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,15 +1,15 @@
|
|
|
1
1
|
import { c as listPermissions, h as formerKeys } from "./permission-registry-B8tYxPIt.js";
|
|
2
2
|
import { a as expandRelation, c as isEdgeRelation, d as isSelfParented, l as isFieldRelation, o as groupEntries, p as restrictedFor, u as isPrincipalRelation } from "./resource-relations-8-pCScBO.js";
|
|
3
|
-
import { c as rootScope, d as scopeList, l as scopeChain, s as resolveScope } from "./scopes-BSdYaGHs.js";
|
|
4
3
|
import { o as flattenGrantee } from "./grantee-Dke-9rd1.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { c as rootScope, d as scopeList, l as scopeChain, s as resolveScope } from "./scopes-gdH__vDZ.js";
|
|
5
|
+
import { r as relationCondition, t as inheritCondition } from "./grantee-conditions-Dzprappv.js";
|
|
6
|
+
import { l as partitionsOf, p as scopeField } from "./tenancy-BlxY5T0q.js";
|
|
7
|
+
import { a as delegatedScopeMap } from "./permdock-B5LyNVgn.js";
|
|
8
8
|
import { i as configError } from "./errors-BhRkoNS7.js";
|
|
9
9
|
import { d as sqlTextArray, i as qualifySqlTable, t as SQL_IDENT } from "./sql-0WjxIp9g.js";
|
|
10
|
-
import { a as scopeMembershipTable, d as restrictedRowsSql, i as scopeColumn, l as relationArmSql } from "./compile-
|
|
10
|
+
import { a as scopeMembershipTable, d as restrictedRowsSql, i as scopeColumn, l as relationArmSql } from "./compile-Cvru58id.js";
|
|
11
11
|
import { d as keptKeys, l as roleColumn, t as AUTHZ_VERSION_TABLE, u as roleManifest } from "./sources-C4vkzZJV.js";
|
|
12
|
-
import { A as quoteQualified, D as qualified, E as helperSchema,
|
|
12
|
+
import { A as quoteQualified, D as qualified, E as helperSchema, L as scopeTypeOf, O as quoteIdent, _ as subjectClaimJsonSql, d as keyTenantSql, f as kindFilterSql, h as roleKindSql, i as allowEntry, j as quoteTable, k as quoteLiteral, m as memberVia, n as GLOBAL_ROLES, o as rootName, r as HELPERS, s as signedIn, t as CUSTOM_ROLES, u as globalKindFilterSql, v as subjectClaimSql, w as CLI, x as userIdHelperSql, y as subjectIdSql, z as tenantTypeOf } from "./shared-DfaIWvIJ.js";
|
|
13
13
|
//#region src/cli/sql/active.ts
|
|
14
14
|
function checkActiveRow(label, row) {
|
|
15
15
|
quoteTable(row.table);
|
|
@@ -1373,14 +1373,34 @@ function sourcesBodyOf(sql, sources, user) {
|
|
|
1373
1373
|
vars: sources.map((source, index) => `${sourceUser(index)} ${source.sql.userType} := ${user};`)
|
|
1374
1374
|
};
|
|
1375
1375
|
}
|
|
1376
|
+
/** SQL reading the memo at `key`: a text value, or null when unset. */
|
|
1377
|
+
function memoReadSql(api, key) {
|
|
1378
|
+
return api === "better-supabase" ? `better_supabase.memo_get(${key})` : `nullif(current_setting(${key}, true), '')`;
|
|
1379
|
+
}
|
|
1380
|
+
/** SQL writing `value` to the memo at `key`. */
|
|
1381
|
+
function memoWriteSql(api, key, value) {
|
|
1382
|
+
return api === "better-supabase" ? `better_supabase.memo_set(${key}, ${value})` : `set_config(${key}, ${value}, true)`;
|
|
1383
|
+
}
|
|
1384
|
+
function memoDiscriminatorSql(user, key) {
|
|
1385
|
+
return `md5(concat_ws('|',
|
|
1386
|
+
${user},
|
|
1387
|
+
${key},
|
|
1388
|
+
coalesce((select auth.jwt()) ->> 'authz_ver', ''),
|
|
1389
|
+
coalesce(nullif(current_setting('permdock.m.gen', true), ''), '0'),
|
|
1390
|
+
statement_timestamp()::text,
|
|
1391
|
+
md5(coalesce((select auth.jwt())::text, ''))
|
|
1392
|
+
))`;
|
|
1393
|
+
}
|
|
1376
1394
|
/**
|
|
1377
1395
|
* `language sql`, or `plpgsql` returning the query when the body declares
|
|
1378
1396
|
* variables.
|
|
1379
1397
|
*/
|
|
1380
|
-
function functionBody(body) {
|
|
1398
|
+
function functionBody(body, parallelSafe = false) {
|
|
1399
|
+
const planner = `cost 1000${parallelSafe ? "\nparallel safe" : ""}`;
|
|
1381
1400
|
if (body.memo !== void 0) return `language plpgsql
|
|
1382
1401
|
volatile
|
|
1383
1402
|
security definer
|
|
1403
|
+
cost 1000
|
|
1384
1404
|
set search_path = ''
|
|
1385
1405
|
as $$
|
|
1386
1406
|
declare
|
|
@@ -1388,15 +1408,8 @@ ${[
|
|
|
1388
1408
|
...body.vars,
|
|
1389
1409
|
`v_user text := ${body.memo.user}::text;`,
|
|
1390
1410
|
`v_key text := 'permdock.m.' || ${quoteLiteral(body.memo.scope)} || '.k' || (hashtext(p_grant) & 1023)::text;`,
|
|
1391
|
-
`v_disc text :=
|
|
1392
|
-
|
|
1393
|
-
p_grant,
|
|
1394
|
-
coalesce((select auth.jwt()) ->> 'authz_ver', ''),
|
|
1395
|
-
coalesce(nullif(current_setting('permdock.m.gen', true), ''), '0'),
|
|
1396
|
-
statement_timestamp()::text,
|
|
1397
|
-
md5(coalesce((select auth.jwt())::text, ''))
|
|
1398
|
-
));`,
|
|
1399
|
-
`v_memo text := nullif(current_setting(v_key, true), '');`,
|
|
1411
|
+
`v_disc text := ${memoDiscriminatorSql("v_user", "p_grant")};`,
|
|
1412
|
+
`v_memo text := ${memoReadSql(body.memo.api, "v_key")};`,
|
|
1400
1413
|
`v_ids ${body.memo.type}[];`
|
|
1401
1414
|
].map((line) => ` ${line}`).join("\n")}
|
|
1402
1415
|
begin
|
|
@@ -1406,7 +1419,7 @@ begin
|
|
|
1406
1419
|
v_ids := array(
|
|
1407
1420
|
${body.sql}
|
|
1408
1421
|
);
|
|
1409
|
-
perform
|
|
1422
|
+
perform ${memoWriteSql(body.memo.api, "v_key", "jsonb_build_object('k', v_disc, 'ids', to_jsonb(v_ids))::text")};
|
|
1410
1423
|
end if;
|
|
1411
1424
|
return query select unnest(v_ids);
|
|
1412
1425
|
end;
|
|
@@ -1414,6 +1427,7 @@ $$;`;
|
|
|
1414
1427
|
if (body.vars.length === 0) return `language sql
|
|
1415
1428
|
stable
|
|
1416
1429
|
security definer
|
|
1430
|
+
${planner}
|
|
1417
1431
|
set search_path = ''
|
|
1418
1432
|
as $$
|
|
1419
1433
|
${body.sql}
|
|
@@ -1421,6 +1435,7 @@ $$;`;
|
|
|
1421
1435
|
return `language plpgsql
|
|
1422
1436
|
stable
|
|
1423
1437
|
security definer
|
|
1438
|
+
${planner}
|
|
1424
1439
|
set search_path = ''
|
|
1425
1440
|
as $$
|
|
1426
1441
|
declare
|
|
@@ -2432,13 +2447,25 @@ function suspensionTargets(targets, row) {
|
|
|
2432
2447
|
const columns = [...row.disabledAt === void 0 ? [] : [row.disabledAt], ...row.status === void 0 ? [] : [row.status]];
|
|
2433
2448
|
add(targets, row.table, columns);
|
|
2434
2449
|
}
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2450
|
+
const IDENT = String.raw`(?:"(?:[^"]|"")+"|[A-Za-z_][A-Za-z0-9_$]*)`;
|
|
2451
|
+
const READ = new RegExp(String.raw`(?<!\bdistinct\s+)(?<!\bextract\s*\([^()]*)\b(?:from|join)\s+(${IDENT})\.(${IDENT})(?![\w$]|\s*[.(])`, "gu");
|
|
2452
|
+
const SYSTEM = /* @__PURE__ */ new Set([
|
|
2453
|
+
"auth",
|
|
2454
|
+
"pg_catalog",
|
|
2455
|
+
"information_schema"
|
|
2456
|
+
]);
|
|
2457
|
+
function unquote(name) {
|
|
2458
|
+
return name.startsWith("\"") ? name.slice(1, -1).replaceAll("\"\"", "\"") : name;
|
|
2459
|
+
}
|
|
2460
|
+
function readTables(sql) {
|
|
2461
|
+
const out = /* @__PURE__ */ new Set();
|
|
2462
|
+
for (const [, schema = "", table = ""] of sql.matchAll(READ)) {
|
|
2463
|
+
const name = unquote(schema);
|
|
2464
|
+
if (!SYSTEM.has(name)) out.add(`${name}.${unquote(table)}`);
|
|
2465
|
+
}
|
|
2466
|
+
return [...out];
|
|
2467
|
+
}
|
|
2468
|
+
function memoTargets(ctx, reads) {
|
|
2442
2469
|
const schema = helperSchema(ctx);
|
|
2443
2470
|
const targets = /* @__PURE__ */ new Map();
|
|
2444
2471
|
add(targets, `${schema}.role_permissions`);
|
|
@@ -2454,9 +2481,36 @@ function memoGenerationSql(ctx) {
|
|
|
2454
2481
|
}
|
|
2455
2482
|
suspensionTargets(targets, ctx.suspension?.users);
|
|
2456
2483
|
for (const row of Object.values(ctx.suspension?.scopes ?? {})) suspensionTargets(targets, row);
|
|
2484
|
+
for (const table of readTables(reads)) if (!targets.has(qualifySqlTable(table))) add(targets, table);
|
|
2485
|
+
return targets;
|
|
2486
|
+
}
|
|
2487
|
+
function triggersSql(ctx, targets) {
|
|
2488
|
+
const trigger = qualified(ctx, TRIGGER);
|
|
2489
|
+
return [...targets].map(({ table, columns }) => {
|
|
2490
|
+
const target = quoteTable(qualifySqlTable(table));
|
|
2491
|
+
const update = columns === void 0 ? "update" : `update of ${[...columns].map((column) => quoteIdent(column)).join(", ")}`;
|
|
2492
|
+
return `drop trigger if exists ${quoteIdent(TRIGGER)} on ${target};
|
|
2493
|
+
create trigger ${quoteIdent(TRIGGER)}
|
|
2494
|
+
after insert or ${update} or delete on ${target}
|
|
2495
|
+
for each statement execute function ${trigger}();
|
|
2496
|
+
drop trigger if exists ${quoteIdent(`${TRIGGER}_truncate`)} on ${target};
|
|
2497
|
+
create trigger ${quoteIdent(`${TRIGGER}_truncate`)}
|
|
2498
|
+
after truncate on ${target}
|
|
2499
|
+
for each statement execute function ${trigger}();`;
|
|
2500
|
+
}).join("\n");
|
|
2501
|
+
}
|
|
2502
|
+
/**
|
|
2503
|
+
* The triggers that invalidate the memo when a write changes permitted ids
|
|
2504
|
+
* inside the statement: the permission map, a custom role's grants, a suspended
|
|
2505
|
+
* user or scope, and every table `reads` (the memoized helper bodies) selects
|
|
2506
|
+
* from, such as the membership sources and the global roles. The hook's version
|
|
2507
|
+
* triggers call the same bump.
|
|
2508
|
+
*/
|
|
2509
|
+
function memoGenerationSql(ctx, reads = "") {
|
|
2510
|
+
if (!memoizes(ctx)) return "";
|
|
2457
2511
|
const bump = qualified(ctx, BUMP);
|
|
2458
2512
|
const trigger = qualified(ctx, TRIGGER);
|
|
2459
|
-
return `-- a permission, custom-role or
|
|
2513
|
+
return `-- a permission, custom-role, suspension or membership write changes permitted ids inside the statement
|
|
2460
2514
|
create or replace function ${bump}()
|
|
2461
2515
|
returns void
|
|
2462
2516
|
language sql
|
|
@@ -2485,18 +2539,13 @@ begin
|
|
|
2485
2539
|
end;
|
|
2486
2540
|
$$;
|
|
2487
2541
|
revoke execute on function ${trigger}() from public, anon, authenticated;
|
|
2488
|
-
${
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
drop trigger if exists ${quoteIdent(`${TRIGGER}_truncate`)} on ${target};
|
|
2496
|
-
create trigger ${quoteIdent(`${TRIGGER}_truncate`)}
|
|
2497
|
-
after truncate on ${target}
|
|
2498
|
-
for each statement execute function ${trigger}();`;
|
|
2499
|
-
}).join("\n")}`;
|
|
2542
|
+
${triggersSql(ctx, memoTargets(ctx, reads).values())}`;
|
|
2543
|
+
}
|
|
2544
|
+
function memoReadTriggersSql(ctx, reads, covered) {
|
|
2545
|
+
const done = memoTargets(ctx, covered);
|
|
2546
|
+
const targets = /* @__PURE__ */ new Map();
|
|
2547
|
+
for (const table of readTables(reads)) if (!done.has(qualifySqlTable(table))) add(targets, table);
|
|
2548
|
+
return targets.size === 0 ? "" : triggersSql(ctx, targets.values());
|
|
2500
2549
|
}
|
|
2501
2550
|
//#endregion
|
|
2502
2551
|
//#region src/cli/rls/token-scopes.ts
|
|
@@ -2665,7 +2714,7 @@ grant execute on function ${fn}(text) to anon, authenticated;` : `revoke execute
|
|
|
2665
2714
|
grant execute on function ${fn}(text) to authenticated;`;
|
|
2666
2715
|
return `create or replace function ${fn}(p_grant text)
|
|
2667
2716
|
returns ${returns}
|
|
2668
|
-
${functionBody(body)}
|
|
2717
|
+
${functionBody(body, !memoizes(ctx))}
|
|
2669
2718
|
${grants}`;
|
|
2670
2719
|
}
|
|
2671
2720
|
/**
|
|
@@ -2686,7 +2735,7 @@ function forUserSql(ctx) {
|
|
|
2686
2735
|
const qualifiedName = qualified(ctx, name);
|
|
2687
2736
|
return `create or replace function ${qualifiedName}(p_user ${type}, p_grant text)
|
|
2688
2737
|
returns ${returns}
|
|
2689
|
-
${functionBody(body)}
|
|
2738
|
+
${functionBody(body, !memoizes(ctx))}
|
|
2690
2739
|
revoke execute on function ${qualifiedName}(${type}, text) from public, anon, authenticated;`;
|
|
2691
2740
|
};
|
|
2692
2741
|
return [`-- the helpers for a user the caller names: trusted SQL acting for a stored user; no client role may execute them
|
|
@@ -2803,7 +2852,7 @@ revoke all on table ${ur} from anon, authenticated, public;`);
|
|
|
2803
2852
|
}
|
|
2804
2853
|
const custom = customRolesSql(ctx);
|
|
2805
2854
|
if (custom !== "") chunks.push(custom);
|
|
2806
|
-
const memoGeneration = memoGenerationSql(ctx);
|
|
2855
|
+
const memoGeneration = memoGenerationSql(ctx, memoReadsSql(ctx));
|
|
2807
2856
|
if (memoGeneration !== "") chunks.push(memoGeneration);
|
|
2808
2857
|
const anon = options.anonExecute === true;
|
|
2809
2858
|
const keys = ctx.apiKeys;
|
|
@@ -2848,10 +2897,15 @@ function memoBody(ctx, scope, type, body) {
|
|
|
2848
2897
|
memo: {
|
|
2849
2898
|
type,
|
|
2850
2899
|
scope,
|
|
2851
|
-
user: subjectIdSql(ctx)
|
|
2900
|
+
user: subjectIdSql(ctx),
|
|
2901
|
+
...ctx.memo === void 0 ? {} : { api: ctx.memo }
|
|
2852
2902
|
}
|
|
2853
2903
|
};
|
|
2854
2904
|
}
|
|
2905
|
+
function memoReadsSql(ctx) {
|
|
2906
|
+
const bodies = grantBodies(ctx);
|
|
2907
|
+
return [bodies.has.sql, ...ctx.scopes.map((scope) => bodies.ids(scope.name).sql)].join("\n");
|
|
2908
|
+
}
|
|
2855
2909
|
function grantBodies(ctx) {
|
|
2856
2910
|
const keys = ctx.apiKeys;
|
|
2857
2911
|
const scoped = ctx.tokenScopes !== void 0;
|
|
@@ -2969,12 +3023,13 @@ function grantsSql(fn, args, anonExecute) {
|
|
|
2969
3023
|
grant execute on function ${fn}(${args}) to anon, authenticated;` : `revoke execute on function ${fn}(${args}) from public, anon;
|
|
2970
3024
|
grant execute on function ${fn}(${args}) to authenticated;`;
|
|
2971
3025
|
}
|
|
2972
|
-
function
|
|
3026
|
+
function definerSql(fn, params, returns, sql, parallelSafe) {
|
|
2973
3027
|
return `create or replace function ${fn}(${params})
|
|
2974
3028
|
returns ${returns}
|
|
2975
3029
|
language sql
|
|
2976
3030
|
stable
|
|
2977
3031
|
security definer
|
|
3032
|
+
cost 1000${parallelSafe ? "\nparallel safe" : ""}
|
|
2978
3033
|
set search_path = ''
|
|
2979
3034
|
as $$
|
|
2980
3035
|
${sql}
|
|
@@ -2983,10 +3038,10 @@ $$;`;
|
|
|
2983
3038
|
function heldSql(at, effect) {
|
|
2984
3039
|
return `select 1 from pdk_h where pdk_h.key = pdk_k.key and pdk_h.scope = ${quoteLiteral(at)} and pdk_h.effect = '${effect}'`;
|
|
2985
3040
|
}
|
|
2986
|
-
function keysFunction(fn, params, body, access) {
|
|
3041
|
+
function keysFunction(fn, params, body, access, parallelSafe) {
|
|
2987
3042
|
return `create or replace function ${fn}(${params})
|
|
2988
3043
|
returns setof text
|
|
2989
|
-
${functionBody(body).replace("set search_path = ''", "set search_path = ''\nset jit = off")}
|
|
3044
|
+
${functionBody(body, parallelSafe).replace("set search_path = ''", "set search_path = ''\nset jit = off")}
|
|
2990
3045
|
${access}`;
|
|
2991
3046
|
}
|
|
2992
3047
|
/**
|
|
@@ -3004,6 +3059,8 @@ ${access}`;
|
|
|
3004
3059
|
* as `permittedIds(..., { conditioned: true })` does in process.
|
|
3005
3060
|
*/
|
|
3006
3061
|
function permissionHelpersSql(ctx, grants, renamed, anonExecute) {
|
|
3062
|
+
const parallel = !memoizes(ctx);
|
|
3063
|
+
const definer = (fn, params, returns, sql) => definerSql(fn, params, returns, sql, parallel);
|
|
3007
3064
|
const keys = qualified(ctx, PERMISSION_HELPERS.grantKeys);
|
|
3008
3065
|
const allowKeys = (scope) => `${keys}(p_permission, ${quoteLiteral(scope)}) g(grant_key)`;
|
|
3009
3066
|
const denyKeys = (scope) => `${keys}(p_permission, ${quoteLiteral(scope)}, 'deny') g(grant_key)`;
|
|
@@ -3093,8 +3150,8 @@ ${grantsSql(fn, "text", anonExecute)}`);
|
|
|
3093
3150
|
grantSet: true
|
|
3094
3151
|
});
|
|
3095
3152
|
chunks.push(`-- the permission keys the caller holds on one ${scope.name}: what permdock_has_permission or permitted_${scope.name}_ids_by_permission answers for each key, in one call
|
|
3096
|
-
${keysFunction(keysFn, `p_id ${type}`, keysBody(scope.name, caller, false), grantsSql(keysFn, type, anonExecute))}
|
|
3097
|
-
${keysFunction(keysFn, `p_id ${type}, p_keys text[]`, keysBody(scope.name, caller, true), grantsSql(keysFn, `${type}, text[]`, anonExecute))}`);
|
|
3153
|
+
${keysFunction(keysFn, `p_id ${type}`, keysBody(scope.name, caller, false), grantsSql(keysFn, type, anonExecute), parallel)}
|
|
3154
|
+
${keysFunction(keysFn, `p_id ${type}, p_keys text[]`, keysBody(scope.name, caller, true), grantsSql(keysFn, `${type}, text[]`, anonExecute), parallel)}`);
|
|
3098
3155
|
chunks.push(`-- with p_conditioned true, also the instances a conditioned allow reaches, minus only unconditional denies: the caller applies the row condition
|
|
3099
3156
|
${definer(fn, "p_permission text, p_conditioned boolean", `setof ${scopeTypeOf(ctx, scope.name)}`, conditionedIds(qualified(ctx, permittedIdsHelper(scope.name)), scope.name, ""))}
|
|
3100
3157
|
${grantsSql(fn, "text, boolean", anonExecute)}`);
|
|
@@ -3118,8 +3175,8 @@ revoke execute on function ${fn}(${user}, text, boolean) from public, anon, auth
|
|
|
3118
3175
|
...forUserContext(ctx),
|
|
3119
3176
|
grantSet: true
|
|
3120
3177
|
});
|
|
3121
|
-
chunks.push(`${keysFunction(keysFor, `p_user ${user}, p_id ${type}`, keysBody(scope.name, named, false), `revoke execute on function ${keysFor}(${user}, ${type}) from public, anon, authenticated
|
|
3122
|
-
${keysFunction(keysFor, `p_user ${user}, p_id ${type}, p_keys text[]`, keysBody(scope.name, named, true), `revoke execute on function ${keysFor}(${user}, ${type}, text[]) from public, anon, authenticated
|
|
3178
|
+
chunks.push(`${keysFunction(keysFor, `p_user ${user}, p_id ${type}`, keysBody(scope.name, named, false), `revoke execute on function ${keysFor}(${user}, ${type}) from public, anon, authenticated;`, parallel)}
|
|
3179
|
+
${keysFunction(keysFor, `p_user ${user}, p_id ${type}, p_keys text[]`, keysBody(scope.name, named, true), `revoke execute on function ${keysFor}(${user}, ${type}, text[]) from public, anon, authenticated;`, parallel)}`);
|
|
3123
3180
|
}
|
|
3124
3181
|
return `${chunks.join("\n\n")}\n`;
|
|
3125
3182
|
}
|
|
@@ -3593,6 +3650,7 @@ returns setof text
|
|
|
3593
3650
|
language sql
|
|
3594
3651
|
stable
|
|
3595
3652
|
security definer
|
|
3653
|
+
cost 1000
|
|
3596
3654
|
set search_path = ''
|
|
3597
3655
|
as $$
|
|
3598
3656
|
${arms.join("\n union\n")}
|
|
@@ -3614,6 +3672,7 @@ returns setof text
|
|
|
3614
3672
|
language sql
|
|
3615
3673
|
stable
|
|
3616
3674
|
security definer
|
|
3675
|
+
cost 1000
|
|
3617
3676
|
set search_path = ''
|
|
3618
3677
|
as $$
|
|
3619
3678
|
select t.${quoteIdent(node.id)}::text from ${quoteQualified(tableFor(node.name, tables))} t
|
|
@@ -3778,6 +3837,7 @@ returns setof text
|
|
|
3778
3837
|
language sql
|
|
3779
3838
|
stable
|
|
3780
3839
|
security definer
|
|
3840
|
+
cost 1000
|
|
3781
3841
|
set search_path = ''
|
|
3782
3842
|
as $$
|
|
3783
3843
|
${body}
|
|
@@ -3812,6 +3872,9 @@ function dependencyOrder(plan) {
|
|
|
3812
3872
|
for (const name of [...plan.keys()].toSorted()) visit(name);
|
|
3813
3873
|
return out;
|
|
3814
3874
|
}
|
|
3875
|
+
function graphIdsSql(ctx, plan, tables) {
|
|
3876
|
+
return dependencyOrder(plan).filter((entry) => entry.relations.size > 0 || entry.closure !== void 0).map((entry) => permittedSql(ctx, plan, entry, tables)).join("\n");
|
|
3877
|
+
}
|
|
3815
3878
|
/**
|
|
3816
3879
|
* The graph preamble: `permitted_<resource>_ids` for every resource a graph
|
|
3817
3880
|
* grant reads, and the closure table with its triggers for every self-parented
|
|
@@ -3847,20 +3910,39 @@ function graphSql(ctx, plan, tables) {
|
|
|
3847
3910
|
* The `schema.table` an `rls.tables` entry names, or `resource` when it names
|
|
3848
3911
|
* none or is `false`.
|
|
3849
3912
|
*/
|
|
3850
|
-
function tableNameOf(entry, resource) {
|
|
3913
|
+
function tableNameOf(entry, resource, tables) {
|
|
3851
3914
|
if (entry === void 0 || entry === false) return resource;
|
|
3852
|
-
|
|
3915
|
+
if (typeof entry === "string") return entry;
|
|
3916
|
+
if ("tableOf" in entry) {
|
|
3917
|
+
const owner = tables?.[entry.tableOf];
|
|
3918
|
+
return typeof owner === "object" && "tableOf" in owner ? entry.tableOf : tableNameOf(owner, entry.tableOf);
|
|
3919
|
+
}
|
|
3920
|
+
return entry.table ?? resource;
|
|
3853
3921
|
}
|
|
3854
3922
|
/**
|
|
3855
3923
|
* `rls.tables` as resource to table name, the `via` objects reduced to their
|
|
3856
3924
|
* `table` and the `false` entries left out.
|
|
3857
3925
|
*/
|
|
3858
3926
|
function tableNames(tables) {
|
|
3859
|
-
return tables === void 0 ? void 0 : Object.fromEntries(Object.entries(tables).filter(([, entry]) => entry !== false).map(([resource, entry]) => [resource, tableNameOf(entry, resource)]));
|
|
3927
|
+
return tables === void 0 ? void 0 : Object.fromEntries(Object.entries(tables).filter(([, entry]) => entry !== false).map(([resource, entry]) => [resource, tableNameOf(entry, resource, tables)]));
|
|
3860
3928
|
}
|
|
3861
|
-
/**
|
|
3929
|
+
/**
|
|
3930
|
+
* The resources `rls.tables` marks `false` or `{ tableOf }`: no policies of
|
|
3931
|
+
* their own, their grants only seeded.
|
|
3932
|
+
*/
|
|
3862
3933
|
function tablelessResources(tables) {
|
|
3863
|
-
return new Set(Object.entries(tables ?? {}).filter(([, entry]) => entry === false).map(([resource]) => resource));
|
|
3934
|
+
return new Set(Object.entries(tables ?? {}).filter(([, entry]) => entry === false || typeof entry === "object" && "tableOf" in entry).map(([resource]) => resource));
|
|
3935
|
+
}
|
|
3936
|
+
/**
|
|
3937
|
+
* Rejects a `{ tableOf }` entry that names its own resource, a `false` entry or
|
|
3938
|
+
* another `{ tableOf }` entry: the owner must have a table of its own.
|
|
3939
|
+
*/
|
|
3940
|
+
function checkSharedTables(tables) {
|
|
3941
|
+
for (const [resource, entry] of Object.entries(tables ?? {})) {
|
|
3942
|
+
if (typeof entry === "string" || entry === false || !("tableOf" in entry)) continue;
|
|
3943
|
+
const owner = tables?.[entry.tableOf];
|
|
3944
|
+
if (entry.tableOf === resource || owner === false || typeof owner === "object" && "tableOf" in owner) throw configError(`PermDock CLI: rls.tables.${resource}.tableOf names ${entry.tableOf}, which must be another resource with a table of its own`);
|
|
3945
|
+
}
|
|
3864
3946
|
}
|
|
3865
3947
|
function singular(name) {
|
|
3866
3948
|
if (name.endsWith("ies")) return `${name.slice(0, -3)}y`;
|
|
@@ -3871,7 +3953,7 @@ function singular(name) {
|
|
|
3871
3953
|
function resolveVias(tables, scopes, dialect) {
|
|
3872
3954
|
const out = {};
|
|
3873
3955
|
for (const [resource, entry] of Object.entries(tables ?? {})) {
|
|
3874
|
-
if (typeof entry === "string" || entry === false) continue;
|
|
3956
|
+
if (typeof entry === "string" || entry === false || "tableOf" in entry) continue;
|
|
3875
3957
|
const { via } = entry;
|
|
3876
3958
|
const scope = via.scope ?? scopes[0]?.name;
|
|
3877
3959
|
if (scope === void 0 || !scopes.some((item) => item.name === scope)) throw configError(`PermDock CLI: rls.tables.${resource}.via.scope '${scope ?? ""}' is not a scope of the policy (${scopes.map((item) => item.name).join(", ")})`);
|
|
@@ -3895,4 +3977,4 @@ function resolveVias(tables, scopes, dialect) {
|
|
|
3895
3977
|
return Object.keys(out).length === 0 ? void 0 : out;
|
|
3896
3978
|
}
|
|
3897
3979
|
//#endregion
|
|
3898
|
-
export {
|
|
3980
|
+
export { byKey as $, tokenScopeAllowsCall as A, memoizes as B, permittedByPermissionHelper as C, scopeTable as Ct, memoReadsSql as D, activeUserSql as Dt, helpersSql as E, activeRowSql as Et, disabledColumn as F, roleRows as G, sourcesKeep as H, memberColumn as I, hasCustomRoleChecksFor as J, globalRoleSource as K, memoDiscriminatorSql as L, memoReadTriggersSql as M, capabilityAccessSql as N, seedSql as O, checkSuspension as Ot, claimKeptLines as P, byCodeUnit as Q, memoReadSql as R, permissionKeysForHelper as S, scopeSources as St, accessSql as T, activeMembershipSql as Tt, globalRoleRows as U, sourceFilters as V, membershipRows as W, rolesTableScope as X, raiseSql as Y, storedTenant as Z, ASSIGNMENTS as _, memberOfHelper as _t, tablelessResources as a, graphHelper as at, checkName as b, permittedIdsHelper as bt, graphPlan as c, hasMemberFor as ct, pairsSql as d, isTeamScope as dt, API_KEY_ALLOWS as et, sourceHoldersTriggerSql as f, linkHelper as ft, transferTriggerSql as g, memberIdsHelper as gt, holdersTriggerSql as h, memberForTable as ht, tableNames as i, CLOSURE as it, tokenScopesPlan as j, TOKEN_SCOPE_ALLOWS as k, graphSql as l, hasPermittedUsers as lt, sourceTransferTriggerSql as m, memberForSources as mt, resolveVias as n, apiKeyFields as nt, closureDepths as o, graphSqlName as ot, sourceRowsSql as p, memberForHelper as pt, currentKeyExpr as q, tableNameOf as r, apiKeysPlan as rt, graphIdsSql as s, graphSqlText as st, checkSharedTables as t, apiKeyAllowsCall as tt, holderSources as u, inheritedRowsHelper as ut, OWNERSHIP as v, memberRoleOf as vt, requiresSql as w, activeInstancesSql as wt, permissionHelpersSql as x, restrictedHelper as xt, PERMISSION_HELPERS as y, permittedForHelper as yt, memoWriteSql as z };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { D as Policy, N as PolicyVocabulary, en as Snapshot, yr as Principal } from "../policy-types-
|
|
2
|
-
import {
|
|
3
|
-
import { a as OperationInput, t as Operation } from "../operations-
|
|
4
|
-
import { a as PermDock } from "../permdock-
|
|
5
|
-
import { D as ConnectionOptions, T as Connection, f as InvalidSignatureError, i as OpenApiHooks, o as ProtectOptions, u as SnapshotQuery, v as discoverViaSignatureAgent, x as webBotAuthVerifier } from "../server-types
|
|
6
|
-
import { a as ProtectTarget, n as FetchAdapterOptions, t as ContextReader } from "../fetch-adapter-
|
|
1
|
+
import { D as Policy, N as PolicyVocabulary, en as Snapshot, yr as Principal } from "../policy-types-rNfz7t0M.js";
|
|
2
|
+
import { w as Permission } from "../vocabulary-DeZvUaTw.js";
|
|
3
|
+
import { a as OperationInput, t as Operation } from "../operations-BMPx7HyO.js";
|
|
4
|
+
import { a as PermDock } from "../permdock-BaB-KQqn.js";
|
|
5
|
+
import { D as ConnectionOptions, T as Connection, f as InvalidSignatureError, i as OpenApiHooks, o as ProtectOptions, u as SnapshotQuery, v as discoverViaSignatureAgent, x as webBotAuthVerifier } from "../server-types--_Hann81.js";
|
|
6
|
+
import { a as ProtectTarget, n as FetchAdapterOptions, t as ContextReader } from "../fetch-adapter-DxqsIXSO.js";
|
|
7
7
|
import { RequestMiddleware, RequestMiddlewareAfterServer, createMiddleware } from "@tanstack/react-start";
|
|
8
8
|
//#region src/tanstack-start/create.d.ts
|
|
9
9
|
type TanStackStartPermDockOptions<TUser = unknown> = FetchAdapterOptions<Request, TUser>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as fetchAdapter } from "../fetch-adapter-
|
|
1
|
+
import { f as InvalidSignatureError, g as webBotAuthVerifier, p as discoverViaSignatureAgent } from "../evaluations-BzTDWO4m.js";
|
|
2
|
+
import { t as fetchAdapter } from "../fetch-adapter-MoYZ-vF5.js";
|
|
3
3
|
import { createMiddleware } from "@tanstack/react-start";
|
|
4
4
|
//#region src/tanstack-start/create.ts
|
|
5
5
|
function createPermDock(policy, options) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { o as sameId, t as expiredAt } from "./expiry-6XByK0dm.js";
|
|
2
1
|
import { l as isFieldRelation } from "./resource-relations-8-pCScBO.js";
|
|
3
2
|
import { o as epochSeconds } from "./time-nR1JesoH.js";
|
|
4
|
-
import {
|
|
3
|
+
import { a as expiredAt, i as sameId } from "./ids-DzhJaCUj.js";
|
|
4
|
+
import { c as rootScope, l as scopeChain, p as tenantOf, r as findScope, s as resolveScope, t as activeFor, u as scopeIdOf } from "./scopes-gdH__vDZ.js";
|
|
5
5
|
//#region src/core/tenancy.ts
|
|
6
6
|
function nowSeconds(now) {
|
|
7
7
|
return now ?? epochSeconds();
|
package/dist/terminal/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { D as Policy, N as PolicyVocabulary, Yn as Decision, qt as Instant, xr as Subject, yr as Principal } from "../policy-types-
|
|
2
|
-
import {
|
|
3
|
-
import { a as PermDock } from "../permdock-
|
|
4
|
-
import { m as ApprovalStore } from "../types-
|
|
5
|
-
import { a as ProblemDetails, t as ApprovalHint } from "../errors-
|
|
6
|
-
import { t as InstanceOptions } from "../instance-options-
|
|
1
|
+
import { D as Policy, N as PolicyVocabulary, Yn as Decision, qt as Instant, xr as Subject, yr as Principal } from "../policy-types-rNfz7t0M.js";
|
|
2
|
+
import { w as Permission } from "../vocabulary-DeZvUaTw.js";
|
|
3
|
+
import { a as PermDock } from "../permdock-BaB-KQqn.js";
|
|
4
|
+
import { m as ApprovalStore } from "../types-ZfjQB0KC.js";
|
|
5
|
+
import { a as ProblemDetails, t as ApprovalHint } from "../errors-D_JIQJYb.js";
|
|
6
|
+
import { t as InstanceOptions } from "../instance-options-C6gEDOts.js";
|
|
7
7
|
//#region src/terminal/types.d.ts
|
|
8
8
|
type TokenSourceName = "device" | "keychain" | "env" | "ci-oidc";
|
|
9
9
|
type TokenSource = TokenSourceName | {
|
package/dist/terminal/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { t as compact } from "../compact-CAf557ZB.js";
|
|
2
2
|
import { a as deniedMessage, i as approvalMessage, n as PermDockDeniedError, t as PermDockApprovalRequiredError } from "../errors-ynga1EQy.js";
|
|
3
3
|
import { h as secondsAt } from "../time-nR1JesoH.js";
|
|
4
|
-
import { r as isSubject } from "../subject-C7RddW0G.js";
|
|
5
4
|
import { n as resourceRef } from "../resource-ref-CaS9yVPi.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { r as isSubject } from "../subject-C7RddW0G.js";
|
|
6
|
+
import { r as withApp } from "../app-DIvM65Mv.js";
|
|
7
|
+
import { n as resolveOrNull, t as buildInstance } from "../build-instance-B0vsViF5.js";
|
|
9
8
|
import { t as timeoutSignal } from "../timeout-D51niuQP.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { l as storedApprovalToken, s as resumeDecision } from "../helpers-DzBIfL1N.js";
|
|
10
|
+
import { n as readBodyText } from "../body-text-DQhcmqdY.js";
|
|
11
|
+
import { a as refreshCredential, o as revokeCredential, s as runDeviceFlow, t as TERMINAL_TIMEOUT_MS } from "../device-BkSynWdg.js";
|
|
12
12
|
import { i as writeCredentials, n as deleteCredentials, r as readCredentials } from "../storage-C2bWdvJH.js";
|
|
13
13
|
import { createInterface } from "node:readline";
|
|
14
14
|
//#region src/terminal/exit.ts
|
package/dist/testing/core.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { S as policyMatrix, _ as DescribePolicyConfig, a as OrmParityScenario, b as PolicyMatrixCell, c as RlsFieldsOutcome, d as RlsParityOptions, f as RlsParityReport, g as testRlsParity, h as RlsQueryResult, i as OrmParityRunInput, l as RlsParityCase, m as RlsQueryFn, n as OrmParityOptions, o as testOrmParity, p as RlsParitySubject, r as OrmParityReport, s as RlsDbOutcome, t as OrmParityCase, u as RlsParityFixture, v as MatrixCell, x as PolicyMatrixReport, y as MatrixOutcome } from "../core-
|
|
1
|
+
import { S as policyMatrix, _ as DescribePolicyConfig, a as OrmParityScenario, b as PolicyMatrixCell, c as RlsFieldsOutcome, d as RlsParityOptions, f as RlsParityReport, g as testRlsParity, h as RlsQueryResult, i as OrmParityRunInput, l as RlsParityCase, m as RlsQueryFn, n as OrmParityOptions, o as testOrmParity, p as RlsParitySubject, r as OrmParityReport, s as RlsDbOutcome, t as OrmParityCase, u as RlsParityFixture, v as MatrixCell, x as PolicyMatrixReport, y as MatrixOutcome } from "../core-D2JNg5jA.js";
|
|
2
2
|
export { type DescribePolicyConfig, type MatrixCell, type MatrixOutcome, type OrmParityCase, type OrmParityOptions, type OrmParityReport, type OrmParityRunInput, type OrmParityScenario, type PolicyMatrixCell, type PolicyMatrixReport, type RlsDbOutcome, type RlsFieldsOutcome, type RlsParityCase, type RlsParityFixture, type RlsParityOptions, type RlsParityReport, type RlsParitySubject, type RlsQueryFn, type RlsQueryResult, policyMatrix, testOrmParity, testRlsParity };
|
package/dist/testing/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { r as policyMatrix, t as testOrmParity, n as testRlsParity } from "../core-
|
|
1
|
+
export { r as policyMatrix, t as testOrmParity, n as testRlsParity } from "../core-CUjhfz0W.js";
|
|
@@ -1,5 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { rt as MemberEntry } from "../../policy-types-rNfz7t0M.js";
|
|
2
|
+
import { r as SubjectRecord } from "../../subject-cache-d_Z4KAnm.js";
|
|
3
|
+
import { i as SupabaseRpcClient } from "../../postgrest-Cn0Res25.js";
|
|
4
|
+
import { a as CatalogDocument } from "../../types-DAyp592k.js";
|
|
5
|
+
import { i as SupabaseManifest } from "../../manifest-C6eFl3Vo.js";
|
|
6
|
+
//#region src/testing/fixtures/postgrest.d.ts
|
|
7
|
+
type PostgrestFixtureOptions = {
|
|
8
|
+
/** The users `subject_for` knows, by id. An unknown user answers `null`. */
|
|
9
|
+
readonly subjects: Readonly<Record<string, SubjectRecord>>;
|
|
10
|
+
/**
|
|
11
|
+
* `authz_version_for` by id. A user missing here answers the `authzVersion`
|
|
12
|
+
* of its record.
|
|
13
|
+
*/
|
|
14
|
+
readonly versions?: Readonly<Record<string, number>>;
|
|
15
|
+
/** What `members_of` returns for the entries whose scope and id match. */
|
|
16
|
+
readonly members?: readonly MemberEntry[];
|
|
17
|
+
};
|
|
18
|
+
type PostgrestFixtureCall = {
|
|
19
|
+
readonly schema: string;
|
|
20
|
+
readonly fn: string;
|
|
21
|
+
readonly args: Readonly<Record<string, unknown>>;
|
|
22
|
+
};
|
|
23
|
+
type PostgrestFixture = SupabaseRpcClient & {
|
|
24
|
+
/** Every RPC the code under test made, in order. */
|
|
25
|
+
readonly calls: readonly PostgrestFixtureCall[];
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* A Supabase client double that answers the three functions `postgrestSources`
|
|
29
|
+
* calls, `subject_for`, `authz_version_for` and `members_of`, under any schema
|
|
30
|
+
* and any wrapper prefix (`permdock_subject_for` answers as `subject_for`). Any
|
|
31
|
+
* other function answers an error.
|
|
32
|
+
*/
|
|
33
|
+
export declare function postgrestFixture(options: PostgrestFixtureOptions): PostgrestFixture;
|
|
34
|
+
//#endregion
|
|
3
35
|
//#region src/testing/fixtures/index.d.ts
|
|
4
36
|
/**
|
|
5
37
|
* The `permissions.catalog.json` of `apps/examples/next-better-supabase`, a
|
|
@@ -12,4 +44,5 @@ export declare const betterSupabaseCatalog: CatalogDocument;
|
|
|
12
44
|
* document.
|
|
13
45
|
*/
|
|
14
46
|
export declare const betterSupabaseManifest: SupabaseManifest;
|
|
15
|
-
//#endregion
|
|
47
|
+
//#endregion
|
|
48
|
+
export type { PostgrestFixture, PostgrestFixtureCall, PostgrestFixtureOptions };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as parseSupabaseManifest } from "../../manifest-
|
|
2
|
-
import { t as parseCatalog } from "../../parse-
|
|
1
|
+
import { n as parseSupabaseManifest } from "../../manifest-D44OkoLk.js";
|
|
2
|
+
import { t as parseCatalog } from "../../parse-CORUNcCo.js";
|
|
3
3
|
//#region src/testing/fixtures/better-supabase.catalog.json
|
|
4
4
|
var better_supabase_catalog_default = {
|
|
5
5
|
$schema: "https://permdock.com/schemas/catalog-v1.json",
|
|
@@ -813,6 +813,43 @@ var better_supabase_manifest_default = {
|
|
|
813
813
|
}
|
|
814
814
|
};
|
|
815
815
|
//#endregion
|
|
816
|
+
//#region src/testing/fixtures/postgrest.ts
|
|
817
|
+
const answer = (data) => ({
|
|
818
|
+
data,
|
|
819
|
+
error: null
|
|
820
|
+
});
|
|
821
|
+
/**
|
|
822
|
+
* A Supabase client double that answers the three functions `postgrestSources`
|
|
823
|
+
* calls, `subject_for`, `authz_version_for` and `members_of`, under any schema
|
|
824
|
+
* and any wrapper prefix (`permdock_subject_for` answers as `subject_for`). Any
|
|
825
|
+
* other function answers an error.
|
|
826
|
+
*/
|
|
827
|
+
function postgrestFixture(options) {
|
|
828
|
+
const calls = [];
|
|
829
|
+
const read = (fn, args) => {
|
|
830
|
+
const user = String(args["p_user"]);
|
|
831
|
+
const record = options.subjects[user];
|
|
832
|
+
if (fn.endsWith("authz_version_for")) return answer(options.versions?.[user] ?? record?.authzVersion ?? null);
|
|
833
|
+
if (fn.endsWith("subject_for")) return answer(record ?? null);
|
|
834
|
+
if (fn.endsWith("members_of")) return answer((options.members ?? []).filter(({ membership }) => membership.scope === args["p_scope"] && membership.id === args["p_id"]));
|
|
835
|
+
return {
|
|
836
|
+
data: null,
|
|
837
|
+
error: { message: `unknown function ${fn}` }
|
|
838
|
+
};
|
|
839
|
+
};
|
|
840
|
+
return {
|
|
841
|
+
calls,
|
|
842
|
+
schema: (schema) => ({ rpc: async (fn, args) => {
|
|
843
|
+
calls.push({
|
|
844
|
+
schema,
|
|
845
|
+
fn,
|
|
846
|
+
args
|
|
847
|
+
});
|
|
848
|
+
return read(fn, args);
|
|
849
|
+
} })
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
//#endregion
|
|
816
853
|
//#region src/testing/fixtures/index.ts
|
|
817
854
|
/**
|
|
818
855
|
* The `permissions.catalog.json` of `apps/examples/next-better-supabase`, a
|
|
@@ -826,4 +863,4 @@ const betterSupabaseCatalog = parseCatalog(better_supabase_catalog_default);
|
|
|
826
863
|
*/
|
|
827
864
|
const betterSupabaseManifest = parseSupabaseManifest(better_supabase_manifest_default);
|
|
828
865
|
//#endregion
|
|
829
|
-
export { betterSupabaseCatalog, betterSupabaseManifest };
|
|
866
|
+
export { betterSupabaseCatalog, betterSupabaseManifest, postgrestFixture };
|