@prisma/orm-mongo 8.0.0-rc.9-dev.12 → 8.0.1-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.
- package/README.md +48 -8
- package/dist/components-CWskH7lF-Dkc9ysZz.mjs +18 -0
- package/dist/components-CWskH7lF-Dkc9ysZz.mjs.map +1 -0
- package/dist/config.d.mts +14 -5
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +47 -25
- package/dist/config.mjs.map +1 -1
- package/dist/contract-builder.d.mts +33 -91
- package/dist/contract-builder.d.mts.map +1 -1
- package/dist/contract-builder.mjs +23 -7
- package/dist/contract-builder.mjs.map +1 -1
- package/dist/contract-types.d.mts +3 -0
- package/dist/contract-types.mjs +1 -0
- package/dist/contract__format-version.d.mts +1 -0
- package/dist/contract__format-version.mjs +2 -0
- package/dist/contract__internal__format-version.d.mts +1 -0
- package/dist/contract__internal__format-version.mjs +2 -0
- package/dist/contract__validate-once.d.mts +1 -0
- package/dist/contract__validate-once.mjs +2 -0
- package/dist/contract__validate-storage.d.mts +1 -0
- package/dist/contract__validate-storage.mjs +2 -0
- package/dist/control.d.mts +1 -1
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +3 -9
- package/dist/control.mjs.map +1 -1
- package/dist/driver__runtime.d.mts +3 -0
- package/dist/driver__runtime.mjs +3 -0
- package/dist/family-contract__data-type.d.mts +1 -0
- package/dist/family-contract__data-type.mjs +2 -0
- package/dist/init-quick-reference.md +116 -0
- package/dist/init-readme.md +35 -0
- package/dist/init.d.mts +7 -0
- package/dist/init.d.mts.map +1 -0
- package/dist/init.mjs +245 -0
- package/dist/init.mjs.map +1 -0
- package/dist/migration.d.mts +1 -0
- package/dist/migration.mjs +2 -0
- package/dist/module-base-B70DHaBE-k_c3Klu4.mjs +6 -0
- package/dist/module-base-B70DHaBE-k_c3Klu4.mjs.map +1 -0
- package/dist/mongo-static-CfvV1-qX-DdckMRxc.mjs +74 -0
- package/dist/mongo-static-CfvV1-qX-DdckMRxc.mjs.map +1 -0
- package/dist/{mongo-static-BdSGXYgQ-DSA-2DiK.d.mts → mongo-static-DabeBtmV-DILuhcbE.d.mts} +18 -5
- package/dist/mongo-static-DabeBtmV-DILuhcbE.d.mts.map +1 -0
- package/dist/runtime.d.mts +49 -44
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +104 -42
- package/dist/runtime.mjs.map +1 -1
- package/dist/static.d.mts +24 -2
- package/dist/static.d.mts.map +1 -0
- package/dist/static.mjs +2 -2
- package/dist/target__codec-ids.d.mts +1 -0
- package/dist/target__codec-ids.mjs +2 -0
- package/dist/target__codecs.d.mts +1 -0
- package/dist/target__codecs.mjs +2 -0
- package/dist/target__data-types.d.mts +1 -0
- package/dist/target__data-types.mjs +2 -0
- package/dist/target__server-version.d.mts +1 -0
- package/dist/target__server-version.mjs +2 -0
- package/dist/utils__guards.d.mts +1 -0
- package/dist/utils__guards.mjs +2 -0
- package/dist/utils__text.d.mts +1 -0
- package/dist/utils__text.mjs +2 -0
- package/dist/utils__upgrade-guides.d.mts +1 -0
- package/dist/utils__upgrade-guides.mjs +2 -0
- package/package.json +37 -13
- package/skills/prisma-8/SKILL.md +24 -19
- package/skills/prisma-8/references/build-a-target-package.md +117 -0
- package/skills/prisma-8/references/build.md +12 -16
- package/skills/prisma-8/references/contract.md +181 -75
- package/skills/prisma-8/references/debug.md +38 -27
- package/skills/prisma-8/references/feedback.md +8 -8
- package/skills/prisma-8/references/migration-model.md +28 -18
- package/skills/prisma-8/references/migration-review.md +24 -53
- package/skills/prisma-8/references/migrations.md +298 -84
- package/skills/prisma-8/references/queries-mongo.md +53 -17
- package/skills/prisma-8/references/queries-postgres.md +345 -34
- package/skills/prisma-8/references/queries.md +44 -25
- package/skills/prisma-8/references/quickstart.md +28 -25
- package/skills/prisma-8/references/runtime.md +172 -72
- package/skills/prisma-8/references/supabase.md +22 -19
- package/skills/prisma-8/references/upgrade-app.md +57 -22
- package/skills/prisma-8/references/upgrade-extension.md +72 -23
- package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/instructions.md +1 -1
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.10-to-8.0.0-rc.11/instructions.md +34 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/instructions.md +639 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/scripts/multifile-psl/add-use-prisma-8-directive.mjs +60 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/scripts/psl-verbatim-table-names/add-model-map.mjs +256 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/instructions.md +332 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/scripts/execution-ref-entry-field/rename-execution-ref-keys.ts +193 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.13-to-8.0.0-rc.14/instructions.md +489 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.14-to-8.0.0-rc.15/instructions.md +1368 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.14-to-8.0.0-rc.15/scripts/data-type-in-contract/data-type-in-contract.ts +1492 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.15-to-8.0.0-rc.16/instructions.md +108 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.16-to-8.0.0-rc.17/instructions.md +755 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.17-to-8.0.0-rc.18/instructions.md +973 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.17-to-8.0.0-rc.18/scripts/sql-expression-literals-psl/rewrite-sql-strings.mjs +271 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/instructions.md +1862 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/client-takes-contract-value/contract-from-json.ts +597 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/data-type-values/data-type-values.ts +1120 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/default-generators-to-on-create/rewrite-default-generators.mjs +86 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/mongo-field-storage-names/mongo-field-storage-names.ts +304 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/remove-nocheck/remove-nocheck.ts +2462 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.19-to-8.0.0-rc.20/instructions.md +513 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.19-to-8.0.0-rc.20/scripts/expand-type-aliases/expand-type-aliases.ts +1206 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.20-to-8.0.0-rc.21/instructions.md +803 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.21-to-8.0.0-rc.22/instructions.md +586 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.21-to-8.0.0-rc.22/scripts/value-objects-in-storage/value-objects-in-storage.ts +1184 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.22-to-8.0.0-rc.23/instructions.md +480 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.22-to-8.0.0-rc.23/scripts/mongo-index-names/mongo-index-names.ts +317 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.23-to-8.0.0-rc.24/instructions.md +336 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.23-to-8.0.0-rc.24/scripts/mongo-convenience-date-time-types/rewrite-mongo-date-types.ts +220 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.23-to-8.0.0-rc.24/scripts/mongo-type-helpers/rewrite-mongo-field-types.ts +621 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.24-to-8.0.0-rc.25/instructions.md +1561 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.9-to-8.0.0-rc.10/instructions.md +13 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.10-to-0.11/instructions.md +1 -1
- package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/instructions.md +1 -1
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.10-to-8.0.0-rc.11/instructions.md +34 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/instructions.md +857 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/scripts/psl-verbatim-table-names/add-model-map.mjs +256 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/instructions.md +504 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/scripts/execution-ref-entry-field/rename-execution-ref-keys.ts +193 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.13-to-8.0.0-rc.14/instructions.md +143 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.14-to-8.0.0-rc.15/instructions.md +2168 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.14-to-8.0.0-rc.15/scripts/data-type-in-contract/data-type-in-contract.ts +1492 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.15-to-8.0.0-rc.16/instructions.md +223 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.16-to-8.0.0-rc.17/instructions.md +583 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.17-to-8.0.0-rc.18/instructions.md +1008 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/instructions.md +2186 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/client-takes-contract-value/contract-from-json.ts +597 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/data-type-values/data-type-values.ts +1120 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/default-generators-to-on-create/rewrite-default-generators.mjs +86 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/mongo-field-storage-names/mongo-field-storage-names.ts +304 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/remove-nocheck/remove-nocheck.ts +2462 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.19-to-8.0.0-rc.20/instructions.md +381 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.19-to-8.0.0-rc.20/scripts/expand-type-aliases/expand-type-aliases.ts +1206 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.20-to-8.0.0-rc.21/instructions.md +570 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.21-to-8.0.0-rc.22/instructions.md +464 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.22-to-8.0.0-rc.23/instructions.md +410 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.23-to-8.0.0-rc.24/instructions.md +303 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.23-to-8.0.0-rc.24/scripts/mongo-convenience-date-time-types/rewrite-mongo-date-types.ts +220 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.23-to-8.0.0-rc.24/scripts/mongo-type-helpers/rewrite-mongo-field-types.ts +621 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.24-to-8.0.0-rc.25/instructions.md +1593 -0
- package/dist/adapter__codec-ids.d.mts +0 -1
- package/dist/adapter__codec-ids.mjs +0 -2
- package/dist/adapter__codec-types.d.mts +0 -1
- package/dist/adapter__codec-types.mjs +0 -2
- package/dist/adapter__codecs.d.mts +0 -1
- package/dist/adapter__codecs.mjs +0 -2
- package/dist/mongo-static-BdSGXYgQ-DSA-2DiK.d.mts.map +0 -1
- package/dist/mongo-static-_wy-fC4P-mXlhePy0.mjs +0 -38
- package/dist/mongo-static-_wy-fC4P-mXlhePy0.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
# @prisma/orm-mongo
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
The package a MongoDB application imports Prisma from. It wires the framework, the Mongo family, and the Mongo target into a single lazy client.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
> **Maturity level: Early Access.** This package is published so that you can try it. It may have known failures, and any new version may change it. At each new release you edit the Prisma lines in your `package.json` by hand, and [Versions and support](https://github.com/prisma/orm/blob/main/docs/oss/versioning.md#a-new-minor-below-ga) shows how. Until release 8.0 it is published as `8.0.0-rc.N`, like every Prisma 8 package, and any of those versions may contain breaking changes.
|
|
6
|
+
|
|
7
|
+
This package is built from other Prisma packages, the platform packages, and your application lists them beside it in `package.json`. `prisma orm init` writes those lines for you. To add them by hand:
|
|
8
|
+
|
|
9
|
+
- Until release 8.0, give every `@prisma/orm-*` package the same exact version, such as `8.0.0-rc.25`.
|
|
10
|
+
- From release 8.0, use the command below. It is written for release 8.0. For a later release, such as 8.3, write `8.3.0` in place of `8.0.1`.
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
pnpm add "@prisma/orm-mongo@~8.0.1-ea.0" "@prisma/orm-framework@~8.0.1" "@prisma/orm-family-mongo@~8.0.1-ea.0" "@prisma/orm-target-mongo@~8.0.1-ea.0" "@prisma/orm-toolchain@~8.0.1"
|
|
14
|
+
pnpm add mongodb
|
|
8
15
|
```
|
|
9
16
|
|
|
10
17
|
```
|
|
@@ -15,21 +22,29 @@ The one package a MongoDB application installs. It wires the framework, the Mong
|
|
|
15
22
|
└── @prisma/orm-toolchain ORM command family for the `prisma` CLI, emitter, config loader
|
|
16
23
|
```
|
|
17
24
|
|
|
25
|
+
Keep all of these lines, on the same release. Your code imports only from `@prisma/orm-mongo` and from extensions, never from the other packages. If your package manager prints a peer dependency warning for a Prisma package, or refuses to install, the versions in these lines do not fit together: put them back on one release. [ADR 329](https://github.com/prisma/orm/blob/main/docs/architecture%20docs/adrs/ADR%20329%20-%20An%20application%20lists%20the%20platform%20packages%20and%20our%20packages%20name%20each%20other%20as%20peers.md) explains why they are listed.
|
|
26
|
+
|
|
27
|
+
In a repository with several applications on different Prisma versions, npm workspaces and Bun with its hoisted linker can give one application two copies of a platform package without a warning. Keep the applications on one Prisma version, or use pnpm, Yarn, or Bun with its isolated linker.
|
|
28
|
+
|
|
18
29
|
`mongodb` is a peer dependency: the driver is the application's, so a single connection pool and a single BSON implementation serve both Prisma 8 and any direct `mongodb` use in the same process.
|
|
19
30
|
|
|
31
|
+
`temporal-polyfill` is a required peer dependency. The control plane, such as the `prisma` commands, loads it as a fallback `Temporal` when the runtime has none, and a project that already installs it for its own code has one copy. npm, pnpm and bun install it automatically; with Yarn, add `temporal-polyfill` to your dependencies.
|
|
32
|
+
|
|
20
33
|
## Entrypoints
|
|
21
34
|
|
|
22
35
|
| Namespace | Surface |
|
|
23
36
|
| --- | --- |
|
|
24
37
|
| `/runtime` | `mongo(url)` — the lazy query client |
|
|
25
38
|
| `/static` | statically composed runtime for pre-wired deployments |
|
|
26
|
-
| `/config` | `defineConfig` for `prisma.config.ts` |
|
|
39
|
+
| `/config` | `defineConfig` for `prisma.config.ts`, and `prisma6Schema` to read a Prisma 6 MongoDB schema as the contract source |
|
|
40
|
+
| `/contract-types` | the types a generated `contract.d.ts` imports |
|
|
27
41
|
| `/contract-builder` | `defineContract` and Mongo contract authoring |
|
|
28
42
|
| `/bson` | BSON value helpers (`ObjectId`, `Decimal128`, …) |
|
|
29
43
|
| `/target`, `/family` | the Mongo target pack and the Mongo family pack |
|
|
30
|
-
| `/control` | the control client |
|
|
44
|
+
| `/migration`, `/control` | migration planning and the control client |
|
|
45
|
+
| `/init` | the init contribution `prisma orm init` writes a project from |
|
|
31
46
|
|
|
32
|
-
|
|
47
|
+
A generated `contract.d.ts` imports every framework, family and target type it names from `/contract-types`, and a generated `migration.ts` imports from `/migration`: the modules this package's `defineConfig` sets as `contract.typesModule` and `migrations.module`. This package also forwards the namespaces of the packages it is built from, so application code imports from this package alone, even though the application lists those packages too:
|
|
33
48
|
|
|
34
49
|
| Namespace | Forwards |
|
|
35
50
|
| --- | --- |
|
|
@@ -39,7 +54,32 @@ Generated contract files import their types from the facade, so an application n
|
|
|
39
54
|
| `/target/*` | `@prisma/orm-target-mongo/target` |
|
|
40
55
|
| `/adapter`, `/adapter/*` | `@prisma/orm-target-mongo/adapter` |
|
|
41
56
|
|
|
42
|
-
These forward; they do not copy. `@prisma/orm-mongo/contract/types` and `@prisma/orm-framework/contract/types` are the same module, so
|
|
57
|
+
These forward; they do not copy. `@prisma/orm-mongo/contract/types` and `@prisma/orm-framework/contract/types` are the same module, so a value made through either is recognised by both, and `instanceof` checks hold across the boundary.
|
|
58
|
+
|
|
59
|
+
## Prepared statements
|
|
60
|
+
|
|
61
|
+
`db.prepare(declaration, callback)` builds a query once and runs it many times with different values. Run the handle against `await db.runtime()`:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
const byEmail = await db.prepare({ email: 'mongo/string@1' }, (p) =>
|
|
65
|
+
db.query
|
|
66
|
+
.from('users')
|
|
67
|
+
.match((f) => f.email.eq(p.email))
|
|
68
|
+
.build(),
|
|
69
|
+
);
|
|
70
|
+
const users = await byEmail.query(await db.runtime(), { email: 'alice@example.com' }).toArray();
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
ORM reads are prepared through `.prepared.all()`, `.prepared.first()` and `.prepared.firstOrThrow()`, and the handle's `query` returns what the ad-hoc read returns:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
const userByEmail = await db.prepare({ email: 'mongo/string@1' }, (p) =>
|
|
77
|
+
db.orm.users.where({ email: p.email }).prepared.first(),
|
|
78
|
+
);
|
|
79
|
+
const user = await userByEmail.query(await db.runtime(), { email: 'alice@example.com' });
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The handle and declaration types (`MongoPreparedStatement`, `MongoPreparedExecution`, `MongoDeclaration`, `MongoParamsFromDeclaration`) are exported from `@prisma/orm-mongo/family-runtime`. The ORM read handle types (`MongoPreparedRowQuery`, `MongoPreparedFrom`) and `MongoPrepareMember`, the type that has the client's `prepare` method, are exported from `@prisma/orm-mongo/runtime`.
|
|
43
83
|
|
|
44
84
|
## The CLI
|
|
45
85
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { t as moduleBase } from "./module-base-B70DHaBE-k_c3Klu4.mjs";
|
|
2
|
+
import mongoAdapter from "@prisma/orm-target-mongo/adapter/control";
|
|
3
|
+
import mongoDriver from "@prisma/orm-target-mongo/driver/control";
|
|
4
|
+
import { mongoFamilyDescriptor } from "@prisma/orm-family-mongo/family/control";
|
|
5
|
+
import { mongoTargetDescriptor } from "@prisma/orm-target-mongo/target/control";
|
|
6
|
+
import { restateTypeDeclarations } from "@prisma/orm-framework/target-package-config/type-declarations";
|
|
7
|
+
//#region ../../../3-targets/mongo/9-facade/dist/components-CWskH7lF.mjs
|
|
8
|
+
const contractTypesModule = `${moduleBase}/contract-types`;
|
|
9
|
+
const controlComponents = {
|
|
10
|
+
family: mongoFamilyDescriptor,
|
|
11
|
+
target: restateTypeDeclarations(mongoTargetDescriptor, contractTypesModule),
|
|
12
|
+
adapter: restateTypeDeclarations(mongoAdapter, contractTypesModule),
|
|
13
|
+
driver: mongoDriver
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { controlComponents as n, contractTypesModule as t };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=components-CWskH7lF-Dkc9ysZz.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-CWskH7lF-Dkc9ysZz.mjs","names":[],"sources":["../../../../3-targets/mongo/9-facade/dist/components-CWskH7lF.mjs"],"sourcesContent":["import { t as moduleBase } from \"./module-base-B70DHaBE.mjs\";\nimport mongoAdapter from \"@internal/adapter-mongo/control\";\nimport mongoDriver from \"@internal/driver-mongo/control\";\nimport { mongoFamilyDescriptor } from \"@internal/family-mongo/control\";\nimport { mongoTargetDescriptor } from \"@internal/target-mongo/control\";\nimport { restateTypeDeclarations } from \"@internal/target-package-config/type-declarations\";\n//#region src/config/components.ts\nconst contractTypesModule = `${moduleBase}/contract-types`;\nconst controlComponents = {\n\tfamily: mongoFamilyDescriptor,\n\ttarget: restateTypeDeclarations(mongoTargetDescriptor, contractTypesModule),\n\tadapter: restateTypeDeclarations(mongoAdapter, contractTypesModule),\n\tdriver: mongoDriver\n};\n//#endregion\nexport { controlComponents as n, contractTypesModule as t };\n\n//# sourceMappingURL=components-CWskH7lF.mjs.map"],"mappings":";;;;;;;AAOA,MAAM,sBAAsB,GAAG,WAAW;AAC1C,MAAM,oBAAoB;CACzB,QAAQ;CACR,QAAQ,wBAAwB,uBAAuB,mBAAmB;CAC1E,SAAS,wBAAwB,cAAc,mBAAmB;CAClE,QAAQ;AACT"}
|
package/dist/config.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContractConfig, FormatterConfig, PrismaConfig } from "@prisma/orm-framework/config/config-types";
|
|
2
2
|
import { ControlExtensionDescriptor } from "@prisma/orm-framework/components/control";
|
|
3
|
-
//#region ../../../3-
|
|
3
|
+
//#region ../../../3-targets/mongo/9-facade/dist/config.d.mts
|
|
4
4
|
//#region src/config/define-config.d.ts
|
|
5
5
|
interface MongoConfigOptions {
|
|
6
|
-
|
|
6
|
+
/** A contract file path (`.prisma` or `.ts`), or a ready `ContractConfig` such as `prisma6Schema(...)`. */
|
|
7
|
+
readonly contract: string | ContractConfig;
|
|
7
8
|
readonly output?: string;
|
|
8
9
|
readonly db?: {
|
|
9
10
|
readonly connection?: string;
|
|
@@ -12,8 +13,16 @@ interface MongoConfigOptions {
|
|
|
12
13
|
readonly migrations?: {
|
|
13
14
|
readonly dir?: string;
|
|
14
15
|
};
|
|
16
|
+
readonly formatter?: FormatterConfig;
|
|
15
17
|
}
|
|
16
|
-
declare function defineConfig(options: MongoConfigOptions):
|
|
18
|
+
declare function defineConfig(options: MongoConfigOptions): PrismaConfig<'mongo', 'mongo'>;
|
|
17
19
|
//#endregion
|
|
18
|
-
|
|
20
|
+
//#region src/config/prisma6-schema.d.ts
|
|
21
|
+
/**
|
|
22
|
+
* Reads a Prisma 6 MongoDB `schema.prisma` (or a directory of `.prisma` files) as the
|
|
23
|
+
* contract source, so Prisma 8 can adopt a database a Prisma 6 application still uses.
|
|
24
|
+
*/
|
|
25
|
+
declare function prisma6Schema(schemaPath: string): ContractConfig;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { type MongoConfigOptions, defineConfig, prisma6Schema };
|
|
19
28
|
//# sourceMappingURL=config.d.mts.map
|
package/dist/config.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.mts","names":[],"sources":["../../../../3-
|
|
1
|
+
{"version":3,"file":"config.d.mts","names":[],"sources":["../../../../3-targets/mongo/9-facade/dist/config.d.mts"],"mappings":";;;;UAGU;;WAEC,mBAAmB;WACnB;WACA;aACE;;WAEF,sBAAsB;WACtB;aACE;;WAEF,YAAY;;iBAEN,aAAa,SAAS,qBAAqB;;;;;;;iBAO3C,cAAc,qBAAqB"}
|
package/dist/config.mjs
CHANGED
|
@@ -1,40 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { defineConfig as defineConfig$1 } from "@prisma/orm-framework/config/config-types";
|
|
4
|
-
import mongoDriver from "@prisma/orm-target-mongo/driver/control";
|
|
5
|
-
import { mongoFamilyDescriptor } from "@prisma/orm-family-mongo/family/control";
|
|
1
|
+
import { t as moduleBase } from "./module-base-B70DHaBE-k_c3Klu4.mjs";
|
|
2
|
+
import { n as controlComponents, t as contractTypesModule } from "./components-CWskH7lF-Dkc9ysZz.mjs";
|
|
3
|
+
import { defaultContractOutputPath, defineConfig as defineConfig$1 } from "@prisma/orm-framework/config/config-types";
|
|
6
4
|
import { mongoContract } from "@prisma/orm-family-mongo/contract-psl/provider";
|
|
7
5
|
import { typescriptContractFromPath } from "@prisma/orm-family-mongo/contract-ts/config-types";
|
|
8
|
-
import {
|
|
6
|
+
import { MONGO_INT32_CODEC_ID, MONGO_STRING_CODEC_ID } from "@prisma/orm-target-mongo/target/codec-ids";
|
|
7
|
+
import mongoTargetPack from "@prisma/orm-target-mongo/target/pack";
|
|
9
8
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
10
9
|
import { extname, join } from "pathe";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return
|
|
10
|
+
import { prisma6Contract } from "@prisma/orm-family-mongo/contract-prisma6/provider";
|
|
11
|
+
import { prisma6MongoBinding } from "@prisma/orm-target-mongo/target/prisma6-binding";
|
|
12
|
+
//#region ../../../3-targets/mongo/9-facade/dist/config.mjs
|
|
13
|
+
function contractConfigFromPath(contractPath, output, extensions) {
|
|
14
|
+
return extname(contractPath) === ".ts" ? typescriptContractFromPath(contractPath, output) : mongoContract(contractPath, {
|
|
15
|
+
target: mongoTargetPack,
|
|
16
|
+
extensionPacks: Object.fromEntries(extensions.map((extension) => [extension.id, extension])),
|
|
17
|
+
output,
|
|
18
|
+
enumInferenceCodecs: {
|
|
19
|
+
text: MONGO_STRING_CODEC_ID,
|
|
20
|
+
int: MONGO_INT32_CODEC_ID
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function resolveContractConfig(options, extensions) {
|
|
25
|
+
const explicitOutput = options.output !== void 0 ? join(options.output, "contract.json") : void 0;
|
|
26
|
+
if (typeof options.contract === "string") return contractConfigFromPath(options.contract, explicitOutput ?? defaultContractOutputPath(options.contract), extensions);
|
|
27
|
+
const firstInput = options.contract.source.inputs?.[0];
|
|
28
|
+
const output = explicitOutput ?? options.contract.output ?? (firstInput !== void 0 ? defaultContractOutputPath(firstInput) : void 0);
|
|
29
|
+
return {
|
|
30
|
+
...options.contract,
|
|
31
|
+
...ifDefined("output", output)
|
|
32
|
+
};
|
|
16
33
|
}
|
|
17
34
|
function defineConfig(options) {
|
|
18
35
|
const extensions = options.extensions ?? [];
|
|
19
|
-
const
|
|
36
|
+
const contractConfig = resolveContractConfig(options, extensions);
|
|
20
37
|
return defineConfig$1({
|
|
21
|
-
|
|
22
|
-
target: mongoTargetDescriptor,
|
|
23
|
-
adapter: mongoAdapter,
|
|
24
|
-
driver: mongoDriver,
|
|
38
|
+
...controlComponents,
|
|
25
39
|
extensions,
|
|
26
|
-
contract:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
contract: {
|
|
41
|
+
...contractConfig,
|
|
42
|
+
typesModule: contractTypesModule
|
|
43
|
+
},
|
|
44
|
+
migrations: {
|
|
45
|
+
...options.migrations,
|
|
46
|
+
module: `${moduleBase}/migration`
|
|
47
|
+
},
|
|
33
48
|
...ifDefined("db", options.db),
|
|
34
|
-
...ifDefined("
|
|
49
|
+
...ifDefined("formatter", options.formatter)
|
|
35
50
|
});
|
|
36
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Reads a Prisma 6 MongoDB `schema.prisma` (or a directory of `.prisma` files) as the
|
|
54
|
+
* contract source, so Prisma 8 can adopt a database a Prisma 6 application still uses.
|
|
55
|
+
*/
|
|
56
|
+
function prisma6Schema(schemaPath) {
|
|
57
|
+
return prisma6Contract(schemaPath, { binding: prisma6MongoBinding });
|
|
58
|
+
}
|
|
37
59
|
//#endregion
|
|
38
|
-
export { defineConfig };
|
|
60
|
+
export { defineConfig, prisma6Schema };
|
|
39
61
|
|
|
40
62
|
//# sourceMappingURL=config.mjs.map
|
package/dist/config.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","names":[],"sources":["../../../../3-
|
|
1
|
+
{"version":3,"file":"config.mjs","names":[],"sources":["../../../../3-targets/mongo/9-facade/dist/config.mjs"],"sourcesContent":["import { t as moduleBase } from \"./module-base-B70DHaBE.mjs\";\nimport { n as controlComponents, t as contractTypesModule } from \"./components-CWskH7lF.mjs\";\nimport { defaultContractOutputPath, defineConfig as defineConfig$1 } from \"@internal/config/config-types\";\nimport { mongoContract } from \"@internal/mongo-contract-psl/provider\";\nimport { typescriptContractFromPath } from \"@internal/mongo-contract-ts/config-types\";\nimport { MONGO_INT32_CODEC_ID, MONGO_STRING_CODEC_ID } from \"@internal/target-mongo/codec-ids\";\nimport mongoTargetPack from \"@internal/target-mongo/pack\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { extname, join } from \"pathe\";\nimport { prisma6Contract } from \"@internal/mongo-contract-prisma6/provider\";\nimport { prisma6MongoBinding } from \"@internal/target-mongo/prisma6-binding\";\n//#region src/config/define-config.ts\nfunction contractConfigFromPath(contractPath, output, extensions) {\n\treturn extname(contractPath) === \".ts\" ? typescriptContractFromPath(contractPath, output) : mongoContract(contractPath, {\n\t\ttarget: mongoTargetPack,\n\t\textensionPacks: Object.fromEntries(extensions.map((extension) => [extension.id, extension])),\n\t\toutput,\n\t\tenumInferenceCodecs: {\n\t\t\ttext: MONGO_STRING_CODEC_ID,\n\t\t\tint: MONGO_INT32_CODEC_ID\n\t\t}\n\t});\n}\nfunction resolveContractConfig(options, extensions) {\n\tconst explicitOutput = options.output !== void 0 ? join(options.output, \"contract.json\") : void 0;\n\tif (typeof options.contract === \"string\") return contractConfigFromPath(options.contract, explicitOutput ?? defaultContractOutputPath(options.contract), extensions);\n\tconst firstInput = options.contract.source.inputs?.[0];\n\tconst output = explicitOutput ?? options.contract.output ?? (firstInput !== void 0 ? defaultContractOutputPath(firstInput) : void 0);\n\treturn {\n\t\t...options.contract,\n\t\t...ifDefined(\"output\", output)\n\t};\n}\nfunction defineConfig(options) {\n\tconst extensions = options.extensions ?? [];\n\tconst contractConfig = resolveContractConfig(options, extensions);\n\treturn defineConfig$1({\n\t\t...controlComponents,\n\t\textensions,\n\t\tcontract: {\n\t\t\t...contractConfig,\n\t\t\ttypesModule: contractTypesModule\n\t\t},\n\t\tmigrations: {\n\t\t\t...options.migrations,\n\t\t\tmodule: `${moduleBase}/migration`\n\t\t},\n\t\t...ifDefined(\"db\", options.db),\n\t\t...ifDefined(\"formatter\", options.formatter)\n\t});\n}\n//#endregion\n//#region src/config/prisma6-schema.ts\n/**\n* Reads a Prisma 6 MongoDB `schema.prisma` (or a directory of `.prisma` files) as the\n* contract source, so Prisma 8 can adopt a database a Prisma 6 application still uses.\n*/\nfunction prisma6Schema(schemaPath) {\n\treturn prisma6Contract(schemaPath, { binding: prisma6MongoBinding });\n}\n//#endregion\nexport { defineConfig, prisma6Schema };\n\n//# sourceMappingURL=config.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,SAAS,uBAAuB,cAAc,QAAQ,YAAY;CACjE,OAAO,QAAQ,YAAY,MAAM,QAAQ,2BAA2B,cAAc,MAAM,IAAI,cAAc,cAAc;EACvH,QAAQ;EACR,gBAAgB,OAAO,YAAY,WAAW,KAAK,cAAc,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC;EAC3F;EACA,qBAAqB;GACpB,MAAM;GACN,KAAK;EACN;CACD,CAAC;AACF;AACA,SAAS,sBAAsB,SAAS,YAAY;CACnD,MAAM,iBAAiB,QAAQ,WAAW,KAAK,IAAI,KAAK,QAAQ,QAAQ,eAAe,IAAI,KAAK;CAChG,IAAI,OAAO,QAAQ,aAAa,UAAU,OAAO,uBAAuB,QAAQ,UAAU,kBAAkB,0BAA0B,QAAQ,QAAQ,GAAG,UAAU;CACnK,MAAM,aAAa,QAAQ,SAAS,OAAO,SAAS;CACpD,MAAM,SAAS,kBAAkB,QAAQ,SAAS,WAAW,eAAe,KAAK,IAAI,0BAA0B,UAAU,IAAI,KAAK;CAClI,OAAO;EACN,GAAG,QAAQ;EACX,GAAG,UAAU,UAAU,MAAM;CAC9B;AACD;AACA,SAAS,aAAa,SAAS;CAC9B,MAAM,aAAa,QAAQ,cAAc,CAAC;CAC1C,MAAM,iBAAiB,sBAAsB,SAAS,UAAU;CAChE,OAAO,eAAe;EACrB,GAAG;EACH;EACA,UAAU;GACT,GAAG;GACH,aAAa;EACd;EACA,YAAY;GACX,GAAG,QAAQ;GACX,QAAQ,GAAG,WAAW;EACvB;EACA,GAAG,UAAU,MAAM,QAAQ,EAAE;EAC7B,GAAG,UAAU,aAAa,QAAQ,SAAS;CAC5C,CAAC;AACF;;;;;AAOA,SAAS,cAAc,YAAY;CAClC,OAAO,gBAAgB,YAAY,EAAE,SAAS,oBAAoB,CAAC;AACpE"}
|
|
@@ -1,113 +1,40 @@
|
|
|
1
|
-
import { ContractDefinition, ContractDefinition as ContractDefinition$1, ContractFactory, ContractFactory as ContractFactory$1, ContractScaffold, ContractScaffold as ContractScaffold$1, EnumMember, EnumTypeHandle, FieldBuilder, FieldReference, ModelBuilder, MongoContractResult, MongoContractResult as MongoContractResult$1, RelationBuilder, ValueObjectBuilder, field, index, member, model, rel, valueObject } from "@prisma/orm-family-mongo/contract-ts/contract-builder";
|
|
2
|
-
import mongoFamilyPack from "@prisma/orm-family-mongo/family/pack";
|
|
3
1
|
import mongoTargetPack from "@prisma/orm-target-mongo/target/pack";
|
|
4
|
-
import "@prisma/orm-
|
|
5
|
-
import "@prisma/orm-
|
|
6
|
-
import {
|
|
7
|
-
|
|
2
|
+
import { ContractAuthoringHelpers, ContractFactory, ContractFactory as ContractFactory$1, ContractInput, ContractInput as ContractInput$1, ContractScaffold, ContractScaffold as ContractScaffold$1, EnumMember, EnumTypeHandle, ExtractCodecTypesFromPack, FieldBuilder, FieldReference, ModelBuilder, MongoContractResult, MongoContractResult as MongoContractResult$1, RelationBuilder, ValueObjectBuilder, index, member, model, rel, valueObject } from "@prisma/orm-family-mongo/contract-ts/contract-builder";
|
|
3
|
+
import mongoFamilyPack from "@prisma/orm-family-mongo/family/pack";
|
|
4
|
+
import { ExtensionPackRef } from "@prisma/orm-framework/components/components";
|
|
5
|
+
import { BoundEnumType } from "@prisma/orm-framework/contract-authoring";
|
|
6
|
+
//#region ../../../3-targets/mongo/9-facade/dist/contract-builder.d.mts
|
|
8
7
|
//#region src/contract/define-contract.d.ts
|
|
9
8
|
type MongoFamilyPack = typeof mongoFamilyPack;
|
|
10
9
|
type MongoTargetPack = typeof mongoTargetPack;
|
|
11
|
-
type
|
|
12
|
-
type
|
|
10
|
+
type MongoExtensionPacks = Record<string, ExtensionPackRef<'mongo', string>>;
|
|
11
|
+
type ExtensionsConstraint = MongoExtensionPacks | undefined;
|
|
12
|
+
type MongoHelpers$1<Extensions extends ExtensionsConstraint> = Parameters<ContractFactory$1<Record<never, never>, Record<never, never>, undefined, MongoFamilyPack, MongoTargetPack, Extensions>>[0];
|
|
13
|
+
type MongoContractInput<Extensions extends ExtensionsConstraint> = Omit<ContractInput$1<MongoFamilyPack, MongoTargetPack, Record<never, never>, Record<never, never>, Extensions>, 'family' | 'target'> & {
|
|
13
14
|
readonly family?: never;
|
|
14
15
|
readonly target?: never;
|
|
15
16
|
};
|
|
16
|
-
type MongoScaffoldInput = Omit<ContractScaffold$1<MongoFamilyPack, MongoTargetPack>, 'family' | 'target'> & {
|
|
17
|
+
type MongoScaffoldInput<Extensions extends ExtensionsConstraint> = Omit<ContractScaffold$1<MongoFamilyPack, MongoTargetPack, Extensions>, 'family' | 'target'> & {
|
|
17
18
|
readonly family?: never;
|
|
18
19
|
readonly target?: never;
|
|
19
20
|
};
|
|
20
|
-
declare function defineContract<const
|
|
21
|
+
declare function defineContract<const Input extends MongoContractInput<ExtensionsConstraint>>(input: Input): MongoContractResult$1<Omit<Input, 'family' | 'target'> & {
|
|
21
22
|
readonly family: MongoFamilyPack;
|
|
22
23
|
readonly target: MongoTargetPack;
|
|
23
24
|
}>;
|
|
24
|
-
declare function defineContract<const
|
|
25
|
+
declare function defineContract<const Extensions extends ExtensionsConstraint, const Scaffold extends MongoScaffoldInput<Extensions>, const Built extends {
|
|
25
26
|
readonly models?: Record<string, unknown>;
|
|
26
27
|
readonly valueObjects?: Record<string, unknown>;
|
|
27
28
|
readonly roots?: Record<string, string>;
|
|
28
|
-
}>(scaffold:
|
|
29
|
+
}>(scaffold: Scaffold & {
|
|
30
|
+
readonly extensions?: Extensions;
|
|
31
|
+
}, factory: (helpers: MongoHelpers$1<Extensions>) => Built): MongoContractResult$1<Omit<Scaffold, 'family' | 'target'> & Built & {
|
|
29
32
|
readonly family: MongoFamilyPack;
|
|
30
33
|
readonly target: MongoTargetPack;
|
|
31
34
|
}>;
|
|
32
35
|
//#endregion
|
|
33
|
-
//#region ../../1-framework/2-authoring/contract/dist/index.d.mts
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/enum-type.d.ts
|
|
36
|
-
/**
|
|
37
|
-
* A single enum member produced by `member()`. The `Name` and `Value` generics
|
|
38
|
-
* are preserved as literal types so `enumType()` can carry the ordered value
|
|
39
|
-
* tuple in its return type. `Value` is whatever the codec dictates — its type
|
|
40
|
-
* is constrained at `enumType` against the codec's input type, not here.
|
|
41
|
-
*/
|
|
42
|
-
interface EnumMember$1<Name extends string, Value> {
|
|
43
|
-
readonly name: Name;
|
|
44
|
-
readonly value: Value;
|
|
45
|
-
}
|
|
46
|
-
type MembersToValues<Members extends readonly EnumMember$1<string, unknown>[]> = { readonly [K in keyof Members]: Members[K] extends EnumMember$1<string, infer V> ? V : never; };
|
|
47
|
-
type MembersToNames<Members extends readonly EnumMember$1<string, unknown>[]> = { readonly [K in keyof Members]: Members[K] extends EnumMember$1<infer N, unknown> ? N : never; };
|
|
48
|
-
type MembersAccessorMap<Members extends readonly EnumMember$1<string, unknown>[]> = { readonly [M in Members[number] as M['name']]: M['value']; };
|
|
49
|
-
declare const ENUM_TYPE_HANDLE_BRAND = "__prismaNextEnumTypeHandle__";
|
|
50
|
-
/** Authoring handle returned by `enumType()`. Generic over the ordered value tuple so `const Role = enumType(...)` retains literal types. */
|
|
51
|
-
interface EnumTypeHandle$1<Name extends string = string, Values extends readonly unknown[] = readonly unknown[], Names extends readonly string[] = readonly string[], MembersMap extends Record<string, unknown> = Record<string, unknown>> {
|
|
52
|
-
/** Internal brand for lowering-pipeline detection. */
|
|
53
|
-
readonly [ENUM_TYPE_HANDLE_BRAND]: true;
|
|
54
|
-
/** The enum's declared name (used as the key in domain `enum` / storage `valueSet`). */
|
|
55
|
-
readonly enumName: Name;
|
|
56
|
-
/** codecId from the codec passed to `enumType`. */
|
|
57
|
-
readonly codecId: string;
|
|
58
|
-
/** nativeType from the codec passed to `enumType`. */
|
|
59
|
-
readonly nativeType: string;
|
|
60
|
-
/** Ordered member list for lowering (name + value pairs). */
|
|
61
|
-
readonly enumMembers: readonly {
|
|
62
|
-
readonly name: string;
|
|
63
|
-
readonly value: Values[number];
|
|
64
|
-
}[];
|
|
65
|
-
/** Ordered literal value tuple. Declaration order is preserved. */
|
|
66
|
-
readonly values: Values;
|
|
67
|
-
/** Ordered literal name tuple. Declaration order is preserved. */
|
|
68
|
-
readonly names: Names;
|
|
69
|
-
/**
|
|
70
|
-
* Namespaced accessor map: `Role.members.User === 'user'`.
|
|
71
|
-
* Namespaced under `.members` to avoid collisions with `.values` / `.has`.
|
|
72
|
-
*/
|
|
73
|
-
readonly members: MembersMap;
|
|
74
|
-
/** Returns `true` if `v` is a declared member value. */
|
|
75
|
-
has(v: Values[number]): boolean;
|
|
76
|
-
/** Returns the member name for a value, or `undefined` if not found. */
|
|
77
|
-
nameOf(v: Values[number]): string | undefined;
|
|
78
|
-
/** Returns the zero-based declaration index of a value, or `-1` if not found. */
|
|
79
|
-
ordinalOf(v: Values[number]): number;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* A codec typemap: codecId → `{ input, output }`, the same shape the query
|
|
83
|
-
* lanes consume. The bound `enumType` wrappers supply the target pack's
|
|
84
|
-
* typemap; the core defaults to an empty map (no codec is known), so member
|
|
85
|
-
* values stay unconstrained.
|
|
86
|
-
*/
|
|
87
|
-
type CodecTypeMap = Record<string, {
|
|
88
|
-
readonly input?: unknown;
|
|
89
|
-
}>;
|
|
90
|
-
/**
|
|
91
|
-
* The application input type the codec dictates for an enum's member values:
|
|
92
|
-
* looks `Codec['codecId']` up in the supplied codec typemap. When the codecId
|
|
93
|
-
* isn't in the map the input is unconstrained, so any member-value literal is
|
|
94
|
-
* accepted and inferred verbatim.
|
|
95
|
-
*/
|
|
96
|
-
type CodecInput<CodecTypes extends CodecTypeMap, Codec extends {
|
|
97
|
-
readonly codecId: string;
|
|
98
|
-
}> = Codec['codecId'] extends keyof CodecTypes ? CodecTypes[Codec['codecId']] extends {
|
|
99
|
-
readonly input: infer In;
|
|
100
|
-
} ? In : unknown : unknown;
|
|
101
|
-
/**
|
|
102
|
-
* The signature of an `enumType` whose codec typemap is already bound — the
|
|
103
|
-
* shape a target-bound wrapper (e.g. `@internal/postgres/contract-builder`)
|
|
104
|
-
* exposes. The member values are constrained to the codec's input type drawn
|
|
105
|
-
* from `CodecTypes`, while `Name`, `Codec`, and the member tuple still infer
|
|
106
|
-
* from the call.
|
|
107
|
-
*/
|
|
108
|
-
type BoundEnumType<CodecTypes extends CodecTypeMap> = <const Name extends string, const Codec extends Pick<ColumnTypeDescriptor, 'codecId' | 'nativeType'>, const Members extends readonly [EnumMember$1<string, CodecInput<CodecTypes, Codec>>, ...EnumMember$1<string, CodecInput<CodecTypes, Codec>>[]]>(name: Name, codec: Codec, ...members: Members) => EnumTypeHandle$1<Name, MembersToValues<[...Members]>, MembersToNames<[...Members]>, MembersAccessorMap<[...Members]>>;
|
|
109
|
-
//#endregion
|
|
110
36
|
//#region src/contract/enum-type.d.ts
|
|
37
|
+
type MongoCodecTypes = ExtractCodecTypesFromPack<typeof mongoTargetPack>;
|
|
111
38
|
/**
|
|
112
39
|
* The `enumType` authors call when building a Mongo contract (re-exported
|
|
113
40
|
* from `@internal/mongo/contract-builder`).
|
|
@@ -117,7 +44,22 @@ type BoundEnumType<CodecTypes extends CodecTypeMap> = <const Name extends string
|
|
|
117
44
|
* codec's input type so `mongo/string@1` requires string values and a
|
|
118
45
|
* mismatch is a compile error.
|
|
119
46
|
*/
|
|
120
|
-
declare const enumType: BoundEnumType<
|
|
47
|
+
declare const enumType: BoundEnumType<MongoCodecTypes>;
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/contract/field.d.ts
|
|
50
|
+
type MongoHelpers = ContractAuthoringHelpers<typeof mongoFamilyPack, typeof mongoTargetPack>;
|
|
51
|
+
/**
|
|
52
|
+
* The field builders of the `defineContract` callback for MongoDB: `field.scalar(type.ObjectId())`, `field.valueObject(Address)`, `field.namedType(Role)`. Use it outside a contract, for example to declare models passed to `defineContract({ models })`.
|
|
53
|
+
*/
|
|
54
|
+
declare const field: MongoHelpers['field'];
|
|
55
|
+
/**
|
|
56
|
+
* The generator function calls of the `defineContract` callback for MongoDB, for `.onCreate(...)` and `.onUpdate(...)`. MongoDB declares one generator function, so this holds `gen.now()` only.
|
|
57
|
+
*/
|
|
58
|
+
declare const gen: MongoHelpers['gen'];
|
|
59
|
+
/**
|
|
60
|
+
* The type constructors and type aliases of the `defineContract` callback for MongoDB, for `field.scalar(...)`: `type.ObjectId()`, `type.String()`, `type.Vector(3)`, `type.temporal.CreatedAt()`.
|
|
61
|
+
*/
|
|
62
|
+
declare const type: MongoHelpers['type'];
|
|
121
63
|
//#endregion
|
|
122
|
-
export { type
|
|
64
|
+
export { type ContractFactory, type ContractInput, type ContractScaffold, type EnumMember, type EnumTypeHandle, type FieldBuilder, type FieldReference, type ModelBuilder, type MongoContractResult, type RelationBuilder, type ValueObjectBuilder, defineContract, enumType, field, gen, index, member, model, rel, type, valueObject };
|
|
123
65
|
//# sourceMappingURL=contract-builder.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-builder.d.mts","names":[],"sources":["../../../../3-
|
|
1
|
+
{"version":3,"file":"contract-builder.d.mts","names":[],"sources":["../../../../3-targets/mongo/9-facade/dist/contract-builder.d.mts"],"mappings":";;;;;;;KAMK,yBAAyB;KACzB,yBAAyB;KACzB,sBAAsB,eAAe;KACrC,uBAAuB;KACvB,eAAe,mBAAmB,wBAAwB,WAAW,kBAAkB,sBAAsB,iCAAiC,iBAAiB,iBAAiB;KAChL,mBAAmB,mBAAmB,wBAAwB,KAAK,gBAAgB,iBAAiB,iBAAiB,sBAAsB,sBAAsB;WAC3J;WACA;;KAEN,mBAAmB,mBAAmB,wBAAwB,KAAK,mBAAmB,iBAAiB,iBAAiB;WAClH;WACA;;iBAEM,qBAAqB,cAAc,mBAAmB,uBAAuB,OAAO,QAAQ,sBAAsB,KAAK;WAC7H,QAAQ;WACR,QAAQ;;iBAEF,qBAAqB,mBAAmB,4BAA4B,iBAAiB,mBAAmB,mBAAmB;WACjI,SAAS;WACT,eAAe;WACf,QAAQ;GAChB,UAAU;WACF,aAAa;GACrB,UAAU,SAAS,eAAe,gBAAgB,QAAQ,sBAAsB,KAAK,iCAAiC;WAC9G,QAAQ;WACR,QAAQ;;;;KAId,kBAAkB,iCAAiC;;;;;;;;;;cAU1C,UAAU,cAAc;;;KAGjC,eAAe,gCAAgC,wBAAwB;;;;cAI9D,OAAO;;;;cAIP,KAAK;;;;cAIL,MAAM"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { bindEnumType, buildBoundContract, field, index, member, model, rel, valueObject } from "@prisma/orm-family-mongo/contract-ts/contract-builder";
|
|
2
|
-
import mongoFamilyPack from "@prisma/orm-family-mongo/family/pack";
|
|
3
1
|
import mongoTargetPack from "@prisma/orm-target-mongo/target/pack";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { bindEnumType, buildBoundContract, createContractAuthoringHelpers, index, member, model, rel, valueObject } from "@prisma/orm-family-mongo/contract-ts/contract-builder";
|
|
3
|
+
import mongoFamilyPack from "@prisma/orm-family-mongo/family/pack";
|
|
4
|
+
//#region ../../../3-targets/mongo/9-facade/dist/contract-builder.mjs
|
|
5
|
+
function defineContract(input, factory) {
|
|
6
|
+
if (factory !== void 0) return buildBoundContract(mongoFamilyPack, mongoTargetPack, input, factory);
|
|
7
|
+
return buildBoundContract(mongoFamilyPack, mongoTargetPack, input);
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* The `enumType` authors call when building a Mongo contract (re-exported
|
|
@@ -16,7 +16,23 @@ function defineContract(definition, factory) {
|
|
|
16
16
|
* mismatch is a compile error.
|
|
17
17
|
*/
|
|
18
18
|
const enumType = bindEnumType();
|
|
19
|
+
const helpers = createContractAuthoringHelpers({
|
|
20
|
+
family: mongoFamilyPack,
|
|
21
|
+
target: mongoTargetPack
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* The field builders of the `defineContract` callback for MongoDB: `field.scalar(type.ObjectId())`, `field.valueObject(Address)`, `field.namedType(Role)`. Use it outside a contract, for example to declare models passed to `defineContract({ models })`.
|
|
25
|
+
*/
|
|
26
|
+
const field = helpers.field;
|
|
27
|
+
/**
|
|
28
|
+
* The generator function calls of the `defineContract` callback for MongoDB, for `.onCreate(...)` and `.onUpdate(...)`. MongoDB declares one generator function, so this holds `gen.now()` only.
|
|
29
|
+
*/
|
|
30
|
+
const gen = helpers.gen;
|
|
31
|
+
/**
|
|
32
|
+
* The type constructors and type aliases of the `defineContract` callback for MongoDB, for `field.scalar(...)`: `type.ObjectId()`, `type.String()`, `type.Vector(3)`, `type.temporal.CreatedAt()`.
|
|
33
|
+
*/
|
|
34
|
+
const type = helpers.type;
|
|
19
35
|
//#endregion
|
|
20
|
-
export { defineContract, enumType, field, index, member, model, rel, valueObject };
|
|
36
|
+
export { defineContract, enumType, field, gen, index, member, model, rel, type, valueObject };
|
|
21
37
|
|
|
22
38
|
//# sourceMappingURL=contract-builder.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-builder.mjs","names":[],"sources":["../../../../3-
|
|
1
|
+
{"version":3,"file":"contract-builder.mjs","names":[],"sources":["../../../../3-targets/mongo/9-facade/dist/contract-builder.mjs"],"sourcesContent":["import mongoTargetPack from \"@internal/target-mongo/pack\";\nimport { bindEnumType, buildBoundContract, createContractAuthoringHelpers, index, member, model, rel, valueObject } from \"@internal/mongo-contract-ts/contract-builder\";\nimport mongoFamilyPack from \"@internal/family-mongo/pack\";\n//#region src/contract/define-contract.ts\nfunction defineContract(input, factory) {\n\tif (factory !== void 0) return buildBoundContract(mongoFamilyPack, mongoTargetPack, input, factory);\n\treturn buildBoundContract(mongoFamilyPack, mongoTargetPack, input);\n}\n//#endregion\n//#region src/contract/enum-type.ts\n/**\n* The `enumType` authors call when building a Mongo contract (re-exported\n* from `@internal/mongo/contract-builder`).\n*\n* `bindEnumType` is the core, codec-agnostic `enumType` factory; calling it\n* with the Mongo target pack's codec typemap constrains member values to the\n* codec's input type so `mongo/string@1` requires string values and a\n* mismatch is a compile error.\n*/\nconst enumType = bindEnumType();\n//#endregion\n//#region src/contract/field.ts\nconst helpers = createContractAuthoringHelpers({\n\tfamily: mongoFamilyPack,\n\ttarget: mongoTargetPack\n});\n/**\n* The field builders of the `defineContract` callback for MongoDB: `field.scalar(type.ObjectId())`, `field.valueObject(Address)`, `field.namedType(Role)`. Use it outside a contract, for example to declare models passed to `defineContract({ models })`.\n*/\nconst field = helpers.field;\n/**\n* The generator function calls of the `defineContract` callback for MongoDB, for `.onCreate(...)` and `.onUpdate(...)`. MongoDB declares one generator function, so this holds `gen.now()` only.\n*/\nconst gen = helpers.gen;\n/**\n* The type constructors and type aliases of the `defineContract` callback for MongoDB, for `field.scalar(...)`: `type.ObjectId()`, `type.String()`, `type.Vector(3)`, `type.temporal.CreatedAt()`.\n*/\nconst type = helpers.type;\n//#endregion\nexport { defineContract, enumType, field, gen, index, member, model, rel, type, valueObject };\n\n//# sourceMappingURL=contract-builder.mjs.map"],"mappings":";;;;AAIA,SAAS,eAAe,OAAO,SAAS;CACvC,IAAI,YAAY,KAAK,GAAG,OAAO,mBAAmB,iBAAiB,iBAAiB,OAAO,OAAO;CAClG,OAAO,mBAAmB,iBAAiB,iBAAiB,KAAK;AAClE;;;;;;;;;;AAYA,MAAM,WAAW,aAAa;AAG9B,MAAM,UAAU,+BAA+B;CAC9C,QAAQ;CACR,QAAQ;AACT,CAAC;;;;AAID,MAAM,QAAQ,QAAQ;;;;AAItB,MAAM,MAAM,QAAQ;;;;AAIpB,MAAM,OAAO,QAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-framework/contract/format-version";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-framework/contract/internal/format-version";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-framework/contract/validate-once";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-framework/contract/validate-storage";
|
package/dist/control.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ControlClient, ControlClientOptions } from "@prisma/orm-toolchain/cli/control-api";
|
|
2
|
-
//#region ../../../3-
|
|
2
|
+
//#region ../../../3-targets/mongo/9-facade/dist/control.d.mts
|
|
3
3
|
//#region src/exports/control.d.ts
|
|
4
4
|
interface MongoControlClientOptions {
|
|
5
5
|
readonly connection?: string;
|
package/dist/control.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.mts","names":[],"sources":["../../../../3-
|
|
1
|
+
{"version":3,"file":"control.d.mts","names":[],"sources":["../../../../3-targets/mongo/9-facade/dist/control.d.mts"],"mappings":";;;UAEU;WACC;WACA,aAAa;;iBAEP,yBAAyB,UAAU,4BAA4B"}
|
package/dist/control.mjs
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import mongoDriver from "@prisma/orm-target-mongo/driver/control";
|
|
3
|
-
import { mongoFamilyDescriptor } from "@prisma/orm-family-mongo/family/control";
|
|
4
|
-
import { mongoTargetDescriptor } from "@prisma/orm-target-mongo/target/control";
|
|
1
|
+
import { n as controlComponents } from "./components-CWskH7lF-Dkc9ysZz.mjs";
|
|
5
2
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
6
3
|
import { createControlClient } from "@prisma/orm-toolchain/cli/control-api";
|
|
7
|
-
//#region ../../../3-
|
|
4
|
+
//#region ../../../3-targets/mongo/9-facade/dist/control.mjs
|
|
8
5
|
function createMongoControlClient(options = {}) {
|
|
9
6
|
return createControlClient({
|
|
10
|
-
|
|
11
|
-
target: mongoTargetDescriptor,
|
|
12
|
-
adapter: mongoAdapter,
|
|
13
|
-
driver: mongoDriver,
|
|
7
|
+
...controlComponents,
|
|
14
8
|
...ifDefined("connection", options.connection),
|
|
15
9
|
...ifDefined("extensions", options.extensions)
|
|
16
10
|
});
|
package/dist/control.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.mjs","names":[],"sources":["../../../../3-
|
|
1
|
+
{"version":3,"file":"control.mjs","names":[],"sources":["../../../../3-targets/mongo/9-facade/dist/control.mjs"],"sourcesContent":["import { n as controlComponents } from \"./components-CWskH7lF.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { createControlClient } from \"@internal/cli/control-api\";\n//#region src/exports/control.ts\nfunction createMongoControlClient(options = {}) {\n\treturn createControlClient({\n\t\t...controlComponents,\n\t\t...ifDefined(\"connection\", options.connection),\n\t\t...ifDefined(\"extensions\", options.extensions)\n\t});\n}\n//#endregion\nexport { createMongoControlClient };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;AAIA,SAAS,yBAAyB,UAAU,CAAC,GAAG;CAC/C,OAAO,oBAAoB;EAC1B,GAAG;EACH,GAAG,UAAU,cAAc,QAAQ,UAAU;EAC7C,GAAG,UAAU,cAAc,QAAQ,UAAU;CAC9C,CAAC;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-family-mongo/contract/data-type";
|