@pgxsinkit/contracts 0.1.53 → 0.2.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/dist/config.d.ts +47 -11
- package/dist/config.d.ts.map +1 -1
- package/dist/index.js +60 -14
- package/dist/index.js.map +5 -5
- package/dist/mutation.d.ts.map +1 -1
- package/dist/registry.d.ts +35 -11
- package/dist/registry.d.ts.map +1 -1
- package/dist/runtime.d.ts +1 -1
- package/package.json +1 -1
- package/skills/registry-authoring/SKILL.md +33 -10
- package/src/config.ts +58 -19
- package/src/mutation.ts +1 -2
- package/src/registry.ts +129 -34
- package/src/runtime.ts +1 -1
package/dist/mutation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutation.d.ts","sourceRoot":"","sources":["../src/mutation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,kBAAkB;;;;EAAyC,CAAC;AACzE;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;EAQ/B,CAAC;AACH;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB;;;;;EAAwD,CAAC;AAE7F,eAAO,MAAM,eAAe,uCAA+D,CAAC;AAE5F,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"mutation.d.ts","sourceRoot":"","sources":["../src/mutation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,kBAAkB;;;;EAAyC,CAAC;AACzE;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;EAQ/B,CAAC;AACH;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB;;;;;EAAwD,CAAC;AAE7F,eAAO,MAAM,eAAe,uCAA+D,CAAC;AAE5F,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;kBAwBxB,C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BAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
package/dist/registry.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { pgSchema } from "drizzle-orm/pg-core";
|
|
|
4
4
|
import type { ExtractTablesWithRelations } from "drizzle-orm/relations";
|
|
5
5
|
import { getColumns } from "drizzle-orm/utils";
|
|
6
6
|
import { type ApplyStrategy, type SyncColumnType } from "./apply-strategy";
|
|
7
|
-
import { type ClientProjectionSpec, type ConflictPolicy, type DeferrableConstraintSpec, type ManagedFieldApplyOn, type ManagedFieldSpec, type ManagedFieldStrategy, type PrimaryKeySpec, type Retention, type RowFilterSpec, type ServerProjectionSpec, type ShapeSpec, type ShapeSpecInput, type SubscriptionTiming, type TableGovernanceSpec as TableGovernanceSpecBase, type TableMode, type WriteMode } from "./config";
|
|
7
|
+
import { type ClientProjectionSpec, type ConflictPolicy, type DeferrableConstraintSpec, type ManagedFieldApplyOn, type ManagedFieldSpec, type ManagedFieldStrategy, type PrimaryKeySpec, type Retention, type RowFilterSpec, type ServerProjectionSpec, type ShapeSpec, type ShapeSpecInput, type SubscriptionTiming, type SyncStorageDeclaration, type TableGovernanceSpec as TableGovernanceSpecBase, type TableMode, type WriteMode } from "./config";
|
|
8
8
|
type PgSchemaType = ReturnType<typeof pgSchema>;
|
|
9
9
|
type AnyPgView = PgView;
|
|
10
10
|
type TableColumnsShape<TTable extends AnyPgTable> = TTable extends {
|
|
@@ -74,8 +74,9 @@ export interface SyncTableEntry<TTable extends AnyPgTable = AnyPgTable, TLocalTa
|
|
|
74
74
|
* Consistency group (ADR-0009 decision 2). Tables sharing a `consistencyGroup` are synced on one
|
|
75
75
|
* `MultiShapeStream` and committed atomically at a shared LSN frontier, so a local reader never
|
|
76
76
|
* sees one grouped table advanced past another for the same server transaction. Omitted → the
|
|
77
|
-
* table is its own singleton group (independent frontier,
|
|
78
|
-
*
|
|
77
|
+
* table is its own singleton group (independent frontier, no cross-table atomicity — the resolution
|
|
78
|
+
* for a table that declares no group). The latency cost (a group advances only as fast as its
|
|
79
|
+
* slowest shape) is contained to the tables that opt in.
|
|
79
80
|
*/
|
|
80
81
|
consistencyGroup?: string;
|
|
81
82
|
/**
|
|
@@ -168,14 +169,13 @@ export type SyncTableInputProjection<TColumns extends Record<string, ColumnBuild
|
|
|
168
169
|
omitColumns?: TOmittedColumns;
|
|
169
170
|
};
|
|
170
171
|
/**
|
|
171
|
-
* A row filter for {@link defineSyncTable}'s `shape
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* rename-safe column objects instead of hand-written column-name strings.
|
|
172
|
+
* A row filter for {@link defineSyncTable}'s `shape`, authored from the table's built, typed columns.
|
|
173
|
+
* Reference columns through `c(columns.x)` exactly as `extras` does with its `self` argument, so
|
|
174
|
+
* `customWhere` builds parameterized Electric `where`s from real, rename-safe column objects instead
|
|
175
|
+
* of hand-written column-name strings.
|
|
176
176
|
*/
|
|
177
|
-
export type RowFilterInput<TColumns extends Record<string, ColumnBuilderBase>> =
|
|
178
|
-
/** {@link ShapeSpecInput} whose `rowFilter`
|
|
177
|
+
export type RowFilterInput<TColumns extends Record<string, ColumnBuilderBase>> = (columns: PgBuildExtraConfigColumns<TColumns>) => RowFilterSpec;
|
|
178
|
+
/** {@link ShapeSpecInput} whose `rowFilter` is authored from the built columns (typed by `TColumns`). */
|
|
179
179
|
export type ShapeSpecInputFor<TColumns extends Record<string, ColumnBuilderBase>> = Omit<ShapeSpecInput, "rowFilter"> & {
|
|
180
180
|
rowFilter?: RowFilterInput<TColumns>;
|
|
181
181
|
};
|
|
@@ -264,8 +264,17 @@ export type SyncTableRegistry = Record<string, SyncTableEntry>;
|
|
|
264
264
|
export interface SyncRegistryDefinition<TRegistry extends SyncTableRegistry> {
|
|
265
265
|
schema?: string;
|
|
266
266
|
tables: TRegistry;
|
|
267
|
+
/**
|
|
268
|
+
* The storage contract for every store this registry mints (ADR-0049 decision 1, ADR-0047). Part of the
|
|
269
|
+
* DATA contract, not a per-open knob: `durability` binds every toolkit-minted open (relaxed default),
|
|
270
|
+
* and `backend` scopes the BROWSER store only (`opfs` default; Node/`file` and `memory` clones
|
|
271
|
+
* unaffected). Validated at {@link defineSyncRegistry} (fail-closed at module-eval); carried through on
|
|
272
|
+
* the returned registry and read back with {@link getSyncRegistryStorage}. See {@link SyncStorageDeclaration}.
|
|
273
|
+
*/
|
|
274
|
+
storage?: SyncStorageDeclaration;
|
|
267
275
|
}
|
|
268
276
|
export declare const syncRegistrySchemaSymbol: unique symbol;
|
|
277
|
+
export declare const syncRegistryStorageSymbol: unique symbol;
|
|
269
278
|
export type RegistryTables<TRegistry extends SyncTableRegistry> = {
|
|
270
279
|
[TKey in keyof TRegistry]: TRegistry[TKey]["table"];
|
|
271
280
|
};
|
|
@@ -679,7 +688,7 @@ export declare function defineReadProjection<const TOwnerTable extends AnyPgTabl
|
|
|
679
688
|
/** Column keys (of the owner) to sync locally + fetch from Electric. The PK is always kept. Omit → all. */
|
|
680
689
|
columns?: TColumns;
|
|
681
690
|
/** Row filter for this shape; the callback form receives the owner's full (physical) columns. */
|
|
682
|
-
rowFilter?:
|
|
691
|
+
rowFilter?: (columns: TableColumnsShape<TOwnerTable>) => RowFilterSpec;
|
|
683
692
|
/**
|
|
684
693
|
* Server-side egress projection (ADR-0004) for THIS shape — typically a `rowTransform` that redacts a
|
|
685
694
|
* sub-document of a kept column conditionally on row data. A projection does NOT inherit its owner's
|
|
@@ -758,5 +767,20 @@ export declare function getLocalSyncedTablePrimaryKeyColumns<TTable extends AnyP
|
|
|
758
767
|
export declare function resolveServerVersionColumnName<TTable extends AnyPgTable>(entry: SyncTableEntry<TTable>): string | undefined;
|
|
759
768
|
export declare function attachSyncRegistrySchema<TRegistry extends SyncTableRegistry>(registry: TRegistry, schema?: string): TRegistry;
|
|
760
769
|
export declare function getSyncRegistrySchema<TRegistry extends SyncTableRegistry>(registry: TRegistry): string;
|
|
770
|
+
/**
|
|
771
|
+
* Stamp the registry's storage declaration (ADR-0049 decision 1, ADR-0047) onto the registry value as a
|
|
772
|
+
* non-enumerable symbol — the storage twin of {@link attachSyncRegistrySchema}. Carries the data-contract
|
|
773
|
+
* storage through {@link defineSyncRegistry} so client code reads it back via {@link getSyncRegistryStorage}.
|
|
774
|
+
* A `null`/`undefined` declaration attaches nothing (the bare-registry-map overload), leaving the reader to
|
|
775
|
+
* resolve the ADR-0047 defaults at the mint seam.
|
|
776
|
+
*/
|
|
777
|
+
export declare function attachSyncRegistryStorage<TRegistry extends SyncTableRegistry>(registry: TRegistry, storage: SyncStorageDeclaration | undefined): TRegistry;
|
|
778
|
+
/**
|
|
779
|
+
* Read the storage declaration (ADR-0049 decision 1, ADR-0047) a registry was built with, or `undefined`
|
|
780
|
+
* when none was declared (a bare registry map, or a definition with no `storage`). The client resolves the
|
|
781
|
+
* effective mint durability as `getSyncRegistryStorage(registry)?.durability ?? "relaxed"` at its single
|
|
782
|
+
* mint seam — the storage twin of {@link getSyncRegistrySchema}.
|
|
783
|
+
*/
|
|
784
|
+
export declare function getSyncRegistryStorage<TRegistry extends SyncTableRegistry>(registry: TRegistry): SyncStorageDeclaration | undefined;
|
|
761
785
|
export {};
|
|
762
786
|
//# sourceMappingURL=registry.d.ts.map
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAQL,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,yBAAyB,EAC9B,KAAK,QAAQ,EACb,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,MAAM,EACX,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAChB,MAAM,qBAAqB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cAAc,CAAC,MAAM,CAAC,YAEtG;AAED,wBAAgB,oCAAoC,CAAC,MAAM,SAAS,UAAU,EAAE,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,YAE5G;AAED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,SAAS,UAAU,EACtE,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,GAC5B,MAAM,GAAG,SAAS,CAapB;AAED,wBAAgB,wBAAwB,CAAC,SAAS,SAAS,iBAAiB,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,aAwCjH;AAED,wBAAgB,qBAAqB,CAAC,SAAS,SAAS,iBAAiB,EAAE,QAAQ,EAAE,SAAS,UAG7F;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,SAAS,iBAAiB,EAC3E,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,sBAAsB,GAAG,SAAS,aA0B5C;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,SAAS,iBAAiB,EACxE,QAAQ,EAAE,SAAS,GAClB,sBAAsB,GAAG,SAAS,CAGpC"}
|
package/dist/runtime.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export interface MutationDiagnostics {
|
|
|
43
43
|
lastAckAtUs?: string;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
|
-
* A registry-wide mutation-journal summary
|
|
46
|
+
* A registry-wide mutation-journal summary for warm-store observability: the
|
|
47
47
|
* per-status counts across EVERY writable table's journal, folded from one aggregate query/subscription over
|
|
48
48
|
* the `pgxsinkit_all_mutations` view — so a consumer renders a global sync indicator with ONE subscription
|
|
49
49
|
* instead of one live query per writable journal. Cheap enough to mount permanently.
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ description: >-
|
|
|
15
15
|
metadata:
|
|
16
16
|
type: core
|
|
17
17
|
library: "@pgxsinkit/contracts"
|
|
18
|
-
library_version: "0.
|
|
18
|
+
library_version: "0.2.0"
|
|
19
19
|
source: https://pgxsinkit.github.io/start/getting-started/
|
|
20
20
|
---
|
|
21
21
|
|
|
@@ -65,16 +65,18 @@ sync's sake.
|
|
|
65
65
|
## The `primaryKey` spec emits the physical PRIMARY KEY — it is the single source of truth
|
|
66
66
|
|
|
67
67
|
`defineSyncTable` **emits** the `primaryKey` spec as the server table's physical `PRIMARY KEY` constraint,
|
|
68
|
-
named `` `${tableName}_pkey` ``
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
named `` `${tableName}_pkey` `` — Postgres's default inline-PK constraint name (which drizzle's own naming
|
|
69
|
+
does not produce), so DDL declared through pgxsinkit agrees with plain-Postgres inline-PK DDL and
|
|
70
|
+
drizzle-kit sees no rename churn against a real Postgres database. The spec was runtime-only metadata
|
|
71
|
+
until a consumer had drizzle-kit DROP a live composite key — seeing no PK in the generated DDL — so the
|
|
72
|
+
spec now drives DDL directly.
|
|
71
73
|
|
|
72
74
|
- **Composite / non-`id` key:** `primaryKey: ["org_id", "person_id"]` (default `["id"]`). Constraint
|
|
73
75
|
columns follow spec order.
|
|
74
76
|
- **Custom constraint name:** the object form `primaryKey: { name: "org_person_pk", columns: [...] }`.
|
|
75
77
|
- **Single-column key, idiomatic drizzle:** declaring `id: uuid("id").primaryKey()` on the column is
|
|
76
78
|
allowed and equivalent — it must match the spec, and emission is skipped (the column already carries
|
|
77
|
-
the constraint), so
|
|
79
|
+
the constraint), so a single-`id` table's DDL agrees with plain-Postgres inline-PK DDL. A custom constraint name
|
|
78
80
|
cannot be combined with a column-level `.primaryKey()` (a named constraint needs `defineSyncTable` to
|
|
79
81
|
emit it).
|
|
80
82
|
- **Rejected:** a table-level `primaryKey(...)` passed through `extras`/`policies`, and more than one
|
|
@@ -181,11 +183,10 @@ defineSyncTable({
|
|
|
181
183
|
});
|
|
182
184
|
```
|
|
183
185
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
`DENY_ALL` the obvious deny.
|
|
186
|
+
The column callback is the only authoring form. **Prefer a typed SQL fragment over the raw string escape
|
|
187
|
+
hatch:** a `customWhere` that returns `null`/`""` means _no filter — all rows visible_, so an owner filter
|
|
188
|
+
that returns `null` for "no claim" silently exposes every row; the typed form makes `DENY_ALL` the obvious
|
|
189
|
+
deny.
|
|
189
190
|
|
|
190
191
|
## Cross-table filters: compose a self-contained subquery from the typed columns, never a string
|
|
191
192
|
|
|
@@ -375,6 +376,28 @@ no transform but records the raw-egress decision at the definition site). `"unre
|
|
|
375
376
|
transform-less owner is itself rejected — a stale opt-out would silently pre-authorize a leak if the owner
|
|
376
377
|
later gains a transform.
|
|
377
378
|
|
|
379
|
+
## Storage declaration: `storage.backend` and `storage.durability` (browser stores)
|
|
380
|
+
|
|
381
|
+
The registry carries the browser store's storage contract — `SyncRegistryDefinition.storage`,
|
|
382
|
+
`{ backend?: "opfs" | "idbfs"; durability?: "relaxed" | "strict" }`. It lives on the registry, not on a
|
|
383
|
+
minting surface, worker entry, or attach site, because both properties follow the DATA: one declaration
|
|
384
|
+
binds every open of every store minted from that registry, so no tab can disagree with another.
|
|
385
|
+
|
|
386
|
+
- **`backend`** (default `"opfs"`) — `"opfs"` is the normal boot on every platform: the toolkit probes
|
|
387
|
+
OPFS sync-access at boot and runs the `opfs-repacked` engine wherever handles are granted, falling back
|
|
388
|
+
automatically to in-SharedWorker idbfs (declared durability kept) only where the platform provides no
|
|
389
|
+
OPFS sync access anywhere. `backend: "idbfs"` is the one opt-out — no probe, no election, the engine
|
|
390
|
+
boots in the SharedWorker on idb. Where the engine runs is never a consumer knob; the only decision you
|
|
391
|
+
declare is whether to force idb.
|
|
392
|
+
- **`durability`** (default `"relaxed"`) — relaxed returns the local write before the physical flush and
|
|
393
|
+
schedules it asynchronously; `"strict"` awaits the flush per commit. Relaxed is the right default for a
|
|
394
|
+
sync toolkit (the local write is instant, the server is the source of truth, and the loss window is one
|
|
395
|
+
recent action); declare `"strict"` only for local-only data you cannot re-derive and cannot lose on a
|
|
396
|
+
crash. See ADR-0047.
|
|
397
|
+
|
|
398
|
+
The declaration scopes the **browser** store only; Node mints stay `file://` and throwaway export clones
|
|
399
|
+
stay memory (environment resolution is orthogonal).
|
|
400
|
+
|
|
378
401
|
## Consistency groups: scope them to the joined cluster
|
|
379
402
|
|
|
380
403
|
`consistencyGroup` binds tables onto one shape stream committing **atomically** at a shared LSN
|
package/src/config.ts
CHANGED
|
@@ -12,14 +12,15 @@ export type TableMode = "readonly" | "writeonly" | "readwrite";
|
|
|
12
12
|
* interleaved). It is a **required** declaration on every writable table; there is no silent default
|
|
13
13
|
* (registry validation rejects an undeclared writable table — the third hard-require). v1:
|
|
14
14
|
*
|
|
15
|
-
* - `last-write-wins` — apply the stale write anyway.
|
|
16
|
-
*
|
|
15
|
+
* - `last-write-wins` — apply the stale write anyway. A required, named declaration: the toolkit never
|
|
16
|
+
* silently clobbers under an unspecified default, so choosing this is an explicit acceptance of the
|
|
17
|
+
* stale-overwrite semantics.
|
|
17
18
|
* - `reject-if-stale` — do not apply; surface the conflict so the user's edit is kept (the optimistic
|
|
18
19
|
* Overlay stays, marked conflicted) and resolved as a new write.
|
|
19
20
|
*
|
|
20
21
|
* `field-merge` (apply only the changed fields over the current row) and `custom-resolver` (a client
|
|
21
|
-
* re-resolution protocol) are reserved
|
|
22
|
-
*
|
|
22
|
+
* re-resolution protocol) are reserved values for future policies — declared here so the policy surface
|
|
23
|
+
* names its full intended range.
|
|
23
24
|
*/
|
|
24
25
|
export type ConflictPolicy = "last-write-wins" | "reject-if-stale";
|
|
25
26
|
|
|
@@ -99,6 +100,59 @@ export function isWriteMode(value: unknown): value is WriteMode {
|
|
|
99
100
|
return typeof value === "string" && (WRITE_MODES as readonly string[]).includes(value);
|
|
100
101
|
}
|
|
101
102
|
|
|
103
|
+
/**
|
|
104
|
+
* The registry-declared BROWSER storage backend (ADR-0049 decision 1). `opfs` (default) is the store's
|
|
105
|
+
* normal boot on every platform — the capability machinery selects the `opfs-repacked` VFS where a home
|
|
106
|
+
* can hold sync-access handles, and falls back to in-SharedWorker `idbfs` when no home can. `idbfs` is the
|
|
107
|
+
* one way to opt out of that machinery entirely: no probe, no election, the engine boots on idb.
|
|
108
|
+
*
|
|
109
|
+
* Scopes the BROWSER store only. Environment resolution is orthogonal and unchanged (ADR-0049 decision 14):
|
|
110
|
+
* a Node mint stays `file://` and the export clone stays memory regardless of this declaration.
|
|
111
|
+
*/
|
|
112
|
+
export type StorageBackend = "opfs" | "idbfs";
|
|
113
|
+
|
|
114
|
+
/** The {@link StorageBackend} values. Source of truth for {@link SyncStorageDeclaration} validation. */
|
|
115
|
+
export const STORAGE_BACKENDS = ["opfs", "idbfs"] as const satisfies readonly StorageBackend[];
|
|
116
|
+
|
|
117
|
+
/** Type guard: is `value` a {@link StorageBackend}? */
|
|
118
|
+
export function isStorageBackend(value: unknown): value is StorageBackend {
|
|
119
|
+
return typeof value === "string" && (STORAGE_BACKENDS as readonly string[]).includes(value);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The registry-declared durability mode (ADR-0047; ADR-0049 decision 9). `relaxed` (default) returns a
|
|
124
|
+
* write before its durable flush and schedules the flush asynchronously — the local-first "instant write"
|
|
125
|
+
* the toolkit exists to deliver. `strict` reinstates the synchronous flush boundary (a ~50ms+ per-statement
|
|
126
|
+
* floor on idb; cheap on `opfs-repacked`). It binds EVERY open of EVERY store minted from the registry, so
|
|
127
|
+
* no minting/open site takes a durability option to contradict it, and an opfs→idbfs capability fallback
|
|
128
|
+
* keeps the declared mode.
|
|
129
|
+
*/
|
|
130
|
+
export type StorageDurability = "relaxed" | "strict";
|
|
131
|
+
|
|
132
|
+
/** The {@link StorageDurability} values. Source of truth for {@link SyncStorageDeclaration} validation. */
|
|
133
|
+
export const STORAGE_DURABILITIES = ["relaxed", "strict"] as const satisfies readonly StorageDurability[];
|
|
134
|
+
|
|
135
|
+
/** Type guard: is `value` a {@link StorageDurability}? */
|
|
136
|
+
export function isStorageDurability(value: unknown): value is StorageDurability {
|
|
137
|
+
return typeof value === "string" && (STORAGE_DURABILITIES as readonly string[]).includes(value);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The registry's storage contract (ADR-0049 decision 1, ADR-0047). Storage is PART OF THE DATA CONTRACT:
|
|
142
|
+
* whether losing the last not-yet-flushed action is acceptable, and whether OPFS may be used at all, is
|
|
143
|
+
* decided by what the data IS — so it is declared once on the registry, not at any minting/open site.
|
|
144
|
+
*
|
|
145
|
+
* - {@link StorageDurability durability} defaults to `"relaxed"` and binds every toolkit-minted open of
|
|
146
|
+
* every store the registry mints (its own boot AND the provision/spare path). No open-site option exists
|
|
147
|
+
* to contradict it; a capability fallback keeps the declared mode. A no-op on `memory` clones.
|
|
148
|
+
* - {@link StorageBackend backend} defaults to `"opfs"` and scopes the BROWSER store only; Node/`file` and
|
|
149
|
+
* `memory` clones are unaffected. `"idbfs"` opts the store out of the capability/election machinery.
|
|
150
|
+
*/
|
|
151
|
+
export interface SyncStorageDeclaration {
|
|
152
|
+
backend?: StorageBackend;
|
|
153
|
+
durability?: StorageDurability;
|
|
154
|
+
}
|
|
155
|
+
|
|
102
156
|
/**
|
|
103
157
|
* Minimal verified-JWT claim shape the sync layer understands. Providers may
|
|
104
158
|
* attach arbitrary extra claims; those stay reachable through index access and
|
|
@@ -316,21 +370,6 @@ export interface RowFilterSpec {
|
|
|
316
370
|
revision?: string | number;
|
|
317
371
|
}
|
|
318
372
|
|
|
319
|
-
/**
|
|
320
|
-
* The non-parameterized inline `where` for a filter: the string a `customWhere` returns (the raw
|
|
321
|
-
* escape hatch), or `null` when there is no filter or `customWhere` returns a Drizzle `SQL` fragment
|
|
322
|
-
* (which is parameterized by {@link buildRowFilterShape}, not inlined here). Most callers want
|
|
323
|
-
* `buildRowFilterShape` — this is the inline-string view it composes from.
|
|
324
|
-
*/
|
|
325
|
-
export function buildRowFilterWhere(
|
|
326
|
-
filter: RowFilterSpec,
|
|
327
|
-
claims: JwtClaims | null,
|
|
328
|
-
params?: Record<string, unknown>,
|
|
329
|
-
): string | null {
|
|
330
|
-
const custom = filter.customWhere?.(claims ?? {}, params);
|
|
331
|
-
return typeof custom === "string" && custom ? custom : null;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
373
|
/**
|
|
335
374
|
* A **bare** (table-unqualified) quoted identifier for a Drizzle column — `"workspace_id"`, never
|
|
336
375
|
* `"work_items"."workspace_id"`. Electric's shape `where` grammar requires *plain* column references
|
package/src/mutation.ts
CHANGED
|
@@ -49,8 +49,7 @@ export const mutationEnvelopeSchema = z
|
|
|
49
49
|
* at enqueue for a chain head, or its predecessor's resolved version for a chained write. The
|
|
50
50
|
* applier compares the row's *current* Server version to it — `current > base` ⇒ a stale write
|
|
51
51
|
* (an external write interleaved). Absent on a `create` (its conflict is a PK collision, a
|
|
52
|
-
* separate concern) and on
|
|
53
|
-
* check runs.
|
|
52
|
+
* separate concern) and on blind authoritative writes; absence means no stale check runs.
|
|
54
53
|
*/
|
|
55
54
|
baseServerVersion: unixMicrosecondsSchema.optional(),
|
|
56
55
|
})
|
package/src/registry.ts
CHANGED
|
@@ -29,9 +29,13 @@ import {
|
|
|
29
29
|
CONFLICT_POLICIES,
|
|
30
30
|
isConflictPolicy,
|
|
31
31
|
isRetention,
|
|
32
|
+
isStorageBackend,
|
|
33
|
+
isStorageDurability,
|
|
32
34
|
isSubscriptionTiming,
|
|
33
35
|
isWriteMode,
|
|
34
36
|
RETENTIONS,
|
|
37
|
+
STORAGE_BACKENDS,
|
|
38
|
+
STORAGE_DURABILITIES,
|
|
35
39
|
SUBSCRIPTION_TIMINGS,
|
|
36
40
|
WRITE_MODES,
|
|
37
41
|
type ClientProjectionSpec,
|
|
@@ -47,6 +51,7 @@ import {
|
|
|
47
51
|
type ShapeSpec,
|
|
48
52
|
type ShapeSpecInput,
|
|
49
53
|
type SubscriptionTiming,
|
|
54
|
+
type SyncStorageDeclaration,
|
|
50
55
|
type TableGovernanceSpec as TableGovernanceSpecBase,
|
|
51
56
|
type TableMode,
|
|
52
57
|
type WriteMode,
|
|
@@ -142,8 +147,9 @@ export interface SyncTableEntry<TTable extends AnyPgTable = AnyPgTable, TLocalTa
|
|
|
142
147
|
* Consistency group (ADR-0009 decision 2). Tables sharing a `consistencyGroup` are synced on one
|
|
143
148
|
* `MultiShapeStream` and committed atomically at a shared LSN frontier, so a local reader never
|
|
144
149
|
* sees one grouped table advanced past another for the same server transaction. Omitted → the
|
|
145
|
-
* table is its own singleton group (independent frontier,
|
|
146
|
-
*
|
|
150
|
+
* table is its own singleton group (independent frontier, no cross-table atomicity — the resolution
|
|
151
|
+
* for a table that declares no group). The latency cost (a group advances only as fast as its
|
|
152
|
+
* slowest shape) is contained to the tables that opt in.
|
|
147
153
|
*/
|
|
148
154
|
consistencyGroup?: string;
|
|
149
155
|
/**
|
|
@@ -273,17 +279,16 @@ export type SyncTableInputProjection<
|
|
|
273
279
|
};
|
|
274
280
|
|
|
275
281
|
/**
|
|
276
|
-
* A row filter for {@link defineSyncTable}'s `shape
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
* rename-safe column objects instead of hand-written column-name strings.
|
|
282
|
+
* A row filter for {@link defineSyncTable}'s `shape`, authored from the table's built, typed columns.
|
|
283
|
+
* Reference columns through `c(columns.x)` exactly as `extras` does with its `self` argument, so
|
|
284
|
+
* `customWhere` builds parameterized Electric `where`s from real, rename-safe column objects instead
|
|
285
|
+
* of hand-written column-name strings.
|
|
281
286
|
*/
|
|
282
|
-
export type RowFilterInput<TColumns extends Record<string, ColumnBuilderBase>> =
|
|
283
|
-
|
|
284
|
-
|
|
287
|
+
export type RowFilterInput<TColumns extends Record<string, ColumnBuilderBase>> = (
|
|
288
|
+
columns: PgBuildExtraConfigColumns<TColumns>,
|
|
289
|
+
) => RowFilterSpec;
|
|
285
290
|
|
|
286
|
-
/** {@link ShapeSpecInput} whose `rowFilter`
|
|
291
|
+
/** {@link ShapeSpecInput} whose `rowFilter` is authored from the built columns (typed by `TColumns`). */
|
|
287
292
|
export type ShapeSpecInputFor<TColumns extends Record<string, ColumnBuilderBase>> = Omit<
|
|
288
293
|
ShapeSpecInput,
|
|
289
294
|
"rowFilter"
|
|
@@ -379,10 +384,20 @@ export type SyncTableRegistry = Record<string, SyncTableEntry>;
|
|
|
379
384
|
export interface SyncRegistryDefinition<TRegistry extends SyncTableRegistry> {
|
|
380
385
|
schema?: string;
|
|
381
386
|
tables: TRegistry;
|
|
387
|
+
/**
|
|
388
|
+
* The storage contract for every store this registry mints (ADR-0049 decision 1, ADR-0047). Part of the
|
|
389
|
+
* DATA contract, not a per-open knob: `durability` binds every toolkit-minted open (relaxed default),
|
|
390
|
+
* and `backend` scopes the BROWSER store only (`opfs` default; Node/`file` and `memory` clones
|
|
391
|
+
* unaffected). Validated at {@link defineSyncRegistry} (fail-closed at module-eval); carried through on
|
|
392
|
+
* the returned registry and read back with {@link getSyncRegistryStorage}. See {@link SyncStorageDeclaration}.
|
|
393
|
+
*/
|
|
394
|
+
storage?: SyncStorageDeclaration;
|
|
382
395
|
}
|
|
383
396
|
|
|
384
397
|
export const syncRegistrySchemaSymbol = Symbol.for("@pgxsinkit/contracts/syncRegistrySchema");
|
|
385
398
|
|
|
399
|
+
export const syncRegistryStorageSymbol = Symbol.for("@pgxsinkit/contracts/syncRegistryStorage");
|
|
400
|
+
|
|
386
401
|
export type RegistryTables<TRegistry extends SyncTableRegistry> = {
|
|
387
402
|
[TKey in keyof TRegistry]: TRegistry[TKey]["table"];
|
|
388
403
|
};
|
|
@@ -577,14 +592,11 @@ export function defineSyncTable<
|
|
|
577
592
|
: undefined;
|
|
578
593
|
const table = schema ? schema.table(tableName, makeColumns(), extrasFn) : pgTable(tableName, makeColumns(), extrasFn);
|
|
579
594
|
|
|
580
|
-
//
|
|
581
|
-
//
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
typeof shape?.rowFilter === "function"
|
|
586
|
-
? shape.rowFilter(getColumns(table) as unknown as PgBuildExtraConfigColumns<ReturnType<typeof makeColumns>>)
|
|
587
|
-
: (shape?.rowFilter ?? undefined);
|
|
595
|
+
// Resolve `shape.rowFilter` against the built typed columns so all authoring uses rename-safe
|
|
596
|
+
// Drizzle column objects rather than hand-written column-name strings.
|
|
597
|
+
const resolvedRowFilter = shape?.rowFilter?.(
|
|
598
|
+
getColumns(table) as unknown as PgBuildExtraConfigColumns<ReturnType<typeof makeColumns>>,
|
|
599
|
+
);
|
|
588
600
|
const resolvedShape: ShapeSpec | undefined =
|
|
589
601
|
resolvedMode !== "writeonly" || shape != null
|
|
590
602
|
? {
|
|
@@ -725,7 +737,7 @@ export function defineReadProjection<
|
|
|
725
737
|
/** Column keys (of the owner) to sync locally + fetch from Electric. The PK is always kept. Omit → all. */
|
|
726
738
|
columns?: TColumns;
|
|
727
739
|
/** Row filter for this shape; the callback form receives the owner's full (physical) columns. */
|
|
728
|
-
rowFilter?:
|
|
740
|
+
rowFilter?: (columns: TableColumnsShape<TOwnerTable>) => RowFilterSpec;
|
|
729
741
|
/**
|
|
730
742
|
* Server-side egress projection (ADR-0004) for THIS shape — typically a `rowTransform` that redacts a
|
|
731
743
|
* sub-document of a kept column conditionally on row data. A projection does NOT inherit its owner's
|
|
@@ -882,10 +894,7 @@ export function defineReadProjection<
|
|
|
882
894
|
|
|
883
895
|
// Resolve the row filter against the OWNER's full columns (the customWhere runs in Electric on the
|
|
884
896
|
// physical table, so it may reference a column the subset omits).
|
|
885
|
-
const resolvedRowFilter
|
|
886
|
-
typeof opts.rowFilter === "function"
|
|
887
|
-
? opts.rowFilter(getColumns(owner.table) as unknown as TableColumnsShape<TOwnerTable>)
|
|
888
|
-
: opts.rowFilter;
|
|
897
|
+
const resolvedRowFilter = opts.rowFilter?.(getColumns(owner.table) as unknown as TableColumnsShape<TOwnerTable>);
|
|
889
898
|
|
|
890
899
|
// When a subset is requested, set the Electric `columns` allow-list to the KEPT physical column names
|
|
891
900
|
// so an omitted (e.g. heavy jsonb) column is never fetched over the wire — not merely stripped after.
|
|
@@ -957,8 +966,14 @@ export function defineSyncRegistry<const TRegistry extends { [TKey in keyof TReg
|
|
|
957
966
|
}
|
|
958
967
|
validateRegistryTableUniqueness(input.tables);
|
|
959
968
|
validateRegistryLifecycleGroups(input.tables);
|
|
960
|
-
|
|
961
|
-
|
|
969
|
+
validateStorageDeclaration(input.storage);
|
|
970
|
+
|
|
971
|
+
// Schema first (it may return the same tables object), then stamp the storage declaration on the
|
|
972
|
+
// returned registry as a non-enumerable symbol — the same carrier pattern as the schema symbol — so
|
|
973
|
+
// client code reads the data-contract storage back off the registry value (getSyncRegistrySchema's
|
|
974
|
+
// twin, getSyncRegistryStorage). The bare-registry-map overload carries no storage and reads back
|
|
975
|
+
// `undefined`, which resolves to the ADR-0047 defaults at the mint seam.
|
|
976
|
+
return attachSyncRegistryStorage(attachSyncRegistrySchema(input.tables, input.schema), input.storage);
|
|
962
977
|
}
|
|
963
978
|
|
|
964
979
|
for (const entry of getRegistryEntries(input)) {
|
|
@@ -1173,15 +1188,10 @@ export function resolveServerVersionColumnName<TTable extends AnyPgTable>(
|
|
|
1173
1188
|
return undefined;
|
|
1174
1189
|
}
|
|
1175
1190
|
|
|
1191
|
+
// `field.column` is the drizzle property key (registry validation rejects a column-name declaration —
|
|
1192
|
+
// ADR-0012); resolve it to the underlying SQL column name.
|
|
1176
1193
|
const columns = getColumns(entry.table);
|
|
1177
|
-
|
|
1178
|
-
const byProperty = (columns as Record<string, { name: string } | undefined>)[field.column as string];
|
|
1179
|
-
if (byProperty) {
|
|
1180
|
-
return byProperty.name;
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
// Defensive: a managed field declared by column name rather than property key.
|
|
1184
|
-
return Object.values(columns).find((column) => column.name === field.column)?.name;
|
|
1194
|
+
return (columns as Record<string, { name: string } | undefined>)[field.column as string]?.name;
|
|
1185
1195
|
}
|
|
1186
1196
|
|
|
1187
1197
|
export function attachSyncRegistrySchema<TRegistry extends SyncTableRegistry>(registry: TRegistry, schema?: string) {
|
|
@@ -1231,6 +1241,77 @@ export function getSyncRegistrySchema<TRegistry extends SyncTableRegistry>(regis
|
|
|
1231
1241
|
return typeof schema === "string" && schema.length > 0 ? schema : "public";
|
|
1232
1242
|
}
|
|
1233
1243
|
|
|
1244
|
+
/**
|
|
1245
|
+
* Stamp the registry's storage declaration (ADR-0049 decision 1, ADR-0047) onto the registry value as a
|
|
1246
|
+
* non-enumerable symbol — the storage twin of {@link attachSyncRegistrySchema}. Carries the data-contract
|
|
1247
|
+
* storage through {@link defineSyncRegistry} so client code reads it back via {@link getSyncRegistryStorage}.
|
|
1248
|
+
* A `null`/`undefined` declaration attaches nothing (the bare-registry-map overload), leaving the reader to
|
|
1249
|
+
* resolve the ADR-0047 defaults at the mint seam.
|
|
1250
|
+
*/
|
|
1251
|
+
export function attachSyncRegistryStorage<TRegistry extends SyncTableRegistry>(
|
|
1252
|
+
registry: TRegistry,
|
|
1253
|
+
storage: SyncStorageDeclaration | undefined,
|
|
1254
|
+
) {
|
|
1255
|
+
if (storage == null) {
|
|
1256
|
+
return registry;
|
|
1257
|
+
}
|
|
1258
|
+
// Idempotent for an EQUAL declaration (a registry value reused across constructions may be re-stamped with
|
|
1259
|
+
// the same contract) but fail-closed on a CONFLICT — two different storage contracts over one registry is a
|
|
1260
|
+
// definition error, never silently resolved. `backend`/`durability` are the only fields, so a shallow
|
|
1261
|
+
// compare is exhaustive.
|
|
1262
|
+
const existing = getSyncRegistryStorage(registry);
|
|
1263
|
+
if (existing != null) {
|
|
1264
|
+
if (existing.backend !== storage.backend || existing.durability !== storage.durability) {
|
|
1265
|
+
throw new Error(
|
|
1266
|
+
`conflicting storage declaration for registry: already ${JSON.stringify(existing)}, cannot re-declare ` +
|
|
1267
|
+
`${JSON.stringify(storage)}`,
|
|
1268
|
+
);
|
|
1269
|
+
}
|
|
1270
|
+
return registry;
|
|
1271
|
+
}
|
|
1272
|
+
Object.defineProperty(registry, syncRegistryStorageSymbol, {
|
|
1273
|
+
value: storage,
|
|
1274
|
+
enumerable: false,
|
|
1275
|
+
configurable: false,
|
|
1276
|
+
writable: false,
|
|
1277
|
+
});
|
|
1278
|
+
return registry;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
/**
|
|
1282
|
+
* Read the storage declaration (ADR-0049 decision 1, ADR-0047) a registry was built with, or `undefined`
|
|
1283
|
+
* when none was declared (a bare registry map, or a definition with no `storage`). The client resolves the
|
|
1284
|
+
* effective mint durability as `getSyncRegistryStorage(registry)?.durability ?? "relaxed"` at its single
|
|
1285
|
+
* mint seam — the storage twin of {@link getSyncRegistrySchema}.
|
|
1286
|
+
*/
|
|
1287
|
+
export function getSyncRegistryStorage<TRegistry extends SyncTableRegistry>(
|
|
1288
|
+
registry: TRegistry,
|
|
1289
|
+
): SyncStorageDeclaration | undefined {
|
|
1290
|
+
const storage = Reflect.get(registry, syncRegistryStorageSymbol) as unknown;
|
|
1291
|
+
return storage != null && typeof storage === "object" ? (storage as SyncStorageDeclaration) : undefined;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
/**
|
|
1295
|
+
* Fail-closed at module-eval (ADR-0049 decision 1): a declared `storage.backend` / `storage.durability` must
|
|
1296
|
+
* be a known value, matching how the other registry axes reject bad input at `defineSyncRegistry`. An absent
|
|
1297
|
+
* declaration or absent field is fine — it resolves to the ADR-0047 defaults (`opfs` / `relaxed`).
|
|
1298
|
+
*/
|
|
1299
|
+
function validateStorageDeclaration(storage: SyncStorageDeclaration | undefined) {
|
|
1300
|
+
if (storage == null) {
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1303
|
+
if (storage.backend !== undefined && !isStorageBackend(storage.backend)) {
|
|
1304
|
+
throw new Error(
|
|
1305
|
+
`invalid storage.backend "${String(storage.backend)}": must be one of ${STORAGE_BACKENDS.join(", ")}`,
|
|
1306
|
+
);
|
|
1307
|
+
}
|
|
1308
|
+
if (storage.durability !== undefined && !isStorageDurability(storage.durability)) {
|
|
1309
|
+
throw new Error(
|
|
1310
|
+
`invalid storage.durability "${String(storage.durability)}": must be one of ${STORAGE_DURABILITIES.join(", ")}`,
|
|
1311
|
+
);
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1234
1315
|
function isSyncRegistryDefinition<TRegistry extends SyncTableRegistry>(
|
|
1235
1316
|
input: TRegistry | SyncRegistryDefinition<TRegistry>,
|
|
1236
1317
|
): input is SyncRegistryDefinition<TRegistry> {
|
|
@@ -1326,11 +1407,25 @@ function validateSyncTableEntry(entry: SyncTableEntry<AnyPgTable>) {
|
|
|
1326
1407
|
);
|
|
1327
1408
|
}
|
|
1328
1409
|
|
|
1410
|
+
// A managed field's `column` is the drizzle PROPERTY KEY of the target column, never its SQL column
|
|
1411
|
+
// name — ADR-0012 keeps the two distinct. Both consumers resolve by property key and canonicalise to
|
|
1412
|
+
// it (the client stamp in mutation.ts, the Server-version resolve in resolveServerVersionColumnName);
|
|
1413
|
+
// neither tolerates a column-name spelling. So a declaration that names the SQL column instead of the
|
|
1414
|
+
// property must fail HERE, at the boundary where declarations enter, rather than silently
|
|
1415
|
+
// half-resolving downstream.
|
|
1416
|
+
const managedFieldPropertyKeys = new Set(Object.keys(getColumns(entry.table)));
|
|
1417
|
+
|
|
1329
1418
|
// The single claim-stamping strategy (ADR-0026): an `authClaim` managed field reads a value from the
|
|
1330
1419
|
// verified request claims at a JSON path, emitted into the apply-function DDL — so the path segments
|
|
1331
1420
|
// must be plain identifiers and any cast a plain type name (never a value-injection surface). A
|
|
1332
1421
|
// non-authClaim field carrying claimPath/cast is an authoring slip; reject it rather than ignore it.
|
|
1333
1422
|
for (const field of entry.governance?.managedFields ?? []) {
|
|
1423
|
+
if (!managedFieldPropertyKeys.has(field.column as string)) {
|
|
1424
|
+
throw new Error(
|
|
1425
|
+
`managed field ${tableName}.${String(field.column)} names an unknown column: field.column must be the ` +
|
|
1426
|
+
`drizzle PROPERTY KEY of the target column, not its SQL column name (ADR-0012)`,
|
|
1427
|
+
);
|
|
1428
|
+
}
|
|
1334
1429
|
if (field.strategy === "authClaim") {
|
|
1335
1430
|
if (!Array.isArray(field.claimPath) || field.claimPath.length === 0) {
|
|
1336
1431
|
throw new Error(
|