Releases: TarekRaafat/skalex
v4.0.0-alpha.2
What's changed
Major engine overhaul: 6 internal modules extracted, typed error hierarchy, lazy copy-on-write transactions, dirty tracking, flush sentinel for crash detection, and 31 correctness/hardening fixes across persistence, queries, and indexing.
Breaking Changes
- Date serialization - Date values now persist as tagged objects and load back as
Dateinstances. Alpha.1 stored them as ISO strings. Existing databases auto-migrate on re-save. inferSchemaexport removed - useparseSchemawith an explicit schema definition insteadrestore()throwsQueryError- was genericError; code catchingErrorbroadly is unaffected_idandcreatedAtimmutable on update -updateOne/updateManysilently skip these fields- Mixed operator updates dropped -
{ $inc: 1, name: "x" }as an update value now ignores non-$keys; split into separate calls
Added
- Engine modularisation - monolithic
index.jsdecomposed intoerrors.js,persistence.js,pipeline.js,registry.js,transaction.js,adapters.js - Typed error hierarchy -
SkalexError,ValidationError,UniqueConstraintError,TransactionError,PersistenceError,AdapterError,QueryErrorwith stableERR_SKALEX_*codes - Lazy copy-on-first-write snapshots - transactions only clone collections they touch (up to 100x fewer clones)
- Transaction timeout -
db.transaction(fn, { timeout: 5000 })with stale continuation detection - Dirty tracking - only mutated collections are persisted, reducing I/O proportionally
- Flush sentinel - crash detection via
_metasentinel; warns on nextconnect()if a previous write was interrupted - Batch writes (
writeAll) - adapters use native atomicity (SQLite transaction, D1 batch, LibSQL batch) - Compound indexes - multi-field O(1) lookups via
indexes: [["field1", "field2"]] - Logical query operators -
$or,$and,$notin all query filters - Schema validation on updates - schema rules enforced on
updateOne/updateMany, not just inserts - Named exports - error types and
Collectionavailable as ESM named imports and CJS properties
Fixed
- 6 data corruption fixes (P0): stale Collection instances, upsert operator leak, insertMany index corruption, transaction isolation, stale proxy detection, save durability
- 5 persistence coherence fixes (P1): saveAtomic batch integrity, save mutex, FieldIndex atomicity, changelog restore persistence, save semantics documented
- 2 query/index correctness fixes (P2): plain-object deep equality, compound index non-scalar rejection
- 18 hardening fixes (P2.5): ifNotExists copy safety, aggregation auto-connect, dot-notation index rejection, connect idempotency, vector select stripping, recursive prototype pollution defense, system field enforcement, dump deep copies, and more
Tests
- 82 new tests (571 -> 653 total), 4 new test files
- Cross-runtime smoke suite: 229 checks across Node.js, Bun, Deno, and headless Chromium (ESM + UMD)
Install: npm install skalex@alpha
Full changelog: https://github.com/TarekRaafat/skalex/blob/master/CHANGELOG.md
Docs: https://tarekraafat.github.io/skalex
v4.0.0-alpha.1
What's changed
This patch fixes all known transaction correctness issues discovered after the initial v4.0.0-alpha release.
Fixed
- autoSave suppressed during
fn()- writes no longer flush mid-transaction; adapter written once on commit structuredClonereplacesJSON.parse/stringifyfor snapshots - Date, TypedArray, Map, Set, RegExp survive rollback correctly_inTransactionflag - correctly guards_saveIfNeeded()in all collection operations- Events and hooks deferred until commit -
watch()observers andafter*plugin hooks no longer fire for rolled-back writes - Concurrent transactions serialised - promise-chain mutex eliminates lost-update races under
Promise.all db.collectionsblocked insidefn()via Proxy - throws a descriptive error directing callers todb.useCollection()- Commit sequence corrected -
saveData()runs before side-effect queue is flushed; observers see fully persisted state restore()uses transaction helpers - events and changelog entries are properly deferred until commit- BigInt-safe default serializer -
JSON.stringify/JSON.parsereplaced with tagged-object encoding that round-trips BigInt values - Transaction guarantees in docs corrected - removed inaccurate "atomic" language across README, llms.txt, and docs
Tests
13 new integration tests covering all of the above fixes.
Full changelog: https://github.com/TarekRaafat/skalex/blob/master/CHANGELOG.md
Skalex v4.0.0-alpha
AI-first rewrite of Skalex. This is the first alpha release of v4.
What's new in v4:
- Vector search with cosine similarity + hybrid filtering
- Agent memory: remember/recall/compress with semantic embeddings
- db.ask() - natural language queries via any LLM
- MCP server for Claude Desktop, Cursor, and any MCP client
- AnthropicLLMAdapter, OpenAILLMAdapter, OllamaLLMAdapter built in
- AES-256-GCM at-rest encryption via EncryptedAdapter
- BunSQLiteAdapter, D1Adapter, LibSQLAdapter storage backends
- Plugin system with pre/post hooks on all operations
- Per-session stats, slow query log, changelog, soft deletes
- Full cross-runtime support: Node.js 18+, Bun, Deno 2.x, browsers, edge
Install:
npm install skalex@alpha
Full changelog: https://github.com/TarekRaafat/skalex/blob/master/CHANGELOG.md
Docs: https://tarekraafat.github.io/skalex