A cross-browser/platform indexeddb-like client library
Перейти к файлу
Mukundan Kidambi a037ade456
Merge pull request #5 from Caseyyu2/xiyu/add-getmultiple-api-support
Adding index support to getMultiple API. This allows developers to fetch multiple entries for a specific set of keys on any index in the schema (earlier you could only fetch on the primary index).
2020-09-03 12:11:38 -07:00
.vscode adding getMultiple API support and unit test 2020-08-26 16:01:03 -07:00
dist adding unit tests 2020-09-02 14:56:48 -07:00
src adding comments to explain why call getOnly for fakeComplicatedKeys 2020-09-02 18:18:56 -07:00
.gitignore Checking in the dist folder as a temp mitigation. 2019-04-18 11:26:46 -07:00
.npmignore 0.3.5: Actually fixing npm dist 2016-12-23 02:11:36 -08:00
.npmrc 0.6.0: Changing to not have all of the various getters have templated… (#35) 2017-10-11 16:51:41 -07:00
.travis.yml travis ci support (#39) 2018-01-24 21:24:29 -07:00
LICENSE Updating LICENSE with LCA-approved language 2016-01-05 16:38:12 -08:00
README.md Minor updates to readme. 2019-03-05 17:08:58 -08:00
index.ts Fixing up UTs. 2019-03-22 17:29:43 -07:00
package.json Merge remote-tracking branch 'upstream/master' into xiyu/add-getmultiple-api-support 2020-08-26 16:54:16 -07:00
test.html adding scenario for indexeddb with fake keys and updating the test.html 2020-08-31 16:53:48 -07:00
tsconfig.json Changes: 2019-08-13 10:54:51 -07:00
tslint.json adding unit tests 2020-09-02 14:56:48 -07:00
webpack.config.js Add doNotBackfill to index schema (#57) 2018-09-12 13:59:03 -07:00
yarn.lock Fixing up yarn lock 2020-03-09 17:57:50 -07:00

README.md

NoSQLProvider Build Status

We developed NoSQLProvider after needing a simplified interface to NoSQL-style object storage/retrieval that worked not only across all browsers, but also for native app development (initially Cordova-based, later moving to React Native.) Across the browsers, this required unifying WebSQL and IndexedDB, with the nuances of all the different IndexedDB issues (on IE, mostly, with not properly supporting compound keys and multi-entry indexes, and Safari having basically completely broken keyspace support.) On native platforms and NodeJS, we fully wrap several different SQLite-based providers, depending on the platform. We also have built a fully in-memory database provider that has no persistence but supports fully transactional semantics, for a fallback in situations where you don't want persistence (ephemeral logins, etc.)

Removed support for ReactNative and SqlLite/WebSQL support.

As part of this work, we had to develop SyncTasks as a complete promise library that spurns the A+ convention of deferring all resolutions/rejections to the event loop. This is because IndexedDB's transactional semantics are such that if control is ever returned to the event loop without a pending query, the transaction is automatically closed. As such, if you defer resolution of a query, then the transaction closes before you can issue followup queries against it. To avoid this, we required synchronous resolution of promises, and SyncTasks gives us the ability to chain commands on a single transaction. Given that IndexedDB was the most limiting transactional scenario that we needed to support, we followed that pattern with all of the other database providers, and designed them such that returning control to the event loop without issuing followup queries automatically resolves the transaction.

The bugs that were causing the above transaction closures are now fixed on most major browsers (recent versions). Hence this version of NoSQLProvider removes it. Here is a link to the bug : https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/

At this point, known feature work is complete and we are mostly just fixing bugs on the platform moving forward. If you have feature requests, feel free to file them, just make sure that you have behavior determined across all providers as part of your request, since all features need to be able to work across all the different providers.

Examples

The only current full example is available as part of the ReactXP samples, the TodoList sample app. If you pick up NoSQLProvider and use it in your open source application, please let us know so we can add more example links here!

Providers/Platforms/Support

We will soon list all of the providers available out of the box here, and list what platforms they can be used on, with any nuances of that platform.

Usage

Coming soon.

Compiling

Source

npm install
npm run build

Tests

npm install
npm run webtest

Testing

  1. Compile tests
  2. Open test.html in browser
  3. You can add ?grep=foo to the URL to run only tests containing 'foo' in the name