permdock 0.1.0 → 0.2.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 (349) hide show
  1. package/README.md +106 -47
  2. package/dist/a2a/index.d.ts +7 -16
  3. package/dist/a2a/index.js +59 -98
  4. package/dist/adapter-context-mlWsVGGg.js +23 -0
  5. package/dist/ai-sdk/index.d.ts +37 -16
  6. package/dist/ai-sdk/index.js +30 -13
  7. package/dist/approvals/index.d.ts +3 -3
  8. package/dist/approvals/index.js +5 -4
  9. package/dist/{approvals-DaxY-Bdg.js → approvals-DbYAuNkG.js} +17 -11
  10. package/dist/approvers-DT4AVyIg.js +52 -0
  11. package/dist/{arazzo-CTeVuXr5.js → arazzo-BAgw9ap6.js} +2 -2
  12. package/dist/{arazzo-aoTkqYsJ.js → arazzo-cmvX2jDe.js} +2 -2
  13. package/dist/authzen/index.d.ts +4 -13
  14. package/dist/authzen/index.js +16 -50
  15. package/dist/better-auth/index.d.ts +20 -3
  16. package/dist/better-auth/index.js +27 -7
  17. package/dist/better-supabase/index.d.ts +206 -0
  18. package/dist/better-supabase/index.js +620 -0
  19. package/dist/bind-CVy3Espv.d.ts +25 -0
  20. package/dist/bind-VnYn2HKq.js +97 -0
  21. package/dist/boundary-BM8a_P6E.js +13 -0
  22. package/dist/boundary-BmHxVH1J.d.ts +15 -0
  23. package/dist/canonical-json-DemiK4Vp.js +26 -0
  24. package/dist/{capability-B68OFnZx.js → capability-4qPdO9gk.js} +7 -5
  25. package/dist/{capability-BDG_nkxt.d.ts → capability-Dq43tT1u.d.ts} +2 -2
  26. package/dist/catalog/index.d.ts +1 -1
  27. package/dist/catalog/index.js +1 -1
  28. package/dist/catalog-BjZSovXQ.js +2 -0
  29. package/dist/{catalog-doc-BSo_Q_-6.js → catalog-doc-Dsc9y7sd.js} +23 -12
  30. package/dist/{catalog-B0E6bggc.js → catalog-h2tlKFkq.js} +2 -2
  31. package/dist/{catalog-H-vFGwWK.js → catalog-z8q6bi_r.js} +4 -4
  32. package/dist/claude-agent/index.d.ts +5 -14
  33. package/dist/claude-agent/index.js +4 -10
  34. package/dist/clerk/index.d.ts +12 -3
  35. package/dist/clerk/index.js +26 -5
  36. package/dist/cli/bin.js +1 -1
  37. package/dist/cli/index.d.ts +3 -3
  38. package/dist/cli/index.js +2 -2
  39. package/dist/clients-C7zLFuWT.d.ts +12 -0
  40. package/dist/clients-DjU5ABMy.js +23 -0
  41. package/dist/cloud/index.d.ts +4 -5
  42. package/dist/cloud/index.js +20 -6
  43. package/dist/{cloud-BNQTrmrr.js → cloud-BGhHS-lY.js} +2 -2
  44. package/dist/{cloud-Cuxr6Czw.js → cloud-Bo3e9Ak3.js} +7 -6
  45. package/dist/{collect-O-tOtbnk.js → collect-DDDv_ESs.js} +194 -42
  46. package/dist/collect-DLlujdHC.js +83 -0
  47. package/dist/collect-rG2IQ3t0.js +2 -0
  48. package/dist/{commands-BMh_Etm2.js → commands-DWOrSQic.js} +16 -12
  49. package/dist/compile/index.d.ts +3 -0
  50. package/dist/compile/index.js +2 -0
  51. package/dist/{compile-D22iwvuV.js → compile-Ba4blROR.js} +85 -30
  52. package/dist/compile-CNnl6uIt.d.ts +94 -0
  53. package/dist/config-BJiM-xAm.js +157 -0
  54. package/dist/config-Bn00Z3ks.js +36 -0
  55. package/dist/config-report-Dw_JcUqT.js +44 -0
  56. package/dist/{connection-JvqwHODC.js → connection-CU8MQxRi.js} +1 -1
  57. package/dist/{context-CKEAabd7.js → context-Ttp0ekMT.js} +36 -27
  58. package/dist/convex/index.d.ts +9 -4
  59. package/dist/convex/index.js +14 -4
  60. package/dist/create-BWyx3jua.d.ts +245 -0
  61. package/dist/create-CPhDL6qx.js +253 -0
  62. package/dist/{credential-B_rkUNlY.js → credential-8P81ff4u.js} +26 -46
  63. package/dist/delegation-D8pUEuce.js +103 -0
  64. package/dist/{describe-Bt1YD5uS.js → describe-B_gVZEVi.js} +10 -15
  65. package/dist/{describe-DernyItf.d.ts → describe-PdoqESvg.d.ts} +9 -10
  66. package/dist/{diff-x5Il8LVa.js → diff-B8Tunc3o.js} +44 -11
  67. package/dist/{diff-BUzf5Poi.js → diff-CzqLxZ77.js} +2 -2
  68. package/dist/doctor-WpvG6p4k.js +1194 -0
  69. package/dist/doctor-collect-ByfYlNv1.js +664 -0
  70. package/dist/{doctor-Bqo6FwUa.js → doctor-rOr-4ZfS.js} +2 -2
  71. package/dist/drizzle/index.d.ts +4 -3
  72. package/dist/drizzle/index.js +3 -3
  73. package/dist/elysia/index.d.ts +6 -28
  74. package/dist/elysia/index.js +16 -60
  75. package/dist/{errors-DSMnAVNa.js → errors-CWfoNg9N.js} +8 -4
  76. package/dist/{errors-Iy71s7Oj.js → errors-Cz5zn0mW.js} +17 -71
  77. package/dist/{errors-DbZ1YOnb.d.ts → errors-DAqevpNk.d.ts} +8 -21
  78. package/dist/{errors-m3u9TmDu.js → errors-DRnGZHzF.js} +4 -1
  79. package/dist/evaluation-items-CfCCejQd.js +40 -0
  80. package/dist/{evaluations-DsAU9ppl.js → evaluations-tz6D9A2G.js} +28 -46
  81. package/dist/eve/index.d.ts +6 -15
  82. package/dist/eve/index.js +7 -12
  83. package/dist/expiry-BoBJ8Tvc.js +7 -0
  84. package/dist/express/index.d.ts +6 -29
  85. package/dist/express/index.js +28 -58
  86. package/dist/fastify/index.d.ts +6 -29
  87. package/dist/fastify/index.js +16 -65
  88. package/dist/fields-BMl1RxoX.js +26 -0
  89. package/dist/{files-B_wAGYmt.js → files-DWUN9PzI.js} +5 -1
  90. package/dist/{fixtures-Cvaw0gDG.js → fixtures-ht28Cplr.js} +5 -2
  91. package/dist/{freeze-y1_jQL4v.js → freeze-CrU8nQeX.js} +31 -2
  92. package/dist/{from-snapshot-BMGnhmgv.js → from-snapshot-C3sHpZNS.js} +65 -48
  93. package/dist/{grantee-Bv04_Vzf.js → grantee-Cv5Sogfv.js} +88 -7
  94. package/dist/graph-sql-B-dsAT6j.d.ts +29 -0
  95. package/dist/{headers-B5RRv3Xm.js → headers-BZSDieNT.js} +1 -1
  96. package/dist/{headers-C8SHQccD.d.ts → headers-Cf-zWvsO.d.ts} +1 -1
  97. package/dist/helpers-H_KARDVC.js +421 -0
  98. package/dist/hono/index.d.ts +6 -28
  99. package/dist/hono/index.js +11 -43
  100. package/dist/{hosted-BwKQ1BTA.js → hosted-DJQw46hn.js} +6 -5
  101. package/dist/{http-GgVApX1k.js → http-BIhmLfCc.js} +4 -20
  102. package/dist/http-SO7qGttf.js +44 -0
  103. package/dist/ids-DC4V4CFu.js +18 -0
  104. package/dist/{index-LF_hS-yn.d.ts → index-A0YNL8jZ.d.ts} +1 -1
  105. package/dist/index-CtE07CBF.d.ts +6 -0
  106. package/dist/{index-xIxJLwOQ.d.ts → index-D3vbkoSI.d.ts} +75 -7
  107. package/dist/{index-CltcQ4Bf.d.ts → index-D6_cSa1z.d.ts} +68 -5
  108. package/dist/index.d.ts +14 -9
  109. package/dist/index.js +22 -17
  110. package/dist/instance-options-BK_rNOSC.d.ts +11 -0
  111. package/dist/instance-options-Dhhcnm3y.js +22 -0
  112. package/dist/{parse-DPfIvFMU.js → json-schema-BsAflUGW.js} +28 -57
  113. package/dist/jwt/index.d.ts +10 -6
  114. package/dist/jwt/index.js +32 -13
  115. package/dist/kernel-GSQnMz3O.js +208 -0
  116. package/dist/kysely/index.d.ts +4 -3
  117. package/dist/kysely/index.js +3 -3
  118. package/dist/live-options-H2eG8dfJ.js +60 -0
  119. package/dist/{load-BZ24CpZP.js → load-DhWEB9P1.js} +16 -10
  120. package/dist/load-DwJUafYN.js +2 -0
  121. package/dist/manifest-iaoBXHKc.js +783 -0
  122. package/dist/manifest-uDS9y5de.d.ts +206 -0
  123. package/dist/{map-DowSO96j.js → map-AcxK9o_D.js} +4 -15
  124. package/dist/{map-claims-B_6I1Rn-.js → map-claims-Z4QZOiFF.js} +13 -4
  125. package/dist/map-error-pgUWNNtG.js +23 -0
  126. package/dist/may-use-DndQ5tQ-.js +77 -0
  127. package/dist/mcp/index.d.ts +54 -22
  128. package/dist/mcp/index.js +218 -178
  129. package/dist/nest/index.d.ts +26 -31
  130. package/dist/nest/index.js +75 -84
  131. package/dist/next/client.d.ts +7 -8
  132. package/dist/next/client.js +11 -9
  133. package/dist/next/index.d.ts +30 -47
  134. package/dist/next/index.js +45 -60
  135. package/dist/next/plugin.d.ts +1 -1
  136. package/dist/next/plugin.js +32 -1
  137. package/dist/node/index.d.ts +9 -28
  138. package/dist/node/index.js +11 -43
  139. package/dist/openai/index.d.ts +6 -15
  140. package/dist/openai/index.js +7 -20
  141. package/dist/openapi/index.d.ts +87 -4
  142. package/dist/openapi/index.js +3 -3
  143. package/dist/{openapi-CwePaF7C.js → openapi-Bbg4wGVL.js} +3 -3
  144. package/dist/{openapi-DcqM8nU7.js → openapi-BqRBvAng.js} +237 -5
  145. package/dist/{openapi-DWD0Uc_4.js → openapi-CqqEbHsL.js} +5 -5
  146. package/dist/{openapi-import-BWRUNNeW.js → openapi-import-cmwetbzw.js} +1 -1
  147. package/dist/{openapi-schema-D8j_T9tO.js → openapi-schema--ARjyfQr.js} +2 -2
  148. package/dist/orpc/index.d.ts +15 -28
  149. package/dist/orpc/index.js +74 -117
  150. package/dist/otel/index.d.ts +2 -2
  151. package/dist/parse-BuyjxhZV.js +53 -0
  152. package/dist/parse-local-manifest-BkGQNzAh.d.ts +10 -0
  153. package/dist/parse-local-manifest-BrMozJCo.js +36 -0
  154. package/dist/pdp/index.d.ts +2 -2
  155. package/dist/pdp/index.js +14 -127
  156. package/dist/{permdock-yoZ7EjxX.js → permdock-CzqXjCpU.js} +641 -126
  157. package/dist/{permissions-B8vCg_bI.d.ts → permissions-CDgvKG5L.d.ts} +2 -2
  158. package/dist/{permissions-CofRqesP.js → permissions-CpZrivYv.js} +3 -3
  159. package/dist/{permissions-DC7GROPA.js → permissions-DVoF6dMt.js} +77 -15
  160. package/dist/{permissions-B4apnahQ.d.ts → permissions-DttnqqxC.d.ts} +34 -5
  161. package/dist/{pins-CqE1jZuF.js → pins-8ILTftC9.js} +2 -2
  162. package/dist/{policy-CInmNGkM.d.ts → policy-CFZAr_Al.d.ts} +330 -37
  163. package/dist/{policy-Cq2fB8Q5.d.ts → policy-D8UFyERw.d.ts} +2 -2
  164. package/dist/{policy-ANp36PnI.js → policy-xyWg7QdR.js} +173 -22
  165. package/dist/powersync-A8x_Yyvh.js +2 -0
  166. package/dist/powersync-C7kLglqX.js +540 -0
  167. package/dist/powersync-yW1UUFzp.js +62 -0
  168. package/dist/prisma/index.d.ts +3 -2
  169. package/dist/prisma/index.js +45 -20
  170. package/dist/{problem-Cgp9-KZA.js → problem-B43ztKIm.js} +74 -109
  171. package/dist/problem-details-CkL50EEf.d.ts +7 -0
  172. package/dist/problem-details-_AMOYz-w.js +144 -0
  173. package/dist/{protected-BuPAycJT.d.ts → protected-CNsMzrVd.d.ts} +5 -4
  174. package/dist/protected-Cs6kTaHo.js +100 -0
  175. package/dist/protected-bZs6rbT1.d.ts +40 -0
  176. package/dist/{provider-wTAUda2v.d.ts → provider-Cjr62YMV.d.ts} +1 -1
  177. package/dist/provider-DLzpb2Xz.js +52 -0
  178. package/dist/provider-store-DNyC1y48.js +43 -0
  179. package/dist/react/index.d.ts +7 -5
  180. package/dist/react/index.js +5 -4
  181. package/dist/react/provider-client.d.ts +1 -1
  182. package/dist/react/provider-client.js +1 -1
  183. package/dist/react-native/index.d.ts +166 -10
  184. package/dist/react-native/index.js +607 -85
  185. package/dist/{refs-ChLSxbST.js → refs-KYb4ntaz.js} +4 -3
  186. package/dist/{relations-r4soIFZB.js → relations-cjOL01hZ.js} +110 -31
  187. package/dist/replay-BsOyTrdV.js +28 -0
  188. package/dist/replay-sqBGMnNs.d.ts +5 -0
  189. package/dist/resource-ref-CaS9yVPi.js +20 -0
  190. package/dist/revocations-Bhr0aMIC.js +27 -0
  191. package/dist/rls-BMNydpHk.js +2521 -0
  192. package/dist/{rls-BOFU3chG.js → rls-CEvs64Kj.js} +8 -3
  193. package/dist/rls-fields-BMasREhR.js +3502 -0
  194. package/dist/{rls-graph-DxQ39PJj.js → rls-graph-pc9fuXYm.js} +100 -36
  195. package/dist/{rls-import-CXV6LBlS.js → rls-import-D8F7j35Q.js} +7 -6
  196. package/dist/{rls-migrate-DrFPbf8p.js → rls-migrate-7wikfrVI.js} +6 -5
  197. package/dist/rls-ownership-B5Lkq62W.js +843 -0
  198. package/dist/rls-shared-aOQ4hGTO.js +493 -0
  199. package/dist/rls-verify-D8B7dOTh.js +745 -0
  200. package/dist/{row-check-BajTgQZ-.d.ts → row-check-Dt35czLy.d.ts} +12 -15
  201. package/dist/rpc-DOK54_CS.js +89 -0
  202. package/dist/{run-CJ6UvS3a.js → run-YXCJDNYk.js} +31 -12
  203. package/dist/runtime-CB8gQFvS.js +11 -0
  204. package/dist/{saas-BRrZzJkM.js → saas-Bj_FFkjN.js} +17 -7
  205. package/dist/{schema-P8yoma__.js → schema-D3MnDMxa.js} +8 -4
  206. package/dist/scim/index.d.ts +1 -1
  207. package/dist/scim/index.js +1 -1
  208. package/dist/{scim-9NFa0XVZ.js → scim-BFGBBAqR.js} +1 -1
  209. package/dist/{scopes-cKVp_WTw.js → scopes-CVdPrWN-.js} +35 -8
  210. package/dist/server/index.d.ts +22 -11
  211. package/dist/server/index.js +11 -8
  212. package/dist/{credentials-BgRX3WEg.js → server-DlZ28Oz5.js} +1 -1
  213. package/dist/shared-DRu8VFVM.js +123 -0
  214. package/dist/{sink-Cfr9-7YC.d.ts → sink-Gs6TTVa-.d.ts} +1 -1
  215. package/dist/skills-Biq5uup3.js +192 -0
  216. package/dist/{skills-C_lpV4Jx.js → skills-JaymNCdK.js} +10 -4
  217. package/dist/{snapshot-DE8dE_hz.js → snapshot-Enxd0n-s.js} +138 -214
  218. package/dist/snapshot-cache-D6jLelln.js +44 -0
  219. package/dist/snapshot-cache-DwQH8ufx.d.ts +45 -0
  220. package/dist/solid/index.d.ts +39 -9
  221. package/dist/solid/index.js +76 -85
  222. package/dist/sources-B0UvrJ21.js +534 -0
  223. package/dist/sources-BcJgw0lt.d.ts +192 -0
  224. package/dist/{sql-Bll1d7y0.js → sql-xdg5f4Fi.js} +6 -1
  225. package/dist/{src-CTNT-PBW.js → src-CSbUiozF.js} +149 -11
  226. package/dist/ssf/index.d.ts +3 -2
  227. package/dist/ssf/index.js +3 -29
  228. package/dist/store-DMAWwAJV.js +371 -0
  229. package/dist/{store-Bq90395i.d.ts → store-D_pjn91-.d.ts} +13 -4
  230. package/dist/store-options-yO0V6gRn.js +716 -0
  231. package/dist/{stores-CkG2HrSg.js → stores-4_sqiOA1.js} +10 -63
  232. package/dist/{stores-CvOnu_2T.d.ts → stores-DVR5NHLE.d.ts} +20 -9
  233. package/dist/{stream-Q_xlB6Ko.js → stream-DDpvynSB.js} +16 -2
  234. package/dist/{stream-BhMfZOwr.d.ts → stream-DlvG2hs-.d.ts} +2 -2
  235. package/dist/subject-settings-BwBmCdTR.js +128 -0
  236. package/dist/supabase/index.d.ts +122 -6
  237. package/dist/supabase/index.js +4 -3
  238. package/dist/supabase/middleware.d.ts +32 -27
  239. package/dist/supabase/middleware.js +56 -22
  240. package/dist/{supabase-D8UlBA7Z.js → supabase-CwafwxxF.js} +3 -3
  241. package/dist/{supabase-DTxGtYdi.js → supabase-DTBaC20O.js} +345 -367
  242. package/dist/supabase-config-Bs44dare.js +472 -0
  243. package/dist/{supabase-hook-D_OqGb_V.js → supabase-hook-BuxLQLpU.js} +994 -708
  244. package/dist/supabase-hook-D5qVd_D8.js +2 -0
  245. package/dist/supautils-DYZnzRWV.js +91 -0
  246. package/dist/svelte/PermissionBoundary.svelte +37 -0
  247. package/dist/svelte/Protected.svelte +8 -2
  248. package/dist/svelte/index.d.ts +9 -6
  249. package/dist/svelte/index.js +61 -7
  250. package/dist/svelte/runtime.d.ts +4 -3
  251. package/dist/svelte/runtime.js +4 -3
  252. package/dist/svelte/source.d.ts +9 -6
  253. package/dist/svelte/source.js +7 -4
  254. package/dist/terminal/index.d.ts +6 -14
  255. package/dist/terminal/index.js +44 -32
  256. package/dist/testing/index.d.ts +105 -16
  257. package/dist/testing/index.js +504 -40
  258. package/dist/testing/saas/index.d.ts +4 -4
  259. package/dist/testing/saas/index.js +2 -2
  260. package/dist/testing/saas/permissions.d.ts +1 -1
  261. package/dist/testing/saas/permissions.js +1 -1
  262. package/dist/token-CIWxJOCh.js +50 -0
  263. package/dist/trpc/index.d.ts +7 -26
  264. package/dist/trpc/index.js +17 -100
  265. package/dist/types-9AWO9EGt.d.ts +197 -0
  266. package/dist/{types-D6Z6-rKJ.d.ts → types-BPxgszlT.d.ts} +260 -22
  267. package/dist/{types-BvBk1wgn.d.ts → types-BVyImy5I.d.ts} +5 -3
  268. package/dist/{types-CxquUByI.d.ts → types-Bvc4oWT6.d.ts} +1 -1
  269. package/dist/types-C3s9xVJG.d.ts +48 -0
  270. package/dist/{types-BBK-exvJ.d.ts → types-Dnemwd77.d.ts} +7 -1
  271. package/dist/types-kxznc7cn.d.ts +52 -0
  272. package/dist/{types-B8w5PFtS.d.ts → types-vKyAMtcX.d.ts} +17 -1
  273. package/dist/{types-B9dmiiab.d.ts → types-vNSDF7Dq.d.ts} +1 -1
  274. package/dist/{sources-DOpW5Ila.d.ts → types-yF5LmQVD.d.ts} +86 -127
  275. package/dist/unplugin/index.d.ts +1 -1
  276. package/dist/unplugin/index.js +10 -9
  277. package/dist/{usage-1ozMubLY.js → usage-D07N9QJ3.js} +2 -2
  278. package/dist/usage-D82l1CwK.js +2 -0
  279. package/dist/{usage-CUnK6Ou9.js → usage-DG1oeCca.js} +225 -62
  280. package/dist/validation-error-CnjZ4t92.js +33 -0
  281. package/dist/validation-error-CtF23SrC.d.ts +26 -0
  282. package/dist/{validity-D0uRmJKJ.js → validity-uOp8UpYn.js} +57 -36
  283. package/dist/{verifier-B90agnhl.js → verifier-BxBo6I44.js} +10 -5
  284. package/dist/version-BvacVTZR.js +17 -0
  285. package/dist/views-Soe7bGSC.js +95 -0
  286. package/dist/{vocabulary-Dk0fs-Jk.d.ts → vocabulary-DA8a8zif.d.ts} +1 -1
  287. package/dist/vue/index.d.ts +35 -13
  288. package/dist/vue/index.js +86 -93
  289. package/dist/watch-Etoa_Mvr.js +2 -0
  290. package/dist/watch-UihESpsJ.js +128 -0
  291. package/dist/webmcp/index.d.ts +2 -2
  292. package/dist/webmcp/index.js +7 -13
  293. package/package.json +62 -36
  294. package/schemas/approval-request-v1.json +175 -0
  295. package/schemas/catalog-v1.json +29 -1
  296. package/schemas/supabase-claims-v1.json +6 -1
  297. package/schemas/supabase-manifest-v1.json +150 -6
  298. package/skills/permdock/SKILL.md +7 -7
  299. package/skills/permdock-agents/SKILL.md +5 -5
  300. package/skills/permdock-agents/references/runtimes.md +12 -10
  301. package/skills/permdock-approvals/SKILL.md +4 -4
  302. package/skills/permdock-approvals/references/stores-and-resume.md +15 -4
  303. package/skills/permdock-audit/SKILL.md +3 -3
  304. package/skills/permdock-credentials/SKILL.md +4 -4
  305. package/skills/permdock-credentials/references/tokens-keys-links.md +7 -2
  306. package/skills/permdock-data/SKILL.md +4 -4
  307. package/skills/permdock-data/references/queries-and-rls.md +14 -6
  308. package/skills/permdock-data/references/relationships.md +5 -3
  309. package/skills/permdock-tenancy/SKILL.md +9 -6
  310. package/skills/permdock-tenancy/references/ownership-and-custom-roles.md +14 -8
  311. package/skills/permdock-wire/SKILL.md +4 -4
  312. package/skills/permdock-wire/references/adapters.md +42 -30
  313. package/skills/permdock-wire/references/policy-options.md +5 -3
  314. package/dist/approvers-aH0PJkmf.js +0 -20
  315. package/dist/catalog-idsHc0vo.js +0 -2
  316. package/dist/collect-B7_TIfmg.js +0 -49
  317. package/dist/collect-fRPAQIWb.js +0 -2
  318. package/dist/compile-CQbvyIBr.d.ts +0 -30
  319. package/dist/config-BPYmjTOp.js +0 -26
  320. package/dist/context-gtAwAILx.js +0 -6
  321. package/dist/create-BKF3dgFk.d.ts +0 -162
  322. package/dist/create-CSkhDU9T.js +0 -222
  323. package/dist/doctor-BGle8Gqi.js +0 -1314
  324. package/dist/helpers-DnSOrhB9.js +0 -682
  325. package/dist/index-fG6NSXlc.d.ts +0 -9
  326. package/dist/kernel-YOGCWNLf.js +0 -211
  327. package/dist/load-QOOm1z70.js +0 -2
  328. package/dist/manifest-DDQbC6K0.d.ts +0 -118
  329. package/dist/map-error-RJ3ZsUyA.js +0 -16
  330. package/dist/may-use-CnFEjVEp.js +0 -37
  331. package/dist/pg-4GJWDUxG.js +0 -953
  332. package/dist/plugin-4gr7IxFJ.js +0 -65
  333. package/dist/protected-B4K3BKoX.js +0 -138
  334. package/dist/protected-wY7nXhY9.d.ts +0 -23
  335. package/dist/provider-_wx46HpB.js +0 -48
  336. package/dist/rls-CJVja9Ww.js +0 -2119
  337. package/dist/rls-helpers-BxRuif0l.js +0 -1346
  338. package/dist/runtime-DP9ttFh1.js +0 -27
  339. package/dist/skills-Dx3QLnMY.js +0 -110
  340. package/dist/source-DoBBYJi2.js +0 -6
  341. package/dist/sources-DVHM3Mwq.js +0 -284
  342. package/dist/store-C6hFW6ta.js +0 -508
  343. package/dist/subject-settings-xt7V845g.js +0 -82
  344. package/dist/supabase-hook-DW-xP4hU.js +0 -2
  345. package/dist/types-DbWdEfcm.d.ts +0 -87
  346. package/dist/types-bva3i4Gf.d.ts +0 -98
  347. package/dist/types-i4BAOvdb.d.ts +0 -97
  348. package/dist/usage-PyEor6GA.js +0 -2
  349. package/dist/version-CnSh33Fj.js +0 -16
