permdock 0.22.1 → 0.24.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 (322) hide show
  1. package/dist/a2a/index.d.ts +4 -4
  2. package/dist/a2a/index.js +4 -4
  3. package/dist/{adoption-scan-DzX5Gqcg.js → adoption-scan-CNoE5yBA.js} +1 -1
  4. package/dist/agent/index.d.ts +2 -2
  5. package/dist/agent/index.js +1 -1
  6. package/dist/ai-sdk/index.d.ts +3 -3
  7. package/dist/ai-sdk/index.js +2 -2
  8. package/dist/app/index.d.ts +6 -6
  9. package/dist/app/index.js +4 -4
  10. package/dist/{approval-normalize-DNLW0zOM.js → approval-normalize-KfhzpD93.js} +1 -1
  11. package/dist/{approval-policies-UnDSxT__.d.ts → approval-policies-D7moEfTM.d.ts} +1 -1
  12. package/dist/{approval-prompt-2hTqo6IM.d.ts → approval-prompt-DtfKSH-8.d.ts} +1 -1
  13. package/dist/approvals/index.d.ts +3 -3
  14. package/dist/approvals/index.js +3 -3
  15. package/dist/{approvals-B_sn4Wrn.js → approvals-BfzI8Foe.js} +5 -5
  16. package/dist/{arazzo-BkjyGVF0.js → arazzo-4rMFOHbu.js} +1 -1
  17. package/dist/{arazzo-CTx11zFc.js → arazzo-rsYPFgga.js} +2 -2
  18. package/dist/astro/index.d.ts +4 -4
  19. package/dist/astro/index.js +2 -2
  20. package/dist/{audience-5Xx1hdIv.js → audience-N2BqOvES.js} +1 -1
  21. package/dist/authzen/index.d.ts +5 -5
  22. package/dist/authzen/index.js +3 -3
  23. package/dist/{automation-B20_8UoT.d.ts → automation-CrGcfIZn.d.ts} +1 -1
  24. package/dist/better-auth/index.d.ts +1 -1
  25. package/dist/better-auth/index.js +1 -1
  26. package/dist/better-supabase/index.d.ts +61 -23
  27. package/dist/better-supabase/index.js +87 -35
  28. package/dist/{bind-B4Z0U2Gr.js → bind-Cx10JuJ-.js} +3 -3
  29. package/dist/{bind-CnOMjazH.d.ts → bind-N5jf6kjk.d.ts} +7 -7
  30. package/dist/{body-B3ylkmmE.js → body-Cy9S8zhw.js} +1 -1
  31. package/dist/{build-instance-B0vsViF5.js → build-instance-BDGzsGcn.js} +1 -1
  32. package/dist/{capability-YkRMUAsF.d.ts → capability-mLbd3KZ0.d.ts} +1 -1
  33. package/dist/{casbin-BFOuRptJ.js → casbin-CjUT-wqV.js} +1 -1
  34. package/dist/{casbin-BpS9ABSO.js → casbin-Dg5N0Gfa.js} +1 -1
  35. package/dist/catalog/index.d.ts +4 -4
  36. package/dist/catalog/index.js +5 -5
  37. package/dist/{catalog-Y4CjN8NA.js → catalog-BJu0A15r.js} +2 -2
  38. package/dist/{catalog-CoyKnU5c.js → catalog-CgA6-DQA.js} +1 -1
  39. package/dist/catalog-DqYnQz8U.js +1 -0
  40. package/dist/{catalog-doc-Zi0jRpyH.js → catalog-doc-BoSOQRXT.js} +2 -2
  41. package/dist/{challenge-B__LcNve.js → challenge-DVw1SrH9.js} +1 -1
  42. package/dist/chat/index.d.ts +1 -1
  43. package/dist/chat/index.js +3 -3
  44. package/dist/chat-sdk/index.d.ts +3 -3
  45. package/dist/claude-agent/index.d.ts +3 -3
  46. package/dist/claude-agent/index.js +1 -1
  47. package/dist/clerk/index.d.ts +2 -2
  48. package/dist/cli/bin.js +1 -1
  49. package/dist/cli/index.d.ts +4 -4
  50. package/dist/cli/index.js +2 -2
  51. package/dist/cloud/index.d.ts +8 -8
  52. package/dist/cloud/index.js +2 -2
  53. package/dist/{cloud-DXcQXWDi.js → cloud-Blw4AaQv.js} +2 -2
  54. package/dist/{codemod-CxyKuniX.js → codemod-BFFXaS-S.js} +1 -1
  55. package/dist/{codemod-DJ0WqXWk.js → codemod-ByRUKVp-.js} +2 -2
  56. package/dist/{collect-ScSG05VJ.js → collect-COqPRz6O.js} +2 -2
  57. package/dist/collect-CjFczu8a.js +1 -0
  58. package/dist/{collect-Cr71JA7z.js → collect-D3ToPa6Z.js} +1 -1
  59. package/dist/compile/index.d.ts +1 -1
  60. package/dist/{compile-DC-BrhH1.d.ts → compile-DSwZUJmL.d.ts} +2 -2
  61. package/dist/{completion-BHVvAJ6Q.js → completion-BW53byZN.js} +1 -1
  62. package/dist/{config-2grt3oll.js → config-B0qti4jI.js} +1 -1
  63. package/dist/{config-report-Cg5Y5j0h.js → config-report-DgMqeeK6.js} +2 -2
  64. package/dist/{context-Cem4QafV.js → context-KrAhRY22.js} +2 -2
  65. package/dist/convex/index.d.ts +4 -4
  66. package/dist/convex/index.js +1 -1
  67. package/dist/{core-CUjhfz0W.js → core-DMQsq2Gv.js} +5 -5
  68. package/dist/{core-D2JNg5jA.d.ts → core-KsoqXWhf.d.ts} +2 -2
  69. package/dist/{create-BsL5lCWR.js → create-BRr7Gu7N.js} +6 -6
  70. package/dist/{create-oMCcZV4X.d.ts → create-ChK8bpCK.d.ts} +7 -7
  71. package/dist/{create-CPDSbK1a.d.ts → create-DGFv7Dje.d.ts} +4 -4
  72. package/dist/{create-BJ2_8NDO.js → create-bYkJ4-tg.js} +3 -3
  73. package/dist/{create-B2tdOygC.d.ts → create-goT32QIN.d.ts} +6 -6
  74. package/dist/{credential-Bap3HClV.js → credential-DrVrRL7z.js} +2 -2
  75. package/dist/{credentials-BXV0oz56.js → credentials-UwTE2wCW.js} +1 -1
  76. package/dist/{credentials-DPX140fN.d.ts → credentials-fqa_Xzzh.d.ts} +2 -2
  77. package/dist/{condition-evaluate-bVVRSdzq.js → delegation-CrdqnesZ.js} +123 -156
  78. package/dist/delivery/index.d.ts +4 -4
  79. package/dist/delivery/index.js +1 -1
  80. package/dist/{denied-text-BXQkWU7d.d.ts → denied-text-BTMxIn5W.d.ts} +1 -1
  81. package/dist/{describe-DVobr5FX.d.ts → describe-CazEjtOH.d.ts} +1 -1
  82. package/dist/{diff-Jc_kbDz-.js → diff-BkuW_5dK.js} +1 -1
  83. package/dist/{diff-BR9JArxz.js → diff-DLcsCeVo.js} +3 -3
  84. package/dist/{doctor-iIbdUK8F.js → doctor-Jk2Ifezw.js} +2 -2
  85. package/dist/{doctor-DaRoSPT0.js → doctor-oD08zL1e.js} +37 -19
  86. package/dist/drizzle/index.d.ts +3 -3
  87. package/dist/elysia/index.d.ts +4 -4
  88. package/dist/elysia/index.js +3 -3
  89. package/dist/{errors-D_JIQJYb.d.ts → errors-CXxQwtbZ.d.ts} +1 -1
  90. package/dist/{evaluate-B5yZHmts.js → evaluate-_JdlbJ32.js} +11 -8
  91. package/dist/{evaluations-BzTDWO4m.js → evaluations-Bj5xw0EM.js} +3 -3
  92. package/dist/{evaluations-DQYfh4Jh.d.ts → evaluations-DcUW5VkX.d.ts} +3 -3
  93. package/dist/evaluator-BvRk9kiK.js +0 -0
  94. package/dist/evaluator-eager-DvmrpdZt.js +9 -0
  95. package/dist/evaluator-mHAoYEkk.js +2 -0
  96. package/dist/eve/index.d.ts +4 -4
  97. package/dist/eve/index.js +2 -2
  98. package/dist/express/index.d.ts +4 -4
  99. package/dist/express/index.js +3 -3
  100. package/dist/fastify/index.d.ts +4 -4
  101. package/dist/fastify/index.js +3 -3
  102. package/dist/{fetch-adapter-MoYZ-vF5.js → fetch-adapter-CAA3VJMX.js} +3 -3
  103. package/dist/{fetch-adapter-DxqsIXSO.d.ts → fetch-adapter-eQ-mdk8n.d.ts} +2 -2
  104. package/dist/{fields-CVyOk-f1.js → fields-B17OWcPx.js} +1 -1
  105. package/dist/fields-DlKwZYiy.js +26 -0
  106. package/dist/from-snapshot-CdGYjHUg.js +153 -0
  107. package/dist/{gen-Cw8goef4.js → gen-BwcwwLok.js} +3 -3
  108. package/dist/{gen-DFpWGJWF.js → gen-D4ulqsYR.js} +1 -1
  109. package/dist/grantee-OG4klcNr.js +110 -0
  110. package/dist/{grantee-match-8J2y60MF.js → grantee-match-CPQ9zV-H.js} +1 -1
  111. package/dist/h3/index.d.ts +4 -4
  112. package/dist/h3/index.js +3 -3
  113. package/dist/{helpers-DzBIfL1N.js → helpers-CO2hDpBU.js} +1 -1
  114. package/dist/hono/index.d.ts +4 -4
  115. package/dist/hono/index.js +3 -3
  116. package/dist/{hosted-DXq1plaP.d.ts → hosted-BUCpV8-u.d.ts} +1 -1
  117. package/dist/{hosted-C5I2TSXm.js → hosted-cPDyrlsQ.js} +5 -4
  118. package/dist/{import-CvXswHDy.js → import-B2jgnNS0.js} +1 -1
  119. package/dist/{import-DDegvwDI.js → import-BsrnU4BF.js} +1 -1
  120. package/dist/{index-C-R8lBPb.d.ts → index-BXS29UnX.d.ts} +1 -1
  121. package/dist/{index-BcS8c_2S.d.ts → index-CvKGALWb.d.ts} +4 -4
  122. package/dist/{index-BdZpqhJK.d.ts → index-CxA-ygwc.d.ts} +2 -2
  123. package/dist/{index-Cjfa1Uwr.d.ts → index-DD2FBFdm.d.ts} +10 -8
  124. package/dist/{index-iIsqXFVu.d.ts → index-DQCBzEhO.d.ts} +4 -4
  125. package/dist/{index-C_8uxAlv.d.ts → index-DYAJ9JX1.d.ts} +4 -4
  126. package/dist/index.d.ts +16 -16
  127. package/dist/index.js +21 -18
  128. package/dist/{init-D_T_zgFg.js → init-Baq0yYfu.js} +1 -1
  129. package/dist/{init-Dz552ZPp.js → init-Cik6ITgM.js} +3 -3
  130. package/dist/{instance-options-C6gEDOts.d.ts → instance-options-BDHB3qBG.d.ts} +1 -1
  131. package/dist/{instance-snapshot-D_dGTq--.js → instance-snapshot-LPNBG9np.js} +67 -8
  132. package/dist/jwt/index.d.ts +4 -4
  133. package/dist/{kernel-NmxiWII2.js → kernel-BY3rVRs2.js} +8 -8
  134. package/dist/kysely/index.d.ts +3 -3
  135. package/dist/{login-DIVe6QdP.js → login-CUboKh0f.js} +3 -3
  136. package/dist/{login-B2usNw0X.js → login-CcBS1xkU.js} +1 -1
  137. package/dist/{manifest-D44OkoLk.js → manifest-BoCYBbQL.js} +1 -1
  138. package/dist/{manifest-CbHnl4I_.js → manifest-CIlVL-QT.js} +35 -35
  139. package/dist/{manifest-schema-DUheHWcp.js → manifest-schema-svAkgqMc.js} +1 -1
  140. package/dist/{map-error-p4ROJ_26.js → map-error-BCdb2Nrp.js} +2 -2
  141. package/dist/may-use-D0_wNcgB.js +126 -0
  142. package/dist/mcp/index.d.ts +8 -8
  143. package/dist/mcp/index.js +5 -5
  144. package/dist/membership-filter-CfLdP_F9.js +68 -0
  145. package/dist/nest/index.d.ts +4 -4
  146. package/dist/nest/index.js +3 -3
  147. package/dist/next/index.d.ts +10 -10
  148. package/dist/next/index.js +6 -6
  149. package/dist/next/plugin.d.ts +1 -1
  150. package/dist/next/plugin.js +1 -1
  151. package/dist/node/index.d.ts +4 -4
  152. package/dist/node/index.js +2 -2
  153. package/dist/openai/index.d.ts +4 -4
  154. package/dist/openai/index.js +2 -2
  155. package/dist/openapi/index.d.ts +2 -2
  156. package/dist/{openapi-5moP9sTG.js → openapi-DglIpD53.js} +2 -2
  157. package/dist/{openapi-DcvNnLFa.js → openapi-DobvXTF6.js} +2 -2
  158. package/dist/orpc/index.d.ts +5 -5
  159. package/dist/orpc/index.js +3 -3
  160. package/dist/otel/index.d.ts +3 -3
  161. package/dist/otel/index.js +1 -1
  162. package/dist/{output-RIUEs3_S.js → output-B81GJ6u6.js} +1 -1
  163. package/dist/{ownership-adPAsUwY.js → ownership-B7Ea-hUY.js} +3 -3
  164. package/dist/{parse-local-manifest-BaCqsqwC.d.ts → parse-local-manifest-DzZOzDsK.d.ts} +1 -1
  165. package/dist/pdp/index.d.ts +3 -3
  166. package/dist/pdp/index.js +3 -3
  167. package/dist/{permdock-B5LyNVgn.js → permdock-HfTF99xX.js} +26 -15
  168. package/dist/{permdock-BaB-KQqn.d.ts → permdock-vD3mwLSm.d.ts} +3 -3
  169. package/dist/{permissions-COpRGKt7.js → permissions-CGYZqYsY.js} +2 -2
  170. package/dist/{policy-x8RBKW8d.d.ts → policy-B_cqFLHu.d.ts} +1 -1
  171. package/dist/{policy-wGzbAPQF.js → policy-BovcTojN.js} +5 -4
  172. package/dist/{policy-from-catalog-Cy103lsm.js → policy-from-catalog-lKL280I8.js} +7 -7
  173. package/dist/{policy-types-rNfz7t0M.d.ts → policy-types-CCBrL7me.d.ts} +14 -0
  174. package/dist/{postgrest-Cn0Res25.d.ts → postgrest-5WOO47Ud.d.ts} +2 -2
  175. package/dist/{powersync-C5_aFFaU.js → powersync-B6f4l8C1.js} +2 -2
  176. package/dist/{powersync-BUO5uQve.js → powersync-BUUqJfH2.js} +6 -6
  177. package/dist/powersync-D12Q6Chj.js +1 -0
  178. package/dist/prisma/index.d.ts +2 -2
  179. package/dist/{protected-action-E7Sdt_Dt.js → protected-action-BWvZjjyt.js} +83 -12
  180. package/dist/{protected-action-C4aj1KjO.d.ts → protected-action-DGuJNiMA.d.ts} +20 -8
  181. package/dist/provider-B085HEOf.js +12 -0
  182. package/dist/{provider-store-D4PU1my_.js → provider-store-BLd4UEmg.js} +4 -3
  183. package/dist/{provider-DKO9KHua.js → provider-with-DobrMx1N.js} +6 -6
  184. package/dist/{provider-B-1DlOGM.d.ts → provider-yIM04TwN.d.ts} +1 -1
  185. package/dist/{pull-BkT7tTKb.js → pull-4Yi8zYeU.js} +3 -3
  186. package/dist/pull-Dr6Bq5Jo.js +1 -0
  187. package/dist/{push-CEPcWdTJ.js → push-Dv1nfFPr.js} +3 -3
  188. package/dist/{pushed-policy-P55cJNx5.d.ts → pushed-policy-B2ZSpnRY.d.ts} +1 -1
  189. package/dist/{pushed-policy-Bi5-il4C.js → pushed-policy-DJoyBZsd.js} +2 -2
  190. package/dist/react/index.d.ts +7 -7
  191. package/dist/react/index.js +4 -4
  192. package/dist/react/lazy.d.ts +12 -0
  193. package/dist/react/lazy.js +36 -0
  194. package/dist/react/provider-client.d.ts +1 -1
  195. package/dist/react/provider-client.js +1 -1
  196. package/dist/react-native/index.d.ts +8 -8
  197. package/dist/react-native/index.js +7 -6
  198. package/dist/{replay-DKhFvt0L.d.ts → replay-CsErjiHt.d.ts} +1 -1
  199. package/dist/{request-context-5gl_oxO1.js → request-context-B_L4ev8L.js} +2 -2
  200. package/dist/resend/index.d.ts +4 -4
  201. package/dist/resend/index.js +2 -2
  202. package/dist/{resolve-names-bzYlAXRt.js → resolve-names-SGcLjtFc.js} +2 -2
  203. package/dist/{rls-v6V75yf_.js → rls-Df9NEWD3.js} +1 -1
  204. package/dist/{rls-DTf8X__h.js → rls-hmwRIS3-.js} +11 -11
  205. package/dist/{role-builder-boQiUvfo.js → role-builder-BXdhhQcB.js} +5 -3
  206. package/dist/row-pair-DglMdRFh.js +34 -0
  207. package/dist/{rpc-BqRiVpbP.d.ts → rpc-D3St8vPO.d.ts} +1 -1
  208. package/dist/{rpc-Dhi55Whd.js → rpc-DFtputZ1.js} +1 -1
  209. package/dist/{run-CgSQS9RF.js → run-BXmJIjRA.js} +2 -2
  210. package/dist/run-DnzrDgU-.js +1 -0
  211. package/dist/{run-ticket-Dulj4RQk.d.ts → run-ticket-zfABczfh.d.ts} +2 -2
  212. package/dist/{saas-DABv6vjy.js → saas-DIThcxbn.js} +5 -5
  213. package/dist/{scan-BY3Pp1PS.js → scan-BrTSlc_5.js} +1 -1
  214. package/dist/{schema-B_HsJKm2.js → schema-UOeI_LTB.js} +1 -1
  215. package/dist/scim/index.d.ts +1 -1
  216. package/dist/server/index.d.ts +11 -11
  217. package/dist/server/index.js +5 -5
  218. package/dist/{server-types--_Hann81.d.ts → server-types-CtJSDhOv.d.ts} +8 -8
  219. package/dist/{sink-Cs6z34AX.d.ts → sink-BskpqwLl.d.ts} +2 -2
  220. package/dist/{skills-Bj2wk38p.js → skills-BTVeFptV.js} +1 -1
  221. package/dist/{skills-Clo4qYLn.js → skills-CAgWKbDR.js} +1 -1
  222. package/dist/{snapshot-C2j96x97.js → snapshot-BcHYtUIg.js} +57 -7
  223. package/dist/{snapshot-cache-Cc7VNabe.d.ts → snapshot-cache-BnXMcJbK.d.ts} +1 -1
  224. package/dist/snapshot-empty-BoPBFoB8.js +17 -0
  225. package/dist/snapshot-evaluate-CwYVSUgO.js +501 -0
  226. package/dist/snapshot-reads-DOsTYC82.js +66 -0
  227. package/dist/solid/index.d.ts +5 -5
  228. package/dist/solid/index.js +2 -2
  229. package/dist/solid-start/index.d.ts +4 -4
  230. package/dist/solid-start/index.js +3 -3
  231. package/dist/{sources-CdYZBVcW.d.ts → sources-DhCtO9G8.d.ts} +1 -1
  232. package/dist/{src-BG9YJM3Q.js → src-BZKQe1lr.js} +13 -12
  233. package/dist/ssf/index.d.ts +3 -3
  234. package/dist/ssf/index.js +2 -2
  235. package/dist/{standard-webhooks-CJBgfl7y.d.ts → standard-webhooks-kQDkIPj3.d.ts} +2 -2
  236. package/dist/{store-BpKH-pLm.js → store-DXO0aVgf.js} +2 -2
  237. package/dist/{store-DSyjHD5-.d.ts → store-core-CDabEiO9.d.ts} +27 -6
  238. package/dist/{store-options-CXv6BHH6.js → store-options-COLWAd1K.js} +92 -12
  239. package/dist/{stores-BuqAHjp_.js → stores-DYxx75fk.js} +1 -1
  240. package/dist/{stores-C6-7TPTV.d.ts → stores-Mw_VAJ3B.d.ts} +5 -5
  241. package/dist/{subject-cache-d_Z4KAnm.d.ts → subject-cache-DrJGnRiV.d.ts} +1 -1
  242. package/dist/supabase/index.d.ts +6 -6
  243. package/dist/supabase/index.js +2 -2
  244. package/dist/supabase/middleware.d.ts +5 -5
  245. package/dist/supabase/middleware.js +5 -5
  246. package/dist/{supabase-DnazO6W4.js → supabase-BDr-fIHp.js} +1 -1
  247. package/dist/{supabase-CJv6K3iz.js → supabase-Bt8rb-ah.js} +2 -2
  248. package/dist/{supabase-hook-DLQMugW8.js → supabase-hook-Cb3UZpGC.js} +6 -5
  249. package/dist/supabase-hook-D1pwHu87.js +1 -0
  250. package/dist/{supautils-BHKsP7l-.js → supautils-CuR9rPsi.js} +8 -8
  251. package/dist/svelte/index.d.ts +5 -5
  252. package/dist/svelte/index.js +3 -3
  253. package/dist/svelte/runtime.d.ts +3 -3
  254. package/dist/svelte/runtime.js +1 -1
  255. package/dist/svelte/source.d.ts +5 -5
  256. package/dist/svelte/source.js +2 -2
  257. package/dist/sveltekit/index.d.ts +4 -4
  258. package/dist/sveltekit/index.js +2 -2
  259. package/dist/{tables-CbEOy2Ma.js → tables-Bl_ozD0k.js} +35 -13
  260. package/dist/tanstack-start/index.d.ts +4 -4
  261. package/dist/tanstack-start/index.js +2 -2
  262. package/dist/terminal/index.d.ts +5 -5
  263. package/dist/terminal/index.js +3 -3
  264. package/dist/testing/core.d.ts +1 -1
  265. package/dist/testing/core.js +1 -1
  266. package/dist/testing/fixtures/index.d.ts +3 -3
  267. package/dist/testing/fixtures/index.js +7 -1
  268. package/dist/testing/index.d.ts +23 -23
  269. package/dist/testing/index.js +47 -41
  270. package/dist/testing/saas/index.d.ts +3 -3
  271. package/dist/testing/saas/index.js +2 -2
  272. package/dist/testing/saas/permissions.js +1 -1
  273. package/dist/trpc/index.d.ts +5 -5
  274. package/dist/trpc/index.js +3 -3
  275. package/dist/{type-helpers-iXJEIDe7.d.ts → type-helpers-fQdBvtU0.d.ts} +1 -1
  276. package/dist/{types-BpxdxaRD.d.ts → types-BSGrzDPi.d.ts} +4 -4
  277. package/dist/{types-cNZhj0UF.d.ts → types-B_s1oQaF.d.ts} +2 -2
  278. package/dist/{types-ZfjQB0KC.d.ts → types-CAp7UGiB.d.ts} +1 -1
  279. package/dist/{types-CD1qmxdx.d.ts → types-CErg7ft6.d.ts} +3 -3
  280. package/dist/{types-_pi9kxS2.d.ts → types-CXUwgZ3d.d.ts} +2 -2
  281. package/dist/{types-C_a44wSr.d.ts → types-Cc68_zqR.d.ts} +2 -2
  282. package/dist/{types-Cq2rvv-C.d.ts → types-CdXM6qPc.d.ts} +2 -2
  283. package/dist/{types-BSNZMp5b.d.ts → types-ChYCRn7Y.d.ts} +1 -1
  284. package/dist/{types-CuDXvyIT.d.ts → types-DDlaFDM3.d.ts} +4 -4
  285. package/dist/{types-NikV1pND.d.ts → types-DM0o1YyJ.d.ts} +4 -4
  286. package/dist/{types-B9F0EZAF.d.ts → types-DyA4Loy4.d.ts} +3 -3
  287. package/dist/unplugin/index.d.ts +1 -1
  288. package/dist/unplugin/index.js +1 -1
  289. package/dist/{usage-DlOllyPi.js → usage-B6sQwycY.js} +4 -4
  290. package/dist/{usage-BUUXeKwk.js → usage-CNkKk27O.js} +1 -1
  291. package/dist/usage-Cem1FOeJ.js +1 -0
  292. package/dist/{validation-error-DLAYFlkr.d.ts → validation-error-BE8bpmhR.d.ts} +1 -1
  293. package/dist/{validity-Buc7w8E9.js → validity-IcjQSR7I.js} +1 -26
  294. package/dist/{verify-CfmvQjVw.js → verify-OtU4yCzg.js} +11 -11
  295. package/dist/{version-sources-BC3hf2ME.js → version-sources-BZ7V6Z8Z.js} +1 -1
  296. package/dist/{grantee-Dke-9rd1.js → vocabulary-BuYFWeCU.js} +1 -107
  297. package/dist/vue/index.d.ts +5 -5
  298. package/dist/vue/index.js +2 -2
  299. package/dist/{waiter-cbK1CBhT.d.ts → waiter-LdnPaBJE.d.ts} +2 -2
  300. package/dist/watch-B8F7Wgdy.js +1 -0
  301. package/dist/{watch-BigZ260i.js → watch-CR2ZIT_5.js} +1 -1
  302. package/dist/webmcp/index.d.ts +1 -1
  303. package/dist/{who-can-CjfMP9a4.js → who-can-DcrHB6ya.js} +2 -2
  304. package/dist/workflow/index.d.ts +3 -3
  305. package/dist/workflow/index.js +2 -2
  306. package/dist/workflow-sdk/index.d.ts +4 -4
  307. package/dist/{wrap-B-k2qHJx.d.ts → wrap-CVBPIuEs.d.ts} +2 -2
  308. package/package.json +8 -4
  309. package/schemas/supabase-manifest-v1.json +1 -1
  310. package/skills/permdock-wire/references/adapters.md +2 -0
  311. package/dist/catalog-C462QC3A.js +0 -1
  312. package/dist/collect-W9i7REKT.js +0 -1
  313. package/dist/from-snapshot-oR_N97dM.js +0 -927
  314. package/dist/powersync-DhspazC8.js +0 -1
  315. package/dist/pull-COPm1W-l.js +0 -1
  316. package/dist/run-ItR_bQGz.js +0 -1
  317. package/dist/supabase-hook-vZADjjfN.js +0 -1
  318. package/dist/usage-NmH5QXKC.js +0 -1
  319. package/dist/watch-CHURMgrv.js +0 -1
  320. package/dist/{connection-QFsv-kbh.js → connection-zoAgwdsD.js} +1 -1
  321. package/dist/{problem-BWP1l86g.js → problem-CPB8kqk7.js} +1 -1
  322. package/dist/{wrap-BKU5Arsu.js → wrap-C5PWzgkq.js} +1 -1
