@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/index.js CHANGED
@@ -70,10 +70,88 @@ function classifyApplyStrategy(columns) {
70
70
  import { z } from "zod";
71
71
  var unixMicrosecondsSchema = z.string().regex(/^[0-9]+$/);
72
72
  // packages/contracts/src/config.ts
73
- import { sql } from "drizzle-orm";
74
- import { PgDialect } from "drizzle-orm/pg-core";
75
73
  import { z as z2 } from "zod";
76
- var pgDialect = new PgDialect;
74
+
75
+ // packages/contracts/src/predicate.ts
76
+ import { getColumnTable, getTableName } from "drizzle-orm";
77
+ function isLeafPredicate(node) {
78
+ return "col" in node && "op" in node;
79
+ }
80
+ function isIsNullPredicate(node) {
81
+ return "col" in node && "isNull" in node;
82
+ }
83
+ function isAndPredicate(node) {
84
+ return "and" in node;
85
+ }
86
+ function isOrPredicate(node) {
87
+ return "or" in node;
88
+ }
89
+ function isNotPredicate(node) {
90
+ return "not" in node;
91
+ }
92
+ function isInSubqueryPredicate(node) {
93
+ return "in" in node && "col" in node;
94
+ }
95
+ function assertPredicateValue(column, value) {
96
+ if (value === null)
97
+ return;
98
+ const kind = typeof value;
99
+ if (kind === "string" || kind === "number" || kind === "boolean")
100
+ return;
101
+ const shown = value instanceof Date ? "Date" : kind === "object" ? "object" : kind;
102
+ throw new Error(`[pgxsinkit] predicate on "${column.name}": ${shown} is not a predicate value \u2014 the wire form ` + `carries JSON scalars (string | number | boolean | null). Render it to the text form the ` + `column itself stores and pass that, rather than relying on a coercion that may not match.`);
103
+ }
104
+ function toWireValue(column, value) {
105
+ if (typeof value !== "bigint") {
106
+ assertPredicateValue(column, value);
107
+ return value;
108
+ }
109
+ if (value > BigInt(Number.MAX_SAFE_INTEGER) || value < BigInt(Number.MIN_SAFE_INTEGER)) {
110
+ throw new Error(`[pgxsinkit] predicate on "${column.name}": ${value}n is outside the exactly-representable ` + `integer range, so serializing it would silently round to a different value. Compare against ` + `a value inside the safe-integer range, or split the test.`);
111
+ }
112
+ return Number(value);
113
+ }
114
+ function leaf(column, op, value) {
115
+ return { col: column.name, op, value: toWireValue(column, value) };
116
+ }
117
+ var p = {
118
+ eq: (column, value) => leaf(column, "eq", value),
119
+ ne: (column, value) => leaf(column, "neq", value),
120
+ lt: (column, value) => leaf(column, "lt", value),
121
+ lte: (column, value) => leaf(column, "lte", value),
122
+ gt: (column, value) => leaf(column, "gt", value),
123
+ gte: (column, value) => leaf(column, "gte", value),
124
+ like: (column, pattern) => leaf(column, "like", pattern),
125
+ notLike: (column, pattern) => ({
126
+ not: leaf(column, "like", pattern)
127
+ }),
128
+ isNull: (column) => ({ col: column.name, isNull: true }),
129
+ isNotNull: (column) => ({ col: column.name, isNull: false }),
130
+ and: (...nodes) => ({ and: nodes }),
131
+ or: (...nodes) => ({ or: nodes }),
132
+ not: (node) => ({ not: node }),
133
+ subquery: (projected, where) => ({
134
+ table: getTableName(getColumnTable(projected)),
135
+ project: projected.name,
136
+ ...where !== undefined ? { where } : {}
137
+ }),
138
+ in: (column, ref) => ({ col: column.name, in: ref }),
139
+ notIn: (column, ref) => ({
140
+ col: column.name,
141
+ in: ref,
142
+ negated: true
143
+ })
144
+ };
145
+ function conjoinPredicates(...nodes) {
146
+ const present = nodes.filter((node) => node !== undefined);
147
+ if (present.length === 0)
148
+ return;
149
+ if (present.length === 1)
150
+ return present[0];
151
+ return { and: present };
152
+ }
153
+
154
+ // packages/contracts/src/config.ts
77
155
  var CONFLICT_POLICIES = ["last-write-wins", "reject-if-stale"];
78
156
  function isConflictPolicy(value) {
79
157
  return typeof value === "string" && CONFLICT_POLICIES.includes(value);
@@ -133,39 +211,39 @@ var jwtClaimsSchema = z2.looseObject({
133
211
  roles: z2.array(z2.string()).optional()
134
212
  }).optional()
135
213
  });
214
+ function readShapeTier(shape) {
215
+ if (shape.scope != null && shape.rowFilter != null) {
216
+ throw new Error(`[pgxsinkit] shape "${shape.shapeKey}" declares both scope and rowFilter \u2014 a shape is shared ` + `(scope: the predicate is a function of scope values only) or private (rowFilter: the subject ` + `is fused into the predicate), never both. A rowFilter makes the stream's bytes ` + `subject-dependent, so it cannot be served from a scope-keyed shared stream. Move the ` + `subject-dependent part into the entitlement rule, or drop scope and keep this private.`);
217
+ }
218
+ return shape.scope != null ? "shared" : "private";
219
+ }
220
+ function assertShapeFilterIsEnforceable(shape) {
221
+ const filter = shape.rowFilter;
222
+ if (filter == null || filter.customPredicate != null)
223
+ return;
224
+ if (filter.columns == null) {
225
+ throw new Error(`[pgxsinkit] shape "${shape.shapeKey}" declares a rowFilter that restricts nothing \u2014 no ` + `customPredicate and no column allow-list. Declare customPredicate, or drop the rowFilter if ` + `the rows really are for everyone (an absent rowFilter is how a shape says so).`);
226
+ }
227
+ }
136
228
  function getLocalSyncPrimaryKey(source) {
137
229
  return source.clientProjection?.localPrimaryKey ?? source.primaryKey;
138
230
  }
139
231
  function getLocalSyncPrimaryKeyColumns(source) {
140
232
  return [...getLocalSyncPrimaryKey(source).columns];
141
233
  }
