@prisma/orm-mongo 8.0.0-rc.5 → 8.0.0-rc.5-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/package.json +11 -10
  2. package/skills/prisma-8/SKILL.md +84 -0
  3. package/skills/prisma-8/references/build.md +142 -0
  4. package/skills/prisma-8/references/contract.md +417 -0
  5. package/skills/prisma-8/references/debug.md +141 -0
  6. package/skills/prisma-8/references/feedback.md +251 -0
  7. package/skills/prisma-8/references/migration-review.md +224 -0
  8. package/skills/prisma-8/references/migrations.md +519 -0
  9. package/skills/prisma-8/references/queries-mongo.md +236 -0
  10. package/skills/prisma-8/references/queries-postgres.md +415 -0
  11. package/skills/prisma-8/references/queries.md +168 -0
  12. package/skills/prisma-8/references/quickstart.md +326 -0
  13. package/skills/prisma-8/references/runtime.md +344 -0
  14. package/skills/prisma-8/references/supabase.md +244 -0
  15. package/skills/prisma-8/references/upgrade-app.md +101 -0
  16. package/skills/prisma-8/references/upgrade-extension.md +105 -0
  17. package/skills/prisma-8/upgrading/app/upgrades/0.10-to-0.11/instructions.md +56 -0
  18. package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/instructions.md +381 -0
  19. package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/re-emit-closed-mongo-contracts.ts +202 -0
  20. package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/re-emit-domain-namespaced-contracts.ts +201 -0
  21. package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/re-emit-postgres-public-default.ts +198 -0
  22. package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/strip-migration-labels-hints.ts +340 -0
  23. package/skills/prisma-8/upgrading/app/upgrades/0.12-to-0.13/instructions.md +339 -0
  24. package/skills/prisma-8/upgrading/app/upgrades/0.12-to-0.13/re-emit-mti-variant-link-columns.ts +229 -0
  25. package/skills/prisma-8/upgrading/app/upgrades/0.13-to-0.14/instructions.md +543 -0
  26. package/skills/prisma-8/upgrading/app/upgrades/0.13-to-0.14/migration-op-factories-to-methods.ts +290 -0
  27. package/skills/prisma-8/upgrading/app/upgrades/0.13-to-0.14/uuid-preset-rename.ts +43 -0
  28. package/skills/prisma-8/upgrading/app/upgrades/0.14-to-0.15/instructions.md +359 -0
  29. package/skills/prisma-8/upgrading/app/upgrades/0.15-to-0.16/instructions.md +173 -0
  30. package/skills/prisma-8/upgrading/app/upgrades/0.16-to-0.17/instructions.md +805 -0
  31. package/skills/prisma-8/upgrading/app/upgrades/0.16-to-0.17/strip-sha256-hash-prefixes.ts +382 -0
  32. package/skills/prisma-8/upgrading/app/upgrades/0.17-to-8.0.0-rc.1/instructions.md +72 -0
  33. package/skills/prisma-8/upgrading/app/upgrades/0.7-to-0.8/instructions.md +8 -0
  34. package/skills/prisma-8/upgrading/app/upgrades/0.8-to-0.9/instructions.md +36 -0
  35. package/skills/prisma-8/upgrading/app/upgrades/0.8-to-0.9/strip-inline-contracts.ts +226 -0
  36. package/skills/prisma-8/upgrading/app/upgrades/0.9-to-0.10/instructions.md +86 -0
  37. package/skills/prisma-8/upgrading/app/upgrades/0.9-to-0.10/stamp-storage-types-kind.ts +360 -0
  38. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.1-to-8.0.0-rc.2/instructions.md +588 -0
  39. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.2-to-8.0.0-rc.3/instructions.md +5 -0
  40. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.3-to-8.0.0-rc.4/instructions.md +158 -0
  41. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.4-to-8.0.0-rc.5/instructions.md +42 -0
  42. package/skills/prisma-8/upgrading/extension/upgrades/0.10-to-0.11/instructions.md +276 -0
  43. package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/instructions.md +738 -0
  44. package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/migrate-contract-testing-imports.ts +97 -0
  45. package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/regenerate-extension-public-baseline.ts +223 -0
  46. package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/strip-migration-labels-hints.ts +340 -0
  47. package/skills/prisma-8/upgrading/extension/upgrades/0.12-to-0.13/instructions.md +266 -0
  48. package/skills/prisma-8/upgrading/extension/upgrades/0.13-to-0.14/instructions.md +522 -0
  49. package/skills/prisma-8/upgrading/extension/upgrades/0.13-to-0.14/migration-op-factories-to-methods.ts +290 -0
  50. package/skills/prisma-8/upgrading/extension/upgrades/0.13-to-0.14/uuid-preset-rename.ts +43 -0
  51. package/skills/prisma-8/upgrading/extension/upgrades/0.14-to-0.15/instructions.md +803 -0
  52. package/skills/prisma-8/upgrading/extension/upgrades/0.15-to-0.16/instructions.md +219 -0
  53. package/skills/prisma-8/upgrading/extension/upgrades/0.16-to-0.17/instructions.md +731 -0
  54. package/skills/prisma-8/upgrading/extension/upgrades/0.16-to-0.17/strip-sha256-hash-prefixes.ts +382 -0
  55. package/skills/prisma-8/upgrading/extension/upgrades/0.17-to-8.0.0-rc.1/instructions.md +194 -0
  56. package/skills/prisma-8/upgrading/extension/upgrades/0.7-to-0.8/instructions.md +8 -0
  57. package/skills/prisma-8/upgrading/extension/upgrades/0.8-to-0.9/instructions.md +57 -0
  58. package/skills/prisma-8/upgrading/extension/upgrades/0.8-to-0.9/strip-inline-contracts.ts +226 -0
  59. package/skills/prisma-8/upgrading/extension/upgrades/0.9-to-0.10/instructions.md +150 -0
  60. package/skills/prisma-8/upgrading/extension/upgrades/0.9-to-0.10/stamp-storage-types-kind.ts +360 -0
  61. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.1-to-8.0.0-rc.2/instructions.md +746 -0
  62. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.2-to-8.0.0-rc.3/instructions.md +5 -0
  63. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.3-to-8.0.0-rc.4/instructions.md +137 -0
  64. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.4-to-8.0.0-rc.5/instructions.md +129 -0
