qubu 0.0.0 → 0.3.4

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.
Files changed (109) hide show
  1. package/dist/canonical-BbnqavJm.mjs +972 -0
  2. package/dist/codegen.d.mts +107 -0
  3. package/dist/codegen.mjs +1199 -0
  4. package/dist/column-CXMxx8Hq.mjs +118 -0
  5. package/dist/complete-D5Djh-zo.mjs +1788 -0
  6. package/dist/complete-types-BdFqUfbb.d.mts +371 -0
  7. package/dist/core.d.mts +33 -0
  8. package/dist/core.mjs +36 -0
  9. package/dist/ddl.d.mts +118 -0
  10. package/dist/ddl.mjs +1120 -0
  11. package/dist/dialect-b2-Z6uBF.mjs +13 -0
  12. package/dist/diff.d.mts +2 -0
  13. package/dist/diff.mjs +883 -0
  14. package/dist/drizzle-mysql.d.mts +24 -0
  15. package/dist/drizzle-mysql.mjs +72 -0
  16. package/dist/drizzle-postgres.d.mts +24 -0
  17. package/dist/drizzle-postgres.mjs +73 -0
  18. package/dist/drizzle-sqlite.d.mts +24 -0
  19. package/dist/drizzle-sqlite.mjs +82 -0
  20. package/dist/drizzle.d.mts +13 -0
  21. package/dist/drizzle.mjs +2 -0
  22. package/dist/errors-BGCoLe_r.mjs +14 -0
  23. package/dist/errors-Dxv73YJu.mjs +26 -0
  24. package/dist/explain-CkIK13L_.mjs +98 -0
  25. package/dist/index-Ds7-mhJi.d.mts +146 -0
  26. package/dist/index-Dug5HnLB.d.mts +204 -0
  27. package/dist/index.d.mts +2 -0
  28. package/dist/index.mjs +1276 -0
  29. package/dist/introspection.d.mts +117 -0
  30. package/dist/introspection.mjs +4341 -0
  31. package/dist/json-CUZlv4HT.mjs +169 -0
  32. package/dist/migration.d.mts +215 -0
  33. package/dist/migration.mjs +1161 -0
  34. package/dist/mysql-DqkqXB6A.mjs +355 -0
  35. package/dist/mysql.d.mts +5 -0
  36. package/dist/mysql.mjs +50 -0
  37. package/dist/naming-QVCOnSj2.mjs +20 -0
  38. package/dist/omit-OxV58AwX.mjs +5 -0
  39. package/dist/on-conflict-BxnxubMb.mjs +143 -0
  40. package/dist/postgres-DEBBeh52.mjs +235 -0
  41. package/dist/postgres.d.mts +123 -0
  42. package/dist/postgres.mjs +52 -0
  43. package/dist/registry-BufIskVN.mjs +569 -0
  44. package/dist/relational-DCZrrNia.mjs +77 -0
  45. package/dist/runtime-BTr-MTlo.mjs +193 -0
  46. package/dist/schema.d.mts +2 -0
  47. package/dist/schema.mjs +5 -0
  48. package/dist/serialize-PF1cfH2P.mjs +556 -0
  49. package/dist/snapshot-CWPgzxNx.mjs +392 -0
  50. package/dist/snapshot.d.mts +4 -0
  51. package/dist/snapshot.mjs +8 -0
  52. package/dist/source-DUoJVXmL.mjs +68 -0
  53. package/dist/sqlite-BU6DBxef.mjs +320 -0
  54. package/dist/sqlite.d.mts +5 -0
  55. package/dist/sqlite.mjs +48 -0
  56. package/dist/standard-BTVYKh_F.mjs +12 -0
  57. package/dist/table-llv9tsZ8.mjs +384 -0
  58. package/dist/types-4Q076HKo.d.mts +3636 -0
  59. package/dist/types-BX0mckiU.d.mts +644 -0
  60. package/dist/types-Cec0xzo4.mjs +116 -0
  61. package/dist/types-H4vyCw8_.d.mts +45 -0
  62. package/dist/value-BvilP0oz.mjs +29 -0
  63. package/dist/vite/ambient.d.ts +449 -0
  64. package/dist/vite.d.mts +35 -0
  65. package/dist/vite.mjs +498 -0
  66. package/docs/config.json +21 -0
  67. package/docs/dialects-and-execution.md +427 -0
  68. package/docs/getting-started.md +96 -0
  69. package/docs/guides/compose-queries.md +225 -0
  70. package/docs/guides/drizzle.md +130 -0
  71. package/docs/guides/extensions/dialects.md +40 -0
  72. package/docs/guides/extensions/overview.md +36 -0
  73. package/docs/guides/extensions/sources-and-clauses.md +82 -0
  74. package/docs/guides/extensions/typed-expressions.md +94 -0
  75. package/docs/guides/extensions/unsafe-syntax.md +27 -0
  76. package/docs/guides/json.md +65 -0
  77. package/docs/guides/mutations.md +138 -0
  78. package/docs/guides/select/conditions.md +110 -0
  79. package/docs/guides/select/grouping-and-windows.md +82 -0
  80. package/docs/guides/select/ordering-and-pagination.md +78 -0
  81. package/docs/guides/select/overview.md +139 -0
  82. package/docs/guides/sql-templates.md +157 -0
  83. package/docs/guides/vite-plugin.md +92 -0
  84. package/docs/index.md +111 -0
  85. package/docs/query-model/fragments.md +109 -0
  86. package/docs/query-model/result-shapes.md +125 -0
  87. package/docs/query-model/source-scope.md +182 -0
  88. package/docs/reference/introspection-support.md +196 -0
  89. package/docs/reference/mysql-snapshot.md +55 -0
  90. package/docs/reference/postgres-snapshot.md +61 -0
  91. package/docs/reference/sqlite-snapshot.md +53 -0
  92. package/docs/reference/supported-surface.md +104 -0
  93. package/docs/schema/catalog-model.md +58 -0
  94. package/docs/schema/code-generation.md +139 -0
  95. package/docs/schema/columns-and-writes.md +130 -0
  96. package/docs/schema/constraints-and-indexes.md +180 -0
  97. package/docs/schema/ddl-emission.md +75 -0
  98. package/docs/schema/diff.md +75 -0
  99. package/docs/schema/introspection.md +214 -0
  100. package/docs/schema/migration-plans.md +76 -0
  101. package/docs/schema/snapshots.md +93 -0
  102. package/docs/schema/storage-and-schema-sql.md +104 -0
  103. package/docs/schema/tables-and-names.md +106 -0
  104. package/docs/sql-semantic-types.md +141 -0
  105. package/docs/troubleshooting.md +151 -0
  106. package/package.json +132 -10
  107. package/skills/qubu/SKILL.md +42 -0
  108. package/skills/qubu/agents/openai.yaml +6 -0
  109. package/readme.md +0 -1
