BetterFrame/server/src/plugins/service-store
Mitchell R ed2050cfd8
feat(db): full async Repository conversion for PostgreSQL support
Mechanical conversion of the entire data access layer from synchronous
node:sqlite API to async DbAdapter interface. Enables PostgreSQL
(PgAdapter) as a drop-in backend alongside SQLite (SqliteAdapter).

Repository (2208 lines):
  - Constructor accepts DbAdapter instead of DatabaseSync
  - Internal _run/_get/_all/_exec helpers wrap adapter calls
  - All 155 methods converted to async, return Promise<T>
  - transact() uses adapter.transaction() (supports PG savepoints)

14 caller files updated (327 call sites):
  - routes-admin.ts: 202 repo calls + 6 async helper functions
  - service-api-http: 40 repo calls + async getClusterKey
  - routes-firmware.ts, routes-os-updates.ts, routes-auth.ts,
    routes-setup.ts, middleware.ts: all handlers made async
  - shared/auth.ts: resolveSession + revokeSession now async
  - shared/bundle.ts: generateBundle now async, .map→for..of loops
  - shared/pairing.ts: all 3 functions async
  - shared/audit.ts: audit() now async
  - shared/camera-health.ts: checkAll repo calls awaited
  - service-coordinator-ws: session + kiosk lookups awaited
  - service-store/index.ts: creates SqliteAdapter.fromExisting()

SqliteAdapter gains static fromExisting(db) factory for wrapping an
already-opened DatabaseSync (migrations run on raw db, then adapter
wraps for Repository queries).

tsc --noEmit: zero errors.
2026-05-23 02:07:44 +02:00
..
db-adapter.ts feat(store): Postgres adapter foundation + BF_DB selector (phase 1) 2026-05-18 22:50:48 +02:00
index.ts feat(db): full async Repository conversion for PostgreSQL support 2026-05-23 02:07:44 +02:00
mappers.ts feat(security): per-kiosk encryption keys for camera passwords 2026-05-23 01:36:43 +02:00
migrations-pg.ts feat(multi-tenant): schema-per-tenant model + PostgreSQL migration DDL 2026-05-23 01:15:49 +02:00
migrations.ts feat(security): per-kiosk encryption keys for camera passwords 2026-05-23 01:36:43 +02:00
pg-adapter.ts feat(store): Postgres adapter foundation + BF_DB selector (phase 1) 2026-05-18 22:50:48 +02:00
repository.ts feat(db): full async Repository conversion for PostgreSQL support 2026-05-23 02:07:44 +02:00
sqlite-adapter.ts feat(db): full async Repository conversion for PostgreSQL support 2026-05-23 02:07:44 +02:00
util.ts adding initial project 2026-05-10 01:09:13 +02:00