@atscript/db 0.1.128 → 0.1.130

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 (39) hide show
  1. package/dist/agg.cjs +31 -0
  2. package/dist/agg.d.cts +30 -1
  3. package/dist/agg.d.mts +30 -1
  4. package/dist/agg.mjs +31 -1
  5. package/dist/{db-error-DXwEzmYJ.cjs → db-error-C4JuLcvb.cjs} +27 -0
  6. package/dist/{db-error-BHPXOKzc.mjs → db-error-COrO58t5.mjs} +22 -1
  7. package/dist/{db-readable-CkbZn_z-.d.cts → db-readable-B7eYWS5q.d.cts} +10 -1
  8. package/dist/{db-readable-BTl4NzNN.d.mts → db-readable-Bn1bV_eC.d.mts} +10 -1
  9. package/dist/{db-space-BEB5Jl8M.d.mts → db-space-C2UCnGHd.d.cts} +28 -2
  10. package/dist/{db-space-BevOyVrC.d.cts → db-space-DdIPYD0Q.d.mts} +28 -2
  11. package/dist/{db-view-Ck0I-PMI.mjs → db-view-BkF2xEGd.mjs} +98 -8
  12. package/dist/{db-view-C8-MsjND.cjs → db-view-hkwQ-fHJ.cjs} +98 -8
  13. package/dist/index.cjs +4 -3
  14. package/dist/index.d.cts +4 -4
  15. package/dist/index.d.mts +4 -4
  16. package/dist/index.mjs +4 -4
  17. package/dist/{nested-writer-DI-HeTky.mjs → nested-writer-CkDo-ZfH.mjs} +1 -1
  18. package/dist/{nested-writer-DoDhl3X3.cjs → nested-writer-DxPhmWFz.cjs} +1 -1
  19. package/dist/ops.cjs +1 -1
  20. package/dist/ops.mjs +1 -1
  21. package/dist/rel.cjs +2 -2
  22. package/dist/rel.d.cts +1 -1
  23. package/dist/rel.d.mts +1 -1
  24. package/dist/rel.mjs +2 -2
  25. package/dist/{relation-loader-BnUgJsUG.cjs → relation-loader-C8GOpNYJ.cjs} +1 -1
  26. package/dist/{relation-loader-BmeOMj0b.mjs → relation-loader-CUGcxJ18.mjs} +1 -1
  27. package/dist/sync.cjs +280 -143
  28. package/dist/sync.d.cts +24 -6
  29. package/dist/sync.d.mts +24 -6
  30. package/dist/sync.mjs +280 -143
  31. package/dist/{validator-eKYWf3xf.mjs → validator-CeD_fqyW.mjs} +1 -1
  32. package/dist/{validator-BNUHCXIE.cjs → validator-lkCJKuoo.cjs} +1 -1
  33. package/dist/{validator-DuAmWc8L.d.cts → validator-wBARmD68.d.cts} +21 -2
  34. package/dist/{validator-DuAmWc8L.d.mts → validator-wBARmD68.d.mts} +21 -2
  35. package/dist/validator.cjs +2 -2
  36. package/dist/validator.d.cts +1 -1
  37. package/dist/validator.d.mts +1 -1
  38. package/dist/validator.mjs +2 -2
  39. package/package.json +1 -1
package/dist/sync.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as TDbForeignKey, K as TDbObjectKind, L as TDbDefaultValue, Nt as TGenericLogger, O as TColumnDiff, Z as TDbStorageType, at as TExistingForeignKey, ht as TReferencingForeignKey, it as TExistingColumn, mt as TPrimaryKeyChange, ot as TExistingTableOption, rt as TEnsureTableOptions, t as AtscriptDbReadable, yt as TTableOptionDiff, z as TDbFieldMeta } from "./db-readable-CkbZn_z-.cjs";
2
- import { c as AtscriptQueryFieldRef$1, i as AtscriptDbView, l as AtscriptQueryNode$1, t as DbSpace } from "./db-space-BevOyVrC.cjs";
1
+ import { B as TDbForeignKey, K as TDbObjectKind, L as TDbDefaultValue, O as TColumnDiff, Pt as TGenericLogger, Z as TDbStorageType, at as TExistingForeignKey, ht as TReferencingForeignKey, it as TExistingColumn, mt as TPrimaryKeyChange, ot as TExistingTableOption, rt as TEnsureTableOptions, t as AtscriptDbReadable, yt as TTableOptionDiff, z as TDbFieldMeta } from "./db-readable-B7eYWS5q.cjs";
2
+ import { c as AtscriptQueryFieldRef$1, i as AtscriptDbView, l as AtscriptQueryNode$1, t as DbSpace } from "./db-space-C2UCnGHd.cjs";
3
3
  import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