@@ -0,0 +1,501 @@
1
+ import { a as sole, t as compact } from "./compact-CAf557ZB.js";
2
+ import { n as freezeDeep } from "./freeze-jjan0lCv.js";
3
+ import { o as epochSeconds, t as INVALID_NOW } from "./time-nR1JesoH.js";
4
+ import { d as scopeList, l as scopeChain, r as findScope, t as activeFor, u as scopeIdOf } from "./scopes-gdH__vDZ.js";
5
+ import { a as readOnlyActorRefuses, n as coveredByDelegation, s as evaluateCondition } from "./delegation-CrdqnesZ.js";
6
+ import { t as requiresApproval } from "./approval-required-TzNB9oQA.js";
7
+ import { o as resourceRoleCondition } from "./grantee-conditions-Dzprappv.js";
8
+ import { n as matchGrantee } from "./grantee-match-CPQ9zV-H.js";
9
+ import { r as readWireValidity, t as isActive } from "./validity-IcjQSR7I.js";
10
+ import { t as grantCoversField } from "./fields-DlKwZYiy.js";
11
+ import { t as resourceIdOf } from "./resource-ref-CaS9yVPi.js";
12
+ import { n as rowIdOf, r as rowValues } from "./row-pair-DglMdRFh.js";
13
+ import { c as nowSeconds, f as rowInScope, n as inTeam, o as membershipField, r as isMembershipExpired, s as nestedAppliesWithoutRow } from "./tenancy-BlxY5T0q.js";
14
+ import { i as tokenPayload, n as decisionToken } from "./token-DaMnIU9O.js";
15
+ import { s as bindConditionRefs } from "./snapshot-BcHYtUIg.js";
16
+ //#region src/core/where-scope.ts
17
+ const ALWAYS = freezeDeep({
18
+ op: "eq",
19
+ field: "_",
20
+ value: true
21
+ });
22
+ function eq(field, value) {
23
+ return value === void 0 ? {
24
+ op: "or",
25
+ conditions: []
26
+ } : {
27
+ op: "eq",
28
+ field,
29
+ value
30
+ };
31
+ }
32
+ /**
33
+ * One equality per partitioning scope key on the membership's chain, outermost
34
+ * first.
35
+ */
36
+ function namedFilters(membership, scope) {
37
+ if (findScope(scope.scopes, membership.scope ?? "") === void 0 || !inTeam(membership, scope.scopes, scope.team) || !activeFor(membership, scope.scopes, scope.tenant) || membership.scope === void 0) return null;
38
+ const filters = [];
39
+ for (const name of scopeChain(scope.scopes, membership.scope).toReversed()) {
40
+ const key = scope.fieldOf(name);
41
+ if (key !== void 0 && scope.partitioned(name, key)) filters.push(eq(key, scopeIdOf(membership, name)));
42
+ }
43
+ return filters;
44
+ }
45
+ /**
46
+ * The row filters a grant's membership implies, or `null` when the grant
47
+ * reaches no row in this scope (another tenant, no active tenant, expired).
48
+ */
49
+ function scopeFilters(grant, scope) {
50
+ if (grant.scope === void 0) return [];
51
+ const membership = grant.membership;
52
+ if (membership === void 0 || isMembershipExpired(membership, scope.now)) return null;
53
+ if (typeof grant.scope === "string") return membership.scope === grant.scope ? namedFilters(membership, scope) : null;
54
+ const on = membership.on;
55
+ if (on === void 0) return null;
56
+ if (scope.resources === void 0) return on.resource === grant.scope.resource && on.resource === scope.resource ? [eq("id", on.id)] : null;
57
+ const roleResource = scope.resources.get(grant.scope.resource);
58
+ if (on.resource !== grant.scope.resource && membershipField(roleResource, on.resource, scope.resources) === void 0) return null;
59
+ const walked = scope.graph === true ? resourceRoleCondition(scope.resources.get(scope.resource), on.resource, [on.id], scope.resources) : void 0;
60
+ if (walked !== void 0) return [walked];
61
+ const field = membershipField(scope.resources.get(scope.resource), on.resource, scope.resources);
62
+ return field === void 0 ? null : [eq(field, on.id)];
63
+ }
64
+ function all(conditions) {
65
+ if (conditions.length === 0) return ALWAYS;
66
+ return sole(conditions) ?? {
67
+ op: "and",
68
+ conditions: [...conditions]
69
+ };
70
+ }
71
+ function scopedCondition(grant, scope) {
72
+ const filters = scopeFilters(grant, scope);
73
+ if (filters === null) return null;
74
+ const parts = grant.where === void 0 ? filters : [...filters, grant.where];
75
+ return parts.length === 0 ? "always" : all(parts);
76
+ }
77
+ /** Whether an unconditional `deny` removes every row `allow` could reach. */
78
+ function covers(deny, allow, scopes) {
79
+ if (deny.where !== void 0) return false;
80
+ const denied = deny.membership;
81
+ if (deny.scope === void 0 || denied === void 0) return deny.scope === void 0;
82
+ const allowed = allow.membership;
83
+ if (allowed === void 0) return false;
84
+ if (typeof deny.scope === "object") return typeof allow.scope === "object" && denied.on?.resource === allowed.on?.resource && denied.on?.id === allowed.on?.id;
85
+ if (typeof allow.scope !== "string" || allowed.scope === void 0) return false;
86
+ const chain = scopeChain(scopes, deny.scope);
87
+ return scopeChain(scopes, allowed.scope).includes(deny.scope) && chain.every((name) => scopeIdOf(allowed, name) === scopeIdOf(denied, name));
88
+ }
89
+ /**
90
+ * The portable filter for one permission's grants: allows OR together, each
91
+ * narrowed to its membership's tenant, team or resource; any applicable
92
+ * portable deny is subtracted, and an unconditional one empties the result.
93
+ */
94
+ function collect(grants, scope) {
95
+ const none = {
96
+ op: "or",
97
+ conditions: []
98
+ };
99
+ const partial = grants.some((grant) => grant.portable === false);
100
+ const denies = [];
101
+ for (const grant of grants) {
102
+ if (grant.effect !== "deny" || grant.portable === false || !isActive(readWireValidity(grant.validity, "deny"), scope.now)) continue;
103
+ const condition = scopedCondition(grant, scope);
104
+ if (condition === "always") return {
105
+ condition: none,
106
+ partial
107
+ };
108
+ if (condition !== null) denies.push({
109
+ grant,
110
+ condition
111
+ });
112
+ }
113
+ const parts = [];
114
+ for (const grant of grants) {
115
+ if (grant.effect !== "allow" || grant.portable === false || !isActive(readWireValidity(grant.validity), scope.now)) continue;
116
+ const condition = scopedCondition(grant, scope);
117
+ if (condition === null || denies.some((deny) => covers(deny.grant, grant, scope.scopes))) continue;
118
+ parts.push(all([...condition === "always" ? [] : [condition], ...denies.map((deny) => ({
119
+ op: "not",
120
+ condition: deny.condition
121
+ }))]));
122
+ }
123
+ if (parts.length === 0) return {
124
+ condition: none,
125
+ partial
126
+ };
127
+ return {
128
+ condition: sole(parts) ?? {
129
+ op: "or",
130
+ conditions: parts
131
+ },
132
+ partial
133
+ };
134
+ }
135
+ /**
136
+ * `collect`, with every subject ref bound to `scope.subject` and the subject
137
+ * attached (not enumerable) for `memberOf`, which needs its memberships.
138
+ */
139
+ function whereFromGrants(grants, scope) {
140
+ const { condition, partial } = collect(grants, scope);
141
+ const result = {
142
+ condition: bindConditionRefs(condition, scope.subject),
143
+ partial
144
+ };
145
+ Object.defineProperty(result, "subject", {
146
+ value: scope.subject,
147
+ enumerable: false
148
+ });
149
+ Object.defineProperty(result, "scopes", {
150
+ value: scope.scopes,
151
+ enumerable: false
152
+ });
153
+ if (scope.resources !== void 0) Object.defineProperty(result, "resources", {
154
+ value: scope.resources,
155
+ enumerable: false
156
+ });
157
+ return freezeDeep(result);
158
+ }
159
+ //#endregion
160
+ //#region src/core/snapshot-evaluate.ts
161
+ function coveredByInclude(snapshot, permission) {
162
+ const include = snapshot.include;
163
+ if (include === void 0 || include.length === 0) return true;
164
+ return include.some((prefix) => permission.key === prefix || permission.key.startsWith(`${prefix}.`) || permission.resource === prefix);
165
+ }
166
+ /**
167
+ * The field of `resource` that holds scope `name`'s id in a snapshot: its
168
+ * `fields` entry, else the scope's key.
169
+ */
170
+ function snapshotField(snapshot, name, resource) {
171
+ const entry = snapshot.scopes?.find((item) => item.name === name);
172
+ return entry?.fields?.[resource] ?? entry?.key;
173
+ }
174
+ function scopeOk(snapshot, grant, permission, subject, data, team, now, only) {
175
+ const scope = grant.scope;
176
+ if (scope === void 0) return { ok: true };
177
+ if (only !== void 0 && scope !== only) return {
178
+ ok: false,
179
+ reason: "scope"
180
+ };
181
+ const principal = subject.principal;
182
+ const membership = grant.membership;
183
+ if (principal === null || membership === void 0) return {
184
+ ok: false,
185
+ reason: "no-membership"
186
+ };
187
+ if (isMembershipExpired(membership, now)) return {
188
+ ok: false,
189
+ reason: "expired-membership"
190
+ };
191
+ if (typeof scope === "string") {
192
+ const scopes = scopeList(snapshot.scopes);
193
+ if (membership.scope !== scope || !scopes.some((entry) => entry.name === scope)) return {
194
+ ok: false,
195
+ reason: "scope"
196
+ };
197
+ if (!activeFor(membership, scopes, principal.tenant)) return {
198
+ ok: false,
199
+ reason: principal.tenant === void 0 && principal.unheldTenant === void 0 ? "no-tenant" : principal.tenant === void 0 ? "no-membership" : "tenant-mismatch"
200
+ };
201
+ if (!inTeam(membership, scopes, team)) return {
202
+ ok: false,
203
+ reason: "scope"
204
+ };
205
+ if (data === null || typeof data !== "object") return permission.kind !== "instance" || nestedAppliesWithoutRow(membership, scopes, data, team) ? { ok: true } : {
206
+ ok: false,
207
+ reason: "scope"
208
+ };
209
+ const partitioned = (name) => snapshot.scopes?.find((entry) => entry.name === name)?.resources?.includes(permission.resource) === true;
210
+ return rowInScope(membership, scopes, data, partitioned, (name) => snapshotField(snapshot, name, permission.resource));
211
+ }
212
+ const on = membership.on;
213
+ if (on === void 0 || on.resource !== scope.resource || on.resource !== permission.resource) return {
214
+ ok: false,
215
+ reason: "scope"
216
+ };
217
+ if (on.id !== rowIdOf(data, snapshot.ids?.[permission.resource])) return {
218
+ ok: false,
219
+ reason: "scope"
220
+ };
221
+ return { ok: true };
222
+ }
223
+ function conditionOk(grant, permission, current, next, subject, now, scopes) {
224
+ let opaqueReached = false;
225
+ const onOpaque = () => {
226
+ opaqueReached = true;
227
+ };
228
+ if (grant.portable === false) return {
229
+ matched: false,
230
+ reason: "opaque-condition"
231
+ };
232
+ const deny = grant.effect === "deny";
233
+ let whereMatched;
234
+ if (grant.where !== void 0) {
235
+ if (permission.kind === "collection" || current === void 0) return {
236
+ matched: false,
237
+ reason: "condition"
238
+ };
239
+ if (grant.where.op === "opaque" || grant.check?.op === "opaque") return {
240
+ matched: false,
241
+ reason: "opaque-condition"
242
+ };
243
+ whereMatched = evaluateCondition(grant.where, current, subject, now, scopes, void 0, onOpaque);
244
+ if (opaqueReached) return {
245
+ matched: false,
246
+ reason: "opaque-condition"
247
+ };
248
+ if (whereMatched && deny) return { matched: true };
249
+ if (!whereMatched && !deny) return {
250
+ matched: false,
251
+ reason: "condition"
252
+ };
253
+ }
254
+ const check = grant.check ?? (permission.action === "update" ? grant.where : void 0);
255
+ if (check === void 0 && whereMatched === false) return {
256
+ matched: false,
257
+ reason: "condition"
258
+ };
259
+ if (check !== void 0) {
260
+ if (check.op === "opaque") return {
261
+ matched: false,
262
+ reason: "opaque-condition"
263
+ };
264
+ if (next === void 0) return {
265
+ matched: false,
266
+ reason: "condition"
267
+ };
268
+ const matched = evaluateCondition(check, next, subject, now, scopes, void 0, onOpaque);
269
+ if (opaqueReached) return {
270
+ matched: false,
271
+ reason: "opaque-condition"
272
+ };
273
+ if (!matched) return {
274
+ matched: false,
275
+ reason: "condition"
276
+ };
277
+ }
278
+ return { matched: true };
279
+ }
280
+ function matchedOf(grant) {
281
+ return compact({
282
+ role: grant.role,
283
+ permission: grant.permission,
284
+ name: grant.name,
285
+ meta: grant.meta,
286
+ to: grant.to,
287
+ where: grant.where,
288
+ check: grant.check,
289
+ approval: grant.approval
290
+ });
291
+ }
292
+ function evaluateSnapshot(snapshot, subject, permission, data, team, options, outcomeOnly = false) {
293
+ let clock = options.now === void 0 ? void 0 : epochSeconds(options.now);
294
+ const now = () => clock ??= nowSeconds();
295
+ const tracer = options.explain === true ? {
296
+ evaluated: 0,
297
+ allows: [],
298
+ denies: [],
299
+ skipped: []
300
+ } : void 0;
301
+ const done = (raw) => {
302
+ if (outcomeOnly) return raw;
303
+ const decision = raw.outcome === "denied" ? {
304
+ ...raw,
305
+ permission: permission.key
306
+ } : raw;
307
+ return freezeDeep(tracer === void 0 ? decision : {
308
+ ...decision,
309
+ trace: {
310
+ evaluated: tracer.evaluated,
311
+ allows: tracer.allows,
312
+ denies: tracer.denies,
313
+ skipped: tracer.skipped
314
+ }
315
+ });
316
+ };
317
+ const skip = (grant, why) => {
318
+ tracer?.skipped.push({
319
+ role: grant.role,
320
+ permission: grant.permission,
321
+ effect: grant.effect,
322
+ why
323
+ });
324
+ };
325
+ if (!coveredByInclude(snapshot, permission)) return done({
326
+ outcome: "denied",
327
+ denials: [{
328
+ role: null,
329
+ reason: "opaque-condition"
330
+ }],
331
+ alternatives: []
332
+ });
333
+ if (clock !== void 0 && !Number.isFinite(clock)) return done({
334
+ outcome: "denied",
335
+ denials: [{
336
+ role: null,
337
+ reason: "validation",
338
+ detail: INVALID_NOW
339
+ }],
340
+ alternatives: []
341
+ });
342
+ const { current, next } = rowValues(permission, data);
343
+ const scopes = scopeList(snapshot.scopes);
344
+ const denials = [];
345
+ const allows = [];
346
+ for (const grant of snapshot.grants) {
347
+ if (grant.permission !== permission.key) continue;
348
+ if (tracer !== void 0) tracer.evaluated += 1;
349
+ const match = matchGrantee(grant.to, subject, now(), void 0, scopes, void 0, grant.effect === "deny");
350
+ if (!match.matched) {
351
+ denials.push(compact({
352
+ role: grant.role,
353
+ reason: match.reason ?? "no-grant",
354
+ to: grant.to
355
+ }));
356
+ continue;
357
+ }
358
+ let scoped = scopeOk(snapshot, grant, permission, subject, permission.kind === "instance" ? current : next, team, now(), options.scope);
359
+ if (scoped.ok !== (grant.effect === "deny") && permission.kind === "instance" && next !== current) scoped = scopeOk(snapshot, grant, permission, subject, next, team, now(), options.scope);
360
+ if (!scoped.ok) {
361
+ denials.push(compact({
362
+ role: grant.role,
363
+ reason: scoped.reason,
364
+ to: grant.to
365
+ }));
366
+ continue;
367
+ }
368
+ if (!isActive(readWireValidity(grant.validity, grant.effect), now())) {
369
+ if (grant.effect === "allow") denials.push({
370
+ role: grant.role,
371
+ reason: "inactive-grant",
372
+ detail: grant.validity
373
+ });
374
+ else skip(grant, "validity");
375
+ continue;
376
+ }
377
+ if (grant.effect === "deny" && grant.portable === false) {
378
+ if (!grantCoversField(grant.fields, options.field, grant.effect)) {
379
+ skip(grant, "field");
380
+ continue;
381
+ }
382
+ tracer?.denies.push(matchedOf(grant));
383
+ return done({
384
+ outcome: "denied",
385
+ denials: [{
386
+ role: grant.role,
387
+ reason: "opaque-condition"
388
+ }],
389
+ alternatives: []
390
+ });
391
+ }
392
+ const condition = conditionOk(grant, permission, current, next, subject, now(), scopes);
393
+ if (!condition.matched && grant.effect === "deny" && condition.reason === "opaque-condition" && grantCoversField(grant.fields, options.field, grant.effect)) {
394
+ tracer?.denies.push(matchedOf(grant));
395
+ return done({
396
+ outcome: "denied",
397
+ denials: [{
398
+ role: grant.role,
399
+ reason: "opaque-condition"
400
+ }],
401
+ alternatives: []
402
+ });
403
+ }
404
+ if (!condition.matched) {
405
+ denials.push({
406
+ role: grant.role,
407
+ reason: condition.reason ?? "condition"
408
+ });
409
+ continue;
410
+ }
411
+ if (!grantCoversField(grant.fields, options.field, grant.effect)) {
412
+ skip(grant, "field");
413
+ continue;
414
+ }
415
+ if (grant.effect === "deny") {
416
+ tracer?.denies.push(matchedOf(grant));
417
+ return done({
418
+ outcome: "denied",
419
+ denials: [{
420
+ role: grant.role,
421
+ reason: "deny"
422
+ }],
423
+ alternatives: []
424
+ });
425
+ }
426
+ tracer?.allows.push(matchedOf(grant));
427
+ allows.push(grant);
428
+ }
429
+ const [matched] = allows;
430
+ if (matched === void 0) {
431
+ for (const entry of snapshot.notEntitled ?? []) if (entry.permission === permission.key) denials.push({
432
+ role: entry.role,
433
+ reason: "not-entitled",
434
+ to: entry.to
435
+ });
436
+ return done({
437
+ outcome: "denied",
438
+ denials: denials.length > 0 ? denials : [{
439
+ role: null,
440
+ reason: subject.principal === null ? "anonymous" : "no-grant"
441
+ }],
442
+ alternatives: []
443
+ });
444
+ }
445
+ if (snapshot.delegated !== void 0 && !snapshot.delegated.includes(permission.key) || readOnlyActorRefuses(subject.actor, permission)) return done({
446
+ outcome: "denied",
447
+ denials: [{
448
+ role: null,
449
+ reason: "not-delegated"
450
+ }],
451
+ alternatives: []
452
+ });
453
+ const miss = coveredByDelegation(permission, subject.delegation, resourceIdOf(current), subject.actor !== void 0 && snapshot.delegated === void 0);
454
+ if (miss !== void 0) return done({
455
+ outcome: "denied",
456
+ denials: [{
457
+ role: null,
458
+ reason: miss
459
+ }],
460
+ alternatives: []
461
+ });
462
+ const resourceId = permission.kind === "collection" ? "*" : rowIdOf(current, snapshot.ids?.[permission.resource]);
463
+ const token = outcomeOnly ? "" : decisionToken({
464
+ key: permission.key,
465
+ resourceId,
466
+ principal: subject.principal,
467
+ actor: subject.actor,
468
+ source: `snapshot:${snapshot.issuedAt}`,
469
+ payload: tokenPayload(resourceId, next ?? current, options.args),
470
+ fingerprint: options.fingerprint
471
+ });
472
+ const grant = matchedOf(matched);
473
+ if (requiresApproval(matched.approval)) return done(compact({
474
+ outcome: "approval-required",
475
+ grant,
476
+ reason: "human",
477
+ token,
478
+ fingerprint: options.fingerprint
479
+ }));
480
+ return done(compact({
481
+ outcome: "granted",
482
+ subject,
483
+ matched: grant,
484
+ token,
485
+ obligations: matched.obligations
486
+ }));
487
+ }
488
+ function whereFromSnapshot(snapshot, subject, permission, team) {
489
+ return whereFromGrants(snapshot.grants.filter((grant) => grant.permission === permission.key), {
490
+ resource: permission.resource,
491
+ scopes: scopeList(snapshot.scopes),
492
+ partitioned: (name) => snapshot.scopes?.find((entry) => entry.name === name)?.resources?.includes(permission.resource) === true,
493
+ fieldOf: (name) => snapshotField(snapshot, name, permission.resource),
494
+ tenant: subject.principal?.tenant,
495
+ team,
496
+ now: nowSeconds(),
497
+ subject
498
+ });
499
+ }
500
+ //#endregion
501
+ export { whereFromSnapshot as n, whereFromGrants as r, evaluateSnapshot as t };
@@ -0,0 +1,66 @@
1
+ import { t as compact } from "./compact-CAf557ZB.js";
2
+ import { l as synthesiseRole, r as findRole, s as listRoles } from "./vocabulary-BuYFWeCU.js";
3
+ import { d as scopeList } from "./scopes-gdH__vDZ.js";
4
+ import { a as heldRoleNames } from "./snapshot-BcHYtUIg.js";
5
+ import { t as filterMemberships } from "./membership-filter-CfLdP_F9.js";
6
+ //#region src/core/snapshot-reads.ts
7
+ function assignableEntry(snapshot, tenant) {
8
+ if (tenant === void 0) return;
9
+ return snapshot.assignable?.find((entry) => entry.tenant === tenant);
10
+ }
11
+ /**
12
+ * The members of a snapshot instance that only read the snapshot: memberships,
13
+ * tenants, held roles, audiences and what the subject may hand out. A client
14
+ * reads them without the evaluator.
15
+ */
16
+ function snapshotReads(snapshot, subject) {
17
+ return {
18
+ memberships(filter) {
19
+ return filterMemberships(subject.principal?.memberships ?? [], filter);
20
+ },
21
+ tenants() {
22
+ return snapshot.tenants;
23
+ },
24
+ heldRoles(query) {
25
+ const names = heldRoleNames(subject, query?.tenant ?? subject.principal?.tenant, scopeList(snapshot.scopes), compact({
26
+ scope: query?.scope,
27
+ id: query?.id,
28
+ rank: snapshot.roles
29
+ }));
30
+ const tree = snapshot.vocabulary?.roles;
31
+ return names.map((name) => findRole(tree, name) ?? synthesiseRole(name));
32
+ },
33
+ audiences() {
34
+ const tenant = subject.principal?.tenant;
35
+ if (tenant === snapshot.subject.principal?.tenant) return snapshot.audiences ?? [];
36
+ const tree = snapshot.vocabulary?.roles;
37
+ const out = [];
38
+ for (const name of heldRoleNames(subject, tenant, scopeList(snapshot.scopes), { rank: snapshot.roles })) {
39
+ const audience = findRole(tree, name)?.meta.audience;
40
+ if (typeof audience === "string" && !out.includes(audience)) out.push(audience);
41
+ }
42
+ return out;
43
+ },
44
+ assignableRoles(query) {
45
+ if (query?.scope === "global") return [];
46
+ const tenant = query?.tenant ?? subject.principal?.tenant;
47
+ const tree = snapshot.vocabulary?.roles;
48
+ if (snapshot.assignable !== void 0) return (assignableEntry(snapshot, tenant)?.roles ?? []).map((name) => findRole(tree, name) ?? synthesiseRole(name, { assignable: true }));
49
+ const names = new Set(heldRoleNames(subject, tenant, scopeList(snapshot.scopes)));
50
+ return listRoles(tree).filter((leaf) => leaf.assignable && names.has(leaf.key));
51
+ },
52
+ assignablePermissions(query) {
53
+ if (query?.scope === "global") return [];
54
+ return assignableEntry(snapshot, query?.tenant ?? subject.principal?.tenant)?.permissions ?? [];
55
+ },
56
+ assignableLevels(permission, query) {
57
+ if (query?.scope === "global") return [];
58
+ const levels = assignableEntry(snapshot, query?.tenant ?? subject.principal?.tenant)?.levels;
59
+ if (levels === void 0 || !Object.hasOwn(levels, permission.key)) return [];
60
+ const names = levels[permission.key];
61
+ return Array.isArray(names) ? names.filter((name) => typeof name === "string") : [];
62
+ }
63
+ };
64
+ }
65
+ //#endregion
66
+ export { snapshotReads as t };
@@ -1,10 +1,10 @@
1
- import { Jn as ApprovalRequiredDecision, N as PolicyVocabulary, Yn as Decision, en as Snapshot, tr as GrantedDecision, vr as Membership, vt as TokenVerifier } from "../policy-types-rNfz7t0M.js";
1
+ import { Jn as ApprovalRequiredDecision, N as PolicyVocabulary, Yn as Decision, en as Snapshot, tr as GrantedDecision, vr as Membership, vt as TokenVerifier } from "../policy-types-CCBrL7me.js";
2
2
  import { r as Role, w as Permission } from "../vocabulary-DeZvUaTw.js";
