@prisma/orm-target-mongo 8.0.0-rc.23-dev.9 → 8.0.0-rc.23-dev.11

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 (78) hide show
  1. package/README.md +2 -0
  2. package/dist/adapter.mjs +2 -2
  3. package/dist/adapter__control.mjs +1 -1
  4. package/dist/adapter__runtime.mjs +7 -2
  5. package/dist/adapter__runtime.mjs.map +1 -1
  6. package/dist/codec-ids-B8WIyai-.d.mts +25 -0
  7. package/dist/{codec-ids-BKQbXhZt.d.mts.map → codec-ids-B8WIyai-.d.mts.map} +1 -1
  8. package/dist/codec-ids-DZQsuh80-ywDzfnAg.mjs +25 -0
  9. package/dist/codec-ids-DZQsuh80-ywDzfnAg.mjs.map +1 -0
  10. package/dist/{codec-types-oKxM85p-.d.mts → codec-types-C6UDhw7l.d.mts} +37 -1
  11. package/dist/codec-types-C6UDhw7l.d.mts.map +1 -0
  12. package/dist/codecs-BbX2VMzN-Dm9db3Jz.mjs +620 -0
  13. package/dist/codecs-BbX2VMzN-Dm9db3Jz.mjs.map +1 -0
  14. package/dist/{control-CdHPs2QG.mjs → control-B77seMDK.mjs} +7 -4
  15. package/dist/control-B77seMDK.mjs.map +1 -0
  16. package/dist/{control-DfDVW_9x.mjs → control-CHr0ZjKM.mjs} +2 -2
  17. package/dist/{control-DfDVW_9x.mjs.map → control-CHr0ZjKM.mjs.map} +1 -1
  18. package/dist/{data-types-hoKLBrYZ-h9cAgbOy.mjs → data-types-Cq1kg82y-Vk7z6rnW.mjs} +88 -5
  19. package/dist/data-types-Cq1kg82y-Vk7z6rnW.mjs.map +1 -0
  20. package/dist/data-types-ozSM4YdB.d.mts +39 -0
  21. package/dist/data-types-ozSM4YdB.d.mts.map +1 -0
  22. package/dist/date-time-now-generators-fWUk_--7-BnCnC0d8.mjs +66 -0
  23. package/dist/date-time-now-generators-fWUk_--7-BnCnC0d8.mjs.map +1 -0
  24. package/dist/{descriptor-meta-_vnrMWD4-CXzRuo6u.mjs → descriptor-meta-CFsOxO6g-Ca8valmZ.mjs} +204 -20
  25. package/dist/descriptor-meta-CFsOxO6g-Ca8valmZ.mjs.map +1 -0
  26. package/dist/{descriptor-meta-runtime-M_DCE9pk-BltR3MLY.mjs → descriptor-meta-runtime-CBJIjp5R-DMQ9-3Hd.mjs} +4 -4
  27. package/dist/{descriptor-meta-runtime-M_DCE9pk-BltR3MLY.mjs.map → descriptor-meta-runtime-CBJIjp5R-DMQ9-3Hd.mjs.map} +1 -1
  28. package/dist/driver.mjs +1 -1
  29. package/dist/driver__control.mjs +1 -1
  30. package/dist/driver__runtime.mjs +1 -1
  31. package/dist/driver__runtime.mjs.map +1 -1
  32. package/dist/{migration-factories-CUyEIo5p-CXTwpgxe.mjs → migration-factories-oLRWgLGz-B9fWm8Wc.mjs} +3 -3
  33. package/dist/{migration-factories-CUyEIo5p-CXTwpgxe.mjs.map → migration-factories-oLRWgLGz-B9fWm8Wc.mjs.map} +1 -1
  34. package/dist/{mongo-adapter-RJ_YOxiK-yG_qHDyR.mjs → mongo-adapter-RJ_YOxiK-jlyFS6Wr.mjs} +3 -3
  35. package/dist/{mongo-adapter-RJ_YOxiK-yG_qHDyR.mjs.map → mongo-adapter-RJ_YOxiK-jlyFS6Wr.mjs.map} +1 -1
  36. package/dist/{mongo-driver-DGpvEBcg-DD5q-5iT.mjs → mongo-driver-CSDRQwak-j3pdkDuW.mjs} +3 -3
  37. package/dist/mongo-driver-CSDRQwak-j3pdkDuW.mjs.map +1 -0
  38. package/dist/{pack-BJLQkv5o.d.mts → pack-FzGKNW0Q.d.mts} +358 -38
  39. package/dist/pack-FzGKNW0Q.d.mts.map +1 -0
  40. package/dist/{prisma6-binding-BuMRLaNZ.mjs → prisma6-binding-BjKPGVql.mjs} +3 -3
  41. package/dist/{prisma6-binding-BuMRLaNZ.mjs.map → prisma6-binding-BjKPGVql.mjs.map} +1 -1
  42. package/dist/runtime-C-5ghims.d.mts +42 -0
  43. package/dist/runtime-C-5ghims.d.mts.map +1 -0
  44. package/dist/{runtime-Jc2oA31j.mjs → runtime-DyWNR1FZ.mjs} +2 -2
  45. package/dist/runtime-DyWNR1FZ.mjs.map +1 -0
  46. package/dist/target.d.mts +6 -6
  47. package/dist/target.mjs +8 -7
  48. package/dist/target__codec-ids.d.mts +2 -2
  49. package/dist/target__codec-ids.mjs +2 -2
  50. package/dist/target__codec-types.d.mts +1 -1
  51. package/dist/target__codecs.mjs +1 -1
  52. package/dist/target__control.mjs +1 -1
  53. package/dist/target__data-types.d.mts +2 -2
  54. package/dist/target__data-types.mjs +2 -2
  55. package/dist/target__migration.mjs +1 -1
  56. package/dist/target__pack.d.mts +2 -2
  57. package/dist/target__pack.mjs +1 -1
  58. package/dist/target__pack.mjs.map +1 -1
  59. package/dist/target__prisma6-binding.mjs +1 -1
  60. package/dist/target__runtime.d.mts +2 -2
  61. package/dist/target__runtime.mjs +3 -2
  62. package/package.json +17 -12
  63. package/dist/codec-ids-BKQbXhZt.d.mts +0 -18
  64. package/dist/codec-ids-WdrumsYA-CZVjuKW8.mjs +0 -18
  65. package/dist/codec-ids-WdrumsYA-CZVjuKW8.mjs.map +0 -1
  66. package/dist/codec-types-oKxM85p-.d.mts.map +0 -1
  67. package/dist/codecs-_QYfn0YT-BWZI19N1.mjs +0 -342
  68. package/dist/codecs-_QYfn0YT-BWZI19N1.mjs.map +0 -1
  69. package/dist/control-CdHPs2QG.mjs.map +0 -1
  70. package/dist/data-types-LShlnAUM.d.mts +0 -25
  71. package/dist/data-types-LShlnAUM.d.mts.map +0 -1
  72. package/dist/data-types-hoKLBrYZ-h9cAgbOy.mjs.map +0 -1
  73. package/dist/descriptor-meta-_vnrMWD4-CXzRuo6u.mjs.map +0 -1
  74. package/dist/mongo-driver-DGpvEBcg-DD5q-5iT.mjs.map +0 -1
  75. package/dist/pack-BJLQkv5o.d.mts.map +0 -1
  76. package/dist/runtime-DeUjc8oy.d.mts +0 -11
  77. package/dist/runtime-DeUjc8oy.d.mts.map +0 -1
  78. package/dist/runtime-Jc2oA31j.mjs.map +0 -1
