@prisma/orm-family-sql 8.0.0-rc.14-dev.1 → 8.0.0-rc.14-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ast-DQU1yUQ5.d.mts → ast-B53rACdv.d.mts} +3 -3
- package/dist/{ast-DQU1yUQ5.d.mts.map → ast-B53rACdv.d.mts.map} +1 -1
- package/dist/{authoring-entity-types-CZ-vdwYS-GsYvzoFF.d.mts → authoring-entity-types-CZ-vdwYS-D6R9QovE.d.mts} +2 -2
- package/dist/{authoring-entity-types-CZ-vdwYS-GsYvzoFF.d.mts.map → authoring-entity-types-CZ-vdwYS-D6R9QovE.d.mts.map} +1 -1
- package/dist/{authoring-type-constructors-DQZEX4Sb-BYGQWq43.mjs → authoring-type-constructors-DQZEX4Sb-D6uFhwhG.mjs} +2 -2
- package/dist/{authoring-type-constructors-DQZEX4Sb-BYGQWq43.mjs.map → authoring-type-constructors-DQZEX4Sb-D6uFhwhG.mjs.map} +1 -1
- package/dist/builder.d.mts +2 -2
- package/dist/builder__runtime.d.mts +6 -6
- package/dist/builder__types.d.mts +2 -2
- package/dist/{config-types-B86lMw4s.mjs → config-types-CEXpi8FV.mjs} +2 -2
- package/dist/{config-types-B86lMw4s.mjs.map → config-types-CEXpi8FV.mjs.map} +1 -1
- package/dist/{contract-builder-j05FWfIe.d.mts → contract-builder-6ujqQuj-.d.mts} +2 -2
- package/dist/{contract-builder-j05FWfIe.d.mts.map → contract-builder-6ujqQuj-.d.mts.map} +1 -1
- package/dist/{contract-builder-Fw-SFRvK.mjs → contract-builder-vmb0E3SP.mjs} +2 -2
- package/dist/{contract-builder-Fw-SFRvK.mjs.map → contract-builder-vmb0E3SP.mjs.map} +1 -1
- package/dist/contract-emitter.mjs +1 -1
- package/dist/contract-prisma7__provider.mjs +4 -4
- package/dist/contract-prisma7__provider.mjs.map +1 -1
- package/dist/contract-psl.d.mts +4 -4
- package/dist/contract-psl.d.mts.map +1 -1
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__provider.mjs +2 -2
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/contract-ts.d.mts +1 -1
- package/dist/contract-ts.mjs +3 -3
- package/dist/contract-ts__config-types.mjs +1 -1
- package/dist/contract-ts__contract-builder.d.mts +1 -1
- package/dist/contract-ts__contract-builder.mjs +2 -2
- package/dist/contract.d.mts +2 -1
- package/dist/contract.mjs +2 -1
- package/dist/contract__sql-expression.d.mts +2 -0
- package/dist/contract__sql-expression.mjs +2 -0
- package/dist/{control-DOGYQMFH.mjs → control-2-eFP31F.mjs} +9 -47
- package/dist/control-2-eFP31F.mjs.map +1 -0
- package/dist/{control-kbS8DWF0.d.mts → control-DmVQjyZd.d.mts} +15 -20
- package/dist/control-DmVQjyZd.d.mts.map +1 -0
- package/dist/{control-adapter-C99J7aEF-B571Jffd.d.mts → control-adapter-C99J7aEF-B3_IhgH6.d.mts} +4 -4
- package/dist/{control-adapter-C99J7aEF-B571Jffd.d.mts.map → control-adapter-C99J7aEF-B3_IhgH6.d.mts.map} +1 -1
- package/dist/control-adapter-kl-cOML5.d.mts +1 -0
- package/dist/{db-DLjWu9-f-CVAu8jgd.d.mts → db-DLjWu9-f-COdzEg7b.d.mts} +6 -6
- package/dist/{db-DLjWu9-f-CVAu8jgd.d.mts.map → db-DLjWu9-f-COdzEg7b.d.mts.map} +1 -1
- package/dist/{ddl-types-DD-i-Uj9-D99heD5Z.d.mts → ddl-types-DD-i-Uj9-BRqLNUDm.d.mts} +2 -2
- package/dist/{ddl-types-DD-i-Uj9-D99heD5Z.d.mts.map → ddl-types-DD-i-Uj9-BRqLNUDm.d.mts.map} +1 -1
- package/dist/{derived-checks-C6psACIj-DfqUVmZz.mjs → derived-checks-C6psACIj-BSBDa2_9.mjs} +3 -3
- package/dist/{derived-checks-C6psACIj-DfqUVmZz.mjs.map → derived-checks-C6psACIj-BSBDa2_9.mjs.map} +1 -1
- package/dist/{diff-BxwNI8yE.d.mts → diff-DFOiwUHg.d.mts} +3 -3
- package/dist/{diff-BxwNI8yE.d.mts.map → diff-DFOiwUHg.d.mts.map} +1 -1
- package/dist/{dist-U61NPKN3.mjs → dist-ChyuAdtP.mjs} +2 -2
- package/dist/{dist-U61NPKN3.mjs.map → dist-ChyuAdtP.mjs.map} +1 -1
- package/dist/{expression-BPoA5eEl.d.mts → expression-Dl5WvxCA.d.mts} +3 -3
- package/dist/{expression-BPoA5eEl.d.mts.map → expression-Dl5WvxCA.d.mts.map} +1 -1
- package/dist/family.d.mts +11 -11
- package/dist/family.mjs +3 -3
- package/dist/family__control-adapter.d.mts +2 -2
- package/dist/family__control.d.mts +3 -3
- package/dist/family__control.mjs +2 -2
- package/dist/family__diff.d.mts +2 -2
- package/dist/family__migration.d.mts +1 -1
- package/dist/family__pack.d.mts +1 -1
- package/dist/family__pack.mjs +1 -1
- package/dist/family__psl-build.d.mts +2 -2
- package/dist/family__psl-build.mjs +1 -1
- package/dist/family__psl-infer.d.mts +1 -1
- package/dist/{index-yNeNt2GO.d.mts → index-BNL2_qQY.d.mts} +9 -9
- package/dist/{index-yNeNt2GO.d.mts.map → index-BNL2_qQY.d.mts.map} +1 -1
- package/dist/{interpreter-IKKTyZNv-D12J5Dcx.mjs → interpreter-Bcc3MIC5-C4dZrobt.mjs} +53 -71
- package/dist/interpreter-Bcc3MIC5-C4dZrobt.mjs.map +1 -0
- package/dist/{middleware-CuGBptK0-C88HCnh5.d.mts → middleware-CuGBptK0-UwVChCr2.d.mts} +2 -2
- package/dist/{middleware-CuGBptK0-C88HCnh5.d.mts.map → middleware-CuGBptK0-UwVChCr2.d.mts.map} +1 -1
- package/dist/middleware-RUh4qBBg.d.mts +1 -0
- package/dist/{migration-BJCmLNwu.d.mts → migration-Csmr6bd8.d.mts} +2 -2
- package/dist/{migration-BJCmLNwu.d.mts.map → migration-Csmr6bd8.d.mts.map} +1 -1
- package/dist/orm-client.d.mts +11 -11
- package/dist/{pack-CUGnCaEh.d.mts → pack-BUv79Jrr.d.mts} +2 -2
- package/dist/{pack-CUGnCaEh.d.mts.map → pack-BUv79Jrr.d.mts.map} +1 -1
- package/dist/{plan-B7g2kDfQ-Bw0784x6.d.mts → plan-B7g2kDfQ-ZD3BfWYx.d.mts} +2 -2
- package/dist/{plan-B7g2kDfQ-Bw0784x6.d.mts.map → plan-B7g2kDfQ-ZD3BfWYx.d.mts.map} +1 -1
- package/dist/plan-CVje8E5I.d.mts +2 -0
- package/dist/{prepared-statement-BHSj2pDk-BL0wOCnq.d.mts → prepared-statement-BHSj2pDk-D9a_Vwr-.d.mts} +14 -14
- package/dist/{prepared-statement-BHSj2pDk-BL0wOCnq.d.mts.map → prepared-statement-BHSj2pDk-D9a_Vwr-.d.mts.map} +1 -1
- package/dist/{psl-build-yBrQQN3r.d.mts → psl-build-BnM1ZTyK.d.mts} +2 -2
- package/dist/psl-build-BnM1ZTyK.d.mts.map +1 -0
- package/dist/{psl-build-SOpIFu24.mjs → psl-build-ph4eUJSB.mjs} +6 -21
- package/dist/psl-build-ph4eUJSB.mjs.map +1 -0
- package/dist/{psl-infer-C8hg8mIS.d.mts → psl-infer-DT5_Lx5r.d.mts} +2 -2
- package/dist/{psl-infer-C8hg8mIS.d.mts.map → psl-infer-DT5_Lx5r.d.mts.map} +1 -1
- package/dist/query-lane-context-D54z0tof.d.mts +1 -0
- package/dist/{query-lane-context-D6o9YrEV-bouFPM6u.d.mts → query-lane-context-D6o9YrEV-BxW3-5e8.d.mts} +3 -3
- package/dist/{query-lane-context-D6o9YrEV-bouFPM6u.d.mts.map → query-lane-context-D6o9YrEV-BxW3-5e8.d.mts.map} +1 -1
- package/dist/relational-core.d.mts +11 -11
- package/dist/relational-core__aggregate-descriptor-registry.d.mts +1 -1
- package/dist/relational-core__ast.d.mts +3 -3
- package/dist/relational-core__codec-descriptor-registry.d.mts +2 -2
- package/dist/relational-core__contract-free.d.mts +2 -2
- package/dist/relational-core__expression.d.mts +1 -1
- package/dist/relational-core__middleware.d.mts +2 -2
- package/dist/relational-core__plan.d.mts +3 -3
- package/dist/relational-core__query-lane-context.d.mts +2 -2
- package/dist/relational-core__types.d.mts +2 -2
- package/dist/runtime.d.mts +4 -4
- package/dist/runtime.mjs +33 -33
- package/dist/runtime.mjs.map +1 -1
- package/dist/runtime__internal__prepared-query.d.mts +1 -1
- package/dist/{sql-execution-plan-Db0j752I-CI5WbdLi.d.mts → sql-execution-plan-Db0j752I-faODNLY9.d.mts} +2 -2
- package/dist/{sql-execution-plan-Db0j752I-CI5WbdLi.d.mts.map → sql-execution-plan-Db0j752I-faODNLY9.d.mts.map} +1 -1
- package/dist/sql-expression-BXx0Ilj-.mjs +51 -0
- package/dist/sql-expression-BXx0Ilj-.mjs.map +1 -0
- package/dist/sql-expression-D_hbJOgM.d.mts +27 -0
- package/dist/sql-expression-D_hbJOgM.d.mts.map +1 -0
- package/dist/{type-map-BwBI56i3-DDERtzxf.d.mts → type-map-DpfnXzun-DZaSuJXh.d.mts} +5 -5
- package/dist/{type-map-BwBI56i3-DDERtzxf.d.mts.map → type-map-DpfnXzun-DZaSuJXh.d.mts.map} +1 -1
- package/dist/{types-BFPRCYGW-BLH0sK1Y.d.mts → types-BFPRCYGW-CZrZyp1E.d.mts} +2 -2
- package/dist/{types-BFPRCYGW-BLH0sK1Y.d.mts.map → types-BFPRCYGW-CZrZyp1E.d.mts.map} +1 -1
- package/dist/{types-DFJNPLXY-vp6AGe5e.d.mts → types-DFJNPLXY-DyYKIhXA.d.mts} +5 -5
- package/dist/{types-DFJNPLXY-vp6AGe5e.d.mts.map → types-DFJNPLXY-DyYKIhXA.d.mts.map} +1 -1
- package/dist/types-Dul4Za_W.d.mts +1 -0
- package/dist/{types-Yui2yFf6-TP-oRDTX.d.mts → types-Yui2yFf6-Dnc7RNUD.d.mts} +2 -2
- package/dist/{types-Yui2yFf6-TP-oRDTX.d.mts.map → types-Yui2yFf6-Dnc7RNUD.d.mts.map} +1 -1
- package/package.json +19 -18
- package/dist/control-DOGYQMFH.mjs.map +0 -1
- package/dist/control-adapter-jmL_K-jB.d.mts +0 -1
- package/dist/control-kbS8DWF0.d.mts.map +0 -1
- package/dist/interpreter-IKKTyZNv-D12J5Dcx.mjs.map +0 -1
- package/dist/middleware-aoqicpDI.d.mts +0 -1
- package/dist/plan-DiT00Rg8.d.mts +0 -2
- package/dist/psl-build-SOpIFu24.mjs.map +0 -1
- package/dist/psl-build-yBrQQN3r.d.mts.map +0 -1
- package/dist/query-lane-context-BcXiJasG.d.mts +0 -1
- package/dist/types-BvTYXSiS.d.mts +0 -1
package/dist/runtime.mjs
CHANGED
|
@@ -9,11 +9,11 @@ import { isStructuredError } from "@prisma/orm-framework/utils/structured-error"
|
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
10
10
|
import { assertNever } from "@prisma/orm-framework/utils/internal-error";
|
|
11
11
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
12
|
-
import { AsyncIterableResult, RuntimeCore, applyMutationDefaults, assertMutationDefaultGeneratorsAvailable, checkAborted, checkMiddlewareCompatibility, collectMutationDefaultGenerators, raceAgainstAbort, runBeforeExecuteChain, runBeforeQueryChain, runExecuteWithMiddleware, runQueryWithMiddleware, runtimeError } from "@prisma/orm-framework/components/runtime";
|
|
13
|
-
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
14
|
-
import { canonicalStringify } from "@prisma/orm-framework/utils/canonical-stringify";
|
|
15
12
|
import { materializeCodec, resolveCodecDescriptorOrThrow } from "@prisma/orm-framework/components/codec";
|
|
16
13
|
import { checkContractComponentRequirements, mergeCapabilityMatrices } from "@prisma/orm-framework/components/components";
|
|
14
|
+
import { AsyncIterableResult, RuntimeCore, applyMutationDefaults, assertMutationDefaultGeneratorsAvailable, checkAborted, checkMiddlewareCompatibility, collectMutationDefaultGenerators, raceAgainstAbort, runBeforeExecuteChain, runBeforeQueryChain, runExecuteWithMiddleware, runQueryWithMiddleware, runtimeError as runtimeError$1 } from "@prisma/orm-framework/components/runtime";
|
|
15
|
+
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
16
|
+
import { canonicalStringify } from "@prisma/orm-framework/utils/canonical-stringify";
|
|
17
17
|
import { canonicalizeJson } from "@prisma/orm-framework/components/utils";
|
|
18
18
|
import { createExecutionStack } from "@prisma/orm-framework/components/execution";
|
|
19
19
|
import { hashContent } from "@prisma/orm-framework/utils/hash-content";
|
|
@@ -73,7 +73,7 @@ function paramLabel(metadata, paramIndex) {
|
|
|
73
73
|
}
|
|
74
74
|
function wrapEncodeFailure(error, metadata, paramIndex, codecId) {
|
|
75
75
|
const label = paramLabel(metadata, paramIndex);
|
|
76
|
-
const wrapped = runtimeError("RUNTIME.ENCODE_FAILED", `Failed to encode parameter ${label} with codec '${codecId}': ${error instanceof Error ? error.message : String(error)}`, {
|
|
76
|
+
const wrapped = runtimeError$1("RUNTIME.ENCODE_FAILED", `Failed to encode parameter ${label} with codec '${codecId}': ${error instanceof Error ? error.message : String(error)}`, {
|
|
77
77
|
label,
|
|
78
78
|
codec: codecId,
|
|
79
79
|
paramIndex
|
|
@@ -155,7 +155,7 @@ function validateContractCodecMappings(registry, contract) {
|
|
|
155
155
|
contractTarget: contract.target,
|
|
156
156
|
invalidCodecs
|
|
157
157
|
};
|
|
158
|
-
throw runtimeError("RUNTIME.CODEC_MISSING", `Missing codec implementations for column codecIds: ${invalidCodecs.map((c) => `${c.namespaceId}.${c.table}.${c.column} (${c.codecId})`).join(", ")}`, details);
|
|
158
|
+
throw runtimeError$1("RUNTIME.CODEC_MISSING", `Missing codec implementations for column codecIds: ${invalidCodecs.map((c) => `${c.namespaceId}.${c.table}.${c.column} (${c.codecId})`).join(", ")}`, details);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
function validateCodecRegistryCompleteness(registry, contract) {
|
|
@@ -177,7 +177,7 @@ function lowerSqlPlan(adapter, contract, queryPlan) {
|
|
|
177
177
|
});
|
|
178
178
|
const params = lowered.params.map((slot) => {
|
|
179
179
|
if (slot.kind === "literal") return slot.value;
|
|
180
|
-
throw runtimeError("RUNTIME.PREPARE_BIND_ON_ADHOC", `Ad-hoc execute received a bind-site slot for '${slot.name}' — bind-site references are only valid inside runtime.prepare(...).`, { name: slot.name });
|
|
180
|
+
throw runtimeError$1("RUNTIME.PREPARE_BIND_ON_ADHOC", `Ad-hoc execute received a bind-site slot for '${slot.name}' — bind-site references are only valid inside runtime.prepare(...).`, { name: slot.name });
|
|
181
181
|
});
|
|
182
182
|
return Object.freeze({
|
|
183
183
|
sql: lowered.sql,
|
|
@@ -231,7 +231,7 @@ function budgets(options) {
|
|
|
231
231
|
const latencyMs = result.latencyMs;
|
|
232
232
|
if (latencyMs > maxLatencyMs) {
|
|
233
233
|
const shouldBlock = latencySeverity === "error" || ctx.mode === "strict";
|
|
234
|
-
emitBudgetViolation(runtimeError("BUDGET.TIME_EXCEEDED", "Query latency exceeds budget", {
|
|
234
|
+
emitBudgetViolation(runtimeError$1("BUDGET.TIME_EXCEEDED", "Query latency exceeds budget", {
|
|
235
235
|
latencyMs,
|
|
236
236
|
maxLatencyMs
|
|
237
237
|
}), shouldBlock, ctx);
|
|
@@ -246,7 +246,7 @@ function budgets(options) {
|
|
|
246
246
|
const state = observedRowsByPlan.get(plan);
|
|
247
247
|
if (!state) return;
|
|
248
248
|
state.count += 1;
|
|
249
|
-
if (state.count > maxRows) throw runtimeError("BUDGET.ROWS_EXCEEDED", "Observed row count exceeds budget", {
|
|
249
|
+
if (state.count > maxRows) throw runtimeError$1("BUDGET.ROWS_EXCEEDED", "Observed row count exceeds budget", {
|
|
250
250
|
source: "observed",
|
|
251
251
|
observedRows: state.count,
|
|
252
252
|
maxRows
|
|
@@ -261,7 +261,7 @@ function budgets(options) {
|
|
|
261
261
|
const isUnbounded = ast.limit === void 0 && !hasAggNoGroup;
|
|
262
262
|
const shouldBlock = rowSeverity === "error" || ctx.mode === "strict";
|
|
263
263
|
if (isUnbounded) {
|
|
264
|
-
emitBudgetViolation(runtimeError("BUDGET.ROWS_EXCEEDED", "Unbounded SELECT query exceeds budget", estimated >= maxRows ? {
|
|
264
|
+
emitBudgetViolation(runtimeError$1("BUDGET.ROWS_EXCEEDED", "Unbounded SELECT query exceeds budget", estimated >= maxRows ? {
|
|
265
265
|
source: "ast",
|
|
266
266
|
estimatedRows: estimated,
|
|
267
267
|
maxRows
|
|
@@ -271,7 +271,7 @@ function budgets(options) {
|
|
|
271
271
|
}), shouldBlock, ctx);
|
|
272
272
|
return;
|
|
273
273
|
}
|
|
274
|
-
if (estimated > maxRows) emitBudgetViolation(runtimeError("BUDGET.ROWS_EXCEEDED", "Estimated row count exceeds budget", {
|
|
274
|
+
if (estimated > maxRows) emitBudgetViolation(runtimeError$1("BUDGET.ROWS_EXCEEDED", "Estimated row count exceeds budget", {
|
|
275
275
|
source: "ast",
|
|
276
276
|
estimatedRows: estimated,
|
|
277
277
|
maxRows
|
|
@@ -443,7 +443,7 @@ function lints(options) {
|
|
|
443
443
|
} else if (fallback !== "skip") findings.push(...evaluateRawGuardrails(plan).lints);
|
|
444
444
|
for (const lint of findings) {
|
|
445
445
|
const effectiveSeverity = getConfiguredSeverity(lint.code, options) ?? lint.severity;
|
|
446
|
-
if (effectiveSeverity === "error") throw runtimeError(lint.code, lint.message, lint.details);
|
|
446
|
+
if (effectiveSeverity === "error") throw runtimeError$1(lint.code, lint.message, lint.details);
|
|
447
447
|
if (effectiveSeverity === "warn") ctx.log.warn({
|
|
448
448
|
code: lint.code,
|
|
449
449
|
message: lint.message,
|
|
@@ -529,29 +529,29 @@ function assertExecutionStackContractRequirements(contract, stack) {
|
|
|
529
529
|
expectedTargetId: stack.target.targetId,
|
|
530
530
|
providedComponentIds
|
|
531
531
|
});
|
|
532
|
-
if (result.familyMismatch) throw runtimeError("RUNTIME.CONTRACT_FAMILY_MISMATCH", `Contract target family '${result.familyMismatch.actual}' does not match runtime family '${result.familyMismatch.expected}'.`, {
|
|
532
|
+
if (result.familyMismatch) throw runtimeError$1("RUNTIME.CONTRACT_FAMILY_MISMATCH", `Contract target family '${result.familyMismatch.actual}' does not match runtime family '${result.familyMismatch.expected}'.`, {
|
|
533
533
|
actual: result.familyMismatch.actual,
|
|
534
534
|
expected: result.familyMismatch.expected
|
|
535
535
|
});
|
|
536
|
-
if (result.targetMismatch) throw runtimeError("RUNTIME.CONTRACT_TARGET_MISMATCH", `Contract target '${result.targetMismatch.actual}' does not match runtime target descriptor '${result.targetMismatch.expected}'.`, {
|
|
536
|
+
if (result.targetMismatch) throw runtimeError$1("RUNTIME.CONTRACT_TARGET_MISMATCH", `Contract target '${result.targetMismatch.actual}' does not match runtime target descriptor '${result.targetMismatch.expected}'.`, {
|
|
537
537
|
actual: result.targetMismatch.actual,
|
|
538
538
|
expected: result.targetMismatch.expected
|
|
539
539
|
});
|
|
540
540
|
if (result.missingExtensionPackIds.length > 0) {
|
|
541
541
|
const packIds = result.missingExtensionPackIds;
|
|
542
|
-
throw runtimeError("RUNTIME.MISSING_EXTENSION_PACK", `Contract requires extension pack(s) ${packIds.map((id) => `'${id}'`).join(", ")}, but runtime descriptors do not provide matching component(s).`, { packIds });
|
|
542
|
+
throw runtimeError$1("RUNTIME.MISSING_EXTENSION_PACK", `Contract requires extension pack(s) ${packIds.map((id) => `'${id}'`).join(", ")}, but runtime descriptors do not provide matching component(s).`, { packIds });
|
|
543
543
|
}
|
|
544
544
|
}
|
|
545
545
|
function validateTypeParams(typeParams, descriptor, context) {
|
|
546
546
|
const result = descriptor.paramsSchema["~standard"].validate(typeParams);
|
|
547
|
-
if (result instanceof Promise) throw runtimeError("RUNTIME.TYPE_PARAMS_INVALID", `paramsSchema for codec '${descriptor.codecId}' returned a Promise; runtime validation requires a synchronous Standard Schema validator.`, {
|
|
547
|
+
if (result instanceof Promise) throw runtimeError$1("RUNTIME.TYPE_PARAMS_INVALID", `paramsSchema for codec '${descriptor.codecId}' returned a Promise; runtime validation requires a synchronous Standard Schema validator.`, {
|
|
548
548
|
...context,
|
|
549
549
|
codecId: descriptor.codecId,
|
|
550
550
|
typeParams
|
|
551
551
|
});
|
|
552
552
|
if (result.issues) {
|
|
553
553
|
const messages = result.issues.map((issue) => issue.message).join("; ");
|
|
554
|
-
throw runtimeError("RUNTIME.TYPE_PARAMS_INVALID", `Invalid typeParams for ${context.typeName ? `type '${context.typeName}'` : `column '${context.tableName}.${context.columnName}'`} (codecId: ${descriptor.codecId}): ${messages}`, {
|
|
554
|
+
throw runtimeError$1("RUNTIME.TYPE_PARAMS_INVALID", `Invalid typeParams for ${context.typeName ? `type '${context.typeName}'` : `column '${context.tableName}.${context.columnName}'`} (codecId: ${descriptor.codecId}): ${messages}`, {
|
|
555
555
|
...context,
|
|
556
556
|
codecId: descriptor.codecId,
|
|
557
557
|
typeParams
|
|
@@ -569,7 +569,7 @@ function collectCodecDescriptors(contributors) {
|
|
|
569
569
|
const parameterized = /* @__PURE__ */ new Map();
|
|
570
570
|
const seen = /* @__PURE__ */ new Set();
|
|
571
571
|
for (const contributor of contributors) for (const descriptor of contributor.codecs()) {
|
|
572
|
-
if (seen.has(descriptor.codecId)) throw runtimeError("RUNTIME.DUPLICATE_CODEC", `Duplicate codec descriptor for codecId '${descriptor.codecId}'.`, { codecId: descriptor.codecId });
|
|
572
|
+
if (seen.has(descriptor.codecId)) throw runtimeError$1("RUNTIME.DUPLICATE_CODEC", `Duplicate codec descriptor for codecId '${descriptor.codecId}'.`, { codecId: descriptor.codecId });
|
|
573
573
|
seen.add(descriptor.codecId);
|
|
574
574
|
all.push(descriptor);
|
|
575
575
|
if (descriptor.isParameterized) parameterized.set(descriptor.codecId, blindCast(descriptor));
|
|
@@ -645,7 +645,7 @@ function assertColumnCodecIntegrity(storage, codecDescriptors) {
|
|
|
645
645
|
const ref = codecDescriptors.codecRefForColumn(namespaceId, tableName, columnName);
|
|
646
646
|
if (!ref) continue;
|
|
647
647
|
const descriptor = codecDescriptors.descriptorFor(ref.codecId);
|
|
648
|
-
if (!descriptor) throw runtimeError("RUNTIME.CODEC_DESCRIPTOR_MISSING", `Column '${tableName}.${columnName}' references codec '${ref.codecId}' but no contributor registered a codec descriptor for that codecId. Add the extension pack that owns the codec to the runtime stack.`, {
|
|
648
|
+
if (!descriptor) throw runtimeError$1("RUNTIME.CODEC_DESCRIPTOR_MISSING", `Column '${tableName}.${columnName}' references codec '${ref.codecId}' but no contributor registered a codec descriptor for that codecId. Add the extension pack that owns the codec to the runtime stack.`, {
|
|
649
649
|
table: tableName,
|
|
650
650
|
column: columnName,
|
|
651
651
|
codecId: ref.codecId
|
|
@@ -655,13 +655,13 @@ function assertColumnCodecIntegrity(storage, codecDescriptors) {
|
|
|
655
655
|
const probe = paramsSchema["~standard"].validate({});
|
|
656
656
|
if (probe instanceof Promise) {
|
|
657
657
|
probe.catch(() => {});
|
|
658
|
-
throw runtimeError("RUNTIME.TYPE_PARAMS_INVALID", `Column '${tableName}.${columnName}' uses parameterized codec '${ref.codecId}' whose paramsSchema returned a Promise; paramsSchema must be a synchronous Standard Schema validator. Return a value/issues result directly instead of a Promise.`, {
|
|
658
|
+
throw runtimeError$1("RUNTIME.TYPE_PARAMS_INVALID", `Column '${tableName}.${columnName}' uses parameterized codec '${ref.codecId}' whose paramsSchema returned a Promise; paramsSchema must be a synchronous Standard Schema validator. Return a value/issues result directly instead of a Promise.`, {
|
|
659
659
|
table: tableName,
|
|
660
660
|
column: columnName,
|
|
661
661
|
codecId: ref.codecId
|
|
662
662
|
});
|
|
663
663
|
}
|
|
664
|
-
if ("issues" in probe && !!probe.issues) throw runtimeError("RUNTIME.CODEC_PARAMETERIZATION_MISMATCH", `Column '${tableName}.${columnName}' uses parameterized codec '${ref.codecId}' but no typeParams are supplied. Provide typeParams on the column, or use a typeRef pointing at a storage.types entry that carries them.`, {
|
|
664
|
+
if ("issues" in probe && !!probe.issues) throw runtimeError$1("RUNTIME.CODEC_PARAMETERIZATION_MISMATCH", `Column '${tableName}.${columnName}' uses parameterized codec '${ref.codecId}' but no typeParams are supplied. Provide typeParams on the column, or use a typeRef pointing at a storage.types entry that carries them.`, {
|
|
665
665
|
table: tableName,
|
|
666
666
|
column: columnName,
|
|
667
667
|
codecId: ref.codecId,
|
|
@@ -671,7 +671,7 @@ function assertColumnCodecIntegrity(storage, codecDescriptors) {
|
|
|
671
671
|
}
|
|
672
672
|
const refTypeParams = ref.typeParams;
|
|
673
673
|
const refHasTypeParamKeys = refTypeParams !== void 0 && refTypeParams !== null && typeof refTypeParams === "object" && !Array.isArray(refTypeParams) && Object.keys(refTypeParams).length > 0;
|
|
674
|
-
if (!descriptor.isParameterized && refHasTypeParamKeys) throw runtimeError("RUNTIME.CODEC_PARAMETERIZATION_MISMATCH", `Column '${tableName}.${columnName}' supplies typeParams to non-parameterized codec '${ref.codecId}'. Remove the typeParams or switch to a parameterized codec id.`, {
|
|
674
|
+
if (!descriptor.isParameterized && refHasTypeParamKeys) throw runtimeError$1("RUNTIME.CODEC_PARAMETERIZATION_MISMATCH", `Column '${tableName}.${columnName}' supplies typeParams to non-parameterized codec '${ref.codecId}'. Remove the typeParams or switch to a parameterized codec id.`, {
|
|
675
675
|
table: tableName,
|
|
676
676
|
column: columnName,
|
|
677
677
|
codecId: ref.codecId,
|
|
@@ -883,7 +883,7 @@ function previewWireValue(wireValue) {
|
|
|
883
883
|
}
|
|
884
884
|
function wrapDecodeFailure(error, alias, ref, codec, wireValue) {
|
|
885
885
|
const message = error instanceof Error ? error.message : String(error);
|
|
886
|
-
const wrapped = runtimeError("RUNTIME.DECODE_FAILED", `Failed to decode column ${ref ? `${ref.table}.${ref.column}` : alias} with codec '${codec.id}': ${message}`, {
|
|
886
|
+
const wrapped = runtimeError$1("RUNTIME.DECODE_FAILED", `Failed to decode column ${ref ? `${ref.table}.${ref.column}` : alias} with codec '${codec.id}': ${message}`, {
|
|
887
887
|
...ref ? {
|
|
888
888
|
table: ref.table,
|
|
889
889
|
column: ref.column
|
|
@@ -895,7 +895,7 @@ function wrapDecodeFailure(error, alias, ref, codec, wireValue) {
|
|
|
895
895
|
throw wrapped;
|
|
896
896
|
}
|
|
897
897
|
function wrapIncludeAggregateFailure(error, alias, wireValue) {
|
|
898
|
-
const wrapped = runtimeError("RUNTIME.DECODE_FAILED", `Failed to parse JSON array for include alias '${alias}': ${error instanceof Error ? error.message : String(error)}`, {
|
|
898
|
+
const wrapped = runtimeError$1("RUNTIME.DECODE_FAILED", `Failed to parse JSON array for include alias '${alias}': ${error instanceof Error ? error.message : String(error)}`, {
|
|
899
899
|
alias,
|
|
900
900
|
wirePreview: previewWireValue(wireValue)
|
|
901
901
|
});
|
|
@@ -974,11 +974,11 @@ async function decodeRow(row, decodeCtx, rowCtx, listDecoder) {
|
|
|
974
974
|
const signal = rowCtx.signal;
|
|
975
975
|
const aliases = decodeCtx.aliases ?? Object.keys(row);
|
|
976
976
|
if (decodeCtx.aliases !== void 0) {
|
|
977
|
-
for (const alias of decodeCtx.aliases) if (!Object.hasOwn(row, alias)) throw decodeCtx.aliasSource === "row-spec" ? runtimeError("RUNTIME.RAW_ROW_COLUMN_MISSING", `Raw statement result has no column "${alias}", which its row spec declares`, {
|
|
977
|
+
for (const alias of decodeCtx.aliases) if (!Object.hasOwn(row, alias)) throw decodeCtx.aliasSource === "row-spec" ? runtimeError$1("RUNTIME.RAW_ROW_COLUMN_MISSING", `Raw statement result has no column "${alias}", which its row spec declares`, {
|
|
978
978
|
column: alias,
|
|
979
979
|
declaredColumns: decodeCtx.aliases,
|
|
980
980
|
resultColumns: Object.keys(row)
|
|
981
|
-
}) : runtimeError("RUNTIME.DECODE_FAILED", `Row missing projection alias "${alias}"`, {
|
|
981
|
+
}) : runtimeError$1("RUNTIME.DECODE_FAILED", `Row missing projection alias "${alias}"`, {
|
|
982
982
|
alias,
|
|
983
983
|
expectedAliases: decodeCtx.aliases,
|
|
984
984
|
presentKeys: Object.keys(row)
|
|
@@ -1124,10 +1124,10 @@ function isRecord(value) {
|
|
|
1124
1124
|
return typeof value === "object" && value !== null;
|
|
1125
1125
|
}
|
|
1126
1126
|
function resolvePreparedSlotValues(ps, userParams) {
|
|
1127
|
-
if (!isRecord(userParams)) throw runtimeError("RUNTIME.PREPARE_MISSING_PARAM", "Prepared statement parameters must be an object");
|
|
1127
|
+
if (!isRecord(userParams)) throw runtimeError$1("RUNTIME.PREPARE_MISSING_PARAM", "Prepared statement parameters must be an object");
|
|
1128
1128
|
return ps.slots.map((slot) => {
|
|
1129
1129
|
if (slot.kind === "literal") return slot.value;
|
|
1130
|
-
if (!Object.hasOwn(userParams, slot.name)) throw runtimeError("RUNTIME.PREPARE_MISSING_PARAM", `Prepared statement query is missing parameter '${slot.name}'`, { name: slot.name });
|
|
1130
|
+
if (!Object.hasOwn(userParams, slot.name)) throw runtimeError$1("RUNTIME.PREPARE_MISSING_PARAM", `Prepared statement query is missing parameter '${slot.name}'`, { name: slot.name });
|
|
1131
1131
|
return userParams[slot.name];
|
|
1132
1132
|
});
|
|
1133
1133
|
}
|
|
@@ -1139,11 +1139,11 @@ var SqlFamilyAdapter = class {
|
|
|
1139
1139
|
this.markerReader = adapterProfile;
|
|
1140
1140
|
}
|
|
1141
1141
|
validatePlan(plan, contract) {
|
|
1142
|
-
if (plan.meta.target !== contract.target) throw runtimeError("PLAN.TARGET_MISMATCH", "Plan target does not match runtime target", {
|
|
1142
|
+
if (plan.meta.target !== contract.target) throw runtimeError$1("PLAN.TARGET_MISMATCH", "Plan target does not match runtime target", {
|
|
1143
1143
|
planTarget: plan.meta.target,
|
|
1144
1144
|
runtimeTarget: contract.target
|
|
1145
1145
|
});
|
|
1146
|
-
if (plan.meta.storageHash !== contract.storage.storageHash) throw runtimeError("PLAN.HASH_MISMATCH", "Plan storage hash does not match runtime contract", {
|
|
1146
|
+
if (plan.meta.storageHash !== contract.storage.storageHash) throw runtimeError$1("PLAN.HASH_MISMATCH", "Plan storage hash does not match runtime contract", {
|
|
1147
1147
|
planStorageHash: plan.meta.storageHash,
|
|
1148
1148
|
runtimeStorageHash: contract.storage.storageHash
|
|
1149
1149
|
});
|
|
@@ -1422,7 +1422,7 @@ var SqlRuntimeBase = class extends RuntimeCore {
|
|
|
1422
1422
|
const referencedNames = /* @__PURE__ */ new Set();
|
|
1423
1423
|
for (const ref of orderedRefs) if (ref.kind === "prepared-param-ref") referencedNames.add(ref.name);
|
|
1424
1424
|
const missing = Object.keys(declaration).filter((name) => !referencedNames.has(name));
|
|
1425
|
-
if (missing.length > 0) throw runtimeError("RUNTIME.PREPARE_UNUSED_PARAM", `Prepared statement declaration includes parameter${missing.length === 1 ? "" : "s"} not referenced by the callback's plan: ${missing.join(", ")}`, { unused: missing });
|
|
1425
|
+
if (missing.length > 0) throw runtimeError$1("RUNTIME.PREPARE_UNUSED_PARAM", `Prepared statement declaration includes parameter${missing.length === 1 ? "" : "s"} not referenced by the callback's plan: ${missing.join(", ")}`, { unused: missing });
|
|
1426
1426
|
const lowered = this.adapter.lower(finalPlan.ast, {
|
|
1427
1427
|
contract: this.contract,
|
|
1428
1428
|
params: orderedRefs.map((r) => r.kind === "param-ref" ? r.value : void 0)
|
|
@@ -1652,7 +1652,7 @@ var SqlRuntimeBase = class extends RuntimeCore {
|
|
|
1652
1652
|
}
|
|
1653
1653
|
};
|
|
1654
1654
|
function transactionClosedError() {
|
|
1655
|
-
return runtimeError("RUNTIME.TRANSACTION_CLOSED", "Cannot use a transaction operation after the transaction has ended. Consume query results and await execute calls inside the transaction callback.", {});
|
|
1655
|
+
return runtimeError$1("RUNTIME.TRANSACTION_CLOSED", "Cannot use a transaction operation after the transaction has ended. Consume query results and await execute calls inside the transaction callback.", {});
|
|
1656
1656
|
}
|
|
1657
1657
|
async function withTransaction(runtime, fn) {
|
|
1658
1658
|
const connection = await runtime.connection();
|
|
@@ -1701,7 +1701,7 @@ async function withTransaction(runtime, fn) {
|
|
|
1701
1701
|
await transaction.rollback();
|
|
1702
1702
|
} catch (rollbackError) {
|
|
1703
1703
|
await destroyConnection(rollbackError);
|
|
1704
|
-
const wrapped = runtimeError("RUNTIME.TRANSACTION_ROLLBACK_FAILED", "Transaction rollback failed after callback error", { rollbackError });
|
|
1704
|
+
const wrapped = runtimeError$1("RUNTIME.TRANSACTION_ROLLBACK_FAILED", "Transaction rollback failed after callback error", { rollbackError });
|
|
1705
1705
|
wrapped.cause = error;
|
|
1706
1706
|
throw wrapped;
|
|
1707
1707
|
}
|
|
@@ -1717,7 +1717,7 @@ async function withTransaction(runtime, fn) {
|
|
|
1717
1717
|
} catch {
|
|
1718
1718
|
await destroyConnection(commitError);
|
|
1719
1719
|
}
|
|
1720
|
-
const wrapped = runtimeError("RUNTIME.TRANSACTION_COMMIT_FAILED", "Transaction commit failed", { commitError });
|
|
1720
|
+
const wrapped = runtimeError$1("RUNTIME.TRANSACTION_COMMIT_FAILED", "Transaction commit failed", { commitError });
|
|
1721
1721
|
wrapped.cause = commitError;
|
|
1722
1722
|
throw wrapped;
|
|
1723
1723
|
}
|