effect-qb 4.0.0-beta.66 → 4.0.0-beta.92
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 +9373 -0
- package/dist/mysql.js +3917 -2572
- package/dist/postgres/metadata.js +2491 -1373
- package/dist/postgres.js +5450 -5155
- package/dist/sqlite.js +6891 -5528
- package/dist/standard.js +9327 -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 +6975 -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/executor.ts +7 -7
- package/src/mysql/internal/dialect.ts +9 -4
- package/src/mysql/internal/dsl.ts +309 -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/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 +303 -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/executor.ts +7 -7
- package/src/sqlite/internal/dialect.ts +9 -4
- package/src/sqlite/internal/dsl.ts +298 -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
|
}
|
|
@@ -1642,7 +1681,7 @@ const profile: QueryDialectProfile<Dialect, TextDb, NumericDb, BoolDb, Timestamp
|
|
|
1642
1681
|
value: Expression.Any,
|
|
1643
1682
|
target: Expression.Any
|
|
1644
1683
|
): Expression.Any => {
|
|
1645
|
-
const ast = (value as
|
|
1684
|
+
const ast = (value as Expression.Any & { readonly [ExpressionAst.TypeId]: ExpressionAst.Any })[ExpressionAst.TypeId]
|
|
1646
1685
|
if (ast.kind !== "literal") {
|
|
1647
1686
|
return value
|
|
1648
1687
|
}
|
|
@@ -1663,8 +1702,8 @@ const profile: QueryDialectProfile<Dialect, TextDb, NumericDb, BoolDb, Timestamp
|
|
|
1663
1702
|
left: Expression.Any,
|
|
1664
1703
|
right: Expression.Any
|
|
1665
1704
|
): readonly [Expression.Any, Expression.Any] => {
|
|
1666
|
-
const leftAst = (left as
|
|
1667
|
-
const rightAst = (right as
|
|
1705
|
+
const leftAst = (left as Expression.Any & { readonly [ExpressionAst.TypeId]: ExpressionAst.Any })[ExpressionAst.TypeId]
|
|
1706
|
+
const rightAst = (right as Expression.Any & { readonly [ExpressionAst.TypeId]: ExpressionAst.Any })[ExpressionAst.TypeId]
|
|
1668
1707
|
if (leftAst.kind === "literal" && rightAst.kind !== "literal") {
|
|
1669
1708
|
return [retargetLiteralExpression(left, right), right]
|
|
1670
1709
|
}
|
|
@@ -1697,7 +1736,7 @@ const profile: QueryDialectProfile<Dialect, TextDb, NumericDb, BoolDb, Timestamp
|
|
|
1697
1736
|
): readonly Expression.Any[] => {
|
|
1698
1737
|
const flattened: Array<Expression.Any> = []
|
|
1699
1738
|
for (const value of values) {
|
|
1700
|
-
const ast = (value as
|
|
1739
|
+
const ast = (value as Expression.Any & { readonly [ExpressionAst.TypeId]: ExpressionAst.Any })[ExpressionAst.TypeId]
|
|
1701
1740
|
if (ast.kind === kind) {
|
|
1702
1741
|
flattened.push(...ast.values)
|
|
1703
1742
|
} else {
|
|
@@ -1743,7 +1782,33 @@ const profile: QueryDialectProfile<Dialect, TextDb, NumericDb, BoolDb, Timestamp
|
|
|
1743
1782
|
if (operations.every((operation) => typeof operation === "function")) {
|
|
1744
1783
|
return pipeArguments(this, arguments)
|
|
1745
1784
|
}
|
|
1746
|
-
|
|
1785
|
+
const valuesForMixedPipe = (value: unknown): readonly Expression.Any[] => {
|
|
1786
|
+
if (typeof value !== "object" || value === null || !(Expression.TypeId in value)) {
|
|
1787
|
+
return []
|
|
1788
|
+
}
|
|
1789
|
+
const expression = value as Expression.Any & {
|
|
1790
|
+
readonly [ExpressionAst.TypeId]: ExpressionAst.Any
|
|
1791
|
+
}
|
|
1792
|
+
const ast = expression[ExpressionAst.TypeId]
|
|
1793
|
+
if (ast.kind === kind) {
|
|
1794
|
+
return (ast as {
|
|
1795
|
+
readonly values: readonly Expression.Any[]
|
|
1796
|
+
}).values
|
|
1797
|
+
}
|
|
1798
|
+
return [expression]
|
|
1799
|
+
}
|
|
1800
|
+
let current: unknown = this
|
|
1801
|
+
for (const operation of operations) {
|
|
1802
|
+
if (typeof operation === "function") {
|
|
1803
|
+
current = (operation as (value: unknown) => unknown)(current)
|
|
1804
|
+
continue
|
|
1805
|
+
}
|
|
1806
|
+
current = makeVariadicBooleanExpression(
|
|
1807
|
+
kind,
|
|
1808
|
+
[...valuesForMixedPipe(current), toDialectExpression(operation as ExpressionInput)] as const
|
|
1809
|
+
)
|
|
1810
|
+
}
|
|
1811
|
+
return current
|
|
1747
1812
|
}
|
|
1748
1813
|
})
|
|
1749
1814
|
|
|
@@ -1764,9 +1829,6 @@ const profile: QueryDialectProfile<Dialect, TextDb, NumericDb, BoolDb, Timestamp
|
|
|
1764
1829
|
const partitionBy = [...(spec?.partitionBy ?? [])] as unknown as PartitionBy
|
|
1765
1830
|
const orderBy = (spec?.orderBy ?? []).map((term) => {
|
|
1766
1831
|
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
1832
|
return {
|
|
1771
1833
|
value: term.value,
|
|
1772
1834
|
direction
|
|
@@ -1907,7 +1969,8 @@ type BinaryPredicateExpression<
|
|
|
1907
1969
|
>(
|
|
1908
1970
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "eq">
|
|
1909
1971
|
): BinaryPredicateExpression<Left, Right, "eq"> => {
|
|
1910
|
-
const
|
|
1972
|
+
const left = args[0] as Left
|
|
1973
|
+
const right = args[1] as Right
|
|
1911
1974
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "eq")
|
|
1912
1975
|
}
|
|
1913
1976
|
|
|
@@ -1917,7 +1980,8 @@ type BinaryPredicateExpression<
|
|
|
1917
1980
|
>(
|
|
1918
1981
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "neq">
|
|
1919
1982
|
): BinaryPredicateExpression<Left, Right, "neq"> => {
|
|
1920
|
-
const
|
|
1983
|
+
const left = args[0] as Left
|
|
1984
|
+
const right = args[1] as Right
|
|
1921
1985
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "neq")
|
|
1922
1986
|
}
|
|
1923
1987
|
|
|
@@ -1927,7 +1991,8 @@ type BinaryPredicateExpression<
|
|
|
1927
1991
|
>(
|
|
1928
1992
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "lt">
|
|
1929
1993
|
): BinaryPredicateExpression<Left, Right, "lt"> => {
|
|
1930
|
-
const
|
|
1994
|
+
const left = args[0] as Left
|
|
1995
|
+
const right = args[1] as Right
|
|
1931
1996
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "lt")
|
|
1932
1997
|
}
|
|
1933
1998
|
|
|
@@ -1937,7 +2002,8 @@ type BinaryPredicateExpression<
|
|
|
1937
2002
|
>(
|
|
1938
2003
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "lte">
|
|
1939
2004
|
): BinaryPredicateExpression<Left, Right, "lte"> => {
|
|
1940
|
-
const
|
|
2005
|
+
const left = args[0] as Left
|
|
2006
|
+
const right = args[1] as Right
|
|
1941
2007
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "lte")
|
|
1942
2008
|
}
|
|
1943
2009
|
|
|
@@ -1947,7 +2013,8 @@ type BinaryPredicateExpression<
|
|
|
1947
2013
|
>(
|
|
1948
2014
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "gt">
|
|
1949
2015
|
): BinaryPredicateExpression<Left, Right, "gt"> => {
|
|
1950
|
-
const
|
|
2016
|
+
const left = args[0] as Left
|
|
2017
|
+
const right = args[1] as Right
|
|
1951
2018
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "gt")
|
|
1952
2019
|
}
|
|
1953
2020
|
|
|
@@ -1957,7 +2024,8 @@ type BinaryPredicateExpression<
|
|
|
1957
2024
|
>(
|
|
1958
2025
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "gte">
|
|
1959
2026
|
): BinaryPredicateExpression<Left, Right, "gte"> => {
|
|
1960
|
-
const
|
|
2027
|
+
const left = args[0] as Left
|
|
2028
|
+
const right = args[1] as Right
|
|
1961
2029
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "gte")
|
|
1962
2030
|
}
|
|
1963
2031
|
|
|
@@ -1967,7 +2035,8 @@ type BinaryPredicateExpression<
|
|
|
1967
2035
|
>(
|
|
1968
2036
|
...args: TextArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "like">
|
|
1969
2037
|
): BinaryPredicateExpression<Left, Right, "like"> => {
|
|
1970
|
-
const
|
|
2038
|
+
const left = args[0] as Left
|
|
2039
|
+
const right = args[1] as Right
|
|
1971
2040
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "like")
|
|
1972
2041
|
}
|
|
1973
2042
|
|
|
@@ -1977,7 +2046,8 @@ type BinaryPredicateExpression<
|
|
|
1977
2046
|
>(
|
|
1978
2047
|
...args: TextArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "ilike">
|
|
1979
2048
|
): BinaryPredicateExpression<Left, Right, "ilike"> => {
|
|
1980
|
-
const
|
|
2049
|
+
const left = args[0] as Left
|
|
2050
|
+
const right = args[1] as Right
|
|
1981
2051
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "ilike")
|
|
1982
2052
|
}
|
|
1983
2053
|
|
|
@@ -1987,7 +2057,8 @@ type BinaryPredicateExpression<
|
|
|
1987
2057
|
>(
|
|
1988
2058
|
...args: TextArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "regexMatch">
|
|
1989
2059
|
): BinaryPredicateExpression<Left, Right, "regexMatch"> => {
|
|
1990
|
-
const
|
|
2060
|
+
const left = args[0] as Left
|
|
2061
|
+
const right = args[1] as Right
|
|
1991
2062
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "regexMatch")
|
|
1992
2063
|
}
|
|
1993
2064
|
|
|
@@ -1997,7 +2068,8 @@ type BinaryPredicateExpression<
|
|
|
1997
2068
|
>(
|
|
1998
2069
|
...args: TextArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "regexIMatch">
|
|
1999
2070
|
): BinaryPredicateExpression<Left, Right, "regexIMatch"> => {
|
|
2000
|
-
const
|
|
2071
|
+
const left = args[0] as Left
|
|
2072
|
+
const right = args[1] as Right
|
|
2001
2073
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "regexIMatch")
|
|
2002
2074
|
}
|
|
2003
2075
|
|
|
@@ -2007,7 +2079,8 @@ type BinaryPredicateExpression<
|
|
|
2007
2079
|
>(
|
|
2008
2080
|
...args: TextArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "regexNotMatch">
|
|
2009
2081
|
): BinaryPredicateExpression<Left, Right, "regexNotMatch"> => {
|
|
2010
|
-
const
|
|
2082
|
+
const left = args[0] as Left
|
|
2083
|
+
const right = args[1] as Right
|
|
2011
2084
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "regexNotMatch")
|
|
2012
2085
|
}
|
|
2013
2086
|
|
|
@@ -2017,7 +2090,8 @@ type BinaryPredicateExpression<
|
|
|
2017
2090
|
>(
|
|
2018
2091
|
...args: TextArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "regexNotIMatch">
|
|
2019
2092
|
): BinaryPredicateExpression<Left, Right, "regexNotIMatch"> => {
|
|
2020
|
-
const
|
|
2093
|
+
const left = args[0] as Left
|
|
2094
|
+
const right = args[1] as Right
|
|
2021
2095
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "regexNotIMatch")
|
|
2022
2096
|
}
|
|
2023
2097
|
|
|
@@ -2027,7 +2101,8 @@ type BinaryPredicateExpression<
|
|
|
2027
2101
|
>(
|
|
2028
2102
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "isDistinctFrom">
|
|
2029
2103
|
): BinaryPredicateExpression<Left, Right, "isDistinctFrom", "never"> => {
|
|
2030
|
-
const
|
|
2104
|
+
const left = args[0] as Left
|
|
2105
|
+
const right = args[1] as Right
|
|
2031
2106
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "isDistinctFrom", "never")
|
|
2032
2107
|
}
|
|
2033
2108
|
|
|
@@ -2037,7 +2112,8 @@ type BinaryPredicateExpression<
|
|
|
2037
2112
|
>(
|
|
2038
2113
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "isNotDistinctFrom">
|
|
2039
2114
|
): BinaryPredicateExpression<Left, Right, "isNotDistinctFrom", "never"> => {
|
|
2040
|
-
const
|
|
2115
|
+
const left = args[0] as Left
|
|
2116
|
+
const right = args[1] as Right
|
|
2041
2117
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "isNotDistinctFrom", "never")
|
|
2042
2118
|
}
|
|
2043
2119
|
|
|
@@ -2188,62 +2264,62 @@ type BinaryPredicateExpression<
|
|
|
2188
2264
|
})
|
|
2189
2265
|
|
|
2190
2266
|
const range = <Kind extends string, Subtype extends Expression.DbType.Any>(
|
|
2191
|
-
kind: Kind
|
|
2267
|
+
kind: NonEmptyStringInput<Kind>,
|
|
2192
2268
|
subtype: Subtype
|
|
2193
2269
|
): Expression.DbType.Range<Dialect, Subtype, Kind> => ({
|
|
2194
2270
|
dialect: profile.dialect,
|
|
2195
|
-
kind,
|
|
2271
|
+
kind: kind as Kind,
|
|
2196
2272
|
subtype
|
|
2197
2273
|
})
|
|
2198
2274
|
|
|
2199
2275
|
const multirange = <Kind extends string, Subtype extends Expression.DbType.Any>(
|
|
2200
|
-
kind: Kind
|
|
2276
|
+
kind: NonEmptyStringInput<Kind>,
|
|
2201
2277
|
subtype: Subtype
|
|
2202
2278
|
): Expression.DbType.Multirange<Dialect, Subtype, Kind> => ({
|
|
2203
2279
|
dialect: profile.dialect,
|
|
2204
|
-
kind,
|
|
2280
|
+
kind: kind as Kind,
|
|
2205
2281
|
subtype
|
|
2206
2282
|
})
|
|
2207
2283
|
|
|
2208
2284
|
const record = <Kind extends string, Fields extends Record<string, Expression.DbType.Any>>(
|
|
2209
|
-
kind: Kind
|
|
2285
|
+
kind: NonEmptyStringInput<Kind>,
|
|
2210
2286
|
fields: Fields
|
|
2211
2287
|
): Expression.DbType.Composite<Dialect, Fields, Kind> => ({
|
|
2212
2288
|
dialect: profile.dialect,
|
|
2213
|
-
kind,
|
|
2289
|
+
kind: kind as Kind,
|
|
2214
2290
|
fields
|
|
2215
2291
|
})
|
|
2216
2292
|
|
|
2217
2293
|
const domain = <Kind extends string, Base extends Expression.DbType.Any>(
|
|
2218
|
-
kind: Kind
|
|
2294
|
+
kind: NonEmptyStringInput<Kind>,
|
|
2219
2295
|
base: Base
|
|
2220
2296
|
): Expression.DbType.Domain<Dialect, Base, Kind> => ({
|
|
2221
2297
|
dialect: profile.dialect,
|
|
2222
|
-
kind,
|
|
2298
|
+
kind: kind as Kind,
|
|
2223
2299
|
base
|
|
2224
2300
|
})
|
|
2225
2301
|
|
|
2226
2302
|
const enum_ = <Kind extends string>(
|
|
2227
|
-
kind: Kind
|
|
2303
|
+
kind: NonEmptyStringInput<Kind>
|
|
2228
2304
|
): Expression.DbType.Enum<Dialect, Kind> => ({
|
|
2229
2305
|
dialect: profile.dialect,
|
|
2230
|
-
kind,
|
|
2306
|
+
kind: kind as Kind,
|
|
2231
2307
|
variant: "enum"
|
|
2232
2308
|
})
|
|
2233
2309
|
|
|
2234
2310
|
const set = <Kind extends string>(
|
|
2235
|
-
kind: Kind
|
|
2311
|
+
kind: NonEmptyStringInput<Kind>
|
|
2236
2312
|
): Expression.DbType.Set<Dialect, Kind> => ({
|
|
2237
2313
|
dialect: profile.dialect,
|
|
2238
|
-
kind,
|
|
2314
|
+
kind: kind as Kind,
|
|
2239
2315
|
variant: "set"
|
|
2240
2316
|
})
|
|
2241
2317
|
|
|
2242
2318
|
const custom = <Kind extends string>(
|
|
2243
|
-
kind: Kind
|
|
2319
|
+
kind: NonEmptyStringInput<Kind>
|
|
2244
2320
|
): Expression.DbType.Base<Dialect, Kind> => ({
|
|
2245
2321
|
dialect: profile.dialect,
|
|
2246
|
-
kind
|
|
2322
|
+
kind: kind as Kind
|
|
2247
2323
|
})
|
|
2248
2324
|
|
|
2249
2325
|
const driverValueMapping = <Db extends Expression.DbType.Any>(
|
|
@@ -3051,9 +3127,12 @@ type BinaryPredicateExpression<
|
|
|
3051
3127
|
}
|
|
3052
3128
|
)
|
|
3053
3129
|
|
|
3054
|
-
const jsonPathExists = <
|
|
3130
|
+
const jsonPathExists = <
|
|
3131
|
+
Base extends JsonExpressionLike<any>,
|
|
3132
|
+
Query extends JsonQueryInput
|
|
3133
|
+
>(
|
|
3055
3134
|
base: Base,
|
|
3056
|
-
query:
|
|
3135
|
+
query: JsonQueryValue<Query>
|
|
3057
3136
|
) => {
|
|
3058
3137
|
if (isJsonPathValue(query)) {
|
|
3059
3138
|
return buildJsonNodeExpression(
|
|
@@ -3101,9 +3180,12 @@ type BinaryPredicateExpression<
|
|
|
3101
3180
|
}
|
|
3102
3181
|
)
|
|
3103
3182
|
|
|
3104
|
-
const jsonPathMatch = <
|
|
3183
|
+
const jsonPathMatch = <
|
|
3184
|
+
Base extends JsonExpressionLike<any>,
|
|
3185
|
+
Query extends JsonQueryInput
|
|
3186
|
+
>(
|
|
3105
3187
|
base: Base,
|
|
3106
|
-
query:
|
|
3188
|
+
query: JsonQueryValue<Query>
|
|
3107
3189
|
) => {
|
|
3108
3190
|
if (isJsonPathValue(query)) {
|
|
3109
3191
|
return buildJsonNodeExpression(
|
|
@@ -3330,7 +3412,8 @@ type BinaryPredicateExpression<
|
|
|
3330
3412
|
>(
|
|
3331
3413
|
...args: ContainmentArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "contains">
|
|
3332
3414
|
): BinaryPredicateExpression<Left, Right, "contains"> => {
|
|
3333
|
-
const
|
|
3415
|
+
const left = args[0] as Left
|
|
3416
|
+
const right = args[1] as Right
|
|
3334
3417
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "contains")
|
|
3335
3418
|
}
|
|
3336
3419
|
|
|
@@ -3340,7 +3423,8 @@ type BinaryPredicateExpression<
|
|
|
3340
3423
|
>(
|
|
3341
3424
|
...args: ContainmentArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "containedBy">
|
|
3342
3425
|
): BinaryPredicateExpression<Left, Right, "containedBy"> => {
|
|
3343
|
-
const
|
|
3426
|
+
const left = args[0] as Left
|
|
3427
|
+
const right = args[1] as Right
|
|
3344
3428
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "containedBy")
|
|
3345
3429
|
}
|
|
3346
3430
|
|
|
@@ -3350,7 +3434,8 @@ type BinaryPredicateExpression<
|
|
|
3350
3434
|
>(
|
|
3351
3435
|
...args: ContainmentArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "overlaps">
|
|
3352
3436
|
): BinaryPredicateExpression<Left, Right, "overlaps"> => {
|
|
3353
|
-
const
|
|
3437
|
+
const left = args[0] as Left
|
|
3438
|
+
const right = args[1] as Right
|
|
3354
3439
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "overlaps")
|
|
3355
3440
|
}
|
|
3356
3441
|
|
|
@@ -3777,12 +3862,9 @@ type BinaryPredicateExpression<
|
|
|
3777
3862
|
>
|
|
3778
3863
|
}
|
|
3779
3864
|
|
|
3780
|
-
const call =
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
>(
|
|
3784
|
-
name: Name,
|
|
3785
|
-
...args: Args
|
|
3865
|
+
const call: FunctionCallApi = (
|
|
3866
|
+
name: string,
|
|
3867
|
+
...args: readonly ExpressionInput[]
|
|
3786
3868
|
): Expression.Any => {
|
|
3787
3869
|
const expressions = args.map((value) => toDialectExpression(value)) as readonly Expression.Any[]
|
|
3788
3870
|
return makeExpression({
|
|
@@ -4018,9 +4100,6 @@ type BinaryPredicateExpression<
|
|
|
4018
4100
|
ExpressionAst.ExcludedNode<AstOf<Value> extends ExpressionAst.ColumnNode<any, infer ColumnName extends string> ? ColumnName : string>
|
|
4019
4101
|
> => {
|
|
4020
4102
|
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
4103
|
return makeExpression({
|
|
4025
4104
|
runtime: undefined as Expression.RuntimeOf<Value>,
|
|
4026
4105
|
dbType: value[Expression.TypeId].dbType as Expression.DbTypeOf<Value>,
|
|
@@ -4033,7 +4112,7 @@ type BinaryPredicateExpression<
|
|
|
4033
4112
|
dependencies: {}
|
|
4034
4113
|
}, {
|
|
4035
4114
|
kind: "excluded",
|
|
4036
|
-
columnName: ast.columnName
|
|
4115
|
+
columnName: (ast as ExpressionAst.ColumnNode<any, string>).columnName
|
|
4037
4116
|
}) as unknown as AstBackedExpression<
|
|
4038
4117
|
Expression.RuntimeOf<Value>,
|
|
4039
4118
|
Expression.DbTypeOf<Value>,
|
|
@@ -4066,7 +4145,7 @@ type BinaryPredicateExpression<
|
|
|
4066
4145
|
}
|
|
4067
4146
|
if (value !== null && typeof value === "object" && Expression.TypeId in value) {
|
|
4068
4147
|
const expression = value as unknown as Expression.Any
|
|
4069
|
-
const ast = (expression as
|
|
4148
|
+
const ast = (expression as Expression.Any & { readonly [ExpressionAst.TypeId]: ExpressionAst.Any })[ExpressionAst.TypeId]
|
|
4070
4149
|
if (ast.kind === "literal") {
|
|
4071
4150
|
const normalizedValue = normalizeMutationValue(ast.value)
|
|
4072
4151
|
return makeExpression({
|
|
@@ -4135,8 +4214,8 @@ type BinaryPredicateExpression<
|
|
|
4135
4214
|
: ">="
|
|
4136
4215
|
|
|
4137
4216
|
const targetSourceDetails = (table: MutationTargetLike | SchemaTableLike) => {
|
|
4138
|
-
const sourceName = (table as
|
|
4139
|
-
const sourceBaseName = (table as
|
|
4217
|
+
const sourceName = (table as TableLike)[Table.TypeId].name
|
|
4218
|
+
const sourceBaseName = (table as TableLike)[Table.TypeId].baseName
|
|
4140
4219
|
return {
|
|
4141
4220
|
sourceName,
|
|
4142
4221
|
sourceBaseName
|
|
@@ -4226,12 +4305,7 @@ type BinaryPredicateExpression<
|
|
|
4226
4305
|
|
|
4227
4306
|
const normalizeUnnestColumns = (columns: UnnestColumnsInput): Record<string, readonly Expression.Any[]> =>
|
|
4228
4307
|
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
|
-
})
|
|
4308
|
+
Object.entries(columns).map(([key, values]) => [key, values.map((value) => toDialectExpression(value))])
|
|
4235
4309
|
) as Record<string, readonly Expression.Any[]>
|
|
4236
4310
|
|
|
4237
4311
|
const normalizeMutationTargets = (
|
|
@@ -4277,13 +4351,7 @@ type BinaryPredicateExpression<
|
|
|
4277
4351
|
const getMutationColumn = (
|
|
4278
4352
|
columns: Record<string, unknown>,
|
|
4279
4353
|
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
|
-
}
|
|
4354
|
+
): Expression.Any => columns[columnName] as Expression.Any
|
|
4287
4355
|
|
|
4288
4356
|
const buildMutationAssignments = <Target extends MutationTargetInput, Values>(
|
|
4289
4357
|
target: Target,
|
|
@@ -4299,7 +4367,7 @@ type BinaryPredicateExpression<
|
|
|
4299
4367
|
}
|
|
4300
4368
|
const valueMap = values as Record<string, Record<string, unknown> | undefined>
|
|
4301
4369
|
return targets.flatMap((table) => {
|
|
4302
|
-
const targetName = (table as
|
|
4370
|
+
const targetName = (table as TableLike)[Table.TypeId].name
|
|
4303
4371
|
const scopedValues = valueMap[targetName] ?? {}
|
|
4304
4372
|
const columns = table as unknown as Record<string, Expression.Any>
|
|
4305
4373
|
return Object.entries(scopedValues).map(([columnName, value]) => ({
|
|
@@ -4320,20 +4388,17 @@ type BinaryPredicateExpression<
|
|
|
4320
4388
|
} => {
|
|
4321
4389
|
const firstRow = rows[0]
|
|
4322
4390
|
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
4391
|
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
|
-
}
|
|
4392
|
+
const normalizeRow = (row: InsertRowInput<Target>) => {
|
|
4332
4393
|
const assignments = buildMutationAssignments(target, row) as readonly QueryAst.AssignmentClause[]
|
|
4333
4394
|
return {
|
|
4334
4395
|
values: columns.map((columnName) => assignments.find((assignment) => assignment.columnName === columnName)!)
|
|
4335
4396
|
} satisfies QueryAst.InsertValuesRowClause
|
|
4336
|
-
}
|
|
4397
|
+
}
|
|
4398
|
+
const normalizedRows: readonly [QueryAst.InsertValuesRowClause, ...QueryAst.InsertValuesRowClause[]] = [
|
|
4399
|
+
normalizeRow(rows[0]),
|
|
4400
|
+
...rows.slice(1).map(normalizeRow)
|
|
4401
|
+
]
|
|
4337
4402
|
const required = normalizedRows.flatMap((row) =>
|
|
4338
4403
|
row.values.flatMap((entry) => Object.keys(entry.value[Expression.TypeId].dependencies))
|
|
4339
4404
|
)
|
|
@@ -4348,9 +4413,6 @@ type BinaryPredicateExpression<
|
|
|
4348
4413
|
selection: Record<string, Expression.Any>
|
|
4349
4414
|
): readonly [string, ...string[]] => {
|
|
4350
4415
|
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
4416
|
return columns as [string, ...string[]]
|
|
4355
4417
|
}
|
|
4356
4418
|
|
|
@@ -4365,27 +4427,11 @@ type BinaryPredicateExpression<
|
|
|
4365
4427
|
}[]
|
|
4366
4428
|
} => {
|
|
4367
4429
|
const entries = Object.entries(values)
|
|
4368
|
-
if (entries.length === 0) {
|
|
4369
|
-
throw new Error("unnest(...) requires at least one column array")
|
|
4370
|
-
}
|
|
4371
4430
|
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
|
-
}
|
|
4431
|
+
const normalized = entries.map(([columnName, items]) => ({
|
|
4432
|
+
columnName,
|
|
4433
|
+
values: items
|
|
4434
|
+
}))
|
|
4389
4435
|
return {
|
|
4390
4436
|
columns,
|
|
4391
4437
|
values: normalized
|
|
@@ -4397,10 +4443,6 @@ type BinaryPredicateExpression<
|
|
|
4397
4443
|
columnsInput: string | readonly string[]
|
|
4398
4444
|
): readonly [string, ...string[]] => {
|
|
4399
4445
|
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
4446
|
return columns
|
|
4405
4447
|
}
|
|
4406
4448
|
|
|
@@ -4415,7 +4457,10 @@ type BinaryPredicateExpression<
|
|
|
4415
4457
|
}
|
|
4416
4458
|
}
|
|
4417
4459
|
if (!Array.isArray(input) && "constraint" in input) {
|
|
4418
|
-
|
|
4460
|
+
return {
|
|
4461
|
+
kind: "constraint",
|
|
4462
|
+
name: input.constraint
|
|
4463
|
+
}
|
|
4419
4464
|
}
|
|
4420
4465
|
const columnTarget = input as {
|
|
4421
4466
|
readonly columns: string | readonly string[]
|
|
@@ -4476,14 +4521,91 @@ type ValidateTargetColumnInput<
|
|
|
4476
4521
|
Columns extends DdlColumnInput
|
|
4477
4522
|
> = ValidateTargetColumns<Target, NormalizeDdlColumns<Columns>> extends never ? never : Columns
|
|
4478
4523
|
|
|
4479
|
-
type
|
|
4480
|
-
readonly
|
|
4524
|
+
type SameColumnSet<
|
|
4525
|
+
Left extends readonly string[],
|
|
4526
|
+
Right extends readonly string[]
|
|
4527
|
+
> = string extends Left[number] | Right[number]
|
|
4528
|
+
? false
|
|
4529
|
+
: Exclude<Left[number], Right[number]> extends never
|
|
4530
|
+
? Exclude<Right[number], Left[number]> extends never
|
|
4531
|
+
? true
|
|
4532
|
+
: false
|
|
4533
|
+
: false
|
|
4534
|
+
|
|
4535
|
+
type ConflictArbitersOf<Target extends MutationTargetLike> =
|
|
4536
|
+
Target[typeof Table.TypeId]["conflictArbiters"][number]
|
|
4537
|
+
|
|
4538
|
+
type MatchingConflictArbiter<
|
|
4539
|
+
Target extends MutationTargetLike,
|
|
4540
|
+
Columns extends readonly string[],
|
|
4541
|
+
AllowPartial extends boolean
|
|
4542
|
+
> = ConflictArbitersOf<Target> extends infer Arbiter extends Table.ConflictArbiter
|
|
4543
|
+
? Arbiter extends Table.ConflictArbiter
|
|
4544
|
+
? SameColumnSet<Arbiter["columns"], Columns> extends true
|
|
4545
|
+
? Arbiter["scope"] extends "unconditional"
|
|
4546
|
+
? true
|
|
4547
|
+
: AllowPartial extends true ? true : never
|
|
4548
|
+
: never
|
|
4549
|
+
: never
|
|
4550
|
+
: never
|
|
4551
|
+
|
|
4552
|
+
type HasInlineConflictArbiter<
|
|
4553
|
+
Target extends MutationTargetLike,
|
|
4554
|
+
Columns extends readonly string[]
|
|
4555
|
+
> = Columns extends readonly [infer Column extends Extract<keyof Target[typeof Table.TypeId]["fields"], string>]
|
|
4556
|
+
? Target[typeof Table.TypeId]["fields"][Column] extends { readonly metadata: { readonly primaryKey: true } | { readonly unique: true } }
|
|
4557
|
+
? true
|
|
4558
|
+
: false
|
|
4559
|
+
: false
|
|
4560
|
+
|
|
4561
|
+
type HasConflictArbiter<
|
|
4562
|
+
Target extends MutationTargetLike,
|
|
4563
|
+
Columns extends readonly string[],
|
|
4564
|
+
AllowPartial extends boolean
|
|
4565
|
+
> = string extends Extract<keyof Target[typeof Table.TypeId]["fields"], string>
|
|
4566
|
+
? true
|
|
4567
|
+
: HasInlineConflictArbiter<Target, Columns> extends true
|
|
4568
|
+
? true
|
|
4569
|
+
: true extends MatchingConflictArbiter<Target, Columns, AllowPartial> ? true : false
|
|
4570
|
+
|
|
4571
|
+
type ConflictTargetArbiterError<
|
|
4572
|
+
Columns,
|
|
4573
|
+
AllowPartial extends boolean
|
|
4574
|
+
> = {
|
|
4575
|
+
readonly __effect_qb_error__: "effect-qb: conflict target columns must match a primary key, unique constraint, or unique index"
|
|
4576
|
+
readonly __effect_qb_conflict_columns__: Columns
|
|
4577
|
+
readonly __effect_qb_partial_target__: AllowPartial
|
|
4578
|
+
readonly __effect_qb_hint__: "Declare the target columns as primaryKey/unique, add a table-level Unique.make(...), or use a simple Pg.Index.uniqueIndex(...)"
|
|
4579
|
+
}
|
|
4580
|
+
|
|
4581
|
+
type ValidateConflictColumnInput<
|
|
4582
|
+
Target extends MutationTargetLike,
|
|
4583
|
+
Columns extends DdlColumnInput,
|
|
4584
|
+
AllowPartial extends boolean
|
|
4585
|
+
> = ValidateTargetColumnInput<Target, Columns> extends never
|
|
4586
|
+
? never
|
|
4587
|
+
: HasConflictArbiter<Target, NormalizeDdlColumns<Columns>, AllowPartial> extends true
|
|
4588
|
+
? Columns
|
|
4589
|
+
: ConflictTargetArbiterError<NormalizeDdlColumns<Columns>, AllowPartial>
|
|
4590
|
+
|
|
4591
|
+
type ConflictColumnPlanConstraint<
|
|
4592
|
+
Target extends MutationTargetLike,
|
|
4593
|
+
Columns extends DdlColumnInput,
|
|
4594
|
+
AllowPartial extends boolean
|
|
4595
|
+
> = ValidateTargetColumnInput<Target, Columns> extends never
|
|
4596
|
+
? never
|
|
4597
|
+
: HasConflictArbiter<Target, NormalizeDdlColumns<Columns>, AllowPartial> extends true
|
|
4598
|
+
? unknown
|
|
4599
|
+
: ConflictTargetArbiterError<NormalizeDdlColumns<Columns>, AllowPartial>
|
|
4600
|
+
|
|
4601
|
+
type CreateIndexOptions<Name extends string = string> = {
|
|
4602
|
+
readonly name?: NonEmptyStringInput<Name>
|
|
4481
4603
|
readonly unique?: boolean
|
|
4482
4604
|
readonly ifNotExists?: boolean
|
|
4483
4605
|
}
|
|
4484
4606
|
|
|
4485
|
-
type DropIndexOptions = {
|
|
4486
|
-
readonly name?:
|
|
4607
|
+
type DropIndexOptions<Name extends string = string> = {
|
|
4608
|
+
readonly name?: NonEmptyStringInput<Name>
|
|
4487
4609
|
readonly ifExists?: boolean
|
|
4488
4610
|
}
|
|
4489
4611
|
|
|
@@ -4582,7 +4704,7 @@ type ValuesRowsDialectInput<
|
|
|
4582
4704
|
BoolDb extends Expression.DbType.Any,
|
|
4583
4705
|
TimestampDb extends Expression.DbType.Any,
|
|
4584
4706
|
NullDb extends Expression.DbType.Any
|
|
4585
|
-
> = Exclude<ValuesRowsDialect<Rows, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect> extends never
|
|
4707
|
+
> = Exclude<ValuesRowsDialect<Rows, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect | "standard"> extends never
|
|
4586
4708
|
? unknown
|
|
4587
4709
|
: {
|
|
4588
4710
|
readonly __effect_qb_error__: "effect-qb: values rows cannot mix dialects"
|
|
@@ -4637,7 +4759,7 @@ type UnnestColumnsDialectInput<
|
|
|
4637
4759
|
BoolDb extends Expression.DbType.Any,
|
|
4638
4760
|
TimestampDb extends Expression.DbType.Any,
|
|
4639
4761
|
NullDb extends Expression.DbType.Any
|
|
4640
|
-
> = Exclude<UnnestColumnsDialect<Columns, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect> extends never
|
|
4762
|
+
> = Exclude<UnnestColumnsDialect<Columns, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect | "standard"> extends never
|
|
4641
4763
|
? unknown
|
|
4642
4764
|
: {
|
|
4643
4765
|
readonly __effect_qb_error__: "effect-qb: unnest columns cannot mix dialects"
|
|
@@ -4972,6 +5094,26 @@ type ConflictTargetInput<
|
|
|
4972
5094
|
readonly constraint?: string
|
|
4973
5095
|
}>)
|
|
4974
5096
|
|
|
5097
|
+
type ConflictConstraintNameConstraint<Target> =
|
|
5098
|
+
Target extends { readonly constraint: infer Constraint extends string }
|
|
5099
|
+
? { readonly constraint: NonEmptyStringInput<Constraint> }
|
|
5100
|
+
: unknown
|
|
5101
|
+
|
|
5102
|
+
type ConflictTargetHasPredicate<Target> =
|
|
5103
|
+
Target extends { readonly where: PredicateInput } ? true : false
|
|
5104
|
+
|
|
5105
|
+
type ConflictTargetPlanConstraint<
|
|
5106
|
+
Target extends MutationTargetLike,
|
|
5107
|
+
ConflictTarget
|
|
5108
|
+
> =
|
|
5109
|
+
ConflictTarget extends { readonly constraint: string }
|
|
5110
|
+
? unknown
|
|
5111
|
+
: ConflictTarget extends { readonly columns: infer Columns extends DdlColumnInput }
|
|
5112
|
+
? ConflictColumnPlanConstraint<Target, Columns, ConflictTargetHasPredicate<ConflictTarget>>
|
|
5113
|
+
: ConflictTarget extends DdlColumnInput
|
|
5114
|
+
? ConflictColumnPlanConstraint<Target, ConflictTarget, false>
|
|
5115
|
+
: unknown
|
|
5116
|
+
|
|
4975
5117
|
type ConflictActionInput<
|
|
4976
5118
|
Target extends MutationTargetLike,
|
|
4977
5119
|
Dialect extends string,
|
|
@@ -5123,7 +5265,7 @@ type MutationOrderLimitSupported<PlanValue extends QueryPlan<any, any, any, any,
|
|
|
5123
5265
|
type MutationTargetTupleDialectConstraint<
|
|
5124
5266
|
Targets extends MutationTargetTuple,
|
|
5125
5267
|
Dialect extends string
|
|
5126
|
-
> = Exclude<TableDialectOf<Targets[number]>, Dialect> extends never ? unknown : never
|
|
5268
|
+
> = Exclude<TableDialectOf<Targets[number]>, Dialect | "standard"> extends never ? unknown : never
|
|
5127
5269
|
|
|
5128
5270
|
type MutationRequiredFromValues<Values extends Record<string, unknown>> = {
|
|
5129
5271
|
[K in keyof Values]: Values[K] extends Expression.Any ? RequiredFromDependencies<DependenciesOf<Values[K]>> : never
|
|
@@ -5177,7 +5319,7 @@ type KnownIncompatibleMutationDialectFromValues<
|
|
|
5177
5319
|
BoolDb extends Expression.DbType.Any,
|
|
5178
5320
|
TimestampDb extends Expression.DbType.Any,
|
|
5179
5321
|
NullDb extends Expression.DbType.Any
|
|
5180
|
-
> = Exclude<KnownMutationDialectFromValues<Values, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect>
|
|
5322
|
+
> = Exclude<KnownMutationDialectFromValues<Values, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect | "standard">
|
|
5181
5323
|
|
|
5182
5324
|
type MutationValuesDialectConstraint<
|
|
5183
5325
|
Values,
|
|
@@ -5229,9 +5371,11 @@ type SourceDialectConstraint<
|
|
|
5229
5371
|
Dialect extends string
|
|
5230
5372
|
> = [SourceDialectOf<CurrentSource>] extends [never]
|
|
5231
5373
|
? unknown
|
|
5232
|
-
:
|
|
5233
|
-
?
|
|
5234
|
-
:
|
|
5374
|
+
: Exclude<SourceDialectOf<CurrentSource>, Dialect | "standard"> extends never
|
|
5375
|
+
? unknown
|
|
5376
|
+
: Dialect extends "standard"
|
|
5377
|
+
? unknown
|
|
5378
|
+
: never
|
|
5235
5379
|
|
|
5236
5380
|
type SourceRequirementConstraint<
|
|
5237
5381
|
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>,
|
|
@@ -5495,7 +5639,7 @@ type AsCurriedResult<
|
|
|
5495
5639
|
function as<
|
|
5496
5640
|
Alias extends string
|
|
5497
5641
|
>(
|
|
5498
|
-
alias: Alias
|
|
5642
|
+
alias: LiteralStringInput<Alias>
|
|
5499
5643
|
): <Value extends AsCurriedInput<Dialect>>(
|
|
5500
5644
|
value: Value
|
|
5501
5645
|
) => AsCurriedResult<Value, Alias, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>
|
|
@@ -5504,7 +5648,7 @@ type AsCurriedResult<
|
|
|
5504
5648
|
Alias extends string
|
|
5505
5649
|
>(
|
|
5506
5650
|
value: Value,
|
|
5507
|
-
alias: Alias
|
|
5651
|
+
alias: LiteralStringInput<Alias>
|
|
5508
5652
|
): ProjectionAliasedExpression<DialectAsExpression<Value, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Alias>
|
|
5509
5653
|
function as<
|
|
5510
5654
|
Rows extends ValuesRowsInput,
|
|
@@ -5515,7 +5659,7 @@ type AsCurriedResult<
|
|
|
5515
5659
|
ValuesOutputShape<Rows, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
5516
5660
|
Dialect
|
|
5517
5661
|
>,
|
|
5518
|
-
alias: Alias
|
|
5662
|
+
alias: LiteralStringInput<Alias>
|
|
5519
5663
|
): ValuesSource<
|
|
5520
5664
|
Rows,
|
|
5521
5665
|
ValuesOutputShape<Rows, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
@@ -5527,11 +5671,11 @@ type AsCurriedResult<
|
|
|
5527
5671
|
Alias extends string
|
|
5528
5672
|
>(
|
|
5529
5673
|
value: DerivedTableCompatiblePlan<PlanValue>,
|
|
5530
|
-
alias: Alias
|
|
5674
|
+
alias: LiteralStringInput<Alias>
|
|
5531
5675
|
): DerivedSource<PlanValue, Alias>
|
|
5532
5676
|
function as(valueOrAlias: unknown, alias?: string): unknown {
|
|
5533
5677
|
if (alias === undefined) {
|
|
5534
|
-
return (value: unknown) => as(value as any, valueOrAlias as
|
|
5678
|
+
return (value: unknown) => as(value as any, valueOrAlias as never)
|
|
5535
5679
|
}
|
|
5536
5680
|
const resolvedAlias = alias
|
|
5537
5681
|
const value = valueOrAlias
|
|
@@ -5571,7 +5715,7 @@ type AsCurriedResult<
|
|
|
5571
5715
|
function with_<
|
|
5572
5716
|
Alias extends string
|
|
5573
5717
|
>(
|
|
5574
|
-
alias: Alias
|
|
5718
|
+
alias: LiteralStringInput<Alias>
|
|
5575
5719
|
): <PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
|
|
5576
5720
|
value: SqliteCteCompatiblePlan<PlanValue>
|
|
5577
5721
|
) => import("../../internal/query.js").CteSource<PlanValue, Alias>
|
|
@@ -5580,11 +5724,11 @@ type AsCurriedResult<
|
|
|
5580
5724
|
Alias extends string
|
|
5581
5725
|
>(
|
|
5582
5726
|
value: SqliteCteCompatiblePlan<PlanValue>,
|
|
5583
|
-
alias: Alias
|
|
5727
|
+
alias: LiteralStringInput<Alias>
|
|
5584
5728
|
): import("../../internal/query.js").CteSource<PlanValue, Alias>
|
|
5585
5729
|
function with_(valueOrAlias: unknown, alias?: string): unknown {
|
|
5586
5730
|
if (alias === undefined) {
|
|
5587
|
-
return (value: unknown) => with_(value as any, valueOrAlias as
|
|
5731
|
+
return (value: unknown) => with_(value as any, valueOrAlias as never)
|
|
5588
5732
|
}
|
|
5589
5733
|
return makeCteSource(
|
|
5590
5734
|
valueOrAlias as CompletePlan<QueryPlan<any, any, any, any, any, any, any, any, any, any>>,
|
|
@@ -5595,7 +5739,7 @@ type AsCurriedResult<
|
|
|
5595
5739
|
function withRecursive_<
|
|
5596
5740
|
Alias extends string
|
|
5597
5741
|
>(
|
|
5598
|
-
alias: Alias
|
|
5742
|
+
alias: LiteralStringInput<Alias>
|
|
5599
5743
|
): <PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
|
|
5600
5744
|
value: SqliteCteCompatiblePlan<PlanValue>
|
|
5601
5745
|
) => import("../../internal/query.js").CteSource<PlanValue, Alias>
|
|
@@ -5604,11 +5748,11 @@ type AsCurriedResult<
|
|
|
5604
5748
|
Alias extends string
|
|
5605
5749
|
>(
|
|
5606
5750
|
value: SqliteCteCompatiblePlan<PlanValue>,
|
|
5607
|
-
alias: Alias
|
|
5751
|
+
alias: LiteralStringInput<Alias>
|
|
5608
5752
|
): import("../../internal/query.js").CteSource<PlanValue, Alias>
|
|
5609
5753
|
function withRecursive_(valueOrAlias: unknown, alias?: string): unknown {
|
|
5610
5754
|
if (alias === undefined) {
|
|
5611
|
-
return (value: unknown) => withRecursive_(value as any, valueOrAlias as
|
|
5755
|
+
return (value: unknown) => withRecursive_(value as any, valueOrAlias as never)
|
|
5612
5756
|
}
|
|
5613
5757
|
return makeCteSource(
|
|
5614
5758
|
valueOrAlias as CompletePlan<QueryPlan<any, any, any, any, any, any, any, any, any, any>>,
|
|
@@ -5620,7 +5764,7 @@ type AsCurriedResult<
|
|
|
5620
5764
|
function lateral<
|
|
5621
5765
|
Alias extends string
|
|
5622
5766
|
>(
|
|
5623
|
-
alias: Alias
|
|
5767
|
+
alias: LiteralStringInput<Alias>
|
|
5624
5768
|
): <PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
|
|
5625
5769
|
value: LateralSourceCompatiblePlan<PlanValue>
|
|
5626
5770
|
) => import("../../internal/query.js").LateralSource<PlanValue, Alias>
|
|
@@ -5629,11 +5773,11 @@ type AsCurriedResult<
|
|
|
5629
5773
|
Alias extends string
|
|
5630
5774
|
>(
|
|
5631
5775
|
value: LateralSourceCompatiblePlan<PlanValue>,
|
|
5632
|
-
alias: Alias
|
|
5776
|
+
alias: LiteralStringInput<Alias>
|
|
5633
5777
|
): import("../../internal/query.js").LateralSource<PlanValue, Alias>
|
|
5634
5778
|
function lateral(valueOrAlias: unknown, alias?: string): unknown {
|
|
5635
5779
|
if (alias === undefined) {
|
|
5636
|
-
return (value: unknown) => lateral(value as any, valueOrAlias as
|
|
5780
|
+
return (value: unknown) => lateral(value as any, valueOrAlias as never)
|
|
5637
5781
|
}
|
|
5638
5782
|
return makeLateralSource(
|
|
5639
5783
|
valueOrAlias as QueryPlan<any, any, any, any, any, any, any, any, any, any>,
|
|
@@ -5660,7 +5804,7 @@ type AsCurriedResult<
|
|
|
5660
5804
|
columns: Columns
|
|
5661
5805
|
& UnnestColumnsShapeInput<Columns>
|
|
5662
5806
|
& UnnestColumnsDialectInput<Columns, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
5663
|
-
alias: Alias
|
|
5807
|
+
alias: LiteralStringInput<Alias>
|
|
5664
5808
|
) => UnnestSource<
|
|
5665
5809
|
UnnestOutputShape<Columns, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
5666
5810
|
Alias,
|
|
@@ -5676,7 +5820,7 @@ type AsCurriedResult<
|
|
|
5676
5820
|
start: Start & NumericExpressionDialectInput<Start, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
5677
5821
|
stop: Stop & NumericExpressionDialectInput<Stop, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
5678
5822
|
step?: Step & (Step extends NumericExpressionInput ? NumericExpressionDialectInput<Step, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb> : unknown),
|
|
5679
|
-
alias?: Alias
|
|
5823
|
+
alias?: LiteralStringInput<Alias>
|
|
5680
5824
|
) => Dialect extends "postgres"
|
|
5681
5825
|
? TableFunctionSource<
|
|
5682
5826
|
GenerateSeriesOutputShape<Start, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
@@ -5723,8 +5867,8 @@ type AsCurriedResult<
|
|
|
5723
5867
|
? SelectSelectionNonEmptyError<Selection>
|
|
5724
5868
|
: unknown
|
|
5725
5869
|
|
|
5726
|
-
export type SelectApi = <Selection extends SelectionShape>(
|
|
5727
|
-
selection: Selection & SelectionRootObjectConstraint<Selection> & SelectionNestedNonEmptyConstraint<Selection> & SelectSelectionNonEmptyConstraint<Selection>
|
|
5870
|
+
export type SelectApi = <const Selection extends SelectionShape>(
|
|
5871
|
+
selection: Selection & SelectionRootObjectConstraint<Selection> & SelectionNestedNonEmptyConstraint<Selection> & SelectSelectionNonEmptyConstraint<Selection> & SelectionProjectionAliasCollisionConstraint<Selection>
|
|
5728
5872
|
) => QueryPlan<
|
|
5729
5873
|
Selection,
|
|
5730
5874
|
ExtractRequired<Selection>,
|
|
@@ -6189,8 +6333,8 @@ type AsCurriedResult<
|
|
|
6189
6333
|
: unknown
|
|
6190
6334
|
|
|
6191
6335
|
type ReturningApi = Dialect extends "postgres" | "sqlite"
|
|
6192
|
-
? <Selection extends SelectionShape>(
|
|
6193
|
-
selection: Selection & SelectionRootObjectConstraint<Selection> & SelectionNestedNonEmptyConstraint<Selection> & ReturningSelectionNonEmptyConstraint<Selection>
|
|
6336
|
+
? <const Selection extends SelectionShape>(
|
|
6337
|
+
selection: Selection & SelectionRootObjectConstraint<Selection> & SelectionNestedNonEmptyConstraint<Selection> & ReturningSelectionNonEmptyConstraint<Selection> & SelectionProjectionAliasCollisionConstraint<Selection>
|
|
6194
6338
|
) =>
|
|
6195
6339
|
<PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
|
|
6196
6340
|
plan: PlanValue & RequireMutationStatement<PlanValue>
|
|
@@ -6259,13 +6403,13 @@ type AsCurriedResult<
|
|
|
6259
6403
|
const Columns extends DdlColumnInput,
|
|
6260
6404
|
UpdateValues extends MutationInputOf<Table.UpdateOf<Target>> | undefined = MutationInputOf<Table.UpdateOf<Target>> | undefined,
|
|
6261
6405
|
Options extends ConflictActionInput<Target, Dialect, UpdateValues> = ConflictActionInput<Target, Dialect, UpdateValues>,
|
|
6262
|
-
ConflictTarget extends ConflictTargetInput<Target, Dialect, Columns> = ConflictTargetInput<Target, Dialect, Columns>
|
|
6406
|
+
const ConflictTarget extends ConflictTargetInput<Target, Dialect, Columns> = ConflictTargetInput<Target, Dialect, Columns>
|
|
6263
6407
|
>(
|
|
6264
|
-
target: ConflictTarget
|
|
6408
|
+
target: ConflictTarget & ConflictConstraintNameConstraint<ConflictTarget>,
|
|
6265
6409
|
options?: Options & ConflictActionUpdateNonEmptyConstraint<Options>
|
|
6266
|
-
|
|
6410
|
+
) =>
|
|
6267
6411
|
<PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
|
|
6268
|
-
plan: PlanValue & RequireInsertStatement<PlanValue>
|
|
6412
|
+
plan: PlanValue & RequireInsertStatement<PlanValue> & ConflictTargetPlanConstraint<MutationTargetOfPlan<PlanValue>, ConflictTarget>
|
|
6269
6413
|
) => QueryPlan<
|
|
6270
6414
|
SelectionOfPlan<PlanValue>,
|
|
6271
6415
|
Exclude<RequiredOfPlan<PlanValue> | ConflictRequired<UpdateValues, Options, ConflictTarget>, AvailableNames<AvailableOfPlan<PlanValue>>>,
|
|
@@ -6329,7 +6473,7 @@ type AsCurriedResult<
|
|
|
6329
6473
|
>(
|
|
6330
6474
|
target: Target,
|
|
6331
6475
|
values: Values & MutationValuesDialectConstraint<Values, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
6332
|
-
conflictColumns:
|
|
6476
|
+
conflictColumns: ValidateConflictColumnInput<Target, Columns, false>,
|
|
6333
6477
|
updateValues?: UpdateValues & UpdateValuesNonEmptyConstraint<Exclude<UpdateValues, undefined>> & MutationValuesDialectConstraint<Exclude<UpdateValues, undefined>, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>
|
|
6334
6478
|
) => QueryPlan<
|
|
6335
6479
|
{},
|
|
@@ -6637,7 +6781,7 @@ type AsCurriedResult<
|
|
|
6637
6781
|
"rollback"
|
|
6638
6782
|
>
|
|
6639
6783
|
|
|
6640
|
-
type SavepointApi = <Name extends string>(name: Name) => QueryPlan<
|
|
6784
|
+
type SavepointApi = <Name extends string>(name: NonEmptyStringInput<Name>) => QueryPlan<
|
|
6641
6785
|
{},
|
|
6642
6786
|
never,
|
|
6643
6787
|
{},
|
|
@@ -6650,7 +6794,7 @@ type AsCurriedResult<
|
|
|
6650
6794
|
"savepoint"
|
|
6651
6795
|
>
|
|
6652
6796
|
|
|
6653
|
-
type RollbackToApi = <Name extends string>(name: Name) => QueryPlan<
|
|
6797
|
+
type RollbackToApi = <Name extends string>(name: NonEmptyStringInput<Name>) => QueryPlan<
|
|
6654
6798
|
{},
|
|
6655
6799
|
never,
|
|
6656
6800
|
{},
|
|
@@ -6663,7 +6807,7 @@ type AsCurriedResult<
|
|
|
6663
6807
|
"rollbackTo"
|
|
6664
6808
|
>
|
|
6665
6809
|
|
|
6666
|
-
type ReleaseSavepointApi = <Name extends string>(name: Name) => QueryPlan<
|
|
6810
|
+
type ReleaseSavepointApi = <Name extends string>(name: NonEmptyStringInput<Name>) => QueryPlan<
|
|
6667
6811
|
{},
|
|
6668
6812
|
never,
|
|
6669
6813
|
{},
|
|
@@ -6708,10 +6852,10 @@ type AsCurriedResult<
|
|
|
6708
6852
|
"dropTable"
|
|
6709
6853
|
>
|
|
6710
6854
|
|
|
6711
|
-
type CreateIndexApi = <Target extends SchemaTableLike, const Columns extends DdlColumnInput>(
|
|
6855
|
+
type CreateIndexApi = <Target extends SchemaTableLike, const Columns extends DdlColumnInput, Name extends string = string>(
|
|
6712
6856
|
target: Target,
|
|
6713
6857
|
columns: Columns & ValidateDdlColumnInput<Target, Columns>,
|
|
6714
|
-
options?: CreateIndexOptions
|
|
6858
|
+
options?: CreateIndexOptions<Name>
|
|
6715
6859
|
) => QueryPlan<
|
|
6716
6860
|
{},
|
|
6717
6861
|
never,
|
|
@@ -6725,10 +6869,10 @@ type AsCurriedResult<
|
|
|
6725
6869
|
"createIndex"
|
|
6726
6870
|
>
|
|
6727
6871
|
|
|
6728
|
-
type DropIndexApi = <Target extends SchemaTableLike, const Columns extends DdlColumnInput>(
|
|
6872
|
+
type DropIndexApi = <Target extends SchemaTableLike, const Columns extends DdlColumnInput, Name extends string = string>(
|
|
6729
6873
|
target: Target,
|
|
6730
6874
|
columns: Columns & ValidateDdlColumnInput<Target, Columns>,
|
|
6731
|
-
options?: DropIndexOptions
|
|
6875
|
+
options?: DropIndexOptions<Name>
|
|
6732
6876
|
) => QueryPlan<
|
|
6733
6877
|
{},
|
|
6734
6878
|
never,
|