@prisma/orm-target-mongo 8.0.0-rc.23-dev.13 → 8.0.0-rc.24-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/adapter.mjs +1 -1
  2. package/dist/adapter__control.mjs +1 -1
  3. package/dist/adapter__runtime.mjs +2 -2
  4. package/dist/{codecs-BbX2VMzN-Dm9db3Jz.mjs → codecs-Bl21z49D-Bj5erX9r.mjs} +3 -3
  5. package/dist/{codecs-BbX2VMzN-Dm9db3Jz.mjs.map → codecs-Bl21z49D-Bj5erX9r.mjs.map} +1 -1
  6. package/dist/{control-B77seMDK.mjs → control-BxslS3_F.mjs} +1452 -154
  7. package/dist/control-BxslS3_F.mjs.map +1 -0
  8. package/dist/{control-AjuXfVKk.mjs → control-D_uldvl5.mjs} +2 -2
  9. package/dist/{control-AjuXfVKk.mjs.map → control-D_uldvl5.mjs.map} +1 -1
  10. package/dist/{control-1-RnMe4V.d.mts → control-OiC131Dv.d.mts} +35 -5
  11. package/dist/control-OiC131Dv.d.mts.map +1 -0
  12. package/dist/{data-types-Cq1kg82y-Vk7z6rnW.mjs → data-types-B3SLjbqa-C1LmrfzH.mjs} +29 -5
  13. package/dist/{data-types-Cq1kg82y-Vk7z6rnW.mjs.map → data-types-B3SLjbqa-C1LmrfzH.mjs.map} +1 -1
  14. package/dist/{date-time-now-generators-fWUk_--7-BnCnC0d8.mjs → date-time-now-generators-Dhq1b2V8-TgMEfnbI.mjs} +3 -3
  15. package/dist/{date-time-now-generators-fWUk_--7-BnCnC0d8.mjs.map → date-time-now-generators-Dhq1b2V8-TgMEfnbI.mjs.map} +1 -1
  16. package/dist/{descriptor-meta-CFsOxO6g-Ca8valmZ.mjs → descriptor-meta-BXMz_uZd-B8WB2m7v.mjs} +5 -5
  17. package/dist/{descriptor-meta-CFsOxO6g-Ca8valmZ.mjs.map → descriptor-meta-BXMz_uZd-B8WB2m7v.mjs.map} +1 -1
  18. package/dist/{descriptor-meta-runtime-CBJIjp5R-DMQ9-3Hd.mjs → descriptor-meta-runtime-J4eVdBtZ-D1yRng4t.mjs} +4 -4
  19. package/dist/{descriptor-meta-runtime-CBJIjp5R-DMQ9-3Hd.mjs.map → descriptor-meta-runtime-J4eVdBtZ-D1yRng4t.mjs.map} +1 -1
  20. package/dist/driver.mjs +1 -1
  21. package/dist/driver__control.mjs +1 -1
  22. package/dist/driver__runtime.mjs +1 -1
  23. package/dist/driver__runtime.mjs.map +1 -1
  24. package/dist/migration-DASk9QNA.d.mts +5 -0
  25. package/dist/{migration-factories-oLRWgLGz-B9fWm8Wc.mjs → migration-factories-C5ktmt8c-BP8k9SnZ.mjs} +245 -17
  26. package/dist/migration-factories-C5ktmt8c-BP8k9SnZ.mjs.map +1 -0
  27. package/dist/{mongo-adapter-RJ_YOxiK-jlyFS6Wr.mjs → mongo-adapter-RJ_YOxiK-CCHpxwqy.mjs} +2 -2
  28. package/dist/{mongo-adapter-RJ_YOxiK-jlyFS6Wr.mjs.map → mongo-adapter-RJ_YOxiK-CCHpxwqy.mjs.map} +1 -1
  29. package/dist/{mongo-driver-Dtca4OAu-Cy1Lh7xi.mjs → mongo-driver-Ci-03XE3-kphfDDR4.mjs} +3 -3
  30. package/dist/mongo-driver-Ci-03XE3-kphfDDR4.mjs.map +1 -0
  31. package/dist/op-factory-call-BCgwbVJe-DhcJRxAb.d.mts +248 -0
  32. package/dist/op-factory-call-BCgwbVJe-DhcJRxAb.d.mts.map +1 -0
  33. package/dist/{prisma6-binding-BjKPGVql.mjs → prisma6-binding-BXi_1e8c.mjs} +2 -2
  34. package/dist/{prisma6-binding-BjKPGVql.mjs.map → prisma6-binding-BXi_1e8c.mjs.map} +1 -1
  35. package/dist/{runtime-DyWNR1FZ.mjs → runtime-CkX-HAf5.mjs} +2 -2
  36. package/dist/{runtime-DyWNR1FZ.mjs.map → runtime-CkX-HAf5.mjs.map} +1 -1
  37. package/dist/target.d.mts +4 -4
  38. package/dist/target.mjs +8 -8
  39. package/dist/target__codecs.mjs +1 -1
  40. package/dist/target__control.d.mts +2 -2
  41. package/dist/target__control.mjs +1 -1
  42. package/dist/target__data-types.mjs +1 -1
  43. package/dist/target__migration.d.mts +3 -2
  44. package/dist/target__migration.mjs +3 -3
  45. package/dist/target__pack.mjs +1 -1
  46. package/dist/target__pack.mjs.map +1 -1
  47. package/dist/target__prisma6-binding.mjs +1 -1
  48. package/dist/target__runtime.mjs +2 -2
  49. package/package.json +10 -10
  50. package/dist/control-1-RnMe4V.d.mts.map +0 -1
  51. package/dist/control-B77seMDK.mjs.map +0 -1
  52. package/dist/migration-BMUh33vn.d.mts +0 -56
  53. package/dist/migration-BMUh33vn.d.mts.map +0 -1
  54. package/dist/migration-factories-oLRWgLGz-B9fWm8Wc.mjs.map +0 -1
  55. package/dist/mongo-driver-Dtca4OAu-Cy1Lh7xi.mjs.map +0 -1
  56. package/dist/op-factory-call-DzQ_ZxeZ-CukKyuhZ.d.mts +0 -115
  57. package/dist/op-factory-call-DzQ_ZxeZ-CukKyuhZ.d.mts.map +0 -1
  58. package/dist/{migration-C-jfTsGU.mjs → migration-psmPNv10.mjs} +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"descriptor-meta-CFsOxO6g-Ca8valmZ.mjs","names":[],"sources":["../../../../3-targets/mongo/1-target/dist/descriptor-meta-CFsOxO6g.mjs"],"sourcesContent":["import { _ as MONGO_STRING_CODEC_ID, a as MONGO_DATE_INSTANT_CODEC_ID, b as MONGO_VECTOR_CODEC_ID, c as MONGO_DATE_TEMPORAL_CODEC_ID, d as MONGO_DURATION_STRING_CODEC_ID, f as MONGO_INT32_CODEC_ID, g as MONGO_OBJECTID_CODEC_ID, h as MONGO_JSON_CODEC_ID, i as MONGO_DATE_CODEC_ID, l as MONGO_DECIMAL128_CODEC_ID, m as MONGO_INT64_NUMBER_CODEC_ID, n as MONGO_BOOLEAN_CODEC_ID, o as MONGO_DATE_INSTANT_STRING_CODEC_ID, p as MONGO_INT64_CODEC_ID, r as MONGO_BSON_CODEC_ID, s as MONGO_DATE_STRING_CODEC_ID, t as MONGO_BINARY_CODEC_ID, u as MONGO_DOUBLE_CODEC_ID, v as MONGO_TIME_STRING_CODEC_ID, y as MONGO_TIME_TEMPORAL_CODEC_ID } from \"./codec-ids-DZQsuh80.mjs\";\nimport { W as decimal128HoldsExactly, _ as mongoString, b as mongoTimeText, c as mongoDecimal128, d as mongoDurationText, h as mongoJson, l as mongoDouble, m as mongoInt64, n as mongoBool, nt as isBase64Text, p as mongoInt32, s as mongoDate, t as mongoBinary, u as mongoDuration, v as mongoTextDataTypes, y as mongoTime } from \"./data-types-Cq1kg82y.mjs\";\nimport { n as mongoNowGenerators, t as mongoNowGeneratorIds } from \"./date-time-now-generators-fWUk_--7.mjs\";\nimport { t as mongoTargetDescriptorMetaRuntime } from \"./descriptor-meta-runtime-CBJIjp5R.mjs\";\nimport { TIMESTAMP_NOW_GENERATOR_ID, temporalTypeAliases } from \"@internal/framework-components/authoring\";\nimport { singleGeneratorBinding } from \"@internal/framework-components/components\";\nimport { createNumberClassifier, isoDateStringText, numeralText, parseJsonText, printJsonText, signedRange } from \"@internal/framework-components/codec\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/core/authoring.ts\n/**\n* The MongoDB scalar types as type constructors, which PSL writes as field types and the TypeScript builder calls as `type.X()`. Each names a codec; the collection validator reads the BSON types from the data type the codec represents, not from the constructor.\n*/\nconst mongoScalarAuthoringTypes = {\n\tString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Text, stored as BSON string.\",\n\t\toutput: { codecId: MONGO_STRING_CODEC_ID }\n\t},\n\tInt32: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A signed 32-bit integer, stored as BSON int.\",\n\t\toutput: { codecId: MONGO_INT32_CODEC_ID }\n\t},\n\tBool: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A true or false value, stored as BSON bool.\",\n\t\toutput: { codecId: MONGO_BOOLEAN_CODEC_ID }\n\t},\n\tObjectId: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A 12-byte MongoDB identifier, stored as BSON objectId.\",\n\t\toutput: { codecId: MONGO_OBJECTID_CODEC_ID }\n\t},\n\tDouble: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A double-precision floating-point number, stored as BSON double.\",\n\t\toutput: { codecId: MONGO_DOUBLE_CODEC_ID }\n\t},\n\tInt64: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A signed 64-bit integer read as a bigint, stored as BSON long.\",\n\t\toutput: { codecId: MONGO_INT64_CODEC_ID }\n\t},\n\tInt64Number: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A signed 64-bit integer read as a JavaScript number within its safe integer range, stored as BSON long.\",\n\t\toutput: { codecId: MONGO_INT64_NUMBER_CODEC_ID }\n\t},\n\tDecimal128: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A 128-bit decimal read as decimal text without an exponent, stored as BSON decimal.\",\n\t\toutput: { codecId: MONGO_DECIMAL128_CODEC_ID }\n\t},\n\tBinary: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Bytes read as a Uint8Array, stored as BSON binData.\",\n\t\toutput: { codecId: MONGO_BINARY_CODEC_ID }\n\t},\n\tJson: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A JSON value, stored as BSON object, array, string, double, int, long, bool or null; the collection validator admits only those types at the top level, and the codec refuses anything else at any depth.\",\n\t\toutput: { codecId: MONGO_JSON_CODEC_ID }\n\t},\n\tBson: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Any BSON value, read as BsonValue; the collection validator does not constrain it.\",\n\t\toutput: { codecId: MONGO_BSON_CODEC_ID }\n\t},\n\tVector: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A list of finite numbers, stored as BSON array, as a vector search index reads it. With a length, it is read as Vector<length>.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: \"mongo/int32\",\n\t\t\tname: \"length\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: MONGO_VECTOR_CODEC_ID,\n\t\t\ttypeParams: { length: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tInt: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Deprecated: use Int32. A signed 32-bit integer, stored as BSON int.\",\n\t\toutput: { codecId: MONGO_INT32_CODEC_ID },\n\t\tdeprecated: { replacement: \"Int32\" }\n\t},\n\tFloat: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Deprecated: use Double. A double-precision floating-point number, stored as BSON double.\",\n\t\toutput: { codecId: MONGO_DOUBLE_CODEC_ID },\n\t\tdeprecated: { replacement: \"Double\" }\n\t},\n\tBoolean: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Deprecated: use Bool. A true or false value, stored as BSON bool.\",\n\t\toutput: { codecId: MONGO_BOOLEAN_CODEC_ID },\n\t\tdeprecated: { replacement: \"Bool\" }\n\t}\n};\n/**\n* The explicit date and time types. Each name says what the field stores and what the application reads. ADR 315.\n*/\nconst mongoDateTimeTypeConstructors = {\n\tDateJsDate: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An instant with millisecond precision, stored as BSON date and represented as a JavaScript Date.\",\n\t\toutput: { codecId: MONGO_DATE_CODEC_ID }\n\t},\n\tDateInstant: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An instant with millisecond precision, stored as BSON date and represented as Temporal.Instant.\",\n\t\toutput: { codecId: MONGO_DATE_INSTANT_CODEC_ID }\n\t},\n\tDateInstantString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An instant with millisecond precision, stored as BSON date and represented as ISO 8601 text in UTC with three fraction digits, 2024-01-01T00:00:00.000Z.\",\n\t\toutput: { codecId: MONGO_DATE_INSTANT_STRING_CODEC_ID }\n\t},\n\tDateString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A calendar date, stored as BSON date at midnight UTC and represented as ISO 8601 text, 2024-02-29.\",\n\t\toutput: { codecId: MONGO_DATE_STRING_CODEC_ID }\n\t},\n\tDateTemporal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A calendar date, stored as BSON date at midnight UTC and represented as Temporal.PlainDate.\",\n\t\toutput: { codecId: MONGO_DATE_TEMPORAL_CODEC_ID }\n\t},\n\tTimeString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A time of day, stored as BSON string and represented as that string, 09:30:00.000, always with three fraction digits.\",\n\t\toutput: { codecId: MONGO_TIME_STRING_CODEC_ID }\n\t},\n\tTimeTemporal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A time of day, stored as BSON string, 09:30:00.000, and represented as Temporal.PlainTime.\",\n\t\toutput: { codecId: MONGO_TIME_TEMPORAL_CODEC_ID }\n\t},\n\tDurationString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A length of time, stored as BSON string and represented as the ISO 8601 duration it was written as, such as PT1H30M.\",\n\t\toutput: { codecId: MONGO_DURATION_STRING_CODEC_ID }\n\t}\n};\nconst dateStorage = {\n\tkind: \"option\",\n\tname: \"storage\",\n\tvalues: [\"date\"],\n\tdefault: \"date\",\n\toptional: true\n};\nconst stringStorage = {\n\tkind: \"option\",\n\tname: \"storage\",\n\tvalues: [\"string\"],\n\tdefault: \"string\",\n\toptional: true\n};\n/**\n* The convenience date and time types. Each is a type choice: its `as` argument chooses the explicit type it becomes. ADR 279, ADR 315.\n*/\nconst mongoConvenienceDateTimeTypes = {\n\tDateTime: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A moment in time, stored as BSON date. `as` is what the application reads: jsDate (a JavaScript Date), temporal (Temporal.Instant) or string, such as \\\"2024-01-01T00:00:00.000Z\\\".\",\n\t\targs: [{\n\t\t\tkind: \"option\",\n\t\t\tname: \"as\",\n\t\t\tvalues: [\n\t\t\t\t\"jsDate\",\n\t\t\t\t\"temporal\",\n\t\t\t\t\"string\"\n\t\t\t],\n\t\t\tdefault: \"jsDate\",\n\t\t\toptional: true\n\t\t}, dateStorage],\n\t\tchoices: [\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"jsDate\",\n\t\t\t\t\tstorage: \"date\"\n\t\t\t\t},\n\t\t\t\ttype: \"DateJsDate\"\n\t\t\t},\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"temporal\",\n\t\t\t\t\tstorage: \"date\"\n\t\t\t\t},\n\t\t\t\ttype: \"DateInstant\"\n\t\t\t},\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"string\",\n\t\t\t\t\tstorage: \"date\"\n\t\t\t\t},\n\t\t\t\ttype: \"DateInstantString\"\n\t\t\t}\n\t\t]\n\t},\n\tDate: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A calendar date, stored as BSON date at midnight UTC. `as` is what the application reads: string, such as \\\"2024-02-29\\\", or temporal (Temporal.PlainDate).\",\n\t\targs: [{\n\t\t\tkind: \"option\",\n\t\t\tname: \"as\",\n\t\t\tvalues: [\"string\", \"temporal\"],\n\t\t\tdefault: \"string\",\n\t\t\toptional: true\n\t\t}, dateStorage],\n\t\tchoices: [{\n\t\t\twhen: {\n\t\t\t\tas: \"string\",\n\t\t\t\tstorage: \"date\"\n\t\t\t},\n\t\t\ttype: \"DateString\"\n\t\t}, {\n\t\t\twhen: {\n\t\t\t\tas: \"temporal\",\n\t\t\t\tstorage: \"date\"\n\t\t\t},\n\t\t\ttype: \"DateTemporal\"\n\t\t}]\n\t},\n\tTime: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A time of day, stored as BSON string. `as` is what the application reads: string, such as \\\"09:30:00.000\\\", or temporal (Temporal.PlainTime).\",\n\t\targs: [{\n\t\t\tkind: \"option\",\n\t\t\tname: \"as\",\n\t\t\tvalues: [\"string\", \"temporal\"],\n\t\t\tdefault: \"string\",\n\t\t\toptional: true\n\t\t}, stringStorage],\n\t\tchoices: [{\n\t\t\twhen: {\n\t\t\t\tas: \"string\",\n\t\t\t\tstorage: \"string\"\n\t\t\t},\n\t\t\ttype: \"TimeString\"\n\t\t}, {\n\t\t\twhen: {\n\t\t\t\tas: \"temporal\",\n\t\t\t\tstorage: \"string\"\n\t\t\t},\n\t\t\ttype: \"TimeTemporal\"\n\t\t}]\n\t},\n\tDuration: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A length of time, stored as BSON string. `as` is what the application reads: string, an ISO 8601 duration such as \\\"PT1H30M\\\".\",\n\t\targs: [{\n\t\t\tkind: \"option\",\n\t\t\tname: \"as\",\n\t\t\tvalues: [\"string\"],\n\t\t\tdefault: \"string\",\n\t\t\toptional: true\n\t\t}, stringStorage],\n\t\tchoices: [{\n\t\t\twhen: {\n\t\t\t\tas: \"string\",\n\t\t\t\tstorage: \"string\"\n\t\t\t},\n\t\t\ttype: \"DurationString\"\n\t\t}]\n\t}\n};\nconst mongoAuthoringTypes = {\n\t...mongoScalarAuthoringTypes,\n\t...mongoDateTimeTypeConstructors,\n\t...mongoConvenienceDateTimeTypes,\n\ttemporal: temporalTypeAliases({ codecId: MONGO_DATE_CODEC_ID }, \"a JavaScript Date\")\n};\n//#endregion\n//#region src/core/data-type-entries.ts\nconst classifyAsDecimal = createNumberClassifier({\n\tintegers: [{\n\t\ttype: mongoInt32.id,\n\t\tform: \"number\",\n\t\t...signedRange(32)\n\t}, {\n\t\ttype: mongoInt64.id,\n\t\tform: \"text\",\n\t\t...signedRange(64)\n\t}],\n\tlargerWhole: {\n\t\ttype: mongoDecimal128.id,\n\t\tform: \"text\"\n\t},\n\tfraction: {\n\t\ttype: mongoDecimal128.id,\n\t\tform: \"text\"\n\t},\n\twords: {\n\t\ttype: mongoDecimal128.id,\n\t\tform: \"text\"\n\t}\n});\n/** The type of a written number: a `decimal` only when a Decimal128 holds it exactly, else the `double` nearest it. */\nfunction classifyMongoNumber(text) {\n\tconst classified = classifyAsDecimal(text);\n\tif (classified?.type !== mongoDecimal128.id || decimal128HoldsExactly(String(classified.value))) return classified;\n\tconst double = Number(text);\n\treturn Number.isFinite(double) ? {\n\t\ttype: mongoDouble.id,\n\t\tvalue: double\n\t} : void 0;\n}\nfunction printNumber(value) {\n\treturn typeof value === \"number\" ? numeralText(value) : String(value);\n}\nfunction base64Text(text) {\n\tif (isBase64Text(text)) return text;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `\"${text}\" is not base64 text: write the bytes in base64, as in binary\\`aGVsbG8=\\`.`, {\n\t\twhy: \"The binary tag reads bytes as base64, as MongoDB prints them.\",\n\t\tfix: \"Write the bytes in base64, as in binary`aGVsbG8=`.\"\n\t});\n}\nfunction mongoDataTypeEntries() {\n\treturn {\n\t\t[mongoString.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"plain\",\n\t\t\t\tsyntax: \"string\",\n\t\t\t\tparse: (text) => text\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"Text.\"\n\t\t},\n\t\t[mongoBool.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"plain\",\n\t\t\t\tsyntax: \"boolean\",\n\t\t\t\tparse: (text) => text === \"true\"\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"A boolean, written true or false.\"\n\t\t},\n\t\t[mongoDouble.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"plain\",\n\t\t\t\tsyntax: \"number\",\n\t\t\t\ttypes: [\n\t\t\t\t\tmongoInt32.id,\n\t\t\t\t\tmongoInt64.id,\n\t\t\t\t\tmongoDecimal128.id,\n\t\t\t\t\tmongoDouble.id\n\t\t\t\t],\n\t\t\t\tclassify: classifyMongoNumber\n\t\t\t},\n\t\t\tprint: printNumber,\n\t\t\tdocumentation: \"A number: an int in 32 bits, a long in 64, a decimal when a Decimal128 holds it exactly, NaN and the infinities included, and a double otherwise.\"\n\t\t},\n\t\t[mongoDate.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"tag\",\n\t\t\t\ttag: \"date\",\n\t\t\t\tparse: (text) => isoDateStringText(text, mongoDate.id)\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"An instant, as in date`2024-01-01T00:00:00Z`. Reads ISO 8601 with a UTC offset and stores the instant in UTC with three fraction digits, as Date.toISOString() writes it.\"\n\t\t},\n\t\t[mongoTime.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"tag\",\n\t\t\t\ttag: \"time\",\n\t\t\t\tparse: mongoTimeText\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"A time of day without a UTC offset, as in time`09:30:00`. Stores it with three fraction digits, as in 09:30:00.000.\"\n\t\t},\n\t\t[mongoDuration.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"tag\",\n\t\t\t\ttag: \"duration\",\n\t\t\t\tparse: mongoDurationText\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"A length of time, as in duration`PT1H30M`. Reads an ISO 8601 duration and stores it as written.\"\n\t\t},\n\t\t[mongoBinary.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"tag\",\n\t\t\t\ttag: \"binary\",\n\t\t\t\tparse: base64Text\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"Bytes, written in base64 as MongoDB prints them, as in binary`aGVsbG8=`.\"\n\t\t},\n\t\t[mongoJson.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"tag\",\n\t\t\t\ttag: \"json\",\n\t\t\t\tparse: parseJsonText\n\t\t\t},\n\t\t\tprint: printJsonText,\n\t\t\tdocumentation: \"Reads the text as a JSON document and stores it as the value.\"\n\t\t}\n\t};\n}\nconst mongoTargetDescriptorMeta = {\n\t...mongoTargetDescriptorMetaRuntime,\n\tauthoring: {\n\t\ttype: mongoAuthoringTypes,\n\t\tdataTypes: mongoDataTypeEntries(),\n\t\ttextDataTypes: mongoTextDataTypes\n\t},\n\tcontrolMutationDefaults: {\n\t\tdefaultFunctionRegistry: /* @__PURE__ */ new Map(),\n\t\tgeneratorDescriptors: [{ id: TIMESTAMP_NOW_GENERATOR_ID }, ...mongoNowGenerators.map(({ id }) => ({ id }))]\n\t},\n\tgeneratorFunctions: [{\n\t\tname: \"now\",\n\t\tsignature: { documentation: \"Writes the current time.\" },\n\t\tbindings: Object.entries(mongoNowGeneratorIds).map(([codecId, generatorId]) => singleGeneratorBinding({\n\t\t\tcodecIds: [codecId],\n\t\t\tgeneratorId\n\t\t}))\n\t}]\n};\n//#endregion\nexport { mongoTargetDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-CFsOxO6g.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,MAAM,4BAA4B;CACjC,QAAQ;EACP,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,sBAAsB;CAC1C;CACA,OAAO;EACN,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;CACA,MAAM;EACL,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,uBAAuB;CAC3C;CACA,UAAU;EACT,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,wBAAwB;CAC5C;CACA,QAAQ;EACP,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,sBAAsB;CAC1C;CACA,OAAO;EACN,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;CACA,aAAa;EACZ,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,4BAA4B;CAChD;CACA,YAAY;EACX,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,0BAA0B;CAC9C;CACA,QAAQ;EACP,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,sBAAsB;CAC1C;CACA,MAAM;EACL,MAA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,iBAAiB,uBAAuB;GACrG,UAAU,CAAC,OAAO;GAClB;EACD,CAAC,CAAC;CACH,CAAC;AACF"}
