permdock 0.29.0 → 0.31.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.
- package/README.md +2 -2
- package/dist/a2a/index.d.ts +5 -5
- package/dist/a2a/index.js +2 -2
- package/dist/{adoption-scan-obbSy73c.js → adoption-scan-9brJ_mUG.js} +1 -1
- package/dist/agent/index.d.ts +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/ai-sdk/index.d.ts +4 -4
- package/dist/ai-sdk/index.js +3 -3
- package/dist/annotate-dUrBHXWa.js +183 -0
- package/dist/{annotate-doc-BCOCOrq_.js → annotate-doc-BA0betEO.js} +5 -4
- package/dist/annotate-routes-CGJy1ojp.js +30 -0
- package/dist/app/index.d.ts +1 -1
- package/dist/app/index.js +1 -1
- package/dist/app-peer-BnMh5lqz.js +27 -0
- package/dist/approval-chain-D97rgMoA.js +431 -0
- package/dist/{approval-normalize-Cpp8R0rY.js → approval-normalize-C6je8vWN.js} +1 -1
- package/dist/{approval-prompt-C-vjNZyd.d.ts → approval-prompt-yNyhQqn8.d.ts} +2 -2
- package/dist/approvals/index.d.ts +3 -3
- package/dist/approvals/index.js +3 -3
- package/dist/{approvals-7jHYXocE.js → approvals-Bt5IQ4wR.js} +3 -3
- package/dist/{arazzo-D9Fv_ZEV.js → arazzo-C0bltfjv.js} +2 -2
- package/dist/{arazzo-rxj2pNN3.js → arazzo-Cs-3yoxR.js} +3 -3
- package/dist/{args-Bc0HLiD4.js → args-BSpXxMnb.js} +2 -1
- package/dist/ast-CAOxvn9t.js +188 -0
- package/dist/ast-Dnm2TOHN.js +434 -0
- package/dist/astro/index.d.ts +6 -6
- package/dist/astro/index.js +2 -2
- package/dist/{audience-DauhRBNg.js → audience-CARf-b-R.js} +1 -1
- package/dist/authzen/index.d.ts +6 -6
- package/dist/authzen/index.js +3 -3
- package/dist/{automation-CUcWz8uu.d.ts → automation-0VF1xe4o.d.ts} +3 -3
- package/dist/{automation-CpPdFX91.js → automation-D58PEI7Y.js} +1 -1
- package/dist/baseline-file-BQoki1O_.js +148 -0
- package/dist/better-auth/index.d.ts +2 -2
- package/dist/better-auth/index.js +2 -2
- package/dist/better-supabase/index.d.ts +50 -19
- package/dist/better-supabase/index.js +147 -71
- package/dist/{bind-up3QptTt.js → bind-BYeoLJgN.js} +5 -4
- package/dist/{bind-B3MHrzw4.d.ts → bind-zQacwAOg.d.ts} +12 -7
- package/dist/bsb-access-Bcw6GrQm.js +74 -0
- package/dist/bsb-access-tags-B1TBUQLj.js +305 -0
- package/dist/bsb-action-keys-iKmZChtQ.js +377 -0
- package/dist/bsb-actions-BHiyBxQZ.js +65 -0
- package/dist/budgets-Dpumu_Dt.js +75 -0
- package/dist/{build-instance-hLKYe3-E.js → build-instance-CFiegi_w.js} +1 -1
- package/dist/bundle-size-Ddhv_H_v.js +56 -0
- package/dist/bundle-size-DwZ4e1gu.js +1 -0
- package/dist/{capability-CVt3lpVK.d.ts → capability-BPzseilU.d.ts} +2 -2
- package/dist/{capability-_ZsyfYxU.js → capability-oxfxybFR.js} +1 -1
- package/dist/{casbin-p8yi9Py5.js → casbin-DGsO-QmR.js} +1 -1
- package/dist/{casbin-D3PH6-AJ.js → casbin-s6_zDJi1.js} +2 -2
- package/dist/{casl-CrltbDPa.js → casl-BSt24g-p.js} +1 -1
- package/dist/catalog/index.d.ts +5 -5
- package/dist/catalog/index.js +6 -6
- package/dist/{catalog-DXSP1we9.js → catalog-BExjL94D.js} +4 -4
- package/dist/{catalog-COoxFOoy.js → catalog-CBPFyRv7.js} +2 -2
- package/dist/{catalog-doc-Bp5khmCG.js → catalog-doc-D4g3nyFB.js} +5 -3
- package/dist/{catalog-operations-dxuOZr4J.js → catalog-operations-BqSsByIE.js} +3 -3
- package/dist/catalog-sR0m6x2g.js +1 -0
- package/dist/{challenge-CjwmjcuX.js → challenge-CRB1X3Ry.js} +1 -1
- package/dist/chat/index.d.ts +1 -1
- package/dist/chat/index.js +2 -2
- package/dist/chat-sdk/index.d.ts +3 -3
- package/dist/claims-size-B6j0Ff4Q.js +1 -0
- package/dist/{perf-token-dFGVP14-.js → claims-size-BsSDVD5u.js} +66 -1
- package/dist/claude-agent/index.d.ts +3 -3
- package/dist/claude-agent/index.js +2 -2
- package/dist/clerk/index.d.ts +3 -3
- package/dist/cli/bin.js +1 -1
- package/dist/cli/generate/watch-worker.js +2 -2
- package/dist/cli/index.d.ts +9 -9
- package/dist/cli/index.js +3 -3
- package/dist/cli/plugins/app.d.ts +1 -1
- package/dist/cli/plugins/app.js +1 -1
- package/dist/cli/plugins/better-supabase.d.ts +1 -1
- package/dist/cli/plugins/openapi.d.ts +1 -1
- package/dist/cli/plugins/openapi.js +2 -2
- package/dist/cli/plugins/powersync.d.ts +1 -1
- package/dist/cli/plugins/powersync.js +2 -2
- package/dist/cli/plugins/rls.d.ts +2 -2
- package/dist/cli/plugins/rls.js +1 -1
- package/dist/cli/plugins/schemas.d.ts +1 -1
- package/dist/cli/plugins/schemas.js +1 -1
- package/dist/cli/plugins/scim.d.ts +2 -2
- package/dist/cli/plugins/supabase-hook.d.ts +2 -2
- package/dist/cli/plugins/supabase-hook.js +1 -1
- package/dist/cli/plugins/supabase.d.ts +3 -3
- package/dist/cli/plugins/supabase.js +2 -2
- package/dist/cli/plugins/ui.d.ts +1 -1
- package/dist/cli/plugins/ui.js +1 -1
- package/dist/{client-subject-v89t811z.d.ts → client-subject-BOPbpwgm.d.ts} +2 -2
- package/dist/cloud/index.d.ts +8 -8
- package/dist/cloud/index.js +1 -1
- package/dist/{cloud-DnTSKTYr.js → cloud-fRv3j6sq.js} +3 -3
- package/dist/codemod-DT0dMVdd.js +74 -0
- package/dist/{codemod-C4xmPHZU.js → codemod-DsqEKP6A.js} +612 -391
- package/dist/{collect-BYPq-0JU.js → collect-CCgmm5xN.js} +3 -3
- package/dist/collect-CIdE3FGC.js +1 -0
- package/dist/{collect-BOh9Pxob.js → collect-CPimbkC5.js} +3 -3
- package/dist/compare-8SNJN-9U.js +12 -0
- package/dist/compile/index.d.ts +1 -1
- package/dist/{compile-B9SZiEnG.js → compile-DNVVdVWs.js} +19 -23
- package/dist/{compile-D8c1nFGy.d.ts → compile-tG1zkSgX.d.ts} +3 -3
- package/dist/{completion-CHOgUToS.js → completion-DrJkWgZa.js} +2 -2
- package/dist/{config-StFKj2S0.js → config-BaKkd6HB.js} +2 -2
- package/dist/config-D8iWeV9k.js +521 -0
- package/dist/config-paths-CQvGng3k.js +136 -0
- package/dist/{config-report-DFj3emJp.js → config-report-uuD5eVEn.js} +7 -2
- package/dist/{config-shape-B6tdyBju.js → config-shape-BTojaD-H.js} +9 -2
- package/dist/{context-BdoA9DhS.js → context-BQHKgT1m.js} +2 -2
- package/dist/context-Ne0EdD45.js +35 -0
- package/dist/convex/index.d.ts +5 -5
- package/dist/convex/index.js +2 -2
- package/dist/{core-tEfD0lwu.js → core-C5yCD-Ls.js} +6 -6
- package/dist/{core-CnC47rSf.d.ts → core-bf8qgaZf.d.ts} +3 -3
- package/dist/{coverage-DL7JCZmb.d.ts → coverage-AOeWiQ7Z.d.ts} +2 -2
- package/dist/{coverage-nFSMjFxH.js → coverage-C3jVYC9Y.js} +1 -1
- package/dist/{create-sGl1ccTp.d.ts → create-B7Xa4jSQ.d.ts} +9 -9
- package/dist/{create-D3oXoXxM.js → create-COQVXK6C.js} +22 -6
- package/dist/{create-DeQ5t8mZ.d.ts → create-Cn5EpEez.d.ts} +5 -5
- package/dist/{create-BsRcXm_m.d.ts → create-DHA0fhmi.d.ts} +7 -7
- package/dist/{create-BAMPoEga.js → create-nOWD3Joc.js} +3 -3
- package/dist/{credential-ke0KMQeB.js → credential-D9in5keC.js} +3 -3
- package/dist/{credentials-DOeqknte.js → credentials-B-hsgB4W.js} +1 -1
- package/dist/{credentials-BfzdL5kv.d.ts → credentials-COT-cjnP.d.ts} +3 -3
- package/dist/custom-role-rebuild-BBKC7Bt1.js +181 -0
- package/dist/deciding-columns-DBZsrpdD.js +60 -0
- package/dist/deferred-sink-BZahJ8sO.js +34 -0
- package/dist/{define-permdock-CIxHBykk.js → define-permdock-D7aKxIax.js} +4 -4
- package/dist/{define-permdock-BLpQ0m95.d.ts → define-permdock-DBgwTFi1.d.ts} +6 -6
- package/dist/{delegation-BaUNCrE_.js → delegation-0DVVomzu.js} +3 -3
- package/dist/delivery/index.d.ts +4 -4
- package/dist/delivery/index.js +1 -1
- package/dist/{denied-text-D6JJTDr3.d.ts → denied-text-C_AWc0f0.d.ts} +2 -2
- package/dist/{describe-lAafaRQQ.d.ts → describe-AdETpWsn.d.ts} +2 -2
- package/dist/{diff-CXRZ6qPa.js → diff-COdwpP31.js} +7 -7
- package/dist/{diff-Cv9inVY5.js → diff-CW9eZy9X.js} +2 -2
- package/dist/{doctor-BSYAl2XG.js → doctor-C1T2G2mn.js} +1597 -323
- package/dist/{doctor-CjCJ_U2a.js → doctor-Ch4VGl2q.js} +17 -5
- package/dist/drizzle/index.d.ts +3 -3
- package/dist/edits-CqU8s2GC.js +69 -0
- package/dist/elysia/index.d.ts +5 -5
- package/dist/elysia/index.js +3 -3
- package/dist/{errors-DUJ7wLlE.d.ts → errors-COoiWqIs.d.ts} +1 -1
- package/dist/{evaluate-D8SdfP3h.js → evaluate-Dmd0bShm.js} +30 -31
- package/dist/{evaluations-BQkpE7hC.js → evaluations-DPEAu_jM.js} +2 -2
- package/dist/{evaluations-K9qglDP7.d.ts → evaluations-GW9j_ARq.d.ts} +3 -3
- package/dist/evaluator-COmATWCr.js +2 -0
- package/dist/{evaluator-eager-UuJK6NX_.js → evaluator-eager-CpVYslzY.js} +1 -1
- package/dist/eve/index.d.ts +25 -15
- package/dist/eve/index.js +15 -17
- package/dist/{execute-BzQKrYqL.js → execute-BhWXiQAy.js} +17 -41
- package/dist/explain-DRC9V5Qb.js +37 -0
- package/dist/explain-jg0KLCVt.js +74 -0
- package/dist/express/index.d.ts +5 -5
- package/dist/express/index.js +3 -3
- package/dist/fastify/index.d.ts +5 -5
- package/dist/fastify/index.js +3 -3
- package/dist/{fetch-adapter-gmTCu4FR.d.ts → fetch-adapter-CJncmsPg.d.ts} +4 -4
- package/dist/{fetch-adapter-ovZdSvlT.js → fetch-adapter-CU1DIkXu.js} +3 -3
- package/dist/{fields-CViS0EPC.js → fields-y_PSRCyJ.js} +3 -2
- package/dist/{fixtures-Bm0G0A7H.js → fixtures-3aUUP6Nx.js} +1 -1
- package/dist/flags-DQzNPxg1.js +204 -0
- package/dist/{from-snapshot-CCDF_ihX.js → from-snapshot-DGc9W4QU.js} +7 -7
- package/dist/{gen-BVDN_Hqx.js → gen-CGjbD8I_.js} +16 -12
- package/dist/gen-CkUEZ5Z6.js +1 -0
- package/dist/{gen-kind-BK6bb0gj.js → gen-kind-thoT0NYV.js} +1 -1
- package/dist/{generate-DNAoLMj1.js → generate-eor7vXGN.js} +240 -158
- package/dist/{generate-options-Yfh1pGyX.js → generate-options-MJgn0dgl.js} +18 -189
- package/dist/{generate-p7cdH1ac.js → generate-vEW8Brg8.js} +4 -4
- package/dist/{grantee-BPUG6f0r.js → grantee-BSCdpIF3.js} +1 -1
- package/dist/{grantee-match-CFQ-LRcL.js → grantee-match-CJgQmcx4.js} +1 -1
- package/dist/h3/index.d.ts +4 -4
- package/dist/h3/index.js +3 -3
- package/dist/helper-calls-DHvgN9tr.js +106 -0
- package/dist/{helpers-DSmj6SHi.js → helpers-COh0lLc1.js} +2 -2
- package/dist/hono/index.d.ts +5 -5
- package/dist/hono/index.js +3 -3
- package/dist/{hook-sql-55514A9t.js → hook-sql-DJQ_yOEC.js} +47 -225
- package/dist/{hosted-DUbuh0Td.d.ts → hosted-Bkw3Oyh-.d.ts} +1 -1
- package/dist/{hosted-DMJKJPoc.js → hosted-DZwCFrcy.js} +5 -5
- package/dist/{import-B0nUIp2b.js → import-CGQIK3iN.js} +1 -1
- package/dist/{import-Cm8kuezl.js → import-D_8tLF9g.js} +30 -46
- package/dist/{index-BSJoxaOi.d.ts → index-DPVeDtAO.d.ts} +5 -5
- package/dist/{index-D1msamx_.d.ts → index-DT3hOxA7.d.ts} +83 -14
- package/dist/{index-DegTwZxD.d.ts → index-DWmIuQLz.d.ts} +5 -5
- package/dist/{index-eaNHkELi.d.ts → index-Kj5S3IWE.d.ts} +6 -6
- package/dist/{index-O0qbI8Ha.d.ts → index-WOx7TBbj.d.ts} +2 -2
- package/dist/{index-D8A1d_Tt.d.ts → index-xShPsK8G.d.ts} +2 -2
- package/dist/index.d.ts +18 -18
- package/dist/index.js +25 -24
- package/dist/{init-CjlVWrBE.js → init-C6te_dSg.js} +4 -4
- package/dist/{init-Ck4PIu9F.js → init-DN19mlwE.js} +1 -1
- package/dist/{instance-options-B4MD2wgl.d.ts → instance-options-DQCiBBuz.d.ts} +1 -1
- package/dist/{instance-snapshot-DdGOpSfN.js → instance-snapshot-D9kjL37B.js} +37 -20
- package/dist/{interactive-only-C_olBCPl.js → interactive-only-BjYwp9mm.js} +5 -14
- package/dist/jwt/index.d.ts +17 -13
- package/dist/jwt/index.js +14 -5
- package/dist/{kernel-Dn6pKMAF.js → kernel-C5akxw5n.js} +7 -7
- package/dist/keys-qFqDoYeF.js +42 -0
- package/dist/kysely/index.d.ts +3 -3
- package/dist/{lazy-provider-C48LDq0q.d.ts → lazy-provider-CMgFAGf8.d.ts} +1 -1
- package/dist/{lazy-provider-CVX534Kk.js → lazy-provider-DNVjY4n3.js} +2 -2
- package/dist/load-BCABUQZi.js +1 -0
- package/dist/{load-CZnlAyZ8.js → load-m7jmit3y.js} +1 -1
- package/dist/{login-BdWIAsFT.js → login-BYXaH_yT.js} +1 -1
- package/dist/{login-BhSLL8Pn.js → login-CMzfsdm8.js} +4 -4
- package/dist/manager-chain-CStuYb7A.js +243 -0
- package/dist/{manifest-CRHphHxo.d.ts → manifest-CA3E0KP8.d.ts} +39 -0
- package/dist/{manifest-CXK3krNu.js → manifest-CowZuywo.js} +70 -38
- package/dist/{manifest-Ct3eXbLR.js → manifest-DdNYR_pl.js} +1 -1
- package/dist/{manifest-schema-Bp-eFhNZ.js → manifest-schema-CLbcbDz7.js} +47 -1
- package/dist/{map-error-DTi_JZT8.js → map-error-DYQbf-3Q.js} +1 -1
- package/dist/{may-use-Died1tNU.js → may-use-4HzzgYJ3.js} +3 -3
- package/dist/mcp/index.d.ts +9 -9
- package/dist/mcp/index.js +4 -4
- package/dist/{membership-filter-CSKH48eD.js → membership-filter-C7ZuhAqJ.js} +1 -1
- package/dist/{migrate-BcBFWFt9.js → migrate-pg-lkbDu.js} +4 -16
- package/dist/model-BqHWwfcg.js +329 -0
- package/dist/{module-values-Ddx0GLaJ.js → module-values-B09BBJIj.js} +3 -3
- package/dist/nest/index.d.ts +5 -5
- package/dist/nest/index.js +3 -3
- package/dist/next/index.d.ts +28 -12
- package/dist/next/index.js +23 -26
- package/dist/next/plugin.d.ts +1 -1
- package/dist/next/plugin.js +1 -1
- package/dist/node/index.d.ts +5 -5
- package/dist/node/index.js +2 -2
- package/dist/openai/index.d.ts +5 -5
- package/dist/openai/index.js +3 -3
- package/dist/openapi/index.d.ts +4 -4
- package/dist/openapi/index.js +3 -3
- package/dist/{openapi-E2411VYb.js → openapi-BP7YpJeF.js} +11 -4
- package/dist/{openapi-D2dmyWZK.js → openapi-CZu6sVsP.js} +1 -1
- package/dist/{openapi-D595qUYF.js → openapi-Dsh0MDSZ.js} +6 -6
- package/dist/{openapi-document-DDzA3CrT.js → openapi-document-_QSOtSKS.js} +1 -1
- package/dist/{operations-BS8ExH5A.d.ts → operations-DaEoGpMV.d.ts} +1 -1
- package/dist/{operations-De3F7tlf.js → operations-dJxcshJZ.js} +1 -1
- package/dist/{operations-B0yO77Zz.js → operations-id4vhwFN.js} +9 -3
- package/dist/orpc/index.d.ts +7 -7
- package/dist/orpc/index.js +4 -4
- package/dist/otel/index.d.ts +3 -3
- package/dist/{output-BhNN-hvv.js → output-Didy9Ys4.js} +19 -2
- package/dist/{output-files-D5D-8-4l.js → output-files-8lfALMSU.js} +143 -11
- package/dist/output-files-DKWhL1IE.js +1 -0
- package/dist/{ownership-mprXkEHG.js → ownership-CG5_N8b5.js} +4 -3
- package/dist/{parse-nfHSt1Wy.js → parse-CUqZ_lLC.js} +1 -1
- package/dist/{parse-local-manifest-BGLWVchi.d.ts → parse-local-manifest-B92rFWnk.d.ts} +1 -1
- package/dist/pdp/index.d.ts +3 -3
- package/dist/pdp/index.js +2 -2
- package/dist/{permdock-Dz3yzWrp.d.ts → permdock-BShHM8OJ.d.ts} +11 -5
- package/dist/{permdock-BueSeg7X.js → permdock-CJPIwU1T.js} +102 -55
- package/dist/{permission-registry-DMYRZVcn.js → permission-registry-DstT40VS.js} +31 -1
- package/dist/{permissions-CQW3cr2S.js → permissions-DJ_QV9L7.js} +1 -1
- package/dist/{permissions-DWULToSb.d.ts → permissions-UyQD5nRN.d.ts} +1 -1
- package/dist/{permissions-Bj3DRIEi.js → permissions-wEkTVr_I.js} +3 -3
- package/dist/{pg-CA651850.js → pg-DmS5ITHu.js} +20 -1
- package/dist/pg-DtiDogUp.js +1 -0
- package/dist/{pipeline-Ct3YEKjx.js → pipeline-B4iyaOK7.js} +103 -32
- package/dist/platform-CSxTsLsr.js +35 -0
- package/dist/{plugin-zOs9uqQj.d.ts → plugin-DQJuZVl1.d.ts} +15 -4
- package/dist/{policy-DFD2J5o_.js → policy-BBvhhH9X.js} +4 -4
- package/dist/{policy-C-Lzp3Zh.d.ts → policy-BUtwixSN.d.ts} +2 -2
- package/dist/{policy-bundle-pwhJJv2-.js → policy-bundle-BIDV0DZF.js} +3 -3
- package/dist/{policy-from-catalog-YKaTeaco.js → policy-from-catalog-_zwn1sNj.js} +12 -9
- package/dist/{policy-DfvOwgtX.js → policy-hnVT4MC4.js} +3 -3
- package/dist/{policy-types-93NwI8iI.d.ts → policy-types-CfW4X_yX.d.ts} +155 -19
- package/dist/{postgrest-DyrYo_XT.d.ts → postgrest-PQ3zAOD2.d.ts} +2 -2
- package/dist/{powersync-BdqLK59r.js → powersync-D7YfMHke.js} +2 -2
- package/dist/powersync-DUvN9v5a.js +1 -0
- package/dist/{powersync-Da9op2Zo.js → powersync-_2ElzOhQ.js} +65 -24
- package/dist/prisma/index.d.ts +2 -2
- package/dist/program-CvarkLMS.js +10 -0
- package/dist/{protected-action-Dco5O_Kc.js → protected-action-BPN0NaRb.js} +1 -1
- package/dist/{protected-action-CEzNNtfi.d.ts → protected-action-DhCQ4bSe.d.ts} +6 -6
- package/dist/{provider-BYcoTKuS.js → provider-1xqxLVEz.js} +2 -2
- package/dist/{provider-C48LDq0q.d.ts → provider-CMgFAGf8.d.ts} +1 -1
- package/dist/{provider-1yWthvi5.js → provider-D1vlNPWo.js} +442 -116
- package/dist/{provider-store-Dq_olUjC.js → provider-store-Cf8HRNtb.js} +3 -3
- package/dist/{provider-with-fxHItxDh.js → provider-with-cpL9vRjC.js} +2 -2
- package/dist/prune-config-5vtQpiLk.js +209 -0
- package/dist/{pull-AXzbc_kg.js → pull-BnxZmo3f.js} +4 -4
- package/dist/pull-CGncYZNZ.js +1 -0
- package/dist/{push-N-QI_ArC.js → push-Bu0uCkJg.js} +5 -5
- package/dist/{pushed-policy-rpB6k77P.js → pushed-policy-DSjSWEAl.js} +1 -1
- package/dist/{pushed-policy-APjMbYdV.d.ts → pushed-policy-DcvO8NXy.d.ts} +1 -1
- package/dist/{conditions-ChE7zxJI.js → rbac-CwcucZPx.js} +227 -6
- package/dist/react/index.d.ts +6 -6
- package/dist/react/index.js +3 -3
- package/dist/react/lazy.d.ts +6 -6
- package/dist/react/lazy.js +3 -3
- package/dist/react/provider-client-lazy.d.ts +1 -1
- package/dist/react/provider-client-lazy.js +1 -1
- package/dist/react/provider-client.d.ts +1 -1
- package/dist/react/provider-client.js +1 -1
- package/dist/react-native/index.d.ts +9 -9
- package/dist/react-native/index.js +8 -8
- package/dist/rename-CLoDRrbc.js +437 -0
- package/dist/replay-BCOZifwx.d.ts +3 -0
- package/dist/report-BI_hek_d.js +298 -0
- package/dist/report-BevPHMy6.js +1 -0
- package/dist/{request-context-CVJodWx8.js → request-context-BNVY3kZ1.js} +1 -1
- package/dist/resend/index.d.ts +4 -4
- package/dist/resolve-config-9NYYVc30.js +238 -0
- package/dist/{resolve-names-B0cqvJxo.js → resolve-names-CTji5IPe.js} +5 -5
- package/dist/{resolver-4qxIIHcC.js → resolver-CuIY8aFD.js} +48 -30
- package/dist/{retire-BNiXnbBR.js → retire-FN4aY6-n.js} +1 -1
- package/dist/{rls-DfzVlo1q.js → rls-BPHCyA5v.js} +221 -40
- package/dist/{rls-BC1IFnfu.js → rls-UY6p6ztg.js} +28 -5
- package/dist/{rls-files-BpMqBdji.js → rls-files-CDZdTh8v.js} +3 -3
- package/dist/{rls-options-BZxfMDFo.d.ts → rls-options-BgD-KZkm.d.ts} +1 -1
- package/dist/{role-builder-DhsGEVq-.js → role-builder-BksM3Q9O.js} +3 -3
- package/dist/{roles-B29psCem.js → roles-BeNEhv7Q.js} +2 -2
- package/dist/{rpc-DjgxFbjK.d.ts → rpc-COnquydd.d.ts} +2 -2
- package/dist/{rpc-B-4IZOiU.js → rpc-D7G7IJDa.js} +1 -1
- package/dist/run-3ySqmufy.js +1 -0
- package/dist/{run-CqAur1Y3.js → run-C3ztA88m.js} +12 -11
- package/dist/{run-ticket-DXwrko2J.d.ts → run-ticket-Mmor5sYW.d.ts} +2 -2
- package/dist/{saas-CUwmgUB8.js → saas-DcqUkynn.js} +5 -5
- package/dist/{scan-C_YtxPxn.js → scan-m5m1M6Qn.js} +1 -1
- package/dist/{schema-BVhiZyY-.js → schema-BpGuLrwk.js} +1 -1
- package/dist/{schema-BeY3croo.js → schema-D2OK4RrB.js} +1 -0
- package/dist/schema-tables-Ba9LE_XB.js +185 -0
- package/dist/scim/index.d.ts +1 -1
- package/dist/seeds/index.d.ts +1 -1
- package/dist/seeds/index.js +1 -1
- package/dist/{seeds-BDTG7xl-.js → seeds-Bs44UDS3.js} +1 -1
- package/dist/{seeds-uG196Ev4.d.ts → seeds-Cih1ztkf.d.ts} +2 -2
- package/dist/server/index.d.ts +13 -12
- package/dist/server/index.js +7 -6
- package/dist/{server-Co9CYGqk.js → server-lohbasQd.js} +2 -2
- package/dist/{server-types-BrHOGAYx.d.ts → server-types-C2XX60aF.d.ts} +16 -9
- package/dist/shared-C6_T7QUo.js +76 -0
- package/dist/{sink-BD34OS8T.d.ts → sink-BQ_6K81r.d.ts} +4 -4
- package/dist/{size-BqLd5oJ4.js → size-l1pDHE2z.js} +28 -5
- package/dist/{skills-CQ3B9vuz.js → skills-BytzDi34.js} +2 -2
- package/dist/{skills-DBvXLSo7.js → skills-CzhnDo-C.js} +2 -2
- package/dist/{snapshot-DckMnHk8.js → snapshot-Ty0uk9wZ.js} +46 -12
- package/dist/{snapshot-cache-DoP3avLl.d.ts → snapshot-cache-DGvLQW0-.d.ts} +1 -1
- package/dist/snapshot-compact-yXFxZLPo.js +596 -0
- package/dist/{snapshot-empty-DZ6sZ83n.js → snapshot-empty-pKgPDcLd.js} +1 -1
- package/dist/{snapshot-evaluate-9RGy7J3N.js → snapshot-evaluate-DSNj2rhV.js} +5 -4
- package/dist/{snapshot-reads-D775amTL.js → snapshot-reads-BnAHiuoa.js} +2 -2
- package/dist/snapshot-requires-DfUqCLEb.js +122 -0
- package/dist/{snapshot-size-CHig-Nq_.js → snapshot-size-2fkXbCkP.js} +5 -15
- package/dist/snapshot-size-DNY1MTsV.js +1 -0
- package/dist/solid/index.d.ts +6 -6
- package/dist/solid/index.js +2 -2
- package/dist/solid-start/index.d.ts +6 -6
- package/dist/solid-start/index.js +3 -3
- package/dist/{sources-NQio1yFq.d.ts → sources-D5n28164.d.ts} +2 -2
- package/dist/{src-BAYcigFU.js → src-HRYn4UFj.js} +148 -15
- package/dist/ssf/index.d.ts +3 -3
- package/dist/ssf/index.js +1 -1
- package/dist/{standard-webhooks-B3MQihcP.d.ts → standard-webhooks-Bnnrqa6d.d.ts} +2 -2
- package/dist/{store-core-DyNo_BwA.d.ts → store-core-BdFcruPm.d.ts} +5 -5
- package/dist/{store-AH8bmaxW.js → store-n3yEN7dt.js} +2 -2
- package/dist/{store-options-BtHrfJUU.js → store-options-DpCQo0vB.js} +21 -12
- package/dist/{stores-DyFCruRC.d.ts → stores-D6MIjN_-.d.ts} +6 -6
- package/dist/{stores-BIMyclLg.js → stores-KpBCaY6c.js} +1 -1
- package/dist/{shared-Cwxy5N16.js → subject-CrldGifz.js} +1 -75
- package/dist/{subject-cache-BZeSj4Xf.d.ts → subject-cache-CnJcz2K_.d.ts} +14 -6
- package/dist/supabase/index.d.ts +9 -9
- package/dist/supabase/index.js +4 -4
- package/dist/supabase/middleware.d.ts +14 -7
- package/dist/supabase/middleware.js +17 -6
- package/dist/{supabase-CakrAxMg.js → supabase-CAswAUeb.js} +2 -2
- package/dist/supabase-dir-0lxKbrYu.js +41 -0
- package/dist/{supabase-hook-0q6ohTVN.js → supabase-hook-C0LIaT7b.js} +189 -10
- package/dist/supabase-hook-DXGg5bNn.js +2 -0
- package/dist/{supabase-BzK3lplm.js → supabase-kWQlkrHw.js} +4 -4
- package/dist/{supabase-config-B2sDFiwy.js → supabase-schemas-BUFeyErz.js} +217 -29
- package/dist/{supautils-DXzJ2E2Q.js → supautils-C85NuESf.js} +2 -2
- package/dist/{support-session-B8xrW28B.js → support-session-DpzcGTuV.js} +1 -1
- package/dist/svelte/index.d.ts +5 -5
- package/dist/svelte/index.js +3 -3
- package/dist/svelte/runtime.d.ts +3 -3
- package/dist/svelte/runtime.js +1 -1
- package/dist/svelte/source.d.ts +5 -5
- package/dist/svelte/source.js +2 -2
- package/dist/sveltekit/index.d.ts +6 -6
- package/dist/sveltekit/index.js +2 -2
- package/dist/{tables-BDqfipr1.js → tables-sLA1CpuN.js} +76 -23
- package/dist/tanstack-start/index.d.ts +6 -6
- package/dist/tanstack-start/index.js +2 -2
- package/dist/tenant-check-gL2miiaS.js +31 -0
- package/dist/tenant-from-path-AKTSY7uR.js +65 -0
- package/dist/tenant-from-path-Dq3jkqjh.d.ts +25 -0
- package/dist/terminal/index.d.ts +6 -6
- package/dist/terminal/index.js +4 -4
- package/dist/testing/core.d.ts +1 -1
- package/dist/testing/core.js +1 -1
- package/dist/testing/fixtures/index.d.ts +5 -5
- package/dist/testing/fixtures/index.js +61 -3
- package/dist/testing/index.d.ts +31 -30
- package/dist/testing/index.js +51 -45
- package/dist/testing/saas/index.d.ts +5 -5
- package/dist/testing/saas/index.js +2 -2
- package/dist/testing/saas/permissions.d.ts +1 -1
- package/dist/testing/saas/permissions.js +1 -1
- package/dist/trpc/index.d.ts +6 -6
- package/dist/trpc/index.js +3 -3
- package/dist/{type-helpers-DHCQEPj8.d.ts → type-helpers-CUmJFGV6.d.ts} +3 -3
- package/dist/{types-PS10T9UK.d.ts → types-BKnUwgvx.d.ts} +5 -5
- package/dist/{types-CQF-oYSz.d.ts → types-BRECeQ2n.d.ts} +4 -4
- package/dist/{types-OzSal_K_.d.ts → types-BhBfMdQ5.d.ts} +3 -3
- package/dist/{types-DONLJQjY.d.ts → types-BsRf5rKk.d.ts} +3 -3
- package/dist/{types-Cakw89Wx.d.ts → types-CIzXPPV-.d.ts} +2 -2
- package/dist/{types-CWmBZtQN.d.ts → types-CbJ5mxXv.d.ts} +7 -2
- package/dist/{types-4wjWMSFM.d.ts → types-CjZscT16.d.ts} +4 -4
- package/dist/{types-XSfi6ihL.d.ts → types-DwoRXDvN.d.ts} +2 -2
- package/dist/{types-config-Cq72dArb.d.ts → types-config-BiMM_zJ-.d.ts} +82 -17
- package/dist/{types-BFtFaI1W.d.ts → types-euUv1wsO.d.ts} +1 -1
- package/dist/{types-D3tjoLwT.d.ts → types-h9W3CNC_.d.ts} +5 -5
- package/dist/{types-run-DG1H5vrX.d.ts → types-run-N2ffLN_Z.d.ts} +1 -1
- package/dist/{types-BdNdMix7.d.ts → types-vKKndyxx.d.ts} +2 -2
- package/dist/unplugin/index.d.ts +1 -1
- package/dist/unplugin/index.js +1 -1
- package/dist/{usage-CnCNB6XN.js → usage-DT6QK86a.js} +7 -235
- package/dist/{usage-Dodo7Sjb.js → usage-Dcbg6zu6.js} +2 -2
- package/dist/usage-DdOFc5xq.js +1 -0
- package/dist/{validation-error-BAO1W1yk.d.ts → validation-error-P4Z9HUuP.d.ts} +1 -1
- package/dist/{verify-DTlATzWK.js → verify-DNERav8K.js} +16 -104
- package/dist/{version-cache-BXkl7-Fz.js → version-cache-BzK8dwJy.js} +14 -10
- package/dist/{vocabulary-FYgI_NoI.d.ts → vocabulary-DHfKPIC5.d.ts} +7 -0
- package/dist/vue/index.d.ts +6 -6
- package/dist/vue/index.js +2 -2
- package/dist/{waiter-hYLJXA7r.d.ts → waiter-BqUxSRxq.d.ts} +2 -2
- package/dist/{watch-Bz_iEKlB.js → watch-BsQ4n3NV.js} +11 -14
- package/dist/watch-eay1PztJ.js +1 -0
- package/dist/{watch-BNxvqCS4.js → watch-fldErlRf.js} +2 -2
- package/dist/webmcp/index.d.ts +2 -2
- package/dist/webmcp/index.js +2 -2
- package/dist/{who-can-rUSZfLvI.js → who-can-CGVpM3fZ.js} +3 -3
- package/dist/workflow/index.d.ts +3 -3
- package/dist/workflow/index.js +4 -4
- package/dist/workflow-sdk/index.d.ts +17 -5
- package/dist/workflow-sdk/index.js +3 -1
- package/dist/{wrap-D-KvhzaC.d.ts → wrap-D8WtzrB7.d.ts} +2 -2
- package/package.json +44 -40
- package/schemas/catalog-v2.json +6 -0
- package/schemas/snapshot-v2.json +557 -0
- package/schemas/supabase-manifest-v1.json +52 -1
- package/skills/permdock/SKILL.md +1 -1
- package/skills/permdock-agents/references/runtimes.md +1 -1
- package/skills/permdock-credentials/references/tokens-keys-links.md +1 -1
- package/skills/permdock-data/references/queries-and-rls.md +1 -1
- package/skills/permdock-tenancy/SKILL.md +4 -4
- package/skills/permdock-tenancy/references/ownership-and-custom-roles.md +1 -1
- package/dist/annotate-routes-BvSuEht3.js +0 -75
- package/dist/annotate-uZVGIRym.js +0 -25
- package/dist/better-supabase-DSbs4MtQ.js +0 -201
- package/dist/catalog-DCjJIl3n.js +0 -1
- package/dist/claims-size-DcjhvUv5.js +0 -58
- package/dist/codemod-DwJ1I9er.js +0 -35
- package/dist/collect-XcoQRyiA.js +0 -1
- package/dist/config-iyy90IOU.js +0 -143
- package/dist/deciding-columns-BnglEKqU.js +0 -143
- package/dist/evaluator-Dlhn2d7D.js +0 -2
- package/dist/flags-C0e-BzGW.js +0 -112
- package/dist/gen-D13YdBQP.js +0 -1
- package/dist/grants-Dn6zwfqo.js +0 -139
- package/dist/load-BPzIqlGB.js +0 -1
- package/dist/model-B0rrUh6J.js +0 -188
- package/dist/output-files-aPXXhV4q.js +0 -1
- package/dist/powersync-CMu40wtz.js +0 -1
- package/dist/pull-B0ju22jJ.js +0 -1
- package/dist/rbac-BJTUGJum.js +0 -90
- package/dist/replay-ClGIMp5p.d.ts +0 -3
- package/dist/run-X_cWRiUV.js +0 -1
- package/dist/snapshot-compact-CwAop_6C.js +0 -119
- package/dist/snapshot-size-B_chu2c1.js +0 -1
- package/dist/supabase-hook-CcmjiBsh.js +0 -2
- package/dist/usage-Cayjfw1S.js +0 -1
- package/dist/watch-CGLmIdld.js +0 -1
- 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-
|
|
7
|
-
import { c as generateFlags, f as policyFlag, i as dryRunFlag, r as dbUrlFlags, t as checkFlag } from "./flags-
|
|
8
|
-
import { n as ROOT } from "./manifest-
|
|
9
|
-
import {
|
|
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-CowZuywo.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/
|
|
294
|
-
|
|
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.32.ts
|
|
298
|
+
const DEFAULT_BASELINE = "doctor-baseline.json";
|
|
318
299
|
/**
|
|
319
|
-
*
|
|
320
|
-
*
|
|
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
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
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
|
-
*
|
|
346
|
-
*
|
|
335
|
+
* `doctor.waivers` entries `{ code: "PD017", key, reason }` as baseline
|
|
336
|
+
* entries.
|
|
347
337
|
*/
|
|
348
|
-
function
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
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
|
-
*
|
|
398
|
-
*
|
|
361
|
+
* `doctor.ignore` entries `{ id: "<code>:<target>", reason }` as baseline
|
|
362
|
+
* entries.
|
|
399
363
|
*/
|
|
400
|
-
function
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
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
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
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
|
-
|
|
441
|
-
|
|
384
|
+
kind: "entries",
|
|
385
|
+
entries
|
|
442
386
|
};
|
|
443
387
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
388
|
+
/**
|
|
389
|
+
* 0.32: `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.32.ts
|
|
464
|
+
/** The 0.32 config moves. Each entry moves one key path of `permdock.config.ts`. */
|
|
465
|
+
const CONFIG_MOVES = [];
|
|
461
466
|
/**
|
|
462
|
-
*
|
|
463
|
-
*
|
|
467
|
+
* The 0.32 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
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
470
|
+
const REWRITES = [rewriteDoctorBaseline];
|
|
471
|
+
function rewrite032(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
|
-
|
|
483
|
+
return {
|
|
484
|
+
source: text,
|
|
485
|
+
changes,
|
|
486
|
+
followUps,
|
|
487
|
+
files
|
|
488
|
+
};
|
|
478
489
|
}
|
|
490
|
+
const CODEMOD_0_32 = Object.freeze({
|
|
491
|
+
renames: [],
|
|
492
|
+
signatures: [],
|
|
493
|
+
configMoves: CONFIG_MOVES,
|
|
494
|
+
literals: rewrite032
|
|
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
|
|
483
|
-
|
|
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
|
|
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
|
|
673
|
-
|
|
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
|
|
684
|
-
let text = source;
|
|
685
|
-
if (text
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
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
|
-
|
|
770
|
+
kinds
|
|
703
771
|
};
|
|
704
772
|
}
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
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
|
|
767
|
-
const
|
|
768
|
-
return
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
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
|
|
803
|
-
|
|
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
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
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 (
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
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 =
|
|
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
|
|
862
|
-
const
|
|
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:
|
|
865
|
-
|
|
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
|
-
|
|
873
|
-
|
|
874
|
-
const
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
const
|
|
882
|
-
if (
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
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
|
-
|
|
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
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
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
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
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
|
-
|
|
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
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
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.32": CODEMOD_0_32
|
|
1947
2127
|
});
|
|
1948
2128
|
function codemodVersions() {
|
|
1949
|
-
return
|
|
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,13 +2280,36 @@ 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]
|
|
@@ -2122,23 +2343,23 @@ function cliResult(file, source) {
|
|
|
2122
2343
|
})), ...result.followUps]
|
|
2123
2344
|
};
|
|
2124
2345
|
}
|
|
2125
|
-
function sourceFiles(cwd, paths, cli,
|
|
2346
|
+
function sourceFiles(cwd, paths, cli, v026) {
|
|
2126
2347
|
const out = /* @__PURE__ */ new Set();
|
|
2127
2348
|
for (const path of paths) {
|
|
2128
2349
|
const root = resolve(cwd, path);
|
|
2129
2350
|
const stats = statSync(root, { throwIfNoEntry: false });
|
|
2130
2351
|
if (stats === void 0) throw new CliError("usage", `not found: ${path}`);
|
|
2131
2352
|
if (stats.isFile()) out.add(root);
|
|
2132
|
-
else walkDir(root, out, cli,
|
|
2353
|
+
else walkDir(root, out, cli, v026);
|
|
2133
2354
|
}
|
|
2134
2355
|
return [...out].toSorted();
|
|
2135
2356
|
}
|
|
2136
|
-
function walkDir(dir, out, cli,
|
|
2357
|
+
function walkDir(dir, out, cli, v026) {
|
|
2137
2358
|
for (const name of readdirSync(dir)) {
|
|
2138
2359
|
if (SKIP_DIRS.has(name)) continue;
|
|
2139
2360
|
const full = join(dir, name);
|
|
2140
|
-
if (statSync(full).isDirectory()) walkDir(full, out, cli,
|
|
2141
|
-
else if (EXTENSIONS.has(extname(name)) || cli && isCliFile(name) ||
|
|
2361
|
+
if (statSync(full).isDirectory()) walkDir(full, out, cli, v026);
|
|
2362
|
+
else if (EXTENSIONS.has(extname(name)) || cli && isCliFile(name) || v026 && (extname(name) === ".json" || extname(name) === ".sql")) out.add(full);
|
|
2142
2363
|
}
|
|
2143
2364
|
}
|
|
2144
2365
|
function formatReport(report) {
|