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
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { s as resolveCastTarget } from "./json-
|
|
2
|
-
import { t as standardDialect } from "./standard-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as asValue } from "./value-b6OFZXVS.mjs";
|
|
1
|
+
import { s as resolveCastTarget } from "./json-Db7XRD91.mjs";
|
|
2
|
+
import { t as standardDialect } from "./standard-DfcZEVOj.mjs";
|
|
3
|
+
import { H as makeSchemaExpression, K as fragment, V as makeExpression, u as columnResultValue } from "./column-hqKr7-1I.mjs";
|
|
4
|
+
import { t as asValue } from "./value-Bi71Agyf.mjs";
|
|
6
5
|
//#region src/core/render.ts
|
|
7
6
|
function render(query, options = {}) {
|
|
8
7
|
const dialect = isDialect(options) ? options : options.dialect ?? standardDialect();
|
|
@@ -82,9 +81,9 @@ function call(name, ...args) {
|
|
|
82
81
|
});
|
|
83
82
|
}
|
|
84
83
|
/**
|
|
85
|
-
* Internal built-in function constructor for deterministic schema functions.
|
|
86
|
-
*
|
|
87
|
-
*
|
|
84
|
+
* Internal built-in function constructor for deterministic schema functions. Arbitrary calls stay
|
|
85
|
+
* on {@link call} and require an explicit schema extension contract before they can be used in
|
|
86
|
+
* schema metadata.
|
|
88
87
|
*/
|
|
89
88
|
function schemaCall(name, ...args) {
|
|
90
89
|
routineName(name);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as SchemaSnapshot } from "./types-
|
|
1
|
+
import { n as SchemaSnapshot } from "./types-BK1COGZe.mjs";
|
|
2
2
|
//#region src/introspection/connection.d.ts
|
|
3
3
|
/** A parameterized statement owned by a catalog adapter. */
|
|
4
4
|
interface CatalogQuery {
|
|
@@ -15,10 +15,9 @@ interface CatalogQueryOptions {
|
|
|
15
15
|
/**
|
|
16
16
|
* User-owned catalog query boundary.
|
|
17
17
|
*
|
|
18
|
-
* Qubu does not select a driver, open or close a connection, manage a pool,
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* returns already-decoded row records.
|
|
18
|
+
* Qubu does not select a driver, open or close a connection, manage a pool, authenticate, retry,
|
|
19
|
+
* start a transaction, or impose a timeout. The connection only executes fixed, parameterized
|
|
20
|
+
* catalog statements and returns already-decoded row records.
|
|
22
21
|
*/
|
|
23
22
|
interface CatalogConnection {
|
|
24
23
|
readonly dialect: CatalogDialect;
|
|
@@ -27,9 +26,9 @@ interface CatalogConnection {
|
|
|
27
26
|
//#endregion
|
|
28
27
|
//#region src/introspection/diagnostics.d.ts
|
|
29
28
|
/** Stable severity levels for discovery and normalization findings. */
|
|
30
|
-
type IntrospectionDiagnosticSeverity =
|
|
29
|
+
type IntrospectionDiagnosticSeverity = "error" | "warning" | "info";
|
|
31
30
|
/** Stable codes emitted by catalog discovery and normalization. */
|
|
32
|
-
type IntrospectionDiagnosticCode =
|
|
31
|
+
type IntrospectionDiagnosticCode = "connection-failed" | "query-failed" | "permission-denied" | "unsupported-product" | "unsupported-server" | "unsupported-feature" | "invalid-catalog-row" | "missing-catalog-row" | "expression-parse-failed" | "unresolved-reference" | "ambiguous-identity" | "unmodeled-object" | "lossy-mapping" | "dialect-mismatch" | "partial-result";
|
|
33
32
|
/** A path-addressed diagnostic from catalog discovery or normalization. */
|
|
34
33
|
interface IntrospectionDiagnostic {
|
|
35
34
|
readonly severity: IntrospectionDiagnosticSeverity;
|
|
@@ -47,8 +46,8 @@ interface IntrospectionDiagnostic {
|
|
|
47
46
|
/** Input accepted by {@link createIntrospectionDiagnostic}. */
|
|
48
47
|
type IntrospectionDiagnosticInput = IntrospectionDiagnostic;
|
|
49
48
|
/**
|
|
50
|
-
* Create one immutable diagnostic without interpreting catalog text or
|
|
51
|
-
*
|
|
49
|
+
* Create one immutable diagnostic without interpreting catalog text or copying driver error details
|
|
50
|
+
* into the structured fields.
|
|
52
51
|
*/
|
|
53
52
|
declare function createIntrospectionDiagnostic(diagnostic: IntrospectionDiagnosticInput): IntrospectionDiagnostic;
|
|
54
53
|
/** Return whether a diagnostic list prevents strict introspection output. */
|
|
@@ -63,9 +62,9 @@ declare class IntrospectionError extends Error {
|
|
|
63
62
|
//#endregion
|
|
64
63
|
//#region src/introspection/identity.d.ts
|
|
65
64
|
/** The source selected by the stable introspection identity precedence. */
|
|
66
|
-
type CatalogIdentitySource =
|
|
65
|
+
type CatalogIdentitySource = "explicit-hint" | "previous-snapshot" | "physical-name" | "deterministic-fallback";
|
|
67
66
|
/** Entity kinds for which a caller may provide a logical identity hint. */
|
|
68
|
-
type CatalogIdentityEntityKind = Exclude<CatalogEntityKind,
|
|
67
|
+
type CatalogIdentityEntityKind = Exclude<CatalogEntityKind, "namespace" | "deferred-object">;
|
|
69
68
|
/** A physical selector for one table-scoped or namespace-scoped entity. */
|
|
70
69
|
interface CatalogIdentityHint {
|
|
71
70
|
readonly kind: CatalogIdentityEntityKind;
|
|
@@ -79,7 +78,7 @@ interface CatalogIdentityHint {
|
|
|
79
78
|
/** The caller-provided identity hints accepted by an introspection run. */
|
|
80
79
|
type CatalogIdentityHints = readonly CatalogIdentityHint[];
|
|
81
80
|
/** How invalid physical names become deterministic logical IDs. */
|
|
82
|
-
type CatalogIdentityFallback =
|
|
81
|
+
type CatalogIdentityFallback = "escaped" | "hashed";
|
|
83
82
|
/** Versioned metadata for the identity policy used by one introspection run. */
|
|
84
83
|
interface CatalogIdentityPolicy {
|
|
85
84
|
readonly name: string;
|
|
@@ -95,8 +94,8 @@ interface CatalogResolvedIdentity {
|
|
|
95
94
|
readonly source: CatalogIdentitySource;
|
|
96
95
|
}
|
|
97
96
|
/**
|
|
98
|
-
* Inputs used when carrying a prior snapshot's table and column IDs forward.
|
|
99
|
-
*
|
|
97
|
+
* Inputs used when carrying a prior snapshot's table and column IDs forward. The resolver must
|
|
98
|
+
* match physical names inside the selected namespace only.
|
|
100
99
|
*/
|
|
101
100
|
interface CatalogPreviousSnapshotIdentitySource {
|
|
102
101
|
readonly snapshot: SchemaSnapshot;
|
|
@@ -104,11 +103,11 @@ interface CatalogPreviousSnapshotIdentitySource {
|
|
|
104
103
|
//#endregion
|
|
105
104
|
//#region src/introspection/types.d.ts
|
|
106
105
|
/** SQL engines supported by the common catalog contract. */
|
|
107
|
-
type CatalogDialect =
|
|
106
|
+
type CatalogDialect = "postgresql" | "sqlite" | "mysql";
|
|
108
107
|
/** A decoded row returned by a user-owned catalog connection. */
|
|
109
108
|
type CatalogQueryRow = Readonly<Record<string, unknown>>;
|
|
110
109
|
/** Physical objects that can receive stable logical IDs. */
|
|
111
|
-
type CatalogEntityKind =
|
|
110
|
+
type CatalogEntityKind = "namespace" | "table" | "column" | "constraint" | "index" | "view" | "materialized-view" | "sequence" | "enum" | "domain" | "collation" | "trigger" | "routine" | "partition" | "policy" | "extension" | "comment" | "ownership" | "opaque-object" | "deferred-object";
|
|
112
111
|
/** A scalar value retained as catalog data rather than executable SQL. */
|
|
113
112
|
type CatalogScalar = null | boolean | string | number | bigint;
|
|
114
113
|
/** Plain catalog data used for dialect extensions and unknown fields. */
|
|
@@ -122,8 +121,8 @@ interface CatalogCatalogReference {
|
|
|
122
121
|
readonly value: string | number;
|
|
123
122
|
}
|
|
124
123
|
/**
|
|
125
|
-
* A physical object reference with an optional current-run catalog key.
|
|
126
|
-
*
|
|
124
|
+
* A physical object reference with an optional current-run catalog key. PostgreSQL OIDs and similar
|
|
125
|
+
* values belong in `catalog`, not in logical IDs.
|
|
127
126
|
*/
|
|
128
127
|
interface CatalogReference {
|
|
129
128
|
readonly kind: CatalogEntityKind;
|
|
@@ -133,7 +132,7 @@ interface CatalogReference {
|
|
|
133
132
|
readonly catalog?: CatalogCatalogReference;
|
|
134
133
|
}
|
|
135
134
|
/** Where an opaque catalog SQL expression came from. */
|
|
136
|
-
type CatalogProvenanceKind =
|
|
135
|
+
type CatalogProvenanceKind = "catalog" | "decompiler" | "create-sql";
|
|
137
136
|
/** Source location retained with catalog-derived SQL text. */
|
|
138
137
|
interface CatalogProvenance {
|
|
139
138
|
readonly kind: CatalogProvenanceKind;
|
|
@@ -142,24 +141,24 @@ interface CatalogProvenance {
|
|
|
142
141
|
readonly path?: readonly (string | number)[];
|
|
143
142
|
}
|
|
144
143
|
/**
|
|
145
|
-
* Opaque SQL text recovered from catalog metadata. It has no evaluator or
|
|
146
|
-
*
|
|
144
|
+
* Opaque SQL text recovered from catalog metadata. It has no evaluator or Qubu expression
|
|
145
|
+
* implementation and must not be executed by introspection.
|
|
147
146
|
*/
|
|
148
147
|
interface CatalogSqlExpression {
|
|
149
|
-
readonly kind:
|
|
148
|
+
readonly kind: "sql";
|
|
150
149
|
readonly dialect: CatalogDialect;
|
|
151
150
|
readonly text: string;
|
|
152
151
|
readonly provenance: CatalogProvenance;
|
|
153
152
|
}
|
|
154
153
|
/** A literal catalog fact with optional source provenance. */
|
|
155
154
|
interface CatalogLiteralFact {
|
|
156
|
-
readonly kind:
|
|
155
|
+
readonly kind: "literal";
|
|
157
156
|
readonly value: CatalogScalar;
|
|
158
157
|
readonly provenance?: CatalogProvenance;
|
|
159
158
|
}
|
|
160
159
|
/** A catalog fact whose value remains opaque dialect SQL. */
|
|
161
160
|
interface CatalogExpressionFact {
|
|
162
|
-
readonly kind:
|
|
161
|
+
readonly kind: "expression";
|
|
163
162
|
readonly expression: CatalogSqlExpression;
|
|
164
163
|
}
|
|
165
164
|
/** Tagged data used by defaults, identity options, and dialect metadata. */
|
|
@@ -172,12 +171,12 @@ interface CatalogUnknownField {
|
|
|
172
171
|
}
|
|
173
172
|
/** A reference to an object in the normalized catalog. */
|
|
174
173
|
interface CatalogObjectReference {
|
|
175
|
-
readonly kind: Exclude<CatalogEntityKind,
|
|
174
|
+
readonly kind: Exclude<CatalogEntityKind, "namespace">;
|
|
176
175
|
readonly id: string;
|
|
177
176
|
}
|
|
178
177
|
/** A comment observed for a physical catalog object. */
|
|
179
178
|
interface CatalogComment {
|
|
180
|
-
readonly kind:
|
|
179
|
+
readonly kind: "comment";
|
|
181
180
|
readonly id: string;
|
|
182
181
|
readonly object: CatalogObjectReference;
|
|
183
182
|
readonly text: string;
|
|
@@ -188,7 +187,7 @@ interface CatalogComment {
|
|
|
188
187
|
}
|
|
189
188
|
/** Ownership metadata observed for a physical catalog object. */
|
|
190
189
|
interface CatalogOwnership {
|
|
191
|
-
readonly kind:
|
|
190
|
+
readonly kind: "ownership";
|
|
192
191
|
readonly id: string;
|
|
193
192
|
readonly object: CatalogObjectReference;
|
|
194
193
|
readonly owner: string;
|
|
@@ -205,7 +204,7 @@ interface CatalogObjectMetadata {
|
|
|
205
204
|
}
|
|
206
205
|
/** Common identity and physical-name fields for complete catalog objects. */
|
|
207
206
|
interface CatalogObjectBase extends CatalogObjectMetadata {
|
|
208
|
-
readonly kind: Exclude<CatalogEntityKind,
|
|
207
|
+
readonly kind: Exclude<CatalogEntityKind, "namespace">;
|
|
209
208
|
readonly id: string;
|
|
210
209
|
readonly identitySource: CatalogIdentitySource;
|
|
211
210
|
readonly physicalName: string;
|
|
@@ -214,9 +213,9 @@ interface CatalogObjectBase extends CatalogObjectMetadata {
|
|
|
214
213
|
readonly unknownFields?: readonly CatalogUnknownField[];
|
|
215
214
|
}
|
|
216
215
|
/** Portable classification retained beside an exact native declaration. */
|
|
217
|
-
type CatalogPortableStorageType =
|
|
216
|
+
type CatalogPortableStorageType = "integer" | "numeric" | "text" | "boolean" | "date" | "timestamp" | "uuid" | "json" | "bigint" | "binary";
|
|
218
217
|
/** Confidence for a portable classification, never a replacement for native type text. */
|
|
219
|
-
type CatalogClassificationConfidence =
|
|
218
|
+
type CatalogClassificationConfidence = "exact" | "inferred" | "unknown";
|
|
220
219
|
/** Exact native storage plus an optional portable classification. */
|
|
221
220
|
interface CatalogStorageType {
|
|
222
221
|
readonly nativeType: string;
|
|
@@ -227,14 +226,14 @@ interface CatalogStorageType {
|
|
|
227
226
|
}
|
|
228
227
|
/** A generated-column expression and its recovered storage mode. */
|
|
229
228
|
interface CatalogGeneratedColumn {
|
|
230
|
-
readonly kind:
|
|
229
|
+
readonly kind: "generated";
|
|
231
230
|
readonly expression: CatalogSqlExpression;
|
|
232
|
-
readonly mode:
|
|
231
|
+
readonly mode: "stored" | "virtual" | "unknown";
|
|
233
232
|
}
|
|
234
233
|
/** Identity behavior kept separate from defaults and generated expressions. */
|
|
235
234
|
interface CatalogIdentity {
|
|
236
|
-
readonly kind:
|
|
237
|
-
readonly generation:
|
|
235
|
+
readonly kind: "identity";
|
|
236
|
+
readonly generation: "always" | "by-default";
|
|
238
237
|
readonly options: Readonly<Record<string, CatalogValueFact>>;
|
|
239
238
|
readonly dialect?: CatalogDialectExtension;
|
|
240
239
|
}
|
|
@@ -250,13 +249,13 @@ interface CatalogCapabilities {
|
|
|
250
249
|
readonly generatedColumns: boolean;
|
|
251
250
|
readonly identityMetadata: boolean;
|
|
252
251
|
readonly checkConstraints: boolean;
|
|
253
|
-
readonly checkConstraintEnforcement:
|
|
252
|
+
readonly checkConstraintEnforcement: "enforced" | "metadata-only" | "unknown";
|
|
254
253
|
readonly expressionDecompilation: boolean;
|
|
255
254
|
readonly indexExpressions: boolean;
|
|
256
255
|
readonly indexPredicates: boolean;
|
|
257
256
|
readonly indexIncludedColumns: boolean;
|
|
258
257
|
readonly namespaces: boolean;
|
|
259
|
-
readonly visibility:
|
|
258
|
+
readonly visibility: "complete" | "limited" | "unknown";
|
|
260
259
|
readonly [capability: string]: boolean | string;
|
|
261
260
|
}
|
|
262
261
|
/** Server product, raw version text, parsed version, and adapter capabilities. */
|
|
@@ -268,7 +267,7 @@ interface CatalogServerInfo {
|
|
|
268
267
|
}
|
|
269
268
|
/** The one physical namespace selected for a catalog run. */
|
|
270
269
|
interface CatalogNamespace {
|
|
271
|
-
readonly kind:
|
|
270
|
+
readonly kind: "postgres-schema" | "sqlite-database" | "mysql-database";
|
|
272
271
|
readonly name: string;
|
|
273
272
|
readonly reference?: CatalogReference;
|
|
274
273
|
readonly provenance?: CatalogProvenance;
|
|
@@ -279,20 +278,20 @@ interface CatalogNamespace {
|
|
|
279
278
|
}
|
|
280
279
|
/** A logical reference used for normalized cross-object relationships. */
|
|
281
280
|
interface CatalogEntityReference {
|
|
282
|
-
readonly kind: Exclude<CatalogEntityKind,
|
|
281
|
+
readonly kind: Exclude<CatalogEntityKind, "namespace" | "deferred-object">;
|
|
283
282
|
readonly id: string;
|
|
284
283
|
readonly tableId?: string;
|
|
285
284
|
}
|
|
286
285
|
/** A primary key constraint in the normalized catalog. */
|
|
287
286
|
interface CatalogPrimaryKeyConstraint extends CatalogObjectMetadata {
|
|
288
|
-
readonly kind:
|
|
287
|
+
readonly kind: "primary-key";
|
|
289
288
|
readonly id: string;
|
|
290
289
|
readonly identitySource: CatalogIdentitySource;
|
|
291
290
|
readonly physicalName?: string;
|
|
292
291
|
readonly columns: readonly string[];
|
|
293
292
|
readonly backingIndex?: CatalogEntityReference;
|
|
294
293
|
readonly deferrable?: boolean;
|
|
295
|
-
readonly initially?:
|
|
294
|
+
readonly initially?: "immediate" | "deferred";
|
|
296
295
|
readonly validated?: boolean;
|
|
297
296
|
readonly reference?: CatalogReference;
|
|
298
297
|
readonly dialect?: CatalogDialectExtension;
|
|
@@ -300,15 +299,15 @@ interface CatalogPrimaryKeyConstraint extends CatalogObjectMetadata {
|
|
|
300
299
|
}
|
|
301
300
|
/** A unique constraint, including nullable uniqueness semantics. */
|
|
302
301
|
interface CatalogUniqueConstraint extends CatalogObjectMetadata {
|
|
303
|
-
readonly kind:
|
|
302
|
+
readonly kind: "unique";
|
|
304
303
|
readonly id: string;
|
|
305
304
|
readonly identitySource: CatalogIdentitySource;
|
|
306
305
|
readonly physicalName?: string;
|
|
307
306
|
readonly columns: readonly string[];
|
|
308
|
-
readonly nulls:
|
|
307
|
+
readonly nulls: "distinct" | "not-distinct";
|
|
309
308
|
readonly backingIndex?: CatalogEntityReference;
|
|
310
309
|
readonly deferrable?: boolean;
|
|
311
|
-
readonly initially?:
|
|
310
|
+
readonly initially?: "immediate" | "deferred";
|
|
312
311
|
readonly validated?: boolean;
|
|
313
312
|
readonly reference?: CatalogReference;
|
|
314
313
|
readonly dialect?: CatalogDialectExtension;
|
|
@@ -321,17 +320,17 @@ interface CatalogForeignKeyTarget {
|
|
|
321
320
|
}
|
|
322
321
|
/** A foreign key with ordered columns and referential actions. */
|
|
323
322
|
interface CatalogForeignKeyConstraint extends CatalogObjectMetadata {
|
|
324
|
-
readonly kind:
|
|
323
|
+
readonly kind: "foreign-key";
|
|
325
324
|
readonly id: string;
|
|
326
325
|
readonly identitySource: CatalogIdentitySource;
|
|
327
326
|
readonly physicalName?: string;
|
|
328
327
|
readonly columns: readonly string[];
|
|
329
328
|
readonly target: CatalogForeignKeyTarget;
|
|
330
|
-
readonly onUpdate?:
|
|
331
|
-
readonly onDelete?:
|
|
332
|
-
readonly match?:
|
|
329
|
+
readonly onUpdate?: "no-action" | "restrict" | "cascade" | "set-null" | "set-default";
|
|
330
|
+
readonly onDelete?: "no-action" | "restrict" | "cascade" | "set-null" | "set-default";
|
|
331
|
+
readonly match?: "simple" | "full" | "partial";
|
|
333
332
|
readonly deferrable?: boolean;
|
|
334
|
-
readonly initially?:
|
|
333
|
+
readonly initially?: "immediate" | "deferred";
|
|
335
334
|
readonly validated?: boolean;
|
|
336
335
|
readonly reference?: CatalogReference;
|
|
337
336
|
readonly dialect?: CatalogDialectExtension;
|
|
@@ -339,13 +338,13 @@ interface CatalogForeignKeyConstraint extends CatalogObjectMetadata {
|
|
|
339
338
|
}
|
|
340
339
|
/** A check constraint whose expression remains tagged catalog SQL. */
|
|
341
340
|
interface CatalogCheckConstraint extends CatalogObjectMetadata {
|
|
342
|
-
readonly kind:
|
|
341
|
+
readonly kind: "check";
|
|
343
342
|
readonly id: string;
|
|
344
343
|
readonly identitySource: CatalogIdentitySource;
|
|
345
344
|
readonly physicalName?: string;
|
|
346
345
|
readonly expression: CatalogSqlExpression;
|
|
347
346
|
readonly deferrable?: boolean;
|
|
348
|
-
readonly initially?:
|
|
347
|
+
readonly initially?: "immediate" | "deferred";
|
|
349
348
|
readonly validated?: boolean;
|
|
350
349
|
readonly reference?: CatalogReference;
|
|
351
350
|
readonly dialect?: CatalogDialectExtension;
|
|
@@ -355,24 +354,24 @@ interface CatalogCheckConstraint extends CatalogObjectMetadata {
|
|
|
355
354
|
type CatalogConstraint = CatalogPrimaryKeyConstraint | CatalogUniqueConstraint | CatalogForeignKeyConstraint | CatalogCheckConstraint;
|
|
356
355
|
/** One ordered column or expression term in a normalized index. */
|
|
357
356
|
type CatalogIndexTerm = {
|
|
358
|
-
readonly kind:
|
|
357
|
+
readonly kind: "column";
|
|
359
358
|
readonly column: string;
|
|
360
359
|
readonly position: number;
|
|
361
|
-
readonly direction?:
|
|
362
|
-
readonly nulls?:
|
|
360
|
+
readonly direction?: "ASC" | "DESC";
|
|
361
|
+
readonly nulls?: "FIRST" | "LAST";
|
|
363
362
|
readonly prefixLength?: CatalogValueFact;
|
|
364
363
|
readonly operatorClass?: string;
|
|
365
364
|
} | {
|
|
366
|
-
readonly kind:
|
|
365
|
+
readonly kind: "expression";
|
|
367
366
|
readonly expression: CatalogSqlExpression;
|
|
368
367
|
readonly position: number;
|
|
369
|
-
readonly direction?:
|
|
370
|
-
readonly nulls?:
|
|
368
|
+
readonly direction?: "ASC" | "DESC";
|
|
369
|
+
readonly nulls?: "FIRST" | "LAST";
|
|
371
370
|
readonly operatorClass?: string;
|
|
372
371
|
};
|
|
373
372
|
/** A normalized index with ordered terms and backing relationships. */
|
|
374
373
|
interface CatalogIndex extends CatalogObjectMetadata {
|
|
375
|
-
readonly kind:
|
|
374
|
+
readonly kind: "index";
|
|
376
375
|
readonly id: string;
|
|
377
376
|
readonly identitySource: CatalogIdentitySource;
|
|
378
377
|
readonly physicalName?: string;
|
|
@@ -388,7 +387,7 @@ interface CatalogIndex extends CatalogObjectMetadata {
|
|
|
388
387
|
}
|
|
389
388
|
/** A normalized table containing only ordinary included table metadata. */
|
|
390
389
|
interface CatalogTable extends CatalogObjectMetadata {
|
|
391
|
-
readonly kind:
|
|
390
|
+
readonly kind: "table";
|
|
392
391
|
readonly id: string;
|
|
393
392
|
readonly identitySource: CatalogIdentitySource;
|
|
394
393
|
readonly physicalName: string;
|
|
@@ -402,7 +401,7 @@ interface CatalogTable extends CatalogObjectMetadata {
|
|
|
402
401
|
}
|
|
403
402
|
/** A normalized visible column within an ordinary table. */
|
|
404
403
|
interface CatalogColumn extends CatalogObjectMetadata {
|
|
405
|
-
readonly kind:
|
|
404
|
+
readonly kind: "column";
|
|
406
405
|
readonly id: string;
|
|
407
406
|
readonly identitySource: CatalogIdentitySource;
|
|
408
407
|
readonly physicalName: string;
|
|
@@ -418,10 +417,10 @@ interface CatalogColumn extends CatalogObjectMetadata {
|
|
|
418
417
|
readonly unknownFields?: readonly CatalogUnknownField[];
|
|
419
418
|
}
|
|
420
419
|
/** Object categories intentionally retained outside Snapshot v1 tables. */
|
|
421
|
-
type CatalogDeferredObjectKind =
|
|
420
|
+
type CatalogDeferredObjectKind = "view" | "materialized-view" | "sequence" | "enum" | "domain" | "collation" | "routine" | "trigger" | "policy" | "extension" | "partition" | "virtual-table" | "shadow-table" | "temporary-object" | "foreign-table" | "other";
|
|
422
421
|
/** A deferred or unmodeled object retained for diagnostics and future support. */
|
|
423
422
|
interface CatalogDeferredObject extends CatalogObjectMetadata {
|
|
424
|
-
readonly kind:
|
|
423
|
+
readonly kind: "deferred-object";
|
|
425
424
|
readonly objectKind: CatalogDeferredObjectKind;
|
|
426
425
|
/** Optional in the legacy reader contract; complete readers should set it. */
|
|
427
426
|
readonly id?: string;
|
|
@@ -439,17 +438,17 @@ interface CatalogDialectExtension {
|
|
|
439
438
|
}
|
|
440
439
|
/** A view or materialized view definition and its exposed columns. */
|
|
441
440
|
interface CatalogView extends CatalogObjectBase {
|
|
442
|
-
readonly kind:
|
|
441
|
+
readonly kind: "view" | "materialized-view";
|
|
443
442
|
readonly columns: readonly CatalogColumn[];
|
|
444
443
|
readonly definition: CatalogSqlExpression;
|
|
445
444
|
readonly dependencies?: readonly CatalogObjectReference[];
|
|
446
|
-
readonly checkOption?:
|
|
445
|
+
readonly checkOption?: "none" | "local" | "cascaded";
|
|
447
446
|
readonly securityBarrier?: boolean;
|
|
448
447
|
readonly securityInvoker?: boolean;
|
|
449
448
|
}
|
|
450
449
|
/** Sequence metadata, including options needed to describe an identity. */
|
|
451
450
|
interface CatalogSequence extends CatalogObjectBase {
|
|
452
|
-
readonly kind:
|
|
451
|
+
readonly kind: "sequence";
|
|
453
452
|
readonly storage?: CatalogStorageType;
|
|
454
453
|
readonly start?: CatalogValueFact;
|
|
455
454
|
readonly increment?: CatalogValueFact;
|
|
@@ -468,12 +467,12 @@ interface CatalogEnumValue {
|
|
|
468
467
|
}
|
|
469
468
|
/** A database enum type with stable label ordering. */
|
|
470
469
|
interface CatalogEnum extends CatalogObjectBase {
|
|
471
|
-
readonly kind:
|
|
470
|
+
readonly kind: "enum";
|
|
472
471
|
readonly values: readonly CatalogEnumValue[];
|
|
473
472
|
}
|
|
474
473
|
/** A domain type layered over a native storage declaration. */
|
|
475
474
|
interface CatalogDomain extends CatalogObjectBase {
|
|
476
|
-
readonly kind:
|
|
475
|
+
readonly kind: "domain";
|
|
477
476
|
readonly storage: CatalogStorageType;
|
|
478
477
|
readonly nullable?: boolean;
|
|
479
478
|
readonly default?: CatalogValueFact;
|
|
@@ -481,7 +480,7 @@ interface CatalogDomain extends CatalogObjectBase {
|
|
|
481
480
|
}
|
|
482
481
|
/** Collation properties that affect comparison and ordering semantics. */
|
|
483
482
|
interface CatalogCollation extends CatalogObjectBase {
|
|
484
|
-
readonly kind:
|
|
483
|
+
readonly kind: "collation";
|
|
485
484
|
readonly provider?: string;
|
|
486
485
|
readonly locale?: string;
|
|
487
486
|
readonly deterministic?: boolean;
|
|
@@ -489,11 +488,11 @@ interface CatalogCollation extends CatalogObjectBase {
|
|
|
489
488
|
}
|
|
490
489
|
/** A trigger attached to a table or view, retaining its body as opaque SQL. */
|
|
491
490
|
interface CatalogTrigger extends CatalogObjectBase {
|
|
492
|
-
readonly kind:
|
|
491
|
+
readonly kind: "trigger";
|
|
493
492
|
readonly table: CatalogObjectReference;
|
|
494
|
-
readonly timing:
|
|
495
|
-
readonly events: readonly (
|
|
496
|
-
readonly orientation?:
|
|
493
|
+
readonly timing: "before" | "after" | "instead-of" | "unknown";
|
|
494
|
+
readonly events: readonly ("insert" | "update" | "delete" | "truncate")[];
|
|
495
|
+
readonly orientation?: "row" | "statement";
|
|
497
496
|
readonly condition?: CatalogSqlExpression;
|
|
498
497
|
readonly body: CatalogSqlExpression;
|
|
499
498
|
readonly enabled?: boolean;
|
|
@@ -501,7 +500,7 @@ interface CatalogTrigger extends CatalogObjectBase {
|
|
|
501
500
|
/** A routine parameter as observed in a function or procedure signature. */
|
|
502
501
|
interface CatalogRoutineParameter {
|
|
503
502
|
readonly name?: string;
|
|
504
|
-
readonly mode?:
|
|
503
|
+
readonly mode?: "in" | "out" | "inout" | "variadic" | "table";
|
|
505
504
|
readonly storage: CatalogStorageType;
|
|
506
505
|
readonly default?: CatalogValueFact;
|
|
507
506
|
readonly ordinalPosition: number;
|
|
@@ -509,31 +508,31 @@ interface CatalogRoutineParameter {
|
|
|
509
508
|
}
|
|
510
509
|
/** A function, procedure, aggregate, or other routine declaration. */
|
|
511
510
|
interface CatalogRoutine extends CatalogObjectBase {
|
|
512
|
-
readonly kind:
|
|
513
|
-
readonly routineKind:
|
|
511
|
+
readonly kind: "routine";
|
|
512
|
+
readonly routineKind: "function" | "procedure" | "aggregate" | "window" | "unknown";
|
|
514
513
|
readonly parameters: readonly CatalogRoutineParameter[];
|
|
515
514
|
readonly returnType?: CatalogStorageType;
|
|
516
515
|
readonly language?: string;
|
|
517
516
|
readonly body?: CatalogSqlExpression;
|
|
518
|
-
readonly volatility?:
|
|
519
|
-
readonly parallel?:
|
|
520
|
-
readonly security?:
|
|
517
|
+
readonly volatility?: "immutable" | "stable" | "volatile" | "unknown";
|
|
518
|
+
readonly parallel?: "safe" | "restricted" | "unsafe" | "unknown";
|
|
519
|
+
readonly security?: "invoker" | "definer" | "unknown";
|
|
521
520
|
readonly dependencies?: readonly CatalogObjectReference[];
|
|
522
521
|
}
|
|
523
522
|
/** A partition child and its normalized bound expression. */
|
|
524
523
|
interface CatalogPartition extends CatalogObjectBase {
|
|
525
|
-
readonly kind:
|
|
524
|
+
readonly kind: "partition";
|
|
526
525
|
readonly parent: CatalogObjectReference;
|
|
527
|
-
readonly strategy:
|
|
526
|
+
readonly strategy: "range" | "list" | "hash" | "reference" | "unknown";
|
|
528
527
|
readonly keyColumns?: readonly string[];
|
|
529
528
|
readonly bound?: CatalogSqlExpression;
|
|
530
529
|
readonly default?: boolean;
|
|
531
530
|
}
|
|
532
531
|
/** A row-level security policy attached to a table. */
|
|
533
532
|
interface CatalogPolicy extends CatalogObjectBase {
|
|
534
|
-
readonly kind:
|
|
533
|
+
readonly kind: "policy";
|
|
535
534
|
readonly table: CatalogObjectReference;
|
|
536
|
-
readonly command:
|
|
535
|
+
readonly command: "all" | "select" | "insert" | "update" | "delete" | "unknown";
|
|
537
536
|
readonly roles?: readonly string[];
|
|
538
537
|
readonly permissive?: boolean;
|
|
539
538
|
readonly using?: CatalogSqlExpression;
|
|
@@ -541,7 +540,7 @@ interface CatalogPolicy extends CatalogObjectBase {
|
|
|
541
540
|
}
|
|
542
541
|
/** An engine extension object and its typed, versioned payload. */
|
|
543
542
|
interface CatalogExtensionObject extends CatalogObjectBase {
|
|
544
|
-
readonly kind:
|
|
543
|
+
readonly kind: "extension";
|
|
545
544
|
readonly extensionName: string;
|
|
546
545
|
readonly extensionVersion?: string;
|
|
547
546
|
readonly schema?: string;
|
|
@@ -550,7 +549,7 @@ interface CatalogExtensionObject extends CatalogObjectBase {
|
|
|
550
549
|
}
|
|
551
550
|
/** An observed object whose family is not yet modeled by a first-party type. */
|
|
552
551
|
interface CatalogOpaqueObject extends CatalogObjectBase {
|
|
553
|
-
readonly kind:
|
|
552
|
+
readonly kind: "opaque-object";
|
|
554
553
|
readonly objectKind: string;
|
|
555
554
|
readonly data: CatalogData;
|
|
556
555
|
readonly sql?: CatalogSqlExpression;
|
|
@@ -609,7 +608,7 @@ interface IntrospectionCatalog {
|
|
|
609
608
|
readonly diagnostics: readonly IntrospectionDiagnostic[];
|
|
610
609
|
}
|
|
611
610
|
/** Strictness of the optional normalized-catalog-to-snapshot step. */
|
|
612
|
-
type IntrospectionMode =
|
|
611
|
+
type IntrospectionMode = "strict" | "lossy";
|
|
613
612
|
/** Inputs shared by dialect adapters and the later snapshot mapper. */
|
|
614
613
|
interface IntrospectionOptions {
|
|
615
614
|
/** PostgreSQL schema, MySQL database, or SQLite database name. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { H as makeSchemaExpression, K as fragment } from "./column-hqKr7-1I.mjs";
|
|
2
2
|
//#region src/core/primitives/parameter.ts
|
|
3
3
|
function parameter(_value) {
|
|
4
4
|
return fragment((context) => context.parameter(_value));
|