permdock 0.21.0 → 0.22.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 (359) hide show
  1. package/README.md +2 -1
  2. package/dist/a2a/index.d.ts +5 -5
  3. package/dist/a2a/index.js +5 -4
  4. package/dist/{adoption-scan-UkQisAqe.js → adoption-scan-_bHLMnVQ.js} +1 -1
  5. package/dist/agent/index.d.ts +2 -2
  6. package/dist/agent/index.js +1 -1
  7. package/dist/ai-sdk/index.d.ts +4 -4
  8. package/dist/ai-sdk/index.js +3 -3
  9. package/dist/app/index.d.ts +85 -0
  10. package/dist/app/index.js +91 -0
  11. package/dist/app-DIvM65Mv.js +24 -0
  12. package/dist/{approval-policies-CKlByf5o.d.ts → approval-policies-UnDSxT__.d.ts} +2 -2
  13. package/dist/{approval-prompt-CQFiO1KE.d.ts → approval-prompt-2hTqo6IM.d.ts} +2 -2
  14. package/dist/approvals/index.d.ts +3 -3
  15. package/dist/approvals/index.js +3 -3
  16. package/dist/{approvals-CuXILe52.js → approvals-B_sn4Wrn.js} +6 -6
  17. package/dist/{arazzo-CUthH61H.js → arazzo-BXD-VJU_.js} +1 -1
  18. package/dist/{arazzo-BC3uLIZy.js → arazzo-Ct0PGblq.js} +3 -3
  19. package/dist/astro/index.d.ts +6 -6
  20. package/dist/astro/index.js +2 -2
  21. package/dist/{audience-BUonniPx.js → audience-5Xx1hdIv.js} +1 -1
  22. package/dist/{auth-j3Eu-j4h.js → auth-BxXHxWRy.js} +1 -1
  23. package/dist/authzen/index.d.ts +5 -5
  24. package/dist/authzen/index.js +4 -4
  25. package/dist/{automation-CpOk7Tlu.d.ts → automation-B20_8UoT.d.ts} +3 -3
  26. package/dist/{automation-x3KEUusw.js → automation-BueW05db.js} +2 -2
  27. package/dist/better-auth/index.d.ts +2 -2
  28. package/dist/better-auth/index.js +1 -1
  29. package/dist/better-supabase/index.d.ts +113 -56
  30. package/dist/better-supabase/index.js +200 -62
  31. package/dist/better-supabase-DF8f8oly.js +194 -0
  32. package/dist/{bind-CJf7S-Jd.js → bind-B4Z0U2Gr.js} +5 -5
  33. package/dist/{bind-XvnD_SUz.d.ts → bind-CnOMjazH.d.ts} +7 -7
  34. package/dist/{build-instance-CkRKgjSj.js → build-instance-B0vsViF5.js} +3 -25
  35. package/dist/{capability-zN6T9fxe.js → capability-CenWwTMR.js} +1 -1
  36. package/dist/{capability-v2xZB7us.d.ts → capability-YkRMUAsF.d.ts} +2 -2
  37. package/dist/{casbin-BOZN1P2Y.js → casbin-D5evU3lX.js} +1 -1
  38. package/dist/{casbin-v9Xo_XPa.js → casbin-imBS3UIf.js} +1 -1
  39. package/dist/catalog/index.d.ts +5 -5
  40. package/dist/catalog/index.js +5 -5
  41. package/dist/catalog-C462QC3A.js +1 -0
  42. package/dist/{catalog-DjDc87R2.js → catalog-CoyKnU5c.js} +1 -1
  43. package/dist/{catalog-s0waIrfY.js → catalog-Y4CjN8NA.js} +4 -4
  44. package/dist/{catalog-operations-BD22drQf.js → catalog-operations-Do1eD-Rt.js} +1 -1
  45. package/dist/{challenge-DbkpCx_v.js → challenge-B__LcNve.js} +3 -3
  46. package/dist/chat/index.d.ts +1 -1
  47. package/dist/chat/index.js +3 -2
  48. package/dist/chat-sdk/index.d.ts +3 -3
  49. package/dist/claude-agent/index.d.ts +3 -3
  50. package/dist/claude-agent/index.js +2 -2
  51. package/dist/clerk/index.d.ts +3 -3
  52. package/dist/cli/bin.js +1 -1
  53. package/dist/cli/index.d.ts +8 -7
  54. package/dist/cli/index.js +3 -3
  55. package/dist/cloud/index.d.ts +8 -8
  56. package/dist/cloud/index.js +3 -3
  57. package/dist/{cloud-CB0btByh.js → cloud-DWCeStPH.js} +2 -2
  58. package/dist/{codemod-C3a3Iz_w.js → codemod-B7QKJ_ak.js} +2 -2
  59. package/dist/{codemod-B-duJDFD.js → codemod-BaPmaCYQ.js} +13 -6
  60. package/dist/{collect-DN_x7hvV.js → collect-Cr71JA7z.js} +8 -7
  61. package/dist/{collect-DMQ6Sxr6.js → collect-ScSG05VJ.js} +2 -2
  62. package/dist/collect-W9i7REKT.js +1 -0
  63. package/dist/compile/index.d.ts +1 -1
  64. package/dist/compile/index.js +1 -1
  65. package/dist/{compile-B_oJqmIg.js → compile-Cvru58id.js} +2 -2
  66. package/dist/{compile-DonvwG9x.d.ts → compile-DC-BrhH1.d.ts} +3 -3
  67. package/dist/{completion-6IshPaPd.js → completion-DOUMyCwa.js} +1 -1
  68. package/dist/{delegation-aK4T_5WU.js → condition-evaluate-bVVRSdzq.js} +159 -159
  69. package/dist/{config-C45X7mpm.js → config-DRp-E8Ly.js} +1 -1
  70. package/dist/{config-D2oXUwos.js → config-DyNanTjZ.js} +10 -8
  71. package/dist/{config-report-Bmo62RRr.js → config-report-Bh_nLdAE.js} +2 -2
  72. package/dist/{config-shape-D9paLhEX.js → config-shape-C4zqzG2K.js} +9 -2
  73. package/dist/{context-YhyXyqBI.js → context-Cem4QafV.js} +2 -2
  74. package/dist/convex/index.d.ts +5 -5
  75. package/dist/convex/index.js +2 -2
  76. package/dist/{core-Dxkwz4xR.js → core-CUjhfz0W.js} +6 -6
  77. package/dist/{core-9KbhurkH.d.ts → core-D2JNg5jA.d.ts} +3 -3
  78. package/dist/coverage-D8jBJdgD.d.ts +114 -0
  79. package/dist/coverage-Dh2W_DmF.js +211 -0
  80. package/dist/{create-DH4ZD0A7.d.ts → create-B2tdOygC.d.ts} +7 -7
  81. package/dist/{create-Q0wF9Elt.js → create-BJ2_8NDO.js} +5 -5
  82. package/dist/{create-BRiRVNUO.js → create-BsL5lCWR.js} +8 -7
  83. package/dist/{create-BzgDDamI.d.ts → create-CPDSbK1a.d.ts} +5 -5
  84. package/dist/{create-BQOQkYYg.d.ts → create-oMCcZV4X.d.ts} +9 -9
  85. package/dist/{credential-B3Hj4puZ.js → credential-Bap3HClV.js} +4 -4
  86. package/dist/{server-D0PW6ZCw.js → credentials-BXV0oz56.js} +3 -146
  87. package/dist/credentials-DPX140fN.d.ts +125 -0
  88. package/dist/delivery/index.d.ts +4 -4
  89. package/dist/delivery/index.js +1 -1
  90. package/dist/{denied-text-De8cw3MW.d.ts → denied-text-BXQkWU7d.d.ts} +2 -2
  91. package/dist/{describe-DibQM6g-.d.ts → describe-DVobr5FX.d.ts} +2 -2
  92. package/dist/{diff-BJv7I3GR.js → diff-BR9JArxz.js} +6 -6
  93. package/dist/{diff-3fpwo3UD.js → diff-Jc_kbDz-.js} +1 -1
  94. package/dist/{doctor-Bz7s3JYD.js → doctor-BBMW5ZT_.js} +310 -36
  95. package/dist/{doctor-keoa9DpH.js → doctor-DhqSiPkq.js} +3 -3
  96. package/dist/drizzle/index.d.ts +3 -3
  97. package/dist/drizzle/index.js +1 -1
  98. package/dist/elysia/index.d.ts +5 -5
  99. package/dist/elysia/index.js +3 -3
  100. package/dist/{errors-OTE9u4Wk.d.ts → errors-D_JIQJYb.d.ts} +1 -1
  101. package/dist/{evaluate-Dcq_U2TV.js → evaluate-B5yZHmts.js} +16 -16
  102. package/dist/{evaluations-CNMVJVD6.js → evaluations-BzTDWO4m.js} +57 -57
  103. package/dist/{evaluations-OCm_Z-8V.d.ts → evaluations-DQYfh4Jh.d.ts} +3 -3
  104. package/dist/eve/index.d.ts +5 -5
  105. package/dist/eve/index.js +3 -3
  106. package/dist/express/index.d.ts +5 -5
  107. package/dist/express/index.js +3 -3
  108. package/dist/fastify/index.d.ts +5 -5
  109. package/dist/fastify/index.js +3 -3
  110. package/dist/{fetch-adapter-BlL-ZhHq.d.ts → fetch-adapter-DxqsIXSO.d.ts} +4 -4
  111. package/dist/{fetch-adapter-4EB3cLgB.js → fetch-adapter-MoYZ-vF5.js} +3 -3
  112. package/dist/{fields-D_TfExiI.js → fields-CVyOk-f1.js} +2 -2
  113. package/dist/{fixtures-Cemqurt8.js → fixtures-BVZc7OCF.js} +1 -1
  114. package/dist/{from-snapshot-DHnb8Fh4.js → from-snapshot-oR_N97dM.js} +346 -14
  115. package/dist/{gen-DYF4LKUP.js → gen-DXXoFjyf.js} +1 -1
  116. package/dist/{gen-Cf7nQsOb.js → gen-WdycZ_-b.js} +5 -5
  117. package/dist/{grantee-conditions-DX4K_gGI.js → grantee-conditions-Dzprappv.js} +1 -1
  118. package/dist/{grantee-match-BP-k4vRJ.js → grantee-match-8J2y60MF.js} +3 -3
  119. package/dist/h3/index.d.ts +4 -4
  120. package/dist/h3/index.js +3 -3
  121. package/dist/{helpers-D-MXwkOF.js → helpers-DzBIfL1N.js} +25 -25
  122. package/dist/hono/index.d.ts +5 -5
  123. package/dist/hono/index.js +3 -3
  124. package/dist/{hosted-C2Pmhy2x.js → hosted-C5I2TSXm.js} +4 -4
  125. package/dist/{hosted-yhyAuQkL.d.ts → hosted-DXq1plaP.d.ts} +1 -1
  126. package/dist/{http-DhMWeB_h.js → http-dptLQzPP.js} +1 -1
  127. package/dist/{expiry-6XByK0dm.js → ids-DzhJaCUj.js} +23 -23
  128. package/dist/{import-CQ_kH_Ny.js → import-BE5sDazm.js} +2 -2
  129. package/dist/{import-C2ExjVvv.js → import-CvXswHDy.js} +2 -2
  130. package/dist/index-BcS8c_2S.d.ts +101 -0
  131. package/dist/{index--AwSBzJC.d.ts → index-BdZpqhJK.d.ts} +2 -2
  132. package/dist/{index-CLbGOPBr.d.ts → index-C-R8lBPb.d.ts} +3 -3
  133. package/dist/{index-Do7FqHEr.d.ts → index-C_8uxAlv.d.ts} +5 -5
  134. package/dist/{index-tuR-kZoJ.d.ts → index-Cjfa1Uwr.d.ts} +21 -40
  135. package/dist/{index-BqzpT-90.d.ts → index-iIsqXFVu.d.ts} +6 -6
  136. package/dist/index.d.ts +19 -20
  137. package/dist/index.js +25 -24
  138. package/dist/{init-kTFkEu8S.js → init-B_S8Xdz1.js} +4 -4
  139. package/dist/{init-DvkvbvZ_.js → init-CqGHcvyR.js} +2 -2
  140. package/dist/{instance-options-Cq66kEeR.d.ts → instance-options-C6gEDOts.d.ts} +1 -1
  141. package/dist/instance-options-URVwqpMW.js +24 -0
  142. package/dist/{instance-snapshot-Bi4-dJk0.js → instance-snapshot-D_dGTq--.js} +9 -9
  143. package/dist/jwt/index.d.ts +4 -4
  144. package/dist/jwt/index.js +2 -2
  145. package/dist/{kernel-CLEzDmbv.js → kernel-NmxiWII2.js} +8 -8
  146. package/dist/kysely/index.d.ts +3 -3
  147. package/dist/kysely/index.js +1 -1
  148. package/dist/limits-CAhpRrhk.js +167 -0
  149. package/dist/{load-BaEamml-.js → load-C4p4VgwR.js} +2 -2
  150. package/dist/load-DiBUJx77.js +1 -0
  151. package/dist/{login-9ycIcJZH.js → login-CzwlsBEO.js} +4 -4
  152. package/dist/{login-CM_etiLM.js → login-DoLxv1s5.js} +3 -3
  153. package/dist/{manifest-CCd-xrM3.js → manifest-BAf7cgRx.js} +35 -35
  154. package/dist/{map-claims-PQwHynxV.js → map-claims-CAa_bQt9.js} +1 -1
  155. package/dist/{map-error-EOhahOVA.js → map-error-p4ROJ_26.js} +1 -1
  156. package/dist/mcp/index.d.ts +9 -9
  157. package/dist/mcp/index.js +9 -8
  158. package/dist/{migrate-CkLHdwuH.js → migrate-DVsxeE0y.js} +1 -1
  159. package/dist/{module-values-BYuNtdK5.js → module-values-BLiVlO1X.js} +3 -3
  160. package/dist/nest/index.d.ts +5 -5
  161. package/dist/nest/index.js +3 -3
  162. package/dist/next/index.d.ts +43 -17
  163. package/dist/next/index.js +54 -21
  164. package/dist/next/plugin.d.ts +1 -1
  165. package/dist/next/plugin.js +1 -1
  166. package/dist/node/index.d.ts +5 -5
  167. package/dist/node/index.js +2 -2
  168. package/dist/openai/index.d.ts +5 -5
  169. package/dist/openai/index.js +3 -3
  170. package/dist/openapi/index.d.ts +5 -59
  171. package/dist/openapi/index.js +3 -2
  172. package/dist/{openapi-BOsx0xn9.js → openapi-Cc-aS9xC.js} +6 -135
  173. package/dist/{openapi-QnnU2A1c.js → openapi-DroBcLJZ.js} +2 -2
  174. package/dist/{openapi-DA7FVG2F.js → openapi-EmvKwuWj.js} +4 -4
  175. package/dist/{operations-Ci_rT6Uo.d.ts → operations-BMPx7HyO.d.ts} +1 -1
  176. package/dist/optional-8TKc-0j4.js +47 -0
  177. package/dist/orpc/index.d.ts +7 -7
  178. package/dist/orpc/index.js +4 -4
  179. package/dist/otel/index.d.ts +3 -3
  180. package/dist/otel/index.js +1 -1
  181. package/dist/{output-KT0a3B3H.js → output-CYgfpT6o.js} +1 -1
  182. package/dist/{ownership-CeNOtQMV.js → ownership-adPAsUwY.js} +15 -13
  183. package/dist/{parse-CXTT7hBq.js → parse-CORUNcCo.js} +1 -1
  184. package/dist/{parse-local-manifest-CE4tgFsj.d.ts → parse-local-manifest-BaCqsqwC.d.ts} +1 -1
  185. package/dist/pdp/index.d.ts +3 -3
  186. package/dist/pdp/index.js +4 -3
  187. package/dist/{permdock-DbAq8_Fp.js → permdock-B5LyNVgn.js} +70 -34
  188. package/dist/{permdock-CsrvbzHk.d.ts → permdock-BaB-KQqn.d.ts} +46 -9
  189. package/dist/{permissions-Dz79qsFw.js → permissions-COpRGKt7.js} +1 -1
  190. package/dist/{permissions-Bx6UI8n1.d.ts → permissions-DriWkV7q.d.ts} +1 -2
  191. package/dist/{policy-from-catalog-BtqfxytV.js → policy-from-catalog-Cy103lsm.js} +8 -8
  192. package/dist/{policy-types-BI9C5Sp5.d.ts → policy-types-rNfz7t0M.d.ts} +9 -3
  193. package/dist/{policy-CaAME-Rh.js → policy-wGzbAPQF.js} +7 -7
  194. package/dist/{policy-Dh9WVSVz.d.ts → policy-x8RBKW8d.d.ts} +2 -2
  195. package/dist/{postgrest-CWCCbaxm.d.ts → postgrest-Cn0Res25.d.ts} +9 -21
  196. package/dist/powersync-BdoR7nwS.js +1 -0
  197. package/dist/{powersync-CWsN-QaK.js → powersync-BeI0VmEK.js} +2 -2
  198. package/dist/{powersync-DiqY3VBG.js → powersync-Dpa5AnnN.js} +11 -11
  199. package/dist/preset/index.js +1 -1
  200. package/dist/{preset-pPrVyGU5.js → preset-Bn5Z54cH.js} +5 -6
  201. package/dist/prisma/index.d.ts +2 -2
  202. package/dist/prisma/index.js +1 -1
  203. package/dist/{protected-action-CuG0xz4P.d.ts → protected-action-C4aj1KjO.d.ts} +6 -7
  204. package/dist/{protected-action-CD1HXwQK.js → protected-action-E7Sdt_Dt.js} +1 -1
  205. package/dist/{provider-ihxuJbMi.d.ts → provider-B-1DlOGM.d.ts} +1 -1
  206. package/dist/{provider-qESIf_C0.js → provider-DKO9KHua.js} +2 -2
  207. package/dist/{provider-store-BTHGJH9j.js → provider-store-D4PU1my_.js} +2 -2
  208. package/dist/{pull-B4EhSqOG.js → pull-3tkn25ll.js} +5 -5
  209. package/dist/pull-D90HqWNP.js +1 -0
  210. package/dist/{push-DYOI4bPf.js → push-dMyKdlEm.js} +6 -6
  211. package/dist/{pushed-policy-Dszouliu.js → pushed-policy-Bi5-il4C.js} +2 -2
  212. package/dist/{pushed-policy-P0hgyLBh.d.ts → pushed-policy-P55cJNx5.d.ts} +1 -1
  213. package/dist/react/index.d.ts +6 -6
  214. package/dist/react/index.js +3 -3
  215. package/dist/react/provider-client.d.ts +1 -1
  216. package/dist/react/provider-client.js +1 -1
  217. package/dist/react-native/index.d.ts +9 -9
  218. package/dist/react-native/index.js +7 -7
  219. package/dist/{relation-walk-DK_gkgL7.js → relation-walk-BDTaTKTM.js} +1 -1
  220. package/dist/{relations-BxvRvDHK.js → relations-CMsJ1ARY.js} +1 -1
  221. package/dist/{replay-DYXI4gRN.d.ts → replay-DKhFvt0L.d.ts} +1 -1
  222. package/dist/{request-context-VjeXst1z.js → request-context-5gl_oxO1.js} +2 -2
  223. package/dist/resend/index.d.ts +4 -4
  224. package/dist/resend/index.js +2 -2
  225. package/dist/{resolve-names-BIHnWL_L.js → resolve-names-BnGJU88N.js} +4 -4
  226. package/dist/{rls-C7qXye9M.js → rls-DIYSRnDZ.js} +1 -1
  227. package/dist/{rls-CMFZWosz.js → rls-qrehUPf_.js} +45 -18
  228. package/dist/{role-builder-C5AgaC1x.js → role-builder-boQiUvfo.js} +3 -3
  229. package/dist/{rpc-CYXICjM1.d.ts → rpc-BqRiVpbP.d.ts} +2 -2
  230. package/dist/{rpc-BNIQwEB6.js → rpc-Dhi55Whd.js} +2 -2
  231. package/dist/run-elFdnSZx.js +1 -0
  232. package/dist/{run-CMJX9x7b.js → run-oNqBe0gc.js} +3 -3
  233. package/dist/{run-ticket-CjvXr6wj.js → run-ticket-Ddxt9OuU.js} +2 -2
  234. package/dist/{run-ticket-BXYqQ9dy.d.ts → run-ticket-Dulj4RQk.d.ts} +2 -2
  235. package/dist/{saas-DHFfthXv.js → saas-DABv6vjy.js} +6 -5
  236. package/dist/{scan-CSOkcNdl.js → scan-BYXqcgON.js} +1 -1
  237. package/dist/{schema-7pXCaRYB.js → schema-Wf-SvlHG.js} +1 -1
  238. package/dist/scim/index.d.ts +1 -1
  239. package/dist/scim/index.js +1 -1
  240. package/dist/{scopes-BSdYaGHs.js → scopes-gdH__vDZ.js} +1 -1
  241. package/dist/server/index.d.ts +11 -10
  242. package/dist/server/index.js +7 -6
  243. package/dist/server-CKjFooaJ.js +147 -0
  244. package/dist/{server-types-Bfl-IrzZ.d.ts → server-types--_Hann81.d.ts} +9 -9
  245. package/dist/{shared-sW3VYchq.js → shared-DfaIWvIJ.js} +11 -2
  246. package/dist/{sink-RwmP7ZHs.d.ts → sink-Cs6z34AX.d.ts} +4 -4
  247. package/dist/{skills-DAjg-rgF.js → skills-417bOj4o.js} +1 -1
  248. package/dist/{skills-DrX83QBK.js → skills-B9U465B7.js} +2 -2
  249. package/dist/{snapshot-DHPih65J.js → snapshot-C2j96x97.js} +4 -4
  250. package/dist/{snapshot-cache-MPinwwgZ.d.ts → snapshot-cache-Cc7VNabe.d.ts} +1 -1
  251. package/dist/solid/index.d.ts +6 -7
  252. package/dist/solid/index.js +2 -2
  253. package/dist/solid-start/index.d.ts +6 -6
  254. package/dist/solid-start/index.js +3 -3
  255. package/dist/{sources-sgQlMfmz.d.ts → sources-BfTza0zT.d.ts} +1 -1
  256. package/dist/{src-Cop53_X1.js → src-BG9YJM3Q.js} +96 -247
  257. package/dist/ssf/index.d.ts +3 -3
  258. package/dist/ssf/index.js +3 -3
  259. package/dist/{standard-webhooks-CFZIYtBF.d.ts → standard-webhooks-CJBgfl7y.d.ts} +2 -2
  260. package/dist/{store-CSOsXd5s.js → store-BpKH-pLm.js} +2 -2
  261. package/dist/{store-CRQ5VrWR.d.ts → store-DSyjHD5-.d.ts} +5 -5
  262. package/dist/{store-options-CDvoX52-.js → store-options-CXv6BHH6.js} +5 -6
  263. package/dist/{stores-PpYVQ5yF.js → stores-BuqAHjp_.js} +1 -1
  264. package/dist/{stores-pEBMy94l.d.ts → stores-C6-7TPTV.d.ts} +6 -7
  265. package/dist/{postgrest-BrjrckDG.js → subject-BqFwS6l3.js} +214 -319
  266. package/dist/subject-cache-BT1fGuea.js +193 -0
  267. package/dist/subject-cache-d_Z4KAnm.d.ts +144 -0
  268. package/dist/supabase/index.d.ts +6 -5
  269. package/dist/supabase/index.js +3 -2
  270. package/dist/supabase/middleware.d.ts +6 -6
  271. package/dist/supabase/middleware.js +6 -6
  272. package/dist/{supabase-Cbl2orB2.js → supabase-D0J99yqL.js} +2 -2
  273. package/dist/{supabase-CVZuytCC.js → supabase-DnazO6W4.js} +3 -3
  274. package/dist/{supabase-hook-BUcu3vPM.js → supabase-hook-Bh5syR9N.js} +174 -62
  275. package/dist/supabase-hook-CVAenq-w.js +1 -0
  276. package/dist/{supautils-a_253u1X.js → supautils-ChXR-4Or.js} +302 -43
  277. package/dist/{support-session-BsmPCbz8.js → support-session-BGeEYDSq.js} +2 -2
  278. package/dist/svelte/index.d.ts +5 -5
  279. package/dist/svelte/index.js +3 -3
  280. package/dist/svelte/runtime.d.ts +3 -3
  281. package/dist/svelte/runtime.js +1 -1
  282. package/dist/svelte/source.d.ts +5 -5
  283. package/dist/svelte/source.js +2 -2
  284. package/dist/sveltekit/index.d.ts +6 -6
  285. package/dist/sveltekit/index.js +2 -2
  286. package/dist/{tables-XrvffTMj.js → tables-CbEOy2Ma.js} +137 -55
  287. package/dist/tanstack-start/index.d.ts +6 -6
  288. package/dist/tanstack-start/index.js +2 -2
  289. package/dist/{tenancy-DvOHHk3-.js → tenancy-BlxY5T0q.js} +2 -2
  290. package/dist/terminal/index.d.ts +6 -6
  291. package/dist/terminal/index.js +6 -6
  292. package/dist/testing/core.d.ts +1 -1
  293. package/dist/testing/core.js +1 -1
  294. package/dist/testing/fixtures/index.d.ts +35 -2
  295. package/dist/testing/fixtures/index.js +39 -2
  296. package/dist/testing/index.d.ts +41 -25
  297. package/dist/testing/index.js +114 -26
  298. package/dist/testing/saas/index.d.ts +5 -5
  299. package/dist/testing/saas/index.js +2 -2
  300. package/dist/testing/saas/permissions.d.ts +1 -1
  301. package/dist/testing/saas/permissions.js +1 -1
  302. package/dist/trpc/index.d.ts +6 -6
  303. package/dist/trpc/index.js +4 -4
  304. package/dist/{type-helpers-BjOLGVy1.d.ts → type-helpers-iXJEIDe7.d.ts} +3 -4
  305. package/dist/{types-p8mhWTcR.d.ts → types-B9F0EZAF.d.ts} +3 -3
  306. package/dist/{types-DZwEOsK1.d.ts → types-BSNZMp5b.d.ts} +1 -1
  307. package/dist/{types-MixnvXQ5.d.ts → types-BpxdxaRD.d.ts} +5 -5
  308. package/dist/{types-C3C9ien9.d.ts → types-CD1qmxdx.d.ts} +4 -4
  309. package/dist/{types-D1NjjwI4.d.ts → types-CS1DI_Ke.d.ts} +40 -9
  310. package/dist/{types-zh4WGQcP.d.ts → types-C_a44wSr.d.ts} +3 -3
  311. package/dist/{types-DBVSljAx.d.ts → types-Cq2rvv-C.d.ts} +3 -3
  312. package/dist/{types--_lpWUGV.d.ts → types-CuDXvyIT.d.ts} +5 -5
  313. package/dist/{types-7Vlz1Wi2.d.ts → types-DAyp592k.d.ts} +2 -2
  314. package/dist/{types-DjGZAU64.d.ts → types-NikV1pND.d.ts} +4 -4
  315. package/dist/{types-BzxA2OAD.d.ts → types-ZfjQB0KC.d.ts} +2 -2
  316. package/dist/{types-DotXrris.d.ts → types-_pi9kxS2.d.ts} +2 -2
  317. package/dist/unplugin/index.d.ts +1 -1
  318. package/dist/unplugin/index.js +1 -1
  319. package/dist/{usage-DPbdI3Vi.js → usage-0wsl83uw.js} +10 -10
  320. package/dist/{usage-DHsqp4lN.js → usage-Bl-BkXEq.js} +1 -1
  321. package/dist/usage-CmyGbo4e.js +1 -0
  322. package/dist/{validation-error-DkOK9zUE.d.ts → validation-error-DLAYFlkr.d.ts} +1 -1
  323. package/dist/{verify-C0jGJrmb.js → verify-BSLotSa0.js} +41 -24
  324. package/dist/version-sources-BC3hf2ME.js +34 -0
  325. package/dist/{permission-types-CAY-GU7e.d.ts → vocabulary-DeZvUaTw.d.ts} +69 -1
  326. package/dist/vue/index.d.ts +6 -7
  327. package/dist/vue/index.js +2 -2
  328. package/dist/{waiter-BjVI_Byg.d.ts → waiter-cbK1CBhT.d.ts} +2 -2
  329. package/dist/{watch-Dz2LNM1R.js → watch-BigZ260i.js} +2 -2
  330. package/dist/watch-CHURMgrv.js +1 -0
  331. package/dist/webmcp/index.d.ts +2 -2
  332. package/dist/{who-can-CZeAwQZD.js → who-can-CjfMP9a4.js} +8 -8
  333. package/dist/workflow/index.d.ts +3 -3
  334. package/dist/workflow/index.js +6 -5
  335. package/dist/workflow-sdk/index.d.ts +5 -5
  336. package/dist/{wrap-EQ6Or2Hi.d.ts → wrap-B-k2qHJx.d.ts} +2 -2
  337. package/package.json +16 -4
  338. package/skills/permdock-wire/references/presets-and-recipes.md +2 -2
  339. package/dist/better-supabase-ayun1IKE.js +0 -122
  340. package/dist/catalog-BTPySmbp.js +0 -1
  341. package/dist/collect-eSTXOZDC.js +0 -1
  342. package/dist/index-DuOF7OqS.d.ts +0 -222
  343. package/dist/load-CjnlPxpL.js +0 -1
  344. package/dist/powersync-CWCirKAJ.js +0 -1
  345. package/dist/pull-VzcECZ-R.js +0 -1
  346. package/dist/run-D2e1tybu.js +0 -1
  347. package/dist/supabase-hook-QWphWBnG.js +0 -1
  348. package/dist/usage-dmSjKx-Z.js +0 -1
  349. package/dist/version-cache-q5cpaDSt.d.ts +0 -57
  350. package/dist/vocabulary-DEJ5j4mR.d.ts +0 -70
  351. package/dist/watch-CS69ftMP.js +0 -1
  352. package/dist/where-scope-BAyOsPQW.js +0 -332
  353. package/dist/{approval-normalize-hlfO9BJv.js → approval-normalize-DNLW0zOM.js} +1 -1
  354. package/dist/{body-C9JbIoqb.js → body-B3ylkmmE.js} +1 -1
  355. package/dist/{catalog-doc-nrgfbh8I.js → catalog-doc-Zi0jRpyH.js} +2 -2
  356. package/dist/{device-BwbJNmb2.js → device-BkSynWdg.js} +1 -1
  357. package/dist/{prompt-BYc6drYW.js → prompt-D1Gj1W4Y.js} +1 -1
  358. package/dist/{scim-C30QBBoF.js → scim-BG6uPUeW.js} +1 -1
  359. package/dist/{wrap-C5PWzgkq.js → wrap-BKU5Arsu.js} +1 -1
