@pgxsinkit/contracts 0.2.7 → 0.3.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 CHANGED
@@ -1,5 +1,6 @@
1
- import { type AnyColumn, type SQL } from "drizzle-orm";
1
+ import type { AnyColumn } from "drizzle-orm";
2
2
  import { z } from "zod";
3
+ import { type Predicate } from "./predicate";
3
4
  export type TableMode = "readonly" | "writeonly" | "readwrite";
4
5
  /**
5
6
  * The per-writable-table Conflict policy (ADR-0015): what happens to a **stale** write — one whose
@@ -23,7 +24,7 @@ export declare const CONFLICT_POLICIES: readonly ["last-write-wins", "reject-if-
23
24
  /** Type guard: is `value` one of the v1 {@link ConflictPolicy} values? */
24
25
  export declare function isConflictPolicy(value: unknown): value is ConflictPolicy;
25
26
  /**
26
- * Subscription timing for a synced table (ADR-0021): **when** its Electric shape subscribes.
27
+ * Subscription timing for a synced table (ADR-0021): **when** its read-path shape subscribes.
27
28
  *
28
29
  * - `eager` (default) — subscribed in the boot set, as today.
29
30
  * - `lazy` — excluded from boot; subscribed on first query-reference. With `persistent` retention,
@@ -31,7 +32,8 @@ export declare function isConflictPolicy(value: unknown): value is ConflictPolic
31
32
  * sessions; with `ephemeral` retention it is session-scoped.
32
33
  *
33
34
  * A property of the **consistency group**: every table sharing a `consistencyGroup` must agree, since
34
- * a group commits atomically on one `MultiShapeStream` and cannot be partly lazy (ADR-0021 §4).
35
+ * a group's streams commit atomically together — all up-to-date, then one transaction (ADR-0056) — so
36
+ * it cannot be partly lazy (ADR-0021 §4).
35
37
  */
36
38
  export type SubscriptionTiming = "eager" | "lazy";
37
39
  /** The {@link SubscriptionTiming} values. Source of truth for registry validation. */
@@ -171,23 +173,83 @@ export interface ShapeSpec {
171
173
  /**
172
174
  * INTERNAL / resolved — the physical Postgres table this shape reads, when it differs from the
173
175
  * shape's own `tableName`. A read PROJECTION (`defineReadProjection`) sets it to the OWNING table's
174
- * name so several shapes can read one physical table under distinct `shapeKey`s; the engine resolves
175
- * an incoming request by `shapeKey` and consults this only on egress, to build the upstream Electric
176
- * `table` param. `attachSyncRegistrySchema` also fills/qualifies it for schema-bound registries.
176
+ * name so several shapes can read one physical table under distinct `shapeKey`s; the control plane
177
+ * resolves an incoming subscription by `shapeKey` and consults this only when it creates the shape, as
178
+ * the source `table` it hands the engine. `attachSyncRegistrySchema` also fills/qualifies it for
179
+ * schema-bound registries.
177
180
  *
178
181
  * Not a consumer input — there is no valid reason to hand-set it (it can only be redundant with, or
179
182
  * wrong about, the table you are reading), so it is omitted from {@link ShapeSpecInput}. The
180
183
  * combinator derives it from the owner; `defineSyncTable` never sets it from input.
181
184
  */
182
- electricTable?: string;
185
+ physicalTable?: string;
183
186
  rowFilter?: RowFilterSpec;
187
+ /**
188
+ * SHARED TIER (ADR-0055) — the scope columns, resolved to column names, whose values key this
189
+ * shape family. The predicate is *generated* as an `AND` of equalities over them, so disjointness
190
+ * is a property of the construction rather than something a checker has to enforce: a row carries
191
+ * exactly one value per scope column, so it falls in exactly one shape of the family, and an
192
+ * overlapping pair is not expressible at all.
193
+ *
194
+ * `NULL` is a legal scope value and compiles to `IS NULL` — which is how an offering-wide row gets
195
+ * its own scope `(O, null)` rather than appearing in every group's shape. The tempting
196
+ * `group_id IS NULL OR group_id = $G` form is not merely disallowed here; it is wrong, because it
197
+ * places one row in every group shape at once.
198
+ *
199
+ * Its presence is what makes this a shared-tier shape. Declaring it alongside `rowFilter` is
200
+ * refused at definition time — see {@link readShapeTier}.
201
+ */
202
+ scope?: readonly string[];
203
+ /**
204
+ * The **static** half of the shape's predicate: subscriber-independent, identical for every
205
+ * reader, and therefore safe in either tier. On the shared tier it is conjoined with the generated
206
+ * scope equalities; on the private tier, with whatever `rowFilter` resolves to for the subject.
207
+ *
208
+ * Native AST, not SQL text — see {@link Predicate}.
209
+ */
210
+ where?: Predicate;
184
211
  }
