@pgxsinkit/client 0.2.7 → 0.5.0
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/LICENSE +21 -0
- package/LICENSE-APACHE-2.0 +202 -0
- package/NOTICE +81 -0
- package/README.md +11 -3
- package/dist/boot-report.d.ts +11 -8
- package/dist/boot-report.d.ts.map +1 -1
- package/dist/circuits/envelope-to-change.d.ts +39 -0
- package/dist/circuits/envelope-to-change.d.ts.map +1 -0
- package/dist/circuits/group-sync.d.ts +123 -0
- package/dist/circuits/group-sync.d.ts.map +1 -0
- package/dist/circuits/shape-group.d.ts +77 -0
- package/dist/circuits/shape-group.d.ts.map +1 -0
- package/dist/circuits/stream-inbox.d.ts +126 -0
- package/dist/circuits/stream-inbox.d.ts.map +1 -0
- package/dist/circuits/stream-source.d.ts +96 -0
- package/dist/circuits/stream-source.d.ts.map +1 -0
- package/dist/circuits/subscription-client.d.ts +143 -0
- package/dist/circuits/subscription-client.d.ts.map +1 -0
- package/dist/circuits/sync-engine.d.ts +131 -0
- package/dist/circuits/sync-engine.d.ts.map +1 -0
- package/dist/debug.d.ts +0 -10
- package/dist/debug.d.ts.map +1 -1
- package/dist/event-lane.d.ts +32 -1
- package/dist/event-lane.d.ts.map +1 -1
- package/dist/export-data.d.ts +3 -3
- package/dist/export-dump.d.ts +9 -9
- package/dist/export-dump.d.ts.map +1 -1
- package/dist/export-store.d.ts +13 -13
- package/dist/index.d.ts +237 -113
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7037 -6665
- package/dist/index.js.map +46 -43
- package/dist/local-store.d.ts +1 -1
- package/dist/local-store.d.ts.map +1 -1
- package/dist/local-tables.d.ts +59 -1
- package/dist/local-tables.d.ts.map +1 -1
- package/dist/mutation.d.ts +2 -2
- package/dist/mutation.d.ts.map +1 -1
- package/dist/mutations-api.d.ts.map +1 -1
- package/dist/opfs-effects.d.ts +30 -2
- package/dist/opfs-effects.d.ts.map +1 -1
- package/dist/schema.d.ts +12 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/store-boot.d.ts +30 -2
- package/dist/store-boot.d.ts.map +1 -1
- package/dist/store-build.d.ts +19 -0
- package/dist/store-build.d.ts.map +1 -0
- package/dist/store-engine.d.ts +22 -0
- package/dist/store-engine.d.ts.map +1 -0
- package/dist/store-meta.d.ts +29 -3
- package/dist/store-meta.d.ts.map +1 -1
- package/dist/store-ownership-lock.d.ts +33 -0
- package/dist/store-ownership-lock.d.ts.map +1 -0
- package/dist/store-path.d.ts +40 -28
- package/dist/store-path.d.ts.map +1 -1
- package/dist/sync/apply.d.ts +17 -25
- package/dist/sync/apply.d.ts.map +1 -1
- package/dist/sync/copy.d.ts +84 -8
- package/dist/sync/copy.d.ts.map +1 -1
- package/dist/sync/drizzle-executor.d.ts +4 -4
- package/dist/sync/drizzle-executor.d.ts.map +1 -1
- package/dist/sync/fold.d.ts +40 -0
- package/dist/sync/fold.d.ts.map +1 -0
- package/dist/sync/metadata-tables.d.ts +25 -1
- package/dist/sync/metadata-tables.d.ts.map +1 -1
- package/dist/sync/subscription-state.d.ts +26 -7
- package/dist/sync/subscription-state.d.ts.map +1 -1
- package/dist/sync/types.d.ts +9 -129
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +4 -3
- package/dist/testing.js.map +4 -4
- package/dist/worker/attach-sync-client.d.ts +27 -14
- package/dist/worker/attach-sync-client.d.ts.map +1 -1
- package/dist/worker/define-sync-worker.d.ts +52 -19
- package/dist/worker/define-sync-worker.d.ts.map +1 -1
- package/dist/worker/engine-control.d.ts +53 -0
- package/dist/worker/engine-control.d.ts.map +1 -1
- package/dist/worker/live-query-manager.d.ts +3 -3
- package/dist/worker/live-query-manager.d.ts.map +1 -1
- package/dist/worker/live-query-params-guard.d.ts +5 -5
- package/dist/worker/protocol.d.ts +26 -7
- package/dist/worker/protocol.d.ts.map +1 -1
- package/package.json +11 -9
- package/skills/core/SKILL.md +145 -63
- package/skills/operating/SKILL.md +221 -221
- package/skills/operating/references/postgres-builds.md +48 -0
- package/src/boot-report.ts +13 -12
- package/src/circuits/envelope-to-change.ts +211 -0
- package/src/circuits/group-sync.ts +1047 -0
- package/src/circuits/shape-group.ts +158 -0
- package/src/circuits/stream-inbox.ts +225 -0
- package/src/circuits/stream-source.ts +191 -0
- package/src/circuits/subscription-client.ts +353 -0
- package/src/circuits/sync-engine.ts +643 -0
- package/src/debug.ts +1 -85
- package/src/event-lane.ts +132 -14
- package/src/export-data.ts +4 -4
- package/src/export-dump.ts +24 -28
- package/src/export-store.ts +17 -17
- package/src/index.ts +797 -544
- package/src/lazy-guard.ts +1 -1
- package/src/live-rows-sql.ts +1 -1
- package/src/local-store.ts +2 -2
- package/src/local-tables.ts +76 -5
- package/src/mutation.ts +9 -8
- package/src/mutations-api.ts +2 -2
- package/src/opfs-effects.ts +74 -10
- package/src/schema.ts +126 -29
- package/src/store-boot.ts +71 -7
- package/src/store-build.ts +37 -0
- package/src/store-engine.ts +94 -0
- package/src/store-lifecycle.ts +1 -1
- package/src/store-meta.ts +155 -4
- package/src/store-ownership-lock.ts +109 -0
- package/src/store-path.ts +56 -40
- package/src/sync/apply.ts +104 -156
- package/src/sync/copy.ts +116 -21
- package/src/sync/drizzle-executor.ts +13 -14
- package/src/sync/fold.ts +94 -0
- package/src/sync/metadata-tables.ts +43 -2
- package/src/sync/subscription-state.ts +28 -10
- package/src/sync/types.ts +13 -141
- package/src/testing.ts +4 -4
- package/src/worker/attach-sync-client.ts +150 -57
- package/src/worker/define-sync-worker.ts +325 -87
- package/src/worker/engine-control.ts +89 -0
- package/src/worker/engine-router.ts +1 -1
- package/src/worker/live-query-fingerprint.ts +4 -4
- package/src/worker/live-query-manager.ts +12 -12
- package/src/worker/live-query-params-guard.ts +10 -10
- package/src/worker/protocol.ts +38 -7
- package/dist/read-stream-stall.d.ts +0 -54
- package/dist/read-stream-stall.d.ts.map +0 -1
- package/dist/shape-sync.d.ts +0 -207
- package/dist/shape-sync.d.ts.map +0 -1
- package/dist/sync/index.d.ts +0 -32
- package/dist/sync/index.d.ts.map +0 -1
- package/dist/sync/nudge.d.ts +0 -49
- package/dist/sync/nudge.d.ts.map +0 -1
- package/dist/sync/shape-inbox.d.ts +0 -215
- package/dist/sync/shape-inbox.d.ts.map +0 -1
- package/dist/sync/tags.d.ts +0 -142
- package/dist/sync/tags.d.ts.map +0 -1
- package/dist/sync-auth.d.ts +0 -53
- package/dist/sync-auth.d.ts.map +0 -1
- package/src/read-stream-stall.ts +0 -102
- package/src/shape-sync.ts +0 -533
- package/src/sync/index.ts +0 -1124
- package/src/sync/nudge.ts +0 -110
- package/src/sync/shape-inbox.ts +0 -566
- package/src/sync/tags.ts +0 -390
- package/src/sync-auth.ts +0 -117
package/dist/local-store.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ export declare function writeMutationRecoveryRequired(db: MutationDb, registry:
|
|
|
73
73
|
* statement — but only where NOT EXISTS any `sending` row in ANY writable journal (the EXISTS-union is built
|
|
74
74
|
* from the registry's journal Drizzle objects via {@link getJournalTable}). Correct regardless of JS
|
|
75
75
|
* bookkeeping: a concurrent enqueue that committed a `sending` row makes the guard fail, so the marker stays
|
|
76
|
-
* `"true"`. Returns `{ cleared }` from the statement's affected-row count (
|
|
76
|
+
* `"true"`. Returns `{ cleared }` from the statement's affected-row count (pgwasm reports `affectedRows`) —
|
|
77
77
|
* `true` when the guard passed (an existing marker row flipped/held at `"false"`), `false` when a `sending`
|
|
78
78
|
* row blocked it OR no marker row exists yet. Off the boot path AND at the end of a boot recovery pass.
|
|
79
79
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-store.d.ts","sourceRoot":"","sources":["../src/local-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"local-store.d.ts","sourceRoot":"","sources":["../src/local-store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,MA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,CAAC,MAAM,GAAG,IAAI,CAAC,CAWxB;AAED;;;;GAIG;AACH,wBAAsB,iCAAiC,CACrD,EAAE,EAAE,UAAU,EACd,QAAQ,EAAE,iBAAiB,EAC3B,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,8BAA8B,+BAA+B,CAAC;AAE3E;;;;;;;;GAQG;AACH,wBAAsB,4BAA4B,CAChD,EAAE,EAAE,UAAU,EACd,QAAQ,EAAE,iBAAiB,GAC1B,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAoBzB;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,EAAE,EAAE,UAAU,EACd,QAAQ,EAAE,iBAAiB,EAC3B,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,IAAI,CAAC,CAEf;AAOD;;;;;;;;;;;;GAYG;AACH,wBAAsB,oCAAoC,CACxD,EAAE,EAAE,UAAU,EACd,QAAQ,EAAE,iBAAiB,GAC1B,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAkB/B;AAED;;;;GAIG;AACH,wBAAsB,0BAA0B,CAAC,SAAS,SAAS,iBAAiB,EAAE,IAAI,EAAE;IAC1F,EAAE,EAAE,UAAU,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,uBAAuB,CAAC;IACjC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1E,GAAG,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAezC"}
|
package/dist/local-tables.d.ts
CHANGED
|
@@ -722,6 +722,25 @@ declare const outboxShape: PgTableWithColumns<{
|
|
|
722
722
|
identity: undefined;
|
|
723
723
|
generated: undefined;
|
|
724
724
|
}>;
|
|
725
|
+
ackedAtUs: import("drizzle-orm/pg-core").PgBuildColumn<"pgxsinkit_outbox", import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
|
|
726
|
+
dataType: 'custom';
|
|
727
|
+
data: string;
|
|
728
|
+
driverParam: string;
|
|
729
|
+
}>, {
|
|
730
|
+
name: string;
|
|
731
|
+
tableName: "pgxsinkit_outbox";
|
|
732
|
+
dataType: "custom";
|
|
733
|
+
data: string;
|
|
734
|
+
driverParam: string;
|
|
735
|
+
notNull: false;
|
|
736
|
+
hasDefault: false;
|
|
737
|
+
isPrimaryKey: false;
|
|
738
|
+
isAutoincrement: false;
|
|
739
|
+
hasRuntimeDefault: false;
|
|
740
|
+
enumValues: undefined;
|
|
741
|
+
identity: undefined;
|
|
742
|
+
generated: undefined;
|
|
743
|
+
}>;
|
|
725
744
|
};
|
|
726
745
|
dialect: 'pg';
|
|
727
746
|
}>;
|
|
@@ -831,7 +850,7 @@ export declare function getReadModelView<TRegistry extends SyncTableRegistry, TK
|
|
|
831
850
|
* appliers need is derived once from the registry entry — the real projected synced table object, its
|
|
832
851
|
* columns indexed by DB column name, the primary-key column names, and the model-derived column types —
|
|
833
852
|
* so the appliers author over Drizzle objects (no name/schema strings, no `information_schema` probe).
|
|
834
|
-
* Resolved once per shape at subscribe time; reused for every message.
|
|
853
|
+
* Resolved once per shape at subscribe time; reused for every message. Streamed change rows are keyed
|
|
835
854
|
* by DB **column name**, while Drizzle DML keys by **property key**, so both indexes are carried.
|
|
836
855
|
*/
|
|
837
856
|
export interface ApplyTarget {
|
|
@@ -843,6 +862,20 @@ export interface ApplyTarget {
|
|
|
843
862
|
propertyKeyByName: Record<string, string>;
|
|
844
863
|
/** Primary-key column NAMES, in order (from the entry, local-projection override honoured). */
|
|
845
864
|
primaryKey: string[];
|
|
865
|
+
/**
|
|
866
|
+
* The SERVER primary-key column names, in declaration order — the order the engine joins stream-key
|
|
867
|
+
* components in (`schema.rs` `key_string`). Identical to {@link primaryKey} except under a
|
|
868
|
+
* `clientProjection.localPrimaryKey` narrowing, where the stream key still carries every server
|
|
869
|
+
* component and the local key is a subset.
|
|
870
|
+
*/
|
|
871
|
+
serverPrimaryKey: string[];
|
|
872
|
+
/**
|
|
873
|
+
* Server-key components `clientProjection.localPrimaryKey` drops (subscribe-time compile refuses the
|
|
874
|
+
* narrowing unless the shape's predicate pins each to a single value). The engine force-includes
|
|
875
|
+
* every server pk component in emitted rows and keys, so the applier projects exactly these away —
|
|
876
|
+
* any OTHER unknown column stays a loud config error.
|
|
877
|
+
*/
|
|
878
|
+
droppedKeyColumns: string[];
|
|
846
879
|
/**
|
|
847
880
|
* CDC insert-apply policy (ADR-0045), from the entry. `"insert"` (default) applies a CDC insert as a
|
|
848
881
|
* plain INSERT so a genuine PK collision surfaces; `"upsert"` applies it idempotently (ON CONFLICT DO
|
|
@@ -851,6 +884,16 @@ export interface ApplyTarget {
|
|
|
851
884
|
applyMode: "insert" | "upsert";
|
|
852
885
|
/** Model-derived column types (`deriveSyncColumnTypes`), keyed by DB column name via `.name`. */
|
|
853
886
|
columnTypes: SyncColumnType[];
|
|
887
|
+
/**
|
|
888
|
+
* DB column names of the SCALAR `json`/`jsonb` columns — the columns whose wire cell is decoded from
|
|
889
|
+
* JSON text to a JS value on the way in (see `envelopeToChange`). Derived from {@link columnTypes} via
|
|
890
|
+
* the contracts' `jsonUdtName`, once per shape at resolve time rather than per row: the decode runs on
|
|
891
|
+
* every cell of every backfill row, so re-deriving it there would be a per-row string normalisation.
|
|
892
|
+
*
|
|
893
|
+
* Array json columns (`json[]`/`jsonb[]`) are NOT listed — like every array column they stay in
|
|
894
|
+
* Postgres's `array_out` text, which every apply tier feeds back to `array_in`.
|
|
895
|
+
*/
|
|
896
|
+
jsonColumns: string[];
|
|
854
897
|
/**
|
|
855
898
|
* Per-shape render-once cache for the batched-INSERT family (ADR-0029 D5): a rendered `{sqlText,
|
|
856
899
|
* params}` per distinct (column-set, row-count), reused across batches with per-value codecs applied
|
|
@@ -861,6 +904,12 @@ export interface ApplyTarget {
|
|
|
861
904
|
params: unknown[];
|
|
862
905
|
}>;
|
|
863
906
|
}
|
|
907
|
+
/**
|
|
908
|
+
* The DB column names of the SCALAR `json`/`jsonb` columns in a resolved column-type list — the
|
|
909
|
+
* {@link ApplyTarget.jsonColumns} derivation, exported so the test-support target builder and any other
|
|
910
|
+
* ApplyTarget producer derive it the one way (through the contracts' `jsonUdtName`).
|
|
911
|
+
*/
|
|
912
|
+
export declare function scalarJsonColumnNames(columnTypes: readonly SyncColumnType[]): string[];
|
|
864
913
|
/**
|
|
865
914
|
* Resolve a shape's {@link ApplyTarget} from its registry entry (ADR-0029 D1/D2). Called once per shape
|
|
866
915
|
* at subscribe time — never per message. The single source is the registry item: identity via
|
|
@@ -1215,6 +1264,15 @@ export declare function getAllMutationsView(_registry: SyncTableRegistry): AllMu
|
|
|
1215
1264
|
* Public on purpose: the table's shape is contract, so an app composing a best-guess view (pending events
|
|
1216
1265
|
* over down-synced aggregates) authors it as tier-① Drizzle instead of hand-written SQL —
|
|
1217
1266
|
* `client.query((c) => c.drizzle.select().from(getOutboxTable(registry)).where(eq(outbox.stream, "…")))`.
|
|
1267
|
+
*
|
|
1268
|
+
* **A best-guess view's pending predicate is `acked_at_us IS NULL`** (ADR-0060), not "the row is present":
|
|
1269
|
+
* with `events.ackedRetentionMs > 0` an accepted event is STAMPED and RETAINED rather than deleted, because
|
|
1270
|
+
* the server has only accepted it — its consumer has not folded it yet, and the folded aggregate has not
|
|
1271
|
+
* synced back down. That retention window is the composition's **grace ledger**: keep counting an acked row
|
|
1272
|
+
* until your own synced row's stamp passes its `acked_at_us` (or until the retention elapses and the lane's
|
|
1273
|
+
* sweep deletes it), and the composed value stops dipping between the ack and the fold. At the default
|
|
1274
|
+
* retention of `0` an acked row is deleted on the spot, so `acked_at_us` is never non-NULL and the predicate
|
|
1275
|
+
* costs nothing.
|
|
1218
1276
|
*/
|
|
1219
1277
|
export declare function getOutboxTable(registry: SyncTableRegistry): OutboxTable;
|
|
1220
1278
|
/** The `pgxsinkit_local_meta` key/value table (ADR-0006) under the registry's local schema. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-tables.d.ts","sourceRoot":"","sources":["../src/local-tables.ts"],"names":[],"mappings":"AAEA,OAAO,EAaL,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,
|
|
1
|
+
{"version":3,"file":"local-tables.d.ts","sourceRoot":"","sources":["../src/local-tables.ts"],"names":[],"mappings":"AAEA,OAAO,EAaL,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAgH9B,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAkE,CAAC;AACrF,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAkE,CAAC;AACrF,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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I,GACb,WAAW,CAuCb;AAkCD,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAwE,CAAC;AAEhG;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,iBAAiB,CAAC;AAExD,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,iBAAiB,GAAG,gBAAgB,CAElF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,iBAAiB,GAAG,WAAW,CASvE;AAED,+FAA+F;AAC/F,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,cAAc,CAY7E"}
|
package/dist/mutation.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export interface CreateMutationRuntimeOptions<TRegistry extends SyncTableRegistr
|
|
|
70
70
|
registryVersion?: string;
|
|
71
71
|
/**
|
|
72
72
|
* Whether pgxsinkit owns the local schema (and therefore the `pgxsinkit_local_meta` table the durable
|
|
73
|
-
* recovery-required marker lives in). Defaults to `true`. A caller-owned `
|
|
73
|
+
* recovery-required marker lives in). Defaults to `true`. A caller-owned `pgwasmInstance` boot sets this
|
|
74
74
|
* `false`: the meta table may not exist, so the marker is never read/written and boot recovery runs
|
|
75
75
|
* unconditionally.
|
|
76
76
|
*/
|
|
@@ -185,7 +185,7 @@ export interface MutationRuntime<TRegistry extends SyncTableRegistry> {
|
|
|
185
185
|
* runs from a consumer call ({@link recoverSending} keeps today's exact per-table semantics and never
|
|
186
186
|
* touches the marker); {@link BootRecoveryOutcome} feeds the `warmBoot` BootReport fields verbatim.
|
|
187
187
|
*
|
|
188
|
-
* - `ownsMetaTable: false` (caller-owned
|
|
188
|
+
* - `ownsMetaTable: false` (caller-owned pgwasm) → unconditional recovery, marker untouched.
|
|
189
189
|
* - `restore: true` → unconditional recovery + {@link quarantineRecovered} + self-verifying clear (marker ignored).
|
|
190
190
|
* - marker `false` → skip the loop entirely.
|
|
191
191
|
* - marker absent (not initialized) → one conservative recovery pass, then initialize the marker.
|
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":"AAgFA,OAAO,KAAK,EAEV,WAAW,EACX,mBAAmB,EAEnB,oBAAoB,EAEpB,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,EACV,MAAM,sBAAsB,CAAC;AAc9B,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,MAAM,MAAM,iBAAiB,CAAC,SAAS,SAAS,iBAAiB,IAAI;KAClE,IAAI,IAAI,aAAa,CAAC,SAAS,CAAC,GAC7B;QACE,KAAK,EAAE,IAAI,CAAC;QACZ,IAAI,EAAE,QAAQ,CAAC;QACf,KAAK,EAAE,oBAAoB,CAAC,SAAS,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a,CAAC,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,CAkkC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations-api.d.ts","sourceRoot":"","sources":["../src/mutations-api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mutations-api.d.ts","sourceRoot":"","sources":["../src/mutations-api.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAI9F,OAAO,KAAK,EAAE,cAAc,EAAgB,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,k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;CACtC;AA0BD,wGAAwG;AACxG,MAAM,WAAW,gBAAgB,CAAC,SAAS,SAAS,iBAAiB;IACnE,QAAQ,EAAE,SAAS,CAAC;IACpB,iBAAiB,EAAE,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtD,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAA;KAAE,EAClD,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,KAC3B,OAAO,CAAC;QAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QAAC,WAAW,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAC;IAC/D,8GAA8G;IAC9G,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;KAAE,CAAC,CAAC;CAC1F;AAkID;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,SAAS,iBAAiB,EACpE,IAAI,EAAE,gBAAgB,CAAC,SAAS,CAAC,GAChC,YAAY,CAAC,SAAS,CAAC,CA0CzB"}
|
package/dist/opfs-effects.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type OwnershipLocks } from "./store-ownership-lock";
|
|
1
2
|
/**
|
|
2
3
|
* The minimal structural shape of an OPFS `FileSystemDirectoryHandle` this module traverses: the
|
|
3
4
|
* create-or-not `getDirectoryHandle`/`getFileHandle` hops and the recursive `removeEntry`. Declared locally
|
|
@@ -22,14 +23,29 @@ export interface OpfsEffectsDeps {
|
|
|
22
23
|
* `"unobservable"`, and the create effects throw (they are only reached in the opfs engine home).
|
|
23
24
|
*/
|
|
24
25
|
getRoot?: () => Promise<DirLike>;
|
|
26
|
+
/**
|
|
27
|
+
* The Web Locks surface `deleteStoreDirectory` orders on (`store-ownership-lock.ts`). Omit in production: the
|
|
28
|
+
* default reads `navigator.locks` off `globalThis`; `null` (or an absent API) skips the ordering.
|
|
29
|
+
*/
|
|
30
|
+
locks?: OwnershipLocks | null;
|
|
31
|
+
/** Bound on waiting for the store's owner to release before `deleteStoreDirectory` fails. Default 10 s. */
|
|
32
|
+
ownershipWaitMs?: number;
|
|
25
33
|
}
|
|
26
34
|
/** The effects surface the store-boot wiring drives (create-if-absent / delete-if-present / never-creating observe). */
|
|
27
35
|
export interface OpfsEffects {
|
|
28
36
|
/** Create-if-absent the commitment sentinel file at `pgxsinkit/commitments/<identity>`. */
|
|
29
37
|
publishSentinel(): Promise<void>;
|
|
30
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Delete-if-present the commitment sentinel (`NotFoundError` swallowed). A root that cannot be opened at all
|
|
40
|
+
* raises {@link OpfsRootUnavailableError}.
|
|
41
|
+
*/
|
|
31
42
|
deleteSentinel(): Promise<void>;
|
|
32
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Recursively delete-if-present the store directory `pgxsinkit/stores/<identity>` (`NotFoundError` swallowed),
|
|
45
|
+
* under the store's ownership lock: the delete waits (bounded) until the context holding the directory's
|
|
46
|
+
* sync-access handles has released them, and fails with `StoreOwnershipWaitError` under a live owner. A root
|
|
47
|
+
* that cannot be opened at all raises {@link OpfsRootUnavailableError}.
|
|
48
|
+
*/
|
|
33
49
|
deleteStoreDirectory(): Promise<void>;
|
|
34
50
|
/**
|
|
35
51
|
* Never-creating walk of the commitment namespace. A root/API failure (or the API being absent) reads as
|
|
@@ -42,6 +58,18 @@ export interface OpfsEffects {
|
|
|
42
58
|
/** Create-if-absent chain to the store directory, returning its handle for the opfs-repacked factory. */
|
|
43
59
|
getStoreDirectoryHandle(): Promise<unknown>;
|
|
44
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* The OPFS root could not be opened AT ALL in this context — `navigator.storage.getDirectory()` rejected
|
|
63
|
+
* (WebKit's throwaway contexts reject with `UnknownError`; probably Safari private windows too). Raised only by
|
|
64
|
+
* the two DELETE effects, so the destruction wiring can tell "this context cannot reach OPFS" from a failure
|
|
65
|
+
* inside a reachable OPFS and record the OPFS side as pending instead (ADR-0036 amendment, 2026-09-28). The
|
|
66
|
+
* original rejection is the `cause`.
|
|
67
|
+
*/
|
|
68
|
+
export declare class OpfsRootUnavailableError extends Error {
|
|
69
|
+
constructor(storePath: string, cause: unknown);
|
|
70
|
+
}
|
|
71
|
+
/** Is this an {@link OpfsRootUnavailableError}? Name-based, so it survives duplicated module instances. */
|
|
72
|
+
export declare function isOpfsRootUnavailableError(error: unknown): boolean;
|
|
45
73
|
/**
|
|
46
74
|
* Construct the real OPFS effects for a store, all under `store-path.ts`'s disjoint namespaces. The returned
|
|
47
75
|
* object's methods satisfy the idempotency contracts the `store-lifecycle.ts` machines require, so a boot that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opfs-effects.d.ts","sourceRoot":"","sources":["../src/opfs-effects.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"opfs-effects.d.ts","sourceRoot":"","sources":["../src/opfs-effects.ts"],"names":[],"mappings":"AAeA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGjF;;;;GAIG;AACH,MAAM,WAAW,OAAO;IACtB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnF,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9E,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7E;AAED,8FAA8F;AAC9F,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,2GAA2G;IAC3G,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wHAAwH;AACxH,MAAM,WAAW,WAAW;IAC1B,2FAA2F;IAC3F,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC;;;OAGG;IACH,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC;;;;;OAKG;IACH,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC;;;OAGG;IACH,0BAA0B,IAAI,OAAO,CAAC;QAAE,eAAe,EAAE,OAAO,CAAC;QAAC,qBAAqB,EAAE,OAAO,CAAA;KAAE,GAAG,cAAc,CAAC,CAAC;IACrH,yGAAyG;IACzG,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7C;AAED;;;;;;GAMG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,YAAY,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAO5C;CACF;AAED,2GAA2G;AAC3G,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAElE;AAgBD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,WAAW,CA8GxF"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -35,6 +35,17 @@ export declare const LOCAL_META_TABLE = "pgxsinkit_local_meta";
|
|
|
35
35
|
* `next_retry_at_us` is in the future is skipped by batch assembly. NULL = eligible now.
|
|
36
36
|
* - `last_reason` — the most recent server `deferred` reason, kept on the row it belongs to (never a
|
|
37
37
|
* second, retention-bearing verdict table — ADR-0053 rejects that).
|
|
38
|
+
* - `acked_at_us` — the **acked ledger** stamp (ADR-0060): when the server accepted the event, or NULL
|
|
39
|
+
* while it is still PENDING a verdict. NULL is the pending predicate — everything the library means by
|
|
40
|
+
* "pending" reads `acked_at_us IS NULL` (the drain signal, batch assembly, `diagnostics().outbox`, the
|
|
41
|
+
* non-forced `destroy()` refusal), so a stamped row is never re-posted and never keeps the lane
|
|
42
|
+
* "non-empty". It is stamped instead of deleted only when the client configures
|
|
43
|
+
* `events.ackedRetentionMs > 0`; at the default `0` an `acked` verdict deletes the row immediately and
|
|
44
|
+
* this column is never non-NULL. **For a best-guess view it is the grace ledger**: an `acked` row has
|
|
45
|
+
* been accepted but NOT yet folded by the server's consumer, and the folded aggregate has not yet synced
|
|
46
|
+
* back down — so a composition may keep counting an acked row until its own synced row's stamp passes
|
|
47
|
+
* `acked_at_us`, or until the retention elapses and the sweep deletes it. That dip is the whole reason
|
|
48
|
+
* the column exists.
|
|
38
49
|
*/
|
|
39
50
|
export declare const OUTBOX_TABLE = "pgxsinkit_outbox";
|
|
40
51
|
/** The sequence backing {@link OUTBOX_TABLE}'s `seq` append ordinal (the journal's `mutation_seq` precedent). */
|
|
@@ -121,7 +132,7 @@ export declare function computeLocalSchemaFingerprint<TRegistry extends SyncTabl
|
|
|
121
132
|
* takes the UNqualified relation name (the TEMP keyword places it in `pg_temp`; a `CREATE TEMP TABLE
|
|
122
133
|
* pg_temp.x` target is not portable). Same relation/index NAMES as the durable form: an index name lives
|
|
123
134
|
* per schema, so the durable (metadata-schema) and session (`pg_temp`) indexes coexist without collision
|
|
124
|
-
* (probed on real
|
|
135
|
+
* (probed on real pgwasm).
|
|
125
136
|
*
|
|
126
137
|
* CAVEAT — the `temp` flag only bares the RELATION name; `buildTableColumnSql` below still receives
|
|
127
138
|
* `schemaName` and would qualify any ENUM column type into THAT schema. That is correct only because the
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,EAWL,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;
|
|
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,EAWL,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAuB9B,kGAAkG;AAClG,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAE/C,iHAAiH;AACjH,eAAO,MAAM,eAAe,yBAAwB,CAAC;AACrD,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAC/D;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,6BAA6B,CAAC;AACvE,4EAA4E;AAC5E,eAAO,MAAM,+BAA+B,UAAU,CAAC;AAEvD;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,4BAA4B,CAAC;AAE5D;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,YACxC,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,eAAe,CACP,CAAC;AA8EX;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,SAAS,iBAAiB,EAAE,QAAQ,EAAE,SAAS,GAAG,MAAM,CAE3G;AAoUD,iIAAiI;AACj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iB,EACrE,QAAQ,EAAE,SAAS,EACnB,QAAQ,EAAE,MAAM,GACf,MAAM,CA2BR"}
|
package/dist/store-boot.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { type StoreBootVerdict, type StoreMetaDeps } from "./store-meta";
|
|
|
9
9
|
export type ResolvedStorageBackend = "opfs-repacked" | "idbfs" | "filesystem" | "memory";
|
|
10
10
|
/** The outcome of {@link resolveStoreBoot}: the URL to open the store at, its backend, and the boot verdict. */
|
|
11
11
|
export interface StoreBootResolution {
|
|
12
|
-
/** The
|
|
12
|
+
/** The pgwasm dataDir URL, always assembled by {@link resolveStoreDataDir} (the one URL assembler). */
|
|
13
13
|
dataDir: string;
|
|
14
14
|
/** The resolved backend, for diagnostics. */
|
|
15
15
|
storageBackend: ResolvedStorageBackend;
|
|
@@ -80,6 +80,21 @@ export declare class CommittedStoreUnreachableError extends Error {
|
|
|
80
80
|
* every bridge seam calls THIS, never its own shape sniff.
|
|
81
81
|
*/
|
|
82
82
|
export declare function committedStoreUnreachableFromWire(detail: unknown): CommittedStoreUnreachableError | undefined;
|
|
83
|
+
/** The outcome of {@link settlePendingOpfsDeletion}. */
|
|
84
|
+
export type PendingOpfsDeletionOutcome = "none" | "settled" | "still-pending";
|
|
85
|
+
/**
|
|
86
|
+
* Settle an "OPFS deletion pending" marker (ADR-0036 amendment, 2026-09-28) — the FIRST thing every browser boot
|
|
87
|
+
* does, before any classification or open. A store destroyed in a context that could not open OPFS at all left
|
|
88
|
+
* its OPFS store directory and commitment sentinel (if it ever had them) behind, with the marker as the durable
|
|
89
|
+
* obligation. When this boot can reach OPFS it deletes the sentinel, then the store directory (under the
|
|
90
|
+
* store's ownership lock), and only then clears the marker — so a leftover sentinel never reaches the classifier
|
|
91
|
+
* as "no record + sentinel" (`repair-record-then-open-committed`, which would reopen destroyed data). When it
|
|
92
|
+
* still cannot reach OPFS (the namespace is unobservable, or the root rejects mid-settlement) the marker stays
|
|
93
|
+
* and the boot proceeds: such a context cannot open an OPFS store anyway.
|
|
94
|
+
*
|
|
95
|
+
* An unreadable marker propagates ({@link StoreMetaUnreadableError}) — never read as "no marker".
|
|
96
|
+
*/
|
|
97
|
+
export declare function settlePendingOpfsDeletion(storePath: string, deps?: ResolveStoreBootOptions["deps"]): Promise<PendingOpfsDeletionOutcome>;
|
|
83
98
|
/**
|
|
84
99
|
* The PRE-MINT meta gate every probe-denied (no OPFS sync access) browser boot passes through — one bounded
|
|
85
100
|
* meta read serving both of the record's claims such a boot must honour, before any replacement IDB store is
|
|
@@ -105,6 +120,17 @@ export declare function committedStoreUnreachableFromWire(detail: unknown): Comm
|
|
|
105
120
|
*
|
|
106
121
|
* An UNREADABLE record propagates ({@link StoreMetaUnreadableError}) — a failed meta read is an error, never
|
|
107
122
|
* "no record" (invariant 12).
|
|
123
|
+
*
|
|
124
|
+
* A pending OPFS deletion is settled first when this home can reach OPFS asynchronously
|
|
125
|
+
* ({@link settlePendingOpfsDeletion}; it runs alongside the record read, which it does not touch).
|
|
126
|
+
*
|
|
127
|
+
* **An interrupted destroy whose OPFS side is already pending** (ADR-0036 amendment, 2026-09-28): a `deleting`
|
|
128
|
+
* record in a scope whose commitment namespace is unobservable is normally refused (sentinel removal cannot be
|
|
129
|
+
* confirmed). When the "OPFS deletion pending" marker for this identity still stands, the destroy got past its
|
|
130
|
+
* marker step, so the OPFS side is already durably deferred to the next OPFS-capable boot: this boot finishes
|
|
131
|
+
* the IndexedDB side (the idb database, then the meta record — destroy's own order), leaves the marker, and
|
|
132
|
+
* proceeds as a fresh boot. Returns `false` (no authority is published; the fresh boot is recordless). Without
|
|
133
|
+
* the marker (interrupted before the marker step) the refusal stands.
|
|
108
134
|
*/
|
|
109
135
|
export declare function resolveDeniedBootAuthority(storePath: string, deps?: ResolveStoreBootOptions["deps"]): Promise<boolean>;
|
|
110
136
|
/**
|
|
@@ -115,7 +141,9 @@ export declare function resolveDeniedBootAuthority(storePath: string, deps?: Res
|
|
|
115
141
|
* no meta machinery).
|
|
116
142
|
* - **non-browser** (no idb, no opfs handles) → `file://` passthrough, no classification (the filesystem
|
|
117
143
|
* backend has no meta machinery either).
|
|
118
|
-
* - **browser** →
|
|
144
|
+
* - **browser** → settle any pending OPFS deletion FIRST ({@link settlePendingOpfsDeletion} — alongside the first
|
|
145
|
+
* meta read, which it does not touch, and before any observation, classification or open), then read the meta
|
|
146
|
+
* record ({@link readStoreMetaRecord}; {@link StoreMetaUnreadableError}
|
|
119
147
|
* propagates = fail closed, invariant 12), map {@link META_STORE_UNAVAILABLE} to a provable absence
|
|
120
148
|
* (no idb ⇒ no record and no existing idb store), observe the commitment namespace and the recordless idb fact,
|
|
121
149
|
* classify, and execute:
|
package/dist/store-boot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-boot.d.ts","sourceRoot":"","sources":["../src/store-boot.ts"],"names":[],"mappings":"AA4BA,OAAO,
|
|
1
|
+
{"version":3,"file":"store-boot.d.ts","sourceRoot":"","sources":["../src/store-boot.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAiD,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAErG,OAAO,EAQL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAGnB,MAAM,cAAc,CAAC;AAGtB;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG,OAAO,GAAG,YAAY,GAAG,QAAQ,CAAC;AAEzF,gHAAgH;AAChH,MAAM,WAAW,mBAAmB;IAClC,uGAAuG;IACvG,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,cAAc,EAAE,sBAAsB,CAAC;IACvC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED,4CAA4C;AAC5C,MAAM,WAAW,uBAAuB;IACtC,8GAA8G;IAC9G,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qGAAqG;IACrG,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,4EAA4E;IAC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B,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAmJrH"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type StorageBuild, type StoreBuildCheckSite } from "@pgxsinkit/contracts";
|
|
2
|
+
import type { BuildIdentity } from "@pgxsinkit/pgwasm";
|
|
3
|
+
/**
|
|
4
|
+
* The supplied-build check (ADR-0063). A store's Postgres build is code — a `PostgresBuild` a site supplies,
|
|
5
|
+
* or the build an adopted instance reports as `pg.build` — never the declared string. The registry's
|
|
6
|
+
* `storage.build` (default `"c"`) must name it:
|
|
7
|
+
*
|
|
8
|
+
* - before any mint, against the build the site supplies (the `createSyncClient` boot, the worker's
|
|
9
|
+
* provision and spare mints, a `createPgwasmClient` with a declaration threaded to it);
|
|
10
|
+
* - on every adopted instance, against `pg.build` (`pgwasmInstance`, `precreatedPgwasm`, a worker
|
|
11
|
+
* `createStore` result).
|
|
12
|
+
*
|
|
13
|
+
* A mismatch throws {@link StorageBuildMismatchError} before any store is touched. Declaring `pgrust` and
|
|
14
|
+
* supplying no build is a mismatch too: the default build is `cBuild`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function assertStoreBuild(declared: StorageBuild, supplied: BuildIdentity, site: StoreBuildCheckSite): void;
|
|
17
|
+
/** Is `error` a typed build refusal ({@link STORE_BUILD_REFUSALS}), which a retry cannot change? */
|
|
18
|
+
export declare function isStoreBuildRefusal(error: unknown): boolean;
|
|
19
|
+
//# sourceMappingURL=store-build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-build.d.ts","sourceRoot":"","sources":["../src/store-build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAA6B,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC9G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAEjH;AAeD,oGAAoG;AACpG,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE3D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PgwasmClient } from "./index";
|
|
2
|
+
/** The one function the declared engine trades in — the toolkit's `createStore` option (ADR-0036). */
|
|
3
|
+
export type StoreEngineFactory = (storePath: string, backendOverride?: "memory") => Promise<PgwasmClient>;
|
|
4
|
+
/** How a scope loads a module URL: the dynamic `import()` in a browser scope, a stub in a unit test. */
|
|
5
|
+
export type StoreEngineModuleLoader = (url: string) => Promise<unknown>;
|
|
6
|
+
/**
|
|
7
|
+
* Import one store-engine module URL and take its factory: the default export, else a named `createStore`.
|
|
8
|
+
*
|
|
9
|
+
* @param module the declared `storage.engine.module` — an absolute or origin-relative module URL.
|
|
10
|
+
* @param load how to import it; defaults to a dynamic `import()` in the calling scope.
|
|
11
|
+
*/
|
|
12
|
+
export declare function loadStoreEngineFactory(module: string, load?: StoreEngineModuleLoader): Promise<StoreEngineFactory>;
|
|
13
|
+
/**
|
|
14
|
+
* A per-scope resolver that loads each declared engine module ONCE and reuses it for every later mint.
|
|
15
|
+
*
|
|
16
|
+
* The memo keeps the REJECTION too: a failed load stays failed for the scope's lifetime, so every later
|
|
17
|
+
* mint reports the same loud error instead of quietly succeeding on the built-in engine (a declared engine
|
|
18
|
+
* that half-ran is a worse outcome than one that never started). Keyed by module URL, so a scope that is
|
|
19
|
+
* somehow asked for two engines gets two loads and no cross-talk.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createStoreEngineResolver(load?: StoreEngineModuleLoader): (module: string) => Promise<StoreEngineFactory>;
|
|
22
|
+
//# sourceMappingURL=store-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-engine.d.ts","sourceRoot":"","sources":["../src/store-engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA0B5C,sGAAsG;AACtG,MAAM,MAAM,kBAAkB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,QAAQ,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;AAE1G,wGAAwG;AACxG,MAAM,MAAM,uBAAuB,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAUxE;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,uBAAiD,GACtD,OAAO,CAAC,kBAAkB,CAAC,CAsB7B;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,GAAE,uBAAiD,GACtD,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAUjD"}
|
package/dist/store-meta.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export type StoreBootVerdict = {
|
|
|
75
75
|
* termination model, and a later sentinel/record conflict surfaces as a hard error, never silently resolved.
|
|
76
76
|
*/
|
|
77
77
|
export declare function classifyStoreBoot(obs: StoreBootObservations): StoreBootVerdict;
|
|
78
|
-
/** The dedicated IndexedDB database holding every store's meta record — SEPARATE from
|
|
78
|
+
/** The dedicated IndexedDB database holding every store's meta record — SEPARATE from pgwasm's own idb stores. */
|
|
79
79
|
export declare const STORE_META_DATABASE = "pgxsinkit-store-meta";
|
|
80
80
|
/** The bounded read-retry budget before a failed read fails closed (invariant 12). */
|
|
81
81
|
export declare const META_READ_ATTEMPTS = 3;
|
|
@@ -170,7 +170,7 @@ export declare function writeStoreMetaRecord(storePath: string, record: StoreMet
|
|
|
170
170
|
/** Delete a store's meta record — the terminal step of the destructive lifecycle (invariant 12/13). */
|
|
171
171
|
export declare function deleteStoreMetaRecord(storePath: string, deps?: StoreMetaDeps): Promise<void>;
|
|
172
172
|
/**
|
|
173
|
-
* Does
|
|
173
|
+
* Does pgwasm's idb database for this store ALREADY exist, WITHOUT creating it? The recordless-idb recognition
|
|
174
174
|
* check (invariant 14): no meta record + an existing idb store → `idb-authoritative`, never virgin. An
|
|
175
175
|
* existing idb store's data is never overwritten by a fresh opfs mint — it is opened IN PLACE, whatever the
|
|
176
176
|
* booting home's capabilities, because a store's storage backend is fixed at first mint.
|
|
@@ -182,8 +182,34 @@ export declare function deleteStoreMetaRecord(storePath: string, deps?: StoreMet
|
|
|
182
182
|
* the handle and resolve `true`. The `onerror` that follows an abort is the EXPECTED completion of the
|
|
183
183
|
* non-exist path (the AbortError), not a failure — it resolves `false`. `indexedDB` absent → `false`
|
|
184
184
|
* (no idb store can exist). The database name comes from `store-path.ts`'s {@link storeIndexedDbDatabaseName}
|
|
185
|
-
* (the sole
|
|
185
|
+
* (the sole route to pgwasm's IndexedDB naming) — never re-derived here.
|
|
186
186
|
*/
|
|
187
187
|
export declare function idbStoreExists(storePath: string, deps?: StoreMetaDeps): Promise<boolean>;
|
|
188
|
+
/**
|
|
189
|
+
* The dedicated IndexedDB database holding "OPFS deletion pending" markers — SEPARATE from the meta record
|
|
190
|
+
* database, so the meta record's schema and total phase machine are untouched. A marker says: this store was
|
|
191
|
+
* destroyed in a context that could not open OPFS at all (`navigator.storage.getDirectory()` rejected — WebKit's
|
|
192
|
+
* throwaway contexts, probably Safari private windows), so its OPFS store directory and commitment sentinel,
|
|
193
|
+
* if any, still have to go. The next boot of that store that CAN reach OPFS deletes both, clears the marker, and
|
|
194
|
+
* only then classifies/opens (`store-boot.ts`'s `settlePendingOpfsDeletion`). Keyed by
|
|
195
|
+
* {@link storeIdentityComponent}; PRESENCE is the whole signal.
|
|
196
|
+
*/
|
|
197
|
+
export declare const OPFS_DELETION_PENDING_DATABASE = "pgxsinkit-opfs-deletion-pending";
|
|
198
|
+
/**
|
|
199
|
+
* Is an OPFS deletion pending for this store? `indexedDB` entirely absent → `false` (no marker can exist). The
|
|
200
|
+
* SAME failed-read policy as the meta record (invariant 12): a read that fails every one of
|
|
201
|
+
* {@link META_READ_ATTEMPTS} attempts throws {@link StoreMetaUnreadableError}, never "no marker" — reading an
|
|
202
|
+
* unreadable marker as absent would let a leftover sentinel classify as a committed store and reopen destroyed
|
|
203
|
+
* data.
|
|
204
|
+
*/
|
|
205
|
+
export declare function readOpfsDeletionPending(storePath: string, deps?: StoreMetaDeps): Promise<boolean>;
|
|
206
|
+
/**
|
|
207
|
+
* Durably record that this store's OPFS side still has to be deleted. Resolves `false` WITHOUT writing when
|
|
208
|
+
* `indexedDB` is entirely absent — there is nowhere to record it, so the caller must not treat the OPFS side as
|
|
209
|
+
* handled.
|
|
210
|
+
*/
|
|
211
|
+
export declare function writeOpfsDeletionPending(storePath: string, deps?: StoreMetaDeps): Promise<boolean>;
|
|
212
|
+
/** Clear the marker once the OPFS sentinel and store directory are provably gone. Absent counts as cleared. */
|
|
213
|
+
export declare function clearOpfsDeletionPending(storePath: string, deps?: StoreMetaDeps): Promise<void>;
|
|
188
214
|
export {};
|
|
189
215
|
//# sourceMappingURL=store-meta.d.ts.map
|
package/dist/store-meta.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-meta.d.ts","sourceRoot":"","sources":["../src/store-meta.ts"],"names":[],"mappings":"AA0BA;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,mBAAmB,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,UAAU,CAAC;AAEpG,6FAA6F;AAC7F,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,cAAc,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,MAAM,EAAE,eAAe,GAAG,SAAS,CAAC;IACpC;;;;OAIG;IACH,IAAI,EAAE;QAAE,eAAe,EAAE,OAAO,CAAC;QAAC,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G;AACH,wBAAsB,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAaxG;AAED,+GAA+G;AAC/G,wBAAsB,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAcrG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** The minimal `navigator.locks` shape this module needs: an exclusive, abortable `request`. */
|
|
2
|
+
export interface OwnershipLocks {
|
|
3
|
+
request(name: string, options: {
|
|
4
|
+
mode: "exclusive";
|
|
5
|
+
signal: AbortSignal;
|
|
6
|
+
}, callback: (lock: unknown) => Promise<void>): Promise<unknown>;
|
|
7
|
+
}
|
|
8
|
+
/** Options for {@link acquireStoreOwnership} / {@link withStoreOwnership}. */
|
|
9
|
+
export interface StoreOwnershipOptions {
|
|
10
|
+
/** The Web Locks surface. Omit in production: the default reads `navigator.locks` off `globalThis`. */
|
|
11
|
+
locks?: OwnershipLocks | null;
|
|
12
|
+
/** How long to wait for the current owner to release before failing. Default {@link STORE_OWNERSHIP_WAIT_MS}. */
|
|
13
|
+
waitMs?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The default bound on waiting for a store's owner to let go. It covers a dying engine worker's teardown with a
|
|
17
|
+
* wide margin while still failing loudly (and re-runnably) under an owner that is alive and staying.
|
|
18
|
+
*/
|
|
19
|
+
export declare const STORE_OWNERSHIP_WAIT_MS = 10000;
|
|
20
|
+
/** The store is still owned by another live context after the bounded wait — the owner never released it. */
|
|
21
|
+
export declare class StoreOwnershipWaitError extends Error {
|
|
22
|
+
readonly storePath: string;
|
|
23
|
+
constructor(storePath: string, waitMs: number);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Take the store's ownership lock, waiting at most `waitMs` for the current holder to release it. Resolves with
|
|
27
|
+
* an idempotent `release` once granted; rejects with {@link StoreOwnershipWaitError} when the wait runs out.
|
|
28
|
+
* Without a Web Locks API the returned `release` is a no-op.
|
|
29
|
+
*/
|
|
30
|
+
export declare function acquireStoreOwnership(storePath: string, options?: StoreOwnershipOptions): Promise<() => void>;
|
|
31
|
+
/** Run `effect` while holding the store's ownership lock (see {@link acquireStoreOwnership}), then release it. */
|
|
32
|
+
export declare function withStoreOwnership<T>(storePath: string, effect: () => Promise<T>, options?: StoreOwnershipOptions): Promise<T>;
|
|
33
|
+
//# sourceMappingURL=store-ownership-lock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-ownership-lock.d.ts","sourceRoot":"","sources":["../src/store-ownership-lock.ts"],"names":[],"mappings":"AAqBA,gGAAgG;AAChG,MAAM,WAAW,cAAc;IAC7B,OAAO,CACL,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;QAAE,IAAI,EAAE,WAAW,CAAC;QAAC,MAAM,EAAE,WAAW,CAAA;KAAE,EACnD,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,GACzC,OAAO,CAAC,OAAO,CAAC,CAAC;CACrB;AAED,8EAA8E;AAC9E,MAAM,WAAW,qBAAqB;IACpC,uGAAuG;IACvG,KAAK,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,iHAAiH;IACjH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,QAAS,CAAC;AAE9C,6GAA6G;AAC7G,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,YAAY,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAO5C;CACF;AAOD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CA2B7G;AAED,kHAAkH;AAClH,wBAAsB,kBAAkB,CAAC,CAAC,EACxC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACxB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,CAAC,CAAC,CAOZ"}
|