@@ -1,21 +1,292 @@
1
- import { t as compact } from "./compact-CAf557ZB.js";
1
+ import { a as sole, r as isRecord, t as compact } from "./compact-CAf557ZB.js";
2
2
  import { n as freezeDeep } from "./freeze-jjan0lCv.js";
3
+ import { i as decideAllWith, n as canAllWith } from "./checks-fyDOhcz0.js";
4
+ import { t as loadPrincipal } from "./principal-source-C6N60GtM.js";
3
5
  import { a as deniedMessage, i as approvalMessage, n as PermDockDeniedError, t as PermDockApprovalRequiredError } from "./errors-ynga1EQy.js";
4
- import { o as sameId } from "./expiry-6XByK0dm.js";
6
+ import { a as grantCoversField, o as pickVisible, r as readWireValidity, t as isActive } from "./validity-Buc7w8E9.js";
5
7
  import { c as listPermissions } from "./permission-registry-B8tYxPIt.js";
6
- import { g as secondsOf, o as epochSeconds, t as INVALID_NOW } from "./time-nR1JesoH.js";
7
- import { d as scopeList, o as normalizeMemberships, p as tenantOf, s as resolveScope, t as activeFor } from "./scopes-BSdYaGHs.js";
8
- import { a as readOnlyActorRefuses, c as rowIdOf, l as rowValues, n as coveredByDelegation, u as evaluateCondition } from "./delegation-aK4T_5WU.js";
9
8
  import { b as synthesiseRole, m as findRole, v as listRoles } from "./grantee-Dke-9rd1.js";
