permdock 0.16.0 → 0.17.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 (374) hide show
  1. package/dist/a2a/index.d.ts +4 -4
  2. package/dist/a2a/index.js +3 -3
  3. package/dist/{adapter-context-CIQpQxbE.js → adapter-context-OHikyRqV.js} +1 -1
  4. package/dist/{adoption-scan-C2BCiUEG.js → adoption-scan-Ci0xiJ3T.js} +1 -1
  5. package/dist/agent/index.d.ts +2 -2
  6. package/dist/agent/index.js +1 -1
  7. package/dist/ai-sdk/index.d.ts +3 -3
  8. package/dist/ai-sdk/index.js +3 -3
  9. package/dist/approval-normalize-4KxMRdJC.js +189 -0
  10. package/dist/approval-policies-9VagPixq.d.ts +138 -0
  11. package/dist/{approval-prompt-3BqWczTt.d.ts → approval-prompt-BSh-yxbH.d.ts} +1 -1
  12. package/dist/approvals/index.d.ts +5 -4
  13. package/dist/approvals/index.js +7 -6
  14. package/dist/{approvals-DnIBTuXE.js → approvals-DdFcTncq.js} +3 -3
  15. package/dist/{approvers-B4r0N_Uz.js → approvers-CNtl4Vc5.js} +22 -1
  16. package/dist/{arazzo-CHoYnQXO.js → arazzo-7kbeh1yi.js} +2 -2
  17. package/dist/{arazzo-ClYz2Z0W.js → arazzo-_zUmT8ZT.js} +4 -4
  18. package/dist/{args-0FrVs5EH.js → args-iafbHiXn.js} +2 -5
  19. package/dist/astro/index.d.ts +4 -4
  20. package/dist/astro/index.js +2 -2
  21. package/dist/{audience-DTjR8xet.js → audience-jRO819i3.js} +1 -1
  22. package/dist/{auth--yPyZNgr.js → auth-j3Eu-j4h.js} +1 -1
  23. package/dist/authz-topic-Dbc-HDOS.js +15 -0
  24. package/dist/authzen/index.d.ts +5 -5
  25. package/dist/authzen/index.js +2 -2
  26. package/dist/{automation-C6Jg75xq.d.ts → automation-DCWuVKtd.d.ts} +1 -1
  27. package/dist/better-auth/index.d.ts +1 -1
  28. package/dist/better-auth/index.js +10 -8
  29. package/dist/better-supabase/index.d.ts +273 -38
  30. package/dist/better-supabase/index.js +493 -102
  31. package/dist/{better-supabase-Dirf_8Ec.js → better-supabase-BJtQ-kNf.js} +26 -10
  32. package/dist/{bind-BNQA9JK9.js → bind-BJFeLX1V.js} +6 -6
  33. package/dist/{bind-YYjvfpB9.d.ts → bind-DjFNX0Pq.d.ts} +7 -7
  34. package/dist/{budget-BELja5A9.js → budget-BBCPDOGP.js} +1 -1
  35. package/dist/{budget-hYsPz_yE.d.ts → budget-CNLsV2SL.d.ts} +1 -1
  36. package/dist/{build-instance-BWXqwQYU.js → build-instance-lye7oEqf.js} +3 -2
  37. package/dist/{capability-Di9tiUvi.d.ts → capability-BzjWdKmP.d.ts} +1 -1
  38. package/dist/{capability-BqX94r07.js → capability-zN6T9fxe.js} +2 -3
  39. package/dist/{casbin-C9EvElBb.js → casbin-C3O_O9nu.js} +2 -2
  40. package/dist/{casbin-D_rVQ31U.js → casbin-DFzk_so3.js} +2 -2
  41. package/dist/{casl-C4OINZHI.js → casl-CjBVJj8R.js} +2 -2
  42. package/dist/{casl-CHHoCldP.js → casl-CkBssiB1.js} +1 -1
  43. package/dist/catalog/index.d.ts +5 -5
  44. package/dist/catalog/index.js +6 -6
  45. package/dist/catalog-BpnjesqX.js +1 -0
  46. package/dist/{catalog-CGlSwU6j.js → catalog-DGDd_ww1.js} +5 -5
  47. package/dist/{catalog-amPDr0JQ.js → catalog-DJJIkR9P.js} +3 -3
  48. package/dist/{catalog-doc-DjMKzJp9.js → catalog-doc-C4DGfJCO.js} +3 -3
  49. package/dist/{catalog-operations-DeHTrJSV.js → catalog-operations-DVI5QO5R.js} +3 -3
  50. package/dist/{challenge-DImNcR7B.js → challenge-M_ghKJnT.js} +2 -2
  51. package/dist/chat/index.d.ts +1 -1
  52. package/dist/chat/index.js +2 -2
  53. package/dist/chat-sdk/index.d.ts +3 -3
  54. package/dist/{checks-CGkP3Z7A.js → checks-fyDOhcz0.js} +33 -1
  55. package/dist/claude-agent/index.d.ts +3 -3
  56. package/dist/claude-agent/index.js +2 -2
  57. package/dist/clerk/index.d.ts +2 -2
  58. package/dist/clerk/index.js +10 -7
  59. package/dist/cli/bin.js +1 -1
  60. package/dist/cli/index.d.ts +5 -5
  61. package/dist/cli/index.js +3 -3
  62. package/dist/cloud/index.d.ts +8 -8
  63. package/dist/cloud/index.js +1 -1
  64. package/dist/{cloud-DdaJ7ILM.js → cloud-DYqzmh5i.js} +4 -4
  65. package/dist/{codemod-ammy6wv4.js → codemod-DNGMGqBS.js} +395 -8
  66. package/dist/{codemod-B1USJS7a.js → codemod-DqB9klYI.js} +3 -3
  67. package/dist/{collect-DnXL4B8c.js → collect-C44RrKCI.js} +4 -4
  68. package/dist/collect-CAibhmCi.js +1 -0
  69. package/dist/{collect-WCl8cJQV.js → collect-HfJXl8Tr.js} +4 -4
  70. package/dist/compile/index.d.ts +1 -1
  71. package/dist/compile/index.js +1 -1
  72. package/dist/{compile-EzEMB-7v.js → compile-B_oJqmIg.js} +4 -4
  73. package/dist/{compile-BEklRUYo.d.ts → compile-BxiwRotu.d.ts} +2 -2
  74. package/dist/{completion--Y4YItFZ.js → completion-pwVjJlek.js} +3 -3
  75. package/dist/{config-CcLlvEYW.js → config-COHmivz9.js} +4 -4
  76. package/dist/{config-BQ77xMZk.js → config-DnfH6_eT.js} +2 -2
  77. package/dist/{config-report-DVMOLJ7F.js → config-report-C1jl7Na-.js} +2 -2
  78. package/dist/{context-BnIzxTNE.js → context-DeammvFl.js} +2 -2
  79. package/dist/convex/index.d.ts +4 -4
  80. package/dist/convex/index.js +3 -3
  81. package/dist/{core-CFepFiDP.d.ts → core-0iYZ5HUx.d.ts} +2 -2
  82. package/dist/{core-lxoANyai.js → core-W5f4Rjt0.js} +7 -7
  83. package/dist/{create-DBvUsgzK.d.ts → create-DNN3OtsO.d.ts} +4 -4
  84. package/dist/{create-CDd9c22W.d.ts → create-DrHUmKvG.d.ts} +6 -6
  85. package/dist/{create-BPUopdfL.d.ts → create-bzQlBzG4.d.ts} +7 -7
  86. package/dist/{create-Coq5fIrq.js → create-gqtDb1nU.js} +5 -5
  87. package/dist/{create-BLPKnJKa.js → create-jCPwPWXf.js} +6 -5
  88. package/dist/{credential-CyyyvCsL.js → credential-B3Hj4puZ.js} +4 -3
  89. package/dist/{credentials-CdDxp7jN.js → credentials-dkycUsY3.js} +1 -1
  90. package/dist/decision-CaG5_eNJ.js +21 -0
  91. package/dist/{delegation-CDB6_keF.js → delegation-aK4T_5WU.js} +3 -3
  92. package/dist/delivery/index.d.ts +4 -4
  93. package/dist/delivery/index.js +1 -1
  94. package/dist/{denied-text-DHldhVUv.d.ts → denied-text-DyzWwxEB.d.ts} +1 -1
  95. package/dist/{describe-Bb4hGK5d.js → describe-CogP1loh.js} +2 -1
  96. package/dist/{describe-BbFPBSms.d.ts → describe-nalX_HHE.d.ts} +1 -1
  97. package/dist/{diff-DfmYaIhB.js → diff-BTsLiW59.js} +7 -7
  98. package/dist/{diff-CxtbOi2l.js → diff-CcxYooMu.js} +2 -2
  99. package/dist/{doctor-CwYc2lJb.js → doctor-BNRhJegR.js} +3 -3
  100. package/dist/{doctor-D1Xnmy6u.js → doctor-DS-9ApID.js} +195 -30
  101. package/dist/drizzle/index.d.ts +3 -3
  102. package/dist/drizzle/index.js +1 -1
  103. package/dist/elysia/index.d.ts +4 -4
  104. package/dist/elysia/index.js +3 -3
  105. package/dist/{errors-Vpu6rKHl.js → errors-BhRkoNS7.js} +0 -2
  106. package/dist/{errors-BIM4MFsJ.d.ts → errors-Dc9FdamT.d.ts} +1 -1
  107. package/dist/{evaluate-BAmf_AQd.js → evaluate-CsjXeLRo.js} +18 -15
  108. package/dist/{evaluations-DOWuBpWv.d.ts → evaluations-BasA9zXp.d.ts} +3 -3
  109. package/dist/{evaluations-IBceAeKT.js → evaluations-DG40eSJa.js} +3 -22
  110. package/dist/eve/index.d.ts +4 -4
  111. package/dist/eve/index.js +3 -3
  112. package/dist/express/index.d.ts +4 -4
  113. package/dist/express/index.js +3 -3
  114. package/dist/fastify/index.d.ts +4 -4
  115. package/dist/fastify/index.js +3 -3
  116. package/dist/{fetch-adapter-BIbBAtPZ.d.ts → fetch-adapter-BgqpOOpd.d.ts} +2 -2
  117. package/dist/{fetch-adapter-dPTgJVHd.js → fetch-adapter-UZOW0PRC.js} +2 -2
  118. package/dist/{fields-DI8s3cPl.js → fields-CrjL6A49.js} +3 -3
  119. package/dist/{files-B3AA05f1.js → files-CfiRtQ-m.js} +1 -1
  120. package/dist/{fixtures-Bm4_K1ke.js → fixtures-0VTW5oNq.js} +2 -2
  121. package/dist/{flags-DXjoTVbS.js → flags-BlmpmXoY.js} +2 -2
  122. package/dist/{from-snapshot-DCakWRsr.js → from-snapshot-DMlSSo9b.js} +14 -12
  123. package/dist/{gen-DwgCSC6V.js → gen-CNCzG4sB.js} +2 -2
  124. package/dist/{gen-DuAhghDw.js → gen-DnpZwQPo.js} +9 -9
  125. package/dist/{generate-CRVV5V7l.js → generate-BqkZq8Dr.js} +2 -2
  126. package/dist/{grantee-conditions-BrYPe-w0.js → grantee-conditions-DX4K_gGI.js} +1 -1
  127. package/dist/{grantee-match-7RZZvoT_.js → grantee-match-BP-k4vRJ.js} +2 -2
  128. package/dist/h3/index.d.ts +4 -4
  129. package/dist/h3/index.js +3 -3
  130. package/dist/{helpers-DJicaG6f.js → helpers-DNnZffrI.js} +76 -12
  131. package/dist/hono/index.d.ts +4 -4
  132. package/dist/hono/index.js +3 -3
  133. package/dist/{hosted-DVxlLZMe.d.ts → hosted-DxRLLiFU.d.ts} +1 -1
  134. package/dist/{hosted-D0IzESu_.js → hosted-tPZnyjQS.js} +12 -10
  135. package/dist/{http-DOL33cO0.js → http-DhMWeB_h.js} +1 -1
  136. package/dist/{import-Dfe2unKO.js → import-BYVbSKx0.js} +3 -3
  137. package/dist/{import-CNBF96hB.js → import-C1XXpG_m.js} +4 -4
  138. package/dist/{index-Cay5-Kvx.d.ts → index-Bt-UoBWu.d.ts} +11 -10
  139. package/dist/{index-DJwEgYzA.d.ts → index-CXXUFWtG.d.ts} +17 -11
  140. package/dist/{index-Dj2qF9VC.d.ts → index-CZ5mixHO.d.ts} +1 -1
  141. package/dist/{index-ymept53A.d.ts → index-DFwUOkvt.d.ts} +4 -4
  142. package/dist/{index-CV-7DWeD.d.ts → index-DtGtDzjb.d.ts} +4 -4
  143. package/dist/{index-BinlXeU-.d.ts → index-z44pfWar.d.ts} +2 -2
  144. package/dist/index.d.ts +18 -16
  145. package/dist/index.js +20 -18
  146. package/dist/{init-C6cWP3xW.js → init-Dr1qAStu.js} +5 -5
  147. package/dist/{init-BUo2G-FI.js → init-YSDySeMy.js} +5 -5
  148. package/dist/{instance-options-CoHn-0e8.d.ts → instance-options-BOCRxEFb.d.ts} +2 -2
  149. package/dist/{instance-snapshot-DuWf1cT3.js → instance-snapshot-BgOGtyCy.js} +15 -12
  150. package/dist/jwt/index.d.ts +4 -4
  151. package/dist/jwt/index.js +3 -3
  152. package/dist/{kernel-BD8QuMnv.js → kernel-CDDU93dI.js} +10 -10
  153. package/dist/kysely/index.d.ts +3 -3
  154. package/dist/kysely/index.js +1 -1
  155. package/dist/{load-DjSU5KXO.js → load-BaEamml-.js} +1 -1
  156. package/dist/load-CjnlPxpL.js +1 -0
  157. package/dist/{login-D1MHOomI.js → login-CXgEKLaW.js} +4 -4
  158. package/dist/{login-DCKE5pVy.js → login-DEVXDTX8.js} +4 -4
  159. package/dist/{manifest-Cft51TLK.js → manifest-Dij1U0hx.js} +37 -37
  160. package/dist/{map-claims-C-nv08_n.js → map-claims-PQwHynxV.js} +25 -11
  161. package/dist/{map-error-pasIGqMT.js → map-error-B_f3C5cs.js} +1 -1
  162. package/dist/mcp/index.d.ts +8 -8
  163. package/dist/mcp/index.js +9 -9
  164. package/dist/{migrate-BJHxQqT5.js → migrate-BbY5-Khy.js} +4 -4
  165. package/dist/{module-values-B1EVTkHP.js → module-values-B8tNIxdd.js} +2 -2
  166. package/dist/nest/index.d.ts +4 -4
  167. package/dist/nest/index.js +3 -3
  168. package/dist/next/index.d.ts +32 -13
  169. package/dist/next/index.js +43 -25
  170. package/dist/next/plugin.d.ts +1 -1
  171. package/dist/next/plugin.js +2 -2
  172. package/dist/node/index.d.ts +4 -4
  173. package/dist/node/index.js +2 -2
  174. package/dist/openai/index.d.ts +4 -4
  175. package/dist/openai/index.js +3 -3
  176. package/dist/openapi/index.d.ts +2 -2
  177. package/dist/{openapi-BwWkHxvW.js → openapi-D3wkvOoU.js} +4 -4
  178. package/dist/{openapi-DSzQN7Zu.js → openapi-GM-kTdkq.js} +5 -5
  179. package/dist/orpc/index.d.ts +5 -5
  180. package/dist/orpc/index.js +3 -3
  181. package/dist/otel/index.d.ts +3 -3
  182. package/dist/otel/index.js +1 -1
  183. package/dist/{output-DlICTjBh.js → output-DhTpe8v1.js} +1 -1
  184. package/dist/output-files-BYscrQl-.js +1 -0
  185. package/dist/{output-files-BIQ_9pIs.js → output-files-CM0BnH05.js} +1 -1
  186. package/dist/{ownership-qqBuGJXr.js → ownership-moSRhxl_.js} +6 -6
  187. package/dist/{parse-1_ZheTW5.js → parse-UTC-sDrt.js} +2 -2
  188. package/dist/{parse-local-manifest-CCmbhnxP.d.ts → parse-local-manifest-BgTYdR3q.d.ts} +1 -1
  189. package/dist/{parse-request-CwCZpyjV.js → parse-request-DOBVaeiQ.js} +1 -1
  190. package/dist/pdp/index.d.ts +3 -3
  191. package/dist/pdp/index.js +3 -3
  192. package/dist/{peer-Q0fuZ6hx.js → peer-BuK9F53f.js} +1 -1
  193. package/dist/{peer-C9LvBCcb.js → peer-n-swIV4H.js} +1 -1
  194. package/dist/{permdock-CprAPN3w.d.ts → permdock-DUWZEOLR.d.ts} +88 -131
  195. package/dist/{permdock-BvjivVb9.js → permdock-DdzMv5-F.js} +195 -102
  196. package/dist/{permissions-CYcHj_w7.js → permissions-CvpPtz5O.js} +1 -1
  197. package/dist/{pg-DQTqRrou.js → pg-Ddxsd5ZB.js} +2 -2
  198. package/dist/{policy-BycVKnXv.d.ts → policy-CTNl7pvN.d.ts} +1 -1
  199. package/dist/{policy-CLQ8__GF.js → policy-DxQyHKPB.js} +5 -4
  200. package/dist/{policy-from-catalog-CU3An8uP.js → policy-from-catalog-DVa1faOr.js} +8 -7
  201. package/dist/{policy-types-DGIO_gxq.d.ts → policy-types-IRJVABmm.d.ts} +63 -19
  202. package/dist/{postgrest-D5nUGm-c.d.ts → postgrest-B_cEDd4e.d.ts} +12 -7
  203. package/dist/{postgrest-DAxFltvO.js → postgrest-BrjrckDG.js} +74 -19
  204. package/dist/{powersync-DAfo0EL5.js → powersync-BZxw_v-A.js} +3 -3
  205. package/dist/{powersync-CBhTBhG2.js → powersync-C0nsyULQ.js} +15 -15
  206. package/dist/powersync-Cqzx25dI.js +1 -0
  207. package/dist/preset/index.js +1 -1
  208. package/dist/{preset-BjLzeFpp.js → preset-pPrVyGU5.js} +74 -7
  209. package/dist/prisma/index.d.ts +2 -2
  210. package/dist/prisma/index.js +1 -1
  211. package/dist/{protected-action-DUYqb-Ma.js → protected-action-B6n6w7Rl.js} +1 -1
  212. package/dist/{protected-action-D8x73IGm.d.ts → protected-action-D3S9U4nc.d.ts} +14 -7
  213. package/dist/{protected-action-QEA8arRB.js → protected-action-qowj6nxN.js} +15 -5
  214. package/dist/{provider-C55OGXJ7.js → provider-CY4TSSJo.js} +2 -2
  215. package/dist/{provider-DfLeek9O.d.ts → provider-CjAu39fJ.d.ts} +1 -1
  216. package/dist/{provider-store-CaTv00tr.js → provider-store-BQP_pp8s.js} +2 -2
  217. package/dist/pull-CUVdB04v.js +1 -0
  218. package/dist/{pull-CQCGy1gv.js → pull-DVoZ0V9_.js} +6 -6
  219. package/dist/{push-Dq_ca4-j.js → push-eJl1Tvqm.js} +7 -7
  220. package/dist/{pushed-policy-CryQheKq.d.ts → pushed-policy-CUQuvlS3.d.ts} +1 -1
  221. package/dist/{pushed-policy-CDuOL2de.js → pushed-policy-DMXAOmEW.js} +1 -1
  222. package/dist/react/index.d.ts +8 -8
  223. package/dist/react/index.js +6 -6
  224. package/dist/react/provider-client.d.ts +1 -1
  225. package/dist/react/provider-client.js +1 -1
  226. package/dist/react-native/index.d.ts +10 -10
  227. package/dist/react-native/index.js +9 -9
  228. package/dist/refresh-on-L9UOwATg.d.ts +49 -0
  229. package/dist/{replay-Bs9Df2fQ.d.ts → replay-Dc3d8LhG.d.ts} +1 -1
  230. package/dist/{request-context-Duzdf0cd.js → request-context-Ch052blg.js} +2 -2
  231. package/dist/{request-schema-DhX7UbfQ.js → request-schema-CMP8Cmxd.js} +5 -0
  232. package/dist/resend/index.d.ts +4 -4
  233. package/dist/{resolve-names-Y1Cb22cp.js → resolve-names-1nCei24V.js} +6 -6
  234. package/dist/{rls-C5ZGzR_B.js → rls-BVzoZCn3.js} +4 -4
  235. package/dist/{rls-tHu7N_Pe.js → rls-ClJRblnR.js} +19 -19
  236. package/dist/{role-builder-BK2-T6oD.js → role-builder-BrmOcXch.js} +3 -157
  237. package/dist/{rpc-vHIwyXCp.js → rpc-BOu3FD6X.js} +2 -2
  238. package/dist/{run-DUq1xU4K.js → run-CnCaTjWX.js} +8 -40
  239. package/dist/run-D9N6V5WQ.js +1 -0
  240. package/dist/{run-ticket-ylovhyFQ.d.ts → run-ticket-C6lXvHM_.d.ts} +2 -2
  241. package/dist/{run-ticket-DfnZCh-u.js → run-ticket-CjvXr6wj.js} +1 -1
  242. package/dist/{runtime-BGnrOkVH.js → runtime-CBXkOcg9.js} +1 -1
  243. package/dist/{saas-DK4V-3Is.js → saas-BqM9mJkk.js} +13 -10
  244. package/dist/{scan-C3HRH9Fs.js → scan-CepUXrFt.js} +1 -1
  245. package/dist/{schema-DvXvxPhQ.js → schema-9_NDz8fx.js} +1 -1
  246. package/dist/{schema-BOJjqlWL.js → schema-CuX70xgH.js} +15 -2
  247. package/dist/scim/index.d.ts +1 -1
  248. package/dist/scim/index.js +1 -1
  249. package/dist/{scim-jJBJ7g1Z.js → scim-C30QBBoF.js} +2 -1
  250. package/dist/{scim-D8YupzX1.js → scim-CovliQUg.js} +2 -2
  251. package/dist/{scopes-0Up_UA2t.js → scopes-BSdYaGHs.js} +9 -40
  252. package/dist/server/index.d.ts +11 -11
  253. package/dist/server/index.js +8 -8
  254. package/dist/{server-3cVlTLde.js → server-D0PW6ZCw.js} +2 -2
  255. package/dist/{server-types-CyRN0-Cd.d.ts → server-types-Bw-lWqzR.d.ts} +8 -8
  256. package/dist/{shared-l0oGGetg.js → shared-BRmCJxDK.js} +2 -2
  257. package/dist/{shared-DrGLwM3s.js → shared-DyYVEjKC.js} +2 -2
  258. package/dist/{sink-B5zoUW_O.d.ts → sink-DUzt0e4B.d.ts} +2 -2
  259. package/dist/{skills-Celu2W6v.js → skills-BUuH-QFt.js} +2 -2
  260. package/dist/{skills-B2qTbaQa.js → skills-a4N6Y2Xm.js} +2 -2
  261. package/dist/{snapshot-CXlzi69u.js → snapshot-DN_8J27z.js} +6 -2
  262. package/dist/{snapshot-cache-Bx_4xC_6.js → snapshot-cache-B66h7FBK.js} +25 -8
  263. package/dist/{snapshot-cache-BjAWkchD.d.ts → snapshot-cache-Dbk-Gnij.d.ts} +20 -6
  264. package/dist/solid/index.d.ts +7 -7
  265. package/dist/solid/index.js +6 -6
  266. package/dist/solid-start/index.d.ts +4 -4
  267. package/dist/solid-start/index.js +3 -3
  268. package/dist/{sources-oB1Hg1Fm.d.ts → sources-CXY05xtB.d.ts} +1 -1
  269. package/dist/{src-C_pi2Rnh.js → src-nYNBfmgq.js} +187 -39
  270. package/dist/ssf/index.d.ts +3 -3
  271. package/dist/ssf/index.js +1 -1
  272. package/dist/{standard-webhooks-DOYEuOLx.d.ts → standard-webhooks-BFeEpjxy.d.ts} +2 -2
  273. package/dist/{store-RNFvaJJv.js → store-XgBMbfDy.js} +13 -7
  274. package/dist/{types-tQB2CEnY.d.ts → store-g5ctUrOI.d.ts} +114 -113
  275. package/dist/{store-options-Dil3lraY.js → store-options--zWn48PK.js} +76 -7
  276. package/dist/{stores-DxZWDXCs.js → stores-53_kOwPi.js} +3 -3
  277. package/dist/{stores-DZJvxFIZ.d.ts → stores-BtdN3eDO.d.ts} +5 -6
  278. package/dist/{stream-9y9qw51m.d.ts → stream-BMJg56jU.d.ts} +1 -1
  279. package/dist/{subject-BGoM5o8B.js → subject-C7RddW0G.js} +8 -1
  280. package/dist/supabase/client.d.ts +31 -0
  281. package/dist/supabase/client.js +21 -0
  282. package/dist/supabase/index.d.ts +37 -6
  283. package/dist/supabase/index.js +5 -4
  284. package/dist/supabase/middleware.d.ts +8 -7
  285. package/dist/supabase/middleware.js +6 -6
  286. package/dist/{supabase-DYWnT800.js → supabase-C6FyUeSh.js} +3 -3
  287. package/dist/{supabase-CDHMsDD0.js → supabase-C8cNzp4i.js} +31 -8
  288. package/dist/supabase-hook-CPBX4dy5.js +1 -0
  289. package/dist/{supabase-hook-HPgwYb9V.js → supabase-hook-Cj85nccs.js} +167 -21
  290. package/dist/{supautils-SwE642N1.js → supautils-BP_5WAIc.js} +12 -12
  291. package/dist/svelte/index.d.ts +7 -7
  292. package/dist/svelte/index.js +8 -8
  293. package/dist/svelte/runtime.d.ts +3 -3
  294. package/dist/svelte/runtime.js +3 -3
  295. package/dist/svelte/source.d.ts +7 -7
  296. package/dist/svelte/source.js +5 -5
  297. package/dist/sveltekit/index.d.ts +4 -4
  298. package/dist/sveltekit/index.js +2 -2
  299. package/dist/{tables-DimBcVWY.js → tables-BsGE6HBR.js} +7 -7
  300. package/dist/tanstack-start/index.d.ts +4 -4
  301. package/dist/tanstack-start/index.js +2 -2
  302. package/dist/{tenancy-5d1zVBvK.js → tenancy-DvOHHk3-.js} +1 -1
  303. package/dist/terminal/index.d.ts +5 -5
  304. package/dist/terminal/index.js +6 -6
  305. package/dist/testing/core.d.ts +1 -1
  306. package/dist/testing/core.js +1 -1
  307. package/dist/testing/fixtures/index.d.ts +1 -1
  308. package/dist/testing/fixtures/index.js +1 -1
  309. package/dist/testing/index.d.ts +29 -22
  310. package/dist/testing/index.js +118 -46
  311. package/dist/testing/saas/index.d.ts +3 -3
  312. package/dist/testing/saas/index.js +2 -2
  313. package/dist/testing/saas/permissions.js +1 -1
  314. package/dist/token-D6pWn8Uj.d.ts +11 -0
  315. package/dist/{token-DC9EQiet.js → token-DaMnIU9O.js} +24 -8
  316. package/dist/{tool-refusal-Qpjs_W6M.js → tool-refusal-C1UlhU0V.js} +1 -1
  317. package/dist/trpc/index.d.ts +5 -5
  318. package/dist/trpc/index.js +3 -3
  319. package/dist/{type-helpers-c7Xo_2Cu.d.ts → type-helpers-C_OnZW8c.d.ts} +1 -1
  320. package/dist/{types-B2efzoSX.d.ts → types-AOP5HQku.d.ts} +1 -1
  321. package/dist/{types-DlelvQk4.d.ts → types-B3BOcI0J.d.ts} +2 -2
  322. package/dist/{types-DLvhVm1r.d.ts → types-BvBbkAu1.d.ts} +16 -7
  323. package/dist/{types-BB-zWDcR.d.ts → types-CA-A33Q5.d.ts} +5 -5
  324. package/dist/{types-Cklw5hJo.d.ts → types-CAAN7evk.d.ts} +24 -1
  325. package/dist/{types-DsHGPtkR.d.ts → types-CJC1aaoJ.d.ts} +2 -2
  326. package/dist/{types-CWBsAwqn.d.ts → types-D29K5ZNP.d.ts} +4 -4
  327. package/dist/{types-CEinc15V.d.ts → types-DVZNTkU0.d.ts} +3 -4
  328. package/dist/{types-ZzRGoViD.d.ts → types-NYoj8JBm.d.ts} +2 -2
  329. package/dist/{types-B6ExllNo.d.ts → types-Sj1U8HMm.d.ts} +2 -2
  330. package/dist/{types-CN0LsqbK.d.ts → types-UfpcY575.d.ts} +3 -3
  331. package/dist/{types-rCRV4Ge-.d.ts → types-e82uzrTn.d.ts} +4 -4
  332. package/dist/unplugin/index.d.ts +1 -1
  333. package/dist/unplugin/index.js +2 -2
  334. package/dist/{usage-CPXeuAdT.js → usage-COsGLht5.js} +6 -6
  335. package/dist/{usage-CfZCQd0F.js → usage-CqcMeQgX.js} +2 -2
  336. package/dist/usage-D1cpHO7p.js +1 -0
  337. package/dist/{validation-error-uvp-kyfO.d.ts → validation-error-DpvsBwZJ.d.ts} +1 -1
  338. package/dist/{verify-DfT0QYNh.js → verify-C8G8D5mk.js} +19 -19
  339. package/dist/{version-cache-Df11C2Qp.d.ts → version-cache-9Vq5QVFC.d.ts} +9 -3
  340. package/dist/{views-CD8wuL4Z.js → views-TrZYlDnM.js} +1 -1
  341. package/dist/vue/index.d.ts +7 -7
  342. package/dist/vue/index.js +6 -6
  343. package/dist/{waiter-CqUKX6CY.d.ts → waiter-C2cXXLFZ.d.ts} +2 -2
  344. package/dist/{watch-DAkjm75Y.js → watch-DXRDBSCu.js} +3 -3
  345. package/dist/watch-DnymTAfe.js +1 -0
  346. package/dist/webmcp/index.d.ts +1 -1
  347. package/dist/webmcp/index.js +1 -1
  348. package/dist/{where-scope-DlCdCM_8.js → where-scope-BKrqUDVk.js} +5 -5
  349. package/dist/{who-can-BoDJm0Nc.js → who-can-BY5d3HPw.js} +4 -4
  350. package/dist/workflow/index.d.ts +3 -3
  351. package/dist/workflow/index.js +5 -4
  352. package/dist/workflow-sdk/index.d.ts +4 -4
  353. package/dist/{wrap-B2wziJI_.js → wrap-C5PWzgkq.js} +1 -1
  354. package/dist/{wrap-DxXB54Wu.d.ts → wrap-DpZAbxuD.d.ts} +2 -2
  355. package/package.json +8 -5
  356. package/schemas/approval-request-v1.json +5 -0
  357. package/schemas/catalog-v1.json +18 -2
  358. package/schemas/cli-result-v1.json +0 -2
  359. package/schemas/snapshot-v1.json +9 -0
  360. package/skills/permdock-approvals/SKILL.md +8 -8
  361. package/skills/permdock-approvals/references/stores-and-resume.md +7 -3
  362. package/skills/permdock-audit/SKILL.md +1 -1
  363. package/dist/action-result-BcudBQOF.d.ts +0 -19
  364. package/dist/catalog-D3oS2GH3.js +0 -1
  365. package/dist/collect-D-eroIfV.js +0 -1
  366. package/dist/load-Dm0pSYH3.js +0 -1
  367. package/dist/output-files-BHOIlrfD.js +0 -1
  368. package/dist/powersync-0QVP_DuR.js +0 -1
  369. package/dist/pull-CCAChKuy.js +0 -1
  370. package/dist/renames-CGj7YwcQ.js +0 -175
  371. package/dist/run-C5P3x1EI.js +0 -1
  372. package/dist/supabase-hook-qsewAVZY.js +0 -1
  373. package/dist/usage-DmmO_xjJ.js +0 -1
  374. package/dist/watch-CuPz0D2M.js +0 -1
@@ -1,6 +1,6 @@
1
- import { T as Policy, Un as Decision, fr as Membership, sr as CustomRole } from "./policy-types-DGIO_gxq.js";
1
+ import { E as Policy, dr as CustomRole, gr as Membership, qn as Decision } from "./policy-types-IRJVABmm.js";
2
2
  import { u as Permission } from "./permission-types-CAY-GU7e.js";
3
- import { f as WhereResult, o as PermDockOptions } from "./permdock-CprAPN3w.js";
3
+ import { f as WhereResult, o as PermDockOptions } from "./permdock-DUWZEOLR.js";
4
4
  //#region src/testing/policy-matrix.d.ts
5
5
  type MatrixOutcome = "granted" | "denied" | "approval-required";
6
6
  type MatrixCell = MatrixOutcome | {
@@ -1,11 +1,11 @@
1
- import { j as memoryCustomRoleSource } from "./src-C_pi2Rnh.js";
1
+ import { M as memoryCustomRoleSource } from "./src-nYNBfmgq.js";
2
2
  import { c as listPermissions } from "./permission-registry-B8tYxPIt.js";
3
- import { f as scopeList } from "./scopes-0Up_UA2t.js";
4
- import { y as membershipsClaim } from "./evaluate-BAmf_AQd.js";
5
- import { n as parseSnapshot } from "./snapshot-CXlzi69u.js";
6
- import { n as fromSnapshot } from "./from-snapshot-DCakWRsr.js";
7
- import { t as getPermDock } from "./permdock-BvjivVb9.js";
8
- import "./budget-BELja5A9.js";
3
+ import { d as scopeList } from "./scopes-BSdYaGHs.js";
4
+ import { y as membershipsClaim } from "./evaluate-CsjXeLRo.js";
5
+ import { n as parseSnapshot } from "./snapshot-DN_8J27z.js";
6
+ import { n as fromSnapshot } from "./from-snapshot-DMlSSo9b.js";
7
+ import { t as getPermDock } from "./permdock-DdzMv5-F.js";
8
+ import "./budget-BBCPDOGP.js";
9
9
  import { c as quoteSqlTable, n as defaultSqlCommand, o as quoteSqlIdent, t as SQL_IDENT } from "./sql-0WjxIp9g.js";
10
10
  //#region src/testing/policy-matrix.ts
11
11
  function isOutcomeCell(value) {
@@ -1,9 +1,9 @@
1
- import { Hn as ApprovalRequiredDecision, T as Policy, Yn as GrantedDecision, hr as Subject, j as PolicyVocabulary, pr as Principal, qn as DeniedDecision } from "./policy-types-DGIO_gxq.js";
1
+ import { $n as GrantedDecision, E as Policy, Kn as ApprovalRequiredDecision, M as PolicyVocabulary, Zn as DeniedDecision, _r as Principal, yr as Subject } from "./policy-types-IRJVABmm.js";
2
2
  import { t as Operation } from "./operations-Ci_rT6Uo.js";
3
- import { _ as PrincipalSource, a as PermDock, o as PermDockOptions } from "./permdock-CprAPN3w.js";
4
- import { m as ApprovalStore, p as ApprovalStatus } from "./types-DLvhVm1r.js";
3
+ import { _ as PrincipalSource, a as PermDock, o as PermDockOptions } from "./permdock-DUWZEOLR.js";
4
+ import { m as ApprovalStore, p as ApprovalStatus } from "./types-BvBbkAu1.js";
5
5
  import { n as ApprovalErrorCode } from "./errors-CHwoRRpB.js";
6
- import { t as ApprovalPrompt } from "./approval-prompt-3BqWczTt.js";
6
+ import { t as ApprovalPrompt } from "./approval-prompt-BSh-yxbH.js";
7
7
  //#region src/chat/subject.d.ts
8
8
  /**
9
9
  * The platform user behind a chat message or action. Fill it only from an event
@@ -1,10 +1,10 @@
1
- import { T as Policy, Un as Decision, Wn as Denial, Wt as Instant, ht as TokenVerifier, j as PolicyVocabulary, mt as TokenSigner, pr as Principal, rn as AuthEvent } from "./policy-types-DGIO_gxq.js";
1
+ import { E as Policy, Jn as Denial, Kt as Instant, M as PolicyVocabulary, _r as Principal, _t as TokenVerifier, an as AuthEvent, gt as TokenSigner, qn as Decision } from "./policy-types-IRJVABmm.js";
2
2
  import { u as Permission } from "./permission-types-CAY-GU7e.js";
3
- import { _ as PrincipalSource, a as PermDock, n as DecideOptions, o as PermDockOptions } from "./permdock-CprAPN3w.js";
4
- import { m as ApprovalStore } from "./types-DLvhVm1r.js";
5
- import { a as AutomationSource } from "./automation-C6Jg75xq.js";
6
- import { n as ApprovalWaiter } from "./waiter-CqUKX6CY.js";
7
- import { c as RunResource, i as RunBinding, r as RunAutomation } from "./run-ticket-ylovhyFQ.js";
3
+ import { _ as PrincipalSource, a as PermDock, n as DecideOptions, o as PermDockOptions } from "./permdock-DUWZEOLR.js";
4
+ import { m as ApprovalStore } from "./types-BvBbkAu1.js";
5
+ import { a as AutomationSource } from "./automation-DCWuVKtd.js";
6
+ import { n as ApprovalWaiter } from "./waiter-C2cXXLFZ.js";
7
+ import { c as RunResource, i as RunBinding, r as RunAutomation } from "./run-ticket-C6lXvHM_.js";
8
8
  //#region src/workflow/create.d.ts
9
9
  type WorkflowPermDockOptions = PermDockOptions & {
10
10
  /** Signs the run tickets `start` mints. */
@@ -1,13 +1,13 @@
1
- import { T as Policy, Un as Decision, hr as Subject, j as PolicyVocabulary, lr as Delegation, pr as Principal } from "./policy-types-DGIO_gxq.js";
1
+ import { E as Policy, M as PolicyVocabulary, _r as Principal, pr as Delegation, qn as Decision, yr as Subject } from "./policy-types-IRJVABmm.js";
2
2
  import { u as Permission } from "./permission-types-CAY-GU7e.js";
3
3
  import { t as Operation } from "./operations-Ci_rT6Uo.js";
4
- import { a as PermDock } from "./permdock-CprAPN3w.js";
5
- import { m as ApprovalStore } from "./types-DLvhVm1r.js";
6
- import { t as InstanceOptions } from "./instance-options-CoHn-0e8.js";
4
+ import { a as PermDock } from "./permdock-DUWZEOLR.js";
5
+ import { m as ApprovalStore } from "./types-BvBbkAu1.js";
6
+ import { t as InstanceOptions } from "./instance-options-BOCRxEFb.js";
7
7
  import { t as RequestContext } from "./request-context-C2_1lchh.js";
8
- import { n as PermDockWrap } from "./wrap-DxXB54Wu.js";
9
- import { o as OtelWrap } from "./types-B6ExllNo.js";
10
- import { t as DeniedText } from "./denied-text-DHldhVUv.js";
8
+ import { n as PermDockWrap } from "./wrap-DpZAbxuD.js";
9
+ import { o as OtelWrap } from "./types-Sj1U8HMm.js";
10
+ import { t as DeniedText } from "./denied-text-DyzWwxEB.js";
11
11
  //#region src/agent/step-up.d.ts
12
12
  /**
13
13
  * What the user can do to lift a denial: authenticate again with the `acr` and
@@ -1,10 +1,10 @@
1
1
  import { t as compact } from "./compact-CAf557ZB.js";
2
2
  import { n as freezeDeep } from "./freeze-jjan0lCv.js";
3
- import { o as deniedFor } from "./where-scope-DlCdCM_8.js";
4
- import { l as withApp } from "./permdock-BvjivVb9.js";
5
- import { t as composeWraps } from "./wrap-B2wziJI_.js";
6
- import { r as instanceOptions } from "./build-instance-BWXqwQYU.js";
7
- import { n as createAgentKernel } from "./kernel-BD8QuMnv.js";
3
+ import { o as deniedFor } from "./where-scope-BKrqUDVk.js";
4
+ import { l as withApp } from "./permdock-DdzMv5-F.js";
5
+ import { t as composeWraps } from "./wrap-C5PWzgkq.js";
6
+ import { r as instanceOptions } from "./build-instance-lye7oEqf.js";
7
+ import { n as createAgentKernel } from "./kernel-CDDU93dI.js";
8
8
  //#region src/agent/create.ts
9
9
  function modelRow(modelId) {
10
10
  return { id: modelId };
@@ -3,13 +3,14 @@ import { n as freezeDeep } from "./freeze-jjan0lCv.js";
3
3
  import { n as problemDetails } from "./problem-details-CLDgX1KV.js";
4
4
  import { c as listPermissions } from "./permission-registry-B8tYxPIt.js";
5
5
  import { n as resourceRef } from "./resource-ref-CaS9yVPi.js";
6
- import { i as challengeScope, l as withApp } from "./permdock-BvjivVb9.js";
6
+ import { i as challengeScope, l as withApp } from "./permdock-DdzMv5-F.js";
7
7
  import { r as hasCredentials } from "./http-DKLXrFGk.js";
8
8
  import { a as decisionResponse, c as problemFromDecision, d as unauthenticatedProblem, s as notFoundProblem, t as ANONYMOUS } from "./problem-BVLHFK33.js";
9
- import { n as resolveOrNull } from "./build-instance-BWXqwQYU.js";
10
- import { _ as LOAD_FAILED, l as InvalidSignatureError, n as applyApprovalResume, o as evaluationsHandler } from "./evaluations-IBceAeKT.js";
11
- import { n as tenantScope, t as actorFrom } from "./adapter-context-CIQpQxbE.js";
12
- import { n as requestContext, t as buildReportingInstance } from "./request-context-Duzdf0cd.js";
9
+ import { n as resolveOrNull } from "./build-instance-lye7oEqf.js";
10
+ import { t as LOAD_FAILED } from "./decision-CaG5_eNJ.js";
11
+ import { l as InvalidSignatureError, n as applyApprovalResume, o as evaluationsHandler } from "./evaluations-DG40eSJa.js";
12
+ import { n as tenantScope, t as actorFrom } from "./adapter-context-OHikyRqV.js";
13
+ import { n as requestContext, t as buildReportingInstance } from "./request-context-Ch052blg.js";
13
14
  //#region src/server/kernel-problems.ts
14
15
  const NOT_DELEGATED = freezeDeep({
15
16
  outcome: "denied",
@@ -7,9 +7,9 @@ import { c as listPermissions, h as formerKeys } from "./permission-registry-B8t
7
7
  import { g as secondsOf, l as isRfc3339, m as rfc3339, p as nowSeconds } from "./time-nR1JesoH.js";
8
8
  import { t as canonicalJson } from "./canonical-json-DwilZ1iB.js";
9
9
  import { r as sha256Digest } from "./sha256-C-4WXKIu.js";
10
- import { n as coveredByDelegation } from "./delegation-CDB6_keF.js";
10
+ import { n as coveredByDelegation } from "./delegation-aK4T_5WU.js";
11
11
  import { o as flattenGrantee } from "./grantee-Dke-9rd1.js";
12
- import { t as anonymousSubject } from "./subject-BGoM5o8B.js";
12
+ import { t as anonymousSubject } from "./subject-C7RddW0G.js";
13
13
  //#region src/core/credential.ts
14
14
  /**
15
15
  * A feed id: lowercase, so a mail system that lowercases a local part still
@@ -181,7 +181,8 @@ function credentialSubject(credential, options) {
181
181
  });
182
182
  } else {
183
183
  const membership = compact({
184
- tenant: credential.tenant,
184
+ scope: "tenant",
185
+ id: credential.tenant,
185
186
  roles: credential.roles ?? [],
186
187
  via: "credential"
187
188
  });
@@ -1,4 +1,4 @@
1
- import { n as CliError } from "./errors-Vpu6rKHl.js";
1
+ import { n as CliError } from "./errors-BhRkoNS7.js";
2
2
  //#region src/cli/core/io.ts
3
3
  const FRAMES = [
4
4
  "⠋",
@@ -0,0 +1,21 @@
1
+ //#region src/core/decision.ts
2
+ /** The denial for a check that failed or named no declared permission. */
3
+ const NO_GRANT = Object.freeze({
4
+ outcome: "denied",
5
+ denials: Object.freeze([Object.freeze({
6
+ role: null,
7
+ reason: "no-grant"
8
+ })]),
9
+ alternatives: Object.freeze([])
10
+ });
11
+ /** The denial for a check whose row loader threw: it fails closed. */
12
+ const LOAD_FAILED = Object.freeze({
13
+ outcome: "denied",
14
+ denials: Object.freeze([Object.freeze({
15
+ role: null,
16
+ reason: "validation"
17
+ })]),
18
+ alternatives: Object.freeze([])
19
+ });
20
+ //#endregion
21
+ export { NO_GRANT as n, LOAD_FAILED as t };
@@ -4,11 +4,11 @@ import { a as resolveConditionRef, c as isConditionDate, d as parentHop, l as is
4
4
  import { o as sameId, t as expiredAt } from "./expiry-6XByK0dm.js";
5
5
  import { g as formerScopes, m as annotationsFor, n as findPermission } from "./permission-registry-B8tYxPIt.js";
6
6
  import { o as epochSeconds } from "./time-nR1JesoH.js";
7
- import { f as scopeList, h as tenantOf, m as subjectMemberships, s as resolveScope } from "./scopes-0Up_UA2t.js";
7
+ import { d as scopeList, p as tenantOf, s as resolveScope } from "./scopes-BSdYaGHs.js";
8
8
  import { t as isoInstant } from "./instant-DK3Iz83e.js";
9
9
  import { o as flattenGrantee } from "./grantee-Dke-9rd1.js";
10
10
  import { t as isActive } from "./validity-Buc7w8E9.js";
11
- import { n as matchGrantee } from "./grantee-match-7RZZvoT_.js";
11
+ import { n as matchGrantee } from "./grantee-match-BP-k4vRJ.js";
12
12
  //#region src/conditions/evaluate.ts
13
13
  function resolveRef(ref, subject) {
14
14
  return resolveConditionRef(ref, subject);
@@ -73,7 +73,7 @@ function evaluateMemberOf(condition, data, subject, now, scopes) {
73
73
  if (data === null || typeof data !== "object") return false;
74
74
  const rowValue = ownGet(data, condition.field);
75
75
  if (rowValue === void 0 || rowValue === null) return false;
76
- const memberships = subjectMemberships(subject.principal?.memberships, scopes);
76
+ const memberships = subject.principal?.memberships ?? [];
77
77
  const wanted = new Set(condition.roles);
78
78
  const active = subject.principal?.tenant === "" ? void 0 : subject.principal?.tenant;
79
79
  const scope = condition.scope === "resource" ? void 0 : resolveScope(scopes, condition.scope);
@@ -1,5 +1,5 @@
1
- import { dn as EmailCategory, ln as DeliveryFailureCause, sn as DeliveryChannel } from "../policy-types-DGIO_gxq.js";
2
- import { i as approvalUrlFor, n as ApprovalUrl, r as approvalPrompt, t as ApprovalPrompt } from "../approval-prompt-3BqWczTt.js";
3
- import { _ as TransportOptions, a as DeliveryReport, c as DeliveryTransport, d as EmailTransport, f as EmailUnsubscribe, g as TransportMessages, h as TransportItem, i as DeliveryMessages, l as DeliveryTransports, m as Recipient, n as ChatTransport, o as DeliveryResult, p as OutgoingEmail, r as DeliverOptions, s as DeliveryTarget, t as ChatMessage, u as EmailMessage, v as WebhookMessage, y as WebhookTransport } from "../types-CN0LsqbK.js";
4
- import { C as audience, S as SubscriberEvent, _ as ParseConnectorResult, a as DeliveryPermDock, b as Audience, c as MemoryDelivery, d as memoryDeliveryTransport, f as CONNECTOR_SCHEMA, g as ConnectorKind, h as ConnectorIssue, i as isDeliveryTarget, l as MemoryDeliveryTransport, m as Connector, n as webhookTransport, o as DeliveryPermDockOptions, p as CONNECTOR_KINDS, r as isAddrSpec, s as createPermDock, t as WebhookTransportOptions, u as MemoryDeliveryTransportOptions, v as SiemDestination, w as subscribersFor, x as AudienceOptions, y as parseConnector } from "../index-ymept53A.js";
1
+ import { dn as DeliveryFailureCause, ln as DeliveryChannel, pn as EmailCategory } from "../policy-types-IRJVABmm.js";
2
+ import { i as approvalUrlFor, n as ApprovalUrl, r as approvalPrompt, t as ApprovalPrompt } from "../approval-prompt-BSh-yxbH.js";
3
+ import { _ as TransportOptions, a as DeliveryReport, c as DeliveryTransport, d as EmailTransport, f as EmailUnsubscribe, g as TransportMessages, h as TransportItem, i as DeliveryMessages, l as DeliveryTransports, m as Recipient, n as ChatTransport, o as DeliveryResult, p as OutgoingEmail, r as DeliverOptions, s as DeliveryTarget, t as ChatMessage, u as EmailMessage, v as WebhookMessage, y as WebhookTransport } from "../types-UfpcY575.js";
4
+ import { C as audience, S as SubscriberEvent, _ as ParseConnectorResult, a as DeliveryPermDock, b as Audience, c as MemoryDelivery, d as memoryDeliveryTransport, f as CONNECTOR_SCHEMA, g as ConnectorKind, h as ConnectorIssue, i as isDeliveryTarget, l as MemoryDeliveryTransport, m as Connector, n as webhookTransport, o as DeliveryPermDockOptions, p as CONNECTOR_KINDS, r as isAddrSpec, s as createPermDock, t as WebhookTransportOptions, u as MemoryDeliveryTransportOptions, v as SiemDestination, w as subscribersFor, x as AudienceOptions, y as parseConnector } from "../index-DFwUOkvt.js";
5
5
  export { type ApprovalPrompt, type ApprovalUrl, type Audience, type AudienceOptions, CONNECTOR_KINDS, CONNECTOR_SCHEMA, type ChatMessage, type ChatTransport, type Connector, type ConnectorIssue, type ConnectorKind, type DeliverOptions, type DeliveryChannel, type DeliveryFailureCause, type DeliveryMessages, type DeliveryPermDock, type DeliveryPermDockOptions, type DeliveryReport, type DeliveryResult, type DeliveryTarget, type DeliveryTransport, type DeliveryTransports, type EmailCategory, type EmailMessage, type EmailTransport, type EmailUnsubscribe, type MemoryDelivery, type MemoryDeliveryTransport, type MemoryDeliveryTransportOptions, type OutgoingEmail, type ParseConnectorResult, type Recipient, type SiemDestination, type SubscriberEvent, type TransportItem, type TransportMessages, type TransportOptions, type WebhookMessage, type WebhookTransport, type WebhookTransportOptions, approvalPrompt, approvalUrlFor, audience, createPermDock, isAddrSpec, isDeliveryTarget, memoryDeliveryTransport, parseConnector, subscribersFor, webhookTransport };
@@ -1,5 +1,5 @@
1
1
  import { n as approvalUrlFor, t as approvalPrompt } from "../approval-prompt-B8hQY69x.js";
2
- import { n as subscribersFor, t as audience } from "../audience-DTjR8xet.js";
2
+ import { n as subscribersFor, t as audience } from "../audience-jRO819i3.js";
3
3
  import { t as CONNECTOR_SCHEMA } from "../connector-schema-CYLQNMYq.js";
4
4
  import { a as parseConnector, i as CONNECTOR_KINDS, n as createPermDock, r as memoryDeliveryTransport, t as webhookTransport } from "../delivery-BupfvJIV.js";
5
5
  import { i as isDeliveryTarget, n as isAddrSpec } from "../target-qdEAnnhU.js";
@@ -1,4 +1,4 @@
1
- import { Un as Decision } from "./policy-types-DGIO_gxq.js";
1
+ import { qn as Decision } from "./policy-types-IRJVABmm.js";
2
2
  import { u as Permission } from "./permission-types-CAY-GU7e.js";
3
3
  //#region src/agent/denied-text.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { i as flattenApprovers } from "./approvers-B4r0N_Uz.js";
1
+ import { a as flattenApprovers } from "./approvers-CNtl4Vc5.js";
2
2
  import { r as requiredPlans } from "./problem-details-CLDgX1KV.js";
3
3
  //#region src/core/describe.ts
4
4
  const TENANT_REASONS = /* @__PURE__ */ new Set([
@@ -43,6 +43,7 @@ const DESCRIBE_TITLES = {
43
43
  function labelApprover(approver) {
44
44
  if (approver.kind === "user") return `user ${approver.id}`;
45
45
  if (approver.kind === "permission") return `a holder of ${approver.permission}`;
46
+ if (approver.kind === "manager") return approver.levels === void 0 ? "the requester's manager" : `a manager up to ${approver.levels} levels above the requester`;
46
47
  if (approver.kind === "any-of") return `one of (${approver.of.map((entry) => flattenApprovers(entry).map(labelApprover).join(" and ")).join(", ")})`;
47
48
  return labelGrantee(approver);
48
49
  }
@@ -1,4 +1,4 @@
1
- import { Kn as DenialReason, Un as Decision, qn as DeniedDecision } from "./policy-types-DGIO_gxq.js";
1
+ import { Xn as DenialReason, Zn as DeniedDecision, qn as Decision } from "./policy-types-IRJVABmm.js";
2
2
  import { u as Permission } from "./permission-types-CAY-GU7e.js";
3
3
  //#region src/core/describe.d.ts
4
4
  type DecisionDescription = {
@@ -1,14 +1,14 @@
1
- import { j as memoryCustomRoleSource } from "./src-C_pi2Rnh.js";
1
+ import { M as memoryCustomRoleSource } from "./src-nYNBfmgq.js";
2
2
  import { n as findPermission } from "./permission-registry-B8tYxPIt.js";
3
3
  import { g as secondsOf } from "./time-nR1JesoH.js";
4
4
  import { t as canonicalJson } from "./canonical-json-DwilZ1iB.js";
5
- import { t as getPermDock } from "./permdock-BvjivVb9.js";
6
- import { i as configError, u as usageResult } from "./errors-Vpu6rKHl.js";
7
- import { t as buildCatalog } from "./catalog-doc-DjMKzJp9.js";
8
- import { a as loadModule, n as asPolicy, s as pickNamed } from "./load-DjSU5KXO.js";
9
- import { t as parseCatalog } from "./parse-1_ZheTW5.js";
5
+ import { t as getPermDock } from "./permdock-DdzMv5-F.js";
6
+ import { i as configError, u as usageResult } from "./errors-BhRkoNS7.js";
7
+ import { t as buildCatalog } from "./catalog-doc-C4DGfJCO.js";
8
+ import { a as loadModule, n as asPolicy, s as pickNamed } from "./load-BaEamml-.js";
9
+ import { t as parseCatalog } from "./parse-UTC-sDrt.js";
10
10
  import { t as operationFindings } from "./operation-findings-CXtFzlKJ.js";
11
- import { n as fixtureSubject, r as loadFixtures, t as fixtureRow } from "./fixtures-Bm4_K1ke.js";
11
+ import { n as fixtureSubject, r as loadFixtures, t as fixtureRow } from "./fixtures-0VTW5oNq.js";
12
12
  import { existsSync, readFileSync } from "node:fs";
13
13
  import { resolve } from "node:path";
14
14
  //#region src/cli/diff/format.ts
@@ -1,5 +1,5 @@
1
1
  import { t as defineLeaf } from "./command-L8EstFNm.js";
2
- import { c as given } from "./flags-DXjoTVbS.js";
2
+ import { c as given } from "./flags-BlmpmXoY.js";
3
3
  //#region src/cli/commands/diff.ts
4
4
  const diff = defineLeaf({
5
5
  positionals: [{
@@ -21,7 +21,7 @@ const diff = defineLeaf({
21
21
  }
22
22
  },
23
23
  async run(ctx, { flags, args }) {
24
- return (await import("./diff-DfmYaIhB.js")).runDiff({
24
+ return (await import("./diff-BTsLiW59.js")).runDiff({
25
25
  cwd: ctx.cwd,
26
26
  config: ctx.config,
27
27
  sources: [args["before"], args["after"]].filter((value) => value !== void 0),
@@ -1,5 +1,5 @@
1
1
  import { t as defineLeaf } from "./command-L8EstFNm.js";
2
- import { a as failOnFlag } from "./flags-DXjoTVbS.js";
2
+ import { a as failOnFlag } from "./flags-BlmpmXoY.js";
3
3
  import { n as ask, t as CANCELLED } from "./prompt-BYc6drYW.js";
4
4
  //#region src/cli/commands/doctor.ts
5
5
  const doctor = defineLeaf({
@@ -10,7 +10,7 @@ const doctor = defineLeaf({
10
10
  description: "Check codes or groups to run",
11
11
  valueHint: "code",
12
12
  async complete() {
13
- const { DOCTOR_CHECKS } = await import("./doctor-D1Xnmy6u.js");
13
+ const { DOCTOR_CHECKS } = await import("./doctor-DS-9ApID.js");
14
14
  return [.../* @__PURE__ */ new Set([...DOCTOR_CHECKS.map(({ code }) => code), ...DOCTOR_CHECKS.flatMap(({ groups }) => groups)])];
15
15
  }
16
16
  },
@@ -27,7 +27,7 @@ const doctor = defineLeaf({
27
27
  if (answer === void 0) return CANCELLED;
28
28
  fix = answer;
29
29
  }
30
- return (await import("./doctor-D1Xnmy6u.js")).runDoctor({
30
+ return (await import("./doctor-DS-9ApID.js")).runDoctor({
31
31
  cwd: ctx.cwd,
32
32
  config: ctx.config,
33
33
  only: flags.only,
@@ -3,48 +3,49 @@ import { o as hasConditionOp } from "./refs-C8BKxc_e.js";
3
3
  import { c as listPermissions, h as formerKeys } from "./permission-registry-B8tYxPIt.js";
4
4
  import { u as isPrincipalRelation } from "./resource-relations-8-pCScBO.js";
5
5
  import { t as canonicalJson } from "./canonical-json-DwilZ1iB.js";
6
- import { f as scopeList, l as rootScope, o as normalizeMemberships, s as resolveScope } from "./scopes-0Up_UA2t.js";
6
+ import { c as rootScope, d as scopeList, o as normalizeMemberships, s as resolveScope } from "./scopes-BSdYaGHs.js";
7
7
  import { o as flattenGrantee } from "./grantee-Dke-9rd1.js";
8
- import { u as separationConflicts } from "./policy-CLQ8__GF.js";
9
- import { T as validateCustomRole } from "./evaluate-BAmf_AQd.js";
10
- import { s as parseCredential } from "./credential-CyyyvCsL.js";
11
- import { a as describeError } from "./errors-Vpu6rKHl.js";
8
+ import { u as separationConflicts } from "./policy-DxQyHKPB.js";
9
+ import { T as validateCustomRole } from "./evaluate-CsjXeLRo.js";
10
+ import { s as parseCredential } from "./credential-B3Hj4puZ.js";
11
+ import { a as describeError } from "./errors-BhRkoNS7.js";
12
12
  import { t as policyRowConditionKeys } from "./row-conditions-BAGHOmVq.js";
13
13
  import { a as rel, n as doctorSrcPath, o as sqlFiles, r as listSourceFiles } from "./files-BSjrtIHw.js";
14
14
  import { i as DOCTOR_REPORT_SCHEMA } from "./version-DMQ0dnN5.js";
15
- import { c as jsonSchemaOf, i as catalogOAuthScopes } from "./catalog-doc-DjMKzJp9.js";
16
- import { a as loadModule, i as loadConfiguredPolicy, n as asPolicy, s as pickNamed } from "./load-DjSU5KXO.js";
15
+ import { c as jsonSchemaOf, i as catalogOAuthScopes } from "./catalog-doc-C4DGfJCO.js";
16
+ import { a as loadModule, i as loadConfiguredPolicy, n as asPolicy, s as pickNamed } from "./load-BaEamml-.js";
17
17
  import { t as catalogPath } from "./catalog-path-CnI0XTFK.js";
18
- import { r as runCollect } from "./collect-WCl8cJQV.js";
19
- import { n as supabaseTenantClaim } from "./budget-BELja5A9.js";
20
- import { a as nodeFiles, i as filesOf, n as betterSupabaseDefaults, o as readJson, r as betterSupabaseTenantClaim, t as betterSupabaseConfig } from "./better-supabase-Dirf_8Ec.js";
18
+ import { r as runCollect } from "./collect-HfJXl8Tr.js";
19
+ import { n as supabaseTenantClaim } from "./budget-BBCPDOGP.js";
20
+ import { a as filesOf, i as betterSupabaseTenantClaim, n as betterSupabaseConfig, o as nodeFiles, r as betterSupabaseDefaults, s as readJson, t as betterSupabaseAuthzVersions } from "./better-supabase-BJtQ-kNf.js";
21
21
  import { i as qualifySqlTable, s as quoteSqlLiteral } from "./sql-0WjxIp9g.js";
22
- import { a as scopeMembershipTable } from "./compile-EzEMB-7v.js";
22
+ import { a as scopeMembershipTable } from "./compile-B_oJqmIg.js";
23
23
  import { d as keptKeys, r as PERMDOCK_SCHEMA } from "./sources-C4vkzZJV.js";
24
- import { t as parseCatalog } from "./parse-1_ZheTW5.js";
24
+ import { t as parseCatalog } from "./parse-UTC-sDrt.js";
25
25
  import { n as activeTenantMismatch } from "./active-tenant-DVee32-T.js";
26
26
  import "./markers-BeHZ4x9Q.js";
27
- import { t as didYouMean } from "./args-0FrVs5EH.js";
28
- import { t as DOCS_BASE } from "./manifest-Cft51TLK.js";
27
+ import { t as didYouMean } from "./args-iafbHiXn.js";
28
+ import { t as DOCS_BASE } from "./manifest-Dij1U0hx.js";
29
29
  import { t as createStyle } from "./style-Ds11Hmk4.js";
30
- import { a as nonEmptyOr, r as findingOf } from "./output-DlICTjBh.js";
31
- import { i as runSkillsInstall } from "./skills-Celu2W6v.js";
30
+ import { a as nonEmptyOr, r as findingOf } from "./output-DhTpe8v1.js";
31
+ import { i as runSkillsInstall } from "./skills-BUuH-QFt.js";
32
32
  import { n as MIGRATION_DIRS, t as DEFAULT_SENSITIVE_ACTIONS } from "./constants-DcJABbLW.js";
33
- import { l as partPath } from "./output-files-BIQ_9pIs.js";
34
- import { _ as readSupabaseConfig, a as supabaseHookManifest, c as activeSource, d as resolveSchemas, g as pd074, h as pd045, l as pd039, m as attrsPlan, n as hookOut, v as supabaseConfig } from "./supabase-hook-HPgwYb9V.js";
35
- import { G as byKey, Q as graphSqlName, n as tableNameOf, o as graphPlan, r as tableNames } from "./tables-DimBcVWY.js";
36
- import { a as guardedTables, p as contextRefs, r as unsatisfiedKinds, t as ownershipRules } from "./ownership-qqBuGJXr.js";
33
+ import { l as partPath } from "./output-files-CM0BnH05.js";
34
+ import { _ as readSupabaseConfig, a as supabaseHookManifest, c as activeSource, d as resolveSchemas, g as pd074, h as pd045, l as pd039, m as attrsPlan, n as hookOut, v as supabaseConfig } from "./supabase-hook-Cj85nccs.js";
35
+ import { G as byKey, Q as graphSqlName, n as tableNameOf, o as graphPlan, r as tableNames } from "./tables-BsGE6HBR.js";
36
+ import { a as guardedTables, p as contextRefs, r as unsatisfiedKinds, t as ownershipRules } from "./ownership-moSRhxl_.js";
37
37
  import { t as membershipSourcesOf } from "./sources-qoIJQrJv.js";
38
38
  import { i as group, n as membershipColumns, o as sqlStatements, r as tableKey } from "./deciding-columns-NB4wcyBf.js";
39
- import { t as FIELD_VIEWS } from "./fields-DI8s3cPl.js";
40
- import { t as resolveNames } from "./resolve-names-Y1Cb22cp.js";
41
- import { a as pd010, c as pd014, d as pd038, f as pd041, i as pd008, l as pd015, n as pd001, o as pd011, p as pd057, r as pd007, s as pd013, t as runUsage, u as pd036 } from "./usage-CPXeuAdT.js";
42
- import { d as rowConditionMessage, f as commandFor, m as tableFor, p as compileGrants, s as ROW_CONDITION_FIX, u as helperTablePolicies } from "./verify-DfT0QYNh.js";
43
- import { a as streamOf, i as scopeSourcesOf, r as staleFiles, t as powersyncFiles } from "./powersync-CBhTBhG2.js";
44
- import { a as buildContext, n as generateOptions, r as isRefusal, s as inheritTargets, t as supautilsRejections } from "./supautils-SwE642N1.js";
39
+ import { t as FIELD_VIEWS } from "./fields-CrjL6A49.js";
40
+ import { t as resolveNames } from "./resolve-names-1nCei24V.js";
41
+ import { a as pd010, c as pd014, d as pd038, f as pd041, i as pd008, l as pd015, n as pd001, o as pd011, p as pd057, r as pd007, s as pd013, t as runUsage, u as pd036 } from "./usage-COsGLht5.js";
42
+ import { d as rowConditionMessage, f as commandFor, m as tableFor, p as compileGrants, s as ROW_CONDITION_FIX, u as helperTablePolicies } from "./verify-C8G8D5mk.js";
43
+ import { a as streamOf, i as scopeSourcesOf, r as staleFiles, t as powersyncFiles } from "./powersync-C0nsyULQ.js";
44
+ import { a as buildContext, n as generateOptions, r as isRefusal, s as inheritTargets, t as supautilsRejections } from "./supautils-BP_5WAIc.js";
45
45
  import { n as legacyHelperNames, r as retirePlan, t as legacyHelperCalls } from "./retire-B2xffQgY.js";
46
46
  import { basename, dirname, join, resolve } from "node:path";
47
47
  import { pathToFileURL } from "node:url";
48
+ import { Visitor, parseSync } from "oxc-parser";
48
49
  import { createRequire } from "node:module";
49
50
  //#region src/cli/project/project.ts
50
51
  function loadProject(input) {
@@ -295,6 +296,23 @@ async function pd079(input) {
295
296
  fix: `declare ${key} in the policy and run permdock collect, or map the block action to a key the catalog lists`
296
297
  }));
297
298
  }
299
+ /**
300
+ * PermDock's hook keeps `permdock_authz_version` and better-supabase's
301
+ * `sessions.authzVersions` keeps `user_authz_versions`: two tables bump on
302
+ * different triggers, and only one reaches the `authz_ver` claim.
303
+ */
304
+ async function pd082(input) {
305
+ const hook = input.config.supabase?.hook;
306
+ if (hook === void 0 || hook.version === false) return [];
307
+ const config = await betterSupabaseConfig(input);
308
+ if (config === void 0 || !betterSupabaseAuthzVersions(config)) return [];
309
+ return [{
310
+ code: "PD082",
311
+ severity: "warning",
312
+ message: "supabase.hook keeps permdock_authz_version and better-supabase's blocks.sessions.authzVersions keeps user_authz_versions: two version tables bump on different triggers, and only PermDock's reaches the authz_ver claim",
313
+ fix: "turn blocks.sessions.authzVersions off; PermDock's trigger broadcasts on better_supabase:authz and authz:<uid>, which better-supabase's subscribeAuthzVersions and SessionProvider read"
314
+ }];
315
+ }
298
316
  //#endregion
299
317
  //#region src/cli/doctor/catalog.ts
300
318
  /**
@@ -761,7 +779,7 @@ async function pd025(input) {
761
779
  findings.push({
762
780
  code: "PD025",
763
781
  severity: "warning",
764
- message: `membership ${membership.principal ?? String(index)} grants nothing: its scope is not one of ${names}, a parent id is missing from within, or it mixes shapes`,
782
+ message: `membership ${membership.principal ?? String(index)} grants nothing: its scope is not one of ${names}, a parent id is missing from within, it mixes shapes, or it uses the { tenant, team } form 0.17.0 removed (permdock codemod 0.17 rewrites it)`,
765
783
  fix: "use { scope, id, within: { <parent>: id }, roles } with a declared scope, or { on: { resource, id }, roles }"
766
784
  });
767
785
  }
@@ -854,6 +872,105 @@ async function pd065(input) {
854
872
  })));
855
873
  }
856
874
  //#endregion
875
+ //#region src/cli/doctor/per-request.ts
876
+ /** Factories whose answers or entries only pay off when one is shared. */
877
+ const SHARED_FACTORIES = {
878
+ postgrestSources: "PD080",
879
+ memoryVersionCache: "PD080",
880
+ instanceCache: "PD081"
881
+ };
882
+ const MESSAGES = {
883
+ PD080: {
884
+ what: "so every call starts with no shared version reads",
885
+ fix: "create it once at module scope and pass the same object to every getPermDock call"
886
+ },
887
+ PD081: {
888
+ what: "so every call gets an empty cache and no instance is reused",
889
+ fix: "create one instanceCache() at module scope and pass it as instances to every adapter"
890
+ }
891
+ };
892
+ function isPermDockSpecifier(value) {
893
+ return value === "permdock" || value.startsWith("permdock/");
894
+ }
895
+ /**
896
+ * The calls to `postgrestSources`, `memoryVersionCache` and `instanceCache`
897
+ * imported from PermDock that sit inside a function body, except the right side
898
+ * of a `??=`, which builds the object once.
899
+ */
900
+ function callsInFunctions(source) {
901
+ const { program } = parseSync(source.file, source.text);
902
+ const names = /* @__PURE__ */ new Map();
903
+ const namespaces = /* @__PURE__ */ new Set();
904
+ const lazy = [];
905
+ const found = [];
906
+ let depth = 0;
907
+ const enter = () => {
908
+ depth += 1;
909
+ };
910
+ const exit = () => {
911
+ depth -= 1;
912
+ };
913
+ new Visitor({
914
+ ImportDeclaration(node) {
915
+ if (node.importKind === "type" || !isPermDockSpecifier(node.source.value)) return;
916
+ for (const specifier of node.specifiers) if (specifier.type === "ImportNamespaceSpecifier") namespaces.add(specifier.local.name);
917
+ else if (specifier.type === "ImportSpecifier" && specifier.importKind !== "type") {
918
+ const imported = specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value;
919
+ if (Object.hasOwn(SHARED_FACTORIES, imported)) names.set(specifier.local.name, imported);
920
+ }
921
+ },
922
+ FunctionDeclaration: enter,
923
+ "FunctionDeclaration:exit": exit,
924
+ FunctionExpression: enter,
925
+ "FunctionExpression:exit": exit,
926
+ ArrowFunctionExpression: enter,
927
+ "ArrowFunctionExpression:exit": exit,
928
+ AssignmentExpression(node) {
929
+ if (node.operator === "??=") lazy.push({
930
+ start: node.right.start,
931
+ end: node.right.end
932
+ });
933
+ },
934
+ CallExpression(node) {
935
+ if (depth === 0) return;
936
+ const { callee } = node;
937
+ let factory;
938
+ if (callee.type === "Identifier") factory = names.get(callee.name);
939
+ else if (callee.type === "MemberExpression" && callee.object.type === "Identifier" && namespaces.has(callee.object.name) && callee.property.type === "Identifier" && Object.hasOwn(SHARED_FACTORIES, callee.property.name)) factory = callee.property.name;
940
+ if (factory !== void 0) found.push({
941
+ call: node,
942
+ factory
943
+ });
944
+ }
945
+ }).visit(program);
946
+ return found.filter(({ call }) => !lazy.some((range) => call.start >= range.start && call.end <= range.end));
947
+ }
948
+ function findings(sources, code) {
949
+ const out = [];
950
+ for (const source of sources) {
951
+ if (!source.text.includes("permdock")) continue;
952
+ for (const { call, factory } of callsInFunctions(source)) {
953
+ if (SHARED_FACTORIES[factory] !== code) continue;
954
+ const line = source.text.slice(0, call.start).split("\n").length;
955
+ out.push({
956
+ code,
957
+ severity: "warning",
958
+ message: `${source.file}:${String(line)} creates ${factory}() inside a function, ${MESSAGES[code].what}`,
959
+ fix: MESSAGES[code].fix
960
+ });
961
+ }
962
+ }
963
+ return out;
964
+ }
965
+ /** PD080: `postgrestSources` or `memoryVersionCache` created per call. */
966
+ function pd080(sources) {
967
+ return findings(sources, "PD080");
968
+ }
969
+ /** PD081: `instanceCache` created per call. */
970
+ function pd081(sources) {
971
+ return findings(sources, "PD081");
972
+ }
973
+ //#endregion
857
974
  //#region src/cli/doctor/policy.ts
858
975
  async function pd017(input) {
859
976
  if (input.config.policy === void 0) return [];
@@ -886,12 +1003,12 @@ async function pd024(input) {
886
1003
  const findings = [];
887
1004
  for (const grant of policy.grants) {
888
1005
  const approval = grant.approval;
889
- if (grant.effect !== "allow" || approval === void 0 || approval === "human" || approval.distinct !== false) continue;
1006
+ if (grant.effect !== "allow" || approval === void 0 || approval === "human" || approval.mode !== "confirm") continue;
890
1007
  findings.push({
891
1008
  code: "PD024",
892
1009
  severity: "warning",
893
- message: `${grant.permission.key}${grant.role === null ? "" : ` (role ${grant.role})`} sets approval.distinct: false, so the requester can approve their own request`,
894
- fix: "remove distinct: false unless the requester confirming their own call (an agent asking its user) is the intent"
1010
+ message: `${grant.permission.key}${grant.role === null ? "" : ` (role ${grant.role})`} sets approval.mode: 'confirm', so the requester can approve their own request`,
1011
+ fix: "remove mode: 'confirm' unless the requester confirming their own call (an agent asking its user) is the intent"
895
1012
  });
896
1013
  }
897
1014
  return findings;
@@ -1008,6 +1125,33 @@ async function pd035(input) {
1008
1125
  return findings;
1009
1126
  }
1010
1127
  //#endregion
1128
+ //#region src/cli/doctor/postgrest.ts
1129
+ const POSTGREST_IMPORT = /import\s*\{[^}]*\bpostgrestSources\b[^}]*\}\s*from\s*["']permdock\/supabase["']/u;
1130
+ function definesFunction(sql, suffix) {
1131
+ return new RegExp(String.raw`create\s+(?:or\s+replace\s+)?function\s+(?:(?:"[^"]+"|\w+)\.)?"?\w*${suffix}"?\s*\(`, "iu").test(sql);
1132
+ }
1133
+ /**
1134
+ * PD083: `postgrestSources` from `permdock/supabase` with a hook file that
1135
+ * defines `subject_for` and no `authz_version_for`. Since 0.17.0 `version`
1136
+ * calls only the version function, so every `claimsFirst` check fails closed.
1137
+ */
1138
+ function pd083(cwd, config, sources, files = nodeFiles) {
1139
+ const user = sources.find((source) => POSTGREST_IMPORT.test(source.text));
1140
+ if (user === void 0) return [];
1141
+ const sql = sqlFiles(cwd, config.doctor?.migrations ?? MIGRATION_DIRS).map((file) => ({
1142
+ file,
1143
+ text: files.read(file)
1144
+ }));
1145
+ const subject = sql.find((item) => definesFunction(item.text, "subject_for"));
1146
+ if (subject === void 0 || sql.some((item) => definesFunction(item.text, "authz_version_for"))) return [];
1147
+ return [{
1148
+ code: "PD083",
1149
+ severity: "error",
1150
+ message: `${rel(cwd, user.file)} uses postgrestSources and ${rel(cwd, subject.file)} defines subject_for but no authz_version_for, so every version read fails and claimsFirst denies`,
1151
+ fix: "run permdock supabase hook generate (with supabase.hook.api for the PostgREST wrappers) and apply the migration it writes"
1152
+ }];
1153
+ }
1154
+ //#endregion
1011
1155
  //#region src/cli/doctor/powersync.ts
1012
1156
  /**
1013
1157
  * Why each membership source of a scope the streams read through sources has no
@@ -2345,6 +2489,27 @@ const DOCTOR_CHECKS = [
2345
2489
  groups: ["catalog", "better-supabase"],
2346
2490
  run: pd079
2347
2491
  },
2492
+ {
2493
+ code: "PD080",
2494
+ groups: ["caching"],
2495
+ run: (project) => pd080(project.sources())
2496
+ },
2497
+ {
2498
+ code: "PD081",
2499
+ groups: ["caching"],
2500
+ run: (project) => pd081(project.sources())
2501
+ },
2502
+ {
2503
+ code: "PD082",
2504
+ groups: ["supabase", "better-supabase"],
2505
+ when: (config) => config.supabase?.hook !== void 0,
2506
+ run: pd082
2507
+ },
2508
+ {
2509
+ code: "PD083",
2510
+ groups: ["supabase"],
2511
+ run: (project) => pd083(project.cwd, project.config, project.sources())
2512
+ },
2348
2513
  {
2349
2514
  code: "PD005",
2350
2515
  groups: ["skills"],