permdock 0.8.0 → 0.10.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 (277) hide show
  1. package/dist/a2a/index.d.ts +4 -4
  2. package/dist/a2a/index.js +3 -3
  3. package/dist/{action-result-CL-QCITA.d.ts → action-result-BcudBQOF.d.ts} +1 -1
  4. package/dist/active-tenant-DVee32-T.js +39 -0
  5. package/dist/{adoption-scan-BLs67P1l.js → adoption-scan-0oFt2RD5.js} +1 -1
  6. package/dist/agent/index.d.ts +2 -2
  7. package/dist/agent/index.js +1 -1
  8. package/dist/ai-sdk/index.d.ts +3 -3
  9. package/dist/ai-sdk/index.js +3 -3
  10. package/dist/{approval-prompt-PYagyQUj.d.ts → approval-prompt-3BqWczTt.d.ts} +1 -1
  11. package/dist/approvals/index.d.ts +3 -3
  12. package/dist/{arazzo-3RhGfkAK.js → arazzo-DA9PCXew.js} +1 -1
  13. package/dist/{arazzo-B5-ulWif.js → arazzo-DhxDfYt-.js} +2 -2
  14. package/dist/astro/index.d.ts +4 -4
  15. package/dist/astro/index.js +1 -1
  16. package/dist/{audience-BAkBDMqn.js → audience-DTjR8xet.js} +1 -1
  17. package/dist/authzen/index.d.ts +5 -5
  18. package/dist/authzen/index.js +1 -1
  19. package/dist/{automation-DqEoWHBc.d.ts → automation-C6Jg75xq.d.ts} +1 -1
  20. package/dist/better-auth/index.d.ts +1 -1
  21. package/dist/better-supabase/index.d.ts +192 -27
  22. package/dist/better-supabase/index.js +248 -64
  23. package/dist/{bind-D_sZSVA3.js → bind-BNQA9JK9.js} +7 -3
  24. package/dist/{bind-Cp2hBHzP.d.ts → bind-YYjvfpB9.d.ts} +12 -7
  25. package/dist/{build-instance-CNWaYJyr.js → build-instance-BWXqwQYU.js} +1 -1
  26. package/dist/{capability-ChuiONQU.d.ts → capability-Di9tiUvi.d.ts} +1 -1
  27. package/dist/{casbin-H0rKxBx2.js → casbin-BJu2liqU.js} +1 -1
  28. package/dist/{casbin-cbSbhT_k.js → casbin-BkhqGh2z.js} +1 -1
  29. package/dist/catalog/index.d.ts +4 -4
  30. package/dist/catalog/index.js +2 -2
  31. package/dist/{catalog-BFpz2EmT.js → catalog-CGlSwU6j.js} +2 -2
  32. package/dist/catalog-D3oS2GH3.js +1 -0
  33. package/dist/{catalog-DCspHDc8.js → catalog-amPDr0JQ.js} +1 -1
  34. package/dist/{catalog-operations-Dadrl7Z-.js → catalog-operations-DeHTrJSV.js} +1 -1
  35. package/dist/chat/index.d.ts +1 -1
  36. package/dist/chat/index.js +1 -1
  37. package/dist/chat-sdk/index.d.ts +3 -3
  38. package/dist/claude-agent/index.d.ts +3 -3
  39. package/dist/claude-agent/index.js +2 -2
  40. package/dist/clerk/index.d.ts +2 -2
  41. package/dist/cli/bin.js +1 -1
  42. package/dist/cli/index.d.ts +9 -4
  43. package/dist/cli/index.js +11 -3
  44. package/dist/cloud/index.d.ts +8 -8
  45. package/dist/{cloud-BFlGMaak.js → cloud-3RIuS4E9.js} +2 -2
  46. package/dist/{codemod-DLQ9Zpo4.js → codemod-DLcp-B6v.js} +2 -2
  47. package/dist/{codemod-DWSN2erG.js → codemod-DRl_w-bY.js} +1 -1
  48. package/dist/collect-D-eroIfV.js +1 -0
  49. package/dist/{collect-Bzv3le0A.js → collect-D9Tt0Bcx.js} +2 -2
  50. package/dist/{collect-B7ZFAJU3.js → collect-WCl8cJQV.js} +1 -1
  51. package/dist/compile/index.d.ts +1 -1
  52. package/dist/{compile-BFzysW3o.d.ts → compile-BEklRUYo.d.ts} +2 -2
  53. package/dist/{completion-saoYiRFO.js → completion-VSWvaaPO.js} +1 -1
  54. package/dist/{config-BwPBfN0t.js → config-BR23fL8m.js} +2 -2
  55. package/dist/{config-DBeXXmBF.js → config-kL36AxkE.js} +1 -1
  56. package/dist/{config-report-BipSWA6V.js → config-report-osnfUNg5.js} +3 -3
  57. package/dist/{config-shape-ykV0Vm2n.js → config-shape-tsxHx71E.js} +2 -1
  58. package/dist/convex/index.d.ts +4 -4
  59. package/dist/convex/index.js +2 -2
  60. package/dist/{core-hWIARPDz.d.ts → core-CFepFiDP.d.ts} +2 -2
  61. package/dist/{core-H-mbhpZc.js → core-DzVINFbU.js} +3 -3
  62. package/dist/{create-Cq4Uox0f.js → create-6EwRQlig.js} +3 -3
  63. package/dist/{create-_noSrY1T.js → create-BLPKnJKa.js} +23 -7
  64. package/dist/{create-BSNrVuxh.d.ts → create-BPUopdfL.d.ts} +7 -7
  65. package/dist/{create-CM1FciYG.d.ts → create-CDd9c22W.d.ts} +15 -6
  66. package/dist/{create-BVq1lNQE.d.ts → create-DBvUsgzK.d.ts} +4 -4
  67. package/dist/delivery/index.d.ts +4 -4
  68. package/dist/delivery/index.js +1 -1
  69. package/dist/{denied-text-CHNlVInN.d.ts → denied-text-DHldhVUv.d.ts} +1 -1
  70. package/dist/{describe-ByS9LgHK.d.ts → describe-BbFPBSms.d.ts} +1 -1
  71. package/dist/{diff-CN8IYhC_.js → diff-BwR1JdP2.js} +1 -1
  72. package/dist/{diff-iZWV65nC.js → diff-CQegtBAo.js} +2 -2
  73. package/dist/{doctor-D3wo-yuz.js → doctor-B9FY9H0F.js} +2 -2
  74. package/dist/{doctor-CHD1M9R5.js → doctor-DfTnMaUt.js} +144 -16
  75. package/dist/drizzle/index.d.ts +3 -3
  76. package/dist/elysia/index.d.ts +4 -4
  77. package/dist/elysia/index.js +1 -1
  78. package/dist/{errors-zi_4T-rx.d.ts → errors-BIM4MFsJ.d.ts} +1 -1
  79. package/dist/{evaluate-Dd8Ta0Ie.js → evaluate-BAmf_AQd.js} +13 -4
  80. package/dist/{evaluations-z8dQFDaN.d.ts → evaluations-DOWuBpWv.d.ts} +3 -3
  81. package/dist/eve/index.d.ts +4 -4
  82. package/dist/eve/index.js +2 -2
  83. package/dist/express/index.d.ts +4 -4
  84. package/dist/express/index.js +1 -1
  85. package/dist/fastify/index.d.ts +4 -4
  86. package/dist/fastify/index.js +1 -1
  87. package/dist/{fetch-adapter-C1DCvpqV.d.ts → fetch-adapter-BIbBAtPZ.d.ts} +2 -2
  88. package/dist/{fetch-adapter-JL43jD3E.js → fetch-adapter-dPTgJVHd.js} +1 -1
  89. package/dist/{fields-D0vUI6dq.js → fields-DI8s3cPl.js} +1 -1
  90. package/dist/{gen-DWCYcMQM.js → gen-DuAhghDw.js} +2 -2
  91. package/dist/{gen-B5kvbAoZ.js → gen-DwgCSC6V.js} +1 -1
  92. package/dist/h3/index.d.ts +4 -4
  93. package/dist/h3/index.js +2 -2
  94. package/dist/hono/index.d.ts +4 -4
  95. package/dist/hono/index.js +1 -1
  96. package/dist/{hosted-Cmtxogd0.d.ts → hosted-DVxlLZMe.d.ts} +1 -1
  97. package/dist/{import-CST57XLp.js → import-CNBF96hB.js} +2 -2
  98. package/dist/{import-_YqhhwvX.js → import-Iuk9mx8A.js} +1 -1
  99. package/dist/{index-BhxEUY9J.d.ts → index-BinlXeU-.d.ts} +2 -2
  100. package/dist/{index-B8s204GL.d.ts → index-CV-7DWeD.d.ts} +4 -4
  101. package/dist/{index-BW_0MZOS.d.ts → index-Cay5-Kvx.d.ts} +13 -8
  102. package/dist/{index-_9UiQIkt.d.ts → index-DJwEgYzA.d.ts} +4 -4
  103. package/dist/{index-BT5-1VsX.d.ts → index-Dj2qF9VC.d.ts} +1 -1
  104. package/dist/{index-Bv5iXPqU.d.ts → index-ymept53A.d.ts} +4 -4
  105. package/dist/index.d.ts +16 -15
  106. package/dist/index.js +6 -6
  107. package/dist/{init-cE3A8aXq.js → init-DeoSvkh2.js} +1 -1
  108. package/dist/{init-Dz_PsHdv.js → init-fNF_XmTa.js} +3 -3
  109. package/dist/{instance-options-B0KXqTrJ.d.ts → instance-options-CoHn-0e8.d.ts} +1 -1
  110. package/dist/{instance-snapshot--JWiTrvO.js → instance-snapshot-DuWf1cT3.js} +13 -8
  111. package/dist/jwt/index.d.ts +4 -4
  112. package/dist/jwt/index.js +1 -1
  113. package/dist/{kernel-C-fYydV2.js → kernel-qv4cr9w8.js} +4 -4
  114. package/dist/kysely/index.d.ts +3 -3
  115. package/dist/{login-DplQ0s84.js → login-CutVtcmQ.js} +1 -1
  116. package/dist/{login-D-8tMqzo.js → login-DYazeWc9.js} +3 -3
  117. package/dist/{manifest-Cgiq5oqc.js → manifest-B4ENCp2I.js} +35 -35
  118. package/dist/{manifest-CzzWtnAb.d.ts → manifest-B5yF3CIq.d.ts} +19 -0
  119. package/dist/{manifest-wg8WkkpD.js → manifest-BXTbHNIV.js} +1 -1
  120. package/dist/{manifest-schema-2r37XRhD.js → manifest-schema-DQkBK2Mr.js} +28 -1
  121. package/dist/{map-claims-BNWCJtmP.js → map-claims-C-nv08_n.js} +2 -1
  122. package/dist/mcp/index.d.ts +8 -8
  123. package/dist/mcp/index.js +4 -4
  124. package/dist/{migrate-B7oP_sQU.js → migrate-BJHxQqT5.js} +2 -2
  125. package/dist/{module-values-BJTBdo6y.js → module-values-B1EVTkHP.js} +1 -1
  126. package/dist/nest/index.d.ts +4 -4
  127. package/dist/nest/index.js +1 -1
  128. package/dist/next/index.d.ts +32 -12
  129. package/dist/next/index.js +15 -8
  130. package/dist/next/plugin.d.ts +1 -1
  131. package/dist/next/plugin.js +1 -1
  132. package/dist/node/index.d.ts +4 -4
  133. package/dist/node/index.js +1 -1
  134. package/dist/openai/index.d.ts +4 -4
  135. package/dist/openai/index.js +3 -3
  136. package/dist/openapi/index.d.ts +2 -2
  137. package/dist/{openapi-VeHHU2l9.js → openapi-C-ADypaY.js} +1 -1
  138. package/dist/{openapi-CBZUhA3l.js → openapi-DFj0cirS.js} +2 -2
  139. package/dist/orpc/index.d.ts +5 -5
  140. package/dist/orpc/index.js +2 -2
  141. package/dist/otel/index.d.ts +3 -3
  142. package/dist/{output-tkju6U7R.js → output-LsbLe41I.js} +1 -1
  143. package/dist/{ownership-B4L59T9u.js → ownership-qqBuGJXr.js} +11 -6
  144. package/dist/{parse-local-manifest-BQhTlLQS.d.ts → parse-local-manifest-CCmbhnxP.d.ts} +1 -1
  145. package/dist/pdp/index.d.ts +3 -3
  146. package/dist/pdp/index.js +1 -1
  147. package/dist/{permdock-L-_I_3zP.js → permdock-BvjivVb9.js} +143 -107
  148. package/dist/{permdock-B6Sf4T_S.d.ts → permdock-CprAPN3w.d.ts} +9 -2
  149. package/dist/{permissions-mDcTWoBs.js → permissions-CYcHj_w7.js} +1 -1
  150. package/dist/{policy-Ba4bDhaj.d.ts → policy-BycVKnXv.d.ts} +1 -1
  151. package/dist/{policy-from-catalog-CJgOm6aq.js → policy-from-catalog-CU3An8uP.js} +1 -1
  152. package/dist/{policy-types-CCiDRZBH.d.ts → policy-types-DGIO_gxq.d.ts} +54 -18
  153. package/dist/{postgrest-DicQyqm-.d.ts → postgrest-D5nUGm-c.d.ts} +4 -3
  154. package/dist/{postgrest-D4nuPXIQ.js → postgrest-DAxFltvO.js} +35 -56
  155. package/dist/{powersync-DXqGuq9A.js → powersync-B_8uwz7f.js} +2 -2
  156. package/dist/powersync-CSzDCHRu.js +1 -0
  157. package/dist/{powersync-DHNQX06W.js → powersync-DUT-UKgw.js} +190 -38
  158. package/dist/prisma/index.d.ts +2 -2
  159. package/dist/{protected-action-BE7N_Luo.d.ts → protected-action-D8x73IGm.d.ts} +6 -6
  160. package/dist/{provider-DXfq5c2d.d.ts → provider-DfLeek9O.d.ts} +1 -1
  161. package/dist/{pull-CwpGaQSi.js → pull-DQCgvJSC.js} +2 -2
  162. package/dist/pull-DYbyod1f.js +1 -0
  163. package/dist/{push-DgssgzkK.js → push-Dq_ca4-j.js} +3 -3
  164. package/dist/{pushed-policy-ITwYKvvH.js → pushed-policy-CDuOL2de.js} +1 -1
  165. package/dist/{pushed-policy-D1Eoi6NM.d.ts → pushed-policy-CryQheKq.d.ts} +1 -1
  166. package/dist/react/index.d.ts +7 -7
  167. package/dist/react/provider-client.d.ts +1 -1
  168. package/dist/react-native/index.d.ts +9 -9
  169. package/dist/{replay-DNftIb_R.d.ts → replay-Bs9Df2fQ.d.ts} +1 -1
  170. package/dist/{request-context-C25ilqiJ.js → request-context-Duzdf0cd.js} +1 -1
  171. package/dist/resend/index.d.ts +4 -4
  172. package/dist/{resolve-names-CF7xXLSG.js → resolve-names-Y1Cb22cp.js} +4 -4
  173. package/dist/{rls-CNEH2_BG.js → rls-B57mIeVq.js} +34 -20
  174. package/dist/{rls-Ca8Jz9b5.js → rls-j0YrFPpW.js} +1 -1
  175. package/dist/{rpc-fNqAIqQk.js → rpc-vHIwyXCp.js} +1 -1
  176. package/dist/run-BATawNVH.js +1 -0
  177. package/dist/{run-Bz26OTfO.js → run-CLP_fQUF.js} +3 -3
  178. package/dist/{run-ticket-Dv7aF7Dk.js → run-ticket-DfnZCh-u.js} +19 -6
  179. package/dist/{run-ticket-DbWI9f99.d.ts → run-ticket-ylovhyFQ.d.ts} +18 -3
  180. package/dist/{saas-iWnUdwCt.js → saas-DK4V-3Is.js} +2 -2
  181. package/dist/{scan-DCj1KQfn.js → scan-B7xrAvRm.js} +1 -1
  182. package/dist/{schema-Dst9I9Gs.js → schema-3PJ8wAeL.js} +1 -1
  183. package/dist/scim/index.d.ts +1 -1
  184. package/dist/server/index.d.ts +11 -11
  185. package/dist/server/index.js +2 -2
  186. package/dist/{server-types-CIlpSA2G.d.ts → server-types-CyRN0-Cd.d.ts} +15 -8
  187. package/dist/{shared-Afctg7B0.js → shared-DrGLwM3s.js} +1 -1
  188. package/dist/{sink-Dvi7YZG_.d.ts → sink-B5zoUW_O.d.ts} +2 -2
  189. package/dist/{skills-OuoMR49L.js → skills-BUI8DMqy.js} +1 -1
  190. package/dist/{skills-Bjj7BNEQ.js → skills-iwbRxavw.js} +1 -1
  191. package/dist/{snapshot-cache-BAXZ0KOp.d.ts → snapshot-cache-BjAWkchD.d.ts} +1 -1
  192. package/dist/solid/index.d.ts +6 -6
  193. package/dist/solid-start/index.d.ts +4 -4
  194. package/dist/solid-start/index.js +2 -2
  195. package/dist/{sources-CMAM-2A3.js → sources-C4vkzZJV.js} +12 -7
  196. package/dist/{types-ah9NlU6j.d.ts → sources-oB1Hg1Fm.d.ts} +316 -2
  197. package/dist/{src-DZ0l9UAg.js → src-C_pi2Rnh.js} +106 -5
  198. package/dist/ssf/index.d.ts +3 -3
  199. package/dist/{standard-webhooks-C-qX4mJW.d.ts → standard-webhooks-DOYEuOLx.d.ts} +2 -2
  200. package/dist/{stores-C0Kta5Ft.d.ts → stores-DZJvxFIZ.d.ts} +6 -6
  201. package/dist/{stream-ltuLdtTG.d.ts → stream-9y9qw51m.d.ts} +1 -1
  202. package/dist/supabase/index.d.ts +5 -6
  203. package/dist/supabase/index.js +4 -4
  204. package/dist/supabase/middleware.d.ts +5 -5
  205. package/dist/supabase/middleware.js +4 -4
  206. package/dist/{supabase-BL1qJzzY.js → supabase-B1EfuD47.js} +2 -2
  207. package/dist/{supabase-D39cuGPt.js → supabase-BaizG0n7.js} +2 -2
  208. package/dist/{supabase-hook-B-yXnzUl.js → supabase-hook-BT2P9wah.js} +110 -47
  209. package/dist/supabase-hook-CbvGAutK.js +1 -0
  210. package/dist/{supautils-BU-pAEpf.js → supautils-DBKOoyjn.js} +247 -200
  211. package/dist/svelte/index.d.ts +6 -6
  212. package/dist/svelte/runtime.d.ts +3 -3
  213. package/dist/svelte/source.d.ts +6 -6
  214. package/dist/sveltekit/index.d.ts +4 -4
  215. package/dist/sveltekit/index.js +1 -1
  216. package/dist/{tables-DeMNEy6V.js → tables-DimBcVWY.js} +3 -3
  217. package/dist/tanstack-start/index.d.ts +4 -4
  218. package/dist/tanstack-start/index.js +1 -1
  219. package/dist/terminal/index.d.ts +5 -5
  220. package/dist/terminal/index.js +2 -2
  221. package/dist/testing/core.d.ts +1 -1
  222. package/dist/testing/core.js +1 -1
  223. package/dist/testing/fixtures/index.d.ts +1 -1
  224. package/dist/testing/fixtures/index.js +26 -28
  225. package/dist/testing/index.d.ts +23 -21
  226. package/dist/testing/index.js +64 -10
  227. package/dist/testing/saas/index.d.ts +3 -3
  228. package/dist/testing/saas/index.js +2 -2
  229. package/dist/testing/saas/permissions.js +1 -1
  230. package/dist/trpc/index.d.ts +5 -5
  231. package/dist/trpc/index.js +2 -2
  232. package/dist/{type-helpers-BIPIDa6a.d.ts → type-helpers-c7Xo_2Cu.d.ts} +1 -1
  233. package/dist/{types-B2mlGuhW.d.ts → types-B2efzoSX.d.ts} +1 -1
  234. package/dist/{types-DHKPcqzr.d.ts → types-B6ExllNo.d.ts} +2 -2
  235. package/dist/{types-AMJ5qoU_.d.ts → types-BB-zWDcR.d.ts} +4 -4
  236. package/dist/{types-djVzLlIV.d.ts → types-CEinc15V.d.ts} +4 -4
  237. package/dist/{types-yUuPR5Hy.d.ts → types-CN0LsqbK.d.ts} +3 -3
  238. package/dist/{types-HzqOtvsJ.d.ts → types-CWBsAwqn.d.ts} +4 -4
  239. package/dist/{types-DC1Loeh3.d.ts → types-Cklw5hJo.d.ts} +26 -3
  240. package/dist/{types-B_tiYvk8.d.ts → types-DLvhVm1r.d.ts} +1 -1
  241. package/dist/{types-B4uqKDnp.d.ts → types-DlelvQk4.d.ts} +2 -2
  242. package/dist/{types-DjuMBNF9.d.ts → types-DsHGPtkR.d.ts} +2 -2
  243. package/dist/{types-BJk0BKRX.d.ts → types-rCRV4Ge-.d.ts} +4 -4
  244. package/dist/{types-B_d_g7T3.d.ts → types-tQB2CEnY.d.ts} +4 -4
  245. package/dist/unplugin/index.d.ts +1 -1
  246. package/dist/unplugin/index.js +1 -1
  247. package/dist/{usage-ab0PdusX.js → usage-B1ZJOUdr.js} +1 -1
  248. package/dist/{usage-CxEzS4ey.js → usage-t_nXnwCW.js} +3 -3
  249. package/dist/usage-weohzv2f.js +1 -0
  250. package/dist/{validation-error-YGg2mXyH.d.ts → validation-error-uvp-kyfO.d.ts} +1 -1
  251. package/dist/{verify-DZeqoWu5.js → verify-jHrbmn-E.js} +9 -9
  252. package/dist/version-cache-Df11C2Qp.d.ts +51 -0
  253. package/dist/vue/index.d.ts +6 -6
  254. package/dist/{waiter-Bu9zAlE0.d.ts → waiter-CqUKX6CY.d.ts} +2 -2
  255. package/dist/{watch-Cx_WciLE.js → watch-Bpci3hBY.js} +2 -2
  256. package/dist/watch-COuvly20.js +1 -0
  257. package/dist/webmcp/index.d.ts +1 -1
  258. package/dist/{who-can-rI7dCR9Q.js → who-can-BoDJm0Nc.js} +1 -1
  259. package/dist/workflow/index.d.ts +3 -3
  260. package/dist/workflow/index.js +23 -7
  261. package/dist/workflow-sdk/index.d.ts +4 -4
  262. package/dist/{wrap-DlJE3gS_.d.ts → wrap-DxXB54Wu.d.ts} +2 -2
  263. package/package.json +3 -3
  264. package/schemas/run-v1.json +16 -0
  265. package/schemas/supabase-manifest-v1.json +28 -0
  266. package/skills/permdock-agents/references/operations-automations-chat.md +1 -0
  267. package/skills/permdock-data/references/queries-and-rls.md +1 -1
  268. package/skills/permdock-wire/references/adapters.md +4 -3
  269. package/dist/catalog-mRQQQhNK.js +0 -1
  270. package/dist/collect-B5BL3klN.js +0 -1
  271. package/dist/powersync-Djf-zCpB.js +0 -1
  272. package/dist/pull-B65ndFNZ.js +0 -1
  273. package/dist/run-D-JE8QWb.js +0 -1
  274. package/dist/sources-B1Os_YUu.d.ts +0 -312
  275. package/dist/supabase-hook-H-MtE9Wd.js +0 -1
  276. package/dist/usage-CYeXek0p.js +0 -1
  277. package/dist/watch-DB42U1ib.js +0 -1