4
4
 
5
5
  //#region src/schema/sync-entry.d.ts
@@ -175,6 +175,13 @@ declare class SyncEntry {
175
175
  * @since 0.1.128
176
176
  */
177
177
  toInit(): TSyncEntryInit;
178
+ /**
179
+ * This entry as an `error` entry with `msg` appended to its errors — the
180
+ * shape a DDL failure inside the entry's step reports (the planned work is
181
+ * kept, the status says it did not land).
182
+ * @since 0.1.129
183
+ */
184
+ withError(msg: string): SyncEntry;
178
185
  /**
179
186
  * Whether desired work is still pending after this entry — DDL that was
180
187
  * not issued because the entry errored or safe mode skipped it (see
@@ -379,13 +386,14 @@ interface TSyncOptions {
379
386
  */
380
387
  safe?: boolean;
381
388
  /**
382
- * Logger for sync progress and failures (index/FK DDL errors are logged,
383
- * not thrown). Default: NoopLogger — pass `console` to surface them.
389
+ * Logger for sync progress and failures (DDL errors inside a table's step
390
+ * are logged and recorded on its entry, not thrown). Default: NoopLogger —
391
+ * pass `console` to surface them.
384
392
  */
385
393
  logger?: TGenericLogger;
386
394
  /**
387
- * What to do when the run finishes with errored entries (failed index/FK
388
- * DDL, external-view checks, pre-flight refusals, …):
395
+ * What to do when the run finishes with errored entries (failed DDL inside
396
+ * a table's step, external-view checks, pre-flight refusals, …):
389
397
  * - `"warn"` (default) — emit a one-line summary plus per-entry error lines
390
398
  * via the configured logger, **falling back to `console` when no logger
391
399
  * is set** (errors are never silently swallowed by the NoopLogger default);
@@ -459,6 +467,7 @@ declare class SchemaSync {
459
467
  * Introspects one desired table and computes its plan entry.
460
468
  * `probeRecreateInbound` — whether a drop-and-recreate's live inbound FKs
461
469
  * are worth probing (a removed table exists that could block it).
470
+ * `safe` — safe mode skips the key rebuild, so its plan rule does not apply.
462
471
  */
463
472
  private discoverTable;
464
473
  /**
@@ -486,6 +495,8 @@ declare class SchemaSync {
486
495
  * before the table they block) and late groups (after the views) alike.
487
496
  */
488
497
  private dropRemovedGroup;
498
+ /** The error-entry message of a DDL failure inside a view step, logged at error level. */
499
+ private stepFailed;
489
500
  /**
490
501
  * Surfaces the run outcome per the `onError` policy. Reporting must never be
491
502
  * silently lost to the NoopLogger default — when no real logger is
@@ -503,6 +514,13 @@ declare class SchemaSync {
503
514
  private resolveTypeMapper;
504
515
  /**
505
516
  * Populates plan init from a column diff (shared by Path A and Path B).
517
+ *
518
+ * The plan's rule set is canonical (since 0.1.129): every change the
519
+ * executor cannot apply without DDL it does not have is an `error` entry
520
+ * here, and `executeSyncTable` returns an errored plan entry untouched —
521
+ * so the executor's own copies of these rules are reached only when
522
+ * discovery had no diff (a pending rename whose old name it could not
523
+ * introspect).
506
524
  */
507
525
  private populatePlanFromDiff;
508
526
  /**
package/dist/sync.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as TDbForeignKey, K as TDbObjectKind, L as TDbDefaultValue, Nt as TGenericLogger, O as TColumnDiff, Z as TDbStorageType, at as TExistingForeignKey, ht as TReferencingForeignKey, it as TExistingColumn, mt as TPrimaryKeyChange, ot as TExistingTableOption, rt as TEnsureTableOptions, t as AtscriptDbReadable, yt as TTableOptionDiff, z as TDbFieldMeta } from "./db-readable-BTl4NzNN.mjs";
2
- import { c as AtscriptQueryFieldRef$1, i as AtscriptDbView, l as AtscriptQueryNode$1, t as DbSpace } from "./db-space-BEB5Jl8M.mjs";
1
+ import { B as TDbForeignKey, K as TDbObjectKind, L as TDbDefaultValue, O as TColumnDiff, Pt as TGenericLogger, Z as TDbStorageType, at as TExistingForeignKey, ht as TReferencingForeignKey, it as TExistingColumn, mt as TPrimaryKeyChange, ot as TExistingTableOption, rt as TEnsureTableOptions, t as AtscriptDbReadable, yt as TTableOptionDiff, z as TDbFieldMeta } from "./db-readable-Bn1bV_eC.mjs";
2
+ import { c as AtscriptQueryFieldRef$1, i as AtscriptDbView, l as AtscriptQueryNode$1, t as DbSpace } from "./db-space-DdIPYD0Q.mjs";
3
3
  import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
4
4
 
5
5
  //#region src/schema/sync-entry.d.ts
@@ -175,6 +175,13 @@ declare class SyncEntry {
175
175
  * @since 0.1.128
176
176
  */
177
177
  toInit(): TSyncEntryInit;
178
+ /**
179
+ * This entry as an `error` entry with `msg` appended to its errors — the
180
+ * shape a DDL failure inside the entry's step reports (the planned work is
181
+ * kept, the status says it did not land).
182
+ * @since 0.1.129
183
+ */
184
+ withError(msg: string): SyncEntry;
178
185
  /**
179
186
  * Whether desired work is still pending after this entry — DDL that was
180
187
  * not issued because the entry errored or safe mode skipped it (see
@@ -379,13 +386,14 @@ interface TSyncOptions {
379
386
  */
380
387
  safe?: boolean;
381
388
  /**
382
- * Logger for sync progress and failures (index/FK DDL errors are logged,
383
- * not thrown). Default: NoopLogger — pass `console` to surface them.
389
+ * Logger for sync progress and failures (DDL errors inside a table's step
390
+ * are logged and recorded on its entry, not thrown). Default: NoopLogger —
391
+ * pass `console` to surface them.
384
392
  */
385
393
  logger?: TGenericLogger;
386
394
  /**
387
- * What to do when the run finishes with errored entries (failed index/FK
388
- * DDL, external-view checks, pre-flight refusals, …):
395
+ * What to do when the run finishes with errored entries (failed DDL inside
396
+ * a table's step, external-view checks, pre-flight refusals, …):
389
397
  * - `"warn"` (default) — emit a one-line summary plus per-entry error lines
390
398
  * via the configured logger, **falling back to `console` when no logger
391
399
  * is set** (errors are never silently swallowed by the NoopLogger default);
@@ -459,6 +467,7 @@ declare class SchemaSync {
459
467
  * Introspects one desired table and computes its plan entry.
460
468
  * `probeRecreateInbound` — whether a drop-and-recreate's live inbound FKs
461
469
  * are worth probing (a removed table exists that could block it).
470
+ * `safe` — safe mode skips the key rebuild, so its plan rule does not apply.
462
471
  */
463
472
  private discoverTable;
464
473
  /**
@@ -486,6 +495,8 @@ declare class SchemaSync {
486
495
  * before the table they block) and late groups (after the views) alike.
487
496
  */
488
497
  private dropRemovedGroup;
498
+ /** The error-entry message of a DDL failure inside a view step, logged at error level. */
499
+ private stepFailed;
489
500
  /**
490
501
  * Surfaces the run outcome per the `onError` policy. Reporting must never be
491
502
  * silently lost to the NoopLogger default — when no real logger is
@@ -503,6 +514,13 @@ declare class SchemaSync {
503
514
  private resolveTypeMapper;
504
515
  /**
505
516
  * Populates plan init from a column diff (shared by Path A and Path B).
517
+ *
518
+ * The plan's rule set is canonical (since 0.1.129): every change the
519
+ * executor cannot apply without DDL it does not have is an `error` entry
520
+ * here, and `executeSyncTable` returns an errored plan entry untouched —
521
+ * so the executor's own copies of these rules are reached only when
522
+ * discovery had no diff (a pending rename whose old name it could not
523
+ * introspect).
506
524
  */
507
525
  private populatePlanFromDiff;
508
526
  /**