@prisma-next/framework-components 0.5.0-dev.28 → 0.5.0-dev.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -36,6 +36,37 @@ The base `Codec` interface lands on the seam between **query-time** methods (per
36
36
 
37
37
  There is no `runtime` / `kind` / equivalent async marker on the interface and no `TRuntime` generic. The runtime always awaits the query-time methods. See [ADR 204 — Single-Path Async Codec Runtime](../../../../../docs/architecture%20docs/adrs/ADR%20204%20-%20Single-Path%20Async%20Codec%20Runtime.md) for the full design.
38
38
 
39
+ ### Codec call context (`ctx`)
40
+
41
+ Codecs receive a second `ctx` options argument; you may ignore it. The runtime allocates one `CodecCallContext` per `execute()` call and threads the same reference to every codec dispatch site as a non-optional argument — when no `signal` is supplied the runtime still threads an empty `{}`, never `undefined`. The framework `CodecCallContext` is signal-only:
42
+
43
+ ```ts
44
+ export interface CodecCallContext {
45
+ readonly signal?: AbortSignal;
46
+ }
47
+ ```
48
+
49
+ The internal `Codec` interface declares the parameter as required:
50
+
51
+ ```ts
52
+ encode(value: TInput, ctx: CodecCallContext): Promise<TWire>;
53
+ decode(wire: TWire, ctx: CodecCallContext): Promise<TInput>;
54
+ ```
55
+
56
+ Codec authors who write `(value) => …` continue to compile via TypeScript's bivariance for trailing parameters; nothing at the author surface changes.
57
+
58
+ Family layers extend the context where they have a per-call concept that doesn't generalise. SQL declares `SqlCodecCallContext extends CodecCallContext { column?: SqlColumnRef }` (see `@prisma-next/sql-relational-core`); Mongo continues to use the framework type directly. Codec authors that take a `(value, ctx)` author signature can forward `ctx.signal` to network SDKs:
59
+
60
+ ```ts
61
+ // Sketch — actual factory lives in a family package (codec() / mongoCodec()).
62
+ encode: async (v: string, ctx) =>
63
+ kms.encrypt({ plaintext: v }, { signal: ctx?.signal });
64
+ ```
65
+
66
+ Aborts surface to the caller as `RUNTIME.ABORTED` with `details.phase ∈ { 'encode', 'decode', 'stream' }`. Codec bodies that ignore the signal complete in the background (cooperative cancellation). The `runtimeAborted(phase, cause?)` envelope helper and the `raceAgainstAbort(work, signal, phase)` race helper are exported from `@prisma-next/framework-components/runtime`.
67
+
68
+ See [ADR 207 — Codec call context: per-query `AbortSignal` and column metadata](../../../../docs/architecture%20docs/adrs/ADR%20207%20-%20Codec%20call%20context%20per-query%20AbortSignal%20and%20column%20metadata.md) for the full design.
69
+
39
70
  ## Why SPI types live here (dependency inversion)
40
71
 
41
72
  This package sits in the **core** layer — below the tooling layer where family-specific emitters and control implementations live. SPI interfaces like `EmissionSpi` define the contract between framework orchestration code (control-plane emission, CLI) and family-specific implementations (SQL emitter, Mongo emitter).
@@ -2,6 +2,32 @@ import { JsonValue } from "@prisma-next/contract/types";
2
2
 
3
3
  //#region src/shared/codec-types.d.ts
4
4
  type CodecTrait = 'equality' | 'order' | 'boolean' | 'numeric' | 'textual';
5
+ /**
6
+ * Per-call context the runtime threads to every `codec.encode` /
7
+ * `codec.decode` invocation for a single `runtime.execute()` call.
8
+ *
9
+ * The framework-level shape is family-agnostic and carries one field:
10
+ *
11
+ * - `signal?: AbortSignal` — per-query cancellation. The runtime returns
12
+ * a `RUNTIME.ABORTED` envelope when the signal aborts; codec authors
13
+ * who forward `signal` to their underlying SDK get true cancellation
14
+ * of in-flight network calls.
15
+ *
16
+ * Family layers extend this base with their own shape-of-call metadata:
17
+ * the SQL family adds `column?: SqlColumnRef` via `SqlCodecCallContext`
18
+ * (see `@prisma-next/sql-relational-core`). Mongo currently uses this
19
+ * framework type unchanged. Column metadata is intentionally **not** on
20
+ * the framework type — it is a SQL-family concept rooted in SQL's
21
+ * `(table, column)` addressing model and would not generalise to other
22
+ * families.
23
+ *
24
+ * The interface is named explicitly (not inlined) so future framework
25
+ * fields and family extensions can land additively without breaking
26
+ * codec author signatures.
27
+ */
28
+ interface CodecCallContext {
29
+ readonly signal?: AbortSignal;
30
+ }
5
31
  /**
6
32
  * A codec is the contract between an application value and its on-wire and
7
33
  * on-contract-disk representations.
@@ -38,10 +64,10 @@ interface Codec<Id extends string = string, TTraits extends readonly CodecTrait[
38
64
  readonly targetTypes: readonly string[];
39
65
  /** Semantic traits for operator gating (e.g. equality, order, numeric). */
40
66
  readonly traits?: TTraits;
41
- /** Converts a JS value to the wire format expected by the database driver. Always Promise-returning at the boundary. */
42
- encode(value: TInput): Promise<TWire>;
43
- /** Converts a wire value from the database driver into the JS application type. Always Promise-returning at the boundary. */
44
- decode(wire: TWire): Promise<TInput>;
67
+ /** Converts a JS value to the wire format expected by the database driver. Always Promise-returning at the boundary. The {@link CodecCallContext} is supplied by the runtime on every call (allocated once per `runtime.execute()`); family layers may narrow the ctx to extend it (e.g. SQL adds `column`). Author-side single-arg `(value) => …` functions remain legal via TypeScript's bivariance for trailing parameters. */
68
+ encode(value: TInput, ctx: CodecCallContext): Promise<TWire>;
69
+ /** Converts a wire value from the database driver into the JS application type. Always Promise-returning at the boundary. The {@link CodecCallContext} is supplied by the runtime on every call (allocated once per `runtime.execute()`); family layers may narrow the ctx to extend it (e.g. SQL adds `column`). Author-side single-arg `(wire) => …` functions remain legal via TypeScript's bivariance for trailing parameters. */
70
+ decode(wire: TWire, ctx: CodecCallContext): Promise<TInput>;
45
71
  /** Converts a JS value to a JSON-safe representation for contract serialization. Synchronous; called during contract emission. */
46
72
  encodeJson(value: TInput): JsonValue;
47
73
  /** Converts a JSON representation back to the JS input type. Synchronous; called during contract loading via `validateContract`. */
@@ -54,5 +80,5 @@ interface CodecLookup {
54
80
  }
55
81
  declare const emptyCodecLookup: CodecLookup;
56
82
  //#endregion
57
- export { emptyCodecLookup as i, CodecLookup as n, CodecTrait as r, Codec as t };
58
- //# sourceMappingURL=codec-types-Csp_4QDg.d.mts.map
83
+ export { emptyCodecLookup as a, CodecTrait as i, CodecCallContext as n, CodecLookup as r, Codec as t };
84
+ //# sourceMappingURL=codec-types-DXv-ROhF.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-types-DXv-ROhF.d.mts","names":[],"sources":["../src/shared/codec-types.ts"],"sourcesContent":[],"mappings":";;;KAEY,UAAA;;AAAZ;AAyBA;AAiCA;;;;;;;;;;;;;;;;;;;AAwBA;AAIa,UA7DI,gBAAA,CA+DhB;oBA9DmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAgCH,2DAEU,wBAAwB;;eAKpC;;;;oBAIK;;gBAEJ,aAAa,mBAAmB,QAAQ;;eAEzC,YAAY,mBAAmB,QAAQ;;oBAElC,SAAS;;mBAEV,YAAY;;gCAEC;;UAGf,WAAA;mBACE;;cAGN,kBAAkB"}
package/dist/codec.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { i as emptyCodecLookup, n as CodecLookup, r as CodecTrait, t as Codec } from "./codec-types-Csp_4QDg.mjs";
2
- export { type Codec, type CodecLookup, type CodecTrait, emptyCodecLookup };
1
+ import { a as emptyCodecLookup, i as CodecTrait, n as CodecCallContext, r as CodecLookup, t as Codec } from "./codec-types-DXv-ROhF.mjs";
2
+ export { type Codec, type CodecCallContext, type CodecLookup, type CodecTrait, emptyCodecLookup };
@@ -1 +1 @@
1
- {"version":3,"file":"codec.mjs","names":["emptyCodecLookup: CodecLookup"],"sources":["../src/shared/codec-types.ts"],"sourcesContent":["import type { JsonValue } from '@prisma-next/contract/types';\n\nexport type CodecTrait = 'equality' | 'order' | 'boolean' | 'numeric' | 'textual';\n\n/**\n * A codec is the contract between an application value and its on-wire and\n * on-contract-disk representations.\n *\n * The author's mental model is two JS-side types — `TInput` (the\n * application JS type) and `TWire` (the database driver wire format) —\n * plus `JsonValue` for build-time contract artifacts. The codec translates\n * `TInput` to `TWire` on writes and back on reads, and to/from `JsonValue`\n * during contract emission and loading.\n *\n * Three representations participate:\n * - **Input** (`TInput`): the JS type at the application boundary.\n * - **Wire** (`TWire`): the format exchanged with the database driver.\n * - **JSON** (`JsonValue`): a JSON-safe form used in contract artifacts.\n *\n * Codec methods split into two groups:\n *\n * - **Query-time** methods (`encode`, `decode`) run per row/parameter at the\n * IO boundary; they are required and Promise-returning. The per-family\n * codec factory accepts sync or async author functions and lifts sync\n * ones to Promise-shaped methods automatically.\n * - **Build-time** methods (`encodeJson`, `decodeJson`, `renderOutputType`)\n * run when the contract is serialized, loaded, or when client types are\n * emitted. They stay synchronous so contract validation and client\n * construction are synchronous.\n *\n * Target-family codec interfaces extend this base with target-shaped\n * metadata.\n */\nexport interface Codec<\n Id extends string = string,\n TTraits extends readonly CodecTrait[] = readonly CodecTrait[],\n TWire = unknown,\n TInput = unknown,\n> {\n /** Unique codec identifier in `namespace/name@version` format (e.g. `pg/timestamptz@1`). */\n readonly id: Id;\n /** Database-native type names this codec handles (e.g. `['timestamptz']`). */\n readonly targetTypes: readonly string[];\n /** Semantic traits for operator gating (e.g. equality, order, numeric). */\n readonly traits?: TTraits;\n /** Converts a JS value to the wire format expected by the database driver. Always Promise-returning at the boundary. */\n encode(value: TInput): Promise<TWire>;\n /** Converts a wire value from the database driver into the JS application type. Always Promise-returning at the boundary. */\n decode(wire: TWire): Promise<TInput>;\n /** Converts a JS value to a JSON-safe representation for contract serialization. Synchronous; called during contract emission. */\n encodeJson(value: TInput): JsonValue;\n /** Converts a JSON representation back to the JS input type. Synchronous; called during contract loading via `validateContract`. */\n decodeJson(json: JsonValue): TInput;\n /** Produces the TypeScript output type expression for a field given its `typeParams`. Synchronous; used during contract.d.ts emission. */\n renderOutputType?(typeParams: Record<string, unknown>): string | undefined;\n}\n\nexport interface CodecLookup {\n get(id: string): Codec | undefined;\n}\n\nexport const emptyCodecLookup: CodecLookup = {\n get: () => undefined,\n};\n"],"mappings":";AA6DA,MAAaA,mBAAgC,EAC3C,WAAW,QACZ"}
1
+ {"version":3,"file":"codec.mjs","names":["emptyCodecLookup: CodecLookup"],"sources":["../src/shared/codec-types.ts"],"sourcesContent":["import type { JsonValue } from '@prisma-next/contract/types';\n\nexport type CodecTrait = 'equality' | 'order' | 'boolean' | 'numeric' | 'textual';\n\n/**\n * Per-call context the runtime threads to every `codec.encode` /\n * `codec.decode` invocation for a single `runtime.execute()` call.\n *\n * The framework-level shape is family-agnostic and carries one field:\n *\n * - `signal?: AbortSignal` — per-query cancellation. The runtime returns\n * a `RUNTIME.ABORTED` envelope when the signal aborts; codec authors\n * who forward `signal` to their underlying SDK get true cancellation\n * of in-flight network calls.\n *\n * Family layers extend this base with their own shape-of-call metadata:\n * the SQL family adds `column?: SqlColumnRef` via `SqlCodecCallContext`\n * (see `@prisma-next/sql-relational-core`). Mongo currently uses this\n * framework type unchanged. Column metadata is intentionally **not** on\n * the framework type — it is a SQL-family concept rooted in SQL's\n * `(table, column)` addressing model and would not generalise to other\n * families.\n *\n * The interface is named explicitly (not inlined) so future framework\n * fields and family extensions can land additively without breaking\n * codec author signatures.\n */\nexport interface CodecCallContext {\n readonly signal?: AbortSignal;\n}\n\n/**\n * A codec is the contract between an application value and its on-wire and\n * on-contract-disk representations.\n *\n * The author's mental model is two JS-side types — `TInput` (the\n * application JS type) and `TWire` (the database driver wire format) —\n * plus `JsonValue` for build-time contract artifacts. The codec translates\n * `TInput` to `TWire` on writes and back on reads, and to/from `JsonValue`\n * during contract emission and loading.\n *\n * Three representations participate:\n * - **Input** (`TInput`): the JS type at the application boundary.\n * - **Wire** (`TWire`): the format exchanged with the database driver.\n * - **JSON** (`JsonValue`): a JSON-safe form used in contract artifacts.\n *\n * Codec methods split into two groups:\n *\n * - **Query-time** methods (`encode`, `decode`) run per row/parameter at the\n * IO boundary; they are required and Promise-returning. The per-family\n * codec factory accepts sync or async author functions and lifts sync\n * ones to Promise-shaped methods automatically.\n * - **Build-time** methods (`encodeJson`, `decodeJson`, `renderOutputType`)\n * run when the contract is serialized, loaded, or when client types are\n * emitted. They stay synchronous so contract validation and client\n * construction are synchronous.\n *\n * Target-family codec interfaces extend this base with target-shaped\n * metadata.\n */\nexport interface Codec<\n Id extends string = string,\n TTraits extends readonly CodecTrait[] = readonly CodecTrait[],\n TWire = unknown,\n TInput = unknown,\n> {\n /** Unique codec identifier in `namespace/name@version` format (e.g. `pg/timestamptz@1`). */\n readonly id: Id;\n /** Database-native type names this codec handles (e.g. `['timestamptz']`). */\n readonly targetTypes: readonly string[];\n /** Semantic traits for operator gating (e.g. equality, order, numeric). */\n readonly traits?: TTraits;\n /** Converts a JS value to the wire format expected by the database driver. Always Promise-returning at the boundary. The {@link CodecCallContext} is supplied by the runtime on every call (allocated once per `runtime.execute()`); family layers may narrow the ctx to extend it (e.g. SQL adds `column`). Author-side single-arg `(value) => …` functions remain legal via TypeScript's bivariance for trailing parameters. */\n encode(value: TInput, ctx: CodecCallContext): Promise<TWire>;\n /** Converts a wire value from the database driver into the JS application type. Always Promise-returning at the boundary. The {@link CodecCallContext} is supplied by the runtime on every call (allocated once per `runtime.execute()`); family layers may narrow the ctx to extend it (e.g. SQL adds `column`). Author-side single-arg `(wire) => …` functions remain legal via TypeScript's bivariance for trailing parameters. */\n decode(wire: TWire, ctx: CodecCallContext): Promise<TInput>;\n /** Converts a JS value to a JSON-safe representation for contract serialization. Synchronous; called during contract emission. */\n encodeJson(value: TInput): JsonValue;\n /** Converts a JSON representation back to the JS input type. Synchronous; called during contract loading via `validateContract`. */\n decodeJson(json: JsonValue): TInput;\n /** Produces the TypeScript output type expression for a field given its `typeParams`. Synchronous; used during contract.d.ts emission. */\n renderOutputType?(typeParams: Record<string, unknown>): string | undefined;\n}\n\nexport interface CodecLookup {\n get(id: string): Codec | undefined;\n}\n\nexport const emptyCodecLookup: CodecLookup = {\n get: () => undefined,\n};\n"],"mappings":";AAwFA,MAAaA,mBAAgC,EAC3C,WAAW,QACZ"}
@@ -1,2 +1,2 @@
1
- import { S as checkContractComponentRequirements, _ as PackRefBase, a as ComponentMetadata, b as TargetInstance, c as DriverDescriptor, d as ExtensionDescriptor, f as ExtensionInstance, g as FamilyPackRef, h as FamilyInstance, i as ComponentDescriptor, l as DriverInstance, m as FamilyDescriptor, n as AdapterInstance, o as ContractComponentRequirementsCheckInput, p as ExtensionPackRef, r as AdapterPackRef, s as ContractComponentRequirementsCheckResult, t as AdapterDescriptor, u as DriverPackRef, v as TargetBoundComponentDescriptor, x as TargetPackRef, y as TargetDescriptor } from "./framework-components-XYjBYPoB.mjs";
1
+ import { S as checkContractComponentRequirements, _ as PackRefBase, a as ComponentMetadata, b as TargetInstance, c as DriverDescriptor, d as ExtensionDescriptor, f as ExtensionInstance, g as FamilyPackRef, h as FamilyInstance, i as ComponentDescriptor, l as DriverInstance, m as FamilyDescriptor, n as AdapterInstance, o as ContractComponentRequirementsCheckInput, p as ExtensionPackRef, r as AdapterPackRef, s as ContractComponentRequirementsCheckResult, t as AdapterDescriptor, u as DriverPackRef, v as TargetBoundComponentDescriptor, x as TargetPackRef, y as TargetDescriptor } from "./framework-components-Buvf7mnC.mjs";
2
2
  export { type AdapterDescriptor, type AdapterInstance, type AdapterPackRef, type ComponentDescriptor, type ComponentMetadata, type ContractComponentRequirementsCheckInput, type ContractComponentRequirementsCheckResult, type DriverDescriptor, type DriverInstance, type DriverPackRef, type ExtensionDescriptor, type ExtensionInstance, type ExtensionPackRef, type FamilyDescriptor, type FamilyInstance, type FamilyPackRef, type PackRefBase, type TargetBoundComponentDescriptor, type TargetDescriptor, type TargetInstance, type TargetPackRef, checkContractComponentRequirements };
@@ -1,6 +1,6 @@
1
1
  import { a as AuthoringFieldNamespace, d as AuthoringTypeNamespace, i as AuthoringContributions } from "./framework-authoring-BdrFDx4x.mjs";
2
- import { n as CodecLookup } from "./codec-types-Csp_4QDg.mjs";
3
- import { A as LoweredDefaultResult, C as ControlMutationDefaultEntry, D as DefaultFunctionLoweringHandler, E as DefaultFunctionLoweringContext, F as SourceSpan, M as MutationDefaultGeneratorDescriptor, N as ParsedDefaultFunctionCall, O as DefaultFunctionRegistry, P as SourceDiagnostic, T as ControlMutationDefaults, a as ComponentMetadata, b as TargetInstance, c as DriverDescriptor, d as ExtensionDescriptor, f as ExtensionInstance, h as FamilyInstance, j as LoweredDefaultValue, k as DefaultFunctionRegistryEntry, l as DriverInstance, m as FamilyDescriptor, n as AdapterInstance, t as AdapterDescriptor, v as TargetBoundComponentDescriptor, w as ControlMutationDefaultRegistry, y as TargetDescriptor } from "./framework-components-XYjBYPoB.mjs";
2
+ import { r as CodecLookup } from "./codec-types-DXv-ROhF.mjs";
3
+ import { A as LoweredDefaultResult, C as ControlMutationDefaultEntry, D as DefaultFunctionLoweringHandler, E as DefaultFunctionLoweringContext, F as SourceSpan, M as MutationDefaultGeneratorDescriptor, N as ParsedDefaultFunctionCall, O as DefaultFunctionRegistry, P as SourceDiagnostic, T as ControlMutationDefaults, a as ComponentMetadata, b as TargetInstance, c as DriverDescriptor, d as ExtensionDescriptor, f as ExtensionInstance, h as FamilyInstance, j as LoweredDefaultValue, k as DefaultFunctionRegistryEntry, l as DriverInstance, m as FamilyDescriptor, n as AdapterInstance, t as AdapterDescriptor, v as TargetBoundComponentDescriptor, w as ControlMutationDefaultRegistry, y as TargetDescriptor } from "./framework-components-Buvf7mnC.mjs";
4
4
  import { t as TypesImportSpec } from "./types-import-spec-D-O6GotH.mjs";
5
5
  import { t as EmissionSpi } from "./emission-types-D234HxUz.mjs";
6
6
  import { m as PslDocumentAst } from "./psl-ast-9X5rwo98.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"control.d.mts","names":[],"sources":["../src/control/control-result-types.ts","../src/control/control-instances.ts","../src/control/control-stack.ts","../src/control/control-descriptors.ts","../src/control/control-migration-types.ts","../src/control/control-operation-preview.ts","../src/control/control-schema-view.ts","../src/control/control-capabilities.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;cAAa,0BAAA;cACA,yBAAA;cACA,2BAAA;cACA,0BAAA;UAEI,gBAAA;;;kBAGC,SAAS;;UAGV,oBAAA;EAXJ,SAAA,EAAA,EAAA,OAAA;EACA,SAAA,IAAA,CAAA,EAAA,MAAA;EACA,SAAA,OAAA,EAAA,MAAA;EACA,SAAA,QAAA,EAAA;IAEI,SAAA,WAAgB,EAAA,MAGN;IAGV,SAAA,WAAoB,CAAA,EAAA,MAA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,SAAA,CAAA,CAAA,QAAA,EO/EvB,qBP+EuB,CO/ED,SP+EC,EO/EU,SP+EV,CAAA,CAAA,EAAA,QAAA,IO9EpB,qBP8EoB,CO9EE,SP8EF,EO9Ea,SP8Eb,CAAA,GO9E0B,uBP8E1B,CO9EkD,SP8ElD,CAAA;AAQnC;AAiBA;;;;ACvIiB,UM4CA,uBAAA,CN5CqB;EACb,kBAAA,CAAA,UAAA,EAAA,SM4CiB,sBN5CjB,EAAA,CAAA,EM4C4C,gBN5C5C;;AAIkB,iBM2C3B,mBN3C2B,CAAA,kBAAA,MAAA,EAAA,SAAA,CAAA,CAAA,QAAA,EM4C/B,qBN5C+B,CM4CT,SN5CS,EM4CE,SN5CF,CAAA,CAAA,EAAA,QAAA,IM6C5B,qBN7C4B,CM6CN,SN7CM,EM6CK,SN7CL,CAAA,GM6CkB,uBN7ClB"}
1
+ {"version":3,"file":"control.d.mts","names":[],"sources":["../src/control/control-result-types.ts","../src/control/control-instances.ts","../src/control/control-stack.ts","../src/control/control-descriptors.ts","../src/control/control-migration-types.ts","../src/control/control-operation-preview.ts","../src/control/control-schema-view.ts","../src/control/control-capabilities.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;cAAa,0BAAA;cACA,yBAAA;cACA,2BAAA;cACA,0BAAA;UAEI,gBAAA;;;kBAGC,SAAS;;UAGV,oBAAA;EAXJ,SAAA,EAAA,EAAA,OAAA;EACA,SAAA,IAAA,CAAA,EAAA,MAAA;EACA,SAAA,OAAA,EAAA,MAAA;EACA,SAAA,QAAA,EAAA;IAEI,SAAA,WAAgB,EAAA,MAGN;IAGV,SAAA,WAAoB,CAAA,EAAA,MAAA;EA2BpB,CAAA;EAiCA,SAAA,MAAA,CAAA,EAAA;IAQL,SAAA,WAAW,CAAA,EAAG,MAAA;IAET,SAAA,WAAA,CAAsB,EAAA,MAAA;EAYtB,CAAA;EAgCA,SAAA,MAAA,EAAA;IAQA,SAAA,QAAA,EAAA,MAAsB;IAiBtB,SAAA,MA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;;;;ACvIiB,UM4CA,uBAAA,CN5CqB;EACb,kBAAA,CAAA,UAAA,EAAA,SM4CiB,sBN5CjB,EAAA,CAAA,EM4C4C,gBN5C5C;;AAIkB,iBM2C3B,mBN3C2B,CAAA,kBAAA,MAAA,EAAA,SAAA,CAAA,CAAA,QAAA,EM4C/B,qBN5C+B,CM4CT,SN5CS,EM4CE,SN5CF,CAAA,CAAA,EAAA,QAAA,IM6C5B,qBN7C4B,CM6CN,SN7CM,EM6CK,SN7CL,CAAA,GM6CkB,uBN7ClB"}
@@ -1,4 +1,4 @@
1
- import { b as TargetInstance, c as DriverDescriptor, d as ExtensionDescriptor, f as ExtensionInstance, h as FamilyInstance, l as DriverInstance, m as FamilyDescriptor, n as AdapterInstance, t as AdapterDescriptor, y as TargetDescriptor } from "./framework-components-XYjBYPoB.mjs";
1
+ import { b as TargetInstance, c as DriverDescriptor, d as ExtensionDescriptor, f as ExtensionInstance, h as FamilyInstance, l as DriverInstance, m as FamilyDescriptor, n as AdapterInstance, t as AdapterDescriptor, y as TargetDescriptor } from "./framework-components-Buvf7mnC.mjs";
2
2
 
3
3
  //#region src/execution/execution-instances.d.ts
4
4
  interface RuntimeFamilyInstance<TFamilyId extends string> extends FamilyInstance<TFamilyId> {}
@@ -1 +1 @@
1
- {"version":3,"file":"framework-authoring-BdrFDx4x.d.mts","names":[],"sources":["../src/shared/framework-authoring.ts"],"sourcesContent":[],"mappings":";KAEY,eAAA;EAAA,SAAA,IAAA,EAAA,KAAe;EAOf,SAAA,KAAA,EAAA,MAAA;EAKR,SAAA,IAAA,CAAA,EAAA,SAAA,MAAA,EAAA;EACS,SAAA,OAAA,CAAA,EATQ,sBASR;CACiB;AAAsB,KAPxC,sBAAA,GAOwC,MAAA,GAAA,MAAA,GAAA,OAAA,GAAA,IAAA,GAFhD,eAEgD,GAAA,SADvC,sBACuC,EAAA,GAAA;EAE1C,UAAA,GAAA,EAAA,MAAA,CAAA,EAFoB,sBAEa;AAK3C,CAAA;UALU,i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AYA,SAAA,IAAA,CAAA,EAAA,SA3EW,2BA6Ef,EAAA;EAUI,SAAA,MAAA,EAtFG,4BAuFP;AA2GZ;AAuFgB,UAtRC,qCAAA,CAuRH;EAUE,SAAA,IAAA,EAAA,SAAA;kBA/RE;;UAGD,sCAAA;;uBAEM;;KAGX,8BAAA,GACR,wCACA;UAEa,0BAAA,SAAmC;;qBAE/B;8BACS;;;;UAKb,8BAAA;;2BAEU;mBACR;;KAGP,sBAAA;2BACe,qCAAqC;;KAGpD,uBAAA;2BACe,iCAAiC;;UAG3C,sBAAA;kBACC;mBACC;;iBAGH,iBAAA,2BAA4C;iBAkB5C,oCAAA,2BAEJ;iBAUI,gCAAA,2BAEJ;iBAUI,6BAAA,WACJ;iBA2GI,gCAAA,2CAEQ;iBAqFR,mCAAA,aACF;;;wBAKU;;iBAKR,+BAAA,aACF;;;;0BAMY"}
@@ -1,5 +1,5 @@
1
1
  import { i as AuthoringContributions } from "./framework-authoring-BdrFDx4x.mjs";
2
- import { t as Codec } from "./codec-types-Csp_4QDg.mjs";
2
+ import { t as Codec } from "./codec-types-DXv-ROhF.mjs";
3
3
  import { t as TypesImportSpec } from "./types-import-spec-D-O6GotH.mjs";
4
4
  import { ColumnDefault, ExecutionMutationDefaultValue } from "@prisma-next/contract/types";
5
5
 
@@ -421,4 +421,4 @@ interface ExtensionInstance<TFamilyId extends string, TTargetId extends string>
421
421
  }
422
422
  //#endregion
423
423
  export { LoweredDefaultResult as A, ControlMutationDefaultEntry as C, DefaultFunctionLoweringHandler as D, DefaultFunctionLoweringContext as E, SourceSpan as F, MutationDefaultGeneratorDescriptor as M, ParsedDefaultFunctionCall as N, DefaultFunctionRegistry as O, SourceDiagnostic as P, checkContractComponentRequirements as S, ControlMutationDefaults as T, PackRefBase as _, ComponentMetadata as a, TargetInstance as b, DriverDescriptor as c, ExtensionDescriptor as d, ExtensionInstance as f, FamilyPackRef as g, FamilyInstance as h, ComponentDescriptor as i, LoweredDefaultValue as j, DefaultFunctionRegistryEntry as k, DriverInstance as l, FamilyDescriptor as m, AdapterInstance as n, ContractComponentRequirementsCheckInput as o, ExtensionPackRef as p, AdapterPackRef as r, ContractComponentRequirementsCheckResult as s, AdapterDescriptor as t, DriverPackRef as u, TargetBoundComponentDescriptor as v, ControlMutationDefaultRegistry as w, TargetPackRef as x, TargetDescriptor as y };
424
- //# sourceMappingURL=framework-components-XYjBYPoB.d.mts.map
424
+ //# sourceMappingURL=framework-components-Buvf7mnC.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"framework-components-XYjBYPoB.d.mts","names":[],"sources":["../src/shared/mutation-default-types.ts","../src/shared/framework-components.ts"],"sourcesContent":[],"mappings":";;;;;;UAEU,cAAA;;;;;AAAA,UAMO,UAAA,CANO;EAMP,SAAA,KAAU,EACT,cAAA;EAID,SAAA,GAAA,EAHD,cAGiB;;AAKN,UALV,gBAAA,CAKU;EAAT,SAAA,IAAA,EAAA,MAAA;EAAQ,SAAA,OAAA,EAAA,MAAA;EAGhB,SAAA,QAAA,CAAA,EAAA,MAAuB;EAKhB,SAAA,IAAA,CAAA,EATC,UASD;EAOA,SAAA,IAAA,CAAA,EAfC,QAeD,CAfU,MAeV,CAAA,MAA8B,EAAA,OAAA,CAAA,CAAA;AAO/C;AAIA,UAvBU,uBAAA,CAuBsB;EAIpB,SAAA,GAAA,EAAA,MAAA;EACK,SAAA,IAAA,EA1BA,UA0BA;;AAEX,UAzBW,yBAAA,CAyBX;EAAoB,SAAA,IAAA,EAAA,MAAA;EAET,SAAA,GAAA,EAAA,MAAA;EAKL,SAAA,IAAA,EAAA,SA7Bc,uBA6BgC,EAAA;EAEzC,SAAA,IAAA,EA9BA,UA8BA;AAejB;AAEmB,UA5CF,8BAAA,CA4CE;EACG,SAAA,QAAA,EAAA,MAAA;EACd,SAAA,SAAA,EAAA,MAAA;EAAoB,SAAA,SAAA,EAAA,MAAA;EAIhB,SAAA,aAAA,CAAA,EAAA,MAAA;AAEZ;KA7CY,mBAAA;;yBAC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;;;;;;;;;;;;;;;UA+BJ,8EACP;;qBAEW;;qBAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiCJ,6EACP;;qBAEW;;qBAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA8BJ,gFACP;;qBAEW;;qBAGA;;;KAIT,qFACR,iBAAiB,WAAW,aAC5B,kBAAkB,WAAW,aAC7B,iBAAiB,WAAW,aAC5B,oBAAoB,WAAW;UAElB;qBACI;;UAGJ;qBACI;qBACA;;UAGJ;qBACI;qBACA;;UAGJ;qBACI;qBACA;;UAGJ;qBACI;qBACA"}
1
+ {"version":3,"file":"framework-components-Buvf7mnC.d.mts","names":[],"sources":["../src/shared/mutation-default-types.ts","../src/shared/framework-components.ts"],"sourcesContent":[],"mappings":";;;;;;UAEU,cAAA;;;;;AAAA,UAMO,UAAA,CANO;EAMP,SAAA,KAAU,EACT,cAAA;EAID,SAAA,GAAA,EAHD,cAGiB;;AAKN,UALV,gBAAA,CAKU;EAAT,SAAA,IAAA,EAAA,MAAA;EAAQ,SAAA,OAAA,EAAA,MAAA;EAGhB,SAAA,QAAA,CAAA,EAAA,MAAuB;EAKhB,SAAA,IAAA,CAAA,EATC,UASD;EAOA,SAAA,IAAA,CAAA,EAfC,QAeD,CAfU,MAeV,CAAA,MAA8B,EAAA,OAAA,CAAA,CAAA;AAO/C;AAIA,UAvBU,uBAAA,CAuBsB;EAIpB,SAAA,GAAA,EAAA,MAAA;EACK,SAAA,IAAA,EA1BA,UA0BA;;AAEX,UAzBW,yBAAA,CAyBX;EAAoB,SAAA,IAAA,EAAA,MAAA;EAET,SAAA,GAAA,EAAA,MAAA;EAKL,SAAA,IAAA,EAAA,SA7Bc,uBA6BgC,EAAA;EAEzC,SAAA,IAAA,EA9BA,UA8BA;AAejB;AAEmB,UA5CF,8BAAA,CA4CE;EACG,SAAA,QAAA,EAAA,MAAA;EACd,SAAA,SAAA,EAAA,MAAA;EAAoB,SAAA,SAAA,EAAA,MAAA;EAIhB,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AAyB;qBACR;;KAGT,sFAGR,sBAAsB;qBACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA+BJ,8EACP;;qBAEW;;qBAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiCJ,6EACP;;qBAEW;;qBAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA8BJ,gFACP;;qBAEW;;qBAGA;;;KAIT,qFACR,iBAAiB,WAAW,aAC5B,kBAAkB,WAAW,aAC7B,iBAAiB,WAAW,aAC5B,oBAAoB,WAAW;UAElB;qBACI;;UAGJ;qBACI;qBACA;;UAGJ;qBACI;qBACA;;UAGJ;qBACI;qBACA;;UAGJ;qBACI;qBACA"}
@@ -1,3 +1,4 @@
1
+ import { n as CodecCallContext } from "./codec-types-DXv-ROhF.mjs";
1
2
  import { PlanMeta } from "@prisma-next/contract/types";
2
3
 
3
4
  //#region src/execution/async-iterable-result.d.ts
@@ -63,6 +64,86 @@ type ResultType<P> = '_row' extends keyof P ? P extends {
63
64
  readonly _row?: infer R;
64
65
  } ? R : never : never;
65
66
  //#endregion
67
+ //#region src/execution/runtime-error.d.ts
68
+ interface RuntimeErrorEnvelope extends Error {
69
+ readonly code: string;
70
+ readonly category: 'PLAN' | 'CONTRACT' | 'LINT' | 'BUDGET' | 'RUNTIME';
71
+ readonly severity: 'error';
72
+ readonly details?: Record<string, unknown>;
73
+ }
74
+ /**
75
+ * Stable code emitted by the runtime when an in-flight `execute()`
76
+ * is cancelled via the per-query `AbortSignal`. The envelope's
77
+ * `details.phase` distinguishes where the abort was observed:
78
+ *
79
+ * - `'encode'` — abort fired during `encodeParams` (SQL) or
80
+ * `resolveValue` (Mongo).
81
+ * - `'decode'` — abort fired during `decodeRow` / `decodeField`.
82
+ * - `'stream'` — abort fired between rows or before any codec call
83
+ * (already-aborted at entry).
84
+ */
85
+ declare const RUNTIME_ABORTED: "RUNTIME.ABORTED";
86
+ /** Discriminator placed in `details.phase` of a `RUNTIME.ABORTED` envelope. */
87
+ type RuntimeAbortedPhase = 'encode' | 'decode' | 'stream';
88
+ /**
89
+ * Type guard for the runtime-error envelope produced by `runtimeError`.
90
+ *
91
+ * Prefer this over duck-typing on `error.code` directly so consumers stay
92
+ * insulated from the envelope's internal shape.
93
+ */
94
+ declare function isRuntimeError(error: unknown): error is RuntimeErrorEnvelope;
95
+ declare function runtimeError(code: string, message: string, details?: Record<string, unknown>): RuntimeErrorEnvelope;
96
+ /**
97
+ * Construct a `RUNTIME.ABORTED` envelope. Phase distinguishes where the
98
+ * abort was observed (encode / decode / stream); cause carries `signal.reason`
99
+ * verbatim from the platform — native abort produces a `DOMException`,
100
+ * explicit `controller.abort(reason)` produces whatever the caller passed.
101
+ * No synthesis happens here.
102
+ */
103
+ declare function runtimeAborted(phase: RuntimeAbortedPhase, cause?: unknown): RuntimeErrorEnvelope;
104
+ //#endregion
105
+ //#region src/execution/race-against-abort.d.ts
106
+ /**
107
+ * Throw a phase-tagged `RUNTIME.ABORTED` envelope if the supplied
108
+ * codec-call context is already aborted at the precheck site. Centralises
109
+ * the `if (ctx.signal?.aborted) throw runtimeAborted(...)` pattern that
110
+ * every codec dispatch site repeats.
111
+ */
112
+ declare function checkAborted(ctx: CodecCallContext, phase: RuntimeAbortedPhase): void;
113
+ /**
114
+ * Race a per-cell `Promise.all` (or any other in-flight work promise) against
115
+ * the supplied abort signal so the runtime returns `RUNTIME.ABORTED` promptly
116
+ * even when codec bodies ignore the signal. In-flight bodies that ignore the
117
+ * signal are abandoned and run to completion in the background — the
118
+ * cooperative-cancellation contract documented in ADR 204.
119
+ *
120
+ * Call sites still SHOULD pre-check `signal.aborted` and short-circuit with
121
+ * a phase-tagged `RUNTIME.ABORTED` envelope before invoking this helper —
122
+ * that path is the canonical "aborted at entry" surface and avoids
123
+ * scheduling the work promise. As a defensive belt-and-braces, this helper
124
+ * also handles the already-aborted case internally: `AbortSignal` does not
125
+ * replay past abort events to listeners registered after the abort, so we
126
+ * inspect `signal.aborted` synchronously and reject with the sentinel
127
+ * before installing the listener. The rejection is still attributed to the
128
+ * abort path via the sentinel-identity check.
129
+ *
130
+ * Distinguishing the rejection source is load-bearing for AC-ERR4
131
+ * (`RUNTIME.ENCODE_FAILED` / `RUNTIME.DECODE_FAILED` pass through unchanged).
132
+ * The semantically equivalent `abortable(signal)` helper in
133
+ * `@prisma-next/utils` rejects with `signal.reason ?? new DOMException(...)`,
134
+ * which is not stably distinguishable from a codec-thrown error by identity
135
+ * alone (a fresh fallback DOMException is allocated per call). We instead
136
+ * track abort attribution with a unique sentinel: only the `onAbort` listener
137
+ * installed here ever rejects with the sentinel, so an `error === sentinel`
138
+ * identity check after the race is unambiguous.
139
+ *
140
+ * Lives in `framework-components` (rather than the SQL family, where it
141
+ * originated in m2) so every family runtime that needs cooperative
142
+ * cancellation around a codec-dispatch `Promise.all` (SQL encode + decode
143
+ * today, Mongo encode in m3) shares the same attribution logic.
144
+ */
145
+ declare function raceAgainstAbort<T>(work: Promise<T>, signal: AbortSignal | undefined, phase: RuntimeAbortedPhase): Promise<T>;
146
+ //#endregion
66
147
  //#region src/execution/runtime-middleware.d.ts
67
148
  interface RuntimeLog {
68
149
  info(event: unknown): void;
@@ -97,6 +178,18 @@ interface RuntimeMiddleware<TPlan extends QueryPlan = QueryPlan> {
97
178
  onRow?(row: Record<string, unknown>, plan: TPlan, ctx: RuntimeMiddlewareContext): Promise<void>;
98
179
  afterExecute?(plan: TPlan, result: AfterExecuteResult, ctx: RuntimeMiddlewareContext): Promise<void>;
99
180
  }
181
+ /**
182
+ * Optional per-`execute` options accepted by every family runtime.
183
+ *
184
+ * `signal` is the per-query cancellation signal. The runtime threads the
185
+ * signal through to every codec call for the query and uses it to short-
186
+ * circuit the row stream with `RUNTIME.ABORTED` when the caller aborts.
187
+ * Omitting the option (or passing `undefined`) preserves today's behavior
188
+ * bit-for-bit.
189
+ */
190
+ interface RuntimeExecuteOptions {
191
+ readonly signal?: AbortSignal;
192
+ }
100
193
  /**
101
194
  * Cross-family SPI for any runtime that can execute plans and be shut down.
102
195
  * Each family runtime (SQL, Mongo) satisfies this interface — SQL nominally,
@@ -108,7 +201,7 @@ interface RuntimeMiddleware<TPlan extends QueryPlan = QueryPlan> {
108
201
  interface RuntimeExecutor<TPlan extends QueryPlan> {
109
202
  execute<Row>(plan: TPlan & {
110
203
  readonly _row?: Row;
111
- }): AsyncIterableResult<Row>;
204
+ }, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
112
205
  close(): Promise<void>;
113
206
  }
114
207
  declare function checkMiddlewareCompatibility(middleware: RuntimeMiddleware, runtimeFamilyId: string, runtimeTargetId: string): void;
@@ -185,8 +278,16 @@ declare abstract class RuntimeCore<TPlan extends QueryPlan, TExec extends Execut
185
278
  * Lower a pre-lowering `TPlan` into the family's executable `TExec`.
186
279
  * Family-specific: SQL produces `{ sql, params, ast?, ... }`; Mongo
187
280
  * produces `{ command, ... }`.
281
+ *
282
+ * `ctx` carries per-query cancellation (and any future fields on
283
+ * `CodecCallContext`); concrete subclasses forward it to the
284
+ * encode-side codec dispatch site (e.g. SQL's `encodeParams` in m2,
285
+ * Mongo's `resolveValue` in m3). The runtime allocates one ctx per
286
+ * `execute()` call and threads the same reference everywhere; the
287
+ * `signal` field inside may be `undefined`, but the ctx object itself
288
+ * is always present.
188
289
  */
189
- protected abstract lower(plan: TPlan): TExec | Promise<TExec>;
290
+ protected abstract lower(plan: TPlan, ctx: CodecCallContext): TExec | Promise<TExec>;
190
291
  /**
191
292
  * Drive the underlying transport for a lowered `TExec`. Yields raw rows
192
293
  * directly from the driver as `Record<string, unknown>`; codec decoding
@@ -201,24 +302,8 @@ declare abstract class RuntimeCore<TPlan extends QueryPlan, TExec extends Execut
201
302
  abstract close(): Promise<void>;
202
303
  execute<Row>(plan: TPlan & {
203
304
  readonly _row?: Row;
204
- }): AsyncIterableResult<Row>;
305
+ }, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
205
306
  }
206
307
  //#endregion
207
- //#region src/execution/runtime-error.d.ts
208
- interface RuntimeErrorEnvelope extends Error {
209
- readonly code: string;
210
- readonly category: 'PLAN' | 'CONTRACT' | 'LINT' | 'BUDGET' | 'RUNTIME';
211
- readonly severity: 'error';
212
- readonly details?: Record<string, unknown>;
213
- }
214
- /**
215
- * Type guard for the runtime-error envelope produced by `runtimeError`.
216
- *
217
- * Prefer this over duck-typing on `error.code` directly so consumers stay
218
- * insulated from the envelope's internal shape.
219
- */
220
- declare function isRuntimeError(error: unknown): error is RuntimeErrorEnvelope;
221
- declare function runtimeError(code: string, message: string, details?: Record<string, unknown>): RuntimeErrorEnvelope;
222
- //#endregion
223
- export { type AfterExecuteResult, AsyncIterableResult, type ExecutionPlan, type QueryPlan, type ResultType, RuntimeCore, type RuntimeCoreOptions, type RuntimeErrorEnvelope, type RuntimeExecutor, type RuntimeLog, type RuntimeMiddleware, type RuntimeMiddlewareContext, checkMiddlewareCompatibility, isRuntimeError, runWithMiddleware, runtimeError };
308
+ export { type AfterExecuteResult, AsyncIterableResult, type ExecutionPlan, type QueryPlan, RUNTIME_ABORTED, type ResultType, type RuntimeAbortedPhase, RuntimeCore, type RuntimeCoreOptions, type RuntimeErrorEnvelope, type RuntimeExecuteOptions, type RuntimeExecutor, type RuntimeLog, type RuntimeMiddleware, type RuntimeMiddlewareContext, checkAborted, checkMiddlewareCompatibility, isRuntimeError, raceAgainstAbort, runWithMiddleware, runtimeAborted, runtimeError };
224
309
  //# sourceMappingURL=runtime.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/execution/async-iterable-result.ts","../src/execution/query-plan.ts","../src/execution/runtime-middleware.ts","../src/execution/run-with-middleware.ts","../src/execution/runtime-core.ts","../src/execution/runtime-error.ts"],"sourcesContent":[],"mappings":";;;cAEa,oCAAoC,cAAc,MAAM,YAAY;;;EAApE,QAAA,UAAA;EAAkD,QAAA,oBAAA;EAAkB,WAAA,CAAA,SAAA,EAMxD,cANwD,CAMzC,GANyC,EAAA,IAAA,EAAA,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EtBiB,oBAAA,SAA6B;;;ELEjC,SAAA,QAAA,EAAA,OAAmB;EAA+B,SAAA,OAAA,CAAA,EKE1C,MLF0C,CAAA,MAAA,EAAA,OAAA,CAAA;;;;;;;;AA6BlD,iBKlBG,cAAA,CLkBH,KAAA,EAAA,OAAA,CAAA,EAAA,KAAA,IKlB4C,oBLkB5C;AA+BY,iBKvCT,YAAA,CLuCS,IAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EKpCb,MLoCa,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,EKnCtB,oBLmCsB"}
1
+ {"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/execution/async-iterable-result.ts","../src/execution/query-plan.ts","../src/execution/runtime-error.ts","../src/execution/race-against-abort.ts","../src/execution/runtime-middleware.ts","../src/execution/run-with-middleware.ts","../src/execution/runtime-core.ts"],"sourcesContent":[],"mappings":";;;;cAEa,oCAAoC,cAAc,MAAM,YAAY;;;;EAApE,QAAA,oBAAmB;EAA+B,WAAA,CAAA,SAAA,EAMtC,cANsC,CAMvB,GANuB,EAAA,IAAA,EAAA,OAAA,CAAA;EAAkB,CAU9E,MAAA,CAAO,aAAA,GAVuE,EAUrD,aAVqD,CAUvC,GAVuC,CAAA;EAMzC,OAAA,CAAA,CAAA,EAuB3B,OAvB2B,CAuBnB,GAvBmB,EAAA,CAAA;EAAf,KAAA,CAAA,CAAA,EAsDR,OAtDQ,CAsDA,GAtDA,GAAA,IAAA,CAAA;EAIiB,YAAA,CAAA,CAAA,EAuDlB,OAvDkB,CAuDV,GAvDU,CAAA;EAAd,IAAA,CAAA,WAmEV,GAnEU,EAAA,EAAA,WAAA,KAAA,CAAA,CAAA,WAAA,CAAA,EAAA,CAAA,CAAA,KAAA,EAoED,GApEC,EAAA,EAAA,GAoES,QApET,GAoEoB,WApEpB,CAoEgC,QApEhC,CAAA,CAAA,GAAA,SAAA,GAAA,IAAA,EAAA,UAAA,CAAA,EAAA,CAAA,C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1EQ,EAAA,GAIzB,EEsE6B,gBFtEnB,CAAA,EEsEsC,KFtEtC,GEsE8C,OFtE9C,CEsEsD,KFtEtD,CAAA;EAGT;AAcjB;;;;;;;;;EAKoF,mBAAA,SAAA,CAAA,IAAA,EE4D/C,KF5D+C,CAAA,EE4DvC,aF5DuC,CE4DzB,MF5DyB,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA;EAE1E,SAAA,KAAA,CAAA,CAAA,EE4DU,OF5DV,CAAA,IAAA,CAAA;EACE,OAAA,CAAA,GAAA,CAAA,CAAA,IAAA,EE8DF,KF9DE,GAAA;IACH,SAAA,IAAA,CAAA,EE6D2B,GF7D3B;EACJ,CAAA,EAAA,OAAA,CAAA,EE6DS,qBF7DT,CAAA,EE8DA,mBF9DA,CE8DoB,GF9DpB,CAAA"}
package/dist/runtime.mjs CHANGED
@@ -1,5 +1,17 @@
1
1
  //#region src/execution/runtime-error.ts
2
2
  /**
3
+ * Stable code emitted by the runtime when an in-flight `execute()`
4
+ * is cancelled via the per-query `AbortSignal`. The envelope's
5
+ * `details.phase` distinguishes where the abort was observed:
6
+ *
7
+ * - `'encode'` — abort fired during `encodeParams` (SQL) or
8
+ * `resolveValue` (Mongo).
9
+ * - `'decode'` — abort fired during `decodeRow` / `decodeField`.
10
+ * - `'stream'` — abort fired between rows or before any codec call
11
+ * (already-aborted at entry).
12
+ */
13
+ const RUNTIME_ABORTED = "RUNTIME.ABORTED";
14
+ /**
3
15
  * Type guard for the runtime-error envelope produced by `runtimeError`.
4
16
  *
5
17
  * Prefer this over duck-typing on `error.code` directly so consumers stay
@@ -32,6 +44,17 @@ function resolveCategory(code) {
32
44
  default: return "RUNTIME";
33
45
  }
34
46
  }
47
+ /**
48
+ * Construct a `RUNTIME.ABORTED` envelope. Phase distinguishes where the
49
+ * abort was observed (encode / decode / stream); cause carries `signal.reason`
50
+ * verbatim from the platform — native abort produces a `DOMException`,
51
+ * explicit `controller.abort(reason)` produces whatever the caller passed.
52
+ * No synthesis happens here.
53
+ */
54
+ function runtimeAborted(phase, cause) {
55
+ const envelope = runtimeError(RUNTIME_ABORTED, `Operation aborted during ${phase}`, { phase });
56
+ return Object.assign(envelope, { cause });
57
+ }
35
58
 
36
59
  //#endregion
37
60
  //#region src/execution/async-iterable-result.ts
@@ -80,6 +103,75 @@ var AsyncIterableResult = class {
80
103
  }
81
104
  };
