effect-qb 0.14.0 → 0.15.0
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/mysql.js +61270 -4259
- package/dist/postgres/metadata.js +176 -82
- package/dist/postgres.js +5903 -3316
- package/package.json +14 -1
- package/src/internal/aggregation-validation.ts +3 -3
- package/src/internal/case-analysis.d.ts +18 -0
- package/src/internal/case-analysis.ts +4 -4
- package/src/internal/coercion/analysis.d.ts +7 -0
- package/src/internal/{coercion-analysis.ts → coercion/analysis.ts} +3 -3
- package/src/internal/coercion/errors.d.ts +17 -0
- package/src/internal/{coercion-errors.ts → coercion/errors.ts} +1 -1
- package/src/internal/coercion/kind.d.ts +4 -0
- package/src/internal/{coercion-kind.ts → coercion/kind.ts} +2 -2
- package/src/internal/{coercion-normalize.ts → coercion/normalize.ts} +1 -1
- package/src/internal/coercion/rules.d.ts +6 -0
- package/src/internal/{coercion-rules.ts → coercion/rules.ts} +2 -2
- package/src/internal/column-state.d.ts +190 -0
- package/src/internal/column-state.ts +36 -47
- package/src/internal/column.ts +21 -305
- package/src/internal/datatypes/define.d.ts +17 -0
- package/src/internal/datatypes/define.ts +18 -4
- package/src/internal/datatypes/lookup.d.ts +44 -0
- package/src/internal/datatypes/lookup.ts +61 -152
- package/src/internal/datatypes/shape.d.ts +16 -0
- package/src/internal/datatypes/shape.ts +1 -1
- package/src/internal/derived-table.d.ts +4 -0
- package/src/internal/derived-table.ts +21 -16
- package/src/internal/dsl-mutation-runtime.ts +378 -0
- package/src/internal/dsl-plan-runtime.ts +387 -0
- package/src/internal/dsl-query-runtime.ts +160 -0
- package/src/internal/dsl-transaction-ddl-runtime.ts +263 -0
- package/src/internal/executor.ts +132 -31
- package/src/internal/expression-ast.ts +15 -5
- package/src/internal/grouping-key.d.ts +3 -0
- package/src/internal/grouping-key.ts +1 -1
- package/src/internal/implication-runtime.d.ts +15 -0
- package/src/internal/implication-runtime.ts +4 -4
- package/src/internal/json/ast.d.ts +30 -0
- package/src/internal/json/ast.ts +1 -1
- package/src/internal/json/errors.d.ts +8 -0
- package/src/internal/json/path.d.ts +75 -0
- package/src/internal/json/path.ts +1 -1
- package/src/internal/json/types.d.ts +62 -0
- package/src/internal/predicate/analysis.d.ts +20 -0
- package/src/internal/{predicate-analysis.ts → predicate/analysis.ts} +3 -3
- package/src/internal/predicate/atom.d.ts +28 -0
- package/src/internal/{predicate-branches.ts → predicate/branches.ts} +2 -2
- package/src/internal/predicate/context.d.ts +67 -0
- package/src/internal/{predicate-context.ts → predicate/context.ts} +8 -5
- package/src/internal/predicate/formula.d.ts +35 -0
- package/src/internal/{predicate-formula.ts → predicate/formula.ts} +1 -1
- package/src/internal/predicate/key.d.ts +11 -0
- package/src/internal/{predicate-key.ts → predicate/key.ts} +2 -2
- package/src/internal/{predicate-nnf.ts → predicate/nnf.ts} +2 -2
- package/src/internal/predicate/normalize.d.ts +53 -0
- package/src/internal/{predicate-normalize.ts → predicate/normalize.ts} +19 -19
- package/src/internal/predicate/runtime.d.ts +31 -0
- package/src/internal/{predicate-runtime.ts → predicate/runtime.ts} +9 -6
- package/src/internal/projection-alias.d.ts +13 -0
- package/src/internal/projections.d.ts +31 -0
- package/src/internal/projections.ts +1 -1
- package/src/internal/query-ast.d.ts +217 -0
- package/src/internal/query-ast.ts +1 -1
- package/src/internal/query-requirements.d.ts +20 -0
- package/src/internal/query.d.ts +775 -0
- package/src/internal/query.ts +389 -313
- package/src/internal/renderer.ts +7 -21
- package/src/internal/row-set.d.ts +53 -0
- package/src/internal/{plan.ts → row-set.ts} +11 -9
- package/src/internal/{runtime-normalize.ts → runtime/normalize.ts} +9 -31
- package/src/internal/{runtime-schema.ts → runtime/schema.ts} +13 -38
- package/src/internal/runtime/value.d.ts +22 -0
- package/src/internal/{runtime-value.ts → runtime/value.ts} +2 -2
- package/src/internal/scalar.d.ts +107 -0
- package/src/internal/scalar.ts +191 -0
- package/src/internal/schema-derivation.d.ts +105 -0
- package/src/internal/schema-expression.d.ts +18 -0
- package/src/internal/schema-expression.ts +38 -7
- package/src/internal/table-options.d.ts +94 -0
- package/src/internal/table-options.ts +8 -2
- package/src/internal/table.d.ts +173 -0
- package/src/internal/table.ts +32 -14
- package/src/mysql/column.ts +94 -18
- package/src/mysql/datatypes/index.ts +47 -7
- package/src/mysql/errors/generated.ts +57336 -0
- package/src/mysql/errors/index.ts +1 -0
- package/src/mysql/errors/normalize.ts +55 -53
- package/src/mysql/errors/types.ts +74 -0
- package/src/mysql/executor.ts +69 -7
- package/src/mysql/function/aggregate.ts +1 -5
- package/src/mysql/function/core.ts +1 -4
- package/src/mysql/function/index.ts +0 -1
- package/src/mysql/function/string.ts +1 -5
- package/src/mysql/function/temporal.ts +12 -15
- package/src/mysql/function/window.ts +1 -6
- package/src/{internal/mysql-dialect.ts → mysql/internal/dialect.ts} +1 -1
- package/src/{internal/mysql-query.ts → mysql/internal/dsl.ts} +1024 -2082
- package/src/{internal/mysql-renderer.ts → mysql/internal/renderer.ts} +6 -6
- package/src/mysql/internal/sql-expression-renderer.ts +1455 -0
- package/src/mysql/json.ts +2 -0
- package/src/mysql/query.ts +111 -91
- package/src/mysql/renderer.ts +1 -1
- package/src/mysql/table.ts +1 -1
- package/src/mysql.ts +6 -4
- package/src/postgres/cast.ts +11 -12
- package/src/postgres/column.ts +178 -46
- package/src/postgres/datatypes/index.d.ts +515 -0
- package/src/postgres/datatypes/index.ts +22 -13
- package/src/postgres/datatypes/spec.d.ts +412 -0
- package/src/postgres/errors/generated.ts +2636 -0
- package/src/postgres/errors/index.ts +1 -0
- package/src/postgres/errors/normalize.ts +47 -62
- package/src/postgres/errors/types.ts +92 -34
- package/src/postgres/executor.ts +37 -5
- package/src/postgres/function/aggregate.ts +1 -5
- package/src/postgres/function/core.ts +12 -6
- package/src/postgres/function/index.ts +0 -1
- package/src/postgres/function/string.ts +1 -5
- package/src/postgres/function/temporal.ts +12 -15
- package/src/postgres/function/window.ts +1 -6
- package/src/{internal/postgres-dialect.ts → postgres/internal/dialect.ts} +1 -1
- package/src/{internal/postgres-query.ts → postgres/internal/dsl.ts} +1085 -2089
- package/src/{internal/postgres-renderer.ts → postgres/internal/renderer.ts} +6 -6
- package/src/postgres/internal/schema-ddl.ts +108 -0
- package/src/{internal/postgres-schema-model.ts → postgres/internal/schema-model.ts} +12 -6
- package/src/{internal → postgres/internal}/sql-expression-renderer.ts +19 -17
- package/src/postgres/{function/json.ts → json.ts} +77 -85
- package/src/postgres/metadata.ts +2 -2
- package/src/postgres/query.ts +113 -89
- package/src/postgres/renderer.ts +3 -13
- package/src/postgres/schema-expression.ts +2 -1
- package/src/postgres/schema-management.ts +1 -1
- package/src/postgres/table.ts +12 -4
- package/src/postgres/type.ts +29 -2
- package/src/postgres.ts +6 -4
- package/src/internal/expression.ts +0 -327
- package/src/internal/schema-ddl.ts +0 -55
- package/src/mysql/function/json.ts +0 -4
- package/src/mysql/private/query.ts +0 -1
- package/src/postgres/private/query.ts +0 -1
- /package/src/internal/{predicate-atom.ts → predicate/atom.ts} +0 -0
package/src/internal/query.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { pipeArguments, type Pipeable } from "effect/Pipeable"
|
|
2
|
+
import type * as Schema from "effect/Schema"
|
|
2
3
|
|
|
3
|
-
import * as Expression from "./
|
|
4
|
-
import * as
|
|
4
|
+
import * as Expression from "./scalar.js"
|
|
5
|
+
import * as RowSet from "./row-set.js"
|
|
5
6
|
import * as Table from "./table.js"
|
|
6
7
|
import * as ExpressionAst from "./expression-ast.js"
|
|
7
8
|
import * as QueryAst from "./query-ast.js"
|
|
@@ -9,10 +10,10 @@ import type { JsonNode } from "./json/ast.js"
|
|
|
9
10
|
import type * as JsonPath from "./json/path.js"
|
|
10
11
|
import type { QueryCapability } from "./query-requirements.js"
|
|
11
12
|
import type { CaseBranchAssumeFalse, CaseBranchAssumeTrue, CaseBranchDecision } from "./case-analysis.js"
|
|
12
|
-
import type { ContradictsFormula, GuaranteedNonNullKeys, GuaranteedNullKeys, GuaranteedSourceNames } from "./predicate
|
|
13
|
-
import type { ColumnKeyOfExpression } from "./predicate
|
|
14
|
-
import type { PredicateFormula, TrueFormula } from "./predicate
|
|
15
|
-
import { trueFormula } from "./predicate
|
|
13
|
+
import type { ContradictsFormula, GuaranteedNonNullKeys, GuaranteedNullKeys, GuaranteedSourceNames } from "./predicate/analysis.js"
|
|
14
|
+
import type { ColumnKeyOfExpression } from "./predicate/key.js"
|
|
15
|
+
import type { PredicateFormula, TrueFormula } from "./predicate/formula.js"
|
|
16
|
+
import { trueFormula } from "./predicate/runtime.js"
|
|
16
17
|
|
|
17
18
|
export type {
|
|
18
19
|
MergeCapabilities,
|
|
@@ -25,7 +26,7 @@ export type {
|
|
|
25
26
|
RuntimeOfDbType,
|
|
26
27
|
TextCompatibleDbType,
|
|
27
28
|
CastableDbType
|
|
28
|
-
} from "./coercion
|
|
29
|
+
} from "./coercion/analysis.js"
|
|
29
30
|
export type {
|
|
30
31
|
CanonicalSegment as JsonPathSegment,
|
|
31
32
|
DescendSegment as JsonPathDescendSegment,
|
|
@@ -60,12 +61,12 @@ export type {
|
|
|
60
61
|
export type {
|
|
61
62
|
CoercionKind,
|
|
62
63
|
CoercionKindOf
|
|
63
|
-
} from "./coercion
|
|
64
|
+
} from "./coercion/kind.js"
|
|
64
65
|
export type {
|
|
65
66
|
CanCastDbType,
|
|
66
67
|
CanCompareDbTypes,
|
|
67
68
|
CanContainDbTypes
|
|
68
|
-
} from "./coercion
|
|
69
|
+
} from "./coercion/rules.js"
|
|
69
70
|
export type {
|
|
70
71
|
ConflictClause,
|
|
71
72
|
LockClause,
|
|
@@ -99,12 +100,12 @@ const PlanProto = {
|
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
/** Internal symbol used to preserve query-only phantom metadata through inference. */
|
|
102
|
-
const QueryTypeId: unique symbol = Symbol.for("effect-qb/Query/internal")
|
|
103
|
+
export const QueryTypeId: unique symbol = Symbol.for("effect-qb/Query/internal")
|
|
103
104
|
|
|
104
105
|
type InsertSourceState = "ready" | "missing"
|
|
105
106
|
|
|
106
107
|
/** Internal phantom state tracked on query plans. */
|
|
107
|
-
interface QueryState<
|
|
108
|
+
export interface QueryState<
|
|
108
109
|
Outstanding extends string,
|
|
109
110
|
AvailableNames extends string,
|
|
110
111
|
Grouped extends string,
|
|
@@ -124,14 +125,12 @@ interface QueryState<
|
|
|
124
125
|
readonly insertSource: InsertState
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
/** Source provenance attached to an expression. */
|
|
128
|
-
export type SourceOf<Value extends Expression.Any> = Value[typeof Expression.TypeId]["source"]
|
|
129
128
|
/** Effective SQL dialect carried by an expression. */
|
|
130
129
|
export type DialectOf<Value extends Expression.Any> = Value[typeof Expression.TypeId]["dialect"]
|
|
131
|
-
/** Source dependency
|
|
130
|
+
/** Source dependency union carried by an expression. */
|
|
132
131
|
export type DependenciesOf<Value extends Expression.Any> = Expression.DependenciesOf<Value>
|
|
133
132
|
/** Aggregation kind carried by an expression. */
|
|
134
|
-
export type
|
|
133
|
+
export type KindOf<Value extends Expression.Any> = Value[typeof Expression.TypeId]["kind"]
|
|
135
134
|
type AstOf<Value extends Expression.Any> = Value extends { readonly [ExpressionAst.TypeId]: infer Ast extends ExpressionAst.Any } ? Ast : never
|
|
136
135
|
|
|
137
136
|
/**
|
|
@@ -143,11 +142,11 @@ type AstOf<Value extends Expression.Any> = Value extends { readonly [ExpressionA
|
|
|
143
142
|
export type LiteralValue = string | number | boolean | null | Date
|
|
144
143
|
|
|
145
144
|
/** Runtime expression type produced by `literal(...)` for a primitive value. */
|
|
146
|
-
type LiteralExpression<Value extends LiteralValue> = Expression.
|
|
145
|
+
type LiteralExpression<Value extends LiteralValue> = Expression.Scalar<
|
|
147
146
|
Value,
|
|
148
147
|
LiteralDbType<Value>,
|
|
149
148
|
LiteralNullability<Value>,
|
|
150
|
-
|
|
149
|
+
string,
|
|
151
150
|
"scalar",
|
|
152
151
|
never
|
|
153
152
|
>
|
|
@@ -161,21 +160,19 @@ type LiteralExpression<Value extends LiteralValue> = Expression.Expression<
|
|
|
161
160
|
export type ExpressionInput = Expression.Any | LiteralValue
|
|
162
161
|
|
|
163
162
|
/** Input accepted by numeric clauses such as `limit(...)` and `offset(...)`. */
|
|
164
|
-
export type NumericExpressionInput = Expression.
|
|
163
|
+
export type NumericExpressionInput = Expression.Scalar<
|
|
165
164
|
number,
|
|
166
165
|
Expression.DbType.Any,
|
|
167
166
|
Expression.Nullability,
|
|
168
167
|
string,
|
|
169
168
|
"scalar",
|
|
170
|
-
|
|
171
|
-
Expression.SourceDependencies,
|
|
172
|
-
Expression.SourceNullabilityMode
|
|
169
|
+
Expression.BindingId
|
|
173
170
|
> | number
|
|
174
171
|
|
|
175
172
|
/** Values accepted by mutation payload fields. */
|
|
176
173
|
export type MutationValueInput<Value> =
|
|
177
174
|
| Value
|
|
178
|
-
| Expression.
|
|
175
|
+
| Expression.Scalar<Value, Expression.DbType.Any, Expression.Nullability, string, Expression.ScalarKind, Expression.BindingId>
|
|
179
176
|
|
|
180
177
|
/** Maps a payload shape to values or expressions of the same runtime type. */
|
|
181
178
|
export type MutationInputOf<Shape> = {
|
|
@@ -185,74 +182,64 @@ export type MutationInputOf<Shape> = {
|
|
|
185
182
|
type Simplify<T> = { readonly [K in keyof T]: T[K] } & {}
|
|
186
183
|
|
|
187
184
|
/** Input accepted by boolean plan clauses such as `where(...)` and joins. */
|
|
188
|
-
export type PredicateInput = Expression.
|
|
185
|
+
export type PredicateInput = Expression.Scalar<
|
|
189
186
|
boolean,
|
|
190
187
|
Expression.DbType.Any,
|
|
191
188
|
Expression.Nullability,
|
|
192
189
|
string,
|
|
193
190
|
"scalar",
|
|
194
|
-
|
|
195
|
-
Expression.SourceDependencies,
|
|
196
|
-
Expression.SourceNullabilityMode
|
|
191
|
+
Expression.BindingId
|
|
197
192
|
> | boolean
|
|
198
193
|
|
|
199
194
|
/** Input accepted by `having(...)`. */
|
|
200
|
-
export type HavingPredicateInput = Expression.
|
|
195
|
+
export type HavingPredicateInput = Expression.Scalar<
|
|
201
196
|
boolean,
|
|
202
197
|
Expression.DbType.Any,
|
|
203
198
|
Expression.Nullability,
|
|
204
199
|
string,
|
|
205
200
|
"scalar" | "aggregate",
|
|
206
|
-
|
|
207
|
-
Expression.SourceDependencies,
|
|
208
|
-
Expression.SourceNullabilityMode
|
|
201
|
+
Expression.BindingId
|
|
209
202
|
> | boolean
|
|
210
203
|
|
|
211
204
|
/** Input accepted by `GROUP BY`. */
|
|
212
|
-
export type GroupByInput = Expression.
|
|
205
|
+
export type GroupByInput = Expression.Scalar<
|
|
213
206
|
any,
|
|
214
207
|
Expression.DbType.Any,
|
|
215
208
|
Expression.Nullability,
|
|
216
209
|
string,
|
|
217
210
|
"scalar",
|
|
218
|
-
|
|
211
|
+
Expression.BindingId
|
|
219
212
|
>
|
|
220
213
|
|
|
221
214
|
/** Maps a literal runtime value to its SQL-level DB type descriptor. */
|
|
222
215
|
type LiteralDbType<Value extends LiteralValue> =
|
|
223
|
-
Value extends string ? Expression.DbType.
|
|
224
|
-
Value extends number ? Expression.DbType.
|
|
225
|
-
Value extends boolean ? Expression.DbType.
|
|
226
|
-
Value extends Date ? Expression.DbType.
|
|
227
|
-
Expression.DbType.Base<
|
|
216
|
+
Value extends string ? Expression.DbType.Base<string, "text"> :
|
|
217
|
+
Value extends number ? Expression.DbType.Base<string, "numeric"> :
|
|
218
|
+
Value extends boolean ? Expression.DbType.Base<string, "boolean"> :
|
|
219
|
+
Value extends Date ? Expression.DbType.Base<string, "timestamp"> :
|
|
220
|
+
Expression.DbType.Base<string, "null">
|
|
228
221
|
|
|
229
222
|
/** Maps a literal runtime value to its static nullability state. */
|
|
230
223
|
type LiteralNullability<Value extends LiteralValue> = Value extends null ? "always" : "never"
|
|
231
224
|
/** Converts a supported input into its canonical expression type. */
|
|
232
225
|
type AsExpression<Value extends ExpressionInput> = Value extends Expression.Any ? Value : LiteralExpression<Extract<Value, LiteralValue>>
|
|
233
|
-
/** Extracts provenance from an operator input after coercion. */
|
|
234
|
-
type SourceOfInput<Value extends ExpressionInput> = SourceOf<AsExpression<Value>>
|
|
235
226
|
/** Extracts dialect from an operator input after coercion. */
|
|
236
227
|
type DialectOfInput<Value extends ExpressionInput> = DialectOf<AsExpression<Value>>
|
|
237
228
|
/** Extracts dependencies from an operator input after coercion. */
|
|
238
229
|
type DependenciesOfInput<Value extends ExpressionInput> = DependenciesOf<AsExpression<Value>>
|
|
239
|
-
/** Extracts required
|
|
240
|
-
type RequiredFromInput<Value extends ExpressionInput> =
|
|
230
|
+
/** Extracts required bindings from an operator input after coercion. */
|
|
231
|
+
type RequiredFromInput<Value extends ExpressionInput> = DependenciesOfInput<Value>
|
|
241
232
|
/** String-valued expressions accepted by text operators. */
|
|
242
|
-
export type StringExpressionInput = Expression.
|
|
233
|
+
export type StringExpressionInput = Expression.Scalar<
|
|
243
234
|
string | null,
|
|
244
235
|
Expression.DbType.Any,
|
|
245
236
|
Expression.Nullability,
|
|
246
237
|
string,
|
|
247
|
-
Expression.
|
|
248
|
-
|
|
249
|
-
Expression.SourceDependencies,
|
|
250
|
-
Expression.SourceNullabilityMode
|
|
238
|
+
Expression.ScalarKind,
|
|
239
|
+
Expression.BindingId
|
|
251
240
|
> | string
|
|
252
241
|
/** Converts a string operator input into its canonical expression type. */
|
|
253
242
|
type AsStringExpression<Value extends StringExpressionInput> = Value extends Expression.Any ? Value : LiteralExpression<Extract<Value, string>>
|
|
254
|
-
/** Extracts provenance from a string operator input after coercion. */
|
|
255
|
-
type SourceOfStringInput<Value extends StringExpressionInput> = SourceOf<AsStringExpression<Value>>
|
|
256
243
|
/** Extracts dialect from a string operator input after coercion. */
|
|
257
244
|
type DialectOfStringInput<Value extends StringExpressionInput> = DialectOf<AsStringExpression<Value>>
|
|
258
245
|
/** Extracts dependencies from a string operator input after coercion. */
|
|
@@ -260,10 +247,8 @@ type DependenciesOfStringInput<Value extends StringExpressionInput> = Dependenci
|
|
|
260
247
|
/** Extracts intrinsic nullability from a string operator input after coercion. */
|
|
261
248
|
type NullabilityOfStringInput<Value extends StringExpressionInput> = Expression.NullabilityOf<AsStringExpression<Value>>
|
|
262
249
|
|
|
263
|
-
/** Extracts
|
|
264
|
-
type
|
|
265
|
-
/** Extracts required table names from an expression dependency map. */
|
|
266
|
-
export type RequiredFromDependencies<Dependencies extends Expression.SourceDependencies> = Extract<keyof Dependencies, string>
|
|
250
|
+
/** Extracts required bindings from an expression dependency union. */
|
|
251
|
+
export type RequiredFromDependencies<Dependencies extends Expression.BindingId> = Dependencies
|
|
267
252
|
|
|
268
253
|
type LiteralGroupingKey<Value> =
|
|
269
254
|
Value extends string ? `string:${Value}` :
|
|
@@ -378,8 +363,13 @@ type GroupingKeyOfAst<Ast extends ExpressionAst.Any> =
|
|
|
378
363
|
? "exists(subquery)"
|
|
379
364
|
: never
|
|
380
365
|
|
|
381
|
-
/** Canonical grouping identity for an expression
|
|
382
|
-
export type GroupingKeyOfExpression<Value extends Expression.Any> =
|
|
366
|
+
/** Canonical grouping identity for an expression. */
|
|
367
|
+
export type GroupingKeyOfExpression<Value extends Expression.Any> =
|
|
368
|
+
Expression.GroupKeyOf<Value> extends infer GroupKey extends string
|
|
369
|
+
? string extends GroupKey
|
|
370
|
+
? GroupingKeyOfAst<AstOf<Value>>
|
|
371
|
+
: GroupKey
|
|
372
|
+
: GroupingKeyOfAst<AstOf<Value>>
|
|
383
373
|
|
|
384
374
|
/**
|
|
385
375
|
* Recursive selection tree accepted by `select(...)`.
|
|
@@ -418,7 +408,7 @@ export type ExtractDialect<Selection> = Selection extends Expression.Any
|
|
|
418
408
|
* The query layer only needs the plan metadata and the static table name. It
|
|
419
409
|
* deliberately avoids depending on the full table-definition surface.
|
|
420
410
|
*/
|
|
421
|
-
export type TableLike<Name extends string = string, Dialect extends string = string> =
|
|
411
|
+
export type TableLike<Name extends string = string, Dialect extends string = string> = RowSet.RowSet<any, any, Record<string, RowSet.AnySource>, Dialect> & {
|
|
422
412
|
readonly [Table.TypeId]: {
|
|
423
413
|
readonly name: Name
|
|
424
414
|
readonly baseName: string
|
|
@@ -556,6 +546,9 @@ export type TableFunctionSource<
|
|
|
556
546
|
readonly columns: DerivedSelectionOf<Selection, Alias>
|
|
557
547
|
}
|
|
558
548
|
|
|
549
|
+
/** Broad structural shape for table-function sources when used as composable inputs. */
|
|
550
|
+
export type AnyTableFunctionSource = TableFunctionSource<Record<string, Expression.Any>, string, string, string>
|
|
551
|
+
|
|
559
552
|
/** Accepts either a physical table or a derived table source. */
|
|
560
553
|
type DerivedSourceShape = {
|
|
561
554
|
readonly kind: "derived"
|
|
@@ -649,12 +642,12 @@ type JsonMutationDbKindError<
|
|
|
649
642
|
ExpectedKind extends string,
|
|
650
643
|
ReceivedKind extends string
|
|
651
644
|
> = {
|
|
652
|
-
readonly __effect_qb_error__: "effect-qb: incompatible
|
|
645
|
+
readonly __effect_qb_error__: "effect-qb: incompatible json mutation value"
|
|
653
646
|
readonly __effect_qb_column__: ColumnName
|
|
654
|
-
readonly __effect_qb_reason__: "
|
|
647
|
+
readonly __effect_qb_reason__: "json kinds do not match"
|
|
655
648
|
readonly __effect_qb_expected_json_kind__: ExpectedKind
|
|
656
649
|
readonly __effect_qb_received_json_kind__: ReceivedKind
|
|
657
|
-
readonly __effect_qb_hint__: "Use
|
|
650
|
+
readonly __effect_qb_hint__: "Use the dialect Json helpers that match the target json kind"
|
|
658
651
|
}
|
|
659
652
|
|
|
660
653
|
type JsonMutationShapeError<
|
|
@@ -662,7 +655,7 @@ type JsonMutationShapeError<
|
|
|
662
655
|
Expected,
|
|
663
656
|
Received
|
|
664
657
|
> = {
|
|
665
|
-
readonly __effect_qb_error__: "effect-qb: incompatible
|
|
658
|
+
readonly __effect_qb_error__: "effect-qb: incompatible json mutation value"
|
|
666
659
|
readonly __effect_qb_column__: ColumnName
|
|
667
660
|
readonly __effect_qb_reason__: "json value is not assignable to the target column schema"
|
|
668
661
|
readonly __effect_qb_json_issues__: JsonShapeIssues<Expected, Received>
|
|
@@ -705,6 +698,13 @@ type JsonArrayPath<Path extends string> = Path extends ""
|
|
|
705
698
|
? "[number]"
|
|
706
699
|
: `${Path}[number]`
|
|
707
700
|
|
|
701
|
+
type JsonTupleIndexPath<
|
|
702
|
+
Path extends string,
|
|
703
|
+
Index extends string
|
|
704
|
+
> = Path extends ""
|
|
705
|
+
? `[${Index}]`
|
|
706
|
+
: `${Path}[${Index}]`
|
|
707
|
+
|
|
708
708
|
type JsonIssueKeyPath<Path extends string> = Path extends ""
|
|
709
709
|
? "root"
|
|
710
710
|
: Path
|
|
@@ -751,6 +751,22 @@ type JsonObjectShapeIssues<
|
|
|
751
751
|
JsonShapeIssues<Expected[K], Received[K], JsonObjectKeyPath<Path, K>>
|
|
752
752
|
}[JsonSharedKeys<Expected, Received>]
|
|
753
753
|
|
|
754
|
+
type JsonTupleIndices<Value extends readonly unknown[]> = Extract<keyof Value, `${number}`>
|
|
755
|
+
|
|
756
|
+
type JsonTupleShapeIssues<
|
|
757
|
+
Expected extends readonly unknown[],
|
|
758
|
+
Received extends readonly unknown[],
|
|
759
|
+
Path extends string
|
|
760
|
+
> =
|
|
761
|
+
| {
|
|
762
|
+
readonly [K in Exclude<JsonTupleIndices<Expected>, JsonTupleIndices<Received>>]:
|
|
763
|
+
JsonShapeIssue<JsonTupleIndexPath<Path, K>, "missing_required_property", Expected[K], undefined>
|
|
764
|
+
}[Exclude<JsonTupleIndices<Expected>, JsonTupleIndices<Received>>]
|
|
765
|
+
| {
|
|
766
|
+
readonly [K in Extract<JsonTupleIndices<Expected>, JsonTupleIndices<Received>>]:
|
|
767
|
+
JsonShapeIssues<Expected[K], Received[K], JsonTupleIndexPath<Path, K>>
|
|
768
|
+
}[Extract<JsonTupleIndices<Expected>, JsonTupleIndices<Received>>]
|
|
769
|
+
|
|
754
770
|
type JsonShapeIssues<
|
|
755
771
|
Expected,
|
|
756
772
|
Received,
|
|
@@ -759,7 +775,15 @@ type JsonShapeIssues<
|
|
|
759
775
|
? never
|
|
760
776
|
: [Expected] extends [readonly (infer ExpectedElement)[]]
|
|
761
777
|
? [Received] extends [readonly (infer ReceivedElement)[]]
|
|
762
|
-
?
|
|
778
|
+
? number extends Expected["length"]
|
|
779
|
+
? JsonShapeIssues<ExpectedElement, ReceivedElement, JsonArrayPath<Path>>
|
|
780
|
+
: number extends Received["length"]
|
|
781
|
+
? JsonShapeIssues<ExpectedElement, ReceivedElement, JsonArrayPath<Path>>
|
|
782
|
+
: JsonTupleShapeIssues<Expected, Received, Path> extends infer Issues
|
|
783
|
+
? [Issues] extends [never]
|
|
784
|
+
? JsonShapeIssue<Path, "type_mismatch", Expected, Received>
|
|
785
|
+
: Issues
|
|
786
|
+
: never
|
|
763
787
|
: JsonShapeIssue<Path, "type_mismatch", Expected, Received>
|
|
764
788
|
: [Expected] extends [object]
|
|
765
789
|
? [Expected] extends [Function]
|
|
@@ -776,7 +800,7 @@ type JsonShapeIssues<
|
|
|
776
800
|
: JsonShapeIssue<Path, "type_mismatch", Expected, Received>
|
|
777
801
|
|
|
778
802
|
type MutationAcceptedInput<Column> =
|
|
779
|
-
Column extends Expression.
|
|
803
|
+
Column extends Expression.Scalar<infer Runtime, any, any, any, any, any>
|
|
780
804
|
? MutationValueInput<Runtime>
|
|
781
805
|
: never
|
|
782
806
|
|
|
@@ -784,14 +808,14 @@ type MutationValueCompatibilityIssue<
|
|
|
784
808
|
Column,
|
|
785
809
|
Value,
|
|
786
810
|
ColumnName extends string
|
|
787
|
-
> = Column extends Expression.
|
|
788
|
-
? ColumnDb extends Expression.DbType.Json<
|
|
789
|
-
? Value extends Expression.
|
|
790
|
-
? ValueDb extends Expression.DbType.Json<
|
|
811
|
+
> = Column extends Expression.Scalar<any, infer ColumnDb extends Expression.DbType.Any, any, any, any, any>
|
|
812
|
+
? ColumnDb extends Expression.DbType.Json<infer ColumnDialect extends string, infer ExpectedKind>
|
|
813
|
+
? Value extends Expression.Scalar<any, infer ValueDb extends Expression.DbType.Any, any, any, any, any>
|
|
814
|
+
? ValueDb extends Expression.DbType.Json<ColumnDialect, infer ReceivedKind>
|
|
791
815
|
? [ExpectedKind] extends [ReceivedKind]
|
|
792
816
|
? [ReceivedKind] extends [ExpectedKind]
|
|
793
|
-
? Value extends Expression.
|
|
794
|
-
? Column extends Expression.
|
|
817
|
+
? Value extends Expression.Scalar<infer ReceivedRuntime, any, any, any, any, any>
|
|
818
|
+
? Column extends Expression.Scalar<infer ExpectedRuntime, any, any, any, any, any>
|
|
795
819
|
? [ReceivedRuntime] extends [ExpectedRuntime]
|
|
796
820
|
? never
|
|
797
821
|
: JsonMutationShapeError<ColumnName, ExpectedRuntime, ReceivedRuntime>
|
|
@@ -799,29 +823,29 @@ type MutationValueCompatibilityIssue<
|
|
|
799
823
|
: never
|
|
800
824
|
: JsonMutationDbKindError<ColumnName, ExpectedKind, ReceivedKind>
|
|
801
825
|
: JsonMutationDbKindError<ColumnName, ExpectedKind, ReceivedKind>
|
|
802
|
-
: Value extends Expression.
|
|
803
|
-
? Column extends Expression.
|
|
826
|
+
: Value extends Expression.Scalar<infer ReceivedRuntime, any, any, any, any, any>
|
|
827
|
+
? Column extends Expression.Scalar<infer ExpectedRuntime, any, any, any, any, any>
|
|
804
828
|
? [ReceivedRuntime] extends [ExpectedRuntime]
|
|
805
829
|
? never
|
|
806
830
|
: JsonMutationShapeError<ColumnName, ExpectedRuntime, ReceivedRuntime>
|
|
807
831
|
: never
|
|
808
|
-
: Column extends Expression.
|
|
832
|
+
: Column extends Expression.Scalar<infer ExpectedRuntime, any, any, any, any, any>
|
|
809
833
|
? [Value] extends [ExpectedRuntime]
|
|
810
834
|
? never
|
|
811
835
|
: JsonMutationShapeError<ColumnName, ExpectedRuntime, Value>
|
|
812
836
|
: never
|
|
813
|
-
: Column extends Expression.
|
|
837
|
+
: Column extends Expression.Scalar<infer ExpectedRuntime, any, any, any, any, any>
|
|
814
838
|
? [Value] extends [ExpectedRuntime]
|
|
815
839
|
? never
|
|
816
840
|
: JsonMutationShapeError<ColumnName, ExpectedRuntime, Value>
|
|
817
841
|
: never
|
|
818
|
-
: Value extends Expression.
|
|
819
|
-
? Column extends Expression.
|
|
842
|
+
: Value extends Expression.Scalar<infer ReceivedRuntime, any, any, any, any, any>
|
|
843
|
+
? Column extends Expression.Scalar<infer ExpectedRuntime, any, any, any, any, any>
|
|
820
844
|
? [ReceivedRuntime] extends [ExpectedRuntime]
|
|
821
845
|
? never
|
|
822
846
|
: MutationValueShapeError<ColumnName, ExpectedRuntime, ReceivedRuntime>
|
|
823
847
|
: never
|
|
824
|
-
: Column extends Expression.
|
|
848
|
+
: Column extends Expression.Scalar<infer ExpectedRuntime, any, any, any, any, any>
|
|
825
849
|
? [Value] extends [ExpectedRuntime]
|
|
826
850
|
? never
|
|
827
851
|
: MutationValueShapeError<ColumnName, ExpectedRuntime, Value>
|
|
@@ -965,15 +989,13 @@ type DerivedLeafExpression<
|
|
|
965
989
|
Value extends Expression.Any,
|
|
966
990
|
Alias extends string,
|
|
967
991
|
ColumnName extends string
|
|
968
|
-
> = Expression.
|
|
992
|
+
> = Expression.Scalar<
|
|
969
993
|
Expression.RuntimeOf<Value>,
|
|
970
994
|
Expression.DbTypeOf<Value>,
|
|
971
995
|
Expression.NullabilityOf<Value>,
|
|
972
996
|
DialectOf<Value>,
|
|
973
997
|
"scalar",
|
|
974
|
-
|
|
975
|
-
Record<Alias, true>,
|
|
976
|
-
"propagate"
|
|
998
|
+
Alias
|
|
977
999
|
> & {
|
|
978
1000
|
readonly [ExpressionAst.TypeId]: ExpressionAst.ColumnNode<Alias, ColumnName>
|
|
979
1001
|
}
|
|
@@ -994,41 +1016,60 @@ export type DerivedSelectionOf<
|
|
|
994
1016
|
/** Extracts the static SQL table name from a table-like value. */
|
|
995
1017
|
export type TableNameOf<T extends TableLike> = T[typeof Table.TypeId]["name"]
|
|
996
1018
|
/** Extracts the effective dialect from a table-like value. */
|
|
997
|
-
export type TableDialectOf<T extends TableLike> = T[typeof
|
|
1019
|
+
export type TableDialectOf<T extends TableLike> = T[typeof RowSet.TypeId]["dialect"]
|
|
998
1020
|
/** Names of sources already available to a plan. */
|
|
999
|
-
type AvailableNames<Available extends Record<string,
|
|
1021
|
+
type AvailableNames<Available extends Record<string, RowSet.AnySource>> = Extract<keyof Available, string>
|
|
1000
1022
|
/** Availability mode of a named source within the current plan scope. */
|
|
1001
1023
|
type SourceModeOf<
|
|
1002
|
-
Available extends Record<string,
|
|
1024
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1003
1025
|
Name extends string
|
|
1004
1026
|
> = Name extends keyof Available ? Available[Name]["mode"] : never
|
|
1005
1027
|
type TrueAssumptions = TrueFormula
|
|
1006
1028
|
|
|
1029
|
+
/** Extracts the public plan state carried under `RowSet.TypeId`. */
|
|
1030
|
+
type QueryPlanParts<
|
|
1031
|
+
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any, any, any>
|
|
1032
|
+
> = PlanValue[typeof RowSet.TypeId]
|
|
1033
|
+
|
|
1034
|
+
/** Extracts the internal phantom query state carried under `QueryTypeId`. */
|
|
1035
|
+
type QueryPlanState<
|
|
1036
|
+
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any, any, any>
|
|
1037
|
+
> = PlanValue[typeof QueryTypeId]
|
|
1038
|
+
|
|
1007
1039
|
/** Extracts the selection carried by a query plan. */
|
|
1008
|
-
export type SelectionOfPlan<
|
|
1009
|
-
PlanValue
|
|
1040
|
+
export type SelectionOfPlan<
|
|
1041
|
+
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any, any, any>
|
|
1042
|
+
> = QueryPlanParts<PlanValue>["selection"]
|
|
1010
1043
|
/** Extracts the public required-source state carried by a query plan. */
|
|
1011
|
-
export type RequiredOfPlan<
|
|
1012
|
-
PlanValue
|
|
1044
|
+
export type RequiredOfPlan<
|
|
1045
|
+
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any, any, any>
|
|
1046
|
+
> = QueryPlanParts<PlanValue>["required"]
|
|
1013
1047
|
/** Extracts the available-source scope carried by a query plan. */
|
|
1014
|
-
export type AvailableOfPlan<
|
|
1015
|
-
PlanValue
|
|
1048
|
+
export type AvailableOfPlan<
|
|
1049
|
+
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any, any, any>
|
|
1050
|
+
> = QueryPlanParts<PlanValue>["available"]
|
|
1016
1051
|
/** Extracts the effective dialect carried by a query plan. */
|
|
1017
|
-
export type PlanDialectOf<
|
|
1018
|
-
PlanValue
|
|
1052
|
+
export type PlanDialectOf<
|
|
1053
|
+
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any, any, any>
|
|
1054
|
+
> = QueryPlanParts<PlanValue>["dialect"]
|
|
1019
1055
|
/** Extracts the grouped-source phantom carried by a query plan. */
|
|
1020
|
-
export type GroupedOfPlan<
|
|
1021
|
-
PlanValue extends QueryPlan<any, any, any, any,
|
|
1056
|
+
export type GroupedOfPlan<
|
|
1057
|
+
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any, any, any>
|
|
1058
|
+
> = QueryPlanState<PlanValue>["grouped"]
|
|
1022
1059
|
/** Extracts the available-name phantom carried by a query plan. */
|
|
1023
|
-
export type ScopedNamesOfPlan<
|
|
1024
|
-
PlanValue extends QueryPlan<any, any, any, any, any,
|
|
1060
|
+
export type ScopedNamesOfPlan<
|
|
1061
|
+
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any, any, any>
|
|
1062
|
+
> = QueryPlanState<PlanValue>["availableNames"]
|
|
1025
1063
|
/** Extracts the outstanding-required-source phantom carried by a query plan. */
|
|
1026
|
-
export type OutstandingOfPlan<
|
|
1027
|
-
PlanValue extends QueryPlan<any, any, any, any, any, any,
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1064
|
+
export type OutstandingOfPlan<
|
|
1065
|
+
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any, any, any>
|
|
1066
|
+
> = QueryPlanState<PlanValue>["required"]
|
|
1067
|
+
export type AssumptionsOfPlan<
|
|
1068
|
+
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any, any, any>
|
|
1069
|
+
> = QueryPlanState<PlanValue>["assumptions"]
|
|
1070
|
+
export type CapabilitiesOfPlan<
|
|
1071
|
+
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any, any, any>
|
|
1072
|
+
> = QueryPlanState<PlanValue>["capabilities"]
|
|
1032
1073
|
/** Extracts capabilities contributed by a source wrapper. */
|
|
1033
1074
|
export type SourceCapabilitiesOf<Source extends SourceLike> =
|
|
1034
1075
|
Source extends TableLike<any, any> ? never :
|
|
@@ -1037,14 +1078,20 @@ export type SourceCapabilitiesOf<Source extends SourceLike> =
|
|
|
1037
1078
|
Source extends { readonly kind: "lateral"; readonly plan: infer PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any> } ? CapabilitiesOfPlan<PlanValue> :
|
|
1038
1079
|
never
|
|
1039
1080
|
/** Extracts the statement kind carried by a query plan. */
|
|
1040
|
-
export type StatementOfPlan<
|
|
1041
|
-
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any,
|
|
1081
|
+
export type StatementOfPlan<
|
|
1082
|
+
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any, any, any>
|
|
1083
|
+
> = QueryPlanState<PlanValue>["statement"]
|
|
1042
1084
|
/** Extracts the mutation target phantom carried by a query plan. */
|
|
1043
|
-
export type MutationTargetOfPlan<
|
|
1044
|
-
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any,
|
|
1085
|
+
export type MutationTargetOfPlan<
|
|
1086
|
+
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any, any, any>
|
|
1087
|
+
> = QueryPlanState<PlanValue>["target"]
|
|
1045
1088
|
/** Extracts whether an insert plan still needs a source attached. */
|
|
1046
|
-
export type InsertSourceStateOfPlan<
|
|
1047
|
-
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any, any,
|
|
1089
|
+
export type InsertSourceStateOfPlan<
|
|
1090
|
+
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any, any, any>
|
|
1091
|
+
> = QueryPlanState<PlanValue>["insertSource"]
|
|
1092
|
+
export type StateOfPlan<
|
|
1093
|
+
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any, any, any>
|
|
1094
|
+
> = QueryPlanParts<PlanValue>
|
|
1048
1095
|
|
|
1049
1096
|
type PresenceWitnessKeysOfSelection<Selection> = Selection extends Expression.Any
|
|
1050
1097
|
? AstOf<Selection> extends ExpressionAst.ColumnNode<any, any>
|
|
@@ -1060,7 +1107,7 @@ type PresenceWitnessKeysOfSelection<Selection> = Selection extends Expression.An
|
|
|
1060
1107
|
|
|
1061
1108
|
export type PresenceWitnessKeysOfSource<Source extends SourceLike> =
|
|
1062
1109
|
Source extends TableLike<any, any>
|
|
1063
|
-
? PresenceWitnessKeysOfSelection<Source[typeof
|
|
1110
|
+
? PresenceWitnessKeysOfSelection<Source[typeof RowSet.TypeId]["selection"]>
|
|
1064
1111
|
: Source extends { readonly columns: infer Columns }
|
|
1065
1112
|
? PresenceWitnessKeysOfSelection<Columns>
|
|
1066
1113
|
: never
|
|
@@ -1071,21 +1118,21 @@ export type PresenceWitnessKeysOfSource<Source extends SourceLike> =
|
|
|
1071
1118
|
* This is used by `from(...)` and the join builders.
|
|
1072
1119
|
*/
|
|
1073
1120
|
export type AddAvailable<
|
|
1074
|
-
Available extends Record<string,
|
|
1121
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1075
1122
|
Name extends string,
|
|
1076
|
-
Mode extends
|
|
1123
|
+
Mode extends RowSet.SourceMode = "required",
|
|
1077
1124
|
PresentFormula extends PredicateFormula = TrueFormula,
|
|
1078
1125
|
PresenceWitness extends string = never
|
|
1079
|
-
> = Available & Record<Name,
|
|
1126
|
+
> = Available & Record<Name, RowSet.Source<Name, Mode, PresentFormula, PresenceWitness>>
|
|
1080
1127
|
|
|
1081
1128
|
export type AddAvailableMany<
|
|
1082
|
-
Available extends Record<string,
|
|
1129
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1083
1130
|
Names extends string,
|
|
1084
|
-
Mode extends
|
|
1131
|
+
Mode extends RowSet.SourceMode = "required",
|
|
1085
1132
|
PresentFormula extends PredicateFormula = TrueFormula,
|
|
1086
1133
|
PresenceWitness extends string = never
|
|
1087
1134
|
> = Available & {
|
|
1088
|
-
readonly [K in Names]:
|
|
1135
|
+
readonly [K in Names]: RowSet.Source<K, Mode, PresentFormula, PresenceWitness>
|
|
1089
1136
|
}
|
|
1090
1137
|
|
|
1091
1138
|
/** Join mode projected into the plan's source-scope mode lattice. */
|
|
@@ -1094,27 +1141,27 @@ export type JoinSourceMode<Kind extends QueryAst.JoinKind> = Kind extends "left"
|
|
|
1094
1141
|
: "required"
|
|
1095
1142
|
|
|
1096
1143
|
type DemoteAllAvailable<
|
|
1097
|
-
Available extends Record<string,
|
|
1144
|
+
Available extends Record<string, RowSet.AnySource>
|
|
1098
1145
|
> = {
|
|
1099
|
-
readonly [K in keyof Available]: Available[K] extends
|
|
1146
|
+
readonly [K in keyof Available]: Available[K] extends RowSet.Source<
|
|
1100
1147
|
infer Name extends string,
|
|
1101
1148
|
any,
|
|
1102
1149
|
infer PresentFormula extends PredicateFormula,
|
|
1103
1150
|
infer PresenceWitness extends string
|
|
1104
1151
|
>
|
|
1105
|
-
?
|
|
1152
|
+
? RowSet.Source<Name, "optional", PresentFormula, PresenceWitness>
|
|
1106
1153
|
: never
|
|
1107
1154
|
}
|
|
1108
1155
|
|
|
1109
1156
|
export type ExistingAvailableAfterJoin<
|
|
1110
|
-
Available extends Record<string,
|
|
1157
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1111
1158
|
Kind extends QueryAst.JoinKind
|
|
1112
1159
|
> = Kind extends "right" | "full"
|
|
1113
1160
|
? DemoteAllAvailable<Available>
|
|
1114
1161
|
: Available
|
|
1115
1162
|
|
|
1116
1163
|
export type AvailableAfterJoin<
|
|
1117
|
-
Available extends Record<string,
|
|
1164
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1118
1165
|
JoinedName extends string,
|
|
1119
1166
|
Kind extends QueryAst.JoinKind,
|
|
1120
1167
|
PresentFormula extends PredicateFormula = TrueFormula,
|
|
@@ -1134,7 +1181,7 @@ export type AvailableAfterJoin<
|
|
|
1134
1181
|
*/
|
|
1135
1182
|
export type AddExpressionRequired<
|
|
1136
1183
|
Required,
|
|
1137
|
-
Available extends Record<string,
|
|
1184
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1138
1185
|
Value extends ExpressionInput
|
|
1139
1186
|
> = Exclude<Required | RequiredFromInput<Value>, AvailableNames<Available>>
|
|
1140
1187
|
|
|
@@ -1146,7 +1193,7 @@ export type AddExpressionRequired<
|
|
|
1146
1193
|
*/
|
|
1147
1194
|
export type AddJoinRequired<
|
|
1148
1195
|
Required,
|
|
1149
|
-
Available extends Record<string,
|
|
1196
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1150
1197
|
JoinedName extends string,
|
|
1151
1198
|
Predicate extends PredicateInput | never,
|
|
1152
1199
|
Kind extends QueryAst.JoinKind = "inner"
|
|
@@ -1157,8 +1204,8 @@ export type AddJoinRequired<
|
|
|
1157
1204
|
|
|
1158
1205
|
/** Merges two aggregation kinds through a derived expression. */
|
|
1159
1206
|
export type MergeAggregation<
|
|
1160
|
-
Left extends Expression.
|
|
1161
|
-
Right extends Expression.
|
|
1207
|
+
Left extends Expression.ScalarKind,
|
|
1208
|
+
Right extends Expression.ScalarKind
|
|
1162
1209
|
> = Left extends "window"
|
|
1163
1210
|
? "window"
|
|
1164
1211
|
: Right extends "window"
|
|
@@ -1172,9 +1219,9 @@ export type MergeAggregation<
|
|
|
1172
1219
|
/** Folds aggregation kinds across a tuple of expressions. */
|
|
1173
1220
|
type MergeAggregationTuple<
|
|
1174
1221
|
Values extends readonly Expression.Any[],
|
|
1175
|
-
Current extends Expression.
|
|
1222
|
+
Current extends Expression.ScalarKind = "scalar"
|
|
1176
1223
|
> = Values extends readonly [infer Head extends Expression.Any, ...infer Tail extends readonly Expression.Any[]]
|
|
1177
|
-
? MergeAggregationTuple<Tail, MergeAggregation<Current,
|
|
1224
|
+
? MergeAggregationTuple<Tail, MergeAggregation<Current, KindOf<Head>>>
|
|
1178
1225
|
: Current
|
|
1179
1226
|
|
|
1180
1227
|
/** Merges two nullability states for null-propagating scalar operators. */
|
|
@@ -1204,23 +1251,18 @@ export type TupleDialect<
|
|
|
1204
1251
|
Values extends readonly Expression.Any[]
|
|
1205
1252
|
> = Values[number] extends never ? never : DialectOf<Values[number]>
|
|
1206
1253
|
|
|
1207
|
-
/** Source union across a tuple of expressions. */
|
|
1208
|
-
export type TupleSource<
|
|
1209
|
-
Values extends readonly Expression.Any[]
|
|
1210
|
-
> = Values[number] extends never ? never : SourceOf<Values[number]>
|
|
1211
|
-
|
|
1212
1254
|
/** Converts a union into an intersection. */
|
|
1213
1255
|
type UnionToIntersection<Union> = (
|
|
1214
1256
|
Union extends any ? (value: Union) => void : never
|
|
1215
1257
|
) extends (value: infer Intersection) => void ? Intersection : never
|
|
1216
1258
|
|
|
1217
|
-
/** Dependency
|
|
1259
|
+
/** Dependency union across a tuple of scalar expressions. */
|
|
1218
1260
|
export type TupleDependencies<
|
|
1219
1261
|
Values extends readonly Expression.Any[]
|
|
1220
|
-
> =
|
|
1262
|
+
> = Values[number] extends never ? never : DependenciesOf<Values[number]>
|
|
1221
1263
|
|
|
1222
|
-
/** Builds
|
|
1223
|
-
export type DependencyRecord<Keys extends string> =
|
|
1264
|
+
/** Builds the canonical dependency union from a string union of table names. */
|
|
1265
|
+
export type DependencyRecord<Keys extends string> = Keys
|
|
1224
1266
|
|
|
1225
1267
|
/** Grouped expression identities carried by a tuple of scalar expressions. */
|
|
1226
1268
|
export type GroupedKeysFromValues<
|
|
@@ -1231,7 +1273,7 @@ export type GroupedKeysFromValues<
|
|
|
1231
1273
|
|
|
1232
1274
|
/** Whether a selection contains any aggregate expressions. */
|
|
1233
1275
|
type SelectionHasAggregate<Selection> = Selection extends Expression.Any
|
|
1234
|
-
?
|
|
1276
|
+
? KindOf<Selection> extends "aggregate" ? true : false
|
|
1235
1277
|
: Selection extends Record<string, any>
|
|
1236
1278
|
? Extract<{
|
|
1237
1279
|
[K in keyof Selection]: SelectionHasAggregate<Selection[K]>
|
|
@@ -1243,9 +1285,9 @@ type IsGroupedSelectionValid<
|
|
|
1243
1285
|
Selection,
|
|
1244
1286
|
Grouped extends string
|
|
1245
1287
|
> = Selection extends Expression.Any
|
|
1246
|
-
?
|
|
1288
|
+
? KindOf<Selection> extends "aggregate"
|
|
1247
1289
|
? true
|
|
1248
|
-
:
|
|
1290
|
+
: KindOf<Selection> extends "window"
|
|
1249
1291
|
? false
|
|
1250
1292
|
: RequiredFromDependencies<DependenciesOf<Selection>> extends never
|
|
1251
1293
|
? true
|
|
@@ -1281,7 +1323,7 @@ type MergeNullabilityStates<
|
|
|
1281
1323
|
|
|
1282
1324
|
type FoldEffectiveNullability<
|
|
1283
1325
|
Values extends readonly Expression.Any[],
|
|
1284
|
-
Available extends Record<string,
|
|
1326
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1285
1327
|
Assumptions extends PredicateFormula
|
|
1286
1328
|
> = Extract<{
|
|
1287
1329
|
[K in keyof Values]: Values[K] extends Expression.Any ? EffectiveNullability<Values[K], Available, Assumptions> : never
|
|
@@ -1295,7 +1337,7 @@ type FoldEffectiveNullability<
|
|
|
1295
1337
|
|
|
1296
1338
|
type CoalesceEffectiveNullability<
|
|
1297
1339
|
Values extends readonly Expression.Any[],
|
|
1298
|
-
Available extends Record<string,
|
|
1340
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1299
1341
|
Assumptions extends PredicateFormula
|
|
1300
1342
|
> = Extract<{
|
|
1301
1343
|
[K in keyof Values]: Values[K] extends Expression.Any ? EffectiveNullability<Values[K], Available, Assumptions> : never
|
|
@@ -1327,26 +1369,26 @@ type KnownGuaranteedSourceNames<
|
|
|
1327
1369
|
> = PreciseFactSet<GuaranteedSourceNames<Assumptions>>
|
|
1328
1370
|
|
|
1329
1371
|
type ExplicitlyRequiredSourceNames<
|
|
1330
|
-
Available extends Record<string,
|
|
1372
|
+
Available extends Record<string, RowSet.AnySource>
|
|
1331
1373
|
> = Extract<{
|
|
1332
1374
|
readonly [K in keyof Available]:
|
|
1333
|
-
Available[K] extends
|
|
1375
|
+
Available[K] extends RowSet.Source<any, infer Mode extends RowSet.SourceMode>
|
|
1334
1376
|
? Mode extends "required" ? K : never
|
|
1335
1377
|
: never
|
|
1336
1378
|
}[keyof Available], string>
|
|
1337
1379
|
|
|
1338
|
-
type PresentFormulaOfSource<Source extends
|
|
1339
|
-
Source extends
|
|
1380
|
+
type PresentFormulaOfSource<Source extends RowSet.AnySource> =
|
|
1381
|
+
Source extends RowSet.Source<any, any, infer PresentFormula extends PredicateFormula, any>
|
|
1340
1382
|
? PresentFormula
|
|
1341
1383
|
: TrueFormula
|
|
1342
1384
|
|
|
1343
|
-
type PresenceWitnessesOfSource<Source extends
|
|
1344
|
-
Source extends
|
|
1385
|
+
type PresenceWitnessesOfSource<Source extends RowSet.AnySource> =
|
|
1386
|
+
Source extends RowSet.Source<any, any, any, infer PresenceWitness extends string>
|
|
1345
1387
|
? PresenceWitness
|
|
1346
1388
|
: never
|
|
1347
1389
|
|
|
1348
1390
|
type ImpliedSourceNamesFromRequired<
|
|
1349
|
-
Available extends Record<string,
|
|
1391
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1350
1392
|
Required extends string
|
|
1351
1393
|
> = Extract<{
|
|
1352
1394
|
readonly [K in Extract<keyof Available, string>]:
|
|
@@ -1356,7 +1398,7 @@ type ImpliedSourceNamesFromRequired<
|
|
|
1356
1398
|
}[Extract<keyof Available, string>], string>
|
|
1357
1399
|
|
|
1358
1400
|
type ExpandRequiredSourceNames<
|
|
1359
|
-
Available extends Record<string,
|
|
1401
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1360
1402
|
Required extends string
|
|
1361
1403
|
> = ExpandRequiredSourceNamesStep<
|
|
1362
1404
|
Available,
|
|
@@ -1365,7 +1407,7 @@ type ExpandRequiredSourceNames<
|
|
|
1365
1407
|
>
|
|
1366
1408
|
|
|
1367
1409
|
type ExpandRequiredSourceNamesStep<
|
|
1368
|
-
Available extends Record<string,
|
|
1410
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1369
1411
|
Current extends string,
|
|
1370
1412
|
Next extends string
|
|
1371
1413
|
> = [Exclude<Next, Current>] extends [never]
|
|
@@ -1373,7 +1415,7 @@ type ExpandRequiredSourceNamesStep<
|
|
|
1373
1415
|
: ExpandRequiredSourceNames<Available, Next>
|
|
1374
1416
|
|
|
1375
1417
|
type DirectlyAbsentSourceNames<
|
|
1376
|
-
Available extends Record<string,
|
|
1418
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1377
1419
|
Assumptions extends PredicateFormula
|
|
1378
1420
|
> = Extract<{
|
|
1379
1421
|
readonly [K in Extract<keyof Available, string>]:
|
|
@@ -1389,7 +1431,7 @@ type DirectlyAbsentSourceNames<
|
|
|
1389
1431
|
}[Extract<keyof Available, string>], string>
|
|
1390
1432
|
|
|
1391
1433
|
type ImpliedAbsentSourceNames<
|
|
1392
|
-
Available extends Record<string,
|
|
1434
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1393
1435
|
Absent extends string
|
|
1394
1436
|
> = Extract<{
|
|
1395
1437
|
readonly [K in Extract<keyof Available, string>]:
|
|
@@ -1399,7 +1441,7 @@ type ImpliedAbsentSourceNames<
|
|
|
1399
1441
|
}[Extract<keyof Available, string>], string>
|
|
1400
1442
|
|
|
1401
1443
|
type ExpandAbsentSourceNames<
|
|
1402
|
-
Available extends Record<string,
|
|
1444
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1403
1445
|
Current extends string
|
|
1404
1446
|
> = ExpandAbsentSourceNamesStep<
|
|
1405
1447
|
Available,
|
|
@@ -1408,7 +1450,7 @@ type ExpandAbsentSourceNames<
|
|
|
1408
1450
|
>
|
|
1409
1451
|
|
|
1410
1452
|
type ExpandAbsentSourceNamesStep<
|
|
1411
|
-
Available extends Record<string,
|
|
1453
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1412
1454
|
Current extends string,
|
|
1413
1455
|
Next extends string
|
|
1414
1456
|
> = [Exclude<Next, Current>] extends [never]
|
|
@@ -1416,12 +1458,12 @@ type ExpandAbsentSourceNamesStep<
|
|
|
1416
1458
|
: ExpandAbsentSourceNames<Available, Next>
|
|
1417
1459
|
|
|
1418
1460
|
type AbsentSourceNamesInScope<
|
|
1419
|
-
Available extends Record<string,
|
|
1461
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1420
1462
|
Assumptions extends PredicateFormula
|
|
1421
1463
|
> = ExpandAbsentSourceNames<Available, DirectlyAbsentSourceNames<Available, Assumptions>>
|
|
1422
1464
|
|
|
1423
1465
|
type RequiredSourceNamesInScope<
|
|
1424
|
-
Available extends Record<string,
|
|
1466
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1425
1467
|
Assumptions extends PredicateFormula
|
|
1426
1468
|
> = Exclude<
|
|
1427
1469
|
ExpandRequiredSourceNames<
|
|
@@ -1432,17 +1474,17 @@ type RequiredSourceNamesInScope<
|
|
|
1432
1474
|
>
|
|
1433
1475
|
|
|
1434
1476
|
type EffectiveAvailable<
|
|
1435
|
-
Available extends Record<string,
|
|
1477
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1436
1478
|
Assumptions extends PredicateFormula
|
|
1437
1479
|
> = {
|
|
1438
1480
|
readonly [K in keyof Available]:
|
|
1439
|
-
Available[K] extends
|
|
1481
|
+
Available[K] extends RowSet.Source<
|
|
1440
1482
|
infer Name extends string,
|
|
1441
|
-
infer Mode extends
|
|
1483
|
+
infer Mode extends RowSet.SourceMode,
|
|
1442
1484
|
infer PresentFormula extends PredicateFormula,
|
|
1443
1485
|
infer PresenceWitness extends string
|
|
1444
1486
|
>
|
|
1445
|
-
?
|
|
1487
|
+
? RowSet.Source<
|
|
1446
1488
|
Name,
|
|
1447
1489
|
K extends RequiredSourceNamesInScope<Available, Assumptions> ? "required" : Mode,
|
|
1448
1490
|
PresentFormula,
|
|
@@ -1454,17 +1496,20 @@ type EffectiveAvailable<
|
|
|
1454
1496
|
}
|
|
1455
1497
|
|
|
1456
1498
|
type HasAbsentSource<
|
|
1457
|
-
Dependencies extends Expression.
|
|
1458
|
-
Available extends Record<string,
|
|
1499
|
+
Dependencies extends Expression.BindingId,
|
|
1500
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1459
1501
|
Assumptions extends PredicateFormula
|
|
1502
|
+
> = Extract<Dependencies, AbsentSourceNamesInScope<Available, Assumptions>> extends never ? false : true
|
|
1503
|
+
|
|
1504
|
+
type OptionalSourceNamesInScope<
|
|
1505
|
+
Available extends Record<string, RowSet.AnySource>
|
|
1460
1506
|
> = Extract<{
|
|
1461
|
-
[K in keyof
|
|
1462
|
-
|
|
1463
|
-
}[keyof Dependencies & string], true> extends never ? false : true
|
|
1507
|
+
[K in keyof Available & string]: SourceModeOf<Available, K> extends "optional" ? K : never
|
|
1508
|
+
}[keyof Available & string], string>
|
|
1464
1509
|
|
|
1465
1510
|
type BaseEffectiveNullability<
|
|
1466
1511
|
Value extends Expression.Any,
|
|
1467
|
-
Available extends Record<string,
|
|
1512
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1468
1513
|
Assumptions extends PredicateFormula
|
|
1469
1514
|
> = AstOf<Value> extends ExpressionAst.ColumnNode<infer TableName extends string, infer ColumnName extends string>
|
|
1470
1515
|
? TableName extends AbsentSourceNamesInScope<Available, Assumptions>
|
|
@@ -1474,22 +1519,18 @@ type BaseEffectiveNullability<
|
|
|
1474
1519
|
: `${TableName}.${ColumnName}` extends KnownGuaranteedNonNullKeys<Assumptions>
|
|
1475
1520
|
? "never"
|
|
1476
1521
|
: Expression.NullabilityOf<Value> extends "always" ? "always"
|
|
1477
|
-
: Expression.SourceNullabilityOf<Value> extends "resolved"
|
|
1478
|
-
? Expression.NullabilityOf<Value>
|
|
1479
1522
|
: HasAbsentSource<DependenciesOf<Value>, Available, Assumptions> extends true ? "always"
|
|
1480
|
-
|
|
1481
|
-
|
|
1523
|
+
: HasOptionalSource<DependenciesOf<Value>, Available> extends true ? "maybe"
|
|
1524
|
+
: Expression.NullabilityOf<Value>
|
|
1482
1525
|
: Expression.NullabilityOf<Value> extends "always" ? "always"
|
|
1483
|
-
:
|
|
1484
|
-
? Expression.NullabilityOf<Value>
|
|
1485
|
-
: HasAbsentSource<DependenciesOf<Value>, Available, Assumptions> extends true ? "always"
|
|
1526
|
+
: HasAbsentSource<DependenciesOf<Value>, Available, Assumptions> extends true ? "always"
|
|
1486
1527
|
: HasOptionalSource<DependenciesOf<Value>, Available> extends true ? "maybe"
|
|
1487
|
-
|
|
1528
|
+
: Expression.NullabilityOf<Value>
|
|
1488
1529
|
|
|
1489
1530
|
type CaseOutputOf<
|
|
1490
1531
|
Branches extends readonly ExpressionAst.CaseBranchNode[],
|
|
1491
1532
|
Else extends Expression.Any,
|
|
1492
|
-
Available extends Record<string,
|
|
1533
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1493
1534
|
Assumptions extends PredicateFormula
|
|
1494
1535
|
> = Branches extends readonly [
|
|
1495
1536
|
infer Head extends ExpressionAst.CaseBranchNode,
|
|
@@ -1506,56 +1547,71 @@ type CaseOutputOf<
|
|
|
1506
1547
|
: ExpressionOutput<Else, EffectiveAvailable<Available, Assumptions>, Assumptions>
|
|
1507
1548
|
|
|
1508
1549
|
/** Effective nullability of an expression after source-scope nullability is applied. */
|
|
1550
|
+
type EffectiveNullabilityOfAst<
|
|
1551
|
+
Value extends Expression.Any,
|
|
1552
|
+
Ast extends ExpressionAst.Any,
|
|
1553
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1554
|
+
Assumptions extends PredicateFormula = TrueAssumptions
|
|
1555
|
+
> = Ast extends ExpressionAst.ColumnNode<any, any>
|
|
1556
|
+
? BaseEffectiveNullability<Value, Available, Assumptions>
|
|
1557
|
+
: Ast extends ExpressionAst.LiteralNode<any>
|
|
1558
|
+
? Expression.NullabilityOf<Value>
|
|
1559
|
+
: Ast extends ExpressionAst.UnaryNode<infer Kind, infer UnaryValue extends Expression.Any>
|
|
1560
|
+
? Kind extends "upper" | "lower" | "not"
|
|
1561
|
+
? EffectiveNullability<UnaryValue, Available, Assumptions>
|
|
1562
|
+
: Kind extends "isNull" | "isNotNull" | "count"
|
|
1563
|
+
? "never"
|
|
1564
|
+
: Expression.NullabilityOf<Value>
|
|
1565
|
+
: Ast extends ExpressionAst.BinaryNode<"eq", infer Left extends Expression.Any, infer Right extends Expression.Any>
|
|
1566
|
+
? EffectiveNullability<Left, Available, Assumptions> extends "never"
|
|
1567
|
+
? EffectiveNullability<Right, Available, Assumptions> extends "never" ? "never" : "maybe"
|
|
1568
|
+
: "maybe"
|
|
1569
|
+
: Ast extends ExpressionAst.VariadicNode<infer Kind, infer Values extends readonly Expression.Any[]>
|
|
1570
|
+
? Kind extends "coalesce"
|
|
1571
|
+
? CoalesceEffectiveNullability<Values, Available, Assumptions>
|
|
1572
|
+
: Kind extends "and" | "or" | "concat"
|
|
1573
|
+
? FoldEffectiveNullability<Values, Available, Assumptions>
|
|
1574
|
+
: BaseEffectiveNullability<Value, Available, Assumptions>
|
|
1575
|
+
: Ast extends ExpressionAst.CaseNode<infer Branches extends readonly ExpressionAst.CaseBranchNode[], infer Else extends Expression.Any>
|
|
1576
|
+
? NullabilityOfOutput<CaseOutputOf<Branches, Else, Available, Assumptions>>
|
|
1577
|
+
: BaseEffectiveNullability<Value, Available, Assumptions>
|
|
1578
|
+
|
|
1509
1579
|
export type EffectiveNullability<
|
|
1510
1580
|
Value extends Expression.Any,
|
|
1511
|
-
Available extends Record<string,
|
|
1581
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1512
1582
|
Assumptions extends PredicateFormula = TrueAssumptions
|
|
1513
1583
|
> =
|
|
1514
1584
|
AstOf<Value> extends infer Ast extends ExpressionAst.Any
|
|
1515
|
-
? Ast
|
|
1516
|
-
? BaseEffectiveNullability<Value, Available, Assumptions>
|
|
1517
|
-
: Ast extends ExpressionAst.LiteralNode<any>
|
|
1518
|
-
? Expression.NullabilityOf<Value>
|
|
1519
|
-
: Ast extends ExpressionAst.UnaryNode<infer Kind, infer UnaryValue extends Expression.Any>
|
|
1520
|
-
? Kind extends "upper" | "lower" | "not"
|
|
1521
|
-
? EffectiveNullability<UnaryValue, Available, Assumptions>
|
|
1522
|
-
: Kind extends "isNull" | "isNotNull" | "count"
|
|
1523
|
-
? "never"
|
|
1524
|
-
: Expression.NullabilityOf<Value>
|
|
1525
|
-
: Ast extends ExpressionAst.BinaryNode<"eq", infer Left extends Expression.Any, infer Right extends Expression.Any>
|
|
1526
|
-
? EffectiveNullability<Left, Available, Assumptions> extends "never"
|
|
1527
|
-
? EffectiveNullability<Right, Available, Assumptions> extends "never" ? "never" : "maybe"
|
|
1528
|
-
: "maybe"
|
|
1529
|
-
: Ast extends ExpressionAst.VariadicNode<infer Kind, infer Values extends readonly Expression.Any[]>
|
|
1530
|
-
? Kind extends "coalesce"
|
|
1531
|
-
? CoalesceEffectiveNullability<Values, Available, Assumptions>
|
|
1532
|
-
: Kind extends "and" | "or" | "concat"
|
|
1533
|
-
? FoldEffectiveNullability<Values, Available, Assumptions>
|
|
1534
|
-
: BaseEffectiveNullability<Value, Available, Assumptions>
|
|
1535
|
-
: Ast extends ExpressionAst.CaseNode<infer Branches extends readonly ExpressionAst.CaseBranchNode[], infer Else extends Expression.Any>
|
|
1536
|
-
? NullabilityOfOutput<CaseOutputOf<Branches, Else, Available, Assumptions>>
|
|
1537
|
-
: BaseEffectiveNullability<Value, Available, Assumptions>
|
|
1585
|
+
? EffectiveNullabilityOfAst<Value, Ast, Available, Assumptions>
|
|
1538
1586
|
: BaseEffectiveNullability<Value, Available, Assumptions>
|
|
1539
1587
|
|
|
1540
1588
|
/** Result runtime type of an expression after effective nullability is resolved. */
|
|
1541
1589
|
export type ExpressionOutput<
|
|
1542
1590
|
Value extends Expression.Any,
|
|
1543
|
-
Available extends Record<string,
|
|
1591
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1544
1592
|
Assumptions extends PredicateFormula = TrueAssumptions
|
|
1545
|
-
> = AstOf<Value> extends
|
|
1546
|
-
?
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
? Expression.
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1593
|
+
> = AstOf<Value> extends infer Ast extends ExpressionAst.Any
|
|
1594
|
+
? Ast extends ExpressionAst.CaseNode<infer Branches extends readonly ExpressionAst.CaseBranchNode[], infer Else extends Expression.Any>
|
|
1595
|
+
? CaseOutputOf<Branches, Else, Available, Assumptions>
|
|
1596
|
+
: EffectiveNullabilityOfAst<Value, Ast, Available, Assumptions> extends infer Nullability
|
|
1597
|
+
? Expression.NullabilityOf<Value> extends infer BaseNullability
|
|
1598
|
+
? Expression.RuntimeOf<Value> extends infer Runtime
|
|
1599
|
+
? Nullability extends "never"
|
|
1600
|
+
? BaseNullability extends "never"
|
|
1601
|
+
? Runtime
|
|
1602
|
+
: NonNullable<Runtime>
|
|
1603
|
+
: Nullability extends "always"
|
|
1604
|
+
? null
|
|
1605
|
+
: Runtime | null
|
|
1606
|
+
: never
|
|
1607
|
+
: never
|
|
1608
|
+
: never
|
|
1609
|
+
: never
|
|
1554
1610
|
|
|
1555
1611
|
/** Result runtime type of a nested selection after source-scope nullability is resolved. */
|
|
1556
1612
|
export type OutputOfSelection<
|
|
1557
1613
|
Selection,
|
|
1558
|
-
Available extends Record<string,
|
|
1614
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1559
1615
|
Assumptions extends PredicateFormula = TrueAssumptions
|
|
1560
1616
|
> = Selection extends Expression.Any
|
|
1561
1617
|
? ExpressionOutput<Selection, Available, Assumptions>
|
|
@@ -1565,22 +1621,36 @@ export type OutputOfSelection<
|
|
|
1565
1621
|
}
|
|
1566
1622
|
: never
|
|
1567
1623
|
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1624
|
+
type ResolvedSelectionOutput<
|
|
1625
|
+
Selection,
|
|
1626
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1627
|
+
Assumptions extends PredicateFormula
|
|
1628
|
+
> = OutputOfSelection<
|
|
1629
|
+
Selection,
|
|
1630
|
+
EffectiveAvailable<Available, Assumptions>,
|
|
1631
|
+
Assumptions
|
|
1573
1632
|
>
|
|
1574
1633
|
|
|
1634
|
+
/** Resolved row type produced by a concrete query plan. */
|
|
1635
|
+
export type ResultRow<PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>> =
|
|
1636
|
+
SelectionOfPlan<PlanValue> extends infer Selection
|
|
1637
|
+
? AvailableOfPlan<PlanValue> extends infer Available extends Record<string, RowSet.AnySource>
|
|
1638
|
+
? AssumptionsOfPlan<PlanValue> extends infer Assumptions extends PredicateFormula
|
|
1639
|
+
? ResolvedSelectionOutput<Selection, Available, Assumptions>
|
|
1640
|
+
: never
|
|
1641
|
+
: never
|
|
1642
|
+
: never
|
|
1643
|
+
|
|
1575
1644
|
/** Resolved row collection type produced by a concrete query plan. */
|
|
1576
1645
|
export type ResultRows<PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>> = ReadonlyArray<ResultRow<PlanValue>>
|
|
1577
1646
|
|
|
1578
1647
|
/** Conservative runtime row shape produced by remapping projection aliases. */
|
|
1579
|
-
export type RuntimeResultRow<PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>> =
|
|
1580
|
-
PlanValue
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1648
|
+
export type RuntimeResultRow<PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>> =
|
|
1649
|
+
SelectionOfPlan<PlanValue> extends infer Selection
|
|
1650
|
+
? AvailableOfPlan<PlanValue> extends infer Available extends Record<string, RowSet.AnySource>
|
|
1651
|
+
? OutputOfSelection<Selection, Available, TrueAssumptions>
|
|
1652
|
+
: never
|
|
1653
|
+
: never
|
|
1584
1654
|
|
|
1585
1655
|
/** Conservative runtime row collection type. */
|
|
1586
1656
|
export type RuntimeResultRows<PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>> = ReadonlyArray<RuntimeResultRow<PlanValue>>
|
|
@@ -1613,7 +1683,7 @@ type DialectCompatibilityError<
|
|
|
1613
1683
|
EngineDialect extends string
|
|
1614
1684
|
> = PlanValue & {
|
|
1615
1685
|
readonly __effect_qb_error__: "effect-qb: plan dialect is not compatible with the target renderer or executor"
|
|
1616
|
-
readonly __effect_qb_plan_dialect__: PlanValue[typeof
|
|
1686
|
+
readonly __effect_qb_plan_dialect__: PlanValue[typeof RowSet.TypeId]["dialect"]
|
|
1617
1687
|
readonly __effect_qb_target_dialect__: EngineDialect
|
|
1618
1688
|
readonly __effect_qb_hint__: "Use the matching dialect module or renderer/executor"
|
|
1619
1689
|
}
|
|
@@ -1640,25 +1710,23 @@ type InsertHasOptionalDefaults<
|
|
|
1640
1710
|
/** Narrows a query plan to aggregate-compatible selections. */
|
|
1641
1711
|
export type AggregationCompatiblePlan<
|
|
1642
1712
|
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>
|
|
1643
|
-
> = PlanValue
|
|
1644
|
-
?
|
|
1645
|
-
:
|
|
1713
|
+
> = IsAggregationCompatibleSelection<SelectionOfPlan<PlanValue>, GroupedOfPlan<PlanValue>> extends true
|
|
1714
|
+
? PlanValue
|
|
1715
|
+
: AggregationCompatibilityError<PlanValue>
|
|
1646
1716
|
|
|
1647
1717
|
/** Narrows a query plan to aggregate-compatible, source-complete plans. */
|
|
1648
1718
|
export type CompletePlan<PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>> =
|
|
1649
|
-
PlanValue extends
|
|
1650
|
-
?
|
|
1651
|
-
?
|
|
1652
|
-
?
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
: IsAggregationCompatibleSelection<Selection, Grouped> extends true ? PlanValue : AggregationCompatibilityError<PlanValue>
|
|
1661
|
-
: never
|
|
1719
|
+
StatementOfPlan<PlanValue> extends "insert"
|
|
1720
|
+
? InsertSourceStateOfPlan<PlanValue> extends "missing"
|
|
1721
|
+
? InsertHasOptionalDefaults<PlanValue> extends true
|
|
1722
|
+
? PlanValue
|
|
1723
|
+
: InsertSourceCompletenessError<PlanValue>
|
|
1724
|
+
: HasKnownOutstanding<RequiredOfPlan<PlanValue>> extends true
|
|
1725
|
+
? SourceCompletenessError<PlanValue, Extract<RequiredOfPlan<PlanValue>, string>>
|
|
1726
|
+
: IsAggregationCompatibleSelection<SelectionOfPlan<PlanValue>, GroupedOfPlan<PlanValue>> extends true ? PlanValue : AggregationCompatibilityError<PlanValue>
|
|
1727
|
+
: HasKnownOutstanding<RequiredOfPlan<PlanValue>> extends true
|
|
1728
|
+
? SourceCompletenessError<PlanValue, Extract<RequiredOfPlan<PlanValue>, string>>
|
|
1729
|
+
: IsAggregationCompatibleSelection<SelectionOfPlan<PlanValue>, GroupedOfPlan<PlanValue>> extends true ? PlanValue : AggregationCompatibilityError<PlanValue>
|
|
1662
1730
|
|
|
1663
1731
|
/** Whether a plan dialect is compatible with a target engine dialect. */
|
|
1664
1732
|
type IsDialectCompatible<
|
|
@@ -1674,7 +1742,7 @@ type IsDialectCompatible<
|
|
|
1674
1742
|
export type DialectCompatiblePlan<
|
|
1675
1743
|
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>,
|
|
1676
1744
|
EngineDialect extends string
|
|
1677
|
-
> = IsDialectCompatible<PlanValue[typeof
|
|
1745
|
+
> = IsDialectCompatible<PlanValue[typeof RowSet.TypeId]["dialect"], EngineDialect> extends true
|
|
1678
1746
|
? CompletePlan<PlanValue>
|
|
1679
1747
|
: DialectCompatibilityError<PlanValue, EngineDialect>
|
|
1680
1748
|
|
|
@@ -1682,7 +1750,7 @@ export type DialectCompatiblePlan<
|
|
|
1682
1750
|
export type DialectCompatibleNestedPlan<
|
|
1683
1751
|
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>,
|
|
1684
1752
|
EngineDialect extends string
|
|
1685
|
-
> = IsDialectCompatible<PlanValue[typeof
|
|
1753
|
+
> = IsDialectCompatible<PlanValue[typeof RowSet.TypeId]["dialect"], EngineDialect> extends true
|
|
1686
1754
|
? AggregationCompatiblePlan<PlanValue>
|
|
1687
1755
|
: DialectCompatibilityError<PlanValue, EngineDialect>
|
|
1688
1756
|
|
|
@@ -1767,11 +1835,9 @@ export type SetCompatibleRightPlan<
|
|
|
1767
1835
|
|
|
1768
1836
|
/** True when any of an expression's dependencies are optional in the current scope. */
|
|
1769
1837
|
type HasOptionalSource<
|
|
1770
|
-
Dependencies extends Expression.
|
|
1771
|
-
Available extends Record<string,
|
|
1772
|
-
> = Extract<
|
|
1773
|
-
[K in keyof Dependencies & string]: SourceModeOf<Available, K> extends "optional" ? true : never
|
|
1774
|
-
}[keyof Dependencies & string], true> extends never ? false : true
|
|
1838
|
+
Dependencies extends Expression.BindingId,
|
|
1839
|
+
Available extends Record<string, RowSet.AnySource>
|
|
1840
|
+
> = Extract<Dependencies, OptionalSourceNamesInScope<Available>> extends never ? false : true
|
|
1775
1841
|
|
|
1776
1842
|
/**
|
|
1777
1843
|
* Concrete query-plan value produced by the query DSL.
|
|
@@ -1783,65 +1849,51 @@ type HasOptionalSource<
|
|
|
1783
1849
|
export type QueryPlan<
|
|
1784
1850
|
Selection,
|
|
1785
1851
|
Required = never,
|
|
1786
|
-
Available extends Record<string,
|
|
1852
|
+
Available extends Record<string, RowSet.AnySource> = {},
|
|
1787
1853
|
Dialect extends string = never,
|
|
1788
1854
|
Grouped extends string = never,
|
|
1789
|
-
ScopedNames extends string =
|
|
1790
|
-
Outstanding extends string =
|
|
1855
|
+
ScopedNames extends string = never,
|
|
1856
|
+
Outstanding extends string = never,
|
|
1791
1857
|
Assumptions extends PredicateFormula = TrueAssumptions,
|
|
1792
1858
|
Capabilities extends QueryCapability = "read",
|
|
1793
1859
|
Statement extends QueryAst.QueryStatement = "select",
|
|
1794
|
-
Target =
|
|
1860
|
+
Target = any,
|
|
1795
1861
|
InsertState extends InsertSourceState = InsertSourceState
|
|
1796
|
-
> =
|
|
1797
|
-
readonly [
|
|
1862
|
+
> = RowSet.RowSet<Selection, Required, Available, Dialect> & {
|
|
1863
|
+
readonly [QueryTypeId]: QueryState<
|
|
1864
|
+
Outstanding,
|
|
1865
|
+
ScopedNames,
|
|
1866
|
+
Grouped,
|
|
1867
|
+
Assumptions,
|
|
1868
|
+
Capabilities,
|
|
1869
|
+
Statement,
|
|
1870
|
+
Target,
|
|
1871
|
+
InsertState
|
|
1872
|
+
>
|
|
1798
1873
|
readonly [QueryAst.TypeId]: QueryAst.Ast<Selection, Grouped, Statement>
|
|
1799
|
-
readonly [QueryTypeId]: QueryState<Outstanding, ScopedNames, Grouped, Assumptions, Capabilities, Statement, Target, InsertState>
|
|
1800
1874
|
}
|
|
1801
1875
|
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
*
|
|
1805
|
-
* Single-source expressions store one provenance object, while derived
|
|
1806
|
-
* operators may carry multiple sources. This helper hides that shape
|
|
1807
|
-
* difference.
|
|
1808
|
-
*/
|
|
1809
|
-
const normalizeSources = (source: unknown): readonly unknown[] =>
|
|
1810
|
-
source === undefined ? [] : Array.isArray(source) ? source : [source]
|
|
1811
|
-
|
|
1812
|
-
/**
|
|
1813
|
-
* Merges the provenance of two expressions into one normalized runtime value.
|
|
1814
|
-
*
|
|
1815
|
-
* The result is:
|
|
1816
|
-
* - `undefined` when neither side is sourced
|
|
1817
|
-
* - a single provenance object when exactly one source exists
|
|
1818
|
-
* - an array when multiple sources are involved
|
|
1819
|
-
*/
|
|
1820
|
-
export const mergeSources = (left: unknown, right?: unknown): unknown => {
|
|
1821
|
-
const values = [...normalizeSources(left), ...normalizeSources(right)]
|
|
1822
|
-
if (values.length === 0) {
|
|
1823
|
-
return undefined
|
|
1824
|
-
}
|
|
1825
|
-
if (values.length === 1) {
|
|
1826
|
-
return values[0]
|
|
1827
|
-
}
|
|
1828
|
-
return values
|
|
1876
|
+
export namespace Plan {
|
|
1877
|
+
export type Any = QueryPlan<any, any, any, any, any, any, any, any, any, any>
|
|
1829
1878
|
}
|
|
1830
1879
|
|
|
1831
|
-
/** Merges two expression dependency
|
|
1832
|
-
export const mergeDependencies =
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1880
|
+
/** Merges two expression dependency records into a single normalized record. */
|
|
1881
|
+
export const mergeDependencies = <
|
|
1882
|
+
Left extends Expression.BindingId = never,
|
|
1883
|
+
Right extends Expression.BindingId = never
|
|
1884
|
+
>(
|
|
1885
|
+
left: Record<Left, true> | undefined,
|
|
1886
|
+
right: Record<Right, true> | undefined = undefined
|
|
1887
|
+
): Record<Left | Right, true> => ({
|
|
1888
|
+
...(left ?? {}),
|
|
1889
|
+
...(right ?? {})
|
|
1890
|
+
}) as Record<Left | Right, true>
|
|
1839
1891
|
|
|
1840
1892
|
/** Merges expression aggregation kinds at runtime. */
|
|
1841
1893
|
export const mergeAggregationRuntime = (
|
|
1842
|
-
left: Expression.
|
|
1843
|
-
right: Expression.
|
|
1844
|
-
): Expression.
|
|
1894
|
+
left: Expression.ScalarKind,
|
|
1895
|
+
right: Expression.ScalarKind = "scalar"
|
|
1896
|
+
): Expression.ScalarKind =>
|
|
1845
1897
|
left === "window" || right === "window"
|
|
1846
1898
|
? "window"
|
|
1847
1899
|
: left === "aggregate" || right === "aggregate"
|
|
@@ -1851,10 +1903,10 @@ export const mergeAggregationRuntime = (
|
|
|
1851
1903
|
/** Folds runtime aggregation across a list of expressions. */
|
|
1852
1904
|
export const mergeAggregationManyRuntime = (
|
|
1853
1905
|
values: readonly Expression.Any[]
|
|
1854
|
-
): Expression.
|
|
1906
|
+
): Expression.ScalarKind =>
|
|
1855
1907
|
values.reduce(
|
|
1856
|
-
(current, value) => mergeAggregationRuntime(current, value[Expression.TypeId].
|
|
1857
|
-
"scalar" as Expression.
|
|
1908
|
+
(current, value) => mergeAggregationRuntime(current, value[Expression.TypeId].kind),
|
|
1909
|
+
"scalar" as Expression.ScalarKind
|
|
1858
1910
|
)
|
|
1859
1911
|
|
|
1860
1912
|
/** Merges expression nullability for null-propagating scalar operators. */
|
|
@@ -1877,19 +1929,14 @@ export const mergeNullabilityManyRuntime = (
|
|
|
1877
1929
|
"never" as Expression.Nullability
|
|
1878
1930
|
)
|
|
1879
1931
|
|
|
1880
|
-
/** Merges provenance across a variadic expression input list. */
|
|
1881
|
-
export const mergeManySources = (values: readonly Expression.Any[]): unknown =>
|
|
1882
|
-
values.reduce<unknown>(
|
|
1883
|
-
(current, value) => mergeSources(current, value[Expression.TypeId].source),
|
|
1884
|
-
undefined
|
|
1885
|
-
)
|
|
1886
|
-
|
|
1887
1932
|
/** Merges dependency maps across a variadic expression input list. */
|
|
1888
|
-
export const mergeManyDependencies =
|
|
1889
|
-
values
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1933
|
+
export const mergeManyDependencies = <Values extends readonly Expression.Any[]>(
|
|
1934
|
+
values: Values
|
|
1935
|
+
): Record<TupleDependencies<Values>, true> =>
|
|
1936
|
+
values.reduce<Record<string, true>>(
|
|
1937
|
+
(current, value) => mergeDependencies(current, value[Expression.TypeId].dependencies) as Record<string, true>,
|
|
1938
|
+
{}
|
|
1939
|
+
) as Record<TupleDependencies<Values>, true>
|
|
1893
1940
|
|
|
1894
1941
|
/**
|
|
1895
1942
|
* Creates a runtime expression object from fully computed static metadata.
|
|
@@ -1902,19 +1949,41 @@ export const makeExpression = <
|
|
|
1902
1949
|
Db extends Expression.DbType.Any,
|
|
1903
1950
|
Nullable extends Expression.Nullability,
|
|
1904
1951
|
Dialect extends string,
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
Ast extends ExpressionAst.Any = ExpressionAst.Any
|
|
1952
|
+
Kind extends Expression.ScalarKind,
|
|
1953
|
+
Deps extends Expression.BindingId = never,
|
|
1954
|
+
Ast extends ExpressionAst.Any = ExpressionAst.Any,
|
|
1955
|
+
GroupKey extends string = GroupingKeyOfAst<Ast>
|
|
1910
1956
|
>(
|
|
1911
|
-
state:
|
|
1957
|
+
state: {
|
|
1958
|
+
readonly runtime: Runtime
|
|
1959
|
+
readonly dbType: Db
|
|
1960
|
+
readonly runtimeSchema?: Schema.Schema.Any
|
|
1961
|
+
readonly nullability: Nullable
|
|
1962
|
+
readonly dialect: Dialect
|
|
1963
|
+
readonly kind?: Kind
|
|
1964
|
+
readonly dependencies?: Record<string, true>
|
|
1965
|
+
},
|
|
1912
1966
|
ast: Ast
|
|
1913
|
-
): Expression.
|
|
1967
|
+
): Expression.Scalar<Runtime, Db, Nullable, Dialect, Kind, Deps, GroupKey> & {
|
|
1914
1968
|
readonly [ExpressionAst.TypeId]: Ast
|
|
1915
1969
|
} => {
|
|
1916
1970
|
const expression = Object.create(ExpressionProto)
|
|
1917
|
-
expression
|
|
1971
|
+
Object.defineProperty(expression, "pipe", {
|
|
1972
|
+
configurable: true,
|
|
1973
|
+
writable: true,
|
|
1974
|
+
value: function(this: unknown) {
|
|
1975
|
+
return pipeArguments(expression, arguments)
|
|
1976
|
+
}
|
|
1977
|
+
})
|
|
1978
|
+
expression[Expression.TypeId] = {
|
|
1979
|
+
runtime: state.runtime,
|
|
1980
|
+
dbType: state.dbType,
|
|
1981
|
+
runtimeSchema: state.runtimeSchema,
|
|
1982
|
+
nullability: state.nullability,
|
|
1983
|
+
dialect: state.dialect,
|
|
1984
|
+
kind: state.kind ?? ("scalar" as Kind),
|
|
1985
|
+
dependencies: state.dependencies ?? {}
|
|
1986
|
+
} as Expression.State<Runtime, Db, Nullable, Dialect, Kind, Deps>
|
|
1918
1987
|
expression[ExpressionAst.TypeId] = ast
|
|
1919
1988
|
return expression
|
|
1920
1989
|
}
|
|
@@ -1926,7 +1995,7 @@ export const makeExpression = <
|
|
|
1926
1995
|
export const makePlan = <
|
|
1927
1996
|
Selection,
|
|
1928
1997
|
Required,
|
|
1929
|
-
Available extends Record<string,
|
|
1998
|
+
Available extends Record<string, RowSet.AnySource>,
|
|
1930
1999
|
Dialect extends string,
|
|
1931
2000
|
Grouped extends string = never,
|
|
1932
2001
|
ScopedNames extends string = Extract<keyof Available, string>,
|
|
@@ -1934,10 +2003,10 @@ export const makePlan = <
|
|
|
1934
2003
|
Assumptions extends PredicateFormula = TrueAssumptions,
|
|
1935
2004
|
Capabilities extends QueryCapability = "read",
|
|
1936
2005
|
Statement extends QueryAst.QueryStatement = "select",
|
|
1937
|
-
Target =
|
|
1938
|
-
InsertState extends InsertSourceState =
|
|
2006
|
+
Target = any,
|
|
2007
|
+
InsertState extends InsertSourceState = InsertSourceState
|
|
1939
2008
|
>(
|
|
1940
|
-
state:
|
|
2009
|
+
state: RowSet.State<Selection, Required, Available, Dialect>,
|
|
1941
2010
|
ast: QueryAst.Ast<Selection, Grouped, Statement>,
|
|
1942
2011
|
_assumptions?: Assumptions,
|
|
1943
2012
|
_capabilities?: Capabilities,
|
|
@@ -1946,7 +2015,14 @@ export const makePlan = <
|
|
|
1946
2015
|
_insertState?: InsertState
|
|
1947
2016
|
): QueryPlan<Selection, Required, Available, Dialect, Grouped, ScopedNames, Outstanding, Assumptions, Capabilities, Statement, Target, InsertState> => {
|
|
1948
2017
|
const plan = Object.create(PlanProto)
|
|
1949
|
-
plan
|
|
2018
|
+
Object.defineProperty(plan, "pipe", {
|
|
2019
|
+
configurable: true,
|
|
2020
|
+
writable: true,
|
|
2021
|
+
value: function(this: unknown) {
|
|
2022
|
+
return pipeArguments(plan, arguments)
|
|
2023
|
+
}
|
|
2024
|
+
})
|
|
2025
|
+
plan[RowSet.TypeId] = state
|
|
1950
2026
|
plan[QueryAst.TypeId] = ast
|
|
1951
2027
|
plan[QueryTypeId] = {
|
|
1952
2028
|
required: undefined as unknown as Outstanding,
|