142
- function c(column) {
143
- return sql`${sql.identifier(column.name)}`;
144
- }
145
- var DENY_ALL = sql`false`;
234
+ var DENY_ALL_PREDICATE = Object.freeze({ or: [] });
146
235
  function isClaimsDependentRowFilter(filter) {
147
- if (!filter?.customWhere) {
236
+ if (!filter?.customPredicate) {
148
237
  return false;
149
238
  }
150
239
  try {
151
- return filter.customWhere({}, undefined) === DENY_ALL;
240
+ return filter.customPredicate({}, undefined) === DENY_ALL_PREDICATE;
152
241
  } catch {
153
242
  return true;
154
243
  }
155
244
  }
156
- function buildOwnershipShapeWhere(ownerColumn, subject) {
157
- return subject == null || subject === "" ? DENY_ALL : sql`${c(ownerColumn)} = ${subject}`;
158
- }
159
- function buildRowFilterShape(filter, claims, params) {
160
- const custom = filter.customWhere?.(claims ?? {}, params);
161
- if (custom == null) {
162
- return null;
163
- }
164
- if (typeof custom === "string") {
165
- return custom ? { where: custom, params: [] } : null;
166
- }
167
- const compiled = pgDialect.sqlToQuery(custom);
168
- return { where: compiled.sql, params: compiled.params.map((value) => String(value)) };
245
+ function buildOwnershipShapePredicate(ownerColumn, subject) {
246
+ return subject == null || subject === "" ? DENY_ALL_PREDICATE : p.eq(ownerColumn, subject);
169
247
  }
170
248
  // packages/contracts/src/convergence-model.ts
171
249
  import { getTableConfig as getTableConfig2 } from "drizzle-orm/pg-core";
@@ -268,14 +346,15 @@ function defineSyncTable(input) {
268
346
  const primaryKeyConstraintName = customPrimaryKeyName ?? `${tableName}_pkey`;
269
347
  const probeColumns = getColumns(pgTable(tableName, makeColumns()));
270
348
  const columnLevelPkKeys = Object.entries(probeColumns).filter(([, col]) => col.primary === true).map(([key]) => key);
271
- const specPropertyKeys = primaryKeyColumns.map((key) => {
349
+ const toPropertyKey = (key, label) => {
272
350
  if (probeColumns[key])
273
351
  return key;
274
352
  const byColumnName = Object.entries(probeColumns).find(([, col]) => col.name === key);
275
353
  if (byColumnName)
276
354
  return byColumnName[0];
277
- throw new Error(`[pgxsinkit] ${tableName}: primaryKey column "${key}" not found among the table's columns`);
278
- });
355
+ throw new Error(`[pgxsinkit] ${tableName}: ${label} column "${key}" not found among the table's columns`);
356
+ };
357
+ const specPropertyKeys = primaryKeyColumns.map((key) => toPropertyKey(key, "primaryKey"));
279
358
  if (columnLevelPkKeys.length > 1) {
280
359
  throw new Error(`[pgxsinkit] ${tableName}: multiple columns declare .primaryKey() (${columnLevelPkKeys.join(", ")}) \u2014 declare a composite key via the primaryKey option ({ name?, columns }) and remove the column-level .primaryKey() flags; the spec is the single source of truth`);
281
360
  }
@@ -311,15 +390,31 @@ function defineSyncTable(input) {
311
390
  return [...consumerExtras, pgPrimaryKey({ name: primaryKeyConstraintName, columns: pkColumns })];
312
391
  } : undefined;
313
392
  const table = schema ? schema.table(tableName, makeColumns(), extrasFn) : pgTable(tableName, makeColumns(), extrasFn);
314
- const resolvedRowFilter = shape?.rowFilter?.(getColumns(table));
393
+ const shapeColumns = getColumns(table);
394
+ const resolvedRowFilter = shape?.rowFilter?.(shapeColumns);
395
+ const resolvedScope = shape?.scope?.(shapeColumns).map((column) => column.name);
396
+ const resolvedWhere = shape?.where?.(shapeColumns);
315
397
  const resolvedShape = resolvedMode !== "writeonly" || shape != null ? {
316
398
  tableName: shape?.tableName ?? tableName,
317
399
  shapeKey: shape?.shapeKey ?? shape?.tableName ?? tableName,
318
- ...resolvedRowFilter != null ? { rowFilter: resolvedRowFilter } : {}
400
+ ...resolvedRowFilter != null ? { rowFilter: resolvedRowFilter } : {},
401
+ ...resolvedScope != null ? { scope: resolvedScope } : {},
402
+ ...resolvedWhere != null ? { where: resolvedWhere } : {}
319
403
  } : undefined;
404
+ if (resolvedShape != null) {
405
+ readShapeTier(resolvedShape);
406
+ assertShapeFilterIsEnforceable(resolvedShape);
407
+ }
320
408
  const omittedColumns = clientProjection?.omitColumns ?? [];
321
409
  const projectedCols = viewColumnsForProjection(makeColumns(), omittedColumns);
322
- const localTable = schema ? schema.table(tableName, projectedCols) : pgTable(tableName, projectedCols);
410
+ const localPkPropertyKeys = (clientProjection?.localPrimaryKey?.columns ?? primaryKeyColumns).map((key) => toPropertyKey(key, "localPrimaryKey"));
411
+ const localPkIsColumnLevel = localPkPropertyKeys.length === 1 && probeColumns[localPkPropertyKeys[0]]?.primary === true;
412
+ const localExtrasFn = localPkIsColumnLevel ? undefined : (self) => {
413
+ const selfCols = self;
414
+ const pkColumns = localPkPropertyKeys.map((k) => selfCols[k]);
415
+ return [pgPrimaryKey({ name: primaryKeyConstraintName, columns: pkColumns })];
416
+ };
417
+ const localTable = schema ? schema.table(tableName, projectedCols, localExtrasFn) : pgTable(tableName, projectedCols, localExtrasFn);
323
418
  const viewColumns = viewColumnsForProjection(makeColumns(), omittedColumns);
324
419
  const view = resolvedMode === "readwrite" ? pgView(`${tableName}_read_model`, {
325
420
  ...viewColumns,
@@ -379,7 +474,7 @@ function defineReadProjection(owner, opts) {
379
474
  const clientKept = new Set([...opts.columns, ...pkKeys]);
380
475
  for (const key of serverOnlyColumns) {
381
476
  if (!allKeys.includes(key)) {
382
- throw new Error(`defineReadProjection: projection "${opts.as}" serverOnlyColumns names "${key}", which is not a ` + `column of owner "${physicalTable}". It feeds the Electric fetch allow-list, so a typo would ` + `silently mis-fetch \u2014 name an existing owner column key.`);
477
+ throw new Error(`defineReadProjection: projection "${opts.as}" serverOnlyColumns names "${key}", which is not a ` + `column of owner "${physicalTable}". It feeds the shape's "columns" allow-list, so a typo would ` + `silently mis-fetch \u2014 name an existing owner column key.`);
383
478
  }
384
479
  if (clientKept.has(key)) {
385
480
  throw new Error(`defineReadProjection: projection "${opts.as}" lists "${key}" in BOTH serverOnlyColumns and the ` + `client shape (columns or primary key) \u2014 it is already fetched and kept client-side, so ` + `declaring it server-only is contradictory. Remove it from serverOnlyColumns.`);
@@ -407,9 +502,10 @@ function defineReadProjection(owner, opts) {
407
502
  const shape = {
408
503
  tableName: opts.as,
409
504
  shapeKey: opts.as,
410
- electricTable: physicalTable,
505
+ physicalTable,
411
506
  ...rowFilter != null ? { rowFilter } : {}
412
507
  };
508
+ assertShapeFilterIsEnforceable(shape);
413
509
  const rowClass = opts.rowClass ?? owner.rowClass;
414
510
  const projection = {
415
511
  ...built,
@@ -427,6 +523,7 @@ function defineSyncRegistry(input) {
427
523
  validateSyncTableEntry(entry);
428
524
  }
429
525
  validateRegistryTableUniqueness(input.tables);
526
+ validateRegistryShapeKeyUniqueness(input.tables);
430
527
  validateRegistryLifecycleGroups(input.tables);
431
528
  validateStorageDeclaration(input.storage);
432
529
  validateRowClassification(input.tables, input.rowClasses);
@@ -437,6 +534,7 @@ function defineSyncRegistry(input) {
437
534
  validateSyncTableEntry(entry);
438
535
  }
439
536
  validateRegistryTableUniqueness(input);
537
+ validateRegistryShapeKeyUniqueness(input);
440
538
  validateRegistryLifecycleGroups(input);
441
539
  return input;
442
540
  }
@@ -454,6 +552,19 @@ function validateRegistryTableUniqueness(registry) {
454
552
  declaredBy.set(identity, key);
455
553
  }
456
554
  }
555
+ function validateRegistryShapeKeyUniqueness(registry) {
556
+ const declaredBy = new Map;
557
+ for (const [key, entry] of Object.entries(registry)) {
558
+ const shape = entry.shape;
559
+ if (shape === undefined)
560
+ continue;
561
+ const firstKey = declaredBy.get(shape.shapeKey);
562
+ if (firstKey !== undefined) {
563
+ throw new Error(`shapeKey "${shape.shapeKey}" is declared by two registry entries ("${firstKey}" and "${key}"): ` + `a duplicate shapeKey makes the second entry unreachable \u2014 the control plane resolves a ` + `subscription by shapeKey and would serve the first entry's shape. Give each entry a unique ` + `shape.shapeKey, or use defineReadProjection (a distinct "as") for a second shape over one table.`);
564
+ }
565
+ declaredBy.set(shape.shapeKey, key);
566
+ }
567
+ }
457
568
  function validateRegistryLifecycleGroups(registry) {
458
569
  const groups = new Map;
459
570
  for (const entry of getRegistryEntries(registry)) {
@@ -569,7 +680,7 @@ function attachSyncRegistrySchema(registry, schema) {
569
680
  const qualifiedTableName = `${normalizedSchema}.${entry.shape.tableName}`;
570
681
  entry.shape = {
571
682
  ...entry.shape,
572
- electricTable: entry.shape.electricTable ? qualify(entry.shape.electricTable) : qualifiedTableName,
683
+ physicalTable: entry.shape.physicalTable ? qualify(entry.shape.physicalTable) : qualifiedTableName,
573
684
  ...entry.shape.shapeKey === entry.shape.tableName ? { shapeKey: qualifiedTableName } : {}
574
685
  };
575
686
  }
@@ -772,6 +883,9 @@ function validateSyncTableEntry(entry) {
772
883
  if (typeof entry.makeColumns !== "function") {
773
884
  throw new Error(`sync table ${tableName} has no makeColumns factory: every registered entry must be built by ` + `defineSyncTable (or a projection of one \u2014 asReadonly / asEphemeral / defineReadProjection), which ` + `stashes the column-builder factory the client requires (ADR-0029 P1) to derive its local ` + `synced/overlay/journal objects. Hand-assembled entries are unsupported.`);
774
885
  }
886
+ if (entry.serverProjection?.rowTransform != null && entry.shape?.scope != null) {
887
+ throw new Error(`[pgxsinkit] shape "${entry.shape.shapeKey}" declares both scope and a serverProjection.rowTransform ` + `\u2014 an egress transform rewrites the stream's bytes per request with the reader's subject, so the ` + `shape is private-tier by construction (ADR-0055 decision 5) and cannot be served from a ` + `scope-keyed shared stream. Drop the transform and pre-compute the redaction into a column the ` + `shape projects, or drop scope and keep this shape private.`);
888
+ }
775
889
  if (entry.mode !== "readonly" && resolveServerVersionColumnName(entry) === undefined) {
776
890
  throw new Error(`writable table ${tableName} must declare a Server version: a managed field with strategy ` + `"nowMicroseconds" and applyOn including "update" (conventionally updated_at_us) \u2014 ADR-0010`);
777
891
  }
@@ -1037,11 +1151,11 @@ var CONVERGENCE_EVENTS = [
1037
1151
  effect: "journal row \u2192 acked, server_updated_at_us stamped; entity shows acked_unobserved until the echo catches up"
1038
1152
  },
1039
1153
  {
1040
- event: "Electric insert/update observed",
1154
+ event: "synced upsert observed",
1041
1155
  effect: "synced row applied; the barrier predicate runs; resolved entities clear overlay + acked journal"
1042
1156
  },
1043
1157
  {
1044
- event: "Electric delete observed",
1158
+ event: "synced delete observed",
1045
1159
  effect: "resolved by synced-row absence (deletes carry no Server version \u2014 ADR-0010)"
1046
1160
  },
1047
1161
  { event: "resolution", effect: "clear overlay/journal only through the shared barrier predicate (decision 4)" },
@@ -1114,12 +1228,39 @@ function canonicalizeManagedFields(entry) {
1114
1228
  return { field: name, strategy, applyOn };
1115
1229
  }).sort((a, b) => asString(a.field, b.field));
1116
1230
  }
1231
+ function canonicalizePredicate(node) {
1232
+ if (node === undefined)
1233
+ return null;
1234
+ const render = (current) => {
1235
+ if (isAndPredicate(current))
1236
+ return { and: current.and.map(render) };
1237
+ if (isOrPredicate(current))
1238
+ return { or: current.or.map(render) };
1239
+ if (isNotPredicate(current))
1240
+ return { not: render(current.not) };
1241
+ if (isInSubqueryPredicate(current)) {
1242
+ return {
1243
+ col: current.col,
1244
+ in: {
1245
+ table: current.in.table,
1246
+ project: current.in.project,
1247
+ where: current.in.where ? render(current.in.where) : null
1248
+ },
1249
+ negated: current.negated === true
1250
+ };
1251
+ }
1252
+ if (isIsNullPredicate(current))
1253
+ return { col: current.col, isNull: current.isNull };
1254
+ return { col: current.col, op: current.op, value: current.value };
1255
+ };
1256
+ return JSON.stringify(render(node));
1257
+ }
1117
1258
  function canonicalizeRowFilter(filter) {
1118
1259
  if (!filter) {
1119
1260
  return null;
1120
1261
  }
1121
1262
  return {
1122
- hasCustomWhere: filter.customWhere != null,
1263
+ hasCustomPredicate: filter.customPredicate != null,
1123
1264
  columns: filter.columns ? [...filter.columns].sort(asString) : null,
1124
1265
  revision: filter.revision != null ? String(filter.revision) : null
1125
1266
  };
@@ -1134,8 +1275,10 @@ function canonicalizeTable(key, entry) {
1134
1275
  const shape = entry.shape ? {
1135
1276
  tableName: entry.shape.tableName,
1136
1277
  shapeKey: entry.shape.shapeKey,
1137
- electricTable: entry.shape.electricTable ?? null,
1138
- rowFilter: canonicalizeRowFilter(entry.shape.rowFilter)
1278
+ physicalTable: entry.shape.physicalTable ?? null,
1279
+ rowFilter: canonicalizeRowFilter(entry.shape.rowFilter),
1280
+ scope: entry.shape.scope ? [...entry.shape.scope] : null,
1281
+ where: canonicalizePredicate(entry.shape.where)
1139
1282
  } : null;
1140
1283
  return {
1141
1284
  key,
@@ -1169,8 +1312,10 @@ function canonicalizeReadContract(entry) {
1169
1312
  const shape = entry.shape ? {
1170
1313
  tableName: entry.shape.tableName,
1171
1314
  shapeKey: entry.shape.shapeKey,
1172
- electricTable: entry.shape.electricTable ?? null,
1173
- rowFilter: canonicalizeRowFilter(entry.shape.rowFilter)
1315
+ physicalTable: entry.shape.physicalTable ?? null,
1316
+ rowFilter: canonicalizeRowFilter(entry.shape.rowFilter),
1317
+ scope: entry.shape.scope ? [...entry.shape.scope] : null,
1318
+ where: canonicalizePredicate(entry.shape.where)
1174
1319
  } : null;
1175
1320
  return {
1176
1321
  syncedTable: entry.clientProjection?.syncedTable ?? getTableConfig3(entry.table).name,
@@ -1326,13 +1471,19 @@ function diffProjection(table, previous, next, changes) {
1326
1471
  }
1327
1472
  }
1328
1473
  function diffShape(table, previous, next, changes) {
1329
- const target = (shape) => shape ? `${shape.tableName}|${shape.shapeKey}|${shape.electricTable ?? ""}` : null;
1474
+ const target = (shape) => shape ? `${shape.tableName}|${shape.shapeKey}|${shape.physicalTable ?? ""}` : null;
1330
1475
  if (target(previous) !== target(next)) {
1331
1476
  changes.push({ severity: "risky", table, detail: "shape target changed (re-sync required)" });
1332
1477
  }
1333
1478
  if (JSON.stringify(previous?.rowFilter ?? null) !== JSON.stringify(next?.rowFilter ?? null)) {
1334
1479
  changes.push({ severity: "risky", table, detail: "row filter changed (re-sync required)" });
1335
1480
  }
1481
+ if (JSON.stringify(previous?.scope ?? null) !== JSON.stringify(next?.scope ?? null)) {
1482
+ changes.push({ severity: "risky", table, detail: "shape scope changed (re-sync required)" });
1483
+ }
1484
+ if ((previous?.where ?? null) !== (next?.where ?? null)) {
1485
+ changes.push({ severity: "risky", table, detail: "shape predicate changed (re-sync required)" });
1486
+ }
1336
1487
  }
1337
1488
  function diffRowClass(table, previous, next, changes) {
1338
1489
  if (previous === next) {
@@ -1422,8 +1573,13 @@ function summarizeRegistryDiff(diff) {
1422
1573
  `);
1423
1574
  }
1424
1575
  // packages/contracts/src/registry-invariant.ts
1425
- import { getTableConfig as getTableConfig4, PgDialect as PgDialect2 } from "drizzle-orm/pg-core";
1426
- var policyDialect = new PgDialect2;
1576
+ import { getTableConfig as getTableConfig4, PgDialect } from "drizzle-orm/pg-core";
1577
+ function deniesAllRows(predicate) {
1578
+ if (predicate === DENY_ALL_PREDICATE)
1579
+ return true;
1580
+ return predicate != null && isOrPredicate(predicate) && predicate.or.length === 0;
1581
+ }
1582
+ var policyDialect = new PgDialect;
1427
1583
  function renderPolicyPredicate(fragment) {
1428
1584
  return fragment == null ? null : policyDialect.sqlToQuery(fragment.inlineParams()).sql;
1429
1585
  }
@@ -1435,9 +1591,8 @@ function renderPolicies(entry) {
1435
1591
  withCheck: renderPolicyPredicate(policy.withCheck)
1436
1592
  }));
1437
1593
  }
1438
- function renderWhere(entry, claims) {
1439
- const rowFilter = entry.shape?.rowFilter;
1440
- return rowFilter == null ? null : buildRowFilterShape(rowFilter, claims);
1594
+ function resolvePredicate(entry, claims) {
1595
+ return entry.shape?.rowFilter?.customPredicate?.(claims) ?? null;
1441
1596
  }
1442
1597
  function boundEntries(registry, appliesTo) {
1443
1598
  const entries = Object.entries(registry);
@@ -1474,7 +1629,7 @@ function assertRegistryInvariant(registry, spec) {
1474
1629
  rowClass: entry.rowClass,
1475
1630
  fixtureName,
1476
1631
  claims,
1477
- renderedWhere: renderWhere(entry, claims),
1632
+ readPredicate: resolvePredicate(entry, claims),
1478
1633
  renderedPolicies
1479
1634
  });
1480
1635
  if (verdict === true) {
@@ -1593,10 +1748,14 @@ function assertReadContractPreserved(authoritative, projection, options) {
1593
1748
  }
1594
1749
  }
1595
1750
  // packages/contracts/src/sql-defaults.ts
1596
- import { sql as sql2 } from "drizzle-orm";
1751
+ import { sql } from "drizzle-orm";
1597
1752
  var NOW_MICROSECONDS_SQL_TEXT = "CAST(FLOOR(EXTRACT(EPOCH FROM clock_timestamp()) * 1000000) AS BIGINT)";
1598
1753
  var CLOCK_US_CALL_SQL_TEXT = "public.pgxsinkit_clock_us()";
1599
- var clockMicrosecondsSql = sql2.raw(CLOCK_US_CALL_SQL_TEXT);
1754
+ var clockMicrosecondsSql = sql.raw(CLOCK_US_CALL_SQL_TEXT);
1755
+ // packages/contracts/src/stream-envelope.ts
1756
+ function isDeleteEnvelope(envelope) {
1757
+ return envelope.headers.operation === "delete";
1758
+ }
1600
1759
  // packages/contracts/src/sql-role-guard.ts
1601
1760
  function buildRoleGuardedStatement(roleName, statementSql) {
1602
1761
  return [
@@ -1611,9 +1770,9 @@ function buildRoleGuardedStatement(roleName, statementSql) {
1611
1770
  `);
1612
1771
  }
1613
1772
  // packages/contracts/src/supabase-rls.ts
1614
- import { and, eq, getTableName, or, sql as sql3 } from "drizzle-orm";
1615
- import { PgDialect as PgDialect3, pgPolicy } from "drizzle-orm/pg-core";
1616
- var textDialect = new PgDialect3;
1773
+ import { and, eq, getTableName as getTableName2, or, sql as sql2 } from "drizzle-orm";
1774
+ import { PgDialect as PgDialect2, pgPolicy } from "drizzle-orm/pg-core";
1775
+ var textDialect = new PgDialect2;
1617
1776
  function renderInlineSql(fragment) {
1618
1777
  return textDialect.sqlToQuery(fragment.inlineParams()).sql;
1619
1778
  }
@@ -1677,11 +1836,11 @@ function tableNameForColumn(column, label) {
1677
1836
  if (!table) {
1678
1837
  throw new Error(`${label} must be a built Drizzle column carrying its table \u2014 call this builder inside defineSyncTable's \`extras\` callback`);
1679
1838
  }
1680
- return getTableName(table);
1839
+ return getTableName2(table);
1681
1840
  }
1682
1841
  function buildSubjectSql(subjectCastType) {
1683
1842
  assertTypeName(subjectCastType, "subjectCastType");
1684
- return sql3.raw(`(select ${buildSubjectSqlText(subjectCastType)})`);
1843
+ return sql2.raw(`(select ${buildSubjectSqlText(subjectCastType)})`);
1685
1844
  }
1686
1845
  function buildSubjectSqlText(subjectCastType) {
1687
1846
  return `coalesce(
@@ -1697,22 +1856,22 @@ function resolveAdminRolesClaimPath(path) {
1697
1856
  return segments;
1698
1857
  }
1699
1858
  function buildClaimPathChainSql(path) {
1700
- return sql3.join(path.map((segment) => sql3` -> ${segment}`), sql3``);
1859
+ return sql2.join(path.map((segment) => sql2` -> ${segment}`), sql2``);
1701
1860
  }
1702
1861
  function buildClaimArraySqlText(claimSqlText) {
1703
1862
  return `case jsonb_typeof(${claimSqlText}) when 'array' then ${claimSqlText} else '[]'::jsonb end`;
1704
1863
  }
1705
1864
  function buildAdminRoleExistsSqlText(adminRoleName, claimPath) {
1706
- const rolesClaim = renderInlineSql(sql3`(
1865
+ const rolesClaim = renderInlineSql(sql2`(
1707
1866
  coalesce(
1708
1867
  nullif(current_setting('request.jwt.claim', true), ''),
1709
1868
  nullif(current_setting('request.jwt.claims', true), '')
1710
1869
  )::jsonb${buildClaimPathChainSql(claimPath)}
1711
1870
  )`);
1712
- return renderInlineSql(sql3`EXISTS (
1871
+ return renderInlineSql(sql2`EXISTS (
1713
1872
  SELECT 1
1714
1873
  FROM jsonb_array_elements_text(
1715
- ${sql3.raw(buildClaimArraySqlText(rolesClaim))}
1874
+ ${sql2.raw(buildClaimArraySqlText(rolesClaim))}
1716
1875
  ) AS assigned_role(role_name_value)
1717
1876
  WHERE assigned_role.role_name_value = ${adminRoleName}
1718
1877
  )`);
@@ -1740,7 +1899,7 @@ function buildSupabaseOwnerOrAdminPredicateSqlText(options = {}) {
1740
1899
  function buildSupabaseOwnerOrAdminNativePolicies(options) {
1741
1900
  const adminRoleName = options.adminRoleName ?? defaultAdminRoleName;
1742
1901
  const subject = buildSubjectSql(options.subjectCastType ?? defaultSubjectCastType);
1743
- const adminExists = sql3.raw(buildAdminRoleExistsSqlText(adminRoleName, resolveAdminRolesClaimPath(options.adminRolesClaimPath)));
1902
+ const adminExists = sql2.raw(buildAdminRoleExistsSqlText(adminRoleName, resolveAdminRolesClaimPath(options.adminRolesClaimPath)));
1744
1903
  const predicate = or(eq(options.ownerColumn, subject), adminExists);
1745
1904
  const tableName = tableNameForColumn(options.ownerColumn, "ownerColumn");
1746
1905
  return ownerOrAdminPolicyShapes.map((shape) => pgPolicy(buildOwnerOrAdminPolicyName(tableName, shape.command), {
@@ -1764,9 +1923,9 @@ function resolveOwnerOrAdminAccess(claims, options = {}) {
1764
1923
  const admin = Array.isArray(roles) && roles.some((role) => typeof role === "string" && role === adminRoleName);
1765
1924
  return { admin, subject: readSubjectClaim(claims) };
1766
1925
  }
1767
- function buildOwnerOrAdminShapeWhere(ownerColumn, claims, options = {}) {
1926
+ function buildOwnerOrAdminShapePredicate(ownerColumn, claims, options = {}) {
1768
1927
  const access = resolveOwnerOrAdminAccess(claims, options);
1769
- return access.admin ? null : buildOwnershipShapeWhere(ownerColumn, access.subject);
1928
+ return access.admin ? null : buildOwnershipShapePredicate(ownerColumn, access.subject);
1770
1929
  }
1771
1930
  var defaultManagerRoleValue = "manager";
1772
1931
  var membershipPolicyShapes = [
@@ -1785,15 +1944,15 @@ function normalizeMembershipColumns(options) {
1785
1944
  function membershipMatch(cols, subject, requireManager) {
1786
1945
  const subjectIsMember = eq(cols.membershipSubjectColumn, subject);
1787
1946
  const where = requireManager && cols.managerRoleColumn ? and(subjectIsMember, eq(cols.managerRoleColumn, cols.managerRoleValue).inlineParams()) : subjectIsMember;
1788
- return sql3`${cols.containerColumn} = any(array(select ${cols.membershipContainerColumn} from ${cols.membershipTable} where ${where}))`;
1947
+ return sql2`${cols.containerColumn} = any(array(select ${cols.membershipContainerColumn} from ${cols.membershipTable} where ${where}))`;
1789
1948
  }
1790
1949
  function ownerOrManager(cols, subject) {
1791
1950
  const owner = eq(cols.ownerColumn, subject);
1792
1951
  return cols.managerRoleColumn ? or(owner, membershipMatch(cols, subject, true)) : owner;
1793
1952
  }
1794
1953
  function membershipWriteGate(cols, gate, subject) {
1795
- const unlocked = sql3`${cols.containerColumn} = any(array(select ${gate.containerPkColumn} from ${gate.containerTable} where ${eq(gate.containerLockColumn, false).inlineParams()}))`;
1796
- const notMuted = sql3`${cols.containerColumn} = any(array(select ${cols.membershipContainerColumn} from ${cols.membershipTable} where ${and(eq(cols.membershipSubjectColumn, subject), eq(gate.membershipMutedColumn, false).inlineParams())}))`;
1954
+ const unlocked = sql2`${cols.containerColumn} = any(array(select ${gate.containerPkColumn} from ${gate.containerTable} where ${eq(gate.containerLockColumn, false).inlineParams()}))`;
1955
+ const notMuted = sql2`${cols.containerColumn} = any(array(select ${cols.membershipContainerColumn} from ${cols.membershipTable} where ${and(eq(cols.membershipSubjectColumn, subject), eq(gate.membershipMutedColumn, false).inlineParams())}))`;
1797
1956
  return and(or(unlocked, membershipMatch(cols, subject, true)), notMuted);
1798
1957
  }
1799
1958
  function buildSupabaseMembershipNativePolicies(options) {
@@ -1834,12 +1993,12 @@ function buildSupabaseMembershipNativePolicies(options) {
1834
1993
  });
1835
1994
  });
1836
1995
  }
1837
- function buildMembershipShapeWhere(columns, claims) {
1996
+ function buildMembershipShapePredicate(columns, claims) {
1838
1997
  const subject = readSubjectClaim(claims);
1839
1998
  if (subject === null) {
1840
- return DENY_ALL;
1999
+ return DENY_ALL_PREDICATE;
1841
2000
  }
1842
- return sql3`${c(columns.containerColumn)} in (select ${c(columns.membershipContainerColumn)} from ${columns.membershipTable} where ${c(columns.membershipSubjectColumn)} = ${subject})`;
2001
+ return p.in(columns.containerColumn, p.subquery(columns.membershipContainerColumn, p.eq(columns.membershipSubjectColumn, subject)));
1843
2002
  }
1844
2003
  var defaultGrantsClaimPath = ["app_metadata", "authorization", "grants"];
1845
2004
  var defaultGrantScopeCastType = "uuid";
@@ -1869,7 +2028,7 @@ function buildRoleInListSqlText(roleValues) {
1869
2028
  if (roleValues.length === 0) {
1870
2029
  throw new Error("grant-scope policy requires at least one role value");
1871
2030
  }
1872
- return renderInlineSql(sql3.join(roleValues.map((role) => sql3`${role}`), sql3`, `));
2031
+ return renderInlineSql(sql2.join(roleValues.map((role) => sql2`${role}`), sql2`, `));
1873
2032
  }
1874
2033
  function resolveGrantScopeIdField(options) {
1875
2034
  const field = options.scopeIdField ?? `${options.scopeKind}Id`;
@@ -1881,7 +2040,7 @@ function buildBypassExistsSqlText(bypass, grantsText) {
1881
2040
  return `exists (
1882
2041
  select 1
1883
2042
  from jsonb_array_elements(${grantsText}) as bypass_grant
1884
- where bypass_grant -> 'scope' ->> 'kind' = ${renderInlineSql(sql3`${scopeKind}`)}
2043
+ where bypass_grant -> 'scope' ->> 'kind' = ${renderInlineSql(sql2`${scopeKind}`)}
1885
2044
  and bypass_grant ->> 'role' in (${buildRoleInListSqlText(bypass.roleValues)})
1886
2045
  )`;
1887
2046
  }
@@ -1893,13 +2052,13 @@ function buildGrantScopePredicate(options) {
1893
2052
  assertTypeName(castType, "scopeCastType");
1894
2053
  const grantsText = buildGrantsArraySqlText(resolveGrantsClaimPath(options.grantsClaimPath));
1895
2054
  const roleIn = buildRoleInListSqlText(options.roleValues);
1896
- const kindMatch = `grant_elem -> 'scope' ->> 'kind' = ${renderInlineSql(sql3`${scopeKind}`)} and grant_elem ->> 'role' in (${roleIn})`;
1897
- const idExpr = `(grant_elem -> 'scope' ->> ${renderInlineSql(sql3`${scopeIdField}`)})::${castType}`;
1898
- const base = options.naive ? sql3`exists (select 1 from jsonb_array_elements(${sql3.raw(grantsText)}) as grant_elem where ${sql3.raw(kindMatch)} and ${sql3.raw(idExpr)} = ${options.scopeColumn})` : sql3`${options.scopeColumn} = any(array(select ${sql3.raw(idExpr)} from jsonb_array_elements(${sql3.raw(grantsText)}) as grant_elem where ${sql3.raw(kindMatch)}))`;
2055
+ const kindMatch = `grant_elem -> 'scope' ->> 'kind' = ${renderInlineSql(sql2`${scopeKind}`)} and grant_elem ->> 'role' in (${roleIn})`;
2056
+ const idExpr = `(grant_elem -> 'scope' ->> ${renderInlineSql(sql2`${scopeIdField}`)})::${castType}`;
2057
+ const base = options.naive ? sql2`exists (select 1 from jsonb_array_elements(${sql2.raw(grantsText)}) as grant_elem where ${sql2.raw(kindMatch)} and ${sql2.raw(idExpr)} = ${options.scopeColumn})` : sql2`${options.scopeColumn} = any(array(select ${sql2.raw(idExpr)} from jsonb_array_elements(${sql2.raw(grantsText)}) as grant_elem where ${sql2.raw(kindMatch)}))`;
1899
2058
  if (!options.bypass) {
1900
2059
  return base;
1901
2060
  }
1902
- return or(base, sql3.raw(buildBypassExistsSqlText(options.bypass, grantsText)));
2061
+ return or(base, sql2.raw(buildBypassExistsSqlText(options.bypass, grantsText)));
1903
2062
  }
1904
2063
  function buildSupabaseGrantScopeNativePolicies(options) {
1905
2064
  const predicate = buildGrantScopePredicate(options);
@@ -1944,11 +2103,12 @@ function resolveGrantScopeIds(claims, options) {
1944
2103
  }
1945
2104
  return [...ids];
1946
2105
  }
1947
- function buildGrantScopeShapeWhere(scopeColumn, ids) {
2106
+ function buildGrantScopeShapePredicate(scopeColumn, ids) {
1948
2107
  if (ids.length === 0) {
1949
- return DENY_ALL;
2108
+ return DENY_ALL_PREDICATE;
1950
2109
  }
1951
- return sql3`${c(scopeColumn)} in (${sql3.join(ids.map((id) => sql3`${id}`), sql3`, `)})`;
2110
+ const equalities = ids.map((id) => p.eq(scopeColumn, id));
2111
+ return equalities.length === 1 ? equalities[0] : p.or(...equalities);
1952
2112
  }
1953
2113
  function hasGrantScopeBypass(claims, options) {
1954
2114
  const bypass = options.bypass;
@@ -1985,133 +2145,143 @@ function resolveGrantScopeAccess(claims, options) {
1985
2145
  ids: resolveGrantScopeIds(claims, options)
1986
2146
  };
1987
2147
  }
1988
- function buildGrantScopeAccessShapeWhere(scopeColumn, claims, options) {
2148
+ function buildGrantScopeAccessShapePredicate(scopeColumn, claims, options) {
1989
2149
  const access = resolveGrantScopeAccess(claims, options);
1990
- return access.bypass ? null : buildGrantScopeShapeWhere(scopeColumn, access.ids);
2150
+ return access.bypass ? null : buildGrantScopeShapePredicate(scopeColumn, access.ids);
1991
2151
  }
1992
2152
  export {
1993
- withRetention,
1994
- unixMicrosecondsSchema,
1995
- syncRegistryStreamsSymbol,
1996
- syncRegistryStorageSymbol,
1997
- syncRegistrySchemaSymbol,
1998
- syncRegistryRowClassesSymbol,
1999
- supabaseOwnerOrAdminDefaults,
2000
- summarizeRegistryDiff,
2001
- stampedEventSchema,
2002
- runRegistryCheck,
2003
- resolveStorageDeclaration,
2004
- resolveServerVersionColumnName,
2005
- resolveOwnerOrAdminAccess,
2006
- resolveGrantScopeIds,
2007
- resolveGrantScopeAccess,
2008
- registryRowClasses,
2009
- registryEventStreams,
2010
- quoteSqlLiteral,
2011
- quoteIdentifier,
2012
- normalizeCastPositionType,
2013
- mutationStatusSchema,
2014
- mutationRejectionSchema,
2015
- mutationKindSchema,
2016
- mutationEnvelopeSchema,
2017
- mutationAckStatusSchema,
2018
- mutationAckSchema,
2019
- maybeQuoteIdentifier,
2020
- jwtClaimsSchema,
2021
- isZodSchema,
2022
- isWriteMode,
2023
- isSubscriptionTiming,
2024
- isStorageDurability,
2025
- isStorageBackend,
2026
- isRetention,
2027
- isManagedFieldGuarded,
2028
- isConflictPolicy,
2029
- isClaimsDependentRowFilter,
2030
- hashString,
2031
- hasNonStrictObjectRoot,
2032
- getSyncRegistryStreams,
2033
- getSyncRegistryStorage,
2034
- getSyncRegistrySchema,
2035
- getSyncRegistryRowClasses,
2036
- getProjectedColumns,
2037
- getProjectedColumnNames,
2038
- getOmittedProjectedColumns,
2039
- getOmittedProjectedColumnNames,
2040
- getLocalSyncedTablePrimaryKeyColumns,
2041
- getLocalSyncPrimaryKeyColumns,
2042
- getLocalSyncPrimaryKey,
2043
- fingerprintRegistry,
2044
- fingerprintReadContract,
2045
- eventQueueMessageSchema,
2046
- eventEnvelopeSchema,
2047
- eventAckStatusSchema,
2048
- eventAckSchema,
2049
- escapeSqlLiteral,
2050
- entityKeySchema,
2051
- diffRegistryAgainstLock,
2052
- diffCanonicalRegistries,
2053
- deriveSyncColumnTypes,
2054
- defineSyncTable,
2055
- defineSyncRegistry,
2056
- defineReadProjection,
2057
- defineEventStream,
2058
- compareRegistries,
2059
- clockMicrosecondsSql,
2060
- classifyTableApplyStrategy,
2061
- classifyApplyStrategy,
2062
- canonicalizeRegistry,
2063
- canonicalizeReadContract,
2064
- canonicalRegistryString,
2065
- canonicalReadContractString,
2066
- c,
2067
- buildSyncStateView,
2068
- buildSupabaseOwnerOrAdminPredicateSqlText,
2069
- buildSupabaseOwnerOrAdminNativePolicies,
2070
- buildSupabaseMembershipNativePolicies,
2071
- buildSupabaseGrantScopeNativePolicies,
2072
- buildRowFilterShape,
2073
- buildRoleGuardedStatement,
2074
- buildRegistryLock,
2075
- buildOwnershipShapeWhere,
2076
- buildOwnerOrAdminShapeWhere,
2077
- buildOverlayResolutionBarrier,
2078
- buildMembershipShapeWhere,
2079
- buildGrantScopeShapeWhere,
2080
- buildGrantScopeAccessShapeWhere,
2081
- batchMutationRequestSchema,
2082
- batchMutationErrorSchema,
2083
- batchMutationAckSchema,
2084
- batchEventRequestSchema,
2085
- batchEventPaths,
2086
- batchEventErrorSchema,
2087
- batchEventAckSchema,
2088
- authoritativeWriteRequestSchema,
2089
- attachSyncRegistryStreams,
2090
- attachSyncRegistryStorage,
2091
- attachSyncRegistrySchema,
2092
- attachSyncRegistryRowClasses,
2093
- assertStorageDeclarationCompatible,
2094
- assertRegistryInvariant,
2095
- assertReadContractPreserved,
2096
- asReadonly,
2097
- asEphemeral,
2098
- WRITE_MODES,
2099
- StorageDeclarationRefusedError,
2100
- SUBSCRIPTION_TIMINGS,
2101
- STORAGE_DURABILITIES,
2102
- STORAGE_BACKENDS,
2103
- RETENTIONS,
2104
- NOW_MICROSECONDS_SQL_TEXT,
2105
- MAX_EVENT_REQUEST_BYTES,
2106
- MAX_EVENT_PAYLOAD_BYTES,
2107
- MAX_EVENTS_PER_BATCH,
2108
- EVENT_STREAM_QUEUE_PREFIX,
2109
- EVENT_STREAM_NAME_PATTERN,
2110
- EVENT_STREAM_NAME_MAX_LENGTH,
2111
- DENY_ALL,
2112
- CONVERGENCE_EVENTS,
2153
+ CLOCK_US_CALL_SQL_TEXT,
2113
2154
  CONFLICT_POLICIES,
2114
- CLOCK_US_CALL_SQL_TEXT
2155
+ CONVERGENCE_EVENTS,
2156
+ DENY_ALL_PREDICATE,
2157
+ EVENT_STREAM_NAME_MAX_LENGTH,
2158
+ EVENT_STREAM_NAME_PATTERN,
2159
+ EVENT_STREAM_QUEUE_PREFIX,
2160
+ MAX_EVENTS_PER_BATCH,
2161
+ MAX_EVENT_PAYLOAD_BYTES,
2162
+ MAX_EVENT_REQUEST_BYTES,
2163
+ NOW_MICROSECONDS_SQL_TEXT,
2164
+ RETENTIONS,
2165
+ STORAGE_BACKENDS,
2166
+ STORAGE_DURABILITIES,
2167
+ SUBSCRIPTION_TIMINGS,
2168
+ StorageDeclarationRefusedError,
2169
+ WRITE_MODES,
2170
+ asEphemeral,
2171
+ asReadonly,
2172
+ assertReadContractPreserved,
2173
+ assertRegistryInvariant,
2174
+ assertShapeFilterIsEnforceable,
2175
+ assertStorageDeclarationCompatible,
2176
+ attachSyncRegistryRowClasses,
2177
+ attachSyncRegistrySchema,
2178
+ attachSyncRegistryStorage,
2179
+ attachSyncRegistryStreams,
2180
+ authoritativeWriteRequestSchema,
2181
+ batchEventAckSchema,
2182
+ batchEventErrorSchema,
2183
+ batchEventPaths,
2184
+ batchEventRequestSchema,
2185
+ batchMutationAckSchema,
2186
+ batchMutationErrorSchema,
2187
+ batchMutationRequestSchema,
2188
+ buildGrantScopeAccessShapePredicate,
2189
+ buildGrantScopeShapePredicate,
2190
+ buildMembershipShapePredicate,
2191
+ buildOverlayResolutionBarrier,
2192
+ buildOwnerOrAdminShapePredicate,
2193
+ buildOwnershipShapePredicate,
2194
+ buildRegistryLock,
2195
+ buildRoleGuardedStatement,
2196
+ buildSupabaseGrantScopeNativePolicies,
2197
+ buildSupabaseMembershipNativePolicies,
2198
+ buildSupabaseOwnerOrAdminNativePolicies,
2199
+ buildSupabaseOwnerOrAdminPredicateSqlText,
2200
+ buildSyncStateView,
2201
+ canonicalReadContractString,
2202
+ canonicalRegistryString,
2203
+ canonicalizeReadContract,
2204
+ canonicalizeRegistry,
2205
+ classifyApplyStrategy,
2206
+ classifyTableApplyStrategy,
2207
+ clockMicrosecondsSql,
2208
+ compareRegistries,
2209
+ conjoinPredicates,
2210
+ defineEventStream,
2211
+ defineReadProjection,
2212
+ defineSyncRegistry,
2213
+ defineSyncTable,
2214
+ deniesAllRows,
2215
+ deriveSyncColumnTypes,
2216
+ diffCanonicalRegistries,
2217
+ diffRegistryAgainstLock,
2218
+ entityKeySchema,
2219
+ escapeSqlLiteral,
2220
+ eventAckSchema,
2221
+ eventAckStatusSchema,
2222
+ eventEnvelopeSchema,
2223
+ eventQueueMessageSchema,
2224
+ fingerprintReadContract,
2225
+ fingerprintRegistry,
2226
+ getLocalSyncPrimaryKey,
2227
+ getLocalSyncPrimaryKeyColumns,
2228
+ getLocalSyncedTablePrimaryKeyColumns,
2229
+ getOmittedProjectedColumnNames,
2230
+ getOmittedProjectedColumns,
2231
+ getProjectedColumnNames,
2232
+ getProjectedColumns,
2233
+ getSyncRegistryRowClasses,
2234
+ getSyncRegistrySchema,
2235
+ getSyncRegistryStorage,
2236
+ getSyncRegistryStreams,
2237
+ hasNonStrictObjectRoot,
2238
+ hashString,
2239
+ isAndPredicate,
2240
+ isClaimsDependentRowFilter,
2241
+ isConflictPolicy,
2242
+ isDeleteEnvelope,
2243
+ isInSubqueryPredicate,
2244
+ isIsNullPredicate,
2245
+ isLeafPredicate,
2246
+ isManagedFieldGuarded,
2247
+ isNotPredicate,
2248
+ isOrPredicate,
2249
+ isRetention,
2250
+ isStorageBackend,
2251
+ isStorageDurability,
2252
+ isSubscriptionTiming,
2253
+ isWriteMode,
2254
+ isZodSchema,
2255
+ jwtClaimsSchema,
2256
+ maybeQuoteIdentifier,
2257
+ mutationAckSchema,
2258
+ mutationAckStatusSchema,
2259
+ mutationEnvelopeSchema,
2260
+ mutationKindSchema,
2261
+ mutationRejectionSchema,
2262
+ mutationStatusSchema,
2263
+ normalizeCastPositionType,
2264
+ p,
2265
+ quoteIdentifier,
2266
+ quoteSqlLiteral,
2267
+ readShapeTier,
2268
+ registryEventStreams,
2269
+ registryRowClasses,
2270
+ resolveGrantScopeAccess,
2271
+ resolveGrantScopeIds,
2272
+ resolveOwnerOrAdminAccess,
2273
+ resolveServerVersionColumnName,
2274
+ resolveStorageDeclaration,
2275
+ runRegistryCheck,
2276
+ stampedEventSchema,
2277
+ summarizeRegistryDiff,
2278
+ supabaseOwnerOrAdminDefaults,
2279
+ syncRegistryRowClassesSymbol,
2280
+ syncRegistrySchemaSymbol,
2281
+ syncRegistryStorageSymbol,
2282
+ syncRegistryStreamsSymbol,
2283
+ unixMicrosecondsSchema,
2284
+ withRetention
2115
2285
  };
2116
2286
 
2117
- //# debugId=7B2607AF400BBBC364756E2164756E21
2287
+ //# debugId=55BBD8D000C5BC3D64756E2164756E21