@rebasepro/server-postgres 0.28.2 → 0.29.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 (100) hide show
  1. package/dist/{BranchService-BPssiD8_.js → BranchService-JiYJ_n9E.js} +3 -3
  2. package/dist/{BranchService-BPssiD8_.js.map → BranchService-JiYJ_n9E.js.map} +1 -1
  3. package/dist/PostgresBackendDriver.d.ts +147 -1
  4. package/dist/PostgresBootstrapper.d.ts +34 -1
  5. package/dist/{backup-cli-C1wcj-rc.js → backup-cli-D_aKXPyX.js} +3 -3
  6. package/dist/{backup-cli-C1wcj-rc.js.map → backup-cli-D_aKXPyX.js.map} +1 -1
  7. package/dist/{boot-ddl-CIGoIGcC.js → boot-ddl-D4W9o9xE.js} +2 -2
  8. package/dist/{boot-ddl-CIGoIGcC.js.map → boot-ddl-D4W9o9xE.js.map} +1 -1
  9. package/dist/{cli-console-C0FYkICX.js → cli-console-DPdZCWTi.js} +6 -6
  10. package/dist/{cli-console-C0FYkICX.js.map → cli-console-DPdZCWTi.js.map} +1 -1
  11. package/dist/{cli-errors-DYets7cp.js → cli-errors-D8s4z_3g.js} +26 -6
  12. package/dist/cli-errors-D8s4z_3g.js.map +1 -0
  13. package/dist/cli-helpers.d.ts +10 -0
  14. package/dist/cli.js +41 -35
  15. package/dist/cli.js.map +1 -1
  16. package/dist/{connection-czvI7TZL.js → connection-COuS5Fm-.js} +126 -36
  17. package/dist/connection-COuS5Fm-.js.map +1 -0
  18. package/dist/connection.d.ts +63 -0
  19. package/dist/database-health.d.ts +23 -0
  20. package/dist/{databasePoolManager-BjoVvuAq.js → databasePoolManager-7hXVurmG.js} +2 -2
  21. package/dist/{databasePoolManager-BjoVvuAq.js.map → databasePoolManager-7hXVurmG.js.map} +1 -1
  22. package/dist/{deferred-index-build-BcJ_oulu.js → deferred-index-build-F2GWu009.js} +34 -5
  23. package/dist/{deferred-index-build-BcJ_oulu.js.map → deferred-index-build-F2GWu009.js.map} +1 -1
  24. package/dist/{doctor-TJApVglQ.js → doctor-_g2tHRtG.js} +20 -6
  25. package/dist/doctor-_g2tHRtG.js.map +1 -0
  26. package/dist/{ensure-collection-policies-BNwSQfVx.js → ensure-collection-policies-DUpWJb5D.js} +8 -8
  27. package/dist/{ensure-collection-policies-BNwSQfVx.js.map → ensure-collection-policies-DUpWJb5D.js.map} +1 -1
  28. package/dist/{ensure-collection-tables-CSbgkTBx.js → ensure-collection-tables-BK--gDo6.js} +15 -9
  29. package/dist/ensure-collection-tables-BK--gDo6.js.map +1 -0
  30. package/dist/{ensure-tables-CF-8zgYA.js → ensure-tables-Bx1DYarz.js} +4 -4
  31. package/dist/{ensure-tables-CF-8zgYA.js.map → ensure-tables-Bx1DYarz.js.map} +1 -1
  32. package/dist/{enum-labels-kept-BCgFGAbJ.js → enum-labels-kept-DyFE4Gaq.js} +3 -3
  33. package/dist/{enum-labels-kept-BCgFGAbJ.js.map → enum-labels-kept-DyFE4Gaq.js.map} +1 -1
  34. package/dist/{generate-drizzle-schema-logic-CVRmZjP3.js → generate-drizzle-schema-logic-DpFA1UVd.js} +2 -2
  35. package/dist/{generate-drizzle-schema-logic-CVRmZjP3.js.map → generate-drizzle-schema-logic-DpFA1UVd.js.map} +1 -1
  36. package/dist/{generate-drizzle-schema-BAIp9nKT.js → generate-drizzle-schema-taNTu3xv.js} +2 -2
  37. package/dist/{generate-drizzle-schema-BAIp9nKT.js.map → generate-drizzle-schema-taNTu3xv.js.map} +1 -1
  38. package/dist/{generate-files-DutUrsSS.js → generate-files-DbwU8Btx.js} +11 -4
  39. package/dist/generate-files-DbwU8Btx.js.map +1 -0
  40. package/dist/{generate-postgres-ddl-logic-0rbAqwYT.js → generate-postgres-ddl-logic-ISVgsP34.js} +11 -4
  41. package/dist/{generate-postgres-ddl-logic-0rbAqwYT.js.map → generate-postgres-ddl-logic-ISVgsP34.js.map} +1 -1
  42. package/dist/{generated-schema-diff-ChFg6UxI.js → generated-schema-diff-4lOC0g1_.js} +21 -6
  43. package/dist/generated-schema-diff-4lOC0g1_.js.map +1 -0
  44. package/dist/index.d.ts +5 -2
  45. package/dist/index.es.js +13 -13
  46. package/dist/{migrate-baseline-DPawvckr.js → migrate-baseline-BeepEphh.js} +2 -2
  47. package/dist/{migrate-baseline-DPawvckr.js.map → migrate-baseline-BeepEphh.js.map} +1 -1
  48. package/dist/{migrate-policy-stamps-B-8vTSIm.js → migrate-policy-stamps-cYMJ_9Ha.js} +7 -7
  49. package/dist/{migrate-policy-stamps-B-8vTSIm.js.map → migrate-policy-stamps-cYMJ_9Ha.js.map} +1 -1
  50. package/dist/{open-rebase-D9n8idex.js → open-rebase-CTNBmmH8.js} +1712 -164
  51. package/dist/open-rebase-CTNBmmH8.js.map +1 -0
  52. package/dist/{pg-error-utils-BIHfsGZL.js → pg-error-utils-BLOVXK67.js} +2 -2
  53. package/dist/{pg-error-utils-BIHfsGZL.js.map → pg-error-utils-BLOVXK67.js.map} +1 -1
  54. package/dist/pipelined-transaction.d.ts +131 -0
  55. package/dist/{plan-schema-DMVh77yb.js → plan-schema-CMNWvqIa.js} +62 -3
  56. package/dist/plan-schema-CMNWvqIa.js.map +1 -0
  57. package/dist/{policy-drift-0Cp4Lc0x.js → policy-drift-IjD2AUD-.js} +2 -2
  58. package/dist/{policy-drift-0Cp4Lc0x.js.map → policy-drift-IjD2AUD-.js.map} +1 -1
  59. package/dist/pooled-database.d.ts +38 -0
  60. package/dist/{push-index-prebuild-DR3P4yOw.js → push-index-prebuild-CIvajIrL.js} +4 -4
  61. package/dist/{push-index-prebuild-DR3P4yOw.js.map → push-index-prebuild-CIvajIrL.js.map} +1 -1
  62. package/dist/{push-kept-defaults-BSqPzp0T.js → push-kept-defaults-CLbsuSmo.js} +2 -2
  63. package/dist/{push-kept-defaults-BSqPzp0T.js.map → push-kept-defaults-CLbsuSmo.js.map} +1 -1
  64. package/dist/{push-legacy-renames-BIxBmVLl.js → push-legacy-renames-DeW_HTLJ.js} +4 -4
  65. package/dist/{push-legacy-renames-BIxBmVLl.js.map → push-legacy-renames-DeW_HTLJ.js.map} +1 -1
  66. package/dist/{push-policy-plan-BHsasXa7.js → push-policy-plan--oRXOj4X.js} +4 -4
  67. package/dist/{push-policy-plan-BHsasXa7.js.map → push-policy-plan--oRXOj4X.js.map} +1 -1
  68. package/dist/read-routing.d.ts +139 -0
  69. package/dist/{render-ddl-NpPPDACz.js → render-ddl-CzVcbbR1.js} +77 -3
  70. package/dist/render-ddl-CzVcbbR1.js.map +1 -0
  71. package/dist/{rls-enforcement-BOHuHVlc.js → rls-enforcement-jZTv1yci.js} +48 -16
  72. package/dist/{rls-enforcement-BOHuHVlc.js.map → rls-enforcement-jZTv1yci.js.map} +1 -1
  73. package/dist/schema/deferred-index-build.d.ts +9 -0
  74. package/dist/schema/doctor-cli.js +4 -4
  75. package/dist/schema/generate-drizzle-schema.js +1 -1
  76. package/dist/schema/generate-files.d.ts +2 -1
  77. package/dist/schema/generate-postgres-ddl-logic.d.ts +6 -0
  78. package/dist/schema/generate-postgres-ddl.js +1 -1
  79. package/dist/schema/introspect-db.js +2 -2
  80. package/dist/schema/introspect-runtime.d.ts +10 -1
  81. package/dist/schema/plan/plan-schema.d.ts +9 -1
  82. package/dist/schema/plan/render-ddl.d.ts +25 -1
  83. package/dist/schema/plan/types.d.ts +24 -0
  84. package/dist/security/rls-enforcement.d.ts +11 -0
  85. package/dist/services/FetchService.d.ts +12 -12
  86. package/dist/services/PersistService.d.ts +59 -0
  87. package/dist/services/collection-helpers.d.ts +3 -1
  88. package/dist/services/view-access.d.ts +21 -0
  89. package/dist/{websocket-D4wrzF3b.js → websocket-D2y88dOa.js} +3 -3
  90. package/dist/{websocket-D4wrzF3b.js.map → websocket-D2y88dOa.js.map} +1 -1
  91. package/package.json +7 -7
  92. package/dist/cli-errors-DYets7cp.js.map +0 -1
  93. package/dist/connection-czvI7TZL.js.map +0 -1
  94. package/dist/doctor-TJApVglQ.js.map +0 -1
  95. package/dist/ensure-collection-tables-CSbgkTBx.js.map +0 -1
  96. package/dist/generate-files-DutUrsSS.js.map +0 -1
  97. package/dist/generated-schema-diff-ChFg6UxI.js.map +0 -1
  98. package/dist/open-rebase-D9n8idex.js.map +0 -1
  99. package/dist/plan-schema-DMVh77yb.js.map +0 -1
  100. package/dist/render-ddl-NpPPDACz.js.map +0 -1
