qubu 0.0.0 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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-CO1KaRNc.d.mts +46 -0
  61. package/dist/types-Cec0xzo4.mjs +116 -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 +129 -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,169 @@
1
+ //#region src/core/dialect.ts
2
+ const standardCastTypes = {
3
+ integer: "INTEGER",
4
+ decimal: "DECIMAL",
5
+ text: "TEXT",
6
+ boolean: "BOOLEAN",
7
+ date: "DATE",
8
+ timestamp: "TIMESTAMP",
9
+ uuid: "UUID",
10
+ json: "JSON",
11
+ bigint: "BIGINT",
12
+ binary: "VARBINARY"
13
+ };
14
+ /** Resolve a logical or explicitly named CAST target for a dialect. */
15
+ function resolveCastTarget(dialect, target) {
16
+ if (target.kind === "named-cast") return target.typeName;
17
+ return dialect.castTypes?.[target.type] ?? standardCastTypes[target.type];
18
+ }
19
+ const quoteIdentifier = (identifier) => `"${identifier.replaceAll("\"", "\"\"")}"`;
20
+ function createDialect(options) {
21
+ return Object.freeze({
22
+ name: options.name,
23
+ quoteIdentifier: options.quoteIdentifier ?? quoteIdentifier,
24
+ placeholder: options.placeholder,
25
+ pagination: options.pagination,
26
+ rowLocking: options.rowLocking,
27
+ json: options.json,
28
+ castTypes: options.castTypes ? Object.freeze({ ...options.castTypes }) : void 0,
29
+ renderSchemaLiteral: options.renderSchemaLiteral,
30
+ explain: options.explain,
31
+ capabilities: Object.freeze([...options.capabilities ?? [], ...options.json ? ["json"] : []])
32
+ });
33
+ }
34
+ /**
35
+ * Check a capability at runtime for callers that intentionally bypass the
36
+ * typed render boundary or use a dialect supplied by an older integration.
37
+ */
38
+ function assertDialectCapability(dialect, capability) {
39
+ if (dialect.capabilities?.includes(capability)) return;
40
+ throw new Error(`Dialect "${dialect.name}" does not support the "${capability}" capability`);
41
+ }
42
+ //#endregion
43
+ //#region src/dialects/json.ts
44
+ function jsonPath(path) {
45
+ return path.reduce((result, segment) => typeof segment === "number" ? `${result}[${segment}]` : `${result}.${JSON.stringify(segment)}`, "$");
46
+ }
47
+ function appendPath(context, path, requiredType) {
48
+ context.append("'");
49
+ context.append(jsonPath(path).replaceAll("'", "''"));
50
+ if (requiredType) {
51
+ const type = requiredType === "text" ? "string" : requiredType;
52
+ context.append(` ? (@.type() == "${type}")`);
53
+ }
54
+ context.append("'");
55
+ }
56
+ function renderSqlJsonValue(context, document, path, returning, requiredType) {
57
+ context.append("JSON_VALUE(");
58
+ context.render(document);
59
+ context.append(", ");
60
+ appendPath(context, path, requiredType);
61
+ context.append(` RETURNING ${returning} NULL ON EMPTY NULL ON ERROR)`);
62
+ }
63
+ const standardJson = {
64
+ renderScalar(context, document, path, kind) {
65
+ renderSqlJsonValue(context, document, path, kind === "text" ? "VARCHAR(512)" : kind === "number" ? "DOUBLE PRECISION" : "BOOLEAN", kind);
66
+ },
67
+ renderExists(context, document, path) {
68
+ context.append("COALESCE(JSON_EXISTS(");
69
+ context.render(document);
70
+ context.append(", ");
71
+ appendPath(context, path);
72
+ context.append(" FALSE ON ERROR), FALSE)");
73
+ }
74
+ };
75
+ function renderPostgresTarget(context, document, path) {
76
+ context.append("jsonb_path_query_first(CAST(");
77
+ context.render(document);
78
+ context.append(" AS JSONB), ");
79
+ appendPath(context, path);
80
+ context.append(")");
81
+ }
82
+ function postgresType(kind) {
83
+ return kind === "text" ? "string" : kind;
84
+ }
85
+ const postgresJson = {
86
+ renderScalar(context, document, path, kind) {
87
+ context.append("(CASE jsonb_typeof(");
88
+ renderPostgresTarget(context, document, path);
89
+ context.append(`) WHEN '${postgresType(kind)}' THEN `);
90
+ if (kind !== "text") context.append("CAST(");
91
+ context.append("(");
92
+ renderPostgresTarget(context, document, path);
93
+ context.append(" #>> '{}')");
94
+ if (kind !== "text") context.append(kind === "number" ? " AS DOUBLE PRECISION)" : " AS BOOLEAN)");
95
+ context.append(" END)");
96
+ },
97
+ renderExists(context, document, path) {
98
+ context.append("COALESCE(jsonb_path_exists(CAST(");
99
+ context.render(document);
100
+ context.append(" AS JSONB), ");
101
+ appendPath(context, path);
102
+ context.append(", '{}'::JSONB, TRUE), FALSE)");
103
+ }
104
+ };
105
+ function renderMySqlExtract(context, document, path) {
106
+ context.append("JSON_EXTRACT(");
107
+ context.render(document);
108
+ context.append(", ");
109
+ appendPath(context, path);
110
+ context.append(")");
111
+ }
112
+ function mysqlType(kind) {
113
+ return kind === "text" ? "STRING" : kind === "number" ? "INTEGER" : "BOOLEAN";
114
+ }
115
+ const mysqlJson = {
116
+ renderScalar(context, document, path, kind) {
117
+ context.append("(CASE JSON_TYPE(");
118
+ renderMySqlExtract(context, document, path);
119
+ context.append(`) WHEN '${mysqlType(kind)}' THEN `);
120
+ if (kind === "boolean") context.append("(");
121
+ renderSqlJsonValue(context, document, path, kind === "text" ? "CHAR" : kind === "number" ? "DOUBLE" : "CHAR");
122
+ if (kind === "boolean") context.append(" = 'true')");
123
+ context.append(" END)");
124
+ },
125
+ renderExists(context, document, path) {
126
+ context.append("COALESCE(JSON_CONTAINS_PATH(");
127
+ context.render(document);
128
+ context.append(", 'one', ");
129
+ appendPath(context, path);
130
+ context.append("), FALSE)");
131
+ }
132
+ };
133
+ function renderSqliteExtract(context, document, path) {
134
+ context.append("json_extract(");
135
+ context.render(document);
136
+ context.append(", ");
137
+ appendPath(context, path);
138
+ context.append(")");
139
+ }
140
+ function renderSqliteType(context, document, path) {
141
+ context.append("json_type(");
142
+ context.render(document);
143
+ context.append(", ");
144
+ appendPath(context, path);
145
+ context.append(")");
146
+ }
147
+ const sqliteJson = {
148
+ renderScalar(context, document, path, kind) {
149
+ context.append("(CASE ");
150
+ renderSqliteType(context, document, path);
151
+ if (kind === "text") {
152
+ context.append(" WHEN 'text' THEN ");
153
+ renderSqliteExtract(context, document, path);
154
+ } else if (kind === "number") {
155
+ context.append(" WHEN 'integer' THEN ");
156
+ renderSqliteExtract(context, document, path);
157
+ context.append(" WHEN 'real' THEN ");
158
+ renderSqliteExtract(context, document, path);
159
+ } else context.append(" WHEN 'true' THEN TRUE WHEN 'false' THEN FALSE");
160
+ context.append(" END)");
161
+ },
162
+ renderExists(context, document, path) {
163
+ context.append("(");
164
+ renderSqliteType(context, document, path);
165
+ context.append(" IS NOT NULL)");
166
+ }
167
+ };
168
+ //#endregion
169
+ export { assertDialectCapability as a, standardJson as i, postgresJson as n, createDialect as o, sqliteJson as r, resolveCastTarget as s, mysqlJson as t };
@@ -0,0 +1,215 @@
1
+ import { T as SnapshotJsonValue, m as SnapshotDialect } from "./types-4Q076HKo.mjs";
2
+ import { S as SnapshotDiffPath, _ as SnapshotDiffObjectKind, b as SnapshotDiffOperationType, f as SnapshotDiffDiagnostic, g as SnapshotDiffObject, m as SnapshotDiffEvidence, u as SnapshotDiff } from "./index-Dug5HnLB.mjs";
3
+ //#region src/migration/types.d.ts
4
+ /** The versioned envelope tag for dialect-neutral migration plans. */
5
+ declare const migrationPlanFormat: "qubu-migration-plan";
6
+ /** The first strict migration-plan format version. */
7
+ declare const migrationPlanVersion: 1;
8
+ /** Safety classifications carried by every planned operation. */
9
+ type MigrationSafety = 'safe' | 'review-required' | 'destructive' | 'unsupported' | 'unknown';
10
+ /** Lock strength required by a planned operation. */
11
+ type MigrationLockRequirement = 'none' | 'shared' | 'exclusive' | 'unknown';
12
+ /** Transaction behavior required by a planned operation. */
13
+ type MigrationTransactionRequirement = 'required' | 'optional' | 'forbidden' | 'unknown';
14
+ /** Operations that can appear in a migration plan. */
15
+ type MigrationOperationType = 'add' | 'remove' | 'property-change' | 'physical-rename' | 'custom-sql';
16
+ /** A condition a later executor must check before applying an operation. */
17
+ type MigrationPreconditionType = 'snapshot-digest' | 'object-present' | 'object-absent' | 'property-equals';
18
+ /** An immutable, serializable migration precondition. */
19
+ interface MigrationPrecondition {
20
+ readonly type: MigrationPreconditionType;
21
+ readonly path: SnapshotDiffPath;
22
+ readonly kind: SnapshotDiffObjectKind | 'custom-sql';
23
+ readonly namespace?: string;
24
+ readonly logicalId?: string;
25
+ readonly physicalName?: string;
26
+ readonly digest?: string;
27
+ readonly property?: SnapshotDiffPath;
28
+ readonly value?: SnapshotJsonValue;
29
+ }
30
+ /** The explicit custom SQL escape hatch for one planned operation. */
31
+ interface MigrationCustomSql {
32
+ readonly sql: string;
33
+ readonly dialect: SnapshotDialect;
34
+ readonly safety: MigrationSafety;
35
+ readonly position: number;
36
+ readonly reason: string;
37
+ readonly reversible: boolean;
38
+ }
39
+ /** Input accepted when attaching explicit custom SQL to a plan. */
40
+ interface MigrationCustomSqlInput {
41
+ readonly sql: string;
42
+ readonly dialect: SnapshotDialect;
43
+ readonly safety: MigrationSafety;
44
+ readonly reason: string;
45
+ readonly reversible?: boolean;
46
+ /** Target an operation by deterministic ID when it already exists. */
47
+ readonly operationId?: string;
48
+ /** Or target a diff object by kind, namespace, and path. */
49
+ readonly kind?: SnapshotDiffObjectKind;
50
+ readonly namespace?: string;
51
+ readonly path?: SnapshotDiffPath;
52
+ /** Explicit dependency position. It does not render or execute SQL. */
53
+ readonly position?: number;
54
+ readonly dependsOn?: readonly string[];
55
+ }
56
+ /** A user's explicit decision for an unsafe or incomplete fact. */
57
+ interface MigrationDecision {
58
+ readonly action: 'allow' | 'skip';
59
+ readonly reason: string;
60
+ readonly operationId?: string;
61
+ readonly kind?: SnapshotDiffObjectKind;
62
+ readonly namespace?: string;
63
+ readonly path?: SnapshotDiffPath;
64
+ readonly code?: MigrationDiagnosticCode;
65
+ }
66
+ /** Why a plan was blocked or needs review. */
67
+ type MigrationDiagnosticCode = 'decision-required' | 'dependency-cycle' | 'invalid-plan' | 'unknown' | 'lossy' | 'unsupported' | 'destructive' | 'ambiguous' | 'custom-sql' | 'dialect-mismatch' | 'non-canonical';
68
+ /** A structured plan diagnostic that keeps source diff context. */
69
+ interface MigrationDiagnostic {
70
+ readonly code: MigrationDiagnosticCode;
71
+ readonly severity: 'error' | 'warning';
72
+ readonly message: string;
73
+ readonly path: SnapshotDiffPath;
74
+ readonly operationId?: string;
75
+ readonly kind?: SnapshotDiffObjectKind | 'custom-sql';
76
+ readonly namespace?: string;
77
+ readonly logicalId?: string;
78
+ readonly physicalName?: string;
79
+ readonly dialect?: SnapshotDialect;
80
+ readonly evidence?: readonly SnapshotDiffEvidence[];
81
+ readonly source?: SnapshotDiffDiagnostic;
82
+ }
83
+ /** The source facts preserved on each non-custom migration operation. */
84
+ interface MigrationOperationOrigin {
85
+ readonly type: SnapshotDiffOperationType;
86
+ readonly kind: SnapshotDiffObjectKind;
87
+ readonly namespace?: string;
88
+ readonly path: SnapshotDiffPath;
89
+ readonly logicalId?: string;
90
+ readonly physicalName?: string;
91
+ readonly physicalReference?: SnapshotJsonValue;
92
+ readonly provenance?: SnapshotJsonValue;
93
+ readonly before?: SnapshotDiffObject;
94
+ readonly after?: SnapshotDiffObject;
95
+ readonly evidence: readonly SnapshotDiffEvidence[];
96
+ }
97
+ /** One immutable operation in a migration plan. */
98
+ interface MigrationOperation {
99
+ readonly id: string;
100
+ readonly type: MigrationOperationType;
101
+ readonly kind: SnapshotDiffObjectKind | 'custom-sql';
102
+ readonly objectKind: SnapshotDiffObjectKind | 'custom-sql';
103
+ readonly namespace?: string;
104
+ readonly path: SnapshotDiffPath;
105
+ readonly logicalId?: string;
106
+ readonly physicalName?: string;
107
+ readonly physicalReference?: SnapshotJsonValue;
108
+ readonly provenance?: SnapshotJsonValue;
109
+ readonly dialect: SnapshotDialect;
110
+ readonly safety: MigrationSafety;
111
+ readonly lock: MigrationLockRequirement;
112
+ readonly transaction: MigrationTransactionRequirement;
113
+ readonly reversible: boolean;
114
+ readonly reversibility: 'reversible' | 'irreversible';
115
+ readonly irreversibleReason?: string;
116
+ readonly preconditions: readonly MigrationPrecondition[];
117
+ readonly dependsOn: readonly string[];
118
+ readonly evidence: readonly SnapshotDiffEvidence[];
119
+ readonly origin?: MigrationOperationOrigin;
120
+ readonly customSql?: MigrationCustomSql;
121
+ readonly decision?: MigrationDecision;
122
+ readonly status: 'approved' | 'decision-required' | 'skipped';
123
+ readonly position: number;
124
+ }
125
+ /** A dependency edge. `from` must appear before `to`. */
126
+ interface MigrationDependency {
127
+ readonly from: string;
128
+ readonly to: string;
129
+ readonly reason: 'parent-before-child' | 'child-before-parent' | 'reference-before-dependent' | 'explicit-custom-sql';
130
+ }
131
+ /** Immutable migration plan data. It contains no executor or SQL renderer. */
132
+ interface MigrationPlan {
133
+ readonly format: typeof migrationPlanFormat;
134
+ readonly version: typeof migrationPlanVersion;
135
+ readonly dialect: SnapshotDialect;
136
+ readonly beforeDigest?: string;
137
+ readonly afterDigest?: string;
138
+ readonly safety: MigrationSafety;
139
+ readonly ready: boolean;
140
+ readonly operations: readonly MigrationOperation[];
141
+ readonly dependencies: readonly MigrationDependency[];
142
+ readonly decisions: readonly MigrationDecision[];
143
+ readonly diagnostics: readonly MigrationDiagnostic[];
144
+ }
145
+ /** Options for converting a resolved diff into a migration plan. */
146
+ interface MigrationPlanOptions {
147
+ readonly decisions?: readonly MigrationDecision[];
148
+ readonly customSql?: readonly MigrationCustomSqlInput[];
149
+ readonly allowUnknown?: boolean;
150
+ readonly allowLossy?: boolean;
151
+ readonly allowUnsupported?: boolean;
152
+ readonly allowDestructive?: boolean;
153
+ readonly allowReviewRequired?: boolean;
154
+ }
155
+ /** A plan result retains a blocked plan so callers can inspect and review it. */
156
+ type MigrationPlanResult = {
157
+ readonly ok: true;
158
+ readonly plan: MigrationPlan;
159
+ readonly diagnostics: readonly MigrationDiagnostic[];
160
+ } | {
161
+ readonly ok: false;
162
+ readonly plan: MigrationPlan;
163
+ readonly diagnostics: readonly MigrationDiagnostic[];
164
+ };
165
+ /** Result returned by strict plan decoding. */
166
+ type MigrationPlanDecodeResult = {
167
+ readonly ok: true;
168
+ readonly value: MigrationPlan;
169
+ } | {
170
+ readonly ok: false;
171
+ readonly diagnostics: readonly MigrationDiagnostic[];
172
+ };
173
+ /** Result returned by non-throwing plan validation. */
174
+ type MigrationPlanValidationResult = MigrationPlanDecodeResult;
175
+ /** A validation error raised by throwing plan APIs. */
176
+ declare class MigrationPlanValidationError extends TypeError {
177
+ readonly name = "MigrationPlanValidationError";
178
+ readonly diagnostics: readonly MigrationDiagnostic[];
179
+ readonly issues: readonly MigrationDiagnostic[];
180
+ constructor(diagnostics: readonly MigrationDiagnostic[]);
181
+ }
182
+ //#endregion
183
+ //#region src/migration/plan.d.ts
184
+ /**
185
+ * Convert a resolved SnapshotDiff into an immutable migration plan.
186
+ *
187
+ * This function only describes operations. It does not render SQL, open a
188
+ * connection, execute a transaction, or infer SQL from opaque snapshot data.
189
+ * A plan that still needs a safety decision is returned with `ok: false` so it
190
+ * can be reviewed without being mistaken for an executable plan.
191
+ */
192
+ declare function createMigrationPlan(diff: SnapshotDiff, options?: MigrationPlanOptions): MigrationPlanResult;
193
+ /** Alias for callers that treat plan creation as the main migration action. */
194
+ declare const planMigration: typeof createMigrationPlan;
195
+ declare const createPlan: typeof createMigrationPlan;
196
+ /** Build a plan or throw one structured validation error when it is blocked. */
197
+ declare function assertMigrationPlanFromDiff(diff: SnapshotDiff, options?: MigrationPlanOptions): MigrationPlan;
198
+ /** Return a fixed-order immutable plan after strict validation. */
199
+ declare function canonicalizeMigrationPlan(input: MigrationPlan): MigrationPlan;
200
+ /** Encode a validated plan as deterministic JSON. */
201
+ declare function encodeMigrationPlan(input: MigrationPlan): string;
202
+ /** Decode and strictly validate a migration-plan JSON value. */
203
+ declare function decodeMigrationPlan(input: string | unknown): MigrationPlanDecodeResult;
204
+ /** Validate a plan without throwing. */
205
+ declare function validateMigrationPlan(input: unknown): MigrationPlanValidationResult;
206
+ /** Validate a plan and throw one structured error on failure. */
207
+ declare function assertMigrationPlan(input: unknown): MigrationPlan;
208
+ /** Compute a deterministic digest for cache keys and fixture assertions. */
209
+ declare function migrationPlanDigest(input: MigrationPlan | string): string;
210
+ declare const encodePlan: typeof encodeMigrationPlan;
211
+ declare const decodePlan: typeof decodeMigrationPlan;
212
+ declare const assertPlan: typeof assertMigrationPlan;
213
+ declare const digestMigrationPlan: typeof migrationPlanDigest;
214
+ //#endregion
215
+ export { MigrationCustomSql, MigrationCustomSqlInput, MigrationDecision, MigrationDependency, MigrationDiagnostic, MigrationDiagnosticCode, MigrationLockRequirement, MigrationOperation, MigrationOperationOrigin, MigrationOperationType, MigrationPlan, MigrationPlanDecodeResult, MigrationPlanOptions, MigrationPlanResult, MigrationPlanValidationError, MigrationPlanValidationResult, MigrationPrecondition, MigrationPreconditionType, MigrationSafety, MigrationTransactionRequirement, type SnapshotDiff, assertMigrationPlan, assertMigrationPlanFromDiff, assertPlan, canonicalizeMigrationPlan, createMigrationPlan, createPlan, decodeMigrationPlan, decodePlan, digestMigrationPlan, encodeMigrationPlan, encodePlan, migrationPlanDigest, migrationPlanFormat, migrationPlanVersion, planMigration, validateMigrationPlan };