A Minimalistic Wrapper for IndexedDB
APACHE-2.0 License
Published by dfahlander over 6 years ago
PR #670: updating hook's onsuccess will get the updated object as documented, instead of the primary key.
PR #672: fix for setByKeyPath when removing array items
Published by dfahlander over 6 years ago
Fix: PR #670: updating hook's onsuccess will get the updated object as documented, instead of the primary key.
Published by dfahlander over 6 years ago
This is the first release after refactored dexie to typescript (Announcement #622, PR #653).
In summary, everything should work the same as latest stable, version 2.0.1.
To install:
npm install dexie@next
Keeping it on new major due to the massive rewrite and possible backward incompatibilities in the typings file (should only concern typescript users though). The only 2 known incompatibilities are:
Published by dfahlander about 7 years ago
Published by dfahlander about 7 years ago
At last, we have version 2.0.0 out and it is way more tested, compliant and bug free than the old 1.x branch.
I would bore you if listing all details since the last stable release (version 1.5.1 in November 2016) so I'll try to summarize it with focus on the most interesting parts:
Unit tests of Binary Keys (IndexedDB 2.0 feature) has been fixed along with some issues in Dexie related to binary key support. Binary Keys are a more optimal way of storing binary data in IndexedDB. IndexedDB 2.0 supports any typed array (such as Uint8Array, Float64Array, etc) as well as ArrayBuffer to be indexed or used as primary key. Browsers that support IndexedDB 2.0 are: Firefox(*), Chrome, Opera and Safari.
(*) Firefox < 57 have an issue with using binary keys as primary keys. This issue was fixed recently and will be solved in Firefox 57 (a future release).
Safari 10.1 is now at last fully IndexedDB compliant and part of the CI tests of Dexie. We run the Safari tests on an IPhone 7 device at browserstack.com. IndexedDBShim is no more needed when targeting latest version of Safari (10.1).
Full test matrix is now:
We use travis ci and browserstack for continous integration and automatic pre-relase tests. If you'd like to extend the test matrix, please file a PR where you add your desired browser to karma.browers.matrix.js. You must also define the browser in karma.browserstack.js. Submitting the PR will tell whether it would work or not (just add your new browser to the "ci" array of karma.browsers.matrix.js and define the same browser in karma.browserstack.js).
NOTE: Integration tests of dexie-observable, dexie-syncable and dexie-relationships are still not tested against the full matrix quite yet.
Dexie.waitFor() makes it possible to call non-indexedDB API:s (promise-returning async API:s!) without loosing the transaction.
Simpler queries like:
await db.friends.where({
name: "Bobby",
age: 42
}).toArray()
will try using a compatible compound index [name+age] if present (and browser supports it), else just utilizing one of the indexes and JS-filter on the second criteriea.
See Table.where()
Simpler way of getting a single row by index instead of primary key:
const foo = await db.friends.get({email: '[email protected]'})
See Table.get()
Improved typescript definitions in general
Much work has been put on rewriting and fixing issues in dexie-syncable and dexie-observable. Thanks @nponiros !
Keeping backward compatibility is a number one priority for Dexie.js, so there are not a lot of API changes. However, some things need to change some time and a few API methods that have been deprecated for a time have gone obsolete. The full list can be viewed here: http://dexie.org/docs/Deprecations
Published by dfahlander about 7 years ago
This is a stability release with:
We will try to get out a 2.0.0 version very soon, as this branch feels way more stable and reliable than the 1.x branch (that is currently still marked as 'latest' on npm).
Safari 10.1 is now at last fully IndexedDB compliant and part of the CI tests of Dexie. We run the Safari tests on an IPhone 7 device at browserstack.com. IndexedDBShim is no more needed when targeting latest version of Safari (10.1).
Full test matrix is now:
We use travis ci and browserstack for continous integration and automatic pre-relase tests. If you'd like to extend the test matrix, please file a PR where you add your desired browser to karma.browers.matrix.js. You must also define the browser in karma.browserstack.js. Submitting the PR will tell whether it would work or not (if adding you new browser to the "ci" array of karma.browsers.matrix.js and defining the same browser in karma.browserstack.js).
NOTE: Integration tests of dexie-observable, dexie-syncable and dexie-relationships are not tested against the full matrix quite yet. Will see if we can improve that somehow before 2.0.0 final.
Unit tests of Binary Keys (IndexedDB 2.0 feature) has been fixed along with some issues in Dexie related to binary key support. Binary Keys are a more optimal way of storing binary data in IndexedDB. IndexedDB 2.0 supports any typed array (such as Uint8Array, Float64Array, etc) as well as ArrayBuffer to be indexed or used as primary key. Browsers that support IndexedDB 2.0 are: Firefox(*), Chrome, Opera and Safari.
(*) Firefox < 57 have an issue with using binary keys as primary keys. This issue was fixed recently and will be solved in Firefox 57 (a future release).
Published by dfahlander over 7 years ago
Fixed bower config to meet best practices (#488) #490
Typings (d.ts) correction of Dexie.exists() and Dexie.delete()#497
Bubble up QuotaExceededError
instead of AbortError: Transaction aborted
#514
Fixes #323
Rather than throwing Unhandled rejection: AbortError: Transaction aborted when the user is out of disk space, the underlying transaction error (QuotaExceededError) is bubbled up. This allows consumers of the Dexie API to identify QuotaExceededErrors and handle them accordingly.
NOTE: I used http://www.cylog.org/utilities/filldisk.jsp to fill up my hard disk to try this code locally.
Update typescript Promise definition #518
Dexie.Promise typings needed adjustments to compile correctly with tsc > v2.3.
Don't use IndexedDBShim just because it's included #511
Resolves #342 and #148
This change is a breaking change (though to the better), since the shim will no more be used on browsers where it's not needed. We need to collect some user feedback about how this affects apps. What we know is that we now go over letting the shim to its job to detect whether it should be applied or not. To be backward compatible, call shimIndexedDB.__useShim(); before including dexie.
Published by dfahlander over 7 years ago
Published by dfahlander over 7 years ago
Much work has been done in this release with dexie-syncable and dexie-observable thanks to @nponiros. Versions 1.0.0-beta.2 of these addons were released together with this dexie-release.
Published by dfahlander almost 8 years ago
A lot of work has been put into dexie-observable and dexie-syncable to fix stability issues and generate typescript definition files for them. We are continuing to improve these addons and approach version 1.0 of them.
The addons have been updated at npm as well and we strongly encourage to upgrade the addons if going up on this version of Dexie.
npm install [email protected]
npm install [email protected]
Published by dfahlander almost 8 years ago
Updated dexie.d.ts with Dexie.waitFor() (#382)
Published by dfahlander almost 8 years ago
More rigorously release notes to come...
To take is short:
New methods:
Note: Dexie.Observable and Dexie.Syncable must be updated to version 0.2.1 to work with this version of Dexie.
Published by dfahlander almost 8 years ago
PrematureCommitError makes it visible when you accedently fall outside the transaction zone and start using the database transactionless without knowing so.
Before, if you'd use a non-Dexie Promise and then continue using database after that, you wouldn't detect that your code runs outside the transaction and the code could succeed silently without you noticing it did stuff transactionless.
Now, if the indexedDB transaction commits before your returned promise is completed, PrematureCommitError will be thrown. That is; if you for example await jQuery.ajax() within your transaction block, the transaction will now fail with PrematureCommitError. In earlier releases, it would sometimes fail with TransactionInactiveError() when this occurred, but only if the zone persisted when trying to do another db call.
Published by dfahlander almost 8 years ago
Stability bugfix of #360.
Published by dfahlander about 8 years ago
Published by dfahlander about 8 years ago
This release is the first maintainence release of Dexie v1.x as version v2.0-beta is being developed on the master branch in parallell. Dexie v1.x is being maintained continously in parallell with the development of 2.x on the master-1
branch.
It's incredibly easy to forget catching promises. The HTML standard has evolved to support a global 'unhandledrejection' event to make sure no error goes unseen for the developer. Dexie 1.5 now supports and embraces the use of this event instead of the previous custom Dexie.Promise.on('error', ...)
.
window.onunhandledrejection = function (event) {
var reason = event.reason;
console.warn('Unhandled Promise Rejection: ' + (reason && (reason.stack || reason));
event.preventDefault(); // Prohibit default handler from logging to console.
};
Works also with window.addEventListener('unhandledrejection', ...);
Works on legacy browsers as well (Tested on IE11, Firefox 45, Edge 13 and Chrome 49).
Search your code for Promise.on('error
, Promise.on("error
or Promise.on.error
to see if you should go over to the standard way instead. I've deprecated Promise.on.error
but it will continue to work in 1.x. In 2.0 it's obsolete.
Published by dfahlander about 8 years ago
First beta-release of the 2.0 track.
Native (or polyfilled) Promise can be safely used within transaction scopes. So for example, the use of Promise.all(...)
would break transaction in Dexie v1.x but works perfectly well in Dexie v2.x without having to do Dexie.Promise.all(...)
. We're solving the browser-issues described in #317 by polyfilling the global Promise to play well with indexedDB transactions within the transaction scope only, and revert the patching for every leave from the transaction scope. This is possible only because of the built-in zone system that Dexie has.
Dexie v2.x will keep using Dexie.Promise, but the work needed retire Dexie.Promise in favour of native Promise has been implemented, and once the problem described in #317 is fully solved widely by the affected browsers (IE, Safari and Firefox) we will do that shift. In the meantime, I've started the mounting down of Dexie.Promise-specific API:s so that the user shouldn't have to think about Dexie.Promise anymore. Code will look the same as soon as we do the switch to native Promise.
Dexie 2.0 is built with backward compatibility in mind, but there are a few things that you would might need to fix before migrating:
A full story of obsolete parts of the API is listed in the wiki under Deprecations. Note that some of the deprecations are still available in 2.0 but are planned to go obsolete in 3.0.
The main reason for the major version increment, else than the obsolete methods, is the new way that db.transaction() works - specifically that it patches the global promise within the transaction zone, wich is a change of a behavior in an existing API. db.transaction() is still backward compatible though and you don't need to change your transaction code.
Published by dfahlander about 8 years ago
Deprecating Promise.on.error and added support for the global unhandledrejection event. Subscribe to the unhandledrejection event instead. This is the standard way of catching unhandled native promise rejections as well.
Published by dfahlander about 8 years ago
Minor version was incremented due to deprecation of APIs (see notes below). Note that those API:s still work and most of them will continue to work also in Dexie 2.x.
Bugfixes:
Build- and deployment tools
Deprecations (See https://github.com/dfahlander/Dexie.js/wiki/Deprecations)
Published by dfahlander about 8 years ago
Resolved issues:
Also: