permdock 0.6.0 → 0.8.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 (507) hide show
  1. package/README.md +2 -3
  2. package/dist/{2020-C9VN-x8c.js → 2020-CJbO8Bvz.js} +1 -3
  3. package/dist/a2a/index.d.ts +7 -7
  4. package/dist/a2a/index.js +9 -9
  5. package/dist/action-result-CL-QCITA.d.ts +19 -0
  6. package/dist/{adapter-context-CRhqyzCk.js → adapter-context-CIQpQxbE.js} +8 -2
  7. package/dist/{adoption-scan-DCYe60Pi.js → adoption-scan-BLs67P1l.js} +5 -5
  8. package/dist/agent/index.d.ts +3 -3
  9. package/dist/agent/index.js +1 -1
  10. package/dist/ai-sdk/index.d.ts +31 -10
  11. package/dist/ai-sdk/index.js +22 -12
  12. package/dist/{app-data-MuyzVqX8.js → app-data-UNNm07jV.js} +10 -7
  13. package/dist/{approval-header-CJACtHkv.js → approval-header-8QV6MU4H.js} +6 -3
  14. package/dist/{approval-prompt-Dg5LeAcT.js → approval-prompt-B8hQY69x.js} +5 -6
  15. package/dist/{approval-prompt-DvSSPQJX.d.ts → approval-prompt-PYagyQUj.d.ts} +13 -11
  16. package/dist/approvals/index.d.ts +5 -5
  17. package/dist/approvals/index.js +7 -7
  18. package/dist/{approvals-p1PGoVjb.js → approvals-DnIBTuXE.js} +128 -78
  19. package/dist/{approvers-CqPOLD-o.js → approvers-B4r0N_Uz.js} +8 -2
  20. package/dist/{arazzo-41WuzHou.js → arazzo-3RhGfkAK.js} +2 -2
  21. package/dist/{arazzo-CaUVBn7D.js → arazzo-B5-ulWif.js} +6 -6
  22. package/dist/{args-IIolxxKA.js → args-0FrVs5EH.js} +125 -8
  23. package/dist/astro/index.d.ts +30 -12
  24. package/dist/astro/index.js +2 -2
  25. package/dist/{audience-DabClFLQ.js → audience-BAkBDMqn.js} +8 -8
  26. package/dist/{auth-DRLEizbL.js → auth--yPyZNgr.js} +21 -10
  27. package/dist/authzen/index.d.ts +171 -25
  28. package/dist/authzen/index.js +321 -149
  29. package/dist/{automation-BNM3TtDo.d.ts → automation-DqEoWHBc.d.ts} +42 -32
  30. package/dist/{automation-DVjOckjV.js → automation-x3KEUusw.js} +22 -21
  31. package/dist/base-url-BQbddZO5.js +9 -0
  32. package/dist/better-auth/index.d.ts +2 -2
  33. package/dist/better-auth/index.js +13 -7
  34. package/dist/better-supabase/index.d.ts +392 -220
  35. package/dist/better-supabase/index.js +293 -152
  36. package/dist/{bind-DOyrv6zi.d.ts → bind-Cp2hBHzP.d.ts} +27 -12
  37. package/dist/{bind-CAvgUuKs.js → bind-D_sZSVA3.js} +22 -10
  38. package/dist/{body-CH5of8Ne.js → body-CJQwYVa8.js} +3 -3
  39. package/dist/{body-text-QcXok_SI.js → body-text-DQhcmqdY.js} +8 -4
  40. package/dist/{boundary-BM8a_P6E.js → boundary-BV3O1eud.js} +8 -2
  41. package/dist/{boundary-BmHxVH1J.d.ts → boundary-C9ck-3uK.d.ts} +13 -4
  42. package/dist/{budget-NbEtbJC_.js → budget-BELja5A9.js} +6 -3
  43. package/dist/{budget-JqcRqyhK.d.ts → budget-hYsPz_yE.d.ts} +6 -3
  44. package/dist/{build-instance-Bu_eDqYw.js → build-instance-CNWaYJyr.js} +3 -3
  45. package/dist/{canonical-json-BC8_nMTw.js → canonical-json-DwilZ1iB.js} +6 -3
  46. package/dist/{capability-N1K9IpqS.js → capability-BqX94r07.js} +31 -25
  47. package/dist/{capability-Drg-1YhL.d.ts → capability-ChuiONQU.d.ts} +41 -29
  48. package/dist/{casbin-Dyu2gnUD.js → casbin-H0rKxBx2.js} +16 -8
  49. package/dist/{casbin-Cr7RLtA3.js → casbin-cbSbhT_k.js} +2 -2
  50. package/dist/{casl-64gpT-8x.js → casl-C4OINZHI.js} +2 -2
  51. package/dist/{casl-DjEDhTCP.js → casl-CHHoCldP.js} +19 -10
  52. package/dist/catalog/index.d.ts +104 -23
  53. package/dist/catalog/index.js +117 -8
  54. package/dist/{catalog-HD2gf5mY.js → catalog-BFpz2EmT.js} +57 -26
  55. package/dist/{catalog-DZVbrF-z.js → catalog-DCspHDc8.js} +3 -3
  56. package/dist/{catalog-doc-Cdn7-0pQ.js → catalog-doc-DjMKzJp9.js} +53 -16
  57. package/dist/{catalog-fingerprint-CCP0-yQS.js → catalog-fingerprint-e6aCWosn.js} +19 -15
  58. package/dist/catalog-mRQQQhNK.js +1 -0
  59. package/dist/catalog-operations-Dadrl7Z-.js +60 -0
  60. package/dist/{create-CQWIpUG-.js → challenge-DImNcR7B.js} +157 -39
  61. package/dist/chat/index.d.ts +1 -1
  62. package/dist/chat/index.js +13 -10
  63. package/dist/chat-sdk/index.d.ts +44 -26
  64. package/dist/chat-sdk/index.js +17 -17
  65. package/dist/checks-CGkP3Z7A.js +40 -0
  66. package/dist/{claims-map-7oQ3ue4X.js → claims-map-CKkoAAYF.js} +5 -2
  67. package/dist/{claims-map-Ca-QX8C6.d.ts → claims-map-D1Pb5oRq.d.ts} +8 -5
  68. package/dist/claude-agent/index.d.ts +6 -6
  69. package/dist/claude-agent/index.js +6 -3
  70. package/dist/clerk/index.d.ts +11 -7
  71. package/dist/clerk/index.js +6 -6
  72. package/dist/cli/bin.js +4 -4
  73. package/dist/cli/index.d.ts +82 -7
  74. package/dist/cli/index.js +6 -6
  75. package/dist/{clients-C7zLFuWT.d.ts → clients-C_NOET3z.d.ts} +5 -5
  76. package/dist/{clients-DjU5ABMy.js → clients-DYr3U86j.js} +3 -3
  77. package/dist/cloud/index.d.ts +186 -38
  78. package/dist/cloud/index.js +293 -31
  79. package/dist/{cloud-ytQ3uviA.js → cloud-BFlGMaak.js} +5 -6
  80. package/dist/{codemod-5mpSpnUY.js → codemod-DLQ9Zpo4.js} +3 -4
  81. package/dist/{codemod-ua2hHy7w.js → codemod-DWSN2erG.js} +523 -201
  82. package/dist/collect-B5BL3klN.js +1 -0
  83. package/dist/{collect-mLTY4nwb.js → collect-B7ZFAJU3.js} +36 -64
  84. package/dist/{collect-Ci6akVwH.js → collect-Bzv3le0A.js} +6 -6
  85. package/dist/{compare-pfyVnBjE.js → compare-DTfyUunF.js} +2 -2
  86. package/dist/compile/index.d.ts +2 -2
  87. package/dist/compile/index.js +1 -1
  88. package/dist/{compile-1bsAezL0.d.ts → compile-BFzysW3o.d.ts} +36 -12
  89. package/dist/{compile-CMqMx_IN.js → compile-EzEMB-7v.js} +77 -33
  90. package/dist/{completion-BTFrHZhX.js → completion-saoYiRFO.js} +17 -8
  91. package/dist/config-BwPBfN0t.js +108 -0
  92. package/dist/{config-Bj2Ixq3d.js → config-DBeXXmBF.js} +2 -2
  93. package/dist/{config-report-DSpsLpCE.js → config-report-BipSWA6V.js} +9 -6
  94. package/dist/config-shape-ykV0Vm2n.js +134 -0
  95. package/dist/{connection-DjhIJSs2.js → connection-B72dg5Q2.js} +23 -22
  96. package/dist/connector-schema-CYLQNMYq.js +434 -0
  97. package/dist/{context-B_u3_bDJ.js → context-BnIzxTNE.js} +4 -3
  98. package/dist/convex/index.d.ts +13 -7
  99. package/dist/convex/index.js +9 -6
  100. package/dist/core-H-mbhpZc.js +341 -0
  101. package/dist/core-hWIARPDz.d.ts +206 -0
  102. package/dist/{create-CBMmFie-.d.ts → create-BSNrVuxh.d.ts} +87 -34
  103. package/dist/{create-B30OMUOJ.d.ts → create-BVq1lNQE.d.ts} +49 -28
  104. package/dist/{create-D_NmPOdH.d.ts → create-CM1FciYG.d.ts} +37 -29
  105. package/dist/{create-CGm28gyI.js → create-Cq4Uox0f.js} +13 -9
  106. package/dist/{create-DCF2SvoT.js → create-_noSrY1T.js} +15 -21
  107. package/dist/{credential-BcoiejpY.js → credential-CyyyvCsL.js} +42 -39
  108. package/dist/{credentials-DPyHmYz5.js → credentials-CdDxp7jN.js} +6 -6
  109. package/dist/{deciding-columns-Sq12mEA6.js → deciding-columns-NB4wcyBf.js} +13 -2
  110. package/dist/{delegation-j6-rc37o.js → delegation-CDB6_keF.js} +31 -22
  111. package/dist/delivery/index.d.ts +5 -5
  112. package/dist/delivery/index.js +6 -5
  113. package/dist/{delivery-DCAgNyCn.js → delivery-BupfvJIV.js} +81 -20
  114. package/dist/{delivery-event-xX4obB8F.js → delivery-event-JioK5YbS.js} +6 -6
  115. package/dist/denied-text-CHNlVInN.d.ts +22 -0
  116. package/dist/{describe-BybMRY7A.js → describe-Bb4hGK5d.js} +6 -5
  117. package/dist/{describe-B5qgDvEW.d.ts → describe-ByS9LgHK.d.ts} +5 -5
  118. package/dist/{device-BARQ8eYG.js → device-BwbJNmb2.js} +11 -8
  119. package/dist/{diff-CmuSD3vc.js → diff-CN8IYhC_.js} +2 -2
  120. package/dist/{diff-3jbx6Rm4.js → diff-iZWV65nC.js} +23 -14
  121. package/dist/{digest-B3kc_PgQ.d.ts → digest-8Yx2CchM.d.ts} +3 -3
  122. package/dist/{doctor-BdZw53-k.js → doctor-CHD1M9R5.js} +485 -141
  123. package/dist/{doctor-3ZqNHX_G.js → doctor-D3wo-yuz.js} +4 -4
  124. package/dist/drizzle/index.d.ts +33 -19
  125. package/dist/drizzle/index.js +17 -9
  126. package/dist/elysia/index.d.ts +17 -11
  127. package/dist/elysia/index.js +5 -5
  128. package/dist/{errors-BKy0EfhN.js → errors-B6R_lg2a.js} +13 -4
  129. package/dist/{errors-BWXBMaKK.d.ts → errors-CHwoRRpB.d.ts} +4 -1
  130. package/dist/{errors-CWTY6uih.js → errors-Vpu6rKHl.js} +14 -10
  131. package/dist/{errors-DH5QEGXh.d.ts → errors-zi_4T-rx.d.ts} +22 -6
  132. package/dist/{evaluate-CNClBvcj.js → evaluate-Dd8Ta0Ie.js} +185 -80
  133. package/dist/{evaluations-beAooV0n.js → evaluations-IBceAeKT.js} +41 -20
  134. package/dist/{evaluations-C_1vdSZc.d.ts → evaluations-z8dQFDaN.d.ts} +12 -6
  135. package/dist/eve/index.d.ts +9 -6
  136. package/dist/eve/index.js +4 -4
  137. package/dist/{event-time-CsegxXxB.js → event-time-BGy48400.js} +8 -4
  138. package/dist/{expiry-D4_YKRKD.js → expiry-6XByK0dm.js} +8 -5
  139. package/dist/express/index.d.ts +9 -6
  140. package/dist/express/index.js +9 -6
  141. package/dist/fastify/index.d.ts +16 -10
  142. package/dist/fastify/index.js +8 -5
  143. package/dist/{fetch-adapter-Dw0MTS3D.d.ts → fetch-adapter-C1DCvpqV.d.ts} +9 -6
  144. package/dist/{fetch-adapter-DD_gfmrC.js → fetch-adapter-JL43jD3E.js} +14 -11
  145. package/dist/fields-D0vUI6dq.js +498 -0
  146. package/dist/{files-C5ZI27eV.js → files-B3AA05f1.js} +21 -5
  147. package/dist/{files-D_JIzUrP.js → files-BSjrtIHw.js} +11 -4
  148. package/dist/{fixtures-B7XrLeY7.js → fixtures-A1_sp_tR.js} +15 -6
  149. package/dist/{flags-C3DktBDY.js → flags-DXjoTVbS.js} +2 -2
  150. package/dist/{freeze-CrU8nQeX.js → freeze-jjan0lCv.js} +4 -1
  151. package/dist/{from-snapshot-CTCMsFZk.js → from-snapshot-DCakWRsr.js} +26 -16
  152. package/dist/gen-B5kvbAoZ.js +58 -0
  153. package/dist/gen-DWCYcMQM.js +827 -0
  154. package/dist/generate-CRVV5V7l.js +165 -0
  155. package/dist/generate-CezbCaTI.js +275 -0
  156. package/dist/{grantee-hxrUsbpM.js → grantee-Dke-9rd1.js} +4 -4
  157. package/dist/{grantee-conditions-CcXf8hMM.js → grantee-conditions-BrYPe-w0.js} +12 -12
  158. package/dist/{grantee-match-DbENBHLB.js → grantee-match-7RZZvoT_.js} +12 -6
  159. package/dist/{graph-sql-B-dsAT6j.d.ts → graph-sql-BwFC4Qjs.d.ts} +3 -3
  160. package/dist/h3/index.d.ts +10 -7
  161. package/dist/h3/index.js +3 -3
  162. package/dist/headers-B9jQxjtW.d.ts +10 -0
  163. package/dist/{helpers-CBYVMjwh.js → helpers-DJicaG6f.js} +40 -28
  164. package/dist/hono/index.d.ts +16 -10
  165. package/dist/hono/index.js +5 -5
  166. package/dist/{hosted-BPk51-kX.d.ts → hosted-Cmtxogd0.d.ts} +44 -20
  167. package/dist/{hosted-B46-5LYE.js → hosted-D0IzESu_.js} +68 -25
  168. package/dist/{http-ujKm0JXE.js → http-DH94eh6f.js} +4 -4
  169. package/dist/{http-BBoKefeS.js → http-DKLXrFGk.js} +13 -7
  170. package/dist/{http-DXJ37RDA.js → http-DOL33cO0.js} +11 -8
  171. package/dist/{import-wyqXUyjm.js → import-CST57XLp.js} +64 -51
  172. package/dist/{import-CNV7I2Dw.js → import-_YqhhwvX.js} +6 -6
  173. package/dist/{index-B8YjkEZ4.d.ts → index-B8s204GL.d.ts} +64 -52
  174. package/dist/{index-Ch8LpNDp.d.ts → index-BT5-1VsX.d.ts} +64 -25
  175. package/dist/{index-DuWxc5dt.d.ts → index-BW_0MZOS.d.ts} +388 -149
  176. package/dist/index-BhxEUY9J.d.ts +233 -0
  177. package/dist/index-Bv5iXPqU.d.ts +210 -0
  178. package/dist/{index-C-6Letxg.d.ts → index-_9UiQIkt.d.ts} +164 -77
  179. package/dist/index.d.ts +22 -21
  180. package/dist/index.js +35 -33
  181. package/dist/{init-GG6Jh8HD.js → init-Dz_PsHdv.js} +5 -5
  182. package/dist/{init-DeMYsnYJ.js → init-cE3A8aXq.js} +10 -10
  183. package/dist/{instance-options-BsVpyGIk.d.ts → instance-options-B0KXqTrJ.d.ts} +4 -4
  184. package/dist/{instance-snapshot-BOEhcqIF.js → instance-snapshot--JWiTrvO.js} +81 -56
  185. package/dist/{instant-BluqDvyS.js → instant-DK3Iz83e.js} +2 -2
  186. package/dist/{internals-Dk8A8fX3.js → internals-B3IgHrvo.js} +6 -3
  187. package/dist/{json-schema-B-vAwlde.js → json-schema-BPGa-RjQ.js} +9 -3
  188. package/dist/{json-schema-CN_iLFH2.d.ts → json-schema-BfXgnRNT.d.ts} +4 -4
  189. package/dist/jwt/index.d.ts +125 -17
  190. package/dist/jwt/index.js +157 -16
  191. package/dist/{kernel-D0NVb1cK.js → kernel-C-fYydV2.js} +151 -16
  192. package/dist/kysely/index.d.ts +49 -33
  193. package/dist/kysely/index.js +9 -7
  194. package/dist/{live-options-BaAFCIiu.js → live-options-BBIT68le.js} +2 -2
  195. package/dist/{load-DFS_ry0W.js → load-DjSU5KXO.js} +6 -6
  196. package/dist/load-Dm0pSYH3.js +1 -0
  197. package/dist/{login-Dfe5RlYk.js → login-D-8tMqzo.js} +4 -4
  198. package/dist/{login-imhuwvn3.js → login-DplQ0s84.js} +18 -15
  199. package/dist/{manifest-dvL2XEe1.js → manifest-Cgiq5oqc.js} +67 -37
  200. package/dist/{manifest-mx5ghSFM.d.ts → manifest-CzzWtnAb.d.ts} +144 -28
  201. package/dist/{manifest-schema-C0kK_8V0.js → manifest-schema-2r37XRhD.js} +80 -9
  202. package/dist/{manifest-C8IzW3Do.js → manifest-wg8WkkpD.js} +11 -7
  203. package/dist/{map-claims-D3oRmTk0.js → map-claims-BNWCJtmP.js} +27 -18
  204. package/dist/{map-error-Dr70oA_3.js → map-error-pasIGqMT.js} +7 -7
  205. package/dist/{markers-C6joDI3o.js → markers-BeHZ4x9Q.js} +20 -5
  206. package/dist/mcp/index.d.ts +154 -47
  207. package/dist/mcp/index.js +200 -41
  208. package/dist/{migrate-CIq4-E9F.js → migrate-B7oP_sQU.js} +102 -31
  209. package/dist/module-values-BJTBdo6y.js +107 -0
  210. package/dist/nest/index.d.ts +23 -13
  211. package/dist/nest/index.js +18 -11
  212. package/dist/next/client.d.ts +5 -2
  213. package/dist/next/client.js +1 -1
  214. package/dist/next/index.d.ts +72 -26
  215. package/dist/next/index.js +110 -6
  216. package/dist/next/plugin.d.ts +1 -1
  217. package/dist/next/plugin.js +4 -3
  218. package/dist/node/index.d.ts +5 -5
  219. package/dist/node/index.js +3 -3
  220. package/dist/{ocsf-BFp-PZZA.js → ocsf-TcjRBgIs.js} +15 -5
  221. package/dist/openai/index.d.ts +13 -7
  222. package/dist/openai/index.js +3 -3
  223. package/dist/openapi/index.d.ts +61 -30
  224. package/dist/openapi/index.js +2 -2
  225. package/dist/{openapi-B7HZ0f-r.js → openapi-BOsx0xn9.js} +34 -24
  226. package/dist/{openapi-C4dDTVEd.js → openapi-CBZUhA3l.js} +4 -5
  227. package/dist/{openapi-DD1SV-5-.js → openapi-VeHHU2l9.js} +23 -14
  228. package/dist/{operation-findings-DgATDpvh.js → operation-findings-CXtFzlKJ.js} +3 -3
  229. package/dist/{operations-X0VM7F3m.d.ts → operations-Ci_rT6Uo.d.ts} +10 -7
  230. package/dist/orpc/index.d.ts +68 -14
  231. package/dist/orpc/index.js +62 -13
  232. package/dist/otel/index.d.ts +7 -4
  233. package/dist/otel/index.js +8 -5
  234. package/dist/output-files-BHOIlrfD.js +1 -0
  235. package/dist/{output-files-DhRBBE4n.js → output-files-BIQ_9pIs.js} +29 -17
  236. package/dist/{output-1im__-08.js → output-tkju6U7R.js} +15 -7
  237. package/dist/ownership-B4L59T9u.js +1054 -0
  238. package/dist/parse-1_ZheTW5.js +151 -0
  239. package/dist/parse-local-manifest-BQhTlLQS.d.ts +10 -0
  240. package/dist/parse-local-manifest-DEiCF4ah.js +69 -0
  241. package/dist/{parse-request-D_tUXG6M.js → parse-request-CwCZpyjV.js} +7 -8
  242. package/dist/{paths-DXSHAMIa.js → paths-CUvURzHp.js} +4 -1
  243. package/dist/pdp/index.d.ts +9 -6
  244. package/dist/pdp/index.js +23 -12
  245. package/dist/{peer-CRvC7Hg1.js → peer-C9LvBCcb.js} +1 -1
  246. package/dist/peer-Q0fuZ6hx.js +982 -0
  247. package/dist/{permdock-SV8ZINYT.d.ts → permdock-B6Sf4T_S.d.ts} +270 -117
  248. package/dist/{permdock-BrAscV28.js → permdock-L-_I_3zP.js} +226 -74
  249. package/dist/{permission-registry-Br4jSNVi.js → permission-registry-B8tYxPIt.js} +24 -11
  250. package/dist/{vocabulary-CN8H_9UF.d.ts → permission-types-CAY-GU7e.d.ts} +130 -104
  251. package/dist/{permissions-u_KHg-sN.d.ts → permissions-Bx6UI8n1.d.ts} +6 -2
  252. package/dist/{permissions-B-wCP5ZC.js → permissions-CVXmRILq.js} +3 -3
  253. package/dist/{permissions-BPxlwVhN.js → permissions-mDcTWoBs.js} +8 -5
  254. package/dist/pg-DQTqRrou.js +60 -0
  255. package/dist/{pins-8ILTftC9.js → pins-nqarl3oE.js} +4 -1
  256. package/dist/pkce-CnmmYqUZ.js +21 -0
  257. package/dist/{policy-77FSAq_V.d.ts → policy-Ba4bDhaj.d.ts} +5 -5
  258. package/dist/{policy-DbM5YYtV.js → policy-CLQ8__GF.js} +49 -20
  259. package/dist/{policy-from-catalog-C2gMa2Dj.js → policy-from-catalog-CJgOm6aq.js} +28 -25
  260. package/dist/{policy-module-CTlwMvLI.js → policy-module-xym9fnSq.js} +12 -6
  261. package/dist/{policy-types-n0uRTsW8.d.ts → policy-types-CCiDRZBH.d.ts} +802 -334
  262. package/dist/postgres-store-DcyrPS-r.js +1028 -0
  263. package/dist/{postgrest-DAjUkF9w.js → postgrest-D4nuPXIQ.js} +88 -36
  264. package/dist/{postgrest-CEgRbefE.d.ts → postgrest-DicQyqm-.d.ts} +60 -30
  265. package/dist/powersync-DHNQX06W.js +1117 -0
  266. package/dist/{powersync-DISt6SUe.js → powersync-DXqGuq9A.js} +3 -3
  267. package/dist/powersync-Djf-zCpB.js +1 -0
  268. package/dist/preset/index.d.ts +38 -28
  269. package/dist/preset/index.js +1 -1
  270. package/dist/{preset-DZdU0tne.js → preset-BjLzeFpp.js} +58 -34
  271. package/dist/{principal-source-pHneukrx.js → principal-source-C6N60GtM.js} +10 -10
  272. package/dist/prisma/index.d.ts +69 -41
  273. package/dist/prisma/index.js +21 -17
  274. package/dist/{problem-CTviyH5L.js → problem-BVLHFK33.js} +41 -21
  275. package/dist/{problem-details-cn5X30gZ.js → problem-details-CLDgX1KV.js} +13 -4
  276. package/dist/{problem-types-CJ2325SZ.js → problem-types-DSsRfONQ.js} +4 -1
  277. package/dist/prompt-BYc6drYW.js +938 -0
  278. package/dist/protected-action-BE7N_Luo.d.ts +58 -0
  279. package/dist/protected-action-DUYqb-Ma.js +80 -0
  280. package/dist/{protected-BlF0F6wL.js → protected-action-QEA8arRB.js} +48 -14
  281. package/dist/{provider-B1al-AZz.js → provider-C55OGXJ7.js} +5 -4
  282. package/dist/{provider-DILL9oPK.d.ts → provider-DXfq5c2d.d.ts} +1 -1
  283. package/dist/{provider-store-DM6DNcta.js → provider-store-CaTv00tr.js} +13 -9
  284. package/dist/pull-B65ndFNZ.js +1 -0
  285. package/dist/{pull-jEwbf80J.js → pull-CwpGaQSi.js} +12 -11
  286. package/dist/{push-BD4f15co.js → push-DgssgzkK.js} +62 -16
  287. package/dist/{pushed-policy-DCW91KQU.d.ts → pushed-policy-D1Eoi6NM.d.ts} +12 -6
  288. package/dist/{pushed-policy-CqtxkV4G.js → pushed-policy-ITwYKvvH.js} +10 -7
  289. package/dist/react/index.d.ts +9 -8
  290. package/dist/react/index.js +7 -6
  291. package/dist/react/provider-client.d.ts +1 -1
  292. package/dist/react/provider-client.js +1 -1
  293. package/dist/react-native/index.d.ts +104 -51
  294. package/dist/react-native/index.js +394 -67
  295. package/dist/{refs-K6eWUJ0H.js → refs-C8BKxc_e.js} +17 -3
  296. package/dist/{relation-walk-3OyDBF0S.js → relation-walk-DK_gkgL7.js} +12 -9
  297. package/dist/{relations-BnCWnJGI.js → relations-BxvRvDHK.js} +3 -3
  298. package/dist/{replay-Du1tJjG7.js → replay-BU09ad4L.js} +1 -1
  299. package/dist/{replay-Bkm-Ne4l.d.ts → replay-DNftIb_R.d.ts} +1 -1
  300. package/dist/{request-context-C81Pip9n.js → request-context-C25ilqiJ.js} +8 -8
  301. package/dist/{request-schema-CMreVuFM.js → request-schema-DhX7UbfQ.js} +4 -1
  302. package/dist/resend/index.d.ts +34 -28
  303. package/dist/resend/index.js +29 -29
  304. package/dist/resolve-names-CF7xXLSG.js +201 -0
  305. package/dist/{resource-relations-D_jw0BFx.js → resource-relations-8-pCScBO.js} +18 -9
  306. package/dist/{retire-CALjIQ7e.js → retire-B2xffQgY.js} +15 -6
  307. package/dist/{revocations-R07lFBnX.d.ts → revocations-BaUXHM1N.d.ts} +6 -3
  308. package/dist/{rls-DTvYd-lI.js → rls-CNEH2_BG.js} +743 -624
  309. package/dist/{rls-BAqP4q66.js → rls-Ca8Jz9b5.js} +41 -10
  310. package/dist/{role-builder-uWQZ4v84.js → role-builder-BK2-T6oD.js} +41 -20
  311. package/dist/rolldown-runtime-C3I60J0A.js +4 -0
  312. package/dist/{row-conditions-h2HythXQ.js → row-conditions-BAGHOmVq.js} +4 -3
  313. package/dist/{rpc-VSl5ylaQ.js → rpc-fNqAIqQk.js} +8 -5
  314. package/dist/{run-CUKuz0A8.js → run-Bz26OTfO.js} +26 -23
  315. package/dist/run-D-JE8QWb.js +1 -0
  316. package/dist/{run-ticket-DocwaTKn.d.ts → run-ticket-DbWI9f99.d.ts} +33 -13
  317. package/dist/{run-ticket-sxFI6LAk.js → run-ticket-Dv7aF7Dk.js} +29 -8
  318. package/dist/{runtime-D3VTAiCA.js → runtime-BGnrOkVH.js} +5 -2
  319. package/dist/{saas-BCXRuXca.js → saas-iWnUdwCt.js} +42 -29
  320. package/dist/{scan-qvOe0hS3.js → scan-DCj1KQfn.js} +1 -1
  321. package/dist/{schema-B4v0Qrac.js → schema-BOJjqlWL.js} +3 -2
  322. package/dist/{schema-yLuBWWsh.js → schema-Dst9I9Gs.js} +9 -5
  323. package/dist/scim/index.d.ts +3 -2
  324. package/dist/scim/index.js +3 -1
  325. package/dist/scim-D8YupzX1.js +44 -0
  326. package/dist/{scim-ClHtpyV3.js → scim-jJBJ7g1Z.js} +35 -551
  327. package/dist/{scopes-CUPSjo9q.js → scopes-0Up_UA2t.js} +42 -24
  328. package/dist/server/index.d.ts +12 -12
  329. package/dist/server/index.js +13 -13
  330. package/dist/{server-C3WXAHZj.js → server-3cVlTLde.js} +31 -31
  331. package/dist/{server-types-CKQiCnON.d.ts → server-types-CIlpSA2G.d.ts} +81 -46
  332. package/dist/{sha256-D9ihqmvd.js → sha256-C-4WXKIu.js} +4 -3
  333. package/dist/{shared-BAK8t4Uo.js → shared-Afctg7B0.js} +100 -61
  334. package/dist/{shared-DvvFzYXe.js → shared-l0oGGetg.js} +9 -6
  335. package/dist/{signals-D3NcTKUS.js → signals-B1vHR3fN.js} +2 -2
  336. package/dist/{sink-BEZSlMS_.js → sink-D9_vh372.js} +32 -21
  337. package/dist/{sink-4-eQIRWf.d.ts → sink-Dvi7YZG_.d.ts} +44 -20
  338. package/dist/{skills-B6lVdD_W.js → skills-Bjj7BNEQ.js} +16 -12
  339. package/dist/{skills-CTYwkl44.js → skills-OuoMR49L.js} +3 -3
  340. package/dist/{snapshot-B7DkYg6g.js → snapshot-CXlzi69u.js} +21 -18
  341. package/dist/{snapshot-cache-PXI-vGpY.d.ts → snapshot-cache-BAXZ0KOp.d.ts} +21 -12
  342. package/dist/{snapshot-cache-DZHQ0KF6.js → snapshot-cache-Bx_4xC_6.js} +14 -11
  343. package/dist/solid/index.d.ts +55 -15
  344. package/dist/solid/index.js +46 -12
  345. package/dist/solid-start/index.d.ts +30 -12
  346. package/dist/solid-start/index.js +3 -3
  347. package/dist/sources-B1Os_YUu.d.ts +312 -0
  348. package/dist/{sources-vs5dGOsS.js → sources-CMAM-2A3.js} +156 -51
  349. package/dist/sources-qoIJQrJv.js +11 -0
  350. package/dist/{sql-B5T1IL83.js → sql-0WjxIp9g.js} +32 -7
  351. package/dist/sql-B80DFdpG.d.ts +10 -0
  352. package/dist/{src-Cu2m75uo.js → src-DZ0l9UAg.js} +305 -123
  353. package/dist/ssf/index.d.ts +4 -4
  354. package/dist/ssf/index.js +665 -224
  355. package/dist/{standard-webhooks-rbD7LS6h.d.ts → standard-webhooks-C-qX4mJW.d.ts} +7 -7
  356. package/dist/{standard-webhooks-DgFFD-Ga.js → standard-webhooks-D67a3nzk.js} +5 -5
  357. package/dist/{store-BDutJkDL.js → store-RNFvaJJv.js} +43 -29
  358. package/dist/{store-options-u0ycEe8s.js → store-options-Dil3lraY.js} +105 -15
  359. package/dist/stores-C0Kta5Ft.d.ts +59 -0
  360. package/dist/{stores-CGhM8BN_.js → stores-DxZWDXCs.js} +42 -5
  361. package/dist/{stream-CvdUS9V1.js → stream-CDvF0sJm.js} +5 -5
  362. package/dist/{stream-CeCMJmBB.d.ts → stream-ltuLdtTG.d.ts} +4 -3
  363. package/dist/{style-DiKWnAvn.js → style-DblOtSga.js} +1 -1
  364. package/dist/{style-Uao76wO7.js → style-Ds11Hmk4.js} +3 -1
  365. package/dist/{subject-settings-CkEwrw3W.js → subject-settings-8sH5HlII.js} +8 -4
  366. package/dist/{row-check-Dt35czLy.d.ts → subject-settings-vNW8qmUH.d.ts} +30 -18
  367. package/dist/supabase/index.d.ts +48 -37
  368. package/dist/supabase/index.js +6 -6
  369. package/dist/supabase/middleware.d.ts +19 -13
  370. package/dist/supabase/middleware.js +7 -7
  371. package/dist/{supabase-x5JtR2tc.js → supabase-BL1qJzzY.js} +82 -36
  372. package/dist/{supabase-By_frk3U.js → supabase-D39cuGPt.js} +3 -3
  373. package/dist/{supabase-hook-BMoEhZir.js → supabase-hook-B-yXnzUl.js} +1206 -286
  374. package/dist/supabase-hook-H-MtE9Wd.js +1 -0
  375. package/dist/supautils-BU-pAEpf.js +808 -0
  376. package/dist/{support-session-C6xJQYut.js → support-session-BsmPCbz8.js} +22 -22
  377. package/dist/svelte/PermissionBoundary.svelte +2 -6
  378. package/dist/svelte/Protected.svelte +2 -8
  379. package/dist/svelte/index.d.ts +9 -8
  380. package/dist/svelte/index.js +10 -9
  381. package/dist/svelte/runtime.d.ts +4 -4
  382. package/dist/svelte/runtime.js +4 -4
  383. package/dist/svelte/source.d.ts +9 -8
  384. package/dist/svelte/source.js +6 -5
  385. package/dist/sveltekit/index.d.ts +30 -12
  386. package/dist/sveltekit/index.js +2 -2
  387. package/dist/{ownership-DqaJNJPn.js → tables-DeMNEy6V.js} +1025 -1085
  388. package/dist/tanstack-start/index.d.ts +22 -10
  389. package/dist/tanstack-start/index.js +2 -2
  390. package/dist/{target-Bw37TFNA.js → target-qdEAnnhU.js} +6 -6
  391. package/dist/{tenancy-DN2QAx9z.js → tenancy-5d1zVBvK.js} +36 -21
  392. package/dist/terminal/index.d.ts +23 -14
  393. package/dist/terminal/index.js +17 -20
  394. package/dist/testing/core.d.ts +2 -0
  395. package/dist/testing/core.js +1 -0
  396. package/dist/testing/fixtures/index.d.ts +15 -0
  397. package/dist/testing/fixtures/index.js +831 -0
  398. package/dist/testing/index.d.ts +235 -285
  399. package/dist/testing/index.js +502 -927
  400. package/dist/testing/saas/index.d.ts +43 -27
  401. package/dist/testing/saas/index.js +2 -2
  402. package/dist/testing/saas/permissions.d.ts +1 -1
  403. package/dist/testing/saas/permissions.js +1 -1
  404. package/dist/text-diff-BtfSmdUo.js +444 -0
  405. package/dist/{thenable-yD7SabqG.js → thenable-BNSM1U2R.js} +12 -3
  406. package/dist/{time-DkWjdL98.js → time-nR1JesoH.js} +32 -8
  407. package/dist/{token-BLZcjQgt.js → token-DC9EQiet.js} +15 -13
  408. package/dist/{tool-refusal-CMLN5xhn.js → tool-refusal-Qpjs_W6M.js} +5 -2
  409. package/dist/trpc/index.d.ts +11 -8
  410. package/dist/trpc/index.js +15 -9
  411. package/dist/type-helpers-BIPIDa6a.d.ts +50 -0
  412. package/dist/{types-8RnwUAvE.d.ts → types-AMJ5qoU_.d.ts} +49 -30
  413. package/dist/{types-C_IiEs64.d.ts → types-B2mlGuhW.d.ts} +14 -11
  414. package/dist/{types-_WhUP7ud.d.ts → types-B4uqKDnp.d.ts} +25 -12
  415. package/dist/{types-CX7AvRqP.d.ts → types-BJk0BKRX.d.ts} +24 -14
  416. package/dist/types-B_d_g7T3.d.ts +262 -0
  417. package/dist/{types-BdtSDbBO.d.ts → types-B_tiYvk8.d.ts} +59 -32
  418. package/dist/{types-DqzsnlSA.js → types-CcUXciSj.js} +17 -5
  419. package/dist/{types-Dfv0aTER.d.ts → types-DC1Loeh3.d.ts} +449 -168
  420. package/dist/{types-lUlG3TVd.d.ts → types-DHKPcqzr.d.ts} +2 -2
  421. package/dist/{types-C791HFu9.d.ts → types-DjuMBNF9.d.ts} +68 -32
  422. package/dist/{types-C863OQiR.d.ts → types-HzqOtvsJ.d.ts} +23 -12
  423. package/dist/{types-Druu9wLM.d.ts → types-ZzRGoViD.d.ts} +77 -24
  424. package/dist/{types-BzzaHxt3.d.ts → types-ah9NlU6j.d.ts} +137 -48
  425. package/dist/{types-CVZSNocA.d.ts → types-djVzLlIV.d.ts} +31 -14
  426. package/dist/{types-BtHtcKMr.d.ts → types-yUuPR5Hy.d.ts} +47 -24
  427. package/dist/unplugin/index.d.ts +1 -1
  428. package/dist/unplugin/index.js +2 -2
  429. package/dist/usage-CYeXek0p.js +1 -0
  430. package/dist/{usage-SveTRTyr.js → usage-CxEzS4ey.js} +50 -26
  431. package/dist/{usage-CRVl9V3t.js → usage-ab0PdusX.js} +2 -2
  432. package/dist/{validation-error-ZfUHbKvf.js → validation-error-CYg2kJEw.js} +4 -1
  433. package/dist/{validation-error-DHUrAkku.d.ts → validation-error-YGg2mXyH.d.ts} +5 -2
  434. package/dist/{validity-CZ7-y0Cj.js → validity-Buc7w8E9.js} +13 -10
  435. package/dist/{verifier-DHuh-okk.js → verifier-DUV6pLqZ.js} +10 -4
  436. package/dist/{verify-BaAKx7t6.js → verify-DZeqoWu5.js} +417 -489
  437. package/dist/version-DMQ0dnN5.js +48 -0
  438. package/dist/version-DizhmD72.js +1 -0
  439. package/dist/{views-DTIIO-oQ.js → views-CD8wuL4Z.js} +19 -6
  440. package/dist/vocabulary-DEJ5j4mR.d.ts +70 -0
  441. package/dist/vue/index.d.ts +71 -21
  442. package/dist/vue/index.js +50 -13
  443. package/dist/{waiter-B986w1oK.d.ts → waiter-Bu9zAlE0.d.ts} +13 -10
  444. package/dist/{waiter-BGUtGYoU.js → waiter-aBLM63_f.js} +1 -1
  445. package/dist/{watch-vea54PRw.js → watch-Cx_WciLE.js} +8 -8
  446. package/dist/watch-DB42U1ib.js +1 -0
  447. package/dist/webmcp/index.d.ts +11 -11
  448. package/dist/webmcp/index.js +8 -5
  449. package/dist/{where-scope-C9vfEphl.js → where-scope-DlCdCM_8.js} +56 -30
  450. package/dist/{who-can-DWBAcaCQ.js → who-can-rI7dCR9Q.js} +23 -20
  451. package/dist/workflow/index.d.ts +3 -3
  452. package/dist/workflow/index.js +13 -13
  453. package/dist/workflow-sdk/index.d.ts +19 -13
  454. package/dist/workflow-sdk/index.js +6 -6
  455. package/dist/{wrap-gX61EtpB.js → wrap-B2wziJI_.js} +11 -5
  456. package/dist/{wrap-C5jC6sKI.d.ts → wrap-DlJE3gS_.d.ts} +8 -5
  457. package/package.json +25 -14
  458. package/schemas/catalog-v1.json +3 -0
  459. package/schemas/cli-result-v1.json +1 -0
  460. package/schemas/cloud-api-v1.json +152 -7
  461. package/schemas/connector-v1.json +8 -0
  462. package/schemas/supabase-claims-v1.json +5 -0
  463. package/schemas/supabase-manifest-v1.json +308 -75
  464. package/skills/permdock/SKILL.md +1 -0
  465. package/skills/permdock-agents/references/runtimes.md +3 -1
  466. package/skills/permdock-approvals/references/stores-and-resume.md +2 -1
  467. package/skills/permdock-credentials/references/tokens-keys-links.md +8 -6
  468. package/skills/permdock-data/references/queries-and-rls.md +6 -2
  469. package/skills/permdock-tenancy/SKILL.md +1 -1
  470. package/skills/permdock-tenancy/references/ownership-and-custom-roles.md +2 -1
  471. package/skills/permdock-wire/references/adapters.md +28 -22
  472. package/skills/permdock-wire/references/policy-options.md +1 -0
  473. package/dist/catalog-BoWglDPI.js +0 -1
  474. package/dist/collect-D7eQDffE.js +0 -1
  475. package/dist/config-bs_kZeYq.js +0 -162
  476. package/dist/denied-text-CiFQNuMV.d.ts +0 -19
  477. package/dist/fields-OYG_JR78.js +0 -203
  478. package/dist/generate-CNU1pIOo.js +0 -171
  479. package/dist/headers-BIjfMaoC.js +0 -8
  480. package/dist/headers-CIbDTUTK.d.ts +0 -7
  481. package/dist/index-Cp_ilKi1.d.ts +0 -91
  482. package/dist/index-CueFnxQc.d.ts +0 -110
  483. package/dist/load-BxEtwlBS.js +0 -1
  484. package/dist/output-files-B3IZJksC.js +0 -1
  485. package/dist/package-root-Dk_ETdkp.js +0 -31
  486. package/dist/parse-Cxq0WxrA.js +0 -53
  487. package/dist/parse-local-manifest-5ODwqu8b.d.ts +0 -10
  488. package/dist/parse-local-manifest-CVSs6J9I.js +0 -34
  489. package/dist/peer-C8swJ2GH.js +0 -50
  490. package/dist/policies-DP2nqRoF.js +0 -295
  491. package/dist/powersync-BkWWCS1K.js +0 -538
  492. package/dist/powersync-MMJ2mI2q.js +0 -1
  493. package/dist/problem-details-B45V5d2b.d.ts +0 -7
  494. package/dist/prompt-DfZLJLIn.js +0 -32
  495. package/dist/protected-RFGpakN9.d.ts +0 -38
  496. package/dist/pull-CvpINcMK.js +0 -1
  497. package/dist/run-DDwUaJDU.js +0 -1
  498. package/dist/sources-Xc4zkszI.d.ts +0 -190
  499. package/dist/stores-BUGNbJTt.d.ts +0 -30
  500. package/dist/supabase-hook-CCw5m35C.js +0 -1
  501. package/dist/supautils-B6HYL9eL.js +0 -91
  502. package/dist/text-diff-BQcUapOb.js +0 -15
  503. package/dist/types-B3_ooZgZ.d.ts +0 -172
  504. package/dist/usage-CZpSQP6L.js +0 -1
  505. package/dist/version-CEbQ5UeM.js +0 -18
  506. package/dist/version-DXkYUISx.js +0 -1
  507. package/dist/watch--ovlPOc0.js +0 -1
