@prisma/orm-family-mongo 8.0.0-rc.17-dev.25 → 8.0.0-rc.17-dev.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { C as MongoContract, W as MongoStorageShape } from "./mongo-value-set-BngSUlOh-BhDGXjM_.mjs";
2
2
  import "./index-CLPkwReD.mjs";
3
3
  import { o as MongoSchemaIR } from "./index-CaoieUeB.mjs";
4
- import { i as MongoRunnerDependencies } from "./control-adapter-Bh_ZraGM-jP5nqgUQ.mjs";
4
+ import { i as MongoRunnerDependencies } from "./control-adapter-Bh_ZraGM-DpcaLFJJ.mjs";
5
5
  import { Contract, ControlPolicy } from "@prisma/orm-framework/contract/types";
6
6
  import { ContractSerializer, ContractSpace, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlFamilyInstance, ControlStack, MigratableTargetDescriptor, MigrationPlanOperation, OperationPreview, OperationPreviewCapable, SchemaDiffIssue, SchemaVerifier, SchemaViewCapable } from "@prisma/orm-framework/components/control";
7
7
  //#region ../../../2-mongo-family/9-family/dist/control.d.mts
@@ -105,4 +105,4 @@ interface CanonicalizedSchemas {
105
105
  declare function canonicalizeSchemasForVerification(live: MongoSchemaIR, expected: MongoSchemaIR): CanonicalizedSchemas;
106
106
  //#endregion
107
107
  export { contractToMongoSchemaIR as a, formatMongoOperations as c, canonicalizeSchemasForVerification as i, mongoFamilyDescriptor as l, MongoControlFamilyInstance as n, createMongoFamilyInstance as o, MongoControlTargetDescriptor as r, diffMongoSchemas as s, MongoControlExtensionDescriptor as t, mongoOperationsToPreview as u };
108
- //# sourceMappingURL=control-jfkr6y8H.d.mts.map
108
+ //# sourceMappingURL=control-Cn3b4iRR.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-jfkr6y8H.d.mts","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control.d.mts"],"mappings":";;;;;;;;iBAMiB,wBAAwB,U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nB,mBAAmB;;iBAEb,iBAAiB,MAAM,eAAe,UAAU,eAAe,iBAAiB,0BAA0B,2BAA2B,gBAAgB;;;UAG5J;WACC,MAAM;WACN,UAAU;;iBAEJ,mCAAmC,MAAM,eAAe,UAAU,gBAAgB"}
@@ -1,6 +1,6 @@
1
1
  import { o as MongoSchemaIR } from "./index-CaoieUeB.mjs";
2
2
  import { _ as MongoInspectionCommandVisitor, t as AnyMongoDdlCommand } from "./control-jcjM0_9u.mjs";
3
- import { i as MongoDriver, t as MongoAdapter } from "./index-DewnUTbg.mjs";
3
+ import { i as MongoDriver, t as MongoAdapter } from "./index-DGRsq3ef.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
6
  //#region ../../../2-mongo-family/9-family/dist/control-adapter-Bh_ZraGM.d.mts
@@ -124,4 +124,4 @@ interface MongoControlAdapter<TTarget extends string = string> extends ControlAd
124
124
  interface MongoControlAdapterDescriptor<TTarget extends string = string> extends ControlAdapterDescriptor<'mongo', TTarget, MongoControlAdapter<TTarget>> {}
125
125
  //#endregion
126
126
  export { MongoRunnerDependencies as i, MongoControlAdapter as n, MongoControlAdapterDescriptor as r, MarkerOperations as t };
127
- //# sourceMappingURL=control-adapter-Bh_ZraGM-jP5nqgUQ.d.mts.map
127
+ //# sourceMappingURL=control-adapter-Bh_ZraGM-DpcaLFJJ.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-adapter-Bh_ZraGM-jP5nqgUQ.d.mts","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control-adapter-Bh_ZraGM.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;aAC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rG,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-Bh_ZraGM-DpcaLFJJ.mjs";
package/dist/family.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { E as defaultMongoStorageNamespaceId, T as defaultMongoDomainNamespaceId } from "./index-CLPkwReD.mjs";
2
- import { i as MongoRunnerDependencies, n as MongoControlAdapter, r as MongoControlAdapterDescriptor, t as MarkerOperations } from "./control-adapter-Bh_ZraGM-jP5nqgUQ.mjs";
3
- import { a as contractToMongoSchemaIR, c as formatMongoOperations, i as canonicalizeSchemasForVerification, l as mongoFamilyDescriptor, n as MongoControlFamilyInstance, o as createMongoFamilyInstance, r as MongoControlTargetDescriptor, s as diffMongoSchemas, t as MongoControlExtensionDescriptor, u as mongoOperationsToPreview } from "./control-jfkr6y8H.mjs";
4
- import "./control-adapter-D7th_Prd.mjs";
2
+ import { i as MongoRunnerDependencies, n as MongoControlAdapter, r as MongoControlAdapterDescriptor, t as MarkerOperations } from "./control-adapter-Bh_ZraGM-DpcaLFJJ.mjs";
3
+ import { a as contractToMongoSchemaIR, c as formatMongoOperations, i as canonicalizeSchemasForVerification, l as mongoFamilyDescriptor, n as MongoControlFamilyInstance, o as createMongoFamilyInstance, r as MongoControlTargetDescriptor, s as diffMongoSchemas, t as MongoControlExtensionDescriptor, u as mongoOperationsToPreview } from "./control-Cn3b4iRR.mjs";
4
+ import "./control-adapter-CK0EHdYR.mjs";
5
5
  import { t as MongoContractView$1 } from "./mongo-contract-view-AnejqfrQ-CY4pMjqf.mjs";
6
6
  import { n as MongoContractSerializerBase, r as MongoSchemaVerifierBase, t as MongoContractSerializer } from "./ir-B_vYXaaA.mjs";
7
7
  import { t as MongoMigration } from "./migration-DiJ24gBK.mjs";
@@ -1,3 +1,3 @@
1
- import { i as MongoRunnerDependencies, n as MongoControlAdapter, r as MongoControlAdapterDescriptor, t as MarkerOperations } from "./control-adapter-Bh_ZraGM-jP5nqgUQ.mjs";
2
- import "./control-adapter-D7th_Prd.mjs";
1
+ import { i as MongoRunnerDependencies, n as MongoControlAdapter, r as MongoControlAdapterDescriptor, t as MarkerOperations } from "./control-adapter-Bh_ZraGM-DpcaLFJJ.mjs";
2
+ import "./control-adapter-CK0EHdYR.mjs";
3
3
  export type { MarkerOperations, MongoControlAdapter, MongoControlAdapterDescriptor, MongoRunnerDependencies };
@@ -1,2 +1,2 @@
1
- import { a as contractToMongoSchemaIR, c as formatMongoOperations, i as canonicalizeSchemasForVerification, l as mongoFamilyDescriptor, n as MongoControlFamilyInstance, o as createMongoFamilyInstance, r as MongoControlTargetDescriptor, s as diffMongoSchemas, t as MongoControlExtensionDescriptor, u as mongoOperationsToPreview } from "./control-jfkr6y8H.mjs";
1
+ import { a as contractToMongoSchemaIR, c as formatMongoOperations, i as canonicalizeSchemasForVerification, l as mongoFamilyDescriptor, n as MongoControlFamilyInstance, o as createMongoFamilyInstance, r as MongoControlTargetDescriptor, s as diffMongoSchemas, t as MongoControlExtensionDescriptor, u as mongoOperationsToPreview } from "./control-Cn3b4iRR.mjs";
2
2
  export { type MongoControlExtensionDescriptor, type MongoControlFamilyInstance, type MongoControlTargetDescriptor, canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };
@@ -10,7 +10,7 @@ import { Db } from "mongodb";
10
10
  /**
11
11
  * Intermediate state produced by structural lowering. `MongoParamRef` leaves
12
12
  * remain in place — they have not yet been resolved through codecs. The
13
- * runtime defers value resolution past the `beforeExecute` middleware chain
13
+ * runtime defers value resolution past the `beforeEncode` middleware chain
14
14
  * so middleware can walk and rewrite `MongoParamRef` nodes before encoding.
15
15
  *
16
16
  * All document/filter/update slots that may carry `MongoParamRef` nodes are
@@ -122,7 +122,7 @@ interface MongoAdapter {
122
122
  * calling `resolveValue` on any `MongoParamRef` leaf. All filter predicates,
123
123
  * document fields, and pipeline stage values that carry `MongoParamRef`
124
124
  * nodes are preserved in the returned `MongoLoweredDraft` so that the
125
- * `beforeExecute` middleware chain can inspect and rewrite them before
125
+ * `beforeEncode` middleware chain can inspect and rewrite them before
126
126
  * encoding runs. Synchronous — no I/O or codec calls.
127
127
  */
128
128
  structuralLower(plan: MongoQueryPlan): MongoLoweredDraft;
@@ -148,4 +148,4 @@ interface MongoControlDriverInstance extends ControlDriverInstance<'mongo', 'mon
148
148
  }
