permdock 0.18.1 → 0.20.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 (313) hide show
  1. package/dist/a2a/index.d.ts +4 -4
  2. package/dist/a2a/index.js +6 -6
  3. package/dist/{adoption-scan-CxExBYSJ.js → adoption-scan-BWL5H82_.js} +1 -1
  4. package/dist/agent/index.d.ts +2 -2
  5. package/dist/agent/index.js +1 -1
  6. package/dist/ai-sdk/index.d.ts +3 -3
  7. package/dist/ai-sdk/index.js +4 -4
  8. package/dist/{approval-normalize-CUjgSsOl.js → approval-normalize-hlfO9BJv.js} +8 -1
  9. package/dist/{approval-policies-oNnckT12.d.ts → approval-policies-CKlByf5o.d.ts} +1 -1
  10. package/dist/{approval-prompt-Bg7gDSqd.d.ts → approval-prompt-CQFiO1KE.d.ts} +1 -1
  11. package/dist/approvals/index.d.ts +4 -4
  12. package/dist/approvals/index.js +3 -3
  13. package/dist/{approvals-DGId_hgJ.js → approvals-CuXILe52.js} +9 -6
  14. package/dist/{arazzo--riLuGY0.js → arazzo-B_CPVseu.js} +2 -2
  15. package/dist/{arazzo-CEDbb-uM.js → arazzo-C8u26FUA.js} +1 -1
  16. package/dist/astro/index.d.ts +4 -4
  17. package/dist/astro/index.js +2 -2
  18. package/dist/{audience-B4YR9UpV.js → audience-BUonniPx.js} +1 -1
  19. package/dist/authzen/index.d.ts +5 -5
  20. package/dist/authzen/index.js +3 -3
  21. package/dist/{automation-Bfa_wD1h.d.ts → automation-CpOk7Tlu.d.ts} +1 -1
  22. package/dist/better-auth/index.d.ts +1 -1
  23. package/dist/better-auth/index.js +1 -1
  24. package/dist/better-supabase/index.d.ts +20 -17
  25. package/dist/better-supabase/index.js +9 -9
  26. package/dist/{better-supabase-BJtQ-kNf.js → better-supabase-ayun1IKE.js} +38 -4
  27. package/dist/{bind-DR6ku3A9.d.ts → bind-CW7nsZ86.d.ts} +7 -7
  28. package/dist/{bind-B4pMH9bm.js → bind-gwEbe9hL.js} +4 -4
  29. package/dist/{body-CJQwYVa8.js → body-C9JbIoqb.js} +1 -1
  30. package/dist/{build-instance-BFMFQdE_.js → build-instance-DaBdCRiz.js} +1 -1
  31. package/dist/{capability-BZ_veK9o.d.ts → capability-v2xZB7us.d.ts} +1 -1
  32. package/dist/{casbin-DCQHkkyj.js → casbin-DaY-CWOr.js} +1 -1
  33. package/dist/{casbin-bKC1FpEx.js → casbin-JWZGKqzy.js} +1 -1
  34. package/dist/catalog/index.d.ts +5 -5
  35. package/dist/catalog/index.js +5 -5
  36. package/dist/catalog-BTPySmbp.js +1 -0
  37. package/dist/{catalog-zzNuR3sY.js → catalog-DjDc87R2.js} +1 -1
  38. package/dist/{catalog-doc-C4DGfJCO.js → catalog-doc-nrgfbh8I.js} +2 -1
  39. package/dist/{catalog-D1fw8qif.js → catalog-s0waIrfY.js} +2 -2
  40. package/dist/{challenge-B2O2OLEk.js → challenge-DbkpCx_v.js} +1 -1
  41. package/dist/chat/index.d.ts +1 -1
  42. package/dist/chat/index.js +2 -2
  43. package/dist/chat-sdk/index.d.ts +3 -3
  44. package/dist/claude-agent/index.d.ts +3 -3
  45. package/dist/claude-agent/index.js +2 -2
  46. package/dist/clerk/index.d.ts +2 -2
  47. package/dist/cli/bin.js +1 -1
  48. package/dist/cli/index.d.ts +5 -5
  49. package/dist/cli/index.js +3 -3
  50. package/dist/{client-CH7vzSAY.d.ts → client-JK504UCq.d.ts} +15 -2
  51. package/dist/cloud/index.d.ts +8 -8
  52. package/dist/cloud/index.js +2 -2
  53. package/dist/{cloud-C0vXBmLG.js → cloud-pEhjaPNs.js} +2 -2
  54. package/dist/{codemod-C-L0w-u7.js → codemod-BUhreN8m.js} +2 -2
  55. package/dist/{codemod-eYI1FbeJ.js → codemod-Cv0-7Ogj.js} +1 -1
  56. package/dist/{collect-CU85z6Ta.js → collect-DMQ6Sxr6.js} +2 -2
  57. package/dist/{collect-D878zLDP.js → collect-DN_x7hvV.js} +1 -1
  58. package/dist/collect-eSTXOZDC.js +1 -0
  59. package/dist/compile/index.d.ts +1 -1
  60. package/dist/{compile-DBm0ub4p.d.ts → compile-DZftFfXc.d.ts} +2 -2
  61. package/dist/{completion-Dauc6pVT.js → completion-BG1wcLJ3.js} +1 -1
  62. package/dist/{config-COHmivz9.js → config-D2oXUwos.js} +8 -5
  63. package/dist/{config-DWp2PucY.js → config-Di9kWoLY.js} +1 -1
  64. package/dist/{config-report-DKpFm5ID.js → config-report-B0IyW7EQ.js} +2 -2
  65. package/dist/{config-shape-tsxHx71E.js → config-shape-D9paLhEX.js} +5 -1
  66. package/dist/{connection-B72dg5Q2.js → connection-QFsv-kbh.js} +1 -1
  67. package/dist/{context-DeammvFl.js → context-YhyXyqBI.js} +3 -2
  68. package/dist/convex/index.d.ts +4 -4
  69. package/dist/convex/index.js +3 -3
  70. package/dist/{core-D87h2kpR.d.ts → core-BOeGWbcR.d.ts} +2 -2
  71. package/dist/{core-B8sLve3z.js → core-BwVkrpsi.js} +5 -5
  72. package/dist/{create-BrQXL-Wt.d.ts → create-BezeYFcT.d.ts} +6 -6
  73. package/dist/{create-C-tm3KIF.js → create-C0R8omeF.js} +4 -4
  74. package/dist/{create-3A7J9KRR.js → create-DDUFG1ul.js} +69 -29
  75. package/dist/{create-BzwjZuRS.d.ts → create-DMCC5ZOi.d.ts} +7 -7
  76. package/dist/{create-CtoT1lIQ.d.ts → create-DYSYYiLr.d.ts} +4 -4
  77. package/dist/decide-set-DXEPepY1.js +100 -0
  78. package/dist/{delegation-input-FTxMK3ji.js → delegation-input-DcXhiMkf.js} +1 -1
  79. package/dist/delivery/index.d.ts +4 -4
  80. package/dist/delivery/index.js +1 -1
  81. package/dist/{denied-text-DlIxt8fh.d.ts → denied-text-De8cw3MW.d.ts} +1 -1
  82. package/dist/{describe-BKtC_8PG.d.ts → describe-DibQM6g-.d.ts} +1 -1
  83. package/dist/{diff-BnNHqtHj.js → diff-Bd1-VCe5.js} +4 -4
  84. package/dist/{diff-CBCzOTWM.js → diff-DXRNcjpg.js} +1 -1
  85. package/dist/{doctor-xUpR5rXg.js → doctor-Bp3xspBi.js} +15 -5
  86. package/dist/{doctor-CkYKCuX7.js → doctor-DpD4nHMS.js} +295 -66
  87. package/dist/drizzle/index.d.ts +3 -3
  88. package/dist/elysia/index.d.ts +4 -4
  89. package/dist/elysia/index.js +4 -4
  90. package/dist/{errors-TpzkEKgJ.d.ts → errors-OTE9u4Wk.d.ts} +1 -1
  91. package/dist/{errors-B6R_lg2a.js → errors-ynga1EQy.js} +1 -1
  92. package/dist/{evaluate-Czbj7thS.js → evaluate-Dcq_U2TV.js} +2 -2
  93. package/dist/{evaluations-CisTTURl.d.ts → evaluations-BgxEfPL7.d.ts} +3 -3
  94. package/dist/{evaluations-h3KoJAPa.js → evaluations-CNMVJVD6.js} +3 -3
  95. package/dist/eve/index.d.ts +4 -4
  96. package/dist/eve/index.js +3 -3
  97. package/dist/express/index.d.ts +4 -4
  98. package/dist/express/index.js +3 -3
  99. package/dist/fastify/index.d.ts +4 -4
  100. package/dist/fastify/index.js +3 -3
  101. package/dist/{fetch-adapter-BdmfnbJM.d.ts → fetch-adapter-DCQ4pZxf.d.ts} +2 -2
  102. package/dist/{fetch-adapter-DH-NJPbL.js → fetch-adapter-acq4dPX3.js} +3 -3
  103. package/dist/{fields-CrjL6A49.js → fields-COvJbUva.js} +1 -1
  104. package/dist/{from-snapshot-DMlSSo9b.js → from-snapshot-DHnb8Fh4.js} +2 -2
  105. package/dist/{gen-BEIN-DRM.js → gen-B2O9T25-.js} +1 -1
  106. package/dist/{gen-mf-MRwVr.js → gen-CKr1Vfiz.js} +2 -2
  107. package/dist/h3/index.d.ts +4 -4
  108. package/dist/h3/index.js +3 -3
  109. package/dist/{helpers-DmqGy63f.js → helpers-D-MXwkOF.js} +28 -4
  110. package/dist/hono/index.d.ts +4 -4
  111. package/dist/hono/index.js +5 -5
  112. package/dist/{hosted-waouw2V-.js → hosted-C2Pmhy2x.js} +4 -3
  113. package/dist/{hosted-BFNXwcjd.d.ts → hosted-yhyAuQkL.d.ts} +1 -1
  114. package/dist/{import-DObwEota.js → import-DG6uswAo.js} +1 -1
  115. package/dist/{import-C1XXpG_m.js → import-DVI_1tO_.js} +46 -2
  116. package/dist/{index-BhnOOnp9.d.ts → index--AwSBzJC.d.ts} +2 -2
  117. package/dist/{index-rFp6X_QP.d.ts → index-B_I6N8Ju.d.ts} +5 -5
  118. package/dist/{index-CVGio3cH.d.ts → index-Bt37QovT.d.ts} +4 -4
  119. package/dist/{index-Dfv9Toct.d.ts → index-CLbGOPBr.d.ts} +1 -1
  120. package/dist/{index-CdMOd-GY.d.ts → index-CruReRkB.d.ts} +24 -6
  121. package/dist/{index-CdUTE6qd.d.ts → index-D7xGi1LS.d.ts} +24 -10
  122. package/dist/index.d.ts +17 -17
  123. package/dist/index.js +15 -15
  124. package/dist/{init-CNJ8lLjo.js → init-C-cgOvCl.js} +1 -1
  125. package/dist/{init-DS3PEsCG.js → init-DAPbdjcX.js} +3 -3
  126. package/dist/{instance-options-2sFGSdsf.d.ts → instance-options-VPsNQsTH.d.ts} +1 -1
  127. package/dist/{instance-snapshot-BWa71my8.js → instance-snapshot-SX8zH_1t.js} +3 -3
  128. package/dist/jwt/index.d.ts +4 -4
  129. package/dist/{kernel-30Z2zM_d.js → kernel-_QEUOSU0.js} +7 -7
  130. package/dist/kysely/index.d.ts +3 -3
  131. package/dist/{login-DUVzBLh7.js → login-CQGjpkuo.js} +3 -3
  132. package/dist/{login-BgK5Jloo.js → login-Cgix5FgG.js} +1 -1
  133. package/dist/{manifest-wclLWBVH.js → manifest-CMu1IE0R.js} +38 -37
  134. package/dist/{map-error-BH16Ah8P.js → map-error-EOhahOVA.js} +3 -3
  135. package/dist/mcp/index.d.ts +57 -17
  136. package/dist/mcp/index.js +199 -53
  137. package/dist/{module-values-B8tNIxdd.js → module-values-BYuNtdK5.js} +1 -1
  138. package/dist/nest/index.d.ts +4 -4
  139. package/dist/nest/index.js +5 -5
  140. package/dist/next/index.d.ts +12 -12
  141. package/dist/next/index.js +8 -8
  142. package/dist/next/plugin.d.ts +1 -1
  143. package/dist/next/plugin.js +1 -1
  144. package/dist/node/index.d.ts +4 -4
  145. package/dist/node/index.js +2 -2
  146. package/dist/openai/index.d.ts +4 -4
  147. package/dist/openai/index.js +3 -3
  148. package/dist/openapi/index.d.ts +2 -2
  149. package/dist/{openapi-zMEB9qxn.js → openapi-FVeCoh97.js} +2 -2
  150. package/dist/{openapi-C4gFqeRz.js → openapi-lsf1gEtr.js} +2 -2
  151. package/dist/orpc/index.d.ts +21 -17
  152. package/dist/orpc/index.js +18 -11
  153. package/dist/otel/index.d.ts +3 -3
  154. package/dist/{output-BFWLER4r.js → output-DZQCr2lP.js} +1 -1
  155. package/dist/{ownership-D-mIt-w0.js → ownership-CBuIjxKh.js} +2 -1
  156. package/dist/{parse-UTC-sDrt.js → parse-CXTT7hBq.js} +1 -1
  157. package/dist/{parse-local-manifest-DvjTQNuO.d.ts → parse-local-manifest-CE4tgFsj.d.ts} +1 -1
  158. package/dist/{parse-local-manifest-CxcSMQgl.js → parse-local-manifest-Ce2N-Opr.js} +1 -1
  159. package/dist/pdp/index.d.ts +3 -3
  160. package/dist/pdp/index.js +2 -2
  161. package/dist/{permdock-D-_WrdKu.js → permdock-C1DN_7a-.js} +6 -6
  162. package/dist/{permdock-ffY4CMd9.d.ts → permdock-D4F2p5J8.d.ts} +4 -4
  163. package/dist/{permissions-B3ggI88M.js → permissions-8N2yFsUM.js} +1 -1
  164. package/dist/{policy-cV_wwPb8.js → policy-CaAME-Rh.js} +2 -2
  165. package/dist/{policy-BtKSApSt.d.ts → policy-Dh9WVSVz.d.ts} +1 -1
  166. package/dist/{policy-from-catalog-B68hGC0S.js → policy-from-catalog-CUNlpgz0.js} +6 -6
  167. package/dist/{policy-types-D-GwfQTc.d.ts → policy-types-BI9C5Sp5.d.ts} +32 -2
  168. package/dist/{postgrest-D84p5dbA.d.ts → postgrest-CWCCbaxm.d.ts} +1 -1
  169. package/dist/powersync-BV68Jh-T.js +1 -0
  170. package/dist/{powersync-DStC_g0B.js → powersync-CRtuJXVB.js} +2 -2
  171. package/dist/{powersync-9PYOE1wt.js → powersync-Dz4H1FLs.js} +77 -38
  172. package/dist/prisma/index.d.ts +2 -2
  173. package/dist/{problem-BVLHFK33.js → problem-BWP1l86g.js} +8 -7
  174. package/dist/{protected-action-B40tU3yP.js → protected-action-CD1HXwQK.js} +2 -2
  175. package/dist/{protected-action-Ds_EUY8B.d.ts → protected-action-ua0cx5cW.d.ts} +5 -5
  176. package/dist/{provider-OtnIiFWm.d.ts → provider-D_hgjZRa.d.ts} +1 -1
  177. package/dist/{provider-CY4TSSJo.js → provider-qESIf_C0.js} +5 -2
  178. package/dist/{provider-store-BQP_pp8s.js → provider-store-BTHGJH9j.js} +3 -2
  179. package/dist/pull-AOmtUo8V.js +1 -0
  180. package/dist/{pull-DLP4I1Kl.js → pull-DnhBA9pf.js} +3 -3
  181. package/dist/{push-BSb8j1EW.js → push-D2SsRW0U.js} +3 -3
  182. package/dist/{pushed-policy-BecMsTtM.js → pushed-policy-BERO0x9O.js} +1 -1
  183. package/dist/{pushed-policy-Ck3FZcoy.d.ts → pushed-policy-P0hgyLBh.d.ts} +1 -1
  184. package/dist/react/index.d.ts +6 -6
  185. package/dist/react/index.js +3 -3
  186. package/dist/react/provider-client.d.ts +1 -1
  187. package/dist/react/provider-client.js +1 -1
  188. package/dist/react-native/index.d.ts +28 -14
  189. package/dist/react-native/index.js +57 -37
  190. package/dist/{replay-E5X9E1lC.d.ts → replay-DYXI4gRN.d.ts} +1 -1
  191. package/dist/{request-context-DM6_jY1n.js → request-context-BPTi68z5.js} +1 -1
  192. package/dist/resend/index.d.ts +4 -4
  193. package/dist/resend/index.js +2 -2
  194. package/dist/{resolve-names-CBl4r4_r.js → resolve-names-CDnxNqNb.js} +2 -2
  195. package/dist/{rls-pAHGYgTb.js → rls-CHZi5SUK.js} +1 -1
  196. package/dist/{rls-DGBL-jDY.js → rls-CbDKv6GP.js} +19 -13
  197. package/dist/{role-builder-CMW4wWzn.js → role-builder-C5AgaC1x.js} +18 -3
  198. package/dist/rpc-D2LnFELm.d.ts +22 -0
  199. package/dist/{rpc-KwX_Jcxz.js → rpc-DdkbQVlT.js} +16 -6
  200. package/dist/{run-B7lv3NuK.js → run-Bnm5VZ8m.js} +3 -3
  201. package/dist/run-D6U-Gwok.js +1 -0
  202. package/dist/{run-ticket-DPaD27_r.d.ts → run-ticket-94DOS9Cd.d.ts} +2 -2
  203. package/dist/{saas-B8H1MsQ3.js → saas-BEXnrH9H.js} +4 -4
  204. package/dist/{scan-0r3OZqqK.js → scan-VKkU4Ix9.js} +1 -1
  205. package/dist/{schema-B_9tXrbG.js → schema-5onstWlb.js} +1 -1
  206. package/dist/{schema-CuX70xgH.js → schema-BlnU_TzE.js} +4 -0
  207. package/dist/scim/index.d.ts +1 -1
  208. package/dist/server/index.d.ts +10 -10
  209. package/dist/server/index.js +5 -5
  210. package/dist/{server-types-3OnXjZ2D.d.ts → server-types-ChzXWU4Y.d.ts} +31 -13
  211. package/dist/{sink-ogbVkyeo.d.ts → sink-RwmP7ZHs.d.ts} +2 -2
  212. package/dist/{skills-C9sTD70r.js → skills-B6sLqv4E.js} +1 -1
  213. package/dist/{skills-B4MPRxQd.js → skills-Yz3LfoAZ.js} +1 -1
  214. package/dist/{snapshot-DN_8J27z.js → snapshot-DHPih65J.js} +2 -1
  215. package/dist/{snapshot-cache-B4YvlGG_.d.ts → snapshot-cache-MPinwwgZ.d.ts} +1 -1
  216. package/dist/solid/index.d.ts +5 -5
  217. package/dist/solid/index.js +3 -2
  218. package/dist/solid-start/index.d.ts +4 -4
  219. package/dist/solid-start/index.js +3 -3
  220. package/dist/{sources-xdQShLDU.d.ts → sources-sgQlMfmz.d.ts} +1 -1
  221. package/dist/{src-Brzq_0in.js → src-B8SQNsvw.js} +30 -13
  222. package/dist/ssf/index.d.ts +3 -3
  223. package/dist/ssf/index.js +2 -2
  224. package/dist/{standard-webhooks-BfPaZ6T1.d.ts → standard-webhooks-CFZIYtBF.d.ts} +2 -2
  225. package/dist/{store-DmVqy74I.js → store-CSOsXd5s.js} +8 -6
  226. package/dist/{store-DYeB-_U3.d.ts → store-Dpg_fSNQ.d.ts} +31 -4
  227. package/dist/{store-options--zWn48PK.js → store-options-CDvoX52-.js} +31 -8
  228. package/dist/{stores-EPul_8MN.d.ts → stores-C2A6KsxE.d.ts} +5 -5
  229. package/dist/{stores-BYFopOm1.js → stores-PpYVQ5yF.js} +1 -1
  230. package/dist/{stream-CDvF0sJm.js → stream-DQ3rbO3J.js} +1 -1
  231. package/dist/supabase/client.d.ts +1 -1
  232. package/dist/supabase/client.js +32 -4
  233. package/dist/supabase/index.d.ts +10 -5
  234. package/dist/supabase/index.js +1 -1
  235. package/dist/supabase/middleware.d.ts +5 -5
  236. package/dist/supabase/middleware.js +5 -5
  237. package/dist/{supabase-BiViJpQ4.js → supabase-CVZuytCC.js} +2 -2
  238. package/dist/{supabase-CogTyJH2.js → supabase-CWpADE8k.js} +2 -2
  239. package/dist/supabase-hook-Clczf4iF.js +1 -0
  240. package/dist/{supabase-hook-DX38Hj8h.js → supabase-hook-bDeWbKee.js} +151 -55
  241. package/dist/{supautils-BGf6zRvM.js → supautils-0RrdsFT3.js} +7 -7
  242. package/dist/svelte/index.d.ts +5 -5
  243. package/dist/svelte/index.js +3 -3
  244. package/dist/svelte/runtime.d.ts +3 -3
  245. package/dist/svelte/runtime.js +1 -1
  246. package/dist/svelte/source.d.ts +5 -5
  247. package/dist/svelte/source.js +2 -2
  248. package/dist/sveltekit/index.d.ts +4 -4
  249. package/dist/sveltekit/index.js +2 -2
  250. package/dist/{tables-BfOk0ymL.js → tables-C53U2zrN.js} +1 -1
  251. package/dist/tanstack-start/index.d.ts +4 -4
  252. package/dist/tanstack-start/index.js +2 -2
  253. package/dist/terminal/index.d.ts +5 -5
  254. package/dist/terminal/index.js +4 -4
  255. package/dist/testing/core.d.ts +1 -1
  256. package/dist/testing/core.js +1 -1
  257. package/dist/testing/fixtures/index.d.ts +1 -1
  258. package/dist/testing/fixtures/index.js +1 -1
  259. package/dist/testing/index.d.ts +23 -23
  260. package/dist/testing/index.js +22 -22
  261. package/dist/testing/saas/index.d.ts +3 -3
  262. package/dist/testing/saas/index.js +2 -2
  263. package/dist/testing/saas/permissions.js +1 -1
  264. package/dist/trpc/index.d.ts +15 -8
  265. package/dist/trpc/index.js +23 -19
  266. package/dist/{type-helpers-i1EJ3Eb1.d.ts → type-helpers-BjOLGVy1.d.ts} +1 -1
  267. package/dist/{types-D-JO7lh8.d.ts → types--_lpWUGV.d.ts} +5 -5
  268. package/dist/{types-NYoj8JBm.d.ts → types-7Vlz1Wi2.d.ts} +1 -0
  269. package/dist/{types-CqcsNCaN.d.ts → types-BzxA2OAD.d.ts} +13 -1
  270. package/dist/{types-D19MK4t-.d.ts → types-C5p2hoBR.d.ts} +3 -3
  271. package/dist/{types-B8qUkGja.d.ts → types-CMclYgSk.d.ts} +2 -2
  272. package/dist/{types-3Y8UpFkF.d.ts → types-D1NjjwI4.d.ts} +68 -4
  273. package/dist/{types-DGf_cpKF.d.ts → types-D8JVDWOr.d.ts} +2 -2
  274. package/dist/{types-Ck1KOfug.d.ts → types-DBVSljAx.d.ts} +2 -2
  275. package/dist/{types-CDVXR6YD.d.ts → types-DZwEOsK1.d.ts} +1 -1
  276. package/dist/{types-DmbfLu2p.d.ts → types-DnzRZjEu.d.ts} +9 -4
  277. package/dist/{types-o1vu6Ks3.d.ts → types-Drs3OOAy.d.ts} +4 -4
  278. package/dist/{types-CCEeSCMB.d.ts → types-p8mhWTcR.d.ts} +3 -3
  279. package/dist/unplugin/index.d.ts +1 -1
  280. package/dist/unplugin/index.js +1 -1
  281. package/dist/{usage-DC0UKe6C.js → usage-B6gmS634.js} +7 -5
  282. package/dist/{usage-DYtRVkcN.js → usage-BFMCEgJp.js} +1 -1
  283. package/dist/usage-Csu-M5jC.js +1 -0
  284. package/dist/{validation-error-Dx8PipbO.d.ts → validation-error-DkOK9zUE.d.ts} +1 -1
  285. package/dist/{verify-Bpj0hauG.js → verify-DFruUfZg.js} +79 -58
  286. package/dist/{version-cache-DzNKWiI6.d.ts → version-cache-q5cpaDSt.d.ts} +1 -1
  287. package/dist/vue/index.d.ts +5 -5
  288. package/dist/vue/index.js +2 -2
  289. package/dist/{waiter-NK_UuZbb.d.ts → waiter-BjVI_Byg.d.ts} +2 -2
  290. package/dist/watch-CS69ftMP.js +1 -0
  291. package/dist/{watch-CBHADqBH.js → watch-Dz2LNM1R.js} +2 -2
  292. package/dist/webmcp/index.d.ts +1 -1
  293. package/dist/{where-scope-BKrqUDVk.js → where-scope-BAyOsPQW.js} +1 -1
  294. package/dist/{who-can-KhVWMxtf.js → who-can-CZeAwQZD.js} +1 -1
  295. package/dist/workflow/index.d.ts +3 -3
  296. package/dist/workflow/index.js +2 -2
  297. package/dist/workflow-sdk/index.d.ts +4 -4
  298. package/dist/{wrap-BHGA-SMM.d.ts → wrap-CE5lxje7.d.ts} +2 -2
  299. package/package.json +1 -1
  300. package/schemas/catalog-v1.json +8 -0
  301. package/skills/permdock-agents/references/runtimes.md +2 -2
  302. package/skills/permdock-data/SKILL.md +1 -1
  303. package/skills/permdock-data/references/queries-and-rls.md +2 -0
  304. package/skills/permdock-wire/references/adapters.md +1 -1
  305. package/dist/catalog-Caqhbdix.js +0 -1
  306. package/dist/collect-KCtOigxx.js +0 -1
  307. package/dist/powersync-xNRlC4jN.js +0 -1
  308. package/dist/pull-UBjDnf4b.js +0 -1
  309. package/dist/run-UPbacxPg.js +0 -1
  310. package/dist/stream-W2RuUYly.d.ts +0 -13
  311. package/dist/supabase-hook-BN46IrVI.js +0 -1
  312. package/dist/usage-Cl5eb-e1.js +0 -1
  313. package/dist/watch-OYwAPCzx.js +0 -1
