Skip to content

feat!: 2.0 — both-engines config, sqlSwitch rename, db.reconnect() - #20

Merged
revxshafi merged 2 commits into
mainfrom
feat/2.0-release
Aug 26, 2026
Merged

feat!: 2.0 — both-engines config, sqlSwitch rename, db.reconnect()#20
revxshafi merged 2 commits into
mainfrom
feat/2.0-release

Conversation

@revxshafi

Copy link
Copy Markdown
Collaborator

Summary

Breaking 2.0 release. Reshapes the config to declare both engines up front, renames the factory, and adds a db.reconnect() primitive.

  • Config reshape (breaking):DALConfig.db is now a 'local' | 'cloud' selector with local? / cloud? blocks declared alongside it. The per-block mode field is removed. Every declared block is validated eagerly at connect(), so a bad cloud connectionString is caught at boot even while running db: 'local'; db: 'cloud' with no cloud block throws ConfigurationError.
  • createDAL()sqlSwitch():sqlSwitch is the factory and default export. createDAL stays as a one-line @deprecated alias (removed in 3.0).
  • db.reconnect(target?): one primitive for three jobs — restart a wedged connection, recover a lost one, or repoint to the other declared engine without moving data. Fail-safe: the replacement engine is built and validated before the old one is torn down, and pending writes are flushed first. engineSwap() stays a pure data-mover.
  • Docs + version: README, CHANGELOG.md (2.0.0 entry + migration notes), CLAUDE.md public-API invariant; bumped to 2.0.0 across root + scoped package (version + dep pin).
  • SVG fixes:architecture.svg engineSwap caption shrunk to 13px so "resumable" stops overflowing; "collapses repeats" → "collapse repeats". hero.svg drops the hand-edited npm 1.0.1 chip for the always-true ESM + CJS, and mode:db: to match the 2.0 shape.

Related issue

none

Type of change

  • Breaking change (fix or feature that changes existing behavior or the public API)
  • Documentation only (SVG + README + CHANGELOG)

How it was tested

pnpm check # Biome lint + format — clean
pnpm typecheck # tsc --noEmit on src/ + scripts — 0 errors
pnpm build # tsup dual CJS/ESM — ok
pnpm docs # TypeDoc zero warnings — ok

Logic + fakedriver tests pass locally (including the new test/reconnect.test.ts and test/factory-rename.test.ts). The real-SQLite/Postgres integration matrix could not run in the Replit sandbox (native better-sqlite3 ABI mismatch segfaults the Vitest fork) — that matrix runs authoritatively in CI on Node 22/24 once this lands on main.

Checklist

  • Tests added or updated for the change
  • Docs / TSDoc updated where relevant
  • TypeDoc still builds at zero warnings (pnpm docs)
  • Public API surface (src/database/index.ts) changes are intentional and called out above
  • Follows the conventions in CLAUDE.md

Supersedes #19 (rebased onto current main to drop a duplicate README commit that was showing as a conflict).

BREAKING CHANGE: DALConfig.db is now a 'local' | 'cloud' selector with
local?/cloud? blocks declared alongside it; the per-block `mode` field is
removed. Every declared block is validated eagerly at connect(), and a
db: 'cloud' with no cloud block throws ConfigurationError.
- rename createDAL() -> sqlSwitch() (factory + default export); createDAL
kept as a one-line @deprecated alias, removed in 3.0
- add db.reconnect(target?): restart / recover a wedged connection, or
repoint to the other declared engine without moving data. fail-safe
(new engine built + validated before the old one is torn down) and
flushes pending writes first. engineSwap() stays a pure data-mover.
- bump to 2.0.0 across root + scoped package (version + dep pin)
- docs: README, CHANGELOG 2.0.0 entry, CLAUDE.md public-API invariant
- tests: reconnect.test.ts + factory-rename.test.ts
- architecture.svg: shrink the engineSwap caption to 13px so "resumable"
stops overflowing the box; "collapses repeats" -> "collapse repeats" so
the "w" in "now" no longer touches the card edge
- hero.svg: replace the hardcoded "npm 1.0.1" (had to be hand-edited every
release) with the always-true "ESM + CJS"; a live version belongs in a
shields.io README badge, not a static committed SVG
- hero.svg: mode: 'local'/'cloud' -> db: 'local'/'cloud' to match the 2.0
both-engines config shape
@revxshafirevxshafi mentioned this pull request Aug 26, 2026
11 tasks
@revxshafi
revxshafi merged commit cab2923 into mainAug 26, 2026
9 checks passed
@revxshafi
revxshafi deleted the feat/2.0-release branch August 26, 2026 10:49
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@revxshafi