@prisma/orm-mongo 8.0.0-rc.18-dev.28 → 8.0.0-rc.18-dev.30

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.
@@ -1,4 +1,4 @@
1
- import { ContractDefinition, ContractDefinition as ContractDefinition$1, ContractFactory, ContractFactory as ContractFactory$1, ContractScaffold, ContractScaffold as ContractScaffold$1, EnumMember, EnumTypeHandle, ExtractCodecTypesFromPack, 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";
1
+ import { ContractAuthoringHelpers, ContractDefinition, ContractDefinition as ContractDefinition$1, ContractFactory, ContractFactory as ContractFactory$1, ContractScaffold, ContractScaffold as ContractScaffold$1, EnumMember, EnumTypeHandle, ExtractCodecTypesFromPack, 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
2
  import mongoFamilyPack from "@prisma/orm-family-mongo/family/pack";
3
3
  import mongoTargetPack from "@prisma/orm-target-mongo/target/pack";
4
4
  import { BoundEnumType } from "@prisma/orm-framework/contract-authoring";
@@ -41,5 +41,11 @@ type MongoCodecTypes = ExtractCodecTypesFromPack<typeof mongoTargetPack>;
41
41
  */
42
42
  declare const enumType: BoundEnumType<MongoCodecTypes>;
43
43
  //#endregion
44
- export { type ContractDefinition, type ContractFactory, type ContractScaffold, type EnumMember, type EnumTypeHandle, type FieldBuilder, type FieldReference, type ModelBuilder, type MongoContractResult, type RelationBuilder, type ValueObjectBuilder, defineContract, enumType, field, index, member, model, rel, valueObject };
44
+ //#region src/contract/gen.d.ts
45
+ /**
46
+ * The generator function calls of the `defineContract` callback for MongoDB, built from the same family and target packs, for `.onCreate(...)` and `.onUpdate(...)`. MongoDB declares one generator function, so this holds `gen.now()` only.
47
+ */
48
+ declare const gen: ContractAuthoringHelpers<typeof mongoFamilyPack, typeof mongoTargetPack>['gen'];
49
+ //#endregion
50
+ export { type ContractDefinition, type ContractFactory, 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, valueObject };
45
51
  //# sourceMappingURL=contract-builder.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-builder.d.mts","names":[],"sources":["../../../../3-extensions/mongo/dist/contract-builder.d.mts"],"mappings":";;;;;;KAKK,yBAAyB;KACzB,yBAAyB;KACzB,eAAe,WAAW,kBAAkB,sBAAsB,iCAAiC,iBAAiB;KACpH,uBAAuB,KAAK,qBAAqB,iBAAiB;WAC5D;WACA;;KAEN,qBAAqB,KAAK,mBAAmB,iBAAiB;WACxD;WACA;;iBAEM,qBAAqB,mBAAmB,sBAAsB,YAAY,aAAa,sBAAsB,KAAK;WACxH,QAAQ;WACR,QAAQ;;iBAEF,qBAAqB,mBAAmB,0BAA0B;WACxE,SAAS;WACT,eAAe;WACf,QAAQ;GAChB,UAAU,YAAY,UAAU,SAAS,iBAAiB,QAAQ,sBAAsB,KAAK,mCAAmC;WACxH,QAAQ;WACR,QAAQ;;;;KAId,kBAAkB,iCAAiC;;;;;;;;;;cAU1C,UAAU,cAAc"}
1
+ {"version":3,"file":"contract-builder.d.mts","names":[],"sources":["../../../../3-extensions/mongo/dist/contract-builder.d.mts"],"mappings":";;;;;;KAKK,yBAAyB;KACzB,yBAAyB;KACzB,eAAe,WAAW,kBAAkB,sBAAsB,iCAAiC,iBAAiB;KACpH,uBAAuB,KAAK,qBAAqB,iBAAiB;WAC5D;WACA;;KAEN,qBAAqB,KAAK,mBAAmB,iBAAiB;WACxD;WACA;;iBAEM,qBAAqB,mBAAmB,sBAAsB,YAAY,aAAa,sBAAsB,KAAK;WACxH,QAAQ;WACR,QAAQ;;iBAEF,qBAAqB,mBAAmB,0BAA0B;WACxE,SAAS;WACT,eAAe;WACf,QAAQ;GAChB,UAAU,YAAY,UAAU,SAAS,iBAAiB,QAAQ,sBAAsB,KAAK,mCAAmC;WACxH,QAAQ;WACR,QAAQ;;;;KAId,kBAAkB,iCAAiC;;;;;;;;;;cAU1C,UAAU,cAAc;;;;;;cAMxB,KAAK,gCAAgC,wBAAwB"}
@@ -1,6 +1,7 @@
1
1
  import { bindEnumType, buildBoundContract, field, index, member, model, rel, valueObject } from "@prisma/orm-family-mongo/contract-ts/contract-builder";
2
2
  import mongoFamilyPack from "@prisma/orm-family-mongo/family/pack";
3
3
  import mongoTargetPack from "@prisma/orm-target-mongo/target/pack";
4
+ import { createGeneratorHelpers } from "@prisma/orm-framework/components/components";
4
5
  //#region ../../../3-extensions/mongo/dist/contract-builder.mjs
5
6
  function defineContract(definition, factory) {
6
7
  if (factory !== void 0) return buildBoundContract(mongoFamilyPack, mongoTargetPack, definition, factory);
@@ -16,7 +17,11 @@ function defineContract(definition, factory) {
16
17
  * mismatch is a compile error.
17
18
  */
18
19
  const enumType = bindEnumType();
20
+ /**
21
+ * The generator function calls of the `defineContract` callback for MongoDB, built from the same family and target packs, for `.onCreate(...)` and `.onUpdate(...)`. MongoDB declares one generator function, so this holds `gen.now()` only.
22
+ */
23
+ const gen = createGeneratorHelpers([mongoFamilyPack, mongoTargetPack]);
19
24
  //#endregion
20
- export { defineContract, enumType, field, index, member, model, rel, valueObject };
25
+ export { defineContract, enumType, field, gen, index, member, model, rel, valueObject };
21
26
 
22
27
  //# sourceMappingURL=contract-builder.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-builder.mjs","names":[],"sources":["../../../../3-extensions/mongo/dist/contract-builder.mjs"],"sourcesContent":["import { bindEnumType, buildBoundContract, field, index, member, model, rel, valueObject } from \"@internal/mongo-contract-ts/contract-builder\";\nimport mongoFamilyPack from \"@internal/family-mongo/pack\";\nimport mongoTargetPack from \"@internal/target-mongo/pack\";\n//#region src/contract/define-contract.ts\nfunction defineContract(definition, factory) {\n\tif (factory !== void 0) return buildBoundContract(mongoFamilyPack, mongoTargetPack, definition, factory);\n\treturn buildBoundContract(mongoFamilyPack, mongoTargetPack, definition);\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\nexport { defineContract, enumType, field, index, member, model, rel, valueObject };\n\n//# sourceMappingURL=contract-builder.mjs.map"],"mappings":";;;;AAIA,SAAS,eAAe,YAAY,SAAS;CAC5C,IAAI,YAAY,KAAK,GAAG,OAAO,mBAAmB,iBAAiB,iBAAiB,YAAY,OAAO;CACvG,OAAO,mBAAmB,iBAAiB,iBAAiB,UAAU;AACvE;;;;;;;;;;AAYA,MAAM,WAAW,aAAa"}
1
+ {"version":3,"file":"contract-builder.mjs","names":[],"sources":["../../../../3-extensions/mongo/dist/contract-builder.mjs"],"sourcesContent":["import { bindEnumType, buildBoundContract, field, index, member, model, rel, valueObject } from \"@internal/mongo-contract-ts/contract-builder\";\nimport mongoFamilyPack from \"@internal/family-mongo/pack\";\nimport mongoTargetPack from \"@internal/target-mongo/pack\";\nimport { createGeneratorHelpers } from \"@internal/framework-components/components\";\n//#region src/contract/define-contract.ts\nfunction defineContract(definition, factory) {\n\tif (factory !== void 0) return buildBoundContract(mongoFamilyPack, mongoTargetPack, definition, factory);\n\treturn buildBoundContract(mongoFamilyPack, mongoTargetPack, definition);\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/gen.ts\n/**\n* The generator function calls of the `defineContract` callback for MongoDB, built from the same family and target packs, for `.onCreate(...)` and `.onUpdate(...)`. MongoDB declares one generator function, so this holds `gen.now()` only.\n*/\nconst gen = createGeneratorHelpers([mongoFamilyPack, mongoTargetPack]);\n//#endregion\nexport { defineContract, enumType, field, gen, index, member, model, rel, valueObject };\n\n//# sourceMappingURL=contract-builder.mjs.map"],"mappings":";;;;;AAKA,SAAS,eAAe,YAAY,SAAS;CAC5C,IAAI,YAAY,KAAK,GAAG,OAAO,mBAAmB,iBAAiB,iBAAiB,YAAY,OAAO;CACvG,OAAO,mBAAmB,iBAAiB,iBAAiB,UAAU;AACvE;;;;;;;;;;AAYA,MAAM,WAAW,aAAa;;;;AAM9B,MAAM,MAAM,uBAAuB,CAAC,iBAAiB,eAAe,CAAC"}
@@ -8,8 +8,8 @@ import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
8
8
  import { mongoQuery } from "@prisma/orm-family-mongo/query-builder";
9
9
  import { assertDefined } from "@prisma/orm-framework/utils/assertions";
10
10
  import { blindCast } from "@prisma/orm-framework/utils/casts";
11
- //#region ../../../3-extensions/mongo/dist/mongo-static-BDwTtMKh.mjs
12
- var version = "8.0.0-rc.18-dev.28";
11
+ //#region ../../../3-extensions/mongo/dist/mongo-static-BOynTdtC.mjs
12
+ var version = "8.0.0-rc.18-dev.30";
13
13
  const serializer = new MongoContractSerializer();
14
14
  const validator = `${mongoRuntimeTarget.targetId}@${version}`;
15
15
  /**
@@ -69,4 +69,4 @@ function mongoStatic(options) {
69
69
  //#endregion
70
70
  export { validateMongoContract as i, contractFromJson as n, mongoStatic as r, buildMongoStaticContext as t };
71
71
 
72
- //# sourceMappingURL=mongo-static-BDwTtMKh-DG75pAv8.mjs.map
72
+ //# sourceMappingURL=mongo-static-BOynTdtC-DGBX_VnR.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mongo-static-BDwTtMKh-DG75pAv8.mjs","names":[],"sources":["../../../../3-extensions/mongo/dist/mongo-static-BDwTtMKh.mjs"],"sourcesContent":["import { mongoRaw } from \"@internal/mongo-orm\";\nimport { buildMongoEnums, createMongoExecutionContext, createMongoExecutionStack } from \"@internal/mongo-runtime\";\nimport { validateContractOnce } from \"@internal/contract/validate-once\";\nimport { MongoContractSerializer } from \"@internal/family-mongo/ir\";\nimport mongoRuntimeTarget from \"@internal/target-mongo/runtime\";\nimport mongoRuntimeAdapter from \"@internal/adapter-mongo/runtime\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { mongoQuery } from \"@internal/mongo-query-builder\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region package.json\nvar version = \"8.0.0-rc.18-dev.28\";\n//#endregion\n//#region src/static/contract-from-json.ts\nconst serializer = new MongoContractSerializer();\nconst validator = `${mongoRuntimeTarget.targetId}@${version}`;\n/**\n* Validates an emitted Mongo `contract.json` and returns it as the contract type the application\n* names, ready to pass to `mongo({ contract })` and `mongoStatic({ contract })`. Clients built from\n* the result do not validate it again.\n*\n* The returned value's top level is frozen; its nested objects are not. Do not change `json` or the\n* returned value after the call: clients built from the value later do not validate it again.\n*\n* @example\n* ```ts\n* import type { Contract } from './contract.d';\n* import contractJson from './contract.json' with { type: 'json' };\n*\n* export const contract = contractFromJson<Contract>(contractJson);\n* ```\n*/\nfunction contractFromJson(json) {\n\treturn validateContractOnce(json, validator, (input) => serializer.deserializeContract(input));\n}\nfunction validateMongoContract(contract) {\n\treturn contractFromJson(contract);\n}\n//#endregion\n//#region src/static/mongo-static.ts\nfunction buildMongoStaticContext(contract) {\n\tconst context = createMongoExecutionContext({\n\t\tcontract,\n\t\tstack: createMongoExecutionStack({\n\t\t\ttarget: mongoRuntimeTarget,\n\t\t\tadapter: mongoRuntimeAdapter\n\t\t})\n\t});\n\tconst enumsByNamespace = buildMongoEnums(contract, context.codecs);\n\tconst unbound = enumsByNamespace[UNBOUND_NAMESPACE_ID];\n\tassertDefined(unbound, \"the unbound namespace always exists on a mongo builder output\");\n\treturn {\n\t\tcontext,\n\t\tcontract,\n\t\tenums: blindCast(unbound),\n\t\tenumsByNamespace,\n\t\tquery: mongoQuery({ contract }),\n\t\traw: mongoRaw({ contract })\n\t};\n}\n/**\n* The query surfaces of a Mongo client without a driver: `query`, `raw` and `enums`. Use it where\n* loading `mongodb` is not wanted.\n*\n* @example\n* ```ts\n* const { enums } = mongoStatic({ contract: contractFromJson<Contract>(contractJson) });\n* ```\n*/\nfunction mongoStatic(options) {\n\treturn buildMongoStaticContext(validateMongoContract(options.contract));\n}\n//#endregion\nexport { validateMongoContract as i, mongoStatic as n, contractFromJson as r, buildMongoStaticContext as t };\n\n//# sourceMappingURL=mongo-static-BDwTtMKh.mjs.map"],"mappings":";;;;;;;;;;;AAWA,IAAI,UAAU;AAGd,MAAM,aAAa,IAAI,wBAAwB;AAC/C,MAAM,YAAY,GAAG,mBAAmB,SAAS,GAAG;;;;;;;;;;;;;;;;;AAiBpD,SAAS,iBAAiB,MAAM;CAC/B,OAAO,qBAAqB,MAAM,YAAY,UAAU,WAAW,oBAAoB,KAAK,CAAC;AAC9F;AACA,SAAS,sBAAsB,UAAU;CACxC,OAAO,iBAAiB,QAAQ;AACjC;AAGA,SAAS,wBAAwB,UAAU;CAC1C,MAAM,UAAU,4BAA4B;EAC3C;EACA,OAAO,0BAA0B;GAChC,QAAQ;GACR,SAAS;EACV,CAAC;CACF,CAAC;CACD,MAAM,mBAAmB,gBAAgB,UAAU,QAAQ,MAAM;CACjE,MAAM,UAAU,iBAAiB;CACjC,cAAc,SAAS,+DAA+D;CACtF,OAAO;EACN;EACA;EACA,OAAO,UAAU,OAAO;EACxB;EACA,OAAO,WAAW,EAAE,SAAS,CAAC;EAC9B,KAAK,SAAS,EAAE,SAAS,CAAC;CAC3B;AACD;;;;;;;;;;AAUA,SAAS,YAAY,SAAS;CAC7B,OAAO,wBAAwB,sBAAsB,QAAQ,QAAQ,CAAC;AACvE"}
1
+ {"version":3,"file":"mongo-static-BOynTdtC-DGBX_VnR.mjs","names":[],"sources":["../../../../3-extensions/mongo/dist/mongo-static-BOynTdtC.mjs"],"sourcesContent":["import { mongoRaw } from \"@internal/mongo-orm\";\nimport { buildMongoEnums, createMongoExecutionContext, createMongoExecutionStack } from \"@internal/mongo-runtime\";\nimport { validateContractOnce } from \"@internal/contract/validate-once\";\nimport { MongoContractSerializer } from \"@internal/family-mongo/ir\";\nimport mongoRuntimeTarget from \"@internal/target-mongo/runtime\";\nimport mongoRuntimeAdapter from \"@internal/adapter-mongo/runtime\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { mongoQuery } from \"@internal/mongo-query-builder\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region package.json\nvar version = \"8.0.0-rc.18-dev.30\";\n//#endregion\n//#region src/static/contract-from-json.ts\nconst serializer = new MongoContractSerializer();\nconst validator = `${mongoRuntimeTarget.targetId}@${version}`;\n/**\n* Validates an emitted Mongo `contract.json` and returns it as the contract type the application\n* names, ready to pass to `mongo({ contract })` and `mongoStatic({ contract })`. Clients built from\n* the result do not validate it again.\n*\n* The returned value's top level is frozen; its nested objects are not. Do not change `json` or the\n* returned value after the call: clients built from the value later do not validate it again.\n*\n* @example\n* ```ts\n* import type { Contract } from './contract.d';\n* import contractJson from './contract.json' with { type: 'json' };\n*\n* export const contract = contractFromJson<Contract>(contractJson);\n* ```\n*/\nfunction contractFromJson(json) {\n\treturn validateContractOnce(json, validator, (input) => serializer.deserializeContract(input));\n}\nfunction validateMongoContract(contract) {\n\treturn contractFromJson(contract);\n}\n//#endregion\n//#region src/static/mongo-static.ts\nfunction buildMongoStaticContext(contract) {\n\tconst context = createMongoExecutionContext({\n\t\tcontract,\n\t\tstack: createMongoExecutionStack({\n\t\t\ttarget: mongoRuntimeTarget,\n\t\t\tadapter: mongoRuntimeAdapter\n\t\t})\n\t});\n\tconst enumsByNamespace = buildMongoEnums(contract, context.codecs);\n\tconst unbound = enumsByNamespace[UNBOUND_NAMESPACE_ID];\n\tassertDefined(unbound, \"the unbound namespace always exists on a mongo builder output\");\n\treturn {\n\t\tcontext,\n\t\tcontract,\n\t\tenums: blindCast(unbound),\n\t\tenumsByNamespace,\n\t\tquery: mongoQuery({ contract }),\n\t\traw: mongoRaw({ contract })\n\t};\n}\n/**\n* The query surfaces of a Mongo client without a driver: `query`, `raw` and `enums`. Use it where\n* loading `mongodb` is not wanted.\n*\n* @example\n* ```ts\n* const { enums } = mongoStatic({ contract: contractFromJson<Contract>(contractJson) });\n* ```\n*/\nfunction mongoStatic(options) {\n\treturn buildMongoStaticContext(validateMongoContract(options.contract));\n}\n//#endregion\nexport { validateMongoContract as i, mongoStatic as n, contractFromJson as r, buildMongoStaticContext as t };\n\n//# sourceMappingURL=mongo-static-BOynTdtC.mjs.map"],"mappings":";;;;;;;;;;;AAWA,IAAI,UAAU;AAGd,MAAM,aAAa,IAAI,wBAAwB;AAC/C,MAAM,YAAY,GAAG,mBAAmB,SAAS,GAAG;;;;;;;;;;;;;;;;;AAiBpD,SAAS,iBAAiB,MAAM;CAC/B,OAAO,qBAAqB,MAAM,YAAY,UAAU,WAAW,oBAAoB,KAAK,CAAC;AAC9F;AACA,SAAS,sBAAsB,UAAU;CACxC,OAAO,iBAAiB,QAAQ;AACjC;AAGA,SAAS,wBAAwB,UAAU;CAC1C,MAAM,UAAU,4BAA4B;EAC3C;EACA,OAAO,0BAA0B;GAChC,QAAQ;GACR,SAAS;EACV,CAAC;CACF,CAAC;CACD,MAAM,mBAAmB,gBAAgB,UAAU,QAAQ,MAAM;CACjE,MAAM,UAAU,iBAAiB;CACjC,cAAc,SAAS,+DAA+D;CACtF,OAAO;EACN;EACA;EACA,OAAO,UAAU,OAAO;EACxB;EACA,OAAO,WAAW,EAAE,SAAS,CAAC;EAC9B,KAAK,SAAS,EAAE,SAAS,CAAC;CAC3B;AACD;;;;;;;;;;AAUA,SAAS,YAAY,SAAS;CAC7B,OAAO,wBAAwB,sBAAsB,QAAQ,QAAQ,CAAC;AACvE"}
package/dist/runtime.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { i as validateMongoContract, t as buildMongoStaticContext } from "./mongo-static-BDwTtMKh-DG75pAv8.mjs";
1
+ import { i as validateMongoContract, t as buildMongoStaticContext } from "./mongo-static-BOynTdtC-DGBX_VnR.mjs";
2
2
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
3
3
  import { mongoOrm } from "@prisma/orm-family-mongo/orm";
4
4
  import { createMongoRuntime } from "@prisma/orm-family-mongo/runtime";
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-extensions/mongo/dist/runtime.mjs"],"sourcesContent":["import { i as validateMongoContract, t as buildMongoStaticContext } from \"./mongo-static-BDwTtMKh.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { MongoDriverImpl } from \"@internal/driver-mongo\";\nimport { AsyncIterableResult } from \"@internal/framework-components/runtime\";\nimport { mongoOrm } from \"@internal/mongo-orm\";\nimport { createMongoRuntime } from \"@internal/mongo-runtime\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { ConnectionString } from \"mongodb-connection-string-url\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/runtime/mongo-errors.ts\nfunction mongoError(code, message, options) {\n\treturn structuredError(code, message, {\n\t\t...options,\n\t\tmeta: {\n\t\t\t...options?.meta,\n\t\t\textension: \"mongo\"\n\t\t}\n\t});\n}\n//#endregion\n//#region src/runtime/binding.ts\nconst URL_SCHEME_PATTERN = /^([a-z][a-z\\d+.-]*):\\/\\//i;\nconst MONGO_SCHEMES = /* @__PURE__ */ new Set([\"mongodb\", \"mongodb+srv\"]);\nfunction validateMongoUrl(url) {\n\tconst trimmed = url.trim();\n\tif (trimmed.length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must be a non-empty string\");\n\tconst scheme = URL_SCHEME_PATTERN.exec(trimmed)?.[1];\n\tif (scheme === void 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must be a valid URL\");\n\tif (!MONGO_SCHEMES.has(scheme)) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must use mongodb:// or mongodb+srv://\");\n\ttry {\n\t\treturn new ConnectionString(trimmed);\n\t} catch {\n\t\tthrow mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must be a valid URL\");\n\t}\n}\nfunction extractDbNameFromUrl(parsed) {\n\tconst [encodedDbName = \"\"] = parsed.pathname.slice(1).split(\"/\");\n\tif (encodedDbName.length === 0) return;\n\ttry {\n\t\treturn decodeURIComponent(encodedDbName);\n\t} catch {\n\t\tthrow mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must be a valid URL\");\n\t}\n}\nfunction resolveMongoBinding(options) {\n\tconst providedCount = Number(options.binding !== void 0) + Number(options.url !== void 0) + Number(options.uri !== void 0) + Number(options.mongoClient !== void 0);\n\tif (providedCount !== 1) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Provide one binding input: binding, url, uri+dbName, or mongoClient+dbName\", { meta: { received: providedCount } });\n\tif (options.binding !== void 0) return options.binding;\n\tif (options.url !== void 0) {\n\t\tconst parsed = validateMongoUrl(options.url);\n\t\tif (options.dbName !== void 0 && options.dbName.trim().length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo binding via { url, dbName } requires a non-empty dbName\");\n\t\tconst explicitDbName = options.dbName?.trim();\n\t\tconst dbName = explicitDbName !== void 0 && explicitDbName.length > 0 ? explicitDbName : extractDbNameFromUrl(parsed);\n\t\tif (dbName === void 0 || dbName.length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must include a database name in its path (e.g. mongodb://host:27017/mydb), or pass dbName explicitly\");\n\t\treturn {\n\t\t\tkind: \"url\",\n\t\t\turl: options.url.trim(),\n\t\t\tdbName\n\t\t};\n\t}\n\tif (options.uri !== void 0) {\n\t\tvalidateMongoUrl(options.uri);\n\t\tconst dbName = options.dbName?.trim();\n\t\tif (dbName === void 0 || dbName.length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo binding via { uri, dbName } requires a non-empty dbName\");\n\t\treturn {\n\t\t\tkind: \"url\",\n\t\t\turl: options.uri.trim(),\n\t\t\tdbName\n\t\t};\n\t}\n\tconst mongoClient = options.mongoClient;\n\tif (mongoClient === void 0) throw new InternalError(\"Invariant violation: expected mongo binding after validation\");\n\tconst dbName = options.dbName?.trim();\n\tif (dbName === void 0 || dbName.length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo binding via { mongoClient, dbName } requires a non-empty dbName\");\n\treturn {\n\t\tkind: \"mongoClient\",\n\t\tclient: mongoClient,\n\t\tdbName\n\t};\n}\nfunction resolveOptionalMongoBinding(options) {\n\tconst providedCount = Number(options.binding !== void 0) + Number(options.url !== void 0) + Number(options.uri !== void 0) + Number(options.mongoClient !== void 0);\n\tif (providedCount === 0) return;\n\tif (providedCount !== 1) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Provide one binding input: binding, url, uri+dbName, or mongoClient+dbName\", { meta: { received: providedCount } });\n\tif (options.binding !== void 0) return resolveMongoBinding({ binding: options.binding });\n\tif (options.url !== void 0) return resolveMongoBinding(options.dbName !== void 0 ? {\n\t\turl: options.url,\n\t\tdbName: options.dbName\n\t} : { url: options.url });\n\tif (options.uri !== void 0) return resolveMongoBinding({\n\t\turi: options.uri,\n\t\tdbName: options.dbName ?? \"\"\n\t});\n\tif (options.mongoClient !== void 0) return resolveMongoBinding({\n\t\tmongoClient: options.mongoClient,\n\t\tdbName: options.dbName ?? \"\"\n\t});\n\tthrow new InternalError(\"Invariant violation: expected one mongo binding branch\");\n}\n//#endregion\n//#region src/runtime/mongo.ts\n/**\n* Creates a lazy Mongo client. The client infers its contract type from `contract`: a value from\n* `contractFromJson` for an emitted contract, or a TypeScript-authored contract. A contract is\n* validated once, however many clients are built from it. The `orm` and `query` surfaces are\n* available at once; the driver connects on the first query or `connect()`.\n*\n* @example\n* ```ts\n* import { contractFromJson } from '@prisma/orm-mongo/static';\n* import mongo from '@prisma/orm-mongo/runtime';\n* import type { Contract } from './contract.d';\n* import contractJson from './contract.json' with { type: 'json' };\n*\n* export const contract = contractFromJson<Contract>(contractJson);\n* export const db = mongo({ contract, url: process.env['MONGODB_URL']! });\n* ```\n*/\nfunction mongo(options) {\n\tconst contract = validateMongoContract(options.contract);\n\tlet binding = resolveOptionalMongoBinding(options);\n\tconst { context, query, enums, enumsByNamespace, raw } = buildMongoStaticContext(contract);\n\tlet runtimePromise;\n\tlet closed = false;\n\tlet ownedDispose;\n\tconst buildRuntime = async (resolvedBinding) => {\n\t\tconst driver = resolvedBinding.kind === \"url\" ? await MongoDriverImpl.fromConnection(resolvedBinding.url, resolvedBinding.dbName) : MongoDriverImpl.fromDb(resolvedBinding.client.db(resolvedBinding.dbName));\n\t\tif (resolvedBinding.kind === \"url\") ownedDispose = () => driver.close();\n\t\treturn createMongoRuntime({\n\t\t\tcontext,\n\t\t\tdriver,\n\t\t\t...ifDefined(\"mode\", options.mode),\n\t\t\t...ifDefined(\"middleware\", options.middleware)\n\t\t});\n\t};\n\tconst getRuntime = () => {\n\t\tif (closed) return Promise.reject(mongoError(\"DRIVER.NOT_CONNECTED\", \"Mongo client is closed\"));\n\t\tif (runtimePromise !== void 0) return runtimePromise;\n\t\tif (binding === void 0) return Promise.reject(mongoError(\"RUNTIME.BINDING_MISSING\", \"Mongo binding not configured. Pass url/uri+dbName/mongoClient+dbName/binding to mongo(...) or call db.connect({ ... }).\"));\n\t\truntimePromise = buildRuntime(binding).catch((err) => {\n\t\t\truntimePromise = void 0;\n\t\t\tthrow err;\n\t\t});\n\t\treturn runtimePromise;\n\t};\n\tfunction queryRows(plan) {\n\t\tasync function* iterate() {\n\t\t\tyield* (await getRuntime()).query(plan);\n\t\t}\n\t\treturn new AsyncIterableResult(iterate());\n\t}\n\tasync function executeStats(plan) {\n\t\treturn (await getRuntime()).execute(plan);\n\t}\n\treturn {\n\t\torm: mongoOrm({\n\t\t\tcontract,\n\t\t\texecutor: {\n\t\t\t\tquery: queryRows,\n\t\t\t\texecute: executeStats\n\t\t\t},\n\t\t\tmutationDefaults: context,\n\t\t\tenums: enumsByNamespace\n\t\t}),\n\t\tquery,\n\t\traw,\n\t\tcontract,\n\t\tenums,\n\t\tcontext,\n\t\tasync connect(bindingInput) {\n\t\t\tif (closed) throw mongoError(\"DRIVER.NOT_CONNECTED\", \"Mongo client is closed\");\n\t\t\tif (runtimePromise !== void 0) throw mongoError(\"DRIVER.ALREADY_CONNECTED\", \"Mongo client already connected\");\n\t\t\tif (bindingInput !== void 0) binding = resolveMongoBinding(bindingInput);\n\t\t\tif (binding === void 0) throw mongoError(\"RUNTIME.BINDING_MISSING\", \"Mongo binding not configured. Pass url/uri+dbName/mongoClient+dbName/binding to mongo(...) or call db.connect({ ... }).\");\n\t\t\treturn getRuntime();\n\t\t},\n\t\truntime() {\n\t\t\treturn getRuntime();\n\t\t},\n\t\tasync close() {\n\t\t\tif (closed) return;\n\t\t\tclosed = true;\n\t\t\tif (runtimePromise === void 0) return;\n\t\t\ttry {\n\t\t\t\tawait runtimePromise;\n\t\t\t} catch {}\n\t\t\tconst dispose = ownedDispose;\n\t\t\townedDispose = void 0;\n\t\t\tawait dispose?.();\n\t\t},\n\t\t[Symbol.asyncDispose]() {\n\t\t\treturn this.close();\n\t\t}\n\t};\n}\n//#endregion\nexport { mongo as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;AAUA,SAAS,WAAW,MAAM,SAAS,SAAS;CAC3C,OAAO,gBAAgB,MAAM,SAAS;EACrC,GAAG;EACH,MAAM;GACL,GAAG,SAAS;GACZ,WAAW;EACZ;CAC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QAAQ;GACrD,iBAAiB,KAAK;GACtB,MAAM;EACP,CAAC;EACD,OAAO;CACR;CACA,SAAS,UAAU,MAAM;EACxB,gBAAgB,UAAU;GACzB,QAAQ,MAAM,WAAW,EAAA,CAAG,MAAM,IAAI;EACvC;EACA,OAAO,IAAI,oBAAoB,QAAQ,CAAC;CACzC;CACA,eAAe,aAAa,MAAM;EACjC,QAAQ,MAAM,WAAW,EAAA,CAAG,QAAQ,IAAI;CACzC;CACA,OAAO;EACN,KAAK,SAAS;GACb;GACA,UAAU;IACT,OAAO;IACP,SAAS;GACV;GACA,kBAAkB;GAClB,OAAO;EACR,CAAC;EACD;EACA;EACA;EACA;EACA;EACA,MAAM,QAAQ,cAAc;GAC3B,IAAI,QAAQ,MAAM,WAAW,wBAAwB,wBAAwB;GAC7E,IAAI,mBAAmB,KAAK,GAAG,MAAM,WAAW,4BAA4B,gCAAgC;GAC5G,IAAI,iBAAiB,KAAK,GAAG,UAAU,oBAAoB,YAAY;GACvE,IAAI,YAAY,KAAK,GAAG,MAAM,WAAW,2BAA2B,yHAAyH;GAC7L,OAAO,WAAW;EACnB;EACA,UAAU;GACT,OAAO,WAAW;EACnB;EACA,MAAM,QAAQ;GACb,IAAI,QAAQ;GACZ,SAAS;GACT,IAAI,mBAAmB,KAAK,GAAG;GAC/B,IAAI;IACH,MAAM;GACP,QAAQ,CAAC;GACT,MAAM,UAAU;GAChB,eAAe,KAAK;GACpB,MAAM,UAAU;EACjB;EACA,CAAC,OAAO,gBAAgB;GACvB,OAAO,KAAK,MAAM;EACnB;CACD;AACD"}
1
+ {"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-extensions/mongo/dist/runtime.mjs"],"sourcesContent":["import { i as validateMongoContract, t as buildMongoStaticContext } from \"./mongo-static-BOynTdtC.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { MongoDriverImpl } from \"@internal/driver-mongo\";\nimport { AsyncIterableResult } from \"@internal/framework-components/runtime\";\nimport { mongoOrm } from \"@internal/mongo-orm\";\nimport { createMongoRuntime } from \"@internal/mongo-runtime\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { ConnectionString } from \"mongodb-connection-string-url\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/runtime/mongo-errors.ts\nfunction mongoError(code, message, options) {\n\treturn structuredError(code, message, {\n\t\t...options,\n\t\tmeta: {\n\t\t\t...options?.meta,\n\t\t\textension: \"mongo\"\n\t\t}\n\t});\n}\n//#endregion\n//#region src/runtime/binding.ts\nconst URL_SCHEME_PATTERN = /^([a-z][a-z\\d+.-]*):\\/\\//i;\nconst MONGO_SCHEMES = /* @__PURE__ */ new Set([\"mongodb\", \"mongodb+srv\"]);\nfunction validateMongoUrl(url) {\n\tconst trimmed = url.trim();\n\tif (trimmed.length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must be a non-empty string\");\n\tconst scheme = URL_SCHEME_PATTERN.exec(trimmed)?.[1];\n\tif (scheme === void 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must be a valid URL\");\n\tif (!MONGO_SCHEMES.has(scheme)) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must use mongodb:// or mongodb+srv://\");\n\ttry {\n\t\treturn new ConnectionString(trimmed);\n\t} catch {\n\t\tthrow mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must be a valid URL\");\n\t}\n}\nfunction extractDbNameFromUrl(parsed) {\n\tconst [encodedDbName = \"\"] = parsed.pathname.slice(1).split(\"/\");\n\tif (encodedDbName.length === 0) return;\n\ttry {\n\t\treturn decodeURIComponent(encodedDbName);\n\t} catch {\n\t\tthrow mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must be a valid URL\");\n\t}\n}\nfunction resolveMongoBinding(options) {\n\tconst providedCount = Number(options.binding !== void 0) + Number(options.url !== void 0) + Number(options.uri !== void 0) + Number(options.mongoClient !== void 0);\n\tif (providedCount !== 1) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Provide one binding input: binding, url, uri+dbName, or mongoClient+dbName\", { meta: { received: providedCount } });\n\tif (options.binding !== void 0) return options.binding;\n\tif (options.url !== void 0) {\n\t\tconst parsed = validateMongoUrl(options.url);\n\t\tif (options.dbName !== void 0 && options.dbName.trim().length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo binding via { url, dbName } requires a non-empty dbName\");\n\t\tconst explicitDbName = options.dbName?.trim();\n\t\tconst dbName = explicitDbName !== void 0 && explicitDbName.length > 0 ? explicitDbName : extractDbNameFromUrl(parsed);\n\t\tif (dbName === void 0 || dbName.length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must include a database name in its path (e.g. mongodb://host:27017/mydb), or pass dbName explicitly\");\n\t\treturn {\n\t\t\tkind: \"url\",\n\t\t\turl: options.url.trim(),\n\t\t\tdbName\n\t\t};\n\t}\n\tif (options.uri !== void 0) {\n\t\tvalidateMongoUrl(options.uri);\n\t\tconst dbName = options.dbName?.trim();\n\t\tif (dbName === void 0 || dbName.length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo binding via { uri, dbName } requires a non-empty dbName\");\n\t\treturn {\n\t\t\tkind: \"url\",\n\t\t\turl: options.uri.trim(),\n\t\t\tdbName\n\t\t};\n\t}\n\tconst mongoClient = options.mongoClient;\n\tif (mongoClient === void 0) throw new InternalError(\"Invariant violation: expected mongo binding after validation\");\n\tconst dbName = options.dbName?.trim();\n\tif (dbName === void 0 || dbName.length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo binding via { mongoClient, dbName } requires a non-empty dbName\");\n\treturn {\n\t\tkind: \"mongoClient\",\n\t\tclient: mongoClient,\n\t\tdbName\n\t};\n}\nfunction resolveOptionalMongoBinding(options) {\n\tconst providedCount = Number(options.binding !== void 0) + Number(options.url !== void 0) + Number(options.uri !== void 0) + Number(options.mongoClient !== void 0);\n\tif (providedCount === 0) return;\n\tif (providedCount !== 1) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Provide one binding input: binding, url, uri+dbName, or mongoClient+dbName\", { meta: { received: providedCount } });\n\tif (options.binding !== void 0) return resolveMongoBinding({ binding: options.binding });\n\tif (options.url !== void 0) return resolveMongoBinding(options.dbName !== void 0 ? {\n\t\turl: options.url,\n\t\tdbName: options.dbName\n\t} : { url: options.url });\n\tif (options.uri !== void 0) return resolveMongoBinding({\n\t\turi: options.uri,\n\t\tdbName: options.dbName ?? \"\"\n\t});\n\tif (options.mongoClient !== void 0) return resolveMongoBinding({\n\t\tmongoClient: options.mongoClient,\n\t\tdbName: options.dbName ?? \"\"\n\t});\n\tthrow new InternalError(\"Invariant violation: expected one mongo binding branch\");\n}\n//#endregion\n//#region src/runtime/mongo.ts\n/**\n* Creates a lazy Mongo client. The client infers its contract type from `contract`: a value from\n* `contractFromJson` for an emitted contract, or a TypeScript-authored contract. A contract is\n* validated once, however many clients are built from it. The `orm` and `query` surfaces are\n* available at once; the driver connects on the first query or `connect()`.\n*\n* @example\n* ```ts\n* import { contractFromJson } from '@prisma/orm-mongo/static';\n* import mongo from '@prisma/orm-mongo/runtime';\n* import type { Contract } from './contract.d';\n* import contractJson from './contract.json' with { type: 'json' };\n*\n* export const contract = contractFromJson<Contract>(contractJson);\n* export const db = mongo({ contract, url: process.env['MONGODB_URL']! });\n* ```\n*/\nfunction mongo(options) {\n\tconst contract = validateMongoContract(options.contract);\n\tlet binding = resolveOptionalMongoBinding(options);\n\tconst { context, query, enums, enumsByNamespace, raw } = buildMongoStaticContext(contract);\n\tlet runtimePromise;\n\tlet closed = false;\n\tlet ownedDispose;\n\tconst buildRuntime = async (resolvedBinding) => {\n\t\tconst driver = resolvedBinding.kind === \"url\" ? await MongoDriverImpl.fromConnection(resolvedBinding.url, resolvedBinding.dbName) : MongoDriverImpl.fromDb(resolvedBinding.client.db(resolvedBinding.dbName));\n\t\tif (resolvedBinding.kind === \"url\") ownedDispose = () => driver.close();\n\t\treturn createMongoRuntime({\n\t\t\tcontext,\n\t\t\tdriver,\n\t\t\t...ifDefined(\"mode\", options.mode),\n\t\t\t...ifDefined(\"middleware\", options.middleware)\n\t\t});\n\t};\n\tconst getRuntime = () => {\n\t\tif (closed) return Promise.reject(mongoError(\"DRIVER.NOT_CONNECTED\", \"Mongo client is closed\"));\n\t\tif (runtimePromise !== void 0) return runtimePromise;\n\t\tif (binding === void 0) return Promise.reject(mongoError(\"RUNTIME.BINDING_MISSING\", \"Mongo binding not configured. Pass url/uri+dbName/mongoClient+dbName/binding to mongo(...) or call db.connect({ ... }).\"));\n\t\truntimePromise = buildRuntime(binding).catch((err) => {\n\t\t\truntimePromise = void 0;\n\t\t\tthrow err;\n\t\t});\n\t\treturn runtimePromise;\n\t};\n\tfunction queryRows(plan) {\n\t\tasync function* iterate() {\n\t\t\tyield* (await getRuntime()).query(plan);\n\t\t}\n\t\treturn new AsyncIterableResult(iterate());\n\t}\n\tasync function executeStats(plan) {\n\t\treturn (await getRuntime()).execute(plan);\n\t}\n\treturn {\n\t\torm: mongoOrm({\n\t\t\tcontract,\n\t\t\texecutor: {\n\t\t\t\tquery: queryRows,\n\t\t\t\texecute: executeStats\n\t\t\t},\n\t\t\tmutationDefaults: context,\n\t\t\tenums: enumsByNamespace\n\t\t}),\n\t\tquery,\n\t\traw,\n\t\tcontract,\n\t\tenums,\n\t\tcontext,\n\t\tasync connect(bindingInput) {\n\t\t\tif (closed) throw mongoError(\"DRIVER.NOT_CONNECTED\", \"Mongo client is closed\");\n\t\t\tif (runtimePromise !== void 0) throw mongoError(\"DRIVER.ALREADY_CONNECTED\", \"Mongo client already connected\");\n\t\t\tif (bindingInput !== void 0) binding = resolveMongoBinding(bindingInput);\n\t\t\tif (binding === void 0) throw mongoError(\"RUNTIME.BINDING_MISSING\", \"Mongo binding not configured. Pass url/uri+dbName/mongoClient+dbName/binding to mongo(...) or call db.connect({ ... }).\");\n\t\t\treturn getRuntime();\n\t\t},\n\t\truntime() {\n\t\t\treturn getRuntime();\n\t\t},\n\t\tasync close() {\n\t\t\tif (closed) return;\n\t\t\tclosed = true;\n\t\t\tif (runtimePromise === void 0) return;\n\t\t\ttry {\n\t\t\t\tawait runtimePromise;\n\t\t\t} catch {}\n\t\t\tconst dispose = ownedDispose;\n\t\t\townedDispose = void 0;\n\t\t\tawait dispose?.();\n\t\t},\n\t\t[Symbol.asyncDispose]() {\n\t\t\treturn this.close();\n\t\t}\n\t};\n}\n//#endregion\nexport { mongo as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;AAUA,SAAS,WAAW,MAAM,SAAS,SAAS;CAC3C,OAAO,gBAAgB,MAAM,SAAS;EACrC,GAAG;EACH,MAAM;GACL,GAAG,SAAS;GACZ,WAAW;EACZ;CACD,CAAC;AACF;AAGA,MAAM,qBAAqB;AAC3B,MAAM,gCAAgC,IAAI,IAAI,CAAC,WAAW,aAAa,CAAC;AACxE,SAAS,iBAAiB,KAAK;CAC9B,MAAM,UAAU,IAAI,KAAK;CACzB,IAAI,QAAQ,WAAW,GAAG,MAAM,WAAW,2BAA2B,sCAAsC;CAC5G,MAAM,SAAS,mBAAmB,KAAK,OAAO,CAAC,GAAG;CAClD,IAAI,WAAW,KAAK,GAAG,MAAM,WAAW,2BAA2B,+BAA+B;CAClG,IAAI,CAAC,cAAc,IAAI,MAAM,GAAG,MAAM,WAAW,2BAA2B,iDAAiD;CAC7H,IAAI;EACH,OAAO,IAAI,iBAAiB,OAAO;CACpC,QAAQ;EACP,MAAM,WAAW,2BAA2B,+BAA+B;CAC5E;AACD;AACA,SAAS,qBAAqB,QAAQ;CACrC,MAAM,CAAC,gBAAgB,MAAM,OAAO,SAAS,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG;CAC/D,IAAI,cAAc,WAAW,GAAG;CAChC,IAAI;EACH,OAAO,mBAAmB,aAAa;CACxC,QAAQ;EACP,MAAM,WAAW,2BAA2B,+BAA+B;CAC5E;AACD;AACA,SAAS,oBAAoB,SAAS;CACrC,MAAM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Z,SAAS;GACT,IAAI,mBAAmB,KAAK,GAAG;GAC/B,IAAI;IACH,MAAM;GACP,QAAQ,CAAC;GACT,MAAM,UAAU;GAChB,eAAe,KAAK;GACpB,MAAM,UAAU;EACjB;EACA,CAAC,OAAO,gBAAgB;GACvB,OAAO,KAAK,MAAM;EACnB;CACD;AACD"}
package/dist/static.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as contractFromJson, r as mongoStatic } from "./mongo-static-BDwTtMKh-DG75pAv8.mjs";
1
+ import { n as contractFromJson, r as mongoStatic } from "./mongo-static-BOynTdtC-DGBX_VnR.mjs";
2
2
  export { contractFromJson, mongoStatic as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-mongo",
3
- "version": "8.0.0-rc.18-dev.28",
3
+ "version": "8.0.0-rc.18-dev.30",
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.18-dev.28",
14
- "@prisma/orm-framework": "8.0.0-rc.18-dev.28",
15
- "@prisma/orm-target-mongo": "8.0.0-rc.18-dev.28",
16
- "@prisma/orm-toolchain": "8.0.0-rc.18-dev.28",
13
+ "@prisma/orm-family-mongo": "8.0.0-rc.18-dev.30",
14
+ "@prisma/orm-framework": "8.0.0-rc.18-dev.30",
15
+ "@prisma/orm-target-mongo": "8.0.0-rc.18-dev.30",
16
+ "@prisma/orm-toolchain": "8.0.0-rc.18-dev.30",
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.18-dev.28",
23
- "@repo/tsconfig": "8.0.0-rc.18-dev.28",
24
- "@repo/tsdown": "8.0.0-rc.18-dev.28",
22
+ "@internal/mongo": "8.0.0-rc.18-dev.30",
23
+ "@repo/tsconfig": "8.0.0-rc.18-dev.30",
24
+ "@repo/tsdown": "8.0.0-rc.18-dev.30",
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.18-dev.28'
18
+ library_version: '8.0.0-rc.18-dev.30'
19
19
  version: '2026-09-12'
20
20
  ---
21
21
 
@@ -155,6 +155,8 @@ model User {
155
155
  }
156
156
  ```
157
157
 
158
+ Values the client generates are written `@onCreate(fn())` and `@onUpdate(fn())`: `id String @id @onCreate(uuid(7))`, `slug String @onCreate(nanoid(12))`, `updatedAt DateTime @onCreate(now()) @onUpdate(now())`. `@default(...)` is a database default only (`now()`, `autoincrement()`, a literal, or `` sql`...` ``); `@default(uuid())` is refused with `PSL_GENERATOR_IN_DEFAULT`. In the TS builder, write `.onCreate(gen.uuid(7))` and `.onUpdate(gen.now())`. Column defaults and generators can sit on one field: `@default(now()) @onCreate(now())`.
159
+
158
160
  Note: scalar lists (e.g. `String[]`) are gated on the target's `sql.scalarList` capability — PostgreSQL declares it, so `tags String[]` lowers to an array column (with a generated no-NULL-elements check; write `tags String?[]` for a list whose elements may be null, which gets no such check); SQLite does not, and rejects the field with `PSL_SCALAR_LIST_UNSUPPORTED_TARGET`. Implicit Prisma-ORM many-to-many (list navigation on both sides without a join model) is rejected by the SQL interpreter — declare the join model explicitly and the ORM traverses it for you (`references/queries.md`). Composite/embeddable types (`type Address { ... }` with `address Address` on a model) are supported: the interpreter lowers them to `valueObjects` in the domain and stores them as `jsonb` columns. See *Workflow — Value objects* below.
159
161
 
160
162
  ## Workflow — Edit a model / field / relation (TS builder)
@@ -191,7 +193,7 @@ For Mongo, swap every `@internal/postgres/*` import for `@internal/mongo/*`. The
191
193
 
192
194
  Mongo scalar types, as PSL name / TS builder / application type: `String` / `field.string()` / `string`; `Int32` / `field.int32()` / `number`; `Int64` / `field.int64()` / `bigint`; `Double` / `field.double()` / `number`; `Decimal128` / `field.decimal128()` / decimal text as a `string`; `Bool` / `field.bool()` / `boolean`; `Date` / `field.date()` / `Date`; `ObjectId` / `field.objectId()` / `string`; `Binary` / `field.binary()` / `Uint8Array`; `Json` / `field.json()` / `JsonValue`; `Bson` / `field.bson()` / `BsonValue`. `Json` holds a JSON value only, validated as the JSON-representable BSON types; `Bson` holds any BSON value, unconstrained by the validator. The full table, with codec ids and storage types, is [Scalar types](https://github.com/prisma/orm/blob/main/docs/reference/scalar-types.md).
193
195
 
194
- Mongo timestamps the ORM fills: in PSL, type the field `temporal.createdAt()` (set on create), `temporal.updatedAt()` (set on create and on every update with a non-empty payload), or `temporal.timestamp(onCreate: now, onUpdate: now)` with either option; in TS, use `field.temporal.createdAt()` and the rest inside the callback overload. They store a BSON date read back as `Date`, one value per ORM operation, and an explicit value in the write wins. The fields are optional on create. A preset field cannot be optional (`?`), a list, `@id`, or a field of a composite type.
196
+ Mongo timestamps the ORM fills: in PSL, write `createdAt Date @onCreate(now())` (set on create) or `updatedAt Date @onCreate(now()) @onUpdate(now())` (set on create and on every update with a non-empty payload), or type the field with the presets `temporal.createdAt()`, `temporal.updatedAt()` or `temporal.timestamp(onCreate: now, onUpdate: now)`; in TS, use `field.date().onCreate(gen.now()).onUpdate(gen.now())`, or `field.temporal.createdAt()` and the rest inside the callback overload. They store a BSON date read back as `Date`, one value per ORM operation, and an explicit value in the write wins. The fields are optional on create. A preset field cannot be optional (`?`), a list, `@id`, or a field of a composite type.
195
197
 
196
198
  ## Workflow — Add an extension-typed scalar (pgvector)
197
199
 
@@ -281,7 +283,7 @@ type Address {
281
283
  }
282
284
 
283
285
  model User {
284
- id String @id @default(uuid())
286
+ id String @id @onCreate(uuid())
285
287
  email String
286
288
  address Address?
287
289
  }
@@ -303,7 +305,7 @@ enum user_type {
303
305
  }
304
306
 
305
307
  model User {
306
- id String @id @default(uuid())
308
+ id String @id @onCreate(uuid())
307
309
  kind user_type
308
310
  }
309
311
  ```
@@ -312,7 +314,7 @@ model User {
312
314
 
313
315
  **Codecs an enum cannot use.** An enum compares values with its members, so a codec whose values cannot be compared for equality, or whose values read back never equal a member as the contract stores it, is refused, in TypeScript with `CONTRACT.ENUM_INVALID` and in PSL with `PSL_EXTENSION_INVALID_VALUE` at the `@@type`. The message says why and what to use instead. On Postgres: `pg/timestamp-string@1` and `pg/timestamptz-string@1` (use `pg/timestamp-temporal@1` or `pg/timestamptz-temporal@1`), `pg/json@1` (use `pg/jsonb@1`), and `pg/bytea@1` and `pg/tsquery@1`, for which no enum is possible (use a text enum).
314
316
 
315
- **Mongo enums.** A Mongo PSL contract's collection validator lists each enum's members in their stored JSON forms, so a PSL enum needs a codec whose BSON type JSON holds: string, int, double, bool, object or array, with finite numbers for doubles. An enum over `mongo/int64@1`, `mongo/date@1` or `mongo/objectId@1` is refused with `PSL_EXTENSION_INVALID_VALUE`. A TypeScript Mongo contract has no collection validator and accepts these enums.
317
+ **Mongo enums.** A Mongo contract's collection validator lists each enum's members in their stored JSON forms, so an enum needs a codec whose BSON type JSON holds: string, int, double, bool, object or array, with finite numbers for doubles. PSL and TypeScript contracts derive the same validator. An enum over `mongo/int64@1`, `mongo/date@1` or `mongo/objectId@1` is refused: with `PSL_EXTENSION_INVALID_VALUE` in PSL, and with `CONTRACT.ENUM_INVALID` by `defineContract`.
316
318
 
317
319
  **Generated checks cannot be waived.** On a managed table every enum column gets a membership check, and every list column with non-null elements gets a no-NULL-elements check. A list whose elements may be null is written `String?[]` (TS: `.many({ elementsNullable: true })`) and gets no element check. `contract infer` writes `String?[]` for a list column whose database has no element check, and a Prisma 7 schema's lists are read as `String?[]`.
318
320
 
@@ -348,7 +350,7 @@ The concept: wrap models in a `namespace <name> { ... }` block to place them in
348
350
  ```prisma
349
351
  namespace public {
350
352
  model Profile {
351
- id String @id @default(uuid())
353
+ id String @id @onCreate(uuid())
352
354
  username String
353
355
  userId String @unique
354
356
  @@map("profile")
@@ -365,7 +367,7 @@ The concept: a mixin is a named set of members for one kind of block. Declare it
365
367
  ```prisma
366
368
  model mixin Timestamps {
367
369
  createdAt DateTime @default(now())
368
- updatedAt DateTime @default(now())
370
+ updatedAt DateTime @onCreate(now()) @onUpdate(now())
369
371
  @@index([createdAt])
370
372
  }
371
373
 
@@ -409,7 +411,7 @@ types {
409
411
 
410
412
  namespace public {
411
413
  model Profile {
412
- id String @id @default(uuid())
414
+ id String @id @onCreate(uuid())
413
415
  username String
414
416
  userId AuthUserId @unique
415
417
  user supabase:auth.AuthUser @relation(fields: [userId], references: [id], onDelete: Cascade)
@@ -57,7 +57,7 @@ The concept: your models live in your namespaces (`public`); Supabase's live in
57
57
  ```prisma
58
58
  namespace public {
59
59
  model Profile {
60
- id Uuid @id @default(uuid())
60
+ id Uuid @id @onCreate(uuid())
61
61
  username String
62
62
  userId Uuid @unique
63
63
  user supabase:auth.AuthUser @relation(fields: [userId], references: [id], onDelete: Cascade)