@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.
- package/dist/control.d.mts +25 -12
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +354 -108
- package/dist/control.mjs.map +1 -1
- package/dist/{migration-factories-Brzz-QGG.mjs → migration-factories-gwi81C8u.mjs} +43 -3
- package/dist/migration-factories-gwi81C8u.mjs.map +1 -0
- package/dist/migration.d.mts +16 -3
- package/dist/migration.d.mts.map +1 -1
- package/dist/migration.mjs +2 -2
- package/dist/{op-factory-call-CfPGebEH.d.mts → op-factory-call-BjNAcPSF.d.mts} +26 -25
- package/dist/op-factory-call-BjNAcPSF.d.mts.map +1 -0
- package/package.json +12 -10
- package/src/core/migration-factories.ts +69 -1
- package/src/core/mongo-ops-serializer.ts +324 -5
- package/src/core/mongo-planner.ts +5 -6
- package/src/core/mongo-runner.ts +144 -8
- package/src/core/op-factory-call.ts +81 -26
- package/src/core/render-ops.ts +2 -35
- package/src/core/render-typescript.ts +25 -78
- package/src/exports/control.ts +1 -1
- package/src/exports/migration.ts +1 -0
- package/dist/migration-factories-Brzz-QGG.mjs.map +0 -1
- package/dist/op-factory-call-CfPGebEH.d.mts.map +0 -1
package/dist/control.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { a as DropCollectionCall, c as
|
|
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):
|
|
47
|
-
declare function deserializeMongoOps(json: readonly unknown[]):
|
|
48
|
-
declare function serializeMongoOps(ops: readonly
|
|
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
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
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
|
|
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
|
|
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
|
package/dist/control.d.mts.map
CHANGED
|
@@ -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":"
|
|
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,mBAAA,4BAA+C;iBAI/C,iBAAA,eAAgC;;;KC7epC,eAAA;;kBACoC;;;sBACI;;cAEvC,qBAAA,YAAiC;;;ILpD9B,SAAA,MAAA,EAAA,OAAuB;qBKwDlB;kCACa,cAAc;MAC1C;EJbU,IAAA,CAAA,OAAA,EAAA;;;qBIiIK;IHhLR,SAAA,QAAgB,EAAA,MAAA;IAGV,SAAA,mBAAA,EG+Ke,aH/Kf,CG+K6B,8BH/K7B,CAAA,OAAA,EAAA,OAAA,CAAA,CAAA;EAAsB,CAAA,CAAA,EGgLnC,sBHhLmC;EAK3B;;;;;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