npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@raincatcher/datasync-client

v1.1.2

Published

Raincatcher datasync client wrapper for TypeScript

Downloads

7

Readme

RainCatcher DataSync

Raincatcher DataSync is based on theFeedhenry sync.js client For advanced usage of the Raincatcher DataSync module, see[FeedHenry Sync] (https://github.com/feedhenry/fh-sync/tree/master/docs) documentation.

Overview

Raincatcher DataSync provides the following functionality:

  • Allows synchronisation of WFM workorder data between the RainCatcher mobile client and the RainCatcher cloud server
  • Allows mobile apps to use and update data offline (local cache)
  • Provides a mechanism to manage bi-directional data synchronization from multiple Client Apps via the Cloud App and into back-end data stores
  • Allows data updates (that is, deltas) to be distributed from the Cloud App to connected clients
  • Provides facilities for managing data collisions from multiple updates in the cloud

This service effectively allows Sync apps to seamlessly continue working when the network connection is lost, and allow them to recover when the network connection is restored.

Getting started with sync

Init sync service

Init sync service to start processing data.

import * as sync from 'fh-sync-js';

// Provide backwards compatibility with upstream documentation and examples
const $fh = { sync };

const options: sync.SyncOptions = {
 cloudUrl: 'http://localhost:3000',
 sync_frequency: 10,
 storage_strategy: 'dom'
};
$fh.sync.init(options);

Register your local data collections

Sync introduces concept of DataSets. DataSets are form of local data collections that will be managed and synchronized with server in sync loop. In the following example,a new UserTasks dataset is registered.

const datasetId = 'UserTasks';
// Parameters for retrieving server data
const queryParams = {};
const metaData = {};

$fh.sync.manage(datasetId, options, queryParams, metaData, function() {
   // callback code
});

Perform operations on datasets

Sync provides a set of methods to perform create, read, update and delete operations on datasets.

// Example object to save
const task: any = {
 name: 'test task',
 status: 'finished'
};

// Create and update object
$fh.sync.doCreate(datasetId, task, function(data) {
   console.log('Data Saved', data);
   $fh.sync.doUpdate(datasetId, data.localId, function(result: any) {
     console.log('Data updated', result);
   }, function(err) {
     console.log('Error when updating data', err);
   });
 }, function(err, data) {
   console.log('Error when saving Data', err);
 });

// Get list of elements
$fh.sync.doList(datasetId,function(res) {
   console.log('Successful result from list:', JSON.stringify(res));
 },
 function(err) {
   console.log('Error result from list:', JSON.stringify(err));
 });

Monitor sync events

Developers can monitor sync specific events and react to them.

$fh.sync.notify(datasetId, function(notification) {
 const code = notification.code;
 if ('sync_complete' === code) {
     console.log("Backend sync was completed");
 }
});

More advanced usages

For advanced usage see FeedHenry Sync documentation.