@atscript/db 0.1.161 → 0.1.163
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/agg.cjs +1 -1
- package/dist/agg.d.cts +1 -1
- package/dist/agg.d.mts +1 -1
- package/dist/agg.mjs +1 -1
- package/dist/{aggregate-fns-B_sgl4mB.mjs → aggregate-fns-DsS9UQVB.mjs} +1 -1
- package/dist/{aggregate-fns-DFtKAv7Q.cjs → aggregate-fns-DupYzFD7.cjs} +1 -1
- package/dist/{buckets-B4T_alUe.d.cts → buckets-B8UOod-v.d.cts} +488 -57
- package/dist/{buckets-8mG67Mtw.d.mts → buckets-CHyspjYP.d.mts} +488 -57
- package/dist/{column-diff-DpeUbhEI.cjs → column-diff-BIGX3sRH.cjs} +853 -232
- package/dist/{column-diff-DR1glykD.mjs → column-diff-BfNIlMwX.mjs} +836 -233
- package/dist/{validator-B3xlbrWf.d.cts → db-error-B_DRL1E9.d.cts} +18 -89
- package/dist/{validator-B3xlbrWf.d.mts → db-error-B_DRL1E9.d.mts} +18 -89
- package/dist/{db-error-JcfJqqpk.cjs → db-error-DmF1_xrz.cjs} +13 -0
- package/dist/{db-error-eSsQX7rt.mjs → db-error-hraC12B9.mjs} +8 -1
- package/dist/{db-validator-plugin-BWy60OvG.d.cts → db-validator-plugin-wRqMYNBI.d.cts} +6 -0
- package/dist/{db-validator-plugin-BWy60OvG.d.mts → db-validator-plugin-wRqMYNBI.d.mts} +6 -0
- package/dist/{fk-diff-5gX42hBt.d.mts → fk-diff-BNGawZi9.d.cts} +34 -10
- package/dist/{fk-diff-BWdQ7kRZ.d.cts → fk-diff-rj9N2QLw.d.mts} +34 -10
- package/dist/index.cjs +15 -11
- package/dist/index.d.cts +24 -21
- package/dist/index.d.mts +24 -21
- package/dist/index.mjs +10 -12
- package/dist/{nested-writer-BOj_c_lI.mjs → nested-writer-ClUX0DB0.mjs} +16 -22
- package/dist/{nested-writer-Bl1SZS7x.cjs → nested-writer-yCy6wGuN.cjs} +16 -22
- package/dist/{object-CtPYTIvy.d.cts → object-Czia_qD4.d.cts} +7 -1
- package/dist/{object-CtPYTIvy.d.mts → object-Czia_qD4.d.mts} +7 -1
- package/dist/{object-Djg28csK.cjs → object-GjsuPNqo.cjs} +19 -0
- package/dist/{object-TkiJQ-Dp.mjs → object-PQ1J8jri.mjs} +14 -1
- package/dist/ops.cjs +6 -21
- package/dist/ops.mjs +6 -21
- package/dist/plugin.cjs +263 -323
- package/dist/plugin.mjs +163 -223
- package/dist/rel.cjs +2 -2
- package/dist/rel.d.cts +3 -3
- package/dist/rel.d.mts +3 -3
- package/dist/rel.mjs +2 -2
- package/dist/{relation-helpers-17_2f5hX.d.mts → relation-helpers-DloMywNs.d.cts} +1 -1
- package/dist/{relation-helpers-BLBrLQYi.d.cts → relation-helpers-zwt19E7r.d.mts} +1 -1
- package/dist/{relation-loader-DeulLrAw.cjs → relation-loader-DujL_Mh9.cjs} +1 -1
- package/dist/{relation-loader-CNBMPfRr.mjs → relation-loader-Qv3LrQ42.mjs} +1 -1
- package/dist/{search-fields-CT_UZ9fg.cjs → search-fields-B49-RCWd.cjs} +65 -1
- package/dist/{search-fields-CE8cmj9X.mjs → search-fields-BPNsxrCk.mjs} +48 -2
- package/dist/search-fields-CHqqcC3W.d.cts +30 -0
- package/dist/search-fields-CHqqcC3W.d.mts +30 -0
- package/dist/server-stamped-B6XbUQ4p.cjs +33 -0
- package/dist/server-stamped-BoP56K9M.mjs +22 -0
- package/dist/shared.cjs +42 -26
- package/dist/shared.d.cts +98 -4
- package/dist/shared.d.mts +98 -4
- package/dist/shared.mjs +4 -2
- package/dist/sync.cjs +228 -65
- package/dist/sync.d.cts +41 -5
- package/dist/sync.d.mts +41 -5
- package/dist/sync.mjs +228 -66
- package/dist/{validator-B4YDLUkj.cjs → validator-DK9Ijpo7.cjs} +3 -2
- package/dist/validator-DX97RzC2.d.cts +108 -0
- package/dist/validator-DX97RzC2.d.mts +108 -0
- package/dist/{validator-B3fPJjS1.mjs → validator-DuDWsIdQ.mjs} +3 -2
- package/dist/validator.cjs +6 -3
- package/dist/validator.d.cts +5 -4
- package/dist/validator.d.mts +5 -4
- package/dist/validator.mjs +5 -4
- package/dist/{validation-utils-BGjqc2jU.mjs → view-validation-BcgDq7M9.mjs} +364 -20
- package/dist/{validation-utils-CtLNlBtB.cjs → view-validation-BiDLCYMw.cjs} +452 -18
- package/package.json +6 -6
package/dist/sync.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Ct as TEnsureTableOptions, Et as TExistingTableOption, G as TDbFieldMeta, Pt as TIndexChange, Tt as TExistingForeignKey, Vt as TReferencingForeignKey, at as TDbObjectKind, cr as TGenericLogger, gn as DbSpace, qt as TTableOptionDiff, xt as TDerivedChangeReason, zt as TPrimaryKeyChange } from "./buckets-B8UOod-v.cjs";
|
|
2
|
+
import { S as snapshotToExistingTableOptions, _ as computeSchemaHash, a as hasForeignKeyChanges, b as computeViewSnapshot, d as TForeignKeySnapshot, f as TTableSnapshot, g as canonicalizeQueryNode, h as TViewSnapshot, i as fkKey, l as sameDefaultValue, m as TViewJoinSnapshot, n as computeForeignKeyDiff, o as TColumnDiffOptions, p as TViewColumnSnapshot, s as computeColumnDiff, t as TForeignKeyDiff, u as TFieldSnapshot, v as computeTableHash, x as snapshotToExistingColumns, y as computeTableSnapshot } from "./fk-diff-BNGawZi9.cjs";
|
|
3
3
|
import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
|
|
4
4
|
|
|
5
5
|
//#region src/schema/sync-entry.d.ts
|
|
@@ -150,6 +150,23 @@ interface TSyncEntryInit {
|
|
|
150
150
|
* @since 0.1.141
|
|
151
151
|
*/
|
|
152
152
|
cascadeFrom?: string[];
|
|
153
|
+
/**
|
|
154
|
+
* `true` on a managed view whose own definition changed since the last
|
|
155
|
+
* sync — the reason it is dropped and recreated. Printed as
|
|
156
|
+
* `· definition changed`.
|
|
157
|
+
* @since 0.1.162
|
|
158
|
+
*/
|
|
159
|
+
definitionChanged?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Managed indexes created, dropped or rebuilt (definition drift). On a
|
|
162
|
+
* plan entry: what the run's index sync would do to the live table as it
|
|
163
|
+
* is now (before the entry's column changes; not planned for a table the
|
|
164
|
+
* run creates, recreates or renames). On a run entry: what it did — not
|
|
165
|
+
* reported for a created or recreated table. Either marks the entry
|
|
166
|
+
* `alter`.
|
|
167
|
+
* @since 0.1.162
|
|
168
|
+
*/
|
|
169
|
+
indexChanges?: TIndexChange[];
|
|
153
170
|
}
|
|
154
171
|
declare class SyncEntry {
|
|
155
172
|
readonly name: string;
|
|
@@ -223,6 +240,10 @@ declare class SyncEntry {
|
|
|
223
240
|
readonly refused: boolean;
|
|
224
241
|
/** @since 0.1.141 — see {@link TSyncEntryInit.cascadeFrom}. */
|
|
225
242
|
readonly cascadeFrom: string[];
|
|
243
|
+
/** @since 0.1.162 — see {@link TSyncEntryInit.definitionChanged}. */
|
|
244
|
+
readonly definitionChanged: boolean;
|
|
245
|
+
/** @since 0.1.162 — see {@link TSyncEntryInit.indexChanges}. */
|
|
246
|
+
readonly indexChanges: TIndexChange[];
|
|
226
247
|
constructor(init: TSyncEntryInit);
|
|
227
248
|
/**
|
|
228
249
|
* The init object this entry was built from — lets callers derive a
|
|
@@ -259,8 +280,9 @@ declare class SyncEntry {
|
|
|
259
280
|
/** `! PK (id) → (code) — rebuild (table is empty)` / `— rebuild (rows satisfy the new key)` / `— skipped (safe mode)` */
|
|
260
281
|
private printPkChange;
|
|
261
282
|
/**
|
|
262
|
-
* `! col: t1 → t2 — drop` (plan),
|
|
263
|
-
* mode)` in plan and result when
|
|
283
|
+
* `! col: t1 → t2 — drop` (plan), `~ col: t1 → t2 — type changed` (result),
|
|
284
|
+
* or `! type col (t1 → t2) — skipped (safe mode)` in plan and result when
|
|
285
|
+
* the `'drop'` recreate was skipped.
|
|
264
286
|
*/
|
|
265
287
|
private printTypeChanges;
|
|
266
288
|
/**
|
|
@@ -278,6 +300,12 @@ declare class SyncEntry {
|
|
|
278
300
|
* change. Both: `! option k: a → b — skipped (safe mode)` when pending.
|
|
279
301
|
*/
|
|
280
302
|
private printOptionChanges;
|
|
303
|
+
/** `+ FK(a) → t — add` / `- … — remove` / `~ … — details` (plan); `added` / `removed` (result). */
|
|
304
|
+
private printForeignKeys;
|
|
305
|
+
/** `+ index name — add` / `- … — drop` / `~ … — rebuild` (plan); `added` / `dropped` / `rebuilt` (result). */
|
|
306
|
+
private printIndexChanges;
|
|
307
|
+
/** `· definition changed` — why a managed view is recreated. */
|
|
308
|
+
private printDefinitionChanged;
|
|
281
309
|
/** `· after: a, b` (plan only — the executor already runs in this order). */
|
|
282
310
|
private printDependsOn;
|
|
283
311
|
/** `· upstream view "x" recreated` — why an unchanged view is recreated. */
|
|
@@ -423,6 +451,14 @@ declare class SchemaSync {
|
|
|
423
451
|
* `safe` — safe mode skips the key rebuild, so its plan rule does not apply.
|
|
424
452
|
*/
|
|
425
453
|
private discoverTable;
|
|
454
|
+
/**
|
|
455
|
+
* Folds the index / foreign-key work on each live table as it is now
|
|
456
|
+
* (`planIndexes` / `planForeignKeys`) into its plan entry. Read only when
|
|
457
|
+
* plan entries are reported (`plan()`, a refused run) — a run reports what
|
|
458
|
+
* `syncIndexes` / `syncForeignKeys` did.
|
|
459
|
+
*/
|
|
460
|
+
private planLiveWork;
|
|
461
|
+
private planTableLiveWork;
|
|
426
462
|
/**
|
|
427
463
|
* Pure validation over the discovery facts. Every refusal is a change that
|
|
428
464
|
* no order of DDL can apply safely; the messages are user-facing.
|
|
@@ -566,4 +602,4 @@ declare function syncSchema(space: DbSpace, types: readonly TAtscriptAnnotatedTy
|
|
|
566
602
|
*/
|
|
567
603
|
declare function planSchema(space: DbSpace, types: readonly TAtscriptAnnotatedType[], opts?: Pick<TSyncOptions, "force" | "safe">): Promise<TSyncPlan>;
|
|
568
604
|
//#endregion
|
|
569
|
-
export { SchemaSync, SyncEntry, type TDbObjectKind, type TDependencyEdge, type TEnsureTableOptions, type TExistingForeignKey, type TFieldSnapshot, type TForeignKeyDiff, type TForeignKeySnapshot, type TPrimaryKeyChange, type TReferencingForeignKey, type TSyncColors, type TSyncDerivedChange, type TSyncEntryInit, type TSyncEntryStatus, type TSyncOptions, type TSyncPlan, type TSyncResult, type TSyncSkippedWork, type TTableSnapshot, type TViewColumnSnapshot, type TViewJoinSnapshot, type TViewSnapshot, canonicalizeQueryNode, computeColumnDiff, computeForeignKeyDiff, computeSchemaHash, computeTableHash, computeTableOptionDiff, computeTableSnapshot, computeViewSnapshot, fkKey, hasForeignKeyChanges, planSchema, readStoredSnapshot, snapshotToExistingColumns, snapshotToExistingTableOptions, syncSchema, topoOrder };
|
|
605
|
+
export { SchemaSync, SyncEntry, type TColumnDiffOptions, type TDbObjectKind, type TDependencyEdge, type TEnsureTableOptions, type TExistingForeignKey, type TFieldSnapshot, type TForeignKeyDiff, type TForeignKeySnapshot, type TPrimaryKeyChange, type TReferencingForeignKey, type TSyncColors, type TSyncDerivedChange, type TSyncEntryInit, type TSyncEntryStatus, type TSyncOptions, type TSyncPlan, type TSyncResult, type TSyncSkippedWork, type TTableSnapshot, type TViewColumnSnapshot, type TViewJoinSnapshot, type TViewSnapshot, canonicalizeQueryNode, computeColumnDiff, computeForeignKeyDiff, computeSchemaHash, computeTableHash, computeTableOptionDiff, computeTableSnapshot, computeViewSnapshot, fkKey, hasForeignKeyChanges, planSchema, readStoredSnapshot, sameDefaultValue, snapshotToExistingColumns, snapshotToExistingTableOptions, syncSchema, topoOrder };
|
package/dist/sync.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Ct as TEnsureTableOptions, Et as TExistingTableOption, G as TDbFieldMeta, Pt as TIndexChange, Tt as TExistingForeignKey, Vt as TReferencingForeignKey, at as TDbObjectKind, cr as TGenericLogger, gn as DbSpace, qt as TTableOptionDiff, xt as TDerivedChangeReason, zt as TPrimaryKeyChange } from "./buckets-CHyspjYP.mjs";
|
|
2
|
+
import { S as snapshotToExistingTableOptions, _ as computeSchemaHash, a as hasForeignKeyChanges, b as computeViewSnapshot, d as TForeignKeySnapshot, f as TTableSnapshot, g as canonicalizeQueryNode, h as TViewSnapshot, i as fkKey, l as sameDefaultValue, m as TViewJoinSnapshot, n as computeForeignKeyDiff, o as TColumnDiffOptions, p as TViewColumnSnapshot, s as computeColumnDiff, t as TForeignKeyDiff, u as TFieldSnapshot, v as computeTableHash, x as snapshotToExistingColumns, y as computeTableSnapshot } from "./fk-diff-rj9N2QLw.mjs";
|
|
3
3
|
import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
|
|
4
4
|
|
|
5
5
|
//#region src/schema/sync-entry.d.ts
|
|
@@ -150,6 +150,23 @@ interface TSyncEntryInit {
|
|
|
150
150
|
* @since 0.1.141
|
|
151
151
|
*/
|
|
152
152
|
cascadeFrom?: string[];
|
|
153
|
+
/**
|
|
154
|
+
* `true` on a managed view whose own definition changed since the last
|
|
155
|
+
* sync — the reason it is dropped and recreated. Printed as
|
|
156
|
+
* `· definition changed`.
|
|
157
|
+
* @since 0.1.162
|
|
158
|
+
*/
|
|
159
|
+
definitionChanged?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Managed indexes created, dropped or rebuilt (definition drift). On a
|
|
162
|
+
* plan entry: what the run's index sync would do to the live table as it
|
|
163
|
+
* is now (before the entry's column changes; not planned for a table the
|
|
164
|
+
* run creates, recreates or renames). On a run entry: what it did — not
|
|
165
|
+
* reported for a created or recreated table. Either marks the entry
|
|
166
|
+
* `alter`.
|
|
167
|
+
* @since 0.1.162
|
|
168
|
+
*/
|
|
169
|
+
indexChanges?: TIndexChange[];
|
|
153
170
|
}
|
|
154
171
|
declare class SyncEntry {
|
|
155
172
|
readonly name: string;
|
|
@@ -223,6 +240,10 @@ declare class SyncEntry {
|
|
|
223
240
|
readonly refused: boolean;
|
|
224
241
|
/** @since 0.1.141 — see {@link TSyncEntryInit.cascadeFrom}. */
|
|
225
242
|
readonly cascadeFrom: string[];
|
|
243
|
+
/** @since 0.1.162 — see {@link TSyncEntryInit.definitionChanged}. */
|
|
244
|
+
readonly definitionChanged: boolean;
|
|
245
|
+
/** @since 0.1.162 — see {@link TSyncEntryInit.indexChanges}. */
|
|
246
|
+
readonly indexChanges: TIndexChange[];
|
|
226
247
|
constructor(init: TSyncEntryInit);
|
|
227
248
|
/**
|
|
228
249
|
* The init object this entry was built from — lets callers derive a
|
|
@@ -259,8 +280,9 @@ declare class SyncEntry {
|
|
|
259
280
|
/** `! PK (id) → (code) — rebuild (table is empty)` / `— rebuild (rows satisfy the new key)` / `— skipped (safe mode)` */
|
|
260
281
|
private printPkChange;
|
|
261
282
|
/**
|
|
262
|
-
* `! col: t1 → t2 — drop` (plan),
|
|
263
|
-
* mode)` in plan and result when
|
|
283
|
+
* `! col: t1 → t2 — drop` (plan), `~ col: t1 → t2 — type changed` (result),
|
|
284
|
+
* or `! type col (t1 → t2) — skipped (safe mode)` in plan and result when
|
|
285
|
+
* the `'drop'` recreate was skipped.
|
|
264
286
|
*/
|
|
265
287
|
private printTypeChanges;
|
|
266
288
|
/**
|
|
@@ -278,6 +300,12 @@ declare class SyncEntry {
|
|
|
278
300
|
* change. Both: `! option k: a → b — skipped (safe mode)` when pending.
|
|
279
301
|
*/
|
|
280
302
|
private printOptionChanges;
|
|
303
|
+
/** `+ FK(a) → t — add` / `- … — remove` / `~ … — details` (plan); `added` / `removed` (result). */
|
|
304
|
+
private printForeignKeys;
|
|
305
|
+
/** `+ index name — add` / `- … — drop` / `~ … — rebuild` (plan); `added` / `dropped` / `rebuilt` (result). */
|
|
306
|
+
private printIndexChanges;
|
|
307
|
+
/** `· definition changed` — why a managed view is recreated. */
|
|
308
|
+
private printDefinitionChanged;
|
|
281
309
|
/** `· after: a, b` (plan only — the executor already runs in this order). */
|
|
282
310
|
private printDependsOn;
|
|
283
311
|
/** `· upstream view "x" recreated` — why an unchanged view is recreated. */
|
|
@@ -423,6 +451,14 @@ declare class SchemaSync {
|
|
|
423
451
|
* `safe` — safe mode skips the key rebuild, so its plan rule does not apply.
|
|
424
452
|
*/
|
|
425
453
|
private discoverTable;
|
|
454
|
+
/**
|
|
455
|
+
* Folds the index / foreign-key work on each live table as it is now
|
|
456
|
+
* (`planIndexes` / `planForeignKeys`) into its plan entry. Read only when
|
|
457
|
+
* plan entries are reported (`plan()`, a refused run) — a run reports what
|
|
458
|
+
* `syncIndexes` / `syncForeignKeys` did.
|
|
459
|
+
*/
|
|
460
|
+
private planLiveWork;
|
|
461
|
+
private planTableLiveWork;
|
|
426
462
|
/**
|
|
427
463
|
* Pure validation over the discovery facts. Every refusal is a change that
|
|
428
464
|
* no order of DDL can apply safely; the messages are user-facing.
|
|
@@ -566,4 +602,4 @@ declare function syncSchema(space: DbSpace, types: readonly TAtscriptAnnotatedTy
|
|
|
566
602
|
*/
|
|
567
603
|
declare function planSchema(space: DbSpace, types: readonly TAtscriptAnnotatedType[], opts?: Pick<TSyncOptions, "force" | "safe">): Promise<TSyncPlan>;
|
|
568
604
|
//#endregion
|
|
569
|
-
export { SchemaSync, SyncEntry, type TDbObjectKind, type TDependencyEdge, type TEnsureTableOptions, type TExistingForeignKey, type TFieldSnapshot, type TForeignKeyDiff, type TForeignKeySnapshot, type TPrimaryKeyChange, type TReferencingForeignKey, type TSyncColors, type TSyncDerivedChange, type TSyncEntryInit, type TSyncEntryStatus, type TSyncOptions, type TSyncPlan, type TSyncResult, type TSyncSkippedWork, type TTableSnapshot, type TViewColumnSnapshot, type TViewJoinSnapshot, type TViewSnapshot, canonicalizeQueryNode, computeColumnDiff, computeForeignKeyDiff, computeSchemaHash, computeTableHash, computeTableOptionDiff, computeTableSnapshot, computeViewSnapshot, fkKey, hasForeignKeyChanges, planSchema, readStoredSnapshot, snapshotToExistingColumns, snapshotToExistingTableOptions, syncSchema, topoOrder };
|
|
605
|
+
export { SchemaSync, SyncEntry, type TColumnDiffOptions, type TDbObjectKind, type TDependencyEdge, type TEnsureTableOptions, type TExistingForeignKey, type TFieldSnapshot, type TForeignKeyDiff, type TForeignKeySnapshot, type TPrimaryKeyChange, type TReferencingForeignKey, type TSyncColors, type TSyncDerivedChange, type TSyncEntryInit, type TSyncEntryStatus, type TSyncOptions, type TSyncPlan, type TSyncResult, type TSyncSkippedWork, type TTableSnapshot, type TViewColumnSnapshot, type TViewJoinSnapshot, type TViewSnapshot, canonicalizeQueryNode, computeColumnDiff, computeForeignKeyDiff, computeSchemaHash, computeTableHash, computeTableOptionDiff, computeTableSnapshot, computeViewSnapshot, fkKey, hasForeignKeyChanges, planSchema, readStoredSnapshot, sameDefaultValue, snapshotToExistingColumns, snapshotToExistingTableOptions, syncSchema, topoOrder };
|