@prisma/orm-target-mongo 8.0.0-rc.18-dev.32 → 8.0.0-rc.18-dev.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/adapter.mjs +1 -1
  2. package/dist/adapter__control.d.mts +1 -1
  3. package/dist/adapter__control.mjs +2 -2
  4. package/dist/adapter__runtime.mjs +2 -2
  5. package/dist/{codec-types-DHjpzMTv.d.mts → codec-types-Daq7xQEA.d.mts} +2 -1
  6. package/dist/{codec-types-DHjpzMTv.d.mts.map → codec-types-Daq7xQEA.d.mts.map} +1 -1
  7. package/dist/{codecs-BVrMDhha-DBl_TLS8.mjs → codecs-CylyDRI5-DdzCZHek.mjs} +15 -11
  8. package/dist/codecs-CylyDRI5-DdzCZHek.mjs.map +1 -0
  9. package/dist/{control-DpeYOTlN.d.mts → control-Poy33Wpm.d.mts} +13 -4
  10. package/dist/control-Poy33Wpm.d.mts.map +1 -0
  11. package/dist/{control-CfztdRLD.mjs → control-r-qY2RS-.mjs} +17 -27
  12. package/dist/control-r-qY2RS-.mjs.map +1 -0
  13. package/dist/{data-types-vptiHFHC-LUJwNRIq.mjs → data-types-BUNJnoE9-S7P2K-7r.mjs} +5 -11
  14. package/dist/data-types-BUNJnoE9-S7P2K-7r.mjs.map +1 -0
  15. package/dist/{descriptor-meta-BQBreSNF-CZ9uOPwO.mjs → descriptor-meta-DdeUSTJk-zJzD7C-n.mjs} +3 -3
  16. package/dist/{descriptor-meta-BQBreSNF-CZ9uOPwO.mjs.map → descriptor-meta-DdeUSTJk-zJzD7C-n.mjs.map} +1 -1
  17. package/dist/{descriptor-meta-runtime-D0YxXi85-CjeTEg7T.mjs → descriptor-meta-runtime-DeRjCidG-BzMW-qkN.mjs} +4 -4
  18. package/dist/{descriptor-meta-runtime-D0YxXi85-CjeTEg7T.mjs.map → descriptor-meta-runtime-DeRjCidG-BzMW-qkN.mjs.map} +1 -1
  19. package/dist/driver.mjs +1 -1
  20. package/dist/driver__control.mjs +2 -2
  21. package/dist/driver__control.mjs.map +1 -1
  22. package/dist/{mongo-adapter-Bo6ciURK-Cy0xnkRa.mjs → mongo-adapter-Bo6ciURK-Dvq-oZQ9.mjs} +2 -2
  23. package/dist/{mongo-adapter-Bo6ciURK-Cy0xnkRa.mjs.map → mongo-adapter-Bo6ciURK-Dvq-oZQ9.mjs.map} +1 -1
  24. package/dist/{mongo-driver-BqPkFjuV-Crm0Mhm6.mjs → mongo-driver-BqR2je7A-Bj0z84IU.mjs} +3 -3
  25. package/dist/{mongo-driver-BqPkFjuV-Crm0Mhm6.mjs.map → mongo-driver-BqR2je7A-Bj0z84IU.mjs.map} +1 -1
  26. package/dist/{pack-BuZ5LBMg.d.mts → pack-FxKc7yY0.d.mts} +2 -2
  27. package/dist/{pack-BuZ5LBMg.d.mts.map → pack-FxKc7yY0.d.mts.map} +1 -1
  28. package/dist/{prisma6-binding-DKZXqEL5.mjs → prisma6-binding-L_x2s5FV.mjs} +2 -2
  29. package/dist/{prisma6-binding-DKZXqEL5.mjs.map → prisma6-binding-L_x2s5FV.mjs.map} +1 -1
  30. package/dist/target.d.mts +4 -4
  31. package/dist/target.mjs +4 -4
  32. package/dist/target__codec-types.d.mts +1 -1
  33. package/dist/target__codecs.mjs +1 -1
  34. package/dist/target__control.d.mts +2 -2
  35. package/dist/target__control.mjs +1 -1
  36. package/dist/target__data-types.mjs +1 -1
  37. package/dist/target__pack.d.mts +2 -2
  38. package/dist/target__pack.mjs +1 -1
  39. package/dist/target__pack.mjs.map +1 -1
  40. package/dist/target__prisma6-binding.mjs +1 -1
  41. package/dist/target__runtime.mjs +1 -1
  42. package/dist/target__runtime.mjs.map +1 -1
  43. package/package.json +9 -9
  44. package/dist/codecs-BVrMDhha-DBl_TLS8.mjs.map +0 -1
  45. package/dist/control-CfztdRLD.mjs.map +0 -1
  46. package/dist/control-DpeYOTlN.d.mts.map +0 -1
  47. package/dist/data-types-vptiHFHC-LUJwNRIq.mjs.map +0 -1
package/dist/adapter.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { p as MONGO_VECTOR_CODEC_ID } from "./codec-ids-WdrumsYA-BkQfspmL.mjs";
2
- import { a as lowerStage, i as lowerPipeline, n as lowerAggExpr, r as lowerFilter, t as createMongoAdapter } from "./mongo-adapter-Bo6ciURK-Cy0xnkRa.mjs";
2
+ import { a as lowerStage, i as lowerPipeline, n as lowerAggExpr, r as lowerFilter, t as createMongoAdapter } from "./mongo-adapter-Bo6ciURK-Dvq-oZQ9.mjs";
3
3
  //#region ../../../3-mongo-target/2-mongo-adapter/dist/index.mjs