@@ -1,12 +1,16 @@
1
- import { a as MONGO_DECIMAL128_CODEC_ID, c as MONGO_INT64_CODEC_ID, d as MONGO_OBJECTID_CODEC_ID, f as MONGO_STRING_CODEC_ID, i as MONGO_DATE_CODEC_ID, l as MONGO_INT64_NUMBER_CODEC_ID, n as MONGO_BOOLEAN_CODEC_ID, o as MONGO_DOUBLE_CODEC_ID, p as MONGO_VECTOR_CODEC_ID, r as MONGO_BSON_CODEC_ID, s as MONGO_INT32_CODEC_ID, t as MONGO_BINARY_CODEC_ID, u as MONGO_JSON_CODEC_ID } from "./codec-ids-WdrumsYA-CZVjuKW8.mjs";
2
- import { A as isBase64Text, B as mongoInt32, G as mongoTextDataTypes, H as mongoJson, L as mongoDate, N as mongoBinary, P as mongoBool, R as mongoDecimal128, V as mongoInt64, W as mongoString, g as decimal128HoldsExactly, z as mongoDouble } from "./data-types-hoKLBrYZ-h9cAgbOy.mjs";
3
- import { t as mongoTargetDescriptorMetaRuntime } from "./descriptor-meta-runtime-M_DCE9pk-BltR3MLY.mjs";
1
+ 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-ywDzfnAg.mjs";
2
+ import { A as isBase64Text, B as mongoDecimal128, G as mongoInt32, H as mongoDuration, K as mongoInt64, N as mongoBinary, P as mongoBool, Q as mongoTimeText, U as mongoDurationText, V as mongoDouble, X as mongoTextDataTypes, Y as mongoString, Z as mongoTime, g as decimal128HoldsExactly, q as mongoJson, z as mongoDate } from "./data-types-Cq1kg82y-Vk7z6rnW.mjs";
3
+ import { n as mongoNowGenerators, t as mongoNowGeneratorIds } from "./date-time-now-generators-fWUk_--7-BnCnC0d8.mjs";
4
+ import { t as mongoTargetDescriptorMetaRuntime } from "./descriptor-meta-runtime-CBJIjp5R-DMQ9-3Hd.mjs";
4
5
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
5
6
  import { createNumberClassifier, isoDateStringText, numeralText, parseJsonText, printJsonText, signedRange } from "@prisma/orm-framework/components/codec";
