Skip to content

Replace PouchDB credentials provider with file-backed JSON store#514

Open
fiachra wants to merge 1 commit into
mainfrom
fix/credentials-provider-file-store
Open

Replace PouchDB credentials provider with file-backed JSON store#514
fiachra wants to merge 1 commit into
mainfrom
fix/credentials-provider-file-store

Conversation

@fiachra
Copy link
Copy Markdown
Contributor

@fiachra fiachra commented May 1, 2026

Why

sqlite3@4.2.0 (transitive via pouchdb-adapter-node-websql -> websql) fails
to compile against Node 22/24 V8 headers, breaking npm install for
anyone on a modern Node.

What

  • Replace the PouchDB-WebSQL backend in @medable/mdctl-credentials-provider-pouchdb
    with a small file-backed JSON store. Same exported class, same constructor
    signature, same CredentialsProvider API.
  • One-shot migration from the legacy SQLite store via better-sqlite3
    (declared as optionalDependency, used only for migration). Legacy file
    is renamed (never deleted) with a rollback README.
  • Bump CI matrix to [18, 20, 22, 24]; drop EOL Node 16. Add .nvmrc.
  • Bump all workspace packages to 1.0.75-alpha.0 via lerna.

Test plan

  • 17 unit tests pass on Node 24 (covers store + migration safety)
  • Live migration test against a copy of my real ~/.medable/mdctl.db
    successfully decrypts all 14 credentials
  • npm install succeeds on Node v24.14.0 with no native build failures
  • CI green on Node 18, 20, 22, 24

The transitive sqlite3@4.2.0 (pouchdb-adapter-node-websql -> websql -> sqlite3)
no longer compiles against Node 22/24 V8 headers, breaking `npm install` on
modern Node versions.

Rewrites @medable/mdctl-credentials-provider-pouchdb as an encrypted-at-rest
JSON store. Same exported class name, same constructor signature, same
CredentialsProvider API; PouchDB and its native deps are dropped.
better-sqlite3 is declared as an optionalDependency and used only to read
legacy SQLite stores during a one-shot migration. The legacy file is
renamed to <name>.legacy-<timestamp> after a successful migration and
verified read-back; it is never deleted, and a rollback README is written
alongside it.

Bumps all workspace packages to 1.0.75-alpha.0 (lerna), and CI matrix to
[18, 20, 22, 24]. Adds .nvmrc.
Sign up for free to 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