permdock 0.21.0 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/a2a/index.d.ts +5 -5
- package/dist/a2a/index.js +5 -4
- package/dist/{adoption-scan-UkQisAqe.js → adoption-scan-DzX5Gqcg.js} +1 -1
- package/dist/agent/index.d.ts +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/ai-sdk/index.d.ts +4 -4
- package/dist/ai-sdk/index.js +3 -3
- package/dist/app/index.d.ts +85 -0
- package/dist/app/index.js +91 -0
- package/dist/app-DIvM65Mv.js +24 -0
- package/dist/{approval-policies-CKlByf5o.d.ts → approval-policies-UnDSxT__.d.ts} +2 -2
- package/dist/{approval-prompt-CQFiO1KE.d.ts → approval-prompt-2hTqo6IM.d.ts} +2 -2
- package/dist/approvals/index.d.ts +3 -3
- package/dist/approvals/index.js +3 -3
- package/dist/{approvals-CuXILe52.js → approvals-B_sn4Wrn.js} +6 -6
- package/dist/{arazzo-CUthH61H.js → arazzo-BkjyGVF0.js} +1 -1
- package/dist/{arazzo-BC3uLIZy.js → arazzo-CTx11zFc.js} +3 -3
- package/dist/astro/index.d.ts +6 -6
- package/dist/astro/index.js +2 -2
- package/dist/{audience-BUonniPx.js → audience-5Xx1hdIv.js} +1 -1
- package/dist/{auth-j3Eu-j4h.js → auth-BxXHxWRy.js} +1 -1
- package/dist/authzen/index.d.ts +5 -5
- package/dist/authzen/index.js +4 -4
- package/dist/{automation-CpOk7Tlu.d.ts → automation-B20_8UoT.d.ts} +3 -3
- package/dist/{automation-x3KEUusw.js → automation-BueW05db.js} +2 -2
- package/dist/better-auth/index.d.ts +2 -2
- package/dist/better-auth/index.js +1 -1
- package/dist/better-supabase/index.d.ts +113 -56
- package/dist/better-supabase/index.js +213 -69
- package/dist/better-supabase-DF8f8oly.js +194 -0
- package/dist/{bind-CJf7S-Jd.js → bind-B4Z0U2Gr.js} +5 -5
- package/dist/{bind-XvnD_SUz.d.ts → bind-CnOMjazH.d.ts} +7 -7
- package/dist/{build-instance-CkRKgjSj.js → build-instance-B0vsViF5.js} +3 -25
- package/dist/{capability-zN6T9fxe.js → capability-CenWwTMR.js} +1 -1
- package/dist/{capability-v2xZB7us.d.ts → capability-YkRMUAsF.d.ts} +2 -2
- package/dist/{casbin-v9Xo_XPa.js → casbin-BFOuRptJ.js} +1 -1
- package/dist/{casbin-BOZN1P2Y.js → casbin-BpS9ABSO.js} +1 -1
- package/dist/catalog/index.d.ts +5 -5
- package/dist/catalog/index.js +5 -5
- package/dist/catalog-C462QC3A.js +1 -0
- package/dist/{catalog-DjDc87R2.js → catalog-CoyKnU5c.js} +1 -1
- package/dist/{catalog-s0waIrfY.js → catalog-Y4CjN8NA.js} +4 -4
- package/dist/{catalog-operations-BD22drQf.js → catalog-operations-Do1eD-Rt.js} +1 -1
- package/dist/{challenge-DbkpCx_v.js → challenge-B__LcNve.js} +3 -3
- package/dist/chat/index.d.ts +1 -1
- package/dist/chat/index.js +3 -2
- package/dist/chat-sdk/index.d.ts +3 -3
- package/dist/claude-agent/index.d.ts +3 -3
- package/dist/claude-agent/index.js +2 -2
- package/dist/clerk/index.d.ts +3 -3
- package/dist/cli/bin.js +1 -1
- package/dist/cli/index.d.ts +8 -7
- package/dist/cli/index.js +3 -3
- package/dist/cloud/index.d.ts +8 -8
- package/dist/cloud/index.js +3 -3
- package/dist/{cloud-CB0btByh.js → cloud-DXcQXWDi.js} +2 -2
- package/dist/{codemod-B-duJDFD.js → codemod-CxyKuniX.js} +13 -6
- package/dist/{codemod-C3a3Iz_w.js → codemod-DJ0WqXWk.js} +2 -2
- package/dist/{collect-DN_x7hvV.js → collect-Cr71JA7z.js} +8 -7
- package/dist/{collect-DMQ6Sxr6.js → collect-ScSG05VJ.js} +2 -2
- package/dist/collect-W9i7REKT.js +1 -0
- package/dist/compile/index.d.ts +1 -1
- package/dist/compile/index.js +1 -1
- package/dist/{compile-B_oJqmIg.js → compile-Cvru58id.js} +2 -2
- package/dist/{compile-DonvwG9x.d.ts → compile-DC-BrhH1.d.ts} +3 -3
- package/dist/{completion-6IshPaPd.js → completion-BHVvAJ6Q.js} +1 -1
- package/dist/{delegation-aK4T_5WU.js → condition-evaluate-bVVRSdzq.js} +159 -159
- package/dist/{config-C45X7mpm.js → config-2grt3oll.js} +1 -1
- package/dist/{config-D2oXUwos.js → config-DyNanTjZ.js} +10 -8
- package/dist/{config-report-Bmo62RRr.js → config-report-Cg5Y5j0h.js} +2 -2
- package/dist/{config-shape-D9paLhEX.js → config-shape-C4zqzG2K.js} +9 -2
- package/dist/{context-YhyXyqBI.js → context-Cem4QafV.js} +2 -2
- package/dist/convex/index.d.ts +5 -5
- package/dist/convex/index.js +2 -2
- package/dist/{core-Dxkwz4xR.js → core-CUjhfz0W.js} +6 -6
- package/dist/{core-9KbhurkH.d.ts → core-D2JNg5jA.d.ts} +3 -3
- package/dist/coverage-D8jBJdgD.d.ts +114 -0
- package/dist/coverage-Dh2W_DmF.js +211 -0
- package/dist/{create-DH4ZD0A7.d.ts → create-B2tdOygC.d.ts} +7 -7
- package/dist/{create-Q0wF9Elt.js → create-BJ2_8NDO.js} +5 -5
- package/dist/{create-BRiRVNUO.js → create-BsL5lCWR.js} +8 -7
- package/dist/{create-BzgDDamI.d.ts → create-CPDSbK1a.d.ts} +5 -5
- package/dist/{create-BQOQkYYg.d.ts → create-oMCcZV4X.d.ts} +9 -9
- package/dist/{credential-B3Hj4puZ.js → credential-Bap3HClV.js} +4 -4
- package/dist/{server-D0PW6ZCw.js → credentials-BXV0oz56.js} +3 -146
- package/dist/credentials-DPX140fN.d.ts +125 -0
- package/dist/delivery/index.d.ts +4 -4
- package/dist/delivery/index.js +1 -1
- package/dist/{denied-text-De8cw3MW.d.ts → denied-text-BXQkWU7d.d.ts} +2 -2
- package/dist/{describe-DibQM6g-.d.ts → describe-DVobr5FX.d.ts} +2 -2
- package/dist/{diff-BJv7I3GR.js → diff-BR9JArxz.js} +6 -6
- package/dist/{diff-3fpwo3UD.js → diff-Jc_kbDz-.js} +1 -1
- package/dist/{doctor-Bz7s3JYD.js → doctor-DaRoSPT0.js} +310 -36
- package/dist/{doctor-keoa9DpH.js → doctor-iIbdUK8F.js} +3 -3
- package/dist/drizzle/index.d.ts +3 -3
- package/dist/drizzle/index.js +1 -1
- package/dist/elysia/index.d.ts +5 -5
- package/dist/elysia/index.js +3 -3
- package/dist/{errors-OTE9u4Wk.d.ts → errors-D_JIQJYb.d.ts} +1 -1
- package/dist/{evaluate-Dcq_U2TV.js → evaluate-B5yZHmts.js} +16 -16
- package/dist/{evaluations-CNMVJVD6.js → evaluations-BzTDWO4m.js} +57 -57
- package/dist/{evaluations-OCm_Z-8V.d.ts → evaluations-DQYfh4Jh.d.ts} +3 -3
- package/dist/eve/index.d.ts +5 -5
- package/dist/eve/index.js +3 -3
- package/dist/express/index.d.ts +5 -5
- package/dist/express/index.js +3 -3
- package/dist/fastify/index.d.ts +5 -5
- package/dist/fastify/index.js +3 -3
- package/dist/{fetch-adapter-BlL-ZhHq.d.ts → fetch-adapter-DxqsIXSO.d.ts} +4 -4
- package/dist/{fetch-adapter-4EB3cLgB.js → fetch-adapter-MoYZ-vF5.js} +3 -3
- package/dist/{fields-D_TfExiI.js → fields-CVyOk-f1.js} +2 -2
- package/dist/{fixtures-Cemqurt8.js → fixtures-BVZc7OCF.js} +1 -1
- package/dist/{from-snapshot-DHnb8Fh4.js → from-snapshot-oR_N97dM.js} +346 -14
- package/dist/{gen-Cf7nQsOb.js → gen-Cw8goef4.js} +5 -5
- package/dist/{gen-DYF4LKUP.js → gen-DFpWGJWF.js} +1 -1
- package/dist/{grantee-conditions-DX4K_gGI.js → grantee-conditions-Dzprappv.js} +1 -1
- package/dist/{grantee-match-BP-k4vRJ.js → grantee-match-8J2y60MF.js} +3 -3
- package/dist/h3/index.d.ts +4 -4
- package/dist/h3/index.js +3 -3
- package/dist/{helpers-D-MXwkOF.js → helpers-DzBIfL1N.js} +25 -25
- package/dist/hono/index.d.ts +5 -5
- package/dist/hono/index.js +3 -3
- package/dist/{hosted-C2Pmhy2x.js → hosted-C5I2TSXm.js} +4 -4
- package/dist/{hosted-yhyAuQkL.d.ts → hosted-DXq1plaP.d.ts} +1 -1
- package/dist/{http-DhMWeB_h.js → http-dptLQzPP.js} +1 -1
- package/dist/{expiry-6XByK0dm.js → ids-DzhJaCUj.js} +23 -23
- package/dist/{import-C2ExjVvv.js → import-CvXswHDy.js} +2 -2
- package/dist/{import-CQ_kH_Ny.js → import-DDegvwDI.js} +2 -2
- package/dist/index-BcS8c_2S.d.ts +101 -0
- package/dist/{index--AwSBzJC.d.ts → index-BdZpqhJK.d.ts} +2 -2
- package/dist/{index-CLbGOPBr.d.ts → index-C-R8lBPb.d.ts} +3 -3
- package/dist/{index-Do7FqHEr.d.ts → index-C_8uxAlv.d.ts} +5 -5
- package/dist/{index-tuR-kZoJ.d.ts → index-Cjfa1Uwr.d.ts} +21 -40
- package/dist/{index-BqzpT-90.d.ts → index-iIsqXFVu.d.ts} +6 -6
- package/dist/index.d.ts +19 -20
- package/dist/index.js +25 -24
- package/dist/{init-DvkvbvZ_.js → init-D_T_zgFg.js} +2 -2
- package/dist/{init-kTFkEu8S.js → init-Dz552ZPp.js} +4 -4
- package/dist/{instance-options-Cq66kEeR.d.ts → instance-options-C6gEDOts.d.ts} +1 -1
- package/dist/instance-options-URVwqpMW.js +24 -0
- package/dist/{instance-snapshot-Bi4-dJk0.js → instance-snapshot-D_dGTq--.js} +9 -9
- package/dist/jwt/index.d.ts +4 -4
- package/dist/jwt/index.js +2 -2
- package/dist/{kernel-CLEzDmbv.js → kernel-NmxiWII2.js} +8 -8
- package/dist/kysely/index.d.ts +3 -3
- package/dist/kysely/index.js +1 -1
- package/dist/limits-CAhpRrhk.js +167 -0
- package/dist/{load-BaEamml-.js → load-C4p4VgwR.js} +2 -2
- package/dist/load-DiBUJx77.js +1 -0
- package/dist/{login-9ycIcJZH.js → login-B2usNw0X.js} +4 -4
- package/dist/{login-CM_etiLM.js → login-DIVe6QdP.js} +3 -3
- package/dist/{manifest-B5yF3CIq.d.ts → manifest-C6eFl3Vo.d.ts} +1 -0
- package/dist/{manifest-CCd-xrM3.js → manifest-CbHnl4I_.js} +35 -35
- package/dist/{manifest-BdzBobNK.js → manifest-D44OkoLk.js} +1 -1
- package/dist/{manifest-schema-CsFsYLF-.js → manifest-schema-DUheHWcp.js} +4 -0
- package/dist/{map-claims-PQwHynxV.js → map-claims-CAa_bQt9.js} +1 -1
- package/dist/{map-error-EOhahOVA.js → map-error-p4ROJ_26.js} +1 -1
- package/dist/mcp/index.d.ts +9 -9
- package/dist/mcp/index.js +9 -8
- package/dist/{migrate-CkLHdwuH.js → migrate-DVsxeE0y.js} +1 -1
- package/dist/{module-values-BYuNtdK5.js → module-values-BLiVlO1X.js} +3 -3
- package/dist/nest/index.d.ts +5 -5
- package/dist/nest/index.js +3 -3
- package/dist/next/index.d.ts +43 -17
- package/dist/next/index.js +54 -21
- package/dist/next/plugin.d.ts +1 -1
- package/dist/next/plugin.js +1 -1
- package/dist/node/index.d.ts +5 -5
- package/dist/node/index.js +2 -2
- package/dist/openai/index.d.ts +5 -5
- package/dist/openai/index.js +3 -3
- package/dist/openapi/index.d.ts +5 -59
- package/dist/openapi/index.js +3 -2
- package/dist/{openapi-DA7FVG2F.js → openapi-5moP9sTG.js} +4 -4
- package/dist/{openapi-BOsx0xn9.js → openapi-Cc-aS9xC.js} +6 -135
- package/dist/{openapi-QnnU2A1c.js → openapi-DcvNnLFa.js} +2 -2
- package/dist/{operations-Ci_rT6Uo.d.ts → operations-BMPx7HyO.d.ts} +1 -1
- package/dist/optional-8TKc-0j4.js +47 -0
- package/dist/orpc/index.d.ts +7 -7
- package/dist/orpc/index.js +4 -4
- package/dist/otel/index.d.ts +3 -3
- package/dist/otel/index.js +1 -1
- package/dist/{output-KT0a3B3H.js → output-RIUEs3_S.js} +1 -1
- package/dist/{ownership-CeNOtQMV.js → ownership-adPAsUwY.js} +15 -13
- package/dist/{parse-CXTT7hBq.js → parse-CORUNcCo.js} +1 -1
- package/dist/{parse-local-manifest-CE4tgFsj.d.ts → parse-local-manifest-BaCqsqwC.d.ts} +1 -1
- package/dist/pdp/index.d.ts +3 -3
- package/dist/pdp/index.js +4 -3
- package/dist/{permdock-DbAq8_Fp.js → permdock-B5LyNVgn.js} +70 -34
- package/dist/{permdock-CsrvbzHk.d.ts → permdock-BaB-KQqn.d.ts} +46 -9
- package/dist/{permissions-Dz79qsFw.js → permissions-COpRGKt7.js} +1 -1
- package/dist/{permissions-Bx6UI8n1.d.ts → permissions-DriWkV7q.d.ts} +1 -2
- package/dist/{policy-from-catalog-BtqfxytV.js → policy-from-catalog-Cy103lsm.js} +8 -8
- package/dist/{policy-types-BI9C5Sp5.d.ts → policy-types-rNfz7t0M.d.ts} +9 -3
- package/dist/{policy-CaAME-Rh.js → policy-wGzbAPQF.js} +7 -7
- package/dist/{policy-Dh9WVSVz.d.ts → policy-x8RBKW8d.d.ts} +2 -2
- package/dist/{postgrest-CWCCbaxm.d.ts → postgrest-Cn0Res25.d.ts} +9 -21
- package/dist/{powersync-DiqY3VBG.js → powersync-BUO5uQve.js} +11 -11
- package/dist/{powersync-CWsN-QaK.js → powersync-C5_aFFaU.js} +2 -2
- package/dist/powersync-DhspazC8.js +1 -0
- package/dist/preset/index.js +1 -1
- package/dist/{preset-pPrVyGU5.js → preset-Bn5Z54cH.js} +5 -6
- package/dist/prisma/index.d.ts +2 -2
- package/dist/prisma/index.js +1 -1
- package/dist/{protected-action-CuG0xz4P.d.ts → protected-action-C4aj1KjO.d.ts} +6 -7
- package/dist/{protected-action-CD1HXwQK.js → protected-action-E7Sdt_Dt.js} +1 -1
- package/dist/{provider-ihxuJbMi.d.ts → provider-B-1DlOGM.d.ts} +1 -1
- package/dist/{provider-qESIf_C0.js → provider-DKO9KHua.js} +2 -2
- package/dist/{provider-store-BTHGJH9j.js → provider-store-D4PU1my_.js} +2 -2
- package/dist/{pull-B4EhSqOG.js → pull-BkT7tTKb.js} +6 -6
- package/dist/pull-COPm1W-l.js +1 -0
- package/dist/{push-DYOI4bPf.js → push-CEPcWdTJ.js} +7 -7
- package/dist/{pushed-policy-Dszouliu.js → pushed-policy-Bi5-il4C.js} +2 -2
- package/dist/{pushed-policy-P0hgyLBh.d.ts → pushed-policy-P55cJNx5.d.ts} +1 -1
- package/dist/react/index.d.ts +6 -6
- package/dist/react/index.js +3 -3
- package/dist/react/provider-client.d.ts +1 -1
- package/dist/react/provider-client.js +1 -1
- package/dist/react-native/index.d.ts +9 -9
- package/dist/react-native/index.js +7 -7
- package/dist/{relation-walk-DK_gkgL7.js → relation-walk-BDTaTKTM.js} +1 -1
- package/dist/{relations-BxvRvDHK.js → relations-CMsJ1ARY.js} +1 -1
- package/dist/{replay-DYXI4gRN.d.ts → replay-DKhFvt0L.d.ts} +1 -1
- package/dist/{request-context-VjeXst1z.js → request-context-5gl_oxO1.js} +2 -2
- package/dist/resend/index.d.ts +4 -4
- package/dist/resend/index.js +2 -2
- package/dist/{resolve-names-BIHnWL_L.js → resolve-names-bzYlAXRt.js} +11 -6
- package/dist/{rls-CMFZWosz.js → rls-DTf8X__h.js} +45 -18
- package/dist/{rls-C7qXye9M.js → rls-v6V75yf_.js} +1 -1
- package/dist/{role-builder-C5AgaC1x.js → role-builder-boQiUvfo.js} +3 -3
- package/dist/{rpc-CYXICjM1.d.ts → rpc-BqRiVpbP.d.ts} +2 -2
- package/dist/{rpc-BNIQwEB6.js → rpc-Dhi55Whd.js} +2 -2
- package/dist/{run-CMJX9x7b.js → run-CgSQS9RF.js} +3 -3
- package/dist/run-ItR_bQGz.js +1 -0
- package/dist/{run-ticket-CjvXr6wj.js → run-ticket-Ddxt9OuU.js} +2 -2
- package/dist/{run-ticket-BXYqQ9dy.d.ts → run-ticket-Dulj4RQk.d.ts} +2 -2
- package/dist/{saas-DHFfthXv.js → saas-DABv6vjy.js} +6 -5
- package/dist/{scan-CSOkcNdl.js → scan-BY3Pp1PS.js} +1 -1
- package/dist/{schema-7pXCaRYB.js → schema-B_HsJKm2.js} +1 -1
- package/dist/scim/index.d.ts +1 -1
- package/dist/scim/index.js +1 -1
- package/dist/{scopes-BSdYaGHs.js → scopes-gdH__vDZ.js} +1 -1
- package/dist/server/index.d.ts +11 -10
- package/dist/server/index.js +7 -6
- package/dist/server-CKjFooaJ.js +147 -0
- package/dist/{server-types-Bfl-IrzZ.d.ts → server-types--_Hann81.d.ts} +9 -9
- package/dist/{shared-sW3VYchq.js → shared-DfaIWvIJ.js} +11 -2
- package/dist/{sink-RwmP7ZHs.d.ts → sink-Cs6z34AX.d.ts} +4 -4
- package/dist/{skills-DrX83QBK.js → skills-Bj2wk38p.js} +2 -2
- package/dist/{skills-DAjg-rgF.js → skills-Clo4qYLn.js} +1 -1
- package/dist/{snapshot-DHPih65J.js → snapshot-C2j96x97.js} +4 -4
- package/dist/{snapshot-cache-MPinwwgZ.d.ts → snapshot-cache-Cc7VNabe.d.ts} +1 -1
- package/dist/solid/index.d.ts +6 -7
- package/dist/solid/index.js +2 -2
- package/dist/solid-start/index.d.ts +6 -6
- package/dist/solid-start/index.js +3 -3
- package/dist/{sources-sgQlMfmz.d.ts → sources-CdYZBVcW.d.ts} +2 -2
- package/dist/{src-Cop53_X1.js → src-BG9YJM3Q.js} +96 -247
- package/dist/ssf/index.d.ts +3 -3
- package/dist/ssf/index.js +3 -3
- package/dist/{standard-webhooks-CFZIYtBF.d.ts → standard-webhooks-CJBgfl7y.d.ts} +2 -2
- package/dist/{store-CSOsXd5s.js → store-BpKH-pLm.js} +2 -2
- package/dist/{store-CRQ5VrWR.d.ts → store-DSyjHD5-.d.ts} +5 -5
- package/dist/{store-options-CDvoX52-.js → store-options-CXv6BHH6.js} +5 -6
- package/dist/{stores-PpYVQ5yF.js → stores-BuqAHjp_.js} +1 -1
- package/dist/{stores-pEBMy94l.d.ts → stores-C6-7TPTV.d.ts} +6 -7
- package/dist/{postgrest-BrjrckDG.js → subject-BqFwS6l3.js} +214 -319
- package/dist/subject-cache-BT1fGuea.js +193 -0
- package/dist/subject-cache-d_Z4KAnm.d.ts +144 -0
- package/dist/supabase/index.d.ts +7 -6
- package/dist/supabase/index.js +4 -3
- package/dist/supabase/middleware.d.ts +6 -6
- package/dist/supabase/middleware.js +6 -6
- package/dist/{supabase-Cbl2orB2.js → supabase-CJv6K3iz.js} +2 -2
- package/dist/{supabase-CVZuytCC.js → supabase-DnazO6W4.js} +3 -3
- package/dist/{supabase-hook-BUcu3vPM.js → supabase-hook-DLQMugW8.js} +174 -62
- package/dist/supabase-hook-vZADjjfN.js +1 -0
- package/dist/{supautils-a_253u1X.js → supautils-BHKsP7l-.js} +302 -43
- package/dist/{support-session-BsmPCbz8.js → support-session-BGeEYDSq.js} +2 -2
- package/dist/svelte/index.d.ts +5 -5
- package/dist/svelte/index.js +3 -3
- package/dist/svelte/runtime.d.ts +3 -3
- package/dist/svelte/runtime.js +1 -1
- package/dist/svelte/source.d.ts +5 -5
- package/dist/svelte/source.js +2 -2
- package/dist/sveltekit/index.d.ts +6 -6
- package/dist/sveltekit/index.js +2 -2
- package/dist/{tables-XrvffTMj.js → tables-CbEOy2Ma.js} +137 -55
- package/dist/tanstack-start/index.d.ts +6 -6
- package/dist/tanstack-start/index.js +2 -2
- package/dist/{tenancy-DvOHHk3-.js → tenancy-BlxY5T0q.js} +2 -2
- package/dist/terminal/index.d.ts +6 -6
- package/dist/terminal/index.js +6 -6
- package/dist/testing/core.d.ts +1 -1
- package/dist/testing/core.js +1 -1
- package/dist/testing/fixtures/index.d.ts +36 -3
- package/dist/testing/fixtures/index.js +40 -3
- package/dist/testing/index.d.ts +42 -26
- package/dist/testing/index.js +115 -27
- package/dist/testing/saas/index.d.ts +5 -5
- package/dist/testing/saas/index.js +2 -2
- package/dist/testing/saas/permissions.d.ts +1 -1
- package/dist/testing/saas/permissions.js +1 -1
- package/dist/trpc/index.d.ts +6 -6
- package/dist/trpc/index.js +4 -4
- package/dist/{type-helpers-BjOLGVy1.d.ts → type-helpers-iXJEIDe7.d.ts} +3 -4
- package/dist/{types-p8mhWTcR.d.ts → types-B9F0EZAF.d.ts} +3 -3
- package/dist/{types-DZwEOsK1.d.ts → types-BSNZMp5b.d.ts} +1 -1
- package/dist/{types-MixnvXQ5.d.ts → types-BpxdxaRD.d.ts} +5 -5
- package/dist/{types-C3C9ien9.d.ts → types-CD1qmxdx.d.ts} +4 -4
- package/dist/{types-zh4WGQcP.d.ts → types-C_a44wSr.d.ts} +3 -3
- package/dist/{types-DBVSljAx.d.ts → types-Cq2rvv-C.d.ts} +3 -3
- package/dist/{types--_lpWUGV.d.ts → types-CuDXvyIT.d.ts} +5 -5
- package/dist/{types-7Vlz1Wi2.d.ts → types-DAyp592k.d.ts} +2 -2
- package/dist/{types-DjGZAU64.d.ts → types-NikV1pND.d.ts} +4 -4
- package/dist/{types-BzxA2OAD.d.ts → types-ZfjQB0KC.d.ts} +2 -2
- package/dist/{types-DotXrris.d.ts → types-_pi9kxS2.d.ts} +2 -2
- package/dist/{types-D1NjjwI4.d.ts → types-cNZhj0UF.d.ts} +40 -9
- package/dist/unplugin/index.d.ts +1 -1
- package/dist/unplugin/index.js +1 -1
- package/dist/{usage-DHsqp4lN.js → usage-BUUXeKwk.js} +1 -1
- package/dist/{usage-DPbdI3Vi.js → usage-DlOllyPi.js} +10 -10
- package/dist/usage-NmH5QXKC.js +1 -0
- package/dist/{validation-error-DkOK9zUE.d.ts → validation-error-DLAYFlkr.d.ts} +1 -1
- package/dist/{verify-C0jGJrmb.js → verify-CfmvQjVw.js} +41 -24
- package/dist/version-sources-BC3hf2ME.js +34 -0
- package/dist/{permission-types-CAY-GU7e.d.ts → vocabulary-DeZvUaTw.d.ts} +69 -1
- package/dist/vue/index.d.ts +6 -7
- package/dist/vue/index.js +2 -2
- package/dist/{waiter-BjVI_Byg.d.ts → waiter-cbK1CBhT.d.ts} +2 -2
- package/dist/{watch-Dz2LNM1R.js → watch-BigZ260i.js} +2 -2
- package/dist/watch-CHURMgrv.js +1 -0
- package/dist/webmcp/index.d.ts +2 -2
- package/dist/{who-can-CZeAwQZD.js → who-can-CjfMP9a4.js} +8 -8
- package/dist/workflow/index.d.ts +3 -3
- package/dist/workflow/index.js +6 -5
- package/dist/workflow-sdk/index.d.ts +5 -5
- package/dist/{wrap-EQ6Or2Hi.d.ts → wrap-B-k2qHJx.d.ts} +2 -2
- package/package.json +16 -4
- package/schemas/supabase-manifest-v1.json +6 -0
- package/skills/permdock-wire/references/presets-and-recipes.md +2 -2
- package/dist/better-supabase-ayun1IKE.js +0 -122
- package/dist/catalog-BTPySmbp.js +0 -1
- package/dist/collect-eSTXOZDC.js +0 -1
- package/dist/index-DuOF7OqS.d.ts +0 -222
- package/dist/load-CjnlPxpL.js +0 -1
- package/dist/powersync-CWCirKAJ.js +0 -1
- package/dist/pull-VzcECZ-R.js +0 -1
- package/dist/run-D2e1tybu.js +0 -1
- package/dist/supabase-hook-QWphWBnG.js +0 -1
- package/dist/usage-dmSjKx-Z.js +0 -1
- package/dist/version-cache-q5cpaDSt.d.ts +0 -57
- package/dist/vocabulary-DEJ5j4mR.d.ts +0 -70
- package/dist/watch-CS69ftMP.js +0 -1
- package/dist/where-scope-BAyOsPQW.js +0 -332
- package/dist/{approval-normalize-hlfO9BJv.js → approval-normalize-DNLW0zOM.js} +1 -1
- package/dist/{body-C9JbIoqb.js → body-B3ylkmmE.js} +1 -1
- package/dist/{catalog-doc-nrgfbh8I.js → catalog-doc-Zi0jRpyH.js} +2 -2
- package/dist/{device-BwbJNmb2.js → device-BkSynWdg.js} +1 -1
- package/dist/{prompt-BYc6drYW.js → prompt-D1Gj1W4Y.js} +1 -1
- package/dist/{scim-C30QBBoF.js → scim-BG6uPUeW.js} +1 -1
- package/dist/{wrap-C5PWzgkq.js → wrap-BKU5Arsu.js} +1 -1
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { r as isRecord } from "./compact-CAf557ZB.js";
|
|
2
2
|
import { o as hasConditionOp } from "./refs-C8BKxc_e.js";
|
|
3
|
-
import { c as rootScope, d as scopeList, l as scopeChain, s as resolveScope } from "./scopes-
|
|
3
|
+
import { c as rootScope, d as scopeList, l as scopeChain, s as resolveScope } from "./scopes-gdH__vDZ.js";
|
|
4
|
+
import { r as readMemberships } from "./subject-cache-BT1fGuea.js";
|
|
4
5
|
import { t as APPROVAL_REQUEST_SCHEMA } from "./request-schema-CMP8Cmxd.js";
|
|
5
6
|
import { t as AUTHZ_EVENT } from "./authz-topic-Dbc-HDOS.js";
|
|
6
7
|
import { a as describeError, i as configError } from "./errors-BhRkoNS7.js";
|
|
7
8
|
import { i as readJsonFile, o as sqlFiles, s as writeFileEnsuringDir } from "./files-BSjrtIHw.js";
|
|
8
9
|
import { a as SUPABASE_MANIFEST_SCHEMA } from "./version-DMQ0dnN5.js";
|
|
9
|
-
import { c as requirePolicy } from "./load-
|
|
10
|
+
import { c as requirePolicy } from "./load-C4p4VgwR.js";
|
|
10
11
|
import "./budget-BBCPDOGP.js";
|
|
11
12
|
import { i as qualifySqlTable } from "./sql-0WjxIp9g.js";
|
|
12
|
-
import { i as scopeColumn } from "./compile-
|
|
13
|
-
import { t as authorizeSql } from "./supabase-
|
|
13
|
+
import { i as scopeColumn } from "./compile-Cvru58id.js";
|
|
14
|
+
import { t as authorizeSql } from "./supabase-DnazO6W4.js";
|
|
14
15
|
import { a as hookApiNames, d as keptKeys, t as AUTHZ_VERSION_TABLE, u as roleManifest } from "./sources-C4vkzZJV.js";
|
|
15
|
-
import { o as readMemberships } from "./postgrest-BrjrckDG.js";
|
|
16
16
|
import { t as beforeFirst } from "./text-BMFRfBqc.js";
|
|
17
17
|
import { n as GRANTS_MARKER, r as HOOK_MARKER, s as hookMarkerFields } from "./markers-BeHZ4x9Q.js";
|
|
18
18
|
import { n as formatManifestJson, t as MANIFEST_FILE } from "./manifest-json-CAGzls-C.js";
|
|
19
19
|
import { n as MIGRATION_DIRS } from "./constants-DcJABbLW.js";
|
|
20
20
|
import { f as writeOutputFiles, l as partPath, r as driftOf, u as pgDeltaPath } from "./output-files-CM0BnH05.js";
|
|
21
21
|
import { n as pgConnector } from "./pg-Ddxsd5ZB.js";
|
|
22
|
-
import { A as quoteQualified, D as qualified, F as firstScopeType,
|
|
23
|
-
import {
|
|
24
|
-
import { a as guardedTables, t as ownershipRules, u as roleNames } from "./ownership-
|
|
22
|
+
import { A as quoteQualified, D as qualified$1, F as firstScopeType, L as scopeTypeOf, O as quoteIdent, a as customRolesOn, j as quoteTable, k as quoteLiteral, l as USER_ID_HELPER, r as HELPERS, y as subjectIdSql, z as tenantTypeOf } from "./shared-DfaIWvIJ.js";
|
|
23
|
+
import { C as permittedByPermissionHelper, Et as activeRowSql, K as globalRoleSource, Ot as checkSuspension, S as permissionKeysForHelper, _ as ASSIGNMENTS, _t as memberOfHelper, b as checkName, bt as permittedIdsHelper, ct as hasMemberFor, dt as isTeamScope, et as API_KEY_ALLOWS, gt as memberIdsHelper, ht as memberForTable, k as TOKEN_SCOPE_ALLOWS, lt as hasPermittedUsers, mt as memberForSources, nt as apiKeyFields, pt as memberForHelper, v as OWNERSHIP, vt as memberRoleOf, y as PERMISSION_HELPERS, yt as permittedForHelper } from "./tables-CbEOy2Ma.js";
|
|
24
|
+
import { a as guardedTables, t as ownershipRules, u as roleNames } from "./ownership-adPAsUwY.js";
|
|
25
25
|
import { t as membershipSourcesOf } from "./sources-qoIJQrJv.js";
|
|
26
26
|
import { a as splitUndiffed, r as tableKey, t as decidingColumns } from "./deciding-columns-NB4wcyBf.js";
|
|
27
|
-
import { c as ACTOR_MAY_WRITE, f as readOnlyActorKinds } from "./fields-
|
|
28
|
-
import { r as permittedUsersHelper, t as resolveNames } from "./resolve-names-
|
|
27
|
+
import { c as ACTOR_MAY_WRITE, f as readOnlyActorKinds } from "./fields-CVyOk-f1.js";
|
|
28
|
+
import { r as permittedUsersHelper, t as resolveNames } from "./resolve-names-bzYlAXRt.js";
|
|
29
29
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
30
30
|
import { dirname, join, posix, resolve } from "node:path";
|
|
31
31
|
//#region ../../node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/error.js
|
|
@@ -1620,17 +1620,19 @@ function activeFromSql(input, root) {
|
|
|
1620
1620
|
};
|
|
1621
1621
|
}
|
|
1622
1622
|
/**
|
|
1623
|
-
* One variable per user-keyed table
|
|
1624
|
-
* Supabase Auth issues) as that column's type, so each lookup
|
|
1625
|
-
* column uncast and its index applies.
|
|
1623
|
+
* One variable per user-keyed table `membership_entries_for` reads, holding the
|
|
1624
|
+
* user (a uuid, as Supabase Auth issues) as that column's type, so each lookup
|
|
1625
|
+
* compares the column uncast and its index applies.
|
|
1626
|
+
*/
|
|
1627
|
+
function typedSourceUsers(parts) {
|
|
1628
|
+
return parts.sources.map((source, index) => `\n v_user_${String(index)} ${source.sql.userType} := p_user;`).join("");
|
|
1629
|
+
}
|
|
1630
|
+
/**
|
|
1631
|
+
* The remaining user-keyed variables of the hook: the attribute row and the
|
|
1632
|
+
* active-tenant row, each as its column's type.
|
|
1626
1633
|
*/
|
|
1627
1634
|
function typedUsers(parts) {
|
|
1628
|
-
return [
|
|
1629
|
-
...parts.sources.map((source, index) => `v_user_${String(index)} ${source.sql.userType} := uid;`),
|
|
1630
|
-
...parts.roles === void 0 ? [] : [`v_roles_user ${quoteQualified(parts.roles.table)}.${quoteIdent(parts.roles.user)}%type := uid;`],
|
|
1631
|
-
...parts.attrs?.table === void 0 || parts.attrs.columns.length === 0 ? [] : [`v_attrs_user ${quoteQualified(parts.attrs.table)}.${quoteIdent(parts.attrs.id)}%type := uid;`],
|
|
1632
|
-
...parts.active.userType === void 0 ? [] : [`v_active_user ${parts.active.userType} := uid;`]
|
|
1633
|
-
].map((line) => `\n ${line}`).join("");
|
|
1635
|
+
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("");
|
|
1634
1636
|
}
|
|
1635
1637
|
function checkSources(parts) {
|
|
1636
1638
|
if (parts.sources.length === 0) throw configError("PermDock CLI: supabase.hook.memberships needs at least one tableMembershipSource, junctionMembershipSource or blockMembershipSource source");
|
|
@@ -1660,8 +1662,89 @@ ${source.sql.select(`v_user_${String(index)}`).replaceAll(/^/gmu, " ")}
|
|
|
1660
1662
|
) s`).join("\nunion all\n");
|
|
1661
1663
|
}
|
|
1662
1664
|
//#endregion
|
|
1665
|
+
//#region src/cli/supabase-hook/entries.ts
|
|
1666
|
+
const MEMBERSHIP_ENTRIES_FOR = "membership_entries_for";
|
|
1667
|
+
const GLOBAL_ROLES_FOR = "global_roles_for";
|
|
1668
|
+
function qualified(parts, name) {
|
|
1669
|
+
return `${quoteIdent(parts.schema)}.${name}`;
|
|
1670
|
+
}
|
|
1671
|
+
/**
|
|
1672
|
+
* `membership_entries_for(p_user uuid) returns table(ord int, entry jsonb)`:
|
|
1673
|
+
* every membership entry the hook and `subject_for` read, one row per entry in
|
|
1674
|
+
* the shape of a token's `memberships` claim. Both callers order and budget the
|
|
1675
|
+
* rows themselves; the function never truncates. `security invoker`, so the
|
|
1676
|
+
* caller's table reads apply.
|
|
1677
|
+
*/
|
|
1678
|
+
function membershipEntriesSql(parts) {
|
|
1679
|
+
const fn = qualified(parts, MEMBERSHIP_ENTRIES_FOR);
|
|
1680
|
+
return `-- the membership entries the hook and subject_for read for p_user; no client role may execute it
|
|
1681
|
+
create or replace function ${fn}(p_user uuid)
|
|
1682
|
+
returns table (ord integer, entry jsonb)
|
|
1683
|
+
language plpgsql
|
|
1684
|
+
stable
|
|
1685
|
+
set search_path = ''
|
|
1686
|
+
as $$
|
|
1687
|
+
#variable_conflict use_column
|
|
1688
|
+
declare${typedSourceUsers(parts)}
|
|
1689
|
+
begin
|
|
1690
|
+
return query
|
|
1691
|
+
select x.ord, x.entry
|
|
1692
|
+
from (
|
|
1693
|
+
${entriesSql(parts).replaceAll(/^/gmu, " ")}
|
|
1694
|
+
) x;
|
|
1695
|
+
end;
|
|
1696
|
+
$$;
|
|
1697
|
+
revoke execute on function ${fn}(uuid) from public, anon, authenticated;`;
|
|
1698
|
+
}
|
|
1699
|
+
/**
|
|
1700
|
+
* `global_roles_for(p_user uuid) returns jsonb`: the sorted, distinct global
|
|
1701
|
+
* roles of `p_user` as a json array, for the hook's `roles` and `user_role`
|
|
1702
|
+
* claims and for `subject_for`. Empty without a roles source.
|
|
1703
|
+
*/
|
|
1704
|
+
function globalRolesSql(parts) {
|
|
1705
|
+
const rows = parts.roles;
|
|
1706
|
+
if (rows === void 0) return "";
|
|
1707
|
+
const fn = qualified(parts, GLOBAL_ROLES_FOR);
|
|
1708
|
+
return `-- the global roles of p_user as a json array; no client role may execute it
|
|
1709
|
+
create or replace function ${fn}(p_user uuid)
|
|
1710
|
+
returns jsonb
|
|
1711
|
+
language plpgsql
|
|
1712
|
+
stable
|
|
1713
|
+
set search_path = ''
|
|
1714
|
+
as $$
|
|
1715
|
+
declare
|
|
1716
|
+
v_roles_user ${quoteQualified(rows.table)}.${quoteIdent(rows.user)}%type := p_user;
|
|
1717
|
+
held jsonb;
|
|
1718
|
+
begin
|
|
1719
|
+
select coalesce(jsonb_agg(distinct ${rows.roleSql} order by ${rows.roleSql}) filter (where ${rows.roleSql} is not null), '[]'::jsonb)
|
|
1720
|
+
into held
|
|
1721
|
+
from ${rows.from}
|
|
1722
|
+
where ${rows.userSql} = v_roles_user;
|
|
1723
|
+
return held;
|
|
1724
|
+
end;
|
|
1725
|
+
$$;
|
|
1726
|
+
revoke execute on function ${fn}(uuid) from public, anon, authenticated;`;
|
|
1727
|
+
}
|
|
1728
|
+
/**
|
|
1729
|
+
* Execute on both readers for the invoker hook, which runs as
|
|
1730
|
+
* `supabase_auth_admin`.
|
|
1731
|
+
*/
|
|
1732
|
+
function entriesGrantsSql(parts) {
|
|
1733
|
+
return [MEMBERSHIP_ENTRIES_FOR, ...parts.roles === void 0 ? [] : [GLOBAL_ROLES_FOR]].map((name) => `\ngrant execute on function ${qualified(parts, name)}(uuid) to supabase_auth_admin;`).join("");
|
|
1734
|
+
}
|
|
1735
|
+
/** The `held` assignment, from `global_roles_for` or an empty array. */
|
|
1736
|
+
function heldSql(parts, user) {
|
|
1737
|
+
return parts.roles === void 0 ? ` held := '[]'::jsonb;` : ` held := ${qualified(parts, GLOBAL_ROLES_FOR)}(${user});`;
|
|
1738
|
+
}
|
|
1739
|
+
/** The tenant id of an entry, as the hook orders by it. */
|
|
1740
|
+
function entryTenantSql(parts, alias) {
|
|
1741
|
+
const root = quoteLiteral(parts.root);
|
|
1742
|
+
return `case when ${alias}.entry ->> 'scope' = ${root} then ${alias}.entry ->> 'id' else ${alias}.entry -> 'within' ->> ${root} end`;
|
|
1743
|
+
}
|
|
1744
|
+
//#endregion
|
|
1663
1745
|
//#region src/cli/supabase-hook/api.ts
|
|
1664
1746
|
const SUBJECT_FOR = "subject_for";
|
|
1747
|
+
const PERMDOCK_SUBJECT = "permdock_subject";
|
|
1665
1748
|
/**
|
|
1666
1749
|
* `subject_for(p_user uuid) returns jsonb`: what the hook would put in a token
|
|
1667
1750
|
* for `p_user`, from the same membership, role, suspension and version reads,
|
|
@@ -1673,11 +1756,7 @@ const SUBJECT_FOR = "subject_for";
|
|
|
1673
1756
|
function subjectForSql(parts, config) {
|
|
1674
1757
|
const schema = quoteIdent(parts.schema);
|
|
1675
1758
|
const fn = `${schema}.${SUBJECT_FOR}`;
|
|
1676
|
-
const
|
|
1677
|
-
const roles = rows === void 0 ? ` held := '[]'::jsonb;` : ` select coalesce(jsonb_agg(distinct ${rows.roleSql} order by ${rows.roleSql}) filter (where ${rows.roleSql} is not null), '[]'::jsonb)
|
|
1678
|
-
into held
|
|
1679
|
-
from ${rows.from}
|
|
1680
|
-
where ${rows.userSql} = v_roles_user;`;
|
|
1759
|
+
const roles = heldSql(parts, "uid");
|
|
1681
1760
|
const suspended = parts.users === void 0 ? "" : `
|
|
1682
1761
|
if not ${activeRowSql(parts.users, "uid")} then
|
|
1683
1762
|
return jsonb_build_object('id', uid::text, 'active', false);
|
|
@@ -1722,9 +1801,7 @@ begin
|
|
|
1722
1801
|
${roles}
|
|
1723
1802
|
select coalesce(jsonb_agg(x.entry order by x.ord, x.entry ->> 'scope', x.entry ->> 'id', x.entry::text), '[]'::jsonb)
|
|
1724
1803
|
into memberships
|
|
1725
|
-
from (
|
|
1726
|
-
${entriesSql(parts).replaceAll(/^/gmu, " ")}
|
|
1727
|
-
) x;${custom}${version}${teams}${extra}
|
|
1804
|
+
from ${schema}.${MEMBERSHIP_ENTRIES_FOR}(uid) x;${custom}${version}${teams}${extra}
|
|
1728
1805
|
return jsonb_strip_nulls(jsonb_build_object(
|
|
1729
1806
|
'claims', case when claims = '{}'::jsonb then null else claims end,
|
|
1730
1807
|
'id', uid::text,
|
|
@@ -1739,6 +1816,35 @@ $$;
|
|
|
1739
1816
|
revoke execute on function ${fn}(uuid) from public, anon, authenticated;`;
|
|
1740
1817
|
}
|
|
1741
1818
|
/**
|
|
1819
|
+
* `<helpers schema>.permdock_subject() returns jsonb`: `subject_for` for the
|
|
1820
|
+
* signed-in user, `null` for an anonymous or suspended one. A client role may
|
|
1821
|
+
* execute it because it names no user: `bootstrap` calls it so one round trip
|
|
1822
|
+
* returns the subject the authorizer would otherwise read again.
|
|
1823
|
+
*/
|
|
1824
|
+
function permdockSubjectSql(parts) {
|
|
1825
|
+
const helpers = quoteIdent(parts.helpers.schema);
|
|
1826
|
+
const fn = `${helpers}.${PERMDOCK_SUBJECT}`;
|
|
1827
|
+
return `-- the signed-in user's subject_for record, for a bootstrap that seeds the authorizer; null when anonymous or suspended
|
|
1828
|
+
create or replace function ${fn}()
|
|
1829
|
+
returns jsonb
|
|
1830
|
+
language plpgsql
|
|
1831
|
+
stable
|
|
1832
|
+
security definer
|
|
1833
|
+
set search_path = ''
|
|
1834
|
+
as $$
|
|
1835
|
+
declare
|
|
1836
|
+
subject jsonb := ${quoteIdent(parts.schema)}.${SUBJECT_FOR}((select ${helpers}.${USER_ID_HELPER}()));
|
|
1837
|
+
begin
|
|
1838
|
+
if subject is null or (subject ->> 'active') is distinct from 'true' then
|
|
1839
|
+
return null;
|
|
1840
|
+
end if;
|
|
1841
|
+
return subject;
|
|
1842
|
+
end;
|
|
1843
|
+
$$;
|
|
1844
|
+
revoke execute on function ${fn}() from public, anon, authenticated;
|
|
1845
|
+
grant execute on function ${fn}() to authenticated;`;
|
|
1846
|
+
}
|
|
1847
|
+
/**
|
|
1742
1848
|
* The PostgREST wrappers `supabase.hook.api` asks for: one `security invoker`
|
|
1743
1849
|
* function per reader, in the API schema, executable by `service_role` only.
|
|
1744
1850
|
* The `security definer` readers stay in the hook schema, which the Data API
|
|
@@ -1929,9 +2035,9 @@ function approvalManagersSql(ctx, given, isApprover, base, delegations) {
|
|
|
1929
2035
|
const table = quoteQualified(managers.table);
|
|
1930
2036
|
const user = quoteIdent(managers.user);
|
|
1931
2037
|
const boss = quoteIdent(managers.manager);
|
|
1932
|
-
const manages = qualified(ctx, MANAGES);
|
|
1933
|
-
const managesFor = qualified(ctx, MANAGES_FOR);
|
|
1934
|
-
const approves = qualified(ctx, APPROVES);
|
|
2038
|
+
const manages = qualified$1(ctx, MANAGES);
|
|
2039
|
+
const managesFor = qualified$1(ctx, MANAGES_FOR);
|
|
2040
|
+
const approves = qualified$1(ctx, APPROVES);
|
|
1935
2041
|
const me = `${subjectIdSql(ctx)}::text`;
|
|
1936
2042
|
const entry = delegations ? "" : `
|
|
1937
2043
|
-- approvers with managers: permdock_approves for the signed-in user
|
|
@@ -2121,15 +2227,15 @@ function approvalPoliciesSql(ctx, given, actorMayWrite = false) {
|
|
|
2121
2227
|
const keys = `{${path.map((key) => `"${key.replaceAll("\"", String.raw`\"`)}"`).join(",")}}`;
|
|
2122
2228
|
const policyIn = (alias) => path.length === 0 ? `${alias}${bodyColumn}` : `(${alias}${bodyColumn} #> ${quoteLiteral(keys)})`;
|
|
2123
2229
|
const tableName = options.table === void 0 ? APPROVAL_POLICIES.table : options.table.split(".").at(-1) ?? APPROVAL_POLICIES.table;
|
|
2124
|
-
const table = options.table === void 0 ? qualified(ctx, APPROVAL_POLICIES.table) : quoteQualified(options.table);
|
|
2125
|
-
const fn = qualified(ctx, options.function ?? APPROVAL_POLICIES.read);
|
|
2126
|
-
const member = `${tenantColumn} in (select m.id::text from ${qualified(ctx, memberIdsHelper(root))}() m(id))`;
|
|
2230
|
+
const table = options.table === void 0 ? qualified$1(ctx, APPROVAL_POLICIES.table) : quoteQualified(options.table);
|
|
2231
|
+
const fn = qualified$1(ctx, options.function ?? APPROVAL_POLICIES.read);
|
|
2232
|
+
const member = `${tenantColumn} in (select m.id::text from ${qualified$1(ctx, memberIdsHelper(root))}() m(id))`;
|
|
2127
2233
|
const manages = `exists (
|
|
2128
2234
|
select 1
|
|
2129
|
-
from ${qualified(ctx, checkName(permittedByPermissionHelper(root)))}(${quoteLiteral(options.manage)}) i(id)
|
|
2235
|
+
from ${qualified$1(ctx, checkName(permittedByPermissionHelper(root)))}(${quoteLiteral(options.manage)}) i(id)
|
|
2130
2236
|
where i.id::text = ${tenantColumn}
|
|
2131
2237
|
)`;
|
|
2132
|
-
const writable = actorMayWrite ? ` and (select ${qualified(ctx, ACTOR_MAY_WRITE)}())` : "";
|
|
2238
|
+
const writable = actorMayWrite ? ` and (select ${qualified$1(ctx, ACTOR_MAY_WRITE)}())` : "";
|
|
2133
2239
|
const own = `${tenantColumn} is not null and ${subjectIdSql(ctx)} is not null and ${manages}${writable}`;
|
|
2134
2240
|
const policy = (suffix) => quoteIdent(`${tableName}_${suffix}`);
|
|
2135
2241
|
return `
|
|
@@ -2266,8 +2372,8 @@ $permdock$;\n`;
|
|
|
2266
2372
|
* server, which grants its own role.
|
|
2267
2373
|
*/
|
|
2268
2374
|
function approvalStoreSql(ctx, jsonSchema = false) {
|
|
2269
|
-
const table = qualified(ctx, APPROVAL_STORE.table);
|
|
2270
|
-
const fn = (name) => qualified(ctx, name);
|
|
2375
|
+
const table = qualified$1(ctx, APPROVAL_STORE.table);
|
|
2376
|
+
const fn = (name) => qualified$1(ctx, name);
|
|
2271
2377
|
const index = (name) => `"${APPROVAL_STORE.table}_${name}"`;
|
|
2272
2378
|
return `-- approval store: ApprovalRequest bodies, opened, resolved and consumed through the functions below; supabaseApprovalStore calls them
|
|
2273
2379
|
create table if not exists ${table} (
|
|
@@ -2429,13 +2535,13 @@ ${serverOnly(fn(APPROVAL_STORE.cancel), "jsonb, text, text, text")}
|
|
|
2429
2535
|
* membership source, so they match nobody.
|
|
2430
2536
|
*/
|
|
2431
2537
|
function isApproverSql(ctx, managers = false) {
|
|
2432
|
-
const fn = qualified(ctx, managers ? APPROVAL_STORE.isApproverBase : APPROVAL_STORE.isApprover);
|
|
2538
|
+
const fn = qualified$1(ctx, managers ? APPROVAL_STORE.isApproverBase : APPROVAL_STORE.isApprover);
|
|
2433
2539
|
const exposure = managers ? `revoke execute on function ${fn}(jsonb, text) from public, anon, authenticated;` : `revoke execute on function ${fn}(jsonb, text) from public, anon;
|
|
2434
2540
|
grant execute on function ${fn}(jsonb, text) to authenticated;`;
|
|
2435
2541
|
const root = ctx.scopes[0]?.name;
|
|
2436
2542
|
const inTenant = root === void 0 ? "false" : `exists (
|
|
2437
2543
|
select 1
|
|
2438
|
-
from ${qualified(ctx, checkName(permittedByPermissionHelper(root)))}(p_approvers ->> 'permission') i(id)
|
|
2544
|
+
from ${qualified$1(ctx, checkName(permittedByPermissionHelper(root)))}(p_approvers ->> 'permission') i(id)
|
|
2439
2545
|
where i.id::text = p_tenant
|
|
2440
2546
|
)`;
|
|
2441
2547
|
return `
|
|
@@ -2473,7 +2579,7 @@ begin
|
|
|
2473
2579
|
return coalesce(p_approvers ->> 'id' = v_user, false);
|
|
2474
2580
|
when 'permission' then
|
|
2475
2581
|
if p_tenant is null then
|
|
2476
|
-
return coalesce(${qualified(ctx, PERMISSION_HELPERS.has)}(p_approvers ->> 'permission'), false);
|
|
2582
|
+
return coalesce(${qualified$1(ctx, PERMISSION_HELPERS.has)}(p_approvers ->> 'permission'), false);
|
|
2477
2583
|
end if;
|
|
2478
2584
|
return ${inTenant};
|
|
2479
2585
|
when 'any-of' then
|
|
@@ -2533,7 +2639,7 @@ function approvalsSql(ctx, approvals, jsonSchema, actorMayWrite = false) {
|
|
|
2533
2639
|
...approvals,
|
|
2534
2640
|
table
|
|
2535
2641
|
}, jsonSchema);
|
|
2536
|
-
return store + isApproverSql(ctx, managers !== void 0) + (managers === void 0 ? "" : approvalManagersSql(ctx, managers, qualified(ctx, APPROVAL_STORE.isApprover), qualified(ctx, APPROVAL_STORE.isApproverBase), delegations === true)) + (delegations === true ? approvalDelegationsSql(ctx, actorMayWrite, managers !== void 0) : "") + (delegations === true || managers !== void 0 ? requestApproversSql(ctx) : "") + (tenantPolicies === void 0 ? "" : approvalPoliciesSql(ctx, tenantPolicies, actorMayWrite));
|
|
2642
|
+
return store + isApproverSql(ctx, managers !== void 0) + (managers === void 0 ? "" : approvalManagersSql(ctx, managers, qualified$1(ctx, APPROVAL_STORE.isApprover), qualified$1(ctx, APPROVAL_STORE.isApproverBase), delegations === true)) + (delegations === true ? approvalDelegationsSql(ctx, actorMayWrite, managers !== void 0) : "") + (delegations === true || managers !== void 0 ? requestApproversSql(ctx) : "") + (tenantPolicies === void 0 ? "" : approvalPoliciesSql(ctx, tenantPolicies, actorMayWrite));
|
|
2537
2643
|
}
|
|
2538
2644
|
/**
|
|
2539
2645
|
* The objects `rls.approvals.delegations` adds; `tableApprovalDelegationSource`
|
|
@@ -2555,30 +2661,30 @@ const DELEGATIONS = {
|
|
|
2555
2661
|
* mode only `user()` approvers pass.
|
|
2556
2662
|
*/
|
|
2557
2663
|
function approvalDelegationsSql(ctx, actorMayWrite = false, managers = false) {
|
|
2558
|
-
const table = qualified(ctx, DELEGATIONS.table);
|
|
2559
|
-
const fn = qualified(ctx, APPROVAL_STORE.isApprover);
|
|
2560
|
-
const covers = qualified(ctx, DELEGATIONS.covers);
|
|
2664
|
+
const table = qualified$1(ctx, DELEGATIONS.table);
|
|
2665
|
+
const fn = qualified$1(ctx, APPROVAL_STORE.isApprover);
|
|
2666
|
+
const covers = qualified$1(ctx, DELEGATIONS.covers);
|
|
2561
2667
|
const user = ctx.dialect === "supabase" ? "uuid" : "text";
|
|
2562
2668
|
const me = `${subjectIdSql(ctx)}::text`;
|
|
2563
2669
|
const defaultMe = subjectIdSql(ctx).replace(/^\(select (.+)\)$/su, "$1");
|
|
2564
2670
|
const root = ctx.scopes[0]?.name;
|
|
2565
|
-
const member = (tenant) => root === void 0 ? "false" : `${tenant} in (select m.id::text from ${qualified(ctx, memberIdsHelper(root))}() m(id))`;
|
|
2671
|
+
const member = (tenant) => root === void 0 ? "false" : `${tenant} in (select m.id::text from ${qualified$1(ctx, memberIdsHelper(root))}() m(id))`;
|
|
2566
2672
|
const database = ctx.authorize === "database";
|
|
2567
|
-
const holderGlobal = database ? `coalesce(${qualified(ctx, PERMISSION_HELPERS.hasFor)}(p_delegator, p_approvers ->> 'permission'), false)` : "false";
|
|
2673
|
+
const holderGlobal = database ? `coalesce(${qualified$1(ctx, PERMISSION_HELPERS.hasFor)}(p_delegator, p_approvers ->> 'permission'), false)` : "false";
|
|
2568
2674
|
const holderTenant = database && root !== void 0 ? `exists (
|
|
2569
2675
|
select 1
|
|
2570
|
-
from ${qualified(ctx, checkName(`${permittedByPermissionHelper(root)}_for`))}(p_delegator, p_approvers ->> 'permission') i(id)
|
|
2676
|
+
from ${qualified$1(ctx, checkName(`${permittedByPermissionHelper(root)}_for`))}(p_delegator, p_approvers ->> 'permission') i(id)
|
|
2571
2677
|
where i.id::text = p_tenant
|
|
2572
2678
|
)` : "false";
|
|
2573
2679
|
const policy = (name) => quoteIdent(`${DELEGATIONS.table}_${name}`);
|
|
2574
|
-
const writable = actorMayWrite ? ` and (select ${qualified(ctx, ACTOR_MAY_WRITE)}())` : "";
|
|
2680
|
+
const writable = actorMayWrite ? ` and (select ${qualified$1(ctx, ACTOR_MAY_WRITE)}())` : "";
|
|
2575
2681
|
const managerCase = managers ? `
|
|
2576
2682
|
when 'manager' then
|
|
2577
2683
|
v_levels := coalesce(p_approvers -> 'levels', '1'::jsonb);
|
|
2578
2684
|
if jsonb_typeof(v_levels) <> 'number' or v_levels::text !~ '^[0-9]{1,2}$' then
|
|
2579
2685
|
return false;
|
|
2580
2686
|
end if;
|
|
2581
|
-
return coalesce(${qualified(ctx, MANAGES_FOR)}(p_delegator::text, p_requester, v_levels::text::integer), false);` : "";
|
|
2687
|
+
return coalesce(${qualified$1(ctx, MANAGES_FOR)}(p_delegator::text, p_requester, v_levels::text::integer), false);` : "";
|
|
2582
2688
|
const mine = `delegator::text = ${me}${writable}`;
|
|
2583
2689
|
const own = `${mine} and (tenant is null or ${member("tenant")})`;
|
|
2584
2690
|
return `
|
|
@@ -2683,7 +2789,7 @@ declare
|
|
|
2683
2789
|
v_delegator ${user};
|
|
2684
2790
|
v_user text := ${me};
|
|
2685
2791
|
begin
|
|
2686
|
-
if ${managers ? `${qualified(ctx, APPROVES)}(p_approvers, p_tenant, p_requester)` : `${fn}(p_approvers, p_tenant)`} then
|
|
2792
|
+
if ${managers ? `${qualified$1(ctx, APPROVES)}(p_approvers, p_tenant, p_requester)` : `${fn}(p_approvers, p_tenant)`} then
|
|
2687
2793
|
return true;
|
|
2688
2794
|
end if;
|
|
2689
2795
|
if coalesce(v_user, '') = '' or coalesce(p_requester, '') = '' then
|
|
@@ -2716,7 +2822,7 @@ grant execute on function ${fn}(jsonb, text, text, text) to authenticated;
|
|
|
2716
2822
|
`;
|
|
2717
2823
|
}
|
|
2718
2824
|
function requestApproversSql(ctx) {
|
|
2719
|
-
const fn = qualified(ctx, APPROVAL_STORE.isApprover);
|
|
2825
|
+
const fn = qualified$1(ctx, APPROVAL_STORE.isApprover);
|
|
2720
2826
|
return `
|
|
2721
2827
|
-- approvers with the current step: the four-argument check over p_approvers and the step's users, manager and permission
|
|
2722
2828
|
create or replace function ${fn}(p_approvers jsonb, p_tenant text, p_requester text, p_resource text, p_request_approvers jsonb)
|
|
@@ -2821,7 +2927,7 @@ function adoptedApprovalStoreSql(ctx, adopt, jsonSchema = false) {
|
|
|
2821
2927
|
if (open !== "insert" && open !== "attach") throw configError(`PermDock CLI: rls.approvals.open must be 'insert' or 'attach', got '${String(open)}'`);
|
|
2822
2928
|
const schema = adopt.schema;
|
|
2823
2929
|
if (schema !== void 0 && (typeof schema !== "string" || schema === "")) throw configError("PermDock CLI: rls.approvals.schema must be a schema name");
|
|
2824
|
-
const fn = (name) => schema === void 0 ? qualified(ctx, name) : `${quoteIdent(schema)}.${name}`;
|
|
2930
|
+
const fn = (name) => schema === void 0 ? qualified$1(ctx, name) : `${quoteIdent(schema)}.${name}`;
|
|
2825
2931
|
const index = (name) => quoteIdent(`${base}_permdock_${name}`);
|
|
2826
2932
|
const status = `a.${body} ->> 'status'`;
|
|
2827
2933
|
const expires = `(a.${body} ->> 'expiresAt')::timestamptz`;
|
|
@@ -2995,14 +3101,15 @@ ${serverOnly(fn(APPROVAL_STORE.cancel), "jsonb, text, text, text")}
|
|
|
2995
3101
|
//#endregion
|
|
2996
3102
|
//#region src/cli/supabase-hook/sql.ts
|
|
2997
3103
|
const MANAGED_TRIGGER = "permdock_protect_managed";
|
|
3104
|
+
function schemaSql(parts) {
|
|
3105
|
+
if (parts.schema === "public") return "";
|
|
3106
|
+
const schema = quoteIdent(parts.schema);
|
|
3107
|
+
return `create schema if not exists ${schema};\nrevoke all on schema ${schema} from public;`;
|
|
3108
|
+
}
|
|
2998
3109
|
function hookSql(parts) {
|
|
2999
3110
|
const schema = quoteIdent(parts.schema);
|
|
3000
3111
|
const fn = `${schema}.custom_access_token_hook`;
|
|
3001
|
-
const
|
|
3002
|
-
const roles = rows === void 0 ? ` held := '[]'::jsonb;` : ` select coalesce(jsonb_agg(distinct ${rows.roleSql} order by ${rows.roleSql}) filter (where ${rows.roleSql} is not null), '[]'::jsonb)
|
|
3003
|
-
into held
|
|
3004
|
-
from ${rows.from}
|
|
3005
|
-
where ${rows.userSql} = v_roles_user;`;
|
|
3112
|
+
const roles = heldSql(parts, "uid");
|
|
3006
3113
|
const plan = parts.attrs;
|
|
3007
3114
|
const tableMembershipSource = plan === void 0 || plan.columns.length === 0 || plan.table === void 0 ? "" : `
|
|
3008
3115
|
select jsonb_strip_nulls(jsonb_build_object(${plan.columns.map((column) => `${quoteLiteral(column)}, to_jsonb(p.${quoteIdent(column)})`).join(", ")}))
|
|
@@ -3055,7 +3162,7 @@ function hookSql(parts) {
|
|
|
3055
3162
|
if team_ids <> '[]'::jsonb then
|
|
3056
3163
|
claims := jsonb_set(claims, '{team_ids}', team_ids);
|
|
3057
3164
|
end if;`;
|
|
3058
|
-
return
|
|
3165
|
+
return `create or replace function ${fn}(event jsonb)
|
|
3059
3166
|
returns jsonb
|
|
3060
3167
|
language plpgsql
|
|
3061
3168
|
stable${parts.hook.security === "definer" ? "\nsecurity definer" : ""}
|
|
@@ -3083,11 +3190,12 @@ ${roles}
|
|
|
3083
3190
|
end if;
|
|
3084
3191
|
active := ${parts.active.sql};${attrs}
|
|
3085
3192
|
for item in
|
|
3086
|
-
select x.entry, x.
|
|
3193
|
+
select x.entry, x.root_id is not distinct from active as current
|
|
3087
3194
|
from (
|
|
3088
|
-
${
|
|
3195
|
+
select e.ord, e.entry, ${entryTenantSql(parts, "e")} as root_id
|
|
3196
|
+
from ${quoteIdent(parts.schema)}.${MEMBERSHIP_ENTRIES_FOR}(uid) e
|
|
3089
3197
|
) x
|
|
3090
|
-
order by (x.
|
|
3198
|
+
order by (x.root_id is not distinct from active) desc, x.ord, x.entry ->> 'scope', x.entry ->> 'id', x.entry::text
|
|
3091
3199
|
loop
|
|
3092
3200
|
if octet_length((kept || jsonb_build_array(item.entry))::text) + used > budget then
|
|
3093
3201
|
truncated := true;
|
|
@@ -3121,7 +3229,7 @@ grant execute on function ${fn}(jsonb) to supabase_auth_admin;${extraRevokesSql(
|
|
|
3121
3229
|
`-- supabase_auth_admin: the grants and read policies the hook needs
|
|
3122
3230
|
grant usage on schema ${schema} to supabase_auth_admin;
|
|
3123
3231
|
grant execute on function ${fn}(jsonb) to supabase_auth_admin;
|
|
3124
|
-
revoke execute on function ${fn}(jsonb) from authenticated, anon, public;${extraGrantsSql(parts.extra)}${beforeGrantsSql(parts.before, parts.extra)}${memberForGrantsSql(parts)}${validateGrantsSql(parts)}`,
|
|
3232
|
+
revoke execute on function ${fn}(jsonb) from authenticated, anon, public;${extraGrantsSql(parts.extra)}${beforeGrantsSql(parts.before, parts.extra)}${entriesGrantsSql(parts)}${memberForGrantsSql(parts)}${validateGrantsSql(parts)}`,
|
|
3125
3233
|
readsSql(parts),
|
|
3126
3234
|
parts.version ? authAdminRead(`${parts.schema}.${AUTHZ_VERSION_TABLE}`, "version") : ""
|
|
3127
3235
|
].filter((chunk) => chunk !== "").join("\n");
|
|
@@ -3939,10 +4047,14 @@ function supabaseHookSql(scopes, config, overrides = {}, grantsOut) {
|
|
|
3939
4047
|
-- custom_access_token_hook(jsonb): memberships go active ${parts.root} first and stop at the budget
|
|
3940
4048
|
-- supabase/config.toml:
|
|
3941
4049
|
${toml}${grantsOut === void 0 ? "" : `\n-- what supabase db diff drops from this part is in ${grantsOut}`}`,
|
|
4050
|
+
schemaSql(parts),
|
|
3942
4051
|
attrsGuardSql(parts.attrs),
|
|
4052
|
+
globalRolesSql(parts),
|
|
4053
|
+
membershipEntriesSql(parts),
|
|
3943
4054
|
hookSql(parts),
|
|
3944
4055
|
versionSql(parts),
|
|
3945
4056
|
subjectForSql(parts, config),
|
|
4057
|
+
permdockSubjectSql(parts),
|
|
3946
4058
|
authzVersionForSql(parts),
|
|
3947
4059
|
membersOfSql(parts),
|
|
3948
4060
|
teamIdsOfSql(parts),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { i as runSupabase } from "./supabase-hook-DLQMugW8.js";
|