permdock 0.4.0 → 0.6.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 +37 -35
- package/dist/{schema-Bol6gqXA.js → 2020-C9VN-x8c.js} +5 -130
- package/dist/a2a/index.d.ts +6 -6
- package/dist/a2a/index.js +14 -17
- package/dist/{adapter-context-mlWsVGGg.js → adapter-context-CRhqyzCk.js} +1 -1
- package/dist/adoption-scan-DCYe60Pi.js +107 -0
- package/dist/agent/index.d.ts +3 -0
- package/dist/agent/index.js +1 -0
- package/dist/ai-sdk/index.d.ts +18 -35
- package/dist/ai-sdk/index.js +37 -23
- package/dist/{app-data-CV8pqqMi.js → app-data-MuyzVqX8.js} +2 -1
- package/dist/approval-header-CJACtHkv.js +23 -0
- package/dist/approval-prompt-Dg5LeAcT.js +62 -0
- package/dist/approval-prompt-DvSSPQJX.d.ts +57 -0
- package/dist/approvals/index.d.ts +5 -3
- package/dist/approvals/index.js +8 -5
- package/dist/approvals-p1PGoVjb.js +995 -0
- package/dist/arazzo-41WuzHou.js +36 -0
- package/dist/{arazzo-C4BcskbX.js → arazzo-CaUVBn7D.js} +20 -14
- package/dist/args-IIolxxKA.js +197 -0
- package/dist/astro/index.d.ts +43 -0
- package/dist/astro/index.js +27 -0
- package/dist/audience-DabClFLQ.js +55 -0
- package/dist/auth-DRLEizbL.js +178 -0
- package/dist/authzen/index.d.ts +26 -6
- package/dist/authzen/index.js +94 -79
- package/dist/automation-BNM3TtDo.d.ts +114 -0
- package/dist/automation-DVjOckjV.js +157 -0
- package/dist/better-auth/index.d.ts +8 -6
- package/dist/better-auth/index.js +9 -8
- package/dist/better-supabase/index.d.ts +357 -30
- package/dist/better-supabase/index.js +936 -194
- package/dist/{bind-kk-uyCwH.js → bind-CAvgUuKs.js} +14 -10
- package/dist/{bind-BzqG8SMb.d.ts → bind-DOyrv6zi.d.ts} +12 -10
- package/dist/body-CH5of8Ne.js +10 -0
- package/dist/body-text-QcXok_SI.js +52 -0
- package/dist/{build-instance-DIIV9DbC.js → build-instance-Bu_eDqYw.js} +4 -3
- package/dist/{canonical-json-CFKyFOke.js → canonical-json-BC8_nMTw.js} +5 -3
- package/dist/{capability-CksyCWDH.d.ts → capability-Drg-1YhL.d.ts} +44 -25
- package/dist/{capability-txATtKV4.js → capability-N1K9IpqS.js} +68 -42
- package/dist/casbin-Cr7RLtA3.js +30 -0
- package/dist/casbin-Dyu2gnUD.js +234 -0
- package/dist/casl-64gpT-8x.js +24 -0
- package/dist/casl-DjEDhTCP.js +299 -0
- package/dist/catalog/index.d.ts +74 -2
- package/dist/catalog/index.js +51 -2
- package/dist/catalog-BoWglDPI.js +1 -0
- package/dist/catalog-DZVbrF-z.js +52 -0
- package/dist/{catalog-tZUyOfOv.js → catalog-HD2gf5mY.js} +51 -6
- package/dist/{catalog-doc-DWtg0gGR.js → catalog-doc-Cdn7-0pQ.js} +45 -23
- package/dist/catalog-fingerprint-CCP0-yQS.js +153 -0
- package/dist/chat/index.d.ts +2 -0
- package/dist/chat/index.js +224 -0
- package/dist/chat-sdk/index.d.ts +87 -0
- package/dist/chat-sdk/index.js +197 -0
- package/dist/claims-map-7oQ3ue4X.js +13 -0
- package/dist/claims-map-Ca-QX8C6.d.ts +32 -0
- package/dist/claude-agent/index.d.ts +7 -14
- package/dist/claude-agent/index.js +24 -27
- package/dist/clerk/index.d.ts +9 -8
- package/dist/clerk/index.js +9 -14
- package/dist/cli/bin.js +36 -17
- package/dist/cli/index.d.ts +19 -5
- package/dist/cli/index.js +164 -4
- package/dist/cloud/index.d.ts +102 -63
- package/dist/cloud/index.js +239 -340
- package/dist/cloud-ytQ3uviA.js +87 -0
- package/dist/codemod-5mpSpnUY.js +37 -0
- package/dist/codemod-ua2hHy7w.js +2084 -0
- package/dist/collect-Ci6akVwH.js +55 -0
- package/dist/collect-D7eQDffE.js +1 -0
- package/dist/{collect-2SrB7lfk.js → collect-mLTY4nwb.js} +75 -11
- package/dist/command-L8EstFNm.js +6 -0
- package/dist/compile/index.d.ts +1 -1
- package/dist/compile/index.js +1 -2
- package/dist/{compile-CtTP7eur.d.ts → compile-1bsAezL0.d.ts} +5 -3
- package/dist/{compile-CcEu2ZQ1.js → compile-CMqMx_IN.js} +11 -8
- package/dist/completion-BTFrHZhX.js +143 -0
- package/dist/config-Bj2Ixq3d.js +26 -0
- package/dist/{config-BIjREpyE.js → config-bs_kZeYq.js} +12 -7
- package/dist/{config-report--Xb9APJS.js → config-report-DSpsLpCE.js} +15 -5
- package/dist/{connection-DUsczpB5.js → connection-DjhIJSs2.js} +6 -5
- package/dist/{context-DieZVJXu.js → context-B_u3_bDJ.js} +2 -2
- package/dist/convex/index.d.ts +11 -10
- package/dist/convex/index.js +6 -4
- package/dist/create-B30OMUOJ.d.ts +107 -0
- package/dist/create-CBMmFie-.d.ts +138 -0
- package/dist/create-CGm28gyI.js +130 -0
- package/dist/create-CQWIpUG-.js +403 -0
- package/dist/{create-BBO24vj6.js → create-DCF2SvoT.js} +31 -32
- package/dist/create-D_NmPOdH.d.ts +110 -0
- package/dist/{credential-kue0qpbm.js → credential-BcoiejpY.js} +152 -31
- package/dist/credentials-DPyHmYz5.js +74 -0
- package/dist/delegation-j6-rc37o.js +286 -0
- package/dist/delivery/index.d.ts +5 -0
- package/dist/delivery/index.js +5 -0
- package/dist/delivery-DCAgNyCn.js +499 -0
- package/dist/delivery-event-xX4obB8F.js +40 -0
- package/dist/{denied-text-DfRk15uw.d.ts → denied-text-CiFQNuMV.d.ts} +5 -5
- package/dist/{describe-C3ldA9os.d.ts → describe-B5qgDvEW.d.ts} +2 -2
- package/dist/{describe-Cgkp7eP0.js → describe-BybMRY7A.js} +6 -2
- package/dist/device-BARQ8eYG.js +193 -0
- package/dist/{diff-rpqoe7Ag.js → diff-3jbx6Rm4.js} +60 -54
- package/dist/diff-CmuSD3vc.js +37 -0
- package/dist/doctor-3ZqNHX_G.js +44 -0
- package/dist/{doctor-owlv6ddh.js → doctor-BdZw53-k.js} +245 -50
- package/dist/drizzle/index.d.ts +5 -3
- package/dist/drizzle/index.js +2 -2
- package/dist/elysia/index.d.ts +16 -13
- package/dist/elysia/index.js +13 -12
- package/dist/env-DJZrPjRi.js +8 -0
- package/dist/errors-BDUwg2qC.js +27 -0
- package/dist/{errors-drnfxYtm.js → errors-BKy0EfhN.js} +5 -9
- package/dist/errors-BWXBMaKK.d.ts +11 -0
- package/dist/errors-CWTY6uih.js +143 -0
- package/dist/{errors-OD_4c__H.d.ts → errors-DH5QEGXh.d.ts} +2 -2
- package/dist/evaluate-CNClBvcj.js +1785 -0
- package/dist/evaluations-C_1vdSZc.d.ts +32 -0
- package/dist/{evaluations-C9YJsv3H.js → evaluations-beAooV0n.js} +145 -34
- package/dist/eve/index.d.ts +12 -16
- package/dist/eve/index.js +22 -28
- package/dist/event-time-CsegxXxB.js +23 -0
- package/dist/expiry-D4_YKRKD.js +52 -0
- package/dist/express/index.d.ts +13 -10
- package/dist/express/index.js +12 -11
- package/dist/fastify/index.d.ts +25 -22
- package/dist/fastify/index.js +13 -12
- package/dist/fetch-adapter-DD_gfmrC.js +120 -0
- package/dist/fetch-adapter-Dw0MTS3D.d.ts +31 -0
- package/dist/fields-OYG_JR78.js +203 -0
- package/dist/files-C5ZI27eV.js +124 -0
- package/dist/{fixtures-h2eG2OZV.js → fixtures-B7XrLeY7.js} +8 -7
- package/dist/flags-C3DktBDY.js +86 -0
- package/dist/{from-snapshot-7REQZe0H.js → from-snapshot-CTCMsFZk.js} +55 -52
- package/dist/{grantee-conditions-MQs5NIuX.js → grantee-conditions-CcXf8hMM.js} +4 -3
- package/dist/{grantee-CXY-0C87.js → grantee-hxrUsbpM.js} +16 -6
- package/dist/{grantee-match-fxYp9Nmt.js → grantee-match-DbENBHLB.js} +5 -4
- package/dist/h3/index.d.ts +37 -0
- package/dist/h3/index.js +35 -0
- package/dist/headers-BIjfMaoC.js +8 -0
- package/dist/headers-CIbDTUTK.d.ts +7 -0
- package/dist/{helpers-C9YmyBIa.js → helpers-CBYVMjwh.js} +45 -38
- package/dist/hono/index.d.ts +12 -9
- package/dist/hono/index.js +13 -12
- package/dist/hosted-B46-5LYE.js +315 -0
- package/dist/hosted-BPk51-kX.d.ts +78 -0
- package/dist/{http-DPuDaChb.d.ts → http-B_LphE5Y.d.ts} +1 -2
- package/dist/http-DXJ37RDA.js +46 -0
- package/dist/{http-BEbdMZ05.js → http-ujKm0JXE.js} +1 -2
- package/dist/{import-UHk1N7vH.js → import-CNV7I2Dw.js} +25 -20
- package/dist/{import-BFIlhetD.js → import-wyqXUyjm.js} +190 -53
- package/dist/index-B8YjkEZ4.d.ts +210 -0
- package/dist/index-C-6Letxg.d.ts +431 -0
- package/dist/index-CaxrMD1A.d.ts +1 -0
- package/dist/{index-BwMe94Xq.d.ts → index-Ch8LpNDp.d.ts} +34 -16
- package/dist/index-Cp_ilKi1.d.ts +91 -0
- package/dist/index-CueFnxQc.d.ts +110 -0
- package/dist/index-DuWxc5dt.d.ts +909 -0
- package/dist/index.d.ts +19 -15
- package/dist/index.js +31 -21
- package/dist/init-DeMYsnYJ.js +96 -0
- package/dist/init-GG6Jh8HD.js +95 -0
- package/dist/{instance-options-plkrsAog.d.ts → instance-options-BsVpyGIk.d.ts} +2 -2
- package/dist/instance-snapshot-BOEhcqIF.js +601 -0
- package/dist/instant-BluqDvyS.js +19 -0
- package/dist/internals-Dk8A8fX3.js +17 -0
- package/dist/{json-schema-DBkdUuCO.js → json-schema-B-vAwlde.js} +45 -6
- package/dist/json-schema-CN_iLFH2.d.ts +40 -0
- package/dist/jwt/index.d.ts +18 -11
- package/dist/jwt/index.js +156 -135
- package/dist/{kernel-CB3LrIJM.js → kernel-D0NVb1cK.js} +52 -24
- package/dist/kysely/index.d.ts +5 -3
- package/dist/kysely/index.js +2 -2
- package/dist/load-BxEtwlBS.js +1 -0
- package/dist/{load-C3_oTHyO.js → load-DFS_ry0W.js} +22 -6
- package/dist/{load-jose-BL6LH4bL.js → load-jose-DZ4dnjri.js} +1 -4
- package/dist/login-Dfe5RlYk.js +68 -0
- package/dist/login-imhuwvn3.js +254 -0
- package/dist/manifest-C8IzW3Do.js +42 -0
- package/dist/manifest-dvL2XEe1.js +370 -0
- package/dist/manifest-json-CAGzls-C.js +9 -0
- package/dist/{manifest-uDS9y5de.d.ts → manifest-mx5ghSFM.d.ts} +9 -2
- package/dist/manifest-schema-C0kK_8V0.js +399 -0
- package/dist/{map-claims-AVlBaJoa.js → map-claims-D3oRmTk0.js} +13 -10
- package/dist/{map-error-BE27PYkE.js → map-error-Dr70oA_3.js} +3 -3
- package/dist/{markers-CiwAOZtO.js → markers-C6joDI3o.js} +2 -1
- package/dist/mcp/index.d.ts +22 -12
- package/dist/mcp/index.js +57 -39
- package/dist/{migrate-BwlB5-Wk.js → migrate-CIq4-E9F.js} +53 -14
- package/dist/nest/index.d.ts +12 -9
- package/dist/nest/index.js +15 -14
- package/dist/next/index.d.ts +18 -21
- package/dist/next/index.js +13 -11
- package/dist/next/plugin.d.ts +1 -1
- package/dist/next/plugin.js +2 -2
- package/dist/node/index.d.ts +10 -10
- package/dist/node/index.js +7 -9
- package/dist/{ocsf-uYFXGVw2.js → ocsf-BFp-PZZA.js} +22 -11
- package/dist/openai/index.d.ts +9 -16
- package/dist/openai/index.js +17 -24
- package/dist/openapi/index.d.ts +3 -3
- package/dist/openapi/index.js +1 -1
- package/dist/{openapi-DBzHQbov.js → openapi-B7HZ0f-r.js} +8 -8
- package/dist/openapi-C4dDTVEd.js +138 -0
- package/dist/{openapi-BJdBmYDG.js → openapi-DD1SV-5-.js} +10 -9
- package/dist/operation-findings-DgATDpvh.js +36 -0
- package/dist/operations-X0VM7F3m.d.ts +59 -0
- package/dist/orpc/index.d.ts +13 -10
- package/dist/orpc/index.js +20 -15
- package/dist/otel/index.d.ts +3 -2
- package/dist/otel/index.js +30 -7
- package/dist/output-1im__-08.js +88 -0
- package/dist/output-files-B3IZJksC.js +1 -0
- package/dist/{output-files-CgIsvdSa.js → output-files-DhRBBE4n.js} +24 -26
- package/dist/{permission-keys-B26jeyUv.js → ownership-DqaJNJPn.js} +1045 -153
- package/dist/{package-root-DtNnpmUd.js → package-root-Dk_ETdkp.js} +1 -1
- package/dist/{parse-CVFQHk6c.js → parse-Cxq0WxrA.js} +2 -2
- package/dist/{parse-local-manifest-DvYUR0QL.d.ts → parse-local-manifest-5ODwqu8b.d.ts} +1 -1
- package/dist/{parse-local-manifest-C-q02Pal.js → parse-local-manifest-CVSs6J9I.js} +1 -1
- package/dist/parse-request-D_tUXG6M.js +26 -0
- package/dist/paths-DXSHAMIa.js +42 -0
- package/dist/pdp/index.d.ts +7 -3
- package/dist/pdp/index.js +45 -26
- package/dist/{peer-BOr_kJE1.js → peer-C8swJ2GH.js} +23 -4
- package/dist/peer-CRvC7Hg1.js +1 -0
- package/dist/permdock-BrAscV28.js +868 -0
- package/dist/permdock-SV8ZINYT.d.ts +502 -0
- package/dist/{permission-registry-BsblpB-z.js → permission-registry-Br4jSNVi.js} +3 -3
- package/dist/permissions-B-wCP5ZC.js +30 -0
- package/dist/{permissions-CCJ6lmxB.js → permissions-BPxlwVhN.js} +4 -3
- package/dist/{permissions-COH-KRgT.d.ts → permissions-u_KHg-sN.d.ts} +1 -2
- package/dist/policies-DP2nqRoF.js +295 -0
- package/dist/{policy-ur0BBK_e.d.ts → policy-77FSAq_V.d.ts} +2 -2
- package/dist/{hosted-CBHgkzDl.js → policy-DbM5YYtV.js} +17 -273
- package/dist/policy-from-catalog-C2gMa2Dj.js +450 -0
- package/dist/policy-module-CTlwMvLI.js +89 -0
- package/dist/{policy-types-sp9P1iIV.d.ts → policy-types-n0uRTsW8.d.ts} +460 -632
- package/dist/postgrest-CEgRbefE.d.ts +100 -0
- package/dist/postgrest-DAjUkF9w.js +575 -0
- package/dist/{powersync-cZe4kzhL.js → powersync-BkWWCS1K.js} +23 -24
- package/dist/powersync-DISt6SUe.js +62 -0
- package/dist/powersync-MMJ2mI2q.js +1 -0
- package/dist/preset/index.d.ts +146 -0
- package/dist/preset/index.js +1 -0
- package/dist/preset-DZdU0tne.js +1768 -0
- package/dist/principal-source-pHneukrx.js +103 -0
- package/dist/prisma/index.d.ts +6 -3
- package/dist/prisma/index.js +2 -2
- package/dist/{problem-CnWraVhC.js → problem-CTviyH5L.js} +13 -23
- package/dist/{problem-details-rIIo8B2C.d.ts → problem-details-B45V5d2b.d.ts} +1 -1
- package/dist/{problem-details-DECUnXAn.js → problem-details-cn5X30gZ.js} +43 -40
- package/dist/problem-types-CJ2325SZ.js +5 -0
- package/dist/{prompt-CXYhLfsS.js → prompt-DfZLJLIn.js} +2 -2
- package/dist/{protected-BN7BUdY1.js → protected-BlF0F6wL.js} +21 -4
- package/dist/{protected-B3_P7xuw.d.ts → protected-RFGpakN9.d.ts} +16 -8
- package/dist/{provider-Bi-0HNL3.js → provider-B1al-AZz.js} +2 -2
- package/dist/{provider-kwHC9CZD.d.ts → provider-DILL9oPK.d.ts} +1 -1
- package/dist/{provider-store-Ctt-81Ni.js → provider-store-DM6DNcta.js} +2 -2
- package/dist/pull-CvpINcMK.js +1 -0
- package/dist/pull-jEwbf80J.js +256 -0
- package/dist/push-BD4f15co.js +116 -0
- package/dist/pushed-policy-CqtxkV4G.js +238 -0
- package/dist/pushed-policy-DCW91KQU.d.ts +57 -0
- package/dist/react/index.d.ts +8 -8
- package/dist/react/index.js +6 -6
- package/dist/react/provider-client.d.ts +1 -1
- package/dist/react/provider-client.js +1 -2
- package/dist/react-native/index.d.ts +24 -72
- package/dist/react-native/index.js +29 -25
- package/dist/{refs-f3imMjNW.js → refs-K6eWUJ0H.js} +1 -1
- package/dist/{relation-walk-BXnlLtg2.js → relation-walk-3OyDBF0S.js} +2 -2
- package/dist/{relations-CvmSpG67.js → relations-BnCWnJGI.js} +3 -3
- package/dist/renames-CGj7YwcQ.js +175 -0
- package/dist/{replay-COpmZUfx.d.ts → replay-Bkm-Ne4l.d.ts} +1 -1
- package/dist/{replay-BsOyTrdV.js → replay-Du1tJjG7.js} +2 -1
- package/dist/{request-context-BVM7aWNs.js → request-context-C81Pip9n.js} +3 -3
- package/dist/request-schema-CMreVuFM.js +148 -0
- package/dist/resend/index.d.ts +126 -0
- package/dist/resend/index.js +379 -0
- package/dist/{resource-relations-D1Un3pcz.js → resource-relations-D_jw0BFx.js} +1 -1
- package/dist/{retire-BFcxL6un.js → retire-CALjIQ7e.js} +2 -2
- package/dist/{revocations-Cy06JNx2.d.ts → revocations-R07lFBnX.d.ts} +2 -0
- package/dist/rls-BAqP4q66.js +336 -0
- package/dist/{rls-BEktUaqg.js → rls-DTvYd-lI.js} +288 -690
- package/dist/{role-builder-B4GbKM-i.js → role-builder-uWQZ4v84.js} +14 -207
- package/dist/{rpc-nYC3cR_u.js → rpc-VSl5ylaQ.js} +7 -7
- package/dist/run-CUKuz0A8.js +723 -0
- package/dist/run-DDwUaJDU.js +1 -0
- package/dist/run-ticket-DocwaTKn.d.ts +124 -0
- package/dist/run-ticket-sxFI6LAk.js +337 -0
- package/dist/{runtime-D_tMXnsq.js → runtime-D3VTAiCA.js} +1 -1
- package/dist/{saas-DtaA4JuW.js → saas-BCXRuXca.js} +16 -14
- package/dist/scan-qvOe0hS3.js +29 -0
- package/dist/{schema-DjQBcAP9.js → schema-B4v0Qrac.js} +102 -8
- package/dist/schema-yLuBWWsh.js +130 -0
- package/dist/scim/index.d.ts +2 -2
- package/dist/scim/index.js +1 -2
- package/dist/{scim-vFR1O5oG.js → scim-ClHtpyV3.js} +208 -76
- package/dist/{scopes-tvpa34ep.js → scopes-CUPSjo9q.js} +12 -7
- package/dist/server/index.d.ts +12 -143
- package/dist/server/index.js +12 -9
- package/dist/server-C3WXAHZj.js +453 -0
- package/dist/{server-types-DdqBwZN_.d.ts → server-types-CKQiCnON.d.ts} +51 -68
- package/dist/{sha256-BO0swRXL.js → sha256-D9ihqmvd.js} +8 -1
- package/dist/{shared-1uhI-e-b.js → shared-BAK8t4Uo.js} +20 -9
- package/dist/{shared-JhMeOsDF.js → shared-DvvFzYXe.js} +8 -9
- package/dist/signals-D3NcTKUS.js +32 -0
- package/dist/sink-4-eQIRWf.d.ts +225 -0
- package/dist/sink-BEZSlMS_.js +957 -0
- package/dist/{skills-BZdRQkxs.js → skills-B6lVdD_W.js} +13 -6
- package/dist/skills-CTYwkl44.js +51 -0
- package/dist/snapshot-B7DkYg6g.js +269 -0
- package/dist/{snapshot-cache-Cod40D-X.js → snapshot-cache-DZHQ0KF6.js} +11 -5
- package/dist/{snapshot-cache-J5T7t_vD.d.ts → snapshot-cache-PXI-vGpY.d.ts} +7 -5
- package/dist/solid/index.d.ts +11 -12
- package/dist/solid/index.js +7 -7
- package/dist/solid-start/index.d.ts +52 -0
- package/dist/solid-start/index.js +49 -0
- package/dist/{sources-Dljy06zL.d.ts → sources-Xc4zkszI.d.ts} +7 -13
- package/dist/{sources-B1-b-R0t.js → sources-vs5dGOsS.js} +125 -119
- package/dist/{sql-t8teWOfo.js → sql-B5T1IL83.js} +13 -1
- package/dist/src-Cu2m75uo.js +1860 -0
- package/dist/ssf/index.d.ts +4 -4
- package/dist/ssf/index.js +384 -47
- package/dist/standard-webhooks-DgFFD-Ga.js +228 -0
- package/dist/standard-webhooks-rbD7LS6h.d.ts +88 -0
- package/dist/storage-C2bWdvJH.js +132 -0
- package/dist/{store-ILkLUj_o.js → store-BDutJkDL.js} +40 -53
- package/dist/{store-options-CbUHDoSe.js → store-options-u0ycEe8s.js} +26 -21
- package/dist/{stores-Cxz_80g-.d.ts → stores-BUGNbJTt.d.ts} +7 -8
- package/dist/{stores-BHXdSbw9.js → stores-CGhM8BN_.js} +2 -2
- package/dist/{stream-Dwsg6WwE.d.ts → stream-CeCMJmBB.d.ts} +2 -2
- package/dist/{stream-BMui98KK.js → stream-CvdUS9V1.js} +9 -2
- package/dist/style-DiKWnAvn.js +1 -0
- package/dist/{style-CTm1AXDT.js → style-Uao76wO7.js} +3 -2
- package/dist/subject-BGoM5o8B.js +17 -0
- package/dist/supabase/index.d.ts +23 -106
- package/dist/supabase/index.js +5 -4
- package/dist/supabase/middleware.d.ts +7 -6
- package/dist/supabase/middleware.js +13 -11
- package/dist/supabase-By_frk3U.js +92 -0
- package/dist/{supabase-hook-Cva3ikXz.js → supabase-hook-BMoEhZir.js} +960 -64
- package/dist/supabase-hook-CCw5m35C.js +1 -0
- package/dist/{supabase-C1TWlnYt.js → supabase-x5JtR2tc.js} +99 -206
- package/dist/support-session-C6xJQYut.js +158 -0
- package/dist/svelte/Protected.svelte +4 -4
- package/dist/svelte/index.d.ts +7 -7
- package/dist/svelte/index.js +10 -10
- package/dist/svelte/runtime.d.ts +3 -3
- package/dist/svelte/runtime.js +3 -3
- package/dist/svelte/source.d.ts +7 -7
- package/dist/svelte/source.js +4 -4
- package/dist/sveltekit/index.d.ts +51 -0
- package/dist/sveltekit/index.js +27 -0
- package/dist/tanstack-start/index.d.ts +51 -0
- package/dist/tanstack-start/index.js +40 -0
- package/dist/target-Bw37TFNA.js +51 -0
- package/dist/{tenancy-DshjqY0n.js → tenancy-DN2QAx9z.js} +5 -5
- package/dist/terminal/index.d.ts +11 -9
- package/dist/terminal/index.js +23 -287
- package/dist/testing/index.d.ts +311 -38
- package/dist/testing/index.js +3475 -201
- package/dist/testing/saas/index.d.ts +9 -8
- package/dist/testing/saas/index.js +2 -2
- package/dist/testing/saas/permissions.d.ts +1 -1
- package/dist/testing/saas/permissions.js +1 -2
- package/dist/text-BMFRfBqc.js +8 -0
- package/dist/{text-diff-BdkkYSbi.js → text-diff-BQcUapOb.js} +1 -1
- package/dist/thenable-yD7SabqG.js +31 -0
- package/dist/time-DkWjdL98.js +71 -0
- package/dist/{token-Bx9qy30p.js → token-BLZcjQgt.js} +15 -6
- package/dist/{tool-refusal-CQ7OEia9.js → tool-refusal-CMLN5xhn.js} +2 -2
- package/dist/trpc/index.d.ts +12 -9
- package/dist/trpc/index.js +16 -14
- package/dist/types-8RnwUAvE.d.ts +107 -0
- package/dist/{store-9KO4BlkB.d.ts → types-B3_ooZgZ.d.ts} +100 -75
- package/dist/{types-Br9IXUBG.d.ts → types-BdtSDbBO.d.ts} +77 -17
- package/dist/types-BtHtcKMr.d.ts +157 -0
- package/dist/{types-CqrjB9o6.d.ts → types-BzzaHxt3.d.ts} +23 -11
- package/dist/types-C791HFu9.d.ts +332 -0
- package/dist/types-C863OQiR.d.ts +57 -0
- package/dist/{types-ByUo56un.d.ts → types-CVZSNocA.d.ts} +23 -22
- package/dist/{types-DHrmBJLH.d.ts → types-CX7AvRqP.d.ts} +7 -7
- package/dist/types-C_IiEs64.d.ts +65 -0
- package/dist/{types-7rJVLWe5.d.ts → types-Dfv0aTER.d.ts} +63 -11
- package/dist/types-DqzsnlSA.js +67 -0
- package/dist/{types-DpWfQdSh.d.ts → types-Druu9wLM.d.ts} +46 -11
- package/dist/{types-CIlTojhq.d.ts → types-_WhUP7ud.d.ts} +9 -6
- package/dist/{types-CUcFZfpU.d.ts → types-lUlG3TVd.d.ts} +2 -1
- package/dist/unplugin/index.d.ts +1 -1
- package/dist/unplugin/index.js +2 -2
- package/dist/usage-CRVl9V3t.js +32 -0
- package/dist/usage-CZpSQP6L.js +1 -0
- package/dist/{usage-CG9nOYZw.js → usage-SveTRTyr.js} +54 -11
- package/dist/{validation-error-BSSw0l_8.d.ts → validation-error-DHUrAkku.d.ts} +1 -1
- package/dist/{validity-dVrUEPJt.js → validity-CZ7-y0Cj.js} +32 -15
- package/dist/{verifier-DMr_Zmb_.js → verifier-DHuh-okk.js} +18 -7
- package/dist/{verify-BztUB3GX.js → verify-BaAKx7t6.js} +645 -50
- package/dist/{version-BEogC-rB.js → version-CEbQ5UeM.js} +4 -3
- package/dist/version-DXkYUISx.js +1 -0
- package/dist/{views-CJsrBS1f.js → views-DTIIO-oQ.js} +22 -5
- package/dist/{permission-types-Dg39z9Kv.d.ts → vocabulary-CN8H_9UF.d.ts} +67 -2
- package/dist/vue/index.d.ts +9 -10
- package/dist/vue/index.js +8 -8
- package/dist/waiter-B986w1oK.d.ts +36 -0
- package/dist/waiter-BGUtGYoU.js +67 -0
- package/dist/watch--ovlPOc0.js +1 -0
- package/dist/{watch-zeucB7eF.js → watch-vea54PRw.js} +44 -5
- package/dist/webmcp/index.d.ts +2 -2
- package/dist/webmcp/index.js +3 -3
- package/dist/where-scope-C9vfEphl.js +306 -0
- package/dist/who-can-DWBAcaCQ.js +364 -0
- package/dist/wire-delegation-Cv3W2eaM.js +36 -0
- package/dist/wire-denial-C7PaVYEM.js +27 -0
- package/dist/workflow/index.d.ts +5 -0
- package/dist/workflow/index.js +223 -0
- package/dist/workflow-sdk/index.d.ts +56 -0
- package/dist/workflow-sdk/index.js +78 -0
- package/dist/{wrap-Cr93qqdP.d.ts → wrap-C5jC6sKI.d.ts} +2 -1
- package/dist/{wrap-DWsU_5Bd.js → wrap-gX61EtpB.js} +7 -6
- package/package.json +136 -37
- package/schemas/access-event-v1.json +118 -0
- package/schemas/approval-request-v1.json +34 -1
- package/schemas/approval-signature-v1.json +94 -0
- package/schemas/automation-event-v1.json +113 -0
- package/schemas/capability-v1.json +84 -0
- package/schemas/catalog-event-v1.json +87 -0
- package/schemas/catalog-v1.json +123 -12
- package/schemas/cli-commands-v1.json +164 -0
- package/schemas/cli-result-v1.json +96 -0
- package/schemas/cloud-api-v1.json +5407 -0
- package/schemas/connector-v1.json +408 -0
- package/schemas/credential-event-v1.json +81 -0
- package/schemas/credential-v1.json +134 -0
- package/schemas/decision-event-v1.json +288 -0
- package/schemas/delivery-event-v1.json +117 -0
- package/schemas/directory-event-v1.json +85 -0
- package/schemas/evidence-export-v1.json +54 -0
- package/schemas/membership-event-v1.json +93 -0
- package/schemas/policy-v1.json +68 -0
- package/schemas/pushed-policy-v1.json +236 -0
- package/schemas/run-v1.json +162 -0
- package/schemas/snapshot-v1.json +138 -0
- package/schemas/supabase-claims-v1.json +4 -4
- package/schemas/supabase-manifest-v1.json +5 -1
- package/schemas/support-session-v1.json +111 -0
- package/skills/permdock/SKILL.md +16 -12
- package/skills/permdock-agents/SKILL.md +40 -23
- package/skills/permdock-agents/references/operations-automations-chat.md +221 -0
- package/skills/permdock-agents/references/runtimes.md +22 -18
- package/skills/permdock-approvals/SKILL.md +29 -13
- package/skills/permdock-approvals/references/delivery-and-waiters.md +172 -0
- package/skills/permdock-approvals/references/stores-and-resume.md +21 -7
- package/skills/permdock-audit/SKILL.md +3 -3
- package/skills/permdock-credentials/SKILL.md +5 -5
- package/skills/permdock-credentials/references/tokens-keys-links.md +14 -10
- package/skills/permdock-data/SKILL.md +6 -6
- package/skills/permdock-data/references/queries-and-rls.md +10 -9
- package/skills/permdock-data/references/relationships.md +3 -3
- package/skills/permdock-tenancy/SKILL.md +20 -7
- package/skills/permdock-tenancy/references/contacts-and-support-sessions.md +122 -0
- package/skills/permdock-tenancy/references/ownership-and-custom-roles.md +6 -4
- package/skills/permdock-wire/SKILL.md +17 -11
- package/skills/permdock-wire/references/adapters.md +139 -51
- package/skills/permdock-wire/references/policy-options.md +5 -5
- package/skills/permdock-wire/references/presets-and-recipes.md +58 -0
- package/dist/approvals-DZL76lKW.js +0 -240
- package/dist/arazzo-CD8d0WLb.js +0 -54
- package/dist/catalog-6yWAX6Ps.js +0 -2
- package/dist/catalog-WHG4kBq7.js +0 -48
- package/dist/cloud-C7bSDgX4.js +0 -50
- package/dist/cloud-PeBN3IEn.js +0 -118
- package/dist/collect-Bw2Jdq1q.js +0 -2
- package/dist/collect-CQx4hX4N.js +0 -83
- package/dist/commands-Cpip4ULx.js +0 -97
- package/dist/config-DLt6BvV7.js +0 -36
- package/dist/diff-Cnghh_Ip.js +0 -48
- package/dist/doctor-CuVJvhV_.js +0 -53
- package/dist/duration-xK2jGFVc.js +0 -25
- package/dist/errors-CWfoNg9N.js +0 -47
- package/dist/errors-DRnGZHzF.js +0 -30
- package/dist/expiry-BoBJ8Tvc.js +0 -7
- package/dist/fields-fwfXN01n.js +0 -1016
- package/dist/headers-BZSDieNT.js +0 -6
- package/dist/headers-Cf-zWvsO.d.ts +0 -6
- package/dist/ids-DC4V4CFu.js +0 -18
- package/dist/index-DgM7w96K.d.ts +0 -6
- package/dist/index-Dz7didpC.d.ts +0 -201
- package/dist/index-UdVQgq48.d.ts +0 -550
- package/dist/load-B_shHrmd.js +0 -2
- package/dist/manifest-BngWKryL.js +0 -770
- package/dist/may-use-BOn_dR_w.js +0 -78
- package/dist/openapi-DcQ1Kg40.js +0 -164
- package/dist/ownership-BgnbOJFT.js +0 -851
- package/dist/permdock-L26udHSk.js +0 -3646
- package/dist/powersync-BFSbSElQ.js +0 -62
- package/dist/powersync-DCDgZgfZ.js +0 -2
- package/dist/rls-55DQTuf5.js +0 -250
- package/dist/run-DMcNW_8T.js +0 -174
- package/dist/server-ZYEHtNHS.js +0 -268
- package/dist/sink-BTtmfPnE.js +0 -141
- package/dist/sink-CPN4zLfs.d.ts +0 -104
- package/dist/skills-Dle4ZoLF.js +0 -56
- package/dist/snapshot-Dc9CHPME.js +0 -1078
- package/dist/src-Bb7no-hS.js +0 -639
- package/dist/subject-C6dLxqHU.js +0 -24
- package/dist/supabase-Dbqr141s.js +0 -83
- package/dist/supabase-hook-BULg7Ut_.js +0 -2
- package/dist/thenable-QSmvt-vZ.js +0 -65
- package/dist/types-C0dee0Qf.d.ts +0 -197
- package/dist/types-DvupZE0w.d.ts +0 -9
- package/dist/usage-4G6t643F.js +0 -42
- package/dist/usage-iFLJ0-rr.js +0 -2
- package/dist/vocabulary-hhEFLFoL.d.ts +0 -65
- package/dist/watch-C8TpsAl4.js +0 -2
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as RoleTree, i as RoleMeta, n as PlanTree, r as Role, t as Plan } from "./vocabulary-hhEFLFoL.js";
|
|
1
|
+
import { E as PermissionTree, H as AppDataSchema, N as ResourceNode, T as PermissionKind, U as MetaValue, V as AppData, a as RoleTree, i as RoleMeta, n as PlanTree, r as Role, t as Plan, w as Permission } from "./vocabulary-CN8H_9UF.js";
|
|
3
2
|
//#region src/conditions/ast.d.ts
|
|
4
3
|
type ConditionRef = {
|
|
5
4
|
readonly ref: string;
|
|
@@ -164,6 +163,22 @@ type FieldWhere<V> = V | FieldOperator | {
|
|
|
164
163
|
readonly ref: string;
|
|
165
164
|
};
|
|
166
165
|
//#endregion
|
|
166
|
+
//#region src/core/open-union.d.ts
|
|
167
|
+
/**
|
|
168
|
+
* A string union that stays open: the listed values autocomplete, and an
|
|
169
|
+
* integrator may pass its own. Only for ids that core compares for equality,
|
|
170
|
+
* where an unknown value can only fail to match. A union whose members core
|
|
171
|
+
* interprets one by one (denial reasons, approval modes, condition operators,
|
|
172
|
+
* credential kinds, delivery channels) stays closed.
|
|
173
|
+
*/
|
|
174
|
+
type OpenUnion<T extends string> = T | (string & NonNullable<unknown>);
|
|
175
|
+
/** `actor.kind`: the values PermDock's adapters set, or an integrator's own; a policy delegation matches it by equality. */
|
|
176
|
+
type ActorKind = OpenUnion<"mcp-client" | "oauth-client" | "support" | "impersonation" | "ai-sdk" | "claude-agent" | "openai-agent" | "eve" | "terminal" | "web-bot-auth" | "a2a-agent" | "automation" | "job" | "caller" | "workload">;
|
|
177
|
+
/** The adapter a decision event names: a PermDock entry, or an integrator's own adapter. */
|
|
178
|
+
type AdapterId = OpenUnion<"server" | "next" | "hono" | "express" | "fastify" | "elysia" | "nest" | "node" | "h3" | "sveltekit" | "astro" | "solid-start" | "tanstack-start" | "trpc" | "orpc" | "supabase-middleware" | "convex" | "authzen" | "mcp" | "a2a" | "agent" | "ai-sdk" | "claude-agent" | "openai" | "eve" | "terminal" | "webmcp" | "workflow" | "chat" | "delivery">;
|
|
179
|
+
/** How a membership was obtained (`membership.via`); `viaOnly` and support rules match it by equality. */
|
|
180
|
+
type MembershipVia = OpenUnion<"direct" | "contact" | "credential" | "elevated" | "feed" | "link" | "share" | "support" | "support-session" | "scim">;
|
|
181
|
+
//#endregion
|
|
167
182
|
//#region src/core/subject.d.ts
|
|
168
183
|
type JsonWebKeyLike = {
|
|
169
184
|
readonly kty?: string;
|
|
@@ -208,13 +223,13 @@ type Membership = {
|
|
|
208
223
|
readonly roles: readonly string[];
|
|
209
224
|
/** Roles the holder may activate here but does not hold; `permdock.activate` writes an elevated membership. */
|
|
210
225
|
readonly eligible?: readonly string[];
|
|
211
|
-
readonly via?:
|
|
226
|
+
readonly via?: MembershipVia;
|
|
212
227
|
readonly expiresAt?: number;
|
|
213
228
|
/** The principal id that wrote this membership: who elevated, consented to or granted the access. */
|
|
214
229
|
readonly grantedBy?: string;
|
|
215
230
|
/** Free text recording why the membership was written: the activation or consent justification. */
|
|
216
231
|
readonly reason?: string;
|
|
217
|
-
/** A subgroup the holder belongs to inside the instance (`vendor-support`); a `
|
|
232
|
+
/** A subgroup the holder belongs to inside the instance (`vendor-support`); a `junctionMembershipSource` group column fills it. */
|
|
218
233
|
readonly member?: {
|
|
219
234
|
readonly group: string;
|
|
220
235
|
};
|
|
@@ -271,6 +286,7 @@ type TenantCustomRole = CustomRoleBody & {
|
|
|
271
286
|
readonly id?: string;
|
|
272
287
|
/** Input only: `scope` = the second scope, `id` = this team. */
|
|
273
288
|
readonly team?: string;
|
|
289
|
+
readonly shared?: undefined;
|
|
274
290
|
};
|
|
275
291
|
/**
|
|
276
292
|
* A role the platform defines, held through `principal.roles` like a declared
|
|
@@ -282,12 +298,33 @@ type GlobalCustomRole = CustomRoleBody & {
|
|
|
282
298
|
readonly tenant?: undefined;
|
|
283
299
|
readonly id?: undefined;
|
|
284
300
|
readonly team?: undefined;
|
|
301
|
+
readonly shared?: undefined;
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* A role the platform defines once for every tenant, held on memberships of
|
|
305
|
+
* its scope in any tenant. Tenant admins assign it but never edit it. Its
|
|
306
|
+
* ceiling is the assignable declared roles of its scope; its name wins over
|
|
307
|
+
* a tenant custom role of the same name.
|
|
308
|
+
*/
|
|
309
|
+
type SharedCustomRole = CustomRoleBody & {
|
|
310
|
+
readonly shared: true;
|
|
311
|
+
/** The scope the role is held at, never `'global'`; defaults to the first scope. */
|
|
312
|
+
readonly scope?: string;
|
|
313
|
+
readonly tenant?: undefined;
|
|
314
|
+
readonly id?: undefined;
|
|
315
|
+
readonly team?: undefined;
|
|
285
316
|
};
|
|
286
|
-
type CustomRole = TenantCustomRole | GlobalCustomRole;
|
|
317
|
+
type CustomRole = TenantCustomRole | SharedCustomRole | GlobalCustomRole;
|
|
287
318
|
type Principal = {
|
|
288
319
|
readonly id: string;
|
|
289
320
|
readonly issuer?: string;
|
|
290
|
-
|
|
321
|
+
/**
|
|
322
|
+
* `contact`: an external person (a customer contact, a portal user). Only
|
|
323
|
+
* its `{ on }` memberships count; it never approves, creates keys or
|
|
324
|
+
* publishes, and is read-only unless a role whose `for` lists `contact`
|
|
325
|
+
* grants the write.
|
|
326
|
+
*/
|
|
327
|
+
readonly kind?: "user" | "service" | "workload" | "link" | "feed" | "contact";
|
|
291
328
|
readonly roles?: readonly string[];
|
|
292
329
|
readonly plans?: readonly string[];
|
|
293
330
|
readonly memberships?: readonly Membership[];
|
|
@@ -302,9 +339,9 @@ type Principal = {
|
|
|
302
339
|
};
|
|
303
340
|
type Actor = {
|
|
304
341
|
readonly id: string;
|
|
305
|
-
readonly kind:
|
|
342
|
+
readonly kind: ActorKind;
|
|
306
343
|
readonly binding?: Binding;
|
|
307
|
-
/** `true`
|
|
344
|
+
/** `true` denies every permission without `readOnlyHint` (`not-delegated`), with or without a policy delegation. */
|
|
308
345
|
readonly readOnly?: boolean;
|
|
309
346
|
/** The stable name the application gives this OAuth client (`ClientNames`), set by the subject resolver from the verified client id; policy delegations match it with `to: { kind, client }`. */
|
|
310
347
|
readonly client?: string;
|
|
@@ -340,12 +377,12 @@ type Subject<TPrincipal extends Principal = Principal> = {
|
|
|
340
377
|
};
|
|
341
378
|
//#endregion
|
|
342
379
|
//#region src/core/decision.d.ts
|
|
343
|
-
type DenialReason = "no-grant" | "condition" | "deny" | "inactive-grant" | "closure-error" | "opaque-condition" | "server-only" | "anonymous" | "not-delegated" | "no-delegation" | "insufficient-user-authentication" | "not-entitled" | "purpose" | "reason-required" | "actor-required" | "limit" | "limit-unavailable" | "relation-depth" | "relation-unavailable" | "validation" | "tenant-mismatch" | "no-membership" | "scope" | "expired-membership" | "stale-credentials" | "unknown-role" | "last-holder" | "max-holders" | "transfer-only" | "not-assignable-by" | "self-demotion" | "externally-managed" | "not-allowed-for-membership" | "conflicting-role" | "approval" | "stale-approval" | "pdp-denied" | "pdp-unavailable" | "pdp-invalid-response" | "undocumented" | "unsupported" | "exceeds-creator" | "credential-policy";
|
|
380
|
+
type DenialReason = "no-grant" | "condition" | "deny" | "inactive-grant" | "closure-error" | "opaque-condition" | "server-only" | "anonymous" | "not-delegated" | "no-delegation" | "agent-tool-not-delegated" | "insufficient-user-authentication" | "not-entitled" | "purpose" | "reason-required" | "actor-required" | "limit" | "limit-unavailable" | "relation-depth" | "relation-unavailable" | "validation" | "tenant-mismatch" | "no-membership" | "scope" | "expired-membership" | "stale-credentials" | "unknown-role" | "last-holder" | "max-holders" | "transfer-only" | "not-assignable-by" | "self-demotion" | "externally-managed" | "not-allowed-for-membership" | "conflicting-role" | "approval" | "stale-approval" | "pdp-denied" | "pdp-unavailable" | "pdp-invalid-response" | "undocumented" | "unsupported" | "exceeds-creator" | "credential-policy";
|
|
344
381
|
/** The `detail` each denial reason carries, where PermDock sets a structured one. */
|
|
345
382
|
type DenialDetails = {
|
|
346
383
|
readonly limit: LimitDetail;
|
|
347
384
|
/** The window the inactive allow applies in. */
|
|
348
|
-
readonly "inactive-grant":
|
|
385
|
+
readonly "inactive-grant": WireValidity;
|
|
349
386
|
/** The matching deny's declared `name`. */
|
|
350
387
|
readonly deny: {
|
|
351
388
|
readonly name?: string;
|
|
@@ -399,19 +436,19 @@ type AppObligation = {
|
|
|
399
436
|
readonly name: string;
|
|
400
437
|
readonly detail?: MetaValue;
|
|
401
438
|
};
|
|
402
|
-
/** What is left of the `limit` that applied; `resetsAt` is
|
|
439
|
+
/** What is left of the `limit` that applied; `resetsAt` is RFC 3339. */
|
|
403
440
|
type Quota = {
|
|
404
441
|
readonly remaining: number;
|
|
405
|
-
readonly resetsAt:
|
|
442
|
+
readonly resetsAt: string;
|
|
406
443
|
};
|
|
407
444
|
/**
|
|
408
|
-
* The `detail` of a `limit` denial: the grant's `count`, its window
|
|
409
|
-
* seconds and when the window resets (
|
|
445
|
+
* The `detail` of a `limit` denial: the grant's `count`, its `per` window
|
|
446
|
+
* in seconds and when the window resets (RFC 3339).
|
|
410
447
|
*/
|
|
411
448
|
type LimitDetail = {
|
|
412
449
|
readonly count: number;
|
|
413
|
-
readonly
|
|
414
|
-
readonly resetsAt:
|
|
450
|
+
readonly per: number;
|
|
451
|
+
readonly resetsAt: string;
|
|
415
452
|
};
|
|
416
453
|
/**
|
|
417
454
|
* Why a candidate grant for the permission was passed over before its
|
|
@@ -596,65 +633,35 @@ declare function allOf(...items: readonly ApproverInput[]): readonly ApproverInp
|
|
|
596
633
|
/** A named approver for `approval.by`, matched on the approver's principal id. */
|
|
597
634
|
declare function user(id: string): UserApprover;
|
|
598
635
|
//#endregion
|
|
599
|
-
//#region src/core/
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
readonly
|
|
603
|
-
readonly
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
};
|
|
607
|
-
type ArazzoStepResult = {
|
|
608
|
-
readonly stepId: string;
|
|
609
|
-
/** The nested workflow that owns the step, when it is not the plan's workflow. */
|
|
610
|
-
readonly workflowId?: string;
|
|
611
|
-
readonly operationId?: string;
|
|
612
|
-
readonly permissions: readonly Permission[];
|
|
613
|
-
readonly decision: Decision;
|
|
614
|
-
readonly provisional?: true;
|
|
615
|
-
};
|
|
616
|
-
type ArazzoPlan = {
|
|
617
|
-
readonly workflowId: string;
|
|
618
|
-
readonly outcome: Decision["outcome"];
|
|
619
|
-
readonly steps: readonly ArazzoStepResult[];
|
|
620
|
-
};
|
|
621
|
-
type ArazzoFinding = {
|
|
622
|
-
readonly stepId: string;
|
|
623
|
-
readonly workflowId: string;
|
|
624
|
-
readonly reason: "undocumented" | "unsupported" | "validation" | "unknown-key";
|
|
625
|
-
readonly detail: string;
|
|
626
|
-
};
|
|
627
|
-
declare function arazzoFindings(input: ArazzoSimulateInput, tree: PermissionTree | undefined): readonly ArazzoFinding[];
|
|
628
|
-
declare function simulateArazzo(input: ArazzoSimulateInput, tree: PermissionTree | undefined, decide: (permission: Permission, data: unknown) => Decision): ArazzoPlan;
|
|
629
|
-
//#endregion
|
|
630
|
-
//#region src/core/elevated.d.ts
|
|
636
|
+
//#region src/core/scopes.d.ts
|
|
637
|
+
/** One entry of `definePolicy({ scopes })`: the row field holding the scope id, and its parent scope. */
|
|
638
|
+
type ScopeDeclaration = {
|
|
639
|
+
readonly key: string;
|
|
640
|
+
readonly within?: string;
|
|
641
|
+
};
|
|
642
|
+
type PolicyScopesInput = Readonly<Record<string, ScopeDeclaration>>;
|
|
631
643
|
/**
|
|
632
|
-
*
|
|
633
|
-
* `
|
|
634
|
-
* (RLS never compiles it) and grants only once its `requires` are met.
|
|
644
|
+
* A declared scope, in declaration order. `key` is absent only on the
|
|
645
|
+
* implicit `tenant` / `team` pair of a policy that declares no scopes.
|
|
635
646
|
*/
|
|
636
|
-
|
|
647
|
+
type Scope = {
|
|
648
|
+
readonly name: string;
|
|
649
|
+
readonly key?: string;
|
|
650
|
+
readonly within?: string;
|
|
651
|
+
};
|
|
652
|
+
/** The names `role(..., { on })`, `memberOf` and memberships may use: declared names plus the aliases. */
|
|
653
|
+
type ScopeNames<S> = [S] extends [PolicyScopesInput] ? string extends keyof S ? string : (keyof S & string) | "tenant" | "team" : string;
|
|
654
|
+
//#endregion
|
|
655
|
+
//#region src/core/wire-delegation.d.ts
|
|
637
656
|
/**
|
|
638
|
-
*
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
* scoped to `via: 'support'`.
|
|
657
|
+
* A delegation as every PermDock wire form carries it: OAuth `scope`
|
|
658
|
+
* (RFC 6749, space-separated) and RFC 9396 `authorization_details`. An empty
|
|
659
|
+
* `scope` is an empty scope list, which delegates nothing.
|
|
642
660
|
*/
|
|
643
|
-
|
|
644
|
-
readonly
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
declare function supportAccess(options: SupportAccessOptions<never>): RoleBinding<"tenant">;
|
|
648
|
-
type ActivateInput = {
|
|
649
|
-
readonly role: string | Role;
|
|
650
|
-
/** The scope the activation applies in (a declared name or the `tenant` / `team` alias). */
|
|
651
|
-
readonly scope: string;
|
|
652
|
-
readonly id: string;
|
|
653
|
-
/** Ancestor scope ids, keyed by scope name, for a nested-scope activation. */
|
|
654
|
-
readonly within?: Readonly<Record<string, string>>;
|
|
655
|
-
/** How long the elevation lasts; capped at the role's `maxDuration`. */
|
|
656
|
-
readonly duration?: string;
|
|
657
|
-
readonly reason?: string;
|
|
661
|
+
type WireDelegation = {
|
|
662
|
+
readonly scope?: string;
|
|
663
|
+
readonly authorization_details?: readonly AuthorizationDetail[];
|
|
664
|
+
readonly access?: readonly GnapAccess[];
|
|
658
665
|
};
|
|
659
666
|
//#endregion
|
|
660
667
|
//#region src/core/wire-denial.d.ts
|
|
@@ -679,7 +686,8 @@ type WireDecision = GrantedDecision | ApprovalRequiredDecision | (Omit<DeniedDec
|
|
|
679
686
|
type DirectoryEvent = {
|
|
680
687
|
readonly type: "directory";
|
|
681
688
|
readonly at: string;
|
|
682
|
-
|
|
689
|
+
/** `scim`, or an integrator's own directory sync. */
|
|
690
|
+
readonly source: OpenUnion<"scim">;
|
|
683
691
|
readonly operation: "create" | "replace" | "patch" | "delete";
|
|
684
692
|
readonly tenant: string;
|
|
685
693
|
readonly resource: {
|
|
@@ -693,6 +701,8 @@ type DirectoryEvent = {
|
|
|
693
701
|
readonly iss?: string;
|
|
694
702
|
};
|
|
695
703
|
readonly active?: boolean;
|
|
704
|
+
/** The application's own data, set where the event is built; plain JSON, never read by a decision. */
|
|
705
|
+
readonly x?: AppData;
|
|
696
706
|
};
|
|
697
707
|
type MembershipEvent = {
|
|
698
708
|
readonly type: "membership";
|
|
@@ -708,9 +718,9 @@ type MembershipEvent = {
|
|
|
708
718
|
readonly id?: string;
|
|
709
719
|
/** The id of every ancestor scope, keyed by scope name. */
|
|
710
720
|
readonly within?: Readonly<Record<string, string>>;
|
|
711
|
-
readonly via?:
|
|
712
|
-
/** When the membership lapses,
|
|
713
|
-
readonly expiresAt?:
|
|
721
|
+
readonly via?: MembershipVia;
|
|
722
|
+
/** When the membership lapses, an RFC 3339 instant. */
|
|
723
|
+
readonly expiresAt?: string;
|
|
714
724
|
readonly roles: {
|
|
715
725
|
readonly added: readonly string[];
|
|
716
726
|
readonly removed: readonly string[];
|
|
@@ -719,6 +729,8 @@ type MembershipEvent = {
|
|
|
719
729
|
readonly id: string;
|
|
720
730
|
readonly kind: string;
|
|
721
731
|
};
|
|
732
|
+
/** The application's own data, set where the event is built; plain JSON, never read by a decision. */
|
|
733
|
+
readonly x?: AppData;
|
|
722
734
|
};
|
|
723
735
|
/**
|
|
724
736
|
* An API key's lifecycle: `created`, `rotated` and `revoked` from the
|
|
@@ -738,14 +750,105 @@ type CredentialEvent = {
|
|
|
738
750
|
readonly id: string;
|
|
739
751
|
};
|
|
740
752
|
readonly tenant?: string;
|
|
741
|
-
|
|
753
|
+
/** When the key expires, an RFC 3339 instant. */
|
|
754
|
+
readonly expiresAt?: string;
|
|
742
755
|
readonly by?: {
|
|
743
756
|
readonly id: string;
|
|
744
757
|
readonly kind: string;
|
|
745
758
|
};
|
|
746
759
|
readonly sample?: number;
|
|
760
|
+
/** The application's own data, set where the event is built; plain JSON, never read by a decision. */
|
|
761
|
+
readonly x?: AppData;
|
|
762
|
+
};
|
|
763
|
+
/**
|
|
764
|
+
* An automation's lifecycle: `published`, `changed` (a new version) and
|
|
765
|
+
* `revoked` from the application, `run` when a run starts. It records the
|
|
766
|
+
* delegation for access review; it never decides.
|
|
767
|
+
*/
|
|
768
|
+
type AutomationEvent = {
|
|
769
|
+
readonly type: "automation";
|
|
770
|
+
readonly at: string;
|
|
771
|
+
readonly source: string;
|
|
772
|
+
readonly operation: "published" | "changed" | "revoked" | "run";
|
|
773
|
+
readonly automation: {
|
|
774
|
+
readonly id: string;
|
|
775
|
+
readonly version: number | string;
|
|
776
|
+
readonly mode: "publisher" | "service";
|
|
777
|
+
readonly name?: string;
|
|
778
|
+
};
|
|
779
|
+
/** The principal each run acts as. */
|
|
780
|
+
readonly principal: {
|
|
781
|
+
readonly id: string;
|
|
782
|
+
};
|
|
783
|
+
readonly publishedBy: string;
|
|
784
|
+
readonly tenant?: string;
|
|
785
|
+
readonly roles?: readonly string[];
|
|
786
|
+
/** The delegated permission keys. */
|
|
787
|
+
readonly permissions: readonly string[];
|
|
788
|
+
/** Set on `run` events only. */
|
|
789
|
+
readonly run?: {
|
|
790
|
+
readonly id: string;
|
|
791
|
+
};
|
|
792
|
+
readonly by?: {
|
|
793
|
+
readonly id: string;
|
|
794
|
+
readonly kind: string;
|
|
795
|
+
};
|
|
796
|
+
/** The application's own data, set where the event is built; plain JSON, never read by a decision. */
|
|
797
|
+
readonly x?: AppData;
|
|
798
|
+
};
|
|
799
|
+
type SinkEvent = DecisionEvent | DirectoryEvent | MembershipEvent | CredentialEvent | AccessEvent | AutomationEvent | DeliveryEvent;
|
|
800
|
+
/** A delivery channel: an email, a chat message or an outbound webhook. */
|
|
801
|
+
type DeliveryChannel = "email" | "chat" | "webhook";
|
|
802
|
+
/** What an email is for; only `notification` mail carries `List-Unsubscribe`. */
|
|
803
|
+
type EmailCategory = "transactional" | "notification" | "security" | "approval";
|
|
804
|
+
/**
|
|
805
|
+
* Why a delivery failed. `denied` and `unlinked` are the router's refusals of
|
|
806
|
+
* a recipient; the rest come from a transport or a provider webhook.
|
|
807
|
+
*/
|
|
808
|
+
type DeliveryFailureCause = "denied" | "unlinked" | "no-transport" | "no-message" | "invalid-recipient" | "invalid-message" | "rate-limited" | "quota-exceeded" | "unauthorized" | "unavailable" | "suppressed" | "rejected";
|
|
809
|
+
/**
|
|
810
|
+
* One recipient's delivery: `sent` when a transport accepted it, then
|
|
811
|
+
* `delivered`, `bounced` or `complained` from the provider, or `failed`.
|
|
812
|
+
* It carries no address, only the principal the router checked.
|
|
813
|
+
*/
|
|
814
|
+
type DeliveryEvent = {
|
|
815
|
+
readonly type: "delivery";
|
|
816
|
+
readonly at: string;
|
|
817
|
+
readonly source: string;
|
|
818
|
+
readonly operation: "sent" | "delivered" | "bounced" | "complained" | "failed";
|
|
819
|
+
readonly channel: DeliveryChannel;
|
|
820
|
+
/** The delivery's id and this recipient's key, sent as the `Idempotency-Key`. */
|
|
821
|
+
readonly delivery: {
|
|
822
|
+
readonly id: string;
|
|
823
|
+
readonly key: string;
|
|
824
|
+
};
|
|
825
|
+
/** The checked principal, or `trusted` for an address the server loaded itself. */
|
|
826
|
+
readonly recipient?: {
|
|
827
|
+
readonly principal?: {
|
|
828
|
+
readonly id: string;
|
|
829
|
+
};
|
|
830
|
+
readonly trusted?: true;
|
|
831
|
+
};
|
|
832
|
+
/** The permission the recipient was checked for. */
|
|
833
|
+
readonly permission?: string;
|
|
834
|
+
readonly tenant?: string;
|
|
835
|
+
readonly category?: EmailCategory;
|
|
836
|
+
/** The approval request a prompt was delivered for. */
|
|
837
|
+
readonly approval?: string;
|
|
838
|
+
/** The transport or provider, and its message id. */
|
|
839
|
+
readonly provider?: {
|
|
840
|
+
readonly name: string;
|
|
841
|
+
readonly id?: string;
|
|
842
|
+
};
|
|
843
|
+
/** Set on `failed` only. */
|
|
844
|
+
readonly cause?: DeliveryFailureCause;
|
|
845
|
+
/** Set on `failed` only: whether a retry with the same key may succeed. */
|
|
846
|
+
readonly retryable?: boolean;
|
|
847
|
+
/** The denial reason when `cause` is `denied`. */
|
|
848
|
+
readonly reason?: string;
|
|
849
|
+
/** The application's own data, set where the event is built; plain JSON, never read by a decision. */
|
|
850
|
+
readonly x?: AppData;
|
|
747
851
|
};
|
|
748
|
-
type SinkEvent = DecisionEvent | DirectoryEvent | MembershipEvent | CredentialEvent | AccessEvent;
|
|
749
852
|
/**
|
|
750
853
|
* A support-access session lifecycle event: a tenant consented to vendor
|
|
751
854
|
* support (`started`), the session lapsed (`ended`), or the tenant pulled
|
|
@@ -762,12 +865,13 @@ type AccessEvent = {
|
|
|
762
865
|
readonly id: string;
|
|
763
866
|
};
|
|
764
867
|
/** The membership kind the session runs under (`support`). */
|
|
765
|
-
readonly via:
|
|
868
|
+
readonly via: MembershipVia;
|
|
766
869
|
readonly roles: readonly string[];
|
|
767
870
|
readonly member?: {
|
|
768
871
|
readonly group: string;
|
|
769
872
|
};
|
|
770
|
-
|
|
873
|
+
/** When the session lapses, an RFC 3339 instant. */
|
|
874
|
+
readonly expiresAt?: string;
|
|
771
875
|
/** The tenant principal that consented. */
|
|
772
876
|
readonly grantedBy?: string;
|
|
773
877
|
readonly reason?: string;
|
|
@@ -775,9 +879,19 @@ type AccessEvent = {
|
|
|
775
879
|
readonly id: string;
|
|
776
880
|
readonly kind: string;
|
|
777
881
|
};
|
|
882
|
+
/** A `SupportSession`: its id and the principal the staff member views as. */
|
|
883
|
+
readonly session?: {
|
|
884
|
+
readonly id: string;
|
|
885
|
+
readonly principal: string;
|
|
886
|
+
};
|
|
887
|
+
/** A `SupportSession`'s permission keys. */
|
|
888
|
+
readonly permissions?: readonly string[];
|
|
889
|
+
/** The application's own data, set where the event is built; plain JSON, never read by a decision. */
|
|
890
|
+
readonly x?: AppData;
|
|
778
891
|
};
|
|
779
892
|
type DecisionEvent = {
|
|
780
893
|
readonly type: "decision";
|
|
894
|
+
/** An RFC 3339 instant. */
|
|
781
895
|
readonly at: string;
|
|
782
896
|
readonly outcome: "granted" | "denied" | "approval-required";
|
|
783
897
|
readonly permission: string;
|
|
@@ -796,18 +910,23 @@ type DecisionEvent = {
|
|
|
796
910
|
readonly id: string;
|
|
797
911
|
readonly kind: string;
|
|
798
912
|
};
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
readonly authorizationDetails?: readonly unknown[];
|
|
802
|
-
};
|
|
913
|
+
/** OAuth `scope` and RFC 9396 `authorization_details`, as every wire form carries a delegation. */
|
|
914
|
+
readonly delegation?: WireDelegation;
|
|
803
915
|
/** The API key the subject came from. */
|
|
804
916
|
readonly credential?: {
|
|
805
917
|
readonly id: string;
|
|
806
918
|
readonly kind: CredentialKind;
|
|
807
919
|
};
|
|
920
|
+
/** The support session the subject came from: the `id` its `access` events carry as `session.id`. */
|
|
921
|
+
readonly supportSession?: {
|
|
922
|
+
readonly id: string;
|
|
923
|
+
};
|
|
808
924
|
};
|
|
809
925
|
readonly tenant?: string;
|
|
810
|
-
|
|
926
|
+
/** The membership that answered, with `expiresAt` as an RFC 3339 instant. */
|
|
927
|
+
readonly membership?: Omit<Membership, "expiresAt"> & {
|
|
928
|
+
readonly expiresAt?: string;
|
|
929
|
+
};
|
|
811
930
|
readonly via?: string | null;
|
|
812
931
|
readonly matched?: {
|
|
813
932
|
readonly role: string | null;
|
|
@@ -830,19 +949,27 @@ type DecisionEvent = {
|
|
|
830
949
|
readonly alternatives?: readonly string[];
|
|
831
950
|
readonly token?: string;
|
|
832
951
|
readonly trusted: boolean;
|
|
833
|
-
|
|
834
|
-
readonly adapter
|
|
835
|
-
readonly
|
|
952
|
+
/** The call that produced the decision. */
|
|
953
|
+
readonly call: "can" | "decide" | "assert" | "filter" | "endpoint" | "adapter" | "approval" | "simulate" | "explain";
|
|
954
|
+
readonly adapter?: AdapterId;
|
|
955
|
+
/** The model id the agent model gate decided, or the model that drove the call. */
|
|
956
|
+
readonly model?: string;
|
|
957
|
+
/** Set on an approval lifecycle event (`com.permdock.approval.<phase>`). */
|
|
958
|
+
readonly phase?: "requested" | "resolved" | "expired" | "cancelled";
|
|
836
959
|
readonly counts?: {
|
|
837
960
|
readonly granted: number;
|
|
838
961
|
readonly denied: number;
|
|
839
962
|
readonly approvalRequired: number;
|
|
840
963
|
};
|
|
964
|
+
/** The application's own data, set where the event is built; plain JSON, never read by a decision. */
|
|
965
|
+
readonly x?: AppData;
|
|
841
966
|
};
|
|
842
967
|
type AuthEvent = {
|
|
843
968
|
readonly reason: "invalid-token" | "schema" | "unknown-role" | "groups-overflow" | "source-threw";
|
|
844
969
|
readonly cause?: string;
|
|
845
970
|
readonly source: string;
|
|
971
|
+
/** The `name` of the source that threw, when it has one. */
|
|
972
|
+
readonly name?: string;
|
|
846
973
|
readonly kid?: string;
|
|
847
974
|
readonly alg?: string;
|
|
848
975
|
readonly typ?: string;
|
|
@@ -850,91 +977,11 @@ type AuthEvent = {
|
|
|
850
977
|
readonly requestId?: string;
|
|
851
978
|
};
|
|
852
979
|
//#endregion
|
|
853
|
-
//#region src/core/scopes.d.ts
|
|
854
|
-
/** One entry of `definePolicy({ scopes })`: the row field holding the scope id, and its parent scope. */
|
|
855
|
-
type ScopeDeclaration = {
|
|
856
|
-
readonly key: string;
|
|
857
|
-
readonly within?: string;
|
|
858
|
-
};
|
|
859
|
-
type PolicyScopesInput = Readonly<Record<string, ScopeDeclaration>>;
|
|
860
|
-
/**
|
|
861
|
-
* A declared scope, in declaration order. `key` is absent only on the
|
|
862
|
-
* implicit `tenant` / `team` pair of a policy that declares no scopes.
|
|
863
|
-
*/
|
|
864
|
-
type Scope = {
|
|
865
|
-
readonly name: string;
|
|
866
|
-
readonly key?: string;
|
|
867
|
-
readonly within?: string;
|
|
868
|
-
};
|
|
869
|
-
/** The names `role(..., { on })`, `memberOf` and memberships may use: declared names plus the aliases. */
|
|
870
|
-
type ScopeNames<S> = [S] extends [PolicyScopesInput] ? string extends keyof S ? string : (keyof S & string) | "tenant" | "team" : string;
|
|
871
|
-
//#endregion
|
|
872
|
-
//#region src/core/ownership.d.ts
|
|
873
|
-
/** Who a role change is about: their principal id and their membership in the scope instance. */
|
|
874
|
-
type RoleChangeTarget = {
|
|
875
|
-
readonly id: string;
|
|
876
|
-
/** The kind of the target's membership in the instance (`staff`, `contact`, ...). */
|
|
877
|
-
readonly via?: string;
|
|
878
|
-
/** The roles the target holds in the instance now. */
|
|
879
|
-
readonly roles?: readonly string[];
|
|
880
|
-
/** `idp` when the identity provider owns the target's membership: the application cannot change it. */
|
|
881
|
-
readonly managedBy?: "idp";
|
|
882
|
-
};
|
|
883
|
-
type RoleChangeBase = {
|
|
884
|
-
readonly kind: "assign" | "revoke" | "transfer";
|
|
885
|
-
readonly role: string | Role;
|
|
886
|
-
/** Ids of the instance's ancestor scopes; a holder there may assign here. */
|
|
887
|
-
readonly within?: Readonly<Record<string, string>>;
|
|
888
|
-
readonly target: RoleChangeTarget;
|
|
889
|
-
/**
|
|
890
|
-
* How many principals hold `role` in the instance now, from the
|
|
891
|
-
* application's store. Without it a role with `min`, `max` or
|
|
892
|
-
* `transferOnly` is denied.
|
|
893
|
-
*/
|
|
894
|
-
readonly holders?: number;
|
|
895
|
-
};
|
|
896
|
-
/**
|
|
897
|
-
* A role held at a named scope instance (`scope` is a declared name or alias
|
|
898
|
-
* and `id` the instance), or a global role: `scope: 'global'` with no `id`.
|
|
899
|
-
* A global change has no tenant, so `within` and `holders` do not apply to it.
|
|
900
|
-
*/
|
|
901
|
-
type RoleChange = RoleChangeBase & ({
|
|
902
|
-
/** The scope the role is held at (a declared name or alias). */
|
|
903
|
-
readonly scope: string;
|
|
904
|
-
/** The scope instance. */
|
|
905
|
-
readonly id: string;
|
|
906
|
-
} | {
|
|
907
|
-
readonly scope: "global";
|
|
908
|
-
readonly id?: undefined;
|
|
909
|
-
});
|
|
910
|
-
/**
|
|
911
|
-
* `granted` names the role that authorised the change (`null` when a
|
|
912
|
-
* `meta.manageRoles` holder or the declared-role ceiling did); `denied` lists
|
|
913
|
-
* every rule the change breaks.
|
|
914
|
-
*/
|
|
915
|
-
type RoleChangeDecision = {
|
|
916
|
-
readonly outcome: "granted";
|
|
917
|
-
readonly change: RoleChange;
|
|
918
|
-
readonly role: string | null;
|
|
919
|
-
} | {
|
|
920
|
-
readonly outcome: "denied";
|
|
921
|
-
readonly change: RoleChange;
|
|
922
|
-
readonly denials: readonly Denial[];
|
|
923
|
-
};
|
|
924
|
-
type RoleChangeOptions = {
|
|
925
|
-
/**
|
|
926
|
-
* `true` when the application loaded `change.within` from its own store
|
|
927
|
-
* (the instance's stored parent), not from the request. Without it, a
|
|
928
|
-
* nested instance's tenant comes only from a live membership the actor
|
|
929
|
-
* holds on that instance or under it.
|
|
930
|
-
*/
|
|
931
|
-
readonly trusted?: boolean;
|
|
932
|
-
};
|
|
933
|
-
//#endregion
|
|
934
980
|
//#region src/core/snapshot-types.d.ts
|
|
935
981
|
type Snapshot = {
|
|
936
982
|
readonly v: 1;
|
|
937
|
-
|
|
983
|
+
/** RFC 3339. The epoch for a snapshot built without a clock. Signed, it is the token's `iat`. */
|
|
984
|
+
readonly issuedAt: string;
|
|
938
985
|
readonly subject: {
|
|
939
986
|
readonly principal: {
|
|
940
987
|
readonly id: string;
|
|
@@ -943,7 +990,8 @@ type Snapshot = {
|
|
|
943
990
|
readonly tenant?: string;
|
|
944
991
|
readonly memberships?: readonly Membership[];
|
|
945
992
|
} | null;
|
|
946
|
-
|
|
993
|
+
/** OAuth `scope` and RFC 9396 `authorization_details`, as the token carried them. */
|
|
994
|
+
readonly delegation?: WireDelegation;
|
|
947
995
|
readonly context: Readonly<Record<string, unknown>>;
|
|
948
996
|
};
|
|
949
997
|
/** Roles held in the active tenant, in rank order. */
|
|
@@ -954,7 +1002,8 @@ type Snapshot = {
|
|
|
954
1002
|
readonly tenants: readonly string[];
|
|
955
1003
|
readonly include?: readonly string[];
|
|
956
1004
|
readonly simulated?: true;
|
|
957
|
-
|
|
1005
|
+
/** RFC 3339. Signed, it is the token's `exp`. */
|
|
1006
|
+
readonly expiresAt?: string;
|
|
958
1007
|
readonly vocabulary?: {
|
|
959
1008
|
readonly roles?: Readonly<Record<string, Role>>;
|
|
960
1009
|
readonly plans?: Readonly<Record<string, Plan>>;
|
|
@@ -1020,8 +1069,8 @@ type SnapshotGrant = {
|
|
|
1020
1069
|
readonly membership?: Membership;
|
|
1021
1070
|
readonly portable?: false;
|
|
1022
1071
|
readonly fields?: readonly string[];
|
|
1023
|
-
/** When the grant applies (
|
|
1024
|
-
readonly validity?:
|
|
1072
|
+
/** When the grant applies (RFC 3339, `from` inclusive, `until` exclusive); absent means always. */
|
|
1073
|
+
readonly validity?: WireValidity;
|
|
1025
1074
|
/** The grant's declared `name`. */
|
|
1026
1075
|
readonly name?: string;
|
|
1027
1076
|
/** The grant's declared `meta`; visible to the client that holds the snapshot. */
|
|
@@ -1058,409 +1107,34 @@ type LocalCustomRoleTable = {
|
|
|
1058
1107
|
readonly includes: Readonly<Record<string, readonly SnapshotGrant[]>>;
|
|
1059
1108
|
};
|
|
1060
1109
|
//#endregion
|
|
1061
|
-
//#region src/core/
|
|
1062
|
-
type Boundary = "http-body" | "mcp-args" | "tool-args" | "decision-endpoint" | "manual";
|
|
1063
|
-
//#endregion
|
|
1064
|
-
//#region src/core/who-can.d.ts
|
|
1065
|
-
/** One way a principal holds a permission on an object. */
|
|
1066
|
-
type HoldingVia = {
|
|
1067
|
-
readonly kind: "role";
|
|
1068
|
-
readonly role: string;
|
|
1069
|
-
readonly membership: Membership;
|
|
1070
|
-
} | {
|
|
1071
|
-
readonly kind: "relation";
|
|
1072
|
-
readonly resource: string;
|
|
1073
|
-
readonly relation: string;
|
|
1074
|
-
/** The instance the relation is held on: the object or one of its ancestors. */
|
|
1075
|
-
readonly id: string;
|
|
1076
|
-
} | {
|
|
1077
|
-
readonly kind: "share";
|
|
1078
|
-
readonly resource: string;
|
|
1079
|
-
readonly relation: string;
|
|
1080
|
-
readonly id: string;
|
|
1081
|
-
readonly expiresAt?: number;
|
|
1082
|
-
/** The group the share names, when the principal holds it as one of its members. */
|
|
1083
|
-
readonly group?: RelationGroup;
|
|
1084
|
-
};
|
|
1085
|
-
type Holder = {
|
|
1086
|
-
readonly principal: {
|
|
1087
|
-
readonly id: string;
|
|
1088
|
-
};
|
|
1089
|
-
readonly via: readonly HoldingVia[];
|
|
1090
|
-
};
|
|
1091
|
-
/**
|
|
1092
|
-
* Who holds a permission on one object, for share dialogs and access
|
|
1093
|
-
* reviews. It lists and never grants. `complete: false` means some grantee
|
|
1094
|
-
* could not be enumerated (a global role, a plan, a source without `list`,
|
|
1095
|
-
* an unavailable relation): holders may be missing, so check with `decide`.
|
|
1096
|
-
*/
|
|
1097
|
-
type WhoCan = {
|
|
1098
|
-
readonly permission: string;
|
|
1099
|
-
readonly holders: readonly Holder[];
|
|
1100
|
-
readonly complete: boolean;
|
|
1101
|
-
};
|
|
1102
|
-
//#endregion
|
|
1103
|
-
//#region src/core/approval-policies.d.ts
|
|
1104
|
-
/**
|
|
1105
|
-
* One approval requirement kept as data, for a tenant or the whole platform.
|
|
1106
|
-
* It adds to what the code requires and never removes a requirement.
|
|
1107
|
-
*/
|
|
1108
|
-
type ApprovalPolicy = {
|
|
1109
|
-
/** The permission key; a former key from `renamed` resolves. */
|
|
1110
|
-
readonly permission: string;
|
|
1111
|
-
/** Absent: every tenant. */
|
|
1112
|
-
readonly tenant?: string;
|
|
1113
|
-
/** Actor kinds it applies to (`['agent']`); absent: every call. A call without an actor never matches a list. */
|
|
1114
|
-
readonly actors?: readonly string[];
|
|
1115
|
-
/** A portable condition over the row; instance permissions only, since a collection action has no row. */
|
|
1116
|
-
readonly where?: Condition;
|
|
1117
|
-
/** A portable condition over the call's input (the proposed row). */
|
|
1118
|
-
readonly check?: Condition;
|
|
1119
|
-
/**
|
|
1120
|
-
* The same shape as `allow(..., { approval })`. An `escalation` here widens
|
|
1121
|
-
* only this entry's stages, never the code's.
|
|
1122
|
-
*/
|
|
1123
|
-
readonly approval: ApprovalOption;
|
|
1124
|
-
};
|
|
1110
|
+
//#region src/core/time.d.ts
|
|
1125
1111
|
/**
|
|
1126
|
-
*
|
|
1127
|
-
*
|
|
1128
|
-
*
|
|
1129
|
-
* denies every call an allow would otherwise permit.
|
|
1112
|
+
* The one time rule: NumericDate (whole seconds) for JWT registered claims
|
|
1113
|
+
* and the claims SQL reads, RFC 3339 for every other JSON field, integer
|
|
1114
|
+
* seconds for durations, and an `Instant` for every runtime `now`.
|
|
1130
1115
|
*/
|
|
1131
|
-
type ApprovalPolicySource = {
|
|
1132
|
-
approvalPoliciesFor(query: {
|
|
1133
|
-
readonly tenants: readonly string[];
|
|
1134
|
-
}): readonly ApprovalPolicy[] | Promise<readonly ApprovalPolicy[]>;
|
|
1135
|
-
};
|
|
1136
|
-
/** The denial detail when an `ApprovalPolicySource` fails: every call an allow would grant denies with reason `approval`. */
|
|
1137
|
-
declare const APPROVAL_POLICY_UNAVAILABLE = "approval-policy-unavailable";
|
|
1138
|
-
declare function memoryApprovalPolicies(policies: readonly ApprovalPolicy[]): ApprovalPolicySource;
|
|
1139
1116
|
/**
|
|
1140
|
-
*
|
|
1141
|
-
*
|
|
1142
|
-
*
|
|
1143
|
-
* `where-on-collection`: `where` reads a row, which a collection action
|
|
1144
|
-
* never has, so the entry could never match; use `check` over the input.
|
|
1145
|
-
* `stale-on-without-version`: `staleOn` needs an instance permission whose
|
|
1146
|
-
* resource declares `version`.
|
|
1117
|
+
* The part of a `Temporal.Instant` PermDock reads. Public options take it
|
|
1118
|
+
* structurally so their declarations compile under a TypeScript lib without
|
|
1119
|
+
* `Temporal` (5.9); every `Temporal.Instant` satisfies it.
|
|
1147
1120
|
*/
|
|
1148
|
-
type
|
|
1149
|
-
|
|
1150
|
-
readonly ok: true;
|
|
1151
|
-
} | {
|
|
1152
|
-
readonly ok: false;
|
|
1153
|
-
readonly problem: ApprovalPolicyProblem;
|
|
1121
|
+
type Instant = {
|
|
1122
|
+
readonly epochMilliseconds: number;
|
|
1154
1123
|
};
|
|
1155
|
-
/**
|
|
1156
|
-
* Checks one entry against the policy the way `approvalPoliciesFor` loads
|
|
1157
|
-
* it, for an application to refuse a bad entry when it is saved instead of
|
|
1158
|
-
* finding every call denied. Never throws.
|
|
1159
|
-
*/
|
|
1160
|
-
declare function validateApprovalPolicy(policy: Policy, entry: unknown): ApprovalPolicyValidation;
|
|
1161
1124
|
//#endregion
|
|
1162
|
-
//#region src/core/
|
|
1163
|
-
/** One grant authored in PermDock Cloud; its grantee is a declared role, plan or relation. */
|
|
1164
|
-
type HostedGrant = {
|
|
1165
|
-
readonly id: string;
|
|
1166
|
-
readonly permission: string;
|
|
1167
|
-
readonly effect?: "allow" | "deny";
|
|
1168
|
-
readonly to: Grantee | readonly Grantee[];
|
|
1169
|
-
readonly where?: Condition;
|
|
1170
|
-
readonly check?: Condition;
|
|
1171
|
-
readonly approval?: "human" | ApprovalRequirement;
|
|
1172
|
-
readonly fields?: readonly string[];
|
|
1173
|
-
};
|
|
1174
|
-
/** PolicyDocument v1: the payload of a `permdock-policy+jwt` under the `policy` claim. */
|
|
1175
|
-
type PolicyDocument = {
|
|
1176
|
-
readonly v: 1;
|
|
1177
|
-
readonly id: string;
|
|
1178
|
-
readonly fingerprint: string;
|
|
1179
|
-
/** The catalog fingerprint the document was authored against. */
|
|
1180
|
-
readonly catalog: string;
|
|
1181
|
-
readonly issuedAt: number;
|
|
1182
|
-
readonly grants: readonly HostedGrant[];
|
|
1183
|
-
};
|
|
1184
|
-
/**
|
|
1185
|
-
* The channel for hosted grants. `createPermDock` reads `current()` once;
|
|
1186
|
-
* the application calls `refresh()` on its own schedule, never a check.
|
|
1187
|
-
*/
|
|
1188
|
-
type PolicySource = {
|
|
1189
|
-
current(): PolicyDocument | null;
|
|
1190
|
-
refresh(): Promise<void>;
|
|
1191
|
-
};
|
|
1192
|
-
type HostedGrantDropReason = "not-hostable" | "unknown-permission" | "unknown-grantee" | "non-portable" | "weaker-approval" | "invalid";
|
|
1193
|
-
/** Reported through `on('error')` when a hosted grant is not merged; never thrown. */
|
|
1194
|
-
type HostedGrantDropped = {
|
|
1195
|
-
readonly kind: "hosted-grant-dropped";
|
|
1196
|
-
readonly document: string;
|
|
1197
|
-
readonly grant: string;
|
|
1198
|
-
readonly reason: HostedGrantDropReason;
|
|
1199
|
-
};
|
|
1200
|
-
declare function memoryPolicySource(document?: PolicyDocument | null): PolicySource;
|
|
1201
|
-
/** Validates the document envelope; per-grant checks happen at merge time. */
|
|
1202
|
-
declare function parsePolicyDocument(json: unknown): PolicyDocument;
|
|
1203
|
-
/** True for the portable subset only: no `opaque`, no `sqlFunction`, no unknown op. */
|
|
1204
|
-
declare function isPortableCondition(value: unknown): value is Condition;
|
|
1125
|
+
//#region src/core/internals.d.ts
|
|
1205
1126
|
/**
|
|
1206
|
-
*
|
|
1207
|
-
*
|
|
1208
|
-
* never override a code deny; one that fails a rule is dropped, not thrown.
|
|
1127
|
+
* Any instance a feature function accepts: a server `PermDock`, one built
|
|
1128
|
+
* from a snapshot, or an adapter's wrapper such as `PdpPermDock`.
|
|
1209
1129
|
*/
|
|
1210
|
-
|
|
1211
|
-
readonly policy: Policy;
|
|
1212
|
-
readonly dropped: readonly HostedGrantDropped[];
|
|
1213
|
-
};
|
|
1214
|
-
//#endregion
|
|
1215
|
-
//#region src/core/permdock.d.ts
|
|
1216
|
-
type DecideOptions = {
|
|
1217
|
-
/** `true` skips schema validation for a row the server loaded itself. Otherwise `data` is validated against the resource schema first (`validate: 'boundary'`), and a failure denies with reason `validation`. */
|
|
1218
|
-
readonly trusted?: boolean;
|
|
1219
|
-
/** Where untrusted data came from, reported on validation errors. Defaults to `'manual'`. */
|
|
1220
|
-
readonly boundary?: Boundary;
|
|
1221
|
-
/** Decision clock in Unix seconds, for expiries and limits. Defaults to the current time. */
|
|
1222
|
-
readonly now?: number;
|
|
1223
|
-
/** The call that produced the decision, reported on the decision event. Defaults to `'decide'`. */
|
|
1224
|
-
readonly source?: DecisionEvent["source"];
|
|
1225
|
-
/** The adapter that made the call, reported on the decision event. */
|
|
1226
|
-
readonly adapter?: string;
|
|
1227
|
-
/** Per-call unauthorized handler for `assert`; runs before instance and policy handlers. */
|
|
1228
|
-
readonly onDenied?: (decision: Decision) => never | void;
|
|
1229
|
-
/** The field being read or written; only grants whose `fields` cover it match. */
|
|
1230
|
-
readonly field?: string;
|
|
1231
|
-
/** `true` attaches a `trace` to the decision: the grants evaluated, matched and skipped. Off by default and free when off. */
|
|
1232
|
-
readonly explain?: boolean;
|
|
1233
|
-
/**
|
|
1234
|
-
* A declared scope name: only memberships of that scope answer the check.
|
|
1235
|
-
* Naming the first scope keeps nested memberships out of a tenant-level
|
|
1236
|
-
* guard on a collection action. Global roles still apply; resource roles
|
|
1237
|
-
* and memberships of other scopes are skipped with reason `scope`.
|
|
1238
|
-
*/
|
|
1239
|
-
readonly scope?: string;
|
|
1240
|
-
};
|
|
1241
|
-
type SimulateOptions = {
|
|
1242
|
-
/** Decision clock in Unix seconds for the whole batch: grant validity, membership expiry and limits are read as of this instant. Defaults to the current time. */
|
|
1243
|
-
readonly now?: number;
|
|
1244
|
-
};
|
|
1245
|
-
type RowPair<T> = {
|
|
1246
|
-
readonly current: T;
|
|
1247
|
-
readonly next: T;
|
|
1248
|
-
};
|
|
1249
|
-
type WhereResult = {
|
|
1250
|
-
readonly condition: Condition | {
|
|
1251
|
-
readonly op: "or";
|
|
1252
|
-
readonly conditions: readonly [];
|
|
1253
|
-
};
|
|
1254
|
-
readonly partial: boolean;
|
|
1255
|
-
/**
|
|
1256
|
-
* The subject `where()` was built for. `toWhere` reads its memberships for
|
|
1257
|
-
* `memberOf` when no `subject` option is passed. Not enumerable, so it never
|
|
1258
|
-
* serialises with the result.
|
|
1259
|
-
*/
|
|
1260
|
-
readonly subject?: Subject;
|
|
1261
|
-
/** The policy's scopes, for `memberOf`; not enumerable either. */
|
|
1262
|
-
readonly scopes?: readonly Scope[];
|
|
1263
|
-
/** The policy's resource graph, for `related`; not enumerable either. */
|
|
1264
|
-
readonly resources?: ReadonlyMap<string, ResourceNode>;
|
|
1265
|
-
};
|
|
1266
|
-
type SnapshotOptions = {
|
|
1267
|
-
readonly include?: readonly (Permission | {
|
|
1268
|
-
readonly [key: string]: unknown;
|
|
1269
|
-
})[];
|
|
1270
|
-
readonly tenants?: "all";
|
|
1271
|
-
readonly signer?: TokenSigner;
|
|
1272
|
-
readonly audience?: string | readonly string[];
|
|
1273
|
-
};
|
|
1274
|
-
type PermDock<V extends PolicyVocabulary = PolicyVocabulary> = {
|
|
1275
|
-
readonly can: {
|
|
1276
|
-
(permission: Permission<string, unknown, "instance">, data: unknown, options?: DecideOptions): boolean;
|
|
1277
|
-
(permission: Permission<string, unknown, "collection">, data?: unknown, options?: DecideOptions): boolean;
|
|
1278
|
-
/**
|
|
1279
|
-
* A permission held as `Permission` at run time (from a list, a catalog
|
|
1280
|
-
* or `findPermission`), whose kind the type does not say: pass `data`,
|
|
1281
|
-
* or `undefined` for a check without a row.
|
|
1282
|
-
*/
|
|
1283
|
-
(permission: Permission, data: unknown, options?: DecideOptions): boolean;
|
|
1284
|
-
};
|
|
1285
|
-
readonly decide: {
|
|
1286
|
-
(permission: Permission<string, unknown, "instance">, data: unknown, options?: DecideOptions): Decision;
|
|
1287
|
-
(permission: Permission<string, unknown, "collection">, data?: unknown, options?: DecideOptions): Decision;
|
|
1288
|
-
/**
|
|
1289
|
-
* A permission held as `Permission` at run time (from a list, a catalog
|
|
1290
|
-
* or `findPermission`), whose kind the type does not say: pass `data`,
|
|
1291
|
-
* or `undefined` for a check without a row.
|
|
1292
|
-
*/
|
|
1293
|
-
(permission: Permission, data: unknown, options?: DecideOptions): Decision;
|
|
1294
|
-
};
|
|
1295
|
-
readonly assert: {
|
|
1296
|
-
(permission: Permission<string, unknown, "instance">, data: unknown, options?: DecideOptions): Extract<Decision, {
|
|
1297
|
-
readonly outcome: "granted";
|
|
1298
|
-
}>;
|
|
1299
|
-
(permission: Permission<string, unknown, "collection">, data?: unknown, options?: DecideOptions): Extract<Decision, {
|
|
1300
|
-
readonly outcome: "granted";
|
|
1301
|
-
}>;
|
|
1302
|
-
/**
|
|
1303
|
-
* A permission held as `Permission` at run time (from a list, a catalog
|
|
1304
|
-
* or `findPermission`), whose kind the type does not say: pass `data`,
|
|
1305
|
-
* or `undefined` for a check without a row.
|
|
1306
|
-
*/
|
|
1307
|
-
(permission: Permission, data: unknown, options?: DecideOptions): Extract<Decision, {
|
|
1308
|
-
readonly outcome: "granted";
|
|
1309
|
-
}>;
|
|
1310
|
-
};
|
|
1311
|
-
/**
|
|
1312
|
-
* `decide` with `explain: true`: the same decision, with a `trace` that
|
|
1313
|
-
* names the grants evaluated, the allows and denies that matched (so a
|
|
1314
|
-
* `denied` says which deny won) and the grants passed over. Local
|
|
1315
|
-
* computation only; the trace never reaches a `DecisionSink`.
|
|
1316
|
-
*/
|
|
1317
|
-
readonly explain: {
|
|
1318
|
-
(permission: Permission<string, unknown, "instance">, data: unknown, options?: Omit<DecideOptions, "explain">): ExplainedDecision;
|
|
1319
|
-
(permission: Permission<string, unknown, "collection">, data?: unknown, options?: Omit<DecideOptions, "explain">): ExplainedDecision;
|
|
1320
|
-
(permission: Permission, data: unknown, options?: Omit<DecideOptions, "explain">): ExplainedDecision;
|
|
1321
|
-
};
|
|
1322
|
-
readonly filter: <T>(permission: Permission<string, T, "instance">, rows: readonly T[], options?: DecideOptions) => T[];
|
|
1323
|
-
readonly pick: <T>(permission: Permission<string, T, "instance">, row: T, options?: DecideOptions) => Partial<T>;
|
|
1324
|
-
readonly where: (permission: Permission) => WhereResult;
|
|
1325
|
-
readonly actions: (resource: Permission | {
|
|
1326
|
-
readonly [key: string]: unknown;
|
|
1327
|
-
}, data: unknown, options?: DecideOptions) => Permission[];
|
|
1328
|
-
readonly simulate: {
|
|
1329
|
-
(checks: readonly (readonly [Permission, unknown?])[], options?: SimulateOptions): Decision[];
|
|
1330
|
-
(preview: {
|
|
1331
|
-
readonly roles?: readonly (string | Role)[];
|
|
1332
|
-
readonly memberships?: readonly Membership[];
|
|
1333
|
-
readonly tenant?: string;
|
|
1334
|
-
}): PermDock<V>;
|
|
1335
|
-
(plan: ArazzoSimulateInput): ArazzoPlan;
|
|
1336
|
-
};
|
|
1337
|
-
readonly snapshot: {
|
|
1338
|
-
(options?: SnapshotOptions & {
|
|
1339
|
-
readonly signer?: undefined;
|
|
1340
|
-
}): Snapshot;
|
|
1341
|
-
(options: SnapshotOptions & {
|
|
1342
|
-
readonly signer: TokenSigner;
|
|
1343
|
-
}): Promise<string>;
|
|
1344
|
-
(options?: SnapshotOptions): Snapshot | Promise<string>;
|
|
1345
|
-
};
|
|
1346
|
-
readonly on: (event: "decision" | "denied" | "approval" | "auth" | "error", handler: (payload: unknown) => void) => () => void;
|
|
1347
|
-
readonly tenant: (id: string) => PermDock<V>;
|
|
1348
|
-
readonly team: (id: string) => PermDock<V>;
|
|
1349
|
-
readonly memberships: () => readonly Membership[];
|
|
1350
|
-
readonly tenants: () => readonly string[];
|
|
1351
|
-
/**
|
|
1352
|
-
* Roles held in a tenant (the active one by default), or only on the
|
|
1353
|
-
* memberships of one `scope` (and instance `id`). Ordered by rank: a role
|
|
1354
|
-
* comes before the roles its `assigns` lists.
|
|
1355
|
-
*/
|
|
1356
|
-
readonly heldRoles: (options?: {
|
|
1357
|
-
readonly tenant?: string;
|
|
1358
|
-
readonly scope?: string;
|
|
1359
|
-
readonly id?: string;
|
|
1360
|
-
}) => readonly Role[];
|
|
1361
|
-
/** The distinct `meta.audience` values of the roles held in the active tenant, in rank order. */
|
|
1362
|
-
readonly audiences: () => readonly string[];
|
|
1363
|
-
/**
|
|
1364
|
-
* The roles the subject may hand out in a tenant (the active one by
|
|
1365
|
-
* default), or with `scope: 'global'` the global roles it may hand out. A
|
|
1366
|
-
* snapshot answers only the tenant form.
|
|
1367
|
-
*/
|
|
1368
|
-
readonly assignableRoles: (options?: {
|
|
1369
|
-
readonly tenant?: string;
|
|
1370
|
-
readonly scope?: "global";
|
|
1371
|
-
}) => readonly Role[];
|
|
1372
|
-
/**
|
|
1373
|
-
* The custom-role ceiling the subject may hand out: in a tenant (empty
|
|
1374
|
-
* without one), or with `scope: 'global'` for platform custom roles, the
|
|
1375
|
-
* allows of assignable global roles the subject holds. A snapshot answers
|
|
1376
|
-
* only the tenant form.
|
|
1377
|
-
*/
|
|
1378
|
-
readonly assignablePermissions: (options?: {
|
|
1379
|
-
readonly tenant?: string;
|
|
1380
|
-
readonly scope?: "global";
|
|
1381
|
-
}) => readonly Permission[];
|
|
1382
|
-
/**
|
|
1383
|
-
* The levels of `permission` (`resource(…, { levels })`) the subject may
|
|
1384
|
-
* hand out in a custom role: those it holds, or every level with
|
|
1385
|
-
* `meta.manageRoles`. Empty when the permission is not assignable.
|
|
1386
|
-
*/
|
|
1387
|
-
readonly assignableLevels: (permission: Permission, options?: {
|
|
1388
|
-
readonly tenant?: string;
|
|
1389
|
-
readonly scope?: "global";
|
|
1390
|
-
}) => readonly string[];
|
|
1391
|
-
/**
|
|
1392
|
-
* Whether the subject may assign, revoke or transfer a role in one scope
|
|
1393
|
-
* instance: `assigns`, the ceiling, `for`, `exclusiveWith`, `min`, `max`
|
|
1394
|
-
* and `transferOnly`. It never writes; the application does, and generated
|
|
1395
|
-
* RLS triggers re-check the holder counts at commit. A nested instance's
|
|
1396
|
-
* tenant comes from a live membership the subject holds on it, or from
|
|
1397
|
-
* `change.within` only with `{ trusted: true }`; otherwise `no-membership`.
|
|
1398
|
-
*/
|
|
1399
|
-
readonly decideRoleChange: (change: RoleChange, options?: RoleChangeOptions) => RoleChangeDecision;
|
|
1400
|
-
/**
|
|
1401
|
-
* Loads the relation facts `permission` needs for `rows` into this
|
|
1402
|
-
* instance's cache, so `can`, `decide` and `filter` answer synchronously
|
|
1403
|
-
* over an async `RelationSource`. It never grants; a failed load leaves
|
|
1404
|
-
* the checks denied with `relation-unavailable`.
|
|
1405
|
-
*/
|
|
1406
|
-
readonly loadRelations: (permission: Permission, rows: readonly unknown[]) => Promise<void>;
|
|
1407
|
-
/**
|
|
1408
|
-
* Who holds `permission` on `resource` and how (role, relation or share),
|
|
1409
|
-
* from `MembershipSource.list` and `RelationSource.related`. It lists and
|
|
1410
|
-
* never grants; `complete: false` means some holders could not be listed.
|
|
1411
|
-
*/
|
|
1412
|
-
readonly whoCan: (permission: Permission<string, unknown, "instance">, resource: unknown) => Promise<WhoCan>;
|
|
1413
|
-
/**
|
|
1414
|
-
* Requests a just-in-time activation of an eligible role. It never writes:
|
|
1415
|
-
* a granted decision carries the elevated membership under `elevation` for
|
|
1416
|
-
* the app to write, and `approval-required` comes back first when the
|
|
1417
|
-
* role's `activation` sets `approval`.
|
|
1418
|
-
*/
|
|
1419
|
-
readonly activate: (input: ActivateInput) => Decision;
|
|
1420
|
-
readonly roles: V["roles"] extends RoleTree ? V["roles"] : RoleTree;
|
|
1421
|
-
readonly plans: V["plans"] extends PlanTree ? V["plans"] : PlanTree;
|
|
1422
|
-
readonly permissions: V["permissions"] extends Policy["permissions"] ? V["permissions"] : Policy["permissions"];
|
|
1130
|
+
type InstanceHandle = {
|
|
1423
1131
|
readonly subject: Subject;
|
|
1424
|
-
/**
|
|
1425
|
-
* The same subject, tenant, team, actor, delegation, sink and limits with
|
|
1426
|
-
* other sources: `customRoles`, `approvalPolicies` or `relations`. The
|
|
1427
|
-
* sources it names are read again for the subject's tenants; the others
|
|
1428
|
-
* keep what this instance loaded. Returns a promise when a source it names
|
|
1429
|
-
* answers asynchronously.
|
|
1430
|
-
*/
|
|
1431
|
-
readonly derive: (options: DeriveOptions) => PermDock<V> | Promise<PermDock<V>>;
|
|
1432
|
-
};
|
|
1433
|
-
/** What `permdock.derive` may replace: the sources read after the subject is resolved. */
|
|
1434
|
-
type DeriveOptions = Pick<PermDockOptions, "customRoles" | "approvalPolicies" | "relations">;
|
|
1435
|
-
type PermDockOptions = {
|
|
1436
|
-
readonly tenant?: string;
|
|
1437
|
-
/** One source, or several composed with `composeMemberships`. */
|
|
1438
|
-
readonly memberships?: MembershipSource | readonly MembershipSource[];
|
|
1439
|
-
readonly customRoles?: RoleSource | RoleSourceFactory;
|
|
1440
|
-
/** Plans and seats from billing, merged into `principal.plans` for the active tenant. */
|
|
1441
|
-
readonly entitlements?: EntitlementSource;
|
|
1442
|
-
readonly actor?: Actor;
|
|
1443
|
-
readonly delegation?: Delegation;
|
|
1444
|
-
readonly sink?: DecisionSink;
|
|
1445
|
-
readonly limits?: LimitStore;
|
|
1446
|
-
readonly session?: string;
|
|
1447
|
-
readonly expiresAt?: number;
|
|
1448
|
-
/** Hosted grants; `current()` is read once, when the instance is created. */
|
|
1449
|
-
readonly policies?: PolicySource;
|
|
1450
|
-
/** The object graph for `through` and edge-table relations; without it they deny with `relation-unavailable`. */
|
|
1451
|
-
readonly relations?: RelationSource;
|
|
1452
|
-
/** Approval requirements kept as data; they add to the code's and never remove one. A throw denies. */
|
|
1453
|
-
readonly approvalPolicies?: ApprovalPolicySource;
|
|
1454
|
-
/**
|
|
1455
|
-
* Request values an adapter's `context` hook derived on the server, merged
|
|
1456
|
-
* into `subject.context`; keys from `policy.context` win on a clash.
|
|
1457
|
-
*/
|
|
1458
|
-
readonly context?: Readonly<Record<string, unknown>>;
|
|
1459
1132
|
};
|
|
1460
|
-
declare function createPermDock<TUser, TPrincipal extends Principal = Principal, V extends PolicyVocabulary = PolicyVocabulary>(policy: Policy<TUser, TPrincipal, V>, user: TUser | Subject | null, options?: PermDockOptions): PermDock<V> | Promise<PermDock<V>>;
|
|
1461
1133
|
//#endregion
|
|
1462
1134
|
//#region src/core/credential.d.ts
|
|
1463
|
-
type CredentialKind = "user" | "service";
|
|
1135
|
+
type CredentialKind = "user" | "service" | "feed";
|
|
1136
|
+
/** A feed id: lowercase, so a mail system that lowercases a local part still matches. At most 16 characters, so `pdfeed_<id>_<secret>` fits an email local part. */
|
|
1137
|
+
declare function isFeedId(value: string): boolean;
|
|
1464
1138
|
/** One permission (a key) a credential may use: on every instance, or only on `ids`. */
|
|
1465
1139
|
type CredentialPermission = {
|
|
1466
1140
|
readonly permission: string;
|
|
@@ -1485,17 +1159,22 @@ type Credential = {
|
|
|
1485
1159
|
* credential, where it keeps only the owner's memberships inside it.
|
|
1486
1160
|
*/
|
|
1487
1161
|
readonly tenant?: string;
|
|
1488
|
-
/** Service
|
|
1162
|
+
/** Service: the roles it holds in `tenant`. Feed: the resource roles it holds on `on`. */
|
|
1489
1163
|
readonly roles?: readonly string[];
|
|
1164
|
+
/** Feed only: the resource instance the roles are held on. */
|
|
1165
|
+
readonly on?: {
|
|
1166
|
+
readonly resource: string;
|
|
1167
|
+
readonly id: string;
|
|
1168
|
+
};
|
|
1490
1169
|
readonly permissions: readonly CredentialPermission[];
|
|
1491
1170
|
readonly createdBy: string;
|
|
1492
|
-
/**
|
|
1493
|
-
readonly createdAt:
|
|
1494
|
-
/**
|
|
1495
|
-
readonly expiresAt?:
|
|
1171
|
+
/** RFC 3339. */
|
|
1172
|
+
readonly createdAt: string;
|
|
1173
|
+
/** RFC 3339; absent only where a credential policy allows it. */
|
|
1174
|
+
readonly expiresAt?: string;
|
|
1496
1175
|
readonly name?: string;
|
|
1497
1176
|
};
|
|
1498
|
-
type
|
|
1177
|
+
type ApiKeyPrincipal = Principal & {
|
|
1499
1178
|
readonly credential: Credential;
|
|
1500
1179
|
};
|
|
1501
1180
|
/**
|
|
@@ -1520,7 +1199,8 @@ type CredentialPermissionInput = Permission | {
|
|
|
1520
1199
|
type CredentialRequestBase = {
|
|
1521
1200
|
readonly id: string;
|
|
1522
1201
|
readonly permissions: readonly CredentialPermissionInput[];
|
|
1523
|
-
|
|
1202
|
+
/** RFC 3339; must be after `now`. */
|
|
1203
|
+
readonly expiresAt?: string;
|
|
1524
1204
|
readonly name?: string;
|
|
1525
1205
|
};
|
|
1526
1206
|
type CredentialRequest = (CredentialRequestBase & {
|
|
@@ -1533,6 +1213,15 @@ type CredentialRequest = (CredentialRequestBase & {
|
|
|
1533
1213
|
readonly principal?: string;
|
|
1534
1214
|
readonly tenant: string;
|
|
1535
1215
|
readonly roles: readonly string[];
|
|
1216
|
+
}) | (CredentialRequestBase & {
|
|
1217
|
+
readonly kind: "feed";
|
|
1218
|
+
readonly on: {
|
|
1219
|
+
readonly resource: Permission | PermissionTree;
|
|
1220
|
+
readonly id: string;
|
|
1221
|
+
};
|
|
1222
|
+
readonly roles: readonly string[];
|
|
1223
|
+
/** A row the server loaded. Each permission must be granted on it. */
|
|
1224
|
+
readonly row: unknown;
|
|
1536
1225
|
});
|
|
1537
1226
|
type CredentialDecision = {
|
|
1538
1227
|
readonly outcome: "granted";
|
|
@@ -1551,8 +1240,8 @@ type DecideCredentialOptions = {
|
|
|
1551
1240
|
readonly settings?: SettingsSource;
|
|
1552
1241
|
/** The `token` of an approval the application consumed for this request. */
|
|
1553
1242
|
readonly approved?: string;
|
|
1554
|
-
/**
|
|
1555
|
-
readonly now?:
|
|
1243
|
+
/** The creation time; defaults to the clock. */
|
|
1244
|
+
readonly now?: Instant;
|
|
1556
1245
|
};
|
|
1557
1246
|
/**
|
|
1558
1247
|
* The first rule of `policy` the credential breaks, or `undefined`. A key
|
|
@@ -1574,20 +1263,6 @@ declare function parseCredential(input: unknown): Credential | undefined;
|
|
|
1574
1263
|
* key is gone delegates nothing and every check is denied.
|
|
1575
1264
|
*/
|
|
1576
1265
|
declare function credentialDelegation(credential: Credential, permissions: PermissionTree): Delegation;
|
|
1577
|
-
/**
|
|
1578
|
-
* The subject a verified credential acts as. A `user` credential is its
|
|
1579
|
-
* owner, passed live as `owner` (roles and memberships as of this request),
|
|
1580
|
-
* with the credential's delegation: every check is the owner's rights
|
|
1581
|
-
* intersected with the key's. One that names a `tenant` makes it the active
|
|
1582
|
-
* tenant, and `createPermDock` then keeps only the owner's memberships
|
|
1583
|
-
* inside it and no global role. A `service` credential is a `service`
|
|
1584
|
-
* principal whose only membership is `roles` in `tenant`. An owner whose id
|
|
1585
|
-
* is not the credential's `principal`, or who is not a user, is anonymous.
|
|
1586
|
-
*/
|
|
1587
|
-
declare function credentialSubject(credential: Credential, options: {
|
|
1588
|
-
readonly permissions: PermissionTree;
|
|
1589
|
-
readonly owner?: Principal;
|
|
1590
|
-
}): Subject<CredentialPrincipal> | Subject;
|
|
1591
1266
|
/**
|
|
1592
1267
|
* Decides whether the subject of `permdock` may create the credential in
|
|
1593
1268
|
* `request`. The creator must be a signed-in user or service that is not
|
|
@@ -1602,7 +1277,113 @@ declare function credentialSubject(credential: Credential, options: {
|
|
|
1602
1277
|
* its token. PermDock never stores the credential; the application does,
|
|
1603
1278
|
* after a `granted` result.
|
|
1604
1279
|
*/
|
|
1605
|
-
|
|
1280
|
+
/**
|
|
1281
|
+
* Decides whether the subject of `permdock` may create the credential in
|
|
1282
|
+
* `request`: the creator's own reach, the `credentials` policy of the key's
|
|
1283
|
+
* tenant (the call's `settings`, else the instance's), and `approval`.
|
|
1284
|
+
* PermDock never stores the credential; the application does, after a
|
|
1285
|
+
* `granted` result. An instance built from a snapshot denies with
|
|
1286
|
+
* `unsupported`.
|
|
1287
|
+
*/
|
|
1288
|
+
declare function decideCredential(permdock: InstanceHandle, request: CredentialRequest, options?: DecideCredentialOptions): Promise<CredentialDecision>;
|
|
1289
|
+
//#endregion
|
|
1290
|
+
//#region src/core/support-session.d.ts
|
|
1291
|
+
/**
|
|
1292
|
+
* SupportSession v1: a support staff member (`actor`, kind `support`)
|
|
1293
|
+
* viewing the app as `principal` in `tenant`, for a stated `reason`. Each
|
|
1294
|
+
* request in the session acts as `principal` with their live rights,
|
|
1295
|
+
* narrowed to `permissions`.
|
|
1296
|
+
*/
|
|
1297
|
+
type SupportSession = {
|
|
1298
|
+
readonly v: 1;
|
|
1299
|
+
readonly id: string;
|
|
1300
|
+
/** The person the session views the app as. */
|
|
1301
|
+
readonly principal: string;
|
|
1302
|
+
/** The support staff member running the session. */
|
|
1303
|
+
readonly actor: string;
|
|
1304
|
+
readonly tenant: string;
|
|
1305
|
+
readonly reason: string;
|
|
1306
|
+
/** The delegation: permission keys, read-only unless listed on purpose. */
|
|
1307
|
+
readonly permissions: readonly string[];
|
|
1308
|
+
/** RFC 3339. */
|
|
1309
|
+
readonly startedAt: string;
|
|
1310
|
+
/** RFC 3339. */
|
|
1311
|
+
readonly expiresAt: string;
|
|
1312
|
+
/** Who approved the session; never `actor`. */
|
|
1313
|
+
readonly approvedBy?: string;
|
|
1314
|
+
/** The application's ticket or case id. */
|
|
1315
|
+
readonly reference?: string;
|
|
1316
|
+
};
|
|
1317
|
+
/** A tenant's rules for support sessions. Every field only tightens. */
|
|
1318
|
+
type SupportSessionPolicy = {
|
|
1319
|
+
/** No session may start in this tenant. */
|
|
1320
|
+
readonly disabled?: boolean;
|
|
1321
|
+
/** Longest a session may last, in seconds. */
|
|
1322
|
+
readonly maxTtl?: number;
|
|
1323
|
+
/** Only `readOnlyHint` permissions, whatever the request lists. */
|
|
1324
|
+
readonly readOnly?: boolean;
|
|
1325
|
+
};
|
|
1326
|
+
type SupportSessionRequest = {
|
|
1327
|
+
readonly id: string;
|
|
1328
|
+
/** The person to view the app as. */
|
|
1329
|
+
readonly principal: string;
|
|
1330
|
+
/** Defaults to the actor's active tenant. */
|
|
1331
|
+
readonly tenant?: string;
|
|
1332
|
+
/** Required: why the session is needed. */
|
|
1333
|
+
readonly reason: string;
|
|
1334
|
+
/** Defaults to every `readOnlyHint` permission the actor can use. */
|
|
1335
|
+
readonly permissions?: readonly Permission[];
|
|
1336
|
+
/** Seconds the session lasts. Defaults to 3600; at most 86400. */
|
|
1337
|
+
readonly expiresIn?: number;
|
|
1338
|
+
readonly reference?: string;
|
|
1339
|
+
};
|
|
1340
|
+
type SupportSessionDecision = {
|
|
1341
|
+
readonly outcome: "granted";
|
|
1342
|
+
readonly session: SupportSession;
|
|
1343
|
+
} | {
|
|
1344
|
+
readonly outcome: "approval-required";
|
|
1345
|
+
readonly session: SupportSession;
|
|
1346
|
+
/** Bound to the request and the actor; pass it as `approved` to resume. */
|
|
1347
|
+
readonly token: string;
|
|
1348
|
+
} | {
|
|
1349
|
+
readonly outcome: "denied";
|
|
1350
|
+
readonly denials: readonly Denial[];
|
|
1351
|
+
};
|
|
1352
|
+
type DecideSupportSessionOptions = {
|
|
1353
|
+
/** Where the tenant's `supportSessions` policy comes from. */
|
|
1354
|
+
readonly settings?: SettingsSource;
|
|
1355
|
+
/** Approval is required unless this is `false`. */
|
|
1356
|
+
readonly approval?: boolean;
|
|
1357
|
+
/** The `token` of an approval the application consumed for this request. */
|
|
1358
|
+
readonly approved?: string;
|
|
1359
|
+
/** The principal id that approved; required with `approved` and never the actor. */
|
|
1360
|
+
readonly approvedBy?: string;
|
|
1361
|
+
/** The start time; defaults to the clock. */
|
|
1362
|
+
readonly now?: Instant;
|
|
1363
|
+
};
|
|
1364
|
+
/**
|
|
1365
|
+
* Validates an untrusted support-session record and returns a frozen copy
|
|
1366
|
+
* with only the v1 fields, or `undefined`.
|
|
1367
|
+
*/
|
|
1368
|
+
declare function parseSupportSession(input: unknown): SupportSession | undefined;
|
|
1369
|
+
/**
|
|
1370
|
+
* Decides whether the subject of `permdock` may start the support session
|
|
1371
|
+
* in `request`. The actor must be a signed-in person acting for themselves
|
|
1372
|
+
* (`exceeds-creator` otherwise), give a `reason` (`reason-required`), be a
|
|
1373
|
+
* member of the tenant (`tenant-mismatch`) and be able to use every
|
|
1374
|
+
* permission (`exceeds-creator`). Without `permissions` the session gets the
|
|
1375
|
+
* actor's read-only permissions. The tenant's `supportSessions` policy then
|
|
1376
|
+
* applies, and the result is `approval-required` until `approved` carries
|
|
1377
|
+
* its token and `approvedBy` names someone other than the actor.
|
|
1378
|
+
*/
|
|
1379
|
+
/**
|
|
1380
|
+
* Decides whether the subject of `permdock` may start the support session
|
|
1381
|
+
* in `request` and returns the record to sign: a stated reason, membership
|
|
1382
|
+
* of the tenant, the actor's own reach, the tenant's `supportSessions`
|
|
1383
|
+
* policy and approval by someone else. An instance built from a snapshot
|
|
1384
|
+
* denies with `unsupported`.
|
|
1385
|
+
*/
|
|
1386
|
+
declare function decideSupportSession(permdock: InstanceHandle, request: SupportSessionRequest, options?: DecideSupportSessionOptions): Promise<SupportSessionDecision>;
|
|
1606
1387
|
//#endregion
|
|
1607
1388
|
//#region src/core/interfaces.d.ts
|
|
1608
1389
|
type DecisionProvider = {
|
|
@@ -1624,9 +1405,11 @@ type DecisionProvider = {
|
|
|
1624
1405
|
readonly subject: Subject;
|
|
1625
1406
|
}): Promise<readonly string[] | null | undefined>;
|
|
1626
1407
|
};
|
|
1627
|
-
type
|
|
1408
|
+
type CustomRoleSource = {
|
|
1409
|
+
/** Names the implementation in errors and events. */
|
|
1410
|
+
readonly name?: string;
|
|
1628
1411
|
/**
|
|
1629
|
-
* The custom roles of one tenant. `
|
|
1412
|
+
* The custom roles of one tenant. `getPermDock` passes `held`, the role
|
|
1630
1413
|
* names the subject's live memberships hold there, declared or not, so a
|
|
1631
1414
|
* source can skip its read when none of them is a custom role.
|
|
1632
1415
|
*/
|
|
@@ -1642,14 +1425,23 @@ type RoleSource = {
|
|
|
1642
1425
|
globalRoles?(context?: {
|
|
1643
1426
|
readonly held: readonly string[];
|
|
1644
1427
|
}): CustomRole[] | Promise<CustomRole[]>;
|
|
1428
|
+
/**
|
|
1429
|
+
* Shared custom roles (`shared: true`), defined once for every tenant and
|
|
1430
|
+
* read once per subject with a tenant membership, with `held`, the role
|
|
1431
|
+
* names its live memberships hold in any tenant. A role here without
|
|
1432
|
+
* `shared: true` is ignored.
|
|
1433
|
+
*/
|
|
1434
|
+
sharedRoles?(context?: {
|
|
1435
|
+
readonly held: readonly string[];
|
|
1436
|
+
}): CustomRole[] | Promise<CustomRole[]>;
|
|
1645
1437
|
};
|
|
1646
1438
|
/**
|
|
1647
|
-
* A `
|
|
1439
|
+
* A `CustomRoleSource` built for the subject the instance serves, for an adapter
|
|
1648
1440
|
* option shared by every request: it gets the resolved subject (principal,
|
|
1649
1441
|
* actor and delegation) and returns that subject's source, or `undefined`
|
|
1650
1442
|
* for none. A throw reads no custom roles and reports `source-threw`.
|
|
1651
1443
|
*/
|
|
1652
|
-
type
|
|
1444
|
+
type CustomRoleSourceFactory = (subject: Subject) => CustomRoleSource | undefined;
|
|
1653
1445
|
/** One member of a scope instance, as `MembershipSource.list` returns it. */
|
|
1654
1446
|
type MemberEntry = {
|
|
1655
1447
|
readonly principal: {
|
|
@@ -1658,6 +1450,8 @@ type MemberEntry = {
|
|
|
1658
1450
|
readonly membership: Membership;
|
|
1659
1451
|
};
|
|
1660
1452
|
type MembershipSource = {
|
|
1453
|
+
/** Names the implementation in errors and events. */
|
|
1454
|
+
readonly name?: string;
|
|
1661
1455
|
membershipsFor(principal: {
|
|
1662
1456
|
readonly id: string;
|
|
1663
1457
|
readonly kind?: string;
|
|
@@ -1730,6 +1524,8 @@ type RelationHolder = HolderPeriod & ({
|
|
|
1730
1524
|
* `relation-unavailable`.
|
|
1731
1525
|
*/
|
|
1732
1526
|
type RelationSource = {
|
|
1527
|
+
/** Names the implementation in errors and events. */
|
|
1528
|
+
readonly name?: string;
|
|
1733
1529
|
/**
|
|
1734
1530
|
* With `through: 'parent'`, the parent chain; with a link name, the one
|
|
1735
1531
|
* instance that link points to (`depth` is then 1).
|
|
@@ -1752,6 +1548,8 @@ type RelationSource = {
|
|
|
1752
1548
|
};
|
|
1753
1549
|
/** Plan and seat names a principal holds in a tenant, from billing (Stripe Entitlements, a table). */
|
|
1754
1550
|
type EntitlementSource = {
|
|
1551
|
+
/** Names the implementation in errors and events. */
|
|
1552
|
+
readonly name?: string;
|
|
1755
1553
|
entitlementsFor(principal: {
|
|
1756
1554
|
readonly id: string;
|
|
1757
1555
|
}, options: {
|
|
@@ -1783,6 +1581,8 @@ type VerificationFailure = {
|
|
|
1783
1581
|
readonly cause: TokenFailureCause;
|
|
1784
1582
|
};
|
|
1785
1583
|
type TokenVerifier<TClaims extends JwtClaims = JwtClaims> = {
|
|
1584
|
+
/** Names the implementation in errors and events. */
|
|
1585
|
+
readonly name?: string;
|
|
1786
1586
|
verify(token: string, expectations: {
|
|
1787
1587
|
readonly typ?: string | readonly string[];
|
|
1788
1588
|
readonly audience?: string | readonly string[];
|
|
@@ -1791,10 +1591,18 @@ type TokenVerifier<TClaims extends JwtClaims = JwtClaims> = {
|
|
|
1791
1591
|
}): Promise<VerifiedToken<TClaims> | VerificationFailure>;
|
|
1792
1592
|
};
|
|
1793
1593
|
type TokenSigner = {
|
|
1594
|
+
/** Names the implementation in errors and events. */
|
|
1595
|
+
readonly name?: string;
|
|
1794
1596
|
sign(payload: Readonly<Record<string, unknown>>, options: {
|
|
1795
|
-
readonly typ: "permdock
|
|
1597
|
+
readonly typ: "vnd.permdock.snapshot+jwt" | "vnd.permdock.approval+jwt" | "vnd.permdock.policy+jwt" | "vnd.permdock.capability+jwt" | "vnd.permdock.run+jwt" | "vnd.permdock.support-session+jwt" | "vnd.permdock.evidence+jwt" | "at+jwt" | "secevent+jwt";
|
|
1598
|
+
/** `aud`; a signer with no default audience refuses to sign without one. */
|
|
1796
1599
|
readonly audience?: string | readonly string[];
|
|
1600
|
+
/** `exp`, a NumericDate; one hour after `iat` when absent. */
|
|
1797
1601
|
readonly expiresAt?: number;
|
|
1602
|
+
/** `iat`, a NumericDate: the artefact's issue time. The signer's clock when absent. */
|
|
1603
|
+
readonly issuedAt?: number;
|
|
1604
|
+
/** `jti`: the artefact's id. A fresh UUID when absent. */
|
|
1605
|
+
readonly jti?: string;
|
|
1798
1606
|
}): Promise<string>;
|
|
1799
1607
|
readonly kid?: string;
|
|
1800
1608
|
jwks?(): Promise<{
|
|
@@ -1805,6 +1613,8 @@ type SubjectResolver<TInput, TPrincipal extends Principal = Principal> = (input:
|
|
|
1805
1613
|
readonly tenant?: string;
|
|
1806
1614
|
}) => Subject<TPrincipal> | Promise<Subject<TPrincipal>>;
|
|
1807
1615
|
type SnapshotSource = {
|
|
1616
|
+
/** Names the implementation in errors and events. */
|
|
1617
|
+
readonly name?: string;
|
|
1808
1618
|
get(): Promise<Snapshot | string> | Snapshot | string;
|
|
1809
1619
|
subscribe?(listener: () => void): () => void;
|
|
1810
1620
|
};
|
|
@@ -1813,8 +1623,10 @@ type LimitConsumeInput = {
|
|
|
1813
1623
|
readonly key: string;
|
|
1814
1624
|
readonly subjectId: string;
|
|
1815
1625
|
readonly count: number;
|
|
1816
|
-
|
|
1817
|
-
readonly
|
|
1626
|
+
/** The window in seconds; windows are aligned to the epoch. */
|
|
1627
|
+
readonly per: number;
|
|
1628
|
+
/** The decision clock; the store reads the clock when absent. */
|
|
1629
|
+
readonly now?: Instant;
|
|
1818
1630
|
/** The active tenant; a quota counts per subject and tenant. */
|
|
1819
1631
|
readonly tenant?: string;
|
|
1820
1632
|
};
|
|
@@ -1822,10 +1634,14 @@ type LimitRemaining = {
|
|
|
1822
1634
|
readonly remaining: number;
|
|
1823
1635
|
};
|
|
1824
1636
|
type LimitStore = {
|
|
1637
|
+
/** Names the implementation in errors and events. */
|
|
1638
|
+
readonly name?: string;
|
|
1825
1639
|
consume(input: LimitConsumeInput): Promise<LimitRemaining> | LimitRemaining;
|
|
1826
1640
|
remaining(input: LimitConsumeInput): LimitRemaining | undefined;
|
|
1827
1641
|
};
|
|
1828
1642
|
type DecisionSink = {
|
|
1643
|
+
/** Names the implementation in errors and events. */
|
|
1644
|
+
readonly name?: string;
|
|
1829
1645
|
write(events: readonly SinkEvent[]): Promise<void> | void;
|
|
1830
1646
|
flush?(): Promise<void>;
|
|
1831
1647
|
};
|
|
@@ -1836,24 +1652,30 @@ type DecisionSink = {
|
|
|
1836
1652
|
* never core's.
|
|
1837
1653
|
*/
|
|
1838
1654
|
type CredentialVerifier = {
|
|
1655
|
+
/** Names the implementation in errors and events. */
|
|
1656
|
+
readonly name?: string;
|
|
1839
1657
|
verify(secret: string): Credential | null | Promise<Credential | null>;
|
|
1840
1658
|
/**
|
|
1841
|
-
* Records a successful use at `at
|
|
1842
|
-
*
|
|
1843
|
-
*
|
|
1659
|
+
* Records a successful use at `at`, for a `lastUsedAt` column. Called
|
|
1660
|
+
* after a key resolved and not awaited; a throw or a rejection is
|
|
1661
|
+
* ignored, so it never changes the subject.
|
|
1844
1662
|
*/
|
|
1845
|
-
touch?(id: string, at:
|
|
1663
|
+
touch?(id: string, at: Instant): void | Promise<void>;
|
|
1846
1664
|
};
|
|
1847
1665
|
/** What one tenant configures for itself. Every field only tightens. */
|
|
1848
1666
|
type TenantSettings = {
|
|
1849
1667
|
/** Rules for API keys created in, or used against, this tenant. */
|
|
1850
1668
|
readonly credentials?: CredentialPolicy;
|
|
1669
|
+
/** Rules for support sessions started in this tenant. */
|
|
1670
|
+
readonly supportSessions?: SupportSessionPolicy;
|
|
1851
1671
|
};
|
|
1852
1672
|
/**
|
|
1853
|
-
* Per-tenant settings, a subject input like `
|
|
1673
|
+
* Per-tenant settings, a subject input like `CustomRoleSource`: they tighten what
|
|
1854
1674
|
* a key may be and never grant. A throw denies.
|
|
1855
1675
|
*/
|
|
1856
1676
|
type SettingsSource = {
|
|
1677
|
+
/** Names the implementation in errors and events. */
|
|
1678
|
+
readonly name?: string;
|
|
1857
1679
|
settingsFor(tenant: string): TenantSettings | undefined | Promise<TenantSettings | undefined>;
|
|
1858
1680
|
};
|
|
1859
1681
|
//#endregion
|
|
@@ -1875,8 +1697,8 @@ type ClosureContext = {
|
|
|
1875
1697
|
type ClosureGrantFn<T = unknown> = (data: T, ctx: ClosureContext) => boolean;
|
|
1876
1698
|
/** Who else may approve once a request has waited `after`. */
|
|
1877
1699
|
type ApprovalEscalation = {
|
|
1878
|
-
/**
|
|
1879
|
-
readonly after:
|
|
1700
|
+
/** Seconds from the request's creation. */
|
|
1701
|
+
readonly after: number;
|
|
1880
1702
|
readonly to: Approver | readonly Approver[];
|
|
1881
1703
|
};
|
|
1882
1704
|
/** One group of approvers; `quorum` distinct approvers of `by` complete it. */
|
|
@@ -1906,8 +1728,8 @@ type ApprovalRequirement = {
|
|
|
1906
1728
|
readonly staleOn?: "resource-change";
|
|
1907
1729
|
/** Distinct approvers a request needs before it is approved under `by`; absent means 1. */
|
|
1908
1730
|
readonly quorum?: number;
|
|
1909
|
-
/**
|
|
1910
|
-
readonly ttl?:
|
|
1731
|
+
/** Seconds a request stays open; the store's default when absent, and never longer than it. */
|
|
1732
|
+
readonly ttl?: number;
|
|
1911
1733
|
readonly escalation?: ApprovalEscalation;
|
|
1912
1734
|
};
|
|
1913
1735
|
type ApprovalOption = "human" | {
|
|
@@ -1917,9 +1739,9 @@ type ApprovalOption = "human" | {
|
|
|
1917
1739
|
readonly stages?: readonly {
|
|
1918
1740
|
readonly by: ApproverInput;
|
|
1919
1741
|
readonly quorum?: number;
|
|
1920
|
-
/** After `after
|
|
1742
|
+
/** After `after` seconds, `to` may approve this stage as well as `by`. */
|
|
1921
1743
|
readonly escalation?: {
|
|
1922
|
-
readonly after:
|
|
1744
|
+
readonly after: number;
|
|
1923
1745
|
readonly to: ApproverInput;
|
|
1924
1746
|
};
|
|
1925
1747
|
}[];
|
|
@@ -1933,11 +1755,11 @@ type ApprovalOption = "human" | {
|
|
|
1933
1755
|
readonly staleOn?: "resource-change";
|
|
1934
1756
|
/** Distinct approvers needed (an integer of at least 1); the same approver counts once. Absent means 1. */
|
|
1935
1757
|
readonly quorum?: number;
|
|
1936
|
-
/**
|
|
1937
|
-
readonly ttl?:
|
|
1938
|
-
/** After `after` (`
|
|
1758
|
+
/** Seconds the request stays open (`1800`); caps the approval store's default. */
|
|
1759
|
+
readonly ttl?: number;
|
|
1760
|
+
/** After `after` seconds (`14_400`), `to` may approve as well as `by`, at any open stage; same kinds as `by`. */
|
|
1939
1761
|
readonly escalation?: {
|
|
1940
|
-
readonly after:
|
|
1762
|
+
readonly after: number;
|
|
1941
1763
|
readonly to: ApproverInput;
|
|
1942
1764
|
};
|
|
1943
1765
|
};
|
|
@@ -1948,7 +1770,8 @@ type ApprovalOption = "human" | {
|
|
|
1948
1770
|
*/
|
|
1949
1771
|
type GrantLimit = {
|
|
1950
1772
|
readonly count: number;
|
|
1951
|
-
|
|
1773
|
+
/** The window in seconds (`3600` for an hour), aligned to the epoch. */
|
|
1774
|
+
readonly per: number;
|
|
1952
1775
|
readonly mode?: "hard" | "soft";
|
|
1953
1776
|
readonly alertAt?: number;
|
|
1954
1777
|
};
|
|
@@ -1967,8 +1790,8 @@ type AssuranceRequirement = {
|
|
|
1967
1790
|
* mints the elevated membership to write.
|
|
1968
1791
|
*/
|
|
1969
1792
|
type ActivationOption = {
|
|
1970
|
-
/** The longest an activation may last,
|
|
1971
|
-
readonly maxDuration?:
|
|
1793
|
+
/** The longest an activation may last, in seconds (`14_400`). */
|
|
1794
|
+
readonly maxDuration?: number;
|
|
1972
1795
|
/** `'required'` denies an activation without a reason. */
|
|
1973
1796
|
readonly justification?: "required" | "optional";
|
|
1974
1797
|
/** When set, `activate` returns `approval-required` before the membership can be written. */
|
|
@@ -1977,7 +1800,7 @@ type ActivationOption = {
|
|
|
1977
1800
|
readonly assurance?: AssuranceRequirement;
|
|
1978
1801
|
};
|
|
1979
1802
|
type ActivationSpec = {
|
|
1980
|
-
readonly maxDuration?:
|
|
1803
|
+
readonly maxDuration?: number;
|
|
1981
1804
|
readonly justification: "required" | "optional";
|
|
1982
1805
|
readonly approval?: "human" | ApprovalRequirement;
|
|
1983
1806
|
readonly assurance?: AssuranceRequirement;
|
|
@@ -1994,8 +1817,8 @@ type BreakGlassOptions = {
|
|
|
1994
1817
|
/** Names of the deny grants this override lifts; every other deny still wins. */
|
|
1995
1818
|
readonly overrides?: readonly string[];
|
|
1996
1819
|
readonly requires?: BreakGlassRequirements;
|
|
1997
|
-
/** The longest a break-glass session may last,
|
|
1998
|
-
readonly maxDuration?:
|
|
1820
|
+
/** The longest a break-glass session may last, in seconds. */
|
|
1821
|
+
readonly maxDuration?: number;
|
|
1999
1822
|
/** Follow-ups the grant owes: each becomes an obligation on the decision. */
|
|
2000
1823
|
readonly obligations?: readonly ("notify" | "review")[];
|
|
2001
1824
|
};
|
|
@@ -2005,14 +1828,14 @@ type BreakGlassSpec = {
|
|
|
2005
1828
|
readonly purpose?: readonly string[];
|
|
2006
1829
|
readonly reason: boolean;
|
|
2007
1830
|
readonly assurance?: AssuranceRequirement;
|
|
2008
|
-
readonly maxDuration?:
|
|
1831
|
+
readonly maxDuration?: number;
|
|
2009
1832
|
readonly obligations: readonly ("notify" | "review")[];
|
|
2010
1833
|
};
|
|
2011
1834
|
/** How a tenant consents to support access, and for how long. */
|
|
2012
1835
|
type SupportConsent = {
|
|
2013
1836
|
readonly by: GranteeInput;
|
|
2014
|
-
/** The durations a tenant owner may pick,
|
|
2015
|
-
readonly durations: readonly
|
|
1837
|
+
/** The durations a tenant owner may pick, in seconds. */
|
|
1838
|
+
readonly durations: readonly number[];
|
|
2016
1839
|
};
|
|
2017
1840
|
type SupportAccessOptions<S extends string = string> = {
|
|
2018
1841
|
/** The role a consented support membership holds. */
|
|
@@ -2032,7 +1855,7 @@ type SupportSpec = {
|
|
|
2032
1855
|
readonly actorRequired: boolean;
|
|
2033
1856
|
readonly consent: {
|
|
2034
1857
|
readonly by: Grantee | readonly Grantee[];
|
|
2035
|
-
readonly durations: readonly
|
|
1858
|
+
readonly durations: readonly number[];
|
|
2036
1859
|
};
|
|
2037
1860
|
readonly group: string;
|
|
2038
1861
|
};
|
|
@@ -2060,10 +1883,10 @@ type GrantOptions<T = Record<string, unknown>> = {
|
|
|
2060
1883
|
readonly obligations?: readonly ObligationInput[];
|
|
2061
1884
|
/** Purposes of use (`context.purpose`) that make the grant apply; non-portable. */
|
|
2062
1885
|
readonly purpose?: readonly string[];
|
|
2063
|
-
/** The grant applies from this instant on (RFC 3339
|
|
2064
|
-
readonly validFrom?: string |
|
|
2065
|
-
/** The grant stops applying at this instant (exclusive; RFC 3339
|
|
2066
|
-
readonly validUntil?: string |
|
|
1886
|
+
/** The grant applies from this instant on (RFC 3339 or an `Instant`); before it an allow denies with `inactive-grant` and a deny does not apply. */
|
|
1887
|
+
readonly validFrom?: string | Instant;
|
|
1888
|
+
/** The grant stops applying at this instant (exclusive; RFC 3339 or an `Instant`). */
|
|
1889
|
+
readonly validUntil?: string | Instant;
|
|
2067
1890
|
/**
|
|
2068
1891
|
* An allow on an instance action counts only on rows whose scope instance
|
|
2069
1892
|
* (or the whole app, globally) is one where the subject also holds this
|
|
@@ -2091,13 +1914,18 @@ type GrantValidity = {
|
|
|
2091
1914
|
readonly from?: number;
|
|
2092
1915
|
readonly until?: number;
|
|
2093
1916
|
};
|
|
1917
|
+
/** A grant's validity in JSON (snapshots, catalogs, `inactive-grant` details): RFC 3339 bounds. */
|
|
1918
|
+
type WireValidity = {
|
|
1919
|
+
readonly from?: string;
|
|
1920
|
+
readonly until?: string;
|
|
1921
|
+
};
|
|
2094
1922
|
/**
|
|
2095
1923
|
* The actor a policy delegation is for: an actor kind, narrowed to one id
|
|
2096
1924
|
* when `id` is set, or to one named client when `client` is set (the name
|
|
2097
1925
|
* the subject resolver gives a verified client id through `clients`).
|
|
2098
1926
|
*/
|
|
2099
1927
|
type DelegationTarget = {
|
|
2100
|
-
readonly kind:
|
|
1928
|
+
readonly kind: ActorKind;
|
|
2101
1929
|
readonly id?: string;
|
|
2102
1930
|
readonly client?: string;
|
|
2103
1931
|
};
|
|
@@ -2121,8 +1949,8 @@ type DelegationInput = {
|
|
|
2121
1949
|
readonly to: ActorGrantee | string | DelegationTarget;
|
|
2122
1950
|
/** The leaves or subtrees the actor may use; a deny grant still applies. */
|
|
2123
1951
|
readonly permissions: readonly (Permission | PermissionTree)[];
|
|
2124
|
-
readonly validFrom?: string |
|
|
2125
|
-
readonly validUntil?: string |
|
|
1952
|
+
readonly validFrom?: string | Instant;
|
|
1953
|
+
readonly validUntil?: string | Instant;
|
|
2126
1954
|
};
|
|
2127
1955
|
/** A declared scope name (or the `tenant` / `team` alias), or the resource a role is held on. */
|
|
2128
1956
|
type RoleScope<S extends string = string> = S | Permission | PermissionTree | readonly (Permission | PermissionTree)[];
|
|
@@ -2180,7 +2008,7 @@ type Grant = {
|
|
|
2180
2008
|
/** Set on a break-glass allow: it overrides named denies and carries obligations. */
|
|
2181
2009
|
readonly breakGlass?: BreakGlassSpec;
|
|
2182
2010
|
/** The membership kind (`via`) this grant applies under; others never match it. */
|
|
2183
|
-
readonly viaOnly?:
|
|
2011
|
+
readonly viaOnly?: MembershipVia;
|
|
2184
2012
|
/** Set only on a grant merged from a hosted policy document. */
|
|
2185
2013
|
readonly hosted?: HostedGrantRef;
|
|
2186
2014
|
/** When the grant applies; absent means always. */
|
|
@@ -2283,7 +2111,7 @@ type PolicyAppDataSchemas = {
|
|
|
2283
2111
|
readonly grant?: AppDataSchema<unknown>;
|
|
2284
2112
|
readonly membership?: AppDataSchema<unknown>;
|
|
2285
2113
|
};
|
|
2286
|
-
type
|
|
2114
|
+
type PolicyOptions<TUser, TPrincipal extends Principal, S extends PolicyScopesInput = PolicyScopesInput> = {
|
|
2287
2115
|
readonly x?: PolicyAppDataSchemas;
|
|
2288
2116
|
readonly roles?: readonly RoleBinding<ScopeNames<S>>[];
|
|
2289
2117
|
readonly grants?: readonly (Omit<Grant, "role" | "scope"> | readonly Omit<Grant, "role" | "scope">[] | Grant)[];
|
|
@@ -2293,8 +2121,8 @@ type DefinePolicyOptions<TUser, TPrincipal extends Principal, S extends PolicySc
|
|
|
2293
2121
|
* the first and second scope.
|
|
2294
2122
|
*/
|
|
2295
2123
|
readonly scopes?: S;
|
|
2296
|
-
|
|
2297
|
-
readonly subject
|
|
2124
|
+
/** Maps the application's user to the principal PermDock decides for; `null` is anonymous. */
|
|
2125
|
+
readonly subject: (user: TUser) => TPrincipal | null;
|
|
2298
2126
|
readonly context?: (user: TUser) => Readonly<Record<string, unknown>> | Promise<Readonly<Record<string, unknown>>>;
|
|
2299
2127
|
readonly validate?: ValidateMode;
|
|
2300
2128
|
readonly onDenied?: (decision: unknown) => never | void;
|
|
@@ -2344,4 +2172,4 @@ type SubjectOf<P> = {
|
|
|
2344
2172
|
readonly expiresAt?: number;
|
|
2345
2173
|
};
|
|
2346
2174
|
//#endregion
|
|
2347
|
-
export {
|
|
2175
|
+
export { MemberEntry as $, Delegation as $n, DeliveryFailureCause as $t, PolicyScopes as A, relation as An, CredentialRequest as At, ValidateMode as B, LimitDetail as Bn, LocalSnapshotManifest as Bt, MembershipFixture as C, RelationGrantee as Cn, isConditionDate as Cr, Credential as Ct, PolicyDelegation as D, authenticated as Dn, CredentialPermissionInput as Dt, PolicyAppDataSchemas as E, assurance as En, CredentialPermission as Et, RoleScope as F, DenialDetails as Fn, isFeedId as Ft, CustomRoleSourceFactory as G, TraceSkip as Gn, SnapshotScope as Gt, WireValidity as H, Obligation as Hn, SnapshotAssignable as Ht, SeparationConflict as I, DenialReason as In, parseCredential as It, EntitlementSource as J, Assurance as Jn, AutomationEvent as Jt, DecisionProvider as K, TraceSkipReason as Kn, AccessEvent as Kt, SubjectOf as L, DeniedDecision as Ln, InstanceHandle as Lt, PrincipalOf as M, ApprovalRequiredDecision as Mn, credentialDelegation as Mt, RoleBinding as N, Decision as Nn, credentialPolicyViolation as Nt, PolicyOAuthScope as O, inherit as On, CredentialPolicy as Ot, RoleOptions as P, Denial as Pn, decideCredential as Pt, LimitStore as Q, CustomRoleGrant as Qn, DeliveryEvent as Qt, SupportAccessOptions as R, ExplainedDecision as Rn, Instant as Rt, HostedGrantRef as S, InheritGrantee as Sn, isCondition as Sr, ApiKeyPrincipal as St, Policy as T, anyone as Tn, isSqlFunctionField as Tr, CredentialKind as Tt, CredentialVerifier as U, Quota as Un, SnapshotGrant as Ut, VocabularyFromInput as V, MatchedGrant as Vn, Snapshot as Vt, CustomRoleSource as W, Trace as Wn, SnapshotNotEntitled as Wt, LimitConsumeInput as X, Binding as Xn, DecisionEvent as Xt, JwtClaims as Y, AuthorizationDetail as Yn, CredentialEvent as Yt, LimitRemaining as Z, CustomRole as Zn, DeliveryChannel as Zt, GrantLimit as _, anyOf as _n, RelatedHop as _r, SupportSessionDecision as _t, ApprovalRequirement as a, WireDenial as an, Subject as ar, SettingsSource as at, GrantScope as b, Grantee as bn, SqlFunctionCondition as br, decideSupportSession as bt, BreakGlassOptions as c, Scope as cn, AdapterId as cr, TenantSettings as ct, ClosureContext as d, AnyOfApprover as dn, ConditionRef as dr, TokenVerifier as dt, DirectoryEvent as en, GnapAccess as er, MembershipSource as et, ClosureGrantFn as f, Approver as fn, ConditionValue as fr, VerificationFailure as ft, GrantCondition as g, allOf as gn, RelatedCondition as gr, SupportSession as gt, Grant as h, UserApprover as hn, OpaqueCondition as hr, DecideSupportSessionOptions as ht, ApprovalOption as i, WireDecision as in, SharedCustomRole as ir, RelationSource as it, PolicyVocabulary as j, AppObligation as jn, DecideCredentialOptions as jt, PolicyOptions as k, plan as kn, CredentialPolicyViolation as kt, BreakGlassRequirements as l, ScopeDeclaration as ln, MembershipVia as lr, TokenFailureCause as lt, DelegationTarget as m, PermissionApprover as mn, MemberOfParent as mr, WhereCompiler as mt, ApprovalEscalation as n, MembershipEvent as nn, Membership as nr, RelationGroup as nt, ApprovalStage as o, WireDelegation as on, VerifiedClaims as or, SnapshotSource as ot, DelegationInput as p, ApproverInput as pn, MemberOfCondition as pr, VerifiedToken as pt, DecisionSink as q, Actor as qn, AuthEvent as qt, ApprovalMode as r, SinkEvent as rn, Principal as rr, RelationHolder as rt, AssuranceRequirement as s, PolicyScopesInput as sn, ActorKind as sr, SubjectResolver as st, ActivationOption as t, EmailCategory as tn, JsonWebKeyLike as tr, RelationChain as tt, BreakGlassSpec as u, ScopeNames as un, Condition as ur, TokenSigner as ut, GrantMeta as v, holder as vn, RestrictedAncestors as vr, SupportSessionPolicy as vt, ObligationInput as w, actor as wn, isConditionRef as wr, CredentialDecision as wt, GrantValidity as x, GranteeInput as xn, hasConditionOp as xr, parseSupportSession as xt, GrantOptions as y, user as yn, SqlFunctionArg as yr, SupportSessionRequest as yt, SupportConsent as z, GrantedDecision as zn, LocalCustomRoleTable as zt };
|