@@ -1,8 +1,9 @@
1
- import { t as catalogFingerprint } from "./src-CTNT-PBW.js";
2
- import { a as snapshotScopes } from "./permdock-yoZ7EjxX.js";
3
- import { i as loadConfiguredPolicy } from "./load-BZ24CpZP.js";
4
- import { t as parseCatalog } from "./parse-DPfIvFMU.js";
5
- import { t as runCatalog } from "./catalog-H-vFGwWK.js";
1
+ import { t as catalogFingerprint } from "./src-CSbUiozF.js";
2
+ import { s as snapshotScopes } from "./permdock-CzqXjCpU.js";
3
+ import { i as describeError } from "./errors-CWfoNg9N.js";
4
+ import { i as loadConfiguredPolicy } from "./load-DhWEB9P1.js";
5
+ import { t as parseCatalog } from "./parse-BuyjxhZV.js";
6
+ import { t as runCatalog } from "./catalog-z8q6bi_r.js";
6
7
  //#region src/cli/cloud.ts
7
8
  function firstNonEmpty(...values) {
8
9
  for (const value of values) if (value !== void 0 && value !== "") return value;
@@ -101,7 +102,7 @@ async function runCloud(input) {
101
102
  } catch (error) {
102
103
  return {
103
104
  code: 1,
104
- output: `PermDock Cloud unreachable: ${error instanceof Error ? error.message : String(error)}`
105
+ output: `PermDock Cloud unreachable: ${describeError(error)}`
105
106
  };
106
107
  }
107
108
  if (!response.ok) return {
@@ -1,12 +1,15 @@
1
- import { i as formatCatalogJson, n as catalogForCompare, t as buildCatalog } from "./catalog-doc-BSo_Q_-6.js";
1
+ import { i as describeError } from "./errors-CWfoNg9N.js";
2
+ import { i as formatCatalogJson, n as catalogForCompare, t as buildCatalog } from "./catalog-doc-Dsc9y7sd.js";
2
3
  import { t as catalogPath } from "./catalog-path-CnI0XTFK.js";
3
- import { n as listSourceFiles, r as rel, t as defaultSrcPath } from "./files-B_wAGYmt.js";
4
- import { a as loadModule, i as loadConfiguredPolicy, o as pickNamed, r as leavesOf, t as asPermissionTree } from "./load-BZ24CpZP.js";
4
+ import { i as rel, r as listSourceFiles, t as defaultSrcPath } from "./files-DWUN9PzI.js";
5
+ import { a as loadModule, i as loadConfiguredPolicy, o as pickNamed, r as leavesOf, t as asPermissionTree } from "./load-DhWEB9P1.js";
5
6
  import { t as shortDiff } from "./text-diff-BdkkYSbi.js";
6
7
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
7
8
  import { dirname, relative, resolve } from "node:path";
8
9
  import { Visitor, parseSync, visitorKeys } from "oxc-parser";
9
10
  //#region src/cli/scan.ts
11
+ /** oxc reports recoverable problems as `Warning` or `Advice`; only `Error` leaves the program incomplete. */
12
+ const PARSE_ERRORS = /* @__PURE__ */ new Set(["Error"]);
10
13
  const CHECK_CALLS = /* @__PURE__ */ new Set([
11
14
  "can",
12
15
  "decide",
@@ -26,7 +29,8 @@ const CHECK_CALLS = /* @__PURE__ */ new Set([
26
29
  "relation",
27
30
  "plan",
28
31
  "actor",
29
- "assurance"
32
+ "assurance",
33
+ "inherit"
30
34
  ]);
31
35
  function scanSources(cwd, files, knownKeys) {
32
36
  const roots = /* @__PURE__ */ new Set(["permissions"]);
@@ -38,27 +42,53 @@ function scanSources(cwd, files, knownKeys) {
38
42
  const planNames = /* @__PURE__ */ new Set();
39
43
  const allowKeys = /* @__PURE__ */ new Set();
40
44
  const snapshots = [];
45
+ const unparsed = [];
46
+ const parsed = [];
41
47
  for (const file of files) {
42
48
  const source = readFileSync(file, "utf8");
43
- let program;
49
+ const fileRel = rel(cwd, file);
44
50
  try {
45
- program = parseSync(file, source).program;
46
- } catch {
47
- continue;
51
+ const result = parseSync(file, source);
52
+ const error = result.errors.find((item) => PARSE_ERRORS.has(item.severity));
53
+ if (error !== void 0) unparsed.push({
54
+ file: fileRel,
55
+ line: lineIndex(source)(error.labels[0]?.start ?? 0),
56
+ message: error.message
57
+ });
58
+ parsed.push({
59
+ file,
60
+ source,
61
+ program: result.program
62
+ });
63
+ } catch (error) {
64
+ unparsed.push({
65
+ file: fileRel,
66
+ line: 1,
67
+ message: describeError(error)
68
+ });
48
69
  }
70
+ }
71
+ const definitions = /* @__PURE__ */ new Set(["permissions"]);
72
+ for (const { program } of parsed) walk(program, (node) => {
73
+ if (node.type === "VariableDeclarator" && node.id?.type === "Identifier" && node.id.name !== void 0 && isDefinePermissions(node.init)) definitions.add(node.id.name);
74
+ });
75
+ for (const { file, source, program } of parsed) {
49
76
  const fileRel = rel(cwd, file);
50
- walk(program, (node, parent) => {
77
+ const lineAt = lineIndex(source);
78
+ const scopes = /* @__PURE__ */ new WeakMap();
79
+ walk(program, (node, parent, ancestors) => {
80
+ const isRoot = (name) => boundToRoot(name, ancestors, definitions, scopes);
51
81
  if (node.type === "CallExpression") {
52
- recordCall(node, parent, source, fileRel, roots, definitionFiles, usages, unknown, dynamic, roleNames, planNames, allowKeys, knownKeys);
82
+ recordCall(node, parent, lineAt, fileRel, roots, definitionFiles, usages, unknown, dynamic, roleNames, planNames, allowKeys, knownKeys);
53
83
  const callee = calleeName(node.callee);
54
84
  if (callee === "snapshot" || callee === "snapshotFor") snapshots.push({
55
85
  file: fileRel,
56
- line: lineAt(source, node.start ?? 0),
57
- include: includeOf(node.arguments?.[callee === "snapshot" ? 0 : 2], roots)
86
+ line: lineAt(node.start ?? 0),
87
+ include: includeOf(node.arguments?.[callee === "snapshot" ? 0 : 2], isRoot)
58
88
  });
59
89
  }
60
- if (node.type === "MemberExpression" && parent?.type !== "MemberExpression") recordMember(node, parent, source, fileRel, roots, usages, unknown, dynamic, allowKeys, knownKeys);
61
- if (node.type === "ImportDeclaration") recordImport(node, roots);
90
+ if (node.type === "MemberExpression" && parent?.type !== "MemberExpression") recordMember(node, parent, lineAt, fileRel, isRoot, usages, unknown, dynamic, allowKeys, knownKeys);
91
+ if (node.type === "ImportDeclaration") recordImport(node, roots, definitions);
62
92
  });
63
93
  }
64
94
  return {
@@ -70,10 +100,11 @@ function scanSources(cwd, files, knownKeys) {
70
100
  roleNames: [...roleNames].toSorted(),
71
101
  planNames: [...planNames].toSorted(),
72
102
  allowKeys: [...allowKeys].toSorted(),
73
- snapshots
103
+ snapshots,
104
+ unparsed
74
105
  };
75
106
  }
76
- function includeOf(options, roots) {
107
+ function includeOf(options, isRoot) {
77
108
  if (options?.type !== "ObjectExpression") return options === void 0 ? void 0 : null;
78
109
  const property = options.properties?.find((item) => item.key?.name === "include");
79
110
  if (property === void 0) return options.properties?.some((item) => item.type === "SpreadElement") ? null : void 0;
@@ -81,22 +112,118 @@ function includeOf(options, roots) {
81
112
  if (list?.type !== "ArrayExpression") return null;
82
113
  const keys = [];
83
114
  for (const element of list.elements ?? []) {
84
- const [root, ...rest] = (element.type === "MemberExpression" ? memberPath(element) : void 0) ?? [];
85
- if (root === void 0 || !roots.has(root) || rest.length === 0) return null;
115
+ const [root, ...rest] = (element?.type === "MemberExpression" ? memberPath(element) : void 0) ?? [];
116
+ if (root === void 0 || !isRoot(root) || rest.length === 0) return null;
86
117
  keys.push(rest.join("."));
87
118
  }
88
119
  return keys;
89
120
  }
90
- function recordImport(node, roots) {
121
+ function recordImport(node, roots, definitions) {
91
122
  for (const spec of node.specifiers ?? []) {
92
- const imported = spec.imported?.name ?? spec.local?.name;
93
123
  const local = spec.local?.name;
94
- if (imported === "permissions" && local !== void 0) roots.add(local);
124
+ if (local !== void 0 && importsRoot(spec, definitions)) roots.add(local);
125
+ }
126
+ }
127
+ function isDefinePermissions(node) {
128
+ return node?.type === "CallExpression" && calleeName(node.callee) === "definePermissions";
129
+ }
130
+ /** An import binding of a permission tree: by its imported name, or a default import named `permissions`. */
131
+ function importsRoot(spec, definitions) {
132
+ if (spec.type === "ImportSpecifier") {
133
+ const value = spec.imported?.value;
134
+ const imported = typeof value === "string" ? value : spec.imported?.name;
135
+ return imported !== void 0 && definitions.has(imported);
136
+ }
137
+ return spec.type === "ImportDefaultSpecifier" && spec.local?.name === "permissions";
138
+ }
139
+ function patternNames(pattern, into) {
140
+ if (pattern === null || pattern === void 0) return;
141
+ const type = pattern.type;
142
+ if (type === "Identifier" && pattern.name !== void 0) into.push(pattern.name);
143
+ else if (type === "ObjectPattern") for (const property of pattern.properties ?? []) {
144
+ const value = property.value;
145
+ patternNames(property.type === "RestElement" ? property.argument : value, into);
146
+ }
147
+ else if (type === "ArrayPattern") for (const element of pattern.elements ?? []) patternNames(element, into);
148
+ else patternNames(pattern.left ?? pattern.argument ?? pattern.parameter, into);
149
+ }
150
+ const NAMED_DECLARATIONS = /* @__PURE__ */ new Set([
151
+ "FunctionDeclaration",
152
+ "ClassDeclaration",
153
+ "TSEnumDeclaration"
154
+ ]);
155
+ function declareStatement(statement, bindings, definitions) {
156
+ const type = statement.type;
157
+ if (type === "VariableDeclaration") for (const declarator of statement.declarations ?? []) {
158
+ const names = [];
159
+ patternNames(declarator.id, names);
160
+ const root = declarator.id?.type === "Identifier" && isDefinePermissions(declarator.init);
161
+ for (const name of names) bindings.set(name, root);
162
+ }
163
+ else if (NAMED_DECLARATIONS.has(type)) {
164
+ if (statement.id?.name !== void 0) bindings.set(statement.id.name, false);
165
+ } else if (type === "ExportNamedDeclaration" || type === "ExportDefaultDeclaration") {
166
+ const declaration = statement.declaration;
167
+ if (declaration !== void 0 && declaration !== null) declareStatement(declaration, bindings, definitions);
168
+ } else if (type === "ImportDeclaration") {
169
+ for (const spec of statement.specifiers ?? []) if (spec.local?.name !== void 0) bindings.set(spec.local.name, importsRoot(spec, definitions));
95
170
  }
96
171
  }
97
- function recordCall(node, parent, source, fileRel, roots, definitionFiles, usages, unknown, dynamic, roleNames, planNames, _allowKeys, knownKeys) {
172
+ function isNodeList(value) {
173
+ return Array.isArray(value);
174
+ }
175
+ const BLOCK_SCOPES = /* @__PURE__ */ new Set([
176
+ "Program",
177
+ "BlockStatement",
178
+ "StaticBlock"
179
+ ]);
180
+ const FUNCTION_SCOPES = /* @__PURE__ */ new Set([
181
+ "FunctionDeclaration",
182
+ "FunctionExpression",
183
+ "ArrowFunctionExpression"
184
+ ]);
185
+ /** The names a scope node declares, each with whether it is a permission tree; `undefined` for a node that opens no scope. */
186
+ function bindingsOf(node, definitions) {
187
+ const bindings = /* @__PURE__ */ new Map();
188
+ const type = node.type;
189
+ const declare = (statements) => {
190
+ for (const statement of isNodeList(statements) ? statements : []) declareStatement(statement, bindings, definitions);
191
+ };
192
+ const names = [];
193
+ if (BLOCK_SCOPES.has(type)) declare(node.body);
194
+ else if (FUNCTION_SCOPES.has(type)) {
195
+ for (const param of node.params ?? []) patternNames(param, names);
196
+ if (type === "FunctionExpression") patternNames(node.id, names);
197
+ } else if (type === "ForStatement") declare(node.init === null || node.init === void 0 ? [] : [node.init]);
198
+ else if (type === "ForInStatement" || type === "ForOfStatement") declare(node.left === void 0 ? [] : [node.left]);
199
+ else if (type === "CatchClause") patternNames(node.param, names);
200
+ else if (type === "SwitchStatement") for (const branch of node.cases ?? []) declare(branch.consequent);
201
+ else return;
202
+ for (const name of names) bindings.set(name, false);
203
+ return bindings;
204
+ }
205
+ /**
206
+ * Whether `name`, read inside `ancestors`, is bound to a permission tree: the
207
+ * innermost scope that declares it decides. A name no scope declares keeps
208
+ * matching by name, as a global or generated reference does.
209
+ */
210
+ function boundToRoot(name, ancestors, definitions, cache) {
211
+ for (const scope of ancestors.toReversed()) {
212
+ let bindings = cache.get(scope);
213
+ if (bindings === void 0) {
214
+ const found = bindingsOf(scope, definitions);
215
+ if (found === void 0) continue;
216
+ bindings = found;
217
+ cache.set(scope, bindings);
218
+ }
219
+ const bound = bindings.get(name);
220
+ if (bound !== void 0) return bound;
221
+ }
222
+ return definitions.has(name);
223
+ }
224
+ function recordCall(node, parent, lineAt, fileRel, roots, definitionFiles, usages, unknown, dynamic, roleNames, planNames, _allowKeys, knownKeys) {
98
225
  const callee = calleeName(node.callee);
99
- const line = lineAt(source, node.start ?? 0);
226
+ const line = lineAt(node.start ?? 0);
100
227
  if (callee === "definePermissions" || callee === "defineRoles" || callee === "definePlans") {
101
228
  const name = declaredName(parent);
102
229
  if (name !== void 0) {
@@ -130,12 +257,12 @@ function recordCall(node, parent, source, fileRel, roots, definitionFiles, usage
130
257
  });
131
258
  }
132
259
  }
133
- function recordMember(node, parent, source, fileRel, roots, usages, unknown, dynamic, allowKeys, knownKeys) {
260
+ function recordMember(node, parent, lineAt, fileRel, isRoot, usages, unknown, dynamic, allowKeys, knownKeys) {
134
261
  if (node.computed === true) {
135
262
  const root = rootName(node);
136
- if (root !== void 0 && roots.has(root)) dynamic.push({
263
+ if (root !== void 0 && isRoot(root)) dynamic.push({
137
264
  file: fileRel,
138
- line: lineAt(source, node.start ?? 0),
265
+ line: lineAt(node.start ?? 0),
139
266
  call: callName(parent)
140
267
  });
141
268
  return;
@@ -143,13 +270,13 @@ function recordMember(node, parent, source, fileRel, roots, usages, unknown, dyn
143
270
  const path = memberPath(node);
144
271
  if (path === void 0 || path.length < 2) return;
145
272
  const [root, ...rest] = path;
146
- if (root === void 0 || !roots.has(root)) return;
273
+ if (root === void 0 || !isRoot(root)) return;
147
274
  const key = rest.join(".");
148
275
  if (!knownKeys.has(key) && isFieldOrSubtree(rest, knownKeys)) return;
149
276
  const call = callName(parent);
150
277
  const usage = {
151
278
  file: fileRel,
152
- line: lineAt(source, node.start ?? 0),
279
+ line: lineAt(node.start ?? 0),
153
280
  call
154
281
  };
155
282
  if (call === "allow") allowKeys.add(key);
@@ -215,11 +342,20 @@ function rootName(node) {
215
342
  while (current?.type === "MemberExpression") current = current.object;
216
343
  return current?.type === "Identifier" ? current.name : void 0;
217
344
  }
218
- function lineAt(source, index) {
219
- let line = 1;
220
- const end = Math.min(index, source.length);
221
- for (let i = 0; i < end; i += 1) if (source.charCodeAt(i) === 10) line += 1;
222
- return line;
345
+ /** One pass over the file, then a binary search per node. */
346
+ function lineIndex(source) {
347
+ const starts = [0];
348
+ for (let i = 0; i < source.length; i += 1) if (source.charCodeAt(i) === 10) starts.push(i + 1);
349
+ return (index) => {
350
+ let low = 0;
351
+ let high = starts.length - 1;
352
+ while (low < high) {
353
+ const mid = low + high + 1 >> 1;
354
+ if ((starts[mid] ?? 0) <= index) low = mid;
355
+ else high = mid - 1;
356
+ }
357
+ return low + 1;
358
+ };
223
359
  }
224
360
  function collectObjectKeys(node, into) {
225
361
  if (node?.type !== "ObjectExpression" || node.properties === void 0) return;
@@ -238,7 +374,7 @@ function walk(program, visit) {
238
374
  const handlers = {};
239
375
  for (const type of Object.keys(visitorKeys)) {
240
376
  handlers[type] = (node) => {
241
- visit(node, stack.at(-1));
377
+ visit(node, stack.at(-1), stack);
242
378
  stack.push(node);
243
379
  };
244
380
  handlers[`${type}:exit`] = () => {
@@ -250,6 +386,7 @@ function walk(program, visit) {
250
386
  //#endregion
251
387
  //#region src/cli/collect.ts
252
388
  async function runCollect(input) {
389
+ const load = { fresh: input.fresh === true };
253
390
  const srcPath = input.collect.srcPath ?? input.config.collect?.srcPath ?? defaultSrcPath();
254
391
  const outPath = catalogPath(input.config, input.cwd, input.collect.out);
255
392
  const permissionsRel = input.config.permissions ?? guessPermissions(input.cwd, srcPath);
@@ -270,7 +407,7 @@ async function runCollect(input) {
270
407
  };
271
408
  let tree;
272
409
  try {
273
- const mod = await loadModule(permissionsAbs);
410
+ const mod = await loadModule(permissionsAbs, load);
274
411
  tree = asPermissionTree(pickNamed(mod, ["permissions"]));
275
412
  } catch (error) {
276
413
  return {
@@ -278,13 +415,15 @@ async function runCollect(input) {
278
415
  document: void 0,
279
416
  scan: void 0,
280
417
  outPath,
281
- message: error instanceof Error ? error.message : String(error)
418
+ message: describeError(error)
282
419
  };
283
420
  }
284
- const files = listSourceFiles(input.cwd, srcPath);
421
+ const files = listSourceFiles(input.cwd, input.scanPath ?? srcPath);
285
422
  const knownKeys = new Set(leavesOf(tree).map((leaf) => leaf.key));
286
423
  const scan = scanSources(input.cwd, files, knownKeys);
287
- const document = buildCatalog(tree, scan, input.now.toISOString(), await loadConfiguredPolicy(input.cwd, input.config.policy));
424
+ const policy = input.loadPolicy === void 0 ? await loadConfiguredPolicy(input.cwd, input.config.policy, load) : await input.loadPolicy();
425
+ const generatedAt = input.now.toISOString();
426
+ const document = buildCatalog(tree, scan, generatedAt, policy);
288
427
  const next = formatCatalogJson(document);
289
428
  if (input.check) {
290
429
  if (!existsSync(outPath)) return {
@@ -297,7 +436,7 @@ async function runCollect(input) {
297
436
  const current = readFileSync(outPath, "utf8");
298
437
  const currentDoc = JSON.parse(current);
299
438
  const onDisk = catalogForCompare(currentDoc);
300
- const generated = catalogForCompare(document);
439
+ const generated = catalogForCompare(input.scanPath === void 0 || samePaths(input.scanPath, srcPath) ? document : buildCatalog(tree, scanSources(input.cwd, listSourceFiles(input.cwd, srcPath), knownKeys), generatedAt, policy));
301
440
  if (onDisk !== generated) {
302
441
  const file = rel(input.cwd, outPath);
303
442
  return {
@@ -318,16 +457,26 @@ async function runCollect(input) {
318
457
  }
319
458
  mkdirSync(dirname(outPath), { recursive: true });
320
459
  writeFileSync(outPath, next);
460
+ const written = [outPath];
321
461
  const barrel = input.collect.barrel ?? input.config.collect?.barrel;
322
- if (barrel !== void 0 && barrel !== false) writeBarrel(resolve(input.cwd, barrel === true ? "src/permissions.generated.ts" : barrel), permissionsAbs);
462
+ if (barrel !== void 0 && barrel !== false) {
463
+ const barrelPath = resolve(input.cwd, barrelFile(barrel));
464
+ writeBarrel(barrelPath, permissionsAbs);
465
+ written.push(barrelPath);
466
+ }
323
467
  return {
324
468
  code: 0,
325
469
  document,
326
470
  scan,
327
471
  outPath,
328
- message: `wrote ${rel(input.cwd, outPath)}`
472
+ message: `wrote ${rel(input.cwd, outPath)}`,
473
+ written
329
474
  };
330
475
  }
476
+ function samePaths(a, b) {
477
+ return a.length === b.length && a.every((entry, index) => entry === b[index]);
478
+ }
479
+ /** The permissions module `collect` reads when the config names none. */
331
480
  function guessPermissions(cwd, srcPath) {
332
481
  return [
333
482
  "src/permissions.ts",
@@ -335,6 +484,9 @@ function guessPermissions(cwd, srcPath) {
335
484
  ...srcPath.map((entry) => `${entry.replace(/\/$/, "")}/permissions.ts`)
336
485
  ].find((file) => existsSync(resolve(cwd, file)));
337
486
  }
487
+ function barrelFile(barrel) {
488
+ return barrel === true ? "src/permissions.generated.ts" : barrel;
489
+ }
338
490
  function writeBarrel(abs, permissionsAbs) {
339
491
  const specifier = relative(dirname(abs), permissionsAbs).replace(/\\/gu, "/").replace(/\.tsx?$/u, ".js");
340
492
  const body = `// @generated by permdock — do not edit
@@ -347,4 +499,4 @@ export const permissions = mergePermissions(collected)
347
499
  writeFileSync(abs, body);
348
500
  }
349
501
  //#endregion
350
- export { scanSources as n, runCollect as t };
502
+ export { scanSources as i, guessPermissions as n, runCollect as r, barrelFile as t };
@@ -0,0 +1,83 @@
1
+ import { i as describeError } from "./errors-CWfoNg9N.js";
2
+ import { a as listArg, i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-DWOrSQic.js";
3
+ import { defineCommand } from "citty";
4
+ //#region src/cli/commands/collect.ts
5
+ function collect(ctx) {
6
+ return defineCommand({
7
+ meta: {
8
+ name: "collect",
9
+ description: COMMAND_DESCRIPTIONS.collect
10
+ },
11
+ args: {
12
+ ...globalArgs,
13
+ check: {
14
+ type: "boolean",
15
+ description: "Exit 1 when the catalog on disk is stale; write nothing"
16
+ },
17
+ src: {
18
+ type: "string",
19
+ description: "Source roots or globs, repeatable or comma-separated",
20
+ valueHint: "path"
21
+ },
22
+ out: {
23
+ type: "string",
24
+ description: "Catalog file to write",
25
+ valueHint: "file"
26
+ },
27
+ watch: {
28
+ type: "boolean",
29
+ description: "Collect again when a source, config or policy file changes"
30
+ }
31
+ },
32
+ async run({ args: parsed, rawArgs }) {
33
+ const src = listArg(rawArgs, "src");
34
+ const out = stringArg(parsed.out);
35
+ const overrides = {
36
+ ...src.length > 0 ? { srcPath: src } : {},
37
+ ...out === void 0 ? {} : { out }
38
+ };
39
+ if (parsed.watch === true) {
40
+ if (parsed.check === true) {
41
+ ctx.report({
42
+ code: 2,
43
+ output: "collect: --watch writes the catalog; drop --check"
44
+ });
45
+ return;
46
+ }
47
+ const { createCollectScheduler } = await import("./watch-Etoa_Mvr.js");
48
+ const scheduler = createCollectScheduler(ctx.cwd, { collect: overrides }, {
49
+ ...ctx.configFile === void 0 ? {} : { configFile: ctx.configFile },
50
+ report: (message) => {
51
+ ctx.io.stderr(message ?? "catalog updated");
52
+ }
53
+ });
54
+ let message;
55
+ try {
56
+ message = await scheduler.run(false);
57
+ } catch (error) {
58
+ message = describeError(error);
59
+ }
60
+ scheduler.watch();
61
+ ctx.report({
62
+ code: 0,
63
+ output: message ?? "watching for changes; Ctrl-C to stop"
64
+ });
65
+ return;
66
+ }
67
+ const result = await (await import("./collect-rG2IQ3t0.js")).runCollect({
68
+ cwd: ctx.cwd,
69
+ config: ctx.config,
70
+ collect: overrides,
71
+ check: parsed.check === true,
72
+ now: ctx.now,
73
+ io: ctx.io
74
+ });
75
+ ctx.report({
76
+ code: result.code,
77
+ output: result.message
78
+ });
79
+ }
80
+ });
81
+ }
82
+ //#endregion
83
+ export { collect };
@@ -0,0 +1,2 @@
1
+ import { r as runCollect } from "./collect-DDDv_ESs.js";
2
+ export { runCollect };
@@ -65,26 +65,30 @@ const COMMAND_DESCRIPTIONS = {
65
65
  diff: "Compare two policies or catalogs; exit 1 on a breaking change",
66
66
  usage: "Report unused, ungranted and role-less permissions and conditions on undeclared fields",
67
67
  doctor: "Check a PermDock installation and print a fix for each finding",
68
+ config: "Check permdock.config.ts for unknown keys, or print the effective config",
68
69
  skills: "Install, update or list the PermDock Agent Skills",
69
70
  openapi: "Emit security into an OpenAPI document, or import one into a generated definition",
70
71
  rls: "Generate, import, verify or migrate Postgres RLS policies from the policy",
71
72
  arazzo: "Resolve every Arazzo step to x-permdock-permissions",
72
73
  cloud: "Publish the catalog, hostable flags and role assignability to a PermDock Cloud environment",
73
- supabase: "Generate the Supabase Custom Access Token Hook, or inspect its manifest"
74
+ supabase: "Generate the Supabase Custom Access Token Hook, or inspect its manifest",
75
+ powersync: "Generate PowerSync Sync Streams from the policy, or verify them against the fixtures"
74
76
  };
75
77
  /** Every top-level command, loaded only when it runs or its own `--help` is asked for. */
76
78
  const commands = {
77
- collect: async () => (await import("./collect-B7_TIfmg.js")).collect,
78
- catalog: async () => (await import("./catalog-B0E6bggc.js")).catalog,
79
- diff: async () => (await import("./diff-BUzf5Poi.js")).diff,
80
- usage: async () => (await import("./usage-1ozMubLY.js")).usage,
81
- doctor: async () => (await import("./doctor-Bqo6FwUa.js")).doctor,
82
- skills: async () => (await import("./skills-C_lpV4Jx.js")).skills,
83
- openapi: async () => (await import("./openapi-CwePaF7C.js")).openapi,
84
- rls: async () => (await import("./rls-BOFU3chG.js")).rls,
85
- arazzo: async () => (await import("./arazzo-aoTkqYsJ.js")).arazzo,
86
- cloud: async () => (await import("./cloud-BNQTrmrr.js")).cloud,
87
- supabase: async () => (await import("./supabase-D8UlBA7Z.js")).supabase
79
+ collect: async () => (await import("./collect-DLlujdHC.js")).collect,
80
+ catalog: async () => (await import("./catalog-h2tlKFkq.js")).catalog,
81
+ diff: async () => (await import("./diff-CzqLxZ77.js")).diff,
82
+ usage: async () => (await import("./usage-D07N9QJ3.js")).usage,
83
+ doctor: async () => (await import("./doctor-rOr-4ZfS.js")).doctor,
84
+ config: async () => (await import("./config-Bn00Z3ks.js")).config,
85
+ skills: async () => (await import("./skills-JaymNCdK.js")).skills,
86
+ openapi: async () => (await import("./openapi-Bbg4wGVL.js")).openapi,
87
+ rls: async () => (await import("./rls-CEvs64Kj.js")).rls,
88
+ arazzo: async () => (await import("./arazzo-cmvX2jDe.js")).arazzo,
89
+ cloud: async () => (await import("./cloud-BGhHS-lY.js")).cloud,
90
+ supabase: async () => (await import("./supabase-CwafwxxF.js")).supabase,
91
+ powersync: async () => (await import("./powersync-yW1UUFzp.js")).powersync
88
92
  };
89
93
  function isCommand(name) {
90
94
  return Object.hasOwn(commands, name);
@@ -0,0 +1,3 @@
1
+ import { n as GraphSqlPart, r as RelationsMapping, t as GraphSql } from "../graph-sql-B-dsAT6j.js";
2
+ import { a as CompiledWhere, c as compileWhere, i as CompiledSql, l as escapeLike, n as CompiledCompare, o as MembershipTable, r as CompiledExists, s as MembershipsMapping, t as CompileWhereOptions } from "../compile-CNnl6uIt.js";
3
+ export { type CompileWhereOptions, type CompiledCompare, type CompiledExists, type CompiledSql, type CompiledWhere, type GraphSql, type GraphSqlPart, type MembershipTable, type MembershipsMapping, type RelationsMapping, compileWhere, escapeLike };
@@ -0,0 +1,2 @@
1
+ import { n as escapeLike, t as compileWhere } from "../compile-Ba4blROR.js";
2
+ export { compileWhere, escapeLike };