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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +23 -0
  3. package/dist/adapter.d.mts +19 -0
  4. package/dist/adapter.d.mts.map +1 -0
  5. package/dist/adapter.mjs +12 -0
  6. package/dist/adapter.mjs.map +1 -0
  7. package/dist/adapter__codec-ids.d.mts +12 -0
  8. package/dist/adapter__codec-ids.d.mts.map +1 -0
  9. package/dist/adapter__codec-ids.mjs +2 -0
  10. package/dist/adapter__codec-types.d.mts +38 -0
  11. package/dist/adapter__codec-types.d.mts.map +1 -0
  12. package/dist/adapter__codec-types.mjs +1 -0
  13. package/dist/adapter__codecs.d.mts +14 -0
  14. package/dist/adapter__codecs.d.mts.map +1 -0
  15. package/dist/adapter__codecs.mjs +2 -0
  16. package/dist/adapter__control.d.mts +3 -0
  17. package/dist/adapter__control.mjs +3 -0
  18. package/dist/adapter__runtime.d.mts +16 -0
  19. package/dist/adapter__runtime.d.mts.map +1 -0
  20. package/dist/adapter__runtime.mjs +25 -0
  21. package/dist/adapter__runtime.mjs.map +1 -0
  22. package/dist/codec-ids-BennPcpQ-Btzz3ILV.mjs +12 -0
  23. package/dist/codec-ids-BennPcpQ-Btzz3ILV.mjs.map +1 -0
  24. package/dist/codec-types-Bx2fHyq_.d.mts +35 -0
  25. package/dist/codec-types-Bx2fHyq_.d.mts.map +1 -0
  26. package/dist/codecs-DLWO-Cjc-CWfQj0bY.mjs +170 -0
  27. package/dist/codecs-DLWO-Cjc-CWfQj0bY.mjs.map +1 -0
  28. package/dist/control-BOc5lrQg.mjs +437 -0
  29. package/dist/control-BOc5lrQg.mjs.map +1 -0
  30. package/dist/control-CEXmcht7.mjs +1563 -0
  31. package/dist/control-CEXmcht7.mjs.map +1 -0
  32. package/dist/control-CxXmTy_h.d.mts +312 -0
  33. package/dist/control-CxXmTy_h.d.mts.map +1 -0
  34. package/dist/control-rPM2HNxW.d.mts +170 -0
  35. package/dist/control-rPM2HNxW.d.mts.map +1 -0
  36. package/dist/descriptor-meta-CBiaTwe5-HX742pZh.mjs +17 -0
  37. package/dist/descriptor-meta-CBiaTwe5-HX742pZh.mjs.map +1 -0
  38. package/dist/driver.d.mts +2 -0
  39. package/dist/driver.mjs +2 -0
  40. package/dist/driver__control.d.mts +16 -0
  41. package/dist/driver__control.d.mts.map +1 -0
  42. package/dist/driver__control.mjs +46 -0
  43. package/dist/driver__control.mjs.map +1 -0
  44. package/dist/migration-BkqcE2Uv.d.mts +42 -0
  45. package/dist/migration-BkqcE2Uv.d.mts.map +1 -0
  46. package/dist/migration-C-jfTsGU.mjs +4 -0
  47. package/dist/migration-factories-CCJFG_3e-75oJ8xn2.mjs +201 -0
  48. package/dist/migration-factories-CCJFG_3e-75oJ8xn2.mjs.map +1 -0
  49. package/dist/mongo-adapter-BkVYI6jn-ChXldtpg.mjs +807 -0
  50. package/dist/mongo-adapter-BkVYI6jn-ChXldtpg.mjs.map +1 -0
  51. package/dist/mongo-adapter-CjJU3S9o-BIJruFYW.d.mts +16 -0
  52. package/dist/mongo-adapter-CjJU3S9o-BIJruFYW.d.mts.map +1 -0
  53. package/dist/mongo-driver-C7zThOjZ-BcMrlirh.mjs +161 -0
  54. package/dist/mongo-driver-C7zThOjZ-BcMrlirh.mjs.map +1 -0
  55. package/dist/mongo-driver-D1lEf5Kl-KPfGUVXK.d.mts +33 -0
  56. package/dist/mongo-driver-D1lEf5Kl-KPfGUVXK.d.mts.map +1 -0
  57. package/dist/op-factory-call-B7EKa4Ri-B2Lb6W68.d.mts +76 -0
  58. package/dist/op-factory-call-B7EKa4Ri-B2Lb6W68.d.mts.map +1 -0
  59. package/dist/pack-MK8ZQfrL.d.mts +22 -0
  60. package/dist/pack-MK8ZQfrL.d.mts.map +1 -0
  61. package/dist/runtime-B9_-kjBX.d.mts +15 -0
  62. package/dist/runtime-B9_-kjBX.d.mts.map +1 -0
  63. package/dist/target.d.mts +8 -0
  64. package/dist/target.mjs +4 -0
  65. package/dist/target__codec-types.d.mts +2 -0
  66. package/dist/target__codec-types.mjs +1 -0
  67. package/dist/target__control.d.mts +4 -0
  68. package/dist/target__control.mjs +2 -0
  69. package/dist/target__migration.d.mts +2 -0
  70. package/dist/target__migration.mjs +3 -0
  71. package/dist/target__pack.d.mts +2 -0
  72. package/dist/target__pack.mjs +7 -0
  73. package/dist/target__pack.mjs.map +1 -0
  74. package/dist/target__runtime.d.mts +2 -0
  75. package/dist/target__runtime.mjs +21 -0
  76. package/dist/target__runtime.mjs.map +1 -0
  77. package/package.json +63 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-CEXmcht7.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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AsB,UAAU,QAAQ,GAAG,MAAM,MAAM,CAAC,CAAC;KACpF,MAAM,qBAAqB,WAAW,yBAAyB,QAAQ,kBAAkB;KACzF,MAAM,EAAE,OAAO,GAAG,kBAAkB;KACpC,MAAM,SAAS,MAAM,SAAS,QAAQ;MACrC,GAAG;MACH;KACD,CAAC;KACD,IAAI,CAAC,OAAO,IAAI,OAAO,MAAM;MAC5B,GAAG,OAAO;MACV,cAAc;KACf,CAAC;KACD,gBAAgB,KAAK;MACpB;MACA,OAAO,OAAO;KACf,CAAC;IACF;IACA,OAAO,GAAG,EAAE,gBAAgB,CAAC;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"}
