@prisma/orm-target-mongo 8.0.0-rc.12-dev.8 → 8.0.0-rc.12-dev.10
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/adapter.d.mts +1 -1
- package/dist/adapter.mjs +2 -2
- package/dist/adapter.mjs.map +1 -1
- package/dist/adapter__control.d.mts +208 -3
- package/dist/adapter__control.d.mts.map +1 -0
- package/dist/adapter__control.mjs +516 -3
- package/dist/adapter__control.mjs.map +1 -0
- package/dist/adapter__runtime.mjs +2 -2
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/codec-ids-Bz230VLx-Dbi_KV7J.mjs +16 -0
- package/dist/codec-ids-Bz230VLx-Dbi_KV7J.mjs.map +1 -0
- package/dist/codec-ids-Ck-Z63jY.d.mts +16 -0
- package/dist/codec-ids-Ck-Z63jY.d.mts.map +1 -0
- package/dist/{adapter__codec-types.d.mts → codec-types-KM2ikqd7.d.mts} +20 -3
- package/dist/codec-types-KM2ikqd7.d.mts.map +1 -0
- package/dist/codecs-ChbLv6Rd-BmoC4ktF.mjs +393 -0
- package/dist/codecs-ChbLv6Rd-BmoC4ktF.mjs.map +1 -0
- package/dist/codecs-DsyGq31F.d.mts +33 -0
- package/dist/codecs-DsyGq31F.d.mts.map +1 -0
- package/dist/{control-CDO-vU3z.d.mts → control-Cfov50jX.d.mts} +82 -82
- package/dist/control-Cfov50jX.d.mts.map +1 -0
- package/dist/{control-CB0AAVw_.mjs → control-DESRWr7S.mjs} +140 -145
- package/dist/control-DESRWr7S.mjs.map +1 -0
- package/dist/{data-types-CxW7xs7P-Dxj3sc0T.mjs → data-types-B2WnpO9e-D97kwz96.mjs} +12 -4
- package/dist/data-types-B2WnpO9e-D97kwz96.mjs.map +1 -0
- package/dist/data-types-Kd9NIobH.d.mts +18 -0
- package/dist/data-types-Kd9NIobH.d.mts.map +1 -0
- package/dist/{descriptor-meta-BQRniVcn-8meGwEZr.mjs → descriptor-meta-CSm-03KE-DDeX4NIT.mjs} +4 -4
- package/dist/descriptor-meta-CSm-03KE-DDeX4NIT.mjs.map +1 -0
- package/dist/driver.mjs +1 -1
- package/dist/driver__control.d.mts +1 -1
- package/dist/driver__control.mjs +2 -2
- package/dist/driver__control.mjs.map +1 -1
- package/dist/{migration-BkqcE2Uv.d.mts → migration-DeZyk0tl.d.mts} +3 -3
- package/dist/{migration-BkqcE2Uv.d.mts.map → migration-DeZyk0tl.d.mts.map} +1 -1
- package/dist/{migration-factories-CqjDpXHw-fxXh_wY1.mjs → migration-factories-BwvR6Mvk-Ba1ywTUZ.mjs} +2 -2
- package/dist/migration-factories-BwvR6Mvk-Ba1ywTUZ.mjs.map +1 -0
- package/dist/{mongo-adapter-NKwUwPku-Bqm1kySe.mjs → mongo-adapter-Dx9Gs2Lj-CA6H_zbI.mjs} +10 -5
- package/dist/mongo-adapter-Dx9Gs2Lj-CA6H_zbI.mjs.map +1 -0
- package/dist/{mongo-adapter-CjJU3S9o-BIJruFYW.d.mts → mongo-adapter-wvK2fQOZ-BXo5NxEB.d.mts} +2 -2
- package/dist/mongo-adapter-wvK2fQOZ-BXo5NxEB.d.mts.map +1 -0
- package/dist/{mongo-driver-BGXMvnQ8-B_flHHzS.mjs → mongo-driver-CZDo4GWY-CDmclLXI.mjs} +3 -3
- package/dist/mongo-driver-CZDo4GWY-CDmclLXI.mjs.map +1 -0
- package/dist/{op-factory-call-B7EKa4Ri-B2Lb6W68.d.mts → op-factory-call-DV0hKDUc-DHt1CB5L.d.mts} +3 -3
- package/dist/{op-factory-call-B7EKa4Ri-B2Lb6W68.d.mts.map → op-factory-call-DV0hKDUc-DHt1CB5L.d.mts.map} +1 -1
- package/dist/{pack-MK8ZQfrL.d.mts → pack-CPxA9byH.d.mts} +2 -2
- package/dist/{pack-MK8ZQfrL.d.mts.map → pack-CPxA9byH.d.mts.map} +1 -1
- package/dist/target.d.mts +9 -7
- package/dist/target.mjs +6 -3
- package/dist/target__codec-ids.d.mts +2 -0
- package/dist/target__codec-ids.mjs +2 -0
- package/dist/target__codec-types.d.mts +2 -2
- package/dist/target__codecs.d.mts +2 -0
- package/dist/target__codecs.mjs +2 -0
- package/dist/target__control.d.mts +3 -4
- package/dist/target__control.mjs +1 -1
- package/dist/target__data-types.d.mts +2 -0
- package/dist/target__data-types.mjs +2 -0
- package/dist/target__migration.d.mts +1 -1
- package/dist/target__migration.mjs +1 -1
- package/dist/target__pack.d.mts +1 -1
- package/dist/target__pack.mjs +1 -1
- package/dist/target__pack.mjs.map +1 -1
- package/dist/target__runtime.mjs +1 -1
- package/dist/target__runtime.mjs.map +1 -1
- package/package.json +13 -14
- package/dist/adapter__codec-ids.d.mts +0 -12
- package/dist/adapter__codec-ids.d.mts.map +0 -1
- package/dist/adapter__codec-ids.mjs +0 -2
- package/dist/adapter__codec-types.d.mts.map +0 -1
- package/dist/adapter__codec-types.mjs +0 -1
- package/dist/adapter__codecs.d.mts +0 -14
- package/dist/adapter__codecs.d.mts.map +0 -1
- package/dist/adapter__codecs.mjs +0 -2
- package/dist/adapter__data-types.d.mts +0 -14
- package/dist/adapter__data-types.d.mts.map +0 -1
- package/dist/adapter__data-types.mjs +0 -2
- package/dist/codec-ids-BennPcpQ-Btzz3ILV.mjs +0 -12
- package/dist/codec-ids-BennPcpQ-Btzz3ILV.mjs.map +0 -1
- package/dist/codec-types-Bx2fHyq_.d.mts +0 -35
- package/dist/codec-types-Bx2fHyq_.d.mts.map +0 -1
- package/dist/codecs-0ilNxnkk-P6rdFjk0.mjs +0 -179
- package/dist/codecs-0ilNxnkk-P6rdFjk0.mjs.map +0 -1
- package/dist/control-BDevch6o.mjs +0 -443
- package/dist/control-BDevch6o.mjs.map +0 -1
- package/dist/control-CB0AAVw_.mjs.map +0 -1
- package/dist/control-CDO-vU3z.d.mts.map +0 -1
- package/dist/control-CbxqWOJS.d.mts +0 -176
- package/dist/control-CbxqWOJS.d.mts.map +0 -1
- package/dist/data-types-CxW7xs7P-Dxj3sc0T.mjs.map +0 -1
- package/dist/descriptor-meta-BQRniVcn-8meGwEZr.mjs.map +0 -1
- package/dist/migration-factories-CqjDpXHw-fxXh_wY1.mjs.map +0 -1
- package/dist/mongo-adapter-CjJU3S9o-BIJruFYW.d.mts.map +0 -1
- package/dist/mongo-adapter-NKwUwPku-Bqm1kySe.mjs.map +0 -1
- package/dist/mongo-driver-BGXMvnQ8-B_flHHzS.mjs.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { s as OpFactoryCall$1 } from "./op-factory-call-B7EKa4Ri-B2Lb6W68.mjs";
|
|
1
|
+
import { s as OpFactoryCall$1 } from "./op-factory-call-DV0hKDUc-DHt1CB5L.mjs";
|
|
3
2
|
import { Namespace, NamespaceBase } from "@prisma/orm-framework/components/ir";
|
|
4
3
|
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
4
|
import { MongoControlTargetDescriptor } from "@prisma/orm-family-mongo/family/control";
|
|
7
5
|
import { Result } from "@prisma/orm-framework/utils/result";
|
|
6
|
+
import { MongoContractSerializerBase, MongoSchemaVerifierBase } from "@prisma/orm-family-mongo/family/ir";
|
|
7
|
+
import { MongoCollection, MongoCollectionInput, MongoContract, MongoNamespaceEntries, MongoStorage, MongoValueSetInput } from "@prisma/orm-family-mongo/contract";
|
|
8
|
+
import { MongoSchemaIR } from "@prisma/orm-family-mongo/schema-ir";
|
|
8
9
|
import { Migration, MigrationMeta } from "@prisma/orm-toolchain/migration-tools/migration";
|
|
9
10
|
import { MigrationOperationPolicy, MigrationPlan, MigrationPlanOperation, MigrationPlanWithAuthoringSurface, MigrationPlanner, MigrationPlannerConflict, MigrationPlannerResult, MigrationRunnerExecutionChecks, MigrationRunnerFailure, MigrationRunnerPerSpaceSuccessValue, MigrationScaffoldContext, OperationContext, SchemaDiffIssue, SchemaVerifyOptions, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
|
|
10
11
|
import { ImportSpecifierResolver } from "@prisma/orm-framework/components/emission";
|
|
11
|
-
import {
|
|
12
|
-
import { MongoCollection, MongoCollectionInput, MongoContract, MongoNamespaceEntries, MongoStorage, MongoValueSetInput } from "@prisma/orm-family-mongo/contract";
|
|
12
|
+
import { MongoRunnerDependencies } from "@prisma/orm-family-mongo/family/control-adapter";
|
|
13
13
|
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
14
14
|
import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
|
|
15
15
|
import { AggregateMigrationEdgeRef } from "@prisma/orm-toolchain/migration-tools/aggregate";
|
|
@@ -30,7 +30,7 @@ type MongoTargetContract = Omit<MongoContract, 'storage'> & {
|
|
|
30
30
|
readonly storage: MongoStorage;
|
|
31
31
|
};
|
|
32
32
|
//#endregion
|
|
33
|
-
//#region src/core/control-target.d.ts
|
|
33
|
+
//#region src/core/migrations/control-target.d.ts
|
|
34
34
|
/**
|
|
35
35
|
* `migration.ts` default-exports a `Migration` subclass whose `operations`
|
|
36
36
|
* getter returns the ordered list of operations and whose `describe()`
|
|
@@ -43,7 +43,7 @@ type MongoTargetContract = Omit<MongoContract, 'storage'> & {
|
|
|
43
43
|
*/
|
|
44
44
|
declare const mongoTargetDescriptor: MongoControlTargetDescriptor<MongoTargetContract>;
|
|
45
45
|
//#endregion
|
|
46
|
-
//#region src/core/filter-evaluator.d.ts
|
|
46
|
+
//#region src/core/migrations/filter-evaluator.d.ts
|
|
47
47
|
declare class FilterEvaluator implements MongoFilterVisitor<boolean> {
|
|
48
48
|
private doc;
|
|
49
49
|
evaluate(filter: MongoFilterExpr, doc: Record<string, unknown>): boolean;
|
|
@@ -55,12 +55,12 @@ declare class FilterEvaluator implements MongoFilterVisitor<boolean> {
|
|
|
55
55
|
expr(_expr: MongoExprFilter): boolean;
|
|
56
56
|
}
|
|
57
57
|
//#endregion
|
|
58
|
-
//#region src/core/mongo-ops-serializer.d.ts
|
|
58
|
+
//#region src/core/migrations/mongo-ops-serializer.d.ts
|
|
59
59
|
declare function deserializeMongoOp(json: unknown): AnyMongoMigrationOperation;
|
|
60
60
|
declare function deserializeMongoOps(json: readonly unknown[]): AnyMongoMigrationOperation[];
|
|
61
61
|
declare function serializeMongoOps(ops: readonly AnyMongoMigrationOperation[]): string;
|
|
62
62
|
//#endregion
|
|
63
|
-
//#region src/core/mongo-planner.d.ts
|
|
63
|
+
//#region src/core/migrations/mongo-planner.d.ts
|
|
64
64
|
type PlanCallsResult = {
|
|
65
65
|
readonly kind: 'success';
|
|
66
66
|
readonly calls: OpFactoryCall$1[];
|
|
@@ -105,7 +105,7 @@ declare class MongoMigrationPlanner implements MigrationPlanner<'mongo', 'mongo'
|
|
|
105
105
|
emptyMigration(context: MigrationScaffoldContext): MigrationPlanWithAuthoringSurface;
|
|
106
106
|
}
|
|
107
107
|
//#endregion
|
|
108
|
-
//#region src/core/mongo-runner.d.ts
|
|
108
|
+
//#region src/core/migrations/mongo-runner.d.ts
|
|
109
109
|
interface MongoMigrationRunnerExecuteOptions {
|
|
110
110
|
readonly plan: MigrationPlan;
|
|
111
111
|
readonly destinationContract: MongoContract;
|
|
@@ -146,74 +146,7 @@ declare class MongoMigrationRunner {
|
|
|
146
146
|
private ensureMarkerCompatibility;
|
|
147
147
|
}
|
|
148
148
|
//#endregion
|
|
149
|
-
//#region src/core/mongo-target-
|
|
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
|
|
149
|
+
//#region src/core/migrations/mongo-target-schema-verifier.d.ts
|
|
217
150
|
/**
|
|
218
151
|
* Mongo target `SchemaVerifier` concretion. Extends the family base's
|
|
219
152
|
* namespace-walk scaffolding and contributes the per-namespace diff via
|
|
@@ -245,7 +178,7 @@ declare class MongoTargetSchemaVerifier extends MongoSchemaVerifierBase<MongoTar
|
|
|
245
178
|
protected verifyTargetExtensions(_options: SchemaVerifyOptions<MongoTargetContract, MongoSchemaIR>): readonly SchemaDiffIssue[];
|
|
246
179
|
}
|
|
247
180
|
//#endregion
|
|
248
|
-
//#region src/core/planner-produced-migration.d.ts
|
|
181
|
+
//#region src/core/migrations/planner-produced-migration.d.ts
|
|
249
182
|
/**
|
|
250
183
|
* Planner-produced Mongo migration, returned by `MongoMigrationPlanner.plan(...)`
|
|
251
184
|
* and `MongoMigrationPlanner.emptyMigration(...)`.
|
|
@@ -272,10 +205,10 @@ declare class PlannerProducedMongoMigration extends Migration<AnyMongoMigrationO
|
|
|
272
205
|
renderTypeScript(resolveImportSpecifier: ImportSpecifierResolver): string;
|
|
273
206
|
}
|
|
274
207
|
//#endregion
|
|
275
|
-
//#region src/core/render-ops.d.ts
|
|
208
|
+
//#region src/core/migrations/render-ops.d.ts
|
|
276
209
|
declare function renderOps(calls: ReadonlyArray<OpFactoryCall$1>): MongoMigrationPlanOperation[];
|
|
277
210
|
//#endregion
|
|
278
|
-
//#region src/core/render-typescript.d.ts
|
|
211
|
+
//#region src/core/migrations/render-typescript.d.ts
|
|
279
212
|
interface RenderMigrationMeta {
|
|
280
213
|
readonly from: string | null;
|
|
281
214
|
readonly to: string;
|
|
@@ -308,5 +241,72 @@ interface RenderMigrationMeta {
|
|
|
308
241
|
*/
|
|
309
242
|
declare function renderCallsToTypeScript(calls: ReadonlyArray<OpFactoryCall$1>, meta: RenderMigrationMeta): string;
|
|
310
243
|
//#endregion
|
|
244
|
+
//#region src/core/mongo-target-contract-serializer.d.ts
|
|
245
|
+
declare class MongoTargetContractSerializer extends MongoContractSerializerBase<MongoTargetContract> {
|
|
246
|
+
protected constructTargetContract(validated: MongoContract): MongoTargetContract;
|
|
247
|
+
serializeContract(contract: MongoTargetContract): JsonObject;
|
|
248
|
+
}
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/core/mongo-target-database.d.ts
|
|
251
|
+
interface MongoTargetDatabaseInput {
|
|
252
|
+
readonly id: string;
|
|
253
|
+
readonly entries?: Readonly<Record<string, Readonly<Record<string, unknown>>>> & {
|
|
254
|
+
readonly collection?: Readonly<Record<string, MongoCollectionInput>>;
|
|
255
|
+
readonly valueSet?: Readonly<Record<string, MongoValueSetInput>>;
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Mongo target `Namespace` concretion. In Mongo the "namespace" concept
|
|
260
|
+
* binds to the connection's `db` field — a `MongoTargetDatabase` instance
|
|
261
|
+
* names the database the collections live under. `entries['collection']`
|
|
262
|
+
* holds collection IR. The unbound singleton (below) is the late-bound
|
|
263
|
+
* namespace whose binding the connection's `db` resolves at runtime rather
|
|
264
|
+
* than at authoring time.
|
|
265
|
+
*
|
|
266
|
+
* Qualifier emission is the rendering seam: query / DDL emission asks the
|
|
267
|
+
* namespace for its qualifier (e.g. `"<db>.<collection>"`) and consumes
|
|
268
|
+
* the result polymorphically. The unbound singleton overrides these
|
|
269
|
+
* methods to elide the prefix entirely — call sites stay polymorphic and
|
|
270
|
+
* never branch on `id === UNBOUND_NAMESPACE_ID`.
|
|
271
|
+
*/
|
|
272
|
+
declare class MongoTargetDatabase extends NamespaceBase {
|
|
273
|
+
readonly kind: string;
|
|
274
|
+
readonly id: string;
|
|
275
|
+
readonly entries: MongoNamespaceEntries;
|
|
276
|
+
constructor(input: MongoTargetDatabaseInput);
|
|
277
|
+
get collection(): Readonly<Record<string, MongoCollection>>;
|
|
278
|
+
/**
|
|
279
|
+
* The bare qualifier as it would appear in a rendered string. The
|
|
280
|
+
* unbound-database singleton overrides this to return `''`.
|
|
281
|
+
*/
|
|
282
|
+
qualifier(): string;
|
|
283
|
+
/**
|
|
284
|
+
* Qualify a collection name with the database prefix. The
|
|
285
|
+
* unbound-database singleton overrides this to emit just the
|
|
286
|
+
* collection name. Used by emission/introspection paths that need a
|
|
287
|
+
* fully-qualified reference.
|
|
288
|
+
*/
|
|
289
|
+
qualifyCollection(collectionName: string): string;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Singleton subclass for the reserved sentinel namespace id
|
|
293
|
+
* (`UNBOUND_NAMESPACE_ID`) — the late-bound namespace whose binding the
|
|
294
|
+
* connection's `db` resolves at runtime. Overrides qualifier emission
|
|
295
|
+
* to elide the database prefix; call sites that consume `qualifier()`
|
|
296
|
+
* / `qualifyCollection()` get unqualified output without branching on
|
|
297
|
+
* the namespace id.
|
|
298
|
+
*
|
|
299
|
+
* This is the target-side materialization of "the framework provides
|
|
300
|
+
* affordances; targets implement specifics": the framework names the
|
|
301
|
+
* sentinel; Mongo decides what late-bound means here (the collection
|
|
302
|
+
* name, naked — the database is supplied by the live connection).
|
|
303
|
+
*/
|
|
304
|
+
declare class MongoTargetUnboundDatabase extends MongoTargetDatabase {
|
|
305
|
+
static readonly instance: MongoTargetUnboundDatabase;
|
|
306
|
+
private constructor();
|
|
307
|
+
qualifier(): string;
|
|
308
|
+
qualifyCollection(collectionName: string): string;
|
|
309
|
+
}
|
|
310
|
+
//#endregion
|
|
311
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-
|
|
312
|
+
//# sourceMappingURL=control-Cfov50jX.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-Cfov50jX.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;;;;;;;;;;;;;;;;;;;;;;;;;cAyBI,kCAAkC,wBAAwB,qBAAqB;YACjF,gBAAgB;aACf,UAAU;aACV,QAAQ;aACR;aACA,WAAW;eACT;YACH,uBAAuB,UAAU,oBAAoB,qBAAqB,0BAA0B;;;;;;;;;;;;;;;;;;;cAmBlG,sCAAsC,UAAU,uCAAuC;mBAClF;mBACA;mBACA;WACR;EACT,YAAY,gBAAgB,mBAAiB,MAAM,eAAe;MAC9D,uBAAuB;EAC3B,YAAY;EACZ,iBAAiB,wBAAwB;;;;iBAI1B,UAAU,OAAO,cAAc,mBAAiB;;;UAGvD;WACC;WACA;;WAEA;;;;;;;WAOA,yBAAyB;;;;;;;;;;;;;;;;;;;iBAmBnB,wBAAwB,OAAO,cAAc,kBAAgB,MAAM;;;cAGtE,sCAAsC,4BAA4B;YACpE,wBAAwB,WAAW,gBAAgB;EAC7D,kBAAkB,UAAU,sBAAsB;;;;UAI1C;WACC;WACA,UAAU,SAAS,eAAe,SAAS;aACzC,aAAa,SAAS,eAAe;aACrC,WAAW,SAAS,eAAe;;;;;;;;;;;;;;;;;cAiBlC,4BAA4B;WAC/B;WACA;WACA,SAAS;EAClB,YAAY,OAAO;MACf,cAAc,SAAS,eAAe;;;;;EAK1C;;;;;;;EAOA,kBAAkB;;;;;;;;;;;;;;;cAeN,mCAAmC;kBAC/B,UAAU;UAClB;EACR;EACA,kBAAkB"}
|
|
@@ -1,30 +1,155 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { n as MongoDriverImpl } from "./mongo-driver-BGXMvnQ8-B_flHHzS.mjs";
|
|
5
|
-
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
1
|
+
import { a as mongoTargetError } from "./codecs-ChbLv6Rd-BmoC4ktF.mjs";
|
|
2
|
+
import { t as mongoTargetDescriptorMeta } from "./descriptor-meta-CSm-03KE-DDeX4NIT.mjs";
|
|
3
|
+
import { a as dropCollection, n as createCollection, o as dropIndex, r as createIndex, t as collMod } from "./migration-factories-BwvR6Mvk-Ba1ywTUZ.mjs";
|
|
6
4
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
7
5
|
import { NamespaceBase, UNBOUND_NAMESPACE_ID, elementCoordinates, freezeNode, hydrateNamespaceEntities } from "@prisma/orm-framework/components/ir";
|
|
8
6
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
9
7
|
import { CollModCommand, CreateCollectionCommand, CreateIndexCommand, DropCollectionCommand, DropIndexCommand, ListCollectionsCommand, ListIndexesCommand, MongoAndExpr, MongoExistsExpr, MongoFieldFilter, MongoNotExpr, MongoOrExpr } from "@prisma/orm-family-mongo/query-ast/control";
|
|
10
|
-
import { AggregateCommand, MongoAddFieldsStage, MongoLimitStage, MongoLookupStage, MongoMatchStage, MongoMergeStage, MongoProjectStage, MongoSortStage, RawAggregateCommand, RawDeleteManyCommand, RawDeleteOneCommand, RawFindOneAndDeleteCommand, RawFindOneAndUpdateCommand, RawInsertManyCommand, RawInsertOneCommand, RawUpdateManyCommand, RawUpdateOneCommand } from "@prisma/orm-family-mongo/query-ast/execution";
|
|
11
|
-
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
12
|
-
import { canonicalize, deepEqual } from "@prisma/orm-family-mongo/schema-ir";
|
|
13
|
-
import { errorRunnerFailed } from "@prisma/orm-framework/errors/execution";
|
|
14
|
-
import { type } from "arktype";
|
|
15
8
|
import { canonicalizeSchemasForVerification, contractToMongoSchemaIR, diffMongoSchemas } from "@prisma/orm-family-mongo/family/control";
|
|
16
9
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
10
|
+
import { MongoContractSerializerBase, MongoSchemaVerifierBase } from "@prisma/orm-family-mongo/family/ir";
|
|
11
|
+
import { MongoStorage } from "@prisma/orm-family-mongo/contract";
|
|
12
|
+
import { composeMongoEntityKinds } from "@prisma/orm-family-mongo/contract/entity-kinds";
|
|
13
|
+
import { canonicalize, deepEqual } from "@prisma/orm-family-mongo/schema-ir";
|
|
17
14
|
import { TsExpression, jsonToTsSource, renderImports } from "@prisma/orm-framework/ts-render";
|
|
18
15
|
import { Migration } from "@prisma/orm-toolchain/migration-tools/migration";
|
|
19
16
|
import { APP_SPACE_ID, contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier, issueOutcome } from "@prisma/orm-framework/components/control";
|
|
20
17
|
import { resolveRequirementSpecifiers } from "@prisma/orm-framework/components/emission";
|
|
21
18
|
import { detectScaffoldRuntime, shebangLineFor } from "@prisma/orm-toolchain/migration-tools/migration-ts";
|
|
19
|
+
import { errorRunnerFailed } from "@prisma/orm-framework/errors/execution";
|
|
22
20
|
import { verifyMongoSchema } from "@prisma/orm-family-mongo/family/schema-verify";
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
21
|
+
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
22
|
+
import { AggregateCommand, MongoAddFieldsStage, MongoLimitStage, MongoLookupStage, MongoMatchStage, MongoMergeStage, MongoProjectStage, MongoSortStage, RawAggregateCommand, RawDeleteManyCommand, RawDeleteOneCommand, RawFindOneAndDeleteCommand, RawFindOneAndUpdateCommand, RawInsertManyCommand, RawInsertOneCommand, RawUpdateManyCommand, RawUpdateOneCommand } from "@prisma/orm-family-mongo/query-ast/execution";
|
|
23
|
+
import { type } from "arktype";
|
|
26
24
|
//#region ../../../3-mongo-target/1-mongo-target/dist/control.mjs
|
|
27
25
|
/**
|
|
26
|
+
* Mongo target `Namespace` concretion. In Mongo the "namespace" concept
|
|
27
|
+
* binds to the connection's `db` field — a `MongoTargetDatabase` instance
|
|
28
|
+
* names the database the collections live under. `entries['collection']`
|
|
29
|
+
* holds collection IR. The unbound singleton (below) is the late-bound
|
|
30
|
+
* namespace whose binding the connection's `db` resolves at runtime rather
|
|
31
|
+
* than at authoring time.
|
|
32
|
+
*
|
|
33
|
+
* Qualifier emission is the rendering seam: query / DDL emission asks the
|
|
34
|
+
* namespace for its qualifier (e.g. `"<db>.<collection>"`) and consumes
|
|
35
|
+
* the result polymorphically. The unbound singleton overrides these
|
|
36
|
+
* methods to elide the prefix entirely — call sites stay polymorphic and
|
|
37
|
+
* never branch on `id === UNBOUND_NAMESPACE_ID`.
|
|
38
|
+
*/
|
|
39
|
+
var MongoTargetDatabase = class extends NamespaceBase {
|
|
40
|
+
id;
|
|
41
|
+
entries;
|
|
42
|
+
constructor(input) {
|
|
43
|
+
super();
|
|
44
|
+
this.id = input.id;
|
|
45
|
+
const rawEntries = {
|
|
46
|
+
collection: {},
|
|
47
|
+
...input.entries
|
|
48
|
+
};
|
|
49
|
+
this.entries = Object.freeze(blindCast(hydrateNamespaceEntities(rawEntries, composeMongoEntityKinds(), "carry")));
|
|
50
|
+
Object.defineProperty(this, "kind", {
|
|
51
|
+
value: "database",
|
|
52
|
+
writable: false,
|
|
53
|
+
enumerable: false,
|
|
54
|
+
configurable: true
|
|
55
|
+
});
|
|
56
|
+
freezeNode(this);
|
|
57
|
+
}
|
|
58
|
+
get collection() {
|
|
59
|
+
return this.entries.collection ?? Object.freeze({});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The bare qualifier as it would appear in a rendered string. The
|
|
63
|
+
* unbound-database singleton overrides this to return `''`.
|
|
64
|
+
*/
|
|
65
|
+
qualifier() {
|
|
66
|
+
return this.id;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Qualify a collection name with the database prefix. The
|
|
70
|
+
* unbound-database singleton overrides this to emit just the
|
|
71
|
+
* collection name. Used by emission/introspection paths that need a
|
|
72
|
+
* fully-qualified reference.
|
|
73
|
+
*/
|
|
74
|
+
qualifyCollection(collectionName) {
|
|
75
|
+
return `${this.id}.${collectionName}`;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Singleton subclass for the reserved sentinel namespace id
|
|
80
|
+
* (`UNBOUND_NAMESPACE_ID`) — the late-bound namespace whose binding the
|
|
81
|
+
* connection's `db` resolves at runtime. Overrides qualifier emission
|
|
82
|
+
* to elide the database prefix; call sites that consume `qualifier()`
|
|
83
|
+
* / `qualifyCollection()` get unqualified output without branching on
|
|
84
|
+
* the namespace id.
|
|
85
|
+
*
|
|
86
|
+
* This is the target-side materialization of "the framework provides
|
|
87
|
+
* affordances; targets implement specifics": the framework names the
|
|
88
|
+
* sentinel; Mongo decides what late-bound means here (the collection
|
|
89
|
+
* name, naked — the database is supplied by the live connection).
|
|
90
|
+
*/
|
|
91
|
+
var MongoTargetUnboundDatabase = class MongoTargetUnboundDatabase extends MongoTargetDatabase {
|
|
92
|
+
static instance = new MongoTargetUnboundDatabase();
|
|
93
|
+
constructor() {
|
|
94
|
+
super({ id: UNBOUND_NAMESPACE_ID });
|
|
95
|
+
}
|
|
96
|
+
qualifier() {
|
|
97
|
+
return "";
|
|
98
|
+
}
|
|
99
|
+
qualifyCollection(collectionName) {
|
|
100
|
+
return collectionName;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
var MongoTargetContractSerializer = class extends MongoContractSerializerBase {
|
|
104
|
+
constructTargetContract(validated) {
|
|
105
|
+
const { storage, ...rest } = validated;
|
|
106
|
+
const namespaces = Object.fromEntries(Object.entries(storage.namespaces).map(([nsId, nsData]) => {
|
|
107
|
+
const collectionCount = Object.keys(nsData.entries.collection ?? {}).length;
|
|
108
|
+
const valueSetCount = Object.keys(nsData.entries["valueSet"] ?? {}).length;
|
|
109
|
+
if (nsId === UNBOUND_NAMESPACE_ID && collectionCount === 0 && valueSetCount === 0) return [nsId, MongoTargetUnboundDatabase.instance];
|
|
110
|
+
const dbInput = { id: nsData.id };
|
|
111
|
+
if (nsData.entries["collection"] !== void 0 || nsData.entries["valueSet"] !== void 0) dbInput.entries = {
|
|
112
|
+
collection: blindCast(nsData.entries["collection"] ?? {}),
|
|
113
|
+
...ifDefined("valueSet", blindCast(nsData.entries["valueSet"]))
|
|
114
|
+
};
|
|
115
|
+
return [nsId, new MongoTargetDatabase(dbInput)];
|
|
116
|
+
}));
|
|
117
|
+
const targetStorage = new MongoStorage({
|
|
118
|
+
storageHash: storage.storageHash,
|
|
119
|
+
namespaces
|
|
120
|
+
});
|
|
121
|
+
return {
|
|
122
|
+
...rest,
|
|
123
|
+
storage: targetStorage
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
serializeContract(contract) {
|
|
127
|
+
const { storage, ...rest } = contract;
|
|
128
|
+
const namespacesJson = {};
|
|
129
|
+
for (const [nsId, ns] of Object.entries(storage.namespaces)) {
|
|
130
|
+
const collectionsOut = {};
|
|
131
|
+
for (const [collName, coll] of Object.entries(ns.entries.collection ?? {})) collectionsOut[collName] = blindCast(JSON.parse(JSON.stringify(coll)));
|
|
132
|
+
const valueSetOut = {};
|
|
133
|
+
for (const [vsName, vs] of Object.entries(ns.entries.valueSet ?? {})) valueSetOut[vsName] = blindCast(JSON.parse(JSON.stringify(vs)));
|
|
134
|
+
namespacesJson[nsId] = {
|
|
135
|
+
id: ns.id,
|
|
136
|
+
kind: "mongo-database",
|
|
137
|
+
entries: {
|
|
138
|
+
collection: collectionsOut,
|
|
139
|
+
...ifDefined("valueSet", Object.keys(valueSetOut).length > 0 ? valueSetOut : void 0)
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
return blindCast({
|
|
144
|
+
...rest,
|
|
145
|
+
storage: {
|
|
146
|
+
storageHash: String(storage.storageHash),
|
|
147
|
+
namespaces: namespacesJson
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
28
153
|
* The single module a scaffolded Mongo `migration.ts` imports from: the
|
|
29
154
|
* operation factories below, plus the `Migration` base and `MigrationCLI`
|
|
30
155
|
* that `render-typescript.ts` adds. The authored name; `render-typescript.ts`
|
|
@@ -532,9 +657,6 @@ function planMutableOptionsDiffCall(collName, origin, dest) {
|
|
|
532
657
|
operationClass: desiredCSPPI.enabled ? "widening" : "destructive"
|
|
533
658
|
});
|
|
534
659
|
}
|
|
535
|
-
function mongoTargetError(code, message, options) {
|
|
536
|
-
return structuredError(code, message, options);
|
|
537
|
-
}
|
|
538
660
|
function isRecord(value) {
|
|
539
661
|
return value !== null && typeof value === "object";
|
|
540
662
|
}
|
|
@@ -1330,133 +1452,6 @@ var MongoMigrationRunner = class {
|
|
|
1330
1452
|
}
|
|
1331
1453
|
};
|
|
1332
1454
|
/**
|
|
1333
|
-
* Mongo target `Namespace` concretion. In Mongo the "namespace" concept
|
|
1334
|
-
* binds to the connection's `db` field — a `MongoTargetDatabase` instance
|
|
1335
|
-
* names the database the collections live under. `entries['collection']`
|
|
1336
|
-
* holds collection IR. The unbound singleton (below) is the late-bound
|
|
1337
|
-
* namespace whose binding the connection's `db` resolves at runtime rather
|
|
1338
|
-
* than at authoring time.
|
|
1339
|
-
*
|
|
1340
|
-
* Qualifier emission is the rendering seam: query / DDL emission asks the
|
|
1341
|
-
* namespace for its qualifier (e.g. `"<db>.<collection>"`) and consumes
|
|
1342
|
-
* the result polymorphically. The unbound singleton overrides these
|
|
1343
|
-
* methods to elide the prefix entirely — call sites stay polymorphic and
|
|
1344
|
-
* never branch on `id === UNBOUND_NAMESPACE_ID`.
|
|
1345
|
-
*/
|
|
1346
|
-
var MongoTargetDatabase = class extends NamespaceBase {
|
|
1347
|
-
id;
|
|
1348
|
-
entries;
|
|
1349
|
-
constructor(input) {
|
|
1350
|
-
super();
|
|
1351
|
-
this.id = input.id;
|
|
1352
|
-
const rawEntries = {
|
|
1353
|
-
collection: {},
|
|
1354
|
-
...input.entries
|
|
1355
|
-
};
|
|
1356
|
-
this.entries = Object.freeze(blindCast(hydrateNamespaceEntities(rawEntries, composeMongoEntityKinds(), "carry")));
|
|
1357
|
-
Object.defineProperty(this, "kind", {
|
|
1358
|
-
value: "database",
|
|
1359
|
-
writable: false,
|
|
1360
|
-
enumerable: false,
|
|
1361
|
-
configurable: true
|
|
1362
|
-
});
|
|
1363
|
-
freezeNode(this);
|
|
1364
|
-
}
|
|
1365
|
-
get collection() {
|
|
1366
|
-
return this.entries.collection ?? Object.freeze({});
|
|
1367
|
-
}
|
|
1368
|
-
/**
|
|
1369
|
-
* The bare qualifier as it would appear in a rendered string. The
|
|
1370
|
-
* unbound-database singleton overrides this to return `''`.
|
|
1371
|
-
*/
|
|
1372
|
-
qualifier() {
|
|
1373
|
-
return this.id;
|
|
1374
|
-
}
|
|
1375
|
-
/**
|
|
1376
|
-
* Qualify a collection name with the database prefix. The
|
|
1377
|
-
* unbound-database singleton overrides this to emit just the
|
|
1378
|
-
* collection name. Used by emission/introspection paths that need a
|
|
1379
|
-
* fully-qualified reference.
|
|
1380
|
-
*/
|
|
1381
|
-
qualifyCollection(collectionName) {
|
|
1382
|
-
return `${this.id}.${collectionName}`;
|
|
1383
|
-
}
|
|
1384
|
-
};
|
|
1385
|
-
/**
|
|
1386
|
-
* Singleton subclass for the reserved sentinel namespace id
|
|
1387
|
-
* (`UNBOUND_NAMESPACE_ID`) — the late-bound namespace whose binding the
|
|
1388
|
-
* connection's `db` resolves at runtime. Overrides qualifier emission
|
|
1389
|
-
* to elide the database prefix; call sites that consume `qualifier()`
|
|
1390
|
-
* / `qualifyCollection()` get unqualified output without branching on
|
|
1391
|
-
* the namespace id.
|
|
1392
|
-
*
|
|
1393
|
-
* This is the target-side materialization of "the framework provides
|
|
1394
|
-
* affordances; targets implement specifics": the framework names the
|
|
1395
|
-
* sentinel; Mongo decides what late-bound means here (the collection
|
|
1396
|
-
* name, naked — the database is supplied by the live connection).
|
|
1397
|
-
*/
|
|
1398
|
-
var MongoTargetUnboundDatabase = class MongoTargetUnboundDatabase extends MongoTargetDatabase {
|
|
1399
|
-
static instance = new MongoTargetUnboundDatabase();
|
|
1400
|
-
constructor() {
|
|
1401
|
-
super({ id: UNBOUND_NAMESPACE_ID });
|
|
1402
|
-
}
|
|
1403
|
-
qualifier() {
|
|
1404
|
-
return "";
|
|
1405
|
-
}
|
|
1406
|
-
qualifyCollection(collectionName) {
|
|
1407
|
-
return collectionName;
|
|
1408
|
-
}
|
|
1409
|
-
};
|
|
1410
|
-
var MongoTargetContractSerializer = class extends MongoContractSerializerBase {
|
|
1411
|
-
constructTargetContract(validated) {
|
|
1412
|
-
const { storage, ...rest } = validated;
|
|
1413
|
-
const namespaces = Object.fromEntries(Object.entries(storage.namespaces).map(([nsId, nsData]) => {
|
|
1414
|
-
const collectionCount = Object.keys(nsData.entries.collection ?? {}).length;
|
|
1415
|
-
const valueSetCount = Object.keys(nsData.entries["valueSet"] ?? {}).length;
|
|
1416
|
-
if (nsId === UNBOUND_NAMESPACE_ID && collectionCount === 0 && valueSetCount === 0) return [nsId, MongoTargetUnboundDatabase.instance];
|
|
1417
|
-
const dbInput = { id: nsData.id };
|
|
1418
|
-
if (nsData.entries["collection"] !== void 0 || nsData.entries["valueSet"] !== void 0) dbInput.entries = {
|
|
1419
|
-
collection: blindCast(nsData.entries["collection"] ?? {}),
|
|
1420
|
-
...ifDefined("valueSet", blindCast(nsData.entries["valueSet"]))
|
|
1421
|
-
};
|
|
1422
|
-
return [nsId, new MongoTargetDatabase(dbInput)];
|
|
1423
|
-
}));
|
|
1424
|
-
const targetStorage = new MongoStorage({
|
|
1425
|
-
storageHash: storage.storageHash,
|
|
1426
|
-
namespaces
|
|
1427
|
-
});
|
|
1428
|
-
return {
|
|
1429
|
-
...rest,
|
|
1430
|
-
storage: targetStorage
|
|
1431
|
-
};
|
|
1432
|
-
}
|
|
1433
|
-
serializeContract(contract) {
|
|
1434
|
-
const { storage, ...rest } = contract;
|
|
1435
|
-
const namespacesJson = {};
|
|
1436
|
-
for (const [nsId, ns] of Object.entries(storage.namespaces)) {
|
|
1437
|
-
const collectionsOut = {};
|
|
1438
|
-
for (const [collName, coll] of Object.entries(ns.entries.collection ?? {})) collectionsOut[collName] = blindCast(JSON.parse(JSON.stringify(coll)));
|
|
1439
|
-
const valueSetOut = {};
|
|
1440
|
-
for (const [vsName, vs] of Object.entries(ns.entries.valueSet ?? {})) valueSetOut[vsName] = blindCast(JSON.parse(JSON.stringify(vs)));
|
|
1441
|
-
namespacesJson[nsId] = {
|
|
1442
|
-
id: ns.id,
|
|
1443
|
-
kind: "mongo-database",
|
|
1444
|
-
entries: {
|
|
1445
|
-
collection: collectionsOut,
|
|
1446
|
-
...ifDefined("valueSet", Object.keys(valueSetOut).length > 0 ? valueSetOut : void 0)
|
|
1447
|
-
}
|
|
1448
|
-
};
|
|
1449
|
-
}
|
|
1450
|
-
return blindCast({
|
|
1451
|
-
...rest,
|
|
1452
|
-
storage: {
|
|
1453
|
-
storageHash: String(storage.storageHash),
|
|
1454
|
-
namespaces: namespacesJson
|
|
1455
|
-
}
|
|
1456
|
-
});
|
|
1457
|
-
}
|
|
1458
|
-
};
|
|
1459
|
-
/**
|
|
1460
1455
|
* Mongo target `SchemaVerifier` concretion. Extends the family base's
|
|
1461
1456
|
* namespace-walk scaffolding and contributes the per-namespace diff via
|
|
1462
1457
|
* `verifyNamespace`; the diff body reuses the existing target-side
|
|
@@ -1560,7 +1555,7 @@ const mongoTargetDescriptor = {
|
|
|
1560
1555
|
createRunner(family) {
|
|
1561
1556
|
let cachedDeps;
|
|
1562
1557
|
const runMongo = async (driver, runnerOptions) => {
|
|
1563
|
-
cachedDeps ??=
|
|
1558
|
+
cachedDeps ??= family.createRunnerDependencies({ driver });
|
|
1564
1559
|
return new MongoMigrationRunner(cachedDeps).execute({
|
|
1565
1560
|
...runnerOptions,
|
|
1566
1561
|
destinationContract: blindCast(runnerOptions.destinationContract)
|
|
@@ -1605,4 +1600,4 @@ const mongoTargetDescriptor = {
|
|
|
1605
1600
|
//#endregion
|
|
1606
1601
|
export { renderCallsToTypeScript as _, DropIndexCall as a, schemaIndexToCreateIndexOptions as b, MongoMigrationRunner as c, MongoTargetSchemaVerifier as d, MongoTargetUnboundDatabase as f, mongoTargetDescriptor as g, deserializeMongoOps as h, DropCollectionCall as i, MongoTargetContractSerializer as l, deserializeMongoOp as m, CreateCollectionCall as n, FilterEvaluator as o, PlannerProducedMongoMigration as p, CreateIndexCall as r, MongoMigrationPlanner as s, CollModCall as t, MongoTargetDatabase as u, renderOps as v, serializeMongoOps as x, schemaCollectionToCreateCollectionOptions as y };
|
|
1607
1602
|
|
|
1608
|
-
//# sourceMappingURL=control-
|
|
1603
|
+
//# sourceMappingURL=control-DESRWr7S.mjs.map
|