permdock 0.30.0 → 0.32.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 (479) hide show
  1. package/README.md +2 -2
  2. package/dist/a2a/index.d.ts +5 -5
  3. package/dist/a2a/index.js +2 -2
  4. package/dist/{adoption-scan-EGg-hGEu.js → adoption-scan-BJMEEu7V.js} +1 -1
  5. package/dist/agent/index.d.ts +2 -2
  6. package/dist/agent/index.js +1 -1
  7. package/dist/ai-sdk/index.d.ts +4 -4
  8. package/dist/ai-sdk/index.js +3 -3
  9. package/dist/annotate-dUrBHXWa.js +183 -0
  10. package/dist/{annotate-doc-BCOCOrq_.js → annotate-doc-BA0betEO.js} +5 -4
  11. package/dist/annotate-routes-CGJy1ojp.js +30 -0
  12. package/dist/app/index.d.ts +1 -1
  13. package/dist/app/index.js +1 -1
  14. package/dist/app-peer-BnMh5lqz.js +27 -0
  15. package/dist/approval-chain-D97rgMoA.js +431 -0
  16. package/dist/{approval-normalize-Cpp8R0rY.js → approval-normalize-C6je8vWN.js} +1 -1
  17. package/dist/{approval-prompt-C-vjNZyd.d.ts → approval-prompt-yNyhQqn8.d.ts} +2 -2
  18. package/dist/approvals/index.d.ts +3 -3
  19. package/dist/approvals/index.js +3 -3
  20. package/dist/{approvals-7jHYXocE.js → approvals-Bt5IQ4wR.js} +3 -3
  21. package/dist/{arazzo-CfjZOmVG.js → arazzo-BAgh0PT6.js} +3 -3
  22. package/dist/{arazzo-yiKJ4jm0.js → arazzo-C_xK2Kaa.js} +2 -2
  23. package/dist/{args-Bc0HLiD4.js → args-BSpXxMnb.js} +2 -1
  24. package/dist/ast-CAOxvn9t.js +188 -0
  25. package/dist/ast-Dnm2TOHN.js +434 -0
  26. package/dist/astro/index.d.ts +6 -6
  27. package/dist/astro/index.js +2 -2
  28. package/dist/{audience-DauhRBNg.js → audience-CARf-b-R.js} +1 -1
  29. package/dist/authzen/index.d.ts +6 -6
  30. package/dist/authzen/index.js +3 -3
  31. package/dist/{automation-CUcWz8uu.d.ts → automation-0VF1xe4o.d.ts} +3 -3
  32. package/dist/{automation-CpPdFX91.js → automation-D58PEI7Y.js} +1 -1
  33. package/dist/baseline-file-BQoki1O_.js +148 -0
  34. package/dist/better-auth/index.d.ts +2 -2
  35. package/dist/better-auth/index.js +2 -2
  36. package/dist/better-supabase/index.d.ts +72 -19
  37. package/dist/better-supabase/index.js +156 -71
  38. package/dist/{bind-up3QptTt.js → bind-BYeoLJgN.js} +5 -4
  39. package/dist/{bind-B3MHrzw4.d.ts → bind-zQacwAOg.d.ts} +12 -7
  40. package/dist/bsb-access-Bcw6GrQm.js +74 -0
  41. package/dist/bsb-access-tags-CjeR7v7-.js +272 -0
  42. package/dist/bsb-action-keys-CYEREFMg.js +377 -0
  43. package/dist/bsb-actions-BHiyBxQZ.js +65 -0
  44. package/dist/budgets-Dpumu_Dt.js +75 -0
  45. package/dist/{build-instance-hLKYe3-E.js → build-instance-CFiegi_w.js} +1 -1
  46. package/dist/bundle-size-Ddhv_H_v.js +56 -0
  47. package/dist/bundle-size-DwZ4e1gu.js +1 -0
  48. package/dist/{capability-CVt3lpVK.d.ts → capability-BPzseilU.d.ts} +2 -2
  49. package/dist/{capability-_ZsyfYxU.js → capability-oxfxybFR.js} +1 -1
  50. package/dist/{casbin-QzddqHaV.js → casbin-BErdqy1J.js} +1 -1
  51. package/dist/{casbin-j_468wDU.js → casbin-EwdKipQs.js} +2 -2
  52. package/dist/{casl-CrltbDPa.js → casl-BSt24g-p.js} +1 -1
  53. package/dist/catalog/index.d.ts +5 -5
  54. package/dist/catalog/index.js +6 -6
  55. package/dist/{catalog-DXSP1we9.js → catalog-BExjL94D.js} +4 -4
  56. package/dist/{catalog-COoxFOoy.js → catalog-CBPFyRv7.js} +2 -2
  57. package/dist/{catalog-doc-Bp5khmCG.js → catalog-doc-D4g3nyFB.js} +5 -3
  58. package/dist/{catalog-operations-dxuOZr4J.js → catalog-operations-BqSsByIE.js} +3 -3
  59. package/dist/catalog-sR0m6x2g.js +1 -0
  60. package/dist/{challenge-CjwmjcuX.js → challenge-CRB1X3Ry.js} +1 -1
  61. package/dist/chat/index.d.ts +1 -1
  62. package/dist/chat/index.js +2 -2
  63. package/dist/chat-sdk/index.d.ts +3 -3
  64. package/dist/claims-size-B6j0Ff4Q.js +1 -0
  65. package/dist/{perf-token-dFGVP14-.js → claims-size-BsSDVD5u.js} +66 -1
  66. package/dist/claude-agent/index.d.ts +3 -3
  67. package/dist/claude-agent/index.js +2 -2
  68. package/dist/clerk/index.d.ts +3 -3
  69. package/dist/cli/bin.js +1 -1
  70. package/dist/cli/generate/watch-worker.js +2 -2
  71. package/dist/cli/index.d.ts +9 -9
  72. package/dist/cli/index.js +3 -3
  73. package/dist/cli/plugins/app.d.ts +1 -1
  74. package/dist/cli/plugins/app.js +1 -1
  75. package/dist/cli/plugins/better-supabase.d.ts +1 -1
  76. package/dist/cli/plugins/openapi.d.ts +1 -1
  77. package/dist/cli/plugins/openapi.js +2 -2
  78. package/dist/cli/plugins/powersync.d.ts +1 -1
  79. package/dist/cli/plugins/powersync.js +2 -2
  80. package/dist/cli/plugins/rls.d.ts +2 -2
  81. package/dist/cli/plugins/rls.js +1 -1
  82. package/dist/cli/plugins/schemas.d.ts +1 -1
  83. package/dist/cli/plugins/schemas.js +1 -1
  84. package/dist/cli/plugins/scim.d.ts +2 -2
  85. package/dist/cli/plugins/supabase-hook.d.ts +2 -2
  86. package/dist/cli/plugins/supabase-hook.js +1 -1
  87. package/dist/cli/plugins/supabase.d.ts +3 -3
  88. package/dist/cli/plugins/supabase.js +2 -2
  89. package/dist/cli/plugins/ui.d.ts +1 -1
  90. package/dist/cli/plugins/ui.js +1 -1
  91. package/dist/{client-subject-v89t811z.d.ts → client-subject-xCSkKD1C.d.ts} +2 -2
  92. package/dist/cloud/index.d.ts +8 -8
  93. package/dist/cloud/index.js +1 -1
  94. package/dist/{cloud-D3c4zhYr.js → cloud-DW3q3qnp.js} +3 -3
  95. package/dist/{codemod-BLTuDxFa.js → codemod-CF7NNDzA.js} +616 -392
  96. package/dist/codemod-DVDMFsTX.js +75 -0
  97. package/dist/{collect-BYPq-0JU.js → collect-CE5wK0AX.js} +3 -3
  98. package/dist/collect-CIdE3FGC.js +1 -0
  99. package/dist/{collect-BOh9Pxob.js → collect-CPimbkC5.js} +3 -3
  100. package/dist/compare-8SNJN-9U.js +12 -0
  101. package/dist/compile/index.d.ts +1 -1
  102. package/dist/{compile-B9SZiEnG.js → compile-BXKYYmT1.js} +19 -23
  103. package/dist/{compile-D8c1nFGy.d.ts → compile-tG1zkSgX.d.ts} +3 -3
  104. package/dist/{completion-CVTgFKK6.js → completion-B59uPAnZ.js} +2 -2
  105. package/dist/config-7QvEq57a.js +521 -0
  106. package/dist/{config-ClUStKUe.js → config-VCa1RLUe.js} +2 -2
  107. package/dist/config-paths-CQvGng3k.js +136 -0
  108. package/dist/{config-report-GJmQMf2K.js → config-report-CjvA6lGI.js} +7 -2
  109. package/dist/{config-shape-B6tdyBju.js → config-shape-BTojaD-H.js} +9 -2
  110. package/dist/{context-BdoA9DhS.js → context-BQHKgT1m.js} +2 -2
  111. package/dist/context-CAFddgb9.js +35 -0
  112. package/dist/convex/index.d.ts +5 -5
  113. package/dist/convex/index.js +2 -2
  114. package/dist/{core-tEfD0lwu.js → core-C5yCD-Ls.js} +6 -6
  115. package/dist/{core-CnC47rSf.d.ts → core-bf8qgaZf.d.ts} +3 -3
  116. package/dist/{coverage-DL7JCZmb.d.ts → coverage-AOeWiQ7Z.d.ts} +2 -2
  117. package/dist/{coverage-nFSMjFxH.js → coverage-C3jVYC9Y.js} +1 -1
  118. package/dist/{create-sGl1ccTp.d.ts → create-B7Xa4jSQ.d.ts} +9 -9
  119. package/dist/{create-D3oXoXxM.js → create-COQVXK6C.js} +22 -6
  120. package/dist/{create-DeQ5t8mZ.d.ts → create-Cn5EpEez.d.ts} +5 -5
  121. package/dist/{create-BsRcXm_m.d.ts → create-DHA0fhmi.d.ts} +7 -7
  122. package/dist/{create-BAMPoEga.js → create-nOWD3Joc.js} +3 -3
  123. package/dist/{credential-ke0KMQeB.js → credential-D9in5keC.js} +3 -3
  124. package/dist/{credentials-DOeqknte.js → credentials-B-hsgB4W.js} +1 -1
  125. package/dist/{credentials-BfzdL5kv.d.ts → credentials-COT-cjnP.d.ts} +3 -3
  126. package/dist/custom-role-rebuild-BK73tPib.js +181 -0
  127. package/dist/deciding-columns-DBZsrpdD.js +60 -0
  128. package/dist/deferred-sink-BZahJ8sO.js +34 -0
  129. package/dist/{define-permdock-CIxHBykk.js → define-permdock-D7aKxIax.js} +4 -4
  130. package/dist/{define-permdock-BLpQ0m95.d.ts → define-permdock-DBgwTFi1.d.ts} +6 -6
  131. package/dist/{delegation-BaUNCrE_.js → delegation-0DVVomzu.js} +3 -3
  132. package/dist/delivery/index.d.ts +4 -4
  133. package/dist/delivery/index.js +1 -1
  134. package/dist/{denied-text-D6JJTDr3.d.ts → denied-text-C_AWc0f0.d.ts} +2 -2
  135. package/dist/{describe-lAafaRQQ.d.ts → describe-AdETpWsn.d.ts} +2 -2
  136. package/dist/{diff-CXRZ6qPa.js → diff-COdwpP31.js} +7 -7
  137. package/dist/{diff-Cv9inVY5.js → diff-CW9eZy9X.js} +2 -2
  138. package/dist/{doctor-CQoP1264.js → doctor-ELj5hrVv.js} +17 -5
  139. package/dist/{doctor-Bn2BTr0N.js → doctor-ervtBRzG.js} +1624 -322
  140. package/dist/drizzle/index.d.ts +3 -3
  141. package/dist/edits-CqU8s2GC.js +69 -0
  142. package/dist/elysia/index.d.ts +5 -5
  143. package/dist/elysia/index.js +3 -3
  144. package/dist/{errors-DUJ7wLlE.d.ts → errors-COoiWqIs.d.ts} +1 -1
  145. package/dist/{evaluate-D8SdfP3h.js → evaluate-Dmd0bShm.js} +30 -31
  146. package/dist/{evaluations-BQkpE7hC.js → evaluations-DPEAu_jM.js} +2 -2
  147. package/dist/{evaluations-K9qglDP7.d.ts → evaluations-GW9j_ARq.d.ts} +3 -3
  148. package/dist/evaluator-COmATWCr.js +2 -0
  149. package/dist/{evaluator-eager-UuJK6NX_.js → evaluator-eager-CpVYslzY.js} +1 -1
  150. package/dist/eve/index.d.ts +18 -8
  151. package/dist/eve/index.js +13 -15
  152. package/dist/{execute-BLM5tpRU.js → execute-ix7AAdWg.js} +17 -41
  153. package/dist/explain-DRC9V5Qb.js +37 -0
  154. package/dist/explain-jg0KLCVt.js +74 -0
  155. package/dist/express/index.d.ts +5 -5
  156. package/dist/express/index.js +3 -3
  157. package/dist/fastify/index.d.ts +5 -5
  158. package/dist/fastify/index.js +3 -3
  159. package/dist/{fetch-adapter-gmTCu4FR.d.ts → fetch-adapter-CJncmsPg.d.ts} +4 -4
  160. package/dist/{fetch-adapter-ovZdSvlT.js → fetch-adapter-CU1DIkXu.js} +3 -3
  161. package/dist/{fields-CViS0EPC.js → fields-y_PSRCyJ.js} +3 -2
  162. package/dist/{fixtures-Bm0G0A7H.js → fixtures-3aUUP6Nx.js} +1 -1
  163. package/dist/flags-DQzNPxg1.js +204 -0
  164. package/dist/{from-snapshot-CCDF_ihX.js → from-snapshot-DGc9W4QU.js} +7 -7
  165. package/dist/{gen-02p5oEol.js → gen-8rW_AUG5.js} +16 -12
  166. package/dist/gen-BtiGMiuH.js +1 -0
  167. package/dist/{gen-kind-BMwPHJZ0.js → gen-kind-C9ikF8nb.js} +1 -1
  168. package/dist/{generate-BVcwnfoI.js → generate-BmpCt5oi.js} +4 -4
  169. package/dist/{generate-BtstB6iV.js → generate-CW7gNfLr.js} +244 -158
  170. package/dist/{generate-options-Yfh1pGyX.js → generate-options-DiR4r_sk.js} +18 -189
  171. package/dist/{grantee-BPUG6f0r.js → grantee-BSCdpIF3.js} +1 -1
  172. package/dist/{grantee-match-CFQ-LRcL.js → grantee-match-CJgQmcx4.js} +1 -1
  173. package/dist/h3/index.d.ts +4 -4
  174. package/dist/h3/index.js +3 -3
  175. package/dist/helper-calls-DHvgN9tr.js +106 -0
  176. package/dist/{helpers-DSmj6SHi.js → helpers-COh0lLc1.js} +2 -2
  177. package/dist/hono/index.d.ts +5 -5
  178. package/dist/hono/index.js +3 -3
  179. package/dist/{hook-sql-55514A9t.js → hook-sql-D-abRHut.js} +47 -225
  180. package/dist/{hosted-DUbuh0Td.d.ts → hosted-Bkw3Oyh-.d.ts} +1 -1
  181. package/dist/{hosted-DMJKJPoc.js → hosted-DZwCFrcy.js} +5 -5
  182. package/dist/{import-HzsIBAa5.js → import-BAhoTYTk.js} +1 -1
  183. package/dist/{import-Cm8kuezl.js → import-D_8tLF9g.js} +30 -46
  184. package/dist/{index-BSJoxaOi.d.ts → index-DPVeDtAO.d.ts} +5 -5
  185. package/dist/{index-D1msamx_.d.ts → index-DT3hOxA7.d.ts} +83 -14
  186. package/dist/{index-DegTwZxD.d.ts → index-DWmIuQLz.d.ts} +5 -5
  187. package/dist/{index-eaNHkELi.d.ts → index-Kj5S3IWE.d.ts} +6 -6
  188. package/dist/{index-O0qbI8Ha.d.ts → index-WOx7TBbj.d.ts} +2 -2
  189. package/dist/{index-D8A1d_Tt.d.ts → index-xShPsK8G.d.ts} +2 -2
  190. package/dist/index.d.ts +18 -18
  191. package/dist/index.js +25 -24
  192. package/dist/{init-DvsMFuau.js → init-DkRHIe8-.js} +4 -4
  193. package/dist/{init-BklKWywy.js → init-zxb0BVDJ.js} +1 -1
  194. package/dist/{instance-options-B4MD2wgl.d.ts → instance-options-DQCiBBuz.d.ts} +1 -1
  195. package/dist/{instance-snapshot-DdGOpSfN.js → instance-snapshot-D9kjL37B.js} +37 -20
  196. package/dist/{interactive-only-C_olBCPl.js → interactive-only-Dqww0ABO.js} +22 -14
  197. package/dist/jwt/index.d.ts +17 -13
  198. package/dist/jwt/index.js +14 -5
  199. package/dist/{kernel-Dn6pKMAF.js → kernel-C5akxw5n.js} +7 -7
  200. package/dist/keys-DQsHrgBM.js +42 -0
  201. package/dist/kysely/index.d.ts +3 -3
  202. package/dist/{lazy-provider-C48LDq0q.d.ts → lazy-provider-CMgFAGf8.d.ts} +1 -1
  203. package/dist/{lazy-provider-CVX534Kk.js → lazy-provider-DNVjY4n3.js} +2 -2
  204. package/dist/load-BCABUQZi.js +1 -0
  205. package/dist/{load-CZnlAyZ8.js → load-m7jmit3y.js} +1 -1
  206. package/dist/{login-CuUf-syI.js → login-C1p3gmj8.js} +1 -1
  207. package/dist/{login-BFvEcFnI.js → login-DOEZveP6.js} +4 -4
  208. package/dist/manager-chain-DdkiCw5q.js +243 -0
  209. package/dist/{manifest-BYzJF6xk.js → manifest-31igzVGQ.js} +70 -38
  210. package/dist/{manifest-Ct3eXbLR.js → manifest-B487A3po.js} +1 -1
  211. package/dist/{manifest-CRHphHxo.d.ts → manifest-DgsxeAsM.d.ts} +76 -0
  212. package/dist/{manifest-schema-Bp-eFhNZ.js → manifest-schema-D7RQbnGY.js} +90 -1
  213. package/dist/{map-error-DTi_JZT8.js → map-error-DYQbf-3Q.js} +1 -1
  214. package/dist/{may-use-Died1tNU.js → may-use-4HzzgYJ3.js} +3 -3
  215. package/dist/mcp/index.d.ts +9 -9
  216. package/dist/mcp/index.js +4 -4
  217. package/dist/{membership-filter-CSKH48eD.js → membership-filter-C7ZuhAqJ.js} +1 -1
  218. package/dist/{migrate-BcBFWFt9.js → migrate-pg-lkbDu.js} +4 -16
  219. package/dist/model-BXhr8gUI.js +329 -0
  220. package/dist/{module-values-Ddx0GLaJ.js → module-values-B09BBJIj.js} +3 -3
  221. package/dist/nest/index.d.ts +5 -5
  222. package/dist/nest/index.js +3 -3
  223. package/dist/next/index.d.ts +29 -12
  224. package/dist/next/index.js +24 -26
  225. package/dist/next/plugin.d.ts +1 -1
  226. package/dist/next/plugin.js +1 -1
  227. package/dist/node/index.d.ts +5 -5
  228. package/dist/node/index.js +2 -2
  229. package/dist/openai/index.d.ts +5 -5
  230. package/dist/openai/index.js +3 -3
  231. package/dist/openapi/index.d.ts +4 -4
  232. package/dist/openapi/index.js +3 -3
  233. package/dist/{openapi-BwZABlQO.js → openapi-BeMVHVY4.js} +6 -6
  234. package/dist/{openapi-D2dmyWZK.js → openapi-CZu6sVsP.js} +1 -1
  235. package/dist/{openapi-DNZv-nDu.js → openapi-DEGesHWH.js} +11 -4
  236. package/dist/{openapi-document-DoIe4MrZ.js → openapi-document-CEQ6jqqR.js} +1 -1
  237. package/dist/{operations-BS8ExH5A.d.ts → operations-DaEoGpMV.d.ts} +1 -1
  238. package/dist/{operations-De3F7tlf.js → operations-dJxcshJZ.js} +1 -1
  239. package/dist/{operations-B0yO77Zz.js → operations-id4vhwFN.js} +9 -3
  240. package/dist/orpc/index.d.ts +7 -7
  241. package/dist/orpc/index.js +4 -4
  242. package/dist/otel/index.d.ts +3 -3
  243. package/dist/{output-BI85V6hu.js → output-C7EPeSZj.js} +19 -2
  244. package/dist/{output-files-D5D-8-4l.js → output-files-8lfALMSU.js} +143 -11
  245. package/dist/output-files-DKWhL1IE.js +1 -0
  246. package/dist/{ownership-mprXkEHG.js → ownership-Csk9C3Js.js} +10 -6
  247. package/dist/{parse-nfHSt1Wy.js → parse-CUqZ_lLC.js} +1 -1
  248. package/dist/{parse-local-manifest-BGLWVchi.d.ts → parse-local-manifest-B92rFWnk.d.ts} +1 -1
  249. package/dist/pdp/index.d.ts +3 -3
  250. package/dist/pdp/index.js +2 -2
  251. package/dist/{permdock-Dz3yzWrp.d.ts → permdock-BShHM8OJ.d.ts} +11 -5
  252. package/dist/{permdock-BueSeg7X.js → permdock-CJPIwU1T.js} +102 -55
  253. package/dist/{permission-registry-DMYRZVcn.js → permission-registry-DstT40VS.js} +31 -1
  254. package/dist/{permissions-CQW3cr2S.js → permissions-DJ_QV9L7.js} +1 -1
  255. package/dist/{permissions-DWULToSb.d.ts → permissions-UyQD5nRN.d.ts} +1 -1
  256. package/dist/{permissions-Bj3DRIEi.js → permissions-wEkTVr_I.js} +3 -3
  257. package/dist/{pg-CA651850.js → pg-DmS5ITHu.js} +20 -1
  258. package/dist/pg-DtiDogUp.js +1 -0
  259. package/dist/{pipeline-Ct3YEKjx.js → pipeline-Bbu7uw28.js} +103 -32
  260. package/dist/{plugin-zOs9uqQj.d.ts → plugin-L3G7jPGE.d.ts} +15 -4
  261. package/dist/{policy-DFD2J5o_.js → policy-BBvhhH9X.js} +4 -4
  262. package/dist/{policy-C-Lzp3Zh.d.ts → policy-BUtwixSN.d.ts} +2 -2
  263. package/dist/{policy-DfvOwgtX.js → policy-CSOOQ3rR.js} +3 -3
  264. package/dist/{policy-bundle-pwhJJv2-.js → policy-bundle-KYI0EnrM.js} +3 -3
  265. package/dist/{policy-from-catalog-YKaTeaco.js → policy-from-catalog-_zwn1sNj.js} +12 -9
  266. package/dist/{policy-types-93NwI8iI.d.ts → policy-types-CfW4X_yX.d.ts} +155 -19
  267. package/dist/{postgrest-DyrYo_XT.d.ts → postgrest-PQ3zAOD2.d.ts} +2 -2
  268. package/dist/powersync-C1ix7CEY.js +1 -0
  269. package/dist/{powersync-D1Aog89p.js → powersync-CGvu6j5U.js} +2 -2
  270. package/dist/{powersync-CkoImqoq.js → powersync-CM6Vg4RH.js} +65 -24
  271. package/dist/prisma/index.d.ts +2 -2
  272. package/dist/program-CvarkLMS.js +10 -0
  273. package/dist/{protected-action-Dco5O_Kc.js → protected-action-BPN0NaRb.js} +1 -1
  274. package/dist/{protected-action-CEzNNtfi.d.ts → protected-action-DhCQ4bSe.d.ts} +6 -6
  275. package/dist/{provider-BYcoTKuS.js → provider-1xqxLVEz.js} +2 -2
  276. package/dist/{provider-1yWthvi5.js → provider-BV_v0JAY.js} +457 -116
  277. package/dist/{provider-C48LDq0q.d.ts → provider-CMgFAGf8.d.ts} +1 -1
  278. package/dist/{provider-store-Dq_olUjC.js → provider-store-Cf8HRNtb.js} +3 -3
  279. package/dist/{provider-with-fxHItxDh.js → provider-with-cpL9vRjC.js} +2 -2
  280. package/dist/prune-config-CdoPJIGz.js +209 -0
  281. package/dist/{pull-DD6YQ42X.js → pull-BaB401Bk.js} +4 -4
  282. package/dist/pull-Bp63vtgu.js +1 -0
  283. package/dist/{push-N-QI_ArC.js → push-DcjvEj0m.js} +5 -5
  284. package/dist/{pushed-policy-rpB6k77P.js → pushed-policy-DSjSWEAl.js} +1 -1
  285. package/dist/{pushed-policy-APjMbYdV.d.ts → pushed-policy-DcvO8NXy.d.ts} +1 -1
  286. package/dist/{conditions-ChE7zxJI.js → rbac-mblGDx-Z.js} +227 -6
  287. package/dist/react/index.d.ts +6 -6
  288. package/dist/react/index.js +3 -3
  289. package/dist/react/lazy.d.ts +6 -6
  290. package/dist/react/lazy.js +3 -3
  291. package/dist/react/provider-client-lazy.d.ts +1 -1
  292. package/dist/react/provider-client-lazy.js +1 -1
  293. package/dist/react/provider-client.d.ts +1 -1
  294. package/dist/react/provider-client.js +1 -1
  295. package/dist/react-native/index.d.ts +9 -9
  296. package/dist/react-native/index.js +8 -8
  297. package/dist/rename-BZNOV8H9.js +437 -0
  298. package/dist/replay-BCOZifwx.d.ts +3 -0
  299. package/dist/report-DCAiUc5U.js +1 -0
  300. package/dist/report-DievqWhf.js +368 -0
  301. package/dist/{request-context-CVJodWx8.js → request-context-BNVY3kZ1.js} +1 -1
  302. package/dist/resend/index.d.ts +4 -4
  303. package/dist/resolve-config-9NYYVc30.js +238 -0
  304. package/dist/{resolve-names-B0cqvJxo.js → resolve-names-Cth1UQ-8.js} +5 -5
  305. package/dist/{resolver-4qxIIHcC.js → resolver-CuIY8aFD.js} +48 -30
  306. package/dist/{retire-BNiXnbBR.js → retire-FN4aY6-n.js} +1 -1
  307. package/dist/{rls-oLdqutBO.js → rls-BtkZgaZp.js} +33 -5
  308. package/dist/{rls-c0Z9lbyp.js → rls-DUYok5e9.js} +231 -40
  309. package/dist/{rls-files-Dhtn_6LH.js → rls-files-ucAI0J5j.js} +3 -3
  310. package/dist/{rls-options-BZxfMDFo.d.ts → rls-options-BFGRmdcH.d.ts} +1 -1
  311. package/dist/{role-builder-DhsGEVq-.js → role-builder-BksM3Q9O.js} +3 -3
  312. package/dist/{roles-B29psCem.js → roles-BeNEhv7Q.js} +2 -2
  313. package/dist/{rpc-DjgxFbjK.d.ts → rpc-COnquydd.d.ts} +2 -2
  314. package/dist/{rpc-B-4IZOiU.js → rpc-D7G7IJDa.js} +1 -1
  315. package/dist/run-BjMxYYTe.js +1 -0
  316. package/dist/{run-DkviX16y.js → run-WIqPbnjD.js} +12 -11
  317. package/dist/{run-ticket-DXwrko2J.d.ts → run-ticket-Mmor5sYW.d.ts} +2 -2
  318. package/dist/{saas-CUwmgUB8.js → saas-DcqUkynn.js} +5 -5
  319. package/dist/{scan-CNhvy39j.js → scan-Badcllgg.js} +1 -1
  320. package/dist/{schema-BeY3croo.js → schema-D2OK4RrB.js} +1 -0
  321. package/dist/{schema-CwNjlLBx.js → schema-DBRKgQb4.js} +1 -1
  322. package/dist/schema-tables-Ba9LE_XB.js +185 -0
  323. package/dist/scim/index.d.ts +1 -1
  324. package/dist/seeds/index.d.ts +1 -1
  325. package/dist/seeds/index.js +1 -1
  326. package/dist/{seeds-BDTG7xl-.js → seeds-Bs44UDS3.js} +1 -1
  327. package/dist/{seeds-uG196Ev4.d.ts → seeds-Cih1ztkf.d.ts} +2 -2
  328. package/dist/server/index.d.ts +13 -12
  329. package/dist/server/index.js +7 -6
  330. package/dist/{server-Co9CYGqk.js → server-lohbasQd.js} +2 -2
  331. package/dist/{server-types-BrHOGAYx.d.ts → server-types-C2XX60aF.d.ts} +16 -9
  332. package/dist/shared-C6_T7QUo.js +76 -0
  333. package/dist/{sink-BD34OS8T.d.ts → sink-BQ_6K81r.d.ts} +4 -4
  334. package/dist/{size-BqLd5oJ4.js → size-l1pDHE2z.js} +28 -5
  335. package/dist/{skills-DrY6VdtH.js → skills-Ba9hHGO6.js} +2 -2
  336. package/dist/{skills-B74k44ml.js → skills-CTKq3o8D.js} +2 -2
  337. package/dist/{snapshot-DckMnHk8.js → snapshot-Ty0uk9wZ.js} +46 -12
  338. package/dist/{snapshot-cache-DoP3avLl.d.ts → snapshot-cache-DGvLQW0-.d.ts} +1 -1
  339. package/dist/snapshot-compact-yXFxZLPo.js +596 -0
  340. package/dist/{snapshot-empty-DZ6sZ83n.js → snapshot-empty-pKgPDcLd.js} +1 -1
  341. package/dist/{snapshot-evaluate-9RGy7J3N.js → snapshot-evaluate-DSNj2rhV.js} +5 -4
  342. package/dist/{snapshot-reads-D775amTL.js → snapshot-reads-BnAHiuoa.js} +2 -2
  343. package/dist/snapshot-requires-DfUqCLEb.js +122 -0
  344. package/dist/{snapshot-size-CHig-Nq_.js → snapshot-size-2fkXbCkP.js} +5 -15
  345. package/dist/snapshot-size-DNY1MTsV.js +1 -0
  346. package/dist/solid/index.d.ts +6 -6
  347. package/dist/solid/index.js +2 -2
  348. package/dist/solid-start/index.d.ts +6 -6
  349. package/dist/solid-start/index.js +3 -3
  350. package/dist/{sources-NQio1yFq.d.ts → sources-CjgZns7t.d.ts} +2 -2
  351. package/dist/{src-BAYcigFU.js → src-HRYn4UFj.js} +148 -15
  352. package/dist/ssf/index.d.ts +3 -3
  353. package/dist/ssf/index.js +1 -1
  354. package/dist/{standard-webhooks-B3MQihcP.d.ts → standard-webhooks-Bnnrqa6d.d.ts} +2 -2
  355. package/dist/{store-core-DyNo_BwA.d.ts → store-core-BdFcruPm.d.ts} +5 -5
  356. package/dist/{store-AH8bmaxW.js → store-n3yEN7dt.js} +2 -2
  357. package/dist/{store-options-BtHrfJUU.js → store-options-DpCQo0vB.js} +21 -12
  358. package/dist/{stores-DyFCruRC.d.ts → stores-D6MIjN_-.d.ts} +6 -6
  359. package/dist/{stores-BIMyclLg.js → stores-KpBCaY6c.js} +1 -1
  360. package/dist/{shared-Cwxy5N16.js → subject-CrldGifz.js} +1 -75
  361. package/dist/{subject-cache-BZeSj4Xf.d.ts → subject-cache-CnJcz2K_.d.ts} +14 -6
  362. package/dist/supabase/index.d.ts +9 -9
  363. package/dist/supabase/index.js +4 -4
  364. package/dist/supabase/middleware.d.ts +14 -7
  365. package/dist/supabase/middleware.js +17 -6
  366. package/dist/{supabase-CakrAxMg.js → supabase-CGiB83XQ.js} +2 -2
  367. package/dist/supabase-dir-0lxKbrYu.js +41 -0
  368. package/dist/supabase-hook-CluYxKee.js +2 -0
  369. package/dist/{supabase-hook-0q6ohTVN.js → supabase-hook-CqO_0Koh.js} +14 -9
  370. package/dist/{supabase-BzK3lplm.js → supabase-kWQlkrHw.js} +4 -4
  371. package/dist/{supabase-config-B2sDFiwy.js → supabase-schemas-BglbAG2Z.js} +223 -34
  372. package/dist/{supautils-DXzJ2E2Q.js → supautils-C85NuESf.js} +2 -2
  373. package/dist/{support-session-B8xrW28B.js → support-session-DpzcGTuV.js} +1 -1
  374. package/dist/svelte/index.d.ts +5 -5
  375. package/dist/svelte/index.js +3 -3
  376. package/dist/svelte/runtime.d.ts +3 -3
  377. package/dist/svelte/runtime.js +1 -1
  378. package/dist/svelte/source.d.ts +5 -5
  379. package/dist/svelte/source.js +2 -2
  380. package/dist/sveltekit/index.d.ts +6 -6
  381. package/dist/sveltekit/index.js +2 -2
  382. package/dist/table-reads-AnHPrBp8.js +517 -0
  383. package/dist/table-reads-BviGc0L_.js +1 -0
  384. package/dist/{tables-BDqfipr1.js → tables-CDq0HVVq.js} +82 -26
  385. package/dist/tanstack-start/index.d.ts +6 -6
  386. package/dist/tanstack-start/index.js +2 -2
  387. package/dist/tenant-check-D7g9oNVH.js +105 -0
  388. package/dist/tenant-from-path-AKTSY7uR.js +65 -0
  389. package/dist/tenant-from-path-Dq3jkqjh.d.ts +25 -0
  390. package/dist/terminal/index.d.ts +6 -6
  391. package/dist/terminal/index.js +4 -4
  392. package/dist/testing/core.d.ts +1 -1
  393. package/dist/testing/core.js +1 -1
  394. package/dist/testing/fixtures/index.d.ts +5 -5
  395. package/dist/testing/fixtures/index.js +67 -3
  396. package/dist/testing/index.d.ts +31 -30
  397. package/dist/testing/index.js +51 -45
  398. package/dist/testing/saas/index.d.ts +5 -5
  399. package/dist/testing/saas/index.js +2 -2
  400. package/dist/testing/saas/permissions.d.ts +1 -1
  401. package/dist/testing/saas/permissions.js +1 -1
  402. package/dist/trpc/index.d.ts +6 -6
  403. package/dist/trpc/index.js +3 -3
  404. package/dist/{type-helpers-DHCQEPj8.d.ts → type-helpers-CUmJFGV6.d.ts} +3 -3
  405. package/dist/{types-PS10T9UK.d.ts → types-BKnUwgvx.d.ts} +5 -5
  406. package/dist/{types-CQF-oYSz.d.ts → types-BRECeQ2n.d.ts} +4 -4
  407. package/dist/{types-OzSal_K_.d.ts → types-BhBfMdQ5.d.ts} +3 -3
  408. package/dist/{types-DONLJQjY.d.ts → types-BsRf5rKk.d.ts} +3 -3
  409. package/dist/{types-Cakw89Wx.d.ts → types-CIzXPPV-.d.ts} +2 -2
  410. package/dist/{types-CWmBZtQN.d.ts → types-CbJ5mxXv.d.ts} +7 -2
  411. package/dist/{types-4wjWMSFM.d.ts → types-CjZscT16.d.ts} +4 -4
  412. package/dist/{types-XSfi6ihL.d.ts → types-DwoRXDvN.d.ts} +2 -2
  413. package/dist/{types-config-Cq72dArb.d.ts → types-config-DNIw_Gt5.d.ts} +82 -17
  414. package/dist/{types-BFtFaI1W.d.ts → types-euUv1wsO.d.ts} +1 -1
  415. package/dist/{types-D3tjoLwT.d.ts → types-h9W3CNC_.d.ts} +5 -5
  416. package/dist/{types-run-DG1H5vrX.d.ts → types-run-Bwn1MuW0.d.ts} +1 -1
  417. package/dist/{types-BdNdMix7.d.ts → types-vKKndyxx.d.ts} +2 -2
  418. package/dist/unplugin/index.d.ts +1 -1
  419. package/dist/unplugin/index.js +1 -1
  420. package/dist/{usage-DEUKhZ1n.js → usage-CW6xhRcV.js} +7 -235
  421. package/dist/usage-Ci7Glu-H.js +1 -0
  422. package/dist/{usage-B-xheuEq.js → usage-n4V2k_a6.js} +2 -2
  423. package/dist/{validation-error-BAO1W1yk.d.ts → validation-error-P4Z9HUuP.d.ts} +1 -1
  424. package/dist/{verify-BgZapMKs.js → verify-CKzngsUH.js} +16 -104
  425. package/dist/{version-cache-BXkl7-Fz.js → version-cache-BzK8dwJy.js} +14 -10
  426. package/dist/{vocabulary-FYgI_NoI.d.ts → vocabulary-DHfKPIC5.d.ts} +7 -0
  427. package/dist/vue/index.d.ts +6 -6
  428. package/dist/vue/index.js +2 -2
  429. package/dist/{waiter-hYLJXA7r.d.ts → waiter-BqUxSRxq.d.ts} +2 -2
  430. package/dist/warm-5yxlUmBh.js +32 -0
  431. package/dist/warm-BR-mrnY-.d.ts +16 -0
  432. package/dist/{watch-Bz_iEKlB.js → watch-C12Ub7x4.js} +11 -14
  433. package/dist/{watch-BNxvqCS4.js → watch-D-5ztqN8.js} +2 -2
  434. package/dist/watch-J1PfGMfb.js +1 -0
  435. package/dist/webmcp/index.d.ts +2 -2
  436. package/dist/webmcp/index.js +2 -2
  437. package/dist/{who-can-rUSZfLvI.js → who-can-CGVpM3fZ.js} +3 -3
  438. package/dist/workflow/index.d.ts +3 -3
  439. package/dist/workflow/index.js +4 -4
  440. package/dist/workflow-sdk/index.d.ts +17 -5
  441. package/dist/workflow-sdk/index.js +3 -1
  442. package/dist/{wrap-D-KvhzaC.d.ts → wrap-D8WtzrB7.d.ts} +2 -2
  443. package/package.json +20 -16
  444. package/schemas/catalog-v2.json +6 -0
  445. package/schemas/snapshot-v2.json +557 -0
  446. package/schemas/supabase-manifest-v1.json +156 -15
  447. package/skills/permdock/SKILL.md +1 -1
  448. package/skills/permdock-agents/references/runtimes.md +1 -1
  449. package/skills/permdock-credentials/references/tokens-keys-links.md +1 -1
  450. package/skills/permdock-data/references/queries-and-rls.md +2 -2
  451. package/skills/permdock-tenancy/SKILL.md +4 -4
  452. package/skills/permdock-tenancy/references/ownership-and-custom-roles.md +1 -1
  453. package/dist/annotate-routes-BvSuEht3.js +0 -75
  454. package/dist/annotate-uZVGIRym.js +0 -25
  455. package/dist/better-supabase-DSbs4MtQ.js +0 -201
  456. package/dist/catalog-DCjJIl3n.js +0 -1
  457. package/dist/claims-size-DcjhvUv5.js +0 -58
  458. package/dist/codemod-Ob71iPQh.js +0 -35
  459. package/dist/collect-XcoQRyiA.js +0 -1
  460. package/dist/config-iyy90IOU.js +0 -143
  461. package/dist/deciding-columns-BnglEKqU.js +0 -143
  462. package/dist/evaluator-Dlhn2d7D.js +0 -2
  463. package/dist/flags-C0e-BzGW.js +0 -112
  464. package/dist/gen-C_RJoGZB.js +0 -1
  465. package/dist/grants-Dn6zwfqo.js +0 -139
  466. package/dist/load-BPzIqlGB.js +0 -1
  467. package/dist/model-B0rrUh6J.js +0 -188
  468. package/dist/output-files-aPXXhV4q.js +0 -1
  469. package/dist/powersync-f-6y8sCk.js +0 -1
  470. package/dist/pull-CT7wu2uo.js +0 -1
  471. package/dist/rbac-BJTUGJum.js +0 -90
  472. package/dist/replay-ClGIMp5p.d.ts +0 -3
  473. package/dist/run-DKUZT8Cc.js +0 -1
  474. package/dist/snapshot-compact-CwAop_6C.js +0 -119
  475. package/dist/snapshot-size-B_chu2c1.js +0 -1
  476. package/dist/supabase-hook-CcmjiBsh.js +0 -2
  477. package/dist/usage-BRjoZ-vo.js +0 -1
  478. package/dist/watch-CGLmIdld.js +0 -1
  479. package/schemas/snapshot-v1.json +0 -329