82
105
 
106
+ //#endregion
107
+ //#region src/execution/race-against-abort.ts
108
+ /**
109
+ * Throw a phase-tagged `RUNTIME.ABORTED` envelope if the supplied
110
+ * codec-call context is already aborted at the precheck site. Centralises
111
+ * the `if (ctx.signal?.aborted) throw runtimeAborted(...)` pattern that
112
+ * every codec dispatch site repeats.
113
+ */
114
+ function checkAborted(ctx, phase) {
115
+ if (ctx.signal?.aborted) throw runtimeAborted(phase, ctx.signal.reason);
116
+ }
117
+ /**
118
+ * Race a per-cell `Promise.all` (or any other in-flight work promise) against
119
+ * the supplied abort signal so the runtime returns `RUNTIME.ABORTED` promptly
120
+ * even when codec bodies ignore the signal. In-flight bodies that ignore the
121
+ * signal are abandoned and run to completion in the background — the
122
+ * cooperative-cancellation contract documented in ADR 204.
123
+ *
124
+ * Call sites still SHOULD pre-check `signal.aborted` and short-circuit with
125
+ * a phase-tagged `RUNTIME.ABORTED` envelope before invoking this helper —
126
+ * that path is the canonical "aborted at entry" surface and avoids
127
+ * scheduling the work promise. As a defensive belt-and-braces, this helper
128
+ * also handles the already-aborted case internally: `AbortSignal` does not
129
+ * replay past abort events to listeners registered after the abort, so we
130
+ * inspect `signal.aborted` synchronously and reject with the sentinel
131
+ * before installing the listener. The rejection is still attributed to the
132
+ * abort path via the sentinel-identity check.
133
+ *
134
+ * Distinguishing the rejection source is load-bearing for AC-ERR4
135
+ * (`RUNTIME.ENCODE_FAILED` / `RUNTIME.DECODE_FAILED` pass through unchanged).
136
+ * The semantically equivalent `abortable(signal)` helper in
137
+ * `@prisma-next/utils` rejects with `signal.reason ?? new DOMException(...)`,
138
+ * which is not stably distinguishable from a codec-thrown error by identity
139
+ * alone (a fresh fallback DOMException is allocated per call). We instead
140
+ * track abort attribution with a unique sentinel: only the `onAbort` listener
141
+ * installed here ever rejects with the sentinel, so an `error === sentinel`
142
+ * identity check after the race is unambiguous.
143
+ *
144
+ * Lives in `framework-components` (rather than the SQL family, where it
145
+ * originated in m2) so every family runtime that needs cooperative
146
+ * cancellation around a codec-dispatch `Promise.all` (SQL encode + decode
147
+ * today, Mongo encode in m3) shares the same attribution logic.
148
+ */
149
+ async function raceAgainstAbort(work, signal, phase) {
150
+ if (signal === void 0) return await work;
151
+ const sentinel = { reason: void 0 };
152
+ let onAbort;
153
+ const abortPromise = new Promise((_, reject) => {
154
+ if (signal.aborted) {
155
+ sentinel.reason = signal.reason;
156
+ reject(sentinel);
157
+ return;
158
+ }
159
+ onAbort = () => {
160
+ sentinel.reason = signal.reason;
161
+ reject(sentinel);
162
+ };
163
+ signal.addEventListener("abort", onAbort, { once: true });
164
+ });
165
+ try {
166
+ return await Promise.race([work, abortPromise]);
167
+ } catch (error) {
168
+ if (error === sentinel) throw runtimeAborted(phase, sentinel.reason);
169
+ throw error;
170
+ } finally {
171
+ if (onAbort) signal.removeEventListener("abort", onAbort);
172
+ }
173
+ }
174
+
83
175
  //#endregion
