effect-qb 4.0.0-beta.66 → 4.0.0-beta.98
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 +5 -2
- package/dist/index.js +9376 -0
- package/dist/mysql.js +3921 -2573
- package/dist/postgres/metadata.js +2491 -1373
- package/dist/postgres.js +5453 -5155
- package/dist/sqlite.js +6895 -5529
- package/dist/standard.js +9330 -0
- package/package.json +9 -2
- package/src/casing.ts +71 -0
- package/src/index.ts +2 -0
- package/src/internal/casing.ts +89 -0
- package/src/internal/coercion/rules.ts +13 -1
- package/src/internal/column-state.ts +21 -15
- package/src/internal/column.ts +44 -7
- package/src/internal/datatypes/define.ts +7 -1
- package/src/internal/datatypes/enrich.ts +23 -0
- package/src/internal/datatypes/lookup.ts +81 -25
- package/src/internal/datatypes/matrix.ts +903 -0
- package/src/internal/datatypes/shape.ts +2 -0
- package/src/internal/derived-table.ts +4 -36
- package/src/{mysql/internal/sql-expression-renderer.ts → internal/dialect-renderers/mysql.ts} +552 -361
- package/src/{postgres/internal/sql-expression-renderer.ts → internal/dialect-renderers/postgres.ts} +657 -400
- package/src/{sqlite/internal/sql-expression-renderer.ts → internal/dialect-renderers/sqlite.ts} +505 -347
- package/src/internal/dialect.ts +35 -0
- package/src/internal/dsl-mutation-runtime.ts +12 -162
- package/src/internal/dsl-plan-runtime.ts +10 -138
- package/src/internal/dsl-query-runtime.ts +5 -79
- package/src/internal/dsl-transaction-ddl-runtime.ts +41 -65
- package/src/internal/executor.ts +14 -16
- package/src/internal/grouping-key.ts +87 -20
- package/src/internal/implication-runtime.ts +1 -1
- package/src/internal/json/path-access.ts +351 -0
- package/src/internal/predicate/runtime.ts +3 -0
- package/src/internal/query.d.ts +38 -11
- package/src/internal/query.ts +64 -25
- package/src/internal/renderer.ts +26 -14
- package/src/internal/runtime/normalize.ts +12 -5
- package/src/internal/scalar.ts +7 -1
- package/src/internal/schema-derivation.d.ts +7 -7
- package/src/internal/schema-derivation.ts +9 -9
- package/src/internal/schema-expression.ts +2 -2
- package/src/internal/sql-expression-renderer.ts +19 -0
- package/src/internal/standard-dsl.ts +6978 -0
- package/src/internal/table-options.ts +126 -66
- package/src/internal/table.ts +652 -219
- package/src/mysql/column-extension.ts +3 -0
- package/src/mysql/column.ts +8 -9
- package/src/mysql/datatypes/index.ts +4 -2
- package/src/mysql/datatypes/spec.ts +6 -176
- package/src/mysql/errors/normalize.ts +0 -1
- package/src/mysql/executor.ts +7 -7
- package/src/mysql/internal/dialect.ts +9 -4
- package/src/mysql/internal/dsl.ts +312 -154
- package/src/mysql/internal/renderer.ts +6 -2
- package/src/mysql/json.ts +7 -2
- package/src/mysql/query-extension.ts +16 -0
- package/src/mysql/renderer.ts +37 -3
- package/src/mysql/type.ts +60 -0
- package/src/mysql.ts +7 -13
- package/src/postgres/check.ts +1 -0
- package/src/postgres/column-extension.ts +28 -0
- package/src/postgres/column.ts +2 -8
- package/src/postgres/datatypes/index.d.ts +2 -1
- package/src/postgres/datatypes/index.ts +4 -2
- package/src/postgres/datatypes/spec.ts +6 -260
- package/src/postgres/errors/normalize.ts +0 -1
- package/src/postgres/executor.ts +7 -7
- package/src/postgres/foreign-key.ts +24 -0
- package/src/postgres/function/core.ts +1 -3
- package/src/postgres/function/index.ts +1 -17
- package/src/postgres/index.ts +1 -0
- package/src/postgres/internal/dialect.ts +9 -4
- package/src/postgres/internal/dsl.ts +306 -163
- package/src/postgres/internal/renderer.ts +6 -2
- package/src/postgres/internal/schema-ddl.ts +22 -10
- package/src/postgres/internal/schema-model.ts +238 -7
- package/src/postgres/json-extension.ts +7 -0
- package/src/postgres/json.ts +762 -173
- package/src/postgres/jsonb.ts +37 -0
- package/src/postgres/primary-key.ts +24 -0
- package/src/postgres/query-extension.ts +2 -0
- package/src/postgres/renderer.ts +37 -3
- package/src/postgres/schema-management.ts +12 -11
- package/src/postgres/schema.ts +106 -15
- package/src/postgres/table.ts +205 -530
- package/src/postgres/type.ts +93 -10
- package/src/postgres/unique.ts +32 -0
- package/src/postgres.ts +20 -16
- package/src/sqlite/column-extension.ts +3 -0
- package/src/sqlite/column.ts +8 -9
- package/src/sqlite/datatypes/index.ts +4 -2
- package/src/sqlite/datatypes/spec.ts +6 -94
- package/src/sqlite/errors/normalize.ts +0 -1
- package/src/sqlite/executor.ts +7 -7
- package/src/sqlite/internal/dialect.ts +9 -4
- package/src/sqlite/internal/dsl.ts +301 -154
- package/src/sqlite/internal/renderer.ts +6 -2
- package/src/sqlite/json.ts +8 -2
- package/src/sqlite/query-extension.ts +2 -0
- package/src/sqlite/renderer.ts +37 -3
- package/src/sqlite/type.ts +40 -0
- package/src/sqlite.ts +7 -13
- package/src/standard/cast.ts +113 -0
- package/src/standard/check.ts +17 -0
- package/src/standard/column.ts +163 -0
- package/src/standard/datatypes/index.ts +83 -0
- package/src/standard/datatypes/spec.ts +12 -0
- package/src/standard/dialect.ts +40 -0
- package/src/standard/foreign-key.ts +37 -0
- package/src/standard/function/aggregate.ts +2 -0
- package/src/standard/function/core.ts +2 -0
- package/src/standard/function/index.ts +18 -0
- package/src/standard/function/string.ts +2 -0
- package/src/standard/function/temporal.ts +78 -0
- package/src/standard/function/window.ts +2 -0
- package/src/standard/index.ts +17 -0
- package/src/standard/internal/renderer.ts +45 -0
- package/src/standard/json.ts +883 -0
- package/src/standard/primary-key.ts +17 -0
- package/src/standard/query.ts +152 -0
- package/src/standard/renderer.ts +49 -0
- package/src/standard/table.ts +151 -0
- package/src/standard/unique.ts +17 -0
- package/src/standard.ts +32 -0
- package/src/internal/aggregation-validation.ts +0 -57
- package/src/internal/table.d.ts +0 -180
- package/src/mysql/table.ts +0 -186
- package/src/postgres/cast.ts +0 -45
- package/src/sqlite/table.ts +0 -175
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pipeArguments } from "effect/Pipeable"
|
|
1
|
+
import { pipeArguments, type Pipeable } from "effect/Pipeable"
|
|
2
2
|
import * as Schema from "effect/Schema"
|
|
3
3
|
|
|
4
4
|
import { sqliteDatatypes } from "../datatypes/index.js"
|
|
@@ -6,6 +6,12 @@ import { sqliteDatatypes } from "../datatypes/index.js"
|
|
|
6
6
|
import * as Expression from "../../internal/scalar.js"
|
|
7
7
|
import * as Plan from "../../internal/row-set.js"
|
|
8
8
|
import * as Table from "../../internal/table.js"
|
|
9
|
+
import type {
|
|
10
|
+
LiteralStringInput,
|
|
11
|
+
NonEmptyStringInput,
|
|
12
|
+
SafeSqlIdentifierInput,
|
|
13
|
+
SafeSqlIdentifierPathInput
|
|
14
|
+
} from "../../internal/table-options.js"
|
|
9
15
|
import type { CastTargetError, OperandCompatibilityError } from "../../internal/coercion/errors.js"
|
|
10
16
|
import type { RuntimeOfDbType } from "../../internal/coercion/analysis.js"
|
|
11
17
|
import type { CanCastDbType, CanCompareDbTypes, CanContainDbTypes, CanTextuallyCoerceDbType } from "../../internal/coercion/rules.js"
|
|
@@ -71,6 +77,7 @@ import {
|
|
|
71
77
|
type ScopedNamesOfPlan,
|
|
72
78
|
type SelectionOfPlan,
|
|
73
79
|
type SelectionShape,
|
|
80
|
+
type SelectionProjectionAliasCollisionConstraint,
|
|
74
81
|
type SetCompatiblePlan,
|
|
75
82
|
type SetCompatibleRightPlan,
|
|
76
83
|
type SchemaTableLike,
|
|
@@ -135,7 +142,7 @@ import * as ProjectionAlias from "../../internal/projection-alias.js"
|
|
|
135
142
|
import * as QueryAst from "../../internal/query-ast.js"
|
|
136
143
|
import { normalizeColumnList } from "../../internal/table-options.js"
|
|
137
144
|
|
|
138
|
-
type MutationTargetLike = Table.AnyTable<Dialect>
|
|
145
|
+
type MutationTargetLike = Table.AnyTable<Dialect | "standard">
|
|
139
146
|
type MutationTargetTuple = readonly [MutationTargetLike, MutationTargetLike, ...MutationTargetLike[]]
|
|
140
147
|
type MutationTargetInput = MutationTargetLike | MutationTargetTuple
|
|
141
148
|
|
|
@@ -711,7 +718,7 @@ type NumericExpressionDialectInput<
|
|
|
711
718
|
BoolDb extends Expression.DbType.Any,
|
|
712
719
|
TimestampDb extends Expression.DbType.Any,
|
|
713
720
|
NullDb extends Expression.DbType.Any
|
|
714
|
-
> = Exclude<DialectOfDialectNumericInput<Value, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect> extends never
|
|
721
|
+
> = Exclude<DialectOfDialectNumericInput<Value, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect | "standard"> extends never
|
|
715
722
|
? unknown
|
|
716
723
|
: {
|
|
717
724
|
readonly __effect_qb_error__: "effect-qb: numeric expressions cannot mix dialects"
|
|
@@ -804,6 +811,35 @@ type DialectExpressionArray<
|
|
|
804
811
|
? Tuple
|
|
805
812
|
: never
|
|
806
813
|
|
|
814
|
+
type ExtractFunctionFieldInput<
|
|
815
|
+
Value extends ExpressionInput
|
|
816
|
+
> = Value extends string
|
|
817
|
+
? SafeSqlIdentifierInput<Value>
|
|
818
|
+
: Value extends { readonly [ExpressionAst.TypeId]: ExpressionAst.LiteralNode<infer Field extends string> }
|
|
819
|
+
? SafeSqlIdentifierInput<Field> extends never ? never : Value
|
|
820
|
+
: never
|
|
821
|
+
|
|
822
|
+
type GenericFunctionNameInput<Name extends string> =
|
|
823
|
+
Name extends "current_date" | "extract" ? never : SafeSqlIdentifierPathInput<Name>
|
|
824
|
+
|
|
825
|
+
type FunctionCallApi = {
|
|
826
|
+
(name: "current_date"): Expression.Any
|
|
827
|
+
<Field extends string, Source extends ExpressionInput>(
|
|
828
|
+
name: "extract",
|
|
829
|
+
field: SafeSqlIdentifierInput<Field>,
|
|
830
|
+
source: Source
|
|
831
|
+
): Expression.Any
|
|
832
|
+
<Field extends Expression.Any, Source extends ExpressionInput>(
|
|
833
|
+
name: "extract",
|
|
834
|
+
field: Field & ExtractFunctionFieldInput<Field>,
|
|
835
|
+
source: Source
|
|
836
|
+
): Expression.Any
|
|
837
|
+
<Name extends string, Args extends readonly ExpressionInput[]>(
|
|
838
|
+
name: GenericFunctionNameInput<Name>,
|
|
839
|
+
...args: Args
|
|
840
|
+
): Expression.Any
|
|
841
|
+
}
|
|
842
|
+
|
|
807
843
|
/** Normalized expression tuple for generic string operator inputs. */
|
|
808
844
|
type DialectStringExpressionTuple<
|
|
809
845
|
Values extends readonly ExpressionInput[],
|
|
@@ -1070,6 +1106,9 @@ type JsonPathInput = JsonPath.Path<any> | JsonPath.CanonicalSegment
|
|
|
1070
1106
|
|
|
1071
1107
|
type JsonQueryInput = JsonPath.Path<any> | StringExpressionInput
|
|
1072
1108
|
|
|
1109
|
+
type JsonQueryValue<Query extends JsonQueryInput> =
|
|
1110
|
+
Query extends string ? LiteralStringInput<Query> : Query
|
|
1111
|
+
|
|
1073
1112
|
type JsonPathOutputOf<
|
|
1074
1113
|
Root,
|
|
1075
1114
|
Target extends JsonPathInput,
|
|
@@ -1544,7 +1583,7 @@ const profile: QueryDialectProfile<Dialect, TextDb, NumericDb, BoolDb, Timestamp
|
|
|
1544
1583
|
type: sqliteDatatypes
|
|
1545
1584
|
}
|
|
1546
1585
|
const ValuesInputProto = {
|
|
1547
|
-
pipe(this:
|
|
1586
|
+
pipe(this: Pipeable) {
|
|
1548
1587
|
return pipeArguments(this, arguments)
|
|
1549
1588
|
}
|
|
1550
1589
|
}
|
|
@@ -1555,6 +1594,9 @@ const profile: QueryDialectProfile<Dialect, TextDb, NumericDb, BoolDb, Timestamp
|
|
|
1555
1594
|
if (value === null || value instanceof Date) {
|
|
1556
1595
|
return undefined
|
|
1557
1596
|
}
|
|
1597
|
+
if (typeof value === "number" && !Number.isFinite(value)) {
|
|
1598
|
+
return undefined
|
|
1599
|
+
}
|
|
1558
1600
|
return Schema.Literal(value) as unknown as Schema.Top
|
|
1559
1601
|
}
|
|
1560
1602
|
|
|
@@ -1642,7 +1684,7 @@ const profile: QueryDialectProfile<Dialect, TextDb, NumericDb, BoolDb, Timestamp
|
|
|
1642
1684
|
value: Expression.Any,
|
|
1643
1685
|
target: Expression.Any
|
|
1644
1686
|
): Expression.Any => {
|
|
1645
|
-
const ast = (value as
|
|
1687
|
+
const ast = (value as Expression.Any & { readonly [ExpressionAst.TypeId]: ExpressionAst.Any })[ExpressionAst.TypeId]
|
|
1646
1688
|
if (ast.kind !== "literal") {
|
|
1647
1689
|
return value
|
|
1648
1690
|
}
|
|
@@ -1663,8 +1705,8 @@ const profile: QueryDialectProfile<Dialect, TextDb, NumericDb, BoolDb, Timestamp
|
|
|
1663
1705
|
left: Expression.Any,
|
|
1664
1706
|
right: Expression.Any
|
|
1665
1707
|
): readonly [Expression.Any, Expression.Any] => {
|
|
1666
|
-
const leftAst = (left as
|
|
1667
|
-
const rightAst = (right as
|
|
1708
|
+
const leftAst = (left as Expression.Any & { readonly [ExpressionAst.TypeId]: ExpressionAst.Any })[ExpressionAst.TypeId]
|
|
1709
|
+
const rightAst = (right as Expression.Any & { readonly [ExpressionAst.TypeId]: ExpressionAst.Any })[ExpressionAst.TypeId]
|
|
1668
1710
|
if (leftAst.kind === "literal" && rightAst.kind !== "literal") {
|
|
1669
1711
|
return [retargetLiteralExpression(left, right), right]
|
|
1670
1712
|
}
|
|
@@ -1697,7 +1739,7 @@ const profile: QueryDialectProfile<Dialect, TextDb, NumericDb, BoolDb, Timestamp
|
|
|
1697
1739
|
): readonly Expression.Any[] => {
|
|
1698
1740
|
const flattened: Array<Expression.Any> = []
|
|
1699
1741
|
for (const value of values) {
|
|
1700
|
-
const ast = (value as
|
|
1742
|
+
const ast = (value as Expression.Any & { readonly [ExpressionAst.TypeId]: ExpressionAst.Any })[ExpressionAst.TypeId]
|
|
1701
1743
|
if (ast.kind === kind) {
|
|
1702
1744
|
flattened.push(...ast.values)
|
|
1703
1745
|
} else {
|
|
@@ -1743,7 +1785,33 @@ const profile: QueryDialectProfile<Dialect, TextDb, NumericDb, BoolDb, Timestamp
|
|
|
1743
1785
|
if (operations.every((operation) => typeof operation === "function")) {
|
|
1744
1786
|
return pipeArguments(this, arguments)
|
|
1745
1787
|
}
|
|
1746
|
-
|
|
1788
|
+
const valuesForMixedPipe = (value: unknown): readonly Expression.Any[] => {
|
|
1789
|
+
if (typeof value !== "object" || value === null || !(Expression.TypeId in value)) {
|
|
1790
|
+
return []
|
|
1791
|
+
}
|
|
1792
|
+
const expression = value as Expression.Any & {
|
|
1793
|
+
readonly [ExpressionAst.TypeId]: ExpressionAst.Any
|
|
1794
|
+
}
|
|
1795
|
+
const ast = expression[ExpressionAst.TypeId]
|
|
1796
|
+
if (ast.kind === kind) {
|
|
1797
|
+
return (ast as {
|
|
1798
|
+
readonly values: readonly Expression.Any[]
|
|
1799
|
+
}).values
|
|
1800
|
+
}
|
|
1801
|
+
return [expression]
|
|
1802
|
+
}
|
|
1803
|
+
let current: unknown = this
|
|
1804
|
+
for (const operation of operations) {
|
|
1805
|
+
if (typeof operation === "function") {
|
|
1806
|
+
current = (operation as (value: unknown) => unknown)(current)
|
|
1807
|
+
continue
|
|
1808
|
+
}
|
|
1809
|
+
current = makeVariadicBooleanExpression(
|
|
1810
|
+
kind,
|
|
1811
|
+
[...valuesForMixedPipe(current), toDialectExpression(operation as ExpressionInput)] as const
|
|
1812
|
+
)
|
|
1813
|
+
}
|
|
1814
|
+
return current
|
|
1747
1815
|
}
|
|
1748
1816
|
})
|
|
1749
1817
|
|
|
@@ -1764,9 +1832,6 @@ const profile: QueryDialectProfile<Dialect, TextDb, NumericDb, BoolDb, Timestamp
|
|
|
1764
1832
|
const partitionBy = [...(spec?.partitionBy ?? [])] as unknown as PartitionBy
|
|
1765
1833
|
const orderBy = (spec?.orderBy ?? []).map((term) => {
|
|
1766
1834
|
const direction = term.direction ?? "asc"
|
|
1767
|
-
if (direction !== "asc" && direction !== "desc") {
|
|
1768
|
-
throw new Error("window order direction must be asc or desc")
|
|
1769
|
-
}
|
|
1770
1835
|
return {
|
|
1771
1836
|
value: term.value,
|
|
1772
1837
|
direction
|
|
@@ -1907,7 +1972,8 @@ type BinaryPredicateExpression<
|
|
|
1907
1972
|
>(
|
|
1908
1973
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "eq">
|
|
1909
1974
|
): BinaryPredicateExpression<Left, Right, "eq"> => {
|
|
1910
|
-
const
|
|
1975
|
+
const left = args[0] as Left
|
|
1976
|
+
const right = args[1] as Right
|
|
1911
1977
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "eq")
|
|
1912
1978
|
}
|
|
1913
1979
|
|
|
@@ -1917,7 +1983,8 @@ type BinaryPredicateExpression<
|
|
|
1917
1983
|
>(
|
|
1918
1984
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "neq">
|
|
1919
1985
|
): BinaryPredicateExpression<Left, Right, "neq"> => {
|
|
1920
|
-
const
|
|
1986
|
+
const left = args[0] as Left
|
|
1987
|
+
const right = args[1] as Right
|
|
1921
1988
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "neq")
|
|
1922
1989
|
}
|
|
1923
1990
|
|
|
@@ -1927,7 +1994,8 @@ type BinaryPredicateExpression<
|
|
|
1927
1994
|
>(
|
|
1928
1995
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "lt">
|
|
1929
1996
|
): BinaryPredicateExpression<Left, Right, "lt"> => {
|
|
1930
|
-
const
|
|
1997
|
+
const left = args[0] as Left
|
|
1998
|
+
const right = args[1] as Right
|
|
1931
1999
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "lt")
|
|
1932
2000
|
}
|
|
1933
2001
|
|
|
@@ -1937,7 +2005,8 @@ type BinaryPredicateExpression<
|
|
|
1937
2005
|
>(
|
|
1938
2006
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "lte">
|
|
1939
2007
|
): BinaryPredicateExpression<Left, Right, "lte"> => {
|
|
1940
|
-
const
|
|
2008
|
+
const left = args[0] as Left
|
|
2009
|
+
const right = args[1] as Right
|
|
1941
2010
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "lte")
|
|
1942
2011
|
}
|
|
1943
2012
|
|
|
@@ -1947,7 +2016,8 @@ type BinaryPredicateExpression<
|
|
|
1947
2016
|
>(
|
|
1948
2017
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "gt">
|
|
1949
2018
|
): BinaryPredicateExpression<Left, Right, "gt"> => {
|
|
1950
|
-
const
|
|
2019
|
+
const left = args[0] as Left
|
|
2020
|
+
const right = args[1] as Right
|
|
1951
2021
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "gt")
|
|
1952
2022
|
}
|
|
1953
2023
|
|
|
@@ -1957,7 +2027,8 @@ type BinaryPredicateExpression<
|
|
|
1957
2027
|
>(
|
|
1958
2028
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "gte">
|
|
1959
2029
|
): BinaryPredicateExpression<Left, Right, "gte"> => {
|
|
1960
|
-
const
|
|
2030
|
+
const left = args[0] as Left
|
|
2031
|
+
const right = args[1] as Right
|
|
1961
2032
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "gte")
|
|
1962
2033
|
}
|
|
1963
2034
|
|
|
@@ -1967,7 +2038,8 @@ type BinaryPredicateExpression<
|
|
|
1967
2038
|
>(
|
|
1968
2039
|
...args: TextArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "like">
|
|
1969
2040
|
): BinaryPredicateExpression<Left, Right, "like"> => {
|
|
1970
|
-
const
|
|
2041
|
+
const left = args[0] as Left
|
|
2042
|
+
const right = args[1] as Right
|
|
1971
2043
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "like")
|
|
1972
2044
|
}
|
|
1973
2045
|
|
|
@@ -1977,7 +2049,8 @@ type BinaryPredicateExpression<
|
|
|
1977
2049
|
>(
|
|
1978
2050
|
...args: TextArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "ilike">
|
|
1979
2051
|
): BinaryPredicateExpression<Left, Right, "ilike"> => {
|
|
1980
|
-
const
|
|
2052
|
+
const left = args[0] as Left
|
|
2053
|
+
const right = args[1] as Right
|
|
1981
2054
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "ilike")
|
|
1982
2055
|
}
|
|
1983
2056
|
|
|
@@ -1987,7 +2060,8 @@ type BinaryPredicateExpression<
|
|
|
1987
2060
|
>(
|
|
1988
2061
|
...args: TextArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "regexMatch">
|
|
1989
2062
|
): BinaryPredicateExpression<Left, Right, "regexMatch"> => {
|
|
1990
|
-
const
|
|
2063
|
+
const left = args[0] as Left
|
|
2064
|
+
const right = args[1] as Right
|
|
1991
2065
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "regexMatch")
|
|
1992
2066
|
}
|
|
1993
2067
|
|
|
@@ -1997,7 +2071,8 @@ type BinaryPredicateExpression<
|
|
|
1997
2071
|
>(
|
|
1998
2072
|
...args: TextArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "regexIMatch">
|
|
1999
2073
|
): BinaryPredicateExpression<Left, Right, "regexIMatch"> => {
|
|
2000
|
-
const
|
|
2074
|
+
const left = args[0] as Left
|
|
2075
|
+
const right = args[1] as Right
|
|
2001
2076
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "regexIMatch")
|
|
2002
2077
|
}
|
|
2003
2078
|
|
|
@@ -2007,7 +2082,8 @@ type BinaryPredicateExpression<
|
|
|
2007
2082
|
>(
|
|
2008
2083
|
...args: TextArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "regexNotMatch">
|
|
2009
2084
|
): BinaryPredicateExpression<Left, Right, "regexNotMatch"> => {
|
|
2010
|
-
const
|
|
2085
|
+
const left = args[0] as Left
|
|
2086
|
+
const right = args[1] as Right
|
|
2011
2087
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "regexNotMatch")
|
|
2012
2088
|
}
|
|
2013
2089
|
|
|
@@ -2017,7 +2093,8 @@ type BinaryPredicateExpression<
|
|
|
2017
2093
|
>(
|
|
2018
2094
|
...args: TextArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "regexNotIMatch">
|
|
2019
2095
|
): BinaryPredicateExpression<Left, Right, "regexNotIMatch"> => {
|
|
2020
|
-
const
|
|
2096
|
+
const left = args[0] as Left
|
|
2097
|
+
const right = args[1] as Right
|
|
2021
2098
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "regexNotIMatch")
|
|
2022
2099
|
}
|
|
2023
2100
|
|
|
@@ -2027,7 +2104,8 @@ type BinaryPredicateExpression<
|
|
|
2027
2104
|
>(
|
|
2028
2105
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "isDistinctFrom">
|
|
2029
2106
|
): BinaryPredicateExpression<Left, Right, "isDistinctFrom", "never"> => {
|
|
2030
|
-
const
|
|
2107
|
+
const left = args[0] as Left
|
|
2108
|
+
const right = args[1] as Right
|
|
2031
2109
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "isDistinctFrom", "never")
|
|
2032
2110
|
}
|
|
2033
2111
|
|
|
@@ -2037,7 +2115,8 @@ type BinaryPredicateExpression<
|
|
|
2037
2115
|
>(
|
|
2038
2116
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "isNotDistinctFrom">
|
|
2039
2117
|
): BinaryPredicateExpression<Left, Right, "isNotDistinctFrom", "never"> => {
|
|
2040
|
-
const
|
|
2118
|
+
const left = args[0] as Left
|
|
2119
|
+
const right = args[1] as Right
|
|
2041
2120
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "isNotDistinctFrom", "never")
|
|
2042
2121
|
}
|
|
2043
2122
|
|
|
@@ -2188,62 +2267,62 @@ type BinaryPredicateExpression<
|
|
|
2188
2267
|
})
|
|
2189
2268
|
|
|
2190
2269
|
const range = <Kind extends string, Subtype extends Expression.DbType.Any>(
|
|
2191
|
-
kind: Kind
|
|
2270
|
+
kind: NonEmptyStringInput<Kind>,
|
|
2192
2271
|
subtype: Subtype
|
|
2193
2272
|
): Expression.DbType.Range<Dialect, Subtype, Kind> => ({
|
|
2194
2273
|
dialect: profile.dialect,
|
|
2195
|
-
kind,
|
|
2274
|
+
kind: kind as Kind,
|
|
2196
2275
|
subtype
|
|
2197
2276
|
})
|
|
2198
2277
|
|
|
2199
2278
|
const multirange = <Kind extends string, Subtype extends Expression.DbType.Any>(
|
|
2200
|
-
kind: Kind
|
|
2279
|
+
kind: NonEmptyStringInput<Kind>,
|
|
2201
2280
|
subtype: Subtype
|
|
2202
2281
|
): Expression.DbType.Multirange<Dialect, Subtype, Kind> => ({
|
|
2203
2282
|
dialect: profile.dialect,
|
|
2204
|
-
kind,
|
|
2283
|
+
kind: kind as Kind,
|
|
2205
2284
|
subtype
|
|
2206
2285
|
})
|
|
2207
2286
|
|
|
2208
2287
|
const record = <Kind extends string, Fields extends Record<string, Expression.DbType.Any>>(
|
|
2209
|
-
kind: Kind
|
|
2288
|
+
kind: NonEmptyStringInput<Kind>,
|
|
2210
2289
|
fields: Fields
|
|
2211
2290
|
): Expression.DbType.Composite<Dialect, Fields, Kind> => ({
|
|
2212
2291
|
dialect: profile.dialect,
|
|
2213
|
-
kind,
|
|
2292
|
+
kind: kind as Kind,
|
|
2214
2293
|
fields
|
|
2215
2294
|
})
|
|
2216
2295
|
|
|
2217
2296
|
const domain = <Kind extends string, Base extends Expression.DbType.Any>(
|
|
2218
|
-
kind: Kind
|
|
2297
|
+
kind: NonEmptyStringInput<Kind>,
|
|
2219
2298
|
base: Base
|
|
2220
2299
|
): Expression.DbType.Domain<Dialect, Base, Kind> => ({
|
|
2221
2300
|
dialect: profile.dialect,
|
|
2222
|
-
kind,
|
|
2301
|
+
kind: kind as Kind,
|
|
2223
2302
|
base
|
|
2224
2303
|
})
|
|
2225
2304
|
|
|
2226
2305
|
const enum_ = <Kind extends string>(
|
|
2227
|
-
kind: Kind
|
|
2306
|
+
kind: NonEmptyStringInput<Kind>
|
|
2228
2307
|
): Expression.DbType.Enum<Dialect, Kind> => ({
|
|
2229
2308
|
dialect: profile.dialect,
|
|
2230
|
-
kind,
|
|
2309
|
+
kind: kind as Kind,
|
|
2231
2310
|
variant: "enum"
|
|
2232
2311
|
})
|
|
2233
2312
|
|
|
2234
2313
|
const set = <Kind extends string>(
|
|
2235
|
-
kind: Kind
|
|
2314
|
+
kind: NonEmptyStringInput<Kind>
|
|
2236
2315
|
): Expression.DbType.Set<Dialect, Kind> => ({
|
|
2237
2316
|
dialect: profile.dialect,
|
|
2238
|
-
kind,
|
|
2317
|
+
kind: kind as Kind,
|
|
2239
2318
|
variant: "set"
|
|
2240
2319
|
})
|
|
2241
2320
|
|
|
2242
2321
|
const custom = <Kind extends string>(
|
|
2243
|
-
kind: Kind
|
|
2322
|
+
kind: NonEmptyStringInput<Kind>
|
|
2244
2323
|
): Expression.DbType.Base<Dialect, Kind> => ({
|
|
2245
2324
|
dialect: profile.dialect,
|
|
2246
|
-
kind
|
|
2325
|
+
kind: kind as Kind
|
|
2247
2326
|
})
|
|
2248
2327
|
|
|
2249
2328
|
const driverValueMapping = <Db extends Expression.DbType.Any>(
|
|
@@ -3051,9 +3130,12 @@ type BinaryPredicateExpression<
|
|
|
3051
3130
|
}
|
|
3052
3131
|
)
|
|
3053
3132
|
|
|
3054
|
-
const jsonPathExists = <
|
|
3133
|
+
const jsonPathExists = <
|
|
3134
|
+
Base extends JsonExpressionLike<any>,
|
|
3135
|
+
Query extends JsonQueryInput
|
|
3136
|
+
>(
|
|
3055
3137
|
base: Base,
|
|
3056
|
-
query:
|
|
3138
|
+
query: JsonQueryValue<Query>
|
|
3057
3139
|
) => {
|
|
3058
3140
|
if (isJsonPathValue(query)) {
|
|
3059
3141
|
return buildJsonNodeExpression(
|
|
@@ -3101,9 +3183,12 @@ type BinaryPredicateExpression<
|
|
|
3101
3183
|
}
|
|
3102
3184
|
)
|
|
3103
3185
|
|
|
3104
|
-
const jsonPathMatch = <
|
|
3186
|
+
const jsonPathMatch = <
|
|
3187
|
+
Base extends JsonExpressionLike<any>,
|
|
3188
|
+
Query extends JsonQueryInput
|
|
3189
|
+
>(
|
|
3105
3190
|
base: Base,
|
|
3106
|
-
query:
|
|
3191
|
+
query: JsonQueryValue<Query>
|
|
3107
3192
|
) => {
|
|
3108
3193
|
if (isJsonPathValue(query)) {
|
|
3109
3194
|
return buildJsonNodeExpression(
|
|
@@ -3330,7 +3415,8 @@ type BinaryPredicateExpression<
|
|
|
3330
3415
|
>(
|
|
3331
3416
|
...args: ContainmentArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "contains">
|
|
3332
3417
|
): BinaryPredicateExpression<Left, Right, "contains"> => {
|
|
3333
|
-
const
|
|
3418
|
+
const left = args[0] as Left
|
|
3419
|
+
const right = args[1] as Right
|
|
3334
3420
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "contains")
|
|
3335
3421
|
}
|
|
3336
3422
|
|
|
@@ -3340,7 +3426,8 @@ type BinaryPredicateExpression<
|
|
|
3340
3426
|
>(
|
|
3341
3427
|
...args: ContainmentArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "containedBy">
|
|
3342
3428
|
): BinaryPredicateExpression<Left, Right, "containedBy"> => {
|
|
3343
|
-
const
|
|
3429
|
+
const left = args[0] as Left
|
|
3430
|
+
const right = args[1] as Right
|
|
3344
3431
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "containedBy")
|
|
3345
3432
|
}
|
|
3346
3433
|
|
|
@@ -3350,7 +3437,8 @@ type BinaryPredicateExpression<
|
|
|
3350
3437
|
>(
|
|
3351
3438
|
...args: ContainmentArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "overlaps">
|
|
3352
3439
|
): BinaryPredicateExpression<Left, Right, "overlaps"> => {
|
|
3353
|
-
const
|
|
3440
|
+
const left = args[0] as Left
|
|
3441
|
+
const right = args[1] as Right
|
|
3354
3442
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "overlaps")
|
|
3355
3443
|
}
|
|
3356
3444
|
|
|
@@ -3777,12 +3865,9 @@ type BinaryPredicateExpression<
|
|
|
3777
3865
|
>
|
|
3778
3866
|
}
|
|
3779
3867
|
|
|
3780
|
-
const call =
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
>(
|
|
3784
|
-
name: Name,
|
|
3785
|
-
...args: Args
|
|
3868
|
+
const call: FunctionCallApi = (
|
|
3869
|
+
name: string,
|
|
3870
|
+
...args: readonly ExpressionInput[]
|
|
3786
3871
|
): Expression.Any => {
|
|
3787
3872
|
const expressions = args.map((value) => toDialectExpression(value)) as readonly Expression.Any[]
|
|
3788
3873
|
return makeExpression({
|
|
@@ -4018,9 +4103,6 @@ type BinaryPredicateExpression<
|
|
|
4018
4103
|
ExpressionAst.ExcludedNode<AstOf<Value> extends ExpressionAst.ColumnNode<any, infer ColumnName extends string> ? ColumnName : string>
|
|
4019
4104
|
> => {
|
|
4020
4105
|
const ast = ((value as unknown) as Expression.Any & { readonly [ExpressionAst.TypeId]: ExpressionAst.Any })[ExpressionAst.TypeId]
|
|
4021
|
-
if (ast.kind !== "column") {
|
|
4022
|
-
throw new Error("excluded(...) only accepts bound table columns")
|
|
4023
|
-
}
|
|
4024
4106
|
return makeExpression({
|
|
4025
4107
|
runtime: undefined as Expression.RuntimeOf<Value>,
|
|
4026
4108
|
dbType: value[Expression.TypeId].dbType as Expression.DbTypeOf<Value>,
|
|
@@ -4033,7 +4115,7 @@ type BinaryPredicateExpression<
|
|
|
4033
4115
|
dependencies: {}
|
|
4034
4116
|
}, {
|
|
4035
4117
|
kind: "excluded",
|
|
4036
|
-
columnName: ast.columnName
|
|
4118
|
+
columnName: (ast as ExpressionAst.ColumnNode<any, string>).columnName
|
|
4037
4119
|
}) as unknown as AstBackedExpression<
|
|
4038
4120
|
Expression.RuntimeOf<Value>,
|
|
4039
4121
|
Expression.DbTypeOf<Value>,
|
|
@@ -4066,7 +4148,7 @@ type BinaryPredicateExpression<
|
|
|
4066
4148
|
}
|
|
4067
4149
|
if (value !== null && typeof value === "object" && Expression.TypeId in value) {
|
|
4068
4150
|
const expression = value as unknown as Expression.Any
|
|
4069
|
-
const ast = (expression as
|
|
4151
|
+
const ast = (expression as Expression.Any & { readonly [ExpressionAst.TypeId]: ExpressionAst.Any })[ExpressionAst.TypeId]
|
|
4070
4152
|
if (ast.kind === "literal") {
|
|
4071
4153
|
const normalizedValue = normalizeMutationValue(ast.value)
|
|
4072
4154
|
return makeExpression({
|
|
@@ -4135,8 +4217,8 @@ type BinaryPredicateExpression<
|
|
|
4135
4217
|
: ">="
|
|
4136
4218
|
|
|
4137
4219
|
const targetSourceDetails = (table: MutationTargetLike | SchemaTableLike) => {
|
|
4138
|
-
const sourceName = (table as
|
|
4139
|
-
const sourceBaseName = (table as
|
|
4220
|
+
const sourceName = (table as TableLike)[Table.TypeId].name
|
|
4221
|
+
const sourceBaseName = (table as TableLike)[Table.TypeId].baseName
|
|
4140
4222
|
return {
|
|
4141
4223
|
sourceName,
|
|
4142
4224
|
sourceBaseName
|
|
@@ -4226,12 +4308,7 @@ type BinaryPredicateExpression<
|
|
|
4226
4308
|
|
|
4227
4309
|
const normalizeUnnestColumns = (columns: UnnestColumnsInput): Record<string, readonly Expression.Any[]> =>
|
|
4228
4310
|
Object.fromEntries(
|
|
4229
|
-
Object.entries(columns).map(([key, values]) =>
|
|
4230
|
-
if (!Array.isArray(values)) {
|
|
4231
|
-
throw new Error("unnest(...) expects every value to be an array")
|
|
4232
|
-
}
|
|
4233
|
-
return [key, values.map((value) => toDialectExpression(value))]
|
|
4234
|
-
})
|
|
4311
|
+
Object.entries(columns).map(([key, values]) => [key, values.map((value) => toDialectExpression(value))])
|
|
4235
4312
|
) as Record<string, readonly Expression.Any[]>
|
|
4236
4313
|
|
|
4237
4314
|
const normalizeMutationTargets = (
|
|
@@ -4277,13 +4354,7 @@ type BinaryPredicateExpression<
|
|
|
4277
4354
|
const getMutationColumn = (
|
|
4278
4355
|
columns: Record<string, unknown>,
|
|
4279
4356
|
columnName: string
|
|
4280
|
-
): Expression.Any =>
|
|
4281
|
-
const column = columns[columnName]
|
|
4282
|
-
if (column === undefined || column === null || typeof column !== "object" || !(Expression.TypeId in column)) {
|
|
4283
|
-
throw new Error("effect-qb: unknown mutation column")
|
|
4284
|
-
}
|
|
4285
|
-
return column as Expression.Any
|
|
4286
|
-
}
|
|
4357
|
+
): Expression.Any => columns[columnName] as Expression.Any
|
|
4287
4358
|
|
|
4288
4359
|
const buildMutationAssignments = <Target extends MutationTargetInput, Values>(
|
|
4289
4360
|
target: Target,
|
|
@@ -4299,7 +4370,7 @@ type BinaryPredicateExpression<
|
|
|
4299
4370
|
}
|
|
4300
4371
|
const valueMap = values as Record<string, Record<string, unknown> | undefined>
|
|
4301
4372
|
return targets.flatMap((table) => {
|
|
4302
|
-
const targetName = (table as
|
|
4373
|
+
const targetName = (table as TableLike)[Table.TypeId].name
|
|
4303
4374
|
const scopedValues = valueMap[targetName] ?? {}
|
|
4304
4375
|
const columns = table as unknown as Record<string, Expression.Any>
|
|
4305
4376
|
return Object.entries(scopedValues).map(([columnName, value]) => ({
|
|
@@ -4320,20 +4391,17 @@ type BinaryPredicateExpression<
|
|
|
4320
4391
|
} => {
|
|
4321
4392
|
const firstRow = rows[0]
|
|
4322
4393
|
const firstColumns = Object.keys(firstRow)
|
|
4323
|
-
if (firstColumns.length === 0) {
|
|
4324
|
-
throw new Error("values(...) rows must specify at least one column; use insert(target) for default-only inserts instead")
|
|
4325
|
-
}
|
|
4326
4394
|
const columns = firstColumns as [string, ...string[]]
|
|
4327
|
-
const
|
|
4328
|
-
const rowKeys = Object.keys(row)
|
|
4329
|
-
if (rowKeys.length !== columns.length || columns.some((column) => !(column in row))) {
|
|
4330
|
-
throw new Error("All values(...) rows must project the same columns in the same shape")
|
|
4331
|
-
}
|
|
4395
|
+
const normalizeRow = (row: InsertRowInput<Target>) => {
|
|
4332
4396
|
const assignments = buildMutationAssignments(target, row) as readonly QueryAst.AssignmentClause[]
|
|
4333
4397
|
return {
|
|
4334
4398
|
values: columns.map((columnName) => assignments.find((assignment) => assignment.columnName === columnName)!)
|
|
4335
4399
|
} satisfies QueryAst.InsertValuesRowClause
|
|
4336
|
-
}
|
|
4400
|
+
}
|
|
4401
|
+
const normalizedRows: readonly [QueryAst.InsertValuesRowClause, ...QueryAst.InsertValuesRowClause[]] = [
|
|
4402
|
+
normalizeRow(rows[0]),
|
|
4403
|
+
...rows.slice(1).map(normalizeRow)
|
|
4404
|
+
]
|
|
4337
4405
|
const required = normalizedRows.flatMap((row) =>
|
|
4338
4406
|
row.values.flatMap((entry) => Object.keys(entry.value[Expression.TypeId].dependencies))
|
|
4339
4407
|
)
|
|
@@ -4348,9 +4416,6 @@ type BinaryPredicateExpression<
|
|
|
4348
4416
|
selection: Record<string, Expression.Any>
|
|
4349
4417
|
): readonly [string, ...string[]] => {
|
|
4350
4418
|
const columns = Object.keys(selection)
|
|
4351
|
-
if (columns.length === 0) {
|
|
4352
|
-
throw new Error("insert(...).pipe(from(subquery)) requires at least one projected column")
|
|
4353
|
-
}
|
|
4354
4419
|
return columns as [string, ...string[]]
|
|
4355
4420
|
}
|
|
4356
4421
|
|
|
@@ -4365,27 +4430,11 @@ type BinaryPredicateExpression<
|
|
|
4365
4430
|
}[]
|
|
4366
4431
|
} => {
|
|
4367
4432
|
const entries = Object.entries(values)
|
|
4368
|
-
if (entries.length === 0) {
|
|
4369
|
-
throw new Error("unnest(...) requires at least one column array")
|
|
4370
|
-
}
|
|
4371
4433
|
const columns = entries.map(([columnName]) => columnName) as [string, ...string[]]
|
|
4372
|
-
const normalized = entries.map(([columnName, items]) => {
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
return {
|
|
4377
|
-
columnName,
|
|
4378
|
-
values: items
|
|
4379
|
-
}
|
|
4380
|
-
})
|
|
4381
|
-
const expectedLength = normalized[0]!.values.length
|
|
4382
|
-
if (normalized.some((entry) => entry.values.length !== expectedLength)) {
|
|
4383
|
-
throw new Error("unnest(...) expects every column array to have the same length")
|
|
4384
|
-
}
|
|
4385
|
-
const knownColumns = new Set(Object.keys(target[Table.TypeId].fields))
|
|
4386
|
-
if (columns.some((columnName) => !knownColumns.has(columnName))) {
|
|
4387
|
-
throw new Error("unnest(...) received a column that does not exist on the target table")
|
|
4388
|
-
}
|
|
4434
|
+
const normalized = entries.map(([columnName, items]) => ({
|
|
4435
|
+
columnName,
|
|
4436
|
+
values: items
|
|
4437
|
+
}))
|
|
4389
4438
|
return {
|
|
4390
4439
|
columns,
|
|
4391
4440
|
values: normalized
|
|
@@ -4397,10 +4446,6 @@ type BinaryPredicateExpression<
|
|
|
4397
4446
|
columnsInput: string | readonly string[]
|
|
4398
4447
|
): readonly [string, ...string[]] => {
|
|
4399
4448
|
const columns = normalizeColumnList(columnsInput) as readonly [string, ...string[]]
|
|
4400
|
-
const knownColumns = new Set(Object.keys(target[Table.TypeId].fields))
|
|
4401
|
-
if (columns.some((columnName) => !knownColumns.has(columnName))) {
|
|
4402
|
-
throw new Error("effect-qb: unknown conflict target column")
|
|
4403
|
-
}
|
|
4404
4449
|
return columns
|
|
4405
4450
|
}
|
|
4406
4451
|
|
|
@@ -4415,7 +4460,10 @@ type BinaryPredicateExpression<
|
|
|
4415
4460
|
}
|
|
4416
4461
|
}
|
|
4417
4462
|
if (!Array.isArray(input) && "constraint" in input) {
|
|
4418
|
-
|
|
4463
|
+
return {
|
|
4464
|
+
kind: "constraint",
|
|
4465
|
+
name: input.constraint
|
|
4466
|
+
}
|
|
4419
4467
|
}
|
|
4420
4468
|
const columnTarget = input as {
|
|
4421
4469
|
readonly columns: string | readonly string[]
|
|
@@ -4476,14 +4524,91 @@ type ValidateTargetColumnInput<
|
|
|
4476
4524
|
Columns extends DdlColumnInput
|
|
4477
4525
|
> = ValidateTargetColumns<Target, NormalizeDdlColumns<Columns>> extends never ? never : Columns
|
|
4478
4526
|
|
|
4479
|
-
type
|
|
4480
|
-
readonly
|
|
4527
|
+
type SameColumnSet<
|
|
4528
|
+
Left extends readonly string[],
|
|
4529
|
+
Right extends readonly string[]
|
|
4530
|
+
> = string extends Left[number] | Right[number]
|
|
4531
|
+
? false
|
|
4532
|
+
: Exclude<Left[number], Right[number]> extends never
|
|
4533
|
+
? Exclude<Right[number], Left[number]> extends never
|
|
4534
|
+
? true
|
|
4535
|
+
: false
|
|
4536
|
+
: false
|
|
4537
|
+
|
|
4538
|
+
type ConflictArbitersOf<Target extends MutationTargetLike> =
|
|
4539
|
+
Target[typeof Table.TypeId]["conflictArbiters"][number]
|
|
4540
|
+
|
|
4541
|
+
type MatchingConflictArbiter<
|
|
4542
|
+
Target extends MutationTargetLike,
|
|
4543
|
+
Columns extends readonly string[],
|
|
4544
|
+
AllowPartial extends boolean
|
|
4545
|
+
> = ConflictArbitersOf<Target> extends infer Arbiter extends Table.ConflictArbiter
|
|
4546
|
+
? Arbiter extends Table.ConflictArbiter
|
|
4547
|
+
? SameColumnSet<Arbiter["columns"], Columns> extends true
|
|
4548
|
+
? Arbiter["scope"] extends "unconditional"
|
|
4549
|
+
? true
|
|
4550
|
+
: AllowPartial extends true ? true : never
|
|
4551
|
+
: never
|
|
4552
|
+
: never
|
|
4553
|
+
: never
|
|
4554
|
+
|
|
4555
|
+
type HasInlineConflictArbiter<
|
|
4556
|
+
Target extends MutationTargetLike,
|
|
4557
|
+
Columns extends readonly string[]
|
|
4558
|
+
> = Columns extends readonly [infer Column extends Extract<keyof Target[typeof Table.TypeId]["fields"], string>]
|
|
4559
|
+
? Target[typeof Table.TypeId]["fields"][Column] extends { readonly metadata: { readonly primaryKey: true } | { readonly unique: true } }
|
|
4560
|
+
? true
|
|
4561
|
+
: false
|
|
4562
|
+
: false
|
|
4563
|
+
|
|
4564
|
+
type HasConflictArbiter<
|
|
4565
|
+
Target extends MutationTargetLike,
|
|
4566
|
+
Columns extends readonly string[],
|
|
4567
|
+
AllowPartial extends boolean
|
|
4568
|
+
> = string extends Extract<keyof Target[typeof Table.TypeId]["fields"], string>
|
|
4569
|
+
? true
|
|
4570
|
+
: HasInlineConflictArbiter<Target, Columns> extends true
|
|
4571
|
+
? true
|
|
4572
|
+
: true extends MatchingConflictArbiter<Target, Columns, AllowPartial> ? true : false
|
|
4573
|
+
|
|
4574
|
+
type ConflictTargetArbiterError<
|
|
4575
|
+
Columns,
|
|
4576
|
+
AllowPartial extends boolean
|
|
4577
|
+
> = {
|
|
4578
|
+
readonly __effect_qb_error__: "effect-qb: conflict target columns must match a primary key, unique constraint, or unique index"
|
|
4579
|
+
readonly __effect_qb_conflict_columns__: Columns
|
|
4580
|
+
readonly __effect_qb_partial_target__: AllowPartial
|
|
4581
|
+
readonly __effect_qb_hint__: "Declare the target columns as primaryKey/unique, add a table-level Unique.make(...), or use a simple Pg.Index.uniqueIndex(...)"
|
|
4582
|
+
}
|
|
4583
|
+
|
|
4584
|
+
type ValidateConflictColumnInput<
|
|
4585
|
+
Target extends MutationTargetLike,
|
|
4586
|
+
Columns extends DdlColumnInput,
|
|
4587
|
+
AllowPartial extends boolean
|
|
4588
|
+
> = ValidateTargetColumnInput<Target, Columns> extends never
|
|
4589
|
+
? never
|
|
4590
|
+
: HasConflictArbiter<Target, NormalizeDdlColumns<Columns>, AllowPartial> extends true
|
|
4591
|
+
? Columns
|
|
4592
|
+
: ConflictTargetArbiterError<NormalizeDdlColumns<Columns>, AllowPartial>
|
|
4593
|
+
|
|
4594
|
+
type ConflictColumnPlanConstraint<
|
|
4595
|
+
Target extends MutationTargetLike,
|
|
4596
|
+
Columns extends DdlColumnInput,
|
|
4597
|
+
AllowPartial extends boolean
|
|
4598
|
+
> = ValidateTargetColumnInput<Target, Columns> extends never
|
|
4599
|
+
? never
|
|
4600
|
+
: HasConflictArbiter<Target, NormalizeDdlColumns<Columns>, AllowPartial> extends true
|
|
4601
|
+
? unknown
|
|
4602
|
+
: ConflictTargetArbiterError<NormalizeDdlColumns<Columns>, AllowPartial>
|
|
4603
|
+
|
|
4604
|
+
type CreateIndexOptions<Name extends string = string> = {
|
|
4605
|
+
readonly name?: NonEmptyStringInput<Name>
|
|
4481
4606
|
readonly unique?: boolean
|
|
4482
4607
|
readonly ifNotExists?: boolean
|
|
4483
4608
|
}
|
|
4484
4609
|
|
|
4485
|
-
type DropIndexOptions = {
|
|
4486
|
-
readonly name?:
|
|
4610
|
+
type DropIndexOptions<Name extends string = string> = {
|
|
4611
|
+
readonly name?: NonEmptyStringInput<Name>
|
|
4487
4612
|
readonly ifExists?: boolean
|
|
4488
4613
|
}
|
|
4489
4614
|
|
|
@@ -4582,7 +4707,7 @@ type ValuesRowsDialectInput<
|
|
|
4582
4707
|
BoolDb extends Expression.DbType.Any,
|
|
4583
4708
|
TimestampDb extends Expression.DbType.Any,
|
|
4584
4709
|
NullDb extends Expression.DbType.Any
|
|
4585
|
-
> = Exclude<ValuesRowsDialect<Rows, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect> extends never
|
|
4710
|
+
> = Exclude<ValuesRowsDialect<Rows, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect | "standard"> extends never
|
|
4586
4711
|
? unknown
|
|
4587
4712
|
: {
|
|
4588
4713
|
readonly __effect_qb_error__: "effect-qb: values rows cannot mix dialects"
|
|
@@ -4637,7 +4762,7 @@ type UnnestColumnsDialectInput<
|
|
|
4637
4762
|
BoolDb extends Expression.DbType.Any,
|
|
4638
4763
|
TimestampDb extends Expression.DbType.Any,
|
|
4639
4764
|
NullDb extends Expression.DbType.Any
|
|
4640
|
-
> = Exclude<UnnestColumnsDialect<Columns, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect> extends never
|
|
4765
|
+
> = Exclude<UnnestColumnsDialect<Columns, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect | "standard"> extends never
|
|
4641
4766
|
? unknown
|
|
4642
4767
|
: {
|
|
4643
4768
|
readonly __effect_qb_error__: "effect-qb: unnest columns cannot mix dialects"
|
|
@@ -4972,6 +5097,26 @@ type ConflictTargetInput<
|
|
|
4972
5097
|
readonly constraint?: string
|
|
4973
5098
|
}>)
|
|
4974
5099
|
|
|
5100
|
+
type ConflictConstraintNameConstraint<Target> =
|
|
5101
|
+
Target extends { readonly constraint: infer Constraint extends string }
|
|
5102
|
+
? { readonly constraint: NonEmptyStringInput<Constraint> }
|
|
5103
|
+
: unknown
|
|
5104
|
+
|
|
5105
|
+
type ConflictTargetHasPredicate<Target> =
|
|
5106
|
+
Target extends { readonly where: PredicateInput } ? true : false
|
|
5107
|
+
|
|
5108
|
+
type ConflictTargetPlanConstraint<
|
|
5109
|
+
Target extends MutationTargetLike,
|
|
5110
|
+
ConflictTarget
|
|
5111
|
+
> =
|
|
5112
|
+
ConflictTarget extends { readonly constraint: string }
|
|
5113
|
+
? unknown
|
|
5114
|
+
: ConflictTarget extends { readonly columns: infer Columns extends DdlColumnInput }
|
|
5115
|
+
? ConflictColumnPlanConstraint<Target, Columns, ConflictTargetHasPredicate<ConflictTarget>>
|
|
5116
|
+
: ConflictTarget extends DdlColumnInput
|
|
5117
|
+
? ConflictColumnPlanConstraint<Target, ConflictTarget, false>
|
|
5118
|
+
: unknown
|
|
5119
|
+
|
|
4975
5120
|
type ConflictActionInput<
|
|
4976
5121
|
Target extends MutationTargetLike,
|
|
4977
5122
|
Dialect extends string,
|
|
@@ -5123,7 +5268,7 @@ type MutationOrderLimitSupported<PlanValue extends QueryPlan<any, any, any, any,
|
|
|
5123
5268
|
type MutationTargetTupleDialectConstraint<
|
|
5124
5269
|
Targets extends MutationTargetTuple,
|
|
5125
5270
|
Dialect extends string
|
|
5126
|
-
> = Exclude<TableDialectOf<Targets[number]>, Dialect> extends never ? unknown : never
|
|
5271
|
+
> = Exclude<TableDialectOf<Targets[number]>, Dialect | "standard"> extends never ? unknown : never
|
|
5127
5272
|
|
|
5128
5273
|
type MutationRequiredFromValues<Values extends Record<string, unknown>> = {
|
|
5129
5274
|
[K in keyof Values]: Values[K] extends Expression.Any ? RequiredFromDependencies<DependenciesOf<Values[K]>> : never
|
|
@@ -5177,7 +5322,7 @@ type KnownIncompatibleMutationDialectFromValues<
|
|
|
5177
5322
|
BoolDb extends Expression.DbType.Any,
|
|
5178
5323
|
TimestampDb extends Expression.DbType.Any,
|
|
5179
5324
|
NullDb extends Expression.DbType.Any
|
|
5180
|
-
> = Exclude<KnownMutationDialectFromValues<Values, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect>
|
|
5325
|
+
> = Exclude<KnownMutationDialectFromValues<Values, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect | "standard">
|
|
5181
5326
|
|
|
5182
5327
|
type MutationValuesDialectConstraint<
|
|
5183
5328
|
Values,
|
|
@@ -5229,9 +5374,11 @@ type SourceDialectConstraint<
|
|
|
5229
5374
|
Dialect extends string
|
|
5230
5375
|
> = [SourceDialectOf<CurrentSource>] extends [never]
|
|
5231
5376
|
? unknown
|
|
5232
|
-
:
|
|
5233
|
-
?
|
|
5234
|
-
:
|
|
5377
|
+
: Exclude<SourceDialectOf<CurrentSource>, Dialect | "standard"> extends never
|
|
5378
|
+
? unknown
|
|
5379
|
+
: Dialect extends "standard"
|
|
5380
|
+
? unknown
|
|
5381
|
+
: never
|
|
5235
5382
|
|
|
5236
5383
|
type SourceRequirementConstraint<
|
|
5237
5384
|
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>,
|
|
@@ -5495,7 +5642,7 @@ type AsCurriedResult<
|
|
|
5495
5642
|
function as<
|
|
5496
5643
|
Alias extends string
|
|
5497
5644
|
>(
|
|
5498
|
-
alias: Alias
|
|
5645
|
+
alias: LiteralStringInput<Alias>
|
|
5499
5646
|
): <Value extends AsCurriedInput<Dialect>>(
|
|
5500
5647
|
value: Value
|
|
5501
5648
|
) => AsCurriedResult<Value, Alias, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>
|
|
@@ -5504,7 +5651,7 @@ type AsCurriedResult<
|
|
|
5504
5651
|
Alias extends string
|
|
5505
5652
|
>(
|
|
5506
5653
|
value: Value,
|
|
5507
|
-
alias: Alias
|
|
5654
|
+
alias: LiteralStringInput<Alias>
|
|
5508
5655
|
): ProjectionAliasedExpression<DialectAsExpression<Value, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Alias>
|
|
5509
5656
|
function as<
|
|
5510
5657
|
Rows extends ValuesRowsInput,
|
|
@@ -5515,7 +5662,7 @@ type AsCurriedResult<
|
|
|
5515
5662
|
ValuesOutputShape<Rows, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
5516
5663
|
Dialect
|
|
5517
5664
|
>,
|
|
5518
|
-
alias: Alias
|
|
5665
|
+
alias: LiteralStringInput<Alias>
|
|
5519
5666
|
): ValuesSource<
|
|
5520
5667
|
Rows,
|
|
5521
5668
|
ValuesOutputShape<Rows, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
@@ -5527,11 +5674,11 @@ type AsCurriedResult<
|
|
|
5527
5674
|
Alias extends string
|
|
5528
5675
|
>(
|
|
5529
5676
|
value: DerivedTableCompatiblePlan<PlanValue>,
|
|
5530
|
-
alias: Alias
|
|
5677
|
+
alias: LiteralStringInput<Alias>
|
|
5531
5678
|
): DerivedSource<PlanValue, Alias>
|
|
5532
5679
|
function as(valueOrAlias: unknown, alias?: string): unknown {
|
|
5533
5680
|
if (alias === undefined) {
|
|
5534
|
-
return (value: unknown) => as(value as any, valueOrAlias as
|
|
5681
|
+
return (value: unknown) => as(value as any, valueOrAlias as never)
|
|
5535
5682
|
}
|
|
5536
5683
|
const resolvedAlias = alias
|
|
5537
5684
|
const value = valueOrAlias
|
|
@@ -5571,7 +5718,7 @@ type AsCurriedResult<
|
|
|
5571
5718
|
function with_<
|
|
5572
5719
|
Alias extends string
|
|
5573
5720
|
>(
|
|
5574
|
-
alias: Alias
|
|
5721
|
+
alias: LiteralStringInput<Alias>
|
|
5575
5722
|
): <PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
|
|
5576
5723
|
value: SqliteCteCompatiblePlan<PlanValue>
|
|
5577
5724
|
) => import("../../internal/query.js").CteSource<PlanValue, Alias>
|
|
@@ -5580,11 +5727,11 @@ type AsCurriedResult<
|
|
|
5580
5727
|
Alias extends string
|
|
5581
5728
|
>(
|
|
5582
5729
|
value: SqliteCteCompatiblePlan<PlanValue>,
|
|
5583
|
-
alias: Alias
|
|
5730
|
+
alias: LiteralStringInput<Alias>
|
|
5584
5731
|
): import("../../internal/query.js").CteSource<PlanValue, Alias>
|
|
5585
5732
|
function with_(valueOrAlias: unknown, alias?: string): unknown {
|
|
5586
5733
|
if (alias === undefined) {
|
|
5587
|
-
return (value: unknown) => with_(value as any, valueOrAlias as
|
|
5734
|
+
return (value: unknown) => with_(value as any, valueOrAlias as never)
|
|
5588
5735
|
}
|
|
5589
5736
|
return makeCteSource(
|
|
5590
5737
|
valueOrAlias as CompletePlan<QueryPlan<any, any, any, any, any, any, any, any, any, any>>,
|
|
@@ -5595,7 +5742,7 @@ type AsCurriedResult<
|
|
|
5595
5742
|
function withRecursive_<
|
|
5596
5743
|
Alias extends string
|
|
5597
5744
|
>(
|
|
5598
|
-
alias: Alias
|
|
5745
|
+
alias: LiteralStringInput<Alias>
|
|
5599
5746
|
): <PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
|
|
5600
5747
|
value: SqliteCteCompatiblePlan<PlanValue>
|
|
5601
5748
|
) => import("../../internal/query.js").CteSource<PlanValue, Alias>
|
|
@@ -5604,11 +5751,11 @@ type AsCurriedResult<
|
|
|
5604
5751
|
Alias extends string
|
|
5605
5752
|
>(
|
|
5606
5753
|
value: SqliteCteCompatiblePlan<PlanValue>,
|
|
5607
|
-
alias: Alias
|
|
5754
|
+
alias: LiteralStringInput<Alias>
|
|
5608
5755
|
): import("../../internal/query.js").CteSource<PlanValue, Alias>
|
|
5609
5756
|
function withRecursive_(valueOrAlias: unknown, alias?: string): unknown {
|
|
5610
5757
|
if (alias === undefined) {
|
|
5611
|
-
return (value: unknown) => withRecursive_(value as any, valueOrAlias as
|
|
5758
|
+
return (value: unknown) => withRecursive_(value as any, valueOrAlias as never)
|
|
5612
5759
|
}
|
|
5613
5760
|
return makeCteSource(
|
|
5614
5761
|
valueOrAlias as CompletePlan<QueryPlan<any, any, any, any, any, any, any, any, any, any>>,
|
|
@@ -5620,7 +5767,7 @@ type AsCurriedResult<
|
|
|
5620
5767
|
function lateral<
|
|
5621
5768
|
Alias extends string
|
|
5622
5769
|
>(
|
|
5623
|
-
alias: Alias
|
|
5770
|
+
alias: LiteralStringInput<Alias>
|
|
5624
5771
|
): <PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
|
|
5625
5772
|
value: LateralSourceCompatiblePlan<PlanValue>
|
|
5626
5773
|
) => import("../../internal/query.js").LateralSource<PlanValue, Alias>
|
|
@@ -5629,11 +5776,11 @@ type AsCurriedResult<
|
|
|
5629
5776
|
Alias extends string
|
|
5630
5777
|
>(
|
|
5631
5778
|
value: LateralSourceCompatiblePlan<PlanValue>,
|
|
5632
|
-
alias: Alias
|
|
5779
|
+
alias: LiteralStringInput<Alias>
|
|
5633
5780
|
): import("../../internal/query.js").LateralSource<PlanValue, Alias>
|
|
5634
5781
|
function lateral(valueOrAlias: unknown, alias?: string): unknown {
|
|
5635
5782
|
if (alias === undefined) {
|
|
5636
|
-
return (value: unknown) => lateral(value as any, valueOrAlias as
|
|
5783
|
+
return (value: unknown) => lateral(value as any, valueOrAlias as never)
|
|
5637
5784
|
}
|
|
5638
5785
|
return makeLateralSource(
|
|
5639
5786
|
valueOrAlias as QueryPlan<any, any, any, any, any, any, any, any, any, any>,
|
|
@@ -5660,7 +5807,7 @@ type AsCurriedResult<
|
|
|
5660
5807
|
columns: Columns
|
|
5661
5808
|
& UnnestColumnsShapeInput<Columns>
|
|
5662
5809
|
& UnnestColumnsDialectInput<Columns, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
5663
|
-
alias: Alias
|
|
5810
|
+
alias: LiteralStringInput<Alias>
|
|
5664
5811
|
) => UnnestSource<
|
|
5665
5812
|
UnnestOutputShape<Columns, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
5666
5813
|
Alias,
|
|
@@ -5676,7 +5823,7 @@ type AsCurriedResult<
|
|
|
5676
5823
|
start: Start & NumericExpressionDialectInput<Start, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
5677
5824
|
stop: Stop & NumericExpressionDialectInput<Stop, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
5678
5825
|
step?: Step & (Step extends NumericExpressionInput ? NumericExpressionDialectInput<Step, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb> : unknown),
|
|
5679
|
-
alias?: Alias
|
|
5826
|
+
alias?: LiteralStringInput<Alias>
|
|
5680
5827
|
) => Dialect extends "postgres"
|
|
5681
5828
|
? TableFunctionSource<
|
|
5682
5829
|
GenerateSeriesOutputShape<Start, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
@@ -5723,8 +5870,8 @@ type AsCurriedResult<
|
|
|
5723
5870
|
? SelectSelectionNonEmptyError<Selection>
|
|
5724
5871
|
: unknown
|
|
5725
5872
|
|
|
5726
|
-
export type SelectApi = <Selection extends SelectionShape>(
|
|
5727
|
-
selection: Selection & SelectionRootObjectConstraint<Selection> & SelectionNestedNonEmptyConstraint<Selection> & SelectSelectionNonEmptyConstraint<Selection>
|
|
5873
|
+
export type SelectApi = <const Selection extends SelectionShape>(
|
|
5874
|
+
selection: Selection & SelectionRootObjectConstraint<Selection> & SelectionNestedNonEmptyConstraint<Selection> & SelectSelectionNonEmptyConstraint<Selection> & SelectionProjectionAliasCollisionConstraint<Selection>
|
|
5728
5875
|
) => QueryPlan<
|
|
5729
5876
|
Selection,
|
|
5730
5877
|
ExtractRequired<Selection>,
|
|
@@ -6189,8 +6336,8 @@ type AsCurriedResult<
|
|
|
6189
6336
|
: unknown
|
|
6190
6337
|
|
|
6191
6338
|
type ReturningApi = Dialect extends "postgres" | "sqlite"
|
|
6192
|
-
? <Selection extends SelectionShape>(
|
|
6193
|
-
selection: Selection & SelectionRootObjectConstraint<Selection> & SelectionNestedNonEmptyConstraint<Selection> & ReturningSelectionNonEmptyConstraint<Selection>
|
|
6339
|
+
? <const Selection extends SelectionShape>(
|
|
6340
|
+
selection: Selection & SelectionRootObjectConstraint<Selection> & SelectionNestedNonEmptyConstraint<Selection> & ReturningSelectionNonEmptyConstraint<Selection> & SelectionProjectionAliasCollisionConstraint<Selection>
|
|
6194
6341
|
) =>
|
|
6195
6342
|
<PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
|
|
6196
6343
|
plan: PlanValue & RequireMutationStatement<PlanValue>
|
|
@@ -6259,13 +6406,13 @@ type AsCurriedResult<
|
|
|
6259
6406
|
const Columns extends DdlColumnInput,
|
|
6260
6407
|
UpdateValues extends MutationInputOf<Table.UpdateOf<Target>> | undefined = MutationInputOf<Table.UpdateOf<Target>> | undefined,
|
|
6261
6408
|
Options extends ConflictActionInput<Target, Dialect, UpdateValues> = ConflictActionInput<Target, Dialect, UpdateValues>,
|
|
6262
|
-
ConflictTarget extends ConflictTargetInput<Target, Dialect, Columns> = ConflictTargetInput<Target, Dialect, Columns>
|
|
6409
|
+
const ConflictTarget extends ConflictTargetInput<Target, Dialect, Columns> = ConflictTargetInput<Target, Dialect, Columns>
|
|
6263
6410
|
>(
|
|
6264
|
-
target: ConflictTarget
|
|
6411
|
+
target: ConflictTarget & ConflictConstraintNameConstraint<ConflictTarget>,
|
|
6265
6412
|
options?: Options & ConflictActionUpdateNonEmptyConstraint<Options>
|
|
6266
|
-
|
|
6413
|
+
) =>
|
|
6267
6414
|
<PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
|
|
6268
|
-
plan: PlanValue & RequireInsertStatement<PlanValue>
|
|
6415
|
+
plan: PlanValue & RequireInsertStatement<PlanValue> & ConflictTargetPlanConstraint<MutationTargetOfPlan<PlanValue>, ConflictTarget>
|
|
6269
6416
|
) => QueryPlan<
|
|
6270
6417
|
SelectionOfPlan<PlanValue>,
|
|
6271
6418
|
Exclude<RequiredOfPlan<PlanValue> | ConflictRequired<UpdateValues, Options, ConflictTarget>, AvailableNames<AvailableOfPlan<PlanValue>>>,
|
|
@@ -6329,7 +6476,7 @@ type AsCurriedResult<
|
|
|
6329
6476
|
>(
|
|
6330
6477
|
target: Target,
|
|
6331
6478
|
values: Values & MutationValuesDialectConstraint<Values, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
6332
|
-
conflictColumns:
|
|
6479
|
+
conflictColumns: ValidateConflictColumnInput<Target, Columns, false>,
|
|
6333
6480
|
updateValues?: UpdateValues & UpdateValuesNonEmptyConstraint<Exclude<UpdateValues, undefined>> & MutationValuesDialectConstraint<Exclude<UpdateValues, undefined>, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>
|
|
6334
6481
|
) => QueryPlan<
|
|
6335
6482
|
{},
|
|
@@ -6637,7 +6784,7 @@ type AsCurriedResult<
|
|
|
6637
6784
|
"rollback"
|
|
6638
6785
|
>
|
|
6639
6786
|
|
|
6640
|
-
type SavepointApi = <Name extends string>(name: Name) => QueryPlan<
|
|
6787
|
+
type SavepointApi = <Name extends string>(name: NonEmptyStringInput<Name>) => QueryPlan<
|
|
6641
6788
|
{},
|
|
6642
6789
|
never,
|
|
6643
6790
|
{},
|
|
@@ -6650,7 +6797,7 @@ type AsCurriedResult<
|
|
|
6650
6797
|
"savepoint"
|
|
6651
6798
|
>
|
|
6652
6799
|
|
|
6653
|
-
type RollbackToApi = <Name extends string>(name: Name) => QueryPlan<
|
|
6800
|
+
type RollbackToApi = <Name extends string>(name: NonEmptyStringInput<Name>) => QueryPlan<
|
|
6654
6801
|
{},
|
|
6655
6802
|
never,
|
|
6656
6803
|
{},
|
|
@@ -6663,7 +6810,7 @@ type AsCurriedResult<
|
|
|
6663
6810
|
"rollbackTo"
|
|
6664
6811
|
>
|
|
6665
6812
|
|
|
6666
|
-
type ReleaseSavepointApi = <Name extends string>(name: Name) => QueryPlan<
|
|
6813
|
+
type ReleaseSavepointApi = <Name extends string>(name: NonEmptyStringInput<Name>) => QueryPlan<
|
|
6667
6814
|
{},
|
|
6668
6815
|
never,
|
|
6669
6816
|
{},
|
|
@@ -6708,10 +6855,10 @@ type AsCurriedResult<
|
|
|
6708
6855
|
"dropTable"
|
|
6709
6856
|
>
|
|
6710
6857
|
|
|
6711
|
-
type CreateIndexApi = <Target extends SchemaTableLike, const Columns extends DdlColumnInput>(
|
|
6858
|
+
type CreateIndexApi = <Target extends SchemaTableLike, const Columns extends DdlColumnInput, Name extends string = string>(
|
|
6712
6859
|
target: Target,
|
|
6713
6860
|
columns: Columns & ValidateDdlColumnInput<Target, Columns>,
|
|
6714
|
-
options?: CreateIndexOptions
|
|
6861
|
+
options?: CreateIndexOptions<Name>
|
|
6715
6862
|
) => QueryPlan<
|
|
6716
6863
|
{},
|
|
6717
6864
|
never,
|
|
@@ -6725,10 +6872,10 @@ type AsCurriedResult<
|
|
|
6725
6872
|
"createIndex"
|
|
6726
6873
|
>
|
|
6727
6874
|
|
|
6728
|
-
type DropIndexApi = <Target extends SchemaTableLike, const Columns extends DdlColumnInput>(
|
|
6875
|
+
type DropIndexApi = <Target extends SchemaTableLike, const Columns extends DdlColumnInput, Name extends string = string>(
|
|
6729
6876
|
target: Target,
|
|
6730
6877
|
columns: Columns & ValidateDdlColumnInput<Target, Columns>,
|
|
6731
|
-
options?: DropIndexOptions
|
|
6878
|
+
options?: DropIndexOptions<Name>
|
|
6732
6879
|
) => QueryPlan<
|
|
6733
6880
|
{},
|
|
6734
6881
|
never,
|