@jini-ai/db 0.7.3-next.2 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +66 -2
  3. package/dist/core/ports.d.ts +2 -2
  4. package/dist/core/ports.js +2 -2
  5. package/dist/data-modules/data-module.d.ts +2 -46
  6. package/dist/data-modules/plugin-identity.d.ts +2 -11
  7. package/dist/data-modules/snapshot.d.ts +5 -3
  8. package/dist/data-modules/snapshot.js +5 -3
  9. package/dist/events/change-set-repo.sql.d.ts +18 -5
  10. package/dist/events/change-set-repo.sql.js +25 -8
  11. package/dist/events/index.d.ts +1 -1
  12. package/dist/events/outbox-repo.sql.d.ts +26 -1
  13. package/dist/events/outbox-repo.sql.js +36 -2
  14. package/dist/events/repo.rows.d.ts +22 -4
  15. package/dist/events/repo.rows.js +32 -4
  16. package/dist/kernel/idle-turn.d.ts +62 -0
  17. package/dist/kernel/idle-turn.js +32 -0
  18. package/dist/kernel/index.d.ts +1 -0
  19. package/dist/kernel/index.js +1 -0
  20. package/dist/kernel/kernel-core.js +28 -0
  21. package/dist/kernel/schema-scope.js +2 -0
  22. package/dist/kernel/sqlite/driver.js +2 -0
  23. package/dist/kernel/sqlite/index.d.ts +1 -1
  24. package/dist/kernel/sqlite/index.js +1 -1
  25. package/dist/kernel/sqlite/ops.d.ts +61 -0
  26. package/dist/kernel/sqlite/ops.js +82 -0
  27. package/dist/kernel/turn-lock.d.ts +2 -0
  28. package/dist/kernel/turn-lock.js +7 -0
  29. package/dist/migrate/runner.d.ts +3 -3
  30. package/dist/migrate/runner.js +4 -1
  31. package/dist/owner-store/index.js +1 -1
  32. package/dist/pglite/copy-source.d.ts +45 -0
  33. package/dist/pglite/copy-source.js +36 -0
  34. package/dist/pglite/index.d.ts +1 -0
  35. package/dist/pglite/index.js +1 -0
  36. package/dist/react/recovery/Recovery.d.ts +205 -0
  37. package/dist/react/recovery/Recovery.js +141 -0
  38. package/dist/react/recovery/Recovery.restore-steps.d.ts +10 -0
  39. package/dist/react/recovery/Recovery.restore-steps.js +71 -0
  40. package/dist/recovery/agent-tools.d.ts +33 -0
  41. package/dist/recovery/agent-tools.js +166 -0
  42. package/dist/recovery/drift.d.ts +47 -0
  43. package/dist/recovery/drift.js +51 -0
  44. package/dist/recovery/journal-kernel.d.ts +80 -0
  45. package/dist/recovery/journal-kernel.js +40 -0
  46. package/dist/recovery/journal-repo.sql.d.ts +154 -0
  47. package/dist/recovery/journal-repo.sql.js +303 -0
  48. package/dist/recovery/journal-schema.d.ts +37 -0
  49. package/dist/recovery/journal-schema.js +110 -0
  50. package/dist/recovery/migrate-forward-hooks.d.ts +2 -1
  51. package/dist/recovery/migrate-forward-hooks.js +3 -3
  52. package/dist/recovery/operation-lock.d.ts +2 -17
  53. package/dist/recovery/reconcile-interrupted-migration.d.ts +2 -5
  54. package/dist/recovery/reconcile-interrupted-migration.js +0 -30
  55. package/dist/recovery/restore-hooks.d.ts +4 -0
  56. package/dist/recovery/restore-hooks.js +1 -1
  57. package/dist/recovery/tool-registrations.d.ts +175 -0
  58. package/dist/recovery/tool-registrations.js +295 -0
  59. package/dist/site/repo.memory.d.ts +149 -0
  60. package/dist/site/repo.memory.js +162 -0
  61. package/dist/site/tool-registrations.d.ts +130 -0
  62. package/dist/site/tool-registrations.js +184 -0
  63. package/dist/sqlite/backup-policy.d.ts +14 -0
  64. package/dist/sqlite/backup-policy.js +47 -3
  65. package/dist/sqlite/compaction-steps.d.ts +43 -0
  66. package/dist/sqlite/compaction-steps.js +74 -0
  67. package/dist/sqlite/compaction.d.ts +63 -0
  68. package/dist/sqlite/compaction.js +263 -0
  69. package/dist/sqlite/db-ops.js +10 -11
  70. package/dist/sqlite/index.d.ts +2 -1
  71. package/dist/sqlite/index.js +2 -1
  72. package/dist/sqlite/open.d.ts +2 -1
  73. package/dist/sqlite/open.js +14 -4
  74. package/dist/tools/index.d.ts +2 -0
  75. package/dist/tools/index.js +2 -0
  76. package/dist/tools/plan-store.d.ts +1 -1
  77. package/dist/tools/plan-store.js +10 -6
  78. package/dist/tools/read-tools.d.ts +1 -1
  79. package/dist/tools/site-db-messages.d.ts +10 -0
  80. package/dist/tools/site-db-messages.js +23 -0
  81. package/dist/tools/site-transfer-messages.d.ts +9 -0
  82. package/dist/tools/site-transfer-messages.js +20 -0
  83. package/dist/transfer/confirmation-ui.d.ts +19 -0
  84. package/dist/transfer/confirmation-ui.js +39 -0
  85. package/dist/transfer/copy-engine.js +11 -11
  86. package/dist/transfer/copy-order.js +1 -3
  87. package/dist/transfer/destination-store.d.ts +83 -0
  88. package/dist/transfer/destination-store.js +82 -0
  89. package/dist/transfer/index.d.ts +2 -0
  90. package/dist/transfer/index.js +2 -0
  91. package/dist/transfer/internal-ddl.d.ts +6 -2
  92. package/dist/transfer/internal-ddl.js +15 -15
  93. package/dist/transfer/postgres-ddl.js +2 -2
  94. package/dist/transfer/schema-catalog.d.ts +148 -0
  95. package/dist/transfer/schema-catalog.js +141 -0
  96. package/dist/transfer/sqlite-backup.d.ts +27 -0
  97. package/dist/transfer/sqlite-backup.js +31 -0
  98. package/dist/transfer/table-catalog.js +1 -0
  99. package/dist/watermark/kernel.d.ts +64 -0
  100. package/dist/watermark/kernel.js +45 -0
  101. package/package.json +107 -9
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @file SPEC-017 C-102 / CIC U-002 / REQ-03 / AC-03 — drift classification between a site's
3
+ * persisted schema snapshot and the runtime's current schema.
4
+ *
5
+ * Purpose:
6
+ * Compares `.site-meta.json {schemaVersion, schemaTag}` against `__drizzle_migrations`'s current
7
+ * tag (ADR-041 §3). Feeds the Timeline's drift banner and the preflight gate that refuses
8
+ * forward-migrate when the site has diverged onto a different migration lineage.
9
+ *
10
+ * How it relates to the project:
11
+ * Pure classification only — no I/O. Callers (the migrate-forward plan step, boot-time
12
+ * SERVE_SITE policy) read the two `SchemaSnapshot`s from their own adapters and pass them in.
13
+ *
14
+ * Architectural role:
15
+ * RELOCATED FROM `features/database/drift.ts` (2026-08-17, architecture SCC cut — see the
16
+ * database-cycle-investigation report). `db/sqlite/database-introspection-adapter.sqlite.ts` was
17
+ * the only VALUE importer of this file outside `features/database` itself, and that one edge
18
+ * (`db -> features/database`) was what closed a cycle once `features/database` got its own
19
+ * `registerToolContributor` edge back into `assistant` (see `features/database/tool-registrations.ts`'s
20
+ * `contributeDatabaseTools()`). Moving this pure, dependency-free module into `db/` — where its one
21
+ * real value-importing caller already lives — removes that edge entirely rather than narrowing it.
22
+ * `features/database/adapter.sqlite.ts` (the port-owning file) still imports `DriftStatus`/
23
+ * `SchemaSnapshot` from here, but only as `import type`, which is erased from the runtime-only graph
24
+ * `check:architecture` gates on. Depends on nothing outside this module.
25
+ *
26
+ * Moved again (w4-db lane): out of the host's `platform/db/drift.ts` into `@jini-ai/db/recovery/drift`,
27
+ * beside the recovery modules that consume the classification. Still pure and dependency-free.
28
+ */
29
+ import type { DriftStatus, SchemaSnapshot } from "@jini-ai/core/contracts/site/database-introspection";
30
+ export type { DriftStatus, SchemaSnapshot } from "@jini-ai/core/contracts/site/database-introspection";
31
+ /**
32
+ * Classifies drift between a site's persisted schema snapshot and the runtime's current schema.
33
+ *
34
+ * CIC U-002-B1/ORD1 (binding): tag-identity comparison is evaluated first and is unconditionally
35
+ * decisive — a tag mismatch is always `"diverged"`, regardless of the version-index relationship.
36
+ * Version-index comparison is used only to disambiguate `"ahead"` vs `"behind"` once the tags
37
+ * already match. This ordering exists because a naive version-index-first shortcut would
38
+ * misclassify an equal-index, different-lineage pair as `"in-sync"`.
39
+ *
40
+ * @complexity O(1).
41
+ * @overallScore 100
42
+ */
43
+ export declare function getDriftStatus(required: {
44
+ siteMeta: SchemaSnapshot;
45
+ runtime: SchemaSnapshot;
46
+ }, _optional?: Record<string, never>): DriftStatus;
47
+ //# sourceMappingURL=drift.d.ts.map
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @file SPEC-017 C-102 / CIC U-002 / REQ-03 / AC-03 — drift classification between a site's
3
+ * persisted schema snapshot and the runtime's current schema.
4
+ *
5
+ * Purpose:
6
+ * Compares `.site-meta.json {schemaVersion, schemaTag}` against `__drizzle_migrations`'s current
7
+ * tag (ADR-041 §3). Feeds the Timeline's drift banner and the preflight gate that refuses
8
+ * forward-migrate when the site has diverged onto a different migration lineage.
9
+ *
10
+ * How it relates to the project:
11
+ * Pure classification only — no I/O. Callers (the migrate-forward plan step, boot-time
12
+ * SERVE_SITE policy) read the two `SchemaSnapshot`s from their own adapters and pass them in.
13
+ *
14
+ * Architectural role:
15
+ * RELOCATED FROM `features/database/drift.ts` (2026-08-17, architecture SCC cut — see the
16
+ * database-cycle-investigation report). `db/sqlite/database-introspection-adapter.sqlite.ts` was
17
+ * the only VALUE importer of this file outside `features/database` itself, and that one edge
18
+ * (`db -> features/database`) was what closed a cycle once `features/database` got its own
19
+ * `registerToolContributor` edge back into `assistant` (see `features/database/tool-registrations.ts`'s
20
+ * `contributeDatabaseTools()`). Moving this pure, dependency-free module into `db/` — where its one
21
+ * real value-importing caller already lives — removes that edge entirely rather than narrowing it.
22
+ * `features/database/adapter.sqlite.ts` (the port-owning file) still imports `DriftStatus`/
23
+ * `SchemaSnapshot` from here, but only as `import type`, which is erased from the runtime-only graph
24
+ * `check:architecture` gates on. Depends on nothing outside this module.
25
+ *
26
+ * Moved again (w4-db lane): out of the host's `platform/db/drift.ts` into `@jini-ai/db/recovery/drift`,
27
+ * beside the recovery modules that consume the classification. Still pure and dependency-free.
28
+ */
29
+ /**
30
+ * Classifies drift between a site's persisted schema snapshot and the runtime's current schema.
31
+ *
32
+ * CIC U-002-B1/ORD1 (binding): tag-identity comparison is evaluated first and is unconditionally
33
+ * decisive — a tag mismatch is always `"diverged"`, regardless of the version-index relationship.
34
+ * Version-index comparison is used only to disambiguate `"ahead"` vs `"behind"` once the tags
35
+ * already match. This ordering exists because a naive version-index-first shortcut would
36
+ * misclassify an equal-index, different-lineage pair as `"in-sync"`.
37
+ *
38
+ * @complexity O(1).
39
+ * @overallScore 100
40
+ */
41
+ export function getDriftStatus(required, _optional = {}) {
42
+ const { siteMeta, runtime } = required;
43
+ if (siteMeta.tag !== runtime.tag) {
44
+ return "diverged";
45
+ }
46
+ if (siteMeta.version === runtime.version) {
47
+ return "in-sync";
48
+ }
49
+ return siteMeta.version > runtime.version ? "ahead" : "behind";
50
+ }
51
+ //# sourceMappingURL=drift.js.map
@@ -0,0 +1,80 @@
1
+ import type { Generated } from "kysely";
2
+ import type { KyselyKernel } from "../kernel/port.js";
3
+ /**
4
+ * @file The sidecar database journal (`ops/database-journal.db`; the host opens it on its SQLite driver)
5
+ * as a storage kernel: `StorageKernel<JournalDatabase>`. The journal twin of the host's chat kernel.
6
+ *
7
+ * The journal is per-site ops metadata (restore points, migration runs, the boot ledger) and stays
8
+ * a local SQLite file whatever database the site's content lives in — so its tables are typed here
9
+ * by hand, snake_case, exactly as `journal-schema.ts` creates them. Type aliases,
10
+ * not interfaces: Kysely's table typing needs them (see `packages/cms/src/comments/sql/repo.rows.ts`).
11
+ */
12
+ export type DatabaseLedgerTable = {
13
+ id: string;
14
+ site_id: string;
15
+ kind: string;
16
+ correlation_id: string | null;
17
+ restore_point_id: string | null;
18
+ schema_before_version: number | null;
19
+ schema_before_tag: string | null;
20
+ schema_after_version: number | null;
21
+ schema_after_tag: string | null;
22
+ drift_status: string | null;
23
+ outcome: string;
24
+ detail_json: string | null;
25
+ actor_workspace_id: string | null;
26
+ actor_id: string | null;
27
+ delegated_by_workspace_id: string | null;
28
+ delegated_by_id: string | null;
29
+ created_at: string;
30
+ };
31
+ export type MigrationRunsTable = {
32
+ id: string;
33
+ site_id: string;
34
+ dialect: string;
35
+ status: string;
36
+ revision_seq_at_quiesce: number | null;
37
+ quiesce_integrity: string | null;
38
+ /** 0/1 (SQLite has no boolean). */
39
+ blue_touched: Generated<number>;
40
+ correlation_id: string | null;
41
+ restore_point_id: string | null;
42
+ actor_workspace_id: string | null;
43
+ actor_id: string | null;
44
+ delegated_by_workspace_id: string | null;
45
+ delegated_by_id: string | null;
46
+ created_at: string;
47
+ updated_at: string;
48
+ };
49
+ export type RestorePointsTable = {
50
+ id: string;
51
+ site_id: string;
52
+ trigger: string;
53
+ cost_class: string;
54
+ kind: string;
55
+ artifact_ref: string;
56
+ watermark_at_capture: number | null;
57
+ captured_schema_version: number | null;
58
+ captured_schema_tag: string | null;
59
+ size_bytes: number | null;
60
+ idempotency_key: string | null;
61
+ actor_workspace_id: string | null;
62
+ actor_id: string | null;
63
+ created_at: string;
64
+ };
65
+ export type JournalDatabase = {
66
+ database_ledger: DatabaseLedgerTable;
67
+ migration_runs: MigrationRunsTable;
68
+ restore_points: RestorePointsTable;
69
+ };
70
+ export type JournalKernel = KyselyKernel<JournalDatabase>;
71
+ /**
72
+ * `kernel` with every database call held until `ready` settles (and failing with its error if it
73
+ * rejects), and `ready` reported as the kernel's own: the {@link StorageKernel.ready} contract, for a
74
+ * kernel whose schema is applied through the kernel itself after the connection opens.
75
+ */
76
+ export declare function gateJournalKernel({ kernel, ready }: {
77
+ kernel: JournalKernel;
78
+ ready: Promise<void>;
79
+ }, _optional?: Record<string, never>): JournalKernel;
80
+ //# sourceMappingURL=journal-kernel.d.ts.map
@@ -0,0 +1,40 @@
1
+ import { afterSettled, observed } from "@jini-ai/core/errors/idioms";
2
+ /**
3
+ * `kernel` with every database call held until `ready` settles (and failing with its error if it
4
+ * rejects), and `ready` reported as the kernel's own: the {@link StorageKernel.ready} contract, for a
5
+ * kernel whose schema is applied through the kernel itself after the connection opens.
6
+ */
7
+ export function gateJournalKernel({ kernel, ready }, _optional = {}) {
8
+ // Observed here so a failed open is not an unhandled rejection; every call below re-throws it.
9
+ observed({ promise: ready });
10
+ return {
11
+ ...kernel,
12
+ ready,
13
+ run: async (fn) => {
14
+ await ready;
15
+ return kernel.run(fn);
16
+ },
17
+ transaction: async (fn) => {
18
+ await ready;
19
+ return kernel.transaction(fn);
20
+ },
21
+ query: async (statement) => {
22
+ await ready;
23
+ return kernel.query(statement);
24
+ },
25
+ execute: async (statement) => {
26
+ await ready;
27
+ await kernel.execute(statement);
28
+ },
29
+ backupTo: async (destPath) => {
30
+ await ready;
31
+ await kernel.backupTo(destPath);
32
+ },
33
+ close: async () => {
34
+ // Readiness errors reach kernel callers; close must still release the underlying handle.
35
+ await afterSettled({ promise: ready });
36
+ await kernel.close();
37
+ },
38
+ };
39
+ }
40
+ //# sourceMappingURL=journal-kernel.js.map
@@ -0,0 +1,154 @@
1
+ import type { LedgerReadPort, LedgerRow } from "../tools/timeline.js";
2
+ import type { LedgerAppendPort } from "./migrate-forward-hooks.js";
3
+ import type { BootLedgerPort, MigrationRunsRepoPort } from "./reconcile-interrupted-migration.js";
4
+ import type { CreateRestorePointRepoPort } from "./restore-point-create.js";
5
+ import type { JournalKernel } from "./journal-kernel.js";
6
+ /** `database_ledger` adapter — implements both the Timeline's read port and the boot
7
+ * reconciliation's append port, siteId-scoped at construction. */
8
+ export declare class SqliteDatabaseLedgerRepo implements LedgerReadPort, BootLedgerPort {
9
+ private readonly deps;
10
+ constructor(deps: {
11
+ db: JournalKernel;
12
+ siteId: string;
13
+ });
14
+ /**
15
+ * REQ-01/REQ-04 — filtered, cursor-paginated read over `database_ledger`, newest-first. The
16
+ * cursor is an opaque `${createdAt}::${id}` composite (never a raw offset — stable under
17
+ * concurrent inserts).
18
+ *
19
+ * @complexity O(limit) via the `(site_id, created_at)` index; one extra row fetched to detect
20
+ * `nextCursor` presence without a second COUNT query.
21
+ * @overallScore 100
22
+ */
23
+ query(filter: {
24
+ kind?: string;
25
+ fromDate?: string;
26
+ toDate?: string;
27
+ outcome?: string;
28
+ cursor?: string | null;
29
+ limit: number;
30
+ }): Promise<{
31
+ items: LedgerRow[];
32
+ nextCursor: string | null;
33
+ }>;
34
+ /** Appends one `database_ledger` row (ADR-041 §4). Never mutates or deletes an existing row —
35
+ * the ledger is append-only by construction. */
36
+ append(row: Parameters<LedgerAppendPort["append"]>[0]): Promise<void>;
37
+ /** SPEC-017 C-106 — converts a non-terminal `migration_runs` row into a `migration.interrupted`
38
+ * ledger row (ADR-041 §3's boot-time crash reconciliation).
39
+ *
40
+ * Round-5 re-audit (2026-07-16, TM-adr041-043-044-045-audit-001, codex `R5-F1-BLOCKED-RECOVERY-
41
+ * NOT-RESTART-SAFE` / Fable `R5-F1-INTERRUPTED-SECOND-BOOT-BRICK`, both independently confirmed
42
+ * by direct code inspection and Fable's empirical double-boot reproduction): `database_ledger.id`
43
+ * is the primary key, and this method's id (`interrupted-${migrationRunId}`) is
44
+ * deterministic BY DESIGN so a second boot re-detecting the SAME still-unresolved migration
45
+ * targets the same row. Before this fix, the plain insert this called through
46
+ * `append()` threw `UNIQUE constraint failed` on that second boot, which — because this is a
47
+ * CRITICAL boot module — failed the whole boot and `process.exit(1)`'d before `app.listen()`,
48
+ * making Recovery itself unreachable. `ON CONFLICT (id) DO NOTHING` makes the deterministic id do what
49
+ * it was always meant to: every boot re-detects and re-blocks idempotently. */
50
+ appendInterruptedRow(params: {
51
+ siteId: string;
52
+ migrationRunId: string;
53
+ }): Promise<void>;
54
+ }
55
+ /** `migration_runs` adapter — implements the boot-sequence's `MigrationRunsRepoPort`, plus the
56
+ * insert/status-update helpers the state machine's own persistence caller needs. */
57
+ export declare class SqliteMigrationRunsRepo implements MigrationRunsRepoPort {
58
+ private static readonly TERMINAL_STATUSES;
59
+ private readonly deps;
60
+ constructor(deps: {
61
+ db: JournalKernel;
62
+ siteId: string;
63
+ });
64
+ /**
65
+ * SPEC-017 C-106/C-107 (INV-08) — the single defensive read both boot-sequence steps consult:
66
+ * a non-null result means a crashed-mid-migration run has not yet been reconciled.
67
+ *
68
+ * @complexity O(1) via the `(site_id, status)` index.
69
+ * @overallScore 100
70
+ */
71
+ findNonTerminalForSite(siteId: string): Promise<{
72
+ id: string;
73
+ status: string;
74
+ } | null>;
75
+ /** Round-5 re-audit (2026-07-16, TM-adr041-043-044-045-audit-001, R5-F1/R5-F2 fix) — terminalizes
76
+ * a run as `RESTORED` (a real member of `MIGRATION_RUN_TERMINAL_STATUSES`) so the next boot's
77
+ * `findNonTerminalForSite` no longer re-detects it. Thin wrapper over `updateState`, kept as its
78
+ * own port method so callers outside this file (the restore ceremony) don't need `updateState`'s
79
+ * full row shape. */
80
+ markResolved(params: {
81
+ id: string;
82
+ }): Promise<void>;
83
+ /** Inserts a new `migration_runs` row (state machine's initial `IDLE`/`PLANNED` write). */
84
+ insert(row: {
85
+ id: string;
86
+ dialect: "sqlite" | "postgres";
87
+ status: string;
88
+ correlationId?: string | null;
89
+ createdAt: string;
90
+ updatedAt: string;
91
+ }): Promise<void>;
92
+ /** Persists a state-machine transition's resulting fields against an existing row. A field left
93
+ * `undefined` is not written (an explicit `null` clears it). */
94
+ updateState(row: {
95
+ id: string;
96
+ status: string;
97
+ revisionSeqAtQuiesce?: number | null;
98
+ quiesceIntegrity?: string | null;
99
+ blueTouched?: boolean;
100
+ restorePointId?: string | null;
101
+ updatedAt: string;
102
+ }): Promise<void>;
103
+ }
104
+ /** What {@link SqliteRestorePointsRepo} is constructed with. `onPruneWarning` is the host's port for a
105
+ * failed cleanup of older restore-point copies: the host formats and redacts the error and decides where
106
+ * the warning goes, so this package never writes to a console or knows a host's secret shapes. */
107
+ export type RestorePointsRepoDeps = {
108
+ db: JournalKernel;
109
+ siteId: string;
110
+ protectedRestorePointIds?: () => Promise<ReadonlySet<string>>;
111
+ onPruneWarning: ({ error }: {
112
+ error: unknown;
113
+ }) => void;
114
+ };
115
+ /** `restore_points` adapter — implements `./restore-point-create.ts`'s
116
+ * `CreateRestorePointRepoPort`, plus the database-side persistence helper `db-ops`'s
117
+ * `captureRestorePoint()` result needs to become a durable row. */
118
+ export declare class SqliteRestorePointsRepo implements CreateRestorePointRepoPort {
119
+ private readonly deps;
120
+ constructor(deps: RestorePointsRepoDeps);
121
+ /** REQ-05 (recovery) / REQ-22 (database) — persists one `restore_points` row. */
122
+ save(row: {
123
+ restorePointId: string;
124
+ idempotencyKey: string;
125
+ trigger: string;
126
+ createdAt: string;
127
+ createdBy: string;
128
+ costClass?: string;
129
+ kind?: string;
130
+ artifactRef?: string;
131
+ watermarkAtCapture?: number | null;
132
+ capturedSchemaVersion?: number | null;
133
+ capturedSchemaTag?: string | null;
134
+ }): Promise<void>;
135
+ /** Row/file deletion stays in this repository; generic policy never learns the journal's schema.
136
+ * @complexity O(n log n) restore rows, plus two bounded-shape reference queries and one delete per expired row. */
137
+ private pruneCopies;
138
+ /** AC-11 (recovery) — `(site_id, idempotency_key)` single-row lookup. */
139
+ findByIdempotencyKey(key: string): Promise<{
140
+ restorePointId: string;
141
+ idempotencyKey: string;
142
+ } | null>;
143
+ /** Newest-first restore-point listing for the Recovery screen / Timeline. */
144
+ list(): Promise<Array<{
145
+ id: string;
146
+ trigger: string;
147
+ costClass: string;
148
+ kind: string;
149
+ watermarkAtCapture: number | null;
150
+ createdAt: string;
151
+ artifactRef: string;
152
+ }>>;
153
+ }
154
+ //# sourceMappingURL=journal-repo.sql.d.ts.map