@prisma/orm-target-mongo 0.17.0-dev.2 → 0.17.0-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { t as mongoTargetDescriptorMeta } from "./descriptor-meta-CBiaTwe5-HX742pZh.mjs";
2
2
  import { a as dropCollection, n as createCollection, o as dropIndex, r as createIndex, t as collMod } from "./migration-factories-CCJFG_3e-75oJ8xn2.mjs";
3
3
  import { i as extractDb, r as createMongoRunnerDeps } from "./control-BOc5lrQg.mjs";
4
- import { n as MongoDriverImpl } from "./mongo-driver-avj3tZIq-B_9jX0Ps.mjs";
4
+ import { n as MongoDriverImpl } from "./mongo-driver-D7h_OJw6-JzI2ZAxd.mjs";
5
5
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
6
6
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
7
7
  import { NamespaceBase, UNBOUND_NAMESPACE_ID, elementCoordinates, freezeNode, hydrateNamespaceEntities } from "@prisma/orm-framework/components/ir";
@@ -1560,4 +1560,4 @@ const mongoTargetDescriptor = {
1560
1560
  //#endregion
1561
1561
  export { renderCallsToTypeScript as _, DropIndexCall as a, schemaIndexToCreateIndexOptions as b, MongoMigrationRunner as c, MongoTargetSchemaVerifier as d, MongoTargetUnboundDatabase as f, mongoTargetDescriptor as g, deserializeMongoOps as h, DropCollectionCall as i, MongoTargetContractSerializer as l, deserializeMongoOp as m, CreateCollectionCall as n, FilterEvaluator as o, PlannerProducedMongoMigration as p, CreateIndexCall as r, MongoMigrationPlanner as s, CollModCall as t, MongoTargetDatabase as u, renderOps as v, serializeMongoOps as x, schemaCollectionToCreateCollectionOptions as y };
1562
1562
 
1563
- //# sourceMappingURL=control-Dzjwk7cK.mjs.map
1563
+ //# sourceMappingURL=control-TQcTpB3d.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-Dzjwk7cK.mjs","names":[],"sources":["../../../../3-mongo-target/1-mongo-target/dist/control.mjs"],"sourcesContent":["import { t as mongoTargetDescriptorMeta } from \"./descriptor-meta-CBiaTwe5.mjs\";\nimport { a as dropCollection, n as createCollection, o as dropIndex, r as createIndex, t as collMod } from \"./migration-factories-CCJFG_3e.mjs\";\nimport { NamespaceBase, UNBOUND_NAMESPACE_ID, elementCoordinates, freezeNode, hydrateNamespaceEntities } from \"@internal/framework-components/ir\";\nimport { createMongoRunnerDeps, extractDb } from \"@internal/adapter-mongo/control\";\nimport { MongoDriverImpl } from \"@internal/driver-mongo\";\nimport { canonicalizeSchemasForVerification, contractToMongoSchemaIR, diffMongoSchemas } from \"@internal/family-mongo/control\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { canonicalize, deepEqual } from \"@internal/mongo-schema-ir\";\nimport { TsExpression, jsonToTsSource, renderImports } from \"@internal/ts-render\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { CollModCommand, CreateCollectionCommand, CreateIndexCommand, DropCollectionCommand, DropIndexCommand, ListCollectionsCommand, ListIndexesCommand, MongoAndExpr, MongoExistsExpr, MongoFieldFilter, MongoNotExpr, MongoOrExpr } from \"@internal/mongo-query-ast/control\";\nimport { Migration } from \"@internal/migration-tools/migration\";\nimport { APP_SPACE_ID, contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier, issueOutcome } from \"@internal/framework-components/control\";\nimport { resolveRequirementSpecifiers } from \"@internal/framework-components/emission\";\nimport { detectScaffoldRuntime, shebangLineFor } from \"@internal/migration-tools/migration-ts\";\nimport { errorRunnerFailed } from \"@internal/errors/execution\";\nimport { verifyMongoSchema } from \"@internal/family-mongo/schema-verify\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { AggregateCommand, MongoAddFieldsStage, MongoLimitStage, MongoLookupStage, MongoMatchStage, MongoMergeStage, MongoProjectStage, MongoSortStage, RawAggregateCommand, RawDeleteManyCommand, RawDeleteOneCommand, RawFindOneAndDeleteCommand, RawFindOneAndUpdateCommand, RawInsertManyCommand, RawInsertOneCommand, RawUpdateManyCommand, RawUpdateOneCommand } from \"@internal/mongo-query-ast/execution\";\nimport { type } from \"arktype\";\nimport { MongoContractSerializerBase, MongoSchemaVerifierBase } from \"@internal/family-mongo/ir\";\nimport { MongoStorage } from \"@internal/mongo-contract\";\nimport { composeMongoEntityKinds } from \"@internal/mongo-contract/entity-kinds\";\n//#region src/core/op-factory-call.ts\n/**\n* The single module a scaffolded Mongo `migration.ts` imports from: the\n* operation factories below, plus the `Migration` base and `MigrationCLI`\n* that `render-typescript.ts` adds. The authored name; `render-typescript.ts`\n* maps it to whatever the consuming application's import root calls it,\n* once over the whole assembled import list.\n*/\nconst TARGET_MIGRATION_MODULE = \"@internal/target-mongo/migration\";\nvar OpFactoryCallNode = class extends TsExpression {\n\timportRequirements() {\n\t\treturn [{\n\t\t\tmoduleSpecifier: TARGET_MIGRATION_MODULE,\n\t\t\tsymbol: this.factoryName\n\t\t}];\n\t}\n\tfreeze() {\n\t\tObject.freeze(this);\n\t}\n};\nfunction formatKeys(keys) {\n\treturn keys.map((k) => `${k.field}:${k.direction}`).join(\", \");\n}\nvar CreateIndexCall = class extends OpFactoryCallNode {\n\tfactoryName = \"createIndex\";\n\toperationClass = \"additive\";\n\tcollection;\n\tkeys;\n\toptions;\n\tlabel;\n\tconstructor(collection, keys, options) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.keys = keys;\n\t\tthis.options = options;\n\t\tthis.label = `Create index on ${collection} (${formatKeys(keys)})`;\n\t\tthis.freeze();\n\t}\n\ttoOp() {\n\t\treturn createIndex(this.collection, this.keys, this.options);\n\t}\n\trenderTypeScript() {\n\t\treturn this.options ? `createIndex(${jsonToTsSource(this.collection)}, ${jsonToTsSource(this.keys)}, ${jsonToTsSource(this.options)})` : `createIndex(${jsonToTsSource(this.collection)}, ${jsonToTsSource(this.keys)})`;\n\t}\n};\nvar DropIndexCall = class extends OpFactoryCallNode {\n\tfactoryName = \"dropIndex\";\n\toperationClass = \"destructive\";\n\tcollection;\n\tkeys;\n\tlabel;\n\tconstructor(collection, keys) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.keys = keys;\n\t\tthis.label = `Drop index on ${collection} (${formatKeys(keys)})`;\n\t\tthis.freeze();\n\t}\n\ttoOp() {\n\t\treturn dropIndex(this.collection, this.keys);\n\t}\n\trenderTypeScript() {\n\t\treturn `dropIndex(${jsonToTsSource(this.collection)}, ${jsonToTsSource(this.keys)})`;\n\t}\n};\nvar CreateCollectionCall = class extends OpFactoryCallNode {\n\tfactoryName = \"createCollection\";\n\toperationClass = \"additive\";\n\tcollection;\n\toptions;\n\tlabel;\n\tconstructor(collection, options) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.options = options;\n\t\tthis.label = `Create collection ${collection}`;\n\t\tthis.freeze();\n\t}\n\ttoOp() {\n\t\treturn createCollection(this.collection, this.options);\n\t}\n\trenderTypeScript() {\n\t\treturn this.options ? `createCollection(${jsonToTsSource(this.collection)}, ${jsonToTsSource(this.options)})` : `createCollection(${jsonToTsSource(this.collection)})`;\n\t}\n};\nvar DropCollectionCall = class extends OpFactoryCallNode {\n\tfactoryName = \"dropCollection\";\n\toperationClass = \"destructive\";\n\tcollection;\n\tlabel;\n\tconstructor(collection) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.label = `Drop collection ${collection}`;\n\t\tthis.freeze();\n\t}\n\ttoOp() {\n\t\treturn dropCollection(this.collection);\n\t}\n\trenderTypeScript() {\n\t\treturn `dropCollection(${jsonToTsSource(this.collection)})`;\n\t}\n};\nvar CollModCall = class extends OpFactoryCallNode {\n\tfactoryName = \"collMod\";\n\tcollection;\n\toptions;\n\tmeta;\n\toperationClass;\n\tlabel;\n\tconstructor(collection, options, meta) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.options = options;\n\t\tthis.meta = meta;\n\t\tthis.operationClass = meta?.operationClass ?? \"destructive\";\n\t\tthis.label = meta?.label ?? `Modify collection ${collection}`;\n\t\tthis.freeze();\n\t}\n\ttoOp() {\n\t\treturn collMod(this.collection, this.options, this.meta);\n\t}\n\trenderTypeScript() {\n\t\treturn this.meta ? `collMod(${jsonToTsSource(this.collection)}, ${jsonToTsSource(this.options)}, ${jsonToTsSource(this.meta)})` : `collMod(${jsonToTsSource(this.collection)}, ${jsonToTsSource(this.options)})`;\n\t}\n};\nfunction schemaIndexToCreateIndexOptions(index) {\n\treturn {\n\t\t...index.unique ? { unique: true } : {},\n\t\t...ifDefined(\"sparse\", index.sparse),\n\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds),\n\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression),\n\t\t...ifDefined(\"wildcardProjection\", index.wildcardProjection),\n\t\t...ifDefined(\"collation\", index.collation),\n\t\t...ifDefined(\"weights\", index.weights),\n\t\t...ifDefined(\"default_language\", index.default_language),\n\t\t...ifDefined(\"language_override\", index.language_override)\n\t};\n}\nfunction schemaCollectionToCreateCollectionOptions(coll) {\n\tconst opts = coll.options;\n\tconst validator = coll.validator;\n\tif (!opts && !validator) return void 0;\n\treturn {\n\t\t...opts?.capped ? { capped: true } : {},\n\t\t...ifDefined(\"size\", opts?.capped?.size),\n\t\t...ifDefined(\"max\", opts?.capped?.max),\n\t\t...ifDefined(\"timeseries\", opts?.timeseries),\n\t\t...ifDefined(\"collation\", opts?.collation),\n\t\t...opts?.clusteredIndex ? { clusteredIndex: {\n\t\t\tkey: { _id: 1 },\n\t\t\tunique: true,\n\t\t\t...opts.clusteredIndex.name != null ? { name: opts.clusteredIndex.name } : {}\n\t\t} } : {},\n\t\t...validator ? { validator: { $jsonSchema: validator.jsonSchema } } : {},\n\t\t...ifDefined(\"validationLevel\", validator?.validationLevel),\n\t\t...ifDefined(\"validationAction\", validator?.validationAction),\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", opts?.changeStreamPreAndPostImages)\n\t};\n}\n//#endregion\n//#region src/core/render-ops.ts\nfunction renderOps(calls) {\n\treturn calls.map((call) => call.toOp());\n}\n//#endregion\n//#region src/core/render-typescript.ts\n/**\n* Always-present base imports for the rendered scaffold, both from the\n* target's own `migration` entry:\n*\n* - `Migration` — the user-facing Mongo `Migration` base, forwarded from\n* `@internal/family-mongo`; subclasses don't need to redeclare\n* `targetId` or thread family/target generics.\n* - `MigrationCLI` — the migration-file CLI entrypoint that loads\n* `prisma-next.config.ts`, assembles a `ControlStack`, and instantiates\n* the migration class. The migration file owns this dependency directly:\n* pulling CLI machinery in at script run time is acceptable because the\n* script's whole purpose is to be invoked from the project that owns the\n* config.\n*\n* Naming one package rather than three is what lets an application that\n* installed only `@prisma/orm-mongo` run a scaffolded migration: emitted\n* code may name only a direct dependency (ADR 242), and the facade carries\n* the target's `migration` entry but neither the family base nor the CLI.\n*/\nconst BASE_IMPORTS = [{\n\tmoduleSpecifier: TARGET_MIGRATION_MODULE,\n\tsymbol: \"Migration\"\n}, {\n\tmoduleSpecifier: TARGET_MIGRATION_MODULE,\n\tsymbol: \"MigrationCLI\"\n}];\n/**\n* Render a list of Mongo `OpFactoryCall`s as a `migration.ts` source string.\n* The result is shebanged, imports the contract JSON from the shared\n* snapshot store (the destination contract, plus the source contract for a\n* non-baseline migration), extends `Migration<Start, End>` (or\n* `Migration<never, End>` for a baseline) from\n* `@internal/target-mongo/migration`,\n* assigns the JSON to `endContractJson` / `startContractJson`, and implements\n* `operations`. The `Migration` base derives `describe()` from those fields.\n*\n* The walk is polymorphic: each call node contributes its own\n* `renderTypeScript()` expression and declares its own `importRequirements()`.\n* The top-level renderer aggregates imports across all nodes and emits one\n* `import { … } from \"…\"` line per module. The `Migration` / `MigrationCLI`\n* base imports and the contract-JSON imports are always emitted, independent\n* of the call nodes.\n*/\nfunction renderCallsToTypeScript(calls, meta) {\n\tconst imports = buildImports(calls, meta);\n\tconst operationsBody = calls.map((c) => c.renderTypeScript()).join(\",\\n\");\n\tconst hasStart = meta.from !== null;\n\tconst startField = hasStart ? [\" override readonly startContractJson = startContract;\"] : [];\n\treturn [\n\t\tshebangLineFor(detectScaffoldRuntime()),\n\t\timports,\n\t\t\"\",\n\t\t`class M extends Migration<${hasStart ? \"Start\" : \"never\"}, End> {`,\n\t\t...startField,\n\t\t\" override readonly endContractJson = endContract;\",\n\t\t\"\",\n\t\t\" override get operations() {\",\n\t\t\" return [\",\n\t\tindent(operationsBody, 6),\n\t\t\" ];\",\n\t\t\" }\",\n\t\t\"}\",\n\t\t\"\",\n\t\t\"export default M;\",\n\t\t\"MigrationCLI.run(import.meta.url, M);\",\n\t\t\"\"\n\t].join(\"\\n\");\n}\nfunction buildImports(calls, meta) {\n\tconst requirements = [...BASE_IMPORTS, ...contractImports(meta)];\n\tfor (const call of calls) for (const req of call.importRequirements()) requirements.push(req);\n\treturn renderImports(resolveRequirementSpecifiers(requirements, meta.resolveImportSpecifier));\n}\n/**\n* The committed contract-JSON imports the scaffold reads its from/to identity\n* from, resolved to the deduplicated snapshot store under\n* `meta.snapshotsImportPath`. The end snapshot is always present; the start\n* snapshot is added only for a non-baseline migration (`meta.from !== null`).\n* The matching `Contract` type imports (aliased `Start`/`End`) feed the\n* `Migration<Start, End>` generics. Baseline emits `Migration<never, End>` with\n* no start imports — `never` is the honest \"no prior contract\" Start.\n*/\nfunction contractImports(meta) {\n\tconst reqs = [{\n\t\tmoduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.to),\n\t\tsymbol: \"endContract\",\n\t\tkind: \"default\",\n\t\tattributes: { type: \"json\" }\n\t}, {\n\t\tmoduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.to),\n\t\tsymbol: \"Contract\",\n\t\talias: \"End\",\n\t\ttypeOnly: true\n\t}];\n\tif (meta.from !== null) {\n\t\treqs.push({\n\t\t\tmoduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.from),\n\t\t\tsymbol: \"startContract\",\n\t\t\tkind: \"default\",\n\t\t\tattributes: { type: \"json\" }\n\t\t});\n\t\treqs.push({\n\t\t\tmoduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.from),\n\t\t\tsymbol: \"Contract\",\n\t\t\talias: \"Start\",\n\t\t\ttypeOnly: true\n\t\t});\n\t}\n\treturn reqs;\n}\nfunction indent(text, spaces) {\n\tconst pad = \" \".repeat(spaces);\n\treturn text.split(\"\\n\").map((line) => line.trim() ? `${pad}${line}` : line).join(\"\\n\");\n}\n//#endregion\n//#region src/core/planner-produced-migration.ts\n/**\n* Planner-produced Mongo migration, returned by `MongoMigrationPlanner.plan(...)`\n* and `MongoMigrationPlanner.emptyMigration(...)`.\n*\n* Unlike user-authored migrations (which extend `MongoMigration` from\n* `@internal/family-mongo`), this class lives inside the target and holds\n* the richer authoring IR (`OpFactoryCall[]`) needed to render itself back to\n* TypeScript source. It implements `MigrationPlanWithAuthoringSurface` so\n* that the CLI can uniformly ask any planner result to serialize itself to a\n* `migration.ts`.\n*\n* It extends the framework `Migration` base directly and declares its own\n* `targetId` rather than inheriting `MongoMigration`, whose added value is\n* the lazily-built contract views a planner result never reads.\n*/\nvar PlannerProducedMongoMigration = class extends Migration {\n\tcalls;\n\tmeta;\n\tsnapshotsImportPath;\n\ttargetId = \"mongo\";\n\tconstructor(calls, meta, snapshotsImportPath) {\n\t\tsuper();\n\t\tthis.calls = calls;\n\t\tthis.meta = meta;\n\t\tthis.snapshotsImportPath = snapshotsImportPath;\n\t}\n\tget operations() {\n\t\treturn renderOps(this.calls);\n\t}\n\tdescribe() {\n\t\treturn this.meta;\n\t}\n\trenderTypeScript(resolveImportSpecifier) {\n\t\treturn renderCallsToTypeScript(this.calls, {\n\t\t\tfrom: this.meta.from,\n\t\t\tto: this.meta.to,\n\t\t\tsnapshotsImportPath: this.snapshotsImportPath,\n\t\t\tresolveImportSpecifier\n\t\t});\n\t}\n};\n//#endregion\n//#region src/core/mongo-planner.ts\nfunction buildIndexLookupKey(index) {\n\tconst keys = index.keys.map((k) => `${k.field}:${k.direction}`).join(\",\");\n\tconst opts = [\n\t\tindex.unique ? \"unique\" : \"\",\n\t\tindex.sparse ? \"sparse\" : \"\",\n\t\tindex.expireAfterSeconds != null ? `ttl:${index.expireAfterSeconds}` : \"\",\n\t\tindex.partialFilterExpression ? `pfe:${canonicalize(index.partialFilterExpression)}` : \"\",\n\t\tindex.wildcardProjection ? `wp:${canonicalize(index.wildcardProjection)}` : \"\",\n\t\tindex.collation ? `col:${canonicalize(index.collation)}` : \"\",\n\t\tindex.weights ? `wt:${canonicalize(index.weights)}` : \"\",\n\t\tindex.default_language ? `dl:${index.default_language}` : \"\",\n\t\tindex.language_override ? `lo:${index.language_override}` : \"\"\n\t].filter(Boolean).join(\";\");\n\treturn opts ? `${keys}|${opts}` : keys;\n}\nfunction validatorsEqual(a, b) {\n\tif (!a && !b) return true;\n\tif (!a || !b) return false;\n\treturn a.validationLevel === b.validationLevel && a.validationAction === b.validationAction && canonicalize(a.jsonSchema) === canonicalize(b.jsonSchema);\n}\nfunction classifyValidatorUpdate(origin, dest) {\n\tif (origin.validationAction !== dest.validationAction && dest.validationAction === \"error\") return \"destructive\";\n\tif (origin.validationLevel !== dest.validationLevel && dest.validationLevel === \"strict\") return \"destructive\";\n\tif (canonicalize(origin.jsonSchema) === canonicalize(dest.jsonSchema)) return \"widening\";\n\treturn isWideningSchemaChange(origin.jsonSchema, dest.jsonSchema) ? \"widening\" : \"destructive\";\n}\nfunction isPlainObject(v) {\n\treturn typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n/**\n* Returns true when `dest` is a structural superset of `origin` for the common\n* additive case: adding non-required properties to a top-level object schema.\n* Anything uncertain falls through to the safe `destructive` default.\n*/\nfunction isWideningSchemaChange(origin, dest) {\n\tif (origin[\"bsonType\"] !== \"object\" || dest[\"bsonType\"] !== \"object\") return false;\n\tconst allKeys = /* @__PURE__ */ new Set([...Object.keys(origin), ...Object.keys(dest)]);\n\tfor (const key of allKeys) {\n\t\tif (key === \"required\" || key === \"properties\") continue;\n\t\tif (canonicalize(origin[key]) !== canonicalize(dest[key])) return false;\n\t}\n\tconst originRequired = new Set(Array.isArray(origin[\"required\"]) ? origin[\"required\"] : []);\n\tconst destRequired = Array.isArray(dest[\"required\"]) ? dest[\"required\"] : [];\n\tfor (const field of destRequired) if (!originRequired.has(field)) return false;\n\tconst originProps = isPlainObject(origin[\"properties\"]) ? origin[\"properties\"] : {};\n\tconst destProps = isPlainObject(dest[\"properties\"]) ? dest[\"properties\"] : {};\n\tfor (const field of Object.keys(originProps)) {\n\t\tif (!Object.hasOwn(destProps, field)) return false;\n\t\tif (canonicalize(originProps[field]) !== canonicalize(destProps[field])) return false;\n\t}\n\treturn true;\n}\nfunction hasImmutableOptionChange(origin, dest) {\n\tif (canonicalize(origin?.capped) !== canonicalize(dest?.capped)) return \"capped\";\n\tif (canonicalize(origin?.timeseries) !== canonicalize(dest?.timeseries)) return \"timeseries\";\n\tif (canonicalize(origin?.collation) !== canonicalize(dest?.collation)) return \"collation\";\n\tif (canonicalize(origin?.clusteredIndex) !== canonicalize(dest?.clusteredIndex)) return \"clusteredIndex\";\n}\nfunction collectionHasOptions(coll) {\n\treturn !!(coll.options || coll.validator);\n}\nvar MongoMigrationPlanner = class {\n\tplanCalls(options) {\n\t\tconst contract = options.contract;\n\t\tconst originIR = options.schema;\n\t\tconst destinationIR = contractToMongoSchemaIR(contract);\n\t\tconst collCreates = [];\n\t\tconst drops = [];\n\t\tconst creates = [];\n\t\tconst validatorOps = [];\n\t\tconst mutableOptionOps = [];\n\t\tconst collDrops = [];\n\t\tconst conflicts = [];\n\t\tconst allCollectionNames = /* @__PURE__ */ new Set([...originIR.collectionNames, ...destinationIR.collectionNames]);\n\t\tfor (const collName of [...allCollectionNames].sort()) {\n\t\t\tconst originColl = originIR.collection(collName);\n\t\t\tconst destColl = destinationIR.collection(collName);\n\t\t\tif (!originColl) {\n\t\t\t\tif (destColl && (collectionHasOptions(destColl) || destColl.indexes.length === 0)) {\n\t\t\t\t\tconst opts = collectionHasOptions(destColl) ? schemaCollectionToCreateCollectionOptions(destColl) : void 0;\n\t\t\t\t\tcollCreates.push(new CreateCollectionCall(collName, opts));\n\t\t\t\t}\n\t\t\t} else if (!destColl) collDrops.push(new DropCollectionCall(collName));\n\t\t\telse {\n\t\t\t\tconst immutableChange = hasImmutableOptionChange(originColl.options, destColl.options);\n\t\t\t\tif (immutableChange) conflicts.push({\n\t\t\t\t\tkind: \"policy-violation\",\n\t\t\t\t\tsummary: `Cannot change immutable collection option '${immutableChange}' on ${collName}`,\n\t\t\t\t\twhy: `MongoDB does not support modifying the '${immutableChange}' option after collection creation`\n\t\t\t\t});\n\t\t\t\tconst mutableCall = planMutableOptionsDiffCall(collName, originColl.options, destColl.options);\n\t\t\t\tif (mutableCall) mutableOptionOps.push(mutableCall);\n\t\t\t\tconst validatorCall = planValidatorDiffCall(collName, originColl.validator, destColl.validator);\n\t\t\t\tif (validatorCall) validatorOps.push(validatorCall);\n\t\t\t}\n\t\t\tconst originLookup = /* @__PURE__ */ new Map();\n\t\t\tif (originColl) for (const idx of originColl.indexes) originLookup.set(buildIndexLookupKey(idx), idx);\n\t\t\tconst destLookup = /* @__PURE__ */ new Map();\n\t\t\tif (destColl) for (const idx of destColl.indexes) destLookup.set(buildIndexLookupKey(idx), idx);\n\t\t\tfor (const [lookupKey, idx] of originLookup) if (!destLookup.has(lookupKey)) drops.push(new DropIndexCall(collName, idx.keys));\n\t\t\tfor (const [lookupKey, idx] of destLookup) if (!originLookup.has(lookupKey)) creates.push(new CreateIndexCall(collName, idx.keys, schemaIndexToCreateIndexOptions(idx)));\n\t\t}\n\t\tif (conflicts.length > 0) return {\n\t\t\tkind: \"failure\",\n\t\t\tconflicts\n\t\t};\n\t\tconst allCalls = [\n\t\t\t...collCreates,\n\t\t\t...drops,\n\t\t\t...creates,\n\t\t\t...validatorOps,\n\t\t\t...mutableOptionOps,\n\t\t\t...collDrops\n\t\t];\n\t\tfor (const call of allCalls) if (!options.policy.allowedOperationClasses.includes(call.operationClass)) conflicts.push({\n\t\t\tkind: \"policy-violation\",\n\t\t\tsummary: `${call.operationClass} operation disallowed: ${call.label}`,\n\t\t\twhy: `Policy does not allow '${call.operationClass}' operations`\n\t\t});\n\t\tif (conflicts.length > 0) return {\n\t\t\tkind: \"failure\",\n\t\t\tconflicts\n\t\t};\n\t\treturn {\n\t\t\tkind: \"success\",\n\t\t\tcalls: allCalls\n\t\t};\n\t}\n\tplan(options) {\n\t\tconst contract = options.contract;\n\t\tconst result = this.planCalls(options);\n\t\tif (result.kind === \"failure\") return result;\n\t\treturn {\n\t\t\tkind: \"success\",\n\t\t\tplan: new PlannerProducedMongoMigration(result.calls, {\n\t\t\t\tfrom: options.fromContract?.storage.storageHash ?? null,\n\t\t\t\tto: contract.storage.storageHash\n\t\t\t}, options.snapshotsImportPath)\n\t\t};\n\t}\n\t/**\n\t* Produce an empty `migration.ts` authoring surface for `migration new`.\n\t*\n\t* The \"empty migration\" is a `PlannerProducedMongoMigration` with no\n\t* operations; `renderTypeScript()` emits a stub class with the correct\n\t* `from`/`to` metadata that the user then fills in with operations. The\n\t* contract path on the context is unused — Mongo's emitted source does\n\t* not import from the generated contract `.d.ts`.\n\t*/\n\temptyMigration(context) {\n\t\treturn new PlannerProducedMongoMigration([], {\n\t\t\tfrom: context.fromHash,\n\t\t\tto: context.toHash\n\t\t}, context.snapshotsImportPath);\n\t}\n};\nfunction planValidatorDiffCall(collName, originValidator, destValidator) {\n\tif (validatorsEqual(originValidator, destValidator)) return void 0;\n\tif (destValidator) {\n\t\tconst operationClass = originValidator ? classifyValidatorUpdate(originValidator, destValidator) : \"destructive\";\n\t\treturn new CollModCall(collName, {\n\t\t\tvalidator: { $jsonSchema: destValidator.jsonSchema },\n\t\t\tvalidationLevel: destValidator.validationLevel,\n\t\t\tvalidationAction: destValidator.validationAction\n\t\t}, {\n\t\t\tid: `validator.${collName}.${originValidator ? \"update\" : \"add\"}`,\n\t\t\tlabel: `${originValidator ? \"Update\" : \"Add\"} validator on ${collName}`,\n\t\t\toperationClass\n\t\t});\n\t}\n\treturn new CollModCall(collName, {\n\t\tvalidator: {},\n\t\tvalidationLevel: \"strict\",\n\t\tvalidationAction: \"error\"\n\t}, {\n\t\tid: `validator.${collName}.remove`,\n\t\tlabel: `Remove validator on ${collName}`,\n\t\toperationClass: \"widening\"\n\t});\n}\nfunction planMutableOptionsDiffCall(collName, origin, dest) {\n\tconst originCSPPI = origin?.changeStreamPreAndPostImages;\n\tconst destCSPPI = dest?.changeStreamPreAndPostImages;\n\tif (deepEqual(originCSPPI, destCSPPI)) return void 0;\n\tconst desiredCSPPI = destCSPPI ?? { enabled: false };\n\treturn new CollModCall(collName, { changeStreamPreAndPostImages: desiredCSPPI }, {\n\t\tid: `options.${collName}.update`,\n\t\tlabel: `Update mutable options on ${collName}`,\n\t\toperationClass: desiredCSPPI.enabled ? \"widening\" : \"destructive\"\n\t});\n}\n//#endregion\n//#region src/core/mongo-target-errors.ts\nfunction mongoTargetError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/core/filter-evaluator.ts\nfunction getNestedField(doc, path) {\n\tconst parts = path.split(\".\");\n\tlet current = doc;\n\tfor (const part of parts) {\n\t\tif (current === null || current === void 0 || typeof current !== \"object\") return;\n\t\tconst record = current;\n\t\tif (!Object.hasOwn(record, part)) return;\n\t\tcurrent = record[part];\n\t}\n\treturn current;\n}\nfunction evaluateFieldOp(op, actual, expected) {\n\tswitch (op) {\n\t\tcase \"$eq\": return deepEqual(actual, expected);\n\t\tcase \"$ne\": return !deepEqual(actual, expected);\n\t\tcase \"$gt\": return typeof actual === typeof expected && actual > expected;\n\t\tcase \"$gte\": return typeof actual === typeof expected && actual >= expected;\n\t\tcase \"$lt\": return typeof actual === typeof expected && actual < expected;\n\t\tcase \"$lte\": return typeof actual === typeof expected && actual <= expected;\n\t\tcase \"$in\": return Array.isArray(expected) && expected.some((v) => deepEqual(actual, v));\n\t\tdefault: throw mongoTargetError(\"MIGRATION.OPERATION_UNSUPPORTED\", `Unsupported filter operator in migration check: ${op}`, { meta: { operator: op } });\n\t}\n}\nvar FilterEvaluator = class {\n\tdoc = {};\n\tevaluate(filter, doc) {\n\t\tthis.doc = doc;\n\t\treturn filter.accept(this);\n\t}\n\tfield(expr) {\n\t\tconst value = getNestedField(this.doc, expr.field);\n\t\treturn evaluateFieldOp(expr.op, value, expr.value);\n\t}\n\tand(expr) {\n\t\treturn expr.exprs.every((child) => child.accept(this));\n\t}\n\tor(expr) {\n\t\treturn expr.exprs.some((child) => child.accept(this));\n\t}\n\tnot(expr) {\n\t\treturn !expr.expr.accept(this);\n\t}\n\texists(expr) {\n\t\tconst has = getNestedField(this.doc, expr.field) !== void 0;\n\t\treturn expr.exists ? has : !has;\n\t}\n\texpr(_expr) {\n\t\tthrow mongoTargetError(\"MIGRATION.OPERATION_UNSUPPORTED\", \"Aggregation expression filters are not supported in migration checks\", { meta: { operator: \"$expr\" } });\n\t}\n};\n//#endregion\n//#region src/core/mongo-ops-serializer.ts\nconst IndexKeyJson = type({\n\tfield: \"string\",\n\tdirection: type(\"1 | -1 | \\\"text\\\" | \\\"2dsphere\\\" | \\\"2d\\\" | \\\"hashed\\\"\")\n});\nconst CollationJson = type({\n\tlocale: \"string\",\n\t\"caseLevel?\": \"boolean\",\n\t\"caseFirst?\": \"string\",\n\t\"strength?\": \"number\",\n\t\"numericOrdering?\": \"boolean\",\n\t\"alternate?\": \"string\",\n\t\"maxVariable?\": \"string\",\n\t\"backwards?\": \"boolean\",\n\t\"normalization?\": \"boolean\"\n});\nconst CreateIndexJson = type({\n\tkind: \"\\\"createIndex\\\"\",\n\tcollection: \"string\",\n\tkeys: IndexKeyJson.array().atLeastLength(1),\n\t\"unique?\": \"boolean\",\n\t\"sparse?\": \"boolean\",\n\t\"expireAfterSeconds?\": \"number\",\n\t\"partialFilterExpression?\": \"Record<string, unknown>\",\n\t\"name?\": \"string\",\n\t\"wildcardProjection?\": \"Record<string, 0 | 1>\",\n\t\"collation?\": CollationJson,\n\t\"weights?\": \"Record<string, number>\",\n\t\"default_language?\": \"string\",\n\t\"language_override?\": \"string\"\n});\nconst DropIndexJson = type({\n\tkind: \"\\\"dropIndex\\\"\",\n\tcollection: \"string\",\n\tname: \"string\"\n});\nconst CreateCollectionJson = type({\n\tkind: \"\\\"createCollection\\\"\",\n\tcollection: \"string\",\n\t\"validator?\": \"Record<string, unknown>\",\n\t\"validationLevel?\": \"\\\"strict\\\" | \\\"moderate\\\"\",\n\t\"validationAction?\": \"\\\"error\\\" | \\\"warn\\\"\",\n\t\"capped?\": \"boolean\",\n\t\"size?\": \"number\",\n\t\"max?\": \"number\",\n\t\"timeseries?\": {\n\t\ttimeField: \"string\",\n\t\t\"metaField?\": \"string\",\n\t\t\"granularity?\": \"\\\"seconds\\\" | \\\"minutes\\\" | \\\"hours\\\"\"\n\t},\n\t\"collation?\": CollationJson,\n\t\"changeStreamPreAndPostImages?\": { enabled: \"boolean\" },\n\t\"clusteredIndex?\": {\n\t\tkey: \"Record<string, number>\",\n\t\tunique: \"boolean\",\n\t\t\"name?\": \"string\"\n\t}\n});\nconst DropCollectionJson = type({\n\tkind: \"\\\"dropCollection\\\"\",\n\tcollection: \"string\"\n});\nconst CollModJson = type({\n\tkind: \"\\\"collMod\\\"\",\n\tcollection: \"string\",\n\t\"validator?\": \"Record<string, unknown>\",\n\t\"validationLevel?\": \"\\\"strict\\\" | \\\"moderate\\\"\",\n\t\"validationAction?\": \"\\\"error\\\" | \\\"warn\\\"\",\n\t\"changeStreamPreAndPostImages?\": { enabled: \"boolean\" }\n});\nconst ListIndexesJson = type({\n\tkind: \"\\\"listIndexes\\\"\",\n\tcollection: \"string\"\n});\nconst ListCollectionsJson = type({ kind: \"\\\"listCollections\\\"\" });\nconst FieldFilterJson = type({\n\tkind: \"\\\"field\\\"\",\n\tfield: \"string\",\n\top: \"string\",\n\tvalue: \"unknown\"\n});\nconst ExistsFilterJson = type({\n\tkind: \"\\\"exists\\\"\",\n\tfield: \"string\",\n\texists: \"boolean\"\n});\nconst RawInsertOneJson = type({\n\tkind: \"\\\"rawInsertOne\\\"\",\n\tcollection: \"string\",\n\tdocument: \"Record<string, unknown>\"\n});\nconst RawInsertManyJson = type({\n\tkind: \"\\\"rawInsertMany\\\"\",\n\tcollection: \"string\",\n\tdocuments: \"Record<string, unknown>[]\"\n});\nconst RawUpdateOneJson = type({\n\tkind: \"\\\"rawUpdateOne\\\"\",\n\tcollection: \"string\",\n\tfilter: \"Record<string, unknown>\",\n\tupdate: \"Record<string, unknown> | Record<string, unknown>[]\"\n});\nconst RawUpdateManyJson = type({\n\tkind: \"\\\"rawUpdateMany\\\"\",\n\tcollection: \"string\",\n\tfilter: \"Record<string, unknown>\",\n\tupdate: \"Record<string, unknown> | Record<string, unknown>[]\"\n});\nconst RawDeleteOneJson = type({\n\tkind: \"\\\"rawDeleteOne\\\"\",\n\tcollection: \"string\",\n\tfilter: \"Record<string, unknown>\"\n});\nconst RawDeleteManyJson = type({\n\tkind: \"\\\"rawDeleteMany\\\"\",\n\tcollection: \"string\",\n\tfilter: \"Record<string, unknown>\"\n});\nconst RawAggregateJson = type({\n\tkind: \"\\\"rawAggregate\\\"\",\n\tcollection: \"string\",\n\tpipeline: \"Record<string, unknown>[]\"\n});\nconst RawFindOneAndUpdateJson = type({\n\tkind: \"\\\"rawFindOneAndUpdate\\\"\",\n\tcollection: \"string\",\n\tfilter: \"Record<string, unknown>\",\n\tupdate: \"Record<string, unknown> | Record<string, unknown>[]\",\n\tupsert: \"boolean\"\n});\nconst RawFindOneAndDeleteJson = type({\n\tkind: \"\\\"rawFindOneAndDelete\\\"\",\n\tcollection: \"string\",\n\tfilter: \"Record<string, unknown>\"\n});\nconst TypedAggregateJson = type({\n\tkind: \"\\\"aggregate\\\"\",\n\tcollection: \"string\",\n\tpipeline: \"Record<string, unknown>[]\"\n});\nconst QueryPlanJson = type({\n\tcollection: \"string\",\n\tcommand: \"Record<string, unknown>\",\n\tmeta: type({\n\t\ttarget: \"string\",\n\t\tstorageHash: \"string\",\n\t\tlane: \"string\",\n\t\t\"targetFamily?\": \"string\",\n\t\t\"profileHash?\": \"string\",\n\t\t\"annotations?\": \"Record<string, unknown>\"\n\t})\n});\nconst CheckJson = type({\n\tdescription: \"string\",\n\tsource: \"Record<string, unknown>\",\n\tfilter: \"Record<string, unknown>\",\n\texpect: \"\\\"exists\\\" | \\\"notExists\\\"\"\n});\nconst StepJson = type({\n\tdescription: \"string\",\n\tcommand: \"Record<string, unknown>\"\n});\nconst DdlOperationJson = type({\n\tid: \"string\",\n\tlabel: \"string\",\n\toperationClass: \"\\\"additive\\\" | \\\"widening\\\" | \\\"destructive\\\"\",\n\tprecheck: \"Record<string, unknown>[]\",\n\texecute: \"Record<string, unknown>[]\",\n\tpostcheck: \"Record<string, unknown>[]\"\n});\nconst DataTransformCheckJson = type({\n\tdescription: \"string\",\n\tsource: \"Record<string, unknown>\",\n\tfilter: \"Record<string, unknown>\",\n\texpect: \"\\\"exists\\\" | \\\"notExists\\\"\"\n});\nconst DataTransformOperationJson = type({\n\tid: \"string\",\n\tlabel: \"string\",\n\toperationClass: \"\\\"data\\\"\",\n\tname: \"string\",\n\tprecheck: \"Record<string, unknown>[]\",\n\trun: \"Record<string, unknown>[]\",\n\tpostcheck: \"Record<string, unknown>[]\"\n});\nfunction validate(schema, data, context) {\n\ttry {\n\t\treturn schema.assert(stripUndefinedDeep(data));\n\t} catch (error) {\n\t\t/* v8 ignore stop */\n\t\tthrow mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", `Invalid ${context}: ${error instanceof Error ? error.message : String(error)}`, {\n\t\t\tmeta: { context },\n\t\t\tcause: error\n\t\t});\n\t}\n}\n/**\n* Strip `undefined`-valued properties before they reach arktype's optional-key\n* assertions.\n*\n* Op IRs (e.g. `CreateCollectionCommand`) assign every optional field on\n* every instance — fields the caller did not provide land as\n* `undefined`-valued properties. arktype treats `{ foo?: 'boolean' }` as\n* \"key may be absent, but if present must be boolean\", so the bare instance\n* fails validation when it crosses the deserialize boundary in-process\n* (no JSON round-trip happens between planner → runner). This helper\n* recovers the JSON-round-tripped shape (undefined keys absent) without\n* forcing every caller to round-trip.\n*\n* Returns the original value reference whenever no change is needed.\n* That preserves prototype-bound payload values such as BSON wrappers\n* (`ObjectId`, `Decimal128`, `Binary`, …) which embed no `undefined`\n* own-enumerable properties and therefore never trigger a rebuild.\n* Top-level op IRs (class instances with `undefined` optional fields)\n* still get flattened to plain records as required by arktype.\n*/\nfunction stripUndefinedDeep(value) {\n\tif (Array.isArray(value)) {\n\t\tlet changed = false;\n\t\tconst next = value.map((item) => {\n\t\t\tconst stripped = stripUndefinedDeep(item);\n\t\t\tif (stripped !== item) changed = true;\n\t\t\treturn stripped;\n\t\t});\n\t\treturn changed ? next : value;\n\t}\n\tif (value === null || typeof value !== \"object\") return value;\n\tconst entries = Object.entries(value);\n\tconst out = {};\n\tlet changed = false;\n\tfor (const [key, val] of entries) {\n\t\tif (val === void 0) {\n\t\t\tchanged = true;\n\t\t\tcontinue;\n\t\t}\n\t\tconst stripped = stripUndefinedDeep(val);\n\t\tif (stripped !== val) changed = true;\n\t\tout[key] = stripped;\n\t}\n\treturn changed ? out : value;\n}\nfunction deserializeFilterExpr(json) {\n\tconst record = json;\n\tconst kind = record[\"kind\"];\n\tswitch (kind) {\n\t\tcase \"field\": {\n\t\t\tconst data = validate(FieldFilterJson, json, \"field filter\");\n\t\t\treturn MongoFieldFilter.of(data.field, data.op, data.value);\n\t\t}\n\t\tcase \"and\": {\n\t\t\tconst exprs = record[\"exprs\"];\n\t\t\tif (!Array.isArray(exprs)) throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", \"Invalid and filter: missing exprs array\", { meta: { context: \"and filter\" } });\n\t\t\treturn MongoAndExpr.of(exprs.map(deserializeFilterExpr));\n\t\t}\n\t\tcase \"or\": {\n\t\t\tconst exprs = record[\"exprs\"];\n\t\t\tif (!Array.isArray(exprs)) throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", \"Invalid or filter: missing exprs array\", { meta: { context: \"or filter\" } });\n\t\t\treturn MongoOrExpr.of(exprs.map(deserializeFilterExpr));\n\t\t}\n\t\tcase \"not\": {\n\t\t\tconst expr = record[\"expr\"];\n\t\t\tif (!expr || typeof expr !== \"object\") throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", \"Invalid not filter: missing expr\", { meta: { context: \"not filter\" } });\n\t\t\treturn new MongoNotExpr(deserializeFilterExpr(expr));\n\t\t}\n\t\tcase \"exists\": {\n\t\t\tconst data = validate(ExistsFilterJson, json, \"exists filter\");\n\t\t\treturn new MongoExistsExpr(data.field, data.exists);\n\t\t}\n\t\tdefault: throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", `Unknown filter expression kind: ${kind}`, { meta: {\n\t\t\tcontext: \"filter expression\",\n\t\t\tkind\n\t\t} });\n\t}\n}\nfunction deserializePipelineStage(json) {\n\tconst record = json;\n\tconst kind = record[\"kind\"];\n\tswitch (kind) {\n\t\tcase \"match\": return new MongoMatchStage(deserializeFilterExpr(record[\"filter\"]));\n\t\tcase \"limit\": return new MongoLimitStage(record[\"limit\"]);\n\t\tcase \"sort\": return new MongoSortStage(record[\"sort\"]);\n\t\tcase \"project\": return new MongoProjectStage(record[\"projection\"]);\n\t\tcase \"addFields\": return new MongoAddFieldsStage(record[\"fields\"]);\n\t\tcase \"lookup\": {\n\t\t\tconst opts = {\n\t\t\t\tfrom: record[\"from\"],\n\t\t\t\tas: record[\"as\"]\n\t\t\t};\n\t\t\tif (record[\"localField\"] !== void 0) opts.localField = record[\"localField\"];\n\t\t\tif (record[\"foreignField\"] !== void 0) opts.foreignField = record[\"foreignField\"];\n\t\t\tif (record[\"pipeline\"] !== void 0) opts.pipeline = record[\"pipeline\"].map(deserializePipelineStage);\n\t\t\tif (record[\"let_\"] !== void 0) opts.let_ = record[\"let_\"];\n\t\t\treturn new MongoLookupStage(opts);\n\t\t}\n\t\tcase \"merge\": {\n\t\t\tconst opts = { into: record[\"into\"] };\n\t\t\tif (record[\"on\"] !== void 0) opts.on = record[\"on\"];\n\t\t\tif (record[\"whenMatched\"] !== void 0) {\n\t\t\t\tconst wm = record[\"whenMatched\"];\n\t\t\t\topts.whenMatched = typeof wm === \"string\" ? wm : wm.map(deserializePipelineStage);\n\t\t\t}\n\t\t\tif (record[\"whenNotMatched\"] !== void 0) opts.whenNotMatched = record[\"whenNotMatched\"];\n\t\t\treturn new MongoMergeStage(opts);\n\t\t}\n\t\tdefault: throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", `Unknown pipeline stage kind: ${kind}`, { meta: {\n\t\t\tcontext: \"pipeline stage\",\n\t\t\tkind\n\t\t} });\n\t}\n}\nfunction deserializeDmlCommand(json) {\n\tconst kind = json[\"kind\"];\n\tswitch (kind) {\n\t\tcase \"rawInsertOne\": {\n\t\t\tconst data = validate(RawInsertOneJson, json, \"rawInsertOne command\");\n\t\t\treturn new RawInsertOneCommand(data.collection, data.document);\n\t\t}\n\t\tcase \"rawInsertMany\": {\n\t\t\tconst data = validate(RawInsertManyJson, json, \"rawInsertMany command\");\n\t\t\treturn new RawInsertManyCommand(data.collection, data.documents);\n\t\t}\n\t\tcase \"rawUpdateOne\": {\n\t\t\tconst data = validate(RawUpdateOneJson, json, \"rawUpdateOne command\");\n\t\t\treturn new RawUpdateOneCommand(data.collection, data.filter, data.update);\n\t\t}\n\t\tcase \"rawUpdateMany\": {\n\t\t\tconst data = validate(RawUpdateManyJson, json, \"rawUpdateMany command\");\n\t\t\treturn new RawUpdateManyCommand(data.collection, data.filter, data.update);\n\t\t}\n\t\tcase \"rawDeleteOne\": {\n\t\t\tconst data = validate(RawDeleteOneJson, json, \"rawDeleteOne command\");\n\t\t\treturn new RawDeleteOneCommand(data.collection, data.filter);\n\t\t}\n\t\tcase \"rawDeleteMany\": {\n\t\t\tconst data = validate(RawDeleteManyJson, json, \"rawDeleteMany command\");\n\t\t\treturn new RawDeleteManyCommand(data.collection, data.filter);\n\t\t}\n\t\tcase \"rawAggregate\": {\n\t\t\tconst data = validate(RawAggregateJson, json, \"rawAggregate command\");\n\t\t\treturn new RawAggregateCommand(data.collection, data.pipeline);\n\t\t}\n\t\tcase \"rawFindOneAndUpdate\": {\n\t\t\tconst data = validate(RawFindOneAndUpdateJson, json, \"rawFindOneAndUpdate command\");\n\t\t\treturn new RawFindOneAndUpdateCommand(data.collection, data.filter, data.update, data.upsert);\n\t\t}\n\t\tcase \"rawFindOneAndDelete\": {\n\t\t\tconst data = validate(RawFindOneAndDeleteJson, json, \"rawFindOneAndDelete command\");\n\t\t\treturn new RawFindOneAndDeleteCommand(data.collection, data.filter);\n\t\t}\n\t\tcase \"aggregate\": {\n\t\t\tconst data = validate(TypedAggregateJson, json, \"aggregate command\");\n\t\t\tconst pipeline = data.pipeline.map(deserializePipelineStage);\n\t\t\treturn new AggregateCommand(data.collection, pipeline);\n\t\t}\n\t\tdefault: throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", `Unknown DML command kind: ${kind}`, { meta: {\n\t\t\tcontext: \"DML command\",\n\t\t\tkind\n\t\t} });\n\t}\n}\nfunction deserializeMongoQueryPlan(json) {\n\tconst data = validate(QueryPlanJson, json, \"Mongo query plan\");\n\tconst command = deserializeDmlCommand(data.command);\n\tconst m = data.meta;\n\tconst meta = {\n\t\ttarget: m.target,\n\t\tstorageHash: m.storageHash,\n\t\tlane: m.lane,\n\t\t...ifDefined(\"targetFamily\", m.targetFamily),\n\t\t...ifDefined(\"profileHash\", m.profileHash),\n\t\t...ifDefined(\"annotations\", m.annotations)\n\t};\n\treturn {\n\t\tcollection: data.collection,\n\t\tcommand,\n\t\tmeta\n\t};\n}\nfunction deserializeDdlCommand(json) {\n\tconst kind = json[\"kind\"];\n\tswitch (kind) {\n\t\tcase \"createIndex\": {\n\t\t\tconst data = validate(CreateIndexJson, json, \"createIndex command\");\n\t\t\treturn new CreateIndexCommand(data.collection, data.keys, {\n\t\t\t\t...ifDefined(\"unique\", data.unique),\n\t\t\t\t...ifDefined(\"sparse\", data.sparse),\n\t\t\t\t...ifDefined(\"expireAfterSeconds\", data.expireAfterSeconds),\n\t\t\t\t...ifDefined(\"partialFilterExpression\", data.partialFilterExpression),\n\t\t\t\t...ifDefined(\"name\", data.name),\n\t\t\t\t...ifDefined(\"wildcardProjection\", data.wildcardProjection),\n\t\t\t\t...ifDefined(\"collation\", data.collation),\n\t\t\t\t...ifDefined(\"weights\", data.weights),\n\t\t\t\t...ifDefined(\"default_language\", data.default_language),\n\t\t\t\t...ifDefined(\"language_override\", data.language_override)\n\t\t\t});\n\t\t}\n\t\tcase \"dropIndex\": {\n\t\t\tconst data = validate(DropIndexJson, json, \"dropIndex command\");\n\t\t\treturn new DropIndexCommand(data.collection, data.name);\n\t\t}\n\t\tcase \"createCollection\": {\n\t\t\tconst data = validate(CreateCollectionJson, json, \"createCollection command\");\n\t\t\treturn new CreateCollectionCommand(data.collection, {\n\t\t\t\t...ifDefined(\"validator\", data.validator),\n\t\t\t\t...ifDefined(\"validationLevel\", data.validationLevel),\n\t\t\t\t...ifDefined(\"validationAction\", data.validationAction),\n\t\t\t\t...ifDefined(\"capped\", data.capped),\n\t\t\t\t...ifDefined(\"size\", data.size),\n\t\t\t\t...ifDefined(\"max\", data.max),\n\t\t\t\t...ifDefined(\"timeseries\", data.timeseries),\n\t\t\t\t...ifDefined(\"collation\", data.collation),\n\t\t\t\t...ifDefined(\"changeStreamPreAndPostImages\", data.changeStreamPreAndPostImages),\n\t\t\t\t...ifDefined(\"clusteredIndex\", data.clusteredIndex)\n\t\t\t});\n\t\t}\n\t\tcase \"dropCollection\": return new DropCollectionCommand(validate(DropCollectionJson, json, \"dropCollection command\").collection);\n\t\tcase \"collMod\": {\n\t\t\tconst data = validate(CollModJson, json, \"collMod command\");\n\t\t\treturn new CollModCommand(data.collection, {\n\t\t\t\t...ifDefined(\"validator\", data.validator),\n\t\t\t\t...ifDefined(\"validationLevel\", data.validationLevel),\n\t\t\t\t...ifDefined(\"validationAction\", data.validationAction),\n\t\t\t\t...ifDefined(\"changeStreamPreAndPostImages\", data.changeStreamPreAndPostImages)\n\t\t\t});\n\t\t}\n\t\tdefault: throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", `Unknown DDL command kind: ${kind}`, { meta: {\n\t\t\tcontext: \"DDL command\",\n\t\t\tkind\n\t\t} });\n\t}\n}\nfunction deserializeInspectionCommand(json) {\n\tconst kind = json[\"kind\"];\n\tswitch (kind) {\n\t\tcase \"listIndexes\": return new ListIndexesCommand(validate(ListIndexesJson, json, \"listIndexes command\").collection);\n\t\tcase \"listCollections\":\n\t\t\tvalidate(ListCollectionsJson, json, \"listCollections command\");\n\t\t\treturn new ListCollectionsCommand();\n\t\tdefault: throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", `Unknown inspection command kind: ${kind}`, { meta: {\n\t\t\tcontext: \"inspection command\",\n\t\t\tkind\n\t\t} });\n\t}\n}\nfunction deserializeCheck(json) {\n\tconst data = validate(CheckJson, json, \"migration check\");\n\treturn {\n\t\tdescription: data.description,\n\t\tsource: deserializeInspectionCommand(data.source),\n\t\tfilter: deserializeFilterExpr(data.filter),\n\t\texpect: data.expect\n\t};\n}\nfunction deserializeStep(json) {\n\tconst data = validate(StepJson, json, \"migration step\");\n\treturn {\n\t\tdescription: data.description,\n\t\tcommand: deserializeDdlCommand(data.command)\n\t};\n}\nfunction isDataTransformJson(json) {\n\treturn typeof json === \"object\" && json !== null && json[\"operationClass\"] === \"data\";\n}\nfunction deserializeDdlOp(json) {\n\tconst data = validate(DdlOperationJson, json, \"migration operation\");\n\treturn {\n\t\tid: data.id,\n\t\tlabel: data.label,\n\t\toperationClass: data.operationClass,\n\t\tprecheck: data.precheck.map(deserializeCheck),\n\t\texecute: data.execute.map(deserializeStep),\n\t\tpostcheck: data.postcheck.map(deserializeCheck)\n\t};\n}\nfunction deserializeDataTransformCheck(json) {\n\tconst data = validate(DataTransformCheckJson, json, \"data transform check\");\n\treturn {\n\t\tdescription: data.description,\n\t\tsource: deserializeMongoQueryPlan(data.source),\n\t\tfilter: deserializeFilterExpr(data.filter),\n\t\texpect: data.expect\n\t};\n}\nfunction deserializeDataTransformOp(json) {\n\tconst data = validate(DataTransformOperationJson, json, \"data transform operation\");\n\treturn {\n\t\tid: data.id,\n\t\tlabel: data.label,\n\t\toperationClass: \"data\",\n\t\tname: data.name,\n\t\tprecheck: data.precheck.map(deserializeDataTransformCheck),\n\t\trun: data.run.map(deserializeMongoQueryPlan),\n\t\tpostcheck: data.postcheck.map(deserializeDataTransformCheck)\n\t};\n}\nfunction deserializeMongoOp(json) {\n\tif (isDataTransformJson(json)) return deserializeDataTransformOp(json);\n\treturn deserializeDdlOp(json);\n}\nfunction deserializeMongoOps(json) {\n\treturn json.map(deserializeMongoOp);\n}\nfunction serializeMongoOps(ops) {\n\treturn JSON.stringify(ops, null, 2);\n}\n//#endregion\n//#region src/core/mongo-runner.ts\nconst READ_ONLY_CHECK_COMMAND_KINDS = /* @__PURE__ */ new Set([\"aggregate\", \"rawAggregate\"]);\nfunction runnerFailure(code, summary, opts) {\n\treturn notOk({\n\t\tcode,\n\t\tsummary,\n\t\t...opts\n\t});\n}\nvar MongoMigrationRunner = class {\n\tdeps;\n\tconstructor(deps) {\n\t\tthis.deps = deps;\n\t}\n\tasync execute(options) {\n\t\tconst { inspectionExecutor, adapter, driver, executeDdl, markerOps } = this.deps;\n\t\tconst operations = deserializeMongoOps(options.plan.operations);\n\t\tconst space = options.plan.spaceId ?? APP_SPACE_ID;\n\t\tconst policyCheck = this.enforcePolicyCompatibility(options.policy, operations);\n\t\tif (policyCheck) return policyCheck;\n\t\tconst existingMarker = await markerOps.readMarker(space);\n\t\tconst markerCheck = this.ensureMarkerCompatibility(existingMarker, options.plan);\n\t\tif (markerCheck) return markerCheck;\n\t\tconst checks = options.executionChecks;\n\t\tconst runPrechecks = checks?.prechecks !== false;\n\t\tconst runPostchecks = checks?.postchecks !== false;\n\t\tconst runIdempotency = checks?.idempotencyChecks !== false;\n\t\tconst filterEvaluator = new FilterEvaluator();\n\t\tlet operationsExecuted = 0;\n\t\tfor (const operation of operations) {\n\t\t\toptions.callbacks?.onOperationStart?.(operation);\n\t\t\ttry {\n\t\t\t\tif (operation.operationClass === \"data\") {\n\t\t\t\t\tconst result = await this.executeDataTransform(operation, adapter, driver, filterEvaluator, runIdempotency, runPrechecks, runPostchecks);\n\t\t\t\t\tif (result.failure) return result.failure;\n\t\t\t\t\tif (result.executed) operationsExecuted += 1;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst ddlOp = operation;\n\t\t\t\tif (runPostchecks && runIdempotency) {\n\t\t\t\t\tif (await this.allChecksSatisfied(ddlOp.postcheck, inspectionExecutor, filterEvaluator)) continue;\n\t\t\t\t}\n\t\t\t\tif (runPrechecks) {\n\t\t\t\t\tif (!await this.evaluateChecks(ddlOp.precheck, inspectionExecutor, filterEvaluator)) return runnerFailure(\"MIGRATION.PRECHECK_FAILED\", `Operation ${operation.id} failed during precheck`, { meta: { operationId: operation.id } });\n\t\t\t\t}\n\t\t\t\tfor (const step of ddlOp.execute) await executeDdl(step.command);\n\t\t\t\tif (runPostchecks) {\n\t\t\t\t\tif (!await this.evaluateChecks(ddlOp.postcheck, inspectionExecutor, filterEvaluator)) return runnerFailure(\"MIGRATION.POSTCHECK_FAILED\", `Operation ${operation.id} failed during postcheck`, { meta: { operationId: operation.id } });\n\t\t\t\t}\n\t\t\t\toperationsExecuted += 1;\n\t\t\t} finally {\n\t\t\t\toptions.callbacks?.onOperationComplete?.(operation);\n\t\t\t}\n\t\t}\n\t\tconst destination = options.plan.destination;\n\t\tconst profileHash = options.destinationContract.profileHash ?? destination.storageHash;\n\t\tconst incomingInvariants = options.plan.providedInvariants ?? [];\n\t\tconst existingInvariantSet = new Set(existingMarker?.invariants ?? []);\n\t\tconst incomingIsSubsetOfExisting = incomingInvariants.every((id) => existingInvariantSet.has(id));\n\t\tconst markerAlreadyAtDestination = existingMarker !== null && existingMarker.storageHash === destination.storageHash && existingMarker.profileHash === profileHash;\n\t\tif (!(operationsExecuted === 0 && markerAlreadyAtDestination && incomingIsSubsetOfExisting)) {\n\t\t\tconst liveSchema = await this.deps.introspectSchema();\n\t\t\tconst rawVerifyResult = verifyMongoSchema({\n\t\t\t\tcontract: options.destinationContract,\n\t\t\t\tschema: liveSchema,\n\t\t\t\tstrict: options.strictVerification ?? true,\n\t\t\t\tframeworkComponents: options.frameworkComponents,\n\t\t\t\t...options.context ? { context: options.context } : {}\n\t\t\t});\n\t\t\tconst verifyResult = options.scopeVerifyResult ? options.scopeVerifyResult(rawVerifyResult) : rawVerifyResult;\n\t\t\tif (!verifyResult.ok) return runnerFailure(\"MIGRATION.SCHEMA_VERIFY_FAILED\", verifyResult.summary, {\n\t\t\t\twhy: \"The resulting database schema does not satisfy the destination contract.\",\n\t\t\t\tmeta: { issues: verifyResult.schema.issues }\n\t\t\t});\n\t\t\tif (existingMarker) {\n\t\t\t\tif (!await markerOps.updateMarker(space, existingMarker.storageHash, {\n\t\t\t\t\tstorageHash: destination.storageHash,\n\t\t\t\t\tprofileHash,\n\t\t\t\t\tinvariants: incomingInvariants\n\t\t\t\t})) return runnerFailure(\"MIGRATION.MARKER_CAS_FAILURE\", \"Marker was modified by another process during migration execution.\", { meta: {\n\t\t\t\t\tspace,\n\t\t\t\t\texpectedStorageHash: existingMarker.storageHash,\n\t\t\t\t\tdestinationStorageHash: destination.storageHash\n\t\t\t\t} });\n\t\t\t} else await markerOps.initMarker(space, {\n\t\t\t\tstorageHash: destination.storageHash,\n\t\t\t\tprofileHash,\n\t\t\t\tinvariants: incomingInvariants\n\t\t\t});\n\t\t\tawait this.recordLedgerEntries(markerOps, space, options);\n\t\t}\n\t\treturn ok({\n\t\t\toperationsPlanned: operations.length,\n\t\t\toperationsExecuted\n\t\t});\n\t}\n\tasync recordLedgerEntries(markerOps, space, options) {\n\t\tconst plan = options.plan;\n\t\tconst edges = options.migrationEdges;\n\t\tconst totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);\n\t\tif (totalEdgeOps !== plan.operations.length) throw new InternalError(`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`);\n\t\tlet offset = 0;\n\t\tfor (const edge of edges) {\n\t\t\tconst edgeOps = plan.operations.slice(offset, offset + edge.operationCount);\n\t\t\toffset += edge.operationCount;\n\t\t\tawait markerOps.writeLedgerEntry(space, {\n\t\t\t\tedgeId: `${edge.from}->${edge.to}`,\n\t\t\t\tfrom: edge.from,\n\t\t\t\tto: edge.to,\n\t\t\t\tmigrationName: edge.dirName,\n\t\t\t\tmigrationHash: edge.migrationHash,\n\t\t\t\toperations: edgeOps\n\t\t\t});\n\t\t}\n\t}\n\tasync executeDataTransform(op, adapter, driver, filterEvaluator, runIdempotency, runPrechecks, runPostchecks) {\n\t\tif (runPostchecks && runIdempotency && op.postcheck.length > 0) {\n\t\t\tif (await this.evaluateDataTransformChecks(op.postcheck, adapter, driver, filterEvaluator)) return { executed: false };\n\t\t}\n\t\tif (runPrechecks && op.precheck.length > 0) {\n\t\t\tif (!await this.evaluateDataTransformChecks(op.precheck, adapter, driver, filterEvaluator)) return {\n\t\t\t\texecuted: false,\n\t\t\t\tfailure: runnerFailure(\"MIGRATION.PRECHECK_FAILED\", `Operation ${op.id} failed during precheck`, { meta: {\n\t\t\t\t\toperationId: op.id,\n\t\t\t\t\tname: op.name\n\t\t\t\t} })\n\t\t\t};\n\t\t}\n\t\tfor (const plan of op.run) {\n\t\t\tconst wireCommand = await adapter.lower(plan, {});\n\t\t\tfor await (const _ of driver.execute(wireCommand));\n\t\t}\n\t\tif (runPostchecks && op.postcheck.length > 0) {\n\t\t\tif (!await this.evaluateDataTransformChecks(op.postcheck, adapter, driver, filterEvaluator)) return {\n\t\t\t\texecuted: false,\n\t\t\t\tfailure: runnerFailure(\"MIGRATION.POSTCHECK_FAILED\", `Operation ${op.id} failed during postcheck`, { meta: {\n\t\t\t\t\toperationId: op.id,\n\t\t\t\t\tname: op.name\n\t\t\t\t} })\n\t\t\t};\n\t\t}\n\t\treturn { executed: true };\n\t}\n\tasync evaluateDataTransformChecks(checks, adapter, driver, filterEvaluator) {\n\t\tfor (const check of checks) {\n\t\t\tconst commandKind = check.source.command.kind;\n\t\t\tif (!READ_ONLY_CHECK_COMMAND_KINDS.has(commandKind)) throw errorRunnerFailed(`Data-transform check rejected: command kind \"${commandKind}\" is not read-only`, {\n\t\t\t\twhy: \"Data-transform checks must use aggregate or rawAggregate commands so the pre/postcheck path cannot mutate the database.\",\n\t\t\t\tfix: \"Author the check.source as an aggregate pipeline (or rawAggregate) rather than a DML write command.\",\n\t\t\t\tmeta: {\n\t\t\t\t\tcheckDescription: check.description,\n\t\t\t\t\tcommandKind,\n\t\t\t\t\tcollection: check.source.collection\n\t\t\t\t}\n\t\t\t});\n\t\t\tconst wireCommand = await adapter.lower(check.source, {});\n\t\t\tlet matchFound = false;\n\t\t\tfor await (const row of driver.execute(wireCommand)) if (filterEvaluator.evaluate(check.filter, row)) {\n\t\t\t\tmatchFound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!(check.expect === \"exists\" ? matchFound : !matchFound)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tasync evaluateChecks(checks, inspectionExecutor, filterEvaluator) {\n\t\tfor (const check of checks) {\n\t\t\tconst matchFound = (await check.source.accept(inspectionExecutor)).some((doc) => filterEvaluator.evaluate(check.filter, doc));\n\t\t\tif (!(check.expect === \"exists\" ? matchFound : !matchFound)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tasync allChecksSatisfied(checks, inspectionExecutor, filterEvaluator) {\n\t\tif (checks.length === 0) return false;\n\t\treturn this.evaluateChecks(checks, inspectionExecutor, filterEvaluator);\n\t}\n\tenforcePolicyCompatibility(policy, operations) {\n\t\tconst allowedClasses = new Set(policy.allowedOperationClasses);\n\t\tfor (const operation of operations) if (!allowedClasses.has(operation.operationClass)) return runnerFailure(\"MIGRATION.POLICY_VIOLATION\", `Operation ${operation.id} has class \"${operation.operationClass}\" which is not allowed by policy.`, {\n\t\t\twhy: `Policy only allows: ${[...allowedClasses].join(\", \")}.`,\n\t\t\tmeta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\toperationClass: operation.operationClass\n\t\t\t}\n\t\t});\n\t}\n\tensureMarkerCompatibility(marker, plan) {\n\t\tconst origin = plan.origin ?? null;\n\t\tif (!origin) return;\n\t\tif (!marker) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });\n\t\tif (marker.storageHash !== origin.storageHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {\n\t\t\tmarkerStorageHash: marker.storageHash,\n\t\t\texpectedOriginStorageHash: origin.storageHash\n\t\t} });\n\t}\n};\n//#endregion\n//#region src/core/mongo-target-database.ts\n/**\n* Mongo target `Namespace` concretion. In Mongo the \"namespace\" concept\n* binds to the connection's `db` field — a `MongoTargetDatabase` instance\n* names the database the collections live under. `entries['collection']`\n* holds collection IR. The unbound singleton (below) is the late-bound\n* namespace whose binding the connection's `db` resolves at runtime rather\n* than at authoring time.\n*\n* Qualifier emission is the rendering seam: query / DDL emission asks the\n* namespace for its qualifier (e.g. `\"<db>.<collection>\"`) and consumes\n* the result polymorphically. The unbound singleton overrides these\n* methods to elide the prefix entirely — call sites stay polymorphic and\n* never branch on `id === UNBOUND_NAMESPACE_ID`.\n*/\nvar MongoTargetDatabase = class extends NamespaceBase {\n\tid;\n\tentries;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.id = input.id;\n\t\tconst rawEntries = {\n\t\t\tcollection: {},\n\t\t\t...input.entries\n\t\t};\n\t\tthis.entries = Object.freeze(blindCast(hydrateNamespaceEntities(rawEntries, composeMongoEntityKinds(), \"carry\")));\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: \"database\",\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true\n\t\t});\n\t\tfreezeNode(this);\n\t}\n\tget collection() {\n\t\treturn this.entries.collection ?? Object.freeze({});\n\t}\n\t/**\n\t* The bare qualifier as it would appear in a rendered string. The\n\t* unbound-database singleton overrides this to return `''`.\n\t*/\n\tqualifier() {\n\t\treturn this.id;\n\t}\n\t/**\n\t* Qualify a collection name with the database prefix. The\n\t* unbound-database singleton overrides this to emit just the\n\t* collection name. Used by emission/introspection paths that need a\n\t* fully-qualified reference.\n\t*/\n\tqualifyCollection(collectionName) {\n\t\treturn `${this.id}.${collectionName}`;\n\t}\n};\n/**\n* Singleton subclass for the reserved sentinel namespace id\n* (`UNBOUND_NAMESPACE_ID`) — the late-bound namespace whose binding the\n* connection's `db` resolves at runtime. Overrides qualifier emission\n* to elide the database prefix; call sites that consume `qualifier()`\n* / `qualifyCollection()` get unqualified output without branching on\n* the namespace id.\n*\n* This is the target-side materialization of \"the framework provides\n* affordances; targets implement specifics\": the framework names the\n* sentinel; Mongo decides what late-bound means here (the collection\n* name, naked — the database is supplied by the live connection).\n*/\nvar MongoTargetUnboundDatabase = class MongoTargetUnboundDatabase extends MongoTargetDatabase {\n\tstatic instance = new MongoTargetUnboundDatabase();\n\tconstructor() {\n\t\tsuper({ id: UNBOUND_NAMESPACE_ID });\n\t}\n\tqualifier() {\n\t\treturn \"\";\n\t}\n\tqualifyCollection(collectionName) {\n\t\treturn collectionName;\n\t}\n};\n//#endregion\n//#region src/core/mongo-target-contract-serializer.ts\nvar MongoTargetContractSerializer = class extends MongoContractSerializerBase {\n\tconstructTargetContract(validated) {\n\t\tconst { storage, ...rest } = validated;\n\t\tconst namespaces = Object.fromEntries(Object.entries(storage.namespaces).map(([nsId, nsData]) => {\n\t\t\tconst collectionCount = Object.keys(nsData.entries.collection ?? {}).length;\n\t\t\tconst valueSetCount = Object.keys(nsData.entries[\"valueSet\"] ?? {}).length;\n\t\t\tif (nsId === UNBOUND_NAMESPACE_ID && collectionCount === 0 && valueSetCount === 0) return [nsId, MongoTargetUnboundDatabase.instance];\n\t\t\tconst dbInput = { id: nsData.id };\n\t\t\tif (nsData.entries[\"collection\"] !== void 0 || nsData.entries[\"valueSet\"] !== void 0) dbInput.entries = {\n\t\t\t\tcollection: blindCast(nsData.entries[\"collection\"] ?? {}),\n\t\t\t\t...ifDefined(\"valueSet\", blindCast(nsData.entries[\"valueSet\"]))\n\t\t\t};\n\t\t\treturn [nsId, new MongoTargetDatabase(dbInput)];\n\t\t}));\n\t\tconst targetStorage = new MongoStorage({\n\t\t\tstorageHash: storage.storageHash,\n\t\t\tnamespaces\n\t\t});\n\t\treturn {\n\t\t\t...rest,\n\t\t\tstorage: targetStorage\n\t\t};\n\t}\n\tserializeContract(contract) {\n\t\tconst { storage, ...rest } = contract;\n\t\tconst namespacesJson = {};\n\t\tfor (const [nsId, ns] of Object.entries(storage.namespaces)) {\n\t\t\tconst collectionsOut = {};\n\t\t\tfor (const [collName, coll] of Object.entries(ns.entries.collection ?? {})) collectionsOut[collName] = JSON.parse(JSON.stringify(coll));\n\t\t\tconst valueSetOut = {};\n\t\t\tfor (const [vsName, vs] of Object.entries(ns.entries.valueSet ?? {})) valueSetOut[vsName] = blindCast(JSON.parse(JSON.stringify(vs)));\n\t\t\tnamespacesJson[nsId] = {\n\t\t\t\tid: ns.id,\n\t\t\t\tkind: \"mongo-database\",\n\t\t\t\tentries: {\n\t\t\t\t\tcollection: collectionsOut,\n\t\t\t\t\t...ifDefined(\"valueSet\", Object.keys(valueSetOut).length > 0 ? valueSetOut : void 0)\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\treturn blindCast({\n\t\t\t...rest,\n\t\t\tstorage: {\n\t\t\t\tstorageHash: String(storage.storageHash),\n\t\t\t\tnamespaces: namespacesJson\n\t\t\t}\n\t\t});\n\t}\n};\n//#endregion\n//#region src/core/mongo-target-schema-verifier.ts\n/**\n* Mongo target `SchemaVerifier` concretion. Extends the family base's\n* namespace-walk scaffolding and contributes the per-namespace diff via\n* `verifyNamespace`; the diff body reuses the existing target-side\n* helpers (`contractToMongoSchemaIR`, `canonicalizeSchemasForVerification`,\n* `diffMongoSchemas`) so production verification behaviour is unchanged.\n*\n* Today's invariant: every Mongo contract carries exactly one\n* namespace (the unbound singleton, materialised as\n* `MongoTargetUnboundDatabase`), so the family-base namespace walk\n* dispatches exactly once and the per-namespace body runs the existing\n* whole-schema diff. Future per-collection namespace assignment will\n* have this hook project the diff to the namespace's owned collections.\n*\n* `verifyTargetExtensions` returns the empty list — Mongo has no\n* target-only kinds today.\n*\n* Strict diff mode is `false` for SPI-routed calls; production\n* verification today still goes through `verifyMongoSchema` which\n* receives strict from the CLI.\n*/\nvar MongoTargetSchemaVerifier = class extends MongoSchemaVerifierBase {\n\tverifyNamespace(options) {\n\t\tconst expectedIR = contractToMongoSchemaIR(options.contract);\n\t\tconst { live, expected } = canonicalizeSchemasForVerification(options.schema, expectedIR);\n\t\tconst collectionControlPolicy = (name) => this.collectionControlPolicyForName(options.contract, name);\n\t\tconst { failures, warnings } = diffMongoSchemas(live, expected, false, collectionControlPolicy);\n\t\treturn [...failures, ...warnings];\n\t}\n\tverifyTargetExtensions(_options) {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/core/scope-verify-result.ts\n/**\n* The bare entity names the given contracts declare, unioned. The Mongo runner\n* asks this of every OTHER contract space in a multi-space apply, so each\n* space's post-apply verify can drop the extras those siblings claim.\n*/\nfunction entityNamesDeclaredBy(contracts) {\n\tconst owned = /* @__PURE__ */ new Set();\n\tfor (const contract of contracts) for (const { entityName } of elementCoordinates(contract.storage)) owned.add(entityName);\n\treturn owned;\n}\n/**\n* True when an issue reports a whole collection present in the database but\n* declared by no contract (an extra) — its path is exactly the collection\n* name, never a deeper index/validator/options auxiliary.\n*/\nfunction extraCollectionName(issue) {\n\tif (issueOutcome(issue) !== \"not-expected\" || issue.path.length !== 1) return void 0;\n\treturn issue.path[0];\n}\n/**\n* Scope a per-space post-apply verify result to the contract space's own\n* elements: drop the `extra` findings for collections another contract space\n* claims. The runner verifies the destination contract against the full live\n* database, which holds sibling spaces' collections — without the scoping a\n* multi-space apply could never pass strict verify. Extras claimed by NO space\n* survive, so genuine drift still fails the runner's verdict.\n*\n* The result is issue-based, so the verdict recomputes directly from the\n* surviving list: `ok` holds exactly when it is empty.\n*/\nfunction scopeVerifyResultToSpace(result, ownedByOtherSpaces) {\n\tif (ownedByOtherSpaces.size === 0) return result;\n\tconst issues = result.schema.issues.filter((issue) => {\n\t\tconst name = extraCollectionName(issue);\n\t\treturn name === void 0 || !ownedByOtherSpaces.has(name);\n\t});\n\tif (issues.length === result.schema.issues.length) return result;\n\tconst ok = issues.length === 0;\n\tconst { code: staleCode, ...envelope } = result;\n\treturn {\n\t\t...envelope,\n\t\tok,\n\t\t...ok ? {} : { code: result.code ?? \"CONTRACT.MARKER_REQUIRED\" },\n\t\tsummary: ok ? \"Database schema satisfies contract\" : result.summary,\n\t\tschema: {\n\t\t\t...result.schema,\n\t\t\tissues\n\t\t}\n\t};\n}\n//#endregion\n//#region src/core/control-target.ts\n/**\n* `migration.ts` default-exports a `Migration` subclass whose `operations`\n* getter returns the ordered list of operations and whose `describe()`\n* returns the manifest identity metadata. `MongoMigrationPlanner.plan()`\n* returns a `MigrationPlanWithAuthoringSurface` that knows how to render\n* itself back to such a file; `MongoMigrationPlanner.emptyMigration()`\n* returns the same shape for `migration new`. Users run the scaffolded\n* `migration.ts` directly (via `node migration.ts`) to self-emit\n* `ops.json` and attest the `migrationHash`.\n*/\nconst mongoTargetDescriptor = {\n\t...mongoTargetDescriptorMeta,\n\tcontractSerializer: new MongoTargetContractSerializer(),\n\tschemaVerifier: new MongoTargetSchemaVerifier(),\n\tmigrations: {\n\t\tcreatePlanner(_adapter) {\n\t\t\treturn new MongoMigrationPlanner();\n\t\t},\n\t\tcreateRunner(family) {\n\t\t\tlet cachedDeps;\n\t\t\tconst runMongo = async (driver, runnerOptions) => {\n\t\t\t\tcachedDeps ??= createMongoRunnerDeps(driver, MongoDriverImpl.fromDb(extractDb(driver)), family);\n\t\t\t\treturn new MongoMigrationRunner(cachedDeps).execute({\n\t\t\t\t\t...runnerOptions,\n\t\t\t\t\tdestinationContract: blindCast(runnerOptions.destinationContract)\n\t\t\t\t});\n\t\t\t};\n\t\t\treturn { async execute({ driver, perSpaceOptions }) {\n\t\t\t\tconst contracts = perSpaceOptions.map((opts) => blindCast(opts.destinationContract));\n\t\t\t\tconst perSpaceResults = [];\n\t\t\t\tfor (let i = 0; i < perSpaceOptions.length; i++) {\n\t\t\t\t\tconst spaceOptions = perSpaceOptions[i];\n\t\t\t\t\tif (!spaceOptions) continue;\n\t\t\t\t\tconst ownedByOtherSpaces = entityNamesDeclaredBy(contracts.filter((_, j) => j !== i));\n\t\t\t\t\tconst scopeVerifyResult = (result) => scopeVerifyResultToSpace(result, ownedByOtherSpaces);\n\t\t\t\t\tconst { space, ...runnerOptions } = spaceOptions;\n\t\t\t\t\tconst result = await runMongo(driver, {\n\t\t\t\t\t\t...runnerOptions,\n\t\t\t\t\t\tscopeVerifyResult\n\t\t\t\t\t});\n\t\t\t\t\tif (!result.ok) return notOk({\n\t\t\t\t\t\t...result.failure,\n\t\t\t\t\t\tfailingSpace: space\n\t\t\t\t\t});\n\t\t\t\t\tperSpaceResults.push({\n\t\t\t\t\t\tspace,\n\t\t\t\t\t\tvalue: result.value\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn ok({ perSpaceResults });\n\t\t\t} };\n\t\t},\n\t\tcontractToSchema(contract) {\n\t\t\treturn contractToMongoSchemaIR(blindCast(contract));\n\t\t}\n\t},\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"mongo\",\n\t\t\ttargetId: \"mongo\"\n\t\t};\n\t}\n};\n//#endregion\nexport { CollModCall, CreateCollectionCall, CreateIndexCall, DropCollectionCall, DropIndexCall, FilterEvaluator, MongoMigrationPlanner, MongoMigrationRunner, MongoTargetContractSerializer, MongoTargetDatabase, MongoTargetSchemaVerifier, MongoTargetUnboundDatabase, PlannerProducedMongoMigration, deserializeMongoOp, deserializeMongoOps, mongoTargetDescriptor, renderCallsToTypeScript, renderOps, schemaCollectionToCreateCollectionOptions, schemaIndexToCreateIndexOptions, serializeMongoOps };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,0BAA0B;AAChC,IAAI,oBAAoB,cAAc,aAAa;CAClD,qBAAqB;EACpB,OAAO,CAAC;GACP,iBAAiB;GACjB,QAAQ,KAAK;EACd,CAAC;CACF;CACA,SAAS;EACR,OAAO,OAAO,IAAI;CACnB;AACD;AACA,SAAS,WAAW,MAAM;CACzB,OAAO,KAAK,KAAK,MAAM,GAAG,EAAE,MAAM,GAAG,EAAE,WAAW,CAAC,CAAC,KAAK,IAAI;AAC9D;AACA,IAAI,kBAAkB,cAAc,kBAAkB;CACrD,cAAc;CACd,iBAAiB;CACjB;CACA;CACA;CACA;CACA,YAAY,YAAY,MAAM,SAAS;EACtC,MAAM;EACN,KAAK,aAAa;EAClB,KAAK,OAAO;EACZ,KAAK,UAAU;EACf,KAAK,QAAQ,mBAAmB,WAAW,IAAI,WAAW,IAAI,EAAE;EAChE,KAAK,OAAO;CACb;CACA,OAAO;EACN,OAAO,YAAY,KAAK,YAAY,KAAK,MAAM,KAAK,OAAO;CAC5D;CACA,mBAAmB;EAClB,OAAO,KAAK,UAAU,eAAe,eAAe,KAAK,UAAU,EAAE,IAAI,eAAe,KAAK,IAAI,EAAE,IAAI,eAAe,KAAK,OAAO,EAAE,KAAK,eAAe,eAAe,KAAK,UAAU,EAAE,IAAI,eAAe,KAAK,IAAI,EAAE;CACvN;AACD;AACA,IAAI,gBAAgB,cAAc,kBAAkB;CACnD,c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AO;GACN,UAAU;GACV,UAAU;EACX;CACD;AACD"}
1
+ {"version":3,"file":"control-TQcTpB3d.mjs","names":[],"sources":["../../../../3-mongo-target/1-mongo-target/dist/control.mjs"],"sourcesContent":["import { t as mongoTargetDescriptorMeta } from \"./descriptor-meta-CBiaTwe5.mjs\";\nimport { a as dropCollection, n as createCollection, o as dropIndex, r as createIndex, t as collMod } from \"./migration-factories-CCJFG_3e.mjs\";\nimport { NamespaceBase, UNBOUND_NAMESPACE_ID, elementCoordinates, freezeNode, hydrateNamespaceEntities } from \"@internal/framework-components/ir\";\nimport { createMongoRunnerDeps, extractDb } from \"@internal/adapter-mongo/control\";\nimport { MongoDriverImpl } from \"@internal/driver-mongo\";\nimport { canonicalizeSchemasForVerification, contractToMongoSchemaIR, diffMongoSchemas } from \"@internal/family-mongo/control\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { canonicalize, deepEqual } from \"@internal/mongo-schema-ir\";\nimport { TsExpression, jsonToTsSource, renderImports } from \"@internal/ts-render\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { CollModCommand, CreateCollectionCommand, CreateIndexCommand, DropCollectionCommand, DropIndexCommand, ListCollectionsCommand, ListIndexesCommand, MongoAndExpr, MongoExistsExpr, MongoFieldFilter, MongoNotExpr, MongoOrExpr } from \"@internal/mongo-query-ast/control\";\nimport { Migration } from \"@internal/migration-tools/migration\";\nimport { APP_SPACE_ID, contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier, issueOutcome } from \"@internal/framework-components/control\";\nimport { resolveRequirementSpecifiers } from \"@internal/framework-components/emission\";\nimport { detectScaffoldRuntime, shebangLineFor } from \"@internal/migration-tools/migration-ts\";\nimport { errorRunnerFailed } from \"@internal/errors/execution\";\nimport { verifyMongoSchema } from \"@internal/family-mongo/schema-verify\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { AggregateCommand, MongoAddFieldsStage, MongoLimitStage, MongoLookupStage, MongoMatchStage, MongoMergeStage, MongoProjectStage, MongoSortStage, RawAggregateCommand, RawDeleteManyCommand, RawDeleteOneCommand, RawFindOneAndDeleteCommand, RawFindOneAndUpdateCommand, RawInsertManyCommand, RawInsertOneCommand, RawUpdateManyCommand, RawUpdateOneCommand } from \"@internal/mongo-query-ast/execution\";\nimport { type } from \"arktype\";\nimport { MongoContractSerializerBase, MongoSchemaVerifierBase } from \"@internal/family-mongo/ir\";\nimport { MongoStorage } from \"@internal/mongo-contract\";\nimport { composeMongoEntityKinds } from \"@internal/mongo-contract/entity-kinds\";\n//#region src/core/op-factory-call.ts\n/**\n* The single module a scaffolded Mongo `migration.ts` imports from: the\n* operation factories below, plus the `Migration` base and `MigrationCLI`\n* that `render-typescript.ts` adds. The authored name; `render-typescript.ts`\n* maps it to whatever the consuming application's import root calls it,\n* once over the whole assembled import list.\n*/\nconst TARGET_MIGRATION_MODULE = \"@internal/target-mongo/migration\";\nvar OpFactoryCallNode = class extends TsExpression {\n\timportRequirements() {\n\t\treturn [{\n\t\t\tmoduleSpecifier: TARGET_MIGRATION_MODULE,\n\t\t\tsymbol: this.factoryName\n\t\t}];\n\t}\n\tfreeze() {\n\t\tObject.freeze(this);\n\t}\n};\nfunction formatKeys(keys) {\n\treturn keys.map((k) => `${k.field}:${k.direction}`).join(\", \");\n}\nvar CreateIndexCall = class extends OpFactoryCallNode {\n\tfactoryName = \"createIndex\";\n\toperationClass = \"additive\";\n\tcollection;\n\tkeys;\n\toptions;\n\tlabel;\n\tconstructor(collection, keys, options) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.keys = keys;\n\t\tthis.options = options;\n\t\tthis.label = `Create index on ${collection} (${formatKeys(keys)})`;\n\t\tthis.freeze();\n\t}\n\ttoOp() {\n\t\treturn createIndex(this.collection, this.keys, this.options);\n\t}\n\trenderTypeScript() {\n\t\treturn this.options ? `createIndex(${jsonToTsSource(this.collection)}, ${jsonToTsSource(this.keys)}, ${jsonToTsSource(this.options)})` : `createIndex(${jsonToTsSource(this.collection)}, ${jsonToTsSource(this.keys)})`;\n\t}\n};\nvar DropIndexCall = class extends OpFactoryCallNode {\n\tfactoryName = \"dropIndex\";\n\toperationClass = \"destructive\";\n\tcollection;\n\tkeys;\n\tlabel;\n\tconstructor(collection, keys) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.keys = keys;\n\t\tthis.label = `Drop index on ${collection} (${formatKeys(keys)})`;\n\t\tthis.freeze();\n\t}\n\ttoOp() {\n\t\treturn dropIndex(this.collection, this.keys);\n\t}\n\trenderTypeScript() {\n\t\treturn `dropIndex(${jsonToTsSource(this.collection)}, ${jsonToTsSource(this.keys)})`;\n\t}\n};\nvar CreateCollectionCall = class extends OpFactoryCallNode {\n\tfactoryName = \"createCollection\";\n\toperationClass = \"additive\";\n\tcollection;\n\toptions;\n\tlabel;\n\tconstructor(collection, options) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.options = options;\n\t\tthis.label = `Create collection ${collection}`;\n\t\tthis.freeze();\n\t}\n\ttoOp() {\n\t\treturn createCollection(this.collection, this.options);\n\t}\n\trenderTypeScript() {\n\t\treturn this.options ? `createCollection(${jsonToTsSource(this.collection)}, ${jsonToTsSource(this.options)})` : `createCollection(${jsonToTsSource(this.collection)})`;\n\t}\n};\nvar DropCollectionCall = class extends OpFactoryCallNode {\n\tfactoryName = \"dropCollection\";\n\toperationClass = \"destructive\";\n\tcollection;\n\tlabel;\n\tconstructor(collection) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.label = `Drop collection ${collection}`;\n\t\tthis.freeze();\n\t}\n\ttoOp() {\n\t\treturn dropCollection(this.collection);\n\t}\n\trenderTypeScript() {\n\t\treturn `dropCollection(${jsonToTsSource(this.collection)})`;\n\t}\n};\nvar CollModCall = class extends OpFactoryCallNode {\n\tfactoryName = \"collMod\";\n\tcollection;\n\toptions;\n\tmeta;\n\toperationClass;\n\tlabel;\n\tconstructor(collection, options, meta) {\n\t\tsuper();\n\t\tthis.collection = collection;\n\t\tthis.options = options;\n\t\tthis.meta = meta;\n\t\tthis.operationClass = meta?.operationClass ?? \"destructive\";\n\t\tthis.label = meta?.label ?? `Modify collection ${collection}`;\n\t\tthis.freeze();\n\t}\n\ttoOp() {\n\t\treturn collMod(this.collection, this.options, this.meta);\n\t}\n\trenderTypeScript() {\n\t\treturn this.meta ? `collMod(${jsonToTsSource(this.collection)}, ${jsonToTsSource(this.options)}, ${jsonToTsSource(this.meta)})` : `collMod(${jsonToTsSource(this.collection)}, ${jsonToTsSource(this.options)})`;\n\t}\n};\nfunction schemaIndexToCreateIndexOptions(index) {\n\treturn {\n\t\t...index.unique ? { unique: true } : {},\n\t\t...ifDefined(\"sparse\", index.sparse),\n\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds),\n\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression),\n\t\t...ifDefined(\"wildcardProjection\", index.wildcardProjection),\n\t\t...ifDefined(\"collation\", index.collation),\n\t\t...ifDefined(\"weights\", index.weights),\n\t\t...ifDefined(\"default_language\", index.default_language),\n\t\t...ifDefined(\"language_override\", index.language_override)\n\t};\n}\nfunction schemaCollectionToCreateCollectionOptions(coll) {\n\tconst opts = coll.options;\n\tconst validator = coll.validator;\n\tif (!opts && !validator) return void 0;\n\treturn {\n\t\t...opts?.capped ? { capped: true } : {},\n\t\t...ifDefined(\"size\", opts?.capped?.size),\n\t\t...ifDefined(\"max\", opts?.capped?.max),\n\t\t...ifDefined(\"timeseries\", opts?.timeseries),\n\t\t...ifDefined(\"collation\", opts?.collation),\n\t\t...opts?.clusteredIndex ? { clusteredIndex: {\n\t\t\tkey: { _id: 1 },\n\t\t\tunique: true,\n\t\t\t...opts.clusteredIndex.name != null ? { name: opts.clusteredIndex.name } : {}\n\t\t} } : {},\n\t\t...validator ? { validator: { $jsonSchema: validator.jsonSchema } } : {},\n\t\t...ifDefined(\"validationLevel\", validator?.validationLevel),\n\t\t...ifDefined(\"validationAction\", validator?.validationAction),\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", opts?.changeStreamPreAndPostImages)\n\t};\n}\n//#endregion\n//#region src/core/render-ops.ts\nfunction renderOps(calls) {\n\treturn calls.map((call) => call.toOp());\n}\n//#endregion\n//#region src/core/render-typescript.ts\n/**\n* Always-present base imports for the rendered scaffold, both from the\n* target's own `migration` entry:\n*\n* - `Migration` — the user-facing Mongo `Migration` base, forwarded from\n* `@internal/family-mongo`; subclasses don't need to redeclare\n* `targetId` or thread family/target generics.\n* - `MigrationCLI` — the migration-file CLI entrypoint that loads\n* `prisma-next.config.ts`, assembles a `ControlStack`, and instantiates\n* the migration class. The migration file owns this dependency directly:\n* pulling CLI machinery in at script run time is acceptable because the\n* script's whole purpose is to be invoked from the project that owns the\n* config.\n*\n* Naming one package rather than three is what lets an application that\n* installed only `@prisma/orm-mongo` run a scaffolded migration: emitted\n* code may name only a direct dependency (ADR 242), and the facade carries\n* the target's `migration` entry but neither the family base nor the CLI.\n*/\nconst BASE_IMPORTS = [{\n\tmoduleSpecifier: TARGET_MIGRATION_MODULE,\n\tsymbol: \"Migration\"\n}, {\n\tmoduleSpecifier: TARGET_MIGRATION_MODULE,\n\tsymbol: \"MigrationCLI\"\n}];\n/**\n* Render a list of Mongo `OpFactoryCall`s as a `migration.ts` source string.\n* The result is shebanged, imports the contract JSON from the shared\n* snapshot store (the destination contract, plus the source contract for a\n* non-baseline migration), extends `Migration<Start, End>` (or\n* `Migration<never, End>` for a baseline) from\n* `@internal/target-mongo/migration`,\n* assigns the JSON to `endContractJson` / `startContractJson`, and implements\n* `operations`. The `Migration` base derives `describe()` from those fields.\n*\n* The walk is polymorphic: each call node contributes its own\n* `renderTypeScript()` expression and declares its own `importRequirements()`.\n* The top-level renderer aggregates imports across all nodes and emits one\n* `import { … } from \"…\"` line per module. The `Migration` / `MigrationCLI`\n* base imports and the contract-JSON imports are always emitted, independent\n* of the call nodes.\n*/\nfunction renderCallsToTypeScript(calls, meta) {\n\tconst imports = buildImports(calls, meta);\n\tconst operationsBody = calls.map((c) => c.renderTypeScript()).join(\",\\n\");\n\tconst hasStart = meta.from !== null;\n\tconst startField = hasStart ? [\" override readonly startContractJson = startContract;\"] : [];\n\treturn [\n\t\tshebangLineFor(detectScaffoldRuntime()),\n\t\timports,\n\t\t\"\",\n\t\t`class M extends Migration<${hasStart ? \"Start\" : \"never\"}, End> {`,\n\t\t...startField,\n\t\t\" override readonly endContractJson = endContract;\",\n\t\t\"\",\n\t\t\" override get operations() {\",\n\t\t\" return [\",\n\t\tindent(operationsBody, 6),\n\t\t\" ];\",\n\t\t\" }\",\n\t\t\"}\",\n\t\t\"\",\n\t\t\"export default M;\",\n\t\t\"MigrationCLI.run(import.meta.url, M);\",\n\t\t\"\"\n\t].join(\"\\n\");\n}\nfunction buildImports(calls, meta) {\n\tconst requirements = [...BASE_IMPORTS, ...contractImports(meta)];\n\tfor (const call of calls) for (const req of call.importRequirements()) requirements.push(req);\n\treturn renderImports(resolveRequirementSpecifiers(requirements, meta.resolveImportSpecifier));\n}\n/**\n* The committed contract-JSON imports the scaffold reads its from/to identity\n* from, resolved to the deduplicated snapshot store under\n* `meta.snapshotsImportPath`. The end snapshot is always present; the start\n* snapshot is added only for a non-baseline migration (`meta.from !== null`).\n* The matching `Contract` type imports (aliased `Start`/`End`) feed the\n* `Migration<Start, End>` generics. Baseline emits `Migration<never, End>` with\n* no start imports — `never` is the honest \"no prior contract\" Start.\n*/\nfunction contractImports(meta) {\n\tconst reqs = [{\n\t\tmoduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.to),\n\t\tsymbol: \"endContract\",\n\t\tkind: \"default\",\n\t\tattributes: { type: \"json\" }\n\t}, {\n\t\tmoduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.to),\n\t\tsymbol: \"Contract\",\n\t\talias: \"End\",\n\t\ttypeOnly: true\n\t}];\n\tif (meta.from !== null) {\n\t\treqs.push({\n\t\t\tmoduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.from),\n\t\t\tsymbol: \"startContract\",\n\t\t\tkind: \"default\",\n\t\t\tattributes: { type: \"json\" }\n\t\t});\n\t\treqs.push({\n\t\t\tmoduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.from),\n\t\t\tsymbol: \"Contract\",\n\t\t\talias: \"Start\",\n\t\t\ttypeOnly: true\n\t\t});\n\t}\n\treturn reqs;\n}\nfunction indent(text, spaces) {\n\tconst pad = \" \".repeat(spaces);\n\treturn text.split(\"\\n\").map((line) => line.trim() ? `${pad}${line}` : line).join(\"\\n\");\n}\n//#endregion\n//#region src/core/planner-produced-migration.ts\n/**\n* Planner-produced Mongo migration, returned by `MongoMigrationPlanner.plan(...)`\n* and `MongoMigrationPlanner.emptyMigration(...)`.\n*\n* Unlike user-authored migrations (which extend `MongoMigration` from\n* `@internal/family-mongo`), this class lives inside the target and holds\n* the richer authoring IR (`OpFactoryCall[]`) needed to render itself back to\n* TypeScript source. It implements `MigrationPlanWithAuthoringSurface` so\n* that the CLI can uniformly ask any planner result to serialize itself to a\n* `migration.ts`.\n*\n* It extends the framework `Migration` base directly and declares its own\n* `targetId` rather than inheriting `MongoMigration`, whose added value is\n* the lazily-built contract views a planner result never reads.\n*/\nvar PlannerProducedMongoMigration = class extends Migration {\n\tcalls;\n\tmeta;\n\tsnapshotsImportPath;\n\ttargetId = \"mongo\";\n\tconstructor(calls, meta, snapshotsImportPath) {\n\t\tsuper();\n\t\tthis.calls = calls;\n\t\tthis.meta = meta;\n\t\tthis.snapshotsImportPath = snapshotsImportPath;\n\t}\n\tget operations() {\n\t\treturn renderOps(this.calls);\n\t}\n\tdescribe() {\n\t\treturn this.meta;\n\t}\n\trenderTypeScript(resolveImportSpecifier) {\n\t\treturn renderCallsToTypeScript(this.calls, {\n\t\t\tfrom: this.meta.from,\n\t\t\tto: this.meta.to,\n\t\t\tsnapshotsImportPath: this.snapshotsImportPath,\n\t\t\tresolveImportSpecifier\n\t\t});\n\t}\n};\n//#endregion\n//#region src/core/mongo-planner.ts\nfunction buildIndexLookupKey(index) {\n\tconst keys = index.keys.map((k) => `${k.field}:${k.direction}`).join(\",\");\n\tconst opts = [\n\t\tindex.unique ? \"unique\" : \"\",\n\t\tindex.sparse ? \"sparse\" : \"\",\n\t\tindex.expireAfterSeconds != null ? `ttl:${index.expireAfterSeconds}` : \"\",\n\t\tindex.partialFilterExpression ? `pfe:${canonicalize(index.partialFilterExpression)}` : \"\",\n\t\tindex.wildcardProjection ? `wp:${canonicalize(index.wildcardProjection)}` : \"\",\n\t\tindex.collation ? `col:${canonicalize(index.collation)}` : \"\",\n\t\tindex.weights ? `wt:${canonicalize(index.weights)}` : \"\",\n\t\tindex.default_language ? `dl:${index.default_language}` : \"\",\n\t\tindex.language_override ? `lo:${index.language_override}` : \"\"\n\t].filter(Boolean).join(\";\");\n\treturn opts ? `${keys}|${opts}` : keys;\n}\nfunction validatorsEqual(a, b) {\n\tif (!a && !b) return true;\n\tif (!a || !b) return false;\n\treturn a.validationLevel === b.validationLevel && a.validationAction === b.validationAction && canonicalize(a.jsonSchema) === canonicalize(b.jsonSchema);\n}\nfunction classifyValidatorUpdate(origin, dest) {\n\tif (origin.validationAction !== dest.validationAction && dest.validationAction === \"error\") return \"destructive\";\n\tif (origin.validationLevel !== dest.validationLevel && dest.validationLevel === \"strict\") return \"destructive\";\n\tif (canonicalize(origin.jsonSchema) === canonicalize(dest.jsonSchema)) return \"widening\";\n\treturn isWideningSchemaChange(origin.jsonSchema, dest.jsonSchema) ? \"widening\" : \"destructive\";\n}\nfunction isPlainObject(v) {\n\treturn typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n/**\n* Returns true when `dest` is a structural superset of `origin` for the common\n* additive case: adding non-required properties to a top-level object schema.\n* Anything uncertain falls through to the safe `destructive` default.\n*/\nfunction isWideningSchemaChange(origin, dest) {\n\tif (origin[\"bsonType\"] !== \"object\" || dest[\"bsonType\"] !== \"object\") return false;\n\tconst allKeys = /* @__PURE__ */ new Set([...Object.keys(origin), ...Object.keys(dest)]);\n\tfor (const key of allKeys) {\n\t\tif (key === \"required\" || key === \"properties\") continue;\n\t\tif (canonicalize(origin[key]) !== canonicalize(dest[key])) return false;\n\t}\n\tconst originRequired = new Set(Array.isArray(origin[\"required\"]) ? origin[\"required\"] : []);\n\tconst destRequired = Array.isArray(dest[\"required\"]) ? dest[\"required\"] : [];\n\tfor (const field of destRequired) if (!originRequired.has(field)) return false;\n\tconst originProps = isPlainObject(origin[\"properties\"]) ? origin[\"properties\"] : {};\n\tconst destProps = isPlainObject(dest[\"properties\"]) ? dest[\"properties\"] : {};\n\tfor (const field of Object.keys(originProps)) {\n\t\tif (!Object.hasOwn(destProps, field)) return false;\n\t\tif (canonicalize(originProps[field]) !== canonicalize(destProps[field])) return false;\n\t}\n\treturn true;\n}\nfunction hasImmutableOptionChange(origin, dest) {\n\tif (canonicalize(origin?.capped) !== canonicalize(dest?.capped)) return \"capped\";\n\tif (canonicalize(origin?.timeseries) !== canonicalize(dest?.timeseries)) return \"timeseries\";\n\tif (canonicalize(origin?.collation) !== canonicalize(dest?.collation)) return \"collation\";\n\tif (canonicalize(origin?.clusteredIndex) !== canonicalize(dest?.clusteredIndex)) return \"clusteredIndex\";\n}\nfunction collectionHasOptions(coll) {\n\treturn !!(coll.options || coll.validator);\n}\nvar MongoMigrationPlanner = class {\n\tplanCalls(options) {\n\t\tconst contract = options.contract;\n\t\tconst originIR = options.schema;\n\t\tconst destinationIR = contractToMongoSchemaIR(contract);\n\t\tconst collCreates = [];\n\t\tconst drops = [];\n\t\tconst creates = [];\n\t\tconst validatorOps = [];\n\t\tconst mutableOptionOps = [];\n\t\tconst collDrops = [];\n\t\tconst conflicts = [];\n\t\tconst allCollectionNames = /* @__PURE__ */ new Set([...originIR.collectionNames, ...destinationIR.collectionNames]);\n\t\tfor (const collName of [...allCollectionNames].sort()) {\n\t\t\tconst originColl = originIR.collection(collName);\n\t\t\tconst destColl = destinationIR.collection(collName);\n\t\t\tif (!originColl) {\n\t\t\t\tif (destColl && (collectionHasOptions(destColl) || destColl.indexes.length === 0)) {\n\t\t\t\t\tconst opts = collectionHasOptions(destColl) ? schemaCollectionToCreateCollectionOptions(destColl) : void 0;\n\t\t\t\t\tcollCreates.push(new CreateCollectionCall(collName, opts));\n\t\t\t\t}\n\t\t\t} else if (!destColl) collDrops.push(new DropCollectionCall(collName));\n\t\t\telse {\n\t\t\t\tconst immutableChange = hasImmutableOptionChange(originColl.options, destColl.options);\n\t\t\t\tif (immutableChange) conflicts.push({\n\t\t\t\t\tkind: \"policy-violation\",\n\t\t\t\t\tsummary: `Cannot change immutable collection option '${immutableChange}' on ${collName}`,\n\t\t\t\t\twhy: `MongoDB does not support modifying the '${immutableChange}' option after collection creation`\n\t\t\t\t});\n\t\t\t\tconst mutableCall = planMutableOptionsDiffCall(collName, originColl.options, destColl.options);\n\t\t\t\tif (mutableCall) mutableOptionOps.push(mutableCall);\n\t\t\t\tconst validatorCall = planValidatorDiffCall(collName, originColl.validator, destColl.validator);\n\t\t\t\tif (validatorCall) validatorOps.push(validatorCall);\n\t\t\t}\n\t\t\tconst originLookup = /* @__PURE__ */ new Map();\n\t\t\tif (originColl) for (const idx of originColl.indexes) originLookup.set(buildIndexLookupKey(idx), idx);\n\t\t\tconst destLookup = /* @__PURE__ */ new Map();\n\t\t\tif (destColl) for (const idx of destColl.indexes) destLookup.set(buildIndexLookupKey(idx), idx);\n\t\t\tfor (const [lookupKey, idx] of originLookup) if (!destLookup.has(lookupKey)) drops.push(new DropIndexCall(collName, idx.keys));\n\t\t\tfor (const [lookupKey, idx] of destLookup) if (!originLookup.has(lookupKey)) creates.push(new CreateIndexCall(collName, idx.keys, schemaIndexToCreateIndexOptions(idx)));\n\t\t}\n\t\tif (conflicts.length > 0) return {\n\t\t\tkind: \"failure\",\n\t\t\tconflicts\n\t\t};\n\t\tconst allCalls = [\n\t\t\t...collCreates,\n\t\t\t...drops,\n\t\t\t...creates,\n\t\t\t...validatorOps,\n\t\t\t...mutableOptionOps,\n\t\t\t...collDrops\n\t\t];\n\t\tfor (const call of allCalls) if (!options.policy.allowedOperationClasses.includes(call.operationClass)) conflicts.push({\n\t\t\tkind: \"policy-violation\",\n\t\t\tsummary: `${call.operationClass} operation disallowed: ${call.label}`,\n\t\t\twhy: `Policy does not allow '${call.operationClass}' operations`\n\t\t});\n\t\tif (conflicts.length > 0) return {\n\t\t\tkind: \"failure\",\n\t\t\tconflicts\n\t\t};\n\t\treturn {\n\t\t\tkind: \"success\",\n\t\t\tcalls: allCalls\n\t\t};\n\t}\n\tplan(options) {\n\t\tconst contract = options.contract;\n\t\tconst result = this.planCalls(options);\n\t\tif (result.kind === \"failure\") return result;\n\t\treturn {\n\t\t\tkind: \"success\",\n\t\t\tplan: new PlannerProducedMongoMigration(result.calls, {\n\t\t\t\tfrom: options.fromContract?.storage.storageHash ?? null,\n\t\t\t\tto: contract.storage.storageHash\n\t\t\t}, options.snapshotsImportPath)\n\t\t};\n\t}\n\t/**\n\t* Produce an empty `migration.ts` authoring surface for `migration new`.\n\t*\n\t* The \"empty migration\" is a `PlannerProducedMongoMigration` with no\n\t* operations; `renderTypeScript()` emits a stub class with the correct\n\t* `from`/`to` metadata that the user then fills in with operations. The\n\t* contract path on the context is unused — Mongo's emitted source does\n\t* not import from the generated contract `.d.ts`.\n\t*/\n\temptyMigration(context) {\n\t\treturn new PlannerProducedMongoMigration([], {\n\t\t\tfrom: context.fromHash,\n\t\t\tto: context.toHash\n\t\t}, context.snapshotsImportPath);\n\t}\n};\nfunction planValidatorDiffCall(collName, originValidator, destValidator) {\n\tif (validatorsEqual(originValidator, destValidator)) return void 0;\n\tif (destValidator) {\n\t\tconst operationClass = originValidator ? classifyValidatorUpdate(originValidator, destValidator) : \"destructive\";\n\t\treturn new CollModCall(collName, {\n\t\t\tvalidator: { $jsonSchema: destValidator.jsonSchema },\n\t\t\tvalidationLevel: destValidator.validationLevel,\n\t\t\tvalidationAction: destValidator.validationAction\n\t\t}, {\n\t\t\tid: `validator.${collName}.${originValidator ? \"update\" : \"add\"}`,\n\t\t\tlabel: `${originValidator ? \"Update\" : \"Add\"} validator on ${collName}`,\n\t\t\toperationClass\n\t\t});\n\t}\n\treturn new CollModCall(collName, {\n\t\tvalidator: {},\n\t\tvalidationLevel: \"strict\",\n\t\tvalidationAction: \"error\"\n\t}, {\n\t\tid: `validator.${collName}.remove`,\n\t\tlabel: `Remove validator on ${collName}`,\n\t\toperationClass: \"widening\"\n\t});\n}\nfunction planMutableOptionsDiffCall(collName, origin, dest) {\n\tconst originCSPPI = origin?.changeStreamPreAndPostImages;\n\tconst destCSPPI = dest?.changeStreamPreAndPostImages;\n\tif (deepEqual(originCSPPI, destCSPPI)) return void 0;\n\tconst desiredCSPPI = destCSPPI ?? { enabled: false };\n\treturn new CollModCall(collName, { changeStreamPreAndPostImages: desiredCSPPI }, {\n\t\tid: `options.${collName}.update`,\n\t\tlabel: `Update mutable options on ${collName}`,\n\t\toperationClass: desiredCSPPI.enabled ? \"widening\" : \"destructive\"\n\t});\n}\n//#endregion\n//#region src/core/mongo-target-errors.ts\nfunction mongoTargetError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/core/filter-evaluator.ts\nfunction getNestedField(doc, path) {\n\tconst parts = path.split(\".\");\n\tlet current = doc;\n\tfor (const part of parts) {\n\t\tif (current === null || current === void 0 || typeof current !== \"object\") return;\n\t\tconst record = current;\n\t\tif (!Object.hasOwn(record, part)) return;\n\t\tcurrent = record[part];\n\t}\n\treturn current;\n}\nfunction evaluateFieldOp(op, actual, expected) {\n\tswitch (op) {\n\t\tcase \"$eq\": return deepEqual(actual, expected);\n\t\tcase \"$ne\": return !deepEqual(actual, expected);\n\t\tcase \"$gt\": return typeof actual === typeof expected && actual > expected;\n\t\tcase \"$gte\": return typeof actual === typeof expected && actual >= expected;\n\t\tcase \"$lt\": return typeof actual === typeof expected && actual < expected;\n\t\tcase \"$lte\": return typeof actual === typeof expected && actual <= expected;\n\t\tcase \"$in\": return Array.isArray(expected) && expected.some((v) => deepEqual(actual, v));\n\t\tdefault: throw mongoTargetError(\"MIGRATION.OPERATION_UNSUPPORTED\", `Unsupported filter operator in migration check: ${op}`, { meta: { operator: op } });\n\t}\n}\nvar FilterEvaluator = class {\n\tdoc = {};\n\tevaluate(filter, doc) {\n\t\tthis.doc = doc;\n\t\treturn filter.accept(this);\n\t}\n\tfield(expr) {\n\t\tconst value = getNestedField(this.doc, expr.field);\n\t\treturn evaluateFieldOp(expr.op, value, expr.value);\n\t}\n\tand(expr) {\n\t\treturn expr.exprs.every((child) => child.accept(this));\n\t}\n\tor(expr) {\n\t\treturn expr.exprs.some((child) => child.accept(this));\n\t}\n\tnot(expr) {\n\t\treturn !expr.expr.accept(this);\n\t}\n\texists(expr) {\n\t\tconst has = getNestedField(this.doc, expr.field) !== void 0;\n\t\treturn expr.exists ? has : !has;\n\t}\n\texpr(_expr) {\n\t\tthrow mongoTargetError(\"MIGRATION.OPERATION_UNSUPPORTED\", \"Aggregation expression filters are not supported in migration checks\", { meta: { operator: \"$expr\" } });\n\t}\n};\n//#endregion\n//#region src/core/mongo-ops-serializer.ts\nconst IndexKeyJson = type({\n\tfield: \"string\",\n\tdirection: type(\"1 | -1 | \\\"text\\\" | \\\"2dsphere\\\" | \\\"2d\\\" | \\\"hashed\\\"\")\n});\nconst CollationJson = type({\n\tlocale: \"string\",\n\t\"caseLevel?\": \"boolean\",\n\t\"caseFirst?\": \"string\",\n\t\"strength?\": \"number\",\n\t\"numericOrdering?\": \"boolean\",\n\t\"alternate?\": \"string\",\n\t\"maxVariable?\": \"string\",\n\t\"backwards?\": \"boolean\",\n\t\"normalization?\": \"boolean\"\n});\nconst CreateIndexJson = type({\n\tkind: \"\\\"createIndex\\\"\",\n\tcollection: \"string\",\n\tkeys: IndexKeyJson.array().atLeastLength(1),\n\t\"unique?\": \"boolean\",\n\t\"sparse?\": \"boolean\",\n\t\"expireAfterSeconds?\": \"number\",\n\t\"partialFilterExpression?\": \"Record<string, unknown>\",\n\t\"name?\": \"string\",\n\t\"wildcardProjection?\": \"Record<string, 0 | 1>\",\n\t\"collation?\": CollationJson,\n\t\"weights?\": \"Record<string, number>\",\n\t\"default_language?\": \"string\",\n\t\"language_override?\": \"string\"\n});\nconst DropIndexJson = type({\n\tkind: \"\\\"dropIndex\\\"\",\n\tcollection: \"string\",\n\tname: \"string\"\n});\nconst CreateCollectionJson = type({\n\tkind: \"\\\"createCollection\\\"\",\n\tcollection: \"string\",\n\t\"validator?\": \"Record<string, unknown>\",\n\t\"validationLevel?\": \"\\\"strict\\\" | \\\"moderate\\\"\",\n\t\"validationAction?\": \"\\\"error\\\" | \\\"warn\\\"\",\n\t\"capped?\": \"boolean\",\n\t\"size?\": \"number\",\n\t\"max?\": \"number\",\n\t\"timeseries?\": {\n\t\ttimeField: \"string\",\n\t\t\"metaField?\": \"string\",\n\t\t\"granularity?\": \"\\\"seconds\\\" | \\\"minutes\\\" | \\\"hours\\\"\"\n\t},\n\t\"collation?\": CollationJson,\n\t\"changeStreamPreAndPostImages?\": { enabled: \"boolean\" },\n\t\"clusteredIndex?\": {\n\t\tkey: \"Record<string, number>\",\n\t\tunique: \"boolean\",\n\t\t\"name?\": \"string\"\n\t}\n});\nconst DropCollectionJson = type({\n\tkind: \"\\\"dropCollection\\\"\",\n\tcollection: \"string\"\n});\nconst CollModJson = type({\n\tkind: \"\\\"collMod\\\"\",\n\tcollection: \"string\",\n\t\"validator?\": \"Record<string, unknown>\",\n\t\"validationLevel?\": \"\\\"strict\\\" | \\\"moderate\\\"\",\n\t\"validationAction?\": \"\\\"error\\\" | \\\"warn\\\"\",\n\t\"changeStreamPreAndPostImages?\": { enabled: \"boolean\" }\n});\nconst ListIndexesJson = type({\n\tkind: \"\\\"listIndexes\\\"\",\n\tcollection: \"string\"\n});\nconst ListCollectionsJson = type({ kind: \"\\\"listCollections\\\"\" });\nconst FieldFilterJson = type({\n\tkind: \"\\\"field\\\"\",\n\tfield: \"string\",\n\top: \"string\",\n\tvalue: \"unknown\"\n});\nconst ExistsFilterJson = type({\n\tkind: \"\\\"exists\\\"\",\n\tfield: \"string\",\n\texists: \"boolean\"\n});\nconst RawInsertOneJson = type({\n\tkind: \"\\\"rawInsertOne\\\"\",\n\tcollection: \"string\",\n\tdocument: \"Record<string, unknown>\"\n});\nconst RawInsertManyJson = type({\n\tkind: \"\\\"rawInsertMany\\\"\",\n\tcollection: \"string\",\n\tdocuments: \"Record<string, unknown>[]\"\n});\nconst RawUpdateOneJson = type({\n\tkind: \"\\\"rawUpdateOne\\\"\",\n\tcollection: \"string\",\n\tfilter: \"Record<string, unknown>\",\n\tupdate: \"Record<string, unknown> | Record<string, unknown>[]\"\n});\nconst RawUpdateManyJson = type({\n\tkind: \"\\\"rawUpdateMany\\\"\",\n\tcollection: \"string\",\n\tfilter: \"Record<string, unknown>\",\n\tupdate: \"Record<string, unknown> | Record<string, unknown>[]\"\n});\nconst RawDeleteOneJson = type({\n\tkind: \"\\\"rawDeleteOne\\\"\",\n\tcollection: \"string\",\n\tfilter: \"Record<string, unknown>\"\n});\nconst RawDeleteManyJson = type({\n\tkind: \"\\\"rawDeleteMany\\\"\",\n\tcollection: \"string\",\n\tfilter: \"Record<string, unknown>\"\n});\nconst RawAggregateJson = type({\n\tkind: \"\\\"rawAggregate\\\"\",\n\tcollection: \"string\",\n\tpipeline: \"Record<string, unknown>[]\"\n});\nconst RawFindOneAndUpdateJson = type({\n\tkind: \"\\\"rawFindOneAndUpdate\\\"\",\n\tcollection: \"string\",\n\tfilter: \"Record<string, unknown>\",\n\tupdate: \"Record<string, unknown> | Record<string, unknown>[]\",\n\tupsert: \"boolean\"\n});\nconst RawFindOneAndDeleteJson = type({\n\tkind: \"\\\"rawFindOneAndDelete\\\"\",\n\tcollection: \"string\",\n\tfilter: \"Record<string, unknown>\"\n});\nconst TypedAggregateJson = type({\n\tkind: \"\\\"aggregate\\\"\",\n\tcollection: \"string\",\n\tpipeline: \"Record<string, unknown>[]\"\n});\nconst QueryPlanJson = type({\n\tcollection: \"string\",\n\tcommand: \"Record<string, unknown>\",\n\tmeta: type({\n\t\ttarget: \"string\",\n\t\tstorageHash: \"string\",\n\t\tlane: \"string\",\n\t\t\"targetFamily?\": \"string\",\n\t\t\"profileHash?\": \"string\",\n\t\t\"annotations?\": \"Record<string, unknown>\"\n\t})\n});\nconst CheckJson = type({\n\tdescription: \"string\",\n\tsource: \"Record<string, unknown>\",\n\tfilter: \"Record<string, unknown>\",\n\texpect: \"\\\"exists\\\" | \\\"notExists\\\"\"\n});\nconst StepJson = type({\n\tdescription: \"string\",\n\tcommand: \"Record<string, unknown>\"\n});\nconst DdlOperationJson = type({\n\tid: \"string\",\n\tlabel: \"string\",\n\toperationClass: \"\\\"additive\\\" | \\\"widening\\\" | \\\"destructive\\\"\",\n\tprecheck: \"Record<string, unknown>[]\",\n\texecute: \"Record<string, unknown>[]\",\n\tpostcheck: \"Record<string, unknown>[]\"\n});\nconst DataTransformCheckJson = type({\n\tdescription: \"string\",\n\tsource: \"Record<string, unknown>\",\n\tfilter: \"Record<string, unknown>\",\n\texpect: \"\\\"exists\\\" | \\\"notExists\\\"\"\n});\nconst DataTransformOperationJson = type({\n\tid: \"string\",\n\tlabel: \"string\",\n\toperationClass: \"\\\"data\\\"\",\n\tname: \"string\",\n\tprecheck: \"Record<string, unknown>[]\",\n\trun: \"Record<string, unknown>[]\",\n\tpostcheck: \"Record<string, unknown>[]\"\n});\nfunction validate(schema, data, context) {\n\ttry {\n\t\treturn schema.assert(stripUndefinedDeep(data));\n\t} catch (error) {\n\t\t/* v8 ignore stop */\n\t\tthrow mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", `Invalid ${context}: ${error instanceof Error ? error.message : String(error)}`, {\n\t\t\tmeta: { context },\n\t\t\tcause: error\n\t\t});\n\t}\n}\n/**\n* Strip `undefined`-valued properties before they reach arktype's optional-key\n* assertions.\n*\n* Op IRs (e.g. `CreateCollectionCommand`) assign every optional field on\n* every instance — fields the caller did not provide land as\n* `undefined`-valued properties. arktype treats `{ foo?: 'boolean' }` as\n* \"key may be absent, but if present must be boolean\", so the bare instance\n* fails validation when it crosses the deserialize boundary in-process\n* (no JSON round-trip happens between planner → runner). This helper\n* recovers the JSON-round-tripped shape (undefined keys absent) without\n* forcing every caller to round-trip.\n*\n* Returns the original value reference whenever no change is needed.\n* That preserves prototype-bound payload values such as BSON wrappers\n* (`ObjectId`, `Decimal128`, `Binary`, …) which embed no `undefined`\n* own-enumerable properties and therefore never trigger a rebuild.\n* Top-level op IRs (class instances with `undefined` optional fields)\n* still get flattened to plain records as required by arktype.\n*/\nfunction stripUndefinedDeep(value) {\n\tif (Array.isArray(value)) {\n\t\tlet changed = false;\n\t\tconst next = value.map((item) => {\n\t\t\tconst stripped = stripUndefinedDeep(item);\n\t\t\tif (stripped !== item) changed = true;\n\t\t\treturn stripped;\n\t\t});\n\t\treturn changed ? next : value;\n\t}\n\tif (value === null || typeof value !== \"object\") return value;\n\tconst entries = Object.entries(value);\n\tconst out = {};\n\tlet changed = false;\n\tfor (const [key, val] of entries) {\n\t\tif (val === void 0) {\n\t\t\tchanged = true;\n\t\t\tcontinue;\n\t\t}\n\t\tconst stripped = stripUndefinedDeep(val);\n\t\tif (stripped !== val) changed = true;\n\t\tout[key] = stripped;\n\t}\n\treturn changed ? out : value;\n}\nfunction deserializeFilterExpr(json) {\n\tconst record = json;\n\tconst kind = record[\"kind\"];\n\tswitch (kind) {\n\t\tcase \"field\": {\n\t\t\tconst data = validate(FieldFilterJson, json, \"field filter\");\n\t\t\treturn MongoFieldFilter.of(data.field, data.op, data.value);\n\t\t}\n\t\tcase \"and\": {\n\t\t\tconst exprs = record[\"exprs\"];\n\t\t\tif (!Array.isArray(exprs)) throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", \"Invalid and filter: missing exprs array\", { meta: { context: \"and filter\" } });\n\t\t\treturn MongoAndExpr.of(exprs.map(deserializeFilterExpr));\n\t\t}\n\t\tcase \"or\": {\n\t\t\tconst exprs = record[\"exprs\"];\n\t\t\tif (!Array.isArray(exprs)) throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", \"Invalid or filter: missing exprs array\", { meta: { context: \"or filter\" } });\n\t\t\treturn MongoOrExpr.of(exprs.map(deserializeFilterExpr));\n\t\t}\n\t\tcase \"not\": {\n\t\t\tconst expr = record[\"expr\"];\n\t\t\tif (!expr || typeof expr !== \"object\") throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", \"Invalid not filter: missing expr\", { meta: { context: \"not filter\" } });\n\t\t\treturn new MongoNotExpr(deserializeFilterExpr(expr));\n\t\t}\n\t\tcase \"exists\": {\n\t\t\tconst data = validate(ExistsFilterJson, json, \"exists filter\");\n\t\t\treturn new MongoExistsExpr(data.field, data.exists);\n\t\t}\n\t\tdefault: throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", `Unknown filter expression kind: ${kind}`, { meta: {\n\t\t\tcontext: \"filter expression\",\n\t\t\tkind\n\t\t} });\n\t}\n}\nfunction deserializePipelineStage(json) {\n\tconst record = json;\n\tconst kind = record[\"kind\"];\n\tswitch (kind) {\n\t\tcase \"match\": return new MongoMatchStage(deserializeFilterExpr(record[\"filter\"]));\n\t\tcase \"limit\": return new MongoLimitStage(record[\"limit\"]);\n\t\tcase \"sort\": return new MongoSortStage(record[\"sort\"]);\n\t\tcase \"project\": return new MongoProjectStage(record[\"projection\"]);\n\t\tcase \"addFields\": return new MongoAddFieldsStage(record[\"fields\"]);\n\t\tcase \"lookup\": {\n\t\t\tconst opts = {\n\t\t\t\tfrom: record[\"from\"],\n\t\t\t\tas: record[\"as\"]\n\t\t\t};\n\t\t\tif (record[\"localField\"] !== void 0) opts.localField = record[\"localField\"];\n\t\t\tif (record[\"foreignField\"] !== void 0) opts.foreignField = record[\"foreignField\"];\n\t\t\tif (record[\"pipeline\"] !== void 0) opts.pipeline = record[\"pipeline\"].map(deserializePipelineStage);\n\t\t\tif (record[\"let_\"] !== void 0) opts.let_ = record[\"let_\"];\n\t\t\treturn new MongoLookupStage(opts);\n\t\t}\n\t\tcase \"merge\": {\n\t\t\tconst opts = { into: record[\"into\"] };\n\t\t\tif (record[\"on\"] !== void 0) opts.on = record[\"on\"];\n\t\t\tif (record[\"whenMatched\"] !== void 0) {\n\t\t\t\tconst wm = record[\"whenMatched\"];\n\t\t\t\topts.whenMatched = typeof wm === \"string\" ? wm : wm.map(deserializePipelineStage);\n\t\t\t}\n\t\t\tif (record[\"whenNotMatched\"] !== void 0) opts.whenNotMatched = record[\"whenNotMatched\"];\n\t\t\treturn new MongoMergeStage(opts);\n\t\t}\n\t\tdefault: throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", `Unknown pipeline stage kind: ${kind}`, { meta: {\n\t\t\tcontext: \"pipeline stage\",\n\t\t\tkind\n\t\t} });\n\t}\n}\nfunction deserializeDmlCommand(json) {\n\tconst kind = json[\"kind\"];\n\tswitch (kind) {\n\t\tcase \"rawInsertOne\": {\n\t\t\tconst data = validate(RawInsertOneJson, json, \"rawInsertOne command\");\n\t\t\treturn new RawInsertOneCommand(data.collection, data.document);\n\t\t}\n\t\tcase \"rawInsertMany\": {\n\t\t\tconst data = validate(RawInsertManyJson, json, \"rawInsertMany command\");\n\t\t\treturn new RawInsertManyCommand(data.collection, data.documents);\n\t\t}\n\t\tcase \"rawUpdateOne\": {\n\t\t\tconst data = validate(RawUpdateOneJson, json, \"rawUpdateOne command\");\n\t\t\treturn new RawUpdateOneCommand(data.collection, data.filter, data.update);\n\t\t}\n\t\tcase \"rawUpdateMany\": {\n\t\t\tconst data = validate(RawUpdateManyJson, json, \"rawUpdateMany command\");\n\t\t\treturn new RawUpdateManyCommand(data.collection, data.filter, data.update);\n\t\t}\n\t\tcase \"rawDeleteOne\": {\n\t\t\tconst data = validate(RawDeleteOneJson, json, \"rawDeleteOne command\");\n\t\t\treturn new RawDeleteOneCommand(data.collection, data.filter);\n\t\t}\n\t\tcase \"rawDeleteMany\": {\n\t\t\tconst data = validate(RawDeleteManyJson, json, \"rawDeleteMany command\");\n\t\t\treturn new RawDeleteManyCommand(data.collection, data.filter);\n\t\t}\n\t\tcase \"rawAggregate\": {\n\t\t\tconst data = validate(RawAggregateJson, json, \"rawAggregate command\");\n\t\t\treturn new RawAggregateCommand(data.collection, data.pipeline);\n\t\t}\n\t\tcase \"rawFindOneAndUpdate\": {\n\t\t\tconst data = validate(RawFindOneAndUpdateJson, json, \"rawFindOneAndUpdate command\");\n\t\t\treturn new RawFindOneAndUpdateCommand(data.collection, data.filter, data.update, data.upsert);\n\t\t}\n\t\tcase \"rawFindOneAndDelete\": {\n\t\t\tconst data = validate(RawFindOneAndDeleteJson, json, \"rawFindOneAndDelete command\");\n\t\t\treturn new RawFindOneAndDeleteCommand(data.collection, data.filter);\n\t\t}\n\t\tcase \"aggregate\": {\n\t\t\tconst data = validate(TypedAggregateJson, json, \"aggregate command\");\n\t\t\tconst pipeline = data.pipeline.map(deserializePipelineStage);\n\t\t\treturn new AggregateCommand(data.collection, pipeline);\n\t\t}\n\t\tdefault: throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", `Unknown DML command kind: ${kind}`, { meta: {\n\t\t\tcontext: \"DML command\",\n\t\t\tkind\n\t\t} });\n\t}\n}\nfunction deserializeMongoQueryPlan(json) {\n\tconst data = validate(QueryPlanJson, json, \"Mongo query plan\");\n\tconst command = deserializeDmlCommand(data.command);\n\tconst m = data.meta;\n\tconst meta = {\n\t\ttarget: m.target,\n\t\tstorageHash: m.storageHash,\n\t\tlane: m.lane,\n\t\t...ifDefined(\"targetFamily\", m.targetFamily),\n\t\t...ifDefined(\"profileHash\", m.profileHash),\n\t\t...ifDefined(\"annotations\", m.annotations)\n\t};\n\treturn {\n\t\tcollection: data.collection,\n\t\tcommand,\n\t\tmeta\n\t};\n}\nfunction deserializeDdlCommand(json) {\n\tconst kind = json[\"kind\"];\n\tswitch (kind) {\n\t\tcase \"createIndex\": {\n\t\t\tconst data = validate(CreateIndexJson, json, \"createIndex command\");\n\t\t\treturn new CreateIndexCommand(data.collection, data.keys, {\n\t\t\t\t...ifDefined(\"unique\", data.unique),\n\t\t\t\t...ifDefined(\"sparse\", data.sparse),\n\t\t\t\t...ifDefined(\"expireAfterSeconds\", data.expireAfterSeconds),\n\t\t\t\t...ifDefined(\"partialFilterExpression\", data.partialFilterExpression),\n\t\t\t\t...ifDefined(\"name\", data.name),\n\t\t\t\t...ifDefined(\"wildcardProjection\", data.wildcardProjection),\n\t\t\t\t...ifDefined(\"collation\", data.collation),\n\t\t\t\t...ifDefined(\"weights\", data.weights),\n\t\t\t\t...ifDefined(\"default_language\", data.default_language),\n\t\t\t\t...ifDefined(\"language_override\", data.language_override)\n\t\t\t});\n\t\t}\n\t\tcase \"dropIndex\": {\n\t\t\tconst data = validate(DropIndexJson, json, \"dropIndex command\");\n\t\t\treturn new DropIndexCommand(data.collection, data.name);\n\t\t}\n\t\tcase \"createCollection\": {\n\t\t\tconst data = validate(CreateCollectionJson, json, \"createCollection command\");\n\t\t\treturn new CreateCollectionCommand(data.collection, {\n\t\t\t\t...ifDefined(\"validator\", data.validator),\n\t\t\t\t...ifDefined(\"validationLevel\", data.validationLevel),\n\t\t\t\t...ifDefined(\"validationAction\", data.validationAction),\n\t\t\t\t...ifDefined(\"capped\", data.capped),\n\t\t\t\t...ifDefined(\"size\", data.size),\n\t\t\t\t...ifDefined(\"max\", data.max),\n\t\t\t\t...ifDefined(\"timeseries\", data.timeseries),\n\t\t\t\t...ifDefined(\"collation\", data.collation),\n\t\t\t\t...ifDefined(\"changeStreamPreAndPostImages\", data.changeStreamPreAndPostImages),\n\t\t\t\t...ifDefined(\"clusteredIndex\", data.clusteredIndex)\n\t\t\t});\n\t\t}\n\t\tcase \"dropCollection\": return new DropCollectionCommand(validate(DropCollectionJson, json, \"dropCollection command\").collection);\n\t\tcase \"collMod\": {\n\t\t\tconst data = validate(CollModJson, json, \"collMod command\");\n\t\t\treturn new CollModCommand(data.collection, {\n\t\t\t\t...ifDefined(\"validator\", data.validator),\n\t\t\t\t...ifDefined(\"validationLevel\", data.validationLevel),\n\t\t\t\t...ifDefined(\"validationAction\", data.validationAction),\n\t\t\t\t...ifDefined(\"changeStreamPreAndPostImages\", data.changeStreamPreAndPostImages)\n\t\t\t});\n\t\t}\n\t\tdefault: throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", `Unknown DDL command kind: ${kind}`, { meta: {\n\t\t\tcontext: \"DDL command\",\n\t\t\tkind\n\t\t} });\n\t}\n}\nfunction deserializeInspectionCommand(json) {\n\tconst kind = json[\"kind\"];\n\tswitch (kind) {\n\t\tcase \"listIndexes\": return new ListIndexesCommand(validate(ListIndexesJson, json, \"listIndexes command\").collection);\n\t\tcase \"listCollections\":\n\t\t\tvalidate(ListCollectionsJson, json, \"listCollections command\");\n\t\t\treturn new ListCollectionsCommand();\n\t\tdefault: throw mongoTargetError(\"MIGRATION.INVALID_OPERATION_ENTRY\", `Unknown inspection command kind: ${kind}`, { meta: {\n\t\t\tcontext: \"inspection command\",\n\t\t\tkind\n\t\t} });\n\t}\n}\nfunction deserializeCheck(json) {\n\tconst data = validate(CheckJson, json, \"migration check\");\n\treturn {\n\t\tdescription: data.description,\n\t\tsource: deserializeInspectionCommand(data.source),\n\t\tfilter: deserializeFilterExpr(data.filter),\n\t\texpect: data.expect\n\t};\n}\nfunction deserializeStep(json) {\n\tconst data = validate(StepJson, json, \"migration step\");\n\treturn {\n\t\tdescription: data.description,\n\t\tcommand: deserializeDdlCommand(data.command)\n\t};\n}\nfunction isDataTransformJson(json) {\n\treturn typeof json === \"object\" && json !== null && json[\"operationClass\"] === \"data\";\n}\nfunction deserializeDdlOp(json) {\n\tconst data = validate(DdlOperationJson, json, \"migration operation\");\n\treturn {\n\t\tid: data.id,\n\t\tlabel: data.label,\n\t\toperationClass: data.operationClass,\n\t\tprecheck: data.precheck.map(deserializeCheck),\n\t\texecute: data.execute.map(deserializeStep),\n\t\tpostcheck: data.postcheck.map(deserializeCheck)\n\t};\n}\nfunction deserializeDataTransformCheck(json) {\n\tconst data = validate(DataTransformCheckJson, json, \"data transform check\");\n\treturn {\n\t\tdescription: data.description,\n\t\tsource: deserializeMongoQueryPlan(data.source),\n\t\tfilter: deserializeFilterExpr(data.filter),\n\t\texpect: data.expect\n\t};\n}\nfunction deserializeDataTransformOp(json) {\n\tconst data = validate(DataTransformOperationJson, json, \"data transform operation\");\n\treturn {\n\t\tid: data.id,\n\t\tlabel: data.label,\n\t\toperationClass: \"data\",\n\t\tname: data.name,\n\t\tprecheck: data.precheck.map(deserializeDataTransformCheck),\n\t\trun: data.run.map(deserializeMongoQueryPlan),\n\t\tpostcheck: data.postcheck.map(deserializeDataTransformCheck)\n\t};\n}\nfunction deserializeMongoOp(json) {\n\tif (isDataTransformJson(json)) return deserializeDataTransformOp(json);\n\treturn deserializeDdlOp(json);\n}\nfunction deserializeMongoOps(json) {\n\treturn json.map(deserializeMongoOp);\n}\nfunction serializeMongoOps(ops) {\n\treturn JSON.stringify(ops, null, 2);\n}\n//#endregion\n//#region src/core/mongo-runner.ts\nconst READ_ONLY_CHECK_COMMAND_KINDS = /* @__PURE__ */ new Set([\"aggregate\", \"rawAggregate\"]);\nfunction runnerFailure(code, summary, opts) {\n\treturn notOk({\n\t\tcode,\n\t\tsummary,\n\t\t...opts\n\t});\n}\nvar MongoMigrationRunner = class {\n\tdeps;\n\tconstructor(deps) {\n\t\tthis.deps = deps;\n\t}\n\tasync execute(options) {\n\t\tconst { inspectionExecutor, adapter, driver, executeDdl, markerOps } = this.deps;\n\t\tconst operations = deserializeMongoOps(options.plan.operations);\n\t\tconst space = options.plan.spaceId ?? APP_SPACE_ID;\n\t\tconst policyCheck = this.enforcePolicyCompatibility(options.policy, operations);\n\t\tif (policyCheck) return policyCheck;\n\t\tconst existingMarker = await markerOps.readMarker(space);\n\t\tconst markerCheck = this.ensureMarkerCompatibility(existingMarker, options.plan);\n\t\tif (markerCheck) return markerCheck;\n\t\tconst checks = options.executionChecks;\n\t\tconst runPrechecks = checks?.prechecks !== false;\n\t\tconst runPostchecks = checks?.postchecks !== false;\n\t\tconst runIdempotency = checks?.idempotencyChecks !== false;\n\t\tconst filterEvaluator = new FilterEvaluator();\n\t\tlet operationsExecuted = 0;\n\t\tfor (const operation of operations) {\n\t\t\toptions.callbacks?.onOperationStart?.(operation);\n\t\t\ttry {\n\t\t\t\tif (operation.operationClass === \"data\") {\n\t\t\t\t\tconst result = await this.executeDataTransform(operation, adapter, driver, filterEvaluator, runIdempotency, runPrechecks, runPostchecks);\n\t\t\t\t\tif (result.failure) return result.failure;\n\t\t\t\t\tif (result.executed) operationsExecuted += 1;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst ddlOp = operation;\n\t\t\t\tif (runPostchecks && runIdempotency) {\n\t\t\t\t\tif (await this.allChecksSatisfied(ddlOp.postcheck, inspectionExecutor, filterEvaluator)) continue;\n\t\t\t\t}\n\t\t\t\tif (runPrechecks) {\n\t\t\t\t\tif (!await this.evaluateChecks(ddlOp.precheck, inspectionExecutor, filterEvaluator)) return runnerFailure(\"MIGRATION.PRECHECK_FAILED\", `Operation ${operation.id} failed during precheck`, { meta: { operationId: operation.id } });\n\t\t\t\t}\n\t\t\t\tfor (const step of ddlOp.execute) await executeDdl(step.command);\n\t\t\t\tif (runPostchecks) {\n\t\t\t\t\tif (!await this.evaluateChecks(ddlOp.postcheck, inspectionExecutor, filterEvaluator)) return runnerFailure(\"MIGRATION.POSTCHECK_FAILED\", `Operation ${operation.id} failed during postcheck`, { meta: { operationId: operation.id } });\n\t\t\t\t}\n\t\t\t\toperationsExecuted += 1;\n\t\t\t} finally {\n\t\t\t\toptions.callbacks?.onOperationComplete?.(operation);\n\t\t\t}\n\t\t}\n\t\tconst destination = options.plan.destination;\n\t\tconst profileHash = options.destinationContract.profileHash ?? destination.storageHash;\n\t\tconst incomingInvariants = options.plan.providedInvariants ?? [];\n\t\tconst existingInvariantSet = new Set(existingMarker?.invariants ?? []);\n\t\tconst incomingIsSubsetOfExisting = incomingInvariants.every((id) => existingInvariantSet.has(id));\n\t\tconst markerAlreadyAtDestination = existingMarker !== null && existingMarker.storageHash === destination.storageHash && existingMarker.profileHash === profileHash;\n\t\tif (!(operationsExecuted === 0 && markerAlreadyAtDestination && incomingIsSubsetOfExisting)) {\n\t\t\tconst liveSchema = await this.deps.introspectSchema();\n\t\t\tconst rawVerifyResult = verifyMongoSchema({\n\t\t\t\tcontract: options.destinationContract,\n\t\t\t\tschema: liveSchema,\n\t\t\t\tstrict: options.strictVerification ?? true,\n\t\t\t\tframeworkComponents: options.frameworkComponents,\n\t\t\t\t...options.context ? { context: options.context } : {}\n\t\t\t});\n\t\t\tconst verifyResult = options.scopeVerifyResult ? options.scopeVerifyResult(rawVerifyResult) : rawVerifyResult;\n\t\t\tif (!verifyResult.ok) return runnerFailure(\"MIGRATION.SCHEMA_VERIFY_FAILED\", verifyResult.summary, {\n\t\t\t\twhy: \"The resulting database schema does not satisfy the destination contract.\",\n\t\t\t\tmeta: { issues: verifyResult.schema.issues }\n\t\t\t});\n\t\t\tif (existingMarker) {\n\t\t\t\tif (!await markerOps.updateMarker(space, existingMarker.storageHash, {\n\t\t\t\t\tstorageHash: destination.storageHash,\n\t\t\t\t\tprofileHash,\n\t\t\t\t\tinvariants: incomingInvariants\n\t\t\t\t})) return runnerFailure(\"MIGRATION.MARKER_CAS_FAILURE\", \"Marker was modified by another process during migration execution.\", { meta: {\n\t\t\t\t\tspace,\n\t\t\t\t\texpectedStorageHash: existingMarker.storageHash,\n\t\t\t\t\tdestinationStorageHash: destination.storageHash\n\t\t\t\t} });\n\t\t\t} else await markerOps.initMarker(space, {\n\t\t\t\tstorageHash: destination.storageHash,\n\t\t\t\tprofileHash,\n\t\t\t\tinvariants: incomingInvariants\n\t\t\t});\n\t\t\tawait this.recordLedgerEntries(markerOps, space, options);\n\t\t}\n\t\treturn ok({\n\t\t\toperationsPlanned: operations.length,\n\t\t\toperationsExecuted\n\t\t});\n\t}\n\tasync recordLedgerEntries(markerOps, space, options) {\n\t\tconst plan = options.plan;\n\t\tconst edges = options.migrationEdges;\n\t\tconst totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);\n\t\tif (totalEdgeOps !== plan.operations.length) throw new InternalError(`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`);\n\t\tlet offset = 0;\n\t\tfor (const edge of edges) {\n\t\t\tconst edgeOps = plan.operations.slice(offset, offset + edge.operationCount);\n\t\t\toffset += edge.operationCount;\n\t\t\tawait markerOps.writeLedgerEntry(space, {\n\t\t\t\tedgeId: `${edge.from}->${edge.to}`,\n\t\t\t\tfrom: edge.from,\n\t\t\t\tto: edge.to,\n\t\t\t\tmigrationName: edge.dirName,\n\t\t\t\tmigrationHash: edge.migrationHash,\n\t\t\t\toperations: edgeOps\n\t\t\t});\n\t\t}\n\t}\n\tasync executeDataTransform(op, adapter, driver, filterEvaluator, runIdempotency, runPrechecks, runPostchecks) {\n\t\tif (runPostchecks && runIdempotency && op.postcheck.length > 0) {\n\t\t\tif (await this.evaluateDataTransformChecks(op.postcheck, adapter, driver, filterEvaluator)) return { executed: false };\n\t\t}\n\t\tif (runPrechecks && op.precheck.length > 0) {\n\t\t\tif (!await this.evaluateDataTransformChecks(op.precheck, adapter, driver, filterEvaluator)) return {\n\t\t\t\texecuted: false,\n\t\t\t\tfailure: runnerFailure(\"MIGRATION.PRECHECK_FAILED\", `Operation ${op.id} failed during precheck`, { meta: {\n\t\t\t\t\toperationId: op.id,\n\t\t\t\t\tname: op.name\n\t\t\t\t} })\n\t\t\t};\n\t\t}\n\t\tfor (const plan of op.run) {\n\t\t\tconst wireCommand = await adapter.lower(plan, {});\n\t\t\tfor await (const _ of driver.execute(wireCommand));\n\t\t}\n\t\tif (runPostchecks && op.postcheck.length > 0) {\n\t\t\tif (!await this.evaluateDataTransformChecks(op.postcheck, adapter, driver, filterEvaluator)) return {\n\t\t\t\texecuted: false,\n\t\t\t\tfailure: runnerFailure(\"MIGRATION.POSTCHECK_FAILED\", `Operation ${op.id} failed during postcheck`, { meta: {\n\t\t\t\t\toperationId: op.id,\n\t\t\t\t\tname: op.name\n\t\t\t\t} })\n\t\t\t};\n\t\t}\n\t\treturn { executed: true };\n\t}\n\tasync evaluateDataTransformChecks(checks, adapter, driver, filterEvaluator) {\n\t\tfor (const check of checks) {\n\t\t\tconst commandKind = check.source.command.kind;\n\t\t\tif (!READ_ONLY_CHECK_COMMAND_KINDS.has(commandKind)) throw errorRunnerFailed(`Data-transform check rejected: command kind \"${commandKind}\" is not read-only`, {\n\t\t\t\twhy: \"Data-transform checks must use aggregate or rawAggregate commands so the pre/postcheck path cannot mutate the database.\",\n\t\t\t\tfix: \"Author the check.source as an aggregate pipeline (or rawAggregate) rather than a DML write command.\",\n\t\t\t\tmeta: {\n\t\t\t\t\tcheckDescription: check.description,\n\t\t\t\t\tcommandKind,\n\t\t\t\t\tcollection: check.source.collection\n\t\t\t\t}\n\t\t\t});\n\t\t\tconst wireCommand = await adapter.lower(check.source, {});\n\t\t\tlet matchFound = false;\n\t\t\tfor await (const row of driver.execute(wireCommand)) if (filterEvaluator.evaluate(check.filter, row)) {\n\t\t\t\tmatchFound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!(check.expect === \"exists\" ? matchFound : !matchFound)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tasync evaluateChecks(checks, inspectionExecutor, filterEvaluator) {\n\t\tfor (const check of checks) {\n\t\t\tconst matchFound = (await check.source.accept(inspectionExecutor)).some((doc) => filterEvaluator.evaluate(check.filter, doc));\n\t\t\tif (!(check.expect === \"exists\" ? matchFound : !matchFound)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tasync allChecksSatisfied(checks, inspectionExecutor, filterEvaluator) {\n\t\tif (checks.length === 0) return false;\n\t\treturn this.evaluateChecks(checks, inspectionExecutor, filterEvaluator);\n\t}\n\tenforcePolicyCompatibility(policy, operations) {\n\t\tconst allowedClasses = new Set(policy.allowedOperationClasses);\n\t\tfor (const operation of operations) if (!allowedClasses.has(operation.operationClass)) return runnerFailure(\"MIGRATION.POLICY_VIOLATION\", `Operation ${operation.id} has class \"${operation.operationClass}\" which is not allowed by policy.`, {\n\t\t\twhy: `Policy only allows: ${[...allowedClasses].join(\", \")}.`,\n\t\t\tmeta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\toperationClass: operation.operationClass\n\t\t\t}\n\t\t});\n\t}\n\tensureMarkerCompatibility(marker, plan) {\n\t\tconst origin = plan.origin ?? null;\n\t\tif (!origin) return;\n\t\tif (!marker) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });\n\t\tif (marker.storageHash !== origin.storageHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {\n\t\t\tmarkerStorageHash: marker.storageHash,\n\t\t\texpectedOriginStorageHash: origin.storageHash\n\t\t} });\n\t}\n};\n//#endregion\n//#region src/core/mongo-target-database.ts\n/**\n* Mongo target `Namespace` concretion. In Mongo the \"namespace\" concept\n* binds to the connection's `db` field — a `MongoTargetDatabase` instance\n* names the database the collections live under. `entries['collection']`\n* holds collection IR. The unbound singleton (below) is the late-bound\n* namespace whose binding the connection's `db` resolves at runtime rather\n* than at authoring time.\n*\n* Qualifier emission is the rendering seam: query / DDL emission asks the\n* namespace for its qualifier (e.g. `\"<db>.<collection>\"`) and consumes\n* the result polymorphically. The unbound singleton overrides these\n* methods to elide the prefix entirely — call sites stay polymorphic and\n* never branch on `id === UNBOUND_NAMESPACE_ID`.\n*/\nvar MongoTargetDatabase = class extends NamespaceBase {\n\tid;\n\tentries;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.id = input.id;\n\t\tconst rawEntries = {\n\t\t\tcollection: {},\n\t\t\t...input.entries\n\t\t};\n\t\tthis.entries = Object.freeze(blindCast(hydrateNamespaceEntities(rawEntries, composeMongoEntityKinds(), \"carry\")));\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: \"database\",\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true\n\t\t});\n\t\tfreezeNode(this);\n\t}\n\tget collection() {\n\t\treturn this.entries.collection ?? Object.freeze({});\n\t}\n\t/**\n\t* The bare qualifier as it would appear in a rendered string. The\n\t* unbound-database singleton overrides this to return `''`.\n\t*/\n\tqualifier() {\n\t\treturn this.id;\n\t}\n\t/**\n\t* Qualify a collection name with the database prefix. The\n\t* unbound-database singleton overrides this to emit just the\n\t* collection name. Used by emission/introspection paths that need a\n\t* fully-qualified reference.\n\t*/\n\tqualifyCollection(collectionName) {\n\t\treturn `${this.id}.${collectionName}`;\n\t}\n};\n/**\n* Singleton subclass for the reserved sentinel namespace id\n* (`UNBOUND_NAMESPACE_ID`) — the late-bound namespace whose binding the\n* connection's `db` resolves at runtime. Overrides qualifier emission\n* to elide the database prefix; call sites that consume `qualifier()`\n* / `qualifyCollection()` get unqualified output without branching on\n* the namespace id.\n*\n* This is the target-side materialization of \"the framework provides\n* affordances; targets implement specifics\": the framework names the\n* sentinel; Mongo decides what late-bound means here (the collection\n* name, naked — the database is supplied by the live connection).\n*/\nvar MongoTargetUnboundDatabase = class MongoTargetUnboundDatabase extends MongoTargetDatabase {\n\tstatic instance = new MongoTargetUnboundDatabase();\n\tconstructor() {\n\t\tsuper({ id: UNBOUND_NAMESPACE_ID });\n\t}\n\tqualifier() {\n\t\treturn \"\";\n\t}\n\tqualifyCollection(collectionName) {\n\t\treturn collectionName;\n\t}\n};\n//#endregion\n//#region src/core/mongo-target-contract-serializer.ts\nvar MongoTargetContractSerializer = class extends MongoContractSerializerBase {\n\tconstructTargetContract(validated) {\n\t\tconst { storage, ...rest } = validated;\n\t\tconst namespaces = Object.fromEntries(Object.entries(storage.namespaces).map(([nsId, nsData]) => {\n\t\t\tconst collectionCount = Object.keys(nsData.entries.collection ?? {}).length;\n\t\t\tconst valueSetCount = Object.keys(nsData.entries[\"valueSet\"] ?? {}).length;\n\t\t\tif (nsId === UNBOUND_NAMESPACE_ID && collectionCount === 0 && valueSetCount === 0) return [nsId, MongoTargetUnboundDatabase.instance];\n\t\t\tconst dbInput = { id: nsData.id };\n\t\t\tif (nsData.entries[\"collection\"] !== void 0 || nsData.entries[\"valueSet\"] !== void 0) dbInput.entries = {\n\t\t\t\tcollection: blindCast(nsData.entries[\"collection\"] ?? {}),\n\t\t\t\t...ifDefined(\"valueSet\", blindCast(nsData.entries[\"valueSet\"]))\n\t\t\t};\n\t\t\treturn [nsId, new MongoTargetDatabase(dbInput)];\n\t\t}));\n\t\tconst targetStorage = new MongoStorage({\n\t\t\tstorageHash: storage.storageHash,\n\t\t\tnamespaces\n\t\t});\n\t\treturn {\n\t\t\t...rest,\n\t\t\tstorage: targetStorage\n\t\t};\n\t}\n\tserializeContract(contract) {\n\t\tconst { storage, ...rest } = contract;\n\t\tconst namespacesJson = {};\n\t\tfor (const [nsId, ns] of Object.entries(storage.namespaces)) {\n\t\t\tconst collectionsOut = {};\n\t\t\tfor (const [collName, coll] of Object.entries(ns.entries.collection ?? {})) collectionsOut[collName] = JSON.parse(JSON.stringify(coll));\n\t\t\tconst valueSetOut = {};\n\t\t\tfor (const [vsName, vs] of Object.entries(ns.entries.valueSet ?? {})) valueSetOut[vsName] = blindCast(JSON.parse(JSON.stringify(vs)));\n\t\t\tnamespacesJson[nsId] = {\n\t\t\t\tid: ns.id,\n\t\t\t\tkind: \"mongo-database\",\n\t\t\t\tentries: {\n\t\t\t\t\tcollection: collectionsOut,\n\t\t\t\t\t...ifDefined(\"valueSet\", Object.keys(valueSetOut).length > 0 ? valueSetOut : void 0)\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\treturn blindCast({\n\t\t\t...rest,\n\t\t\tstorage: {\n\t\t\t\tstorageHash: String(storage.storageHash),\n\t\t\t\tnamespaces: namespacesJson\n\t\t\t}\n\t\t});\n\t}\n};\n//#endregion\n//#region src/core/mongo-target-schema-verifier.ts\n/**\n* Mongo target `SchemaVerifier` concretion. Extends the family base's\n* namespace-walk scaffolding and contributes the per-namespace diff via\n* `verifyNamespace`; the diff body reuses the existing target-side\n* helpers (`contractToMongoSchemaIR`, `canonicalizeSchemasForVerification`,\n* `diffMongoSchemas`) so production verification behaviour is unchanged.\n*\n* Today's invariant: every Mongo contract carries exactly one\n* namespace (the unbound singleton, materialised as\n* `MongoTargetUnboundDatabase`), so the family-base namespace walk\n* dispatches exactly once and the per-namespace body runs the existing\n* whole-schema diff. Future per-collection namespace assignment will\n* have this hook project the diff to the namespace's owned collections.\n*\n* `verifyTargetExtensions` returns the empty list — Mongo has no\n* target-only kinds today.\n*\n* Strict diff mode is `false` for SPI-routed calls; production\n* verification today still goes through `verifyMongoSchema` which\n* receives strict from the CLI.\n*/\nvar MongoTargetSchemaVerifier = class extends MongoSchemaVerifierBase {\n\tverifyNamespace(options) {\n\t\tconst expectedIR = contractToMongoSchemaIR(options.contract);\n\t\tconst { live, expected } = canonicalizeSchemasForVerification(options.schema, expectedIR);\n\t\tconst collectionControlPolicy = (name) => this.collectionControlPolicyForName(options.contract, name);\n\t\tconst { failures, warnings } = diffMongoSchemas(live, expected, false, collectionControlPolicy);\n\t\treturn [...failures, ...warnings];\n\t}\n\tverifyTargetExtensions(_options) {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/core/scope-verify-result.ts\n/**\n* The bare entity names the given contracts declare, unioned. The Mongo runner\n* asks this of every OTHER contract space in a multi-space apply, so each\n* space's post-apply verify can drop the extras those siblings claim.\n*/\nfunction entityNamesDeclaredBy(contracts) {\n\tconst owned = /* @__PURE__ */ new Set();\n\tfor (const contract of contracts) for (const { entityName } of elementCoordinates(contract.storage)) owned.add(entityName);\n\treturn owned;\n}\n/**\n* True when an issue reports a whole collection present in the database but\n* declared by no contract (an extra) — its path is exactly the collection\n* name, never a deeper index/validator/options auxiliary.\n*/\nfunction extraCollectionName(issue) {\n\tif (issueOutcome(issue) !== \"not-expected\" || issue.path.length !== 1) return void 0;\n\treturn issue.path[0];\n}\n/**\n* Scope a per-space post-apply verify result to the contract space's own\n* elements: drop the `extra` findings for collections another contract space\n* claims. The runner verifies the destination contract against the full live\n* database, which holds sibling spaces' collections — without the scoping a\n* multi-space apply could never pass strict verify. Extras claimed by NO space\n* survive, so genuine drift still fails the runner's verdict.\n*\n* The result is issue-based, so the verdict recomputes directly from the\n* surviving list: `ok` holds exactly when it is empty.\n*/\nfunction scopeVerifyResultToSpace(result, ownedByOtherSpaces) {\n\tif (ownedByOtherSpaces.size === 0) return result;\n\tconst issues = result.schema.issues.filter((issue) => {\n\t\tconst name = extraCollectionName(issue);\n\t\treturn name === void 0 || !ownedByOtherSpaces.has(name);\n\t});\n\tif (issues.length === result.schema.issues.length) return result;\n\tconst ok = issues.length === 0;\n\tconst { code: staleCode, ...envelope } = result;\n\treturn {\n\t\t...envelope,\n\t\tok,\n\t\t...ok ? {} : { code: result.code ?? \"CONTRACT.MARKER_REQUIRED\" },\n\t\tsummary: ok ? \"Database schema satisfies contract\" : result.summary,\n\t\tschema: {\n\t\t\t...result.schema,\n\t\t\tissues\n\t\t}\n\t};\n}\n//#endregion\n//#region src/core/control-target.ts\n/**\n* `migration.ts` default-exports a `Migration` subclass whose `operations`\n* getter returns the ordered list of operations and whose `describe()`\n* returns the manifest identity metadata. `MongoMigrationPlanner.plan()`\n* returns a `MigrationPlanWithAuthoringSurface` that knows how to render\n* itself back to such a file; `MongoMigrationPlanner.emptyMigration()`\n* returns the same shape for `migration new`. Users run the scaffolded\n* `migration.ts` directly (via `node migration.ts`) to self-emit\n* `ops.json` and attest the `migrationHash`.\n*/\nconst mongoTargetDescriptor = {\n\t...mongoTargetDescriptorMeta,\n\tcontractSerializer: new MongoTargetContractSerializer(),\n\tschemaVerifier: new MongoTargetSchemaVerifier(),\n\tmigrations: {\n\t\tcreatePlanner(_adapter) {\n\t\t\treturn new MongoMigrationPlanner();\n\t\t},\n\t\tcreateRunner(family) {\n\t\t\tlet cachedDeps;\n\t\t\tconst runMongo = async (driver, runnerOptions) => {\n\t\t\t\tcachedDeps ??= createMongoRunnerDeps(driver, MongoDriverImpl.fromDb(extractDb(driver)), family);\n\t\t\t\treturn new MongoMigrationRunner(cachedDeps).execute({\n\t\t\t\t\t...runnerOptions,\n\t\t\t\t\tdestinationContract: blindCast(runnerOptions.destinationContract)\n\t\t\t\t});\n\t\t\t};\n\t\t\treturn { async execute({ driver, perSpaceOptions }) {\n\t\t\t\tconst contracts = perSpaceOptions.map((opts) => blindCast(opts.destinationContract));\n\t\t\t\tconst perSpaceResults = [];\n\t\t\t\tfor (let i = 0; i < perSpaceOptions.length; i++) {\n\t\t\t\t\tconst spaceOptions = perSpaceOptions[i];\n\t\t\t\t\tif (!spaceOptions) continue;\n\t\t\t\t\tconst ownedByOtherSpaces = entityNamesDeclaredBy(contracts.filter((_, j) => j !== i));\n\t\t\t\t\tconst scopeVerifyResult = (result) => scopeVerifyResultToSpace(result, ownedByOtherSpaces);\n\t\t\t\t\tconst { space, ...runnerOptions } = spaceOptions;\n\t\t\t\t\tconst result = await runMongo(driver, {\n\t\t\t\t\t\t...runnerOptions,\n\t\t\t\t\t\tscopeVerifyResult\n\t\t\t\t\t});\n\t\t\t\t\tif (!result.ok) return notOk({\n\t\t\t\t\t\t...result.failure,\n\t\t\t\t\t\tfailingSpace: space\n\t\t\t\t\t});\n\t\t\t\t\tperSpaceResults.push({\n\t\t\t\t\t\tspace,\n\t\t\t\t\t\tvalue: result.value\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn ok({ perSpaceResults });\n\t\t\t} };\n\t\t},\n\t\tcontractToSchema(contract) {\n\t\t\treturn contractToMongoSchemaIR(blindCast(contract));\n\t\t}\n\t},\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"mongo\",\n\t\t\ttargetId: \"mongo\"\n\t\t};\n\t}\n};\n//#endregion\nexport { CollModCall, CreateCollectionCall, CreateIndexCall, DropCollectionCall, DropIndexCall, FilterEvaluator, MongoMigrationPlanner, MongoMigrationRunner, MongoTargetContractSerializer, MongoTargetDatabase, MongoTargetSchemaVerifier, MongoTargetUnboundDatabase, PlannerProducedMongoMigration, deserializeMongoOp, deserializeMongoOps, mongoTargetDescriptor, renderCallsToTypeScript, renderOps, schemaCollectionToCreateCollectionOptions, schemaIndexToCreateIndexOptions, serializeMongoOps };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,0BAA0B;AAChC,IAAI,oBAAoB,cAAc,aAAa;CAClD,qBAAqB;EACpB,OAAO,CAAC;GACP,iBAAiB;GACjB,QAAQ,KAAK;EACd,CAAC;CACF;CACA,SAAS;EACR,OAAO,OAAO,IAAI;CACnB;AACD;AACA,SAAS,WAAW,MAAM;CACzB,OAAO,KAAK,KAAK,MAAM,GAAG,EAAE,MAAM,GAAG,EAAE,WAAW,CAAC,CAAC,KAAK,IAAI;AAC9D;AACA,IAAI,kBAAkB,cAAc,kBAAkB;CACrD,cAAc;CACd,iBAAiB;CACjB;CACA;CACA;CACA;CACA,YAAY,YAAY,MAAM,SAAS;EACtC,MAAM;EACN,KAAK,aAAa;EAClB,KAAK,OAAO;EACZ,KAAK,UAAU;EACf,KAAK,QAAQ,mBAAmB,WAAW,IAAI,WAAW,IAAI,EAAE;EAChE,KAAK,OAAO;CACb;CACA,OAAO;EACN,OAAO,YAAY,KAAK,YAAY,KAAK,MAAM,KAAK,OAAO;CAC5D;CACA,mBAAmB;EAClB,OAAO,KAAK,UAAU,eAAe,eAAe,KAAK,UAAU,EAAE,IAAI,eAAe,KAAK,IAAI,EAAE,IAAI,eAAe,KAAK,OAAO,EAAE,KAAK,eAA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;GAC9B,EAAE;EACH;EACA,iBAAiB,UAAU;GAC1B,OAAO,wBAAwB,UAAU,QAAQ,CAAC;EACnD;CACD;CACA,SAAS;EACR,OAAO;GACN,UAAU;GACV,UAAU;EACX;CACD;AACD"}
package/dist/driver.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as MongoDriverImpl, r as createMongoDriver } from "./mongo-driver-avj3tZIq-B_9jX0Ps.mjs";
1
+ import { n as MongoDriverImpl, r as createMongoDriver } from "./mongo-driver-D7h_OJw6-JzI2ZAxd.mjs";
2
2
  export { MongoDriverImpl, createMongoDriver };
