permdock 0.32.0 → 0.35.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/dist/a2a/index.d.ts +4 -4
- package/dist/a2a/index.js +2 -2
- package/dist/{adoption-scan-BJMEEu7V.js → adoption-scan-oaPsvHSN.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 +3 -3
- package/dist/ai-sdk/index.js +3 -3
- package/dist/app/index.d.ts +1 -1
- package/dist/app/index.js +1 -1
- package/dist/{approval-chain-D97rgMoA.js → approval-chain-BEeExHpb.js} +15 -10
- package/dist/{approval-prompt-yNyhQqn8.d.ts → approval-prompt-BKxaKtby.d.ts} +1 -1
- package/dist/approvals/index.d.ts +3 -3
- package/dist/{arazzo-BAgh0PT6.js → arazzo-1oDMApA_.js} +2 -2
- package/dist/{arazzo-C_xK2Kaa.js → arazzo-B2PszcDL.js} +1 -1
- package/dist/astro/index.d.ts +4 -4
- package/dist/astro/index.js +1 -1
- package/dist/{audience-CARf-b-R.js → audience-B6DQ5wQu.js} +1 -1
- package/dist/authzen/index.d.ts +6 -6
- package/dist/authzen/index.js +1 -1
- package/dist/{automation-0VF1xe4o.d.ts → automation-C7WH5XcZ.d.ts} +1 -1
- package/dist/better-auth/index.d.ts +1 -1
- package/dist/better-supabase/index.d.ts +34 -13
- package/dist/better-supabase/index.js +21 -21
- package/dist/{bind-zQacwAOg.d.ts → bind-BnrOLyJq.d.ts} +7 -7
- package/dist/{bind-BYeoLJgN.js → bind-DPptdk31.js} +2 -2
- package/dist/{bsb-access-tags-CjeR7v7-.js → bsb-access-tags-uDuwPUbT.js} +12 -3
- package/dist/{bsb-action-keys-CYEREFMg.js → bsb-action-keys-BfZAwg-9.js} +1 -1
- package/dist/{budgets-Dpumu_Dt.js → budgets-hi-ecgEd.js} +3 -3
- package/dist/{build-instance-CFiegi_w.js → build-instance-DZEWYO-A.js} +1 -1
- package/dist/bundle-size-BRFeBvuv.js +1 -0
- package/dist/{bundle-size-Ddhv_H_v.js → bundle-size-DbXV65Ix.js} +2 -2
- package/dist/{capability-BPzseilU.d.ts → capability-BW-vAxJi.d.ts} +1 -1
- package/dist/{casbin-BErdqy1J.js → casbin-DrdS0vLy.js} +1 -1
- package/dist/{casbin-EwdKipQs.js → casbin-vtIUd-6L.js} +1 -1
- package/dist/catalog/index.d.ts +4 -4
- package/dist/catalog/index.js +4 -4
- package/dist/{challenge-CRB1X3Ry.js → challenge-E9sicsCA.js} +1 -1
- package/dist/chat/index.d.ts +1 -1
- package/dist/chat/index.js +1 -1
- package/dist/chat-sdk/index.d.ts +3 -3
- package/dist/{claims-size-BsSDVD5u.js → claims-size-BUhCWS88.js} +18 -3
- package/dist/claims-size-C6oKGuOM.js +1 -0
- package/dist/claude-agent/index.d.ts +3 -3
- package/dist/claude-agent/index.js +2 -2
- package/dist/clerk/index.d.ts +2 -2
- package/dist/cli/bin.js +1 -1
- package/dist/cli/generate/watch-worker.js +2 -2
- package/dist/cli/index.d.ts +6 -6
- 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 +1 -1
- package/dist/cli/plugins/powersync.d.ts +1 -1
- package/dist/cli/plugins/powersync.js +1 -1
- 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-xCSkKD1C.d.ts → client-subject-YAGMzRa-.d.ts} +2 -2
- package/dist/cloud/index.d.ts +8 -8
- package/dist/cloud/index.js +1 -1
- package/dist/{cloud-DW3q3qnp.js → cloud-BQnIR-SS.js} +2 -2
- package/dist/{codemod-DVDMFsTX.js → codemod-C0OHCnaj.js} +6 -6
- package/dist/{codemod-CF7NNDzA.js → codemod-rv5XSBNw.js} +1 -1
- package/dist/{collect-CE5wK0AX.js → collect-Ba7ccZ23.js} +1 -1
- package/dist/compile/index.d.ts +1 -1
- package/dist/{compile-BXKYYmT1.js → compile-BRDpja_Y.js} +10 -9
- package/dist/{compile-tG1zkSgX.d.ts → compile-CoUadQXF.d.ts} +2 -2
- package/dist/{completion-B59uPAnZ.js → completion-Dgjdte2-.js} +1 -1
- package/dist/{config-7QvEq57a.js → config-Dan6vcvj.js} +2 -2
- package/dist/{config-VCa1RLUe.js → config-anQ9E37F.js} +1 -1
- package/dist/{config-report-CjvA6lGI.js → config-report-C43BSFHY.js} +3 -3
- package/dist/{config-shape-BTojaD-H.js → config-shape-BODqM-rG.js} +1 -1
- package/dist/{context-BQHKgT1m.js → context-Nr3nknZX.js} +2 -2
- package/dist/{context-CAFddgb9.js → context-rioF4fQl.js} +1 -1
- package/dist/convex/index.d.ts +4 -4
- package/dist/convex/index.js +2 -2
- package/dist/{core-bf8qgaZf.d.ts → core-DCMIztx1.d.ts} +2 -2
- package/dist/{core-C5yCD-Ls.js → core-DIUrkFNL.js} +5 -5
- package/dist/{create-COQVXK6C.js → create-BMRnaZel.js} +3 -3
- package/dist/{create-nOWD3Joc.js → create-BRY0OtFV.js} +3 -3
- package/dist/{create-Cn5EpEez.d.ts → create-BYL8xCJB.d.ts} +4 -4
- package/dist/{create-B7Xa4jSQ.d.ts → create-T_NqxU31.d.ts} +7 -7
- package/dist/{create-DHA0fhmi.d.ts → create-iCwrnaFE.d.ts} +6 -6
- package/dist/{credentials-COT-cjnP.d.ts → credentials-DzNrCNZY.d.ts} +2 -2
- package/dist/{custom-role-rebuild-BK73tPib.js → custom-role-rebuild-wzN8pqDk.js} +5 -5
- package/dist/{define-permdock-DBgwTFi1.d.ts → define-permdock-Bhye7WSY.d.ts} +6 -6
- package/dist/{define-permdock-D7aKxIax.js → define-permdock-CO7YNrOF.js} +2 -2
- package/dist/{definition-options-9o8Hdww3.js → definition-options-DLBlRrPO.js} +8 -9
- package/dist/delivery/index.d.ts +4 -4
- package/dist/delivery/index.js +1 -1
- package/dist/{denied-text-C_AWc0f0.d.ts → denied-text-DgNqDAPH.d.ts} +1 -1
- package/dist/{describe-AdETpWsn.d.ts → describe-DEoWvk00.d.ts} +1 -1
- package/dist/{diff-CW9eZy9X.js → diff-CS8ks9h3.js} +1 -1
- package/dist/{diff-COdwpP31.js → diff-CkSZF7LO.js} +2 -2
- package/dist/{doctor-ervtBRzG.js → doctor-GnMgqGO8.js} +102 -42
- package/dist/{doctor-ELj5hrVv.js → doctor-sAqU02Fx.js} +2 -2
- package/dist/drizzle/index.d.ts +3 -3
- package/dist/elysia/index.d.ts +4 -4
- package/dist/elysia/index.js +1 -1
- package/dist/{errors-COoiWqIs.d.ts → errors-BliKrfmP.d.ts} +1 -1
- package/dist/{evaluate-Dmd0bShm.js → evaluate-DNz6wMYv.js} +1 -1
- package/dist/{evaluations-GW9j_ARq.d.ts → evaluations-CUkSKioS.d.ts} +3 -3
- package/dist/{evaluator-eager-CpVYslzY.js → evaluator-eager-BLNVbEAC.js} +1 -1
- package/dist/evaluator-zpeC7zel.js +2 -0
- package/dist/eve/index.d.ts +4 -4
- package/dist/eve/index.js +2 -2
- package/dist/{execute-ix7AAdWg.js → execute-xF5fwAel.js} +4 -4
- package/dist/{explain-DRC9V5Qb.js → explain-D4ipf8IH.js} +1 -1
- package/dist/{explain-jg0KLCVt.js → explain-DISCeeYS.js} +2 -2
- package/dist/express/index.d.ts +4 -4
- package/dist/express/index.js +1 -1
- package/dist/fastify/index.d.ts +4 -4
- package/dist/fastify/index.js +1 -1
- package/dist/{fetch-adapter-CU1DIkXu.js → fetch-adapter-BXQc4NoV.js} +1 -1
- package/dist/{fetch-adapter-CJncmsPg.d.ts → fetch-adapter-Ds2-fUUi.d.ts} +2 -2
- package/dist/{fields-y_PSRCyJ.js → fields-CwFej4gp.js} +3 -3
- package/dist/{from-snapshot-DGc9W4QU.js → from-snapshot-DZ4D2sLa.js} +14 -9
- package/dist/gen-BPYFr_tZ.js +1 -0
- package/dist/{gen-8rW_AUG5.js → gen-djPw1RS-.js} +3 -3
- package/dist/{gen-kind-C9ikF8nb.js → gen-kind-Vhq_ZIZm.js} +1 -1
- package/dist/{generate-CW7gNfLr.js → generate-BcH-uL0z.js} +18 -17
- package/dist/{generate-BmpCt5oi.js → generate-CYHeuPq8.js} +3 -3
- package/dist/{generate-options-DiR4r_sk.js → generate-options-DDSeUTFU.js} +15 -14
- package/dist/h3/index.d.ts +4 -4
- package/dist/h3/index.js +2 -2
- package/dist/{helper-calls-DHvgN9tr.js → helper-calls-B5MOl99d.js} +1 -1
- package/dist/hono/index.d.ts +4 -4
- package/dist/hono/index.js +1 -1
- package/dist/{hook-sql-D-abRHut.js → hook-sql-EksAnz-T.js} +269 -225
- package/dist/{hosted-DZwCFrcy.js → hosted-D3USbpS6.js} +1 -1
- package/dist/{hosted-Bkw3Oyh-.d.ts → hosted-DZgmEG4b.d.ts} +1 -1
- package/dist/identity-scopes-CRVAV0HU.js +11 -0
- package/dist/{import-D_8tLF9g.js → import-Bz6IKoMM.js} +3 -3
- package/dist/{import-BAhoTYTk.js → import-C45gc74U.js} +1 -1
- package/dist/{index-DPVeDtAO.d.ts → index-BOJPdIBk.d.ts} +4 -4
- package/dist/{index-xShPsK8G.d.ts → index-CAE_Z53Y.d.ts} +1 -1
- package/dist/{index-Kj5S3IWE.d.ts → index-CWBCzwOp.d.ts} +4 -4
- package/dist/{index-DT3hOxA7.d.ts → index-Cjr8Q-uq.d.ts} +34 -11
- package/dist/{index-WOx7TBbj.d.ts → index-DBBRSw6r.d.ts} +2 -2
- package/dist/{index-DWmIuQLz.d.ts → index-ktQ7E4qB.d.ts} +4 -4
- package/dist/index.d.ts +16 -16
- package/dist/index.js +13 -13
- package/dist/{init-zxb0BVDJ.js → init-B6aZxzd7.js} +1 -1
- package/dist/{init-DkRHIe8-.js → init-CCBVeyW8.js} +3 -3
- package/dist/inspect-functions-BUACOlgS.js +34 -0
- package/dist/{instance-options-DQCiBBuz.d.ts → instance-options-DDERlopm.d.ts} +1 -1
- package/dist/{instance-snapshot-D9kjL37B.js → instance-snapshot-D03srwnf.js} +9 -8
- package/dist/{interactive-only-Dqww0ABO.js → interactive-only-Bbq9e61G.js} +10 -182
- package/dist/jwt/index.d.ts +4 -4
- package/dist/{kernel-C5akxw5n.js → kernel-DSnWVZ0O.js} +5 -5
- package/dist/{keys-DQsHrgBM.js → keys-BWhAnANj.js} +1 -1
- package/dist/kysely/index.d.ts +3 -3
- package/dist/{lazy-provider-CMgFAGf8.d.ts → lazy-provider-Clt2095H.d.ts} +1 -1
- package/dist/{lazy-provider-DNVjY4n3.js → lazy-provider-b8UHGi8P.js} +2 -2
- package/dist/{login-C1p3gmj8.js → login-BnE2iUUA.js} +1 -1
- package/dist/{login-DOEZveP6.js → login-d631Tpa9.js} +3 -3
- package/dist/{manager-chain-DdkiCw5q.js → manager-chain-CFkceFls.js} +2 -2
- package/dist/{manifest-31igzVGQ.js → manifest-1w67doim.js} +45 -38
- package/dist/{manifest-DgsxeAsM.d.ts → manifest-BwhZ1s5b.d.ts} +35 -3
- package/dist/{manifest-B487A3po.js → manifest-CIWOmdlP.js} +1 -1
- package/dist/{manifest-schema-D7RQbnGY.js → manifest-schema-N3v2RVL-.js} +24 -0
- package/dist/{may-use-4HzzgYJ3.js → may-use-ikNCnNgZ.js} +1 -1
- package/dist/mcp/index.d.ts +8 -8
- package/dist/mcp/index.js +2 -2
- package/dist/measure-BKsYdwKd.js +272 -0
- package/dist/membership-claim-sql-DGfhIn__.js +33 -0
- package/dist/{membership-filter-C7ZuhAqJ.js → membership-filter-Bz9QX6E9.js} +1 -1
- package/dist/memberships-4e6qi8Uv.js +1 -0
- package/dist/memberships-CNoAlsma.js +180 -0
- package/dist/{migrate-pg-lkbDu.js → migrate-BXk_rUmb.js} +2 -2
- package/dist/{model-BXhr8gUI.js → model-BYCtXS_g.js} +3 -3
- package/dist/{module-values-B09BBJIj.js → module-values-D-AiNhBp.js} +1 -1
- package/dist/names-DBxKx2bz.js +182 -0
- package/dist/nest/index.d.ts +4 -4
- package/dist/nest/index.js +1 -1
- package/dist/next/index.d.ts +11 -11
- package/dist/next/index.js +3 -3
- package/dist/next/plugin.d.ts +1 -1
- package/dist/next/plugin.js +1 -1
- package/dist/node/index.d.ts +4 -4
- package/dist/node/index.js +1 -1
- package/dist/openai/index.d.ts +4 -4
- package/dist/openai/index.js +3 -3
- package/dist/openapi/index.d.ts +2 -2
- package/dist/{openapi-BeMVHVY4.js → openapi-BnKSxOrh.js} +2 -2
- package/dist/{openapi-DEGesHWH.js → openapi-CN2Oq9zN.js} +1 -1
- package/dist/{openapi-document-CEQ6jqqR.js → openapi-document-XnGRbWBb.js} +1 -1
- package/dist/orpc/index.d.ts +5 -5
- package/dist/orpc/index.js +2 -2
- package/dist/otel/index.d.ts +3 -3
- package/dist/{output-C7EPeSZj.js → output-dO4bArCS.js} +1 -1
- package/dist/{ownership-Csk9C3Js.js → ownership-CSdLGGfW.js} +7 -6
- package/dist/{parse-local-manifest-B92rFWnk.d.ts → parse-local-manifest-DoLQFkRb.d.ts} +1 -1
- package/dist/pdp/index.d.ts +3 -3
- package/dist/pdp/index.js +1 -1
- package/dist/{permdock-BShHM8OJ.d.ts → permdock-DkvkGVF0.d.ts} +2 -2
- package/dist/{permdock-CJPIwU1T.js → permdock-JM9TKevZ.js} +14 -14
- package/dist/{permissions-wEkTVr_I.js → permissions-xPyAmuXi.js} +1 -1
- package/dist/{pipeline-Bbu7uw28.js → pipeline-BAGSNnct.js} +2 -2
- package/dist/{plugin-L3G7jPGE.d.ts → plugin-DDPXES4k.d.ts} +2 -2
- package/dist/{policy-BUtwixSN.d.ts → policy-BoUbJ2c0.d.ts} +1 -1
- package/dist/{policy-CSOOQ3rR.js → policy-CTn-9VQm.js} +1 -1
- package/dist/{policy-BBvhhH9X.js → policy-CZBJDcTx.js} +2 -1
- package/dist/{policy-bundle-KYI0EnrM.js → policy-bundle-BHd1dqU9.js} +3 -3
- package/dist/{policy-from-catalog-_zwn1sNj.js → policy-from-catalog-BohzTN3J.js} +3 -3
- package/dist/{policy-types-CfW4X_yX.d.ts → policy-types-DuM3k5Ao.d.ts} +51 -2
- package/dist/{postgrest-PQ3zAOD2.d.ts → postgrest-B1bTbVE4.d.ts} +9 -2
- package/dist/{powersync-C1ix7CEY.js → powersync-CZkZgVyi.js} +1 -1
- package/dist/{powersync-CM6Vg4RH.js → powersync-DJ7dY-Vf.js} +12 -12
- package/dist/{powersync-CGvu6j5U.js → powersync-Jj57J-X8.js} +1 -1
- package/dist/prisma/index.d.ts +2 -2
- package/dist/{protected-action-BPN0NaRb.js → protected-action-DDYvU-9Z.js} +1 -1
- package/dist/{protected-action-DhCQ4bSe.d.ts → protected-action-gBxeetqY.d.ts} +5 -5
- package/dist/{provider-BV_v0JAY.js → provider-BwqzED5h.js} +83 -50
- package/dist/{provider-CMgFAGf8.d.ts → provider-Clt2095H.d.ts} +1 -1
- package/dist/{provider-1xqxLVEz.js → provider-NQwLSlgb.js} +2 -2
- package/dist/{provider-store-Cf8HRNtb.js → provider-store-BizF6jyu.js} +2 -2
- package/dist/{provider-with-cpL9vRjC.js → provider-with-DtBgCCV_.js} +1 -1
- package/dist/{prune-config-CdoPJIGz.js → prune-config-Bwz4wNQA.js} +6 -6
- package/dist/pull-BOC-0kJV.js +1 -0
- package/dist/{pull-BaB401Bk.js → pull-Cj_ngsuu.js} +2 -2
- package/dist/{push-DcjvEj0m.js → push-D5so0ptb.js} +2 -2
- package/dist/{pushed-policy-DcvO8NXy.d.ts → pushed-policy-C65TbLtU.d.ts} +1 -1
- package/dist/{pushed-policy-DSjSWEAl.js → pushed-policy-dm_hFstN.js} +1 -1
- package/dist/{quote-BKrTBbcH.js → quote-LNaBdCGA.js} +1 -1
- package/dist/{rbac-mblGDx-Z.js → rbac-DbyaaNLa.js} +5 -4
- 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 +15 -15
- package/dist/react-native/index.js +6 -6
- package/dist/read-memberships-DVBitJZG.js +164 -0
- package/dist/{rename-BZNOV8H9.js → rename-CI6NIF9t.js} +5 -5
- package/dist/replay-B__gzUx3.d.ts +3 -0
- package/dist/{report-DCAiUc5U.js → report-DF0zUNut.js} +1 -1
- package/dist/{report-DievqWhf.js → report-XdCm1y_J.js} +1 -1
- package/dist/{request-context-BNVY3kZ1.js → request-context-CqqdiVp4.js} +1 -1
- package/dist/resend/index.d.ts +4 -4
- package/dist/{resolve-config-9NYYVc30.js → resolve-config-Cu_mE2wt.js} +1 -1
- package/dist/{resolve-names-Cth1UQ-8.js → resolve-names-CuEhEQyB.js} +7 -6
- package/dist/{resolver-CuIY8aFD.js → resolver-D2c1CcoZ.js} +99 -15
- package/dist/{rls-DUYok5e9.js → rls-BDtyip5c.js} +13 -13
- package/dist/{rls-BtkZgaZp.js → rls-DcqSn7b2.js} +51 -4
- package/dist/{rls-files-ucAI0J5j.js → rls-files-CRRtjXxG.js} +1 -1
- package/dist/{rls-options-BFGRmdcH.d.ts → rls-options-DCLdZaTZ.d.ts} +1 -1
- package/dist/{rpc-D7G7IJDa.js → rpc-BQPa7tLP.js} +1 -1
- package/dist/{rpc-COnquydd.d.ts → rpc-BYFB37KV.d.ts} +1 -1
- package/dist/run-DOP1UKWw.js +1 -0
- package/dist/{run-WIqPbnjD.js → run-DvbrPkgt.js} +3 -3
- package/dist/{run-ticket-Mmor5sYW.d.ts → run-ticket-CRldclc7.d.ts} +2 -2
- package/dist/{saas-DcqUkynn.js → saas-DSeazNrN.js} +3 -3
- package/dist/{scan-Badcllgg.js → scan-CmfWbAbz.js} +1 -1
- package/dist/{schema-DBRKgQb4.js → schema-CO3btX_O.js} +1 -1
- package/dist/scim/index.d.ts +1 -1
- package/dist/seeds/index.d.ts +1 -1
- package/dist/{seeds-Cih1ztkf.d.ts → seeds-BZMPfWcC.d.ts} +1 -1
- package/dist/server/index.d.ts +11 -11
- package/dist/server/index.js +1 -1
- package/dist/{server-types-C2XX60aF.d.ts → server-types-FkdDSB9h.d.ts} +8 -8
- package/dist/share-key-claims-CZGAeVqa.js +28 -0
- package/dist/{shared-C6_T7QUo.js → shared-DnVY767H.js} +2 -1
- package/dist/{sink-BQ_6K81r.d.ts → sink-CoMI_OVw.d.ts} +2 -2
- package/dist/{size-l1pDHE2z.js → size-CY6rK6l9.js} +3 -3
- package/dist/{skills-CTKq3o8D.js → skills-C28GUaJC.js} +1 -1
- package/dist/{skills-Ba9hHGO6.js → skills-CA8GfQxQ.js} +1 -1
- package/dist/{snapshot-Ty0uk9wZ.js → snapshot-Dzi4LR6n.js} +8 -1
- package/dist/{snapshot-cache-DGvLQW0-.d.ts → snapshot-cache-R1lJjYmI.d.ts} +1 -1
- package/dist/{snapshot-compact-yXFxZLPo.js → snapshot-compact-BWMLnIXK.js} +35 -4
- package/dist/{snapshot-evaluate-DSNj2rhV.js → snapshot-evaluate-C382Z1mQ.js} +1 -1
- package/dist/{snapshot-reads-BnAHiuoa.js → snapshot-reads-JxcUSUfW.js} +2 -2
- package/dist/{snapshot-size-DNY1MTsV.js → snapshot-size-D6ixbYvH.js} +1 -1
- package/dist/{snapshot-size-2fkXbCkP.js → snapshot-size-NklqBKcV.js} +1 -1
- package/dist/solid/index.d.ts +5 -5
- package/dist/solid/index.js +2 -2
- package/dist/solid-start/index.d.ts +4 -4
- package/dist/solid-start/index.js +2 -2
- package/dist/{sources-DnjJPGfb.js → sources-C6Id63F8.js} +2 -1
- package/dist/{sources-CjgZns7t.d.ts → sources-Dp6FQ8np.d.ts} +7 -2
- package/dist/{src-HRYn4UFj.js → src-BXDohWNO.js} +154 -11
- package/dist/ssf/index.d.ts +3 -3
- package/dist/{standard-webhooks-Bnnrqa6d.d.ts → standard-webhooks-D2FwHtMX.d.ts} +2 -2
- package/dist/{store-core-BdFcruPm.d.ts → store-core-aluQ3R1M.d.ts} +4 -4
- package/dist/{store-options-DpCQo0vB.js → store-options-DgOuhUSn.js} +4 -4
- package/dist/{stores-D6MIjN_-.d.ts → stores-hHICuiQl.d.ts} +5 -5
- package/dist/{stores-KpBCaY6c.js → stores-jgDndNHa.js} +1 -1
- package/dist/{subject-CrldGifz.js → subject-B7p94Y0s.js} +1 -1
- package/dist/{subject-cache-CnJcz2K_.d.ts → subject-cache-Bn4oJY_R.d.ts} +3 -1
- package/dist/supabase/index.d.ts +36 -9
- package/dist/supabase/index.js +8 -7
- package/dist/supabase/middleware.d.ts +5 -5
- package/dist/supabase/middleware.js +4 -4
- package/dist/{supabase-kWQlkrHw.js → supabase-ByhSqBDB.js} +14 -7
- package/dist/{supabase-CGiB83XQ.js → supabase-DXEcFJGM.js} +15 -1
- package/dist/supabase-hook-C_ViYz3g.js +2 -0
- package/dist/{supabase-hook-CqO_0Koh.js → supabase-hook-D-ybV98H.js} +7 -7
- package/dist/{supabase-schemas-BglbAG2Z.js → supabase-schemas-CVhpyYB6.js} +2 -2
- package/dist/svelte/index.d.ts +5 -5
- package/dist/svelte/index.js +5 -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 +4 -4
- package/dist/sveltekit/index.js +1 -1
- package/dist/{table-reads-BviGc0L_.js → table-reads-BcceuV7h.js} +1 -1
- package/dist/{table-reads-AnHPrBp8.js → table-reads-BoF_58yh.js} +297 -48
- package/dist/{tables-CDq0HVVq.js → tables-BTXmioCH.js} +187 -20
- package/dist/tanstack-start/index.d.ts +4 -4
- package/dist/tanstack-start/index.js +1 -1
- package/dist/{tenant-check-D7g9oNVH.js → tenant-check-DNbm8OiV.js} +4 -4
- package/dist/terminal/index.d.ts +5 -5
- package/dist/terminal/index.js +3 -3
- package/dist/testing/core.d.ts +1 -1
- package/dist/testing/core.js +1 -1
- package/dist/testing/fixtures/index.d.ts +4 -4
- package/dist/testing/fixtures/index.js +29 -11
- package/dist/testing/index.d.ts +23 -23
- package/dist/testing/index.js +13 -13
- package/dist/testing/saas/index.d.ts +3 -3
- package/dist/testing/saas/index.js +2 -2
- package/dist/testing/saas/permissions.js +1 -1
- package/dist/trpc/index.d.ts +5 -5
- package/dist/trpc/index.js +2 -2
- package/dist/{type-helpers-CUmJFGV6.d.ts → type-helpers-CsWH9z8p.d.ts} +1 -1
- package/dist/{types-vKKndyxx.d.ts → types-BGN3coSe.d.ts} +1 -1
- package/dist/{types-h9W3CNC_.d.ts → types-BwjOhlgx.d.ts} +4 -4
- package/dist/{types-BKnUwgvx.d.ts → types-BzsplNgO.d.ts} +4 -4
- package/dist/{types-BsRf5rKk.d.ts → types-CBUYbPwl.d.ts} +2 -2
- package/dist/{types-euUv1wsO.d.ts → types-CKwI6AT4.d.ts} +1 -1
- package/dist/{types-CIzXPPV-.d.ts → types-Cvfe-G_N.d.ts} +2 -2
- package/dist/{types-BhBfMdQ5.d.ts → types-D3GI2B9O.d.ts} +3 -3
- package/dist/{types-BRECeQ2n.d.ts → types-D417woMp.d.ts} +3 -3
- package/dist/{types-DwoRXDvN.d.ts → types-DRMoZjJm.d.ts} +2 -2
- package/dist/{types-config-DNIw_Gt5.d.ts → types-config-DYRoZ8Iw.d.ts} +11 -5
- package/dist/{types-CjZscT16.d.ts → types-dtDg4goh.d.ts} +4 -4
- package/dist/{types-run-Bwn1MuW0.d.ts → types-run-CeCrWO0v.d.ts} +1 -1
- package/dist/unplugin/index.d.ts +1 -1
- package/dist/unplugin/index.js +1 -1
- package/dist/{usage-CW6xhRcV.js → usage-BGuSrwiW.js} +2 -2
- package/dist/usage-CW6PfRfC.js +1 -0
- package/dist/{usage-n4V2k_a6.js → usage-D5QwWiNp.js} +1 -1
- package/dist/{validation-error-P4Z9HUuP.d.ts → validation-error-MZ7KLNHt.d.ts} +1 -1
- package/dist/{verify-CKzngsUH.js → verify-GWeopgxU.js} +12 -12
- package/dist/{version-cache-BzK8dwJy.js → version-cache-Ccrfu2A4.js} +6 -1
- package/dist/vue/index.d.ts +5 -5
- package/dist/vue/index.js +2 -2
- package/dist/{waiter-BqUxSRxq.d.ts → waiter-DdwtUSzB.d.ts} +2 -2
- package/dist/{warm-5yxlUmBh.js → warm-BZ0ZwSmO.js} +1 -1
- package/dist/{warm-BR-mrnY-.d.ts → warm-znYuJoUZ.d.ts} +1 -1
- package/dist/{watch-D-5ztqN8.js → watch-14vng0pg.js} +1 -1
- package/dist/watch-Be7ja4dL.js +1 -0
- package/dist/{watch-C12Ub7x4.js → watch-DuIAsqFR.js} +2 -2
- package/dist/webmcp/index.d.ts +1 -1
- package/dist/webmcp/index.js +1 -1
- package/dist/{who-can-CGVpM3fZ.js → who-can-CIgYpEvy.js} +1 -1
- package/dist/workflow/index.d.ts +3 -3
- package/dist/workflow/index.js +1 -1
- package/dist/workflow-sdk/index.d.ts +4 -4
- package/dist/{wrap-D8WtzrB7.d.ts → wrap-C36-eV-C.d.ts} +2 -2
- package/package.json +11 -11
- package/schemas/snapshot-v2.json +20 -0
- package/schemas/supabase-claims-v1.json +48 -2
- package/schemas/supabase-manifest-v1.json +28 -0
- package/skills/permdock-data/references/queries-and-rls.md +1 -1
- package/dist/bundle-size-DwZ4e1gu.js +0 -1
- package/dist/claims-size-B6j0Ff4Q.js +0 -1
- package/dist/evaluator-COmATWCr.js +0 -2
- package/dist/gen-BtiGMiuH.js +0 -1
- package/dist/pull-Bp63vtgu.js +0 -1
- package/dist/read-memberships-BkePIa1F.js +0 -63
- package/dist/replay-BCOZifwx.d.ts +0 -3
- package/dist/run-BjMxYYTe.js +0 -1
- package/dist/supabase-hook-CluYxKee.js +0 -2
- package/dist/usage-Ci7Glu-H.js +0 -1
- package/dist/watch-J1PfGMfb.js +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { r as isRecord } from "./compact-C4LFuqbW.js";
|
|
2
2
|
import { d as scopeList } from "./scopes-B-KX9EI8.js";
|
|
3
|
-
import { n as parseSupabaseManifest } from "./manifest-
|
|
3
|
+
import { n as parseSupabaseManifest } from "./manifest-CIWOmdlP.js";
|
|
4
4
|
import { i as readJsonFile } from "./files-DAR51W3J.js";
|
|
5
5
|
import { t as MANIFEST_FILE } from "./manifest-json-DMaBWmcG.js";
|
|
6
6
|
import { i as loadConfiguredPolicy } from "./load-m7jmit3y.js";
|
|
7
7
|
import { a as parseSqlFile, c as readPolicy, d as sqlCalls, f as stringValues, t as SqlSyntaxError } from "./ast-Dnm2TOHN.js";
|
|
8
8
|
import { i as taggedAccessPolicies } from "./bsb-access-Bcw6GrQm.js";
|
|
9
|
-
import { a as droppedPolicy, s as reportFiles, u as isPlatformSchema } from "./report-
|
|
10
|
-
import { a as tryKeyReasons, n as tenantCheck, r as keyReason } from "./tenant-check-
|
|
9
|
+
import { a as droppedPolicy, s as reportFiles, u as isPlatformSchema } from "./report-XdCm1y_J.js";
|
|
10
|
+
import { a as tryKeyReasons, n as tenantCheck, r as keyReason, t as svals } from "./tenant-check-DNbm8OiV.js";
|
|
11
11
|
import { existsSync, readFileSync } from "node:fs";
|
|
12
12
|
import { join, relative } from "node:path";
|
|
13
13
|
// src/cli/rls/shared-functions.ts
|
|
@@ -78,56 +78,71 @@ function definitionOf(node) {
|
|
|
78
78
|
const security = defs["security"];
|
|
79
79
|
const definer = isRecord(security) ? isRecord(security["Boolean"]) && security["Boolean"]["boolval"] === true : false;
|
|
80
80
|
const volatility = sval(defs["volatility"]);
|
|
81
|
+
const language = sval(defs["language"]);
|
|
81
82
|
return {
|
|
82
83
|
schema: schema.toLowerCase(),
|
|
83
84
|
name: name.toLowerCase(),
|
|
84
85
|
body: bodyOf(defs["as"]),
|
|
86
|
+
header: `language ${language ?? "unstated"}, security ${definer ? "definer" : "invoker"}, ${volatility ?? "volatile"}`,
|
|
85
87
|
eligible: sval(defs["language"]) === "sql" && !definer && (volatility === "stable" || volatility === "immutable")
|
|
86
88
|
};
|
|
87
89
|
}
|
|
88
90
|
/**
|
|
89
|
-
* The tables a body reads and the functions it calls, or
|
|
90
|
-
* reads the caller, calls a function outside `known`, or reads a relation
|
|
91
|
-
* is not a table in `reads`.
|
|
91
|
+
* The tables a body reads and the functions it calls, or why it is not shared:
|
|
92
|
+
* it reads the caller, calls a function outside `known`, or reads a relation
|
|
93
|
+
* that is not a table in `reads`.
|
|
92
94
|
*/
|
|
93
|
-
async function readsOf(definition, defined, reads, helperSchema) {
|
|
95
|
+
async function readsOf$1(definition, defined, reads, helperSchema) {
|
|
94
96
|
let statements;
|
|
95
97
|
try {
|
|
96
98
|
statements = await parseSqlFile(definition.body);
|
|
97
99
|
} catch (error) {
|
|
98
|
-
if (error instanceof SqlSyntaxError) return;
|
|
100
|
+
if (error instanceof SqlSyntaxError) return "the body does not parse";
|
|
99
101
|
throw error;
|
|
100
102
|
}
|
|
101
103
|
const tables = /* @__PURE__ */ new Set();
|
|
102
104
|
const calls = /* @__PURE__ */ new Set();
|
|
105
|
+
const keys = /* @__PURE__ */ new Set();
|
|
103
106
|
for (const statement of statements) {
|
|
104
|
-
if (statement.kind !== "SelectStmt") return
|
|
105
|
-
if (collect(statement.node, "SQLValueFunction").some((value) => isRecord(value) && typeof value["op"] === "string" && IDENTITY_VALUES.has(value["op"]))) return;
|
|
107
|
+
if (statement.kind !== "SelectStmt") return `the body holds a ${statement.kind}, not a select`;
|
|
108
|
+
if (collect(statement.node, "SQLValueFunction").some((value) => isRecord(value) && typeof value["op"] === "string" && IDENTITY_VALUES.has(value["op"]))) return "it reads current_user, session_user or user";
|
|
106
109
|
const ctes = new Set(collect(statement.node, "CommonTableExpr").flatMap((value) => isRecord(value) && typeof value["ctename"] === "string" ? [value["ctename"].toLowerCase()] : []));
|
|
107
110
|
for (const value of collect(statement.node, "RangeVar")) {
|
|
108
|
-
if (!isRecord(value) || typeof value["relname"] !== "string") return;
|
|
111
|
+
if (!isRecord(value) || typeof value["relname"] !== "string") return "it reads a relation inspect cannot name";
|
|
109
112
|
const relname = value["relname"].toLowerCase();
|
|
110
113
|
const explicit = typeof value["schemaname"] === "string" ? value["schemaname"].toLowerCase() : void 0;
|
|
111
114
|
if (explicit === void 0 && ctes.has(relname)) continue;
|
|
112
|
-
const
|
|
113
|
-
|
|
115
|
+
const candidates = (explicit === void 0 ? [definition.schema, DEFAULT_SCHEMA] : [explicit]).map((schema) => `${schema}.${relname}`);
|
|
116
|
+
const found = candidates.find((table) => reads.has(table));
|
|
117
|
+
if (found === void 0) return `it reads ${candidates[0] ?? relname}, which is no table the schema files create`;
|
|
114
118
|
tables.add(found);
|
|
115
119
|
}
|
|
116
120
|
for (const call of sqlCalls(statement.node)) {
|
|
117
121
|
const last = call.name.at(-1);
|
|
118
122
|
const schema = call.name.length > 1 ? call.name[0] : void 0;
|
|
119
|
-
if (last === void 0 || IDENTITY_FUNCTIONS.has(last) || schema === "auth") return
|
|
120
|
-
if (schema === helperSchema)
|
|
123
|
+
if (last === void 0 || IDENTITY_FUNCTIONS.has(last) || schema === "auth") return `it reads the caller through ${call.name.join(".")}()`;
|
|
124
|
+
if (schema === helperSchema) {
|
|
125
|
+
const key = permissionFilterKey(call, helperSchema);
|
|
126
|
+
if (key === void 0) return `it calls the helper ${call.name.join(".")}(), which is not a permissionFilters helper`;
|
|
127
|
+
if (typeof key !== "string") return `it calls ${call.name.join(".")}() with a permission key that is not a string literal, so the key cannot join the share key`;
|
|
128
|
+
keys.add(key);
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
121
131
|
const target = (schema === void 0 ? [`${definition.schema}.${last}`, `${DEFAULT_SCHEMA}.${last}`] : [`${schema}.${last}`]).find((name) => defined.has(name));
|
|
122
132
|
if (target !== void 0) calls.add(target);
|
|
123
|
-
else if (schema !== void 0 && schema !== "pg_catalog") return
|
|
133
|
+
else if (schema !== void 0 && schema !== "pg_catalog") return `it calls ${call.name.join(".")}(), which no schema file defines`;
|
|
124
134
|
}
|
|
125
135
|
}
|
|
126
136
|
return {
|
|
127
137
|
tables,
|
|
128
|
-
calls
|
|
138
|
+
calls,
|
|
139
|
+
keys
|
|
129
140
|
};
|
|
130
141
|
}
|
|
142
|
+
/** Why `definition` fails the header checks, or `undefined`. */
|
|
143
|
+
function headerReason(definition) {
|
|
144
|
+
return definition.eligible ? void 0 : `it is not language sql, security invoker and stable or immutable (${definition.header})`;
|
|
145
|
+
}
|
|
131
146
|
/**
|
|
132
147
|
* `rls.sharedFunctions`: the functions better-supabase's doctor BS430 accepts
|
|
133
148
|
* in a `share: "tenant"` fill, read from the same SQL files as `tableReads`. A
|
|
@@ -140,6 +155,37 @@ async function readsOf(definition, defined, reads, helperSchema) {
|
|
|
140
155
|
* function wins.
|
|
141
156
|
*/
|
|
142
157
|
async function sharedFunctionsOf(input) {
|
|
158
|
+
const outcomes = await analyse(input);
|
|
159
|
+
return [...outcomes.keys()].toSorted().flatMap((name) => {
|
|
160
|
+
const shared = outcomes.get(name)?.shared;
|
|
161
|
+
return shared === void 0 ? [] : [shared];
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/** `*` matches any run of characters, every other character itself. */
|
|
165
|
+
function matcher(pattern) {
|
|
166
|
+
const source = pattern.split("*").map((part) => part.replaceAll(/[.+?^${}()|[\]\\]/gu, String.raw`\$&`)).join(".*");
|
|
167
|
+
const regex = new RegExp(`^${source}$`, "u");
|
|
168
|
+
return (name) => regex.test(name);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* For each function the schema files define whose `schema.name` matches
|
|
172
|
+
* `pattern` (`public.*_payload`), a pass or every reason `sharedFunctionsOf`
|
|
173
|
+
* does not list it: a header it fails, a read of the caller, an unknown call,
|
|
174
|
+
* or the `row` table it reads with the rules that make it so.
|
|
175
|
+
*/
|
|
176
|
+
async function functionShares(input, pattern) {
|
|
177
|
+
const matches = matcher(pattern.toLowerCase());
|
|
178
|
+
const outcomes = await analyse(input);
|
|
179
|
+
return [...outcomes.keys()].filter((name) => matches(name)).toSorted().map((name) => {
|
|
180
|
+
const outcome = outcomes.get(name);
|
|
181
|
+
return {
|
|
182
|
+
function: name,
|
|
183
|
+
shared: outcome?.shared !== void 0,
|
|
184
|
+
reasons: outcome?.reasons ?? []
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
async function analyse(input) {
|
|
143
189
|
const reads = new Map(input.tableReads.map((read) => [read.table, read]));
|
|
144
190
|
const byArity = /* @__PURE__ */ new Map();
|
|
145
191
|
for (const file of reportFiles(input.cwd, input.config)) {
|
|
@@ -165,23 +211,31 @@ async function sharedFunctionsOf(input) {
|
|
|
165
211
|
}
|
|
166
212
|
const helperSchema = input.schema.toLowerCase();
|
|
167
213
|
const analysed = /* @__PURE__ */ new Map();
|
|
214
|
+
const reasons = /* @__PURE__ */ new Map();
|
|
168
215
|
for (const [name, overloads] of defined) {
|
|
169
216
|
const merged = [];
|
|
217
|
+
const why = [];
|
|
170
218
|
for (const definition of overloads) {
|
|
171
|
-
const found = definition
|
|
172
|
-
if (found ===
|
|
173
|
-
merged.push(found);
|
|
219
|
+
const found = headerReason(definition) ?? await readsOf$1(definition, defined, reads, helperSchema);
|
|
220
|
+
if (typeof found === "string") why.push(found);
|
|
221
|
+
else merged.push(found);
|
|
174
222
|
}
|
|
175
|
-
|
|
223
|
+
reasons.set(name, why);
|
|
224
|
+
if (why.length === 0 && merged.length > 0) analysed.set(name, {
|
|
176
225
|
tables: new Set(merged.flatMap((entry) => [...entry.tables])),
|
|
177
|
-
calls: new Set(merged.flatMap((entry) => [...entry.calls]))
|
|
226
|
+
calls: new Set(merged.flatMap((entry) => [...entry.calls])),
|
|
227
|
+
keys: new Set(merged.flatMap((entry) => [...entry.keys]))
|
|
178
228
|
});
|
|
179
229
|
}
|
|
180
230
|
for (let changed = true; changed;) {
|
|
181
231
|
changed = false;
|
|
182
|
-
for (const [name, entry] of analysed)
|
|
183
|
-
analysed.
|
|
184
|
-
|
|
232
|
+
for (const [name, entry] of analysed) {
|
|
233
|
+
const gone = [...entry.calls].filter((call) => !analysed.has(call));
|
|
234
|
+
if (gone.length > 0) {
|
|
235
|
+
analysed.delete(name);
|
|
236
|
+
reasons.set(name, gone.map((call) => `it calls ${call}, which is not shared`));
|
|
237
|
+
changed = true;
|
|
238
|
+
}
|
|
185
239
|
}
|
|
186
240
|
}
|
|
187
241
|
const close = (name, seen) => {
|
|
@@ -189,18 +243,56 @@ async function sharedFunctionsOf(input) {
|
|
|
189
243
|
seen.add(name);
|
|
190
244
|
for (const call of analysed.get(name)?.calls ?? []) close(call, seen);
|
|
191
245
|
};
|
|
192
|
-
|
|
246
|
+
const outcomes = /* @__PURE__ */ new Map();
|
|
247
|
+
for (const name of defined.keys()) {
|
|
248
|
+
if (!analysed.has(name)) {
|
|
249
|
+
outcomes.set(name, { reasons: reasons.get(name) ?? [] });
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
193
252
|
const reached = /* @__PURE__ */ new Set();
|
|
194
253
|
close(name, reached);
|
|
195
254
|
const tables = /* @__PURE__ */ new Set();
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
255
|
+
const filterKeys = /* @__PURE__ */ new Set();
|
|
256
|
+
for (const member of reached) {
|
|
257
|
+
const entry = analysed.get(member);
|
|
258
|
+
for (const table of entry?.tables ?? []) tables.add(table);
|
|
259
|
+
for (const key of entry?.keys ?? []) filterKeys.add(key);
|
|
260
|
+
}
|
|
261
|
+
const rows = [...tables].toSorted().filter((table) => reads.get(table)?.share !== "tenant");
|
|
262
|
+
if (tables.size === 0 || rows.length > 0) {
|
|
263
|
+
outcomes.set(name, { reasons: tables.size === 0 ? ["it reads no table"] : rows.map((table) => rowReason(table, reads.get(table))) });
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
outcomes.set(name, {
|
|
267
|
+
reasons: [],
|
|
268
|
+
shared: {
|
|
269
|
+
function: name,
|
|
270
|
+
tables: [...tables].toSorted(),
|
|
271
|
+
permissions: [.../* @__PURE__ */ new Set([...[...tables].flatMap((table) => reads.get(table)?.permissions ?? []), ...filterKeys])].toSorted()
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
return outcomes;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* The string literal a call passes to a `permissionFilters` helper, `false`
|
|
279
|
+
* when the helper is one but the key is not a string literal, or `undefined`
|
|
280
|
+
* when the call is not such a helper. Better-supabase 0.87 adds only a string
|
|
281
|
+
* literal to the share key.
|
|
282
|
+
*/
|
|
283
|
+
function permissionFilterKey(call, helperSchema) {
|
|
284
|
+
const name = call.name.at(-1);
|
|
285
|
+
if ((call.name.length > 1 ? call.name[0] : void 0) !== helperSchema || name === void 0 || !name.endsWith("_has_active") && !name.endsWith("_permission_keys_active")) return;
|
|
286
|
+
const [first] = Array.isArray(call.node["args"]) ? call.node["args"] : [];
|
|
287
|
+
const cast = isRecord(first) ? first["TypeCast"] : void 0;
|
|
288
|
+
const inner = isRecord(cast) && isRecord(cast["arg"]) ? cast["arg"] : first;
|
|
289
|
+
const constant = isRecord(inner) ? inner["A_Const"] : void 0;
|
|
290
|
+
const value = isRecord(constant) && isRecord(constant["sval"]) ? constant["sval"]["sval"] : void 0;
|
|
291
|
+
return typeof value === "string" ? value : false;
|
|
292
|
+
}
|
|
293
|
+
/** The `row` table a function reads, under which rule and why. */
|
|
294
|
+
function rowReason(table, read) {
|
|
295
|
+
return `it reads ${table}, a row table (rule ${read?.rules?.join(", ") ?? "unknown"})${read?.reason === void 0 ? "" : `: ${read.reason}`}`;
|
|
204
296
|
}
|
|
205
297
|
/**
|
|
206
298
|
* `rls.tenantPureHelpers`: the helpers of the root scope that answer from the
|
|
@@ -225,16 +317,126 @@ function tenantPureHelpersOf(manifest) {
|
|
|
225
317
|
return [{
|
|
226
318
|
name: `permdock_${root}_has`,
|
|
227
319
|
keyArgument: "p_grant",
|
|
320
|
+
keyPosition: 0,
|
|
228
321
|
tenantArgument: "p_tenant"
|
|
229
322
|
}, {
|
|
230
323
|
name: `${prefix}_permission_keys`,
|
|
231
324
|
keyArgument: "p_keys",
|
|
325
|
+
keyPosition: 1,
|
|
232
326
|
tenantArgument: "p_id"
|
|
233
327
|
}].map((candidate) => ({
|
|
234
328
|
...candidate,
|
|
235
329
|
name: `${manifest.rls.schema}.${candidate.name}`
|
|
236
330
|
}));
|
|
237
331
|
}
|
|
332
|
+
/**
|
|
333
|
+
* `rls.permissionFilters`: the one-argument forms of the tenant-pure helpers.
|
|
334
|
+
* Each reads the tenant from the token, so a call with a literal key depends
|
|
335
|
+
* only on the caller's grants of that key in the active tenant. The
|
|
336
|
+
* two-argument helpers stay in `tenantPureHelpers` and are never filters:
|
|
337
|
+
* better-supabase 0.87 checks the key argument only.
|
|
338
|
+
*/
|
|
339
|
+
function permissionFiltersOf(manifest) {
|
|
340
|
+
const root = manifest.rls.scopes[0]?.name;
|
|
341
|
+
if (root === void 0) return [];
|
|
342
|
+
const schema = manifest.rls.schema;
|
|
343
|
+
return [{
|
|
344
|
+
name: `${schema}.permdock_${root}_has_active`,
|
|
345
|
+
keyPosition: 0
|
|
346
|
+
}, {
|
|
347
|
+
name: `${schema}.permitted_${root}_permission_keys_active`,
|
|
348
|
+
keyPosition: 0
|
|
349
|
+
}];
|
|
350
|
+
}
|
|
351
|
+
// src/cli/rls/table-reasons.ts
|
|
352
|
+
/** `policy <name>` with the file that defines it. */
|
|
353
|
+
function policyLabel(policy) {
|
|
354
|
+
return `policy ${policy.name}${policy.file === void 0 ? "" : ` in ${policy.file}`}`;
|
|
355
|
+
}
|
|
356
|
+
/** The column names an expression reads, in order of first appearance. */
|
|
357
|
+
function columnsOf(expr) {
|
|
358
|
+
const found = /* @__PURE__ */ new Set();
|
|
359
|
+
const visit = (value) => {
|
|
360
|
+
if (Array.isArray(value)) {
|
|
361
|
+
for (const item of value) visit(item);
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
if (!isRecord(value)) return;
|
|
365
|
+
for (const [key, child] of Object.entries(value)) if (key === "ColumnRef" && isRecord(child)) found.add(svals(child["fields"]).join("."));
|
|
366
|
+
else visit(child);
|
|
367
|
+
};
|
|
368
|
+
visit(expr);
|
|
369
|
+
return [...found].filter((name) => name !== "");
|
|
370
|
+
}
|
|
371
|
+
const list = (items) => items.length === 0 ? "none" : items.join(", ");
|
|
372
|
+
/** The function calls and columns of a policy's `using`, as one phrase. */
|
|
373
|
+
function readsOf(policy) {
|
|
374
|
+
const calls = [...new Set(sqlCalls(policy.using).map((call) => `${call.name.join(".")}()`))];
|
|
375
|
+
const columns = columnsOf(policy.using);
|
|
376
|
+
return `calls ${list(calls)} and reads ${columns.length === 0 ? "no column" : `column ${list(columns)}`}`;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Whether a policy file is a migration, which `codemod bsb-access-tags` leaves
|
|
380
|
+
* alone.
|
|
381
|
+
*/
|
|
382
|
+
function inMigration(policy) {
|
|
383
|
+
return policy.file?.split(/[/\\]/u).includes("migrations") === true;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* What keeps the codemod `bsb-access-tags` from moving a `form` select policy
|
|
387
|
+
* to an `@bsb access` tag: the policy, the tenant column or the migration. The
|
|
388
|
+
* codemod rewrites only declarative schema files, and only a policy that is
|
|
389
|
+
* `<column> in (select <helper>('<key>'))` for `authenticated` alone, with no
|
|
390
|
+
* other policy on the same operation and one tenant column on the table.
|
|
391
|
+
*/
|
|
392
|
+
function formBlockers(policy, others, helpers) {
|
|
393
|
+
const label = policyLabel(policy);
|
|
394
|
+
const blockers = [];
|
|
395
|
+
if (inMigration(policy)) blockers.push(`${label} is a migration, which the codemod does not rewrite: move the policy to the schema files`);
|
|
396
|
+
if (policy.roles.length !== 1 || policy.roles[0] !== "authenticated") blockers.push(`${label} applies to ${list(policy.roles)}, not authenticated alone`);
|
|
397
|
+
if (policy.command === "all") blockers.push(`${label} covers all commands: split it into one policy per command`);
|
|
398
|
+
if (tenantCheck(policy.using, helpers.plain) === void 0) blockers.push(`${label} uses ${helpers.plain} inside a larger expression, not as "<column> in (select ${helpers.plain}('<key>'))"`);
|
|
399
|
+
const selects = others.filter((other) => other !== policy && (other.command === "select" || other.command === "all"));
|
|
400
|
+
if (selects.length > 0) {
|
|
401
|
+
const named = selects.map((other) => `${other.permissive ? "" : "restrictive "}${other.name}`);
|
|
402
|
+
blockers.push(`${named.join(", ")} also ${selects.length === 1 ? "applies" : "apply"} to select on the table`);
|
|
403
|
+
}
|
|
404
|
+
const columns = /* @__PURE__ */ new Map();
|
|
405
|
+
for (const other of [policy, ...others]) {
|
|
406
|
+
const found = tenantCheck(other.using, helpers.plain) ?? tenantCheck(other.check, helpers.plain);
|
|
407
|
+
if (found !== void 0 && !columns.has(found.column)) columns.set(found.column, other.name);
|
|
408
|
+
}
|
|
409
|
+
if (columns.size > 1) blockers.push(`the tenant column differs between policies: ${[...columns].map(([column, name]) => `${name} uses ${column}`).join(", ")}`);
|
|
410
|
+
return blockers;
|
|
411
|
+
}
|
|
412
|
+
/** Why a permissive select policy that is no tenant form makes its table `row`. */
|
|
413
|
+
function ruleReason(rule, policy, helpers) {
|
|
414
|
+
const label = policyLabel(policy);
|
|
415
|
+
switch (rule) {
|
|
416
|
+
case "owner": return `${label} is an owner rule: it ${readsOf(policy)}, so a row is read by the user it names, not by a tenant grant`;
|
|
417
|
+
case "condition": return policy.using === void 0 ? `${label} has no using clause` : `${label} is a row condition: it ${readsOf(policy)}, which no tenant check of ${helpers.byPermission} covers`;
|
|
418
|
+
case "follows":
|
|
419
|
+
case "via":
|
|
420
|
+
case "walk": return `${label} resolves rows through a ${rule} helper: it ${readsOf(policy)}`;
|
|
421
|
+
default: return `${label} is a ${rule} rule`;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
/** A restrictive select policy that reads a column of the row. */
|
|
425
|
+
function restrictiveReason(policy) {
|
|
426
|
+
return `restrictive ${policyLabel(policy)} reads ${columnsOf(policy.using).length === 0 ? "the row" : `column ${list(columnsOf(policy.using))}`}, so the rows it hides differ per row, not per tenant`;
|
|
427
|
+
}
|
|
428
|
+
/** Why a table with no readable policy is `unknown`. */
|
|
429
|
+
function unknownReason(state, policies) {
|
|
430
|
+
switch (state) {
|
|
431
|
+
case "no-facts": return "no policy or enable row level security statement for the table in the files inspect read; the table may exist only in a file libpg_query rejects, or be created by a function";
|
|
432
|
+
case "no-rls": return "no alter table ... enable row level security statement for the table in the files inspect read";
|
|
433
|
+
case "no-select": {
|
|
434
|
+
const named = policies.map((policy) => policy.name);
|
|
435
|
+
return `row level security is on and no permissive select policy applies to authenticated or public${named.length === 0 ? "" : ` (policies: ${list(named)})`}, so the table is not read through PostgREST by a signed-in role; inspect does not read grants, so a table grant is not checked`;
|
|
436
|
+
}
|
|
437
|
+
default: throw new Error(state);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
238
440
|
// src/cli/rls/table-reads.ts
|
|
239
441
|
/** better-supabase's own tables, which its block SQL owns. */
|
|
240
442
|
const LIBRARY_SCHEMAS = /* @__PURE__ */ new Set(["better_supabase"]);
|
|
@@ -296,6 +498,17 @@ function ruleOf(policy, plainHelper) {
|
|
|
296
498
|
if (names.some((name) => name === "auth.uid" || name.endsWith("permdock_user_id"))) return "owner";
|
|
297
499
|
return policy.using === void 0 ? "unknown" : "condition";
|
|
298
500
|
}
|
|
501
|
+
/**
|
|
502
|
+
* The tenant checks a permissive policy ORs in: the expression itself or an
|
|
503
|
+
* argument of its top-level `or`. Other disjuncts only add rows.
|
|
504
|
+
*/
|
|
505
|
+
function tenantDisjuncts(expr, helper) {
|
|
506
|
+
const bool = isRecord(expr) ? expr["BoolExpr"] : void 0;
|
|
507
|
+
return (isRecord(bool) && bool["boolop"] === "OR_EXPR" && Array.isArray(bool["args"]) ? bool["args"] : [expr]).flatMap((arg) => {
|
|
508
|
+
const check = tenantCheck(arg, helper);
|
|
509
|
+
return check === void 0 ? [] : [check];
|
|
510
|
+
});
|
|
511
|
+
}
|
|
299
512
|
function keysOf(expr, helper) {
|
|
300
513
|
return sqlCalls(expr).flatMap((call) => {
|
|
301
514
|
if (call.name.join(".") !== helper) return [];
|
|
@@ -312,46 +525,78 @@ function readOf(table, facts, helpers, fieldTables, reasons) {
|
|
|
312
525
|
if (facts === void 0 || !facts.rls) return {
|
|
313
526
|
table,
|
|
314
527
|
share: "row",
|
|
315
|
-
rules: ["unknown"]
|
|
528
|
+
rules: ["unknown"],
|
|
529
|
+
reason: unknownReason(facts === void 0 ? "no-facts" : "no-rls", facts === void 0 ? [] : [...facts.policies.values()])
|
|
316
530
|
};
|
|
317
|
-
const
|
|
531
|
+
const all = [...facts.policies.values()];
|
|
532
|
+
const selects = all.filter(appliesToSelect);
|
|
318
533
|
const permissive = selects.filter((policy) => policy.permissive);
|
|
319
534
|
const rules = /* @__PURE__ */ new Set();
|
|
320
|
-
const columns = /* @__PURE__ */ new
|
|
535
|
+
const columns = /* @__PURE__ */ new Map();
|
|
321
536
|
const keys = /* @__PURE__ */ new Set();
|
|
322
537
|
const formKeys = /* @__PURE__ */ new Set();
|
|
538
|
+
const formPolicies = [];
|
|
539
|
+
const parts = [];
|
|
540
|
+
const widenKeys = /* @__PURE__ */ new Set();
|
|
541
|
+
const widenColumns = /* @__PURE__ */ new Set();
|
|
323
542
|
const stale = [];
|
|
324
|
-
const hasTag =
|
|
325
|
-
if (fieldTables.has(table))
|
|
326
|
-
|
|
543
|
+
const hasTag = all.some((p) => p.tagged !== void 0);
|
|
544
|
+
if (fieldTables.has(table)) {
|
|
545
|
+
rules.add("fields");
|
|
546
|
+
parts.push("the table has a field view, which reads rows per field grant");
|
|
547
|
+
}
|
|
548
|
+
if (permissive.length === 0) {
|
|
549
|
+
rules.add("unknown");
|
|
550
|
+
parts.push(unknownReason("no-select", all));
|
|
551
|
+
}
|
|
327
552
|
for (const policy of permissive) {
|
|
328
553
|
const check = policy.tagged ?? tenantCheck(policy.using, helpers.byPermission);
|
|
329
554
|
for (const key of policy.tagged === void 0 ? keysOf(policy.using, helpers.byPermission) : [policy.tagged.key]) keys.add(key);
|
|
555
|
+
for (const found of policy.tagged === void 0 ? tenantDisjuncts(policy.using, helpers.byPermission) : [policy.tagged]) {
|
|
556
|
+
widenKeys.add(found.key);
|
|
557
|
+
widenColumns.add(found.column);
|
|
558
|
+
}
|
|
330
559
|
if (check === void 0) {
|
|
331
560
|
const rule = ruleOf(policy, helpers.plain);
|
|
332
561
|
rules.add(rule);
|
|
333
562
|
if (rule === "form") {
|
|
563
|
+
formPolicies.push(policy);
|
|
334
564
|
if (hasTag) stale.push(policy);
|
|
335
565
|
for (const key of keysOf(policy.using, helpers.plain)) formKeys.add(key);
|
|
336
|
-
}
|
|
337
|
-
} else columns.
|
|
566
|
+
} else parts.push(ruleReason(rule, policy, helpers));
|
|
567
|
+
} else if (!columns.has(check.column)) columns.set(check.column, policy.name);
|
|
568
|
+
}
|
|
569
|
+
for (const policy of selects) if (!policy.permissive && readsColumn(policy.using)) {
|
|
570
|
+
rules.add("restrictive");
|
|
571
|
+
parts.push(restrictiveReason(policy));
|
|
572
|
+
}
|
|
573
|
+
if (rules.size === 0 && columns.size > 1) {
|
|
574
|
+
rules.add("condition");
|
|
575
|
+
parts.push(`tenant checks on ${columns.size} columns: ${[...columns].map(([column, name]) => `${name} on ${column}`).join(", ")}`);
|
|
338
576
|
}
|
|
339
|
-
if (selects.some((policy) => !policy.permissive && readsColumn(policy.using))) rules.add("restrictive");
|
|
340
|
-
if (rules.size === 0 && columns.size > 1) rules.add("condition");
|
|
341
577
|
const permissions = [...keys].toSorted();
|
|
342
578
|
const listed = permissions.length === 0 ? {} : { permissions };
|
|
343
579
|
if (rules.size > 0) {
|
|
344
|
-
|
|
580
|
+
for (const policy of formPolicies) {
|
|
581
|
+
const blockers = stale.includes(policy) ? [`policy ${policy.name} is still defined${policy.file === void 0 ? "" : ` in ${policy.file}`} next to an @bsb access tag that renders the table's policy: write a migration that drops it`] : formBlockers(policy, all, helpers);
|
|
582
|
+
parts.push(...blockers);
|
|
583
|
+
if (blockers.length === 0 && reasons !== void 0 && keysOf(policy.using, helpers.plain).every((key) => reasons.swappable.has(key))) parts.push(`policy ${policy.name} is movable: nothing on the table blocks permdock codemod bsb-access-tags`);
|
|
584
|
+
}
|
|
585
|
+
if (reasons !== void 0 && stale.length === 0) parts.push(...[...formKeys].toSorted().map((key) => `key ${key}: ${keyReason(reasons, key)}`));
|
|
345
586
|
const why = parts.length === 0 ? void 0 : parts.join("; ");
|
|
587
|
+
const [widened] = widenColumns;
|
|
588
|
+
const holds = widenColumns.size === 1 && widened !== void 0 && widenKeys.size > 0 && !rules.has("restrictive") && !rules.has("fields") && !rules.has("unknown");
|
|
346
589
|
return {
|
|
347
590
|
table,
|
|
348
591
|
share: "row",
|
|
592
|
+
...holds ? { column: widened } : {},
|
|
349
593
|
...listed,
|
|
350
594
|
rules: [...rules].toSorted(),
|
|
595
|
+
...holds ? { tenantFor: [...widenKeys].toSorted() } : {},
|
|
351
596
|
...why === void 0 ? {} : { reason: why }
|
|
352
597
|
};
|
|
353
598
|
}
|
|
354
|
-
const [column] = columns;
|
|
599
|
+
const [column] = columns.keys();
|
|
355
600
|
return {
|
|
356
601
|
table,
|
|
357
602
|
share: "tenant",
|
|
@@ -456,7 +701,11 @@ function manifestTableReads(cwd, config, manifest, reasons) {
|
|
|
456
701
|
async function withTableReads(cwd, config, manifest, reasons) {
|
|
457
702
|
const reads = await manifestTableReads(cwd, config, manifest, reasons);
|
|
458
703
|
const tenantPureHelpers = tenantPureHelpersOf(manifest);
|
|
459
|
-
const
|
|
704
|
+
const permissionFilters = permissionFiltersOf(manifest);
|
|
705
|
+
const pure = {
|
|
706
|
+
...tenantPureHelpers.length === 0 ? {} : { tenantPureHelpers },
|
|
707
|
+
...permissionFilters.length === 0 ? {} : { permissionFilters }
|
|
708
|
+
};
|
|
460
709
|
if (reads.length === 0) return {
|
|
461
710
|
...manifest,
|
|
462
711
|
rls: {
|
|
@@ -514,4 +763,4 @@ async function configuredTableReads(cwd, config) {
|
|
|
514
763
|
...reasons === void 0 ? {} : { reasons }
|
|
515
764
|
});
|
|
516
765
|
}
|
|
517
|
-
export { withTableReads as a, tableReads as i, configuredTableReads as n,
|
|
766
|
+
export { withTableReads as a, tableReads as i, configuredTableReads as n, functionShares as o, manifestTableReads as r, sharedFunctionsOf as s, committedManifest as t };
|