permdock 0.27.3 → 0.28.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 (185) hide show
  1. package/dist/{2020-bJfT8aIA.js → 2020-DBXhfpuK.js} +2 -2
  2. package/dist/{adoption-scan-CHMU7gnE.js → adoption-scan-BHQm3Li7.js} +1 -1
  3. package/dist/approvals/index.d.ts +1 -1
  4. package/dist/{arazzo-D1ZHjjea.js → arazzo-CAQr4N7Z.js} +2 -2
  5. package/dist/{arazzo-DuXmPMSu.js → arazzo-UwtVzma6.js} +1 -1
  6. package/dist/{args-0EWFk-4S.js → args-Bc0HLiD4.js} +1 -1
  7. package/dist/better-supabase/index.d.ts +2 -0
  8. package/dist/better-supabase/index.js +8 -6
  9. package/dist/{casbin-CwLL5QnK.js → casbin-CSgPeAJK.js} +1 -1
  10. package/dist/{casbin-Bf9jkDMy.js → casbin-Ccbaft52.js} +1 -1
  11. package/dist/catalog/index.d.ts +1 -1
  12. package/dist/{catalog-B3MJShnZ.js → catalog-COoxFOoy.js} +1 -1
  13. package/dist/catalog-DCjJIl3n.js +1 -0
  14. package/dist/{catalog-DyC3LKc7.js → catalog-DXSP1we9.js} +1 -1
  15. package/dist/cli/bin.js +1 -1
  16. package/dist/cli/generate/watch-worker.js +1 -1
  17. package/dist/cli/index.d.ts +5 -4
  18. package/dist/cli/index.js +1 -1
  19. package/dist/cli/plugins/app.d.ts +1 -1
  20. package/dist/cli/plugins/app.js +1 -1
  21. package/dist/cli/plugins/better-supabase.d.ts +1 -1
  22. package/dist/cli/plugins/openapi.d.ts +1 -1
  23. package/dist/cli/plugins/openapi.js +1 -1
  24. package/dist/cli/plugins/powersync.d.ts +1 -1
  25. package/dist/cli/plugins/powersync.js +1 -1
  26. package/dist/cli/plugins/rls.d.ts +2 -2
  27. package/dist/cli/plugins/rls.js +1 -1
  28. package/dist/cli/plugins/schemas.d.ts +1 -1
  29. package/dist/cli/plugins/schemas.js +1 -1
  30. package/dist/cli/plugins/scim.d.ts +2 -2
  31. package/dist/cli/plugins/supabase-hook.d.ts +2 -2
  32. package/dist/cli/plugins/supabase-hook.js +1 -1
  33. package/dist/cli/plugins/supabase.d.ts +3 -3
  34. package/dist/cli/plugins/supabase.js +2 -2
  35. package/dist/cli/plugins/ui.d.ts +1 -1
  36. package/dist/cli/plugins/ui.js +1 -1
  37. package/dist/{cloud-nXogJ7e1.js → cloud-CFtvELWj.js} +2 -2
  38. package/dist/{codemod-DwL1E5of.js → codemod-3PFIcPag.js} +2 -2
  39. package/dist/{codemod-Bp2bKwKe.js → codemod-ClcPRv4c.js} +2 -2
  40. package/dist/{collect-BJZsuBW4.js → collect-BOh9Pxob.js} +1 -1
  41. package/dist/{collect-CpGnmGpL.js → collect-BYPq-0JU.js} +2 -2
  42. package/dist/collect-XcoQRyiA.js +1 -0
  43. package/dist/{compile-NM1GOb2q.js → compile-mfTqcMJ5.js} +1 -1
  44. package/dist/{completion-BQovwoTx.js → completion-D4p_MQX7.js} +2 -2
  45. package/dist/{config-DSyn7r1l.js → config-D9bq79Yi.js} +1 -1
  46. package/dist/{config-report--ae2r_MI.js → config-report-DZfIl6zc.js} +2 -2
  47. package/dist/{context-DmH-Eyvx.js → context-BdoA9DhS.js} +2 -2
  48. package/dist/{core-DKqrD_xW.js → core-tEfD0lwu.js} +1 -1
  49. package/dist/delivery/index.d.ts +1 -1
  50. package/dist/{diff-BIqibFnm.js → diff-CXRZ6qPa.js} +1 -1
  51. package/dist/{diff-n6LONVwL.js → diff-Cv9inVY5.js} +1 -1
  52. package/dist/{doctor-CIV882xS.js → doctor-CuhkBJ06.js} +3 -3
  53. package/dist/{doctor-kbRrZD3Q.js → doctor-FHjwjHYC.js} +18 -18
  54. package/dist/{execute-CE8P72Ez.js → execute-DdH84BHC.js} +3 -3
  55. package/dist/gen-BseS8XeZ.js +1 -0
  56. package/dist/{gen-CuEt0o6p.js → gen-CcKymoUw.js} +3 -3
  57. package/dist/{gen-kind-BLIhHgD3.js → gen-kind-Bf9jYVgn.js} +1 -1
  58. package/dist/{generate-Dl75LKbW.js → generate-BCUVV4vB.js} +11 -11
  59. package/dist/{generate-B-Hlc08D.js → generate-UMuStlLD.js} +2 -2
  60. package/dist/{generate-options-BUh621MW.js → generate-options-Cg5sAHhT.js} +6 -6
  61. package/dist/{hook-sql-Bxc_YRrd.js → hook-sql-C0aUoiOH.js} +6 -5
  62. package/dist/{import-BKTq4cxW.js → import--taRAR01.js} +1 -1
  63. package/dist/{index-Cq9N5B92.d.ts → index-BSJoxaOi.d.ts} +1 -1
  64. package/dist/{index-BXz-XXC3.d.ts → index-D1msamx_.d.ts} +1 -1
  65. package/dist/{index-CVuc3E1O.d.ts → index-eaNHkELi.d.ts} +1 -1
  66. package/dist/index.d.ts +2 -2
  67. package/dist/index.js +1 -1
  68. package/dist/{init-B8GG9vjg.js → init-CP3fYFb6.js} +3 -3
  69. package/dist/{init-D4YO8hVa.js → init-Cfi7_gXO.js} +1 -1
  70. package/dist/{json-schema-SDkWXxhu.d.ts → json-schema-DAeA-lJa.d.ts} +1 -1
  71. package/dist/{lazy-provider-CydlnKkS.d.ts → lazy-provider-C48LDq0q.d.ts} +1 -1
  72. package/dist/{lazy-provider-DG5rMeqL.js → lazy-provider-CVX534Kk.js} +1 -1
  73. package/dist/{login-OJdYkueH.js → login-BjkyJNGn.js} +3 -3
  74. package/dist/{login-Bl-SuTJA.js → login-kg9Pd0C2.js} +1 -1
  75. package/dist/{manifest-BY8lK4l4.js → manifest-C7dWk0k5.js} +35 -35
  76. package/dist/{migrate-CmTMk7rd.js → migrate-BwXtXUtE.js} +1 -1
  77. package/dist/next/index.d.ts +2 -2
  78. package/dist/next/plugin.d.ts +1 -1
  79. package/dist/next/plugin.js +1 -1
  80. package/dist/{openapi-CvAjVdK7.js → openapi-B5jo5ClY.js} +3 -3
  81. package/dist/{openapi-Dpetebzt.js → openapi-dJFJTHiW.js} +1 -1
  82. package/dist/{openapi-document-7K7rofeR.js → openapi-document-B58hIsZ4.js} +1 -1
  83. package/dist/{output-Cq0neio3.js → output-Pne7BTXn.js} +1 -1
  84. package/dist/{output-files-DNid6TBl.js → output-files-D5D-8-4l.js} +1 -1
  85. package/dist/output-files-aPXXhV4q.js +1 -0
  86. package/dist/{ownership-CHND0y5L.js → ownership-BPGoxz1T.js} +1 -1
  87. package/dist/{permissions-ijDw4sO1.js → permissions-Bj3DRIEi.js} +1 -1
  88. package/dist/{plugin-1XW5OfAZ.d.ts → plugin-zOs9uqQj.d.ts} +1 -1
  89. package/dist/{policy-DzTU5233.js → policy-G8iZ2T5P.js} +1 -1
  90. package/dist/{policy-bundle-Dafv5nOx.js → policy-bundle-nbcxlVOb.js} +3 -3
  91. package/dist/{powersync-IrDmJbqx.js → powersync-B9KEEiJE.js} +1 -1
  92. package/dist/{powersync-BfMIjRqo.js → powersync-BoOMFQRl.js} +1 -1
  93. package/dist/{powersync-DNeS5JrT.js → powersync-CqAj9QJt.js} +6 -6
  94. package/dist/{prompt-CSXHcJxy.js → prompt-CPlJn_4-.js} +3 -3
  95. package/dist/{protected-action-D6T3eJyW.d.ts → protected-action-CEzNNtfi.d.ts} +2 -2
  96. package/dist/{protected-action-BMb0ftEu.js → protected-action-Dco5O_Kc.js} +1 -1
  97. package/dist/{provider-ClD4rfgT.js → provider-BYcoTKuS.js} +1 -1
  98. package/dist/{provider-CydlnKkS.d.ts → provider-C48LDq0q.d.ts} +1 -1
  99. package/dist/{provider-store-atQUfsVO.js → provider-store-Dq_olUjC.js} +1 -1
  100. package/dist/{provider-with-CSw4mBDU.js → provider-with-fxHItxDh.js} +1 -1
  101. package/dist/pull-8Vce3V1e.js +1 -0
  102. package/dist/{pull-DOwvDn98.js → pull-DXuh-rob.js} +1 -1
  103. package/dist/{push-Cb7PqXdO.js → push-DXh936bz.js} +1 -1
  104. package/dist/{pushed-policy-pH-EFWyx.d.ts → pushed-policy-APjMbYdV.d.ts} +1 -1
  105. package/dist/{rbac-CygtQB85.js → rbac-FlJv7Ba9.js} +1 -1
  106. package/dist/react/index.d.ts +4 -4
  107. package/dist/react/index.js +3 -3
  108. package/dist/react/lazy.d.ts +4 -4
  109. package/dist/react/lazy.js +3 -3
  110. package/dist/react/provider-client-lazy.d.ts +1 -1
  111. package/dist/react/provider-client-lazy.js +1 -1
  112. package/dist/react/provider-client.d.ts +1 -1
  113. package/dist/react/provider-client.js +1 -1
  114. package/dist/react-native/index.d.ts +4 -4
  115. package/dist/react-native/index.js +2 -2
  116. package/dist/{resolve-names-D0hNHBp5.js → resolve-names-CROyyjVR.js} +1 -1
  117. package/dist/{resolver-kdZ4HrpC.js → resolver-4qxIIHcC.js} +1 -1
  118. package/dist/{rls-BjEp-1Ob.js → rls-BL90Ec30.js} +7 -7
  119. package/dist/{rls-BDmebOIp.js → rls-DV4MUNMb.js} +1 -1
  120. package/dist/{rls-files-kGXtfslQ.js → rls-files-BgLoAa9x.js} +2 -2
  121. package/dist/{rls-options-CEpg5nDP.d.ts → rls-options-BZxfMDFo.d.ts} +1 -1
  122. package/dist/{run-DFe2I0T7.js → run-BFDAiNuS.js} +3 -3
  123. package/dist/run-mEbYi2Ow.js +1 -0
  124. package/dist/{saas-DzjKUQr5.js → saas-CUwmgUB8.js} +2 -2
  125. package/dist/{scan-DGCpdOuR.js → scan-CoyAmDAz.js} +1 -1
  126. package/dist/{schema-wummOGn9.js → schema-9eGIiLry.js} +2 -2
  127. package/dist/{size-DF7xQ-nH.js → size-BqLd5oJ4.js} +1 -1
  128. package/dist/{skills-BQ9bEjPV.js → skills-B8nt-KuB.js} +2 -2
  129. package/dist/{skills-BntnICiJ.js → skills-BPDVfXgR.js} +2 -2
  130. package/dist/{snapshot-size-DU7CvpMt.js → snapshot-size-B_chu2c1.js} +1 -1
  131. package/dist/{snapshot-size-D-pCR8x0.js → snapshot-size-CHig-Nq_.js} +1 -1
  132. package/dist/solid/index.d.ts +24 -24
  133. package/dist/solid/index.js +2 -2
  134. package/dist/{src-D6_T4zd7.js → src-BAYcigFU.js} +1 -1
  135. package/dist/{store-core-eqG8jijs.d.ts → store-core-DyNo_BwA.d.ts} +4 -2
  136. package/dist/{store-options-C8x39AHa.js → store-options-BtHrfJUU.js} +1 -1
  137. package/dist/{stores-DoA7ACkz.js → stores-BIMyclLg.js} +1 -1
  138. package/dist/{stores-4DOaL4ZP.d.ts → stores-DyFCruRC.d.ts} +2 -2
  139. package/dist/supabase/index.d.ts +6 -0
  140. package/dist/supabase/index.js +2 -2
  141. package/dist/{supabase-BI5ZhzLl.js → supabase-Ctn_Z6xf.js} +1 -1
  142. package/dist/{supabase-CjUsihRL.js → supabase-D5KN965n.js} +1 -1
  143. package/dist/{supabase-config-CbK7xX77.js → supabase-config-CjX-GjEp.js} +1 -1
  144. package/dist/supabase-hook-CjChM-eX.js +2 -0
  145. package/dist/{supabase-hook-nGLUvn5x.js → supabase-hook-CmW2MLWa.js} +4 -4
  146. package/dist/svelte/index.d.ts +3 -3
  147. package/dist/svelte/index.js +3 -3
  148. package/dist/svelte/runtime.d.ts +2 -2
  149. package/dist/svelte/runtime.js +1 -1
  150. package/dist/svelte/source.d.ts +3 -3
  151. package/dist/svelte/source.js +2 -2
  152. package/dist/{tables-CbVpFhC6.js → tables-Btlt_Rp-.js} +43 -6
  153. package/dist/testing/core.js +1 -1
  154. package/dist/testing/index.d.ts +3 -3
  155. package/dist/testing/index.js +5 -5
  156. package/dist/testing/saas/index.js +2 -2
  157. package/dist/testing/saas/permissions.js +1 -1
  158. package/dist/{text-diff-CsglY49A.js → text-diff-DxKRNFlx.js} +2 -2
  159. package/dist/{types-C7QtRn3n.d.ts → types-4wjWMSFM.d.ts} +2 -2
  160. package/dist/{types-CVCRFYY_.d.ts → types-CQF-oYSz.d.ts} +1 -1
  161. package/dist/{types-3pRMqcvw.d.ts → types-PS10T9UK.d.ts} +1 -1
  162. package/dist/{types-nXo_oQYk.d.ts → types-config-Cq72dArb.d.ts} +740 -782
  163. package/dist/types-run-DG1H5vrX.d.ts +44 -0
  164. package/dist/unplugin/index.d.ts +1 -1
  165. package/dist/unplugin/index.js +1 -1
  166. package/dist/{usage-L1G1zlwz.js → usage-DRReZaxQ.js} +1 -1
  167. package/dist/{usage-C1NKRxBJ.js → usage-DVjr2ZDc.js} +3 -3
  168. package/dist/usage-nVi3-z-j.js +1 -0
  169. package/dist/{verify-KX4Ohvs_.js → verify-BOB_Jyjx.js} +4 -4
  170. package/dist/vue/index.d.ts +1 -1
  171. package/dist/vue/index.js +2 -2
  172. package/dist/{watch-CiN6WU9k.js → watch-BNxvqCS4.js} +1 -1
  173. package/dist/watch-CGLmIdld.js +1 -0
  174. package/dist/{watch-DNIGANvR.js → watch-CnRyGEtp.js} +1 -1
  175. package/package.json +14 -14
  176. package/skills/permdock-data/references/queries-and-rls.md +1 -0
  177. package/dist/catalog-CgK_L4Qf.js +0 -1
  178. package/dist/collect-CPvCXMQ-.js +0 -1
  179. package/dist/gen-DbPS6a4x.js +0 -1
  180. package/dist/output-files-C5LFnQa4.js +0 -1
  181. package/dist/pull-Qh7JjiO7.js +0 -1
  182. package/dist/run-CdxQr6w8.js +0 -1
  183. package/dist/supabase-hook-b7tej2Vw.js +0 -2
  184. package/dist/usage-BAUV1SYl.js +0 -1
  185. package/dist/watch-NAUnUXph.js +0 -1
