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
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { r as isRecord } from "./compact-C4LFuqbW.js";
|
|
2
|
+
import { t as readMemberships } from "./read-memberships-DVBitJZG.js";
|
|
3
|
+
import { d as scopeList, p as tenantOf } from "./scopes-B-KX9EI8.js";
|
|
4
|
+
import { r as shareKeyClaimsEligible } from "./share-key-claims-CZGAeVqa.js";
|
|
5
|
+
import "./sources-C6Id63F8.js";
|
|
6
|
+
import { i as loadConfiguredPolicy } from "./load-m7jmit3y.js";
|
|
7
|
+
import { a as quoteIdent } from "./quote-LNaBdCGA.js";
|
|
8
|
+
import { n as activeSource } from "./memberships-CNoAlsma.js";
|
|
9
|
+
import { n as configuredTableReads } from "./table-reads-BoF_58yh.js";
|
|
10
|
+
// src/cli/rls/measure.ts
|
|
11
|
+
/** Requests per tenant when `--requests` is absent. */
|
|
12
|
+
const DEFAULT_REQUESTS = 20;
|
|
13
|
+
/** Tables a request reads when `--tables` is absent. */
|
|
14
|
+
const DEFAULT_TABLES = 10;
|
|
15
|
+
/** Tenants of one user the share-key count covers. */
|
|
16
|
+
const TENANT_LIMIT = 20;
|
|
17
|
+
const VERSION_FUNCTION = /(authz_versions?_for|custom_roles_version_for)$/u;
|
|
18
|
+
const ident = quoteIdent;
|
|
19
|
+
function median(values) {
|
|
20
|
+
const sorted = values.toSorted((a, b) => a - b);
|
|
21
|
+
const mid = Math.floor(sorted.length / 2);
|
|
22
|
+
return sorted.length % 2 === 1 ? sorted[mid] ?? 0 : ((sorted[mid - 1] ?? 0) + (sorted[mid] ?? 0)) / 2;
|
|
23
|
+
}
|
|
24
|
+
const round = (value) => Math.round(value * 1e3) / 1e3;
|
|
25
|
+
async function counts(client, schema) {
|
|
26
|
+
const out = /* @__PURE__ */ new Map();
|
|
27
|
+
let trackFunctions = true;
|
|
28
|
+
try {
|
|
29
|
+
const { rows } = await client.query(`select schemaname, funcname, calls, total_time from pg_stat_user_functions where schemaname = $1`, [schema]);
|
|
30
|
+
for (const row of rows) out.set(String(row["funcname"]), {
|
|
31
|
+
calls: Number(row["calls"]),
|
|
32
|
+
totalMs: Number(row["total_time"])
|
|
33
|
+
});
|
|
34
|
+
} catch {
|
|
35
|
+
trackFunctions = false;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
counts: out,
|
|
39
|
+
trackFunctions
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function delta(before, after) {
|
|
43
|
+
const out = /* @__PURE__ */ new Map();
|
|
44
|
+
for (const [name, now] of after) {
|
|
45
|
+
const was = before.get(name);
|
|
46
|
+
const calls = now.calls - (was?.calls ?? 0);
|
|
47
|
+
if (calls > 0) out.set(name, {
|
|
48
|
+
calls,
|
|
49
|
+
totalMs: now.totalMs - (was?.totalMs ?? 0)
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
async function statementCounts(client, schema) {
|
|
55
|
+
const out = /* @__PURE__ */ new Map();
|
|
56
|
+
const { rows } = await client.query(`select query, calls, total_exec_time from pg_stat_statements
|
|
57
|
+
where dbid = (select oid from pg_database where datname = current_database())
|
|
58
|
+
and query like $1`, [`%${schema}.%`]);
|
|
59
|
+
for (const row of rows) out.set(String(row["query"]), {
|
|
60
|
+
calls: Number(row["calls"]),
|
|
61
|
+
totalMs: Number(row["total_exec_time"])
|
|
62
|
+
});
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The claims the hook mints for `user`, with `tenant` active when the hook
|
|
67
|
+
* reads it from `app_metadata`.
|
|
68
|
+
*/
|
|
69
|
+
async function mint(client, input) {
|
|
70
|
+
const meta = input.tenantKey === void 0 || input.tenant === void 0 ? "{}" : JSON.stringify({ app_metadata: { [input.tenantKey]: input.tenant } });
|
|
71
|
+
const { rows } = await client.query(`select ${ident(input.schema)}.custom_access_token_hook(jsonb_build_object(
|
|
72
|
+
'user_id', $1::uuid,
|
|
73
|
+
'claims', jsonb_build_object('sub', $1::text, 'role', 'authenticated', 'aal', 'aal1') || $2::jsonb
|
|
74
|
+
)) -> 'claims' as claims`, [input.user, meta]);
|
|
75
|
+
const claims = rows[0]?.["claims"];
|
|
76
|
+
return isRecord(claims) ? claims : void 0;
|
|
77
|
+
}
|
|
78
|
+
/** `false` for an id `auth.users` does not hold. */
|
|
79
|
+
async function known(client, user) {
|
|
80
|
+
try {
|
|
81
|
+
const { rows } = await client.query("select exists (select 1 from auth.users where id = $1::uuid) as found", [user]);
|
|
82
|
+
return rows[0]?.["found"] === true;
|
|
83
|
+
} catch {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async function request(client, claims, tables) {
|
|
88
|
+
await client.query("begin", []);
|
|
89
|
+
try {
|
|
90
|
+
await client.query("set local role authenticated", []);
|
|
91
|
+
await client.query("select set_config('request.jwt.claims', $1, true)", [JSON.stringify(claims)]);
|
|
92
|
+
const started = performance.now();
|
|
93
|
+
for (const table of tables) await client.query(`select 1 from ${table} limit 1`, []);
|
|
94
|
+
return performance.now() - started;
|
|
95
|
+
} finally {
|
|
96
|
+
await client.query("rollback", []);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function tenantsOf(claims, scopes, only) {
|
|
100
|
+
if (only !== void 0) return [only];
|
|
101
|
+
const ids = readMemberships(claims["memberships"]).memberships.flatMap((membership) => {
|
|
102
|
+
const tenant = tenantOf(membership, scopes);
|
|
103
|
+
return tenant === void 0 ? [] : [tenant];
|
|
104
|
+
});
|
|
105
|
+
return [...new Set(ids)].slice(0, TENANT_LIMIT);
|
|
106
|
+
}
|
|
107
|
+
function perRequest(versions, requests) {
|
|
108
|
+
return Object.fromEntries([...versions].filter(([name]) => VERSION_FUNCTION.test(name)).map(([name, value]) => [name, round(value.calls / requests)]));
|
|
109
|
+
}
|
|
110
|
+
async function measureUser(client, input, user) {
|
|
111
|
+
const base = await known(client, user) ? await mint(client, {
|
|
112
|
+
schema: input.schema,
|
|
113
|
+
user,
|
|
114
|
+
tenantKey: input.tenantKey,
|
|
115
|
+
tenant: input.tenant
|
|
116
|
+
}) : void 0;
|
|
117
|
+
if (base === void 0) return {
|
|
118
|
+
user,
|
|
119
|
+
token: false,
|
|
120
|
+
memberships: 0,
|
|
121
|
+
membershipsTruncated: false,
|
|
122
|
+
tenants: 0,
|
|
123
|
+
shareKeys: 0,
|
|
124
|
+
versionReadsPerRequest: {},
|
|
125
|
+
requests: 0,
|
|
126
|
+
tablesPerRequest: 0,
|
|
127
|
+
requestMs: {
|
|
128
|
+
median: 0,
|
|
129
|
+
p95: 0
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
const tenants = tenantsOf(base, input.scopes, input.tenant);
|
|
133
|
+
let shareKeys = 0;
|
|
134
|
+
for (const tenant of tenants) {
|
|
135
|
+
const claims = input.tenantKey === void 0 ? base : await mint(client, {
|
|
136
|
+
schema: input.schema,
|
|
137
|
+
user,
|
|
138
|
+
tenantKey: input.tenantKey,
|
|
139
|
+
tenant
|
|
140
|
+
});
|
|
141
|
+
if (claims !== void 0 && shareKeyClaimsEligible(claims, tenant, input.scopes)) shareKeys += 1;
|
|
142
|
+
}
|
|
143
|
+
const before = (await counts(client, input.schema)).counts;
|
|
144
|
+
const times = [];
|
|
145
|
+
for (let index = 0; index < input.requests; index += 1) times.push(await request(client, base, input.tableNames));
|
|
146
|
+
const after = (await counts(client, input.schema)).counts;
|
|
147
|
+
const sorted = times.toSorted((a, b) => a - b);
|
|
148
|
+
return {
|
|
149
|
+
user,
|
|
150
|
+
token: true,
|
|
151
|
+
memberships: readMemberships(base["memberships"]).memberships.length,
|
|
152
|
+
membershipsTruncated: base["memberships_truncated"] === true,
|
|
153
|
+
tenants: tenants.length,
|
|
154
|
+
shareKeys,
|
|
155
|
+
versionReadsPerRequest: perRequest(delta(before, after), input.requests),
|
|
156
|
+
requests: input.requests,
|
|
157
|
+
tablesPerRequest: input.tableNames.length,
|
|
158
|
+
requestMs: {
|
|
159
|
+
median: round(median(times)),
|
|
160
|
+
p95: round(sorted[Math.max(0, Math.ceil(sorted.length * .95) - 1)] ?? 0)
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function helpersOf(functions, statements) {
|
|
165
|
+
const rows = [...functions].map(([name, value]) => ({
|
|
166
|
+
name,
|
|
167
|
+
calls: value.calls,
|
|
168
|
+
meanMs: round(value.totalMs / value.calls),
|
|
169
|
+
totalMs: round(value.totalMs),
|
|
170
|
+
source: "pg_stat_user_functions"
|
|
171
|
+
}));
|
|
172
|
+
for (const [query, value] of statements ?? []) rows.push({
|
|
173
|
+
name: query.replaceAll(/\s+/gu, " ").slice(0, 120),
|
|
174
|
+
calls: value.calls,
|
|
175
|
+
meanMs: round(value.totalMs / value.calls),
|
|
176
|
+
totalMs: round(value.totalMs),
|
|
177
|
+
source: "pg_stat_statements"
|
|
178
|
+
});
|
|
179
|
+
return rows.toSorted((a, b) => b.totalMs - a.totalMs).slice(0, 15);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Runs `requests` requests as each user in `input.users` against the app's own
|
|
183
|
+
* database and reports what Postgres counted. A request is one transaction, as
|
|
184
|
+
* `authenticated` with the hook's claims, that reads one row from each of the
|
|
185
|
+
* first `tables` tables of `rls.tableReads`. The hook runs per tenant of the
|
|
186
|
+
* user, so the share-key count is the share of tenants whose token allows one
|
|
187
|
+
* (the claims decide; the live version check and `widened` keys can still
|
|
188
|
+
* refuse it). Every request rolls back and writes nothing.
|
|
189
|
+
*/
|
|
190
|
+
async function measure(input) {
|
|
191
|
+
const hook = input.config.supabase?.hook;
|
|
192
|
+
const schema = hook?.schema ?? input.config.rls?.schema ?? "permdock";
|
|
193
|
+
const policy = await loadConfiguredPolicy(input.cwd, input.config.policy);
|
|
194
|
+
const scopes = policy === void 0 ? [] : scopeList(policy.scopes);
|
|
195
|
+
const root = scopes[0]?.name ?? "tenant";
|
|
196
|
+
const active = activeSource(hook?.activeFrom, root);
|
|
197
|
+
const tables = (await configuredTableReads(input.cwd, input.config)).map((read) => read.table).slice(0, input.tables);
|
|
198
|
+
const notes = [];
|
|
199
|
+
const client = await input.connect(input.db);
|
|
200
|
+
try {
|
|
201
|
+
let statements;
|
|
202
|
+
let pgStatStatements = "available";
|
|
203
|
+
try {
|
|
204
|
+
await client.query("set track_functions = 'all'", []);
|
|
205
|
+
} catch {
|
|
206
|
+
notes.push("track_functions could not be set: version reads are not counted");
|
|
207
|
+
}
|
|
208
|
+
try {
|
|
209
|
+
statements = await statementCounts(client, schema);
|
|
210
|
+
} catch {
|
|
211
|
+
pgStatStatements = "missing";
|
|
212
|
+
notes.push("pg_stat_statements is not installed: create extension pg_stat_statements, and set shared_preload_libraries on a hosted database");
|
|
213
|
+
}
|
|
214
|
+
const functionsBefore = (await counts(client, schema)).counts;
|
|
215
|
+
const users = [];
|
|
216
|
+
for (const user of input.users) users.push(await measureUser(client, {
|
|
217
|
+
...input,
|
|
218
|
+
schema,
|
|
219
|
+
scopes,
|
|
220
|
+
tenantKey: "appMetadata" in active ? active.appMetadata : void 0,
|
|
221
|
+
tableNames: tables
|
|
222
|
+
}, user));
|
|
223
|
+
if (!("appMetadata" in active)) notes.push("the hook reads the active tenant from a table: each user is measured with the tenant the table gives");
|
|
224
|
+
if (tables.length === 0) notes.push("rls.tableReads names no table, so a request reads nothing: run permdock rls generate first");
|
|
225
|
+
const functionsAfter = (await counts(client, schema)).counts;
|
|
226
|
+
const statementsAfter = statements === void 0 ? void 0 : await statementCounts(client, schema);
|
|
227
|
+
const requests = users.reduce((sum, user) => sum + user.tenants, 0);
|
|
228
|
+
const withKey = users.reduce((sum, user) => sum + user.shareKeys, 0);
|
|
229
|
+
return {
|
|
230
|
+
users,
|
|
231
|
+
helpers: helpersOf(delta(functionsBefore, functionsAfter), statements === void 0 || statementsAfter === void 0 ? void 0 : delta(statements, statementsAfter)),
|
|
232
|
+
shareKey: {
|
|
233
|
+
requests,
|
|
234
|
+
withKey,
|
|
235
|
+
share: requests === 0 ? null : round(withKey / requests)
|
|
236
|
+
},
|
|
237
|
+
pgStatStatements,
|
|
238
|
+
notes
|
|
239
|
+
};
|
|
240
|
+
} finally {
|
|
241
|
+
await client.end();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function text(report) {
|
|
245
|
+
const lines = [];
|
|
246
|
+
for (const user of report.users) {
|
|
247
|
+
if (!user.token) {
|
|
248
|
+
lines.push(`${user.user}: not in auth.users`);
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
const reads = Object.entries(user.versionReadsPerRequest).map(([name, value]) => `${name} ${String(value)}`).join(", ");
|
|
252
|
+
lines.push(`${user.user}: ${String(user.memberships)} memberships${user.membershipsTruncated ? " (truncated)" : ""}, ${String(user.tenants)} tenants, share key for ${String(user.shareKeys)}`, ` ${String(user.requests)} requests of ${String(user.tablesPerRequest)} tables: median ${String(user.requestMs.median)} ms, p95 ${String(user.requestMs.p95)} ms`, ` version reads per request: ${reads === "" ? "0" : reads}`);
|
|
253
|
+
}
|
|
254
|
+
const { shareKey } = report;
|
|
255
|
+
lines.push(`share key: ${String(shareKey.withKey)} of ${String(shareKey.requests)} tenant requests${shareKey.share === null ? "" : ` (${String(Math.round(shareKey.share * 100))}%)`}`);
|
|
256
|
+
if (report.helpers.length > 0) {
|
|
257
|
+
lines.push("helpers by total time:");
|
|
258
|
+
for (const helper of report.helpers) lines.push(` ${String(helper.calls)} calls, ${String(helper.meanMs)} ms mean, ${String(helper.totalMs)} ms total ${helper.name} (${helper.source})`);
|
|
259
|
+
}
|
|
260
|
+
for (const note of report.notes) lines.push(`note: ${note}`);
|
|
261
|
+
return lines.join("\n");
|
|
262
|
+
}
|
|
263
|
+
/** `permdock rls measure`: the result of {@link measure}. */
|
|
264
|
+
async function runRlsMeasure(input) {
|
|
265
|
+
const report = await measure(input);
|
|
266
|
+
return {
|
|
267
|
+
code: 0,
|
|
268
|
+
output: text(report),
|
|
269
|
+
data: report
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
export { DEFAULT_REQUESTS, DEFAULT_TABLES, runRlsMeasure };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// src/core/membership-claim-sql.ts
|
|
2
|
+
/**
|
|
3
|
+
* The SQL that turns a compact `memberships` claim (`core/membership-claim.ts`:
|
|
4
|
+
* `[scope index, short id, via index, ...role indexes]` rows in `e` plus the
|
|
5
|
+
* `o` objects) into the entries of the long form. `claim` is a jsonb
|
|
6
|
+
* expression, which may be correlated with the enclosing query.
|
|
7
|
+
*/
|
|
8
|
+
function compactMembershipsSql(claim) {
|
|
9
|
+
return `(
|
|
10
|
+
select coalesce(jsonb_agg(d.m), '[]'::jsonb)
|
|
11
|
+
from (
|
|
12
|
+
select jsonb_build_object(
|
|
13
|
+
'scope', c.cl -> 's' ->> (x.e ->> 0)::int,
|
|
14
|
+
'id', case when left(x.e ->> 1, 1) = '=' then substr(x.e ->> 1, 2)
|
|
15
|
+
else (encode(decode(translate(x.e ->> 1, '-_', '+/') || '==', 'base64'), 'hex'))::uuid::text end,
|
|
16
|
+
'roles', (
|
|
17
|
+
select coalesce(jsonb_agg(c.cl -> 'r' -> ((r.v #>> '{}')::int)), '[]'::jsonb)
|
|
18
|
+
from jsonb_array_elements(x.e) with ordinality r(v, n)
|
|
19
|
+
where r.n > 3
|
|
20
|
+
)
|
|
21
|
+
) || case when (x.e ->> 2)::int >= 0
|
|
22
|
+
then jsonb_build_object('via', c.cl -> 'v' ->> (x.e ->> 2)::int)
|
|
23
|
+
else '{}'::jsonb end as m
|
|
24
|
+
from (select ${claim} as cl) c
|
|
25
|
+
cross join lateral jsonb_array_elements(coalesce(c.cl -> 'e', '[]'::jsonb)) x(e)
|
|
26
|
+
union all
|
|
27
|
+
select o.m
|
|
28
|
+
from (select ${claim} as cl) c
|
|
29
|
+
cross join lateral jsonb_array_elements(coalesce(c.cl -> 'o', '[]'::jsonb)) o(m)
|
|
30
|
+
) d
|
|
31
|
+
)`;
|
|
32
|
+
}
|
|
33
|
+
export { compactMembershipsSql as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as isRecord, t as compact } from "./compact-C4LFuqbW.js";
|
|
2
2
|
import { g as secondsOf, m as rfc3339 } from "./time-r0CKBm57.js";
|
|
3
|
-
import { n as parseSnapshot } from "./snapshot-
|
|
3
|
+
import { n as parseSnapshot } from "./snapshot-Dzi4LR6n.js";
|
|
4
4
|
// src/core/snapshot-sign.ts
|
|
5
5
|
/**
|
|
6
6
|
* The claims `signSnapshot` signs for `snapshot`. `issuedAt` and `expiresAt`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as activeFromSql, n as activeSource, r as checkSources, i as entriesSql, a as hookMemberships, o as memberForPlan, s as positiveInteger, c as typedSourceUsers, l as typedUsers } from "./memberships-CNoAlsma.js";
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { i as scopeColumn } from "./compile-BUKXrueE.js";
|
|
2
|
+
import { l as scopeChain, s as resolveScope } from "./scopes-B-KX9EI8.js";
|
|
3
|
+
import { i as qualifySqlTable } from "./sql-T4GaBh9X.js";
|
|
4
|
+
import { o as junctionMembershipSource, u as roleManifest } from "./sources-C6Id63F8.js";
|
|
5
|
+
import { i as configError } from "./errors-DgLOqc6j.js";
|
|
6
|
+
import { _ as memberRoleOf, c as hasPermittedUsers, m as memberForTable, o as hasMemberFor, p as memberForSources } from "./names-DBxKx2bz.js";
|
|
7
|
+
import { a as quoteIdent, o as quoteLiteral, s as quoteQualified } from "./quote-LNaBdCGA.js";
|
|
8
|
+
// src/cli/supabase-hook/memberships.ts
|
|
9
|
+
function memberForPlan(input) {
|
|
10
|
+
const memberFor = input.scopes.map((scope) => scope.name).filter((name) => hasMemberFor({
|
|
11
|
+
dialect: "supabase",
|
|
12
|
+
...input
|
|
13
|
+
}, name));
|
|
14
|
+
const holders = memberFor.filter((name) => hasPermittedUsers(input, name));
|
|
15
|
+
const entries = /* @__PURE__ */ new Map();
|
|
16
|
+
for (const name of memberFor) {
|
|
17
|
+
const mapped = memberForTable(input, name);
|
|
18
|
+
const found = mapped === void 0 ? memberForSources(input, name).map((source) => source.sql.manifest) : [mappedMembership(mapped, input.scopes, name)];
|
|
19
|
+
for (const entry of found) entries.set(JSON.stringify(entry), entry);
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
memberFor,
|
|
23
|
+
holders,
|
|
24
|
+
memberships: [...entries.values()]
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* An `rls.memberships` table in the manifest's `tableMembershipSource` /
|
|
29
|
+
* `junctionMembershipSource` shape, for scope `name`.
|
|
30
|
+
*/
|
|
31
|
+
function mappedMembership(mapped, scopes, name) {
|
|
32
|
+
const id = scopeColumn(mapped, scopes, name) ?? "";
|
|
33
|
+
const within = {};
|
|
34
|
+
for (const ancestor of scopeChain(scopes, name).slice(1)) {
|
|
35
|
+
const column = scopeColumn(mapped, scopes, ancestor);
|
|
36
|
+
if (column !== void 0) within[ancestor] = column;
|
|
37
|
+
}
|
|
38
|
+
const role = memberRoleOf(mapped);
|
|
39
|
+
const columns = [
|
|
40
|
+
mapped.user,
|
|
41
|
+
id,
|
|
42
|
+
...role.columns,
|
|
43
|
+
...Object.values(within),
|
|
44
|
+
...typeof mapped.via === "string" ? [mapped.via] : [],
|
|
45
|
+
...mapped.expiresAt === void 0 ? [] : [mapped.expiresAt],
|
|
46
|
+
...mapped.disabledAt === void 0 ? [] : [mapped.disabledAt]
|
|
47
|
+
];
|
|
48
|
+
return {
|
|
49
|
+
table: qualifySqlTable(mapped.table),
|
|
50
|
+
user: { column: mapped.user },
|
|
51
|
+
scope: { value: name },
|
|
52
|
+
id: { column: id },
|
|
53
|
+
role: roleManifest(role),
|
|
54
|
+
...Object.keys(within).length === 0 ? {} : { within: { columns: within } },
|
|
55
|
+
...mapped.via === void 0 ? {} : { via: typeof mapped.via === "string" ? { column: mapped.via } : { value: mapped.via.value } },
|
|
56
|
+
...mapped.expiresAt === void 0 ? {} : { expiresAt: { column: mapped.expiresAt } },
|
|
57
|
+
...mapped.disabledAt === void 0 ? {} : { disabledAt: { column: mapped.disabledAt } },
|
|
58
|
+
columns: [...new Set(columns)]
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function positiveInteger(value, label) {
|
|
62
|
+
const number = typeof value === "string" ? Number(value) : value;
|
|
63
|
+
if (typeof number !== "number" || !Number.isInteger(number) || number <= 0) throw configError(`PermDock CLI: ${label} must be a positive integer`);
|
|
64
|
+
return number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Where the hook reads the active first-scope id: `supabase.hook.activeFrom`,
|
|
68
|
+
* or `app_metadata.active_<root>` by default.
|
|
69
|
+
*/
|
|
70
|
+
function activeSource(input, root) {
|
|
71
|
+
const spec = input ?? `app_metadata.active_${root}`;
|
|
72
|
+
if (typeof spec === "string" && spec.startsWith("app_metadata.")) {
|
|
73
|
+
const key = spec.slice(13);
|
|
74
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(key)) throw configError(`PermDock CLI: unsafe app_metadata key '${key}'`);
|
|
75
|
+
return { appMetadata: key };
|
|
76
|
+
}
|
|
77
|
+
if (typeof spec !== "string") return {
|
|
78
|
+
table: spec.table,
|
|
79
|
+
column: spec.column,
|
|
80
|
+
id: spec.id ?? "id"
|
|
81
|
+
};
|
|
82
|
+
const dot = spec.lastIndexOf(".");
|
|
83
|
+
if (dot <= 0) throw configError(`PermDock CLI: --active-from must be app_metadata.<key> or <table>.<column>, got '${spec}'`);
|
|
84
|
+
return {
|
|
85
|
+
table: spec.slice(0, dot),
|
|
86
|
+
column: spec.slice(dot + 1),
|
|
87
|
+
id: "id"
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* SQL for the active first-scope id, as text, for user `uid`; a table source
|
|
92
|
+
* compares its id column with `v_active_user`, declared as `userType`.
|
|
93
|
+
*/
|
|
94
|
+
function activeFromSql(input, root) {
|
|
95
|
+
const from = activeSource(input, root);
|
|
96
|
+
if ("appMetadata" in from) return { sql: `claims -> 'app_metadata' ->> ${quoteLiteral(from.appMetadata)}` };
|
|
97
|
+
return {
|
|
98
|
+
sql: `(select a.${quoteIdent(from.column)}::text from ${quoteQualified(from.table)} a where a.${quoteIdent(from.id)} = v_active_user)`,
|
|
99
|
+
userType: `${quoteQualified(from.table)}.${quoteIdent(from.id)}%type`
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* One variable per user-keyed table `memberships_for` reads, holding the user
|
|
104
|
+
* (a uuid, as Supabase Auth issues) as that column's type, so each lookup
|
|
105
|
+
* compares the column uncast and its index applies.
|
|
106
|
+
*/
|
|
107
|
+
function typedSourceUsers(parts) {
|
|
108
|
+
return parts.sources.map((source, index) => `\n v_user_${String(index)} ${source.sql.userType} := p_user;`).join("");
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The remaining user-keyed variables of the hook: the attribute row and the
|
|
112
|
+
* active-tenant row, each as its column's type.
|
|
113
|
+
*/
|
|
114
|
+
function typedUsers(parts) {
|
|
115
|
+
return [...parts.attrs?.table === void 0 || parts.attrs.columns.length === 0 ? [] : [`v_attrs_user ${quoteQualified(parts.attrs.table)}.${quoteIdent(parts.attrs.id)}%type := uid;`], ...parts.active.userType === void 0 ? [] : [`v_active_user ${parts.active.userType} := uid;`]].map((line) => `\n ${line}`).join("");
|
|
116
|
+
}
|
|
117
|
+
function isRoleList(role) {
|
|
118
|
+
return Array.isArray(role);
|
|
119
|
+
}
|
|
120
|
+
function junctionRoles(role) {
|
|
121
|
+
if (isRoleList(role)) return { sources: role };
|
|
122
|
+
return role;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* `supabase.hook.memberships`, or one junction source per `rls.memberships`
|
|
126
|
+
* scope table when the hook leaves memberships unset. The junction sources read
|
|
127
|
+
* `suspension`, so a suspended instance's rows carry the keys it keeps.
|
|
128
|
+
*/
|
|
129
|
+
function hookMemberships(memberships, tables, scopes, suspension) {
|
|
130
|
+
if (memberships !== void 0) return memberships;
|
|
131
|
+
return Object.entries(tables?.scopes ?? {}).map(([key, table]) => {
|
|
132
|
+
const scope = resolveScope(scopes, key) ?? key;
|
|
133
|
+
const id = scopeColumn(table, scopes, scope) ?? table.id;
|
|
134
|
+
const within = {};
|
|
135
|
+
for (const ancestor of scopeChain(scopes, scope).slice(1)) {
|
|
136
|
+
const column = scopeColumn(table, scopes, ancestor);
|
|
137
|
+
if (column !== void 0) within[ancestor] = column;
|
|
138
|
+
}
|
|
139
|
+
return junctionMembershipSource({
|
|
140
|
+
table: table.table,
|
|
141
|
+
scope,
|
|
142
|
+
...id === void 0 ? {} : { id },
|
|
143
|
+
user: table.user,
|
|
144
|
+
roles: junctionRoles(table.role),
|
|
145
|
+
...Object.keys(within).length === 0 ? {} : { within },
|
|
146
|
+
...table.expiresAt === void 0 ? {} : { expiresAt: table.expiresAt },
|
|
147
|
+
...table.disabledAt === void 0 ? {} : { disabledAt: table.disabledAt },
|
|
148
|
+
...typeof table.via === "object" ? { via: table.via.value } : {},
|
|
149
|
+
...suspension === void 0 ? {} : { suspension }
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function checkSources(parts) {
|
|
154
|
+
if (parts.sources.length === 0) throw configError("PermDock CLI: supabase.hook.memberships needs at least one tableMembershipSource, junctionMembershipSource or blockMembershipSource source, or rls.memberships");
|
|
155
|
+
for (const source of parts.sources) {
|
|
156
|
+
if (source.sql === void 0 || typeof source.sql.select !== "function") throw configError("PermDock CLI: supabase.hook.memberships takes tableMembershipSource, junctionMembershipSource or blockMembershipSource sources from permdock/supabase");
|
|
157
|
+
const scope = source.sql.scope;
|
|
158
|
+
if (scope === void 0) continue;
|
|
159
|
+
if (resolveScope(parts.scopes, scope) !== scope) throw configError(`PermDock CLI: the ${source.sql.table} source names scope '${scope}', which the policy does not declare by that name`);
|
|
160
|
+
const chain = scopeChain(parts.scopes, scope);
|
|
161
|
+
const holds = new Set(source.sql.holds ?? [scope]);
|
|
162
|
+
const missing = chain.filter((ancestor) => !holds.has(ancestor));
|
|
163
|
+
if (missing.length > 0) throw configError(`PermDock CLI: the ${source.sql.table} source needs within columns for ${missing.join(", ")}: a ${scope} membership without every ancestor grants nothing`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function entriesSql(parts) {
|
|
167
|
+
const tenant = `case when s.scope = ${quoteLiteral(parts.root)} then s.id else s.within ->> ${quoteLiteral(parts.root)} end`;
|
|
168
|
+
return parts.sources.map((source, index) => `select ${String(index)} as ord,
|
|
169
|
+
(${tenant}) as tenant,
|
|
170
|
+
jsonb_strip_nulls(jsonb_build_object(
|
|
171
|
+
'scope', s.scope, 'id', s.id, 'within', s.within, 'roles', s.roles, 'via', s.via,
|
|
172
|
+
'expires_at', s.expires_at, 'granted_by', s.granted_by, 'reason', s.reason,
|
|
173
|
+
'member', case when s.member_group is not null then jsonb_build_object('group', s.member_group) end,
|
|
174
|
+
'managed_by', s.managed_by, 'entitlements', s.seats${source.sql.keeps ? ", 'keep', s.keep" : ""}
|
|
175
|
+
)) as entry
|
|
176
|
+
from (
|
|
177
|
+
${source.sql.select(`v_user_${String(index)}`).replaceAll(/^/gmu, " ")}
|
|
178
|
+
) s`).join("\nunion all\n");
|
|
179
|
+
}
|
|
180
|
+
export { hookMemberships as a, typedSourceUsers as c, entriesSql as i, typedUsers as l, activeSource as n, memberForPlan as o, checkSources as r, positiveInteger as s, activeFromSql as t };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { r as isRecord } from "./compact-C4LFuqbW.js";
|
|
2
2
|
import { r as escapeSqlIdent, s as quoteSqlLiteral } from "./sql-T4GaBh9X.js";
|
|
3
3
|
import { i as dateAt } from "./time-r0CKBm57.js";
|
|
4
|
-
import "./sources-
|
|
4
|
+
import "./sources-C6Id63F8.js";
|
|
5
5
|
import { a as describeError } from "./errors-DgLOqc6j.js";
|
|
6
6
|
import { i as refuseDirty, t as applyFiles } from "./files-DuV7wRim.js";
|
|
7
7
|
import { _ as writeOutputFiles, n as dataMigrationFile } from "./output-files-8lfALMSU.js";
|
|
8
8
|
import { o as sqlFiles } from "./files-DAR51W3J.js";
|
|
9
9
|
import { h as sqlStatements, n as charIndex } from "./ast-Dnm2TOHN.js";
|
|
10
10
|
import { a as RETIRE_MARKER } from "./markers-C-kThnKN.js";
|
|
11
|
-
import { r as HELPERS } from "./shared-
|
|
11
|
+
import { r as HELPERS } from "./shared-DnVY767H.js";
|
|
12
12
|
import { i as retireSql, r as retirePlan } from "./retire-FN4aY6-n.js";
|
|
13
13
|
import { existsSync, readFileSync } from "node:fs";
|
|
14
14
|
import { relative, resolve } from "node:path";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { r as isRecord, t as compact } from "./compact-C4LFuqbW.js";
|
|
2
2
|
import { n as freezeDeep } from "./freeze-DGfJq_j2.js";
|
|
3
3
|
import { c as listPermissions, i as getRegistry, s as isRegistryTree } from "./permission-registry-DstT40VS.js";
|
|
4
|
-
import { i as grantList } from "./policy-
|
|
4
|
+
import { i as grantList } from "./policy-CZBJDcTx.js";
|
|
5
5
|
import { n as CliError } from "./errors-DgLOqc6j.js";
|
|
6
6
|
import { o as sqlFiles } from "./files-DAR51W3J.js";
|
|
7
7
|
import { c as jsonSchemaOf } from "./catalog-doc-D4g3nyFB.js";
|
|
8
|
-
import { a as quoteIdent, o as quoteLiteral } from "./quote-
|
|
8
|
+
import { a as quoteIdent, o as quoteLiteral } from "./quote-LNaBdCGA.js";
|
|
9
9
|
import { a as parseSqlFile, f as stringValues, l as readRelation, t as SqlSyntaxError, u as removeStatements } from "./ast-Dnm2TOHN.js";
|
|
10
|
-
import { f as compileConditionSql } from "./rbac-
|
|
10
|
+
import { f as compileConditionSql } from "./rbac-DbyaaNLa.js";
|
|
11
11
|
import { readFileSync } from "node:fs";
|
|
12
12
|
import { relative } from "node:path";
|
|
13
13
|
// src/cli/sql/exported-copies.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as listPermissions } from "./permission-registry-DstT40VS.js";
|
|
2
2
|
import { i as configError } from "./errors-DgLOqc6j.js";
|
|
3
3
|
import { r as parseSync } from "./optional-CaQWp9HA.js";
|
|
4
|
-
import { i as isModuleKey, n as MODULE_KEYS } from "./config-shape-
|
|
4
|
+
import { i as isModuleKey, n as MODULE_KEYS } from "./config-shape-BODqM-rG.js";
|
|
5
5
|
import { a as loadModule, s as pickNamed, t as asPermissionTree } from "./load-m7jmit3y.js";
|
|
6
6
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
7
7
|
import { dirname, relative, resolve } from "node:path";
|