Release Notes (Developer Guide) โ
What changed in recent FLASH releases and how to adopt it in your apps.
Current version: 1.0.0 ยท Tests: 155/155
v1.0.0 โ npm @moaaz-i/flash-db โ
npm rejected the unscoped name flash-db (too similar to the existing flashdb package). The official npm name is @moaaz-i/flash-db.
npm install @moaaz-i/flash-dbimport { FlashClient } from "@moaaz-i/flash-db";v1.3.2 โ Default Buffer Pipeline โ
Summary โ
The engine now keeps records as FlashBinary Buffers end-to-end. The SDK still accepts and returns plain JavaScript objects โ conversion happens once at the client boundary.
Your app (object) โ encryptToBuffer() โ Buffer โ WAL / SSTable
WAL / SSTable โ Buffer โ decryptFromBuffer() โ Your app (object)New APIs โ
| API | Where | Purpose |
|---|---|---|
client.encryptToBuffer(doc) | FlashClient | Plain doc โ encrypted Buffer (one serialize) |
client.decryptFromBuffer(buf) | FlashClient | Encrypted Buffer โ plain doc (partial field read) |
FlashRecordCodec | export | Low-level encode/decode helpers |
FlashBinary.decodeRecord(buf) | export | Engine buffer โ object (for SQL/Wire/etc.) |
FlashBinary.decodeRecords(bufs) | export | Batch decode |
Behavior changes (low-level) โ
If you use FlashCollection directly (not FlashClient.collection()):
| Method | Before | Now |
|---|---|---|
find() | object[] | Buffer[] |
findOne() | object | null | Buffer | null |
insertOne() | object only | object | Buffer |
insertMany() | object[] only | (object | Buffer)[] |
Use FlashBinary.decodeRecord() when you need plain objects from engine buffers.
Remote / FlashServer wire format โ
Records over HTTP are sent as:
{ "_flashRecord": "<base64 FlashBinary buffer>" }The remote client decodes automatically. No app changes if you use FlashClient with uri.
insertMany over remote uses POST /api/v1/insertMany/:collection (single round-trip batch).
Performance (v1.3.2) โ
| Feature | API |
|---|---|
| Turbo profile | engineOptions: { performanceProfile: 'turbo' } |
| In-memory engine | inMemory: true or storagePath: ':memory:' |
| Lazy field decrypt | .select('field1 field2') |
| Partial buffer decrypt | FlashRecordCodec.decryptFields() / decryptFieldsFromBuffer() |
| Skip Merkle (turbo) | disableMerkle: true (turbo default) |
See Foundations ยง15.
Compact storage (storageProfile: 'compact') โ
Minimal on-disk footprint โ use for bulk archives and non-searchable payloads:
const client = new FlashClient({
secretKey: "key",
storageProfile: "compact",
fieldPolicy: {
title: "exact", // equality search only
body: "encrypted", // encrypt only โ smallest
tags: "plaintext", // compressible metadata
},
engineOptions: { compressionLevel: 6 },
});| Policy | Blind index | Typical size vs searchable |
|---|---|---|
encrypted / zk-secret | none | ~5โ15ร smaller (strings) |
exact | exact trapdoor only | ~3โ8ร smaller |
searchable | exact + ngrams + range | baseline |
plaintext | none | smallest + SSTable compresses |
Plugin hooks โ
beforeUpdate and afterUpdate are fully supported:
client.use({
name: "audit",
beforeUpdate(doc, col, previous) {
doc.lastEditedBy = "system";
return doc;
},
afterUpdate(doc, col) {
console.log("updated", doc._id);
},
});TypeScript โ
FlashQueryWhereBuilder<T>โ fixes fluent.where().gt()typingFlashRecordCodec,encryptToBuffer,decryptFromBufferFlashCollectionbuffer return typesFlashPlugin.afterUpdateFlashDatabaseconstructor acceptsengineOptions
See Buffer Pipeline and TypeScript Support.
v1.3.1 โ Engine Fixes + Foundations โ
Bug fixes โ
| Issue | Fix |
|---|---|
| TTL only scanned memtable | TTL sweeps memtable + SSTables |
getMerkleProof() async bug | Sync returns null if dirty; use getMerkleProofAsync() |
count() loaded all docs | Uses engine count() when no filter |
Missing beforeUpdate hook | Added on updateOne |
Schema expireAfterSeconds | Also registers lifecycle() |
New client foundations โ
| API | Use case |
|---|---|
client.eventLog(name) | Append-only time-ordered stream |
client.counter(name) | Atomic counters |
client.queue(name) | FIFO jobs with ack/fail |
client.health() | Engine capacity report |
client.snapshot() | .flashpack export/import |
autoTimestamps: true (default) | Auto createdAt / updatedAt |
v1.3.0 โ Universal Foundations (Cross-Domain) โ
Introduced generic primitives instead of domain-named modules:
lifecycle(),paginate(),maintenance(),pipeline()events(),use()plugins,tenant()- Positioning as zero-knowledge encrypted intelligence DB
Migration checklist โ
From โค1.3.0 โ 1.3.2 โ
- No breaking changes if you only use
FlashClient.collection()CRUD. - Engine-level code (
FlashDatabase.collection().find()): decode buffers withFlashBinary.decodeRecord(). - Custom server clients: expect
_flashRecordbase64 over REST if reading raw responses. - Enable timestamps: default on โ pass
autoTimestamps: falseto disable. - Run tests after upgrade; 146 tests cover buffer + remote + foundations paths.
Recommended client setup (2026) โ
import { FlashClient } from "@moaaz-i/flash-db";
const client = new FlashClient({
secretKey: process.env.FLASH_SECRET_KEY,
storagePath: "./data",
engineOptions: { durability: "balanced" },
autoTimestamps: true,
});
// Foundations
client.maintenance({ autoStart: true });
const log = client.eventLog("events");
const jobs = client.queue("tasks");