Giter Site home page Giter Site logo

feathersjs-offline / owndata-ownnet Goto Github PK

View Code? Open in Web Editor NEW
17.0 4.0 4.0 1.04 MB

This repository holds the necessary tools to bring own-data/own-net offline-first to FeathersJS applications.

Home Page: https://feathersjs-offline.github.io/docs/

License: MIT License

JavaScript 100.00%
feathers offline-first mobile mutations realtime

owndata-ownnet's Introduction

Server npm version Build Status Dependency Status Known Vulnerabilities Maintainability Test Coverage Download Status lerna

Client npm version Build Status Dependency Status Known Vulnerabilities Maintainability Test Coverage Download Status lerna

Feathers offline-first own-data / own-net

These packages implements the offline-first own-data / own-net principles on CRUD methods on any Feathers database adapter. It consist of two parts; one for the server services and one for the client counterparts.

Installation

Go to the packages to see the details:

  • Server is here on Git and here on NPM
  • Client is here on Git and here on NPM

You'll need both to be able to a fully functional own-dataor own-net offline-first implementation in your own app.

Example

You can see an example showcasing Feathers offline-first here

Documentation

You can read the original docs here discussing the theories behind it all. The new and updated documentation is available here.

Summary:

own-data / own-net are two related strategies implemented in Feathers Offline-first. Both strategies queues CRUD events for a wrapped service locally until the device have connection to the server, but to the user the CRUD events are executed immediately using optimistic mutation strategy.

own-data will re-play all queued event to the server in the order they were performed in offline mode. This allows the the server to react on each event (mutation). It may, for example, run hooks which send emails on certain mutations.

own-net on the other hand will only play the end result of all queued events for a given item (ie. row or document) to the server. If an item (document) is mutated 5 times only the result will reach the server when connection is established. If a record is patched and finally removed while still offline, the server will never see the mutations. The server may still react on each event (mutation), but bear in mind the changes are possibly only net changes. own-net usually results in much shorter synchronization times and reduced traffic between client and server.

License

Copyright (c) 2020

Licensed under the MIT license.

owndata-ownnet's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar mhillerstrom avatar tr3ffel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

owndata-ownnet's Issues

implementation issues on server side

Hi, I'm currently testing this new library and discovered two problems while implementing it on server side.

Problem 1:

setup(app, path) is not called for the wrapped service which is important if you want to access the app object inside a service method (i.e. for internally calling other services).
I've created a Pull Request for this. I hope it helps.

Problem 2:

For some reason all my hooks are getting ignored if I call my wrapped service via Postman (HTTP). Also context.path is undefined for the request which should normally contain the service name.
But if I call the service via socket.io everything works fine. This problem also seems to be present in the simple-example repository. I could not find out why this happens, so I hope someone else could maybe fix this problem.

And thanks for the effort making this library. It would be great for many people not having to manually programming all the code for offline-first applications.

fs package issue under LocalStorage

This is in relation to the error discussed here.

#44

I managed to get rid of the error regarding node-localstorage by installing these packages.

assert, constants, events, path, stream, and fs

however, the package fs has a security issue and it is now suggested to use fs-extra. . now I get a new error.

Screen Shot 2021-07-20 at 1 45 59 PM

I am now clueless as to what to do. Here is my repo

https://github.com/messycoding/myfeathersofflinefirstproject

Note: This error will only show if I call

owndataWrapper(app, '/messages', {});

Replacing local storage

Maybe it is a dumb question, but is it possible to use IndexedDB in place of LocalStorage? (to overcome quota limits) Or maybe PouchDB? (standalone, without sync)

context.params being overwriten on fixParams method

Steps to reproduce

  • Add any property to context.params.
  • Try to access it after wrapping the service.

Expected behaviour

According to the docs, context.params is writable, so it should not be totally overwritten.

Actual behaviour

The method fixParams at server/src/index.js is overwriting the params preserving only query and paginate properties.