@@ -1,47 +1,49 @@
1
1
  import { r as isRecord } from "./compact-CAf557ZB.js";
2
- import { o as hasConditionOp } from "./refs-C8BKxc_e.js";
2
+ import { o as hasConditionOp, u as isSqlFunctionField } 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
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-cV_wwPb8.js";
9
- import { T as validateCustomRole } from "./evaluate-Czbj7thS.js";
8
+ import { u as separationConflicts } from "./policy-CaAME-Rh.js";
9
+ import { T as validateCustomRole } from "./evaluate-Dcq_U2TV.js";
10
10
  import { s as parseCredential } from "./credential-B3Hj4puZ.js";
11
- import { a as describeError } from "./errors-BhRkoNS7.js";
11
+ import { a as describeError, i as configError } 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-C4DGfJCO.js";
15
+ import { c as jsonSchemaOf, i as catalogOAuthScopes } from "./catalog-doc-nrgfbh8I.js";
16
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-D878zLDP.js";
18
+ import { r as runCollect } from "./collect-DN_x7hvV.js";
19
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";
20
+ import { a as workspaceDirs, c as readJson, i as betterSupabaseTenantClaim, n as betterSupabaseConfig, o as filesOf, r as betterSupabaseDefaults, s as nodeFiles, t as betterSupabaseAuthzVersions } from "./better-supabase-ayun1IKE.js";
21
21
  import { i as qualifySqlTable, s as quoteSqlLiteral } from "./sql-0WjxIp9g.js";
22
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-UTC-sDrt.js";
24
+ import { t as parseCatalog } from "./parse-CXTT7hBq.js";
25
25
  import { n as activeTenantMismatch } from "./active-tenant-DVee32-T.js";
26
26
  import "./markers-BeHZ4x9Q.js";
27
27
  import { t as didYouMean } from "./args-iafbHiXn.js";
28
- import { t as DOCS_BASE } from "./manifest-wclLWBVH.js";
28
+ import { t as DOCS_BASE } from "./manifest-CMu1IE0R.js";
29
29
  import { t as createStyle } from "./style-Ds11Hmk4.js";
30
- import { a as nonEmptyOr, r as findingOf } from "./output-BFWLER4r.js";
31
- import { i as runSkillsInstall } from "./skills-B4MPRxQd.js";
30
+ import { a as nonEmptyOr, r as findingOf } from "./output-DZQCr2lP.js";
31
+ import { i as runSkillsInstall } from "./skills-Yz3LfoAZ.js";
32
32
  import { n as MIGRATION_DIRS, t as DEFAULT_SENSITIVE_ACTIONS } from "./constants-DcJABbLW.js";
33
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-DX38Hj8h.js";
35
- import { G as byKey, Q as graphSqlName, n as tableNameOf, o as graphPlan, r as tableNames } from "./tables-BfOk0ymL.js";
36
- import { a as guardedTables, p as contextRefs, r as unsatisfiedKinds, t as ownershipRules } from "./ownership-D-mIt-w0.js";
34
+ import { n as pgConnector } from "./pg-Ddxsd5ZB.js";
35
+ 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-bDeWbKee.js";
36
+ import { O as quoteIdent, t as CUSTOM_ROLES } from "./shared-DyYVEjKC.js";
37
+ import { G as byKey, Q as graphSqlName, n as tableNameOf, o as graphPlan, r as tableNames } from "./tables-C53U2zrN.js";
38
+ import { a as guardedTables, p as contextRefs, r as unsatisfiedKinds, t as ownershipRules } from "./ownership-CBuIjxKh.js";
37
39
  import { t as membershipSourcesOf } from "./sources-qoIJQrJv.js";
