qubu 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codegen.d.mts +1 -1
- package/dist/codegen.mjs +6 -3
- package/dist/{column-hqKr7-1I.mjs → column-DmazTL67.mjs} +15 -2
- package/dist/{complete-types-IjEn5VPN.d.mts → complete-types-CY0KbzNw.d.mts} +1 -1
- package/dist/core.d.mts +1 -1
- package/dist/core.mjs +3 -3
- package/dist/ddl.d.mts +4 -4
- package/dist/ddl.mjs +2 -2
- package/dist/diff.d.mts +1 -1
- package/dist/{index-CPvfEheG.d.mts → index-C_BQNvbT.d.mts} +2 -2
- package/dist/{index-1DpA3mUh.d.mts → index-DSX3IGM6.d.mts} +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +226 -44
- package/dist/introspection.d.mts +2 -2
- package/dist/introspection.mjs +1 -1
- package/dist/migration.d.mts +2 -2
- package/dist/{mysql-B_cYzzX2.mjs → mysql-DxFleLw4.mjs} +3 -3
- package/dist/mysql.d.mts +2 -2
- package/dist/{on-conflict-hfPW0KmQ.mjs → on-conflict-jPsl9l0K.mjs} +6 -3
- package/dist/postgres.d.mts +2 -2
- package/dist/postgres.mjs +3 -3
- package/dist/{registry-BRMLYwDp.mjs → registry-BGqa05et.mjs} +2 -2
- package/dist/{relational-BZ3WDPzC.mjs → relational-x3BDVX9e.mjs} +2 -2
- package/dist/schema.d.mts +2 -2
- package/dist/schema.mjs +5 -5
- package/dist/{snapshot-C-W65HEd.mjs → snapshot-tkKoCd-F.mjs} +1 -1
- package/dist/snapshot.d.mts +3 -3
- package/dist/snapshot.mjs +2 -2
- package/dist/{source-BcS2AsIg.mjs → source-C4Vmu5bb.mjs} +1 -1
- package/dist/{sqlite-Cg0nwYEH.mjs → sqlite-mPVdrKrk.mjs} +2 -2
- package/dist/sqlite.d.mts +30 -3
- package/dist/sqlite.mjs +28 -2
- package/dist/{table-Bp5irMSj.mjs → table-DLQ7YWth.mjs} +2 -2
- package/dist/{types-BK1COGZe.d.mts → types-C0VkiwpR.d.mts} +146 -41
- package/dist/{types-JSZHpUEj.d.mts → types-CTCqtFlS.d.mts} +1 -1
- package/dist/{types-JM3FcAnX.mjs → types-CTENnDh9.mjs} +2 -2
- package/dist/{value-Bi71Agyf.mjs → value-BEEj_Ayd.mjs} +1 -1
- package/dist/vite/ambient.d.ts +6 -0
- package/docs/dialects-and-execution.md +47 -0
- package/docs/guides/drizzle.md +2 -1
- package/docs/reference/supported-surface.md +1 -1
- package/docs/schema/columns-and-writes.md +14 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,32 +1,44 @@
|
|
|
1
1
|
import { a as assertDialectCapability } from "./json-Db7XRD91.mjs";
|
|
2
|
-
import { c as render, n as call, o as cast, r as schemaCall, t as createClause } from "./types-
|
|
2
|
+
import { c as render, n as call, o as cast, r as schemaCall, t as createClause } from "./types-CTENnDh9.mjs";
|
|
3
3
|
import { n as queryValidationError, t as QueryValidationError } from "./errors-Dxv73YJu.mjs";
|
|
4
|
-
import { $ as
|
|
5
|
-
import { i as value, t as asValue } from "./value-
|
|
6
|
-
import { a as isDistinctFrom, c as lt, d as notLike, f as expressionOperand, i as gte, l as lte, m as renderOperands, n as eq, o as isNotDistinctFrom, p as isNullOperand, r as gt, s as like, u as ne } from "./relational-
|
|
4
|
+
import { $ as createResultShape, B as isExpression, D as generatedColumn, E as externalGeneratedColumn, G as markSchemaExpression, H as makeExpression, J as isFragment, O as identityColumn, Q as booleanResultDecoder, R as resolveSqlNames, S as uuid, T as externalDefault, U as makeSchemaExpression, V as isSchemaExpression, W as markExpressionCategory, Y as parenthesize, Z as ResultDecodingError, _ as nullable, at as resultValueOf, b as text, c as boolean, d as date, et as dateResultDecoder, f as encodeColumnParameter, g as nativeStorage, h as nativeColumn, i as identifier, it as resultValue, l as column, m as json, nt as jsonTextResultDecoder, o as bigint, ot as timestampResultDecoder, p as integer, q as fragment, rt as resultShapeValue, s as binary, t as createColumnReference, tt as decodeResultRow, v as numeric, x as timestamp, y as portableStorage, z as snakeCaseIdentifier } from "./column-DmazTL67.mjs";
|
|
5
|
+
import { i as value, t as asValue } from "./value-BEEj_Ayd.mjs";
|
|
6
|
+
import { a as isDistinctFrom, c as lt, d as notLike, f as expressionOperand, i as gte, l as lte, m as renderOperands, n as eq, o as isNotDistinctFrom, p as isNullOperand, r as gt, s as like, u as ne } from "./relational-x3BDVX9e.mjs";
|
|
7
7
|
import { t as omit } from "./omit-OxV58AwX.mjs";
|
|
8
|
-
import { r as exposeColumns, t as createSource } from "./source-
|
|
9
|
-
import { n as alias, r as lateral, t as table } from "./table-
|
|
10
|
-
import { C as index, S as unsafeSchemaSql, c as check, d as references, f as unique, i as schema, l as foreignKey, o as catalogCheck, p as uniqueConstraint, s as catalogForeignKey, u as primaryKey } from "./registry-
|
|
8
|
+
import { r as exposeColumns, t as createSource } from "./source-C4Vmu5bb.mjs";
|
|
9
|
+
import { n as alias, r as lateral, t as table } from "./table-DLQ7YWth.mjs";
|
|
10
|
+
import { C as index, S as unsafeSchemaSql, c as check, d as references, f as unique, i as schema, l as foreignKey, o as catalogCheck, p as uniqueConstraint, s as catalogForeignKey, u as primaryKey } from "./registry-BGqa05et.mjs";
|
|
11
11
|
//#region src/execution.ts
|
|
12
|
-
function qubu(adapter) {
|
|
13
|
-
const
|
|
12
|
+
function qubu(adapter, options = {}) {
|
|
13
|
+
const observation = createObservation(options.hooks);
|
|
14
|
+
const client = createClient(adapter, observation);
|
|
14
15
|
if (!isTransactionalQueryAdapter(adapter)) return client;
|
|
15
16
|
return Object.freeze({
|
|
16
17
|
...client,
|
|
17
|
-
transaction(callback,
|
|
18
|
-
|
|
18
|
+
async transaction(callback, transactionOptions) {
|
|
19
|
+
const active = startTransactionOperation(observation, transactionOptions?.hookMetadata);
|
|
20
|
+
try {
|
|
21
|
+
const result = await adapter.transaction(async (transactionAdapter) => callback(createClient(transactionAdapter, observation, active?.operation.id)), adapterTransactionOptions(transactionOptions));
|
|
22
|
+
active?.finish({ status: "success" });
|
|
23
|
+
return result;
|
|
24
|
+
} catch (error) {
|
|
25
|
+
active?.finish({
|
|
26
|
+
status: "error",
|
|
27
|
+
error
|
|
28
|
+
});
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
19
31
|
}
|
|
20
32
|
});
|
|
21
33
|
}
|
|
22
|
-
function createClient(adapter) {
|
|
34
|
+
function createClient(adapter, observation, parentId) {
|
|
23
35
|
const client = {
|
|
24
36
|
adapter,
|
|
25
37
|
execute(query, options) {
|
|
26
|
-
return
|
|
38
|
+
return executeInternal(query, adapter, options ?? {}, observation, parentId);
|
|
27
39
|
},
|
|
28
40
|
rows(query, options) {
|
|
29
|
-
return
|
|
41
|
+
return executeRowsInternal(query, adapter, options ?? {}, observation, parentId);
|
|
30
42
|
}
|
|
31
43
|
};
|
|
32
44
|
const streaming = isStreamingQueryAdapter(adapter);
|
|
@@ -35,10 +47,10 @@ function createClient(adapter) {
|
|
|
35
47
|
return Object.freeze({
|
|
36
48
|
...client,
|
|
37
49
|
...streaming ? { stream(query, options) {
|
|
38
|
-
return
|
|
50
|
+
return streamInternal(query, adapter, options ?? {}, observation, parentId);
|
|
39
51
|
} } : {},
|
|
40
52
|
...explainable ? { explain(query, options) {
|
|
41
|
-
return
|
|
53
|
+
return explainInternal(query, adapter, options ?? {}, observation, parentId);
|
|
42
54
|
} } : {}
|
|
43
55
|
});
|
|
44
56
|
}
|
|
@@ -51,35 +63,163 @@ function isStreamingQueryAdapter(adapter) {
|
|
|
51
63
|
function isExplainableQueryAdapter(adapter) {
|
|
52
64
|
return typeof adapter.explain === "function";
|
|
53
65
|
}
|
|
66
|
+
function createObservation(hooks) {
|
|
67
|
+
if (hooks === void 0) return;
|
|
68
|
+
return {
|
|
69
|
+
hooks: Object.freeze({ ...hooks }),
|
|
70
|
+
nextOperationId: 1
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function startQueryOperation(observation, kind, request, dialect, metadata, parentId) {
|
|
74
|
+
return startOperation(observation, {
|
|
75
|
+
kind,
|
|
76
|
+
queryKind: request.queryKind,
|
|
77
|
+
dialect: dialect.name,
|
|
78
|
+
sql: request.statement.text,
|
|
79
|
+
parameterCount: request.statement.parameters.length,
|
|
80
|
+
metadata,
|
|
81
|
+
parentId
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function startTransactionOperation(observation, metadata) {
|
|
85
|
+
return startOperation(observation, {
|
|
86
|
+
kind: "transaction",
|
|
87
|
+
metadata,
|
|
88
|
+
parentId: void 0
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function startOperation(observation, input) {
|
|
92
|
+
if (observation === void 0) return;
|
|
93
|
+
const startedAt = monotonicTime();
|
|
94
|
+
const operation = Object.freeze({
|
|
95
|
+
id: observation.nextOperationId++,
|
|
96
|
+
...input.parentId === void 0 ? {} : { parentId: input.parentId },
|
|
97
|
+
kind: input.kind,
|
|
98
|
+
startedAt,
|
|
99
|
+
...input.metadata === void 0 ? {} : { metadata: freezeMetadata(input.metadata) },
|
|
100
|
+
...input.kind === "transaction" ? {} : {
|
|
101
|
+
queryKind: input.queryKind,
|
|
102
|
+
dialect: input.dialect,
|
|
103
|
+
sql: input.sql,
|
|
104
|
+
parameterCount: input.parameterCount
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
let endHook;
|
|
108
|
+
try {
|
|
109
|
+
endHook = observation.hooks.onOperationStart?.(operation) ?? void 0;
|
|
110
|
+
} catch (error) {
|
|
111
|
+
reportHookError(observation.hooks, error);
|
|
112
|
+
}
|
|
113
|
+
let finished = false;
|
|
114
|
+
return {
|
|
115
|
+
operation,
|
|
116
|
+
finish(completion) {
|
|
117
|
+
if (finished) return;
|
|
118
|
+
finished = true;
|
|
119
|
+
if (endHook === void 0) return;
|
|
120
|
+
const outcome = Object.freeze({
|
|
121
|
+
...completion,
|
|
122
|
+
durationMs: monotonicTime() - startedAt
|
|
123
|
+
});
|
|
124
|
+
try {
|
|
125
|
+
endHook(outcome);
|
|
126
|
+
} catch (error) {
|
|
127
|
+
reportHookError(observation.hooks, error);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function reportHookError(hooks, error) {
|
|
133
|
+
try {
|
|
134
|
+
hooks.onHookError?.(error);
|
|
135
|
+
} catch {}
|
|
136
|
+
}
|
|
137
|
+
function freezeMetadata(metadata) {
|
|
138
|
+
return Object.freeze({ ...metadata });
|
|
139
|
+
}
|
|
140
|
+
function monotonicTime() {
|
|
141
|
+
return performance.now();
|
|
142
|
+
}
|
|
143
|
+
function adapterTransactionOptions(options) {
|
|
144
|
+
if (options?.hookMetadata === void 0) return options;
|
|
145
|
+
const { hookMetadata: _hookMetadata, ...adapterOptions } = options;
|
|
146
|
+
return adapterOptions;
|
|
147
|
+
}
|
|
54
148
|
function execute(first, second, options = {}) {
|
|
55
149
|
return executeInternal(first, second, options);
|
|
56
150
|
}
|
|
57
151
|
async function executeRows(first, second, options = {}) {
|
|
58
|
-
return (
|
|
152
|
+
return executeRowsInternal(first, second, options);
|
|
59
153
|
}
|
|
60
154
|
async function explain(first, second, options = {}) {
|
|
61
|
-
|
|
62
|
-
const adapter = isQuery(first) ? second : first;
|
|
63
|
-
return adapter.explain(createExplainRequest(query, adapter, options));
|
|
155
|
+
return explainInternal(isQuery(first) ? first : second, isQuery(first) ? second : first, options);
|
|
64
156
|
}
|
|
65
157
|
function stream(first, second, options = {}) {
|
|
158
|
+
return streamInternal(isQuery(first) ? first : second, isQuery(first) ? second : first, options);
|
|
159
|
+
}
|
|
160
|
+
async function executeInternal(first, second, options, observation, parentId) {
|
|
66
161
|
const query = isQuery(first) ? first : second;
|
|
67
162
|
const adapter = isQuery(first) ? second : first;
|
|
68
|
-
assertStreamableQuery(query);
|
|
69
163
|
const request = createExecutionRequest(query, adapter, options);
|
|
70
164
|
const dialect = options.dialect ?? adapter.dialect;
|
|
71
|
-
|
|
165
|
+
const active = startQueryOperation(observation, "execute", request, dialect, options.hookMetadata, parentId);
|
|
166
|
+
try {
|
|
167
|
+
const result = await adapter.execute(request);
|
|
168
|
+
const decoded = {
|
|
169
|
+
...result,
|
|
170
|
+
rows: result.rows.map((row, rowIndex) => decodeResultRow(row, request.resultShape, adapter.decoders, dialect, rowIndex))
|
|
171
|
+
};
|
|
172
|
+
active?.finish({
|
|
173
|
+
status: "success",
|
|
174
|
+
rowCount: decoded.rows.length,
|
|
175
|
+
...decoded.affectedRows === void 0 ? {} : { affectedRows: decoded.affectedRows },
|
|
176
|
+
...decoded.changedRows === void 0 ? {} : { changedRows: decoded.changedRows },
|
|
177
|
+
...decoded.insertId === void 0 ? {} : { hasInsertId: true }
|
|
178
|
+
});
|
|
179
|
+
return decoded;
|
|
180
|
+
} catch (error) {
|
|
181
|
+
active?.finish({
|
|
182
|
+
status: "error",
|
|
183
|
+
error
|
|
184
|
+
});
|
|
185
|
+
throw error;
|
|
186
|
+
}
|
|
72
187
|
}
|
|
73
|
-
async function
|
|
74
|
-
|
|
75
|
-
|
|
188
|
+
async function executeRowsInternal(first, second, options, observation, parentId) {
|
|
189
|
+
return (await executeInternal(first, second, options, observation, parentId)).rows;
|
|
190
|
+
}
|
|
191
|
+
async function explainInternal(query, adapter, options, observation, parentId) {
|
|
192
|
+
const request = createExplainRequest(query, adapter, options);
|
|
193
|
+
const active = startQueryOperation(observation, "explain", request, options.dialect ?? adapter.dialect, options.hookMetadata, parentId);
|
|
194
|
+
try {
|
|
195
|
+
const result = await adapter.explain(request);
|
|
196
|
+
active?.finish({
|
|
197
|
+
status: "success",
|
|
198
|
+
rowCount: result.rows.length
|
|
199
|
+
});
|
|
200
|
+
return result;
|
|
201
|
+
} catch (error) {
|
|
202
|
+
active?.finish({
|
|
203
|
+
status: "error",
|
|
204
|
+
error
|
|
205
|
+
});
|
|
206
|
+
throw error;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function streamInternal(query, adapter, options, observation, parentId) {
|
|
210
|
+
assertStreamableQuery(query);
|
|
76
211
|
const request = createExecutionRequest(query, adapter, options);
|
|
77
|
-
const result = await adapter.execute(request);
|
|
78
212
|
const dialect = options.dialect ?? adapter.dialect;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
213
|
+
const active = startQueryOperation(observation, "stream", request, dialect, options.hookMetadata, parentId);
|
|
214
|
+
try {
|
|
215
|
+
return decodeResultStream(adapter.stream(request), request, adapter, dialect, active);
|
|
216
|
+
} catch (error) {
|
|
217
|
+
active?.finish({
|
|
218
|
+
status: "error",
|
|
219
|
+
error
|
|
220
|
+
});
|
|
221
|
+
throw error;
|
|
222
|
+
}
|
|
83
223
|
}
|
|
84
224
|
function createExecutionRequest(query, adapter, options) {
|
|
85
225
|
const statement = render(query, { dialect: options.dialect ?? adapter.dialect });
|
|
@@ -90,9 +230,32 @@ function createExecutionRequest(query, adapter, options) {
|
|
|
90
230
|
...options.signal === void 0 ? {} : { signal: options.signal }
|
|
91
231
|
});
|
|
92
232
|
}
|
|
93
|
-
async function* decodeResultStream(rows, request, adapter, dialect) {
|
|
233
|
+
async function* decodeResultStream(rows, request, adapter, dialect, active) {
|
|
94
234
|
let rowIndex = 0;
|
|
95
|
-
|
|
235
|
+
let completed = false;
|
|
236
|
+
let failed = false;
|
|
237
|
+
try {
|
|
238
|
+
for await (const row of rows) yield decodeResultRow(row, request.resultShape, adapter.decoders, dialect, rowIndex++);
|
|
239
|
+
completed = true;
|
|
240
|
+
active?.finish({
|
|
241
|
+
status: "success",
|
|
242
|
+
rowCount: rowIndex,
|
|
243
|
+
streamEnd: "complete"
|
|
244
|
+
});
|
|
245
|
+
} catch (error) {
|
|
246
|
+
failed = true;
|
|
247
|
+
active?.finish({
|
|
248
|
+
status: "error",
|
|
249
|
+
error
|
|
250
|
+
});
|
|
251
|
+
throw error;
|
|
252
|
+
} finally {
|
|
253
|
+
if (!completed && !failed) active?.finish({
|
|
254
|
+
status: "success",
|
|
255
|
+
rowCount: rowIndex,
|
|
256
|
+
streamEnd: "consumer-return"
|
|
257
|
+
});
|
|
258
|
+
}
|
|
96
259
|
}
|
|
97
260
|
function createExplainRequest(query, adapter, options) {
|
|
98
261
|
const request = createExecutionRequest(query, adapter, options);
|
|
@@ -112,7 +275,7 @@ function createExplainRequest(query, adapter, options) {
|
|
|
112
275
|
hint: "Use PostgreSQL, SQLite, MySQL, or a custom dialect with an explain policy."
|
|
113
276
|
});
|
|
114
277
|
const statement = Object.freeze({
|
|
115
|
-
text: dialect.explain.render(request.statement.text, query.queryKind, options),
|
|
278
|
+
text: dialect.explain.render(request.statement.text, query.queryKind, explainRenderOptions(options)),
|
|
116
279
|
parameters: request.statement.parameters
|
|
117
280
|
});
|
|
118
281
|
return Object.freeze({
|
|
@@ -120,6 +283,11 @@ function createExplainRequest(query, adapter, options) {
|
|
|
120
283
|
statement
|
|
121
284
|
});
|
|
122
285
|
}
|
|
286
|
+
function explainRenderOptions(options) {
|
|
287
|
+
if (options.hookMetadata === void 0) return options;
|
|
288
|
+
const { hookMetadata: _hookMetadata, ...renderOptions } = options;
|
|
289
|
+
return renderOptions;
|
|
290
|
+
}
|
|
123
291
|
function assertStreamableQuery(query) {
|
|
124
292
|
if (query.queryKind === "select" || query.queryKind === "set") return;
|
|
125
293
|
throw queryValidationError({
|
|
@@ -1057,7 +1225,9 @@ function insertInto(table, source, ...clauses) {
|
|
|
1057
1225
|
context.render(table.reference);
|
|
1058
1226
|
if (source.insertKind === "values") {
|
|
1059
1227
|
const rows = source.rows;
|
|
1060
|
-
const
|
|
1228
|
+
const explicitColumns = Object.keys(rows[0] ?? {});
|
|
1229
|
+
const runtimeDefaultColumns = Object.entries(table.definitions).filter(([columnName, definition]) => !explicitColumns.includes(columnName) && definition.defaultFn !== void 0).map(([columnName]) => columnName);
|
|
1230
|
+
const columns = [...explicitColumns, ...runtimeDefaultColumns];
|
|
1061
1231
|
if (columns.length === 0) context.append(" DEFAULT VALUES");
|
|
1062
1232
|
else {
|
|
1063
1233
|
renderTargetColumns(context, table, columns);
|
|
@@ -1067,13 +1237,25 @@ function insertInto(table, source, ...clauses) {
|
|
|
1067
1237
|
context.append("(");
|
|
1068
1238
|
columns.forEach((columnName, columnIndex) => {
|
|
1069
1239
|
if (columnIndex > 0) context.append(", ");
|
|
1070
|
-
|
|
1240
|
+
const definition = table.definitions[columnName];
|
|
1241
|
+
renderInsertValue(context, Object.hasOwn(row, columnName) ? row[columnName] : definition.defaultFn?.(), definition);
|
|
1071
1242
|
});
|
|
1072
1243
|
context.append(")");
|
|
1073
1244
|
});
|
|
1074
1245
|
}
|
|
1075
|
-
} else if (source.insertKind === "default-values")
|
|
1076
|
-
|
|
1246
|
+
} else if (source.insertKind === "default-values") {
|
|
1247
|
+
const runtimeDefaults = Object.entries(table.definitions).filter(([, definition]) => definition.defaultFn !== void 0);
|
|
1248
|
+
if (runtimeDefaults.length === 0) context.append(" DEFAULT VALUES");
|
|
1249
|
+
else {
|
|
1250
|
+
renderTargetColumns(context, table, runtimeDefaults.map(([columnName]) => columnName));
|
|
1251
|
+
context.append(" VALUES (");
|
|
1252
|
+
runtimeDefaults.forEach(([, definition], index) => {
|
|
1253
|
+
if (index > 0) context.append(", ");
|
|
1254
|
+
renderInsertValue(context, definition.defaultFn?.(), definition);
|
|
1255
|
+
});
|
|
1256
|
+
context.append(")");
|
|
1257
|
+
}
|
|
1258
|
+
} else {
|
|
1077
1259
|
renderTargetColumns(context, table, source.columns);
|
|
1078
1260
|
context.append(" ");
|
|
1079
1261
|
context.renderRelation(source.query);
|
|
@@ -1092,9 +1274,9 @@ function renderTargetColumns(context, table, columns) {
|
|
|
1092
1274
|
});
|
|
1093
1275
|
context.append(")");
|
|
1094
1276
|
}
|
|
1095
|
-
function renderInsertValue(context, input) {
|
|
1277
|
+
function renderInsertValue(context, input, definition) {
|
|
1096
1278
|
if (isExpression(input)) context.render(input);
|
|
1097
|
-
else context.parameter(input);
|
|
1279
|
+
else context.parameter(encodeColumnParameter(definition, input));
|
|
1098
1280
|
}
|
|
1099
1281
|
function validateInsert(table, source) {
|
|
1100
1282
|
const definitions = table.definitions;
|
|
@@ -1128,7 +1310,7 @@ function validateInsert(table, source) {
|
|
|
1128
1310
|
});
|
|
1129
1311
|
}
|
|
1130
1312
|
for (const [columnName, definition] of Object.entries(definitions)) {
|
|
1131
|
-
if (definition.generated || definition.hasDefault) continue;
|
|
1313
|
+
if (definition.generated || definition.hasDefault || definition.hasRuntimeDefault) continue;
|
|
1132
1314
|
if (!firstSet.has(columnName)) throw queryValidationError({
|
|
1133
1315
|
code: "invalid-insert",
|
|
1134
1316
|
context: "insert.values.columns",
|
|
@@ -1138,7 +1320,7 @@ function validateInsert(table, source) {
|
|
|
1138
1320
|
});
|
|
1139
1321
|
}
|
|
1140
1322
|
} else if (source.insertKind === "default-values") {
|
|
1141
|
-
for (const [columnName, definition] of Object.entries(definitions)) if (!definition.generated && !definition.hasDefault) throw queryValidationError({
|
|
1323
|
+
for (const [columnName, definition] of Object.entries(definitions)) if (!definition.generated && !definition.hasDefault && !definition.hasRuntimeDefault) throw queryValidationError({
|
|
1142
1324
|
code: "invalid-insert",
|
|
1143
1325
|
context: "insert.default-values",
|
|
1144
1326
|
path: ["defaultValues", columnName],
|
|
@@ -1222,7 +1404,7 @@ function update(table, assignments, ...clauses) {
|
|
|
1222
1404
|
if (index > 0) context.append(", ");
|
|
1223
1405
|
context.render(identifier(table.sqlNames[columnName] ?? columnName));
|
|
1224
1406
|
context.append(" = ");
|
|
1225
|
-
renderAssignmentValue(context, value);
|
|
1407
|
+
renderAssignmentValue(context, value, table.definitions[columnName]);
|
|
1226
1408
|
});
|
|
1227
1409
|
if (whereClause) {
|
|
1228
1410
|
context.append(" ");
|
|
@@ -1234,9 +1416,9 @@ function update(table, assignments, ...clauses) {
|
|
|
1234
1416
|
}
|
|
1235
1417
|
});
|
|
1236
1418
|
}
|
|
1237
|
-
function renderAssignmentValue(context, value) {
|
|
1419
|
+
function renderAssignmentValue(context, value, definition) {
|
|
1238
1420
|
if (isExpression(value)) context.render(value);
|
|
1239
|
-
else context.parameter(value);
|
|
1421
|
+
else context.parameter(encodeColumnParameter(definition, value));
|
|
1240
1422
|
}
|
|
1241
1423
|
function validateUpdate(table, assignments) {
|
|
1242
1424
|
const definitions = table.definitions;
|
package/dist/introspection.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as CatalogTrigger, A as CatalogNamespace, At as CatalogQuery, B as CatalogPrimaryKeyConstraint, C as CatalogForeignKeyTarget, Ct as IntrospectionDiagnosticCode, D as CatalogIndexTerm, Dt as createIntrospectionDiagnostic, E as CatalogIndex, Et as IntrospectionError, F as CatalogOpaqueObject, G as CatalogRoutine, H as CatalogProvenanceKind, I as CatalogOwnership, J as CatalogSequence, K as CatalogRoutineParameter, L as CatalogPartition, M as CatalogObjectBase, N as CatalogObjectMetadata, O as CatalogIntrospector, Ot as hasIntrospectionErrors, P as CatalogObjectReference, Q as CatalogTable, R as CatalogPolicy, S as CatalogForeignKeyConstraint, St as IntrospectionDiagnostic, T as CatalogIdentity, Tt as IntrospectionDiagnosticSeverity, U as CatalogQueryRow, V as CatalogProvenance, W as CatalogReference, X as CatalogSqlExpression, Y as CatalogServerInfo, Z as CatalogStorageType, _ as CatalogEntityReference, _t as CatalogIdentityPolicy, a as CatalogCollation, at as CatalogView, b as CatalogExpressionFact, bt as CatalogResolvedIdentity, c as CatalogCompleteObject, ct as IntrospectionFailure, d as CatalogDeferredObject, dt as IntrospectionResult, et as CatalogUniqueConstraint, f as CatalogDeferredObjectKind, ft as IntrospectionSuccess, g as CatalogEntityKind, gt as CatalogIdentityHints, h as CatalogDomain, ht as CatalogIdentityHint, i as CatalogClassificationConfidence, it as CatalogVersion, j as CatalogObject, jt as CatalogQueryOptions, k as CatalogLiteralFact, kt as CatalogConnection, l as CatalogConstraint, lt as IntrospectionMode, m as CatalogDialectExtension, mt as CatalogIdentityFallback, n as CatalogCatalogReference, nt as CatalogUnknownObject, o as CatalogColumn, ot as CompleteIntrospectionCatalog, p as CatalogDialect, pt as CatalogIdentityEntityKind, q as CatalogScalar, r as CatalogCheckConstraint, rt as CatalogValueFact, s as CatalogComment, st as IntrospectionCatalog, t as CatalogCapabilities, tt as CatalogUnknownField, u as CatalogData, ut as IntrospectionOptions, v as CatalogEnum, vt as CatalogIdentitySource, w as CatalogGeneratedColumn, wt as IntrospectionDiagnosticInput, x as CatalogExtensionObject, xt as introspectedPhysicalIdentityPolicy, y as CatalogEnumValue, yt as CatalogPreviousSnapshotIdentitySource, z as CatalogPortableStorageType } from "./types-
|
|
2
|
-
import { t as CompleteSchemaSnapshot } from "./complete-types-
|
|
1
|
+
import { $ as CatalogTrigger, A as CatalogNamespace, At as CatalogQuery, B as CatalogPrimaryKeyConstraint, C as CatalogForeignKeyTarget, Ct as IntrospectionDiagnosticCode, D as CatalogIndexTerm, Dt as createIntrospectionDiagnostic, E as CatalogIndex, Et as IntrospectionError, F as CatalogOpaqueObject, G as CatalogRoutine, H as CatalogProvenanceKind, I as CatalogOwnership, J as CatalogSequence, K as CatalogRoutineParameter, L as CatalogPartition, M as CatalogObjectBase, N as CatalogObjectMetadata, O as CatalogIntrospector, Ot as hasIntrospectionErrors, P as CatalogObjectReference, Q as CatalogTable, R as CatalogPolicy, S as CatalogForeignKeyConstraint, St as IntrospectionDiagnostic, T as CatalogIdentity, Tt as IntrospectionDiagnosticSeverity, U as CatalogQueryRow, V as CatalogProvenance, W as CatalogReference, X as CatalogSqlExpression, Y as CatalogServerInfo, Z as CatalogStorageType, _ as CatalogEntityReference, _t as CatalogIdentityPolicy, a as CatalogCollation, at as CatalogView, b as CatalogExpressionFact, bt as CatalogResolvedIdentity, c as CatalogCompleteObject, ct as IntrospectionFailure, d as CatalogDeferredObject, dt as IntrospectionResult, et as CatalogUniqueConstraint, f as CatalogDeferredObjectKind, ft as IntrospectionSuccess, g as CatalogEntityKind, gt as CatalogIdentityHints, h as CatalogDomain, ht as CatalogIdentityHint, i as CatalogClassificationConfidence, it as CatalogVersion, j as CatalogObject, jt as CatalogQueryOptions, k as CatalogLiteralFact, kt as CatalogConnection, l as CatalogConstraint, lt as IntrospectionMode, m as CatalogDialectExtension, mt as CatalogIdentityFallback, n as CatalogCatalogReference, nt as CatalogUnknownObject, o as CatalogColumn, ot as CompleteIntrospectionCatalog, p as CatalogDialect, pt as CatalogIdentityEntityKind, q as CatalogScalar, r as CatalogCheckConstraint, rt as CatalogValueFact, s as CatalogComment, st as IntrospectionCatalog, t as CatalogCapabilities, tt as CatalogUnknownField, u as CatalogData, ut as IntrospectionOptions, v as CatalogEnum, vt as CatalogIdentitySource, w as CatalogGeneratedColumn, wt as IntrospectionDiagnosticInput, x as CatalogExtensionObject, xt as introspectedPhysicalIdentityPolicy, y as CatalogEnumValue, yt as CatalogPreviousSnapshotIdentitySource, z as CatalogPortableStorageType } from "./types-CTCqtFlS.mjs";
|
|
2
|
+
import { t as CompleteSchemaSnapshot } from "./complete-types-CY0KbzNw.mjs";
|
|
3
3
|
//#region src/introspection/catalog.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Materialize every optional object-family collection and deeply freeze the normalized catalog.
|
package/dist/introspection.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as toSnapshotJsonValue } from "./canonical-BXUguqfo.mjs";
|
|
2
|
-
import { a as hasIntrospectionErrors, i as createIntrospectionDiagnostic, n as introspectedPhysicalIdentityPolicy, r as IntrospectionError, t as mapCatalogToSnapshot } from "./snapshot-
|
|
2
|
+
import { a as hasIntrospectionErrors, i as createIntrospectionDiagnostic, n as introspectedPhysicalIdentityPolicy, r as IntrospectionError, t as mapCatalogToSnapshot } from "./snapshot-tkKoCd-F.mjs";
|
|
3
3
|
import { n as assertCompleteSchemaSnapshot } from "./complete-WYyVozgK.mjs";
|
|
4
4
|
import "./snapshot.mjs";
|
|
5
5
|
//#region src/introspection/catalog.ts
|
package/dist/migration.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as SnapshotJsonValue, m as SnapshotDialect } from "./types-
|
|
2
|
-
import { S as SnapshotDiffPath, _ as SnapshotDiffObjectKind, b as SnapshotDiffOperationType, f as SnapshotDiffDiagnostic, g as SnapshotDiffObject, m as SnapshotDiffEvidence, u as SnapshotDiff } from "./index-
|
|
1
|
+
import { T as SnapshotJsonValue, m as SnapshotDialect } from "./types-C0VkiwpR.mjs";
|
|
2
|
+
import { S as SnapshotDiffPath, _ as SnapshotDiffObjectKind, b as SnapshotDiffOperationType, f as SnapshotDiffDiagnostic, g as SnapshotDiffObject, m as SnapshotDiffEvidence, u as SnapshotDiff } from "./index-C_BQNvbT.mjs";
|
|
3
3
|
//#region src/migration/types.d.ts
|
|
4
4
|
/** The versioned envelope tag for dialect-neutral migration plans. */
|
|
5
5
|
declare const migrationPlanFormat: "qubu-migration-plan";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as isUnsafeSchemaSql, m as validateConstraintDialect, w as validateIndexDialect, y as renderSchemaExpression } from "./registry-
|
|
1
|
+
import { F as isValidSchemaObjectName, r as isColumnReference } from "./column-DmazTL67.mjs";
|
|
2
|
+
import { _ as isUnsafeSchemaSql, m as validateConstraintDialect, w as validateIndexDialect, y as renderSchemaExpression } from "./registry-BGqa05et.mjs";
|
|
3
3
|
import { t as createSchemaDialect } from "./dialect-wUKrnPMB.mjs";
|
|
4
4
|
import { a as toSnapshotJsonValue } from "./canonical-BXUguqfo.mjs";
|
|
5
|
-
import { c as createSchemaSnapshot, p as tryCreateSchemaSnapshot } from "./sqlite-
|
|
5
|
+
import { c as createSchemaSnapshot, p as tryCreateSchemaSnapshot } from "./sqlite-mPVdrKrk.mjs";
|
|
6
6
|
import { postgresDialect } from "./postgres.mjs";
|
|
7
7
|
import { mysqlDialect } from "./mysql.mjs";
|
|
8
8
|
//#region src/snapshot/postgres.ts
|
package/dist/mysql.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as Dialect } from "./types-
|
|
1
|
+
import { V as Dialect } from "./types-C0VkiwpR.mjs";
|
|
2
2
|
//#region src/dialects/mysql.d.ts
|
|
3
|
-
declare function mysqlDialect(): Dialect<"
|
|
3
|
+
declare function mysqlDialect(): Dialect<"json" | "row-locking">;
|
|
4
4
|
//#endregion
|
|
5
5
|
export { mysqlDialect };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as assertDialectCapability } from "./json-Db7XRD91.mjs";
|
|
2
2
|
import { n as queryValidationError } from "./errors-Dxv73YJu.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { B as isExpression, f as encodeColumnParameter, i as identifier, q as fragment, t as createColumnReference, u as columnResultValue } from "./column-DmazTL67.mjs";
|
|
4
4
|
import { t as omit } from "./omit-OxV58AwX.mjs";
|
|
5
|
-
import { r as exposeColumns, t as createSource } from "./source-
|
|
5
|
+
import { r as exposeColumns, t as createSource } from "./source-C4Vmu5bb.mjs";
|
|
6
6
|
//#region src/query/mutation/on-conflict.ts
|
|
7
7
|
/** Columns from the proposed INSERT row, available inside DO UPDATE. */
|
|
8
8
|
function excluded(table) {
|
|
@@ -57,7 +57,10 @@ function onConflict(...args) {
|
|
|
57
57
|
context.render(identifier(table?.sqlNames[columnName] ?? columnName));
|
|
58
58
|
context.append(" = ");
|
|
59
59
|
if (isExpression(value)) context.render(value);
|
|
60
|
-
else
|
|
60
|
+
else {
|
|
61
|
+
const definition = table?.definitions[columnName];
|
|
62
|
+
context.parameter(definition === void 0 ? value : encodeColumnParameter(definition, value));
|
|
63
|
+
}
|
|
61
64
|
});
|
|
62
65
|
if (action.where !== void 0) {
|
|
63
66
|
context.append(" ");
|
package/dist/postgres.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Do as SqlCapabilityValidation, Eo as OperandSqlType, Fl as SchemaExpression, Ku as SqlBoolean, Ou as RequiresCapabilityMeta, Pl as ExpressionWithOutput, Pu as ResultMeta, To as OperandNullability, Uu as AnySqlType, V as Dialect, _n as doNothing, _u as MetadataOf, bn as onConflict, dn as ConflictAction, fn as ConflictTarget, gn as OnConflictClause, hn as ExcludedSource, id as SqlTextLike, mn as DoUpdateAction, ou as ExpressionMeta, pn as DoNothingAction, sd as SqlUnknown, so as ComparisonValidation, vn as doUpdate, wo as Operand, yn as excluded } from "./types-C0VkiwpR.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<"on-conflict" | "json" | "ilike" | "row-locking">;
|
|
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";
|
package/dist/postgres.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as postgresJson, o as createDialect } from "./json-Db7XRD91.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { t as comparison } from "./relational-
|
|
2
|
+
import { K as withDialectCapability } from "./column-DmazTL67.mjs";
|
|
3
|
+
import { t as comparison } from "./relational-x3BDVX9e.mjs";
|
|
4
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-
|
|
5
|
+
import { i as onConflict, n as doUpdate, r as excluded, t as doNothing } from "./on-conflict-jPsl9l0K.mjs";
|
|
6
6
|
//#region src/dialects/postgres.ts
|
|
7
7
|
const postgresRowLockModeSql = {
|
|
8
8
|
update: "UPDATE",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as standardDialect } from "./standard-DfcZEVOj.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { n as isValueExpression } from "./value-
|
|
2
|
+
import { G as markSchemaExpression, M as dialectMismatchDiagnostic, N as freezeSchemaMetadata, U as makeSchemaExpression, V as isSchemaExpression, r as isColumnReference, z as snakeCaseIdentifier } from "./column-DmazTL67.mjs";
|
|
3
|
+
import { n as isValueExpression } from "./value-BEEj_Ayd.mjs";
|
|
4
4
|
//#region src/schema/indexes.ts
|
|
5
5
|
/**
|
|
6
6
|
* Validate portable and dialect-owned index facts for one target adapter. Unsupported features are
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as queryValidationError } from "./errors-Dxv73YJu.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { n as isValueExpression, t as asValue } from "./value-
|
|
2
|
+
import { U as makeSchemaExpression, it as resultValue } from "./column-DmazTL67.mjs";
|
|
3
|
+
import { n as isValueExpression, t as asValue } from "./value-BEEj_Ayd.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 { $i as SourceIndexesRecord, $o as
|
|
2
|
-
export { AliasIdentity, AliasedSource, AnyKeyColumn, AnySource, AnyTable, CanonicalLiteral, CatalogCheckExpression, CatalogCheckSql, CheckConstraint, CheckConstraintOptions, ColumnBehaviorError, ColumnBehaviorErrorCode, ColumnDefault, ColumnDefaultInput, ColumnDefaultOf, ColumnDefinition, ColumnDefinitionConfig, ColumnFromOptions, ColumnGeneratedOf, ColumnHasDefault, 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, 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 { $i as SourceIndexesRecord, $o as ColumnStorageDialectOf, $r as generatedTableName, $s as ResolvedColumnBehavior, Ai as catalogCheck, Ar as SchemaExpressionErrorCode, As as numeric, At as SourceSqlTypeMap, Bi as AliasedSource, Bo as ColumnHasDefault, Br as renderSchemaSql, Bs as DefaultDescriptor, Bt as TableDefinitions, Ci as SourceConstraintsRecord, Cs as date, Ct as SourceColumns, Di as UniqueConstraint, Dr as createSchemaDialect, Ds as nativeColumn, Dt as SourceKind, Ei as TableLike, Er as SchemaDialectHooks, Es as json, Et as SourceIdentity, Fi as references, Fo as ColumnDefaultOf, Fr as UnsafeSchemaSqlExpression, Fs as CanonicalLiteral, Ft as exposeColumns, Gi as alias, Go as ColumnIsNullable, Gr as SchemaNamingPolicy, Gs as GeneratedColumnDescriptor, Gt as TableRow, Hi as LateralSource, Ho as ColumnIdentityOf, Hr as unsafeSchemaSql, Hs as ExpressionGeneratedColumnDescriptor, Ht as TableInsertInput, Ii as unique, Io as ColumnDefinition, Ir as defineSchemaExpression, Is as ColumnBehaviorError, It as sourceIdentity, Ji as IndexOptions, Jo as ColumnOutput, Jr as SchemaTableNames, Js as IdentityDescriptor, Jt as table, Ki as lateral, Ko as ColumnOnUpdateOf, Kr as SchemaOptions, Ks as GeneratedColumnMode, Kt as TableSqlTypes, Li as uniqueConstraint, Lo as ColumnDefinitionConfig, Lr as isUnsafeSchemaSql, Ls as ColumnBehaviorErrorCode, Lt as AnyTable, Mi as check, Mr as SchemaExpressionMode, Ms as text, Mt as UnknownSourceSqlTypes, Ni as foreignKey, Nr as SchemaRenderContext, Ns as timestamp, Nt as createSource, Oi as UniqueConstraintOptions, Or as RenderedSchemaExpression, Os as nativeStorage, Ot as SourceProvision, Pi as primaryKey, Po as ColumnCodec, Pr as SchemaRenderOptions, Ps as uuid, Pt as customSource, Qi as SourceIndex, Qo as ColumnStorageDescriptor, Qr as defaultSchemaNamingPolicy, Qs as MysqlIdentityExtension, Ri as validateConstraintDialect, Ro as ColumnFromOptions, Rr as normalizeSchemaSql, Rs as ColumnDefault, Rt as Table, Si as SourceConstraint, Ss as columnResultValue, St as Source, Ti as SqliteConstraintExtension, Tr as SchemaDialect, Ts as integer, Tt as SourceConstraints, Ui as QueryAliasIdentity, Uo as ColumnInsertInput, Ur as Schema, Us as ExternalDefaultDescriptor, Ut as TableMetadataCallback, Vi as LateralIdentity, Vo as ColumnHasRuntimeDefault, Vr as schemaExpression, Vs as ExpressionDefaultDescriptor, Vt as TableIdentity, Wi as QuerySource, Wo as ColumnIsGenerated, Wr as SchemaDiagnostic, Ws as ExternalGeneratedColumnDescriptor, Wt as TableOptions, Xi as MysqlIndexExtension, Xo as ColumnStorage, Xr as SchemaTableRegistry, Xs as IdentityGeneration, Yi as IndexTerm, Yo as ColumnSqlType, Yr as SchemaTableRecord, Ys as IdentityDialectExtension, Zi as PostgresIndexExtension, Zo as ColumnStorageDeclarationOf, Zr as SchemaValidationError, Zs as LiteralDefaultDescriptor, _c as generatedSchemaObjectName, _i as KeyConstraint, _s as StorageTypeOf, _t as AnySource, ac as generatedColumn, ai as CheckConstraint, as as DialectNativeStorage, bc as materializeSchemaObjectRecord, bi as PostgresConstraintExtension, bs as boolean, bt as ProvidedSourceIdentity, cc as SchemaDialectExtension, ci as ConstraintOptions, cs as NativeStorageDescriptor, dc as SchemaMetadataValidationError, di as FieldLikeOptions, ds as PortableStorageDescriptor, ea as SqliteIndexExtension, ec as SchemaLiteralValue, ei as schema, es as ColumnStorageKindOf, fc as SchemaObjectIdentity, fi as ForeignKeyConstraint, fs as PortableStorageType, gc as freezeSchemaMetadata, gi as ForeignKeyTargetInput, gs as StorageOf, hc as dialectMismatchDiagnostic, hi as ForeignKeyTarget, hs as StorageDialectOf, ia as DeclaredColumnNullability, ic as externalGeneratedColumn, ii as CatalogCheckSql, is as ColumnUpdateInput, ji as catalogForeignKey, jr as SchemaExpressionInput, js as portableStorage, jt as SourceSqlTypes, ki as UniqueNullSemantics, kr as SchemaExpressionError, ks as nullable, kt as SourceRow, lc as SchemaDialectName, li as ConstraintTiming, ls as PortableColumnStorage, mc as assertSchemaDialectSupport, mi as ForeignKeyOptions, ms as StorageDescriptor, na as index, nc as canonicalLiteral, ni as AnyKeyColumn, ns as ColumnStorageType, oc as identityColumn, oi as CheckConstraintOptions, os as NativeColumnStorage, pc as SchemaObjectNameOptions, pi as ForeignKeyMatch, ps as StorageDeclarationOf, qi as IndexDialectExtension, qo as ColumnOptions, qr as SchemaTableEntry, qs as GeneratedDescriptor, qt as TableUpdateInput, ra as validateIndexDialect, rc as externalDefault, ri as CatalogCheckExpression, rs as ColumnStorageTypeOf, sc as resolveColumnBehavior, si as ConstraintDialectExtension, ss as NativeStorage, ta as TableIndex, tc as SqliteIdentityExtension, ti as schemaNamingPolicyVersion, ts as ColumnStorageOf, uc as SchemaMetadataDiagnostic, ui as FieldLike, us as PortableStorage, vc as isValidSchemaObjectName, vi as KeyConstraintOptions, vs as bigint, vt as CustomSource, wi as SourceLike, ws as encodeColumnParameter, wt as SourceConfig, xi as ReferentialAction, xs as column, xt as ProvidedSourceRow, yc as materializeSchemaObjectIdentity, yi as MysqlConstraintExtension, ys as binary, yt as CustomSourceOptions, zi as AliasIdentity, zo as ColumnGeneratedOf, zr as renderSchemaExpression, zs as ColumnDefaultInput, zt as TableColumns } from "./types-C0VkiwpR.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, 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 };
|
package/dist/schema.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { i as sourceIdentity, n as customSource, r as exposeColumns, t as createSource } from "./source-
|
|
3
|
-
import { n as alias, r as lateral, t as table } from "./table-
|
|
4
|
-
import { C as index, S as unsafeSchemaSql, _ as isUnsafeSchemaSql, a as schemaNamingPolicyVersion, b as renderSchemaSql, c as check, d as references, f as unique, g as defineSchemaExpression, h as SchemaExpressionError, i as schema, l as foreignKey, m as validateConstraintDialect, n as defaultSchemaNamingPolicy, o as catalogCheck, p as uniqueConstraint, r as generatedTableName, s as catalogForeignKey, t as SchemaValidationError, u as primaryKey, v as normalizeSchemaSql, w as validateIndexDialect, x as schemaExpression, y as renderSchemaExpression } from "./registry-
|
|
1
|
+
import { A as SchemaMetadataValidationError, C as ColumnBehaviorError, D as generatedColumn, E as externalGeneratedColumn, F as isValidSchemaObjectName, I as materializeSchemaObjectIdentity, L as materializeSchemaObjectRecord, M as dialectMismatchDiagnostic, N as freezeSchemaMetadata, O as identityColumn, P as generatedSchemaObjectName, S as uuid, T as externalDefault, _ as nullable, b as text, c as boolean, d as date, f as encodeColumnParameter, g as nativeStorage, h as nativeColumn, j as assertSchemaDialectSupport, k as resolveColumnBehavior, l as column, m as json, o as bigint, p as integer, s as binary, u as columnResultValue, v as numeric, w as canonicalLiteral, x as timestamp, y as portableStorage } from "./column-DmazTL67.mjs";
|
|
2
|
+
import { i as sourceIdentity, n as customSource, r as exposeColumns, t as createSource } from "./source-C4Vmu5bb.mjs";
|
|
3
|
+
import { n as alias, r as lateral, t as table } from "./table-DLQ7YWth.mjs";
|
|
4
|
+
import { C as index, S as unsafeSchemaSql, _ as isUnsafeSchemaSql, a as schemaNamingPolicyVersion, b as renderSchemaSql, c as check, d as references, f as unique, g as defineSchemaExpression, h as SchemaExpressionError, i as schema, l as foreignKey, m as validateConstraintDialect, n as defaultSchemaNamingPolicy, o as catalogCheck, p as uniqueConstraint, r as generatedTableName, s as catalogForeignKey, t as SchemaValidationError, u as primaryKey, v as normalizeSchemaSql, w as validateIndexDialect, x as schemaExpression, y as renderSchemaExpression } from "./registry-BGqa05et.mjs";
|
|
5
5
|
import { t as createSchemaDialect } from "./dialect-wUKrnPMB.mjs";
|
|
6
|
-
export { ColumnBehaviorError, SchemaExpressionError, SchemaMetadataValidationError, SchemaValidationError, alias, assertSchemaDialectSupport, bigint, binary, boolean, canonicalLiteral, catalogCheck, catalogForeignKey, check, column, columnResultValue, createSchemaDialect, createSource, customSource, date, defaultSchemaNamingPolicy, defineSchemaExpression, dialectMismatchDiagnostic, 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 };
|
|
6
|
+
export { ColumnBehaviorError, SchemaExpressionError, SchemaMetadataValidationError, SchemaValidationError, 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,5 +1,5 @@
|
|
|
1
1
|
import { s as assertSchemaSnapshot } from "./canonical-BXUguqfo.mjs";
|
|
2
|
-
import { a as sqliteStorageAffinity } from "./sqlite-
|
|
2
|
+
import { a as sqliteStorageAffinity } from "./sqlite-mPVdrKrk.mjs";
|
|
3
3
|
//#region src/introspection/diagnostics.ts
|
|
4
4
|
/**
|
|
5
5
|
* Create one immutable diagnostic without interpreting catalog text or copying driver error details
|