@@ -0,0 +1,320 @@
1
+ import { r as isColumnReference } from "./column-CXMxx8Hq.mjs";
2
+ import { A as isValidSchemaObjectName, _ as isUnsafeSchemaSql, m as validateConstraintDialect, w as validateIndexDialect, y as renderSchemaExpression } from "./registry-BufIskVN.mjs";
3
+ import { t as createSchemaDialect } from "./dialect-b2-Z6uBF.mjs";
4
+ import { a as toSnapshotJsonValue } from "./canonical-BbnqavJm.mjs";
5
+ import { sqliteDialect } from "./sqlite.mjs";
6
+ import { n as createSchemaSnapshot, s as tryCreateSchemaSnapshot } from "./serialize-PF1cfH2P.mjs";
7
+ //#region src/snapshot/sqlite.ts
8
+ /** SQLite's v1 snapshot extension identity. */
9
+ const sqliteSnapshotDialect = Object.freeze({
10
+ name: "sqlite",
11
+ version: 1
12
+ });
13
+ var SqliteSnapshotDialectError = class extends TypeError {
14
+ code = "dialect-mismatch";
15
+ };
16
+ const sqliteStorageTypes = Object.freeze({
17
+ integer: "INTEGER",
18
+ numeric: "NUMERIC",
19
+ text: "TEXT",
20
+ boolean: "INTEGER",
21
+ date: "TEXT",
22
+ timestamp: "TEXT",
23
+ uuid: "TEXT",
24
+ json: "TEXT",
25
+ bigint: "INTEGER",
26
+ binary: "BLOB"
27
+ });
28
+ /**
29
+ * Resolve SQLite's declared-type affinity without changing the declaration.
30
+ * SQLite applies these ordered substring rules at table creation time; the
31
+ * returned affinity is useful metadata, not a replacement for the exact type.
32
+ */
33
+ function sqliteStorageAffinity(declaration) {
34
+ const upper = declaration.toUpperCase();
35
+ if (upper.includes("INT")) return "integer";
36
+ if (upper.includes("CHAR") || upper.includes("CLOB") || upper.includes("TEXT")) return "text";
37
+ if (upper.includes("BLOB") || upper.trim().length === 0) return "blob";
38
+ if (upper.includes("REAL") || upper.includes("FLOA") || upper.includes("DOUB")) return "real";
39
+ return "numeric";
40
+ }
41
+ /** SQLite's query dialect plus its schema metadata behavior. */
42
+ const sqliteSchemaDialect = createSchemaDialect(sqliteDialect(), {
43
+ version: 1,
44
+ validate: validateSqliteSchema,
45
+ encodeStorage(storage, context) {
46
+ return encodeSqliteStorage(storage, context.dialect);
47
+ },
48
+ encodeExpression(expression, context) {
49
+ return encodeSqliteExpression(expression, context.mode, context.dialect);
50
+ },
51
+ encodeDialectExtension(extension, context) {
52
+ return encodeSqliteExtension(extension, context.dialect);
53
+ }
54
+ });
55
+ /** Snapshot adapter retaining the historical adapter-shaped entry point. */
56
+ const sqliteSnapshotAdapter = Object.freeze({ dialect: sqliteSchemaDialect });
57
+ /** Create a canonical SQLite schema snapshot. */
58
+ function createSqliteSchemaSnapshot(schema, options = {}) {
59
+ return createSchemaSnapshot(schema, {
60
+ ...options,
61
+ adapter: sqliteSnapshotAdapter
62
+ });
63
+ }
64
+ /** Return SQLite capability diagnostics without throwing. */
65
+ function tryCreateSqliteSchemaSnapshot(schema, options = {}) {
66
+ return tryCreateSchemaSnapshot(schema, {
67
+ ...options,
68
+ adapter: sqliteSnapshotAdapter
69
+ });
70
+ }
71
+ function encodeSqliteStorage(storage, dialect) {
72
+ if (storage.kind === "native") {
73
+ if (storage.dialect !== dialect.name) throw new SqliteSnapshotDialectError(`SQLite storage cannot encode a native declaration owned by "${storage.dialect}"`);
74
+ if (storage.type.trim().length === 0) throw new TypeError("SQLite native storage declarations cannot be empty");
75
+ return {
76
+ kind: "native",
77
+ dialect: dialect.name,
78
+ type: storage.type,
79
+ affinity: sqliteStorageAffinity(storage.type)
80
+ };
81
+ }
82
+ const type = sqliteStorageTypes[storage.type];
83
+ if (type === void 0) throw new TypeError(`Unsupported portable storage type for SQLite: ${String(storage.type)}`);
84
+ return {
85
+ kind: "native",
86
+ dialect: dialect.name,
87
+ type,
88
+ affinity: sqliteStorageAffinity(type)
89
+ };
90
+ }
91
+ function encodeSqliteExpression(expression, mode, dialect) {
92
+ if (isUnsafeSchemaSql(expression) && expression.schemaSqlDialect !== dialect.name) throw new SqliteSnapshotDialectError(`Schema SQL is tagged for "${expression.schemaSqlDialect}" but the SQLite schema dialect is "${dialect.name}"`);
93
+ const rendered = renderSchemaExpression(expression, {
94
+ mode,
95
+ dialect
96
+ });
97
+ if (rendered.parameters.length !== 0) throw new TypeError("SQLite schema expressions must be parameter-free");
98
+ return {
99
+ kind: "expression",
100
+ expressionKind: expression.expressionKind,
101
+ sql: rendered.text,
102
+ ...isUnsafeSchemaSql(expression) ? { dialect: dialect.name } : {}
103
+ };
104
+ }
105
+ function encodeSqliteExtension(extension, dialect) {
106
+ if (extension.dialect !== dialect.name) throw new TypeError(`SQLite schema extensions require dialect "${dialect.name}"`);
107
+ const data = Object.fromEntries(Object.entries(extension).filter(([key]) => key !== "dialect").sort(([left], [right]) => left.localeCompare(right)));
108
+ return {
109
+ dialect: dialect.name,
110
+ version: dialect.schema.version,
111
+ data: sortSnapshotJson(toSnapshotJsonValue(data))
112
+ };
113
+ }
114
+ function sortSnapshotJson(value) {
115
+ if (Array.isArray(value)) return value.map(sortSnapshotJson);
116
+ if (typeof value !== "object" || value === null) return value;
117
+ return Object.fromEntries(Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, child]) => [key, sortSnapshotJson(child)]));
118
+ }
119
+ function validateSqliteSchema(schema, context) {
120
+ const diagnostics = [];
121
+ const tableEntries = Object.entries(schema.registry).sort(([left], [right]) => compareIds(left, right));
122
+ const relationNames = /* @__PURE__ */ new Map();
123
+ if (schema.namespace !== void 0) validateSqliteName(schema.namespace, ["namespace"], "SQLite namespace", diagnostics);
124
+ for (const [id, entry] of tableEntries) {
125
+ const tablePath = ["tables", id];
126
+ validateSqliteName(entry.physicalName, [...tablePath, "physicalName"], "SQLite table", diagnostics);
127
+ addRelationName(relationNames, entry.physicalName, [...tablePath, "physicalName"], "table", diagnostics);
128
+ }
129
+ for (const [id, entry] of tableEntries) validateSqliteTable(id, entry, context, relationNames, diagnostics);
130
+ return Object.freeze(diagnostics);
131
+ }
132
+ function validateSqliteTable(tableId, entry, context, relationNames, diagnostics) {
133
+ const table = entry.table;
134
+ const tablePath = ["tables", tableId];
135
+ const definitions = table.definitions;
136
+ const metadata = table;
137
+ for (const [columnId, definition] of Object.entries(definitions).sort(([left], [right]) => compareIds(left, right))) {
138
+ validateSqliteName(table.sqlNames[columnId] ?? columnId, [
139
+ ...tablePath,
140
+ "columns",
141
+ columnId,
142
+ "physicalName"
143
+ ], "SQLite column", diagnostics);
144
+ if (definition.onUpdate !== void 0) diagnostics.push({
145
+ code: "unsupported-dialect-option",
146
+ message: "MySQL ON UPDATE expressions are not supported by SQLite",
147
+ path: [
148
+ ...tablePath,
149
+ "columns",
150
+ columnId,
151
+ "onUpdate"
152
+ ]
153
+ });
154
+ const storage = definition.storage;
155
+ const identity = definition.identity;
156
+ if (identity !== void 0) {
157
+ const identityPath = [
158
+ ...tablePath,
159
+ "columns",
160
+ columnId,
161
+ "identity"
162
+ ];
163
+ const extension = identity.dialect;
164
+ if (extension !== void 0 && extension.dialect === "sqlite" && extension.autoIncrement !== void 0 && typeof extension.autoIncrement !== "boolean") diagnostics.push({
165
+ code: "unsupported-dialect-option",
166
+ message: "SQLite identity autoIncrement must be boolean",
167
+ path: [
168
+ ...identityPath,
169
+ "dialect",
170
+ "autoIncrement"
171
+ ]
172
+ });
173
+ const primary = primaryKeyForColumn(metadata.constraints, columnId);
174
+ const declaration = sqliteDeclaration(storage);
175
+ if ((declaration === void 0 ? void 0 : sqliteStorageAffinity(declaration)) !== "integer") diagnostics.push({
176
+ code: "unsupported-dialect-option",
177
+ message: "SQLite identity columns must use INTEGER affinity so they can be rowid aliases",
178
+ path: [...identityPath, "generation"]
179
+ });
180
+ if (primary === void 0 || primary.length !== 1) diagnostics.push({
181
+ code: "unsupported-dialect-option",
182
+ message: "SQLite identity columns must be the sole column of a PRIMARY KEY constraint",
183
+ path: [...identityPath, "generation"]
184
+ });
185
+ if (extension?.dialect === "sqlite" && extension.autoIncrement === true && declaration?.trim().toUpperCase() !== "INTEGER") diagnostics.push({
186
+ code: "unsupported-dialect-option",
187
+ message: "SQLite AUTOINCREMENT requires an exact INTEGER PRIMARY KEY declaration",
188
+ path: [
189
+ ...identityPath,
190
+ "dialect",
191
+ "autoIncrement"
192
+ ]
193
+ });
194
+ }
195
+ if (definition.generatedColumn?.kind === "expression" && primaryKeyForColumn(metadata.constraints, columnId) !== void 0) diagnostics.push({
196
+ code: "unsupported-dialect-option",
197
+ message: "SQLite generated columns cannot be part of a PRIMARY KEY",
198
+ path: [
199
+ ...tablePath,
200
+ "columns",
201
+ columnId,
202
+ "generatedColumn"
203
+ ]
204
+ });
205
+ }
206
+ const constraintNames = /* @__PURE__ */ new Map();
207
+ const constraints = Object.entries(metadata.constraints);
208
+ for (const [constraintId, constraint] of constraints.sort(([left], [right]) => compareIds(left, right))) {
209
+ const constraintPath = [
210
+ ...tablePath,
211
+ "constraints",
212
+ constraintId
213
+ ];
214
+ const physicalName = constraint.physicalName ?? constraintId;
215
+ validateSqliteName(physicalName, [...constraintPath, "physicalName"], "SQLite constraint", diagnostics);
216
+ addScopedName(constraintNames, physicalName, [...constraintPath, "physicalName"], "constraint", diagnostics);
217
+ appendMetadataDiagnostics(diagnostics, validateConstraintDialect(constraint, context.dialect.name, constraintPath));
218
+ if ((constraint.kind === "primary-key" || constraint.kind === "unique" || constraint.kind === "unique-constraint" || constraint.kind === "check") && (constraint.deferrable === true || constraint.initially !== void 0)) diagnostics.push({
219
+ code: "unsupported-dialect-option",
220
+ message: "SQLite only supports DEFERRABLE timing on foreign-key constraints",
221
+ path: [...constraintPath, constraint.deferrable ? "deferrable" : "initially"]
222
+ });
223
+ if (constraint.kind === "foreign-key" && constraint.match !== void 0 && constraint.match !== "simple") diagnostics.push({
224
+ code: "unsupported-dialect-option",
225
+ message: "SQLite supports MATCH SIMPLE foreign keys only",
226
+ path: [...constraintPath, "match"]
227
+ });
228
+ if (constraint.kind === "unique-constraint" && constraint.nulls === "not-distinct") diagnostics.push({
229
+ code: "unsupported-dialect-option",
230
+ message: "SQLite UNIQUE constraints always use distinct NULL semantics in v1",
231
+ path: [...constraintPath, "nulls"]
232
+ });
233
+ if (constraint.dialect?.dialect === "sqlite" && "onConflict" in constraint.dialect && constraint.dialect.onConflict !== void 0 && ![
234
+ "rollback",
235
+ "abort",
236
+ "fail",
237
+ "ignore",
238
+ "replace"
239
+ ].includes(String(constraint.dialect.onConflict))) diagnostics.push({
240
+ code: "unsupported-dialect-option",
241
+ message: "SQLite constraint onConflict has an unsupported value",
242
+ path: [
243
+ ...constraintPath,
244
+ "dialect",
245
+ "onConflict"
246
+ ]
247
+ });
248
+ }
249
+ const indexes = Object.entries(metadata.indexes);
250
+ for (const [indexId, index] of indexes.sort(([left], [right]) => compareIds(left, right))) {
251
+ const indexPath = [
252
+ ...tablePath,
253
+ "indexes",
254
+ indexId
255
+ ];
256
+ const physicalName = index.physicalName ?? indexId;
257
+ validateSqliteName(physicalName, [...indexPath, "physicalName"], "SQLite index", diagnostics);
258
+ addRelationName(relationNames, physicalName, [...indexPath, "physicalName"], "index", diagnostics);
259
+ appendMetadataDiagnostics(diagnostics, validateIndexDialect(index, context.dialect.name, indexPath));
260
+ if (index.dialect?.dialect === "sqlite" && "auto" in index.dialect && index.dialect.auto !== void 0 && typeof index.dialect.auto !== "boolean") diagnostics.push({
261
+ code: "unsupported-dialect-option",
262
+ message: "SQLite index auto must be boolean",
263
+ path: [
264
+ ...indexPath,
265
+ "dialect",
266
+ "auto"
267
+ ]
268
+ });
269
+ }
270
+ }
271
+ function sqliteDeclaration(storage) {
272
+ if (storage === void 0) return void 0;
273
+ if (storage.kind === "native") return storage.type;
274
+ return sqliteStorageTypes[storage.type];
275
+ }
276
+ function primaryKeyForColumn(constraints, columnId) {
277
+ for (const constraint of Object.values(constraints)) {
278
+ if (constraint.kind !== "primary-key") continue;
279
+ if (constraint.columns.some((column) => isColumnReference(column) && column.fieldName === columnId)) return constraint.columns;
280
+ }
281
+ }
282
+ function validateSqliteName(name, path, kind, diagnostics) {
283
+ if (!isValidSchemaObjectName(name) || name.length === 0) diagnostics.push({
284
+ code: "invalid-schema",
285
+ message: `${kind} name "${name}" is not a valid unqualified identifier`,
286
+ path
287
+ });
288
+ }
289
+ function addRelationName(names, name, path, kind, diagnostics) {
290
+ addScopedName(names, name, path, kind, diagnostics);
291
+ }
292
+ function addScopedName(names, name, path, kind, diagnostics) {
293
+ const previousPath = names.get(name);
294
+ if (previousPath !== void 0) {
295
+ diagnostics.push({
296
+ code: "invalid-schema",
297
+ message: `SQLite ${kind} name "${name}" collides with another table or index`,
298
+ path,
299
+ relatedPaths: [previousPath]
300
+ });
301
+ return;
302
+ }
303
+ names.set(name, path);
304
+ }
305
+ function appendMetadataDiagnostics(diagnostics, issues) {
306
+ for (const issue of issues) {
307
+ if (issue.code === "dialect-mismatch") continue;
308
+ diagnostics.push({
309
+ code: issue.code === "unsupported-dialect-option" ? "unsupported-dialect-option" : "invalid-schema",
310
+ message: issue.message,
311
+ path: issue.path,
312
+ ...issue.relatedPaths === void 0 ? {} : { relatedPaths: issue.relatedPaths }
313
+ });
314
+ }
315
+ }
316
+ function compareIds(left, right) {
317
+ return left < right ? -1 : left > right ? 1 : 0;
318
+ }
319
+ //#endregion
320
+ export { sqliteStorageAffinity as a, sqliteSnapshotDialect as i, sqliteSchemaDialect as n, tryCreateSqliteSchemaSnapshot as o, sqliteSnapshotAdapter as r, createSqliteSchemaSnapshot as t };
@@ -0,0 +1,5 @@
1
+ import { Cn as ExcludedSource, Dn as excluded, En as doUpdate, On as onConflict, Sn as DoUpdateAction, Tn as doNothing, V as Dialect, bn as ConflictTarget, wn as OnConflictClause, xn as DoNothingAction, yn as ConflictAction } from "./types-4Q076HKo.mjs";
2
+ //#region src/dialects/sqlite.d.ts
3
+ declare function sqliteDialect(): Dialect<"json" | "on-conflict">;
4
+ //#endregion
5
+ export { type ConflictAction, type ConflictTarget, type DoNothingAction, type DoUpdateAction, type ExcludedSource, type OnConflictClause, doNothing, doUpdate, excluded, onConflict, sqliteDialect };
@@ -0,0 +1,48 @@
1
+ import { o as createDialect, r as sqliteJson } from "./json-CUZlv4HT.mjs";
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-BxnxubMb.mjs";
4
+ //#region src/dialects/sqlite.ts
5
+ function renderSqliteSchemaLiteral(value) {
6
+ if (value === null) return "NULL";
7
+ if (typeof value === "boolean") return value ? "1" : "0";
8
+ if (typeof value === "string") return `'${value.replaceAll("'", "''")}'`;
9
+ if (typeof value === "bigint") return String(value);
10
+ if (typeof value === "number") {
11
+ if (!Number.isFinite(value)) throw new TypeError("SQLite schema literals require finite numbers");
12
+ return Object.is(value, -0) ? "0" : String(value);
13
+ }
14
+ throw new TypeError(`Unsupported SQLite schema literal type: ${value === void 0 ? "undefined" : typeof value}`);
15
+ }
16
+ function renderSqlitePagination(context, parts) {
17
+ const fetch = parts.find((part) => part.kind === "fetch");
18
+ const offset = parts.find((part) => part.kind === "offset");
19
+ context.append("LIMIT ");
20
+ if (fetch) context.parameter(fetch.rows);
21
+ else context.append("-1");
22
+ if (offset) {
23
+ context.append(" OFFSET ");
24
+ context.parameter(offset.rows);
25
+ }
26
+ }
27
+ function sqliteDialect() {
28
+ return createDialect({
29
+ name: "sqlite",
30
+ placeholder: () => "?",
31
+ pagination: { render: renderSqlitePagination },
32
+ capabilities: ["on-conflict"],
33
+ json: sqliteJson,
34
+ castTypes: {
35
+ decimal: "NUMERIC",
36
+ boolean: "INTEGER",
37
+ date: "TEXT",
38
+ timestamp: "TEXT",
39
+ uuid: "TEXT",
40
+ json: "TEXT",
41
+ binary: "BLOB"
42
+ },
43
+ renderSchemaLiteral: renderSqliteSchemaLiteral,
44
+ explain: sqliteExplain
45
+ });
46
+ }
47
+ //#endregion
48
+ export { doNothing, doUpdate, excluded, onConflict, sqliteDialect };
@@ -0,0 +1,12 @@
1
+ import { i as standardJson, o as createDialect } from "./json-CUZlv4HT.mjs";
2
+ //#region src/dialects/standard.ts
3
+ /** SQL:2008-style rendering defaults used by the core builder. */
4
+ function standardDialect() {
5
+ return createDialect({
6
+ name: "standard-sql",
7
+ placeholder: () => "?",
8
+ json: standardJson
9
+ });
10
+ }
11
+ //#endregion
12
+ export { standardDialect as t };