3
- import { d as UncheckedData, s as RowData } from "../permdock-BaB-KQqn.js";
4
- import { c as requiredPlans } from "../errors-D_JIQJYb.js";
5
- import { i as describe, r as DescribeOptions, t as DecisionDescription } from "../describe-DVobr5FX.js";
3
+ import { d as UncheckedData, s as RowData } from "../permdock-vD3mwLSm.js";
4
+ import { c as requiredPlans } from "../errors-CXxQwtbZ.js";
5
+ import { i as describe, r as DescribeOptions, t as DecisionDescription } from "../describe-CazEjtOH.js";
6
6
  import { t as PermissionBoundaryState } from "../boundary-C9ck-3uK.js";
7
- import { _ as TenantView, a as ClientPermDock, c as GateMode, d as PermissionState, g as SubjectView, h as RolesOptions, i as ApprovalState, l as GateView, m as ProviderOptionsBase, o as ClientStatus, p as ProtectedActionView, r as ApprovalHandle, s as FilterResult, u as PermissionSet, v as ActionResult, y as ProtectedAction } from "../store-DSyjHD5-.js";
7
+ import { _ as SubjectView, a as ClientPermDock, b as ProtectedAction, c as GateMode, d as PermissionSet, f as PermissionState, g as RolesOptions, h as ProviderOptionsBase, 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-CDabEiO9.js";
8
8
  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-L9UOwATg.js";
9
9
  import { t as approvalHeaders } from "../headers-B9jQxjtW.js";
10
10
  import { Accessor, Accessor as Accessor$1, JSX } from "solid-js";
@@ -4,8 +4,8 @@ import { n as describe } from "../describe-BZAlPHxT.js";
4
4
  import { n as boundaryFallback, t as boundaryDigest } from "../boundary-BV3O1eud.js";
5
5
  import { n as actionRunner, r as approvalHeaders, t as actionApproval } from "../protected-action-OpOxtTsN.js";
6
6
  import { a as livePermDock, c as rolesView, d as subjectView, f as tenantView, i as gateView, l as scopedTenant, n as describeWith, o as permissionSet, r as filterResult, s as protectedView, t as approvalHandle, u as slotContent } from "../views-MWmJ6Y4P.js";
7
- import { a as eventSourceRefresh, i as broadcastChannelRefresh, l as isPromiseLike, o as focusRefresh, r as authzChangeRefresh, s as visibilityRefresh } from "../store-options-CXv6BHH6.js";
8
- import { n as switchTenant, t as providerStore } from "../provider-store-D4PU1my_.js";
7
+ import { a as eventSourceRefresh, i as broadcastChannelRefresh, l as isPromiseLike, o as focusRefresh, r as authzChangeRefresh, s as visibilityRefresh } from "../store-options-COLWAd1K.js";
8
+ import { n as switchTenant, t as providerStore } from "../provider-store-BLd4UEmg.js";
9
9
  import { ErrorBoundary, createComponent, createComputed, createContext, createMemo, createSignal, getOwner, on, onCleanup, useContext } from "solid-js";
10
10
  //#region src/solid/context.ts
11
11
  const PermDockContext = createContext(void 0);
@@ -1,9 +1,9 @@
1
- import { D as Policy, N as PolicyVocabulary, en as Snapshot, yr as Principal } from "../policy-types-rNfz7t0M.js";
1
+ import { D as Policy, N as PolicyVocabulary, en as Snapshot, yr as Principal } from "../policy-types-CCBrL7me.js";
2
2
  import { w as Permission } from "../vocabulary-DeZvUaTw.js";
3
3
  import { a as OperationInput, t as Operation } from "../operations-BMPx7HyO.js";
4
- import { a as PermDock } from "../permdock-BaB-KQqn.js";
5
- import { D as ConnectionOptions, T as Connection, f as InvalidSignatureError, i as OpenApiHooks, o as ProtectOptions, u as SnapshotQuery, v as discoverViaSignatureAgent, x as webBotAuthVerifier } from "../server-types--_Hann81.js";
6
- import { a as ProtectTarget, n as FetchAdapterOptions, t as ContextReader } from "../fetch-adapter-DxqsIXSO.js";
4
+ import { a as PermDock } from "../permdock-vD3mwLSm.js";
5
+ import { D as ConnectionOptions, T as Connection, f as InvalidSignatureError, i as OpenApiHooks, o as ProtectOptions, u as SnapshotQuery, v as discoverViaSignatureAgent, x as webBotAuthVerifier } from "../server-types-CtJSDhOv.js";
6
+ import { a as ProtectTarget, n as FetchAdapterOptions, t as ContextReader } from "../fetch-adapter-eQ-mdk8n.js";
7
7
  import { APIEvent, FetchEvent } from "@solidjs/start/server";
8
8
  //#region src/solid-start/create.d.ts
9
9
  /** The h3 event under every SolidStart request; `subject` and `scope` read it. */
@@ -1,6 +1,6 @@
1
- import { f as InvalidSignatureError, g as webBotAuthVerifier, p as discoverViaSignatureAgent } from "../evaluations-BzTDWO4m.js";
2
- import { i as decorate } from "../bind-B4Z0U2Gr.js";
3
- import { n as guardedRoute, t as fetchAdapter } from "../fetch-adapter-MoYZ-vF5.js";
1
+ import { f as InvalidSignatureError, g as webBotAuthVerifier, p as discoverViaSignatureAgent } from "../evaluations-Bj5xw0EM.js";
2
+ import { i as decorate } from "../bind-Cx10JuJ-.js";
3
+ import { n as guardedRoute, t as fetchAdapter } from "../fetch-adapter-CAA3VJMX.js";
4
4
  //#region src/solid-start/create.ts
5
5
  /**
6
6
  * `event.locals`. Its type, `App.RequestEventLocals`, is declared by
@@ -1,4 +1,4 @@
1
- import { it as MembershipSource, sn as AuthEvent, yr as Principal } from "./policy-types-rNfz7t0M.js";
1
+ import { it as MembershipSource, sn as AuthEvent, yr as Principal } from "./policy-types-CCBrL7me.js";
2
2
  import { t as ClaimsMap } from "./claims-map-D1Pb5oRq.js";
3
3
  import { t as ClientNames } from "./clients-C_NOET3z.js";
4
4
  import { c as SupabaseManifestMembership } from "./manifest-C6eFl3Vo.js";
@@ -1,31 +1,32 @@
1
1
  import { n as isReadonlyArray, r as isRecord, t as compact } from "./compact-CAf557ZB.js";
2
2
  import { n as freezeDeep } from "./freeze-jjan0lCv.js";
3
3
  import { r as ownGet } from "./paths-CUvURzHp.js";
4
- import { d as assertSqlFunctionArg, f as assertSqlFunctionName, l as normalizeWhere, p as assertSqlFunctionSet, u as assertPortableTwin } from "./role-builder-boQiUvfo.js";
5
- import { n as PermDockDeniedError } from "./errors-ynga1EQy.js";
4
+ import { d as assertSqlFunctionArg, f as assertSqlFunctionName, l as normalizeWhere, p as assertSqlFunctionSet, u as assertPortableTwin } from "./role-builder-BXdhhQcB.js";
6
5
  import { c as listPermissions, i as getRegistry, n as findPermission } from "./permission-registry-B8tYxPIt.js";
7
6
  import { n as isThenable } from "./thenable-BNSM1U2R.js";
8
7
  import { c as isEdgeRelation, m as restrictedStops, o as groupEntries, s as isComputedRelation, u as isPrincipalRelation } from "./resource-relations-8-pCScBO.js";
9
- import { _ as listPlans, a as authenticated, m as findRole, o as flattenGrantee } from "./grantee-Dke-9rd1.js";
8
+ import { o as listPlans, r as findRole } from "./vocabulary-BuYFWeCU.js";
9
+ import { a as authenticated, o as flattenGrantee } from "./grantee-OG4klcNr.js";
10
10
  import { a as durationOf, f as nowMillis, g as secondsOf, p as nowSeconds } from "./time-nR1JesoH.js";
11
11
  import { i as sameId } from "./ids-DzhJaCUj.js";
12
12
  import { a as normalizeMembership$1, c as rootScope, d as scopeList, l as scopeChain, o as normalizeMemberships$1, p as tenantOf, s as resolveScope$1, u as scopeIdOf } from "./scopes-gdH__vDZ.js";
13
- import { t as evaluateCondition } from "./condition-evaluate-bVVRSdzq.js";
13
+ import { s as evaluateCondition } from "./delegation-CrdqnesZ.js";
14
14
  import { m as tenantsOf, r as isMembershipExpired } from "./tenancy-BlxY5T0q.js";
15
15
  import { t as canonicalJson } from "./canonical-json-DwilZ1iB.js";
16
- import { i as snapshotGrant, r as plainPermission, t as buildSnapshot } from "./snapshot-C2j96x97.js";
17
- import { r as resolveSubject } from "./permdock-B5LyNVgn.js";
16
+ import { i as snapshotGrant, r as plainPermission, t as buildSnapshot } from "./snapshot-BcHYtUIg.js";
17
+ import { r as resolveSubject } from "./permdock-HfTF99xX.js";
18
+ import { n as PermDockDeniedError } from "./errors-ynga1EQy.js";
18
19
  import { n as internalsOf } from "./internals-B3IgHrvo.js";
19
- import { a as normalizeApproval, r as assertApprovalRelations } from "./approval-normalize-DNLW0zOM.js";
20
- import { c as levelNames, i as grantList, n as declaredRoleNames } from "./policy-wGzbAPQF.js";
21
- import { o as isPortableCondition } from "./hosted-C5I2TSXm.js";
20
+ import { a as normalizeApproval, r as assertApprovalRelations } from "./approval-normalize-KfhzpD93.js";
21
+ import { c as levelNames, i as grantList, n as declaredRoleNames } from "./policy-BovcTojN.js";
22
+ import { o as isPortableCondition } from "./hosted-cPDyrlsQ.js";
22
23
  import { n as isOperationRisk } from "./operation-risks-BKOcTv8J.js";
23
24
  import { n as isOperationEffect } from "./operations-Bm9HFecz.js";
24
- import { C as tenantCustomRoles, S as roleAllowKeys, f as customRoleId, l as ceilingGrants, m as customRoleScope, p as customRoleOf, x as resolveCustomRole } from "./evaluate-B5yZHmts.js";
25
- import { a as heldLevels, f as bindingOf, h as usesAssigns, m as roleMeta, n as snapshotScopes, o as collectSnapshotGrants, p as rankRoles, r as assignableCandidates, t as snapshotOf } from "./instance-snapshot-D_dGTq--.js";
25
+ import { C as tenantCustomRoles, S as roleAllowKeys, f as customRoleId, l as ceilingGrants, m as customRoleScope, p as customRoleOf, x as resolveCustomRole } from "./evaluate-_JdlbJ32.js";
26
+ import { a as heldLevels, f as bindingOf, h as usesAssigns, m as roleMeta, n as snapshotScopes, o as collectSnapshotGrants, p as rankRoles, r as assignableCandidates, t as snapshotOf } from "./instance-snapshot-LPNBG9np.js";
26
27
  import { n as relationId } from "./relations-CMsJ1ARY.js";
27
28
  import { n as LOCAL_CUSTOM_ROLE } from "./parse-local-manifest-Ce2N-Opr.js";
28
- import { n as wrapPermDock } from "./wrap-BKU5Arsu.js";
29
+ import { n as wrapPermDock } from "./wrap-C5PWzgkq.js";
29
30
  //#region src/conditions/sql-function.ts
30
31
  function sqlFunction(name, options) {
31
32
  assertSqlFunctionName(name);