@@ -3,14 +3,18 @@ import { i as refuseDirty, t as applyFiles } from "./files-DuV7wRim.js";
3
3
  import { a as rel } from "./files-DAR51W3J.js";
4
4
  import { t as catalogFingerprint } from "./catalog-fingerprint-DAWZARy6.js";
5
5
  import { r as isRecord } from "./compact-C4LFuqbW.js";
6
- import { n as flagSpellings, o as GLOBAL_FLAGS } from "./args-Bc0HLiD4.js";
7
- import { c as generateFlags, f as policyFlag, i as dryRunFlag, r as dbUrlFlags, t as checkFlag } from "./flags-C0e-BzGW.js";
8
- import { n as ROOT } from "./manifest-BYzJF6xk.js";
9
- import { i as visitorKeyTypes, r as parseSync, t as createVisitor } from "./optional-CaQWp9HA.js";
6
+ import { n as flagSpellings, o as GLOBAL_FLAGS } from "./args-BSpXxMnb.js";
7
+ import { c as generateFlags, f as policyFlag, i as dryRunFlag, r as dbUrlFlags, t as checkFlag } from "./flags-DQzNPxg1.js";
8
+ import { n as ROOT } from "./manifest-31igzVGQ.js";
9
+ import { n as baselineText, r as parseBaseline } from "./baseline-file-BQoki1O_.js";
10
+ import { r as resolveConfigRoot, t as configProperty } from "./config-paths-CQvGng3k.js";
11
+ import { n as propertyKey, r as removeProperty, t as applyEditsStrict } from "./edits-CqU8s2GC.js";
12
+ import { a as nameOf, c as referencePlace, i as lineIndex, l as scopeBindings, n as bindingsCached, o as nodes, r as child, s as position, t as applyEdits, u as walk } from "./ast-CAOxvn9t.js";
13
+ import { r as parseSync, t as createVisitor } from "./optional-CaQWp9HA.js";
10
14
  import { n as defaultSqlCommand } from "./sql-T4GaBh9X.js";
