@rebasepro/server-postgres 0.32.0 → 0.33.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.
Files changed (64) hide show
  1. package/dist/{BranchService-C8LtpMho.js → BranchService-Bdin0Wxh.js} +3 -3
  2. package/dist/{BranchService-C8LtpMho.js.map → BranchService-Bdin0Wxh.js.map} +1 -1
  3. package/dist/PostgresBackendDriver.d.ts +3 -0
  4. package/dist/{backup-cli-DtV6n3oB.js → backup-cli-BEAMPWMs.js} +3 -3
  5. package/dist/{backup-cli-DtV6n3oB.js.map → backup-cli-BEAMPWMs.js.map} +1 -1
  6. package/dist/{boot-ddl-CSYhSSZD.js → boot-ddl-Bu6gAY-2.js} +2 -2
  7. package/dist/{boot-ddl-CSYhSSZD.js.map → boot-ddl-Bu6gAY-2.js.map} +1 -1
  8. package/dist/{cli-console-Cu1DzqvR.js → cli-console-DjFiYlSe.js} +4 -4
  9. package/dist/{cli-console-Cu1DzqvR.js.map → cli-console-DjFiYlSe.js.map} +1 -1
  10. package/dist/cli-errors.d.ts +12 -0
  11. package/dist/cli-helpers.d.ts +20 -0
  12. package/dist/{cli-schema-dir-DuZIsF2e.js → cli-schema-dir-CjDH_31U.js} +111 -5
  13. package/dist/cli-schema-dir-CjDH_31U.js.map +1 -0
  14. package/dist/cli.js +28 -23
  15. package/dist/cli.js.map +1 -1
  16. package/dist/{database-preflight-CyTCWlfc.js → database-preflight-DKzsGnc4.js} +2 -2
  17. package/dist/{database-preflight-CyTCWlfc.js.map → database-preflight-DKzsGnc4.js.map} +1 -1
  18. package/dist/{deferred-index-build-ueYVUBZc.js → deferred-index-build-88bWtYgx.js} +4 -4
  19. package/dist/{deferred-index-build-ueYVUBZc.js.map → deferred-index-build-88bWtYgx.js.map} +1 -1
  20. package/dist/{ensure-policies-13mHWjBs.js → ensure-policies-nIITKxud.js} +6 -6
  21. package/dist/{ensure-policies-13mHWjBs.js.map → ensure-policies-nIITKxud.js.map} +1 -1
  22. package/dist/{ensure-tables-B3Kh2RwT.js → ensure-tables-Lm-77eM5.js} +6 -6
  23. package/dist/{ensure-tables-B3Kh2RwT.js.map → ensure-tables-Lm-77eM5.js.map} +1 -1
  24. package/dist/{ensure-tables-DM1U9AZK.js → ensure-tables-hQ5oAK_j.js} +3 -3
  25. package/dist/{ensure-tables-DM1U9AZK.js.map → ensure-tables-hQ5oAK_j.js.map} +1 -1
  26. package/dist/{enum-labels-kept-CJDVtX14.js → enum-labels-kept-mesgEJWH.js} +2 -2
  27. package/dist/{enum-labels-kept-CJDVtX14.js.map → enum-labels-kept-mesgEJWH.js.map} +1 -1
  28. package/dist/index.es.js +11 -11
  29. package/dist/{migrate-baseline-DnMlSDup.js → migrate-baseline-Bzj5gSCM.js} +2 -2
  30. package/dist/{migrate-baseline-DnMlSDup.js.map → migrate-baseline-Bzj5gSCM.js.map} +1 -1
  31. package/dist/{migrate-policy-stamps-BpHyEFkk.js → migrate-policy-stamps-C2WaOEsB.js} +4 -4
  32. package/dist/{migrate-policy-stamps-BpHyEFkk.js.map → migrate-policy-stamps-C2WaOEsB.js.map} +1 -1
  33. package/dist/{open-rebase-B2mAA7UE.js → open-rebase-OB4hhQuk.js} +391 -33
  34. package/dist/open-rebase-OB4hhQuk.js.map +1 -0
  35. package/dist/{pg-error-utils-CpUiBkp-.js → pg-error-utils-CWopxboq.js} +2 -2
  36. package/dist/{pg-error-utils-CpUiBkp-.js.map → pg-error-utils-CWopxboq.js.map} +1 -1
  37. package/dist/{policy-drift-C9xRcbsU.js → policy-drift-rVLKS2AG.js} +3 -3
  38. package/dist/{policy-drift-C9xRcbsU.js.map → policy-drift-rVLKS2AG.js.map} +1 -1
  39. package/dist/{push-index-adoption-D-ph6kBc.js → push-index-adoption-EcamXfW2.js} +2 -2
  40. package/dist/{push-index-adoption-D-ph6kBc.js.map → push-index-adoption-EcamXfW2.js.map} +1 -1
  41. package/dist/{push-index-prebuild-DUKtH87s.js → push-index-prebuild-BPIns6wA.js} +3 -3
  42. package/dist/{push-index-prebuild-DUKtH87s.js.map → push-index-prebuild-BPIns6wA.js.map} +1 -1
  43. package/dist/{push-legacy-renames-wLSsAg80.js → push-legacy-renames-lmYkb41I.js} +3 -3
  44. package/dist/{push-legacy-renames-wLSsAg80.js.map → push-legacy-renames-lmYkb41I.js.map} +1 -1
  45. package/dist/{push-policy-plan-I9RNoP_-.js → push-policy-plan-Dqu4FKWh.js} +3 -3
  46. package/dist/{push-policy-plan-I9RNoP_-.js.map → push-policy-plan-Dqu4FKWh.js.map} +1 -1
  47. package/dist/{request-role-cli-D9yWoeSl.js → request-role-cli-Ay0v9oYZ.js} +8 -8
  48. package/dist/{request-role-cli-D9yWoeSl.js.map → request-role-cli-Ay0v9oYZ.js.map} +1 -1
  49. package/dist/{request-role-migration-DQLiYJ4c.js → request-role-migration-DTE3Owsh.js} +2 -2
  50. package/dist/{request-role-migration-DQLiYJ4c.js.map → request-role-migration-DTE3Owsh.js.map} +1 -1
  51. package/dist/{rls-enforcement-Cwh5SJRx.js → rls-enforcement-Ck-d8zdJ.js} +2 -2
  52. package/dist/{rls-enforcement-Cwh5SJRx.js.map → rls-enforcement-Ck-d8zdJ.js.map} +1 -1
  53. package/dist/schema/doctor-cli.js +5 -5
  54. package/dist/schema/introspect-db.js +1 -1
  55. package/dist/services/cdc/CdcListener.d.ts +12 -0
  56. package/dist/services/cdc/pgoutput.d.ts +6 -0
  57. package/dist/services/realtime-prefilter.d.ts +90 -0
  58. package/dist/services/realtimeService.d.ts +39 -1
  59. package/dist/utils/connection-string.d.ts +9 -1
  60. package/dist/{websocket-CSVNOYHC.js → websocket-kZixcOXt.js} +3 -3
  61. package/dist/{websocket-CSVNOYHC.js.map → websocket-kZixcOXt.js.map} +1 -1
  62. package/package.json +7 -7
  63. package/dist/cli-schema-dir-DuZIsF2e.js.map +0 -1
  64. package/dist/open-rebase-B2mAA7UE.js.map +0 -1
