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,371 @@
1
+ import { A as SnapshotStorage, D as SnapshotLiteral, O as SnapshotNamingPolicy, T as SnapshotJsonValue, b as SnapshotGeneratedColumn, d as SnapshotDefault, f as SnapshotDiagnostic, g as SnapshotExpression, h as SnapshotDialectExtension, i as SchemaSnapshotInput, m as SnapshotDialect } from "./types-4Q076HKo.mjs";
2
+ //#region src/snapshot/complete-types.d.ts
3
+ /** The stable envelope tag shared by Snapshot v1 and the complete model. */
4
+ declare const completeSchemaSnapshotFormat: "qubu-schema";
5
+ /** The strict format version for the complete catalog/object model. */
6
+ declare const completeSchemaSnapshotVersion: 2;
7
+ /** Descriptive alias for consumers that select a numbered snapshot version. */
8
+ declare const schemaSnapshotV2Version: 2;
9
+ /** Explicit format-version aliases for generated tooling and fixtures. */
10
+ declare const schemaSnapshotCompleteVersion: 2;
11
+ declare const schemaSnapshotVersion2: 2;
12
+ /** Object families that may appear in a complete canonical snapshot. */
13
+ type CompleteSnapshotObjectKind = 'namespace' | 'table' | 'column' | 'constraint' | 'index' | 'view' | 'materialized-view' | 'sequence' | 'enum' | 'domain' | 'collation' | 'trigger' | 'routine' | 'partition' | 'policy' | 'extension' | 'comment' | 'ownership' | 'deferred-object' | 'opaque-object';
14
+ /** A stable logical object reference used by complete snapshot relations. */
15
+ interface CompleteSnapshotObjectReference {
16
+ readonly kind: Exclude<CompleteSnapshotObjectKind, 'namespace'>;
17
+ readonly id: string;
18
+ }
19
+ /** Source evidence retained without persisting a database catalog key. */
20
+ interface CompleteSnapshotProvenance {
21
+ readonly kind: 'catalog' | 'decompiler' | 'create-sql';
22
+ readonly dialect: string;
23
+ readonly path?: readonly (string | number)[];
24
+ }
25
+ /** Physical-name evidence retained without ephemeral catalog identity keys. */
26
+ interface CompleteSnapshotPhysicalReference {
27
+ readonly kind: CompleteSnapshotObjectKind;
28
+ readonly namespace?: string;
29
+ readonly table?: string;
30
+ readonly name: string;
31
+ }
32
+ /** Namespace identity and selected physical boundary for a snapshot. */
33
+ interface CompleteSnapshotNamespace extends CompleteSnapshotObjectMetadata {
34
+ readonly kind: 'postgres-schema' | 'sqlite-database' | 'mysql-database';
35
+ readonly name: string;
36
+ }
37
+ /** Capability facts reported by the adapter that produced the snapshot. */
38
+ interface CompleteSnapshotCapabilities {
39
+ readonly generatedColumns: boolean;
40
+ readonly identityMetadata: boolean;
41
+ readonly checkConstraints: boolean;
42
+ readonly checkConstraintEnforcement: 'enforced' | 'metadata-only' | 'unknown';
43
+ readonly expressionDecompilation: boolean;
44
+ readonly indexExpressions: boolean;
45
+ readonly indexPredicates: boolean;
46
+ readonly indexIncludedColumns: boolean;
47
+ readonly namespaces: boolean;
48
+ readonly visibility: 'complete' | 'limited' | 'unknown';
49
+ readonly [capability: string]: boolean | string;
50
+ }
51
+ /** Metadata common to every complete snapshot object. */
52
+ interface CompleteSnapshotObjectMetadata {
53
+ readonly provenance?: CompleteSnapshotProvenance;
54
+ readonly physicalReference?: CompleteSnapshotPhysicalReference;
55
+ readonly dialect?: SnapshotDialectExtension;
56
+ }
57
+ /** A complete snapshot column, including physical ordinal evidence. */
58
+ interface CompleteSnapshotColumn extends CompleteSnapshotObjectMetadata {
59
+ readonly kind: 'column';
60
+ readonly id: string;
61
+ readonly physicalName: string;
62
+ readonly ordinalPosition: number;
63
+ readonly nullable: boolean;
64
+ readonly hasDefault: boolean;
65
+ readonly generated: boolean;
66
+ readonly storage?: SnapshotStorage;
67
+ readonly default?: SnapshotDefault;
68
+ readonly generatedColumn?: SnapshotGeneratedColumn;
69
+ readonly identity?: CompleteSnapshotIdentity;
70
+ readonly onUpdate?: SnapshotExpression;
71
+ }
72
+ /** A richer identity declaration retained beside a column or sequence. */
73
+ interface CompleteSnapshotIdentity extends CompleteSnapshotObjectMetadata {
74
+ readonly kind: 'identity';
75
+ readonly generation: 'always' | 'by-default';
76
+ readonly options: Readonly<Record<string, CompleteSnapshotValueFact>>;
77
+ }
78
+ /** A literal or opaque expression value in complete object metadata. */
79
+ type CompleteSnapshotValueFact = {
80
+ readonly kind: 'literal';
81
+ readonly value: SnapshotLiteral;
82
+ } | {
83
+ readonly kind: 'expression';
84
+ readonly expression: SnapshotExpression;
85
+ };
86
+ /** An ordered column or expression term in a complete index. */
87
+ type CompleteSnapshotIndexTerm = {
88
+ readonly kind: 'column';
89
+ readonly column: string;
90
+ readonly position: number;
91
+ readonly direction?: 'ASC' | 'DESC';
92
+ readonly nulls?: 'FIRST' | 'LAST';
93
+ readonly prefixLength?: CompleteSnapshotValueFact;
94
+ readonly operatorClass?: string;
95
+ } | {
96
+ readonly kind: 'expression';
97
+ readonly expression: SnapshotExpression;
98
+ readonly position: number;
99
+ readonly direction?: 'ASC' | 'DESC';
100
+ readonly nulls?: 'FIRST' | 'LAST';
101
+ readonly operatorClass?: string;
102
+ };
103
+ /** A complete index with engine-specific method and included-column facts. */
104
+ interface CompleteSnapshotIndex extends CompleteSnapshotObjectMetadata {
105
+ readonly kind: 'index';
106
+ readonly id: string;
107
+ readonly physicalName: string;
108
+ readonly terms: readonly CompleteSnapshotIndexTerm[];
109
+ readonly unique: boolean;
110
+ readonly candidateKey: boolean;
111
+ readonly predicate?: SnapshotExpression;
112
+ readonly includedColumns?: readonly string[];
113
+ readonly backingConstraint?: CompleteSnapshotObjectReference;
114
+ readonly method?: string;
115
+ }
116
+ /** A key or uniqueness constraint in a complete table. */
117
+ interface CompleteSnapshotKeyConstraint extends CompleteSnapshotObjectMetadata {
118
+ readonly kind: 'primary-key' | 'unique' | 'unique-constraint';
119
+ readonly id: string;
120
+ readonly physicalName: string;
121
+ readonly columns: readonly string[];
122
+ readonly nulls?: 'distinct' | 'not-distinct';
123
+ readonly backingIndex?: CompleteSnapshotObjectReference;
124
+ readonly deferrable?: boolean;
125
+ readonly initially?: 'immediate' | 'deferred';
126
+ readonly validated?: boolean;
127
+ }
128
+ /** A foreign key with explicit target object identity and actions. */
129
+ interface CompleteSnapshotForeignKey extends CompleteSnapshotObjectMetadata {
130
+ readonly kind: 'foreign-key';
131
+ readonly id: string;
132
+ readonly physicalName: string;
133
+ readonly columns: readonly string[];
134
+ readonly target: {
135
+ readonly table: CompleteSnapshotObjectReference;
136
+ readonly columns: readonly string[];
137
+ };
138
+ readonly onUpdate?: 'no-action' | 'restrict' | 'cascade' | 'set-null' | 'set-default';
139
+ readonly onDelete?: 'no-action' | 'restrict' | 'cascade' | 'set-null' | 'set-default';
140
+ readonly match?: 'simple' | 'full' | 'partial';
141
+ readonly deferrable?: boolean;
142
+ readonly initially?: 'immediate' | 'deferred';
143
+ readonly validated?: boolean;
144
+ }
145
+ /** A check constraint whose expression remains tagged data. */
146
+ interface CompleteSnapshotCheckConstraint extends CompleteSnapshotObjectMetadata {
147
+ readonly kind: 'check';
148
+ readonly id: string;
149
+ readonly physicalName: string;
150
+ readonly expression: SnapshotExpression;
151
+ readonly deferrable?: boolean;
152
+ readonly initially?: 'immediate' | 'deferred';
153
+ readonly validated?: boolean;
154
+ }
155
+ /** Every constraint represented by the complete neutral snapshot model. */
156
+ type CompleteSnapshotConstraint = CompleteSnapshotKeyConstraint | CompleteSnapshotForeignKey | CompleteSnapshotCheckConstraint;
157
+ /** A complete table record keyed by stable logical identity. */
158
+ interface CompleteSnapshotTable extends CompleteSnapshotObjectMetadata {
159
+ readonly kind: 'table';
160
+ readonly id: string;
161
+ readonly physicalName: string;
162
+ readonly columns: readonly CompleteSnapshotColumn[];
163
+ readonly constraints: readonly CompleteSnapshotConstraint[];
164
+ readonly indexes: readonly CompleteSnapshotIndex[];
165
+ }
166
+ /** A view or materialized-view declaration and its output columns. */
167
+ interface CompleteSnapshotView extends CompleteSnapshotObjectMetadata {
168
+ readonly kind: 'view' | 'materialized-view';
169
+ readonly id: string;
170
+ readonly physicalName: string;
171
+ readonly columns: readonly CompleteSnapshotColumn[];
172
+ readonly definition: SnapshotExpression;
173
+ readonly dependencies?: readonly CompleteSnapshotObjectReference[];
174
+ readonly checkOption?: 'none' | 'local' | 'cascaded';
175
+ readonly securityBarrier?: boolean;
176
+ readonly securityInvoker?: boolean;
177
+ }
178
+ /** A sequence and its exact option facts. */
179
+ interface CompleteSnapshotSequence extends CompleteSnapshotObjectMetadata {
180
+ readonly kind: 'sequence';
181
+ readonly id: string;
182
+ readonly physicalName: string;
183
+ readonly storage?: SnapshotStorage;
184
+ readonly start?: CompleteSnapshotValueFact;
185
+ readonly increment?: CompleteSnapshotValueFact;
186
+ readonly minimum?: CompleteSnapshotValueFact;
187
+ readonly maximum?: CompleteSnapshotValueFact;
188
+ readonly cache?: CompleteSnapshotValueFact;
189
+ readonly cycle?: boolean;
190
+ readonly ownedBy?: CompleteSnapshotObjectReference;
191
+ readonly identity?: CompleteSnapshotIdentity;
192
+ }
193
+ /** An ordered enum declaration. */
194
+ interface CompleteSnapshotEnum extends CompleteSnapshotObjectMetadata {
195
+ readonly kind: 'enum';
196
+ readonly id: string;
197
+ readonly physicalName: string;
198
+ readonly values: readonly {
199
+ readonly value: string;
200
+ readonly ordinalPosition: number;
201
+ readonly provenance?: CompleteSnapshotProvenance;
202
+ }[];
203
+ }
204
+ /** A domain declaration and its base type constraints. */
205
+ interface CompleteSnapshotDomain extends CompleteSnapshotObjectMetadata {
206
+ readonly kind: 'domain';
207
+ readonly id: string;
208
+ readonly physicalName: string;
209
+ readonly storage: SnapshotStorage;
210
+ readonly nullable?: boolean;
211
+ readonly default?: CompleteSnapshotValueFact;
212
+ readonly constraints?: readonly CompleteSnapshotCheckConstraint[];
213
+ }
214
+ /** Collation behavior that can affect deterministic schema comparison. */
215
+ interface CompleteSnapshotCollation extends CompleteSnapshotObjectMetadata {
216
+ readonly kind: 'collation';
217
+ readonly id: string;
218
+ readonly physicalName: string;
219
+ readonly provider?: string;
220
+ readonly locale?: string;
221
+ readonly deterministic?: boolean;
222
+ readonly version?: string;
223
+ }
224
+ /** Trigger declaration attached to a table or view. */
225
+ interface CompleteSnapshotTrigger extends CompleteSnapshotObjectMetadata {
226
+ readonly kind: 'trigger';
227
+ readonly id: string;
228
+ readonly physicalName: string;
229
+ readonly table: CompleteSnapshotObjectReference;
230
+ readonly timing: 'before' | 'after' | 'instead-of' | 'unknown';
231
+ readonly events: readonly ('insert' | 'update' | 'delete' | 'truncate')[];
232
+ readonly orientation?: 'row' | 'statement';
233
+ readonly condition?: SnapshotExpression;
234
+ readonly body: SnapshotExpression;
235
+ readonly enabled?: boolean;
236
+ }
237
+ /** Routine argument declaration. */
238
+ interface CompleteSnapshotRoutineParameter {
239
+ readonly name?: string;
240
+ readonly mode?: 'in' | 'out' | 'inout' | 'variadic' | 'table';
241
+ readonly storage: SnapshotStorage;
242
+ readonly default?: CompleteSnapshotValueFact;
243
+ readonly ordinalPosition: number;
244
+ }
245
+ /** Function, procedure, aggregate, or window routine declaration. */
246
+ interface CompleteSnapshotRoutine extends CompleteSnapshotObjectMetadata {
247
+ readonly kind: 'routine';
248
+ readonly id: string;
249
+ readonly physicalName: string;
250
+ readonly routineKind: 'function' | 'procedure' | 'aggregate' | 'window' | 'unknown';
251
+ readonly parameters: readonly CompleteSnapshotRoutineParameter[];
252
+ readonly returnType?: SnapshotStorage;
253
+ readonly language?: string;
254
+ readonly body?: SnapshotExpression;
255
+ readonly volatility?: 'immutable' | 'stable' | 'volatile' | 'unknown';
256
+ readonly parallel?: 'safe' | 'restricted' | 'unsafe' | 'unknown';
257
+ readonly security?: 'invoker' | 'definer' | 'unknown';
258
+ readonly dependencies?: readonly CompleteSnapshotObjectReference[];
259
+ }
260
+ /** A partition child, its parent, and normalized bound expression. */
261
+ interface CompleteSnapshotPartition extends CompleteSnapshotObjectMetadata {
262
+ readonly kind: 'partition';
263
+ readonly id: string;
264
+ readonly physicalName: string;
265
+ readonly parent: CompleteSnapshotObjectReference;
266
+ readonly strategy: 'range' | 'list' | 'hash' | 'reference' | 'unknown';
267
+ readonly keyColumns?: readonly string[];
268
+ readonly bound?: SnapshotExpression;
269
+ readonly default?: boolean;
270
+ }
271
+ /** A row-level security policy attached to a table. */
272
+ interface CompleteSnapshotPolicy extends CompleteSnapshotObjectMetadata {
273
+ readonly kind: 'policy';
274
+ readonly id: string;
275
+ readonly physicalName: string;
276
+ readonly table: CompleteSnapshotObjectReference;
277
+ readonly command: 'all' | 'select' | 'insert' | 'update' | 'delete' | 'unknown';
278
+ readonly roles?: readonly string[];
279
+ readonly permissive?: boolean;
280
+ readonly using?: SnapshotExpression;
281
+ readonly check?: SnapshotExpression;
282
+ }
283
+ /** An extension object with a typed, versioned payload. */
284
+ interface CompleteSnapshotExtension extends CompleteSnapshotObjectMetadata {
285
+ readonly kind: 'extension';
286
+ readonly id: string;
287
+ readonly physicalName: string;
288
+ readonly extensionName: string;
289
+ readonly extensionVersion?: string;
290
+ readonly schema?: string;
291
+ readonly data: SnapshotJsonValue;
292
+ readonly configuration?: SnapshotJsonValue;
293
+ }
294
+ /** A deferred object retained as a reviewable, non-lossy boundary record. */
295
+ interface CompleteSnapshotDeferredObject extends CompleteSnapshotObjectMetadata {
296
+ readonly kind: 'deferred-object';
297
+ readonly id: string;
298
+ readonly objectKind: string;
299
+ readonly physicalName: string;
300
+ readonly reason?: string;
301
+ readonly data?: SnapshotJsonValue;
302
+ }
303
+ /** An opaque object observed by an adapter but not yet structurally modeled. */
304
+ interface CompleteSnapshotOpaqueObject extends CompleteSnapshotObjectMetadata {
305
+ readonly kind: 'opaque-object';
306
+ readonly id: string;
307
+ readonly objectKind: string;
308
+ readonly physicalName: string;
309
+ readonly data: SnapshotJsonValue;
310
+ readonly sql?: SnapshotExpression;
311
+ }
312
+ /** A comment attached to a stable logical object. */
313
+ interface CompleteSnapshotComment extends CompleteSnapshotObjectMetadata {
314
+ readonly kind: 'comment';
315
+ readonly id: string;
316
+ readonly physicalName: string;
317
+ readonly object: CompleteSnapshotObjectReference;
318
+ readonly text: string;
319
+ }
320
+ /** Ownership metadata attached to a stable logical object. */
321
+ interface CompleteSnapshotOwnership extends CompleteSnapshotObjectMetadata {
322
+ readonly kind: 'ownership';
323
+ readonly id: string;
324
+ readonly physicalName: string;
325
+ readonly object: CompleteSnapshotObjectReference;
326
+ readonly owner: string;
327
+ }
328
+ /** Every complete snapshot object family, including retained boundaries. */
329
+ type CompleteSnapshotObject = CompleteSnapshotTable | CompleteSnapshotView | CompleteSnapshotSequence | CompleteSnapshotEnum | CompleteSnapshotDomain | CompleteSnapshotCollation | CompleteSnapshotTrigger | CompleteSnapshotRoutine | CompleteSnapshotPartition | CompleteSnapshotPolicy | CompleteSnapshotExtension | CompleteSnapshotDeferredObject | CompleteSnapshotOpaqueObject | CompleteSnapshotComment | CompleteSnapshotOwnership;
330
+ /** The immutable strict Snapshot v2 envelope. */
331
+ interface CompleteSchemaSnapshot {
332
+ readonly format: typeof completeSchemaSnapshotFormat;
333
+ readonly version: typeof completeSchemaSnapshotVersion;
334
+ readonly dialect: SnapshotDialect;
335
+ readonly namingPolicy: SnapshotNamingPolicy;
336
+ readonly namespace: CompleteSnapshotNamespace;
337
+ readonly capabilities: CompleteSnapshotCapabilities;
338
+ readonly tables: readonly CompleteSnapshotTable[];
339
+ readonly views: readonly CompleteSnapshotView[];
340
+ readonly sequences: readonly CompleteSnapshotSequence[];
341
+ readonly enums: readonly CompleteSnapshotEnum[];
342
+ readonly domains: readonly CompleteSnapshotDomain[];
343
+ readonly collations: readonly CompleteSnapshotCollation[];
344
+ readonly triggers: readonly CompleteSnapshotTrigger[];
345
+ readonly routines: readonly CompleteSnapshotRoutine[];
346
+ readonly partitions: readonly CompleteSnapshotPartition[];
347
+ readonly policies: readonly CompleteSnapshotPolicy[];
348
+ readonly extensions: readonly CompleteSnapshotExtension[];
349
+ readonly deferredObjects: readonly CompleteSnapshotDeferredObject[];
350
+ readonly opaqueObjects: readonly CompleteSnapshotOpaqueObject[];
351
+ readonly comments: readonly CompleteSnapshotComment[];
352
+ readonly ownership: readonly CompleteSnapshotOwnership[];
353
+ }
354
+ /** Input accepted by the strict complete snapshot encoder. */
355
+ type CompleteSchemaSnapshotInput = CompleteSchemaSnapshot | SchemaSnapshotInput | Readonly<Record<string, unknown>>;
356
+ /** A complete snapshot decoder result with immutable successful output. */
357
+ type CompleteSnapshotDecodeResult = {
358
+ readonly ok: true;
359
+ readonly value: CompleteSchemaSnapshot;
360
+ } | {
361
+ readonly ok: false;
362
+ readonly diagnostics: readonly SnapshotDiagnostic[];
363
+ };
364
+ /** A complete snapshot creation result with immutable successful output. */
365
+ type CompleteSnapshotCreateResult = CompleteSnapshotDecodeResult;
366
+ /** v2 aliases kept explicit for consumers that prefer numbered APIs. */
367
+ type SchemaSnapshotV2 = CompleteSchemaSnapshot;
368
+ type SchemaSnapshotV2Input = CompleteSchemaSnapshotInput;
369
+ type SchemaSnapshotV2DecodeResult = CompleteSnapshotDecodeResult;
370
+ //#endregion
371
+ export { CompleteSnapshotProvenance as A, SchemaSnapshotV2Input as B, CompleteSnapshotObjectMetadata as C, CompleteSnapshotPartition as D, CompleteSnapshotOwnership as E, CompleteSnapshotTrigger as F, schemaSnapshotVersion2 as G, completeSchemaSnapshotVersion as H, CompleteSnapshotValueFact as I, CompleteSnapshotView as L, CompleteSnapshotRoutineParameter as M, CompleteSnapshotSequence as N, CompleteSnapshotPhysicalReference as O, CompleteSnapshotTable as P, SchemaSnapshotV2 as R, CompleteSnapshotObjectKind as S, CompleteSnapshotOpaqueObject as T, schemaSnapshotCompleteVersion as U, completeSchemaSnapshotFormat as V, schemaSnapshotV2Version as W, CompleteSnapshotIndex as _, CompleteSnapshotCollation as a, CompleteSnapshotNamespace as b, CompleteSnapshotConstraint as c, CompleteSnapshotDeferredObject as d, CompleteSnapshotDomain as f, CompleteSnapshotIdentity as g, CompleteSnapshotForeignKey as h, CompleteSnapshotCheckConstraint as i, CompleteSnapshotRoutine as j, CompleteSnapshotPolicy as k, CompleteSnapshotCreateResult as l, CompleteSnapshotExtension as m, CompleteSchemaSnapshotInput as n, CompleteSnapshotColumn as o, CompleteSnapshotEnum as p, CompleteSnapshotCapabilities as r, CompleteSnapshotComment as s, CompleteSchemaSnapshot as t, CompleteSnapshotDecodeResult as u, CompleteSnapshotIndexTerm as v, CompleteSnapshotObjectReference as w, CompleteSnapshotObject as x, CompleteSnapshotKeyConstraint as y, SchemaSnapshotV2DecodeResult as z };
@@ -0,0 +1,33 @@
1
+ import { $ as PaginationKind, $l as SubqueryMeta, Al as HasSubquery, B as CastTarget, Bl as ProvidesOuterSourceMeta, Cl as ExpressionMeta, Cu as SqlTypeSatisfies, Dl as GroupingKeysOf, Do as RenderedQuery, El as GroupingDependenciesOf, Eo as RenderOptions, Fi as SelectClause, Fl as NullabilityOf, G as DialectJson, Gl as RequiresCapabilityMeta, H as DialectCapability, Hl as QueryCardinality, Il as NullableSourceMeta, J as DialectRowLocking, Jl as RequiresOuterOf, K as DialectOptions, Kl as RequiresOf, Ll as NullableSourcesOf, Ml as InheritedMetadata, Nl as InheritedMetadataOf, Ol as GroupingMeta, Oo as render, Pi as ClausePlacement, Pl as MetadataOf, Q as NamedCastTarget, Ql as SqlTypeOf, Rl as OutputOf, Sl as DependenciesOf, Su as SqlTimestamp, Tl as FragmentMeta, To as RenderCapabilityValidation, Tu as SqlUuid, U as DialectCastTypes, Ul as RenderContext, V as Dialect, Va as typedValue, Vl as ProvidesSourceMeta, W as DialectExplain, Wa as typedCast, Wl as RenderFunction, X as ExplainRenderOptions, Xl as RequiresSourceMeta, Y as ExplainFormat, Yl as RequiresOuterSourceMeta, Z as JsonScalarKind, Zl as ResultMeta, _l as AnyFragment, _u as SqlOrderCompatible, at as SchemaLiteralRenderer, au as sequence, bl as CardinalityMeta, bu as SqlText, ct as resolveCastTarget, cu as SqlBinary, dl as isExpression, du as SqlDecimal, el as expressionFragment, et as PaginationPart, eu as VisibleDependenciesOf, fl as makeExpression, fu as SqlEqualityComparable, gl as AggregateMeta, gu as SqlNumericLike, hl as AggregateDependenciesOf, hu as SqlJson, it as RowLockWaitPolicy, iu as parenthesize, jl as HasWindow, kl as HasAggregate, lu as SqlBoolean, ml as withDialectCapability, mu as SqlInteger, nt as PortableCastType, nu as fragment, ot as assertDialectCapability, ou as AnySqlType, pl as markExpressionCategory, pu as SqlEqualityCompatible, q as DialectPagination, ql as RequiresOuterMetadataOf, ra as typedCall, rl as Expression, rt as RowLockMode, ru as isFragment, st as createDialect, su as SqlBigInt, tt as PortableCastTarget, tu as WindowMeta, uu as SqlDate, vl as CapabilitiesOf, vu as SqlOrderable, wl as Fragment, wu as SqlUnknown, xl as CardinalityOf, xu as SqlTextLike, yl as CapabilityMetadataOf, yu as SqlSemanticType, zl as ProvidesOuterOf } from "./types-4Q076HKo.mjs";
2
+ //#region src/core/primitives/compose.d.ts
3
+ declare function commaSeparated<const TParts extends readonly AnyFragment[]>(parts: TParts): Fragment<InheritedMetadata<TParts[number]>>;
4
+ declare function keyword<TPart extends AnyFragment | undefined>(value: string, part?: TPart): Fragment<TPart extends AnyFragment ? InheritedMetadata<TPart> : never>;
5
+ //#endregion
6
+ //#region src/core/primitives/identifier.d.ts
7
+ declare function identifier(name: string): Fragment<never>;
8
+ declare function qualifiedIdentifier(...parts: readonly string[]): Fragment<never>;
9
+ //#endregion
10
+ //#region src/core/primitives/parameter.d.ts
11
+ declare function parameter<T>(_value: T): Fragment<never>;
12
+ //#endregion
13
+ //#region src/core/primitives/routine.d.ts
14
+ /** Render a validated, unquoted SQL routine name such as `LOWER` or `app.fn`. */
15
+ declare function routineName(name: string): Fragment<never>;
16
+ //#endregion
17
+ //#region src/core/primitives/syntax.d.ts
18
+ /** Emit trusted SQL syntax. Never pass user data to this primitive. */
19
+ declare function syntax(value: string): Fragment<never>;
20
+ //#endregion
21
+ //#region src/expressions/unsafe.d.ts
22
+ /** Explicit escape hatch for syntax the standard primitives do not model. */
23
+ declare function unsafeExpression<T = unknown, TSqlType extends AnySqlType = SqlUnknown>(sql: string): Expression<ResultMeta<T, never, TSqlType> | ExpressionMeta<never>, 'unsafe'>;
24
+ //#endregion
25
+ //#region src/query/clauses/custom.d.ts
26
+ declare function customClause<TMetadata = never>(options: {
27
+ readonly name: string;
28
+ readonly placement?: ClausePlacement;
29
+ readonly order: number;
30
+ readonly render: (context: RenderContext) => void;
31
+ }): SelectClause<TMetadata>;
32
+ //#endregion
33
+ export { AggregateDependenciesOf, AggregateMeta, AnyFragment, AnySqlType, CapabilitiesOf, CapabilityMetadataOf, CardinalityMeta, CardinalityOf, CastTarget, DependenciesOf, Dialect, DialectCapability, DialectCastTypes, DialectExplain, DialectJson, DialectOptions, DialectPagination, DialectRowLocking, ExplainFormat, ExplainRenderOptions, ExpressionMeta, Fragment, FragmentMeta, GroupingDependenciesOf, GroupingKeysOf, GroupingMeta, HasAggregate, HasSubquery, HasWindow, InheritedMetadata, InheritedMetadataOf, JsonScalarKind, MetadataOf, NamedCastTarget, NullabilityOf, NullableSourceMeta, NullableSourcesOf, OutputOf, PaginationKind, PaginationPart, PortableCastTarget, PortableCastType, ProvidesOuterOf, ProvidesOuterSourceMeta, ProvidesSourceMeta, QueryCardinality, RenderCapabilityValidation, RenderContext, RenderFunction, RenderOptions, RenderedQuery, RequiresCapabilityMeta, RequiresOf, RequiresOuterMetadataOf, RequiresOuterOf, RequiresOuterSourceMeta, RequiresSourceMeta, ResultMeta, RowLockMode, RowLockWaitPolicy, SchemaLiteralRenderer, SqlBigInt, SqlBinary, SqlBoolean, SqlDate, SqlDecimal, SqlEqualityComparable, SqlEqualityCompatible, SqlInteger, SqlJson, SqlNumericLike, SqlOrderCompatible, SqlOrderable, SqlSemanticType, SqlText, SqlTextLike, SqlTimestamp, SqlTypeOf, SqlTypeSatisfies, SqlUnknown, SqlUuid, SubqueryMeta, VisibleDependenciesOf, WindowMeta, assertDialectCapability, commaSeparated, createDialect, customClause, expressionFragment, fragment, identifier, isExpression, isFragment, keyword, makeExpression, markExpressionCategory, parameter, parenthesize, qualifiedIdentifier, render, resolveCastTarget, routineName, sequence, syntax, typedCall, typedCast, typedValue, unsafeExpression, withDialectCapability };
package/dist/core.mjs ADDED
@@ -0,0 +1,36 @@
1
+ import { a as assertDialectCapability, o as createDialect, s as resolveCastTarget } from "./json-CUZlv4HT.mjs";
2
+ import { a as routineName, c as render, i as typedCall, s as typedCast, t as createClause } from "./types-Cec0xzo4.mjs";
3
+ import { a as qualifiedIdentifier, c as makeExpression, f as withDialectCapability, g as sequence, h as parenthesize, i as identifier, m as isFragment, n as expressionFragment, o as isExpression, p as fragment, u as markExpressionCategory } from "./column-CXMxx8Hq.mjs";
4
+ import { a as parameter, r as typedValue } from "./value-BvilP0oz.mjs";
5
+ //#region src/core/primitives/compose.ts
6
+ function commaSeparated(parts) {
7
+ return sequence(parts, ", ");
8
+ }
9
+ function keyword(value, part) {
10
+ return fragment((context) => {
11
+ context.append(value);
12
+ if (part) {
13
+ context.append(" ");
14
+ context.render(part);
15
+ }
16
+ });
17
+ }
18
+ //#endregion
19
+ //#region src/core/primitives/syntax.ts
20
+ /** Emit trusted SQL syntax. Never pass user data to this primitive. */
21
+ function syntax(value) {
22
+ return fragment((context) => context.append(value));
23
+ }
24
+ //#endregion
25
+ //#region src/expressions/unsafe.ts
26
+ /** Explicit escape hatch for syntax the standard primitives do not model. */
27
+ function unsafeExpression(sql) {
28
+ return makeExpression("unsafe", (context) => context.render(syntax(sql)));
29
+ }
30
+ //#endregion
31
+ //#region src/query/clauses/custom.ts
32
+ function customClause(options) {
33
+ return createClause(options.name, options.placement ?? "after-select", options.order, options.render);
34
+ }
35
+ //#endregion
36
+ export { assertDialectCapability, commaSeparated, createDialect, customClause, expressionFragment, fragment, identifier, isExpression, isFragment, keyword, makeExpression, markExpressionCategory, parameter, parenthesize, qualifiedIdentifier, render, resolveCastTarget, routineName, sequence, syntax, typedCall, typedCast, typedValue, unsafeExpression, withDialectCapability };
package/dist/ddl.d.mts ADDED
@@ -0,0 +1,118 @@
1
+ import { Mr as SchemaDialect } from "./types-4Q076HKo.mjs";
2
+ import { MigrationLockRequirement, MigrationOperation, MigrationPlan, MigrationTransactionRequirement } from "./migration.mjs";
3
+ //#region src/ddl/types.d.ts
4
+ /** Stable diagnostic categories produced before a migration is rendered. */
5
+ type DdlDiagnosticCode = 'invalid-plan' | 'blocked-plan' | 'decision-required' | 'dialect-mismatch' | 'unsupported' | 'server-version' | 'lock-conflict' | 'transaction-conflict' | 'lossy' | 'unknown' | 'destructive' | 'review-required' | 'ambiguous' | 'malformed-operation' | 'custom-sql' | 'capability' | 'non-canonical';
6
+ /** A path-addressed finding from DDL preflight or rendering. */
7
+ interface DdlDiagnostic {
8
+ readonly code: DdlDiagnosticCode;
9
+ readonly severity: 'error' | 'warning';
10
+ readonly message: string;
11
+ readonly operationId?: string;
12
+ readonly path: readonly (string | number)[];
13
+ readonly kind?: MigrationOperation['kind'];
14
+ readonly dialect?: string;
15
+ readonly requiredVersion?: string;
16
+ readonly actualVersion?: string;
17
+ readonly lock?: MigrationLockRequirement;
18
+ readonly transaction?: MigrationTransactionRequirement;
19
+ }
20
+ /** One deterministic statement emitted for one plan operation. */
21
+ interface DdlStatement {
22
+ readonly operationId: string;
23
+ readonly position: number;
24
+ readonly kind: MigrationOperation['kind'];
25
+ /** SQL text with dialect placeholders, if a dialect ever needs them. */
26
+ readonly sql: string;
27
+ /** Alias for callers that use the query renderer's terminology. */
28
+ readonly text: string;
29
+ /** DDL literals are normally in SQL; this remains explicit and ordered. */
30
+ readonly parameters: readonly unknown[];
31
+ }
32
+ /** Policy and execution-context facts used by DDL preflight. */
33
+ interface DdlEmissionOptions {
34
+ /** Permit a plan whose own `ready` flag is false after reviewing diagnostics. */
35
+ readonly allowBlocked?: boolean;
36
+ /** Alias for callers that intentionally permit all review gates. */
37
+ readonly allowUnsafe?: boolean;
38
+ readonly allowDecisionRequired?: boolean;
39
+ readonly allowUnknown?: boolean;
40
+ readonly allowLossy?: boolean;
41
+ readonly allowUnsupported?: boolean;
42
+ readonly allowDestructive?: boolean;
43
+ readonly allowReviewRequired?: boolean;
44
+ /** Server version used for syntax checks, such as SQLite DROP COLUMN. */
45
+ readonly serverVersion?: string | number;
46
+ /** Whether the caller will wrap statements in one transaction. */
47
+ readonly transaction?: 'managed' | 'autocommit' | 'none';
48
+ /** Maximum lock the caller can acquire for this migration. */
49
+ readonly lock?: Exclude<MigrationLockRequirement, 'unknown'>;
50
+ }
51
+ /** Result of preflight plus deterministic statement rendering. */
52
+ interface DdlEmission {
53
+ readonly ok: boolean;
54
+ readonly dialect: string;
55
+ readonly statements: readonly DdlStatement[];
56
+ readonly diagnostics: readonly DdlDiagnostic[];
57
+ /** Statements joined with a newline for simple migration-file writers. */
58
+ readonly sql: string;
59
+ /** Flattened parameters in statement order. */
60
+ readonly parameters: readonly unknown[];
61
+ }
62
+ /** Descriptive alias for callers that name rendered output as a result. */
63
+ type DdlEmissionResult = DdlEmission;
64
+ /** A dialect-specific DDL emitter. */
65
+ interface DdlEmitter {
66
+ readonly dialect: string;
67
+ diagnose(plan: MigrationPlan, schemaDialect: SchemaDialect, options?: DdlEmissionOptions): readonly DdlDiagnostic[];
68
+ emit(plan: MigrationPlan, schemaDialect: SchemaDialect, options?: DdlEmissionOptions): DdlEmission;
69
+ }
70
+ //#endregion
71
+ //#region src/ddl/emitter.d.ts
72
+ interface DdlFeatures {
73
+ readonly dialect: 'postgresql' | 'sqlite' | 'mysql';
74
+ readonly supports: ReadonlySet<string>;
75
+ }
76
+ /**
77
+ * Build the shared strict preflight and rendering boundary for one engine.
78
+ * The renderer only receives a validated MigrationPlan and a SchemaDialect.
79
+ */
80
+ declare function createDdlEmitter(features: DdlFeatures): DdlEmitter;
81
+ //#endregion
82
+ //#region src/ddl/postgres.d.ts
83
+ /** PostgreSQL operation support used by the strict DDL preflight. */
84
+ declare const postgresDdlEmitter: DdlEmitter;
85
+ /** Emit a reviewed plan with PostgreSQL's schema dialect. */
86
+ declare function emitPostgresMigrationPlan(plan: MigrationPlan, options?: DdlEmissionOptions): DdlEmission;
87
+ /** Alias using the full PostgreSQL spelling. */
88
+ declare const emitPostgresqlMigrationPlan: typeof emitPostgresMigrationPlan;
89
+ declare const emitPostgresDdl: typeof emitPostgresMigrationPlan;
90
+ declare const emitPostgresqlDdl: typeof emitPostgresMigrationPlan;
91
+ //#endregion
92
+ //#region src/ddl/sqlite.d.ts
93
+ /** SQLite operation support used by the strict DDL preflight. */
94
+ declare const sqliteDdlEmitter: DdlEmitter;
95
+ /** Emit a reviewed plan with SQLite's schema dialect. */
96
+ declare function emitSqliteMigrationPlan(plan: MigrationPlan, options?: DdlEmissionOptions): DdlEmission;
97
+ declare const emitSqliteDdl: typeof emitSqliteMigrationPlan;
98
+ //#endregion
99
+ //#region src/ddl/mysql.d.ts
100
+ /** MySQL operation support used by the strict DDL preflight. */
101
+ declare const mysqlDdlEmitter: DdlEmitter;
102
+ /** Emit a reviewed plan with MySQL's schema dialect. */
103
+ declare function emitMysqlMigrationPlan(plan: MigrationPlan, options?: DdlEmissionOptions): DdlEmission;
104
+ declare const emitMysqlDdl: typeof emitMysqlMigrationPlan;
105
+ //#endregion
106
+ //#region src/ddl/index.d.ts
107
+ /** Select a first-party emitter by the selected schema dialect name. */
108
+ declare function ddlEmitterForDialect(dialect: SchemaDialect): DdlEmitter;
109
+ /** Emit a plan through the matching first-party schema dialect. */
110
+ declare function emitMigrationPlan(plan: MigrationPlan, dialect: SchemaDialect, options?: DdlEmissionOptions): DdlEmission;
111
+ /** Convenient defaults for callers that already selected a plan dialect. */
112
+ declare const ddlDialects: Readonly<{
113
+ postgresql: SchemaDialect<"json" | "ilike" | "on-conflict" | "row-locking">;
114
+ sqlite: SchemaDialect<"json" | "on-conflict">;
115
+ mysql: SchemaDialect<"json" | "row-locking">;
116
+ }>;
117
+ //#endregion
118
+ export { DdlDiagnostic, DdlDiagnosticCode, DdlEmission, DdlEmissionOptions, DdlEmissionResult, DdlEmitter, DdlFeatures, DdlStatement, createDdlEmitter, ddlDialects, ddlEmitterForDialect, emitMigrationPlan, emitMysqlDdl, emitMysqlMigrationPlan, emitPostgresDdl, emitPostgresMigrationPlan, emitPostgresqlDdl, emitPostgresqlMigrationPlan, emitSqliteDdl, emitSqliteMigrationPlan, mysqlDdlEmitter, postgresDdlEmitter, sqliteDdlEmitter };