@@ -1,4 +1,4 @@
1
- import { n as MongoDriverImpl, t as DRIVER_INFO } from "./mongo-driver-avj3tZIq-B_9jX0Ps.mjs";
1
+ import { n as MongoDriverImpl, t as DRIVER_INFO } from "./mongo-driver-D7h_OJw6-JzI2ZAxd.mjs";
2
2
  import { MongoClient } from "mongodb";
3
3
  import { errorRuntime } from "@prisma/orm-framework/errors/execution";
4
4
  import { redactDatabaseUrl } from "@prisma/orm-framework/utils/redact-db-url";
@@ -1 +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-avj3tZIq.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"}
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-D7h_OJw6.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"}
@@ -1,9 +1,9 @@
1
1
  import { assertNever } from "@prisma/orm-framework/utils/internal-error";
2
2
  import { MongoClient } from "mongodb";
3
- //#region ../../../3-mongo-target/3-mongo-driver/dist/mongo-driver-avj3tZIq.mjs
3
+ //#region ../../../3-mongo-target/3-mongo-driver/dist/mongo-driver-D7h_OJw6.mjs
4
4
  const DRIVER_INFO = {
5
5
  name: "Prisma",
6
- version: "0.17.0-dev.2"
6
+ version: "0.17.0-dev.3"
7
7
  };
