@prisma/orm-target-mongo 0.16.0-dev.36

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 (77) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +23 -0
  3. package/dist/adapter.d.mts +19 -0
  4. package/dist/adapter.d.mts.map +1 -0
  5. package/dist/adapter.mjs +12 -0
  6. package/dist/adapter.mjs.map +1 -0
  7. package/dist/adapter__codec-ids.d.mts +12 -0
  8. package/dist/adapter__codec-ids.d.mts.map +1 -0
  9. package/dist/adapter__codec-ids.mjs +2 -0
  10. package/dist/adapter__codec-types.d.mts +38 -0
  11. package/dist/adapter__codec-types.d.mts.map +1 -0
  12. package/dist/adapter__codec-types.mjs +1 -0
  13. package/dist/adapter__codecs.d.mts +14 -0
  14. package/dist/adapter__codecs.d.mts.map +1 -0
  15. package/dist/adapter__codecs.mjs +2 -0
  16. package/dist/adapter__control.d.mts +3 -0
  17. package/dist/adapter__control.mjs +3 -0
  18. package/dist/adapter__runtime.d.mts +16 -0
  19. package/dist/adapter__runtime.d.mts.map +1 -0
  20. package/dist/adapter__runtime.mjs +25 -0
  21. package/dist/adapter__runtime.mjs.map +1 -0
  22. package/dist/codec-ids-BennPcpQ-Btzz3ILV.mjs +12 -0
  23. package/dist/codec-ids-BennPcpQ-Btzz3ILV.mjs.map +1 -0
  24. package/dist/codec-types-Bx2fHyq_.d.mts +35 -0
  25. package/dist/codec-types-Bx2fHyq_.d.mts.map +1 -0
  26. package/dist/codecs-DLWO-Cjc-CWfQj0bY.mjs +170 -0
  27. package/dist/codecs-DLWO-Cjc-CWfQj0bY.mjs.map +1 -0
  28. package/dist/control-BOc5lrQg.mjs +437 -0
  29. package/dist/control-BOc5lrQg.mjs.map +1 -0
  30. package/dist/control-CEXmcht7.mjs +1563 -0
  31. package/dist/control-CEXmcht7.mjs.map +1 -0
  32. package/dist/control-CxXmTy_h.d.mts +312 -0
  33. package/dist/control-CxXmTy_h.d.mts.map +1 -0
  34. package/dist/control-rPM2HNxW.d.mts +170 -0
  35. package/dist/control-rPM2HNxW.d.mts.map +1 -0
  36. package/dist/descriptor-meta-CBiaTwe5-HX742pZh.mjs +17 -0
  37. package/dist/descriptor-meta-CBiaTwe5-HX742pZh.mjs.map +1 -0
  38. package/dist/driver.d.mts +2 -0
  39. package/dist/driver.mjs +2 -0
  40. package/dist/driver__control.d.mts +16 -0
  41. package/dist/driver__control.d.mts.map +1 -0
  42. package/dist/driver__control.mjs +46 -0
  43. package/dist/driver__control.mjs.map +1 -0
  44. package/dist/migration-BkqcE2Uv.d.mts +42 -0
  45. package/dist/migration-BkqcE2Uv.d.mts.map +1 -0
  46. package/dist/migration-C-jfTsGU.mjs +4 -0
  47. package/dist/migration-factories-CCJFG_3e-75oJ8xn2.mjs +201 -0
  48. package/dist/migration-factories-CCJFG_3e-75oJ8xn2.mjs.map +1 -0
  49. package/dist/mongo-adapter-BkVYI6jn-ChXldtpg.mjs +807 -0
  50. package/dist/mongo-adapter-BkVYI6jn-ChXldtpg.mjs.map +1 -0
  51. package/dist/mongo-adapter-CjJU3S9o-BIJruFYW.d.mts +16 -0
  52. package/dist/mongo-adapter-CjJU3S9o-BIJruFYW.d.mts.map +1 -0
  53. package/dist/mongo-driver-C7zThOjZ-BcMrlirh.mjs +161 -0
  54. package/dist/mongo-driver-C7zThOjZ-BcMrlirh.mjs.map +1 -0
  55. package/dist/mongo-driver-D1lEf5Kl-KPfGUVXK.d.mts +33 -0
  56. package/dist/mongo-driver-D1lEf5Kl-KPfGUVXK.d.mts.map +1 -0
  57. package/dist/op-factory-call-B7EKa4Ri-B2Lb6W68.d.mts +76 -0
  58. package/dist/op-factory-call-B7EKa4Ri-B2Lb6W68.d.mts.map +1 -0
  59. package/dist/pack-MK8ZQfrL.d.mts +22 -0
  60. package/dist/pack-MK8ZQfrL.d.mts.map +1 -0
  61. package/dist/runtime-B9_-kjBX.d.mts +15 -0
  62. package/dist/runtime-B9_-kjBX.d.mts.map +1 -0
  63. package/dist/target.d.mts +8 -0
  64. package/dist/target.mjs +4 -0
  65. package/dist/target__codec-types.d.mts +2 -0
  66. package/dist/target__codec-types.mjs +1 -0
  67. package/dist/target__control.d.mts +4 -0
  68. package/dist/target__control.mjs +2 -0
  69. package/dist/target__migration.d.mts +2 -0
  70. package/dist/target__migration.mjs +3 -0
  71. package/dist/target__pack.d.mts +2 -0
  72. package/dist/target__pack.mjs +7 -0
  73. package/dist/target__pack.mjs.map +1 -0
  74. package/dist/target__runtime.d.mts +2 -0
  75. package/dist/target__runtime.mjs +21 -0
  76. package/dist/target__runtime.mjs.map +1 -0
  77. package/package.json +63 -0
