@prisma/orm-mongo 8.0.0-rc.14-dev.4 → 8.0.0-rc.14-dev.6

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.
package/README.md CHANGED
@@ -2,9 +2,8 @@
2
2
 
3
3
  The one package a MongoDB application installs. It wires the framework, the Mongo family, and the Mongo target into a single lazy client, and brings the rest of the stack along as exact-pinned dependencies:
4
4
 
5
- ```jsonc
6
- // package.json
7
- { "dependencies": { "@prisma/orm-mongo": "0.16.0", "mongodb": "^7.0.0" } }
5
+ ```sh
6
+ pnpm add @prisma/orm-mongo mongodb
8
7
  ```
9
8
 
10
9
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-mongo",
3
- "version": "8.0.0-rc.14-dev.4",
3
+ "version": "8.0.0-rc.14-dev.6",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -10,18 +10,18 @@
10
10
  "skills"
11
11
  ],
12
12
  "dependencies": {
13
- "@prisma/orm-family-mongo": "8.0.0-rc.14-dev.4",
14
- "@prisma/orm-framework": "8.0.0-rc.14-dev.4",
15
- "@prisma/orm-target-mongo": "8.0.0-rc.14-dev.4",
16
- "@prisma/orm-toolchain": "8.0.0-rc.14-dev.4",
13
+ "@prisma/orm-family-mongo": "8.0.0-rc.14-dev.6",
14
+ "@prisma/orm-framework": "8.0.0-rc.14-dev.6",
15
+ "@prisma/orm-target-mongo": "8.0.0-rc.14-dev.6",
16
+ "@prisma/orm-toolchain": "8.0.0-rc.14-dev.6",
17
17
  "mongodb-connection-string-url": "^7.0.1",
18
18
  "pathe": "^2.0.3",
19
19
  "tinyglobby": "^0.2.17"
20
20
  },
21
21
  "devDependencies": {
22
- "@internal/mongo": "8.0.0-rc.14-dev.4",
23
- "@repo/tsconfig": "8.0.0-rc.14-dev.4",
24
- "@repo/tsdown": "8.0.0-rc.14-dev.4",
22
+ "@internal/mongo": "8.0.0-rc.14-dev.6",
23
+ "@repo/tsconfig": "8.0.0-rc.14-dev.6",
24
+ "@repo/tsdown": "8.0.0-rc.14-dev.6",
25
25
  "tsdown": "0.22.14",
26
26
  "typescript": "5.9.3"
27
27
  },
@@ -15,7 +15,7 @@ description: >-
15
15
  ORM 7 or earlier (schema.prisma + @prisma/client).
16
16
  metadata:
17
17
  library: '@prisma/orm-mongo'
18
- library_version: '8.0.0-rc.14-dev.4'
18
+ library_version: '8.0.0-rc.14-dev.6'
19
19
  version: '2026-09-12'
20
20
  ---
21
21
 
@@ -68,7 +68,8 @@ For each `(from, to)` step in the chain:
68
68
  3. **Read the upgrade instructions.** Re-sync the skills (`prisma skills sync`) so the tree matches the version just installed, then load `../upgrading/app/upgrades/<from>-to-<to>/instructions.md`. Parse the YAML frontmatter and pay particular attention to its `changes[]` array.
69
69
 
70
70
  4. **Apply each change.** For each entry in `changes[]`:
71
- - If the entry has a `detection` block (glob + content predicate), run it; skip the change if no files match. No `detection` → apply unconditionally.
71
+ - If the entry has a `detection` block (glob + content predicate), run it; skip the change if no files match. No `detection` → apply unconditionally. Run the glob over the project's own files: skip `node_modules`, and build output such as `dist`, `build`, `.next` or `out` (whatever directories the project's build writes). A match there is generated code, which the next build rewrites; editing it changes nothing. Migration snapshots under `migrations/snapshots/` are committed files, not build output, so keep them.
72
+ - How a `detection` block runs: `glob` selects files relative to the project root. Each `matches` entry, once read from the YAML, is a JavaScript regular expression, built as `new RegExp(pattern)` with no flags and tested against the whole content of one file at a time; each `contains` entry is a plain substring. A file is a hit when any entry matches it. Patterns may span lines, and some look at the whole file (for example, to skip a file that declares something elsewhere in it), so a line-by-line search such as `grep` or `rg` without `-U` is not the same test and can report files the pattern excludes. From a shell, `rg -U --pcre2 -l -e '<pattern>' <files>` tests whole files and gives the same hits.
72
73
  - If the entry names a `script:` (a relative path next to `instructions.md`), invoke it from the project root:
73
74
  - `*.ts` → `pnpm exec tsx <skill>/upgrading/app/upgrades/<from>-to-<to>/<script>`
74
75
  - `*.sh` → `bash <skill>/upgrading/app/upgrades/<from>-to-<to>/<script>`
@@ -64,7 +64,8 @@ For each `(from, to)` step in the chain:
64
64
  4. **Read the upgrade instructions.** Re-sync the skills (`prisma skills sync`) so the tree matches the version just installed, then load `../upgrading/extension/upgrades/<from>-to-<to>/instructions.md`. Parse the YAML frontmatter and pay particular attention to its `changes[]` array.
65
65
 
66
66
  5. **Apply each change.** For each entry in `changes[]`:
67
- - If the entry has a `detection` block (a glob + content predicate), run it. If no files match, skip this change.
67
+ - If the entry has a `detection` block (a glob + content predicate), run it. If no files match, skip this change. Run the glob over the project's own files: skip `node_modules`, and build output such as `dist`, `build`, `.next` or `out` (whatever directories the project's build writes). A match there is generated code, which the next build rewrites; editing it changes nothing. Migration snapshots under `migrations/snapshots/` are committed files, not build output, so keep them.
68
+ - How a `detection` block runs: `glob` selects files relative to the project root. Each `matches` entry, once read from the YAML, is a JavaScript regular expression, built as `new RegExp(pattern)` with no flags and tested against the whole content of one file at a time; each `contains` entry is a plain substring. A file is a hit when any entry matches it. Patterns may span lines, and some look at the whole file (for example, to skip a file that declares something elsewhere in it), so a line-by-line search such as `grep` or `rg` without `-U` is not the same test and can report files the pattern excludes. From a shell, `rg -U --pcre2 -l -e '<pattern>' <files>` tests whole files and gives the same hits.
68
69
  - If the entry has no `detection`, apply unconditionally.
69
70
  - If the entry names a `script:` (a relative path next to `instructions.md`), invoke it from the project root:
70
71
  - `*.ts` → `pnpm exec tsx <skill>/upgrading/extension/upgrades/<from>-to-<to>/<script>`
@@ -39,8 +39,9 @@ changes:
39
39
  The Mongo codec subpaths moved from the adapter to the target:
40
40
  `adapter/codec-types`, `adapter/codecs`, `adapter/codec-ids` and `adapter/data-types` under
41
41
  `@prisma/orm-mongo` and `@prisma/orm-target-mongo` are now `target/...`. Emitted
42
- `contract.d.ts` files, including migration snapshots, import `adapter/codec-types` and no
43
- longer compile until rewritten or re-emitted.
42
+ `contract.d.ts` files, including migration snapshots, import `adapter/codec-types` until
43
+ rewritten or re-emitted. Under `skipLibCheck: true` that import fails silently and the
44
+ contract's field types turn wrong where they are used, instead of failing to compile.
44
45
  detection:
45
46
  glob: "**/*.{ts,mts,cts,md}"
46
47
  matches:
@@ -78,23 +79,18 @@ changes:
78
79
  Four Mongo PSL scalar names are deprecated in favour of the name of the BSON type they store:
79
80
  `Int` → `Int32`, `Float` → `Double`, `Boolean` → `Bool`, `DateTime` → `Date`. The old names
80
81
  are still accepted, with a `PSL_DEPRECATED_SCALAR_NAME` warning, and will be removed in a later
81
- release; rename them now. Codec ids, `contract.json` and every hash are unchanged.
82
+ release; rename them now. Codec ids, `contract.json` and every hash are unchanged. Rename only
83
+ in the Prisma 8 contract source and its `migrations/app/*/contract.prisma` copies, never in a
84
+ Prisma 6 `schema.prisma`.
82
85
  detection:
83
86
  glob: "**/*.prisma"