@@ -0,0 +1,21 @@
1
+ /**
2
+ * What a collection that serves a SQL view (`PostgresCollectionConfig.view`)
3
+ * allows: reads, and for a materialized view only by the roles it names.
4
+ *
5
+ * A plain view runs as the caller (`security_invoker`), so the policies of the
6
+ * tables it reads already decide every row, and a read of one needs nothing
7
+ * here. A materialized view stores its rows and Postgres puts no row-level
8
+ * security on it: whoever may select from it sees all of it. So the role check
9
+ * is the driver's, made before every read of one by a caller (see
10
+ * `beforeQueryConditions`) — and not of the server's own work, which reads
11
+ * with no viewer at all.
12
+ */
13
+ import { type CollectionConfig } from "@rebasepro/types";
14
+ /** The roles a materialized view is served to when it names none. */
15
+ export declare const DEFAULT_VIEW_ROLES: readonly string[];
16
+ /** Whether a collection serves a view rather than a table. */
17
+ export declare function isViewCollection(collection: CollectionConfig | undefined): boolean;
18
+ /** Refuse a caller who holds none of a materialized view's roles. A no-op for anything else. */
19
+ export declare function assertViewReadable(collection: CollectionConfig | undefined): void;
20
+ /** Refuse a write to a collection that serves a view. */
21
+ export declare function assertCollectionWritable(collection: CollectionConfig | undefined, path: string): void;
@@ -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-D9n8idex.js";
5
- import { r as BranchingUnsupportedError } from "./BranchService-BPssiD8_.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-CTNBmmH8.js";
5
+ import { r as BranchingUnsupportedError } from "./BranchService-JiYJ_n9E.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-D4wrzF3b.js.map
1701
+ //# sourceMappingURL=websocket-D2y88dOa.js.map