@pgxsinkit/client 0.1.32 → 0.1.40
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/README.md +11 -0
- package/dist/boot-report.d.ts +134 -0
- package/dist/boot-report.d.ts.map +1 -0
- package/dist/convergence.d.ts +76 -0
- package/dist/convergence.d.ts.map +1 -0
- package/dist/debug.d.ts +34 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/export-data.d.ts +100 -0
- package/dist/export-data.d.ts.map +1 -0
- package/dist/export-dump.d.ts +92 -0
- package/dist/export-dump.d.ts.map +1 -0
- package/dist/export-store.d.ts +214 -0
- package/dist/export-store.d.ts.map +1 -0
- package/dist/index.d.ts +615 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8083 -2286
- package/dist/index.js.map +81 -44
- package/dist/lazy-guard.d.ts +59 -0
- package/dist/lazy-guard.d.ts.map +1 -0
- package/dist/lifecycle-slot.d.ts +31 -0
- package/dist/lifecycle-slot.d.ts.map +1 -0
- package/dist/live-rows-sql.d.ts +21 -0
- package/dist/live-rows-sql.d.ts.map +1 -0
- package/dist/local-store.d.ts +56 -0
- package/dist/local-store.d.ts.map +1 -0
- package/dist/local-tables.d.ts +707 -0
- package/dist/local-tables.d.ts.map +1 -0
- package/dist/mutation-state.d.ts +69 -0
- package/dist/mutation-state.d.ts.map +1 -0
- package/dist/mutation.d.ts +129 -4
- package/dist/mutation.d.ts.map +1 -1
- package/dist/schema.d.ts +82 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/shape-sync.d.ts +190 -0
- package/dist/shape-sync.d.ts.map +1 -0
- package/dist/store-path.d.ts +132 -0
- package/dist/store-path.d.ts.map +1 -0
- package/dist/sync/apply.d.ts +51 -0
- package/dist/sync/apply.d.ts.map +1 -0
- package/dist/sync/copy.d.ts +43 -0
- package/dist/sync/copy.d.ts.map +1 -0
- package/dist/sync/drizzle-executor.d.ts +5 -0
- package/dist/sync/drizzle-executor.d.ts.map +1 -0
- package/dist/sync/index.d.ts +32 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/metadata-tables.d.ts +131 -0
- package/dist/sync/metadata-tables.d.ts.map +1 -0
- package/dist/sync/nudge.d.ts +49 -0
- package/dist/sync/nudge.d.ts.map +1 -0
- package/dist/sync/shape-inbox.d.ts +215 -0
- package/dist/sync/shape-inbox.d.ts.map +1 -0
- package/dist/sync/subscription-state.d.ts +39 -0
- package/dist/sync/subscription-state.d.ts.map +1 -0
- package/dist/sync/tags.d.ts +130 -0
- package/dist/sync/tags.d.ts.map +1 -0
- package/dist/sync/types.d.ts +126 -0
- package/dist/sync/types.d.ts.map +1 -0
- package/dist/sync-auth.d.ts +53 -0
- package/dist/sync-auth.d.ts.map +1 -0
- package/dist/testing.d.ts +27 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +17 -0
- package/dist/testing.js.map +11 -0
- package/dist/worker/attach-sync-client.d.ts +96 -0
- package/dist/worker/attach-sync-client.d.ts.map +1 -0
- package/dist/worker/define-sync-worker.d.ts +76 -0
- package/dist/worker/define-sync-worker.d.ts.map +1 -0
- package/dist/worker/live-diff.d.ts +44 -0
- package/dist/worker/live-diff.d.ts.map +1 -0
- package/dist/worker/protocol.d.ts +341 -0
- package/dist/worker/protocol.d.ts.map +1 -0
- package/dist/worker/token-cache.d.ts +26 -0
- package/dist/worker/token-cache.d.ts.map +1 -0
- package/oxlint-plugin.js +143 -0
- package/package.json +20 -7
- package/skills/core/SKILL.md +210 -0
- package/skills/operating/SKILL.md +303 -0
- package/src/boot-report.ts +287 -0
- package/src/convergence.ts +197 -0
- package/src/debug.ts +151 -0
- package/src/export-data.ts +300 -0
- package/src/export-dump.ts +239 -0
- package/src/export-store.ts +309 -0
- package/src/index.ts +1652 -51
- package/src/lazy-guard.ts +135 -0
- package/src/lifecycle-slot.ts +66 -0
- package/src/live-rows-sql.ts +45 -0
- package/src/local-store.ts +193 -0
- package/src/local-tables.ts +546 -0
- package/src/mutation-state.ts +99 -0
- package/src/mutation.ts +1910 -562
- package/src/schema.ts +472 -28
- package/src/shape-sync.ts +498 -0
- package/src/store-path.ts +249 -0
- package/src/sync/apply.ts +530 -0
- package/src/sync/copy.ts +206 -0
- package/src/sync/drizzle-executor.ts +48 -0
- package/src/sync/index.ts +1087 -0
- package/src/sync/metadata-tables.ts +67 -0
- package/src/sync/nudge.ts +110 -0
- package/src/sync/shape-inbox.ts +566 -0
- package/src/sync/subscription-state.ts +135 -0
- package/src/sync/tags.ts +365 -0
- package/src/sync/types.ts +141 -0
- package/src/sync-auth.ts +117 -0
- package/src/testing.ts +53 -0
- package/src/worker/attach-sync-client.ts +653 -0
- package/src/worker/define-sync-worker.ts +762 -0
- package/src/worker/live-diff.ts +140 -0
- package/src/worker/protocol.ts +425 -0
- package/src/worker/token-cache.ts +84 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-tables.d.ts","sourceRoot":"","sources":["../src/local-tables.ts"],"names":[],"mappings":"AAEA,OAAO,EAYL,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAgH9B,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AM,SAAS,GACjC,aAAa,CA8Bf;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,SAAS,iBAAiB,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,SAAS,EACzG,QAAQ,EAAE,SAAS,EACnB,QAAQ,EAAE,IAAI,GACb,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAoBhC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,qGAAqG;IACrG,KAAK,EAAE,UAAU,CAAC;IAClB,uFAAuF;IACvF,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACvC,qGAAqG;IACrG,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,+FAA+F;IAC/F,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,iGAAiG;IACjG,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B;;;;OAIG;IACH,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC,CAAC;CACxE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,SAAS,iBAAiB,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,SAAS,EAC3G,QAAQ,EAAE,SAAS,EACnB,QAAQ,EAAE,IAAI,GACb,WAAW,CAkBb;AAED,+FAA+F;AAC/F,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,cAAc,CAY7E"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The mutation-journal state machine (ADR-0005, extended by ADR-0006).
|
|
3
|
+
*
|
|
4
|
+
* The runtime is large; previously the legal status transitions were implicit,
|
|
5
|
+
* scattered across SQL writes. This is the one named place that defines them, so the
|
|
6
|
+
* rules are testable and a future change extends a single table. ADR-0006 splits the
|
|
7
|
+
* old single `failed` into transient (retryable `failed`) and permanent (`quarantined`).
|
|
8
|
+
*/
|
|
9
|
+
export type MutationStatus = "pending" | "sending" | "acked" | "failed" | "quarantined" | "conflicted" | "rejected";
|
|
10
|
+
/**
|
|
11
|
+
* Legal transitions. `acked` is terminal at the journal level — it is cleared by
|
|
12
|
+
* reconciliation once the synced echo reaches the acknowledged server timestamp, not
|
|
13
|
+
* by another status transition. `quarantined` is terminal too: the server will never
|
|
14
|
+
* accept the mutation as-is, so it is surfaced (callback + diagnostics), never retried.
|
|
15
|
+
* `conflicted` (ADR-0015) is likewise terminal but a *different* outcome: the write was
|
|
16
|
+
* well-formed but **stale** (an external write interleaved) and the table's `reject-if-stale`
|
|
17
|
+
* policy declined it. The optimistic Overlay is KEPT (the user's edit is not lost) and the
|
|
18
|
+
* conflict is surfaced via `onConflict`; resolution is an ordinary NEW mutation, and `discard`
|
|
19
|
+
* clears the overlay + this entry. It is never retried as-is (the base would still be stale).
|
|
20
|
+
* `rejected` (ADR-0022) is terminal as well, and the inverse of `conflicted` on disposition: the
|
|
21
|
+
* authoritative endpoint declined the whole pessimistic write-**unit** for a business reason (a
|
|
22
|
+
* capacity/quota/uniqueness rule the client could not evaluate locally), so the optimistic Overlay
|
|
23
|
+
* is **auto-discarded** for every member of the unit and the typed reason is surfaced via `onReject`.
|
|
24
|
+
* Never retried (the server's answer is authoritative).
|
|
25
|
+
*
|
|
26
|
+
* - `pending -> sending` a flush claims the row and posts it.
|
|
27
|
+
* - `sending -> acked` the server acknowledged the mutation.
|
|
28
|
+
* - `sending -> failed` transient transport/server error (network, 5xx, …).
|
|
29
|
+
* - `sending -> quarantined` structural 4xx rejection the server will never accept.
|
|
30
|
+
* - `sending -> conflicted` a stale write the reject-if-stale policy declined (ADR-0015).
|
|
31
|
+
* - `sending -> rejected` a business rejection from the authoritative endpoint (ADR-0022).
|
|
32
|
+
* - `sending -> pending` recoverSending re-queues an in-flight row on startup.
|
|
33
|
+
* - `pending -> quarantined` a RESTORE boot quarantines every non-terminal row recovered from a
|
|
34
|
+
* backup (ADR-0035 decision 6). A `pending` row is normally only ever claimed (`-> sending`), but a
|
|
35
|
+
* store restored from a backup must NOT auto-flush anything it recovered — the write path has no
|
|
36
|
+
* `mutationId` dedupe ledger, so replaying a recovered `pending`/`sending`/`failed` mutation is unsafe
|
|
37
|
+
* (silent last-write-wins reverts, create PK collisions). Restore is therefore the ONE producer of this
|
|
38
|
+
* edge; ordinary boots never move a `pending` row straight to `quarantined`.
|
|
39
|
+
* - `failed -> pending` retryFailed re-queues a failed row.
|
|
40
|
+
* - `failed -> quarantined` the hard max-attempts cap is reached; stop retrying (also the restore
|
|
41
|
+
* quarantine of a recovered `failed` row, ADR-0035 decision 6 — the edge already existed).
|
|
42
|
+
*/
|
|
43
|
+
export declare const MUTATION_TRANSITIONS: {
|
|
44
|
+
readonly pending: readonly ["sending", "quarantined"];
|
|
45
|
+
readonly sending: readonly ["acked", "failed", "quarantined", "conflicted", "rejected", "pending"];
|
|
46
|
+
readonly failed: readonly ["pending", "quarantined"];
|
|
47
|
+
readonly quarantined: readonly [];
|
|
48
|
+
readonly conflicted: readonly [];
|
|
49
|
+
readonly rejected: readonly [];
|
|
50
|
+
readonly acked: readonly [];
|
|
51
|
+
};
|
|
52
|
+
export declare function isValidMutationTransition(from: MutationStatus, to: MutationStatus): boolean;
|
|
53
|
+
export declare function assertValidMutationTransition(from: MutationStatus, to: MutationStatus): void;
|
|
54
|
+
/**
|
|
55
|
+
* The hard cap on send attempts (ADR-0005 congestion policy). A mutation that has
|
|
56
|
+
* failed this many times — even with transient-looking errors — is given up on and
|
|
57
|
+
* quarantined, so a permanently-unreachable server never produces an unbounded retry
|
|
58
|
+
* loop. The consumer can raise/lower it via `createSyncClient({ maxMutationAttempts })`.
|
|
59
|
+
*/
|
|
60
|
+
export declare const DEFAULT_MAX_MUTATION_ATTEMPTS = 10;
|
|
61
|
+
/**
|
|
62
|
+
* Classify a flush failure into its durable journal state (ADR-0006 decision 4):
|
|
63
|
+
* - `quarantined` (terminal): a structural 4xx rejection — retrying is pointless, so it
|
|
64
|
+
* is surfaced rather than retry-looped (the silent-data-loss case the runtime *can*
|
|
65
|
+
* catch at send time).
|
|
66
|
+
* - `failed` (retryable): network/transport (no status), any 5xx, or a transient 4xx.
|
|
67
|
+
*/
|
|
68
|
+
export declare function classifyFailureStatus(httpStatus: number | null | undefined): "failed" | "quarantined";
|
|
69
|
+
//# sourceMappingURL=mutation-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation-state.d.ts","sourceRoot":"","sources":["../src/mutation-state.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,aAAa,GAAG,YAAY,GAAG,UAAU,CAAC;AAEpH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;CAUqC,CAAC;AAEvE,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,cAAc,GAAG,OAAO,CAE3F;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,cAAc,GAAG,IAAI,CAI5F;AAED;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAShD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,GAAG,aAAa,CAUrG"}
|
package/dist/mutation.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import type { MutationDiagnostics, SyncTableCreateInput, SyncTableName, SyncTableRecord, SyncTableRegistry, SyncTableUpdateInput } from "@pgxsinkit/contracts";
|
|
2
|
-
|
|
1
|
+
import type { MutationAck, MutationDiagnostics, SyncTableCreateInput, SyncTableName, SyncTableRecord, SyncTableRegistry, SyncTableUpdateInput, WriteMode } from "@pgxsinkit/contracts";
|
|
2
|
+
import { type MutationStatus } from "./mutation-state";
|
|
3
|
+
export type { MutationStatus } from "./mutation-state";
|
|
3
4
|
export type MutationKind = "create" | "update" | "delete";
|
|
5
|
+
/**
|
|
6
|
+
* The dynamic write-unit tag (ADR-0022 §2) a `transaction({ mode })` block stamps onto the mutations
|
|
7
|
+
* authored within it: a shared `id` grouping the co-committed mutations, and the unit's `mode`. Persisted
|
|
8
|
+
* on each journal row (`write_unit` / `write_mode`); absent for the default path, where the flusher derives
|
|
9
|
+
* mode + unit from the table's static consistency group.
|
|
10
|
+
*/
|
|
11
|
+
export interface WriteUnit {
|
|
12
|
+
id: string;
|
|
13
|
+
mode: WriteMode;
|
|
14
|
+
}
|
|
4
15
|
export type MutationBatchItem<TRegistry extends SyncTableRegistry> = {
|
|
5
16
|
[TKey in SyncTableName<TRegistry>]: {
|
|
6
17
|
table: TKey;
|
|
@@ -11,6 +22,13 @@ export type MutationBatchItem<TRegistry extends SyncTableRegistry> = {
|
|
|
11
22
|
kind: "update";
|
|
12
23
|
entityKey: Record<string, string>;
|
|
13
24
|
patch: SyncTableUpdateInput<TRegistry, TKey>;
|
|
25
|
+
/**
|
|
26
|
+
* A **blind** update (ADR-0022 addendum): plan a journal row ONLY — no local base row is required
|
|
27
|
+
* and no optimistic overlay is written. Set exclusively by the transaction handle's `updateBlind`;
|
|
28
|
+
* valid only when the write routes pessimistically (a `pessimistic` unit, or a statically-pessimistic
|
|
29
|
+
* table), and rejected at enqueue otherwise. Absent/false for an ordinary update.
|
|
30
|
+
*/
|
|
31
|
+
blind?: boolean;
|
|
14
32
|
} | {
|
|
15
33
|
table: TKey;
|
|
16
34
|
kind: "delete";
|
|
@@ -32,6 +50,8 @@ export interface MutationDetail {
|
|
|
32
50
|
nextRetryAtUs: string | null;
|
|
33
51
|
serverUpdatedAtUs: string | null;
|
|
34
52
|
updatedAtUs: string;
|
|
53
|
+
/** Registry fingerprint (ADR-0004) the mutation was authored under, or null if unstamped. */
|
|
54
|
+
registryVersion: string | null;
|
|
35
55
|
}
|
|
36
56
|
export interface MutationDb {
|
|
37
57
|
exec: (sql: string) => Promise<unknown>;
|
|
@@ -44,22 +64,127 @@ export interface CreateMutationRuntimeOptions<TRegistry extends SyncTableRegistr
|
|
|
44
64
|
registry: TRegistry;
|
|
45
65
|
writeUrl: string;
|
|
46
66
|
getAuthToken?: () => Promise<string | undefined>;
|
|
67
|
+
/** Static headers added to every write request (e.g. a Supabase Cloud `apikey`); see {@link CreateSyncClientOptions.requestHeaders}. */
|
|
68
|
+
requestHeaders?: Record<string, string>;
|
|
69
|
+
/**
|
|
70
|
+
* Registry fingerprint (ADR-0004) stamped onto each enqueued mutation as its
|
|
71
|
+
* `registry_version`, so a version-boundary crossing is known before sending (ADR-0006).
|
|
72
|
+
*/
|
|
73
|
+
registryVersion?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Hard cap on send attempts before a still-failing mutation is quarantined
|
|
76
|
+
* (ADR-0005 congestion policy). Defaults to {@link DEFAULT_MAX_MUTATION_ATTEMPTS}.
|
|
77
|
+
*/
|
|
78
|
+
maxMutationAttempts?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Max mutations drained per flush HTTP request; a flush loops slices until the journal is empty.
|
|
81
|
+
* Defaults to {@link DEFAULT_FLUSH_BATCH_SIZE}. Primarily a test seam (a small value exercises the
|
|
82
|
+
* multi-slice drain path without enqueueing hundreds of mutations).
|
|
83
|
+
*/
|
|
84
|
+
flushBatchSize?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Invoked after a flush whenever mutations transition to `quarantined` (terminal,
|
|
87
|
+
* permanently rejected). Receives the newly-quarantined details so the app can surface
|
|
88
|
+
* them, then either re-author + resubmit or roll back via {@link MutationRuntime.discardQuarantined}
|
|
89
|
+
* (clears the kept overlay + quarantined journal rows, so the entity accepts new mutations again).
|
|
90
|
+
* The library never silently drops these (ADR-0006 decision 4).
|
|
91
|
+
*/
|
|
92
|
+
onQuarantine?: (quarantined: MutationDetail[]) => void | Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Invoked after a flush whenever mutations transition to `conflicted` — a stale write the
|
|
95
|
+
* server declined under the `reject-if-stale` Conflict policy (ADR-0015). Distinct from
|
|
96
|
+
* `onQuarantine` (structural rejection): the optimistic Overlay is KEPT, so the app surfaces a
|
|
97
|
+
* resolution/diff UI and resolves each as a new write (or `discardConflict`s it). Never silent.
|
|
98
|
+
*/
|
|
99
|
+
onConflict?: (conflicted: MutationDetail[]) => void | Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Invoked after an authoritative (pessimistic) flush whenever a write-unit was `rejected` (ADR-0022) —
|
|
102
|
+
* a business decline the client could not evaluate locally (capacity/quota/uniqueness). The inverse of
|
|
103
|
+
* `onConflict`: the optimistic Overlay was **auto-discarded** for every member of the unit, so the app
|
|
104
|
+
* surfaces the typed reason (e.g. "full") rather than a resolve/diff UI. Never silent.
|
|
105
|
+
*/
|
|
106
|
+
onReject?: (rejected: MutationDetail[]) => void | Promise<void>;
|
|
47
107
|
}
|
|
48
108
|
export interface MutationRuntime<TRegistry extends SyncTableRegistry> {
|
|
109
|
+
/** The registry fingerprint (ADR-0004) this runtime stamps onto enqueued mutations. */
|
|
110
|
+
registryVersion: string;
|
|
49
111
|
create: <TKey extends SyncTableName<TRegistry>>(table: TKey, input: SyncTableCreateInput<TRegistry, TKey>) => Promise<void>;
|
|
50
112
|
update: <TKey extends SyncTableName<TRegistry>>(table: TKey, entityKey: Record<string, string>, patch: SyncTableUpdateInput<TRegistry, TKey>) => Promise<void>;
|
|
51
113
|
delete: <TKey extends SyncTableName<TRegistry>>(table: TKey, entityKey: Record<string, string>) => Promise<void>;
|
|
52
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Enqueue an atomic batch of mutations. An optional {@link WriteUnit} tags every row of the batch as one
|
|
116
|
+
* dynamic write-unit (ADR-0022 §2) — the `transaction({ mode })` block passes it; the per-table
|
|
117
|
+
* `create`/`update`/`delete` helpers do not (their write-mode comes from the static group at flush).
|
|
118
|
+
*/
|
|
119
|
+
batch: (items: ReadonlyArray<MutationBatchItem<TRegistry>>, unit?: WriteUnit) => Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Discard a `conflicted` entity (ADR-0015): clear its conflicted journal entries and the kept
|
|
122
|
+
* optimistic Overlay, so the Read model falls back to the synced (server) value. Use when the user
|
|
123
|
+
* abandons their stale edit instead of resolving it as a new write. No-op for an entity with no
|
|
124
|
+
* conflicted entry.
|
|
125
|
+
*/
|
|
126
|
+
discardConflict: <TKey extends SyncTableName<TRegistry>>(table: TKey, entityKey: Record<string, string>) => Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* Discard a `quarantined` entity (ADR-0006): clear its quarantined journal entries and the kept
|
|
129
|
+
* optimistic Overlay, so the Read model falls back to the synced (server) value and the entity
|
|
130
|
+
* accepts new mutations again. The rollback path for a permanently-rejected write (e.g. an RLS
|
|
131
|
+
* policy denial routed to quarantine). Symmetric to {@link discardConflict}. No-op for an entity
|
|
132
|
+
* with no quarantined entry; the overlay is kept when another still-owed write depends on it.
|
|
133
|
+
*/
|
|
134
|
+
discardQuarantined: <TKey extends SyncTableName<TRegistry>>(table: TKey, entityKey: Record<string, string>) => Promise<void>;
|
|
53
135
|
flush: (table?: SyncTableName<TRegistry>) => Promise<void>;
|
|
136
|
+
/**
|
|
137
|
+
* Flush one pessimistic write-unit (ADR-0022) to the authoritative endpoint and apply its per-mutation
|
|
138
|
+
* result inline: `acked` clears via the synced echo, `conflicted` keeps the overlay (surfaced), and
|
|
139
|
+
* `rejected` auto-discards the overlay for the whole unit (surfaced via `onReject`). A foreground
|
|
140
|
+
* operation — it resolves once the server has decided. Throws on transport failure (the overlay is kept
|
|
141
|
+
* for a retry). Returns the server acks. Used by the client `transaction({ mode: "pessimistic" })` block.
|
|
142
|
+
*/
|
|
143
|
+
flushUnit: (unitId: string) => Promise<{
|
|
144
|
+
acks: MutationAck[];
|
|
145
|
+
}>;
|
|
54
146
|
reconcile: (table?: SyncTableName<TRegistry>) => Promise<void>;
|
|
55
147
|
retryFailed: (table?: SyncTableName<TRegistry>) => Promise<void>;
|
|
56
148
|
recoverSending: (table?: SyncTableName<TRegistry>) => Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Quarantine EVERY non-terminal journal row recovered from a backup (`pending`/`sending`/`failed` →
|
|
151
|
+
* `quarantined`) — the restore-boot rule (ADR-0035 decision 6). Nothing recovered from a store backup
|
|
152
|
+
* may ever auto-flush: the write path keeps `mutationId` in `operations_log` but never consults it, so
|
|
153
|
+
* there is no dedupe ledger, and a replayed mutation would silently re-apply stale values over newer
|
|
154
|
+
* writes on a last-write-wins table (and a replayed create collides on its PK). Terminal states
|
|
155
|
+
* (`acked`/`conflicted`/`rejected`) are left untouched. Run ONCE, on the restore boot only, AFTER
|
|
156
|
+
* `recoverSending` (which first lifts any `sending` back to `pending`); the app then inspects
|
|
157
|
+
* `diagnostics()` and resolves each row via `discardQuarantined` (quarantine is terminal — "release"
|
|
158
|
+
* means discard and re-author as a new mutation) before going online. A no-op on a clean journal.
|
|
159
|
+
*/
|
|
160
|
+
quarantineRecovered: (table?: SyncTableName<TRegistry>) => Promise<void>;
|
|
57
161
|
readMutationStats: (table?: SyncTableName<TRegistry>) => Promise<MutationDiagnostics>;
|
|
58
162
|
readMutationDetails: (table?: SyncTableName<TRegistry>) => Promise<MutationDetail[]>;
|
|
59
163
|
createOptimisticRecord: <TKey extends SyncTableName<TRegistry>>(table: TKey, input: SyncTableCreateInput<TRegistry, TKey>) => SyncTableRecord<TRegistry, TKey>;
|
|
60
164
|
}
|
|
61
165
|
export declare function nowMicroseconds(): string;
|
|
166
|
+
/**
|
|
167
|
+
* Best-effort decode of a JWT's claims payload, for stamping `authClaim` managed fields into the
|
|
168
|
+
* optimistic overlay (the value the server will independently stamp from the same claim path). This is
|
|
169
|
+
* **not** a verification — the token is trusted only for a local, optimistic projection that the server
|
|
170
|
+
* re-stamps authoritatively on apply; a forged claim could never make the server attribute the row
|
|
171
|
+
* differently. Returns `undefined` for a malformed token.
|
|
172
|
+
*/
|
|
173
|
+
export declare function decodeJwtClaims(token: string): Record<string, unknown> | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* Read a claim at a JSON path out of a decoded claims object, returning it as a string (the form the
|
|
176
|
+
* optimistic overlay column expects, mirroring the server's `jsonb #>>` text extraction). Returns
|
|
177
|
+
* `undefined` if the path is absent or the leaf is not a string/number.
|
|
178
|
+
*/
|
|
179
|
+
export declare function readJwtClaimPath(claims: Record<string, unknown>, claimPath: string[]): string | undefined;
|
|
62
180
|
export declare function computeBackoffDelayMs(attemptCount: number): number;
|
|
63
|
-
|
|
181
|
+
/**
|
|
182
|
+
* Retry delay with equal jitter around the {@link computeBackoffDelayMs} ceiling: half
|
|
183
|
+
* the ceiling plus a random share of the other half. Spreads retries so a fleet of
|
|
184
|
+
* clients does not stampede the server in lockstep after an outage (ADR-0005 congestion
|
|
185
|
+
* policy). `random` is injectable for deterministic tests.
|
|
186
|
+
*/
|
|
187
|
+
export declare function computeRetryDelayMs(attemptCount: number, random?: () => number): number;
|
|
188
|
+
export declare function computeNextRetryAtUs(nowUs: string, attemptCount: number, random?: () => number): string;
|
|
64
189
|
export declare function createMutationRuntime<TRegistry extends SyncTableRegistry>(options: CreateMutationRuntimeOptions<TRegistry>): MutationRuntime<TRegistry>;
|
|
65
190
|
//# sourceMappingURL=mutation.d.ts.map
|
package/dist/mutation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutation.d.ts","sourceRoot":"","sources":["../src/mutation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mutation.d.ts","sourceRoot":"","sources":["../src/mutation.ts"],"names":[],"mappings":"AA0EA,OAAO,KAAK,EAEV,WAAW,EACX,mBAAmB,EAEnB,oBAAoB,EAEpB,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,oBA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C,SAAS,CAAC,EAC5D,KAAK,EAAE,IAAI,EACX,KAAK,EAAE,oBAAoB,CAAC,SAAS,EAAE,IAAI,CAAC,KACzC,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;CACvC;AAED,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAelF;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAYzG;AAED,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,UAGzD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,MAAoB,UAG3F;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,MAAoB,UAE3G;AAED,wBAAgB,qBAAqB,CAAC,SAAS,SAAS,iBAAiB,EACvE,OAAO,EAAE,4BAA4B,CAAC,SAAS,CAAC,GAC/C,eAAe,CAAC,SAAS,CAAC,CAy3B5B"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,3 +1,85 @@
|
|
|
1
|
+
import { type AnyPgTable } from "drizzle-orm/pg-core";
|
|
1
2
|
import { type SyncTableRegistry } from "@pgxsinkit/contracts";
|
|
3
|
+
/**
|
|
4
|
+
* Local key/value metadata table. Holds the registry fingerprint the local store was
|
|
5
|
+
* provisioned under (ADR-0006), so a registry change is detected on boot and the read
|
|
6
|
+
* cache is rebuilt — rather than relying on a hand-bumped `idb://…-vN` suffix.
|
|
7
|
+
*/
|
|
8
|
+
export declare const LOCAL_META_TABLE = "pgxsinkit_local_meta";
|
|
9
|
+
export declare const REGISTRY_FINGERPRINT_KEY = "registry_fingerprint";
|
|
2
10
|
export declare function generateLocalSchemaSql<TRegistry extends SyncTableRegistry>(registry: TRegistry): string;
|
|
11
|
+
/**
|
|
12
|
+
* Render `CREATE TABLE IF NOT EXISTS` (plus a `CREATE INDEX IF NOT EXISTS` per declared index) for a
|
|
13
|
+
* Drizzle `pgTable` / `pgSchema.table`, through the SAME column/PK/type machinery
|
|
14
|
+
* ({@link buildTableColumnSql} → {@link buildColumnDefinition} → {@link mapColumnType}) that
|
|
15
|
+
* {@link generateLocalSchemaSql} uses for every other local relation. The table is schema-qualified
|
|
16
|
+
* when it declares a schema and bare otherwise (per the table object). Column types come from each
|
|
17
|
+
* column's `getSQLType()`, NOT NULL and single-column PRIMARY KEY inline, composite PKs as a trailing
|
|
18
|
+
* clause. Enum column types are qualified into the table's own schema — the metadata pgTables carry
|
|
19
|
+
* none, but the path is shared with the local-store generator so it must stay honest.
|
|
20
|
+
*
|
|
21
|
+
* ADR-0029 D3: the metadata-store DDL renders from its `metadata-tables.ts` pgTables through this,
|
|
22
|
+
* making the pgTable the single source. The OUTPUT is tier-③-by-nature runtime DDL (schema/table
|
|
23
|
+
* identifiers assembled at construction), but it is GENERATED from the model, never hand-maintained.
|
|
24
|
+
*/
|
|
25
|
+
export declare function renderCreateTableSql(table: AnyPgTable): string[];
|
|
26
|
+
/**
|
|
27
|
+
* The `-t` allowlist for a Data export (ADR-0035 decision 1): the schema-qualified PHYSICAL synced table
|
|
28
|
+
* name for every registry entry that owns one, resolved through the SAME `getClientProjection` the local
|
|
29
|
+
* DDL generator uses — NOT re-derived by string convention. This is deliberately the physical `syncedTable`,
|
|
30
|
+
* never the read-model view (whose name can carry the entry name while the table differs): `-t` must target
|
|
31
|
+
* the tables that hold the rows. Read-projection and ephemeral entries are excluded (see
|
|
32
|
+
* {@link ownsPersistentSyncedTable}).
|
|
33
|
+
*/
|
|
34
|
+
export declare function collectDataExportSyncedTableNames<TRegistry extends SyncTableRegistry>(registry: TRegistry): string[];
|
|
35
|
+
/**
|
|
36
|
+
* The clone-cleanup SQL a Data export runs on its THROWAWAY clone before `pg_dump -t` (ADR-0035). The
|
|
37
|
+
* reconcile trigger sits ON the synced table (`AFTER INSERT/UPDATE/DELETE ON <syncedTable>`), so
|
|
38
|
+
* `pg_dump -t <syncedTable>` pulls the trigger into the dump — but its function is pgxsinkit machinery the
|
|
39
|
+
* data export deliberately EXCLUDES, so the artefact would carry a trigger referencing a missing function
|
|
40
|
+
* and fail to load into a vanilla Postgres. Because the clone is a memory-backed throwaway we fully own, we
|
|
41
|
+
* drop each reconcile trigger (and its now-unreferenced function) on it first, so `-t` yields clean,
|
|
42
|
+
* portable tables. Overlay/journal/views/metadata are NOT captured by `-t <syncedTable>` at all (a probe
|
|
43
|
+
* confirmed only the table, its PK, its data, and this trigger appear), so nothing else needs dropping.
|
|
44
|
+
* Returns `""` when the registry declares no writable owning table.
|
|
45
|
+
*/
|
|
46
|
+
export declare function buildDataExportCloneCleanupSql<TRegistry extends SyncTableRegistry>(registry: TRegistry): string;
|
|
47
|
+
/**
|
|
48
|
+
* The enum DDL header for a Data export artefact (ADR-0035 decision 1). `pg_dump -t <table>` emits the
|
|
49
|
+
* tables but NOT the enum types their columns reference, so the portable artefact is this generated header
|
|
50
|
+
* concatenated ahead of the `pg_dump` output. It reuses the SAME `CREATE TYPE` generation the local-schema
|
|
51
|
+
* generator emits ({@link buildCreateEnumTypeSql}) — every enum wrapped in an idempotent `IF NOT EXISTS`
|
|
52
|
+
* guard — restricted to the enums actually referenced by the exported (owning, persistent) tables, so a
|
|
53
|
+
* dropped/ephemeral-only enum never bloats the artefact. When the registry uses a non-`public` schema, a
|
|
54
|
+
* `CREATE SCHEMA IF NOT EXISTS` precedes the types (they live in that schema, and the header runs before
|
|
55
|
+
* `pg_dump`'s own schema creation), so the header is self-contained against a bare Postgres. Returns `""`
|
|
56
|
+
* when no exported table references an enum.
|
|
57
|
+
*/
|
|
58
|
+
export declare function buildDataExportEnumHeaderSql<TRegistry extends SyncTableRegistry>(registry: TRegistry): string;
|
|
59
|
+
/**
|
|
60
|
+
* Drop the reconstructible **read cache** — the synced tables and their read-model views
|
|
61
|
+
* and reconcile triggers/functions — while preserving the authority tables (overlay,
|
|
62
|
+
* journal, the local-meta table). Re-running {@link generateLocalSchemaSql} then rebuilds
|
|
63
|
+
* the synced tables at the current shape, and a re-sync refills them (ADR-0006). This is
|
|
64
|
+
* the named drop primitive a returning-online upgrade uses after a clean drain.
|
|
65
|
+
*/
|
|
66
|
+
export declare function buildDropReadCacheSql<TRegistry extends SyncTableRegistry>(registry: TRegistry): string;
|
|
67
|
+
/**
|
|
68
|
+
* Wipe the **entire** local store provisioned from the registry — the read cache plus the
|
|
69
|
+
* authority tables (overlay, journal, sequences), the enum types, and the local-meta row.
|
|
70
|
+
* This is the full teardown reused by `destroy()` (ADR-0005 decision 5) and by the
|
|
71
|
+
* drain-then-drop upgrade once a clean drain has confirmed nothing is owed (ADR-0006).
|
|
72
|
+
*/
|
|
73
|
+
export declare function buildWipeLocalStoreSql<TRegistry extends SyncTableRegistry>(registry: TRegistry): string;
|
|
74
|
+
/**
|
|
75
|
+
* Clean-truncate a single table's local read cache so a desynced `lazy` relation (ADR-0021 §2) returns
|
|
76
|
+
* to an empty, dormant state: the synced table and — for a writable table — its optimistic overlay and
|
|
77
|
+
* the journal, plus a sequence restart. It does NOT drop the cluster (the table/views/trigger persist),
|
|
78
|
+
* so a later re-reference re-streams into it without a schema rebuild. Ephemeral-aware: bare/`pg_temp`
|
|
79
|
+
* names for an ephemeral cluster, schema-qualified for a persistent one — mirroring
|
|
80
|
+
* {@link generateLocalSchemaSql}. The caller (`desync`) first stops the group's stream (so nothing
|
|
81
|
+
* re-populates mid-truncate) and refuses when the journal owes unsettled writes (so this never drops
|
|
82
|
+
* un-acked local intent).
|
|
83
|
+
*/
|
|
84
|
+
export declare function buildDesyncTableSql<TRegistry extends SyncTableRegistry>(registry: TRegistry, tableKey: string): string;
|
|
3
85
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAErF,OAAO,EAUL,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAyB9B;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AACvD,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAI/D,wBAAgB,sBAAsB,CAAC,SAAS,SAAS,iBAAiB,EAAE,QAAQ,EAAE,SAAS,UAuO9F;AA0CD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,EAAE,CAchE;AAmLD;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAAC,SAAS,SAAS,iBAAiB,EAAE,QAAQ,EAAE,SAAS,GAAG,MAAM,EAAE,CAapH;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,8BAA8B,CAAC,SAAS,SAAS,iBAAiB,EAAE,QAAQ,EAAE,SAAS,GAAG,MAAM,CAgB/G;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAAC,SAAS,SAAS,iBAAiB,EAAE,QAAQ,EAAE,SAAS,GAAG,MAAM,CAyB7G;AAgHD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,SAAS,iBAAiB,EAAE,QAAQ,EAAE,SAAS,GAAG,MAAM,CAkBtG;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,SAAS,iBAAiB,EAAE,QAAQ,EAAE,SAAS,GAAG,MAAM,CA8BvG;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,SAAS,iBAAiB,EACrE,QAAQ,EAAE,SAAS,EACnB,QAAQ,EAAE,MAAM,GACf,MAAM,CAkCR"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import type { ExternalHeadersRecord } from "@electric-sql/client";
|
|
2
|
+
import type { PGliteInterface } from "@electric-sql/pglite";
|
|
3
|
+
import { type Retention, type SubscriptionTiming, type SyncConfigInput, type SyncTableRegistry } from "@pgxsinkit/contracts";
|
|
4
|
+
import type { BootStampCollector, GroupBootStamp } from "./boot-report";
|
|
5
|
+
import type { SyncNamespaceObj } from "./sync";
|
|
6
|
+
export interface ShapeSyncSpec {
|
|
7
|
+
electricUrl: string;
|
|
8
|
+
tableName: string;
|
|
9
|
+
schema?: string;
|
|
10
|
+
shapeKey: string;
|
|
11
|
+
primaryKey: string[];
|
|
12
|
+
electricTable?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Consistency group (ADR-0009 decision 2). Specs sharing a group sync on one `MultiShapeStream`
|
|
15
|
+
* and commit atomically. Absent → the table is its own singleton group keyed by its `shapeKey`.
|
|
16
|
+
*/
|
|
17
|
+
consistencyGroup?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Subscription timing (ADR-0021). Absent → `eager`. A `lazy` spec's group is held out of the eager
|
|
20
|
+
* boot set and started on demand via {@link StartConfiguredSyncResult.ensureGroupStarted}. A group's
|
|
21
|
+
* members all agree (registry-validated), so the group's timing is any member's.
|
|
22
|
+
*/
|
|
23
|
+
subscription?: SubscriptionTiming;
|
|
24
|
+
/**
|
|
25
|
+
* Retention (ADR-0021). Absent → `persistent`. Only a `persistent` `lazy` group is promoted to the
|
|
26
|
+
* eager set on activation (its activation is permanent across boots); an `ephemeral` group's activation
|
|
27
|
+
* is session-scoped by construction, so it is never promoted/persisted.
|
|
28
|
+
*/
|
|
29
|
+
retention?: Retention;
|
|
30
|
+
}
|
|
31
|
+
export interface ConfiguredShapeSyncSpec extends ShapeSyncSpec {
|
|
32
|
+
key: string;
|
|
33
|
+
}
|
|
34
|
+
export interface StartConfiguredSyncOptions {
|
|
35
|
+
syncConfig: SyncConfigInput;
|
|
36
|
+
/**
|
|
37
|
+
* The sync registry (ADR-0029 D1): the engine's sole per-table spec source. Each shape's `tableKey`
|
|
38
|
+
* (its `syncConfig` table key) resolves against it for the local table, PKs, apply strategy, and
|
|
39
|
+
* column types — no table-scoped fact is threaded from `syncConfig` into the engine.
|
|
40
|
+
*/
|
|
41
|
+
registry: SyncTableRegistry;
|
|
42
|
+
/**
|
|
43
|
+
* Shape request headers shared by every member shape. Values may be async functions resolved per
|
|
44
|
+
* request (ADR-0013) — the read-path `Authorization` token is one such function.
|
|
45
|
+
*/
|
|
46
|
+
shapeHeaders?: ExternalHeadersRecord;
|
|
47
|
+
onInitialSync?: () => void;
|
|
48
|
+
onTableInitialSync?: (tableKey: string) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Fresh-store prefetch overlap (ADR-0032 S4). When present, every EAGER group starts its shape streams
|
|
51
|
+
* and buffers their catch-up into the memory inbox immediately, gating all commits until this promise
|
|
52
|
+
* resolves — so the network catch-up overlaps the local boot phases (schema/journal/reconcile) instead
|
|
53
|
+
* of running after them. Set ONLY by `createSyncClient` on a provably-fresh store (its `freshStore`
|
|
54
|
+
* hint); absent → the sequential path. Passed straight through to the engine's `syncShapesToTables`.
|
|
55
|
+
*/
|
|
56
|
+
dbReady?: Promise<void>;
|
|
57
|
+
/** Commit-level error surfacing (ADR-0009 decision 5): a sync commit exhausted its retries. */
|
|
58
|
+
onSyncError?: (error: Error) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Notified when a shape hits an auth error (401/403) and the read path is retrying for a fresh
|
|
61
|
+
* token (ADR-0013 Phase 3). The runtime surfaces a distinct `auth-needed` status from this.
|
|
62
|
+
*/
|
|
63
|
+
onAuthError?: () => void;
|
|
64
|
+
/**
|
|
65
|
+
* Notified when a shape hits a NON-auth stream error (#4): a transient 5xx/429/network (retried) or
|
|
66
|
+
* a structural 4xx (stops the stream). The runtime surfaces a `degraded` status from this so it
|
|
67
|
+
* never silently believes the read path is live while it has actually stalled.
|
|
68
|
+
*/
|
|
69
|
+
onReadStreamError?: (error: Error) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Notified when a shape successfully delivers a batch — i.e. a fetch just succeeded (ADR-0013
|
|
72
|
+
* Phase 3). The runtime uses this to clear an `auth-needed`/`degraded` status once sync resumes.
|
|
73
|
+
*/
|
|
74
|
+
onSyncActivity?: () => void;
|
|
75
|
+
/**
|
|
76
|
+
* Consistency-group keys of `lazy` groups that were activated on a previous boot and persisted their
|
|
77
|
+
* activation flag (ADR-0021 §2 — `lazy + persistent` promotion). These join the eager boot set as if
|
|
78
|
+
* they were declared `eager`, so a once-activated durable lazy group resumes without re-evaluation.
|
|
79
|
+
* Computed by the caller from the local meta table (the sync engine does no DB read of its own).
|
|
80
|
+
*/
|
|
81
|
+
promotedGroups?: ReadonlySet<string>;
|
|
82
|
+
/**
|
|
83
|
+
* Invoked when a `persistent` `lazy` group is activated on demand (not promoted at boot), so the
|
|
84
|
+
* caller can persist its activation flag for the next boot (ADR-0021 §2). Never fired for an
|
|
85
|
+
* `ephemeral` group (its activation is session-scoped and leaves no durable trace).
|
|
86
|
+
*/
|
|
87
|
+
onLazyActivated?: (groupKey: string) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Invoked exactly once per consistency group the moment it becomes up-to-date (ADR-0032 decision 6 —
|
|
90
|
+
* per-group readiness). Fires for eager, promoted, and on-demand `lazy` groups alike, so a client can
|
|
91
|
+
* surface progressive per-group paint (and the worker bridge can fan a `groupReady` event to tabs)
|
|
92
|
+
* without the all-eager-groups `onInitialSync` gate. The matching promise is {@link StartConfiguredSyncResult.groupReady}.
|
|
93
|
+
*/
|
|
94
|
+
onGroupReady?: (groupKey: string) => void;
|
|
95
|
+
/**
|
|
96
|
+
* Boot observability (ADR-0034): opens a per-group accumulator (rows/requests/fetch/apply wall) for each
|
|
97
|
+
* EAGER + PROMOTED boot group, stamped by the engine as the group's stream chain delivers and applies. A
|
|
98
|
+
* lazy on-demand start gets none — so a lazily-activated-later group never enters (or mutates) the report.
|
|
99
|
+
* Absent → no boot instrumentation.
|
|
100
|
+
*/
|
|
101
|
+
bootCollector?: BootStampCollector;
|
|
102
|
+
}
|
|
103
|
+
type SyncEnginePGlite = PGliteInterface & {
|
|
104
|
+
electric: SyncNamespaceObj;
|
|
105
|
+
};
|
|
106
|
+
export interface ShapeSyncResult {
|
|
107
|
+
unsubscribe: () => void;
|
|
108
|
+
readonly isUpToDate: boolean;
|
|
109
|
+
}
|
|
110
|
+
export interface StartConfiguredSyncResult {
|
|
111
|
+
unsubscribe: () => void;
|
|
112
|
+
tables: Record<string, ShapeSyncResult>;
|
|
113
|
+
/**
|
|
114
|
+
* Start a `lazy` consistency group (ADR-0021) held out of the eager boot set. Idempotent and
|
|
115
|
+
* single-flight: concurrent calls share one start; a started, unknown, or eager group resolves
|
|
116
|
+
* immediately. Resolves once the group's initial sync completes — the seam the live-query layer
|
|
117
|
+
* calls on first reference to a lazy table. After it resolves, the group's member `tables` entries
|
|
118
|
+
* report `isUpToDate` live.
|
|
119
|
+
*/
|
|
120
|
+
ensureGroupStarted: (groupKey: string) => Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Stop a group's stream and return it to dormant (ADR-0021 §2): tear down its live subscription and
|
|
123
|
+
* clear the runtime so {@link isTableStarted} reports false again and a later {@link ensureGroupStarted}
|
|
124
|
+
* re-subscribes from scratch — the inverse of an on-demand activation. Used by the client's `desync`
|
|
125
|
+
* to halt a lazy group before truncating its read cache. A no-op for an unknown or never-started group.
|
|
126
|
+
* The temp cluster of an `ephemeral` group is NOT dropped here (that is the deferred idle-eviction); the
|
|
127
|
+
* cluster simply stops being fed.
|
|
128
|
+
*/
|
|
129
|
+
stopGroup: (groupKey: string) => void;
|
|
130
|
+
/** The consistency-group key a table belongs to — maps a queried table to its {@link ensureGroupStarted}. */
|
|
131
|
+
groupKeyForTable: (tableKey: string) => string | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* Whether a table's consistency group has started and completed its initial sync, so its reads are
|
|
134
|
+
* hydrated (ADR-0021). False for a `lazy` group still held out of the boot set. Drives the read-path
|
|
135
|
+
* tripwire — a lazy relation read while this is false would return empty/stale rows.
|
|
136
|
+
*/
|
|
137
|
+
isTableStarted: (tableKey: string) => boolean;
|
|
138
|
+
/**
|
|
139
|
+
* A promise that resolves the moment the given consistency group is up-to-date (ADR-0032 decision 6).
|
|
140
|
+
* Resolves immediately for an already-ready group; stays pending for a `lazy` group until it is
|
|
141
|
+
* activated (via {@link ensureGroupStarted}) and catches up. An unknown group resolves immediately
|
|
142
|
+
* (nothing to await). Per-group readiness the client re-exposes as `client.groupReady(table)`.
|
|
143
|
+
*/
|
|
144
|
+
groupReady: (groupKey: string) => Promise<void>;
|
|
145
|
+
/** Whether the given consistency group has completed its initial sync (synchronous peek at {@link groupReady}). */
|
|
146
|
+
isGroupReady: (groupKey: string) => boolean;
|
|
147
|
+
/** Every consistency-group key this config declares — the domain of {@link groupReady}/{@link isGroupReady}. */
|
|
148
|
+
groupKeys: () => string[];
|
|
149
|
+
}
|
|
150
|
+
export declare function buildShapeUrl(electricUrl: string, table: string): string;
|
|
151
|
+
export declare function buildShapeConfig(input: ShapeSyncSpec): {
|
|
152
|
+
shape: {
|
|
153
|
+
url: string;
|
|
154
|
+
};
|
|
155
|
+
table: string;
|
|
156
|
+
schema?: string;
|
|
157
|
+
primaryKey: string[];
|
|
158
|
+
shapeKey: string;
|
|
159
|
+
};
|
|
160
|
+
export declare function buildConfiguredShapeSpecs(input: SyncConfigInput): ConfiguredShapeSyncSpec[];
|
|
161
|
+
export declare function startConfiguredSync(pg: SyncEnginePGlite, input: StartConfiguredSyncOptions): Promise<StartConfiguredSyncResult>;
|
|
162
|
+
interface StartGroupSyncOptions {
|
|
163
|
+
groupKey: string;
|
|
164
|
+
specs: ConfiguredShapeSyncSpec[];
|
|
165
|
+
registry: SyncTableRegistry;
|
|
166
|
+
headers?: ExternalHeadersRecord;
|
|
167
|
+
/** Fresh-store prefetch overlap gate (ADR-0032 S4) — forwarded to the engine's `syncShapesToTables`. */
|
|
168
|
+
dbReady?: Promise<void>;
|
|
169
|
+
/** Boot observability (ADR-0034): the group's accumulator, stamped by the engine on delivery/apply. */
|
|
170
|
+
bootStamp?: GroupBootStamp;
|
|
171
|
+
onGroupInitialSync?: () => void;
|
|
172
|
+
onSyncError?: (error: Error) => void;
|
|
173
|
+
onAuthError?: () => void;
|
|
174
|
+
onReadStreamError?: (error: Error) => void;
|
|
175
|
+
onSyncActivity?: () => void;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Sync one consistency group on a single `MultiShapeStream` (ADR-0009 decision 2). All member
|
|
179
|
+
* shapes share the group's subscription key and commit atomically at a shared LSN frontier; each
|
|
180
|
+
* shape keeps its own apply strategy and column types (resolved per-shape inside the engine).
|
|
181
|
+
*/
|
|
182
|
+
export declare function startGroupSync(pg: SyncEnginePGlite, input: StartGroupSyncOptions): Promise<import("./sync").SyncShapesToTablesResult>;
|
|
183
|
+
/**
|
|
184
|
+
* The subscription key for a spec's consistency group (ADR-0009 decision 2): the explicit
|
|
185
|
+
* `consistencyGroup` when set, else the table's own `shapeKey` (a singleton group). One persisted
|
|
186
|
+
* subscription-state row exists per group key, so subscription reset enumerates these.
|
|
187
|
+
*/
|
|
188
|
+
export declare function groupSubscriptionKey(spec: Pick<ConfiguredShapeSyncSpec, "consistencyGroup" | "shapeKey">): string;
|
|
189
|
+
export {};
|
|
190
|
+
//# sourceMappingURL=shape-sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-sync.d.ts","sourceRoot":"","sources":["../src/shape-sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;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