84
87
  matches:
85
- - '(?:^|\n)[ \t]*[A-Za-z_][A-Za-z0-9_]*[ \t]+(?:Int|Float|Boolean|DateTime)(?:\[\])?\??(?![ \t]*\{)(?=\s|$)'
86
- - id: mongo-json-field-semantics
87
- summary: |
88
- A Mongo `Json` field now admits only JSON values. Its collection validator lists the
89
- JSON-representable BSON types, which changes the validator and `storageHash` of every Mongo
90
- contract with a `Json` field, and a document whose `Json` field holds a `Date`, `ObjectId`,
91
- `Decimal128`, `Binary`, or another non-JSON BSON value at any depth fails to decode.
88
+ - '(?<![\s\S])(?![\s\S]*\bprovider\s*=\s*"mongodb")[\s\S]*?(?:^|\n)[ \t]*[A-Za-z_][A-Za-z0-9_]*[ \t]+(?:Int|Float|Boolean|DateTime)(?:\[\])?\??(?![ \t]*\{)(?=\s|$)'
92
89
  - id: mongo-variant-field-codecs
93
90
  summary: |
94
91
  Through `.variant(...)`, a field declared only on the variant model is now written and read
95
92
  through its codec, as base-model fields always were. An `ObjectId` field there is stored as
