Skip to content

Releases: mabulu-inc/simplicity-db

Release 4.3.0

Choose a tag to compare

@SamMaxwell SamMaxwell released this 13 Jun 18:03

Added

  • Optional ON CONFLICT DO NOTHING race backstop in upsertMutation.
    Pass { onConflict: 'DO NOTHING' } to append ON CONFLICT DO NOTHING
    to the generated INSERT (default: omitted, so existing output is
    unchanged). This is a complement to the always-present
    WHERE NOT EXISTS, not a replacement: WHERE NOT EXISTS still prevents
    serial/bigserial sequence churn, while ON CONFLICT DO NOTHING closes
    the concurrency race where two writers both pass the not-exists check
    and then collide on the unique constraint. It only affects the insert
    half.

Changed

  • Generated SQL now uses uppercase keywords (SELECT, INSERT INTO,
    WHERE NOT EXISTS, IS DISTINCT FROM, …) across updateMutation and
    upsertMutation. Purely cosmetic — the statements are semantically
    identical — but any test or snapshot asserting on the old lowercase
    output needs updating.

Release 4.2.0

Choose a tag to compare

@SamMaxwell SamMaxwell released this 08 Jun 21:08

What's Changed

  • fix: resolveDatabaseUrl drops silent 'postgres' dbname fallback by @SamMaxwell in #16

Full Changelog: v4.1.0...v4.2.0

Release 4.1.0

Choose a tag to compare

@SamMaxwell SamMaxwell released this 08 Jun 20:31

What's Changed

  • feat: derived & input-only columns in the upsert generator by @SamMaxwell in #14

Full Changelog: v4.0.0...v4.1.0

Release 4.0.0

Choose a tag to compare

@SamMaxwell SamMaxwell released this 08 Jun 19:29

What's Changed

  • feat: scalar params for upsertMutation + copy-free classifyPgError by @SamMaxwell in #12

Full Changelog: v3.1.0...v4.0.0

Release 3.1.0

Choose a tag to compare

@SamMaxwell SamMaxwell released this 08 Jun 17:17

What's Changed

  • ci: refuse to publish when tag isn't on main by @SamMaxwell in #2
  • feat: pool options, secret resolution, withTransaction, bulk upserts, typed pg-error classification by @SamMaxwell in #7
  • docs: Astro Starlight docs-site on GitHub Pages by @SamMaxwell in #9

New Contributors

Full Changelog: v3.0.0...v3.1.0

v3.0.0 — TypeScript port

Choose a tag to compare

@SamMaxwell SamMaxwell released this 09 Apr 21:41

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 to dist/ via tsc. Type declarations ship in the package.
  • pg is now a peer dependency (was a direct dep). Install pg in the consuming service.
  • No more dotenv. Load .env at the edge of your application, not inside a library.
  • Tests migrated to vitest — unit tests for updateMutation and friendlyError, integration tests against a real Postgres (docker-compose locally, service container in CI) for withClient and friendlyError round-tripping real pg error codes.
  • withClient is now generically typedwithClient<T>(pool, fn) infers T from the callback's return type.
  • updateMutation exports a FieldSpec tuple type so consumers get type-checked fieldsets.
  • friendlyError exports PgErrorLike, ERROR_CODES, and MESSAGES so 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 outdated advisory.

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

  1. pnpm remove @mabulu-inc/db && pnpm add @smplcty/db
  2. Ensure pg is a direct dependency of your service (was previously transitive).
  3. If you were relying on the package to load .env, switch to node --env-file=.env or load dotenv explicitly at your entry point.
  4. Update imports from @mabulu-inc/db to @smplcty/db.

v2.4.3

Choose a tag to compare

@SamMaxwell SamMaxwell released this 07 Apr 11:46

Full Changelog: v2.4.2...v2.4.3

v2.4.2

Choose a tag to compare

@SamMaxwell SamMaxwell released this 07 Apr 11:32

Full Changelog: 2.4.0...v2.4.2