@dfahlander dfahlander released this Sep 22, 2017 · 110 commits to master since this release

Assets 2

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:

Support for native and transpiled async / await

  • Use async functions within database transactions without loosing track of current ongoing transaction.
  • Compatible with Typescript 2.x, 1.x and babel.
  • Compatible with even native async / await across all browser inluding Safari, Chrome, Edge and Firefox*. Firefox still suffers from this issue which makes native await calls loose the transaction. This is something that only can be adressed by the Mozilla team. NOTE: You can still do async/await within transactions and target Firefox - just make sure to not use native async/await, but transpile it to ES5 or ES6 using a transpiler such as Babel or Typescript!

IndexedDB 2.0 support

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).

Native Safari (including Iphone) Support

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:

BrowserVersionOSAuto-tested for each PRTested on publish (publish.sh)
Firefox 47 Debian
Internet Explorer 11 Windows 7
Firefox 55 Windows
Safari 10.1 iOS
Firefox 47 OS X
Microsoft Edge 15 Windows 10
Chrome 49 OS X
Chrome 60 Windows

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.

A pick of other news...

  • 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: 'foo@bar.com'})

    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 !

Backward Compatibility

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