@prisma-next/target-mongo 0.4.0-dev.8 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
- import { a as DropCollectionCall, c as OpFactoryCallVisitor, i as CreateIndexCall, l as schemaCollectionToCreateCollectionOptions, n as CollModMeta, o as DropIndexCall, r as CreateCollectionCall, s as OpFactoryCall, t as CollModCall, u as schemaIndexToCreateIndexOptions } from "./op-factory-call-CfPGebEH.mjs";
1
+ import { a as DropCollectionCall, c as schemaCollectionToCreateCollectionOptions, i as CreateIndexCall, l as schemaIndexToCreateIndexOptions, n as CollModMeta, o as DropIndexCall, r as CreateCollectionCall, s as OpFactoryCall, t as CollModCall } from "./op-factory-call-BjNAcPSF.mjs";
2
2
  import { MongoSchemaIR } from "@prisma-next/mongo-schema-ir";
3
+ import { MongoQueryPlan } from "@prisma-next/mongo-query-ast/execution";
3
4
  import { AnyMongoMigrationOperation, MongoAndExpr, MongoDdlCommandVisitor, MongoExistsExpr, MongoExprFilter, MongoFieldFilter, MongoFilterExpr, MongoFilterVisitor, MongoInspectionCommandVisitor, MongoMigrationPlanOperation, MongoNotExpr, MongoOrExpr } from "@prisma-next/mongo-query-ast/control";
4
5
  import { Migration, MigrationMeta } from "@prisma-next/migration-tools/migration";
5
6
  import { MongoContract } from "@prisma-next/mongo-contract";