96
- an `ObjectId` and read back as a hex string; an `Int64`, `Decimal128` or `Binary` field reads
97
- back as its application type; `Json` and `Bson` fields refuse values outside their type.
93
+ an `ObjectId` and read back as a hex string, and a where filter on it encodes a hex string.
98
94
  - id: contract-artifacts-restamp
99
95
  summary: |
100
96
  The emitted `contract.json` / `contract.d.ts` embed the toolchain version, which moves
@@ -236,6 +232,8 @@ The Mongo target package owns the codecs now. Rewrite each specifier, in every f
236
232
 
237
233
  The exported names are unchanged. For the application's own `contract.d.ts`, running `prisma contract emit` produces the same result as the rewrite. Snapshot `contract.d.ts` files under `migrations/snapshots/` are not re-emitted, so rewrite them. The contract JSON and every hash stay the same.
238
234
 
235
+ Do not rely on `tsc` to find the `contract.d.ts` files. They are declaration files, and a project with `skipLibCheck: true` (the `tsconfig.json` that `prisma orm init` writes sets it) gets no error for their stale import. Instead the contract's field types stop resolving to the codec types, so type errors appear where the contract is used, such as a seed script or a query, rather than at the import, and some fields are no longer type-checked. Rewrite or re-emit every file the detection finds, whether or not `tsc` complains.
236
+
239
237
  ## `create-mongo-runner-deps-removed`
240
238
 