@@ -0,0 +1,312 @@
1
+ import { a as MongoRunnerDependencies } from "./control-rPM2HNxW.mjs";
2
+ import { s as OpFactoryCall$1 } from "./op-factory-call-B7EKa4Ri-B2Lb6W68.mjs";
3
+ import { Namespace, NamespaceBase } from "@prisma/orm-framework/components/ir";
4
+ import { AnyMongoMigrationOperation, MongoAndExpr, MongoExistsExpr, MongoExprFilter, MongoFieldFilter, MongoFilterExpr, MongoFilterVisitor, MongoMigrationPlanOperation, MongoNotExpr, MongoOrExpr } from "@prisma/orm-family-mongo/query-ast/control";
5
+ import { MongoSchemaIR } from "@prisma/orm-family-mongo/schema-ir";
6
+ import { MongoControlTargetDescriptor } from "@prisma/orm-family-mongo/family/control";
7
+ import { Result } from "@prisma/orm-framework/utils/result";
8
+ import { Migration, MigrationMeta } from "@prisma/orm-toolchain/migration-tools/migration";
9
+ import { MigrationOperationPolicy, MigrationPlan, MigrationPlanOperation, MigrationPlanWithAuthoringSurface, MigrationPlanner, MigrationPlannerConflict, MigrationPlannerResult, MigrationRunnerExecutionChecks, MigrationRunnerFailure, MigrationRunnerPerSpaceSuccessValue, MigrationScaffoldContext, OperationContext, SchemaDiffIssue, SchemaVerifyOptions, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
10
+ import { ImportSpecifierResolver } from "@prisma/orm-framework/components/emission";
11
+ import { MongoContractSerializerBase, MongoSchemaVerifierBase } from "@prisma/orm-family-mongo/family/ir";
12
+ import { MongoCollection, MongoCollectionInput, MongoContract, MongoNamespaceEntries, MongoStorage, MongoValueSetInput } from "@prisma/orm-family-mongo/contract";
13
+ import { Contract } from "@prisma/orm-framework/contract/types";
14
+ import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
15
+ import { AggregateMigrationEdgeRef } from "@prisma/orm-toolchain/migration-tools/aggregate";
16
+ import { JsonObject } from "@prisma/orm-framework/utils/json";
17
+ //#region ../../../3-mongo-target/1-mongo-target/dist/control.d.mts
18
+ //#region src/core/mongo-target-contract.d.ts
19
+ /**
20
+ * Mongo target contract envelope: the result of
21
+ * `descriptor.contractSerializer.deserializeContract(json)`.
22
+ *
23
+ * Structurally `MongoContract` with the storage envelope promoted to
24
+ * the family-layer `MongoStorage` class instance — the class carries
25
+ * `namespaces` and gives the rest of the framework a stable surface to
26
+ * reach for. The leaf collection / index shapes inside
27
+ * `storage.collections` are family-layer `MongoCollection` instances.
28
+ */
29
+ type MongoTargetContract = Omit<MongoContract, 'storage'> & {
30
+ readonly storage: MongoStorage;
31
+ };
32
+ //#endregion
33
+ //#region src/core/control-target.d.ts
34
+ /**
35
+ * `migration.ts` default-exports a `Migration` subclass whose `operations`
36
+ * getter returns the ordered list of operations and whose `describe()`
37
+ * returns the manifest identity metadata. `MongoMigrationPlanner.plan()`
38
+ * returns a `MigrationPlanWithAuthoringSurface` that knows how to render
39
+ * itself back to such a file; `MongoMigrationPlanner.emptyMigration()`
40
+ * returns the same shape for `migration new`. Users run the scaffolded
41
+ * `migration.ts` directly (via `node migration.ts`) to self-emit
42
+ * `ops.json` and attest the `migrationHash`.
43
+ */
44
+ declare const mongoTargetDescriptor: MongoControlTargetDescriptor<MongoTargetContract>;
45
+ //#endregion
46
+ //#region src/core/filter-evaluator.d.ts
47
+ declare class FilterEvaluator implements MongoFilterVisitor<boolean> {
48
+ private doc;
49
+ evaluate(filter: MongoFilterExpr, doc: Record<string, unknown>): boolean;
50
+ field(expr: MongoFieldFilter): boolean;
51
+ and(expr: MongoAndExpr): boolean;
52
+ or(expr: MongoOrExpr): boolean;
53
+ not(expr: MongoNotExpr): boolean;
54
+ exists(expr: MongoExistsExpr): boolean;
55
+ expr(_expr: MongoExprFilter): boolean;
56
+ }
57
+ //#endregion
58
+ //#region src/core/mongo-ops-serializer.d.ts
59
+ declare function deserializeMongoOp(json: unknown): AnyMongoMigrationOperation;
60
+ declare function deserializeMongoOps(json: readonly unknown[]): AnyMongoMigrationOperation[];
61
+ declare function serializeMongoOps(ops: readonly AnyMongoMigrationOperation[]): string;
62
+ //#endregion
63
+ //#region src/core/mongo-planner.d.ts
64
+ type PlanCallsResult = {
65
+ readonly kind: 'success';
66
+ readonly calls: OpFactoryCall$1[];
67
+ } | {
68
+ readonly kind: 'failure';
69
+ readonly conflicts: MigrationPlannerConflict[];
70
+ };
71
+ declare class MongoMigrationPlanner implements MigrationPlanner<'mongo', 'mongo'> {
72
+ planCalls(options: {
73
+ readonly contract: unknown;
74
+ readonly schema: unknown;
75
+ readonly policy: MigrationOperationPolicy;
76
+ readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'mongo', 'mongo'>>;
77
+ }): PlanCallsResult;
78
+ plan(options: {
79
+ readonly contract: unknown;
80
+ readonly schema: unknown;
81
+ readonly policy: MigrationOperationPolicy;
82
+ /**
83
+ * The "from" contract (state the planner assumes the database starts at),
84
+ * or `null` for reconciliation flows. Used to populate `describe().from`
85
+ * on the produced plan as `fromContract?.storage.storageHash ?? null`.
86
+ */
87
+ readonly fromContract: Contract | null;
88
+ readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'mongo', 'mongo'>>;
89
+ /**
90
+ * POSIX-relative path from the migration package dir to
91
+ * `migrations/snapshots`, e.g. `'../../snapshots'`. Threaded straight
92
+ * into the produced plan's `renderTypeScript()` metadata.
93
+ */
94
+ readonly snapshotsImportPath: string;
95
+ }): MigrationPlannerResult;
96
+ /**
97
+ * Produce an empty `migration.ts` authoring surface for `migration new`.
98
+ *
99
+ * The "empty migration" is a `PlannerProducedMongoMigration` with no
100
+ * operations; `renderTypeScript()` emits a stub class with the correct
101
+ * `from`/`to` metadata that the user then fills in with operations. The
102
+ * contract path on the context is unused — Mongo's emitted source does
103
+ * not import from the generated contract `.d.ts`.
104
+ */
105
+ emptyMigration(context: MigrationScaffoldContext): MigrationPlanWithAuthoringSurface;
106
+ }
107
+ //#endregion
108
+ //#region src/core/mongo-runner.d.ts
109
+ interface MongoMigrationRunnerExecuteOptions {
110
+ readonly plan: MigrationPlan;
111
+ readonly destinationContract: MongoContract;
112
+ readonly policy: MigrationOperationPolicy;
113
+ readonly callbacks?: {
114
+ onOperationStart?(op: MigrationPlanOperation): void;
115
+ onOperationComplete?(op: MigrationPlanOperation): void;
116
+ };
117
+ readonly executionChecks?: MigrationRunnerExecutionChecks;
118
+ readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'mongo', 'mongo'>>;
119
+ readonly strictVerification?: boolean;
120
+ readonly context?: OperationContext;
121
+ /**
122
+ * Per-space verify-result scope. When set, the runner verifies the
123
+ * destination contract against the **full** introspected schema, then
124
+ * applies this to scope the result to the space the contract claims —
125
+ * dropping the `extra` findings for collections a sibling space owns.
126
+ *
127
+ * The target descriptor's `execute` injects this callback, derived from
128
+ * the sibling spaces in the aggregate. Callers that don't scope leave it
129
+ * unset and verify against the whole introspected schema.
130
+ */
131
+ readonly scopeVerifyResult?: (result: VerifyDatabaseSchemaResult) => VerifyDatabaseSchemaResult;
132
+ /** Per-edge breakdown from graph-walk planning; drives per-edge ledger writes. */
133
+ readonly migrationEdges: readonly AggregateMigrationEdgeRef[];
134
+ }
135
+ type MongoMigrationRunnerResult = Result<MigrationRunnerPerSpaceSuccessValue, MigrationRunnerFailure>;
136
+ declare class MongoMigrationRunner {
137
+ private readonly deps;
138
+ constructor(deps: MongoRunnerDependencies);
139
+ execute(options: MongoMigrationRunnerExecuteOptions): Promise<MongoMigrationRunnerResult>;
140
+ private recordLedgerEntries;
141
+ private executeDataTransform;
142
+ private evaluateDataTransformChecks;
143
+ private evaluateChecks;
144
+ private allChecksSatisfied;
145
+ private enforcePolicyCompatibility;
146
+ private ensureMarkerCompatibility;
147
+ }
148
+ //#endregion
149
+ //#region src/core/mongo-target-contract-serializer.d.ts
150
+ declare class MongoTargetContractSerializer extends MongoContractSerializerBase<MongoTargetContract> {
151
+ protected constructTargetContract(validated: MongoContract): MongoTargetContract;
152
+ serializeContract(contract: MongoTargetContract): JsonObject;
153
+ }
154
+ //#endregion
155
+ //#region src/core/mongo-target-database.d.ts
156
+ interface MongoTargetDatabaseInput {
157
+ readonly id: string;
158
+ readonly entries?: Readonly<Record<string, Readonly<Record<string, unknown>>>> & {
159
+ readonly collection?: Readonly<Record<string, MongoCollectionInput>>;
160
+ readonly valueSet?: Readonly<Record<string, MongoValueSetInput>>;
161
+ };
162
+ }
163
+ /**
164
+ * Mongo target `Namespace` concretion. In Mongo the "namespace" concept
165
+ * binds to the connection's `db` field — a `MongoTargetDatabase` instance
166
+ * names the database the collections live under. `entries['collection']`
167
+ * holds collection IR. The unbound singleton (below) is the late-bound
168
+ * namespace whose binding the connection's `db` resolves at runtime rather
169
+ * than at authoring time.
170
+ *
171
+ * Qualifier emission is the rendering seam: query / DDL emission asks the
172
+ * namespace for its qualifier (e.g. `"<db>.<collection>"`) and consumes
173
+ * the result polymorphically. The unbound singleton overrides these
174
+ * methods to elide the prefix entirely — call sites stay polymorphic and
175
+ * never branch on `id === UNBOUND_NAMESPACE_ID`.
176
+ */
177
+ declare class MongoTargetDatabase extends NamespaceBase {
178
+ readonly kind: string;
179
+ readonly id: string;
180
+ readonly entries: MongoNamespaceEntries;
181
+ constructor(input: MongoTargetDatabaseInput);
182
+ get collection(): Readonly<Record<string, MongoCollection>>;
183
+ /**
184
+ * The bare qualifier as it would appear in a rendered string. The
185
+ * unbound-database singleton overrides this to return `''`.
186
+ */
187
+ qualifier(): string;
188
+ /**
189
+ * Qualify a collection name with the database prefix. The
190
+ * unbound-database singleton overrides this to emit just the
191
+ * collection name. Used by emission/introspection paths that need a
192
+ * fully-qualified reference.
193
+ */
194
+ qualifyCollection(collectionName: string): string;
195
+ }
196
+ /**
197
+ * Singleton subclass for the reserved sentinel namespace id
198
+ * (`UNBOUND_NAMESPACE_ID`) — the late-bound namespace whose binding the
199
+ * connection's `db` resolves at runtime. Overrides qualifier emission
200
+ * to elide the database prefix; call sites that consume `qualifier()`
201
+ * / `qualifyCollection()` get unqualified output without branching on
202
+ * the namespace id.
203
+ *
204
+ * This is the target-side materialization of "the framework provides
205
+ * affordances; targets implement specifics": the framework names the
206
+ * sentinel; Mongo decides what late-bound means here (the collection
207
+ * name, naked — the database is supplied by the live connection).
208
+ */
209
+ declare class MongoTargetUnboundDatabase extends MongoTargetDatabase {
210
+ static readonly instance: MongoTargetUnboundDatabase;
211
+ private constructor();
212
+ qualifier(): string;
213
+ qualifyCollection(collectionName: string): string;
214
+ }
215
+ //#endregion
216
+ //#region src/core/mongo-target-schema-verifier.d.ts
217
+ /**
218
+ * Mongo target `SchemaVerifier` concretion. Extends the family base's
219
+ * namespace-walk scaffolding and contributes the per-namespace diff via
220
+ * `verifyNamespace`; the diff body reuses the existing target-side
221
+ * helpers (`contractToMongoSchemaIR`, `canonicalizeSchemasForVerification`,
222
+ * `diffMongoSchemas`) so production verification behaviour is unchanged.
223
+ *
224
+ * Today's invariant: every Mongo contract carries exactly one
225
+ * namespace (the unbound singleton, materialised as
226
+ * `MongoTargetUnboundDatabase`), so the family-base namespace walk
227
+ * dispatches exactly once and the per-namespace body runs the existing
228
+ * whole-schema diff. Future per-collection namespace assignment will
229
+ * have this hook project the diff to the namespace's owned collections.
230
+ *
231
+ * `verifyTargetExtensions` returns the empty list — Mongo has no
232
+ * target-only kinds today.
233
+ *
234
+ * Strict diff mode is `false` for SPI-routed calls; production
235
+ * verification today still goes through `verifyMongoSchema` which
236
+ * receives strict from the CLI.
237
+ */
238
+ declare class MongoTargetSchemaVerifier extends MongoSchemaVerifierBase<MongoTargetContract, MongoSchemaIR> {
239
+ protected verifyNamespace(options: {
240
+ readonly contract: MongoTargetContract;
241
+ readonly schema: MongoSchemaIR;
242
+ readonly namespaceId: string;
243
+ readonly namespace: Namespace;
244
+ }): readonly SchemaDiffIssue[];
245
+ protected verifyTargetExtensions(_options: SchemaVerifyOptions<MongoTargetContract, MongoSchemaIR>): readonly SchemaDiffIssue[];
246
+ }
247
+ //#endregion
248
+ //#region src/core/planner-produced-migration.d.ts
249
+ /**
250
+ * Planner-produced Mongo migration, returned by `MongoMigrationPlanner.plan(...)`
251
+ * and `MongoMigrationPlanner.emptyMigration(...)`.
252
+ *
253
+ * Unlike user-authored migrations (which extend `MongoMigration` from
254
+ * `@internal/family-mongo`), this class lives inside the target and holds
255
+ * the richer authoring IR (`OpFactoryCall[]`) needed to render itself back to
256
+ * TypeScript source. It implements `MigrationPlanWithAuthoringSurface` so
257
+ * that the CLI can uniformly ask any planner result to serialize itself to a
258
+ * `migration.ts`.
259
+ *
260
+ * It extends the framework `Migration` base directly and declares its own
261
+ * `targetId` rather than inheriting `MongoMigration`, whose added value is
262
+ * the lazily-built contract views a planner result never reads.
263
+ */
264
+ declare class PlannerProducedMongoMigration extends Migration<AnyMongoMigrationOperation> implements MigrationPlanWithAuthoringSurface {
265
+ private readonly calls;
266
+ private readonly meta;
267
+ private readonly snapshotsImportPath;
268
+ readonly targetId: "mongo";
269
+ constructor(calls: readonly OpFactoryCall$1[], meta: MigrationMeta, snapshotsImportPath: string);
270
+ get operations(): readonly AnyMongoMigrationOperation[];
271
+ describe(): MigrationMeta;
272
+ renderTypeScript(resolveImportSpecifier: ImportSpecifierResolver): string;
273
+ }
274
+ //#endregion
275
+ //#region src/core/render-ops.d.ts
276
+ declare function renderOps(calls: ReadonlyArray<OpFactoryCall$1>): MongoMigrationPlanOperation[];
277
+ //#endregion
278
+ //#region src/core/render-typescript.d.ts
279
+ interface RenderMigrationMeta {
280
+ readonly from: string | null;
281
+ readonly to: string;
282
+ /** POSIX-relative path from the migration package dir to `migrations/snapshots`, e.g. '../../snapshots'. */
283
+ readonly snapshotsImportPath: string;
284
+ /**
285
+ * Rewrites the package names the scaffold imports from, for the import root
286
+ * the consuming application installed. Applied once to the assembled
287
+ * requirement list rather than at each `OpFactoryCall`, so a new operation
288
+ * cannot forget it. Defaults to leaving specifiers as authored.
289
+ */
290
+ readonly resolveImportSpecifier?: ImportSpecifierResolver;
291
+ }
292
+ /**
293
+ * Render a list of Mongo `OpFactoryCall`s as a `migration.ts` source string.
294
+ * The result is shebanged, imports the contract JSON from the shared
295
+ * snapshot store (the destination contract, plus the source contract for a
296
+ * non-baseline migration), extends `Migration<Start, End>` (or
297
+ * `Migration<never, End>` for a baseline) from
298
+ * `@internal/target-mongo/migration`,
299
+ * assigns the JSON to `endContractJson` / `startContractJson`, and implements
300
+ * `operations`. The `Migration` base derives `describe()` from those fields.
301
+ *
302
+ * The walk is polymorphic: each call node contributes its own
303
+ * `renderTypeScript()` expression and declares its own `importRequirements()`.
304
+ * The top-level renderer aggregates imports across all nodes and emits one
305
+ * `import { … } from "…"` line per module. The `Migration` / `MigrationCLI`
306
+ * base imports and the contract-JSON imports are always emitted, independent
307
+ * of the call nodes.
308
+ */
309
+ declare function renderCallsToTypeScript(calls: ReadonlyArray<OpFactoryCall$1>, meta: RenderMigrationMeta): string;
310
+ //#endregion
311
+ export { renderOps as _, MongoTargetContract as a, MongoTargetSchemaVerifier as c, PlannerProducedMongoMigration as d, RenderMigrationMeta as f, renderCallsToTypeScript as g, mongoTargetDescriptor as h, MongoMigrationRunnerExecuteOptions as i, MongoTargetUnboundDatabase as l, deserializeMongoOps as m, MongoMigrationPlanner as n, MongoTargetContractSerializer as o, deserializeMongoOp as p, MongoMigrationRunner as r, MongoTargetDatabase as s, FilterEvaluator as t, PlanCallsResult as u, serializeMongoOps as v };
312
+ //# sourceMappingURL=control-CxXmTy_h.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-CxXmTy_h.d.mts","names":[],"sources":["../../../../3-mongo-target/1-mongo-target/dist/control.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BK,sBAAsB,KAAK;WACrB,SAAS;;;;;;;;;;;;;;cAcN,uBAAuB,6BAA6B;;;cAGpD,2BAA2B;UAC/B;EACR,SAAS,QAAQ,iBAAiB,KAAK;EACvC,MAAM,MAAM;EACZ,IAAI,MAAM;EACV,GAAG,MAAM;EACT,IAAI,MAAM;EACV,OAAO,MAAM;EACb,KAAK,OAAO;;;;iBAIG,mBAAmB,gBAAgB;iBACnC,oBAAoB,2BAA2B;iBAC/C,kBAAkB,cAAc;;;KAG5C;WACM;WACA,OAAO;;WAEP;WACA,WAAW;;cAER,iCAAiC;EAC7C,UAAU;aACC;aACA;aACA,QAAQ;aACR,qBAAqB,cAAc;MAC1C;EACJ,KAAK;aACM;aACA;aACA,QAAQ;;;;;;aAMR,cAAc;aACd,qBAAqB,cAAc;;;;;;aAMnC;MACP;;;;;;;;;;EAUJ,eAAe,SAAS,2BAA2B;;;;UAI3C;WACC,MAAM;WACN,qBAAqB;WACrB,QAAQ;WACR;IACP,kBAAkB,IAAI;IACtB,qBAAqB,IAAI;;WAElB,kBAAkB;WAClB,qBAAqB,cAAc;WACnC;WACA,UAAU;;;;;;;;;;;WAWV,qBAAqB,QAAQ,+BAA+B;;WAE5D,yBAAyB;;KAE/B,6BAA6B,OAAO,qCAAqC;cAChE;mBACK;EACjB,YAAY,MAAM;EAClB,QAAQ,SAAS,qCAAqC,QAAQ;UACtD;UACA;UACA;UACA;UACA;UACA;UACA;;;;cAII,sCAAsC,4BAA4B;YACpE,wBAAwB,WAAW,gBAAgB;EAC7D,kBAAkB,UAAU,sB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