@rebasepro/server-postgres 0.29.2 → 0.29.3

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 (90) hide show
  1. package/dist/{BranchService-X9R505mP.js → BranchService-CrXvcES2.js} +3 -3
  2. package/dist/{BranchService-X9R505mP.js.map → BranchService-CrXvcES2.js.map} +1 -1
  3. package/dist/PostgresBootstrapper.d.ts +7 -0
  4. package/dist/{backup-cli-CwiJEp_J.js → backup-cli-CTKCOLpX.js} +3 -3
  5. package/dist/{backup-cli-CwiJEp_J.js.map → backup-cli-CTKCOLpX.js.map} +1 -1
  6. package/dist/{boot-ddl-CbZj9ovZ.js → boot-ddl-CqGIwSYx.js} +2 -2
  7. package/dist/{boot-ddl-CbZj9ovZ.js.map → boot-ddl-CqGIwSYx.js.map} +1 -1
  8. package/dist/{cli-console-DDkNetCz.js → cli-console-DBPw-oAz.js} +5 -5
  9. package/dist/{cli-console-DDkNetCz.js.map → cli-console-DBPw-oAz.js.map} +1 -1
  10. package/dist/{cli-errors-C73Qy7WJ.js → cli-errors-DYTxnLbW.js} +5 -5
  11. package/dist/{cli-errors-C73Qy7WJ.js.map → cli-errors-DYTxnLbW.js.map} +1 -1
  12. package/dist/cli.js +62 -42
  13. package/dist/cli.js.map +1 -1
  14. package/dist/{database-preflight-DIauc8i5.js → database-preflight-iBpT7-vv.js} +2 -2
  15. package/dist/{database-preflight-DIauc8i5.js.map → database-preflight-iBpT7-vv.js.map} +1 -1
  16. package/dist/{deferred-index-build-DDdnjaOW.js → deferred-index-build-BCU9RoHK.js} +6 -6
  17. package/dist/{deferred-index-build-DDdnjaOW.js.map → deferred-index-build-BCU9RoHK.js.map} +1 -1
  18. package/dist/{doctor-DwMXljiq.js → doctor-Kg1oUK0Q.js} +6 -6
  19. package/dist/{doctor-DwMXljiq.js.map → doctor-Kg1oUK0Q.js.map} +1 -1
  20. package/dist/{ensure-collection-policies-DJsOMpaI.js → ensure-collection-policies-Bo-_fDAy.js} +12 -12
  21. package/dist/ensure-collection-policies-Bo-_fDAy.js.map +1 -0
  22. package/dist/{ensure-collection-tables-h1mUO7Uu.js → ensure-collection-tables-DCJINkT_.js} +9 -9
  23. package/dist/{ensure-collection-tables-h1mUO7Uu.js.map → ensure-collection-tables-DCJINkT_.js.map} +1 -1
  24. package/dist/{ensure-tables-CUqYgMvo.js → ensure-tables-BPGaGh0y.js} +4 -4
  25. package/dist/{ensure-tables-CUqYgMvo.js.map → ensure-tables-BPGaGh0y.js.map} +1 -1
  26. package/dist/{enum-labels-kept-z7ustOl_.js → enum-labels-kept-YAgOZS4I.js} +3 -3
  27. package/dist/{enum-labels-kept-z7ustOl_.js.map → enum-labels-kept-YAgOZS4I.js.map} +1 -1
  28. package/dist/{generate-drizzle-schema-BIUqhSzh.js → generate-drizzle-schema-DcrFr7YX.js} +2 -2
  29. package/dist/{generate-drizzle-schema-BIUqhSzh.js.map → generate-drizzle-schema-DcrFr7YX.js.map} +1 -1
  30. package/dist/{generate-drizzle-schema-logic-BBXjxm5z.js → generate-drizzle-schema-logic-LTLZvt6r.js} +2 -2
  31. package/dist/{generate-drizzle-schema-logic-BBXjxm5z.js.map → generate-drizzle-schema-logic-LTLZvt6r.js.map} +1 -1
  32. package/dist/{generate-files-BkiRFoV1.js → generate-files-CsaVzatS.js} +3 -3
  33. package/dist/{generate-files-BkiRFoV1.js.map → generate-files-CsaVzatS.js.map} +1 -1
  34. package/dist/{generate-postgres-ddl-logic-G9PvjHrr.js → generate-postgres-ddl-logic-Dg0bcENZ.js} +39 -6
  35. package/dist/generate-postgres-ddl-logic-Dg0bcENZ.js.map +1 -0
  36. package/dist/{generated-schema-diff-D2soazQU.js → generated-schema-diff-By4dxyTH.js} +2 -2
  37. package/dist/{generated-schema-diff-D2soazQU.js.map → generated-schema-diff-By4dxyTH.js.map} +1 -1
  38. package/dist/index.es.js +12 -12
  39. package/dist/{migrate-baseline-CveNQli3.js → migrate-baseline-CmWXL7qx.js} +2 -2
  40. package/dist/{migrate-baseline-CveNQli3.js.map → migrate-baseline-CmWXL7qx.js.map} +1 -1
  41. package/dist/{migrate-policy-stamps-C4qbQ0jK.js → migrate-policy-stamps-BN_Qad6c.js} +6 -6
  42. package/dist/{migrate-policy-stamps-C4qbQ0jK.js.map → migrate-policy-stamps-BN_Qad6c.js.map} +1 -1
  43. package/dist/{open-rebase-Cvid3iwR.js → open-rebase-40paQfVW.js} +31 -24
  44. package/dist/{open-rebase-Cvid3iwR.js.map → open-rebase-40paQfVW.js.map} +1 -1
  45. package/dist/{pg-error-utils-80uTIHQs.js → pg-error-utils-DJHjCF7-.js} +2 -2
  46. package/dist/{pg-error-utils-80uTIHQs.js.map → pg-error-utils-DJHjCF7-.js.map} +1 -1
  47. package/dist/{plan-schema-CMhNYEYF.js → plan-schema-vJd3UEmT.js} +24 -9
  48. package/dist/plan-schema-vJd3UEmT.js.map +1 -0
  49. package/dist/{policy-drift-Bx6663KD.js → policy-drift-C-m0uWHH.js} +53 -8
  50. package/dist/policy-drift-C-m0uWHH.js.map +1 -0
  51. package/dist/{push-index-adoption-C-TpM445.js → push-index-adoption-Cp7oZxSl.js} +3 -3
  52. package/dist/{push-index-adoption-C-TpM445.js.map → push-index-adoption-Cp7oZxSl.js.map} +1 -1
  53. package/dist/{push-index-prebuild-xbpgZEJK.js → push-index-prebuild-DbwKGtQT.js} +4 -4
  54. package/dist/{push-index-prebuild-xbpgZEJK.js.map → push-index-prebuild-DbwKGtQT.js.map} +1 -1
  55. package/dist/{push-kept-defaults-D-JEv0Gn.js → push-kept-defaults-CLcgsEPt.js} +2 -2
  56. package/dist/{push-kept-defaults-D-JEv0Gn.js.map → push-kept-defaults-CLcgsEPt.js.map} +1 -1
  57. package/dist/{push-legacy-renames-7UKspspl.js → push-legacy-renames-BthD0E9W.js} +4 -4
  58. package/dist/{push-legacy-renames-7UKspspl.js.map → push-legacy-renames-BthD0E9W.js.map} +1 -1
  59. package/dist/{push-policy-plan-BOw5PtU8.js → push-policy-plan-BgcrroxQ.js} +3 -3
  60. package/dist/{push-policy-plan-BOw5PtU8.js.map → push-policy-plan-BgcrroxQ.js.map} +1 -1
  61. package/dist/{render-ddl-Di-fTGti.js → render-ddl-Ci3S_SoI.js} +23 -5
  62. package/dist/render-ddl-Ci3S_SoI.js.map +1 -0
  63. package/dist/{request-role-cli-Bxxskru9.js → request-role-cli-Dy1EgJU9.js} +8 -8
  64. package/dist/{request-role-cli-Bxxskru9.js.map → request-role-cli-Dy1EgJU9.js.map} +1 -1
  65. package/dist/{request-role-migration-BCW4v0rq.js → request-role-migration-GHTJnPMV.js} +2 -2
  66. package/dist/{request-role-migration-BCW4v0rq.js.map → request-role-migration-GHTJnPMV.js.map} +1 -1
  67. package/dist/{rls-bootstrap-sql-CxszeSc7.js → rls-bootstrap-sql-kPX4-MB1.js} +18 -3
  68. package/dist/rls-bootstrap-sql-kPX4-MB1.js.map +1 -0
  69. package/dist/{rls-enforcement-CyUCPDH8.js → rls-enforcement-Cc_UhOxb.js} +109 -6
  70. package/dist/rls-enforcement-Cc_UhOxb.js.map +1 -0
  71. package/dist/schema/doctor-cli.js +7 -7
  72. package/dist/schema/ensure-collection-policies.d.ts +8 -0
  73. package/dist/schema/generate-drizzle-schema.js +1 -1
  74. package/dist/schema/generate-postgres-ddl-logic.d.ts +9 -0
  75. package/dist/schema/generate-postgres-ddl.js +1 -1
  76. package/dist/schema/introspect-db.js +1 -1
  77. package/dist/schema/plan/types.d.ts +13 -0
  78. package/dist/schema/rls-bootstrap-sql.d.ts +6 -0
  79. package/dist/security/policy-drift.d.ts +13 -1
  80. package/dist/security/rls-enforcement.d.ts +31 -0
  81. package/dist/{websocket-BSYV_KSw.js → websocket-B7ex6AQM.js} +3 -3
  82. package/dist/{websocket-BSYV_KSw.js.map → websocket-B7ex6AQM.js.map} +1 -1
  83. package/package.json +7 -7
  84. package/dist/ensure-collection-policies-DJsOMpaI.js.map +0 -1
  85. package/dist/generate-postgres-ddl-logic-G9PvjHrr.js.map +0 -1
  86. package/dist/plan-schema-CMhNYEYF.js.map +0 -1
  87. package/dist/policy-drift-Bx6663KD.js.map +0 -1
  88. package/dist/render-ddl-Di-fTGti.js.map +0 -1
  89. package/dist/rls-bootstrap-sql-CxszeSc7.js.map +0 -1
  90. package/dist/rls-enforcement-CyUCPDH8.js.map +0 -1