212
+ /** Which read tier a shape belongs to (ADR-0055 decision 2). */
213
+ export type ShapeTier = "shared" | "private";
214
+ /**
215
+ * The tier a shape declares, or a refusal.
216
+ *
217
+ * The tier is not configured; it is *read off* which field the author declared — `scope` for shared,
218
+ * `rowFilter` for private. That makes a shape's tier evident from its authoring and impossible to
219
+ * leave ambiguous, which matters because the two differ in whether their bytes are user-independent,
220
+ * and so in whether they may be shared and cached at all.
221
+ *
222
+ * Declaring both is refused rather than resolved by precedence. A `rowFilter` fuses the subject into
223
+ * the predicate, which is exactly what makes a stream unshareable; silently letting it ride along on
224
+ * a shape declared as shared would produce a stream that is cached under a scope key while carrying
225
+ * subject-dependent bytes — a disclosure, not a stale row.
226
+ */
227
+ export declare function readShapeTier(shape: ShapeSpec): ShapeTier;
228
+ /**
229
+ * Refuse a shape whose `rowFilter` cannot actually filter.
230
+ *
231
+ * The control plane compiles a private-tier shape from `customPredicate` alone, so a filter that does
232
+ * not supply one is created with no subject test and streams **every** row to whoever subscribed. That
233
+ * is the precise shape of a silent authorization bypass: the registry says "filtered", the wire says
234
+ * "all rows", and nothing anywhere reports a discrepancy.
235
+ *
236
+ * The way to land there is a `rowFilter` that filters nothing at all — no predicate and no column
237
+ * allow-list — so it asserts a restriction it does not carry. (A filter holding *only* `columns` is
238
+ * legitimate: that is how `defineReadProjection` narrows a projection's wire columns without
239
+ * restricting its rows.)
240
+ *
241
+ * Refused at DEFINITION time, not at the first subscribe: declaring a `rowFilter` asserts that these
242
+ * rows are not for everyone, and there is no input for which a filter that cannot run could later turn
243
+ * out to be fine. A shape that genuinely serves every row omits `rowFilter` entirely — the difference
244
+ * between "no filter" and "a filter that does nothing" is exactly what this keeps expressible.
245
+ */
246
+ export declare function assertShapeFilterIsEnforceable(shape: ShapeSpec): void;
185
247
  /** Input variant of {@link ShapeSpec} where `tableName` and `shapeKey` are optional.
186
248
  * When omitted, both default to the top-level `tableName` of the `defineSyncTable` call.
187
- * `electricTable` is deliberately absent — it is a resolved/internal field, never a consumer input
188
- * (see {@link ShapeSpec.electricTable}); a read projection over an existing table is authored with
249
+ * `physicalTable` is deliberately absent — it is a resolved/internal field, never a consumer input
250
+ * (see {@link ShapeSpec.physicalTable}); a read projection over an existing table is authored with
189
251
  * `defineReadProjection`, which derives it from the owner. */
