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,4 +1,4 @@
|
|
|
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-
|
|
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-BK1COGZe.mjs";
|
|
2
2
|
//#region src/snapshot/complete-types.d.ts
|
|
3
3
|
/** The stable envelope tag shared by Snapshot v1 and the complete model. */
|
|
4
4
|
declare const completeSchemaSnapshotFormat: "qubu-schema";
|
|
@@ -10,15 +10,15 @@ declare const schemaSnapshotV2Version: 2;
|
|
|
10
10
|
declare const schemaSnapshotCompleteVersion: 2;
|
|
11
11
|
declare const schemaSnapshotVersion2: 2;
|
|
12
12
|
/** Object families that may appear in a complete canonical snapshot. */
|
|
13
|
-
type CompleteSnapshotObjectKind =
|
|
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
14
|
/** A stable logical object reference used by complete snapshot relations. */
|
|
15
15
|
interface CompleteSnapshotObjectReference {
|
|
16
|
-
readonly kind: Exclude<CompleteSnapshotObjectKind,
|
|
16
|
+
readonly kind: Exclude<CompleteSnapshotObjectKind, "namespace">;
|
|
17
17
|
readonly id: string;
|
|
18
18
|
}
|
|
19
19
|
/** Source evidence retained without persisting a database catalog key. */
|
|
20
20
|
interface CompleteSnapshotProvenance {
|
|
21
|
-
readonly kind:
|
|
21
|
+
readonly kind: "catalog" | "decompiler" | "create-sql";
|
|
22
22
|
readonly dialect: string;
|
|
23
23
|
readonly path?: readonly (string | number)[];
|
|
24
24
|
}
|
|
@@ -31,7 +31,7 @@ interface CompleteSnapshotPhysicalReference {
|
|
|
31
31
|
}
|
|
32
32
|
/** Namespace identity and selected physical boundary for a snapshot. */
|
|
33
33
|
interface CompleteSnapshotNamespace extends CompleteSnapshotObjectMetadata {
|
|
34
|
-
readonly kind:
|
|
34
|
+
readonly kind: "postgres-schema" | "sqlite-database" | "mysql-database";
|
|
35
35
|
readonly name: string;
|
|
36
36
|
}
|
|
37
37
|
/** Capability facts reported by the adapter that produced the snapshot. */
|
|
@@ -39,13 +39,13 @@ interface CompleteSnapshotCapabilities {
|
|
|
39
39
|
readonly generatedColumns: boolean;
|
|
40
40
|
readonly identityMetadata: boolean;
|
|
41
41
|
readonly checkConstraints: boolean;
|
|
42
|
-
readonly checkConstraintEnforcement:
|
|
42
|
+
readonly checkConstraintEnforcement: "enforced" | "metadata-only" | "unknown";
|
|
43
43
|
readonly expressionDecompilation: boolean;
|
|
44
44
|
readonly indexExpressions: boolean;
|
|
45
45
|
readonly indexPredicates: boolean;
|
|
46
46
|
readonly indexIncludedColumns: boolean;
|
|
47
47
|
readonly namespaces: boolean;
|
|
48
|
-
readonly visibility:
|
|
48
|
+
readonly visibility: "complete" | "limited" | "unknown";
|
|
49
49
|
readonly [capability: string]: boolean | string;
|
|
50
50
|
}
|
|
51
51
|
/** Metadata common to every complete snapshot object. */
|
|
@@ -56,7 +56,7 @@ interface CompleteSnapshotObjectMetadata {
|
|
|
56
56
|
}
|
|
57
57
|
/** A complete snapshot column, including physical ordinal evidence. */
|
|
58
58
|
interface CompleteSnapshotColumn extends CompleteSnapshotObjectMetadata {
|
|
59
|
-
readonly kind:
|
|
59
|
+
readonly kind: "column";
|
|
60
60
|
readonly id: string;
|
|
61
61
|
readonly physicalName: string;
|
|
62
62
|
readonly ordinalPosition: number;
|
|
@@ -71,38 +71,38 @@ interface CompleteSnapshotColumn extends CompleteSnapshotObjectMetadata {
|
|
|
71
71
|
}
|
|
72
72
|
/** A richer identity declaration retained beside a column or sequence. */
|
|
73
73
|
interface CompleteSnapshotIdentity extends CompleteSnapshotObjectMetadata {
|
|
74
|
-
readonly kind:
|
|
75
|
-
readonly generation:
|
|
74
|
+
readonly kind: "identity";
|
|
75
|
+
readonly generation: "always" | "by-default";
|
|
76
76
|
readonly options: Readonly<Record<string, CompleteSnapshotValueFact>>;
|
|
77
77
|
}
|
|
78
78
|
/** A literal or opaque expression value in complete object metadata. */
|
|
79
79
|
type CompleteSnapshotValueFact = {
|
|
80
|
-
readonly kind:
|
|
80
|
+
readonly kind: "literal";
|
|
81
81
|
readonly value: SnapshotLiteral;
|
|
82
82
|
} | {
|
|
83
|
-
readonly kind:
|
|
83
|
+
readonly kind: "expression";
|
|
84
84
|
readonly expression: SnapshotExpression;
|
|
85
85
|
};
|
|
86
86
|
/** An ordered column or expression term in a complete index. */
|
|
87
87
|
type CompleteSnapshotIndexTerm = {
|
|
88
|
-
readonly kind:
|
|
88
|
+
readonly kind: "column";
|
|
89
89
|
readonly column: string;
|
|
90
90
|
readonly position: number;
|
|
91
|
-
readonly direction?:
|
|
92
|
-
readonly nulls?:
|
|
91
|
+
readonly direction?: "ASC" | "DESC";
|
|
92
|
+
readonly nulls?: "FIRST" | "LAST";
|
|
93
93
|
readonly prefixLength?: CompleteSnapshotValueFact;
|
|
94
94
|
readonly operatorClass?: string;
|
|
95
95
|
} | {
|
|
96
|
-
readonly kind:
|
|
96
|
+
readonly kind: "expression";
|
|
97
97
|
readonly expression: SnapshotExpression;
|
|
98
98
|
readonly position: number;
|
|
99
|
-
readonly direction?:
|
|
100
|
-
readonly nulls?:
|
|
99
|
+
readonly direction?: "ASC" | "DESC";
|
|
100
|
+
readonly nulls?: "FIRST" | "LAST";
|
|
101
101
|
readonly operatorClass?: string;
|
|
102
102
|
};
|
|
103
103
|
/** A complete index with engine-specific method and included-column facts. */
|
|
104
104
|
interface CompleteSnapshotIndex extends CompleteSnapshotObjectMetadata {
|
|
105
|
-
readonly kind:
|
|
105
|
+
readonly kind: "index";
|
|
106
106
|
readonly id: string;
|
|
107
107
|
readonly physicalName: string;
|
|
108
108
|
readonly terms: readonly CompleteSnapshotIndexTerm[];
|
|
@@ -115,19 +115,19 @@ interface CompleteSnapshotIndex extends CompleteSnapshotObjectMetadata {
|
|
|
115
115
|
}
|
|
116
116
|
/** A key or uniqueness constraint in a complete table. */
|
|
117
117
|
interface CompleteSnapshotKeyConstraint extends CompleteSnapshotObjectMetadata {
|
|
118
|
-
readonly kind:
|
|
118
|
+
readonly kind: "primary-key" | "unique" | "unique-constraint";
|
|
119
119
|
readonly id: string;
|
|
120
120
|
readonly physicalName: string;
|
|
121
121
|
readonly columns: readonly string[];
|
|
122
|
-
readonly nulls?:
|
|
122
|
+
readonly nulls?: "distinct" | "not-distinct";
|
|
123
123
|
readonly backingIndex?: CompleteSnapshotObjectReference;
|
|
124
124
|
readonly deferrable?: boolean;
|
|
125
|
-
readonly initially?:
|
|
125
|
+
readonly initially?: "immediate" | "deferred";
|
|
126
126
|
readonly validated?: boolean;
|
|
127
127
|
}
|
|
128
128
|
/** A foreign key with explicit target object identity and actions. */
|
|
129
129
|
interface CompleteSnapshotForeignKey extends CompleteSnapshotObjectMetadata {
|
|
130
|
-
readonly kind:
|
|
130
|
+
readonly kind: "foreign-key";
|
|
131
131
|
readonly id: string;
|
|
132
132
|
readonly physicalName: string;
|
|
133
133
|
readonly columns: readonly string[];
|
|
@@ -135,28 +135,28 @@ interface CompleteSnapshotForeignKey extends CompleteSnapshotObjectMetadata {
|
|
|
135
135
|
readonly table: CompleteSnapshotObjectReference;
|
|
136
136
|
readonly columns: readonly string[];
|
|
137
137
|
};
|
|
138
|
-
readonly onUpdate?:
|
|
139
|
-
readonly onDelete?:
|
|
140
|
-
readonly match?:
|
|
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
141
|
readonly deferrable?: boolean;
|
|
142
|
-
readonly initially?:
|
|
142
|
+
readonly initially?: "immediate" | "deferred";
|
|
143
143
|
readonly validated?: boolean;
|
|
144
144
|
}
|
|
145
145
|
/** A check constraint whose expression remains tagged data. */
|
|
146
146
|
interface CompleteSnapshotCheckConstraint extends CompleteSnapshotObjectMetadata {
|
|
147
|
-
readonly kind:
|
|
147
|
+
readonly kind: "check";
|
|
148
148
|
readonly id: string;
|
|
149
149
|
readonly physicalName: string;
|
|
150
150
|
readonly expression: SnapshotExpression;
|
|
151
151
|
readonly deferrable?: boolean;
|
|
152
|
-
readonly initially?:
|
|
152
|
+
readonly initially?: "immediate" | "deferred";
|
|
153
153
|
readonly validated?: boolean;
|
|
154
154
|
}
|
|
155
155
|
/** Every constraint represented by the complete neutral snapshot model. */
|
|
156
156
|
type CompleteSnapshotConstraint = CompleteSnapshotKeyConstraint | CompleteSnapshotForeignKey | CompleteSnapshotCheckConstraint;
|
|
157
157
|
/** A complete table record keyed by stable logical identity. */
|
|
158
158
|
interface CompleteSnapshotTable extends CompleteSnapshotObjectMetadata {
|
|
159
|
-
readonly kind:
|
|
159
|
+
readonly kind: "table";
|
|
160
160
|
readonly id: string;
|
|
161
161
|
readonly physicalName: string;
|
|
162
162
|
readonly columns: readonly CompleteSnapshotColumn[];
|
|
@@ -165,19 +165,19 @@ interface CompleteSnapshotTable extends CompleteSnapshotObjectMetadata {
|
|
|
165
165
|
}
|
|
166
166
|
/** A view or materialized-view declaration and its output columns. */
|
|
167
167
|
interface CompleteSnapshotView extends CompleteSnapshotObjectMetadata {
|
|
168
|
-
readonly kind:
|
|
168
|
+
readonly kind: "view" | "materialized-view";
|
|
169
169
|
readonly id: string;
|
|
170
170
|
readonly physicalName: string;
|
|
171
171
|
readonly columns: readonly CompleteSnapshotColumn[];
|
|
172
172
|
readonly definition: SnapshotExpression;
|
|
173
173
|
readonly dependencies?: readonly CompleteSnapshotObjectReference[];
|
|
174
|
-
readonly checkOption?:
|
|
174
|
+
readonly checkOption?: "none" | "local" | "cascaded";
|
|
175
175
|
readonly securityBarrier?: boolean;
|
|
176
176
|
readonly securityInvoker?: boolean;
|
|
177
177
|
}
|
|
178
178
|
/** A sequence and its exact option facts. */
|
|
179
179
|
interface CompleteSnapshotSequence extends CompleteSnapshotObjectMetadata {
|
|
180
|
-
readonly kind:
|
|
180
|
+
readonly kind: "sequence";
|
|
181
181
|
readonly id: string;
|
|
182
182
|
readonly physicalName: string;
|
|
183
183
|
readonly storage?: SnapshotStorage;
|
|
@@ -192,7 +192,7 @@ interface CompleteSnapshotSequence extends CompleteSnapshotObjectMetadata {
|
|
|
192
192
|
}
|
|
193
193
|
/** An ordered enum declaration. */
|
|
194
194
|
interface CompleteSnapshotEnum extends CompleteSnapshotObjectMetadata {
|
|
195
|
-
readonly kind:
|
|
195
|
+
readonly kind: "enum";
|
|
196
196
|
readonly id: string;
|
|
197
197
|
readonly physicalName: string;
|
|
198
198
|
readonly values: readonly {
|
|
@@ -203,7 +203,7 @@ interface CompleteSnapshotEnum extends CompleteSnapshotObjectMetadata {
|
|
|
203
203
|
}
|
|
204
204
|
/** A domain declaration and its base type constraints. */
|
|
205
205
|
interface CompleteSnapshotDomain extends CompleteSnapshotObjectMetadata {
|
|
206
|
-
readonly kind:
|
|
206
|
+
readonly kind: "domain";
|
|
207
207
|
readonly id: string;
|
|
208
208
|
readonly physicalName: string;
|
|
209
209
|
readonly storage: SnapshotStorage;
|
|
@@ -213,7 +213,7 @@ interface CompleteSnapshotDomain extends CompleteSnapshotObjectMetadata {
|
|
|
213
213
|
}
|
|
214
214
|
/** Collation behavior that can affect deterministic schema comparison. */
|
|
215
215
|
interface CompleteSnapshotCollation extends CompleteSnapshotObjectMetadata {
|
|
216
|
-
readonly kind:
|
|
216
|
+
readonly kind: "collation";
|
|
217
217
|
readonly id: string;
|
|
218
218
|
readonly physicalName: string;
|
|
219
219
|
readonly provider?: string;
|
|
@@ -223,13 +223,13 @@ interface CompleteSnapshotCollation extends CompleteSnapshotObjectMetadata {
|
|
|
223
223
|
}
|
|
224
224
|
/** Trigger declaration attached to a table or view. */
|
|
225
225
|
interface CompleteSnapshotTrigger extends CompleteSnapshotObjectMetadata {
|
|
226
|
-
readonly kind:
|
|
226
|
+
readonly kind: "trigger";
|
|
227
227
|
readonly id: string;
|
|
228
228
|
readonly physicalName: string;
|
|
229
229
|
readonly table: CompleteSnapshotObjectReference;
|
|
230
|
-
readonly timing:
|
|
231
|
-
readonly events: readonly (
|
|
232
|
-
readonly orientation?:
|
|
230
|
+
readonly timing: "before" | "after" | "instead-of" | "unknown";
|
|
231
|
+
readonly events: readonly ("insert" | "update" | "delete" | "truncate")[];
|
|
232
|
+
readonly orientation?: "row" | "statement";
|
|
233
233
|
readonly condition?: SnapshotExpression;
|
|
234
234
|
readonly body: SnapshotExpression;
|
|
235
235
|
readonly enabled?: boolean;
|
|
@@ -237,44 +237,44 @@ interface CompleteSnapshotTrigger extends CompleteSnapshotObjectMetadata {
|
|
|
237
237
|
/** Routine argument declaration. */
|
|
238
238
|
interface CompleteSnapshotRoutineParameter {
|
|
239
239
|
readonly name?: string;
|
|
240
|
-
readonly mode?:
|
|
240
|
+
readonly mode?: "in" | "out" | "inout" | "variadic" | "table";
|
|
241
241
|
readonly storage: SnapshotStorage;
|
|
242
242
|
readonly default?: CompleteSnapshotValueFact;
|
|
243
243
|
readonly ordinalPosition: number;
|
|
244
244
|
}
|
|
245
245
|
/** Function, procedure, aggregate, or window routine declaration. */
|
|
246
246
|
interface CompleteSnapshotRoutine extends CompleteSnapshotObjectMetadata {
|
|
247
|
-
readonly kind:
|
|
247
|
+
readonly kind: "routine";
|
|
248
248
|
readonly id: string;
|
|
249
249
|
readonly physicalName: string;
|
|
250
|
-
readonly routineKind:
|
|
250
|
+
readonly routineKind: "function" | "procedure" | "aggregate" | "window" | "unknown";
|
|
251
251
|
readonly parameters: readonly CompleteSnapshotRoutineParameter[];
|
|
252
252
|
readonly returnType?: SnapshotStorage;
|
|
253
253
|
readonly language?: string;
|
|
254
254
|
readonly body?: SnapshotExpression;
|
|
255
|
-
readonly volatility?:
|
|
256
|
-
readonly parallel?:
|
|
257
|
-
readonly security?:
|
|
255
|
+
readonly volatility?: "immutable" | "stable" | "volatile" | "unknown";
|
|
256
|
+
readonly parallel?: "safe" | "restricted" | "unsafe" | "unknown";
|
|
257
|
+
readonly security?: "invoker" | "definer" | "unknown";
|
|
258
258
|
readonly dependencies?: readonly CompleteSnapshotObjectReference[];
|
|
259
259
|
}
|
|
260
260
|
/** A partition child, its parent, and normalized bound expression. */
|
|
261
261
|
interface CompleteSnapshotPartition extends CompleteSnapshotObjectMetadata {
|
|
262
|
-
readonly kind:
|
|
262
|
+
readonly kind: "partition";
|
|
263
263
|
readonly id: string;
|
|
264
264
|
readonly physicalName: string;
|
|
265
265
|
readonly parent: CompleteSnapshotObjectReference;
|
|
266
|
-
readonly strategy:
|
|
266
|
+
readonly strategy: "range" | "list" | "hash" | "reference" | "unknown";
|
|
267
267
|
readonly keyColumns?: readonly string[];
|
|
268
268
|
readonly bound?: SnapshotExpression;
|
|
269
269
|
readonly default?: boolean;
|
|
270
270
|
}
|
|
271
271
|
/** A row-level security policy attached to a table. */
|
|
272
272
|
interface CompleteSnapshotPolicy extends CompleteSnapshotObjectMetadata {
|
|
273
|
-
readonly kind:
|
|
273
|
+
readonly kind: "policy";
|
|
274
274
|
readonly id: string;
|
|
275
275
|
readonly physicalName: string;
|
|
276
276
|
readonly table: CompleteSnapshotObjectReference;
|
|
277
|
-
readonly command:
|
|
277
|
+
readonly command: "all" | "select" | "insert" | "update" | "delete" | "unknown";
|
|
278
278
|
readonly roles?: readonly string[];
|
|
279
279
|
readonly permissive?: boolean;
|
|
280
280
|
readonly using?: SnapshotExpression;
|
|
@@ -282,7 +282,7 @@ interface CompleteSnapshotPolicy extends CompleteSnapshotObjectMetadata {
|
|
|
282
282
|
}
|
|
283
283
|
/** An extension object with a typed, versioned payload. */
|
|
284
284
|
interface CompleteSnapshotExtension extends CompleteSnapshotObjectMetadata {
|
|
285
|
-
readonly kind:
|
|
285
|
+
readonly kind: "extension";
|
|
286
286
|
readonly id: string;
|
|
287
287
|
readonly physicalName: string;
|
|
288
288
|
readonly extensionName: string;
|
|
@@ -293,7 +293,7 @@ interface CompleteSnapshotExtension extends CompleteSnapshotObjectMetadata {
|
|
|
293
293
|
}
|
|
294
294
|
/** A deferred object retained as a reviewable, non-lossy boundary record. */
|
|
295
295
|
interface CompleteSnapshotDeferredObject extends CompleteSnapshotObjectMetadata {
|
|
296
|
-
readonly kind:
|
|
296
|
+
readonly kind: "deferred-object";
|
|
297
297
|
readonly id: string;
|
|
298
298
|
readonly objectKind: string;
|
|
299
299
|
readonly physicalName: string;
|
|
@@ -302,7 +302,7 @@ interface CompleteSnapshotDeferredObject extends CompleteSnapshotObjectMetadata
|
|
|
302
302
|
}
|
|
303
303
|
/** An opaque object observed by an adapter but not yet structurally modeled. */
|
|
304
304
|
interface CompleteSnapshotOpaqueObject extends CompleteSnapshotObjectMetadata {
|
|
305
|
-
readonly kind:
|
|
305
|
+
readonly kind: "opaque-object";
|
|
306
306
|
readonly id: string;
|
|
307
307
|
readonly objectKind: string;
|
|
308
308
|
readonly physicalName: string;
|
|
@@ -311,7 +311,7 @@ interface CompleteSnapshotOpaqueObject extends CompleteSnapshotObjectMetadata {
|
|
|
311
311
|
}
|
|
312
312
|
/** A comment attached to a stable logical object. */
|
|
313
313
|
interface CompleteSnapshotComment extends CompleteSnapshotObjectMetadata {
|
|
314
|
-
readonly kind:
|
|
314
|
+
readonly kind: "comment";
|
|
315
315
|
readonly id: string;
|
|
316
316
|
readonly physicalName: string;
|
|
317
317
|
readonly object: CompleteSnapshotObjectReference;
|
|
@@ -319,7 +319,7 @@ interface CompleteSnapshotComment extends CompleteSnapshotObjectMetadata {
|
|
|
319
319
|
}
|
|
320
320
|
/** Ownership metadata attached to a stable logical object. */
|
|
321
321
|
interface CompleteSnapshotOwnership extends CompleteSnapshotObjectMetadata {
|
|
322
|
-
readonly kind:
|
|
322
|
+
readonly kind: "ownership";
|
|
323
323
|
readonly id: string;
|
|
324
324
|
readonly physicalName: string;
|
|
325
325
|
readonly object: CompleteSnapshotObjectReference;
|
|
@@ -363,7 +363,7 @@ type CompleteSnapshotDecodeResult = {
|
|
|
363
363
|
};
|
|
364
364
|
/** A complete snapshot creation result with immutable successful output. */
|
|
365
365
|
type CompleteSnapshotCreateResult = CompleteSnapshotDecodeResult;
|
|
366
|
-
/**
|
|
366
|
+
/** V2 aliases kept explicit for consumers that prefer numbered APIs. */
|
|
367
367
|
type SchemaSnapshotV2 = CompleteSchemaSnapshot;
|
|
368
368
|
type SchemaSnapshotV2Input = CompleteSchemaSnapshotInput;
|
|
369
369
|
type SchemaSnapshotV2DecodeResult = CompleteSnapshotDecodeResult;
|
package/dist/core.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as PaginationKind, $l as InheritedMetadata, Au as SqlBoolean, B as CastTarget, Bl as CapabilityMetadataOf, Bu as SqlSemanticType, Cl as markExpressionCategory, Cu as fragment, Du as AnySqlType, Eu as sequence, Fu as SqlInteger, G as DialectJson, Ga as
|
|
1
|
+
import { $ as PaginationKind, $c as RenderCapabilityValidation, $l as InheritedMetadata, Au as SqlBoolean, B as CastTarget, Bl as CapabilityMetadataOf, Bu as SqlSemanticType, Ca as SelectClause, Cl as markExpressionCategory, Cu as fragment, Du as AnySqlType, Eu as sequence, Fu as SqlInteger, G as DialectJson, Ga as typedCall, Gl as Fragment, Gu as SqlUnknown, H as DialectCapability, Hl as CardinalityOf, Hu as SqlTextLike, Il as AggregateDependenciesOf, Iu as SqlJson, J as DialectRowLocking, Jl as GroupingKeysOf, K as DialectOptions, Kl as FragmentMeta, Ku as SqlUuid, Ll as AggregateMeta, Lu as SqlNumericLike, Mu as SqlDecimal, No as typedCast, Nu as SqlEqualityComparable, Ou as SqlBigInt, Pu as SqlEqualityCompatible, Q as NamedCastTarget, Ql as HasWindow, Rl as AnyFragment, Ru as SqlOrderCompatible, Sa as ClausePlacement, Sl as makeExpression, Su as WindowMeta, Tu as parenthesize, U as DialectCastTypes, Ul as DependenciesOf, Uu as SqlTimestamp, V as Dialect, Vl as CardinalityMeta, Vu as SqlText, W as DialectExplain, Wl as ExpressionMeta, Wu as SqlTypeSatisfies, X as ExplainRenderOptions, Xl as HasAggregate, Y as ExplainFormat, Yl as GroupingMeta, Z as JsonScalarKind, Zl as HasSubquery, _u as RequiresSourceMeta, at as SchemaLiteralRenderer, au as OutputOf, bu as SubqueryMeta, ct as resolveCastTarget, cu as ProvidesSourceMeta, du as RenderFunction, el as RenderOptions, et as PaginationPart, eu as InheritedMetadataOf, fl as Expression, fu as RequiresCapabilityMeta, gu as RequiresOuterSourceMeta, hu as RequiresOuterOf, it as RowLockWaitPolicy, iu as NullableSourcesOf, ju as SqlDate, ko as typedValue, ku as SqlBinary, ll as expressionFragment, lu as QueryCardinality, mu as RequiresOuterMetadataOf, nl as render, nt as PortableCastType, nu as NullabilityOf, ot as assertDialectCapability, ou as ProvidesOuterOf, pu as RequiresOf, q as DialectPagination, ql as GroupingDependenciesOf, rt as RowLockMode, ru as NullableSourceMeta, st as createDialect, su as ProvidesOuterSourceMeta, tl as RenderedQuery, tt as PortableCastTarget, tu as MetadataOf, uu as RenderContext, vu as ResultMeta, wl as withDialectCapability, wu as isFragment, xl as isExpression, xu as VisibleDependenciesOf, yu as SqlTypeOf, zl as CapabilitiesOf, zu as SqlOrderable } from "./types-BK1COGZe.mjs";
|
|
2
2
|
//#region src/core/primitives/compose.d.ts
|
|
3
3
|
declare function commaSeparated<const TParts extends readonly AnyFragment[]>(parts: TParts): Fragment<InheritedMetadata<TParts[number]>>;
|
|
4
4
|
declare function keyword<TPart extends AnyFragment | undefined>(value: string, part?: TPart): Fragment<TPart extends AnyFragment ? InheritedMetadata<TPart> : never>;
|
|
@@ -20,7 +20,7 @@ declare function syntax(value: string): Fragment<never>;
|
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/expressions/unsafe.d.ts
|
|
22
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>,
|
|
23
|
+
declare function unsafeExpression<T = unknown, TSqlType extends AnySqlType = SqlUnknown>(sql: string): Expression<ResultMeta<T, never, TSqlType> | ExpressionMeta<never>, "unsafe">;
|
|
24
24
|
//#endregion
|
|
25
25
|
//#region src/query/clauses/custom.d.ts
|
|
26
26
|
declare function customClause<TMetadata = never>(options: {
|
package/dist/core.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as assertDialectCapability, o as createDialect, s as resolveCastTarget } from "./json-
|
|
2
|
-
import { a as routineName, c as render, i as typedCall, s as typedCast, t as createClause } from "./types-
|
|
3
|
-
import {
|
|
4
|
-
import { a as parameter, r as typedValue } from "./value-
|
|
1
|
+
import { a as assertDialectCapability, o as createDialect, s as resolveCastTarget } from "./json-Db7XRD91.mjs";
|
|
2
|
+
import { a as routineName, c as render, i as typedCall, s as typedCast, t as createClause } from "./types-JM3FcAnX.mjs";
|
|
3
|
+
import { G as withDialectCapability, J as parenthesize, K as fragment, U as markExpressionCategory, V as makeExpression, Y as sequence, a as qualifiedIdentifier, i as identifier, n as expressionFragment, q as isFragment, z as isExpression } from "./column-hqKr7-1I.mjs";
|
|
4
|
+
import { a as parameter, r as typedValue } from "./value-Bi71Agyf.mjs";
|
|
5
5
|
//#region src/core/primitives/compose.ts
|
|
6
6
|
function commaSeparated(parts) {
|
|
7
7
|
return sequence(parts, ", ");
|
package/dist/ddl.d.mts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Tr as SchemaDialect } from "./types-BK1COGZe.mjs";
|
|
2
2
|
import { MigrationLockRequirement, MigrationOperation, MigrationPlan, MigrationTransactionRequirement } from "./migration.mjs";
|
|
3
3
|
//#region src/ddl/types.d.ts
|
|
4
4
|
/** Stable diagnostic categories produced before a migration is rendered. */
|
|
5
|
-
type DdlDiagnosticCode =
|
|
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
6
|
/** A path-addressed finding from DDL preflight or rendering. */
|
|
7
7
|
interface DdlDiagnostic {
|
|
8
8
|
readonly code: DdlDiagnosticCode;
|
|
9
|
-
readonly severity:
|
|
9
|
+
readonly severity: "error" | "warning";
|
|
10
10
|
readonly message: string;
|
|
11
11
|
readonly operationId?: string;
|
|
12
12
|
readonly path: readonly (string | number)[];
|
|
13
|
-
readonly kind?: MigrationOperation[
|
|
13
|
+
readonly kind?: MigrationOperation["kind"];
|
|
14
14
|
readonly dialect?: string;
|
|
15
15
|
readonly requiredVersion?: string;
|
|
16
16
|
readonly actualVersion?: string;
|
|
@@ -21,7 +21,7 @@ interface DdlDiagnostic {
|
|
|
21
21
|
interface DdlStatement {
|
|
22
22
|
readonly operationId: string;
|
|
23
23
|
readonly position: number;
|
|
24
|
-
readonly kind: MigrationOperation[
|
|
24
|
+
readonly kind: MigrationOperation["kind"];
|
|
25
25
|
/** SQL text with dialect placeholders, if a dialect ever needs them. */
|
|
26
26
|
readonly sql: string;
|
|
27
27
|
/** Alias for callers that use the query renderer's terminology. */
|
|
@@ -44,9 +44,9 @@ interface DdlEmissionOptions {
|
|
|
44
44
|
/** Server version used for syntax checks, such as SQLite DROP COLUMN. */
|
|
45
45
|
readonly serverVersion?: string | number;
|
|
46
46
|
/** Whether the caller will wrap statements in one transaction. */
|
|
47
|
-
readonly transaction?:
|
|
47
|
+
readonly transaction?: "managed" | "autocommit" | "none";
|
|
48
48
|
/** Maximum lock the caller can acquire for this migration. */
|
|
49
|
-
readonly lock?: Exclude<MigrationLockRequirement,
|
|
49
|
+
readonly lock?: Exclude<MigrationLockRequirement, "unknown">;
|
|
50
50
|
}
|
|
51
51
|
/** Result of preflight plus deterministic statement rendering. */
|
|
52
52
|
interface DdlEmission {
|
|
@@ -70,12 +70,12 @@ interface DdlEmitter {
|
|
|
70
70
|
//#endregion
|
|
71
71
|
//#region src/ddl/emitter.d.ts
|
|
72
72
|
interface DdlFeatures {
|
|
73
|
-
readonly dialect:
|
|
73
|
+
readonly dialect: "postgresql" | "sqlite" | "mysql";
|
|
74
74
|
readonly supports: ReadonlySet<string>;
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
|
-
* Build the shared strict preflight and rendering boundary for one engine.
|
|
78
|
-
*
|
|
77
|
+
* Build the shared strict preflight and rendering boundary for one engine. The renderer only
|
|
78
|
+
* receives a validated MigrationPlan and a SchemaDialect.
|
|
79
79
|
*/
|
|
80
80
|
declare function createDdlEmitter(features: DdlFeatures): DdlEmitter;
|
|
81
81
|
//#endregion
|
|
@@ -110,9 +110,9 @@ declare function ddlEmitterForDialect(dialect: SchemaDialect): DdlEmitter;
|
|
|
110
110
|
declare function emitMigrationPlan(plan: MigrationPlan, dialect: SchemaDialect, options?: DdlEmissionOptions): DdlEmission;
|
|
111
111
|
/** Convenient defaults for callers that already selected a plan dialect. */
|
|
112
112
|
declare const ddlDialects: Readonly<{
|
|
113
|
-
postgresql: SchemaDialect<"
|
|
113
|
+
postgresql: SchemaDialect<"row-locking" | "json" | "ilike" | "on-conflict">;
|
|
114
114
|
sqlite: SchemaDialect<"json" | "on-conflict">;
|
|
115
|
-
mysql: SchemaDialect<"
|
|
115
|
+
mysql: SchemaDialect<"row-locking" | "json">;
|
|
116
116
|
}>;
|
|
117
117
|
//#endregion
|
|
118
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 };
|
package/dist/ddl.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { n as sqliteSchemaDialect } from "./sqlite-
|
|
2
|
-
import { n as postgresSchemaDialect } from "./
|
|
3
|
-
import { n as mysqlSchemaDialect } from "./mysql-CKEKGnj4.mjs";
|
|
1
|
+
import { n as sqliteSchemaDialect } from "./sqlite-Cg0nwYEH.mjs";
|
|
2
|
+
import { n as mysqlSchemaDialect, s as postgresSchemaDialect } from "./mysql-B_cYzzX2.mjs";
|
|
4
3
|
import { assertMigrationPlan } from "./migration.mjs";
|
|
5
4
|
//#region src/ddl/emitter.ts
|
|
6
5
|
const objectKinds = /* @__PURE__ */ new Set([
|
|
@@ -32,8 +31,8 @@ const lockRank = {
|
|
|
32
31
|
exclusive: 2
|
|
33
32
|
};
|
|
34
33
|
/**
|
|
35
|
-
* Build the shared strict preflight and rendering boundary for one engine.
|
|
36
|
-
*
|
|
34
|
+
* Build the shared strict preflight and rendering boundary for one engine. The renderer only
|
|
35
|
+
* receives a validated MigrationPlan and a SchemaDialect.
|
|
37
36
|
*/
|
|
38
37
|
function createDdlEmitter(features) {
|
|
39
38
|
const emitter = {
|
|
@@ -286,7 +285,7 @@ function isOperationSupported(features, operation) {
|
|
|
286
285
|
function renderOperation(operation, operations, dialect, features) {
|
|
287
286
|
if (operation.type === "custom-sql") return normalizeSql(operation.customSql?.sql ?? "");
|
|
288
287
|
const object = operation.type === "remove" ? operation.origin?.before : operation.origin?.after ?? operation.origin?.before;
|
|
289
|
-
if (object === void 0) return
|
|
288
|
+
if (object === void 0) return;
|
|
290
289
|
const value = object.value;
|
|
291
290
|
switch (operation.type) {
|
|
292
291
|
case "add": return renderAdd(operation, value, operations, dialect, features);
|
|
@@ -297,7 +296,7 @@ function renderOperation(operation, operations, dialect, features) {
|
|
|
297
296
|
}
|
|
298
297
|
}
|
|
299
298
|
function renderAdd(operation, value, operations, dialect, features) {
|
|
300
|
-
if (!isRecord(value)) return
|
|
299
|
+
if (!isRecord(value)) return;
|
|
301
300
|
const name = requiredName(operation, value);
|
|
302
301
|
switch (operation.kind) {
|
|
303
302
|
case "namespace": return features.dialect === "postgresql" ? `CREATE SCHEMA ${dialect.quoteIdentifier(name)}` : void 0;
|
|
@@ -322,7 +321,7 @@ function renderAdd(operation, value, operations, dialect, features) {
|
|
|
322
321
|
}
|
|
323
322
|
}
|
|
324
323
|
function renderRemove(operation, value, operations, dialect, features) {
|
|
325
|
-
if (!isRecord(value)) return
|
|
324
|
+
if (!isRecord(value)) return;
|
|
326
325
|
const name = requiredName(operation, value);
|
|
327
326
|
switch (operation.kind) {
|
|
328
327
|
case "namespace": return features.dialect === "postgresql" ? `DROP SCHEMA ${dialect.quoteIdentifier(name)}` : void 0;
|
|
@@ -350,7 +349,7 @@ function renderRemove(operation, value, operations, dialect, features) {
|
|
|
350
349
|
}
|
|
351
350
|
}
|
|
352
351
|
function renderPropertyChange(operation, value, operations, dialect, features) {
|
|
353
|
-
if (!isRecord(value)) return
|
|
352
|
+
if (!isRecord(value)) return;
|
|
354
353
|
if (operation.kind === "comment" || operation.kind === "ownership") return operation.kind === "comment" ? renderComment(operation, value, dialect, features) : renderOwnership(operation, value, dialect, features);
|
|
355
354
|
if (operation.kind === "column") return renderAlterColumn(operation, value, operations, dialect, features);
|
|
356
355
|
if (operation.kind === "index") {
|
|
@@ -374,7 +373,7 @@ function renderPropertyChange(operation, value, operations, dialect, features) {
|
|
|
374
373
|
function renderRename(operation, operations, dialect, features) {
|
|
375
374
|
const before = operation.origin?.before;
|
|
376
375
|
const after = operation.origin?.after;
|
|
377
|
-
if (before === void 0 || after === void 0) return
|
|
376
|
+
if (before === void 0 || after === void 0) return;
|
|
378
377
|
const oldName = requiredValueName(before.value);
|
|
379
378
|
const newName = requiredValueName(after.value);
|
|
380
379
|
const oldQualified = qualifiedName(operation, oldName, dialect);
|
|
@@ -842,7 +841,7 @@ function requiredValueName(value) {
|
|
|
842
841
|
}
|
|
843
842
|
function operationName(operation, value) {
|
|
844
843
|
if (operation.kind === "namespace" && isRecord(value)) return stringValue(value.name);
|
|
845
|
-
if (!isRecord(value)) return
|
|
844
|
+
if (!isRecord(value)) return;
|
|
846
845
|
return operation.physicalName ?? stringValue(value.physicalName) ?? stringValue(value.id);
|
|
847
846
|
}
|
|
848
847
|
function requiresPhysicalName(kind) {
|
|
@@ -931,7 +930,7 @@ function stringArray(value) {
|
|
|
931
930
|
return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
932
931
|
}
|
|
933
932
|
function expressionValue(value) {
|
|
934
|
-
if (!isRecord(value) || value.kind !== "expression" || typeof value.sql !== "string" || typeof value.expressionKind !== "string") return
|
|
933
|
+
if (!isRecord(value) || value.kind !== "expression" || typeof value.sql !== "string" || typeof value.expressionKind !== "string") return;
|
|
935
934
|
return value;
|
|
936
935
|
}
|
|
937
936
|
function expressionsIn(value) {
|
|
@@ -1001,11 +1000,11 @@ function dollarQuote(sql) {
|
|
|
1001
1000
|
}
|
|
1002
1001
|
function parseVersion(value) {
|
|
1003
1002
|
if (typeof value === "number") {
|
|
1004
|
-
if (!Number.isFinite(value) || value < 0) return
|
|
1003
|
+
if (!Number.isFinite(value) || value < 0) return;
|
|
1005
1004
|
value = String(value);
|
|
1006
1005
|
}
|
|
1007
1006
|
const match = value.trim().match(/^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?/iu);
|
|
1008
|
-
if (match === null) return
|
|
1007
|
+
if (match === null) return;
|
|
1009
1008
|
return match.slice(1).filter((item) => item !== void 0).map((item) => Number(item));
|
|
1010
1009
|
}
|
|
1011
1010
|
function compareVersion(left, right) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region src/schema/dialect.ts
|
|
2
2
|
/**
|
|
3
|
-
* Add schema behavior to an existing query dialect without rebuilding any of
|
|
4
|
-
*
|
|
3
|
+
* Add schema behavior to an existing query dialect without rebuilding any of its identifier,
|
|
4
|
+
* literal, placeholder, JSON, cast, or capability policies.
|
|
5
5
|
*/
|
|
6
6
|
function createSchemaDialect(queryDialect, schema) {
|
|
7
7
|
return Object.freeze({
|
package/dist/diff.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as SnapshotDiffPropertyChange, D as SnapshotRenameTarget, E as SnapshotRenameSuggestion, S as SnapshotDiffPath, T as SnapshotRenameHintResult, _ as SnapshotDiffObjectKind, a as diffSnapshots, b as SnapshotDiffOperationType, c as validateRenameHints, d as SnapshotDiffDecodeResult, f as SnapshotDiffDiagnostic, g as SnapshotDiffObject, h as SnapshotDiffInput, i as decodeSnapshotRenameHints, l as validateSnapshotRenameHints, m as SnapshotDiffEvidence, n as decodeRenameHints, o as encodeRenameHints, p as SnapshotDiffDiagnosticCode, r as decodeSnapshotForDiff, s as encodeSnapshotRenameHints, t as compareSnapshots, u as SnapshotDiff, v as SnapshotDiffObjectReference, w as SnapshotRenameHint, x as SnapshotDiffOptions, y as SnapshotDiffOperation } from "./index-
|
|
1
|
+
import { C as SnapshotDiffPropertyChange, D as SnapshotRenameTarget, E as SnapshotRenameSuggestion, S as SnapshotDiffPath, T as SnapshotRenameHintResult, _ as SnapshotDiffObjectKind, a as diffSnapshots, b as SnapshotDiffOperationType, c as validateRenameHints, d as SnapshotDiffDecodeResult, f as SnapshotDiffDiagnostic, g as SnapshotDiffObject, h as SnapshotDiffInput, i as decodeSnapshotRenameHints, l as validateSnapshotRenameHints, m as SnapshotDiffEvidence, n as decodeRenameHints, o as encodeRenameHints, p as SnapshotDiffDiagnosticCode, r as decodeSnapshotForDiff, s as encodeSnapshotRenameHints, t as compareSnapshots, u as SnapshotDiff, v as SnapshotDiffObjectReference, w as SnapshotRenameHint, x as SnapshotDiffOptions, y as SnapshotDiffOperation } from "./index-CPvfEheG.mjs";
|
|
2
2
|
export { SnapshotDiff, SnapshotDiffDecodeResult, SnapshotDiffDiagnostic, SnapshotDiffDiagnosticCode, SnapshotDiffEvidence, SnapshotDiffInput, SnapshotDiffObject, SnapshotDiffObjectKind, SnapshotDiffObjectReference, SnapshotDiffOperation, SnapshotDiffOperationType, SnapshotDiffOptions, SnapshotDiffPath, SnapshotDiffPropertyChange, SnapshotRenameHint, SnapshotRenameHintResult, SnapshotRenameSuggestion, SnapshotRenameTarget, compareSnapshots, decodeRenameHints, decodeSnapshotForDiff, decodeSnapshotRenameHints, diffSnapshots, encodeRenameHints, encodeSnapshotRenameHints, validateRenameHints, validateSnapshotRenameHints };
|
package/dist/diff.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as toSnapshotJsonValue, i as schemaSnapshotDigest, l as decodeSchemaSnapshot, n as canonicalJson } from "./canonical-
|
|
2
|
-
import { c as decodeCompleteSchemaSnapshot, s as completeSchemaSnapshotDigest } from "./complete-
|
|
1
|
+
import { a as toSnapshotJsonValue, i as schemaSnapshotDigest, l as decodeSchemaSnapshot, n as canonicalJson } from "./canonical-BXUguqfo.mjs";
|
|
2
|
+
import { c as decodeCompleteSchemaSnapshot, s as completeSchemaSnapshotDigest } from "./complete-WYyVozgK.mjs";
|
|
3
3
|
//#region src/diff/diff.ts
|
|
4
4
|
const objectKinds = /* @__PURE__ */ new Set([
|
|
5
5
|
"namespace",
|
|
@@ -32,9 +32,8 @@ const operationOrder = /* @__PURE__ */ new Map([
|
|
|
32
32
|
/**
|
|
33
33
|
* Compare Snapshot v1 or v2 values and return immutable, reviewable data.
|
|
34
34
|
*
|
|
35
|
-
* The function never opens a connection, renders SQL, or turns a heuristic
|
|
36
|
-
*
|
|
37
|
-
* diagnostics in the returned value.
|
|
35
|
+
* The function never opens a connection, renders SQL, or turns a heuristic match into a rename.
|
|
36
|
+
* Invalid input and malformed hints are represented by diagnostics in the returned value.
|
|
38
37
|
*/
|
|
39
38
|
function diffSnapshots(beforeInput, afterInput, options = {}) {
|
|
40
39
|
const diagnostics = [];
|
|
@@ -568,7 +567,7 @@ function operationForMatch(match, diagnostics) {
|
|
|
568
567
|
source: match.source,
|
|
569
568
|
destructive: false
|
|
570
569
|
});
|
|
571
|
-
if (effectiveChanges.length === 0) return
|
|
570
|
+
if (effectiveChanges.length === 0) return;
|
|
572
571
|
const destructive = effectiveChanges.some(isDestructiveProperty);
|
|
573
572
|
if (destructive) diagnostics.push(diffDiagnostic("destructive", `Property changes on ${before.kind} "${before.id}" may remove or narrow existing data`, before.path, {
|
|
574
573
|
kind: before.kind,
|
|
@@ -819,7 +818,7 @@ function normalizeRenameTarget(value, path, diagnostics) {
|
|
|
819
818
|
diagnostics.push(diffDiagnostic("invalid-rename-hint", "Rename target needs an id, physicalName, or path", path));
|
|
820
819
|
return;
|
|
821
820
|
}
|
|
822
|
-
if (id !== void 0 && (typeof id !== "string" || id.length === 0) || physicalName !== void 0 && (typeof physicalName !== "string" || physicalName.length === 0) || targetPath !== void 0 && !isPath(targetPath)) return
|
|
821
|
+
if (id !== void 0 && (typeof id !== "string" || id.length === 0) || physicalName !== void 0 && (typeof physicalName !== "string" || physicalName.length === 0) || targetPath !== void 0 && !isPath(targetPath)) return;
|
|
823
822
|
return freeze({
|
|
824
823
|
...typeof id === "string" ? { id } : {},
|
|
825
824
|
...typeof physicalName === "string" ? { physicalName } : {},
|