@@ -3,23 +3,23 @@ __createRequire(import.meta.url);
3
3
  import { a as createPostgresDatabaseConnection, f as pooledTransactionSettings, h as transactionSettingsStatements, l as isPooledPool, m as transactionSettingsConfig, n as closeWithPool, p as searchPathList } from "./connection-C1zXTPJq.js";
4
4
  import { i as buildTableSearchColumnSpec, o as isSearchIndexColumn, r as SEARCH_UNACCENT_FN } from "./search-column-BO-WND-B.js";
5
5
  import { r as viewRowsName, t as DEFAULT_VIEW_ROLES } from "./view-names-Dscp6--B.js";
6
- import { a as closedDatabaseName, c as diagnoseDbError, ct as extractCauseMessage, d as isEconnrefused, o as deepestErrorMessage, p as parseHostInfo } from "./cli-schema-dir-DuZIsF2e.js";
7
- import { a as pgErrorToFriendlyMessage, i as isRowLevelSecurityDenial, n as extractPgError, o as reachedDatabase, r as isRoleSwitchingPermissionError, s as sanitizeErrorForClient, t as classifyConnectFailure } from "./pg-error-utils-CpUiBkp-.js";
8
- import { t as BranchService } from "./BranchService-C8LtpMho.js";
6
+ import { a as closedDatabaseName, c as diagnoseDbError, d as isEconnrefused, m as parseHostInfo, o as deepestErrorMessage, p as isUntrustedServerCertificate, ut as extractCauseMessage } from "./cli-schema-dir-CjDH_31U.js";
7
+ import { a as pgErrorToFriendlyMessage, i as isRowLevelSecurityDenial, n as extractPgError, o as reachedDatabase, r as isRoleSwitchingPermissionError, s as sanitizeErrorForClient, t as classifyConnectFailure } from "./pg-error-utils-CWopxboq.js";
8
+ import { t as BranchService } from "./BranchService-Bdin0Wxh.js";
9
9
  import { i as rlsHandoverNotes, n as resolveRlsSettings, r as rlsConfigFromEnv } from "./rls-settings-CmGK2U0a.js";
10
- import { C as warnOnAnonymousGrants, S as validatePolicyPgRoles, T as warnOnRoleSchemaCollision, _ as recordRequestRoles, a as assertRecordedRequestRoles, b as roleHoldsTableGrants, c as ensureAppRole, d as findExposedInternalTables, f as findOtherRoleMembers, g as readRecordedRequestRoles, h as proveRoleSwitch, i as assertAppRoleRestricted, l as ensureAppRoleGrants, o as authContextStatement, p as findUngrantableTables, r as applyAuthContext, s as detectConnectionPosture, t as REBASE_USER_ROLE$1, u as ensureConnectionInheritsAdminRole, v as revokeUserRoleSql, w as warnOnLegacyRlsFunctions, x as settleAdminSwitch } from "./rls-enforcement-Cwh5SJRx.js";
10
+ import { C as warnOnAnonymousGrants, S as validatePolicyPgRoles, T as warnOnRoleSchemaCollision, _ as recordRequestRoles, a as assertRecordedRequestRoles, b as roleHoldsTableGrants, c as ensureAppRole, d as findExposedInternalTables, f as findOtherRoleMembers, g as readRecordedRequestRoles, h as proveRoleSwitch, i as assertAppRoleRestricted, l as ensureAppRoleGrants, o as authContextStatement, p as findUngrantableTables, r as applyAuthContext, s as detectConnectionPosture, t as REBASE_USER_ROLE$1, u as ensureConnectionInheritsAdminRole, v as revokeUserRoleSql, w as warnOnLegacyRlsFunctions, x as settleAdminSwitch } from "./rls-enforcement-Ck-d8zdJ.js";
11
11
  import { t as AUTH_USERS_COLUMNS } from "./auth-users-columns-BpfgbkxZ.js";
12
12
  import { i as plannedColumnEntries, n as planSchema, r as quoteSqlLiteral } from "./plan-schema-Hbtjhge3.js";
13
13
  import { t as generateSchema } from "./generate-drizzle-schema-logic-DL7R1rAF.js";
14
14
  import { i as renderPgType } from "./render-ddl-D4n86NHz.js";
15
15
  import { d as planTablePolicies } from "./generate-postgres-ddl-logic-CQof4iFH.js";
16
- import { d as typesAgree, s as diffPlanAgainstCatalogue } from "./deferred-index-build-ueYVUBZc.js";
17
- import { a as isLockTimeout, c as resolveBootLockOptions, l as sleep, n as BOOT_LOCK_TIMEOUT_MS } from "./boot-ddl-CSYhSSZD.js";
18
- import { a as readSchemaFactsFor, r as planTableSchemaEnsure } from "./ensure-tables-B3Kh2RwT.js";
16
+ import { d as typesAgree, s as diffPlanAgainstCatalogue } from "./deferred-index-build-88bWtYgx.js";
17
+ import { a as isLockTimeout, c as resolveBootLockOptions, l as sleep, n as BOOT_LOCK_TIMEOUT_MS } from "./boot-ddl-Bu6gAY-2.js";
18
+ import { a as readSchemaFactsFor, r as planTableSchemaEnsure } from "./ensure-tables-Lm-77eM5.js";
19
19
  import { n as introspectTables, t as describeUnmappedTables } from "./introspect-tables-Cw_A-kk4.js";
20
20
  import { a as mergeDatabaseBranch, i as diffDatabaseBranch } from "./branch-diff-CxE4VlxT.js";
21
21
  import { t as DatabasePoolManager } from "./databasePoolManager-DIjzlTK4.js";
22
- import { a as resolveAuthSchema, i as probeAuthSchema, r as assertAuthSchemaCompatible, t as ensureAuthTablesExist } from "./ensure-tables-DM1U9AZK.js";
22
+ import { a as resolveAuthSchema, i as probeAuthSchema, r as assertAuthSchemaCompatible, t as ensureAuthTablesExist } from "./ensure-tables-hQ5oAK_j.js";
23
23
  import { a as buildBaasSchema, c as introspectSchema, i as warnOnGeneratedSchemaDrift, n as diffGeneratedSchemaAgainstCatalogue, o as readCatalogueSchema, s as compileIntrospectedTables } from "./generated-schema-diff-DoT2dYDe.js";