8
8
  /* v8 ignore start */
9
9
  function unreachableKind(value) {
@@ -158,4 +158,4 @@ async function createMongoDriver(uri, dbName) {
158
158
  //#endregion
159
159
  export { MongoDriverImpl as n, createMongoDriver as r, DRIVER_INFO as t };
160
160
 
161
- //# sourceMappingURL=mongo-driver-avj3tZIq-B_9jX0Ps.mjs.map
161
+ //# sourceMappingURL=mongo-driver-D7h_OJw6-JzI2ZAxd.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mongo-driver-avj3tZIq-B_9jX0Ps.mjs","names":[],"sources":["../../../../3-mongo-target/3-mongo-driver/dist/mongo-driver-avj3tZIq.mjs"],"sourcesContent":["import { assertNever } from \"@internal/utils/internal-error\";\nimport { MongoClient } from \"mongodb\";\n//#endregion\n//#region src/core/driver-info.ts\nconst DRIVER_INFO = {\n\tname: \"Prisma\",\n\tversion: \"0.17.0-dev.2\"\n};\n//#endregion\n//#region src/mongo-driver.ts\n/* v8 ignore start */\nfunction unreachableKind(value) {\n\tconst candidate = value;\n\tif (typeof candidate === \"object\" && candidate !== null && \"kind\" in candidate && typeof candidate.kind === \"string\") return candidate.kind;\n\treturn \"unknown\";\n}\n/* v8 ignore stop */\nvar MongoDriverImpl = class MongoDriverImpl {\n\tdb;\n\tclient;\n\tconstructor(db, client) {\n\t\tthis.db = db;\n\t\tthis.client = client;\n\t}\n\tstatic async fromConnection(uri, dbName) {\n\t\tconst client = new MongoClient(uri, { driverInfo: DRIVER_INFO });\n\t\tawait client.connect();\n\t\treturn new MongoDriverImpl(client.db(dbName), client);\n\t}\n\tstatic fromDb(db) {\n\t\treturn new MongoDriverImpl(db, void 0);\n\t}\n\texecute(wireCommand) {\n\t\tswitch (wireCommand.kind) {\n\t\t\tcase \"insertOne\": return this.executeInsertOneCommand(wireCommand);\n\t\t\tcase \"updateOne\": return this.executeUpdateOneCommand(wireCommand);\n\t\t\tcase \"insertMany\": return this.executeInsertManyCommand(wireCommand);\n\t\t\tcase \"updateMany\": return this.executeUpdateManyCommand(wireCommand);\n\t\t\tcase \"deleteOne\": return this.executeDeleteOneCommand(wireCommand);\n\t\t\tcase \"deleteMany\": return this.executeDeleteManyCommand(wireCommand);\n\t\t\tcase \"findOneAndUpdate\": return this.executeFindOneAndUpdateCommand(wireCommand);\n\t\t\tcase \"findOneAndDelete\": return this.executeFindOneAndDeleteCommand(wireCommand);\n\t\t\tcase \"aggregate\": return this.executeAggregateCommand(wireCommand);\n\t\t\t// v8 ignore next 4\n\t\t\tdefault: return assertNever(wireCommand, `Unknown wire command kind: ${unreachableKind(wireCommand)}`);\n\t\t}\n\t}\n\tasync run(wireCommand) {\n\t\tswitch (wireCommand.kind) {\n\t\t\tcase \"createCollection\": return this.executeCreateCollectionCommand(wireCommand);\n\t\t\tcase \"createIndex\": return this.executeCreateIndexCommand(wireCommand);\n\t\t\tcase \"dropCollection\": return this.executeDropCollectionCommand(wireCommand);\n\t\t\tcase \"dropIndex\": return this.executeDropIndexCommand(wireCommand);\n\t\t\tcase \"collMod\": return this.executeCollModCommand(wireCommand);\n\t\t\t// v8 ignore next 4\n\t\t\tdefault: return assertNever(wireCommand, `Unknown DDL wire command kind: ${unreachableKind(wireCommand)}`);\n\t\t}\n\t}\n\tasync close() {\n\t\tawait this.client?.close();\n\t}\n\tasync *executeInsertOneCommand(cmd) {\n\t\tyield { insertedId: (await this.db.collection(cmd.collection).insertOne(cmd.document)).insertedId };\n\t}\n\tasync *executeUpdateOneCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).updateOne(cmd.filter, cmd.update, { upsert: cmd.upsert });\n\t\tyield {\n\t\t\tmatchedCount: result.matchedCount,\n\t\t\tmodifiedCount: result.modifiedCount,\n\t\t\tupsertedCount: result.upsertedCount,\n\t\t\tupsertedId: result.upsertedId ?? void 0\n\t\t};\n\t}\n\tasync *executeInsertManyCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).insertMany(cmd.documents);\n\t\tyield {\n\t\t\tinsertedIds: Object.values(result.insertedIds),\n\t\t\tinsertedCount: result.insertedCount\n\t\t};\n\t}\n\tasync *executeUpdateManyCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).updateMany(cmd.filter, cmd.update, { upsert: cmd.upsert });\n\t\tyield {\n\t\t\tmatchedCount: result.matchedCount,\n\t\t\tmodifiedCount: result.modifiedCount,\n\t\t\tupsertedCount: result.upsertedCount,\n\t\t\tupsertedId: result.upsertedId ?? void 0\n\t\t};\n\t}\n\tasync *executeDeleteOneCommand(cmd) {\n\t\tyield { deletedCount: (await this.db.collection(cmd.collection).deleteOne(cmd.filter)).deletedCount };\n\t}\n\tasync *executeDeleteManyCommand(cmd) {\n\t\tyield { deletedCount: (await this.db.collection(cmd.collection).deleteMany(cmd.filter)).deletedCount };\n\t}\n\tasync *executeFindOneAndUpdateCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).findOneAndUpdate(cmd.filter, cmd.update, {\n\t\t\tupsert: cmd.upsert,\n\t\t\t...cmd.returnDocument != null ? { returnDocument: cmd.returnDocument } : {},\n\t\t\t...cmd.sort != null ? { sort: cmd.sort } : {}\n\t\t});\n\t\tif (result) yield result;\n\t}\n\tasync *executeFindOneAndDeleteCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).findOneAndDelete(cmd.filter, { ...cmd.sort != null ? { sort: cmd.sort } : {} });\n\t\tif (result) yield result;\n\t}\n\tasync *executeAggregateCommand(cmd) {\n\t\tyield* this.db.collection(cmd.collection).aggregate(cmd.pipeline);\n\t}\n\tasync executeCreateCollectionCommand(cmd) {\n\t\tconst { validator, validationLevel, validationAction, capped, size, max, timeseries, collation, changeStreamPreAndPostImages, clusteredIndex } = cmd;\n\t\tawait this.db.createCollection(cmd.collection, {\n\t\t\t...validator !== void 0 ? { validator } : {},\n\t\t\t...validationLevel !== void 0 ? { validationLevel } : {},\n\t\t\t...validationAction !== void 0 ? { validationAction } : {},\n\t\t\t...capped !== void 0 ? { capped } : {},\n\t\t\t...size !== void 0 ? { size } : {},\n\t\t\t...max !== void 0 ? { max } : {},\n\t\t\t...timeseries !== void 0 ? { timeseries } : {},\n\t\t\t...collation !== void 0 ? { collation } : {},\n\t\t\t...changeStreamPreAndPostImages !== void 0 ? { changeStreamPreAndPostImages } : {},\n\t\t\t...clusteredIndex !== void 0 ? { clusteredIndex } : {}\n\t\t});\n\t}\n\tasync executeCreateIndexCommand(cmd) {\n\t\tconst { unique, sparse, expireAfterSeconds, partialFilterExpression, name, wildcardProjection, collation, weights, default_language, language_override } = cmd;\n\t\tawait this.db.collection(cmd.collection).createIndex(cmd.key, {\n\t\t\t...unique !== void 0 ? { unique } : {},\n\t\t\t...sparse !== void 0 ? { sparse } : {},\n\t\t\t...expireAfterSeconds !== void 0 ? { expireAfterSeconds } : {},\n\t\t\t...partialFilterExpression !== void 0 ? { partialFilterExpression } : {},\n\t\t\t...name !== void 0 ? { name } : {},\n\t\t\t...wildcardProjection !== void 0 ? { wildcardProjection } : {},\n\t\t\t...collation !== void 0 ? { collation } : {},\n\t\t\t...weights !== void 0 ? { weights } : {},\n\t\t\t...default_language !== void 0 ? { default_language } : {},\n\t\t\t...language_override !== void 0 ? { language_override } : {}\n\t\t});\n\t}\n\tasync executeDropCollectionCommand(cmd) {\n\t\tawait this.db.collection(cmd.collection).drop();\n\t}\n\tasync executeDropIndexCommand(cmd) {\n\t\tawait this.db.collection(cmd.collection).dropIndex(cmd.name);\n\t}\n\tasync executeCollModCommand(cmd) {\n\t\tconst { validator, validationLevel, validationAction, changeStreamPreAndPostImages } = cmd;\n\t\tawait this.db.command({\n\t\t\tcollMod: cmd.collection,\n\t\t\t...validator !== void 0 ? { validator } : {},\n\t\t\t...validationLevel !== void 0 ? { validationLevel } : {},\n\t\t\t...validationAction !== void 0 ? { validationAction } : {},\n\t\t\t...changeStreamPreAndPostImages !== void 0 ? { changeStreamPreAndPostImages } : {}\n\t\t});\n\t}\n};\nasync function createMongoDriver(uri, dbName) {\n\treturn MongoDriverImpl.fromConnection(uri, dbName);\n}\n//#endregion\nexport { createMongoDriver as n, DRIVER_INFO as r, MongoDriverImpl as t };\n\n//# sourceMappingURL=mongo-driver-avj3tZIq.mjs.map"],"mappings":";;;AAIA,MAAM,cAAc;CACnB,MAAM;CACN,SAAS;AACV;;AAIA,SAAS,gBAAgB,OAAO;CAC/B,MAAM,YAAY;CAClB,IAAI,OAAO,cAAc,YAAY,cAAc,QAAQ,UAAU,aAAa,OAAO,UAAU,SAAS,UAAU,OAAO,UAAU;CACvI,OAAO;AACR;;AAEA,IAAI,kBAAkB,MAAM,gBAAgB;CAC3C;CACA;CACA,YAAY,IAAI,QAAQ;EACvB,KAAK,KAAK;EACV,KAAK,SAAS;CACf;CACA,aAAa,eAAe,KAAK,QAAQ;EACxC,MAAM,SAAS,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I,CAAC;GACzD,GAAG,iCAAiC,KAAK,IAAI,EAAE,6BAA6B,IAAI,CAAC;EAClF,CAAC;CACF;AACD;AACA,eAAe,kBAAkB,KAAK,QAAQ;CAC7C,OAAO,gBAAgB,eAAe,KAAK,MAAM;AAClD"}
1
+ {"version":3,"file":"mongo-driver-D7h_OJw6-JzI2ZAxd.mjs","names":[],"sources":["../../../../3-mongo-target/3-mongo-driver/dist/mongo-driver-D7h_OJw6.mjs"],"sourcesContent":["import { assertNever } from \"@internal/utils/internal-error\";\nimport { MongoClient } from \"mongodb\";\n//#endregion\n//#region src/core/driver-info.ts\nconst DRIVER_INFO = {\n\tname: \"Prisma\",\n\tversion: \"0.17.0-dev.3\"\n};\n//#endregion\n//#region src/mongo-driver.ts\n/* v8 ignore start */\nfunction unreachableKind(value) {\n\tconst candidate = value;\n\tif (typeof candidate === \"object\" && candidate !== null && \"kind\" in candidate && typeof candidate.kind === \"string\") return candidate.kind;\n\treturn \"unknown\";\n}\n/* v8 ignore stop */\nvar MongoDriverImpl = class MongoDriverImpl {\n\tdb;\n\tclient;\n\tconstructor(db, client) {\n\t\tthis.db = db;\n\t\tthis.client = client;\n\t}\n\tstatic async fromConnection(uri, dbName) {\n\t\tconst client = new MongoClient(uri, { driverInfo: DRIVER_INFO });\n\t\tawait client.connect();\n\t\treturn new MongoDriverImpl(client.db(dbName), client);\n\t}\n\tstatic fromDb(db) {\n\t\treturn new MongoDriverImpl(db, void 0);\n\t}\n\texecute(wireCommand) {\n\t\tswitch (wireCommand.kind) {\n\t\t\tcase \"insertOne\": return this.executeInsertOneCommand(wireCommand);\n\t\t\tcase \"updateOne\": return this.executeUpdateOneCommand(wireCommand);\n\t\t\tcase \"insertMany\": return this.executeInsertManyCommand(wireCommand);\n\t\t\tcase \"updateMany\": return this.executeUpdateManyCommand(wireCommand);\n\t\t\tcase \"deleteOne\": return this.executeDeleteOneCommand(wireCommand);\n\t\t\tcase \"deleteMany\": return this.executeDeleteManyCommand(wireCommand);\n\t\t\tcase \"findOneAndUpdate\": return this.executeFindOneAndUpdateCommand(wireCommand);\n\t\t\tcase \"findOneAndDelete\": return this.executeFindOneAndDeleteCommand(wireCommand);\n\t\t\tcase \"aggregate\": return this.executeAggregateCommand(wireCommand);\n\t\t\t// v8 ignore next 4\n\t\t\tdefault: return assertNever(wireCommand, `Unknown wire command kind: ${unreachableKind(wireCommand)}`);\n\t\t}\n\t}\n\tasync run(wireCommand) {\n\t\tswitch (wireCommand.kind) {\n\t\t\tcase \"createCollection\": return this.executeCreateCollectionCommand(wireCommand);\n\t\t\tcase \"createIndex\": return this.executeCreateIndexCommand(wireCommand);\n\t\t\tcase \"dropCollection\": return this.executeDropCollectionCommand(wireCommand);\n\t\t\tcase \"dropIndex\": return this.executeDropIndexCommand(wireCommand);\n\t\t\tcase \"collMod\": return this.executeCollModCommand(wireCommand);\n\t\t\t// v8 ignore next 4\n\t\t\tdefault: return assertNever(wireCommand, `Unknown DDL wire command kind: ${unreachableKind(wireCommand)}`);\n\t\t}\n\t}\n\tasync close() {\n\t\tawait this.client?.close();\n\t}\n\tasync *executeInsertOneCommand(cmd) {\n\t\tyield { insertedId: (await this.db.collection(cmd.collection).insertOne(cmd.document)).insertedId };\n\t}\n\tasync *executeUpdateOneCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).updateOne(cmd.filter, cmd.update, { upsert: cmd.upsert });\n\t\tyield {\n\t\t\tmatchedCount: result.matchedCount,\n\t\t\tmodifiedCount: result.modifiedCount,\n\t\t\tupsertedCount: result.upsertedCount,\n\t\t\tupsertedId: result.upsertedId ?? void 0\n\t\t};\n\t}\n\tasync *executeInsertManyCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).insertMany(cmd.documents);\n\t\tyield {\n\t\t\tinsertedIds: Object.values(result.insertedIds),\n\t\t\tinsertedCount: result.insertedCount\n\t\t};\n\t}\n\tasync *executeUpdateManyCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).updateMany(cmd.filter, cmd.update, { upsert: cmd.upsert });\n\t\tyield {\n\t\t\tmatchedCount: result.matchedCount,\n\t\t\tmodifiedCount: result.modifiedCount,\n\t\t\tupsertedCount: result.upsertedCount,\n\t\t\tupsertedId: result.upsertedId ?? void 0\n\t\t};\n\t}\n\tasync *executeDeleteOneCommand(cmd) {\n\t\tyield { deletedCount: (await this.db.collection(cmd.collection).deleteOne(cmd.filter)).deletedCount };\n\t}\n\tasync *executeDeleteManyCommand(cmd) {\n\t\tyield { deletedCount: (await this.db.collection(cmd.collection).deleteMany(cmd.filter)).deletedCount };\n\t}\n\tasync *executeFindOneAndUpdateCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).findOneAndUpdate(cmd.filter, cmd.update, {\n\t\t\tupsert: cmd.upsert,\n\t\t\t...cmd.returnDocument != null ? { returnDocument: cmd.returnDocument } : {},\n\t\t\t...cmd.sort != null ? { sort: cmd.sort } : {}\n\t\t});\n\t\tif (result) yield result;\n\t}\n\tasync *executeFindOneAndDeleteCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).findOneAndDelete(cmd.filter, { ...cmd.sort != null ? { sort: cmd.sort } : {} });\n\t\tif (result) yield result;\n\t}\n\tasync *executeAggregateCommand(cmd) {\n\t\tyield* this.db.collection(cmd.collection).aggregate(cmd.pipeline);\n\t}\n\tasync executeCreateCollectionCommand(cmd) {\n\t\tconst { validator, validationLevel, validationAction, capped, size, max, timeseries, collation, changeStreamPreAndPostImages, clusteredIndex } = cmd;\n\t\tawait this.db.createCollection(cmd.collection, {\n\t\t\t...validator !== void 0 ? { validator } : {},\n\t\t\t...validationLevel !== void 0 ? { validationLevel } : {},\n\t\t\t...validationAction !== void 0 ? { validationAction } : {},\n\t\t\t...capped !== void 0 ? { capped } : {},\n\t\t\t...size !== void 0 ? { size } : {},\n\t\t\t...max !== void 0 ? { max } : {},\n\t\t\t...timeseries !== void 0 ? { timeseries } : {},\n\t\t\t...collation !== void 0 ? { collation } : {},\n\t\t\t...changeStreamPreAndPostImages !== void 0 ? { changeStreamPreAndPostImages } : {},\n\t\t\t...clusteredIndex !== void 0 ? { clusteredIndex } : {}\n\t\t});\n\t}\n\tasync executeCreateIndexCommand(cmd) {\n\t\tconst { unique, sparse, expireAfterSeconds, partialFilterExpression, name, wildcardProjection, collation, weights, default_language, language_override } = cmd;\n\t\tawait this.db.collection(cmd.collection).createIndex(cmd.key, {\n\t\t\t...unique !== void 0 ? { unique } : {},\n\t\t\t...sparse !== void 0 ? { sparse } : {},\n\t\t\t...expireAfterSeconds !== void 0 ? { expireAfterSeconds } : {},\n\t\t\t...partialFilterExpression !== void 0 ? { partialFilterExpression } : {},\n\t\t\t...name !== void 0 ? { name } : {},\n\t\t\t...wildcardProjection !== void 0 ? { wildcardProjection } : {},\n\t\t\t...collation !== void 0 ? { collation } : {},\n\t\t\t...weights !== void 0 ? { weights } : {},\n\t\t\t...default_language !== void 0 ? { default_language } : {},\n\t\t\t...language_override !== void 0 ? { language_override } : {}\n\t\t});\n\t}\n\tasync executeDropCollectionCommand(cmd) {\n\t\tawait this.db.collection(cmd.collection).drop();\n\t}\n\tasync executeDropIndexCommand(cmd) {\n\t\tawait this.db.collection(cmd.collection).dropIndex(cmd.name);\n\t}\n\tasync executeCollModCommand(cmd) {\n\t\tconst { validator, validationLevel, validationAction, changeStreamPreAndPostImages } = cmd;\n\t\tawait this.db.command({\n\t\t\tcollMod: cmd.collection,\n\t\t\t...validator !== void 0 ? { validator } : {},\n\t\t\t...validationLevel !== void 0 ? { validationLevel } : {},\n\t\t\t...validationAction !== void 0 ? { validationAction } : {},\n\t\t\t...changeStreamPreAndPostImages !== void 0 ? { changeStreamPreAndPostImages } : {}\n\t\t});\n\t}\n};\nasync function createMongoDriver(uri, dbName) {\n\treturn MongoDriverImpl.fromConnection(uri, dbName);\n}\n//#endregion\nexport { createMongoDriver as n, DRIVER_INFO as r, MongoDriverImpl as t };\n\n//# sourceMappingURL=mongo-driver-D7h_OJw6.mjs.map"],"mappings":";;;AAIA,M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AAK,GAAG,WAAW,IAAI,UAAU,CAAC,CAAC,UAAU,IAAI,IAAI;CAC5D;CACA,MAAM,sBAAsB,KAAK;EAChC,MAAM,EAAE,WAAW,iBAAiB,kBAAkB,iCAAiC;EACvF,MAAM,KAAK,GAAG,QAAQ;GACrB,SAAS,IAAI;GACb,GAAG,cAAc,KAAK,IAAI,EAAE,UAAU,IAAI,CAAC;GAC3C,GAAG,oBAAoB,KAAK,IAAI,EAAE,gBAAgB,IAAI,CAAC;GACvD,GAAG,qBAAqB,KAAK,IAAI,EAAE,iBAAiB,IAAI,CAAC;GACzD,GAAG,iCAAiC,KAAK,IAAI,EAAE,6BAA6B,IAAI,CAAC;EAClF,CAAC;CACF;AACD;AACA,eAAe,kBAAkB,KAAK,QAAQ;CAC7C,OAAO,gBAAgB,eAAe,KAAK,MAAM;AAClD"}
package/dist/target.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  import { a as dropCollection, c as validatedCollection, i as dataTransform, n as createCollection, o as dropIndex, r as createIndex, s as setValidation, t as collMod } from "./migration-factories-CCJFG_3e-75oJ8xn2.mjs";
2
- import { _ as renderCallsToTypeScript, a as DropIndexCall, b as schemaIndexToCreateIndexOptions, c as MongoMigrationRunner, d as MongoTargetSchemaVerifier, f as MongoTargetUnboundDatabase, g as mongoTargetDescriptor, h as deserializeMongoOps, i as DropCollectionCall, l as MongoTargetContractSerializer, m as deserializeMongoOp, n as CreateCollectionCall, o as FilterEvaluator, p as PlannerProducedMongoMigration, r as CreateIndexCall, s as MongoMigrationPlanner, t as CollModCall, u as MongoTargetDatabase, v as renderOps, x as serializeMongoOps, y as schemaCollectionToCreateCollectionOptions } from "./control-Dzjwk7cK.mjs";
2
+ import { _ as renderCallsToTypeScript, a as DropIndexCall, b as schemaIndexToCreateIndexOptions, c as MongoMigrationRunner, d as MongoTargetSchemaVerifier, f as MongoTargetUnboundDatabase, g as mongoTargetDescriptor, h as deserializeMongoOps, i as DropCollectionCall, l as MongoTargetContractSerializer, m as deserializeMongoOp, n as CreateCollectionCall, o as FilterEvaluator, p as PlannerProducedMongoMigration, r as CreateIndexCall, s as MongoMigrationPlanner, t as CollModCall, u as MongoTargetDatabase, v as renderOps, x as serializeMongoOps, y as schemaCollectionToCreateCollectionOptions } from "./control-TQcTpB3d.mjs";
3
3
  import { n as MigrationCLI, r as placeholder, t as Migration } from "./migration-C-jfTsGU.mjs";
4
4
  export { CollModCall, CreateCollectionCall, CreateIndexCall, DropCollectionCall, DropIndexCall, FilterEvaluator, Migration, MigrationCLI, MongoMigrationPlanner, MongoMigrationRunner, MongoTargetContractSerializer, MongoTargetDatabase, MongoTargetSchemaVerifier, MongoTargetUnboundDatabase, PlannerProducedMongoMigration, collMod, createCollection, createIndex, dataTransform, deserializeMongoOp, deserializeMongoOps, dropCollection, dropIndex, mongoTargetDescriptor, placeholder, renderCallsToTypeScript, renderOps, schemaCollectionToCreateCollectionOptions, schemaIndexToCreateIndexOptions, serializeMongoOps, setValidation, validatedCollection };
@@ -1,2 +1,2 @@
1
- import { _ as renderCallsToTypeScript, a as DropIndexCall, b as schemaIndexToCreateIndexOptions, c as MongoMigrationRunner, d as MongoTargetSchemaVerifier, f as MongoTargetUnboundDatabase, g as mongoTargetDescriptor, h as deserializeMongoOps, i as DropCollectionCall, l as MongoTargetContractSerializer, m as deserializeMongoOp, n as CreateCollectionCall, o as FilterEvaluator, p as PlannerProducedMongoMigration, r as CreateIndexCall, s as MongoMigrationPlanner, t as CollModCall, u as MongoTargetDatabase, v as renderOps, x as serializeMongoOps, y as schemaCollectionToCreateCollectionOptions } from "./control-Dzjwk7cK.mjs";
1
+ import { _ as renderCallsToTypeScript, a as DropIndexCall, b as schemaIndexToCreateIndexOptions, c as MongoMigrationRunner, d as MongoTargetSchemaVerifier, f as MongoTargetUnboundDatabase, g as mongoTargetDescriptor, h as deserializeMongoOps, i as DropCollectionCall, l as MongoTargetContractSerializer, m as deserializeMongoOp, n as CreateCollectionCall, o as FilterEvaluator, p as PlannerProducedMongoMigration, r as CreateIndexCall, s as MongoMigrationPlanner, t as CollModCall, u as MongoTargetDatabase, v as renderOps, x as serializeMongoOps, y as schemaCollectionToCreateCollectionOptions } from "./control-TQcTpB3d.mjs";
2
2
  export { CollModCall, CreateCollectionCall, CreateIndexCall, DropCollectionCall, DropIndexCall, FilterEvaluator, MongoMigrationPlanner, MongoMigrationRunner, MongoTargetContractSerializer, MongoTargetDatabase, MongoTargetSchemaVerifier, MongoTargetUnboundDatabase, PlannerProducedMongoMigration, deserializeMongoOp, deserializeMongoOps, mongoTargetDescriptor, renderCallsToTypeScript, renderOps, schemaCollectionToCreateCollectionOptions, schemaIndexToCreateIndexOptions, serializeMongoOps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-target-mongo",
3
- "version": "0.17.0-dev.2",
3
+ "version": "0.17.0-dev.3",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -9,18 +9,18 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@prisma/orm-family-mongo": "0.17.0-dev.2",
13
- "@prisma/orm-framework": "0.17.0-dev.2",
14
- "@prisma/orm-toolchain": "0.17.0-dev.2",
12
+ "@prisma/orm-family-mongo": "0.17.0-dev.3",
13
+ "@prisma/orm-framework": "0.17.0-dev.3",
14
+ "@prisma/orm-toolchain": "0.17.0-dev.3",
15
15
  "arktype": "^2.2.2",
16
16
  "bson": "^7.3.1"
17
17
  },
18
18
  "devDependencies": {
19
- "@internal/adapter-mongo": "0.17.0-dev.2",
20
- "@internal/driver-mongo": "0.17.0-dev.2",
21
- "@internal/target-mongo": "0.17.0-dev.2",
22
- "@repo/tsconfig": "0.17.0-dev.2",
23
- "@repo/tsdown": "0.17.0-dev.2",
19
+ "@internal/adapter-mongo": "0.17.0-dev.3",
20
+ "@internal/driver-mongo": "0.17.0-dev.3",
21
+ "@internal/target-mongo": "0.17.0-dev.3",
22
+ "@repo/tsconfig": "0.17.0-dev.3",
23
+ "@repo/tsdown": "0.17.0-dev.3",
24
24
  "tsdown": "0.22.14",
25
25
  "typescript": "5.9.3"
26
26
  },