149
149
  //#endregion
150
150
  export { MongoLoweredDraft as a, MongoDriver as i, MongoControlDriverInstance as n, MongoDdlPlan as r, MongoAdapter as t };
151
- //# sourceMappingURL=index-DewnUTbg.d.mts.map
151
+ //# sourceMappingURL=index-DGRsq3ef.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-DewnUTbg.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;;WAEhD;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-DGRsq3ef.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;;WAEhD;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,2 +1,2 @@
1
- import { a as MongoLoweredDraft, i as MongoDriver, n as MongoControlDriverInstance, r as MongoDdlPlan, t as MongoAdapter } from "./index-DewnUTbg.mjs";
1
+ import { a as MongoLoweredDraft, i as MongoDriver, n as MongoControlDriverInstance, r as MongoDdlPlan, t as MongoAdapter } from "./index-DGRsq3ef.mjs";
2
2
  export type { MongoAdapter, MongoControlDriverInstance, MongoDdlPlan, MongoDriver, MongoLoweredDraft };
@@ -3,9 +3,9 @@ import { l as MongoParamRef } from "./index-9DDQlC5U.mjs";
3
3
  import { ot as MongoResultShape, rt as MongoQueryPlan } from "./query-plan-DWV6y1mg-wdqfTTo9.mjs";
4
4
  import "./execution-p8UbRaQp.mjs";
5
5
  import { r as AnyMongoDmlWireCommand } from "./index-BxEJgXKF.mjs";
6
- import { a as MongoLoweredDraft, i as MongoDriver, t as MongoAdapter } from "./index-DewnUTbg.mjs";
6
+ import { a as MongoLoweredDraft, i as MongoDriver, t as MongoAdapter } from "./index-DGRsq3ef.mjs";
7
7
  import { Contract } from "@prisma/orm-framework/contract/types";