@@ -1,12 +1,12 @@
1
1
  import { n as boundaryFallback, t as boundaryDigest } from "../boundary--5Swp7sN.js";
2
- import { n as getUi, t as getStore } from "../context-DmH-Eyvx.js";
2
+ import { n as getUi, t as getStore } from "../context-BdoA9DhS.js";
3
3
  import { n as viewFor, t as scopedFor } from "../runtime-Cl6xSbEq.js";
4
4
  import { d as slotContent } from "../views-Dpr1uB16.js";
5
5
  import { n as describe } from "../describe-B7EosIKA.js";
6
6
  import { r as requiredPlans } from "../problem-details-EJHcvYCz.js";
7
7
  import { r as approvalHeaders } from "../protected-action-DiXulRVj.js";
8
- import { a as eventSourceRefresh, i as broadcastChannelRefresh, o as focusRefresh, r as authzChangeRefresh, s as visibilityRefresh } from "../store-options-C8x39AHa.js";
9
- import { a as gate, c as memberships, d as protectedAction, f as roles, h as tenant, i as filtered, l as permission, m as subject, n as assignable, o as getDescribe, p as setPermDock, r as assignablePermissions, s as getPermDock, t as approval, u as permissions } from "../stores-DoA7ACkz.js";
8
+ import { a as eventSourceRefresh, i as broadcastChannelRefresh, o as focusRefresh, r as authzChangeRefresh, s as visibilityRefresh } from "../store-options-BtHrfJUU.js";
9
+ import { a as gate, c as memberships, d as protectedAction, f as roles, h as tenant, i as filtered, l as permission, m as subject, n as assignable, o as getDescribe, p as setPermDock, r as assignablePermissions, s as getPermDock, t as approval, u as permissions } from "../stores-BIMyclLg.js";
10
10
  import "svelte/internal/disclose-version";
