Repository navigation
Releases: mojtaba-afraz/doxor.js
Release list
v2.0.1
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
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.jsimport { 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
awaiton non-IndexedDB work. - Real errors:
DoxorErrorwith 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
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@nextFull changelog: v2.0.0-beta.0...v2.0.0-rc.0
v2.0.0-beta.0
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@nextFull changelog: v2.0.0-alpha.0...v2.0.0-beta.0
v2.0.0-alpha.0
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@nextimport { 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
DoxorErrorthat has a stablecode(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)
Historical pre-release matching npm doxor.js@1.0.0-beta. Callback API: Store / CreateCollection / Insert / get / getAll / remove. Superseded by the v2 rewrite.