@prisma/orm-family-mongo 8.0.0-rc.21-dev.20 → 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.
@@ -3,7 +3,7 @@ import "./index-B3o8NFNH.mjs";
3
3
  import { o as MongoSchemaIR } from "./index-BonKbeyU.mjs";
4
4
  import { At as RawUpdateManyCommand } from "./query-plan-C7sSU3Al-wzsJKtml.mjs";
5
5
  import "./execution-CZhOXkot.mjs";
6
- import { i as MongoRunnerDependencies } from "./control-adapter-CLIE-kQU-BCu2nSWb.mjs";
6
+ import { i as MongoRunnerDependencies } from "./control-adapter-BheElqfe-BVp5aOMr.mjs";
7
7
  import { Contract, ControlPolicy } from "@prisma/orm-framework/contract/types";
8
8
  import { ContractSerializer, ContractSpace, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlFamilyInstance, ControlStack, MigratableTargetDescriptor, MigrationPlanOperation, OperationPreview, OperationPreviewCapable, SchemaDiffIssue, SchemaVerifier, SchemaViewCapable } from "@prisma/orm-framework/components/control";
9
9
  //#region ../../../2-mongo-family/9-family/dist/control.d.mts
@@ -121,4 +121,4 @@ interface CanonicalizedSchemas {
121
121
  declare function canonicalizeSchemasForVerification(live: MongoSchemaIR, expected: MongoSchemaIR): CanonicalizedSchemas;
122
122
  //#endregion
123
123
  export { canonicalizeSchemasForVerification as a, diffMongoSchemas as c, mongoFamilyDescriptor as d, mongoOperationsToPreview as f, MongoControlTargetDescriptor as i, fieldRewriteOf as l, MongoControlExtensionDescriptor as n, contractToMongoSchemaIR as o, MongoControlFamilyInstance as r, createMongoFamilyInstance as s, FieldRewrite as t, formatMongoOperations as u };
124
- //# sourceMappingURL=control-Ci-GHZS3.d.mts.map
124
+ //# sourceMappingURL=control-Cpgdr11Q.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-Ci-GHZS3.d.mts","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control.d.mts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cAAc;;;;;UAK7C;WACC;;WAEA;WACA,SAAS;;;;;;iBAMH,eAAe,WAAW,yBAAyB;;;iBAGnD,sBAAsB,qBAAqB;;;;;;iBAM3C,yBAAyB,qBAAqB,2BAA2B;;;;;;;;;;;;;UAahF;WACC,mBAAmB;WACnB,mBAAmB;;iBAEb,iBAAiB,MAAM,eAAe,UAAU,eAAe,iBAAiB,0BAA0B,2BAA2B,gBAAgB;;;UAG5J;WACC,MAAM;WACN,UAAU;;iBAEJ,mCAAmC,MAAM,eAAe,UAAU,gBAAgB"}
@@ -1,9 +1,9 @@
1
1
  import { o as MongoSchemaIR } from "./index-BonKbeyU.mjs";
2
2
  import { _ as MongoInspectionCommandVisitor, t as AnyMongoDdlCommand } from "./control-DVHcBUoh.mjs";
3
- import { i as MongoDriver, t as MongoAdapter } from "./index-y5fGsR1i.mjs";
3
+ import { o as MongoQueryable, t as MongoAdapter } from "./index-Bh6a8q-2.mjs";
4
4
  import { ContractMarkerRecord, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
5
5
  import { ControlAdapterDescriptor, ControlAdapterInstance, ControlDriverInstance } from "@prisma/orm-framework/components/control";
6
- //#region ../../../2-mongo-family/9-family/dist/control-adapter-CLIE-kQU.d.mts
6
+ //#region ../../../2-mongo-family/9-family/dist/control-adapter-BheElqfe.d.mts
7
7
  //#region src/core/control-adapter.d.ts
8
8
  /**
9
9
  * Marker / ledger operations the Mongo runner depends on. Every method
@@ -38,7 +38,7 @@ interface MarkerOperations {
38
38
  interface MongoRunnerDependencies {
39
39
  readonly inspectionExecutor: MongoInspectionCommandVisitor<Promise<Record<string, unknown>[]>>;
40
40
  readonly adapter: MongoAdapter;
41
- readonly driver: MongoDriver;
41
+ readonly driver: MongoQueryable;
42
42
  readonly executeDdl: (command: AnyMongoDdlCommand) => Promise<void>;
43
43
  readonly markerOps: MarkerOperations;
44
44
  readonly introspectSchema: () => Promise<MongoSchemaIR>;
@@ -126,4 +126,4 @@ interface MongoControlAdapter<TTarget extends string = string> extends ControlAd
126
126
  interface MongoControlAdapterDescriptor<TTarget extends string = string> extends ControlAdapterDescriptor<'mongo', TTarget, MongoControlAdapter<TTarget>> {}
127
127
  //#endregion
128
128
  export { MongoRunnerDependencies as i, MongoControlAdapter as n, MongoControlAdapterDescriptor as r, MarkerOperations as t };
129
- //# sourceMappingURL=control-adapter-CLIE-kQU-BCu2nSWb.d.mts.map
129
+ //# sourceMappingURL=control-adapter-BheElqfe-BVp5aOMr.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-adapter-CLIE-kQU-BCu2nSWb.d.mts","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control-adapter-CLIE-kQU.d.mts"],"mappings":";;;;;;;;;;;;;UAYU;EACR,WAAW,gBAAgB,QAAQ;EACnC,WAAW,eAAe;aACf;aACA;aACA;MACP;EACJ,aAAa,eAAe,sBAAsB;aACvC;aACA;aACA;MACP;EACJ,iBAAiB,eAAe;aACrB;aACA;aACA;aACA;aACA;aACA;MACP;;;;;UAKI;WACC,oBAAoB,8BAA8B,QAAQ;WAC1D,SAAS;WACT,QAAQ;WACR,aAAa,SAAS,uBAAuB;WAC7C,WAAW;WACX,wBAAwB,QAAQ;;;;;;;;;;;;;;;UAejC,oBAAoB,yCAAyC,gCAAgC;;WAE5F;;;;;;;EAOT,WAAW,QAAQ,+BAA+B,UAAU,gBAAgB,QAAQ;;;;;;;EAOpF,eAAe,QAAQ,+BAA+B,WAAW,QAAQ,oBAAoB;;;;EAI7F,WAAW,QAAQ,+BAA+B,UAAU,eAAe;aAChE;aACA;aACA;MACP;;;;;;EAMJ,aAAa,QAAQ,+BAA+B,UAAU,eAAe,sBAAsB;aACxF;aACA;aACA;MACP;;;;;;EAMJ,iBAAiB,QAAQ,+BAA+B,UAAU,eAAe;aACtE;aACA;aACA;aACA;aACA;aACA;MACP;;;;;EAKJ,WAAW,QAAQ,+BAA+B,UAAU,iBAAiB,iBAAiB;;;;EAI9F,iBAAiB,QAAQ,+BAA+B,WAAW,QAAQ;;;;EAI3E,yBAAyB,QAAQ,+BAA+B,WAAW;;;;;;;UAOnE,8BAA8B,yCAAyC,kCAAkC,SAAS,oBAAoB"}
1
+ {"version":3,"file":"control-adapter-BheElqfe-BVp5aOMr.d.mts","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control-adapter-BheElqfe.d.mts"],"mappings":";;;;;;;;;;;;;UAYU;EACR,WAAW,gBAAgB,QAAQ;EACnC,WAAW,eAAe;aACf;aACA;aACA;MACP;EACJ,aAAa,eAAe,sBAAsB;aACvC;aACA;aACA;MACP;EACJ,iBAAiB,eAAe;aACrB;aACA;aACA;aACA;aACA;aACA;MACP;;;;;UAKI;WACC,oBAAoB,8BAA8B,QAAQ;WAC1D,SAAS;WACT,QAAQ;WACR,aAAa,SAAS,uBAAuB;WAC7C,WAAW;WACX,wBAAwB,QAAQ;;;;;;;;;;;;;;;UAejC,oBAAoB,yCAAyC,gCAAgC;;WAE5F;;;;;;;EAOT,WAAW,QAAQ,+BAA+B,UAAU,gBAAgB,QAAQ;;;;;;;EAOpF,eAAe,QAAQ,+BAA+B,WAAW,QAAQ,oBAAoB;;;;EAI7F,WAAW,QAAQ,+BAA+B,UAAU,eAAe;aAChE;aACA;aACA;MACP;;;;;;EAMJ,aAAa,QAAQ,+BAA+B,UAAU,eAAe,sBAAsB;aACxF;aACA;aACA;MACP;;;;;;EAMJ,iBAAiB,QAAQ,+BAA+B,UAAU,eAAe;aACtE;aACA;aACA;aACA;aACA;aACA;MACP;;;;;EAKJ,WAAW,QAAQ,+BAA+B,UAAU,iBAAiB,iBAAiB;;;;EAI9F,iBAAiB,QAAQ,+BAA+B,WAAW,QAAQ;;;;EAI3E,yBAAyB,QAAQ,+BAA+B,WAAW;;;;;;;UAOnE,8BAA8B,yCAAyC,kCAAkC,SAAS,oBAAoB"}
@@ -0,0 +1 @@
1
+ import "./control-adapter-BheElqfe-BVp5aOMr.mjs";
package/dist/family.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { H as defaultMongoStorageNamespaceId, V as defaultMongoDomainNamespaceId } from "./index-B3o8NFNH.mjs";
2
- import { i as MongoRunnerDependencies, n as MongoControlAdapter, r as MongoControlAdapterDescriptor, t as MarkerOperations } from "./control-adapter-CLIE-kQU-BCu2nSWb.mjs";
3
- import { a as canonicalizeSchemasForVerification, c as diffMongoSchemas, d as mongoFamilyDescriptor, f as mongoOperationsToPreview, i as MongoControlTargetDescriptor, l as fieldRewriteOf, n as MongoControlExtensionDescriptor, o as contractToMongoSchemaIR, r as MongoControlFamilyInstance, s as createMongoFamilyInstance, t as FieldRewrite, u as formatMongoOperations } from "./control-Ci-GHZS3.mjs";
4
- import "./control-adapter-D6x3BQ0H.mjs";
2
+ import { i as MongoRunnerDependencies, n as MongoControlAdapter, r as MongoControlAdapterDescriptor, t as MarkerOperations } from "./control-adapter-BheElqfe-BVp5aOMr.mjs";
3
+ import { a as canonicalizeSchemasForVerification, c as diffMongoSchemas, d as mongoFamilyDescriptor, f as mongoOperationsToPreview, i as MongoControlTargetDescriptor, l as fieldRewriteOf, n as MongoControlExtensionDescriptor, o as contractToMongoSchemaIR, r as MongoControlFamilyInstance, s as createMongoFamilyInstance, t as FieldRewrite, u as formatMongoOperations } from "./control-Cpgdr11Q.mjs";
4
+ import "./control-adapter-CGIKt9Hq.mjs";
5
5
  import { t as MongoContractView$1 } from "./mongo-contract-view-AnejqfrQ-k0FbFieN.mjs";
6
6
  import { n as MongoContractSerializerBase, r as MongoSchemaVerifierBase, t as MongoContractSerializer } from "./ir-ZONNL1YV.mjs";
7
7
  import { t as MongoMigration } from "./migration-RzYuoweU.mjs";
@@ -1,3 +1,3 @@
1
- import { i as MongoRunnerDependencies, n as MongoControlAdapter, r as MongoControlAdapterDescriptor, t as MarkerOperations } from "./control-adapter-CLIE-kQU-BCu2nSWb.mjs";
2
- import "./control-adapter-D6x3BQ0H.mjs";
1
+ import { i as MongoRunnerDependencies, n as MongoControlAdapter, r as MongoControlAdapterDescriptor, t as MarkerOperations } from "./control-adapter-BheElqfe-BVp5aOMr.mjs";
2
+ import "./control-adapter-CGIKt9Hq.mjs";
3
3
  export type { MarkerOperations, MongoControlAdapter, MongoControlAdapterDescriptor, MongoRunnerDependencies };
@@ -1,2 +1,2 @@
1
- import { a as canonicalizeSchemasForVerification, c as diffMongoSchemas, d as mongoFamilyDescriptor, f as mongoOperationsToPreview, i as MongoControlTargetDescriptor, l as fieldRewriteOf, n as MongoControlExtensionDescriptor, o as contractToMongoSchemaIR, r as MongoControlFamilyInstance, s as createMongoFamilyInstance, t as FieldRewrite, u as formatMongoOperations } from "./control-Ci-GHZS3.mjs";
1
+ import { a as canonicalizeSchemasForVerification, c as diffMongoSchemas, d as mongoFamilyDescriptor, f as mongoOperationsToPreview, i as MongoControlTargetDescriptor, l as fieldRewriteOf, n as MongoControlExtensionDescriptor, o as contractToMongoSchemaIR, r as MongoControlFamilyInstance, s as createMongoFamilyInstance, t as FieldRewrite, u as formatMongoOperations } from "./control-Cpgdr11Q.mjs";
2
2
  export { type FieldRewrite, type MongoControlExtensionDescriptor, type MongoControlFamilyInstance, type MongoControlTargetDescriptor, canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };
@@ -139,14 +139,17 @@ interface MongoAdapter {
139
139
  }
140
140
  //#endregion
141
141
  //#region src/driver-types.d.ts
142
- interface MongoDriver {
142
+ interface MongoQueryable {
143
143
  execute<Row>(wireCommand: AnyMongoDmlWireCommand): AsyncIterable<Row>;
144
144
  run(wireCommand: AnyMongoDdlWireCommand): Promise<void>;
145
+ }
146
+ interface MongoDriver<TBinding = void> extends MongoQueryable {
147
+ connect(binding: TBinding): Promise<void>;
145
148
  close(): Promise<void>;
146
149
  }
147
- interface MongoControlDriverInstance extends ControlDriverInstance<'mongo', 'mongo'>, MongoDriver {
150
+ interface MongoControlDriverInstance extends ControlDriverInstance<'mongo', 'mongo'>, MongoQueryable {
148
151
  readonly db: Db;
149
152
  }
150
153
  //#endregion
151
- export { MongoLoweredDraft as a, MongoDriver as i, MongoControlDriverInstance as n, MongoDdlPlan as r, MongoAdapter as t };
152
- //# sourceMappingURL=index-y5fGsR1i.d.mts.map
154
+ export { MongoLoweredDraft as a, MongoDriver as i, MongoControlDriverInstance as n, MongoQueryable as o, MongoDdlPlan as r, MongoAdapter as t };
155
+ //# sourceMappingURL=index-Bh6a8q-2.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-y5fGsR1i.d.mts","names":[],"sources":["../../../../2-mongo-family/6-transport/mongo-lowering/dist/index.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;KAkBK;WACM;WACA;WACA,UAAU;;WAEV;WACA;WACA,WAAW,cAAc;;WAEzB;WACA;WACA,QAAQ;WACR,QAAQ,0BAA0B,cAAc;WAChD;;WAEA;WACA;WACA,QAAQ;WACR,QAAQ,0BAA0B,cAAc;WAChD;;WAEA;WACA;WACA,QAAQ;;WAER;WACA;WACA,QAAQ;;WAER;WACA;WACA,QAAQ;WACR,QAAQ,0BAA0B,cAAc;WAChD;WACA,MAAM;WACN;;WAEA;WACA;WACA,QAAQ;WACR,MAAM;;WAEN;WACA;WACA,UAAU,cAAc;;WAExB;WACA;WACA,UAAU;;WAEV;WACA;WACA,WAAW,cAAc;;WAEzB;WACA;WACA,QAAQ;WACR,QAAQ,0BAA0B,cAAc;;WAEhD;WACA;WACA,QAAQ;WACR,QAAQ,0BAA0B,cAAc;WAChD;;WAEA;WACA;WACA,QAAQ;;WAER;WACA;WACA,QAAQ;;WAER;WACA;WACA,QAAQ;WACR,QAAQ,0BAA0B,cAAc;WAChD;WACA,MAAM;WACN;;WAEA;WACA;WACA,QAAQ;WACR,MAAM;;WAEN;WACA;WACA,UAAU,cAAc;;;UAGzB;WACC,SAAS;;UAEV;EACR,MAAM,MAAM,cAAc,KAAK,mBAAmB,QAAQ;EAC1D,MAAM,MAAM,gBAAgB,KAAK,mBAAmB,QAAQ;EAC5D,MAAM,MAAM,iBAAiB,cAAc,KAAK,mBAAmB,QAAQ;;;;;;;;;;;EAW3E,gBAAgB,MAAM,iBAAiB;;;;;;;;;EASvC,cAAc,OAAO,mBAAmB,KAAK,mBAAmB,QAAQ;;;;UAIhE;EACR,QAAQ,KAAK,aAAa,yBAAyB,cAAc;EACjE,IAAI,aAAa,yBAAyB;EAC1C,SAAS;;UAED,mCAAmC,yCAAyC;WAC3E,IAAI"}
1
+ {"version":3,"file":"index-Bh6a8q-2.d.mts","names":[],"sources":["../../../../2-mongo-family/6-transport/mongo-lowering/dist/index.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;KAkBK;WACM;WACA;WACA,UAAU;;WAEV;WACA;WACA,WAAW,cAAc;;WAEzB;WACA;WACA,QAAQ;WACR,QAAQ,0BAA0B,cAAc;WAChD;;WAEA;WACA;WACA,QAAQ;WACR,QAAQ,0BAA0B,cAAc;WAChD;;WAEA;WACA;WACA,QAAQ;;WAER;WACA;WACA,QAAQ;;WAER;WACA;WACA,QAAQ;WACR,QAAQ,0BAA0B,cAAc;WAChD;WACA,MAAM;WACN;;WAEA;WACA;WACA,QAAQ;WACR,MAAM;;WAEN;WACA;WACA,UAAU,cAAc;;WAExB;WACA;WACA,UAAU;;WAEV;WACA;WACA,WAAW,cAAc;;WAEzB;WACA;WACA,QAAQ;WACR,QAAQ,0BAA0B,cAAc;;WAEhD;WACA;WACA,QAAQ;WACR,QAAQ,0BAA0B,cAAc;WAChD;;WAEA;WACA;WACA,QAAQ;;WAER;WACA;WACA,QAAQ;;WAER;WACA;WACA,QAAQ;WACR,QAAQ,0BAA0B,cAAc;WAChD;WACA,MAAM;WACN;;WAEA;WACA;WACA,QAAQ;WACR,MAAM;;WAEN;WACA;WACA,UAAU,cAAc;;;UAGzB;WACC,SAAS;;UAEV;EACR,MAAM,MAAM,cAAc,KAAK,mBAAmB,QAAQ;EAC1D,MAAM,MAAM,gBAAgB,KAAK,mBAAmB,QAAQ;EAC5D,MAAM,MAAM,iBAAiB,cAAc,KAAK,mBAAmB,QAAQ;;;;;;;;;;;EAW3E,gBAAgB,MAAM,iBAAiB;;;;;;;;;EASvC,cAAc,OAAO,mBAAmB,KAAK,mBAAmB,QAAQ;;;;UAIhE;EACR,QAAQ,KAAK,aAAa,yBAAyB,cAAc;EACjE,IAAI,aAAa,yBAAyB;;UAElC,YAAY,yBAAyB;EAC7C,QAAQ,SAAS,WAAW;EAC5B,SAAS;;UAED,mCAAmC,yCAAyC;WAC3E,IAAI"}
@@ -1,2 +1,2 @@
1
- import { a as MongoLoweredDraft, i as MongoDriver, n as MongoControlDriverInstance, r as MongoDdlPlan, t as MongoAdapter } from "./index-y5fGsR1i.mjs";
2
- export type { MongoAdapter, MongoControlDriverInstance, MongoDdlPlan, MongoDriver, MongoLoweredDraft };
1
+ import { a as MongoLoweredDraft, i as MongoDriver, n as MongoControlDriverInstance, o as MongoQueryable, r as MongoDdlPlan, t as MongoAdapter } from "./index-Bh6a8q-2.mjs";
2
+ export type { MongoAdapter, MongoControlDriverInstance, MongoDdlPlan, MongoDriver, MongoLoweredDraft, MongoQueryable };
@@ -5,9 +5,9 @@ import { l as MongoParamRef } from "./index-9DDQlC5U.mjs";
5
5
  import { ot as MongoResultShape, rt as MongoQueryPlan } from "./query-plan-C7sSU3Al-wzsJKtml.mjs";
6
6
  import { d as enumMemberCodecFor, o as MongoCodecLookup, s as MongoExecutionContext } from "./execution-CZhOXkot.mjs";
7
7
  import { r as AnyMongoDmlWireCommand } from "./index-D9TThYU9.mjs";
8
- import { a as MongoLoweredDraft, i as MongoDriver, t as MongoAdapter } from "./index-y5fGsR1i.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
- declare function createMongoExecutionStack<TTargetId extends string = 'mongo'>(options: {
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
- }): MongoExecutionStack<TTargetId>;
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
@@ -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;UACxP,8BAA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B;EAC5G;IACE,SAAS,MAAM,oBAAoB,KAAK,yBAAyB,QAAQ;IACzE,WAAW,MAAM,oBAAoB,KAAK,yBAAyB,QAAQ;;EAE7E,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,KAAK,yBAAyB;;;;;;;;;UASrF;WACC,SAAS;WACT,SAAS;WACT,QAAQ;WACR,sBAAsB;WACtB,OAAO;;UAER;;;;;;;;;;;;;;;;;;;;;;EAsBR,MAAM,KAAK,MAAM,eAAe,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
  };
@@ -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;EACjB,YAAY,QAAQ;CACrB,CAAC;CACD,OAAO;EACN;EACA;EACA;CACD;AACD;AACA,SAAS,4BAA4B,SAAS;CAC7C,MAAM,WAAW,sBAAsB;CACvC,MAAM,yBAAyB,IAAI,IAAI;CACvC,MAAM,eAAe;EACpB,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,GAAG,QAAQ,MAAM;CAClB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a,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;EACjB,QAAQ,QAAQ;EAChB,YAAY,QAAQ;CACrB,CAAC;CACD,OAAO,WAAW,KAAK,IAAI;EAC1B;EACA;EACA;CACD,IAAI;EACH;EACA;EACA;EACA;CACD;AACD;AACA,SAAS,4BAA4B,SAAS;CAC7C,MAAM,WAAW,sBAAsB;CACvC,MAAM,yBAAyB,IAAI,IAAI;CACvC,MAAM,eAAe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type": "module",
6
6
  "sideEffects": false,
@@ -9,30 +9,30 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@prisma/orm-framework": "8.0.0-rc.21-dev.20",
13
- "@prisma/orm-toolchain": "8.0.0-rc.21-dev.20",
12
+ "@prisma/orm-framework": "8.0.0-rc.21-dev.21",
13
+ "@prisma/orm-toolchain": "8.0.0-rc.21-dev.21",
14
14
  "arktype": "^2.2.2",
15
15
  "mongodb": "^7.4.0",
16
16
  "pathe": "^2.0.3"
17
17
  },
18
18
  "devDependencies": {
19
- "@internal/family-mongo": "8.0.0-rc.21-dev.20",
20
- "@internal/mongo-codec": "8.0.0-rc.21-dev.20",
21
- "@internal/mongo-contract": "8.0.0-rc.21-dev.20",
22
- "@internal/mongo-contract-prisma6": "8.0.0-rc.21-dev.20",
23
- "@internal/mongo-contract-psl": "8.0.0-rc.21-dev.20",
24
- "@internal/mongo-contract-ts": "8.0.0-rc.21-dev.20",
25
- "@internal/mongo-emitter": "8.0.0-rc.21-dev.20",
26
- "@internal/mongo-lowering": "8.0.0-rc.21-dev.20",
27
- "@internal/mongo-orm": "8.0.0-rc.21-dev.20",
28
- "@internal/mongo-query-ast": "8.0.0-rc.21-dev.20",
29
- "@internal/mongo-query-builder": "8.0.0-rc.21-dev.20",
30
- "@internal/mongo-runtime": "8.0.0-rc.21-dev.20",
31
- "@internal/mongo-schema-ir": "8.0.0-rc.21-dev.20",
32
- "@internal/mongo-value": "8.0.0-rc.21-dev.20",
33
- "@internal/mongo-wire": "8.0.0-rc.21-dev.20",
34
- "@repo/tsconfig": "8.0.0-rc.21-dev.20",
35
- "@repo/tsdown": "8.0.0-rc.21-dev.20",
19
+ "@internal/family-mongo": "8.0.0-rc.21-dev.21",
20
+ "@internal/mongo-codec": "8.0.0-rc.21-dev.21",
21
+ "@internal/mongo-contract": "8.0.0-rc.21-dev.21",
22
+ "@internal/mongo-contract-prisma6": "8.0.0-rc.21-dev.21",
23
+ "@internal/mongo-contract-psl": "8.0.0-rc.21-dev.21",
24
+ "@internal/mongo-contract-ts": "8.0.0-rc.21-dev.21",
25
+ "@internal/mongo-emitter": "8.0.0-rc.21-dev.21",
26
+ "@internal/mongo-lowering": "8.0.0-rc.21-dev.21",
27
+ "@internal/mongo-orm": "8.0.0-rc.21-dev.21",
28
+ "@internal/mongo-query-ast": "8.0.0-rc.21-dev.21",
29
+ "@internal/mongo-query-builder": "8.0.0-rc.21-dev.21",
30
+ "@internal/mongo-runtime": "8.0.0-rc.21-dev.21",
31
+ "@internal/mongo-schema-ir": "8.0.0-rc.21-dev.21",
32
+ "@internal/mongo-value": "8.0.0-rc.21-dev.21",
33
+ "@internal/mongo-wire": "8.0.0-rc.21-dev.21",
34
+ "@repo/tsconfig": "8.0.0-rc.21-dev.21",
35
+ "@repo/tsdown": "8.0.0-rc.21-dev.21",
36
36
  "tsdown": "0.22.14",
37
37
  "typescript": "5.9.3"
38
38
  },
@@ -1 +0,0 @@
1
- import "./control-adapter-CLIE-kQU-BCu2nSWb.mjs";