@@ -0,0 +1,170 @@
1
+ import "./mongo-adapter-CjJU3S9o-BIJruFYW.mjs";
2
+ import { AnyMongoDdlCommand, ListCollectionsCommand, ListIndexesCommand, MongoInspectionCommandVisitor } from "@prisma/orm-family-mongo/query-ast/control";
3
+ import { Db, Document } from "mongodb";
4
+ import { MongoSchemaIR } from "@prisma/orm-family-mongo/schema-ir";
5
+ import { ControlDriverInstance, ControlFamilyInstance } from "@prisma/orm-framework/components/control";
6
+ import { MongoAdapter, MongoControlDriverInstance, MongoControlDriverInstance as MongoControlDriverInstance$1, MongoDriver } from "@prisma/orm-family-mongo/lowering";
7
+ import { MongoControlAdapter, MongoControlAdapterDescriptor } from "@prisma/orm-family-mongo/family/control-adapter";
8
+ import { ContractMarkerRecord, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
9
+ //#region ../../../3-mongo-target/2-mongo-adapter/dist/control.d.mts
10
+ //#region src/core/inspection-executor.d.ts
11
+ /**
12
+ * Executes the read-only catalog inspections (`listCollections` / `listIndexes`)
13
+ * that migration prechecks/postchecks and operation preview evaluate, directly
14
+ * against `db`. Routing these checks through the adapter's lowering seam is
15
+ * deferred to the `typed-migration-verification-queries` slice.
16
+ */
17
+ declare class MongoInspectionExecutor implements MongoInspectionCommandVisitor<Promise<Document[]>> {
18
+ private readonly db;
19
+ constructor(db: Db);
20
+ listIndexes(cmd: ListIndexesCommand): Promise<Document[]>;
21
+ listCollections(_cmd: ListCollectionsCommand): Promise<Document[]>;
22
+ }
23
+ //#endregion
24
+ //#region src/core/introspect-schema.d.ts
25
+ declare function introspectSchema(db: Db): Promise<MongoSchemaIR>;
26
+ //#endregion
27
+ //#region src/core/mongo-control-adapter.d.ts
28
+ /**
29
+ * Mongo control adapter for control-plane operations like introspection
30
+ * and marker-ledger CAS. Implements the family-level `MongoControlAdapter`
31
+ * SPI. Every marker/ledger operation builds a canonical command inline via
32
+ * the contract-free fluent builder and dispatches it through the family
33
+ * adapter's lowering path (`createMongoAdapter().lower(plan, {})`) onto the
34
+ * Mongo wire transport (`driver.execute(wireCommand)`) — the same route SQL
35
+ * marker/ledger ops take through `adapter.lower()` → `driver.query()`.
36
+ */
37
+ declare class MongoControlAdapterImpl implements MongoControlAdapter<'mongo'> {
38
+ #private;
39
+ readonly familyId: "mongo";
40
+ readonly targetId: "mongo";
41
+ executeDdl(driver: MongoDriver, command: AnyMongoDdlCommand): Promise<void>;
42
+ readMarker(driver: ControlDriverInstance<'mongo', 'mongo'>, space: string): Promise<ContractMarkerRecord | null>;
43
+ readAllMarkers(driver: ControlDriverInstance<'mongo', 'mongo'>): Promise<ReadonlyMap<string, ContractMarkerRecord>>;
44
+ initMarker(driver: ControlDriverInstance<'mongo', 'mongo'>, space: string, destination: {
45
+ readonly storageHash: string;
46
+ readonly profileHash: string;
47
+ readonly invariants?: readonly string[];
48
+ }): Promise<void>;
49
+ updateMarker(driver: ControlDriverInstance<'mongo', 'mongo'>, space: string, expectedFrom: string, destination: {
50
+ readonly storageHash: string;
51
+ readonly profileHash: string;
52
+ readonly invariants?: readonly string[];
53
+ }): Promise<boolean>;
54
+ writeLedgerEntry(driver: ControlDriverInstance<'mongo', 'mongo'>, space: string, entry: {
55
+ readonly edgeId: string;
56
+ readonly from: string;
57
+ readonly to: string;
58
+ readonly migrationName: string;
59
+ readonly migrationHash: string;
60
+ readonly operations: readonly unknown[];
61
+ }): Promise<void>;
62
+ readLedger(driver: ControlDriverInstance<'mongo', 'mongo'>, space?: string): Promise<readonly LedgerEntryRecord[]>;
63
+ introspectSchema(driver: ControlDriverInstance<'mongo', 'mongo'>): Promise<MongoSchemaIR>;
64
+ }
65
+ //#endregion
66
+ //#region src/core/mongo-control-driver.d.ts
67
+ declare function isMongoControlDriver(driver: ControlDriverInstance<'mongo', string>): driver is MongoControlDriverInstance;
68
+ //#endregion
69
+ //#region src/core/runner-deps.d.ts
70
+ declare function extractDb(driver: ControlDriverInstance<'mongo', 'mongo'>): Db;
71
+ /**
72
+ * Marker / ledger operations the Mongo runner depends on. Every method
73
+ * takes a `space` parameter so each loaded contract space addresses its
74
+ * own marker row independently — see ADR 212 for the per-space
75
+ * mechanism.
76
+ */
77
+ interface MarkerOperations {
78
+ readMarker(space: string): Promise<ContractMarkerRecord | null>;
79
+ initMarker(space: string, destination: {
80
+ readonly storageHash: string;
81
+ readonly profileHash: string;
82
+ readonly invariants?: readonly string[];
83
+ }): Promise<void>;
84
+ updateMarker(space: string, expectedFrom: string, destination: {
85
+ readonly storageHash: string;
86
+ readonly profileHash: string;
87
+ readonly invariants?: readonly string[];
88
+ }): Promise<boolean>;
89
+ writeLedgerEntry(space: string, entry: {
90
+ readonly edgeId: string;
91
+ readonly from: string;
92
+ readonly to: string;
93
+ readonly migrationName: string;
94
+ readonly migrationHash: string;
95
+ readonly operations: readonly unknown[];
96
+ }): Promise<void>;
97
+ }
98
+ interface MongoRunnerDependencies {
99
+ readonly inspectionExecutor: MongoInspectionCommandVisitor<Promise<Record<string, unknown>[]>>;
100
+ readonly adapter: MongoAdapter;
101
+ readonly driver: MongoDriver;
102
+ readonly executeDdl: (command: AnyMongoDdlCommand) => Promise<void>;
103
+ readonly markerOps: MarkerOperations;
104
+ readonly introspectSchema: () => Promise<MongoSchemaIR>;
105
+ }
106
+ /**
107
+ * Build the runner-dependencies envelope. `controlAdapter` is the
108
+ * dispatch surface for wire-level Mongo CAS operations (marker reads,
109
+ * marker advances, ledger appends, introspection); the envelope's
110
+ * `markerOps` shim simply forwards each call through it. When the
111
+ * caller already has a `MongoControlAdapter` on the control stack it
112
+ * can pass it in; otherwise a default `MongoControlAdapterImpl` is
113
+ * constructed locally.
114
+ */
115
+ declare function createMongoRunnerDeps(controlDriver: ControlDriverInstance<'mongo', 'mongo'>, driver: MongoDriver, _family: ControlFamilyInstance<'mongo', MongoSchemaIR>, controlAdapter?: MongoControlAdapter<'mongo'>): MongoRunnerDependencies;
116
+ //#endregion
117
+ //#region src/exports/control.d.ts
118
+ /**
119
+ * The base PSL scalars as zero-arg type constructors in the unified authoring
120
+ * channel, with explicit `nativeType` values pinned to the codec manifests
121
+ * (`codecLookup.targetTypesFor(codecId)[0]`).
122
+ */
123
+ declare const mongoScalarAuthoringTypes: {
124
+ readonly String: {
125
+ readonly kind: "typeConstructor";
126
+ readonly output: {
127
+ readonly codecId: "mongo/string@1";
128
+ readonly nativeType: "string";
129
+ };
130
+ };
131
+ readonly Int: {
132
+ readonly kind: "typeConstructor";
133
+ readonly output: {
134
+ readonly codecId: "mongo/int32@1";
135
+ readonly nativeType: "int";
136
+ };
137
+ };
138
+ readonly Boolean: {
139
+ readonly kind: "typeConstructor";
140
+ readonly output: {
141
+ readonly codecId: "mongo/bool@1";
142
+ readonly nativeType: "bool";
143
+ };
144
+ };
145
+ readonly DateTime: {
146
+ readonly kind: "typeConstructor";
147
+ readonly output: {
148
+ readonly codecId: "mongo/date@1";
149
+ readonly nativeType: "date";
150
+ };
151
+ };
152
+ readonly ObjectId: {
153
+ readonly kind: "typeConstructor";
154
+ readonly output: {
155
+ readonly codecId: "mongo/objectId@1";
156
+ readonly nativeType: "objectId";
157
+ };
158
+ };
159
+ readonly Float: {
160
+ readonly kind: "typeConstructor";
161
+ readonly output: {
162
+ readonly codecId: "mongo/double@1";
163
+ readonly nativeType: "double";
164
+ };
165
+ };
166
+ };
167
+ declare const mongoAdapterDescriptor: MongoControlAdapterDescriptor<'mongo'>;
168
+ //#endregion
169
+ export { MongoRunnerDependencies as a, introspectSchema as c, mongoScalarAuthoringTypes as d, MongoInspectionExecutor as i, isMongoControlDriver as l, MongoControlAdapterImpl as n, createMongoRunnerDeps as o, MongoControlDriverInstance$1 as r, extractDb as s, MarkerOperations as t, mongoAdapterDescriptor as u };
170
+ //# sourceMappingURL=control-rPM2HNxW.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-rPM2HNxW.d.mts","names":[],"sources":["../../../../3-mongo-target/2-mongo-adapter/dist/control.d.mts"],"mappings":";;;;;;;;;;;;;;;;cAec,mCAAmC,8BAA8B,QAAQ;mBACpE;EACjB,YAAY,IAAI;EAChB,YAAY,KAAK,qBAAqB,QAAQ;EAC9C,gBAAgB,MAAM,yBAAyB,QAAQ;;;;iBAIxC,iBAAiB,IAAI,KAAK,QAAQ;;;;;;;;;;;;cAYrC,mCAAmC;;WAEtC;WACA;EACT,WAAW,QAAQ,aAAa,SAAS,qBAAqB;EAC9D,WAAW,QAAQ,yCAAyC,gBAAgB,QAAQ;EACpF,eAAe,QAAQ,0CAA0C,QAAQ,oBAAoB;EAC7F,WAAW,QAAQ,yCAAyC,eAAe;aAChE;aACA;aACA;MACP;EACJ,aAAa,QAAQ,yCAAyC,eAAe,sBAAsB;aACxF;aACA;aACA;MACP;EACJ,iBAAiB,QAAQ,yCAAyC,eAAe;aACtE;aACA;aACA;aACA;aACA;aACA;MACP;EACJ,WAAW,QAAQ,yCAAyC,iBAAiB,iBAAiB;EAC9F,iBAAiB,QAAQ,0CAA0C,QAAQ;;;;iBAI5D,qBAAqB,QAAQ,yCAAyC,UAAU;;;iBAGhF,UAAU,QAAQ,0CAA0C;;;;;;;UAOnE;EACR,WAAW,gBAAgB,QAAQ;EACnC,WAAW,eAAe;aACf;aACA;aACA;MACP;EACJ,aAAa,eAAe,sBAAsB;aACvC;aACA;aACA;MACP;EACJ,iBAAiB,eAAe;aACrB;aACA;aACA;aACA;aACA;aACA;MACP;;UAEI;WACC,oBAAoB,8BAA8B,QAAQ;WAC1D,SAAS;WACT,QAAQ;WACR,aAAa,SAAS,uBAAuB;WAC7C,WAAW;WACX,wBAAwB,QAAQ;;;;;;;;;;;iBAW1B,sBAAsB,eAAe,yCAAyC,QAAQ,aAAa,SAAS,+BAA+B,gBAAgB,iBAAiB,+BAA+B;;;;;;;;cAQ9M;WACH;aACE;aACA;eACE;eACA;;;WAGJ;aACE;aACA;eACE;eACA;;;WAGJ;aACE;aACA;eACE;eACA;;;WAGJ;aACE;aACA;eACE;eACA;;;WAGJ;aACE;aACA;eACE;eACA;;;WAGJ;aACE;aACA;eACE;eACA;;;;cAID,wBAAwB"}
@@ -0,0 +1,17 @@
1
+ import { i as mongoCodecDescriptors } from "./codecs-DLWO-Cjc-CWfQj0bY.mjs";
2
+ import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
3
+ //#region ../../../3-mongo-target/1-mongo-target/dist/descriptor-meta-CBiaTwe5.mjs
4
+ const mongoTargetDescriptorMeta = {
5
+ kind: "target",
6
+ familyId: "mongo",
7
+ targetId: "mongo",
8
+ id: "mongo",
9
+ version: "0.0.1",
10
+ capabilities: {},
11
+ defaultNamespaceId: UNBOUND_NAMESPACE_ID,
12
+ types: { codecTypes: { codecDescriptors: mongoCodecDescriptors } }
13
+ };
14
+ //#endregion
15
+ export { mongoTargetDescriptorMeta as t };
16
+
17
+ //# sourceMappingURL=descriptor-meta-CBiaTwe5-HX742pZh.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor-meta-CBiaTwe5-HX742pZh.mjs","names":[],"sources":["../../../../3-mongo-target/1-mongo-target/dist/descriptor-meta-CBiaTwe5.mjs"],"sourcesContent":["import { mongoCodecDescriptors } from \"@internal/adapter-mongo/codecs\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nconst mongoTargetDescriptorMeta = {\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\ttypes: { codecTypes: { codecDescriptors: mongoCodecDescriptors } }\n};\n//#endregion\nexport { mongoTargetDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-CBiaTwe5.mjs.map"],"mappings":";;;AAEA,MAAM,4BAA4B;CACjC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,CAAC;CACf,oBAAoB;CACpB,OAAO,EAAE,YAAY,EAAE,kBAAkB,sBAAsB,EAAE;AAClE"}
@@ -0,0 +1,2 @@
1
+ import { n as createMongoDriver, t as MongoDriverImpl } from "./mongo-driver-D1lEf5Kl-KPfGUVXK.mjs";
2
+ export { MongoDriverImpl, createMongoDriver };
@@ -0,0 +1,2 @@
1
+ import { n as MongoDriverImpl, r as createMongoDriver } from "./mongo-driver-C7zThOjZ-BcMrlirh.mjs";
2
+ export { MongoDriverImpl, createMongoDriver };
@@ -0,0 +1,16 @@
1
+ import { t as MongoDriverImpl } from "./mongo-driver-D1lEf5Kl-KPfGUVXK.mjs";
2
+ import { Db, MongoClient } from "mongodb";
3
+ import { ControlDriverDescriptor } from "@prisma/orm-framework/components/control";
4
+ import { MongoControlDriverInstance } from "@prisma/orm-family-mongo/lowering";
5
+ //#region ../../../3-mongo-target/3-mongo-driver/dist/control.d.mts
6
+ //#region src/exports/control.d.ts
7
+ declare class MongoControlDriver extends MongoDriverImpl implements MongoControlDriverInstance {
8
+ readonly familyId: "mongo";
9
+ readonly targetId: "mongo";
10
+ readonly db: Db;
11
+ constructor(db: Db, mongoClient: MongoClient);
12
+ }
13
+ declare const mongoControlDriverDescriptor: ControlDriverDescriptor<'mongo', 'mongo', MongoControlDriver>;
14
+ //#endregion
15
+ export { MongoControlDriver, mongoControlDriverDescriptor as default };
16
+ //# sourceMappingURL=driver__control.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver__control.d.mts","names":[],"sources":["../../../../3-mongo-target/3-mongo-driver/dist/control.d.mts"],"mappings":";;;;;;cAKc,2BAA2B,2BAA2B;WACzD;WACA;WACA,IAAI;EACb,YAAY,IAAI,IAAI,aAAa;;cAErB,8BAA8B,0CAA0C"}
@@ -0,0 +1,46 @@
1
+ import { n as MongoDriverImpl, t as DRIVER_INFO } from "./mongo-driver-C7zThOjZ-BcMrlirh.mjs";
2
+ import { MongoClient } from "mongodb";
3
+ import { errorRuntime } from "@prisma/orm-framework/errors/execution";
4
+ import { redactDatabaseUrl } from "@prisma/orm-framework/utils/redact-db-url";
5
+ //#region ../../../3-mongo-target/3-mongo-driver/dist/control.mjs
6
+ var MongoControlDriver = class extends MongoDriverImpl {
7
+ familyId = "mongo";
8
+ targetId = "mongo";
9
+ db;
10
+ constructor(db, mongoClient) {
11
+ super(db, mongoClient);
12
+ this.db = db;
13
+ }
14
+ };
15
+ const mongoControlDriverDescriptor = {
16
+ kind: "driver",
17
+ familyId: "mongo",
18
+ targetId: "mongo",
19
+ id: "mongo",
20
+ version: DRIVER_INFO.version,
21
+ capabilities: {},
22
+ async create(url) {
23
+ const client = new MongoClient(url, {
24
+ serverSelectionTimeoutMS: 5e3,
25
+ connectTimeoutMS: 5e3,
26
+ driverInfo: DRIVER_INFO
27
+ });
28
+ try {
29
+ await client.connect();
30
+ return new MongoControlDriver(client.db(), client);
31
+ } catch (error) {
32
+ try {
33
+ await client.close();
34
+ } catch {}
35
+ throw errorRuntime("Database connection failed", {
36
+ why: error instanceof Error ? error.message : String(error),
37
+ fix: "Verify the MongoDB URL, ensure the database is reachable, and confirm credentials/permissions",
38
+ meta: { ...redactDatabaseUrl(url) }
39
+ });
40
+ }
41
+ }
42
+ };
43
+ //#endregion
44
+ export { MongoControlDriver, mongoControlDriverDescriptor as default };
45
+
46
+ //# sourceMappingURL=driver__control.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver__control.mjs","names":[],"sources":["../../../../3-mongo-target/3-mongo-driver/dist/control.mjs"],"sourcesContent":["import { r as DRIVER_INFO, t as MongoDriverImpl } from \"./mongo-driver-C7zThOjZ.mjs\";\nimport { MongoClient } from \"mongodb\";\nimport { errorRuntime } from \"@internal/errors/execution\";\nimport { redactDatabaseUrl } from \"@internal/utils/redact-db-url\";\n//#region src/exports/control.ts\nvar MongoControlDriver = class extends MongoDriverImpl {\n\tfamilyId = \"mongo\";\n\ttargetId = \"mongo\";\n\tdb;\n\tconstructor(db, mongoClient) {\n\t\tsuper(db, mongoClient);\n\t\tthis.db = db;\n\t}\n};\nconst mongoControlDriverDescriptor = {\n\tkind: \"driver\",\n\tfamilyId: \"mongo\",\n\ttargetId: \"mongo\",\n\tid: \"mongo\",\n\tversion: DRIVER_INFO.version,\n\tcapabilities: {},\n\tasync create(url) {\n\t\tconst client = new MongoClient(url, {\n\t\t\tserverSelectionTimeoutMS: 5e3,\n\t\t\tconnectTimeoutMS: 5e3,\n\t\t\tdriverInfo: DRIVER_INFO\n\t\t});\n\t\ttry {\n\t\t\tawait client.connect();\n\t\t\treturn new MongoControlDriver(client.db(), client);\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\tawait client.close();\n\t\t\t} catch {}\n\t\t\tthrow errorRuntime(\"Database connection failed\", {\n\t\t\t\twhy: error instanceof Error ? error.message : String(error),\n\t\t\t\tfix: \"Verify the MongoDB URL, ensure the database is reachable, and confirm credentials/permissions\",\n\t\t\t\tmeta: { ...redactDatabaseUrl(url) }\n\t\t\t});\n\t\t}\n\t}\n};\n//#endregion\nexport { MongoControlDriver, mongoControlDriverDescriptor as default };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;AAKA,IAAI,qBAAqB,cAAc,gBAAgB;CACtD,WAAW;CACX,WAAW;CACX;CACA,YAAY,IAAI,aAAa;EAC5B,MAAM,IAAI,WAAW;EACrB,KAAK,KAAK;CACX;AACD;AACA,MAAM,+BAA+B;CACpC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS,YAAY;CACrB,cAAc,CAAC;CACf,MAAM,OAAO,KAAK;EACjB,MAAM,SAAS,IAAI,YAAY,KAAK;GACnC,0BAA0B;GAC1B,kBAAkB;GAClB,YAAY;EACb,CAAC;EACD,IAAI;GACH,MAAM,OAAO,QAAQ;GACrB,OAAO,IAAI,mBAAmB,OAAO,GAAG,GAAG,MAAM;EAClD,SAAS,OAAO;GACf,IAAI;IACH,MAAM,OAAO,MAAM;GACpB,QAAQ,CAAC;GACT,MAAM,aAAa,8BAA8B;IAChD,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;IAC1D,KAAK;IACL,MAAM,EAAE,GAAG,kBAAkB,GAAG,EAAE;GACnC,CAAC;EACF;CACD;AACD"}
@@ -0,0 +1,42 @@
1
+ import { n as CollModMeta } from "./op-factory-call-B7EKa4Ri-B2Lb6W68.mjs";
2
+ import { CollModOptions, CreateCollectionOptions, CreateIndexOptions, MongoDataTransformOperation, MongoFilterExpr, MongoIndexKey, MongoMigrationPlanOperation } from "@prisma/orm-family-mongo/query-ast/control";
3
+ import { MongoQueryPlan } from "@prisma/orm-family-mongo/query-ast/execution";
4
+ import { MigrationCLI } from "@prisma/orm-toolchain/cli/migration-cli";
5
+ import { placeholder } from "@prisma/orm-framework/errors/migration";
6
+ import { Migration } from "@prisma/orm-family-mongo/family/migration";
7
+ //#region ../../../3-mongo-target/1-mongo-target/dist/migration.d.mts
8
+ //#region src/core/migration-factories.d.ts
9
+ interface Buildable {
10
+ build(): MongoQueryPlan;
11
+ }
12
+ declare function dataTransform(name: string, options: {
13
+ /**
14
+ * Optional opt-in routing identity. Presence opts the transform into
15
+ * invariant-aware routing; absence means it is path-dependent and
16
+ * not referenceable from refs.
17
+ */
18
+ invariantId?: string;
19
+ check?: {
20
+ source: () => MongoQueryPlan | Buildable;
21
+ filter?: MongoFilterExpr;
22
+ expect?: 'exists' | 'notExists';
23
+ description?: string;
24
+ };
25
+ run: () => MongoQueryPlan | Buildable;
26
+ }): MongoDataTransformOperation;
27
+ declare function createIndex(collectionName: string, keys: ReadonlyArray<MongoIndexKey>, options?: CreateIndexOptions): MongoMigrationPlanOperation;
28
+ declare function dropIndex(collectionName: string, keys: ReadonlyArray<MongoIndexKey>): MongoMigrationPlanOperation;
29
+ declare function createCollection(collectionName: string, options?: CreateCollectionOptions): MongoMigrationPlanOperation;
30
+ declare function dropCollection(collectionName: string): MongoMigrationPlanOperation;
31
+ declare function setValidation(collectionName: string, schema: Record<string, unknown>, options?: {
32
+ validationLevel?: 'strict' | 'moderate';
33
+ validationAction?: 'error' | 'warn';
34
+ }): MongoMigrationPlanOperation;
35
+ declare function collMod(collectionName: string, options: CollModOptions, meta?: CollModMeta): MongoMigrationPlanOperation;
36
+ declare function validatedCollection(name: string, schema: Record<string, unknown>, indexes: ReadonlyArray<{
37
+ keys: MongoIndexKey[];
38
+ unique?: boolean;
39
+ }>): MongoMigrationPlanOperation[];
40
+ //#endregion
41
+ export { createIndex as a, dropIndex as c, validatedCollection as d, createCollection as i, placeholder as l, MigrationCLI as n, dataTransform as o, collMod as r, dropCollection as s, Migration as t, setValidation as u };
42
+ //# sourceMappingURL=migration-BkqcE2Uv.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-BkqcE2Uv.d.mts","names":[],"sources":["../../../../3-mongo-target/1-mongo-target/dist/migration.d.mts"],"mappings":";;;;;;;;UAOU;EACR,SAAS;;iBAEM,cAAc,cAAc;;;;;;EAM3C;EACA;IACE,cAAc,iBAAiB;IAC/B,SAAS;IACT;IACA;;EAEF,WAAW,iBAAiB;IAC1B;iBACa,YAAY,wBAAwB,MAAM,cAAc,gBAAgB,UAAU,qBAAqB;iBACvG,UAAU,wBAAwB,MAAM,cAAc,iBAAiB;iBACvE,iBAAiB,wBAAwB,UAAU,0BAA0B;iBAC7E,eAAe,yBAAyB;iBACxC,cAAc,wBAAwB,QAAQ,yBAAyB;EACtF;EACA;IACE;iBACa,QAAQ,wBAAwB,SAAS,gBAAgB,OAAO,cAAc;iBAC9E,oBAAoB,cAAc,QAAQ,yBAAyB,SAAS;EAC3F,MAAM;EACN;KACG"}
@@ -0,0 +1,4 @@
1
+ import { MigrationCLI } from "@prisma/orm-toolchain/cli/migration-cli";
2
+ import { placeholder } from "@prisma/orm-framework/errors/migration";
3
+ import { Migration } from "@prisma/orm-family-mongo/family/migration";
4
+ export { MigrationCLI as n, placeholder as r, Migration as t };
@@ -0,0 +1,201 @@
1
+ import { ifDefined } from "@prisma/orm-framework/utils/defined";
2
+ import { blindCast } from "@prisma/orm-framework/utils/casts";
3
+ import { CollModCommand, DropCollectionCommand, DropIndexCommand, ListCollectionsCommand, ListIndexesCommand, MongoAndExpr, MongoExistsExpr, MongoFieldFilter, buildIndexOpId, defaultMongoIndexName, keysToKeySpec } from "@prisma/orm-family-mongo/query-ast/control";
4
+ import { createFieldAccessor } from "@prisma/orm-family-mongo/query-builder";
5
+ import { collection } from "@prisma/orm-family-mongo/query-builder/contract-free";
6
+ //#region ../../../3-mongo-target/1-mongo-target/dist/migration-factories-CCJFG_3e.mjs
7
+ function isBuildable(value) {
8
+ return typeof value === "object" && value !== null && "build" in value && typeof value.build === "function";
9
+ }
10
+ function resolveQuery(value) {
11
+ return isBuildable(value) ? value.build() : value;
12
+ }
13
+ const MATCH_ALL_FILTER = MongoExistsExpr.exists("_id");
14
+ function dataTransform(name, options) {
15
+ let precheck = [];
16
+ let postcheck = [];
17
+ if (options.check) {
18
+ const source = resolveQuery(options.check.source());
19
+ const filter = options.check.filter ?? MATCH_ALL_FILTER;
20
+ const description = options.check.description ?? `Check for data transform: ${name}`;
21
+ const precheckExpect = options.check.expect ?? "exists";
22
+ const postcheckExpect = precheckExpect === "exists" ? "notExists" : "exists";
23
+ precheck = [{
24
+ description,
25
+ source,
26
+ filter,
27
+ expect: precheckExpect
28
+ }];
29
+ postcheck = [{
30
+ description,
31
+ source,
32
+ filter,
33
+ expect: postcheckExpect
34
+ }];
35
+ }
36
+ const run = [resolveQuery(options.run())];
37
+ return {
38
+ id: `data_transform.${name}`,
39
+ label: `Data transform: ${name}`,
40
+ operationClass: "data",
41
+ name,
42
+ ...ifDefined("invariantId", options.invariantId),
43
+ precheck,
44
+ run,
45
+ postcheck
46
+ };
47
+ }
48
+ function formatKeys(keys) {
49
+ return keys.map((k) => `${k.field}:${k.direction}`).join(", ");
50
+ }
51
+ function isTextIndex(keys) {
52
+ return keys.some((k) => k.direction === "text");
53
+ }
54
+ function keyFilter(keys) {
55
+ const f = createFieldAccessor();
56
+ return isTextIndex(keys) ? f.rawPath("key._fts").eq("text") : f.key.eq(blindCast(keysToKeySpec(keys)));
57
+ }
58
+ function createIndex(collectionName, keys, options) {
59
+ const name = defaultMongoIndexName(keys);
60
+ const f = createFieldAccessor();
61
+ const filter = keyFilter(keys);
62
+ const fullFilter = options?.unique ? filter.and(f.unique.eq(true)) : filter;
63
+ return {
64
+ id: buildIndexOpId("create", collectionName, keys),
65
+ label: `Create index on ${collectionName} (${formatKeys(keys)})`,
66
+ operationClass: "additive",
67
+ precheck: [{
68
+ description: `index does not already exist on ${collectionName}`,
69
+ source: new ListIndexesCommand(collectionName),
70
+ filter,
71
+ expect: "notExists"
72
+ }],
73
+ execute: [{
74
+ description: `create index on ${collectionName}`,
75
+ command: collection(collectionName).createIndex(keys, {
76
+ ...options,
77
+ name
78
+ })
79
+ }],
80
+ postcheck: [{
81
+ description: `index exists on ${collectionName}`,
82
+ source: new ListIndexesCommand(collectionName),
83
+ filter: fullFilter,
84
+ expect: "exists"
85
+ }]
86
+ };
87
+ }
88
+ function dropIndex(collectionName, keys) {
89
+ const indexName = defaultMongoIndexName(keys);
90
+ const filter = keyFilter(keys);
91
+ return {
92
+ id: buildIndexOpId("drop", collectionName, keys),
93
+ label: `Drop index on ${collectionName} (${formatKeys(keys)})`,
94
+ operationClass: "destructive",
95
+ precheck: [{
96
+ description: `index exists on ${collectionName}`,
97
+ source: new ListIndexesCommand(collectionName),
98
+ filter,
99
+ expect: "exists"
100
+ }],
101
+ execute: [{
102
+ description: `drop index on ${collectionName}`,
103
+ command: new DropIndexCommand(collectionName, indexName)
104
+ }],
105
+ postcheck: [{
106
+ description: `index no longer exists on ${collectionName}`,
107
+ source: new ListIndexesCommand(collectionName),
108
+ filter,
109
+ expect: "notExists"
110
+ }]
111
+ };
112
+ }
113
+ function createCollection(collectionName, options) {
114
+ const f = createFieldAccessor();
115
+ return {
116
+ id: `collection.${collectionName}.create`,
117
+ label: `Create collection ${collectionName}`,
118
+ operationClass: "additive",
119
+ precheck: [{
120
+ description: `collection ${collectionName} does not exist`,
121
+ source: new ListCollectionsCommand(),
122
+ filter: f.name.eq(collectionName),
123
+ expect: "notExists"
124
+ }],
125
+ execute: [{
126
+ description: `create collection ${collectionName}`,
127
+ command: collection(collectionName).createCollection(options)
128
+ }],
129
+ postcheck: []
130
+ };
131
+ }
132
+ function dropCollection(collectionName) {
133
+ return {
134
+ id: `collection.${collectionName}.drop`,
135
+ label: `Drop collection ${collectionName}`,
136
+ operationClass: "destructive",
137
+ precheck: [],
138
+ execute: [{
139
+ description: `drop collection ${collectionName}`,
140
+ command: new DropCollectionCommand(collectionName)
141
+ }],
142
+ postcheck: []
143
+ };
144
+ }
145
+ function setValidation(collectionName, schema, options) {
146
+ return {
147
+ id: `collection.${collectionName}.setValidation`,
148
+ label: `Set validation on ${collectionName}`,
149
+ operationClass: "destructive",
150
+ precheck: [],
151
+ execute: [{
152
+ description: `set validation on ${collectionName}`,
153
+ command: new CollModCommand(collectionName, {
154
+ validator: { $jsonSchema: schema },
155
+ ...ifDefined("validationLevel", options?.validationLevel),
156
+ ...ifDefined("validationAction", options?.validationAction)
157
+ })
158
+ }],
159
+ postcheck: []
160
+ };
161
+ }
162
+ function collMod(collectionName, options, meta) {
163
+ const hasValidator = options.validator != null && Object.keys(options.validator).length > 0;
164
+ return {
165
+ id: meta?.id ?? `collection.${collectionName}.collMod`,
166
+ label: meta?.label ?? `Modify collection ${collectionName}`,
167
+ operationClass: meta?.operationClass ?? "destructive",
168
+ precheck: options.validator != null ? [{
169
+ description: `collection ${collectionName} exists`,
170
+ source: new ListCollectionsCommand(),
171
+ filter: MongoFieldFilter.eq("name", collectionName),
172
+ expect: "exists"
173
+ }] : [],
174
+ execute: [{
175
+ description: `modify ${collectionName}`,
176
+ command: new CollModCommand(collectionName, options)
177
+ }],
178
+ postcheck: hasValidator ? [{
179
+ description: `validator applied on ${collectionName}`,
180
+ source: new ListCollectionsCommand(),
181
+ filter: MongoAndExpr.of([
182
+ MongoFieldFilter.eq("name", collectionName),
183
+ ...options.validationLevel ? [MongoFieldFilter.eq("options.validationLevel", options.validationLevel)] : [],
184
+ ...options.validationAction ? [MongoFieldFilter.eq("options.validationAction", options.validationAction)] : [],
185
+ ...options.validator?.["$jsonSchema"] !== void 0 ? [MongoFieldFilter.eq("options.validator.$jsonSchema", blindCast(options.validator?.["$jsonSchema"]))] : []
186
+ ]),
187
+ expect: "exists"
188
+ }] : []
189
+ };
190
+ }
191
+ function validatedCollection(name, schema, indexes) {
192
+ return [createCollection(name, {
193
+ validator: { $jsonSchema: schema },
194
+ validationLevel: "strict",
195
+ validationAction: "error"
196
+ }), ...indexes.map((idx) => createIndex(name, idx.keys, idx.unique !== void 0 ? { unique: idx.unique } : void 0))];
197
+ }
198
+ //#endregion
199
+ export { dropCollection as a, validatedCollection as c, dataTransform as i, createCollection as n, dropIndex as o, createIndex as r, setValidation as s, collMod as t };
200
+
201
+ //# sourceMappingURL=migration-factories-CCJFG_3e-75oJ8xn2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-factories-CCJFG_3e-75oJ8xn2.mjs","names":[],"sources":["../../../../3-mongo-target/1-mongo-target/dist/migration-factories-CCJFG_3e.mjs"],"sourcesContent":["import { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { CollModCommand, DropCollectionCommand, DropIndexCommand, ListCollectionsCommand, ListIndexesCommand, MongoAndExpr, MongoExistsExpr, MongoFieldFilter, buildIndexOpId, defaultMongoIndexName, keysToKeySpec } from \"@internal/mongo-query-ast/control\";\nimport { createFieldAccessor } from \"@internal/mongo-query-builder\";\nimport { collection } from \"@internal/mongo-query-builder/contract-free\";\n//#region src/core/migration-factories.ts\nfunction isBuildable(value) {\n\treturn typeof value === \"object\" && value !== null && \"build\" in value && typeof 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}\nfunction formatKeys(keys) {\n\treturn keys.map((k) => `${k.field}:${k.direction}`).join(\", \");\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 createIndex(collectionName, keys, options) {\n\tconst name = defaultMongoIndexName(keys);\n\tconst f = createFieldAccessor();\n\tconst filter = keyFilter(keys);\n\tconst fullFilter = options?.unique ? filter.and(f.unique.eq(true)) : filter;\n\treturn {\n\t\tid: buildIndexOpId(\"create\", collectionName, keys),\n\t\tlabel: `Create index on ${collectionName} (${formatKeys(keys)})`,\n\t\toperationClass: \"additive\",\n\t\tprecheck: [{\n\t\t\tdescription: `index does not already exist on ${collectionName}`,\n\t\t\tsource: new ListIndexesCommand(collectionName),\n\t\t\tfilter,\n\t\t\texpect: \"notExists\"\n\t\t}],\n\t\texecute: [{\n\t\t\tdescription: `create index 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 exists on ${collectionName}`,\n\t\t\tsource: new ListIndexesCommand(collectionName),\n\t\t\tfilter: fullFilter,\n\t\t\texpect: \"exists\"\n\t\t}]\n\t};\n}\nfunction dropIndex(collectionName, keys) {\n\tconst indexName = defaultMongoIndexName(keys);\n\tconst filter = keyFilter(keys);\n\treturn {\n\t\tid: buildIndexOpId(\"drop\", collectionName, keys),\n\t\tlabel: `Drop index on ${collectionName} (${formatKeys(keys)})`,\n\t\toperationClass: \"destructive\",\n\t\tprecheck: [{\n\t\t\tdescription: `index exists on ${collectionName}`,\n\t\t\tsource: new ListIndexesCommand(collectionName),\n\t\t\tfilter,\n\t\t\texpect: \"exists\"\n\t\t}],\n\t\texecute: [{\n\t\t\tdescription: `drop index on ${collectionName}`,\n\t\t\tcommand: new DropIndexCommand(collectionName, indexName)\n\t\t}],\n\t\tpostcheck: [{\n\t\t\tdescription: `index no longer exists on ${collectionName}`,\n\t\t\tsource: new ListIndexesCommand(collectionName),\n\t\t\tfilter,\n\t\t\texpect: \"notExists\"\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}],\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 setValidation(collectionName, schema, options) {\n\treturn {\n\t\tid: `collection.${collectionName}.setValidation`,\n\t\tlabel: `Set validation on ${collectionName}`,\n\t\toperationClass: \"destructive\",\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}\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 ?? \"destructive\",\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}] : [],\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\t...options.validator?.[\"$jsonSchema\"] !== void 0 ? [MongoFieldFilter.eq(\"options.validator.$jsonSchema\", blindCast(options.validator?.[\"$jsonSchema\"]))] : []\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, validatedCollection as c, dataTransform as i, createCollection as n, dropIndex as o, createIndex as r, setValidation as s, collMod as t };\n\n//# sourceMappingURL=migration-factories-CCJFG_3e.mjs.map"],"mappings":";;;;;;AAMA,SAAS,YAAY,OAAO;CAC3B,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,WAAW,SAAS,OAAO,MAAM,UAAU;AAClG;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,OAA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