Skip to content

Releases: mojtaba-afraz/doxor.js

v2.0.1

Choose a tag to compare

@github-actions github-actions released this 29 Sep 12:52
Immutable release. Only release title and notes can be modified.
d555114

Patch release: the npmjs.com page for 2.0.0 showed no README, because the release pipeline published the tarball file and npm only reads the README from a directory. There are no code changes.

Full changelog: v2.0.0...v2.0.1

v2.0.0

Choose a tag to compare

@github-actions github-actions released this 29 Sep 12:42
Immutable release. Only release title and notes can be modified.
cc6cf64

doxor.js 2.0 is stable. Typed collections for IndexedDB: declare once, get types, indexes and migrations. About 4.4 kB, zero dependencies.

npm i doxor.js
import { collection, createDB } from 'doxor.js'

const db = createDB({
  name: 'app',
  collections: {
    users: collection<User>().key('id', { autoIncrement: true }).index('email', { unique: true }).index('age'),
  },
})

const id = await db.users.insert({ name: 'Ali', email: 'ali@example.com', age: 30 })
const adults = await db.users.where('age').gte(18).limit(20).toArray()

Highlights

  • Typed from one declaration: records, keys, index names and query values.
  • Automatic schema upgrades: new collections and indexes need no version bumps. Numbered migrations run once and roll back on failure.
  • Queries: ranges, startsWith, anyOf, reverse, offset, limit, filter, count, keys, delete.
  • Transactions: atomic across collections, and they detect an await on non-IndexedDB work.
  • Real errors: DoxorError with stable codes instead of silent failures.
  • Multiple tabs: tabs never block each other's upgrades, and outdated tabs are told so.
  • Everywhere: SSR-safe, ESM, TypeScript. Tested on Chromium, Firefox and WebKit, and published with npm trusted publishing and provenance.

Upgrading from 1.x

2.0 replaces the 1.x callback API. See Migrating from 1.x. Databases created by 1.x keep working when you declare the same shape. 1.x is deprecated and unmaintained.

Links

Playground · README · CHANGELOG · Roadmap issues

Thanks to @MostafaSaadatnia and @arshamalh for their earlier contributions.

Full changelog: v1.0.0-beta-1...v2.0.0

v2.0.0-rc.0

v2.0.0-rc.0 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 29 Sep 12:42
Immutable release. Only release title and notes can be modified.
db32598

Release candidate for doxor.js 2.0.0. No changes since 2.0.0-beta.0; verified on Chromium, Firefox and WebKit.

npm i doxor.js@next

Full changelog: v2.0.0-beta.0...v2.0.0-rc.0

v2.0.0-beta.0

v2.0.0-beta.0 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 29 Sep 12:42
Immutable release. Only release title and notes can be modified.
3f0d75c

Second prerelease of doxor.js 2.0. The public API is now frozen: only bug fixes until 2.0.0.

No changes since 2.0.0-alpha.0.

npm i doxor.js@next

Full changelog: v2.0.0-alpha.0...v2.0.0-beta.0

v2.0.0-alpha.0

v2.0.0-alpha.0 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 29 Sep 12:14
Immutable release. Only release title and notes can be modified.
16fe9e8

doxor.js is back, rewritten from scratch. This is the first prerelease of 2.0: typed collections for IndexedDB with automatic schema upgrades, migrations, queries and transactions, in about 4.4 kB.

npm i doxor.js@next
import { collection, createDB } from 'doxor.js'

const db = createDB({
  name: 'app',
  collections: {
    users: collection<User>().key('id', { autoIncrement: true }).index('email', { unique: true }).index('age'),
  },
})

const id = await db.users.insert({ name: 'Ali', email: 'ali@example.com', age: 30 })
const adults = await db.users.where('age').gte(18).toArray()

Highlights

  • Typed from one declaration: records, keys, index names and query values.
  • No version bookkeeping: new collections and indexes are applied automatically. Numbered migrations run once, in order, and roll back on failure.
  • Promises and real errors: writes resolve after commit. Failures reject with a DoxorError that has a stable code (Constraint, Outdated, SchemaConflict, …).
  • Queries: where() with ranges, startsWith, anyOf, reverse, offset, limit, filter, count, keys, delete.
  • Transactions: atomic across collections, with detection of the classic "awaited a fetch inside a transaction" mistake.
  • Safe across tabs: tabs never block each other's upgrades, and tabs running old code are told they are outdated.
  • SSR-safe, zero dependencies, ESM, TypeScript. Tested on Chromium, Firefox and WebKit.
  • Provenance: published from GitHub Actions with npm trusted publishing, with signed provenance.

Breaking changes

2.0 replaces the 1.x callback API (new Doxor(), Store, Insert, get(…, callback), …). See Migrating from 1.x. Databases created by 1.x keep working when you declare the same shape.

npm i doxor.js (the latest tag) keeps installing the legacy 1.0.0-beta-1 until 2.0.0 is stable.

Try it

This is an alpha: the API may still change before 2.0.0. Feedback and bug reports are very welcome.

Thanks to @MostafaSaadatnia and @arshamalh for their earlier contributions.

Full changelog: v1.0.0-beta-1...v2.0.0-alpha.0

v1.0.0-beta (2022, historical)

Pre-release

Choose a tag to compare

@mojtaba-afraz mojtaba-afraz released this 18 Jul 18:06

Historical pre-release matching npm doxor.js@1.0.0-beta. Callback API: Store / CreateCollection / Insert / get / getAll / remove. Superseded by the v2 rewrite.