10
- import { a as grantCoversField, o as pickVisible, r as readWireValidity, t as isActive } from "./validity-Buc7w8E9.js";
11
- import { c as nowSeconds, d as resolveActiveTenant, f as rowInScope, n as inTeam, r as isMembershipExpired, s as nestedAppliesWithoutRow } from "./tenancy-DvOHHk3-.js";
9
+ import { g as secondsOf, m as rfc3339, o as epochSeconds, t as INVALID_NOW } from "./time-nR1JesoH.js";
10
+ import { i as sameId } from "./ids-DzhJaCUj.js";
11
+ import { d as scopeList, l as scopeChain, o as normalizeMemberships, p as tenantOf, r as findScope, s as resolveScope, t as activeFor, u as scopeIdOf } from "./scopes-gdH__vDZ.js";
12
+ import { o as resourceRoleCondition } from "./grantee-conditions-Dzprappv.js";
13
+ import { n as matchGrantee } from "./grantee-match-8J2y60MF.js";
14
+ import { i as rowValues, l as readOnlyActorRefuses, o as coveredByDelegation, r as rowIdOf, t as evaluateCondition } from "./condition-evaluate-bVVRSdzq.js";
15
+ import { c as nowSeconds, d as resolveActiveTenant, f as rowInScope, n as inTeam, o as membershipField, r as isMembershipExpired, s as nestedAppliesWithoutRow } from "./tenancy-BlxY5T0q.js";
12
16
  import { t as requiresApproval } from "./approval-required-TzNB9oQA.js";
