@prisma/orm-family-mongo 8.0.0-rc.21-dev.19 → 8.0.0-rc.21-dev.21
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/{contract-builder-Bhh9_UPS.d.mts → contract-builder-CKAOYSpC.d.mts} +2 -8
- package/dist/contract-builder-CKAOYSpC.d.mts.map +1 -0
- package/dist/{contract-builder-DzeVnjsm.mjs → contract-builder-bpLBqNm-.mjs} +33 -47
- package/dist/contract-builder-bpLBqNm-.mjs.map +1 -0
- package/dist/contract-prisma6__provider.mjs +6 -14
- package/dist/contract-prisma6__provider.mjs.map +1 -1
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__provider.mjs +1 -1
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/contract-ts.d.mts +1 -1
- package/dist/contract-ts.mjs +1 -1
- package/dist/contract-ts__contract-builder.d.mts +1 -1
- package/dist/contract-ts__contract-builder.mjs +1 -1
- package/dist/contract.d.mts +2 -2
- package/dist/contract.mjs +2 -2
- package/dist/{control-D_aaZj4g.mjs → control-CVeZGRjw.mjs} +5 -5
- package/dist/{control-D_aaZj4g.mjs.map → control-CVeZGRjw.mjs.map} +1 -1
- package/dist/{control-7qLrKCcY.d.mts → control-Cpgdr11Q.d.mts} +5 -5
- package/dist/{control-7qLrKCcY.d.mts.map → control-Cpgdr11Q.d.mts.map} +1 -1
- package/dist/{control-BdNzdZKQ.d.mts → control-DVHcBUoh.d.mts} +2 -2
- package/dist/{control-BdNzdZKQ.d.mts.map → control-DVHcBUoh.d.mts.map} +1 -1
- package/dist/{control-adapter-CLIE-kQU-Bp01Cd9h.d.mts → control-adapter-BheElqfe-BVp5aOMr.d.mts} +6 -6
- package/dist/{control-adapter-CLIE-kQU-Bp01Cd9h.d.mts.map → control-adapter-BheElqfe-BVp5aOMr.d.mts.map} +1 -1
- package/dist/control-adapter-CGIKt9Hq.d.mts +1 -0
- package/dist/{dist-CroOs9BN.mjs → dist-BPlVwyAb.mjs} +40 -2
- package/dist/dist-BPlVwyAb.mjs.map +1 -0
- package/dist/dist-BhDqnAiz.mjs.map +1 -1
- package/dist/{dist-B1afy6LD.mjs → dist-BwYedu6-.mjs} +2 -2
- package/dist/{dist-B1afy6LD.mjs.map → dist-BwYedu6-.mjs.map} +1 -1
- package/dist/{execution-BCgTPyx1.d.mts → execution-CZhOXkot.d.mts} +2 -2
- package/dist/{execution-BCgTPyx1.d.mts.map → execution-CZhOXkot.d.mts.map} +1 -1
- package/dist/{exports-BAimNKOs.mjs → exports-B2tu3O-g.mjs} +3 -41
- package/dist/exports-B2tu3O-g.mjs.map +1 -0
- package/dist/family.d.mts +9 -9
- package/dist/family.mjs +7 -7
- package/dist/family__control-adapter.d.mts +2 -2
- package/dist/family__control.d.mts +1 -1
- package/dist/family__control.mjs +2 -2
- package/dist/family__ir.d.mts +2 -2
- package/dist/family__ir.mjs +3 -3
- package/dist/family__migration.d.mts +1 -1
- package/dist/family__migration.mjs +1 -1
- package/dist/family__pack.mjs +1 -1
- package/dist/family__runtime.d.mts +2 -2
- package/dist/family__runtime.mjs +1 -1
- package/dist/family__schema-verify.d.mts +1 -1
- package/dist/family__schema-verify.mjs +1 -1
- package/dist/{field-accessor-CqKt9hxI-BmcdFwrk.d.mts → field-accessor-CqKt9hxI-Co64FQ3V.d.mts} +3 -3
- package/dist/{field-accessor-CqKt9hxI-BmcdFwrk.d.mts.map → field-accessor-CqKt9hxI-Co64FQ3V.d.mts.map} +1 -1
- package/dist/{index-CgvlbMOw.d.mts → index-B3o8NFNH.d.mts} +17 -3
- package/dist/index-B3o8NFNH.d.mts.map +1 -0
- package/dist/{index-BvhsteM2.d.mts → index-Bh6a8q-2.d.mts} +10 -7
- package/dist/{index-BvhsteM2.d.mts.map → index-Bh6a8q-2.d.mts.map} +1 -1
- package/dist/{index-LvXZZ_jC.d.mts → index-BonKbeyU.d.mts} +102 -110
- package/dist/index-BonKbeyU.d.mts.map +1 -0
- package/dist/{index-BmMMEdyQ.d.mts → index-D9TThYU9.d.mts} +3 -3
- package/dist/{index-BmMMEdyQ.d.mts.map → index-D9TThYU9.d.mts.map} +1 -1
- package/dist/{interpreter-DqVj74Rn-DgfRcygL.mjs → interpreter-K6G8SumZ-DVZw4CFe.mjs} +5 -7
- package/dist/interpreter-K6G8SumZ-DVZw4CFe.mjs.map +1 -0
- package/dist/{ir-FZi5ql4K.mjs → ir-C7oVYJg2.mjs} +2 -2
- package/dist/{ir-FZi5ql4K.mjs.map → ir-C7oVYJg2.mjs.map} +1 -1
- package/dist/{ir-MBl4vT_o.d.mts → ir-ZONNL1YV.d.mts} +3 -3
- package/dist/{ir-MBl4vT_o.d.mts.map → ir-ZONNL1YV.d.mts.map} +1 -1
- package/dist/lowering.d.mts +2 -2
- package/dist/{migration-KD7yy64Y.mjs → migration-C0N4Uamo.mjs} +2 -2
- package/dist/{migration-KD7yy64Y.mjs.map → migration-C0N4Uamo.mjs.map} +1 -1
- package/dist/{migration-xxic7RBq.d.mts → migration-RzYuoweU.d.mts} +4 -4
- package/dist/{migration-xxic7RBq.d.mts.map → migration-RzYuoweU.d.mts.map} +1 -1
- package/dist/{mongo-contract-serializer-BBknnHWy-yE74wFbz.mjs → mongo-contract-serializer-BBknnHWy-CZOnQGdR.mjs} +2 -2
- package/dist/{mongo-contract-serializer-BBknnHWy-yE74wFbz.mjs.map → mongo-contract-serializer-BBknnHWy-CZOnQGdR.mjs.map} +1 -1
- package/dist/{mongo-contract-view-AnejqfrQ-DJ2JKgA-.d.mts → mongo-contract-view-AnejqfrQ-k0FbFieN.d.mts} +2 -2
- package/dist/{mongo-contract-view-AnejqfrQ-DJ2JKgA-.d.mts.map → mongo-contract-view-AnejqfrQ-k0FbFieN.d.mts.map} +1 -1
- package/dist/{mongo-contract-view-CF5trX6R-D_Bus9dt.mjs → mongo-contract-view-CF5trX6R-BCPkEgiL.mjs} +3 -3
- package/dist/{mongo-contract-view-CF5trX6R-D_Bus9dt.mjs.map → mongo-contract-view-CF5trX6R-BCPkEgiL.mjs.map} +1 -1
- package/dist/orm.d.mts +2 -2
- package/dist/orm.mjs +2 -2
- package/dist/query-ast.d.mts +2 -2
- package/dist/query-ast__control.d.mts +1 -1
- package/dist/query-ast__execution.d.mts +1 -1
- package/dist/query-builder.d.mts +3 -3
- package/dist/query-builder.mjs +1 -1
- package/dist/query-builder__contract-free.d.mts +3 -3
- package/dist/{runtime-CXoFcIme.d.mts → runtime-D_E5N6Ii.d.mts} +2 -2
- package/dist/runtime-D_E5N6Ii.d.mts.map +1 -0
- package/dist/runtime.d.mts +21 -10
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +19 -3
- package/dist/runtime.mjs.map +1 -1
- package/dist/schema-ir.d.mts +2 -2
- package/dist/schema-ir.mjs +2 -2
- package/dist/{schema-verify-DldhIjOX.d.mts → schema-verify-BTRGeQWE.d.mts} +3 -3
- package/dist/{schema-verify-DldhIjOX.d.mts.map → schema-verify-BTRGeQWE.d.mts.map} +1 -1
- package/dist/{verify-mongo-schema-nsnAhPm8-DvsVH5bL.mjs → verify-mongo-schema-CyvUewwP-Dl3QC2wh.mjs} +24 -6
- package/dist/verify-mongo-schema-CyvUewwP-Dl3QC2wh.mjs.map +1 -0
- package/dist/wire.d.mts +2 -2
- package/package.json +20 -20
- package/dist/contract-builder-Bhh9_UPS.d.mts.map +0 -1
- package/dist/contract-builder-DzeVnjsm.mjs.map +0 -1
- package/dist/control-adapter-DoykpdEX.d.mts +0 -1
- package/dist/dist-CroOs9BN.mjs.map +0 -1
- package/dist/exports-BAimNKOs.mjs.map +0 -1
- package/dist/index-CgvlbMOw.d.mts.map +0 -1
- package/dist/index-LvXZZ_jC.d.mts.map +0 -1
- package/dist/interpreter-DqVj74Rn-DgfRcygL.mjs.map +0 -1
- package/dist/runtime-CXoFcIme.d.mts.map +0 -1
- package/dist/verify-mongo-schema-nsnAhPm8-DvsVH5bL.mjs.map +0 -1
package/dist/query-builder.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { B as MongoModelStorage, C as MongoContract, V as MongoModelsMap, lt as RootModelName, n as ExtractMongoCodecTypes, t as AnyMongoTypeMaps, w as MongoContractWithTypeMaps } from "./mongo-value-set-DAGBOegv-B0Vel8d-.mjs";
|
|
2
|
-
import "./index-
|
|
2
|
+
import "./index-B3o8NFNH.mjs";
|
|
3
3
|
import { f as MongoValue } from "./index-9DDQlC5U.mjs";
|
|
4
4
|
import { B as MongoFilterExpr, L as MongoFieldShape, Mt as UpdateManyCommand, Nt as UpdateOneCommand, R as MongoFillOutput, a as DeleteOneCommand, c as InsertManyCommand, d as MongoAggAccumulator, et as MongoPipelineStage, i as DeleteManyCommand, j as MongoDensifyRange, l as InsertOneCommand, m as MongoAggExpr, n as AggregateCommand, o as FindOneAndDeleteCommand, ot as MongoResultShape, r as AnyMongoCommand, rt as MongoQueryPlan, s as FindOneAndUpdateCommand, vt as MongoUpdatePipelineStage, xt as MongoWindowField } from "./query-plan-C7sSU3Al-wzsJKtml.mjs";
|
|
5
|
-
import { a as InsertOneResult, i as InsertManyResult, r as DeleteResult, s as MongoExecutionContext, u as UpdateResult } from "./execution-
|
|
6
|
-
import { A as TypedUpdateOp, C as ProjectedShape, D as StringField, E as SortSpec, F as expr, M as UpdaterResult, N as ValidPaths, O as TypedAccumulatorExpr, P as createFieldAccessor, S as PathCompletions, T as ResolveRow, _ as NullableDocField, a as DocShape, b as ObjectExpression, c as FieldAccessor, d as LeafExpression, f as LiteralValue, g as NestedDocShape, h as ModelToDocShape, i as DocField, j as UnwoundShape, k as TypedAggExpr, l as GroupSpec, m as ModelNestedShape, n as BooleanField, o as Expression, p as ModelArrayField, r as DateField, s as ExtractDocShape, t as ArrayField, u as GroupedDocShape, v as NullableNumericField, w as ResolvePath, x as ObjectField, y as NumericField } from "./field-accessor-CqKt9hxI-
|
|
5
|
+
import { a as InsertOneResult, i as InsertManyResult, r as DeleteResult, s as MongoExecutionContext, u as UpdateResult } from "./execution-CZhOXkot.mjs";
|
|
6
|
+
import { A as TypedUpdateOp, C as ProjectedShape, D as StringField, E as SortSpec, F as expr, M as UpdaterResult, N as ValidPaths, O as TypedAccumulatorExpr, P as createFieldAccessor, S as PathCompletions, T as ResolveRow, _ as NullableDocField, a as DocShape, b as ObjectExpression, c as FieldAccessor, d as LeafExpression, f as LiteralValue, g as NestedDocShape, h as ModelToDocShape, i as DocField, j as UnwoundShape, k as TypedAggExpr, l as GroupSpec, m as ModelNestedShape, n as BooleanField, o as Expression, p as ModelArrayField, r as DateField, s as ExtractDocShape, t as ArrayField, u as GroupedDocShape, v as NullableNumericField, w as ResolvePath, x as ObjectField, y as NumericField } from "./field-accessor-CqKt9hxI-Co64FQ3V.mjs";
|
|
7
7
|
import { ContractField, ContractModel, StorageBase } from "@prisma/orm-framework/contract/types";
|
|
8
8
|
//#region ../../../2-mongo-family/5-query-builders/query-builder/dist/index.d.mts
|
|
9
9
|
//#region src/accumulator-helpers.d.ts
|
package/dist/query-builder.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as expr, t as createFieldAccessor } from "./field-accessor-0oUt6RZC-BjNwSinZ.mjs";
|
|
2
|
-
import { a as contractFieldToMongoFieldShape, c as mongoQuery, i as acc, n as FilteredCollection, o as contractModelToMongoResultShape, r as PipelineChain, s as fn, t as CollectionHandle } from "./dist-
|
|
2
|
+
import { a as contractFieldToMongoFieldShape, c as mongoQuery, i as acc, n as FilteredCollection, o as contractModelToMongoResultShape, r as PipelineChain, s as fn, t as CollectionHandle } from "./dist-BwYedu6-.mjs";
|
|
3
3
|
export { CollectionHandle, FilteredCollection, PipelineChain, acc, contractFieldToMongoFieldShape, contractModelToMongoResultShape, createFieldAccessor, expr, fn, mongoQuery };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { A as MongoIndexKey } from "./mongo-value-set-DAGBOegv-B0Vel8d-.mjs";
|
|
2
2
|
import { f as MongoValue } from "./index-9DDQlC5U.mjs";
|
|
3
3
|
import { B as MongoFilterExpr, et as MongoPipelineStage, l as InsertOneCommand, n as AggregateCommand, s as FindOneAndUpdateCommand } from "./query-plan-C7sSU3Al-wzsJKtml.mjs";
|
|
4
|
-
import { c as CreateIndexCommand, l as CreateIndexOptions, o as CreateCollectionCommand, s as CreateCollectionOptions } from "./control-
|
|
5
|
-
import "./execution-
|
|
6
|
-
import { M as UpdaterResult, a as DocShape, c as FieldAccessor } from "./field-accessor-CqKt9hxI-
|
|
4
|
+
import { c as CreateIndexCommand, l as CreateIndexOptions, o as CreateCollectionCommand, s as CreateCollectionOptions } from "./control-DVHcBUoh.mjs";
|
|
5
|
+
import "./execution-CZhOXkot.mjs";
|
|
6
|
+
import { M as UpdaterResult, a as DocShape, c as FieldAccessor } from "./field-accessor-CqKt9hxI-Co64FQ3V.mjs";
|
|
7
7
|
//#region ../../../2-mongo-family/5-query-builders/query-builder/dist/exports/contract-free.d.mts
|
|
8
8
|
//#region src/contract-free/collection.d.ts
|
|
9
9
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./index-
|
|
1
|
+
import "./index-B3o8NFNH.mjs";
|
|
2
2
|
import { RuntimeMutationDefaultGenerator } from "@prisma/orm-framework/components/runtime";
|
|
3
3
|
//#region ../../../2-mongo-family/9-family/dist/runtime.d.mts
|
|
4
4
|
//#region src/core/timestamp-now-runtime-generator.d.ts
|
|
@@ -8,4 +8,4 @@ import { RuntimeMutationDefaultGenerator } from "@prisma/orm-framework/component
|
|
|
8
8
|
declare function timestampNowRuntimeGenerator(): RuntimeMutationDefaultGenerator;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { timestampNowRuntimeGenerator as t };
|
|
11
|
-
//# sourceMappingURL=runtime-
|
|
11
|
+
//# sourceMappingURL=runtime-D_E5N6Ii.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-D_E5N6Ii.d.mts","names":[],"sources":["../../../../2-mongo-family/9-family/dist/runtime.d.mts"],"mappings":";;;;;;;iBAMiB,gCAAgC"}
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { r as MongoCodecRegistry } from "./index-CQG5l2o9.mjs";
|
|
2
2
|
import { C as MongoContract } from "./mongo-value-set-DAGBOegv-B0Vel8d-.mjs";
|
|
3
|
-
import "./index-
|
|
3
|
+
import "./index-B3o8NFNH.mjs";
|
|
4
4
|
import { l as MongoParamRef } from "./index-9DDQlC5U.mjs";
|
|
5
5
|
import { ot as MongoResultShape, rt as MongoQueryPlan } from "./query-plan-C7sSU3Al-wzsJKtml.mjs";
|
|
6
|
-
import { d as enumMemberCodecFor, o as MongoCodecLookup, s as MongoExecutionContext } from "./execution-
|
|
7
|
-
import { r as AnyMongoDmlWireCommand } from "./index-
|
|
8
|
-
import { a as MongoLoweredDraft, i as MongoDriver, t as MongoAdapter } from "./index-
|
|
6
|
+
import { d as enumMemberCodecFor, o as MongoCodecLookup, s as MongoExecutionContext } from "./execution-CZhOXkot.mjs";
|
|
7
|
+
import { r as AnyMongoDmlWireCommand } from "./index-D9TThYU9.mjs";
|
|
8
|
+
import { a as MongoLoweredDraft, i as MongoDriver, t as MongoAdapter } from "./index-Bh6a8q-2.mjs";
|
|
9
9
|
import { Activity, ActivityContext, ActivityEndedResult, ActivityFinalizedResult, AsyncIterableResult, ExecuteInterceptResult, ExecutionPlan, MutationDefaultGeneratorContributor, ParamRefMutator, QueryInterceptResult, RuntimeExecuteOptions, RuntimeMiddleware, RuntimeMode, RuntimeStatementStats } from "@prisma/orm-framework/components/runtime";
|
|
10
|
-
import { RuntimeAdapterDescriptor, RuntimeAdapterInstance, RuntimeExtensionDescriptor, RuntimeExtensionInstance, RuntimeTargetDescriptor, RuntimeTargetInstance, RuntimeTargetInstance as RuntimeTargetInstance$1 } from "@prisma/orm-framework/components/execution";
|
|
10
|
+
import { RuntimeAdapterDescriptor, RuntimeAdapterInstance, RuntimeDriverDescriptor, RuntimeDriverInstance, RuntimeExtensionDescriptor, RuntimeExtensionInstance, RuntimeTargetDescriptor, RuntimeTargetInstance, RuntimeTargetInstance as RuntimeTargetInstance$1 } from "@prisma/orm-framework/components/execution";
|
|
11
11
|
//#region ../../../2-mongo-family/7-runtime/dist/index.d.mts
|
|
12
12
|
//#region src/mongo-execution-plan.d.ts
|
|
13
13
|
/**
|
|
@@ -60,18 +60,29 @@ interface MongoRuntimeExtensionDescriptor<TTargetId extends string = 'mongo'> ex
|
|
|
60
60
|
create(): MongoRuntimeExtensionInstance<TTargetId>;
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
|
-
* The Mongo execution stack: target + adapter + extension packs. Mirrors `SqlExecutionStack`. Constructed via `createMongoExecutionStack
|
|
63
|
+
* The Mongo execution stack: target + adapter + extension packs. Mirrors `SqlExecutionStack`. Constructed via `createMongoExecutionStack`; given a driver, it returns a {@link MongoExecutionStackWithDriver}.
|
|
64
64
|
*/
|
|
65
65
|
interface MongoExecutionStack<TTargetId extends string = 'mongo'> {
|
|
66
66
|
readonly target: MongoRuntimeTargetDescriptor<TTargetId>;
|
|
67
67
|
readonly adapter: MongoRuntimeAdapterDescriptor<TTargetId>;
|
|
68
68
|
readonly extensions: readonly MongoRuntimeExtensionDescriptor<TTargetId>[];
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
/**
|
|
71
|
+
* The binding type is erased to `unknown` here, as in `SqlRuntimeDriverInstance`. A target client such as `mongo()` resolves the concrete binding before it calls `driver.connect(binding)`.
|
|
72
|
+
*/
|
|
73
|
+
type MongoRuntimeDriverInstance<TTargetId extends string = 'mongo'> = RuntimeDriverInstance<'mongo', TTargetId> & MongoDriver<unknown>;
|
|
74
|
+
type MongoExecutionStackWithDriver<TTargetId extends string = 'mongo'> = MongoExecutionStack<TTargetId> & {
|
|
75
|
+
readonly driver: RuntimeDriverDescriptor<'mongo', TTargetId, unknown, MongoRuntimeDriverInstance<TTargetId>>;
|
|
76
|
+
};
|
|
77
|
+
interface MongoExecutionStackOptions<TTargetId extends string> {
|
|
71
78
|
readonly target: MongoRuntimeTargetDescriptor<TTargetId>;
|
|
72
79
|
readonly adapter: MongoRuntimeAdapterDescriptor<TTargetId>;
|
|
73
80
|
readonly extensions?: readonly MongoRuntimeExtensionDescriptor<TTargetId>[] | undefined;
|
|
74
|
-
}
|
|
81
|
+
}
|
|
82
|
+
declare function createMongoExecutionStack<TTargetId extends string = 'mongo'>(options: MongoExecutionStackOptions<TTargetId> & {
|
|
83
|
+
readonly driver: MongoExecutionStackWithDriver<TTargetId>['driver'];
|
|
84
|
+
}): MongoExecutionStackWithDriver<TTargetId>;
|
|
85
|
+
declare function createMongoExecutionStack<TTargetId extends string = 'mongo'>(options: MongoExecutionStackOptions<TTargetId>): MongoExecutionStack<TTargetId>;
|
|
75
86
|
declare function createMongoExecutionContext<TContract extends MongoContract = MongoContract, TTargetId extends string = 'mongo'>(options: {
|
|
76
87
|
readonly contract: TContract;
|
|
77
88
|
readonly stack: MongoExecutionStack<TTargetId>;
|
|
@@ -210,7 +221,7 @@ interface MongoMiddleware extends RuntimeMiddleware<MongoExecutionPlan, MongoPar
|
|
|
210
221
|
interface MongoRuntimeOptions {
|
|
211
222
|
readonly context: MongoExecutionContext;
|
|
212
223
|
readonly adapter: MongoAdapter;
|
|
213
|
-
readonly driver: MongoDriver
|
|
224
|
+
readonly driver: MongoDriver<unknown>;
|
|
214
225
|
readonly middleware?: readonly MongoMiddleware[];
|
|
215
226
|
readonly mode?: RuntimeMode;
|
|
216
227
|
}
|
|
@@ -242,5 +253,5 @@ interface MongoRuntime {
|
|
|
242
253
|
}
|
|
243
254
|
declare function createMongoRuntime(options: MongoRuntimeOptions): MongoRuntime;
|
|
244
255
|
//#endregion
|
|
245
|
-
export { type MongoCodecLookup, type MongoExecutionContext, type MongoExecutionPlan, type MongoExecutionStack, type MongoMiddleware, type MongoMiddlewareContext, type MongoParamRefEntry, type MongoParamRefEntryUnion, type MongoParamRefHandle, type MongoParamRefMutator, type MongoParamRefMutatorInternal, type MongoRuntime, type MongoRuntimeAdapterDescriptor, type MongoRuntimeAdapterInstance, type MongoRuntimeExtensionDescriptor, type MongoRuntimeExtensionInstance, type MongoRuntimeOptions, type MongoRuntimeTargetDescriptor, type MongoStaticContributions, type RuntimeTargetInstance, createMongoExecutionContext, createMongoExecutionStack, createMongoParamRefMutator, createMongoRuntime, enumMemberCodecFor, flattenMongoParamRefs };
|
|
256
|
+
export { type MongoCodecLookup, type MongoExecutionContext, type MongoExecutionPlan, type MongoExecutionStack, type MongoExecutionStackWithDriver, type MongoMiddleware, type MongoMiddlewareContext, type MongoParamRefEntry, type MongoParamRefEntryUnion, type MongoParamRefHandle, type MongoParamRefMutator, type MongoParamRefMutatorInternal, type MongoRuntime, type MongoRuntimeAdapterDescriptor, type MongoRuntimeAdapterInstance, type MongoRuntimeDriverInstance, type MongoRuntimeExtensionDescriptor, type MongoRuntimeExtensionInstance, type MongoRuntimeOptions, type MongoRuntimeTargetDescriptor, type MongoStaticContributions, type RuntimeTargetInstance, createMongoExecutionContext, createMongoExecutionStack, createMongoParamRefMutator, createMongoRuntime, enumMemberCodecFor, flattenMongoParamRefs };
|
|
246
257
|
//# sourceMappingURL=runtime.d.mts.map
|
package/dist/runtime.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../../../../2-mongo-family/7-runtime/dist/index.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA6BU,mBAAmB,uBAAuB,cAAc;;;;;;;;;WASvD,SAAS;WACT,cAAc;;;;;;;;;UASf,iCAAiC,KAAK;WACrC,cAAc;;UAEf,6BAA6B,oCAAoC,wBAAwB,iCAAiC,aAAa,iCAAiC,oBAAoB,iCAAiC,WAAW,kBAAkB;UAC1P,4BAA4B,4CAA4C,gCAAgC,YAAY;UACpH,8BAA8B,oCAAoC,yBAAyB,gCAAgC,aAAa,4BAA4B,oBAAoB,kCAAkC,WAAW,mBAAmB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Ae,MAAM,UAAU,wBAAwB,oBAAoB;EAC5F,QAAQ,MAAM,gBAAgB,UAAU,wBAAwB,QAAQ;EACxE,SAAS;;iBAEM,mBAAmB,SAAS,sBAAsB"}
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as newMongoCodecRegistry } from "./dist-Bgk36iLI.mjs";
|
|
2
2
|
import { t as MongoParamRef } from "./dist-CO2arS1K.mjs";
|
|
3
3
|
import { it as enumMemberCodecFor } from "./execution-BoVPgPvR.mjs";
|
|
4
|
-
import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
4
|
+
import { isStructuredError, structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
5
5
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
6
6
|
import { AsyncIterableResult, RuntimeCore, applyMutationDefaults, assertMutationDefaultGeneratorsAvailable, checkAborted, checkMiddlewareCompatibility, collectMutationDefaultGenerators, executeStatement, runtimeError, streamStatement } from "@prisma/orm-framework/components/runtime";
|
|
7
7
|
import { isInternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
@@ -12,14 +12,20 @@ import { hashContent } from "@prisma/orm-framework/utils/hash-content";
|
|
|
12
12
|
import { isPlainRecord } from "@prisma/orm-framework/contract/is-plain-record";
|
|
13
13
|
//#region ../../../2-mongo-family/7-runtime/dist/index.mjs
|
|
14
14
|
function createMongoExecutionStack(options) {
|
|
15
|
-
const { target, adapter, extensions } = createExecutionStack({
|
|
15
|
+
const { target, adapter, driver, extensions } = createExecutionStack({
|
|
16
16
|
target: options.target,
|
|
17
17
|
adapter: options.adapter,
|
|
18
|
+
driver: options.driver,
|
|
18
19
|
extensions: options.extensions
|
|
19
20
|
});
|
|
20
|
-
return {
|
|
21
|
+
return driver === void 0 ? {
|
|
22
|
+
target,
|
|
23
|
+
adapter,
|
|
24
|
+
extensions
|
|
25
|
+
} : {
|
|
21
26
|
target,
|
|
22
27
|
adapter,
|
|
28
|
+
driver,
|
|
23
29
|
extensions
|
|
24
30
|
};
|
|
25
31
|
}
|
|
@@ -508,11 +514,18 @@ function invalidStatisticsResult(commandKind, countField) {
|
|
|
508
514
|
countField
|
|
509
515
|
});
|
|
510
516
|
}
|
|
517
|
+
function runtimeClosedError() {
|
|
518
|
+
return structuredError("DRIVER.NOT_CONNECTED", "Runtime is closed", {
|
|
519
|
+
why: "close() was called on this runtime, or on the client or connection that owns it. An await using scope calls close() when it ends.",
|
|
520
|
+
fix: "Await every query before close(). The usual cause is a query returned without await from an await using scope."
|
|
521
|
+
});
|
|
522
|
+
}
|
|
511
523
|
var MongoRuntimeImpl = class extends RuntimeCore {
|
|
512
524
|
#adapter;
|
|
513
525
|
#driver;
|
|
514
526
|
#codecs;
|
|
515
527
|
#contextFields;
|
|
528
|
+
#closed = false;
|
|
516
529
|
constructor(options) {
|
|
517
530
|
const middleware = options.middleware ?? [];
|
|
518
531
|
for (const mw of middleware) checkMiddlewareCompatibility(mw, "mongo", options.context.contract.target);
|
|
@@ -547,6 +560,7 @@ var MongoRuntimeImpl = class extends RuntimeCore {
|
|
|
547
560
|
}
|
|
548
561
|
/* v8 ignore stop */
|
|
549
562
|
runDriver(exec) {
|
|
563
|
+
if (this.#closed) throw runtimeClosedError();
|
|
550
564
|
return this.#driver.execute(exec.command);
|
|
551
565
|
}
|
|
552
566
|
runExecute(exec) {
|
|
@@ -617,6 +631,7 @@ var MongoRuntimeImpl = class extends RuntimeCore {
|
|
|
617
631
|
});
|
|
618
632
|
}
|
|
619
633
|
async #readDriverStatistics(exec) {
|
|
634
|
+
if (this.#closed) throw runtimeClosedError();
|
|
620
635
|
const countField = statisticsCountField(exec.command.kind);
|
|
621
636
|
if (countField === void 0) throw runtimeError("RUNTIME.MONGO_STATISTICS_UNSUPPORTED", `Mongo command '${exec.command.kind}' does not expose statement statistics`, { commandKind: exec.command.kind });
|
|
622
637
|
let affectedRows;
|
|
@@ -630,6 +645,7 @@ var MongoRuntimeImpl = class extends RuntimeCore {
|
|
|
630
645
|
return { affectedRows };
|
|
631
646
|
}
|
|
632
647
|
async close() {
|
|
648
|
+
this.#closed = true;
|
|
633
649
|
await this.#driver.close();
|
|
634
650
|
}
|
|
635
651
|
};
|
package/dist/runtime.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.mjs","names":["#contextFields","#adapter","#driver","#codecs","#readDriverStatistics","#decodedRows"],"sources":["../../../../2-mongo-family/7-runtime/dist/index.mjs"],"sourcesContent":["import { enumMemberCodecFor } from \"@internal/mongo-query-ast/execution\";\nimport { createExecutionStack } from \"@internal/framework-components/execution\";\nimport { AsyncIterableResult, RuntimeCore, applyMutationDefaults, assertMutationDefaultGeneratorsAvailable, checkAborted, checkMiddlewareCompatibility, collectMutationDefaultGenerators, executeStatement, runtimeError, streamStatement } from \"@internal/framework-components/runtime\";\nimport { newMongoCodecRegistry } from \"@internal/mongo-codec\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { isInternalError } from \"@internal/utils/internal-error\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { canonicalStringify } from \"@internal/utils/canonical-stringify\";\nimport { hashContent } from \"@internal/utils/hash-content\";\nimport { isPlainRecord } from \"@internal/contract/is-plain-record\";\nimport { MongoParamRef } from \"@internal/mongo-value\";\n//#region src/mongo-execution-stack.ts\nfunction createMongoExecutionStack(options) {\n\tconst { target, adapter, extensions } = createExecutionStack({\n\t\ttarget: options.target,\n\t\tadapter: options.adapter,\n\t\textensions: options.extensions\n\t});\n\treturn {\n\t\ttarget,\n\t\tadapter,\n\t\textensions\n\t};\n}\nfunction createMongoExecutionContext(options) {\n\tconst registry = newMongoCodecRegistry();\n\tconst owners = /* @__PURE__ */ new Map();\n\tconst contributors = [\n\t\toptions.stack.target,\n\t\toptions.stack.adapter,\n\t\t...options.stack.extensions\n\t];\n\tconst generators = collectMutationDefaultGenerators(contributors);\n\tconst execution = options.contract.execution;\n\tassertMutationDefaultGeneratorsAvailable(execution, generators);\n\tfor (const contributor of contributors) {\n\t\tconst contributed = contributor.codecs();\n\t\tfor (const codec of iterateCodecs(contributed)) {\n\t\t\tconst existingOwner = owners.get(codec.id);\n\t\t\tif (existingOwner !== void 0) throw runtimeError(\"RUNTIME.DUPLICATE_CODEC\", `Duplicate Mongo codec id '${codec.id}' contributed by '${contributor.id}' (already registered by '${existingOwner}').`, {\n\t\t\t\tcodecId: codec.id,\n\t\t\t\texistingOwner,\n\t\t\t\tincomingOwner: contributor.id\n\t\t\t});\n\t\t\tregistry.register(codec);\n\t\t\towners.set(codec.id, contributor.id);\n\t\t}\n\t}\n\treturn Object.freeze({\n\t\tcontract: options.contract,\n\t\tcodecs: registry,\n\t\tapplyMutationDefaults: (mutation) => applyMutationDefaults(execution, generators, mutation)\n\t});\n}\nfunction* iterateCodecs(registry) {\n\tyield* registry.values();\n}\n//#endregion\n//#region src/codecs/decoding.ts\nconst WIRE_PREVIEW_LIMIT = 100;\nfunction truncate(text) {\n\treturn text.length > WIRE_PREVIEW_LIMIT ? `${text.substring(0, WIRE_PREVIEW_LIMIT)}...` : text;\n}\n/**\n* JSON text of the wire value, using each BSON class's own JSON form (an `ObjectId` as its hex string, a `Date` as ISO text), or `String(value)` when it has none.\n*/\nfunction previewWireValue(wireValue) {\n\tif (typeof wireValue === \"string\") return truncate(wireValue);\n\ttry {\n\t\treturn truncate(JSON.stringify(wireValue, (_key, value) => typeof value === \"bigint\" ? `${value}n` : value) ?? String(wireValue));\n\t} catch {\n\t\treturn truncate(String(wireValue));\n\t}\n}\nfunction hasHexString(value) {\n\treturn \"toHexString\" in value && typeof value.toHexString === \"function\";\n}\nfunction describeDocumentId(id) {\n\tif (id === void 0) return void 0;\n\tif (typeof id === \"string\") return JSON.stringify(id);\n\tif (typeof id === \"object\" && id !== null && hasHexString(id)) return id.toHexString();\n\treturn previewWireValue(id);\n}\n/**\n* Every decode failure names the collection and field, and the `_id` of the document when the row carries one; inside a document shape marked `row`, that document's `_id` and the field's path from it. A codec's own `RUNTIME.DECODE_FAILED` keeps its code and details, with the location added; any other structured envelope (a dotted `code`, per `isStructuredError`) and an `InternalError` pass through unchanged; everything else is wrapped in a `RUNTIME.DECODE_FAILED` envelope. The original error is the `cause`.\n*/\nfunction wrapDecodeFailure(error, location, codecId, wireValue) {\n\tif (isInternalError(error)) throw error;\n\tconst codecDetails = isStructuredError(error) ? error.meta : void 0;\n\tif (isStructuredError(error) && error.code !== \"RUNTIME.DECODE_FAILED\") throw error;\n\tconst { collection, path, documentId } = location;\n\tconst message = error instanceof Error ? error.message : String(error);\n\tconst wrapped = runtimeError(\"RUNTIME.DECODE_FAILED\", `Failed to decode field ${path}${documentId === void 0 ? \"\" : ` of the document with _id ${documentId}`} in collection '${collection}' with codec '${codecId}': ${message}`, {\n\t\t...codecDetails,\n\t\tcollection,\n\t\tpath,\n\t\t...ifDefined(\"documentId\", documentId),\n\t\tcodec: codecId,\n\t\twirePreview: previewWireValue(wireValue)\n\t});\n\twrapped.cause = error;\n\tthrow wrapped;\n}\n/**\n* A document may leave out a nullable field entirely (Prisma 6 and the driver both omit it); the field's type says `null`, so an absent value reads as `null`.\n*/\nfunction absentAsNull(value, nullable) {\n\treturn value === void 0 && nullable ? null : value;\n}\nasync function decodeMongoRow(row, shape, registry, collection, ctx = {}) {\n\tif (shape.kind === \"unknown\") return row;\n\tif (typeof row !== \"object\" || row === null) return row;\n\tconst rowObj = blindCast(row);\n\tconst out = {};\n\tconst tasks = [];\n\tfunction scheduleLeaf(path, documentId, codecId, wire, assign) {\n\t\tconst codec = registry.get(codecId);\n\t\tif (!codec) {\n\t\t\tassign(wire);\n\t\t\treturn;\n\t\t}\n\t\ttasks.push((async () => {\n\t\t\ttry {\n\t\t\t\tassign(await codec.fromWire(wire, ctx));\n\t\t\t} catch (error) {\n\t\t\t\twrapDecodeFailure(error, {\n\t\t\t\t\tcollection,\n\t\t\t\t\tpath,\n\t\t\t\t\tdocumentId\n\t\t\t\t}, codecId, wire);\n\t\t\t}\n\t\t})());\n\t}\n\tfunction walkField(value, fieldShape, path, documentId, assign) {\n\t\tswitch (fieldShape.kind) {\n\t\t\tcase \"unknown\":\n\t\t\t\tassign(value);\n\t\t\t\treturn;\n\t\t\tcase \"leaf\":\n\t\t\t\tif (value === null || value === void 0) {\n\t\t\t\t\tassign(absentAsNull(value, fieldShape.nullable));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tscheduleLeaf(path, documentId, fieldShape.codecId, value, assign);\n\t\t\t\treturn;\n\t\t\tcase \"document\": {\n\t\t\t\tif (value === null || value === void 0) {\n\t\t\t\t\tassign(absentAsNull(value, fieldShape.nullable));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n\t\t\t\t\tassign(value);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst vObj = blindCast(value);\n\t\t\t\tconst nested = { ...vObj };\n\t\t\t\tassign(nested);\n\t\t\t\tfor (const [fk, fShape] of Object.entries(fieldShape.fields)) walkField(vObj[fk], fShape, fieldShape.row ? fk : `${path}.${fk}`, fieldShape.row ? describeDocumentId(vObj[\"_id\"]) : documentId, (v) => {\n\t\t\t\t\tnested[fk] = v;\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase \"array\": {\n\t\t\t\tif (value === null || value === void 0) {\n\t\t\t\t\tassign(absentAsNull(value, fieldShape.nullable));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!Array.isArray(value)) {\n\t\t\t\t\tassign(value);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst arr = [];\n\t\t\t\tassign(arr);\n\t\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\t\tconst el = value[i];\n\t\t\t\t\twalkField(el, fieldShape.element, `${path}.${i}`, documentId, (v) => {\n\t\t\t\t\t\tarr[i] = v;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t/* v8 ignore stop */\n\t}\n\tconst documentId = describeDocumentId(rowObj[\"_id\"]);\n\tfor (const [k, fShape] of Object.entries(shape.fields)) walkField(rowObj[k], fShape, k, documentId, (v) => {\n\t\tout[k] = v;\n\t});\n\tfor (const k of Object.keys(rowObj)) if (!Object.hasOwn(shape.fields, k)) out[k] = rowObj[k];\n\tawait Promise.all(tasks);\n\treturn out;\n}\n//#endregion\n//#region src/content-hash.ts\n/** @internal */\nconst RUNTIME_CONTENT_HASH_REQUIRES_RESOLVED_COMMAND = \"RUNTIME.CONTENT_HASH_REQUIRES_RESOLVED_COMMAND\";\n/**\n* Resolved wire commands are frozen class instances (`InsertOneWireCommand`, …);\n* pre-resolve `beforeEncode` plans hold a plain-object `MongoLoweredDraft` in the\n* command slot. O(1) prototype check — no tree walk on the hot path.\n*/\nfunction isResolvedMongoWireCommand(command) {\n\tif (command === null || typeof command !== \"object\") return false;\n\tconst proto = Object.getPrototypeOf(command);\n\treturn proto !== null && proto !== Object.prototype;\n}\nfunction assertContentHashOnResolvedCommand(command) {\n\tif (isResolvedMongoWireCommand(command)) return;\n\tthrow runtimeError(RUNTIME_CONTENT_HASH_REQUIRES_RESOLVED_COMMAND, \"contentHash and computeMongoContentHash are only valid on a resolved wire command after parameter resolution. During a before hook, plan.command holds an unresolved MongoLoweredDraft — use params.entries() and the param mutator instead of contentHash or structural reads of plan.command.\", { phase: \"beforeEncode\" });\n}\n/**\n* Computes a stable content hash for a lowered Mongo execution plan.\n*\n* Internally builds an unambiguous canonical-stringified preimage from\n* two components:\n*\n* 1. `meta.storageHash` — discriminates by schema. A migration changes the\n* storage hash, which invalidates cached entries automatically (no\n* per-app invalidation logic needed for schema changes).\n* 2. `exec.command` — the wire command. `canonicalStringify` produces a\n* deterministic serialization that is stable across object key\n* insertion order and that distinguishes types JSON would otherwise\n* conflate (e.g. `BigInt(1)` vs `1`, `Date` vs ISO string, `Buffer`\n* vs number array). The spread converts the frozen wire-command\n* class instance (`InsertOneWireCommand`, `AggregateWireCommand`, …)\n* into a plain object exposing its own enumerable properties\n* (`kind`, `collection`, plus the payload-specific fields like\n* `document`/`filter`/`update`/`pipeline`/…), which is what\n* `canonicalStringify` accepts; class instances are rejected\n* outright to prevent silent collisions.\n*\n* Unlike SQL, there is no separate \"rendered statement\" component because\n* a Mongo `MongoExecutionPlan.command` is the wire command itself —\n* canonicalizing it captures both structure and parameters in one pass.\n*\n* The components are wrapped in an object and canonicalized as a single\n* unit (rather than concatenated with a delimiter) so component\n* boundaries are unambiguous and cannot collide with a different split\n* of the same characters.\n*\n* The canonical string is then piped through `hashContent` to produce a\n* bounded, opaque digest. See `@internal/utils/hash-content` for the\n* rationale.\n*\n* @throws {RuntimeErrorEnvelope} {@link RUNTIME_CONTENT_HASH_REQUIRES_RESOLVED_COMMAND}\n* when `exec.command` is still a pre-resolve draft (plain object), e.g. when\n* `contentHash` is called from `beforeEncode`.\n*\n* @internal\n*/\nfunction computeMongoContentHash(exec) {\n\tassertContentHashOnResolvedCommand(exec.command);\n\treturn hashContent(canonicalStringify({\n\t\tstorageHash: exec.meta.storageHash,\n\t\tcommand: { ...exec.command }\n\t}));\n}\n//#endregion\n//#region src/param-ref-mutator.ts\nfunction* flattenDraftSlot(value) {\n\tif (value instanceof MongoParamRef) {\n\t\tyield value;\n\t\treturn;\n\t}\n\tif (Array.isArray(value)) {\n\t\tfor (const item of value) yield* flattenDraftSlot(item);\n\t\treturn;\n\t}\n\tif (isPlainRecord(value)) for (const v of Object.values(value)) yield* flattenDraftSlot(v);\n}\n/**\n* Flat walk over a `MongoLoweredDraft` yielding every `MongoParamRef` leaf\n* regardless of nesting — object values, array elements, filter predicate\n* values, update operator values, and pipeline stage values. Raw command\n* variants carry no `MongoParamRef` nodes so they yield zero entries.\n*\n* **Walk parity:** slot traversal matches `resolveDraftSlot` / `resolveParams`\n* — refs appear only in plain-object and array containers; `Date` and other\n* non-plain objects are leaves (not descended into), so middleware sees every\n* ref the resolve pass will encode.\n*/\nfunction* flattenMongoParamRefs(draft) {\n\tswitch (draft.kind) {\n\t\tcase \"insertOne\":\n\t\tcase \"rawInsertOne\":\n\t\t\tyield* flattenDraftSlot(draft.document);\n\t\t\tbreak;\n\t\tcase \"insertMany\":\n\t\tcase \"rawInsertMany\":\n\t\t\tfor (const doc of draft.documents) yield* flattenDraftSlot(doc);\n\t\t\tbreak;\n\t\tcase \"updateOne\":\n\t\tcase \"updateMany\":\n\t\tcase \"rawUpdateOne\":\n\t\tcase \"rawUpdateMany\":\n\t\t\tyield* flattenDraftSlot(draft.filter);\n\t\t\tyield* flattenDraftSlot(draft.update);\n\t\t\tbreak;\n\t\tcase \"findOneAndUpdate\":\n\t\tcase \"rawFindOneAndUpdate\":\n\t\t\tyield* flattenDraftSlot(draft.filter);\n\t\t\tyield* flattenDraftSlot(draft.update);\n\t\t\tbreak;\n\t\tcase \"deleteOne\":\n\t\tcase \"deleteMany\":\n\t\tcase \"rawDeleteOne\":\n\t\tcase \"rawDeleteMany\":\n\t\t\tyield* flattenDraftSlot(draft.filter);\n\t\t\tbreak;\n\t\tcase \"findOneAndDelete\":\n\t\tcase \"rawFindOneAndDelete\":\n\t\t\tyield* flattenDraftSlot(draft.filter);\n\t\t\tbreak;\n\t\tcase \"aggregate\":\n\t\tcase \"rawAggregate\":\n\t\t\tfor (const stage of draft.pipeline) yield* flattenDraftSlot(stage);\n\t\t\tbreak;\n\t}\n}\nfunction substituteSlot(value, overrides) {\n\tif (value instanceof MongoParamRef) {\n\t\tif (overrides.has(value)) return new MongoParamRef(overrides.get(value), {\n\t\t\t...ifDefined(\"name\", value.name),\n\t\t\t...ifDefined(\"codecId\", value.codecId),\n\t\t\t...ifDefined(\"collection\", value.collection)\n\t\t});\n\t\treturn value;\n\t}\n\tif (Array.isArray(value)) return value.map((item) => substituteSlot(item, overrides));\n\tif (isPlainRecord(value)) {\n\t\tconst out = {};\n\t\tfor (const [k, v] of Object.entries(value)) out[k] = substituteSlot(v, overrides);\n\t\treturn out;\n\t}\n\treturn value;\n}\nfunction substituteDoc(doc, overrides) {\n\treturn blindCast(substituteSlot(doc, overrides));\n}\nfunction isUpdatePipeline(update) {\n\treturn Array.isArray(update);\n}\nfunction substituteUpdate(update, overrides) {\n\tif (isUpdatePipeline(update)) return update.map((stage) => substituteDoc(stage, overrides));\n\treturn substituteDoc(update, overrides);\n}\nfunction buildMutatedDraft(draft, overrides) {\n\tswitch (draft.kind) {\n\t\tcase \"insertOne\": return {\n\t\t\tkind: \"insertOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tdocument: substituteDoc(draft.document, overrides)\n\t\t};\n\t\tcase \"rawInsertOne\": return {\n\t\t\tkind: \"rawInsertOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tdocument: substituteDoc(draft.document, overrides)\n\t\t};\n\t\tcase \"insertMany\": return {\n\t\t\tkind: \"insertMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tdocuments: draft.documents.map((d) => substituteDoc(d, overrides))\n\t\t};\n\t\tcase \"rawInsertMany\": return {\n\t\t\tkind: \"rawInsertMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tdocuments: draft.documents.map((d) => substituteDoc(d, overrides))\n\t\t};\n\t\tcase \"updateOne\": return {\n\t\t\tkind: \"updateOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides),\n\t\t\tupsert: draft.upsert\n\t\t};\n\t\tcase \"updateMany\": return {\n\t\t\tkind: \"updateMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides),\n\t\t\tupsert: draft.upsert\n\t\t};\n\t\tcase \"rawUpdateOne\": return {\n\t\t\tkind: \"rawUpdateOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides)\n\t\t};\n\t\tcase \"rawUpdateMany\": return {\n\t\t\tkind: \"rawUpdateMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides),\n\t\t\tbypassDocumentValidation: draft.bypassDocumentValidation\n\t\t};\n\t\tcase \"deleteOne\": return {\n\t\t\tkind: \"deleteOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides)\n\t\t};\n\t\tcase \"deleteMany\": return {\n\t\t\tkind: \"deleteMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides)\n\t\t};\n\t\tcase \"rawDeleteOne\": return {\n\t\t\tkind: \"rawDeleteOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides)\n\t\t};\n\t\tcase \"rawDeleteMany\": return {\n\t\t\tkind: \"rawDeleteMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides)\n\t\t};\n\t\tcase \"findOneAndUpdate\": return {\n\t\t\tkind: \"findOneAndUpdate\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides),\n\t\t\tupsert: draft.upsert,\n\t\t\tsort: draft.sort,\n\t\t\treturnDocument: draft.returnDocument\n\t\t};\n\t\tcase \"rawFindOneAndUpdate\": return {\n\t\t\tkind: \"rawFindOneAndUpdate\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides),\n\t\t\tupsert: draft.upsert,\n\t\t\tsort: draft.sort,\n\t\t\treturnDocument: draft.returnDocument\n\t\t};\n\t\tcase \"findOneAndDelete\": return {\n\t\t\tkind: \"findOneAndDelete\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tsort: draft.sort\n\t\t};\n\t\tcase \"rawFindOneAndDelete\": return {\n\t\t\tkind: \"rawFindOneAndDelete\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tsort: draft.sort\n\t\t};\n\t\tcase \"aggregate\": return {\n\t\t\tkind: \"aggregate\",\n\t\t\tcollection: draft.collection,\n\t\t\tpipeline: draft.pipeline.map((s) => substituteDoc(s, overrides))\n\t\t};\n\t\tcase \"rawAggregate\": return {\n\t\t\tkind: \"rawAggregate\",\n\t\t\tcollection: draft.collection,\n\t\t\tpipeline: draft.pipeline.map((s) => substituteDoc(s, overrides))\n\t\t};\n\t}\n}\n/**\n* Build a {@link MongoParamRefMutatorInternal} for the given lowered draft.\n*\n* The mutator captures the draft by reference and uses `flattenMongoParamRefs`\n* on demand to produce `entries()`. Replacements are stored in a lazily-\n* allocated `Map`; the fast path (no replacements) preserves bit-for-bit\n* reference identity to the original draft in `currentDraft()`.\n*/\nfunction createMongoParamRefMutator(draft) {\n\tconst originalDraft = draft;\n\tlet overrides;\n\tconst ensureOverrides = () => {\n\t\tif (!overrides) overrides = /* @__PURE__ */ new Map();\n\t\treturn overrides;\n\t};\n\tfunction* entries() {\n\t\tfor (const ref of flattenMongoParamRefs(originalDraft)) yield blindCast({\n\t\t\tref: blindCast(ref),\n\t\t\tvalue: overrides?.has(ref) ? overrides.get(ref) : ref.value,\n\t\t\tcodecId: ref.codecId\n\t\t});\n\t}\n\tfunction replaceValue(handle, newValue) {\n\t\tensureOverrides().set(blindCast(handle), newValue);\n\t}\n\tfunction replaceValues(updates) {\n\t\tconst map = ensureOverrides();\n\t\tfor (const { ref, newValue } of updates) map.set(blindCast(ref), newValue);\n\t}\n\treturn {\n\t\tentries,\n\t\treplaceValue: blindCast(replaceValue),\n\t\treplaceValues,\n\t\tcurrentDraft() {\n\t\t\tif (!overrides || overrides.size === 0) return originalDraft;\n\t\t\treturn buildMutatedDraft(originalDraft, overrides);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/mongo-runtime.ts\nfunction noop() {}\nfunction isUnknownRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction statisticsCountField(commandKind) {\n\tswitch (commandKind) {\n\t\tcase \"updateOne\":\n\t\tcase \"updateMany\": return \"modifiedCount\";\n\t\tcase \"deleteOne\":\n\t\tcase \"deleteMany\": return \"deletedCount\";\n\t\tdefault: return;\n\t}\n}\nfunction invalidStatisticsResult(commandKind, countField) {\n\treturn runtimeError(\"RUNTIME.MONGO_STATISTICS_RESULT_INVALID\", `Mongo command '${commandKind}' did not return exactly one numeric '${countField}' result`, {\n\t\tcommandKind,\n\t\tcountField\n\t});\n}\nvar MongoRuntimeImpl = class extends RuntimeCore {\n\t#adapter;\n\t#driver;\n\t#codecs;\n\t#contextFields;\n\tconstructor(options) {\n\t\tconst middleware = options.middleware ?? [];\n\t\tfor (const mw of middleware) checkMiddlewareCompatibility(mw, \"mongo\", options.context.contract.target);\n\t\tconst ctx = {\n\t\t\tcontract: options.context.contract,\n\t\t\tmode: options.mode ?? \"strict\",\n\t\t\tnow: () => Date.now(),\n\t\t\tlog: {\n\t\t\t\tinfo: noop,\n\t\t\t\twarn: noop,\n\t\t\t\terror: noop\n\t\t\t},\n\t\t\tcontentHash: (exec) => computeMongoContentHash(blindCast(exec)),\n\t\t\tscope: \"runtime\"\n\t\t};\n\t\tsuper({\n\t\t\tmiddleware,\n\t\t\tctx\n\t\t});\n\t\tthis.#contextFields = ctx;\n\t\tthis.#adapter = options.adapter;\n\t\tthis.#driver = options.driver;\n\t\tthis.#codecs = options.context.codecs;\n\t}\n\t/* v8 ignore start -- one-phase lower satisfies RuntimeCore; operations use the split preparation pipeline */\n\tasync lower(plan, ctx) {\n\t\treturn {\n\t\t\tcommand: await this.#adapter.lower(plan, ctx),\n\t\t\tmeta: plan.meta,\n\t\t\t...ifDefined(\"resultShape\", plan.resultShape)\n\t\t};\n\t}\n\t/* v8 ignore stop */\n\trunDriver(exec) {\n\t\treturn this.#driver.execute(exec.command);\n\t}\n\trunExecute(exec) {\n\t\treturn this.#readDriverStatistics(exec);\n\t}\n\tcreateQueryContexts(options) {\n\t\tconst signal = options?.signal;\n\t\treturn {\n\t\t\tcodecCtx: signal === void 0 ? {} : { signal },\n\t\t\tcontextFields: {\n\t\t\t\t...this.#contextFields,\n\t\t\t\t...ifDefined(\"signal\", signal)\n\t\t\t}\n\t\t};\n\t}\n\tasync prepareOperation(plan, codecCtx, run) {\n\t\tcheckAborted(codecCtx, \"stream\");\n\t\tconst compiled = await this.runBeforeCompile(plan);\n\t\tconst draft = this.#adapter.structuralLower(compiled);\n\t\tconst mutator = createMongoParamRefMutator(draft);\n\t\tconst draftExec = {\n\t\t\tmeta: compiled.meta,\n\t\t\t...ifDefined(\"resultShape\", compiled.resultShape),\n\t\t\tcommand: blindCast(draft)\n\t\t};\n\t\tawait run.beforeEncode(draftExec, mutator);\n\t\treturn {\n\t\t\tmeta: compiled.meta,\n\t\t\t...ifDefined(\"resultShape\", compiled.resultShape),\n\t\t\tcommand: await this.#adapter.resolveParams(mutator.currentDraft(), codecCtx)\n\t\t};\n\t}\n\tquery(plan, options) {\n\t\tconst self = this;\n\t\tconst { codecCtx, contextFields } = this.createQueryContexts(options);\n\t\tconst generator = async function* () {\n\t\t\tyield* streamStatement({\n\t\t\t\tmiddleware: self.middleware,\n\t\t\t\tplan,\n\t\t\t\tcontext: contextFields,\n\t\t\t\tparent: void 0\n\t\t\t}, async function* (run) {\n\t\t\t\tconst exec = await self.prepareOperation(plan, codecCtx, run);\n\t\t\t\tyield* self.#decodedRows(run, exec, codecCtx);\n\t\t\t});\n\t\t};\n\t\treturn new AsyncIterableResult(generator());\n\t}\n\tasync *#decodedRows(run, exec, codecCtx) {\n\t\tconst stream = run.runQuery(exec, () => this.runDriver(exec));\n\t\tfor await (const rawRow of stream) {\n\t\t\tcheckAborted(codecCtx, \"stream\");\n\t\t\tif (exec.resultShape === void 0) yield blindCast(rawRow);\n\t\t\telse yield blindCast(await decodeMongoRow(rawRow, exec.resultShape, this.#codecs, exec.command.collection, codecCtx));\n\t\t}\n\t}\n\texecute(plan, options) {\n\t\tconst { codecCtx, contextFields } = this.createQueryContexts(options);\n\t\treturn executeStatement({\n\t\t\tmiddleware: this.middleware,\n\t\t\tplan,\n\t\t\tcontext: contextFields,\n\t\t\tparent: void 0\n\t\t}, async (run) => {\n\t\t\tconst exec = await this.prepareOperation(plan, codecCtx, run);\n\t\t\tcheckAborted(codecCtx, \"stream\");\n\t\t\treturn run.runExecute(exec, () => this.runExecute(exec));\n\t\t});\n\t}\n\tasync #readDriverStatistics(exec) {\n\t\tconst countField = statisticsCountField(exec.command.kind);\n\t\tif (countField === void 0) throw runtimeError(\"RUNTIME.MONGO_STATISTICS_UNSUPPORTED\", `Mongo command '${exec.command.kind}' does not expose statement statistics`, { commandKind: exec.command.kind });\n\t\tlet affectedRows;\n\t\tfor await (const result of this.#driver.execute(exec.command)) {\n\t\t\tif (affectedRows !== void 0 || !isUnknownRecord(result)) throw invalidStatisticsResult(exec.command.kind, countField);\n\t\t\tconst count = result[countField];\n\t\t\tif (typeof count !== \"number\") throw invalidStatisticsResult(exec.command.kind, countField);\n\t\t\taffectedRows = count;\n\t\t}\n\t\tif (affectedRows === void 0) throw invalidStatisticsResult(exec.command.kind, countField);\n\t\treturn { affectedRows };\n\t}\n\tasync close() {\n\t\tawait this.#driver.close();\n\t}\n};\nfunction createMongoRuntime(options) {\n\treturn new MongoRuntimeImpl(options);\n}\n//#endregion\nexport { createMongoExecutionContext, createMongoExecutionStack, createMongoParamRefMutator, createMongoRuntime, enumMemberCodecFor, flattenMongoParamRefs };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,SAAS,0BAA0B,SAAS;CAC3C,MAAM,EAAE,QAAQ,SAAS,eAAe,qBAAqB;EAC5D,QAAQ,QAAQ;EAChB,SAAS,QAAQ;E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AQ,MAAM,SAAS;EACtB,MAAM,EAAE,UAAU,kBAAkB,KAAK,oBAAoB,OAAO;EACpE,OAAO,iBAAiB;GACvB,YAAY,KAAK;GACjB;GACA,SAAS;GACT,QAAQ,KAAK;EACd,GAAG,OAAO,QAAQ;GACjB,MAAM,OAAO,MAAM,KAAK,iBAAiB,MAAM,UAAU,GAAG;GAC5D,aAAa,UAAU,QAAQ;GAC/B,OAAO,IAAI,WAAW,YAAY,KAAK,WAAW,IAAI,CAAC;EACxD,CAAC;CACF;CACA,MAAMC,sBAAsB,MAAM;EACjC,MAAM,aAAa,qBAAqB,KAAK,QAAQ,IAAI;EACzD,IAAI,eAAe,KAAK,GAAG,MAAM,aAAa,wCAAwC,kBAAkB,KAAK,QAAQ,KAAK,yCAAyC,EAAE,aAAa,KAAK,QAAQ,KAAK,CAAC;EACrM,IAAI;EACJ,WAAW,MAAM,UAAU,KAAKF,QAAQ,QAAQ,KAAK,OAAO,GAAG;GAC9D,IAAI,iBAAiB,KAAK,KAAK,CAAC,gBAAgB,MAAM,GAAG,MAAM,wBAAwB,KAAK,QAAQ,MAAM,UAAU;GACpH,MAAM,QAAQ,OAAO;GACrB,IAAI,OAAO,UAAU,UAAU,MAAM,wBAAwB,KAAK,QAAQ,MAAM,UAAU;GAC1F,eAAe;EAChB;EACA,IAAI,iBAAiB,KAAK,GAAG,MAAM,wBAAwB,KAAK,QAAQ,MAAM,UAAU;EACxF,OAAO,EAAE,aAAa;CACvB;CACA,MAAM,QAAQ;EACb,MAAM,KAAKA,QAAQ,MAAM;CAC1B;AACD;AACA,SAAS,mBAAmB,SAAS;CACpC,OAAO,IAAI,iBAAiB,OAAO;AACpC"}
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":["#contextFields","#adapter","#driver","#codecs","#closed","#readDriverStatistics","#decodedRows"],"sources":["../../../../2-mongo-family/7-runtime/dist/index.mjs"],"sourcesContent":["import { enumMemberCodecFor } from \"@internal/mongo-query-ast/execution\";\nimport { createExecutionStack } from \"@internal/framework-components/execution\";\nimport { AsyncIterableResult, RuntimeCore, applyMutationDefaults, assertMutationDefaultGeneratorsAvailable, checkAborted, checkMiddlewareCompatibility, collectMutationDefaultGenerators, executeStatement, runtimeError, streamStatement } from \"@internal/framework-components/runtime\";\nimport { newMongoCodecRegistry } from \"@internal/mongo-codec\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { isStructuredError, structuredError } from \"@internal/utils/structured-error\";\nimport { isInternalError } from \"@internal/utils/internal-error\";\nimport { canonicalStringify } from \"@internal/utils/canonical-stringify\";\nimport { hashContent } from \"@internal/utils/hash-content\";\nimport { isPlainRecord } from \"@internal/contract/is-plain-record\";\nimport { MongoParamRef } from \"@internal/mongo-value\";\n//#region src/mongo-execution-stack.ts\nfunction createMongoExecutionStack(options) {\n\tconst { target, adapter, driver, extensions } = createExecutionStack({\n\t\ttarget: options.target,\n\t\tadapter: options.adapter,\n\t\tdriver: options.driver,\n\t\textensions: options.extensions\n\t});\n\treturn driver === void 0 ? {\n\t\ttarget,\n\t\tadapter,\n\t\textensions\n\t} : {\n\t\ttarget,\n\t\tadapter,\n\t\tdriver,\n\t\textensions\n\t};\n}\nfunction createMongoExecutionContext(options) {\n\tconst registry = newMongoCodecRegistry();\n\tconst owners = /* @__PURE__ */ new Map();\n\tconst contributors = [\n\t\toptions.stack.target,\n\t\toptions.stack.adapter,\n\t\t...options.stack.extensions\n\t];\n\tconst generators = collectMutationDefaultGenerators(contributors);\n\tconst execution = options.contract.execution;\n\tassertMutationDefaultGeneratorsAvailable(execution, generators);\n\tfor (const contributor of contributors) {\n\t\tconst contributed = contributor.codecs();\n\t\tfor (const codec of iterateCodecs(contributed)) {\n\t\t\tconst existingOwner = owners.get(codec.id);\n\t\t\tif (existingOwner !== void 0) throw runtimeError(\"RUNTIME.DUPLICATE_CODEC\", `Duplicate Mongo codec id '${codec.id}' contributed by '${contributor.id}' (already registered by '${existingOwner}').`, {\n\t\t\t\tcodecId: codec.id,\n\t\t\t\texistingOwner,\n\t\t\t\tincomingOwner: contributor.id\n\t\t\t});\n\t\t\tregistry.register(codec);\n\t\t\towners.set(codec.id, contributor.id);\n\t\t}\n\t}\n\treturn Object.freeze({\n\t\tcontract: options.contract,\n\t\tcodecs: registry,\n\t\tapplyMutationDefaults: (mutation) => applyMutationDefaults(execution, generators, mutation)\n\t});\n}\nfunction* iterateCodecs(registry) {\n\tyield* registry.values();\n}\n//#endregion\n//#region src/codecs/decoding.ts\nconst WIRE_PREVIEW_LIMIT = 100;\nfunction truncate(text) {\n\treturn text.length > WIRE_PREVIEW_LIMIT ? `${text.substring(0, WIRE_PREVIEW_LIMIT)}...` : text;\n}\n/**\n* JSON text of the wire value, using each BSON class's own JSON form (an `ObjectId` as its hex string, a `Date` as ISO text), or `String(value)` when it has none.\n*/\nfunction previewWireValue(wireValue) {\n\tif (typeof wireValue === \"string\") return truncate(wireValue);\n\ttry {\n\t\treturn truncate(JSON.stringify(wireValue, (_key, value) => typeof value === \"bigint\" ? `${value}n` : value) ?? String(wireValue));\n\t} catch {\n\t\treturn truncate(String(wireValue));\n\t}\n}\nfunction hasHexString(value) {\n\treturn \"toHexString\" in value && typeof value.toHexString === \"function\";\n}\nfunction describeDocumentId(id) {\n\tif (id === void 0) return void 0;\n\tif (typeof id === \"string\") return JSON.stringify(id);\n\tif (typeof id === \"object\" && id !== null && hasHexString(id)) return id.toHexString();\n\treturn previewWireValue(id);\n}\n/**\n* Every decode failure names the collection and field, and the `_id` of the document when the row carries one; inside a document shape marked `row`, that document's `_id` and the field's path from it. A codec's own `RUNTIME.DECODE_FAILED` keeps its code and details, with the location added; any other structured envelope (a dotted `code`, per `isStructuredError`) and an `InternalError` pass through unchanged; everything else is wrapped in a `RUNTIME.DECODE_FAILED` envelope. The original error is the `cause`.\n*/\nfunction wrapDecodeFailure(error, location, codecId, wireValue) {\n\tif (isInternalError(error)) throw error;\n\tconst codecDetails = isStructuredError(error) ? error.meta : void 0;\n\tif (isStructuredError(error) && error.code !== \"RUNTIME.DECODE_FAILED\") throw error;\n\tconst { collection, path, documentId } = location;\n\tconst message = error instanceof Error ? error.message : String(error);\n\tconst wrapped = runtimeError(\"RUNTIME.DECODE_FAILED\", `Failed to decode field ${path}${documentId === void 0 ? \"\" : ` of the document with _id ${documentId}`} in collection '${collection}' with codec '${codecId}': ${message}`, {\n\t\t...codecDetails,\n\t\tcollection,\n\t\tpath,\n\t\t...ifDefined(\"documentId\", documentId),\n\t\tcodec: codecId,\n\t\twirePreview: previewWireValue(wireValue)\n\t});\n\twrapped.cause = error;\n\tthrow wrapped;\n}\n/**\n* A document may leave out a nullable field entirely (Prisma 6 and the driver both omit it); the field's type says `null`, so an absent value reads as `null`.\n*/\nfunction absentAsNull(value, nullable) {\n\treturn value === void 0 && nullable ? null : value;\n}\nasync function decodeMongoRow(row, shape, registry, collection, ctx = {}) {\n\tif (shape.kind === \"unknown\") return row;\n\tif (typeof row !== \"object\" || row === null) return row;\n\tconst rowObj = blindCast(row);\n\tconst out = {};\n\tconst tasks = [];\n\tfunction scheduleLeaf(path, documentId, codecId, wire, assign) {\n\t\tconst codec = registry.get(codecId);\n\t\tif (!codec) {\n\t\t\tassign(wire);\n\t\t\treturn;\n\t\t}\n\t\ttasks.push((async () => {\n\t\t\ttry {\n\t\t\t\tassign(await codec.fromWire(wire, ctx));\n\t\t\t} catch (error) {\n\t\t\t\twrapDecodeFailure(error, {\n\t\t\t\t\tcollection,\n\t\t\t\t\tpath,\n\t\t\t\t\tdocumentId\n\t\t\t\t}, codecId, wire);\n\t\t\t}\n\t\t})());\n\t}\n\tfunction walkField(value, fieldShape, path, documentId, assign) {\n\t\tswitch (fieldShape.kind) {\n\t\t\tcase \"unknown\":\n\t\t\t\tassign(value);\n\t\t\t\treturn;\n\t\t\tcase \"leaf\":\n\t\t\t\tif (value === null || value === void 0) {\n\t\t\t\t\tassign(absentAsNull(value, fieldShape.nullable));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tscheduleLeaf(path, documentId, fieldShape.codecId, value, assign);\n\t\t\t\treturn;\n\t\t\tcase \"document\": {\n\t\t\t\tif (value === null || value === void 0) {\n\t\t\t\t\tassign(absentAsNull(value, fieldShape.nullable));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n\t\t\t\t\tassign(value);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst vObj = blindCast(value);\n\t\t\t\tconst nested = { ...vObj };\n\t\t\t\tassign(nested);\n\t\t\t\tfor (const [fk, fShape] of Object.entries(fieldShape.fields)) walkField(vObj[fk], fShape, fieldShape.row ? fk : `${path}.${fk}`, fieldShape.row ? describeDocumentId(vObj[\"_id\"]) : documentId, (v) => {\n\t\t\t\t\tnested[fk] = v;\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase \"array\": {\n\t\t\t\tif (value === null || value === void 0) {\n\t\t\t\t\tassign(absentAsNull(value, fieldShape.nullable));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!Array.isArray(value)) {\n\t\t\t\t\tassign(value);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst arr = [];\n\t\t\t\tassign(arr);\n\t\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\t\tconst el = value[i];\n\t\t\t\t\twalkField(el, fieldShape.element, `${path}.${i}`, documentId, (v) => {\n\t\t\t\t\t\tarr[i] = v;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t/* v8 ignore stop */\n\t}\n\tconst documentId = describeDocumentId(rowObj[\"_id\"]);\n\tfor (const [k, fShape] of Object.entries(shape.fields)) walkField(rowObj[k], fShape, k, documentId, (v) => {\n\t\tout[k] = v;\n\t});\n\tfor (const k of Object.keys(rowObj)) if (!Object.hasOwn(shape.fields, k)) out[k] = rowObj[k];\n\tawait Promise.all(tasks);\n\treturn out;\n}\n//#endregion\n//#region src/content-hash.ts\n/** @internal */\nconst RUNTIME_CONTENT_HASH_REQUIRES_RESOLVED_COMMAND = \"RUNTIME.CONTENT_HASH_REQUIRES_RESOLVED_COMMAND\";\n/**\n* Resolved wire commands are frozen class instances (`InsertOneWireCommand`, …);\n* pre-resolve `beforeEncode` plans hold a plain-object `MongoLoweredDraft` in the\n* command slot. O(1) prototype check — no tree walk on the hot path.\n*/\nfunction isResolvedMongoWireCommand(command) {\n\tif (command === null || typeof command !== \"object\") return false;\n\tconst proto = Object.getPrototypeOf(command);\n\treturn proto !== null && proto !== Object.prototype;\n}\nfunction assertContentHashOnResolvedCommand(command) {\n\tif (isResolvedMongoWireCommand(command)) return;\n\tthrow runtimeError(RUNTIME_CONTENT_HASH_REQUIRES_RESOLVED_COMMAND, \"contentHash and computeMongoContentHash are only valid on a resolved wire command after parameter resolution. During a before hook, plan.command holds an unresolved MongoLoweredDraft — use params.entries() and the param mutator instead of contentHash or structural reads of plan.command.\", { phase: \"beforeEncode\" });\n}\n/**\n* Computes a stable content hash for a lowered Mongo execution plan.\n*\n* Internally builds an unambiguous canonical-stringified preimage from\n* two components:\n*\n* 1. `meta.storageHash` — discriminates by schema. A migration changes the\n* storage hash, which invalidates cached entries automatically (no\n* per-app invalidation logic needed for schema changes).\n* 2. `exec.command` — the wire command. `canonicalStringify` produces a\n* deterministic serialization that is stable across object key\n* insertion order and that distinguishes types JSON would otherwise\n* conflate (e.g. `BigInt(1)` vs `1`, `Date` vs ISO string, `Buffer`\n* vs number array). The spread converts the frozen wire-command\n* class instance (`InsertOneWireCommand`, `AggregateWireCommand`, …)\n* into a plain object exposing its own enumerable properties\n* (`kind`, `collection`, plus the payload-specific fields like\n* `document`/`filter`/`update`/`pipeline`/…), which is what\n* `canonicalStringify` accepts; class instances are rejected\n* outright to prevent silent collisions.\n*\n* Unlike SQL, there is no separate \"rendered statement\" component because\n* a Mongo `MongoExecutionPlan.command` is the wire command itself —\n* canonicalizing it captures both structure and parameters in one pass.\n*\n* The components are wrapped in an object and canonicalized as a single\n* unit (rather than concatenated with a delimiter) so component\n* boundaries are unambiguous and cannot collide with a different split\n* of the same characters.\n*\n* The canonical string is then piped through `hashContent` to produce a\n* bounded, opaque digest. See `@internal/utils/hash-content` for the\n* rationale.\n*\n* @throws {RuntimeErrorEnvelope} {@link RUNTIME_CONTENT_HASH_REQUIRES_RESOLVED_COMMAND}\n* when `exec.command` is still a pre-resolve draft (plain object), e.g. when\n* `contentHash` is called from `beforeEncode`.\n*\n* @internal\n*/\nfunction computeMongoContentHash(exec) {\n\tassertContentHashOnResolvedCommand(exec.command);\n\treturn hashContent(canonicalStringify({\n\t\tstorageHash: exec.meta.storageHash,\n\t\tcommand: { ...exec.command }\n\t}));\n}\n//#endregion\n//#region src/param-ref-mutator.ts\nfunction* flattenDraftSlot(value) {\n\tif (value instanceof MongoParamRef) {\n\t\tyield value;\n\t\treturn;\n\t}\n\tif (Array.isArray(value)) {\n\t\tfor (const item of value) yield* flattenDraftSlot(item);\n\t\treturn;\n\t}\n\tif (isPlainRecord(value)) for (const v of Object.values(value)) yield* flattenDraftSlot(v);\n}\n/**\n* Flat walk over a `MongoLoweredDraft` yielding every `MongoParamRef` leaf\n* regardless of nesting — object values, array elements, filter predicate\n* values, update operator values, and pipeline stage values. Raw command\n* variants carry no `MongoParamRef` nodes so they yield zero entries.\n*\n* **Walk parity:** slot traversal matches `resolveDraftSlot` / `resolveParams`\n* — refs appear only in plain-object and array containers; `Date` and other\n* non-plain objects are leaves (not descended into), so middleware sees every\n* ref the resolve pass will encode.\n*/\nfunction* flattenMongoParamRefs(draft) {\n\tswitch (draft.kind) {\n\t\tcase \"insertOne\":\n\t\tcase \"rawInsertOne\":\n\t\t\tyield* flattenDraftSlot(draft.document);\n\t\t\tbreak;\n\t\tcase \"insertMany\":\n\t\tcase \"rawInsertMany\":\n\t\t\tfor (const doc of draft.documents) yield* flattenDraftSlot(doc);\n\t\t\tbreak;\n\t\tcase \"updateOne\":\n\t\tcase \"updateMany\":\n\t\tcase \"rawUpdateOne\":\n\t\tcase \"rawUpdateMany\":\n\t\t\tyield* flattenDraftSlot(draft.filter);\n\t\t\tyield* flattenDraftSlot(draft.update);\n\t\t\tbreak;\n\t\tcase \"findOneAndUpdate\":\n\t\tcase \"rawFindOneAndUpdate\":\n\t\t\tyield* flattenDraftSlot(draft.filter);\n\t\t\tyield* flattenDraftSlot(draft.update);\n\t\t\tbreak;\n\t\tcase \"deleteOne\":\n\t\tcase \"deleteMany\":\n\t\tcase \"rawDeleteOne\":\n\t\tcase \"rawDeleteMany\":\n\t\t\tyield* flattenDraftSlot(draft.filter);\n\t\t\tbreak;\n\t\tcase \"findOneAndDelete\":\n\t\tcase \"rawFindOneAndDelete\":\n\t\t\tyield* flattenDraftSlot(draft.filter);\n\t\t\tbreak;\n\t\tcase \"aggregate\":\n\t\tcase \"rawAggregate\":\n\t\t\tfor (const stage of draft.pipeline) yield* flattenDraftSlot(stage);\n\t\t\tbreak;\n\t}\n}\nfunction substituteSlot(value, overrides) {\n\tif (value instanceof MongoParamRef) {\n\t\tif (overrides.has(value)) return new MongoParamRef(overrides.get(value), {\n\t\t\t...ifDefined(\"name\", value.name),\n\t\t\t...ifDefined(\"codecId\", value.codecId),\n\t\t\t...ifDefined(\"collection\", value.collection)\n\t\t});\n\t\treturn value;\n\t}\n\tif (Array.isArray(value)) return value.map((item) => substituteSlot(item, overrides));\n\tif (isPlainRecord(value)) {\n\t\tconst out = {};\n\t\tfor (const [k, v] of Object.entries(value)) out[k] = substituteSlot(v, overrides);\n\t\treturn out;\n\t}\n\treturn value;\n}\nfunction substituteDoc(doc, overrides) {\n\treturn blindCast(substituteSlot(doc, overrides));\n}\nfunction isUpdatePipeline(update) {\n\treturn Array.isArray(update);\n}\nfunction substituteUpdate(update, overrides) {\n\tif (isUpdatePipeline(update)) return update.map((stage) => substituteDoc(stage, overrides));\n\treturn substituteDoc(update, overrides);\n}\nfunction buildMutatedDraft(draft, overrides) {\n\tswitch (draft.kind) {\n\t\tcase \"insertOne\": return {\n\t\t\tkind: \"insertOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tdocument: substituteDoc(draft.document, overrides)\n\t\t};\n\t\tcase \"rawInsertOne\": return {\n\t\t\tkind: \"rawInsertOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tdocument: substituteDoc(draft.document, overrides)\n\t\t};\n\t\tcase \"insertMany\": return {\n\t\t\tkind: \"insertMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tdocuments: draft.documents.map((d) => substituteDoc(d, overrides))\n\t\t};\n\t\tcase \"rawInsertMany\": return {\n\t\t\tkind: \"rawInsertMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tdocuments: draft.documents.map((d) => substituteDoc(d, overrides))\n\t\t};\n\t\tcase \"updateOne\": return {\n\t\t\tkind: \"updateOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides),\n\t\t\tupsert: draft.upsert\n\t\t};\n\t\tcase \"updateMany\": return {\n\t\t\tkind: \"updateMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides),\n\t\t\tupsert: draft.upsert\n\t\t};\n\t\tcase \"rawUpdateOne\": return {\n\t\t\tkind: \"rawUpdateOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides)\n\t\t};\n\t\tcase \"rawUpdateMany\": return {\n\t\t\tkind: \"rawUpdateMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides),\n\t\t\tbypassDocumentValidation: draft.bypassDocumentValidation\n\t\t};\n\t\tcase \"deleteOne\": return {\n\t\t\tkind: \"deleteOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides)\n\t\t};\n\t\tcase \"deleteMany\": return {\n\t\t\tkind: \"deleteMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides)\n\t\t};\n\t\tcase \"rawDeleteOne\": return {\n\t\t\tkind: \"rawDeleteOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides)\n\t\t};\n\t\tcase \"rawDeleteMany\": return {\n\t\t\tkind: \"rawDeleteMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides)\n\t\t};\n\t\tcase \"findOneAndUpdate\": return {\n\t\t\tkind: \"findOneAndUpdate\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides),\n\t\t\tupsert: draft.upsert,\n\t\t\tsort: draft.sort,\n\t\t\treturnDocument: draft.returnDocument\n\t\t};\n\t\tcase \"rawFindOneAndUpdate\": return {\n\t\t\tkind: \"rawFindOneAndUpdate\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides),\n\t\t\tupsert: draft.upsert,\n\t\t\tsort: draft.sort,\n\t\t\treturnDocument: draft.returnDocument\n\t\t};\n\t\tcase \"findOneAndDelete\": return {\n\t\t\tkind: \"findOneAndDelete\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tsort: draft.sort\n\t\t};\n\t\tcase \"rawFindOneAndDelete\": return {\n\t\t\tkind: \"rawFindOneAndDelete\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tsort: draft.sort\n\t\t};\n\t\tcase \"aggregate\": return {\n\t\t\tkind: \"aggregate\",\n\t\t\tcollection: draft.collection,\n\t\t\tpipeline: draft.pipeline.map((s) => substituteDoc(s, overrides))\n\t\t};\n\t\tcase \"rawAggregate\": return {\n\t\t\tkind: \"rawAggregate\",\n\t\t\tcollection: draft.collection,\n\t\t\tpipeline: draft.pipeline.map((s) => substituteDoc(s, overrides))\n\t\t};\n\t}\n}\n/**\n* Build a {@link MongoParamRefMutatorInternal} for the given lowered draft.\n*\n* The mutator captures the draft by reference and uses `flattenMongoParamRefs`\n* on demand to produce `entries()`. Replacements are stored in a lazily-\n* allocated `Map`; the fast path (no replacements) preserves bit-for-bit\n* reference identity to the original draft in `currentDraft()`.\n*/\nfunction createMongoParamRefMutator(draft) {\n\tconst originalDraft = draft;\n\tlet overrides;\n\tconst ensureOverrides = () => {\n\t\tif (!overrides) overrides = /* @__PURE__ */ new Map();\n\t\treturn overrides;\n\t};\n\tfunction* entries() {\n\t\tfor (const ref of flattenMongoParamRefs(originalDraft)) yield blindCast({\n\t\t\tref: blindCast(ref),\n\t\t\tvalue: overrides?.has(ref) ? overrides.get(ref) : ref.value,\n\t\t\tcodecId: ref.codecId\n\t\t});\n\t}\n\tfunction replaceValue(handle, newValue) {\n\t\tensureOverrides().set(blindCast(handle), newValue);\n\t}\n\tfunction replaceValues(updates) {\n\t\tconst map = ensureOverrides();\n\t\tfor (const { ref, newValue } of updates) map.set(blindCast(ref), newValue);\n\t}\n\treturn {\n\t\tentries,\n\t\treplaceValue: blindCast(replaceValue),\n\t\treplaceValues,\n\t\tcurrentDraft() {\n\t\t\tif (!overrides || overrides.size === 0) return originalDraft;\n\t\t\treturn buildMutatedDraft(originalDraft, overrides);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/mongo-runtime.ts\nfunction noop() {}\nfunction isUnknownRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction statisticsCountField(commandKind) {\n\tswitch (commandKind) {\n\t\tcase \"updateOne\":\n\t\tcase \"updateMany\": return \"modifiedCount\";\n\t\tcase \"deleteOne\":\n\t\tcase \"deleteMany\": return \"deletedCount\";\n\t\tdefault: return;\n\t}\n}\nfunction invalidStatisticsResult(commandKind, countField) {\n\treturn runtimeError(\"RUNTIME.MONGO_STATISTICS_RESULT_INVALID\", `Mongo command '${commandKind}' did not return exactly one numeric '${countField}' result`, {\n\t\tcommandKind,\n\t\tcountField\n\t});\n}\nfunction runtimeClosedError() {\n\treturn structuredError(\"DRIVER.NOT_CONNECTED\", \"Runtime is closed\", {\n\t\twhy: \"close() was called on this runtime, or on the client or connection that owns it. An await using scope calls close() when it ends.\",\n\t\tfix: \"Await every query before close(). The usual cause is a query returned without await from an await using scope.\"\n\t});\n}\nvar MongoRuntimeImpl = class extends RuntimeCore {\n\t#adapter;\n\t#driver;\n\t#codecs;\n\t#contextFields;\n\t#closed = false;\n\tconstructor(options) {\n\t\tconst middleware = options.middleware ?? [];\n\t\tfor (const mw of middleware) checkMiddlewareCompatibility(mw, \"mongo\", options.context.contract.target);\n\t\tconst ctx = {\n\t\t\tcontract: options.context.contract,\n\t\t\tmode: options.mode ?? \"strict\",\n\t\t\tnow: () => Date.now(),\n\t\t\tlog: {\n\t\t\t\tinfo: noop,\n\t\t\t\twarn: noop,\n\t\t\t\terror: noop\n\t\t\t},\n\t\t\tcontentHash: (exec) => computeMongoContentHash(blindCast(exec)),\n\t\t\tscope: \"runtime\"\n\t\t};\n\t\tsuper({\n\t\t\tmiddleware,\n\t\t\tctx\n\t\t});\n\t\tthis.#contextFields = ctx;\n\t\tthis.#adapter = options.adapter;\n\t\tthis.#driver = options.driver;\n\t\tthis.#codecs = options.context.codecs;\n\t}\n\t/* v8 ignore start -- one-phase lower satisfies RuntimeCore; operations use the split preparation pipeline */\n\tasync lower(plan, ctx) {\n\t\treturn {\n\t\t\tcommand: await this.#adapter.lower(plan, ctx),\n\t\t\tmeta: plan.meta,\n\t\t\t...ifDefined(\"resultShape\", plan.resultShape)\n\t\t};\n\t}\n\t/* v8 ignore stop */\n\trunDriver(exec) {\n\t\tif (this.#closed) throw runtimeClosedError();\n\t\treturn this.#driver.execute(exec.command);\n\t}\n\trunExecute(exec) {\n\t\treturn this.#readDriverStatistics(exec);\n\t}\n\tcreateQueryContexts(options) {\n\t\tconst signal = options?.signal;\n\t\treturn {\n\t\t\tcodecCtx: signal === void 0 ? {} : { signal },\n\t\t\tcontextFields: {\n\t\t\t\t...this.#contextFields,\n\t\t\t\t...ifDefined(\"signal\", signal)\n\t\t\t}\n\t\t};\n\t}\n\tasync prepareOperation(plan, codecCtx, run) {\n\t\tcheckAborted(codecCtx, \"stream\");\n\t\tconst compiled = await this.runBeforeCompile(plan);\n\t\tconst draft = this.#adapter.structuralLower(compiled);\n\t\tconst mutator = createMongoParamRefMutator(draft);\n\t\tconst draftExec = {\n\t\t\tmeta: compiled.meta,\n\t\t\t...ifDefined(\"resultShape\", compiled.resultShape),\n\t\t\tcommand: blindCast(draft)\n\t\t};\n\t\tawait run.beforeEncode(draftExec, mutator);\n\t\treturn {\n\t\t\tmeta: compiled.meta,\n\t\t\t...ifDefined(\"resultShape\", compiled.resultShape),\n\t\t\tcommand: await this.#adapter.resolveParams(mutator.currentDraft(), codecCtx)\n\t\t};\n\t}\n\tquery(plan, options) {\n\t\tconst self = this;\n\t\tconst { codecCtx, contextFields } = this.createQueryContexts(options);\n\t\tconst generator = async function* () {\n\t\t\tyield* streamStatement({\n\t\t\t\tmiddleware: self.middleware,\n\t\t\t\tplan,\n\t\t\t\tcontext: contextFields,\n\t\t\t\tparent: void 0\n\t\t\t}, async function* (run) {\n\t\t\t\tconst exec = await self.prepareOperation(plan, codecCtx, run);\n\t\t\t\tyield* self.#decodedRows(run, exec, codecCtx);\n\t\t\t});\n\t\t};\n\t\treturn new AsyncIterableResult(generator());\n\t}\n\tasync *#decodedRows(run, exec, codecCtx) {\n\t\tconst stream = run.runQuery(exec, () => this.runDriver(exec));\n\t\tfor await (const rawRow of stream) {\n\t\t\tcheckAborted(codecCtx, \"stream\");\n\t\t\tif (exec.resultShape === void 0) yield blindCast(rawRow);\n\t\t\telse yield blindCast(await decodeMongoRow(rawRow, exec.resultShape, this.#codecs, exec.command.collection, codecCtx));\n\t\t}\n\t}\n\texecute(plan, options) {\n\t\tconst { codecCtx, contextFields } = this.createQueryContexts(options);\n\t\treturn executeStatement({\n\t\t\tmiddleware: this.middleware,\n\t\t\tplan,\n\t\t\tcontext: contextFields,\n\t\t\tparent: void 0\n\t\t}, async (run) => {\n\t\t\tconst exec = await this.prepareOperation(plan, codecCtx, run);\n\t\t\tcheckAborted(codecCtx, \"stream\");\n\t\t\treturn run.runExecute(exec, () => this.runExecute(exec));\n\t\t});\n\t}\n\tasync #readDriverStatistics(exec) {\n\t\tif (this.#closed) throw runtimeClosedError();\n\t\tconst countField = statisticsCountField(exec.command.kind);\n\t\tif (countField === void 0) throw runtimeError(\"RUNTIME.MONGO_STATISTICS_UNSUPPORTED\", `Mongo command '${exec.command.kind}' does not expose statement statistics`, { commandKind: exec.command.kind });\n\t\tlet affectedRows;\n\t\tfor await (const result of this.#driver.execute(exec.command)) {\n\t\t\tif (affectedRows !== void 0 || !isUnknownRecord(result)) throw invalidStatisticsResult(exec.command.kind, countField);\n\t\t\tconst count = result[countField];\n\t\t\tif (typeof count !== \"number\") throw invalidStatisticsResult(exec.command.kind, countField);\n\t\t\taffectedRows = count;\n\t\t}\n\t\tif (affectedRows === void 0) throw invalidStatisticsResult(exec.command.kind, countField);\n\t\treturn { affectedRows };\n\t}\n\tasync close() {\n\t\tthis.#closed = true;\n\t\tawait this.#driver.close();\n\t}\n};\nfunction createMongoRuntime(options) {\n\treturn new MongoRuntimeImpl(options);\n}\n//#endregion\nexport { createMongoExecutionContext, createMongoExecutionStack, createMongoParamRefMutator, createMongoRuntime, enumMemberCodecFor, flattenMongoParamRefs };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,SAAS,0BAA0B,SAAS;CAC3C,MAAM,EAAE,QAAQ,SAAS,QAAQ,eAAe,qBAAqB;EACpE,QAAQ,QAAQ;EAChB,SAAS,QAAQ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MAAM;CAC1B;AACD;AACA,SAAS,mBAAmB,SAAS;CACpC,OAAO,IAAI,iBAAiB,OAAO;AACpC"}
|
package/dist/schema-ir.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { type AnyMongoSchemaNode,
|
|
1
|
+
import { a as MongoSchemaCollectionOptionsInput, c as MongoSchemaIndex, d as MongoSchemaValidatorOptions, f as MongoSchemaVisitor, i as MongoSchemaCollectionOptions, l as MongoSchemaIndexOptions, n as MongoSchemaCollection, o as MongoSchemaIR, p as deepEqual, r as MongoSchemaCollectionCtorOptions, s as MongoSchemaIRNode, t as AnyMongoSchemaNode, u as MongoSchemaValidator } from "./index-BonKbeyU.mjs";
|
|
2
|
+
export { type AnyMongoSchemaNode, MongoSchemaCollection, type MongoSchemaCollectionCtorOptions, MongoSchemaCollectionOptions, type MongoSchemaCollectionOptionsInput, MongoSchemaIR, MongoSchemaIRNode, MongoSchemaIndex, type MongoSchemaIndexOptions, MongoSchemaValidator, type MongoSchemaValidatorOptions, type MongoSchemaVisitor, deepEqual };
|
package/dist/schema-ir.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export {
|
|
1
|
+
import { a as MongoSchemaIndex, i as MongoSchemaIRNode, n as MongoSchemaCollectionOptions, o as MongoSchemaValidator, r as MongoSchemaIR, s as deepEqual, t as MongoSchemaCollection } from "./exports-B2tu3O-g.mjs";
|
|
2
|
+
export { MongoSchemaCollection, MongoSchemaCollectionOptions, MongoSchemaIR, MongoSchemaIRNode, MongoSchemaIndex, MongoSchemaValidator, deepEqual };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as MongoContract } from "./mongo-value-set-DAGBOegv-B0Vel8d-.mjs";
|
|
2
|
-
import "./index-
|
|
3
|
-
import {
|
|
2
|
+
import "./index-B3o8NFNH.mjs";
|
|
3
|
+
import { o as MongoSchemaIR } from "./index-BonKbeyU.mjs";
|
|
4
4
|
import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
|
|
5
5
|
import { OperationContext, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
|
|
6
6
|
//#region ../../../2-mongo-family/9-family/dist/schema-verify.d.mts
|
|
@@ -20,4 +20,4 @@ interface VerifyMongoSchemaOptions {
|
|
|
20
20
|
declare function verifyMongoSchema(options: VerifyMongoSchemaOptions): VerifyDatabaseSchemaResult;
|
|
21
21
|
//#endregion
|
|
22
22
|
export { verifyMongoSchema as n, VerifyMongoSchemaOptions as t };
|
|
23
|
-
//# sourceMappingURL=schema-verify-
|
|
23
|
+
//# sourceMappingURL=schema-verify-BTRGeQWE.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-verify-
|
|
1
|
+
{"version":3,"file":"schema-verify-BTRGeQWE.d.mts","names":[],"sources":["../../../../2-mongo-family/9-family/dist/schema-verify.d.mts"],"mappings":";;;;;;;UAKU;WACC,UAAU;WACV,QAAQ;WACR;WACA,UAAU;;;;;;WAMV,qBAAqB,cAAc;;iBAE7B,kBAAkB,SAAS,2BAA2B"}
|
package/dist/{verify-mongo-schema-nsnAhPm8-DvsVH5bL.mjs → verify-mongo-schema-CyvUewwP-Dl3QC2wh.mjs}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { S as indexLookupKey, f as canonicalize, m as collectionControlPolicyOf, p as collectionControlPoliciesOf } from "./dist-BPlVwyAb.mjs";
|
|
2
|
+
import { a as MongoSchemaIndex, n as MongoSchemaCollectionOptions, o as MongoSchemaValidator, r as MongoSchemaIR, s as deepEqual, t as MongoSchemaCollection } from "./exports-B2tu3O-g.mjs";
|
|
3
3
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
4
4
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
5
5
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
6
6
|
import { VERIFY_CODE_SCHEMA_FAILURE, dispositionForCategory, issueOutcome } from "@prisma/orm-framework/components/control";
|
|
7
|
-
//#region ../../../2-mongo-family/9-family/dist/verify-mongo-schema-
|
|
7
|
+
//#region ../../../2-mongo-family/9-family/dist/verify-mongo-schema-CyvUewwP.mjs
|
|
8
8
|
function convertIndex(index) {
|
|
9
9
|
return new MongoSchemaIndex({
|
|
10
10
|
keys: index.keys,
|
|
@@ -203,6 +203,21 @@ function diffOptions(collName, live, expected, strict, collectionControlPolicy,
|
|
|
203
203
|
...ifDefined("actual", live.options)
|
|
204
204
|
}, "fail", failures, warnings);
|
|
205
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Canonicalizes a live (introspected) `MongoSchemaIR` against the expected
|
|
208
|
+
* (contract-built) IR before diffing. MongoDB applies server-side defaults
|
|
209
|
+
* to several option/index families that are absent from authored contracts,
|
|
210
|
+
* which would otherwise cause `verifyMongoSchema` to report false-positive
|
|
211
|
+
* drift on a fresh `migrate` run.
|
|
212
|
+
*
|
|
213
|
+
* The normalization is contract-aware where it has to be: server defaults
|
|
214
|
+
* are stripped from the live IR for fields the contract did not specify, so
|
|
215
|
+
* a contract that *does* specify a value still gets compared faithfully.
|
|
216
|
+
*
|
|
217
|
+
* Symmetric defaults — like `changeStreamPreAndPostImages: { enabled: false }`,
|
|
218
|
+
* which is equivalent to "absent" on both sides — are stripped from both IRs
|
|
219
|
+
* so either authoring style verifies.
|
|
220
|
+
*/
|
|
206
221
|
function canonicalizeSchemasForVerification(live, expected) {
|
|
207
222
|
const expectedByName = /* @__PURE__ */ new Map();
|
|
208
223
|
for (const c of expected.collections) expectedByName.set(c.name, c);
|
|
@@ -298,8 +313,11 @@ function canonicalizeLiveIndex(liveIndex, expectedIndex) {
|
|
|
298
313
|
* we have no counterpart we fall back to no normalization for that index.
|
|
299
314
|
*/
|
|
300
315
|
function findExpectedIndexCounterpart(liveIndex, expectedIndexes) {
|
|
301
|
-
const
|
|
302
|
-
|
|
316
|
+
const liveKeys = keyPatternOf(projectTextIndexKeys(liveIndex));
|
|
317
|
+
return expectedIndexes.find((expected) => keyPatternOf(expected.keys) === liveKeys);
|
|
318
|
+
}
|
|
319
|
+
function keyPatternOf(keys) {
|
|
320
|
+
return canonicalize(sortTextKeys(keys).map((k) => [k.field, k.direction]));
|
|
303
321
|
}
|
|
304
322
|
/**
|
|
305
323
|
* MongoDB expands a contract-shaped text index like
|
|
@@ -427,4 +445,4 @@ function resolveMongoCollectionControlPolicy(contract) {
|
|
|
427
445
|
//#endregion
|
|
428
446
|
export { verifyMongoSchema as i, contractToMongoSchemaIR as n, diffMongoSchemas as r, canonicalizeSchemasForVerification as t };
|
|
429
447
|
|
|
430
|
-
//# sourceMappingURL=verify-mongo-schema-
|
|
448
|
+
//# sourceMappingURL=verify-mongo-schema-CyvUewwP-Dl3QC2wh.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-mongo-schema-CyvUewwP-Dl3QC2wh.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/verify-mongo-schema-CyvUewwP.mjs"],"sourcesContent":["import { MongoSchemaCollection, MongoSchemaCollectionOptions, MongoSchemaIR, MongoSchemaIndex, MongoSchemaValidator, deepEqual } from \"@internal/mongo-schema-ir\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { canonicalize, collectionControlPoliciesOf, collectionControlPolicyOf, indexLookupKey } from \"@internal/mongo-contract\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { VERIFY_CODE_SCHEMA_FAILURE, dispositionForCategory, issueOutcome } from \"@internal/framework-components/control\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/core/contract-to-schema.ts\nfunction convertIndex(index) {\n\treturn new MongoSchemaIndex({\n\t\tkeys: index.keys,\n\t\tunique: index.unique,\n\t\tsparse: index.sparse,\n\t\texpireAfterSeconds: index.expireAfterSeconds,\n\t\tpartialFilterExpression: index.partialFilterExpression,\n\t\twildcardProjection: index.wildcardProjection,\n\t\tcollation: index.collation,\n\t\tweights: index.weights,\n\t\tdefault_language: index.default_language,\n\t\tlanguage_override: index.language_override\n\t});\n}\nfunction convertValidator(v) {\n\treturn new MongoSchemaValidator({\n\t\tjsonSchema: v.jsonSchema,\n\t\tvalidationLevel: v.validationLevel,\n\t\tvalidationAction: v.validationAction\n\t});\n}\nfunction convertOptions(o) {\n\treturn new MongoSchemaCollectionOptions({\n\t\t...ifDefined(\"capped\", o.capped !== void 0 ? {\n\t\t\tsize: o.capped.size,\n\t\t\t...ifDefined(\"max\", o.capped.max)\n\t\t} : void 0),\n\t\t...o.timeseries !== void 0 ? { timeseries: {\n\t\t\ttimeField: o.timeseries.timeField,\n\t\t\t...ifDefined(\"metaField\", o.timeseries.metaField),\n\t\t\t...ifDefined(\"granularity\", o.timeseries.granularity)\n\t\t} } : {},\n\t\t...o.collation !== void 0 ? { collation: {\n\t\t\tlocale: o.collation.locale,\n\t\t\t...ifDefined(\"caseLevel\", o.collation.caseLevel),\n\t\t\t...ifDefined(\"caseFirst\", o.collation.caseFirst),\n\t\t\t...ifDefined(\"strength\", o.collation.strength),\n\t\t\t...ifDefined(\"numericOrdering\", o.collation.numericOrdering),\n\t\t\t...ifDefined(\"alternate\", o.collation.alternate),\n\t\t\t...ifDefined(\"maxVariable\", o.collation.maxVariable),\n\t\t\t...ifDefined(\"backwards\", o.collation.backwards),\n\t\t\t...ifDefined(\"normalization\", o.collation.normalization)\n\t\t} } : {},\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", o.changeStreamPreAndPostImages !== void 0 ? { enabled: o.changeStreamPreAndPostImages.enabled } : void 0),\n\t\t...ifDefined(\"clusteredIndex\", o.clusteredIndex)\n\t});\n}\nfunction convertCollection(name, def) {\n\treturn new MongoSchemaCollection({\n\t\tname,\n\t\tindexes: (def.indexes ?? []).map(convertIndex),\n\t\t...ifDefined(\"validator\", def.validator != null ? convertValidator(def.validator) : void 0),\n\t\t...ifDefined(\"options\", def.options != null ? convertOptions(def.options) : void 0)\n\t});\n}\nfunction contractToMongoSchemaIR(contract) {\n\tif (!contract) return new MongoSchemaIR([]);\n\tconst collections = [];\n\tfor (const ns of Object.values(contract.storage.namespaces)) for (const [name, def] of Object.entries(ns.entries.collection ?? {})) collections.push(convertCollection(name, def));\n\treturn new MongoSchemaIR(collections);\n}\n//#endregion\n//#region src/core/schema-verify/verifier-disposition.ts\n/**\n* Classifies a Mongo schema-diff issue into the target-neutral categories the\n* framework grades. Mongo issues carry their coordinate as `path`\n* (`[collectionName]` for a whole collection, `[collectionName, auxiliary]`\n* for an index/validator/options finding), so a `not-expected` issue at\n* depth 1 is an undeclared whole collection and anything deeper is an\n* undeclared auxiliary. Mongo owns this mapping rather than importing the\n* SQL classifier — the two families share only the framework's category\n* grading.\n*/\nfunction classifyMongoDiffIssue(issue) {\n\tif (issueOutcome(issue) === \"not-found\") return \"declaredMissing\";\n\tif (issueOutcome(issue) === \"not-expected\") return issue.path.length <= 1 ? \"extraTopLevelObject\" : \"extraAuxiliary\";\n\treturn \"declaredIncompatible\";\n}\nfunction verifierDisposition(controlPolicy, issue) {\n\treturn dispositionForCategory(controlPolicy, classifyMongoDiffIssue(issue));\n}\n//#endregion\n//#region src/core/schema-diff.ts\n/**\n* Reconciles a control-policy disposition with the Mongo family's strict-mode\n* contract for live-only extras — the single point where `strict` and the\n* control policy meet.\n*\n* The control policy decides first; only a `fail` is reconciled against the\n* caller's base outcome. Call sites grade a live-only extra with\n* `strict ? 'fail' : 'warn'` and a declared missing/mismatch with `fail`, so\n* this one step encodes the whole matrix:\n*\n* | live-vs-declared | strict | non-strict |\n* |-------------------------------------|----------|------------|\n* | declared missing / mismatch | fail | fail |\n* | live-only extra (managed/tolerated) | fail | warn |\n* | live-only extra (external) | suppress (extras ignored, both modes) |\n* | anything (observed) | warn (both modes) |\n*\n* `tolerated` does not diverge from `managed` on a non-strict extra index:\n* both soften to `warn`, because the softening comes from the base outcome the\n* caller already computed from `strict`, not from per-policy special-casing.\n*/\nfunction emitMongoIssueUnderControlPolicy(controlPolicy, issue, baseOutcome, failures, warnings) {\n\tconst disposition = verifierDisposition(controlPolicy, issue);\n\tconst outcome = disposition === \"fail\" ? baseOutcome : disposition;\n\tif (outcome === \"suppress\") return \"suppress\";\n\tif (outcome === \"warn\") warnings.push(issue);\n\telse failures.push(issue);\n\treturn outcome;\n}\nfunction diffMongoSchemas(live, expected, strict, collectionControlPolicy) {\n\tconst failures = [];\n\tconst warnings = [];\n\tconst allNames = /* @__PURE__ */ new Set([...live.collectionNames, ...expected.collectionNames]);\n\tfor (const name of [...allNames].sort()) {\n\t\tconst liveColl = live.collection(name);\n\t\tconst expectedColl = expected.collection(name);\n\t\tif (!liveColl && expectedColl) {\n\t\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy(name), {\n\t\t\t\tpath: [name],\n\t\t\t\texpected: expectedColl\n\t\t\t}, \"fail\", failures, warnings);\n\t\t\tcontinue;\n\t\t}\n\t\tif (liveColl && !expectedColl) {\n\t\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy(name), {\n\t\t\t\tpath: [name],\n\t\t\t\tactual: liveColl\n\t\t\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n\t\t\tcontinue;\n\t\t}\n\t\tconst lc = liveColl;\n\t\tconst ec = expectedColl;\n\t\tconst controlPolicy = collectionControlPolicy(name);\n\t\tdiffIndexes(name, lc, ec, strict, controlPolicy, failures, warnings);\n\t\tdiffValidator(name, lc, ec, strict, controlPolicy, failures, warnings);\n\t\tdiffOptions(name, lc, ec, strict, controlPolicy, failures, warnings);\n\t}\n\treturn {\n\t\tfailures,\n\t\twarnings\n\t};\n}\nfunction formatIndexName(index) {\n\treturn index.keys.map((k) => `${k.field}:${k.direction}`).join(\", \");\n}\nfunction diffIndexes(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {\n\tconst liveLookup = /* @__PURE__ */ new Map();\n\tfor (const idx of live.indexes) liveLookup.set(indexLookupKey(idx), idx);\n\tconst expectedLookup = /* @__PURE__ */ new Map();\n\tfor (const idx of expected.indexes) expectedLookup.set(indexLookupKey(idx), idx);\n\tfor (const [key, idx] of expectedLookup) if (!liveLookup.has(key)) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, `index:${formatIndexName(idx)}`],\n\t\texpected: idx\n\t}, \"fail\", failures, warnings);\n\tfor (const [key, idx] of liveLookup) if (!expectedLookup.has(key)) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, `index:${formatIndexName(idx)}`],\n\t\tactual: idx\n\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n}\nfunction diffValidator(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {\n\tif (!live.validator && !expected.validator) return;\n\tif (expected.validator && !live.validator) {\n\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, \"validator\"],\n\t\t\texpected: expected.validator\n\t\t}, \"fail\", failures, warnings);\n\t\treturn;\n\t}\n\tif (!expected.validator && live.validator) {\n\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, \"validator\"],\n\t\t\tactual: live.validator\n\t\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n\t\treturn;\n\t}\n\tconst liveVal = live.validator;\n\tconst expectedVal = expected.validator;\n\tif (canonicalize(liveVal.jsonSchema) !== canonicalize(expectedVal.jsonSchema) || liveVal.validationLevel !== expectedVal.validationLevel || liveVal.validationAction !== expectedVal.validationAction) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, \"validator\"],\n\t\texpected: expectedVal,\n\t\tactual: liveVal\n\t}, \"fail\", failures, warnings);\n}\nfunction diffOptions(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {\n\tif (!live.options && !expected.options) return;\n\tif (!expected.options && live.options) {\n\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, \"options\"],\n\t\t\tactual: live.options\n\t\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n\t\treturn;\n\t}\n\tif (deepEqual(live.options, expected.options)) return;\n\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, \"options\"],\n\t\t...ifDefined(\"expected\", expected.options),\n\t\t...ifDefined(\"actual\", live.options)\n\t}, \"fail\", failures, warnings);\n}\n//#endregion\n//#region src/core/schema-verify/canonicalize-introspection.ts\n/**\n* Canonicalizes a live (introspected) `MongoSchemaIR` against the expected\n* (contract-built) IR before diffing. MongoDB applies server-side defaults\n* to several option/index families that are absent from authored contracts,\n* which would otherwise cause `verifyMongoSchema` to report false-positive\n* drift on a fresh `migrate` run.\n*\n* The normalization is contract-aware where it has to be: server defaults\n* are stripped from the live IR for fields the contract did not specify, so\n* a contract that *does* specify a value still gets compared faithfully.\n*\n* Symmetric defaults — like `changeStreamPreAndPostImages: { enabled: false }`,\n* which is equivalent to \"absent\" on both sides — are stripped from both IRs\n* so either authoring style verifies.\n*/\nfunction canonicalizeSchemasForVerification(live, expected) {\n\tconst expectedByName = /* @__PURE__ */ new Map();\n\tfor (const c of expected.collections) expectedByName.set(c.name, c);\n\tconst liveByName = /* @__PURE__ */ new Map();\n\tfor (const c of live.collections) liveByName.set(c.name, c);\n\tconst canonicalLive = live.collections.map((c) => canonicalizeLiveCollection(c, expectedByName.get(c.name)));\n\tconst canonicalExpected = expected.collections.map((c) => canonicalizeExpectedCollection(c, liveByName.get(c.name)));\n\treturn {\n\t\tlive: new MongoSchemaIR(canonicalLive),\n\t\texpected: new MongoSchemaIR(canonicalExpected)\n\t};\n}\nfunction canonicalizeLiveCollection(liveColl, expectedColl) {\n\tconst expectedIndexes = expectedColl?.indexes ?? [];\n\tconst indexes = liveColl.indexes.map((idx) => canonicalizeLiveIndex(idx, findExpectedIndexCounterpart(idx, expectedIndexes)));\n\tconst options = liveColl.options ? canonicalizeLiveOptions(liveColl.options, expectedColl?.options) : void 0;\n\treturn new MongoSchemaCollection({\n\t\tname: liveColl.name,\n\t\tindexes,\n\t\t...ifDefined(\"validator\", liveColl.validator),\n\t\t...ifDefined(\"options\", options)\n\t});\n}\nfunction canonicalizeExpectedCollection(expectedColl, liveColl) {\n\tconst indexes = expectedColl.indexes.map(canonicalizeTextIndexKeyOrder);\n\tconst options = expectedColl.options ? canonicalizeExpectedOptions(expectedColl.options, liveColl?.options) : void 0;\n\treturn new MongoSchemaCollection({\n\t\tname: expectedColl.name,\n\t\tindexes,\n\t\t...ifDefined(\"validator\", expectedColl.validator),\n\t\t...ifDefined(\"options\", options)\n\t});\n}\nfunction canonicalizeTextIndexKeyOrder(index) {\n\tif (!index.keys.some((k) => k.direction === \"text\")) return index;\n\treturn new MongoSchemaIndex({\n\t\tkeys: sortTextKeys(index.keys),\n\t\tunique: index.unique,\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}\n/**\n* Returns a copy of `keys` with text-direction entries sorted alphabetically\n* while preserving the relative position of non-text entries. Compound text\n* indexes (`{a: 1, _fts: 'text', _ftsx: 1, b: 1}`) keep their scalar\n* prefix/suffix layout; only the contiguous text block is reordered.\n*/\nfunction sortTextKeys(keys) {\n\tconst textEntries = keys.filter((k) => k.direction === \"text\");\n\tif (textEntries.length <= 1) return keys;\n\tconst sortedText = [...textEntries].sort((a, b) => a.field.localeCompare(b.field));\n\tlet textIdx = 0;\n\treturn keys.map((k) => {\n\t\tif (k.direction !== \"text\") return k;\n\t\tconst next = sortedText[textIdx++];\n\t\t/* v8 ignore next 3 -- @preserve invariant guard: textIdx is always < sortedText.length here because we only consume sortedText for text-direction entries and sortedText is built from the same filter. */\n\t\tif (next === void 0) throw new InternalError(\"sortTextKeys: text-key counts mismatched\");\n\t\treturn next;\n\t});\n}\nfunction canonicalizeLiveIndex(liveIndex, expectedIndex) {\n\tconst projectedKeys = sortTextKeys(projectTextIndexKeys(liveIndex));\n\tconst collation = liveIndex.collation ? stripCollationFields(liveIndex.collation, expectedIndex?.collation) : liveIndex.collation;\n\tconst weights = expectedIndex?.weights === void 0 && hasDefaultTextWeights(projectedKeys, liveIndex.weights) ? void 0 : liveIndex.weights;\n\tconst default_language = expectedIndex?.default_language === void 0 && liveIndex.default_language === \"english\" ? void 0 : liveIndex.default_language;\n\tconst language_override = expectedIndex?.language_override === void 0 && liveIndex.language_override === \"language\" ? void 0 : liveIndex.language_override;\n\treturn new MongoSchemaIndex({\n\t\tkeys: projectedKeys,\n\t\tunique: liveIndex.unique,\n\t\t...ifDefined(\"sparse\", liveIndex.sparse),\n\t\t...ifDefined(\"expireAfterSeconds\", liveIndex.expireAfterSeconds),\n\t\t...ifDefined(\"partialFilterExpression\", liveIndex.partialFilterExpression),\n\t\t...ifDefined(\"wildcardProjection\", liveIndex.wildcardProjection),\n\t\t...ifDefined(\"collation\", collation),\n\t\t...ifDefined(\"weights\", weights),\n\t\t...ifDefined(\"default_language\", default_language),\n\t\t...ifDefined(\"language_override\", language_override)\n\t});\n}\n/**\n* Locate the contract-side index that corresponds to a live index for the\n* purpose of contract-aware normalization. We deliberately match by the\n* *projected* (contract-shaped) key list — so a live `_fts/_ftsx` index\n* resolves to a contract `{title: 'text', body: 'text'}` index — and pick\n* the first match. Contracts very rarely contain duplicate-key indexes; if\n* we have no counterpart we fall back to no normalization for that index.\n*/\nfunction findExpectedIndexCounterpart(liveIndex, expectedIndexes) {\n\tconst liveKeys = keyPatternOf(projectTextIndexKeys(liveIndex));\n\treturn expectedIndexes.find((expected) => keyPatternOf(expected.keys) === liveKeys);\n}\nfunction keyPatternOf(keys) {\n\treturn canonicalize(sortTextKeys(keys).map((k) => [k.field, k.direction]));\n}\n/**\n* MongoDB expands a contract-shaped text index like\n* `[{title: 'text'}, {body: 'text'}]` into its internal weighted vector\n* representation `[{_fts: 'text'}, {_ftsx: 1}]`. We project back to\n* contract-shaped keys via `weights`, iterating in whatever order MongoDB\n* returns them (alphabetical, in practice). `sortTextKeys` is applied\n* downstream to canonicalize the order on both sides, so this projection\n* does not depend on a specific iteration order.\n*/\nfunction projectTextIndexKeys(liveIndex) {\n\tif (!(liveIndex.keys.length >= 1 && liveIndex.keys.some((k) => k.field === \"_fts\" && k.direction === \"text\")) || !liveIndex.weights) return liveIndex.keys;\n\tconst textKeys = Object.keys(liveIndex.weights).map((field) => ({\n\t\tfield,\n\t\tdirection: \"text\"\n\t}));\n\tconst projectedKeys = [];\n\tfor (const key of liveIndex.keys) {\n\t\tif (key.field === \"_ftsx\") continue;\n\t\tif (key.field === \"_fts\") {\n\t\t\tprojectedKeys.push(...textKeys);\n\t\t\tcontinue;\n\t\t}\n\t\tprojectedKeys.push(key);\n\t}\n\treturn projectedKeys;\n}\n/**\n* MongoDB's server-default `weights` for an authored-without-weights text\n* index assigns `1` to every text-direction field. Returns `true` only when\n* `liveWeights` is exactly that uniform shape (every projected text-direction\n* key weighted at `1`) so the canonicalizer leaves non-default weights —\n* including out-of-band relevance tweaks — visible to the verifier.\n*\n* `projectTextIndexKeys` derives text-direction keys from the live weights\n* map, so the count is guaranteed to match; we only have to check the value\n* shape.\n*/\nfunction hasDefaultTextWeights(projectedKeys, liveWeights) {\n\tif (liveWeights === void 0) return false;\n\treturn projectedKeys.filter((k) => k.direction === \"text\").map((k) => k.field).every((field) => liveWeights[field] === 1);\n}\nfunction canonicalizeLiveOptions(liveOptions, expectedOptions) {\n\tconst collation = liveOptions.collation ? stripCollationFields(liveOptions.collation, expectedOptions?.collation) : void 0;\n\tconst timeseries = liveOptions.timeseries ? stripUnspecifiedFields(liveOptions.timeseries, expectedOptions?.timeseries) : void 0;\n\tconst clusteredIndex = liveOptions.clusteredIndex ? stripUnspecifiedFields(liveOptions.clusteredIndex, expectedOptions?.clusteredIndex) : void 0;\n\tconst changeStreamPreAndPostImages = isDisabledChangeStream(liveOptions.changeStreamPreAndPostImages) ? void 0 : liveOptions.changeStreamPreAndPostImages;\n\tif (!(liveOptions.capped || timeseries || collation || changeStreamPreAndPostImages || clusteredIndex)) return void 0;\n\treturn new MongoSchemaCollectionOptions({\n\t\t...ifDefined(\"capped\", liveOptions.capped),\n\t\t...ifDefined(\"timeseries\", timeseries),\n\t\t...ifDefined(\"collation\", collation),\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", changeStreamPreAndPostImages),\n\t\t...ifDefined(\"clusteredIndex\", clusteredIndex)\n\t});\n}\nfunction canonicalizeExpectedOptions(expectedOptions, _liveOptions) {\n\tconst changeStreamPreAndPostImages = isDisabledChangeStream(expectedOptions.changeStreamPreAndPostImages) ? void 0 : expectedOptions.changeStreamPreAndPostImages;\n\tif (!(expectedOptions.capped || expectedOptions.timeseries || expectedOptions.collation || changeStreamPreAndPostImages || expectedOptions.clusteredIndex)) return void 0;\n\treturn new MongoSchemaCollectionOptions({\n\t\t...ifDefined(\"capped\", expectedOptions.capped),\n\t\t...ifDefined(\"timeseries\", expectedOptions.timeseries),\n\t\t...ifDefined(\"collation\", expectedOptions.collation),\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", changeStreamPreAndPostImages),\n\t\t...ifDefined(\"clusteredIndex\", expectedOptions.clusteredIndex)\n\t});\n}\nfunction isDisabledChangeStream(value) {\n\treturn value !== void 0 && value.enabled === false;\n}\n/**\n* Returns a copy of `live` containing only the keys that `expected` defines.\n* Used for option families whose individual sub-fields are server-extended\n* with platform defaults (collation, timeseries, clusteredIndex), so the\n* verifier should compare only what the contract actually authored.\n*\n* When `expected` is `undefined` — i.e. the contract authored nothing for\n* this whole option family but the live IR has it — we return `live`\n* unchanged so the verifier still sees the entire live block and can\n* surface it as drift. (Returning `undefined` here would silently strip a\n* server-attached collation/timeseries/clusteredIndex that the contract\n* never asked for, hiding real drift.)\n*/\nfunction stripCollationFields(live, expected) {\n\treturn blindCast(stripUnspecifiedFields(live, expected));\n}\nfunction stripUnspecifiedFields(live, expected) {\n\tif (expected === void 0) return live;\n\tconst out = {};\n\tfor (const key of Object.keys(expected)) if (Object.hasOwn(live, key)) out[key] = live[key];\n\treturn out;\n}\n//#endregion\n//#region src/core/schema-verify/verify-mongo-schema.ts\nfunction verifyMongoSchema(options) {\n\tconst { contract, schema, strict, context } = options;\n\tconst startTime = Date.now();\n\tconst { live: canonicalLive, expected: canonicalExpected } = canonicalizeSchemasForVerification(schema, contractToMongoSchemaIR(contract));\n\tconst { failures, warnings } = diffMongoSchemas(canonicalLive, canonicalExpected, strict, resolveMongoCollectionControlPolicy(contract));\n\tconst ok = failures.length === 0;\n\tconst profileHash = typeof contract.profileHash === \"string\" ? contract.profileHash : \"\";\n\treturn {\n\t\tok,\n\t\t...ifDefined(\"code\", ok ? void 0 : VERIFY_CODE_SCHEMA_FAILURE),\n\t\tsummary: ok ? \"Schema matches contract\" : `Schema verification found ${failures.length} issue(s)`,\n\t\tcontract: {\n\t\t\tstorageHash: contract.storage.storageHash,\n\t\t\t...profileHash ? { profileHash } : {}\n\t\t},\n\t\ttarget: { expected: contract.target },\n\t\tschema: {\n\t\t\tissues: failures,\n\t\t\twarnings: { issues: warnings }\n\t\t},\n\t\tmeta: {\n\t\t\tstrict,\n\t\t\t...ifDefined(\"contractPath\", context?.contractPath),\n\t\t\t...ifDefined(\"configPath\", context?.configPath)\n\t\t},\n\t\ttimings: { total: Date.now() - startTime }\n\t};\n}\nfunction resolveMongoCollectionControlPolicy(contract) {\n\tconst policies = collectionControlPoliciesOf(contract);\n\treturn (collectionName) => collectionControlPolicyOf(collectionName, policies);\n}\n//#endregion\nexport { contractToMongoSchemaIR as i, canonicalizeSchemasForVerification as n, diffMongoSchemas as r, verifyMongoSchema as t };\n\n//# sourceMappingURL=verify-mongo-schema-CyvUewwP.mjs.map"],"mappings":";;;;;;;AAOA,SAAS,aAAa,OAAO;CAC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AS,gBAAgB,WAAW,SAAS,cAAc;CACtF,OAAO;EACN;EACA,GAAG,UAAU,QAAQ,KAAK,KAAK,IAAI,0BAA0B;EAC7D,SAAS,KAAK,4BAA4B,6BAA6B,SAAS,OAAO;EACvF,UAAU;GACT,aAAa,SAAS,QAAQ;GAC9B,GAAG,cAAc,EAAE,YAAY,IAAI,CAAC;EACrC;EACA,QAAQ,EAAE,UAAU,SAAS,OAAO;EACpC,QAAQ;GACP,QAAQ;GACR,UAAU,EAAE,QAAQ,SAAS;EAC9B;EACA,MAAM;GACL;GACA,GAAG,UAAU,gBAAgB,SAAS,YAAY;GAClD,GAAG,UAAU,cAAc,SAAS,UAAU;EAC/C;EACA,SAAS,EAAE,OAAO,KAAK,IAAI,IAAI,UAAU;CAC1C;AACD;AACA,SAAS,oCAAoC,UAAU;CACtD,MAAM,WAAW,4BAA4B,QAAQ;CACrD,QAAQ,mBAAmB,0BAA0B,gBAAgB,QAAQ;AAC9E"}
|
package/dist/wire.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as InsertOneResult, c as UpdateManyResult, i as InsertManyResult, l as UpdateOneResult, n as DeleteOneResult, t as DeleteManyResult } from "./execution-
|
|
2
|
-
import { _ as UpdateManyWireCommand, a as CollModWireCommand, c as DeleteManyWireCommand, d as DropIndexWireCommand, f as FindOneAndDeleteWireCommand, g as RenameCollectionWireCommand, h as InsertOneWireCommand, i as AnyMongoWireCommand, l as DeleteOneWireCommand, m as InsertManyWireCommand, n as AnyMongoDdlWireCommand, o as CreateCollectionWireCommand, p as FindOneAndUpdateWireCommand, r as AnyMongoDmlWireCommand, s as CreateIndexWireCommand, t as AggregateWireCommand, u as DropCollectionWireCommand, v as UpdateOneWireCommand, y as isDdlWireCommand } from "./index-
|
|
1
|
+
import { a as InsertOneResult, c as UpdateManyResult, i as InsertManyResult, l as UpdateOneResult, n as DeleteOneResult, t as DeleteManyResult } from "./execution-CZhOXkot.mjs";
|
|
2
|
+
import { _ as UpdateManyWireCommand, a as CollModWireCommand, c as DeleteManyWireCommand, d as DropIndexWireCommand, f as FindOneAndDeleteWireCommand, g as RenameCollectionWireCommand, h as InsertOneWireCommand, i as AnyMongoWireCommand, l as DeleteOneWireCommand, m as InsertManyWireCommand, n as AnyMongoDdlWireCommand, o as CreateCollectionWireCommand, p as FindOneAndUpdateWireCommand, r as AnyMongoDmlWireCommand, s as CreateIndexWireCommand, t as AggregateWireCommand, u as DropCollectionWireCommand, v as UpdateOneWireCommand, y as isDdlWireCommand } from "./index-D9TThYU9.mjs";
|
|
3
3
|
export { AggregateWireCommand, type AnyMongoDdlWireCommand, type AnyMongoDmlWireCommand, type AnyMongoWireCommand, CollModWireCommand, CreateCollectionWireCommand, CreateIndexWireCommand, type DeleteManyResult, DeleteManyWireCommand, type DeleteOneResult, DeleteOneWireCommand, DropCollectionWireCommand, DropIndexWireCommand, FindOneAndDeleteWireCommand, FindOneAndUpdateWireCommand, type InsertManyResult, InsertManyWireCommand, type InsertOneResult, InsertOneWireCommand, RenameCollectionWireCommand, type UpdateManyResult, UpdateManyWireCommand, type UpdateOneResult, UpdateOneWireCommand, isDdlWireCommand };
|