84
176
  //#region src/execution/run-with-middleware.ts
85
177
  /**
@@ -176,11 +268,14 @@ var RuntimeCore = class {
176
268
  runBeforeCompile(plan) {
177
269
  return plan;
178
270
  }
179
- execute(plan) {
271
+ execute(plan, options) {
180
272
  const self = this;
273
+ const signal = options?.signal;
274
+ const codecCtx = signal === void 0 ? {} : { signal };
181
275
  async function* generator() {
276
+ checkAborted(codecCtx, "stream");
182
277
  const compiled = await self.runBeforeCompile(plan);
183
- const exec = await self.lower(compiled);
278
+ const exec = await self.lower(compiled, codecCtx);
184
279
  yield* runWithMiddleware(exec, self.middleware, self.ctx, () => self.runDriver(exec));
185
280
  }
186
281
  return new AsyncIterableResult(generator());
@@ -207,5 +302,5 @@ function checkMiddlewareCompatibility(middleware, runtimeFamilyId, runtimeTarget
207
302
  }
208
303
 
209
304
  //#endregion
210
- export { AsyncIterableResult, RuntimeCore, checkMiddlewareCompatibility, isRuntimeError, runWithMiddleware, runtimeError };
305
+ export { AsyncIterableResult, RUNTIME_ABORTED, RuntimeCore, checkAborted, checkMiddlewareCompatibility, isRuntimeError, raceAgainstAbort, runWithMiddleware, runtimeAborted, runtimeError };
211
306
  //# sourceMappingURL=runtime.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.mjs","names":["out: Row[]","latencyMs"],"sources":["../src/execution/runtime-error.ts","../src/execution/async-iterable-result.ts","../src/execution/run-with-middleware.ts","../src/execution/runtime-core.ts","../src/execution/runtime-middleware.ts"],"sourcesContent":["export interface RuntimeErrorEnvelope extends Error {\n readonly code: string;\n readonly category: 'PLAN' | 'CONTRACT' | 'LINT' | 'BUDGET' | 'RUNTIME';\n readonly severity: 'error';\n readonly details?: Record<string, unknown>;\n}\n\n/**\n * Type guard for the runtime-error envelope produced by `runtimeError`.\n *\n * Prefer this over duck-typing on `error.code` directly so consumers stay\n * insulated from the envelope's internal shape.\n */\nexport function isRuntimeError(error: unknown): error is RuntimeErrorEnvelope {\n return (\n error instanceof Error &&\n 'code' in error &&\n typeof (error as { code?: unknown }).code === 'string' &&\n 'category' in error &&\n 'severity' in error\n );\n}\n\nexport function runtimeError(\n code: string,\n message: string,\n details?: Record<string, unknown>,\n): RuntimeErrorEnvelope {\n const error = new Error(message) as RuntimeErrorEnvelope;\n Object.defineProperty(error, 'name', {\n value: 'RuntimeError',\n configurable: true,\n });\n\n return Object.assign(error, {\n code,\n category: resolveCategory(code),\n severity: 'error' as const,\n message,\n details,\n });\n}\n\nfunction resolveCategory(code: string): RuntimeErrorEnvelope['category'] {\n const prefix = code.split('.')[0] ?? 'RUNTIME';\n switch (prefix) {\n case 'PLAN':\n case 'CONTRACT':\n case 'LINT':\n case 'BUDGET':\n return prefix;\n default:\n return 'RUNTIME';\n }\n}\n","import { runtimeError } from './runtime-error';\n\nexport class AsyncIterableResult<Row> implements AsyncIterable<Row>, PromiseLike<Row[]> {\n private readonly generator: AsyncGenerator<Row, void, unknown>;\n private consumed = false;\n private consumedBy: 'bufferedArray' | 'iterator' | undefined;\n private bufferedArrayPromise: Promise<Row[]> | undefined;\n\n constructor(generator: AsyncGenerator<Row, void, unknown>) {\n this.generator = generator;\n }\n\n [Symbol.asyncIterator](): AsyncIterator<Row> {\n if (this.consumed) {\n throw runtimeError(\n 'RUNTIME.ITERATOR_CONSUMED',\n `AsyncIterableResult iterator has already been consumed via ${this.consumedBy === 'bufferedArray' ? 'toArray()/then()' : 'for-await loop'}. Each AsyncIterableResult can only be iterated once.`,\n {\n consumedBy: this.consumedBy,\n suggestion:\n this.consumedBy === 'bufferedArray'\n ? 'If you need to iterate multiple times, store the results from toArray() in a variable and reuse that.'\n : 'If you need to iterate multiple times, use toArray() to collect all results first.',\n },\n );\n }\n this.consumed = true;\n this.consumedBy = 'iterator';\n return this.generator;\n }\n\n toArray(): Promise<Row[]> {\n if (this.consumedBy === 'iterator') {\n return Promise.reject(\n runtimeError(\n 'RUNTIME.ITERATOR_CONSUMED',\n 'AsyncIterableResult iterator has already been consumed via for-await loop. Each AsyncIterableResult can only be iterated once.',\n {\n consumedBy: this.consumedBy,\n suggestion:\n 'The iterator was already consumed by a for-await loop. Use toArray() or await the result before iterating.',\n },\n ),\n );\n }\n\n if (this.bufferedArrayPromise) {\n return this.bufferedArrayPromise;\n }\n\n this.consumed = true;\n this.consumedBy = 'bufferedArray';\n this.bufferedArrayPromise = (async () => {\n const out: Row[] = [];\n for await (const item of this.generator) {\n out.push(item);\n }\n return out;\n })();\n return this.bufferedArrayPromise;\n }\n\n async first(): Promise<Row | null> {\n const rows = await this.toArray();\n return rows[0] ?? null;\n }\n\n async firstOrThrow(): Promise<Row> {\n const row = await this.first();\n if (row === null)\n throw runtimeError(\n 'RUNTIME.NO_ROWS',\n 'Expected at least one row, but none were returned',\n {},\n );\n return row;\n }\n\n // biome-ignore lint/suspicious/noThenProperty: PromiseLike implementation is intentional for await support.\n then<TResult1 = Row[], TResult2 = never>(\n onfulfilled?: ((value: Row[]) => TResult1 | PromiseLike<TResult1>) | undefined | null,\n onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | undefined | null,\n ): PromiseLike<TResult1 | TResult2> {\n return this.toArray().then(onfulfilled, onrejected);\n }\n}\n","import { AsyncIterableResult } from './async-iterable-result';\nimport type { ExecutionPlan } from './query-plan';\nimport type { RuntimeMiddleware, RuntimeMiddlewareContext } from './runtime-middleware';\n\n/**\n * Drives a single execution of `runDriver()` through the middleware lifecycle.\n *\n * Lifecycle, in order:\n * 1. For each middleware in registration order: `beforeExecute(exec, ctx)`.\n * 2. For each row yielded by `runDriver()`: for each middleware in registration\n * order: `onRow(row, exec, ctx)`; then yield the row to the consumer.\n * 3. On successful completion: for each middleware in registration order:\n * `afterExecute(exec, { rowCount, latencyMs, completed: true }, ctx)`.\n * 4. On any error thrown by the driver loop: for each middleware in\n * registration order: `afterExecute(exec, { rowCount, latencyMs,\n * completed: false }, ctx)`. Errors thrown by `afterExecute` during the\n * error path are swallowed so they do not mask the original driver error.\n * The original error is then rethrown.\n *\n * This helper is the single canonical implementation of the middleware\n * orchestration loop; family runtimes should not reimplement it.\n */\nexport function runWithMiddleware<TExec extends ExecutionPlan, Row>(\n exec: TExec,\n middleware: ReadonlyArray<RuntimeMiddleware<TExec>>,\n ctx: RuntimeMiddlewareContext,\n runDriver: () => AsyncIterable<Row>,\n): AsyncIterableResult<Row> {\n const iterator = async function* (): AsyncGenerator<Row, void, unknown> {\n const startedAt = Date.now();\n let rowCount = 0;\n let completed = false;\n\n try {\n for (const mw of middleware) {\n if (mw.beforeExecute) {\n await mw.beforeExecute(exec, ctx);\n }\n }\n\n for await (const row of runDriver()) {\n for (const mw of middleware) {\n if (mw.onRow) {\n await mw.onRow(row as Record<string, unknown>, exec, ctx);\n }\n }\n rowCount++;\n yield row;\n }\n\n completed = true;\n } catch (error) {\n const latencyMs = Date.now() - startedAt;\n for (const mw of middleware) {\n if (mw.afterExecute) {\n try {\n await mw.afterExecute(exec, { rowCount, latencyMs, completed }, ctx);\n } catch {\n // Swallow afterExecute errors during the error path so they do not\n // mask the original driver error.\n }\n }\n }\n\n throw error;\n }\n\n const latencyMs = Date.now() - startedAt;\n for (const mw of middleware) {\n if (mw.afterExecute) {\n await mw.afterExecute(exec, { rowCount, latencyMs, completed }, ctx);\n }\n }\n };\n\n return new AsyncIterableResult(iterator());\n}\n","import { AsyncIterableResult } from './async-iterable-result';\nimport type { ExecutionPlan, QueryPlan } from './query-plan';\nimport { runWithMiddleware } from './run-with-middleware';\nimport type {\n RuntimeExecutor,\n RuntimeMiddleware,\n RuntimeMiddlewareContext,\n} from './runtime-middleware';\n\n/**\n * Constructor options shared by every concrete `RuntimeCore` subclass.\n *\n * Family runtimes typically build the middleware list and the\n * `RuntimeMiddlewareContext` themselves (running compatibility checks,\n * narrowing the context's `contract` field, etc.) before calling `super`.\n */\nexport interface RuntimeCoreOptions<TMiddleware extends RuntimeMiddleware<ExecutionPlan>> {\n readonly middleware: ReadonlyArray<TMiddleware>;\n readonly ctx: RuntimeMiddlewareContext;\n}\n\n/**\n * Family-agnostic abstract runtime base.\n *\n * Defines the entire `execute(plan)` template in one place:\n *\n * 1. `runBeforeCompile(plan)` — concrete; defaults to identity. SQL overrides\n * this to run its `beforeCompile` middleware-hook chain.\n * 2. `lower(plan)` — abstract. Each family produces its `*ExecutionPlan`\n * (SQL via `lowerSqlPlan`, Mongo via `adapter.lower`).\n * 3. `runWithMiddleware(exec, this.middleware, this.ctx,\n * () => runDriver(exec))` — concrete; lifts the middleware lifecycle\n * out of the family runtimes into the canonical helper.\n *\n * Concrete subclasses must implement `lower`, `runDriver`, and `close`.\n *\n * The class is generic over:\n * - `TPlan` — the family's pre-lowering plan type.\n * - `TExec` — the family's post-lowering (executable) plan type.\n * - `TMiddleware` — the family's middleware type. Constrained to\n * `RuntimeMiddleware<TExec>` because `runWithMiddleware` invokes the\n * `beforeExecute` / `onRow` / `afterExecute` hooks with the lowered\n * `TExec`. (The spec/plan wording \"RuntimeMiddleware<TPlan>\" is\n * tightened to `<TExec>` here so the helper call typechecks; the\n * intent is unchanged — middleware sees the post-lowering plan.)\n */\nexport abstract class RuntimeCore<\n TPlan extends QueryPlan,\n TExec extends ExecutionPlan,\n TMiddleware extends RuntimeMiddleware<TExec>,\n> implements RuntimeExecutor<TPlan>\n{\n protected readonly middleware: ReadonlyArray<TMiddleware>;\n protected readonly ctx: RuntimeMiddlewareContext;\n\n constructor(options: RuntimeCoreOptions<TMiddleware>) {\n this.middleware = options.middleware;\n this.ctx = options.ctx;\n }\n\n /**\n * Pre-lowering hook for plan rewriting. Defaults to identity. Subclasses\n * may override to run a `beforeCompile` middleware chain (SQL does this\n * to support typed AST rewrites — see `before-compile-chain.ts`).\n */\n protected runBeforeCompile(plan: TPlan): TPlan | Promise<TPlan> {\n return plan;\n }\n\n /**\n * Lower a pre-lowering `TPlan` into the family's executable `TExec`.\n * Family-specific: SQL produces `{ sql, params, ast?, ... }`; Mongo\n * produces `{ command, ... }`.\n */\n protected abstract lower(plan: TPlan): TExec | Promise<TExec>;\n\n /**\n * Drive the underlying transport for a lowered `TExec`. Yields raw rows\n * directly from the driver as `Record<string, unknown>`; codec decoding\n * (if any) is the subclass's responsibility, applied by wrapping\n * `execute()` rather than living inside this hook.\n *\n * The `Row` type parameter on `execute()` is satisfied by the caller via\n * the plan's phantom `_row`; the runtime treats rows as opaque records\n * here and trusts the caller's row typing.\n */\n protected abstract runDriver(exec: TExec): AsyncIterable<Record<string, unknown>>;\n\n abstract close(): Promise<void>;\n\n execute<Row>(plan: TPlan & { readonly _row?: Row }): AsyncIterableResult<Row> {\n const self = this;\n\n async function* generator(): AsyncGenerator<Row, void, unknown> {\n const compiled = await self.runBeforeCompile(plan);\n const exec = await self.lower(compiled);\n // The driver yields raw `Record<string, unknown>`; we cast to `Row` here.\n // The Row contract is enforced by the caller via `plan._row`.\n yield* runWithMiddleware<TExec, Row>(\n exec,\n self.middleware,\n self.ctx,\n () => self.runDriver(exec) as AsyncIterable<Row>,\n );\n }\n\n return new AsyncIterableResult(generator());\n }\n}\n","import type { AsyncIterableResult } from './async-iterable-result';\nimport type { QueryPlan } from './query-plan';\nimport { runtimeError } from './runtime-error';\n\nexport interface RuntimeLog {\n info(event: unknown): void;\n warn(event: unknown): void;\n error(event: unknown): void;\n debug?(event: unknown): void;\n}\n\nexport interface RuntimeMiddlewareContext {\n readonly contract: unknown;\n readonly mode: 'strict' | 'permissive';\n readonly now: () => number;\n readonly log: RuntimeLog;\n}\n\nexport interface AfterExecuteResult {\n readonly rowCount: number;\n readonly latencyMs: number;\n readonly completed: boolean;\n}\n\n/**\n * Family-agnostic middleware SPI parameterized over the plan marker.\n *\n * `TPlan` defaults to the framework `QueryPlan` marker so a generic\n * middleware (e.g. cross-family telemetry) can be authored without\n * naming a family. Family-specific middleware (`SqlMiddleware`,\n * `MongoMiddleware`) narrow `TPlan` to their concrete plan type.\n */\nexport interface RuntimeMiddleware<TPlan extends QueryPlan = QueryPlan> {\n readonly name: string;\n readonly familyId?: string;\n readonly targetId?: string;\n beforeExecute?(plan: TPlan, ctx: RuntimeMiddlewareContext): Promise<void>;\n onRow?(row: Record<string, unknown>, plan: TPlan, ctx: RuntimeMiddlewareContext): Promise<void>;\n afterExecute?(\n plan: TPlan,\n result: AfterExecuteResult,\n ctx: RuntimeMiddlewareContext,\n ): Promise<void>;\n}\n\n/**\n * Cross-family SPI for any runtime that can execute plans and be shut down.\n * Each family runtime (SQL, Mongo) satisfies this interface — SQL nominally,\n * Mongo structurally (due to its phantom Row parameter using a unique symbol).\n *\n * The `_row` intersection on `execute` connects the `Row` type parameter to the\n * plan, mirroring how `QueryPlan<Row>` carries a phantom `_row?: Row`.\n */\nexport interface RuntimeExecutor<TPlan extends QueryPlan> {\n execute<Row>(plan: TPlan & { readonly _row?: Row }): AsyncIterableResult<Row>;\n close(): Promise<void>;\n}\n\nexport function checkMiddlewareCompatibility(\n middleware: RuntimeMiddleware,\n runtimeFamilyId: string,\n runtimeTargetId: string,\n): void {\n if (middleware.targetId !== undefined && middleware.familyId === undefined) {\n throw runtimeError(\n 'RUNTIME.MIDDLEWARE_INCOMPATIBLE',\n `Middleware '${middleware.name}' specifies targetId '${middleware.targetId}' without familyId`,\n { middleware: middleware.name, targetId: middleware.targetId },\n );\n }\n\n if (middleware.familyId !== undefined && middleware.familyId !== runtimeFamilyId) {\n throw runtimeError(\n 'RUNTIME.MIDDLEWARE_FAMILY_MISMATCH',\n `Middleware '${middleware.name}' requires family '${middleware.familyId}' but the runtime is configured for family '${runtimeFamilyId}'`,\n { middleware: middleware.name, middlewareFamilyId: middleware.familyId, runtimeFamilyId },\n );\n }\n\n if (middleware.targetId !== undefined && middleware.targetId !== runtimeTargetId) {\n throw runtimeError(\n 'RUNTIME.MIDDLEWARE_TARGET_MISMATCH',\n `Middleware '${middleware.name}' requires target '${middleware.targetId}' but the runtime is configured for target '${runtimeTargetId}'`,\n { middleware: middleware.name, middlewareTargetId: middleware.targetId, runtimeTargetId },\n );\n }\n}\n"],"mappings":";;;;;;;AAaA,SAAgB,eAAe,OAA+C;AAC5E,QACE,iBAAiB,SACjB,UAAU,SACV,OAAQ,MAA6B,SAAS,YAC9C,cAAc,SACd,cAAc;;AAIlB,SAAgB,aACd,MACA,SACA,SACsB;CACtB,MAAM,QAAQ,IAAI,MAAM,QAAQ;AAChC,QAAO,eAAe,OAAO,QAAQ;EACnC,OAAO;EACP,cAAc;EACf,CAAC;AAEF,QAAO,OAAO,OAAO,OAAO;EAC1B;EACA,UAAU,gBAAgB,KAAK;EAC/B,UAAU;EACV;EACA;EACD,CAAC;;AAGJ,SAAS,gBAAgB,MAAgD;CACvE,MAAM,SAAS,KAAK,MAAM,IAAI,CAAC,MAAM;AACrC,SAAQ,QAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,SACH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Aa,UAAa,WAAW,aAAa,gBAC/D,OAAM,aACJ,sCACA,eAAe,WAAW,KAAK,qBAAqB,WAAW,SAAS,8CAA8C,gBAAgB,IACtI;EAAE,YAAY,WAAW;EAAM,oBAAoB,WAAW;EAAU;EAAiB,CAC1F;AAGH,KAAI,WAAW,aAAa,UAAa,WAAW,aAAa,gBAC/D,OAAM,aACJ,sCACA,eAAe,WAAW,KAAK,qBAAqB,WAAW,SAAS,8CAA8C,gBAAgB,IACtI;EAAE,YAAY,WAAW;EAAM,oBAAoB,WAAW;EAAU;EAAiB,CAC1F"}
1
+ {"version":3,"file":"runtime.mjs","names":["out: Row[]","sentinel: { reason: unknown }","onAbort: (() => void) | undefined","latencyMs","codecCtx: CodecCallContext"],"sources":["../src/execution/runtime-error.ts","../src/execution/async-iterable-result.ts","../src/execution/race-against-abort.ts","../src/execution/run-with-middleware.ts","../src/execution/runtime-core.ts","../src/execution/runtime-middleware.ts"],"sourcesContent":["export interface RuntimeErrorEnvelope extends Error {\n readonly code: string;\n readonly category: 'PLAN' | 'CONTRACT' | 'LINT' | 'BUDGET' | 'RUNTIME';\n readonly severity: 'error';\n readonly details?: Record<string, unknown>;\n}\n\n/**\n * Stable code emitted by the runtime when an in-flight `execute()`\n * is cancelled via the per-query `AbortSignal`. The envelope's\n * `details.phase` distinguishes where the abort was observed:\n *\n * - `'encode'` — abort fired during `encodeParams` (SQL) or\n * `resolveValue` (Mongo).\n * - `'decode'` — abort fired during `decodeRow` / `decodeField`.\n * - `'stream'` — abort fired between rows or before any codec call\n * (already-aborted at entry).\n */\nexport const RUNTIME_ABORTED = 'RUNTIME.ABORTED' as const;\n\n/** Discriminator placed in `details.phase` of a `RUNTIME.ABORTED` envelope. */\nexport type RuntimeAbortedPhase = 'encode' | 'decode' | 'stream';\n\n/**\n * Type guard for the runtime-error envelope produced by `runtimeError`.\n *\n * Prefer this over duck-typing on `error.code` directly so consumers stay\n * insulated from the envelope's internal shape.\n */\nexport function isRuntimeError(error: unknown): error is RuntimeErrorEnvelope {\n return (\n error instanceof Error &&\n 'code' in error &&\n typeof (error as { code?: unknown }).code === 'string' &&\n 'category' in error &&\n 'severity' in error\n );\n}\n\nexport function runtimeError(\n code: string,\n message: string,\n details?: Record<string, unknown>,\n): RuntimeErrorEnvelope {\n const error = new Error(message) as RuntimeErrorEnvelope;\n Object.defineProperty(error, 'name', {\n value: 'RuntimeError',\n configurable: true,\n });\n\n return Object.assign(error, {\n code,\n category: resolveCategory(code),\n severity: 'error' as const,\n message,\n details,\n });\n}\n\nfunction resolveCategory(code: string): RuntimeErrorEnvelope['category'] {\n const prefix = code.split('.')[0] ?? 'RUNTIME';\n switch (prefix) {\n case 'PLAN':\n case 'CONTRACT':\n case 'LINT':\n case 'BUDGET':\n return prefix;\n default:\n return 'RUNTIME';\n }\n}\n\n/**\n * Construct a `RUNTIME.ABORTED` envelope. Phase distinguishes where the\n * abort was observed (encode / decode / stream); cause carries `signal.reason`\n * verbatim from the platform — native abort produces a `DOMException`,\n * explicit `controller.abort(reason)` produces whatever the caller passed.\n * No synthesis happens here.\n */\nexport function runtimeAborted(phase: RuntimeAbortedPhase, cause?: unknown): RuntimeErrorEnvelope {\n const envelope = runtimeError(RUNTIME_ABORTED, `Operation aborted during ${phase}`, { phase });\n return Object.assign(envelope, { cause });\n}\n","import { runtimeError } from './runtime-error';\n\nexport class AsyncIterableResult<Row> implements AsyncIterable<Row>, PromiseLike<Row[]> {\n private readonly generator: AsyncGenerator<Row, void, unknown>;\n private consumed = false;\n private consumedBy: 'bufferedArray' | 'iterator' | undefined;\n private bufferedArrayPromise: Promise<Row[]> | undefined;\n\n constructor(generator: AsyncGenerator<Row, void, unknown>) {\n this.generator = generator;\n }\n\n [Symbol.asyncIterator](): AsyncIterator<Row> {\n if (this.consumed) {\n throw runtimeError(\n 'RUNTIME.ITERATOR_CONSUMED',\n `AsyncIterableResult iterator has already been consumed via ${this.consumedBy === 'bufferedArray' ? 'toArray()/then()' : 'for-await loop'}. Each AsyncIterableResult can only be iterated once.`,\n {\n consumedBy: this.consumedBy,\n suggestion:\n this.consumedBy === 'bufferedArray'\n ? 'If you need to iterate multiple times, store the results from toArray() in a variable and reuse that.'\n : 'If you need to iterate multiple times, use toArray() to collect all results first.',\n },\n );\n }\n this.consumed = true;\n this.consumedBy = 'iterator';\n return this.generator;\n }\n\n toArray(): Promise<Row[]> {\n if (this.consumedBy === 'iterator') {\n return Promise.reject(\n runtimeError(\n 'RUNTIME.ITERATOR_CONSUMED',\n 'AsyncIterableResult iterator has already been consumed via for-await loop. Each AsyncIterableResult can only be iterated once.',\n {\n consumedBy: this.consumedBy,\n suggestion:\n 'The iterator was already consumed by a for-await loop. Use toArray() or await the result before iterating.',\n },\n ),\n );\n }\n\n if (this.bufferedArrayPromise) {\n return this.bufferedArrayPromise;\n }\n\n this.consumed = true;\n this.consumedBy = 'bufferedArray';\n this.bufferedArrayPromise = (async () => {\n const out: Row[] = [];\n for await (const item of this.generator) {\n out.push(item);\n }\n return out;\n })();\n return this.bufferedArrayPromise;\n }\n\n async first(): Promise<Row | null> {\n const rows = await this.toArray();\n return rows[0] ?? null;\n }\n\n async firstOrThrow(): Promise<Row> {\n const row = await this.first();\n if (row === null)\n throw runtimeError(\n 'RUNTIME.NO_ROWS',\n 'Expected at least one row, but none were returned',\n {},\n );\n return row;\n }\n\n // biome-ignore lint/suspicious/noThenProperty: PromiseLike implementation is intentional for await support.\n then<TResult1 = Row[], TResult2 = never>(\n onfulfilled?: ((value: Row[]) => TResult1 | PromiseLike<TResult1>) | undefined | null,\n onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | undefined | null,\n ): PromiseLike<TResult1 | TResult2> {\n return this.toArray().then(onfulfilled, onrejected);\n }\n}\n","import type { CodecCallContext } from '../shared/codec-types';\nimport type { RuntimeAbortedPhase } from './runtime-error';\nimport { runtimeAborted } from './runtime-error';\n\n/**\n * Throw a phase-tagged `RUNTIME.ABORTED` envelope if the supplied\n * codec-call context is already aborted at the precheck site. Centralises\n * the `if (ctx.signal?.aborted) throw runtimeAborted(...)` pattern that\n * every codec dispatch site repeats.\n */\nexport function checkAborted(ctx: CodecCallContext, phase: RuntimeAbortedPhase): void {\n if (ctx.signal?.aborted) {\n throw runtimeAborted(phase, ctx.signal.reason);\n }\n}\n\n/**\n * Race a per-cell `Promise.all` (or any other in-flight work promise) against\n * the supplied abort signal so the runtime returns `RUNTIME.ABORTED` promptly\n * even when codec bodies ignore the signal. In-flight bodies that ignore the\n * signal are abandoned and run to completion in the background — the\n * cooperative-cancellation contract documented in ADR 204.\n *\n * Call sites still SHOULD pre-check `signal.aborted` and short-circuit with\n * a phase-tagged `RUNTIME.ABORTED` envelope before invoking this helper —\n * that path is the canonical \"aborted at entry\" surface and avoids\n * scheduling the work promise. As a defensive belt-and-braces, this helper\n * also handles the already-aborted case internally: `AbortSignal` does not\n * replay past abort events to listeners registered after the abort, so we\n * inspect `signal.aborted` synchronously and reject with the sentinel\n * before installing the listener. The rejection is still attributed to the\n * abort path via the sentinel-identity check.\n *\n * Distinguishing the rejection source is load-bearing for AC-ERR4\n * (`RUNTIME.ENCODE_FAILED` / `RUNTIME.DECODE_FAILED` pass through unchanged).\n * The semantically equivalent `abortable(signal)` helper in\n * `@prisma-next/utils` rejects with `signal.reason ?? new DOMException(...)`,\n * which is not stably distinguishable from a codec-thrown error by identity\n * alone (a fresh fallback DOMException is allocated per call). We instead\n * track abort attribution with a unique sentinel: only the `onAbort` listener\n * installed here ever rejects with the sentinel, so an `error === sentinel`\n * identity check after the race is unambiguous.\n *\n * Lives in `framework-components` (rather than the SQL family, where it\n * originated in m2) so every family runtime that needs cooperative\n * cancellation around a codec-dispatch `Promise.all` (SQL encode + decode\n * today, Mongo encode in m3) shares the same attribution logic.\n */\nexport async function raceAgainstAbort<T>(\n work: Promise<T>,\n signal: AbortSignal | undefined,\n phase: RuntimeAbortedPhase,\n): Promise<T> {\n if (signal === undefined) {\n return await work;\n }\n const sentinel: { reason: unknown } = { reason: undefined };\n let onAbort: (() => void) | undefined;\n\n const abortPromise = new Promise<never>((_, reject) => {\n if (signal.aborted) {\n sentinel.reason = signal.reason;\n reject(sentinel);\n return;\n }\n onAbort = () => {\n sentinel.reason = signal.reason;\n reject(sentinel);\n };\n signal.addEventListener('abort', onAbort, { once: true });\n });\n\n try {\n return await Promise.race([work, abortPromise]);\n } catch (error) {\n if (error === sentinel) {\n throw runtimeAborted(phase, sentinel.reason);\n }\n throw error;\n } finally {\n if (onAbort) {\n signal.removeEventListener('abort', onAbort);\n }\n }\n}\n","import { AsyncIterableResult } from './async-iterable-result';\nimport type { ExecutionPlan } from './query-plan';\nimport type { RuntimeMiddleware, RuntimeMiddlewareContext } from './runtime-middleware';\n\n/**\n * Drives a single execution of `runDriver()` through the middleware lifecycle.\n *\n * Lifecycle, in order:\n * 1. For each middleware in registration order: `beforeExecute(exec, ctx)`.\n * 2. For each row yielded by `runDriver()`: for each middleware in registration\n * order: `onRow(row, exec, ctx)`; then yield the row to the consumer.\n * 3. On successful completion: for each middleware in registration order:\n * `afterExecute(exec, { rowCount, latencyMs, completed: true }, ctx)`.\n * 4. On any error thrown by the driver loop: for each middleware in\n * registration order: `afterExecute(exec, { rowCount, latencyMs,\n * completed: false }, ctx)`. Errors thrown by `afterExecute` during the\n * error path are swallowed so they do not mask the original driver error.\n * The original error is then rethrown.\n *\n * This helper is the single canonical implementation of the middleware\n * orchestration loop; family runtimes should not reimplement it.\n */\nexport function runWithMiddleware<TExec extends ExecutionPlan, Row>(\n exec: TExec,\n middleware: ReadonlyArray<RuntimeMiddleware<TExec>>,\n ctx: RuntimeMiddlewareContext,\n runDriver: () => AsyncIterable<Row>,\n): AsyncIterableResult<Row> {\n const iterator = async function* (): AsyncGenerator<Row, void, unknown> {\n const startedAt = Date.now();\n let rowCount = 0;\n let completed = false;\n\n try {\n for (const mw of middleware) {\n if (mw.beforeExecute) {\n await mw.beforeExecute(exec, ctx);\n }\n }\n\n for await (const row of runDriver()) {\n for (const mw of middleware) {\n if (mw.onRow) {\n await mw.onRow(row as Record<string, unknown>, exec, ctx);\n }\n }\n rowCount++;\n yield row;\n }\n\n completed = true;\n } catch (error) {\n const latencyMs = Date.now() - startedAt;\n for (const mw of middleware) {\n if (mw.afterExecute) {\n try {\n await mw.afterExecute(exec, { rowCount, latencyMs, completed }, ctx);\n } catch {\n // Swallow afterExecute errors during the error path so they do not\n // mask the original driver error.\n }\n }\n }\n\n throw error;\n }\n\n const latencyMs = Date.now() - startedAt;\n for (const mw of middleware) {\n if (mw.afterExecute) {\n await mw.afterExecute(exec, { rowCount, latencyMs, completed }, ctx);\n }\n }\n };\n\n return new AsyncIterableResult(iterator());\n}\n","import type { CodecCallContext } from '../shared/codec-types';\nimport { AsyncIterableResult } from './async-iterable-result';\nimport type { ExecutionPlan, QueryPlan } from './query-plan';\nimport { checkAborted } from './race-against-abort';\nimport { runWithMiddleware } from './run-with-middleware';\nimport type {\n RuntimeExecuteOptions,\n RuntimeExecutor,\n RuntimeMiddleware,\n RuntimeMiddlewareContext,\n} from './runtime-middleware';\n\n/**\n * Constructor options shared by every concrete `RuntimeCore` subclass.\n *\n * Family runtimes typically build the middleware list and the\n * `RuntimeMiddlewareContext` themselves (running compatibility checks,\n * narrowing the context's `contract` field, etc.) before calling `super`.\n */\nexport interface RuntimeCoreOptions<TMiddleware extends RuntimeMiddleware<ExecutionPlan>> {\n readonly middleware: ReadonlyArray<TMiddleware>;\n readonly ctx: RuntimeMiddlewareContext;\n}\n\n/**\n * Family-agnostic abstract runtime base.\n *\n * Defines the entire `execute(plan)` template in one place:\n *\n * 1. `runBeforeCompile(plan)` — concrete; defaults to identity. SQL overrides\n * this to run its `beforeCompile` middleware-hook chain.\n * 2. `lower(plan)` — abstract. Each family produces its `*ExecutionPlan`\n * (SQL via `lowerSqlPlan`, Mongo via `adapter.lower`).\n * 3. `runWithMiddleware(exec, this.middleware, this.ctx,\n * () => runDriver(exec))` — concrete; lifts the middleware lifecycle\n * out of the family runtimes into the canonical helper.\n *\n * Concrete subclasses must implement `lower`, `runDriver`, and `close`.\n *\n * The class is generic over:\n * - `TPlan` — the family's pre-lowering plan type.\n * - `TExec` — the family's post-lowering (executable) plan type.\n * - `TMiddleware` — the family's middleware type. Constrained to\n * `RuntimeMiddleware<TExec>` because `runWithMiddleware` invokes the\n * `beforeExecute` / `onRow` / `afterExecute` hooks with the lowered\n * `TExec`. (The spec/plan wording \"RuntimeMiddleware<TPlan>\" is\n * tightened to `<TExec>` here so the helper call typechecks; the\n * intent is unchanged — middleware sees the post-lowering plan.)\n */\nexport abstract class RuntimeCore<\n TPlan extends QueryPlan,\n TExec extends ExecutionPlan,\n TMiddleware extends RuntimeMiddleware<TExec>,\n> implements RuntimeExecutor<TPlan>\n{\n protected readonly middleware: ReadonlyArray<TMiddleware>;\n protected readonly ctx: RuntimeMiddlewareContext;\n\n constructor(options: RuntimeCoreOptions<TMiddleware>) {\n this.middleware = options.middleware;\n this.ctx = options.ctx;\n }\n\n /**\n * Pre-lowering hook for plan rewriting. Defaults to identity. Subclasses\n * may override to run a `beforeCompile` middleware chain (SQL does this\n * to support typed AST rewrites — see `before-compile-chain.ts`).\n */\n protected runBeforeCompile(plan: TPlan): TPlan | Promise<TPlan> {\n return plan;\n }\n\n /**\n * Lower a pre-lowering `TPlan` into the family's executable `TExec`.\n * Family-specific: SQL produces `{ sql, params, ast?, ... }`; Mongo\n * produces `{ command, ... }`.\n *\n * `ctx` carries per-query cancellation (and any future fields on\n * `CodecCallContext`); concrete subclasses forward it to the\n * encode-side codec dispatch site (e.g. SQL's `encodeParams` in m2,\n * Mongo's `resolveValue` in m3). The runtime allocates one ctx per\n * `execute()` call and threads the same reference everywhere; the\n * `signal` field inside may be `undefined`, but the ctx object itself\n * is always present.\n */\n protected abstract lower(plan: TPlan, ctx: CodecCallContext): TExec | Promise<TExec>;\n\n /**\n * Drive the underlying transport for a lowered `TExec`. Yields raw rows\n * directly from the driver as `Record<string, unknown>`; codec decoding\n * (if any) is the subclass's responsibility, applied by wrapping\n * `execute()` rather than living inside this hook.\n *\n * The `Row` type parameter on `execute()` is satisfied by the caller via\n * the plan's phantom `_row`; the runtime treats rows as opaque records\n * here and trusts the caller's row typing.\n */\n protected abstract runDriver(exec: TExec): AsyncIterable<Record<string, unknown>>;\n\n abstract close(): Promise<void>;\n\n execute<Row>(\n plan: TPlan & { readonly _row?: Row },\n options?: RuntimeExecuteOptions,\n ): AsyncIterableResult<Row> {\n const self = this;\n const signal = options?.signal;\n // One ctx per execute() call. The ctx object is always allocated; the\n // `signal` field is only included when a signal was supplied (required\n // under exactOptionalPropertyTypes — `{ signal: undefined }` would not\n // satisfy `signal?: AbortSignal`).\n const codecCtx: CodecCallContext = signal === undefined ? {} : { signal };\n\n async function* generator(): AsyncGenerator<Row, void, unknown> {\n // Pre-check the signal at entry so an already-aborted caller observes\n // RUNTIME.ABORTED on the first `next()` without any work being done.\n checkAborted(codecCtx, 'stream');\n\n const compiled = await self.runBeforeCompile(plan);\n const exec = await self.lower(compiled, codecCtx);\n // The driver yields raw `Record<string, unknown>`; we cast to `Row` here.\n // The Row contract is enforced by the caller via `plan._row`.\n yield* runWithMiddleware<TExec, Row>(\n exec,\n self.middleware,\n self.ctx,\n () => self.runDriver(exec) as AsyncIterable<Row>,\n );\n }\n\n return new AsyncIterableResult(generator());\n }\n}\n","import type { AsyncIterableResult } from './async-iterable-result';\nimport type { QueryPlan } from './query-plan';\nimport { runtimeError } from './runtime-error';\n\nexport interface RuntimeLog {\n info(event: unknown): void;\n warn(event: unknown): void;\n error(event: unknown): void;\n debug?(event: unknown): void;\n}\n\nexport interface RuntimeMiddlewareContext {\n readonly contract: unknown;\n readonly mode: 'strict' | 'permissive';\n readonly now: () => number;\n readonly log: RuntimeLog;\n}\n\nexport interface AfterExecuteResult {\n readonly rowCount: number;\n readonly latencyMs: number;\n readonly completed: boolean;\n}\n\n/**\n * Family-agnostic middleware SPI parameterized over the plan marker.\n *\n * `TPlan` defaults to the framework `QueryPlan` marker so a generic\n * middleware (e.g. cross-family telemetry) can be authored without\n * naming a family. Family-specific middleware (`SqlMiddleware`,\n * `MongoMiddleware`) narrow `TPlan` to their concrete plan type.\n */\nexport interface RuntimeMiddleware<TPlan extends QueryPlan = QueryPlan> {\n readonly name: string;\n readonly familyId?: string;\n readonly targetId?: string;\n beforeExecute?(plan: TPlan, ctx: RuntimeMiddlewareContext): Promise<void>;\n onRow?(row: Record<string, unknown>, plan: TPlan, ctx: RuntimeMiddlewareContext): Promise<void>;\n afterExecute?(\n plan: TPlan,\n result: AfterExecuteResult,\n ctx: RuntimeMiddlewareContext,\n ): Promise<void>;\n}\n\n/**\n * Optional per-`execute` options accepted by every family runtime.\n *\n * `signal` is the per-query cancellation signal. The runtime threads the\n * signal through to every codec call for the query and uses it to short-\n * circuit the row stream with `RUNTIME.ABORTED` when the caller aborts.\n * Omitting the option (or passing `undefined`) preserves today's behavior\n * bit-for-bit.\n */\nexport interface RuntimeExecuteOptions {\n readonly signal?: AbortSignal;\n}\n\n/**\n * Cross-family SPI for any runtime that can execute plans and be shut down.\n * Each family runtime (SQL, Mongo) satisfies this interface — SQL nominally,\n * Mongo structurally (due to its phantom Row parameter using a unique symbol).\n *\n * The `_row` intersection on `execute` connects the `Row` type parameter to the\n * plan, mirroring how `QueryPlan<Row>` carries a phantom `_row?: Row`.\n */\nexport interface RuntimeExecutor<TPlan extends QueryPlan> {\n execute<Row>(\n plan: TPlan & { readonly _row?: Row },\n options?: RuntimeExecuteOptions,\n ): AsyncIterableResult<Row>;\n close(): Promise<void>;\n}\n\nexport function checkMiddlewareCompatibility(\n middleware: RuntimeMiddleware,\n runtimeFamilyId: string,\n runtimeTargetId: string,\n): void {\n if (middleware.targetId !== undefined && middleware.familyId === undefined) {\n throw runtimeError(\n 'RUNTIME.MIDDLEWARE_INCOMPATIBLE',\n `Middleware '${middleware.name}' specifies targetId '${middleware.targetId}' without familyId`,\n { middleware: middleware.name, targetId: middleware.targetId },\n );\n }\n\n if (middleware.familyId !== undefined && middleware.familyId !== runtimeFamilyId) {\n throw runtimeError(\n 'RUNTIME.MIDDLEWARE_FAMILY_MISMATCH',\n `Middleware '${middleware.name}' requires family '${middleware.familyId}' but the runtime is configured for family '${runtimeFamilyId}'`,\n { middleware: middleware.name, middlewareFamilyId: middleware.familyId, runtimeFamilyId },\n );\n }\n\n if (middleware.targetId !== undefined && middleware.targetId !== runtimeTargetId) {\n throw runtimeError(\n 'RUNTIME.MIDDLEWARE_TARGET_MISMATCH',\n `Middleware '${middleware.name}' requires target '${middleware.targetId}' but the runtime is configured for target '${runtimeTargetId}'`,\n { middleware: middleware.name, middlewareTargetId: middleware.targetId, runtimeTargetId },\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAa,kBAAkB;;;;;;;AAW/B,SAAgB,eAAe,OAA+C;AAC5E,QACE,iBAAiB,SACjB,UAAU,SACV,OAAQ,MAA6B,SAAS,YAC9C,cAAc,SACd,cAAc;;AAIlB,SAAgB,aACd,MACA,SACA,SACsB;CACtB,MAAM,QAAQ,IAAI,MAAM,QAAQ;AAChC,QAAO,eAAe,OAAO,QAAQ;EACnC,OAAO;EACP,cAAc;EACf,CAAC;AAEF,QAAO,OAAO,OAAO,OAAO;EAC1B;EACA,UAAU,gBAAgB,KAAK;EAC/B,UAAU;EACV;EACA;EACD,CAAC;;AAGJ,SAAS,gBAAgB,MAAgD;CACvE,MAAM,SAAS,KAAK,MAAM,IAAI,CAAC,MAAM;AACrC,SAAQ,QAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,SACH,QAAO;EACT,QACE,QAAO;;;;;;;;;;AAWb,SAAgB,eAAe,OAA4B,OAAuC;CAChG,MAAM,WAAW,aAAa,iBAAiB,4BAA4B,SAAS,EAAE,OAAO,CAAC;AAC9F,QAAO,OAAO,OAAO,UAAU,EAAE,OAAO,CAAC;;;;;AC/E3C,IAAa,sBAAb,MAAwF;CACtF,AAAiB;CACjB,AAAQ,WAAW;CACnB,AAAQ;CACR,AAAQ;CAER,Y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C;AACpD,OAAK,aAAa,QAAQ;AAC1B,OAAK,MAAM,QAAQ;;;;;;;CAQrB,AAAU,iBAAiB,MAAqC;AAC9D,SAAO;;CAgCT,QACE,MACA,SAC0B;EAC1B,MAAM,OAAO;EACb,MAAM,SAAS,SAAS;EAKxB,MAAMC,WAA6B,WAAW,SAAY,EAAE,GAAG,EAAE,QAAQ;EAEzE,gBAAgB,YAAgD;AAG9D,gBAAa,UAAU,SAAS;GAEhC,MAAM,WAAW,MAAM,KAAK,iBAAiB,KAAK;GAClD,MAAM,OAAO,MAAM,KAAK,MAAM,UAAU,SAAS;AAGjD,UAAO,kBACL,MACA,KAAK,YACL,KAAK,WACC,KAAK,UAAU,KAAK,CAC3B;;AAGH,SAAO,IAAI,oBAAoB,WAAW,CAAC;;;;;;ACxD/C,SAAgB,6BACd,YACA,iBACA,iBACM;AACN,KAAI,WAAW,aAAa,UAAa,WAAW,aAAa,OAC/D,OAAM,aACJ,mCACA,eAAe,WAAW,KAAK,wBAAwB,WAAW,SAAS,qBAC3E;EAAE,YAAY,WAAW;EAAM,UAAU,WAAW;EAAU,CAC/D;AAGH,KAAI,WAAW,aAAa,UAAa,WAAW,aAAa,gBAC/D,OAAM,aACJ,sCACA,eAAe,WAAW,KAAK,qBAAqB,WAAW,SAAS,8CAA8C,gBAAgB,IACtI;EAAE,YAAY,WAAW;EAAM,oBAAoB,WAAW;EAAU;EAAiB,CAC1F;AAGH,KAAI,WAAW,aAAa,UAAa,WAAW,aAAa,gBAC/D,OAAM,aACJ,sCACA,eAAe,WAAW,KAAK,qBAAqB,WAAW,SAAS,8CAA8C,gBAAgB,IACtI;EAAE,YAAY,WAAW;EAAM,oBAAoB,WAAW;EAAU;EAAiB,CAC1F"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@prisma-next/framework-components",
3
- "version": "0.5.0-dev.28",
3
+ "version": "0.5.0-dev.29",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Framework component types, assembly logic, and stack creation for Prisma Next",
7
7
  "dependencies": {
8
- "@prisma-next/operations": "0.5.0-dev.28",
9
- "@prisma-next/utils": "0.5.0-dev.28",
10
- "@prisma-next/contract": "0.5.0-dev.28"
8
+ "@prisma-next/contract": "0.5.0-dev.29",
9
+ "@prisma-next/operations": "0.5.0-dev.29",
10
+ "@prisma-next/utils": "0.5.0-dev.29"
11
11
  },
12
12
  "devDependencies": {
13
13
  "tsdown": "0.18.4",
@@ -0,0 +1,85 @@
1
+ import type { CodecCallContext } from '../shared/codec-types';
2
+ import type { RuntimeAbortedPhase } from './runtime-error';
3
+ import { runtimeAborted } from './runtime-error';
4
+
5
+ /**
6
+ * Throw a phase-tagged `RUNTIME.ABORTED` envelope if the supplied
7
+ * codec-call context is already aborted at the precheck site. Centralises
8
+ * the `if (ctx.signal?.aborted) throw runtimeAborted(...)` pattern that
9
+ * every codec dispatch site repeats.
10
+ */
11
+ export function checkAborted(ctx: CodecCallContext, phase: RuntimeAbortedPhase): void {
12
+ if (ctx.signal?.aborted) {
13
+ throw runtimeAborted(phase, ctx.signal.reason);
14
+ }
15
+ }
16
+
17
+ /**
18
+ * Race a per-cell `Promise.all` (or any other in-flight work promise) against
19
+ * the supplied abort signal so the runtime returns `RUNTIME.ABORTED` promptly
20
+ * even when codec bodies ignore the signal. In-flight bodies that ignore the
21
+ * signal are abandoned and run to completion in the background — the
22
+ * cooperative-cancellation contract documented in ADR 204.
23
+ *
24
+ * Call sites still SHOULD pre-check `signal.aborted` and short-circuit with
25
+ * a phase-tagged `RUNTIME.ABORTED` envelope before invoking this helper —
26
+ * that path is the canonical "aborted at entry" surface and avoids
27
+ * scheduling the work promise. As a defensive belt-and-braces, this helper
28
+ * also handles the already-aborted case internally: `AbortSignal` does not
29
+ * replay past abort events to listeners registered after the abort, so we
30
+ * inspect `signal.aborted` synchronously and reject with the sentinel
31
+ * before installing the listener. The rejection is still attributed to the
32
+ * abort path via the sentinel-identity check.
33
+ *
34
+ * Distinguishing the rejection source is load-bearing for AC-ERR4
35
+ * (`RUNTIME.ENCODE_FAILED` / `RUNTIME.DECODE_FAILED` pass through unchanged).
36
+ * The semantically equivalent `abortable(signal)` helper in
37
+ * `@prisma-next/utils` rejects with `signal.reason ?? new DOMException(...)`,
38
+ * which is not stably distinguishable from a codec-thrown error by identity
39
+ * alone (a fresh fallback DOMException is allocated per call). We instead
40
+ * track abort attribution with a unique sentinel: only the `onAbort` listener
41
+ * installed here ever rejects with the sentinel, so an `error === sentinel`
42
+ * identity check after the race is unambiguous.
43
+ *
44
+ * Lives in `framework-components` (rather than the SQL family, where it
45
+ * originated in m2) so every family runtime that needs cooperative
46
+ * cancellation around a codec-dispatch `Promise.all` (SQL encode + decode
47
+ * today, Mongo encode in m3) shares the same attribution logic.
48
+ */
49
+ export async function raceAgainstAbort<T>(
50
+ work: Promise<T>,
51
+ signal: AbortSignal | undefined,
52
+ phase: RuntimeAbortedPhase,
53
+ ): Promise<T> {
54
+ if (signal === undefined) {
55
+ return await work;
56
+ }
57
+ const sentinel: { reason: unknown } = { reason: undefined };
58
+ let onAbort: (() => void) | undefined;
59
+
60
+ const abortPromise = new Promise<never>((_, reject) => {
61
+ if (signal.aborted) {
62
+ sentinel.reason = signal.reason;
63
+ reject(sentinel);
64
+ return;
65
+ }
66
+ onAbort = () => {
67
+ sentinel.reason = signal.reason;
68
+ reject(sentinel);
69
+ };
70
+ signal.addEventListener('abort', onAbort, { once: true });
71
+ });
72
+
73
+ try {
74
+ return await Promise.race([work, abortPromise]);
75
+ } catch (error) {
76
+ if (error === sentinel) {
77
+ throw runtimeAborted(phase, sentinel.reason);
78
+ }
79
+ throw error;
80
+ } finally {
81
+ if (onAbort) {
82
+ signal.removeEventListener('abort', onAbort);
83
+ }
84
+ }
85
+ }
@@ -1,7 +1,10 @@
1
+ import type { CodecCallContext } from '../shared/codec-types';
1
2
  import { AsyncIterableResult } from './async-iterable-result';
2
3
  import type { ExecutionPlan, QueryPlan } from './query-plan';
4
+ import { checkAborted } from './race-against-abort';
3
5
  import { runWithMiddleware } from './run-with-middleware';
4
6
  import type {
7
+ RuntimeExecuteOptions,
5
8
  RuntimeExecutor,
6
9
  RuntimeMiddleware,
7
10
  RuntimeMiddlewareContext,
@@ -71,8 +74,16 @@ export abstract class RuntimeCore<
71
74
  * Lower a pre-lowering `TPlan` into the family's executable `TExec`.
72
75
  * Family-specific: SQL produces `{ sql, params, ast?, ... }`; Mongo
73
76
  * produces `{ command, ... }`.
77
+ *
78
+ * `ctx` carries per-query cancellation (and any future fields on
79
+ * `CodecCallContext`); concrete subclasses forward it to the
80
+ * encode-side codec dispatch site (e.g. SQL's `encodeParams` in m2,
81
+ * Mongo's `resolveValue` in m3). The runtime allocates one ctx per
82
+ * `execute()` call and threads the same reference everywhere; the
83
+ * `signal` field inside may be `undefined`, but the ctx object itself
84
+ * is always present.
74
85
  */
75
- protected abstract lower(plan: TPlan): TExec | Promise<TExec>;
86
+ protected abstract lower(plan: TPlan, ctx: CodecCallContext): TExec | Promise<TExec>;
76
87
 
77
88
  /**
78
89
  * Drive the underlying transport for a lowered `TExec`. Yields raw rows
@@ -88,12 +99,25 @@ export abstract class RuntimeCore<
88
99
 
89
100
  abstract close(): Promise<void>;
90
101
 
91
- execute<Row>(plan: TPlan & { readonly _row?: Row }): AsyncIterableResult<Row> {
102
+ execute<Row>(
103
+ plan: TPlan & { readonly _row?: Row },
104
+ options?: RuntimeExecuteOptions,
105
+ ): AsyncIterableResult<Row> {
92
106
  const self = this;
107
+ const signal = options?.signal;
108
+ // One ctx per execute() call. The ctx object is always allocated; the
109
+ // `signal` field is only included when a signal was supplied (required
110
+ // under exactOptionalPropertyTypes — `{ signal: undefined }` would not
111
+ // satisfy `signal?: AbortSignal`).
112
+ const codecCtx: CodecCallContext = signal === undefined ? {} : { signal };
93
113
 
94
114
  async function* generator(): AsyncGenerator<Row, void, unknown> {
115
+ // Pre-check the signal at entry so an already-aborted caller observes
116
+ // RUNTIME.ABORTED on the first `next()` without any work being done.
117
+ checkAborted(codecCtx, 'stream');
118
+
95
119
  const compiled = await self.runBeforeCompile(plan);
96
- const exec = await self.lower(compiled);
120
+ const exec = await self.lower(compiled, codecCtx);
97
121
  // The driver yields raw `Record<string, unknown>`; we cast to `Row` here.
98
122
  // The Row contract is enforced by the caller via `plan._row`.
99
123
  yield* runWithMiddleware<TExec, Row>(
@@ -5,6 +5,22 @@ export interface RuntimeErrorEnvelope extends Error {
5
5
  readonly details?: Record<string, unknown>;
6
6
  }
7
7
 
8
+ /**
9
+ * Stable code emitted by the runtime when an in-flight `execute()`
10
+ * is cancelled via the per-query `AbortSignal`. The envelope's
11
+ * `details.phase` distinguishes where the abort was observed:
12
+ *
13
+ * - `'encode'` — abort fired during `encodeParams` (SQL) or
14
+ * `resolveValue` (Mongo).
15
+ * - `'decode'` — abort fired during `decodeRow` / `decodeField`.
16
+ * - `'stream'` — abort fired between rows or before any codec call
17
+ * (already-aborted at entry).
18
+ */
19
+ export const RUNTIME_ABORTED = 'RUNTIME.ABORTED' as const;
20
+
21
+ /** Discriminator placed in `details.phase` of a `RUNTIME.ABORTED` envelope. */
22
+ export type RuntimeAbortedPhase = 'encode' | 'decode' | 'stream';
23
+
8
24
  /**
9
25
  * Type guard for the runtime-error envelope produced by `runtimeError`.
10
26
  *
@@ -53,3 +69,15 @@ function resolveCategory(code: string): RuntimeErrorEnvelope['category'] {
53
69
  return 'RUNTIME';
54
70
  }
55
71
  }
72
+
73
+ /**
74
+ * Construct a `RUNTIME.ABORTED` envelope. Phase distinguishes where the
75
+ * abort was observed (encode / decode / stream); cause carries `signal.reason`
76
+ * verbatim from the platform — native abort produces a `DOMException`,
77
+ * explicit `controller.abort(reason)` produces whatever the caller passed.
78
+ * No synthesis happens here.
79
+ */
80
+ export function runtimeAborted(phase: RuntimeAbortedPhase, cause?: unknown): RuntimeErrorEnvelope {
81
+ const envelope = runtimeError(RUNTIME_ABORTED, `Operation aborted during ${phase}`, { phase });
82
+ return Object.assign(envelope, { cause });
83
+ }
@@ -43,6 +43,19 @@ export interface RuntimeMiddleware<TPlan extends QueryPlan = QueryPlan> {
43
43
  ): Promise<void>;
44
44
  }
45
45
 
46
+ /**
47
+ * Optional per-`execute` options accepted by every family runtime.
48
+ *
49
+ * `signal` is the per-query cancellation signal. The runtime threads the
50
+ * signal through to every codec call for the query and uses it to short-
51
+ * circuit the row stream with `RUNTIME.ABORTED` when the caller aborts.
52
+ * Omitting the option (or passing `undefined`) preserves today's behavior
53
+ * bit-for-bit.
54
+ */
55
+ export interface RuntimeExecuteOptions {
56
+ readonly signal?: AbortSignal;
57
+ }
58
+
46
59
  /**
47
60
  * Cross-family SPI for any runtime that can execute plans and be shut down.
48
61
  * Each family runtime (SQL, Mongo) satisfies this interface — SQL nominally,
@@ -52,7 +65,10 @@ export interface RuntimeMiddleware<TPlan extends QueryPlan = QueryPlan> {
52
65
  * plan, mirroring how `QueryPlan<Row>` carries a phantom `_row?: Row`.
53
66
  */
54
67
  export interface RuntimeExecutor<TPlan extends QueryPlan> {
55
- execute<Row>(plan: TPlan & { readonly _row?: Row }): AsyncIterableResult<Row>;
68
+ execute<Row>(
69
+ plan: TPlan & { readonly _row?: Row },
70
+ options?: RuntimeExecuteOptions,
71
+ ): AsyncIterableResult<Row>;
56
72
  close(): Promise<void>;
57
73
  }
58
74
 
@@ -1,2 +1,2 @@
1
- export type { Codec, CodecLookup, CodecTrait } from '../shared/codec-types';
1
+ export type { Codec, CodecCallContext, CodecLookup, CodecTrait } from '../shared/codec-types';
2
2
  export { emptyCodecLookup } from '../shared/codec-types';
@@ -1,12 +1,19 @@
1
1
  export { AsyncIterableResult } from '../execution/async-iterable-result';
2
2
  export type { ExecutionPlan, QueryPlan, ResultType } from '../execution/query-plan';
3
+ export { checkAborted, raceAgainstAbort } from '../execution/race-against-abort';
3
4
  export { runWithMiddleware } from '../execution/run-with-middleware';
4
5
  export type { RuntimeCoreOptions } from '../execution/runtime-core';
5
6
  export { RuntimeCore } from '../execution/runtime-core';
6
- export type { RuntimeErrorEnvelope } from '../execution/runtime-error';
7
- export { isRuntimeError, runtimeError } from '../execution/runtime-error';
7
+ export type { RuntimeAbortedPhase, RuntimeErrorEnvelope } from '../execution/runtime-error';
8
+ export {
9
+ isRuntimeError,
10
+ RUNTIME_ABORTED,
11
+ runtimeAborted,
12
+ runtimeError,
13
+ } from '../execution/runtime-error';
8
14
  export type {
9
15
  AfterExecuteResult,
16
+ RuntimeExecuteOptions,
10
17
  RuntimeExecutor,
11
18
  RuntimeLog,
12
19
  RuntimeMiddleware,
@@ -2,6 +2,33 @@ import type { JsonValue } from '@prisma-next/contract/types';
2
2
 
3
3
  export type CodecTrait = 'equality' | 'order' | 'boolean' | 'numeric' | 'textual';
4
4
 
5
+ /**
6
+ * Per-call context the runtime threads to every `codec.encode` /
7
+ * `codec.decode` invocation for a single `runtime.execute()` call.
8
+ *
9
+ * The framework-level shape is family-agnostic and carries one field:
10
+ *
11
+ * - `signal?: AbortSignal` — per-query cancellation. The runtime returns
12
+ * a `RUNTIME.ABORTED` envelope when the signal aborts; codec authors
13
+ * who forward `signal` to their underlying SDK get true cancellation
14
+ * of in-flight network calls.
15
+ *
16
+ * Family layers extend this base with their own shape-of-call metadata:
17
+ * the SQL family adds `column?: SqlColumnRef` via `SqlCodecCallContext`
18
+ * (see `@prisma-next/sql-relational-core`). Mongo currently uses this
19
+ * framework type unchanged. Column metadata is intentionally **not** on
20
+ * the framework type — it is a SQL-family concept rooted in SQL's
21
+ * `(table, column)` addressing model and would not generalise to other
22
+ * families.
23
+ *
24
+ * The interface is named explicitly (not inlined) so future framework
25
+ * fields and family extensions can land additively without breaking
26
+ * codec author signatures.
27
+ */
28
+ export interface CodecCallContext {
29
+ readonly signal?: AbortSignal;
30
+ }
31
+
5
32
  /**
6
33
  * A codec is the contract between an application value and its on-wire and
7
34
  * on-contract-disk representations.
@@ -43,10 +70,10 @@ export interface Codec<
43
70
  readonly targetTypes: readonly string[];
44
71
  /** Semantic traits for operator gating (e.g. equality, order, numeric). */
45
72
  readonly traits?: TTraits;
46
- /** Converts a JS value to the wire format expected by the database driver. Always Promise-returning at the boundary. */
47
- encode(value: TInput): Promise<TWire>;
48
- /** Converts a wire value from the database driver into the JS application type. Always Promise-returning at the boundary. */
49
- decode(wire: TWire): Promise<TInput>;
73
+ /** Converts a JS value to the wire format expected by the database driver. Always Promise-returning at the boundary. The {@link CodecCallContext} is supplied by the runtime on every call (allocated once per `runtime.execute()`); family layers may narrow the ctx to extend it (e.g. SQL adds `column`). Author-side single-arg `(value) => …` functions remain legal via TypeScript's bivariance for trailing parameters. */
74
+ encode(value: TInput, ctx: CodecCallContext): Promise<TWire>;
75
+ /** Converts a wire value from the database driver into the JS application type. Always Promise-returning at the boundary. The {@link CodecCallContext} is supplied by the runtime on every call (allocated once per `runtime.execute()`); family layers may narrow the ctx to extend it (e.g. SQL adds `column`). Author-side single-arg `(wire) => …` functions remain legal via TypeScript's bivariance for trailing parameters. */
76
+ decode(wire: TWire, ctx: CodecCallContext): Promise<TInput>;
50
77
  /** Converts a JS value to a JSON-safe representation for contract serialization. Synchronous; called during contract emission. */
51
78
  encodeJson(value: TInput): JsonValue;
52
79
  /** Converts a JSON representation back to the JS input type. Synchronous; called during contract loading via `validateContract`. */
@@ -1 +0,0 @@
1
- {"version":3,"file":"codec-types-Csp_4QDg.d.mts","names":[],"sources":["../src/shared/codec-types.ts"],"sourcesContent":[],"mappings":";;;KAEY,UAAA;;AAAZ;AA+BA;;;;;;;;;;;;;;;;;AAwBA;AAIA;;;;;;;;;UA5BiB,2DAEU,wBAAwB;;eAKpC;;;;oBAIK;;gBAEJ,SAAS,QAAQ;;eAElB,QAAQ,QAAQ;;oBAEX,SAAS;;mBAEV,YAAY;;gCAEC;;UAGf,WAAA;mBACE;;cAGN,kBAAkB"}