1
+ {"version":3,"file":"descriptor-meta-BXMz_uZd-B8WB2m7v.mjs","names":[],"sources":["../../../../3-targets/mongo/1-target/dist/descriptor-meta-BXMz_uZd.mjs"],"sourcesContent":["import { _ as MONGO_STRING_CODEC_ID, a as MONGO_DATE_INSTANT_CODEC_ID, b as MONGO_VECTOR_CODEC_ID, c as MONGO_DATE_TEMPORAL_CODEC_ID, d as MONGO_DURATION_STRING_CODEC_ID, f as MONGO_INT32_CODEC_ID, g as MONGO_OBJECTID_CODEC_ID, h as MONGO_JSON_CODEC_ID, i as MONGO_DATE_CODEC_ID, l as MONGO_DECIMAL128_CODEC_ID, m as MONGO_INT64_NUMBER_CODEC_ID, n as MONGO_BOOLEAN_CODEC_ID, o as MONGO_DATE_INSTANT_STRING_CODEC_ID, p as MONGO_INT64_CODEC_ID, r as MONGO_BSON_CODEC_ID, s as MONGO_DATE_STRING_CODEC_ID, t as MONGO_BINARY_CODEC_ID, u as MONGO_DOUBLE_CODEC_ID, v as MONGO_TIME_STRING_CODEC_ID, y as MONGO_TIME_TEMPORAL_CODEC_ID } from \"./codec-ids-DZQsuh80.mjs\";\nimport { W as decimal128HoldsExactly, _ as mongoString, b as mongoTimeText, c as mongoDecimal128, d as mongoDurationText, h as mongoJson, l as mongoDouble, m as mongoInt64, n as mongoBool, nt as isBase64Text, p as mongoInt32, s as mongoDate, t as mongoBinary, u as mongoDuration, v as mongoTextDataTypes, y as mongoTime } from \"./data-types-B3SLjbqa.mjs\";\nimport { n as mongoNowGenerators, t as mongoNowGeneratorIds } from \"./date-time-now-generators-Dhq1b2V8.mjs\";\nimport { t as mongoTargetDescriptorMetaRuntime } from \"./descriptor-meta-runtime-J4eVdBtZ.mjs\";\nimport { TIMESTAMP_NOW_GENERATOR_ID, temporalTypeAliases } from \"@internal/framework-components/authoring\";\nimport { singleGeneratorBinding } from \"@internal/framework-components/components\";\nimport { createNumberClassifier, isoDateStringText, numeralText, parseJsonText, printJsonText, signedRange } from \"@internal/framework-components/codec\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/core/authoring.ts\n/**\n* The MongoDB scalar types as type constructors, which PSL writes as field types and the TypeScript builder calls as `type.X()`. Each names a codec; the collection validator reads the BSON types from the data type the codec represents, not from the constructor.\n*/\nconst mongoScalarAuthoringTypes = {\n\tString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Text, stored as BSON string.\",\n\t\toutput: { codecId: MONGO_STRING_CODEC_ID }\n\t},\n\tInt32: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A signed 32-bit integer, stored as BSON int.\",\n\t\toutput: { codecId: MONGO_INT32_CODEC_ID }\n\t},\n\tBool: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A true or false value, stored as BSON bool.\",\n\t\toutput: { codecId: MONGO_BOOLEAN_CODEC_ID }\n\t},\n\tObjectId: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A 12-byte MongoDB identifier, stored as BSON objectId.\",\n\t\toutput: { codecId: MONGO_OBJECTID_CODEC_ID }\n\t},\n\tDouble: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A double-precision floating-point number, stored as BSON double.\",\n\t\toutput: { codecId: MONGO_DOUBLE_CODEC_ID }\n\t},\n\tInt64: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A signed 64-bit integer read as a bigint, stored as BSON long.\",\n\t\toutput: { codecId: MONGO_INT64_CODEC_ID }\n\t},\n\tInt64Number: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A signed 64-bit integer read as a JavaScript number within its safe integer range, stored as BSON long.\",\n\t\toutput: { codecId: MONGO_INT64_NUMBER_CODEC_ID }\n\t},\n\tDecimal128: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A 128-bit decimal read as decimal text without an exponent, stored as BSON decimal.\",\n\t\toutput: { codecId: MONGO_DECIMAL128_CODEC_ID }\n\t},\n\tBinary: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Bytes read as a Uint8Array, stored as BSON binData.\",\n\t\toutput: { codecId: MONGO_BINARY_CODEC_ID }\n\t},\n\tJson: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A JSON value, stored as BSON object, array, string, double, int, long, bool or null; the collection validator admits only those types at the top level, and the codec refuses anything else at any depth.\",\n\t\toutput: { codecId: MONGO_JSON_CODEC_ID }\n\t},\n\tBson: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Any BSON value, read as BsonValue; the collection validator does not constrain it.\",\n\t\toutput: { codecId: MONGO_BSON_CODEC_ID }\n\t},\n\tVector: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A list of finite numbers, stored as BSON array, as a vector search index reads it. With a length, it is read as Vector<length>.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: \"mongo/int32\",\n\t\t\tname: \"length\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: MONGO_VECTOR_CODEC_ID,\n\t\t\ttypeParams: { length: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tInt: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Deprecated: use Int32. A signed 32-bit integer, stored as BSON int.\",\n\t\toutput: { codecId: MONGO_INT32_CODEC_ID },\n\t\tdeprecated: { replacement: \"Int32\" }\n\t},\n\tFloat: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Deprecated: use Double. A double-precision floating-point number, stored as BSON double.\",\n\t\toutput: { codecId: MONGO_DOUBLE_CODEC_ID },\n\t\tdeprecated: { replacement: \"Double\" }\n\t},\n\tBoolean: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Deprecated: use Bool. A true or false value, stored as BSON bool.\",\n\t\toutput: { codecId: MONGO_BOOLEAN_CODEC_ID },\n\t\tdeprecated: { replacement: \"Bool\" }\n\t}\n};\n/**\n* The explicit date and time types. Each name says what the field stores and what the application reads. ADR 315.\n*/\nconst mongoDateTimeTypeConstructors = {\n\tDateJsDate: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An instant with millisecond precision, stored as BSON date and represented as a JavaScript Date.\",\n\t\toutput: { codecId: MONGO_DATE_CODEC_ID }\n\t},\n\tDateInstant: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An instant with millisecond precision, stored as BSON date and represented as Temporal.Instant.\",\n\t\toutput: { codecId: MONGO_DATE_INSTANT_CODEC_ID }\n\t},\n\tDateInstantString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An instant with millisecond precision, stored as BSON date and represented as ISO 8601 text in UTC with three fraction digits, 2024-01-01T00:00:00.000Z.\",\n\t\toutput: { codecId: MONGO_DATE_INSTANT_STRING_CODEC_ID }\n\t},\n\tDateString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A calendar date, stored as BSON date at midnight UTC and represented as ISO 8601 text, 2024-02-29.\",\n\t\toutput: { codecId: MONGO_DATE_STRING_CODEC_ID }\n\t},\n\tDateTemporal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A calendar date, stored as BSON date at midnight UTC and represented as Temporal.PlainDate.\",\n\t\toutput: { codecId: MONGO_DATE_TEMPORAL_CODEC_ID }\n\t},\n\tTimeString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A time of day, stored as BSON string and represented as that string, 09:30:00.000, always with three fraction digits.\",\n\t\toutput: { codecId: MONGO_TIME_STRING_CODEC_ID }\n\t},\n\tTimeTemporal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A time of day, stored as BSON string, 09:30:00.000, and represented as Temporal.PlainTime.\",\n\t\toutput: { codecId: MONGO_TIME_TEMPORAL_CODEC_ID }\n\t},\n\tDurationString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A length of time, stored as BSON string and represented as the ISO 8601 duration it was written as, such as PT1H30M.\",\n\t\toutput: { codecId: MONGO_DURATION_STRING_CODEC_ID }\n\t}\n};\nconst dateStorage = {\n\tkind: \"option\",\n\tname: \"storage\",\n\tvalues: [\"date\"],\n\tdefault: \"date\",\n\toptional: true\n};\nconst stringStorage = {\n\tkind: \"option\",\n\tname: \"storage\",\n\tvalues: [\"string\"],\n\tdefault: \"string\",\n\toptional: true\n};\n/**\n* The convenience date and time types. Each is a type choice: its `as` argument chooses the explicit type it becomes. ADR 279, ADR 315.\n*/\nconst mongoConvenienceDateTimeTypes = {\n\tDateTime: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A moment in time, stored as BSON date. `as` is what the application reads: jsDate (a JavaScript Date), temporal (Temporal.Instant) or string, such as \\\"2024-01-01T00:00:00.000Z\\\".\",\n\t\targs: [{\n\t\t\tkind: \"option\",\n\t\t\tname: \"as\",\n\t\t\tvalues: [\n\t\t\t\t\"jsDate\",\n\t\t\t\t\"temporal\",\n\t\t\t\t\"string\"\n\t\t\t],\n\t\t\tdefault: \"jsDate\",\n\t\t\toptional: true\n\t\t}, dateStorage],\n\t\tchoices: [\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"jsDate\",\n\t\t\t\t\tstorage: \"date\"\n\t\t\t\t},\n\t\t\t\ttype: \"DateJsDate\"\n\t\t\t},\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"temporal\",\n\t\t\t\t\tstorage: \"date\"\n\t\t\t\t},\n\t\t\t\ttype: \"DateInstant\"\n\t\t\t},\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"string\",\n\t\t\t\t\tstorage: \"date\"\n\t\t\t\t},\n\t\t\t\ttype: \"DateInstantString\"\n\t\t\t}\n\t\t]\n\t},\n\tDate: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A calendar date, stored as BSON date at midnight UTC. `as` is what the application reads: string, such as \\\"2024-02-29\\\", or temporal (Temporal.PlainDate).\",\n\t\targs: [{\n\t\t\tkind: \"option\",\n\t\t\tname: \"as\",\n\t\t\tvalues: [\"string\", \"temporal\"],\n\t\t\tdefault: \"string\",\n\t\t\toptional: true\n\t\t}, dateStorage],\n\t\tchoices: [{\n\t\t\twhen: {\n\t\t\t\tas: \"string\",\n\t\t\t\tstorage: \"date\"\n\t\t\t},\n\t\t\ttype: \"DateString\"\n\t\t}, {\n\t\t\twhen: {\n\t\t\t\tas: \"temporal\",\n\t\t\t\tstorage: \"date\"\n\t\t\t},\n\t\t\ttype: \"DateTemporal\"\n\t\t}]\n\t},\n\tTime: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A time of day, stored as BSON string. `as` is what the application reads: string, such as \\\"09:30:00.000\\\", or temporal (Temporal.PlainTime).\",\n\t\targs: [{\n\t\t\tkind: \"option\",\n\t\t\tname: \"as\",\n\t\t\tvalues: [\"string\", \"temporal\"],\n\t\t\tdefault: \"string\",\n\t\t\toptional: true\n\t\t}, stringStorage],\n\t\tchoices: [{\n\t\t\twhen: {\n\t\t\t\tas: \"string\",\n\t\t\t\tstorage: \"string\"\n\t\t\t},\n\t\t\ttype: \"TimeString\"\n\t\t}, {\n\t\t\twhen: {\n\t\t\t\tas: \"temporal\",\n\t\t\t\tstorage: \"string\"\n\t\t\t},\n\t\t\ttype: \"TimeTemporal\"\n\t\t}]\n\t},\n\tDuration: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A length of time, stored as BSON string. `as` is what the application reads: string, an ISO 8601 duration such as \\\"PT1H30M\\\".\",\n\t\targs: [{\n\t\t\tkind: \"option\",\n\t\t\tname: \"as\",\n\t\t\tvalues: [\"string\"],\n\t\t\tdefault: \"string\",\n\t\t\toptional: true\n\t\t}, stringStorage],\n\t\tchoices: [{\n\t\t\twhen: {\n\t\t\t\tas: \"string\",\n\t\t\t\tstorage: \"string\"\n\t\t\t},\n\t\t\ttype: \"DurationString\"\n\t\t}]\n\t}\n};\nconst mongoAuthoringTypes = {\n\t...mongoScalarAuthoringTypes,\n\t...mongoDateTimeTypeConstructors,\n\t...mongoConvenienceDateTimeTypes,\n\ttemporal: temporalTypeAliases({ codecId: MONGO_DATE_CODEC_ID }, \"a JavaScript Date\")\n};\n//#endregion\n//#region src/core/data-type-entries.ts\nconst classifyAsDecimal = createNumberClassifier({\n\tintegers: [{\n\t\ttype: mongoInt32.id,\n\t\tform: \"number\",\n\t\t...signedRange(32)\n\t}, {\n\t\ttype: mongoInt64.id,\n\t\tform: \"text\",\n\t\t...signedRange(64)\n\t}],\n\tlargerWhole: {\n\t\ttype: mongoDecimal128.id,\n\t\tform: \"text\"\n\t},\n\tfraction: {\n\t\ttype: mongoDecimal128.id,\n\t\tform: \"text\"\n\t},\n\twords: {\n\t\ttype: mongoDecimal128.id,\n\t\tform: \"text\"\n\t}\n});\n/** The type of a written number: a `decimal` only when a Decimal128 holds it exactly, else the `double` nearest it. */\nfunction classifyMongoNumber(text) {\n\tconst classified = classifyAsDecimal(text);\n\tif (classified?.type !== mongoDecimal128.id || decimal128HoldsExactly(String(classified.value))) return classified;\n\tconst double = Number(text);\n\treturn Number.isFinite(double) ? {\n\t\ttype: mongoDouble.id,\n\t\tvalue: double\n\t} : void 0;\n}\nfunction printNumber(value) {\n\treturn typeof value === \"number\" ? numeralText(value) : String(value);\n}\nfunction base64Text(text) {\n\tif (isBase64Text(text)) return text;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `\"${text}\" is not base64 text: write the bytes in base64, as in binary\\`aGVsbG8=\\`.`, {\n\t\twhy: \"The binary tag reads bytes as base64, as MongoDB prints them.\",\n\t\tfix: \"Write the bytes in base64, as in binary`aGVsbG8=`.\"\n\t});\n}\nfunction mongoDataTypeEntries() {\n\treturn {\n\t\t[mongoString.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"plain\",\n\t\t\t\tsyntax: \"string\",\n\t\t\t\tparse: (text) => text\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"Text.\"\n\t\t},\n\t\t[mongoBool.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"plain\",\n\t\t\t\tsyntax: \"boolean\",\n\t\t\t\tparse: (text) => text === \"true\"\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"A boolean, written true or false.\"\n\t\t},\n\t\t[mongoDouble.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"plain\",\n\t\t\t\tsyntax: \"number\",\n\t\t\t\ttypes: [\n\t\t\t\t\tmongoInt32.id,\n\t\t\t\t\tmongoInt64.id,\n\t\t\t\t\tmongoDecimal128.id,\n\t\t\t\t\tmongoDouble.id\n\t\t\t\t],\n\t\t\t\tclassify: classifyMongoNumber\n\t\t\t},\n\t\t\tprint: printNumber,\n\t\t\tdocumentation: \"A number: an int in 32 bits, a long in 64, a decimal when a Decimal128 holds it exactly, NaN and the infinities included, and a double otherwise.\"\n\t\t},\n\t\t[mongoDate.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"tag\",\n\t\t\t\ttag: \"date\",\n\t\t\t\tparse: (text) => isoDateStringText(text, mongoDate.id)\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"An instant, as in date`2024-01-01T00:00:00Z`. Reads ISO 8601 with a UTC offset and stores the instant in UTC with three fraction digits, as Date.toISOString() writes it.\"\n\t\t},\n\t\t[mongoTime.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"tag\",\n\t\t\t\ttag: \"time\",\n\t\t\t\tparse: mongoTimeText\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"A time of day without a UTC offset, as in time`09:30:00`. Stores it with three fraction digits, as in 09:30:00.000.\"\n\t\t},\n\t\t[mongoDuration.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"tag\",\n\t\t\t\ttag: \"duration\",\n\t\t\t\tparse: mongoDurationText\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"A length of time, as in duration`PT1H30M`. Reads an ISO 8601 duration and stores it as written.\"\n\t\t},\n\t\t[mongoBinary.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"tag\",\n\t\t\t\ttag: \"binary\",\n\t\t\t\tparse: base64Text\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"Bytes, written in base64 as MongoDB prints them, as in binary`aGVsbG8=`.\"\n\t\t},\n\t\t[mongoJson.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"tag\",\n\t\t\t\ttag: \"json\",\n\t\t\t\tparse: parseJsonText\n\t\t\t},\n\t\t\tprint: printJsonText,\n\t\t\tdocumentation: \"Reads the text as a JSON document and stores it as the value.\"\n\t\t}\n\t};\n}\nconst mongoTargetDescriptorMeta = {\n\t...mongoTargetDescriptorMetaRuntime,\n\tauthoring: {\n\t\ttype: mongoAuthoringTypes,\n\t\tdataTypes: mongoDataTypeEntries(),\n\t\ttextDataTypes: mongoTextDataTypes\n\t},\n\tcontrolMutationDefaults: {\n\t\tdefaultFunctionRegistry: /* @__PURE__ */ new Map(),\n\t\tgeneratorDescriptors: [{ id: TIMESTAMP_NOW_GENERATOR_ID }, ...mongoNowGenerators.map(({ id }) => ({ id }))]\n\t},\n\tgeneratorFunctions: [{\n\t\tname: \"now\",\n\t\tsignature: { documentation: \"Writes the current time.\" },\n\t\tbindings: Object.entries(mongoNowGeneratorIds).map(([codecId, generatorId]) => singleGeneratorBinding({\n\t\t\tcodecIds: [codecId],\n\t\t\tgeneratorId\n\t\t}))\n\t}]\n};\n//#endregion\nexport { mongoTargetDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-BXMz_uZd.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,MAAM,4BAA4B;CACjC,QAAQ;EACP,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,sBAAsB;CAC1C;CACA,OAAO;EACN,MAAM;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Y,KAAK;GACjB,SAAS;IACR,MAAM;IACN,KAAK;IACL,OAAO;GACR;GACA,QAAQ,UAAU,OAAO,KAAK;GAC9B,eAAe;EAChB;GACC,UAAU,KAAK;GACf,SAAS;IACR,MAAM;IACN,KAAK;IACL,OAAO;GACR;GACA,OAAO;GACP,eAAe;EAChB;CACD;AACD;AACA,MAAM,4BAA4B;CACjC,GAAG;CACH,WAAW;EACV,MAAM;EACN,WAAW,qBAAqB;EAChC,eAAe;CAChB;CACA,yBAAyB;EACxB,yCAAyC,IAAI,IAAI;EACjD,sBAAsB,CAAC,EAAE,IAAI,2BAA2B,GAAG,GAAG,mBAAmB,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;CAC3G;CACA,oBAAoB,CAAC;EACpB,MAAM;EACN,WAAW,EAAE,eAAe,2BAA2B;EACvD,UAAU,OAAO,QAAQ,oBAAoB,CAAC,CAAC,KAAK,CAAC,SAAS,iBAAiB,uBAAuB;GACrG,UAAU,CAAC,OAAO;GAClB;EACD,CAAC,CAAC;CACH,CAAC;AACF"}
@@ -1,7 +1,7 @@
1
- import { R as mongoDataTypes } from "./data-types-Cq1kg82y-Vk7z6rnW.mjs";
2
- import { t as mongoCodecDescriptors } from "./codecs-BbX2VMzN-Dm9db3Jz.mjs";
1
+ import { R as mongoDataTypes } from "./data-types-B3SLjbqa-C1LmrfzH.mjs";
2
+ import { t as mongoCodecDescriptors } from "./codecs-Bl21z49D-Bj5erX9r.mjs";
3
3
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
4
- //#region ../../../3-targets/mongo/1-target/dist/descriptor-meta-runtime-CBJIjp5R.mjs
4
+ //#region ../../../3-targets/mongo/1-target/dist/descriptor-meta-runtime-J4eVdBtZ.mjs
5
5
  const mongoTargetDescriptorMetaRuntime = {
6
6
  kind: "target",
7
7
  familyId: "mongo",
@@ -17,4 +17,4 @@ const mongoTargetDescriptorMetaRuntime = {
17
17
  //#endregion
18
18
  export { mongoTargetDescriptorMetaRuntime as t };
19
19
 
20
- //# sourceMappingURL=descriptor-meta-runtime-CBJIjp5R-DMQ9-3Hd.mjs.map
20
+ //# sourceMappingURL=descriptor-meta-runtime-J4eVdBtZ-D1yRng4t.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"descriptor-meta-runtime-CBJIjp5R-DMQ9-3Hd.mjs","names":[],"sources":["../../../../3-targets/mongo/1-target/dist/descriptor-meta-runtime-CBJIjp5R.mjs"],"sourcesContent":["import { o as mongoDataTypes } from \"./data-types-Cq1kg82y.mjs\";\nimport { t as mongoCodecDescriptors } from \"./codecs-BbX2VMzN.mjs\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nconst mongoTargetDescriptorMetaRuntime = {\n\tkind: \"target\",\n\tfamilyId: \"mongo\",\n\ttargetId: \"mongo\",\n\tid: \"mongo\",\n\tversion: \"0.0.1\",\n\tcapabilities: {},\n\tdefaultNamespaceId: UNBOUND_NAMESPACE_ID,\n\tsupportsNamespaces: true,\n\tdataTypes: mongoDataTypes,\n\ttypes: { codecTypes: { codecDescriptors: mongoCodecDescriptors } }\n};\n//#endregion\nexport { mongoTargetDescriptorMetaRuntime as t };\n\n//# sourceMappingURL=descriptor-meta-runtime-CBJIjp5R.mjs.map"],"mappings":";;;;AAGA,MAAM,mCAAmC;CACxC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,CAAC;CACf,oBAAoB;CACpB,oBAAoB;CACpB,WAAW;CACX,OAAO,EAAE,YAAY,EAAE,kBAAkB,sBAAsB,EAAE;AAClE"}
1
+ {"version":3,"file":"descriptor-meta-runtime-J4eVdBtZ-D1yRng4t.mjs","names":[],"sources":["../../../../3-targets/mongo/1-target/dist/descriptor-meta-runtime-J4eVdBtZ.mjs"],"sourcesContent":["import { o as mongoDataTypes } from \"./data-types-B3SLjbqa.mjs\";\nimport { t as mongoCodecDescriptors } from \"./codecs-Bl21z49D.mjs\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nconst mongoTargetDescriptorMetaRuntime = {\n\tkind: \"target\",\n\tfamilyId: \"mongo\",\n\ttargetId: \"mongo\",\n\tid: \"mongo\",\n\tversion: \"0.0.1\",\n\tcapabilities: {},\n\tdefaultNamespaceId: UNBOUND_NAMESPACE_ID,\n\tsupportsNamespaces: true,\n\tdataTypes: mongoDataTypes,\n\ttypes: { codecTypes: { codecDescriptors: mongoCodecDescriptors } }\n};\n//#endregion\nexport { mongoTargetDescriptorMetaRuntime as t };\n\n//# sourceMappingURL=descriptor-meta-runtime-J4eVdBtZ.mjs.map"],"mappings":";;;;AAGA,MAAM,mCAAmC;CACxC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,CAAC;CACf,oBAAoB;CACpB,oBAAoB;CACpB,WAAW;CACX,OAAO,EAAE,YAAY,EAAE,kBAAkB,sBAAsB,EAAE;AAClE"}
package/dist/driver.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as MongoControlDriver } from "./control-AjuXfVKk.mjs";
1
+ import { t as MongoControlDriver } from "./control-D_uldvl5.mjs";
2
2
  export { MongoControlDriver };
@@ -1,2 +1,2 @@
1
- import { n as mongoControlDriverDescriptor, t as MongoControlDriver } from "./control-AjuXfVKk.mjs";
1
+ import { n as mongoControlDriverDescriptor, t as MongoControlDriver } from "./control-D_uldvl5.mjs";
2
2
  export { MongoControlDriver, mongoControlDriverDescriptor as default };
@@ -1,4 +1,4 @@
1
- import { n as MongoDriverImpl, r as mongoDriverDescriptorMeta } from "./mongo-driver-Dtca4OAu-Cy1Lh7xi.mjs";
1
+ import { n as MongoDriverImpl, r as mongoDriverDescriptorMeta } from "./mongo-driver-Ci-03XE3-kphfDDR4.mjs";
2
2
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
3
3
  //#region ../../../3-targets/mongo/3-driver/dist/runtime.mjs
4
4
  const notConnectedMessages = {
@@ -1 +1 @@
1
- {"version":3,"file":"driver__runtime.mjs","names":["#disconnectedState","#delegate","#notConnectedError","#connecting","#requireDelegate"],"sources":["../../../../3-targets/mongo/3-driver/dist/runtime.mjs"],"sourcesContent":["import { n as mongoDriverDescriptorMeta, t as MongoDriverImpl } from \"./mongo-driver-Dtca4OAu.mjs\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/core/runtime/mongo-runtime-driver.ts\nconst notConnectedMessages = {\n\tunbound: \"Mongo driver not connected. Call connect(binding) before execute or run.\",\n\tclosed: \"Mongo driver is closed. Call connect(binding) to reconnect.\"\n};\nconst ALREADY_CONNECTED_MESSAGE = \"Mongo driver already connected. Call close() before reconnecting with a new binding.\";\nasync function connectedDriver(binding) {\n\tif (binding.kind === \"mongoClient\") return MongoDriverImpl.fromDb(binding.client.db(binding.dbName));\n\treturn MongoDriverImpl.fromConnection(binding.url, binding.dbName);\n}\nvar MongoUnboundDriverImpl = class {\n\tfamilyId = \"mongo\";\n\ttargetId = \"mongo\";\n\t#delegate = null;\n\t#connecting = null;\n\t#disconnectedState = \"unbound\";\n\t#notConnectedError() {\n\t\treturn structuredError(\"DRIVER.NOT_CONNECTED\", notConnectedMessages[this.#disconnectedState]);\n\t}\n\t#requireDelegate() {\n\t\tif (this.#delegate === null) throw this.#notConnectedError();\n\t\treturn this.#delegate;\n\t}\n\tasync connect(binding) {\n\t\tif (this.#delegate !== null || this.#connecting !== null) throw structuredError(\"DRIVER.ALREADY_CONNECTED\", ALREADY_CONNECTED_MESSAGE, { meta: { bindingKind: binding.kind } });\n\t\tconst connecting = connectedDriver(binding);\n\t\tthis.#connecting = connecting;\n\t\ttry {\n\t\t\tconst delegate = await connecting;\n\t\t\tif (this.#connecting !== connecting) throw this.#notConnectedError();\n\t\t\tthis.#delegate = delegate;\n\t\t\tthis.#disconnectedState = \"unbound\";\n\t\t} finally {\n\t\t\tif (this.#connecting === connecting) this.#connecting = null;\n\t\t}\n\t}\n\tasync *execute(wireCommand) {\n\t\tyield* this.#requireDelegate().execute(wireCommand);\n\t}\n\tasync run(wireCommand) {\n\t\treturn this.#requireDelegate().run(wireCommand);\n\t}\n\tasync close() {\n\t\tconst delegate = this.#delegate;\n\t\tconst connecting = this.#connecting;\n\t\tthis.#delegate = null;\n\t\tthis.#connecting = null;\n\t\tthis.#disconnectedState = \"closed\";\n\t\tconst connected = await connecting?.catch(() => null);\n\t\tawait Promise.all([delegate?.close(), connected?.close()]);\n\t}\n};\nfunction createMongoRuntimeDriver() {\n\treturn new MongoUnboundDriverImpl();\n}\n//#endregion\n//#region src/exports/runtime.ts\nconst mongoRuntimeDriverDescriptor = {\n\t...mongoDriverDescriptorMeta,\n\tcreate: createMongoRuntimeDriver\n};\n//#endregion\nexport { mongoRuntimeDriverDescriptor as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;AAGA,MAAM,uBAAuB;CAC5B,SAAS;CACT,QAAQ;AACT;AACA,MAAM,4BAA4B;AAClC,eAAe,gBAAgB,SAAS;CACvC,IAAI,QAAQ,SAAS,eAAe,OAAO,gBAAgB,OAAO,QAAQ,OAAO,GAAG,QAAQ,MAAM,CAAC;CACnG,OAAO,gBAAgB,eAAe,QAAQ,KAAK,QAAQ,MAAM;AAClE;AACA,IAAI,yBAAyB,MAAM;CAClC,WAAW;CACX,WAAW;CACX,YAAY;CACZ,cAAc;CACd,qBAAqB;CACrB,qBAAqB;EACpB,OAAO,gBAAgB,wBAAwB,qBAAqB,KAAKA,mBAAmB;CAC7F;CACA,mBAAmB;EAClB,IAAI,KAAKC,cAAc,MAAM,MAAM,KAAKC,mBAAmB;EAC3D,OAAO,KAAKD;CACb;CACA,MAAM,QAAQ,SAAS;EACtB,IAAI,KAAKA,cAAc,QAAQ,KAAKE,gBAAgB,MAAM,MAAM,gBAAgB,4BAA4B,2BAA2B,EAAE,MAAM,EAAE,aAAa,QAAQ,KAAK,EAAE,CAAC;EAC9K,MAAM,aAAa,gBAAgB,OAAO;EAC1C,KAAKA,cAAc;EACnB,IAAI;GACH,MAAM,WAAW,MAAM;GACvB,IAAI,KAAKA,gBAAgB,YAAY,MAAM,KAAKD,mBAAmB;GACnE,KAAKD,YAAY;GACjB,KAAKD,qBAAqB;EAC3B,UAAU;GACT,IAAI,KAAKG,gBAAgB,YAAY,KAAKA,cAAc;EACzD;CACD;CACA,OAAO,QAAQ,aAAa;EAC3B,OAAO,KAAKC,iBAAiB,CAAC,CAAC,QAAQ,WAAW;CACnD;CACA,MAAM,IAAI,aAAa;EACtB,OAAO,KAAKA,iBAAiB,CAAC,CAAC,IAAI,WAAW;CAC/C;CACA,MAAM,QAAQ;EACb,MAAM,WAAW,KAAKH;EACtB,MAAM,aAAa,KAAKE;EACxB,KAAKF,YAAY;EACjB,KAAKE,cAAc;EACnB,KAAKH,qBAAqB;EAC1B,MAAM,YAAY,MAAM,YAAY,YAAY,IAAI;EACpD,MAAM,QAAQ,IAAI,CAAC,UAAU,MAAM,GAAG,WAAW,MAAM,CAAC,CAAC;CAC1D;AACD;AACA,SAAS,2BAA2B;CACnC,OAAO,IAAI,uBAAuB;AACnC;AAGA,MAAM,+BAA+B;CACpC,GAAG;CACH,QAAQ;AACT"}
1
+ {"version":3,"file":"driver__runtime.mjs","names":["#disconnectedState","#delegate","#notConnectedError","#connecting","#requireDelegate"],"sources":["../../../../3-targets/mongo/3-driver/dist/runtime.mjs"],"sourcesContent":["import { n as mongoDriverDescriptorMeta, t as MongoDriverImpl } from \"./mongo-driver-Ci-03XE3.mjs\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/core/runtime/mongo-runtime-driver.ts\nconst notConnectedMessages = {\n\tunbound: \"Mongo driver not connected. Call connect(binding) before execute or run.\",\n\tclosed: \"Mongo driver is closed. Call connect(binding) to reconnect.\"\n};\nconst ALREADY_CONNECTED_MESSAGE = \"Mongo driver already connected. Call close() before reconnecting with a new binding.\";\nasync function connectedDriver(binding) {\n\tif (binding.kind === \"mongoClient\") return MongoDriverImpl.fromDb(binding.client.db(binding.dbName));\n\treturn MongoDriverImpl.fromConnection(binding.url, binding.dbName);\n}\nvar MongoUnboundDriverImpl = class {\n\tfamilyId = \"mongo\";\n\ttargetId = \"mongo\";\n\t#delegate = null;\n\t#connecting = null;\n\t#disconnectedState = \"unbound\";\n\t#notConnectedError() {\n\t\treturn structuredError(\"DRIVER.NOT_CONNECTED\", notConnectedMessages[this.#disconnectedState]);\n\t}\n\t#requireDelegate() {\n\t\tif (this.#delegate === null) throw this.#notConnectedError();\n\t\treturn this.#delegate;\n\t}\n\tasync connect(binding) {\n\t\tif (this.#delegate !== null || this.#connecting !== null) throw structuredError(\"DRIVER.ALREADY_CONNECTED\", ALREADY_CONNECTED_MESSAGE, { meta: { bindingKind: binding.kind } });\n\t\tconst connecting = connectedDriver(binding);\n\t\tthis.#connecting = connecting;\n\t\ttry {\n\t\t\tconst delegate = await connecting;\n\t\t\tif (this.#connecting !== connecting) throw this.#notConnectedError();\n\t\t\tthis.#delegate = delegate;\n\t\t\tthis.#disconnectedState = \"unbound\";\n\t\t} finally {\n\t\t\tif (this.#connecting === connecting) this.#connecting = null;\n\t\t}\n\t}\n\tasync *execute(wireCommand) {\n\t\tyield* this.#requireDelegate().execute(wireCommand);\n\t}\n\tasync run(wireCommand) {\n\t\treturn this.#requireDelegate().run(wireCommand);\n\t}\n\tasync close() {\n\t\tconst delegate = this.#delegate;\n\t\tconst connecting = this.#connecting;\n\t\tthis.#delegate = null;\n\t\tthis.#connecting = null;\n\t\tthis.#disconnectedState = \"closed\";\n\t\tconst connected = await connecting?.catch(() => null);\n\t\tawait Promise.all([delegate?.close(), connected?.close()]);\n\t}\n};\nfunction createMongoRuntimeDriver() {\n\treturn new MongoUnboundDriverImpl();\n}\n//#endregion\n//#region src/exports/runtime.ts\nconst mongoRuntimeDriverDescriptor = {\n\t...mongoDriverDescriptorMeta,\n\tcreate: createMongoRuntimeDriver\n};\n//#endregion\nexport { mongoRuntimeDriverDescriptor as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;AAGA,M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,IAAI;EACpD,MAAM,QAAQ,IAAI,CAAC,UAAU,MAAM,GAAG,WAAW,MAAM,CAAC,CAAC;CAC1D;AACD;AACA,SAAS,2BAA2B;CACnC,OAAO,IAAI,uBAAuB;AACnC;AAGA,MAAM,+BAA+B;CACpC,GAAG;CACH,QAAQ;AACT"}
@@ -0,0 +1,5 @@
1
+ import "./op-factory-call-BCgwbVJe-DhcJRxAb.mjs";
2
+ import { placeholder } from "@prisma/orm-framework/errors/migration";
3
+ import { MigrationCLI } from "@prisma/orm-toolchain/cli/migration-cli";
4
+ import { Migration } from "@prisma/orm-family-mongo/family/migration";
5
+ export { MigrationCLI as n, placeholder as r, Migration as t };
@@ -6,7 +6,63 @@ import { CollModCommand, DropCollectionCommand, DropIndexCommand, ListCollection
6
6
  import { RawAggregateCommand, RawUpdateManyCommand } from "@prisma/orm-family-mongo/query-ast/execution";
7
7
  import { createFieldAccessor } from "@prisma/orm-family-mongo/query-builder";
8
8
  import { collection } from "@prisma/orm-family-mongo/query-builder/contract-free";
9
- //#region ../../../3-targets/mongo/1-target/dist/migration-factories-oLRWgLGz.mjs
9
+ //#region ../../../3-targets/mongo/1-target/dist/migration-factories-C5ktmt8c.mjs
10
+ const NUMBERS = [
11
+ "double",
12
+ "int",
13
+ "long",
14
+ "decimal"
15
+ ];
16
+ /**
17
+ * For each BSON type a field can be cast to, the BSON types whose `$convert` result is what casting
18
+ * the value means. `$convert` accepts more pairs than these; each one left off gives a result the
19
+ * value did not mean:
20
+ *
21
+ * - `string` to `bool` is `true` for every non-empty string, `"false"` and `"no"` included.
22
+ * - `objectId` or `date` to `bool` is always `true`.
23
+ * - `bool` to a number is `1` or `0`, which a number field does not mean.
24
+ * - `date` to `double`, `long` or `decimal` is milliseconds since the epoch, and a number to `date`
25
+ * reads the number that way, a unit the value does not name.
26
+ * - `objectId` to `date` is the time the id was made, not a date the document holds.
27
+ *
28
+ * See the MongoDB `$convert` reference.
29
+ */
30
+ const CASTS_FROM = {
31
+ double: /* @__PURE__ */ new Set([...NUMBERS, "string"]),
32
+ string: /* @__PURE__ */ new Set([
33
+ ...NUMBERS,
34
+ "string",
35
+ "bool",
36
+ "date",
37
+ "objectId"
38
+ ]),
39
+ objectId: /* @__PURE__ */ new Set(["string", "objectId"]),
40
+ bool: /* @__PURE__ */ new Set([...NUMBERS, "bool"]),
41
+ date: /* @__PURE__ */ new Set(["string", "date"]),
42
+ int: /* @__PURE__ */ new Set([...NUMBERS, "string"]),
43
+ long: /* @__PURE__ */ new Set([...NUMBERS, "string"]),
44
+ decimal: /* @__PURE__ */ new Set([...NUMBERS, "string"])
45
+ };
46
+ /** The casts that keep every value: each source type with the types it widens to. */
47
+ const KEEPS_EVERY_VALUE = {
48
+ int: /* @__PURE__ */ new Set([
49
+ "long",
50
+ "double",
51
+ "decimal"
52
+ ]),
53
+ long: /* @__PURE__ */ new Set(["decimal"])
54
+ };
55
+ function isConvertTarget(to) {
56
+ return Object.hasOwn(CASTS_FROM, to);
57
+ }
58
+ /** Whether a cast with `$convert` from BSON type `from` to `to` keeps what the values mean, for the values it casts. */
59
+ function castsFrom(from, to) {
60
+ return from === to || (CASTS_FROM[to]?.has(from) ?? false);
61
+ }
62
+ /** Whether casting a value of BSON type `from` to `to` keeps every value as it was. */
63
+ function convertKeepsEveryValue(from, to) {
64
+ return from === to || (KEEPS_EVERY_VALUE[from]?.has(to) ?? false);
65
+ }
10
66
  function isBuildable(value) {
11
67
  if (typeof value !== "object" || value === null || !("build" in value)) return false;
12
68
  return typeof Reflect.get(value, "build") === "function";
@@ -49,11 +105,19 @@ function dataTransform(name, options) {
49
105
  postcheck
50
106
  };
51
107
  }
52
- const REWRITE_PLAN_META = {
53
- target: "mongo",
54
- storageHash: "",
55
- lane: "mongo-raw"
56
- };
108
+ /** A raw `aggregate` on a collection, as a data transform's check reads documents. */
109
+ function rawAggregate(collectionName, pipeline) {
110
+ return rewritePlan(collectionName, new RawAggregateCommand(collectionName, pipeline));
111
+ }
112
+ /**
113
+ * A raw `updateMany` on a collection, which a data transform's run can make skip document
114
+ * validation. `update` is an update document, such as `{ $set: { age: 0 } }`, or an aggregation
115
+ * pipeline, such as `[{ $set: { age: { $toInt: '$age' } } }]`, which can read the document's own
116
+ * values.
117
+ */
118
+ function rawUpdateMany(collectionName, filter, update, options) {
119
+ return rewritePlan(collectionName, new RawUpdateManyCommand(collectionName, filter, update, ifDefined("bypassDocumentValidation", options?.bypassDocumentValidation)));
120
+ }
57
121
  function documentsHolding(fields, filter) {
58
122
  const conditions = [...filter === void 0 ? [] : [filter], ...fields.map((field) => ({ [field]: { $exists: true } }))];
59
123
  const [only] = conditions;
@@ -81,6 +145,12 @@ const UNREWRITABLE_FIELD_NAMES = [
81
145
  function unrewritableFieldNameReason(field) {
82
146
  return UNREWRITABLE_FIELD_NAMES.find((rule) => rule.matches(field))?.reason;
83
147
  }
148
+ /** The plan meta of the raw queries a migration's operations run and check with. */
149
+ const RAW_PLAN_META = {
150
+ target: "mongo",
151
+ storageHash: "",
152
+ lane: "mongo-raw"
153
+ };
84
154
  function assertRewritableField(collectionName, field) {
85
155
  const reason = unrewritableFieldNameReason(field);
86
156
  if (reason === void 0) return;
@@ -94,7 +164,7 @@ function rewritePlan(collectionName, command) {
94
164
  return {
95
165
  collection: collectionName,
96
166
  command,
97
- meta: { ...REWRITE_PLAN_META }
167
+ meta: { ...RAW_PLAN_META }
98
168
  };
99
169
  }
100
170
  function noDocumentHolds(collectionName, fields, filter) {
@@ -161,6 +231,139 @@ function unsetField(collectionName, field, options) {
161
231
  postcheck: [noDocumentHolds(collectionName, [field], filter)]
162
232
  };
163
233
  }
234
+ /**
235
+ * The documents whose field holds a value of none of the BSON types `types`, or, for a list, an
236
+ * element of none of them. A single value is read with `$expr`, since a query's `$type` and `$ne`
237
+ * look at the elements of a list.
238
+ */
239
+ function documentsNotOfType(field, shape) {
240
+ if (shape.list) return { [field]: { $elemMatch: {
241
+ $ne: null,
242
+ $not: { $type: [...shape.types] }
243
+ } } };
244
+ return { $expr: { $not: { $in: [{ $type: `$${field}` }, [
245
+ "missing",
246
+ "null",
247
+ ...shape.types
248
+ ]] } } };
249
+ }
250
+ /** The documents where the field is missing or holds `null`, read with `$expr` so a list holding `null` is not one. */
251
+ function documentsMissingOrNull(field) {
252
+ return { $expr: { $in: [{ $type: `$${field}` }, ["missing", "null"]] } };
253
+ }
254
+ const NUMBER_TYPES = [
255
+ "int",
256
+ "long",
257
+ "double",
258
+ "decimal"
259
+ ];
260
+ /**
261
+ * The documents whose field holds a value of one of the BSON types `types`, or, for a list, an
262
+ * element of one of them. A single value is read with `$expr`, since a query's `$type` looks at the
263
+ * elements of a list.
264
+ */
265
+ function documentsOfType(field, shape) {
266
+ if (shape.list) return { [field]: { $elemMatch: { $type: [...shape.types] } } };
267
+ return { $expr: { $in: [{ $type: `$${field}` }, [...shape.types]] } };
268
+ }
269
+ /**
270
+ * The documents the cast changes: those holding a value of a type it is planned from, other than
271
+ * `to`. A value of any other type is left as it is, for the validator change's document check to
272
+ * name. A cast planned from no type casts every value that is not of type `to`.
273
+ */
274
+ function documentsToCast(field, to, options) {
275
+ const list = options.list === true;
276
+ const from = [...new Set(options.from.flatMap((type) => type === "number" ? NUMBER_TYPES : [type]))].filter((type) => type !== to);
277
+ const condition = options.from.length === 0 ? documentsNotOfType(field, {
278
+ types: [to],
279
+ list
280
+ }) : documentsOfType(field, {
281
+ types: from,
282
+ list
283
+ });
284
+ return options.filter === void 0 ? condition : { $and: [options.filter, condition] };
285
+ }
286
+ function castExpression(field, to, list) {
287
+ return list ? { $map: {
288
+ input: `$${field}`,
289
+ as: "value",
290
+ in: { $convert: {
291
+ input: "$$value",
292
+ to
293
+ } }
294
+ } } : { $convert: {
295
+ input: `$${field}`,
296
+ to
297
+ } };
298
+ }
299
+ /**
300
+ * Casts a field to the BSON type `to` with `$convert`, in the documents where it holds another
301
+ * type. A value `$convert` cannot cast fails the update. Widening when every type in `from` casts
302
+ * to `to` keeping its value, destructive otherwise.
303
+ */
304
+ function castField(options) {
305
+ const { collection: collectionName, field, to, filter } = options;
306
+ assertRewritableField(collectionName, field);
307
+ if (!isConvertTarget(to)) throw mongoTargetError("MIGRATION.INVALID_OPERATION_ENTRY", `castField casts field "${field}" in collection ${collectionName} to "${to}", which $convert cannot cast to.`, { meta: {
308
+ context: "castField",
309
+ collection: collectionName,
310
+ field,
311
+ to
312
+ } });
313
+ const listOf = (types) => options.list === true ? `list of ${types}` : types;
314
+ const id = `field.${collectionName}.${field}.cast(${to})${idSuffix(filter)}`;
315
+ const toCast = documentsToCast(field, to, options);
316
+ return {
317
+ id,
318
+ meta: { rewrite: {
319
+ kind: "cast",
320
+ collection: collectionName,
321
+ field,
322
+ to
323
+ } },
324
+ label: `Cast field ${field} in collection ${collectionName}${options.from.length === 0 ? "" : ` from ${listOf(options.from.join(", "))}`} to ${listOf(to)}${labelSuffix(filter)}`,
325
+ operationClass: options.from.length > 0 && options.from.every((from) => convertKeepsEveryValue(from, to)) ? "widening" : "destructive",
326
+ name: id,
327
+ precheck: [],
328
+ run: [rewritePlan(collectionName, new RawUpdateManyCommand(collectionName, toCast, [{ $set: { [field]: castExpression(field, to, options.list === true) } }], { bypassDocumentValidation: true }))],
329
+ postcheck: [{
330
+ description: `no document in ${collectionName} holds ${field} as ${options.from.length === 0 ? `another type than ${to}` : `a type it is cast from, ${options.from.join(", ")}`}`,
331
+ source: rewritePlan(collectionName, new RawAggregateCommand(collectionName, [{ $match: toCast }, { $limit: 1 }])),
332
+ filter: MATCH_ALL_FILTER,
333
+ expect: "notExists"
334
+ }]
335
+ };
336
+ }
337
+ /**
338
+ * Sets a field to `value` in the documents where it is missing or `null`, skipping document
339
+ * validation, as a migration fills a new required field with a temporary value.
340
+ */
341
+ function fillField(options) {
342
+ const { collection: collectionName, field, value, filter } = options;
343
+ assertRewritableField(collectionName, field);
344
+ const id = `field.${collectionName}.${field}.fill${idSuffix(filter)}`;
345
+ const unfilled = documentsMissingOrNull(field);
346
+ const toFill = filter === void 0 ? unfilled : { $and: [filter, unfilled] };
347
+ return {
348
+ id,
349
+ meta: { rewrite: {
350
+ kind: "fill",
351
+ collection: collectionName,
352
+ field
353
+ } },
354
+ label: `Fill field ${field} in collection ${collectionName} where it is missing or null${labelSuffix(filter)}`,
355
+ operationClass: "widening",
356
+ name: id,
357
+ precheck: [],
358
+ run: [rawUpdateMany(collectionName, toFill, [{ $set: { [field]: value } }], { bypassDocumentValidation: true })],
359
+ postcheck: [{
360
+ description: `no document in ${collectionName} has ${field} missing or null`,
361
+ source: rawAggregate(collectionName, [{ $match: toFill }, { $limit: 1 }]),
362
+ filter: MATCH_ALL_FILTER,
363
+ expect: "notExists"
364
+ }]
365
+ };
366
+ }
164
367
  function formatKeys(keys) {
165
368
  return keys.map((k) => `${k.field}:${k.direction}`).join(", ");
166
369
  }
@@ -356,20 +559,25 @@ function renameCollection(from, to) {
356
559
  };
357
560
  }
358
561
  function setValidation(collectionName, schema, options) {
562
+ const validator = {
563
+ validator: { $jsonSchema: schema },
564
+ ...ifDefined("validationLevel", options?.validationLevel),
565
+ ...ifDefined("validationAction", options?.validationAction)
566
+ };
567
+ const checks = options?.checkDocuments === true ? collMod(collectionName, validator, { checkDocuments: true }) : {
568
+ precheck: [],
569
+ postcheck: []
570
+ };
359
571
  return {
360
572
  id: `collection.${collectionName}.setValidation`,
361
573
  label: `Set validation on ${collectionName}`,
362
574
  operationClass: "widening",
363
- precheck: [],
575
+ precheck: checks.precheck,
364
576
  execute: [{
365
577
  description: `set validation on ${collectionName}`,
366
- command: new CollModCommand(collectionName, {
367
- validator: { $jsonSchema: schema },
368
- ...ifDefined("validationLevel", options?.validationLevel),
369
- ...ifDefined("validationAction", options?.validationAction)
370
- })
578
+ command: new CollModCommand(collectionName, validator)
371
579
  }],
372
- postcheck: []
580
+ postcheck: checks.postcheck
373
581
  };
374
582
  }
375
583
  /**
@@ -381,8 +589,28 @@ function validatorBodyFilter(validator) {
381
589
  const { $jsonSchema, ...rest } = validator;
382
590
  return $jsonSchema !== void 0 && Object.keys(rest).length === 0 ? MongoFieldFilter.eq("options.validator.$jsonSchema", blindCast($jsonSchema)) : MongoFieldFilter.eq("options.validator", documentValue(validator));
383
591
  }
592
+ /**
593
+ * A check that no document of `collection` fails `validator`: an aggregate that matches the
594
+ * documents the validator rejects.
595
+ */
596
+ function documentsFitValidator(collection, validator) {
597
+ return {
598
+ description: `every document in ${collection} fits the new validator`,
599
+ source: {
600
+ collection,
601
+ command: new RawAggregateCommand(collection, [{ $match: { $nor: [validator] } }, { $limit: 1 }]),
602
+ meta: { ...RAW_PLAN_META }
603
+ },
604
+ filter: MongoExistsExpr.exists("_id"),
605
+ expect: "notExists"
606
+ };
607
+ }
384
608
  function collMod(collectionName, options, meta) {
385
609
  const hasValidator = options.validator != null && Object.keys(options.validator).length > 0;
610
+ if (meta?.checkDocuments === true && !hasValidator) throw mongoTargetError("MIGRATION.INVALID_OPERATION_ENTRY", `collMod of collection ${collectionName} checks the documents, but sets no validator to check them against.`, { meta: {
611
+ context: "collMod",
612
+ collection: collectionName
613
+ } });
386
614
  return {
387
615
  id: meta?.id ?? `collection.${collectionName}.collMod`,
388
616
  label: meta?.label ?? `Modify collection ${collectionName}`,
@@ -393,7 +621,7 @@ function collMod(collectionName, options, meta) {
393
621
  filter: MongoFieldFilter.eq("name", collectionName),
394
622
  expect: "exists",
395
623
  object: `collection "${collectionName}"`
396
- }] : [],
624
+ }, ...meta?.checkDocuments === true ? [documentsFitValidator(collectionName, options.validator)] : []] : [],
397
625
  execute: [{
398
626
  description: `modify ${collectionName}`,
399
627
  command: new CollModCommand(collectionName, options)
@@ -419,6 +647,6 @@ function validatedCollection(name, schema, indexes) {
419
647
  }), ...indexes.map((idx) => createIndex(name, idx.keys, idx.unique !== void 0 ? { unique: idx.unique } : void 0))];
420
648
  }
421
649
  //#endregion
422
- export { dropCollection as a, renameField as c, unsetField as d, validatedCollection as f, dataTransform as i, setValidation as l, createCollection as n, dropIndex as o, createIndex as r, renameCollection as s, collMod as t, unrewritableFieldNameReason as u };
650
+ export { setValidation as _, createIndex as a, validatedCollection as b, documentsNotOfType as c, fillField as d, isConvertTarget as f, renameField as g, renameCollection as h, createCollection as i, dropCollection as l, rawUpdateMany as m, castsFrom as n, dataTransform as o, rawAggregate as p, collMod as r, documentsMissingOrNull as s, castField as t, dropIndex as u, unrewritableFieldNameReason as v, unsetField as y };
423
651
 
424
- //# sourceMappingURL=migration-factories-oLRWgLGz-B9fWm8Wc.mjs.map
652
+ //# sourceMappingURL=migration-factories-C5ktmt8c-BP8k9SnZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-factories-C5ktmt8c-BP8k9SnZ.mjs","names":[],"sources":["../../../../3-targets/mongo/1-target/dist/migration-factories-C5ktmt8c.mjs"],"sourcesContent":["import { t as mongoTargetError } from \"./mongo-target-errors-Btf3ML1w.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { MONGO_INDEX_OPTION_KEYS, defaultMongoIndexName } from \"@internal/mongo-contract\";\nimport { CollModCommand, DropCollectionCommand, DropIndexCommand, ListCollectionsCommand, ListIndexesCommand, MongoAndExpr, MongoExistsExpr, MongoFieldFilter, MongoNotExpr, RenameCollectionCommand, buildIndexOpId, keysToKeySpec } from \"@internal/mongo-query-ast/control\";\nimport { RawAggregateCommand, RawUpdateManyCommand } from \"@internal/mongo-query-ast/execution\";\nimport { createFieldAccessor } from \"@internal/mongo-query-builder\";\nimport { collection } from \"@internal/mongo-query-builder/contract-free\";\n//#region src/core/migrations/bson-convert.ts\nconst NUMBERS = [\n\t\"double\",\n\t\"int\",\n\t\"long\",\n\t\"decimal\"\n];\n/**\n* For each BSON type a field can be cast to, the BSON types whose `$convert` result is what casting\n* the value means. `$convert` accepts more pairs than these; each one left off gives a result the\n* value did not mean:\n*\n* - `string` to `bool` is `true` for every non-empty string, `\"false\"` and `\"no\"` included.\n* - `objectId` or `date` to `bool` is always `true`.\n* - `bool` to a number is `1` or `0`, which a number field does not mean.\n* - `date` to `double`, `long` or `decimal` is milliseconds since the epoch, and a number to `date`\n* reads the number that way, a unit the value does not name.\n* - `objectId` to `date` is the time the id was made, not a date the document holds.\n*\n* See the MongoDB `$convert` reference.\n*/\nconst CASTS_FROM = {\n\tdouble: /* @__PURE__ */ new Set([...NUMBERS, \"string\"]),\n\tstring: /* @__PURE__ */ new Set([\n\t\t...NUMBERS,\n\t\t\"string\",\n\t\t\"bool\",\n\t\t\"date\",\n\t\t\"objectId\"\n\t]),\n\tobjectId: /* @__PURE__ */ new Set([\"string\", \"objectId\"]),\n\tbool: /* @__PURE__ */ new Set([...NUMBERS, \"bool\"]),\n\tdate: /* @__PURE__ */ new Set([\"string\", \"date\"]),\n\tint: /* @__PURE__ */ new Set([...NUMBERS, \"string\"]),\n\tlong: /* @__PURE__ */ new Set([...NUMBERS, \"string\"]),\n\tdecimal: /* @__PURE__ */ new Set([...NUMBERS, \"string\"])\n};\n/** The casts that keep every value: each source type with the types it widens to. */\nconst KEEPS_EVERY_VALUE = {\n\tint: /* @__PURE__ */ new Set([\n\t\t\"long\",\n\t\t\"double\",\n\t\t\"decimal\"\n\t]),\n\tlong: /* @__PURE__ */ new Set([\"decimal\"])\n};\nfunction isConvertTarget(to) {\n\treturn Object.hasOwn(CASTS_FROM, to);\n}\n/** Whether a cast with `$convert` from BSON type `from` to `to` keeps what the values mean, for the values it casts. */\nfunction castsFrom(from, to) {\n\treturn from === to || (CASTS_FROM[to]?.has(from) ?? false);\n}\n/** Whether casting a value of BSON type `from` to `to` keeps every value as it was. */\nfunction convertKeepsEveryValue(from, to) {\n\treturn from === to || (KEEPS_EVERY_VALUE[from]?.has(to) ?? false);\n}\n//#endregion\n//#region src/core/migrations/migration-factories.ts\nfunction isBuildable(value) {\n\tif (typeof value !== \"object\" || value === null || !(\"build\" in value)) return false;\n\treturn typeof Reflect.get(value, \"build\") === \"function\";\n}\nfunction resolveQuery(value) {\n\treturn isBuildable(value) ? value.build() : value;\n}\nconst MATCH_ALL_FILTER = MongoExistsExpr.exists(\"_id\");\nfunction dataTransform(name, options) {\n\tlet precheck = [];\n\tlet postcheck = [];\n\tif (options.check) {\n\t\tconst source = resolveQuery(options.check.source());\n\t\tconst filter = options.check.filter ?? MATCH_ALL_FILTER;\n\t\tconst description = options.check.description ?? `Check for data transform: ${name}`;\n\t\tconst precheckExpect = options.check.expect ?? \"exists\";\n\t\tconst postcheckExpect = precheckExpect === \"exists\" ? \"notExists\" : \"exists\";\n\t\tprecheck = [{\n\t\t\tdescription,\n\t\t\tsource,\n\t\t\tfilter,\n\t\t\texpect: precheckExpect\n\t\t}];\n\t\tpostcheck = [{\n\t\t\tdescription,\n\t\t\tsource,\n\t\t\tfilter,\n\t\t\texpect: postcheckExpect\n\t\t}];\n\t}\n\tconst run = [resolveQuery(options.run())];\n\treturn {\n\t\tid: `data_transform.${name}`,\n\t\tlabel: `Data transform: ${name}`,\n\t\toperationClass: \"data\",\n\t\tname,\n\t\t...ifDefined(\"invariantId\", options.invariantId),\n\t\tprecheck,\n\t\trun,\n\t\tpostcheck\n\t};\n}\n/** A raw `aggregate` on a collection, as a data transform's check reads documents. */\nfunction rawAggregate(collectionName, pipeline) {\n\treturn rewritePlan(collectionName, new RawAggregateCommand(collectionName, pipeline));\n}\n/**\n* A raw `updateMany` on a collection, which a data transform's run can make skip document\n* validation. `update` is an update document, such as `{ $set: { age: 0 } }`, or an aggregation\n* pipeline, such as `[{ $set: { age: { $toInt: '$age' } } }]`, which can read the document's own\n* values.\n*/\nfunction rawUpdateMany(collectionName, filter, update, options) {\n\treturn rewritePlan(collectionName, new RawUpdateManyCommand(collectionName, filter, update, ifDefined(\"bypassDocumentValidation\", options?.bypassDocumentValidation)));\n}\nfunction documentsHolding(fields, filter) {\n\tconst conditions = [...filter === void 0 ? [] : [filter], ...fields.map((field) => ({ [field]: { $exists: true } }))];\n\tconst [only] = conditions;\n\treturn conditions.length === 1 && only !== void 0 ? only : { $and: conditions };\n}\nconst UNREWRITABLE_FIELD_NAMES = [\n\t{\n\t\tmatches: (field) => field === \"\",\n\t\treason: \"it is empty\"\n\t},\n\t{\n\t\tmatches: (field) => field === \"_id\",\n\t\treason: \"MongoDB does not let a document change its _id\"\n\t},\n\t{\n\t\tmatches: (field) => field.includes(\".\"),\n\t\treason: \"MongoDB reads a name containing \\\".\\\" as a path into embedded documents\"\n\t},\n\t{\n\t\tmatches: (field) => field.startsWith(\"$\"),\n\t\treason: \"MongoDB reads a name starting with \\\"$\\\" as an operator\"\n\t}\n];\n/** Why `renameField` and `unsetField` cannot rewrite a field of this name, if they cannot. */\nfunction unrewritableFieldNameReason(field) {\n\treturn UNREWRITABLE_FIELD_NAMES.find((rule) => rule.matches(field))?.reason;\n}\n/** The plan meta of the raw queries a migration's operations run and check with. */\nconst RAW_PLAN_META = {\n\ttarget: \"mongo\",\n\tstorageHash: \"\",\n\tlane: \"mongo-raw\"\n};\nfunction assertRewritableField(collectionName, field) {\n\tconst reason = unrewritableFieldNameReason(field);\n\tif (reason === void 0) return;\n\tthrow mongoTargetError(\"MIGRATION.FIELD_NAME_UNSUPPORTED\", `Field \"${field}\" in collection ${collectionName} cannot be rewritten: ${reason}.`, { meta: {\n\t\tcollection: collectionName,\n\t\tfield,\n\t\treason\n\t} });\n}\nfunction rewritePlan(collectionName, command) {\n\treturn {\n\t\tcollection: collectionName,\n\t\tcommand,\n\t\tmeta: { ...RAW_PLAN_META }\n\t};\n}\nfunction noDocumentHolds(collectionName, fields, filter) {\n\treturn {\n\t\tdescription: `no document in ${collectionName} holds ${fields.length === 1 ? fields[0] : `both ${fields.join(\" and \")}`}`,\n\t\tsource: rewritePlan(collectionName, new RawAggregateCommand(collectionName, [{ $match: documentsHolding(fields, filter) }, { $limit: 1 }])),\n\t\tfilter: MATCH_ALL_FILTER,\n\t\texpect: \"notExists\"\n\t};\n}\nfunction rewriteUpdate(collectionName, field, filter, update) {\n\treturn rewritePlan(collectionName, new RawUpdateManyCommand(collectionName, documentsHolding([field], filter), update, { bypassDocumentValidation: true }));\n}\nfunction idSuffix(filter) {\n\treturn filter === void 0 ? \"\" : `.where(${JSON.stringify(filter)})`;\n}\nfunction valueList(values) {\n\treturn values.map((value) => JSON.stringify(value)).join(\", \");\n}\n/** A field condition in words: `type is \"bug\"`, `type is not \"bug\"`, `type is none of \"bug\", \"task\"`. */\nfunction conditionInWords(field, condition) {\n\tconst excluded = typeof condition === \"object\" && condition !== null && !Array.isArray(condition) ? Reflect.get(condition, \"$nin\") : void 0;\n\tif (Array.isArray(excluded)) return excluded.length === 1 ? `${field} is not ${valueList(excluded)}` : `${field} is none of ${valueList(excluded)}`;\n\treturn typeof condition === \"object\" && condition !== null ? void 0 : `${field} is ${JSON.stringify(condition)}`;\n}\n/** The documents a filter selects, in words where the planner wrote it, for an operation's label. */\nfunction labelSuffix(filter) {\n\tif (filter === void 0) return \"\";\n\tconst words = Object.entries(filter).map(([field, condition]) => conditionInWords(field, condition));\n\treturn words.every((word) => word !== void 0) && words.length > 0 ? ` in documents whose ${words.join(\" and \")}` : ` in documents matching ${JSON.stringify(filter)}`;\n}\nfunction renameField(collectionName, from, to, options) {\n\tassertRewritableField(collectionName, from);\n\tassertRewritableField(collectionName, to);\n\tif (from === to) throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", `renameField renames field \"${from}\" in collection ${collectionName} to its own name.`, { meta: {\n\t\tcontext: \"renameField\",\n\t\tcollection: collectionName,\n\t\tfield: from,\n\t\treason: \"the new name is the old name\"\n\t} });\n\tconst filter = options?.filter;\n\tconst id = `field.${collectionName}.${from}.rename(${to})${idSuffix(filter)}`;\n\treturn {\n\t\tid,\n\t\tlabel: `Rename field ${from} to ${to} in collection ${collectionName}${labelSuffix(filter)}`,\n\t\toperationClass: \"widening\",\n\t\tname: id,\n\t\tprecheck: [noDocumentHolds(collectionName, [from, to], filter)],\n\t\trun: [rewriteUpdate(collectionName, from, filter, { $rename: { [from]: to } })],\n\t\tpostcheck: [noDocumentHolds(collectionName, [from], filter)]\n\t};\n}\nfunction unsetField(collectionName, field, options) {\n\tassertRewritableField(collectionName, field);\n\tconst filter = options?.filter;\n\tconst id = `field.${collectionName}.${field}.unset${idSuffix(filter)}`;\n\treturn {\n\t\tid,\n\t\tlabel: `Remove field ${field} from collection ${collectionName}${labelSuffix(filter)}`,\n\t\toperationClass: \"destructive\",\n\t\tname: id,\n\t\tprecheck: [],\n\t\trun: [rewriteUpdate(collectionName, field, filter, { $unset: { [field]: \"\" } })],\n\t\tpostcheck: [noDocumentHolds(collectionName, [field], filter)]\n\t};\n}\n/**\n* The documents whose field holds a value of none of the BSON types `types`, or, for a list, an\n* element of none of them. A single value is read with `$expr`, since a query's `$type` and `$ne`\n* look at the elements of a list.\n*/\nfunction documentsNotOfType(field, shape) {\n\tif (shape.list) return { [field]: { $elemMatch: {\n\t\t$ne: null,\n\t\t$not: { $type: [...shape.types] }\n\t} } };\n\treturn { $expr: { $not: { $in: [{ $type: `$${field}` }, [\n\t\t\"missing\",\n\t\t\"null\",\n\t\t...shape.types\n\t]] } } };\n}\n/** The documents where the field is missing or holds `null`, read with `$expr` so a list holding `null` is not one. */\nfunction documentsMissingOrNull(field) {\n\treturn { $expr: { $in: [{ $type: `$${field}` }, [\"missing\", \"null\"]] } };\n}\nconst NUMBER_TYPES = [\n\t\"int\",\n\t\"long\",\n\t\"double\",\n\t\"decimal\"\n];\n/**\n* The documents whose field holds a value of one of the BSON types `types`, or, for a list, an\n* element of one of them. A single value is read with `$expr`, since a query's `$type` looks at the\n* elements of a list.\n*/\nfunction documentsOfType(field, shape) {\n\tif (shape.list) return { [field]: { $elemMatch: { $type: [...shape.types] } } };\n\treturn { $expr: { $in: [{ $type: `$${field}` }, [...shape.types]] } };\n}\n/**\n* The documents the cast changes: those holding a value of a type it is planned from, other than\n* `to`. A value of any other type is left as it is, for the validator change's document check to\n* name. A cast planned from no type casts every value that is not of type `to`.\n*/\nfunction documentsToCast(field, to, options) {\n\tconst list = options.list === true;\n\tconst from = [...new Set(options.from.flatMap((type) => type === \"number\" ? NUMBER_TYPES : [type]))].filter((type) => type !== to);\n\tconst condition = options.from.length === 0 ? documentsNotOfType(field, {\n\t\ttypes: [to],\n\t\tlist\n\t}) : documentsOfType(field, {\n\t\ttypes: from,\n\t\tlist\n\t});\n\treturn options.filter === void 0 ? condition : { $and: [options.filter, condition] };\n}\nfunction castExpression(field, to, list) {\n\treturn list ? { $map: {\n\t\tinput: `$${field}`,\n\t\tas: \"value\",\n\t\tin: { $convert: {\n\t\t\tinput: \"$$value\",\n\t\t\tto\n\t\t} }\n\t} } : { $convert: {\n\t\tinput: `$${field}`,\n\t\tto\n\t} };\n}\n/**\n* Casts a field to the BSON type `to` with `$convert`, in the documents where it holds another\n* type. A value `$convert` cannot cast fails the update. Widening when every type in `from` casts\n* to `to` keeping its value, destructive otherwise.\n*/\nfunction castField(options) {\n\tconst { collection: collectionName, field, to, filter } = options;\n\tassertRewritableField(collectionName, field);\n\tif (!isConvertTarget(to)) throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", `castField casts field \"${field}\" in collection ${collectionName} to \"${to}\", which $convert cannot cast to.`, { meta: {\n\t\tcontext: \"castField\",\n\t\tcollection: collectionName,\n\t\tfield,\n\t\tto\n\t} });\n\tconst listOf = (types) => options.list === true ? `list of ${types}` : types;\n\tconst id = `field.${collectionName}.${field}.cast(${to})${idSuffix(filter)}`;\n\tconst toCast = documentsToCast(field, to, options);\n\treturn {\n\t\tid,\n\t\tmeta: { rewrite: {\n\t\t\tkind: \"cast\",\n\t\t\tcollection: collectionName,\n\t\t\tfield,\n\t\t\tto\n\t\t} },\n\t\tlabel: `Cast field ${field} in collection ${collectionName}${options.from.length === 0 ? \"\" : ` from ${listOf(options.from.join(\", \"))}`} to ${listOf(to)}${labelSuffix(filter)}`,\n\t\toperationClass: options.from.length > 0 && options.from.every((from) => convertKeepsEveryValue(from, to)) ? \"widening\" : \"destructive\",\n\t\tname: id,\n\t\tprecheck: [],\n\t\trun: [rewritePlan(collectionName, new RawUpdateManyCommand(collectionName, toCast, [{ $set: { [field]: castExpression(field, to, options.list === true) } }], { bypassDocumentValidation: true }))],\n\t\tpostcheck: [{\n\t\t\tdescription: `no document in ${collectionName} holds ${field} as ${options.from.length === 0 ? `another type than ${to}` : `a type it is cast from, ${options.from.join(\", \")}`}`,\n\t\t\tsource: rewritePlan(collectionName, new RawAggregateCommand(collectionName, [{ $match: toCast }, { $limit: 1 }])),\n\t\t\tfilter: MATCH_ALL_FILTER,\n\t\t\texpect: \"notExists\"\n\t\t}]\n\t};\n}\n/**\n* Sets a field to `value` in the documents where it is missing or `null`, skipping document\n* validation, as a migration fills a new required field with a temporary value.\n*/\nfunction fillField(options) {\n\tconst { collection: collectionName, field, value, filter } = options;\n\tassertRewritableField(collectionName, field);\n\tconst id = `field.${collectionName}.${field}.fill${idSuffix(filter)}`;\n\tconst unfilled = documentsMissingOrNull(field);\n\tconst toFill = filter === void 0 ? unfilled : { $and: [filter, unfilled] };\n\treturn {\n\t\tid,\n\t\tmeta: { rewrite: {\n\t\t\tkind: \"fill\",\n\t\t\tcollection: collectionName,\n\t\t\tfield\n\t\t} },\n\t\tlabel: `Fill field ${field} in collection ${collectionName} where it is missing or null${labelSuffix(filter)}`,\n\t\toperationClass: \"widening\",\n\t\tname: id,\n\t\tprecheck: [],\n\t\trun: [rawUpdateMany(collectionName, toFill, [{ $set: { [field]: value } }], { bypassDocumentValidation: true })],\n\t\tpostcheck: [{\n\t\t\tdescription: `no document in ${collectionName} has ${field} missing or null`,\n\t\t\tsource: rawAggregate(collectionName, [{ $match: toFill }, { $limit: 1 }]),\n\t\t\tfilter: MATCH_ALL_FILTER,\n\t\t\texpect: \"notExists\"\n\t\t}]\n\t};\n}\nfunction formatKeys(keys) {\n\treturn keys.map((k) => `${k.field}:${k.direction}`).join(\", \");\n}\n/** What an index content check matches: the index's keys and options in its collection, whatever its name. */\nfunction indexObject(collectionName, keys) {\n\tif (isTextIndex(keys)) return `a text index in \"${collectionName}\"`;\n\treturn `an index on { ${keys.map((key) => `${key.field}: ${JSON.stringify(key.direction)}`).join(\", \")} } in \"${collectionName}\"`;\n}\nfunction namedIndexObject(collectionName, name) {\n\treturn `an index named \"${name}\" in \"${collectionName}\"`;\n}\nfunction nameFilter(name) {\n\treturn MongoFieldFilter.eq(\"name\", name);\n}\nfunction isTextIndex(keys) {\n\treturn keys.some((k) => k.direction === \"text\");\n}\nfunction keyFilter(keys) {\n\tconst f = createFieldAccessor();\n\treturn isTextIndex(keys) ? f.rawPath(\"key._fts\").eq(\"text\") : f.key.eq(blindCast(keysToKeySpec(keys)));\n}\nfunction documentValue(document) {\n\treturn blindCast(document);\n}\n/** MongoDB stores a text index's text fields as `_fts` and `_ftsx` in the place of the first one. */\nfunction textIndexKeySpec(keys) {\n\tconst spec = {};\n\tfor (const key of keys) if (key.direction !== \"text\") spec[key.field] = key.direction;\n\telse if (!Object.hasOwn(spec, \"_fts\")) Object.assign(spec, {\n\t\t_fts: \"text\",\n\t\t_ftsx: 1\n\t});\n\treturn spec;\n}\n/** MongoDB lists every text field's weight, 1 when none is given, ordered by field name. */\nfunction textIndexWeights(keys, weights) {\n\tconst fields = keys.filter((key) => key.direction === \"text\").map((key) => key.field);\n\treturn Object.fromEntries(fields.sort().map((field) => [field, weights?.[field] ?? 1]));\n}\nfunction flagFilter(field, on) {\n\tconst set = MongoFieldFilter.eq(field, true);\n\treturn on ? set : new MongoNotExpr(set);\n}\nfunction optionFilter(field, value) {\n\treturn value === void 0 ? MongoExistsExpr.notExists(field) : MongoFieldFilter.eq(field, value);\n}\n/**\n* MongoDB completes a collation with its defaults, so only the fields the call gives are compared, as\n* the verifier does. An index with no collation must have none.\n*/\nfunction collationFilters(collation) {\n\tif (collation === void 0) return [MongoExistsExpr.notExists(\"collation\")];\n\treturn Object.entries(collation).map(([option, value]) => MongoFieldFilter.eq(`collation.${option}`, blindCast(value)));\n}\nconst textIndexOnly = (filter) => (options, keys) => isTextIndex(keys) ? filter(options, keys) : [];\nconst INDEX_OPTION_FILTERS = {\n\tunique: (options) => [flagFilter(\"unique\", options?.unique)],\n\tsparse: (options) => [flagFilter(\"sparse\", options?.sparse)],\n\texpireAfterSeconds: (options) => [optionFilter(\"expireAfterSeconds\", options?.expireAfterSeconds)],\n\tpartialFilterExpression: (options) => [optionFilter(\"partialFilterExpression\", options?.partialFilterExpression && documentValue(options.partialFilterExpression))],\n\twildcardProjection: (options) => [optionFilter(\"wildcardProjection\", options?.wildcardProjection && documentValue(options.wildcardProjection))],\n\tcollation: (options) => collationFilters(options?.collation),\n\tweights: textIndexOnly((options, keys) => [MongoFieldFilter.eq(\"weights\", documentValue(textIndexWeights(keys, options?.weights)))]),\n\tdefault_language: textIndexOnly((options) => [MongoFieldFilter.eq(\"default_language\", options?.default_language ?? TEXT_INDEX_DEFAULT_LANGUAGE)]),\n\tlanguage_override: textIndexOnly((options) => [MongoFieldFilter.eq(\"language_override\", options?.language_override ?? TEXT_INDEX_DEFAULT_LANGUAGE_OVERRIDE)])\n};\nfunction indexDefinitionFilter(keys, options) {\n\treturn MongoAndExpr.of([isTextIndex(keys) ? MongoFieldFilter.eq(\"key\", documentValue(textIndexKeySpec(keys))) : keyFilter(keys), ...MONGO_INDEX_OPTION_KEYS.flatMap((option) => INDEX_OPTION_FILTERS[option](options, keys))]);\n}\nconst TEXT_INDEX_DEFAULT_LANGUAGE = \"english\";\nconst TEXT_INDEX_DEFAULT_LANGUAGE_OVERRIDE = \"language\";\n/**\n* Creates an index under `options.name`, or under the name MongoDB would give it when the call gives none. The precheck requires that the collection holds no index with that name and none with the same keys and options; the postcheck requires an index with that name, keys and options.\n*/\nfunction createIndex(collectionName, keys, options) {\n\tconst name = options?.name ?? defaultMongoIndexName(keys);\n\tconst definition = indexDefinitionFilter(keys, options);\n\treturn {\n\t\tid: buildIndexOpId(\"create\", collectionName, name),\n\t\tlabel: `Create index ${name} on ${collectionName} (${formatKeys(keys)})`,\n\t\toperationClass: \"additive\",\n\t\tprecheck: [{\n\t\t\tdescription: `no index named ${name} exists on ${collectionName}`,\n\t\t\tsource: new ListIndexesCommand(collectionName),\n\t\t\tfilter: nameFilter(name),\n\t\t\texpect: \"notExists\",\n\t\t\tobject: namedIndexObject(collectionName, name)\n\t\t}, {\n\t\t\tdescription: `no index with the same keys and options exists on ${collectionName}`,\n\t\t\tsource: new ListIndexesCommand(collectionName),\n\t\t\tfilter: definition,\n\t\t\texpect: \"notExists\",\n\t\t\tobject: indexObject(collectionName, keys)\n\t\t}],\n\t\texecute: [{\n\t\t\tdescription: `create index ${name} on ${collectionName}`,\n\t\t\tcommand: collection(collectionName).createIndex(keys, {\n\t\t\t\t...options,\n\t\t\t\tname\n\t\t\t})\n\t\t}],\n\t\tpostcheck: [{\n\t\t\tdescription: `index ${name} exists on ${collectionName}`,\n\t\t\tsource: new ListIndexesCommand(collectionName),\n\t\t\tfilter: MongoAndExpr.of([nameFilter(name), definition]),\n\t\t\texpect: \"exists\"\n\t\t}]\n\t};\n}\n/**\n* Drops the index named `options.name`, or the name MongoDB would give the keys when the call gives none. `options` lists every option the index has, as `migration plan` writes them: the precheck requires an index with that name, those keys and exactly those options, so an option left out must be absent from the index. A call without options checks the keys only. The postcheck requires that no index with that name is left.\n*/\nfunction dropIndex(collectionName, keys, options) {\n\tconst name = options?.name ?? defaultMongoIndexName(keys);\n\tconst content = options === void 0 ? keyFilter(keys) : indexDefinitionFilter(keys, options);\n\treturn {\n\t\tid: buildIndexOpId(\"drop\", collectionName, name),\n\t\tlabel: `Drop index ${name} on ${collectionName} (${formatKeys(keys)})`,\n\t\toperationClass: \"widening\",\n\t\tprecheck: [{\n\t\t\tdescription: `index ${name} exists on ${collectionName} with the expected keys and options`,\n\t\t\tsource: new ListIndexesCommand(collectionName),\n\t\t\tfilter: MongoAndExpr.of([nameFilter(name), content]),\n\t\t\texpect: \"exists\",\n\t\t\tobject: namedIndexObject(collectionName, name)\n\t\t}],\n\t\texecute: [{\n\t\t\tdescription: `drop index ${name} on ${collectionName}`,\n\t\t\tcommand: new DropIndexCommand(collectionName, name)\n\t\t}],\n\t\tpostcheck: [{\n\t\t\tdescription: `index ${name} no longer exists on ${collectionName}`,\n\t\t\tsource: new ListIndexesCommand(collectionName),\n\t\t\tfilter: nameFilter(name),\n\t\t\texpect: \"notExists\",\n\t\t\tobject: namedIndexObject(collectionName, name)\n\t\t}]\n\t};\n}\nfunction createCollection(collectionName, options) {\n\tconst f = createFieldAccessor();\n\treturn {\n\t\tid: `collection.${collectionName}.create`,\n\t\tlabel: `Create collection ${collectionName}`,\n\t\toperationClass: \"additive\",\n\t\tprecheck: [{\n\t\t\tdescription: `collection ${collectionName} does not exist`,\n\t\t\tsource: new ListCollectionsCommand(),\n\t\t\tfilter: f.name.eq(collectionName),\n\t\t\texpect: \"notExists\",\n\t\t\tobject: `collection \"${collectionName}\"`\n\t\t}],\n\t\texecute: [{\n\t\t\tdescription: `create collection ${collectionName}`,\n\t\t\tcommand: collection(collectionName).createCollection(options)\n\t\t}],\n\t\tpostcheck: []\n\t};\n}\nfunction dropCollection(collectionName) {\n\treturn {\n\t\tid: `collection.${collectionName}.drop`,\n\t\tlabel: `Drop collection ${collectionName}`,\n\t\toperationClass: \"destructive\",\n\t\tprecheck: [],\n\t\texecute: [{\n\t\t\tdescription: `drop collection ${collectionName}`,\n\t\t\tcommand: new DropCollectionCommand(collectionName)\n\t\t}],\n\t\tpostcheck: []\n\t};\n}\nfunction collectionCheck(name, expect) {\n\treturn {\n\t\tdescription: expect === \"exists\" ? `collection ${name} exists` : `collection ${name} does not exist`,\n\t\tsource: new ListCollectionsCommand(),\n\t\tfilter: MongoFieldFilter.eq(\"name\", name),\n\t\texpect,\n\t\tobject: `collection \"${name}\"`\n\t};\n}\nfunction renameCollection(from, to) {\n\treturn {\n\t\tid: `collection.${from}.rename(${to})`,\n\t\tlabel: `Rename collection ${from} to ${to}`,\n\t\toperationClass: \"widening\",\n\t\tprecheck: [collectionCheck(from, \"exists\"), collectionCheck(to, \"notExists\")],\n\t\texecute: [{\n\t\t\tdescription: `rename collection ${from} to ${to}`,\n\t\t\tcommand: new RenameCollectionCommand(from, to)\n\t\t}],\n\t\tpostcheck: [collectionCheck(to, \"exists\"), collectionCheck(from, \"notExists\")]\n\t};\n}\nfunction setValidation(collectionName, schema, options) {\n\tconst validator = {\n\t\tvalidator: { $jsonSchema: schema },\n\t\t...ifDefined(\"validationLevel\", options?.validationLevel),\n\t\t...ifDefined(\"validationAction\", options?.validationAction)\n\t};\n\tconst checks = options?.checkDocuments === true ? collMod(collectionName, validator, { checkDocuments: true }) : {\n\t\tprecheck: [],\n\t\tpostcheck: []\n\t};\n\treturn {\n\t\tid: `collection.${collectionName}.setValidation`,\n\t\tlabel: `Set validation on ${collectionName}`,\n\t\toperationClass: \"widening\",\n\t\tprecheck: checks.precheck,\n\t\texecute: [{\n\t\t\tdescription: `set validation on ${collectionName}`,\n\t\t\tcommand: new CollModCommand(collectionName, validator)\n\t\t}],\n\t\tpostcheck: checks.postcheck\n\t};\n}\n/**\n* Matches the collection's validator body. MongoDB returns the validator through `listCollections`\n* with its keys in the order given, so the order-sensitive comparison holds once the collMod ran; a\n* validator written by hand with another key order only makes the collMod run again.\n*/\nfunction validatorBodyFilter(validator) {\n\tconst { $jsonSchema, ...rest } = validator;\n\treturn $jsonSchema !== void 0 && Object.keys(rest).length === 0 ? MongoFieldFilter.eq(\"options.validator.$jsonSchema\", blindCast($jsonSchema)) : MongoFieldFilter.eq(\"options.validator\", documentValue(validator));\n}\n/**\n* A check that no document of `collection` fails `validator`: an aggregate that matches the\n* documents the validator rejects.\n*/\nfunction documentsFitValidator(collection, validator) {\n\treturn {\n\t\tdescription: `every document in ${collection} fits the new validator`,\n\t\tsource: {\n\t\t\tcollection,\n\t\t\tcommand: new RawAggregateCommand(collection, [{ $match: { $nor: [validator] } }, { $limit: 1 }]),\n\t\t\tmeta: { ...RAW_PLAN_META }\n\t\t},\n\t\tfilter: MongoExistsExpr.exists(\"_id\"),\n\t\texpect: \"notExists\"\n\t};\n}\nfunction collMod(collectionName, options, meta) {\n\tconst hasValidator = options.validator != null && Object.keys(options.validator).length > 0;\n\tif (meta?.checkDocuments === true && !hasValidator) throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", `collMod of collection ${collectionName} checks the documents, but sets no validator to check them against.`, { meta: {\n\t\tcontext: \"collMod\",\n\t\tcollection: collectionName\n\t} });\n\treturn {\n\t\tid: meta?.id ?? `collection.${collectionName}.collMod`,\n\t\tlabel: meta?.label ?? `Modify collection ${collectionName}`,\n\t\toperationClass: meta?.operationClass ?? \"widening\",\n\t\tprecheck: options.validator != null ? [{\n\t\t\tdescription: `collection ${collectionName} exists`,\n\t\t\tsource: new ListCollectionsCommand(),\n\t\t\tfilter: MongoFieldFilter.eq(\"name\", collectionName),\n\t\t\texpect: \"exists\",\n\t\t\tobject: `collection \"${collectionName}\"`\n\t\t}, ...meta?.checkDocuments === true ? [documentsFitValidator(collectionName, options.validator)] : []] : [],\n\t\texecute: [{\n\t\t\tdescription: `modify ${collectionName}`,\n\t\t\tcommand: new CollModCommand(collectionName, options)\n\t\t}],\n\t\tpostcheck: hasValidator ? [{\n\t\t\tdescription: `validator applied on ${collectionName}`,\n\t\t\tsource: new ListCollectionsCommand(),\n\t\t\tfilter: MongoAndExpr.of([\n\t\t\t\tMongoFieldFilter.eq(\"name\", collectionName),\n\t\t\t\t...options.validationLevel ? [MongoFieldFilter.eq(\"options.validationLevel\", options.validationLevel)] : [],\n\t\t\t\t...options.validationAction ? [MongoFieldFilter.eq(\"options.validationAction\", options.validationAction)] : [],\n\t\t\t\tvalidatorBodyFilter(options.validator ?? {})\n\t\t\t]),\n\t\t\texpect: \"exists\"\n\t\t}] : []\n\t};\n}\nfunction validatedCollection(name, schema, indexes) {\n\treturn [createCollection(name, {\n\t\tvalidator: { $jsonSchema: schema },\n\t\tvalidationLevel: \"strict\",\n\t\tvalidationAction: \"error\"\n\t}), ...indexes.map((idx) => createIndex(name, idx.keys, idx.unique !== void 0 ? { unique: idx.unique } : void 0))];\n}\n//#endregion\nexport { unsetField as _, dataTransform as a, isConvertTarget as b, dropCollection as c, rawAggregate as d, rawUpdateMany as f, unrewritableFieldNameReason as g, setValidation as h, createIndex as i, dropIndex as l, renameField as m, collMod as n, documentsMissingOrNull as o, renameCollection as p, createCollection as r, documentsNotOfType as s, castField as t, fillField as u, validatedCollection as v, castsFrom as y };\n\n//# sourceMappingURL=migration-factories-C5ktmt8c.mjs.map"],"mappings":";;;;;;;;;AASA,MAAM,UAAU;CACf;CACA;CACA;CACA;AACD;;;;;;;;;;;;;;;AAeA,MAAM,aAAa;CAClB,wBAAwB,IAAI,IAAI,CAAC,GAAG,SAAS,QAAQ,CAAC;CACtD,wBAAwB,IAAI,IAAI;EAC/B,GAAG;EACH;EACA;EACA;EACA;CACD,CAAC;CACD,0BAA0B,IAAI,IAAI,CAAC,UAAU,UAAU,CAAC;CACxD,sBAAsB,IAAI,IAAI,CAAC,GAAG,SAAS,MAAM,CAAC;CAClD,sBAAsB,IAAI,IAAI,CAAC,UAAU,MAAM,CAAC;CAChD,qBAAqB,IAAI,IAAI,CAAC,GAAG,SAAS,QAAQ,CAAC;CACnD,sBAAsB,IAAI,IAAI,CAAC,GAAG,SAAS,QAAQ,CAAC;CACpD,yBAAyB,IAAI,IAAI,CAAC,GAAG,SAAS,QAAQ,CAAC;AACxD;;AAEA,MAAM,oBAAoB;CACzB,qBAAqB,IAAI,IAAI;EAC5B;EACA;EACA;CACD,CAAC;CACD,sBAAsB,IAAI,IAAI,CAAC,SAAS,CAAC;AAC1C;AACA,SAAS,gBAAgB,IAAI;CAC5B,OAAO,OAAO,OAAO,YAAY,EAAE;AACpC;;AAEA,SAAS,UAAU,MAAM,IAAI;CAC5B,OAAO,SAAS,OAAO,WAAW,GAAG,EAAE,IAAI,IAAI,KAAK;AACrD;;AAEA,SAAS,uBAAuB,MAAM,IAAI;CACzC,OAAO,SAAS,OAAO,kBAAkB,KAAK,EAAE,IAAI,EAAE,KAAK;AAC5D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