qubu 0.0.0 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canonical-BbnqavJm.mjs +972 -0
- package/dist/codegen.d.mts +107 -0
- package/dist/codegen.mjs +1199 -0
- package/dist/column-CXMxx8Hq.mjs +118 -0
- package/dist/complete-D5Djh-zo.mjs +1788 -0
- package/dist/complete-types-BdFqUfbb.d.mts +371 -0
- package/dist/core.d.mts +33 -0
- package/dist/core.mjs +36 -0
- package/dist/ddl.d.mts +118 -0
- package/dist/ddl.mjs +1120 -0
- package/dist/dialect-b2-Z6uBF.mjs +13 -0
- package/dist/diff.d.mts +2 -0
- package/dist/diff.mjs +883 -0
- package/dist/drizzle-mysql.d.mts +24 -0
- package/dist/drizzle-mysql.mjs +72 -0
- package/dist/drizzle-postgres.d.mts +24 -0
- package/dist/drizzle-postgres.mjs +73 -0
- package/dist/drizzle-sqlite.d.mts +24 -0
- package/dist/drizzle-sqlite.mjs +82 -0
- package/dist/drizzle.d.mts +13 -0
- package/dist/drizzle.mjs +2 -0
- package/dist/errors-BGCoLe_r.mjs +14 -0
- package/dist/errors-Dxv73YJu.mjs +26 -0
- package/dist/explain-CkIK13L_.mjs +98 -0
- package/dist/index-Ds7-mhJi.d.mts +146 -0
- package/dist/index-Dug5HnLB.d.mts +204 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1276 -0
- package/dist/introspection.d.mts +117 -0
- package/dist/introspection.mjs +4341 -0
- package/dist/json-CUZlv4HT.mjs +169 -0
- package/dist/migration.d.mts +215 -0
- package/dist/migration.mjs +1161 -0
- package/dist/mysql-DqkqXB6A.mjs +355 -0
- package/dist/mysql.d.mts +5 -0
- package/dist/mysql.mjs +50 -0
- package/dist/naming-QVCOnSj2.mjs +20 -0
- package/dist/omit-OxV58AwX.mjs +5 -0
- package/dist/on-conflict-BxnxubMb.mjs +143 -0
- package/dist/postgres-DEBBeh52.mjs +235 -0
- package/dist/postgres.d.mts +123 -0
- package/dist/postgres.mjs +52 -0
- package/dist/registry-BufIskVN.mjs +569 -0
- package/dist/relational-DCZrrNia.mjs +77 -0
- package/dist/runtime-BTr-MTlo.mjs +193 -0
- package/dist/schema.d.mts +2 -0
- package/dist/schema.mjs +5 -0
- package/dist/serialize-PF1cfH2P.mjs +556 -0
- package/dist/snapshot-CWPgzxNx.mjs +392 -0
- package/dist/snapshot.d.mts +4 -0
- package/dist/snapshot.mjs +8 -0
- package/dist/source-DUoJVXmL.mjs +68 -0
- package/dist/sqlite-BU6DBxef.mjs +320 -0
- package/dist/sqlite.d.mts +5 -0
- package/dist/sqlite.mjs +48 -0
- package/dist/standard-BTVYKh_F.mjs +12 -0
- package/dist/table-llv9tsZ8.mjs +384 -0
- package/dist/types-4Q076HKo.d.mts +3636 -0
- package/dist/types-BX0mckiU.d.mts +644 -0
- package/dist/types-CO1KaRNc.d.mts +46 -0
- package/dist/types-Cec0xzo4.mjs +116 -0
- package/dist/value-BvilP0oz.mjs +29 -0
- package/dist/vite/ambient.d.ts +449 -0
- package/dist/vite.d.mts +35 -0
- package/dist/vite.mjs +498 -0
- package/docs/config.json +21 -0
- package/docs/dialects-and-execution.md +427 -0
- package/docs/getting-started.md +96 -0
- package/docs/guides/compose-queries.md +225 -0
- package/docs/guides/drizzle.md +129 -0
- package/docs/guides/extensions/dialects.md +40 -0
- package/docs/guides/extensions/overview.md +36 -0
- package/docs/guides/extensions/sources-and-clauses.md +82 -0
- package/docs/guides/extensions/typed-expressions.md +94 -0
- package/docs/guides/extensions/unsafe-syntax.md +27 -0
- package/docs/guides/json.md +65 -0
- package/docs/guides/mutations.md +138 -0
- package/docs/guides/select/conditions.md +110 -0
- package/docs/guides/select/grouping-and-windows.md +82 -0
- package/docs/guides/select/ordering-and-pagination.md +78 -0
- package/docs/guides/select/overview.md +139 -0
- package/docs/guides/sql-templates.md +157 -0
- package/docs/guides/vite-plugin.md +92 -0
- package/docs/index.md +111 -0
- package/docs/query-model/fragments.md +109 -0
- package/docs/query-model/result-shapes.md +125 -0
- package/docs/query-model/source-scope.md +182 -0
- package/docs/reference/introspection-support.md +196 -0
- package/docs/reference/mysql-snapshot.md +55 -0
- package/docs/reference/postgres-snapshot.md +61 -0
- package/docs/reference/sqlite-snapshot.md +53 -0
- package/docs/reference/supported-surface.md +104 -0
- package/docs/schema/catalog-model.md +58 -0
- package/docs/schema/code-generation.md +139 -0
- package/docs/schema/columns-and-writes.md +130 -0
- package/docs/schema/constraints-and-indexes.md +180 -0
- package/docs/schema/ddl-emission.md +75 -0
- package/docs/schema/diff.md +75 -0
- package/docs/schema/introspection.md +214 -0
- package/docs/schema/migration-plans.md +76 -0
- package/docs/schema/snapshots.md +93 -0
- package/docs/schema/storage-and-schema-sql.md +104 -0
- package/docs/schema/tables-and-names.md +106 -0
- package/docs/sql-semantic-types.md +141 -0
- package/docs/troubleshooting.md +151 -0
- package/package.json +132 -10
- package/skills/qubu/SKILL.md +42 -0
- package/skills/qubu/agents/openai.yaml +6 -0
- package/readme.md +0 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { a as assertDialectCapability } from "./json-CUZlv4HT.mjs";
|
|
2
|
+
//#region src/core/fragment.ts
|
|
3
|
+
function fragment(render) {
|
|
4
|
+
return Object.freeze({ render });
|
|
5
|
+
}
|
|
6
|
+
function sequence(parts, separator = " ") {
|
|
7
|
+
return fragment((context) => {
|
|
8
|
+
let first = true;
|
|
9
|
+
for (const part of parts) {
|
|
10
|
+
if (!first) context.append(separator);
|
|
11
|
+
context.render(part);
|
|
12
|
+
first = false;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function parenthesize(part) {
|
|
17
|
+
return fragment((context) => {
|
|
18
|
+
context.append("(");
|
|
19
|
+
context.render(part);
|
|
20
|
+
context.append(")");
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function isFragment(value) {
|
|
24
|
+
return typeof value === "object" && value !== null && "render" in value && typeof value.render === "function";
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/expressions/types.ts
|
|
28
|
+
/** Runtime/type-level proof that an expression is safe to use in schema SQL. */
|
|
29
|
+
const schemaExpressionBrand = Symbol("qubu.schema-expression");
|
|
30
|
+
/** Add a concrete dialect requirement without dropping expression metadata. */
|
|
31
|
+
function withDialectCapability(expression, capability) {
|
|
32
|
+
const wrapped = makeExpression(expression.expressionKind, (context) => {
|
|
33
|
+
assertDialectCapability(context.dialect, capability);
|
|
34
|
+
context.render(expression);
|
|
35
|
+
});
|
|
36
|
+
return isSchemaExpression(expression) ? markSchemaExpression(wrapped) : wrapped;
|
|
37
|
+
}
|
|
38
|
+
function makeExpression(expressionKind, render, expressionCategory) {
|
|
39
|
+
return Object.freeze({
|
|
40
|
+
expressionKind,
|
|
41
|
+
...expressionCategory ? { expressionCategory } : {},
|
|
42
|
+
...fragment(render)
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/** Mark a query-only expression category without changing its SQL renderer. */
|
|
46
|
+
function markExpressionCategory(expression, category) {
|
|
47
|
+
return Object.freeze({
|
|
48
|
+
...expression,
|
|
49
|
+
expressionCategory: category
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Mark a built-in or explicitly audited renderer as schema-deterministic.
|
|
54
|
+
* Prefer {@link defineSchemaExpression} for application extensions because it
|
|
55
|
+
* supplies a restricted schema rendering context.
|
|
56
|
+
*/
|
|
57
|
+
function makeSchemaExpression(expressionKind, render) {
|
|
58
|
+
const expression = makeExpression(expressionKind, render);
|
|
59
|
+
return Object.freeze({
|
|
60
|
+
...expression,
|
|
61
|
+
[schemaExpressionBrand]: true
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/** Add the schema-determinism brand to an explicitly audited expression. */
|
|
65
|
+
function markSchemaExpression(expression) {
|
|
66
|
+
if (isSchemaExpression(expression)) return expression;
|
|
67
|
+
return Object.freeze({
|
|
68
|
+
...expression,
|
|
69
|
+
[schemaExpressionBrand]: true
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/** Test the runtime brand used by schema rendering and validation. */
|
|
73
|
+
function isSchemaExpression(value) {
|
|
74
|
+
return typeof value === "object" && value !== null && schemaExpressionBrand in value && value[schemaExpressionBrand] === true;
|
|
75
|
+
}
|
|
76
|
+
function isExpression(value) {
|
|
77
|
+
return typeof value === "object" && value !== null && "expressionKind" in value && "render" in value && typeof value.render === "function";
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/core/primitives/identifier.ts
|
|
81
|
+
function identifier(name) {
|
|
82
|
+
return fragment((context) => context.append(context.dialect.quoteIdentifier(name)));
|
|
83
|
+
}
|
|
84
|
+
function qualifiedIdentifier(...parts) {
|
|
85
|
+
return fragment((context) => {
|
|
86
|
+
parts.forEach((part, index) => {
|
|
87
|
+
if (index > 0) context.append(".");
|
|
88
|
+
context.append(context.dialect.quoteIdentifier(part));
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/expressions/column.ts
|
|
94
|
+
function createColumnReference(columnName, sourceReference, fieldName) {
|
|
95
|
+
const expression = makeSchemaExpression("column", (context) => {
|
|
96
|
+
if (context.renderColumnReference) {
|
|
97
|
+
context.renderColumnReference(columnName);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
context.render(sourceReference);
|
|
101
|
+
context.append(".");
|
|
102
|
+
context.render(identifier(columnName));
|
|
103
|
+
});
|
|
104
|
+
return Object.freeze({
|
|
105
|
+
...expression,
|
|
106
|
+
fieldName,
|
|
107
|
+
columnName
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function isColumnReference(value) {
|
|
111
|
+
return typeof value === "object" && value !== null && "expressionKind" in value && value.expressionKind === "column";
|
|
112
|
+
}
|
|
113
|
+
/** Turn an expression into a fragment that renders it without changing it. */
|
|
114
|
+
function expressionFragment(expression) {
|
|
115
|
+
return fragment((context) => context.render(expression));
|
|
116
|
+
}
|
|
117
|
+
//#endregion
|
|
118
|
+
export { qualifiedIdentifier as a, makeExpression as c, markSchemaExpression as d, withDialectCapability as f, sequence as g, parenthesize as h, identifier as i, makeSchemaExpression as l, isFragment as m, expressionFragment as n, isExpression as o, fragment as p, isColumnReference as r, isSchemaExpression as s, createColumnReference as t, markExpressionCategory as u };
|