@rebasepro/server-postgres 0.33.2 → 0.34.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 (73) hide show
  1. package/dist/{BranchService-Bdin0Wxh.js → BranchService-BLcVK_Rd.js} +3 -3
  2. package/dist/{BranchService-Bdin0Wxh.js.map → BranchService-BLcVK_Rd.js.map} +1 -1
  3. package/dist/{backup-cli-BEAMPWMs.js → backup-cli-CVLOCTo_.js} +3 -3
  4. package/dist/{backup-cli-BEAMPWMs.js.map → backup-cli-CVLOCTo_.js.map} +1 -1
  5. package/dist/{boot-ddl-Bu6gAY-2.js → boot-ddl-C7hAFEvY.js} +2 -2
  6. package/dist/{boot-ddl-Bu6gAY-2.js.map → boot-ddl-C7hAFEvY.js.map} +1 -1
  7. package/dist/{cli-console-BU_Rf22O.js → cli-console-E5TM3GaL.js} +4 -4
  8. package/dist/{cli-console-BU_Rf22O.js.map → cli-console-E5TM3GaL.js.map} +1 -1
  9. package/dist/{cli-schema-dir-CjDH_31U.js → cli-schema-dir-CdEqBcph.js} +29 -10
  10. package/dist/cli-schema-dir-CdEqBcph.js.map +1 -0
  11. package/dist/cli.js +29 -27
  12. package/dist/cli.js.map +1 -1
  13. package/dist/{database-preflight-DKzsGnc4.js → database-preflight-NmFI_rFN.js} +2 -2
  14. package/dist/{database-preflight-DKzsGnc4.js.map → database-preflight-NmFI_rFN.js.map} +1 -1
  15. package/dist/{deferred-index-build-88bWtYgx.js → deferred-index-build-Bz37bvxW.js} +4 -4
  16. package/dist/{deferred-index-build-88bWtYgx.js.map → deferred-index-build-Bz37bvxW.js.map} +1 -1
  17. package/dist/{ensure-policies-nIITKxud.js → ensure-policies-C1UCom37.js} +6 -6
  18. package/dist/{ensure-policies-nIITKxud.js.map → ensure-policies-C1UCom37.js.map} +1 -1
  19. package/dist/{ensure-tables-hQ5oAK_j.js → ensure-tables-BVUNi6uG.js} +3 -3
  20. package/dist/{ensure-tables-hQ5oAK_j.js.map → ensure-tables-BVUNi6uG.js.map} +1 -1
  21. package/dist/{ensure-tables-Lm-77eM5.js → ensure-tables-DjuNRClr.js} +7 -7
  22. package/dist/{ensure-tables-Lm-77eM5.js.map → ensure-tables-DjuNRClr.js.map} +1 -1
  23. package/dist/{enum-labels-kept-mesgEJWH.js → enum-labels-kept-DrCueSHr.js} +2 -2
  24. package/dist/{enum-labels-kept-mesgEJWH.js.map → enum-labels-kept-DrCueSHr.js.map} +1 -1
  25. package/dist/{generated-schema-diff-DoT2dYDe.js → generated-schema-diff-DDktAATD.js} +2 -2
  26. package/dist/{generated-schema-diff-DoT2dYDe.js.map → generated-schema-diff-DDktAATD.js.map} +1 -1
  27. package/dist/index.es.js +11 -11
  28. package/dist/{introspect-db-queries-BgiRQqtR.js → introspect-db-queries-D7u9EOfV.js} +66 -4
  29. package/dist/introspect-db-queries-D7u9EOfV.js.map +1 -0
  30. package/dist/{introspect-tables-Cw_A-kk4.js → introspect-tables-2yJ3p98l.js} +267 -30
  31. package/dist/introspect-tables-2yJ3p98l.js.map +1 -0
  32. package/dist/{migrate-baseline-Bzj5gSCM.js → migrate-baseline-CnIbBRgh.js} +4 -3
  33. package/dist/{migrate-baseline-Bzj5gSCM.js.map → migrate-baseline-CnIbBRgh.js.map} +1 -1
  34. package/dist/{migrate-policy-stamps-C2WaOEsB.js → migrate-policy-stamps-D7BaYeKO.js} +4 -4
  35. package/dist/{migrate-policy-stamps-C2WaOEsB.js.map → migrate-policy-stamps-D7BaYeKO.js.map} +1 -1
  36. package/dist/{open-rebase-x3yAPy5g.js → open-rebase-DykxNl1j.js} +72 -20
  37. package/dist/open-rebase-DykxNl1j.js.map +1 -0
  38. package/dist/{pg-error-utils-CWopxboq.js → pg-error-utils-DXyqf9yP.js} +2 -2
  39. package/dist/{pg-error-utils-CWopxboq.js.map → pg-error-utils-DXyqf9yP.js.map} +1 -1
  40. package/dist/{policy-drift-rVLKS2AG.js → policy-drift-B2Czzs2Z.js} +3 -3
  41. package/dist/{policy-drift-rVLKS2AG.js.map → policy-drift-B2Czzs2Z.js.map} +1 -1
  42. package/dist/{push-index-adoption-EcamXfW2.js → push-index-adoption-DTLPk_5i.js} +2 -2
  43. package/dist/{push-index-adoption-EcamXfW2.js.map → push-index-adoption-DTLPk_5i.js.map} +1 -1
  44. package/dist/{push-index-prebuild-BPIns6wA.js → push-index-prebuild-WP5272gZ.js} +3 -3
  45. package/dist/{push-index-prebuild-BPIns6wA.js.map → push-index-prebuild-WP5272gZ.js.map} +1 -1
  46. package/dist/{push-legacy-renames-lmYkb41I.js → push-legacy-renames-CvWSBxRu.js} +3 -3
  47. package/dist/{push-legacy-renames-lmYkb41I.js.map → push-legacy-renames-CvWSBxRu.js.map} +1 -1
  48. package/dist/{push-policy-plan-Dqu4FKWh.js → push-policy-plan-D8HvHgPs.js} +3 -3
  49. package/dist/{push-policy-plan-Dqu4FKWh.js.map → push-policy-plan-D8HvHgPs.js.map} +1 -1
  50. package/dist/{request-role-cli-Ay0v9oYZ.js → request-role-cli-Y5Uqalop.js} +8 -8
  51. package/dist/{request-role-cli-Ay0v9oYZ.js.map → request-role-cli-Y5Uqalop.js.map} +1 -1
  52. package/dist/{request-role-migration-DTE3Owsh.js → request-role-migration-Cc0gJSso.js} +2 -2
  53. package/dist/{request-role-migration-DTE3Owsh.js.map → request-role-migration-Cc0gJSso.js.map} +1 -1
  54. package/dist/{rls-enforcement-Ck-d8zdJ.js → rls-enforcement-NZKe3Jr-.js} +2 -2
  55. package/dist/{rls-enforcement-Ck-d8zdJ.js.map → rls-enforcement-NZKe3Jr-.js.map} +1 -1
  56. package/dist/schema/destructive-sql.d.ts +9 -1
  57. package/dist/schema/doctor-cli.js +6 -6
  58. package/dist/schema/introspect-db-logic.d.ts +51 -0
  59. package/dist/schema/introspect-db-project.d.ts +6 -0
  60. package/dist/schema/introspect-db-queries.d.ts +21 -2
  61. package/dist/schema/introspect-db.js +53 -4
  62. package/dist/schema/introspect-db.js.map +1 -1
  63. package/dist/schema/introspect-foreign.d.ts +47 -0
  64. package/dist/schema/introspect-tables.d.ts +17 -0
  65. package/dist/schema/undeclarable-constraints.d.ts +16 -3
  66. package/dist/utils/result-rows.d.ts +20 -0
  67. package/dist/{websocket-DAVDn7Ki.js → websocket-CvmbzBeS.js} +3 -3
  68. package/dist/{websocket-DAVDn7Ki.js.map → websocket-CvmbzBeS.js.map} +1 -1
  69. package/package.json +7 -7
  70. package/dist/cli-schema-dir-CjDH_31U.js.map +0 -1
  71. package/dist/introspect-db-queries-BgiRQqtR.js.map +0 -1
  72. package/dist/introspect-tables-Cw_A-kk4.js.map +0 -1
  73. package/dist/open-rebase-x3yAPy5g.js.map +0 -1