17
+ import { t as resourceIdOf } from "./resource-ref-CaS9yVPi.js";
13
18
  import { i as tokenPayload, n as decisionToken } from "./token-DaMnIU9O.js";
19
+ import { a as bindConditionRefs, n as parseSnapshot } from "./snapshot-C2j96x97.js";
14
20
  import { t as fromWireDelegation } from "./wire-delegation-Cv3W2eaM.js";
15
- import { n as matchGrantee } from "./grantee-match-BP-k4vRJ.js";
16
- import { t as resourceIdOf } from "./resource-ref-CaS9yVPi.js";
17
- import { i as permittedIds, o as deniedFor, r as mayUse, s as signSnapshot, t as whereFromGrants } from "./where-scope-BAyOsPQW.js";
18
- import { i as decideAllWith, n as canAllWith } from "./checks-fyDOhcz0.js";
21
+ //#region src/core/decide-for.ts
22
+ function deniedFor(permission, reason) {
23
+ return freezeDeep({
24
+ outcome: "denied",
25
+ permission: permission.key,
26
+ denials: [{
27
+ role: null,
28
+ reason
29
+ }],
30
+ alternatives: []
31
+ });
32
+ }
33
+ /** Rows are checked like `decide`; `call: 'can'` keeps every limit unconsumed. */
34
+ const PEEK = Object.freeze({ call: "can" });
35
+ /**
36
+ * What `permission` on `row` decides for the principal `principalId` in the
37
+ * caller's active tenant. Never throws, never consumes a limit, and grants the
38
+ * caller nothing: the target is a separate instance with its own caches.
39
+ */
40
+ async function decideForTarget(caller, principals, create, principalId, permission, row) {
41
+ if (caller.principal === null) return deniedFor(permission, "anonymous");
42
+ const tenant = caller.principal.tenant;
43
+ try {
44
+ const principal = await loadPrincipal(principals, principalId, tenant);
45
+ if (principal === null) return deniedFor(permission, "anonymous");
46
+ const target = await create(principal, tenant);
47
+ if (tenant !== void 0 && target.subject.principal?.tenant !== tenant && (principal.kind !== "contact" || target.tenants().length > 0)) return deniedFor(permission, "tenant-mismatch");
48
+ if (row !== void 0) await target.prefetchRelations(permission, [row]);
49
+ return target.decide(permission, row, PEEK);
50
+ } catch {
51
+ return deniedFor(permission, "anonymous");
52
+ }
53
+ }
54
+ //#endregion
55
+ //#region src/core/may-use.ts
56
+ function delegationMayCover(permission, delegation, hasActor) {
57
+ return [void 0, ...[...delegation?.access ?? [], ...delegation?.authorizationDetails ?? []].flatMap((entry) => typeof entry === "object" && entry !== null && typeof entry["identifier"] === "string" ? [entry["identifier"]] : [])].some((id) => coveredByDelegation(permission, delegation, id, hasActor) === void 0);
58
+ }
59
+ function blocksEveryRow(grant) {
60
+ return grant.effect === "deny" && grant.where === void 0 && grant.check === void 0 && grant.portable !== false && grant.fields === void 0 && (grant.scope === void 0 || grant.scope === "tenant");
61
+ }
62
+ function withinDelegation(permdock, permission, ceiling) {
63
+ return (ceiling === void 0 || ceiling.includes(permission.key)) && !readOnlyActorRefuses(permdock.subject.actor, permission) && delegationMayCover(permission, permdock.subject.delegation, permdock.subject.actor !== void 0 && ceiling === void 0);
64
+ }
65
+ /**
66
+ * Whether the subject's delegation, its delegated ceiling and a read-only actor
67
+ * leave `permission` within reach, whatever the grants say. A hint, never a
68
+ * decision.
69
+ */
70
+ function delegationAllows(permdock, permission) {
71
+ try {
72
+ const snapshot = permdock.snapshot();
73
+ return "grants" in snapshot && withinDelegation(permdock, permission, snapshot.delegated);
74
+ } catch {
75
+ return false;
76
+ }
77
+ }
78
+ /**
79
+ * Whether `permission` could be granted to this instance's subject for some
80
+ * row: the grants its snapshot carries for the active tenant, minus an
81
+ * unconditional deny, within its delegation. A listing hint for tools and
82
+ * skills, never a decision; the call itself is decided in full.
83
+ */
84
+ function mayUse(permdock, permission) {
85
+ try {
86
+ const snapshot = permdock.snapshot();
87
+ if (!("grants" in snapshot) || !withinDelegation(permdock, permission, snapshot.delegated)) return false;
88
+ const tenant = permdock.subject.principal?.tenant;
89
+ const scopes = scopeList(snapshot.scopes);
90
+ const grants = snapshot.grants.filter((grant) => {
91
+ if (grant.permission !== permission.key) return false;
92
+ const owner = grant.membership === void 0 ? void 0 : tenantOf(grant.membership, scopes);
93
+ return owner === void 0 || owner === tenant;
94
+ });
95
+ if (grants.some(blocksEveryRow)) return false;
96
+ return grants.some((grant) => grant.effect === "allow");
97
+ } catch {
98
+ return false;
99
+ }
100
+ }
101
+ function isConditioned(grant) {
102
+ return grant.where !== void 0 || grant.check !== void 0 || grant.validity !== void 0 || grant.portable === false;
103
+ }
104
+ /**
105
+ * The instances of `scope` in which the subject holds `permission`, from its
106
+ * live memberships of exactly that scope, within its delegation: by default
107
+ * those with an allow that carries no row condition (`where`, `check`, a
108
+ * validity window or a non-portable test; a `fields` limit is not a row
109
+ * condition), minus the instances any deny of the permission reaches. The
110
+ * in-process mirror of the SQL `permitted_<scope>_ids_by_permission`. With
111
+ * `conditioned: true` it also lists the instances where a conditioned allow
112
+ * applies, minus only unconditional denies, as
113
+ * `permitted_<scope>_ids_by_permission(p_permission, true)` does. A listing,
114
+ * never a decision: a row's own check still runs `can`.
115
+ */
116
+ function permittedIds(permdock, permission, scope, options = {}) {
117
+ try {
118
+ const snapshot = permdock.snapshot({ tenants: "all" });
119
+ if (!("grants" in snapshot)) return [];
120
+ const scopes = scopeList(snapshot.scopes);
121
+ const name = resolveScope(scopes, scope);
122
+ if (name === void 0 || !withinDelegation(permdock, permission, snapshot.delegated)) return [];
123
+ const conditioned = options.conditioned === true;
124
+ const now = nowSeconds();
125
+ const allowed = /* @__PURE__ */ new Set();
126
+ const denied = /* @__PURE__ */ new Set();
127
+ for (const grant of snapshot.grants) {
128
+ const membership = grant.membership;
129
+ if (grant.permission !== permission.key || grant.scope !== name || membership?.scope !== name || membership.id === void 0 || isMembershipExpired(membership, now) || options.within !== void 0 && tenantOf(membership, scopes) !== options.within) continue;
130
+ if (grant.effect === "deny") {
131
+ if (!conditioned || !isConditioned(grant)) denied.add(membership.id);
132
+ } else if ((conditioned || !isConditioned(grant)) && isActive(readWireValidity(grant.validity), now)) allowed.add(membership.id);
133
+ }
134
+ return [...allowed].filter((id) => !denied.has(id)).toSorted();
135
+ } catch {
136
+ return [];
137
+ }
138
+ }
139
+ //#endregion
140
+ //#region src/core/membership-filter.ts
141
+ function filterMemberships(memberships, filter) {
142
+ if (filter?.via === void 0 && filter?.scope === void 0) return memberships;
143
+ return memberships.filter((entry) => (filter.via === void 0 || entry.via === filter.via) && (filter.scope === void 0 || (entry.scope ?? entry.on?.resource) === filter.scope));
144
+ }
145
+ //#endregion
146
+ //#region src/core/where-scope.ts
147
+ const ALWAYS = freezeDeep({
148
+ op: "eq",
149
+ field: "_",
150
+ value: true
151
+ });
152
+ function eq(field, value) {
153
+ return value === void 0 ? {
154
+ op: "or",
155
+ conditions: []
156
+ } : {
157
+ op: "eq",
158
+ field,
159
+ value
160
+ };
161
+ }
162
+ /**
163
+ * One equality per partitioning scope key on the membership's chain, outermost
164
+ * first.
165
+ */
166
+ function namedFilters(membership, scope) {
167
+ 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;
168
+ const filters = [];
169
+ for (const name of scopeChain(scope.scopes, membership.scope).toReversed()) {
170
+ const key = scope.fieldOf(name);
171
+ if (key !== void 0 && scope.partitioned(name, key)) filters.push(eq(key, scopeIdOf(membership, name)));
172
+ }
173
+ return filters;
174
+ }
175
+ /**
176
+ * The row filters a grant's membership implies, or `null` when the grant
177
+ * reaches no row in this scope (another tenant, no active tenant, expired).
178
+ */
179
+ function scopeFilters(grant, scope) {
180
+ if (grant.scope === void 0) return [];
181
+ const membership = grant.membership;
182
+ if (membership === void 0 || isMembershipExpired(membership, scope.now)) return null;
183
+ if (typeof grant.scope === "string") return membership.scope === grant.scope ? namedFilters(membership, scope) : null;
184
+ const on = membership.on;
185
+ if (on === void 0) return null;
186
+ if (scope.resources === void 0) return on.resource === grant.scope.resource && on.resource === scope.resource ? [eq("id", on.id)] : null;
187
+ const roleResource = scope.resources.get(grant.scope.resource);
188
+ if (on.resource !== grant.scope.resource && membershipField(roleResource, on.resource, scope.resources) === void 0) return null;
189
+ const walked = scope.graph === true ? resourceRoleCondition(scope.resources.get(scope.resource), on.resource, [on.id], scope.resources) : void 0;
190
+ if (walked !== void 0) return [walked];
191
+ const field = membershipField(scope.resources.get(scope.resource), on.resource, scope.resources);
192
+ return field === void 0 ? null : [eq(field, on.id)];
193
+ }
194
+ function all(conditions) {
195
+ if (conditions.length === 0) return ALWAYS;
196
+ return sole(conditions) ?? {
197
+ op: "and",
198
+ conditions: [...conditions]
199
+ };
200
+ }
201
+ function scopedCondition(grant, scope) {
202
+ const filters = scopeFilters(grant, scope);
203
+ if (filters === null) return null;
204
+ const parts = grant.where === void 0 ? filters : [...filters, grant.where];
205
+ return parts.length === 0 ? "always" : all(parts);
206
+ }
207
+ /** Whether an unconditional `deny` removes every row `allow` could reach. */
208
+ function covers(deny, allow, scopes) {
209
+ if (deny.where !== void 0) return false;
210
+ const denied = deny.membership;
211
+ if (deny.scope === void 0 || denied === void 0) return deny.scope === void 0;
212
+ const allowed = allow.membership;
213
+ if (allowed === void 0) return false;
214
+ if (typeof deny.scope === "object") return typeof allow.scope === "object" && denied.on?.resource === allowed.on?.resource && denied.on?.id === allowed.on?.id;
215
+ if (typeof allow.scope !== "string" || allowed.scope === void 0) return false;
216
+ const chain = scopeChain(scopes, deny.scope);
217
+ return scopeChain(scopes, allowed.scope).includes(deny.scope) && chain.every((name) => scopeIdOf(allowed, name) === scopeIdOf(denied, name));
218
+ }
219
+ /**
220
+ * The portable filter for one permission's grants: allows OR together, each
221
+ * narrowed to its membership's tenant, team or resource; any applicable
222
+ * portable deny is subtracted, and an unconditional one empties the result.
223
+ */
224
+ function collect(grants, scope) {
225
+ const none = {
226
+ op: "or",
227
+ conditions: []
228
+ };
229
+ const partial = grants.some((grant) => grant.portable === false);
230
+ const denies = [];
231
+ for (const grant of grants) {
232
+ if (grant.effect !== "deny" || grant.portable === false || !isActive(readWireValidity(grant.validity, "deny"), scope.now)) continue;
233
+ const condition = scopedCondition(grant, scope);
234
+ if (condition === "always") return {
235
+ condition: none,
236
+ partial
237
+ };
238
+ if (condition !== null) denies.push({
239
+ grant,
240
+ condition
241
+ });
242
+ }
243
+ const parts = [];
244
+ for (const grant of grants) {
245
+ if (grant.effect !== "allow" || grant.portable === false || !isActive(readWireValidity(grant.validity), scope.now)) continue;
246
+ const condition = scopedCondition(grant, scope);
247
+ if (condition === null || denies.some((deny) => covers(deny.grant, grant, scope.scopes))) continue;
248
+ parts.push(all([...condition === "always" ? [] : [condition], ...denies.map((deny) => ({
249
+ op: "not",
250
+ condition: deny.condition
251
+ }))]));
252
+ }
253
+ if (parts.length === 0) return {
254
+ condition: none,
255
+ partial
256
+ };
257
+ return {
258
+ condition: sole(parts) ?? {
259
+ op: "or",
260
+ conditions: parts
261
+ },
262
+ partial
263
+ };
264
+ }
265
+ /**
266
+ * `collect`, with every subject ref bound to `scope.subject` and the subject
267
+ * attached (not enumerable) for `memberOf`, which needs its memberships.
268
+ */
269
+ function whereFromGrants(grants, scope) {
270
+ const { condition, partial } = collect(grants, scope);
271
+ const result = {
272
+ condition: bindConditionRefs(condition, scope.subject),
273
+ partial
274
+ };
275
+ Object.defineProperty(result, "subject", {
276
+ value: scope.subject,
277
+ enumerable: false
278
+ });
279
+ Object.defineProperty(result, "scopes", {
280
+ value: scope.scopes,
281
+ enumerable: false
282
+ });
283
+ if (scope.resources !== void 0) Object.defineProperty(result, "resources", {
284
+ value: scope.resources,
285
+ enumerable: false
286
+ });
287
+ return freezeDeep(result);
288
+ }
289
+ //#endregion
19
290
  //#region src/core/snapshot-evaluate.ts