@@ -7,6 +8,7 @@ import { MigrationOperationPolicy, MigrationPlan, MigrationPlanOperation, Migrat
7
8
  import { ContractMarkerRecord } from "@prisma-next/contract/types";
8
9
  import { Db } from "mongodb";
9
10
  import { TargetBoundComponentDescriptor } from "@prisma-next/framework-components/components";
11
+ import { MongoAdapter, MongoDriver } from "@prisma-next/mongo-lowering";
10
12
 
11
13
  //#region src/core/contract-to-schema.d.ts
12
14
  declare function contractToMongoSchemaIR(contract: MongoContract | null): MongoSchemaIR;
@@ -43,9 +45,9 @@ declare function writeLedgerEntry(db: Db, entry: {
43
45
  }): Promise<void>;
44
46
  //#endregion
45
47
  //#region src/core/mongo-ops-serializer.d.ts
46
- declare function deserializeMongoOp(json: unknown): MongoMigrationPlanOperation;
47
- declare function deserializeMongoOps(json: readonly unknown[]): MongoMigrationPlanOperation[];
48
- declare function serializeMongoOps(ops: readonly MongoMigrationPlanOperation[]): string;
48
+ declare function deserializeMongoOp(json: unknown): AnyMongoMigrationOperation;
49
+ declare function deserializeMongoOps(json: readonly unknown[]): AnyMongoMigrationOperation[];
50
+ declare function serializeMongoOps(ops: readonly AnyMongoMigrationOperation[]): string;
49
51
  //#endregion
50
52
  //#region src/core/mongo-planner.d.ts
51
53
  type PlanCallsResult = {
@@ -72,12 +74,11 @@ declare class MongoMigrationPlanner implements MigrationPlanner<'mongo', 'mongo'
72
74
  /**
73
75
  * Produce an empty `migration.ts` authoring surface for `migration new`.
74
76
  *
75
- * Mongo is a class-flow target, so the "empty migration" is a
76
- * `PlannerProducedMongoMigration` with no operations; `renderTypeScript()`
77
- * emits a stub class with the correct `from`/`to` metadata that the user
78
- * then fills in with operations. The contract path on the context is
79
- * unused — Mongo's emitted source does not import from the generated
80
- * contract `.d.ts`.
77
+ * The "empty migration" is a `PlannerProducedMongoMigration` with no
78
+ * operations; `renderTypeScript()` emits a stub class with the correct
79
+ * `from`/`to` metadata that the user then fills in with operations. The
80
+ * contract path on the context is unused Mongo's emitted source does
81
+ * not import from the generated contract `.d.ts`.
81
82
  */
82
83
  emptyMigration(context: MigrationScaffoldContext): MigrationPlanWithAuthoringSurface;
83
84
  }
@@ -102,6 +103,8 @@ interface MarkerOperations {
102
103
  interface MongoRunnerDependencies {
103
104
  readonly commandExecutor: MongoDdlCommandVisitor<Promise<void>>;
104
105
  readonly inspectionExecutor: MongoInspectionCommandVisitor<Promise<Record<string, unknown>[]>>;
106
+ readonly adapter: MongoAdapter;
107
+ readonly driver: MongoDriver;
105
108
  readonly markerOps: MarkerOperations;
106
109
  }
107
110
  declare class MongoMigrationRunner {
@@ -118,6 +121,8 @@ declare class MongoMigrationRunner {
118
121
  readonly executionChecks?: MigrationRunnerExecutionChecks;
119
122
  readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'mongo', 'mongo'>>;
120
123
  }): Promise<MigrationRunnerResult>;
124
+ private executeDataTransform;
125
+ private evaluateDataTransformChecks;
121
126
  private evaluateChecks;
122
127
  private allChecksSatisfied;
123
128
  private enforcePolicyCompatibility;
@@ -162,15 +167,23 @@ interface RenderMigrationMeta {
162
167
  readonly labels?: readonly string[];
163
168
  }
164
169
  /**
165
- * Render a list of Mongo `OpFactoryCall`s as a class-flow `migration.ts`
170
+ * Render a list of Mongo `OpFactoryCall`s as a `migration.ts`
166
171
  * source string. The result is shebanged, extends the user-facing
167
172
  * `Migration` (i.e. `MongoMigration`) from `@prisma-next/family-mongo`, and
168
173
  * implements the abstract `operations` and `describe` members. `meta` is
169
174
  * always rendered — `describe()` is part of the `Migration` contract, so
170
175
  * even an empty stub must satisfy it; callers pass empty strings for a
171
176
  * migration-new scaffold.
177
+ *
178
+ * The walk is polymorphic: each call node contributes its own
179
+ * `renderTypeScript()` expression and declares its own
180
+ * `importRequirements()`. The top-level renderer aggregates imports
181
+ * across all nodes and emits one `import { … } from "…"` line per module.
182
+ * The `Migration` import from `@prisma-next/family-mongo/migration` is
183
+ * always emitted — it's driven by `meta` (the rendered scaffold always
184
+ * extends `Migration`), not by any node.
172
185
  */
173
186
  declare function renderCallsToTypeScript(calls: ReadonlyArray<OpFactoryCall>, meta: RenderMigrationMeta): string;
174
187
  //#endregion
175
- export { CollModCall, type CollModMeta, CreateCollectionCall, CreateIndexCall, DropCollectionCall, DropIndexCall, FilterEvaluator, type MarkerOperations, MongoMigrationPlanner, MongoMigrationRunner, type MongoRunnerDependencies, type OpFactoryCall, type OpFactoryCallVisitor, type PlanCallsResult, PlannerProducedMongoMigration, type RenderMigrationMeta, contractToMongoSchemaIR, deserializeMongoOp, deserializeMongoOps, formatMongoOperations, initMarker, readMarker, renderCallsToTypeScript, renderOps, schemaCollectionToCreateCollectionOptions, schemaIndexToCreateIndexOptions, serializeMongoOps, updateMarker, writeLedgerEntry };
188
+ export { CollModCall, type CollModMeta, CreateCollectionCall, CreateIndexCall, DropCollectionCall, DropIndexCall, FilterEvaluator, type MarkerOperations, MongoMigrationPlanner, MongoMigrationRunner, type MongoRunnerDependencies, type OpFactoryCall, type PlanCallsResult, PlannerProducedMongoMigration, type RenderMigrationMeta, contractToMongoSchemaIR, deserializeMongoOp, deserializeMongoOps, formatMongoOperations, initMarker, readMarker, renderCallsToTypeScript, renderOps, schemaCollectionToCreateCollectionOptions, schemaIndexToCreateIndexOptions, serializeMongoOps, updateMarker, writeLedgerEntry };
176
189
  //# sourceMappingURL=control.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/contract-to-schema.ts","../src/core/ddl-formatter.ts","../src/core/filter-evaluator.ts","../src/core/marker-ledger.ts","../src/core/mongo-ops-serializer.ts","../src/core/mongo-planner.ts","../src/core/mongo-runner.ts","../src/core/planner-produced-migration.ts","../src/core/render-ops.ts","../src/core/render-typescript.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;iBAoDgB,uBAAA,WAAkC,uBAAuB;;;iBC6CzD,qBAAA,sBAA2C;;;cC/C9C,eAAA,YAA2B;;mBAGrB,sBAAsB;cAK3B;YAKF;WAID;YAIC;eAIG;cAKD;;;;iBCjDQ,UAAA,KAAe,KAAK,QAAQ;iBAgB5B,UAAA,KAChB;;;IAEH;iBAcmB,YAAA,KAChB;;;IAGH;AHhBa,iBGiCM,gBAAA,CHjCiB,EAAW,EGkC5C,EHlC4C,EAAA,KAAA,EAAA;;;;AC6ClD,CAAA,CAAA,EETG,OFSa,CAAA,IAAA,CAAA;;;iBGiKA,kBAAA,iBAAmC;iBAYnC,mBAAA,4BAA+C;iBAI/C,iBAAA,eAAgC;;;KC9KpC,eAAA;;kBACoC;;;sBACI;;cAEvC,qBAAA,YAAiC;ELpD9B,SAAA,CAA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AA;EAgB3B,CAAA,CAAA,EGqBhB,OHrBgB,CGqBR,qBHlBX,CAAA;EAcmB,QAAA,cAAY;EAqBZ,QAAA,kBAAgB;;;;;;;;;;;;;AHjCtC;;;;AC6CA;;;;AC/CA;AAGmB,cK7BN,6BAAA,SACH,SL4BS,CK5BC,0BL4BD,CAAA,YK3BN,iCL2BM,CAAA;EAAsB,iBAAA,KAAA;EAK3B,iBAAA,IAAA;EAKF,SAAA,QAAA,EAAA,OAAA;EAID,WAAA,CAAA,KAAA,EAAA,SKpC0B,aLoC1B,EAAA,EAAA,IAAA,EKnCgB,aLmChB;EAIC,IAAA,UAAA,CAAA,CAAA,EAAA,SKlC0B,0BLkC1B,EAAA;EAIG,QAAA,CAAA,CAAA,EKlCQ,aLkCR;EAKD,gBAAA,CAAA,CAAA,EAAA,MAAA;;;;iBM5CE,SAAA,QAAiB,cAAc,iBAAiB;;;UCzB/C,mBAAA;;;;;;;;;;ATyCjB;;;;AC6CA;iBQtEgB,uBAAA,QACP,cAAc,sBACf"}
1
+ {"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/contract-to-schema.ts","../src/core/ddl-formatter.ts","../src/core/filter-evaluator.ts","../src/core/marker-ledger.ts","../src/core/mongo-ops-serializer.ts","../src/core/mongo-planner.ts","../src/core/mongo-runner.ts","../src/core/planner-produced-migration.ts","../src/core/render-ops.ts","../src/core/render-typescript.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;iBAoDgB,uBAAA,WAAkC,uBAAuB;;;iBC6CzD,qBAAA,sBAA2C;;;cC/C9C,eAAA,YAA2B;;mBAGrB,sBAAsB;cAK3B;YAKF;WAID;YAIC;eAIG;cAKD;;;;iBCjDQ,UAAA,KAAe,KAAK,QAAQ;iBAgB5B,UAAA,KAChB;;;IAEH;iBAcmB,YAAA,KAChB;;;IAGH;iBAiBmB,gBAAA,KAChB;;EHlCU,SAAA,IAAA,EAAA,MAAA;;IGoCb;;;iBC8ea,kBAAA,iBAAmC;iBAOnC,m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