@prisma-next/sql-relational-core 0.5.0-dev.7 → 0.5.0-dev.71
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 +65 -1
- package/dist/{errors-D3xmG4h-.mjs → errors-Cb03_kgU.mjs} +2 -2
- package/dist/{errors-D3xmG4h-.mjs.map → errors-Cb03_kgU.mjs.map} +1 -1
- package/dist/{errors-ChY_dHam.d.mts → errors-DCg-36g-.d.mts} +2 -2
- package/dist/errors-DCg-36g-.d.mts.map +1 -0
- package/dist/exports/ast.d.mts +154 -85
- package/dist/exports/ast.d.mts.map +1 -1
- package/dist/exports/ast.mjs +229 -1289
- package/dist/exports/ast.mjs.map +1 -1
- package/dist/exports/codec-descriptor-registry.d.mts +17 -0
- package/dist/exports/codec-descriptor-registry.d.mts.map +1 -0
- package/dist/exports/codec-descriptor-registry.mjs +40 -0
- package/dist/exports/codec-descriptor-registry.mjs.map +1 -0
- package/dist/exports/errors.d.mts +1 -4
- package/dist/exports/errors.mjs +2 -3
- package/dist/exports/expression.d.mts +84 -0
- package/dist/exports/expression.d.mts.map +1 -0
- package/dist/exports/expression.mjs +62 -0
- package/dist/exports/expression.mjs.map +1 -0
- package/dist/exports/plan.d.mts +3 -2
- package/dist/exports/plan.mjs +1 -17
- package/dist/exports/query-lane-context.d.mts +2 -3
- package/dist/exports/query-lane-context.mjs +1 -1
- package/dist/exports/types.d.mts +3 -4
- package/dist/exports/types.mjs +1 -1
- package/dist/index.d.mts +10 -11
- package/dist/index.mjs +6 -5
- package/dist/plan-CZ6CFuSX.d.mts +24 -0
- package/dist/plan-CZ6CFuSX.d.mts.map +1 -0
- package/dist/query-lane-context-DaimN0zf.d.mts +174 -0
- package/dist/query-lane-context-DaimN0zf.d.mts.map +1 -0
- package/dist/sql-execution-plan-DgcD75jn.d.mts +32 -0
- package/dist/sql-execution-plan-DgcD75jn.d.mts.map +1 -0
- package/dist/types-BnLrX_Vr.d.mts +23 -0
- package/dist/types-BnLrX_Vr.d.mts.map +1 -0
- package/dist/{types-k9pir8XY.d.mts → types-Czw4j_wY.d.mts} +18 -25
- package/dist/types-Czw4j_wY.d.mts.map +1 -0
- package/dist/{types-C3Hg-CVz.d.mts → types-hwPoFZX2.d.mts} +36 -23
- package/dist/types-hwPoFZX2.d.mts.map +1 -0
- package/dist/types-vA5134SY.mjs +1072 -0
- package/dist/types-vA5134SY.mjs.map +1 -0
- package/package.json +16 -12
- package/src/ast/adapter-types.ts +6 -14
- package/src/ast/codec-types.ts +90 -372
- package/src/ast/sql-codec-helpers.ts +79 -0
- package/src/ast/sql-codecs.ts +285 -125
- package/src/ast/types.ts +170 -175
- package/src/ast/util.ts +23 -0
- package/src/ast/validate-param-refs.ts +39 -0
- package/src/codec-descriptor-registry.ts +52 -0
- package/src/exports/ast.ts +2 -0
- package/src/exports/codec-descriptor-registry.ts +1 -0
- package/src/exports/expression.ts +1 -0
- package/src/exports/plan.ts +1 -0
- package/src/exports/types.ts +1 -0
- package/src/expression.ts +134 -0
- package/src/index.ts +1 -0
- package/src/plan.ts +11 -30
- package/src/query-lane-context.ts +35 -55
- package/src/runtime-scope.ts +20 -0
- package/src/sql-execution-plan.ts +28 -0
- package/src/types.ts +9 -22
- package/dist/codec-types-DcEITed4.d.mts +0 -144
- package/dist/codec-types-DcEITed4.d.mts.map +0 -1
- package/dist/errors-ChY_dHam.d.mts.map +0 -1
- package/dist/exports/plan.mjs.map +0 -1
- package/dist/plan-Cs65hb-E.d.mts +0 -28
- package/dist/plan-Cs65hb-E.d.mts.map +0 -1
- package/dist/query-lane-context-UlR8vOkd.d.mts +0 -89
- package/dist/query-lane-context-UlR8vOkd.d.mts.map +0 -1
- package/dist/types-C3Hg-CVz.d.mts.map +0 -1
- package/dist/types-k9pir8XY.d.mts.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
import { Adapter, AdapterProfile, AdapterTarget, Lowerer, LowererContext, MarkerStatement, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID,
|
|
4
|
-
import {
|
|
5
|
-
import { a as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import "./
|
|
9
|
-
import "./
|
|
10
|
-
|
|
11
|
-
export { Adapter, AdapterProfile, AdapterTarget, AggregateCountFn, AggregateExpr, AggregateFn, AggregateOpFn, AndExpr, AnyExpression, AnyFromSource, AnyInsertOnConflictAction, AnyInsertValue, AnyOperationArg, AnyQueryAst, AppliedMutationDefault, AstRewriter, BinaryExpr, BinaryOp, BuildOptions, BuildParamsMap, Codec, CodecDefBuilder, CodecId, CodecInput, CodecMeta, CodecOutput, CodecParamsDescriptor, CodecRegistry, CodecTrait, CodecTraits, CodecTypes, ColumnRef, ColumnsOf, ComputeColumnJsType, DefaultValueExpr, DeleteAst, DerivedTableSource, Direction, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExecutionContext, ExistsExpr, Expr, ExprVisitor, ExpressionFolder, ExpressionRewriter, ExpressionSource, ExtractCodecTypes, ExtractDataTypes, HasIncludeManyCapabilities, IdentifierRef, InsertAst, InsertOnConflict, InsertValue, JoinAst, JoinOnExpr, JsonArrayAggExpr, JsonObjectEntry, JsonObjectExpr, JsonSchemaValidateFn, JsonSchemaValidationError, JsonSchemaValidationResult, JsonSchemaValidatorRegistry, ListExpression, LiteralExpr, LoweredStatement, Lowerer, LowererContext, META, MarkerStatement, Meta, ModelDef, ModelMetadata, MutationDefaultsOp, MutationDefaultsOptions, NotExpr, NullCheckExpr, OperationExpr, OperationTypeSignature, OperationTypes, OperationsForTypeId, OrExpr, OrderByItem, ParamRef, ProjectionExpr, ProjectionItem, RawFactory, RawFunctionOptions, RawTemplateFactory, RawTemplateOptions, ResultType, RuntimeError, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, SelectAst, SelectAstOptions, SqlBuilderOptions, SqlCodecTypes, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, SqlExplainResult, SqlPlan, SqlQueryPlan, SqlQueryResult, SqlQueryable, SqlTransaction, SubqueryExpr, TableDef, TableKey, TableMetadata, TableRef, TableSource, TablesOf, ToWhereExpr, TypeHelperRegistry, UpdateAst, WhereArg, augmentDescriptorWithColumnMeta, codec, compact, createCodecRegistry, defineCodecs, isQueryAst, isWhereExpr, planInvalid, planUnsupported, queryAstKinds, sqlCodecDefinitions, sqlDataTypes, whereExprKinds };
|
|
1
|
+
import { $ as TableSource, A as InsertOnConflict, B as NotExpr, C as ExistsExpr, D as ExpressionSource, E as ExpressionRewriter, F as JsonObjectEntry, G as ParamRef, H as OperationExpr, I as JsonObjectExpr, J as ProjectionItem, K as ParamRefBindingRefs, L as ListExpression, M as JoinAst, N as JoinOnExpr, O as IdentifierRef, P as JsonArrayAggExpr, Q as TableRef, R as LiteralExpr, S as EqColJoinOn, T as ExpressionFolder, U as OrExpr, V as NullCheckExpr, W as OrderByItem, X as SelectAstOptions, Y as SelectAst, Z as SubqueryExpr, _ as DeleteAst, a as AndExpr, at as queryAstKinds, b as DoNothingConflictAction, c as AnyInsertOnConflictAction, d as AnyQueryAst, et as ToWhereExpr, f as AstRewriter, g as DefaultValueExpr, h as ColumnRef, i as AggregateOpFn, it as isWhereExpr, j as InsertValue, k as InsertAst, l as AnyInsertValue, m as BinaryOp, n as AggregateExpr, nt as WhereArg, o as AnyExpression, ot as whereExprKinds, p as BinaryExpr, q as ProjectionExpr, r as AggregateFn, rt as isQueryAst, s as AnyFromSource, t as AggregateCountFn, tt as UpdateAst, u as AnyOperationArg, v as DerivedTableSource, w as ExprVisitor, x as DoUpdateSetConflictAction, y as Direction, z as LoweredStatement } from "./types-hwPoFZX2.mjs";
|
|
2
|
+
import { _ as ExtractCodecTypes, a as MutationDefaultsOptions, b as SqlColumnRef, c as Codec, d as CodecMeta, f as CodecTrait, g as DescriptorCodecTraits, h as DescriptorCodecInput, i as MutationDefaultsOp, l as CodecCallContext, m as DescriptorCodecId, n as CodecDescriptorRegistry, o as TypeHelperRegistry, p as ContractCodecRegistry, r as ExecutionContext, s as AnyCodecDescriptor, t as AppliedMutationDefault, u as CodecDescriptor, v as SqlCodecCallContext, y as SqlCodecInstanceContext } from "./query-lane-context-DaimN0zf.mjs";
|
|
3
|
+
import { Adapter, AdapterProfile, AdapterTarget, Lowerer, LowererContext, MarkerStatement, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, SqlCharCodec, SqlCharDescriptor, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, SqlExplainResult, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlQueryResult, SqlQueryable, SqlTextCodec, SqlTextDescriptor, SqlTimestampCodec, SqlTimestampDescriptor, SqlTransaction, SqlVarcharCodec, SqlVarcharDescriptor, collectOrderedParamRefs, compact, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDescriptor, sqlFloatEncode, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlTimestampColumn, sqlTimestampDecode, sqlTimestampDecodeJson, sqlTimestampDescriptor, sqlTimestampEncode, sqlTimestampEncodeJson, sqlTimestampRenderOutputType, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, validateParamRefRefs } from "./exports/ast.mjs";
|
|
4
|
+
import { t as SqlExecutionPlan } from "./sql-execution-plan-DgcD75jn.mjs";
|
|
5
|
+
import { C as TableKey, S as TableDef, T as TablesOf, _ as RawTemplateFactory, a as ComputeColumnJsType, b as SqlBuilderOptions, c as META, d as ModelMetadata, f as OperationTypeSignature, g as RawFunctionOptions, h as RawFactory, i as ColumnsOf, l as Meta, m as OperationsForTypeId, n as BuildParamsMap, o as Expr, p as OperationTypes, r as CodecTypes, s as HasIncludeManyCapabilities, t as BuildOptions, u as ModelDef, v as RawTemplateOptions, w as TableMetadata, x as SqlPlan, y as RuntimeError } from "./types-Czw4j_wY.mjs";
|
|
6
|
+
import { n as planUnsupported, t as planInvalid } from "./errors-DCg-36g-.mjs";
|
|
7
|
+
import { BuildOperationSpec, CodecExpression, Expression, ScopeField, TraitExpression, buildOperation, refsOf, toExpr } from "./exports/expression.mjs";
|
|
8
|
+
import { t as SqlQueryPlan } from "./plan-CZ6CFuSX.mjs";
|
|
9
|
+
import { n as SqlOrmPlan, t as RuntimeScope } from "./types-BnLrX_Vr.mjs";
|
|
10
|
+
export { Adapter, AdapterProfile, AdapterTarget, AggregateCountFn, AggregateExpr, AggregateFn, AggregateOpFn, AndExpr, AnyCodecDescriptor, AnyExpression, AnyFromSource, AnyInsertOnConflictAction, AnyInsertValue, AnyOperationArg, AnyQueryAst, AppliedMutationDefault, AstRewriter, BinaryExpr, BinaryOp, BuildOperationSpec, BuildOptions, BuildParamsMap, Codec, CodecCallContext, CodecDescriptor, CodecDescriptorRegistry, CodecExpression, CodecMeta, CodecTrait, CodecTypes, ColumnRef, ColumnsOf, ComputeColumnJsType, ContractCodecRegistry, DefaultValueExpr, DeleteAst, DerivedTableSource, DescriptorCodecId, DescriptorCodecInput, DescriptorCodecTraits, Direction, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExecutionContext, ExistsExpr, Expr, ExprVisitor, Expression, ExpressionFolder, ExpressionRewriter, ExpressionSource, ExtractCodecTypes, HasIncludeManyCapabilities, IdentifierRef, InsertAst, InsertOnConflict, InsertValue, JoinAst, JoinOnExpr, JsonArrayAggExpr, JsonObjectEntry, JsonObjectExpr, ListExpression, LiteralExpr, LoweredStatement, Lowerer, LowererContext, META, MarkerStatement, Meta, ModelDef, ModelMetadata, MutationDefaultsOp, MutationDefaultsOptions, NotExpr, NullCheckExpr, OperationExpr, OperationTypeSignature, OperationTypes, OperationsForTypeId, OrExpr, OrderByItem, ParamRef, ParamRefBindingRefs, ProjectionExpr, ProjectionItem, RawFactory, RawFunctionOptions, RawTemplateFactory, RawTemplateOptions, RuntimeError, RuntimeScope, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, ScopeField, SelectAst, SelectAstOptions, SqlBuilderOptions, SqlCharCodec, SqlCharDescriptor, SqlCodecCallContext, SqlCodecInstanceContext, SqlColumnRef, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, SqlExecutionPlan, SqlExplainResult, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlOrmPlan, SqlPlan, SqlQueryPlan, SqlQueryResult, SqlQueryable, SqlTextCodec, SqlTextDescriptor, SqlTimestampCodec, SqlTimestampDescriptor, SqlTransaction, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableDef, TableKey, TableMetadata, TableRef, TableSource, TablesOf, ToWhereExpr, TraitExpression, TypeHelperRegistry, UpdateAst, WhereArg, buildOperation, collectOrderedParamRefs, compact, isQueryAst, isWhereExpr, planInvalid, planUnsupported, queryAstKinds, refsOf, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDescriptor, sqlFloatEncode, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlTimestampColumn, sqlTimestampDecode, sqlTimestampDecodeJson, sqlTimestampDescriptor, sqlTimestampEncode, sqlTimestampEncodeJson, sqlTimestampRenderOutputType, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, toExpr, validateParamRefRefs, whereExprKinds };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { A as UpdateAst, C as OrExpr, D as SelectAst, E as ProjectionItem, M as isWhereExpr, N as queryAstKinds, O as SubqueryExpr, P as whereExprKinds, S as OperationExpr, T as ParamRef, _ as JsonObjectExpr, a as DefaultValueExpr, b as NotExpr, c as DoNothingConflictAction, d as ExistsExpr, f as IdentifierRef, g as JsonArrayAggExpr, h as JoinAst, i as ColumnRef, j as isQueryAst, k as TableSource, l as DoUpdateSetConflictAction, m as InsertOnConflict, n as AndExpr, o as DeleteAst, p as InsertAst, r as BinaryExpr, s as DerivedTableSource, t as AggregateExpr, u as EqColJoinOn, v as ListExpression, w as OrderByItem, x as NullCheckExpr, y as LiteralExpr } from "./types-vA5134SY.mjs";
|
|
2
|
+
import { SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, SqlCharCodec, SqlCharDescriptor, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlTextCodec, SqlTextDescriptor, SqlTimestampCodec, SqlTimestampDescriptor, SqlVarcharCodec, SqlVarcharDescriptor, collectOrderedParamRefs, compact, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDescriptor, sqlFloatEncode, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlTimestampColumn, sqlTimestampDecode, sqlTimestampDecodeJson, sqlTimestampDescriptor, sqlTimestampEncode, sqlTimestampEncodeJson, sqlTimestampRenderOutputType, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, validateParamRefRefs } from "./exports/ast.mjs";
|
|
3
|
+
import { n as planUnsupported, t as planInvalid } from "./errors-Cb03_kgU.mjs";
|
|
4
|
+
import { buildOperation, refsOf, toExpr } from "./exports/expression.mjs";
|
|
5
|
+
import "./exports/plan.mjs";
|
|
4
6
|
import "./exports/query-lane-context.mjs";
|
|
5
7
|
import "./exports/types.mjs";
|
|
6
|
-
|
|
7
|
-
export { AggregateExpr, AndExpr, BinaryExpr, ColumnRef, DefaultValueExpr, DeleteAst, DerivedTableSource, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, IdentifierRef, InsertAst, InsertOnConflict, JoinAst, JsonArrayAggExpr, JsonObjectExpr, ListExpression, LiteralExpr, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, ProjectionItem, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, SelectAst, SubqueryExpr, TableSource, UpdateAst, augmentDescriptorWithColumnMeta, codec, compact, createCodecRegistry, defineCodecs, isQueryAst, isWhereExpr, planInvalid, planUnsupported, queryAstKinds, sqlCodecDefinitions, sqlDataTypes, whereExprKinds };
|
|
8
|
+
export { AggregateExpr, AndExpr, BinaryExpr, ColumnRef, DefaultValueExpr, DeleteAst, DerivedTableSource, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, IdentifierRef, InsertAst, InsertOnConflict, JoinAst, JsonArrayAggExpr, JsonObjectExpr, ListExpression, LiteralExpr, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, ProjectionItem, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, SelectAst, SqlCharCodec, SqlCharDescriptor, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlTextCodec, SqlTextDescriptor, SqlTimestampCodec, SqlTimestampDescriptor, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableSource, UpdateAst, buildOperation, collectOrderedParamRefs, compact, isQueryAst, isWhereExpr, planInvalid, planUnsupported, queryAstKinds, refsOf, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDescriptor, sqlFloatEncode, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlTimestampColumn, sqlTimestampDecode, sqlTimestampDecodeJson, sqlTimestampDescriptor, sqlTimestampEncode, sqlTimestampEncodeJson, sqlTimestampRenderOutputType, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, toExpr, validateParamRefRefs, whereExprKinds };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { d as AnyQueryAst } from "./types-hwPoFZX2.mjs";
|
|
2
|
+
import { QueryPlan } from "@prisma-next/framework-components/runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/plan.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* SQL query plan produced by lanes before lowering.
|
|
7
|
+
*
|
|
8
|
+
* Lanes build ASTs and metadata but do not perform SQL lowering. The `sql`
|
|
9
|
+
* field is absent — `RuntimeCore` (the runtime base class in
|
|
10
|
+
* `@prisma-next/framework-components/runtime`) drives lowering via the
|
|
11
|
+
* SQL adapter and produces a `SqlExecutionPlan`.
|
|
12
|
+
*
|
|
13
|
+
* Extends the framework-level `QueryPlan<Row>` marker (`meta + _row`) and
|
|
14
|
+
* adds SQL-specific fields (`ast`, `params`). The phantom `_row` property
|
|
15
|
+
* (inherited from `QueryPlan`) is what `ResultType<P>` inspects to recover
|
|
16
|
+
* the row type.
|
|
17
|
+
*/
|
|
18
|
+
interface SqlQueryPlan<Row = unknown> extends QueryPlan<Row> {
|
|
19
|
+
readonly ast: AnyQueryAst;
|
|
20
|
+
readonly params: readonly unknown[];
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { SqlQueryPlan as t };
|
|
24
|
+
//# sourceMappingURL=plan-CZ6CFuSX.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-CZ6CFuSX.d.mts","names":[],"sources":["../src/plan.ts"],"mappings":";;;;;;AAgBA;;;;;;;;;;;UAAiB,YAAA,wBAAoC,SAAA,CAAU,GAAA;EAAA,SACpD,GAAA,EAAK,WAAA;EAAA,SACL,MAAA;AAAA"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { Codec, CodecCallContext, CodecCallContext as CodecCallContext$1, CodecDescriptor, CodecDescriptor as CodecDescriptor$1, CodecInstanceContext, CodecTrait, CodecTrait as CodecTrait$1 } from "@prisma-next/framework-components/codec";
|
|
2
|
+
import { Contract } from "@prisma-next/contract/types";
|
|
3
|
+
import { SqlOperationRegistry } from "@prisma-next/sql-operations";
|
|
4
|
+
import { SqlStorage } from "@prisma-next/sql-contract/types";
|
|
5
|
+
|
|
6
|
+
//#region src/ast/codec-types.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* SQL-family addressing of a single column. The decode site populates a `SqlColumnRef` whenever it can resolve the cell to a single underlying `(table, column)` (the typical case for projected columns from a single-table source); cells the runtime cannot resolve (aggregate aliases, include aggregate fields, computed projections without a simple ref) get `column = undefined`.
|
|
9
|
+
*
|
|
10
|
+
* The shape is a structural projection of the runtime's `ColumnRef` so the SQL decode site can reuse the resolution it already performs for `RUNTIME.DECODE_FAILED` envelope construction without allocating twice per cell.
|
|
11
|
+
*/
|
|
12
|
+
interface SqlColumnRef {
|
|
13
|
+
readonly table: string;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* SQL-family per-call context. Extends the framework {@link CodecCallContext} (which carries `signal` only) with `column?: SqlColumnRef`, populated on **decode** call sites that can resolve a single underlying column ref. Encode call sites currently leave `column` undefined (encode-time column context is the middleware's domain).
|
|
18
|
+
*
|
|
19
|
+
* SQL codec authors writing codec methods observe this type via {@link SqlCodec}. The framework codec dispatch surface (and Mongo) sees only the base `CodecCallContext`.
|
|
20
|
+
*/
|
|
21
|
+
interface SqlCodecCallContext extends CodecCallContext {
|
|
22
|
+
readonly column?: SqlColumnRef;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* SQL-family per-instance context. Extends the framework {@link CodecInstanceContext} (`name` only) with `usedAt`, the set of `(table, column)` pairs the resolved codec serves.
|
|
26
|
+
*
|
|
27
|
+
* - For `typeRef` columns sharing one named `storage.types` instance, the array lists every referencing column — a column-scoped stateful codec (e.g. encryption) can derive aggregated per-instance state across all the columns sharing the named instance.
|
|
28
|
+
* - For inline-`typeParams` columns, the array has exactly one entry — the column that owns the inline params.
|
|
29
|
+
* - For shared non-parameterized codecs, the array carries one representative entry (the column that triggered materialization); the codec is shared across every column with that codec id, so the `usedAt` is informational only.
|
|
30
|
+
*
|
|
31
|
+
* SQL extensions consuming `usedAt` (e.g. column-scoped state derivation) type their factory parameter as `SqlCodecInstanceContext`. Extensions that don't read `usedAt` type their factory parameter as the family-agnostic {@link CodecInstanceContext} — a `SqlCodecInstanceContext` is structurally assignable to the base.
|
|
32
|
+
*/
|
|
33
|
+
interface SqlCodecInstanceContext extends CodecInstanceContext {
|
|
34
|
+
readonly usedAt: ReadonlyArray<{
|
|
35
|
+
readonly table: string;
|
|
36
|
+
readonly column: string;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Codec metadata for database-specific type information. Used for schema introspection and verification.
|
|
41
|
+
*/
|
|
42
|
+
interface CodecMeta {
|
|
43
|
+
readonly db?: {
|
|
44
|
+
readonly sql?: {
|
|
45
|
+
readonly postgres?: {
|
|
46
|
+
readonly nativeType: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* SQL codec — extends the framework codec base by narrowing the per-call context to the SQL-family {@link SqlCodecCallContext} (adds `column?: SqlColumnRef`). TypeScript treats method-syntax declarations bivariantly, so the SQL narrowing is structurally compatible with the framework {@link BaseCodec} super-interface.
|
|
53
|
+
*
|
|
54
|
+
* Codec-id-keyed static metadata (`traits`, `targetTypes`, `meta`, `paramsSchema`, `renderOutputType`) lives on the unified {@link import('@prisma-next/framework-components/codec').CodecDescriptor} — the codec instance itself only carries `id` plus the four conversion methods.
|
|
55
|
+
*
|
|
56
|
+
* See `Codec` in `@prisma-next/framework-components/codec` for the codec contract that this interface extends.
|
|
57
|
+
*/
|
|
58
|
+
interface Codec$1<Id extends string = string, TTraits extends readonly CodecTrait[] = readonly CodecTrait[], TWire = unknown, TInput = unknown> extends Codec<Id, TTraits, TWire, TInput> {
|
|
59
|
+
encode(value: TInput, ctx: SqlCodecCallContext): Promise<TWire>;
|
|
60
|
+
decode(wire: TWire, ctx: SqlCodecCallContext): Promise<TInput>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Contract-bound codec registry.
|
|
64
|
+
*
|
|
65
|
+
* The dispatch interface for encode/decode at runtime: built once at `ExecutionContext` construction time by walking the contract's `storage.tables[].columns[]` and resolving each column through its descriptor's factory (per-instance for parameterized columns; the cached shared codec for non-parameterized columns). The dispatch path calls `forColumn(table, column).encode/decode(...)` and doesn't know whether the codec
|
|
66
|
+
* is parameterized.
|
|
67
|
+
*
|
|
68
|
+
* `forCodecId(codecId)` is the refs-less fallback. Every column-bound `ParamRef` carries `refs: { table; column }` and the builder-pipeline `validateParamRefRefs` pass enforces refs on every parameterized `ParamRef` before encode runs, so this fallback is only reached for non-parameterized codec ids.
|
|
69
|
+
*/
|
|
70
|
+
interface ContractCodecRegistry {
|
|
71
|
+
/**
|
|
72
|
+
* Resolve the codec for `(table, column)`. Returns the per-instance parameterized codec for parameterized columns, the shared codec for non-parameterized columns, or `undefined` if the column is unknown or the codec isn't registered.
|
|
73
|
+
*/
|
|
74
|
+
forColumn(table: string, column: string): Codec$1 | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Resolve a codec by id. For non-parameterized codecs this returns the canonical shared instance materialized once at context construction; for parameterized codecs it returns the column-resolved instance when a single column declares the codec id, or the `factory(undefined)` representative when the descriptor's factory is parameter-tolerant. Used by refs-less call sites; the validator pass guarantees the call site's
|
|
77
|
+
* `codecId` is non-parameterized (or parameter-tolerant) at this boundary.
|
|
78
|
+
*/
|
|
79
|
+
forCodecId(codecId: string): Codec$1 | undefined;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Variance-erased descriptor type used for heterogeneous storage in collection containers and on the unified contributor `codecs:` slot. The descriptor's `factory` and `renderOutputType` are contravariant in `P`, so descriptors with different params shapes are not in a subtype relationship; collecting them into one container needs an explicit variance erasure rather than `CodecDescriptor<unknown>` (which is the
|
|
83
|
+
* narrowest, not the widest, of the family).
|
|
84
|
+
*/
|
|
85
|
+
type AnyCodecDescriptor = CodecDescriptor<any>;
|
|
86
|
+
type DescriptorResolvedCodec<D> = D extends CodecDescriptor<infer _P> ? ReturnType<ReturnType<D['factory']>> : never;
|
|
87
|
+
type DescriptorCodecId<D> = D extends AnyCodecDescriptor ? D['codecId'] : never;
|
|
88
|
+
type DescriptorCodecInput<D> = DescriptorResolvedCodec<D> extends Codec<string, readonly CodecTrait[], unknown, infer In> ? In : never;
|
|
89
|
+
/**
|
|
90
|
+
* Resolve the trait union for a descriptor `D`.
|
|
91
|
+
*
|
|
92
|
+
* Reads `traits` directly off the descriptor — concrete descriptor classes declare `override readonly traits = [...] as const`, which preserves the literal trait tuple at the descriptor type. Reading from the resolved codec instance (`CodecImpl<…, TTraits, …>`) would lose the literal because `Codec` carries `TTraits` only on its optional phantom slot (`readonly __codecTraits?: TTraits`); codecs extending `CodecImpl`
|
|
93
|
+
* have no required structural site that pins `TTraits`, so a descriptor-keyed extractor reading from the codec instance would widen to the broad `CodecTrait` union.
|
|
94
|
+
*/
|
|
95
|
+
type DescriptorCodecTraits<D> = D extends {
|
|
96
|
+
readonly traits: infer TTraits extends readonly CodecTrait[];
|
|
97
|
+
} ? TTraits[number] & CodecTrait : never;
|
|
98
|
+
/**
|
|
99
|
+
* Project a record of {@link AnyCodecDescriptor}s keyed by scalar name onto the codec-id-keyed `CodecTypes` shape consumed by emit and no-emit type pipelines (`{ readonly [codecId]: { input; output; traits } }`).
|
|
100
|
+
*
|
|
101
|
+
* Canonical extractor for the descriptor-keyed type pipeline; the legacy instance-keyed extractor and its `mkCodec`-bound builder retired alongside the carrier deletion.
|
|
102
|
+
*/
|
|
103
|
+
type ExtractCodecTypes<ScalarNames extends { readonly [K in keyof ScalarNames]: AnyCodecDescriptor } = Record<never, never>> = { readonly [K in keyof ScalarNames as DescriptorCodecId<ScalarNames[K]>]: {
|
|
104
|
+
readonly input: DescriptorCodecInput<ScalarNames[K]>;
|
|
105
|
+
readonly output: DescriptorCodecInput<ScalarNames[K]>;
|
|
106
|
+
readonly traits: DescriptorCodecTraits<ScalarNames[K]>;
|
|
107
|
+
} };
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/query-lane-context.d.ts
|
|
110
|
+
/**
|
|
111
|
+
* Codec-id-keyed accessor for descriptor metadata. The unified read API for codec-id-keyed metadata (`traits`, `targetTypes`, `meta`) — non-branching for parameterized vs. non-parameterized codecs. Every codec ships natively as a `CodecDescriptor` through the unified `codecs:` contributor slot (see ADR 208).
|
|
112
|
+
*/
|
|
113
|
+
interface CodecDescriptorRegistry {
|
|
114
|
+
/**
|
|
115
|
+
* Descriptors carry distinct param shapes per codec id; the registry is heterogeneous and the consumer narrows per codec.
|
|
116
|
+
*/
|
|
117
|
+
descriptorFor(codecId: string): CodecDescriptor<unknown> | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* All registered descriptors. Used by `validateCodecRegistryCompleteness` and other startup-time consumers that enumerate descriptors.
|
|
120
|
+
*/
|
|
121
|
+
values(): IterableIterator<CodecDescriptor<unknown>>;
|
|
122
|
+
/**
|
|
123
|
+
* Descriptors indexed by `targetTypes[i]` (each scalar type the codec advertises). Multiple descriptors may map to the same scalar type; ordering reflects registration order.
|
|
124
|
+
*/
|
|
125
|
+
byTargetType(targetType: string): readonly CodecDescriptor<unknown>[];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Registry of initialized type helpers from storage.types. Each key is a type name from storage.types, and the value is the resolved codec materialized once for that named instance via `descriptor.factory(typeParams)(ctx)` (or the raw `StorageTypeInstance` metadata for codec ids whose descriptor isn't registered).
|
|
129
|
+
*/
|
|
130
|
+
type TypeHelperRegistry = Record<string, unknown>;
|
|
131
|
+
type MutationDefaultsOp = 'create' | 'update';
|
|
132
|
+
type AppliedMutationDefault = {
|
|
133
|
+
readonly column: string;
|
|
134
|
+
readonly value: unknown;
|
|
135
|
+
};
|
|
136
|
+
type MutationDefaultsOptions = {
|
|
137
|
+
readonly op: MutationDefaultsOp;
|
|
138
|
+
readonly table: string;
|
|
139
|
+
readonly values: Record<string, unknown>;
|
|
140
|
+
/**
|
|
141
|
+
* Per-ORM-operation cache for generators that declare `stability: 'query'`. The caller passes the same `Map` across every `applyMutationDefaults` invocation in one bulk operation; the framework keys by `generatorId` so the same value is reused across all rows and columns. Generators with `stability: 'row'` use a fresh per-call cache the framework manages internally; generators with `stability: 'field'` skip caching
|
|
142
|
+
* entirely. Omit to make every call independent (degrades `'query'` to per-call behavior).
|
|
143
|
+
*/
|
|
144
|
+
readonly defaultValueCache?: Map<string, unknown>;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Minimal context interface for SQL query lanes.
|
|
148
|
+
*
|
|
149
|
+
* Lanes only need contract, operations, and codecs to build typed ASTs and attach operation builders. This interface explicitly excludes runtime concerns like adapters, connection management, and transaction state.
|
|
150
|
+
*/
|
|
151
|
+
interface ExecutionContext<TContract extends Contract<SqlStorage> = Contract<SqlStorage>> {
|
|
152
|
+
readonly contract: TContract;
|
|
153
|
+
/**
|
|
154
|
+
* Contract-bound codec registry built once at context-construction time by walking the contract's columns and resolving each through its descriptor's factory. The dispatch path (`encodeParam` / `decodeRow`) consults `forColumn(table, column)` for column-bound call sites; `forCodecId(codecId)` is the refs-less fallback, permitted only for non-parameterized codec ids (the builder-pipeline validator pass enforces refs on
|
|
155
|
+
* every parameterized `ParamRef`). Pre-populated with one canonical instance per non-parameterized descriptor so `forCodecId` covers refs-less codec ids that no contract column declares.
|
|
156
|
+
*/
|
|
157
|
+
readonly contractCodecs: ContractCodecRegistry;
|
|
158
|
+
/**
|
|
159
|
+
* Codec-id-keyed descriptor map. Single source of truth for codec-id-keyed metadata (`traits`, `targetTypes`, `meta`) — every codec, parameterized or not, resolves through this map without branching.
|
|
160
|
+
*/
|
|
161
|
+
readonly codecDescriptors: CodecDescriptorRegistry;
|
|
162
|
+
readonly queryOperations: SqlOperationRegistry;
|
|
163
|
+
/**
|
|
164
|
+
* Type helper registry for parameterized types. Schema builders expose these helpers via schema.types.
|
|
165
|
+
*/
|
|
166
|
+
readonly types: TypeHelperRegistry;
|
|
167
|
+
/**
|
|
168
|
+
* Applies execution-time mutation defaults for the given table. Returns the applied defaults (caller-provided values always win).
|
|
169
|
+
*/
|
|
170
|
+
applyMutationDefaults(options: MutationDefaultsOptions): ReadonlyArray<AppliedMutationDefault>;
|
|
171
|
+
}
|
|
172
|
+
//#endregion
|
|
173
|
+
export { ExtractCodecTypes as _, MutationDefaultsOptions as a, SqlColumnRef as b, Codec$1 as c, CodecMeta as d, CodecTrait$1 as f, DescriptorCodecTraits as g, DescriptorCodecInput as h, MutationDefaultsOp as i, CodecCallContext$1 as l, DescriptorCodecId as m, CodecDescriptorRegistry as n, TypeHelperRegistry as o, ContractCodecRegistry as p, ExecutionContext as r, AnyCodecDescriptor as s, AppliedMutationDefault as t, CodecDescriptor$1 as u, SqlCodecCallContext as v, SqlCodecInstanceContext as y };
|
|
174
|
+
//# sourceMappingURL=query-lane-context-DaimN0zf.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-lane-context-DaimN0zf.d.mts","names":[],"sources":["../src/ast/codec-types.ts","../src/query-lane-context.ts"],"mappings":";;;;;;;;;;AAmBA;UAAiB,YAAA;EAAA,SACN,KAAA;EAAA,SACA,IAAA;AAAA;AAQX;;;;;AAAA,UAAiB,mBAAA,SAA4B,gBAAA;EAAA,SAClC,MAAA,GAAS,YAAA;AAAA;;AAYpB;;;;;;;;UAAiB,uBAAA,SAAgC,oBAAA;EAAA,SACtC,MAAA,EAAQ,aAAA;IAAA,SAAyB,KAAA;IAAA,SAAwB,MAAA;EAAA;AAAA;;;;UAMnD,SAAA;EAAA,SACN,EAAA;IAAA,SACE,GAAA;MAAA,SACE,QAAA;QAAA,SACE,UAAA;MAAA;IAAA;EAAA;AAAA;;;;;;;;UAaA,OAAA,sDAEU,UAAA,cAAwB,UAAA,+CAGzC,KAAA,CAAU,EAAA,EAAI,OAAA,EAAS,KAAA,EAAO,MAAA;EACtC,MAAA,CAAO,KAAA,EAAO,MAAA,EAAQ,GAAA,EAAK,mBAAA,GAAsB,OAAA,CAAQ,KAAA;EACzD,MAAA,CAAO,IAAA,EAAM,KAAA,EAAO,GAAA,EAAK,mBAAA,GAAsB,OAAA,CAAQ,MAAA;AAAA;;;;;;;;;UAWxC,qBAAA;EAdf;;;EAkBA,SAAA,CAAU,KAAA,UAAe,MAAA,WAAiB,OAAA;EAjBX;;;;EAuB/B,UAAA,CAAW,OAAA,WAAkB,OAAA;AAAA;;;;;KAQnB,kBAAA,GAAqB,eAAA;AAAA,KAE5B,uBAAA,MACH,CAAA,SAAU,eAAA,aAA4B,UAAA,CAAW,UAAA,CAAW,CAAA;AAAA,KAElD,iBAAA,MAAuB,CAAA,SAAU,kBAAA,GAAqB,CAAA;AAAA,KAEtD,oBAAA,MACV,uBAAA,CAAwB,CAAA,UAAW,KAAA,kBAA2B,UAAA,yBAC1D,EAAA;;;;;AA3BN;;KAoCY,qBAAA,MAA2B,CAAA;EAAA,SAC5B,MAAA,iCAAuC,UAAA;AAAA,IAE9C,OAAA,WAAkB,UAAA;;;;;;KAQV,iBAAA,4CAEa,WAAA,GAAc,kBAAA,KACjC,MAAA,yCAEiB,WAAA,IAAe,iBAAA,CAAkB,WAAA,CAAY,CAAA;EAAA,SACvD,KAAA,EAAO,oBAAA,CAAqB,WAAA,CAAY,CAAA;EAAA,SACxC,MAAA,EAAQ,oBAAA,CAAqB,WAAA,CAAY,CAAA;EAAA,SACzC,MAAA,EAAQ,qBAAA,CAAsB,WAAA,CAAY,CAAA;AAAA;;;;AAxHvD;;UCViB,uBAAA;EDWN;;AASX;EChBE,aAAA,CAAc,OAAA,WAAkB,eAAA;;;;EAIhC,MAAA,IAAU,gBAAA,CAAiB,eAAA;EDaT;;;ECTlB,YAAA,CAAa,UAAA,oBAA8B,eAAA;AAAA;;;;KAMjC,kBAAA,GAAqB,MAAA;AAAA,KAErB,kBAAA;AAAA,KAEA,sBAAA;EAAA,SACD,MAAA;EAAA,SACA,KAAA;AAAA;AAAA,KAGC,uBAAA;EAAA,SACD,EAAA,EAAI,kBAAA;EAAA,SACJ,KAAA;EAAA,SACA,MAAA,EAAQ,MAAA;EDWR;;;;EAAA,SCNA,iBAAA,GAAoB,GAAA;AAAA;ADsB/B;;;;;AAAA,UCdiB,gBAAA,mBAAmC,QAAA,CAAS,UAAA,IAAc,QAAA,CAAS,UAAA;EAAA,SACzE,QAAA,EAAU,SAAA;EDkBY;;;;EAAA,SCbtB,cAAA,EAAgB,qBAAA;EDcwB;;;EAAA,SCVxC,gBAAA,EAAkB,uBAAA;EAAA,SAClB,eAAA,EAAiB,oBAAA;EDQlB;;;EAAA,SCJC,KAAA,EAAO,kBAAA;EDChB;;;ECGA,qBAAA,CAAsB,OAAA,EAAS,uBAAA,GAA0B,aAAA,CAAc,sBAAA;AAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { d as AnyQueryAst } from "./types-hwPoFZX2.mjs";
|
|
2
|
+
import { ExecutionPlan } from "@prisma-next/framework-components/runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/sql-execution-plan.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* SQL-domain execution plan: a query lowered to the wire-level shape that a
|
|
7
|
+
* SQL driver can run.
|
|
8
|
+
*
|
|
9
|
+
* The plan carries:
|
|
10
|
+
* - `sql` — the rendered SQL text
|
|
11
|
+
* - `params` — the bound parameter list
|
|
12
|
+
* - `ast` — optional pre-lowering AST, retained for telemetry / debugging
|
|
13
|
+
* - `meta` — family-agnostic plan metadata (target, lane, hashes, ...)
|
|
14
|
+
* - `_row` — phantom row type, propagated from the originating `SqlQueryPlan`
|
|
15
|
+
*
|
|
16
|
+
* Extends the framework-level `ExecutionPlan<Row>` marker so generic SPIs
|
|
17
|
+
* (`RuntimeExecutor<SqlExecutionPlan>`, `RuntimeMiddleware<SqlExecutionPlan>`)
|
|
18
|
+
* can be parameterized over it.
|
|
19
|
+
*
|
|
20
|
+
* Co-located with `SqlQueryPlan` (its pre-lowering counterpart) in the lanes
|
|
21
|
+
* layer because lane-level utilities (`RawTemplateFactory`, `RawFactory`,
|
|
22
|
+
* `SqlPlan`) compose against the executable shape and the lanes layer cannot
|
|
23
|
+
* depend on the runtime layer.
|
|
24
|
+
*/
|
|
25
|
+
interface SqlExecutionPlan<Row = unknown> extends ExecutionPlan<Row> {
|
|
26
|
+
readonly sql: string;
|
|
27
|
+
readonly params: readonly unknown[];
|
|
28
|
+
readonly ast?: AnyQueryAst;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { SqlExecutionPlan as t };
|
|
32
|
+
//# sourceMappingURL=sql-execution-plan-DgcD75jn.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-execution-plan-DgcD75jn.d.mts","names":[],"sources":["../src/sql-execution-plan.ts"],"mappings":";;;;;;AAuBA;;;;;;;;;;;;;;;;;;UAAiB,gBAAA,wBAAwC,aAAA,CAAc,GAAA;EAAA,SAC5D,GAAA;EAAA,SACA,MAAA;EAAA,SACA,GAAA,GAAM,WAAA;AAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { t as SqlExecutionPlan } from "./sql-execution-plan-DgcD75jn.mjs";
|
|
2
|
+
import { t as SqlQueryPlan } from "./plan-CZ6CFuSX.mjs";
|
|
3
|
+
import { RuntimeExecutor } from "@prisma-next/framework-components/runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/runtime-scope.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* The plan shape accepted by the SQL ORM client and SQL runtime: either a
|
|
8
|
+
* pre-lowering `SqlQueryPlan` (AST + meta) or a post-lowering
|
|
9
|
+
* `SqlExecutionPlan` (sql + params + meta).
|
|
10
|
+
*/
|
|
11
|
+
type SqlOrmPlan = SqlExecutionPlan | SqlQueryPlan;
|
|
12
|
+
/**
|
|
13
|
+
* The minimal SQL-runtime surface that the ORM client and SQL runtime both
|
|
14
|
+
* depend on: the `execute` method of `RuntimeExecutor<SqlOrmPlan>`.
|
|
15
|
+
*
|
|
16
|
+
* Owned by `sql-relational-core` (lanes layer) so both
|
|
17
|
+
* `@prisma-next/sql-runtime` and `@prisma-next/sql-orm-client` consume the
|
|
18
|
+
* same source of truth without a layering inversion.
|
|
19
|
+
*/
|
|
20
|
+
type RuntimeScope = Pick<RuntimeExecutor<SqlOrmPlan>, 'execute'>;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { SqlOrmPlan as n, RuntimeScope as t };
|
|
23
|
+
//# sourceMappingURL=types-BnLrX_Vr.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-BnLrX_Vr.d.mts","names":[],"sources":["../src/runtime-scope.ts"],"mappings":";;;;;;;;AASA;;KAAY,UAAA,GAAa,gBAAA,GAAmB,YAAA;;;AAU5C;;;;;;KAAY,YAAA,GAAe,IAAA,CAAK,eAAA,CAAgB,UAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { G as ParamRef,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Contract
|
|
1
|
+
import { G as ParamRef, h as ColumnRef } from "./types-hwPoFZX2.mjs";
|
|
2
|
+
import { r as ExecutionContext } from "./query-lane-context-DaimN0zf.mjs";
|
|
3
|
+
import { t as SqlExecutionPlan } from "./sql-execution-plan-DgcD75jn.mjs";
|
|
4
|
+
import { Contract } from "@prisma-next/contract/types";
|
|
5
5
|
import { ParamSpec } from "@prisma-next/operations";
|
|
6
6
|
import { SqlLoweringSpec } from "@prisma-next/sql-operations";
|
|
7
7
|
import { ExtractFieldOutputTypes, SqlStorage, StorageColumn } from "@prisma-next/sql-contract/types";
|
|
@@ -28,11 +28,11 @@ type ExtractColumnToField<TContract extends Contract<SqlStorage>, TableName exte
|
|
|
28
28
|
} ? { [F in keyof Fields & string]: Fields[F] extends {
|
|
29
29
|
readonly column: ColumnName;
|
|
30
30
|
} ? F : never }[keyof Fields & string] : never : never : never : never;
|
|
31
|
-
type FallbackCodecLookup<ColumnMeta extends StorageColumn, CodecTypes
|
|
31
|
+
type FallbackCodecLookup<ColumnMeta extends StorageColumn, CodecTypes extends Record<string, {
|
|
32
32
|
readonly output: unknown;
|
|
33
33
|
}>> = ColumnMeta extends {
|
|
34
34
|
codecId: infer CodecId extends string;
|
|
35
|
-
} ? CodecId extends keyof CodecTypes
|
|
35
|
+
} ? CodecId extends keyof CodecTypes ? CodecTypes[CodecId] extends {
|
|
36
36
|
readonly output: infer O;
|
|
37
37
|
} ? ColumnMeta extends {
|
|
38
38
|
nullable: true;
|
|
@@ -91,9 +91,9 @@ type CodecTypes = Record<string, {
|
|
|
91
91
|
* ```
|
|
92
92
|
*/
|
|
93
93
|
type OperationsForTypeId<TypeId extends string, Operations extends OperationTypes> = Operations extends Record<string, never> ? Record<string, never> : TypeId extends keyof Operations ? Operations[TypeId] : Record<string, never>;
|
|
94
|
-
type ComputeColumnJsType<TContract extends Contract<SqlStorage>, TableName extends string, ColumnName extends string, ColumnMeta extends StorageColumn, CodecTypes
|
|
94
|
+
type ComputeColumnJsType<TContract extends Contract<SqlStorage>, TableName extends string, ColumnName extends string, ColumnMeta extends StorageColumn, CodecTypes extends Record<string, {
|
|
95
95
|
readonly output: unknown;
|
|
96
|
-
}>> = ExtractTableToModel<TContract, TableName> extends infer ModelName ? [ModelName] extends [never] ? FallbackCodecLookup<ColumnMeta, CodecTypes
|
|
96
|
+
}>> = ExtractTableToModel<TContract, TableName> extends infer ModelName ? [ModelName] extends [never] ? FallbackCodecLookup<ColumnMeta, CodecTypes> : ModelName extends string ? ExtractColumnToField<TContract, TableName, ColumnName> extends infer FieldName ? [FieldName] extends [never] ? FallbackCodecLookup<ColumnMeta, CodecTypes> : FieldName extends string ? ModelName extends keyof ExtractFieldOutputTypes<TContract> ? FieldName extends keyof ExtractFieldOutputTypes<TContract>[ModelName] ? ExtractFieldOutputTypes<TContract>[ModelName][FieldName] : never : never : never : never : never : never;
|
|
97
97
|
/**
|
|
98
98
|
* Utility type to check if a contract has the required capabilities for includeMany.
|
|
99
99
|
* Requires both `lateral` and `jsonAgg` to be `true` in the contract's capabilities for the target.
|
|
@@ -107,10 +107,11 @@ type HasIncludeManyCapabilities<TContract extends Contract<SqlStorage>> = TContr
|
|
|
107
107
|
jsonAgg: true;
|
|
108
108
|
} ? true : false : false : false : false : false;
|
|
109
109
|
/**
|
|
110
|
-
* SQL-
|
|
111
|
-
*
|
|
110
|
+
* Alias for the SQL-domain executable plan, exposed under the legacy
|
|
111
|
+
* `SqlPlan` name for compatibility with SQL builder/utility call sites.
|
|
112
|
+
* The canonical name is `SqlExecutionPlan` (`./sql-execution-plan`).
|
|
112
113
|
*/
|
|
113
|
-
type SqlPlan<Row = unknown> =
|
|
114
|
+
type SqlPlan<Row = unknown> = SqlExecutionPlan<Row>;
|
|
114
115
|
/**
|
|
115
116
|
* Helper types for extracting contract structure.
|
|
116
117
|
*/
|
|
@@ -127,9 +128,9 @@ declare const META: unique symbol;
|
|
|
127
128
|
/**
|
|
128
129
|
* Extracts metadata from a type that has a META property
|
|
129
130
|
*/
|
|
130
|
-
type Meta<T
|
|
131
|
+
type Meta<T extends {
|
|
131
132
|
[META]: unknown;
|
|
132
|
-
}> = T
|
|
133
|
+
}> = T[typeof META];
|
|
133
134
|
/**
|
|
134
135
|
* Metadata interface for table definitions
|
|
135
136
|
*/
|
|
@@ -160,16 +161,14 @@ type ColumnsOf<TContract, K extends TableKey<TContract>> = K extends keyof Table
|
|
|
160
161
|
columns: infer C;
|
|
161
162
|
} ? C : never : never;
|
|
162
163
|
interface RawTemplateOptions {
|
|
163
|
-
readonly refs?: PlanRefs;
|
|
164
164
|
readonly annotations?: Record<string, unknown>;
|
|
165
|
-
readonly projection?: ReadonlyArray<string>;
|
|
166
165
|
}
|
|
167
166
|
interface RawFunctionOptions extends RawTemplateOptions {
|
|
168
167
|
readonly params: ReadonlyArray<unknown>;
|
|
169
168
|
}
|
|
170
|
-
type RawTemplateFactory = (strings: TemplateStringsArray, ...values: readonly unknown[]) =>
|
|
169
|
+
type RawTemplateFactory = (strings: TemplateStringsArray, ...values: readonly unknown[]) => SqlExecutionPlan;
|
|
171
170
|
interface RawFactory extends RawTemplateFactory {
|
|
172
|
-
(text: string, options: RawFunctionOptions):
|
|
171
|
+
(text: string, options: RawFunctionOptions): SqlExecutionPlan;
|
|
173
172
|
with(options: RawTemplateOptions): RawTemplateFactory;
|
|
174
173
|
}
|
|
175
174
|
interface RuntimeError extends Error {
|
|
@@ -189,12 +188,6 @@ interface BuildOptions {
|
|
|
189
188
|
interface SqlBuilderOptions<TContract extends Contract<SqlStorage> = Contract<SqlStorage>> {
|
|
190
189
|
readonly context: ExecutionContext<TContract>;
|
|
191
190
|
}
|
|
192
|
-
/**
|
|
193
|
-
* SQL-specific ResultType that works with both Plan and SqlQueryPlan.
|
|
194
|
-
* This extends the core ResultType to also handle SqlQueryPlan.
|
|
195
|
-
* Example: `type Row = ResultType<typeof plan>`
|
|
196
|
-
*/
|
|
197
|
-
type ResultType$1<P> = P extends SqlQueryPlan<infer R> ? R : ResultType<P>;
|
|
198
191
|
//#endregion
|
|
199
|
-
export {
|
|
200
|
-
//# sourceMappingURL=types-
|
|
192
|
+
export { TableKey as C, TableDef as S, TablesOf as T, RawTemplateFactory as _, ComputeColumnJsType as a, SqlBuilderOptions as b, META as c, ModelMetadata as d, OperationTypeSignature as f, RawFunctionOptions as g, RawFactory as h, ColumnsOf as i, Meta as l, OperationsForTypeId as m, BuildParamsMap as n, Expr as o, OperationTypes as p, CodecTypes as r, HasIncludeManyCapabilities as s, BuildOptions as t, ModelDef as u, RawTemplateOptions as v, TableMetadata as w, SqlPlan as x, RuntimeError as y };
|
|
193
|
+
//# sourceMappingURL=types-Czw4j_wY.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-Czw4j_wY.d.mts","names":[],"sources":["../src/types.ts"],"mappings":"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"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PlanRefs } from "@prisma-next/contract/types";
|
|
2
1
|
import { ParamSpec } from "@prisma-next/operations";
|
|
3
2
|
import { SqlLoweringSpec } from "@prisma-next/sql-operations";
|
|
4
3
|
|
|
@@ -65,13 +64,10 @@ declare abstract class AstNode {
|
|
|
65
64
|
protected freeze(): void;
|
|
66
65
|
}
|
|
67
66
|
declare abstract class QueryAst extends AstNode {
|
|
68
|
-
abstract collectRefs(): PlanRefs;
|
|
69
67
|
abstract collectParamRefs(): ParamRef[];
|
|
70
68
|
abstract toQueryAst(): AnyQueryAst;
|
|
71
|
-
collectColumnRefs(): ColumnRef[];
|
|
72
69
|
}
|
|
73
70
|
declare abstract class FromSource extends AstNode {
|
|
74
|
-
abstract collectRefs(): PlanRefs;
|
|
75
71
|
abstract rewrite(rewriter: AstRewriter): AnyFromSource;
|
|
76
72
|
abstract toFromSource(): AnyFromSource;
|
|
77
73
|
}
|
|
@@ -93,7 +89,6 @@ declare class TableSource extends FromSource {
|
|
|
93
89
|
static named(name: string, alias?: string): TableSource;
|
|
94
90
|
rewrite(rewriter: AstRewriter): AnyFromSource;
|
|
95
91
|
toFromSource(): AnyFromSource;
|
|
96
|
-
collectRefs(): PlanRefs;
|
|
97
92
|
}
|
|
98
93
|
interface TableRef {
|
|
99
94
|
readonly name: string;
|
|
@@ -107,7 +102,6 @@ declare class DerivedTableSource extends FromSource {
|
|
|
107
102
|
static as(alias: string, query: SelectAst): DerivedTableSource;
|
|
108
103
|
rewrite(rewriter: AstRewriter): AnyFromSource;
|
|
109
104
|
toFromSource(): AnyFromSource;
|
|
110
|
-
collectRefs(): PlanRefs;
|
|
111
105
|
}
|
|
112
106
|
declare class ColumnRef extends Expression {
|
|
113
107
|
readonly kind: "column-ref";
|
|
@@ -129,18 +123,31 @@ declare class IdentifierRef extends Expression {
|
|
|
129
123
|
rewrite(rewriter: ExpressionRewriter): AnyExpression;
|
|
130
124
|
fold<T>(folder: ExpressionFolder<T>): T;
|
|
131
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Column ref carried by a {@link ParamRef} that was constructed at a column-bound site (e.g. an INSERT/UPDATE column assignment, a `WHERE column = $param` comparison). The encode-side dispatch path uses `refs` to call `contractCodecs.forColumn(refs.table, refs.column)`, which selects the per-instance parameterized codec for the column — required when a parameterized codec id is shared by multiple columns with distinct
|
|
128
|
+
* typeParams (e.g. `vector(1024)` vs. `vector(1536)`).
|
|
129
|
+
*
|
|
130
|
+
* `refs` may legitimately be `undefined` for `ParamRef`s constructed without a column context — the validator pass (`validateParamRefRefs`) treats refs-less ParamRefs as a hard error only when their codec id is parameterized.
|
|
131
|
+
*/
|
|
132
|
+
interface ParamRefBindingRefs {
|
|
133
|
+
readonly table: string;
|
|
134
|
+
readonly column: string;
|
|
135
|
+
}
|
|
132
136
|
declare class ParamRef extends Expression {
|
|
133
137
|
readonly kind: "param-ref";
|
|
134
138
|
readonly value: unknown;
|
|
135
139
|
readonly name: string | undefined;
|
|
136
140
|
readonly codecId: string | undefined;
|
|
141
|
+
readonly refs: ParamRefBindingRefs | undefined;
|
|
137
142
|
constructor(value: unknown, options?: {
|
|
138
143
|
name?: string;
|
|
139
144
|
codecId?: string;
|
|
145
|
+
refs?: ParamRefBindingRefs;
|
|
140
146
|
});
|
|
141
147
|
static of(value: unknown, options?: {
|
|
142
148
|
name?: string;
|
|
143
149
|
codecId?: string;
|
|
150
|
+
refs?: ParamRefBindingRefs;
|
|
144
151
|
}): ParamRef;
|
|
145
152
|
accept<R>(visitor: ExprVisitor<R>): R;
|
|
146
153
|
rewrite(rewriter: ExpressionRewriter): AnyExpression;
|
|
@@ -336,8 +343,15 @@ declare class ProjectionItem extends AstNode {
|
|
|
336
343
|
readonly kind: "projection-item";
|
|
337
344
|
readonly alias: string;
|
|
338
345
|
readonly expr: ProjectionExpr;
|
|
339
|
-
|
|
340
|
-
|
|
346
|
+
readonly codecId: string | undefined;
|
|
347
|
+
/**
|
|
348
|
+
* Column-bound metadata for the projection. Populated by builder paths that promote a top-level field shortcut (`select('email', ...)`) into a bare `IdentifierRef` AST while still knowing the originating `(table, column)`. Decode-side dispatch consults `refs` to call `forColumn(table, column)` so parameterized codec ids resolve to the per-instance codec — required when multiple columns share a codec id with distinct
|
|
349
|
+
* typeParams (e.g. `varchar(36)` vs. `varchar(255)`). Stays `undefined` for `column-ref` projections (the AST already carries the binding) and for non-column-bound projections (computed expressions, subqueries, raw aliases).
|
|
350
|
+
*/
|
|
351
|
+
readonly refs: ParamRefBindingRefs | undefined;
|
|
352
|
+
constructor(alias: string, expr: ProjectionExpr, codecId?: string, refs?: ParamRefBindingRefs);
|
|
353
|
+
static of(alias: string, expr: ProjectionExpr, codecId?: string, refs?: ParamRefBindingRefs): ProjectionItem;
|
|
354
|
+
withCodecId(codecId: string | undefined): ProjectionItem;
|
|
341
355
|
}
|
|
342
356
|
interface SelectAstOptions {
|
|
343
357
|
readonly from: AnyFromSource;
|
|
@@ -391,7 +405,6 @@ declare class SelectAst extends QueryAst {
|
|
|
391
405
|
rewrite(rewriter: AstRewriter): SelectAst;
|
|
392
406
|
collectColumnRefs(): ColumnRef[];
|
|
393
407
|
collectParamRefs(): ParamRef[];
|
|
394
|
-
collectRefs(): PlanRefs;
|
|
395
408
|
toQueryAst(): AnyQueryAst;
|
|
396
409
|
}
|
|
397
410
|
declare abstract class InsertOnConflictAction extends AstNode {
|
|
@@ -422,15 +435,15 @@ declare class InsertAst extends QueryAst {
|
|
|
422
435
|
readonly table: TableSource;
|
|
423
436
|
readonly rows: ReadonlyArray<Readonly<Record<string, InsertValue>>>;
|
|
424
437
|
readonly onConflict: InsertOnConflict | undefined;
|
|
425
|
-
readonly returning: ReadonlyArray<
|
|
426
|
-
constructor(table: TableSource, rows?: ReadonlyArray<Record<string, InsertValue>>, onConflict?: InsertOnConflict, returning?: ReadonlyArray<
|
|
438
|
+
readonly returning: ReadonlyArray<ProjectionItem> | undefined;
|
|
439
|
+
constructor(table: TableSource, rows?: ReadonlyArray<Record<string, InsertValue>>, onConflict?: InsertOnConflict, returning?: ReadonlyArray<ProjectionItem>);
|
|
427
440
|
static into(table: TableSource): InsertAst;
|
|
428
441
|
withValues(values: Record<string, InsertValue>): InsertAst;
|
|
429
442
|
withRows(rows: ReadonlyArray<Record<string, InsertValue>>): InsertAst;
|
|
430
|
-
withReturning(returning: ReadonlyArray<
|
|
443
|
+
withReturning(returning: ReadonlyArray<ProjectionItem> | undefined): InsertAst;
|
|
431
444
|
withOnConflict(onConflict: InsertOnConflict | undefined): InsertAst;
|
|
445
|
+
rewrite(rewriter: AstRewriter): InsertAst;
|
|
432
446
|
collectParamRefs(): ParamRef[];
|
|
433
|
-
collectRefs(): PlanRefs;
|
|
434
447
|
toQueryAst(): AnyQueryAst;
|
|
435
448
|
}
|
|
436
449
|
declare class UpdateAst extends QueryAst {
|
|
@@ -438,27 +451,27 @@ declare class UpdateAst extends QueryAst {
|
|
|
438
451
|
readonly table: TableSource;
|
|
439
452
|
readonly set: Readonly<Record<string, ColumnRef | ParamRef>>;
|
|
440
453
|
readonly where: AnyExpression | undefined;
|
|
441
|
-
readonly returning: ReadonlyArray<
|
|
442
|
-
constructor(table: TableSource, set?: Readonly<Record<string, ColumnRef | ParamRef>>, where?: AnyExpression, returning?: ReadonlyArray<
|
|
454
|
+
readonly returning: ReadonlyArray<ProjectionItem> | undefined;
|
|
455
|
+
constructor(table: TableSource, set?: Readonly<Record<string, ColumnRef | ParamRef>>, where?: AnyExpression, returning?: ReadonlyArray<ProjectionItem>);
|
|
443
456
|
static table(table: TableSource): UpdateAst;
|
|
444
457
|
withSet(set: Readonly<Record<string, ColumnRef | ParamRef>>): UpdateAst;
|
|
445
458
|
withWhere(where: AnyExpression | undefined): UpdateAst;
|
|
446
|
-
withReturning(returning: ReadonlyArray<
|
|
459
|
+
withReturning(returning: ReadonlyArray<ProjectionItem> | undefined): UpdateAst;
|
|
460
|
+
rewrite(rewriter: AstRewriter): UpdateAst;
|
|
447
461
|
collectParamRefs(): ParamRef[];
|
|
448
|
-
collectRefs(): PlanRefs;
|
|
449
462
|
toQueryAst(): AnyQueryAst;
|
|
450
463
|
}
|
|
451
464
|
declare class DeleteAst extends QueryAst {
|
|
452
465
|
readonly kind: "delete";
|
|
453
466
|
readonly table: TableSource;
|
|
454
467
|
readonly where: AnyExpression | undefined;
|
|
455
|
-
readonly returning: ReadonlyArray<
|
|
456
|
-
constructor(table: TableSource, where?: AnyExpression, returning?: ReadonlyArray<
|
|
468
|
+
readonly returning: ReadonlyArray<ProjectionItem> | undefined;
|
|
469
|
+
constructor(table: TableSource, where?: AnyExpression, returning?: ReadonlyArray<ProjectionItem>);
|
|
457
470
|
static from(table: TableSource): DeleteAst;
|
|
458
471
|
withWhere(where: AnyExpression | undefined): DeleteAst;
|
|
459
|
-
withReturning(returning: ReadonlyArray<
|
|
472
|
+
withReturning(returning: ReadonlyArray<ProjectionItem> | undefined): DeleteAst;
|
|
473
|
+
rewrite(rewriter: AstRewriter): DeleteAst;
|
|
460
474
|
collectParamRefs(): ParamRef[];
|
|
461
|
-
collectRefs(): PlanRefs;
|
|
462
475
|
toQueryAst(): AnyQueryAst;
|
|
463
476
|
}
|
|
464
477
|
type AnyQueryAst = SelectAst | InsertAst | UpdateAst | DeleteAst;
|
|
@@ -480,5 +493,5 @@ interface LoweredStatement {
|
|
|
480
493
|
readonly annotations?: Record<string, unknown>;
|
|
481
494
|
}
|
|
482
495
|
//#endregion
|
|
483
|
-
export {
|
|
484
|
-
//# sourceMappingURL=types-
|
|
496
|
+
export { TableSource as $, InsertOnConflict as A, NotExpr as B, ExistsExpr as C, ExpressionSource as D, ExpressionRewriter as E, JsonObjectEntry as F, ParamRef as G, OperationExpr as H, JsonObjectExpr as I, ProjectionItem as J, ParamRefBindingRefs as K, ListExpression as L, JoinAst as M, JoinOnExpr as N, IdentifierRef as O, JsonArrayAggExpr as P, TableRef as Q, LiteralExpr as R, EqColJoinOn as S, ExpressionFolder as T, OrExpr as U, NullCheckExpr as V, OrderByItem as W, SelectAstOptions as X, SelectAst as Y, SubqueryExpr as Z, DeleteAst as _, AndExpr as a, queryAstKinds as at, DoNothingConflictAction as b, AnyInsertOnConflictAction as c, AnyQueryAst as d, ToWhereExpr as et, AstRewriter as f, DefaultValueExpr as g, ColumnRef as h, AggregateOpFn as i, isWhereExpr as it, InsertValue as j, InsertAst as k, AnyInsertValue as l, BinaryOp as m, AggregateExpr as n, WhereArg as nt, AnyExpression as o, whereExprKinds as ot, BinaryExpr as p, ProjectionExpr as q, AggregateFn as r, isQueryAst as rt, AnyFromSource as s, AggregateCountFn as t, UpdateAst as tt, AnyOperationArg as u, DerivedTableSource as v, ExprVisitor as w, DoUpdateSetConflictAction as x, Direction as y, LoweredStatement as z };
|
|
497
|
+
//# sourceMappingURL=types-hwPoFZX2.d.mts.map
|