v3.0.0 — TypeScript port
TypeScript port of v2.x. No API changes — same default connect export, same withClient, updateMutation, and friendlyError. Consumers upgrade by swapping @mabulu-inc/db → @smplcty/db.
What changed
- Source is now TypeScript (
src/*.ts), compiled todist/viatsc. Type declarations ship in the package. pgis now a peer dependency (was a direct dep). Installpgin the consuming service.- No more
dotenv. Load.envat the edge of your application, not inside a library. - Tests migrated to vitest — unit tests for
updateMutationandfriendlyError, integration tests against a real Postgres (docker-compose locally, service container in CI) forwithClientandfriendlyErrorround-tripping real pg error codes. withClientis now generically typed —withClient<T>(pool, fn)infersTfrom the callback's return type.updateMutationexports aFieldSpectuple type so consumers get type-checked fieldsets.friendlyErrorexportsPgErrorLike,ERROR_CODES, andMESSAGESso consumers can extend or override the mapping.- CI and publish workflows matching the fleet baseline: lint, typecheck, gitleaks full-history scan, build, tests against a Postgres service container, OIDC trusted publishing with provenance, and a non-blocking
pnpm outdatedadvisory.
Scope
@smplcty/db stays a thin pg helper. It does not know about sessions, roles, RLS, or GUCs — that layering lives in @smplcty/auth via withSession. Use withClient for background jobs and migrations; use withSession for anything that talks to tenant data.
Migration
pnpm remove @mabulu-inc/db && pnpm add @smplcty/db- Ensure
pgis a direct dependency of your service (was previously transitive). - If you were relying on the package to load
.env, switch tonode --env-file=.envor loaddotenvexplicitly at your entry point. - Update imports from
@mabulu-inc/dbto@smplcty/db.