@@ -454,7 +454,38 @@ export declare function settleAdminSwitch(run: RawSqlRunner, schemas: string[],
454
454
  }): Promise<{
455
455
  request: RequestIdentity;
456
456
  adminPoliciesLive: boolean;
457
+ adminRequestPoliciesLive: boolean;
457
458
  }>;
459
+ /**
460
+ * Make {@link REBASE_ADMIN_REQUEST_ROLE} the admin request roles' alone, and
461
+ * say whether it is — which decides whether the admin-only policies get their
462
+ * `USING (true)` companions, and with them an admin request's index plans.
463
+ *
464
+ * The companions admit every member of that role to every row the admin
465
+ * policies grant, so membership is the whole boundary, and it is checked, not
466
+ * assumed. From PostgreSQL 16 each admin request role is granted it `WITH
467
+ * INHERIT TRUE, SET FALSE`; the connection holds those roles `WITH INHERIT
468
+ * FALSE` and so not this one. Before 16 inheritance is a property of the role,
469
+ * the connection would inherit it through them, and nothing is granted. Then
470
+ * the catalogue is asked who holds its privileges: anyone but the admin
471
+ * request roles — the connection by `createrole_self_grant`, a request role, a
472
+ * grant by hand — and the answer is `false`, the companions are not planned,
473
+ * and the policies step drops any it finds. A role that bypasses RLS anyway
474
+ * (a superuser, BYPASSRLS) gains nothing from them and does not count.
475
+ *
476
+ * A boot that provisions nothing creates and grants nothing, and only reads.
477
+ */
478
+ export declare function settleAdminRequestGroup(run: RawSqlRunner, adminRoles: readonly string[], options: {
479
+ provision: boolean;
480
+ }): Promise<boolean>;
481
+ /**
482
+ * Whether a companion found in the database may stay: the admin switch would
483
+ * be live for this database's request roles, and nothing but their admin
484
+ * roles holds {@link REBASE_ADMIN_REQUEST_ROLE}. `db push` and `rebase doctor`
485
+ * ask this before taking a live companion for Rebase's own — otherwise it is
486
+ * an orphan, and push drops it. Anything it cannot read answers `false`.
487
+ */
488
+ export declare function adminRequestCompanionsSafeForCli(run: RawSqlRunner): Promise<boolean>;
458
489
  /**
459
490
  * Where `db push` and `rebase doctor` expect the server-or-admin policies, for
460
491
  * the request roles this database records (or the configured ones): `TO
@@ -1,8 +1,8 @@
1
1
  import { createRequire as __createRequire } from "module";
2
2
  __createRequire(import.meta.url);
3
3
  import { i as __exportAll } from "./cli-prompt-DXG0yk-h.js";
4
- import { A as budgetSendBuffers, M as terminateIfBacklogged, N as assertReadRequestReadable, ct as SqlResultTooLargeError, it as effectiveSqlRole, j as reapSilentSockets, lt as isNestedPath, ot as sqlRoleRanAs, st as SQL_RESULT_BYTE_BUDGET, ut as resolveNestedPath } from "./open-rebase-Cvid3iwR.js";
5
- import { r as BranchingUnsupportedError } from "./BranchService-X9R505mP.js";
4
+ import { A as budgetSendBuffers, M as terminateIfBacklogged, N as assertReadRequestReadable, ct as SqlResultTooLargeError, it as effectiveSqlRole, j as reapSilentSockets, lt as isNestedPath, ot as sqlRoleRanAs, st as SQL_RESULT_BYTE_BUDGET, ut as resolveNestedPath } from "./open-rebase-40paQfVW.js";
5
+ import { r as BranchingUnsupportedError } from "./BranchService-CrXvcES2.js";
6
6
  import { ApiError, DATABASE_UNAVAILABLE_MESSAGE, RUNTIME_DEFAULT_MAX_BODY_SIZE, assertFieldOpsValid, assertNestedWriteAllowed, assertNoFieldOpsOnCreate, assertNoUserUpsert, assertUserCreationBodyValid, assertWriteRequestValid, createUserThroughAuthCollection, decideImpersonation, declaredErrorAnswer, extractUserFromToken, getAccessModel, isDatabaseUnreachable, logger, resolveConflictTarget, resolveRequireAuth, safeCompare } from "@rebasepro/server";
7
7
  import { ANONYMOUS_USER_ID, ListLimitError, hasAdminRole, isSQLAdmin, isSchemaAdmin, resolveClientListLimit, scopeGrants, scopesForRoles } from "@rebasepro/types";
8
8
  import { UnknownFilterOperatorError, deserializeFilter, redactSqlLiterals } from "@rebasepro/common";
@@ -1698,4 +1698,4 @@ function createPostgresWebSocket(server, realtimeService, driver, authConfig, au
1698
1698
  //#endregion
1699
1699
  export { createPostgresWebSocket as a, websocket_exports as c, TOO_MANY_SOCKETS_CLOSE_CODE as i, PUBLIC_TYPES as n, isSocketRealtimeService as o, SESSION_ENDED_CLOSE_CODE as r, socketRealtimeMissing as s, ADMIN_PLANE_TYPES as t };
1700
1700
 
1701
- //# sourceMappingURL=websocket-BSYV_KSw.js.map
1701
+ //# sourceMappingURL=websocket-B7ex6AQM.js.map