38
40
  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-CrjL6A49.js";
40
- import { t as resolveNames } from "./resolve-names-CBl4r4_r.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-DC0UKe6C.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-Bpj0hauG.js";
43
- import { a as streamOf, i as scopeSourcesOf, r as staleFiles, t as powersyncFiles } from "./powersync-9PYOE1wt.js";
44
- import { a as buildContext, n as generateOptions, r as isRefusal, s as inheritTargets, t as supautilsRejections } from "./supautils-BGf6zRvM.js";
41
+ import { t as FIELD_VIEWS } from "./fields-COvJbUva.js";
42
+ import { t as resolveNames } from "./resolve-names-CDnxNqNb.js";
43
+ import { S as splitIgnored, d as rowConditionMessage, f as commandFor, m as tableFor, p as compileGrants, s as ROW_CONDITION_FIX, u as helperTablePolicies, x as parseIgnores } from "./verify-DFruUfZg.js";
44
+ 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-B6gmS634.js";
45
+ import { a as streamOf, i as scopeSourcesOf, r as staleFiles, t as powersyncFiles } from "./powersync-Dz4H1FLs.js";
46
+ import { a as buildContext, n as generateOptions, r as isRefusal, s as inheritTargets, t as supautilsRejections } from "./supautils-0RrdsFT3.js";
45
47
  import { n as legacyHelperNames, r as retirePlan, t as legacyHelperCalls } from "./retire-B2xffQgY.js";
46
48
  import { basename, dirname, join, resolve } from "node:path";
47
49
  import { pathToFileURL } from "node:url";