@@ -1,4 +1,4 @@
1
- import { T as Policy, lr as Subject, sr as Principal } from "./policy-types-CCiDRZBH.js";
1
+ import { T as Policy, hr as Subject, pr as Principal } from "./policy-types-DGIO_gxq.js";
2
2
  import { c as saasPlans, l as saasRoles, s as saasPermissions } from "./permissions-Bx6UI8n1.js";
3
3
  //#region src/testing/saas/policy.d.ts
4
4
  /** Daily API-key quota per subject; the bucket should be per tenant too. */
@@ -11,7 +11,7 @@ import { o as isPortableCondition } from "./hosted-D0IzESu_.js";
11
11
  import { t as definePermissions } from "./permissions-CVXmRILq.js";
12
12
  import { n as copyJson, t as checkSchema } from "./json-schema-BPGa-RjQ.js";
13
13
  import { t as parseCatalog } from "./parse-1_ZheTW5.js";
14
- import { n as parsePushedPolicy } from "./pushed-policy-ITwYKvvH.js";
14
+ import { n as parsePushedPolicy } from "./pushed-policy-CDuOL2de.js";
15
15
  //#region src/catalog/json-schema-validator.ts
16
16
  const ANNOTATIONS = /* @__PURE__ */ new Set([
17
17
  "$schema",
@@ -429,6 +429,12 @@ type Subject<TPrincipal extends Principal = Principal> = {
429
429
  readonly context: Readonly<Record<string, unknown>>;
430
430
  readonly session?: string;
431
431
  readonly expiresAt?: number;
432
+ /**
433
+ * When the verified token was issued (`iat`), in seconds since the epoch. A
434
+ * `VersionCache` trusts the token's `authzVersion` for its `maxStaleMs` after
435
+ * it.
436
+ */
437
+ readonly issuedAt?: number;
432
438
  /**
433
439
  * The token's memberships are behind the source's authorization version:
434
440
  * `fresh` permissions deny.
@@ -1708,6 +1714,28 @@ type DecisionProvider = {
1708
1714
  readonly subject: Subject;
1709
1715
  }) => Promise<readonly string[] | null | undefined>;
1710
1716
  };
1717
+ /**
1718
+ * Shares one read per key within one `getPermDock` call: the first call runs
1719
+ * `read`, every later call with the same key gets its answer. A source created
1720
+ * once at module scope uses it so the reads of one instance share a single
1721
+ * query and no answer outlives the instance.
1722
+ */
1723
+ type SourceMemo = <T>(key: string, read: () => T) => T;
1724
+ /** What `getPermDock` passes to every source call besides its query. */
1725
+ type SourceContext = {
1726
+ /** Absent when the source is called outside `getPermDock`. */
1727
+ readonly memo?: SourceMemo;
1728
+ };
1729
+ /**
1730
+ * Whether an instance answers reads or writes: `read` may judge a token fresh
1731
+ * from a shared `VersionCache` within its `maxStaleMs`; `write` reads the
1732
+ * version live.
1733
+ */
1734
+ type Intent = "read" | "write";
1735
+ /** The custom-role sources' second argument. */
1736
+ type CustomRoleContext = SourceContext & {
1737
+ readonly held: readonly string[];
1738
+ };
1711
1739
  type CustomRoleSource = {
1712
1740
  /** Names the implementation in errors and events. */
1713
1741
  readonly name?: string;
@@ -1716,27 +1744,21 @@ type CustomRoleSource = {
1716
1744
  * the subject's live memberships hold there, declared or not, so a source can
1717
1745
  * skip its read when none of them is a custom role.
1718
1746
  */
1719
- rolesFor: (tenant: string, context?: {
1720
- readonly held: readonly string[];
1721
- }) => CustomRole[] | Promise<CustomRole[]>;
1747
+ rolesFor: (tenant: string, context?: CustomRoleContext) => CustomRole[] | Promise<CustomRole[]>;
1722
1748
  assignable?: (tenant: string) => string[] | Promise<string[]>;
1723
1749
  /**
1724
1750
  * Platform custom roles (`scope: 'global'`), read once per signed-in subject,
1725
1751
  * with `held`, the global role names the subject holds. A role here with a
1726
1752
  * tenant is ignored.
1727
1753
  */
1728
- globalRoles?: (context?: {
1729
- readonly held: readonly string[];
1730
- }) => CustomRole[] | Promise<CustomRole[]>;
1754
+ globalRoles?: (context?: CustomRoleContext) => CustomRole[] | Promise<CustomRole[]>;
1731
1755
  /**
1732
1756
  * Shared custom roles (`shared: true`), defined once for every tenant and
1733
1757
  * read once per subject with a tenant membership, with `held`, the role names
1734
1758
  * its live memberships hold in any tenant. A role here without `shared: true`
1735
1759
  * is ignored.
1736
1760
  */
1737
- sharedRoles?: (context?: {
1738
- readonly held: readonly string[];
1739
- }) => CustomRole[] | Promise<CustomRole[]>;
1761
+ sharedRoles?: (context?: CustomRoleContext) => CustomRole[] | Promise<CustomRole[]>;
1740
1762
  };
1741
1763
  /**
1742
1764
  * A `CustomRoleSource` built for the subject the instance serves, for an
@@ -1746,6 +1768,23 @@ type CustomRoleSource = {
1746
1768
  * `source-threw`.
1747
1769
  */
1748
1770
  type CustomRoleSourceFactory = (subject: Subject) => CustomRoleSource | undefined;
1771
+ /**
1772
+ * The principal `MembershipSource.version` is asked about: what its token
1773
+ * claims.
1774
+ */
1775
+ type VersionQuery = {
1776
+ readonly id: string;
1777
+ readonly roles?: readonly string[];
1778
+ readonly memberships?: readonly Membership[];
1779
+ readonly authzVersion?: number;
1780
+ /** When the token was issued, in seconds since the epoch (`iat`). */
1781
+ readonly issuedAt?: number;
1782
+ };
1783
+ /** `MembershipSource.version`'s second argument. */
1784
+ type VersionContext = SourceContext & {
1785
+ /** Absent outside `getPermDock`, where the read is live. */
1786
+ readonly intent?: Intent;
1787
+ };
1749
1788
  /** One member of a scope instance, as `MembershipSource.list` returns it. */
1750
1789
  type MemberEntry = {
1751
1790
  readonly principal: {
@@ -1759,7 +1798,7 @@ type MembershipSource = {
1759
1798
  membershipsFor: (principal: {
1760
1799
  readonly id: string;
1761
1800
  readonly kind?: string;
1762
- }, options: {
1801
+ }, options: SourceContext & {
1763
1802
  readonly tenant?: string;
1764
1803
  }) => Membership[] | Promise<Membership[]>;
1765
1804
  /**
@@ -1775,13 +1814,10 @@ type MembershipSource = {
1775
1814
  * change. A token whose `authzVersion` is behind it is stale for the policy's
1776
1815
  * `fresh` permissions. `roles` and `memberships` are what the token claims,
1777
1816
  * so a source can read more than the version in the same call when the claims
1778
- * show it will be needed.
1817
+ * show it will be needed. `authzVersion` and `issuedAt` (seconds) are the
1818
+ * token's, for a `VersionCache`.
1779
1819
  */
1780
- version?: (principal: {
1781
- readonly id: string;
1782
- readonly roles?: readonly string[];
1783
- readonly memberships?: readonly Membership[];
1784
- }) => number | undefined | Promise<number | undefined>;
1820
+ version?: (principal: VersionQuery, context?: VersionContext) => number | undefined | Promise<number | undefined>;
1785
1821
  /**
1786
1822
  * The global roles the principal holds now. With `onStale: 'reread'`, a stale
1787
1823
  * token's `principal.roles` is replaced by this answer, so a revoked platform
@@ -1791,7 +1827,7 @@ type MembershipSource = {
1791
1827
  globalRolesFor?: (principal: {
1792
1828
  readonly id: string;
1793
1829
  readonly kind?: string;
1794
- }) => readonly string[] | Promise<readonly string[]>;
1830
+ }, context?: SourceContext) => readonly string[] | Promise<readonly string[]>;
1795
1831
  /**
1796
1832
  * Keep the memberships the verified token carries and read this source only
1797
1833
  * when the token says they were truncated (`claimsFirst`).
@@ -2640,4 +2676,4 @@ type SubjectOf<P> = {
2640
2676
  readonly expiresAt?: number;
2641
2677
  };
2642
2678
  //#endregion
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 };
2679
+ export { LimitRemaining as $, Quota as $n, SnapshotGrant as $t, PolicyScopes as A, Grantee as An, SqlFunctionCondition as Ar, CredentialDecision as At, ValidateMode as B, relation as Bn, decideCredential as Bt, MembershipFixture as C, ApproverInput as Cn, MemberOfCondition as Cr, SupportSessionDecision as Ct, PolicyDelegation as D, anyOf as Dn, RelatedHop as Dr, parseSupportSession as Dt, PolicyAppDataSchemas as E, allOf as En, RelatedCondition as Er, decideSupportSession as Et, RoleScope as F, anyone as Fn, isSqlFunctionField as Fr, CredentialPolicyViolation as Ft, CustomRoleSource as G, DenialDetails as Gn, LocalCustomRoleTable as Gt, WireValidity as H, ApprovalRequiredDecision as Hn, parseCredential as Ht, SeparationConflict as I, assurance as In, CredentialRequest as It, DecisionSink as J, ExplainedDecision as Jn, LocalRowValue as Jt, CustomRoleSourceFactory as K, DenialReason as Kn, LocalMembershipRows as Kt, SubjectOf as L, authenticated as Ln, DecideCredentialOptions as Lt, PrincipalOf as M, InheritGrantee as Mn, isCondition as Mr, CredentialPermission as Mt, RoleBinding as N, RelationGrantee as Nn, isConditionDate as Nr, CredentialPermissionInput as Nt, PolicyOAuthScope as O, holder as On, RestrictedAncestors as Or, ApiKeyPrincipal as Ot, RoleOptions as P, actor as Pn, isConditionRef as Pr, CredentialPolicy as Pt, LimitConsumeInput as Q, Obligation as Qn, SnapshotAssignable as Qt, SupportAccessOptions as R, inherit as Rn, credentialDelegation as Rt, HostedGrantRef as S, Approver as Sn, ConditionValue as Sr, SupportSession as St, Policy as T, UserApprover as Tn, OpaqueCondition as Tr, SupportSessionRequest as Tt, CredentialVerifier as U, Decision as Un, InstanceHandle as Ut, VocabularyFromInput as V, AppObligation as Vn, isFeedId as Vt, CustomRoleContext as W, Denial as Wn, Instant as Wt, Intent as X, LimitDetail as Xn, LocalSnapshotRows as Xt, EntitlementSource as Y, GrantedDecision as Yn, LocalSnapshotManifest as Yt, JwtClaims as Z, MatchedGrant as Zn, Snapshot as Zt, GrantLimit as _, PolicyScopesInput as _n, ActorKind as _r, VerifiedToken as _t, ApprovalRequirement as a, CredentialEvent as an, AuthorizationDetail as ar, RelationHolder as at, GrantScope as b, ScopeNames as bn, Condition as br, WhereCompiler as bt, BreakGlassOptions as c, DeliveryEvent as cn, CustomRoleGrant as cr, SnapshotSource as ct, ClosureContext as d, EmailCategory as dn, JsonWebKeyLike as dr, SubjectResolver as dt, SnapshotNotEntitled as en, Trace as er, LimitStore as et, ClosureGrantFn as f, MembershipEvent as fn, Membership as fr, TenantSettings as ft, GrantCondition as g, WireDelegation as gn, VerifiedClaims as gr, VerificationFailure as gt, Grant as h, WireDenial as hn, Subject as hr, TokenVerifier as ht, ApprovalOption as i, AutomationEvent as in, Assurance as ir, RelationGroup as it, PolicyVocabulary as j, GranteeInput as jn, hasConditionOp as jr, CredentialKind as jt, PolicyOptions as k, user as kn, SqlFunctionArg as kr, Credential as kt, BreakGlassRequirements as l, DeliveryFailureCause as ln, Delegation as lr, SourceContext as lt, DelegationTarget as m, WireDecision as mn, SharedCustomRole as mr, TokenSigner as mt, ApprovalEscalation as n, AccessEvent as nn, TraceSkipReason as nr, MembershipSource as nt, ApprovalStage as o, DecisionEvent as on, Binding as or, RelationSource as ot, DelegationInput as p, SinkEvent as pn, Principal as pr, TokenFailureCause as pt, DecisionProvider as q, DeniedDecision as qn, LocalRowColumn as qt, ApprovalMode as r, AuthEvent as rn, Actor as rr, RelationChain as rt, AssuranceRequirement as s, DeliveryChannel as sn, CustomRole as sr, SettingsSource as st, ActivationOption as t, SnapshotScope as tn, TraceSkip as tr, MemberEntry as tt, BreakGlassSpec as u, DirectoryEvent as un, GnapAccess as ur, SourceMemo as ut, GrantMeta as v, Scope as vn, AdapterId as vr, VersionContext as vt, ObligationInput as w, PermissionApprover as wn, MemberOfParent as wr, SupportSessionPolicy as wt, GrantValidity as x, AnyOfApprover as xn, ConditionRef as xr, DecideSupportSessionOptions as xt, GrantOptions as y, ScopeDeclaration as yn, MembershipVia as yr, VersionQuery as yt, SupportConsent as z, plan as zn, credentialPolicyViolation as zt };
@@ -1,4 +1,4 @@
1
- import { $ as MemberEntry, T as Policy, W as CustomRoleSource, et as MembershipSource, lr as Subject, or as Membership, sr as Principal, tr as CustomRole } from "./policy-types-CCiDRZBH.js";
1
+ import { G as CustomRoleSource, T as Policy, fr as Membership, hr as Subject, nt as MembershipSource, pr as Principal, sr as CustomRole, tt as MemberEntry } from "./policy-types-DGIO_gxq.js";
2
2
  //#region src/supabase/postgrest.d.ts
3
3
  /**
4
4
  * What a supabase-js `rpc` call resolves to: `data` or an `error` with a
@@ -122,8 +122,9 @@ declare function readSubjectRecord(value: unknown): SubjectRecord | undefined;
122
122
  * stale token; when the version function is missing it falls back to
123
123
  * `subject_for`. With `policy`, a token that claims a custom role has its
124
124
  * subject read in one `subject_for` call instead, and custom roles are read
125
- * only for a subject that holds one. Each user and each instance is read once
126
- * per `postgrestSources` call, so create it per request or per job.
125
+ * only for a subject that holds one. It keeps no answers: create it once at
126
+ * module scope, and `getPermDock` shares each read within one instance. Pass
127
+ * `claimsFirst(…, { versions })` to share version reads across instances.
127
128
  */
128
129
  declare function postgrestSources(client: SupabaseRpcCaller, options?: PostgrestSourcesOptions): PostgrestSources;
129
130
  //#endregion
@@ -5,7 +5,7 @@ import { t as anonymousSubject } from "./subject-BGoM5o8B.js";
5
5
  import { t as readClaim } from "./claims-map-CKkoAAYF.js";
6
6
  import { t as clientNameOf } from "./clients-DYr3U86j.js";
7
7
  import "./budget-BELja5A9.js";
8
- import { a as hookApiNames } from "./sources-CMAM-2A3.js";
8
+ import { a as hookApiNames } from "./sources-C4vkzZJV.js";
9
9
  //#region src/supabase/subject.ts
10
10
  const REGISTERED = /* @__PURE__ */ new Set([
11
11
  "sub",
@@ -361,6 +361,7 @@ function mapClaims(claims, options) {
361
361
  });
362
362
  const session = typeof claims["session_id"] === "string" ? claims["session_id"] : void 0;
363
363
  const expiresAt = typeof claims["exp"] === "number" ? claims["exp"] : void 0;
364
+ const issuedAt = typeof claims["iat"] === "number" && Number.isFinite(claims["iat"]) ? claims["iat"] : void 0;
364
365
  return freezeDeep(compact({
365
366
  principal,
366
367
  actor,
@@ -368,6 +369,7 @@ function mapClaims(claims, options) {
368
369
  context: {},
369
370
  session,
370
371
  expiresAt,
372
+ issuedAt,
371
373
  liveSession: options.liveSession === true && session !== void 0 ? true : void 0
372
374
  }));
373
375
  }
@@ -485,6 +487,9 @@ function readSubjectRecord(value) {
485
487
  claims: isRecord(value["claims"]) && Object.keys(value["claims"]).length > 0 ? value["claims"] : void 0
486
488
  });
487
489
  }
490
+ function once(memo, key, read) {
491
+ return memo === void 0 ? read() : memo(key, read);
492
+ }
488
493
  /**
489
494
  * Membership, custom-role and subject sources over the `subject_for(p_user)`,
490
495
  * `authz_version_for(p_user)` and `members_of(p_scope, p_id)` functions
@@ -494,8 +499,9 @@ function readSubjectRecord(value) {
494
499
  * stale token; when the version function is missing it falls back to
495
500
  * `subject_for`. With `policy`, a token that claims a custom role has its
496
501
  * subject read in one `subject_for` call instead, and custom roles are read
497
- * only for a subject that holds one. Each user and each instance is read once
498
- * per `postgrestSources` call, so create it per request or per job.
502
+ * only for a subject that holds one. It keeps no answers: create it once at
503
+ * module scope, and `getPermDock` shares each read within one instance. Pass
504
+ * `claimsFirst(…, { versions })` to share version reads across instances.
499
505
  */
500
506
  function postgrestSources(client, options = {}) {
501
507
  const api = options.api;
@@ -506,73 +512,46 @@ function postgrestSources(client, options = {}) {
506
512
  const versionFn = options.versionFn ?? names?.authzVersionFor ?? "authz_version_for";
507
513
  const declared = options.policy === void 0 ? void 0 : options.policy.index.declaredRoles;
508
514
  const onlyDeclared = (held) => declared !== void 0 && held?.every((name) => declared.has(name)) === true;
509
- const loaded = /* @__PURE__ */ new Map();
510
- const versions = /* @__PURE__ */ new Map();
511
- const listed = /* @__PURE__ */ new Map();
512
- const list = (query) => {
513
- const key = JSON.stringify([query.scope, query.id]);
514
- const cached = listed.get(key);
515
- if (cached !== void 0) return cached.then((entries) => [...entries]);
516
- const pending = Promise.resolve(callRpc(client, schema, membersFn, {
515
+ const list = async (query) => {
516
+ const result = await callRpc(client, schema, membersFn, {
517
517
  p_scope: query.scope,
518
518
  p_id: query.id
519
- })).then((result) => {
520
- if (result.error !== null) throw new Error(`PermDock: ${schema}.${membersFn} failed: ${result.error.message}`);
521
- return readMemberEntries(result.data);
522
- });
523
- listed.set(key, pending);
524
- return pending.then((entries) => [...entries]);
525
- };
526
- const record = (userId) => {
527
- const cached = loaded.get(userId);
528
- if (cached !== void 0) return cached;
529
- const pending = Promise.resolve(callRpc(client, schema, fn, { p_user: userId })).then((result) => {
530
- if (result.error !== null) throw new Error(`PermDock: ${schema}.${fn} failed: ${result.error.message}`);
531
- return readSubjectRecord(result.data);
532
519
  });
533
- loaded.set(userId, pending);
534
- return pending;
535
- };
536
- const version = (userId) => {
537
- const read = loaded.get(userId);
538
- if (read !== void 0) return read.then((found) => found?.authzVersion);
539
- const cached = versions.get(userId);
540
- if (cached !== void 0) return cached;
541
- const pending = Promise.resolve(callRpc(client, schema, versionFn, { p_user: userId })).then((result) => result.error === null ? versionOf(result.data) : record(userId).then((found) => found?.authzVersion));
542
- versions.set(userId, pending);
543
- return pending;
520
+ if (result.error !== null) throw new Error(`PermDock: ${schema}.${membersFn} failed: ${result.error.message}`);
521
+ return readMemberEntries(result.data);
544
522
  };
545
- const live = async (userId) => {
546
- const found = await record(userId);
523
+ const record = (userId, memo) => once(memo, `${schema}.${fn}:${userId}`, async () => {
524
+ const result = await callRpc(client, schema, fn, { p_user: userId });
525
+ if (result.error !== null) throw new Error(`PermDock: ${schema}.${fn} failed: ${result.error.message}`);
526
+ return readSubjectRecord(result.data);
527
+ });
528
+ const version = (userId, memo) => once(memo, `${schema}.${versionFn}:${userId}`, async () => {
529
+ const result = await callRpc(client, schema, versionFn, { p_user: userId });
530
+ return result.error === null ? versionOf(result.data) : (await record(userId, memo))?.authzVersion;
531
+ });
532
+ const live = async (userId, memo) => {
533
+ const found = await record(userId, memo);
547
534
  return found?.active === true ? found : void 0;
548
535
  };
549
536
  return {
550
537
  memberships: {
551
- async membershipsFor(principal) {
552
- return [...(await live(principal.id))?.memberships ?? []];
538
+ async membershipsFor(principal, query) {
539
+ return [...(await live(principal.id, query.memo))?.memberships ?? []];
553
540
  },
554
- version(principal) {
555
- return declared !== void 0 && !onlyDeclared([...principal.roles ?? [], ...(principal.memberships ?? []).flatMap((membership) => membership.roles)]) ? record(principal.id).then((found) => found?.authzVersion) : version(principal.id);
541
+ version(principal, context) {
542
+ return declared !== void 0 && !onlyDeclared([...principal.roles ?? [], ...(principal.memberships ?? []).flatMap((membership) => membership.roles)]) ? record(principal.id, context?.memo).then((found) => found?.authzVersion) : version(principal.id, context?.memo);
556
543
  },
557
544
  list,
558
- async globalRolesFor(principal) {
559
- return [...(await live(principal.id))?.roles ?? []];
545
+ async globalRolesFor(principal, context) {
546
+ return [...(await live(principal.id, context?.memo))?.roles ?? []];
560
547
  }
561
548
  },
562
549
  customRoles(principal) {
550
+ const held = async (context, keep) => onlyDeclared(context?.held) ? [] : ((await live(principal.id, context?.memo))?.customRoles ?? []).filter(keep);
563
551
  return {
564
- async rolesFor(tenant, context) {
565
- if (onlyDeclared(context?.held)) return [];
566
- return ((await live(principal.id))?.customRoles ?? []).filter((role) => role.tenant === tenant);
567
- },
568
- async globalRoles(context) {
569
- if (onlyDeclared(context?.held)) return [];
570
- return ((await live(principal.id))?.customRoles ?? []).filter((role) => role.scope === "global");
571
- },
572
- async sharedRoles(context) {
573
- if (onlyDeclared(context?.held)) return [];
574
- return ((await live(principal.id))?.customRoles ?? []).filter((role) => role.shared === true);
575
- }
552
+ rolesFor: (tenant, context) => held(context, (role) => role.tenant === tenant),
553
+ globalRoles: (context) => held(context, (role) => role.scope === "global"),
554
+ sharedRoles: (context) => held(context, (role) => role.shared === true)
576
555
  };
577
556
  },
578
557
  async subject(userId) {
@@ -620,7 +599,7 @@ function postgrestSources(client, options = {}) {
620
599
  principal
621
600
  };
622
601
  },
623
- record
602
+ record: (userId) => record(userId)
624
603
  };
625
604
  }
626
605
  //#endregion
@@ -14,7 +14,7 @@ const generate = defineLeaf({
14
14
  async run(ctx, { flags }) {
15
15
  const out = fileOut("powersync", flags.out);
16
16
  const from = given(flags.policy);
17
- const { runPowerSync } = await import("./powersync-Djf-zCpB.js");
17
+ const { runPowerSync } = await import("./powersync-CSzDCHRu.js");
18
18
  return runPowerSync({
19
19
  cwd: ctx.cwd,
20
20
  config: ctx.config,
@@ -45,7 +45,7 @@ const verify = defineLeaf({
45
45
  const db = await dbUrl(ctx, flags, { required: true });
46
46
  const fixtures = given(flags.fixtures);
47
47
  const from = given(flags.policy);
48
- const { runPowerSync } = await import("./powersync-Djf-zCpB.js");
48
+ const { runPowerSync } = await import("./powersync-CSzDCHRu.js");
49
49
  return runPowerSync({
50
50
  cwd: ctx.cwd,
51
51
  config: ctx.config,
@@ -0,0 +1 @@
1
+ export { n as runPowerSync } from "./powersync-DUT-UKgw.js";