4
4
  const mongoVectorNearOperation = Object.freeze({
5
5
  self: { codecId: MONGO_VECTOR_CODEC_ID },
@@ -1,8 +1,8 @@
1
1
  import { t as createMongoAdapter } from "./mongo-adapter-wvK2fQOZ-BXo5NxEB.mjs";
2
2
  import { MongoSchemaIR } from "@prisma/orm-family-mongo/schema-ir";
3
3
  import { AnyMongoDdlCommand, ListCollectionsCommand, ListIndexesCommand, MongoInspectionCommandVisitor } from "@prisma/orm-family-mongo/query-ast/control";
4
- import { ContractMarkerRecord, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
5
4
  import { ControlDriverInstance } from "@prisma/orm-framework/components/control";
5
+ import { ContractMarkerRecord, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
6
6
  import { Db, Document } from "mongodb";
7
7
  import { MongoControlDriverInstance, MongoControlDriverInstance as MongoControlDriverInstance$1, MongoDriver } from "@prisma/orm-family-mongo/lowering";
8
8
  import { MongoControlAdapter, MongoControlAdapterDescriptor, MongoRunnerDependencies } from "@prisma/orm-family-mongo/family/control-adapter";
@@ -1,5 +1,5 @@
1
1
  import { a as MONGO_DECIMAL128_CODEC_ID, c as MONGO_INT64_CODEC_ID, d as MONGO_OBJECTID_CODEC_ID, f as MONGO_STRING_CODEC_ID, i as MONGO_DATE_CODEC_ID, l as MONGO_INT64_NUMBER_CODEC_ID, n as MONGO_BOOLEAN_CODEC_ID, o as MONGO_DOUBLE_CODEC_ID, r as MONGO_BSON_CODEC_ID, s as MONGO_INT32_CODEC_ID, t as MONGO_BINARY_CODEC_ID, u as MONGO_JSON_CODEC_ID } from "./codec-ids-WdrumsYA-BkQfspmL.mjs";
2
- import { t as createMongoAdapter } from "./mongo-adapter-Bo6ciURK-Cy0xnkRa.mjs";
2
+ import { t as createMongoAdapter } from "./mongo-adapter-Bo6ciURK-Dvq-oZQ9.mjs";
3
3
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
4
4
  import { blindCast } from "@prisma/orm-framework/utils/casts";
5
5
  import { type } from "arktype";
@@ -7,8 +7,8 @@ import { MongoSchemaCollection, MongoSchemaCollectionOptions, MongoSchemaIR, Mon
7
7
  import { MongoAggFieldRef, MongoAggLiteral, MongoAggOperator } from "@prisma/orm-family-mongo/query-ast/execution";
8
8
  import { expr, fn } from "@prisma/orm-family-mongo/query-builder";
9
9
  import { collection } from "@prisma/orm-family-mongo/query-builder/contract-free";
10
- import { parseMarkerRowSafely, withMarkerReadErrorHandling } from "@prisma/orm-framework/errors/execution";
11
10
  import { MongoServerError } from "mongodb";
11
+ import { parseMarkerRowSafely, withMarkerReadErrorHandling } from "@prisma/orm-framework/errors/execution";
12
12
  import { ledgerOriginFromStored } from "@prisma/orm-toolchain/migration-tools/ledger-origin";
13
13
  //#region ../../../3-mongo-target/2-mongo-adapter/dist/control.mjs
14
14
  /**
@@ -1,5 +1,5 @@
1
- import { t as buildStandardCodecRegistry } from "./codecs-BVrMDhha-DBl_TLS8.mjs";
2
- import { t as createMongoAdapter } from "./mongo-adapter-Bo6ciURK-Cy0xnkRa.mjs";
1
+ import { t as buildStandardCodecRegistry } from "./codecs-CylyDRI5-DdzCZHek.mjs";
2
+ import { t as createMongoAdapter } from "./mongo-adapter-Bo6ciURK-Dvq-oZQ9.mjs";
3
3
  import { timestampNowRuntimeGenerator } from "@prisma/orm-family-mongo/family/runtime";
4
4
  //#region ../../../3-mongo-target/2-mongo-adapter/dist/runtime.mjs
5
5
  const mongoRuntimeAdapterDescriptor = {
@@ -55,6 +55,7 @@ type CodecTypes = {
55
55
  readonly input: string;
56
56
  readonly output: string;
57
57
  readonly traits: 'equality' | 'order' | 'numeric';
58
+ readonly keepsWrittenForm: true;
58
59
  };
59
60
  readonly 'mongo/binary@1': {
60
61
  readonly input: Uint8Array;
@@ -85,4 +86,4 @@ interface ParameterizedOutputTypesForTypeParams extends ParameterizedOutputTypes
85
86
  }
86
87
  //#endregion
87
88
  export { ParameterizedOutputTypesForTypeParams as a, CodecTypes as i, BsonScalar as n, Vector as o, BsonValue$1 as r, BsonInputValue$1 as t };
88
- //# sourceMappingURL=codec-types-DHjpzMTv.d.mts.map
89
+ //# sourceMappingURL=codec-types-Daq7xQEA.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codec-types-DHjpzMTv.d.mts","names":[],"sources":["../../../../3-mongo-target/1-mongo-target/dist/codec-types.d.mts"],"mappings":";;;;KAGK,OAAO;WACD,iBAAiB;;KAEvB;WACM;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE,OAAO;aACP,QAAQ;aACR;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE,OAAO;aACP,QAAQ;aACR;;WAEF;aACE,OAAO;aACP,QAAQ;aACR;;WAEF;aACE,OAAO;aACP,QAAQ;aACR;;;KAGR,cAAc;WACR,kBAAkB;aAChB,cAAc;MACrB,OAAO;;;;;UAKH,8CAA8C;WAC7C,aAAa"}
1
+ {"version":3,"file":"codec-types-Daq7xQEA.d.mts","names":[],"sources":["../../../../3-mongo-target/1-mongo-target/dist/codec-types.d.mts"],"mappings":";;;;KAGK,OAAO;WACD,iBAAiB;;KAEvB;WACM;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE,OAAO;aACP,QAAQ;aACR;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;aACA;;WAEF;aACE,OAAO;aACP,QAAQ;aACR;;WAEF;aACE,OAAO;aACP,QAAQ;aACR;;WAEF;aACE,OAAO;aACP,QAAQ;aACR;;;KAGR,cAAc;WACR,kBAAkB;aAChB,cAAc;MACrB,OAAO;;;;;UAKH,8CAA8C;WAC7C,aAAa"}
@@ -1,11 +1,11 @@
1
1
  import { a as MONGO_DECIMAL128_CODEC_ID, c as MONGO_INT64_CODEC_ID, d as MONGO_OBJECTID_CODEC_ID, f as MONGO_STRING_CODEC_ID, i as MONGO_DATE_CODEC_ID, l as MONGO_INT64_NUMBER_CODEC_ID, n as MONGO_BOOLEAN_CODEC_ID, o as MONGO_DOUBLE_CODEC_ID, p as MONGO_VECTOR_CODEC_ID, r as MONGO_BSON_CODEC_ID, s as MONGO_INT32_CODEC_ID, t as MONGO_BINARY_CODEC_ID, u as MONGO_JSON_CODEC_ID } from "./codec-ids-WdrumsYA-BkQfspmL.mjs";
2
2
  import { t as mongoTargetError } from "./mongo-target-errors-Btf3ML1w-B5EMYbz1.mjs";
3
- import { A as int64ToJson, B as mongoInt32, C as int32ToJson, D as int64NumberEncode, E as int64NumberDecode, F as mongoBson, G as mongoVector, H as mongoJson, J as objectIdToJson, L as mongoDate, M as isPlainObject, N as mongoBinary, O as int64NumberFromDigits, P as mongoBool, Q as where, R as mongoDecimal128, S as int32Encode, T as int64Encode, U as mongoObjectId, V as mongoInt64, W as mongoString, X as stringEncode, Y as readBsonJson, Z as vectorEncode, _ as decimalTextBigintLiteral, a as booleanEncode, b as doubleEncode, c as bsonTypeTag, d as dateEncode, f as dateToJson, g as decimal128ToJson, h as decimal128Encode, i as binaryToBase64, j as isPlainArray, k as int64NumberToJson, l as child, m as decimal128Decode, n as binaryEncode, o as bsonClassTag, p as dbRefEntries, q as objectIdEncode, r as binaryFromBase64, s as bsonToJson, t as binaryDecode, u as constructorName, v as decimalTextNumberLiteral, w as int64Decode, x as encodeBsonValue, y as decodeBsonValue, z as mongoDouble } from "./data-types-vptiHFHC-LUJwNRIq.mjs";
4
- import { floatToJson, readJsonFloat, renderTsLiteral } from "@prisma/orm-framework/components/codec";
3
+ import { A as isPlainObject, B as mongoJson, C as int64Encode, D as int64NumberToJson, E as int64NumberFromDigits, F as mongoDate, G as objectIdEncode, H as mongoString, I as mongoDecimal128, J as stringEncode, K as objectIdToJson, L as mongoDouble, M as mongoBool, N as mongoBson, O as int64ToJson, R as mongoInt32, S as int64Decode, T as int64NumberEncode, U as mongoVector, V as mongoObjectId, X as where, Y as vectorEncode, _ as decodeBsonValue, a as booleanEncode, b as int32Encode, c as bsonTypeTag, d as dateEncode, f as dateToJson, g as decimal128ToJson, h as decimal128Encode, i as binaryToBase64, j as mongoBinary, k as isPlainArray, l as child, m as decimal128Decode, n as binaryEncode, o as bsonClassTag, p as dbRefEntries, q as readBsonJson, r as binaryFromBase64, s as bsonToJson, t as binaryDecode, u as constructorName, v as doubleEncode, w as int64NumberDecode, x as int32ToJson, y as encodeBsonValue, z as mongoInt64 } from "./data-types-BUNJnoE9-S7P2K-7r.mjs";
4
+ import { decimalTextBigintLiteral, decimalTextNumberLiteral, floatNumberLiteral, floatToJson, readJsonFloat, renderTsLiteral } from "@prisma/orm-framework/components/codec";
5
5
  import { blindCast } from "@prisma/orm-framework/utils/casts";
6
6
  import { mongoCodec, newMongoCodecRegistry } from "@prisma/orm-family-mongo/codec";
7
7
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
8
- //#region ../../../3-mongo-target/1-mongo-target/dist/codecs-BVrMDhha.mjs
8
+ //#region ../../../3-mongo-target/1-mongo-target/dist/codecs-CylyDRI5.mjs
9
9
  const BSON_TYPE_BY_TAG = {
10
10
  ObjectId: "objectId",
11
11
  Decimal128: "decimal",
@@ -300,7 +300,8 @@ function descriptorFor(codec, metadata) {
300
300
  const built = metadata.withParams === void 0 || params === void 0 ? codec : metadata.withParams(params);
301
301
  return () => built;
302
302
  }),
303
- ...ifDefined("renderValueLiteral", metadata.renderValueLiteral)
303
+ ...ifDefined("renderValueLiteral", metadata.renderValueLiteral),
304
+ ...ifDefined("keepsWrittenForm", metadata.keepsWrittenForm)
304
305
  };
305
306
  }
306
307
  /**
@@ -322,7 +323,7 @@ const mongoCodecDescriptors = [
322
323
  "order",
323
324
  "numeric"
324
325
  ],
325
- renderValueLiteral: (value) => typeof value === "number" ? String(value) : void 0
326
+ renderValueLiteral: floatNumberLiteral
326
327
  }),
327
328
  descriptorFor(mongoInt32Codec, {
328
329
  traits: [
@@ -357,11 +358,14 @@ const mongoCodecDescriptors = [
357
358
  ],
358
359
  renderValueLiteral: decimalTextNumberLiteral
359
360
  }),
360
- descriptorFor(mongoDecimal128Codec, { traits: [
361
- "equality",
362
- "order",
363
- "numeric"
364
- ] }),
361
+ descriptorFor(mongoDecimal128Codec, {
362
+ traits: [
363
+ "equality",
364
+ "order",
365
+ "numeric"
366
+ ],
367
+ keepsWrittenForm: true
368
+ }),
365
369
  descriptorFor(mongoBinaryCodec, { traits: ["equality"] }),
366
370
  descriptorFor(mongoJsonCodec, { traits: [] }),
367
371
  descriptorFor(mongoBsonCodec, { traits: [] })
@@ -385,4 +389,4 @@ function buildStandardCodecRegistry() {
385
389
  //#endregion
386
390
  export { mongoStandardCodecs as i, mongoCodecDescriptors as n, mongoDescriptorById as r, buildStandardCodecRegistry as t };
387
391
 
388
- //# sourceMappingURL=codecs-BVrMDhha-DBl_TLS8.mjs.map
392
+ //# sourceMappingURL=codecs-CylyDRI5-DdzCZHek.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codecs-CylyDRI5-DdzCZHek.mjs","names":[],"sources":["../../../../3-mongo-target/1-mongo-target/dist/codecs-CylyDRI5.mjs"],"sourcesContent":["import { a as MONGO_DECIMAL128_CODEC_ID, c as MONGO_INT64_CODEC_ID, d as MONGO_OBJECTID_CODEC_ID, f as MONGO_STRING_CODEC_ID, i as MONGO_DATE_CODEC_ID, l as MONGO_INT64_NUMBER_CODEC_ID, n as MONGO_BOOLEAN_CODEC_ID, o as MONGO_DOUBLE_CODEC_ID, p as MONGO_VECTOR_CODEC_ID, r as MONGO_BSON_CODEC_ID, s as MONGO_INT32_CODEC_ID, t as MONGO_BINARY_CODEC_ID, u as MONGO_JSON_CODEC_ID } from \"./codec-ids-WdrumsYA.mjs\";\nimport { A as int64NumberDecode, B as decodeBsonValue, C as decimal128Encode, D as int32ToJson, E as int32Encode, F as objectIdEncode, G as child, H as readBsonJson, I as objectIdToJson, J as isPlainArray, K as constructorName, L as stringEncode, M as int64NumberFromDigits, N as int64NumberToJson, O as int64Decode, P as int64ToJson, R as vectorEncode, S as decimal128Decode, T as doubleEncode, U as bsonClassTag, V as encodeBsonValue, W as bsonTypeTag, X as where, Y as isPlainObject, _ as binaryFromBase64, a as mongoDate, b as dateEncode, c as mongoInt32, d as mongoObjectId, f as mongoString, g as binaryEncode, h as binaryDecode, j as int64NumberEncode, k as int64Encode, l as mongoInt64, n as mongoBool, o as mongoDecimal128, p as mongoVector, q as dbRefEntries, r as mongoBson, s as mongoDouble, t as mongoBinary, u as mongoJson, v as binaryToBase64, w as decimal128ToJson, x as dateToJson, y as booleanEncode, z as bsonToJson } from \"./data-types-BUNJnoE9.mjs\";\nimport { t as mongoTargetError } from \"./mongo-target-errors-Btf3ML1w.mjs\";\nimport { decimalTextBigintLiteral, decimalTextNumberLiteral, floatNumberLiteral, floatToJson, readJsonFloat, renderTsLiteral } from \"@internal/framework-components/codec\";\nimport { mongoCodec, newMongoCodecRegistry } from \"@internal/mongo-codec\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\n//#region src/core/json-codec-helpers.ts\nconst BSON_TYPE_BY_TAG = {\n\tObjectId: \"objectId\",\n\tDecimal128: \"decimal\",\n\tBinary: \"binData\",\n\tBSONRegExp: \"regex\",\n\tTimestamp: \"timestamp\",\n\tBSONSymbol: \"symbol\",\n\tCode: \"javascript\",\n\tMinKey: \"minKey\",\n\tMaxKey: \"maxKey\"\n};\nconst NOT_FINITE_FIX = \"JSON has no NaN or Infinity; store null or a string, or declare the field Bson.\";\nconst BSON_FIX = \"Declare the field Bson to store BSON values.\";\nconst PLAIN_VALUE_FIX = \"Convert it to a plain object or array.\";\nconst ENCODE_FIX_BY_RECEIVED = {\n\tDate: \"Store the date as an ISO 8601 string, or declare the field Bson.\",\n\tbigint: \"Store it as a number in the safe-integer range or as decimal text, or declare the field Int64 or Bson.\",\n\tNaN: NOT_FINITE_FIX,\n\tInfinity: NOT_FINITE_FIX,\n\t\"-Infinity\": NOT_FINITE_FIX,\n\tundefined: \"Leave the key out, or store null.\",\n\tUint8Array: \"Store the bytes as a base64 string, or declare the field Binary or Bson.\",\n\tBuffer: \"Store the bytes as a base64 string, or declare the field Binary or Bson.\",\n\tBinary: \"Store the bytes as a base64 string, or declare the field Binary or Bson.\",\n\tObjectId: \"Store its hex string, or declare the field ObjectId or Bson.\",\n\tLong: \"Store a number in the safe-integer range or decimal text, or declare the field Int64 or Bson.\",\n\tDecimal128: \"Store the decimal text, or declare the field Decimal128 or Bson.\",\n\tInt32: \"Pass a plain number.\",\n\tDouble: \"Pass a plain number.\",\n\tRegExp: \"Store the pattern as a string, or declare the field Bson.\",\n\tBSONRegExp: \"Store the pattern as a string, or declare the field Bson.\",\n\tsymbol: \"Store a string instead.\",\n\tfunction: \"Store data, not a function.\",\n\t\"circular reference\": \"Remove the cycle; a JSON value is a tree.\",\n\t\"sparse array hole\": \"Fill the hole with null.\",\n\tDBRef: \"Write it as a { $ref, $id } document instead.\"\n};\nfunction encodeFix(received) {\n\treturn ENCODE_FIX_BY_RECEIVED[received] ?? (Object.hasOwn(BSON_TYPE_BY_TAG, received) ? BSON_FIX : PLAIN_VALUE_FIX);\n}\nfunction encodeRefused(received, path) {\n\tthrow mongoTargetError(\"RUNTIME.ENCODE_FAILED\", `${MONGO_JSON_CODEC_ID} value must be a JSON value; received ${received} at ${where(path)}. ${encodeFix(received)}`, { meta: {\n\t\tcodecId: MONGO_JSON_CODEC_ID,\n\t\treceived,\n\t\tvaluePath: path\n\t} });\n}\nfunction describeNonJson(value) {\n\tif (value === null || typeof value === \"string\" || typeof value === \"boolean\") return void 0;\n\tif (typeof value === \"number\") return Number.isFinite(value) ? void 0 : String(value);\n\tif (typeof value !== \"object\") return typeof value;\n\tconst tag = bsonTypeTag(value);\n\tif (tag !== void 0) return tag;\n\tif (value instanceof Date) return \"Date\";\n\tif (isPlainArray(value)) return void 0;\n\treturn isPlainObject(value) ? void 0 : constructorName(value);\n}\nfunction assertJsonValue(value, path, ancestors) {\n\tconst received = describeNonJson(value);\n\tif (received !== void 0) encodeRefused(received, path);\n\tif (typeof value !== \"object\" || value === null) return;\n\tif (ancestors.has(value)) encodeRefused(\"circular reference\", path);\n\tancestors.add(value);\n\tif (Array.isArray(value)) for (let index = 0; index < value.length; index++) {\n\t\tif (!(index in value)) encodeRefused(\"sparse array hole\", child(path, index));\n\t\tassertJsonValue(value[index], child(path, index), ancestors);\n\t}\n\telse for (const [key, entry] of Object.entries(value)) assertJsonValue(entry, child(path, key), ancestors);\n\tancestors.delete(value);\n}\n/**\n* Returns `value` unchanged when it is a plain JSON value at every depth, and throws `RUNTIME.ENCODE_FAILED` naming the first value that is not, with its path.\n*/\nfunction encodeJsonValue(value) {\n\tassertJsonValue(value, \"\", /* @__PURE__ */ new Set());\n\treturn value;\n}\nfunction decodeRefused(bsonType, path) {\n\tthrow mongoTargetError(\"RUNTIME.DECODE_FAILED\", `${MONGO_JSON_CODEC_ID} wire value contains a non-JSON BSON ${bsonType} at ${where(path)}`, { meta: {\n\t\tcodecId: MONGO_JSON_CODEC_ID,\n\t\treceived: bsonType,\n\t\tvaluePath: path\n\t} });\n}\nfunction safeLong(value, path) {\n\tconst number = Number(value);\n\treturn Number.isSafeInteger(number) && BigInt(number) === value ? number : decodeRefused(\"long\", path);\n}\nfunction finiteDouble(value, path) {\n\tif (Number.isFinite(value)) return value;\n\tconst received = String(value);\n\tthrow mongoTargetError(\"RUNTIME.DECODE_FAILED\", `${MONGO_JSON_CODEC_ID} wire value contains ${received} at ${where(path)}; a JSON number cannot be NaN or Infinity`, { meta: {\n\t\tcodecId: MONGO_JSON_CODEC_ID,\n\t\treceived,\n\t\tvaluePath: path\n\t} });\n}\nfunction decodeEntries(entries, path) {\n\treturn Object.fromEntries(entries.map(([key, entry]) => [key, decodeValue(entry, child(path, key))]));\n}\nfunction decodeTagged(value, tag, path) {\n\tswitch (tag) {\n\t\tcase \"DBRef\": return decodeEntries(dbRefEntries(value), path);\n\t\tcase \"Long\": return safeLong(blindCast(value).toBigInt(), path);\n\t\tcase \"Int32\":\n\t\tcase \"Double\": return finiteDouble(Number(value.valueOf()), path);\n\t}\n\treturn decodeRefused(BSON_TYPE_BY_TAG[tag] ?? tag, path);\n}\nfunction decodeValue(value, path) {\n\tif (value === null || typeof value === \"string\" || typeof value === \"boolean\") return value;\n\tif (typeof value === \"number\") return finiteDouble(value, path);\n\tif (typeof value === \"bigint\") return safeLong(value, path);\n\tif (typeof value === \"undefined\") return decodeRefused(\"undefined\", path);\n\tif (typeof value === \"symbol\") return decodeRefused(\"symbol\", path);\n\tif (typeof value === \"function\") return decodeRefused(\"javascript\", path);\n\tconst tag = bsonClassTag(value);\n\tif (tag !== void 0) return decodeTagged(value, tag, path);\n\tif (value instanceof Date) return decodeRefused(\"date\", path);\n\tif (value instanceof RegExp) return decodeRefused(\"regex\", path);\n\tif (value instanceof Uint8Array) return decodeRefused(\"binData\", path);\n\tif (Array.isArray(value)) {\n\t\tconst decoded = value.map((entry, index) => decodeValue(entry, child(path, index)));\n\t\treturn decoded.some((entry, index) => entry !== value[index]) ? decoded : value;\n\t}\n\tif (!isPlainObject(value)) return decodeRefused(constructorName(value), path);\n\tconst entries = Object.entries(value);\n\tconst decoded = decodeEntries(entries, path);\n\treturn entries.some(([key, entry]) => decoded[key] !== entry) ? decoded : blindCast(value);\n}\n/**\n* Decodes a wire value to the JSON value it holds: a `long` in the safe-integer range and the driver's `Int32` and `Double` wrappers become numbers. Only the objects and arrays around a converted value are copied; a wire value that is already JSON is returned as the same object. Throws `RUNTIME.DECODE_FAILED` naming the BSON type and path of the first value that is not JSON.\n*/\nfunction decodeJsonValue(wire) {\n\treturn decodeValue(wire, \"\");\n}\n//#endregion\n//#region src/core/codecs.ts\nconst mongoObjectIdCodec = mongoCodec({\n\ttypeId: MONGO_OBJECTID_CODEC_ID,\n\tdataType: mongoObjectId,\n\tfromWire: (wire) => wire.toHexString(),\n\ttoWire: (value) => objectIdEncode(MONGO_OBJECTID_CODEC_ID, value),\n\ttoDataTypeValue: (value) => mongoObjectId.valueFrom(objectIdToJson(MONGO_OBJECTID_CODEC_ID, value), {}),\n\tfromDataTypeValue: (value) => value.value\n});\nconst mongoStringCodec = mongoCodec({\n\ttypeId: MONGO_STRING_CODEC_ID,\n\tdataType: mongoString,\n\tfromWire: (wire) => wire,\n\ttoWire: (value) => stringEncode(MONGO_STRING_CODEC_ID, value),\n\tfromDataTypeValue: (value) => value.value\n});\nconst mongoDoubleCodec = mongoCodec({\n\ttypeId: MONGO_DOUBLE_CODEC_ID,\n\tdataType: mongoDouble,\n\tfromWire: (wire) => Number(wire),\n\ttoWire: (value) => doubleEncode(MONGO_DOUBLE_CODEC_ID, value),\n\ttoDataTypeValue: (value) => mongoDouble.valueFrom(floatToJson(value), {}),\n\tfromDataTypeValue: (value) => readJsonFloat(MONGO_DOUBLE_CODEC_ID, value.value)\n});\nconst mongoInt32Codec = mongoCodec({\n\ttypeId: MONGO_INT32_CODEC_ID,\n\tdataType: mongoInt32,\n\tfromWire: (wire) => wire,\n\ttoWire: (value) => int32Encode(MONGO_INT32_CODEC_ID, value),\n\ttoDataTypeValue: (value) => mongoInt32.valueFrom(int32ToJson(MONGO_INT32_CODEC_ID, value), {}),\n\tfromDataTypeValue: (value) => value.value\n});\nconst mongoBooleanCodec = mongoCodec({\n\ttypeId: MONGO_BOOLEAN_CODEC_ID,\n\tdataType: mongoBool,\n\tfromWire: (wire) => wire,\n\ttoWire: (value) => booleanEncode(MONGO_BOOLEAN_CODEC_ID, value),\n\tfromDataTypeValue: (value) => value.value\n});\nconst mongoDateCodec = mongoCodec({\n\ttypeId: MONGO_DATE_CODEC_ID,\n\tdataType: mongoDate,\n\tfromWire: (wire) => wire,\n\ttoWire: (value) => dateEncode(MONGO_DATE_CODEC_ID, value),\n\ttoDataTypeValue: (value) => mongoDate.valueFrom(dateToJson(MONGO_DATE_CODEC_ID, value), {}),\n\tfromDataTypeValue: (value) => new Date(value.value)\n});\n/** The vector codec for a column of `mongo/vector` with `params`. The dimension reaches only the TypeScript type `Vector<n>`. */\nfunction vectorCodec(params) {\n\treturn mongoCodec({\n\t\ttypeId: MONGO_VECTOR_CODEC_ID,\n\t\tdataType: mongoVector,\n\t\t...ifDefined(\"params\", params),\n\t\tfromWire: (wire) => wire,\n\t\ttoWire: (value) => vectorEncode(MONGO_VECTOR_CODEC_ID, value),\n\t\tfromDataTypeValue: (value) => value.value\n\t});\n}\nconst mongoVectorCodec = vectorCodec();\n/**\n* A BSON `long`. The application value is a `bigint`, because a `number` cannot hold the full 64-bit range; its stored form is decimal text.\n*/\nconst mongoInt64Codec = mongoCodec({\n\ttypeId: MONGO_INT64_CODEC_ID,\n\tdataType: mongoInt64,\n\tfromWire: (wire) => int64Decode(MONGO_INT64_CODEC_ID, wire),\n\ttoWire: (value) => int64Encode(MONGO_INT64_CODEC_ID, value),\n\ttoDataTypeValue: (value) => mongoInt64.valueFrom(int64ToJson(MONGO_INT64_CODEC_ID, value), {}),\n\tfromDataTypeValue: (value) => BigInt(value.value)\n});\n/**\n* A BSON `long` read and written as a `number` from -(2^53 - 1) to 2^53 - 1, the value a Prisma 6 `Int` presents. A value outside that range, or with a fraction, is refused rather than rounded.\n*/\nconst mongoInt64NumberCodec = mongoCodec({\n\ttypeId: MONGO_INT64_NUMBER_CODEC_ID,\n\tdataType: mongoInt64,\n\tfromWire: (wire) => int64NumberDecode(MONGO_INT64_NUMBER_CODEC_ID, wire),\n\ttoWire: (value) => int64NumberEncode(MONGO_INT64_NUMBER_CODEC_ID, value),\n\ttoDataTypeValue: (value) => mongoInt64.valueFrom(int64NumberToJson(MONGO_INT64_NUMBER_CODEC_ID, value), {}),\n\tfromDataTypeValue: (value) => int64NumberFromDigits(MONGO_INT64_NUMBER_CODEC_ID, value.value)\n});\n/**\n* A BSON `decimal`. The application value and its stored form are the same decimal text, written without an exponent.\n*/\nconst mongoDecimal128Codec = mongoCodec({\n\ttypeId: MONGO_DECIMAL128_CODEC_ID,\n\tdataType: mongoDecimal128,\n\tfromWire: (wire) => decimal128Decode(MONGO_DECIMAL128_CODEC_ID, wire),\n\ttoWire: (value) => decimal128Encode(MONGO_DECIMAL128_CODEC_ID, value),\n\ttoDataTypeValue: (value) => mongoDecimal128.valueFrom(decimal128ToJson(MONGO_DECIMAL128_CODEC_ID, value), {}),\n\tfromDataTypeValue: (value) => value.value\n});\n/**\n* BSON `binData`. The application value is a `Uint8Array`; its stored form is unwrapped base64.\n*/\nconst mongoBinaryCodec = mongoCodec({\n\ttypeId: MONGO_BINARY_CODEC_ID,\n\tdataType: mongoBinary,\n\tfromWire: (wire) => binaryDecode(MONGO_BINARY_CODEC_ID, wire),\n\ttoWire: (value) => binaryEncode(MONGO_BINARY_CODEC_ID, value),\n\ttoDataTypeValue: (value) => mongoBinary.valueFrom(binaryToBase64(value), {}),\n\tfromDataTypeValue: (value) => binaryFromBase64(value.value)\n});\n/**\n* A JSON value, stored as the BSON object, array, string, number, boolean or null it maps to. Encode and decode refuse any other value at any depth, naming its path.\n*/\nconst mongoJsonCodec = mongoCodec({\n\ttypeId: MONGO_JSON_CODEC_ID,\n\tdataType: mongoJson,\n\tfromWire: (wire) => decodeJsonValue(wire),\n\ttoWire: (value) => encodeJsonValue(value)\n});\n/**\n* Any BSON value, passed through unchanged except that decode turns a `DBRef` back into the `{ $ref, $id }` document it was stored as. Encode takes a `BsonInputValue` and decode returns a `BsonValue`. Its stored form is canonical MongoDB Extended JSON v2, written with each number and `Uint8Array` as the BSON type the driver stores, so a round trip keeps the BSON bytes but may return wrapper classes such as `Int32` and `Double`.\n*/\nconst mongoBsonCodec = mongoCodec({\n\ttypeId: MONGO_BSON_CODEC_ID,\n\tdataType: mongoBson,\n\tfromWire: (wire) => decodeBsonValue(wire),\n\ttoWire: (value) => encodeBsonValue(value),\n\ttoDataTypeValue: (value) => mongoBson.valueFrom(bsonToJson(value), {}),\n\tfromDataTypeValue: (value) => readBsonJson(MONGO_BSON_CODEC_ID, value.value)\n});\n/**\n* The canonical set of Mongo wire-type codecs.\n*\n* Single source of truth for both control- and runtime-plane adapter descriptors. Don't duplicate this list — import it.\n*/\nconst mongoStandardCodecs = [\n\tmongoObjectIdCodec,\n\tmongoStringCodec,\n\tmongoDoubleCodec,\n\tmongoInt32Codec,\n\tmongoBooleanCodec,\n\tmongoDateCodec,\n\tmongoVectorCodec,\n\tmongoInt64Codec,\n\tmongoInt64NumberCodec,\n\tmongoDecimal128Codec,\n\tmongoBinaryCodec,\n\tmongoJsonCodec,\n\tmongoBsonCodec\n];\n/**\n* Build a {@link CodecDescriptor} for a Mongo wire-type codec.\n*\n* Wraps an existing {@link MongoCodec} instance into a descriptor whose factory hands out the same shared codec, or, for a codec whose data type has parameters, one built for the column's parameters. Mongo's full migration to descriptor-first authoring is tracked under TML-2324; for now the descriptor view is composed from the existing `mongoCodec()` outputs.\n*/\nfunction descriptorFor(codec, metadata) {\n\treturn {\n\t\tcodecId: codec.id,\n\t\tdataType: codec.dataType.id,\n\t\ttraits: metadata.traits,\n\t\tparamsSchema: blindCast(codec.dataType.params),\n\t\tisParameterized: codec.dataType.params !== void 0,\n\t\tfactory: blindCast((params) => {\n\t\t\tconst built = metadata.withParams === void 0 || params === void 0 ? codec : metadata.withParams(params);\n\t\t\treturn () => built;\n\t\t}),\n\t\t...ifDefined(\"renderValueLiteral\", metadata.renderValueLiteral),\n\t\t...ifDefined(\"keepsWrittenForm\", metadata.keepsWrittenForm)\n\t};\n}\n/**\n* Mongo wire-type codec descriptors. Static metadata such as `traits` lives here (the descriptor shape) — `MongoCodec` itself carries its data type and the four conversion methods (TML-2357).\n*/\nconst mongoCodecDescriptors = [\n\tdescriptorFor(mongoObjectIdCodec, { traits: [\"equality\"] }),\n\tdescriptorFor(mongoStringCodec, {\n\t\ttraits: [\n\t\t\t\"equality\",\n\t\t\t\"order\",\n\t\t\t\"textual\"\n\t\t],\n\t\trenderValueLiteral: renderTsLiteral\n\t}),\n\tdescriptorFor(mongoDoubleCodec, {\n\t\ttraits: [\n\t\t\t\"equality\",\n\t\t\t\"order\",\n\t\t\t\"numeric\"\n\t\t],\n\t\trenderValueLiteral: floatNumberLiteral\n\t}),\n\tdescriptorFor(mongoInt32Codec, {\n\t\ttraits: [\n\t\t\t\"equality\",\n\t\t\t\"order\",\n\t\t\t\"numeric\"\n\t\t],\n\t\trenderValueLiteral: renderTsLiteral\n\t}),\n\tdescriptorFor(mongoBooleanCodec, {\n\t\ttraits: [\"equality\", \"boolean\"],\n\t\trenderValueLiteral: renderTsLiteral\n\t}),\n\tdescriptorFor(mongoDateCodec, { traits: [\"equality\", \"order\"] }),\n\tdescriptorFor(mongoVectorCodec, {\n\t\ttraits: [\"equality\"],\n\t\twithParams: vectorCodec\n\t}),\n\tdescriptorFor(mongoInt64Codec, {\n\t\ttraits: [\n\t\t\t\"equality\",\n\t\t\t\"order\",\n\t\t\t\"numeric\"\n\t\t],\n\t\trenderValueLiteral: decimalTextBigintLiteral\n\t}),\n\tdescriptorFor(mongoInt64NumberCodec, {\n\t\ttraits: [\n\t\t\t\"equality\",\n\t\t\t\"order\",\n\t\t\t\"numeric\"\n\t\t],\n\t\trenderValueLiteral: decimalTextNumberLiteral\n\t}),\n\tdescriptorFor(mongoDecimal128Codec, {\n\t\ttraits: [\n\t\t\t\"equality\",\n\t\t\t\"order\",\n\t\t\t\"numeric\"\n\t\t],\n\t\tkeepsWrittenForm: true\n\t}),\n\tdescriptorFor(mongoBinaryCodec, { traits: [\"equality\"] }),\n\tdescriptorFor(mongoJsonCodec, { traits: [] }),\n\tdescriptorFor(mongoBsonCodec, { traits: [] })\n];\n/**\n* Lookup descriptor metadata by codec id — used by tests and for descriptor-side reads of static metadata.\n*/\nfunction mongoDescriptorById(codecId) {\n\treturn mongoCodecDescriptors.find((d) => d.codecId === codecId);\n}\n/**\n* Build a {@link MongoCodecRegistry} preloaded with the standard Mongo wire-type codecs.\n*\n* Single point of truth for adapter-side codec construction: used by the legacy synchronous `createMongoAdapter()` factory and by the runtime adapter descriptor's `codecs()` getter. Userland code obtains a registry via the framework's execution-stack composition (see `createMongoExecutionContext`) instead of calling this directly.\n*/\nfunction buildStandardCodecRegistry() {\n\tconst registry = newMongoCodecRegistry();\n\tfor (const codec of mongoStandardCodecs) registry.register(codec);\n\treturn registry;\n}\n//#endregion\nexport { mongoStandardCodecs as i, mongoCodecDescriptors as n, mongoDescriptorById as r, buildStandardCodecRegistry as t };\n\n//# sourceMappingURL=codecs-CylyDRI5.mjs.map"],"mappings":";;;;;;;;AAQA,MAAM,mBAAmB;CACxB,UAAU;CACV,YAAY;CACZ,QAAQ;CACR,YAAY;CACZ,WAAW;CACX,YAAY;CACZ,MAAM;CACN,QAAQ;CACR,QAAQ;AACT;AACA,MAAM,iBAAiB;AACvB,MAAM,WAAW;AACjB,MAAM,kBAAkB;AACxB,MAAM,yBAAyB;CAC9B,MAAM;CACN,QAAQ;CACR,KAAK;CACL,UAAU;CACV,aAAa;CACb,WAAW;CACX,YAAY;CACZ,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,MAAM;CACN,YAAY;CACZ,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,YAAY;CACZ,QAAQ;CACR,UAAU;CACV,sBAA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ACD,cAAc,gBAAgB,EAAE,QAAQ,CAAC,YAAY,OAAO,EAAE,CAAC;CAC/D,cAAc,kBAAkB;EAC/B,QAAQ,CAAC,UAAU;EACnB,YAAY;CACb,CAAC;CACD,cAAc,iBAAiB;EAC9B,QAAQ;GACP;GACA;GACA;EACD;EACA,oBAAoB;CACrB,CAAC;CACD,cAAc,uBAAuB;EACpC,QAAQ;GACP;GACA;GACA;EACD;EACA,oBAAoB;CACrB,CAAC;CACD,cAAc,sBAAsB;EACnC,QAAQ;GACP;GACA;GACA;EACD;EACA,kBAAkB;CACnB,CAAC;CACD,cAAc,kBAAkB,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC;CACxD,cAAc,gBAAgB,EAAE,QAAQ,CAAC,EAAE,CAAC;CAC5C,cAAc,gBAAgB,EAAE,QAAQ,CAAC,EAAE,CAAC;AAC7C;;;;AAIA,SAAS,oBAAoB,SAAS;CACrC,OAAO,sBAAsB,MAAM,MAAM,EAAE,YAAY,OAAO;AAC/D;;;;;;AAMA,SAAS,6BAA6B;CACrC,MAAM,WAAW,sBAAsB;CACvC,KAAK,MAAM,SAAS,qBAAqB,SAAS,SAAS,KAAK;CAChE,OAAO;AACR"}
@@ -1,14 +1,15 @@
1
1
  import { c as RenameCollectionCall, l as RenameFieldCall, s as OpFactoryCall$1, u as UnsetFieldCall } from "./op-factory-call-BoYr7vvM-PXfT4zvm.mjs";
2
+ import "@prisma/orm-framework/utils/structured-error";
2
3
  import { Namespace, NamespaceBase } from "@prisma/orm-framework/components/ir";
3
4
  import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
4
5
  import { MongoSchemaIR } from "@prisma/orm-family-mongo/schema-ir";
5
6
  import { AnyMongoMigrationOperation, MongoAndExpr, MongoExistsExpr, MongoExprFilter, MongoFieldFilter, MongoFilterExpr, MongoFilterVisitor, MongoNotExpr, MongoOrExpr } from "@prisma/orm-family-mongo/query-ast/control";
6
7
  import { MongoControlTargetDescriptor } from "@prisma/orm-family-mongo/family/control";
8
+ import { MigrationOperationPolicy, MigrationPlan, MigrationPlanOperation, MigrationPlanWithAuthoringSurface, MigrationPlanner, MigrationPlannerConflict, MigrationPlannerResult, MigrationRunnerExecutionChecks, MigrationRunnerFailure, MigrationRunnerPerSpaceSuccessValue, MigrationScaffoldContext, OperationContext, PlanOrigin, ResolvedMigrationStatement, SchemaDiffIssue, SchemaVerifyOptions, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
7
9
  import { Result } from "@prisma/orm-framework/utils/result";
8
10
  import { MongoContractSerializerBase, MongoSchemaVerifierBase } from "@prisma/orm-family-mongo/family/ir";
9
11
  import { MongoCollection, MongoCollectionInput, MongoContract, MongoNamespaceEntries, MongoStorage, MongoValueSetInput } from "@prisma/orm-family-mongo/contract";
10
12
  import { Contract } from "@prisma/orm-framework/contract/types";
11
- import { MigrationOperationPolicy, MigrationPlan, MigrationPlanOperation, MigrationPlanWithAuthoringSurface, MigrationPlanner, MigrationPlannerConflict, MigrationPlannerResult, MigrationRunnerExecutionChecks, MigrationRunnerFailure, MigrationRunnerPerSpaceSuccessValue, MigrationScaffoldContext, OperationContext, PlanOrigin, ResolvedMigrationStatement, SchemaDiffIssue, SchemaVerifyOptions, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
12
13
  import { Migration, MigrationMeta } from "@prisma/orm-toolchain/migration-tools/migration";
13
14
  import { ImportSpecifierResolver } from "@prisma/orm-framework/components/emission";
14
15
  import { MongoRunnerDependencies } from "@prisma/orm-family-mongo/family/control-adapter";
@@ -125,6 +126,10 @@ declare class MongoMigrationPlanner implements MigrationPlanner<'mongo', 'mongo'
125
126
  emptyMigration(context: MigrationScaffoldContext): MigrationPlanWithAuthoringSurface;
126
127
  }
127
128
  //#endregion
129
+ //#region src/core/mongo-target-errors.d.ts
130
+ /** The codes the Mongo migration runner returns a failure with. */
131
+ type MongoMigrationRunnerErrorCode = 'MIGRATION.EXECUTION_FAILED' | 'MIGRATION.MARKER_CAS_FAILURE' | 'MIGRATION.MARKER_ORIGIN_MISMATCH' | 'MIGRATION.POLICY_VIOLATION' | 'MIGRATION.POSTCHECK_FAILED' | 'MIGRATION.PRECHECK_FAILED' | 'MIGRATION.SCHEMA_VERIFY_FAILED';
132
+ //#endregion
128
133
  //#region src/core/migrations/mongo-runner.d.ts
129
134
  interface MongoMigrationRunnerExecuteOptions {
130
135
  readonly plan: MigrationPlan;
@@ -152,7 +157,11 @@ interface MongoMigrationRunnerExecuteOptions {
152
157
  /** Per-edge breakdown from graph-walk planning; drives per-edge ledger writes. */
153
158
  readonly migrationEdges: readonly AggregateMigrationEdgeRef[];
154
159
  }
155
- type MongoMigrationRunnerResult = Result<MigrationRunnerPerSpaceSuccessValue, MigrationRunnerFailure>;
160
+ /** A failure of the Mongo runner: one of the codes it returns. */
161
+ interface MongoMigrationRunnerFailure extends MigrationRunnerFailure {
162
+ readonly code: MongoMigrationRunnerErrorCode;
163
+ }
164
+ type MongoMigrationRunnerResult = Result<MigrationRunnerPerSpaceSuccessValue, MongoMigrationRunnerFailure>;
156
165
  declare class MongoMigrationRunner {
157
166
  private readonly deps;
158
167
  constructor(deps: MongoRunnerDependencies);
@@ -329,5 +338,5 @@ declare class MongoTargetUnboundDatabase extends MongoTargetDatabase {
329
338
  qualifyCollection(collectionName: string): string;
330
339
  }
331
340
  //#endregion
332
- export { renderOps as _, MongoTargetContract as a, MongoTargetSchemaVerifier as c, PlannerProducedMongoMigration as d, RenderMigrationMeta as f, renderCallsToTypeScript as g, mongoTargetDescriptor as h, MongoMigrationRunnerExecuteOptions as i, MongoTargetUnboundDatabase as l, deserializeMongoOps as m, MongoMigrationPlanner as n, MongoTargetContractSerializer as o, deserializeMongoOp as p, MongoMigrationRunner as r, MongoTargetDatabase as s, FilterEvaluator as t, PlanCallsResult as u, serializeMongoOps as v };
333
- //# sourceMappingURL=control-DpeYOTlN.d.mts.map
341
+ export { deserializeMongoOps as _, MongoMigrationRunnerExecuteOptions as a, renderOps as b, MongoTargetContract as c, MongoTargetSchemaVerifier as d, MongoTargetUnboundDatabase as f, deserializeMongoOp as g, RenderMigrationMeta as h, MongoMigrationRunnerErrorCode as i, MongoTargetContractSerializer as l, PlannerProducedMongoMigration as m, MongoMigrationPlanner as n, MongoMigrationRunnerFailure as o, PlanCallsResult as p, MongoMigrationRunner as r, MongoMigrationRunnerResult as s, FilterEvaluator as t, MongoTargetDatabase as u, mongoTargetDescriptor as v, serializeMongoOps as x, renderCallsToTypeScript as y };
342
+ //# sourceMappingURL=control-Poy33Wpm.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-Poy33Wpm.d.mts","names":[],"sources":["../../../../3-mongo-target/1-mongo-target/dist/control.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6BK,sBAAsB,KAAK;WACrB,SAAS;;;;;;;;;;;;;;cAcN,uBAAuB,6BAA6B;;;cAGpD,2BAA2B;UAC/B;EACR,SAAS,QAAQ,iBAAiB,KAAK;EACvC,MAAM,MAAM;EACZ,IAAI,MAAM;EACV,GAAG,MAAM;EACT,IAAI,MAAM;EACV,OAAO,MAAM;EACb,KAAK,OAAO;;;;iBAIG,mBAAmB,gBAAgB;iBACnC,oBAAoB,2BAA2B;iBAC/C,kBAAkB,cAAc;;;;;;;;UAQvC;WACC,QAAQ;;WAER,4BAA4B;;WAE5B,oBAAoB,kBAAkB;;;;KAI5C;WACM;WACA,OAAO;;WAEP,mBAAmB;;WAEnB;WACA,WAAW;;cAER,iCAAiC;EAC7C,UAAU;aACC;aACA;aACA,QAAQ;aACR,qBAAqB,cAAc;;aAEnC,cAAc;;aAEd,iBAAiB;MACxB;EACJ,KAAK;aACM;aACA;aACA,QAAQ;;aAER,cAAc;;aAEd,QAAQ;;aAER,qBAAqB;aACrB,qBAAqB,cAAc;;;;;;aAMnC;MACP;;;;;;;;;;EAUJ,eAAe,SAAS,2BAA2B;;;;;KAKhD;;;UAGK;WACC,MAAM;WACN,qBAAqB;WACrB,QAAQ;WACR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ongo-target-errors-Btf3ML1w-B5EMYbz1.mjs";
2
- import { t as mongoTargetDescriptorMeta } from "./descriptor-meta-BQBreSNF-CZ9uOPwO.mjs";
2
+ import { t as mongoTargetDescriptorMeta } from "./descriptor-meta-DdeUSTJk-zJzD7C-n.mjs";
3
3
  import { a as dropCollection, c as renameField, d as unsetField, n as createCollection, o as dropIndex, r as createIndex, s as renameCollection, t as collMod, u as unrewritableFieldNameReason } from "./migration-factories-jwrORVMV-BGqJk_WT.mjs";
4
4
  import { blindCast } from "@prisma/orm-framework/utils/casts";
5
5
  import { type } from "arktype";
@@ -9,18 +9,17 @@ import { MongoSchemaCollection, MongoSchemaIR, canonicalize, deepEqual, indexLoo
9
9
  import { CollModCommand, CreateCollectionCommand, CreateIndexCommand, DropCollectionCommand, DropIndexCommand, ListCollectionsCommand, ListIndexesCommand, MongoAndExpr, MongoExistsExpr, MongoFieldFilter, MongoNotExpr, MongoOrExpr, RenameCollectionCommand, isMongoDmlOperation } from "@prisma/orm-family-mongo/query-ast/control";
10
10
  import { AggregateCommand, MongoAddFieldsStage, MongoLimitStage, MongoLookupStage, MongoMatchStage, MongoMergeStage, MongoProjectStage, MongoSortStage, RawAggregateCommand, RawDeleteManyCommand, RawDeleteOneCommand, RawFindOneAndDeleteCommand, RawFindOneAndUpdateCommand, RawInsertManyCommand, RawInsertOneCommand, RawUpdateManyCommand, RawUpdateOneCommand } from "@prisma/orm-family-mongo/query-ast/execution";
11
11
  import { canonicalizeSchemasForVerification, contractToMongoSchemaIR, diffMongoSchemas, fieldRewriteOf } from "@prisma/orm-family-mongo/family/control";
12
+ import { APP_SPACE_ID, VERIFY_CODE_SCHEMA_FAILURE, contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier, describeMigrationStatement, failedPrecheckWhy, issueOutcome, migrationRunnerFailure, modelDisplayName, schemaCheckWhy, withFailingSpace } from "@prisma/orm-framework/components/control";
12
13
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
13
14
  import { MongoContractSerializerBase, MongoSchemaVerifierBase } from "@prisma/orm-family-mongo/family/ir";
14
15
  import { MongoCollection, MongoStorage, collectionControlPoliciesOf, collectionControlPolicyOf, collectionRootModelsOf, hasOwnFieldStoredAs, modelAndBasesOf, mongoModelsOf, ownEmbedStoredNamesOf, ownStoredNameOf, ownStoredNamesOf, validatorFieldNamesOf, validatorRootShapesOf } from "@prisma/orm-family-mongo/contract";
15
16
  import { composeMongoEntityKinds } from "@prisma/orm-family-mongo/contract/entity-kinds";
16
17
  import { asNamespaceId, governingControlPolicy } from "@prisma/orm-framework/contract/types";
17
- import { APP_SPACE_ID, VERIFY_CODE_SCHEMA_FAILURE, contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier, describeMigrationStatement, issueOutcome, modelDisplayName } from "@prisma/orm-framework/components/control";
18
18
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
19
19
  import { TsExpression, jsonToTsSource, renderImports } from "@prisma/orm-framework/ts-render";
20
20
  import { Migration } from "@prisma/orm-toolchain/migration-tools/migration";
21
21
  import { resolveRequirementSpecifiers } from "@prisma/orm-framework/components/emission";
22
22
  import { detectScaffoldRuntime, shebangLineFor } from "@prisma/orm-toolchain/migration-tools/migration-ts";
23
- import { errorRunnerFailed } from "@prisma/orm-framework/errors/execution";
24
23
  import { verifyMongoSchema } from "@prisma/orm-family-mongo/family/schema-verify";
25
24
  //#region ../../../3-mongo-target/1-mongo-target/dist/control.mjs
26
25
  /**
@@ -1951,12 +1950,8 @@ function serializeMongoOps(ops) {
1951
1950
  return JSON.stringify(ops, null, 2);
1952
1951
  }
1953
1952
  const READ_ONLY_CHECK_COMMAND_KINDS = /* @__PURE__ */ new Set(["aggregate", "rawAggregate"]);
1954
- function runnerFailure(code, summary, opts) {
1955
- return notOk({
1956
- code,
1957
- summary,
1958
- ...opts
1959
- });
1953
+ function runnerFailure(code, summary, options) {
1954
+ return notOk(migrationRunnerFailure(code, summary, options));
1960
1955
  }
1961
1956
  /**
1962
1957
  * The failure when a field rename's before-check finds documents that already hold the new name,
@@ -2045,18 +2040,17 @@ var MongoMigrationRunner = class {
2045
2040
  }
2046
2041
  if (runPrechecks) {
2047
2042
  const failed = await this.firstFailingCheck(operation.precheck, inspectionExecutor, filterEvaluator);
2048
- if (failed !== void 0) return renameTargetExistsRefusal(operation, failed) ?? runnerFailure("MIGRATION.PRECHECK_FAILED", `Operation ${operation.id} failed during precheck: ${failed.description}`, {
2049
- meta: {
2050
- operationId: operation.id,
2051
- phase: "precheck",
2052
- stepDescription: failed.description
2053
- },
2054
- failedCheck: {
2043
+ if (failed !== void 0) {
2044
+ const failedCheck = {
2055
2045
  operationId: operation.id,
2056
2046
  phase: "precheck",
2057
2047
  description: failed.description
2058
- }
2059
- });
2048
+ };
2049
+ return renameTargetExistsRefusal(operation, failed) ?? runnerFailure("MIGRATION.PRECHECK_FAILED", `Operation ${operation.id} failed during precheck: ${failed.description}`, {
2050
+ why: failedPrecheckWhy(failedCheck),
2051
+ meta: { failedCheck }
2052
+ });
2053
+ }
2060
2054
  }
2061
2055
  for (const step of operation.execute) await executeDdl(step.command);
2062
2056
  if (runPostchecks) {
@@ -2084,9 +2078,8 @@ var MongoMigrationRunner = class {
2084
2078
  });
2085
2079
  const verifyResult = options.scopeVerifyResult ? options.scopeVerifyResult(rawVerifyResult) : rawVerifyResult;
2086
2080
  if (!verifyResult.ok) return runnerFailure("MIGRATION.SCHEMA_VERIFY_FAILED", verifyResult.summary, {
2087
- why: "The resulting database schema does not satisfy the destination contract.",
2088
- meta: { issues: verifyResult.schema.issues },
2089
- schemaIssues: verifyResult.schema.issues
2081
+ why: schemaCheckWhy(verifyResult.schema.issues),
2082
+ meta: { schemaIssues: verifyResult.schema.issues }
2090
2083
  });
2091
2084
  if (existingMarker) {
2092
2085
  if (!await markerOps.updateMarker(space, existingMarker.storageHash, {
@@ -2173,7 +2166,7 @@ var MongoMigrationRunner = class {
2173
2166
  async evaluateDmlChecks(checks, adapter, driver, filterEvaluator) {
2174
2167
  for (const check of checks) {
2175
2168
  const commandKind = check.source.command.kind;
2176
- if (!READ_ONLY_CHECK_COMMAND_KINDS.has(commandKind)) throw errorRunnerFailed(`Data-transform check rejected: command kind "${commandKind}" is not read-only`, {
2169
+ if (!READ_ONLY_CHECK_COMMAND_KINDS.has(commandKind)) throw mongoTargetError("MIGRATION.DATA_TRANSFORM_CHECK_NOT_READ_ONLY", `Data-transform check rejected: command kind "${commandKind}" is not read-only`, {
2177
2170
  why: "Data-transform checks must use aggregate or rawAggregate commands so the pre/postcheck path cannot mutate the database.",
2178
2171
  fix: "Author the check.source as an aggregate pipeline (or rawAggregate) rather than a DML write command.",
2179
2172
  meta: {
@@ -2348,10 +2341,7 @@ const mongoTargetDescriptor = {
2348
2341
  ...runnerOptions,
2349
2342
  scopeVerifyResult
2350
2343
  });
2351
- if (!result.ok) return notOk({
2352
- ...result.failure,
2353
- failingSpace: space
2354
- });
2344
+ if (!result.ok) return notOk(withFailingSpace(result.failure, space));
2355
2345
  perSpaceResults.push({
2356
2346
  space,
2357
2347
  value: result.value
@@ -2374,4 +2364,4 @@ const mongoTargetDescriptor = {
2374
2364
  //#endregion
2375
2365
  export { schemaIndexToCreateIndexOptions as C, schemaCollectionToCreateCollectionOptions as S, deserializeMongoOp as _, DropIndexCall as a, renderCallsToTypeScript as b, MongoMigrationRunner as c, MongoTargetSchemaVerifier as d, MongoTargetUnboundDatabase as f, UnsetFieldCall as g, RenameFieldCall as h, DropCollectionCall as i, MongoTargetContractSerializer as l, RenameCollectionCall as m, CreateCollectionCall as n, FilterEvaluator as o, PlannerProducedMongoMigration as p, CreateIndexCall as r, MongoMigrationPlanner as s, CollModCall as t, MongoTargetDatabase as u, deserializeMongoOps as v, serializeMongoOps as w, renderOps as x, mongoTargetDescriptor as y };
2376
2366
 
2377
- //# sourceMappingURL=control-CfztdRLD.mjs.map
2367
+ //# sourceMappingURL=control-r-qY2RS-.mjs.map