@@ -68,6 +70,7 @@ function loadProject(input) {
68
70
  files,
69
71
  now: input.now,
70
72
  io: input.io,
73
+ ...input.database === void 0 ? {} : { database: input.database },
71
74
  sources: () => {
72
75
  sources ??= listSourceFiles(cwd, doctorSrcPath(config)).map((file) => ({
73
76
  file: rel(cwd, file),
@@ -201,6 +204,52 @@ async function pd064(input) {
201
204
  }));
202
205
  }
203
206
  //#endregion
207
+ //#region src/cli/doctor/baseline.ts
208
+ const LOCATION = /^([^\s:]+\.[A-Za-z0-9]+):(\d+)\b/u;
209
+ /**
210
+ * The finding's target: the one its check set, else the `file:line` its message
211
+ * opens with, else the message's first word when it is a path or a key, else
212
+ * `project`.
213
+ */
214
+ function targetOf(finding) {
215
+ if (finding.target !== void 0) return finding.target;
216
+ const match = LOCATION.exec(finding.message);
217
+ if (match?.[0] !== void 0) return match[0];
218
+ const first = finding.message.split(/\s+/u)[0] ?? "";
219
+ return /[./]/u.test(first) ? first : "project";
220
+ }
221
+ function reported(finding) {
222
+ const target = targetOf(finding);
223
+ return {
224
+ ...finding,
225
+ target,
226
+ id: `${finding.code}:${target}`
227
+ };
228
+ }
229
+ /**
230
+ * Splits `findings` by `doctor.ignore` and `--ignore`. An entry that matches no
231
+ * finding comes back as an `ignore-stale` warning so the baseline can shrink.
232
+ */
233
+ function applyDoctorIgnores(findings, config, flags) {
234
+ const ignores = parseIgnores(config.doctor?.ignore, "doctor.ignore", flags);
235
+ const split = splitIgnored(findings, (item) => item.id, ignores);
236
+ const stale = split.stale.filter((entry) => entry.reason !== "--ignore").map((entry) => reported({
237
+ code: "ignore-stale",
238
+ severity: "warning",
239
+ target: entry.id,
240
+ message: `ignore entry ${entry.id} matches no finding`,
241
+ fix: "remove it from doctor.ignore"
242
+ }));
243
+ return {
244
+ findings: [...split.kept, ...stale],
245
+ ignored: split.ignored.map((entry) => ({
246
+ id: entry.id,
247
+ reason: entry.reason,
248
+ message: entry.item.message
249
+ }))
250
+ };
251
+ }
252
+ //#endregion
204
253
  //#region src/cli/doctor/better-supabase.ts
205
254
  function activeTenantOf(config) {
206
255
  const blocks = config["blocks"];
@@ -786,6 +835,77 @@ async function pd025(input) {
786
835
  return findings;
787
836
  }
788
837
  //#endregion
838
+ //#region src/cli/doctor/hook-role.ts
839
+ /** A user id no account has: the hook still reads every table it reads. */
840
+ const NOBODY = "00000000-0000-0000-0000-000000000000";
841
+ function eventsOf(project) {
842
+ const nobody = {
843
+ label: "a user with no rows",
844
+ event: {
845
+ user_id: NOBODY,
846
+ claims: {
847
+ sub: NOBODY,
848
+ role: "authenticated",
849
+ aud: "authenticated"
850
+ }
851
+ }
852
+ };
853
+ const fixture = project.config.doctor?.claims;
854
+ if (fixture === void 0) return [nobody];
855
+ let samples;
856
+ try {
857
+ samples = JSON.parse(project.files.read(resolve(project.cwd, fixture)));
858
+ } catch {
859
+ return [nobody];
860
+ }
861
+ if (!Array.isArray(samples)) return [nobody];
862
+ return [nobody, ...samples.flatMap((sample, index) => {
863
+ const sub = isRecord(sample) ? sample["sub"] : void 0;
864
+ return typeof sub === "string" && sub !== "" ? [{
865
+ label: `sample ${String(index)} in ${fixture}`,
866
+ event: {
867
+ user_id: sub,
868
+ claims: sample
869
+ }
870
+ }] : [];
871
+ })];
872
+ }
873
+ /**
874
+ * PD085: `custom_access_token_hook` fails when `supabase_auth_admin` calls it,
875
+ * as GoTrue does at every sign-in and refresh. Runs only with `--db-url-stdin`,
876
+ * inside a transaction it rolls back.
877
+ */
878
+ async function pd085(project) {
879
+ const { database } = project;
880
+ const hook = project.config.supabase?.hook;
881
+ if (database === void 0 || hook === void 0) return [];
882
+ const schema = hook.schema ?? project.config.rls?.schema ?? "permdock";
883
+ const fn = `${quoteIdent(schema)}.custom_access_token_hook`;
884
+ const client = await database.connect(database.url);
885
+ const findings = [];
886
+ try {
887
+ for (const { label, event } of eventsOf(project)) {
888
+ await client.query("begin", []);
889
+ try {
890
+ await client.query("set local role supabase_auth_admin", []);
891
+ await client.query(`select ${fn}($1::jsonb) as event`, [JSON.stringify(event)]);
892
+ } catch (error) {
893
+ findings.push({
894
+ code: "PD085",
895
+ severity: "error",
896
+ message: `${schema}.custom_access_token_hook fails as supabase_auth_admin for ${label} (${describeError(error)}), so that sign-in gets no token`,
897
+ fix: hook.security === "definer" ? "apply the hook migration as the owner of the tables it reads, and grant supabase_auth_admin usage on its schema and execute on the hook" : "apply the hook migration's grants and read policies, or set supabase.hook.security to 'definer' so the hook reads with its owner's rights"
898
+ });
899
+ } finally {
900
+ await client.query("rollback", []);
901
+ }
902
+ }
903
+ } finally {
904
+ await client.end();
905
+ }
906
+ return findings;
907
+ }
908
+ //#endregion
789
909
  //#region src/cli/doctor/next.ts
790
910
  const ROUTE_GLOBS = ["**/api/permdock/route.{ts,tsx,js,jsx,mjs}"];
791
911
  const ENDPOINT = /\bendpoint\s*(?::|=)\s*\{?\s*['"`]/u;
@@ -901,9 +1021,11 @@ function isPermDockSpecifier(value) {
901
1021
  /**
902
1022
  * The calls to `postgrestSources`, `memoryVersionCache` and `instanceCache`
903
1023
  * imported from PermDock that sit inside a function body, except the right side
904
- * of a `??=`, which builds the object once.
1024
+ * of a `??=` or `||=`, the assignment guarded by `if (!x)` on the same name,
1025
+ * and the arguments of a call to a cache helper named in `doctor.cacheHelpers`:
1026
+ * each builds the object once.
905
1027
  */
906
- function callsInFunctions(source) {
1028
+ function callsInFunctions(source, cacheHelpers) {
907
1029
  const { program } = parseSync(source.file, source.text);
908
1030
  const names = /* @__PURE__ */ new Map();
909
1031
  const namespaces = /* @__PURE__ */ new Set();
@@ -932,14 +1054,32 @@ function callsInFunctions(source) {
932
1054
  ArrowFunctionExpression: enter,
933
1055
  "ArrowFunctionExpression:exit": exit,
934
1056
  AssignmentExpression(node) {
935
- if (node.operator === "??=") lazy.push({
1057
+ if (node.operator === "??=" || node.operator === "||=") lazy.push({
936
1058
  start: node.right.start,
937
1059
  end: node.right.end
938
1060
  });
939
1061
  },
1062
+ IfStatement(node) {
1063
+ const { test } = node;
1064
+ if (test.type !== "UnaryExpression" || test.operator !== "!" || test.argument.type !== "Identifier") return;
1065
+ const guarded = test.argument.name;
1066
+ const body = node.consequent.type === "BlockStatement" ? node.consequent.body : [node.consequent];
1067
+ for (const statement of body) if (statement.type === "ExpressionStatement" && statement.expression.type === "AssignmentExpression" && statement.expression.operator === "=" && statement.expression.left.type === "Identifier" && statement.expression.left.name === guarded) {
1068
+ const { right } = statement.expression;
1069
+ lazy.push({
1070
+ start: right.start,
1071
+ end: right.end
1072
+ });
1073
+ }
1074
+ },
940
1075
  CallExpression(node) {
941
- if (depth === 0) return;
942
1076
  const { callee } = node;
1077
+ const helper = callee.type === "Identifier" ? callee.name : callee.type === "MemberExpression" && callee.property.type === "Identifier" ? callee.property.name : void 0;
1078
+ if (helper !== void 0 && cacheHelpers.has(helper)) for (const argument of node.arguments) lazy.push({
1079
+ start: argument.start,
1080
+ end: argument.end
1081
+ });
1082
+ if (depth === 0) return;
943
1083
  let factory;
944
1084
  if (callee.type === "Identifier") factory = names.get(callee.name);
945
1085
  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;
@@ -951,17 +1091,18 @@ function callsInFunctions(source) {
951
1091
  }).visit(program);
952
1092
  return found.filter(({ call }) => !lazy.some((range) => call.start >= range.start && call.end <= range.end));
953
1093
  }
954
- function findings(sources, code) {
1094
+ function findings(sources, code, cacheHelpers) {
955
1095
  const out = [];
956
1096
  for (const source of sources) {
957
1097
  if (!source.text.includes("permdock")) continue;
958
- for (const { call, factory } of callsInFunctions(source)) {
1098
+ for (const { call, factory } of callsInFunctions(source, cacheHelpers)) {
959
1099
  if (SHARED_FACTORIES[factory] !== code) continue;
960
1100
  const line = source.text.slice(0, call.start).split("\n").length;
961
1101
  const { what, fix } = FACTORY_MESSAGES[factory] ?? MESSAGES[code];
962
1102
  out.push({
963
1103
  code,
964
1104
  severity: "warning",
1105
+ target: `${source.file}:${String(line)}`,
965
1106
  message: `${source.file}:${String(line)} creates ${factory}() inside a function, ${what}`,
966
1107
  fix
967
1108
  });
@@ -973,21 +1114,36 @@ function findings(sources, code) {
973
1114
  * PD080: `postgrestSources`, `memoryVersionCache` or `claimsFirst` created per
974
1115
  * call.
975
1116
  */
976
- function pd080(sources) {
977
- return findings(sources, "PD080");
1117
+ function pd080(sources, cacheHelpers = []) {
1118
+ return findings(sources, "PD080", new Set(cacheHelpers));
978
1119
  }
979
1120
  /** PD081: `instanceCache` created per call. */
980
- function pd081(sources) {
981
- return findings(sources, "PD081");
1121
+ function pd081(sources, cacheHelpers = []) {
1122
+ return findings(sources, "PD081", new Set(cacheHelpers));
982
1123
  }
983
1124
  //#endregion
984
1125
  //#region src/cli/doctor/policy.ts
1126
+ /** `doctor.waivers`, checked; PD017 is the only code a waiver names. */
1127
+ function waiversOf(input) {
1128
+ const entries = input.config.doctor?.waivers ?? [];
1129
+ if (!Array.isArray(entries)) throw configError("PermDock CLI: doctor.waivers must be a list of { code, key, reason }");
1130
+ return entries.map((entry, index) => {
1131
+ if (!isRecord(entry) || entry["code"] !== "PD017" || typeof entry["key"] !== "string" || entry["key"] === "" || typeof entry["reason"] !== "string" || entry["reason"].trim() === "") throw configError(`PermDock CLI: doctor.waivers[${String(index)}] needs code "PD017", a permission key and a non-empty reason`);
1132
+ return {
1133
+ key: entry["key"],
1134
+ reason: entry["reason"]
1135
+ };
1136
+ });
1137
+ }
985
1138
  async function pd017(input) {
986
1139
  if (input.config.policy === void 0) return [];
987
1140
  const policy = await policyOf(input);
988
1141
  if (policy === void 0) return [];
989
1142
  const sensitive = new Set(input.config.doctor?.sensitiveActions ?? DEFAULT_SENSITIVE_ACTIONS);
990
1143
  const denied = new Set(policy.grants.filter((grant) => grant.effect === "deny").map((grant) => grant.permission.key));
1144
+ const waivers = waiversOf(input);
1145
+ const waived = new Set(waivers.map((waiver) => waiver.key));
1146
+ const matched = /* @__PURE__ */ new Set();
991
1147
  const findings = [];
992
1148
  const seen = /* @__PURE__ */ new Set();
993
1149
  for (const grant of policy.grants) {
@@ -997,13 +1153,25 @@ async function pd017(input) {
997
1153
  if (denied.has(grant.permission.key)) continue;
998
1154
  if (seen.has(grant.permission.key)) continue;
999
1155
  seen.add(grant.permission.key);
1156
+ if (waived.has(grant.permission.key)) {
1157
+ matched.add(grant.permission.key);
1158
+ continue;
1159
+ }
1000
1160
  findings.push({
1001
1161
  code: "PD017",
1002
1162
  severity: "warning",
1163
+ target: grant.permission.key,
1003
1164
  message: `${grant.permission.key} is a sensitive verb without approval`,
1004
- fix: "add approval: { by } on the allow, or a deny on the same leaf"
1165
+ fix: "add approval: { by } on the allow, or a deny on the same leaf, or waive it in doctor.waivers with a reason"
1005
1166
  });
1006
1167
  }
1168
+ for (const waiver of waivers) if (!matched.has(waiver.key)) findings.push({
1169
+ code: "PD017",
1170
+ severity: "warning",
1171
+ target: `waiver:${waiver.key}`,
1172
+ message: `doctor.waivers entry for ${waiver.key} matches no sensitive allow without approval`,
1173
+ fix: "remove the entry from doctor.waivers"
1174
+ });
1007
1175
  return findings;
1008
1176
  }
1009
1177
  async function pd024(input) {
@@ -1017,6 +1185,7 @@ async function pd024(input) {
1017
1185
  findings.push({
1018
1186
  code: "PD024",
1019
1187
  severity: "warning",
1188
+ target: `${grant.permission.key}${grant.role === null ? "" : `@${grant.role}`}`,
1020
1189
  message: `${grant.permission.key}${grant.role === null ? "" : ` (role ${grant.role})`} sets approval.mode: 'confirm', so the requester can approve their own request`,
1021
1190
  fix: "remove mode: 'confirm' unless the requester confirming their own call (an agent asking its user) is the intent"
1022
1191
  });
@@ -1242,33 +1411,6 @@ async function pd084(input) {
1242
1411
  //#endregion
1243
1412
  //#region src/cli/doctor/project.ts
1244
1413
  /**
1245
- * The directories from `cwd` up to the workspace root: the first one with a
1246
- * `pnpm-workspace.yaml`, a `package.json` that declares `workspaces`, or a
1247
- * `.git`. Skills are often installed once at a monorepo's root.
1248
- */
1249
- function workspaceDirs(files, cwd) {
1250
- const dirs = [];
1251
- let dir = resolve(cwd);
1252
- for (;;) {
1253
- dirs.push(dir);
1254
- if (isWorkspaceRoot(files, dir)) return dirs;
1255
- const parent = dirname(dir);
1256
- if (parent === dir) return [resolve(cwd)];
1257
- dir = parent;
1258
- }
1259
- }
1260
- function isWorkspaceRoot(files, dir) {
1261
- if (files.exists(join(dir, "pnpm-workspace.yaml")) || files.exists(join(dir, ".git"))) return true;
1262
- const manifest = join(dir, "package.json");
1263
- if (!files.exists(manifest)) return false;
1264
- try {
1265
- const parsed = readJson(files, manifest);
1266
- return parsed !== null && typeof parsed === "object" && Object.hasOwn(parsed, "workspaces");
1267
- } catch {
1268
- return false;
1269
- }
1270
- }
1271
- /**
1272
1414
  * Whether `dir` holds a skills lock: PermDock's own, or the `skills` CLI's
1273
1415
  * naming the `permdock` skill.
1274
1416
  */
@@ -1817,6 +1959,21 @@ async function pd071(input) {
1817
1959
  fix: `map it on purpose in rls.actions: ${verb}: "insert", "update", "delete" or "none"`
1818
1960
  }));
1819
1961
  }
1962
+ const NAME_GUARD_TRIGGER = new RegExp(String.raw`create\s+(?:or\s+replace\s+)?(?:constraint\s+)?trigger\s+"?${CUSTOM_ROLES.nameGuard}"?`, "iu");
1963
+ /**
1964
+ * Whether a declarative schema file, migration or generated SQL file creates
1965
+ * the `permdock_custom_role_name_guard` trigger.
1966
+ */
1967
+ function hasNameGuard(input) {
1968
+ const files = filesOf(input);
1969
+ const out = input.config.rls?.out;
1970
+ const entries = [
1971
+ "supabase/schemas",
1972
+ ...input.config.doctor?.migrations ?? MIGRATION_DIRS,
1973
+ ...out === void 0 ? [] : [out]
1974
+ ];
1975
+ return sqlFiles(input.cwd, entries).some((file) => NAME_GUARD_TRIGGER.test(files.read(file)));
1976
+ }
1820
1977
  /**
1821
1978
  * PD072: a membership source reads role keys through the table of custom roles
1822
1979
  * (`rls.customRoleWrites.roles`), which tenants write.
@@ -1825,11 +1982,14 @@ function pd072(input) {
1825
1982
  const roles = input.config.rls?.customRoleWrites?.roles;
1826
1983
  if (roles?.tenant === void 0) return [];
1827
1984
  const target = qualifySqlTable(roles.table);
1828
- return membershipSourcesOf(input.config).filter((source) => source.sql.throughs.some((through) => through.table === target)).map((source) => ({
1985
+ const sources = membershipSourcesOf(input.config).filter((source) => source.sql.throughs.some((through) => through.table === target));
1986
+ if (sources.length === 0 || hasNameGuard(input)) return [];
1987
+ return sources.map((source) => ({
1829
1988
  code: "PD072",
1989
+ target: `${target}:${source.sql.table}`,
1830
1990
  severity: "warning",
1831
1991
  message: `the ${source.sql.table} membership source reads role keys through ${target}, whose tenant rows tenants write: a tenant row named like a declared role must not grant it`,
1832
- fix: `keep the permdock_custom_role_name_guard trigger on ${target} (rls generate emits it with customRoleWrites.roles) and generate with this config, so helpers read a tenant row named like a declared role as no role`
1992
+ fix: `keep the permdock_custom_role_name_guard trigger on ${target} (rls generate emits it with customRoleWrites.roles) and generate with this config, so helpers read a tenant row named like a declared role as no role; doctor reads supabase/schemas, the migrations and rls.out for it`
1833
1993
  }));
1834
1994
  }
1835
1995
  /** PD073: a role's `for` lists kinds no membership source of its scope can hold. */
@@ -1858,6 +2018,53 @@ async function pd073(input) {
1858
2018
  }));
1859
2019
  }
1860
2020
  /**
2021
+ * Every `sqlFunction` set variant in `condition`, through `and`, `or` and
2022
+ * `not`.
2023
+ */
2024
+ function sqlFunctionSets(condition) {
2025
+ if (condition === void 0) return [];
2026
+ if (condition.op === "sqlFunction") return [...condition.set === void 0 ? [] : [condition], ...sqlFunctionSets(condition.twin)];
2027
+ if (condition.op === "and" || condition.op === "or") return condition.conditions.flatMap(sqlFunctionSets);
2028
+ if (condition.op === "not") return sqlFunctionSets(condition.condition);
2029
+ return [];
2030
+ }
2031
+ /**
2032
+ * PD086: a `sqlFunction` set variant names a column the resource does not
2033
+ * declare, or passes row-field args the set form drops because the function is
2034
+ * called once per statement.
2035
+ */
2036
+ async function pd086(input) {
2037
+ if (input.config.rls === void 0 || input.config.policy === void 0) return [];
2038
+ const policy = await policyOf(input);
2039
+ if (policy === void 0) return [];
2040
+ const findings = [];
2041
+ for (const grant of policy.grants) {
2042
+ const node = policy.resources.get(grant.permission.resource);
2043
+ const schema = node === void 0 ? null : jsonSchemaOf(node);
2044
+ const properties = schema !== null && typeof schema === "object" ? schema.properties : void 0;
2045
+ const columns = properties !== null && typeof properties === "object" ? new Set(Object.keys(properties)) : void 0;
2046
+ for (const [kind, condition] of [["where", grant.where], ["check", grant.check]]) for (const fn of sqlFunctionSets(condition)) {
2047
+ const column = fn.set?.column;
2048
+ if (column !== void 0 && columns !== void 0 && !columns.has(column)) findings.push({
2049
+ code: "PD086",
2050
+ target: `${grant.permission.key}:${kind}`,
2051
+ severity: "error",
2052
+ message: `sqlFunction ${fn.name} set compares ${grant.permission.resource}.${column}, which the resource does not declare`,
2053
+ fix: `set column to one of ${[...columns].toSorted().join(", ")} or add ${column} to the resource schema`
2054
+ });
2055
+ const dropped = fn.args.filter(isSqlFunctionField);
2056
+ if (dropped.length > 0) findings.push({
2057
+ code: "PD086",
2058
+ target: `${grant.permission.key}:${kind}`,
2059
+ severity: "warning",
2060
+ message: `sqlFunction ${fn.name} set passes row fields (${dropped.map((arg) => arg.field).join(", ")}), which the set form drops: the function is called once per statement`,
2061
+ fix: "pass only the function's own arguments, or drop set to call it per row"
2062
+ });
2063
+ }
2064
+ }
2065
+ return findings;
2066
+ }
2067
+ /**
1861
2068
  * PD075: two resources that `rls.tables` maps to one table, each with its own
1862
2069
  * keys and helpers for the same rows. `doctor.sharedTables` lists tables split
1863
2070
  * on purpose (two resources over disjoint rows).
@@ -2525,12 +2732,12 @@ const DOCTOR_CHECKS = [
2525
2732
  {
2526
2733
  code: "PD080",
2527
2734
  groups: ["caching"],
2528
- run: (project) => pd080(project.sources())
2735
+ run: (project) => pd080(project.sources(), project.config.doctor?.cacheHelpers)
2529
2736
  },
2530
2737
  {
2531
2738
  code: "PD081",
2532
2739
  groups: ["caching"],
2533
- run: (project) => pd081(project.sources())
2740
+ run: (project) => pd081(project.sources(), project.config.doctor?.cacheHelpers)
2534
2741
  },
2535
2742
  {
2536
2743
  code: "PD082",
@@ -2837,6 +3044,12 @@ const DOCTOR_CHECKS = [
2837
3044
  when: (config) => config.rls?.migrate?.tables !== void 0,
2838
3045
  run: (project) => pd066(project.cwd, project.config, project.files)
2839
3046
  },
3047
+ {
3048
+ code: "PD085",
3049
+ groups: ["supabase", "hook"],
3050
+ when: (config) => config.supabase?.hook !== void 0,
3051
+ run: pd085
3052
+ },
2840
3053
  {
2841
3054
  code: "PD058",
2842
3055
  groups: ["powersync"],
@@ -2847,6 +3060,11 @@ const DOCTOR_CHECKS = [
2847
3060
  groups: ["powersync", "react-native"],
2848
3061
  run: pd084
2849
3062
  },
3063
+ {
3064
+ code: "PD086",
3065
+ groups: ["rls"],
3066
+ run: pd086
3067
+ },
2850
3068
  {
2851
3069
  code: "PD061",
2852
3070
  groups: ["rls", "suspension"],
@@ -2894,19 +3112,27 @@ async function runDoctor(input) {
2894
3112
  });
2895
3113
  fixed.push(`catalog: ${collected.message.trim()}`);
2896
3114
  }
2897
- const project = loadProject(input);
3115
+ const project = loadProject({
3116
+ ...input,
3117
+ ...input.db === void 0 ? {} : { database: {
3118
+ url: input.db,
3119
+ connect: input.connect ?? pgConnector("permdock doctor", input.cwd)
3120
+ } }
3121
+ });
2898
3122
  const selected = (check) => wanted.size === 0 || wanted.has(check.code.toLowerCase()) || check.groups.some((group) => wanted.has(group));
2899
- const findings = [];
3123
+ const collected = [];
2900
3124
  for (const check of DOCTOR_CHECKS) {
2901
3125
  if (check.when !== void 0 && !check.when(input.config)) continue;
2902
- if (selected(check)) findings.push(...await check.run(project));
3126
+ if (selected(check)) collected.push(...await check.run(project));
2903
3127
  }
3128
+ const { findings, ignored } = applyDoctorIgnores(collected.map(reported), input.config, input.ignore ?? []);
2904
3129
  const errors = findings.filter((item) => item.severity === "error").length;
2905
3130
  const warnings = findings.filter((item) => item.severity === "warning").length;
2906
3131
  const report = {
2907
3132
  $schema: DOCTOR_REPORT_SCHEMA,
2908
3133
  fixed,
2909
3134
  findings,
3135
+ ignored,
2910
3136
  errors,
2911
3137
  warnings
2912
3138
  };
@@ -2929,6 +3155,7 @@ async function pd059(project) {
2929
3155
  return [{
2930
3156
  code: "PD059",
2931
3157
  severity: "error",
3158
+ target: load.path,
2932
3159
  message: `policy module ${load.path} did not load (${load.message}), so doctor skipped every check that reads the policy`,
2933
3160
  fix: "fix the module so it exports policy from definePolicy, or point policy in permdock.config.ts at the module that does"
2934
3161
  }];
@@ -2941,6 +3168,7 @@ async function pd060(project) {
2941
3168
  return ((await project.collected()).scan?.unparsed ?? []).map((item) => ({
2942
3169
  code: "PD060",
2943
3170
  severity: "warning",
3171
+ target: `${item.file}:${String(item.line)}`,
2944
3172
  message: `${item.file}:${String(item.line)} does not parse (${item.message}), so the catalog and usage report miss the permissions it references`,
2945
3173
  fix: "fix the syntax error, or exclude the file from collect.srcPath"
2946
3174
  }));
@@ -2968,8 +3196,9 @@ function formatDoctor(report, color) {
2968
3196
  for (const finding of report.findings) {
2969
3197
  const mark = markOf(finding.severity, style);
2970
3198
  lines.push(` ${mark} ${style.paint("bold", finding.code)} ${finding.message}`);
2971
- lines.push(` ${style.paint("dim", `fix: ${finding.fix}`)}`);
3199
+ lines.push(` ${style.paint("dim", `fix: ${finding.fix} [${finding.id}]`)}`);
2972
3200
  }
3201
+ for (const item of report.ignored) lines.push(` ${style.paint("dim", `ignored ${item.id}: ${item.reason}`)}`);
2973
3202
  if (report.findings.length === 0) lines.push(" no findings");
2974
3203
  lines.push("");
2975
3204
  const notes = report.findings.filter((finding) => finding.severity === "info").length;
@@ -1,7 +1,7 @@
1
- import { Kt as Instant, wr as Condition, yr as Subject } from "../policy-types-D-GwfQTc.js";
2
- import { f as WhereResult } from "../permdock-ffY4CMd9.js";
1
+ import { Er as Condition, qt as Instant, xr as Subject } from "../policy-types-BI9C5Sp5.js";
2
+ import { f as WhereResult } from "../permdock-D4F2p5J8.js";
3
3
  import { r as RelationsMapping } from "../graph-sql-BwFC4Qjs.js";
4
- import { s as MembershipsMapping } from "../compile-DBm0ub4p.js";
4
+ import { s as MembershipsMapping } from "../compile-DZftFfXc.js";
5
5
  import { n as RowCheck, t as WithSubjectOptions } from "../subject-settings-vNW8qmUH.js";
6
6
  import { SQL, Table } from "drizzle-orm";
7
7
  //#region src/drizzle/types.d.ts
@@ -1,9 +1,9 @@
1
- import { E as Policy, M as PolicyVocabulary, _r as Principal } from "../policy-types-D-GwfQTc.js";
1
+ import { D as Policy, N as PolicyVocabulary, yr as Principal } from "../policy-types-BI9C5Sp5.js";
2
2
  import { u as Permission } from "../permission-types-CAY-GU7e.js";
3
- import { a as PermDock } from "../permdock-ffY4CMd9.js";
3
+ import { a as PermDock } from "../permdock-D4F2p5J8.js";
4
4
  import { n as RevocationFeed } from "../revocations-BaUXHM1N.js";
5
- import { D as ConnectionOptions, T as Connection, f as InvalidSignatureError, i as OpenApiHooks, o as ProtectOptions, v as discoverViaSignatureAgent, x as webBotAuthVerifier } from "../server-types-3OnXjZ2D.js";
6
- import { t as ServerAdapterOptions } from "../bind-DR6ku3A9.js";
5
+ import { D as ConnectionOptions, T as Connection, f as InvalidSignatureError, i as OpenApiHooks, o as ProtectOptions, v as discoverViaSignatureAgent, x as webBotAuthVerifier } from "../server-types-ChzXWU4Y.js";
6
+ import { t as ServerAdapterOptions } from "../bind-CW7nsZ86.js";
7
7
  import { Elysia } from "elysia";
8
8
  //#region src/elysia/create.d.ts
9
9
  type ElysiaRequestContext = {
@@ -1,8 +1,8 @@
1
1
  import { a as parsedBody, r as hasCredentials } from "../http-DKLXrFGk.js";
2
- import { l as InvalidSignatureError, p as webBotAuthVerifier, u as discoverViaSignatureAgent } from "../evaluations-h3KoJAPa.js";
3
- import { t as problemFromError } from "../map-error-BH16Ah8P.js";
4
- import { a as socketConnection, i as decorate, r as bindKernel } from "../bind-B4pMH9bm.js";
5
- import { a as onRevoked, n as closeReason, t as POLICY_VIOLATION } from "../stream-CDvF0sJm.js";
2
+ import { l as InvalidSignatureError, p as webBotAuthVerifier, u as discoverViaSignatureAgent } from "../evaluations-CNMVJVD6.js";
3
+ import { t as problemFromError } from "../map-error-EOhahOVA.js";
4
+ import { a as socketConnection, i as decorate, r as bindKernel } from "../bind-gwEbe9hL.js";
5
+ import { a as onRevoked, n as closeReason, t as POLICY_VIOLATION } from "../stream-DQ3rbO3J.js";
6
6
  import { Elysia } from "elysia";
7
7
  //#region src/elysia/create.ts
8
8
  function createPermDock(policy, options) {
@@ -1,4 +1,4 @@
1
- import { _n as WireDenial, qn as Decision, yr as Subject } from "./policy-types-D-GwfQTc.js";
1
+ import { Yn as Decision, xr as Subject, yn as WireDenial } from "./policy-types-BI9C5Sp5.js";
2
2
  import { StandardSchemaV1 } from "@standard-schema/spec";
3
3
  //#region src/core/problem-details.d.ts
4
4
  type Disclosure = "hide" | "reveal";
@@ -34,7 +34,7 @@ var PermDockDeniedError = class extends Error {
34
34
  toProblemDetails(options) {
35
35
  return problemDetails(compact({
36
36
  decision: this.decision,
37
- detail: this.message,
37
+ detail: deniedMessage(this.permission, void 0, this.decision.denials, this.decision.alternatives.map((leaf) => leaf.key), false),
38
38
  instance: options?.instance,
39
39
  permission: this.permission,
40
40
  scope: this.scope,
@@ -1,7 +1,7 @@
1
1
  import { a as sole, n as isReadonlyArray, t as compact } from "./compact-CAf557ZB.js";
2
2
  import { n as freezeDeep } from "./freeze-jjan0lCv.js";
3
3
  import { n as isForbiddenKey } from "./paths-CUvURzHp.js";
4
- import { n as role, t as normalizeAssurance } from "./role-builder-CMW4wWzn.js";
4
+ import { n as role, t as normalizeAssurance } from "./role-builder-C5AgaC1x.js";
5
5
  import { n as PermDockValidationError } from "./validation-error-CYg2kJEw.js";
6
6
  import { t as wireDenials } from "./wire-denial-C7PaVYEM.js";
7
7
  import { o as sameId } from "./expiry-6XByK0dm.js";
@@ -17,7 +17,7 @@ import { a as authenticated, g as isRole, i as assurance, m as findRole, o as fl
17
17
  import { a as grantCoversField, i as wireValidity, t as isActive } from "./validity-Buc7w8E9.js";
18
18
  import { o as resourceRoleCondition } from "./grantee-conditions-DX4K_gGI.js";
19
19
  import { c as nowSeconds, i as matchScopedMembership, l as partitionsOf, n as inTeam, p as scopeField, r as isMembershipExpired } from "./tenancy-DvOHHk3-.js";
20
- import { i as grantList, n as declaredRoleNames, s as levelCondition } from "./policy-cV_wwPb8.js";
20
+ import { i as grantList, n as declaredRoleNames, s as levelCondition } from "./policy-CaAME-Rh.js";
21
21
  import { t as requiresApproval } from "./approval-required-TzNB9oQA.js";
22
22
  import { i as rootMembershipId } from "./subject-C7RddW0G.js";
23
23
  import { a as versionOf, i as tokenPayload, n as decisionToken } from "./token-DaMnIU9O.js";