qubu 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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-BavBtv8J.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-DH0qV6aS.d.mts → index-1DpA3mUh.d.mts} +20 -20
- package/dist/{index-D3ZOwPT-.d.mts → index-CPvfEheG.d.mts} +13 -15
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +94 -95
- 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-CKEKGnj4.mjs → mysql-B_cYzzX2.mjs} +237 -7
- package/dist/mysql.d.mts +2 -2
- package/dist/mysql.mjs +3 -3
- package/dist/{on-conflict-4MOBl51J.mjs → on-conflict-hfPW0KmQ.mjs} +3 -4
- package/dist/postgres.d.mts +5 -5
- package/dist/postgres.mjs +6 -6
- package/dist/{registry-CXV8u7Pt.mjs → registry-BRMLYwDp.mjs} +26 -29
- package/dist/{relational-DuQ9IHSb.mjs → relational-BZ3WDPzC.mjs} +2 -2
- package/dist/schema.d.mts +1 -1
- package/dist/schema.mjs +5 -6
- package/dist/{snapshot-DJpfmxhQ.mjs → snapshot-C-W65HEd.mjs} +5 -5
- package/dist/snapshot.d.mts +3 -3
- package/dist/snapshot.mjs +5 -7
- package/dist/{source-DGO3DRgg.mjs → source-BcS2AsIg.mjs} +6 -8
- package/dist/{serialize-CFtYYAdk.mjs → sqlite-Cg0nwYEH.mjs} +326 -12
- package/dist/sqlite.d.mts +1 -1
- package/dist/sqlite.mjs +2 -2
- package/dist/{standard-BTVYKh_F.mjs → standard-DfcZEVOj.mjs} +1 -1
- package/dist/{table-D6rcs8SB.mjs → table-Bp5irMSj.mjs} +2 -3
- package/dist/{types-Deo_q43Y.d.mts → types-BK1COGZe.d.mts} +1113 -1128
- package/dist/{types-g-vVvj1B.mjs → types-JM3FcAnX.mjs} +7 -8
- package/dist/{types-CSNJTYaM.d.mts → types-JSZHpUEj.d.mts} +83 -84
- package/dist/{value-b6OFZXVS.mjs → value-Bi71Agyf.mjs} +1 -1
- package/dist/vite/ambient.d.ts +309 -340
- package/dist/vite.d.mts +5 -6
- package/dist/vite.mjs +3 -4
- package/docs/dialects-and-execution.md +45 -55
- 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 +26 -26
- 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-D-8OqGuV.mjs +0 -328
- package/dist/column-LV7oGQde.mjs +0 -296
- 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 -57
- 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/postgres-BK2APkKP.mjs +0 -236
- package/dist/runtime-Cn_Xgzta.mjs +0 -193
- package/dist/sqlite-CrsK0Fza.mjs +0 -320
- package/dist/types-DZsueVoI.d.mts +0 -45
package/dist/column-D-8OqGuV.mjs
DELETED
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
import { a as assertDialectCapability } from "./json-CUZlv4HT.mjs";
|
|
2
|
-
//#region src/result.ts
|
|
3
|
-
const resultValueMetadata = Symbol("qubu.result-value-metadata");
|
|
4
|
-
function resultValue(type, decoder) {
|
|
5
|
-
return type === void 0 && decoder === void 0 ? void 0 : Object.freeze({
|
|
6
|
-
...type === void 0 ? {} : { type },
|
|
7
|
-
...decoder === void 0 ? {} : { decoder }
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
function resultValueOf(value) {
|
|
11
|
-
if (typeof value !== "object" || value === null) return void 0;
|
|
12
|
-
return value[resultValueMetadata];
|
|
13
|
-
}
|
|
14
|
-
function attachResultValue(value, metadata) {
|
|
15
|
-
if (metadata === void 0) return value;
|
|
16
|
-
return Object.freeze({
|
|
17
|
-
...value,
|
|
18
|
-
[resultValueMetadata]: metadata
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
function createResultShape(fields) {
|
|
22
|
-
return Object.freeze({ fields: Object.freeze(fields.map((field) => Object.freeze({ ...field }))) });
|
|
23
|
-
}
|
|
24
|
-
function resultShapeValue(shape, name) {
|
|
25
|
-
const field = shape.fields.find((candidate) => candidate.name === name);
|
|
26
|
-
return field === void 0 ? void 0 : resultValue(field.type, field.decoder);
|
|
27
|
-
}
|
|
28
|
-
/** Decode SQLite/MySQL-style boolean values while accepting native booleans. */
|
|
29
|
-
const booleanResultDecoder = (value) => {
|
|
30
|
-
if (typeof value === "boolean") return value;
|
|
31
|
-
if (value === 0 || value === 0n) return false;
|
|
32
|
-
if (value === 1 || value === 1n) return true;
|
|
33
|
-
throw new TypeError("Expected a boolean or numeric 0/1 result");
|
|
34
|
-
};
|
|
35
|
-
/** Decode a SQL DATE string as a JavaScript Date at UTC midnight. */
|
|
36
|
-
const dateResultDecoder = (value) => {
|
|
37
|
-
if (value instanceof Date && !Number.isNaN(value.getTime())) return value;
|
|
38
|
-
if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}$/u.test(value)) throw new TypeError("Expected a valid Date or YYYY-MM-DD result");
|
|
39
|
-
const decoded = /* @__PURE__ */ new Date(`${value}T00:00:00.000Z`);
|
|
40
|
-
if (Number.isNaN(decoded.getTime()) || decoded.toISOString().slice(0, 10) !== value) throw new TypeError("Expected a valid calendar date result");
|
|
41
|
-
return decoded;
|
|
42
|
-
};
|
|
43
|
-
/** Decode a SQL/ISO timestamp string while accepting driver-created Dates. */
|
|
44
|
-
const timestampResultDecoder = (value) => {
|
|
45
|
-
if (value instanceof Date && !Number.isNaN(value.getTime())) return value;
|
|
46
|
-
if (typeof value !== "string") throw new TypeError("Expected a valid Date or timestamp string result");
|
|
47
|
-
const normalized = value.includes("T") ? value : value.replace(" ", "T");
|
|
48
|
-
const decoded = new Date(/(?:Z|[+-]\d{2}:?\d{2})$/u.test(normalized) ? normalized : `${normalized}Z`);
|
|
49
|
-
if (Number.isNaN(decoded.getTime())) throw new TypeError("Expected a valid timestamp result");
|
|
50
|
-
return decoded;
|
|
51
|
-
};
|
|
52
|
-
/** Decode a serialized JSON result. Use only when the adapter returns JSON text. */
|
|
53
|
-
const jsonTextResultDecoder = (value) => {
|
|
54
|
-
if (typeof value !== "string") return value;
|
|
55
|
-
return JSON.parse(value);
|
|
56
|
-
};
|
|
57
|
-
/** Error raised when a projected driver value cannot be decoded. */
|
|
58
|
-
var ResultDecodingError = class extends TypeError {
|
|
59
|
-
name = "ResultDecodingError";
|
|
60
|
-
field;
|
|
61
|
-
rowIndex;
|
|
62
|
-
resultType;
|
|
63
|
-
constructor(field, rowIndex, resultType) {
|
|
64
|
-
super(`Could not decode result field "${field}" in row ${rowIndex}${resultType === void 0 ? "" : ` as ${resultType}`}`);
|
|
65
|
-
this.field = field;
|
|
66
|
-
this.rowIndex = rowIndex;
|
|
67
|
-
this.resultType = resultType;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
function decodeResultRow(row, shape, decoders, dialect, rowIndex) {
|
|
71
|
-
let decoded;
|
|
72
|
-
for (const field of shape.fields) {
|
|
73
|
-
const decoder = field.decoder ?? (field.type ? decoders?.[field.type] : void 0);
|
|
74
|
-
if (decoder === void 0 || row[field.name] === null) continue;
|
|
75
|
-
try {
|
|
76
|
-
decoded ??= { ...row };
|
|
77
|
-
decoded[field.name] = decoder(row[field.name], {
|
|
78
|
-
dialect,
|
|
79
|
-
field: field.name,
|
|
80
|
-
rowIndex
|
|
81
|
-
});
|
|
82
|
-
} catch {
|
|
83
|
-
throw new ResultDecodingError(field.name, rowIndex, field.type);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return decoded ?? row;
|
|
87
|
-
}
|
|
88
|
-
//#endregion
|
|
89
|
-
//#region src/core/fragment.ts
|
|
90
|
-
function fragment(render) {
|
|
91
|
-
return Object.freeze({ render });
|
|
92
|
-
}
|
|
93
|
-
function sequence(parts, separator = " ") {
|
|
94
|
-
return fragment((context) => {
|
|
95
|
-
let first = true;
|
|
96
|
-
for (const part of parts) {
|
|
97
|
-
if (!first) context.append(separator);
|
|
98
|
-
context.render(part);
|
|
99
|
-
first = false;
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
function parenthesize(part) {
|
|
104
|
-
return fragment((context) => {
|
|
105
|
-
context.append("(");
|
|
106
|
-
context.render(part);
|
|
107
|
-
context.append(")");
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
function isFragment(value) {
|
|
111
|
-
return typeof value === "object" && value !== null && "render" in value && typeof value.render === "function";
|
|
112
|
-
}
|
|
113
|
-
//#endregion
|
|
114
|
-
//#region src/expressions/types.ts
|
|
115
|
-
/** Runtime/type-level proof that an expression is safe to use in schema SQL. */
|
|
116
|
-
const schemaExpressionBrand = Symbol("qubu.schema-expression");
|
|
117
|
-
/** Add a concrete dialect requirement without dropping expression metadata. */
|
|
118
|
-
function withDialectCapability(expression, capability) {
|
|
119
|
-
const wrapped = makeExpression(expression.expressionKind, (context) => {
|
|
120
|
-
assertDialectCapability(context.dialect, capability);
|
|
121
|
-
context.render(expression);
|
|
122
|
-
}, expression.expressionCategory, resultValueOf(expression));
|
|
123
|
-
return isSchemaExpression(expression) ? markSchemaExpression(wrapped) : wrapped;
|
|
124
|
-
}
|
|
125
|
-
function makeExpression(expressionKind, render, expressionCategory, result) {
|
|
126
|
-
return attachResultValue(Object.freeze({
|
|
127
|
-
expressionKind,
|
|
128
|
-
...expressionCategory ? { expressionCategory } : {},
|
|
129
|
-
...fragment(render)
|
|
130
|
-
}), result);
|
|
131
|
-
}
|
|
132
|
-
/** Mark a query-only expression category without changing its SQL renderer. */
|
|
133
|
-
function markExpressionCategory(expression, category) {
|
|
134
|
-
return Object.freeze({
|
|
135
|
-
...expression,
|
|
136
|
-
expressionCategory: category
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Mark a built-in or explicitly audited renderer as schema-deterministic.
|
|
141
|
-
* Prefer {@link defineSchemaExpression} for application extensions because it
|
|
142
|
-
* supplies a restricted schema rendering context.
|
|
143
|
-
*/
|
|
144
|
-
function makeSchemaExpression(expressionKind, render, result) {
|
|
145
|
-
const expression = makeExpression(expressionKind, render, void 0, result);
|
|
146
|
-
return Object.freeze({
|
|
147
|
-
...expression,
|
|
148
|
-
[schemaExpressionBrand]: true
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
/** Add the schema-determinism brand to an explicitly audited expression. */
|
|
152
|
-
function markSchemaExpression(expression) {
|
|
153
|
-
if (isSchemaExpression(expression)) return expression;
|
|
154
|
-
return Object.freeze({
|
|
155
|
-
...expression,
|
|
156
|
-
[schemaExpressionBrand]: true
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
/** Test the runtime brand used by schema rendering and validation. */
|
|
160
|
-
function isSchemaExpression(value) {
|
|
161
|
-
return typeof value === "object" && value !== null && schemaExpressionBrand in value && value[schemaExpressionBrand] === true;
|
|
162
|
-
}
|
|
163
|
-
function isExpression(value) {
|
|
164
|
-
return typeof value === "object" && value !== null && "expressionKind" in value && "render" in value && typeof value.render === "function";
|
|
165
|
-
}
|
|
166
|
-
//#endregion
|
|
167
|
-
//#region src/core/naming.ts
|
|
168
|
-
/** Convert an application-facing field name to a SQL-facing identifier. */
|
|
169
|
-
function snakeCaseIdentifier(name) {
|
|
170
|
-
return name.replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2").replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[-\s]+/g, "_").toLowerCase();
|
|
171
|
-
}
|
|
172
|
-
function resolveSqlNames(fields) {
|
|
173
|
-
const sqlNames = {};
|
|
174
|
-
const fieldsBySqlName = /* @__PURE__ */ new Map();
|
|
175
|
-
for (const field of fields) {
|
|
176
|
-
const sqlName = field.sqlName ?? snakeCaseIdentifier(field.fieldName);
|
|
177
|
-
if (sqlName.length === 0) throw new Error(`SQL name for field "${field.fieldName}" cannot be empty`);
|
|
178
|
-
const existingField = fieldsBySqlName.get(sqlName);
|
|
179
|
-
if (existingField) throw new Error(`Fields "${existingField}" and "${field.fieldName}" both resolve to SQL name "${sqlName}"`);
|
|
180
|
-
fieldsBySqlName.set(sqlName, field.fieldName);
|
|
181
|
-
sqlNames[field.fieldName] = sqlName;
|
|
182
|
-
}
|
|
183
|
-
return Object.freeze(sqlNames);
|
|
184
|
-
}
|
|
185
|
-
//#endregion
|
|
186
|
-
//#region src/schema/metadata.ts
|
|
187
|
-
/** Error raised when relational metadata cannot be represented safely. */
|
|
188
|
-
var SchemaMetadataValidationError = class extends TypeError {
|
|
189
|
-
name = "SchemaMetadataValidationError";
|
|
190
|
-
diagnostics;
|
|
191
|
-
issues;
|
|
192
|
-
constructor(diagnostics) {
|
|
193
|
-
const frozenDiagnostics = Object.freeze(diagnostics.map((diagnostic) => Object.freeze({
|
|
194
|
-
...diagnostic,
|
|
195
|
-
path: Object.freeze([...diagnostic.path]),
|
|
196
|
-
relatedPaths: diagnostic.relatedPaths ? Object.freeze(diagnostic.relatedPaths.map((path) => Object.freeze([...path]))) : void 0
|
|
197
|
-
})));
|
|
198
|
-
super(frozenDiagnostics.map((diagnostic) => diagnostic.message).join("\n"));
|
|
199
|
-
this.diagnostics = frozenDiagnostics;
|
|
200
|
-
this.issues = frozenDiagnostics;
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
/** Generate the version-one physical name for a relational object ID. */
|
|
204
|
-
function generatedSchemaObjectName(id) {
|
|
205
|
-
return snakeCaseIdentifier(id);
|
|
206
|
-
}
|
|
207
|
-
/** Deep-freeze plain metadata values without introducing executable nodes. */
|
|
208
|
-
function freezeSchemaMetadata(value) {
|
|
209
|
-
if (Array.isArray(value)) return Object.freeze(value.map((item) => freezeSchemaMetadata(item)));
|
|
210
|
-
if (typeof value !== "object" || value === null) return value;
|
|
211
|
-
const frozen = Object.fromEntries(Object.entries(value).map(([key, nested]) => [key, freezeSchemaMetadata(nested)]));
|
|
212
|
-
return Object.freeze(frozen);
|
|
213
|
-
}
|
|
214
|
-
/** Check the portable identifier subset used for generated metadata names. */
|
|
215
|
-
function isValidSchemaObjectName(name) {
|
|
216
|
-
return name.length > 0 && name === name.trim() && !/[.\\/\u0000-\u001f\u007f"']/u.test(name);
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Attach a record key and resolved physical name without changing the
|
|
220
|
-
* enumerable shape of legacy constraint/index values. The properties are
|
|
221
|
-
* still ordinary read-only runtime metadata and are available to snapshot
|
|
222
|
-
* traversals.
|
|
223
|
-
*/
|
|
224
|
-
function materializeSchemaObjectIdentity(value, id, physicalName) {
|
|
225
|
-
const materialized = { ...value };
|
|
226
|
-
Object.defineProperties(materialized, {
|
|
227
|
-
id: {
|
|
228
|
-
configurable: false,
|
|
229
|
-
enumerable: false,
|
|
230
|
-
value: id,
|
|
231
|
-
writable: false
|
|
232
|
-
},
|
|
233
|
-
physicalName: {
|
|
234
|
-
configurable: false,
|
|
235
|
-
enumerable: false,
|
|
236
|
-
value: physicalName ?? generatedSchemaObjectName(id),
|
|
237
|
-
writable: false
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
return Object.freeze(materialized);
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Resolve and validate names for one metadata record. The caller decides
|
|
244
|
-
* whether constraint and index names share a database namespace.
|
|
245
|
-
*/
|
|
246
|
-
function materializeSchemaObjectRecord(record, kind) {
|
|
247
|
-
const diagnostics = [];
|
|
248
|
-
const names = /* @__PURE__ */ new Map();
|
|
249
|
-
const result = {};
|
|
250
|
-
for (const [id, value] of Object.entries(record)) {
|
|
251
|
-
const physicalName = value.physicalName ?? generatedSchemaObjectName(id);
|
|
252
|
-
const path = [kind === "constraint" ? "constraints" : "indexes", id];
|
|
253
|
-
if (!isValidSchemaObjectName(physicalName)) diagnostics.push({
|
|
254
|
-
code: "invalid-physical-name",
|
|
255
|
-
message: `The ${kind} "${id}" has invalid physical name "${physicalName}"`,
|
|
256
|
-
path: [...path, "physicalName"]
|
|
257
|
-
});
|
|
258
|
-
const previousId = names.get(physicalName);
|
|
259
|
-
if (previousId !== void 0) diagnostics.push({
|
|
260
|
-
code: "duplicate-physical-name",
|
|
261
|
-
message: `The ${kind}s "${previousId}" and "${id}" both use physical name "${physicalName}"`,
|
|
262
|
-
path: [...path, "physicalName"],
|
|
263
|
-
relatedPaths: [[
|
|
264
|
-
kind === "constraint" ? "constraints" : "indexes",
|
|
265
|
-
previousId,
|
|
266
|
-
"physicalName"
|
|
267
|
-
]]
|
|
268
|
-
});
|
|
269
|
-
else names.set(physicalName, id);
|
|
270
|
-
result[id] = materializeSchemaObjectIdentity(value, id, physicalName);
|
|
271
|
-
}
|
|
272
|
-
if (diagnostics.length > 0) throw new SchemaMetadataValidationError(diagnostics);
|
|
273
|
-
return Object.freeze(result);
|
|
274
|
-
}
|
|
275
|
-
/** Return a diagnostic when a dialect extension is used by another adapter. */
|
|
276
|
-
function dialectMismatchDiagnostic(extension, dialect, path) {
|
|
277
|
-
if (extension.dialect === dialect) return void 0;
|
|
278
|
-
return {
|
|
279
|
-
code: "dialect-mismatch",
|
|
280
|
-
message: `Dialect extension belongs to "${extension.dialect}" but the active schema dialect is "${dialect}"`,
|
|
281
|
-
path,
|
|
282
|
-
dialect
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
/** Throw a structured error for one or more dialect capability findings. */
|
|
286
|
-
function assertSchemaDialectSupport(diagnostics) {
|
|
287
|
-
if (diagnostics.length > 0) throw new SchemaMetadataValidationError(diagnostics);
|
|
288
|
-
}
|
|
289
|
-
//#endregion
|
|
290
|
-
//#region src/core/primitives/identifier.ts
|
|
291
|
-
function identifier(name) {
|
|
292
|
-
return fragment((context) => context.append(context.dialect.quoteIdentifier(name)));
|
|
293
|
-
}
|
|
294
|
-
function qualifiedIdentifier(...parts) {
|
|
295
|
-
return fragment((context) => {
|
|
296
|
-
parts.forEach((part, index) => {
|
|
297
|
-
if (index > 0) context.append(".");
|
|
298
|
-
context.append(context.dialect.quoteIdentifier(part));
|
|
299
|
-
});
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
//#endregion
|
|
303
|
-
//#region src/expressions/column.ts
|
|
304
|
-
function createColumnReference(columnName, sourceReference, fieldName, result) {
|
|
305
|
-
const expression = makeSchemaExpression("column", (context) => {
|
|
306
|
-
if (context.renderColumnReference) {
|
|
307
|
-
context.renderColumnReference(columnName);
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
context.render(sourceReference);
|
|
311
|
-
context.append(".");
|
|
312
|
-
context.render(identifier(columnName));
|
|
313
|
-
}, result);
|
|
314
|
-
return Object.freeze({
|
|
315
|
-
...expression,
|
|
316
|
-
fieldName,
|
|
317
|
-
columnName
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
function isColumnReference(value) {
|
|
321
|
-
return typeof value === "object" && value !== null && "expressionKind" in value && value.expressionKind === "column";
|
|
322
|
-
}
|
|
323
|
-
/** Turn an expression into a fragment that renders it without changing it. */
|
|
324
|
-
function expressionFragment(expression) {
|
|
325
|
-
return fragment((context) => context.render(expression));
|
|
326
|
-
}
|
|
327
|
-
//#endregion
|
|
328
|
-
export { dateResultDecoder as A, fragment as C, ResultDecodingError as D, sequence as E, resultValueOf as F, timestampResultDecoder as I, jsonTextResultDecoder as M, resultShapeValue as N, booleanResultDecoder as O, resultValue as P, withDialectCapability as S, parenthesize as T, isSchemaExpression as _, qualifiedIdentifier as a, markExpressionCategory as b, dialectMismatchDiagnostic as c, isValidSchemaObjectName as d, materializeSchemaObjectIdentity as f, isExpression as g, snakeCaseIdentifier as h, identifier as i, decodeResultRow as j, createResultShape as k, freezeSchemaMetadata as l, resolveSqlNames as m, expressionFragment as n, SchemaMetadataValidationError as o, materializeSchemaObjectRecord as p, isColumnReference as r, assertSchemaDialectSupport as s, createColumnReference as t, generatedSchemaObjectName as u, makeExpression as v, isFragment as w, markSchemaExpression as x, makeSchemaExpression as y };
|
package/dist/column-LV7oGQde.mjs
DELETED
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
import { P as resultValue, _ as isSchemaExpression, l as freezeSchemaMetadata } from "./column-D-8OqGuV.mjs";
|
|
2
|
-
//#region src/schema/column-behavior.ts
|
|
3
|
-
/** A column behavior error with a stable code and optional property path. */
|
|
4
|
-
var ColumnBehaviorError = class extends TypeError {
|
|
5
|
-
code;
|
|
6
|
-
path;
|
|
7
|
-
constructor(code, message, path) {
|
|
8
|
-
super(message);
|
|
9
|
-
this.name = "ColumnBehaviorError";
|
|
10
|
-
this.code = code;
|
|
11
|
-
this.path = path;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
/** Build a canonical literal node from a supported JavaScript scalar. */
|
|
15
|
-
function canonicalLiteral(value) {
|
|
16
|
-
if (value === null) return Object.freeze({ kind: "null" });
|
|
17
|
-
if (typeof value === "boolean") return Object.freeze({
|
|
18
|
-
kind: "boolean",
|
|
19
|
-
value
|
|
20
|
-
});
|
|
21
|
-
if (typeof value === "string") return Object.freeze({
|
|
22
|
-
kind: "string",
|
|
23
|
-
value
|
|
24
|
-
});
|
|
25
|
-
if (typeof value === "bigint") return Object.freeze({
|
|
26
|
-
kind: "bigint",
|
|
27
|
-
value: String(value)
|
|
28
|
-
});
|
|
29
|
-
if (!Number.isFinite(value)) throw new ColumnBehaviorError("invalid-default", "Default literal numbers must be finite", "default.value");
|
|
30
|
-
return Object.freeze({
|
|
31
|
-
kind: "number",
|
|
32
|
-
value: Object.is(value, -0) ? "0" : String(value)
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
function literalDefault(value) {
|
|
36
|
-
return Object.freeze({
|
|
37
|
-
kind: "literal",
|
|
38
|
-
value: canonicalLiteral(value)
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
/** Normalize a public default input into its canonical snapshot descriptor. */
|
|
42
|
-
function normalizeDefault(value) {
|
|
43
|
-
if (isSchemaExpression(value)) return Object.freeze({
|
|
44
|
-
kind: "expression",
|
|
45
|
-
expression: value
|
|
46
|
-
});
|
|
47
|
-
if (isExternalDefaultDescriptor(value)) return externalDefault();
|
|
48
|
-
return literalDefault(value);
|
|
49
|
-
}
|
|
50
|
-
/** Mark a legacy or externally managed database default explicitly. */
|
|
51
|
-
function externalDefault() {
|
|
52
|
-
return Object.freeze({ kind: "external" });
|
|
53
|
-
}
|
|
54
|
-
/** Create an immutable generated-column descriptor. */
|
|
55
|
-
function generatedColumn(expression, mode) {
|
|
56
|
-
assertSchemaExpression(expression, "generatedColumn.expression", "invalid-generated-column");
|
|
57
|
-
const resolvedMode = typeof mode === "string" ? mode : mode?.mode ?? "stored";
|
|
58
|
-
if (resolvedMode !== "stored" && resolvedMode !== "virtual") throw new ColumnBehaviorError("invalid-generated-column", `Generated-column mode must be "stored" or "virtual", received "${String(resolvedMode)}"`, "generatedColumn.mode");
|
|
59
|
-
return Object.freeze({
|
|
60
|
-
kind: "expression",
|
|
61
|
-
expression,
|
|
62
|
-
mode: resolvedMode
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
/** Mark a legacy or externally managed generated column explicitly. */
|
|
66
|
-
function externalGeneratedColumn() {
|
|
67
|
-
return Object.freeze({ kind: "external" });
|
|
68
|
-
}
|
|
69
|
-
/** Describe a database identity column without inventing a generated SQL expression. */
|
|
70
|
-
function identityColumn(generation, options) {
|
|
71
|
-
const resolvedGeneration = generation ?? "by-default";
|
|
72
|
-
if (resolvedGeneration !== "always" && resolvedGeneration !== "by-default") throw new ColumnBehaviorError("invalid-identity", `Identity generation must be "always" or "by-default", received "${String(resolvedGeneration)}"`, "identity.generation");
|
|
73
|
-
return Object.freeze({
|
|
74
|
-
kind: "identity",
|
|
75
|
-
generation: resolvedGeneration,
|
|
76
|
-
...options?.dialect === void 0 ? {} : { dialect: freezeSchemaMetadata(options.dialect) }
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
/** Normalize complete and legacy column behavior into immutable metadata. */
|
|
80
|
-
function resolveColumnBehavior(options) {
|
|
81
|
-
const hasDefaultFlag = options.hasDefault === true;
|
|
82
|
-
const generatedFlag = options.generated === true;
|
|
83
|
-
const defaultDescriptor = options.default === void 0 ? void 0 : normalizeDefault(options.default);
|
|
84
|
-
const generatedDescriptor = options.generatedColumn;
|
|
85
|
-
const identityDescriptor = options.identity;
|
|
86
|
-
const onUpdateExpression = options.onUpdate;
|
|
87
|
-
if (onUpdateExpression !== void 0 && !isSchemaExpression(onUpdateExpression)) throw new ColumnBehaviorError("invalid-on-update", "Column onUpdate metadata must carry the deterministic schema-expression brand", "onUpdate");
|
|
88
|
-
if (defaultDescriptor !== void 0) {
|
|
89
|
-
assertDefaultDescriptor(defaultDescriptor);
|
|
90
|
-
if (options.hasDefault === false) throw new ColumnBehaviorError("default-flag-conflict", "A complete default descriptor cannot be combined with hasDefault: false", "hasDefault");
|
|
91
|
-
if (generatedDescriptor !== void 0 || identityDescriptor !== void 0) throw new ColumnBehaviorError("default-generated-conflict", "A column cannot declare a complete default together with generated-column or identity metadata", "default");
|
|
92
|
-
if (generatedFlag) throw new ColumnBehaviorError("default-generated-conflict", "A complete default descriptor cannot be combined with generated: true", "default");
|
|
93
|
-
}
|
|
94
|
-
if (generatedDescriptor !== void 0) {
|
|
95
|
-
assertGeneratedColumnDescriptor(generatedDescriptor);
|
|
96
|
-
if (options.generated === false) throw new ColumnBehaviorError("generated-flag-conflict", "A complete generated-column descriptor cannot be combined with generated: false", "generated");
|
|
97
|
-
if (identityDescriptor !== void 0) throw new ColumnBehaviorError("identity-generated-conflict", "A column cannot declare both generated-column and identity metadata", "generatedColumn");
|
|
98
|
-
if (hasDefaultFlag) throw new ColumnBehaviorError("default-generated-conflict", "A complete generated-column descriptor cannot be combined with hasDefault: true", "generatedColumn");
|
|
99
|
-
}
|
|
100
|
-
if (identityDescriptor !== void 0) {
|
|
101
|
-
assertIdentityDescriptor(identityDescriptor);
|
|
102
|
-
if (options.generated === false) throw new ColumnBehaviorError("generated-flag-conflict", "Identity metadata cannot be combined with generated: false", "generated");
|
|
103
|
-
if (hasDefaultFlag) throw new ColumnBehaviorError("identity-generated-conflict", "Identity metadata cannot be combined with hasDefault: true", "identity");
|
|
104
|
-
}
|
|
105
|
-
const normalizedDefault = defaultDescriptor === void 0 ? void 0 : freezeDefaultDescriptor(defaultDescriptor);
|
|
106
|
-
const normalizedGenerated = generatedDescriptor === void 0 ? void 0 : freezeGeneratedColumnDescriptor(generatedDescriptor);
|
|
107
|
-
const normalizedIdentity = identityDescriptor === void 0 ? void 0 : freezeIdentityDescriptor(identityDescriptor);
|
|
108
|
-
return Object.freeze({
|
|
109
|
-
hasDefault: hasDefaultFlag || normalizedDefault !== void 0,
|
|
110
|
-
generated: generatedFlag || normalizedGenerated !== void 0 || normalizedIdentity !== void 0,
|
|
111
|
-
default: normalizedDefault ?? (hasDefaultFlag ? externalDefault() : void 0),
|
|
112
|
-
generatedColumn: normalizedGenerated ?? (generatedFlag && normalizedIdentity === void 0 ? externalGeneratedColumn() : void 0),
|
|
113
|
-
identity: normalizedIdentity,
|
|
114
|
-
onUpdate: onUpdateExpression
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
function freezeDefaultDescriptor(value) {
|
|
118
|
-
if (value.kind === "external") return externalDefault();
|
|
119
|
-
if (value.kind === "expression") return Object.freeze({
|
|
120
|
-
kind: "expression",
|
|
121
|
-
expression: value.expression
|
|
122
|
-
});
|
|
123
|
-
return Object.freeze({
|
|
124
|
-
kind: "literal",
|
|
125
|
-
value: Object.freeze({ ...value.value })
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
function isExternalDefaultDescriptor(value) {
|
|
129
|
-
return typeof value === "object" && value !== null && value.kind === "external";
|
|
130
|
-
}
|
|
131
|
-
function freezeGeneratedColumnDescriptor(value) {
|
|
132
|
-
if (value.kind === "external") return externalGeneratedColumn();
|
|
133
|
-
return Object.freeze({
|
|
134
|
-
kind: "expression",
|
|
135
|
-
expression: value.expression,
|
|
136
|
-
mode: value.mode
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
function freezeIdentityDescriptor(value) {
|
|
140
|
-
return Object.freeze({
|
|
141
|
-
kind: "identity",
|
|
142
|
-
generation: value.generation,
|
|
143
|
-
...value.dialect === void 0 ? {} : { dialect: freezeSchemaMetadata(value.dialect) }
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
function assertSchemaExpression(expression, path, code = "invalid-default") {
|
|
147
|
-
if (!isSchemaExpression(expression)) throw new ColumnBehaviorError(code, "Schema behavior expressions must carry the deterministic schema-expression brand", path);
|
|
148
|
-
}
|
|
149
|
-
function assertDefaultDescriptor(value) {
|
|
150
|
-
if (!value || typeof value !== "object") throw new ColumnBehaviorError("invalid-default", "Column default metadata must be an object", "default");
|
|
151
|
-
if (value.kind === "external") return;
|
|
152
|
-
if (value.kind === "expression") {
|
|
153
|
-
assertSchemaExpression(value.expression, "default.expression");
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
if (value.kind === "literal") {
|
|
157
|
-
assertCanonicalLiteral(value.value);
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
throw new ColumnBehaviorError("invalid-default", "Unknown column default descriptor kind", "default.kind");
|
|
161
|
-
}
|
|
162
|
-
function assertGeneratedColumnDescriptor(value) {
|
|
163
|
-
if (!value || typeof value !== "object") throw new ColumnBehaviorError("invalid-generated-column", "Generated-column metadata must be an object", "generatedColumn");
|
|
164
|
-
if (value.kind === "external") return;
|
|
165
|
-
if (value.kind === "expression") {
|
|
166
|
-
assertSchemaExpression(value.expression, "generatedColumn.expression", "invalid-generated-column");
|
|
167
|
-
if (value.mode !== "stored" && value.mode !== "virtual") throw new ColumnBehaviorError("invalid-generated-column", "Generated-column mode must be \"stored\" or \"virtual\"", "generatedColumn.mode");
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
throw new ColumnBehaviorError("invalid-generated-column", "Unknown generated-column descriptor kind", "generatedColumn.kind");
|
|
171
|
-
}
|
|
172
|
-
function assertIdentityDescriptor(value) {
|
|
173
|
-
if (!value || typeof value !== "object" || value.kind !== "identity" || value.generation !== "always" && value.generation !== "by-default") throw new ColumnBehaviorError("invalid-identity", "Identity metadata must use generation \"always\" or \"by-default\"", "identity.generation");
|
|
174
|
-
if (value.dialect !== void 0) {
|
|
175
|
-
if (typeof value.dialect !== "object" || value.dialect === null || typeof value.dialect.dialect !== "string" || value.dialect.dialect.length === 0) throw new ColumnBehaviorError("invalid-identity", "Identity dialect metadata must contain a non-empty dialect tag", "identity.dialect");
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
function assertCanonicalLiteral(value) {
|
|
179
|
-
if (!value || typeof value !== "object") throw new ColumnBehaviorError("invalid-default", "Literal defaults must contain a canonical literal node", "default.value");
|
|
180
|
-
switch (value.kind) {
|
|
181
|
-
case "null": return;
|
|
182
|
-
case "boolean":
|
|
183
|
-
if (typeof value.value === "boolean") return;
|
|
184
|
-
break;
|
|
185
|
-
case "string":
|
|
186
|
-
if (typeof value.value === "string") return;
|
|
187
|
-
break;
|
|
188
|
-
case "number":
|
|
189
|
-
if (typeof value.value === "string" && value.value.length > 0) return;
|
|
190
|
-
break;
|
|
191
|
-
case "bigint": if (/^-?(0|[1-9][0-9]*)$/.test(value.value)) return;
|
|
192
|
-
}
|
|
193
|
-
throw new ColumnBehaviorError("invalid-default", "Literal defaults must contain a valid canonical literal node", "default.value");
|
|
194
|
-
}
|
|
195
|
-
//#endregion
|
|
196
|
-
//#region src/schema/column.ts
|
|
197
|
-
/** Create an immutable portable physical storage descriptor. */
|
|
198
|
-
function portableStorage(type) {
|
|
199
|
-
return Object.freeze({
|
|
200
|
-
kind: "portable",
|
|
201
|
-
type
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
function nativeStorage(dialectOrOptions, type) {
|
|
205
|
-
const dialect = typeof dialectOrOptions === "string" ? dialectOrOptions : dialectOrOptions.dialect;
|
|
206
|
-
const declaration = typeof dialectOrOptions === "string" ? type : "type" in dialectOrOptions ? dialectOrOptions.type : dialectOrOptions.declaration;
|
|
207
|
-
return Object.freeze({
|
|
208
|
-
kind: "native",
|
|
209
|
-
dialect,
|
|
210
|
-
type: declaration
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
function narrowColumnType() {
|
|
214
|
-
return this;
|
|
215
|
-
}
|
|
216
|
-
function withPortableCast(definition, type) {
|
|
217
|
-
return Object.freeze({
|
|
218
|
-
...definition,
|
|
219
|
-
castTarget: Object.freeze({
|
|
220
|
-
kind: "portable-cast",
|
|
221
|
-
type
|
|
222
|
-
})
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
function withPortableStorage(definition, type) {
|
|
226
|
-
return Object.freeze({
|
|
227
|
-
...definition,
|
|
228
|
-
storage: portableStorage(type)
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
function column(options) {
|
|
232
|
-
return Object.freeze({
|
|
233
|
-
definitionKind: "column",
|
|
234
|
-
nullable: options?.nullable === true,
|
|
235
|
-
...resolveColumnBehavior(options ?? {}),
|
|
236
|
-
sqlName: options?.sqlName,
|
|
237
|
-
storage: options?.storage ? Object.freeze({ ...options.storage }) : void 0,
|
|
238
|
-
...options?.decode === void 0 ? {} : { resultDecoder: options.decode },
|
|
239
|
-
$type: narrowColumnType,
|
|
240
|
-
castTarget: options?.castType ? Object.freeze({
|
|
241
|
-
kind: "named-cast",
|
|
242
|
-
typeName: options.castType
|
|
243
|
-
}) : void 0
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
/** Resolve the runtime result metadata carried by a column definition. */
|
|
247
|
-
function columnResultValue(definition) {
|
|
248
|
-
const storage = definition.storage;
|
|
249
|
-
const type = storage?.kind === "portable" && (storage.type === "boolean" || storage.type === "date" || storage.type === "timestamp" || storage.type === "json") ? storage.type : void 0;
|
|
250
|
-
return resultValue(type, definition.resultDecoder);
|
|
251
|
-
}
|
|
252
|
-
function nativeColumn(storageOrDialect, typeOrOptions, maybeOptions) {
|
|
253
|
-
const storage = typeof storageOrDialect === "string" ? nativeStorage(storageOrDialect, typeOrOptions) : storageOrDialect;
|
|
254
|
-
return column({
|
|
255
|
-
...(typeof storageOrDialect === "string" ? maybeOptions : typeOrOptions) ?? {},
|
|
256
|
-
storage
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
function nullable(definition) {
|
|
260
|
-
return Object.freeze({
|
|
261
|
-
...definition,
|
|
262
|
-
nullable: true
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
function integer(options) {
|
|
266
|
-
return withPortableStorage(withPortableCast(column(options), "integer"), "integer");
|
|
267
|
-
}
|
|
268
|
-
function numeric(options) {
|
|
269
|
-
return withPortableStorage(withPortableCast(column(options), "decimal"), "numeric");
|
|
270
|
-
}
|
|
271
|
-
function text(options) {
|
|
272
|
-
return withPortableStorage(withPortableCast(column(options), "text"), "text");
|
|
273
|
-
}
|
|
274
|
-
function boolean(options) {
|
|
275
|
-
return withPortableStorage(withPortableCast(column(options), "boolean"), "boolean");
|
|
276
|
-
}
|
|
277
|
-
function date(options) {
|
|
278
|
-
return withPortableStorage(withPortableCast(column(options), "date"), "date");
|
|
279
|
-
}
|
|
280
|
-
function timestamp(options) {
|
|
281
|
-
return withPortableStorage(withPortableCast(column(options), "timestamp"), "timestamp");
|
|
282
|
-
}
|
|
283
|
-
function uuid(options) {
|
|
284
|
-
return withPortableStorage(withPortableCast(column(options), "uuid"), "uuid");
|
|
285
|
-
}
|
|
286
|
-
function json(options) {
|
|
287
|
-
return withPortableStorage(withPortableCast(column(options), "json"), "json");
|
|
288
|
-
}
|
|
289
|
-
function bigint(options) {
|
|
290
|
-
return withPortableStorage(withPortableCast(column(options), "bigint"), "bigint");
|
|
291
|
-
}
|
|
292
|
-
function binary(options) {
|
|
293
|
-
return withPortableStorage(withPortableCast(column(options), "binary"), "binary");
|
|
294
|
-
}
|
|
295
|
-
//#endregion
|
|
296
|
-
export { resolveColumnBehavior as C, identityColumn as S, ColumnBehaviorError as _, columnResultValue as a, externalGeneratedColumn as b, json as c, nullable as d, numeric as f, uuid as g, timestamp as h, column as i, nativeColumn as l, text as m, binary as n, date as o, portableStorage as p, boolean as r, integer as s, bigint as t, nativeStorage as u, canonicalLiteral as v, generatedColumn as x, externalDefault as y };
|
package/dist/drizzle-mysql.d.mts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Lt as AnyTable, ei as Schema, oi as SchemaTableRecord } from "./types-Deo_q43Y.mjs";
|
|
2
|
-
import { r as DrizzleSchemaValidation, t as DrizzleColumnConfig } from "./types-DZsueVoI.mjs";
|
|
3
|
-
import { MySqlColumn, MySqlTableWithColumns } from "drizzle-orm/mysql-core";
|
|
4
|
-
//#region src/drizzle/mysql.d.ts
|
|
5
|
-
type MysqlDrizzleColumn<TTableName extends string, TDefinition> = MySqlColumn<DrizzleColumnConfig<TTableName, TDefinition>>;
|
|
6
|
-
type MysqlDrizzleColumns<TTable extends AnyTable> = { [TKey in keyof TTable['definitions']]: MysqlDrizzleColumn<TTable['tableName'], TTable['definitions'][TKey]>; };
|
|
7
|
-
/** The Drizzle MySQL table produced for one Qubu table. */
|
|
8
|
-
type MysqlDrizzleTable<TTable extends AnyTable> = MySqlTableWithColumns<{
|
|
9
|
-
name: TTable['tableName'];
|
|
10
|
-
schema: string | undefined;
|
|
11
|
-
columns: MysqlDrizzleColumns<TTable>;
|
|
12
|
-
dialect: 'mysql';
|
|
13
|
-
}>;
|
|
14
|
-
/** A MySQL Drizzle table record retaining Qubu's logical table keys. */
|
|
15
|
-
type MysqlDrizzleSchema<TSchema extends Schema<any>> = { readonly [TKey in keyof TSchema['tables']]: MysqlDrizzleTable<TSchema['tables'][TKey]>; };
|
|
16
|
-
/**
|
|
17
|
-
* Convert a live Qubu schema registry into MySQL Drizzle table objects.
|
|
18
|
-
*
|
|
19
|
-
* @throws A snapshot validation error for invalid MySQL metadata, or a
|
|
20
|
-
* DrizzleSchemaConversionError when Drizzle cannot represent required metadata.
|
|
21
|
-
*/
|
|
22
|
-
declare function toMysqlDrizzleSchema<const TTables extends SchemaTableRecord>(schema: Schema<TTables> & DrizzleSchemaValidation<TTables, 'mysql'>): MysqlDrizzleSchema<Schema<TTables>>;
|
|
23
|
-
//#endregion
|
|
24
|
-
export { MysqlDrizzleSchema, MysqlDrizzleTable, toMysqlDrizzleSchema };
|