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

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,266 @@
1
+ ---
2
+ from: "0.12"
3
+ to: "0.13"
4
+ changes:
5
+ - id: sqlite-create-table-method
6
+ summary: |
7
+ SQLite migrations: `createTable` is no longer a free function exported from `@internal/sqlite/migration`. It is now a protected method on the `Migration` base class. If your extension ships SQLite migration files, replace every free `createTable(...)` call with `this.createTable({ table: ..., columns: [...], constraints: [...] })`. If your extension's migration facade re-export test asserts `createTable` is defined, remove that assertion. The `col()`, `lit()`, `fn()`, `primaryKey()`, `foreignKey()`, and `unique()` builder helpers are now exported from `@internal/sqlite/migration` directly.
8
+ detection:
9
+ glob: "**/migration.ts"
10
+ contains:
11
+ - "createTable"
12
+ - "@internal/sqlite/migration"
13
+ anyMatch: false
14
+ - id: regen-extension-contracts-strip-empty-type-params
15
+ summary: |
16
+ The canonicalizer now strips empty `typeParams: {}` from `storage.types` entries in
17
+ `contract.json`. Any extension that has shipped a `contract.json` with `typeParams: {}`
18
+ on its named-type entries (e.g. `types { Uuid = String @db.Uuid }`) must re-emit its
19
+ contract artefacts and re-pin its migration baselines so the on-disk hashes match the
20
+ new canonical form.
21
+ detection:
22
+ glob: "**/contract.json"
23
+ contains:
24
+ - '"typeParams": {}'
25
+ anyMatch: true
26
+ - id: thread-namespace-id-through-codec-ref-resolver-spi
27
+ summary: |
28
+ The codec-resolution SPI in `@internal/sql-relational-core` now takes a leading, required `namespaceId` coordinate. The `CodecDescriptorRegistry.codecRefForColumn(table, column)` build-time helper — the one AST authors call to stamp `codec` onto every column-bound `ParamRef` / `ProjectionItem`, exported from `@internal/sql-relational-core/query-lane-context` and `@internal/sql-relational-core/codec-descriptor-registry` — is now `codecRefForColumn(namespaceId, table, column)`. The underlying free function `codecRefForStorageColumn(storage, table, column)` (exported from `@internal/sql-relational-core/codec-descriptor-registry`) is now `codecRefForStorageColumn(storage, namespaceId, table, column)`. Extension authors who derive codec refs directly must thread the namespace the table sits in at every call site: pass the explicit `namespaceId` ahead of `table`. There is no codemod — the right namespace is call-site-specific (read it from the model/table you are building the ref for). Two same-bare-named tables in different namespaces now resolve to their own per-namespace columns/codecs instead of the first scan hit.
29
+ detection:
30
+ glob: "**/*.{ts,tsx}"
31
+ contains:
32
+ - "codecRefForColumn("
33
+ - "codecRefForStorageColumn("
34
+ anyMatch: true
35
+ - id: storage-namespace-envelope-re-emit
36
+ summary: |
37
+ The storage IR in `contract.json` moved to a namespace envelope
38
+ (`storage.namespaces.<ns>.entries.<kind>`). This changes `storageHash` for every
39
+ SQL and Mongo extension contract. Re-emit your extension contract artefacts
40
+ (`pnpm --filter <your-extension-package> build:contract-space`), then re-pin your
41
+ migration baselines so `migrations/refs/head.json`, `end-contract.json`,
42
+ `end-contract.d.ts`, `migration.json`, `migration.ts`, and `ops.json` all reflect
43
+ the new hash. No source change is required — re-emitting is sufficient.
44
+ detection:
45
+ glob: "**/contract.json"
46
+ anyMatch: true
47
+ ---
48
+
49
+ <!--
50
+ TML-2843: @internal/sqlite gained a facade-level transaction API
51
+ (`SqliteClient.transaction()` + `SqliteTransactionContext`), mirroring
52
+ the existing Postgres facade. Purely additive public surface backed by
53
+ the unchanged SQL runtime `withTransaction` helper; existing extension
54
+ code is unaffected. Incidental substrate diff only.
55
+
56
+ TML-2838: vitest configs in `packages/3-extensions/postgres` and
57
+ `packages/3-extensions/supabase` now pass `--no-memory-protection-keys`
58
+ to the test worker forks to stop a V8 WASM-teardown crash on Linux CI.
59
+ Test-harness only — no runtime, contract, or public-API change.
60
+ Incidental substrate diff only.
61
+
62
+ TML-2500 M4: `packages/3-extensions/supabase/README.md` link updated
63
+ from the old project spec to the canonical ecosystem-extensions doc and
64
+ ADR 226. Docs-only; no runtime, contract, or public-API change.
65
+ Incidental substrate diff only.
66
+
67
+ TML-2784: many-to-many became a first-class, validatable contract shape.
68
+ `ContractReferenceRelation` is now a cardinality-discriminated union — the
69
+ `'N:M'` variant requires a `through` junction descriptor ({ table,
70
+ namespaceId, parentColumns, childColumns, targetColumns }); the
71
+ non-junction variant carries `through?: never`. Purely additive: N:M
72
+ contracts did not validate before this change, so no working extension
73
+ constructs them, and existing 1:1 / 1:N / N:1 relation values match the
74
+ non-junction variant unchanged. No codemod required.
75
+
76
+ Bug fix in @internal/sql-orm-client — `orderBy` on a
77
+ variant-narrowed collection now resolves MTI variant-owned fields
78
+ (previously threw), mirroring the existing variant-aware `where`/`first`
79
+ treatment. Additive: the no-variant `orderBy` path and its types are
80
+ unchanged; no extension API change. No codemod required.
81
+
82
+ Release bump 0.13.0 (#789): version-number changes across all workspace
83
+ `package.json` files and `pnpm-lock.yaml` specifiers. Incidental substrate
84
+ diff — no extension-author action required.
85
+ -->
86
+
87
+ # 0.12 → 0.13 — Extension-author upgrade instructions
88
+
89
+ ## `sqlite-create-table-method`
90
+
91
+ Starting at this release, `createTable` is no longer a free function exported from `@internal/sqlite/migration`. It is now a protected method on the `Migration` base class — call it as `this.createTable({...})` inside `get operations()`.
92
+
93
+ If your extension ships SQLite migration files, update them to use `this.createTable(...)` and remove `createTable` from the import list.
94
+
95
+ If your extension has a facade re-export parity test that asserts `createTable` is defined, remove that assertion; add assertions for `col`, `lit`, `fn`, `primaryKey`, `foreignKey`, and `unique` if your test also checks that the column builders are exported.
96
+
97
+ The `col()`, `lit()`, `fn()`, `primaryKey()`, `foreignKey()`, and `unique()` builder helpers are now exported from `@internal/sqlite/migration` directly.
98
+
99
+ See the user-skill entry `sqlite-create-table-method` for the full before/after migration steps — the authoring-surface change is identical for both user and extension migration files.
100
+
101
+ ## `regen-extension-contracts-strip-empty-type-params`
102
+
103
+ The contract canonicalizer now omits `typeParams` from `storage.types` entries when the
104
+ value is an empty object. Previously, emitting a named-type alias like:
105
+
106
+ ```prisma
107
+ types {
108
+ Uuid = String @db.Uuid
109
+ }
110
+ ```
111
+
112
+ produced a `contract.json` entry such as:
113
+
114
+ ```json
115
+ "types": {
116
+ "Uuid": {
117
+ "codecId": "pg/text@1",
118
+ "kind": "codec-instance",
119
+ "nativeType": "uuid",
120
+ "typeParams": {}
121
+ }
122
+ }
123
+ ```
124
+
125
+ From this release the canonicalizer strips `typeParams` when it is empty, so the emitted
126
+ form is:
127
+
128
+ ```json
129
+ "types": {
130
+ "Uuid": {
131
+ "codecId": "pg/text@1",
132
+ "kind": "codec-instance",
133
+ "nativeType": "uuid"
134
+ }
135
+ }
136
+ ```
137
+
138
+ Empty and absent `typeParams` are treated as equivalent at every comparison boundary, so
139
+ the runtime behaviour is unchanged. The only visible effect is that re-emitting produces a
140
+ different `storageHash` — the hash now reflects a `contract.json` without the empty key.
141
+
142
+ ### Re-emit your extension contract
143
+
144
+ If your extension's `contract.json` carries `"typeParams": {}` on any `storage.types`
145
+ entry, re-emit to pick up the canonical form:
146
+
147
+ ```bash
148
+ pnpm fixtures:emit
149
+ # or, for a single package:
150
+ pnpm --filter <your-extension-package> build:contract-space
151
+ ```
152
+
153
+ ### Re-pin migration baselines
154
+
155
+ Because the `storageHash` changes, re-generate the migration baselines so
156
+ `migrations/refs/head.json`, `end-contract.json`, `end-contract.d.ts`, `migration.json`,
157
+ `migration.ts`, and `ops.json` all reflect the new hash.
158
+
159
+ > **Note:** `scripts/regen-extension-migrations.mjs` is a monorepo-internal tool that
160
+ > hard-codes `packages/3-extensions/` paths. It does not exist in external extension
161
+ > repos. Follow the manual steps below.
162
+
163
+ 1. Copy the freshly-emitted `src/contract.json` → `migrations/refs/end-contract.json`
164
+ and `src/contract.d.ts` → `migrations/refs/end-contract.d.ts`.
165
+ 2. Open your HEAD migration's `migration.ts` and update the `to` literal to the new
166
+ `storageHash` from `src/contract.json`.
167
+ 3. Run `pnpm exec tsx migrations/<head-migration>/migration.ts` (from the extension
168
+ package root) to re-emit `ops.json` and `migration.json`.
169
+ 4. Update `migrations/refs/head.json` — set `"hash"` to the new `storageHash`,
170
+ preserving the existing `"invariants"` array unchanged.
171
+
172
+ ### Validation
173
+
174
+ After re-emitting and re-pinning, run `pnpm typecheck && pnpm test --filter <your-extension-package>`,
175
+ then confirm `prisma-next migration check` passes. The `contract.json` diff should show
176
+ `"typeParams": {}` removed from every `storage.types` entry.
177
+
178
+ ## `thread-namespace-id-through-codec-ref-resolver-spi`
179
+
180
+ Starting at the 0.13 release, every model/table sits in an explicit namespace, and the column-bound codec-resolution SPI in `@internal/sql-relational-core` carries that namespace as a leading, required coordinate. If your extension stamps `codec: CodecRef` onto AST nodes at build time (the "CodecRef invariant for AST authors" path — `descriptors.codecRefForColumn(...)`), or calls the free `codecRefForStorageColumn(...)` against `SqlStorage` directly, you must thread the namespace coordinate through.
181
+
182
+ ### `CodecDescriptorRegistry.codecRefForColumn`
183
+
184
+ The registry method exported from `@internal/sql-relational-core/query-lane-context` (the `CodecDescriptorRegistry` interface) and built by `buildCodecDescriptorRegistry` (`@internal/sql-relational-core/codec-descriptor-registry`) gained a leading `namespaceId` parameter.
185
+
186
+ ```ts
187
+ // Before 0.13
188
+ const ref = descriptors.codecRefForColumn('document', 'embedding');
189
+
190
+ // Starting at 0.13 — namespaceId leads the coordinate args
191
+ const ref = descriptors.codecRefForColumn('public', 'document', 'embedding');
192
+ ```
193
+
194
+ The namespace is whatever namespace the model/table you are building the ref for lives in — read it from the resolved table coordinate you already hold at the construction site, not a hard-coded literal. The table is now resolved strictly within that namespace, so two same-bare-named tables in different namespaces resolve to their own per-namespace column codecs without colliding.
195
+
196
+ ### `codecRefForStorageColumn`
197
+
198
+ The free function exported from `@internal/sql-relational-core/codec-descriptor-registry` gained the same leading coordinate, inserted between `storage` and `tableName`.
199
+
200
+ ```ts
201
+ // Before 0.13
202
+ const ref = codecRefForStorageColumn(storage, 'document', 'embedding');
203
+
204
+ // Starting at 0.13
205
+ const ref = codecRefForStorageColumn(storage, 'public', 'document', 'embedding');
206
+ ```
207
+
208
+ It now resolves the table via `resolveStorageTable(storage, tableName, namespaceId)` rather than scanning every namespace for the first bare-name match, so a name that is ambiguous across namespaces is no longer silently bound to whichever namespace happened to enumerate first.
209
+
210
+ ### Validation
211
+
212
+ This is a type-level signature change — `pnpm typecheck` (or `pnpm build`) pinpoints every call site that still passes the pre-0.13 argument list. Fix each one by inserting the namespace coordinate, then run your extension's standard `pnpm test`.
213
+
214
+ ## Validation by execution
215
+
216
+ This entry is prose-only — there is no colocated codemod, so no execution-replay applies. The right namespace coordinate is call-site-specific (it depends on which model/table the AST node is bound to), so the translation is per-site agent reasoning rather than a deterministic transform. The substrate diff inside `packages/3-extensions/` in this transition is the same translation downstream extension authors replicate by hand: the namespace coordinate threaded through every column-bound codec-ref construction site. The release-pipeline gate (`pnpm check:upgrade-coverage`) is satisfied by this directory carrying at least one entry; the substantive verification of the consumer-facing translation lives in the published extension-upgrade skill's per-step bump-install-instructions-validate-commit loop, which runs in extension authors' own CI.
217
+
218
+ ## `storage-namespace-envelope-re-emit`
219
+
220
+ The storage IR inside `contract.json` moved to a namespace envelope in 0.13. Every
221
+ table and type entry that was previously at the top level of `storage` now lives under
222
+ `storage.namespaces.<ns>.entries.<kind>`. Cross-references that were bare strings are
223
+ now `{ namespace, model }` objects in `domain`. The emitter handles the shape change
224
+ automatically — no source change is needed.
225
+
226
+ Because the shape change affects `storageHash`, every extension contract must be
227
+ re-emitted and migration baselines re-pinned.
228
+
229
+ ### Re-emit your extension contract
230
+
231
+ ```bash
232
+ pnpm --filter <your-extension-package> build:contract-space
233
+ ```
234
+
235
+ ### Re-pin migration baselines
236
+
237
+ Follow the manual re-pin steps described in the
238
+ [`regen-extension-contracts-strip-empty-type-params`](#regen-extension-contracts-strip-empty-type-params)
239
+ section above: copy `src/contract.{json,d.ts}` to `migrations/refs/end-contract.*`,
240
+ update `migration.ts` with the new `storageHash`, re-run `tsx migration.ts` to
241
+ re-emit `ops.json` + `migration.json`, then update `migrations/refs/head.json`.
242
+
243
+ ### Validation
244
+
245
+ After re-emitting and re-pinning, run `pnpm typecheck && pnpm test --filter
246
+ <your-extension-package>`, then confirm `prisma-next migration check` passes.
247
+
248
+ ## Declarative PSL-block SPI (additive)
249
+
250
+ **Informational — no action required.**
251
+
252
+ This release adds a declarative SPI for extension-contributed top-level PSL blocks.
253
+ Register an `AuthoringPslBlockDescriptor` under `AuthoringContributions.pslBlockDescriptors`
254
+ (exported from `@internal/framework-components`) and the framework's generic PSL
255
+ parser, validator, and printer handle the block round-trip through `contract infer`
256
+ without any per-block parsing code. Each descriptor claims a PSL keyword and supplies
257
+ the argument schema; a matching `entityTypes` entry lowers the parsed node to an IR
258
+ class instance.
259
+
260
+ This is purely additive — existing extensions that use hand-written PSL-block parsers
261
+ are unaffected. Adopt `pslBlockDescriptors` when you want the framework to own the
262
+ parse/print cycle for a new top-level block your extension introduces.
263
+
264
+ ## Many-to-many contracts (additive)
265
+
266
+ No extension-author action required for the many-to-many change: M:N relations became a first-class, validatable contract shape this release (`'N:M'` cardinality with a required `through` junction descriptor). It is additive — existing non-junction relations and the public framework factories (`crossRef`, the contract-builder) are unchanged.