241
239
  ```ts
@@ -280,7 +278,9 @@ Code that goes through the CLI or `defineConfig` already has the adapter on the
280
278
 
281
279
  `Int`, `Float`, `Boolean` and `DateTime` are deprecated in Mongo schemas. They are still accepted, and they produce the same contract as the new names, but `prisma contract emit` and the language server report a `PSL_DEPRECATED_SCALAR_NAME` warning for each use, and a later release removes them. Rename them now.
282
280
 
283
- Apply this only in a schema whose `prisma.config.ts` uses `@prisma/orm-mongo`. The detection pattern also matches Postgres and SQLite schemas, whose scalar names do not change in this release.
281
+ Apply this only to the Prisma 8 Mongo contract source, the `.prisma` file that `prisma.config.ts` passes to `defineConfig` from `@prisma/orm-mongo/config`, and to its copies under `migrations/app/<migration>/contract.prisma`. The detection pattern also matches Postgres and SQLite schemas, whose scalar names do not change in this release; leave them alone.
282
+
283
+ Never rename in a Prisma 6 `schema.prisma`, such as one kept beside the Prisma 8 contract in a project that still runs Prisma 6: Prisma 6 has no `Int32`, `Double`, `Bool` or `Date`, and would reject the schema. The detection skips a file that declares `provider = "mongodb"`, which every Prisma 6 MongoDB schema does, but a multi-file Prisma 6 schema declares it in one file only, so also skip the other `.prisma` files of a Prisma 6 schema directory.
284
284
 
285
285
  In each field whose type is one of the deprecated names, replace the type name, keeping any `[]` and `?`:
286
286
 
@@ -317,40 +317,14 @@ This includes the `contract.prisma` copies under `migrations/app/<migration>/`.
317
317
 
318
318
  Docs: list only `Int32`, `Double`, `Bool`, `Date`; the old names must not appear in the scalar tables.
319
319
 
320
- ## `mongo-json-field-semantics`
321
-
322
- This change has no detection pattern: which `Json` fields hold non-JSON values depends on the data, which a search of the source cannot see.
323
-
324
- A Mongo `Json` field (`field.json()` in TypeScript) means a JSON value, no more. Its validator admits BSON `object`, `array`, `string`, `double`, `int`, `long`, `bool` and `null`. Reading a document fails with `RUNTIME.DECODE_FAILED` when the field holds a `Date`, `ObjectId`, `Decimal128`, `Binary`, regular expression, timestamp, or a 64-bit integer outside the safe-integer range, at any depth; the message names the path inside the field. Writing such a value fails with `RUNTIME.ENCODE_FAILED`.
325
-
326
- To find the affected fields, query each collection with a `Json` field for documents whose field holds a non-JSON value at its top level or as a direct element of an array: a BSON type outside the JSON types, a `long` outside the safe-integer range, or a `NaN` or infinite `double`:
327
-
328
- ```js
329
- db.<collection>.find({
330
- $or: [
331
- { <field>: { $exists: true, $not: { $type: ['object', 'array', 'string', 'double', 'int', 'long', 'bool', 'null'] } } },
332
- { <field>: { $elemMatch: { $not: { $type: ['object', 'array', 'string', 'double', 'int', 'long', 'bool', 'null'] } } } },
333
- { <field>: { $type: 'long', $gt: 9007199254740991 } },
334
- { <field>: { $type: 'long', $lt: -9007199254740991 } },
335
- { <field>: { $in: [NaN, Infinity, -Infinity] } },
336
- ],
337
- })
338
- ```
339
-
340
- The first clause checks the field's own value, and the second checks each direct element when the value is an array. The last three clauses match at both levels. A non-JSON value nested deeper, inside an object or an array of objects, is not visible to this query; reading every document through the ORM finds it, because the read fails with the path of the first such value.
341
-
342
- 1. For each Mongo `Json` field whose documents hold such values, change its type to `Bson` in PSL (`field.bson()` in TypeScript), which admits any BSON value. A project whose contract source is a Prisma 6 schema (`prisma6Schema`) cannot declare `Bson`: keep its `Json` fields JSON-only, or move the contract source to a Prisma 8 schema and change the type there.
343
- 2. Run `prisma contract emit`. Every Mongo contract written in Prisma 8 PSL with a `Json` field changes: its validator lists the JSON types and its `storageHash` moves, whether or not step 1 changed anything. A contract built with the TypeScript builder or read from a Prisma 6 schema has no validator, so it does not change; the codec's checks on read and write still apply to it.
344
- 3. If the contract changed in step 2, run `prisma db update` so each collection's validator matches the contract. It reports the validator change as destructive and asks for confirmation: type the database name, or pass `--confirm <database>` when nobody is there to ask. A project that deploys with migrations runs `prisma migration plan` instead and applies the new migration the way it applies any other.
345
-
346
320
  ## `mongo-variant-field-codecs`
347
321
 
348
- This change has no detection pattern: it applies to every model with `@@base` whose own fields are written or read through `.variant(...)`, and the effect depends on the field types.
322
+ This change has no detection pattern: it applies to every model with `@@base` whose own `ObjectId` fields are written or read through `.variant(...)`.
349
323
 
350
- Before, a field declared only on a variant model (`model Photo { ownerId ObjectId @@base(Asset, "photo") }`) was passed to the driver as the application wrote it and returned as the driver read it. An `ObjectId` field written as a hex string was refused by the collection validator when the contract was written in Prisma 8 PSL; a contract built with the TypeScript builder or read from a Prisma 6 schema has no validator, so there the hex string was stored as a string. A where filter on such a field passed its value unencoded, so a hex string matched nothing where an `ObjectId` was stored; it is now encoded and matches. A stored `ObjectId`, `Long`, `Decimal128` or `Binary` came back as the driver's class instead of the application type.
324
+ Before, a field declared only on a variant model (`model Photo { ownerId ObjectId @@base(Asset, "photo") }`) was passed to the driver as the application wrote it and returned as the driver read it. An `ObjectId` field written as a hex string was refused by the collection validator when the contract was written in Prisma 8 PSL; a contract built with the TypeScript builder has no validator, so there the hex string was stored as a string. A stored `ObjectId` came back as the driver's `ObjectId` class instead of a hex string. A where filter on such a field passed its value unencoded, so a hex string matched nothing where an `ObjectId` was stored; it is now encoded and matches.
351
325
 
352
- 1. Remove any workaround that converted such values by hand, for example passing `new ObjectId(hex)` for a variant `ObjectId` field or calling `.toHexString()` on what a read returned; pass and expect the application types listed in the scalar types reference instead.
353
- 2. Documents written before this change by a TypeScript-builder or Prisma 6 contract may hold a variant `ObjectId` field as a string; a filter with a hex string now looks for an `ObjectId` and does not match them. Convert the ones that are 24-character hex strings with `db.<collection>.updateMany({ <field>: { $type: 'string', $regex: /^[0-9a-fA-F]{24}$/ } }, [{ $set: { <field>: { $toObjectId: '$<field>' } } }])`. The regex matters: without it, one string that is not an `ObjectId` in hex makes `$toObjectId` fail the whole command. Other strings, `ObjectId` values and documents without the field are left as they are.
326
+ 1. Remove any workaround that converted such values by hand, for example passing `new ObjectId(hex)` for a variant `ObjectId` field or calling `.toHexString()` on what a read returned; pass and expect hex strings, as for any other `ObjectId` field.
327
+ 2. Documents written before this change through a TypeScript-builder contract may hold a variant `ObjectId` field as a string; a filter with a hex string now looks for an `ObjectId` and does not match them. Convert the ones that are 24-character hex strings with `db.<collection>.updateMany({ <field>: { $type: 'string', $regex: /^[0-9a-fA-F]{24}$/ } }, [{ $set: { <field>: { $toObjectId: '$<field>' } } }])`. The regex matters: without it, one string that is not an `ObjectId` in hex makes `$toObjectId` fail the whole command. Other strings, `ObjectId` values and documents without the field are left as they are.
354
328
  3. A read through the base collection (without `.variant(...)`) still returns variant-only fields as the driver read them.
355
329
 
356
330
  ## `contract-artifacts-restamp`
@@ -67,9 +67,9 @@ changes:
67
67
  - id: prisma7-schema-source-declares-psl
68
68
  summary: The prisma7Schema() contract source declares format 'psl' instead of 'prisma7'.
69
69
  - id: print-psl-description-option
70
- summary: printPsl() from @internal/psl-printer opens every file with only the // use prisma-8 marker unless the caller passes description.
70
+ summary: printPsl() from @internal/psl-printer (@prisma/orm-framework/psl-printer) opens every file with only the // use prisma-8 marker unless the caller passes description.
71
71
  - id: family-sql-psl-build-export
72
- summary: mapDefault, its option types, the PslTypeMap types and toEnumMemberName moved from @internal/family-sql/psl-infer to @internal/family-sql/psl-build.
72
+ summary: mapDefault, its option types, the PslTypeMap types and toEnumMemberName moved from @internal/family-sql/psl-infer to @internal/family-sql/psl-build (published as family/psl-infer and family/psl-build of @prisma/orm-family-sql).
73
73
  - id: cursor-rejects-expression-orders
74
74
  summary: "cursor() now throws ORM.ARGUMENT_INVALID when an active orderBy item is not a plain column (extension-operation orders such as vector distance were previously dropped from the keyset silently)"
75
75
  detection:
@@ -77,7 +77,7 @@ changes:
77
77
  matches:
78
78
  - '\.cursor\('
79
79
  - id: order-by-item-nulls
80
- summary: "OrderByItem from @internal/sql-relational-core/ast carries a nulls placement: its constructor takes a required third argument, withExpr rebuilds an item around a new expression, and every renderer must emit nulls wherever it emits dir"
80
+ summary: "OrderByItem from @internal/sql-relational-core/ast (@prisma/orm-family-sql/relational-core/ast) carries a nulls placement: its constructor takes a required third argument, withExpr rebuilds an item around a new expression, and every renderer must emit nulls wherever it emits dir"
81
81
  detection:
82
82
  glob: "**/*.{ts,mts,cts}"
83
83
  matches:
@@ -105,7 +105,8 @@ changes:
105
105
  - '@prisma/orm-(?:target-)?mongo/adapter/(?:codec-types|codecs|codec-ids|data-types)(?![\w-])'
106
106
  - id: create-mongo-runner-deps-removed
107
107
  summary: |
108
- `createMongoRunnerDeps(...)` is removed from `@internal/adapter-mongo/control`. Build the
108
+ `createMongoRunnerDeps(...)` is removed from `@internal/adapter-mongo/control`
109
+ (`@prisma/orm-mongo/adapter/control`). Build the
109
110
  runner dependencies with `new MongoControlAdapterImpl().createRunnerDependencies(controlDriver)`.
110
111
  detection:
111
112
  glob: "**/*.{ts,mts,cts}"
@@ -114,8 +115,9 @@ changes:
114
115
  - id: mongo-runner-dependency-types-move-to-family
115
116
  summary: |
116
117
  `MongoRunnerDependencies` and `MarkerOperations` are exported from
117
- `@internal/family-mongo/control-adapter`, no longer from `@internal/adapter-mongo/control` or
118
- `@internal/target-mongo/control`.
118
+ `@internal/family-mongo/control-adapter` (`@prisma/orm-mongo/family/control-adapter`), no
119
+ longer from `@internal/adapter-mongo/control` or `@internal/target-mongo/control` (the
120
+ `adapter/control` and `target/control` subpaths of `@prisma/orm-mongo`).
119
121
  detection:
120
122
  glob: "**/*.{ts,mts,cts}"
121
123
  matches:
@@ -159,12 +161,16 @@ changes:
159
161
  defaulting to `undefined`, so a bare `FieldBuilder` constraint rejects preset fields such as
160
162
  `field.temporal.createdAt()`; widen it to
161
163
  `FieldBuilder<ContractFieldType, boolean, boolean, EnumTypeHandle | undefined, ExecutionMutationDefaultPhases | undefined>`.
164
+ `ContractFieldType` and `ExecutionMutationDefaultPhases` come from
165
+ `@prisma/orm-mongo/contract/types`; `FieldBuilder` and `EnumTypeHandle` from
166
+ `@prisma/orm-mongo/contract-builder`.
162
167
  - id: mongo-bson-codec-added
163
168
  summary: |
164
- The Mongo target gains the codec `mongo/bson@1` for any BSON value, typed `BsonInputValue`
165
- on write and `BsonValue` on read in `CodecTypes`; `mongo/json@1` now admits only JSON values.
166
- Collection validators now read a codec's whole `targetTypes` list, not only its first entry,
167
- and an enum's codec must declare exactly one.
169
+ The Mongo target gains the codecs `mongo/int64@1`, `mongo/decimal128@1`, `mongo/binary@1`,
170
+ `mongo/json@1` (JSON values only) and `mongo/bson@1` (any BSON value, typed `BsonInputValue`
171
+ on write and `BsonValue` on read in `CodecTypes`). Collection validators now read a codec's
172
+ whole `targetTypes` list, not only its first entry, and an enum's codec must declare exactly
173
+ one.
168
174
  detection:
169
175
  glob: "**/*.{ts,mts,cts}"
170
176
  matches:
@@ -201,7 +207,7 @@ A contract with generated defaults (`temporal.createdAt()`, `temporal.updatedAt(
201
207
 
202
208
  ### For extension authors
203
209
 
204
- - The framework type `ExecutionMutationDefault['ref']` from `@internal/contract/types` is `{ namespace: string; entry: string; field: string }`. A type that matches refs by shape (for example a create-input type that checks whether a column has a generated default) matches `entry` and `field`.
210
+ - The framework type `ExecutionMutationDefault['ref']` from `@internal/contract/types` (`@prisma/orm-framework/contract/types`) is `{ namespace: string; entry: string; field: string }`. A type that matches refs by shape (for example a create-input type that checks whether a column has a generated default) matches `entry` and `field`.
205
211
  - A pack that ships a contract with generated defaults re-emits it with `prisma contract emit`, and updates its pinned contract-space snapshots as in step 2.
206
212
  - The options passed to `applyMutationDefaults` change separately: see `mutation-defaults-options-entry-field` below for the rename of `table` to `entry`.
207
213
 
@@ -261,7 +267,7 @@ import {
261
267
  import { timestampNowControlDescriptor } from '@prisma/orm-framework/components/control';
262
268
  ```
263
269
 
264
- The same applies to the `family/control` subpaths of `@prisma/orm-postgres` and `@prisma/orm-sqlite` (move to their `components/authoring` and `components/control` subpaths), and to `@internal/family-sql/control` (move to `@internal/framework-components/authoring` and `@internal/framework-components/control`). Keep importing `temporalCodecPresetWithPrecision` and `temporalStringAuthoringPresets` from `family/control`.
270
+ The same applies to the `family/control` subpaths of `@prisma/orm-postgres` and `@prisma/orm-sqlite` (move to their `components/authoring` and `components/control` subpaths), and to `@internal/family-sql/control` (move to `@internal/framework-components/authoring` and `@internal/framework-components/control`, published as the `components/authoring` and `components/control` subpaths of `@prisma/orm-framework`). Keep importing `temporalCodecPresetWithPrecision` and `temporalStringAuthoringPresets` from `family/control`.
265
271
 
266
272
  ## `temporal-preset-builders-take-storage-template`
267
273
 
@@ -331,7 +337,7 @@ A literal default on a column whose codec no pack in the contract declares now f
331
337
 
332
338
  ## `contract-source-format-is-psl-or-typescript`
333
339
 
334
- `ContractSourceProvider` from `@internal/config/config-types` is now the union of `PslContractSourceProvider` (`format: 'psl'`) and `TypeScriptContractSourceProvider` (`format: 'typescript'`). `format` is required on both. `OpaqueContractSourceProvider` and every other `format` value are gone, and config validation reports a source with no `format`, or any other value, as an issue on `contract.source.format`.
340
+ `ContractSourceProvider` from `@internal/config/config-types` (`@prisma/orm-framework/config/config-types`) is now the union of `PslContractSourceProvider` (`format: 'psl'`) and `TypeScriptContractSourceProvider` (`format: 'typescript'`). `format` is required on both. `OpaqueContractSourceProvider` and every other `format` value are gone, and config validation reports a source with no `format`, or any other value, as an issue on `contract.source.format`.
335
341
 
336
342
  Give every contract source an extension defines a `format`: `'psl'` when its inputs are PSL text, and `'typescript'` when it builds the contract in TypeScript. Replace imports of `OpaqueContractSourceProvider` with `ContractSourceProvider`.
337
343
 
@@ -341,7 +347,7 @@ The source returned by `prisma7Schema()` now declares `format: 'psl'`, because a
341
347
 
342
348
  ## `print-psl-description-option`
343
349
 
344
- `printPsl()` from `@internal/psl-printer` used to open every file with the `// use prisma-8` marker and a line saying the contract was inferred from the live database. It now writes only the marker, and a second comment line only when the caller passes `description`. Code that prints an inferred contract and wants the old second line passes it:
350
+ `printPsl()` from `@internal/psl-printer` (`@prisma/orm-framework/psl-printer`) used to open every file with the `// use prisma-8` marker and a line saying the contract was inferred from the live database. It now writes only the marker, and a second comment line only when the caller passes `description`. Code that prints an inferred contract and wants the old second line passes it:
345
351
 
346
352
  ```ts
347
353
  printPsl(ast, {
@@ -353,7 +359,7 @@ printPsl(ast, {
353
359
 
354
360
  ## `family-sql-psl-build-export`
355
361
 
356
- `contract print` uses some of what `@internal/family-sql/psl-infer` exported, so those exports moved to the new subpath `@internal/family-sql/psl-build`: `mapDefault`, `DefaultMappingOptions`, `DefaultMappingResult`, `PslTypeMap`, `PslTypeReference`, `PslTypeResolution` and `toEnumMemberName`. Import them from `@internal/family-sql/psl-build`. Everything else stays in `@internal/family-sql/psl-infer`.
362
+ `contract print` uses some of what `@internal/family-sql/psl-infer` exported, so those exports moved to the new subpath `@internal/family-sql/psl-build`: `mapDefault`, `DefaultMappingOptions`, `DefaultMappingResult`, `PslTypeMap`, `PslTypeReference`, `PslTypeResolution` and `toEnumMemberName`. Import them from `@internal/family-sql/psl-build` (`@prisma/orm-family-sql/family/psl-build`, or the same subpath of `@prisma/orm-postgres` and `@prisma/orm-sqlite`). Everything else stays in `@internal/family-sql/psl-infer` (`family/psl-infer`).
357
363
 
358
364
  ## `cursor-rejects-expression-orders`
359
365
 
@@ -408,28 +414,30 @@ Rewrite each specifier. The exported names are unchanged.
408
414
  | `@prisma/orm-mongo/adapter/<same four>` | `@prisma/orm-mongo/target/<same four>` |
409
415
  | `@prisma/orm-target-mongo/adapter/<same four>` | `@prisma/orm-target-mongo/target/<same four>` |
410
416
 
411
- Then re-sort the import block with the package's formatter (the new specifier sorts after `@internal/mongo-*`). A package that imports from `@internal/target-mongo` for the first time needs it in `dependencies`. A pack that emits a Mongo `contract.d.ts` re-emits it with `prisma contract emit`, or applies the same rewrite to the committed file; the contract JSON and hashes do not change.
417
+ An extension outside this repository imports the published forms in the last two rows. Then re-sort the import block with the package's formatter (the new specifier sorts after `@internal/mongo-*`). A package that imports from `@internal/target-mongo` for the first time needs it in `dependencies`. A pack that emits a Mongo `contract.d.ts` re-emits it with `prisma contract emit`, or applies the same rewrite to the committed file; the contract JSON and hashes do not change.
412
418
 
413
- `@internal/target-mongo/codecs` also exports `mongoStandardCodecs` and `buildStandardCodecRegistry`, which the adapter used internally before.
419
+ `@internal/target-mongo/codecs` (`@prisma/orm-mongo/target/codecs`) also exports `mongoStandardCodecs` and `buildStandardCodecRegistry`, which the adapter used internally before.
414
420
 
415
421
  ## `create-mongo-runner-deps-removed`
416
422
 
417
423
  ```ts
418
424
  // before
419
- import { createMongoRunnerDeps, extractDb } from '@internal/adapter-mongo/control';
420
- import { MongoDriverImpl } from '@internal/driver-mongo';
425
+ import { createMongoRunnerDeps, extractDb } from '@prisma/orm-mongo/adapter/control';
426
+ import { MongoDriverImpl } from '@prisma/orm-mongo/driver';
421
427
  const deps = createMongoRunnerDeps(controlDriver, MongoDriverImpl.fromDb(extractDb(controlDriver)), family);
422
428
 
423
429
  // after
424
- import { MongoControlAdapterImpl } from '@internal/adapter-mongo/control';
430
+ import { MongoControlAdapterImpl } from '@prisma/orm-mongo/adapter/control';
425
431
  const deps = new MongoControlAdapterImpl().createRunnerDependencies(controlDriver);
426
432
  ```
427
433
 
434
+ Inside this repository the same imports are `@internal/adapter-mongo/control` and `@internal/driver-mongo`.
435
+
428
436
  Drop imports that are now unused and any family instance built only to pass as the third argument.
429
437
 
430
438
  ## `mongo-runner-dependency-types-move-to-family`
431
439
 
432
- Change the import of `MongoRunnerDependencies` or `MarkerOperations` to `@internal/family-mongo/control-adapter`. The shapes are unchanged.
440
+ Change the import of `MongoRunnerDependencies` or `MarkerOperations` to `@prisma/orm-mongo/family/control-adapter` (`@internal/family-mongo/control-adapter` inside this repository). The shapes are unchanged.
433
441
 
434
442
  ## `mongo-control-adapter-creates-runner-dependencies`
435
443
 
@@ -467,11 +475,25 @@ const context: MongoExecutionContext = { contract, codecs, stack, applyMutationD
467
475
 
468
476
  ## `mongo-field-builder-execution-defaults-parameter`
469
477
 
470
- Code that constrains on a bare `FieldBuilder` (for example `Fields extends Record<string, FieldBuilder>`) accepts only builders without execution defaults; pass `ExecutionMutationDefaultPhases | undefined` as the fifth type argument to accept preset fields. There is no detection pattern: a bare `FieldBuilder` reference is too common to tell which uses need the wider type.
478
+ Code that constrains on a bare `FieldBuilder` (for example `Fields extends Record<string, FieldBuilder>`) accepts only builders without execution defaults; pass `ExecutionMutationDefaultPhases | undefined` as the fifth type argument to accept preset fields:
479
+
480
+ ```ts
481
+ import type { ContractFieldType, ExecutionMutationDefaultPhases } from '@prisma/orm-mongo/contract/types';
482
+ import type { EnumTypeHandle, FieldBuilder } from '@prisma/orm-mongo/contract-builder';
483
+
484
+ type AnyField = FieldBuilder<
485
+ ContractFieldType,
486
+ boolean,
487
+ boolean,
488
+ EnumTypeHandle | undefined,
489
+ ExecutionMutationDefaultPhases | undefined
490
+ >;
491
+ ```
492
+ There is no detection pattern: a bare `FieldBuilder` reference is too common to tell which uses need the wider type.
471
493
 
472
494
  ## `mongo-bson-codec-added`
473
495
 
474
- The Mongo target adds the codec `mongo/bson@1` (data type `mongo/bson`, PSL `Bson`, `field.bson()`), whose `CodecTypes` entry reads `BsonValue` and writes `BsonInputValue` (a `BsonValue`, or a `Uint8Array` at any depth), both exported from `@internal/target-mongo/codec-types` (declared in `@internal/mongo-value`, where the Mongo TypeScript builder reads them). `BsonValue` covers every value the driver returns with its default settings, `Code`, `MinKey`, `MaxKey`, `BSONSymbol` and a native `RegExp` (what a stored regex reads back as) included; `BSONRegExp` appears only with a driver configured with `bsonRegExp: true`. A `DBRef` is never returned, because decode turns it back into its `{ $ref, $id[, $db], ...fields }` document. It declares an empty `targetTypes`, so the validator does not constrain its value: a single field gets `{}`, and a list field still must be an array, `{ bsonType: 'array', items: {} }`. An extension that lists every Mongo codec id, or keys a map by `CodecTypes`, adds `mongo/bson@1`. An extension that stores arbitrary BSON in a field of its own contract types it `mongo/bson@1`, because `mongo/json@1` now refuses non-JSON values on encode and decode.
496
+ The Mongo target adds five codecs, none of which existed in 8.0.0-rc.12: `mongo/int64@1` (PSL `Int64`, `bigint`), `mongo/decimal128@1` (PSL `Decimal128`, a decimal string), `mongo/binary@1` (PSL `Binary`, `Uint8Array`), `mongo/json@1` (PSL `Json`, JSON values only, refused on encode and decode otherwise) and `mongo/bson@1` (PSL `Bson`, `field.bson()`, any BSON value). The `mongo/bson@1` entry of `CodecTypes` reads `BsonValue` and writes `BsonInputValue` (a `BsonValue`, or a `Uint8Array` at any depth), both exported from `@prisma/orm-mongo/target/codec-types` (`@internal/target-mongo/codec-types` inside this repository) and declared in `@prisma/orm-mongo/value` (`@internal/mongo-value`), where the Mongo TypeScript builder reads them. `BsonValue` covers every value the driver returns with its default settings, `Code`, `MinKey`, `MaxKey`, `BSONSymbol` and a native `RegExp` (what a stored regex reads back as) included; `BSONRegExp` appears only with a driver configured with `bsonRegExp: true`. A `DBRef` is never returned, because decode turns it back into its `{ $ref, $id[, $db], ...fields }` document. It declares an empty `targetTypes`, so the validator does not constrain its value: a single field gets `{}`, and a list field still must be an array, `{ bsonType: 'array', items: {} }`. An extension that lists every Mongo codec id, or keys a map by `CodecTypes`, adds the five new ones. An extension that stores arbitrary BSON in a field of its own contract types it `mongo/bson@1`, not `mongo/json@1`, which refuses non-JSON values.
475
497
 
476
498
  The detection pattern finds a descriptor whose `targetTypes` lists two or more entries, quoted strings or named constants, on one line or several. It does not see a list built elsewhere and referenced by name (`targetTypes: TYPES`); check those descriptors by hand.
477
499