Module versions:
"@feathersjs-offline/server": "^1.0.6",

NodeJS version:
v12.20.2

Not working with v5 (Dove)

Steps to reproduce

  • Cloned this repo
  • Updated all @feathersjs dependencies to v5.0.0-pre.17
  • Ran node server
  • Server throws 'Path <path> already exists' error:

Expected behaviour

To work with upcoming Feathers v5

Actual behaviour

Server throws an error:

.../simple-example/node_modules/@feathersjs/transport-commons/lib/routing/router.js:15
                throw new Error(`Path ${path.join('/')} already exists`);
                ^

Error: Path messages already exists
    at RouteNode.insert (.../simple-example/node_modules/@feathersjs/transport-commons/lib/routing/router.js:15:23)
    at RouteNode.insert (.../simple-example/node_modules/@feathersjs/transport-commons/lib/routing/router.js:34:22)
    at Router.insert (.../simple-example/node_modules/@feathersjs/transport-commons/lib/routing/router.js:68:26)
    at Function. (.../simple-example/node_modules/@feathersjs/transport-commons/lib/routing/index.js:34:20)
    at .../simple-example/node_modules/@feathersjs/feathers/lib/application.js:70:38
    at Array.forEach ()
    at Function.use (.../simple-example/node_modules/@feathersjs/feathers/lib/application.js:70:21)
    at Function.use (.../simple-example/node_modules/@feathersjs/express/lib/index.js:75:25)
    at realtimeWrapper (.../simple-example/node_modules/@feathersjs-offline/server/lib/index.js:306:9)
    at Function.module.exports (.../Apps/simple-example/server/services/messages/messages.service.js:17:3)

ownnetWrapper id-property isnt applied locally

Hi, one of my first issues on Github. Hope doing nothing wrong! Thanks!

Steps to reproduce

  1. Using ownnetWrapper and set optional options-id-field
this.service = feathersjsOfflineClient.ownnetWrapper(this.baseService.client, 'projects', {
        id: "_id"
});
  1. use service.create({data})
  2. view generated object in localstorage
  3. "uuid" ist set, but "_id" is null

Expected behaviour

Docu says: Pro tip: If your key is not uuid then you have to manually set the key on the client before calling create as you have no guarantee that the backend answers. You set your key with the id parameter.

-> So i think the given field in the setup options field "id" should be used.

Actual behaviour

--> Default field "uuid" ist used.

System configuration

Module versions (especially the part that's not working): @feathersjs-offline/[email protected]

Operating System: Linux Mint 19

Browser Version: Google Chrome Version 86.0.4240.111 (Official Build) (64-Bit)

React Native Version: Using lit-Element with Ionic

Module Loader: Webpack

Help owndataWrapper or ownnetWrapper not working

Please look in to my issue again regarding owndataWrapper and ownnetWrapper, both do not work.

#43

There is this:

Error: Unable to resolve module path from /Users/neil/Documents/TESTING/NODE/offlinefirst/offlinefirst/node_modules/node-localstorage/LocalStorage.js: path could not be found within the project or in these directories:
node_modules

I already tried installing node-localstorage but still not working.

Unable to get it working, error whenever I use it

Steps to reproduce

(First please check that this issue is not already solved as described
here
)

  • Tell us what broke. The more detailed the better.
  • If you can, please create a simple example that reproduces the issue and link to a gist, jsbin, repo, etc.

Expected behaviour

There is should be no error when using

import { owndataWrapper } from '@feathersjs-offline/client';
owndataWrapper(app, '/messages', {});

Actual behaviour

The app crash and the error is this.

Screen Shot 2021-07-15 at 2 43 52 PM

This error shows whenever I call.
Owndata(app, '/messages', {});

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):
"@feathersjs-offline/client": "1.0.7"

NodeJS version:
v14.16.0

Operating System:
macbook catalina 10.15.7

Browser Version:

React Native Version:
"react-native": "0.64.2"

Module Loader:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.