24
24
  import pg, { Client, DatabaseError, Pool } from "pg";
25
25
  import { NodePgDatabase, NodePgSession, NodePgTransaction, drizzle } from "drizzle-orm/node-postgres";
@@ -12227,10 +12227,14 @@ var PostgresBackendDriver = class PostgresBackendDriver {
12227
12227
  path,
12228
12228
  id: savedId,
12229
12229
  row: savedRow,
12230
- databaseId: void 0
12230
+ databaseId: void 0,
12231
+ image: {
12232
+ before: upserting ? void 0 : status === "existing" ? previousValuesForHistory : null,
12233
+ after: storedRow
12234
+ }
12231
12235
  }, ...this.childListNotifications(runtime, savedId, updatedValues)];
12232
12236
  if (this._deferNotifications) this._pendingNotifications.push(...notifications);
12233
- else for (const notification of notifications) await this.realtimeService.notifyUpdate(notification.path, notification.id, notification.row, notification.databaseId);
12237
+ else for (const notification of notifications) await this.realtimeService.notifyUpdate(notification.path, notification.id, notification.row, notification.databaseId, true, "app", notification.image);
12234
12238
  return savedRow;
12235
12239
  } catch (error) {
12236
12240
  if (hasRowHook(hooks, "afterSaveError")) {
@@ -12281,7 +12285,7 @@ var PostgresBackendDriver = class PostgresBackendDriver {
12281
12285
  return run(txDriver);
12282
12286
  });
12283
12287
  if (ownNotifications) for (const notification of pending) try {
12284
- await this.realtimeService.notifyUpdate(notification.path, notification.id, notification.row, notification.databaseId);
12288
+ await this.realtimeService.notifyUpdate(notification.path, notification.id, notification.row, notification.databaseId, true, "app", notification.image);
12285
12289
  } catch (error) {
12286
12290
  logger.error("[DataDriver] Error flushing deferred notification", { error });
12287
12291
  }
@@ -13481,7 +13485,7 @@ var AuthenticatedPostgresBackendDriver = class {
13481
13485
  writeScope?.committed();
13482
13486
  await writeScope?.settled();
13483
13487
  for (const notification of pendingNotifications) try {
13484
- await this.delegate.realtimeService.notifyUpdate(notification.path, notification.id, notification.row, notification.databaseId);
13488
+ await this.delegate.realtimeService.notifyUpdate(notification.path, notification.id, notification.row, notification.databaseId, true, "app", notification.image);
13485
13489
  } catch (e) {
13486
13490
  logger.error("[DataDriver] Error flushing deferred notification", { error: e });
13487
13491
  }
@@ -14811,6 +14815,175 @@ var CdcListener = class {
14811
14815
  }
14812
14816
  };
14813
14817
  //#endregion
14818
+ //#region src/services/realtime-prefilter.ts
14819
+ /** The canonical spelling of SQL `NULL` in an index. */
14820
+ var NULL_KEY = "\0null";
14821
+ var INTEGER_KINDS = /* @__PURE__ */ new Set([
14822
+ "smallint",
14823
+ "integer",
14824
+ "bigint",
14825
+ "smallserial",
14826
+ "serial",
14827
+ "bigserial"
14828
+ ]);
14829
+ var STRING_KINDS = /* @__PURE__ */ new Set([
14830
+ "text",
14831
+ "varchar",
14832
+ "enum"
14833
+ ]);
14834
+ var TRUE_SPELLINGS = /* @__PURE__ */ new Set([
14835
+ "t",
14836
+ "true",
14837
+ "y",
14838
+ "yes",
14839
+ "on",
14840
+ "1"
14841
+ ]);
14842
+ var FALSE_SPELLINGS = /* @__PURE__ */ new Set([
14843
+ "f",
14844
+ "false",
14845
+ "n",
14846
+ "no",
14847
+ "off",
14848
+ "0"
14849
+ ]);
14850
+ function judgedKind(kind) {
14851
+ return INTEGER_KINDS.has(kind) || STRING_KINDS.has(kind) || kind === "uuid" || kind === "boolean";
14852
+ }
14853
+ /**
14854
+ * A value as Postgres would compare it in a column of `kind`, as one string,
14855
+ * or `undefined` when that cannot be said with certainty — the caller then
14856
+ * treats the comparison as unknown. Accepts both a filter's JSON value and a
14857
+ * change's value (a JS value from the write path, or the text the WAL sends).
14858
+ */
14859
+ function canonicalValue(kind, value) {
14860
+ if (value === null) return NULL_KEY;
14861
+ if (INTEGER_KINDS.has(kind)) {
14862
+ if (typeof value === "number") return Number.isSafeInteger(value) ? String(value) : void 0;
14863
+ if (typeof value === "bigint") return value.toString();
14864
+ if (typeof value === "string" && /^\s*[+-]?\d{1,20}\s*$/.test(value)) return BigInt(value.trim()).toString();
14865
+ return;
14866
+ }
14867
+ if (kind === "boolean") {
14868
+ if (typeof value === "boolean") return value ? "t" : "f";
14869
+ if (typeof value !== "string") return void 0;
14870
+ const spelled = value.trim().toLowerCase();
14871
+ if (TRUE_SPELLINGS.has(spelled)) return "t";
14872
+ if (FALSE_SPELLINGS.has(spelled)) return "f";
14873
+ return;
14874
+ }
14875
+ if (kind === "uuid") {
14876
+ if (typeof value !== "string") return void 0;
14877
+ const hex = value.trim().replace(/^\{(.*)\}$/, "$1").replace(/-/g, "").toLowerCase();
14878
+ return /^[0-9a-f]{32}$/.test(hex) ? hex : void 0;
14879
+ }
14880
+ if (STRING_KINDS.has(kind)) return typeof value === "string" && value.length <= 256 ? value : void 0;
14881
+ }
14882
+ /** The `[op, value]` tuples of one filter entry: one tuple, or an array of them. */
14883
+ function filterTuples(param) {
14884
+ if (!Array.isArray(param) || param.length === 0) return [];
14885
+ if (Array.isArray(param[0])) return param.filter((tuple) => Array.isArray(tuple) && tuple.length >= 1).map((tuple) => [tuple[0], tuple[1]]);
14886
+ return [[param[0], param[1]]];
14887
+ }
14888
+ function equalityConjunct(field, kind, op, value) {
14889
+ if (op === "==") {
14890
+ const key = value === void 0 ? NULL_KEY : canonicalValue(kind, value);
14891
+ return key === void 0 ? void 0 : {
14892
+ field,
14893
+ kind,
14894
+ accepts: /* @__PURE__ */ new Set([key])
14895
+ };
14896
+ }
14897
+ if (op === "in") {
14898
+ if (value === null || value === void 0) return {
14899
+ field,
14900
+ kind,
14901
+ accepts: /* @__PURE__ */ new Set([NULL_KEY])
14902
+ };
14903
+ if (!Array.isArray(value)) return void 0;
14904
+ const accepts = /* @__PURE__ */ new Set();
14905
+ for (const item of value) {
14906
+ if (item === null) continue;
14907
+ const key = canonicalValue(kind, item);
14908
+ if (key === void 0) return void 0;
14909
+ accepts.add(key);
14910
+ }
14911
+ return {
14912
+ field,
14913
+ kind,
14914
+ accepts
14915
+ };
14916
+ }
14917
+ }
14918
+ /**
14919
+ * The pre-filter for a list read of `table`, or `undefined` when the list
14920
+ * must refetch on every change to the table.
14921
+ */
14922
+ function compileListPrefilter(table, request, tableHasReadHooks) {
14923
+ if (tableHasReadHooks) return void 0;
14924
+ const include = request.include;
14925
+ if (include !== void 0 && !(Array.isArray(include) && include.length === 0)) return void 0;
14926
+ const filter = request.filter;
14927
+ if (!filter) return void 0;
14928
+ const transformed = table.compiled.transforms ?? {};
14929
+ const conjuncts = [];
14930
+ for (const [field, param] of Object.entries(filter)) {
14931
+ const column = table.columnsByKey.get(field);
14932
+ if (!column || !judgedKind(column.type.kind)) continue;
14933
+ if (Object.prototype.hasOwnProperty.call(transformed, field)) continue;
14934
+ for (const [op, value] of filterTuples(param)) {
14935
+ const conjunct = equalityConjunct(field, column.type.kind, op, value);
14936
+ if (conjunct) conjuncts.push(conjunct);
14937
+ }
14938
+ }
14939
+ if (conjuncts.length === 0) return void 0;
14940
+ return {
14941
+ conjuncts,
14942
+ index: conjuncts.reduce((best, next) => next.accepts.size < best.accepts.size ? next : best)
14943
+ };
14944
+ }
14945
+ /**
14946
+ * Whether one version of a row matches the judged conditions: `false` only
14947
+ * when a condition is known to fail, `undefined` when one cannot be read.
14948
+ */
14949
+ function prefilterMatches(prefilter, values) {
14950
+ let known = true;
14951
+ for (const conjunct of prefilter.conjuncts) {
14952
+ if (!Object.prototype.hasOwnProperty.call(values, conjunct.field)) {
14953
+ known = false;
14954
+ continue;
14955
+ }
14956
+ const key = canonicalValue(conjunct.kind, values[conjunct.field]);
14957
+ if (key === void 0) {
14958
+ known = false;
14959
+ continue;
14960
+ }
14961
+ if (!conjunct.accepts.has(key)) return false;
14962
+ }
14963
+ return known ? true : void 0;
14964
+ }
14965
+ /**
14966
+ * Whether a change may alter a list with this pre-filter: unless both
14967
+ * versions of the row are known not to match it.
14968
+ */
14969
+ function changeMayReach(prefilter, image) {
14970
+ for (const version of [image.before, image.after]) {
14971
+ if (version === null) continue;
14972
+ if (version === void 0) return true;
14973
+ if (prefilterMatches(prefilter, version) !== false) return true;
14974
+ }
14975
+ return false;
14976
+ }
14977
+ /**
14978
+ * The index keys a version of a row is found under for `field`, or
14979
+ * `undefined` when the version cannot say — then every group indexed by the
14980
+ * field may be reached.
14981
+ */
14982
+ function imageIndexKey(version, field, kind) {
14983
+ if (!Object.prototype.hasOwnProperty.call(version, field)) return void 0;
14984
+ return canonicalValue(kind, version[field]);
14985
+ }
14986
+ //#endregion
14814
14987
  //#region src/services/cdc/pgoutput.ts
14815
14988
  /** Microseconds between the Unix epoch and Postgres's, 2000-01-01. */
14816
14989
  var PG_EPOCH_OFFSET_US = 946684800000000n;
@@ -15096,6 +15269,24 @@ function identityOf(relation, tuple, wanted, keyOnly) {
15096
15269
  return Object.keys(row).length > 0 ? row : void 0;
15097
15270
  }
15098
15271
  /**
15272
+ * A tuple's values by column name, as text. A column the tuple does not carry
15273
+ * (an unchanged TOASTed value, a non-key column of a key-only tuple) is left
15274
+ * out — unknown, not null — and so is a value longer than
15275
+ * `MAX_IMAGE_VALUE_LENGTH`: nothing compares one, and a backlog of changes
15276
+ * should not hold every large column of every row.
15277
+ */
15278
+ function tupleValues(relation, tuple, keyOnly) {
15279
+ const values = {};
15280
+ relation.columns.forEach((column, i) => {
15281
+ if (keyOnly && !column.isKey) return;
15282
+ const value = tuple[i];
15283
+ if (value === void 0) return;
15284
+ if (value !== null && value.length > 256) return;
15285
+ values[column.name] = value;
15286
+ });
15287
+ return values;
15288
+ }
15289
+ /**
15099
15290
  * Turns a `pgoutput` stream into the change events the trigger listener emits,
15100
15291
  * so `RealtimeService` cannot tell which one it is reading.
15101
15292
  *
@@ -15119,16 +15310,16 @@ var PgoutputChanges = class {
15119
15310
  case "relation":
15120
15311
  this.relations.set(message.relation.id, message.relation);
15121
15312
  return [];
15122
- case "insert": return this.change("INSERT", message.relationId, message.newTuple, false);
15313
+ case "insert": return this.withValues(this.change("INSERT", message.relationId, message.newTuple, false), message.relationId, null, message.newTuple, false);
15123
15314
  case "update": {
15124
- const events = this.change("UPDATE", message.relationId, message.newTuple, false);
15315
+ const events = this.withValues(this.change("UPDATE", message.relationId, message.newTuple, false), message.relationId, message.oldTuple ?? message.newTuple, message.newTuple, message.oldTuple ? message.oldIsKeyOnly === true : true);
15125
15316
  if (message.oldTuple) {
15126
15317
  const before = this.change("UPDATE", message.relationId, message.oldTuple, message.oldIsKeyOnly === true);
15127
15318
  if (before.length && JSON.stringify(before[0].row) !== JSON.stringify(events[0]?.row)) events.push(...before);
15128
15319
  }
15129
15320
  return events;
15130
15321
  }
15131
- case "delete": return this.change("DELETE", message.relationId, message.oldTuple, message.oldIsKeyOnly);
15322
+ case "delete": return this.withValues(this.change("DELETE", message.relationId, message.oldTuple, message.oldIsKeyOnly), message.relationId, message.oldTuple, null, message.oldIsKeyOnly);
15132
15323
  case "truncate": return message.relationIds.flatMap((id) => {
15133
15324
  const relation = this.relations.get(id);
15134
15325
  return relation ? [{
@@ -15142,6 +15333,23 @@ var PgoutputChanges = class {
15142
15333
  default: return [];
15143
15334
  }
15144
15335
  }
15336
+ /**
15337
+ * Put the column values of the row's two versions on the first event: see
15338
+ * `CdcChangeEvent.values`. `before` is read for its key columns alone when
15339
+ * `beforeKeyOnly`, which is all a default replica identity sends.
15340
+ */
15341
+ withValues(events, relationId, before, after, beforeKeyOnly) {
15342
+ const relation = this.relations.get(relationId);
15343
+ if (!relation || events.length === 0) return events;
15344
+ events[0] = {
15345
+ ...events[0],
15346
+ values: {
15347
+ before: before === null ? null : tupleValues(relation, before, beforeKeyOnly),
15348
+ after: after === null ? null : tupleValues(relation, after, false)
15349
+ }
15350
+ };
15351
+ return events;
15352
+ }
15145
15353
  change(op, relationId, tuple, keyOnly) {
15146
15354
  const relation = this.relations.get(relationId);
15147
15355
  if (!relation) throw new Error(`row for relation ${relationId}, which the stream never described`);
@@ -17077,6 +17285,13 @@ var RealtimeService = class RealtimeService extends EventEmitter {
17077
17285
  */
17078
17286
  unscheduledListGroups = /* @__PURE__ */ new Map();
17079
17287
  /**
17288
+ * The subset of {@link unscheduledListGroups} with no pre-filter: what a
17289
+ * change that can be judged still schedules wholesale.
17290
+ */
17291
+ unscheduledPlainListGroups = /* @__PURE__ */ new Map();
17292
+ /** The pre-filtered list groups on each path. See {@link groupsReachedBy}. */
17293
+ prefilterIndex = /* @__PURE__ */ new Map();
17294
+ /**
17080
17295
  * Every path a subscription holds, with the collection it lands on and how
17081
17296
  * many hold it — the candidates `aliasPaths` considers, resolved once.
17082
17297
  */
@@ -17282,6 +17497,7 @@ var RealtimeService = class RealtimeService extends EventEmitter {
17282
17497
  lastChangeAt: 0
17283
17498
  };
17284
17499
  this.groups.set(group.key, group);
17500
+ if (group.type === "collection") this.indexPrefilter(group);
17285
17501
  const [index, address] = group.type === "collection" ? [this.collectionGroupsByPath, group.path] : [this.singleGroupsByAddress, `${group.path}\u0000${group.id}`];
17286
17502
  let bucket = index.get(address);
17287
17503
  if (!bucket) index.set(address, bucket = /* @__PURE__ */ new Set());
@@ -17344,17 +17560,90 @@ var RealtimeService = class RealtimeService extends EventEmitter {
17344
17560
  }
17345
17561
  if (group.type === "collection") {
17346
17562
  this.unscheduledListGroups.get(group.path)?.delete(group);
17563
+ this.unscheduledPlainListGroups.get(group.path)?.delete(group);
17564
+ this.unindexPrefilter(group);
17347
17565
  if (!this.collectionGroupsByPath.has(group.path)) {
17348
17566
  this.unscheduledListGroups.delete(group.path);
17567
+ this.unscheduledPlainListGroups.delete(group.path);
17349
17568
  this.listPathChangedAt.delete(group.path);
17350
17569
  }
17351
17570
  }
17352
17571
  }
17572
+ /**
17573
+ * Compile `group`'s pre-filter and index it under its narrowest
17574
+ * condition. Only for a list on a table's own path: a nested list's rows
17575
+ * are chosen by its parent, which a change to the row does not describe.
17576
+ */
17577
+ indexPrefilter(group) {
17578
+ group.prefilter = void 0;
17579
+ if (isNestedPath(group.path)) return;
17580
+ let table;
17581
+ try {
17582
+ table = this.registry.tableAt(group.path);
17583
+ } catch {
17584
+ return;
17585
+ }
17586
+ if (!table) return;
17587
+ const prefilter = compileListPrefilter(table, group.collectionRequest ?? {}, afterReadApplies(this.registry, resolveTableHooks(this.registry, group.path)));
17588
+ if (!prefilter) return;
17589
+ group.prefilter = prefilter;
17590
+ let index = this.prefilterIndex.get(group.path);
17591
+ if (!index) this.prefilterIndex.set(group.path, index = /* @__PURE__ */ new Map());
17592
+ let entry = index.get(prefilter.index.field);
17593
+ if (!entry) index.set(prefilter.index.field, entry = {
17594
+ kind: prefilter.index.kind,
17595
+ buckets: /* @__PURE__ */ new Map()
17596
+ });
17597
+ for (const value of prefilter.index.accepts) {
17598
+ let bucket = entry.buckets.get(value);
17599
+ if (!bucket) entry.buckets.set(value, bucket = /* @__PURE__ */ new Set());
17600
+ bucket.add(group);
17601
+ }
17602
+ }
17603
+ unindexPrefilter(group) {
17604
+ const prefilter = group.prefilter;
17605
+ if (!prefilter) return;
17606
+ const index = this.prefilterIndex.get(group.path);
17607
+ const entry = index?.get(prefilter.index.field);
17608
+ if (!index || !entry) return;
17609
+ for (const value of prefilter.index.accepts) {
17610
+ const bucket = entry.buckets.get(value);
17611
+ bucket?.delete(group);
17612
+ if (bucket?.size === 0) entry.buckets.delete(value);
17613
+ }
17614
+ if (entry.buckets.size === 0) index.delete(prefilter.index.field);
17615
+ if (index.size === 0) this.prefilterIndex.delete(group.path);
17616
+ }
17617
+ /**
17618
+ * The pre-filtered list groups on `path` that `image` may reach, or
17619
+ * `undefined` when the change cannot say which value it had in a field
17620
+ * groups are indexed by — then every group on the path is asked, as for
17621
+ * a change with no image at all.
17622
+ */
17623
+ groupsReachedBy(index, image) {
17624
+ const reached = /* @__PURE__ */ new Set();
17625
+ for (const [field, entry] of index) {
17626
+ const keys = [];
17627
+ for (const version of [image.before, image.after]) {
17628
+ if (version === null) continue;
17629
+ if (version === void 0) return void 0;
17630
+ const key = imageIndexKey(version, field, entry.kind);
17631
+ if (key === void 0) return void 0;
17632
+ keys.push(key);
17633
+ }
17634
+ for (const key of keys) for (const group of entry.buckets.get(key) ?? []) if (group.prefilter && changeMayReach(group.prefilter, image)) reached.add(group);
17635
+ }
17636
+ return reached;
17637
+ }
17353
17638
  /** See {@link unscheduledListGroups}. */
17354
17639
  markListGroupUnscheduled(group) {
17355
17640
  let unscheduled = this.unscheduledListGroups.get(group.path);
17356
17641
  if (!unscheduled) this.unscheduledListGroups.set(group.path, unscheduled = /* @__PURE__ */ new Set());
17357
17642
  unscheduled.add(group);
17643
+ if (group.prefilter) return;
17644
+ let plain = this.unscheduledPlainListGroups.get(group.path);
17645
+ if (!plain) this.unscheduledPlainListGroups.set(group.path, plain = /* @__PURE__ */ new Set());
17646
+ plain.add(group);
17358
17647
  }
17359
17648
  /**
17360
17649
  * Ask for a refetch of `group` once changes have been quiet for the
@@ -17380,7 +17669,7 @@ var RealtimeService = class RealtimeService extends EventEmitter {
17380
17669
  group.timer = void 0;
17381
17670
  if (this.groups.get(group.key) !== group) return;
17382
17671
  const now = Date.now();
17383
- const quietFor = now - (group.type === "collection" ? Math.max(group.lastChangeAt, this.listPathChangedAt.get(group.path) ?? 0) : group.lastChangeAt);
17672
+ const quietFor = now - (group.type === "collection" && !group.prefilter ? Math.max(group.lastChangeAt, this.listPathChangedAt.get(group.path) ?? 0) : group.lastChangeAt);
17384
17673
  const waitedFor = now - (group.firstPendingAt ?? now);
17385
17674
  if (quietFor < RealtimeService.REFETCH_DEBOUNCE_MS && waitedFor < this.refetchMaxWaitMs) {
17386
17675
  this.armGroupTimer(group, Math.min(RealtimeService.REFETCH_DEBOUNCE_MS - quietFor, this.refetchMaxWaitMs - waitedFor));
@@ -17994,7 +18283,12 @@ var RealtimeService = class RealtimeService extends EventEmitter {
17994
18283
  * records the change so this instance can suppress the matching
17995
18284
  * CDC echo, while an unmatched CDC event is delivered normally.
17996
18285
  */
17997
- async notifyUpdate(path, id, row, databaseId, broadcast = true, origin = "app") {
18286
+ /**
18287
+ * @param image What the change is known to have done to the row, by column
18288
+ * key — see `realtime-prefilter.ts`. It narrows which list groups on
18289
+ * `path` refetch, never what any of them receives. Absent, all of them do.
18290
+ */
18291
+ async notifyUpdate(path, id, row, databaseId, broadcast = true, origin = "app", image) {
17998
18292
  this.debugLog("🔔 [RealtimeService] notifyUpdate called for path:", path, "id:", id, "isDelete:", row === null, "origin:", origin);
17999
18293
  const aliases = this.aliasPaths(path);
18000
18294
  if (this.cdcActive) {
@@ -18018,7 +18312,7 @@ var RealtimeService = class RealtimeService extends EventEmitter {
18018
18312
  pathsToNotify.push(...parentPaths);
18019
18313
  this.debugLog(`🔗 [RealtimeService] Nested path detected. Will notify paths: ${pathsToNotify.join(", ")}`);
18020
18314
  }
18021
- for (const notifyPath of pathsToNotify) this.notifyPathUpdate(notifyPath, path, id);
18315
+ for (const notifyPath of pathsToNotify) this.notifyPathUpdate(notifyPath, path, id, notifyPath === path && !isNestedPath(path) ? image : void 0);
18022
18316
  for (const alias of aliases) this.notifyPathUpdate(alias, alias, id);
18023
18317
  if (broadcast && this.broadcasting && !this.cdcActive) this.broadcastChange(path, id, databaseId).catch((err) => {
18024
18318
  logger.error("❌ [RealtimeService] Failed to broadcast change via pg_notify", { error: err });
@@ -18060,14 +18354,30 @@ var RealtimeService = class RealtimeService extends EventEmitter {
18060
18354
  * being able to know, without asking the database as this subscriber,
18061
18355
  * whether this subscriber may see the row at all.
18062
18356
  */
18063
- notifyPathUpdate(notifyPath, originalPath, id) {
18357
+ notifyPathUpdate(notifyPath, originalPath, id, image) {
18064
18358
  this.debugLog(`📡 [RealtimeService] Notifying path: ${notifyPath} (original: ${originalPath})`);
18065
18359
  if (this.collectionGroupsByPath.has(notifyPath)) {
18066
18360
  this.listPathChangedAt.set(notifyPath, Date.now());
18067
- const unscheduled = this.unscheduledListGroups.get(notifyPath);
18068
- if (unscheduled?.size) {
18069
- for (const group of unscheduled) this.scheduleGroupRefetch(group);
18070
- unscheduled.clear();
18361
+ const index = image ? this.prefilterIndex.get(notifyPath) : void 0;
18362
+ const reached = index && image ? this.groupsReachedBy(index, image) : void 0;
18363
+ if (reached) {
18364
+ const plain = this.unscheduledPlainListGroups.get(notifyPath);
18365
+ if (plain?.size) {
18366
+ const unscheduled = this.unscheduledListGroups.get(notifyPath);
18367
+ for (const group of plain) {
18368
+ this.scheduleGroupRefetch(group);
18369
+ unscheduled?.delete(group);
18370
+ }
18371
+ plain.clear();
18372
+ }
18373
+ for (const group of reached) this.scheduleGroupRefetch(group);
18374
+ } else {
18375
+ const unscheduled = this.unscheduledListGroups.get(notifyPath);
18376
+ if (unscheduled?.size) {
18377
+ for (const group of unscheduled) this.scheduleGroupRefetch(group);
18378
+ unscheduled.clear();
18379
+ }
18380
+ this.unscheduledPlainListGroups.get(notifyPath)?.clear();
18071
18381
  }
18072
18382
  }
18073
18383
  if (notifyPath !== originalPath) return;
@@ -19258,6 +19568,8 @@ var RealtimeService = class RealtimeService extends EventEmitter {
19258
19568
  group.recountTimer = void 0;
19259
19569
  }
19260
19570
  this.unscheduledListGroups.clear();
19571
+ this.unscheduledPlainListGroups.clear();
19572
+ this.prefilterIndex.clear();
19261
19573
  this.listPathChangedAt.clear();
19262
19574
  this.refetchQueue.clear();
19263
19575
  this._subscriptions.clear();
@@ -19444,6 +19756,13 @@ var RealtimeService = class RealtimeService extends EventEmitter {
19444
19756
  * change capture is off: the maps are built when it starts.
19445
19757
  */
19446
19758
  refreshTableMaps() {
19759
+ for (const group of this.groups.values()) {
19760
+ if (group.type !== "collection") continue;
19761
+ this.unindexPrefilter(group);
19762
+ this.unscheduledPlainListGroups.get(group.path)?.delete(group);
19763
+ this.indexPrefilter(group);
19764
+ if (this.unscheduledListGroups.get(group.path)?.has(group)) this.markListGroupUnscheduled(group);
19765
+ }
19447
19766
  if (!this.cdcTableMap) return;
19448
19767
  this.cdcTableMap = this.buildCdcTableMap();
19449
19768
  this.junctionLinkMap = buildJunctionLinkMap(this.registry);
@@ -19558,7 +19877,42 @@ var RealtimeService = class RealtimeService extends EventEmitter {
19558
19877
  const path = served.slug;
19559
19878
  const id = event.op === "TRUNCATE" ? ANY_ROW : this.extractIdFromCdcRow(served, event.row);
19560
19879
  const row = event.op === "DELETE" || event.op === "TRUNCATE" ? null : { _rebase_invalidated: true };
19561
- await this.notifyUpdate(path, id, row, void 0, false, "cdc");
19880
+ await this.notifyUpdate(path, id, row, void 0, false, "cdc", this.cdcChangeImage(served, event));
19881
+ }
19882
+ /**
19883
+ * What a captured change says about the row's two versions, by column
19884
+ * key — which list groups it can reach, never what they receive.
19885
+ *
19886
+ * From the WAL, the values it streamed (`CdcChangeEvent.values`). From the
19887
+ * capture trigger, the key alone, and only where the op pins the other
19888
+ * version: an insert had no row before, a delete has none after. A
19889
+ * trigger's update names the new key only — the old one may differ — and
19890
+ * a key too large to send names nothing: both are unknown.
19891
+ */
19892
+ cdcChangeImage(served, event) {
19893
+ if (event.op === "TRUNCATE") return void 0;
19894
+ const byKey = (values) => {
19895
+ if (values === null || values === void 0) return values;
19896
+ const keyed = {};
19897
+ for (const [columnName, value] of Object.entries(values)) {
19898
+ const column = served.columnsBySqlName.get(columnName);
19899
+ if (column) keyed[column.key] = value;
19900
+ }
19901
+ return keyed;
19902
+ };
19903
+ if (event.values) return {
19904
+ before: byKey(event.values.before),
19905
+ after: byKey(event.values.after)
19906
+ };
19907
+ if (event.truncated || Object.keys(event.row).length === 0) return void 0;
19908
+ if (event.op === "INSERT") return {
19909
+ before: null,
19910
+ after: byKey(event.row)
19911
+ };
19912
+ if (event.op === "DELETE") return {
19913
+ before: byKey(event.row),
19914
+ after: null
19915
+ };
19562
19916
  }
19563
19917
  /**
19564
19918
  * Deliver a change on a many-to-many junction table as a change to the child
@@ -23236,6 +23590,10 @@ function diagnoseConnectFailure(err, connectionString) {
23236
23590
  logger.error(diagnoseDbError(err, url) ?? `❌ Database "${closed}" at ${hostInfo} is closed to new connections`);
23237
23591
  return new Error(`Database "${closed}" at ${hostInfo} is closed to new connections: ${reason}${detail}. Open it again with \`rebase db branch list\`.`, { cause: err });
23238
23592
  }
23593
+ if (isUntrustedServerCertificate(err)) {
23594
+ logger.error(diagnoseDbError(err, url) ?? `❌ The certificate of the PostgreSQL server at ${hostInfo} is not trusted`);
23595
+ return new Error(`The certificate of the PostgreSQL server at ${hostInfo} is not trusted: ${reason}${detail}. Use sslmode=no-verify to encrypt without verifying, or sslmode=verify-full with sslrootcert.`, { cause: err });
23596
+ }
23239
23597
  if (code === "53300") {
23240
23598
  const remedy = extractPgError(err)?.hint ?? "Close another client, cap this process's pool with REBASE_DB_POOL_MAX, or raise the server's max_connections.";
23241
23599
  logger.error(`
@@ -24024,7 +24382,7 @@ function createPostgresBootstrapper(pgConfig) {
24024
24382
  const openIndexBuildSession = (driverResult) => async () => {
24025
24383
  const db = requireProvisioningDb(driverResult);
24026
24384
  const pool = "$client" in db ? db.$client : void 0;
24027
- const { clientIndexBuildSession, isPgPool, poolIndexBuildSession } = await import("./deferred-index-build-ueYVUBZc.js").then((n) => n.r);
24385
+ const { clientIndexBuildSession, isPgPool, poolIndexBuildSession } = await import("./deferred-index-build-88bWtYgx.js").then((n) => n.r);
24028
24386
  const config = effectiveConfig();
24029
24387
  if (isPooledPool(pool) || config.pooled) {
24030
24388
  if (!config.directConnectionString) throw pooledWithoutDirectUrlError(DEFAULT_DATA_SOURCE_KEY);
@@ -24167,11 +24525,11 @@ function createPostgresBootstrapper(pgConfig) {
24167
24525
  unavailable: historyUnavailableReason(state, { requireTransaction: false })
24168
24526
  }) };
24169
24527
  }
24170
- const { BOOT_LOCK_TIMEOUT_MS } = await import("./boot-ddl-CSYhSSZD.js").then((n) => n.i);
24528
+ const { BOOT_LOCK_TIMEOUT_MS } = await import("./boot-ddl-Bu6gAY-2.js").then((n) => n.i);
24171
24529
  const historyTable = await ensureHistoryTableExists(db, { lockTimeoutMs: BOOT_LOCK_TIMEOUT_MS });
24172
24530
  const historyIndexes = await ensureHistoryIndexes(db, { lockTimeoutMs: BOOT_LOCK_TIMEOUT_MS });
24173
24531
  if (historyIndexes.length > 0) {
24174
- const { buildDeferredIndexes, scheduleDeferredIndexBuild } = await import("./deferred-index-build-ueYVUBZc.js").then((n) => n.r);
24532
+ const { buildDeferredIndexes, scheduleDeferredIndexBuild } = await import("./deferred-index-build-88bWtYgx.js").then((n) => n.r);
24175
24533
  const indexOptions = {
24176
24534
  log: (message) => logger.info(`[history] ${message}`),
24177
24535
  lockTimeoutMs: BOOT_LOCK_TIMEOUT_MS
@@ -24227,9 +24585,9 @@ function createPostgresBootstrapper(pgConfig) {
24227
24585
  * proved it can bootstrap with.
24228
24586
  */
24229
24587
  async ensureTableSchema(tables, driverResult, log) {
24230
- const { ensureTables } = await import("./ensure-tables-B3Kh2RwT.js").then((n) => n.n);
24588
+ const { ensureTables } = await import("./ensure-tables-Lm-77eM5.js").then((n) => n.n);
24231
24589
  const queryable = provisioningQueryable(driverResult);
24232
- const { BOOT_LOCK_TIMEOUT_MS } = await import("./boot-ddl-CSYhSSZD.js").then((n) => n.i);
24590
+ const { BOOT_LOCK_TIMEOUT_MS } = await import("./boot-ddl-Bu6gAY-2.js").then((n) => n.i);
24233
24591
  const provisionOnly = ["1", "true"].includes((process.env.REBASE_PROVISION_ONLY ?? "").trim().toLowerCase());
24234
24592
  const plan = await ensureTables(queryable, tables, log, {
24235
24593
  lockTimeoutMs: BOOT_LOCK_TIMEOUT_MS,
@@ -24241,7 +24599,7 @@ function createPostgresBootstrapper(pgConfig) {
24241
24599
  pendingIndexBuild?.cancel();
24242
24600
  pendingIndexBuild = void 0;
24243
24601
  if (!provisionOnly && plan.deferredIndexes.length > 0) {
24244
- const { scheduleDeferredIndexBuild } = await import("./deferred-index-build-ueYVUBZc.js").then((n) => n.r);
24602
+ const { scheduleDeferredIndexBuild } = await import("./deferred-index-build-88bWtYgx.js").then((n) => n.r);
24245
24603
  logger.info(`[schema] ${plan.deferredIndexes.length} index(es) are missing, or were left INVALID, on tables that already exist. They are built in the background once the server is serving, one at a time, without blocking reads or writes.`);
24246
24604
  pendingIndexBuild = scheduleDeferredIndexBuild(openIndexBuildSession(driverResult), plan.deferredIndexes, {
24247
24605
  log: (message) => logger.info(`[schema] ${message}`),
@@ -24281,7 +24639,7 @@ function createPostgresBootstrapper(pgConfig) {
24281
24639
  await provisionRlsRuntime(driverResult);
24282
24640
  },
24283
24641
  async ensureTablePolicies(tables, driverResult, log) {
24284
- const { ensureTablePolicies, describeRulesDropped } = await import("./ensure-policies-13mHWjBs.js");
24642
+ const { ensureTablePolicies, describeRulesDropped } = await import("./ensure-policies-nIITKxud.js");
24285
24643
  const queryable = provisioningQueryable(driverResult);
24286
24644
  const { rows } = await queryable.query("SELECT to_regprocedure('rebase.roles()') IS NOT NULL AS present");
24287
24645
  if (!rows[0]?.present) await provisionRlsRuntime(driverResult);
@@ -24417,7 +24775,7 @@ function createPostgresBootstrapper(pgConfig) {
24417
24775
  return driverResult.internals.driver.admin;
24418
24776
  },
24419
24777
  async initializeWebsockets(server, realtimeService, driver, config, adapter, limits) {
24420
- const { createPostgresWebSocket, isSocketRealtimeService, socketRealtimeMissing } = await import("./websocket-CSVNOYHC.js").then((n) => n.c);
24778
+ const { createPostgresWebSocket, isSocketRealtimeService, socketRealtimeMissing } = await import("./websocket-kZixcOXt.js").then((n) => n.c);
24421
24779
  if (!isSocketRealtimeService(realtimeService)) throw new Error(`The realtime service handed to the Postgres socket cannot serve it — it has no ${socketRealtimeMissing(realtimeService).join(", ")}. Every socket would fail on its first frame.`);
24422
24780
  const realtimeConfig = effectiveConfig().realtime;
24423
24781
  const maxSocketsPerUser = realtimeConfig?.maxSocketsPerUser !== void 0 ? parseMaxSocketsPerUser(realtimeConfig.maxSocketsPerUser, "realtime.maxSocketsPerUser") : void 0;
@@ -24578,4 +24936,4 @@ async function openRebase(options) {
24578
24936
  //#endregion
24579
24937
  export { PostgresBackendDriver as $, reapSilentSockets as A, passwordResetTokens as B, PostgresChannelBus as C, frameByteLength as D, MemoryChannelBus as E, magicLinkTokensRelations as F, refreshTokensRelations as G, recoveryCodes as H, mfaChallenges as I, users as J, userIdentities as K, mfaChallengesRelations as L, appConfig as M, createAuthSchema as N, isChannelBusInstance$1 as O, magicLinkTokens as P, CONNECTION_OWNER as Q, mfaFactors as R, PG_NOTIFY_MAX_PAYLOAD_BYTES as S, parseChannelBusPayload as T, recoveryCodesRelations as U, passwordResetTokensRelations as V, refreshTokens as W, usersSchema as X, usersRelations as Y, AuthenticatedPostgresBackendDriver as Z, refetchConcurrencyFor as _, openPostgresDriver as a, SQL_RESULT_BYTE_BUDGET as at, CHANNEL_BUS_NOTIFY_CHANNEL as b, PostgresTableRegistry as c, resolveNestedPath as ct, PostgresRealtimeProvider as d, PostgresConditionBuilder as dt, RoleSwitchUnavailableError as et, RealtimeService as f, configureUnknownFilterFields as ft, parseRealtimeTuning as g, listedColumnKeys as gt, parseMaxSubscriptionsPerSocket as h, joinColumn as ht, isScaffoldedLocalDatabase as i, sqlRoleRanAs as it, terminateIfBacklogged as j, budgetSendBuffers as k, DEFAULT_MAX_SUBSCRIPTIONS_PER_SOCKET as l, assertReadRequestReadable as lt, parseMaxSocketsPerUser as m, getUnknownFilterFieldsMode as mt, createPostgresBootstrapper as n, effectiveSqlRole as nt, postgresDriverConfigFromEnv as o, SqlResultTooLargeError as ot, packEntityChanges as p, escapeLikePattern as pt, userIdentitiesRelations as q, describeSchemaDriftCause as r, isRoleSwitchingOptedOut as rt, resolveSourceUrls as s, isNestedPath as st, openRebase as t, branchParentDatabase as tt, DEFAULT_RECOUNT_MIN_ROWS as u, DrizzleConditionBuilder as ut, createChannelBus as v, parseChannelBusFrame as w, DEFAULT_BATCH_WINDOW_MS as x, resolveChannelBusSetting as y, mfaFactorsRelations as z };
24580
24938
 
24581
- //# sourceMappingURL=open-rebase-B2mAA7UE.js.map
24939
+ //# sourceMappingURL=open-rebase-OB4hhQuk.js.map