Files
stack/packages/storage
Jarvis 72e365438c refactor(storage): replace better-sqlite3 with PGlite adapter
Eliminates the `prebuild-install` deprecation warning that appears during
`mosaic gateway install` by removing `better-sqlite3` from the dependency
graph entirely and replacing the SqliteAdapter with a PGlite-based adapter
that mirrors the same interface and test coverage.

- New `PgliteAdapter` in `packages/storage/src/adapters/pglite.ts` using
  `@electric-sql/pglite` with JSONB columns and pg-style `$N` placeholders
- Ported all 18 adapter tests to `pglite.test.ts` (in-memory PGlite instances)
- Deleted `sqlite.ts` and `sqlite.test.ts`
- Updated `StorageConfig` discriminated union: `sqlite` → `pglite` with optional
  `dataDir` (absent = in-memory)
- `packages/storage/index.ts` re-exports `PgliteAdapter` and registers it
- CLI install wizard writes `{ type: 'pglite', dataDir: '…/storage-pglite' }`
- Removed `better-sqlite3` and `@types/better-sqlite3` from storage deps;
  added `@electric-sql/pglite@^0.2.17`
- Removed `pnpm.onlyBuiltDependencies: ["better-sqlite3"]` from root package.json
- Bump `@mosaic/storage` 0.0.2 → 0.0.3
- Bump `@mosaic/gateway` 0.0.3 → 0.1.0 (minor — storage dialect change)

Breaking: local-tier `data.db` SQLite files are not migrated. Clean break.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 16:44:48 -05:00
..