npm dexie 3.0.0
Dexie v3.0.0

latest releases: 4.0.4, 4.0.3, 4.0.2...
4 years ago

CSP compliance

Dexie is now CSP compliant (#722)

Improved Database Upgrading

It is no longer needed to keep old versions of schemas unless they have an upgrade attached. This is explained in release notes from 3.0.0-rc.3. The docs are updated accordingly.

Also, an old issue with upgrades has been that it was impossible to copy contents from one table to a new one and then remove the old one. This is now fixed, see release notes from [3.0.0-alpha.3] (https://github.com/dfahlander/Dexie.js/releases/tag/v3.0.0-alpha.3))

Typescript

Dexie has been refactored to using Typescript (Announcement #622, PR #653).

Redesign

The big difference in this release from v2.0.4, is how we call IndexedDB. Instead of calling it directly, it will go through a middleware-enabled stack, DBCore.

NOTE: This is an internal redesign. The external API is still the same as in Dexie 2.0 so you won't have to adapt to the new possibilities that comes with this redesign, unless you want to use the new middleware api (Dexie.use()).

This rewrite is part of reaching the goals in vision for dexie, specifically it will enable asynchronic work to be done in a middleware, which is something covered in here.

See new documentation of Dexie.use()

Table.bulkGet()

In response to #833, Table.bulkGet() was added and is a more optimal way than WhereClause.anyOf() when what you need is to fetch several objects with known IDs. The documentation is here

Virtual Indexes

VirtualIndex makes it possible to use the first part of a compound index as if it was an ordinary index.
Dexie will emulate an ordinary index so that it will works with algorithms such as equalsIgnoreCase() etc.

Example:

const db = new Dexie("mydb");
db.version(1).stores({
  friends: '++id, [lastName,firstName]'
});

function findFriendByLastName(prefix) {
   // Note: You can use 'lastName' because it's the first part of a compound index.
   return db.friends.where('lastName').startsWith(prefix);
}

In earlier versions, you would have to specify 'lastName' index side by side with [lastName+firstName]

Issues and fixes since 2.0.4

  • 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
  • #696 Possible to query multiple multiEntry properties using db.table.where({tags: 'browser', categories: 'database'}).
  • #692 Console warnings with indexing advices shall only happen in debug mode.
  • #771 Don't console.warn() unless Dexie.debug is truthy
  • #768 Issues with Collection.raw and Table.mapToClass
  • #612 Native async/await and upgrade handlers
  • #770 Using a database in an upgrade handler prevents subsequent upgrade handlers from running
  • Bugfix for extracting index spec for handling dynamically opened outbound primkeys (commit 9718d95d9b3a434749079a7217412b8c9917c0e6)
  • #811 Dexie does not run under ESNext in Node
  • Fixed CSP compliance (#722)
  • Fixed bug that omitted changes of properties with non-primitive intrinsic types (Date, ArrayBuffer, etc) in call to update hook (#841)
  • Feature: optionally all keys are returned on Table.bulkAdd() and Table.bulkPut() methods (PR #973)
  • Fix for issue 947 (PR #948)
  • Fix #491 (Check that versions given to db.version() is a positive number.)
  • Support Promise.allSettled() and Promise.any() (runtime only. Typings still rely on Typescript lib to support it)
  • Resolves a bug that Dexie may come into a state when it is unable to open a db in case the db exists but has no ObjectStores in it.

Don't miss a new dexie release

NewReleases is sending notifications on new releases.