11
15
  import { t as beforeFirst } from "./text-D704xHVl.js";
12
- import { readFileSync, readdirSync, statSync } from "node:fs";
13
- import { basename, extname, join, resolve } from "node:path";
16
+ import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
17
+ import { basename, dirname, extname, join, resolve } from "node:path";
14
18
  // src/cli/codemod/catalog-0.26.ts
15
19
  const LEGACY_MODE = /* @__PURE__ */ new Set([
16
20
  "any",
@@ -290,208 +294,210 @@ function rewriteCliCalls(text, options) {
290
294
  })
291
295
  };
292
296
  }
293
- // src/cli/codemod/ast.ts
294
- function nameOf(node) {
295
- if (node?.type === "Literal") return typeof node.value === "string" ? node.value : void 0;
296
- return node?.name;
297
- }
298
- const NOT_REFERENCES = /* @__PURE__ */ new Set([
299
- "ImportSpecifier",
300
- "ImportDefaultSpecifier",
301
- "ImportNamespaceSpecifier",
302
- "LabeledStatement",
303
- "BreakStatement",
304
- "ContinueStatement",
305
- "TSEnumMember",
306
- "TSModuleDeclaration",
307
- "TSTypeParameter"
308
- ]);
309
- const KEYED_MEMBERS = /* @__PURE__ */ new Set([
310
- "MethodDefinition",
311
- "PropertyDefinition",
312
- "AccessorProperty",
313
- "TSPropertySignature",
314
- "TSMethodSignature",
315
- "TSAbstractMethodDefinition",
316
- "TSAbstractPropertyDefinition"
317
- ]);
297
+ // src/cli/codemod/doctor-baseline-0.31.ts
298
+ const DEFAULT_BASELINE = "doctor-baseline.json";
318
299
  /**
319
- * How an identifier is read: a plain reference, a shorthand property value, the
320
- * local of an `export { }`, or not a reference.
300
+ * The JSON value of a literal: strings, numbers, booleans, `null`, arrays and
301
+ * objects with plain keys. `undefined` for anything the file computes.
321
302
  */