@@ -1,12 +1,12 @@
1
1
  import { createRequire as __createRequire } from "module";
2
2
  __createRequire(import.meta.url);
3
3
  import { u as pinSearchPath } from "./connection-C1zXTPJq.js";
4
- import { q as withAppClient } from "./cli-schema-dir-CjDH_31U.js";
4
+ import { q as withAppClient } from "./cli-schema-dir-CdEqBcph.js";
5
5
  import { a as outWarn, r as out, t as chalk } from "./source-VxbrQojV.js";
6
6
  import { d as planTablePolicies } from "./generate-postgres-ddl-logic-CQof4iFH.js";
7
7
  import { r as loadTables } from "./load-tables-B1Re74ng.js";
8
- import { ensureTablePolicies, policyStampSql, probeRenderedPolicies, readPolicyStamps } from "./ensure-policies-nIITKxud.js";
9
- import { underSearchPath } from "./push-policy-plan-Dqu4FKWh.js";
8
+ import { ensureTablePolicies, policyStampSql, probeRenderedPolicies, readPolicyStamps } from "./ensure-policies-C1UCom37.js";
9
+ import { underSearchPath } from "./push-policy-plan-D8HvHgPs.js";
10
10
  //#region src/schema/migrate-policy-stamps.ts
11
11
  /**
12
12
  * The stamps `rebase db migrate` leaves on the policies it applied.
@@ -114,4 +114,4 @@ async function moveMigratedAdminPoliciesToPublic(client, compiledTables, log) {
114
114
  //#endregion
115
115
  export { moveMigratedAdminPoliciesToPublic, stampMigratedPolicies };
116
116
 
117
- //# sourceMappingURL=migrate-policy-stamps-C2WaOEsB.js.map
117
+ //# sourceMappingURL=migrate-policy-stamps-D7BaYeKO.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-policy-stamps-C2WaOEsB.js","names":[],"sources":["../src/schema/migrate-policy-stamps.ts"],"sourcesContent":["/**\n * The stamps `rebase db migrate` leaves on the policies it applied.\n *\n * A boot leaves a table's policies alone only when each carries the stamp a\n * boot or a push writes (`COMMENT ON POLICY … IS 'rebase:<hash>'`, see\n * `policyStampSql`). `db push` stamps what `policies.sql` just created. A\n * migration runs the same statements — `db generate` appends `policies.sql` to\n * it — and stamped nothing, so the first boot after every migrate dropped and\n * re-created every policy once, an ACCESS EXCLUSIVE lock per table: 44 on the\n * blog scaffold.\n *\n * Migrate cannot stamp what the files hold, the way push stamps what it just\n * ran: a migration was written from the tables of its day, and the\n * database may hold something a later one, or a hand, made since. A stamp\n * there would tell the boot a policy is what the rule makes when it is not, and\n * the boot would never put it right. So each declared policy without a current\n * stamp is asked of Postgres instead, as `db push --dry-run` asks it\n * (`probeRenderedPolicies`): made again from its rule under a probe name, in a\n * transaction that is rolled back, and compared. Only a policy whose stored\n * definition is exactly what its rule makes is stamped. Any other keeps no\n * stamp, and the boot re-applies its table, as before.\n */\nimport chalk from \"chalk\";\nimport type { CompiledTable } from \"@rebasepro/types\";\nimport type { Queryable } from \"../security/policy-drift\";\nimport { withAppClient } from \"../cli-helpers\";\nimport { out, outWarn } from \"../cli-output\";\nimport { pinSearchPath } from \"../connection\";\nimport { planTablePolicies } from \"./generate-postgres-ddl-logic\";\nimport { ensureTablePolicies, policyStampSql, probeRenderedPolicies, readPolicyStamps } from \"./ensure-policies\";\nimport { underSearchPath } from \"./push-policy-plan\";\nimport { loadTables } from \"./load-tables\";\n\n/**\n * `rebase db migrate`'s last step: stamp what the migration left as its rules\n * make it, on this process's connection. Never fatal — a policy left\n * unstamped costs the next boot a re-apply of its table, which is what every\n * boot after a migrate did before this.\n */\nexport async function stampMigratedPolicies(databaseUrl: string, schemaDir: string, adminRoleAvailable = true): Promise<void> {\n try {\n const compiledTables = await loadTables(schemaDir);\n // The rule the boot's connections follow: `search_path=public` unless\n // the URL pins one of its own, in which case this connection has it too.\n const searchPath = pinSearchPath(databaseUrl) === databaseUrl ? undefined : \"public\";\n const { stamped } = await withAppClient(databaseUrl, client => stampPoliciesStoredAsRendered(\n { query: async (text, values) => ({ rows: (await client.query(text, values)).rows }) },\n compiledTables,\n { searchPath, adminRoleAvailable }\n ));\n if (stamped > 0) {\n out(chalk.gray(` ✓ Stamped ${stamped} RLS ${stamped === 1 ? \"policy\" : \"policies\"} as their rules make them, so the next boot leaves ${stamped === 1 ? \"it\" : \"them\"} alone.`));\n }\n } catch (err) {\n outWarn(chalk.yellow(` ⚠️ The policies could not be stamped (${err instanceof Error ? err.message : String(err)}); the next boot applies them again.`));\n }\n}\n\n/**\n * Stamp every declared policy whose stored definition its rule would store\n * as it is, and none other.\n *\n * @param options.searchPath the `search_path` a boot reads policies under,\n * when the connection's own differs — the stamp hashes `pg_get_expr`,\n * whose spelling depends on it. See `PolicyStamping.searchPath`.\n * @returns how many policies were stamped.\n */\nexport async function stampPoliciesStoredAsRendered(\n client: Queryable,\n compiledTables: readonly CompiledTable[],\n options: { searchPath?: string; adminRoleAvailable?: boolean } = {}\n): Promise<{ stamped: number }> {\n const { adminRoleAvailable } = options;\n const plans = planTablePolicies(compiledTables, { adminRoleAvailable });\n if (plans.length === 0) return { stamped: 0 };\n\n const states = await underSearchPath(client, options.searchPath, () => readPolicyStamps(client, compiledTables, { adminRoleAvailable }));\n const unsure: { schema: string; table: string; name: string }[] = [];\n for (const plan of plans) {\n for (const [name, state] of states.get(plan.qualified) ?? []) {\n if (state !== \"current\") unsure.push({ schema: plan.schema, table: plan.table, name });\n }\n }\n if (unsure.length === 0) return { stamped: 0 };\n\n const confirmed = await probeRenderedPolicies(client, compiledTables, unsure, { searchPath: options.searchPath, adminRoleAvailable });\n const statements: string[] = [];\n let stamped = 0;\n for (const plan of plans) {\n const names = new Set(unsure\n .filter(p => p.schema === plan.schema && p.table === plan.table\n && confirmed.get(`${p.schema}.${p.table}.${p.name}`) === true)\n .map(p => p.name));\n const statement = names.size > 0 ? policyStampSql(plan, names) : undefined;\n if (!statement) continue;\n statements.push(statement);\n stamped += names.size;\n }\n if (statements.length === 0) return { stamped: 0 };\n\n await underSearchPath(client, options.searchPath, async () => {\n for (const statement of statements) await client.query(statement);\n });\n return { stamped };\n}\n\n/**\n * Where the admin switch is not live, move the server-or-admin policies a\n * migration just wrote `TO rebase_admin` back `TO public`, as `db push` and a\n * provisioning boot write them.\n *\n * A migration replays `policies.sql` as `db generate` wrote it, and that cannot\n * know the database it will run on. Left `TO rebase_admin` while admin requests\n * still run as the request role, those policies refuse every admin caller —\n * `dataAsAdmin` in crons, jobs and functions included — and a boot with\n * `REBASE_PROVISION=false` never puts them right.\n *\n * This is the boot's own ensure under the fallback plan, so a table whose\n * policies are already what that plan makes is left alone.\n *\n * @returns how many policies were written again.\n */\nexport async function moveMigratedAdminPoliciesToPublic(\n client: Queryable,\n compiledTables: readonly CompiledTable[],\n log?: (message: string) => void\n): Promise<number> {\n if (!planTablePolicies(compiledTables).some(plan => plan.policies.some(policy => policy.adminTarget))) return 0;\n const outcome = await ensureTablePolicies(client, compiledTables, log, { adminRoleAvailable: false });\n if (outcome.failures.length > 0) {\n throw new Error(outcome.failures.map(f => `${f.table}: ${f.error}`).join(\"; \"));\n }\n return outcome.policiesApplied;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,eAAsB,sBAAsB,aAAqB,WAAmB,qBAAqB,MAAqB;CAC1H,IAAI;EACA,MAAM,iBAAiB,MAAM,WAAW,SAAS;EAGjD,MAAM,aAAa,cAAc,WAAW,MAAM,cAAc,KAAA,IAAY;EAC5E,MAAM,EAAE,YAAY,MAAM,cAAc,cAAa,WAAU,8BAC3D,EAAE,OAAO,OAAO,MAAM,YAAY,EAAE,OAAO,MAAM,OAAO,MAAM,MAAM,MAAM,EAAA,CAAG,KAAK,GAAG,GACrF,gBACA;GAAE;GAAY;EAAmB,CACrC,CAAC;EACD,IAAI,UAAU,GACV,IAAI,MAAM,KAAK,eAAe,QAAQ,OAAO,YAAY,IAAI,WAAW,WAAW,qDAAqD,YAAY,IAAI,OAAO,OAAO,QAAQ,CAAC;CAEvL,SAAS,KAAK;EACV,QAAQ,MAAM,OAAO,4CAA4C,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,EAAE,qCAAqC,CAAC;CAC5J;AACJ;;;;;;;;;;AAWA,eAAsB,8BAClB,QACA,gBACA,UAAiE,CAAC,GACtC;CAC5B,MAAM,EAAE,uBAAuB;CAC/B,MAAM,QAAQ,kBAAkB,gBAAgB,EAAE,mBAAmB,CAAC;CACtE,IAAI,MAAM,WAAW,GAAG,OAAO,EAAE,SAAS,EAAE;CAE5C,MAAM,SAAS,MAAM,gBAAgB,QAAQ,QAAQ,kBAAkB,iBAAiB,QAAQ,gBAAgB,EAAE,mBAAmB,CAAC,CAAC;CACvI,MAAM,SAA4D,CAAC;CACnE,KAAK,MAAM,QAAQ,OACf,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,IAAI,KAAK,SAAS,KAAK,CAAC,GACvD,IAAI,UAAU,WAAW,OAAO,KAAK;EAAE,QAAQ,KAAK;EAAQ,OAAO,KAAK;EAAO;CAAK,CAAC;CAG7F,IAAI,OAAO,WAAW,GAAG,OAAO,EAAE,SAAS,EAAE;CAE7C,MAAM,YAAY,MAAM,sBAAsB,QAAQ,gBAAgB,QAAQ;EAAE,YAAY,QAAQ;EAAY;CAAmB,CAAC;CACpI,MAAM,aAAuB,CAAC;CAC9B,IAAI,UAAU;CACd,KAAK,MAAM,QAAQ,OAAO;EACtB,MAAM,QAAQ,IAAI,IAAI,OACjB,QAAO,MAAK,EAAE,WAAW,KAAK,UAAU,EAAE,UAAU,KAAK,SACnD,UAAU,IAAI,GAAG,EAAE,OAAO,GAAG,EAAE,MAAM,GAAG,EAAE,MAAM,MAAM,IAAI,CAAC,CACjE,KAAI,MAAK,EAAE,IAAI,CAAC;EACrB,MAAM,YAAY,MAAM,OAAO,IAAI,eAAe,MAAM,KAAK,IAAI,KAAA;EACjE,IAAI,CAAC,WAAW;EAChB,WAAW,KAAK,SAAS;EACzB,WAAW,MAAM;CACrB;CACA,IAAI,WAAW,WAAW,GAAG,OAAO,EAAE,SAAS,EAAE;CAEjD,MAAM,gBAAgB,QAAQ,QAAQ,YAAY,YAAY;EAC1D,KAAK,MAAM,aAAa,YAAY,MAAM,OAAO,MAAM,SAAS;CACpE,CAAC;CACD,OAAO,EAAE,QAAQ;AACrB;;;;;;;;;;;;;;;;;AAkBA,eAAsB,kCAClB,QACA,gBACA,KACe;CACf,IAAI,CAAC,kBAAkB,cAAc,CAAC,CAAC,MAAK,SAAQ,KAAK,SAAS,MAAK,WAAU,OAAO,WAAW,CAAC,GAAG,OAAO;CAC9G,MAAM,UAAU,MAAM,oBAAoB,QAAQ,gBAAgB,KAAK,EAAE,oBAAoB,MAAM,CAAC;CACpG,IAAI,QAAQ,SAAS,SAAS,GAC1B,MAAM,IAAI,MAAM,QAAQ,SAAS,KAAI,MAAK,GAAG,EAAE,MAAM,IAAI,EAAE,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC;CAElF,OAAO,QAAQ;AACnB"}
1
+ {"version":3,"file":"migrate-policy-stamps-D7BaYeKO.js","names":[],"sources":["../src/schema/migrate-policy-stamps.ts"],"sourcesContent":["/**\n * The stamps `rebase db migrate` leaves on the policies it applied.\n *\n * A boot leaves a table's policies alone only when each carries the stamp a\n * boot or a push writes (`COMMENT ON POLICY … IS 'rebase:<hash>'`, see\n * `policyStampSql`). `db push` stamps what `policies.sql` just created. A\n * migration runs the same statements — `db generate` appends `policies.sql` to\n * it — and stamped nothing, so the first boot after every migrate dropped and\n * re-created every policy once, an ACCESS EXCLUSIVE lock per table: 44 on the\n * blog scaffold.\n *\n * Migrate cannot stamp what the files hold, the way push stamps what it just\n * ran: a migration was written from the tables of its day, and the\n * database may hold something a later one, or a hand, made since. A stamp\n * there would tell the boot a policy is what the rule makes when it is not, and\n * the boot would never put it right. So each declared policy without a current\n * stamp is asked of Postgres instead, as `db push --dry-run` asks it\n * (`probeRenderedPolicies`): made again from its rule under a probe name, in a\n * transaction that is rolled back, and compared. Only a policy whose stored\n * definition is exactly what its rule makes is stamped. Any other keeps no\n * stamp, and the boot re-applies its table, as before.\n */\nimport chalk from \"chalk\";\nimport type { CompiledTable } from \"@rebasepro/types\";\nimport type { Queryable } from \"../security/policy-drift\";\nimport { withAppClient } from \"../cli-helpers\";\nimport { out, outWarn } from \"../cli-output\";\nimport { pinSearchPath } from \"../connection\";\nimport { planTablePolicies } from \"./generate-postgres-ddl-logic\";\nimport { ensureTablePolicies, policyStampSql, probeRenderedPolicies, readPolicyStamps } from \"./ensure-policies\";\nimport { underSearchPath } from \"./push-policy-plan\";\nimport { loadTables } from \"./load-tables\";\n\n/**\n * `rebase db migrate`'s last step: stamp what the migration left as its rules\n * make it, on this process's connection. Never fatal — a policy left\n * unstamped costs the next boot a re-apply of its table, which is what every\n * boot after a migrate did before this.\n */\nexport async function stampMigratedPolicies(databaseUrl: string, schemaDir: string, adminRoleAvailable = true): Promise<void> {\n try {\n const compiledTables = await loadTables(schemaDir);\n // The rule the boot's connections follow: `search_path=public` unless\n // the URL pins one of its own, in which case this connection has it too.\n const searchPath = pinSearchPath(databaseUrl) === databaseUrl ? undefined : \"public\";\n const { stamped } = await withAppClient(databaseUrl, client => stampPoliciesStoredAsRendered(\n { query: async (text, values) => ({ rows: (await client.query(text, values)).rows }) },\n compiledTables,\n { searchPath, adminRoleAvailable }\n ));\n if (stamped > 0) {\n out(chalk.gray(` ✓ Stamped ${stamped} RLS ${stamped === 1 ? \"policy\" : \"policies\"} as their rules make them, so the next boot leaves ${stamped === 1 ? \"it\" : \"them\"} alone.`));\n }\n } catch (err) {\n outWarn(chalk.yellow(` ⚠️ The policies could not be stamped (${err instanceof Error ? err.message : String(err)}); the next boot applies them again.`));\n }\n}\n\n/**\n * Stamp every declared policy whose stored definition its rule would store\n * as it is, and none other.\n *\n * @param options.searchPath the `search_path` a boot reads policies under,\n * when the connection's own differs — the stamp hashes `pg_get_expr`,\n * whose spelling depends on it. See `PolicyStamping.searchPath`.\n * @returns how many policies were stamped.\n */\nexport async function stampPoliciesStoredAsRendered(\n client: Queryable,\n compiledTables: readonly CompiledTable[],\n options: { searchPath?: string; adminRoleAvailable?: boolean } = {}\n): Promise<{ stamped: number }> {\n const { adminRoleAvailable } = options;\n const plans = planTablePolicies(compiledTables, { adminRoleAvailable });\n if (plans.length === 0) return { stamped: 0 };\n\n const states = await underSearchPath(client, options.searchPath, () => readPolicyStamps(client, compiledTables, { adminRoleAvailable }));\n const unsure: { schema: string; table: string; name: string }[] = [];\n for (const plan of plans) {\n for (const [name, state] of states.get(plan.qualified) ?? []) {\n if (state !== \"current\") unsure.push({ schema: plan.schema, table: plan.table, name });\n }\n }\n if (unsure.length === 0) return { stamped: 0 };\n\n const confirmed = await probeRenderedPolicies(client, compiledTables, unsure, { searchPath: options.searchPath, adminRoleAvailable });\n const statements: string[] = [];\n let stamped = 0;\n for (const plan of plans) {\n const names = new Set(unsure\n .filter(p => p.schema === plan.schema && p.table === plan.table\n && confirmed.get(`${p.schema}.${p.table}.${p.name}`) === true)\n .map(p => p.name));\n const statement = names.size > 0 ? policyStampSql(plan, names) : undefined;\n if (!statement) continue;\n statements.push(statement);\n stamped += names.size;\n }\n if (statements.length === 0) return { stamped: 0 };\n\n await underSearchPath(client, options.searchPath, async () => {\n for (const statement of statements) await client.query(statement);\n });\n return { stamped };\n}\n\n/**\n * Where the admin switch is not live, move the server-or-admin policies a\n * migration just wrote `TO rebase_admin` back `TO public`, as `db push` and a\n * provisioning boot write them.\n *\n * A migration replays `policies.sql` as `db generate` wrote it, and that cannot\n * know the database it will run on. Left `TO rebase_admin` while admin requests\n * still run as the request role, those policies refuse every admin caller —\n * `dataAsAdmin` in crons, jobs and functions included — and a boot with\n * `REBASE_PROVISION=false` never puts them right.\n *\n * This is the boot's own ensure under the fallback plan, so a table whose\n * policies are already what that plan makes is left alone.\n *\n * @returns how many policies were written again.\n */\nexport async function moveMigratedAdminPoliciesToPublic(\n client: Queryable,\n compiledTables: readonly CompiledTable[],\n log?: (message: string) => void\n): Promise<number> {\n if (!planTablePolicies(compiledTables).some(plan => plan.policies.some(policy => policy.adminTarget))) return 0;\n const outcome = await ensureTablePolicies(client, compiledTables, log, { adminRoleAvailable: false });\n if (outcome.failures.length > 0) {\n throw new Error(outcome.failures.map(f => `${f.table}: ${f.error}`).join(\"; \"));\n }\n return outcome.policiesApplied;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,eAAsB,sBAAsB,aAAqB,WAAmB,qBAAqB,MAAqB;CAC1H,IAAI;EACA,MAAM,iBAAiB,MAAM,WAAW,SAAS;EAGjD,MAAM,aAAa,cAAc,WAAW,MAAM,cAAc,KAAA,IAAY;EAC5E,MAAM,EAAE,YAAY,MAAM,cAAc,cAAa,WAAU,8BAC3D,EAAE,OAAO,OAAO,MAAM,YAAY,EAAE,OAAO,MAAM,OAAO,MAAM,MAAM,MAAM,EAAA,CAAG,KAAK,GAAG,GACrF,gBACA;GAAE;GAAY;EAAmB,CACrC,CAAC;EACD,IAAI,UAAU,GACV,IAAI,MAAM,KAAK,eAAe,QAAQ,OAAO,YAAY,IAAI,WAAW,WAAW,qDAAqD,YAAY,IAAI,OAAO,OAAO,QAAQ,CAAC;CAEvL,SAAS,KAAK;EACV,QAAQ,MAAM,OAAO,4CAA4C,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,EAAE,qCAAqC,CAAC;CAC5J;AACJ;;;;;;;;;;AAWA,eAAsB,8BAClB,QACA,gBACA,UAAiE,CAAC,GACtC;CAC5B,MAAM,EAAE,uBAAuB;CAC/B,MAAM,QAAQ,kBAAkB,gBAAgB,EAAE,mBAAmB,CAAC;CACtE,IAAI,MAAM,WAAW,GAAG,OAAO,EAAE,SAAS,EAAE;CAE5C,MAAM,SAAS,MAAM,gBAAgB,QAAQ,QAAQ,kBAAkB,iBAAiB,QAAQ,gBAAgB,EAAE,mBAAmB,CAAC,CAAC;CACvI,MAAM,SAA4D,CAAC;CACnE,KAAK,MAAM,QAAQ,OACf,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,IAAI,KAAK,SAAS,KAAK,CAAC,GACvD,IAAI,UAAU,WAAW,OAAO,KAAK;EAAE,QAAQ,KAAK;EAAQ,OAAO,KAAK;EAAO;CAAK,CAAC;CAG7F,IAAI,OAAO,WAAW,GAAG,OAAO,EAAE,SAAS,EAAE;CAE7C,MAAM,YAAY,MAAM,sBAAsB,QAAQ,gBAAgB,QAAQ;EAAE,YAAY,QAAQ;EAAY;CAAmB,CAAC;CACpI,MAAM,aAAuB,CAAC;CAC9B,IAAI,UAAU;CACd,KAAK,MAAM,QAAQ,OAAO;EACtB,MAAM,QAAQ,IAAI,IAAI,OACjB,QAAO,MAAK,EAAE,WAAW,KAAK,UAAU,EAAE,UAAU,KAAK,SACnD,UAAU,IAAI,GAAG,EAAE,OAAO,GAAG,EAAE,MAAM,GAAG,EAAE,MAAM,MAAM,IAAI,CAAC,CACjE,KAAI,MAAK,EAAE,IAAI,CAAC;EACrB,MAAM,YAAY,MAAM,OAAO,IAAI,eAAe,MAAM,KAAK,IAAI,KAAA;EACjE,IAAI,CAAC,WAAW;EAChB,WAAW,KAAK,SAAS;EACzB,WAAW,MAAM;CACrB;CACA,IAAI,WAAW,WAAW,GAAG,OAAO,EAAE,SAAS,EAAE;CAEjD,MAAM,gBAAgB,QAAQ,QAAQ,YAAY,YAAY;EAC1D,KAAK,MAAM,aAAa,YAAY,MAAM,OAAO,MAAM,SAAS;CACpE,CAAC;CACD,OAAO,EAAE,QAAQ;AACrB;;;;;;;;;;;;;;;;;AAkBA,eAAsB,kCAClB,QACA,gBACA,KACe;CACf,IAAI,CAAC,kBAAkB,cAAc,CAAC,CAAC,MAAK,SAAQ,KAAK,SAAS,MAAK,WAAU,OAAO,WAAW,CAAC,GAAG,OAAO;CAC9G,MAAM,UAAU,MAAM,oBAAoB,QAAQ,gBAAgB,KAAK,EAAE,oBAAoB,MAAM,CAAC;CACpG,IAAI,QAAQ,SAAS,SAAS,GAC1B,MAAM,IAAI,MAAM,QAAQ,SAAS,KAAI,MAAK,GAAG,EAAE,MAAM,IAAI,EAAE,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC;CAElF,OAAO,QAAQ;AACnB"}
@@ -3,24 +3,24 @@ __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, 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";
6
+ import { a as closedDatabaseName, c as diagnoseDbError, d as isEconnrefused, dt as extractCauseMessage, m as parseHostInfo, o as deepestErrorMessage, p as isUntrustedServerCertificate } from "./cli-schema-dir-CdEqBcph.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-DXyqf9yP.js";
8
+ import { t as BranchService } from "./BranchService-BLcVK_Rd.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-Ck-d8zdJ.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-NZKe3Jr-.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-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
- import { n as introspectTables, t as describeUnmappedTables } from "./introspect-tables-Cw_A-kk4.js";
16
+ import { d as typesAgree, s as diffPlanAgainstCatalogue } from "./deferred-index-build-Bz37bvxW.js";
17
+ import { a as isLockTimeout, c as resolveBootLockOptions, l as sleep, n as BOOT_LOCK_TIMEOUT_MS } from "./boot-ddl-C7hAFEvY.js";
18
+ import { a as readSchemaFactsFor, r as planTableSchemaEnsure } from "./ensure-tables-DjuNRClr.js";
19
+ import { n as introspectTables, t as describeUnmappedTables } from "./introspect-tables-2yJ3p98l.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-hQ5oAK_j.js";
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";
22
+ import { a as resolveAuthSchema, i as probeAuthSchema, r as assertAuthSchemaCompatible, t as ensureAuthTablesExist } from "./ensure-tables-BVUNi6uG.js";
23
+ import { a as buildBaasSchema, c as introspectSchema, i as warnOnGeneratedSchemaDrift, n as diffGeneratedSchemaAgainstCatalogue, o as readCatalogueSchema, s as compileIntrospectedTables } from "./generated-schema-diff-DDktAATD.js";
24
24
  import pg, { Client, DatabaseError, Pool } from "pg";
25
25
  import { NodePgDatabase, NodePgSession, NodePgTransaction, drizzle } from "drizzle-orm/node-postgres";
26
26
  import { ApiError, assertQueryFieldsReadable, createDdlBootstrapper, createEmailService, logger, rawQueryLoggingEnabled, resolveBatchRefs, rowETag, splitFieldOps } from "@rebasepro/server";
@@ -5800,6 +5800,58 @@ function rowsOfResult(result) {
5800
5800
  const rows = last.rows;
5801
5801
  return Array.isArray(rows) ? rows : [];
5802
5802
  }
5803
+ /** `timestamptz`'s type oid. */
5804
+ var TIMESTAMPTZ_OID = 1184;
5805
+ /**
5806
+ * An instant as `GET /api/data` returns one: RFC 3339, in UTC
5807
+ * (`2026-11-18T10:52:23.500Z`). Postgres's own text (`2026-11-18 10:52:23.5+00`)
5808
+ * is not something every browser's `Date` parses. A value that is not an
5809
+ * instant (`infinity`) is returned as it came.
5810
+ */
5811
+ function rfc3339Instant(value) {
5812
+ if (value instanceof Date) return Number.isNaN(value.getTime()) ? value : value.toISOString();
5813
+ if (typeof value !== "string") return value;
5814
+ const iso = value.trim().replace(" ", "T").replace(/([+-]\d\d)$/, "$1:00").replace(/([+-]\d\d)(\d\d)$/, "$1:$2");
5815
+ const date = new Date(iso);
5816
+ return Number.isNaN(date.getTime()) ? value : date.toISOString();
5817
+ }
5818
+ /** `bigint`'s type oid. */
5819
+ var INT8_OID = 20;
5820
+ /**
5821
+ * A `bigint` as `GET /api/data` returns one: a number when it fits a safe
5822
+ * integer, else the digits as they came, so no digit is lost.
5823
+ */
5824
+ function int8AsNumber(value) {
5825
+ if (typeof value !== "string" || !/^-?\d+$/.test(value)) return value;
5826
+ const n = Number(value);
5827
+ return Number.isSafeInteger(n) ? n : value;
5828
+ }
5829
+ /**
5830
+ * The rows of a caller-SQL result with values spelled as `/api/data` spells
5831
+ * them: every `timestamptz` column RFC 3339 (see {@link rfc3339Instant}),
5832
+ * every `bigint` a number when it fits (see {@link int8AsNumber}). Read from
5833
+ * the result's field types, so a column named anything, computed or aliased,
5834
+ * is covered.
5835
+ */
5836
+ function withInstantsAsRfc3339(result, rows) {
5837
+ const last = Array.isArray(result) ? result[result.length - 1] : result;
5838
+ const fields = typeof last === "object" && last !== null && "fields" in last ? last.fields : void 0;
5839
+ if (!Array.isArray(fields)) return rows;
5840
+ const convert = /* @__PURE__ */ new Map();
5841
+ for (const field of fields) {
5842
+ if (typeof field !== "object" || field === null || !("name" in field) || !("dataTypeID" in field)) continue;
5843
+ const oid = field.dataTypeID;
5844
+ const name = String(field.name);
5845
+ if (oid === TIMESTAMPTZ_OID) convert.set(name, rfc3339Instant);
5846
+ else if (oid === INT8_OID) convert.set(name, int8AsNumber);
5847
+ }
5848
+ if (convert.size === 0) return rows;
5849
+ return rows.map((row) => {
5850
+ const out = { ...row };
5851
+ for (const [name, fn] of convert) if (name in out) out[name] = fn(out[name]);
5852
+ return out;
5853
+ });
5854
+ }
5803
5855
  //#endregion
5804
5856
  //#region src/services/RelationWriteService.ts
5805
5857
  /**
@@ -13363,7 +13415,7 @@ var AuthenticatedPostgresBackendDriver = class {
13363
13415
  return this.withTransaction(async (delegate) => {
13364
13416
  if (options?.write) commitWithNextStatement();
13365
13417
  const result = await delegate.dataService.executeSqlResult(query, options?.params);
13366
- return withoutUnreadableColumns(rowsOfResult(result), fieldsOfResult(result), { roles: this.user?.roles ?? [] }, this.delegate.registry?.tables().map((table) => table.descriptor) ?? [], this.delegate.columnOrigins, (text, params) => delegate.dataService.executeSql(text, params));
13418
+ return withoutUnreadableColumns(withInstantsAsRfc3339(result, rowsOfResult(result)), fieldsOfResult(result), { roles: this.user?.roles ?? [] }, this.delegate.registry?.tables().map((table) => table.descriptor) ?? [], this.delegate.columnOrigins, (text, params) => delegate.dataService.executeSql(text, params));
13367
13419
  }, { accessMode: options?.write ? "read write" : "read only" });
13368
13420
  }
13369
13421
  /**
@@ -24413,7 +24465,7 @@ function createPostgresBootstrapper(pgConfig) {
24413
24465
  const openIndexBuildSession = (driverResult) => async () => {
24414
24466
  const db = requireProvisioningDb(driverResult);
24415
24467
  const pool = "$client" in db ? db.$client : void 0;
24416
- const { clientIndexBuildSession, isPgPool, poolIndexBuildSession } = await import("./deferred-index-build-88bWtYgx.js").then((n) => n.r);
24468
+ const { clientIndexBuildSession, isPgPool, poolIndexBuildSession } = await import("./deferred-index-build-Bz37bvxW.js").then((n) => n.r);
24417
24469
  const config = effectiveConfig();
24418
24470
  if (isPooledPool(pool) || config.pooled) {
24419
24471
  if (!config.directConnectionString) throw pooledWithoutDirectUrlError(DEFAULT_DATA_SOURCE_KEY);
@@ -24556,11 +24608,11 @@ function createPostgresBootstrapper(pgConfig) {
24556
24608
  unavailable: historyUnavailableReason(state, { requireTransaction: false })
24557
24609
  }) };
24558
24610
  }
24559
- const { BOOT_LOCK_TIMEOUT_MS } = await import("./boot-ddl-Bu6gAY-2.js").then((n) => n.i);
24611
+ const { BOOT_LOCK_TIMEOUT_MS } = await import("./boot-ddl-C7hAFEvY.js").then((n) => n.i);
24560
24612
  const historyTable = await ensureHistoryTableExists(db, { lockTimeoutMs: BOOT_LOCK_TIMEOUT_MS });
24561
24613
  const historyIndexes = await ensureHistoryIndexes(db, { lockTimeoutMs: BOOT_LOCK_TIMEOUT_MS });
24562
24614
  if (historyIndexes.length > 0) {
24563
- const { buildDeferredIndexes, scheduleDeferredIndexBuild } = await import("./deferred-index-build-88bWtYgx.js").then((n) => n.r);
24615
+ const { buildDeferredIndexes, scheduleDeferredIndexBuild } = await import("./deferred-index-build-Bz37bvxW.js").then((n) => n.r);
24564
24616
  const indexOptions = {
24565
24617
  log: (message) => logger.info(`[history] ${message}`),
24566
24618
  lockTimeoutMs: BOOT_LOCK_TIMEOUT_MS
@@ -24616,9 +24668,9 @@ function createPostgresBootstrapper(pgConfig) {
24616
24668
  * proved it can bootstrap with.
24617
24669
  */
24618
24670
  async ensureTableSchema(tables, driverResult, log) {
24619
- const { ensureTables } = await import("./ensure-tables-Lm-77eM5.js").then((n) => n.n);
24671
+ const { ensureTables } = await import("./ensure-tables-DjuNRClr.js").then((n) => n.n);
24620
24672
  const queryable = provisioningQueryable(driverResult);
24621
- const { BOOT_LOCK_TIMEOUT_MS } = await import("./boot-ddl-Bu6gAY-2.js").then((n) => n.i);
24673
+ const { BOOT_LOCK_TIMEOUT_MS } = await import("./boot-ddl-C7hAFEvY.js").then((n) => n.i);
24622
24674
  const provisionOnly = ["1", "true"].includes((process.env.REBASE_PROVISION_ONLY ?? "").trim().toLowerCase());
24623
24675
  const plan = await ensureTables(queryable, tables, log, {
24624
24676
  lockTimeoutMs: BOOT_LOCK_TIMEOUT_MS,
@@ -24630,7 +24682,7 @@ function createPostgresBootstrapper(pgConfig) {
24630
24682
  pendingIndexBuild?.cancel();
24631
24683
  pendingIndexBuild = void 0;
24632
24684
  if (!provisionOnly && plan.deferredIndexes.length > 0) {
24633
- const { scheduleDeferredIndexBuild } = await import("./deferred-index-build-88bWtYgx.js").then((n) => n.r);
24685
+ const { scheduleDeferredIndexBuild } = await import("./deferred-index-build-Bz37bvxW.js").then((n) => n.r);
24634
24686
  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.`);
24635
24687
  pendingIndexBuild = scheduleDeferredIndexBuild(openIndexBuildSession(driverResult), plan.deferredIndexes, {
24636
24688
  log: (message) => logger.info(`[schema] ${message}`),
@@ -24670,7 +24722,7 @@ function createPostgresBootstrapper(pgConfig) {
24670
24722
  await provisionRlsRuntime(driverResult);
24671
24723
  },
24672
24724
  async ensureTablePolicies(tables, driverResult, log) {
24673
- const { ensureTablePolicies, describeRulesDropped } = await import("./ensure-policies-nIITKxud.js");
24725
+ const { ensureTablePolicies, describeRulesDropped } = await import("./ensure-policies-C1UCom37.js");
24674
24726
  const queryable = provisioningQueryable(driverResult);
24675
24727
  const { rows } = await queryable.query("SELECT to_regprocedure('rebase.roles()') IS NOT NULL AS present");
24676
24728
  if (!rows[0]?.present) await provisionRlsRuntime(driverResult);
@@ -24806,7 +24858,7 @@ function createPostgresBootstrapper(pgConfig) {
24806
24858
  return driverResult.internals.driver.admin;
24807
24859
  },
24808
24860
  async initializeWebsockets(server, realtimeService, driver, config, adapter, limits) {
24809
- const { createPostgresWebSocket, isSocketRealtimeService, socketRealtimeMissing } = await import("./websocket-DAVDn7Ki.js").then((n) => n.c);
24861
+ const { createPostgresWebSocket, isSocketRealtimeService, socketRealtimeMissing } = await import("./websocket-CvmbzBeS.js").then((n) => n.c);
24810
24862
  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.`);
24811
24863
  const realtimeConfig = effectiveConfig().realtime;
24812
24864
  const maxSocketsPerUser = realtimeConfig?.maxSocketsPerUser !== void 0 ? parseMaxSocketsPerUser(realtimeConfig.maxSocketsPerUser, "realtime.maxSocketsPerUser") : void 0;
@@ -24967,4 +25019,4 @@ async function openRebase(options) {
24967
25019
  //#endregion
24968
25020
  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 };
24969
25021
 
24970
- //# sourceMappingURL=open-rebase-x3yAPy5g.js.map
25022
+ //# sourceMappingURL=open-rebase-DykxNl1j.js.map