permdock 0.4.0 → 0.5.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-B4R5fnMU.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-Djo_PyZc.d.ts +57 -0
- package/dist/approvals/index.d.ts +5 -3
- package/dist/approvals/index.js +8 -5
- package/dist/approvals-DJ6Yd5z1.js +995 -0
- package/dist/arazzo-B6lebmiQ.js +36 -0
- package/dist/{arazzo-C4BcskbX.js → arazzo-BWhNF-k0.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-Dg8XsRaO.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-BMZPIVUM.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-BzqG8SMb.d.ts → bind--9EFVYWF.d.ts} +12 -10
- package/dist/{bind-kk-uyCwH.js → bind-CZzhx-Vj.js} +14 -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-BMnAudHn.js} +4 -3
- package/dist/{canonical-json-CFKyFOke.js → canonical-json-BC8_nMTw.js} +5 -3
- package/dist/{capability-CksyCWDH.d.ts → capability-BSslw1QV.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-tZUyOfOv.js → catalog-BECMPrwc.js} +51 -6
- package/dist/catalog-DjhMYYCq.js +1 -0
- package/dist/catalog-R_A__RsH.js +52 -0
- package/dist/{catalog-doc-DWtg0gGR.js → catalog-doc-C9wjsfNY.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-CIoHNevm.js +87 -0
- package/dist/codemod-Bmj9dWMH.js +37 -0
- package/dist/codemod-Cxvvc70T.js +2084 -0
- package/dist/{collect-2SrB7lfk.js → collect-CrZJJnEF.js} +75 -11
- package/dist/collect-DloHbDVa.js +55 -0
- package/dist/collect-FlXJlhus.js +1 -0
- 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-CcEu2ZQ1.js → compile-CMqMx_IN.js} +11 -8
- package/dist/{compile-CtTP7eur.d.ts → compile-Ckm2HqBZ.d.ts} +5 -3
- package/dist/completion-BqhRBJD8.js +143 -0
- package/dist/config-B46rm9sc.js +26 -0
- package/dist/{config-BIjREpyE.js → config-bs_kZeYq.js} +12 -7
- package/dist/{config-report--Xb9APJS.js → config-report-DUgj62Ai.js} +15 -5
- package/dist/{connection-DUsczpB5.js → connection-DjhIJSs2.js} +6 -5
- package/dist/{context-DieZVJXu.js → context-bbFHR-0D.js} +2 -2
- package/dist/convex/index.d.ts +11 -10
- package/dist/convex/index.js +6 -4
- package/dist/create-0VZ7Pdiu.d.ts +107 -0
- package/dist/create-BDS7wc3y.d.ts +138 -0
- package/dist/create-BFfm17UA.d.ts +110 -0
- package/dist/create-BWRSXgOF.js +403 -0
- package/dist/create-C3b4B5eF.js +130 -0
- package/dist/{create-BBO24vj6.js → create-DnrmLnLW.js} +31 -32
- package/dist/{credential-kue0qpbm.js → credential-DM2um3ha.js} +152 -31
- package/dist/credentials-DPyHmYz5.js +74 -0
- package/dist/delegation-DaXVdDhM.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-D8jDHgsl.d.ts} +5 -5
- package/dist/{describe-C3ldA9os.d.ts → describe-BZUsixiL.d.ts} +2 -2
- package/dist/{describe-Cgkp7eP0.js → describe-BybMRY7A.js} +6 -2
- package/dist/device-BARQ8eYG.js +193 -0
- package/dist/diff-CxZo9pTq.js +37 -0
- package/dist/{diff-rpqoe7Ag.js → diff-DCePiN6M.js} +60 -54
- package/dist/doctor-CxiwSfqH.js +44 -0
- package/dist/{doctor-owlv6ddh.js → doctor-DFjUxf2f.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-OD_4c__H.d.ts → errors-C2PXIv4c.d.ts} +2 -2
- package/dist/errors-CWTY6uih.js +143 -0
- package/dist/evaluate-_R8QkWaf.js +1732 -0
- package/dist/evaluations-16UqqQ6W.d.ts +32 -0
- package/dist/{evaluations-C9YJsv3H.js → evaluations-DZ2CbV5k.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-g0ypLkID.js +120 -0
- package/dist/fetch-adapter-qKJBuRqy.d.ts +31 -0
- package/dist/fields-D9tPVUUS.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-D2lZt4Dd.js} +55 -52
- package/dist/{grantee-CXY-0C87.js → grantee-Cn1HyUsI.js} +3 -3
- package/dist/{grantee-conditions-MQs5NIuX.js → grantee-conditions-CcXf8hMM.js} +4 -3
- package/dist/{grantee-match-fxYp9Nmt.js → grantee-match-DHArqY82.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-DTcZOzhF.js} +45 -38
- package/dist/hono/index.d.ts +12 -9
- package/dist/hono/index.js +13 -12
- package/dist/hosted-BZIAYvon.js +315 -0
- package/dist/hosted-DBDX0M-P.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-DMmOG27O.js} +190 -53
- package/dist/index-BcHcPyIo.d.ts +110 -0
- package/dist/index-CaxrMD1A.d.ts +1 -0
- package/dist/index-Chrs5fQ-.d.ts +210 -0
- package/dist/index-CxGUswIC.d.ts +431 -0
- package/dist/index-D8EovfsP.d.ts +91 -0
- package/dist/{index-UdVQgq48.d.ts → index-DOVf7RJv.d.ts} +431 -81
- package/dist/{index-BwMe94Xq.d.ts → index-SGdIQyzc.d.ts} +34 -16
- 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-Omfd793B.d.ts} +2 -2
- package/dist/instance-snapshot-Cxq4ygFc.js +600 -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-5JatXyND.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-CtKR3GXL.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-TCAdw-eW.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-BShP7Vf4.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-BJdBmYDG.js → openapi-DTaEmTSW.js} +10 -9
- package/dist/openapi-ahr8rHu3.js +138 -0
- package/dist/operation-findings-DgATDpvh.js +36 -0
- package/dist/operations-CxybZErY.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-Dyw8fyPF.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-BatFgAA4.js} +1698 -869
- 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-C-q02Pal.js → parse-local-manifest-CVSs6J9I.js} +1 -1
- package/dist/{parse-local-manifest-DvYUR0QL.d.ts → parse-local-manifest-DgqtruPn.d.ts} +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-B9JxkBwC.js +868 -0
- package/dist/permdock-D7eeLJER.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-CZKiUfFM.js} +4 -3
- package/dist/{permissions-COH-KRgT.d.ts → permissions-oEWfl-kl.d.ts} +1 -2
- package/dist/policies-CO1oOymN.js +295 -0
- package/dist/{policy-ur0BBK_e.d.ts → policy-Czo4n3Hs.d.ts} +2 -2
- package/dist/{hosted-CBHgkzDl.js → policy-DLZJ5gAp.js} +17 -273
- package/dist/policy-from-catalog-DzhEc3Y9.js +450 -0
- package/dist/policy-module-CTlwMvLI.js +89 -0
- package/dist/{policy-types-sp9P1iIV.d.ts → policy-types-DzwivBgR.d.ts} +434 -631
- package/dist/postgrest-CW0IqC-U.js +566 -0
- package/dist/postgrest-NUqZT-RB.d.ts +100 -0
- package/dist/powersync-BHfuehf3.js +62 -0
- package/dist/powersync-CbzkqL_M.js +1 -0
- package/dist/{powersync-cZe4kzhL.js → powersync-bYUDLOAO.js} +23 -24
- 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-DXlt-vks.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-B3_P7xuw.d.ts → protected-DEPHc2xV.d.ts} +16 -8
- package/dist/{protected-BN7BUdY1.js → protected-DfjY5mLA.js} +21 -4
- package/dist/{provider-Bi-0HNL3.js → provider-CC-u3bYP.js} +2 -2
- package/dist/{provider-kwHC9CZD.d.ts → provider-DMVt6yYn.d.ts} +1 -1
- package/dist/{provider-store-Ctt-81Ni.js → provider-store-B5Yrkhzr.js} +2 -2
- package/dist/pull-BgIfno6w.js +256 -0
- package/dist/pull-ByOks_Tg.js +1 -0
- package/dist/push-CmFVBOeI.js +116 -0
- package/dist/pushed-policy-BImMTTIM.d.ts +57 -0
- package/dist/pushed-policy-DobP7AHI.js +238 -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 +24 -22
- 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-D7iKcLFe.d.ts} +1 -1
- package/dist/{replay-BsOyTrdV.js → replay-Du1tJjG7.js} +2 -1
- package/dist/{request-context-BVM7aWNs.js → request-context-BTRTG7OT.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-BA8an5Ap.js +336 -0
- package/dist/{rls-BEktUaqg.js → rls-j6t43t7n.js} +287 -689
- package/dist/{role-builder-B4GbKM-i.js → role-builder-CXbis5-X.js} +14 -207
- package/dist/{rpc-nYC3cR_u.js → rpc-aPyNi6tA.js} +7 -7
- package/dist/run-CNsApDpd.js +1 -0
- package/dist/run-DOfMtc9V.js +723 -0
- package/dist/run-ticket-BjhTOi6u.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-FO-Q8oj0.js} +16 -14
- package/dist/scan-BOI5tJ-6.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-DqCT4CgZ.js +453 -0
- package/dist/{server-types-DdqBwZN_.d.ts → server-types-BLd4MnBX.d.ts} +51 -68
- package/dist/{sha256-BO0swRXL.js → sha256-D9ihqmvd.js} +8 -1
- package/dist/{shared-1uhI-e-b.js → shared-CD11nBbC.js} +18 -8
- package/dist/{shared-JhMeOsDF.js → shared-DvvFzYXe.js} +8 -9
- package/dist/signals-D3NcTKUS.js +32 -0
- package/dist/sink-BEZSlMS_.js +957 -0
- package/dist/sink-Bj_lDUDq.d.ts +225 -0
- package/dist/{skills-BZdRQkxs.js → skills-B6lVdD_W.js} +13 -6
- package/dist/skills-CTYwkl44.js +51 -0
- package/dist/snapshot-CXUWfsNy.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-DqK9eDmM.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-BV9j0DeZ.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-DLfUWFAI.js +1851 -0
- package/dist/ssf/index.d.ts +4 -4
- package/dist/ssf/index.js +384 -47
- package/dist/standard-webhooks-6lg8v_is.d.ts +88 -0
- package/dist/standard-webhooks-DgFFD-Ga.js +228 -0
- package/dist/storage-C2bWdvJH.js +132 -0
- package/dist/{store-ILkLUj_o.js → store-4u_hxjWa.js} +40 -53
- package/dist/{store-options-CbUHDoSe.js → store-options-BqEakYRa.js} +26 -21
- package/dist/{stores-BHXdSbw9.js → stores-BbsD4fAR.js} +2 -2
- package/dist/{stores-Cxz_80g-.d.ts → stores-ClZUgeoP.d.ts} +7 -8
- package/dist/{stream-Dwsg6WwE.d.ts → stream-7-xmnf3U.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-9pqI57pW.js +92 -0
- package/dist/{supabase-C1TWlnYt.js → supabase-Dxlp8A94.js} +98 -205
- package/dist/supabase-hook-CXcGpHqq.js +1 -0
- package/dist/{supabase-hook-Cva3ikXz.js → supabase-hook-DdDQhMlw.js} +951 -60
- 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-7rJVLWe5.d.ts → types-5Ut_pbKy.d.ts} +61 -11
- package/dist/{store-9KO4BlkB.d.ts → types-BNORmDM8.d.ts} +100 -75
- package/dist/types-BjV-fqcA.d.ts +57 -0
- package/dist/{types-CUcFZfpU.d.ts → types-BqAKcRNW.d.ts} +2 -1
- package/dist/types-C8-KNsFf.d.ts +107 -0
- package/dist/{types-Br9IXUBG.d.ts → types-CCpc2Dcv.d.ts} +77 -17
- package/dist/{types-DpWfQdSh.d.ts → types-CZTnPFzM.d.ts} +46 -11
- package/dist/{types-CqrjB9o6.d.ts → types-CdlxsYQh.d.ts} +23 -11
- package/dist/{types-CIlTojhq.d.ts → types-ClZaWzfb.d.ts} +9 -6
- package/dist/types-DX0LaKTb.d.ts +157 -0
- package/dist/types-DiQjupG2.d.ts +332 -0
- package/dist/types-DqzsnlSA.js +67 -0
- package/dist/types-_sHy8BQf.d.ts +65 -0
- package/dist/{types-ByUo56un.d.ts → types-fbZ7JEXr.d.ts} +23 -22
- package/dist/{types-DHrmBJLH.d.ts → types-tIgIeIKJ.d.ts} +7 -7
- package/dist/unplugin/index.d.ts +1 -1
- package/dist/unplugin/index.js +2 -2
- package/dist/usage-CHOtwL19.js +1 -0
- package/dist/usage-DHtE8j4E.js +32 -0
- package/dist/{usage-CG9nOYZw.js → usage-T5mXq98v.js} +54 -11
- package/dist/{validation-error-BSSw0l_8.d.ts → validation-error-Bg5Tpluk.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-DbCL9bnB.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-D6lPdb4Z.d.ts} +65 -2
- package/dist/vue/index.d.ts +9 -10
- package/dist/vue/index.js +8 -8
- package/dist/waiter-BGUtGYoU.js +67 -0
- package/dist/waiter-CKy4MQSY.d.ts +36 -0
- package/dist/watch-Cb-NcaUw.js +1 -0
- package/dist/{watch-zeucB7eF.js → watch-CszoTJMq.js} +44 -5
- package/dist/webmcp/index.d.ts +2 -2
- package/dist/webmcp/index.js +3 -3
- package/dist/where-scope-Dv-WTP-w.js +306 -0
- package/dist/who-can-D0QoYbEb.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-Bd1Tejur.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 +9 -8
- 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 +5 -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/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-D6lPdb4Z.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
|
};
|
|
@@ -287,7 +302,13 @@ type CustomRole = TenantCustomRole | GlobalCustomRole;
|
|
|
287
302
|
type Principal = {
|
|
288
303
|
readonly id: string;
|
|
289
304
|
readonly issuer?: string;
|
|
290
|
-
|
|
305
|
+
/**
|
|
306
|
+
* `contact`: an external person (a customer contact, a portal user). Only
|
|
307
|
+
* its `{ on }` memberships count; it never approves, creates keys or
|
|
308
|
+
* publishes, and is read-only unless a role whose `for` lists `contact`
|
|
309
|
+
* grants the write.
|
|
310
|
+
*/
|
|
311
|
+
readonly kind?: "user" | "service" | "workload" | "link" | "feed" | "contact";
|
|
291
312
|
readonly roles?: readonly string[];
|
|
292
313
|
readonly plans?: readonly string[];
|
|
293
314
|
readonly memberships?: readonly Membership[];
|
|
@@ -302,9 +323,9 @@ type Principal = {
|
|
|
302
323
|
};
|
|
303
324
|
type Actor = {
|
|
304
325
|
readonly id: string;
|
|
305
|
-
readonly kind:
|
|
326
|
+
readonly kind: ActorKind;
|
|
306
327
|
readonly binding?: Binding;
|
|
307
|
-
/** `true`
|
|
328
|
+
/** `true` denies every permission without `readOnlyHint` (`not-delegated`), with or without a policy delegation. */
|
|
308
329
|
readonly readOnly?: boolean;
|
|
309
330
|
/** 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
331
|
readonly client?: string;
|
|
@@ -340,12 +361,12 @@ type Subject<TPrincipal extends Principal = Principal> = {
|
|
|
340
361
|
};
|
|
341
362
|
//#endregion
|
|
342
363
|
//#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";
|
|
364
|
+
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
365
|
/** The `detail` each denial reason carries, where PermDock sets a structured one. */
|
|
345
366
|
type DenialDetails = {
|
|
346
367
|
readonly limit: LimitDetail;
|
|
347
368
|
/** The window the inactive allow applies in. */
|
|
348
|
-
readonly "inactive-grant":
|
|
369
|
+
readonly "inactive-grant": WireValidity;
|
|
349
370
|
/** The matching deny's declared `name`. */
|
|
350
371
|
readonly deny: {
|
|
351
372
|
readonly name?: string;
|
|
@@ -399,19 +420,19 @@ type AppObligation = {
|
|
|
399
420
|
readonly name: string;
|
|
400
421
|
readonly detail?: MetaValue;
|
|
401
422
|
};
|
|
402
|
-
/** What is left of the `limit` that applied; `resetsAt` is
|
|
423
|
+
/** What is left of the `limit` that applied; `resetsAt` is RFC 3339. */
|
|
403
424
|
type Quota = {
|
|
404
425
|
readonly remaining: number;
|
|
405
|
-
readonly resetsAt:
|
|
426
|
+
readonly resetsAt: string;
|
|
406
427
|
};
|
|
407
428
|
/**
|
|
408
|
-
* The `detail` of a `limit` denial: the grant's `count`, its window
|
|
409
|
-
* seconds and when the window resets (
|
|
429
|
+
* The `detail` of a `limit` denial: the grant's `count`, its `per` window
|
|
430
|
+
* in seconds and when the window resets (RFC 3339).
|
|
410
431
|
*/
|
|
411
432
|
type LimitDetail = {
|
|
412
433
|
readonly count: number;
|
|
413
|
-
readonly
|
|
414
|
-
readonly resetsAt:
|
|
434
|
+
readonly per: number;
|
|
435
|
+
readonly resetsAt: string;
|
|
415
436
|
};
|
|
416
437
|
/**
|
|
417
438
|
* Why a candidate grant for the permission was passed over before its
|
|
@@ -596,65 +617,35 @@ declare function allOf(...items: readonly ApproverInput[]): readonly ApproverInp
|
|
|
596
617
|
/** A named approver for `approval.by`, matched on the approver's principal id. */
|
|
597
618
|
declare function user(id: string): UserApprover;
|
|
598
619
|
//#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
|
|
620
|
+
//#region src/core/scopes.d.ts
|
|
621
|
+
/** One entry of `definePolicy({ scopes })`: the row field holding the scope id, and its parent scope. */
|
|
622
|
+
type ScopeDeclaration = {
|
|
623
|
+
readonly key: string;
|
|
624
|
+
readonly within?: string;
|
|
625
|
+
};
|
|
626
|
+
type PolicyScopesInput = Readonly<Record<string, ScopeDeclaration>>;
|
|
631
627
|
/**
|
|
632
|
-
*
|
|
633
|
-
* `
|
|
634
|
-
* (RLS never compiles it) and grants only once its `requires` are met.
|
|
628
|
+
* A declared scope, in declaration order. `key` is absent only on the
|
|
629
|
+
* implicit `tenant` / `team` pair of a policy that declares no scopes.
|
|
635
630
|
*/
|
|
636
|
-
|
|
631
|
+
type Scope = {
|
|
632
|
+
readonly name: string;
|
|
633
|
+
readonly key?: string;
|
|
634
|
+
readonly within?: string;
|
|
635
|
+
};
|
|
636
|
+
/** The names `role(..., { on })`, `memberOf` and memberships may use: declared names plus the aliases. */
|
|
637
|
+
type ScopeNames<S> = [S] extends [PolicyScopesInput] ? string extends keyof S ? string : (keyof S & string) | "tenant" | "team" : string;
|
|
638
|
+
//#endregion
|
|
639
|
+
//#region src/core/wire-delegation.d.ts
|
|
637
640
|
/**
|
|
638
|
-
*
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
* scoped to `via: 'support'`.
|
|
641
|
+
* A delegation as every PermDock wire form carries it: OAuth `scope`
|
|
642
|
+
* (RFC 6749, space-separated) and RFC 9396 `authorization_details`. An empty
|
|
643
|
+
* `scope` is an empty scope list, which delegates nothing.
|
|
642
644
|
*/
|
|
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;
|
|
645
|
+
type WireDelegation = {
|
|
646
|
+
readonly scope?: string;
|
|
647
|
+
readonly authorization_details?: readonly AuthorizationDetail[];
|
|
648
|
+
readonly access?: readonly GnapAccess[];
|
|
658
649
|
};
|
|
659
650
|
//#endregion
|
|
660
651
|
//#region src/core/wire-denial.d.ts
|
|
@@ -679,7 +670,8 @@ type WireDecision = GrantedDecision | ApprovalRequiredDecision | (Omit<DeniedDec
|
|
|
679
670
|
type DirectoryEvent = {
|
|
680
671
|
readonly type: "directory";
|
|
681
672
|
readonly at: string;
|
|
682
|
-
|
|
673
|
+
/** `scim`, or an integrator's own directory sync. */
|
|
674
|
+
readonly source: OpenUnion<"scim">;
|
|
683
675
|
readonly operation: "create" | "replace" | "patch" | "delete";
|
|
684
676
|
readonly tenant: string;
|
|
685
677
|
readonly resource: {
|
|
@@ -693,6 +685,8 @@ type DirectoryEvent = {
|
|
|
693
685
|
readonly iss?: string;
|
|
694
686
|
};
|
|
695
687
|
readonly active?: boolean;
|
|
688
|
+
/** The application's own data, set where the event is built; plain JSON, never read by a decision. */
|
|
689
|
+
readonly x?: AppData;
|
|
696
690
|
};
|
|
697
691
|
type MembershipEvent = {
|
|
698
692
|
readonly type: "membership";
|
|
@@ -708,9 +702,9 @@ type MembershipEvent = {
|
|
|
708
702
|
readonly id?: string;
|
|
709
703
|
/** The id of every ancestor scope, keyed by scope name. */
|
|
710
704
|
readonly within?: Readonly<Record<string, string>>;
|
|
711
|
-
readonly via?:
|
|
712
|
-
/** When the membership lapses,
|
|
713
|
-
readonly expiresAt?:
|
|
705
|
+
readonly via?: MembershipVia;
|
|
706
|
+
/** When the membership lapses, an RFC 3339 instant. */
|
|
707
|
+
readonly expiresAt?: string;
|
|
714
708
|
readonly roles: {
|
|
715
709
|
readonly added: readonly string[];
|
|
716
710
|
readonly removed: readonly string[];
|
|
@@ -719,6 +713,8 @@ type MembershipEvent = {
|
|
|
719
713
|
readonly id: string;
|
|
720
714
|
readonly kind: string;
|
|
721
715
|
};
|
|
716
|
+
/** The application's own data, set where the event is built; plain JSON, never read by a decision. */
|
|
717
|
+
readonly x?: AppData;
|
|
722
718
|
};
|
|
723
719
|
/**
|
|
724
720
|
* An API key's lifecycle: `created`, `rotated` and `revoked` from the
|
|
@@ -738,14 +734,105 @@ type CredentialEvent = {
|
|
|
738
734
|
readonly id: string;
|
|
739
735
|
};
|
|
740
736
|
readonly tenant?: string;
|
|
741
|
-
|
|
737
|
+
/** When the key expires, an RFC 3339 instant. */
|
|
738
|
+
readonly expiresAt?: string;
|
|
742
739
|
readonly by?: {
|
|
743
740
|
readonly id: string;
|
|
744
741
|
readonly kind: string;
|
|
745
742
|
};
|
|
746
743
|
readonly sample?: number;
|
|
744
|
+
/** The application's own data, set where the event is built; plain JSON, never read by a decision. */
|
|
745
|
+
readonly x?: AppData;
|
|
746
|
+
};
|
|
747
|
+
/**
|
|
748
|
+
* An automation's lifecycle: `published`, `changed` (a new version) and
|
|
749
|
+
* `revoked` from the application, `run` when a run starts. It records the
|
|
750
|
+
* delegation for access review; it never decides.
|
|
751
|
+
*/
|
|
752
|
+
type AutomationEvent = {
|
|
753
|
+
readonly type: "automation";
|
|
754
|
+
readonly at: string;
|
|
755
|
+
readonly source: string;
|
|
756
|
+
readonly operation: "published" | "changed" | "revoked" | "run";
|
|
757
|
+
readonly automation: {
|
|
758
|
+
readonly id: string;
|
|
759
|
+
readonly version: number | string;
|
|
760
|
+
readonly mode: "publisher" | "service";
|
|
761
|
+
readonly name?: string;
|
|
762
|
+
};
|
|
763
|
+
/** The principal each run acts as. */
|
|
764
|
+
readonly principal: {
|
|
765
|
+
readonly id: string;
|
|
766
|
+
};
|
|
767
|
+
readonly publishedBy: string;
|
|
768
|
+
readonly tenant?: string;
|
|
769
|
+
readonly roles?: readonly string[];
|
|
770
|
+
/** The delegated permission keys. */
|
|
771
|
+
readonly permissions: readonly string[];
|
|
772
|
+
/** Set on `run` events only. */
|
|
773
|
+
readonly run?: {
|
|
774
|
+
readonly id: string;
|
|
775
|
+
};
|
|
776
|
+
readonly by?: {
|
|
777
|
+
readonly id: string;
|
|
778
|
+
readonly kind: string;
|
|
779
|
+
};
|
|
780
|
+
/** The application's own data, set where the event is built; plain JSON, never read by a decision. */
|
|
781
|
+
readonly x?: AppData;
|
|
782
|
+
};
|
|
783
|
+
type SinkEvent = DecisionEvent | DirectoryEvent | MembershipEvent | CredentialEvent | AccessEvent | AutomationEvent | DeliveryEvent;
|
|
784
|
+
/** A delivery channel: an email, a chat message or an outbound webhook. */
|
|
785
|
+
type DeliveryChannel = "email" | "chat" | "webhook";
|
|
786
|
+
/** What an email is for; only `notification` mail carries `List-Unsubscribe`. */
|
|
787
|
+
type EmailCategory = "transactional" | "notification" | "security" | "approval";
|
|
788
|
+
/**
|
|
789
|
+
* Why a delivery failed. `denied` and `unlinked` are the router's refusals of
|
|
790
|
+
* a recipient; the rest come from a transport or a provider webhook.
|
|
791
|
+
*/
|
|
792
|
+
type DeliveryFailureCause = "denied" | "unlinked" | "no-transport" | "no-message" | "invalid-recipient" | "invalid-message" | "rate-limited" | "quota-exceeded" | "unauthorized" | "unavailable" | "suppressed" | "rejected";
|
|
793
|
+
/**
|
|
794
|
+
* One recipient's delivery: `sent` when a transport accepted it, then
|
|
795
|
+
* `delivered`, `bounced` or `complained` from the provider, or `failed`.
|
|
796
|
+
* It carries no address, only the principal the router checked.
|
|
797
|
+
*/
|
|
798
|
+
type DeliveryEvent = {
|
|
799
|
+
readonly type: "delivery";
|
|
800
|
+
readonly at: string;
|
|
801
|
+
readonly source: string;
|
|
802
|
+
readonly operation: "sent" | "delivered" | "bounced" | "complained" | "failed";
|
|
803
|
+
readonly channel: DeliveryChannel;
|
|
804
|
+
/** The delivery's id and this recipient's key, sent as the `Idempotency-Key`. */
|
|
805
|
+
readonly delivery: {
|
|
806
|
+
readonly id: string;
|
|
807
|
+
readonly key: string;
|
|
808
|
+
};
|
|
809
|
+
/** The checked principal, or `trusted` for an address the server loaded itself. */
|
|
810
|
+
readonly recipient?: {
|
|
811
|
+
readonly principal?: {
|
|
812
|
+
readonly id: string;
|
|
813
|
+
};
|
|
814
|
+
readonly trusted?: true;
|
|
815
|
+
};
|
|
816
|
+
/** The permission the recipient was checked for. */
|
|
817
|
+
readonly permission?: string;
|
|
818
|
+
readonly tenant?: string;
|
|
819
|
+
readonly category?: EmailCategory;
|
|
820
|
+
/** The approval request a prompt was delivered for. */
|
|
821
|
+
readonly approval?: string;
|
|
822
|
+
/** The transport or provider, and its message id. */
|
|
823
|
+
readonly provider?: {
|
|
824
|
+
readonly name: string;
|
|
825
|
+
readonly id?: string;
|
|
826
|
+
};
|
|
827
|
+
/** Set on `failed` only. */
|
|
828
|
+
readonly cause?: DeliveryFailureCause;
|
|
829
|
+
/** Set on `failed` only: whether a retry with the same key may succeed. */
|
|
830
|
+
readonly retryable?: boolean;
|
|
831
|
+
/** The denial reason when `cause` is `denied`. */
|
|
832
|
+
readonly reason?: string;
|
|
833
|
+
/** The application's own data, set where the event is built; plain JSON, never read by a decision. */
|
|
834
|
+
readonly x?: AppData;
|
|
747
835
|
};
|
|
748
|
-
type SinkEvent = DecisionEvent | DirectoryEvent | MembershipEvent | CredentialEvent | AccessEvent;
|
|
749
836
|
/**
|
|
750
837
|
* A support-access session lifecycle event: a tenant consented to vendor
|
|
751
838
|
* support (`started`), the session lapsed (`ended`), or the tenant pulled
|
|
@@ -762,12 +849,13 @@ type AccessEvent = {
|
|
|
762
849
|
readonly id: string;
|
|
763
850
|
};
|
|
764
851
|
/** The membership kind the session runs under (`support`). */
|
|
765
|
-
readonly via:
|
|
852
|
+
readonly via: MembershipVia;
|
|
766
853
|
readonly roles: readonly string[];
|
|
767
854
|
readonly member?: {
|
|
768
855
|
readonly group: string;
|
|
769
856
|
};
|
|
770
|
-
|
|
857
|
+
/** When the session lapses, an RFC 3339 instant. */
|
|
858
|
+
readonly expiresAt?: string;
|
|
771
859
|
/** The tenant principal that consented. */
|
|
772
860
|
readonly grantedBy?: string;
|
|
773
861
|
readonly reason?: string;
|
|
@@ -775,9 +863,19 @@ type AccessEvent = {
|
|
|
775
863
|
readonly id: string;
|
|
776
864
|
readonly kind: string;
|
|
777
865
|
};
|
|
866
|
+
/** A `SupportSession`: its id and the principal the staff member views as. */
|
|
867
|
+
readonly session?: {
|
|
868
|
+
readonly id: string;
|
|
869
|
+
readonly principal: string;
|
|
870
|
+
};
|
|
871
|
+
/** A `SupportSession`'s permission keys. */
|
|
872
|
+
readonly permissions?: readonly string[];
|
|
873
|
+
/** The application's own data, set where the event is built; plain JSON, never read by a decision. */
|
|
874
|
+
readonly x?: AppData;
|
|
778
875
|
};
|
|
779
876
|
type DecisionEvent = {
|
|
780
877
|
readonly type: "decision";
|
|
878
|
+
/** An RFC 3339 instant. */
|
|
781
879
|
readonly at: string;
|
|
782
880
|
readonly outcome: "granted" | "denied" | "approval-required";
|
|
783
881
|
readonly permission: string;
|
|
@@ -796,18 +894,23 @@ type DecisionEvent = {
|
|
|
796
894
|
readonly id: string;
|
|
797
895
|
readonly kind: string;
|
|
798
896
|
};
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
readonly authorizationDetails?: readonly unknown[];
|
|
802
|
-
};
|
|
897
|
+
/** OAuth `scope` and RFC 9396 `authorization_details`, as every wire form carries a delegation. */
|
|
898
|
+
readonly delegation?: WireDelegation;
|
|
803
899
|
/** The API key the subject came from. */
|
|
804
900
|
readonly credential?: {
|
|
805
901
|
readonly id: string;
|
|
806
902
|
readonly kind: CredentialKind;
|
|
807
903
|
};
|
|
904
|
+
/** The support session the subject came from: the `id` its `access` events carry as `session.id`. */
|
|
905
|
+
readonly supportSession?: {
|
|
906
|
+
readonly id: string;
|
|
907
|
+
};
|
|
808
908
|
};
|
|
809
909
|
readonly tenant?: string;
|
|
810
|
-
|
|
910
|
+
/** The membership that answered, with `expiresAt` as an RFC 3339 instant. */
|
|
911
|
+
readonly membership?: Omit<Membership, "expiresAt"> & {
|
|
912
|
+
readonly expiresAt?: string;
|
|
913
|
+
};
|
|
811
914
|
readonly via?: string | null;
|
|
812
915
|
readonly matched?: {
|
|
813
916
|
readonly role: string | null;
|
|
@@ -830,19 +933,27 @@ type DecisionEvent = {
|
|
|
830
933
|
readonly alternatives?: readonly string[];
|
|
831
934
|
readonly token?: string;
|
|
832
935
|
readonly trusted: boolean;
|
|
833
|
-
|
|
834
|
-
readonly adapter
|
|
835
|
-
readonly
|
|
936
|
+
/** The call that produced the decision. */
|
|
937
|
+
readonly call: "can" | "decide" | "assert" | "filter" | "endpoint" | "adapter" | "approval" | "simulate" | "explain";
|
|
938
|
+
readonly adapter?: AdapterId;
|
|
939
|
+
/** The model id the agent model gate decided, or the model that drove the call. */
|
|
940
|
+
readonly model?: string;
|
|
941
|
+
/** Set on an approval lifecycle event (`com.permdock.approval.<phase>`). */
|
|
942
|
+
readonly phase?: "requested" | "resolved" | "expired" | "cancelled";
|
|
836
943
|
readonly counts?: {
|
|
837
944
|
readonly granted: number;
|
|
838
945
|
readonly denied: number;
|
|
839
946
|
readonly approvalRequired: number;
|
|
840
947
|
};
|
|
948
|
+
/** The application's own data, set where the event is built; plain JSON, never read by a decision. */
|
|
949
|
+
readonly x?: AppData;
|
|
841
950
|
};
|
|
842
951
|
type AuthEvent = {
|
|
843
952
|
readonly reason: "invalid-token" | "schema" | "unknown-role" | "groups-overflow" | "source-threw";
|
|
844
953
|
readonly cause?: string;
|
|
845
954
|
readonly source: string;
|
|
955
|
+
/** The `name` of the source that threw, when it has one. */
|
|
956
|
+
readonly name?: string;
|
|
846
957
|
readonly kid?: string;
|
|
847
958
|
readonly alg?: string;
|
|
848
959
|
readonly typ?: string;
|
|
@@ -850,91 +961,11 @@ type AuthEvent = {
|
|
|
850
961
|
readonly requestId?: string;
|
|
851
962
|
};
|
|
852
963
|
//#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
964
|
//#region src/core/snapshot-types.d.ts
|
|
935
965
|
type Snapshot = {
|
|
936
966
|
readonly v: 1;
|
|
937
|
-
|
|
967
|
+
/** RFC 3339. The epoch for a snapshot built without a clock. Signed, it is the token's `iat`. */
|
|
968
|
+
readonly issuedAt: string;
|
|
938
969
|
readonly subject: {
|
|
939
970
|
readonly principal: {
|
|
940
971
|
readonly id: string;
|
|
@@ -943,7 +974,8 @@ type Snapshot = {
|
|
|
943
974
|
readonly tenant?: string;
|
|
944
975
|
readonly memberships?: readonly Membership[];
|
|
945
976
|
} | null;
|
|
946
|
-
|
|
977
|
+
/** OAuth `scope` and RFC 9396 `authorization_details`, as the token carried them. */
|
|
978
|
+
readonly delegation?: WireDelegation;
|
|
947
979
|
readonly context: Readonly<Record<string, unknown>>;
|
|
948
980
|
};
|
|
949
981
|
/** Roles held in the active tenant, in rank order. */
|
|
@@ -954,7 +986,8 @@ type Snapshot = {
|
|
|
954
986
|
readonly tenants: readonly string[];
|
|
955
987
|
readonly include?: readonly string[];
|
|
956
988
|
readonly simulated?: true;
|
|
957
|
-
|
|
989
|
+
/** RFC 3339. Signed, it is the token's `exp`. */
|
|
990
|
+
readonly expiresAt?: string;
|
|
958
991
|
readonly vocabulary?: {
|
|
959
992
|
readonly roles?: Readonly<Record<string, Role>>;
|
|
960
993
|
readonly plans?: Readonly<Record<string, Plan>>;
|
|
@@ -1020,8 +1053,8 @@ type SnapshotGrant = {
|
|
|
1020
1053
|
readonly membership?: Membership;
|
|
1021
1054
|
readonly portable?: false;
|
|
1022
1055
|
readonly fields?: readonly string[];
|
|
1023
|
-
/** When the grant applies (
|
|
1024
|
-
readonly validity?:
|
|
1056
|
+
/** When the grant applies (RFC 3339, `from` inclusive, `until` exclusive); absent means always. */
|
|
1057
|
+
readonly validity?: WireValidity;
|
|
1025
1058
|
/** The grant's declared `name`. */
|
|
1026
1059
|
readonly name?: string;
|
|
1027
1060
|
/** The grant's declared `meta`; visible to the client that holds the snapshot. */
|
|
@@ -1058,409 +1091,34 @@ type LocalCustomRoleTable = {
|
|
|
1058
1091
|
readonly includes: Readonly<Record<string, readonly SnapshotGrant[]>>;
|
|
1059
1092
|
};
|
|
1060
1093
|
//#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
|
-
};
|
|
1094
|
+
//#region src/core/time.d.ts
|
|
1091
1095
|
/**
|
|
1092
|
-
*
|
|
1093
|
-
*
|
|
1094
|
-
*
|
|
1095
|
-
* an unavailable relation): holders may be missing, so check with `decide`.
|
|
1096
|
+
* The one time rule: NumericDate (whole seconds) for JWT registered claims
|
|
1097
|
+
* and the claims SQL reads, RFC 3339 for every other JSON field, integer
|
|
1098
|
+
* seconds for durations, and an `Instant` for every runtime `now`.
|
|
1096
1099
|
*/
|
|
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
|
-
};
|
|
1125
|
-
/**
|
|
1126
|
-
* Data-driven approval requirements, a subject input like `RoleSource`:
|
|
1127
|
-
* read once per instance for the subject's tenants (entries without a
|
|
1128
|
-
* tenant always apply). A throw, a rejected promise or an invalid entry
|
|
1129
|
-
* denies every call an allow would otherwise permit.
|
|
1130
|
-
*/
|
|
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
1100
|
/**
|
|
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`.
|
|
1101
|
+
* The part of a `Temporal.Instant` PermDock reads. Public options take it
|
|
1102
|
+
* structurally so their declarations compile under a TypeScript lib without
|
|
1103
|
+
* `Temporal` (5.9); every `Temporal.Instant` satisfies it.
|
|
1147
1104
|
*/
|
|
1148
|
-
type
|
|
1149
|
-
|
|
1150
|
-
readonly ok: true;
|
|
1151
|
-
} | {
|
|
1152
|
-
readonly ok: false;
|
|
1153
|
-
readonly problem: ApprovalPolicyProblem;
|
|
1105
|
+
type Instant = {
|
|
1106
|
+
readonly epochMilliseconds: number;
|
|
1154
1107
|
};
|
|
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
1108
|
//#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
|
-
};
|
|
1109
|
+
//#region src/core/internals.d.ts
|
|
1184
1110
|
/**
|
|
1185
|
-
*
|
|
1186
|
-
*
|
|
1111
|
+
* Any instance a feature function accepts: a server `PermDock`, one built
|
|
1112
|
+
* from a snapshot, or an adapter's wrapper such as `PdpPermDock`.
|
|
1187
1113
|
*/
|
|
1188
|
-
type
|
|
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;
|
|
1205
|
-
/**
|
|
1206
|
-
* The code policy plus the hosted grants that pass every rule. Hosted
|
|
1207
|
-
* allows OR with code allows and any deny still wins, so a hosted grant can
|
|
1208
|
-
* never override a code deny; one that fails a rule is dropped, not thrown.
|
|
1209
|
-
*/
|
|
1210
|
-
declare function mergeHostedGrants(policy: Policy, document: PolicyDocument | null): {
|
|
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"];
|
|
1114
|
+
type InstanceHandle = {
|
|
1423
1115
|
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
1116
|
};
|
|
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
|
-
};
|
|
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
1117
|
//#endregion
|
|
1462
1118
|
//#region src/core/credential.d.ts
|
|
1463
|
-
type CredentialKind = "user" | "service";
|
|
1119
|
+
type CredentialKind = "user" | "service" | "feed";
|
|
1120
|
+
/** 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. */
|
|
1121
|
+
declare function isFeedId(value: string): boolean;
|
|
1464
1122
|
/** One permission (a key) a credential may use: on every instance, or only on `ids`. */
|
|
1465
1123
|
type CredentialPermission = {
|
|
1466
1124
|
readonly permission: string;
|
|
@@ -1485,17 +1143,22 @@ type Credential = {
|
|
|
1485
1143
|
* credential, where it keeps only the owner's memberships inside it.
|
|
1486
1144
|
*/
|
|
1487
1145
|
readonly tenant?: string;
|
|
1488
|
-
/** Service
|
|
1146
|
+
/** Service: the roles it holds in `tenant`. Feed: the resource roles it holds on `on`. */
|
|
1489
1147
|
readonly roles?: readonly string[];
|
|
1148
|
+
/** Feed only: the resource instance the roles are held on. */
|
|
1149
|
+
readonly on?: {
|
|
1150
|
+
readonly resource: string;
|
|
1151
|
+
readonly id: string;
|
|
1152
|
+
};
|
|
1490
1153
|
readonly permissions: readonly CredentialPermission[];
|
|
1491
1154
|
readonly createdBy: string;
|
|
1492
|
-
/**
|
|
1493
|
-
readonly createdAt:
|
|
1494
|
-
/**
|
|
1495
|
-
readonly expiresAt?:
|
|
1155
|
+
/** RFC 3339. */
|
|
1156
|
+
readonly createdAt: string;
|
|
1157
|
+
/** RFC 3339; absent only where a credential policy allows it. */
|
|
1158
|
+
readonly expiresAt?: string;
|
|
1496
1159
|
readonly name?: string;
|
|
1497
1160
|
};
|
|
1498
|
-
type
|
|
1161
|
+
type ApiKeyPrincipal = Principal & {
|
|
1499
1162
|
readonly credential: Credential;
|
|
1500
1163
|
};
|
|
1501
1164
|
/**
|
|
@@ -1520,7 +1183,8 @@ type CredentialPermissionInput = Permission | {
|
|
|
1520
1183
|
type CredentialRequestBase = {
|
|
1521
1184
|
readonly id: string;
|
|
1522
1185
|
readonly permissions: readonly CredentialPermissionInput[];
|
|
1523
|
-
|
|
1186
|
+
/** RFC 3339; must be after `now`. */
|
|
1187
|
+
readonly expiresAt?: string;
|
|
1524
1188
|
readonly name?: string;
|
|
1525
1189
|
};
|
|
1526
1190
|
type CredentialRequest = (CredentialRequestBase & {
|
|
@@ -1533,6 +1197,15 @@ type CredentialRequest = (CredentialRequestBase & {
|
|
|
1533
1197
|
readonly principal?: string;
|
|
1534
1198
|
readonly tenant: string;
|
|
1535
1199
|
readonly roles: readonly string[];
|
|
1200
|
+
}) | (CredentialRequestBase & {
|
|
1201
|
+
readonly kind: "feed";
|
|
1202
|
+
readonly on: {
|
|
1203
|
+
readonly resource: Permission | PermissionTree;
|
|
1204
|
+
readonly id: string;
|
|
1205
|
+
};
|
|
1206
|
+
readonly roles: readonly string[];
|
|
1207
|
+
/** A row the server loaded. Each permission must be granted on it. */
|
|
1208
|
+
readonly row: unknown;
|
|
1536
1209
|
});
|
|
1537
1210
|
type CredentialDecision = {
|
|
1538
1211
|
readonly outcome: "granted";
|
|
@@ -1551,8 +1224,8 @@ type DecideCredentialOptions = {
|
|
|
1551
1224
|
readonly settings?: SettingsSource;
|
|
1552
1225
|
/** The `token` of an approval the application consumed for this request. */
|
|
1553
1226
|
readonly approved?: string;
|
|
1554
|
-
/**
|
|
1555
|
-
readonly now?:
|
|
1227
|
+
/** The creation time; defaults to the clock. */
|
|
1228
|
+
readonly now?: Instant;
|
|
1556
1229
|
};
|
|
1557
1230
|
/**
|
|
1558
1231
|
* The first rule of `policy` the credential breaks, or `undefined`. A key
|
|
@@ -1574,20 +1247,6 @@ declare function parseCredential(input: unknown): Credential | undefined;
|
|
|
1574
1247
|
* key is gone delegates nothing and every check is denied.
|
|
1575
1248
|
*/
|
|
1576
1249
|
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
1250
|
/**
|
|
1592
1251
|
* Decides whether the subject of `permdock` may create the credential in
|
|
1593
1252
|
* `request`. The creator must be a signed-in user or service that is not
|
|
@@ -1602,7 +1261,113 @@ declare function credentialSubject(credential: Credential, options: {
|
|
|
1602
1261
|
* its token. PermDock never stores the credential; the application does,
|
|
1603
1262
|
* after a `granted` result.
|
|
1604
1263
|
*/
|
|
1605
|
-
|
|
1264
|
+
/**
|
|
1265
|
+
* Decides whether the subject of `permdock` may create the credential in
|
|
1266
|
+
* `request`: the creator's own reach, the `credentials` policy of the key's
|
|
1267
|
+
* tenant (the call's `settings`, else the instance's), and `approval`.
|
|
1268
|
+
* PermDock never stores the credential; the application does, after a
|
|
1269
|
+
* `granted` result. An instance built from a snapshot denies with
|
|
1270
|
+
* `unsupported`.
|
|
1271
|
+
*/
|
|
1272
|
+
declare function decideCredential(permdock: InstanceHandle, request: CredentialRequest, options?: DecideCredentialOptions): Promise<CredentialDecision>;
|
|
1273
|
+
//#endregion
|
|
1274
|
+
//#region src/core/support-session.d.ts
|
|
1275
|
+
/**
|
|
1276
|
+
* SupportSession v1: a support staff member (`actor`, kind `support`)
|
|
1277
|
+
* viewing the app as `principal` in `tenant`, for a stated `reason`. Each
|
|
1278
|
+
* request in the session acts as `principal` with their live rights,
|
|
1279
|
+
* narrowed to `permissions`.
|
|
1280
|
+
*/
|
|
1281
|
+
type SupportSession = {
|
|
1282
|
+
readonly v: 1;
|
|
1283
|
+
readonly id: string;
|
|
1284
|
+
/** The person the session views the app as. */
|
|
1285
|
+
readonly principal: string;
|
|
1286
|
+
/** The support staff member running the session. */
|
|
1287
|
+
readonly actor: string;
|
|
1288
|
+
readonly tenant: string;
|
|
1289
|
+
readonly reason: string;
|
|
1290
|
+
/** The delegation: permission keys, read-only unless listed on purpose. */
|
|
1291
|
+
readonly permissions: readonly string[];
|
|
1292
|
+
/** RFC 3339. */
|
|
1293
|
+
readonly startedAt: string;
|
|
1294
|
+
/** RFC 3339. */
|
|
1295
|
+
readonly expiresAt: string;
|
|
1296
|
+
/** Who approved the session; never `actor`. */
|
|
1297
|
+
readonly approvedBy?: string;
|
|
1298
|
+
/** The application's ticket or case id. */
|
|
1299
|
+
readonly reference?: string;
|
|
1300
|
+
};
|
|
1301
|
+
/** A tenant's rules for support sessions. Every field only tightens. */
|
|
1302
|
+
type SupportSessionPolicy = {
|
|
1303
|
+
/** No session may start in this tenant. */
|
|
1304
|
+
readonly disabled?: boolean;
|
|
1305
|
+
/** Longest a session may last, in seconds. */
|
|
1306
|
+
readonly maxTtl?: number;
|
|
1307
|
+
/** Only `readOnlyHint` permissions, whatever the request lists. */
|
|
1308
|
+
readonly readOnly?: boolean;
|
|
1309
|
+
};
|
|
1310
|
+
type SupportSessionRequest = {
|
|
1311
|
+
readonly id: string;
|
|
1312
|
+
/** The person to view the app as. */
|
|
1313
|
+
readonly principal: string;
|
|
1314
|
+
/** Defaults to the actor's active tenant. */
|
|
1315
|
+
readonly tenant?: string;
|
|
1316
|
+
/** Required: why the session is needed. */
|
|
1317
|
+
readonly reason: string;
|
|
1318
|
+
/** Defaults to every `readOnlyHint` permission the actor can use. */
|
|
1319
|
+
readonly permissions?: readonly Permission[];
|
|
1320
|
+
/** Seconds the session lasts. Defaults to 3600; at most 86400. */
|
|
1321
|
+
readonly expiresIn?: number;
|
|
1322
|
+
readonly reference?: string;
|
|
1323
|
+
};
|
|
1324
|
+
type SupportSessionDecision = {
|
|
1325
|
+
readonly outcome: "granted";
|
|
1326
|
+
readonly session: SupportSession;
|
|
1327
|
+
} | {
|
|
1328
|
+
readonly outcome: "approval-required";
|
|
1329
|
+
readonly session: SupportSession;
|
|
1330
|
+
/** Bound to the request and the actor; pass it as `approved` to resume. */
|
|
1331
|
+
readonly token: string;
|
|
1332
|
+
} | {
|
|
1333
|
+
readonly outcome: "denied";
|
|
1334
|
+
readonly denials: readonly Denial[];
|
|
1335
|
+
};
|
|
1336
|
+
type DecideSupportSessionOptions = {
|
|
1337
|
+
/** Where the tenant's `supportSessions` policy comes from. */
|
|
1338
|
+
readonly settings?: SettingsSource;
|
|
1339
|
+
/** Approval is required unless this is `false`. */
|
|
1340
|
+
readonly approval?: boolean;
|
|
1341
|
+
/** The `token` of an approval the application consumed for this request. */
|
|
1342
|
+
readonly approved?: string;
|
|
1343
|
+
/** The principal id that approved; required with `approved` and never the actor. */
|
|
1344
|
+
readonly approvedBy?: string;
|
|
1345
|
+
/** The start time; defaults to the clock. */
|
|
1346
|
+
readonly now?: Instant;
|
|
1347
|
+
};
|
|
1348
|
+
/**
|
|
1349
|
+
* Validates an untrusted support-session record and returns a frozen copy
|
|
1350
|
+
* with only the v1 fields, or `undefined`.
|
|
1351
|
+
*/
|
|
1352
|
+
declare function parseSupportSession(input: unknown): SupportSession | undefined;
|
|
1353
|
+
/**
|
|
1354
|
+
* Decides whether the subject of `permdock` may start the support session
|
|
1355
|
+
* in `request`. The actor must be a signed-in person acting for themselves
|
|
1356
|
+
* (`exceeds-creator` otherwise), give a `reason` (`reason-required`), be a
|
|
1357
|
+
* member of the tenant (`tenant-mismatch`) and be able to use every
|
|
1358
|
+
* permission (`exceeds-creator`). Without `permissions` the session gets the
|
|
1359
|
+
* actor's read-only permissions. The tenant's `supportSessions` policy then
|
|
1360
|
+
* applies, and the result is `approval-required` until `approved` carries
|
|
1361
|
+
* its token and `approvedBy` names someone other than the actor.
|
|
1362
|
+
*/
|
|
1363
|
+
/**
|
|
1364
|
+
* Decides whether the subject of `permdock` may start the support session
|
|
1365
|
+
* in `request` and returns the record to sign: a stated reason, membership
|
|
1366
|
+
* of the tenant, the actor's own reach, the tenant's `supportSessions`
|
|
1367
|
+
* policy and approval by someone else. An instance built from a snapshot
|
|
1368
|
+
* denies with `unsupported`.
|
|
1369
|
+
*/
|
|
1370
|
+
declare function decideSupportSession(permdock: InstanceHandle, request: SupportSessionRequest, options?: DecideSupportSessionOptions): Promise<SupportSessionDecision>;
|
|
1606
1371
|
//#endregion
|
|
1607
1372
|
//#region src/core/interfaces.d.ts
|
|
1608
1373
|
type DecisionProvider = {
|
|
@@ -1624,9 +1389,11 @@ type DecisionProvider = {
|
|
|
1624
1389
|
readonly subject: Subject;
|
|
1625
1390
|
}): Promise<readonly string[] | null | undefined>;
|
|
1626
1391
|
};
|
|
1627
|
-
type
|
|
1392
|
+
type CustomRoleSource = {
|
|
1393
|
+
/** Names the implementation in errors and events. */
|
|
1394
|
+
readonly name?: string;
|
|
1628
1395
|
/**
|
|
1629
|
-
* The custom roles of one tenant. `
|
|
1396
|
+
* The custom roles of one tenant. `getPermDock` passes `held`, the role
|
|
1630
1397
|
* names the subject's live memberships hold there, declared or not, so a
|
|
1631
1398
|
* source can skip its read when none of them is a custom role.
|
|
1632
1399
|
*/
|
|
@@ -1644,12 +1411,12 @@ type RoleSource = {
|
|
|
1644
1411
|
}): CustomRole[] | Promise<CustomRole[]>;
|
|
1645
1412
|
};
|
|
1646
1413
|
/**
|
|
1647
|
-
* A `
|
|
1414
|
+
* A `CustomRoleSource` built for the subject the instance serves, for an adapter
|
|
1648
1415
|
* option shared by every request: it gets the resolved subject (principal,
|
|
1649
1416
|
* actor and delegation) and returns that subject's source, or `undefined`
|
|
1650
1417
|
* for none. A throw reads no custom roles and reports `source-threw`.
|
|
1651
1418
|
*/
|
|
1652
|
-
type
|
|
1419
|
+
type CustomRoleSourceFactory = (subject: Subject) => CustomRoleSource | undefined;
|
|
1653
1420
|
/** One member of a scope instance, as `MembershipSource.list` returns it. */
|
|
1654
1421
|
type MemberEntry = {
|
|
1655
1422
|
readonly principal: {
|
|
@@ -1658,6 +1425,8 @@ type MemberEntry = {
|
|
|
1658
1425
|
readonly membership: Membership;
|
|
1659
1426
|
};
|
|
1660
1427
|
type MembershipSource = {
|
|
1428
|
+
/** Names the implementation in errors and events. */
|
|
1429
|
+
readonly name?: string;
|
|
1661
1430
|
membershipsFor(principal: {
|
|
1662
1431
|
readonly id: string;
|
|
1663
1432
|
readonly kind?: string;
|
|
@@ -1730,6 +1499,8 @@ type RelationHolder = HolderPeriod & ({
|
|
|
1730
1499
|
* `relation-unavailable`.
|
|
1731
1500
|
*/
|
|
1732
1501
|
type RelationSource = {
|
|
1502
|
+
/** Names the implementation in errors and events. */
|
|
1503
|
+
readonly name?: string;
|
|
1733
1504
|
/**
|
|
1734
1505
|
* With `through: 'parent'`, the parent chain; with a link name, the one
|
|
1735
1506
|
* instance that link points to (`depth` is then 1).
|
|
@@ -1752,6 +1523,8 @@ type RelationSource = {
|
|
|
1752
1523
|
};
|
|
1753
1524
|
/** Plan and seat names a principal holds in a tenant, from billing (Stripe Entitlements, a table). */
|
|
1754
1525
|
type EntitlementSource = {
|
|
1526
|
+
/** Names the implementation in errors and events. */
|
|
1527
|
+
readonly name?: string;
|
|
1755
1528
|
entitlementsFor(principal: {
|
|
1756
1529
|
readonly id: string;
|
|
1757
1530
|
}, options: {
|
|
@@ -1783,6 +1556,8 @@ type VerificationFailure = {
|
|
|
1783
1556
|
readonly cause: TokenFailureCause;
|
|
1784
1557
|
};
|
|
1785
1558
|
type TokenVerifier<TClaims extends JwtClaims = JwtClaims> = {
|
|
1559
|
+
/** Names the implementation in errors and events. */
|
|
1560
|
+
readonly name?: string;
|
|
1786
1561
|
verify(token: string, expectations: {
|
|
1787
1562
|
readonly typ?: string | readonly string[];
|
|
1788
1563
|
readonly audience?: string | readonly string[];
|
|
@@ -1791,10 +1566,18 @@ type TokenVerifier<TClaims extends JwtClaims = JwtClaims> = {
|
|
|
1791
1566
|
}): Promise<VerifiedToken<TClaims> | VerificationFailure>;
|
|
1792
1567
|
};
|
|
1793
1568
|
type TokenSigner = {
|
|
1569
|
+
/** Names the implementation in errors and events. */
|
|
1570
|
+
readonly name?: string;
|
|
1794
1571
|
sign(payload: Readonly<Record<string, unknown>>, options: {
|
|
1795
|
-
readonly typ: "permdock
|
|
1572
|
+
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";
|
|
1573
|
+
/** `aud`; a signer with no default audience refuses to sign without one. */
|
|
1796
1574
|
readonly audience?: string | readonly string[];
|
|
1575
|
+
/** `exp`, a NumericDate; one hour after `iat` when absent. */
|
|
1797
1576
|
readonly expiresAt?: number;
|
|
1577
|
+
/** `iat`, a NumericDate: the artefact's issue time. The signer's clock when absent. */
|
|
1578
|
+
readonly issuedAt?: number;
|
|
1579
|
+
/** `jti`: the artefact's id. A fresh UUID when absent. */
|
|
1580
|
+
readonly jti?: string;
|
|
1798
1581
|
}): Promise<string>;
|
|
1799
1582
|
readonly kid?: string;
|
|
1800
1583
|
jwks?(): Promise<{
|
|
@@ -1805,6 +1588,8 @@ type SubjectResolver<TInput, TPrincipal extends Principal = Principal> = (input:
|
|
|
1805
1588
|
readonly tenant?: string;
|
|
1806
1589
|
}) => Subject<TPrincipal> | Promise<Subject<TPrincipal>>;
|
|
1807
1590
|
type SnapshotSource = {
|
|
1591
|
+
/** Names the implementation in errors and events. */
|
|
1592
|
+
readonly name?: string;
|
|
1808
1593
|
get(): Promise<Snapshot | string> | Snapshot | string;
|
|
1809
1594
|
subscribe?(listener: () => void): () => void;
|
|
1810
1595
|
};
|
|
@@ -1813,8 +1598,10 @@ type LimitConsumeInput = {
|
|
|
1813
1598
|
readonly key: string;
|
|
1814
1599
|
readonly subjectId: string;
|
|
1815
1600
|
readonly count: number;
|
|
1816
|
-
|
|
1817
|
-
readonly
|
|
1601
|
+
/** The window in seconds; windows are aligned to the epoch. */
|
|
1602
|
+
readonly per: number;
|
|
1603
|
+
/** The decision clock; the store reads the clock when absent. */
|
|
1604
|
+
readonly now?: Instant;
|
|
1818
1605
|
/** The active tenant; a quota counts per subject and tenant. */
|
|
1819
1606
|
readonly tenant?: string;
|
|
1820
1607
|
};
|
|
@@ -1822,10 +1609,14 @@ type LimitRemaining = {
|
|
|
1822
1609
|
readonly remaining: number;
|
|
1823
1610
|
};
|
|
1824
1611
|
type LimitStore = {
|
|
1612
|
+
/** Names the implementation in errors and events. */
|
|
1613
|
+
readonly name?: string;
|
|
1825
1614
|
consume(input: LimitConsumeInput): Promise<LimitRemaining> | LimitRemaining;
|
|
1826
1615
|
remaining(input: LimitConsumeInput): LimitRemaining | undefined;
|
|
1827
1616
|
};
|
|
1828
1617
|
type DecisionSink = {
|
|
1618
|
+
/** Names the implementation in errors and events. */
|
|
1619
|
+
readonly name?: string;
|
|
1829
1620
|
write(events: readonly SinkEvent[]): Promise<void> | void;
|
|
1830
1621
|
flush?(): Promise<void>;
|
|
1831
1622
|
};
|
|
@@ -1836,24 +1627,30 @@ type DecisionSink = {
|
|
|
1836
1627
|
* never core's.
|
|
1837
1628
|
*/
|
|
1838
1629
|
type CredentialVerifier = {
|
|
1630
|
+
/** Names the implementation in errors and events. */
|
|
1631
|
+
readonly name?: string;
|
|
1839
1632
|
verify(secret: string): Credential | null | Promise<Credential | null>;
|
|
1840
1633
|
/**
|
|
1841
|
-
* Records a successful use at `at
|
|
1842
|
-
*
|
|
1843
|
-
*
|
|
1634
|
+
* Records a successful use at `at`, for a `lastUsedAt` column. Called
|
|
1635
|
+
* after a key resolved and not awaited; a throw or a rejection is
|
|
1636
|
+
* ignored, so it never changes the subject.
|
|
1844
1637
|
*/
|
|
1845
|
-
touch?(id: string, at:
|
|
1638
|
+
touch?(id: string, at: Instant): void | Promise<void>;
|
|
1846
1639
|
};
|
|
1847
1640
|
/** What one tenant configures for itself. Every field only tightens. */
|
|
1848
1641
|
type TenantSettings = {
|
|
1849
1642
|
/** Rules for API keys created in, or used against, this tenant. */
|
|
1850
1643
|
readonly credentials?: CredentialPolicy;
|
|
1644
|
+
/** Rules for support sessions started in this tenant. */
|
|
1645
|
+
readonly supportSessions?: SupportSessionPolicy;
|
|
1851
1646
|
};
|
|
1852
1647
|
/**
|
|
1853
|
-
* Per-tenant settings, a subject input like `
|
|
1648
|
+
* Per-tenant settings, a subject input like `CustomRoleSource`: they tighten what
|
|
1854
1649
|
* a key may be and never grant. A throw denies.
|
|
1855
1650
|
*/
|
|
1856
1651
|
type SettingsSource = {
|
|
1652
|
+
/** Names the implementation in errors and events. */
|
|
1653
|
+
readonly name?: string;
|
|
1857
1654
|
settingsFor(tenant: string): TenantSettings | undefined | Promise<TenantSettings | undefined>;
|
|
1858
1655
|
};
|
|
1859
1656
|
//#endregion
|
|
@@ -1875,8 +1672,8 @@ type ClosureContext = {
|
|
|
1875
1672
|
type ClosureGrantFn<T = unknown> = (data: T, ctx: ClosureContext) => boolean;
|
|
1876
1673
|
/** Who else may approve once a request has waited `after`. */
|
|
1877
1674
|
type ApprovalEscalation = {
|
|
1878
|
-
/**
|
|
1879
|
-
readonly after:
|
|
1675
|
+
/** Seconds from the request's creation. */
|
|
1676
|
+
readonly after: number;
|
|
1880
1677
|
readonly to: Approver | readonly Approver[];
|
|
1881
1678
|
};
|
|
1882
1679
|
/** One group of approvers; `quorum` distinct approvers of `by` complete it. */
|
|
@@ -1906,8 +1703,8 @@ type ApprovalRequirement = {
|
|
|
1906
1703
|
readonly staleOn?: "resource-change";
|
|
1907
1704
|
/** Distinct approvers a request needs before it is approved under `by`; absent means 1. */
|
|
1908
1705
|
readonly quorum?: number;
|
|
1909
|
-
/**
|
|
1910
|
-
readonly ttl?:
|
|
1706
|
+
/** Seconds a request stays open; the store's default when absent, and never longer than it. */
|
|
1707
|
+
readonly ttl?: number;
|
|
1911
1708
|
readonly escalation?: ApprovalEscalation;
|
|
1912
1709
|
};
|
|
1913
1710
|
type ApprovalOption = "human" | {
|
|
@@ -1917,9 +1714,9 @@ type ApprovalOption = "human" | {
|
|
|
1917
1714
|
readonly stages?: readonly {
|
|
1918
1715
|
readonly by: ApproverInput;
|
|
1919
1716
|
readonly quorum?: number;
|
|
1920
|
-
/** After `after
|
|
1717
|
+
/** After `after` seconds, `to` may approve this stage as well as `by`. */
|
|
1921
1718
|
readonly escalation?: {
|
|
1922
|
-
readonly after:
|
|
1719
|
+
readonly after: number;
|
|
1923
1720
|
readonly to: ApproverInput;
|
|
1924
1721
|
};
|
|
1925
1722
|
}[];
|
|
@@ -1933,11 +1730,11 @@ type ApprovalOption = "human" | {
|
|
|
1933
1730
|
readonly staleOn?: "resource-change";
|
|
1934
1731
|
/** Distinct approvers needed (an integer of at least 1); the same approver counts once. Absent means 1. */
|
|
1935
1732
|
readonly quorum?: number;
|
|
1936
|
-
/**
|
|
1937
|
-
readonly ttl?:
|
|
1938
|
-
/** After `after` (`
|
|
1733
|
+
/** Seconds the request stays open (`1800`); caps the approval store's default. */
|
|
1734
|
+
readonly ttl?: number;
|
|
1735
|
+
/** After `after` seconds (`14_400`), `to` may approve as well as `by`, at any open stage; same kinds as `by`. */
|
|
1939
1736
|
readonly escalation?: {
|
|
1940
|
-
readonly after:
|
|
1737
|
+
readonly after: number;
|
|
1941
1738
|
readonly to: ApproverInput;
|
|
1942
1739
|
};
|
|
1943
1740
|
};
|
|
@@ -1948,7 +1745,8 @@ type ApprovalOption = "human" | {
|
|
|
1948
1745
|
*/
|
|
1949
1746
|
type GrantLimit = {
|
|
1950
1747
|
readonly count: number;
|
|
1951
|
-
|
|
1748
|
+
/** The window in seconds (`3600` for an hour), aligned to the epoch. */
|
|
1749
|
+
readonly per: number;
|
|
1952
1750
|
readonly mode?: "hard" | "soft";
|
|
1953
1751
|
readonly alertAt?: number;
|
|
1954
1752
|
};
|
|
@@ -1967,8 +1765,8 @@ type AssuranceRequirement = {
|
|
|
1967
1765
|
* mints the elevated membership to write.
|
|
1968
1766
|
*/
|
|
1969
1767
|
type ActivationOption = {
|
|
1970
|
-
/** The longest an activation may last,
|
|
1971
|
-
readonly maxDuration?:
|
|
1768
|
+
/** The longest an activation may last, in seconds (`14_400`). */
|
|
1769
|
+
readonly maxDuration?: number;
|
|
1972
1770
|
/** `'required'` denies an activation without a reason. */
|
|
1973
1771
|
readonly justification?: "required" | "optional";
|
|
1974
1772
|
/** When set, `activate` returns `approval-required` before the membership can be written. */
|
|
@@ -1977,7 +1775,7 @@ type ActivationOption = {
|
|
|
1977
1775
|
readonly assurance?: AssuranceRequirement;
|
|
1978
1776
|
};
|
|
1979
1777
|
type ActivationSpec = {
|
|
1980
|
-
readonly maxDuration?:
|
|
1778
|
+
readonly maxDuration?: number;
|
|
1981
1779
|
readonly justification: "required" | "optional";
|
|
1982
1780
|
readonly approval?: "human" | ApprovalRequirement;
|
|
1983
1781
|
readonly assurance?: AssuranceRequirement;
|
|
@@ -1994,8 +1792,8 @@ type BreakGlassOptions = {
|
|
|
1994
1792
|
/** Names of the deny grants this override lifts; every other deny still wins. */
|
|
1995
1793
|
readonly overrides?: readonly string[];
|
|
1996
1794
|
readonly requires?: BreakGlassRequirements;
|
|
1997
|
-
/** The longest a break-glass session may last,
|
|
1998
|
-
readonly maxDuration?:
|
|
1795
|
+
/** The longest a break-glass session may last, in seconds. */
|
|
1796
|
+
readonly maxDuration?: number;
|
|
1999
1797
|
/** Follow-ups the grant owes: each becomes an obligation on the decision. */
|
|
2000
1798
|
readonly obligations?: readonly ("notify" | "review")[];
|
|
2001
1799
|
};
|
|
@@ -2005,14 +1803,14 @@ type BreakGlassSpec = {
|
|
|
2005
1803
|
readonly purpose?: readonly string[];
|
|
2006
1804
|
readonly reason: boolean;
|
|
2007
1805
|
readonly assurance?: AssuranceRequirement;
|
|
2008
|
-
readonly maxDuration?:
|
|
1806
|
+
readonly maxDuration?: number;
|
|
2009
1807
|
readonly obligations: readonly ("notify" | "review")[];
|
|
2010
1808
|
};
|
|
2011
1809
|
/** How a tenant consents to support access, and for how long. */
|
|
2012
1810
|
type SupportConsent = {
|
|
2013
1811
|
readonly by: GranteeInput;
|
|
2014
|
-
/** The durations a tenant owner may pick,
|
|
2015
|
-
readonly durations: readonly
|
|
1812
|
+
/** The durations a tenant owner may pick, in seconds. */
|
|
1813
|
+
readonly durations: readonly number[];
|
|
2016
1814
|
};
|
|
2017
1815
|
type SupportAccessOptions<S extends string = string> = {
|
|
2018
1816
|
/** The role a consented support membership holds. */
|
|
@@ -2032,7 +1830,7 @@ type SupportSpec = {
|
|
|
2032
1830
|
readonly actorRequired: boolean;
|
|
2033
1831
|
readonly consent: {
|
|
2034
1832
|
readonly by: Grantee | readonly Grantee[];
|
|
2035
|
-
readonly durations: readonly
|
|
1833
|
+
readonly durations: readonly number[];
|
|
2036
1834
|
};
|
|
2037
1835
|
readonly group: string;
|
|
2038
1836
|
};
|
|
@@ -2060,10 +1858,10 @@ type GrantOptions<T = Record<string, unknown>> = {
|
|
|
2060
1858
|
readonly obligations?: readonly ObligationInput[];
|
|
2061
1859
|
/** Purposes of use (`context.purpose`) that make the grant apply; non-portable. */
|
|
2062
1860
|
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 |
|
|
1861
|
+
/** 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. */
|
|
1862
|
+
readonly validFrom?: string | Instant;
|
|
1863
|
+
/** The grant stops applying at this instant (exclusive; RFC 3339 or an `Instant`). */
|
|
1864
|
+
readonly validUntil?: string | Instant;
|
|
2067
1865
|
/**
|
|
2068
1866
|
* An allow on an instance action counts only on rows whose scope instance
|
|
2069
1867
|
* (or the whole app, globally) is one where the subject also holds this
|
|
@@ -2091,13 +1889,18 @@ type GrantValidity = {
|
|
|
2091
1889
|
readonly from?: number;
|
|
2092
1890
|
readonly until?: number;
|
|
2093
1891
|
};
|
|
1892
|
+
/** A grant's validity in JSON (snapshots, catalogs, `inactive-grant` details): RFC 3339 bounds. */
|
|
1893
|
+
type WireValidity = {
|
|
1894
|
+
readonly from?: string;
|
|
1895
|
+
readonly until?: string;
|
|
1896
|
+
};
|
|
2094
1897
|
/**
|
|
2095
1898
|
* The actor a policy delegation is for: an actor kind, narrowed to one id
|
|
2096
1899
|
* when `id` is set, or to one named client when `client` is set (the name
|
|
2097
1900
|
* the subject resolver gives a verified client id through `clients`).
|
|
2098
1901
|
*/
|
|
2099
1902
|
type DelegationTarget = {
|
|
2100
|
-
readonly kind:
|
|
1903
|
+
readonly kind: ActorKind;
|
|
2101
1904
|
readonly id?: string;
|
|
2102
1905
|
readonly client?: string;
|
|
2103
1906
|
};
|
|
@@ -2121,8 +1924,8 @@ type DelegationInput = {
|
|
|
2121
1924
|
readonly to: ActorGrantee | string | DelegationTarget;
|
|
2122
1925
|
/** The leaves or subtrees the actor may use; a deny grant still applies. */
|
|
2123
1926
|
readonly permissions: readonly (Permission | PermissionTree)[];
|
|
2124
|
-
readonly validFrom?: string |
|
|
2125
|
-
readonly validUntil?: string |
|
|
1927
|
+
readonly validFrom?: string | Instant;
|
|
1928
|
+
readonly validUntil?: string | Instant;
|
|
2126
1929
|
};
|
|
2127
1930
|
/** A declared scope name (or the `tenant` / `team` alias), or the resource a role is held on. */
|
|
2128
1931
|
type RoleScope<S extends string = string> = S | Permission | PermissionTree | readonly (Permission | PermissionTree)[];
|
|
@@ -2180,7 +1983,7 @@ type Grant = {
|
|
|
2180
1983
|
/** Set on a break-glass allow: it overrides named denies and carries obligations. */
|
|
2181
1984
|
readonly breakGlass?: BreakGlassSpec;
|
|
2182
1985
|
/** The membership kind (`via`) this grant applies under; others never match it. */
|
|
2183
|
-
readonly viaOnly?:
|
|
1986
|
+
readonly viaOnly?: MembershipVia;
|
|
2184
1987
|
/** Set only on a grant merged from a hosted policy document. */
|
|
2185
1988
|
readonly hosted?: HostedGrantRef;
|
|
2186
1989
|
/** When the grant applies; absent means always. */
|
|
@@ -2283,7 +2086,7 @@ type PolicyAppDataSchemas = {
|
|
|
2283
2086
|
readonly grant?: AppDataSchema<unknown>;
|
|
2284
2087
|
readonly membership?: AppDataSchema<unknown>;
|
|
2285
2088
|
};
|
|
2286
|
-
type
|
|
2089
|
+
type PolicyOptions<TUser, TPrincipal extends Principal, S extends PolicyScopesInput = PolicyScopesInput> = {
|
|
2287
2090
|
readonly x?: PolicyAppDataSchemas;
|
|
2288
2091
|
readonly roles?: readonly RoleBinding<ScopeNames<S>>[];
|
|
2289
2092
|
readonly grants?: readonly (Omit<Grant, "role" | "scope"> | readonly Omit<Grant, "role" | "scope">[] | Grant)[];
|
|
@@ -2293,8 +2096,8 @@ type DefinePolicyOptions<TUser, TPrincipal extends Principal, S extends PolicySc
|
|
|
2293
2096
|
* the first and second scope.
|
|
2294
2097
|
*/
|
|
2295
2098
|
readonly scopes?: S;
|
|
2296
|
-
|
|
2297
|
-
readonly subject
|
|
2099
|
+
/** Maps the application's user to the principal PermDock decides for; `null` is anonymous. */
|
|
2100
|
+
readonly subject: (user: TUser) => TPrincipal | null;
|
|
2298
2101
|
readonly context?: (user: TUser) => Readonly<Record<string, unknown>> | Promise<Readonly<Record<string, unknown>>>;
|
|
2299
2102
|
readonly validate?: ValidateMode;
|
|
2300
2103
|
readonly onDenied?: (decision: unknown) => never | void;
|
|
@@ -2344,4 +2147,4 @@ type SubjectOf<P> = {
|
|
|
2344
2147
|
readonly expiresAt?: number;
|
|
2345
2148
|
};
|
|
2346
2149
|
//#endregion
|
|
2347
|
-
export {
|
|
2150
|
+
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, isConditionRef 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, isConditionDate as Sr, ApiKeyPrincipal as St, Policy as T, anyone as Tn, 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, RestrictedAncestors as _r, SupportSessionDecision as _t, ApprovalRequirement as a, WireDenial as an, VerifiedClaims as ar, SettingsSource as at, GrantScope as b, Grantee as bn, hasConditionOp as br, decideSupportSession as bt, BreakGlassOptions as c, Scope as cn, MembershipVia as cr, TenantSettings as ct, ClosureContext as d, AnyOfApprover as dn, ConditionValue as dr, TokenVerifier as dt, DirectoryEvent as en, GnapAccess as er, MembershipSource as et, ClosureGrantFn as f, Approver as fn, MemberOfCondition as fr, VerificationFailure as ft, GrantCondition as g, allOf as gn, RelatedHop as gr, SupportSession as gt, Grant as h, UserApprover as hn, RelatedCondition as hr, DecideSupportSessionOptions as ht, ApprovalOption as i, WireDecision as in, Subject 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, Condition as lr, TokenFailureCause as lt, DelegationTarget as m, PermissionApprover as mn, OpaqueCondition as mr, WhereCompiler as mt, ApprovalEscalation as n, MembershipEvent as nn, Membership as nr, RelationGroup as nt, ApprovalStage as o, WireDelegation as on, ActorKind as or, SnapshotSource as ot, DelegationInput as p, ApproverInput as pn, MemberOfParent 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, AdapterId as sr, SubjectResolver as st, ActivationOption as t, EmailCategory as tn, JsonWebKeyLike as tr, RelationChain as tt, BreakGlassSpec as u, ScopeNames as un, ConditionRef as ur, TokenSigner as ut, GrantMeta as v, holder as vn, SqlFunctionArg as vr, SupportSessionPolicy as vt, ObligationInput as w, actor as wn, isSqlFunctionField as wr, CredentialDecision as wt, GrantValidity as x, GranteeInput as xn, isCondition as xr, parseSupportSession as xt, GrantOptions as y, user as yn, SqlFunctionCondition as yr, SupportSessionRequest as yt, SupportConsent as z, GrantedDecision as zn, LocalCustomRoleTable as zt };
|