permdock 0.30.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-EGg-hGEu.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-yiKJ4jm0.js → arazzo-C0bltfjv.js} +2 -2
- package/dist/{arazzo-CfjZOmVG.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 +48 -17
- 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-QzddqHaV.js → casbin-DGsO-QmR.js} +1 -1
- package/dist/{casbin-j_468wDU.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-D3c4zhYr.js → cloud-fRv3j6sq.js} +3 -3
- package/dist/codemod-DT0dMVdd.js +74 -0
- package/dist/{codemod-BLTuDxFa.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-CVTgFKK6.js → completion-DrJkWgZa.js} +2 -2
- package/dist/{config-ClUStKUe.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-GJmQMf2K.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-Bn2BTr0N.js → doctor-C1T2G2mn.js} +1597 -323
- package/dist/{doctor-CQoP1264.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 +18 -8
- package/dist/eve/index.js +13 -15
- package/dist/{execute-BLM5tpRU.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-02p5oEol.js → gen-CGjbD8I_.js} +16 -12
- package/dist/gen-CkUEZ5Z6.js +1 -0
- package/dist/{gen-kind-BMwPHJZ0.js → gen-kind-thoT0NYV.js} +1 -1
- package/dist/{generate-BtstB6iV.js → generate-eor7vXGN.js} +240 -158
- package/dist/{generate-options-Yfh1pGyX.js → generate-options-MJgn0dgl.js} +18 -189
- package/dist/{generate-BVcwnfoI.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-HzsIBAa5.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-DvsMFuau.js → init-C6te_dSg.js} +4 -4
- package/dist/{init-BklKWywy.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-CuUf-syI.js → login-BYXaH_yT.js} +1 -1
- package/dist/{login-BFvEcFnI.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-BYzJF6xk.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-DNZv-nDu.js → openapi-BP7YpJeF.js} +11 -4
- package/dist/{openapi-D2dmyWZK.js → openapi-CZu6sVsP.js} +1 -1
- package/dist/{openapi-BwZABlQO.js → openapi-Dsh0MDSZ.js} +6 -6
- package/dist/{openapi-document-DoIe4MrZ.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-BI85V6hu.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-D1Aog89p.js → powersync-D7YfMHke.js} +2 -2
- package/dist/powersync-DUvN9v5a.js +1 -0
- package/dist/{powersync-CkoImqoq.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-DD6YQ42X.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-c0Z9lbyp.js → rls-BPHCyA5v.js} +221 -40
- package/dist/{rls-oLdqutBO.js → rls-UY6p6ztg.js} +28 -5
- package/dist/{rls-files-Dhtn_6LH.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-DkviX16y.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-CNhvy39j.js → scan-m5m1M6Qn.js} +1 -1
- package/dist/{schema-CwNjlLBx.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-DrY6VdtH.js → skills-BytzDi34.js} +2 -2
- package/dist/{skills-B74k44ml.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-DEUKhZ1n.js → usage-DT6QK86a.js} +7 -235
- package/dist/{usage-B-xheuEq.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-BgZapMKs.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 +20 -16
- 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-Ob71iPQh.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-C_RJoGZB.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-f-6y8sCk.js +0 -1
- package/dist/pull-CT7wu2uo.js +0 -1
- package/dist/rbac-BJTUGJum.js +0 -90
- package/dist/replay-ClGIMp5p.d.ts +0 -3
- package/dist/run-DKUZT8Cc.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-BRjoZ-vo.js +0 -1
- package/dist/watch-CGLmIdld.js +0 -1
- package/schemas/snapshot-v1.json +0 -329
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { i as visitorKeyTypes, t as createVisitor } from "./optional-CaQWp9HA.js";
|
|
2
|
+
// src/cli/codemod/ast.ts
|
|
3
|
+
function nameOf(node) {
|
|
4
|
+
if (node?.type === "Literal") return typeof node.value === "string" ? node.value : void 0;
|
|
5
|
+
return node?.name;
|
|
6
|
+
}
|
|
7
|
+
const NOT_REFERENCES = /* @__PURE__ */ new Set([
|
|
8
|
+
"ImportSpecifier",
|
|
9
|
+
"ImportDefaultSpecifier",
|
|
10
|
+
"ImportNamespaceSpecifier",
|
|
11
|
+
"LabeledStatement",
|
|
12
|
+
"BreakStatement",
|
|
13
|
+
"ContinueStatement",
|
|
14
|
+
"TSEnumMember",
|
|
15
|
+
"TSModuleDeclaration",
|
|
16
|
+
"TSTypeParameter"
|
|
17
|
+
]);
|
|
18
|
+
const KEYED_MEMBERS = /* @__PURE__ */ new Set([
|
|
19
|
+
"MethodDefinition",
|
|
20
|
+
"PropertyDefinition",
|
|
21
|
+
"AccessorProperty",
|
|
22
|
+
"TSPropertySignature",
|
|
23
|
+
"TSMethodSignature",
|
|
24
|
+
"TSAbstractMethodDefinition",
|
|
25
|
+
"TSAbstractPropertyDefinition"
|
|
26
|
+
]);
|
|
27
|
+
/**
|
|
28
|
+
* How an identifier is read: a plain reference, a shorthand property value, the
|
|
29
|
+
* local of an `export { }`, or not a reference.
|
|
30
|
+
*/
|
|
31
|
+
function referencePlace(node, parent, ancestors) {
|
|
32
|
+
const type = parent.type;
|
|
33
|
+
if (node.type === "JSXIdentifier") return type === "JSXOpeningElement" || type === "JSXClosingElement" || type === "JSXMemberExpression" && parent.object === node ? "reference" : "none";
|
|
34
|
+
if (type === "Property") {
|
|
35
|
+
if (ancestors.at(-2)?.type === "ObjectPattern") return "none";
|
|
36
|
+
if (parent.shorthand === true) return parent.value === node ? "shorthand" : "none";
|
|
37
|
+
return parent.key === node && parent.computed !== true ? "none" : "reference";
|
|
38
|
+
}
|
|
39
|
+
if (type === "MemberExpression" || KEYED_MEMBERS.has(type)) return (type === "MemberExpression" ? parent.property : parent.key) === node && parent.computed !== true ? "none" : "reference";
|
|
40
|
+
if (type === "ExportSpecifier") {
|
|
41
|
+
const reexport = ancestors.at(-2)?.source !== null;
|
|
42
|
+
return parent.local === node && !reexport ? "export" : "none";
|
|
43
|
+
}
|
|
44
|
+
if (type === "TSQualifiedName") return parent.right === node ? "none" : "reference";
|
|
45
|
+
return NOT_REFERENCES.has(type) ? "none" : "reference";
|
|
46
|
+
}
|
|
47
|
+
function nodes(value) {
|
|
48
|
+
return Array.isArray(value) ? value.filter(isNode) : [];
|
|
49
|
+
}
|
|
50
|
+
function isNode(value) {
|
|
51
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A child node under a field `Estree` types as something else (`value`, a type
|
|
55
|
+
* parameter's `name`).
|
|
56
|
+
*/
|
|
57
|
+
function child(node, field) {
|
|
58
|
+
const value = Reflect.get(node, field);
|
|
59
|
+
return isNode(value) ? value : void 0;
|
|
60
|
+
}
|
|
61
|
+
function patternNames(pattern, into) {
|
|
62
|
+
if (pattern === null || pattern === void 0) return;
|
|
63
|
+
switch (pattern.type) {
|
|
64
|
+
case "Identifier":
|
|
65
|
+
into.add(pattern.name ?? "");
|
|
66
|
+
return;
|
|
67
|
+
case "ObjectPattern":
|
|
68
|
+
for (const property of nodes(pattern.properties)) patternNames(property.type === "RestElement" ? property.argument : child(property, "value"), into);
|
|
69
|
+
return;
|
|
70
|
+
case "ArrayPattern":
|
|
71
|
+
for (const element of nodes(pattern.elements)) patternNames(element, into);
|
|
72
|
+
return;
|
|
73
|
+
default: patternNames(pattern.left ?? pattern.argument ?? pattern.parameter, into);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const DECLARATIONS_WITH_ID = /* @__PURE__ */ new Set([
|
|
77
|
+
"FunctionDeclaration",
|
|
78
|
+
"ClassDeclaration",
|
|
79
|
+
"TSEnumDeclaration",
|
|
80
|
+
"TSTypeAliasDeclaration",
|
|
81
|
+
"TSInterfaceDeclaration",
|
|
82
|
+
"TSModuleDeclaration",
|
|
83
|
+
"TSImportEqualsDeclaration",
|
|
84
|
+
"TSDeclareFunction"
|
|
85
|
+
]);
|
|
86
|
+
function declareStatement(statement, into) {
|
|
87
|
+
const type = statement.type;
|
|
88
|
+
if (type === "VariableDeclaration") for (const declarator of nodes(statement.declarations)) patternNames(declarator.id, into);
|
|
89
|
+
else if (DECLARATIONS_WITH_ID.has(type)) patternNames(statement.id, into);
|
|
90
|
+
else if (statement.declaration !== null && statement.declaration !== void 0) declareStatement(statement.declaration, into);
|
|
91
|
+
else if (type === "ImportDeclaration") for (const spec of nodes(statement.specifiers)) patternNames(spec.local, into);
|
|
92
|
+
}
|
|
93
|
+
const BLOCK_SCOPES = /* @__PURE__ */ new Set([
|
|
94
|
+
"Program",
|
|
95
|
+
"BlockStatement",
|
|
96
|
+
"StaticBlock",
|
|
97
|
+
"TSModuleBlock"
|
|
98
|
+
]);
|
|
99
|
+
const FUNCTION_SCOPES = /* @__PURE__ */ new Set([
|
|
100
|
+
"FunctionDeclaration",
|
|
101
|
+
"FunctionExpression",
|
|
102
|
+
"ArrowFunctionExpression",
|
|
103
|
+
"TSDeclareFunction"
|
|
104
|
+
]);
|
|
105
|
+
/**
|
|
106
|
+
* The names a node declares for the code inside it; `undefined` for a node that
|
|
107
|
+
* opens no scope.
|
|
108
|
+
*/
|
|
109
|
+
function scopeBindings(node) {
|
|
110
|
+
const names = /* @__PURE__ */ new Set();
|
|
111
|
+
const declare = (statements) => {
|
|
112
|
+
for (const statement of statements) if (statement !== null && statement !== void 0) declareStatement(statement, names);
|
|
113
|
+
};
|
|
114
|
+
const type = node.type;
|
|
115
|
+
let opens = true;
|
|
116
|
+
if (BLOCK_SCOPES.has(type)) declare(nodes(node.body));
|
|
117
|
+
else if (FUNCTION_SCOPES.has(type)) {
|
|
118
|
+
for (const param of nodes(node.params)) patternNames(param, names);
|
|
119
|
+
patternNames(type === "FunctionExpression" ? node.id : void 0, names);
|
|
120
|
+
} else if (type === "ClassExpression") patternNames(node.id, names);
|
|
121
|
+
else if (type === "ForStatement") declare([node.init]);
|
|
122
|
+
else if (type === "ForInStatement" || type === "ForOfStatement") declare([node.left]);
|
|
123
|
+
else if (type === "CatchClause") patternNames(node.param, names);
|
|
124
|
+
else if (type === "SwitchStatement") declare(nodes(node.cases).flatMap((branch) => nodes(branch.consequent)));
|
|
125
|
+
else if (type === "TSMappedType") patternNames(node.key, names);
|
|
126
|
+
else opens = false;
|
|
127
|
+
for (const param of nodes(node.typeParameters?.params)) {
|
|
128
|
+
opens = true;
|
|
129
|
+
patternNames(child(param, "name"), names);
|
|
130
|
+
}
|
|
131
|
+
return opens ? names : void 0;
|
|
132
|
+
}
|
|
133
|
+
function bindingsCached(node, cache) {
|
|
134
|
+
let found = cache.get(node);
|
|
135
|
+
if (found === void 0) {
|
|
136
|
+
found = scopeBindings(node) ?? null;
|
|
137
|
+
cache.set(node, found);
|
|
138
|
+
}
|
|
139
|
+
return found;
|
|
140
|
+
}
|
|
141
|
+
function applyEdits(source, edits) {
|
|
142
|
+
let out = source;
|
|
143
|
+
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);
|
|
144
|
+
return out;
|
|
145
|
+
}
|
|
146
|
+
function position(lineAt, index) {
|
|
147
|
+
const { line, lineStart } = lineAt(index);
|
|
148
|
+
return {
|
|
149
|
+
line,
|
|
150
|
+
column: index - lineStart + 1
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function lineIndex(source) {
|
|
154
|
+
const starts = [0];
|
|
155
|
+
for (let i = 0; i < source.length; i += 1) if (source.charCodeAt(i) === 10) starts.push(i + 1);
|
|
156
|
+
return (index) => {
|
|
157
|
+
let low = 0;
|
|
158
|
+
let high = starts.length - 1;
|
|
159
|
+
while (low < high) {
|
|
160
|
+
const mid = low + high + 1 >> 1;
|
|
161
|
+
if ((starts[mid] ?? 0) <= index) low = mid;
|
|
162
|
+
else high = mid - 1;
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
line: low + 1,
|
|
166
|
+
lineStart: starts[low] ?? 0
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Every node in source order with its parent and ancestors: Oxc nodes carry no
|
|
172
|
+
* parent, so enter and exit keep a stack.
|
|
173
|
+
*/
|
|
174
|
+
function walk(program, visit) {
|
|
175
|
+
const stack = [];
|
|
176
|
+
const handlers = {};
|
|
177
|
+
for (const type of visitorKeyTypes()) {
|
|
178
|
+
handlers[type] = (node) => {
|
|
179
|
+
visit(node, stack.at(-1), stack);
|
|
180
|
+
stack.push(node);
|
|
181
|
+
};
|
|
182
|
+
handlers[`${type}:exit`] = () => {
|
|
183
|
+
stack.pop();
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
createVisitor(handlers).visit(program);
|
|
187
|
+
}
|
|
188
|
+
export { nameOf as a, referencePlace as c, lineIndex as i, scopeBindings as l, bindingsCached as n, nodes as o, child as r, position as s, applyEdits as t, walk as u };
|
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
import { r as isRecord } from "./compact-C4LFuqbW.js";
|
|
2
|
+
// src/cli/sql/statements.ts
|
|
3
|
+
const IDENT_CHAR = /[\p{L}\p{N}_$\u0080-\uFFFF]/u;
|
|
4
|
+
const DOLLAR_TAG = /^\$(?:[\p{L}_\u0080-\uFFFF][\p{L}\p{N}_\u0080-\uFFFF]*)?\$/u;
|
|
5
|
+
/** The index just past a block comment that starts at `from`; they nest. */
|
|
6
|
+
function blockCommentEnd(sql, from) {
|
|
7
|
+
let depth = 1;
|
|
8
|
+
let at = from + 2;
|
|
9
|
+
while (at < sql.length && depth > 0) if (sql[at] === "/" && sql[at + 1] === "*") {
|
|
10
|
+
depth += 1;
|
|
11
|
+
at += 2;
|
|
12
|
+
} else if (sql[at] === "*" && sql[at + 1] === "/") {
|
|
13
|
+
depth -= 1;
|
|
14
|
+
at += 2;
|
|
15
|
+
} else at += 1;
|
|
16
|
+
return at;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The index just past a quoted run that opens at `from`. A doubled quote is an
|
|
20
|
+
* escaped quote; a backslash escapes only when `backslash` is set (`E'..'`).
|
|
21
|
+
*/
|
|
22
|
+
function quotedEnd(sql, from, quote, backslash) {
|
|
23
|
+
let at = from + 1;
|
|
24
|
+
while (at < sql.length) if (backslash && sql[at] === "\\") at += 2;
|
|
25
|
+
else if (sql[at] !== quote) at += 1;
|
|
26
|
+
else if (sql[at + 1] === quote) at += 2;
|
|
27
|
+
else return at + 1;
|
|
28
|
+
return sql.length;
|
|
29
|
+
}
|
|
30
|
+
/** The index just past a dollar-quoted body that opens at `from`, or -1. */
|
|
31
|
+
function dollarEnd(sql, from) {
|
|
32
|
+
if (IDENT_CHAR.test(sql[from - 1] ?? " ")) return -1;
|
|
33
|
+
const tag = DOLLAR_TAG.exec(sql.slice(from, from + 80))?.[0];
|
|
34
|
+
if (tag === void 0) return -1;
|
|
35
|
+
const end = sql.indexOf(tag, from + tag.length);
|
|
36
|
+
return end === -1 ? sql.length : end + tag.length;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The statements of `sql` as `text` with comments blanked (same length, so
|
|
40
|
+
* offsets hold) and the index of each `;` between them. A reader that knows
|
|
41
|
+
* Postgres lexing: `--` inside a string is text, a doubled quote and a
|
|
42
|
+
* backslash in an `E''` string escape a quote, `"a;b"` is one identifier,
|
|
43
|
+
* dollar-quoted bodies nest nothing and block comments nest.
|
|
44
|
+
*/
|
|
45
|
+
function lex(sql) {
|
|
46
|
+
const parts = [];
|
|
47
|
+
const cuts = [];
|
|
48
|
+
let copied = 0;
|
|
49
|
+
const blank = (from, to) => {
|
|
50
|
+
parts.push(sql.slice(copied, from), sql.slice(from, to).split("\n").map((line) => " ".repeat(line.length)).join("\n"));
|
|
51
|
+
copied = to;
|
|
52
|
+
};
|
|
53
|
+
let index = 0;
|
|
54
|
+
while (index < sql.length) {
|
|
55
|
+
const char = sql[index];
|
|
56
|
+
const next = sql[index + 1];
|
|
57
|
+
let end = -1;
|
|
58
|
+
if (char === "-" && next === "-") {
|
|
59
|
+
const eol = sql.indexOf("\n", index);
|
|
60
|
+
end = eol === -1 ? sql.length : eol;
|
|
61
|
+
blank(index, end);
|
|
62
|
+
} else if (char === "/" && next === "*") {
|
|
63
|
+
end = blockCommentEnd(sql, index);
|
|
64
|
+
blank(index, end);
|
|
65
|
+
} else if (char === "'") {
|
|
66
|
+
const before = sql[index - 1];
|
|
67
|
+
const escapes = (before === "E" || before === "e") && !IDENT_CHAR.test(sql[index - 2] ?? " ");
|
|
68
|
+
end = quotedEnd(sql, index, "'", escapes);
|
|
69
|
+
} else if (char === "\"") end = quotedEnd(sql, index, "\"", false);
|
|
70
|
+
else if (char === "$") end = dollarEnd(sql, index);
|
|
71
|
+
else if (char === ";") cuts.push(index);
|
|
72
|
+
index = end === -1 ? index + 1 : end;
|
|
73
|
+
}
|
|
74
|
+
parts.push(sql.slice(copied));
|
|
75
|
+
return {
|
|
76
|
+
text: parts.join(""),
|
|
77
|
+
cuts
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function statementRanges(sql) {
|
|
81
|
+
const { text, cuts } = lex(sql);
|
|
82
|
+
const statements = [];
|
|
83
|
+
let counted = 0;
|
|
84
|
+
let line = 1;
|
|
85
|
+
let start = 0;
|
|
86
|
+
for (const end of [...cuts, text.length]) {
|
|
87
|
+
const body = text.slice(start, end);
|
|
88
|
+
const trimmed = body.trim();
|
|
89
|
+
if (trimmed !== "") {
|
|
90
|
+
const at = start + (body.length - body.trimStart().length);
|
|
91
|
+
for (let cursor = counted; cursor < at; cursor += 1) if (text[cursor] === "\n") line += 1;
|
|
92
|
+
counted = at;
|
|
93
|
+
statements.push({
|
|
94
|
+
line,
|
|
95
|
+
text: trimmed,
|
|
96
|
+
start: at,
|
|
97
|
+
end: Math.min(end + 1, sql.length)
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
start = end + 1;
|
|
101
|
+
}
|
|
102
|
+
return statements;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Split on `;` outside strings, quoted identifiers, comments and dollar-quoted
|
|
106
|
+
* bodies.
|
|
107
|
+
*/
|
|
108
|
+
function sqlStatements(sql) {
|
|
109
|
+
return statementRanges(sql).map(({ line, text }) => ({
|
|
110
|
+
line,
|
|
111
|
+
text
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
/** Capture group `index` of a match, or '' when an optional group took no part. */
|
|
115
|
+
function group(match, index) {
|
|
116
|
+
return match[index] ?? "";
|
|
117
|
+
}
|
|
118
|
+
const VIEW = /^create\s+(?:or\s+replace\s+)?view\s+(?<name>\S+?)(?:\s+with\s*\((?<options>[^)]*)\))?\s+as\b/iu;
|
|
119
|
+
const PRIVILEGE = /^(?:grant|revoke)\s[\s\S]*?\son\s+(?<target>[\s\S]+?)\s+(?:to|from)\s/iu;
|
|
120
|
+
const UNDIFFED_TARGET = /^(?:schema|function|procedure|routine|all\s+(?:functions|procedures|routines)\s+in\s+schema)\s/iu;
|
|
121
|
+
/** Spaces, an optional line comment and the newline after a statement's `;`. */
|
|
122
|
+
const TRAILING = /^[ \t]*(?:--[^\n]*)?(?:\r?\n|$)/u;
|
|
123
|
+
function privilegeTable(target) {
|
|
124
|
+
return target.replace(/^table\s+/iu, "").trim();
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The statements `supabase db diff` drops, moved out of `sql`. A moved
|
|
128
|
+
* statement keeps its inner comments; a comment after its `;` on the same line
|
|
129
|
+
* goes with it.
|
|
130
|
+
*/
|
|
131
|
+
function splitUndiffed(sql) {
|
|
132
|
+
const views = /* @__PURE__ */ new Set();
|
|
133
|
+
const moved = [];
|
|
134
|
+
const cuts = [];
|
|
135
|
+
for (const { text, start, end } of statementRanges(sql)) {
|
|
136
|
+
const view = VIEW.exec(text)?.groups;
|
|
137
|
+
if (view !== void 0) {
|
|
138
|
+
views.add(view["name"] ?? "");
|
|
139
|
+
if (view["options"] !== void 0) moved.push(`alter view ${view["name"] ?? ""} set (${view["options"]});`);
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const target = PRIVILEGE.exec(text)?.groups?.["target"];
|
|
143
|
+
if (target !== void 0 && (UNDIFFED_TARGET.test(target) || views.has(privilegeTable(target)))) {
|
|
144
|
+
moved.push(sql.slice(start, end));
|
|
145
|
+
const rest = TRAILING.exec(sql.slice(end))?.[0] ?? "";
|
|
146
|
+
cuts.push({
|
|
147
|
+
from: start,
|
|
148
|
+
to: end + rest.length
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
let kept = sql;
|
|
153
|
+
for (const { from, to } of cuts.toReversed()) kept = kept.slice(0, from) + kept.slice(to);
|
|
154
|
+
return {
|
|
155
|
+
kept,
|
|
156
|
+
moved
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
// src/cli/sql/ast.ts
|
|
160
|
+
/**
|
|
161
|
+
* Maps the byte offsets libpg_query reports onto string indices, so every range
|
|
162
|
+
* this layer returns indexes the JavaScript string.
|
|
163
|
+
*/
|
|
164
|
+
function charIndex(text) {
|
|
165
|
+
if (Buffer.byteLength(text) === text.length) return (byte) => byte;
|
|
166
|
+
const map = [];
|
|
167
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
168
|
+
const code = text.codePointAt(index) ?? 0;
|
|
169
|
+
const size = Buffer.byteLength(String.fromCodePoint(code));
|
|
170
|
+
for (let byte = 0; byte < size; byte += 1) map.push(index);
|
|
171
|
+
if (code > 65535) index += 1;
|
|
172
|
+
}
|
|
173
|
+
map.push(text.length);
|
|
174
|
+
return (byte) => map[byte] ?? text.length;
|
|
175
|
+
}
|
|
176
|
+
/** The index of the first character that is neither white space nor a comment. */
|
|
177
|
+
function skipTrivia(text, from, to) {
|
|
178
|
+
let at = from;
|
|
179
|
+
while (at < to) {
|
|
180
|
+
const char = text[at];
|
|
181
|
+
if (char !== void 0 && /\s/u.test(char)) at += 1;
|
|
182
|
+
else if (char === "-" && text[at + 1] === "-") {
|
|
183
|
+
const end = text.indexOf("\n", at);
|
|
184
|
+
at = end === -1 || end > to ? to : end + 1;
|
|
185
|
+
} else if (char === "/" && text[at + 1] === "*") {
|
|
186
|
+
let depth = 1;
|
|
187
|
+
let cursor = at + 2;
|
|
188
|
+
while (cursor < to && depth > 0) if (text[cursor] === "/" && text[cursor + 1] === "*") {
|
|
189
|
+
depth += 1;
|
|
190
|
+
cursor += 2;
|
|
191
|
+
} else if (text[cursor] === "*" && text[cursor + 1] === "/") {
|
|
192
|
+
depth -= 1;
|
|
193
|
+
cursor += 2;
|
|
194
|
+
} else cursor += 1;
|
|
195
|
+
at = cursor;
|
|
196
|
+
} else break;
|
|
197
|
+
}
|
|
198
|
+
return at;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Loads libpg_query on the first parse, not at import: `rls generate` imports
|
|
202
|
+
* this layer, and a cold `permdock generate` that parses no SQL measured 60 to
|
|
203
|
+
* 160 ms slower and 30 to 110 MB larger with the static import.
|
|
204
|
+
*/
|
|
205
|
+
async function libpgParse(text) {
|
|
206
|
+
return (await import("pgsql-parser")).parse(text);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Parses a SQL file into statements with typed nodes and string ranges.
|
|
210
|
+
*
|
|
211
|
+
* @throws {SqlSyntaxError} When libpg_query rejects the file; it names the line
|
|
212
|
+
* and column.
|
|
213
|
+
*/
|
|
214
|
+
async function parseSqlFile(text) {
|
|
215
|
+
let result;
|
|
216
|
+
try {
|
|
217
|
+
result = await libpgParse(text);
|
|
218
|
+
} catch (error) {
|
|
219
|
+
throw syntaxError(text, error);
|
|
220
|
+
}
|
|
221
|
+
const at = charIndex(text);
|
|
222
|
+
const nodes = [];
|
|
223
|
+
let line = 1;
|
|
224
|
+
let counted = 0;
|
|
225
|
+
for (const entry of result.stmts ?? []) {
|
|
226
|
+
const wrapper = entry.stmt;
|
|
227
|
+
if (!isRecord(wrapper)) continue;
|
|
228
|
+
const kind = Object.keys(wrapper)[0];
|
|
229
|
+
const node = kind === void 0 ? void 0 : wrapper[kind];
|
|
230
|
+
if (kind === void 0 || !isRecord(node)) continue;
|
|
231
|
+
const from = at(entry.stmt_location ?? 0);
|
|
232
|
+
const to = entry.stmt_len === void 0 || entry.stmt_len === 0 ? text.length : at((entry.stmt_location ?? 0) + entry.stmt_len);
|
|
233
|
+
const start = skipTrivia(text, from, to);
|
|
234
|
+
let end = to;
|
|
235
|
+
while (end > start && /\s/u.test(text[end - 1] ?? "x")) end -= 1;
|
|
236
|
+
if (text[end - 1] === ";") end -= 1;
|
|
237
|
+
for (let cursor = counted; cursor < start; cursor += 1) if (text[cursor] === "\n") line += 1;
|
|
238
|
+
counted = start;
|
|
239
|
+
nodes.push({
|
|
240
|
+
kind,
|
|
241
|
+
node,
|
|
242
|
+
start,
|
|
243
|
+
end,
|
|
244
|
+
line,
|
|
245
|
+
text: text.slice(start, end)
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
return nodes;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* `parseSqlFile`, except that a file libpg_query rejects is split on `;` and
|
|
252
|
+
* every statement it accepts is kept, so one bad statement in a migration does
|
|
253
|
+
* not hide the rest. `rejected` holds the statements it refused.
|
|
254
|
+
*/
|
|
255
|
+
async function parseSqlStatements(text) {
|
|
256
|
+
try {
|
|
257
|
+
return {
|
|
258
|
+
nodes: await parseSqlFile(text),
|
|
259
|
+
rejected: []
|
|
260
|
+
};
|
|
261
|
+
} catch (error) {
|
|
262
|
+
if (!(error instanceof SqlSyntaxError)) throw error;
|
|
263
|
+
}
|
|
264
|
+
const nodes = [];
|
|
265
|
+
const rejected = [];
|
|
266
|
+
for (const range of statementRanges(text)) {
|
|
267
|
+
let parsed;
|
|
268
|
+
try {
|
|
269
|
+
parsed = await parseSqlFile(text.slice(range.start, range.end));
|
|
270
|
+
} catch (error) {
|
|
271
|
+
if (error instanceof SqlSyntaxError) {
|
|
272
|
+
rejected.push(range);
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
throw error;
|
|
276
|
+
}
|
|
277
|
+
for (const node of parsed) nodes.push({
|
|
278
|
+
...node,
|
|
279
|
+
start: node.start + range.start,
|
|
280
|
+
end: node.end + range.start,
|
|
281
|
+
line: node.line + range.line - 1
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
return {
|
|
285
|
+
nodes,
|
|
286
|
+
rejected
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
/** The statements of `parseSqlStatements`, without the rejected ones. */
|
|
290
|
+
async function parseSqlLenient(text) {
|
|
291
|
+
return (await parseSqlStatements(text)).nodes;
|
|
292
|
+
}
|
|
293
|
+
/** The `RangeVar` node of `relation`, or `undefined` for another value. */
|
|
294
|
+
function readRelation(relation) {
|
|
295
|
+
if (!isRecord(relation) || typeof relation["relname"] !== "string") return;
|
|
296
|
+
return {
|
|
297
|
+
schema: typeof relation["schemaname"] === "string" ? relation["schemaname"] : void 0,
|
|
298
|
+
name: relation["relname"],
|
|
299
|
+
persistence: typeof relation["relpersistence"] === "string" ? relation["relpersistence"] : "p"
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
/** `String` nodes' values, in order; another node gives nothing. */
|
|
303
|
+
function stringValues(list) {
|
|
304
|
+
return (Array.isArray(list) ? list : []).flatMap((item) => {
|
|
305
|
+
const string = isRecord(item) ? item["String"] : void 0;
|
|
306
|
+
return isRecord(string) && typeof string["sval"] === "string" ? [string["sval"]] : [];
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
const POLICY_COMMANDS = /* @__PURE__ */ new Set([
|
|
310
|
+
"all",
|
|
311
|
+
"select",
|
|
312
|
+
"insert",
|
|
313
|
+
"update",
|
|
314
|
+
"delete"
|
|
315
|
+
]);
|
|
316
|
+
function isPolicyCommand(value) {
|
|
317
|
+
return typeof value === "string" && POLICY_COMMANDS.has(value);
|
|
318
|
+
}
|
|
319
|
+
/** The policy a `CreatePolicyStmt` declares, or `undefined` for another node. */
|
|
320
|
+
function readPolicy(statement) {
|
|
321
|
+
if (statement.kind !== "CreatePolicyStmt") return;
|
|
322
|
+
const { node } = statement;
|
|
323
|
+
const relation = node["table"];
|
|
324
|
+
if (!isRecord(relation) || typeof relation["relname"] !== "string") return;
|
|
325
|
+
const roles = (Array.isArray(node["roles"]) ? node["roles"] : []).flatMap((role) => {
|
|
326
|
+
const spec = isRecord(role) ? role["RoleSpec"] : void 0;
|
|
327
|
+
if (!isRecord(spec)) return [];
|
|
328
|
+
return typeof spec["rolename"] === "string" ? [spec["rolename"]] : spec["roletype"] === "ROLESPEC_PUBLIC" ? ["public"] : [];
|
|
329
|
+
});
|
|
330
|
+
return {
|
|
331
|
+
name: typeof node["policy_name"] === "string" ? node["policy_name"] : "",
|
|
332
|
+
schema: typeof relation["schemaname"] === "string" ? relation["schemaname"] : "public",
|
|
333
|
+
table: relation["relname"],
|
|
334
|
+
command: isPolicyCommand(node["cmd_name"]) ? node["cmd_name"] : "all",
|
|
335
|
+
permissive: node["permissive"] === true,
|
|
336
|
+
roles: roles.length === 0 ? ["public"] : roles,
|
|
337
|
+
...node["qual"] === void 0 ? {} : { using: node["qual"] },
|
|
338
|
+
...node["with_check"] === void 0 ? {} : { check: node["with_check"] }
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
const SIGNATURE_MODES = /* @__PURE__ */ new Set([
|
|
342
|
+
"FUNC_PARAM_DEFAULT",
|
|
343
|
+
"FUNC_PARAM_IN",
|
|
344
|
+
"FUNC_PARAM_INOUT",
|
|
345
|
+
"FUNC_PARAM_VARIADIC"
|
|
346
|
+
]);
|
|
347
|
+
function typeName(argType) {
|
|
348
|
+
if (!isRecord(argType) || !Array.isArray(argType["names"])) return "";
|
|
349
|
+
const name = argType["names"].map((part) => isRecord(part) && isRecord(part["String"]) ? String(part["String"]["sval"]) : "").join(".");
|
|
350
|
+
const bounds = Array.isArray(argType["arrayBounds"]) ? argType["arrayBounds"].length : 0;
|
|
351
|
+
return `${name}${"[]".repeat(bounds)}`;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* The input argument types of a `create function` or `create procedure`, as
|
|
355
|
+
* written: `["text", "uuid[]"]`. Output and `table` columns are not part of the
|
|
356
|
+
* signature.
|
|
357
|
+
*/
|
|
358
|
+
function functionArgTypes(statement) {
|
|
359
|
+
if (statement.kind !== "CreateFunctionStmt") return;
|
|
360
|
+
const parameters = statement.node["parameters"];
|
|
361
|
+
return (Array.isArray(parameters) ? parameters : []).flatMap((item) => {
|
|
362
|
+
const parameter = isRecord(item) ? item["FunctionParameter"] : void 0;
|
|
363
|
+
return isRecord(parameter) && SIGNATURE_MODES.has(String(parameter["mode"])) ? [typeName(parameter["argType"])] : [];
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
/** Every `FuncCall` under `expr`, in source order. */
|
|
367
|
+
function sqlCalls(expr) {
|
|
368
|
+
const out = [];
|
|
369
|
+
const visit = (value, inSubquery) => {
|
|
370
|
+
if (Array.isArray(value)) {
|
|
371
|
+
for (const item of value) visit(item, inSubquery);
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
if (!isRecord(value)) return;
|
|
375
|
+
for (const [key, child] of Object.entries(value)) {
|
|
376
|
+
if (key === "FuncCall" && isRecord(child)) {
|
|
377
|
+
const parts = Array.isArray(child["funcname"]) ? child["funcname"] : [];
|
|
378
|
+
out.push({
|
|
379
|
+
name: parts.flatMap((part) => {
|
|
380
|
+
const string = isRecord(part) ? part["String"] : void 0;
|
|
381
|
+
return isRecord(string) && typeof string["sval"] === "string" ? [string["sval"].toLowerCase()] : [];
|
|
382
|
+
}),
|
|
383
|
+
node: child,
|
|
384
|
+
inSubquery
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
visit(child, inSubquery || key === "SubLink");
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
visit(expr, false);
|
|
391
|
+
return out;
|
|
392
|
+
}
|
|
393
|
+
/** A parse failure with the position libpg_query reported. */
|
|
394
|
+
var SqlSyntaxError = class extends Error {
|
|
395
|
+
line;
|
|
396
|
+
column;
|
|
397
|
+
constructor(message, line, column) {
|
|
398
|
+
super(`${message} (line ${String(line)}, column ${String(column)})`);
|
|
399
|
+
this.name = "SqlSyntaxError";
|
|
400
|
+
this.line = line;
|
|
401
|
+
this.column = column;
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
function syntaxError(text, error) {
|
|
405
|
+
const details = isRecord(error) ? error["sqlDetails"] : void 0;
|
|
406
|
+
const cursor = isRecord(details) && typeof details["cursorPosition"] === "number" ? details["cursorPosition"] : 0;
|
|
407
|
+
const before = text.slice(0, cursor);
|
|
408
|
+
const line = before.split("\n").length;
|
|
409
|
+
const column = before.length - before.lastIndexOf("\n");
|
|
410
|
+
return new SqlSyntaxError(isRecord(details) && typeof details["message"] === "string" ? details["message"] : error instanceof Error ? error.message : "invalid SQL", line, column);
|
|
411
|
+
}
|
|
412
|
+
/** The index just past the `;` that ends a statement, and one newline after it. */
|
|
413
|
+
function afterTerminator(text, end) {
|
|
414
|
+
let at = end;
|
|
415
|
+
while (at < text.length && /[^\S\n]/u.test(text[at] ?? "x")) at += 1;
|
|
416
|
+
if (text[at] === ";") at += 1;
|
|
417
|
+
while (at < text.length && /[^\S\n]/u.test(text[at] ?? "x")) at += 1;
|
|
418
|
+
return text[at] === "\n" ? at + 1 : at;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* `text` without the statements `predicate` selects, each with its `;` and line
|
|
422
|
+
* break.
|
|
423
|
+
*/
|
|
424
|
+
function removeStatements(text, statements, predicate) {
|
|
425
|
+
let out = "";
|
|
426
|
+
let cursor = 0;
|
|
427
|
+
for (const statement of statements) {
|
|
428
|
+
if (!predicate(statement)) continue;
|
|
429
|
+
out += text.slice(cursor, statement.start);
|
|
430
|
+
cursor = afterTerminator(text, statement.end);
|
|
431
|
+
}
|
|
432
|
+
return out + text.slice(cursor);
|
|
433
|
+
}
|
|
434
|
+
export { parseSqlFile as a, readPolicy as c, sqlCalls as d, stringValues as f, statementRanges as g, sqlStatements as h, isPolicyCommand as i, readRelation as l, splitUndiffed as m, charIndex as n, parseSqlLenient as o, group as p, functionArgTypes as r, parseSqlStatements as s, SqlSyntaxError as t, removeStatements as u };
|
package/dist/astro/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { D as ConnectionOptions, T as Connection, f as InvalidSignatureError, i as OpenApiHooks, o as ProtectOptions, u as SnapshotQuery, v as discoverViaSignatureAgent, x as webBotAuthVerifier } from "../server-types-
|
|
2
|
-
import { a as OperationInput, t as Operation } from "../operations-
|
|
3
|
-
import { a as PermDock } from "../permdock-
|
|
4
|
-
import { w as Permission } from "../vocabulary-
|
|
5
|
-
import { D as Policy,
|
|
6
|
-
import { a as ProtectTarget, i as PermDockHandlers, n as FetchAdapterOptions, t as ContextReader } from "../fetch-adapter-
|
|
1
|
+
import { D as ConnectionOptions, T as Connection, f as InvalidSignatureError, i as OpenApiHooks, o as ProtectOptions, u as SnapshotQuery, v as discoverViaSignatureAgent, x as webBotAuthVerifier } from "../server-types-C2XX60aF.js";
|
|
2
|
+
import { a as OperationInput, t as Operation } from "../operations-DaEoGpMV.js";
|
|
3
|
+
import { a as PermDock } from "../permdock-BShHM8OJ.js";
|
|
4
|
+
import { w as Permission } from "../vocabulary-DHfKPIC5.js";
|
|
5
|
+
import { D as Policy, Er as Principal, N as PolicyVocabulary, nn as Snapshot } from "../policy-types-CfW4X_yX.js";
|
|
6
|
+
import { a as ProtectTarget, i as PermDockHandlers, n as FetchAdapterOptions, t as ContextReader } from "../fetch-adapter-CJncmsPg.js";
|
|
7
7
|
import { APIContext, MiddlewareHandler } from "astro";
|
|
8
8
|
type AstroPermDockOptions<TUser = unknown> = FetchAdapterOptions<APIContext, TUser>;
|
|
9
9
|
/** What the adapter sets on `context.locals`. */
|
package/dist/astro/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as InvalidSignatureError, g as webBotAuthVerifier, p as discoverViaSignatureAgent } from "../evaluations-
|
|
2
|
-
import { n as guardedRoute, r as instanceRoute, t as fetchAdapter } from "../fetch-adapter-
|
|
1
|
+
import { f as InvalidSignatureError, g as webBotAuthVerifier, p as discoverViaSignatureAgent } from "../evaluations-DPEAu_jM.js";
|
|
2
|
+
import { n as guardedRoute, r as instanceRoute, t as fetchAdapter } from "../fetch-adapter-CU1DIkXu.js";
|
|
3
3
|
// src/astro/create.ts
|
|
4
4
|
const route = {
|
|
5
5
|
context: (context) => context,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as whoCan } from "./who-can-
|
|
1
|
+
import { t as whoCan } from "./who-can-CGVpM3fZ.js";
|
|
2
2
|
// src/delivery/audience.ts
|
|
3
3
|
async function granted(permdock, ids, permission, row) {
|
|
4
4
|
const unique = [...new Set(ids.filter((id) => typeof id === "string" && id !== ""))];
|
package/dist/authzen/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { m as ApprovalStore } from "../types-
|
|
2
|
-
import { t as InstanceOptions } from "../instance-options-
|
|
3
|
-
import { p as WhereResult } from "../permdock-
|
|
4
|
-
import { D as Policy,
|
|
5
|
-
import { a as ProblemDetails } from "../errors-
|
|
6
|
-
import { a as evaluationsSemantic, n as EvaluationsSemantic, r as evaluateBatch, t as EVALUATIONS_SEMANTICS } from "../evaluations-
|
|
1
|
+
import { m as ApprovalStore } from "../types-vKKndyxx.js";
|
|
2
|
+
import { t as InstanceOptions } from "../instance-options-DQCiBBuz.js";
|
|
3
|
+
import { p as WhereResult } from "../permdock-BShHM8OJ.js";
|
|
4
|
+
import { D as Policy, Er as Principal, Sr as Delegation, gr as Actor } from "../policy-types-CfW4X_yX.js";
|
|
5
|
+
import { a as ProblemDetails } from "../errors-COoiWqIs.js";
|
|
6
|
+
import { a as evaluationsSemantic, n as EvaluationsSemantic, r as evaluateBatch, t as EVALUATIONS_SEMANTICS } from "../evaluations-GW9j_ARq.js";
|
|
7
7
|
type AuthzenEntity = {
|
|
8
8
|
readonly type?: unknown;
|
|
9
9
|
readonly id?: unknown;
|
package/dist/authzen/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { n as resolveOrNull, t as buildInstance } from "../build-instance-
|
|
1
|
+
import { n as resolveOrNull, t as buildInstance } from "../build-instance-CFiegi_w.js";
|
|
2
2
|
import { r as isRecord, t as compact } from "../compact-C4LFuqbW.js";
|
|
3
3
|
import { r as ownGet } from "../paths-CeS_gpHf.js";
|
|
4
|
-
import { a as getResource, c as listPermissions } from "../permission-registry-
|
|
4
|
+
import { a as getResource, c as listPermissions } from "../permission-registry-DstT40VS.js";
|
|
5
5
|
import { a as problemType, o as statusProblem } from "../problem-details-EJHcvYCz.js";
|
|
6
6
|
import { n as resourceRef } from "../resource-ref-BiQtFK-I.js";
|
|
7
|
-
import { a as evaluationReasons, c as withRequestId, d as wireResourceId, i as evaluateBatch, l as itemResourceData, n as applyApprovalResume, r as authzenMetadata, s as evaluationsSemantic, t as EVALUATIONS_SEMANTICS, u as permissionLookup } from "../evaluations-
|
|
7
|
+
import { a as evaluationReasons, c as withRequestId, d as wireResourceId, i as evaluateBatch, l as itemResourceData, n as applyApprovalResume, r as authzenMetadata, s as evaluationsSemantic, t as EVALUATIONS_SEMANTICS, u as permissionLookup } from "../evaluations-DPEAu_jM.js";
|
|
8
8
|
import { r as hasCredentials } from "../http-C9jDw_bZ.js";
|
|
9
9
|
import { d as unauthenticatedProblem, l as problemResponse, o as methodNotAllowed } from "../problem-BZB7zPC7.js";
|
|
10
10
|
import { t as fromWireDelegation } from "../wire-delegation-DC5Cyec4.js";
|