qubu 0.3.4 → 0.4.0
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 +1 -1
- package/dist/column-D-8OqGuV.mjs +328 -0
- package/dist/{table-llv9tsZ8.mjs → column-LV7oGQde.mjs} +9 -97
- package/dist/{complete-types-BdFqUfbb.d.mts → complete-types-BavBtv8J.d.mts} +1 -1
- package/dist/core.d.mts +1 -1
- package/dist/core.mjs +3 -3
- package/dist/ddl.d.mts +1 -1
- package/dist/ddl.mjs +3 -3
- package/dist/diff.d.mts +1 -1
- package/dist/drizzle-mysql.d.mts +2 -2
- package/dist/drizzle-mysql.mjs +2 -2
- package/dist/drizzle-postgres.d.mts +2 -2
- package/dist/drizzle-postgres.mjs +2 -2
- package/dist/drizzle-sqlite.d.mts +36 -3
- package/dist/drizzle-sqlite.mjs +30 -4
- package/dist/drizzle.d.mts +1 -1
- package/dist/{index-Dug5HnLB.d.mts → index-D3ZOwPT-.d.mts} +2 -2
- package/dist/{index-Ds7-mhJi.d.mts → index-DH0qV6aS.d.mts} +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +64 -34
- package/dist/introspection.d.mts +2 -2
- package/dist/introspection.mjs +1 -1
- package/dist/migration.d.mts +2 -2
- package/dist/{mysql-DqkqXB6A.mjs → mysql-CKEKGnj4.mjs} +3 -3
- package/dist/mysql.d.mts +1 -1
- package/dist/{on-conflict-BxnxubMb.mjs → on-conflict-4MOBl51J.mjs} +4 -3
- package/dist/{postgres-DEBBeh52.mjs → postgres-BK2APkKP.mjs} +3 -2
- package/dist/postgres.d.mts +1 -1
- package/dist/postgres.mjs +3 -3
- package/dist/{registry-BufIskVN.mjs → registry-CXV8u7Pt.mjs} +3 -108
- package/dist/{relational-DCZrrNia.mjs → relational-DuQ9IHSb.mjs} +4 -4
- package/dist/{runtime-BTr-MTlo.mjs → runtime-Cn_Xgzta.mjs} +1 -1
- package/dist/schema.d.mts +2 -2
- package/dist/schema.mjs +6 -4
- package/dist/{serialize-PF1cfH2P.mjs → serialize-CFtYYAdk.mjs} +2 -2
- package/dist/{snapshot-CWPgzxNx.mjs → snapshot-DJpfmxhQ.mjs} +1 -1
- package/dist/snapshot.d.mts +3 -3
- package/dist/snapshot.mjs +4 -4
- package/dist/{source-DUoJVXmL.mjs → source-DGO3DRgg.mjs} +3 -3
- package/dist/{sqlite-BU6DBxef.mjs → sqlite-CrsK0Fza.mjs} +3 -3
- package/dist/sqlite.d.mts +1 -1
- package/dist/sqlite.mjs +1 -1
- package/dist/table-D6rcs8SB.mjs +96 -0
- package/dist/{types-BX0mckiU.d.mts → types-CSNJTYaM.d.mts} +1 -1
- package/dist/{types-H4vyCw8_.d.mts → types-DZsueVoI.d.mts} +1 -1
- package/dist/{types-4Q076HKo.d.mts → types-Deo_q43Y.d.mts} +1442 -916
- package/dist/{types-Cec0xzo4.mjs → types-g-vVvj1B.mjs} +4 -3
- package/dist/{value-BvilP0oz.mjs → value-b6OFZXVS.mjs} +1 -1
- package/dist/vite/ambient.d.ts +13 -61
- package/docs/dialects-and-execution.md +84 -34
- package/docs/guides/drizzle.md +27 -0
- package/docs/reference/supported-surface.md +7 -7
- package/package.json +1 -1
- package/dist/column-CXMxx8Hq.mjs +0 -118
- package/dist/naming-QVCOnSj2.mjs +0 -20
|
@@ -1,111 +1,6 @@
|
|
|
1
1
|
import { t as standardDialect } from "./standard-BTVYKh_F.mjs";
|
|
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
|
|
2
|
+
import { _ as isSchemaExpression, c as dialectMismatchDiagnostic, h as snakeCaseIdentifier, l as freezeSchemaMetadata, r as isColumnReference, x as markSchemaExpression, y as makeSchemaExpression } from "./column-D-8OqGuV.mjs";
|
|
3
|
+
import { n as isValueExpression } from "./value-b6OFZXVS.mjs";
|
|
109
4
|
//#region src/schema/indexes.ts
|
|
110
5
|
/**
|
|
111
6
|
* Validate portable and dialect-owned index facts for one target adapter.
|
|
@@ -566,4 +461,4 @@ function generatedTableName(logicalId, namingPolicy = defaultSchemaNamingPolicy)
|
|
|
566
461
|
return namingPolicy.tableName(logicalId);
|
|
567
462
|
}
|
|
568
463
|
//#endregion
|
|
569
|
-
export {
|
|
464
|
+
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 { P as resultValue, y as makeSchemaExpression } from "./column-D-8OqGuV.mjs";
|
|
3
|
+
import { n as isValueExpression, t as asValue } from "./value-b6OFZXVS.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);
|
|
@@ -40,7 +40,7 @@ function createColumnBuilder(definition, column, table, adapter) {
|
|
|
40
40
|
"storage"
|
|
41
41
|
]);
|
|
42
42
|
const portableType = definition.storage?.kind === "portable" ? definition.storage.type : void 0;
|
|
43
|
-
let builder = adapter.createStorageBuilder(portableType, column.physicalName, declaration);
|
|
43
|
+
let builder = adapter.createStorageBuilder(portableType, column.physicalName, declaration, definition);
|
|
44
44
|
if (!column.nullable) builder = builder.notNull();
|
|
45
45
|
if (column.default?.kind === "literal") builder = builder.default(decodeSnapshotLiteral(column.default.value));
|
|
46
46
|
else if (column.default?.kind === "expression") builder = builder.default(sql.raw(column.default.expression.sql));
|
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, 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 { $c as SchemaObjectNameOptions, $o as ForeignKeyTargetInput, $r as unsafeSchemaSql, $s as PortableStorageType, $t as PostgresIndexExtension, Ac as ExternalGeneratedColumnDescriptor, As as ColumnInsertInput, At as SourceSqlTypeMap, Bc as SchemaLiteralValue, Bo as CatalogCheckExpression, Br as SchemaExpressionError, Bs as ColumnStorageDialectOf, Bt as TableDefinitions, Cc as ColumnBehaviorErrorCode, Cs as ColumnDefaultOf, Ct as SourceColumns, Dc as ExpressionDefaultDescriptor, Ds as ColumnGeneratedOf, Dt as SourceKind, Ec as DefaultDescriptor, Es as ColumnFromOptions, Et as SourceIdentity, Fc as IdentityDialectExtension, Fs as ColumnOutput, Ft as exposeColumns, Gc as generatedColumn, Go as ConstraintOptions, Gr as SchemaRenderOptions, Gs as ColumnUpdateInput, Gt as TableRow, Hc as canonicalLiteral, Ho as CheckConstraint, Hr as SchemaExpressionInput, Hs as ColumnStorageOf, Ht as TableInsertInput, Ic as IdentityGeneration, Ir as SchemaDialect, Is as ColumnSqlType, It as sourceIdentity, Jc as SchemaDialectExtension, Jo as FieldLikeOptions, Jr as isUnsafeSchemaSql, Js as NativeStorage, Jt as table, Kc as identityColumn, Ko as ConstraintTiming, Kr as UnsafeSchemaSqlExpression, Ks as DialectNativeStorage, Kt as TableSqlTypes, Lc as LiteralDefaultDescriptor, Lr as SchemaDialectHooks, Ls as ColumnStorage, Lt as AnyTable, Mc as GeneratedColumnMode, Ms as ColumnIsNullable, Mt as UnknownSourceSqlTypes, Nc as GeneratedDescriptor, Ns as ColumnOnUpdateOf, Nt as createSource, Oc as ExpressionGeneratedColumnDescriptor, Os as ColumnHasDefault, Ot as SourceProvision, Pc as IdentityDescriptor, Ps as ColumnOptions, Pt as customSource, Qc as SchemaObjectIdentity, Qo as ForeignKeyTarget, Qr as schemaExpression, Qs as PortableStorageDescriptor, Qt as MysqlIndexExtension, Rc as MysqlIdentityExtension, Rr as createSchemaDialect, Rs as ColumnStorageDeclarationOf, Rt as Table, Sc as ColumnBehaviorError, Ss as DeclaredColumnNullability, St as Source, Tc as ColumnDefaultInput, Ts as ColumnDefinitionConfig, Tt as SourceConstraints, Uc as externalDefault, Uo as CheckConstraintOptions, Ur as SchemaExpressionMode, Us as ColumnStorageType, Ut as TableMetadataCallback, Vc as SqliteIdentityExtension, Vo as CatalogCheckSql, Vr as SchemaExpressionErrorCode, Vs as ColumnStorageKindOf, Vt as TableIdentity, Wc as externalGeneratedColumn, Wo as ConstraintDialectExtension, Wr as SchemaRenderContext, Ws as ColumnStorageTypeOf, Wt as TableOptions, Xc as SchemaMetadataDiagnostic, Xo as ForeignKeyMatch, Xr as renderSchemaExpression, Xs as PortableColumnStorage, Xt as IndexOptions, Yc as SchemaDialectName, Yo as ForeignKeyConstraint, Yr as normalizeSchemaSql, Ys as NativeStorageDescriptor, Yt as IndexDialectExtension, Zc as SchemaMetadataValidationError, Zo as ForeignKeyOptions, Zr as renderSchemaSql, Zs as PortableStorage, Zt as IndexTerm, _c as portableStorage, _i as QueryAliasIdentity, _s as primaryKey, _t as AnySource, ac as bigint, ai as SchemaTableNames, al as materializeSchemaObjectIdentity, an as validateIndexDialect, as as SourceConstraint, bc as uuid, bi as lateral, bs as uniqueConstraint, bt as ProvidedSourceIdentity, cc as column, ci as SchemaValidationError, cs as SqliteConstraintExtension, dc as integer, di as schema, ds as UniqueConstraintOptions, ec as StorageDeclarationOf, ei as Schema, el as assertSchemaDialectSupport, en as SourceIndex, es as KeyConstraint, fc as json, fi as schemaNamingPolicyVersion, fs as UniqueNullSemantics, gc as numeric, gi as LateralSource, gs as foreignKey, hc as nullable, hi as LateralIdentity, hs as check, ic as StorageTypeOf, ii as SchemaTableEntry, il as isValidSchemaObjectName, in as index, is as ReferentialAction, jc as GeneratedColumnDescriptor, js as ColumnIsGenerated, jt as SourceSqlTypes, kc as ExternalDefaultDescriptor, ks as ColumnIdentityOf, kt as SourceRow, lc as columnResultValue, li as defaultSchemaNamingPolicy, ls as TableLike, mc as nativeStorage, mi as AliasedSource, ms as catalogForeignKey, nc as StorageDialectOf, ni as SchemaNamingPolicy, nl as freezeSchemaMetadata, nn as SqliteIndexExtension, ns as MysqlConstraintExtension, oc as binary, oi as SchemaTableRecord, ol as materializeSchemaObjectRecord, os as SourceConstraintsRecord, pc as nativeColumn, pi as AliasIdentity, ps as catalogCheck, qc as resolveColumnBehavior, qo as FieldLike, qr as defineSchemaExpression, qs as NativeColumnStorage, qt as TableUpdateInput, rc as StorageOf, ri as SchemaOptions, rl as generatedSchemaObjectName, rn as TableIndex, rs as PostgresConstraintExtension, sc as boolean, si as SchemaTableRegistry, ss as SourceLike, tc as StorageDescriptor, ti as SchemaDiagnostic, tl as dialectMismatchDiagnostic, tn as SourceIndexesRecord, ts as KeyConstraintOptions, uc as date, ui as generatedTableName, us as UniqueConstraint, vc as text, vi as QuerySource, vs as references, vt as CustomSource, wc as ColumnDefault, ws as ColumnDefinition, wt as SourceConfig, xc as CanonicalLiteral, xs as validateConstraintDialect, xt as ProvidedSourceRow, yc as timestamp, yi as alias, ys as unique, yt as CustomSourceOptions, zc as ResolvedColumnBehavior, zo as AnyKeyColumn, zr as RenderedSchemaExpression, zs as ColumnStorageDescriptor, zt as TableColumns } from "./types-Deo_q43Y.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,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as resolveColumnBehavior, S as identityColumn,
|
|
3
|
-
import {
|
|
1
|
+
import { c as dialectMismatchDiagnostic, d as isValidSchemaObjectName, f as materializeSchemaObjectIdentity, l as freezeSchemaMetadata, o as SchemaMetadataValidationError, p as materializeSchemaObjectRecord, s as assertSchemaDialectSupport, u as generatedSchemaObjectName } from "./column-D-8OqGuV.mjs";
|
|
2
|
+
import { C as resolveColumnBehavior, S as identityColumn, _ as ColumnBehaviorError, a as columnResultValue, b as externalGeneratedColumn, c as json, d as nullable, f as numeric, g as uuid, h as timestamp, i as column, l as nativeColumn, m as text, n as binary, o as date, p as portableStorage, r as boolean, s as integer, t as bigint, u as nativeStorage, v as canonicalLiteral, x as generatedColumn, y as externalDefault } from "./column-LV7oGQde.mjs";
|
|
3
|
+
import { i as sourceIdentity, n as customSource, r as exposeColumns, t as createSource } from "./source-DGO3DRgg.mjs";
|
|
4
|
+
import { n as alias, r as lateral, t as table } from "./table-D6rcs8SB.mjs";
|
|
5
|
+
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-CXV8u7Pt.mjs";
|
|
4
6
|
import { t as createSchemaDialect } from "./dialect-b2-Z6uBF.mjs";
|
|
5
|
-
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 };
|
|
7
|
+
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,6 +1,6 @@
|
|
|
1
1
|
import { t as standardDialect } from "./standard-BTVYKh_F.mjs";
|
|
2
|
-
import { r as isColumnReference } from "./column-
|
|
3
|
-
import { _ as isUnsafeSchemaSql,
|
|
2
|
+
import { r as isColumnReference, u as generatedSchemaObjectName } from "./column-D-8OqGuV.mjs";
|
|
3
|
+
import { _ as isUnsafeSchemaSql, n as defaultSchemaNamingPolicy, y as renderSchemaExpression } from "./registry-CXV8u7Pt.mjs";
|
|
4
4
|
import { t as createSchemaDialect } from "./dialect-b2-Z6uBF.mjs";
|
|
5
5
|
import { a as toSnapshotJsonValue, f as schemaSnapshotFormat, i as schemaSnapshotDigest, o as SnapshotValidationError, r as encodeCanonicalSnapshot, s as assertSchemaSnapshot, u as neutralSnapshotDialect } from "./canonical-BbnqavJm.mjs";
|
|
6
6
|
//#region src/snapshot/serialize.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as assertSchemaSnapshot } from "./canonical-BbnqavJm.mjs";
|
|
2
|
-
import { a as sqliteStorageAffinity } from "./sqlite-
|
|
2
|
+
import { a as sqliteStorageAffinity } from "./sqlite-CrsK0Fza.mjs";
|
|
3
3
|
//#region src/introspection/diagnostics.ts
|
|
4
4
|
/**
|
|
5
5
|
* Create one immutable diagnostic without interpreting catalog text or
|
package/dist/snapshot.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as SnapshotStorage, C as SnapshotIndexTerm, D as SnapshotLiteral, E as SnapshotKeyConstraint, F as neutralSnapshotDialect,
|
|
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, E as SnapshotKeyConstraint, F as neutralSnapshotDialect, I as schemaSnapshotDialectVersion, Ir as SchemaDialect, L as schemaSnapshotFormat, Lr as SchemaDialectHooks, M as SnapshotTable, N as SnapshotUniqueConstraint, O as SnapshotNamingPolicy, P as SnapshotValidationContext, R as schemaSnapshotNamingPolicyVersion, Rr as createSchemaDialect, S as SnapshotIndex, T as SnapshotJsonValue, Xs as PortableColumnStorage, _ 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, j as SnapshotStorageContext, k as SnapshotSpecialNumber, l as SnapshotCreateResult, m as SnapshotDialect, n as SchemaSnapshot, o as SnapshotCheckConstraint, p as SnapshotDiagnosticCode, qs as NativeColumnStorage, r as SchemaSnapshotAdapter, s as SnapshotColumn, t as AnySchema, u as SnapshotDecodeResult, v as SnapshotExtensionContext, w as SnapshotIndexTermExpression, x as SnapshotIdentity, y as SnapshotForeignKey, z as schemaSnapshotVersion } from "./types-Deo_q43Y.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-BavBtv8J.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-DH0qV6aS.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,8 @@
|
|
|
1
1
|
import { t as createSchemaDialect } from "./dialect-b2-Z6uBF.mjs";
|
|
2
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-BbnqavJm.mjs";
|
|
3
|
-
import { a as encodeSnapshot, i as encodeSchemaSnapshot, n as createSchemaSnapshot, o as serializeSchema, r as digestSchemaSnapshot, s as tryCreateSchemaSnapshot, t as SnapshotSerializationError } from "./serialize-
|
|
4
|
-
import { a as sqliteStorageAffinity, i as sqliteSnapshotDialect, n as sqliteSchemaDialect, o as tryCreateSqliteSchemaSnapshot, r as sqliteSnapshotAdapter, t as createSqliteSchemaSnapshot } from "./sqlite-
|
|
3
|
+
import { a as encodeSnapshot, i as encodeSchemaSnapshot, n as createSchemaSnapshot, o as serializeSchema, r as digestSchemaSnapshot, s as tryCreateSchemaSnapshot, t as SnapshotSerializationError } from "./serialize-CFtYYAdk.mjs";
|
|
4
|
+
import { a as sqliteStorageAffinity, i as sqliteSnapshotDialect, n as sqliteSchemaDialect, o as tryCreateSqliteSchemaSnapshot, r as sqliteSnapshotAdapter, t as createSqliteSchemaSnapshot } from "./sqlite-CrsK0Fza.mjs";
|
|
5
5
|
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-D5Djh-zo.mjs";
|
|
6
|
-
import { a as tryCreatePostgresSchemaSnapshot, i as postgresSnapshotDialect, n as postgresSchemaDialect, r as postgresSnapshotAdapter, t as createPostgresSchemaSnapshot } from "./postgres-
|
|
7
|
-
import { a as tryCreateMysqlSchemaSnapshot, i as mysqlSnapshotDialect, n as mysqlSchemaDialect, r as mysqlSnapshotAdapter, t as createMysqlSchemaSnapshot } from "./mysql-
|
|
6
|
+
import { a as tryCreatePostgresSchemaSnapshot, i as postgresSnapshotDialect, n as postgresSchemaDialect, r as postgresSnapshotAdapter, t as createPostgresSchemaSnapshot } from "./postgres-BK2APkKP.mjs";
|
|
7
|
+
import { a as tryCreateMysqlSchemaSnapshot, i as mysqlSnapshotDialect, n as mysqlSchemaDialect, r as mysqlSnapshotAdapter, t as createMysqlSchemaSnapshot } from "./mysql-CKEKGnj4.mjs";
|
|
8
8
|
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,5 @@
|
|
|
1
|
-
import { t as createColumnReference } from "./column-
|
|
2
|
-
import {
|
|
1
|
+
import { m as resolveSqlNames, t as createColumnReference } from "./column-D-8OqGuV.mjs";
|
|
2
|
+
import { a as columnResultValue } from "./column-LV7oGQde.mjs";
|
|
3
3
|
//#region src/schema/source.ts
|
|
4
4
|
const sourceIdentity = Symbol("qubu.source.identity");
|
|
5
5
|
function createSource(sourceKind, render, reference, constraints = {}) {
|
|
@@ -24,7 +24,7 @@ function customSource(options) {
|
|
|
24
24
|
sqlName: definition.sqlName
|
|
25
25
|
})));
|
|
26
26
|
const columns = Object.fromEntries(Object.keys(options.columns).map((fieldName) => {
|
|
27
|
-
return [fieldName, createColumnReference(sqlNames[fieldName], source.reference, fieldName)];
|
|
27
|
+
return [fieldName, createColumnReference(sqlNames[fieldName], source.reference, fieldName, columnResultValue(options.columns[fieldName]))];
|
|
28
28
|
}));
|
|
29
29
|
Object.assign(source, {
|
|
30
30
|
identity: options.identity,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { r as isColumnReference } from "./column-
|
|
2
|
-
import {
|
|
1
|
+
import { d as isValidSchemaObjectName, r as isColumnReference } from "./column-D-8OqGuV.mjs";
|
|
2
|
+
import { _ as isUnsafeSchemaSql, m as validateConstraintDialect, w as validateIndexDialect, y as renderSchemaExpression } from "./registry-CXV8u7Pt.mjs";
|
|
3
3
|
import { t as createSchemaDialect } from "./dialect-b2-Z6uBF.mjs";
|
|
4
4
|
import { a as toSnapshotJsonValue } from "./canonical-BbnqavJm.mjs";
|
|
5
5
|
import { sqliteDialect } from "./sqlite.mjs";
|
|
6
|
-
import { n as createSchemaSnapshot, s as tryCreateSchemaSnapshot } from "./serialize-
|
|
6
|
+
import { n as createSchemaSnapshot, s as tryCreateSchemaSnapshot } from "./serialize-CFtYYAdk.mjs";
|
|
7
7
|
//#region src/snapshot/sqlite.ts
|
|
8
8
|
/** SQLite's v1 snapshot extension identity. */
|
|
9
9
|
const sqliteSnapshotDialect = Object.freeze({
|
package/dist/sqlite.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Cn as
|
|
1
|
+
import { An as excluded, Cn as ConflictTarget, Dn as OnConflictClause, En as ExcludedSource, On as doNothing, Sn as ConflictAction, Tn as DoUpdateAction, V as Dialect, jn as onConflict, kn as doUpdate, wn as DoNothingAction } from "./types-Deo_q43Y.mjs";
|
|
2
2
|
//#region src/dialects/sqlite.d.ts
|
|
3
3
|
declare function sqliteDialect(): Dialect<"json" | "on-conflict">;
|
|
4
4
|
//#endregion
|
package/dist/sqlite.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { o as createDialect, r as sqliteJson } from "./json-CUZlv4HT.mjs";
|
|
2
2
|
import { r as sqliteExplain } from "./explain-CkIK13L_.mjs";
|
|
3
|
-
import { i as onConflict, n as doUpdate, r as excluded, t as doNothing } from "./on-conflict-
|
|
3
|
+
import { i as onConflict, n as doUpdate, r as excluded, t as doNothing } from "./on-conflict-4MOBl51J.mjs";
|
|
4
4
|
//#region src/dialects/sqlite.ts
|
|
5
5
|
function renderSqliteSchemaLiteral(value) {
|
|
6
6
|
if (value === null) return "NULL";
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { F as resultValueOf, N as resultShapeValue, T as parenthesize, i as identifier, m as resolveSqlNames, p as materializeSchemaObjectRecord, t as createColumnReference } from "./column-D-8OqGuV.mjs";
|
|
2
|
+
import { a as columnResultValue } from "./column-LV7oGQde.mjs";
|
|
3
|
+
import { r as exposeColumns, t as createSource } from "./source-DGO3DRgg.mjs";
|
|
4
|
+
//#region src/schema/alias.ts
|
|
5
|
+
function alias(sourceOrQuery, name) {
|
|
6
|
+
const input = sourceOrQuery;
|
|
7
|
+
const reference = identifier(name);
|
|
8
|
+
const isQuery = "queryKind" in input;
|
|
9
|
+
const source = createSource(isQuery ? "query-alias" : "table-alias", (context) => {
|
|
10
|
+
if (isQuery) context.renderRelation(parenthesize(input));
|
|
11
|
+
else context.render(input);
|
|
12
|
+
context.append(" AS ");
|
|
13
|
+
context.render(reference);
|
|
14
|
+
}, reference);
|
|
15
|
+
const fieldNames = isQuery ? Object.keys(input.row) : Object.keys(input.columns);
|
|
16
|
+
const querySqlNames = isQuery ? resolveSqlNames(fieldNames.map((fieldName) => ({ fieldName }))) : void 0;
|
|
17
|
+
const columns = Object.fromEntries(fieldNames.map((fieldName) => {
|
|
18
|
+
const columnName = isQuery ? querySqlNames[fieldName] : input.columns[fieldName].columnName;
|
|
19
|
+
return [fieldName, createColumnReference(columnName, reference, fieldName, isQuery ? resultShapeValue(input.resultShape, fieldName) : resultValueOf(input.columns[fieldName]))];
|
|
20
|
+
}));
|
|
21
|
+
Object.assign(source, {
|
|
22
|
+
alias: name,
|
|
23
|
+
base: isQuery ? void 0 : input,
|
|
24
|
+
query: isQuery ? input : void 0,
|
|
25
|
+
constraints: isQuery ? {} : input.constraints,
|
|
26
|
+
indexes: isQuery ? {} : "indexes" in input ? input.indexes : {},
|
|
27
|
+
columns
|
|
28
|
+
});
|
|
29
|
+
exposeColumns(source, columns);
|
|
30
|
+
return source;
|
|
31
|
+
}
|
|
32
|
+
/** Render a query as a LATERAL source whose outer requirements stay visible. */
|
|
33
|
+
function lateral(query, name) {
|
|
34
|
+
const reference = identifier(name);
|
|
35
|
+
const source = createSource("lateral", (context) => {
|
|
36
|
+
context.append("LATERAL ");
|
|
37
|
+
context.renderRelation(parenthesize(query));
|
|
38
|
+
context.append(" AS ");
|
|
39
|
+
context.render(reference);
|
|
40
|
+
}, reference);
|
|
41
|
+
const sqlNames = resolveSqlNames(Object.keys(query.row).map((fieldName) => ({ fieldName })));
|
|
42
|
+
const columns = Object.fromEntries(Object.keys(query.row).map((fieldName) => [fieldName, createColumnReference(sqlNames[fieldName], reference, fieldName, resultShapeValue(query.resultShape, fieldName))]));
|
|
43
|
+
Object.assign(source, {
|
|
44
|
+
alias: name,
|
|
45
|
+
query,
|
|
46
|
+
columns
|
|
47
|
+
});
|
|
48
|
+
exposeColumns(source, columns);
|
|
49
|
+
return source;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/schema/table.ts
|
|
53
|
+
function table(name, definitions, metadata) {
|
|
54
|
+
const source = createSource("table", (context) => context.render(identifier(name)), identifier(name));
|
|
55
|
+
const sqlNames = resolveSqlNames(Object.entries(definitions).map(([fieldName, definition]) => ({
|
|
56
|
+
fieldName,
|
|
57
|
+
sqlName: definition.sqlName
|
|
58
|
+
})));
|
|
59
|
+
const columns = Object.fromEntries(Object.keys(definitions).map((fieldName) => {
|
|
60
|
+
const sqlName = sqlNames[fieldName];
|
|
61
|
+
return [fieldName, createColumnReference(sqlName, source.reference, fieldName, columnResultValue(definitions[fieldName]))];
|
|
62
|
+
}));
|
|
63
|
+
Object.assign(source, {
|
|
64
|
+
tableName: name,
|
|
65
|
+
definitions,
|
|
66
|
+
sqlNames,
|
|
67
|
+
columns,
|
|
68
|
+
constraints: {},
|
|
69
|
+
indexes: {}
|
|
70
|
+
});
|
|
71
|
+
exposeColumns(source, columns);
|
|
72
|
+
const resolvedMetadata = metadata ? metadata(source) : {
|
|
73
|
+
constraints: {},
|
|
74
|
+
indexes: {}
|
|
75
|
+
};
|
|
76
|
+
const constraints = materializeSchemaObjectRecord(resolvedMetadata.constraints, "constraint");
|
|
77
|
+
const indexes = Object.fromEntries(Object.entries(resolvedMetadata.indexes).map(([indexName, tableIndex]) => {
|
|
78
|
+
const candidateKey = tableIndex.unique && tableIndex.predicate === void 0 && tableIndex.terms.every((term) => {
|
|
79
|
+
const expression = "orderKind" in term ? term.expression : term;
|
|
80
|
+
return expression.expressionKind === "column" && definitions[expression.fieldName]?.nullable === false;
|
|
81
|
+
});
|
|
82
|
+
return [indexName, Object.freeze({
|
|
83
|
+
...tableIndex,
|
|
84
|
+
candidateKey
|
|
85
|
+
})];
|
|
86
|
+
}));
|
|
87
|
+
const namedIndexes = materializeSchemaObjectRecord(indexes, "index");
|
|
88
|
+
Object.assign(source, {
|
|
89
|
+
...resolvedMetadata,
|
|
90
|
+
constraints,
|
|
91
|
+
indexes: namedIndexes
|
|
92
|
+
});
|
|
93
|
+
return source;
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
export { alias as n, lateral as r, table as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { As as ColumnInsertInput, Fs as ColumnOutput, Gs as ColumnUpdateInput, Hs as ColumnStorageOf, Os as ColumnHasDefault, Xs as PortableColumnStorage, js as ColumnIsGenerated, ks as ColumnIdentityOf, oi as SchemaTableRecord, qs as NativeColumnStorage } from "./types-Deo_q43Y.mjs";
|
|
2
2
|
//#region src/drizzle/types.d.ts
|
|
3
3
|
/** SQL engines supported by the Qubu-to-Drizzle runtime adapter. */
|
|
4
4
|
type DrizzleDialect = 'postgresql' | 'mysql' | 'sqlite';
|