6
7
  import { TIMESTAMP_NOW_GENERATOR_ID, temporalTypeAliases } from "@prisma/orm-framework/components/authoring";
7
8
  import { singleGeneratorBinding } from "@prisma/orm-framework/components/components";
8
- //#region ../../../3-targets/mongo/1-target/dist/descriptor-meta-_vnrMWD4.mjs
9
- const mongoAuthoringTypes = {
9
+ //#region ../../../3-targets/mongo/1-target/dist/descriptor-meta-CFsOxO6g.mjs
10
+ /**
11
+ * 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.
12
+ */
13
+ const mongoScalarAuthoringTypes = {
10
14
  String: {
11
15
  kind: "typeConstructor",
12
16
  documentation: "Text, stored as BSON string.",
@@ -22,11 +26,6 @@ const mongoAuthoringTypes = {
22
26
  documentation: "A true or false value, stored as BSON bool.",
23
27
  output: { codecId: MONGO_BOOLEAN_CODEC_ID }
24
28
  },
25
- Date: {
26
- kind: "typeConstructor",
27
- documentation: "A date and time with millisecond precision, stored as BSON date.",
28
- output: { codecId: MONGO_DATE_CODEC_ID }
29
- },
30
29
  ObjectId: {
31
30
  kind: "typeConstructor",
32
31
  documentation: "A 12-byte MongoDB identifier, stored as BSON objectId.",
@@ -101,13 +100,180 @@ const mongoAuthoringTypes = {
101
100
  documentation: "Deprecated: use Bool. A true or false value, stored as BSON bool.",
102
101
  output: { codecId: MONGO_BOOLEAN_CODEC_ID },
103
102
  deprecated: { replacement: "Bool" }
103
+ }
104
+ };
105
+ /**
106
+ * The explicit date and time types. Each name says what the field stores and what the application reads. ADR 315.
107
+ */
108
+ const mongoDateTimeTypeConstructors = {
109
+ DateJsDate: {
110
+ kind: "typeConstructor",
111
+ documentation: "An instant with millisecond precision, stored as BSON date and represented as a JavaScript Date.",
112
+ output: { codecId: MONGO_DATE_CODEC_ID }
104
113
  },
105
- DateTime: {
114
+ DateInstant: {
115
+ kind: "typeConstructor",
116
+ documentation: "An instant with millisecond precision, stored as BSON date and represented as Temporal.Instant.",
117
+ output: { codecId: MONGO_DATE_INSTANT_CODEC_ID }
118
+ },
119
+ DateInstantString: {
106
120
  kind: "typeConstructor",
107
- documentation: "Deprecated: use Date. A date and time with millisecond precision, stored as BSON date.",
108
- output: { codecId: MONGO_DATE_CODEC_ID },
109
- deprecated: { replacement: "Date" }
121
+ documentation: "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.",
122
+ output: { codecId: MONGO_DATE_INSTANT_STRING_CODEC_ID }
123
+ },
124
+ DateString: {
125
+ kind: "typeConstructor",
126
+ documentation: "A calendar date, stored as BSON date at midnight UTC and represented as ISO 8601 text, 2024-02-29.",
127
+ output: { codecId: MONGO_DATE_STRING_CODEC_ID }
128
+ },
129
+ DateTemporal: {
130
+ kind: "typeConstructor",
131
+ documentation: "A calendar date, stored as BSON date at midnight UTC and represented as Temporal.PlainDate.",
132
+ output: { codecId: MONGO_DATE_TEMPORAL_CODEC_ID }
133
+ },
134
+ TimeString: {
135
+ kind: "typeConstructor",
136
+ documentation: "A time of day, stored as BSON string and represented as that string, 09:30:00.000, always with three fraction digits.",
137
+ output: { codecId: MONGO_TIME_STRING_CODEC_ID }
138
+ },
139
+ TimeTemporal: {
140
+ kind: "typeConstructor",
141
+ documentation: "A time of day, stored as BSON string, 09:30:00.000, and represented as Temporal.PlainTime.",
142
+ output: { codecId: MONGO_TIME_TEMPORAL_CODEC_ID }
143
+ },
144
+ DurationString: {
145
+ kind: "typeConstructor",
146
+ documentation: "A length of time, stored as BSON string and represented as the ISO 8601 duration it was written as, such as PT1H30M.",
147
+ output: { codecId: MONGO_DURATION_STRING_CODEC_ID }
148
+ }
149
+ };
150
+ const dateStorage = {
151
+ kind: "option",
152
+ name: "storage",
153
+ values: ["date"],
154
+ default: "date",
155
+ optional: true
156
+ };
157
+ const stringStorage = {
158
+ kind: "option",
159
+ name: "storage",
160
+ values: ["string"],
161
+ default: "string",
162
+ optional: true
163
+ };
164
+ /**
165
+ * The convenience date and time types. Each is a type choice: its `as` argument chooses the explicit type it becomes. ADR 279, ADR 315.
166
+ */
167
+ const mongoConvenienceDateTimeTypes = {
168
+ DateTime: {
169
+ kind: "typeChoice",
170
+ documentation: "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\".",
171
+ args: [{
172
+ kind: "option",
173
+ name: "as",
174
+ values: [
175
+ "jsDate",
176
+ "temporal",
177
+ "string"
178
+ ],
179
+ default: "jsDate",
180
+ optional: true
181
+ }, dateStorage],
182
+ choices: [
183
+ {
184
+ when: {
185
+ as: "jsDate",
186
+ storage: "date"
187
+ },
188
+ type: "DateJsDate"
189
+ },
190
+ {
191
+ when: {
192
+ as: "temporal",
193
+ storage: "date"
194
+ },
195
+ type: "DateInstant"
196
+ },
197
+ {
198
+ when: {
199
+ as: "string",
200
+ storage: "date"
201
+ },
202
+ type: "DateInstantString"
203
+ }
204
+ ]
205
+ },
206
+ Date: {
207
+ kind: "typeChoice",
208
+ documentation: "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).",
209
+ args: [{
210
+ kind: "option",
211
+ name: "as",
212
+ values: ["string", "temporal"],
213
+ default: "string",
214
+ optional: true
215
+ }, dateStorage],
216
+ choices: [{
217
+ when: {
218
+ as: "string",
219
+ storage: "date"
220
+ },
221
+ type: "DateString"
222
+ }, {
223
+ when: {
224
+ as: "temporal",
225
+ storage: "date"
226
+ },
227
+ type: "DateTemporal"
228
+ }]
110
229
  },
230
+ Time: {
231
+ kind: "typeChoice",
232
+ documentation: "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).",
233
+ args: [{
234
+ kind: "option",
235
+ name: "as",
236
+ values: ["string", "temporal"],
237
+ default: "string",
238
+ optional: true
239
+ }, stringStorage],
240
+ choices: [{
241
+ when: {
242
+ as: "string",
243
+ storage: "string"
244
+ },
245
+ type: "TimeString"
246
+ }, {
247
+ when: {
248
+ as: "temporal",
249
+ storage: "string"
250
+ },
251
+ type: "TimeTemporal"
252
+ }]
253
+ },
254
+ Duration: {
255
+ kind: "typeChoice",
256
+ documentation: "A length of time, stored as BSON string. `as` is what the application reads: string, an ISO 8601 duration such as \"PT1H30M\".",
257
+ args: [{
258
+ kind: "option",
259
+ name: "as",
260
+ values: ["string"],
261
+ default: "string",
262
+ optional: true
263
+ }, stringStorage],
264
+ choices: [{
265
+ when: {
266
+ as: "string",
267
+ storage: "string"
268
+ },
269
+ type: "DurationString"
270
+ }]
271
+ }
272
+ };
273
+ const mongoAuthoringTypes = {
274
+ ...mongoScalarAuthoringTypes,
275
+ ...mongoDateTimeTypeConstructors,
276
+ ...mongoConvenienceDateTimeTypes,
111
277
  temporal: temporalTypeAliases({ codecId: MONGO_DATE_CODEC_ID }, "a JavaScript Date")
112
278
  };
113
279
  const classifyAsDecimal = createNumberClassifier({
@@ -197,6 +363,24 @@ function mongoDataTypeEntries() {
197
363
  print: (value) => String(value),
198
364
  documentation: "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."
199
365
  },
366
+ [mongoTime.id]: {
367
+ written: {
368
+ kind: "tag",
369
+ tag: "time",
370
+ parse: mongoTimeText
371
+ },
372
+ print: (value) => String(value),
373
+ documentation: "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."
374
+ },
375
+ [mongoDuration.id]: {
376
+ written: {
377
+ kind: "tag",
378
+ tag: "duration",
379
+ parse: mongoDurationText
380
+ },
381
+ print: (value) => String(value),
382
+ documentation: "A length of time, as in duration`PT1H30M`. Reads an ISO 8601 duration and stores it as written."
383
+ },
200
384
  [mongoBinary.id]: {
201
385
  written: {
202
386
  kind: "tag",
@@ -226,18 +410,18 @@ const mongoTargetDescriptorMeta = {
226
410
  },
227
411
  controlMutationDefaults: {
228
412
  defaultFunctionRegistry: /* @__PURE__ */ new Map(),
229
- generatorDescriptors: [{ id: TIMESTAMP_NOW_GENERATOR_ID }]
413
+ generatorDescriptors: [{ id: TIMESTAMP_NOW_GENERATOR_ID }, ...mongoNowGenerators.map(({ id }) => ({ id }))]
230
414
  },
231
415
  generatorFunctions: [{
232
416
  name: "now",
233
417
  signature: { documentation: "Writes the current time." },
234
- bindings: [singleGeneratorBinding({
235
- codecIds: [MONGO_DATE_CODEC_ID],
236
- generatorId: TIMESTAMP_NOW_GENERATOR_ID
237
- })]
418
+ bindings: Object.entries(mongoNowGeneratorIds).map(([codecId, generatorId]) => singleGeneratorBinding({
419
+ codecIds: [codecId],
420
+ generatorId
421
+ }))
238
422
  }]
239
423
  };
240
424
  //#endregion
241
425
  export { mongoTargetDescriptorMeta as t };
242
426
 
243
- //# sourceMappingURL=descriptor-meta-_vnrMWD4-CXzRuo6u.mjs.map
427
+ //# sourceMappingURL=descriptor-meta-CFsOxO6g-Ca8valmZ.mjs.map
@@ -0,0 +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,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;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 { I as mongoDataTypes } from "./data-types-hoKLBrYZ-h9cAgbOy.mjs";
2
- import { t as mongoCodecDescriptors } from "./codecs-_QYfn0YT-BWZI19N1.mjs";
1
+ import { R as mongoDataTypes } from "./data-types-Cq1kg82y-Vk7z6rnW.mjs";
2
+ import { t as mongoCodecDescriptors } from "./codecs-BbX2VMzN-Dm9db3Jz.mjs";
3
3
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
4
- //#region ../../../3-targets/mongo/1-target/dist/descriptor-meta-runtime-M_DCE9pk.mjs
4
+ //#region ../../../3-targets/mongo/1-target/dist/descriptor-meta-runtime-CBJIjp5R.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-M_DCE9pk-BltR3MLY.mjs.map
20
+ //# sourceMappingURL=descriptor-meta-runtime-CBJIjp5R-DMQ9-3Hd.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"descriptor-meta-runtime-M_DCE9pk-BltR3MLY.mjs","names":[],"sources":["../../../../3-targets/mongo/1-target/dist/descriptor-meta-runtime-M_DCE9pk.mjs"],"sourcesContent":["import { i as mongoDataTypes } from \"./data-types-hoKLBrYZ.mjs\";\nimport { t as mongoCodecDescriptors } from \"./codecs-_QYfn0YT.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-M_DCE9pk.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-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"}
package/dist/driver.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as MongoControlDriver } from "./control-DfDVW_9x.mjs";
1
+ import { t as MongoControlDriver } from "./control-CHr0ZjKM.mjs";
2
2
  export { MongoControlDriver };
@@ -1,2 +1,2 @@
1
- import { n as mongoControlDriverDescriptor, t as MongoControlDriver } from "./control-DfDVW_9x.mjs";
1
+ import { n as mongoControlDriverDescriptor, t as MongoControlDriver } from "./control-CHr0ZjKM.mjs";
2
2
  export { MongoControlDriver, mongoControlDriverDescriptor as default };
@@ -1,4 +1,4 @@
1
- import { n as MongoDriverImpl, r as mongoDriverDescriptorMeta } from "./mongo-driver-DGpvEBcg-DD5q-5iT.mjs";
1
+ import { n as MongoDriverImpl, r as mongoDriverDescriptorMeta } from "./mongo-driver-CSDRQwak-j3pdkDuW.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-DGpvEBcg.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-CSDRQwak.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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A2B;CACnC,OAAO,IAAI,uBAAuB;AACnC;AAGA,MAAM,+BAA+B;CACpC,GAAG;CACH,QAAQ;AACT"}
@@ -1,12 +1,12 @@
1
1
  import { t as mongoTargetError } from "./mongo-target-errors-Btf3ML1w-QOtEG7EX.mjs";
2
- import { blindCast } from "@prisma/orm-framework/utils/casts";
3
2
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
3
+ import { blindCast } from "@prisma/orm-framework/utils/casts";
4
4
  import { MONGO_INDEX_OPTION_KEYS, defaultMongoIndexName } from "@prisma/orm-family-mongo/contract";
5
5
  import { CollModCommand, DropCollectionCommand, DropIndexCommand, ListCollectionsCommand, ListIndexesCommand, MongoAndExpr, MongoExistsExpr, MongoFieldFilter, MongoNotExpr, RenameCollectionCommand, buildIndexOpId, keysToKeySpec } from "@prisma/orm-family-mongo/query-ast/control";
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-CUyEIo5p.mjs
9
+ //#region ../../../3-targets/mongo/1-target/dist/migration-factories-oLRWgLGz.mjs
10
10
  function isBuildable(value) {
11
11
  if (typeof value !== "object" || value === null || !("build" in value)) return false;
12
12
  return typeof Reflect.get(value, "build") === "function";
@@ -421,4 +421,4 @@ function validatedCollection(name, schema, indexes) {
421
421
  //#endregion
422
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 };
423
423
 
424
- //# sourceMappingURL=migration-factories-CUyEIo5p-CXTwpgxe.mjs.map
424
+ //# sourceMappingURL=migration-factories-oLRWgLGz-B9fWm8Wc.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-factories-CUyEIo5p-CXTwpgxe.mjs","names":[],"sources":["../../../../3-targets/mongo/1-target/dist/migration-factories-CUyEIo5p.mjs"],"sourcesContent":["import { t as mongoTargetError } from \"./mongo-target-errors-Btf3ML1w.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\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/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}\nconst REWRITE_PLAN_META = {\n\ttarget: \"mongo\",\n\tstorageHash: \"\",\n\tlane: \"mongo-raw\"\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}\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: { ...REWRITE_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}\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\treturn {\n\t\tid: `collection.${collectionName}.setValidation`,\n\t\tlabel: `Set validation on ${collectionName}`,\n\t\toperationClass: \"widening\",\n\t\tprecheck: [],\n\t\texecute: [{\n\t\t\tdescription: `set validation on ${collectionName}`,\n\t\t\tcommand: new CollModCommand(collectionName, {\n\t\t\t\tvalidator: { $jsonSchema: schema },\n\t\t\t\t...ifDefined(\"validationLevel\", options?.validationLevel),\n\t\t\t\t...ifDefined(\"validationAction\", options?.validationAction)\n\t\t\t})\n\t\t}],\n\t\tpostcheck: []\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}\nfunction collMod(collectionName, options, meta) {\n\tconst hasValidator = options.validator != null && Object.keys(options.validator).length > 0;\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}] : [],\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 { 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 };\n\n//# sourceMappingURL=migration-factories-CUyEIo5p.mjs.map"],"mappings":";;;;;;;;;AASA,SAAS,YAAY,OAAO;CAC3B,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,EAAE,WAAW,QAAQ,OAAO;CAC/E,OAAO,OAAO,QAAQ,IAAI,OAAO,OAAO,MAAM;AAC/C;AACA,SAAS,aAAa,OAAO;CAC5B,OAAO,YAAY,KAAK,IAAI,MAAM,MAAM,IAAI;AAC7C;AACA,MAAM,mBAAmB,gBAAgB,OAAO,KAAK;AACrD,SAAS,cAAc,MAAM,SAAS;CACrC,IAAI,WAAW,CAAC;CAChB,IAAI,YAAY,CAAC;CACjB,IAAI,QAAQ,OAAO;EAClB,MAAM,SAAS,aAAa,QAAQ,MAAM,OAAO,CAAC;EAClD,MAAM,SAAS,QAAQ,MAAM,UAAU;EACvC,MAAM,cAAc,QAAQ,MAAM,eAAe,6BAA6B;EAC9E,MAAM,iBAAiB,QAAQ,MAAM,UAAU;EAC/C,MAAM,kBAAkB,mBAAmB,WAAW,cAAc;EACpE,WAAW,CAAC;GACX;GACA;GACA;GACA,QAAQ;EACT,CAAC;EACD,YAAY,CAAC;GACZ;GACA;GACA;GACA,QAAQ;EACT,CAAC;CACF;CACA,MAAM,MAAM,CAAC,aAAa,QAAQ,IAAI,CAAC,CAAC;CACxC,OAAO;EACN,IAAI,kBAAkB;EACtB,OAAO,mBAAmB;EAC1B,gBAAgB;EAChB;EACA,GAAG,U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AI,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC;AAClH"}
1
+ {"version":3,"file":"migration-factories-oLRWgLGz-B9fWm8Wc.mjs","names":[],"sources":["../../../../3-targets/mongo/1-target/dist/migration-factories-oLRWgLGz.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/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}\nconst REWRITE_PLAN_META = {\n\ttarget: \"mongo\",\n\tstorageHash: \"\",\n\tlane: \"mongo-raw\"\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}\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: { ...REWRITE_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}\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\treturn {\n\t\tid: `collection.${collectionName}.setValidation`,\n\t\tlabel: `Set validation on ${collectionName}`,\n\t\toperationClass: \"widening\",\n\t\tprecheck: [],\n\t\texecute: [{\n\t\t\tdescription: `set validation on ${collectionName}`,\n\t\t\tcommand: new CollModCommand(collectionName, {\n\t\t\t\tvalidator: { $jsonSchema: schema },\n\t\t\t\t...ifDefined(\"validationLevel\", options?.validationLevel),\n\t\t\t\t...ifDefined(\"validationAction\", options?.validationAction)\n\t\t\t})\n\t\t}],\n\t\tpostcheck: []\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}\nfunction collMod(collectionName, options, meta) {\n\tconst hasValidator = options.validator != null && Object.keys(options.validator).length > 0;\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}] : [],\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 { 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 };\n\n//# sourceMappingURL=migration-factories-oLRWgLGz.mjs.map"],"mappings":";;;;;;;;;AASA,SAAS,YAAY,OAAO;CAC3B,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,EAAE,WAAW,QAAQ,OAAO;CAC/E,OAAO,OAAO,QAAQ,IAAI,OAAO,OAAO,MAAM;AAC/C;AACA,SAAS,aAAa,OAAO;CAC5B,OAAO,YAAY,KAAK,IAAI,MAAM,MAAM,IAAI;AAC7C;AACA,MAAM,mBAAmB,gBAAgB,OAAO,KAAK;AACrD,SAAS,cAAc,MAAM,SAAS;CACrC,IAAI,WAAW,CAAC;CAChB,IAAI,YAAY,CAAC;CACjB,IAAI,QAAQ,OAAO;EAClB,MAAM,SAAS,aAAa,QAAQ,MAAM,OAAO,CAAC;EAClD,MAAM,SAAS,QAAQ,MAAM,UAAU;EACvC,MAAM,cAAc,QAAQ,MAAM,eAAe,6BAA6B;EAC9E,MAAM,iBAAiB,QAAQ,MAAM,UAAU;EAC/C,MAAM,kBAAkB,mBAAmB,WAAW,cAAc;EACpE,WAAW,CAAC;GACX;GACA;GACA;GACA,QAAQ;EACT,CAAC;EACD,YAAY,CAAC;GACZ;GACA;GACA;GACA,QAAQ;EACT,CAAC;CACF;CACA,MAAM,MAAM,CAAC,aAAa,QAAQ,IAAI,CAAC,CA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AAG,QAAQ,KAAK,QAAQ,YAAY,MAAM,IAAI,MAAM,IAAI,WAAW,KAAK,IAAI,EAAE,QAAQ,IAAI,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC;AAClH"}
@@ -1,8 +1,8 @@
1
- import { t as mongoRuntimeTargetDescriptor } from "./runtime-Jc2oA31j.mjs";
1
+ import { t as mongoRuntimeTargetDescriptor } from "./runtime-DyWNR1FZ.mjs";
2
2
  import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
3
+ import { ifDefined } from "@prisma/orm-framework/utils/defined";
3
4
  import { blindCast } from "@prisma/orm-framework/utils/casts";
4
5
  import { assembleMongoCodecRegistry } from "@prisma/orm-family-mongo/codec";
5
- import { ifDefined } from "@prisma/orm-framework/utils/defined";
6
6
  import { keysToKeySpec } from "@prisma/orm-family-mongo/query-ast/control";
7
7
  import { isExprArray, isRecordArgs } from "@prisma/orm-family-mongo/query-ast/execution";
8
8
  import { InternalError, assertNever, isInternalError } from "@prisma/orm-framework/utils/internal-error";
@@ -827,4 +827,4 @@ function createMongoAdapter(codecs = assembleMongoCodecRegistry([mongoRuntimeTar
827
827
  //#endregion
828
828
  export { lowerStage as a, lowerPipeline as i, lowerAggExpr as n, lowerFilter as r, createMongoAdapter as t };
829
829
 
830
- //# sourceMappingURL=mongo-adapter-RJ_YOxiK-yG_qHDyR.mjs.map
830
+ //# sourceMappingURL=mongo-adapter-RJ_YOxiK-jlyFS6Wr.mjs.map