qubu 0.3.5 → 0.4.1
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/{canonical-BbnqavJm.mjs → canonical-BXUguqfo.mjs} +23 -23
- package/dist/codegen.d.mts +25 -33
- package/dist/codegen.mjs +38 -45
- package/dist/column-hqKr7-1I.mjs +620 -0
- package/dist/{complete-D5Djh-zo.mjs → complete-WYyVozgK.mjs} +50 -50
- package/dist/{complete-types-B2PO6wQD.d.mts → complete-types-IjEn5VPN.d.mts} +56 -56
- package/dist/core.d.mts +2 -2
- package/dist/core.mjs +4 -4
- package/dist/ddl.d.mts +12 -12
- package/dist/ddl.mjs +13 -14
- package/dist/{dialect-b2-Z6uBF.mjs → dialect-wUKrnPMB.mjs} +2 -2
- package/dist/diff.d.mts +1 -1
- package/dist/diff.mjs +6 -7
- package/dist/{index-7qc6OcIC.d.mts → index-1DpA3mUh.d.mts} +20 -20
- package/dist/{index-CqWnouTK.d.mts → index-CPvfEheG.d.mts} +13 -15
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +148 -120
- package/dist/introspection.d.mts +8 -8
- package/dist/introspection.mjs +29 -30
- package/dist/{json-CUZlv4HT.mjs → json-Db7XRD91.mjs} +2 -2
- package/dist/migration.d.mts +20 -21
- package/dist/migration.mjs +5 -6
- package/dist/{mysql-DqkqXB6A.mjs → mysql-B_cYzzX2.mjs} +237 -7
- package/dist/mysql.d.mts +1 -1
- package/dist/mysql.mjs +3 -3
- package/dist/{on-conflict-BxnxubMb.mjs → on-conflict-hfPW0KmQ.mjs} +4 -4
- package/dist/postgres.d.mts +5 -5
- package/dist/postgres.mjs +6 -6
- package/dist/{registry-BufIskVN.mjs → registry-BRMLYwDp.mjs} +27 -135
- package/dist/{relational-DCZrrNia.mjs → relational-BZ3WDPzC.mjs} +4 -4
- package/dist/schema.d.mts +2 -2
- package/dist/schema.mjs +6 -6
- package/dist/{snapshot-CWPgzxNx.mjs → snapshot-C-W65HEd.mjs} +5 -5
- package/dist/snapshot.d.mts +3 -3
- package/dist/snapshot.mjs +5 -7
- package/dist/{source-DUoJVXmL.mjs → source-BcS2AsIg.mjs} +7 -9
- package/dist/{serialize-PF1cfH2P.mjs → sqlite-Cg0nwYEH.mjs} +326 -12
- package/dist/sqlite.d.mts +2 -2
- package/dist/sqlite.mjs +2 -2
- package/dist/{standard-BTVYKh_F.mjs → standard-DfcZEVOj.mjs} +1 -1
- package/dist/{table-CCUJ60rB.mjs → table-Bp5irMSj.mjs} +5 -7
- package/dist/{types-D8M1yZF4.d.mts → types-BK1COGZe.d.mts} +2661 -2150
- package/dist/{types-Cec0xzo4.mjs → types-JM3FcAnX.mjs} +8 -8
- package/dist/{types-LBt5rclR.d.mts → types-JSZHpUEj.d.mts} +83 -84
- package/dist/{value-BvilP0oz.mjs → value-Bi71Agyf.mjs} +1 -1
- package/dist/vite/ambient.d.ts +311 -390
- package/dist/vite.d.mts +5 -6
- package/dist/vite.mjs +3 -4
- package/docs/dialects-and-execution.md +121 -81
- package/docs/getting-started.md +4 -4
- package/docs/guides/better-auth.md +57 -0
- package/docs/guides/compose-queries.md +24 -67
- package/docs/guides/drizzle.md +23 -23
- package/docs/guides/extensions/dialects.md +4 -4
- package/docs/guides/extensions/sources-and-clauses.md +15 -15
- package/docs/guides/extensions/typed-expressions.md +13 -17
- package/docs/guides/extensions/unsafe-syntax.md +3 -3
- package/docs/guides/json.md +7 -7
- package/docs/guides/mutations.md +14 -21
- package/docs/guides/select/conditions.md +6 -8
- package/docs/guides/select/grouping-and-windows.md +4 -15
- package/docs/guides/select/ordering-and-pagination.md +6 -19
- package/docs/guides/select/overview.md +12 -26
- package/docs/guides/sql-templates.md +20 -24
- package/docs/guides/vite-plugin.md +9 -13
- package/docs/index.md +5 -7
- package/docs/query-model/fragments.md +4 -15
- package/docs/query-model/result-shapes.md +11 -14
- package/docs/query-model/source-scope.md +31 -49
- package/docs/reference/mysql-snapshot.md +2 -5
- package/docs/reference/postgres-snapshot.md +3 -3
- package/docs/reference/sqlite-snapshot.md +2 -5
- package/docs/reference/supported-surface.md +33 -33
- package/docs/schema/catalog-model.md +2 -5
- package/docs/schema/code-generation.md +18 -18
- package/docs/schema/columns-and-writes.md +17 -25
- package/docs/schema/constraints-and-indexes.md +36 -52
- package/docs/schema/ddl-emission.md +6 -6
- package/docs/schema/diff.md +5 -5
- package/docs/schema/introspection.md +7 -7
- package/docs/schema/migration-plans.md +9 -9
- package/docs/schema/snapshots.md +3 -3
- package/docs/schema/storage-and-schema-sql.md +11 -11
- package/docs/schema/tables-and-names.md +11 -14
- package/docs/sql-semantic-types.md +10 -10
- package/docs/troubleshooting.md +10 -10
- package/package.json +21 -33
- package/skills/qubu/agents/openai.yaml +3 -3
- package/dist/column-CXMxx8Hq.mjs +0 -118
- package/dist/column-CYMbKbOy.mjs +0 -290
- package/dist/drizzle-mysql.d.mts +0 -24
- package/dist/drizzle-mysql.mjs +0 -72
- package/dist/drizzle-postgres.d.mts +0 -24
- package/dist/drizzle-postgres.mjs +0 -73
- package/dist/drizzle-sqlite.d.mts +0 -50
- package/dist/drizzle-sqlite.mjs +0 -108
- package/dist/drizzle.d.mts +0 -13
- package/dist/drizzle.mjs +0 -2
- package/dist/errors-BGCoLe_r.mjs +0 -14
- package/dist/naming-QVCOnSj2.mjs +0 -20
- package/dist/postgres-DEBBeh52.mjs +0 -235
- package/dist/runtime-Cn_Xgzta.mjs +0 -193
- package/dist/sqlite-BU6DBxef.mjs +0 -320
- package/dist/types-Ctlxz1ip.d.mts +0 -45
package/dist/postgres.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as postgresJson, o as createDialect } from "./json-
|
|
2
|
-
import {
|
|
3
|
-
import { t as comparison } from "./relational-
|
|
1
|
+
import { n as postgresJson, o as createDialect } from "./json-Db7XRD91.mjs";
|
|
2
|
+
import { G as withDialectCapability } from "./column-hqKr7-1I.mjs";
|
|
3
|
+
import { t as comparison } from "./relational-BZ3WDPzC.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-hfPW0KmQ.mjs";
|
|
6
6
|
//#region src/dialects/postgres.ts
|
|
7
7
|
const postgresRowLockModeSql = {
|
|
8
8
|
update: "UPDATE",
|
|
@@ -25,8 +25,8 @@ const postgresPagination = { render(context, parts) {
|
|
|
25
25
|
});
|
|
26
26
|
} };
|
|
27
27
|
/**
|
|
28
|
-
* PostgreSQL's only core rendering difference is positional parameters.
|
|
29
|
-
*
|
|
28
|
+
* PostgreSQL's only core rendering difference is positional parameters. PostgreSQL-specific
|
|
29
|
+
* expressions and clauses should remain separate modules.
|
|
30
30
|
*/
|
|
31
31
|
function postgresDialect() {
|
|
32
32
|
return createDialect({
|
|
@@ -1,116 +1,11 @@
|
|
|
1
|
-
import { t as standardDialect } from "./standard-
|
|
2
|
-
import {
|
|
3
|
-
import { n as isValueExpression } from "./value-
|
|
4
|
-
import { n as snakeCaseIdentifier } from "./naming-QVCOnSj2.mjs";
|
|
5
|
-
//#region src/schema/metadata.ts
|
|
6
|
-
/** Error raised when relational metadata cannot be represented safely. */
|
|
7
|
-
var SchemaMetadataValidationError = class extends TypeError {
|
|
8
|
-
name = "SchemaMetadataValidationError";
|
|
9
|
-
diagnostics;
|
|
10
|
-
issues;
|
|
11
|
-
constructor(diagnostics) {
|
|
12
|
-
const frozenDiagnostics = Object.freeze(diagnostics.map((diagnostic) => Object.freeze({
|
|
13
|
-
...diagnostic,
|
|
14
|
-
path: Object.freeze([...diagnostic.path]),
|
|
15
|
-
relatedPaths: diagnostic.relatedPaths ? Object.freeze(diagnostic.relatedPaths.map((path) => Object.freeze([...path]))) : void 0
|
|
16
|
-
})));
|
|
17
|
-
super(frozenDiagnostics.map((diagnostic) => diagnostic.message).join("\n"));
|
|
18
|
-
this.diagnostics = frozenDiagnostics;
|
|
19
|
-
this.issues = frozenDiagnostics;
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
/** Generate the version-one physical name for a relational object ID. */
|
|
23
|
-
function generatedSchemaObjectName(id) {
|
|
24
|
-
return snakeCaseIdentifier(id);
|
|
25
|
-
}
|
|
26
|
-
/** Deep-freeze plain metadata values without introducing executable nodes. */
|
|
27
|
-
function freezeSchemaMetadata(value) {
|
|
28
|
-
if (Array.isArray(value)) return Object.freeze(value.map((item) => freezeSchemaMetadata(item)));
|
|
29
|
-
if (typeof value !== "object" || value === null) return value;
|
|
30
|
-
const frozen = Object.fromEntries(Object.entries(value).map(([key, nested]) => [key, freezeSchemaMetadata(nested)]));
|
|
31
|
-
return Object.freeze(frozen);
|
|
32
|
-
}
|
|
33
|
-
/** Check the portable identifier subset used for generated metadata names. */
|
|
34
|
-
function isValidSchemaObjectName(name) {
|
|
35
|
-
return name.length > 0 && name === name.trim() && !/[.\\/\u0000-\u001f\u007f"']/u.test(name);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Attach a record key and resolved physical name without changing the
|
|
39
|
-
* enumerable shape of legacy constraint/index values. The properties are
|
|
40
|
-
* still ordinary read-only runtime metadata and are available to snapshot
|
|
41
|
-
* traversals.
|
|
42
|
-
*/
|
|
43
|
-
function materializeSchemaObjectIdentity(value, id, physicalName) {
|
|
44
|
-
const materialized = { ...value };
|
|
45
|
-
Object.defineProperties(materialized, {
|
|
46
|
-
id: {
|
|
47
|
-
configurable: false,
|
|
48
|
-
enumerable: false,
|
|
49
|
-
value: id,
|
|
50
|
-
writable: false
|
|
51
|
-
},
|
|
52
|
-
physicalName: {
|
|
53
|
-
configurable: false,
|
|
54
|
-
enumerable: false,
|
|
55
|
-
value: physicalName ?? generatedSchemaObjectName(id),
|
|
56
|
-
writable: false
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
return Object.freeze(materialized);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Resolve and validate names for one metadata record. The caller decides
|
|
63
|
-
* whether constraint and index names share a database namespace.
|
|
64
|
-
*/
|
|
65
|
-
function materializeSchemaObjectRecord(record, kind) {
|
|
66
|
-
const diagnostics = [];
|
|
67
|
-
const names = /* @__PURE__ */ new Map();
|
|
68
|
-
const result = {};
|
|
69
|
-
for (const [id, value] of Object.entries(record)) {
|
|
70
|
-
const physicalName = value.physicalName ?? generatedSchemaObjectName(id);
|
|
71
|
-
const path = [kind === "constraint" ? "constraints" : "indexes", id];
|
|
72
|
-
if (!isValidSchemaObjectName(physicalName)) diagnostics.push({
|
|
73
|
-
code: "invalid-physical-name",
|
|
74
|
-
message: `The ${kind} "${id}" has invalid physical name "${physicalName}"`,
|
|
75
|
-
path: [...path, "physicalName"]
|
|
76
|
-
});
|
|
77
|
-
const previousId = names.get(physicalName);
|
|
78
|
-
if (previousId !== void 0) diagnostics.push({
|
|
79
|
-
code: "duplicate-physical-name",
|
|
80
|
-
message: `The ${kind}s "${previousId}" and "${id}" both use physical name "${physicalName}"`,
|
|
81
|
-
path: [...path, "physicalName"],
|
|
82
|
-
relatedPaths: [[
|
|
83
|
-
kind === "constraint" ? "constraints" : "indexes",
|
|
84
|
-
previousId,
|
|
85
|
-
"physicalName"
|
|
86
|
-
]]
|
|
87
|
-
});
|
|
88
|
-
else names.set(physicalName, id);
|
|
89
|
-
result[id] = materializeSchemaObjectIdentity(value, id, physicalName);
|
|
90
|
-
}
|
|
91
|
-
if (diagnostics.length > 0) throw new SchemaMetadataValidationError(diagnostics);
|
|
92
|
-
return Object.freeze(result);
|
|
93
|
-
}
|
|
94
|
-
/** Return a diagnostic when a dialect extension is used by another adapter. */
|
|
95
|
-
function dialectMismatchDiagnostic(extension, dialect, path) {
|
|
96
|
-
if (extension.dialect === dialect) return void 0;
|
|
97
|
-
return {
|
|
98
|
-
code: "dialect-mismatch",
|
|
99
|
-
message: `Dialect extension belongs to "${extension.dialect}" but the active schema dialect is "${dialect}"`,
|
|
100
|
-
path,
|
|
101
|
-
dialect
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
/** Throw a structured error for one or more dialect capability findings. */
|
|
105
|
-
function assertSchemaDialectSupport(diagnostics) {
|
|
106
|
-
if (diagnostics.length > 0) throw new SchemaMetadataValidationError(diagnostics);
|
|
107
|
-
}
|
|
108
|
-
//#endregion
|
|
1
|
+
import { t as standardDialect } from "./standard-DfcZEVOj.mjs";
|
|
2
|
+
import { B as isSchemaExpression, H as makeSchemaExpression, M as freezeSchemaMetadata, R as snakeCaseIdentifier, W as markSchemaExpression, j as dialectMismatchDiagnostic, r as isColumnReference } from "./column-hqKr7-1I.mjs";
|
|
3
|
+
import { n as isValueExpression } from "./value-Bi71Agyf.mjs";
|
|
109
4
|
//#region src/schema/indexes.ts
|
|
110
5
|
/**
|
|
111
|
-
* Validate portable and dialect-owned index facts for one target adapter.
|
|
112
|
-
*
|
|
113
|
-
*
|
|
6
|
+
* Validate portable and dialect-owned index facts for one target adapter. Unsupported features are
|
|
7
|
+
* reported as data so a serializer can aggregate diagnostics instead of failing during traversal
|
|
8
|
+
* with an opaque exception.
|
|
114
9
|
*/
|
|
115
10
|
function validateIndexDialect(indexMetadata, dialect, path = ["index"]) {
|
|
116
11
|
const diagnostics = [];
|
|
@@ -169,8 +64,8 @@ var SchemaExpressionError = class extends TypeError {
|
|
|
169
64
|
}
|
|
170
65
|
};
|
|
171
66
|
/**
|
|
172
|
-
* Normalize only line endings. Whitespace, quoting, and every other byte of
|
|
173
|
-
*
|
|
67
|
+
* Normalize only line endings. Whitespace, quoting, and every other byte of a raw schema expression
|
|
68
|
+
* remain under the extension author's control.
|
|
174
69
|
*/
|
|
175
70
|
function normalizeSchemaSql(sql) {
|
|
176
71
|
return sql.replace(/\r\n?/g, "\n");
|
|
@@ -179,8 +74,8 @@ function schemaExpression(expression) {
|
|
|
179
74
|
return markSchemaExpression(expression);
|
|
180
75
|
}
|
|
181
76
|
/**
|
|
182
|
-
* Define an extension with the restricted schema context. This is the typed
|
|
183
|
-
*
|
|
77
|
+
* Define an extension with the restricted schema context. This is the typed alternative to
|
|
78
|
+
* {@link unsafeSchemaSql} for deterministic custom syntax.
|
|
184
79
|
*/
|
|
185
80
|
function defineSchemaExpression(kind, render) {
|
|
186
81
|
return makeSchemaExpression(kind, (context) => render(context));
|
|
@@ -285,9 +180,9 @@ function renderSchemaLiteral(dialect, value, mode) {
|
|
|
285
180
|
//#endregion
|
|
286
181
|
//#region src/schema/constraints.ts
|
|
287
182
|
/**
|
|
288
|
-
* Validate one constraint against a schema adapter dialect. This is kept
|
|
289
|
-
*
|
|
290
|
-
*
|
|
183
|
+
* Validate one constraint against a schema adapter dialect. This is kept separate from construction
|
|
184
|
+
* because the same declaration can be inspected for more than one target dialect before a
|
|
185
|
+
* serializer is selected.
|
|
291
186
|
*/
|
|
292
187
|
function validateConstraintDialect(constraint, dialect, path = ["constraint"]) {
|
|
293
188
|
const diagnostics = [];
|
|
@@ -368,13 +263,12 @@ function foreignKey(columns, target, options) {
|
|
|
368
263
|
* Reconstruct a foreign key proved by database catalog metadata.
|
|
369
264
|
*
|
|
370
265
|
* @remarks
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
* The returned value serializes as an ordinary foreign-key constraint.
|
|
266
|
+
* Use this helper for generated or introspection-owned declarations when one or both native SQL
|
|
267
|
+
* domains are unresolved. It accepts unresolved domains, but still rejects known domain
|
|
268
|
+
* mismatches, unequal tuple arity, and local columns from different sources. The enclosing
|
|
269
|
+
* `table()` declaration continues to verify target-column ownership and candidate-key metadata.
|
|
270
|
+
* Resolved targets also receive runtime shape, ownership, and arity checks. The returned value
|
|
271
|
+
* serializes as an ordinary foreign-key constraint.
|
|
378
272
|
*/
|
|
379
273
|
function catalogForeignKey(columns, target, options) {
|
|
380
274
|
assertCatalogForeignKeyColumns(columns, "local");
|
|
@@ -385,15 +279,13 @@ function check(expression, options) {
|
|
|
385
279
|
return freezeConstraint("check", void 0, options, expression);
|
|
386
280
|
}
|
|
387
281
|
/**
|
|
388
|
-
* Reconstruct a boolean check from opaque SQL recovered from a database
|
|
389
|
-
* catalog.
|
|
282
|
+
* Reconstruct a boolean check from opaque SQL recovered from a database catalog.
|
|
390
283
|
*
|
|
391
284
|
* @remarks
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
* line endings and retains the dialect tag in serialized schema metadata.
|
|
285
|
+
* This helper records catalog origin as a narrow type-level proof. It gives the opaque expression
|
|
286
|
+
* the {@link SqlBoolean} semantic type without changing the ordinary {@link check} contract. Qubu
|
|
287
|
+
* does not parse or infer dependencies from the SQL. It preserves the text apart from normalizing
|
|
288
|
+
* line endings and retains the dialect tag in serialized schema metadata.
|
|
397
289
|
*/
|
|
398
290
|
function catalogCheck(input, options) {
|
|
399
291
|
assertCatalogCheckSql(input);
|
|
@@ -447,8 +339,8 @@ const schemaNamingPolicyVersion = 1;
|
|
|
447
339
|
/**
|
|
448
340
|
* The built-in naming policy for schema-generated physical names.
|
|
449
341
|
*
|
|
450
|
-
* Explicit names supplied to `table()` remain unchanged. The policy is used
|
|
451
|
-
*
|
|
342
|
+
* Explicit names supplied to `table()` remain unchanged. The policy is used by tooling when it
|
|
343
|
+
* needs a physical name for a logical table ID.
|
|
452
344
|
*/
|
|
453
345
|
const defaultSchemaNamingPolicy = Object.freeze({
|
|
454
346
|
version: 1,
|
|
@@ -566,4 +458,4 @@ function generatedTableName(logicalId, namingPolicy = defaultSchemaNamingPolicy)
|
|
|
566
458
|
return namingPolicy.tableName(logicalId);
|
|
567
459
|
}
|
|
568
460
|
//#endregion
|
|
569
|
-
export {
|
|
461
|
+
export { index as C, unsafeSchemaSql as S, isUnsafeSchemaSql as _, schemaNamingPolicyVersion as a, renderSchemaSql as b, check as c, references as d, unique as f, defineSchemaExpression as g, SchemaExpressionError as h, schema as i, foreignKey as l, validateConstraintDialect as m, defaultSchemaNamingPolicy as n, catalogCheck as o, uniqueConstraint as p, generatedTableName as r, catalogForeignKey as s, SchemaValidationError as t, primaryKey as u, normalizeSchemaSql as v, validateIndexDialect as w, schemaExpression as x, renderSchemaExpression as y };
|
|
@@ -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 { H as makeSchemaExpression, rt as resultValue } from "./column-hqKr7-1I.mjs";
|
|
3
|
+
import { n as isValueExpression, t as asValue } from "./value-Bi71Agyf.mjs";
|
|
4
4
|
//#region src/expressions/operators/shared.ts
|
|
5
5
|
function isNullOperand(value) {
|
|
6
6
|
return value === null || isValueExpression(value) && value.value === null;
|
|
@@ -24,7 +24,7 @@ function comparison(operator, left, right) {
|
|
|
24
24
|
context.append("(");
|
|
25
25
|
context.render(left);
|
|
26
26
|
context.append(` ${nullOperator})`);
|
|
27
|
-
});
|
|
27
|
+
}, resultValue("boolean"));
|
|
28
28
|
}
|
|
29
29
|
if (operator !== "IS DISTINCT FROM" && operator !== "IS NOT DISTINCT FROM") throw queryValidationError({
|
|
30
30
|
code: "invalid-comparison",
|
|
@@ -41,7 +41,7 @@ function comparison(operator, left, right) {
|
|
|
41
41
|
context.append(` ${operator} `);
|
|
42
42
|
context.render(rightExpression);
|
|
43
43
|
context.append(")");
|
|
44
|
-
});
|
|
44
|
+
}, resultValue("boolean"));
|
|
45
45
|
}
|
|
46
46
|
function eq(left, right) {
|
|
47
47
|
return comparison("=", left, right);
|
package/dist/schema.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $o as
|
|
2
|
-
export { AliasIdentity, AliasedSource, AnyKeyColumn, AnySource, AnyTable, CanonicalLiteral, CatalogCheckExpression, CatalogCheckSql, CheckConstraint, CheckConstraintOptions, ColumnBehaviorError, ColumnBehaviorErrorCode, ColumnDefault, ColumnDefaultInput, ColumnDefaultOf, ColumnDefinition, 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, 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, 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 ColumnStorageOf, $r as generatedTableName, $s as canonicalLiteral, Ai as catalogCheck, Ar as SchemaExpressionErrorCode, As as timestamp, At as SourceSqlTypeMap, Bi as AliasedSource, Bo as ColumnIdentityOf, Br as renderSchemaSql, Bs as ExternalDefaultDescriptor, Bt as TableDefinitions, Ci as SourceConstraintsRecord, Cs as json, Ct as SourceColumns, Di as UniqueConstraint, Dr as createSchemaDialect, Ds as numeric, Dt as SourceKind, Ei as TableLike, Er as SchemaDialectHooks, Es as nullable, Et as SourceIdentity, Fi as references, Fo as ColumnDefinition, Fr as UnsafeSchemaSqlExpression, Fs as ColumnDefault, Ft as exposeColumns, Gi as alias, Go as ColumnOptions, Gr as SchemaNamingPolicy, Gs as IdentityDescriptor, Gt as TableRow, Hi as LateralSource, Ho as ColumnIsGenerated, Hr as unsafeSchemaSql, Hs as GeneratedColumnDescriptor, Ht as TableInsertInput, Ii as unique, Io as ColumnDefinitionConfig, Ir as defineSchemaExpression, Is as ColumnDefaultInput, It as sourceIdentity, Ji as IndexOptions, Jo as ColumnStorage, Jr as SchemaTableNames, Js as LiteralDefaultDescriptor, Jt as table, Ki as lateral, Ko as ColumnOutput, Kr as SchemaOptions, Ks as IdentityDialectExtension, Kt as TableSqlTypes, Li as uniqueConstraint, Lo as ColumnFromOptions, Lr as isUnsafeSchemaSql, Ls as DefaultDescriptor, Lt as AnyTable, Mi as check, Mr as SchemaExpressionMode, Ms as CanonicalLiteral, Mt as UnknownSourceSqlTypes, Ni as foreignKey, Nr as SchemaRenderContext, Ns as ColumnBehaviorError, Nt as createSource, Oi as UniqueConstraintOptions, Or as RenderedSchemaExpression, Os as portableStorage, Ot as SourceProvision, Pi as primaryKey, Po as ColumnDefaultOf, Pr as SchemaRenderOptions, Ps as ColumnBehaviorErrorCode, Pt as customSource, Qi as SourceIndex, Qo as ColumnStorageKindOf, Qr as defaultSchemaNamingPolicy, Qs as SqliteIdentityExtension, Ri as validateConstraintDialect, Ro as ColumnGeneratedOf, Rr as normalizeSchemaSql, Rs as ExpressionDefaultDescriptor, Rt as Table, Si as SourceConstraint, Ss as integer, St as Source, Ti as SqliteConstraintExtension, Tr as SchemaDialect, Ts as nativeStorage, Tt as SourceConstraints, Ui as QueryAliasIdentity, Uo as ColumnIsNullable, Ur as Schema, Us as GeneratedColumnMode, Ut as TableMetadataCallback, Vi as LateralIdentity, Vo as ColumnInsertInput, Vr as schemaExpression, Vs as ExternalGeneratedColumnDescriptor, Vt as TableIdentity, Wi as QuerySource, Wo as ColumnOnUpdateOf, Wr as SchemaDiagnostic, Ws as GeneratedDescriptor, Wt as TableOptions, Xi as MysqlIndexExtension, Xo as ColumnStorageDescriptor, Xr as SchemaTableRegistry, Xs as ResolvedColumnBehavior, Yi as IndexTerm, Yo as ColumnStorageDeclarationOf, Yr as SchemaTableRecord, Ys as MysqlIdentityExtension, Zi as PostgresIndexExtension, Zo as ColumnStorageDialectOf, Zr as SchemaValidationError, Zs as SchemaLiteralValue, _c as materializeSchemaObjectRecord, _i as KeyConstraint, _s as binary, _t as AnySource, ac as SchemaDialectExtension, ai as CheckConstraint, as as NativeStorage, bi as PostgresConstraintExtension, bs as columnResultValue, bt as ProvidedSourceIdentity, cc as SchemaMetadataValidationError, ci as ConstraintOptions, cs as PortableStorage, dc as assertSchemaDialectSupport, di as FieldLikeOptions, ds as StorageDeclarationOf, ea as SqliteIndexExtension, ec as externalDefault, ei as schema, es as ColumnStorageType, fc as dialectMismatchDiagnostic, fi as ForeignKeyConstraint, fs as StorageDescriptor, gc as materializeSchemaObjectIdentity, gi as ForeignKeyTargetInput, gs as bigint, hc as isValidSchemaObjectName, hi as ForeignKeyTarget, hs as StorageTypeOf, ia as DeclaredColumnNullability, ic as resolveColumnBehavior, ii as CatalogCheckSql, is as NativeColumnStorage, ji as catalogForeignKey, jr as SchemaExpressionInput, js as uuid, jt as SourceSqlTypes, ki as UniqueNullSemantics, kr as SchemaExpressionError, ks as text, kt as SourceRow, lc as SchemaObjectIdentity, li as ConstraintTiming, ls as PortableStorageDescriptor, mc as generatedSchemaObjectName, mi as ForeignKeyOptions, ms as StorageOf, na as index, nc as generatedColumn, ni as AnyKeyColumn, ns as ColumnUpdateInput, oc as SchemaDialectName, oi as CheckConstraintOptions, os as NativeStorageDescriptor, pc as freezeSchemaMetadata, pi as ForeignKeyMatch, ps as StorageDialectOf, qi as IndexDialectExtension, qo as ColumnSqlType, qr as SchemaTableEntry, qs as IdentityGeneration, qt as TableUpdateInput, ra as validateIndexDialect, rc as identityColumn, ri as CatalogCheckExpression, rs as DialectNativeStorage, sc as SchemaMetadataDiagnostic, si as ConstraintDialectExtension, ss as PortableColumnStorage, ta as TableIndex, tc as externalGeneratedColumn, ti as schemaNamingPolicyVersion, ts as ColumnStorageTypeOf, uc as SchemaObjectNameOptions, ui as FieldLike, us as PortableStorageType, vi as KeyConstraintOptions, vs as boolean, vt as CustomSource, wi as SourceLike, ws as nativeColumn, wt as SourceConfig, xi as ReferentialAction, xs as date, xt as ProvidedSourceRow, yi as MysqlConstraintExtension, ys as column, yt as CustomSourceOptions, zi as AliasIdentity, zo as ColumnHasDefault, zr as renderSchemaExpression, zs as ExpressionGeneratedColumnDescriptor, zt as TableColumns } from "./types-BK1COGZe.mjs";
|
|
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 };
|
package/dist/schema.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
3
|
-
import {
|
|
4
|
-
import { S as
|
|
5
|
-
import { t as createSchemaDialect } from "./dialect-
|
|
6
|
-
export { ColumnBehaviorError, SchemaExpressionError, SchemaMetadataValidationError, SchemaValidationError, alias, assertSchemaDialectSupport, bigint, binary, boolean, canonicalLiteral, catalogCheck, catalogForeignKey, check, column, 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 { A as assertSchemaDialectSupport, C as canonicalLiteral, D as identityColumn, E as generatedColumn, F as materializeSchemaObjectIdentity, I as materializeSchemaObjectRecord, M as freezeSchemaMetadata, N as generatedSchemaObjectName, O as resolveColumnBehavior, P as isValidSchemaObjectName, S as ColumnBehaviorError, T as externalGeneratedColumn, _ as numeric, b as timestamp, c as boolean, d as date, f as integer, g as nullable, h as nativeStorage, j as dialectMismatchDiagnostic, k as SchemaMetadataValidationError, l as column, m as nativeColumn, o as bigint, p as json, s as binary, u as columnResultValue, v as portableStorage, w as externalDefault, x as uuid, y as text } from "./column-hqKr7-1I.mjs";
|
|
2
|
+
import { i as sourceIdentity, n as customSource, r as exposeColumns, t as createSource } from "./source-BcS2AsIg.mjs";
|
|
3
|
+
import { n as alias, r as lateral, t as table } from "./table-Bp5irMSj.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-BRMLYwDp.mjs";
|
|
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 };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { s as assertSchemaSnapshot } from "./canonical-
|
|
2
|
-
import { a as sqliteStorageAffinity } from "./sqlite-
|
|
1
|
+
import { s as assertSchemaSnapshot } from "./canonical-BXUguqfo.mjs";
|
|
2
|
+
import { a as sqliteStorageAffinity } from "./sqlite-Cg0nwYEH.mjs";
|
|
3
3
|
//#region src/introspection/diagnostics.ts
|
|
4
4
|
/**
|
|
5
|
-
* Create one immutable diagnostic without interpreting catalog text or
|
|
6
|
-
*
|
|
5
|
+
* Create one immutable diagnostic without interpreting catalog text or copying driver error details
|
|
6
|
+
* into the structured fields.
|
|
7
7
|
*/
|
|
8
8
|
function createIntrospectionDiagnostic(diagnostic) {
|
|
9
9
|
return freezeDiagnostic(diagnostic);
|
|
@@ -330,7 +330,7 @@ function mapLiteral(value) {
|
|
|
330
330
|
};
|
|
331
331
|
}
|
|
332
332
|
function mapExtension(value) {
|
|
333
|
-
if (!value) return
|
|
333
|
+
if (!value) return;
|
|
334
334
|
return {
|
|
335
335
|
dialect: value.dialect,
|
|
336
336
|
version: value.version,
|
package/dist/snapshot.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as SnapshotStorage,
|
|
2
|
-
import { A as CompleteSnapshotProvenance, B as SchemaSnapshotV2Input, C as CompleteSnapshotObjectMetadata, D as CompleteSnapshotPartition, E as CompleteSnapshotOwnership, F as CompleteSnapshotTrigger, G as schemaSnapshotVersion2, H as completeSchemaSnapshotVersion, I as CompleteSnapshotValueFact, L as CompleteSnapshotView, M as CompleteSnapshotRoutineParameter, N as CompleteSnapshotSequence, O as CompleteSnapshotPhysicalReference, P as CompleteSnapshotTable, R as SchemaSnapshotV2, S as CompleteSnapshotObjectKind, T as CompleteSnapshotOpaqueObject, U as schemaSnapshotCompleteVersion, V as completeSchemaSnapshotFormat, W as schemaSnapshotV2Version, _ as CompleteSnapshotIndex, a as CompleteSnapshotCollation, b as CompleteSnapshotNamespace, c as CompleteSnapshotConstraint, d as CompleteSnapshotDeferredObject, f as CompleteSnapshotDomain, g as CompleteSnapshotIdentity, h as CompleteSnapshotForeignKey, i as CompleteSnapshotCheckConstraint, j as CompleteSnapshotRoutine, k as CompleteSnapshotPolicy, l as CompleteSnapshotCreateResult, m as CompleteSnapshotExtension, n as CompleteSchemaSnapshotInput, o as CompleteSnapshotColumn, p as CompleteSnapshotEnum, r as CompleteSnapshotCapabilities, s as CompleteSnapshotComment, t as CompleteSchemaSnapshot, u as CompleteSnapshotDecodeResult, v as CompleteSnapshotIndexTerm, w as CompleteSnapshotObjectReference, x as CompleteSnapshotObject, y as CompleteSnapshotKeyConstraint, z as SchemaSnapshotV2DecodeResult } from "./complete-types-
|
|
3
|
-
import { A as assertSchemaSnapshot, B as decodeCompleteSchemaSnapshot, C as createSchemaSnapshot, D as serializeSchema, E as encodeSnapshot, F as assertCompleteSnapshot, G as encodeCompleteSnapshot, H as decodeSchemaSnapshotV2, I as assertSchemaSnapshotV2, J as SnapshotCanonicalError, K as encodeSchemaSnapshotV2, L as canonicalizeCompleteSchemaSnapshot, M as decodeSchemaSnapshot, N as CompleteSnapshotValidationError, O as tryCreateSchemaSnapshot, P as assertCompleteSchemaSnapshot, Q as toSnapshotJsonValue, R as canonicalizeSchemaSnapshotV2, S as SnapshotSerializationError, T as encodeSchemaSnapshot, U as digestCompleteSchemaSnapshot, V as decodeCompleteSnapshot, W as encodeCompleteSchemaSnapshot, X as encodeCanonicalSnapshot, Y as canonicalJson, Z as schemaSnapshotDigest, _ as postgresSchemaDialect, a as mysqlSnapshotDialect, b as tryCreatePostgresSchemaSnapshot, c as SqliteStorageAffinity, d as sqliteSnapshotAdapter, f as sqliteSnapshotDialect, g as createPostgresSchemaSnapshot, h as PostgresSnapshotOptions, i as mysqlSnapshotAdapter, j as canonicalizeSchemaSnapshot, k as SnapshotValidationError, l as createSqliteSchemaSnapshot, m as tryCreateSqliteSchemaSnapshot, n as createMysqlSchemaSnapshot, o as tryCreateMysqlSchemaSnapshot, p as sqliteStorageAffinity, q as schemaSnapshotV2Digest, r as mysqlSchemaDialect, s as SqliteSnapshotOptions, t as MysqlSnapshotOptions, u as sqliteSchemaDialect, v as postgresSnapshotAdapter, w as digestSchemaSnapshot, x as SchemaSnapshotOptions, y as postgresSnapshotDialect, z as completeSchemaSnapshotDigest } from "./index-
|
|
1
|
+
import { A as SnapshotStorage, C as SnapshotIndexTerm, D as SnapshotLiteral, Dr as createSchemaDialect, E as SnapshotKeyConstraint, Er as SchemaDialectHooks, F as neutralSnapshotDialect, I as schemaSnapshotDialectVersion, L as schemaSnapshotFormat, M as SnapshotTable, N as SnapshotUniqueConstraint, O as SnapshotNamingPolicy, P as SnapshotValidationContext, R as schemaSnapshotNamingPolicyVersion, S as SnapshotIndex, T as SnapshotJsonValue, Tr as SchemaDialect, _ as SnapshotExpressionContext, a as SnapshotBigInt, b as SnapshotGeneratedColumn, c as SnapshotConstraint, d as SnapshotDefault, f as SnapshotDiagnostic, g as SnapshotExpression, h as SnapshotDialectExtension, i as SchemaSnapshotInput, is as NativeColumnStorage, j as SnapshotStorageContext, k as SnapshotSpecialNumber, l as SnapshotCreateResult, m as SnapshotDialect, n as SchemaSnapshot, o as SnapshotCheckConstraint, p as SnapshotDiagnosticCode, r as SchemaSnapshotAdapter, s as SnapshotColumn, ss as PortableColumnStorage, t as AnySchema, u as SnapshotDecodeResult, v as SnapshotExtensionContext, w as SnapshotIndexTermExpression, x as SnapshotIdentity, y as SnapshotForeignKey, z as schemaSnapshotVersion } from "./types-BK1COGZe.mjs";
|
|
2
|
+
import { A as CompleteSnapshotProvenance, B as SchemaSnapshotV2Input, C as CompleteSnapshotObjectMetadata, D as CompleteSnapshotPartition, E as CompleteSnapshotOwnership, F as CompleteSnapshotTrigger, G as schemaSnapshotVersion2, H as completeSchemaSnapshotVersion, I as CompleteSnapshotValueFact, L as CompleteSnapshotView, M as CompleteSnapshotRoutineParameter, N as CompleteSnapshotSequence, O as CompleteSnapshotPhysicalReference, P as CompleteSnapshotTable, R as SchemaSnapshotV2, S as CompleteSnapshotObjectKind, T as CompleteSnapshotOpaqueObject, U as schemaSnapshotCompleteVersion, V as completeSchemaSnapshotFormat, W as schemaSnapshotV2Version, _ as CompleteSnapshotIndex, a as CompleteSnapshotCollation, b as CompleteSnapshotNamespace, c as CompleteSnapshotConstraint, d as CompleteSnapshotDeferredObject, f as CompleteSnapshotDomain, g as CompleteSnapshotIdentity, h as CompleteSnapshotForeignKey, i as CompleteSnapshotCheckConstraint, j as CompleteSnapshotRoutine, k as CompleteSnapshotPolicy, l as CompleteSnapshotCreateResult, m as CompleteSnapshotExtension, n as CompleteSchemaSnapshotInput, o as CompleteSnapshotColumn, p as CompleteSnapshotEnum, r as CompleteSnapshotCapabilities, s as CompleteSnapshotComment, t as CompleteSchemaSnapshot, u as CompleteSnapshotDecodeResult, v as CompleteSnapshotIndexTerm, w as CompleteSnapshotObjectReference, x as CompleteSnapshotObject, y as CompleteSnapshotKeyConstraint, z as SchemaSnapshotV2DecodeResult } from "./complete-types-IjEn5VPN.mjs";
|
|
3
|
+
import { A as assertSchemaSnapshot, B as decodeCompleteSchemaSnapshot, C as createSchemaSnapshot, D as serializeSchema, E as encodeSnapshot, F as assertCompleteSnapshot, G as encodeCompleteSnapshot, H as decodeSchemaSnapshotV2, I as assertSchemaSnapshotV2, J as SnapshotCanonicalError, K as encodeSchemaSnapshotV2, L as canonicalizeCompleteSchemaSnapshot, M as decodeSchemaSnapshot, N as CompleteSnapshotValidationError, O as tryCreateSchemaSnapshot, P as assertCompleteSchemaSnapshot, Q as toSnapshotJsonValue, R as canonicalizeSchemaSnapshotV2, S as SnapshotSerializationError, T as encodeSchemaSnapshot, U as digestCompleteSchemaSnapshot, V as decodeCompleteSnapshot, W as encodeCompleteSchemaSnapshot, X as encodeCanonicalSnapshot, Y as canonicalJson, Z as schemaSnapshotDigest, _ as postgresSchemaDialect, a as mysqlSnapshotDialect, b as tryCreatePostgresSchemaSnapshot, c as SqliteStorageAffinity, d as sqliteSnapshotAdapter, f as sqliteSnapshotDialect, g as createPostgresSchemaSnapshot, h as PostgresSnapshotOptions, i as mysqlSnapshotAdapter, j as canonicalizeSchemaSnapshot, k as SnapshotValidationError, l as createSqliteSchemaSnapshot, m as tryCreateSqliteSchemaSnapshot, n as createMysqlSchemaSnapshot, o as tryCreateMysqlSchemaSnapshot, p as sqliteStorageAffinity, q as schemaSnapshotV2Digest, r as mysqlSchemaDialect, s as SqliteSnapshotOptions, t as MysqlSnapshotOptions, u as sqliteSchemaDialect, v as postgresSnapshotAdapter, w as digestSchemaSnapshot, x as SchemaSnapshotOptions, y as postgresSnapshotDialect, z as completeSchemaSnapshotDigest } from "./index-1DpA3mUh.mjs";
|
|
4
4
|
export { AnySchema, CompleteSchemaSnapshot, CompleteSchemaSnapshotInput, CompleteSnapshotCapabilities, CompleteSnapshotCheckConstraint, CompleteSnapshotCollation, CompleteSnapshotColumn, CompleteSnapshotComment, CompleteSnapshotConstraint, CompleteSnapshotCreateResult, CompleteSnapshotDecodeResult, CompleteSnapshotDeferredObject, CompleteSnapshotDomain, CompleteSnapshotEnum, CompleteSnapshotExtension, CompleteSnapshotForeignKey, CompleteSnapshotIdentity, CompleteSnapshotIndex, CompleteSnapshotIndexTerm, CompleteSnapshotKeyConstraint, CompleteSnapshotNamespace, CompleteSnapshotObject, CompleteSnapshotObjectKind, CompleteSnapshotObjectMetadata, CompleteSnapshotObjectReference, CompleteSnapshotOpaqueObject, CompleteSnapshotOwnership, CompleteSnapshotPartition, CompleteSnapshotPhysicalReference, CompleteSnapshotPolicy, CompleteSnapshotProvenance, CompleteSnapshotRoutine, CompleteSnapshotRoutineParameter, CompleteSnapshotSequence, CompleteSnapshotTable, CompleteSnapshotTrigger, CompleteSnapshotValidationError, CompleteSnapshotValueFact, CompleteSnapshotView, MysqlSnapshotOptions, type NativeColumnStorage, type PortableColumnStorage, PostgresSnapshotOptions, type SchemaDialect, type SchemaDialectHooks, SchemaSnapshot, SchemaSnapshotAdapter, SchemaSnapshotInput, SchemaSnapshotOptions, SchemaSnapshotV2, SchemaSnapshotV2DecodeResult, SchemaSnapshotV2Input, SnapshotBigInt, SnapshotCanonicalError, SnapshotCheckConstraint, SnapshotColumn, SnapshotConstraint, SnapshotCreateResult, SnapshotDecodeResult, SnapshotDefault, SnapshotDiagnostic, SnapshotDiagnosticCode, SnapshotDialect, SnapshotDialectExtension, SnapshotExpression, SnapshotExpressionContext, SnapshotExtensionContext, SnapshotForeignKey, SnapshotGeneratedColumn, SnapshotIdentity, SnapshotIndex, SnapshotIndexTerm, SnapshotIndexTermExpression, SnapshotJsonValue, SnapshotKeyConstraint, SnapshotLiteral, SnapshotNamingPolicy, SnapshotSerializationError, SnapshotSpecialNumber, SnapshotStorage, SnapshotStorageContext, SnapshotTable, SnapshotUniqueConstraint, SnapshotValidationContext, SnapshotValidationError, SqliteSnapshotOptions, SqliteStorageAffinity, assertCompleteSchemaSnapshot, assertCompleteSnapshot, assertSchemaSnapshot, assertSchemaSnapshotV2, canonicalJson, canonicalizeCompleteSchemaSnapshot, canonicalizeSchemaSnapshot, canonicalizeSchemaSnapshotV2, completeSchemaSnapshotDigest, completeSchemaSnapshotFormat, completeSchemaSnapshotVersion, createMysqlSchemaSnapshot, createPostgresSchemaSnapshot, createSchemaDialect, createSchemaSnapshot, createSqliteSchemaSnapshot, decodeCompleteSchemaSnapshot, decodeCompleteSnapshot, decodeSchemaSnapshot, decodeSchemaSnapshotV2, digestCompleteSchemaSnapshot, digestSchemaSnapshot, encodeCanonicalSnapshot, encodeCompleteSchemaSnapshot, encodeCompleteSnapshot, encodeSchemaSnapshot, encodeSchemaSnapshotV2, encodeSnapshot, mysqlSchemaDialect, mysqlSnapshotAdapter, mysqlSnapshotDialect, neutralSnapshotDialect, postgresSchemaDialect, postgresSnapshotAdapter, postgresSnapshotDialect, schemaSnapshotCompleteVersion, schemaSnapshotDialectVersion, schemaSnapshotDigest, schemaSnapshotFormat, schemaSnapshotNamingPolicyVersion, schemaSnapshotV2Digest, schemaSnapshotV2Version, schemaSnapshotVersion, schemaSnapshotVersion2, serializeSchema, sqliteSchemaDialect, sqliteSnapshotAdapter, sqliteSnapshotDialect, sqliteStorageAffinity, toSnapshotJsonValue, tryCreateMysqlSchemaSnapshot, tryCreatePostgresSchemaSnapshot, tryCreateSchemaSnapshot, tryCreateSqliteSchemaSnapshot };
|
package/dist/snapshot.mjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { t as createSchemaDialect } from "./dialect-
|
|
2
|
-
import { a as toSnapshotJsonValue, c as canonicalizeSchemaSnapshot, d as schemaSnapshotDialectVersion, f as schemaSnapshotFormat, i as schemaSnapshotDigest, l as decodeSchemaSnapshot, m as schemaSnapshotVersion, n as canonicalJson, o as SnapshotValidationError, p as schemaSnapshotNamingPolicyVersion, r as encodeCanonicalSnapshot, s as assertSchemaSnapshot, t as SnapshotCanonicalError, u as neutralSnapshotDialect } from "./canonical-
|
|
3
|
-
import { a as encodeSnapshot, i as
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
6
|
-
import { a as tryCreatePostgresSchemaSnapshot, i as postgresSnapshotDialect, n as postgresSchemaDialect, r as postgresSnapshotAdapter, t as createPostgresSchemaSnapshot } from "./postgres-DEBBeh52.mjs";
|
|
7
|
-
import { a as tryCreateMysqlSchemaSnapshot, i as mysqlSnapshotDialect, n as mysqlSchemaDialect, r as mysqlSnapshotAdapter, t as createMysqlSchemaSnapshot } from "./mysql-DqkqXB6A.mjs";
|
|
1
|
+
import { t as createSchemaDialect } from "./dialect-wUKrnPMB.mjs";
|
|
2
|
+
import { a as toSnapshotJsonValue, c as canonicalizeSchemaSnapshot, d as schemaSnapshotDialectVersion, f as schemaSnapshotFormat, i as schemaSnapshotDigest, l as decodeSchemaSnapshot, m as schemaSnapshotVersion, n as canonicalJson, o as SnapshotValidationError, p as schemaSnapshotNamingPolicyVersion, r as encodeCanonicalSnapshot, s as assertSchemaSnapshot, t as SnapshotCanonicalError, u as neutralSnapshotDialect } from "./canonical-BXUguqfo.mjs";
|
|
3
|
+
import { a as sqliteStorageAffinity, c as createSchemaSnapshot, d as encodeSnapshot, f as serializeSchema, i as sqliteSnapshotDialect, l as digestSchemaSnapshot, n as sqliteSchemaDialect, o as tryCreateSqliteSchemaSnapshot, p as tryCreateSchemaSnapshot, r as sqliteSnapshotAdapter, s as SnapshotSerializationError, t as createSqliteSchemaSnapshot, u as encodeSchemaSnapshot } from "./sqlite-Cg0nwYEH.mjs";
|
|
4
|
+
import { _ as completeSchemaSnapshotVersion, a as canonicalizeCompleteSchemaSnapshot, b as schemaSnapshotVersion2, c as decodeCompleteSchemaSnapshot, d as digestCompleteSchemaSnapshot, f as encodeCompleteSchemaSnapshot, g as completeSchemaSnapshotFormat, h as schemaSnapshotV2Digest, i as assertSchemaSnapshotV2, l as decodeCompleteSnapshot, m as encodeSchemaSnapshotV2, n as assertCompleteSchemaSnapshot, o as canonicalizeSchemaSnapshotV2, p as encodeCompleteSnapshot, r as assertCompleteSnapshot, s as completeSchemaSnapshotDigest, t as CompleteSnapshotValidationError, u as decodeSchemaSnapshotV2, v as schemaSnapshotCompleteVersion, y as schemaSnapshotV2Version } from "./complete-WYyVozgK.mjs";
|
|
5
|
+
import { a as tryCreateMysqlSchemaSnapshot, c as postgresSnapshotAdapter, i as mysqlSnapshotDialect, l as postgresSnapshotDialect, n as mysqlSchemaDialect, o as createPostgresSchemaSnapshot, r as mysqlSnapshotAdapter, s as postgresSchemaDialect, t as createMysqlSchemaSnapshot, u as tryCreatePostgresSchemaSnapshot } from "./mysql-B_cYzzX2.mjs";
|
|
8
6
|
export { CompleteSnapshotValidationError, SnapshotCanonicalError, SnapshotSerializationError, SnapshotValidationError, assertCompleteSchemaSnapshot, assertCompleteSnapshot, assertSchemaSnapshot, assertSchemaSnapshotV2, canonicalJson, canonicalizeCompleteSchemaSnapshot, canonicalizeSchemaSnapshot, canonicalizeSchemaSnapshotV2, completeSchemaSnapshotDigest, completeSchemaSnapshotFormat, completeSchemaSnapshotVersion, createMysqlSchemaSnapshot, createPostgresSchemaSnapshot, createSchemaDialect, createSchemaSnapshot, createSqliteSchemaSnapshot, decodeCompleteSchemaSnapshot, decodeCompleteSnapshot, decodeSchemaSnapshot, decodeSchemaSnapshotV2, digestCompleteSchemaSnapshot, digestSchemaSnapshot, encodeCanonicalSnapshot, encodeCompleteSchemaSnapshot, encodeCompleteSnapshot, encodeSchemaSnapshot, encodeSchemaSnapshotV2, encodeSnapshot, mysqlSchemaDialect, mysqlSnapshotAdapter, mysqlSnapshotDialect, neutralSnapshotDialect, postgresSchemaDialect, postgresSnapshotAdapter, postgresSnapshotDialect, schemaSnapshotCompleteVersion, schemaSnapshotDialectVersion, schemaSnapshotDigest, schemaSnapshotFormat, schemaSnapshotNamingPolicyVersion, schemaSnapshotV2Digest, schemaSnapshotV2Version, schemaSnapshotVersion, schemaSnapshotVersion2, serializeSchema, sqliteSchemaDialect, sqliteSnapshotAdapter, sqliteSnapshotDialect, sqliteStorageAffinity, toSnapshotJsonValue, tryCreateMysqlSchemaSnapshot, tryCreatePostgresSchemaSnapshot, tryCreateSchemaSnapshot, tryCreateSqliteSchemaSnapshot };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { t as createColumnReference } from "./column-
|
|
2
|
-
import { t as resolveSqlNames } from "./naming-QVCOnSj2.mjs";
|
|
1
|
+
import { L as resolveSqlNames, t as createColumnReference, u as columnResultValue } from "./column-hqKr7-1I.mjs";
|
|
3
2
|
//#region src/schema/source.ts
|
|
4
3
|
const sourceIdentity = Symbol("qubu.source.identity");
|
|
5
4
|
function createSource(sourceKind, render, reference, constraints = {}) {
|
|
@@ -12,10 +11,9 @@ function createSource(sourceKind, render, reference, constraints = {}) {
|
|
|
12
11
|
};
|
|
13
12
|
}
|
|
14
13
|
/**
|
|
15
|
-
* Create a typed source-producing fragment for a custom FROM relation such as
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* remain available to the normal FROM/JOIN scope checks.
|
|
14
|
+
* Create a typed source-producing fragment for a custom FROM relation such as a table-valued
|
|
15
|
+
* function. The renderer owns the relation syntax and may bind values through context.parameter();
|
|
16
|
+
* the source identity and output columns remain available to the normal FROM/JOIN scope checks.
|
|
19
17
|
*/
|
|
20
18
|
function customSource(options) {
|
|
21
19
|
const source = createSource(options.sourceKind ?? "custom", options.render, options.reference);
|
|
@@ -24,7 +22,7 @@ function customSource(options) {
|
|
|
24
22
|
sqlName: definition.sqlName
|
|
25
23
|
})));
|
|
26
24
|
const columns = Object.fromEntries(Object.keys(options.columns).map((fieldName) => {
|
|
27
|
-
return [fieldName, createColumnReference(sqlNames[fieldName], source.reference, fieldName)];
|
|
25
|
+
return [fieldName, createColumnReference(sqlNames[fieldName], source.reference, fieldName, columnResultValue(options.columns[fieldName]))];
|
|
28
26
|
}));
|
|
29
27
|
Object.assign(source, {
|
|
30
28
|
identity: options.identity,
|
|
@@ -35,8 +33,8 @@ function customSource(options) {
|
|
|
35
33
|
return source;
|
|
36
34
|
}
|
|
37
35
|
/**
|
|
38
|
-
* Add convenient direct column properties without allowing a column name to
|
|
39
|
-
*
|
|
36
|
+
* Add convenient direct column properties without allowing a column name to overwrite the source's
|
|
37
|
+
* rendering or metadata primitives.
|
|
40
38
|
*/
|
|
41
39
|
function exposeColumns(target, columns) {
|
|
42
40
|
const reserved = /* @__PURE__ */ new Set([
|