@@ -1,4 +1,5 @@
1
- import { E as PermissionTree, H as AppDataSchema, N as ResourceNode, T as PermissionKind, U as MetaValue, V as AppData, a as RoleTree, i as RoleMeta, n as PlanTree, r as Role, t as Plan, w as Permission } from "./vocabulary-CN8H_9UF.js";
1
+ import { M as AppData, N as AppDataSchema, P as MetaValue, b as ResourceNode, d as PermissionKind, f as PermissionTree, k as POLICY_SCOPES, u as Permission } from "./permission-types-CAY-GU7e.js";
2
+ import { a as RoleTree, i as RoleMeta, n as PlanTree, r as Role, t as Plan } from "./vocabulary-DEJ5j4mR.js";
2
3
  //#region src/conditions/ast.d.ts
3
4
  type ConditionRef = {
4
5
  readonly ref: string;
@@ -63,27 +64,34 @@ type RelatedCondition = {
63
64
  readonly op: "related";
64
65
  readonly resource: string;
65
66
  readonly relation: string;
66
- /** The row's own id field, or (with `parent` or `hops`) the field holding the next instance's id. */
67
+ /**
68
+ * The row's own id field, or (with `parent` or `hops`) the field holding the
69
+ * next instance's id.
70
+ */
67
71
  readonly field: string;
68
- /** Parent hops walked above the first `resource` instance; `0` reads only that instance. */
72
+ /**
73
+ * Parent hops walked above the first `resource` instance; `0` reads only that
74
+ * instance.
75
+ */
69
76
  readonly depth: number;
70
77
  /** The row is a child of `resource`, reached through `field`. */
71
78
  readonly parent?: true;
72
79
  /**
73
- * To-one links from the row to `resource`: `field` points at the first
74
- * hop's resource, each later hop follows `link` on the resource before it,
75
- * and the last hop's resource is `resource`.
80
+ * To-one links from the row to `resource`: `field` points at the first hop's
81
+ * resource, each later hop follows `link` on the resource before it, and the
82
+ * last hop's resource is `resource`.
76
83
  */
77
84
  readonly hops?: readonly RelatedHop[];
78
85
  /**
79
- * The `resource` instances the subject holds a resource role on; replaces
80
- * the `relation` lookup (`relation` is then empty).
86
+ * The `resource` instances the subject holds a resource role on; replaces the
87
+ * `relation` lookup (`relation` is then empty).
81
88
  */
82
89
  readonly ids?: readonly string[];
83
90
  readonly permission?: string;
84
91
  /**
85
92
  * The row's boolean column that keeps ancestor grants out: with `parent` or
86
- * `hops`, a restricted row matches nothing; without, the walk stops at the row.
93
+ * `hops`, a restricted row matches nothing; without, the walk stops at the
94
+ * row.
87
95
  */
88
96
  readonly restricted?: string;
89
97
  readonly restrictedAncestors?: RestrictedAncestors;
@@ -116,10 +124,10 @@ type SqlFunctionCondition = {
116
124
  readonly twin: Condition;
117
125
  };
118
126
  /**
119
- * The request's session was checked against the Auth server while the
120
- * subject was resolved (`liveSession: true`), not only verified from the
121
- * token: a revoked session still verifies until `exp`. Written
122
- * `{ subject: { session: { live: true } } }`.
127
+ * The request's session was checked against the Auth server while the subject
128
+ * was resolved (`liveSession: true`), not only verified from the token: a
129
+ * revoked session still verifies until `exp`. Written `{ subject: { session: {
130
+ * live: true } } }`.
123
131
  */
124
132
  type LiveSessionCondition = {
125
133
  readonly op: "liveSession";
@@ -144,14 +152,18 @@ type FieldOperator = {
144
152
  readonly notIn?: unknown;
145
153
  readonly isNull?: boolean;
146
154
  };
147
- type WhereShorthand<T = Record<string, unknown>> = {
155
+ type WhereShorthand<T = Record<string, unknown>> = unknown extends T ? RowWhere<Record<string, unknown>> : RowWhere<T>;
156
+ type RowWhere<T> = {
148
157
  readonly and?: readonly WhereShorthand<T>[];
149
158
  readonly or?: readonly WhereShorthand<T>[];
150
159
  readonly not?: WhereShorthand<T>;
151
160
  } & ("subject" extends keyof T ? { readonly [K in keyof T as Exclude<K, "subject">]?: FieldWhere<T[K]>; } & {
152
161
  readonly subject?: SubjectWhere | FieldWhere<T["subject"]>;
153
162
  } : { readonly [K in keyof T]?: FieldWhere<T[K]>; } & {
154
- /** Holds only when the resolver checked the session live (`liveSession: true`). */
163
+ /**
164
+ * Holds only when the resolver checked the session live (`liveSession:
165
+ * true`).
166
+ */
155
167
  readonly subject?: SubjectWhere;
156
168
  });
157
169
  type SubjectWhere = {
@@ -172,11 +184,20 @@ type FieldWhere<V> = V | FieldOperator | {
172
184
  * credential kinds, delivery channels) stays closed.
173
185
  */
174
186
  type OpenUnion<T extends string> = T | (string & NonNullable<unknown>);
175
- /** `actor.kind`: the values PermDock's adapters set, or an integrator's own; a policy delegation matches it by equality. */
187
+ /**
188
+ * `actor.kind`: the values PermDock's adapters set, or an integrator's own; a
189
+ * policy delegation matches it by equality.
190
+ */
176
191
  type ActorKind = OpenUnion<"mcp-client" | "oauth-client" | "support" | "impersonation" | "ai-sdk" | "claude-agent" | "openai-agent" | "eve" | "terminal" | "web-bot-auth" | "a2a-agent" | "automation" | "job" | "caller" | "workload">;
177
- /** The adapter a decision event names: a PermDock entry, or an integrator's own adapter. */
192
+ /**
193
+ * The adapter a decision event names: a PermDock entry, or an integrator's own
194
+ * adapter.
195
+ */
178
196
  type AdapterId = OpenUnion<"server" | "next" | "hono" | "express" | "fastify" | "elysia" | "nest" | "node" | "h3" | "sveltekit" | "astro" | "solid-start" | "tanstack-start" | "trpc" | "orpc" | "supabase-middleware" | "convex" | "authzen" | "mcp" | "a2a" | "agent" | "ai-sdk" | "claude-agent" | "openai" | "eve" | "terminal" | "webmcp" | "workflow" | "chat" | "delivery">;
179
- /** How a membership was obtained (`membership.via`); `viaOnly` and support rules match it by equality. */
197
+ /**
198
+ * How a membership was obtained (`membership.via`); `viaOnly` and support rules
199
+ * match it by equality.
200
+ */
180
201
  type MembershipVia = OpenUnion<"direct" | "contact" | "credential" | "elevated" | "feed" | "link" | "share" | "support" | "support-session" | "scim">;
181
202
  //#endregion
182
203
  //#region src/core/subject.d.ts
@@ -209,8 +230,8 @@ type Assurance = {
209
230
  /**
210
231
  * Roles held in one scope instance (`scope` + `id`, with the id of every
211
232
  * ancestor scope in `within`) or on one resource (`on`). Evaluation only sees
212
- * the canonical form; `tenant` / `team` are accepted as input for the first
213
- * and second declared scope and normalised away.
233
+ * the canonical form; `tenant` / `team` are accepted as input for the first and
234
+ * second declared scope and normalised away.
214
235
  */
215
236
  type Membership = {
216
237
  readonly scope?: string;
@@ -221,26 +242,44 @@ type Membership = {
221
242
  readonly id: string;
222
243
  };
223
244
  readonly roles: readonly string[];
224
- /** Roles the holder may activate here but does not hold; `permdock.activate` writes an elevated membership. */
245
+ /**
246
+ * Roles the holder may activate here but does not hold; `permdock.activate`
247
+ * writes an elevated membership.
248
+ */
225
249
  readonly eligible?: readonly string[];
226
250
  readonly via?: MembershipVia;
227
251
  readonly expiresAt?: number;
228
- /** The principal id that wrote this membership: who elevated, consented to or granted the access. */
252
+ /**
253
+ * The principal id that wrote this membership: who elevated, consented to or
254
+ * granted the access.
255
+ */
229
256
  readonly grantedBy?: string;
230
- /** Free text recording why the membership was written: the activation or consent justification. */
257
+ /**
258
+ * Free text recording why the membership was written: the activation or
259
+ * consent justification.
260
+ */
231
261
  readonly reason?: string;
232
- /** A subgroup the holder belongs to inside the instance (`vendor-support`); a `junctionMembershipSource` group column fills it. */
262
+ /**
263
+ * A subgroup the holder belongs to inside the instance (`vendor-support`); a
264
+ * `junctionMembershipSource` group column fills it.
265
+ */
233
266
  readonly member?: {
234
267
  readonly group: string;
235
268
  };
236
- /** `idp`: the identity provider (SCIM) owns this membership; the application must not edit it. */
269
+ /**
270
+ * `idp`: the identity provider (SCIM) owns this membership; the application
271
+ * must not edit it.
272
+ */
237
273
  readonly managedBy?: "idp";
238
- /** Seats this membership holds (`dev-mode`, `editor`); `plan()` grantees match them inside the active tenant. */
274
+ /**
275
+ * Seats this membership holds (`dev-mode`, `editor`); `plan()` grantees match
276
+ * them inside the active tenant.
277
+ */
239
278
  readonly entitlements?: readonly string[];
240
279
  /**
241
- * Set when the instance or an ancestor instance is suspended: the
242
- * permission keys the membership still grants (`suspension.scopes.<scope>.keep`).
243
- * Every other grant, allow or deny, ignores it, and so do role listings.
280
+ * Set when the instance or an ancestor instance is suspended: the permission
281
+ * keys the membership still grants (`suspension.scopes.<scope>.keep`). Every
282
+ * other grant, allow or deny, ignores it, and so do role listings.
244
283
  */
245
284
  readonly keep?: readonly string[];
246
285
  /**
@@ -256,13 +295,16 @@ type Membership = {
256
295
  readonly team?: string;
257
296
  };
258
297
  /**
259
- * One permission a custom role adds or removes. It names a declared
260
- * permission key and carries no condition, approval or limit of its own.
298
+ * One permission a custom role adds or removes. It names a declared permission
299
+ * key and carries no condition, approval or limit of its own.
261
300
  */
262
301
  type CustomRoleGrant = {
263
302
  readonly permission: string;
264
303
  readonly effect?: "allow" | "deny";
265
- /** A level the permission's resource declares (`resource(…, { levels })`); allows only. */
304
+ /**
305
+ * A level the permission's resource declares (`resource(…, { levels })`);
306
+ * allows only.
307
+ */
266
308
  readonly level?: string;
267
309
  };
268
310
  type CustomRoleBody = {
@@ -270,9 +312,9 @@ type CustomRoleBody = {
270
312
  readonly includes?: readonly string[];
271
313
  readonly grants?: readonly CustomRoleGrant[];
272
314
  /**
273
- * Display text and app data, carried onto the role leaf
274
- * `assignableRoles()` returns. `x` is checked by the role tree's
275
- * `defineRoles(…, { x })` schema; an invalid `x` is dropped, not the role.
315
+ * Display text and app data, carried onto the role leaf `assignableRoles()`
316
+ * returns. `x` is checked by the role tree's `defineRoles(…, { x })` schema;
317
+ * an invalid `x` is dropped, not the role.
276
318
  */
277
319
  readonly meta?: RoleMeta;
278
320
  };
@@ -280,7 +322,10 @@ type CustomRoleBody = {
280
322
  type TenantCustomRole = CustomRoleBody & {
281
323
  /** The instance of the first scope that owns the role. */
282
324
  readonly tenant: string;
283
- /** The scope the role is held at; defaults to the first scope. Its ceiling is that scope's assignable roles. */
325
+ /**
326
+ * The scope the role is held at; defaults to the first scope. Its ceiling is
327
+ * that scope's assignable roles.
328
+ */
284
329
  readonly scope?: string;
285
330
  /** Pins the role to one instance of `scope`. */
286
331
  readonly id?: string;
@@ -301,14 +346,17 @@ type GlobalCustomRole = CustomRoleBody & {
301
346
  readonly shared?: undefined;
302
347
  };
303
348
  /**
304
- * A role the platform defines once for every tenant, held on memberships of
305
- * its scope in any tenant. Tenant admins assign it but never edit it. Its
306
- * ceiling is the assignable declared roles of its scope; its name wins over
307
- * a tenant custom role of the same name.
349
+ * A role the platform defines once for every tenant, held on memberships of its
350
+ * scope in any tenant. Tenant admins assign it but never edit it. Its ceiling
351
+ * is the assignable declared roles of its scope; its name wins over a tenant
352
+ * custom role of the same name.
308
353
  */
309
354
  type SharedCustomRole = CustomRoleBody & {
310
355
  readonly shared: true;
311
- /** The scope the role is held at, never `'global'`; defaults to the first scope. */
356
+ /**
357
+ * The scope the role is held at, never `'global'`; defaults to the first
358
+ * scope.
359
+ */
312
360
  readonly scope?: string;
313
361
  readonly tenant?: undefined;
314
362
  readonly id?: undefined;
@@ -319,20 +367,28 @@ type Principal = {
319
367
  readonly id: string;
320
368
  readonly issuer?: string;
321
369
  /**
322
- * `contact`: an external person (a customer contact, a portal user). Only
323
- * its `{ on }` memberships count; it never approves, creates keys or
324
- * publishes, and is read-only unless a role whose `for` lists `contact`
325
- * grants the write.
370
+ * `contact`: an external person (a customer contact, a portal user). Only its
371
+ * `{ on }` memberships count; it never approves, creates keys or publishes,
372
+ * and is read-only unless a role whose `for` lists `contact` grants the
373
+ * write.
326
374
  */
327
375
  readonly kind?: "user" | "service" | "workload" | "link" | "feed" | "contact";
328
376
  readonly roles?: readonly string[];
329
377
  readonly plans?: readonly string[];
330
378
  readonly memberships?: readonly Membership[];
331
- /** The token dropped memberships to stay under its size budget; a `claimsFirst` source reads the rest. */
379
+ /**
380
+ * The token dropped memberships to stay under its size budget; a
381
+ * `claimsFirst` source reads the rest.
382
+ */
332
383
  readonly membershipsTruncated?: boolean;
333
384
  /** The authorization version the token was minted at (`authz_ver`). */
334
385
  readonly authzVersion?: number;
335
386
  readonly tenant?: string;
387
+ /**
388
+ * Set by core when a requested tenant is not one the subject holds: the
389
+ * denial is then `no-membership`, not `no-tenant`. Never read from a token.
390
+ */
391
+ readonly unheldTenant?: string;
336
392
  readonly assurance?: Assurance;
337
393
  readonly binding?: Binding;
338
394
  readonly [key: string]: unknown;
@@ -341,9 +397,16 @@ type Actor = {
341
397
  readonly id: string;
342
398
  readonly kind: ActorKind;
343
399
  readonly binding?: Binding;
344
- /** `true` denies every permission without `readOnlyHint` (`not-delegated`), with or without a policy delegation. */
400
+ /**
401
+ * `true` denies every permission without `readOnlyHint` (`not-delegated`),
402
+ * with or without a policy delegation.
403
+ */
345
404
  readonly readOnly?: boolean;
346
- /** The stable name the application gives this OAuth client (`ClientNames`), set by the subject resolver from the verified client id; policy delegations match it with `to: { kind, client }`. */
405
+ /**
406
+ * The stable name the application gives this OAuth client (`ClientNames`),
407
+ * set by the subject resolver from the verified client id; policy delegations
408
+ * match it with `to: { kind, client }`.
409
+ */
347
410
  readonly client?: string;
348
411
  readonly [key: string]: unknown;
349
412
  };
@@ -366,7 +429,10 @@ type Subject<TPrincipal extends Principal = Principal> = {
366
429
  readonly context: Readonly<Record<string, unknown>>;
367
430
  readonly session?: string;
368
431
  readonly expiresAt?: number;
369
- /** The token's memberships are behind the source's authorization version: `fresh` permissions deny. */
432
+ /**
433
+ * The token's memberships are behind the source's authorization version:
434
+ * `fresh` permissions deny.
435
+ */
370
436
  readonly stale?: true;
371
437
  /**
372
438
  * The resolver checked the session against the Auth server for this request
@@ -377,8 +443,11 @@ type Subject<TPrincipal extends Principal = Principal> = {
377
443
  };
378
444
  //#endregion
379
445
  //#region src/core/decision.d.ts
380
- type DenialReason = "no-grant" | "condition" | "deny" | "inactive-grant" | "closure-error" | "opaque-condition" | "server-only" | "anonymous" | "not-delegated" | "no-delegation" | "agent-tool-not-delegated" | "insufficient-user-authentication" | "not-entitled" | "purpose" | "reason-required" | "actor-required" | "limit" | "limit-unavailable" | "relation-depth" | "relation-unavailable" | "validation" | "tenant-mismatch" | "no-membership" | "scope" | "expired-membership" | "stale-credentials" | "unknown-role" | "last-holder" | "max-holders" | "transfer-only" | "not-assignable-by" | "self-demotion" | "externally-managed" | "not-allowed-for-membership" | "conflicting-role" | "approval" | "stale-approval" | "pdp-denied" | "pdp-unavailable" | "pdp-invalid-response" | "undocumented" | "unsupported" | "exceeds-creator" | "credential-policy";
381
- /** The `detail` each denial reason carries, where PermDock sets a structured one. */
446
+ type DenialReason = "no-grant" | "condition" | "deny" | "inactive-grant" | "closure-error" | "opaque-condition" | "server-only" | "anonymous" | "not-delegated" | "no-delegation" | "agent-tool-not-delegated" | "insufficient-user-authentication" | "not-entitled" | "purpose" | "reason-required" | "actor-required" | "limit" | "limit-unavailable" | "relation-depth" | "relation-unavailable" | "validation" | "tenant-mismatch" | "no-membership" | "no-tenant" | "scope" | "expired-membership" | "stale-credentials" | "unknown-role" | "last-holder" | "max-holders" | "transfer-only" | "not-assignable-by" | "self-demotion" | "externally-managed" | "not-allowed-for-membership" | "conflicting-role" | "approval" | "stale-approval" | "pdp-denied" | "pdp-unavailable" | "pdp-invalid-response" | "undocumented" | "unsupported" | "exceeds-creator" | "credential-policy";
447
+ /**
448
+ * The `detail` each denial reason carries, where PermDock sets a structured
449
+ * one.
450
+ */
382
451
  type DenialDetails = {
383
452
  readonly limit: LimitDetail;
384
453
  /** The window the inactive allow applies in. */
@@ -410,18 +479,21 @@ type MatchedGrant = {
410
479
  readonly check?: Grant["check"];
411
480
  readonly approval?: "human" | ApprovalRequirement;
412
481
  readonly provider?: string;
413
- /** The hosted policy document fingerprint and grant id, when a hosted grant matched. */
482
+ /**
483
+ * The hosted policy document fingerprint and grant id, when a hosted grant
484
+ * matched.
485
+ */
414
486
  readonly hosted?: HostedGrantRef;
415
487
  /** A break-glass grant overrode a matching deny. */
416
488
  readonly breakGlass?: true;
417
489
  };
418
490
  /**
419
491
  * Something the caller owes alongside a granted action. `over-limit`: a soft
420
- * `limit` was past its count; `near-limit`: usage reached `alertAt`.
421
- * `notify` / `review`: a break-glass grant's declared follow-ups.
422
- * `justify`: the break-glass reason, carried so audit records why.
423
- * `app`: a follow-up the application declared on the grant
424
- * (`allow(p, { obligations })`); PermDock carries it and never acts on it.
492
+ * `limit` was past its count; `near-limit`: usage reached `alertAt`. `notify` /
493
+ * `review`: a break-glass grant's declared follow-ups. `justify`: the
494
+ * break-glass reason, carried so audit records why. `app`: a follow-up the
495
+ * application declared on the grant (`allow(p, { obligations })`); PermDock
496
+ * carries it and never acts on it.
425
497
  */
426
498
  type Obligation = {
427
499
  readonly kind: "over-limit" | "near-limit" | "notify" | "review";
@@ -442,8 +514,8 @@ type Quota = {
442
514
  readonly resetsAt: string;
443
515
  };
444
516
  /**
445
- * The `detail` of a `limit` denial: the grant's `count`, its `per` window
446
- * in seconds and when the window resets (RFC 3339).
517
+ * The `detail` of a `limit` denial: the grant's `count`, its `per` window in
518
+ * seconds and when the window resets (RFC 3339).
447
519
  */
448
520
  type LimitDetail = {
449
521
  readonly count: number;
@@ -451,28 +523,32 @@ type LimitDetail = {
451
523
  readonly resetsAt: string;
452
524
  };
453
525
  /**
454
- * Why a candidate grant for the permission was passed over before its
455
- * condition ran: `via-only` (the subject holds no membership of its kind),
456
- * `purpose` (no asserted purpose it lists), `field` (its `fields` do not
457
- * cover the requested field), `grantee` (its `to` did not match and added no
458
- * denial), `role` (a role it names is not held), `validity` (a deny outside
459
- * its `validFrom` / `validUntil`; an inactive allow adds an `inactive-grant`
460
- * denial instead), `break-glass-inactive` (a break-glass grant with no
461
- * asserted purpose).
526
+ * Why a candidate grant for the permission was passed over before its condition
527
+ * ran: `via-only` (the subject holds no membership of its kind), `purpose` (no
528
+ * asserted purpose it lists), `field` (its `fields` do not cover the requested
529
+ * field), `grantee` (its `to` did not match and added no denial), `role` (a
530
+ * role it names is not held), `validity` (a deny outside its `validFrom` /
531
+ * `validUntil`; an inactive allow adds an `inactive-grant` denial instead),
532
+ * `break-glass-inactive` (a break-glass grant with no asserted purpose).
462
533
  */
463
- type TraceSkipReason = "via-only" | "purpose" | "field" | "grantee" | "role" | "validity" | "break-glass-inactive";
534
+ type TraceSkipReason = "via-only" | "purpose" | "field" | "grantee" | "role" | "validity" | "unknown-level" | "break-glass-inactive";
464
535
  type TraceSkip = {
465
536
  readonly role: string | null;
466
537
  readonly permission: string;
467
538
  readonly effect: "allow" | "deny";
468
539
  readonly why: TraceSkipReason;
540
+ /**
541
+ * The level a custom role names that its resource does not declare, for
542
+ * `unknown-level`.
543
+ */
544
+ readonly level?: string;
469
545
  };
470
546
  /**
471
- * What `explain` saw: how many candidate grants it examined before the
472
- * outcome, which allows matched (including the ones a deny overrode), which
473
- * denies matched, and which grants it passed over. `denies[0]` is the deny
474
- * that produced a `deny` outcome, or the deny a break-glass grant lifted.
475
- * Pure local computation; never on a decision event.
547
+ * What `explain` saw: how many candidate grants it examined before the outcome,
548
+ * which allows matched (including the ones a deny overrode), which denies
549
+ * matched, and which grants it passed over. `denies[0]` is the deny that
550
+ * produced a `deny` outcome, or the deny a break-glass grant lifted. Pure local
551
+ * computation; never on a decision event.
476
552
  */
477
553
  type Trace = {
478
554
  readonly evaluated: number;
@@ -499,8 +575,8 @@ type GrantedDecision = {
499
575
  type DeniedDecision = {
500
576
  readonly outcome: "denied";
501
577
  /**
502
- * The key of the permission that was checked. Absent on a denial for a
503
- * check that named no declared permission.
578
+ * The key of the permission that was checked. Absent on a denial for a check
579
+ * that named no declared permission.
504
580
  */
505
581
  readonly permission?: string;
506
582
  readonly denials: readonly Denial[];
@@ -547,7 +623,10 @@ type RelationGrantee = {
547
623
  * to `resource`, then walk its parents only when `depth` is set.
548
624
  */
549
625
  readonly through?: "parent" | readonly string[];
550
- /** Parent hops walked above the first `resource` instance; absent means `DEFAULT_RELATION_DEPTH` for `'parent'` and `0` for links. */
626
+ /**
627
+ * Parent hops walked above the first `resource` instance; absent means
628
+ * `DEFAULT_RELATION_DEPTH` for `'parent'` and `0` for links.
629
+ */
551
630
  readonly depth?: number;
552
631
  };
553
632
  type PlanGrantee = {
@@ -596,23 +675,26 @@ type UserApprover = {
596
675
  readonly id: string;
597
676
  };
598
677
  /**
599
- * Whoever holds `permission` in the request's tenant, through any role,
600
- * custom roles included. Checked only through verdict facts
601
- * (`ApprovalVerdict.permissions`) that the handler computes from the
602
- * approver's own instance.
678
+ * Whoever holds `permission` in the request's tenant, through any role, custom
679
+ * roles included. Checked only through verdict facts
680
+ * (`ApprovalVerdict.permissions`) that the handler computes from the approver's
681
+ * own instance.
603
682
  */
604
683
  type PermissionApprover = {
605
684
  readonly kind: "permission";
606
685
  readonly permission: string;
607
686
  };
608
- /** An approver who matches at least one item; an item that is a list matches when every entry does. */
687
+ /**
688
+ * An approver who matches at least one item; an item that is a list matches
689
+ * when every entry does.
690
+ */
609
691
  type AnyOfApprover = {
610
692
  readonly kind: "any-of";
611
693
  readonly of: readonly (Approver | readonly Approver[])[];
612
694
  };
613
695
  /**
614
- * Who may approve: a subject-only grantee, a `relation()` the approver holds
615
- * on the requested row (checked when the verdict is given), `user(id)`,
696
+ * Who may approve: a subject-only grantee, a `relation()` the approver holds on
697
+ * the requested row (checked when the verdict is given), `user(id)`,
616
698
  * `holder(permission)`, or `anyOf(...)`. A list (or `allOf(...)`) matches an
617
699
  * approver who satisfies every item.
618
700
  */
@@ -621,7 +703,10 @@ type ApproverInput = GranteeInput | UserApprover | PermissionApprover | {
621
703
  readonly kind: "any-of";
622
704
  readonly of: readonly ApproverInput[];
623
705
  } | readonly ApproverInput[];
624
- /** Approves when the approver holds `permission` in the request's tenant (any role, custom roles included). */
706
+ /**
707
+ * Approves when the approver holds `permission` in the request's tenant (any
708
+ * role, custom roles included).
709
+ */
625
710
  declare function holder(permission: Permission): PermissionApprover;
626
711
  /** Approves when the approver matches any one of `items`. */
627
712
  declare function anyOf(...items: readonly ApproverInput[]): {
@@ -634,29 +719,35 @@ declare function allOf(...items: readonly ApproverInput[]): readonly ApproverInp
634
719
  declare function user(id: string): UserApprover;
635
720
  //#endregion
636
721
  //#region src/core/scopes.d.ts
637
- /** One entry of `definePolicy({ scopes })`: the row field holding the scope id, and its parent scope. */
722
+ /**
723
+ * One entry of `definePolicy({ scopes })`: the row field holding the scope id,
724
+ * and its parent scope.
725
+ */
638
726
  type ScopeDeclaration = {
639
727
  readonly key: string;
640
728
  readonly within?: string;
641
729
  };
642
730
  type PolicyScopesInput = Readonly<Record<string, ScopeDeclaration>>;
643
731
  /**
644
- * A declared scope, in declaration order. `key` is absent only on the
645
- * implicit `tenant` / `team` pair of a policy that declares no scopes.
732
+ * A declared scope, in declaration order. `key` is absent only on the implicit
733
+ * `tenant` / `team` pair of a policy that declares no scopes.
646
734
  */
647
735
  type Scope = {
648
736
  readonly name: string;
649
737
  readonly key?: string;
650
738
  readonly within?: string;
651
739
  };
652
- /** The names `role(..., { on })`, `memberOf` and memberships may use: declared names plus the aliases. */
740
+ /**
741
+ * The names `role(..., { on })`, `memberOf` and memberships may use: declared
742
+ * names plus the aliases.
743
+ */
653
744
  type ScopeNames<S> = [S] extends [PolicyScopesInput] ? string extends keyof S ? string : (keyof S & string) | "tenant" | "team" : string;
654
745
  //#endregion
655
746
  //#region src/core/wire-delegation.d.ts
656
747
  /**
657
- * A delegation as every PermDock wire form carries it: OAuth `scope`
658
- * (RFC 6749, space-separated) and RFC 9396 `authorization_details`. An empty
659
- * `scope` is an empty scope list, which delegates nothing.
748
+ * A delegation as every PermDock wire form carries it: OAuth `scope` (RFC 6749,
749
+ * space-separated) and RFC 9396 `authorization_details`. An empty `scope` is an
750
+ * empty scope list, which delegates nothing.
660
751
  */
661
752
  type WireDelegation = {
662
753
  readonly scope?: string;
@@ -667,9 +758,9 @@ type WireDelegation = {
667
758
  //#region src/core/wire-denial.d.ts
668
759
  /**
669
760
  * A denial as it leaves the process: in a decision event, a Problem Details
670
- * body, an MCP or WebMCP refusal and the decision endpoint. `detail` is a
671
- * JSON value (a string, or `LimitDetail` on `limit`); what a closure threw
672
- * and a validation error stay in process.
761
+ * body, an MCP or WebMCP refusal and the decision endpoint. `detail` is a JSON
762
+ * value (a string, or `LimitDetail` on `limit`); what a closure threw and a
763
+ * validation error stay in process.
673
764
  */
674
765
  type WireDenial = {
675
766
  readonly role: string | null;
@@ -677,7 +768,10 @@ type WireDenial = {
677
768
  readonly to?: Grantee | readonly Grantee[];
678
769
  readonly detail?: unknown;
679
770
  };
680
- /** A `Decision` whose denials are `WireDenial`s, as the decision endpoint sends it. */
771
+ /**
772
+ * A `Decision` whose denials are `WireDenial`s, as the decision endpoint sends
773
+ * it.
774
+ */
681
775
  type WireDecision = GrantedDecision | ApprovalRequiredDecision | (Omit<DeniedDecision, "denials"> & {
682
776
  readonly denials: readonly WireDenial[];
683
777
  });
@@ -701,7 +795,10 @@ type DirectoryEvent = {
701
795
  readonly iss?: string;
702
796
  };
703
797
  readonly active?: boolean;
704
- /** The application's own data, set where the event is built; plain JSON, never read by a decision. */
798
+ /**
799
+ * The application's own data, set where the event is built; plain JSON, never
800
+ * read by a decision.
801
+ */
705
802
  readonly x?: AppData;
706
803
  };
707
804
  type MembershipEvent = {
@@ -712,7 +809,10 @@ type MembershipEvent = {
712
809
  readonly principal: {
713
810
  readonly id: string;
714
811
  };
715
- /** A declared scope name, or the `tenant` / `team` alias; absent for a global role change. */
812
+ /**
813
+ * A declared scope name, or the `tenant` / `team` alias; absent for a global
814
+ * role change.
815
+ */
716
816
  readonly scope?: string;
717
817
  /** The scope instance; present exactly when `scope` is. */
718
818
  readonly id?: string;
@@ -729,13 +829,16 @@ type MembershipEvent = {
729
829
  readonly id: string;
730
830
  readonly kind: string;
731
831
  };
732
- /** The application's own data, set where the event is built; plain JSON, never read by a decision. */
832
+ /**
833
+ * The application's own data, set where the event is built; plain JSON, never
834
+ * read by a decision.
835
+ */
733
836
  readonly x?: AppData;
734
837
  };
735
838
  /**
736
839
  * An API key's lifecycle: `created`, `rotated` and `revoked` from the
737
- * application or a credential store, `used` from `subjectFromApiKey`. A
738
- * `used` event carries `sample`, the fraction of uses reported.
840
+ * application or a credential store, `used` from `subjectFromApiKey`. A `used`
841
+ * event carries `sample`, the fraction of uses reported.
739
842
  */
740
843
  type CredentialEvent = {
741
844
  readonly type: "credential";
@@ -757,7 +860,10 @@ type CredentialEvent = {
757
860
  readonly kind: string;
758
861
  };
759
862
  readonly sample?: number;
760
- /** The application's own data, set where the event is built; plain JSON, never read by a decision. */
863
+ /**
864
+ * The application's own data, set where the event is built; plain JSON, never
865
+ * read by a decision.
866
+ */
761
867
  readonly x?: AppData;
762
868
  };
763
869
  /**
@@ -793,7 +899,10 @@ type AutomationEvent = {
793
899
  readonly id: string;
794
900
  readonly kind: string;
795
901
  };
796
- /** The application's own data, set where the event is built; plain JSON, never read by a decision. */
902
+ /**
903
+ * The application's own data, set where the event is built; plain JSON, never
904
+ * read by a decision.
905
+ */
797
906
  readonly x?: AppData;
798
907
  };
799
908
  type SinkEvent = DecisionEvent | DirectoryEvent | MembershipEvent | CredentialEvent | AccessEvent | AutomationEvent | DeliveryEvent;
@@ -802,14 +911,14 @@ type DeliveryChannel = "email" | "chat" | "webhook";
802
911
  /** What an email is for; only `notification` mail carries `List-Unsubscribe`. */
803
912
  type EmailCategory = "transactional" | "notification" | "security" | "approval";
804
913
  /**
805
- * Why a delivery failed. `denied` and `unlinked` are the router's refusals of
806
- * a recipient; the rest come from a transport or a provider webhook.
914
+ * Why a delivery failed. `denied` and `unlinked` are the router's refusals of a
915
+ * recipient; the rest come from a transport or a provider webhook.
807
916
  */
808
917
  type DeliveryFailureCause = "denied" | "unlinked" | "no-transport" | "no-message" | "invalid-recipient" | "invalid-message" | "rate-limited" | "quota-exceeded" | "unauthorized" | "unavailable" | "suppressed" | "rejected";
809
918
  /**
810
919
  * One recipient's delivery: `sent` when a transport accepted it, then
811
- * `delivered`, `bounced` or `complained` from the provider, or `failed`.
812
- * It carries no address, only the principal the router checked.
920
+ * `delivered`, `bounced` or `complained` from the provider, or `failed`. It
921
+ * carries no address, only the principal the router checked.
813
922
  */
814
923
  type DeliveryEvent = {
815
924
  readonly type: "delivery";
@@ -822,7 +931,10 @@ type DeliveryEvent = {
822
931
  readonly id: string;
823
932
  readonly key: string;
824
933
  };
825
- /** The checked principal, or `trusted` for an address the server loaded itself. */
934
+ /**
935
+ * The checked principal, or `trusted` for an address the server loaded
936
+ * itself.
937
+ */
826
938
  readonly recipient?: {
827
939
  readonly principal?: {
828
940
  readonly id: string;
@@ -846,7 +958,10 @@ type DeliveryEvent = {
846
958
  readonly retryable?: boolean;
847
959
  /** The denial reason when `cause` is `denied`. */
848
960
  readonly reason?: string;
849
- /** The application's own data, set where the event is built; plain JSON, never read by a decision. */
961
+ /**
962
+ * The application's own data, set where the event is built; plain JSON, never
963
+ * read by a decision.
964
+ */
850
965
  readonly x?: AppData;
851
966
  };
852
967
  /**
@@ -886,7 +1001,10 @@ type AccessEvent = {
886
1001
  };
887
1002
  /** A `SupportSession`'s permission keys. */
888
1003
  readonly permissions?: readonly string[];
889
- /** The application's own data, set where the event is built; plain JSON, never read by a decision. */
1004
+ /**
1005
+ * The application's own data, set where the event is built; plain JSON, never
1006
+ * read by a decision.
1007
+ */
890
1008
  readonly x?: AppData;
891
1009
  };
892
1010
  type DecisionEvent = {
@@ -910,14 +1028,20 @@ type DecisionEvent = {
910
1028
  readonly id: string;
911
1029
  readonly kind: string;
912
1030
  };
913
- /** OAuth `scope` and RFC 9396 `authorization_details`, as every wire form carries a delegation. */
1031
+ /**
1032
+ * OAuth `scope` and RFC 9396 `authorization_details`, as every wire form
1033
+ * carries a delegation.
1034
+ */
914
1035
  readonly delegation?: WireDelegation;
915
1036
  /** The API key the subject came from. */
916
1037
  readonly credential?: {
917
1038
  readonly id: string;
918
1039
  readonly kind: CredentialKind;
919
1040
  };
920
- /** The support session the subject came from: the `id` its `access` events carry as `session.id`. */
1041
+ /**
1042
+ * The support session the subject came from: the `id` its `access` events
1043
+ * carry as `session.id`.
1044
+ */
921
1045
  readonly supportSession?: {
922
1046
  readonly id: string;
923
1047
  };
@@ -941,7 +1065,10 @@ type DecisionEvent = {
941
1065
  };
942
1066
  /** What a granted decision owes, as on `GrantedDecision.obligations`. */
943
1067
  readonly obligations?: readonly Obligation[];
944
- /** Purposes of use the caller asserted (`context.purpose`); present when any was. */
1068
+ /**
1069
+ * Purposes of use the caller asserted (`context.purpose`); present when any
1070
+ * was.
1071
+ */
945
1072
  readonly purpose?: readonly string[];
946
1073
  /** The justification the caller supplied (`context.reason`); present when set. */
947
1074
  readonly reason?: string;
@@ -952,7 +1079,10 @@ type DecisionEvent = {
952
1079
  /** The call that produced the decision. */
953
1080
  readonly call: "can" | "decide" | "assert" | "filter" | "endpoint" | "adapter" | "approval" | "simulate" | "explain";
954
1081
  readonly adapter?: AdapterId;
955
- /** The model id the agent model gate decided, or the model that drove the call. */
1082
+ /**
1083
+ * The model id the agent model gate decided, or the model that drove the
1084
+ * call.
1085
+ */
956
1086
  readonly model?: string;
957
1087
  /** Set on an approval lifecycle event (`com.permdock.approval.<phase>`). */
958
1088
  readonly phase?: "requested" | "resolved" | "expired" | "cancelled";
@@ -961,7 +1091,10 @@ type DecisionEvent = {
961
1091
  readonly denied: number;
962
1092
  readonly approvalRequired: number;
963
1093
  };
964
- /** The application's own data, set where the event is built; plain JSON, never read by a decision. */
1094
+ /**
1095
+ * The application's own data, set where the event is built; plain JSON, never
1096
+ * read by a decision.
1097
+ */
965
1098
  readonly x?: AppData;
966
1099
  };
967
1100
  type AuthEvent = {
@@ -980,7 +1113,10 @@ type AuthEvent = {
980
1113
  //#region src/core/snapshot-types.d.ts
981
1114
  type Snapshot = {
982
1115
  readonly v: 1;
983
- /** RFC 3339. The epoch for a snapshot built without a clock. Signed, it is the token's `iat`. */
1116
+ /**
1117
+ * RFC 3339. The epoch for a snapshot built without a clock. Signed, it is the
1118
+ * token's `iat`.
1119
+ */
984
1120
  readonly issuedAt: string;
985
1121
  readonly subject: {
986
1122
  readonly principal: {
@@ -990,13 +1126,19 @@ type Snapshot = {
990
1126
  readonly tenant?: string;
991
1127
  readonly memberships?: readonly Membership[];
992
1128
  } | null;
993
- /** OAuth `scope` and RFC 9396 `authorization_details`, as the token carried them. */
1129
+ /**
1130
+ * OAuth `scope` and RFC 9396 `authorization_details`, as the token carried
1131
+ * them.
1132
+ */
994
1133
  readonly delegation?: WireDelegation;
995
1134
  readonly context: Readonly<Record<string, unknown>>;
996
1135
  };
997
1136
  /** Roles held in the active tenant, in rank order. */
998
1137
  readonly roles: readonly string[];
999
- /** The distinct `meta.audience` values of `roles`, in rank order; absent when none has one. */
1138
+ /**
1139
+ * The distinct `meta.audience` values of `roles`, in rank order; absent when
1140
+ * none has one.
1141
+ */
1000
1142
  readonly audiences?: readonly string[];
1001
1143
  readonly grants: readonly SnapshotGrant[];
1002
1144
  readonly tenants: readonly string[];
@@ -1008,18 +1150,24 @@ type Snapshot = {
1008
1150
  readonly roles?: Readonly<Record<string, Role>>;
1009
1151
  readonly plans?: Readonly<Record<string, Plan>>;
1010
1152
  };
1011
- /** The policy's scopes in order, so a client checks the row against each membership's instance. */
1153
+ /**
1154
+ * The policy's scopes in order, so a client checks the row against each
1155
+ * membership's instance.
1156
+ */
1012
1157
  readonly scopes?: readonly SnapshotScope[];
1013
- /** One entry per tenant in `tenants`: what the subject may hand out there. Absent without tenants. */
1158
+ /**
1159
+ * One entry per tenant in `tenants`: what the subject may hand out there.
1160
+ * Absent without tenants.
1161
+ */
1014
1162
  readonly assignable?: readonly SnapshotAssignable[];
1015
1163
  /**
1016
- * Allow grants of held roles that only a plan the subject lacks keeps
1017
- * from applying; they grant nothing and name the plan a denial asks for.
1164
+ * Allow grants of held roles that only a plan the subject lacks keeps from
1165
+ * applying; they grant nothing and name the plan a denial asks for.
1018
1166
  */
1019
1167
  readonly notEntitled?: readonly SnapshotNotEntitled[];
1020
1168
  /**
1021
- * The row id field per resource whose `id` option is not `id`, for the
1022
- * grants in `grants`. Absent when every one reads `id`.
1169
+ * The row id field per resource whose `id` option is not `id`, for the grants
1170
+ * in `grants`. Absent when every one reads `id`.
1023
1171
  */
1024
1172
  readonly ids?: Readonly<Record<string, string>>;
1025
1173
  /**
@@ -1030,7 +1178,10 @@ type Snapshot = {
1030
1178
  */
1031
1179
  readonly delegated?: readonly string[];
1032
1180
  };
1033
- /** A grant the subject would hold on another plan: its permission, role and `to`. */
1181
+ /**
1182
+ * A grant the subject would hold on another plan: its permission, role and
1183
+ * `to`.
1184
+ */
1034
1185
  type SnapshotNotEntitled = {
1035
1186
  readonly permission: string;
1036
1187
  readonly role: string | null;
@@ -1041,17 +1192,29 @@ type SnapshotScope = {
1041
1192
  readonly name: string;
1042
1193
  readonly key: string;
1043
1194
  readonly within?: string;
1044
- /** Resources whose rows this scope's key partitions, from their `memberOf` relations. */
1195
+ /**
1196
+ * Resources whose rows this scope's key partitions, from their `memberOf`
1197
+ * relations.
1198
+ */
1045
1199
  readonly resources?: readonly string[];
1046
- /** Resource name to the field holding this scope's id, for a resource whose field is not `key` (its own `id`). */
1200
+ /**
1201
+ * Resource name to the field holding this scope's id, for a resource whose
1202
+ * field is not `key` (its own `id`).
1203
+ */
1047
1204
  readonly fields?: Readonly<Record<string, string>>;
1048
1205
  };
1049
- /** The declared roles and the custom-role ceiling the subject may assign in one tenant. */
1206
+ /**
1207
+ * The declared roles and the custom-role ceiling the subject may assign in one
1208
+ * tenant.
1209
+ */
1050
1210
  type SnapshotAssignable = {
1051
1211
  readonly tenant: string;
1052
1212
  readonly roles: readonly string[];
1053
1213
  readonly permissions: readonly Permission[];
1054
- /** Permission key to the levels the subject may hand out; only permissions whose resource declares levels. */
1214
+ /**
1215
+ * Permission key to the levels the subject may hand out; only permissions
1216
+ * whose resource declares levels.
1217
+ */
1055
1218
  readonly levels?: Readonly<Record<string, readonly string[]>>;
1056
1219
  };
1057
1220
  type SnapshotGrant = {
@@ -1069,7 +1232,10 @@ type SnapshotGrant = {
1069
1232
  readonly membership?: Membership;
1070
1233
  readonly portable?: false;
1071
1234
  readonly fields?: readonly string[];
1072
- /** When the grant applies (RFC 3339, `from` inclusive, `until` exclusive); absent means always. */
1235
+ /**
1236
+ * When the grant applies (RFC 3339, `from` inclusive, `until` exclusive);
1237
+ * absent means always.
1238
+ */
1073
1239
  readonly validity?: WireValidity;
1074
1240
  /** The grant's declared `name`. */
1075
1241
  readonly name?: string;
@@ -1093,25 +1259,144 @@ type LocalSnapshotManifest = {
1093
1259
  readonly rank?: readonly string[];
1094
1260
  /** Every declared grant, without a membership. */
1095
1261
  readonly grants: readonly SnapshotGrant[];
1096
- /** Per custom-role scope (`global` for platform roles): the grants each entry resolves to. */
1262
+ /**
1263
+ * Per custom-role scope (`global` for platform roles): the grants each entry
1264
+ * resolves to.
1265
+ */
1097
1266
  readonly custom: Readonly<Record<string, LocalCustomRoleTable>>;
1267
+ /**
1268
+ * The synced tables a device reads the user's memberships, roles and custom
1269
+ * roles from; `permdock powersync generate` adds it.
1270
+ */
1271
+ readonly rows?: LocalSnapshotRows;
1272
+ /**
1273
+ * What a device needs to compute `Snapshot.assignable` for the active tenant
1274
+ * the way `assignableIn` does on the server.
1275
+ */
1276
+ readonly assignable?: LocalAssignable;
1277
+ };
1278
+ /**
1279
+ * The hand-out rules of a policy, as a device evaluates them over its synced
1280
+ * memberships and custom roles.
1281
+ */
1282
+ type LocalAssignable = {
1283
+ /**
1284
+ * Declared roles a tenant admin may hand out or compose, in rank order, with
1285
+ * the scope each sits on and its allow keys.
1286
+ */
1287
+ readonly roles: readonly {
1288
+ readonly name: string;
1289
+ readonly on: string;
1290
+ readonly allows: readonly string[];
1291
+ }[];
1292
+ /** Declared role names and permission keys with `meta.manageRoles: true`. */
1293
+ readonly manage: {
1294
+ readonly roles: readonly string[];
1295
+ readonly permissions: readonly string[];
1296
+ };
1297
+ /**
1298
+ * Declared role name to the roles it assigns, when any role declares
1299
+ * `assigns`.
1300
+ */
1301
+ readonly assigns?: Readonly<Record<string, readonly string[]>>;
1302
+ /** The first scope's custom-role ceiling, in declaration order. */
1303
+ readonly permissions: readonly Permission[];
1304
+ /** Permission key to its level names, in declaration order. */
1305
+ readonly levels?: Readonly<Record<string, readonly string[]>>;
1306
+ /** Index of an allow in `grants` to the levels a holder of it may hand out. */
1307
+ readonly grants?: Readonly<Record<string, readonly string[]>>;
1308
+ };
1309
+ /** A column of a synced table, or a value every row has. */
1310
+ type LocalRowValue = {
1311
+ readonly column: string;
1312
+ } | {
1313
+ readonly value: string;
1098
1314
  };
1099
- /** Grants a custom role entry resolves to, held by a placeholder role the client renames. */
1315
+ /**
1316
+ * A column that holds a role key or user id: the value itself, the `column` of
1317
+ * the synced `through` table whose `id` it references, or a value each maps to
1318
+ * a role key (`null` for no role).
1319
+ */
1320
+ type LocalRowColumn = {
1321
+ readonly column: string;
1322
+ } | {
1323
+ readonly column: string;
1324
+ readonly through: {
1325
+ readonly table: string;
1326
+ readonly id: string;
1327
+ readonly column: string;
1328
+ };
1329
+ } | {
1330
+ readonly column: string;
1331
+ readonly map: Readonly<Record<string, string | null>>;
1332
+ };
1333
+ /** One synced membership table. Table names are the device's table names. */
1334
+ type LocalMembershipRows = {
1335
+ readonly table: string;
1336
+ readonly user: LocalRowColumn;
1337
+ readonly scope: LocalRowValue;
1338
+ readonly id: string;
1339
+ /**
1340
+ * The role columns (the row holds every non-null key), or the fixed roles
1341
+ * every row holds.
1342
+ */
1343
+ readonly roles: readonly LocalRowColumn[] | {
1344
+ readonly value: readonly string[];
1345
+ };
1346
+ readonly via?: LocalRowValue;
1347
+ /** A row with a value in one of these columns is no membership on the device. */
1348
+ readonly expiresAt?: string;
1349
+ readonly disabledAt?: string;
1350
+ };
1351
+ type LocalSnapshotRows = {
1352
+ readonly memberships: readonly LocalMembershipRows[];
1353
+ /** The global roles table: one row per user and role. */
1354
+ readonly roles?: {
1355
+ readonly table: string;
1356
+ readonly user: string;
1357
+ /** The role columns; the row holds every non-null key. */
1358
+ readonly roles: readonly LocalRowColumn[];
1359
+ };
1360
+ /**
1361
+ * The custom-role tables (`tenant_id`, `scope`, `scope_id`, `role`, and
1362
+ * `permission`, `effect`, `level` or `include_role`).
1363
+ */
1364
+ readonly customRoles?: {
1365
+ readonly permissions: string;
1366
+ readonly includes: string;
1367
+ };
1368
+ };
1369
+ /**
1370
+ * Grants a custom role entry resolves to, held by a placeholder role the client
1371
+ * renames.
1372
+ */
1100
1373
  type LocalCustomRoleTable = {
1101
- /** `{ permission }` per permission key, and `{ permission, level }` per declared level. */
1374
+ /**
1375
+ * `{ permission }` per permission key, and `{ permission, level }` per
1376
+ * declared level.
1377
+ */
1102
1378
  readonly permissions: Readonly<Record<string, {
1103
1379
  readonly all: readonly SnapshotGrant[];
1104
1380
  readonly levels?: Readonly<Record<string, readonly SnapshotGrant[]>>;
1381
+ /** The levels a holder of `all` may hand out. */
1382
+ readonly reach?: readonly string[];
1383
+ /** Level to the levels a holder of `levels[level]` may hand out. */
1384
+ readonly levelReach?: Readonly<Record<string, readonly string[]>>;
1105
1385
  }>>;
1106
1386
  /** `includes: [role]` per declared role. */
1107
1387
  readonly includes: Readonly<Record<string, readonly SnapshotGrant[]>>;
1388
+ /**
1389
+ * Declared role to permission key to the levels a holder of its included
1390
+ * grants may hand out.
1391
+ */
1392
+ readonly includeReach?: Readonly<Record<string, Readonly<Record<string, readonly string[]>>>>;
1108
1393
  };
1109
1394
  //#endregion
1110
1395
  //#region src/core/time.d.ts
1111
1396
  /**
1112
- * The one time rule: NumericDate (whole seconds) for JWT registered claims
1113
- * and the claims SQL reads, RFC 3339 for every other JSON field, integer
1114
- * seconds for durations, and an `Instant` for every runtime `now`.
1397
+ * The one time rule: NumericDate (whole seconds) for JWT registered claims and
1398
+ * the claims SQL reads, RFC 3339 for every other JSON field, integer seconds
1399
+ * for durations, and an `Instant` for every runtime `now`.
1115
1400
  */
1116
1401
  /**
1117
1402
  * The part of a `Temporal.Instant` PermDock reads. Public options take it
@@ -1124,8 +1409,8 @@ type Instant = {
1124
1409
  //#endregion
1125
1410
  //#region src/core/internals.d.ts
1126
1411
  /**
1127
- * Any instance a feature function accepts: a server `PermDock`, one built
1128
- * from a snapshot, or an adapter's wrapper such as `PdpPermDock`.
1412
+ * Any instance a feature function accepts: a server `PermDock`, one built from
1413
+ * a snapshot, or an adapter's wrapper such as `PdpPermDock`.
1129
1414
  */
1130
1415
  type InstanceHandle = {
1131
1416
  readonly subject: Subject;
@@ -1133,19 +1418,26 @@ type InstanceHandle = {
1133
1418
  //#endregion
1134
1419
  //#region src/core/credential.d.ts
1135
1420
  type CredentialKind = "user" | "service" | "feed";
1136
- /** A feed id: lowercase, so a mail system that lowercases a local part still matches. At most 16 characters, so `pdfeed_<id>_<secret>` fits an email local part. */
1421
+ /**
1422
+ * A feed id: lowercase, so a mail system that lowercases a local part still
1423
+ * matches. At most 16 characters, so `pdfeed_<id>_<secret>` fits an email local
1424
+ * part.
1425
+ */
1137
1426
  declare function isFeedId(value: string): boolean;
1138
- /** One permission (a key) a credential may use: on every instance, or only on `ids`. */
1427
+ /**
1428
+ * One permission (a key) a credential may use: on every instance, or only on
1429
+ * `ids`.
1430
+ */
1139
1431
  type CredentialPermission = {
1140
1432
  readonly permission: string;
1141
1433
  readonly ids?: readonly string[];
1142
1434
  };
1143
1435
  /**
1144
- * Credential v1: what a verified API key stands for, never the secret. A
1145
- * `user` credential acts as its owner (`principal`) narrowed to
1146
- * `permissions`, and to the memberships inside `tenant` when it names one;
1147
- * a `service` credential is its own `service` principal holding `roles` in
1148
- * `tenant`, narrowed the same way.
1436
+ * Credential v1: what a verified API key stands for, never the secret. A `user`
1437
+ * credential acts as its owner (`principal`) narrowed to `permissions`, and to
1438
+ * the memberships inside `tenant` when it names one; a `service` credential is
1439
+ * its own `service` principal holding `roles` in `tenant`, narrowed the same
1440
+ * way.
1149
1441
  */
1150
1442
  type Credential = {
1151
1443
  readonly v: 1;
@@ -1154,12 +1446,15 @@ type Credential = {
1154
1446
  /** The owner of a `user` credential, or the id of the service principal. */
1155
1447
  readonly principal: string;
1156
1448
  /**
1157
- * The instance of the first scope the key is held to. Required on a
1158
- * service credential, where its roles are held; optional on a user
1159
- * credential, where it keeps only the owner's memberships inside it.
1449
+ * The instance of the first scope the key is held to. Required on a service
1450
+ * credential, where its roles are held; optional on a user credential, where
1451
+ * it keeps only the owner's memberships inside it.
1160
1452
  */
1161
1453
  readonly tenant?: string;
1162
- /** Service: the roles it holds in `tenant`. Feed: the resource roles it holds on `on`. */
1454
+ /**
1455
+ * Service: the roles it holds in `tenant`. Feed: the resource roles it holds
1456
+ * on `on`.
1457
+ */
1163
1458
  readonly roles?: readonly string[];
1164
1459
  /** Feed only: the resource instance the roles are held on. */
1165
1460
  readonly on?: {
@@ -1229,14 +1524,20 @@ type CredentialDecision = {
1229
1524
  } | {
1230
1525
  readonly outcome: "approval-required";
1231
1526
  readonly credential: Credential;
1232
- /** Bound to the credential's content and its creator; pass it as `approved` to resume. */
1527
+ /**
1528
+ * Bound to the credential's content and its creator; pass it as
1529
+ * `approved` to resume.
1530
+ */
1233
1531
  readonly token: string;
1234
1532
  } | {
1235
1533
  readonly outcome: "denied";
1236
1534
  readonly denials: readonly Denial[];
1237
1535
  };
1238
1536
  type DecideCredentialOptions = {
1239
- /** Where the tenant's `credentials` policy comes from. Without it, only the no-expiry rule applies. */
1537
+ /**
1538
+ * Where the tenant's `credentials` policy comes from. Without it, only the
1539
+ * no-expiry rule applies.
1540
+ */
1240
1541
  readonly settings?: SettingsSource;
1241
1542
  /** The `token` of an approval the application consumed for this request. */
1242
1543
  readonly approved?: string;
@@ -1250,49 +1551,48 @@ type DecideCredentialOptions = {
1250
1551
  */
1251
1552
  declare function credentialPolicyViolation(credential: Credential, policy: CredentialPolicy | readonly CredentialPolicy[]): CredentialPolicyViolation | undefined;
1252
1553
  /**
1253
- * Validates an untrusted credential record and returns a frozen copy with
1254
- * only the v1 fields, or `undefined`. Unknown fields are dropped; a wrong
1255
- * type in a known field, a service credential without `tenant` and `roles`,
1256
- * or a user credential with `roles`, rejects the whole record.
1554
+ * Validates an untrusted credential record and returns a frozen copy with only
1555
+ * the v1 fields, or `undefined`. Unknown fields are dropped; a wrong type in a
1556
+ * known field, a service credential without `tenant` and `roles`, or a user
1557
+ * credential with `roles`, rejects the whole record.
1257
1558
  */
1258
1559
  declare function parseCredential(input: unknown): Credential | undefined;
1259
1560
  /**
1260
1561
  * The delegation a credential narrows its principal to: OAuth scopes for
1261
- * permissions on every instance, one RFC 9396 entry per id otherwise. A key
1262
- * the definitions no longer declare is dropped, so a credential whose every
1263
- * key is gone delegates nothing and every check is denied.
1562
+ * permissions on every instance, one RFC 9396 entry per id otherwise. A key the
1563
+ * definitions no longer declare is dropped, so a credential whose every key is
1564
+ * gone delegates nothing and every check is denied.
1264
1565
  */
1265
1566
  declare function credentialDelegation(credential: Credential, permissions: PermissionTree): Delegation;
1266
1567
  /**
1267
1568
  * Decides whether the subject of `permdock` may create the credential in
1268
- * `request`. The creator must be a signed-in user or service that is not
1269
- * itself a link or a credential; a delegated creator hands out only what its
1270
- * delegation covers. A key's tenant must be one the creator is a member of;
1271
- * a service key's roles among the creator's `assignableRoles` there and its
1569
+ * `request`. The creator must be a signed-in user or service that is not itself
1570
+ * a link or a credential; a delegated creator hands out only what its
1571
+ * delegation covers. A key's tenant must be one the creator is a member of; a
1572
+ * service key's roles among the creator's `assignableRoles` there and its
1272
1573
  * permissions within `assignablePermissions` there (`exceeds-creator`). The
1273
- * `credentials` policy of the key's tenant (its own, or for a user key
1274
- * without one the creator's active tenant) then applies (`credential-policy`; a
1574
+ * `credentials` policy of the key's tenant (its own, or for a user key without
1575
+ * one the creator's active tenant) then applies (`credential-policy`; a
1275
1576
  * settings source that throws denies with `rule: 'unavailable'`), and
1276
- * `approval` makes the result `approval-required` until `approved` carries
1277
- * its token. PermDock never stores the credential; the application does,
1278
- * after a `granted` result.
1577
+ * `approval` makes the result `approval-required` until `approved` carries its
1578
+ * token. PermDock never stores the credential; the application does, after a
1579
+ * `granted` result.
1279
1580
  */
1280
1581
  /**
1281
1582
  * Decides whether the subject of `permdock` may create the credential in
1282
1583
  * `request`: the creator's own reach, the `credentials` policy of the key's
1283
- * tenant (the call's `settings`, else the instance's), and `approval`.
1284
- * PermDock never stores the credential; the application does, after a
1285
- * `granted` result. An instance built from a snapshot denies with
1286
- * `unsupported`.
1584
+ * tenant (the call's `settings`, else the instance's), and `approval`. PermDock
1585
+ * never stores the credential; the application does, after a `granted` result.
1586
+ * An instance built from a snapshot denies with `unsupported`.
1287
1587
  */
1288
1588
  declare function decideCredential(permdock: InstanceHandle, request: CredentialRequest, options?: DecideCredentialOptions): Promise<CredentialDecision>;
1289
1589
  //#endregion
1290
1590
  //#region src/core/support-session.d.ts
1291
1591
  /**
1292
- * SupportSession v1: a support staff member (`actor`, kind `support`)
1293
- * viewing the app as `principal` in `tenant`, for a stated `reason`. Each
1294
- * request in the session acts as `principal` with their live rights,
1295
- * narrowed to `permissions`.
1592
+ * SupportSession v1: a support staff member (`actor`, kind `support`) viewing
1593
+ * the app as `principal` in `tenant`, for a stated `reason`. Each request in
1594
+ * the session acts as `principal` with their live rights, narrowed to
1595
+ * `permissions`.
1296
1596
  */
1297
1597
  type SupportSession = {
1298
1598
  readonly v: 1;
@@ -1356,90 +1656,94 @@ type DecideSupportSessionOptions = {
1356
1656
  readonly approval?: boolean;
1357
1657
  /** The `token` of an approval the application consumed for this request. */
1358
1658
  readonly approved?: string;
1359
- /** The principal id that approved; required with `approved` and never the actor. */
1659
+ /**
1660
+ * The principal id that approved; required with `approved` and never the
1661
+ * actor.
1662
+ */
1360
1663
  readonly approvedBy?: string;
1361
1664
  /** The start time; defaults to the clock. */
1362
1665
  readonly now?: Instant;
1363
1666
  };
1364
1667
  /**
1365
- * Validates an untrusted support-session record and returns a frozen copy
1366
- * with only the v1 fields, or `undefined`.
1668
+ * Validates an untrusted support-session record and returns a frozen copy with
1669
+ * only the v1 fields, or `undefined`.
1367
1670
  */
1368
1671
  declare function parseSupportSession(input: unknown): SupportSession | undefined;
1369
1672
  /**
1370
- * Decides whether the subject of `permdock` may start the support session
1371
- * in `request`. The actor must be a signed-in person acting for themselves
1673
+ * Decides whether the subject of `permdock` may start the support session in
1674
+ * `request`. The actor must be a signed-in person acting for themselves
1372
1675
  * (`exceeds-creator` otherwise), give a `reason` (`reason-required`), be a
1373
- * member of the tenant (`tenant-mismatch`) and be able to use every
1374
- * permission (`exceeds-creator`). Without `permissions` the session gets the
1375
- * actor's read-only permissions. The tenant's `supportSessions` policy then
1376
- * applies, and the result is `approval-required` until `approved` carries
1377
- * its token and `approvedBy` names someone other than the actor.
1676
+ * member of the tenant (`tenant-mismatch`) and be able to use every permission
1677
+ * (`exceeds-creator`). Without `permissions` the session gets the actor's
1678
+ * read-only permissions. The tenant's `supportSessions` policy then applies,
1679
+ * and the result is `approval-required` until `approved` carries its token and
1680
+ * `approvedBy` names someone other than the actor.
1378
1681
  */
1379
1682
  /**
1380
- * Decides whether the subject of `permdock` may start the support session
1381
- * in `request` and returns the record to sign: a stated reason, membership
1382
- * of the tenant, the actor's own reach, the tenant's `supportSessions`
1383
- * policy and approval by someone else. An instance built from a snapshot
1384
- * denies with `unsupported`.
1683
+ * Decides whether the subject of `permdock` may start the support session in
1684
+ * `request` and returns the record to sign: a stated reason, membership of the
1685
+ * tenant, the actor's own reach, the tenant's `supportSessions` policy and
1686
+ * approval by someone else. An instance built from a snapshot denies with
1687
+ * `unsupported`.
1385
1688
  */
1386
1689
  declare function decideSupportSession(permdock: InstanceHandle, request: SupportSessionRequest, options?: DecideSupportSessionOptions): Promise<SupportSessionDecision>;
1387
1690
  //#endregion
1388
1691
  //#region src/core/interfaces.d.ts
1389
1692
  type DecisionProvider = {
1390
1693
  readonly name: string;
1391
- handles(permission: Permission): boolean;
1392
- decide(request: {
1694
+ handles: (permission: Permission) => boolean;
1695
+ decide: (request: {
1393
1696
  readonly permission: Permission;
1394
1697
  readonly data?: unknown;
1395
1698
  readonly subject: Subject;
1396
1699
  readonly local: Decision;
1397
- }): Promise<Decision>;
1700
+ }) => Promise<Decision>;
1398
1701
  /**
1399
1702
  * Ids of the resources of `permission.resource` the subject may act on.
1400
1703
  * `null` means the provider could not answer and every row is denied;
1401
1704
  * `undefined` means it cannot list, and each row is decided on its own.
1402
1705
  */
1403
- permitted?(request: {
1706
+ permitted?: (request: {
1404
1707
  readonly permission: Permission;
1405
1708
  readonly subject: Subject;
1406
- }): Promise<readonly string[] | null | undefined>;
1709
+ }) => Promise<readonly string[] | null | undefined>;
1407
1710
  };
1408
1711
  type CustomRoleSource = {
1409
1712
  /** Names the implementation in errors and events. */
1410
1713
  readonly name?: string;
1411
1714
  /**
1412
- * The custom roles of one tenant. `getPermDock` passes `held`, the role
1413
- * names the subject's live memberships hold there, declared or not, so a
1414
- * source can skip its read when none of them is a custom role.
1715
+ * The custom roles of one tenant. `getPermDock` passes `held`, the role names
1716
+ * the subject's live memberships hold there, declared or not, so a source can
1717
+ * skip its read when none of them is a custom role.
1415
1718
  */
1416
- rolesFor(tenant: string, context?: {
1719
+ rolesFor: (tenant: string, context?: {
1417
1720
  readonly held: readonly string[];
1418
- }): CustomRole[] | Promise<CustomRole[]>;
1419
- assignable?(tenant: string): string[] | Promise<string[]>;
1721
+ }) => CustomRole[] | Promise<CustomRole[]>;
1722
+ assignable?: (tenant: string) => string[] | Promise<string[]>;
1420
1723
  /**
1421
- * Platform custom roles (`scope: 'global'`), read once per signed-in
1422
- * subject, with `held`, the global role names the subject holds. A role
1423
- * here with a tenant is ignored.
1724
+ * Platform custom roles (`scope: 'global'`), read once per signed-in subject,
1725
+ * with `held`, the global role names the subject holds. A role here with a
1726
+ * tenant is ignored.
1424
1727
  */
1425
- globalRoles?(context?: {
1728
+ globalRoles?: (context?: {
1426
1729
  readonly held: readonly string[];
1427
- }): CustomRole[] | Promise<CustomRole[]>;
1730
+ }) => CustomRole[] | Promise<CustomRole[]>;
1428
1731
  /**
1429
1732
  * Shared custom roles (`shared: true`), defined once for every tenant and
1430
- * read once per subject with a tenant membership, with `held`, the role
1431
- * names its live memberships hold in any tenant. A role here without
1432
- * `shared: true` is ignored.
1733
+ * read once per subject with a tenant membership, with `held`, the role names
1734
+ * its live memberships hold in any tenant. A role here without `shared: true`
1735
+ * is ignored.
1433
1736
  */
1434
- sharedRoles?(context?: {
1737
+ sharedRoles?: (context?: {
1435
1738
  readonly held: readonly string[];
1436
- }): CustomRole[] | Promise<CustomRole[]>;
1739
+ }) => CustomRole[] | Promise<CustomRole[]>;
1437
1740
  };
1438
1741
  /**
1439
- * A `CustomRoleSource` built for the subject the instance serves, for an adapter
1440
- * option shared by every request: it gets the resolved subject (principal,
1441
- * actor and delegation) and returns that subject's source, or `undefined`
1442
- * for none. A throw reads no custom roles and reports `source-threw`.
1742
+ * A `CustomRoleSource` built for the subject the instance serves, for an
1743
+ * adapter option shared by every request: it gets the resolved subject
1744
+ * (principal, actor and delegation) and returns that subject's source, or
1745
+ * `undefined` for none. A throw reads no custom roles and reports
1746
+ * `source-threw`.
1443
1747
  */
1444
1748
  type CustomRoleSourceFactory = (subject: Subject) => CustomRoleSource | undefined;
1445
1749
  /** One member of a scope instance, as `MembershipSource.list` returns it. */
@@ -1452,41 +1756,65 @@ type MemberEntry = {
1452
1756
  type MembershipSource = {
1453
1757
  /** Names the implementation in errors and events. */
1454
1758
  readonly name?: string;
1455
- membershipsFor(principal: {
1759
+ membershipsFor: (principal: {
1456
1760
  readonly id: string;
1457
1761
  readonly kind?: string;
1458
1762
  }, options: {
1459
1763
  readonly tenant?: string;
1460
- }): Membership[] | Promise<Membership[]>;
1461
- /** Every membership held in one scope instance, for member lists and access reviews. */
1462
- list?(query: {
1764
+ }) => Membership[] | Promise<Membership[]>;
1765
+ /**
1766
+ * Every membership held in one scope instance, for member lists and access
1767
+ * reviews.
1768
+ */
1769
+ list?: (query: {
1463
1770
  readonly scope: string;
1464
1771
  readonly id: string;
1465
- }): MemberEntry[] | Promise<MemberEntry[]>;
1772
+ }) => MemberEntry[] | Promise<MemberEntry[]>;
1466
1773
  /**
1467
1774
  * The principal's current authorization version, bumped on every membership
1468
- * change. A token whose `authzVersion` is behind it is stale for the
1469
- * policy's `fresh` permissions. `roles` and `memberships` are what the
1470
- * token claims, so a source can read more than the version in the same
1471
- * call when the claims show it will be needed.
1775
+ * change. A token whose `authzVersion` is behind it is stale for the policy's
1776
+ * `fresh` permissions. `roles` and `memberships` are what the token claims,
1777
+ * so a source can read more than the version in the same call when the claims
1778
+ * show it will be needed.
1472
1779
  */
1473
- version?(principal: {
1780
+ version?: (principal: {
1474
1781
  readonly id: string;
1475
1782
  readonly roles?: readonly string[];
1476
1783
  readonly memberships?: readonly Membership[];
1477
- }): number | undefined | Promise<number | undefined>;
1784
+ }) => number | undefined | Promise<number | undefined>;
1785
+ /**
1786
+ * The global roles the principal holds now. With `onStale: 'reread'`, a stale
1787
+ * token's `principal.roles` is replaced by this answer, so a revoked platform
1788
+ * role is lost with the memberships. A throw or rejection leaves no global
1789
+ * roles. Without it, a reread keeps the token's roles.
1790
+ */
1791
+ globalRolesFor?: (principal: {
1792
+ readonly id: string;
1793
+ readonly kind?: string;
1794
+ }) => readonly string[] | Promise<readonly string[]>;
1478
1795
  /**
1479
1796
  * Keep the memberships the verified token carries and read this source only
1480
1797
  * when the token says they were truncated (`claimsFirst`).
1481
1798
  */
1482
1799
  readonly claimsFirst?: boolean;
1800
+ /**
1801
+ * What a token behind `version` gets. Only permissions the policy marks
1802
+ * `fresh` look at staleness: `'deny'` (the default) denies those with
1803
+ * `stale-credentials` and leaves every other permission on the token's
1804
+ * claims; `'reread'` replaces the token's memberships (and global roles, when
1805
+ * the source has `globalRolesFor`) with a live read for the whole subject, so
1806
+ * no decision keeps a revoked grant.
1807
+ */
1483
1808
  readonly onStale?: "deny" | "reread";
1484
1809
  };
1485
1810
  /** An object's parent chain, as `RelationSource.ancestors` returns it. */
1486
1811
  type RelationChain = {
1487
1812
  /** Whether the object itself is restricted: nothing above it reaches it. */
1488
1813
  readonly restricted?: boolean;
1489
- /** Ancestors nearest first, at most `depth`; a restricted one ends the walk after itself. */
1814
+ /**
1815
+ * Ancestors nearest first, at most `depth`; a restricted one ends the walk
1816
+ * after itself.
1817
+ */
1490
1818
  readonly ancestors: readonly {
1491
1819
  readonly id: string;
1492
1820
  readonly restricted?: boolean;
@@ -1500,7 +1828,10 @@ type HolderPeriod = {
1500
1828
  /** Seconds since the epoch; from it on the relation no longer holds. */
1501
1829
  readonly expiresAt?: number;
1502
1830
  };
1503
- /** A group holding a relation on an object: whoever holds `relation` on the group's instance holds it too. */
1831
+ /**
1832
+ * A group holding a relation on an object: whoever holds `relation` on the
1833
+ * group's instance holds it too.
1834
+ */
1504
1835
  type RelationGroup = {
1505
1836
  readonly resource: string;
1506
1837
  readonly id: string;
@@ -1518,10 +1849,9 @@ type RelationHolder = HolderPeriod & ({
1518
1849
  readonly group: RelationGroup;
1519
1850
  });
1520
1851
  /**
1521
- * The object graph: parent chains, links and who holds a relation on an
1522
- * object. A source answers facts and never decides; a thrown or rejected
1523
- * call, or a Promise the instance has not loaded, denies with
1524
- * `relation-unavailable`.
1852
+ * The object graph: parent chains, links and who holds a relation on an object.
1853
+ * A source answers facts and never decides; a thrown or rejected call, or a
1854
+ * Promise the instance has not loaded, denies with `relation-unavailable`.
1525
1855
  */
1526
1856
  type RelationSource = {
1527
1857
  /** Names the implementation in errors and events. */
@@ -1530,31 +1860,34 @@ type RelationSource = {
1530
1860
  * With `through: 'parent'`, the parent chain; with a link name, the one
1531
1861
  * instance that link points to (`depth` is then 1).
1532
1862
  */
1533
- ancestors(query: {
1863
+ ancestors: (query: {
1534
1864
  readonly resource: string;
1535
1865
  readonly id: string;
1536
1866
  readonly through: string;
1537
1867
  readonly depth: number;
1538
- }): RelationChain | Promise<RelationChain>;
1539
- related(query: {
1868
+ }) => RelationChain | Promise<RelationChain>;
1869
+ related: (query: {
1540
1870
  readonly resource: string;
1541
1871
  readonly id: string;
1542
1872
  readonly relation: string;
1543
- }): RelationHolder[] | Promise<RelationHolder[]>;
1544
- row?(query: {
1873
+ }) => RelationHolder[] | Promise<RelationHolder[]>;
1874
+ row?: (query: {
1545
1875
  readonly resource: string;
1546
1876
  readonly id: string;
1547
- }): Readonly<Record<string, unknown>> | null | undefined | Promise<Readonly<Record<string, unknown>> | null | undefined>;
1877
+ }) => Readonly<Record<string, unknown>> | null | undefined | Promise<Readonly<Record<string, unknown>> | null | undefined>;
1548
1878
  };
1549
- /** Plan and seat names a principal holds in a tenant, from billing (Stripe Entitlements, a table). */
1879
+ /**
1880
+ * Plan and seat names a principal holds in a tenant, from billing (Stripe
1881
+ * Entitlements, a table).
1882
+ */
1550
1883
  type EntitlementSource = {
1551
1884
  /** Names the implementation in errors and events. */
1552
1885
  readonly name?: string;
1553
- entitlementsFor(principal: {
1886
+ entitlementsFor: (principal: {
1554
1887
  readonly id: string;
1555
1888
  }, options: {
1556
1889
  readonly tenant?: string;
1557
- }): string[] | Promise<string[]>;
1890
+ }) => string[] | Promise<string[]>;
1558
1891
  };
1559
1892
  type JwtClaims = {
1560
1893
  readonly iss?: string;
@@ -1583,29 +1916,32 @@ type VerificationFailure = {
1583
1916
  type TokenVerifier<TClaims extends JwtClaims = JwtClaims> = {
1584
1917
  /** Names the implementation in errors and events. */
1585
1918
  readonly name?: string;
1586
- verify(token: string, expectations: {
1919
+ verify: (token: string, expectations: {
1587
1920
  readonly typ?: string | readonly string[];
1588
1921
  readonly audience?: string | readonly string[];
1589
1922
  readonly issuer?: string;
1590
1923
  readonly clockTolerance?: number;
1591
- }): Promise<VerifiedToken<TClaims> | VerificationFailure>;
1924
+ }) => Promise<VerifiedToken<TClaims> | VerificationFailure>;
1592
1925
  };
1593
1926
  type TokenSigner = {
1594
1927
  /** Names the implementation in errors and events. */
1595
1928
  readonly name?: string;
1596
- sign(payload: Readonly<Record<string, unknown>>, options: {
1929
+ sign: (payload: Readonly<Record<string, unknown>>, options: {
1597
1930
  readonly typ: "vnd.permdock.snapshot+jwt" | "vnd.permdock.approval+jwt" | "vnd.permdock.policy+jwt" | "vnd.permdock.capability+jwt" | "vnd.permdock.run+jwt" | "vnd.permdock.support-session+jwt" | "vnd.permdock.evidence+jwt" | "at+jwt" | "secevent+jwt";
1598
1931
  /** `aud`; a signer with no default audience refuses to sign without one. */
1599
1932
  readonly audience?: string | readonly string[];
1600
1933
  /** `exp`, a NumericDate; one hour after `iat` when absent. */
1601
1934
  readonly expiresAt?: number;
1602
- /** `iat`, a NumericDate: the artefact's issue time. The signer's clock when absent. */
1935
+ /**
1936
+ * `iat`, a NumericDate: the artefact's issue time. The signer's clock
1937
+ * when absent.
1938
+ */
1603
1939
  readonly issuedAt?: number;
1604
1940
  /** `jti`: the artefact's id. A fresh UUID when absent. */
1605
1941
  readonly jti?: string;
1606
- }): Promise<string>;
1942
+ }) => Promise<string>;
1607
1943
  readonly kid?: string;
1608
- jwks?(): Promise<{
1944
+ jwks?: () => Promise<{
1609
1945
  readonly keys: readonly JsonWebKeyLike[];
1610
1946
  }>;
1611
1947
  };
@@ -1615,8 +1951,8 @@ type SubjectResolver<TInput, TPrincipal extends Principal = Principal> = (input:
1615
1951
  type SnapshotSource = {
1616
1952
  /** Names the implementation in errors and events. */
1617
1953
  readonly name?: string;
1618
- get(): Promise<Snapshot | string> | Snapshot | string;
1619
- subscribe?(listener: () => void): () => void;
1954
+ get: () => Promise<Snapshot | string> | Snapshot | string;
1955
+ subscribe?: (listener: () => void) => () => void;
1620
1956
  };
1621
1957
  type WhereCompiler<TTarget, TOptions = unknown> = (condition: Condition, target: TTarget, options?: TOptions) => unknown;
1622
1958
  type LimitConsumeInput = {
@@ -1636,31 +1972,31 @@ type LimitRemaining = {
1636
1972
  type LimitStore = {
1637
1973
  /** Names the implementation in errors and events. */
1638
1974
  readonly name?: string;
1639
- consume(input: LimitConsumeInput): Promise<LimitRemaining> | LimitRemaining;
1640
- remaining(input: LimitConsumeInput): LimitRemaining | undefined;
1975
+ consume: (input: LimitConsumeInput) => Promise<LimitRemaining> | LimitRemaining;
1976
+ remaining: (input: LimitConsumeInput) => LimitRemaining | undefined;
1641
1977
  };
1642
1978
  type DecisionSink = {
1643
1979
  /** Names the implementation in errors and events. */
1644
1980
  readonly name?: string;
1645
- write(events: readonly SinkEvent[]): Promise<void> | void;
1646
- flush?(): Promise<void>;
1981
+ write: (events: readonly SinkEvent[]) => Promise<void> | void;
1982
+ flush?: () => Promise<void>;
1647
1983
  };
1648
1984
  /**
1649
1985
  * Looks up the credential an API key stands for. `null` for a key that is
1650
- * malformed, unknown, revoked or whose secret does not match; never throws
1651
- * for bad input. Verification is the application's (or `apiKeyVerifier`'s),
1652
- * never core's.
1986
+ * malformed, unknown, revoked or whose secret does not match; never throws for
1987
+ * bad input. Verification is the application's (or `apiKeyVerifier`'s), never
1988
+ * core's.
1653
1989
  */
1654
1990
  type CredentialVerifier = {
1655
1991
  /** Names the implementation in errors and events. */
1656
1992
  readonly name?: string;
1657
- verify(secret: string): Credential | null | Promise<Credential | null>;
1993
+ verify: (secret: string) => Credential | null | Promise<Credential | null>;
1658
1994
  /**
1659
- * Records a successful use at `at`, for a `lastUsedAt` column. Called
1660
- * after a key resolved and not awaited; a throw or a rejection is
1661
- * ignored, so it never changes the subject.
1995
+ * Records a successful use at `at`, for a `lastUsedAt` column. Called after a
1996
+ * key resolved and not awaited; a throw or a rejection is ignored, so it
1997
+ * never changes the subject.
1662
1998
  */
1663
- touch?(id: string, at: Instant): void | Promise<void>;
1999
+ touch?: (id: string, at: Instant) => void | Promise<void>;
1664
2000
  };
1665
2001
  /** What one tenant configures for itself. Every field only tightens. */
1666
2002
  type TenantSettings = {
@@ -1670,13 +2006,13 @@ type TenantSettings = {
1670
2006
  readonly supportSessions?: SupportSessionPolicy;
1671
2007
  };
1672
2008
  /**
1673
- * Per-tenant settings, a subject input like `CustomRoleSource`: they tighten what
1674
- * a key may be and never grant. A throw denies.
2009
+ * Per-tenant settings, a subject input like `CustomRoleSource`: they tighten
2010
+ * what a key may be and never grant. A throw denies.
1675
2011
  */
1676
2012
  type SettingsSource = {
1677
2013
  /** Names the implementation in errors and events. */
1678
2014
  readonly name?: string;
1679
- settingsFor(tenant: string): TenantSettings | undefined | Promise<TenantSettings | undefined>;
2015
+ settingsFor: (tenant: string) => TenantSettings | undefined | Promise<TenantSettings | undefined>;
1680
2016
  };
1681
2017
  //#endregion
1682
2018
  //#region src/core/policy-fingerprint.d.ts
@@ -1706,13 +2042,16 @@ type ApprovalStage = {
1706
2042
  readonly by: Approver | readonly Approver[];
1707
2043
  /** Absent means 1. */
1708
2044
  readonly quorum?: number;
1709
- /** After `after`, `to` may approve this stage as well as `by`; other stages are unaffected. */
2045
+ /**
2046
+ * After `after`, `to` may approve this stage as well as `by`; other stages
2047
+ * are unaffected.
2048
+ */
1710
2049
  readonly escalation?: ApprovalEscalation;
1711
2050
  };
1712
2051
  /**
1713
- * `'any'`: `quorum` approvers from `by`. `'all'`: every stage completes, in
1714
- * any order. `'sequential'`: stages complete in order; an approver signs
1715
- * only the first incomplete stage. An approver signs once per request.
2052
+ * `'any'`: `quorum` approvers from `by`. `'all'`: every stage completes, in any
2053
+ * order. `'sequential'`: stages complete in order; an approver signs only the
2054
+ * first incomplete stage. An approver signs once per request.
1716
2055
  */
1717
2056
  type ApprovalMode = "any" | "all" | "sequential";
1718
2057
  type ApprovalRequirement = {
@@ -1726,15 +2065,24 @@ type ApprovalRequirement = {
1726
2065
  readonly distinct?: boolean;
1727
2066
  /** `'resource-change'` binds the approval to the row's `version` field. */
1728
2067
  readonly staleOn?: "resource-change";
1729
- /** Distinct approvers a request needs before it is approved under `by`; absent means 1. */
2068
+ /**
2069
+ * Distinct approvers a request needs before it is approved under `by`; absent
2070
+ * means 1.
2071
+ */
1730
2072
  readonly quorum?: number;
1731
- /** Seconds a request stays open; the store's default when absent, and never longer than it. */
2073
+ /**
2074
+ * Seconds a request stays open; the store's default when absent, and never
2075
+ * longer than it.
2076
+ */
1732
2077
  readonly ttl?: number;
1733
2078
  readonly escalation?: ApprovalEscalation;
1734
2079
  };
1735
2080
  type ApprovalOption = "human" | {
1736
2081
  readonly by?: ApproverInput;
1737
- /** `'all'` or `'sequential'` with `stages`; absent means `'any'` with `by`. */
2082
+ /**
2083
+ * `'all'` or `'sequential'` with `stages`; absent means `'any'` with
2084
+ * `by`.
2085
+ */
1738
2086
  readonly mode?: ApprovalMode;
1739
2087
  readonly stages?: readonly {
1740
2088
  readonly by: ApproverInput;
@@ -1753,11 +2101,20 @@ type ApprovalOption = "human" | {
1753
2101
  * changes, resuming denies with `stale-approval`.
1754
2102
  */
1755
2103
  readonly staleOn?: "resource-change";
1756
- /** Distinct approvers needed (an integer of at least 1); the same approver counts once. Absent means 1. */
2104
+ /**
2105
+ * Distinct approvers needed (an integer of at least 1); the same approver
2106
+ * counts once. Absent means 1.
2107
+ */
1757
2108
  readonly quorum?: number;
1758
- /** Seconds the request stays open (`1800`); caps the approval store's default. */
2109
+ /**
2110
+ * Seconds the request stays open (`1800`); caps the approval store's
2111
+ * default.
2112
+ */
1759
2113
  readonly ttl?: number;
1760
- /** After `after` seconds (`14_400`), `to` may approve as well as `by`, at any open stage; same kinds as `by`. */
2114
+ /**
2115
+ * After `after` seconds (`14_400`), `to` may approve as well as `by`, at
2116
+ * any open stage; same kinds as `by`.
2117
+ */
1761
2118
  readonly escalation?: {
1762
2119
  readonly after: number;
1763
2120
  readonly to: ApproverInput;
@@ -1785,16 +2142,19 @@ type AssuranceRequirement = {
1785
2142
  readonly amr?: readonly string[];
1786
2143
  };
1787
2144
  /**
1788
- * Time-boxed role activation. A role with `activation` is never held
1789
- * directly: a membership lists it under `eligible`, and `permdock.activate`
1790
- * mints the elevated membership to write.
2145
+ * Time-boxed role activation. A role with `activation` is never held directly:
2146
+ * a membership lists it under `eligible`, and `permdock.activate` mints the
2147
+ * elevated membership to write.
1791
2148
  */
1792
2149
  type ActivationOption = {
1793
2150
  /** The longest an activation may last, in seconds (`14_400`). */
1794
2151
  readonly maxDuration?: number;
1795
2152
  /** `'required'` denies an activation without a reason. */
1796
2153
  readonly justification?: "required" | "optional";
1797
- /** When set, `activate` returns `approval-required` before the membership can be written. */
2154
+ /**
2155
+ * When set, `activate` returns `approval-required` before the membership can
2156
+ * be written.
2157
+ */
1798
2158
  readonly approval?: ApprovalOption;
1799
2159
  /** How fresh the activator's authentication must be. */
1800
2160
  readonly assurance?: AssuranceRequirement;
@@ -1842,10 +2202,16 @@ type SupportAccessOptions<S extends string = string> = {
1842
2202
  readonly role: string;
1843
2203
  /** The scope the support membership sits in; defaults to `tenant`. */
1844
2204
  readonly on?: S;
1845
- /** Every decision under the support membership denies with `actor-required` without an `act`. */
2205
+ /**
2206
+ * Every decision under the support membership denies with `actor-required`
2207
+ * without an `act`.
2208
+ */
1846
2209
  readonly actorRequired?: boolean;
1847
2210
  readonly consent: SupportConsent;
1848
- /** Permissions a support session never reaches, compiled to deny grants scoped to `via: 'support'`. */
2211
+ /**
2212
+ * Permissions a support session never reaches, compiled to deny grants scoped
2213
+ * to `via: 'support'`.
2214
+ */
1849
2215
  readonly forbid?: readonly (Permission | PermissionTree)[];
1850
2216
  /** The subgroup a consented membership records under `member.group`. */
1851
2217
  readonly group?: string;
@@ -1866,38 +2232,56 @@ type GrantOptions<T = Record<string, unknown>> = {
1866
2232
  readonly approval?: ApprovalOption;
1867
2233
  readonly limit?: GrantLimit;
1868
2234
  readonly reason?: string;
1869
- readonly fields?: readonly (keyof T & string)[];
2235
+ readonly fields?: readonly (unknown extends T ? string : keyof T & string)[];
1870
2236
  /**
1871
2237
  * A stable name for the grant. On a deny, a `breakGlass` override may lift
1872
- * it; on any grant, it is reported on `decision.matched.name` and on
1873
- * decision events.
2238
+ * it; on any grant, it is reported on `decision.matched.name` and on decision
2239
+ * events.
1874
2240
  */
1875
2241
  readonly name?: string;
1876
2242
  readonly group?: string;
1877
- /** Display text and app data for the grant, reported on `decision.matched.meta`; never read in evaluation. */
2243
+ /**
2244
+ * Display text and app data for the grant, reported on
2245
+ * `decision.matched.meta`; never read in evaluation.
2246
+ */
1878
2247
  readonly meta?: GrantMeta;
1879
2248
  /**
1880
- * Follow-ups the application owes when this allow grants: each becomes a
1881
- * `{ kind: 'app', name, detail? }` obligation on the decision. Allows only.
2249
+ * Follow-ups the application owes when this allow grants: each becomes a `{
2250
+ * kind: 'app', name, detail? }` obligation on the decision. Allows only.
1882
2251
  */
1883
2252
  readonly obligations?: readonly ObligationInput[];
1884
- /** Purposes of use (`context.purpose`) that make the grant apply; non-portable. */
2253
+ /**
2254
+ * Purposes of use (`context.purpose`) that make the grant apply;
2255
+ * non-portable.
2256
+ */
1885
2257
  readonly purpose?: readonly string[];
1886
- /** The grant applies from this instant on (RFC 3339 or an `Instant`); before it an allow denies with `inactive-grant` and a deny does not apply. */
2258
+ /**
2259
+ * The grant applies from this instant on (RFC 3339 or an `Instant`); before
2260
+ * it an allow denies with `inactive-grant` and a deny does not apply.
2261
+ */
1887
2262
  readonly validFrom?: string | Instant;
1888
- /** The grant stops applying at this instant (exclusive; RFC 3339 or an `Instant`). */
2263
+ /**
2264
+ * The grant stops applying at this instant (exclusive; RFC 3339 or an
2265
+ * `Instant`).
2266
+ */
1889
2267
  readonly validUntil?: string | Instant;
1890
2268
  /**
1891
- * An allow on an instance action counts only on rows whose scope instance
1892
- * (or the whole app, globally) is one where the subject also holds this
2269
+ * An allow on an instance action counts only on rows whose scope instance (or
2270
+ * the whole app, globally) is one where the subject also holds this
1893
2271
  * permission through a role grant without a row condition.
1894
2272
  */
1895
2273
  readonly requires?: Permission | readonly Permission[];
1896
2274
  };
1897
- /** A grant's metadata. PermDock carries it to decisions, events, snapshots and the catalog and never reads `x`. */
2275
+ /**
2276
+ * A grant's metadata. PermDock carries it to decisions, events, snapshots and
2277
+ * the catalog and never reads `x`.
2278
+ */
1898
2279
  type GrantMeta = {
1899
2280
  readonly description?: string;
1900
- /** Data the application owns. Plain JSON, checked by `definePolicy(…, { x: { grant } })`. */
2281
+ /**
2282
+ * Data the application owns. Plain JSON, checked by `definePolicy(…, { x: {
2283
+ * grant } })`.
2284
+ */
1901
2285
  readonly x?: AppData;
1902
2286
  };
1903
2287
  /** An app obligation as declared on an allow: its name, or its name and detail. */
@@ -1907,22 +2291,25 @@ type ObligationInput = string | {
1907
2291
  };
1908
2292
  /**
1909
2293
  * When a grant applies, in Unix seconds. `from` is inclusive, `until`
1910
- * exclusive; either may be absent. Portable: `where()` drops an inactive
1911
- * grant at the decision clock and generated RLS compares against `now()`.
2294
+ * exclusive; either may be absent. Portable: `where()` drops an inactive grant
2295
+ * at the decision clock and generated RLS compares against `now()`.
1912
2296
  */
1913
2297
  type GrantValidity = {
1914
2298
  readonly from?: number;
1915
2299
  readonly until?: number;
1916
2300
  };
1917
- /** A grant's validity in JSON (snapshots, catalogs, `inactive-grant` details): RFC 3339 bounds. */
2301
+ /**
2302
+ * A grant's validity in JSON (snapshots, catalogs, `inactive-grant` details):
2303
+ * RFC 3339 bounds.
2304
+ */
1918
2305
  type WireValidity = {
1919
2306
  readonly from?: string;
1920
2307
  readonly until?: string;
1921
2308
  };
1922
2309
  /**
1923
- * The actor a policy delegation is for: an actor kind, narrowed to one id
1924
- * when `id` is set, or to one named client when `client` is set (the name
1925
- * the subject resolver gives a verified client id through `clients`).
2310
+ * The actor a policy delegation is for: an actor kind, narrowed to one id when
2311
+ * `id` is set, or to one named client when `client` is set (the name the
2312
+ * subject resolver gives a verified client id through `clients`).
1926
2313
  */
1927
2314
  type DelegationTarget = {
1928
2315
  readonly kind: ActorKind;
@@ -1938,42 +2325,66 @@ type PolicyDelegation = {
1938
2325
  readonly from: Grantee | readonly Grantee[];
1939
2326
  readonly to: DelegationTarget;
1940
2327
  readonly permissions: readonly string[];
1941
- /** The keys of `permissions` whose `readOnlyHint` is true: all a `readOnly` actor may use. */
2328
+ /**
2329
+ * The keys of `permissions` whose `readOnlyHint` is true: all a `readOnly`
2330
+ * actor may use.
2331
+ */
1942
2332
  readonly readOnly: readonly string[];
1943
2333
  readonly validity?: GrantValidity;
1944
2334
  };
1945
2335
  type DelegationInput = {
1946
- /** Who hands over: the same subject-only selectors as `approval.by` (a role, `authenticated()`, a plan, `assurance()`); not `relation()`. */
2336
+ /**
2337
+ * Who hands over: the same subject-only selectors as `approval.by` (a role,
2338
+ * `authenticated()`, a plan, `assurance()`); not `relation()`.
2339
+ */
1947
2340
  readonly from: GranteeInput;
1948
- /** Which actor may act: `actor('eve')`, an actor kind, `{ kind, id }` for one agent, or `{ kind, client }` for one named OAuth client. */
2341
+ /**
2342
+ * Which actor may act: `actor('eve')`, an actor kind, `{ kind, id }` for one
2343
+ * agent, or `{ kind, client }` for one named OAuth client.
2344
+ */
1949
2345
  readonly to: ActorGrantee | string | DelegationTarget;
1950
2346
  /** The leaves or subtrees the actor may use; a deny grant still applies. */
1951
2347
  readonly permissions: readonly (Permission | PermissionTree)[];
1952
2348
  readonly validFrom?: string | Instant;
1953
2349
  readonly validUntil?: string | Instant;
1954
2350
  };
1955
- /** A declared scope name (or the `tenant` / `team` alias), or the resource a role is held on. */
2351
+ /**
2352
+ * A declared scope name (or the `tenant` / `team` alias), or the resource a
2353
+ * role is held on.
2354
+ */
1956
2355
  type RoleScope<S extends string = string> = S | Permission | PermissionTree | readonly (Permission | PermissionTree)[];
1957
2356
  type RoleOptions<S extends string = string> = {
1958
2357
  readonly on?: RoleScope<S>;
1959
2358
  readonly assignable?: boolean;
1960
2359
  /** Roles nobody may hold together with this one in the same scope instance. */
1961
2360
  readonly exclusiveWith?: readonly string[];
1962
- /** Fewest holders a scope instance keeps (checked at commit); default 0. Needs a named-scope `on`. */
2361
+ /**
2362
+ * Fewest holders a scope instance keeps (checked at commit); default 0. Needs
2363
+ * a named-scope `on`.
2364
+ */
1963
2365
  readonly min?: number;
1964
2366
  /** Most holders a scope instance may have. Needs a named-scope `on`. */
1965
2367
  readonly max?: number;
1966
- /** The holder count of a scope instance never changes: the role only moves by transfer. */
2368
+ /**
2369
+ * The holder count of a scope instance never changes: the role only moves by
2370
+ * transfer.
2371
+ */
1967
2372
  readonly transferOnly?: boolean;
1968
2373
  /**
1969
- * Roles a holder may assign and revoke. Once any role declares `assigns`,
1970
- * a role nobody lists is assigned only by `meta.manageRoles` holders.
2374
+ * Roles a holder may assign and revoke. Once any role declares `assigns`, a
2375
+ * role nobody lists is assigned only by `meta.manageRoles` holders.
1971
2376
  */
1972
2377
  readonly assigns?: readonly string[];
1973
- /** Membership kinds (`via`) that may hold the role; others hold it for nothing. */
2378
+ /**
2379
+ * Membership kinds (`via`) that may hold the role; others hold it for
2380
+ * nothing.
2381
+ */
1974
2382
  readonly for?: readonly string[];
1975
2383
  readonly meta?: RoleMeta;
1976
- /** Time-boxed activation: the role becomes eligible-only and `activate` mints its membership. */
2384
+ /**
2385
+ * Time-boxed activation: the role becomes eligible-only and `activate` mints
2386
+ * its membership.
2387
+ */
1977
2388
  readonly activation?: ActivationOption;
1978
2389
  /** Reserved for restricted credentials; setting it throws until it ships. */
1979
2390
  readonly restricted?: never;
@@ -1991,31 +2402,52 @@ type Grant = {
1991
2402
  readonly check?: Condition;
1992
2403
  readonly approval?: "human" | ApprovalRequirement;
1993
2404
  readonly portable: boolean;
1994
- /** Set when `portable` is false only because the grant reads the relation graph. */
2405
+ /**
2406
+ * Set when `portable` is false only because the grant reads the relation
2407
+ * graph.
2408
+ */
1995
2409
  readonly graph?: true;
1996
2410
  readonly closure?: ClosureGrantFn;
1997
2411
  readonly limit?: GrantLimit;
1998
2412
  readonly fields?: readonly string[];
1999
2413
  readonly scope: GrantScope;
2000
- /** The grant's stable name: a `breakGlass` override lifts a named deny, and `decision.matched.name` reports it. */
2414
+ /**
2415
+ * The grant's stable name: a `breakGlass` override lifts a named deny, and
2416
+ * `decision.matched.name` reports it.
2417
+ */
2001
2418
  readonly name?: string;
2002
2419
  readonly group?: string;
2003
2420
  readonly meta?: GrantMeta;
2004
2421
  /** App obligations an allow adds to its granted decision. */
2005
2422
  readonly obligations?: readonly AppObligation[];
2006
- /** Purposes of use that make the grant apply (`context.purpose`); non-portable. */
2423
+ /**
2424
+ * Purposes of use that make the grant apply (`context.purpose`);
2425
+ * non-portable.
2426
+ */
2007
2427
  readonly purpose?: readonly string[];
2008
- /** Set on a break-glass allow: it overrides named denies and carries obligations. */
2428
+ /**
2429
+ * Set on a break-glass allow: it overrides named denies and carries
2430
+ * obligations.
2431
+ */
2009
2432
  readonly breakGlass?: BreakGlassSpec;
2010
- /** The membership kind (`via`) this grant applies under; others never match it. */
2433
+ /**
2434
+ * The membership kind (`via`) this grant applies under; others never match
2435
+ * it.
2436
+ */
2011
2437
  readonly viaOnly?: MembershipVia;
2012
2438
  /** Set only on a grant merged from a hosted policy document. */
2013
2439
  readonly hosted?: HostedGrantRef;
2014
2440
  /** When the grant applies; absent means always. */
2015
2441
  readonly validity?: GrantValidity;
2016
- /** Set on a custom-role grant narrowed by a resource level (`CustomRoleGrant.level`). */
2442
+ /**
2443
+ * Set on a custom-role grant narrowed by a resource level
2444
+ * (`CustomRoleGrant.level`).
2445
+ */
2017
2446
  readonly level?: string;
2018
- /** The permission key the subject must also hold, through a role, on the row's scope instance or globally. */
2447
+ /**
2448
+ * The permission key the subject must also hold, through a role, on the row's
2449
+ * scope instance or globally.
2450
+ */
2019
2451
  readonly requires?: readonly string[];
2020
2452
  };
2021
2453
  /** Which hosted policy document and grant a merged grant came from. */
@@ -2035,13 +2467,22 @@ type RoleBinding<S extends string = string> = {
2035
2467
  readonly assigns?: readonly string[];
2036
2468
  readonly for?: readonly string[];
2037
2469
  readonly meta?: RoleMeta;
2038
- /** Time-boxed activation: the role is eligible-only, and `activate` mints its membership. */
2470
+ /**
2471
+ * Time-boxed activation: the role is eligible-only, and `activate` mints its
2472
+ * membership.
2473
+ */
2039
2474
  readonly activation?: ActivationSpec;
2040
- /** Support access: consent and `actorRequired` for a vendor-support membership. */
2475
+ /**
2476
+ * Support access: consent and `actorRequired` for a vendor-support
2477
+ * membership.
2478
+ */
2041
2479
  readonly support?: SupportSpec;
2042
2480
  };
2043
2481
  type ValidateMode = "boundary" | "always" | "never";
2044
- /** The declared scopes, in declaration order; empty when the policy declares none. */
2482
+ /**
2483
+ * The declared scopes, in declaration order; empty when the policy declares
2484
+ * none.
2485
+ */
2045
2486
  type PolicyScopes = readonly Scope[];
2046
2487
  type PolicyVocabulary = {
2047
2488
  readonly permissions: PermissionTree;
@@ -2053,7 +2494,7 @@ type VocabularyFromInput<Input> = Input extends PolicyVocabulary ? Input : {
2053
2494
  readonly roles?: RoleTree;
2054
2495
  readonly plans?: PlanTree;
2055
2496
  };
2056
- type Policy<TUser = unknown, TPrincipal extends Principal = Principal, V extends PolicyVocabulary = PolicyVocabulary> = {
2497
+ type Policy<TUser = unknown, TPrincipal extends Principal = Principal, V extends PolicyVocabulary = PolicyVocabulary, S extends PolicyScopesInput = PolicyScopesInput> = {
2057
2498
  readonly permissions: V["permissions"];
2058
2499
  readonly roles: readonly RoleBinding[];
2059
2500
  readonly rolesByName: ReadonlyMap<string, RoleBinding>;
@@ -2067,18 +2508,39 @@ type Policy<TUser = unknown, TPrincipal extends Principal = Principal, V extends
2067
2508
  readonly onDenied?: (decision: unknown) => never | void;
2068
2509
  readonly fingerprint: string;
2069
2510
  readonly resources: ReadonlyMap<string, ResourceNode>;
2070
- /** The app data schemas `definePolicy` was given; symbol-keyed so freezing the policy leaves the schemas alone. */
2511
+ /**
2512
+ * The app data schemas `definePolicy` was given; symbol-keyed so freezing the
2513
+ * policy leaves the schemas alone.
2514
+ */
2071
2515
  readonly [POLICY_X]?: PolicyAppDataSchemas;
2516
+ readonly [POLICY_SCOPES]?: S;
2072
2517
  readonly providers?: readonly DecisionProvider[];
2073
- /** Permission keys a hosted policy document may grant or deny; empty by default. */
2518
+ /**
2519
+ * Permission keys a hosted policy document may grant or deny; empty by
2520
+ * default.
2521
+ */
2074
2522
  readonly hostable: readonly string[];
2075
- /** Permission keys that deny with `stale-credentials` when the subject's token is behind the source. */
2523
+ /**
2524
+ * Permission keys that deny with `stale-credentials` when the subject's token
2525
+ * is behind the source.
2526
+ */
2076
2527
  readonly fresh?: readonly string[];
2077
- /** Policy delegations in declaration order; absent or empty when the policy declares none. */
2528
+ /**
2529
+ * Policy delegations in declaration order; absent or empty when the policy
2530
+ * declares none.
2531
+ */
2078
2532
  readonly delegations?: readonly PolicyDelegation[];
2079
- /** Grant levels by resource (`resource(…, { levels })`), normalised; absent when none are declared. */
2533
+ /**
2534
+ * Grant levels by resource (`resource(…, { levels })`), normalised; absent
2535
+ * when none are declared.
2536
+ */
2080
2537
  readonly levels?: PolicyLevels;
2081
- /** Coarse OAuth scopes in declaration order; absent when the policy declares none. */
2538
+ /** Resources declared with `orderedLevels: true`, sorted; absent when none. */
2539
+ readonly orderedLevels?: readonly string[];
2540
+ /**
2541
+ * Coarse OAuth scopes in declaration order; absent when the policy declares
2542
+ * none.
2543
+ */
2082
2544
  readonly oauthScopes?: readonly PolicyOAuthScope[];
2083
2545
  readonly index: PolicyIndex;
2084
2546
  };
@@ -2091,7 +2553,10 @@ type PolicyOAuthScope = {
2091
2553
  readonly permissions: readonly string[];
2092
2554
  readonly scopes: readonly string[];
2093
2555
  };
2094
- /** Lookups built once per policy, so a decision does not rescan every role and grant. */
2556
+ /**
2557
+ * Lookups built once per policy, so a decision does not rescan every role and
2558
+ * grant.
2559
+ */
2095
2560
  type PolicyIndex = {
2096
2561
  readonly declaredRoles: ReadonlySet<string>;
2097
2562
  readonly supports: readonly SupportSpec[];
@@ -2117,19 +2582,22 @@ type PolicyOptions<TUser, TPrincipal extends Principal, S extends PolicyScopesIn
2117
2582
  readonly grants?: readonly (Omit<Grant, "role" | "scope"> | readonly Omit<Grant, "role" | "scope">[] | Grant)[];
2118
2583
  /**
2119
2584
  * Named scopes in order, each with the row field holding its id and an
2120
- * optional parent (`within`, an earlier scope). `tenant` and `team` alias
2121
- * the first and second scope.
2585
+ * optional parent (`within`, an earlier scope). `tenant` and `team` alias the
2586
+ * first and second scope.
2122
2587
  */
2123
2588
  readonly scopes?: S;
2124
- /** Maps the application's user to the principal PermDock decides for; `null` is anonymous. */
2589
+ /**
2590
+ * Maps the application's user to the principal PermDock decides for; `null`
2591
+ * is anonymous.
2592
+ */
2125
2593
  readonly subject: (user: TUser) => TPrincipal | null;
2126
2594
  readonly context?: (user: TUser) => Readonly<Record<string, unknown>> | Promise<Readonly<Record<string, unknown>>>;
2127
2595
  readonly validate?: ValidateMode;
2128
2596
  readonly onDenied?: (decision: unknown) => never | void;
2129
2597
  readonly providers?: readonly DecisionProvider[];
2130
2598
  /**
2131
- * Leaves or subtrees a hosted policy document (`PolicySource`) may touch.
2132
- * The default is none, so a policy without it ignores every hosted grant.
2599
+ * Leaves or subtrees a hosted policy document (`PolicySource`) may touch. The
2600
+ * default is none, so a policy without it ignores every hosted grant.
2133
2601
  */
2134
2602
  readonly hostable?: readonly (Permission | PermissionTree)[];
2135
2603
  /**
@@ -2140,8 +2608,8 @@ type PolicyOptions<TUser, TPrincipal extends Principal, S extends PolicyScopesIn
2140
2608
  readonly fresh?: readonly (Permission | PermissionTree)[];
2141
2609
  /**
2142
2610
  * Standing delegations: holders of `from` let actors matching `to` use
2143
- * `permissions` for them without a token saying so. A token delegation on
2144
- * the call still applies as well; both must cover.
2611
+ * `permissions` for them without a token saying so. A token delegation on the
2612
+ * call still applies as well; both must cover.
2145
2613
  */
2146
2614
  readonly delegations?: readonly DelegationInput[];
2147
2615
  /**
@@ -2172,4 +2640,4 @@ type SubjectOf<P> = {
2172
2640
  readonly expiresAt?: number;
2173
2641
  };
2174
2642
  //#endregion
2175
- export { MemberEntry as $, Delegation as $n, DeliveryFailureCause as $t, PolicyScopes as A, relation as An, CredentialRequest as At, ValidateMode as B, LimitDetail as Bn, LocalSnapshotManifest as Bt, MembershipFixture as C, RelationGrantee as Cn, isConditionDate as Cr, Credential as Ct, PolicyDelegation as D, authenticated as Dn, CredentialPermissionInput as Dt, PolicyAppDataSchemas as E, assurance as En, CredentialPermission as Et, RoleScope as F, DenialDetails as Fn, isFeedId as Ft, CustomRoleSourceFactory as G, TraceSkip as Gn, SnapshotScope as Gt, WireValidity as H, Obligation as Hn, SnapshotAssignable as Ht, SeparationConflict as I, DenialReason as In, parseCredential as It, EntitlementSource as J, Assurance as Jn, AutomationEvent as Jt, DecisionProvider as K, TraceSkipReason as Kn, AccessEvent as Kt, SubjectOf as L, DeniedDecision as Ln, InstanceHandle as Lt, PrincipalOf as M, ApprovalRequiredDecision as Mn, credentialDelegation as Mt, RoleBinding as N, Decision as Nn, credentialPolicyViolation as Nt, PolicyOAuthScope as O, inherit as On, CredentialPolicy as Ot, RoleOptions as P, Denial as Pn, decideCredential as Pt, LimitStore as Q, CustomRoleGrant as Qn, DeliveryEvent as Qt, SupportAccessOptions as R, ExplainedDecision as Rn, Instant as Rt, HostedGrantRef as S, InheritGrantee as Sn, isCondition as Sr, ApiKeyPrincipal as St, Policy as T, anyone as Tn, isSqlFunctionField as Tr, CredentialKind as Tt, CredentialVerifier as U, Quota as Un, SnapshotGrant as Ut, VocabularyFromInput as V, MatchedGrant as Vn, Snapshot as Vt, CustomRoleSource as W, Trace as Wn, SnapshotNotEntitled as Wt, LimitConsumeInput as X, Binding as Xn, DecisionEvent as Xt, JwtClaims as Y, AuthorizationDetail as Yn, CredentialEvent as Yt, LimitRemaining as Z, CustomRole as Zn, DeliveryChannel as Zt, GrantLimit as _, anyOf as _n, RelatedHop as _r, SupportSessionDecision as _t, ApprovalRequirement as a, WireDenial as an, Subject as ar, SettingsSource as at, GrantScope as b, Grantee as bn, SqlFunctionCondition as br, decideSupportSession as bt, BreakGlassOptions as c, Scope as cn, AdapterId as cr, TenantSettings as ct, ClosureContext as d, AnyOfApprover as dn, ConditionRef as dr, TokenVerifier as dt, DirectoryEvent as en, GnapAccess as er, MembershipSource as et, ClosureGrantFn as f, Approver as fn, ConditionValue as fr, VerificationFailure as ft, GrantCondition as g, allOf as gn, RelatedCondition as gr, SupportSession as gt, Grant as h, UserApprover as hn, OpaqueCondition as hr, DecideSupportSessionOptions as ht, ApprovalOption as i, WireDecision as in, SharedCustomRole as ir, RelationSource as it, PolicyVocabulary as j, AppObligation as jn, DecideCredentialOptions as jt, PolicyOptions as k, plan as kn, CredentialPolicyViolation as kt, BreakGlassRequirements as l, ScopeDeclaration as ln, MembershipVia as lr, TokenFailureCause as lt, DelegationTarget as m, PermissionApprover as mn, MemberOfParent as mr, WhereCompiler as mt, ApprovalEscalation as n, MembershipEvent as nn, Membership as nr, RelationGroup as nt, ApprovalStage as o, WireDelegation as on, VerifiedClaims as or, SnapshotSource as ot, DelegationInput as p, ApproverInput as pn, MemberOfCondition as pr, VerifiedToken as pt, DecisionSink as q, Actor as qn, AuthEvent as qt, ApprovalMode as r, SinkEvent as rn, Principal as rr, RelationHolder as rt, AssuranceRequirement as s, PolicyScopesInput as sn, ActorKind as sr, SubjectResolver as st, ActivationOption as t, EmailCategory as tn, JsonWebKeyLike as tr, RelationChain as tt, BreakGlassSpec as u, ScopeNames as un, Condition as ur, TokenSigner as ut, GrantMeta as v, holder as vn, RestrictedAncestors as vr, SupportSessionPolicy as vt, ObligationInput as w, actor as wn, isConditionRef as wr, CredentialDecision as wt, GrantValidity as x, GranteeInput as xn, hasConditionOp as xr, parseSupportSession as xt, GrantOptions as y, user as yn, SqlFunctionArg as yr, SupportSessionRequest as yt, SupportConsent as z, GrantedDecision as zn, LocalCustomRoleTable as zt };
2643
+ export { MemberEntry as $, AuthorizationDetail as $n, CredentialEvent as $t, PolicyScopes as A, assurance as An, CredentialRequest as At, ValidateMode as B, DenialReason as Bn, LocalMembershipRows as Bt, MembershipFixture as C, user as Cn, SqlFunctionArg as Cr, Credential as Ct, PolicyDelegation as D, RelationGrantee as Dn, isConditionDate as Dr, CredentialPermissionInput as Dt, PolicyAppDataSchemas as E, InheritGrantee as En, isCondition as Er, CredentialPermission as Et, RoleScope as F, AppObligation as Fn, isFeedId as Ft, CustomRoleSourceFactory as G, MatchedGrant as Gn, Snapshot as Gt, WireValidity as H, ExplainedDecision as Hn, LocalRowValue as Ht, SeparationConflict as I, ApprovalRequiredDecision as In, parseCredential as It, EntitlementSource as J, Trace as Jn, SnapshotNotEntitled as Jt, DecisionProvider as K, Obligation as Kn, SnapshotAssignable as Kt, SubjectOf as L, Decision as Ln, InstanceHandle as Lt, PrincipalOf as M, inherit as Mn, credentialDelegation as Mt, RoleBinding as N, plan as Nn, credentialPolicyViolation as Nt, PolicyOAuthScope as O, actor as On, isConditionRef as Or, CredentialPolicy as Ot, RoleOptions as P, relation as Pn, decideCredential as Pt, LimitStore as Q, Assurance as Qn, AutomationEvent as Qt, SupportAccessOptions as R, Denial as Rn, Instant as Rt, HostedGrantRef as S, holder as Sn, RestrictedAncestors as Sr, ApiKeyPrincipal as St, Policy as T, GranteeInput as Tn, hasConditionOp as Tr, CredentialKind as Tt, CredentialVerifier as U, GrantedDecision as Un, LocalSnapshotManifest as Ut, VocabularyFromInput as V, DeniedDecision as Vn, LocalRowColumn as Vt, CustomRoleSource as W, LimitDetail as Wn, LocalSnapshotRows as Wt, LimitConsumeInput as X, TraceSkipReason as Xn, AccessEvent as Xt, JwtClaims as Y, TraceSkip as Yn, SnapshotScope as Yt, LimitRemaining as Z, Actor as Zn, AuthEvent as Zt, GrantLimit as _, ApproverInput as _n, MemberOfCondition as _r, SupportSessionDecision as _t, ApprovalRequirement as a, EmailCategory as an, JsonWebKeyLike as ar, SettingsSource as at, GrantScope as b, allOf as bn, RelatedCondition as br, decideSupportSession as bt, BreakGlassOptions as c, WireDecision as cn, SharedCustomRole as cr, TenantSettings as ct, ClosureContext as d, PolicyScopesInput as dn, ActorKind as dr, TokenVerifier as dt, DecisionEvent as en, Binding as er, MembershipSource as et, ClosureGrantFn as f, Scope as fn, AdapterId as fr, VerificationFailure as ft, GrantCondition as g, Approver as gn, ConditionValue as gr, SupportSession as gt, Grant as h, AnyOfApprover as hn, ConditionRef as hr, DecideSupportSessionOptions as ht, ApprovalOption as i, DirectoryEvent as in, GnapAccess as ir, RelationSource as it, PolicyVocabulary as j, authenticated as jn, DecideCredentialOptions as jt, PolicyOptions as k, anyone as kn, isSqlFunctionField as kr, CredentialPolicyViolation as kt, BreakGlassRequirements as l, WireDenial as ln, Subject as lr, TokenFailureCause as lt, DelegationTarget as m, ScopeNames as mn, Condition as mr, WhereCompiler as mt, ApprovalEscalation as n, DeliveryEvent as nn, CustomRoleGrant as nr, RelationGroup as nt, ApprovalStage as o, MembershipEvent as on, Membership as or, SnapshotSource as ot, DelegationInput as p, ScopeDeclaration as pn, MembershipVia as pr, VerifiedToken as pt, DecisionSink as q, Quota as qn, SnapshotGrant as qt, ApprovalMode as r, DeliveryFailureCause as rn, Delegation as rr, RelationHolder as rt, AssuranceRequirement as s, SinkEvent as sn, Principal as sr, SubjectResolver as st, ActivationOption as t, DeliveryChannel as tn, CustomRole as tr, RelationChain as tt, BreakGlassSpec as u, WireDelegation as un, VerifiedClaims as ur, TokenSigner as ut, GrantMeta as v, PermissionApprover as vn, MemberOfParent as vr, SupportSessionPolicy as vt, ObligationInput as w, Grantee as wn, SqlFunctionCondition as wr, CredentialDecision as wt, GrantValidity as x, anyOf as xn, RelatedHop as xr, parseSupportSession as xt, GrantOptions as y, UserApprover as yn, OpaqueCondition as yr, SupportSessionRequest as yt, SupportConsent as z, DenialDetails as zn, LocalCustomRoleTable as zt };