11
11
  import * as $ from "svelte/internal/client";
12
12
  import { onDestroy } from "svelte";
@@ -1,6 +1,6 @@
1
1
  import { n as boundaryDigest, r as boundaryFallback, t as PermissionBoundaryState } from "../boundary-DJqHADKu.js";
2
- import { a as scopedFor, c as slotContent, i as ProtectedProps, o as viewFor, s as PermissionBoundaryProps, t as PermDockDefaults } from "../types-CVCRFYY_.js";
3
- import { t as ClientStore } from "../store-core-eqG8jijs.js";
2
+ import { a as scopedFor, c as slotContent, i as ProtectedProps, o as viewFor, s as PermissionBoundaryProps, t as PermDockDefaults } from "../types-CQF-oYSz.js";
3
+ import { t as ClientStore } from "../store-core-DyNo_BwA.js";
4
4
  import { n as DescribeMessages } from "../describe-lAafaRQQ.js";
5
5
  /** The provider's `defaults` and `messages`. */
6
6
  type PermDockUi = {
@@ -1,5 +1,5 @@
1
1
  import { n as boundaryFallback, t as boundaryDigest } from "../boundary--5Swp7sN.js";
2
2
  import { d as slotContent } from "../views-Dpr1uB16.js";
3
- import { n as getUi, t as getStore } from "../context-DmH-Eyvx.js";
3
+ import { n as getUi, t as getStore } from "../context-BdoA9DhS.js";
4
4
  import { n as viewFor, t as scopedFor } from "../runtime-Cl6xSbEq.js";
5
5
  export { boundaryDigest, boundaryFallback, getStore, getUi, scopedFor, slotContent, viewFor };
@@ -1,11 +1,11 @@
1
- import { i as ProtectedProps, n as ProtectedActionReadable, r as SveltePermDockOptions, s as PermissionBoundaryProps, t as PermDockDefaults } from "../types-CVCRFYY_.js";
1
+ import { i as ProtectedProps, n as ProtectedActionReadable, r as SveltePermDockOptions, s as PermissionBoundaryProps, t as PermDockDefaults } from "../types-CQF-oYSz.js";
2
2
  import { i as describe } from "../describe-lAafaRQQ.js";
3
3
  import { c as requiredPlans } from "../errors-DUJ7wLlE.js";
4
4
  import { t as approvalHeaders } from "../headers-D1oRr-js.js";
5
5
  import { a as broadcastChannelRefresh, c as visibilityRefresh, i as authzChangeRefresh, n as EventSourceRefreshOptions, o as eventSourceRefresh, r as RefreshTrigger, s as focusRefresh, t as AuthzChangeRefresh } from "../refresh-on-C1zIMtJr.js";
6
- import { a as gate, c as memberships, d as protectedAction, f as roles, h as tenant, i as filtered, l as permission, m as subject, n as assignable, o as getDescribe, p as setPermDock, r as assignablePermissions, s as getPermDock, t as approval, u as permissions } from "../stores-4DOaL4ZP.js";
6
+ import { a as gate, c as memberships, d as protectedAction, f as roles, h as tenant, i as filtered, l as permission, m as subject, n as assignable, o as getDescribe, p as setPermDock, r as assignablePermissions, s as getPermDock, t as approval, u as permissions } from "../stores-DyFCruRC.js";
7
7
  import { t as PermissionBoundaryState } from "../boundary-DJqHADKu.js";
8
- import { _ as SubjectView, a as ClientPermDock, b as ProtectedAction, c as GateMode, d as PermissionSet, f as PermissionState, g as RolesOptions, i as ApprovalState, l as GateView, m as ProtectedActionView, o as ClientStatus, r as ApprovalHandle, s as FilterResult, v as TenantView, y as ActionResult } from "../store-core-eqG8jijs.js";
8
+ import { _ as SubjectView, a as ClientPermDock, b as ProtectedAction, c as GateMode, d as PermissionSet, f as PermissionState, g as RolesOptions, i as ApprovalState, l as GateView, m as ProtectedActionView, o as ClientStatus, r as ApprovalHandle, s as FilterResult, v as TenantView, y as ActionResult } from "../store-core-DyNo_BwA.js";
9
9
  import { Component } from "svelte";
10
10
  export declare const Protected: Component<ProtectedProps>;
11
11
  export declare const PermissionBoundary: Component<PermissionBoundaryProps>;
@@ -1,8 +1,8 @@
1
1
  import { n as describe } from "../describe-B7EosIKA.js";
2
2
  import { r as requiredPlans } from "../problem-details-EJHcvYCz.js";
3
3
  import { r as approvalHeaders } from "../protected-action-DiXulRVj.js";
4
- import { a as eventSourceRefresh, i as broadcastChannelRefresh, o as focusRefresh, r as authzChangeRefresh, s as visibilityRefresh } from "../store-options-C8x39AHa.js";
5
- import { a as gate, c as memberships, d as protectedAction, f as roles, h as tenant, i as filtered, l as permission, m as subject, n as assignable, o as getDescribe, p as setPermDock, r as assignablePermissions, s as getPermDock, t as approval, u as permissions } from "../stores-DoA7ACkz.js";
4
+ import { a as eventSourceRefresh, i as broadcastChannelRefresh, o as focusRefresh, r as authzChangeRefresh, s as visibilityRefresh } from "../store-options-BtHrfJUU.js";
5
+ import { a as gate, c as memberships, d as protectedAction, f as roles, h as tenant, i as filtered, l as permission, m as subject, n as assignable, o as getDescribe, p as setPermDock, r as assignablePermissions, s as getPermDock, t as approval, u as permissions } from "../stores-BIMyclLg.js";
6
6
  import PermissionBoundaryComponent from "./PermissionBoundary.svelte";
7
7
  import ProtectedComponent from "./Protected.svelte";
8
8
  // src/svelte/source.ts
@@ -2995,6 +2995,25 @@ function checkName(name) {
2995
2995
  if (new TextEncoder().encode(name).length > 63) throw configError(`PermDock CLI: the helper name ${name} is longer than 63 bytes; use a shorter scope name`);
2996
2996
  return name;
2997
2997
  }
2998
+ /**
2999
+ * Allows minus denies over one read of the memberships: `body` yields `(id,
3000
+ * grant_key)` per membership, and each key list selects grant keys.
3001
+ */
3002
+ function setIds(body, allow, deny) {
3003
+ return {
3004
+ sql: ` with pdk_i(id, grant_key) as materialized (
3005
+ ${body.sql}
3006
+ )
3007
+ select i.id from pdk_i i where i.grant_key in (
3008
+ ${allow}
3009
+ )
3010
+ except
3011
+ select i.id from pdk_i i where i.grant_key in (
3012
+ ${deny}
3013
+ )`,
3014
+ vars: body.vars
3015
+ };
3016
+ }
2998
3017
  function grantsFunction(ctx, grants, renamed, anonExecute) {
2999
3018
  const fn = qualified(ctx, PERMISSION_HELPERS.grantKeys);
3000
3019
  const map = Object.fromEntries([...grants].toSorted(byKey));
@@ -3065,14 +3084,17 @@ function permissionHelpersSql(ctx, grants, renamed, anonExecute) {
3065
3084
  const denyKeys = (scope) => `${keys}(p_permission, ${quoteLiteral(scope)}, 'deny') g(grant_key)`;
3066
3085
  const has = (helper, user) => ` select exists (select 1 from ${allowKeys("global")} where ${helper}(${user}g.grant_key))
3067
3086
  and not exists (select 1 from ${denyKeys("global")} where ${helper}(${user}g.grant_key))`;
3068
- const ids = (helper, scope, user) => ` select a.id
3087
+ const keyList = (scope, effect, conditioned) => conditioned === void 0 ? effect === "allow" ? `select g.grant_key from ${allowKeys(scope)}` : `select g.grant_key from ${denyKeys(scope)}` : `select g.grant_key from ${keys}(p_permission, ${quoteLiteral(scope)}, ${quoteLiteral(conditioned)}) g(grant_key)\n where p_conditioned`;
3088
+ const ids = (body, scope) => setIds(body, keyList(scope, "allow"), keyList(scope, "deny"));
3089
+ const conditionedIds = (body, scope) => setIds(body, `${keyList(scope, "allow")}\n union all\n ${keyList(scope, "allow", "conditioned-allow")}`, `${keyList(scope, "deny")}\n except\n ${keyList(scope, "deny", "conditioned-deny")}`);
3090
+ const callIds = (helper, scope, user) => ` select a.id
3069
3091
  from ${allowKeys(scope)}
3070
3092
  cross join lateral ${helper}(${user}g.grant_key) a(id)
3071
3093
  except
3072
3094
  select d.id
3073
3095
  from ${denyKeys(scope)}
3074
3096
  cross join lateral ${helper}(${user}g.grant_key) d(id)`;
3075
- const conditionedIds = (helper, scope, user) => ` select a.id
3097
+ const callConditionedIds = (helper, scope, user) => ` select a.id
3076
3098
  from (
3077
3099
  select g.grant_key from ${allowKeys(scope)}
3078
3100
  union all
@@ -3089,6 +3111,21 @@ function permissionHelpersSql(ctx, grants, renamed, anonExecute) {
3089
3111
  where p_conditioned
3090
3112
  ) g
3091
3113
  cross join lateral ${helper}(${user}g.grant_key) d(id)`;
3114
+ const setForm = ctx.customRoles === void 0;
3115
+ const byPermission = (fn, params, scope, user, conditioned) => {
3116
+ const returns = `setof ${scopeTypeOf(ctx, scope)}`;
3117
+ if (!setForm) {
3118
+ const helper = qualified(ctx, user === "" ? permittedIdsHelper(scope) : permittedForHelper(scope));
3119
+ return definer(fn, params, returns, (conditioned ? callConditionedIds : callIds)(helper, scope, user));
3120
+ }
3121
+ const bodies = grantBodies({
3122
+ ...user === "" ? ctx : forUserContext(ctx),
3123
+ grantSet: true
3124
+ }).ids(scope);
3125
+ return `create or replace function ${fn}(${params})
3126
+ returns ${returns}
3127
+ ${functionBody((conditioned ? conditionedIds : ids)(bodies, scope), parallel, true)}`;
3128
+ };
3092
3129
  const keysBody = (scope, bodies, filtered) => {
3093
3130
  const rows = ["global", scope].flatMap((at) => Object.entries(grants.get(at) ?? {}).toSorted(byKey).flatMap(([key, effects]) => ["allow", "deny"].flatMap((effect) => effects[effect].map((grant) => `(${[
3094
3131
  key,
@@ -3140,7 +3177,7 @@ ${definer(qualified(ctx, PERMISSION_HELPERS.has), "p_permission text", "boolean"
3140
3177
  ${grantsSql(qualified(ctx, PERMISSION_HELPERS.has), "text", anonExecute)}`];
3141
3178
  for (const scope of ctx.scopes) {
3142
3179
  const fn = qualified(ctx, checkName(permittedByPermissionHelper(scope.name)));
3143
- chunks.push(`${definer(fn, "p_permission text", `setof ${scopeTypeOf(ctx, scope.name)}`, ids(qualified(ctx, permittedIdsHelper(scope.name)), scope.name, ""))}
3180
+ chunks.push(`${byPermission(fn, "p_permission text", scope.name, "", false)}
3144
3181
  ${grantsSql(fn, "text", anonExecute)}`);
3145
3182
  const keysFn = qualified(ctx, checkName(permissionKeysHelper(scope.name)));
3146
3183
  const type = scopeTypeOf(ctx, scope.name);
@@ -3152,7 +3189,7 @@ ${grantsSql(fn, "text", anonExecute)}`);
3152
3189
  ${keysFunction(keysFn, `p_id ${type}`, keysBody(scope.name, caller, false), grantsSql(keysFn, type, anonExecute), parallel)}
3153
3190
  ${keysFunction(keysFn, `p_id ${type}, p_keys text[]`, keysBody(scope.name, caller, true), grantsSql(keysFn, `${type}, text[]`, anonExecute), parallel)}`);
3154
3191
  chunks.push(`-- with p_conditioned true, also the instances a conditioned allow reaches, minus only unconditional denies: the caller applies the row condition
3155
- ${definer(fn, "p_permission text, p_conditioned boolean", `setof ${scopeTypeOf(ctx, scope.name)}`, conditionedIds(qualified(ctx, permittedIdsHelper(scope.name)), scope.name, ""))}
3192
+ ${byPermission(fn, "p_permission text, p_conditioned boolean", scope.name, "", true)}
3156
3193
  ${grantsSql(fn, "text, boolean", anonExecute)}`);
3157
3194
  }
3158
3195
  if (ctx.authorize !== "database") return `${chunks.join("\n\n")}\n`;
@@ -3164,9 +3201,9 @@ ${definer(hasFor, `p_user ${user}, p_permission text`, "boolean", has(qualified(
3164
3201
  ${revoke(hasFor)}`);
3165
3202
  for (const scope of ctx.scopes) {
3166
3203
  const fn = qualified(ctx, checkName(`${permittedByPermissionHelper(scope.name)}_for`));
3167
- chunks.push(`${definer(fn, `p_user ${user}, p_permission text`, `setof ${scopeTypeOf(ctx, scope.name)}`, ids(qualified(ctx, permittedForHelper(scope.name)), scope.name, "p_user, "))}
3204
+ chunks.push(`${byPermission(fn, `p_user ${user}, p_permission text`, scope.name, "p_user, ", false)}
3168
3205
  ${revoke(fn)}`);
3169
- chunks.push(`${definer(fn, `p_user ${user}, p_permission text, p_conditioned boolean`, `setof ${scopeTypeOf(ctx, scope.name)}`, conditionedIds(qualified(ctx, permittedForHelper(scope.name)), scope.name, "p_user, "))}
3206
+ chunks.push(`${byPermission(fn, `p_user ${user}, p_permission text, p_conditioned boolean`, scope.name, "p_user, ", true)}
3170
3207
  revoke execute on function ${fn}(${user}, text, boolean) from public, anon, authenticated;`);
3171
3208
  const keysFor = qualified(ctx, checkName(permissionKeysForHelper(scope.name)));
3172
3209
  const type = scopeTypeOf(ctx, scope.name);
@@ -1 +1 @@
1
- export { r as policyMatrix, t as testOrmParity, n as testRlsParity } from "../core-DKqrD_xW.js";
1
+ export { r as policyMatrix, t as testOrmParity, n as testRlsParity } from "../core-tEfD0lwu.js";
@@ -2,7 +2,7 @@ import { Ct as WhereCompiler, D as Policy, G as CredentialVerifier, Sr as Princi
2
2
  import { S as policyMatrix, _ as DescribePolicyConfig, a as OrmParityScenario, b as PolicyMatrixCell, c as RlsFieldsOutcome, d as RlsParityOptions, f as RlsParityReport, g as testRlsParity, h as RlsQueryResult, i as OrmParityRunInput, l as RlsParityCase, m as RlsQueryFn, n as OrmParityOptions, o as testOrmParity, p as RlsParitySubject, r as OrmParityReport, s as RlsDbOutcome, t as OrmParityCase, u as RlsParityFixture, v as MatrixCell, x as PolicyMatrixReport, y as MatrixOutcome } from "../core-CnC47rSf.js";
3
3
  import { A as ResourceInit, C as InferPermissionTree, r as Role, w as Permission } from "../vocabulary-FYgI_NoI.js";
4
4
  import { l as OperationLookup, n as OperationCoverageOptions } from "../coverage-DL7JCZmb.js";
5
- import { lt as LegacyCheck } from "../index-BXz-XXC3.js";
5
+ import { lt as LegacyCheck } from "../index-D1msamx_.js";
6
6
  import { C as Limits, D as InstanceCache, a as PermDock, g as PrincipalIdentity, u as SnapshotOptions, v as PrincipalSource, z as ApprovalPolicySource } from "../permdock-Dz3yzWrp.js";
7
7
  import { i as Seeds } from "../seeds-uG196Ev4.js";
8
8
  import { t as SqlQuery } from "../sql-BYYNi1lu.js";
@@ -14,12 +14,12 @@ import { c as ModelMap, t as AgentPermDock, u as ToolMap } from "../create-sGl1c
14
14
  import { t as CloudApproverOptions } from "../types-D3tjoLwT.js";
15
15
  import { c as AccessReviewStore } from "../types-BFtFaI1W.js";
16
16
  import { t as supabaseMembershipsBudget } from "../budget-5LJ8kfZk.js";
17
- import { R as IdempotencyStore } from "../index-Cq9N5B92.js";
17
+ import { R as IdempotencyStore } from "../index-BSJoxaOi.js";
18
18
  import { g as SetQueue, l as ReplayStore } from "../types-Cakw89Wx.js";
19
19
  import { S as SsfStreamStore } from "../index-O0qbI8Ha.js";
20
20
  import { s as PolicySource } from "../hosted-DUbuh0Td.js";
21
21
  import { l as VersionStore, n as SubjectCache, s as VersionCache } from "../subject-cache-BZeSj4Xf.js";
22
- import { r as SnapshotStorage } from "../types-C7QtRn3n.js";
22
+ import { r as SnapshotStorage } from "../types-4wjWMSFM.js";
23
23
  import { a as AutomationSource, t as Automation } from "../automation-CUcWz8uu.js";
24
24
  import { s as SupportSessionSource } from "../index-DegTwZxD.js";
25
25
  import { n as ApprovalWaiter } from "../waiter-hYLJXA7r.js";
@@ -1,11 +1,11 @@
1
- import { i as policyMatrixLayout, n as testRlsParity, r as policyMatrix, t as testOrmParity } from "../core-DKqrD_xW.js";
1
+ import { i as policyMatrixLayout, n as testRlsParity, r as policyMatrix, t as testOrmParity } from "../core-tEfD0lwu.js";
2
2
  import { t as fromSnapshot } from "../from-snapshot-CCDF_ihX.js";
3
3
  import { t as getPermDock } from "../permdock-BueSeg7X.js";
4
4
  import { n as parseSnapshot } from "../snapshot-DckMnHk8.js";
5
5
  import { t as operationCoverage } from "../coverage-nFSMjFxH.js";
6
- import { C as approvalPoliciesFor, E as memoryCustomRoleSource, d as snapshotFor } from "../src-D6_T4zd7.js";
7
- import { C as saasOrg, E as saasSeed, S as saasMemberships, a as saasProject, g as verifySaasSession, h as signSaasToken, k as saasPolicy, t as saasDoc, w as saasPrincipal, x as saasCustomRoles } from "../saas-DzjKUQr5.js";
8
- import { i as saasPermissions } from "../permissions-ijDw4sO1.js";
6
+ import { C as approvalPoliciesFor, E as memoryCustomRoleSource, d as snapshotFor } from "../src-BAYcigFU.js";
7
+ import { C as saasOrg, E as saasSeed, S as saasMemberships, a as saasProject, g as verifySaasSession, h as signSaasToken, k as saasPolicy, t as saasDoc, w as saasPrincipal, x as saasCustomRoles } from "../saas-CUwmgUB8.js";
8
+ import { i as saasPermissions } from "../permissions-Bj3DRIEi.js";
9
9
  import { c as quoteSqlTable, o as quoteSqlIdent } from "../sql-T4GaBh9X.js";
10
10
  import { o as resolveApproval } from "../helpers-DSmj6SHi.js";
11
11
  import { c as problemFromDecision } from "../problem-BZB7zPC7.js";
@@ -27,7 +27,7 @@ import { c as mergeHostedGrants, l as parsePolicyDocument } from "../hosted-DMJK
27
27
  import { t as catalogFingerprint } from "../catalog-fingerprint-DAWZARy6.js";
28
28
  import { n as discoverAuthorizationServer } from "../device-f3JEnqa0.js";
29
29
  import { t as POLICY_NOT_PUBLISHED } from "../problem-types-81BEw0IN.js";
30
- import { t as require__2020 } from "../2020-bJfT8aIA.js";
30
+ import { t as require__2020 } from "../2020-DBXhfpuK.js";
31
31
  import { t as APPROVAL_REQUEST_SCHEMA } from "../request-schema-DzEoR310.js";
32
32
  import { t as PUSHED_POLICY_SCHEMA } from "../pushed-policy-rpB6k77P.js";
33
33
  import { n as supabaseMembershipsBudget } from "../budget-BH81q2cj.js";
@@ -1,3 +1,3 @@
1
- import { a as saasPlans, c as rowSchema, i as saasPermissions, n as SaasFolderSchema, o as saasRoles, r as SaasProjectSchema, s as saasTenantRoleNames, t as SaasDocSchema } from "../../permissions-ijDw4sO1.js";
2
- import { C as saasOrg, D as saasUsers, E as saasSeed, O as SAAS_API_KEY_LIMIT, S as saasMemberships, T as saasRelations, _ as verifySaasToken, a as saasProject, b as SAAS_EXPIRED_AT, c as saasUser, d as saasIssuer, f as saasJwks, g as verifySaasSession, h as signSaasToken, i as saasLimitStore, k as saasPolicy, l as SAAS_TOKEN_TTL_SECONDS, m as saasPublicJwk, n as saasFolder, o as saasScenarioOptions, p as saasPrivateJwk, r as saasFolderScenarios, s as saasScenarios, t as saasDoc, u as saasAudience, v as saasSchemaSql, w as saasPrincipal, x as saasCustomRoles, y as saasSeedSql } from "../../saas-DzjKUQr5.js";
1
+ import { a as saasPlans, c as rowSchema, i as saasPermissions, n as SaasFolderSchema, o as saasRoles, r as SaasProjectSchema, s as saasTenantRoleNames, t as SaasDocSchema } from "../../permissions-Bj3DRIEi.js";
2
+ import { C as saasOrg, D as saasUsers, E as saasSeed, O as SAAS_API_KEY_LIMIT, S as saasMemberships, T as saasRelations, _ as verifySaasToken, a as saasProject, b as SAAS_EXPIRED_AT, c as saasUser, d as saasIssuer, f as saasJwks, g as verifySaasSession, h as signSaasToken, i as saasLimitStore, k as saasPolicy, l as SAAS_TOKEN_TTL_SECONDS, m as saasPublicJwk, n as saasFolder, o as saasScenarioOptions, p as saasPrivateJwk, r as saasFolderScenarios, s as saasScenarios, t as saasDoc, u as saasAudience, v as saasSchemaSql, w as saasPrincipal, x as saasCustomRoles, y as saasSeedSql } from "../../saas-CUwmgUB8.js";
3
3
  export { SAAS_API_KEY_LIMIT, SAAS_EXPIRED_AT, SAAS_TOKEN_TTL_SECONDS, SaasDocSchema, SaasFolderSchema, SaasProjectSchema, rowSchema, saasAudience, saasCustomRoles, saasDoc, saasFolder, saasFolderScenarios, saasIssuer, saasJwks, saasLimitStore, saasMemberships, saasOrg, saasPermissions, saasPlans, saasPolicy, saasPrincipal, saasPrivateJwk, saasProject, saasPublicJwk, saasRelations, saasRoles, saasScenarioOptions, saasScenarios, saasSchemaSql, saasSeed, saasSeedSql, saasTenantRoleNames, saasUser, saasUsers, signSaasToken, verifySaasSession, verifySaasToken };
@@ -1 +1 @@
1
- export { t as SaasDocSchema, n as SaasFolderSchema, r as SaasProjectSchema, i as saasPermissions, a as saasPlans, o as saasRoles, s as saasTenantRoleNames } from "../../permissions-ijDw4sO1.js";
1
+ export { t as SaasDocSchema, n as SaasFolderSchema, r as SaasProjectSchema, i as saasPermissions, a as saasPlans, o as saasRoles, s as saasTenantRoleNames } from "../../permissions-Bj3DRIEi.js";
@@ -27,7 +27,7 @@ var Diff = class {
27
27
  let editLength = 1;
28
28
  let maxEditLength = newLen + oldLen;
29
29
  if (options.maxEditLength != null) maxEditLength = Math.min(maxEditLength, options.maxEditLength);
30
- const maxExecutionTime = (_a = options.timeout) !== null && _a !== void 0 ? _a : Infinity;
30
+ const maxExecutionTime = (_a = options.timeout) !== null && _a !== void 0 ? _a : 1e400;
31
31
  const abortAfterTimestamp = Date.now() + maxExecutionTime;
32
32
  const bestPath = [{
33
33
  oldPos: -1,
@@ -35,7 +35,7 @@ var Diff = class {
35
35
  }];
36
36
  let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options);
37
37
  if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) return done(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
38
- let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
38
+ let minDiagonalToConsider = -1e400, maxDiagonalToConsider = 1e400;
39
39
  const execEditLength = () => {
40
40
  for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
41
41
  let basePath;
@@ -1,7 +1,7 @@
1
- import { n as ClientStoreOptions } from "./store-core-eqG8jijs.js";
1
+ import { n as ClientStoreOptions } from "./store-core-DyNo_BwA.js";
2
2
  import { n as DescribeMessages } from "./describe-lAafaRQQ.js";
3
3
  import { tn as Snapshot, ut as SnapshotSource, vt as TokenVerifier } from "./policy-types-93NwI8iI.js";
4
- import { t as PermDockDefaults } from "./types-3pRMqcvw.js";
4
+ import { t as PermDockDefaults } from "./types-PS10T9UK.js";
5
5
  import { ReactNode } from "react";
6
6
  type SnapshotStorage = {
7
7
  /** Names the implementation in errors and events. */
@@ -2,7 +2,7 @@ import { Jt as ClientBundle, Qn as Decision, Zn as ApprovalRequiredDecision, ir
2
2
  import { w as Permission } from "./vocabulary-FYgI_NoI.js";
3
3
  import { a as PermDock } from "./permdock-Dz3yzWrp.js";
4
4
  import { t as PermissionBoundaryState } from "./boundary-DJqHADKu.js";
5
- import { f as PermissionState, h as ProviderOptionsBase, m as ProtectedActionView, t as ClientStore, y as ActionResult } from "./store-core-eqG8jijs.js";
5
+ import { f as PermissionState, h as ProviderOptionsBase, m as ProtectedActionView, t as ClientStore, y as ActionResult } from "./store-core-DyNo_BwA.js";
6
6
  import { Snippet } from "svelte";
7
7
  import { Readable } from "svelte/store";
8
8
  /**
@@ -1,4 +1,4 @@
1
- import { n as ClientStoreOptions } from "./store-core-eqG8jijs.js";
1
+ import { n as ClientStoreOptions } from "./store-core-DyNo_BwA.js";
2
2
  import { Jt as ClientBundle, Qn as Decision, Zn as ApprovalRequiredDecision, ir as GrantedDecision, tn as Snapshot, vt as TokenVerifier } from "./policy-types-93NwI8iI.js";
3
3
  import { n as DescribeMessages } from "./describe-lAafaRQQ.js";
4
4
  import { s as RowData } from "./permdock-Dz3yzWrp.js";