322
- function referencePlace(node, parent, ancestors) {
323
- const type = parent.type;
324
- if (node.type === "JSXIdentifier") return type === "JSXOpeningElement" || type === "JSXClosingElement" || type === "JSXMemberExpression" && parent.object === node ? "reference" : "none";
325
- if (type === "Property") {
326
- if (ancestors.at(-2)?.type === "ObjectPattern") return "none";
327
- if (parent.shorthand === true) return parent.value === node ? "shorthand" : "none";
328
- return parent.key === node && parent.computed !== true ? "none" : "reference";
329
- }
330
- if (type === "MemberExpression" || KEYED_MEMBERS.has(type)) return (type === "MemberExpression" ? parent.property : parent.key) === node && parent.computed !== true ? "none" : "reference";
331
- if (type === "ExportSpecifier") {
332
- const reexport = ancestors.at(-2)?.source !== null;
333
- return parent.local === node && !reexport ? "export" : "none";
303
+ function literalValue(node) {
304
+ if (node === null || node === void 0) return;
305
+ switch (node.type) {
306
+ case "Literal": return node.value;
307
+ case "TemplateLiteral": {
308
+ const quasis = nodes(Reflect.get(node, "quasis"));
309
+ if (nodes(Reflect.get(node, "expressions")).length > 0) return;
310
+ const value = quasis.length === 1 ? Reflect.get(quasis[0] ?? {}, "value") : void 0;
311
+ return isRecord(value) ? value["cooked"] : void 0;
312
+ }
313
+ case "ArrayExpression": {
314
+ const items = (node.elements ?? []).map((item) => literalValue(item));
315
+ return items.includes(void 0) ? void 0 : items;
316
+ }
317
+ case "ObjectExpression": {
318
+ const out = {};
319
+ for (const property of nodes(node.properties)) {
320
+ const key = property.type === "Property" && property.computed !== true ? nameOf(property.key) : void 0;
321
+ const value = literalValue(child(property, "value"));
322
+ if (key === void 0 || value === void 0) return;
323
+ out[key] = value;
324
+ }
325
+ return out;
326
+ }
327
+ case "TSAsExpression":
328
+ case "TSSatisfiesExpression":
329
+ case "ParenthesizedExpression": return literalValue(child(node, "expression"));
330
+ default: return;
334
331
  }
335
- if (type === "TSQualifiedName") return parent.right === node ? "none" : "reference";
336
- return NOT_REFERENCES.has(type) ? "none" : "reference";
337
- }
338
- function nodes(value) {
339
- return Array.isArray(value) ? value.filter(isNode) : [];
340
- }
341
- function isNode(value) {
342
- return typeof value === "object" && value !== null && !Array.isArray(value);
343
332
  }
333
+ const text = (value) => typeof value === "string" && value !== "";
344
334
  /**
345
- * A child node under a field `Estree` types as something else (`value`, a type
346
- * parameter's `name`).
335
+ * `doctor.waivers` entries `{ code: "PD017", key, reason }` as baseline
336
+ * entries.
347
337
  */
348
- function child(node, field) {
349
- const value = Reflect.get(node, field);
350
- return isNode(value) ? value : void 0;
351
- }
352
- function patternNames(pattern, into) {
353
- if (pattern === null || pattern === void 0) return;
354
- switch (pattern.type) {
355
- case "Identifier":
356
- into.add(pattern.name ?? "");
357
- return;
358
- case "ObjectPattern":
359
- for (const property of nodes(pattern.properties)) patternNames(property.type === "RestElement" ? property.argument : child(property, "value"), into);
360
- return;
361
- case "ArrayPattern":
362
- for (const element of nodes(pattern.elements)) patternNames(element, into);
363
- return;
364
- default: patternNames(pattern.left ?? pattern.argument ?? pattern.parameter, into);
365
- }
366
- }
367
- const DECLARATIONS_WITH_ID = /* @__PURE__ */ new Set([
368
- "FunctionDeclaration",
369
- "ClassDeclaration",
370
- "TSEnumDeclaration",
371
- "TSTypeAliasDeclaration",
372
- "TSInterfaceDeclaration",
373
- "TSModuleDeclaration",
374
- "TSImportEqualsDeclaration",
375
- "TSDeclareFunction"
376
- ]);
377
- function declareStatement(statement, into) {
378
- const type = statement.type;
379
- if (type === "VariableDeclaration") for (const declarator of nodes(statement.declarations)) patternNames(declarator.id, into);
380
- else if (DECLARATIONS_WITH_ID.has(type)) patternNames(statement.id, into);
381
- else if (statement.declaration !== null && statement.declaration !== void 0) declareStatement(statement.declaration, into);
382
- else if (type === "ImportDeclaration") for (const spec of nodes(statement.specifiers)) patternNames(spec.local, into);
383
- }
384
- const BLOCK_SCOPES = /* @__PURE__ */ new Set([
385
- "Program",
386
- "BlockStatement",
387
- "StaticBlock",
388
- "TSModuleBlock"
389
- ]);
390
- const FUNCTION_SCOPES = /* @__PURE__ */ new Set([
391
- "FunctionDeclaration",
392
- "FunctionExpression",
393
- "ArrowFunctionExpression",
394
- "TSDeclareFunction"
395
- ]);
338
+ function waiverEntries(value) {
339
+ if (!Array.isArray(value)) return {
340
+ kind: "unread",
341
+ why: "doctor.waivers is not a literal list"
342
+ };
343
+ const entries = [];
344
+ for (const item of value) {
345
+ if (!isRecord(item) || !text(item["code"]) || !text(item["key"])) return {
346
+ kind: "unread",
347
+ why: "a doctor.waivers entry has no code or key"
348
+ };
349
+ entries.push({
350
+ code: item["code"],
351
+ target: item["key"],
352
+ reason: typeof item["reason"] === "string" ? item["reason"] : ""
353
+ });
354
+ }
355
+ return {
356
+ kind: "entries",
357
+ entries
358
+ };
359
+ }
396
360
  /**
397
- * The names a node declares for the code inside it; `undefined` for a node that
398
- * opens no scope.
361
+ * `doctor.ignore` entries `{ id: "<code>:<target>", reason }` as baseline
362
+ * entries.
399
363
  */
400
- function scopeBindings(node) {
401
- const names = /* @__PURE__ */ new Set();
402
- const declare = (statements) => {
403
- for (const statement of statements) if (statement !== null && statement !== void 0) declareStatement(statement, names);
364
+ function ignoreEntries(value) {
365
+ if (!Array.isArray(value)) return {
366
+ kind: "unread",
367
+ why: "doctor.ignore is not a literal list"
404
368
  };
405
- const type = node.type;
406
- let opens = true;
407
- if (BLOCK_SCOPES.has(type)) declare(nodes(node.body));
408
- else if (FUNCTION_SCOPES.has(type)) {
409
- for (const param of nodes(node.params)) patternNames(param, names);
410
- patternNames(type === "FunctionExpression" ? node.id : void 0, names);
411
- } else if (type === "ClassExpression") patternNames(node.id, names);
412
- else if (type === "ForStatement") declare([node.init]);
413
- else if (type === "ForInStatement" || type === "ForOfStatement") declare([node.left]);
414
- else if (type === "CatchClause") patternNames(node.param, names);
415
- else if (type === "SwitchStatement") declare(nodes(node.cases).flatMap((branch) => nodes(branch.consequent)));
416
- else if (type === "TSMappedType") patternNames(node.key, names);
417
- else opens = false;
418
- for (const param of nodes(node.typeParameters?.params)) {
419
- opens = true;
420
- patternNames(child(param, "name"), names);
421
- }
422
- return opens ? names : void 0;
423
- }
424
- function bindingsCached(node, cache) {
425
- let found = cache.get(node);
426
- if (found === void 0) {
427
- found = scopeBindings(node) ?? null;
428
- cache.set(node, found);
369
+ const entries = [];
370
+ for (const item of value) {
371
+ const id = isRecord(item) ? item["id"] : void 0;
372
+ const colon = typeof id === "string" ? id.indexOf(":") : -1;
373
+ if (!isRecord(item) || typeof id !== "string" || colon <= 0) return {
374
+ kind: "unread",
375
+ why: "a doctor.ignore entry has no <code>:<target> id"
376
+ };
377
+ entries.push({
378
+ code: id.slice(0, colon),
379
+ target: id.slice(colon + 1),
380
+ reason: typeof item["reason"] === "string" ? item["reason"] : ""
381
+ });
429
382
  }
430
- return found;
431
- }
432
- function applyEdits(source, edits) {
433
- let out = source;
434
- for (const item of edits.toSorted((a, b) => b.start - a.start || b.end - a.end)) out = out.slice(0, item.start) + item.text + out.slice(item.end);
435
- return out;
436
- }
437
- function position(lineAt, index) {
438
- const { line, lineStart } = lineAt(index);
439
383
  return {
440
- line,
441
- column: index - lineStart + 1
384
+ kind: "entries",
385
+ entries
442
386
  };
443
387
  }
444
- function lineIndex(source) {
445
- const starts = [0];
446
- for (let i = 0; i < source.length; i += 1) if (source.charCodeAt(i) === 10) starts.push(i + 1);
447
- return (index) => {
448
- let low = 0;
449
- let high = starts.length - 1;
450
- while (low < high) {
451
- const mid = low + high + 1 >> 1;
452
- if ((starts[mid] ?? 0) <= index) low = mid;
453
- else high = mid - 1;
454
- }
455
- return {
456
- line: low + 1,
457
- lineStart: starts[low] ?? 0
458
- };
388
+ /**
389
+ * 0.31: `doctor.waivers` and `doctor.ignore` fold into the `doctor.baseline`
390
+ * file. The config loses both keys and gains `baseline` when it has none, and
391
+ * the entries land in the file it names, merged with what the file holds. A
392
+ * list the config computes, or a baseline path that is not a literal, is a
393
+ * follow-up and nothing changes.
394
+ */
395
+ function rewriteDoctorBaseline(file, source) {
396
+ const unchanged = {
397
+ source,
398
+ changes: [],
399
+ followUps: []
400
+ };
401
+ let found;
402
+ let baseline;
403
+ try {
404
+ const at = (key) => configProperty(file, source, ["doctor", key]);
405
+ const waivers = at("waivers");
406
+ const ignore = at("ignore");
407
+ found = [...waivers === void 0 ? [] : [{
408
+ ...waivers,
409
+ read: waiverEntries(literalValue(child(waivers.property, "value"))),
410
+ name: "doctor.waivers"
411
+ }], ...ignore === void 0 ? [] : [{
412
+ ...ignore,
413
+ read: ignoreEntries(literalValue(child(ignore.property, "value"))),
414
+ name: "doctor.ignore"
415
+ }]];
416
+ baseline = at("baseline");
417
+ } catch {
418
+ return unchanged;
419
+ }
420
+ const [first] = found;
421
+ if (first === void 0) return unchanged;
422
+ const lineAt = lineIndex(source);
423
+ const followUp = (at, name, message) => ({
424
+ source,
425
+ changes: [],
426
+ followUps: [{
427
+ ...position(lineAt, at.start),
428
+ name,
429
+ message
430
+ }]
431
+ });
432
+ for (const item of found) if (item.read.kind === "unread") return followUp(item.property, item.name, `${item.read.why}; move its entries into the doctor.baseline file by hand`);
433
+ const path = baseline === void 0 ? DEFAULT_BASELINE : literalValue(child(baseline.property, "value"));
434
+ if (typeof path !== "string" || path === "") return followUp(first.property, "doctor.baseline", "doctor.baseline is not a string literal; move doctor.waivers and doctor.ignore into its file by hand");
435
+ const entries = found.flatMap((item) => item.read.kind === "entries" ? item.read.entries : []);
436
+ const target = resolve(dirname(file), path);
437
+ let existing = [];
438
+ if (existsSync(target)) try {
439
+ existing = parseBaseline(readFileSync(target, "utf8"), path);
440
+ } catch (error) {
441
+ return followUp(first.property, "doctor.baseline", `${path} does not parse (${error instanceof Error ? error.message : String(error)}); merge doctor.waivers and doctor.ignore into it by hand`);
442
+ }
443
+ const edits = found.map((item, index) => index === 0 && baseline === void 0 && entries.length > 0 ? {
444
+ start: item.property.start,
445
+ end: item.property.end,
446
+ text: `baseline: ${JSON.stringify(path)}`
447
+ } : removeProperty(source, item.object, item.property));
448
+ const changes = found.map((item) => ({
449
+ ...position(lineAt, item.property.start),
450
+ from: item.name,
451
+ to: entries.length === 0 ? "" : `doctor.baseline (${path})`
452
+ }));
453
+ return {
454
+ source: applyEditsStrict(source, edits),
455
+ changes,
456
+ followUps: [],
457
+ ...entries.length === 0 ? {} : { files: [{
458
+ path: target,
459
+ text: baselineText([...existing, ...entries])
460
+ }] }
459
461
  };
460
462
  }
463
+ // src/cli/codemod/codemod-0.31.ts
464
+ /** The 0.31 config moves. Each entry moves one key path of `permdock.config.ts`. */
465
+ const CONFIG_MOVES = [];
461
466
  /**
462
- * Every node in source order with its parent and ancestors: Oxc nodes carry no
463
- * parent, so enter and exit keep a stack.
467
+ * The 0.31 rewrites, applied in order to every file after the config moves of
468
+ * the one before. Each returns the file unchanged when it has nothing to do.
464
469
  */
465
- function walk(program, visit) {
466
- const stack = [];
467
- const handlers = {};
468
- for (const type of visitorKeyTypes()) {
469
- handlers[type] = (node) => {
470
- visit(node, stack.at(-1), stack);
471
- stack.push(node);
472
- };
473
- handlers[`${type}:exit`] = () => {
474
- stack.pop();
475
- };
470
+ const REWRITES = [rewriteDoctorBaseline];
471
+ function rewrite031(file, source) {
472
+ let text = source;
473
+ const changes = [];
474
+ const followUps = [];
475
+ const files = [];
476
+ for (const rewrite of REWRITES) {
477
+ const result = rewrite(file, text);
478
+ text = result.source;
479
+ changes.push(...result.changes);
480
+ followUps.push(...result.followUps);
481
+ files.push(...result.files ?? []);
476
482
  }
477
- createVisitor(handlers).visit(program);
483
+ return {
484
+ source: text,
485
+ changes,
486
+ followUps,
487
+ files
488
+ };
478
489
  }
490
+ const CODEMOD_0_31 = Object.freeze({
491
+ renames: [],
492
+ signatures: [],
493
+ configMoves: CONFIG_MOVES,
494
+ literals: rewrite031
495
+ });
479
496
  // src/cli/codemod/config-moves.ts
480
497
  /** Passes over one file before the codemod stops; each pass moves one key. */
481
498
  const MAX_PASSES = 500;
482
- function unwrap(node) {
483
- if (node?.type === "TSSatisfiesExpression" || node?.type === "TSAsExpression" || node?.type === "ParenthesizedExpression") return unwrap(child(node, "expression"));
484
- if (node?.type === "CallExpression" && nameOf(node.callee) === "defineConfig") return unwrap(node.arguments?.[0]);
485
- return node;
486
- }
487
- function configRoots(program, file) {
488
- const roots = [];
489
- const isConfigFile = basename(file).startsWith("permdock.config.");
490
- walk(program, (node) => {
491
- const root = node.type === "CallExpression" && nameOf(node.callee) === "defineConfig" ? unwrap(node) : node.type === "ExportDefaultDeclaration" && isConfigFile ? unwrap(node.declaration) : void 0;
492
- if (root?.type === "ObjectExpression" && !roots.includes(root)) roots.push(root);
493
- });
494
- return roots;
499
+ function rootsOf(program, file) {
500
+ return resolveConfigRoot(program, { isConfigFile: basename(file).startsWith("permdock.config.") });
495
501
  }
496
502
  function keyOf(property) {
497
503
  return property.type === "Property" && property.computed !== true ? nameOf(property.key) : void 0;
@@ -619,7 +625,7 @@ function step(source, found, to) {
619
625
  * skipped from then on and reported once in `followUps`.
620
626
  */
621
627
  function nextEdits(program, file, source, moves, skipped, followUps) {
622
- for (const root of configRoots(program, file)) for (const move of moves) {
628
+ for (const root of rootsOf(program, file).roots) for (const move of moves) {
623
629
  const found = find(root, move, 0, [], skipped);
624
630
  if (found === void 0) continue;
625
631
  const result = step(source, found, concreteTarget(move, found.path));
@@ -647,6 +653,15 @@ function moveConfigKeys(file, original, moves) {
647
653
  const parsed = parseSync(file, source, { sourceType: "module" });
648
654
  if (parsed.errors.length > 0) break;
649
655
  const program = parsed.program;
656
+ if (pass === 0) for (const item of rootsOf(program, file).unresolved) {
657
+ const { line, column } = position(lineAt, item.at);
658
+ followUps.push({
659
+ line,
660
+ column,
661
+ name: basename(file),
662
+ message: item.why
663
+ });
664
+ }
650
665
  const applied = nextEdits(program, file, source, moves, skipped, followUps);
651
666
  if (applied === void 0) break;
652
667
  changes.push({
@@ -662,15 +677,63 @@ function moveConfigKeys(file, original, moves) {
662
677
  followUps
663
678
  };
664
679
  }
680
+ // src/cli/source/script-blocks.ts
681
+ /** The index of the `>` that ends the tag whose attributes start at `from`. */
682
+ function tagEnd(text, from) {
683
+ let quote;
684
+ for (let at = from; at < text.length; at += 1) {
685
+ const char = text[at];
686
+ if (quote !== void 0) {
687
+ if (char === quote) quote = void 0;
688
+ } else if (char === "\"" || char === "'") quote = char;
689
+ else if (char === ">") return at;
690
+ }
691
+ return -1;
692
+ }
693
+ function langOf$1(attributes) {
694
+ const value = /\blang\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/u.exec(attributes);
695
+ const lang = (value?.[1] ?? value?.[2] ?? value?.[3] ?? "").toLowerCase();
696
+ if (lang === "tsx") return "tsx";
697
+ return lang === "ts" || lang === "typescript" ? "ts" : "jsx";
698
+ }
699
+ /**
700
+ * The `<script>` blocks of a Vue or Svelte file. The tag scanner respects
701
+ * quoted attributes, so `generic="T extends Record<string, any>"` does not end
702
+ * the tag at its `>`.
703
+ */
704
+ function scriptBlocks(text) {
705
+ const blocks = [];
706
+ const open = /<script(?=[\s>])/giu;
707
+ let match = open.exec(text);
708
+ while (match !== null) {
709
+ const attributesFrom = match.index + match[0].length;
710
+ const end = tagEnd(text, attributesFrom);
711
+ if (end === -1) break;
712
+ const close = text.toLowerCase().indexOf("<\/script", end);
713
+ const stop = close === -1 ? text.length : close;
714
+ blocks.push({
715
+ code: text.slice(end + 1, stop),
716
+ offset: end + 1,
717
+ lang: langOf$1(text.slice(attributesFrom, end))
718
+ });
719
+ open.lastIndex = stop;
720
+ match = open.exec(text);
721
+ }
722
+ return blocks;
723
+ }
665
724
  // src/cli/codemod/rewrite-0.26.ts
666
725
  const ROW_CALL = /\bpermitted_([a-z][a-z0-9_]*)_row\s*\(/gu;
667
726
  const TEXT_BEFORE_HELPER = /::text(?=\s+in\s*\(\s*select\b[^)]{0,120}\b(?:permitted_|can_|member_|permdock_))/gu;
668
727
  const TEXT_AFTER_HELPER = /(\b(?:permitted_|can_|member_|permdock_)[a-z0-9_]*\s*\([^;]{0,200}?\))::text/gu;
669
728
  const OWN_SUBJECT = /\bown_subject\s*\(\s*\)/gu;
670
- const TABLE_OF = /(^[ \t]*)([A-Za-z_][A-Za-z0-9_]*)\s*:\s*\{\s*tableOf\s*:\s*(['"])([A-Za-z_][A-Za-z0-9_]*)\3\s*\},?[ \t]*\r?\n/gmu;
671
729
  const VERB_PREFIX = /^(read|list|get|create|duplicate|update|delete|remove|approve|reject|cancel|send|withdraw|confirm|fulfill|receive|reimburse|writeOff|mark|pause|resume)(?=[A-Z0-9_-])/u;
672
- const ACTION_LINE = /^([ \t]*)([A-Za-z_][A-Za-z0-9_]*)\s*:\s*(['"])(select|insert|update|delete)\3,?[ \t]*\r?\n/gmu;
673
- const PROPERTY = (key) => new RegExp(String.raw`(?<![A-Za-z0-9_])${key}\s*:`, "gu");
730
+ const SQL_COMMANDS = /* @__PURE__ */ new Set([
731
+ "select",
732
+ "insert",
733
+ "update",
734
+ "delete"
735
+ ]);
736
+ const CONFIG_FILE = /(?:^|\.)permdock\.config\.[cm]?[jt]sx?$/u;
674
737
  function change(from, to) {
675
738
  return {
676
739
  line: 1,
@@ -679,81 +742,45 @@ function change(from, to) {
679
742
  to
680
743
  };
681
744
  }
745
+ function followUp(name, message) {
746
+ return {
747
+ line: 1,
748
+ column: 0,
749
+ name,
750
+ message
751
+ };
752
+ }
753
+ /** The 0.26 SQL rewrites of one SQL text, with a change per rewrite kind. */
682
754
  function rewriteSql(source) {
683
- const changes = [];
684
- let text = source;
685
- if (text.match(ROW_CALL) !== null) {
686
- text = text.replaceAll(ROW_CALL, "can_$1(");
687
- changes.push(change("permitted_<resource>_row(", "can_<resource>("));
688
- }
689
- if (TEXT_BEFORE_HELPER.test(text) || TEXT_AFTER_HELPER.test(text)) {
690
- TEXT_BEFORE_HELPER.lastIndex = 0;
691
- TEXT_AFTER_HELPER.lastIndex = 0;
692
- text = text.replaceAll(TEXT_BEFORE_HELPER, "").replaceAll(TEXT_AFTER_HELPER, "$1");
693
- changes.push(change("::text", ""));
694
- }
695
- if (OWN_SUBJECT.test(text)) {
696
- OWN_SUBJECT.lastIndex = 0;
697
- text = text.replaceAll(OWN_SUBJECT, "");
698
- changes.push(change("own_subject()", ""));
755
+ const kinds = [];
756
+ let text = source.replaceAll(ROW_CALL, "can_$1(");
757
+ if (text !== source) kinds.push("row");
758
+ const typed = text.replaceAll(TEXT_BEFORE_HELPER, "").replaceAll(TEXT_AFTER_HELPER, "$1");
759
+ if (typed !== text) {
760
+ kinds.push("text");
761
+ text = typed;
762
+ }
763
+ const owned = text.replaceAll(OWN_SUBJECT, "");
764
+ if (owned !== text) {
765
+ kinds.push("own");
766
+ text = owned;
699
767
  }
700
768
  return {
701
769
  text,
702
- changes
770
+ kinds
703
771
  };
704
772
  }
705
- function ownerProperty(source, owner) {
706
- return new RegExp(String.raw`(^[ \t]*)${owner}\s*:\s*(\{[^}\n]*\}|(['"])[^'"\n]*\3),?`, "mu").exec(source);
707
- }
708
- function withAlso(property, child, owner) {
709
- const stringValue = new RegExp(String.raw`^([ \t]*)${owner}\s*:\s*(['"])([^'"\n]*)\2,?$`, "u").exec(property);
710
- if (stringValue !== null) {
711
- const indent = stringValue[1] ?? "";
712
- const quote = stringValue[2] ?? "\"";
713
- return `${indent}${owner}: { table: ${quote}${stringValue[3] ?? ""}${quote}, also: [${quote}${child}${quote}] },`;
714
- }
715
- if (property.includes("also:")) return property.replace(/also\s*:\s*\[([^\]]*)\]/u, (_match, list) => {
716
- const quote = property.includes("'") ? "'" : "\"";
717
- const item = `${quote}${child}${quote}`;
718
- const body = list.trim();
719
- return `also: [${body === "" ? item : `${body}, ${item}`}]`;
720
- });
721
- return property.replace(/\{\s*/u, (brace) => `${brace}also: ["${child}"], `);
722
- }
723
- function stringEnd(source, open) {
724
- const quote = source[open];
725
- for (let index = open + 1; index < source.length; index += 1) {
726
- if (source[index] === "\\") {
727
- index += 1;
728
- continue;
729
- }
730
- if (source[index] === quote) return index;
731
- }
732
- return source.length - 1;
733
- }
734
- function matchingClose(source, open) {
735
- const closeOf = {
736
- "{": "}",
737
- "[": "]",
738
- "(": ")"
739
- };
740
- const stack = [closeOf[source[open] ?? ""] ?? ""];
741
- for (let index = open + 1; index < source.length; index += 1) {
742
- const char = source[index] ?? "";
743
- if (char === "\"" || char === "'" || char === "`") {
744
- index = stringEnd(source, index);
745
- continue;
746
- }
747
- if (char === "{" || char === "[" || char === "(") {
748
- stack.push(closeOf[char] ?? "");
749
- continue;
750
- }
751
- if (char === stack.at(-1)) {
752
- stack.pop();
753
- if (stack.length === 0) return index;
754
- }
755
- }
756
- return source.length - 1;
773
+ const SQL_CHANGES = {
774
+ row: change("permitted_<resource>_row(", "can_<resource>("),
775
+ text: change("::text", ""),
776
+ own: change("own_subject()", "")
777
+ };
778
+ function sqlChanges(kinds) {
779
+ return [
780
+ "row",
781
+ "text",
782
+ "own"
783
+ ].filter((kind) => kinds.has(kind)).map((kind) => SQL_CHANGES[kind] ?? change(kind, ""));
757
784
  }
758
785
  function inferredOf(action) {
759
786
  const exact = defaultSqlCommand(action);
@@ -763,82 +790,36 @@ function inferredOf(action) {
763
790
  if (verb === "mark" || verb === "pause" || verb === "resume") return "update";
764
791
  return defaultSqlCommand(verb);
765
792
  }
766
- function withoutInferred(body) {
767
- const dropped = [];
768
- return {
769
- text: body.replaceAll(ACTION_LINE, (line, _indent, name, _quote, value) => {
770
- if (inferredOf(String(name)) !== value) return line;
771
- dropped.push(`${String(name)}: "${String(value)}"`);
772
- return "";
773
- }),
774
- dropped
775
- };
776
- }
777
- function dropInferredActions(source) {
778
- const pattern = /\bactions\s*:\s*\{/gu;
779
- let text = source;
780
- let cursor = 0;
781
- const dropped = [];
782
- while (cursor < text.length) {
783
- pattern.lastIndex = cursor;
784
- const match = pattern.exec(text);
785
- if (match === null) break;
786
- const open = text.indexOf("{", match.index);
787
- const close = matchingClose(text, open);
788
- const next = withoutInferred(text.slice(open + 1, close));
789
- if (next.dropped.length === 0) {
790
- cursor = close + 1;
791
- continue;
792
- }
793
- dropped.push(...next.dropped);
794
- text = text.slice(0, open + 1) + next.text + text.slice(close);
795
- cursor = open + 1;
796
- }
797
- return {
798
- text,
799
- dropped
800
- };
793
+ function segmentsOf$1(file, source) {
794
+ const extension = extname(file).slice(1).toLowerCase();
795
+ if (extension === "vue" || extension === "svelte") return scriptBlocks(source);
796
+ return [{
797
+ code: source,
798
+ offset: 0,
799
+ lang: extension === "tsx" ? "tsx" : [
800
+ "ts",
801
+ "mts",
802
+ "cts"
803
+ ].includes(extension) ? "ts" : "jsx"
804
+ }];
801
805
  }
802
- function insidePermissions(source, index) {
803
- let depth = 0;
804
- for (let cursor = index - 1; cursor >= 0; cursor -= 1) {
805
- const char = source[cursor];
806
- if (char === "}") depth += 1;
807
- else if (char === "{") {
808
- if (depth === 0) return /permissions\s*:\s*$/u.test(source.slice(0, cursor));
809
- depth -= 1;
810
- }
811
- }
812
- return false;
806
+ function stringValue(node) {
807
+ return node?.type === "Literal" && typeof node.value === "string" ? node.value : void 0;
813
808
  }
814
- function suppliedFollowUps(file, source) {
815
- const followUps = [];
816
- const keep = (name, message) => {
817
- followUps.push({
818
- line: 1,
819
- column: 0,
820
- name,
821
- message: `${file}: ${message}`
822
- });
809
+ /** The raw text between the delimiters of a string literal or template part. */
810
+ function rawRange(node) {
811
+ if (node.type === "Literal" && typeof node.value === "string") return {
812
+ start: node.start + 1,
813
+ end: node.end - 1
823
814
  };
824
- if (PROPERTY("roleThrough").test(source)) keep("roleThrough", "roleThrough is kept: the provider supplies it only for a membership source whose role reads through that table; delete it when permdock doctor reports it as PD094");
825
- const disabled = PROPERTY("disabled");
826
- for (let match = disabled.exec(source); match !== null; match = disabled.exec(source)) if (insidePermissions(source, match.index)) {
827
- keep("permissions.disabled", "blocks.permissions.disabled is kept: the provider fills it from rls.suspension only under blocks.permissions.model \"provider\", and only for an unset subject; delete it when permdock doctor reports it as PD094");
828
- break;
815
+ if (node.type === "TemplateElement") {
816
+ const raw = typeof node.value === "object" && node.value !== null ? Reflect.get(node.value, "raw") : void 0;
817
+ return typeof raw === "string" ? {
818
+ start: node.start + 1,
819
+ end: node.start + 1 + raw.length
820
+ } : void 0;
829
821
  }
830
- if (PROPERTY("canAssign").test(source) && source.includes("permdock_can_assign_any")) keep("canAssign", "canAssign naming permdock_can_assign_any is kept: the provider fills platformRoles.canAssign only for its own tenant scope, and another scope or a through.where narrows it; delete it when permdock doctor reports it as PD094");
831
- return followUps;
832
822
  }
833
- /**
834
- * 0.26 text rewrites: `permitted_<resource>_row(` becomes `can_<resource>(`,
835
- * `::text` around a helper call is removed, `own_subject()` is deleted, and `{
836
- * tableOf }` moves onto the owner's `also` list. Inferred `rls.actions` entries
837
- * are dropped. In a `better-supabase.config.*` file, `roleThrough`,
838
- * `permissions.disabled` and a `canAssign` that names `permdock_can_assign_any`
839
- * become follow-ups, because the provider supplies them only in some setups and
840
- * PD094 decides whether a value equals the provider's.
841
- */
842
823
  /** Old `permdock gen` file names (without extension) to the 0.26 names. */
843
824
  const GEN_FILES = {
844
825
  generated: "constants",
@@ -852,58 +833,261 @@ const GEN_FILES = {
852
833
  "svelte-stores": "svelte",
853
834
  messages: "messages"
854
835
  };
855
- const GEN_IMPORT = /(\bfrom\s*(['"]))((?:[^'"\n]*\/)?)permdock\.(generated|zod|valibot|arktype|factories|react|vue|solid|svelte-stores|schemas|messages)(\.[a-z]+)?\2/gu;
836
+ const GEN_IMPORT = /^((?:[^'"\n]*\/)?)permdock\.(generated|zod|valibot|arktype|factories|react|vue|solid|svelte-stores|schemas|messages)(\.[a-z]+)?$/u;
837
+ const MODULE_SOURCES = /* @__PURE__ */ new Set([
838
+ "ImportDeclaration",
839
+ "ExportNamedDeclaration",
840
+ "ExportAllDeclaration",
841
+ "ImportExpression"
842
+ ]);
856
843
  /**
857
844
  * An import of a generated file under its 0.25 name moves to the new name:
858
845
  * `permdock.generated.ts` is `constants.ts`, `permdock.schemas.ts` is
859
846
  * `standard-schema.ts` and `permdock.schemas.json` is `json-schema.json`.
860
847
  */
861
- function rewriteGenImports(source) {
862
- const changes = [];
848
+ function genImport(specifier) {
849
+ const match = GEN_IMPORT.exec(specifier);
850
+ if (match === null) return;
851
+ const [, dir = "", name = "", ext = ""] = match;
852
+ const next = name === "schemas" ? ext === ".json" ? "json-schema" : "standard-schema" : GEN_FILES[name] ?? name;
863
853
  return {
864
- text: source.replaceAll(GEN_IMPORT, (_whole, head, quote, dir, name, ext = "") => {
865
- const next = name === "schemas" ? ext === ".json" ? "json-schema" : "standard-schema" : GEN_FILES[name] ?? name;
866
- changes.push(change(`permdock.${name}${ext}`, `${next}${ext}`));
867
- return `${head}${dir}${next}${ext}${quote}`;
868
- }),
869
- changes
854
+ text: `${dir}${next}${ext}`,
855
+ change: change(`permdock.${name}${ext}`, `${next}${ext}`)
870
856
  };
871
857
  }
872
- function rewrite026(file, source) {
873
- const sql = rewriteSql(source);
874
- const followUps = [];
875
- let text = sql.text;
876
- const found = [...text.matchAll(TABLE_OF)];
877
- for (const match of found) {
878
- const child = match[2] ?? "";
879
- const owner = match[4] ?? "";
880
- text = text.replaceAll(match[0], "");
881
- const property = ownerProperty(text, owner);
882
- if (property === null) {
883
- followUps.push({
884
- line: 1,
885
- column: 0,
886
- name: "tableOf",
887
- message: `${file}: rls.tables.${child}.tableOf names ${owner}, which this file does not declare as a property the codemod can extend`
858
+ /** SQL rewrites inside string and template literals, and generated imports. */
859
+ function literalEdits(program, segment, into) {
860
+ const sources = /* @__PURE__ */ new Set();
861
+ walk(program, (node) => {
862
+ if (MODULE_SOURCES.has(node.type)) {
863
+ const source = node.source;
864
+ if (source !== null && source !== void 0) sources.add(source);
865
+ return;
866
+ }
867
+ const range = rawRange(node);
868
+ if (range === void 0) return;
869
+ const text = segment.code.slice(range.start, range.end);
870
+ const at = {
871
+ start: segment.offset + range.start,
872
+ end: segment.offset + range.end
873
+ };
874
+ if (sources.has(node)) {
875
+ const moved = genImport(text);
876
+ if (moved !== void 0) {
877
+ into.edits.push({
878
+ ...at,
879
+ text: moved.text
880
+ });
881
+ into.changes.push(moved.change);
882
+ }
883
+ return;
884
+ }
885
+ const sql = rewriteSql(text);
886
+ if (sql.kinds.length > 0) {
887
+ into.edits.push({
888
+ ...at,
889
+ text: sql.text
888
890
  });
891
+ for (const kind of sql.kinds) into.sqlKinds.add(kind);
892
+ }
893
+ });
894
+ }
895
+ /** The object literals that are a config root or sit inside one. */
896
+ function objectsUnder(program, roots) {
897
+ const found = [];
898
+ walk(program, (node, _parent, ancestors) => {
899
+ if (node.type === "ObjectExpression" && (roots.has(node) || ancestors.some((item) => roots.has(item)))) found.push(node);
900
+ });
901
+ return found;
902
+ }
903
+ /** The owner a `{ tableOf: "owner" }` value names, or `undefined`. */
904
+ function tableOfOwner(value) {
905
+ const properties = nodes(value?.properties);
906
+ const only = properties[0];
907
+ if (value?.type !== "ObjectExpression" || properties.length !== 1 || only === void 0 || propertyKey(only) !== "tableOf") return;
908
+ return stringValue(child(only, "value"));
909
+ }
910
+ function quoteOf(raw) {
911
+ return raw?.startsWith("'") === true ? "'" : "\"";
912
+ }
913
+ /** The edit that lists `children` on the owner's `also`, or `undefined`. */
914
+ function alsoEdit(code, value, children) {
915
+ if (value === void 0) return;
916
+ const raw = (node) => node === void 0 ? void 0 : code.slice(node.start, node.end);
917
+ const listed = (quote) => children.map((name) => `${quote}${name}${quote}`).join(", ");
918
+ if (stringValue(value) !== void 0) {
919
+ const table = raw(value) ?? "\"\"";
920
+ return {
921
+ start: value.start,
922
+ end: value.end,
923
+ text: `{ table: ${table}, also: [${listed(quoteOf(table))}] }`
924
+ };
925
+ }
926
+ if (value.type !== "ObjectExpression") return;
927
+ const properties = nodes(value.properties);
928
+ const table = properties.find((item) => propertyKey(item) === "table");
929
+ const tableQuote = quoteOf(raw(child(table ?? value, "value")));
930
+ const also = child(properties.find((item) => propertyKey(item) === "also") ?? value, "value");
931
+ if (also?.type === "ArrayExpression") {
932
+ const elements = nodes(also.elements);
933
+ const last = elements.at(-1);
934
+ if (last === void 0) return {
935
+ start: also.start,
936
+ end: also.end,
937
+ text: `[${listed(tableQuote)}]`
938
+ };
939
+ const quote = quoteOf(raw(elements[0]));
940
+ return {
941
+ start: last.end,
942
+ end: last.end,
943
+ text: `, ${listed(quote)}`
944
+ };
945
+ }
946
+ if (properties.length === 0) return {
947
+ start: value.start,
948
+ end: value.end,
949
+ text: `{ also: [${listed(tableQuote)}] }`
950
+ };
951
+ return {
952
+ start: value.start + 1,
953
+ end: value.start + 1,
954
+ text: ` also: [${listed(tableQuote)}],`
955
+ };
956
+ }
957
+ /** `{ tableOf }` entries of one object move onto their owner's `also` list. */
958
+ function tableOfEdits(file, code, object, into) {
959
+ const byOwner = /* @__PURE__ */ new Map();
960
+ const properties = nodes(object.properties);
961
+ for (const property of properties) {
962
+ const name = propertyKey(property);
963
+ const owner = tableOfOwner(child(property, "value"));
964
+ if (name === void 0 || owner === void 0) continue;
965
+ into.edits.push(removeProperty(code, object, property));
966
+ byOwner.set(owner, [...byOwner.get(owner) ?? [], name]);
967
+ }
968
+ for (const [owner, children] of byOwner) {
969
+ const property = properties.find((item) => propertyKey(item) === owner);
970
+ const edit = alsoEdit(code, property === void 0 ? void 0 : child(property, "value"), children);
971
+ if (edit === void 0) {
972
+ for (const name of children) into.followUps.push(followUp("tableOf", `${file}: rls.tables.${name}.tableOf names ${owner}, which this file does not declare as a property the codemod can extend`));
889
973
  continue;
890
974
  }
891
- text = text.replaceAll(property[0], withAlso(property[0], child, owner));
975
+ into.edits.push(edit);
976
+ }
977
+ return byOwner.size > 0;
978
+ }
979
+ /** Inferred `rls.actions` entries of one `rls` object are dropped. */
980
+ function actionEdits(code, rls, into) {
981
+ const actions = child(nodes(rls.properties).find((item) => propertyKey(item) === "actions") ?? rls, "value");
982
+ if (actions?.type !== "ObjectExpression") return;
983
+ for (const property of nodes(actions.properties)) {
984
+ const name = propertyKey(property);
985
+ const value = stringValue(child(property, "value"));
986
+ if (name === void 0 || value === void 0 || !SQL_COMMANDS.has(value) || inferredOf(name) !== value) continue;
987
+ into.edits.push(removeProperty(code, actions, property));
988
+ into.changes.push(change(`rls.actions ${name}: "${value}"`, "inferred"));
989
+ }
990
+ }
991
+ function configEdits(file, program, segment, into) {
992
+ const shifted = (from) => {
993
+ for (let index = from; index < into.edits.length; index += 1) {
994
+ const edit = into.edits[index];
995
+ if (edit !== void 0) into.edits[index] = {
996
+ start: edit.start + segment.offset,
997
+ end: edit.end + segment.offset,
998
+ text: edit.text
999
+ };
1000
+ }
1001
+ };
1002
+ const roots = new Set(resolveConfigRoot(program, { isConfigFile: CONFIG_FILE.test(basename(file)) }).roots);
1003
+ const first = into.edits.length;
1004
+ let moved = false;
1005
+ for (const object of objectsUnder(program, roots)) {
1006
+ moved = tableOfEdits(file, segment.code, object, into) || moved;
1007
+ const rls = child(nodes(object.properties).find((item) => propertyKey(item) === "rls") ?? object, "value");
1008
+ if (rls?.type === "ObjectExpression" && rls !== object) actionEdits(segment.code, rls, into);
892
1009
  }
893
- const gen = rewriteGenImports(text);
894
- text = gen.text;
895
- const changes = [...sql.changes, ...gen.changes];
896
- if (gen.changes.length > 0) followUps.push({
897
- line: 1,
898
- column: 0,
899
- name: "gen",
900
- message: `${file}: the generated files moved; rename topics.<x> to <x>Topic, paths.<x> to <x>Path, sqlNames.* to the per-helper exports in sql.ts, factories.<x> to <x>Factory, and scopes and roles to scopeNames and roleNames`
1010
+ shifted(first);
1011
+ if (moved) into.changes.push(change("tableOf", "also"));
1012
+ }
1013
+ /**
1014
+ * In a `better-supabase.config.*` file, `roleThrough`, `permissions.disabled`
1015
+ * and a `canAssign` that names `permdock_can_assign_any` become follow-ups,
1016
+ * because the provider supplies them only in some setups and PD094 decides
1017
+ * whether a value equals the provider's.
1018
+ */
1019
+ function suppliedFollowUps(file, program) {
1020
+ let roleThrough = false;
1021
+ let disabled = false;
1022
+ let canAssign = false;
1023
+ walk(program, (node, parent, ancestors) => {
1024
+ const key = propertyKey(node);
1025
+ if (key === "roleThrough") roleThrough = true;
1026
+ else if (key === "disabled") {
1027
+ const holder = ancestors.at(-2);
1028
+ disabled ||= parent?.type === "ObjectExpression" && holder !== void 0 && propertyKey(holder) === "permissions";
1029
+ } else if (key === "canAssign") canAssign ||= stringValue(child(node, "value"))?.includes("permdock_can_assign_any") === true;
901
1030
  });
902
- if (found.length > 0) changes.push(change("tableOf", "also"));
903
- const actions = dropInferredActions(text);
904
- text = actions.text;
905
- for (const entry of actions.dropped) changes.push(change(`rls.actions ${entry}`, "inferred"));
906
- if (file.includes("better-supabase.config.")) followUps.push(...suppliedFollowUps(file, text));
1031
+ const found = [];
1032
+ if (roleThrough) found.push(followUp("roleThrough", `${file}: roleThrough is kept: the provider supplies it only for a membership source whose role reads through that table; delete it when permdock doctor reports it as PD094`));
1033
+ if (disabled) found.push(followUp("permissions.disabled", `${file}: blocks.permissions.disabled is kept: the provider fills it from rls.suspension only under blocks.permissions.model "provider", and only for an unset subject; delete it when permdock doctor reports it as PD094`));
1034
+ if (canAssign) found.push(followUp("canAssign", `${file}: canAssign naming permdock_can_assign_any is kept: the provider fills platformRoles.canAssign at the 'global' scope, with a through.where only from rls.customRoleWrites.roles.globalScope; delete it when permdock doctor reports it as PD094`));
1035
+ return found;
1036
+ }
1037
+ /**
1038
+ * 0.26 rewrites. In a `.sql` file and inside string and template literals,
1039
+ * `permitted_<resource>_row(` becomes `can_<resource>(`, `::text` around a
1040
+ * helper call is removed and `own_subject()` is deleted. In a config object, `{
1041
+ * tableOf }` moves onto the owner's `also` list and inferred `rls.actions`
1042
+ * entries are dropped. Imports of the old generated files move to the new
1043
+ * names.
1044
+ */
1045
+ function rewrite026(file, source) {
1046
+ if (extname(file) === ".sql") {
1047
+ const sql = rewriteSql(source);
1048
+ return {
1049
+ source: sql.text,
1050
+ changes: sqlChanges(new Set(sql.kinds)),
1051
+ followUps: []
1052
+ };
1053
+ }
1054
+ const into = {
1055
+ edits: [],
1056
+ changes: [],
1057
+ followUps: [],
1058
+ sqlKinds: /* @__PURE__ */ new Set()
1059
+ };
1060
+ const programs = [];
1061
+ for (const segment of segmentsOf$1(file, source)) {
1062
+ const parsed = parseSync(`segment.${segment.lang}`, segment.code, {
1063
+ lang: segment.lang,
1064
+ sourceType: "module"
1065
+ });
1066
+ if (parsed.errors.length > 0) return {
1067
+ source,
1068
+ changes: [],
1069
+ followUps: []
1070
+ };
1071
+ const program = parsed.program;
1072
+ programs.push(program);
1073
+ literalEdits(program, segment, into);
1074
+ configEdits(file, program, segment, into);
1075
+ }
1076
+ let text;
1077
+ try {
1078
+ text = applyEditsStrict(source, into.edits);
1079
+ } catch (error) {
1080
+ if (!(error instanceof RangeError)) throw error;
1081
+ return {
1082
+ source,
1083
+ changes: [],
1084
+ followUps: [followUp("0.26", `${file}: left as it is: ${error.message}`)]
1085
+ };
1086
+ }
1087
+ const changes = [...sqlChanges(into.sqlKinds), ...into.changes];
1088
+ const followUps = [...into.followUps];
1089
+ if (changes.some((item) => item.from.startsWith("permdock."))) followUps.push(followUp("gen", `${file}: the generated files moved; rename topics.<x> to <x>Topic, paths.<x> to <x>Path, sqlNames.* to the per-helper exports in sql.ts, factories.<x> to <x>Factory, and scopes and roles to scopeNames and roleNames`));
1090
+ if (file.includes("better-supabase.config.")) followUps.push(...programs.flatMap((program) => suppliedFollowUps(file, program)));
907
1091
  return {
908
1092
  source: text,
909
1093
  changes,
@@ -1111,8 +1295,6 @@ function rewriteLiterals017(file, source) {
1111
1295
  };
1112
1296
  }
1113
1297
  // src/cli/codemod/context.ts
1114
- /** One version's rename map: what the codemod rewrites and what it only reports. */
1115
- const SCRIPT_BLOCK = /<script\b([^>]*)>([\s\S]*?)<\/script>/gu;
1116
1298
  function isPermDockSpecifier(value) {
1117
1299
  return typeof value === "string" && (value === "permdock" || value.startsWith("permdock/"));
1118
1300
  }
@@ -1285,7 +1467,8 @@ function addImport(ctx, entry, names, gone) {
1285
1467
  function templateHints(file, source, set, components, lineAt) {
1286
1468
  const hints = (set.templates ?? []).filter((hint) => hint.entries.some((entry) => components.has(`${entry} ${hint.component}`)));
1287
1469
  if (hints.length === 0 || !/\.(?:vue|svelte)$/iu.test(file)) return [];
1288
- const markup = source.replaceAll(SCRIPT_BLOCK, (block) => " ".repeat(block.length));
1470
+ let markup = source;
1471
+ for (const block of scriptBlocks(source)) markup = markup.slice(0, block.offset) + " ".repeat(block.code.length) + markup.slice(block.offset + block.code.length);
1289
1472
  return hints.flatMap((hint) => [...markup.matchAll(hint.pattern)].map((match) => {
1290
1473
  const { line, column } = position(lineAt, match.index);
1291
1474
  return {
@@ -1623,16 +1806,12 @@ function byPosition(a, b) {
1623
1806
  }
1624
1807
  function segmentsOf(file, source) {
1625
1808
  const extension = file.slice(file.lastIndexOf(".") + 1).toLowerCase();
1626
- if (extension === "vue" || extension === "svelte") return [...source.matchAll(SCRIPT_BLOCK)].map((match) => {
1627
- const [whole, attributes = "", code = ""] = match;
1628
- const typed = /\blang=["']?(?:ts|typescript)\b/u.test(attributes);
1629
- return {
1630
- code,
1631
- offset: match.index + whole.indexOf(">") + 1,
1632
- lang: typed ? "ts" : "jsx",
1633
- keepLocals: true
1634
- };
1635
- });
1809
+ if (extension === "vue" || extension === "svelte") return scriptBlocks(source).map((block) => ({
1810
+ code: block.code,
1811
+ offset: block.offset,
1812
+ lang: block.lang,
1813
+ keepLocals: true
1814
+ }));
1636
1815
  return [{
1637
1816
  code: source,
1638
1817
  offset: 0,
@@ -1943,10 +2122,17 @@ const CODEMOD_0_26 = Object.freeze({
1943
2122
  /** Each codemod version and the rename map it applies. */
1944
2123
  const CODEMODS = Object.freeze({
1945
2124
  "0.17": CODEMOD_0_17,
1946
- "0.26": CODEMOD_0_26
2125
+ "0.26": CODEMOD_0_26,
2126
+ "0.31": CODEMOD_0_31
1947
2127
  });
1948
2128
  function codemodVersions() {
1949
- return Object.keys(CODEMODS);
2129
+ return [
2130
+ ...Object.keys(CODEMODS),
2131
+ "config",
2132
+ "manager-chain",
2133
+ "bsb-access-tags",
2134
+ "bsb-action-keys"
2135
+ ];
1950
2136
  }
1951
2137
  const EXTENSIONS = /* @__PURE__ */ new Set([
1952
2138
  ".ts",
@@ -2028,7 +2214,7 @@ function codemod(options) {
2028
2214
  }
2029
2215
  if (!source.includes("permdock") && !basename(file).startsWith("permdock.config.")) continue;
2030
2216
  const name = rel(options.cwd, file);
2031
- const result = isCodeFile(file) ? withConfigMoves(file, withLiterals(file, transformSource(file, source, set), set), set) : cliResult(file, source);
2217
+ const result = isCodeFile(file) ? withConfigMoves(file, withLiterals(file, transformSource(file, source, set), set), set) : extname(file) === ".sql" ? sqlResult(file, source, set) : cliResult(file, source);
2032
2218
  if (result.error !== void 0) {
2033
2219
  followUps.push({
2034
2220
  file: name,
@@ -2048,6 +2234,18 @@ function codemod(options) {
2048
2234
  path: file,
2049
2235
  text: result.source
2050
2236
  });
2237
+ for (const created of result.files ?? []) {
2238
+ changed.push({
2239
+ file: rel(options.cwd, created.path),
2240
+ changes: [{
2241
+ line: 1,
2242
+ column: 1,
2243
+ from: name,
2244
+ to: "created"
2245
+ }]
2246
+ });
2247
+ writes.push(created);
2248
+ }
2051
2249
  }
2052
2250
  for (const followUp of result.followUps) followUps.push({
2053
2251
  file: name,
@@ -2082,21 +2280,47 @@ function withLiterals(file, result, set) {
2082
2280
  return {
2083
2281
  source: rewritten.source,
2084
2282
  changes: [...result.changes, ...rewritten.changes],
2085
- followUps: [...result.followUps, ...rewritten.followUps]
2283
+ followUps: [...result.followUps, ...rewritten.followUps],
2284
+ ...rewritten.files === void 0 ? {} : { files: rewritten.files }
2285
+ };
2286
+ }
2287
+ /** Directories of versioned migrations, which are history and never edited. */
2288
+ const MIGRATION_SEGMENTS = /* @__PURE__ */ new Set(["migrations", "drizzle"]);
2289
+ function sqlResult(file, source, set) {
2290
+ if (set.literals === void 0) return {
2291
+ source,
2292
+ changes: [],
2293
+ followUps: []
2294
+ };
2295
+ const rewritten = set.literals(file, source);
2296
+ if (rewritten.changes.length === 0 || !file.split(/[\\/]/u).some((segment) => MIGRATION_SEGMENTS.has(segment))) return rewritten;
2297
+ return {
2298
+ source,
2299
+ changes: [],
2300
+ followUps: rewritten.changes.map((item) => ({
2301
+ line: item.line,
2302
+ column: item.column,
2303
+ name: "migration",
2304
+ message: `a versioned migration is not edited: write a new migration for ${item.from} → ${item.to === "" ? "removed" : item.to}`
2305
+ }))
2086
2306
  };
2087
2307
  }
2088
2308
  function withConfigMoves(file, result, set) {
2089
2309
  if (result.error !== void 0 || set.configMoves === void 0) return result;
2090
2310
  const moved = moveConfigKeys(file, result.source, set.configMoves);
2091
2311
  return {
2312
+ ...result,
2092
2313
  source: moved.source,
2093
2314
  changes: [...result.changes, ...moved.changes],
2094
2315
  followUps: [...result.followUps, ...moved.followUps]
2095
2316
  };
2096
2317
  }
2318
+ /** Names an earlier build of this release used for a codemod. */
2319
+ const CODEMOD_ALIASES = Object.freeze({ "0.32": "0.31" });
2097
2320
  function normaliseVersion(version) {
2098
2321
  if (version === void 0) throw new CliError("usage", `codemod needs a version: permdock codemod <version>. Supported: ${Object.keys(CODEMODS).join(", ")}.`);
2099
- return /^v?(\d+\.\d+)(?:\.\d+)?$/u.exec(version)?.[1] ?? version;
2322
+ const name = /^v?(\d+\.\d+)(?:\.\d+)?$/u.exec(version)?.[1] ?? version;
2323
+ return Object.hasOwn(CODEMOD_ALIASES, name) ? CODEMOD_ALIASES[name] ?? name : name;
2100
2324
  }
2101
2325
  function isCodeFile(file) {
2102
2326
  return EXTENSIONS.has(extname(file));
@@ -2122,23 +2346,23 @@ function cliResult(file, source) {
2122
2346
  })), ...result.followUps]
2123
2347
  };
2124
2348
  }
2125
- function sourceFiles(cwd, paths, cli, catalogs) {
2349
+ function sourceFiles(cwd, paths, cli, v026) {
2126
2350
  const out = /* @__PURE__ */ new Set();
2127
2351
  for (const path of paths) {
2128
2352
  const root = resolve(cwd, path);
2129
2353
  const stats = statSync(root, { throwIfNoEntry: false });
2130
2354
  if (stats === void 0) throw new CliError("usage", `not found: ${path}`);
2131
2355
  if (stats.isFile()) out.add(root);
2132
- else walkDir(root, out, cli, catalogs);
2356
+ else walkDir(root, out, cli, v026);
2133
2357
  }
2134
2358
  return [...out].toSorted();
2135
2359
  }
2136
- function walkDir(dir, out, cli, catalogs) {
2360
+ function walkDir(dir, out, cli, v026) {
2137
2361
  for (const name of readdirSync(dir)) {
2138
2362
  if (SKIP_DIRS.has(name)) continue;
2139
2363
  const full = join(dir, name);
2140
- if (statSync(full).isDirectory()) walkDir(full, out, cli, catalogs);
2141
- else if (EXTENSIONS.has(extname(name)) || cli && isCliFile(name) || catalogs && extname(name) === ".json") out.add(full);
2364
+ if (statSync(full).isDirectory()) walkDir(full, out, cli, v026);
2365
+ else if (EXTENSIONS.has(extname(name)) || cli && isCliFile(name) || v026 && (extname(name) === ".json" || extname(name) === ".sql")) out.add(full);
2142
2366
  }
2143
2367
  }
2144
2368
  function formatReport(report) {