qubu 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -0
- package/dist/{complete-DP7pliuY.mjs → canonical-B5_ouh-c.mjs} +466 -241
- package/dist/codegen.d.mts +2 -2
- package/dist/codegen.mjs +180 -90
- package/dist/column-Cyc2CMnG.mjs +116 -0
- package/dist/column-DDRvD7SF.mjs +721 -0
- package/dist/{constraints-YGyNPQ_z.mjs → constraints-CAmi18Uk.mjs} +8 -3
- package/dist/core.d.mts +3 -3
- package/dist/core.mjs +4 -5
- package/dist/diagnostics-I9vVtXkc.mjs +40 -0
- package/dist/diff.d.mts +9 -9
- package/dist/diff.mjs +152 -102
- package/dist/{explain-CkIK13L_.mjs → explain-BIqEmZha.mjs} +1 -1
- package/dist/expressions-_6JF_J77.mjs +130 -0
- package/dist/index-CaxrMD1A.d.mts +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +414 -77
- package/dist/introspection/mysql.d.mts +26 -0
- package/dist/introspection/mysql.mjs +1278 -0
- package/dist/introspection/postgres.d.mts +43 -0
- package/dist/introspection/postgres.mjs +1889 -0
- package/dist/introspection/sqlite.d.mts +15 -0
- package/dist/introspection/sqlite.mjs +1172 -0
- package/dist/introspection.d.mts +26 -87
- package/dist/introspection.mjs +3 -4351
- package/dist/mysql.d.mts +3 -3
- package/dist/mysql.mjs +8 -7
- package/dist/{errors-Dxv73YJu.mjs → omit-VEr9Ydux.mjs} +5 -1
- package/dist/{on-conflict-DZQ85f1t.mjs → on-conflict-B2rFyHGF.mjs} +78 -8
- package/dist/on-duplicate-key-update-Czsw1Yq-.mjs +95 -0
- package/dist/postgres-hFhd0I9n.mjs +68 -0
- package/dist/postgres.d.mts +3 -3
- package/dist/postgres.mjs +3 -52
- package/dist/registry-BXE_4M9P.mjs +127 -0
- package/dist/{relational-CxnLCqZQ.mjs → relational-CoPBETjI.mjs} +3 -3
- package/dist/schema.d.mts +2 -2
- package/dist/schema.mjs +8 -7
- package/dist/{serialize-BN07IK0v.mjs → serialize-CyobNEx-.mjs} +174 -30
- package/dist/serialize-Du2UPZMt.d.mts +92 -0
- package/dist/snapshot/mysql.d.mts +5 -5
- package/dist/snapshot/mysql.mjs +32 -32
- package/dist/snapshot/postgres.d.mts +5 -5
- package/dist/snapshot/postgres.mjs +25 -25
- package/dist/snapshot/sqlite.d.mts +5 -5
- package/dist/snapshot/sqlite.mjs +30 -30
- package/dist/snapshot-mIb-Zzb5.mjs +1489 -0
- package/dist/snapshot.d.mts +4 -5
- package/dist/snapshot.mjs +3 -4
- package/dist/{source-SqrKWjFJ.mjs → source-DYSUqzvb.mjs} +2 -2
- package/dist/sqlite.d.mts +2 -2
- package/dist/sqlite.mjs +10 -10
- package/dist/{table-BwflqeAj.mjs → table-B8zEq0az.mjs} +4 -4
- package/dist/{types-BIJsj2fJ.mjs → types-CYHpSPwj.mjs} +10 -7
- package/dist/{types-CTCqtFlS.d.mts → types-CiMvKi5V.d.mts} +14 -4
- package/dist/{types-C0VkiwpR.d.mts → types-Dqr4o2I1.d.mts} +640 -189
- package/dist/value-CpaUFtjw.mjs +45 -0
- package/dist/vite/ambient.d.ts +2 -0
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +2 -0
- package/docs/dialects-and-execution.md +61 -11
- package/docs/getting-started.md +1 -1
- package/docs/guides/compose-queries.md +22 -0
- package/docs/guides/drizzle.md +11 -11
- package/docs/guides/extensions/typed-expressions.md +5 -3
- package/docs/guides/json.md +95 -2
- package/docs/guides/mutations.md +125 -0
- package/docs/guides/valtio-sync.md +113 -0
- package/docs/index.md +1 -1
- package/docs/migrations/adapters.md +58 -21
- package/docs/migrations/index.md +50 -12
- package/docs/migrations/operations.md +20 -6
- package/docs/migrations/recovery.md +7 -1
- package/docs/query-model/fragments.md +21 -1
- package/docs/reference/introspection-support.md +16 -18
- package/docs/reference/supported-surface.md +23 -11
- package/docs/schema/catalog-model.md +20 -7
- package/docs/schema/code-generation.md +4 -3
- package/docs/schema/diff.md +2 -2
- package/docs/schema/introspection.md +24 -16
- package/docs/schema/snapshots.md +18 -8
- package/docs/schema/storage-and-schema-sql.md +7 -2
- package/docs/sql-semantic-types.md +8 -0
- package/package.json +14 -1
- package/dist/canonical-DMvR9yBe.mjs +0 -972
- package/dist/column-Da37jYSD.mjs +0 -309
- package/dist/column-r1Y4ivwt.mjs +0 -327
- package/dist/complete-types-CY0KbzNw.d.mts +0 -371
- package/dist/index-B2rZf3-2.d.mts +0 -32
- package/dist/json-Db7XRD91.mjs +0 -169
- package/dist/omit-OxV58AwX.mjs +0 -5
- package/dist/registry-BRcUuazJ.mjs +0 -256
- package/dist/serialize-CEIIlWhC.d.mts +0 -66
- package/dist/snapshot-Xam8-q0j.mjs +0 -392
- package/dist/standard-DfcZEVOj.mjs +0 -12
- package/dist/value-D14I_XgL.mjs +0 -29
package/dist/mysql.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Cr as onDuplicateKeyUpdate, Pt as Dialect, Sr as incoming, br as IncomingIdentity, xr as OnDuplicateKeyUpdateClause, yr as IncomingColumns } from "./types-Dqr4o2I1.mjs";
|
|
2
2
|
//#region src/dialects/mysql.d.ts
|
|
3
|
-
declare function mysqlDialect(): Dialect<"
|
|
3
|
+
declare function mysqlDialect(): Dialect<"row-locking" | "on-duplicate-key-update" | "json">;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { mysqlDialect };
|
|
5
|
+
export { type IncomingColumns, type IncomingIdentity, type OnDuplicateKeyUpdateClause, incoming, mysqlDialect, onDuplicateKeyUpdate };
|
package/dist/mysql.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
1
|
+
import { K as mysqlJson, Z as createDialect } from "./column-DDRvD7SF.mjs";
|
|
2
|
+
import { r as queryValidationError } from "./omit-VEr9Ydux.mjs";
|
|
3
|
+
import { r as onDuplicateKeyUpdate, t as incoming } from "./on-duplicate-key-update-Czsw1Yq-.mjs";
|
|
4
|
+
import { t as mysqlExplain } from "./explain-BIqEmZha.mjs";
|
|
4
5
|
//#region src/dialects/mysql.ts
|
|
5
6
|
const mysqlRowLocking = { render(context, mode, wait) {
|
|
6
7
|
if (mode !== "update" && mode !== "share") throw queryValidationError({
|
|
@@ -14,7 +15,7 @@ const mysqlRowLocking = { render(context, mode, wait) {
|
|
|
14
15
|
if (wait === "nowait") context.append(" NOWAIT");
|
|
15
16
|
if (wait === "skip-locked") context.append(" SKIP LOCKED");
|
|
16
17
|
} };
|
|
17
|
-
function
|
|
18
|
+
function renderPagination(context, parts) {
|
|
18
19
|
const fetch = parts.find((part) => part.kind === "fetch");
|
|
19
20
|
const offset = parts.find((part) => part.kind === "offset");
|
|
20
21
|
context.append("LIMIT ");
|
|
@@ -30,10 +31,10 @@ function mysqlDialect() {
|
|
|
30
31
|
name: "mysql",
|
|
31
32
|
quoteIdentifier: (identifier) => `\`${identifier.replaceAll("`", "``")}\``,
|
|
32
33
|
placeholder: () => "?",
|
|
33
|
-
pagination: { render:
|
|
34
|
+
pagination: { render: renderPagination },
|
|
34
35
|
rowLocking: mysqlRowLocking,
|
|
35
36
|
json: mysqlJson,
|
|
36
|
-
capabilities: ["row-locking"],
|
|
37
|
+
capabilities: ["row-locking", "on-duplicate-key-update"],
|
|
37
38
|
castTypes: {
|
|
38
39
|
integer: "SIGNED",
|
|
39
40
|
text: "CHAR",
|
|
@@ -47,4 +48,4 @@ function mysqlDialect() {
|
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
//#endregion
|
|
50
|
-
export { mysqlDialect };
|
|
51
|
+
export { incoming, mysqlDialect, onDuplicateKeyUpdate };
|
|
@@ -23,4 +23,8 @@ function queryValidationError(issue) {
|
|
|
23
23
|
return new QueryValidationError(issue);
|
|
24
24
|
}
|
|
25
25
|
//#endregion
|
|
26
|
-
|
|
26
|
+
//#region src/query/omit.ts
|
|
27
|
+
/** An explicit placeholder for a safely omitted SELECT clause or projection field. */
|
|
28
|
+
const omit = Symbol("qubu.omit");
|
|
29
|
+
//#endregion
|
|
30
|
+
export { QueryValidationError as n, queryValidationError as r, omit as t };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import { r as exposeColumns, t as createSource } from "./source-SqrKWjFJ.mjs";
|
|
1
|
+
import { A as fragment, C as isExpression, X as assertDialectCapability, i as identifier, t as createColumnReference } from "./column-DDRvD7SF.mjs";
|
|
2
|
+
import { r as queryValidationError, t as omit } from "./omit-VEr9Ydux.mjs";
|
|
3
|
+
import { a as columnResultValue, c as encodeColumnParameter, o as columnSqlType } from "./column-Cyc2CMnG.mjs";
|
|
4
|
+
import { r as exposeColumns, t as createSource } from "./source-DYSUqzvb.mjs";
|
|
5
|
+
import { a as renderSchemaExpression, t as SchemaExpressionError } from "./expressions-_6JF_J77.mjs";
|
|
7
6
|
//#region src/query/mutation/on-conflict.ts
|
|
8
7
|
/** Columns from the proposed INSERT row, available inside DO UPDATE. */
|
|
9
8
|
function excluded(table) {
|
|
@@ -41,12 +40,31 @@ function onConflict(...args) {
|
|
|
41
40
|
assertDialectCapability(context.dialect, "on-conflict");
|
|
42
41
|
context.append("ON CONFLICT");
|
|
43
42
|
if (target !== void 0) {
|
|
43
|
+
if (target.kind === "index" && context.dialect.name !== "postgresql") throw queryValidationError({
|
|
44
|
+
code: "invalid-mutation",
|
|
45
|
+
context: "upsert.conflict.target",
|
|
46
|
+
path: [
|
|
47
|
+
"onConflict",
|
|
48
|
+
"target",
|
|
49
|
+
"dialect"
|
|
50
|
+
],
|
|
51
|
+
message: "Unique-index conflict targets require the PostgreSQL dialect",
|
|
52
|
+
hint: "Render this query with postgresDialect(), or use a declared key constraint."
|
|
53
|
+
});
|
|
44
54
|
context.append(" (");
|
|
45
|
-
target.
|
|
55
|
+
if (target.kind === "index") target.terms.forEach((term, index) => {
|
|
56
|
+
if (index > 0) context.append(", ");
|
|
57
|
+
renderConflictIndexTerm(context, term, index);
|
|
58
|
+
});
|
|
59
|
+
else target.columns.forEach((column, index) => {
|
|
46
60
|
if (index > 0) context.append(", ");
|
|
47
61
|
context.render(identifier(table?.sqlNames[column.fieldName] ?? column.columnName));
|
|
48
62
|
});
|
|
49
63
|
context.append(")");
|
|
64
|
+
if (target.kind === "index" && target.predicate !== void 0) {
|
|
65
|
+
context.append(" WHERE ");
|
|
66
|
+
context.append(renderConflictIndexExpression(context, target.predicate, "predicate"));
|
|
67
|
+
}
|
|
50
68
|
}
|
|
51
69
|
if (action.actionKind === "do-nothing") {
|
|
52
70
|
context.append(" DO NOTHING");
|
|
@@ -60,7 +78,7 @@ function onConflict(...args) {
|
|
|
60
78
|
if (isExpression(value)) context.render(value);
|
|
61
79
|
else {
|
|
62
80
|
const definition = table?.definitions[columnName];
|
|
63
|
-
context.parameter(definition === void 0 ? value : encodeColumnParameter(definition, value));
|
|
81
|
+
context.parameter(definition === void 0 ? value : encodeColumnParameter(definition, value), definition === void 0 ? void 0 : columnSqlType(definition));
|
|
64
82
|
}
|
|
65
83
|
});
|
|
66
84
|
if (action.where !== void 0) {
|
|
@@ -71,6 +89,35 @@ function onConflict(...args) {
|
|
|
71
89
|
});
|
|
72
90
|
}
|
|
73
91
|
function validateConflictTarget(table, target) {
|
|
92
|
+
if (target.kind === "index") {
|
|
93
|
+
const indexes = "indexes" in table ? table.indexes : {};
|
|
94
|
+
if (!Object.values(indexes).includes(target)) throw queryValidationError({
|
|
95
|
+
code: "invalid-mutation",
|
|
96
|
+
context: "upsert.conflict.target",
|
|
97
|
+
path: ["onConflict", "target"],
|
|
98
|
+
message: "ON CONFLICT index target must be declared on the target table",
|
|
99
|
+
hint: "Use a unique index from the INSERT target table's indexes record."
|
|
100
|
+
});
|
|
101
|
+
if (!target.unique || target.terms.length === 0) throw queryValidationError({
|
|
102
|
+
code: "invalid-mutation",
|
|
103
|
+
context: "upsert.conflict.target",
|
|
104
|
+
path: ["onConflict", "target"],
|
|
105
|
+
message: "ON CONFLICT index target must be a non-empty unique index",
|
|
106
|
+
hint: "Declare the target with index(terms, { unique: true })."
|
|
107
|
+
});
|
|
108
|
+
if (target.dialect !== void 0 && target.dialect.dialect !== "postgresql") throw queryValidationError({
|
|
109
|
+
code: "invalid-mutation",
|
|
110
|
+
context: "upsert.conflict.target",
|
|
111
|
+
path: [
|
|
112
|
+
"onConflict",
|
|
113
|
+
"target",
|
|
114
|
+
"dialect"
|
|
115
|
+
],
|
|
116
|
+
message: `ON CONFLICT cannot use an index declared for ${target.dialect.dialect}`,
|
|
117
|
+
hint: "Use a portable unique index or one declared for PostgreSQL."
|
|
118
|
+
});
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
74
121
|
if (target.kind !== "primary-key" && target.kind !== "unique" || target.columns.length === 0) throw queryValidationError({
|
|
75
122
|
code: "invalid-mutation",
|
|
76
123
|
context: "upsert.conflict.target",
|
|
@@ -91,6 +138,29 @@ function validateConflictTarget(table, target) {
|
|
|
91
138
|
hint: "Use the key constraint declared on the INSERT target table."
|
|
92
139
|
});
|
|
93
140
|
}
|
|
141
|
+
function renderConflictIndexTerm(context, term, index) {
|
|
142
|
+
const expression = "orderKind" in term ? term.expression : term;
|
|
143
|
+
const text = renderConflictIndexExpression(context, expression, ["terms", index]);
|
|
144
|
+
context.append(expression.expressionKind === "column" ? text : `(${text})`);
|
|
145
|
+
}
|
|
146
|
+
function renderConflictIndexExpression(context, expression, path) {
|
|
147
|
+
try {
|
|
148
|
+
return renderSchemaExpression(expression, "index", context.dialect).text;
|
|
149
|
+
} catch (error) {
|
|
150
|
+
if (!(error instanceof SchemaExpressionError)) throw error;
|
|
151
|
+
throw queryValidationError({
|
|
152
|
+
code: "invalid-mutation",
|
|
153
|
+
context: "upsert.conflict.target",
|
|
154
|
+
path: [
|
|
155
|
+
"onConflict",
|
|
156
|
+
"target",
|
|
157
|
+
...typeof path === "string" ? [path] : path
|
|
158
|
+
],
|
|
159
|
+
message: `ON CONFLICT index target is not representable: ${error.message}`,
|
|
160
|
+
hint: "Use deterministic PostgreSQL index terms and a deterministic partial predicate."
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
94
164
|
function validateConflictAction(table, action) {
|
|
95
165
|
if (action.actionKind === "do-nothing") {
|
|
96
166
|
if (table === void 0) return;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { A as fragment, C as isExpression, X as assertDialectCapability, i as identifier, t as createColumnReference } from "./column-DDRvD7SF.mjs";
|
|
2
|
+
import { r as queryValidationError, t as omit } from "./omit-VEr9Ydux.mjs";
|
|
3
|
+
import { a as columnResultValue, c as encodeColumnParameter, o as columnSqlType } from "./column-Cyc2CMnG.mjs";
|
|
4
|
+
//#region src/query/mutation/on-duplicate-key-update.ts
|
|
5
|
+
const assignmentTargets = /* @__PURE__ */ new WeakMap();
|
|
6
|
+
function renderDuplicateKeyUpdate(context, clause, columns) {
|
|
7
|
+
assignmentTargets.set(context, {
|
|
8
|
+
table: clause.table,
|
|
9
|
+
columns
|
|
10
|
+
});
|
|
11
|
+
try {
|
|
12
|
+
clause.render(context);
|
|
13
|
+
} finally {
|
|
14
|
+
assignmentTargets.delete(context);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function incomingAlias(table) {
|
|
18
|
+
return table.tableName.toLowerCase() === "__qubu_incoming" ? "__qubu_incoming_row" : "__qubu_incoming";
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Reference the incoming row in MySQL duplicate-key assignments. INSERT SELECT exposes only its
|
|
22
|
+
* explicit target columns; other references fail during rendering. These references cannot be used
|
|
23
|
+
* as a FROM source.
|
|
24
|
+
*/
|
|
25
|
+
function incoming(table) {
|
|
26
|
+
const reference = fragment((context) => {
|
|
27
|
+
assertDialectCapability(context.dialect, "on-duplicate-key-update");
|
|
28
|
+
if (assignmentTargets.get(context)?.table !== table) throw invalid("Incoming columns require duplicate-key assignments for the same target table");
|
|
29
|
+
context.render(identifier(incomingAlias(table)));
|
|
30
|
+
});
|
|
31
|
+
return Object.freeze(Object.fromEntries(Object.keys(table.definitions).map((field) => [field, (() => {
|
|
32
|
+
const column = createColumnReference(table.sqlNames[field] ?? field, reference, field, columnResultValue(table.definitions[field]));
|
|
33
|
+
return Object.freeze({
|
|
34
|
+
...column,
|
|
35
|
+
render(context) {
|
|
36
|
+
const scope = assignmentTargets.get(context);
|
|
37
|
+
if (scope?.columns && !scope.columns.includes(field)) throw invalid(`Incoming column "${field}" is not projected by INSERT SELECT`, field);
|
|
38
|
+
column.render(context);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
})()])));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Update writable columns when a MySQL INSERT row conflicts with a key. Raw values use target
|
|
45
|
+
* column encoders. Expressions may reference the target table or incoming(table). At least one
|
|
46
|
+
* non-omitted assignment is required.
|
|
47
|
+
*/
|
|
48
|
+
function onDuplicateKeyUpdate(table, assignments) {
|
|
49
|
+
const entries = Object.entries(assignments).filter(([, value]) => value !== omit);
|
|
50
|
+
if (entries.length === 0) throw invalid("Duplicate-key updates require at least one assignment");
|
|
51
|
+
for (const [field] of entries) if (!Object.hasOwn(table.definitions, field) || table.definitions[field].generated) throw invalid(`Column "${field}" is not a writable target column`, field);
|
|
52
|
+
return Object.freeze({
|
|
53
|
+
clauseKind: "on-duplicate-key-update",
|
|
54
|
+
table,
|
|
55
|
+
render(context) {
|
|
56
|
+
assertDialectCapability(context.dialect, "on-duplicate-key-update");
|
|
57
|
+
const scope = assignmentTargets.get(context);
|
|
58
|
+
if (scope?.table !== table) throw invalid("Duplicate-key clauses require their matching INSERT target");
|
|
59
|
+
context.append("ON DUPLICATE KEY UPDATE ");
|
|
60
|
+
const scoped = {
|
|
61
|
+
...context,
|
|
62
|
+
render(part) {
|
|
63
|
+
part.render(scoped);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
assignmentTargets.set(scoped, scope);
|
|
67
|
+
try {
|
|
68
|
+
entries.forEach(([field, value], index) => {
|
|
69
|
+
if (index) context.append(", ");
|
|
70
|
+
context.render(identifier(table.sqlNames[field] ?? field));
|
|
71
|
+
context.append(" = ");
|
|
72
|
+
if (isExpression(value)) scoped.render(value);
|
|
73
|
+
else context.parameter(encodeColumnParameter(table.definitions[field], value), columnSqlType(table.definitions[field]));
|
|
74
|
+
});
|
|
75
|
+
} finally {
|
|
76
|
+
assignmentTargets.delete(scoped);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function invalid(message, field) {
|
|
82
|
+
return queryValidationError({
|
|
83
|
+
code: "invalid-update",
|
|
84
|
+
context: "upsert.duplicate-key.assignments",
|
|
85
|
+
path: [
|
|
86
|
+
"onDuplicateKeyUpdate",
|
|
87
|
+
"assignments",
|
|
88
|
+
...field ? [field] : []
|
|
89
|
+
],
|
|
90
|
+
message,
|
|
91
|
+
hint: "Use writable columns and incoming values from the INSERT target table."
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { renderDuplicateKeyUpdate as i, incomingAlias as n, onDuplicateKeyUpdate as r, incoming as t };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { X as assertDialectCapability, Z as createDialect, k as withDialectCapability, q as postgresJson } from "./column-DDRvD7SF.mjs";
|
|
2
|
+
import { t as comparison } from "./relational-CoPBETjI.mjs";
|
|
3
|
+
import { n as postgresExplain } from "./explain-BIqEmZha.mjs";
|
|
4
|
+
//#region src/query/mutation/update-from.ts
|
|
5
|
+
/** Introduce one or more PostgreSQL sources to an UPDATE statement. */
|
|
6
|
+
function updateFrom(...sources) {
|
|
7
|
+
return Object.freeze({
|
|
8
|
+
clauseKind: "update-from",
|
|
9
|
+
sources,
|
|
10
|
+
render(context) {
|
|
11
|
+
assertDialectCapability(context.dialect, "update-from");
|
|
12
|
+
context.append("FROM ");
|
|
13
|
+
sources.forEach((source, index) => {
|
|
14
|
+
if (index > 0) context.append(", ");
|
|
15
|
+
context.render(source);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/dialects/postgres.ts
|
|
22
|
+
const postgresRowLockModeSql = {
|
|
23
|
+
update: "UPDATE",
|
|
24
|
+
"no-key-update": "NO KEY UPDATE",
|
|
25
|
+
share: "SHARE",
|
|
26
|
+
"key-share": "KEY SHARE"
|
|
27
|
+
};
|
|
28
|
+
const postgresRowLocking = { render(context, mode, wait) {
|
|
29
|
+
context.append(`FOR ${postgresRowLockModeSql[mode]}`);
|
|
30
|
+
if (wait === "nowait") context.append(" NOWAIT");
|
|
31
|
+
if (wait === "skip-locked") context.append(" SKIP LOCKED");
|
|
32
|
+
} };
|
|
33
|
+
const postgresPagination = { render(context, parts) {
|
|
34
|
+
[...parts].sort((left, right) => {
|
|
35
|
+
return (left.kind === "fetch" ? 0 : 1) - (right.kind === "fetch" ? 0 : 1);
|
|
36
|
+
}).forEach((part, index) => {
|
|
37
|
+
if (index > 0) context.append(" ");
|
|
38
|
+
context.append(part.kind === "fetch" ? "LIMIT " : "OFFSET ");
|
|
39
|
+
context.parameter(part.rows, "integer");
|
|
40
|
+
});
|
|
41
|
+
} };
|
|
42
|
+
/**
|
|
43
|
+
* PostgreSQL's only core rendering difference is positional parameters. PostgreSQL-specific
|
|
44
|
+
* expressions and clauses should remain separate modules.
|
|
45
|
+
*/
|
|
46
|
+
function postgresDialect() {
|
|
47
|
+
return createDialect({
|
|
48
|
+
name: "postgresql",
|
|
49
|
+
placeholder: (position) => `$${position}`,
|
|
50
|
+
pagination: postgresPagination,
|
|
51
|
+
rowLocking: postgresRowLocking,
|
|
52
|
+
castTypes: { binary: "BYTEA" },
|
|
53
|
+
capabilities: [
|
|
54
|
+
"ilike",
|
|
55
|
+
"on-conflict",
|
|
56
|
+
"row-locking",
|
|
57
|
+
"update-from"
|
|
58
|
+
],
|
|
59
|
+
json: postgresJson,
|
|
60
|
+
explain: postgresExplain
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/** PostgreSQL's case-insensitive pattern-match operator. */
|
|
64
|
+
function ilike(left, pattern) {
|
|
65
|
+
return withDialectCapability(comparison("ILIKE", left, pattern), "ilike");
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { postgresDialect as n, updateFrom as r, ilike as t };
|
package/dist/postgres.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ad as MetadataOf, Dr as UpdateFromClause, Gu as ExpressionWithOutput, Ku as SchemaExpression, Ms as OperandNullability, Ns as OperandSqlType, Or as UpdateFromScope, Ps as SqlCapabilityValidation, Pt as Dialect, Vd as RequiresCapabilityMeta, _f as SqlTextLike, _r as excluded, af as SqlBoolean, dr as DoNothingAction, fr as DoUpdateAction, gr as doUpdate, hr as doNothing, js as Operand, kr as updateFrom, lr as ConflictAction, mr as OnConflictClause, ms as ComparisonValidation, nf as AnySqlType, pr as ExcludedSource, qd as ResultMeta, ur as ConflictTarget, vr as onConflict, xf as SqlUnknown, yd as ExpressionMeta } from "./types-Dqr4o2I1.mjs";
|
|
2
2
|
//#region src/dialects/postgres.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* PostgreSQL's only core rendering difference is positional parameters. PostgreSQL-specific
|
|
5
5
|
* expressions and clauses should remain separate modules.
|
|
6
6
|
*/
|
|
7
|
-
declare function postgresDialect(): Dialect<"
|
|
7
|
+
declare function postgresDialect(): Dialect<"row-locking" | "json" | "on-conflict" | "ilike" | "update-from">;
|
|
8
8
|
/** PostgreSQL's case-insensitive pattern-match operator. */
|
|
9
9
|
declare function ilike<TLeft extends ExpressionWithOutput<string>, R extends Operand<string>>(left: TLeft & ComparisonValidation<TLeft, R, "ILIKE">, pattern: R): SchemaExpression<ResultMeta<boolean, ((MetadataOf<TLeft & SqlCapabilityValidation<(MetadataOf<TLeft> extends (infer T) ? T extends MetadataOf<TLeft> ? T extends {
|
|
10
10
|
readonly kind: "result";
|
|
@@ -120,4 +120,4 @@ declare function ilike<TLeft extends ExpressionWithOutput<string>, R extends Ope
|
|
|
120
120
|
readonly kind: "result" | "cardinality";
|
|
121
121
|
} ? never : T_54 : never : never) | RequiresCapabilityMeta<"ilike">, "operator">;
|
|
122
122
|
//#endregion
|
|
123
|
-
export { type ConflictAction, type ConflictTarget, type DoNothingAction, type DoUpdateAction, type ExcludedSource, type OnConflictClause, doNothing, doUpdate, excluded, ilike, onConflict, postgresDialect };
|
|
123
|
+
export { type ConflictAction, type ConflictTarget, type DoNothingAction, type DoUpdateAction, type ExcludedSource, type OnConflictClause, type UpdateFromClause, type UpdateFromScope, doNothing, doUpdate, excluded, ilike, onConflict, postgresDialect, updateFrom };
|
package/dist/postgres.mjs
CHANGED
|
@@ -1,52 +1,3 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { n as postgresExplain } from "./explain-CkIK13L_.mjs";
|
|
5
|
-
import { i as onConflict, n as doUpdate, r as excluded, t as doNothing } from "./on-conflict-DZQ85f1t.mjs";
|
|
6
|
-
//#region src/dialects/postgres.ts
|
|
7
|
-
const postgresRowLockModeSql = {
|
|
8
|
-
update: "UPDATE",
|
|
9
|
-
"no-key-update": "NO KEY UPDATE",
|
|
10
|
-
share: "SHARE",
|
|
11
|
-
"key-share": "KEY SHARE"
|
|
12
|
-
};
|
|
13
|
-
const postgresRowLocking = { render(context, mode, wait) {
|
|
14
|
-
context.append(`FOR ${postgresRowLockModeSql[mode]}`);
|
|
15
|
-
if (wait === "nowait") context.append(" NOWAIT");
|
|
16
|
-
if (wait === "skip-locked") context.append(" SKIP LOCKED");
|
|
17
|
-
} };
|
|
18
|
-
const postgresPagination = { render(context, parts) {
|
|
19
|
-
[...parts].sort((left, right) => {
|
|
20
|
-
return (left.kind === "fetch" ? 0 : 1) - (right.kind === "fetch" ? 0 : 1);
|
|
21
|
-
}).forEach((part, index) => {
|
|
22
|
-
if (index > 0) context.append(" ");
|
|
23
|
-
context.append(part.kind === "fetch" ? "LIMIT " : "OFFSET ");
|
|
24
|
-
context.parameter(part.rows);
|
|
25
|
-
});
|
|
26
|
-
} };
|
|
27
|
-
/**
|
|
28
|
-
* PostgreSQL's only core rendering difference is positional parameters. PostgreSQL-specific
|
|
29
|
-
* expressions and clauses should remain separate modules.
|
|
30
|
-
*/
|
|
31
|
-
function postgresDialect() {
|
|
32
|
-
return createDialect({
|
|
33
|
-
name: "postgresql",
|
|
34
|
-
placeholder: (position) => `$${position}`,
|
|
35
|
-
pagination: postgresPagination,
|
|
36
|
-
rowLocking: postgresRowLocking,
|
|
37
|
-
castTypes: { binary: "BYTEA" },
|
|
38
|
-
capabilities: [
|
|
39
|
-
"ilike",
|
|
40
|
-
"on-conflict",
|
|
41
|
-
"row-locking"
|
|
42
|
-
],
|
|
43
|
-
json: postgresJson,
|
|
44
|
-
explain: postgresExplain
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
/** PostgreSQL's case-insensitive pattern-match operator. */
|
|
48
|
-
function ilike(left, pattern) {
|
|
49
|
-
return withDialectCapability(comparison("ILIKE", left, pattern), "ilike");
|
|
50
|
-
}
|
|
51
|
-
//#endregion
|
|
52
|
-
export { doNothing, doUpdate, excluded, ilike, onConflict, postgresDialect };
|
|
1
|
+
import { i as onConflict, n as doUpdate, r as excluded, t as doNothing } from "./on-conflict-B2rFyHGF.mjs";
|
|
2
|
+
import { n as postgresDialect, r as updateFrom, t as ilike } from "./postgres-hFhd0I9n.mjs";
|
|
3
|
+
export { doNothing, doUpdate, excluded, ilike, onConflict, postgresDialect, updateFrom };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { S as snakeCaseIdentifier } from "./column-DDRvD7SF.mjs";
|
|
2
|
+
//#region src/schema/registry.ts
|
|
3
|
+
/** The first naming-policy version used by schema metadata. */
|
|
4
|
+
const schemaNamingPolicyVersion = 1;
|
|
5
|
+
/**
|
|
6
|
+
* The built-in naming policy for schema-generated physical names.
|
|
7
|
+
*
|
|
8
|
+
* Explicit names supplied to `table()` remain unchanged. The policy is used by tooling when it
|
|
9
|
+
* needs a physical name for a logical table ID.
|
|
10
|
+
*/
|
|
11
|
+
const defaultSchemaNamingPolicy = Object.freeze({
|
|
12
|
+
version: 1,
|
|
13
|
+
tableName: snakeCaseIdentifier
|
|
14
|
+
});
|
|
15
|
+
/** Error thrown when a root schema fails registry or naming validation. */
|
|
16
|
+
var SchemaValidationError = class extends Error {
|
|
17
|
+
name = "SchemaValidationError";
|
|
18
|
+
diagnostics;
|
|
19
|
+
/** Alias matching validation libraries that call findings "issues". */
|
|
20
|
+
issues;
|
|
21
|
+
constructor(diagnostics) {
|
|
22
|
+
const frozenDiagnostics = Object.freeze(diagnostics.map((diagnostic) => Object.freeze({
|
|
23
|
+
...diagnostic,
|
|
24
|
+
path: Object.freeze([...diagnostic.path]),
|
|
25
|
+
relatedPaths: diagnostic.relatedPaths ? Object.freeze(diagnostic.relatedPaths.map((path) => Object.freeze([...path]))) : void 0
|
|
26
|
+
})));
|
|
27
|
+
super(frozenDiagnostics.map((diagnostic) => diagnostic.message).join("\n"));
|
|
28
|
+
this.diagnostics = frozenDiagnostics;
|
|
29
|
+
this.issues = frozenDiagnostics;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
function entriesOf(input) {
|
|
33
|
+
if (Array.isArray(input)) return input;
|
|
34
|
+
return Object.entries(input);
|
|
35
|
+
}
|
|
36
|
+
function validLogicalId(id) {
|
|
37
|
+
return id.length > 0 && id === id.trim() && !/[.\\/\u0000-\u001f\u007f]/u.test(id);
|
|
38
|
+
}
|
|
39
|
+
function validNamespace(namespace) {
|
|
40
|
+
return namespace.length > 0 && namespace === namespace.trim() && !/[.\\/\u0000-\u001f\u007f"']/u.test(namespace);
|
|
41
|
+
}
|
|
42
|
+
function validateEntries(entries, namespace, namingPolicy) {
|
|
43
|
+
const diagnostics = [];
|
|
44
|
+
const ids = /* @__PURE__ */ new Map();
|
|
45
|
+
const physicalNames = /* @__PURE__ */ new Map();
|
|
46
|
+
const generatedNames = /* @__PURE__ */ new Map();
|
|
47
|
+
for (const [index, [id, table]] of entries.entries()) {
|
|
48
|
+
const path = ["tables", id];
|
|
49
|
+
const previousId = ids.get(id);
|
|
50
|
+
if (previousId !== void 0) diagnostics.push({
|
|
51
|
+
code: "duplicate-table-id",
|
|
52
|
+
message: `Table ID "${id}" is declared more than once`,
|
|
53
|
+
path,
|
|
54
|
+
relatedPaths: [["tables", entries[previousId][0]]]
|
|
55
|
+
});
|
|
56
|
+
else ids.set(id, index);
|
|
57
|
+
if (!validLogicalId(id)) diagnostics.push({
|
|
58
|
+
code: "invalid-table-id",
|
|
59
|
+
message: `Table ID "${id}" must be a non-empty logical identifier`,
|
|
60
|
+
path
|
|
61
|
+
});
|
|
62
|
+
const physicalName = table.tableName || namingPolicy.tableName(id);
|
|
63
|
+
const previousPhysicalName = physicalNames.get(physicalName);
|
|
64
|
+
if (previousPhysicalName !== void 0) diagnostics.push({
|
|
65
|
+
code: "duplicate-physical-name",
|
|
66
|
+
message: `Tables "${entries[previousPhysicalName][0]}" and "${id}" both use physical name "${physicalName}"`,
|
|
67
|
+
path: [...path, "physicalName"],
|
|
68
|
+
relatedPaths: [[
|
|
69
|
+
"tables",
|
|
70
|
+
entries[previousPhysicalName][0],
|
|
71
|
+
"physicalName"
|
|
72
|
+
]]
|
|
73
|
+
});
|
|
74
|
+
else physicalNames.set(physicalName, index);
|
|
75
|
+
const generatedName = namingPolicy.tableName(id);
|
|
76
|
+
const previousGeneratedName = generatedNames.get(generatedName);
|
|
77
|
+
if (previousGeneratedName !== void 0) diagnostics.push({
|
|
78
|
+
code: "generated-name-collision",
|
|
79
|
+
message: `Logical table IDs "${entries[previousGeneratedName][0]}" and "${id}" generate the same physical name "${generatedName}"`,
|
|
80
|
+
path: [...path, "generatedName"],
|
|
81
|
+
relatedPaths: [[
|
|
82
|
+
"tables",
|
|
83
|
+
entries[previousGeneratedName][0],
|
|
84
|
+
"generatedName"
|
|
85
|
+
]]
|
|
86
|
+
});
|
|
87
|
+
else generatedNames.set(generatedName, index);
|
|
88
|
+
}
|
|
89
|
+
if (namespace !== void 0 && !validNamespace(namespace)) diagnostics.push({
|
|
90
|
+
code: "invalid-namespace",
|
|
91
|
+
message: `Schema namespace "${namespace}" must be a non-empty identifier without qualification or control characters`,
|
|
92
|
+
path: ["namespace"]
|
|
93
|
+
});
|
|
94
|
+
return Object.freeze(diagnostics);
|
|
95
|
+
}
|
|
96
|
+
function freezeTableNames(entries, namingPolicy) {
|
|
97
|
+
return Object.freeze(Object.fromEntries(entries.map(([id, table]) => [id, table.tableName || namingPolicy.tableName(id)])));
|
|
98
|
+
}
|
|
99
|
+
function createSchema(entries, tables, options = {}) {
|
|
100
|
+
const namingPolicy = options.namingPolicy ?? defaultSchemaNamingPolicy;
|
|
101
|
+
const diagnostics = validateEntries(entries, options.namespace, namingPolicy);
|
|
102
|
+
if (diagnostics.length > 0) throw new SchemaValidationError(diagnostics);
|
|
103
|
+
const tableNames = freezeTableNames(entries, namingPolicy);
|
|
104
|
+
const registry = Object.freeze(Object.fromEntries(entries.map(([id, table]) => [id, Object.freeze({
|
|
105
|
+
id,
|
|
106
|
+
table,
|
|
107
|
+
physicalName: tableNames[id]
|
|
108
|
+
})])));
|
|
109
|
+
return Object.freeze({
|
|
110
|
+
schemaKind: "schema",
|
|
111
|
+
tables: Object.freeze({ ...tables }),
|
|
112
|
+
registry,
|
|
113
|
+
tableNames,
|
|
114
|
+
namespace: options.namespace,
|
|
115
|
+
namingPolicy: Object.freeze({ ...namingPolicy })
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function schema(tables, options) {
|
|
119
|
+
const entries = entriesOf(tables);
|
|
120
|
+
return createSchema(entries, Object.fromEntries(entries), options);
|
|
121
|
+
}
|
|
122
|
+
/** Generate a v1 physical name for a logical table ID. */
|
|
123
|
+
function generatedTableName(logicalId, namingPolicy = defaultSchemaNamingPolicy) {
|
|
124
|
+
return namingPolicy.tableName(logicalId);
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
export { schemaNamingPolicyVersion as a, schema as i, defaultSchemaNamingPolicy as n, generatedTableName as r, SchemaValidationError as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { E as makeSchemaExpression, U as resultValue } from "./column-DDRvD7SF.mjs";
|
|
2
|
+
import { n as isValueExpression, t as asValue } from "./value-CpaUFtjw.mjs";
|
|
3
|
+
import { r as queryValidationError } from "./omit-VEr9Ydux.mjs";
|
|
4
4
|
//#region src/expressions/operators/shared.ts
|
|
5
5
|
function isNullOperand(value) {
|
|
6
6
|
return value === null || isValueExpression(value) && value.value === null;
|
package/dist/schema.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
export { AliasIdentity, AliasedSource, AnyKeyColumn, AnySource, AnyTable, CanonicalLiteral, CatalogCheckExpression, CatalogCheckSql, CheckConstraint, CheckConstraintOptions, ColumnBehaviorError, ColumnBehaviorErrorCode, ColumnCodec, ColumnDefault, ColumnDefaultInput, ColumnDefaultOf, ColumnDefinition, ColumnDefinitionConfig, ColumnFromOptions, ColumnGeneratedOf, ColumnHasDefault, ColumnHasRuntimeDefault, ColumnIdentityOf, ColumnInsertInput, ColumnIsGenerated, ColumnIsNullable, ColumnOnUpdateOf, ColumnOptions, ColumnOutput, ColumnSqlType, ColumnStorage, ColumnStorageDeclarationOf, ColumnStorageDescriptor, ColumnStorageDialectOf, ColumnStorageKindOf, ColumnStorageOf, ColumnStorageType, ColumnStorageTypeOf, ColumnUpdateInput, ConstraintDialectExtension, ConstraintOptions, ConstraintTiming, CustomSource, CustomSourceOptions, type DeclaredColumnNullability, DefaultDescriptor, DialectNativeStorage, ExpressionDefaultDescriptor, ExpressionGeneratedColumnDescriptor, ExternalDefaultDescriptor, ExternalGeneratedColumnDescriptor, FieldLike, FieldLikeOptions, ForeignKeyConstraint, ForeignKeyMatch, ForeignKeyOptions, ForeignKeyTarget, ForeignKeyTargetInput, GeneratedColumnDescriptor, GeneratedColumnMode, GeneratedDescriptor, IdentityDescriptor, IdentityDialectExtension, IdentityGeneration, IndexDialectExtension, IndexOptions, IndexTerm, KeyConstraint, KeyConstraintOptions, LateralIdentity, LateralSource, LiteralDefaultDescriptor, MysqlConstraintExtension, MysqlIdentityExtension, MysqlIndexExtension, NativeColumnStorage, NativeStorage, NativeStorageDescriptor, PortableColumnStorage, PortableStorage, PortableStorageDescriptor, PortableStorageType, PostgresConstraintExtension, PostgresIndexExtension, ProvidedSourceIdentity, ProvidedSourceRow, QueryAliasIdentity, QuerySource, ReferentialAction, RenderedSchemaExpression, ResolvedColumnBehavior, Schema, SchemaDiagnostic, SchemaDialect, SchemaDialectExtension, SchemaDialectHooks, SchemaDialectName, SchemaExpressionError, SchemaExpressionErrorCode, SchemaExpressionInput, SchemaExpressionMode, SchemaLiteralValue, SchemaMetadataDiagnostic, SchemaMetadataValidationError, SchemaNamingPolicy, SchemaObjectIdentity, SchemaObjectNameOptions, SchemaOptions, SchemaRenderContext, SchemaRenderOptions, SchemaTableEntry, SchemaTableNames, SchemaTableRecord, SchemaTableRegistry, SchemaValidationError, Source, SourceColumns, SourceConfig, SourceConstraint, SourceConstraints, SourceConstraintsRecord, SourceIdentity, SourceIndex, SourceIndexesRecord, SourceKind, SourceLike, SourceProvision, SourceRow, SourceSqlTypeMap, SourceSqlTypes, SqliteConstraintExtension, SqliteIdentityExtension, SqliteIndexExtension, StorageDeclarationOf, StorageDescriptor, StorageDialectOf, StorageOf, StorageTypeOf, Table, TableColumns, TableDefinitions, TableIdentity, TableIndex, TableInsertInput, TableLike, TableMetadataCallback, TableOptions, TableRow, TableSqlTypes, TableUpdateInput, UniqueConstraint, UniqueConstraintOptions, UniqueNullSemantics, UnknownSourceSqlTypes, UnsafeSchemaSqlExpression, alias, assertSchemaDialectSupport, bigint, binary, boolean, canonicalLiteral, catalogCheck, catalogForeignKey, check, column, columnResultValue, createSchemaDialect, createSource, customSource, date, defaultSchemaNamingPolicy, defineSchemaExpression, dialectMismatchDiagnostic, encodeColumnParameter, exposeColumns, externalDefault, externalGeneratedColumn, foreignKey, freezeSchemaMetadata, generatedColumn, generatedSchemaObjectName, generatedTableName, identityColumn, index, integer, isUnsafeSchemaSql, isValidSchemaObjectName, json, lateral, materializeSchemaObjectIdentity, materializeSchemaObjectRecord, nativeColumn, nativeStorage, normalizeSchemaSql, nullable, numeric, portableStorage, primaryKey, references, renderSchemaExpression, renderSchemaSql, resolveColumnBehavior, schema, schemaExpression, schemaNamingPolicyVersion, sourceIdentity, table, text, timestamp, unique, uniqueConstraint, unsafeSchemaSql, uuid, validateConstraintDialect, validateIndexDialect };
|
|
1
|
+
import { $a as IndexDialectExtension, $c as GeneratedColumnDescriptor, $i as SchemaTableEntry, $s as ColumnOnUpdateOf, Aa as SourceLike, Ac as columnSqlType, Al as materializeSchemaObjectRecord, An as sourceIdentity, Ba as primaryKey, Bc as text, Bi as SchemaRenderOptions, Bn as TableSqlTypes, Ca as KeyConstraint, Cc as StorageOf, Cl as SchemaObjectNameOptions, Cn as SourceRow, Da as ReferentialAction, Dc as boolean, Dl as generatedSchemaObjectName, Dn as createSource, Ea as PostgresConstraintExtension, Ec as binary, El as freezeSchemaMetadata, En as UnknownSourceSqlTypes, Fa as UniqueNullSemantics, Fc as nativeColumn, Fi as SchemaExpressionError, Fn as TableIdentity, Ga as AliasIdentity, Gc as ColumnBehaviorErrorCode, Gi as renderSchemaExpression, Gs as ColumnFromOptions, Ha as unique, Hc as uuid, Hi as defineSchemaExpression, Hn as table, Hs as ColumnDefaultOf, Ia as catalogCheck, Ic as nativeStorage, Ii as SchemaExpressionErrorCode, In as TableInsertInput, Ja as LateralSource, Jc as DefaultDescriptor, Ji as unsafeSchemaSql, Js as ColumnHasRuntimeDefault, Ka as AliasedSource, Kc as ColumnDefault, Ki as renderSchemaSql, Ks as ColumnGeneratedOf, La as catalogForeignKey, Lc as nullable, Li as SchemaExpressionInput, Ln as TableMetadataCallback, Ma as TableLike, Mc as encodeColumnParameter, Mi as SchemaDialectHooks, Mn as Table, Na as UniqueConstraint, Nc as integer, Ni as createSchemaDialect, Nn as TableColumns, Oa as SourceConstraint, Oc as column, Ol as isValidSchemaObjectName, On as customSource, Pa as UniqueConstraintOptions, Pc as json, Pi as RenderedSchemaExpression, Pn as TableDefinitions, Qa as lateral, Qc as ExternalGeneratedColumnDescriptor, Qi as SchemaOptions, Qs as ColumnIsNullable, Ra as check, Rc as numeric, Ri as SchemaExpressionMode, Rn as TableOptions, Sa as ForeignKeyTargetInput, Sc as StorageDialectOf, Sl as SchemaObjectIdentity, Sn as SourceProvision, Ta as MysqlConstraintExtension, Tc as bigint, Tl as dialectMismatchDiagnostic, Tn as SourceSqlTypes, Ua as uniqueConstraint, Uc as CanonicalLiteral, Ui as isUnsafeSchemaSql, Us as ColumnDefinition, Va as references, Vc as timestamp, Vi as UnsafeSchemaSqlExpression, Vn as TableUpdateInput, Vs as ColumnCodec, Wa as validateConstraintDialect, Wc as ColumnBehaviorError, Wi as normalizeSchemaSql, Ws as ColumnDefinitionConfig, Xa as QuerySource, Xc as ExpressionGeneratedColumnDescriptor, Xi as SchemaDiagnostic, Xs as ColumnInsertInput, Ya as QueryAliasIdentity, Yc as ExpressionDefaultDescriptor, Yi as Schema, Ys as ColumnIdentityOf, Za as alias, Zc as ExternalDefaultDescriptor, Zi as SchemaNamingPolicy, Zs as ColumnIsGenerated, _a as FieldLikeOptions, _c as PortableStorage, _l as resolveColumnBehavior, _n as SourceColumns, aa as generatedTableName, ac as ColumnStorageDescriptor, al as IdentityOptionValue, ao as SourceIndex, ba as ForeignKeyOptions, bc as StorageDeclarationOf, bl as SchemaMetadataDiagnostic, bn as SourceIdentity, ca as AnyKeyColumn, cc as ColumnStorageOf, cl as MysqlIdentityExtension, co as TableIndex, da as CheckConstraint, dc as ColumnUpdateInput, dl as SqliteIdentityExtension, dn as AnySource, do as DeclaredColumnNullability, ea as SchemaTableNames, ec as ColumnOptions, el as GeneratedColumnMode, eo as IndexOptions, fa as CheckConstraintOptions, fc as DialectNativeStorage, fl as canonicalLiteral, fn as CustomSource, ga as FieldLike, gc as PortableColumnStorage, gl as identityColumn, gn as Source, ha as ConstraintTiming, hc as NativeStorageDescriptor, hl as generatedColumn, hn as ProvidedSourceRow, ia as defaultSchemaNamingPolicy, ic as ColumnStorageDeclarationOf, il as IdentityGeneration, io as PostgresIndexExtension, ja as SqliteConstraintExtension, jc as date, ji as SchemaDialect, jn as AnyTable, ka as SourceConstraintsRecord, kc as columnResultValue, kl as materializeSchemaObjectIdentity, kn as exposeColumns, la as CatalogCheckExpression, lc as ColumnStorageType, ll as ResolvedColumnBehavior, lo as index, ma as ConstraintOptions, mc as NativeStorage, ml as externalGeneratedColumn, mn as ProvidedSourceIdentity, na as SchemaTableRegistry, nc as ColumnSqlType, nl as IdentityDescriptor, no as IndexTermOptions, oa as schema, oc as ColumnStorageDialectOf, ol as IdentityOptions, oo as SourceIndexesRecord, pa as ConstraintDialectExtension, pc as NativeColumnStorage, pl as externalDefault, pn as CustomSourceOptions, qa as LateralIdentity, qc as ColumnDefaultInput, qi as schemaExpression, qs as ColumnHasDefault, ra as SchemaValidationError, rc as ColumnStorage, rl as IdentityDialectExtension, ro as MysqlIndexExtension, sa as schemaNamingPolicyVersion, sc as ColumnStorageKindOf, sl as LiteralDefaultDescriptor, so as SqliteIndexExtension, ta as SchemaTableRecord, tc as ColumnOutput, tl as GeneratedDescriptor, to as IndexTerm, ua as CatalogCheckSql, uc as ColumnStorageTypeOf, ul as SchemaLiteralValue, uo as validateIndexDialect, va as ForeignKeyConstraint, vc as PortableStorageDescriptor, vl as SchemaDialectExtension, vn as SourceConfig, wa as KeyConstraintOptions, wc as StorageTypeOf, wl as assertSchemaDialectSupport, wn as SourceSqlTypeMap, xa as ForeignKeyTarget, xc as StorageDescriptor, xl as SchemaMetadataValidationError, xn as SourceKind, ya as ForeignKeyMatch, yc as PortableStorageType, yl as SchemaDialectName, yn as SourceConstraints, za as foreignKey, zc as portableStorage, zi as SchemaRenderContext, zn as TableRow } from "./types-Dqr4o2I1.mjs";
|
|
2
|
+
export { AliasIdentity, AliasedSource, AnyKeyColumn, AnySource, AnyTable, CanonicalLiteral, CatalogCheckExpression, CatalogCheckSql, CheckConstraint, CheckConstraintOptions, ColumnBehaviorError, ColumnBehaviorErrorCode, ColumnCodec, ColumnDefault, ColumnDefaultInput, ColumnDefaultOf, ColumnDefinition, ColumnDefinitionConfig, ColumnFromOptions, ColumnGeneratedOf, ColumnHasDefault, ColumnHasRuntimeDefault, ColumnIdentityOf, ColumnInsertInput, ColumnIsGenerated, ColumnIsNullable, ColumnOnUpdateOf, ColumnOptions, ColumnOutput, ColumnSqlType, ColumnStorage, ColumnStorageDeclarationOf, ColumnStorageDescriptor, ColumnStorageDialectOf, ColumnStorageKindOf, ColumnStorageOf, ColumnStorageType, ColumnStorageTypeOf, ColumnUpdateInput, ConstraintDialectExtension, ConstraintOptions, ConstraintTiming, CustomSource, CustomSourceOptions, type DeclaredColumnNullability, DefaultDescriptor, DialectNativeStorage, ExpressionDefaultDescriptor, ExpressionGeneratedColumnDescriptor, ExternalDefaultDescriptor, ExternalGeneratedColumnDescriptor, FieldLike, FieldLikeOptions, ForeignKeyConstraint, ForeignKeyMatch, ForeignKeyOptions, ForeignKeyTarget, ForeignKeyTargetInput, GeneratedColumnDescriptor, GeneratedColumnMode, GeneratedDescriptor, IdentityDescriptor, IdentityDialectExtension, IdentityGeneration, IdentityOptionValue, IdentityOptions, IndexDialectExtension, IndexOptions, IndexTerm, IndexTermOptions, KeyConstraint, KeyConstraintOptions, LateralIdentity, LateralSource, LiteralDefaultDescriptor, MysqlConstraintExtension, MysqlIdentityExtension, MysqlIndexExtension, NativeColumnStorage, NativeStorage, NativeStorageDescriptor, PortableColumnStorage, PortableStorage, PortableStorageDescriptor, PortableStorageType, PostgresConstraintExtension, PostgresIndexExtension, ProvidedSourceIdentity, ProvidedSourceRow, QueryAliasIdentity, QuerySource, ReferentialAction, RenderedSchemaExpression, ResolvedColumnBehavior, Schema, SchemaDiagnostic, SchemaDialect, SchemaDialectExtension, SchemaDialectHooks, SchemaDialectName, SchemaExpressionError, SchemaExpressionErrorCode, SchemaExpressionInput, SchemaExpressionMode, SchemaLiteralValue, SchemaMetadataDiagnostic, SchemaMetadataValidationError, SchemaNamingPolicy, SchemaObjectIdentity, SchemaObjectNameOptions, SchemaOptions, SchemaRenderContext, SchemaRenderOptions, SchemaTableEntry, SchemaTableNames, SchemaTableRecord, SchemaTableRegistry, SchemaValidationError, Source, SourceColumns, SourceConfig, SourceConstraint, SourceConstraints, SourceConstraintsRecord, SourceIdentity, SourceIndex, SourceIndexesRecord, SourceKind, SourceLike, SourceProvision, SourceRow, SourceSqlTypeMap, SourceSqlTypes, SqliteConstraintExtension, SqliteIdentityExtension, SqliteIndexExtension, StorageDeclarationOf, StorageDescriptor, StorageDialectOf, StorageOf, StorageTypeOf, Table, TableColumns, TableDefinitions, TableIdentity, TableIndex, TableInsertInput, TableLike, TableMetadataCallback, TableOptions, TableRow, TableSqlTypes, TableUpdateInput, UniqueConstraint, UniqueConstraintOptions, UniqueNullSemantics, UnknownSourceSqlTypes, UnsafeSchemaSqlExpression, alias, assertSchemaDialectSupport, bigint, binary, boolean, canonicalLiteral, catalogCheck, catalogForeignKey, check, column, columnResultValue, columnSqlType, createSchemaDialect, createSource, customSource, date, defaultSchemaNamingPolicy, defineSchemaExpression, dialectMismatchDiagnostic, encodeColumnParameter, exposeColumns, externalDefault, externalGeneratedColumn, foreignKey, freezeSchemaMetadata, generatedColumn, generatedSchemaObjectName, generatedTableName, identityColumn, index, integer, isUnsafeSchemaSql, isValidSchemaObjectName, json, lateral, materializeSchemaObjectIdentity, materializeSchemaObjectRecord, nativeColumn, nativeStorage, normalizeSchemaSql, nullable, numeric, portableStorage, primaryKey, references, renderSchemaExpression, renderSchemaSql, resolveColumnBehavior, schema, schemaExpression, schemaNamingPolicyVersion, sourceIdentity, table, text, timestamp, unique, uniqueConstraint, unsafeSchemaSql, uuid, validateConstraintDialect, validateIndexDialect };
|