@@ -0,0 +1,359 @@
1
+ ---
2
+ from: "0.14"
3
+ to: "0.15"
4
+ changes:
5
+ - id: sql-orm-includes-decode-codec-values
6
+ summary: |
7
+ SQL ORM includes now decode every scalar child field through its contract-bound codec, matching top-level query results. Update application code and tests that relied on included fields retaining the database's JSON representation: for example, Postgres `bytea` include fields now return `Uint8Array` instead of `\\x`-prefixed hex text, and timestamp include fields return `Date` instead of timestamp strings. Custom codec-backed include fields likewise return the value produced by the codec's `decodeJson` method.
8
+ - id: db-verify-json-single-issue-list
9
+ summary: |
10
+ `prisma-next db verify --json` (and `db verify --schema-only --json`) now report a single
11
+ `schema.issues` array instead of the split `schema.issues` / `schema.schemaDiffIssues`
12
+ pair — the one-differ-two-ir-planner slice unified the CLI's schema-issue vocabulary onto
13
+ one shape: `{ path, reason, message, expected?, actual? }`. `reason` replaces the retired
14
+ `outcome` field (`'missing'` -> `'not-found'`, `'extra'` -> `'not-expected'`, `'mismatch'`
15
+ -> `'not-equal'`). The same collapse applies to `schema.warnings`. If a script or CI step
16
+ parses `db verify --json` output and reads `schema.schemaDiffIssues` /
17
+ `schema.warnings.schemaDiffIssues`, or compares an issue's `.outcome` field, update it:
18
+ read `schema.issues` (it already carries everything the two lists used to, concatenated)
19
+ and switch any `.outcome` comparison to the matching `.reason` value.
20
+ detection:
21
+ glob: "**/*.{ts,mts,cts,js,mjs,sh}"
22
+ contains:
23
+ - "schemaDiffIssues"
24
+ - ".outcome === 'missing'"
25
+ - ".outcome === 'extra'"
26
+ - ".outcome === 'mismatch'"
27
+ anyMatch: true
28
+ - id: policy-target-models-require-rls-attribute
29
+ summary: |
30
+ RLS enablement is now an explicit, authored table attribute: a `policy_select` block's
31
+ `target` model must declare `@@rls`, or `prisma-next contract emit` fails with
32
+ `PSL_EXTENSION_TARGET_MODEL_MISSING_ATTRIBUTE` naming the model and the policy. Add
33
+ `@@rls` to every policy-bearing model and re-run `prisma-next contract emit`; the
34
+ re-emitted `contract.json` gains an `rls` marker entity and a new storage hash. Plan
35
+ semantics follow the marker, not the policy set: a marked table with RLS off plans
36
+ `ENABLE ROW LEVEL SECURITY` (even with policies in sync), removing every policy keeps
37
+ RLS enabled (fail-closed deny-all), removing `@@rls` itself plans
38
+ `DISABLE ROW LEVEL SECURITY` (requires the destructive allowance), and changing only a
39
+ policy's name prefix plans a single `ALTER POLICY ... RENAME TO` instead of drop+create.
40
+ detection:
41
+ glob: "**/*.prisma"
42
+ contains:
43
+ - "policy_select"
44
+ anyMatch: true
45
+ ---
46
+
47
+ <!--
48
+ Release bump to 0.15.0 (PR #988): the version bump itself. Every workspace
49
+ `package.json` advances to 0.15.0 (version field + `workspace:` specifier
50
+ lockstep), and the `examples/supabase` contract artifacts regenerate because the
51
+ emitted contract embeds the composed extension pack's version
52
+ (`packs.supabase.version: '0.14.0' → '0.15.0'` in `contract.json` /
53
+ `contract.d.ts`) — no structural contract change. No user action beyond the
54
+ normal dependency upgrade this recipe covers. Incidental substrate diff only.
55
+ -->
56
+
57
+ <!--
58
+ TML-2503 (extension-supabase Slice E — launch close-out, PR #985): docs + test only.
59
+ The `examples/` touch is `examples/supabase/README.md` (new) plus
60
+ `examples/supabase/test/real-supabase.acceptance.test.ts` — an env-guarded (`skipIf`
61
+ on DATABASE_URL / SUPABASE_JWT_SECRET) real-Supabase acceptance test, skipped on the
62
+ normal CI path. No framework surface, contract shape, or emitted artefact change.
63
+ Incidental substrate diff only.
64
+ -->
65
+
66
+ <!--
67
+ TML-2501 (extension-supabase slice B close-out, this PR): test-only. The only
68
+ `examples/` touch is `examples/supabase/test/rls-role-binding.integration.test.ts`:
69
+ the acceptance test's fixture no longer hand-applies `ENABLE ROW LEVEL SECURITY` /
70
+ `CREATE POLICY` SQL — the test now exercises exactly the policies `dbInit` applies
71
+ from `contract.prisma`, and gains a WITH CHECK assertion (reassigning an owned row
72
+ to another owner is rejected). No framework surface, contract shape, or emitted
73
+ artefact changes. No user action required. Incidental substrate diff only.
74
+ -->
75
+
76
+ <!--
77
+ TML-2870 (Postgres RLS slice 4: all policy operations + roles): additive. The
78
+ PSL RLS surface gains the non-select policy keywords `policy_insert`,
79
+ `policy_update`, `policy_delete`, and `policy_all`, each with an optional
80
+ `withCheck` predicate (per-operation predicate matrix enforced at load time),
81
+ alongside the existing `policy_select`. Postgres database roles also enter
82
+ `db verify`: a role a contract declares but the live cluster lacks fails verify
83
+ under every control policy, while an undeclared live role is tolerated
84
+ unconditionally (the framework references but does not own the cluster's role
85
+ list). Both are opt-in and additive — existing schemas that use only
86
+ `policy_select` (or no `policy_*` blocks) emit and verify byte-identically, and
87
+ no contract declares a role today unless authored to. The only `examples/`
88
+ touch is the `examples/supabase` walking skeleton: `Profile` gains an `anon`
89
+ public-read policy and an `authenticated` UPDATE-own policy (`using` +
90
+ `withCheck`), its `contract.json`/`contract.d.ts` regenerate, and the
91
+ integration tests extend to prove WITH CHECK enforcement under `SET ROLE` and
92
+ role verify. No user upgrade action — a re-emit picks up any contract shape.
93
+ Incidental substrate diff only.
94
+ -->
95
+
96
+ <!--
97
+ Postgres-RLS slice 2.5 (one-differ-two-ir-planner), final unit: retires the
98
+ coordinate-based issue vocabulary (`BaseSchemaIssue` / `SchemaIssue` /
99
+ `EnumValuesChangedIssue` / the legacy `outcome` field) now that the migration
100
+ planner and `db verify` both run on the one node-typed differ. The only
101
+ `examples/` touch is `examples/supabase/test/skeleton.integration.test.ts`,
102
+ which read a verify result's `schema.schemaDiffIssues` list and an issue's
103
+ `.outcome` field directly — updated to `schema.issues` and `.reason` per the
104
+ `db-verify-json-single-issue-list` entry above. Superseds the "internal
105
+ refactor... not a stable shipped API" framing of the TML-2931 entry below: the
106
+ JSON shape is now settled and consumer-facing action is required for the
107
+ collapse.
108
+ -->
109
+
110
+ <!--
111
+ TML-2891 (eliminate the SQL family placeholder namespace): app authors who build
112
+ contracts through the public facades / target `defineContract` wrappers
113
+ (`@internal/postgres`, `@internal/sqlite`) are unaffected — those wrappers
114
+ supply the now-required `createNamespace` factory, so no app-author code changes.
115
+ The only `examples/` diff is regenerated migration `end-contract.d.ts` snapshots
116
+ whose SQL namespace `kind` changed from `'sql-namespace'` to `'postgres-schema'`;
117
+ the next `contract emit` picks this up automatically, and historical migration
118
+ snapshots are type-only (the runtime reads `contract.json`, which already carried
119
+ `postgres-schema`). No app-author action. Incidental substrate diff only.
120
+ -->
121
+
122
+ <!--
123
+ TML-2868 (Postgres RLS slice 1): adds the additive Postgres row-level-security
124
+ authoring feature (PSL `policy_select` blocks lower to RLS policies; `db verify`
125
+ diffs them, scoped to the namespaces a contract owns). The `examples/supabase/*`
126
+ touches — re-emitted `contract.json` / `contract.d.ts` / `contract.prisma`, the
127
+ `profile-queries.ts` demo, and the `skeleton.integration.test.ts` walking
128
+ skeleton — only demonstrate the new feature plus merge regeneration. RLS is opt
129
+ in; existing schemas without `policy_*` blocks emit and verify unchanged. No user
130
+ upgrade action — re-emit picks up the contract shape. Incidental substrate diff
131
+ only.
132
+ -->
133
+
134
+ <!--
135
+ TML-2931 (Postgres RLS migration seam): internal refactor of how the RLS schema
136
+ diff is represented — policies nest under a table node, the framework differ keys
137
+ nodes by an `id()` path rather than an entity coordinate, and `SchemaDiffIssue`
138
+ carries `path` instead of `coordinate`. The only `examples/` touch is
139
+ `examples/supabase/test/skeleton.integration.test.ts`, which reads a diff issue's
140
+ subject differently (`issue.path` instead of `issue.coordinate`). The RLS
141
+ schema-diff surface is still in development (not a stable shipped API), and the
142
+ authored RLS feature behaviour is unchanged. No user upgrade action. Incidental
143
+ substrate diff only.
144
+ -->
145
+
146
+ <!--
147
+ TML-2795: the `prisma-8-demo` example gains a Post<->Tag many-to-many. The demo
148
+ authors the relation in PSL (with a re-baselined `add_post_tags` migration), switches
149
+ its id fields to native uuid storage for M:N parity, and adds M:N ORM examples, CLI
150
+ commands, seed data, and PGlite integration coverage. Demonstrates the many-to-many
151
+ authoring surface that slice 5 (TML-2794) added to the framework; the example diff
152
+ spans `examples/prisma-8-demo/**` only. Additive and opt-in — no existing consumer
153
+ contract changes shape and no migration is forced. No consumer action required.
154
+ Incidental substrate diff only.
155
+ -->
156
+
157
+ <!--
158
+ TML-2886 (redo, PR #841): type SQL enum columns via a baked storage column lookup.
159
+ The SQL emitter now generates a top-level `StorageColumnTypes` map keyed
160
+ `[namespace][table][column]`; `FieldOutputTypes`/`FieldInputTypes` are derived from
161
+ it at emit time. The query builder (sql-builder) reads `StorageColumnTypes` directly;
162
+ the ORM still reads `FieldOutputTypes`. `contract.json` and both hashes are
163
+ byte-identical; `FieldOutputTypes` is byte-identical to main. The examples/ diff is
164
+ purely `.d.ts` regeneration (the new `StorageColumnTypes` block added; observable
165
+ types unchanged). No consumer action required. Incidental substrate diff only.
166
+ -->
167
+
168
+ <!--
169
+ TML-2884 (PR #834): end-to-end MongoDB enum enforcement via `$jsonSchema`.
170
+ The `mongo-demo` example gains a `UserRole` enum field (`role` on `users`),
171
+ authored in both PSL and the TypeScript builder. The planner-generated migration
172
+ applies a `collMod` with a `$jsonSchema` validator that enforces the enum values
173
+ at the MongoDB layer. Three migration `end-contract.d.ts` / `start-contract.d.ts`
174
+ snapshots were also updated for the TML-2891 `'mongo-namespace'` → `'mongo-database'`
175
+ kind rename. Re-emit picks up the new contract shape automatically; no consumer
176
+ action required. Incidental substrate diff only.
177
+ -->
178
+
179
+ <!--
180
+ TML-2503 (extension-supabase slice D): the `examples/supabase` diff adds two new
181
+ integration/type tests exercising the additive `db.asServiceRole().supabase.{sql,orm}`
182
+ admin surface — a secondary root for reading Supabase-internal `auth.*`/`storage.*`
183
+ tables as `service_role`. App authors are unaffected: the admin root is additive, and
184
+ the primary `db.asServiceRole().sql`/`.orm` surface (plus `asUser`/`asAnon`) is
185
+ unchanged. No user action. Incidental substrate diff only.
186
+ -->
187
+
188
+ <!--
189
+ TML-2892 (PR #879): the `Migration` base now takes the migration's start/end
190
+ contract JSON as typed inputs and derives `describe()` from their `storage.storageHash`,
191
+ and generated migrations use `Migration<Start, End>` with `endContractJson`/
192
+ `startContractJson` fields instead of hand-written from/to hashes; the base exposes
193
+ typed `this.startContract`/`this.endContract` ContractViews for the (hand-authored)
194
+ data-transform case. Every example `migration.ts` is regenerated to this shape; the
195
+ `operations` bodies are preserved verbatim, so `ops.json`/`migration.json` and every
196
+ emitted contract are byte-identical. No consumer action — re-scaffold via
197
+ `migration plan` picks up the new shape. Incidental substrate diff only.
198
+ -->
199
+
200
+ # Upgrade 0.14 → 0.15
201
+
202
+ No consumer-facing action is required for this transition.
203
+
204
+ The diff under `examples/` (and the example migration snapshots) is incidental —
205
+ emitted contract artefacts (`contract.json` / `contract.d.ts`) were regenerated
206
+ for two internal substrate changes:
207
+
208
+ - **Scalar-list storage machinery.** The emitted contracts now carry the
209
+ adapter-reported `scalarList` capability marker and the bumped envelope
210
+ version. The scalar-list machinery threaded through this release is internal —
211
+ no authoring path emits a list storage column yet, so generated types and
212
+ runtime behaviour for existing schemas are unchanged.
213
+ - **Namespace-scoped execution-default refs (M:N).** The contract's
214
+ `ExecutionMutationDefault.ref` now carries a `namespace` alongside `table` and
215
+ `column`, so an execution-time mutation default is keyed by
216
+ `(namespace, table, column)`, disambiguating same-named tables across
217
+ namespaces. The runtime applies defaults by namespace transparently.
218
+
219
+ No user action — a re-emit picks up the new contract shape.
220
+
221
+ <!--
222
+ Exercise Mongo enums in retail-store (this PR): the retail-store example replaces
223
+ order-type string literals with typed enum accessors via `buildNamespacedEnums` from
224
+ `@internal/contract/enum-accessor`. The `MongoClient` facade also gains a direct
225
+ `db.execute(plan)` method and a `db.raw` property (both additive). None of these
226
+ changes affect the emitted contract shape; a re-emit picks them up automatically.
227
+ No user action required. Incidental substrate diff only.
228
+ -->
229
+
230
+ <!--
231
+ TML-2954 (reshaping-pipeline decode): the Mongo query builder now reifies a per-stage
232
+ result shape, so reads through reshaping aggregation stages (`$project`/`$addFields`,
233
+ with more stages to follow) decode their output fields through the contract codecs
234
+ instead of returning raw BSON. Previously any reshaping stage collapsed the plan to an
235
+ un-decoded pass-through — a projected `_id` came back as a raw `ObjectId`; it now comes
236
+ back decoded, matching the row type the builder already declared. `$vectorSearch`
237
+ (shape-preserving) is reclassified as identity, so the retail-store `findSimilarProducts`
238
+ example drops its `db.raw` + `blindCast` for the typed builder. This is a runtime
239
+ behaviour fix — no API or contract-shape change and no re-emit needed; code that relied
240
+ on the previous un-decoded values would now observe decoded ones. Incidental to emit.
241
+ -->
242
+
243
+ <!--
244
+ TML-2955 (expose the static ExecutionContext symmetrically): additive client-safe
245
+ static surface. New `@internal/{mongo,postgres,sqlite}/static` entrypoints export
246
+ `<target>Static({ contractJson })`, returning the driver-free `ExecutionContext`
247
+ plus derived `enums` / query builder / `raw` / `contract`; the facades also expose
248
+ `db.context` (Mongo now typed `MongoExecutionContext<TContract>`) and `db.contract`.
249
+ All additive — existing app code is unaffected. The `retail-store` example's
250
+ `src/enums.ts` switches from the interim `buildNamespacedEnums` + `blindCast` to
251
+ `mongoStatic(...).enums` (example-internal). No user action required. Incidental
252
+ substrate diff only.
253
+ -->
254
+
255
+ <!--
256
+ TML-2952 (this PR): route SQL enum/value-set column TS typing through the codec.
257
+ A field/column restricted to a value set now derives its narrowed TS literal union
258
+ by rendering each stored value through its codec, replacing the framework's
259
+ (now-deleted) domain-enum override. The only `examples/` touch is a type test —
260
+ `examples/prisma-8-demo/test/demo-dx.types.test.ts` — asserting the emitted
261
+ `FieldOutputTypes` enum field equals the no-emit `typeof contract` value union
262
+ (emit-vs-no-emit agreement). The emitted contract is byte-identical (`fixtures:check`
263
+ clean; `contract.json`, `contract.d.ts`, and both hashes unchanged). No user action
264
+ required. Incidental substrate diff only.
265
+ -->
266
+
267
+ <!--
268
+ Slow-query warning middleware example (PR #912): the `prisma-8-demo` example
269
+ gains a `slowQueryWarning` custom middleware (`src/prisma/slow-query-warning.ts`,
270
+ wired into the runtime `middleware: [...]` chain in `src/prisma/db.ts`, with
271
+ offline unit tests). Documentation-driven example code only — it exercises the
272
+ existing public `SqlMiddleware` `afterExecute` hook and changes no framework
273
+ surface, contract shape, or emitted artefact. No user action required.
274
+ Incidental substrate diff only.
275
+ -->
276
+
277
+ <!--
278
+ TML-2953 (this PR): Mongo enum fields now type through a storage value set, the same
279
+ way SQL does. Authoring a Mongo enum writes a value set into
280
+ `contract.storage.namespaces[<ns>].entries.valueSet[<Enum>]` (the codec-encoded
281
+ member values) alongside the domain enum, and the emit typing + `$jsonSchema`
282
+ validator source from it. The `mongo-demo` and `retail-store` example contracts
283
+ regenerate to carry the value set (`contract.json` gains `entries.valueSet` and its
284
+ `storageHash` updates); the emitted `contract.d.ts` field types and the `$jsonSchema`
285
+ validator are byte-identical. `db.enums` runtime behaviour is unchanged. A re-emit
286
+ picks up the new `contract.json` shape; existing migrations are unaffected (the value
287
+ set is non-physical — no new migration op). No user action required. Incidental
288
+ substrate diff only.
289
+ -->
290
+
291
+ <!--
292
+ TML-2976 (native Postgres enums, external Supabase types — this PR): adds external
293
+ native Postgres enum support — Postgres `CREATE TYPE ... AS ENUM` types the database
294
+ already owns (e.g. Supabase's `auth.aal_level`), represented via a `native_enum` PSL
295
+ entity, typed as a value union, and read at runtime through a Postgres-only
296
+ `db.nativeEnums` accessor. The `examples/` diff is additive:
297
+ - `examples/supabase` gains `src/session-queries.ts` and
298
+ `test/native-enum-session.integration.test.ts` (reading `auth.aal_level`), plus a
299
+ regenerated `src/contract.d.ts`.
300
+ - `examples/prisma-8-demo` and `examples/retail-store` switch their enum
301
+ value-union annotations from `EnumValues<Db['enums'][X]>` to the equivalent `.Value`
302
+ phantom (`Db['enums'][X]['Value']`). `EnumValues` is unchanged and still exported;
303
+ `.Value` is the new preferred form, so this is an optional style adoption, not a
304
+ forced migration.
305
+ Native enums are opt-in — existing schemas without a `native_enum` emit and run
306
+ unchanged, and a re-emit picks up any contract shape. No user action required.
307
+ Incidental substrate diff only.
308
+ -->
309
+
310
+ <!--
311
+ Dependabot runtime-deps group bump (PR #962): runtime dependency version
312
+ bumps only (arktype 2.2.x, prettier 3.9.4, pg 8.22, pg-cursor 2.21, next
313
+ 16.2.10, react-router 7.18, radix/tailwind patches and friends), plus a
314
+ `pnpm dedupe arktype` so every workspace package resolves the same arktype
315
+ instance (the split 2.2.2/2.2.3 resolution broke cross-package `Type`
316
+ assignability). The `examples/` diff is package.json dependency version
317
+ ranges only — no framework surface, contract shape, or emitted artefact
318
+ changes. No user action required. Incidental substrate diff only.
319
+ -->
320
+
321
+ <!--
322
+ TML-2503 (extension-supabase: the complete, introspected Supabase contract, this
323
+ PR): additive + test-only. The pack's emitted `contract.json` / `contract.d.ts`
324
+ grow from a partial hand-scoped shape to the full contract introspected from a
325
+ Supabase reference instance (every `auth`/`storage` table, native enum, and
326
+ platform role), so consumers re-import a now-complete set of types — additive;
327
+ nothing previously shipped is renamed or removed except two internal named-type
328
+ aliases (`Uuid` / `Timestamptz`) folded into the canonicalized named-type set.
329
+ Back-relation field names are corrected from the inferrer's double-pluralized
330
+ form (`sessionses` → `sessions`, `identitieses` → `identities`, …); those names
331
+ were introduced by this PR's full regeneration and never shipped, so there is no
332
+ rename for existing consumers (the general inferrer fix is TML-3024). The
333
+ `examples/` diff is the `examples/supabase` walking-skeleton test plus a CI-only
334
+ vitest `retry` config that absorbs a known intermittent PGlite (WASM) abort. A
335
+ re-emit picks up any contract shape. No user action required. Incidental
336
+ substrate diff only.
337
+ -->
338
+
339
+ <!--
340
+ PR #915 (middleware doc-comment lifecycle fixes): comments-only. The only
341
+ `examples/` touches are doc comments in
342
+ `examples/prisma-8-demo/src/prisma/db.ts` and
343
+ `examples/prisma-8-demo/src/orm-client/find-user-by-id-cached.ts`,
344
+ correcting stale claims about what runs on a cache-middleware hit (every
345
+ `beforeExecute` has already run before `intercept` is consulted,
346
+ `afterExecute` still fires with `source: 'middleware'`, and `decodeRow`
347
+ still runs on the hit path). No code, contract, or emitted-artefact change.
348
+ No user action required. Incidental substrate diff only.
349
+ -->
350
+
351
+ <!--
352
+ Dependabot dev-deps group bump (PR #961): dev-dependency version bumps only
353
+ (biome 2.5.2, wrangler, @types/react, @cloudflare/* and friends), plus the
354
+ biome.jsonc schema-version alignment and the handful of code sites biome 2.5
355
+ newly flags (useOptionalChain / noProto in tests). The `examples/` diff is
356
+ package.json devDependency version ranges only — no framework surface,
357
+ contract shape, or emitted artefact changes. No user action required.
358
+ Incidental substrate diff only.
359
+ -->
@@ -0,0 +1,173 @@
1
+ ---
2
+ from: "0.15"
3
+ to: "0.16"
4
+ changes:
5
+ - id: extension-supabase-test-utils-export-removed
6
+ summary: |
7
+ `@internal/extension-supabase` no longer exports the `./test/utils` subpath
8
+ (`bootstrapSupabaseShim`). The import typechecked (types shipped in `dist`), but the
9
+ subpath never worked from npm — the shim reads fixture `.sql` files that were never
10
+ published, so every call failed with ENOENT before touching a database. There is no
11
+ working code to migrate: delete the import and whatever test setup called
12
+ `bootstrapSupabaseShim`.
13
+ detection:
14
+ glob: "**/*.{ts,mts,cts,js,mjs}"
15
+ contains:
16
+ - "extension-supabase/test/utils"
17
+ anyMatch: true
18
+ - id: identity-columns-need-explicit-default-under-strict-verify
19
+ summary: |
20
+ `contract infer` now emits `@default(autoincrement())` for a Postgres `GENERATED ALWAYS AS IDENTITY` / `GENERATED BY DEFAULT AS IDENTITY` column (previously it emitted a bare column with no default, since Postgres reports no `column_default` for an identity column). Symmetrically, `db verify` introspecting a live identity column now resolves its default to `autoincrement()` too (previously it resolved to nothing). This only changes `db verify --strict` — without `--strict`, an undeclared live default is tolerated either way. If you run `db verify --strict` against a table with an identity column whose contract does not declare `@default(autoincrement())` (because it predates this fix), verify now reports that default as an unexpected extra. Re-run `contract infer` for the affected table, or add `@default(autoincrement())` by hand, to match what the database has always generated.
21
+ - id: pluralize-back-relation-names-no-longer-double-pluralize
22
+ summary: |
23
+ `contract infer`'s back-relation field name generation used a hand-rolled pluralization rule that appended `es` to any table name already ending in `s`/`x`/`z`/`ch`/`sh`, doubling an already-plural table name (`sessions` -> `sessionses`). `contract infer` now uses real inflection (the `pluralize` library) and produces the correct name (`sessions` stays `sessions`; a genuinely singular `status` still becomes `statuses`). This only affects a future `contract infer` run — an already-generated `.prisma` file is untouched, so nothing breaks until you next re-run infer. If you do re-run `contract infer` against a database with an already-plural table name, diff the regenerated `.prisma` file for any back-relation field whose name changed — that's a public field name your application code accesses via `.include()`/`.select()`/the generated TypeScript types, so update those call sites to the corrected name.
24
+ - id: scalar-type-descriptors-channel-removed
25
+ summary: |
26
+ The scalar-type descriptor channel is retired in favour of the unified authoring type
27
+ namespace. Projects with custom control-stack setups that import
28
+ `createPostgresScalarTypeDescriptors` / `createSqliteScalarTypeDescriptors`, or that read
29
+ `scalarTypeDescriptors` from a control stack or contract-source context, must migrate:
30
+ those exports are deleted, and scalar types are now zero-arg type-constructor
31
+ contributions in the component's `authoring.type` namespace — e.g.
32
+ `String: { kind: 'typeConstructor', output: { codecId: 'pg/text@1', nativeType: 'text' } }`.
33
+ Read the scalar type names via `stack.scalarTypes`, or the full name ->
34
+ `{ codecId, nativeType }` map via `collectScalarTypeConstructors(stack.authoringContributions.type)`
35
+ from `@internal/framework-components/authoring`. Standard target setups
36
+ (`@internal/postgres`, `@internal/sqlite`) supply the contributions themselves.
37
+ detection:
38
+ glob: "**/*.{ts,mts,cts}"
39
+ contains:
40
+ - "createPostgresScalarTypeDescriptors"
41
+ - "createSqliteScalarTypeDescriptors"
42
+ - "scalarTypeDescriptors"
43
+ anyMatch: true
44
+ - id: postgres-json-rebound-to-native-json
45
+ summary: |
46
+ On the postgres target the PSL `Json` scalar re-binds from `pg/jsonb@1` / `jsonb` to
47
+ `pg/json@1` / `json`; a new bare `Jsonb` scalar carries `pg/jsonb@1` / `jsonb`. Postgres
48
+ schemas that use `Json` and mean jsonb storage (which every pre-0.16 `Json` field did)
49
+ must switch those fields — and `types {}` aliases — to `Jsonb`, then re-run
50
+ `prisma-next contract emit`; with `Jsonb` the emitted `contract.json` is byte-identical
51
+ to the pre-0.16 output. A field left as `Json` now emits a native `json` column and a
52
+ new storage hash, which against an existing jsonb database is a schema change. The
53
+ legacy `@db.Json` attribute path is unchanged (`Json @db.Json` still yields
54
+ `pg/json@1` / `json`), and sqlite/mongo `Json` bindings are untouched. The TS builder
55
+ surface (`field.json()`, `jsonbColumn`) is unchanged and stays jsonb.
56
+ detection:
57
+ glob: "**/*.prisma"
58
+ contains:
59
+ - "Json"
60
+ anyMatch: true
61
+ - id: default-generators-no-longer-set-storage
62
+ summary: |
63
+ `@default(<generator>)` no longer influences a column's storage — the type position is
64
+ the only storage decider. Pre-0.16, a generator default on a bare `String` field re-picked
65
+ the column's storage to a sized char: `String @default(uuid())` / `@default(uuid(7))`
66
+ emitted `sql/char@1` / `character(36)`, `@default(cuid(2))` `character(24)`,
67
+ `@default(nanoid())` `character(21)` (or `character(<size>)` for `nanoid(<size>)`), and
68
+ `@default(ulid())` `character(26)`. From 0.16 such fields emit the target's `String`
69
+ storage (postgres: `pg/text@1` / `text`) with the same execution-time generator, so a
70
+ re-emit produces a new storage hash — against an existing database created with the char
71
+ storage this is a schema change. To keep the prior storage byte-identical, name it in the
72
+ type position: `Char(36) @default(uuid())`, `Char(24) @default(cuid(2))`,
73
+ `Char(21) @default(nanoid())` (or `Char(<size>)` for a sized nanoid), `Char(26)
74
+ @default(ulid())` — or adopt native `Uuid` for `uuid()` if a `uuid`-typed column is
75
+ preferred (that is a schema change too). Then re-run `prisma-next contract emit` and, if
76
+ you accepted a storage change, plan/apply the matching migration. Generator applicability
77
+ validation is unchanged (`uuid()` on `Int` still fails with
78
+ `PSL_INVALID_DEFAULT_APPLICABILITY`), and the TS builder presets
79
+ (`field.id.uuidv4String()`, `field.generated(uuidv4())`, …) are untouched — they bundle
80
+ their `char(N)` storage explicitly.
81
+ detection:
82
+ glob: "**/*.prisma"
83
+ contains:
84
+ - "@default(uuid("
85
+ - "@default(cuid("
86
+ - "@default(nanoid("
87
+ - "@default(ulid("
88
+ anyMatch: true
89
+ ---
90
+
91
+ <!--
92
+ Release bump to 0.16.0 (PR #1019): the version bump itself. Every workspace
93
+ `package.json` advances to 0.16.0 (version field + `workspace:` specifier
94
+ lockstep). The bump commit touches only `package.json` files and
95
+ `pnpm-lock.yaml` — no source, contract shape, or emitted artefact change. No
96
+ user action beyond the normal dependency upgrade this recipe covers. Incidental
97
+ substrate diff only.
98
+ -->
99
+
100
+ <!--
101
+ TML-3027 (foreign keys and indexes are discrete contract entities): emitted
102
+ contract-shape change. `contract emit` now materializes the per-FK `constraint`/
103
+ `index` authoring booleans into discrete entities — a `foreignKeys[]` entry is the
104
+ referential constraint only (no `constraint`/`index` fields), and every backing
105
+ index (including one backing a FK) is its own named `indexes[]` entry. The booleans
106
+ remain as authoring input (`@relation(index:)`, TS `fk({ constraint, index })`,
107
+ `foreignKeyDefaults`). Every FK-bearing `contract.json` / `contract.d.ts` in the
108
+ repo re-emits to the new shape (the `examples/` diff is that regeneration); a
109
+ downstream `contract emit` picks it up automatically with no source change. The
110
+ only caller-visible break is TypeScript that reads `.constraint` / `.index` off a
111
+ contract's `foreignKeys[]` entry (contract internals, not an app-authoring
112
+ surface) — those fields are gone; read the discrete `indexes[]` entry instead. No
113
+ migration or DDL change: the schema the planner and `db verify` derive is
114
+ identical.
115
+ -->
116
+
117
+ <!--
118
+ Supabase integration close-out (TML-2503): docs-only. The `examples/` touch is
119
+ `examples/supabase/README.md` — a link into the deleted
120
+ `projects/supabase-integration/` workspace removed. No framework surface,
121
+ contract shape, or emitted artefact change. Incidental substrate diff only.
122
+ -->
123
+
124
+ <!--
125
+ TML-3028 (dependency-graph migration ordering; SchemaDiffIssue.reason removed):
126
+ the migration-diff internal `SchemaDiffIssue` lost its `reason` field —
127
+ discriminate via the presence of `expected`/`actual`, or the exported
128
+ `issueOutcome(issue): ExpectationFailureReason` helper. `ExpectationFailureReason`
129
+ keeps its `'not-found' | 'not-expected' | 'not-equal'` values and its export path;
130
+ it is now the helper's return type rather than the removed field's type. This is a
131
+ framework migration-control internal, not an app-authoring surface. The
132
+ `examples/` diff is supabase-example TEST assertions updated from `.reason` to
133
+ presence — no runtime, contract, or DDL change. Incidental test-only diff.
134
+ -->
135
+
136
+ <!--
137
+ Supabase example env template (TML-2503): docs-only. The `examples/` touch adds
138
+ `examples/supabase/.env.example`, naming the two env vars the real-Supabase
139
+ acceptance lane already reads (`DATABASE_URL`, `SUPABASE_JWT_SECRET`). Nothing
140
+ loads the file — it documents what to export. No framework surface, contract
141
+ shape, or emitted artefact change. Incidental substrate diff only.
142
+ -->
143
+
144
+ <!--
145
+ Dependabot dev-deps group bump (PR #961): dev-dependency version bumps only
146
+ (biome 2.5.2, wrangler, @types/react, @cloudflare/* and friends), plus the
147
+ biome.jsonc schema-version alignment and the handful of code sites biome 2.5
148
+ newly flags (useOptionalChain / noProto in tests). The `examples/` diff is
149
+ package.json devDependency version ranges and biome.jsonc schema versions only —
150
+ no framework surface, contract shape, or emitted artefact changes. No user
151
+ action required. Incidental substrate diff only.
152
+ -->
153
+
154
+ <!--
155
+ Dependabot dev-deps group bump (PR #1006): `changes: []`. dev-dependency version
156
+ bumps only (biome 2.5.2 → 2.5.3, wrangler, @prisma/compute-sdk, pkg-pr-new,
157
+ @cloudflare/vitest-pool-workers), plus the test-only sites biome 2.5.3 newly
158
+ flags via noUnsafeOptionalChaining (`(x?.y as T).z` → `(x!.y as T).z`). The
159
+ `examples/` diff is package.json devDependency version ranges only (wrangler and
160
+ @cloudflare/vitest-pool-workers in bundle-size and the cloudflare-worker example)
161
+ — no framework surface, contract shape, or emitted artefact change. No user
162
+ action required. Incidental substrate diff only.
163
+ -->
164
+
165
+ <!--
166
+ Dependabot runtime-deps group bump (PR #1014): `changes: []`. Dependency version
167
+ bumps only. The `examples/` diff is package.json version ranges in the demo apps
168
+ (isbot in react-router-demo; @radix-ui/react-radio-group, @radix-ui/react-select,
169
+ lucide-react, postcss in retail-store) — dependencies of the example applications
170
+ themselves, not of any `@internal/*` package. No framework surface, contract
171
+ shape, or emitted artefact change. No user action required. Incidental substrate
172
+ diff only.
173
+ -->