Skip to content

Releases: TarekRaafat/skalex

v4.0.0-alpha.2

09 Apr 14:10

Choose a tag to compare

v4.0.0-alpha.2 Pre-release
Pre-release

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 Date instances. Alpha.1 stored them as ISO strings. Existing databases auto-migrate on re-save.
  • inferSchema export removed - use parseSchema with an explicit schema definition instead
  • restore() throws QueryError - was generic Error; code catching Error broadly is unaffected
  • _id and createdAt immutable on update - updateOne/updateMany silently 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.js decomposed into errors.js, persistence.js, pipeline.js, registry.js, transaction.js, adapters.js
  • Typed error hierarchy - SkalexError, ValidationError, UniqueConstraintError, TransactionError, PersistenceError, AdapterError, QueryError with stable ERR_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 _meta sentinel; warns on next connect() 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, $not in all query filters
  • Schema validation on updates - schema rules enforced on updateOne/updateMany, not just inserts
  • Named exports - error types and Collection available 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

01 Apr 10:35

Choose a tag to compare

v4.0.0-alpha.1 Pre-release
Pre-release

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
  • structuredClone replaces JSON.parse/stringify for snapshots - Date, TypedArray, Map, Set, RegExp survive rollback correctly
  • _inTransaction flag - correctly guards _saveIfNeeded() in all collection operations
  • Events and hooks deferred until commit - watch() observers and after* plugin hooks no longer fire for rolled-back writes
  • Concurrent transactions serialised - promise-chain mutex eliminates lost-update races under Promise.all
  • db.collections blocked inside fn() via Proxy - throws a descriptive error directing callers to db.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.parse replaced 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

31 Mar 15:05

Choose a tag to compare

Skalex v4.0.0-alpha Pre-release
Pre-release

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