8
- import { AfterExecuteResult, AfterQueryResult, AsyncIterableResult, ExecuteInterceptResult, ExecutionPlan, MutationDefaultGeneratorContributor, MutationDefaults, ParamRefMutator, QueryInterceptResult, RuntimeExecuteOptions, RuntimeMiddleware, RuntimeMiddlewareContext, RuntimeStatementStats } from "@prisma/orm-framework/components/runtime";
8
+ import { ActivityContext, ActivityEndedResult, ActivityFinalizedResult, AsyncIterableResult, ExecuteInterceptResult, ExecutionPlan, MutationDefaultGeneratorContributor, MutationDefaults, ParamRefMutator, QueryInterceptResult, RuntimeActivity, RuntimeExecuteOptions, RuntimeMiddleware, RuntimeStatementStats } from "@prisma/orm-framework/components/runtime";
9
9
  import { EnumAccessor } from "@prisma/orm-framework/contract/enum-accessor";
10
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
@@ -81,7 +81,7 @@ declare function buildMongoEnums(contract: Pick<Contract, 'domain'>, codecs: Mon
81
81
  *
82
82
  * The plan carries:
83
83
  * - `command` — dual lifecycle (see field JSDoc): unresolved draft during
84
- * `beforeExecute`, frozen wire command afterward
84
+ * `beforeEncode`, frozen wire command afterward
85
85
  * - `meta` — family-agnostic plan metadata (target, lane, hashes, ...)
86
86
  * - `_row` — phantom row type, propagated from the originating
87
87
  * `MongoQueryPlan`
@@ -97,12 +97,12 @@ declare function buildMongoEnums(contract: Pick<Contract, 'domain'>, codecs: Mon
97
97
  */
98
98
  interface MongoExecutionPlan<Row = unknown> extends ExecutionPlan<Row> {
99
99
  /**
100
- * Lowered command payload. **Lifecycle:** during `beforeExecute` this slot
100
+ * Lowered command payload. **Lifecycle:** during `beforeEncode` this slot
101
101
  * holds the unresolved `MongoLoweredDraft` (plain object, `MongoParamRef`
102
102
  * leaves intact). After `resolveParams` and in later middleware hooks
103
- * (`afterExecute`, `onRow`, intercept-after-resolve) it is the frozen wire
103
+ * (`intercept`, `onRow`) it is the frozen wire
104
104
  * command (`InsertOneWireCommand`, `AggregateWireCommand`, …). Do not read
105
- * `command` structurally in `beforeExecute` — use the `params` mutator.
105
+ * `command` structurally in `beforeEncode` — use the `params` mutator.
106
106
  */
107
107
  readonly command: AnyMongoDmlWireCommand;
108
108
  readonly resultShape?: MongoResultShape;
@@ -144,7 +144,7 @@ interface MongoParamRefEntry<TCodecId extends string | undefined = string | unde
144
144
  */
145
145
  type MongoParamRefEntryUnion<TCodecMap extends Record<string, unknown>> = { [K in keyof TCodecMap & string]: MongoParamRefEntry<K>; }[keyof TCodecMap & string] | MongoParamRefEntry<undefined>;
146
146
  /**
147
- * Mongo-family mutator threaded into `MongoMiddleware.beforeExecute` as
147
+ * Mongo-family mutator threaded into `MongoMiddleware.beforeEncode` as
148
148
  * `params`. Scope is `MongoParamRef.value` slots only — middleware cannot
149
149
  * insert or remove refs, rewrite the filter shape, or modify the pipeline
150
150
  * structure. The phantom `MongoParamRefHandle` brand and the typed
@@ -173,7 +173,7 @@ interface MongoParamRefMutator<TCodecMap extends Record<string, unknown> = Recor
173
173
  }
174
174
  /**
175
175
  * Internal-only view that exposes `currentDraft()` to the Mongo runtime.
176
- * The runtime calls this after the `beforeExecute` chain; the result is the
176
+ * The runtime calls this after the `beforeEncode` chain; the result is the
177
177
  * original draft by reference if nothing was mutated, otherwise a new tree
178
178
  * with the mutations applied. `MongoMiddleware` consumers never see this
179
179
  * shape; they receive the public `MongoParamRefMutator` view.
@@ -205,54 +205,31 @@ declare function createMongoParamRefMutator<TCodecMap extends Record<string, unk
205
205
  //#endregion
206
206
  //#region src/mongo-middleware.d.ts
207
207
  /**
208
- * Per-operation middleware context for Mongo. See {@link MongoMiddleware} for
209
- * plan/command lifecycle during `beforeQuery` / `beforeExecute` vs later hooks.
208
+ * Activity context for Mongo. See {@link MongoMiddleware} for the plan's command during `beforeEncode` versus later hooks.
210
209
  */
211
- interface MongoMiddlewareContext extends RuntimeMiddlewareContext {
210
+ interface MongoMiddlewareContext extends ActivityContext {
212
211
  /**
213
- * Stable digest of `meta.storageHash` plus the **resolved** wire command.
214
- * Valid only on post-resolution plans (typically `afterQuery`,
215
- * `afterExecute`, or intercept after `resolveParams`). Calling this from
216
- * `beforeQuery` or `beforeExecute` throws
217
- * `RUNTIME.CONTENT_HASH_REQUIRES_RESOLVED_COMMAND` because `plan.command`
218
- * is still an unresolved draft at that point.
212
+ * Stable digest of `meta.storageHash` plus the **resolved** wire command. Valid only on plans after `resolveParams` (`intercept`, `onRow`, or a plan kept from them). Calling it from `beforeEncode` throws `RUNTIME.CONTENT_HASH_REQUIRES_RESOLVED_COMMAND`, because `plan.command` is still an unresolved draft there.
219
213
  */
220
214
  contentHash(exec: MongoExecutionPlan): Promise<string>;
221
215
  }
222
216
  /**
223
- * Mongo-domain middleware. Extends the framework `RuntimeMiddleware`
224
- * parameterized over `MongoExecutionPlan` because the operation-specific
225
- * middleware runners invoke the lifecycle hooks with the post-lowering plan.
217
+ * Mongo-domain middleware over `MongoExecutionPlan`. `familyId` is optional so cross-family middleware remain assignable; when present it must be `'mongo'`. Mongo has no transactions, so every activity is finalized right after it ends.
226
218
  *
227
- * `familyId` is optional so generic cross-family middleware (e.g.
228
- * telemetry) — which carry no `familyId` — remain assignable. When
229
- * present, it must be `'mongo'`; the runtime rejects mismatches at
230
- * construction time via `checkMiddlewareCompatibility`.
231
- *
232
- * **Pre-resolve `beforeQuery` contract:** `plan.command` holds the
233
- * unresolved `MongoLoweredDraft`, not a wire command. Observe and mutate
234
- * parameters via `params.entries()` / `replaceValue` / `replaceValues` only.
235
- * Do not inspect `plan.command` structurally or call `ctx.contentHash` in
236
- * this hook. After the chain, `resolveParams` produces the frozen wire
237
- * command used in `afterQuery` and for `contentHash`.
219
+ * **`beforeEncode` sees an unresolved command:** `plan.command` holds the `MongoLoweredDraft`, not a wire command. Observe and change parameters through `params.entries()` / `replaceValue` / `replaceValues` only, and do not call `ctx.contentHash` there. After the hook, `resolveParams` produces the frozen wire command that `intercept`, `onRow` and `contentHash` see.
238
220
  */
239
- interface MongoMiddleware extends RuntimeMiddleware<MongoExecutionPlan> {
221
+ interface MongoMiddleware extends RuntimeMiddleware<MongoExecutionPlan, MongoParamRefMutator> {
240
222
  readonly familyId?: 'mongo';
241
- /**
242
- * Runs after structural lower, before `resolveParams`. `plan.command` is the
243
- * unresolved draft; use `params` for param-ref access, not `plan.command`.
244
- */
245
- beforeQuery?(plan: MongoExecutionPlan, ctx: MongoMiddlewareContext, params?: MongoParamRefMutator): void | Promise<void>;
246
- interceptQuery?(plan: MongoExecutionPlan, ctx: MongoMiddlewareContext): Promise<QueryInterceptResult | undefined>;
223
+ activityStarted?(activity: RuntimeActivity, ctx: MongoMiddlewareContext): Promise<void>;
224
+ activityEnded?(activity: RuntimeActivity, result: ActivityEndedResult, ctx: MongoMiddlewareContext): Promise<void>;
225
+ activityFinalized?(activity: RuntimeActivity, result: ActivityFinalizedResult, ctx: MongoMiddlewareContext): Promise<void>;
226
+ /** Runs after structural lowering, before `resolveParams`. Use `params` for parameter access, not `plan.command`. */
227
+ beforeEncode?(plan: MongoExecutionPlan, ctx: MongoMiddlewareContext, params?: MongoParamRefMutator): void | Promise<void>;
228
+ intercept?: {
229
+ onQuery?(plan: MongoExecutionPlan, ctx: MongoMiddlewareContext): Promise<QueryInterceptResult | undefined>;
230
+ onExecute?(plan: MongoExecutionPlan, ctx: MongoMiddlewareContext): Promise<ExecuteInterceptResult | undefined>;
231
+ };
247
232
  onRow?(row: Record<string, unknown>, plan: MongoExecutionPlan, ctx: MongoMiddlewareContext): Promise<void>;
248
- afterQuery?(plan: MongoExecutionPlan, result: AfterQueryResult, ctx: MongoMiddlewareContext): Promise<void>;
249
- /**
250
- * Runs after structural lower, before `resolveParams`. `plan.command` is the
251
- * unresolved draft; use `params` for param-ref access, not `plan.command`.
252
- */
253
- beforeExecute?(plan: MongoExecutionPlan, ctx: MongoMiddlewareContext, params?: MongoParamRefMutator): void | Promise<void>;
254
- interceptExecute?(plan: MongoExecutionPlan, ctx: MongoMiddlewareContext): Promise<ExecuteInterceptResult | undefined>;
255
- afterExecute?(plan: MongoExecutionPlan, result: AfterExecuteResult, ctx: MongoMiddlewareContext): Promise<void>;
256
233
  }
257
234
  //#endregion
258
235
  //#region src/mongo-runtime.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.mts","names":[],"sources":["../../../../2-mongo-family/7-runtime/dist/index.d.mts"],"mappings":";;;;;;;;;;;;;;;;;UAeU,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,8BAA8B,4CAA4C,kCAAkC;UAC5G,gCAAgC,4CAA4C,oCAAoC,WAAW,8BAA8B,aAAa;EAC9K,UAAU,8BAA8B;;;;;UAKhC,oBAAoB;WACnB,QAAQ,6BAA6B;WACrC,SAAS,8BAA8B;WACvC,QAAQ,iCAAiC,oBAAoB,+BAA+B;WAC5F,qBAAqB,gCAAgC;;iBAE/C,0B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M,qBAAqB;;;;;;;UAO/B,wBAAwB,kBAAkB,oBAAoB;WAC7D;EACT,iBAAiB,UAAU,iBAAiB,KAAK,yBAAyB;EAC1E,eAAe,UAAU,iBAAiB,QAAQ,qBAAqB,KAAK,yBAAyB;EACrG,mBAAmB,UAAU,iBAAiB,QAAQ,yBAAyB,KAAK,yBAAyB;;EAE7G,cAAc,MAAM,oBAAoB,KAAK,wBAAwB,SAAS,8BAA8B;EAC5G;IACE,SAAS,MAAM,oBAAoB,KAAK,yBAAyB,QAAQ;IACzE,WAAW,MAAM,oBAAoB,KAAK,yBAAyB,QAAQ;;EAE7E,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,KAAK,yBAAyB;;;;;;;;;;;;;;;UAerF;WACC,SAAS;WACT,QAAQ;WACR,sBAAsB;WACtB;;UAED;;;;;;;;;;;;;;;;;;;;;;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-CqUoKyeL.mjs";
2
2
  import { t as MongoParamRef } from "./dist-CO2arS1K.mjs";
3
3
  import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
4
- import { AsyncIterableResult, RuntimeCore, applyMutationDefaults, assertMutationDefaultGeneratorsAvailable, checkAborted, checkMiddlewareCompatibility, collectMutationDefaultGenerators, onQueryEndOutsideTransaction, reportExecuteEnding, reportQueryEnding, runBeforeExecuteChain, runBeforeQueryChain, runExecuteWithMiddleware, runQueryWithMiddleware, runtimeError } from "@prisma/orm-framework/components/runtime";
4
+ import { AsyncIterableResult, RuntimeCore, applyMutationDefaults, assertMutationDefaultGeneratorsAvailable, checkAborted, checkMiddlewareCompatibility, collectMutationDefaultGenerators, executeStatement, runtimeError, streamStatement } from "@prisma/orm-framework/components/runtime";
5
5
  import { blindCast } from "@prisma/orm-framework/utils/casts";
6
6
  import { isInternalError } from "@prisma/orm-framework/utils/internal-error";
7
7
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
@@ -204,7 +204,7 @@ async function decodeMongoRow(row, shape, registry, collection, ctx = {}) {
204
204
  const RUNTIME_CONTENT_HASH_REQUIRES_RESOLVED_COMMAND = "RUNTIME.CONTENT_HASH_REQUIRES_RESOLVED_COMMAND";
205
205
  /**
206
206
  * Resolved wire commands are frozen class instances (`InsertOneWireCommand`, …);
207
- * pre-resolve `beforeExecute` plans hold a plain-object `MongoLoweredDraft` in the
207
+ * pre-resolve `beforeEncode` plans hold a plain-object `MongoLoweredDraft` in the
208
208
  * command slot. O(1) prototype check — no tree walk on the hot path.
209
209
  */
210
210
  function isResolvedMongoWireCommand(command) {
@@ -214,7 +214,7 @@ function isResolvedMongoWireCommand(command) {
214
214
  }
215
215
  function assertContentHashOnResolvedCommand(command) {
216
216
  if (isResolvedMongoWireCommand(command)) return;
217
- throw 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: "beforeExecute" });
217
+ throw 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" });
218
218
  }
219
219
  /**
220
220
  * Computes a stable content hash for a lowered Mongo execution plan.
@@ -252,7 +252,7 @@ function assertContentHashOnResolvedCommand(command) {
252
252
  *
253
253
  * @throws {RuntimeErrorEnvelope} {@link RUNTIME_CONTENT_HASH_REQUIRES_RESOLVED_COMMAND}
254
254
  * when `exec.command` is still a pre-resolve draft (plain object), e.g. when
255
- * `contentHash` is called from `beforeExecute`.
255
+ * `contentHash` is called from `beforeEncode`.
256
256
  *
257
257
  * @internal
258
258
  */
@@ -522,6 +522,7 @@ var MongoRuntimeImpl = class extends RuntimeCore {
522
522
  #adapter;
523
523
  #driver;
524
524
  #codecs;
525
+ #contextFields;
525
526
  constructor(options) {
526
527
  const middleware = options.middleware ?? [];
527
528
  const targetId = options.context.stack.target.targetId;
@@ -536,13 +537,13 @@ var MongoRuntimeImpl = class extends RuntimeCore {
536
537
  error: noop
537
538
  },
538
539
  contentHash: (exec) => computeMongoContentHash(blindCast(exec)),
539
- scope: "runtime",
540
- planExecutionId: ""
540
+ scope: "runtime"
541
541
  };
542
542
  super({
543
543
  middleware,
544
544
  ctx
545
545
  });
546
+ this.#contextFields = ctx;
546
547
  const adapterInstance = options.context.stack.adapter.create(options.context.stack);
547
548
  this.#adapter = adapterInstance;
548
549
  this.#driver = options.driver;
@@ -567,29 +568,23 @@ var MongoRuntimeImpl = class extends RuntimeCore {
567
568
  const signal = options?.signal;
568
569
  return {
569
570
  codecCtx: signal === void 0 ? {} : { signal },
570
- middlewareCtx: {
571
- ...this.ctx,
572
- ...ifDefined("signal", signal),
573
- planExecutionId: crypto.randomUUID()
571
+ contextFields: {
572
+ ...this.#contextFields,
573
+ ...ifDefined("signal", signal)
574
574
  }
575
575
  };
576
576
  }
577
- prepareQueryExecution(plan, codecCtx, middlewareCtx) {
578
- return this.prepareOperation(plan, codecCtx, middlewareCtx, runBeforeQueryChain);
579
- }
580
- prepareExecuteExecution(plan, codecCtx, middlewareCtx) {
581
- return this.prepareOperation(plan, codecCtx, middlewareCtx, runBeforeExecuteChain);
582
- }
583
- async prepareOperation(plan, codecCtx, middlewareCtx, runBefore) {
577
+ async prepareOperation(plan, codecCtx, run) {
584
578
  checkAborted(codecCtx, "stream");
585
579
  const compiled = await this.runBeforeCompile(plan);
586
580
  const draft = this.#adapter.structuralLower(compiled);
587
581
  const mutator = createMongoParamRefMutator(draft);
588
- await runBefore({
582
+ const draftExec = {
589
583
  meta: compiled.meta,
590
584
  ...ifDefined("resultShape", compiled.resultShape),
591
585
  command: blindCast(draft)
592
- }, this.middleware, middlewareCtx, mutator);
586
+ };
587
+ await run.beforeEncode(draftExec, mutator);
593
588
  return {
594
589
  meta: compiled.meta,
595
590
  ...ifDefined("resultShape", compiled.resultShape),
@@ -598,27 +593,39 @@ var MongoRuntimeImpl = class extends RuntimeCore {
598
593
  }
599
594
  query(plan, options) {
600
595
  const self = this;
601
- const { codecCtx, middlewareCtx } = this.createQueryContexts(options);
596
+ const { codecCtx, contextFields } = this.createQueryContexts(options);
602
597
  const generator = async function* () {
603
- const exec = await self.prepareQueryExecution(plan, codecCtx, middlewareCtx);
604
- yield* reportQueryEnding(onQueryEndOutsideTransaction(self.afterTransactionStageFor(exec, middlewareCtx)), () => self.#decodedRows(exec, codecCtx, middlewareCtx));
598
+ yield* streamStatement({
599
+ middleware: self.middleware,
600
+ plan,
601
+ context: contextFields,
602
+ parent: void 0
603
+ }, async function* (run) {
604
+ const exec = await self.prepareOperation(plan, codecCtx, run);
605
+ yield* self.#decodedRows(run, exec, codecCtx);
606
+ });
605
607
  };
606
608
  return new AsyncIterableResult(generator());
607
609
  }
608
- async *#decodedRows(exec, codecCtx, middlewareCtx) {
609
- const stream = runQueryWithMiddleware(exec, this.middleware, middlewareCtx, () => this.runDriver(exec));
610
+ async *#decodedRows(run, exec, codecCtx) {
611
+ const stream = run.runQuery(exec, () => this.runDriver(exec));
610
612
  for await (const rawRow of stream) {
611
613
  checkAborted(codecCtx, "stream");
612
614
  if (exec.resultShape === void 0) yield blindCast(rawRow);
613
615
  else yield blindCast(await decodeMongoRow(rawRow, exec.resultShape, this.#codecs, exec.command.collection, codecCtx));
614
616
  }
615
617
  }
616
- async execute(plan, options) {
617
- const { codecCtx, middlewareCtx } = this.createQueryContexts(options);
618
- const exec = await this.prepareExecuteExecution(plan, codecCtx, middlewareCtx);
619
- return reportExecuteEnding(onQueryEndOutsideTransaction(this.afterTransactionStageFor(exec, middlewareCtx)), async () => {
618
+ execute(plan, options) {
619
+ const { codecCtx, contextFields } = this.createQueryContexts(options);
620
+ return executeStatement({
621
+ middleware: this.middleware,
622
+ plan,
623
+ context: contextFields,
624
+ parent: void 0
625
+ }, async (run) => {
626
+ const exec = await this.prepareOperation(plan, codecCtx, run);
620
627
  checkAborted(codecCtx, "stream");
621
- return runExecuteWithMiddleware(exec, this.middleware, middlewareCtx, () => this.runExecute(exec));
628
+ return run.runExecute(exec, () => this.runExecute(exec));
622
629
  });
623
630
  }
624
631
  async #readDriverStatistics(exec) {
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.mjs","names":["#adapter","#driver","#codecs","#readDriverStatistics","#decodedRows"],"sources":["../../../../2-mongo-family/7-runtime/dist/index.mjs"],"sourcesContent":["import { buildEnumsMapForNamespace } from \"@internal/contract/enum-accessor\";\nimport { AsyncIterableResult, RuntimeCore, applyMutationDefaults, assertMutationDefaultGeneratorsAvailable, checkAborted, checkMiddlewareCompatibility, collectMutationDefaultGenerators, onQueryEndOutsideTransaction, reportExecuteEnding, reportQueryEnding, runBeforeExecuteChain, runBeforeQueryChain, runExecuteWithMiddleware, runQueryWithMiddleware, runtimeError } from \"@internal/framework-components/runtime\";\nimport { createExecutionStack } from \"@internal/framework-components/execution\";\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-enums.ts\n/**\n* The contract's enum accessors by namespace, each reading its members through its codec in `codecs`: what `db.enums` holds, and what `mongoOrm()` checks a written enum value against. A contract whose enum codec `codecs` lacks is refused here, with `RUNTIME.CODEC_DESCRIPTOR_MISSING`; an enum's members are decoded when it is first read.\n*/\nfunction buildMongoEnums(contract, codecs) {\n\tconst codecFor = (codecId) => {\n\t\tconst codec = codecs.get(codecId);\n\t\tif (codec === void 0) throw runtimeError(\"RUNTIME.CODEC_DESCRIPTOR_MISSING\", `No codec is registered for codecId '${codecId}', which a domain enum in the contract uses.`, { codecId });\n\t\treturn codec;\n\t};\n\treturn Object.fromEntries(Object.keys(contract.domain.namespaces).map((namespaceId) => [namespaceId, buildEnumsMapForNamespace(contract.domain, namespaceId, codecFor)]));\n}\n//#endregion\n//#region src/mongo-execution-stack.ts\nfunction createMongoExecutionStack(options) {\n\treturn blindCast(createExecutionStack({\n\t\ttarget: options.target,\n\t\tadapter: options.adapter,\n\t\tdriver: options.driver,\n\t\textensions: options.extensions\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 = executionOf(options.contract);\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\tstack: options.stack,\n\t\tapplyMutationDefaults: (mutation) => applyMutationDefaults(execution, generators, mutation)\n\t});\n}\nfunction executionOf(contract) {\n\treturn blindCast(contract)?.execution;\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.decode(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 `beforeExecute` 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: \"beforeExecute\" });\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 `beforeExecute`.\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};\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\tconstructor(options) {\n\t\tconst middleware = options.middleware ?? [];\n\t\tconst targetId = options.context.stack.target.targetId;\n\t\tfor (const mw of middleware) checkMiddlewareCompatibility(mw, \"mongo\", targetId);\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\tplanExecutionId: \"\"\n\t\t};\n\t\tsuper({\n\t\t\tmiddleware,\n\t\t\tctx\n\t\t});\n\t\tconst adapterInstance = options.context.stack.adapter.create(options.context.stack);\n\t\tthis.#adapter = adapterInstance;\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\tmiddlewareCtx: {\n\t\t\t\t...this.ctx,\n\t\t\t\t...ifDefined(\"signal\", signal),\n\t\t\t\tplanExecutionId: crypto.randomUUID()\n\t\t\t}\n\t\t};\n\t}\n\tprepareQueryExecution(plan, codecCtx, middlewareCtx) {\n\t\treturn this.prepareOperation(plan, codecCtx, middlewareCtx, runBeforeQueryChain);\n\t}\n\tprepareExecuteExecution(plan, codecCtx, middlewareCtx) {\n\t\treturn this.prepareOperation(plan, codecCtx, middlewareCtx, runBeforeExecuteChain);\n\t}\n\tasync prepareOperation(plan, codecCtx, middlewareCtx, runBefore) {\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\tawait runBefore({\n\t\t\tmeta: compiled.meta,\n\t\t\t...ifDefined(\"resultShape\", compiled.resultShape),\n\t\t\tcommand: blindCast(draft)\n\t\t}, this.middleware, middlewareCtx, 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, middlewareCtx } = this.createQueryContexts(options);\n\t\tconst generator = async function* () {\n\t\t\tconst exec = await self.prepareQueryExecution(plan, codecCtx, middlewareCtx);\n\t\t\tyield* reportQueryEnding(onQueryEndOutsideTransaction(self.afterTransactionStageFor(exec, middlewareCtx)), () => self.#decodedRows(exec, codecCtx, middlewareCtx));\n\t\t};\n\t\treturn new AsyncIterableResult(generator());\n\t}\n\tasync *#decodedRows(exec, codecCtx, middlewareCtx) {\n\t\tconst stream = runQueryWithMiddleware(exec, this.middleware, middlewareCtx, () => 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\tasync execute(plan, options) {\n\t\tconst { codecCtx, middlewareCtx } = this.createQueryContexts(options);\n\t\tconst exec = await this.prepareExecuteExecution(plan, codecCtx, middlewareCtx);\n\t\treturn reportExecuteEnding(onQueryEndOutsideTransaction(this.afterTransactionStageFor(exec, middlewareCtx)), async () => {\n\t\t\tcheckAborted(codecCtx, \"stream\");\n\t\t\treturn runExecuteWithMiddleware(exec, this.middleware, middlewareCtx, () => 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 { buildMongoEnums, createMongoExecutionContext, createMongoExecutionStack, createMongoParamRefMutator, createMongoRuntime, flattenMongoParamRefs };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAS,gBAAgB,UAAU,QAAQ;CAC1C,MAAM,YAAY,YAAY;EAC7B,MAAM,QAAQ,OAAO,IAAI,OAAO;EAChC,IAAI,UAAU,KAAK,GAAG,MAAM,aAAa,oCAAoC,uCAAuC,QAAQ,+CAA+C,EAAE,QAAQ,CAAC;EACtL,OAAO;CACR;CACA,OAAO,OAAO,YAAY,OAAO,KAAK,SAAS,OAAO,UAAU,CAAC,CAAC,KAAK,gBAAgB,CAAC,aAAa,0BA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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","#readDriverStatistics","#decodedRows"],"sources":["../../../../2-mongo-family/7-runtime/dist/index.mjs"],"sourcesContent":["import { buildEnumsMapForNamespace } from \"@internal/contract/enum-accessor\";\nimport { AsyncIterableResult, RuntimeCore, applyMutationDefaults, assertMutationDefaultGeneratorsAvailable, checkAborted, checkMiddlewareCompatibility, collectMutationDefaultGenerators, executeStatement, runtimeError, streamStatement } from \"@internal/framework-components/runtime\";\nimport { createExecutionStack } from \"@internal/framework-components/execution\";\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-enums.ts\n/**\n* The contract's enum accessors by namespace, each reading its members through its codec in `codecs`: what `db.enums` holds, and what `mongoOrm()` checks a written enum value against. A contract whose enum codec `codecs` lacks is refused here, with `RUNTIME.CODEC_DESCRIPTOR_MISSING`; an enum's members are decoded when it is first read.\n*/\nfunction buildMongoEnums(contract, codecs) {\n\tconst codecFor = (codecId) => {\n\t\tconst codec = codecs.get(codecId);\n\t\tif (codec === void 0) throw runtimeError(\"RUNTIME.CODEC_DESCRIPTOR_MISSING\", `No codec is registered for codecId '${codecId}', which a domain enum in the contract uses.`, { codecId });\n\t\treturn codec;\n\t};\n\treturn Object.fromEntries(Object.keys(contract.domain.namespaces).map((namespaceId) => [namespaceId, buildEnumsMapForNamespace(contract.domain, namespaceId, codecFor)]));\n}\n//#endregion\n//#region src/mongo-execution-stack.ts\nfunction createMongoExecutionStack(options) {\n\treturn blindCast(createExecutionStack({\n\t\ttarget: options.target,\n\t\tadapter: options.adapter,\n\t\tdriver: options.driver,\n\t\textensions: options.extensions\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 = executionOf(options.contract);\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\tstack: options.stack,\n\t\tapplyMutationDefaults: (mutation) => applyMutationDefaults(execution, generators, mutation)\n\t});\n}\nfunction executionOf(contract) {\n\treturn blindCast(contract)?.execution;\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.decode(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};\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\tconst targetId = options.context.stack.target.targetId;\n\t\tfor (const mw of middleware) checkMiddlewareCompatibility(mw, \"mongo\", targetId);\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\tconst adapterInstance = options.context.stack.adapter.create(options.context.stack);\n\t\tthis.#adapter = adapterInstance;\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 { buildMongoEnums, createMongoExecutionContext, createMongoExecutionStack, createMongoParamRefMutator, createMongoRuntime, flattenMongoParamRefs };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAS,gBAAgB,UAAU,QAAQ;CAC1C,MAAM,YAAY,YAAY;EAC7B,MAAM,QAAQ,OAAO,IAAI,OAAO;EAChC,IAAI,UAAU,KAAK,GAAG,MAAM,aAAa,oCAAoC,uCAAuC,QAAQ,+CAA+C,EAAE,QAAQ,CAAC;EACtL,OAAO;CACR;CACA,OAAO,OAAO,YAAY,OAAO,KAAK,SAAS,OAAO,UAAU,CAAC,CAAC,KAAK,gBAAgB,CAAC,aAAa,0BAA0B,SAAS,QAAQ,aAAa,QAAQ,CAAC,CAAC,CAAC;AACzK;AAGA,SAAS,0BAA0B,SAAS;CAC3C,OAAO,UAAU,qBAAqB;EACrC,QAAQ,QAAQ;EAChB,SAAS,QAAQ;EACjB,QAAQ,QAAQ;EAChB,YAAY,QAAQ;CACrB,CAAC,CAAC;AACH;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;CACA,MAAM,aAAa,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BAAiB;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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-family-mongo",
3
- "version": "8.0.0-rc.17-dev.25",
3
+ "version": "8.0.0-rc.17-dev.27",
4
4
  "license": "Apache-2.0",
5
5
  "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.17-dev.25",
13
- "@prisma/orm-toolchain": "8.0.0-rc.17-dev.25",
12
+ "@prisma/orm-framework": "8.0.0-rc.17-dev.27",
13
+ "@prisma/orm-toolchain": "8.0.0-rc.17-dev.27",
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.17-dev.25",
20
- "@internal/mongo-codec": "8.0.0-rc.17-dev.25",
21
- "@internal/mongo-contract": "8.0.0-rc.17-dev.25",
22
- "@internal/mongo-contract-prisma6": "8.0.0-rc.17-dev.25",
23
- "@internal/mongo-contract-psl": "8.0.0-rc.17-dev.25",
24
- "@internal/mongo-contract-ts": "8.0.0-rc.17-dev.25",
25
- "@internal/mongo-emitter": "8.0.0-rc.17-dev.25",
26
- "@internal/mongo-lowering": "8.0.0-rc.17-dev.25",
27
- "@internal/mongo-orm": "8.0.0-rc.17-dev.25",
28
- "@internal/mongo-query-ast": "8.0.0-rc.17-dev.25",
29
- "@internal/mongo-query-builder": "8.0.0-rc.17-dev.25",
30
- "@internal/mongo-runtime": "8.0.0-rc.17-dev.25",
31
- "@internal/mongo-schema-ir": "8.0.0-rc.17-dev.25",
32
- "@internal/mongo-value": "8.0.0-rc.17-dev.25",
33
- "@internal/mongo-wire": "8.0.0-rc.17-dev.25",
34
- "@repo/tsconfig": "8.0.0-rc.17-dev.25",
35
- "@repo/tsdown": "8.0.0-rc.17-dev.25",
19
+ "@internal/family-mongo": "8.0.0-rc.17-dev.27",
20
+ "@internal/mongo-codec": "8.0.0-rc.17-dev.27",
21
+ "@internal/mongo-contract": "8.0.0-rc.17-dev.27",
22
+ "@internal/mongo-contract-prisma6": "8.0.0-rc.17-dev.27",
23
+ "@internal/mongo-contract-psl": "8.0.0-rc.17-dev.27",
24
+ "@internal/mongo-contract-ts": "8.0.0-rc.17-dev.27",
25
+ "@internal/mongo-emitter": "8.0.0-rc.17-dev.27",
26
+ "@internal/mongo-lowering": "8.0.0-rc.17-dev.27",
27
+ "@internal/mongo-orm": "8.0.0-rc.17-dev.27",
28
+ "@internal/mongo-query-ast": "8.0.0-rc.17-dev.27",
29
+ "@internal/mongo-query-builder": "8.0.0-rc.17-dev.27",
30
+ "@internal/mongo-runtime": "8.0.0-rc.17-dev.27",
31
+ "@internal/mongo-schema-ir": "8.0.0-rc.17-dev.27",
32
+ "@internal/mongo-value": "8.0.0-rc.17-dev.27",
33
+ "@internal/mongo-wire": "8.0.0-rc.17-dev.27",
34
+ "@repo/tsconfig": "8.0.0-rc.17-dev.27",
35
+ "@repo/tsdown": "8.0.0-rc.17-dev.27",
36
36
  "tsdown": "0.22.14",
37
37
  "typescript": "5.9.3"
38
38
  },
@@ -1 +0,0 @@
1
- import "./control-adapter-Bh_ZraGM-jP5nqgUQ.mjs";