20
291
  function coveredByInclude(snapshot, permission) {
21
292
  const include = snapshot.include;
@@ -357,6 +628,64 @@ function whereFromSnapshot(snapshot, subject, permission, team) {
357
628
  });
358
629
  }
359
630
  //#endregion
631
+ //#region src/core/snapshot-sign.ts
632
+ /**
633
+ * The claims `signSnapshot` signs for `snapshot`. `issuedAt` and `expiresAt`
634
+ * become `iat` and `exp` and leave the `snapshot` claim, so the registered
635
+ * claims are the only times a verifier reads.
636
+ */
637
+ function snapshotClaims(snapshot) {
638
+ const { issuedAt, expiresAt, ...claim } = snapshot;
639
+ const iat = secondsOf(issuedAt);
640
+ return compact({
641
+ snapshot: claim,
642
+ sub: snapshot.subject.principal?.id,
643
+ iat: iat === void 0 || iat <= 0 ? void 0 : iat,
644
+ exp: secondsOf(expiresAt)
645
+ });
646
+ }
647
+ /**
648
+ * Signs `snapshot` as a `vnd.permdock.snapshot+jwt` with the claims
649
+ * `snapshotClaims` answers.
650
+ */
651
+ function signSnapshot(snapshot, signer, options = {}) {
652
+ const { iat, exp, ...payload } = snapshotClaims(snapshot);
653
+ return signer.sign(payload, compact({
654
+ typ: "vnd.permdock.snapshot+jwt",
655
+ audience: options.audience,
656
+ issuedAt: iat,
657
+ expiresAt: exp
658
+ }));
659
+ }
660
+ /**
661
+ * The `snapshot` claim of verified claims with `issuedAt` and `expiresAt` taken
662
+ * from `iat` and `exp`; `undefined` when the claim is not an object.
663
+ */
664
+ function snapshotClaim(claims) {
665
+ const claim = claims["snapshot"];
666
+ if (!isRecord(claim)) return;
667
+ const { issuedAt: _issuedAt, expiresAt: _expiresAt, ...rest } = claim;
668
+ return compact({
669
+ ...rest,
670
+ issuedAt: rfc3339(typeof claims.iat === "number" ? claims.iat : 0),
671
+ expiresAt: typeof claims.exp === "number" ? rfc3339(claims.exp) : void 0
672
+ });
673
+ }
674
+ /**
675
+ * The snapshot a verified `vnd.permdock.snapshot+jwt` carries, parsed as
676
+ * `parseSnapshot` parses it, with `issuedAt` and `expiresAt` from `iat` and
677
+ * `exp`. `null` when the claim is missing or not a valid snapshot.
678
+ */
679
+ function snapshotFromClaims(claims) {
680
+ const claim = snapshotClaim(claims);
681
+ if (claim === void 0) return null;
682
+ try {
683
+ return parseSnapshot(claim);
684
+ } catch {
685
+ return null;
686
+ }
687
+ }
688
+ //#endregion
360
689
  //#region src/core/snapshot-subject.ts
