permdock 0.25.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/2020-bJfT8aIA.js +6760 -0
- package/dist/a2a/index.d.ts +5 -9
- package/dist/a2a/index.js +13 -15
- package/dist/adapter-context-lHq_i_77.js +28 -0
- package/dist/adoption-scan-b0_Xpab8.js +106 -0
- package/dist/agent/index.d.ts +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/ai-sdk/index.d.ts +4 -6
- package/dist/ai-sdk/index.js +6 -7
- package/dist/annotate-doc-BCOCOrq_.js +214 -0
- package/dist/annotate-routes-BvSuEht3.js +75 -0
- package/dist/annotate-uZVGIRym.js +25 -0
- package/dist/app/index.d.ts +2 -103
- package/dist/app/index.js +1 -114
- package/dist/app-data-DbSPSPIl.js +62 -0
- package/dist/approval-header-BvszJE3l.js +25 -0
- package/dist/approval-normalize-Cpp8R0rY.js +190 -0
- package/dist/approval-prompt-C-vjNZyd.d.ts +57 -0
- package/dist/approval-prompt-Covyx_DB.js +60 -0
- package/dist/approval-required-B-R4Yw3J.js +5 -0
- package/dist/approvals/index.d.ts +5 -5
- package/dist/approvals/index.js +8 -8
- package/dist/approvals-7jHYXocE.js +1039 -0
- package/dist/approvers-BkY_ZfWl.js +76 -0
- package/dist/arazzo-DMmcumRx.js +76 -0
- package/dist/arazzo-Hxerfx3_.js +35 -0
- package/dist/args-0EWFk-4S.js +311 -0
- package/dist/astro/index.d.ts +6 -8
- package/dist/astro/index.js +3 -4
- package/dist/audience-DauhRBNg.js +54 -0
- package/dist/auth-WHKYWtnS.js +187 -0
- package/dist/authz-topic-D8x24Jv-.js +14 -0
- package/dist/authzen/index.d.ts +37 -22
- package/dist/authzen/index.js +69 -27
- package/dist/automation-CUcWz8uu.d.ts +122 -0
- package/dist/automation-CpPdFX91.js +157 -0
- package/dist/base-url--yJPQlIK.js +8 -0
- package/dist/better-auth/index.d.ts +2 -8
- package/dist/better-auth/index.js +10 -13
- package/dist/better-supabase/index.d.ts +141 -95
- package/dist/better-supabase/index.js +239 -794
- package/dist/better-supabase-DSbs4MtQ.js +201 -0
- package/dist/bind-B3MHrzw4.d.ts +56 -0
- package/dist/bind-up3QptTt.js +124 -0
- package/dist/body-W1_8r6Tw.js +9 -0
- package/dist/body-text-B-m3p-qY.js +55 -0
- package/dist/boundary--5Swp7sN.js +18 -0
- package/dist/boundary-DJqHADKu.d.ts +22 -0
- package/dist/budget-5LJ8kfZk.d.ts +12 -0
- package/dist/budget-BH81q2cj.js +19 -0
- package/dist/build-instance-hLKYe3-E.js +30 -0
- package/dist/canonical-json-BibZkXtE.js +28 -0
- package/dist/capability-CVt3lpVK.d.ts +128 -0
- package/dist/capability-_ZsyfYxU.js +204 -0
- package/dist/casbin-CYwbggCS.js +29 -0
- package/dist/casbin-Co1KcLWU.js +241 -0
- package/dist/casl-CrltbDPa.js +23 -0
- package/dist/casl-D7n7yE-h.js +307 -0
- package/dist/catalog/index.d.ts +6 -20
- package/dist/catalog/index.js +13 -15
- package/dist/catalog-B3MJShnZ.js +51 -0
- package/dist/catalog-CgK_L4Qf.js +1 -0
- package/dist/catalog-DyC3LKc7.js +130 -0
- package/dist/catalog-doc-Bp5khmCG.js +352 -0
- package/dist/catalog-fingerprint-DAWZARy6.js +31 -0
- package/dist/catalog-operations-dxuOZr4J.js +59 -0
- package/dist/catalog-path-bG0XxHMu.js +11 -0
- package/dist/challenge-CjwmjcuX.js +518 -0
- package/dist/chat/index.d.ts +1 -1
- package/dist/chat/index.js +10 -13
- package/dist/chat-sdk/index.d.ts +3 -11
- package/dist/chat-sdk/index.js +7 -11
- package/dist/checks-DSm45qH7.js +71 -0
- package/dist/claims-map-BGbpbvGD.js +15 -0
- package/dist/claims-map-CLKQWxJG.d.ts +33 -0
- package/dist/claims-size-DcjhvUv5.js +58 -0
- package/dist/claude-agent/index.d.ts +3 -5
- package/dist/claude-agent/index.js +4 -5
- package/dist/clerk/index.d.ts +4 -8
- package/dist/clerk/index.js +7 -8
- package/dist/cli/bin.js +6 -7
- package/dist/cli/generate/watch-worker.d.ts +20 -0
- package/dist/cli/generate/watch-worker.js +69 -0
- package/dist/cli/index.d.ts +11 -20
- package/dist/cli/index.js +8 -8
- package/dist/cli/plugins/app.d.ts +18 -0
- package/dist/cli/plugins/app.js +26 -0
- package/dist/cli/plugins/better-supabase.d.ts +10 -0
- package/dist/cli/plugins/better-supabase.js +18 -0
- package/dist/cli/plugins/openapi.d.ts +19 -0
- package/dist/cli/plugins/openapi.js +40 -0
- package/dist/cli/plugins/powersync.d.ts +7 -0
- package/dist/cli/plugins/powersync.js +29 -0
- package/dist/cli/plugins/rls.d.ts +8 -0
- package/dist/cli/plugins/rls.js +27 -0
- package/dist/cli/plugins/schemas.d.ts +13 -0
- package/dist/cli/plugins/schemas.js +23 -0
- package/dist/cli/plugins/scim.d.ts +10 -0
- package/dist/cli/plugins/scim.js +32 -0
- package/dist/cli/plugins/supabase-hook.d.ts +13 -0
- package/dist/cli/plugins/supabase-hook.js +40 -0
- package/dist/cli/plugins/supabase.d.ts +27 -0
- package/dist/cli/plugins/supabase.js +69 -0
- package/dist/cli/plugins/ui.d.ts +11 -0
- package/dist/cli/plugins/ui.js +19 -0
- package/dist/client-V95IvZsF.d.ts +43 -0
- package/dist/client-subject-v89t811z.d.ts +25 -0
- package/dist/clients-Bb_33pRE.js +22 -0
- package/dist/clients-DGcyFDCc.d.ts +10 -0
- package/dist/cloud/index.d.ts +8 -26
- package/dist/cloud/index.js +22 -28
- package/dist/cloud-BfEI9TLS.js +85 -0
- package/dist/codemod-DwH0IZ2x.js +2159 -0
- package/dist/codemod-p67ePW25.js +35 -0
- package/dist/collect-BJZsuBW4.js +535 -0
- package/dist/collect-CPvCXMQ-.js +1 -0
- package/dist/collect-CpGnmGpL.js +54 -0
- package/dist/command-9GAzSI7E.js +5 -0
- package/dist/compact-C4LFuqbW.js +28 -0
- package/dist/compare-dfHDj8kT.js +11 -0
- package/dist/compile/index.d.ts +2 -2
- package/dist/compile/index.js +1 -1
- package/dist/compile-BUKXrueE.js +685 -0
- package/dist/compile-Blrr5WWw.js +724 -0
- package/dist/compile-D8c1nFGy.d.ts +118 -0
- package/dist/completion-CfrZOGcB.js +150 -0
- package/dist/conditions-CkHgXoZB.js +385 -0
- package/dist/config-D6gh_xvs.js +25 -0
- package/dist/config-iyy90IOU.js +143 -0
- package/dist/config-report-BaHEBpt-.js +55 -0
- package/dist/config-shape-B6tdyBju.js +149 -0
- package/dist/connection-BnoSqYU1.js +196 -0
- package/dist/connector-schema-BSRMyq4M.js +433 -0
- package/dist/constants-PCJiir_3.js +19 -0
- package/dist/context-DmH-Eyvx.js +95 -0
- package/dist/convex/index.d.ts +5 -9
- package/dist/convex/index.js +7 -8
- package/dist/core-CnC47rSf.d.ts +200 -0
- package/dist/core-DKqrD_xW.js +338 -0
- package/dist/coverage-DL7JCZmb.d.ts +133 -0
- package/dist/coverage-nFSMjFxH.js +42 -0
- package/dist/create-BAMPoEga.js +133 -0
- package/dist/create-BsRcXm_m.d.ts +125 -0
- package/dist/create-D3oXoXxM.js +373 -0
- package/dist/create-DeQ5t8mZ.d.ts +124 -0
- package/dist/create-sGl1ccTp.d.ts +185 -0
- package/dist/credential-ke0KMQeB.js +430 -0
- package/dist/credentials-6ZWbJ-Re.js +72 -0
- package/dist/credentials-BfzdL5kv.d.ts +123 -0
- package/dist/credentials-DOeqknte.js +309 -0
- package/dist/decide-set-CgNcE6pP.js +99 -0
- package/dist/deciding-columns-BnglEKqU.js +143 -0
- package/dist/decision-hHv4UZgy.js +20 -0
- package/dist/define-permdock-BLpQ0m95.d.ts +99 -0
- package/dist/define-permdock-CIxHBykk.js +148 -0
- package/dist/definition-options-9o8Hdww3.js +370 -0
- package/dist/delegation-BaUNCrE_.js +263 -0
- package/dist/delegation-input-7Y5Rlja7.js +18 -0
- package/dist/delivery/index.d.ts +4 -4
- package/dist/delivery/index.js +5 -5
- package/dist/delivery-Cb3VCij5.js +555 -0
- package/dist/delivery-event-D5b9yhaJ.js +39 -0
- package/dist/denied-text-D6JJTDr3.d.ts +20 -0
- package/dist/describe-B7EosIKA.js +100 -0
- package/dist/describe-lAafaRQQ.d.ts +43 -0
- package/dist/device-f3JEnqa0.js +195 -0
- package/dist/diff-BIqibFnm.js +464 -0
- package/dist/diff-n6LONVwL.js +36 -0
- package/dist/digest-BaP8bQzX.js +26 -0
- package/dist/digest-BcIZRYvp.d.ts +17 -0
- package/dist/doctor-Bg12v-8M.js +4847 -0
- package/dist/doctor-DCsyH7YR.js +53 -0
- package/dist/drizzle/index.d.ts +5 -9
- package/dist/drizzle/index.js +5 -6
- package/dist/elysia/index.d.ts +6 -8
- package/dist/elysia/index.js +6 -7
- package/dist/env-hbYumkRp.js +7 -0
- package/dist/errors-DOSkVeTC.js +127 -0
- package/dist/errors-DUJ7wLlE.d.ts +137 -0
- package/dist/errors-Da88YLm5.js +26 -0
- package/dist/errors-DgLOqc6j.js +148 -0
- package/dist/errors-KngVdJT9.d.ts +12 -0
- package/dist/evaluate-D8SdfP3h.js +1948 -0
- package/dist/evaluations-BQkpE7hC.js +609 -0
- package/dist/evaluations-K9qglDP7.d.ts +36 -0
- package/dist/evaluator-Dlhn2d7D.js +2 -0
- package/dist/evaluator-eager-UuJK6NX_.js +8 -0
- package/dist/eve/index.d.ts +11 -10
- package/dist/eve/index.js +7 -8
- package/dist/event-time-ChIrhzy5.js +26 -0
- package/dist/execute-SN8_dlch.js +166 -0
- package/dist/express/index.d.ts +6 -8
- package/dist/express/index.js +6 -7
- package/dist/fastify/index.d.ts +5 -11
- package/dist/fastify/index.js +6 -8
- package/dist/fetch-adapter-gmTCu4FR.d.ts +32 -0
- package/dist/fetch-adapter-ovZdSvlT.js +124 -0
- package/dist/fields-6d1j-q3c.js +502 -0
- package/dist/fields-C0L2FoZk.js +25 -0
- package/dist/files-DAR51W3J.js +157 -0
- package/dist/files-DuV7wRim.js +139 -0
- package/dist/fixtures-Bm0G0A7H.js +79 -0
- package/dist/flags-C0e-BzGW.js +112 -0
- package/dist/freeze-DGfJq_j2.js +86 -0
- package/dist/from-snapshot-CCDF_ihX.js +173 -0
- package/dist/gen-B4GUqsfM.js +1160 -0
- package/dist/gen-BC66z5Fd.js +1 -0
- package/dist/gen-kind-Bahz_i3U.js +67 -0
- package/dist/gen-kind-DFQnQwFN.d.ts +13 -0
- package/dist/generate-5_kz2309.js +305 -0
- package/dist/generate-B-msjuaO.js +2339 -0
- package/dist/generate-CbtjKcjn.js +67 -0
- package/dist/generate-DhP0jQDR.js +97 -0
- package/dist/generate-options-BDgadlwe.js +1104 -0
- package/dist/grantee-BPUG6f0r.js +109 -0
- package/dist/grantee-conditions-Dob6QQAc.js +270 -0
- package/dist/grantee-match-CFQ-LRcL.js +147 -0
- package/dist/grants-BzjbUCdR.js +139 -0
- package/dist/graph-sql-Ds3nbevr.d.ts +27 -0
- package/dist/h3/index.d.ts +4 -6
- package/dist/h3/index.js +4 -5
- package/dist/headers-D1oRr-js.d.ts +8 -0
- package/dist/helpers-DSmj6SHi.js +533 -0
- package/dist/hono/index.d.ts +6 -8
- package/dist/hono/index.js +7 -8
- package/dist/hook-sql-BIR4fL7i.js +3412 -0
- package/dist/hosted-DMJKJPoc.js +361 -0
- package/dist/hosted-DUbuh0Td.d.ts +100 -0
- package/dist/http-BUIYu1Kc.d.ts +10 -0
- package/dist/http-BbX_Ou3_.js +48 -0
- package/dist/http-C9jDw_bZ.js +82 -0
- package/dist/http-dNltTpC8.js +71 -0
- package/dist/ids-0QDIxtxL.js +53 -0
- package/dist/import-BZi1tZxq.js +318 -0
- package/dist/import-BqoDHpFt.js +1158 -0
- package/dist/index-BXz-XXC3.d.ts +1108 -0
- package/dist/index-CVuc3E1O.d.ts +196 -0
- package/dist/index-Cq9N5B92.d.ts +506 -0
- package/dist/index-D8A1d_Tt.d.ts +214 -0
- package/dist/index-DegTwZxD.d.ts +93 -0
- package/dist/index-O0qbI8Ha.d.ts +221 -0
- package/dist/index.d.ts +24 -25
- package/dist/index.js +47 -46
- package/dist/init-9cqnSJWG.js +95 -0
- package/dist/init-K3tKOwf4.js +94 -0
- package/dist/instance-options-B4MD2wgl.d.ts +9 -0
- package/dist/instance-options-CLErhA76.js +23 -0
- package/dist/instance-snapshot-DdGOpSfN.js +716 -0
- package/dist/instant-Ih5riY_A.js +18 -0
- package/dist/interactive-only-BZu9rLpa.js +1567 -0
- package/dist/internals-D58TnmDB.js +19 -0
- package/dist/json-schema-SDkWXxhu.d.ts +38 -0
- package/dist/json-schema-jtX26ydD.js +148 -0
- package/dist/jwt/index.d.ts +6 -24
- package/dist/jwt/index.js +18 -26
- package/dist/kernel-Dn6pKMAF.js +423 -0
- package/dist/kysely/index.d.ts +5 -9
- package/dist/kysely/index.js +5 -6
- package/dist/lazy-provider-CydlnKkS.d.ts +4 -0
- package/dist/lazy-provider-DG5rMeqL.js +28 -0
- package/dist/limits-DpTxX6N4.js +166 -0
- package/dist/live-options-CIUmc-YQ.js +70 -0
- package/dist/load-BPzIqlGB.js +1 -0
- package/dist/load-CZnlAyZ8.js +98 -0
- package/dist/load-jose-CjzIBSKI.js +7 -0
- package/dist/login-C1I5KIsK.js +67 -0
- package/dist/login-CP0UxnLw.js +255 -0
- package/dist/lru-Cp-AEvpR.js +27 -0
- package/dist/manifest-B-8d2lhG.js +45 -0
- package/dist/manifest-CRHphHxo.d.ts +362 -0
- package/dist/manifest-DvS2IoXo.js +399 -0
- package/dist/manifest-json-DMaBWmcG.js +8 -0
- package/dist/manifest-schema-DJY5Q_pR.js +507 -0
- package/dist/map-claims-BKdnPwep.js +386 -0
- package/dist/map-error-DTi_JZT8.js +22 -0
- package/dist/markers-C-kThnKN.js +79 -0
- package/dist/may-use-Died1tNU.js +233 -0
- package/dist/mcp/index.d.ts +11 -21
- package/dist/mcp/index.js +56 -43
- package/dist/membership-filter-CSKH48eD.js +66 -0
- package/dist/migrate-CmTMk7rd.js +536 -0
- package/dist/model-B4EKVHMK.js +188 -0
- package/dist/module-values-Ddx0GLaJ.js +106 -0
- package/dist/nest/index.d.ts +7 -13
- package/dist/nest/index.js +12 -15
- package/dist/next/client.d.ts +1 -3
- package/dist/next/client.js +2 -3
- package/dist/next/index.d.ts +36 -16
- package/dist/next/index.js +161 -31
- package/dist/next/plugin.d.ts +1 -3
- package/dist/next/plugin.js +3 -4
- package/dist/node/index.d.ts +6 -8
- package/dist/node/index.js +4 -5
- package/dist/oauth-security-C8fjzFRF.js +25 -0
- package/dist/ocsf-DKRQc6uv.js +135 -0
- package/dist/openai/index.d.ts +5 -7
- package/dist/openai/index.js +5 -6
- package/dist/openapi/index.d.ts +4 -16
- package/dist/openapi/index.js +4 -3
- package/dist/openapi-BHqqNSoG.js +95 -0
- package/dist/openapi-BT5XY7HY.js +260 -0
- package/dist/openapi-D2dmyWZK.js +411 -0
- package/dist/openapi-document-Ca5yAjc6.js +35 -0
- package/dist/operation-findings-D5Uo-dcm.js +35 -0
- package/dist/operation-risks-BD-j14dj.js +12 -0
- package/dist/operations-B0yO77Zz.js +290 -0
- package/dist/operations-BS8ExH5A.d.ts +58 -0
- package/dist/operations-De3F7tlf.js +88 -0
- package/dist/optional-CaQWp9HA.js +46 -0
- package/dist/orpc/index.d.ts +8 -12
- package/dist/orpc/index.js +10 -12
- package/dist/otel/index.d.ts +3 -5
- package/dist/otel/index.js +5 -7
- package/dist/output-djxu62oH.js +244 -0
- package/dist/output-files-C5LFnQa4.js +1 -0
- package/dist/output-files-DNid6TBl.js +197 -0
- package/dist/ownership-BO0sI5FB.js +558 -0
- package/dist/parse-local-manifest-BGLWVchi.d.ts +8 -0
- package/dist/parse-local-manifest-CfMjZAFi.js +67 -0
- package/dist/parse-nfHSt1Wy.js +149 -0
- package/dist/parse-request-IEEzVFM8.js +24 -0
- package/dist/parse-sink-events-B6nZx41L.js +125 -0
- package/dist/paths-CeS_gpHf.js +44 -0
- package/dist/pdp/index.d.ts +3 -9
- package/dist/pdp/index.js +22 -18
- package/dist/peer-BWTpSLs2.js +1 -0
- package/dist/peer-D77JpXe-.js +978 -0
- package/dist/perf-token-dFGVP14-.js +155 -0
- package/dist/permdock-BueSeg7X.js +1514 -0
- package/dist/permdock-Dz3yzWrp.d.ts +853 -0
- package/dist/permission-registry-DMYRZVcn.js +413 -0
- package/dist/permissions-CQW3cr2S.js +17 -0
- package/dist/permissions-DWULToSb.d.ts +52 -0
- package/dist/permissions-ijDw4sO1.js +144 -0
- package/dist/pg-CA651850.js +59 -0
- package/dist/pins-CXXkVEiD.js +14 -0
- package/dist/pipeline-CXuwijr2.js +307 -0
- package/dist/pkce-DdsRBK7n.js +20 -0
- package/dist/plugin-DGmbeXwA.d.ts +221 -0
- package/dist/plugin-MQVfUBUS.js +93 -0
- package/dist/plugin-outputs-BE2YCiMj.js +28 -0
- package/dist/policy-BhSUlHRr.js +37 -0
- package/dist/policy-C-Lzp3Zh.d.ts +18 -0
- package/dist/policy-DFD2J5o_.js +476 -0
- package/dist/policy-bundle-97xaDULc.js +82 -0
- package/dist/policy-from-catalog-YKaTeaco.js +452 -0
- package/dist/policy-module-Bp4HvsRg.js +107 -0
- package/dist/policy-types-93NwI8iI.d.ts +2855 -0
- package/dist/postgres-store-CYFvw98w.js +1023 -0
- package/dist/postgrest-DyrYo_XT.d.ts +138 -0
- package/dist/powersync-CN7IQIKk.js +40 -0
- package/dist/powersync-DdDLP02A.js +1630 -0
- package/dist/powersync-m9uYgCFF.js +1 -0
- package/dist/preset/index.d.ts +0 -12
- package/dist/preset/index.js +1 -1
- package/dist/preset-BcFDaeqd.js +1849 -0
- package/dist/principal-source-BIcukkB3.js +102 -0
- package/dist/prisma/index.d.ts +4 -12
- package/dist/prisma/index.js +10 -14
- package/dist/problem-BZB7zPC7.js +202 -0
- package/dist/problem-details-EJHcvYCz.js +154 -0
- package/dist/problem-types-81BEw0IN.js +7 -0
- package/dist/prompt-CSXHcJxy.js +931 -0
- package/dist/protected-action-BMb0ftEu.js +241 -0
- package/dist/protected-action-D6T3eJyW.d.ts +73 -0
- package/dist/protected-action-DiXulRVj.js +78 -0
- package/dist/provider-BnnFjtWI.js +893 -0
- package/dist/provider-ClD4rfgT.js +11 -0
- package/dist/provider-CydlnKkS.d.ts +4 -0
- package/dist/provider-store-atQUfsVO.js +51 -0
- package/dist/provider-with-CSw4mBDU.js +70 -0
- package/dist/public-api-DIMZmzWi.js +5579 -0
- package/dist/pull-9oQvY18T.js +252 -0
- package/dist/pull-jvJPMQhP.js +1 -0
- package/dist/push-Cb7PqXdO.js +158 -0
- package/dist/pushed-policy-pH-EFWyx.d.ts +61 -0
- package/dist/pushed-policy-rpB6k77P.js +240 -0
- package/dist/quote-BKrTBbcH.js +36 -0
- package/dist/rbac-B-49toAp.js +90 -0
- package/dist/react/index.d.ts +10 -9
- package/dist/react/index.js +8 -7
- package/dist/react/lazy.d.ts +10 -12
- package/dist/react/lazy.js +8 -35
- package/dist/react/provider-client-lazy.d.ts +2 -0
- package/dist/react/provider-client-lazy.js +2 -0
- package/dist/react/provider-client.d.ts +1 -1
- package/dist/react/provider-client.js +1 -1
- package/dist/react-native/index.d.ts +12 -30
- package/dist/react-native/index.js +31 -41
- package/dist/read-memberships-BkePIa1F.js +63 -0
- package/dist/refresh-on-C1zIMtJr.d.ts +47 -0
- package/dist/refresh-online-CYGZNo6V.js +19 -0
- package/dist/refresh-online-vtUfV6dk.d.ts +10 -0
- package/dist/refs-Cix9Zjis.js +103 -0
- package/dist/relation-walk-BlWy9gBK.js +188 -0
- package/dist/relations-CIgB5KPJ.js +162 -0
- package/dist/replay-ClGIMp5p.d.ts +3 -0
- package/dist/replay-X2m6moK1.js +28 -0
- package/dist/request-context-CVJodWx8.js +70 -0
- package/dist/request-context-E3-ps-H_.d.ts +3 -0
- package/dist/request-schema-DzEoR310.js +155 -0
- package/dist/resend/index.d.ts +4 -10
- package/dist/resend/index.js +14 -17
- package/dist/resolve-names-Cmg6SPAa.js +266 -0
- package/dist/resolver-kdZ4HrpC.js +404 -0
- package/dist/resource-ref-BiQtFK-I.js +19 -0
- package/dist/resource-relations-Ck5sjYQR.js +251 -0
- package/dist/retire-BNiXnbBR.js +248 -0
- package/dist/revocations-3jyzniOz.js +26 -0
- package/dist/revocations-ku_f2d2y.d.ts +24 -0
- package/dist/rls-BrsMogAP.js +321 -0
- package/dist/rls-Cv1V8YfI.js +946 -0
- package/dist/rls-files-Bj446vbj.js +114 -0
- package/dist/rls-options-Dpj_pEyU.d.ts +26 -0
- package/dist/role-builder-DhsGEVq-.js +501 -0
- package/dist/role-grants-Bk6ZsaS0.js +46 -0
- package/dist/roles-B29psCem.js +29 -0
- package/dist/rolldown-runtime-B8NLbhFH.js +3 -0
- package/dist/row-conditions-DwIJocfQ.js +27 -0
- package/dist/row-pair-CxEhErJU.js +33 -0
- package/dist/rpc-B-4IZOiU.js +111 -0
- package/dist/rpc-DjgxFbjK.d.ts +18 -0
- package/dist/run-DX4D6S6V.js +726 -0
- package/dist/run-decqEKNa.js +1 -0
- package/dist/run-ticket-D6T39Xdi.js +370 -0
- package/dist/run-ticket-DXwrko2J.d.ts +157 -0
- package/dist/runtime-Cl6xSbEq.js +13 -0
- package/dist/saas-DzjKUQr5.js +1218 -0
- package/dist/scan-Cj7PQLrS.js +28 -0
- package/dist/schema-BeY3croo.js +403 -0
- package/dist/schema-CJPvTfeN.js +133 -0
- package/dist/scim/index.d.ts +2 -2
- package/dist/scim/index.js +2 -2
- package/dist/scim-B9QyJ23q.js +1046 -0
- package/dist/scopes-B-KX9EI8.js +238 -0
- package/dist/seed-sql-CjF7u0aX.js +60 -0
- package/dist/seeds/index.d.ts +2 -0
- package/dist/seeds/index.js +1 -0
- package/dist/seeds-BDTG7xl-.js +53 -0
- package/dist/seeds-uG196Ev4.d.ts +73 -0
- package/dist/server/index.d.ts +13 -13
- package/dist/server/index.js +14 -14
- package/dist/server-Co9CYGqk.js +146 -0
- package/dist/server-types-BrHOGAYx.d.ts +318 -0
- package/dist/sha256-DFsnyVPo.js +157 -0
- package/dist/shared-BOsJIQf4.js +124 -0
- package/dist/shared-BdF5DJDQ.js +330 -0
- package/dist/signals-a1NxAP0X.js +31 -0
- package/dist/sink-BD34OS8T.d.ts +247 -0
- package/dist/sink-Bgvf9lIz.js +966 -0
- package/dist/size-DF7xQ-nH.js +95 -0
- package/dist/skills-B5bc6JIA.js +50 -0
- package/dist/skills-Cr1C0b9D.js +202 -0
- package/dist/snapshot-DckMnHk8.js +352 -0
- package/dist/snapshot-cache-DTTEfmxv.js +69 -0
- package/dist/snapshot-cache-DoP3avLl.d.ts +68 -0
- package/dist/snapshot-compact-CwAop_6C.js +119 -0
- package/dist/snapshot-empty-DZ6sZ83n.js +17 -0
- package/dist/snapshot-evaluate-9RGy7J3N.js +552 -0
- package/dist/snapshot-reads-D775amTL.js +65 -0
- package/dist/snapshot-size-D-pCR8x0.js +139 -0
- package/dist/snapshot-size-DU7CvpMt.js +1 -0
- package/dist/solid/index.d.ts +18 -20
- package/dist/solid/index.js +15 -19
- package/dist/solid-start/index.d.ts +6 -8
- package/dist/solid-start/index.js +4 -5
- package/dist/sources-BbSUNmFX.js +10 -0
- package/dist/sources-DnjJPGfb.js +657 -0
- package/dist/sources-NQio1yFq.d.ts +727 -0
- package/dist/sql-BYYNi1lu.d.ts +8 -0
- package/dist/sql-T4GaBh9X.js +93 -0
- package/dist/src-D6_T4zd7.js +1811 -0
- package/dist/ssf/index.d.ts +3 -3
- package/dist/ssf/index.js +20 -31
- package/dist/standard-webhooks-B3MQihcP.d.ts +86 -0
- package/dist/standard-webhooks-BtIkXclH.js +227 -0
- package/dist/storage-BhGDhsXm.js +131 -0
- package/dist/store-AH8bmaxW.js +377 -0
- package/dist/store-core-eqG8jijs.d.ts +306 -0
- package/dist/store-options-C8x39AHa.js +1034 -0
- package/dist/stores-4DOaL4ZP.d.ts +58 -0
- package/dist/stores-DoA7ACkz.js +127 -0
- package/dist/stream-DdF94h7T.js +73 -0
- package/dist/style-CQDaLJtP.js +24 -0
- package/dist/style-Crf-90o6.js +1 -0
- package/dist/subject-DkxY-AhF.js +23 -0
- package/dist/subject-cache-BZeSj4Xf.d.ts +156 -0
- package/dist/subject-settings-BO-frcYx.js +147 -0
- package/dist/subject-settings-C9F1sU1d.d.ts +48 -0
- package/dist/supabase/client.d.ts +1 -1
- package/dist/supabase/client.js +2 -3
- package/dist/supabase/index.d.ts +77 -24
- package/dist/supabase/index.js +9 -8
- package/dist/supabase/middleware.d.ts +27 -9
- package/dist/supabase/middleware.js +51 -21
- package/dist/supabase-BG1HPdQU.js +30 -0
- package/dist/supabase-BI5ZhzLl.js +792 -0
- package/dist/supabase-config-mXcggV5I.js +890 -0
- package/dist/supabase-hook-hd9abKy4.js +2 -0
- package/dist/supabase-hook-tdR45aXY.js +405 -0
- package/dist/supabase-outcome-CMLuLW-V.js +9 -0
- package/dist/supautils-DXzJ2E2Q.js +96 -0
- package/dist/support-session-B8xrW28B.js +157 -0
- package/dist/svelte/index.d.ts +8 -10
- package/dist/svelte/index.js +12 -15
- package/dist/svelte/runtime.d.ts +4 -6
- package/dist/svelte/runtime.js +4 -4
- package/dist/svelte/source.d.ts +8 -10
- package/dist/svelte/source.js +6 -7
- package/dist/sveltekit/index.d.ts +6 -8
- package/dist/sveltekit/index.js +3 -4
- package/dist/tables-CRTCBuFi.js +3240 -0
- package/dist/tanstack-start/index.d.ts +6 -8
- package/dist/tanstack-start/index.js +3 -4
- package/dist/target-BGpxgKsN.js +50 -0
- package/dist/tenancy-B5Xxt9Sc.js +223 -0
- package/dist/terminal/index.d.ts +6 -16
- package/dist/terminal/index.js +18 -23
- package/dist/testing/core.d.ts +1 -1
- package/dist/testing/core.js +1 -1
- package/dist/testing/fixtures/index.d.ts +12 -10
- package/dist/testing/fixtures/index.js +48 -25
- package/dist/testing/index.d.ts +85 -85
- package/dist/testing/index.js +226 -115
- package/dist/testing/saas/index.d.ts +5 -15
- 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/text-D704xHVl.js +7 -0
- package/dist/text-diff-CsglY49A.js +440 -0
- package/dist/thenable-BxMy2v8w.js +39 -0
- package/dist/time-r0CKBm57.js +94 -0
- package/dist/timeout-nOqLpU2I.js +7 -0
- package/dist/token-BgswTQzt.d.ts +9 -0
- package/dist/token-CSljQqzA.js +76 -0
- package/dist/tool-refusal-DzCSbjp8.js +43 -0
- package/dist/trpc/index.d.ts +7 -9
- package/dist/trpc/index.js +7 -8
- package/dist/type-helpers-DHCQEPj8.d.ts +47 -0
- package/dist/types-3pRMqcvw.d.ts +84 -0
- package/dist/types-BFtFaI1W.d.ts +66 -0
- package/dist/types-BdNdMix7.d.ts +263 -0
- package/dist/types-C7QtRn3n.d.ts +66 -0
- package/dist/types-CVCRFYY_.d.ts +102 -0
- package/dist/types-CWmBZtQN.d.ts +274 -0
- package/dist/types-Cakw89Wx.d.ts +372 -0
- package/dist/types-D3tjoLwT.d.ts +124 -0
- package/dist/types-D8VXQxKL.d.ts +1231 -0
- package/dist/types-DFZKovb3.js +77 -0
- package/dist/types-DONLJQjY.d.ts +134 -0
- package/dist/types-OzSal_K_.d.ts +178 -0
- package/dist/types-XSfi6ihL.d.ts +65 -0
- package/dist/unplugin/index.d.ts +1 -3
- package/dist/unplugin/index.js +3 -4
- package/dist/usage-B-E747wO.js +31 -0
- package/dist/usage-B7nx0_aa.js +761 -0
- package/dist/usage-rqQ9ViXv.js +1 -0
- package/dist/validation-error-BAO1W1yk.d.ts +27 -0
- package/dist/validation-error-CgDOA6VS.js +35 -0
- package/dist/validity-YNEEm2MZ.js +56 -0
- package/dist/verifier-BIYkGcJc.js +530 -0
- package/dist/verify-9HObfifg.js +1102 -0
- package/dist/version-CU6e2wxV.js +7 -0
- package/dist/version-D-jWyJb9.js +46 -0
- package/dist/version-DcZCjWXb.js +1 -0
- package/dist/version-cache-BXkl7-Fz.js +462 -0
- package/dist/views-Dpr1uB16.js +164 -0
- package/dist/vocabulary-CE2k7s1a.js +157 -0
- package/dist/vocabulary-FYgI_NoI.d.ts +400 -0
- package/dist/vue/index.d.ts +18 -20
- package/dist/vue/index.js +13 -18
- package/dist/waiter-DKdFHKVZ.js +66 -0
- package/dist/waiter-hYLJXA7r.d.ts +37 -0
- package/dist/watch-BecZtEdU.js +155 -0
- package/dist/watch-CiN6WU9k.js +221 -0
- package/dist/watch-NAUnUXph.js +1 -0
- package/dist/webmcp/index.d.ts +2 -6
- package/dist/webmcp/index.js +8 -9
- package/dist/who-can-rUSZfLvI.js +366 -0
- package/dist/wire-delegation-DC5Cyec4.js +35 -0
- package/dist/wire-denial-BcRQnA7p.js +26 -0
- package/dist/workflow/index.d.ts +3 -3
- package/dist/workflow/index.js +12 -14
- package/dist/workflow-sdk/index.d.ts +6 -8
- package/dist/workflow-sdk/index.js +2 -3
- package/dist/wrap-CsfsaJhd.js +32 -0
- package/dist/wrap-D-KvhzaC.d.ts +16 -0
- package/package.json +83 -39
- package/schemas/catalog-v2.json +665 -0
- package/schemas/cli-commands-v1.json +1 -1
- package/schemas/cli-result-v2.json +163 -0
- package/schemas/cloud-api-v1.json +1 -1
- package/schemas/snapshot-v1.json +26 -0
- package/schemas/supabase-claims-v1.json +5 -1
- package/schemas/supabase-manifest-v1.json +11 -2
- package/skills/permdock/SKILL.md +1 -1
- package/skills/permdock-data/references/queries-and-rls.md +2 -1
- package/skills/permdock-wire/references/adapters.md +5 -3
- package/dist/2020-CJbO8Bvz.js +0 -6773
- package/dist/active-tenant-DVee32-T.js +0 -39
- package/dist/adapter-context-OHikyRqV.js +0 -29
- package/dist/adoption-scan-DhZejKH8.js +0 -107
- package/dist/app-J9PE1LNm.js +0 -24
- package/dist/app-data-UNNm07jV.js +0 -63
- package/dist/approval-header-8QV6MU4H.js +0 -26
- package/dist/approval-normalize-KfhzpD93.js +0 -196
- package/dist/approval-policies-BiXMlYBu.d.ts +0 -138
- package/dist/approval-prompt-B8hQY69x.js +0 -61
- package/dist/approval-prompt-j5PTItiy.d.ts +0 -59
- package/dist/approval-required-TzNB9oQA.js +0 -6
- package/dist/approvals-BfzI8Foe.js +0 -1048
- package/dist/approvers-BaNwKYgd.js +0 -77
- package/dist/arazzo-2_9pOddr.js +0 -77
- package/dist/arazzo-BDDzHgwW.js +0 -36
- package/dist/args-iafbHiXn.js +0 -311
- package/dist/audience-DLoopY4q.js +0 -55
- package/dist/auth-BxXHxWRy.js +0 -189
- package/dist/authz-topic-Dbc-HDOS.js +0 -15
- package/dist/automation-BueW05db.js +0 -158
- package/dist/automation-_iGeP54L.d.ts +0 -124
- package/dist/base-url-BQbddZO5.js +0 -9
- package/dist/better-supabase-DF8f8oly.js +0 -194
- package/dist/bind-CTj4dHc1.d.ts +0 -58
- package/dist/bind-LQ6zbARV.js +0 -125
- package/dist/body-Cy9S8zhw.js +0 -10
- package/dist/body-text-DQhcmqdY.js +0 -56
- package/dist/boundary-BV3O1eud.js +0 -19
- package/dist/boundary-C9ck-3uK.d.ts +0 -24
- package/dist/budget-BBCPDOGP.js +0 -14
- package/dist/budget-CNLsV2SL.d.ts +0 -14
- package/dist/build-instance-Bq8wkJ4i.js +0 -31
- package/dist/canonical-json-DwilZ1iB.js +0 -29
- package/dist/capability-CenWwTMR.js +0 -205
- package/dist/capability-DqCyFGip.d.ts +0 -130
- package/dist/casbin-BspH3-6_.js +0 -30
- package/dist/casbin-XFqehd6I.js +0 -242
- package/dist/casl-CjBVJj8R.js +0 -24
- package/dist/casl-CkBssiB1.js +0 -308
- package/dist/catalog-B1MAmRQI.js +0 -131
- package/dist/catalog-BCVIH7kq.js +0 -1
- package/dist/catalog-CaZoXBD8.js +0 -52
- package/dist/catalog-doc-DnQDviXY.js +0 -353
- package/dist/catalog-fingerprint-e6aCWosn.js +0 -157
- package/dist/catalog-operations-Do1eD-Rt.js +0 -60
- package/dist/catalog-path-CnI0XTFK.js +0 -12
- package/dist/challenge-DKJpP-5P.js +0 -521
- package/dist/checks-fyDOhcz0.js +0 -72
- package/dist/claims-map-CKkoAAYF.js +0 -16
- package/dist/claims-map-D1Pb5oRq.d.ts +0 -35
- package/dist/client-JK504UCq.d.ts +0 -45
- package/dist/clients-C_NOET3z.d.ts +0 -12
- package/dist/clients-DYr3U86j.js +0 -23
- package/dist/cloud-CUvR7okV.js +0 -86
- package/dist/codemod-iwXnO0fg.js +0 -2800
- package/dist/codemod-uZsk1b6T.js +0 -36
- package/dist/collect-BG-SXFQv.js +0 -537
- package/dist/collect-CxPJRjoc.js +0 -55
- package/dist/collect-ZLgHgujd.js +0 -1
- package/dist/command-L8EstFNm.js +0 -6
- package/dist/compact-CAf557ZB.js +0 -29
- package/dist/compare-DTfyUunF.js +0 -12
- package/dist/compile-Cvru58id.js +0 -661
- package/dist/compile-Dh9pW_Co.d.ts +0 -120
- package/dist/completion-DenWMczI.js +0 -152
- package/dist/config-CoUYTCCu.js +0 -26
- package/dist/config-DC7aiuhP.js +0 -116
- package/dist/config-report-C5D1rPiF.js +0 -56
- package/dist/config-shape-ChhsuGSV.js +0 -147
- package/dist/connection-zoAgwdsD.js +0 -197
- package/dist/connector-schema-CYLQNMYq.js +0 -434
- package/dist/constants-DcJABbLW.js +0 -20
- package/dist/context-BXM0MDB0.js +0 -95
- package/dist/core-BTJlqWsv.js +0 -341
- package/dist/core-BhZEo5Le.d.ts +0 -206
- package/dist/coverage-BuGlwUms.d.ts +0 -135
- package/dist/coverage-CGu_Kovx.js +0 -261
- package/dist/create--q7-j0hX.d.ts +0 -127
- package/dist/create-C5IQw_-i.d.ts +0 -191
- package/dist/create-CYj0cjTu.d.ts +0 -128
- package/dist/create-D7D94oNh.js +0 -376
- package/dist/create-DaddhCIg.js +0 -134
- package/dist/credential-BMsbcaeP.js +0 -431
- package/dist/credentials-BZU7Twpt.js +0 -310
- package/dist/credentials-Bq-Xa7Vq.d.ts +0 -125
- package/dist/credentials-dkycUsY3.js +0 -74
- package/dist/decide-set-DXEPepY1.js +0 -100
- package/dist/deciding-columns-NB4wcyBf.js +0 -134
- package/dist/decision-CaG5_eNJ.js +0 -21
- package/dist/delegation-CrdqnesZ.js +0 -262
- package/dist/delegation-input-DcXhiMkf.js +0 -19
- package/dist/delivery-BupfvJIV.js +0 -560
- package/dist/delivery-event-JioK5YbS.js +0 -40
- package/dist/denied-text-B6s29jcf.d.ts +0 -22
- package/dist/describe-BZAlPHxT.js +0 -101
- package/dist/describe-DwcoWMLB.d.ts +0 -45
- package/dist/device-BkSynWdg.js +0 -196
- package/dist/diff-BnYHpRSI.js +0 -466
- package/dist/diff-H75YU6Q-.js +0 -37
- package/dist/digest-8Yx2CchM.d.ts +0 -19
- package/dist/digest-BI-6aa6d.js +0 -27
- package/dist/doctor-CF9TXVkX.js +0 -3560
- package/dist/doctor-DreyO1At.js +0 -54
- package/dist/env-DJZrPjRi.js +0 -8
- package/dist/errors-BDUwg2qC.js +0 -27
- package/dist/errors-BhRkoNS7.js +0 -145
- package/dist/errors-CHwoRRpB.d.ts +0 -14
- package/dist/errors-D_SnqcRn.d.ts +0 -141
- package/dist/errors-ynga1EQy.js +0 -128
- package/dist/evaluate-BQ2nWOki.js +0 -1905
- package/dist/evaluations-BVtY66lF.d.ts +0 -38
- package/dist/evaluations-Bj5xw0EM.js +0 -612
- package/dist/evaluator-CDl2YUd_.js +0 -2
- package/dist/evaluator-eager-CULtQ8t6.js +0 -9
- package/dist/event-time-BGy48400.js +0 -27
- package/dist/fetch-adapter-BJ76IZZg.d.ts +0 -34
- package/dist/fetch-adapter-CXeBg4CH.js +0 -124
- package/dist/fields-D9PIYlJy.js +0 -504
- package/dist/fields-DlKwZYiy.js +0 -26
- package/dist/files-BSjrtIHw.js +0 -141
- package/dist/files-CfiRtQ-m.js +0 -140
- package/dist/fixtures-BVZc7OCF.js +0 -80
- package/dist/flags-BlmpmXoY.js +0 -86
- package/dist/freeze-jjan0lCv.js +0 -63
- package/dist/from-snapshot-FdVXG_QZ.js +0 -159
- package/dist/gen-BU5glz2Q.js +0 -827
- package/dist/gen-C75KIBdA.js +0 -58
- package/dist/generate-BqkZq8Dr.js +0 -165
- package/dist/generate-CezbCaTI.js +0 -275
- package/dist/grantee-OG4klcNr.js +0 -110
- package/dist/grantee-conditions-Dzprappv.js +0 -271
- package/dist/grantee-match-CPQ9zV-H.js +0 -148
- package/dist/graph-sql-BwFC4Qjs.d.ts +0 -29
- package/dist/headers-B9jQxjtW.d.ts +0 -10
- package/dist/helpers-CO2hDpBU.js +0 -537
- package/dist/hosted-CQW_YNx7.js +0 -362
- package/dist/hosted-D5StFpKa.d.ts +0 -102
- package/dist/http-B_LphE5Y.d.ts +0 -12
- package/dist/http-DH94eh6f.js +0 -72
- package/dist/http-DKLXrFGk.js +0 -83
- package/dist/http-dptLQzPP.js +0 -49
- package/dist/ids-DzhJaCUj.js +0 -55
- package/dist/import-B34PyXgL.js +0 -5950
- package/dist/import-BYYXmHvP.js +0 -1143
- package/dist/index-B1-tE0Kx.d.ts +0 -1159
- package/dist/index-BwSEp_O5.d.ts +0 -210
- package/dist/index-CB_eM-qx.d.ts +0 -101
- package/dist/index-CvcE9mYP.d.ts +0 -234
- package/dist/index-D7sMtTf6.d.ts +0 -542
- package/dist/index-d7f0hNss.d.ts +0 -233
- package/dist/init-C-nzibt_.js +0 -96
- package/dist/init-C1Bj0BFA.js +0 -95
- package/dist/instance-options-DhQVCuhT.d.ts +0 -11
- package/dist/instance-options-URVwqpMW.js +0 -24
- package/dist/instance-snapshot-DyG_5ASl.js +0 -693
- package/dist/instant-DK3Iz83e.js +0 -19
- package/dist/internals-B3IgHrvo.js +0 -20
- package/dist/json-schema-BPGa-RjQ.js +0 -149
- package/dist/json-schema-BfXgnRNT.d.ts +0 -40
- package/dist/kernel-D9AxUqmz.js +0 -427
- package/dist/limits-CAhpRrhk.js +0 -167
- package/dist/live-options-BBIT68le.js +0 -73
- package/dist/load-C4p4VgwR.js +0 -99
- package/dist/load-DiBUJx77.js +0 -1
- package/dist/load-jose-DZ4dnjri.js +0 -8
- package/dist/login-Cm_ebe5M.js +0 -68
- package/dist/login-DjuUQqqK.js +0 -257
- package/dist/lru-8q4WZjBV.js +0 -28
- package/dist/manifest-9KSrH_1h.js +0 -401
- package/dist/manifest-BoCYBbQL.js +0 -46
- package/dist/manifest-C6eFl3Vo.d.ts +0 -349
- package/dist/manifest-json-CAGzls-C.js +0 -9
- package/dist/manifest-schema-svAkgqMc.js +0 -501
- package/dist/map-claims-CAa_bQt9.js +0 -387
- package/dist/map-error-BCdb2Nrp.js +0 -23
- package/dist/markers-BeHZ4x9Q.js +0 -80
- package/dist/may-use-WDhFPqGG.js +0 -125
- package/dist/membership-filter-BWnfRQzo.js +0 -68
- package/dist/migrate-DVsxeE0y.js +0 -537
- package/dist/module-values-CdaVwrab.js +0 -107
- package/dist/oauth-security-X7Em8DbH.js +0 -26
- package/dist/ocsf-TcjRBgIs.js +0 -136
- package/dist/openapi-C2WGtmFa.js +0 -137
- package/dist/openapi-Cc-aS9xC.js +0 -416
- package/dist/openapi-DvTtFkwY.js +0 -256
- package/dist/operation-findings-CVwJHEu_.js +0 -36
- package/dist/operation-risks-BKOcTv8J.js +0 -13
- package/dist/operations-BMPx7HyO.d.ts +0 -62
- package/dist/operations-Bm9HFecz.js +0 -89
- package/dist/optional-8TKc-0j4.js +0 -47
- package/dist/output-CuJfGWo6.js +0 -96
- package/dist/output-files-BYscrQl-.js +0 -1
- package/dist/output-files-CM0BnH05.js +0 -150
- package/dist/ownership-C_5eZ6N2.js +0 -1062
- package/dist/parse-CORUNcCo.js +0 -151
- package/dist/parse-local-manifest-Ce2N-Opr.js +0 -69
- package/dist/parse-local-manifest-w_ksIkB9.d.ts +0 -10
- package/dist/parse-request-DOBVaeiQ.js +0 -25
- package/dist/paths-CUvURzHp.js +0 -45
- package/dist/peer-BuK9F53f.js +0 -982
- package/dist/peer-n-swIV4H.js +0 -1
- package/dist/permdock-B3zE16To.js +0 -1203
- package/dist/permdock-DV3opaI3.d.ts +0 -674
- package/dist/permission-registry-B8tYxPIt.js +0 -398
- package/dist/permissions-BaoLxy66.js +0 -18
- package/dist/permissions-D-M48hW-.js +0 -146
- package/dist/permissions-DriWkV7q.d.ts +0 -54
- package/dist/pg-Ddxsd5ZB.js +0 -60
- package/dist/pins-nqarl3oE.js +0 -15
- package/dist/pkce-CnmmYqUZ.js +0 -21
- package/dist/policy-DIHfTqm6.d.ts +0 -20
- package/dist/policy-DnNOTENd.js +0 -430
- package/dist/policy-from-catalog-Z0hvSffr.js +0 -454
- package/dist/policy-module-xym9fnSq.js +0 -95
- package/dist/policy-types-DU389Elz.d.ts +0 -2809
- package/dist/postgres-store-DcyrPS-r.js +0 -1028
- package/dist/postgrest-3dE9SGx9.d.ts +0 -124
- package/dist/powersync-BO1ty3Mf.js +0 -1
- package/dist/powersync-Bqy5Un2J.js +0 -1532
- package/dist/powersync-CCQAqiOo.js +0 -62
- package/dist/preset-Bn5Z54cH.js +0 -1858
- package/dist/principal-source-C6N60GtM.js +0 -103
- package/dist/problem-CPB8kqk7.js +0 -203
- package/dist/problem-details-CLDgX1KV.js +0 -156
- package/dist/problem-types-DSsRfONQ.js +0 -8
- package/dist/prompt-D1Gj1W4Y.js +0 -938
- package/dist/protected-action-CjSUoPGx.d.ts +0 -76
- package/dist/protected-action-D41o5LvP.js +0 -244
- package/dist/protected-action-OpOxtTsN.js +0 -80
- package/dist/provider-Bzzux0TR.js +0 -12
- package/dist/provider-D1jsNJ85.d.ts +0 -6
- package/dist/provider-store-tIAwP4aW.js +0 -52
- package/dist/provider-with-Do28DhxP.js +0 -69
- package/dist/pull-CYdd5HzX.js +0 -1
- package/dist/pull-DLkaZBwH.js +0 -257
- package/dist/push-sJ5dy46a.js +0 -162
- package/dist/pushed-policy-Db651nih.d.ts +0 -63
- package/dist/pushed-policy-UZyQinrL.js +0 -241
- package/dist/refresh-on-L9UOwATg.d.ts +0 -49
- package/dist/refs-C8BKxc_e.js +0 -105
- package/dist/relation-walk-BDTaTKTM.js +0 -189
- package/dist/relations-CMsJ1ARY.js +0 -163
- package/dist/replay-BU09ad4L.js +0 -29
- package/dist/replay-BpmpY2ev.d.ts +0 -5
- package/dist/request-context-C2_1lchh.d.ts +0 -5
- package/dist/request-context-dyCY4V1t.js +0 -71
- package/dist/request-schema-CMP8Cmxd.js +0 -156
- package/dist/resolve-names-DHDedxk0.js +0 -206
- package/dist/resource-ref-CaS9yVPi.js +0 -20
- package/dist/resource-relations-8-pCScBO.js +0 -252
- package/dist/retire-B2xffQgY.js +0 -249
- package/dist/revocations-BaUXHM1N.d.ts +0 -26
- package/dist/revocations-Bhr0aMIC.js +0 -27
- package/dist/rls-B3-tGA4r.js +0 -2700
- package/dist/rls-BW2u4lQW.js +0 -367
- package/dist/role-builder-BXdhhQcB.js +0 -507
- package/dist/rolldown-runtime-C3I60J0A.js +0 -4
- package/dist/row-conditions-BAGHOmVq.js +0 -28
- package/dist/row-pair-DglMdRFh.js +0 -34
- package/dist/rpc-BdFGYcWm.js +0 -112
- package/dist/rpc-DKRQobOX.d.ts +0 -22
- package/dist/run-2GwcSago.js +0 -694
- package/dist/run-CdGNonHf.js +0 -1
- package/dist/run-ticket-Ddxt9OuU.js +0 -371
- package/dist/run-ticket-o4RxoaEN.d.ts +0 -159
- package/dist/runtime-rf0ZuyF3.js +0 -14
- package/dist/saas-D9maBt0q.js +0 -1223
- package/dist/scan-CB46GDQ0.js +0 -29
- package/dist/schema-BlnU_TzE.js +0 -414
- package/dist/schema-CyEB_zeO.js +0 -134
- package/dist/scim-BG6uPUeW.js +0 -1056
- package/dist/scim-CovliQUg.js +0 -44
- package/dist/scopes-gdH__vDZ.js +0 -239
- package/dist/server-CKjFooaJ.js +0 -147
- package/dist/server-types-C4q8_8MM.d.ts +0 -325
- package/dist/sha256-C-4WXKIu.js +0 -158
- package/dist/shared-BRmCJxDK.js +0 -125
- package/dist/shared-DfaIWvIJ.js +0 -354
- package/dist/signals-B1vHR3fN.js +0 -32
- package/dist/sink-C3KDccl9.d.ts +0 -249
- package/dist/sink-D9_vh372.js +0 -968
- package/dist/skills-BYHCObpD.js +0 -51
- package/dist/skills-C-9wjNaE.js +0 -204
- package/dist/snapshot-D0VOanxQ.js +0 -334
- package/dist/snapshot-cache-B66h7FBK.js +0 -70
- package/dist/snapshot-cache-C1mN0pXe.d.ts +0 -70
- package/dist/snapshot-compact-CUtXsx6i.js +0 -75
- package/dist/snapshot-empty-F7d5BRlc.js +0 -18
- package/dist/snapshot-evaluate-C3ZA35O_.js +0 -501
- package/dist/snapshot-reads-CNNmp1cK.js +0 -66
- package/dist/sources-2virTxHt.d.ts +0 -721
- package/dist/sources-C4vkzZJV.js +0 -660
- package/dist/sources-qoIJQrJv.js +0 -11
- package/dist/sql-0WjxIp9g.js +0 -80
- package/dist/sql-B80DFdpG.d.ts +0 -10
- package/dist/src-ieIv22BA.js +0 -2080
- package/dist/standard-webhooks-B2g_yWK8.d.ts +0 -88
- package/dist/standard-webhooks-D67a3nzk.js +0 -228
- package/dist/storage-C2bWdvJH.js +0 -132
- package/dist/store-DXO0aVgf.js +0 -380
- package/dist/store-core-BI-9ZU-5.d.ts +0 -311
- package/dist/store-options-BYKNX_JG.js +0 -993
- package/dist/stores-DtM8pt8o.js +0 -128
- package/dist/stores-DwGfIcmq.d.ts +0 -57
- package/dist/stream-DQ3rbO3J.js +0 -74
- package/dist/style-DblOtSga.js +0 -1
- package/dist/style-Ds11Hmk4.js +0 -25
- package/dist/subject-C7RddW0G.js +0 -24
- package/dist/subject-cache-BT1fGuea.js +0 -193
- package/dist/subject-cache-TY2tw-k9.d.ts +0 -144
- package/dist/subject-jG6o8eKo.js +0 -556
- package/dist/subject-settings-8sH5HlII.js +0 -150
- package/dist/subject-settings-vNW8qmUH.d.ts +0 -52
- package/dist/supabase-BlAqmxD8.js +0 -723
- package/dist/supabase-C1hExXsZ.js +0 -92
- package/dist/supabase-hook-DCemge7i.js +0 -1
- package/dist/supabase-hook-DJA8AJYz.js +0 -4263
- package/dist/supautils-DuwkBqKm.js +0 -1186
- package/dist/support-session-BGeEYDSq.js +0 -158
- package/dist/tables-B3w3EtUF.js +0 -4002
- package/dist/target-qdEAnnhU.js +0 -51
- package/dist/tenancy-BlxY5T0q.js +0 -224
- package/dist/text-BMFRfBqc.js +0 -8
- package/dist/text-diff-BtfSmdUo.js +0 -444
- package/dist/thenable-BNSM1U2R.js +0 -40
- package/dist/time-nR1JesoH.js +0 -95
- package/dist/timeout-D51niuQP.js +0 -8
- package/dist/token-D6pWn8Uj.d.ts +0 -11
- package/dist/token-DaMnIU9O.js +0 -77
- package/dist/tool-refusal-D4spOJ7I.js +0 -44
- package/dist/type-helpers-tDoGEIsd.d.ts +0 -49
- package/dist/types-61f3KMtI.d.ts +0 -1136
- package/dist/types-BDgMzK1i.d.ts +0 -368
- package/dist/types-BIvkpVoc.d.ts +0 -180
- package/dist/types-BWjNPQkS.d.ts +0 -67
- package/dist/types-Bq4AU68k.d.ts +0 -105
- package/dist/types-BsqLNNvG.d.ts +0 -68
- package/dist/types-CH67RMvL.d.ts +0 -136
- package/dist/types-CcUXciSj.js +0 -79
- package/dist/types-DAyp592k.d.ts +0 -276
- package/dist/types-DEDocm4c.d.ts +0 -81
- package/dist/types-DQQkzF97.d.ts +0 -126
- package/dist/types-DdeivUBP.d.ts +0 -68
- package/dist/types-X40XNxRP.d.ts +0 -265
- package/dist/usage-BBEm7GVn.js +0 -762
- package/dist/usage-CkKbvpmL.js +0 -32
- package/dist/usage-GQxn7qkA.js +0 -1
- package/dist/validation-error-CV0nV6_L.d.ts +0 -29
- package/dist/validation-error-CYg2kJEw.js +0 -36
- package/dist/validity-IcjQSR7I.js +0 -57
- package/dist/verifier-DUV6pLqZ.js +0 -519
- package/dist/verify-lgYu1Twv.js +0 -1736
- package/dist/version-DMQ0dnN5.js +0 -48
- package/dist/version-DizhmD72.js +0 -1
- package/dist/version-sources-BRb9ZteH.js +0 -34
- package/dist/views-MWmJ6Y4P.js +0 -147
- package/dist/vocabulary-BuYFWeCU.js +0 -158
- package/dist/vocabulary-DeZvUaTw.d.ts +0 -401
- package/dist/waiter-BophA4BT.d.ts +0 -39
- package/dist/waiter-aBLM63_f.js +0 -67
- package/dist/watch-CJKYQYNb.js +0 -167
- package/dist/watch-Cv-xvI6e.js +0 -1
- package/dist/who-can-Yh9WdiwK.js +0 -367
- package/dist/wire-delegation-Cv3W2eaM.js +0 -36
- package/dist/wire-denial-C7PaVYEM.js +0 -27
- package/dist/wrap-Bq9fHwuT.d.ts +0 -18
- package/dist/wrap-C5PWzgkq.js +0 -33
- package/schemas/catalog-v1.json +0 -679
- package/schemas/cli-result-v1.json +0 -95
|
@@ -0,0 +1,893 @@
|
|
|
1
|
+
import { t as parseCatalog } from "./parse-nfHSt1Wy.js";
|
|
2
|
+
import { n as freezeDeep } from "./freeze-DGfJq_j2.js";
|
|
3
|
+
import { a as delegatedScopeMap } from "./permdock-BueSeg7X.js";
|
|
4
|
+
import { i as qualifySqlTable, l as sqlIdent, s as quoteSqlLiteral } from "./sql-T4GaBh9X.js";
|
|
5
|
+
import { n as parseSupabaseManifest, t as hasTokenHook } from "./manifest-B-8d2lhG.js";
|
|
6
|
+
import { o as holder, r as approverLeaves } from "./approvers-BkY_ZfWl.js";
|
|
7
|
+
import { n as asApprover } from "./approval-normalize-Cpp8R0rY.js";
|
|
8
|
+
// src/better-supabase/active-tenant.ts
|
|
9
|
+
function describe(from) {
|
|
10
|
+
return "appMetadata" in from ? `app_metadata.${from.appMetadata}` : `${from.table}.${from.column} (joined on ${from.id})`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Why PermDock's token hook and better-supabase disagree on the active tenant,
|
|
14
|
+
* or `undefined` when they agree. `"resolver"` takes the tenant from the
|
|
15
|
+
* request, so any hook source agrees with it.
|
|
16
|
+
*/
|
|
17
|
+
function activeTenantMismatch(from, tenantClaim, activeTenant) {
|
|
18
|
+
if (activeTenant === "resolver") return;
|
|
19
|
+
if (activeTenant === "claim") {
|
|
20
|
+
if ("appMetadata" in from && from.appMetadata === tenantClaim) return;
|
|
21
|
+
return `blocks.permissions.activeTenant is "claim", so better-supabase's switch_organization writes app_metadata.${tenantClaim}, but PermDock's token hook reads the active tenant from ${describe(from)}. Set supabase.hook.activeFrom: "app_metadata.${tenantClaim}" and run permdock supabase hook generate.`;
|
|
22
|
+
}
|
|
23
|
+
const dot = activeTenant.profileColumn.lastIndexOf(".");
|
|
24
|
+
if (dot <= 0) return;
|
|
25
|
+
const table = qualifySqlTable(activeTenant.profileColumn.slice(0, dot));
|
|
26
|
+
const column = activeTenant.profileColumn.slice(dot + 1);
|
|
27
|
+
const id = activeTenant.key ?? "id";
|
|
28
|
+
if ("table" in from && qualifySqlTable(from.table) === table && from.column === column && from.id === id) return;
|
|
29
|
+
return `blocks.permissions.activeTenant writes the active tenant to ${table}.${column} (joined on ${id}), but PermDock's token hook reads it from ${describe(from)}. Set supabase.hook.activeFrom: { table: "${table}", column: "${column}", id: "${id}" } and run permdock supabase hook generate.`;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Where the token hook reads the active tenant, as better-supabase names it in
|
|
33
|
+
* `tokenHook.activeOrganizationFrom`, or `undefined` when the hook reads an
|
|
34
|
+
* `app_metadata` key other than the tenant claim, which has no better-supabase
|
|
35
|
+
* name.
|
|
36
|
+
*/
|
|
37
|
+
function activeOrganizationFrom(from, tenantClaim) {
|
|
38
|
+
if ("appMetadata" in from) return from.appMetadata === tenantClaim ? "claim" : void 0;
|
|
39
|
+
return {
|
|
40
|
+
profileColumn: `${qualifySqlTable(from.table)}.${from.column}`,
|
|
41
|
+
...from.id === "id" ? {} : { key: from.id }
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
// src/better-supabase/approvers.ts
|
|
45
|
+
/** `rls.approvals`' approver check, executable by `authenticated`. */
|
|
46
|
+
const IS_APPROVER = "permdock_is_approver";
|
|
47
|
+
/** The manager walk `rls.approvals.managers` writes. */
|
|
48
|
+
const MANAGES = "permdock_manages";
|
|
49
|
+
/**
|
|
50
|
+
* The resource a cover's `resources` names for a request kind: `job` for
|
|
51
|
+
* `job.update`, else the kind.
|
|
52
|
+
*/
|
|
53
|
+
function resourceOf(kind) {
|
|
54
|
+
const dot = kind.indexOf(".");
|
|
55
|
+
return dot <= 0 ? kind : kind.slice(0, dot);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* better-supabase's `isApprover` template: one `case` over `{kind}` whose
|
|
59
|
+
* branches call `permdock_is_approver` with the kind's approvers as JSON. A
|
|
60
|
+
* kind with no branch is `false`. With `requestApprovers`, every call is the
|
|
61
|
+
* five-argument form, which also gets better-supabase's `{approvers}`, the
|
|
62
|
+
* request's current approvers. Only `user`, `holder` and `anyOf` approvers, and
|
|
63
|
+
* `manager` with `rls.approvals.managers`, match in SQL; other leaves are
|
|
64
|
+
* reported and match nobody.
|
|
65
|
+
*/
|
|
66
|
+
function isApproverTemplate(input) {
|
|
67
|
+
const problems = [];
|
|
68
|
+
if (!input.listed) return { problems: [`approvers needs ${input.schema}.${IS_APPROVER}, which \`permdock rls generate\` writes with rls.approvals. Run it, then \`permdock supabase inspect --out\`.`] };
|
|
69
|
+
const fn = `${sqlIdent(input.schema)}.${sqlIdent(IS_APPROVER)}`;
|
|
70
|
+
const keys = input.catalog === void 0 ? void 0 : new Set(input.catalog.permissions.map((permission) => permission.key));
|
|
71
|
+
const current = input.requestApprovers === true;
|
|
72
|
+
if (current && input.covers !== true) return { problems: [`requestApprovers needs the five-argument ${IS_APPROVER}, which \`permdock rls generate\` writes with rls.approvals.delegations or rls.approvals.managers. Set one, run it, then \`permdock supabase inspect --out\`.`] };
|
|
73
|
+
const passed = current ? ", ({approvers})::jsonb" : "";
|
|
74
|
+
const branches = [];
|
|
75
|
+
for (const [kind, given] of Object.entries(input.approvers)) {
|
|
76
|
+
if (kind === "") {
|
|
77
|
+
problems.push("approvers has an empty kind, which no request has.");
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
const approvers = asApprover(given);
|
|
81
|
+
const managers = input.managers === true && input.covers === true;
|
|
82
|
+
for (const leaf of approverLeaves(approvers)) {
|
|
83
|
+
if (leaf.kind === "user") continue;
|
|
84
|
+
if (leaf.kind === "manager") {
|
|
85
|
+
if (!managers) problems.push(`The ${kind} approvers name a manager approver, which ${IS_APPROVER} checks only with rls.approvals.managers, so it matches nobody. Set rls.approvals.managers, run \`permdock rls generate\`, then \`permdock supabase inspect --out\`.`);
|
|
86
|
+
} else if (leaf.kind !== "permission") problems.push(`The ${kind} approvers name a ${leaf.kind} approver, which ${IS_APPROVER} cannot check in SQL, so it matches nobody. Use user(), holder(), manager() or anyOf().`);
|
|
87
|
+
else if (keys !== void 0 && !keys.has(leaf.permission)) problems.push(`The ${kind} approver permission ${leaf.permission} is not in the catalog. Run \`permdock catalog\` after adding it to the policy.`);
|
|
88
|
+
}
|
|
89
|
+
const json = `${quoteSqlLiteral(JSON.stringify(approvers))}::jsonb`;
|
|
90
|
+
branches.push(input.covers === true ? `when ${quoteSqlLiteral(kind)} then ${fn}(${json}, ({tenant})::text, ({requester})::text, ${quoteSqlLiteral(resourceOf(kind))}${passed})` : `when ${quoteSqlLiteral(kind)} then ${fn}(${json}, ({tenant})::text)`);
|
|
91
|
+
}
|
|
92
|
+
if (branches.length === 0 && !current) {
|
|
93
|
+
problems.push("approvers names no kind, so isApprover is not set.");
|
|
94
|
+
return { problems };
|
|
95
|
+
}
|
|
96
|
+
if (!input.rootTenant) problems.push(`The tenant scope "${input.tenantScope}" is not a root scope, and ${IS_APPROVER} checks holder() approvers at the root scope, so they match nobody.`);
|
|
97
|
+
const otherwise = current ? `${fn}(null::jsonb, ({tenant})::text, ({requester})::text, pg_catalog.split_part({kind}, '.', 1)${passed})` : "false";
|
|
98
|
+
return {
|
|
99
|
+
template: branches.length === 0 ? otherwise : `case {kind} ${branches.join(" ")} else ${otherwise} end`,
|
|
100
|
+
requires: {
|
|
101
|
+
function: fn,
|
|
102
|
+
args: current ? "jsonb, text, text, text, jsonb" : input.covers === true ? "jsonb, text, text, text" : "jsonb, text",
|
|
103
|
+
role: "postgres"
|
|
104
|
+
},
|
|
105
|
+
problems
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
// src/better-supabase/provider-functions.ts
|
|
109
|
+
/** `subject_for` for the signed-in user, from the hook (`permdock generate`). */
|
|
110
|
+
const OWN_SUBJECT = "permdock_subject";
|
|
111
|
+
/** better-supabase's `bootstrapPermissions`, from `rls generate`. */
|
|
112
|
+
const BOOTSTRAP_PERMISSIONS = "permdock_bootstrap_permissions";
|
|
113
|
+
/**
|
|
114
|
+
* The helper each template calls (with `{scope}` unfilled), its default
|
|
115
|
+
* argument types and the role that calls it: `postgres` for the templates
|
|
116
|
+
* better-supabase runs inside its own `security definer` functions.
|
|
117
|
+
*/
|
|
118
|
+
const TEMPLATES = {
|
|
119
|
+
idsWith: {
|
|
120
|
+
helper: "permitted_{scope}_ids_by_permission",
|
|
121
|
+
listedAs: "permitted_{scope}_ids",
|
|
122
|
+
args: "text",
|
|
123
|
+
role: "authenticated",
|
|
124
|
+
sql: "permitted_{scope}_ids_by_permission({permission})"
|
|
125
|
+
},
|
|
126
|
+
isPlatform: {
|
|
127
|
+
helper: "permdock_has_permission",
|
|
128
|
+
listedAs: "permdock_has",
|
|
129
|
+
args: "text",
|
|
130
|
+
role: "authenticated",
|
|
131
|
+
sql: "permdock_has_permission({permission})"
|
|
132
|
+
},
|
|
133
|
+
idsWithFor: {
|
|
134
|
+
helper: "permitted_{scope}_ids_by_permission_for",
|
|
135
|
+
listedAs: "permitted_{scope}_ids_for",
|
|
136
|
+
args: "uuid, text",
|
|
137
|
+
role: "postgres",
|
|
138
|
+
sql: "permitted_{scope}_ids_by_permission_for({user}, {permission})"
|
|
139
|
+
},
|
|
140
|
+
isPlatformFor: {
|
|
141
|
+
helper: "permdock_has_permission_for",
|
|
142
|
+
listedAs: "permdock_has_for",
|
|
143
|
+
args: "uuid, text",
|
|
144
|
+
role: "postgres",
|
|
145
|
+
sql: "permdock_has_permission_for({user}, {permission})"
|
|
146
|
+
},
|
|
147
|
+
memberIds: {
|
|
148
|
+
helper: "member_{scope}_ids",
|
|
149
|
+
args: "",
|
|
150
|
+
role: "authenticated",
|
|
151
|
+
sql: "member_{scope}_ids()"
|
|
152
|
+
},
|
|
153
|
+
memberIdsFor: {
|
|
154
|
+
helper: "member_{scope}_ids_for",
|
|
155
|
+
args: "uuid",
|
|
156
|
+
role: "supabase_auth_admin",
|
|
157
|
+
sql: "member_{scope}_ids_for({user})"
|
|
158
|
+
},
|
|
159
|
+
canAssign: {
|
|
160
|
+
helper: "permdock_can_assign",
|
|
161
|
+
args: "text, text",
|
|
162
|
+
role: "authenticated",
|
|
163
|
+
sql: "permdock_can_assign({role}, {tenant}::text)"
|
|
164
|
+
},
|
|
165
|
+
canAssignFor: {
|
|
166
|
+
helper: "permdock_can_assign_for",
|
|
167
|
+
args: "uuid, text, text",
|
|
168
|
+
role: "postgres",
|
|
169
|
+
sql: "permdock_can_assign_for({user}, {role}, {tenant}::text)"
|
|
170
|
+
},
|
|
171
|
+
permissionsFor: {
|
|
172
|
+
helper: "permitted_{scope}_permission_keys_for",
|
|
173
|
+
args: "uuid, uuid",
|
|
174
|
+
role: "postgres",
|
|
175
|
+
sql: "array(select {schema}.permitted_{scope}_permission_keys_for({user}, {tenant}))"
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
const ASSIGN_ANY = {
|
|
179
|
+
canAssign: {
|
|
180
|
+
helper: "permdock_can_assign_any",
|
|
181
|
+
args: "text, uuid, text, text",
|
|
182
|
+
role: "authenticated",
|
|
183
|
+
sql: "permdock_can_assign_any({role}, {tenant}, '{scope}', {tenant}::text)"
|
|
184
|
+
},
|
|
185
|
+
canAssignFor: {
|
|
186
|
+
helper: "permdock_can_assign_any_for",
|
|
187
|
+
args: "uuid, text, uuid, text, text",
|
|
188
|
+
role: "postgres",
|
|
189
|
+
sql: "permdock_can_assign_any_for({user}, {role}, {tenant}, '{scope}', {tenant}::text)"
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
const listedName = (entry) => entry.listedAs ?? entry.helper;
|
|
193
|
+
/**
|
|
194
|
+
* No client role may execute `permitted_<scope>_users`, so `holdersOf` is
|
|
195
|
+
* required for `postgres`, inside better-supabase's `security definer`
|
|
196
|
+
* functions; better-supabase fills it for the tenant scope only.
|
|
197
|
+
*/
|
|
198
|
+
const HOLDERS_OF = "permitted_{scope}_users";
|
|
199
|
+
/**
|
|
200
|
+
* better-supabase calls `teamIdsOf` from RLS policies as `authenticated`, so it
|
|
201
|
+
* fills from the caller-bound `member_<scope>_ids_of`, never from the `_for`
|
|
202
|
+
* form only `supabase_auth_admin` may execute. Without a team scope, the hook
|
|
203
|
+
* writes `member_team_ids_of` from `supabase.hook.teams`.
|
|
204
|
+
*/
|
|
205
|
+
const TEAM_IDS_OF = "member_{scope}_ids_of";
|
|
206
|
+
/** The scope names better-supabase reads as its teams (doctor BS417). */
|
|
207
|
+
const TEAM_SCOPE = /^teams?$/u;
|
|
208
|
+
const ACTOR_MAY_WRITE = "permdock_actor_may_write";
|
|
209
|
+
const APPROVER_FOR = "permdock_approver_for_ids";
|
|
210
|
+
const MANAGED_USERS = "permdock_managed_user_ids";
|
|
211
|
+
const OPTIONAL = [
|
|
212
|
+
"idsWithFor",
|
|
213
|
+
"isPlatformFor",
|
|
214
|
+
"memberIds",
|
|
215
|
+
"memberIdsFor",
|
|
216
|
+
"canAssign",
|
|
217
|
+
"canAssignFor",
|
|
218
|
+
"permissionsFor"
|
|
219
|
+
];
|
|
220
|
+
const withSchema = (schema, sql) => sql.includes("{schema}") ? sql.replaceAll("{schema}", schema) : `${schema}.${sql}`;
|
|
221
|
+
/** `p_user uuid, p_active text default null` as `uuid, text`. */
|
|
222
|
+
const argTypes = (args) => args.split(",").map((arg) => arg.trim().replace(/\s+default\s.*$/iu, "").split(/\s+/u).slice(1).join(" ")).filter((type) => type !== "").join(", ");
|
|
223
|
+
/**
|
|
224
|
+
* better-supabase's `permitted` template. An instance of a scope (`{resource}`
|
|
225
|
+
* names the scope) is checked against that scope's ids; any other resource at
|
|
226
|
+
* the tenant, and with a catalog only for a key without row conditions. Without
|
|
227
|
+
* a catalog better-supabase refuses every key anyway.
|
|
228
|
+
*/
|
|
229
|
+
function permittedTemplate(schema, scopes, tenantScope, catalog) {
|
|
230
|
+
const idsOf = (scope) => `select ids::text from ${schema}.${sqlIdent(`permitted_${scope}_ids_by_permission`)}({permission}) as ids`;
|
|
231
|
+
const branches = scopes.map((scope) => `when {resource} = ${quoteSqlLiteral(scope)} then {id} in (${idsOf(scope)})`);
|
|
232
|
+
const atTenant = `{tenant} in (${idsOf(tenantScope)})`;
|
|
233
|
+
const complete = catalog?.permissions.filter((permission) => !permission.rowConditions).map((permission) => quoteSqlLiteral(permission.key));
|
|
234
|
+
const otherwise = complete === void 0 ? atTenant : complete.length === 0 ? `false and ${atTenant}` : `{permission} in (${complete.join(", ")}) and ${atTenant}`;
|
|
235
|
+
return `case ${branches.join(" ")} else ${otherwise} end`;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* better-supabase's `rowsWith` and `rowsWithFor` over the
|
|
239
|
+
* `permitted_<resource>_rows` helpers: `{resource}` is the resource's SQL name,
|
|
240
|
+
* `rowsWith` takes the candidate ids being checked, and `rowsWithFor` runs the
|
|
241
|
+
* helper's `_for` form, which `rls generate` writes beside it for Supabase.
|
|
242
|
+
*/
|
|
243
|
+
function rowTemplatesOf(schema, manifest, requires, problems) {
|
|
244
|
+
const rows = [];
|
|
245
|
+
for (const [resource, names] of Object.entries(manifest.names?.resources ?? {})) {
|
|
246
|
+
if (names.rows === void 0) continue;
|
|
247
|
+
if (names.idType === void 0 || names.idType === "") {
|
|
248
|
+
problems.push(`names.resources.${resource}.idType is missing. Run permdock generate.`);
|
|
249
|
+
return {};
|
|
250
|
+
}
|
|
251
|
+
rows.push({
|
|
252
|
+
helper: names.rows,
|
|
253
|
+
idType: names.idType
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
if (rows.length === 0) {
|
|
257
|
+
problems.push("rowHelpers: the manifest names no permitted_<resource>_rows helper. Set rls.rowHelpers and run permdock generate.");
|
|
258
|
+
return {};
|
|
259
|
+
}
|
|
260
|
+
const types = new Set(rows.map((row) => row.idType));
|
|
261
|
+
const [only] = types;
|
|
262
|
+
const idType = types.size === 1 ? only : void 0;
|
|
263
|
+
for (const { helper } of rows) requires.push({
|
|
264
|
+
function: `${schema}.${sqlIdent(helper)}`,
|
|
265
|
+
args: idType === void 0 ? "text" : `text, ${idType}[]`,
|
|
266
|
+
role: "authenticated"
|
|
267
|
+
}, {
|
|
268
|
+
function: `${schema}.${sqlIdent(`${helper}_for`)}`,
|
|
269
|
+
args: "uuid, text, jsonb",
|
|
270
|
+
role: "postgres"
|
|
271
|
+
});
|
|
272
|
+
return {
|
|
273
|
+
rowsWith: idType === void 0 ? `${schema}.permitted_{resource}_rows({permission})` : `${schema}.permitted_{resource}_rows({permission}, ({ids})::${idType}[])`,
|
|
274
|
+
rowsWithFor: `${schema}.permitted_{resource}_rows_for({user}, {permission})`
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* better-supabase's `functions` and `requires` from the helpers the manifest
|
|
279
|
+
* lists. A `_for` template and `permissionsFor` are set only when the manifest
|
|
280
|
+
* lists their helper, which `rls.mode: 'database'` writes. `subject` and
|
|
281
|
+
* `subjectForTenant` name `permdock_subject()` and `permdock_subject(p_tenant)`
|
|
282
|
+
* unless `subject: false`; `subjectForTenant`, `bootstrapPermissions`
|
|
283
|
+
* (`permdock_bootstrap_permissions(p_tenant)`) and `canIn` (the tenant scope's
|
|
284
|
+
* ids by permission, as a set) answer at the root scope only.
|
|
285
|
+
*/
|
|
286
|
+
function providerFunctions(input) {
|
|
287
|
+
const { manifest, catalog, options, tenantScope, rootTenant, problems } = input;
|
|
288
|
+
const rls = manifest.rls;
|
|
289
|
+
const scopeNames = rls.scopes.map((scope) => scope.name);
|
|
290
|
+
const helpers = new Map(rls.helpers.map((helper) => [helper.name, helper]));
|
|
291
|
+
const overload = (name, args) => rls.helpers.some((helper) => helper.name === name && helper.args === args);
|
|
292
|
+
const schema = sqlIdent(rls.schema);
|
|
293
|
+
const entryOf = (template) => input.assignAny && (template === "canAssign" || template === "canAssignFor") ? ASSIGN_ANY[template] : TEMPLATES[template];
|
|
294
|
+
const listed = (template, scope) => helpers.has(listedName(entryOf(template)).replaceAll("{scope}", scope));
|
|
295
|
+
const templates = [
|
|
296
|
+
"idsWith",
|
|
297
|
+
"isPlatform",
|
|
298
|
+
...OPTIONAL.filter((template) => listed(template, tenantScope))
|
|
299
|
+
];
|
|
300
|
+
for (const template of ["idsWith", "isPlatform"]) if (!listed(template, tenantScope)) problems.push(`The manifest's rls.helpers has no ${rls.schema}.${listedName(TEMPLATES[template]).replaceAll("{scope}", tenantScope)}. Run \`permdock rls generate\`, then \`permdock supabase inspect --out\`.`);
|
|
301
|
+
if (rls.customRoles === true && !rootTenant && templates.includes("canAssign")) problems.push(`The tenant scope "${tenantScope}" is not a root scope, so canAssign checks declared roles only: ${rls.schema}.${ASSIGN_ANY.canAssign.helper}, which also answers for custom roles, takes the root tenant id.`);
|
|
302
|
+
const optional = {};
|
|
303
|
+
const requires = [];
|
|
304
|
+
const required = /* @__PURE__ */ new Set();
|
|
305
|
+
for (const template of templates) {
|
|
306
|
+
const entry = entryOf(template);
|
|
307
|
+
optional[template] = withSchema(schema, entry.sql);
|
|
308
|
+
for (const scope of entry.helper.includes("{scope}") ? scopeNames : [tenantScope]) {
|
|
309
|
+
const name = entry.helper.replaceAll("{scope}", scope);
|
|
310
|
+
const fn = `${schema}.${sqlIdent(name)}`;
|
|
311
|
+
if (required.has(fn)) continue;
|
|
312
|
+
required.add(fn);
|
|
313
|
+
const helper = helpers.get(name);
|
|
314
|
+
const args = helper === void 0 ? entry.args : argTypes(helper.args);
|
|
315
|
+
requires.push({
|
|
316
|
+
function: fn,
|
|
317
|
+
...args === "" ? {} : { args },
|
|
318
|
+
role: entry.role
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
const isApprover = isApproverOf(input, helpers, requires);
|
|
323
|
+
const call = (name, sql, role, args) => {
|
|
324
|
+
const fn = `${schema}.${sqlIdent(name)}`;
|
|
325
|
+
requires.push({
|
|
326
|
+
function: fn,
|
|
327
|
+
...args === void 0 || args === "" ? {} : { args },
|
|
328
|
+
role
|
|
329
|
+
});
|
|
330
|
+
return `${fn}(${sql})`;
|
|
331
|
+
};
|
|
332
|
+
const holders = helpers.get(HOLDERS_OF.replace("{scope}", tenantScope));
|
|
333
|
+
const holdersOf = holders === void 0 ? void 0 : call(holders.name, "{permission}, {tenant}", "postgres", argTypes(holders.args));
|
|
334
|
+
const teamHelper = scopeNames.filter((scope) => TEAM_SCOPE.test(scope)).map((scope) => helpers.get(TEAM_IDS_OF.replace("{scope}", scope))).find((helper) => helper !== void 0) ?? helpers.get(TEAM_IDS_OF.replace("{scope}", "team"));
|
|
335
|
+
const teamIdsOf = teamHelper === void 0 ? void 0 : call(teamHelper.name, "{user}", "authenticated", argTypes(teamHelper.args));
|
|
336
|
+
const actorMayWrite = helpers.has(ACTOR_MAY_WRITE) ? call(ACTOR_MAY_WRITE, "", "authenticated") : void 0;
|
|
337
|
+
const permitted = listed("idsWith", tenantScope) ? permittedTemplate(schema, scopeNames.filter((scope) => listed("idsWith", scope)), tenantScope, catalog) : void 0;
|
|
338
|
+
const canIn = listed("idsWith", tenantScope) ? `{tenant} in (select ${schema}.${sqlIdent(`permitted_${tenantScope}_ids_by_permission`)}({permission}))` : void 0;
|
|
339
|
+
const rowTemplates = options.rowHelpers === true ? rowTemplatesOf(schema, manifest, requires, problems) : {};
|
|
340
|
+
const subjects = options.subject !== false;
|
|
341
|
+
const subject = subjects && overload(OWN_SUBJECT, "") ? call(OWN_SUBJECT, "", "authenticated").slice(0, -2) : void 0;
|
|
342
|
+
const subjectForTenant = subjects && rootTenant && overload(OWN_SUBJECT, "p_tenant text") ? call(OWN_SUBJECT, "({tenant})::text", "authenticated", "text") : void 0;
|
|
343
|
+
const bootstrapPermissions = rootTenant && overload(BOOTSTRAP_PERMISSIONS, "p_tenant text") ? call(BOOTSTRAP_PERMISSIONS, "({tenant})::text", "authenticated", "text") : void 0;
|
|
344
|
+
const setTemplate = (name, sql = "") => {
|
|
345
|
+
const helper = helpers.get(name);
|
|
346
|
+
return helper === void 0 ? void 0 : call(name, sql, "authenticated", argTypes(helper.args));
|
|
347
|
+
};
|
|
348
|
+
const approverFor = setTemplate(APPROVER_FOR);
|
|
349
|
+
const managedUsers = /\bp_tenant\b/u.test(helpers.get(MANAGED_USERS)?.args ?? "") ? setTemplate(MANAGED_USERS, "{tenant}") : void 0;
|
|
350
|
+
return {
|
|
351
|
+
functions: {
|
|
352
|
+
...rowTemplates,
|
|
353
|
+
...optional,
|
|
354
|
+
idsWith: `${schema}.${TEMPLATES.idsWith.sql}`,
|
|
355
|
+
isPlatform: `${schema}.${TEMPLATES.isPlatform.sql}`,
|
|
356
|
+
...holdersOf === void 0 ? {} : { holdersOf },
|
|
357
|
+
...teamIdsOf === void 0 ? {} : { teamIdsOf },
|
|
358
|
+
...actorMayWrite === void 0 ? {} : { actorMayWrite },
|
|
359
|
+
...isApprover === void 0 ? {} : { isApprover },
|
|
360
|
+
...permitted === void 0 ? {} : { permitted },
|
|
361
|
+
...canIn === void 0 ? {} : { canIn },
|
|
362
|
+
...subject === void 0 ? {} : { subject },
|
|
363
|
+
...subjectForTenant === void 0 ? {} : { subjectForTenant },
|
|
364
|
+
...bootstrapPermissions === void 0 ? {} : { bootstrapPermissions },
|
|
365
|
+
...approverFor === void 0 ? {} : { approverFor },
|
|
366
|
+
...managedUsers === void 0 ? {} : { managedUsers }
|
|
367
|
+
},
|
|
368
|
+
requires,
|
|
369
|
+
canAssign: listed("canAssign", tenantScope)
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* `isApprover` from `approvers` (with `approver` as its `'ai-tool'` entry) or
|
|
374
|
+
* `requestApprovers`, over `permdock_is_approver`.
|
|
375
|
+
*/
|
|
376
|
+
function isApproverOf(input, helpers, requires) {
|
|
377
|
+
const { options } = input;
|
|
378
|
+
const approver = options.approver;
|
|
379
|
+
const approvers = approver === void 0 ? options.approvers : {
|
|
380
|
+
"ai-tool": holder(approver),
|
|
381
|
+
...options.approvers
|
|
382
|
+
};
|
|
383
|
+
if (approvers === void 0 && options.requestApprovers !== true) return;
|
|
384
|
+
const built = isApproverTemplate({
|
|
385
|
+
approvers: approvers ?? {},
|
|
386
|
+
requestApprovers: options.requestApprovers === true,
|
|
387
|
+
schema: input.manifest.rls.schema,
|
|
388
|
+
listed: helpers.has(IS_APPROVER),
|
|
389
|
+
covers: /\bp_requester\b/u.test(helpers.get("permdock_is_approver")?.args ?? ""),
|
|
390
|
+
managers: helpers.has(MANAGES),
|
|
391
|
+
tenantScope: input.tenantScope,
|
|
392
|
+
rootTenant: input.rootTenant,
|
|
393
|
+
catalog: input.catalog
|
|
394
|
+
});
|
|
395
|
+
input.problems.push(...built.problems);
|
|
396
|
+
if (built.requires !== void 0) requires.push(built.requires);
|
|
397
|
+
return built.template;
|
|
398
|
+
}
|
|
399
|
+
// src/better-supabase/provider-hook.ts
|
|
400
|
+
const TEAM_IDS_TRUNCATED = "team_ids_truncated";
|
|
401
|
+
/**
|
|
402
|
+
* better-supabase's `tokenHook` from the manifest's hook and claims: the claims
|
|
403
|
+
* PermDock owns and the ones it fills from other functions, the truncation
|
|
404
|
+
* markers, the byte budget, the marker lines and the command that writes the
|
|
405
|
+
* hook's grants.
|
|
406
|
+
*/
|
|
407
|
+
function tokenHookOf(manifest, activeTenant) {
|
|
408
|
+
const owned = manifest.claims.filter((claim) => claim.source === "permdock");
|
|
409
|
+
const registered = manifest.claims.filter((claim) => claim.source !== "permdock");
|
|
410
|
+
const budgeted = manifest.claims.filter((claim) => claim.budget);
|
|
411
|
+
const truncated = owned.some((claim) => claim.name === "memberships_truncated") ? "memberships_truncated" : void 0;
|
|
412
|
+
const teamsTruncated = owned.some((claim) => claim.name === TEAM_IDS_TRUNCATED);
|
|
413
|
+
const activeFrom = activeTenant === "resolver" || manifest.hook.activeFrom === void 0 ? void 0 : activeOrganizationFrom(manifest.hook.activeFrom, manifest.tenantClaim);
|
|
414
|
+
return {
|
|
415
|
+
function: `${manifest.hook.schema}.${manifest.hook.function}`,
|
|
416
|
+
tenantClaim: manifest.tenantClaim,
|
|
417
|
+
...activeFrom === void 0 ? {} : { activeOrganizationFrom: activeFrom },
|
|
418
|
+
ownedClaims: owned.map((claim) => claim.name),
|
|
419
|
+
...truncated === void 0 ? {} : { truncatedClaim: truncated },
|
|
420
|
+
...teamsTruncated ? { teamIdsTruncatedClaim: TEAM_IDS_TRUNCATED } : {},
|
|
421
|
+
...registered.length > 0 ? { registeredClaims: registered.map((claim) => ({
|
|
422
|
+
name: claim.name,
|
|
423
|
+
function: claim.source
|
|
424
|
+
})) } : {},
|
|
425
|
+
budget: {
|
|
426
|
+
claims: budgeted.map((claim) => claim.name),
|
|
427
|
+
bytes: manifest.budget.bytes,
|
|
428
|
+
...truncated === void 0 ? {} : { truncatedClaim: truncated }
|
|
429
|
+
},
|
|
430
|
+
markers: {
|
|
431
|
+
hook: `-- permdock:hook ${manifest.markers.hook}`,
|
|
432
|
+
grants: `-- permdock:grants ${manifest.markers.grants}`
|
|
433
|
+
},
|
|
434
|
+
grantsCommand: grantsCommandOf(manifest.hook.schemas ?? "pg-delta")
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
/** The command better-supabase doctor prints when the hook lacks its grants. */
|
|
438
|
+
function grantsCommandOf(schemas) {
|
|
439
|
+
switch (schemas) {
|
|
440
|
+
case "pg-delta": return "permdock supabase hook generate && supabase db schema declarative sync -f permdock_hook";
|
|
441
|
+
case "migra": return "permdock supabase hook generate --grants-out supabase/migrations/<timestamp>_permdock_hook_grants.sql";
|
|
442
|
+
case "migrations": return "permdock supabase hook generate --out supabase/migrations/<timestamp>_permdock_hook.sql";
|
|
443
|
+
default: return schemas;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
// src/better-supabase/provider-personas.ts
|
|
447
|
+
function personaName(key) {
|
|
448
|
+
const name = key.toLowerCase().replaceAll(/[^a-z0-9_]/gu, "_");
|
|
449
|
+
if (name === "" || name.startsWith("_") || !/^[a-z]/u.test(name)) return `role_${name}`;
|
|
450
|
+
return name;
|
|
451
|
+
}
|
|
452
|
+
function insertSql(table, values) {
|
|
453
|
+
return `insert into ${table} (${values.map((value) => sqlIdent(value.column)).join(", ")}) values (${values.map((value) => value.sql).join(", ")})`;
|
|
454
|
+
}
|
|
455
|
+
function isRoleList$1(role) {
|
|
456
|
+
return Array.isArray(role);
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* How `role` puts `key` on a row: the column value (a literal, the id of the
|
|
460
|
+
* roles row that holds the key, or the stored value a map turns into it), the
|
|
461
|
+
* second insert into a role set keyed by several columns, or nothing for fixed
|
|
462
|
+
* roles that already include it. `undefined` when the source cannot hold
|
|
463
|
+
* `key`.
|
|
464
|
+
*/
|
|
465
|
+
function roleValue(role, key, customRoleTenant) {
|
|
466
|
+
const literal = quoteSqlLiteral(key);
|
|
467
|
+
if ("value" in role) return (typeof role.value === "string" ? [role.value] : role.value).includes(key) ? { kind: "fixed" } : void 0;
|
|
468
|
+
if ("map" in role) {
|
|
469
|
+
const stored = Object.entries(role.map).find(([, mapped]) => mapped === key);
|
|
470
|
+
return stored === void 0 ? void 0 : {
|
|
471
|
+
kind: "column",
|
|
472
|
+
value: {
|
|
473
|
+
column: role.column,
|
|
474
|
+
sql: quoteSqlLiteral(stored[0])
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
if (!("through" in role)) return {
|
|
479
|
+
kind: "column",
|
|
480
|
+
value: {
|
|
481
|
+
column: role.column,
|
|
482
|
+
sql: literal
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
const { through } = role;
|
|
486
|
+
if (through.on !== void 0) return {
|
|
487
|
+
kind: "set",
|
|
488
|
+
table: through.table,
|
|
489
|
+
on: through.on,
|
|
490
|
+
column: through.column
|
|
491
|
+
};
|
|
492
|
+
const declared = customRoleTenant === void 0 ? "" : ` and r.${sqlIdent(customRoleTenant)} is null`;
|
|
493
|
+
return {
|
|
494
|
+
kind: "column",
|
|
495
|
+
value: {
|
|
496
|
+
column: role.column,
|
|
497
|
+
sql: `(select r.${sqlIdent(through.id)} from ${through.table} r where r.${sqlIdent(through.column)} = ${literal}${declared})`
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
function firstRole(role, key, customRoleTenant) {
|
|
502
|
+
const roles = isRoleList$1(role) ? role : [role];
|
|
503
|
+
for (const entry of roles) {
|
|
504
|
+
const value = roleValue(entry, key, customRoleTenant);
|
|
505
|
+
if (value !== void 0) return value;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
/** A member of `{tenant}` holding `role` through the tenant-scope source. */
|
|
509
|
+
function memberSetup(source, role, tenantScope, customRoleTenant) {
|
|
510
|
+
const label = `fixtureRoles: ${role.key} through ${source.table}`;
|
|
511
|
+
if ("through" in source.user) return { problem: `${label}: the user id is read through another table.` };
|
|
512
|
+
if (source.within !== void 0) return { problem: `${label}: the rows need the tenant's parent ids.` };
|
|
513
|
+
const held = firstRole(source.role, role.key, customRoleTenant);
|
|
514
|
+
if (held === void 0) return { problem: `${label}: no role column can hold the role.` };
|
|
515
|
+
const values = [{
|
|
516
|
+
column: source.user.column,
|
|
517
|
+
sql: "{user}"
|
|
518
|
+
}, {
|
|
519
|
+
column: source.id.column,
|
|
520
|
+
sql: "{tenant}"
|
|
521
|
+
}];
|
|
522
|
+
if ("column" in source.scope) values.push({
|
|
523
|
+
column: source.scope.column,
|
|
524
|
+
sql: quoteSqlLiteral(tenantScope)
|
|
525
|
+
});
|
|
526
|
+
const kind = role.for?.[0];
|
|
527
|
+
if (source.via !== void 0 && "column" in source.via && kind !== void 0) values.push({
|
|
528
|
+
column: source.via.column,
|
|
529
|
+
sql: quoteSqlLiteral(kind)
|
|
530
|
+
});
|
|
531
|
+
if (held.kind === "column") values.push(held.value);
|
|
532
|
+
const clash = values.find((value, index) => values.some((other, at) => at < index && other.column === value.column && other.sql !== value.sql));
|
|
533
|
+
if (clash !== void 0) return { problem: `${label}: ${clash.column} would hold two values.` };
|
|
534
|
+
const member = insertSql(source.table, values.filter((value, index) => values.findIndex((other) => other.column === value.column) === index));
|
|
535
|
+
if (held.kind !== "set") return { sql: member };
|
|
536
|
+
const filled = values.map((value) => [value.column, value.sql]);
|
|
537
|
+
const set = [];
|
|
538
|
+
for (const [referencing, column] of Object.entries(held.on)) {
|
|
539
|
+
const sql = filled.find(([name]) => name === referencing)?.[1];
|
|
540
|
+
if (sql === void 0) return { problem: `${label}: ${held.table} matches on ${referencing}.` };
|
|
541
|
+
set.push({
|
|
542
|
+
column,
|
|
543
|
+
sql
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
set.push({
|
|
547
|
+
column: held.column,
|
|
548
|
+
sql: quoteSqlLiteral(role.key)
|
|
549
|
+
});
|
|
550
|
+
return { sql: `${member}; ${insertSql(held.table, set)}` };
|
|
551
|
+
}
|
|
552
|
+
/** A user holding the global `role` in `rls.roles`. */
|
|
553
|
+
function globalSetup(manifest, role) {
|
|
554
|
+
const roles = manifest.rls.roles;
|
|
555
|
+
const label = `fixtureRoles: global role ${role.key}`;
|
|
556
|
+
if (roles === void 0) return { problem: `${label}: the manifest has no rls.roles table.` };
|
|
557
|
+
const held = firstRole(roles.role, role.key, void 0);
|
|
558
|
+
if (held === void 0 || held.kind === "set") return { problem: `${label}: ${roles.table} cannot hold the role.` };
|
|
559
|
+
return { sql: insertSql(roles.table, [{
|
|
560
|
+
column: roles.user.column,
|
|
561
|
+
sql: "{user}"
|
|
562
|
+
}, ...held.kind === "column" ? [held.value] : []]) };
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* The keys a holder of `role` reaches at the tenant scope, as `idsWith` answers
|
|
566
|
+
* them: its allows there without a row condition, minus its denies there
|
|
567
|
+
* without one. A global role holds none.
|
|
568
|
+
*/
|
|
569
|
+
function heldKeys(catalog, role, tenantScope) {
|
|
570
|
+
const grants = (catalog.grants ?? []).filter((grant) => grant.role === role && grant.scope === tenantScope && grant.where === void 0 && grant.check === void 0);
|
|
571
|
+
const denied = new Set(grants.filter((grant) => grant.effect === "deny").map((grant) => grant.permission));
|
|
572
|
+
return [...new Set(grants.filter((grant) => grant.effect === "allow" && !denied.has(grant.permission)).map((grant) => grant.permission))].toSorted();
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* better-supabase's `fixtureRoles` for `personas: 'roles'`: one entry per role
|
|
576
|
+
* the manifest's `fixtureRoles` names, or without that field per catalog role
|
|
577
|
+
* at the tenant scope and global role. A tenant role's `setup` inserts a member
|
|
578
|
+
* of `{tenant}` into the first `rls.memberships` table of the tenant scope,
|
|
579
|
+
* with the role's id when the table reads it through a roles table; a global
|
|
580
|
+
* role goes into `rls.roles`. A role it can write no setup for is left out and
|
|
581
|
+
* named in `problems`.
|
|
582
|
+
*/
|
|
583
|
+
function fixtureRolesOf(manifest, catalog, tenantScope, problems) {
|
|
584
|
+
const source = manifest.rls.memberships.find((entry) => !("value" in entry.scope) || entry.scope.value === tenantScope);
|
|
585
|
+
const catalogRoles = catalog.roles ?? [];
|
|
586
|
+
const keys = manifest.fixtureRoles ?? catalogRoles.filter((role) => role.on === tenantScope || role.on === void 0).map((role) => role.key);
|
|
587
|
+
const roles = [];
|
|
588
|
+
for (const key of keys) {
|
|
589
|
+
const role = catalogRoles.find((entry) => entry.key === key);
|
|
590
|
+
if (role === void 0) {
|
|
591
|
+
problems.push(`fixtureRoles: the catalog has no role ${key}.`);
|
|
592
|
+
continue;
|
|
593
|
+
}
|
|
594
|
+
if (role.on !== void 0 && role.on !== tenantScope) {
|
|
595
|
+
problems.push(`fixtureRoles: ${key} is a ${role.on} role, not one of the tenant scope ${tenantScope}.`);
|
|
596
|
+
continue;
|
|
597
|
+
}
|
|
598
|
+
const setup = role.on === void 0 ? globalSetup(manifest, role) : source === void 0 ? { problem: `fixtureRoles: no rls.memberships table holds ${tenantScope} members.` } : memberSetup(source, role, tenantScope, manifest.rls.customRoleTenant);
|
|
599
|
+
if ("problem" in setup) {
|
|
600
|
+
problems.push(setup.problem);
|
|
601
|
+
continue;
|
|
602
|
+
}
|
|
603
|
+
roles.push({
|
|
604
|
+
name: personaName(key),
|
|
605
|
+
setup: setup.sql,
|
|
606
|
+
permissions: heldKeys(catalog, key, tenantScope)
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
return roles;
|
|
610
|
+
}
|
|
611
|
+
// src/better-supabase/provider.ts
|
|
612
|
+
/**
|
|
613
|
+
* Postgres aliases of the id types better-supabase reads (`uuid`, `text`,
|
|
614
|
+
* `bigint`, `integer`), matching its `moduleIdType` from `better-supabase/sql`,
|
|
615
|
+
* which this runtime entry does not import.
|
|
616
|
+
*/
|
|
617
|
+
const ID_TYPES = {
|
|
618
|
+
uuid: "uuid",
|
|
619
|
+
text: "text",
|
|
620
|
+
varchar: "text",
|
|
621
|
+
"character varying": "text",
|
|
622
|
+
bigint: "bigint",
|
|
623
|
+
int8: "bigint",
|
|
624
|
+
integer: "integer",
|
|
625
|
+
int: "integer",
|
|
626
|
+
int4: "integer"
|
|
627
|
+
};
|
|
628
|
+
function tenantScopeOf(manifest, explicit) {
|
|
629
|
+
const names = manifest.rls.scopes.map((scope) => scope.name);
|
|
630
|
+
if (explicit !== void 0) {
|
|
631
|
+
if (!names.includes(explicit)) throw new TypeError(`PermDock: scope "${explicit}" is not in the manifest's rls.scopes (${names.join(", ")}).`);
|
|
632
|
+
return explicit;
|
|
633
|
+
}
|
|
634
|
+
const roots = manifest.rls.scopes.filter((scope) => scope.within === void 0);
|
|
635
|
+
const [root] = roots;
|
|
636
|
+
if (root === void 0 || roots.length > 1) {
|
|
637
|
+
const listed = roots.map((scope) => scope.name).join(", ");
|
|
638
|
+
throw new TypeError(`PermDock: the manifest has ${roots.length} root scopes (${listed === "" ? "none" : listed}), so it can't tell which scope tenants are. Pass { scope } with one of ${names.join(", ")}.`);
|
|
639
|
+
}
|
|
640
|
+
return root.name;
|
|
641
|
+
}
|
|
642
|
+
function covers(membership, scope) {
|
|
643
|
+
return !("value" in membership.scope) || membership.scope.value === scope;
|
|
644
|
+
}
|
|
645
|
+
/** `source` as better-supabase reads it, for a source that covers `scope`. */
|
|
646
|
+
function membershipOf(source, scope, problems) {
|
|
647
|
+
if ("through" in source.user) {
|
|
648
|
+
problems.push(`${source.table} reads its user id through ${source.user.through.table}, which better-supabase's membership reads don't follow.`);
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
return {
|
|
652
|
+
table: source.table,
|
|
653
|
+
userColumn: source.user.column,
|
|
654
|
+
scope: "column" in source.scope ? { column: source.scope.column } : { value: scope },
|
|
655
|
+
idColumn: source.id.column,
|
|
656
|
+
...source.disabledAt === void 0 ? {} : { disabledAt: source.disabledAt.column },
|
|
657
|
+
...rolesTableOf(source)
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* The role set a member's roles come from, one row per scope id, user and role:
|
|
662
|
+
* a role read through a reference over several columns.
|
|
663
|
+
*/
|
|
664
|
+
function rolesTableOf(source) {
|
|
665
|
+
const roles = isRoleList(source.role) ? source.role : [source.role];
|
|
666
|
+
for (const role of roles) if ("through" in role && role.through.on !== void 0) return { rolesTable: role.through.table };
|
|
667
|
+
return {};
|
|
668
|
+
}
|
|
669
|
+
function isRoleList(role) {
|
|
670
|
+
return Array.isArray(role);
|
|
671
|
+
}
|
|
672
|
+
function scopeValue(source) {
|
|
673
|
+
if (!("value" in source.scope)) return;
|
|
674
|
+
return typeof source.scope.value === "string" ? source.scope.value : void 0;
|
|
675
|
+
}
|
|
676
|
+
function scopeRoleKeys(catalog, scope) {
|
|
677
|
+
return (catalog?.roles ?? []).filter((role) => scope === void 0 ? typeof role.on === "string" : role.on === scope).map((role) => role.key).toSorted();
|
|
678
|
+
}
|
|
679
|
+
function roleWhere(column, keys, tenant) {
|
|
680
|
+
const parts = [];
|
|
681
|
+
if (keys.length > 0) {
|
|
682
|
+
const listed = keys.map((key) => quoteSqlLiteral(key)).join(", ");
|
|
683
|
+
parts.push(`{row}.${sqlIdent(column)} in (${listed})`);
|
|
684
|
+
}
|
|
685
|
+
if (tenant !== void 0 && tenant !== "") parts.push(`{row}.${sqlIdent(tenant)} is not null`);
|
|
686
|
+
return parts.length === 0 ? void 0 : parts.join(" or ");
|
|
687
|
+
}
|
|
688
|
+
function roleSourceOf(source, catalog, tenant) {
|
|
689
|
+
const role = source.role;
|
|
690
|
+
if (Array.isArray(role) || !("column" in role) || !("through" in role) || role.through.on !== void 0) return;
|
|
691
|
+
const where = roleWhere(role.through.column, scopeRoleKeys(catalog, scopeValue(source)), tenant);
|
|
692
|
+
return {
|
|
693
|
+
table: source.table,
|
|
694
|
+
role: {
|
|
695
|
+
column: role.column,
|
|
696
|
+
through: {
|
|
697
|
+
table: role.through.table,
|
|
698
|
+
id: role.through.id,
|
|
699
|
+
column: role.through.column,
|
|
700
|
+
...where === void 0 ? {} : { where }
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
function disabledRow(row) {
|
|
706
|
+
return {
|
|
707
|
+
table: row.table,
|
|
708
|
+
id: row.id,
|
|
709
|
+
...row.disabledAt === void 0 ? {} : { disabledAt: row.disabledAt },
|
|
710
|
+
...row.status === void 0 || row.active === void 0 ? {} : {
|
|
711
|
+
status: row.status,
|
|
712
|
+
active: row.active
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* `rls.roles` as better-supabase's `platformRoles`: the global-roles table with
|
|
718
|
+
* its roles table, and the assignment helpers that answer without a tenant.
|
|
719
|
+
*/
|
|
720
|
+
function platformRolesOf(manifest, schema, scope, assignAny) {
|
|
721
|
+
const roles = manifest.rls.roles;
|
|
722
|
+
if (roles === void 0 || isRoleList(roles.role) || !("column" in roles.role)) return;
|
|
723
|
+
const through = "through" in roles.role ? roles.role.through : void 0;
|
|
724
|
+
const literal = quoteSqlLiteral(scope);
|
|
725
|
+
return {
|
|
726
|
+
table: roles.table,
|
|
727
|
+
user: roles.user.column,
|
|
728
|
+
role: roles.role.column,
|
|
729
|
+
...through === void 0 || through.on !== void 0 ? {} : { through: {
|
|
730
|
+
table: through.table,
|
|
731
|
+
id: through.id,
|
|
732
|
+
column: through.column
|
|
733
|
+
} },
|
|
734
|
+
...assignAny ? {
|
|
735
|
+
canAssign: `${schema}.${ASSIGN_ANY.canAssign.helper}({role}, null::uuid, ${literal}, null::text)`,
|
|
736
|
+
canAssignFor: `${schema}.${ASSIGN_ANY.canAssignFor.helper}({user}, {role}, null::uuid, ${literal}, null::text)`
|
|
737
|
+
} : {}
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
function permissionsOf(catalog, scopes) {
|
|
741
|
+
return catalog.permissions.map((permission) => {
|
|
742
|
+
const granted = /* @__PURE__ */ new Set();
|
|
743
|
+
for (const grant of catalog.grants ?? []) if (grant.permission === permission.key && typeof grant.scope === "string" && scopes.has(grant.scope)) granted.add(grant.scope);
|
|
744
|
+
return {
|
|
745
|
+
key: permission.key,
|
|
746
|
+
sqlComplete: !permission.rowConditions,
|
|
747
|
+
...granted.size > 0 ? { scopes: [...granted].toSorted() } : {},
|
|
748
|
+
...permission.levels === void 0 || permission.levels.length === 0 ? {} : { levels: permission.levels }
|
|
749
|
+
};
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
const RISKS = {
|
|
753
|
+
low: "low",
|
|
754
|
+
medium: "medium",
|
|
755
|
+
high: "high",
|
|
756
|
+
critical: "high"
|
|
757
|
+
};
|
|
758
|
+
const EFFECTS = {
|
|
759
|
+
read: "read",
|
|
760
|
+
write: "write",
|
|
761
|
+
delete: "delete",
|
|
762
|
+
send: "external",
|
|
763
|
+
spend: "external",
|
|
764
|
+
external: "external"
|
|
765
|
+
};
|
|
766
|
+
/**
|
|
767
|
+
* The catalog's `defineOperations` entries as better-supabase operations. A
|
|
768
|
+
* name with a `.` is used as written (`workflow.node.http`); any other is the
|
|
769
|
+
* tool `ai.tool.<name>` and `mcp.tool.<name>`. `critical` risk is `high`, and
|
|
770
|
+
* `send` and `spend` effects are `external`.
|
|
771
|
+
*/
|
|
772
|
+
function operationsOf(catalog) {
|
|
773
|
+
const operations = {};
|
|
774
|
+
for (const operation of catalog.operations ?? []) {
|
|
775
|
+
const effects = [...new Set((operation.meta.effects ?? []).map((effect) => EFFECTS[effect]))];
|
|
776
|
+
const meta = {
|
|
777
|
+
...operation.meta.risk === void 0 ? {} : { risk: RISKS[operation.meta.risk] },
|
|
778
|
+
...effects.length > 0 ? { effects } : {},
|
|
779
|
+
...operation.meta.title === void 0 ? {} : { title: operation.meta.title }
|
|
780
|
+
};
|
|
781
|
+
const entry = {
|
|
782
|
+
permission: operation.permission,
|
|
783
|
+
...Object.keys(meta).length > 0 ? { meta } : {}
|
|
784
|
+
};
|
|
785
|
+
const names = operation.name.includes(".") ? [operation.name] : [`ai.tool.${operation.name}`, `mcp.tool.${operation.name}`];
|
|
786
|
+
for (const name of names) operations[name] = entry;
|
|
787
|
+
}
|
|
788
|
+
return operations;
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* better-supabase's `delegation.scopes`, the same map `rls.tokenScopes`
|
|
792
|
+
* compiles.
|
|
793
|
+
*/
|
|
794
|
+
function delegatedScopes(catalog) {
|
|
795
|
+
return delegatedScopeMap(catalog?.permissions ?? [], catalog?.oauthScopes);
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* better-supabase's `authorization` config value, built from PermDock's
|
|
799
|
+
* manifest and catalog: the scopes, the `rls generate` helpers as SQL templates
|
|
800
|
+
* (`providerFunctions`), the membership tables, suspension rows, the token hook
|
|
801
|
+
* and every catalog key with `sqlComplete` set from its `rowConditions` and
|
|
802
|
+
* `levels` from the catalog. `isApprover` is set with `approvers` or `approver`
|
|
803
|
+
* and `permdock_is_approver`: `approver` fills its `'ai-tool'` entry.
|
|
804
|
+
* `canApprove` is never set. `personas: 'roles'` is sent as written, with the
|
|
805
|
+
* `fixtureRoles` the manifest names. Throws when the manifest or catalog is
|
|
806
|
+
* invalid, or when the tenant scope is ambiguous.
|
|
807
|
+
*/
|
|
808
|
+
function authorizationProvider(options) {
|
|
809
|
+
const manifest = parseSupabaseManifest(options.manifest);
|
|
810
|
+
const catalog = options.catalog === void 0 ? void 0 : parseCatalog(options.catalog);
|
|
811
|
+
const rls = manifest.rls;
|
|
812
|
+
const problems = [];
|
|
813
|
+
if (catalog === void 0) problems.push("No catalog: better-supabase cannot check that the permission keys its SQL modules use (ai_chat, workflow, inbox and the rest) exist. Pass `catalog`.");
|
|
814
|
+
if (options.personas === "roles" && catalog === void 0) problems.push("personas: 'roles' needs a catalog of the policy's roles. Pass `catalog`.");
|
|
815
|
+
const activeFrom = hasTokenHook(manifest) ? manifest.hook.activeFrom : void 0;
|
|
816
|
+
if (options.activeTenant !== void 0 && activeFrom !== void 0) {
|
|
817
|
+
const mismatch = activeTenantMismatch(activeFrom, manifest.tenantClaim, options.activeTenant);
|
|
818
|
+
if (mismatch !== void 0) problems.push(mismatch);
|
|
819
|
+
}
|
|
820
|
+
const tenantScope = tenantScopeOf(manifest, options.scope);
|
|
821
|
+
const scopeNames = rls.scopes.map((scope) => scope.name);
|
|
822
|
+
const schema = sqlIdent(rls.schema);
|
|
823
|
+
const rootTenant = rls.scopes.find((scope) => scope.name === tenantScope)?.within === void 0;
|
|
824
|
+
const assignAny = rls.customRoles === true && rootTenant;
|
|
825
|
+
const { functions, requires, canAssign } = providerFunctions({
|
|
826
|
+
manifest,
|
|
827
|
+
catalog,
|
|
828
|
+
options,
|
|
829
|
+
tenantScope,
|
|
830
|
+
rootTenant,
|
|
831
|
+
assignAny,
|
|
832
|
+
problems
|
|
833
|
+
});
|
|
834
|
+
const memberships = [];
|
|
835
|
+
const roleSources = [];
|
|
836
|
+
for (const source of rls.memberships) {
|
|
837
|
+
if (!covers(source, tenantScope)) continue;
|
|
838
|
+
const membership = membershipOf(source, tenantScope, problems);
|
|
839
|
+
if (membership) memberships.push(membership);
|
|
840
|
+
const roleSource = roleSourceOf(source, catalog, rls.customRoleTenant);
|
|
841
|
+
if (roleSource) roleSources.push(roleSource);
|
|
842
|
+
}
|
|
843
|
+
const users = rls.suspension?.users;
|
|
844
|
+
const tenants = rls.suspension?.scopes?.[tenantScope];
|
|
845
|
+
const platformRoles = options.platformRoles === false ? void 0 : platformRolesOf(manifest, schema, tenantScope, assignAny && canAssign);
|
|
846
|
+
const operations = catalog === void 0 ? {} : operationsOf(catalog);
|
|
847
|
+
const delegated = delegatedScopes(catalog);
|
|
848
|
+
const interactiveOnly = (catalog?.permissions ?? []).filter((permission) => permission.meta["interactiveOnly"] === true).map((permission) => permission.key).toSorted();
|
|
849
|
+
const scopes = rls.scopes.map((scope) => {
|
|
850
|
+
const idType = ID_TYPES[scope.type.trim().toLowerCase().replaceAll(/\s+/gu, " ")];
|
|
851
|
+
if (idType === void 0) problems.push(`Scope "${scope.name}" has ids of type ${scope.type}; better-supabase reads uuid, text, bigint and integer ids.`);
|
|
852
|
+
return scope.within === void 0 ? {
|
|
853
|
+
name: scope.name,
|
|
854
|
+
idType: idType ?? scope.type
|
|
855
|
+
} : {
|
|
856
|
+
name: scope.name,
|
|
857
|
+
idType: idType ?? scope.type,
|
|
858
|
+
parent: scope.within
|
|
859
|
+
};
|
|
860
|
+
});
|
|
861
|
+
const fixtureRoles = options.personas === "roles" && catalog !== void 0 ? fixtureRolesOf(manifest, catalog, tenantScope, problems) : void 0;
|
|
862
|
+
const personas = options.personas === "roles" ? fixtureRoles === void 0 ? void 0 : "roles" : options.personas?.length === 0 ? void 0 : options.personas;
|
|
863
|
+
return freezeDeep({
|
|
864
|
+
apiVersion: 1,
|
|
865
|
+
name: "PermDock",
|
|
866
|
+
scopes,
|
|
867
|
+
tenantScope,
|
|
868
|
+
functions,
|
|
869
|
+
requires,
|
|
870
|
+
...catalog ? { permissions: permissionsOf(catalog, new Set(scopeNames)) } : {},
|
|
871
|
+
...memberships.length > 0 ? { memberships } : {},
|
|
872
|
+
...users || tenants ? { suspension: {
|
|
873
|
+
...users ? {
|
|
874
|
+
user: disabledRow(users),
|
|
875
|
+
userKey: users.id
|
|
876
|
+
} : {},
|
|
877
|
+
...tenants ? { tenant: disabledRow(tenants) } : {}
|
|
878
|
+
} } : {},
|
|
879
|
+
...roleSources.length > 0 ? { roleSources } : {},
|
|
880
|
+
...platformRoles === void 0 ? {} : { platformRoles },
|
|
881
|
+
...personas === void 0 ? {} : { personas },
|
|
882
|
+
...fixtureRoles === void 0 ? {} : { fixtureRoles },
|
|
883
|
+
...Object.keys(operations).length > 0 ? { operations } : {},
|
|
884
|
+
...Object.keys(delegated).length > 0 || interactiveOnly.length > 0 ? { delegation: {
|
|
885
|
+
...Object.keys(delegated).length > 0 ? { scopes: delegated } : {},
|
|
886
|
+
...interactiveOnly.length > 0 ? { interactiveOnly } : {}
|
|
887
|
+
} } : {},
|
|
888
|
+
decidingColumns: manifest.decidingColumns,
|
|
889
|
+
...hasTokenHook(manifest) ? { tokenHook: tokenHookOf(manifest, options.activeTenant) } : {},
|
|
890
|
+
...problems.length > 0 ? { problems } : {}
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
export { activeTenantMismatch as n, authorizationProvider as t };
|