190
- export type ShapeSpecInput = Omit<ShapeSpec, "tableName" | "shapeKey" | "electricTable"> & {
252
+ export type ShapeSpecInput = Omit<ShapeSpec, "tableName" | "shapeKey" | "physicalTable"> & {
191
253
  tableName?: string;
192
254
  shapeKey?: string;
193
255
  };
@@ -197,15 +259,16 @@ export interface RowTransformContext {
197
259
  params?: Record<string, unknown>;
198
260
  }
199
261
  /**
200
- * Per-row rewrite applied in the proxy response path (after the row filter, before
201
- * column omission). Receives a shape-log row's column map (keys are wire/column names)
262
+ * Per-row rewrite applied on the server's read egress path (after the row filter, before
263
+ * column omission). Receives a streamed row's column map (keys are wire/column names)
202
264
  * and returns a possibly-rewritten one — letting the server strip a *sub-document* of a
203
265
  * jsonb column, or otherwise rewrite a value, *conditionally on row data*. This expresses
204
266
  * what a static, whole-column `omitColumns` cannot.
205
267
  *
206
- * It runs only in the proxy's per-response path: it never alters the local PGlite schema,
207
- * never changes the Electric shape URL, and so never pollutes Electric's shared shape
208
- * cache. Return the same `row` reference to signal "no change".
268
+ * Server authority only: it never alters the local PGlite schema and never alters the shape
269
+ * definition — the engine ref-counts shapes by definition (ADR-0055), so a transform can
270
+ * neither change which stream a subject reads nor split one that would otherwise be shared.
271
+ * Return the same `row` reference to signal "no change".
209
272
  */
210
273
  export type RowTransform = (row: Record<string, unknown>, context: RowTransformContext) => Record<string, unknown>;
211
274
  export interface ClientProjectionSpec {
@@ -216,13 +279,13 @@ export interface ClientProjectionSpec {
216
279
  localPrimaryKey?: PrimaryKeySpec;
217
280
  }
218
281
  /**
219
- * Server-side projection applied in the proxy response path. This is server
282
+ * Server-side projection applied on the read egress path. This is server
220
283
  * authority, not client shape — it never alters the local PGlite schema or the
221
- * Electric shape URL — so it lives apart from {@link ClientProjectionSpec} (ADR-0004).
284
+ * shape definition — so it lives apart from {@link ClientProjectionSpec} (ADR-0004).
222
285
  */
223
286
  export interface ServerProjectionSpec {
224
287
  /**
225
- * Optional per-row rewrite applied in the proxy response path. Runs before column
288
+ * Optional per-row rewrite applied on the read egress path. Runs before column
226
289
  * omission, so it may read a column (e.g. a control flag) that
227
290
  * `clientProjection.omitColumns` then removes from the client-visible row. See
228
291
  * {@link RowTransform}.
@@ -277,8 +340,9 @@ export interface TableSpecInput {
277
340
  clientProjection?: ClientProjectionSpec;
278
341
  governance?: TableGovernanceSpec;
279
342
  /**
280
- * Consistency group (ADR-0009 decision 2): tables sharing a group sync on one `MultiShapeStream`
281
- * and commit atomically at a shared LSN frontier. Absent → the table is its own singleton group.
343
+ * Consistency group (ADR-0009 decision 2): tables sharing a group sync on one set of streams and
344
+ * commit atomically — every stream up-to-date, then one transaction (ADR-0056). Absent → the table is
345
+ * its own singleton group.
282
346
  */
283
347
  consistencyGroup?: string;
284
348
  /**
@@ -298,11 +362,6 @@ export interface TableSpecInput {
298
362
  */
299
363
  writeMode?: WriteMode;
300
364
  }
301
- export interface SyncConfigInput<TTables extends Record<string, TableSpecInput> = Record<string, TableSpecInput>> {
302
- electricUrl: string;
303
- localSchema?: string;
304
- tables: TTables;
305
- }
306
365
  export declare function getLocalSyncPrimaryKey(source: {
307
366
  primaryKey: PrimaryKeySpec;
308
367
  clientProjection?: Pick<ClientProjectionSpec, "localPrimaryKey">;
@@ -313,86 +372,69 @@ export declare function getLocalSyncPrimaryKeyColumns(source: {
313
372
  }): string[];
314
373
  export interface RowFilterSpec {
315
374
  /**
316
- * The row filter: returns the Electric shape `where` for this request, or `null` to bypass
317
- * filtering (e.g. admin access). **Prefer returning a Drizzle `SQL` fragment** built from the
318
- * table's columns: reference each column through {@link c} (a bare, rename-safe identifier) and
319
- * embed request-derived values directly — they become **bound `$n` params**, never hand-escaped
320
- * literals. Enum columns must be cast to text (`${c(col)}::text = 'x'`) for Electric's grammar,
321
- * and subqueries must be self-contained (not correlated), since Electric needs plain column refs.
375
+ * The PRIVATE-TIER row filter (ADR-0055): the predicate fused with the caller's claims, compiled
376
+ * into the shape at subscribe. `null` bypasses filtering (all rows); {@link DENY_ALL_PREDICATE}
377
+ * denies.
322
378
  *
323
- * Returning a raw **string** is the escape hatch for a predicate Drizzle can't express. SECURITY:
324
- * a string is interpolated verbatim into the `where` — it is NOT escaped, so any request-derived
325
- * value you embed must be escaped/validated (`escapeSqlLiteral`) inside this function, or it is a
326
- * SQL-injection vector. Reach for the string form only when the Drizzle fragment cannot express it.
379
+ * Authored with the `p.*` builders over real Drizzle column objects, so a comparison is checked
380
+ * against the column's own TypeScript type — a mistyped enum label, a `null` against a NOT NULL
381
+ * column, or a `jsonb`/`Date` column with no scalar wire form are all compile errors rather than
382
+ * silently-wrong filters.
327
383
  *
328
- * **Must be pure.** The proxy already calls this fresh on every shape request; the client also
329
- * *probes* it with empty claims (`{}`) to detect claims-dependence (ADR-0039 —
330
- * {@link isClaimsDependentRowFilter}). Do not memoize, mutate external state, or assume it runs once.
384
+ * **Must be pure**: it is called fresh per shape creation, and probed with empty claims to detect
385
+ * claims-dependence (ADR-0039 — {@link isClaimsDependentRowFilter}).
331
386
  */
332
- customWhere?: (claims: JwtClaims, params?: Record<string, unknown>) => string | SQL | null;
387
+ customPredicate?: (claims: JwtClaims, params?: Record<string, unknown>) => Predicate | null;
333
388
  /** Column projection for the shape URL (e.g. ["id", "source_text"]). */
334
389
  columns?: string[];
335
390
  /**
336
- * An opaque version tag for the part of this filter the fingerprint cannot see — the `customWhere`
337
- * body (you cannot hash a closure; only its *presence* is fingerprinted). Bump this (any new
338
- * string/number) whenever you change that logic so the fingerprint shifts and the local read cache
339
- * rebuilds + the shape subscription resets. Leaving it unchanged after a `customWhere`
340
- * authorization change would silently serve the stale shape.
391
+ * An opaque version tag for the part of this filter the fingerprint cannot see — the
392
+ * `customPredicate` body (you cannot hash a closure; only its *presence* is fingerprinted). Bump
393
+ * this (any new string/number) whenever you change that logic so the fingerprint shifts and the
394
+ * local read cache rebuilds + the shape subscription resets. Leaving it unchanged after a
395
+ * `customPredicate` authorization change would silently serve the stale shape.
341
396
  */
342
397
  revision?: string | number;
343
398
  }
344
399
  /**
345
- * A **bare** (table-unqualified) quoted identifier for a Drizzle column — `"workspace_id"`, never
346
- * `"work_items"."workspace_id"`. Electric's shape `where` grammar requires *plain* column references
347
- * (it rejects a qualified one with "Expected a plain column reference"), and Drizzle qualifies columns
348
- * by default — so reference columns through `c()` when authoring a `customWhere` Drizzle fragment. The
349
- * column object keeps the reference rename-safe and existence-checked at compile time; only the bare
350
- * name reaches the wire. Subqueries must stay self-contained (not correlated), since bare names then
351
- * resolve unambiguously to each FROM — a correlated subquery would need qualification Electric rejects.
352
- */
353
- export declare function c(column: AnyColumn): SQL;
354
- /**
355
- * The deny-all row filter: a `customWhere` returns this to make **no** rows visible (e.g. an
400
+ * The deny-all predicate: a `customPredicate` returns this to make **no** rows visible (e.g. an
356
401
  * unauthenticated request), the counterpart to returning `null` (which bypasses filtering — all rows
357
- * visible). It is a Drizzle `SQL` fragment (`false`), so it stays on the typed/parameterized path
358
- * with the rest of the filter rather than being a hand-written `"1 = 0"` string. `WHERE false`
359
- * matches nothing; Electric accepts it (verified) exactly as it accepts `1 = 0`.
402
+ * visible).
403
+ *
404
+ * An empty `OR` rather than a synthetic always-false comparison: the engine evaluates it as FALSE by
405
+ * construction (`Or` starts at FALSE and only TRUE dominates), it needs no column to name, and it
406
+ * cannot be made accidentally true by a NULL cell the way `col <> col` can.
407
+ *
408
+ * The control plane recognises it **by reference identity** and declines to create the shape at all,
409
+ * so a denied subject holds no handle and no stream is materialised — a stronger outcome than an
410
+ * empty stream, and the reason this is a frozen singleton rather than a shape a caller might
411
+ * reconstruct. A structurally equal but distinct `{ or: [] }` is still correct on the wire; it just
412
+ * costs an empty shape instead of a refusal.
360
413
  */
361
- export declare const DENY_ALL: SQL;
414
+ export declare const DENY_ALL_PREDICATE: Predicate;
362
415
  /**
363
416
  * Whether a row filter denies (or cannot serve) an unauthenticated caller — a *claims-dependent*
364
417
  * filter (ADR-0039). The client probes this at lazy-group activation: a group whose members probe
365
418
  * claims-dependent, activated with no auth token, opens an empty subscription by construction, so
366
419
  * the client warns.
367
420
  *
368
- * A filter is claims-dependent when its `customWhere`, evaluated with **empty claims** (`{}` —
369
- * exactly what the proxy passes for an unauthenticated request) and no params, either **throws** or
370
- * returns the {@link DENY_ALL} sentinel by **reference identity** (which every contracts helper —
371
- * {@link buildOwnershipShapeWhere} and friends — returns for a missing subject, and which is already
372
- * the documented deny-anonymous pattern). Any other result — `null` (no filtering), a string, or a
373
- * different `SQL` fragment — is not claims-dependent as far as this probe can tell.
421
+ * A filter is claims-dependent when its `customPredicate`, evaluated with **empty claims** (`{}` —
422
+ * exactly what the control plane passes for an unauthenticated request) and no params, either
423
+ * **throws** or returns the {@link DENY_ALL_PREDICATE} sentinel by **reference identity** (which every
424
+ * contracts helper — {@link buildOwnershipShapePredicate} and friends — returns for a missing subject,
425
+ * and which is already the documented deny-anonymous pattern). Any other result — `null` (no
426
+ * filtering) or a different predicate — is not claims-dependent as far as this probe can tell.
374
427
  *
375
- * Requires `customWhere` to be pure (its contract; see {@link RowFilterSpec.customWhere}).
428
+ * Requires `customPredicate` to be pure (its contract; see {@link RowFilterSpec.customPredicate}).
376
429
  */
377
430
  export declare function isClaimsDependentRowFilter(filter: RowFilterSpec | undefined): boolean;
378
431
  /**
379
- * The ownership shape `where` — the read-path mirror of an owner-column RLS policy: rows whose owner
380
- * column equals the caller's subject, {@link DENY_ALL} for an unauthenticated caller. Takes the real
381
- * Drizzle owner column (bare via {@link c}, rename-safe); the subject rides as a typed interpolation —
382
- * a bound param through `buildRowFilterShape`, or a drizzle-escaped literal when a proxy renders it
383
- * inline for a shape URL.
384
- */
385
- export declare function buildOwnershipShapeWhere(ownerColumn: AnyColumn, subject: string | null | undefined): SQL;
386
- /** The parameterized shape filter the proxy sends to Electric: a `where` and its positional params. */
387
- export interface RowFilterShape {
388
- where: string;
389
- params: string[];
390
- }
391
- /**
392
- * The shape filter the proxy sends to Electric: the `where` plus its positional `params` (`$1`, `$2`,
393
- * …). A `customWhere` returning a Drizzle `SQL` fragment is serialized here, so request-derived values
394
- * become **bound params** — never hand-escaped literals; a string `customWhere` is the raw escape
395
- * hatch (no params). Returns `null` when there is no filter (all rows visible).
432
+ * The ownership **predicate** the read path filters on: rows whose owner column equals the caller's
433
+ * subject, {@link DENY_ALL_PREDICATE} for an unauthenticated caller (by reference, so a
434
+ * `customPredicate` built on it probes claims-dependent).
435
+ *
436
+ * Takes the real Drizzle owner column, so the reference is rename-safe, and the subject rides as a
437
+ * typed JSON scalar rather than text that has to be escaped and re-parsed.
396
438
  */
397
- export declare function buildRowFilterShape(filter: RowFilterSpec, claims: JwtClaims | null, params?: Record<string, unknown>): RowFilterShape | null;
439
+ export declare function buildOwnershipShapePredicate(ownerColumn: AnyColumn, subject: string | null | undefined): Predicate;
398
440
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,SAAS,EAAE,KAAK,GAAG,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,WAAW,CAAC;AAE/D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;AAEnE,qGAAqG;AACrG,eAAO,MAAM,iBAAiB,iDAAsF,CAAC;AAErH,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAExE;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,MAAM,CAAC;AAElD,sFAAsF;AACtF,eAAO,MAAM,oBAAoB,4BAAq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AC;AAEtF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,aAAa,GAAG,SAAS,GAAG,OAAO,CAUrF;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,CAElH"}
@@ -85,10 +85,10 @@ export declare const CONVERGENCE_EVENTS: readonly [{
85
85
  readonly event: "mutation acked";
86
86
  readonly effect: "journal row → acked, server_updated_at_us stamped; entity shows acked_unobserved until the echo catches up";
87
87
  }, {
88
- readonly event: "Electric insert/update observed";
88
+ readonly event: "synced upsert observed";
89
89
  readonly effect: "synced row applied; the barrier predicate runs; resolved entities clear overlay + acked journal";
90
90
  }, {
91
- readonly event: "Electric delete observed";
91
+ readonly event: "synced delete observed";
92
92
  readonly effect: "resolved by synced-row absence (deletes carry no Server version — ADR-0010)";
93
93
  }, {
94
94
  readonly event: "resolution";
@@ -1 +1 @@
1
- {"version":3,"file":"convergence-model.d.ts","sourceRoot":"","sources":["../src/convergence-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAkB,MAAM,qBAAqB,CAAC;AAEtE,OAAO,EAAkC,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjF;;;;;;;;;GASG;AAEH;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,SAAS,UAAU,EACrE,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,EAC7B,OAAO,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,GACtD,MAAM,CAWR;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,YAAY,EAAE,MAAM,CA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AAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,SAAS,UAAU,EAC1D,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,EAC7B,UAAU,EAAE,uBAAuB,GAClC,MAAM,CA6DR;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;aAE3B,KAAK,EAAE,qCAAqC;aAC5C,MAAM,EAAE,0FAA0F;;aAElG,KAAK,EAAE,eAAe;aAAE,MAAM,EAAE,uBAAuB;;aAEvD,KAAK,EAAE,gBAAgB;aACvB,MAAM,EACJ,4GAA4G;;aAG9G,KAAK,EAAE,wBAAwB;aAC/B,MAAM,EAAE,iGAAiG;;aAGzG,KAAK,EAAE,wBAAwB;aAC/B,MAAM,EAAE,6EAA6E;;aAErF,KAAK,EAAE,YAAY;aAAE,MAAM,EAAE,8EAA8E;;aAC3G,KAAK,EAAE,mBAAmB;aAAE,MAAM,EAAE,6EAA6E;;aAEjH,KAAK,EAAE,sBAAsB;aAC7B,MAAM,EACJ,8GAA8G;;aAGhH,KAAK,EAAE,oBAAoB;aAC3B,MAAM,EAAE,6FAA6F;EAE/F,CAAC"}
@@ -69,7 +69,7 @@ export interface EventStreamEntry<TPayload extends z.ZodType = z.ZodType> {
69
69
  identity: Record<string, EventStreamIdentityField>;
70
70
  /**
71
71
  * An opaque version counter for the part of this payload contract the lock's hash cannot see — the same
72
- * role `RowFilterSpec.revision` plays for a `customWhere` closure. The lock hashes the payload schema as
72
+ * role `RowFilterSpec.revision` plays for a `customPredicate` closure. The lock hashes the payload schema as
73
73
  * a **JSON Schema**, and refinements/transforms are simply not representable there: a reviewer
74
74
  * demonstrated that `z.string().refine(v => v.length >= 3)` and the INCOMPATIBLE `>= 10` version produce
75
75
  * the identical stream hash, so the `risky` diff the ADR relies on never fires.
@@ -5,10 +5,10 @@ import type { SyncTableEntry, SyncTableRegistry } from "./registry";
5
5
  *
6
6
  * This is the single source of "has the shape changed" — consumed as the local-DB
7
7
  * version key and as the basis of the registry-diff gate (ADR-0006). Function *bodies*
8
- * (`rowTransform`, `customWhere`) cannot be fingerprinted and are excluded — but their
8
+ * (`rowTransform`, `customPredicate`) cannot be fingerprinted and are excluded — but their
9
9
  * *presence* and the surrounding **static** filter structure (the projected columns)
10
10
  * participate. For the invisible *logic* itself, a consumer-bumped `rowFilter.revision` is
11
- * folded in: changing it is how a `customWhere` authorization change is forced to shift the
11
+ * folded in: changing it is how a `customPredicate` authorization change is forced to shift the
12
12
  * fingerprint (and so rebuild the cache + reset the subscription).
13
13
  */
14
14
  export interface CanonicalColumn {
@@ -33,8 +33,18 @@ export interface CanonicalTable {
33
33
  shape: {
34
34
  tableName: string;
35
35
  shapeKey: string;
36
- electricTable: string | null;
36
+ physicalTable: string | null;
37
37
  rowFilter: CanonicalRowFilter | null;
38
+ /** Shared-tier scope columns, in declaration order — the order parameterizes the family. */
39
+ scope: string[] | null;
40
+ /**
41
+ * The native static predicate, canonicalized in full.
42
+ *
43
+ * Unlike `customPredicate`, this one is *visible*: an AST can be hashed, where a closure could only
44
+ * ever be fingerprinted by its presence. So the `revision` footgun does not apply here — editing
45
+ * a native `where` shifts the fingerprint by itself, and a consumer cannot forget to say so.
46
+ */
47
+ where: string | null;
38
48
  } | null;
39
49
  managedFields: Array<{
40
50
  field: string;
@@ -58,16 +68,16 @@ export interface CanonicalTable {
58
68
  }
59
69
  /**
60
70
  * The static, fingerprint-able structure of a row filter. A changed projection shifts the
61
- * fingerprint, so the local store rebuilds and the diff gate flags it. `customWhere`'s body is
62
- * invisible — only its presence (`hasCustomWhere`) is recorded — so a `customWhere` *logic* change
71
+ * fingerprint, so the local store rebuilds and the diff gate flags it. `customPredicate`'s body is
72
+ * invisible — only its presence (`hasCustomPredicate`) is recorded — so a `customPredicate` *logic* change
63
73
  * is surfaced only by bumping `revision`.
64
74
  */
65
75
  export interface CanonicalRowFilter {
66
- hasCustomWhere: boolean;
76
+ hasCustomPredicate: boolean;
67
77
  columns: string[] | null;
68
78
  /**
69
- * The consumer-supplied version tag for the non-fingerprintable filter logic (the `customWhere`
70
- * body). Changing it shifts the fingerprint, which is the only way a `customWhere` *logic* change
79
+ * The consumer-supplied version tag for the non-fingerprintable filter logic (the `customPredicate`
80
+ * body). Changing it shifts the fingerprint, which is the only way a `customPredicate` *logic* change
71
81
  * forces a cache + subscription reset.
72
82
  */
73
83
  revision: string | null;
@@ -89,7 +99,7 @@ export declare function fingerprintRegistry(registry: SyncTableRegistry): string
89
99
  /**
90
100
  * The **read contract** of a single sync table: the subset of its canonical shape that decides what
91
101
  * data streams down and how a row is identified and filtered — synced-table name, columns, primary key
92
- * (and any local-PK override), column omission, and the shape (electric table + row filter). It is the
102
+ * (and any local-PK override), column omission, and the shape (physical table + row filter). It is the
93
103
  * stable identity a writable entry shares with its {@link asReadonly} projection.
94
104
  *
95
105
  * Deliberately EXCLUDES the two axes a per-client projection may legitimately differ on:
@@ -100,7 +110,7 @@ export declare function fingerprintRegistry(registry: SyncTableRegistry): string
100
110
  *
101
111
  * What it pins is the data itself: two registries that present "the same" logical table to different
102
112
  * clients must agree here, or those clients are silently seeing different rows/columns. As with the
103
- * full registry fingerprint, the `customWhere` *body* is invisible — only its presence and the
113
+ * full registry fingerprint, the `customPredicate` *body* is invisible — only its presence and the
104
114
  * consumer-bumped {@link RowFilterSpec.revision} participate, so bump `revision` to force a divergence
105
115
  * a logic-only change would otherwise hide.
106
116
  */
@@ -113,8 +123,18 @@ export interface CanonicalReadContract {
113
123
  shape: {
114
124
  tableName: string;
115
125
  shapeKey: string;
116
- electricTable: string | null;
126
+ physicalTable: string | null;
117
127
  rowFilter: CanonicalRowFilter | null;
128
+ /** Shared-tier scope columns, in declaration order — the order parameterizes the family. */
129
+ scope: string[] | null;
130
+ /**
131
+ * The native static predicate, canonicalized in full.
132
+ *
133
+ * Unlike `customPredicate`, this one is *visible*: an AST can be hashed, where a closure could only
134
+ * ever be fingerprinted by its presence. So the `revision` footgun does not apply here — editing
135
+ * a native `where` shifts the fingerprint by itself, and a consumer cannot forget to say so.
136
+ */
137
+ where: string | null;
118
138
  } | null;
119
139
  }
120
140
  /** The canonical {@link CanonicalReadContract} of a sync table entry (see the interface for what it omits). */
@@ -1 +1 @@
1
- {"version":3,"file":"fingerprint.d.ts","sourceRoot":"","sources":["../src/fingerprint.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpE;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACjC,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,UAAU,EAAE;QACV,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB,GAAG,IAAI,CAAC;IACT,KAAK,EAAE;QACL,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,SAAS,EAAE,kBAAkB,GAAG,IAAI,CAAC;KACtC,GAAG,IAAI,CAAC;IACT,aAAa,EAAE,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IAAI,CAAC;QACvB;;;;;;WAMG;QACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;KACtB,GAAG,IAAI,CAAC;CACV;AAED,+GAA+G;AAC/G,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,cAAc,GAAG,qBAAqB,CAsBrF;AAED,gFAAgF;AAChF,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAEzE;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAErE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAqBhD"}
package/dist/index.d.ts CHANGED
@@ -9,9 +9,11 @@ export * from "./registry";
9
9
  export * from "./registry-diff";
10
10
  export * from "./registry-invariant";
11
11
  export * from "./mutation";
12
+ export * from "./predicate";
12
13
  export * from "./projection";
13
14
  export * from "./runtime";
14
15
  export * from "./sql-defaults";
16
+ export * from "./stream-envelope";
15
17
  export * from "./sql-identifier";
16
18
  export * from "./sql-role-guard";
17
19
  export * from "./supabase-rls";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}