361
690
  function subjectFromSnapshot(snapshot, tenant) {
362
691
  const principal = snapshot.subject.principal;
@@ -517,8 +846,11 @@ function fromSnapshot(snapshot, options = {}) {
517
846
  team: id
518
847
  }));
519
848
  },
520
- memberships() {
521
- return subject.principal?.memberships ?? [];
849
+ memberships(filter) {
850
+ return filterMemberships(subject.principal?.memberships ?? [], filter);
851
+ },
852
+ grantedPermissions() {
853
+ return [];
522
854
  },
523
855
  tenants() {
524
856
  return snapshot.tenants;
@@ -592,4 +924,4 @@ function emptySnapshot() {
592
924
  });
593
925
  }
594
926
  //#endregion
595
- export { fromSnapshot as n, heldRoleNames as r, emptySnapshot as t };
927
+ export { snapshotClaim as a, whereFromGrants as c, mayUse as d, permittedIds as f, signSnapshot as i, filterMemberships as l, deniedFor as m, fromSnapshot as n, snapshotClaims as o, decideForTarget as p, heldRoleNames as r, snapshotFromClaims as s, emptySnapshot as t, delegationAllows as u };
@@ -41,7 +41,7 @@ const gen = defineLeaf({
41
41
  const out = given(flags.out);
42
42
  const outDir = given(flags["out-dir"]);
43
43
  const from = given(flags.policy);
44
- const { runGen } = await import("./gen-Cf7nQsOb.js");
44
+ const { runGen } = await import("./gen-WdycZ_-b.js");
45
45
  return runGen({
46
46
  cwd: ctx.cwd,
47
47
  config: ctx.config,
@@ -1,16 +1,16 @@
1
1
  import { r as isRecord } from "./compact-CAf557ZB.js";
2
2
  import { t as DESCRIBE_TITLES } from "./describe-BZAlPHxT.js";
3
3
  import { c as listPermissions } from "./permission-registry-B8tYxPIt.js";
4
- import { d as scopeList } from "./scopes-BSdYaGHs.js";
5
4
  import { v as listRoles } from "./grantee-Dke-9rd1.js";
5
+ import { d as scopeList } from "./scopes-gdH__vDZ.js";
6
6
  import { t as byCodePoint } from "./compare-DTfyUunF.js";
7
7
  import { i as configError, n as CliError } from "./errors-BhRkoNS7.js";
8
- import { c as jsonSchemaOf } from "./catalog-doc-nrgfbh8I.js";
9
- import { c as requirePolicy } from "./load-BaEamml-.js";
10
- import { t as loadConfiguredOperations } from "./catalog-operations-BD22drQf.js";
8
+ import { c as jsonSchemaOf } from "./catalog-doc-Zi0jRpyH.js";
9
+ import { c as requirePolicy } from "./load-C4p4VgwR.js";
10
+ import { t as loadConfiguredOperations } from "./catalog-operations-Do1eD-Rt.js";
11
11
  import { n as fileSummary, r as planFiles } from "./files-CfiRtQ-m.js";
12
12
  import { f as writeOutputFiles, r as driftOf } from "./output-files-CM0BnH05.js";
13
- import { t as resolveNames } from "./resolve-names-BIHnWL_L.js";
13
+ import { t as resolveNames } from "./resolve-names-BnGJU88N.js";
14
14
  import { i as schemaExpression } from "./generate-CezbCaTI.js";
15
15
  import { existsSync, readFileSync } from "node:fs";
16
16
  import { dirname, extname, relative, resolve } from "node:path";
@@ -1,7 +1,7 @@
1
1
  import { a as sole, t as compact } from "./compact-CAf557ZB.js";
2
2
  import { a as expandRelation, c as isEdgeRelation, d as isSelfParented, l as isFieldRelation, m as restrictedStops, p as restrictedFor, s as isComputedRelation, u as isPrincipalRelation } from "./resource-relations-8-pCScBO.js";
3
3
  import { d as isoNow } from "./time-nR1JesoH.js";
4
- import { c as rootScope, d as scopeList, s as resolveScope } from "./scopes-BSdYaGHs.js";
4
+ import { c as rootScope, d as scopeList, s as resolveScope } from "./scopes-gdH__vDZ.js";
5
5
  //#region src/core/grantee-conditions.ts
6
6
  /**
7
7
  * Where a graph relation starts on the row: its own id when the relation is on
@@ -1,8 +1,8 @@
1
1
  import { t as compact } from "./compact-CAf557ZB.js";
2
- import { u as isoAt } from "./time-nR1JesoH.js";
3
- import { d as scopeList, t as activeFor } from "./scopes-BSdYaGHs.js";
4
2
  import { o as flattenGrantee } from "./grantee-Dke-9rd1.js";
5
- import { r as relationCondition, t as inheritCondition } from "./grantee-conditions-DX4K_gGI.js";
3
+ import { u as isoAt } from "./time-nR1JesoH.js";
4
+ import { d as scopeList, t as activeFor } from "./scopes-gdH__vDZ.js";
5
+ import { r as relationCondition, t as inheritCondition } from "./grantee-conditions-Dzprappv.js";
6
6
  //#region src/core/grantee-match.ts
7
7
  function combineWhere(left, right) {
8
8
  if (left === void 0) return right;
@@ -1,7 +1,7 @@
1
- import { D as Policy, N as PolicyVocabulary, en as Snapshot, yr as Principal } from "../policy-types-BI9C5Sp5.js";
2
- import { a as PermDock } from "../permdock-CsrvbzHk.js";
3
- import { D as ConnectionOptions, T as Connection, f as InvalidSignatureError, i as OpenApiHooks, u as SnapshotQuery, v as discoverViaSignatureAgent, x as webBotAuthVerifier } from "../server-types-Bfl-IrzZ.js";
4
- import { a as ProtectTarget, n as FetchAdapterOptions, r as FetchProtect, t as ContextReader } from "../fetch-adapter-BlL-ZhHq.js";
1
+ import { D as Policy, N as PolicyVocabulary, en as Snapshot, yr as Principal } from "../policy-types-rNfz7t0M.js";
2
+ import { a as PermDock } from "../permdock-BaB-KQqn.js";
3
+ import { D as ConnectionOptions, T as Connection, f as InvalidSignatureError, i as OpenApiHooks, u as SnapshotQuery, v as discoverViaSignatureAgent, x as webBotAuthVerifier } from "../server-types--_Hann81.js";
4
+ import { a as ProtectTarget, n as FetchAdapterOptions, r as FetchProtect, t as ContextReader } from "../fetch-adapter-DxqsIXSO.js";
5
5
  import { EventHandler, H3Event, H3EventContext, Middleware } from "h3";
6
6
  //#region src/h3/create.d.ts
7
7
  type H3PermDockOptions<TUser = unknown> = FetchAdapterOptions<H3Event, TUser>;
package/dist/h3/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { l as InvalidSignatureError, p as webBotAuthVerifier, u as discoverViaSignatureAgent } from "../evaluations-CNMVJVD6.js";
2
- import { i as decorate } from "../bind-CJf7S-Jd.js";
3
- import { t as fetchAdapter } from "../fetch-adapter-4EB3cLgB.js";
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 { t as fetchAdapter } from "../fetch-adapter-MoYZ-vF5.js";
4
4
  //#region src/h3/create.ts
5
5
  function createPermDock(policy, options) {
6
6
  const adapter = fetchAdapter(policy, options, "h3", (event) => event.req);
@@ -5,12 +5,33 @@ import { n as describe } from "./describe-BZAlPHxT.js";
5
5
  import { i as getRegistry, n as findPermission } from "./permission-registry-B8tYxPIt.js";
6
6
  import { t as assertAppData } from "./app-data-UNNm07jV.js";
7
7
  import { a as durationOf, i as dateAt, u as isoAt } from "./time-nR1JesoH.js";
8
- import { r as relationReader, t as pendingRelations } from "./relations-BxvRvDHK.js";
9
- import { n as resolveRelated } from "./relation-walk-DK_gkgL7.js";
10
8
  import { n as toWireDelegation } from "./wire-delegation-Cv3W2eaM.js";
9
+ import { r as relationReader, t as pendingRelations } from "./relations-CMsJ1ARY.js";
10
+ import { n as resolveRelated } from "./relation-walk-BDTaTKTM.js";
11
11
  import { i as approverRelationKey, s as ApprovalError, t as APPROVAL_HEADER } from "./types-CcUXciSj.js";
12
- import { n as assertApprover, u as listAllApprovals } from "./store-CSOsXd5s.js";
12
+ import { n as assertApprover, u as listAllApprovals } from "./store-BpKH-pLm.js";
13
13
  import { n as parseApprovalHeader } from "./approval-header-8QV6MU4H.js";
14
+ //#region src/approvals/directory.ts
15
+ /**
16
+ * The number of eligible approvers other than `by` and the request's principal,
17
+ * or `undefined` when the request has no `fallback: 'confirm'`, there is no
18
+ * directory, or it cannot answer.
19
+ */
20
+ async function countOtherApprovers(request, by, directory) {
21
+ if (directory === void 0 || request.approvers?.fallback !== "confirm") return;
22
+ let ids;
23
+ try {
24
+ ids = await directory.approversFor(request);
25
+ } catch {
26
+ return;
27
+ }
28
+ if (ids === null) return;
29
+ const excluded = /* @__PURE__ */ new Set();
30
+ for (const subject of [by, request.subject]) if (subject.principal !== null) excluded.add(subject.principal.id);
31
+ if (request.subject.actor !== void 0) excluded.add(request.subject.actor.id);
32
+ return new Set(ids.filter((id) => !excluded.has(id))).size;
33
+ }
34
+ //#endregion
14
35
  //#region src/approvals/relations.ts
15
36
  const DEFAULT_PARENT_DEPTH = 16;
16
37
  /**
@@ -200,27 +221,6 @@ async function heldPermissions(request, subject, permdockFor) {
200
221
  }
201
222
  }
202
223
  //#endregion
203
- //#region src/approvals/directory.ts
204
- /**
205
- * The number of eligible approvers other than `by` and the request's principal,
206
- * or `undefined` when the request has no `fallback: 'confirm'`, there is no
207
- * directory, or it cannot answer.
208
- */
209
- async function countOtherApprovers(request, by, directory) {
210
- if (directory === void 0 || request.approvers?.fallback !== "confirm") return;
211
- let ids;
212
- try {
213
- ids = await directory.approversFor(request);
214
- } catch {
215
- return;
216
- }
217
- if (ids === null) return;
218
- const excluded = /* @__PURE__ */ new Set();
219
- for (const subject of [by, request.subject]) if (subject.principal !== null) excluded.add(subject.principal.id);
220
- if (request.subject.actor !== void 0) excluded.add(request.subject.actor.id);
221
- return new Set(ids.filter((id) => !excluded.has(id))).size;
222
- }
223
- //#endregion
224
224
  //#region src/approvals/helpers.ts
225
225
  function permissionMeta(permission) {
226
226
  return {
@@ -534,4 +534,4 @@ async function storedApprovalToken(store, decision, options = {}) {
534
534
  }
535
535
  }
536
536
  //#endregion
537
- export { requestApproval as a, resumeFromHeader as c, vouchApproval as d, countOtherApprovers as f, managerKeys as g, approverRelations as h, readApprovalHeader as i, storedApprovalToken as l, heldPermissions as m, consumeApproval as n, resolveApproval as o, approverPermissions as p, inspectApproval as r, resumeDecision as s, cancelApprovals as t, summarizeSubject as u };
537
+ export { requestApproval as a, resumeFromHeader as c, vouchApproval as d, approverPermissions as f, countOtherApprovers as g, managerKeys as h, readApprovalHeader as i, storedApprovalToken as l, approverRelations as m, consumeApproval as n, resolveApproval as o, heldPermissions as p, inspectApproval as r, resumeDecision as s, cancelApprovals as t, summarizeSubject as u };
@@ -1,9 +1,9 @@
1
- import { D as Policy, N as PolicyVocabulary, yr as Principal } from "../policy-types-BI9C5Sp5.js";
2
- import { u as Permission } from "../permission-types-CAY-GU7e.js";
3
- import { a as PermDock } from "../permdock-CsrvbzHk.js";
1
+ import { D as Policy, N as PolicyVocabulary, yr as Principal } from "../policy-types-rNfz7t0M.js";
2
+ import { w as Permission } from "../vocabulary-DeZvUaTw.js";
3
+ import { a as PermDock } from "../permdock-BaB-KQqn.js";
4
4
  import { n as RevocationFeed } from "../revocations-BaUXHM1N.js";
5
- import { D as ConnectionOptions, T as Connection, f as InvalidSignatureError, i as OpenApiHooks, o as ProtectOptions, v as discoverViaSignatureAgent, x as webBotAuthVerifier } from "../server-types-Bfl-IrzZ.js";
6
- import { t as ServerAdapterOptions } from "../bind-XvnD_SUz.js";
5
+ import { D as ConnectionOptions, T as Connection, f as InvalidSignatureError, i as OpenApiHooks, o as ProtectOptions, v as discoverViaSignatureAgent, x as webBotAuthVerifier } from "../server-types--_Hann81.js";
6
+ import { t as ServerAdapterOptions } from "../bind-CnOMjazH.js";
7
7
  import { Context, Hono, MiddlewareHandler } from "hono";
8
8
  import { SSEMessage, SSEStreamingApi } from "hono/streaming";
9
9
  import { WSEvents } from "hono/ws";
@@ -1,8 +1,8 @@
1
1
  import { t as compact } from "../compact-CAf557ZB.js";
2
2
  import { r as PermDockRevokedError } from "../errors-ynga1EQy.js";
3
- import { l as InvalidSignatureError, p as webBotAuthVerifier, u as discoverViaSignatureAgent } from "../evaluations-CNMVJVD6.js";
4
- import { t as problemFromError } from "../map-error-EOhahOVA.js";
5
- import { r as bindKernel } from "../bind-CJf7S-Jd.js";
3
+ import { f as InvalidSignatureError, g as webBotAuthVerifier, p as discoverViaSignatureAgent } from "../evaluations-BzTDWO4m.js";
4
+ import { r as bindKernel } from "../bind-B4Z0U2Gr.js";
5
+ import { t as problemFromError } from "../map-error-p4ROJ_26.js";
6
6
  import { a as onRevoked, n as closeReason, r as guardIterable, t as POLICY_VIOLATION } from "../stream-DQ3rbO3J.js";
7
7
  import { Hono } from "hono";
8
8
  //#region src/hono/create.ts
@@ -1,14 +1,14 @@
1
1
  import { r as isRecord, t as compact } from "./compact-CAf557ZB.js";
2
2
  import { n as freezeDeep } from "./freeze-jjan0lCv.js";
3
3
  import { n as isForbiddenKey, s as splitPath } from "./paths-CUvURzHp.js";
4
- import { a as deny, i as completeGrant, l as normalizeWhere, n as role, r as allow } from "./role-builder-C5AgaC1x.js";
4
+ import { a as deny, i as completeGrant, l as normalizeWhere, n as role, r as allow } from "./role-builder-boQiUvfo.js";
5
5
  import { a as getResource, n as findPermission } from "./permission-registry-B8tYxPIt.js";
6
6
  import { d as isSelfParented } from "./resource-relations-8-pCScBO.js";
7
+ import { _ as listPlans, m as findRole, o as flattenGrantee } from "./grantee-Dke-9rd1.js";
7
8
  import { a as durationOf, l as isRfc3339, m as rfc3339 } from "./time-nR1JesoH.js";
8
9
  import { r as sha256Digest } from "./sha256-C-4WXKIu.js";
9
- import { _ as listPlans, m as findRole, o as flattenGrantee } from "./grantee-Dke-9rd1.js";
10
- import { o as readWireApproval } from "./approval-normalize-hlfO9BJv.js";
11
- import { a as indexPolicy, n as declaredRoleNames } from "./policy-CaAME-Rh.js";
10
+ import { o as readWireApproval } from "./approval-normalize-DNLW0zOM.js";
11
+ import { a as indexPolicy, n as declaredRoleNames } from "./policy-wGzbAPQF.js";
12
12
  //#region src/core/hosted.ts
13
13
  function memoryPolicySource(document = null) {
14
14
  const current = document === null ? null : parsePolicyDocument(document);
@@ -1,4 +1,4 @@
1
- import { D as Policy, Er as Condition, In as Grantee, s as ApprovalRequirement } from "./policy-types-BI9C5Sp5.js";
1
+ import { D as Policy, Er as Condition, In as Grantee, s as ApprovalRequirement } from "./policy-types-rNfz7t0M.js";
2
2
  //#region src/core/hosted.d.ts
3
3
  /**
4
4
  * One grant authored in PermDock Cloud; its grantee is a declared role, plan or
@@ -1,7 +1,7 @@
1
1
  import { t as timeoutSignal } from "./timeout-D51niuQP.js";
2
2
  import { a as describeError, n as CliError } from "./errors-BhRkoNS7.js";
3
3
  import { s as cliVersion } from "./version-DMQ0dnN5.js";
4
- import "./device-BwbJNmb2.js";
4
+ import "./device-BkSynWdg.js";
5
5
  //#region src/cli/core/http.ts
6
6
  /**
7
7
  * `permdock-cli/<version> node/<version> <platform>`, sent on every request the