permdock 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -3
- package/dist/a2a/index.d.ts +7 -7
- package/dist/a2a/index.js +8 -8
- package/dist/action-result-BcudBQOF.d.ts +19 -0
- package/dist/{adapter-context-CRhqyzCk.js → adapter-context-CIQpQxbE.js} +8 -2
- package/dist/{adoption-scan-D-feE7BE.js → adoption-scan-Ch07MdxN.js} +5 -5
- package/dist/agent/index.d.ts +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/ai-sdk/index.d.ts +19 -13
- package/dist/ai-sdk/index.js +6 -6
- package/dist/{app-data-MuyzVqX8.js → app-data-UNNm07jV.js} +10 -7
- package/dist/{approval-header-CJACtHkv.js → approval-header-8QV6MU4H.js} +6 -3
- package/dist/{approval-prompt-K0faOLFp.d.ts → approval-prompt-3BqWczTt.d.ts} +13 -11
- package/dist/{approval-prompt-Dg5LeAcT.js → approval-prompt-B8hQY69x.js} +5 -6
- package/dist/approvals/index.d.ts +4 -4
- package/dist/approvals/index.js +6 -6
- package/dist/{approvals-CMRfsbBh.js → approvals-DnIBTuXE.js} +66 -42
- package/dist/{approvers-CqPOLD-o.js → approvers-B4r0N_Uz.js} +8 -2
- package/dist/{arazzo-ClrF3PVb.js → arazzo-BpS7LnV0.js} +2 -2
- package/dist/{arazzo-rdeJ8n1J.js → arazzo-CmQaGPkM.js} +6 -6
- package/dist/{args-CC3OwyHW.js → args-0FrVs5EH.js} +14 -7
- package/dist/astro/index.d.ts +30 -12
- package/dist/astro/index.js +2 -2
- package/dist/{audience-BrMs8c4o.js → audience-DTjR8xet.js} +8 -8
- package/dist/{auth-CscUX8Sy.js → auth--yPyZNgr.js} +19 -7
- package/dist/authzen/index.d.ts +34 -28
- package/dist/authzen/index.js +23 -20
- package/dist/{automation-DOtAFWdy.d.ts → automation-C6Jg75xq.d.ts} +42 -32
- package/dist/{automation-ySsxp_Yp.js → automation-x3KEUusw.js} +22 -21
- package/dist/better-auth/index.d.ts +2 -2
- package/dist/better-auth/index.js +13 -7
- package/dist/better-supabase/index.d.ts +357 -227
- package/dist/better-supabase/index.js +219 -140
- package/dist/{bind-D1nO6fiC.js → bind-BNQA9JK9.js} +26 -10
- package/dist/{bind-JDuvxjuW.d.ts → bind-YYjvfpB9.d.ts} +32 -12
- package/dist/{body-CH5of8Ne.js → body-CJQwYVa8.js} +3 -3
- package/dist/{body-text-QcXok_SI.js → body-text-DQhcmqdY.js} +8 -4
- package/dist/{boundary-BM8a_P6E.js → boundary-BV3O1eud.js} +8 -2
- package/dist/{boundary-BmHxVH1J.d.ts → boundary-C9ck-3uK.d.ts} +13 -4
- package/dist/{budget-NbEtbJC_.js → budget-BELja5A9.js} +6 -3
- package/dist/{budget-JqcRqyhK.d.ts → budget-hYsPz_yE.d.ts} +6 -3
- package/dist/{build-instance-DxE7czo9.js → build-instance-BWXqwQYU.js} +3 -3
- package/dist/{capability-L7NnfhiE.js → capability-BqX94r07.js} +31 -25
- package/dist/{capability-D4UC9TTW.d.ts → capability-Di9tiUvi.d.ts} +41 -29
- package/dist/{casbin-BHijLuHY.js → casbin-B7_yS-oo.js} +2 -2
- package/dist/{casbin-BW9pS47J.js → casbin-bHyIxTNQ.js} +16 -8
- package/dist/{casl-CmJlgziS.js → casl-C4OINZHI.js} +2 -2
- package/dist/{casl-UbI8v-Wq.js → casl-CHHoCldP.js} +19 -10
- package/dist/catalog/index.d.ts +51 -30
- package/dist/catalog/index.js +18 -15
- package/dist/{catalog-D69WhFii.js → catalog-CGlSwU6j.js} +20 -19
- package/dist/catalog-D3oS2GH3.js +1 -0
- package/dist/{catalog-BaMQfQ6Y.js → catalog-amPDr0JQ.js} +3 -3
- package/dist/{catalog-doc-CV9s6B1S.js → catalog-doc-DjMKzJp9.js} +28 -14
- package/dist/{catalog-fingerprint-C144oW4M.js → catalog-fingerprint-e6aCWosn.js} +18 -14
- package/dist/catalog-operations-DeHTrJSV.js +60 -0
- package/dist/{challenge-nGWma08S.js → challenge-DImNcR7B.js} +48 -27
- package/dist/chat/index.d.ts +1 -1
- package/dist/chat/index.js +13 -10
- package/dist/chat-sdk/index.d.ts +44 -26
- package/dist/chat-sdk/index.js +17 -17
- package/dist/{checks-BC_0mPIq.js → checks-CGkP3Z7A.js} +4 -1
- package/dist/{claims-map-7oQ3ue4X.js → claims-map-CKkoAAYF.js} +5 -2
- package/dist/{claims-map-Ca-QX8C6.d.ts → claims-map-D1Pb5oRq.d.ts} +8 -5
- package/dist/claude-agent/index.d.ts +6 -6
- package/dist/claude-agent/index.js +6 -3
- package/dist/clerk/index.d.ts +11 -7
- package/dist/clerk/index.js +6 -6
- package/dist/cli/bin.js +4 -4
- package/dist/cli/index.d.ts +82 -7
- package/dist/cli/index.js +6 -6
- package/dist/{clients-C7zLFuWT.d.ts → clients-C_NOET3z.d.ts} +5 -5
- package/dist/{clients-DjU5ABMy.js → clients-DYr3U86j.js} +3 -3
- package/dist/cloud/index.d.ts +84 -52
- package/dist/cloud/index.js +53 -39
- package/dist/{cloud-CO8pYtwr.js → cloud-3kWfjnYy.js} +4 -5
- package/dist/{codemod-BP6n8N9L.js → codemod-Bv5i-Mzo.js} +523 -201
- package/dist/{codemod-i4N2BhDc.js → codemod-D9Aiii1r.js} +3 -4
- package/dist/{collect-DNm3oKOk.js → collect-B80GYEot.js} +4 -5
- package/dist/collect-D-eroIfV.js +1 -0
- package/dist/{collect-BaWeMjwV.js → collect-WCl8cJQV.js} +26 -63
- package/dist/{compare-pfyVnBjE.js → compare-DTfyUunF.js} +2 -2
- package/dist/compile/index.d.ts +2 -2
- package/dist/compile/index.js +1 -1
- package/dist/{compile-COM2VKuN.d.ts → compile-BEklRUYo.d.ts} +36 -12
- package/dist/{compile-BAEO5bOk.js → compile-EzEMB-7v.js} +77 -33
- package/dist/{completion-BNdVf7X2.js → completion-_bc0OUQ-.js} +17 -8
- package/dist/config-BwPBfN0t.js +108 -0
- package/dist/{config-DGZzMV1B.js → config-D5XrLWpk.js} +2 -2
- package/dist/{config-report-Cm7UITNA.js → config-report-BmWIskD7.js} +9 -6
- package/dist/config-shape-ykV0Vm2n.js +134 -0
- package/dist/{connection-DjhIJSs2.js → connection-B72dg5Q2.js} +23 -22
- package/dist/{connector-schema-_VCSsdtD.js → connector-schema-CYLQNMYq.js} +3 -2
- package/dist/{context--uM9V3Ui.js → context-BnIzxTNE.js} +4 -3
- package/dist/convex/index.d.ts +13 -7
- package/dist/convex/index.js +9 -6
- package/dist/{core-CQkE8Esr.d.ts → core-CFepFiDP.d.ts} +49 -22
- package/dist/{core-B5-w6Kw9.js → core-DzVINFbU.js} +26 -20
- package/dist/{create-Cb86Z8Im.js → create-6EwRQlig.js} +10 -7
- package/dist/{create-DJrlhEp9.js → create-BLPKnJKa.js} +35 -25
- package/dist/{create-UTnUVETj.d.ts → create-BPUopdfL.d.ts} +70 -37
- package/dist/{create-QHuuPw3q.d.ts → create-BamXmeob.d.ts} +37 -29
- package/dist/{create-B2-CQqCI.d.ts → create-DBvUsgzK.d.ts} +49 -28
- package/dist/{credential-CIM7wHwA.js → credential-CyyyvCsL.js} +41 -38
- package/dist/{credentials-BpuTwd7a.js → credentials-CdDxp7jN.js} +6 -6
- package/dist/{deciding-columns-DRo2QM6E.js → deciding-columns-NB4wcyBf.js} +2 -2
- package/dist/{delegation-C5rOdTp5.js → delegation-CDB6_keF.js} +31 -22
- package/dist/delivery/index.d.ts +4 -4
- package/dist/delivery/index.js +5 -5
- package/dist/{delivery-rwOKLWRm.js → delivery-BupfvJIV.js} +34 -22
- package/dist/{delivery-event-xX4obB8F.js → delivery-event-JioK5YbS.js} +6 -6
- package/dist/denied-text-DHldhVUv.d.ts +22 -0
- package/dist/{describe-DZlnEtLy.js → describe-Bb4hGK5d.js} +5 -5
- package/dist/{describe-O0SwYIK8.d.ts → describe-BbFPBSms.d.ts} +5 -5
- package/dist/{device-BARQ8eYG.js → device-BwbJNmb2.js} +11 -8
- package/dist/{diff-Btr1c1Ow.js → diff-BwR1JdP2.js} +2 -2
- package/dist/{diff-DzT-xD13.js → diff-CQegtBAo.js} +22 -13
- package/dist/{digest-B3kc_PgQ.d.ts → digest-8Yx2CchM.d.ts} +3 -3
- package/dist/{doctor-BU1szn63.js → doctor-ClRVAtXQ.js} +287 -135
- package/dist/{doctor-BoK_y0KO.js → doctor-LPMYjSqO.js} +4 -4
- package/dist/drizzle/index.d.ts +33 -19
- package/dist/drizzle/index.js +17 -9
- package/dist/elysia/index.d.ts +17 -11
- package/dist/elysia/index.js +5 -5
- package/dist/{errors-BKy0EfhN.js → errors-B6R_lg2a.js} +13 -4
- package/dist/{errors-B_Qg9D3e.d.ts → errors-BIM4MFsJ.d.ts} +22 -6
- package/dist/{errors-BWXBMaKK.d.ts → errors-CHwoRRpB.d.ts} +4 -1
- package/dist/{errors-DpP_U6Bf.js → errors-Vpu6rKHl.js} +13 -10
- package/dist/{evaluate-B_oqFbWC.js → evaluate-BAmf_AQd.js} +153 -82
- package/dist/{evaluations-BCddEOfO.d.ts → evaluations-DOWuBpWv.d.ts} +11 -5
- package/dist/{evaluations-DReoiVBw.js → evaluations-IBceAeKT.js} +40 -19
- package/dist/eve/index.d.ts +9 -6
- package/dist/eve/index.js +4 -4
- package/dist/{event-time-CsegxXxB.js → event-time-BGy48400.js} +8 -4
- package/dist/{expiry-D4_YKRKD.js → expiry-6XByK0dm.js} +8 -5
- package/dist/express/index.d.ts +9 -6
- package/dist/express/index.js +9 -6
- package/dist/fastify/index.d.ts +16 -10
- package/dist/fastify/index.js +8 -5
- package/dist/{fetch-adapter-CuhyYwC1.d.ts → fetch-adapter-BIbBAtPZ.d.ts} +9 -6
- package/dist/{fetch-adapter-De-u6vhJ.js → fetch-adapter-dPTgJVHd.js} +14 -11
- package/dist/fields-D0vUI6dq.js +498 -0
- package/dist/{files-acUbNwWt.js → files-B3AA05f1.js} +8 -5
- package/dist/{files-D_JIzUrP.js → files-BSjrtIHw.js} +11 -4
- package/dist/{fixtures-BTMW6zgU.js → fixtures-A1_sp_tR.js} +15 -6
- package/dist/{flags-aaeRAdiD.js → flags-DXjoTVbS.js} +2 -2
- package/dist/{freeze-CrU8nQeX.js → freeze-jjan0lCv.js} +4 -1
- package/dist/{from-snapshot-Bz469dIh.js → from-snapshot-DCakWRsr.js} +18 -15
- package/dist/gen-BFfzZSLH.js +58 -0
- package/dist/gen-BtfFWGbz.js +827 -0
- package/dist/{generate-3FNO5P5Q.js → generate-CRVV5V7l.js} +14 -8
- package/dist/generate-CezbCaTI.js +275 -0
- package/dist/{grantee-BrRANrpT.js → grantee-Dke-9rd1.js} +4 -4
- package/dist/{grantee-conditions-C6P1Tvol.js → grantee-conditions-BrYPe-w0.js} +12 -12
- package/dist/{grantee-match-0RtHWQDx.js → grantee-match-7RZZvoT_.js} +12 -6
- package/dist/{graph-sql-B-dsAT6j.d.ts → graph-sql-BwFC4Qjs.d.ts} +3 -3
- package/dist/h3/index.d.ts +10 -7
- package/dist/h3/index.js +3 -3
- package/dist/headers-B9jQxjtW.d.ts +10 -0
- package/dist/{helpers-DY3vXuGs.js → helpers-DJicaG6f.js} +40 -28
- package/dist/hono/index.d.ts +16 -10
- package/dist/hono/index.js +5 -5
- package/dist/{hosted-XBgU6RGT.js → hosted-D0IzESu_.js} +42 -21
- package/dist/{hosted-BmjzxQhp.d.ts → hosted-DVxlLZMe.d.ts} +33 -21
- package/dist/{http-ujKm0JXE.js → http-DH94eh6f.js} +4 -4
- package/dist/{http-BBoKefeS.js → http-DKLXrFGk.js} +13 -7
- package/dist/{http-Ca3Sr5x1.js → http-DOL33cO0.js} +11 -8
- package/dist/{import-DB2EG_iy.js → import-ACkOrv6g.js} +6 -6
- package/dist/{import-Bz0GefWg.js → import-CST57XLp.js} +64 -51
- package/dist/{index-CMiPH2Tv.d.ts → index-BinlXeU-.d.ts} +64 -37
- package/dist/{index-BSfRl0hZ.d.ts → index-CV-7DWeD.d.ts} +64 -52
- package/dist/{index-BE8y3moU.d.ts → index-DJwEgYzA.d.ts} +127 -82
- package/dist/{index-DH9DUDEM.d.ts → index-Dj2qF9VC.d.ts} +54 -30
- package/dist/{index-BTkwrK7v.d.ts → index-vYjMrXyK.d.ts} +336 -173
- package/dist/{index-DLwcuCN_.d.ts → index-ymept53A.d.ts} +51 -30
- package/dist/index.d.ts +22 -22
- package/dist/index.js +34 -34
- package/dist/{init-B-4t1NzC.js → init-BjuFDYT1.js} +10 -10
- package/dist/{init-5TXNji88.js → init-txYTuW9u.js} +5 -5
- package/dist/{instance-options-CU0YQCLH.d.ts → instance-options-CoHn-0e8.d.ts} +4 -4
- package/dist/{instance-snapshot-CjcwnEiV.js → instance-snapshot-DuWf1cT3.js} +86 -61
- package/dist/{instant-BluqDvyS.js → instant-DK3Iz83e.js} +2 -2
- package/dist/{internals-Dk8A8fX3.js → internals-B3IgHrvo.js} +6 -3
- package/dist/{json-schema-B-vAwlde.js → json-schema-BPGa-RjQ.js} +9 -3
- package/dist/{json-schema-CN_iLFH2.d.ts → json-schema-BfXgnRNT.d.ts} +4 -4
- package/dist/jwt/index.d.ts +57 -27
- package/dist/jwt/index.js +24 -21
- package/dist/{kernel-DVExUwkp.js → kernel-qv4cr9w8.js} +32 -23
- package/dist/kysely/index.d.ts +49 -33
- package/dist/kysely/index.js +9 -7
- package/dist/{live-options-BaAFCIiu.js → live-options-BBIT68le.js} +2 -2
- package/dist/{load-DxroEzH1.js → load-DjSU5KXO.js} +6 -6
- package/dist/load-Dm0pSYH3.js +1 -0
- package/dist/{login-ClSJh5t5.js → login-CfImTJGb.js} +4 -4
- package/dist/{login-WC9HPJpU.js → login-CgfCTO3F.js} +16 -9
- package/dist/{manifest-Dv6q4i5s.js → manifest-B2QPh19C.js} +49 -38
- package/dist/{manifest-BVhExYhw.d.ts → manifest-CzzWtnAb.d.ts} +126 -31
- package/dist/{manifest-schema-Cv492Qev.js → manifest-schema-2r37XRhD.js} +44 -3
- package/dist/{manifest-B79YuF2T.js → manifest-wg8WkkpD.js} +6 -6
- package/dist/{map-claims-etGIS_Dv.js → map-claims-C-nv08_n.js} +16 -9
- package/dist/{map-error-BQGyDm_M.js → map-error-pasIGqMT.js} +7 -7
- package/dist/{markers-C6joDI3o.js → markers-BeHZ4x9Q.js} +20 -5
- package/dist/mcp/index.d.ts +114 -61
- package/dist/mcp/index.js +70 -40
- package/dist/{migrate-Dodel0IJ.js → migrate-B7oP_sQU.js} +35 -17
- package/dist/module-values-BJTBdo6y.js +107 -0
- package/dist/nest/index.d.ts +23 -13
- package/dist/nest/index.js +18 -11
- package/dist/next/client.d.ts +5 -2
- package/dist/next/client.js +1 -1
- package/dist/next/index.d.ts +79 -26
- package/dist/next/index.js +121 -10
- package/dist/next/plugin.d.ts +1 -1
- package/dist/next/plugin.js +4 -3
- package/dist/node/index.d.ts +5 -5
- package/dist/node/index.js +3 -3
- package/dist/{ocsf-BFp-PZZA.js → ocsf-TcjRBgIs.js} +15 -5
- package/dist/openai/index.d.ts +13 -7
- package/dist/openai/index.js +3 -3
- package/dist/openapi/index.d.ts +51 -30
- package/dist/openapi/index.js +2 -2
- package/dist/{openapi-ztVaux6j.js → openapi-BGeuunWC.js} +23 -14
- package/dist/{openapi-DMocl1bh.js → openapi-BIpw3Mb7.js} +4 -5
- package/dist/{openapi-Ddb4628T.js → openapi-BOsx0xn9.js} +33 -18
- package/dist/{operation-findings-kRcEp8lE.js → operation-findings-CXtFzlKJ.js} +3 -3
- package/dist/{operations-BNLes61x.d.ts → operations-Ci_rT6Uo.d.ts} +10 -7
- package/dist/orpc/index.d.ts +68 -14
- package/dist/orpc/index.js +62 -13
- package/dist/otel/index.d.ts +7 -4
- package/dist/otel/index.js +8 -5
- package/dist/{output-DgSDLrta.js → output-DV5dwOTs.js} +9 -5
- package/dist/output-files-BHOIlrfD.js +1 -0
- package/dist/{output-files-CCMdcFWb.js → output-files-BIQ_9pIs.js} +29 -17
- package/dist/ownership-DA5YdYTm.js +1059 -0
- package/dist/{parse-Ddhz2xf4.js → parse-1_ZheTW5.js} +16 -13
- package/dist/parse-local-manifest-CCmbhnxP.d.ts +10 -0
- package/dist/{parse-local-manifest-T1Q8X3A2.js → parse-local-manifest-DEiCF4ah.js} +19 -7
- package/dist/{parse-request-D_tUXG6M.js → parse-request-CwCZpyjV.js} +7 -8
- package/dist/{paths-DXSHAMIa.js → paths-CUvURzHp.js} +4 -1
- package/dist/pdp/index.d.ts +9 -6
- package/dist/pdp/index.js +20 -13
- package/dist/{peer-DOzzMfZL.js → peer-C9LvBCcb.js} +1 -1
- package/dist/{peer-12Q5I_RH.js → peer-Q0fuZ6hx.js} +9 -3
- package/dist/{permdock-BfWEeMqk.js → permdock-BvjivVb9.js} +200 -140
- package/dist/{permdock-Dco6dyCK.d.ts → permdock-CprAPN3w.d.ts} +260 -129
- package/dist/{permission-registry-DpPtSKNZ.js → permission-registry-B8tYxPIt.js} +23 -10
- package/dist/{permission-types-DhNEmoRG.d.ts → permission-types-CAY-GU7e.d.ts} +127 -41
- package/dist/{permissions-CoqCOfJ3.d.ts → permissions-Bx6UI8n1.d.ts} +6 -3
- package/dist/{permissions-CyH2MV_B.js → permissions-CVXmRILq.js} +3 -3
- package/dist/{permissions-DArULThq.js → permissions-CYcHj_w7.js} +8 -5
- package/dist/pg-DQTqRrou.js +60 -0
- package/dist/{pins-8ILTftC9.js → pins-nqarl3oE.js} +4 -1
- package/dist/{pkce-5h8NgMQJ.js → pkce-CnmmYqUZ.js} +1 -1
- package/dist/{policy-B7dg_yzu.d.ts → policy-BycVKnXv.d.ts} +5 -5
- package/dist/{policy-DaJy4nK4.js → policy-CLQ8__GF.js} +43 -23
- package/dist/{policy-from-catalog-DFWYkNdu.js → policy-from-catalog-CU3An8uP.js} +28 -25
- package/dist/{policy-module-CTlwMvLI.js → policy-module-xym9fnSq.js} +12 -6
- package/dist/{policy-types-B-F-qAZk.d.ts → policy-types-DGIO_gxq.d.ts} +782 -357
- package/dist/{postgres-store-BL9M_CA1.js → postgres-store-DcyrPS-r.js} +43 -16
- package/dist/{postgrest-r5faDIzD.js → postgrest-5Dr3W64L.js} +84 -86
- package/dist/{postgrest-CYacM_u7.d.ts → postgrest-D5nUGm-c.d.ts} +55 -35
- package/dist/powersync-B701tvhE.js +1 -0
- package/dist/{powersync-13odBwiM.js → powersync-Bg8u-JcR.js} +3 -3
- package/dist/{powersync-53ryOZip.js → powersync-CJrT1DSc.js} +127 -69
- package/dist/preset/index.d.ts +38 -28
- package/dist/preset/index.js +1 -1
- package/dist/{preset-CHTbd-DQ.js → preset-BjLzeFpp.js} +56 -32
- package/dist/{principal-source-pHneukrx.js → principal-source-C6N60GtM.js} +10 -10
- package/dist/prisma/index.d.ts +69 -41
- package/dist/prisma/index.js +21 -17
- package/dist/{problem-CTviyH5L.js → problem-BVLHFK33.js} +41 -21
- package/dist/{problem-details-cn5X30gZ.js → problem-details-CLDgX1KV.js} +13 -4
- package/dist/{problem-types-CJ2325SZ.js → problem-types-DSsRfONQ.js} +4 -1
- package/dist/{prompt-DwtVemER.js → prompt-BYc6drYW.js} +4 -1
- package/dist/protected-action-D8x73IGm.d.ts +58 -0
- package/dist/protected-action-DUYqb-Ma.js +80 -0
- package/dist/{protected-DXE3cQYg.js → protected-action-QEA8arRB.js} +48 -14
- package/dist/{provider-BQsTYYy0.js → provider-C55OGXJ7.js} +5 -4
- package/dist/{provider-Csk-THAn.d.ts → provider-DfLeek9O.d.ts} +1 -1
- package/dist/{provider-store-IgqQipCO.js → provider-store-CaTv00tr.js} +13 -9
- package/dist/{pull-CN5OLxrF.js → pull-2nJr0qg_.js} +12 -11
- package/dist/pull-C3EEGzSw.js +1 -0
- package/dist/{push-tVdG8dUL.js → push-Bn-lMEmI.js} +19 -13
- package/dist/{pushed-policy-CmYeSQqq.js → pushed-policy-CDuOL2de.js} +10 -7
- package/dist/{pushed-policy-BbcY9r_4.d.ts → pushed-policy-CryQheKq.d.ts} +12 -6
- package/dist/react/index.d.ts +9 -8
- package/dist/react/index.js +7 -6
- package/dist/react/provider-client.d.ts +1 -1
- package/dist/react/provider-client.js +1 -1
- package/dist/react-native/index.d.ts +94 -55
- package/dist/react-native/index.js +200 -61
- package/dist/{refs-CNJBiTFo.js → refs-C8BKxc_e.js} +2 -2
- package/dist/{relation-walk-3OyDBF0S.js → relation-walk-DK_gkgL7.js} +12 -9
- package/dist/{relations-BnCWnJGI.js → relations-BxvRvDHK.js} +3 -3
- package/dist/{replay-Du1tJjG7.js → replay-BU09ad4L.js} +1 -1
- package/dist/{replay-DCDD_ZfL.d.ts → replay-Bs9Df2fQ.d.ts} +1 -1
- package/dist/{request-context-BykKLmyE.js → request-context-Duzdf0cd.js} +8 -8
- package/dist/{request-schema-CMreVuFM.js → request-schema-DhX7UbfQ.js} +4 -1
- package/dist/resend/index.d.ts +34 -28
- package/dist/resend/index.js +29 -29
- package/dist/resolve-names-ConCSj1y.js +201 -0
- package/dist/{resource-relations-D_jw0BFx.js → resource-relations-8-pCScBO.js} +18 -9
- package/dist/{retire-Wj6dkyDE.js → retire-B2xffQgY.js} +15 -6
- package/dist/{revocations-R07lFBnX.d.ts → revocations-BaUXHM1N.d.ts} +6 -3
- package/dist/{rls-Ck_PocSp.js → rls-Ba9wN0SP.js} +13 -6
- package/dist/{rls-CxBZb4rZ.js → rls-Cx0dtsB7.js} +310 -128
- package/dist/{role-builder-C1VJzvcr.js → role-builder-BK2-T6oD.js} +41 -20
- package/dist/{row-conditions-h2HythXQ.js → row-conditions-BAGHOmVq.js} +4 -3
- package/dist/{rpc-Bk1bE-ch.js → rpc-vHIwyXCp.js} +8 -5
- package/dist/run-Ck22anC2.js +1 -0
- package/dist/{run-uLD2aWuO.js → run-PbRlXTfh.js} +26 -23
- package/dist/{run-ticket-BpNi7BCi.d.ts → run-ticket-B2o2Kxz8.d.ts} +29 -14
- package/dist/{run-ticket-B5d_63Ma.js → run-ticket-Dv7aF7Dk.js} +9 -9
- package/dist/{runtime-Vif3_-zf.js → runtime-BGnrOkVH.js} +5 -2
- package/dist/{saas-Az_Kz-4D.js → saas-DK4V-3Is.js} +42 -29
- package/dist/{scan-DSljDE1Y.js → scan-CRTj6fke.js} +1 -1
- package/dist/{schema-B4v0Qrac.js → schema-BOJjqlWL.js} +3 -2
- package/dist/{schema-gIcCx7zM.js → schema-BTsE1WRT.js} +8 -4
- package/dist/scim/index.d.ts +2 -2
- package/dist/scim/index.js +2 -2
- package/dist/{scim-C7JYhySg.js → scim-D8YupzX1.js} +2 -2
- package/dist/{scim-YNieBO1U.js → scim-jJBJ7g1Z.js} +33 -15
- package/dist/{scopes-BHsc-wp-.js → scopes-0Up_UA2t.js} +41 -23
- package/dist/server/index.d.ts +11 -11
- package/dist/server/index.js +12 -12
- package/dist/{server-Bnga6I50.js → server-3cVlTLde.js} +31 -31
- package/dist/{server-types-C4gZUEZy.d.ts → server-types-CyRN0-Cd.d.ts} +88 -46
- package/dist/{sha256-D9ihqmvd.js → sha256-C-4WXKIu.js} +4 -3
- package/dist/{shared-fMKOv8hP.js → shared-Afctg7B0.js} +65 -32
- package/dist/{shared-C8LjUdVU.js → shared-l0oGGetg.js} +9 -6
- package/dist/{signals-D3NcTKUS.js → signals-B1vHR3fN.js} +2 -2
- package/dist/{sink-Cp_Eot9W.d.ts → sink-B5zoUW_O.d.ts} +44 -20
- package/dist/{sink-BEZSlMS_.js → sink-D9_vh372.js} +32 -21
- package/dist/{skills-g_3BS9NC.js → skills-C9uKfSF5.js} +3 -3
- package/dist/{skills-Dcjw9_1C.js → skills-CQQcuGBi.js} +12 -8
- package/dist/{snapshot-CbGmYiJx.js → snapshot-CXlzi69u.js} +21 -18
- package/dist/{snapshot-cache-Pahd3IYJ.d.ts → snapshot-cache-BjAWkchD.d.ts} +21 -12
- package/dist/{snapshot-cache-DT2Kx1F8.js → snapshot-cache-Bx_4xC_6.js} +14 -11
- package/dist/solid/index.d.ts +55 -16
- package/dist/solid/index.js +46 -12
- package/dist/solid-start/index.d.ts +30 -12
- package/dist/solid-start/index.js +3 -3
- package/dist/{sources-B-zYB4GS.js → sources-CMAM-2A3.js} +46 -27
- package/dist/{sources-DEEuGb8S.d.ts → sources-CWG32C0G.d.ts} +126 -53
- package/dist/{sql-B96movIM.js → sql-0WjxIp9g.js} +28 -7
- package/dist/{sql-CDEPCA0g.d.ts → sql-B80DFdpG.d.ts} +2 -2
- package/dist/{src-DLFrtrrC.js → src-C_pi2Rnh.js} +292 -101
- package/dist/ssf/index.d.ts +3 -3
- package/dist/ssf/index.js +47 -35
- package/dist/{standard-webhooks-DgFFD-Ga.js → standard-webhooks-D67a3nzk.js} +5 -5
- package/dist/{standard-webhooks-B_qRg0ws.d.ts → standard-webhooks-DOYEuOLx.d.ts} +7 -7
- package/dist/{store-DSP9oGvh.js → store-RNFvaJJv.js} +32 -26
- package/dist/{store-options-B_poyYvg.js → store-options-Dil3lraY.js} +105 -15
- package/dist/stores-DZJvxFIZ.d.ts +59 -0
- package/dist/{stores-BqEuHC05.js → stores-DxZWDXCs.js} +42 -5
- package/dist/{stream-2Vwhl7Er.d.ts → stream-9y9qw51m.d.ts} +4 -3
- package/dist/{stream-CvdUS9V1.js → stream-CDvF0sJm.js} +5 -5
- package/dist/{style-Ds1gNm77.js → style-DblOtSga.js} +1 -1
- package/dist/{style-Cqo7-73x.js → style-Ds11Hmk4.js} +2 -1
- package/dist/{subject-settings-CkEwrw3W.js → subject-settings-8sH5HlII.js} +8 -4
- package/dist/{row-check-Dt35czLy.d.ts → subject-settings-vNW8qmUH.d.ts} +30 -18
- package/dist/supabase/index.d.ts +48 -38
- package/dist/supabase/index.js +5 -5
- package/dist/supabase/middleware.d.ts +19 -13
- package/dist/supabase/middleware.js +7 -7
- package/dist/{supabase--0aJdLEd.js → supabase-DnMMg5Fn.js} +79 -35
- package/dist/{supabase-Bqp7iIY2.js → supabase-SBs3MYUE.js} +3 -3
- package/dist/supabase-hook-C0FyEACZ.js +1 -0
- package/dist/{supabase-hook-Dg0SrQWR.js → supabase-hook-CrgU06WH.js} +175 -196
- package/dist/{supautils-MESd81bF.js → supautils-ByezN3b8.js} +385 -219
- package/dist/{support-session-Cna49-3f.js → support-session-BsmPCbz8.js} +21 -21
- package/dist/svelte/PermissionBoundary.svelte +2 -6
- package/dist/svelte/Protected.svelte +2 -8
- package/dist/svelte/index.d.ts +9 -8
- package/dist/svelte/index.js +10 -9
- package/dist/svelte/runtime.d.ts +4 -4
- package/dist/svelte/runtime.js +4 -4
- package/dist/svelte/source.d.ts +9 -8
- package/dist/svelte/source.js +6 -5
- package/dist/sveltekit/index.d.ts +30 -12
- package/dist/sveltekit/index.js +2 -2
- package/dist/{ownership-Z2LpxsGa.js → tables-BqrxBCir.js} +641 -1104
- package/dist/tanstack-start/index.d.ts +22 -10
- package/dist/tanstack-start/index.js +2 -2
- package/dist/{target-Bw37TFNA.js → target-qdEAnnhU.js} +6 -6
- package/dist/{tenancy-CmeBQ6Nv.js → tenancy-5d1zVBvK.js} +25 -19
- package/dist/terminal/index.d.ts +23 -14
- package/dist/terminal/index.js +17 -20
- package/dist/testing/core.d.ts +1 -1
- package/dist/testing/core.js +1 -1
- package/dist/testing/fixtures/index.d.ts +8 -5
- package/dist/testing/fixtures/index.js +78 -17
- package/dist/testing/index.d.ts +225 -141
- package/dist/testing/index.js +352 -234
- package/dist/testing/saas/index.d.ts +43 -27
- package/dist/testing/saas/index.js +2 -2
- package/dist/testing/saas/permissions.d.ts +1 -1
- package/dist/testing/saas/permissions.js +1 -1
- package/dist/{text-diff-DhITNCnD.js → text-diff-BtfSmdUo.js} +2 -2
- package/dist/{thenable-yD7SabqG.js → thenable-BNSM1U2R.js} +12 -3
- package/dist/{time-DkWjdL98.js → time-nR1JesoH.js} +32 -8
- package/dist/{token-2qYDvXz2.js → token-DC9EQiet.js} +14 -12
- package/dist/{tool-refusal-reAhIzdl.js → tool-refusal-Qpjs_W6M.js} +5 -2
- package/dist/trpc/index.d.ts +11 -8
- package/dist/trpc/index.js +15 -9
- package/dist/type-helpers-c7Xo_2Cu.d.ts +50 -0
- package/dist/{types-CfiKC5aN.d.ts → types-B2efzoSX.d.ts} +14 -11
- package/dist/{types-CIeZcG8v.d.ts → types-B6ExllNo.d.ts} +2 -2
- package/dist/{types-DBHftjgS.d.ts → types-BB-zWDcR.d.ts} +45 -33
- package/dist/{types-BfVmNJO5.d.ts → types-BMVDHvI0.d.ts} +128 -50
- package/dist/{types-DXmwu78Z.d.ts → types-CEinc15V.d.ts} +31 -14
- package/dist/{types-g7Oy6Zg4.d.ts → types-CN0LsqbK.d.ts} +47 -24
- package/dist/{types-CeIscIKp.d.ts → types-CWBsAwqn.d.ts} +23 -12
- package/dist/{types-DqzsnlSA.js → types-CcUXciSj.js} +17 -5
- package/dist/{types-BWZybqs9.d.ts → types-CzOeVvcC.d.ts} +384 -203
- package/dist/{types-DC44-hqb.d.ts → types-DLvhVm1r.d.ts} +59 -32
- package/dist/{types-D3A19w4A.d.ts → types-DlelvQk4.d.ts} +22 -13
- package/dist/{types-cTos-H7p.d.ts → types-DsHGPtkR.d.ts} +68 -32
- package/dist/{types-BXMYB7BY.d.ts → types-ZzRGoViD.d.ts} +77 -24
- package/dist/{types-CQVEQawv.d.ts → types-rCRV4Ge-.d.ts} +24 -14
- package/dist/types-tQB2CEnY.d.ts +262 -0
- package/dist/unplugin/index.d.ts +1 -1
- package/dist/unplugin/index.js +2 -2
- package/dist/usage-0hjZPIRX.js +1 -0
- package/dist/{usage-Bybmck7f.js → usage-B9EtHWLa.js} +50 -26
- package/dist/{usage-CDaLXCfL.js → usage-CBzgwfIs.js} +2 -2
- package/dist/{validation-error-ZfUHbKvf.js → validation-error-CYg2kJEw.js} +4 -1
- package/dist/{validation-error-CQpoquwj.d.ts → validation-error-uvp-kyfO.d.ts} +5 -2
- package/dist/{validity-CZ7-y0Cj.js → validity-Buc7w8E9.js} +13 -10
- package/dist/{verifier-DHuh-okk.js → verifier-DUV6pLqZ.js} +10 -4
- package/dist/{verify-pe8rL_Qw.js → verify-DlUcTDBz.js} +148 -487
- package/dist/version-DMQ0dnN5.js +48 -0
- package/dist/version-DizhmD72.js +1 -0
- package/dist/{views-BB8E9dTP.js → views-CD8wuL4Z.js} +19 -6
- package/dist/{vocabulary-Bg3eeT2H.d.ts → vocabulary-DEJ5j4mR.d.ts} +7 -4
- package/dist/vue/index.d.ts +71 -22
- package/dist/vue/index.js +50 -13
- package/dist/{waiter-DwEyouan.d.ts → waiter-CqUKX6CY.d.ts} +13 -10
- package/dist/{waiter-BGUtGYoU.js → waiter-aBLM63_f.js} +1 -1
- package/dist/{watch-C-4VmFlL.js → watch-BFDKqmUa.js} +8 -8
- package/dist/watch-ClLuO2TL.js +1 -0
- package/dist/webmcp/index.d.ts +11 -11
- package/dist/webmcp/index.js +8 -5
- package/dist/{where-scope-wq2coopv.js → where-scope-DlCdCM_8.js} +24 -18
- package/dist/{who-can-BwNsI_Js.js → who-can-BoDJm0Nc.js} +23 -20
- package/dist/workflow/index.d.ts +3 -3
- package/dist/workflow/index.js +13 -13
- package/dist/workflow-sdk/index.d.ts +19 -13
- package/dist/workflow-sdk/index.js +6 -6
- package/dist/{wrap-CiSc_KCq.js → wrap-B2wziJI_.js} +4 -4
- package/dist/{wrap-B6R0cMRL.d.ts → wrap-DxXB54Wu.d.ts} +8 -5
- package/package.json +8 -8
- package/schemas/catalog-v1.json +3 -0
- package/schemas/supabase-manifest-v1.json +33 -1
- package/skills/permdock-credentials/references/tokens-keys-links.md +8 -6
- package/skills/permdock-data/references/queries-and-rls.md +2 -1
- package/skills/permdock-tenancy/references/ownership-and-custom-roles.md +2 -2
- package/skills/permdock-wire/references/adapters.md +16 -23
- package/dist/catalog-BCCjSAdH.js +0 -1
- package/dist/collect-k_Dulxr5.js +0 -1
- package/dist/config-CoQHDrDi.js +0 -166
- package/dist/denied-text-D4qkEtFz.d.ts +0 -19
- package/dist/fields-ClcQLrVc.js +0 -238
- package/dist/generate-CNU1pIOo.js +0 -171
- package/dist/headers-BIjfMaoC.js +0 -8
- package/dist/headers-CIbDTUTK.d.ts +0 -7
- package/dist/load-DrMHXzgN.js +0 -1
- package/dist/output-files-DPAY7-GX.js +0 -1
- package/dist/package-root-Dk_ETdkp.js +0 -31
- package/dist/parse-local-manifest-e4mdwAKd.d.ts +0 -10
- package/dist/policies-B2lZIurj.js +0 -295
- package/dist/powersync-CExtTLyA.js +0 -1
- package/dist/problem-details-Tcfmj3bV.d.ts +0 -7
- package/dist/protected-BwZYL1X_.d.ts +0 -39
- package/dist/pull-Cty6Ovyu.js +0 -1
- package/dist/run-Bz7DXGEv.js +0 -1
- package/dist/stores-BAZwSYZA.d.ts +0 -31
- package/dist/supabase-hook-DJxC4PoP.js +0 -1
- package/dist/types-CKV71kKh.d.ts +0 -172
- package/dist/usage-y-kBNdqs.js +0 -1
- package/dist/version-CEbQ5UeM.js +0 -18
- package/dist/version-DXkYUISx.js +0 -1
- package/dist/watch-Bd9mx3rd.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as RoleTree, i as RoleMeta, n as PlanTree, r as Role, t as Plan } from "./vocabulary-
|
|
1
|
+
import { M as AppData, N as AppDataSchema, P as MetaValue, b as ResourceNode, d as PermissionKind, f as PermissionTree, k as POLICY_SCOPES, u as Permission } from "./permission-types-CAY-GU7e.js";
|
|
2
|
+
import { a as RoleTree, i as RoleMeta, n as PlanTree, r as Role, t as Plan } from "./vocabulary-DEJ5j4mR.js";
|
|
3
3
|
//#region src/conditions/ast.d.ts
|
|
4
4
|
type ConditionRef = {
|
|
5
5
|
readonly ref: string;
|
|
@@ -64,27 +64,34 @@ type RelatedCondition = {
|
|
|
64
64
|
readonly op: "related";
|
|
65
65
|
readonly resource: string;
|
|
66
66
|
readonly relation: string;
|
|
67
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* The row's own id field, or (with `parent` or `hops`) the field holding the
|
|
69
|
+
* next instance's id.
|
|
70
|
+
*/
|
|
68
71
|
readonly field: string;
|
|
69
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Parent hops walked above the first `resource` instance; `0` reads only that
|
|
74
|
+
* instance.
|
|
75
|
+
*/
|
|
70
76
|
readonly depth: number;
|
|
71
77
|
/** The row is a child of `resource`, reached through `field`. */
|
|
72
78
|
readonly parent?: true;
|
|
73
79
|
/**
|
|
74
|
-
* To-one links from the row to `resource`: `field` points at the first
|
|
75
|
-
*
|
|
76
|
-
*
|
|
80
|
+
* To-one links from the row to `resource`: `field` points at the first hop's
|
|
81
|
+
* resource, each later hop follows `link` on the resource before it, and the
|
|
82
|
+
* last hop's resource is `resource`.
|
|
77
83
|
*/
|
|
78
84
|
readonly hops?: readonly RelatedHop[];
|
|
79
85
|
/**
|
|
80
|
-
* The `resource` instances the subject holds a resource role on; replaces
|
|
81
|
-
*
|
|
86
|
+
* The `resource` instances the subject holds a resource role on; replaces the
|
|
87
|
+
* `relation` lookup (`relation` is then empty).
|
|
82
88
|
*/
|
|
83
89
|
readonly ids?: readonly string[];
|
|
84
90
|
readonly permission?: string;
|
|
85
91
|
/**
|
|
86
92
|
* The row's boolean column that keeps ancestor grants out: with `parent` or
|
|
87
|
-
* `hops`, a restricted row matches nothing; without, the walk stops at the
|
|
93
|
+
* `hops`, a restricted row matches nothing; without, the walk stops at the
|
|
94
|
+
* row.
|
|
88
95
|
*/
|
|
89
96
|
readonly restricted?: string;
|
|
90
97
|
readonly restrictedAncestors?: RestrictedAncestors;
|
|
@@ -117,10 +124,10 @@ type SqlFunctionCondition = {
|
|
|
117
124
|
readonly twin: Condition;
|
|
118
125
|
};
|
|
119
126
|
/**
|
|
120
|
-
* The request's session was checked against the Auth server while the
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
127
|
+
* The request's session was checked against the Auth server while the subject
|
|
128
|
+
* was resolved (`liveSession: true`), not only verified from the token: a
|
|
129
|
+
* revoked session still verifies until `exp`. Written `{ subject: { session: {
|
|
130
|
+
* live: true } } }`.
|
|
124
131
|
*/
|
|
125
132
|
type LiveSessionCondition = {
|
|
126
133
|
readonly op: "liveSession";
|
|
@@ -145,14 +152,18 @@ type FieldOperator = {
|
|
|
145
152
|
readonly notIn?: unknown;
|
|
146
153
|
readonly isNull?: boolean;
|
|
147
154
|
};
|
|
148
|
-
type WhereShorthand<T = Record<string, unknown>> =
|
|
155
|
+
type WhereShorthand<T = Record<string, unknown>> = unknown extends T ? RowWhere<Record<string, unknown>> : RowWhere<T>;
|
|
156
|
+
type RowWhere<T> = {
|
|
149
157
|
readonly and?: readonly WhereShorthand<T>[];
|
|
150
158
|
readonly or?: readonly WhereShorthand<T>[];
|
|
151
159
|
readonly not?: WhereShorthand<T>;
|
|
152
160
|
} & ("subject" extends keyof T ? { readonly [K in keyof T as Exclude<K, "subject">]?: FieldWhere<T[K]>; } & {
|
|
153
161
|
readonly subject?: SubjectWhere | FieldWhere<T["subject"]>;
|
|
154
162
|
} : { readonly [K in keyof T]?: FieldWhere<T[K]>; } & {
|
|
155
|
-
/**
|
|
163
|
+
/**
|
|
164
|
+
* Holds only when the resolver checked the session live (`liveSession:
|
|
165
|
+
* true`).
|
|
166
|
+
*/
|
|
156
167
|
readonly subject?: SubjectWhere;
|
|
157
168
|
});
|
|
158
169
|
type SubjectWhere = {
|
|
@@ -173,11 +184,20 @@ type FieldWhere<V> = V | FieldOperator | {
|
|
|
173
184
|
* credential kinds, delivery channels) stays closed.
|
|
174
185
|
*/
|
|
175
186
|
type OpenUnion<T extends string> = T | (string & NonNullable<unknown>);
|
|
176
|
-
/**
|
|
187
|
+
/**
|
|
188
|
+
* `actor.kind`: the values PermDock's adapters set, or an integrator's own; a
|
|
189
|
+
* policy delegation matches it by equality.
|
|
190
|
+
*/
|
|
177
191
|
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">;
|
|
178
|
-
/**
|
|
192
|
+
/**
|
|
193
|
+
* The adapter a decision event names: a PermDock entry, or an integrator's own
|
|
194
|
+
* adapter.
|
|
195
|
+
*/
|
|
179
196
|
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">;
|
|
180
|
-
/**
|
|
197
|
+
/**
|
|
198
|
+
* How a membership was obtained (`membership.via`); `viaOnly` and support rules
|
|
199
|
+
* match it by equality.
|
|
200
|
+
*/
|
|
181
201
|
type MembershipVia = OpenUnion<"direct" | "contact" | "credential" | "elevated" | "feed" | "link" | "share" | "support" | "support-session" | "scim">;
|
|
182
202
|
//#endregion
|
|
183
203
|
//#region src/core/subject.d.ts
|
|
@@ -210,8 +230,8 @@ type Assurance = {
|
|
|
210
230
|
/**
|
|
211
231
|
* Roles held in one scope instance (`scope` + `id`, with the id of every
|
|
212
232
|
* ancestor scope in `within`) or on one resource (`on`). Evaluation only sees
|
|
213
|
-
* the canonical form; `tenant` / `team` are accepted as input for the first
|
|
214
|
-
*
|
|
233
|
+
* the canonical form; `tenant` / `team` are accepted as input for the first and
|
|
234
|
+
* second declared scope and normalised away.
|
|
215
235
|
*/
|
|
216
236
|
type Membership = {
|
|
217
237
|
readonly scope?: string;
|
|
@@ -222,26 +242,44 @@ type Membership = {
|
|
|
222
242
|
readonly id: string;
|
|
223
243
|
};
|
|
224
244
|
readonly roles: readonly string[];
|
|
225
|
-
/**
|
|
245
|
+
/**
|
|
246
|
+
* Roles the holder may activate here but does not hold; `permdock.activate`
|
|
247
|
+
* writes an elevated membership.
|
|
248
|
+
*/
|
|
226
249
|
readonly eligible?: readonly string[];
|
|
227
250
|
readonly via?: MembershipVia;
|
|
228
251
|
readonly expiresAt?: number;
|
|
229
|
-
/**
|
|
252
|
+
/**
|
|
253
|
+
* The principal id that wrote this membership: who elevated, consented to or
|
|
254
|
+
* granted the access.
|
|
255
|
+
*/
|
|
230
256
|
readonly grantedBy?: string;
|
|
231
|
-
/**
|
|
257
|
+
/**
|
|
258
|
+
* Free text recording why the membership was written: the activation or
|
|
259
|
+
* consent justification.
|
|
260
|
+
*/
|
|
232
261
|
readonly reason?: string;
|
|
233
|
-
/**
|
|
262
|
+
/**
|
|
263
|
+
* A subgroup the holder belongs to inside the instance (`vendor-support`); a
|
|
264
|
+
* `junctionMembershipSource` group column fills it.
|
|
265
|
+
*/
|
|
234
266
|
readonly member?: {
|
|
235
267
|
readonly group: string;
|
|
236
268
|
};
|
|
237
|
-
/**
|
|
269
|
+
/**
|
|
270
|
+
* `idp`: the identity provider (SCIM) owns this membership; the application
|
|
271
|
+
* must not edit it.
|
|
272
|
+
*/
|
|
238
273
|
readonly managedBy?: "idp";
|
|
239
|
-
/**
|
|
274
|
+
/**
|
|
275
|
+
* Seats this membership holds (`dev-mode`, `editor`); `plan()` grantees match
|
|
276
|
+
* them inside the active tenant.
|
|
277
|
+
*/
|
|
240
278
|
readonly entitlements?: readonly string[];
|
|
241
279
|
/**
|
|
242
|
-
* Set when the instance or an ancestor instance is suspended: the
|
|
243
|
-
*
|
|
244
|
-
*
|
|
280
|
+
* Set when the instance or an ancestor instance is suspended: the permission
|
|
281
|
+
* keys the membership still grants (`suspension.scopes.<scope>.keep`). Every
|
|
282
|
+
* other grant, allow or deny, ignores it, and so do role listings.
|
|
245
283
|
*/
|
|
246
284
|
readonly keep?: readonly string[];
|
|
247
285
|
/**
|
|
@@ -257,13 +295,16 @@ type Membership = {
|
|
|
257
295
|
readonly team?: string;
|
|
258
296
|
};
|
|
259
297
|
/**
|
|
260
|
-
* One permission a custom role adds or removes. It names a declared
|
|
261
|
-
*
|
|
298
|
+
* One permission a custom role adds or removes. It names a declared permission
|
|
299
|
+
* key and carries no condition, approval or limit of its own.
|
|
262
300
|
*/
|
|
263
301
|
type CustomRoleGrant = {
|
|
264
302
|
readonly permission: string;
|
|
265
303
|
readonly effect?: "allow" | "deny";
|
|
266
|
-
/**
|
|
304
|
+
/**
|
|
305
|
+
* A level the permission's resource declares (`resource(…, { levels })`);
|
|
306
|
+
* allows only.
|
|
307
|
+
*/
|
|
267
308
|
readonly level?: string;
|
|
268
309
|
};
|
|
269
310
|
type CustomRoleBody = {
|
|
@@ -271,9 +312,9 @@ type CustomRoleBody = {
|
|
|
271
312
|
readonly includes?: readonly string[];
|
|
272
313
|
readonly grants?: readonly CustomRoleGrant[];
|
|
273
314
|
/**
|
|
274
|
-
* Display text and app data, carried onto the role leaf
|
|
275
|
-
*
|
|
276
|
-
*
|
|
315
|
+
* Display text and app data, carried onto the role leaf `assignableRoles()`
|
|
316
|
+
* returns. `x` is checked by the role tree's `defineRoles(…, { x })` schema;
|
|
317
|
+
* an invalid `x` is dropped, not the role.
|
|
277
318
|
*/
|
|
278
319
|
readonly meta?: RoleMeta;
|
|
279
320
|
};
|
|
@@ -281,7 +322,10 @@ type CustomRoleBody = {
|
|
|
281
322
|
type TenantCustomRole = CustomRoleBody & {
|
|
282
323
|
/** The instance of the first scope that owns the role. */
|
|
283
324
|
readonly tenant: string;
|
|
284
|
-
/**
|
|
325
|
+
/**
|
|
326
|
+
* The scope the role is held at; defaults to the first scope. Its ceiling is
|
|
327
|
+
* that scope's assignable roles.
|
|
328
|
+
*/
|
|
285
329
|
readonly scope?: string;
|
|
286
330
|
/** Pins the role to one instance of `scope`. */
|
|
287
331
|
readonly id?: string;
|
|
@@ -302,14 +346,17 @@ type GlobalCustomRole = CustomRoleBody & {
|
|
|
302
346
|
readonly shared?: undefined;
|
|
303
347
|
};
|
|
304
348
|
/**
|
|
305
|
-
* A role the platform defines once for every tenant, held on memberships of
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
349
|
+
* A role the platform defines once for every tenant, held on memberships of its
|
|
350
|
+
* scope in any tenant. Tenant admins assign it but never edit it. Its ceiling
|
|
351
|
+
* is the assignable declared roles of its scope; its name wins over a tenant
|
|
352
|
+
* custom role of the same name.
|
|
309
353
|
*/
|
|
310
354
|
type SharedCustomRole = CustomRoleBody & {
|
|
311
355
|
readonly shared: true;
|
|
312
|
-
/**
|
|
356
|
+
/**
|
|
357
|
+
* The scope the role is held at, never `'global'`; defaults to the first
|
|
358
|
+
* scope.
|
|
359
|
+
*/
|
|
313
360
|
readonly scope?: string;
|
|
314
361
|
readonly tenant?: undefined;
|
|
315
362
|
readonly id?: undefined;
|
|
@@ -320,21 +367,27 @@ type Principal = {
|
|
|
320
367
|
readonly id: string;
|
|
321
368
|
readonly issuer?: string;
|
|
322
369
|
/**
|
|
323
|
-
* `contact`: an external person (a customer contact, a portal user). Only
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
370
|
+
* `contact`: an external person (a customer contact, a portal user). Only its
|
|
371
|
+
* `{ on }` memberships count; it never approves, creates keys or publishes,
|
|
372
|
+
* and is read-only unless a role whose `for` lists `contact` grants the
|
|
373
|
+
* write.
|
|
327
374
|
*/
|
|
328
375
|
readonly kind?: "user" | "service" | "workload" | "link" | "feed" | "contact";
|
|
329
376
|
readonly roles?: readonly string[];
|
|
330
377
|
readonly plans?: readonly string[];
|
|
331
378
|
readonly memberships?: readonly Membership[];
|
|
332
|
-
/**
|
|
379
|
+
/**
|
|
380
|
+
* The token dropped memberships to stay under its size budget; a
|
|
381
|
+
* `claimsFirst` source reads the rest.
|
|
382
|
+
*/
|
|
333
383
|
readonly membershipsTruncated?: boolean;
|
|
334
384
|
/** The authorization version the token was minted at (`authz_ver`). */
|
|
335
385
|
readonly authzVersion?: number;
|
|
336
386
|
readonly tenant?: string;
|
|
337
|
-
/**
|
|
387
|
+
/**
|
|
388
|
+
* Set by core when a requested tenant is not one the subject holds: the
|
|
389
|
+
* denial is then `no-membership`, not `no-tenant`. Never read from a token.
|
|
390
|
+
*/
|
|
338
391
|
readonly unheldTenant?: string;
|
|
339
392
|
readonly assurance?: Assurance;
|
|
340
393
|
readonly binding?: Binding;
|
|
@@ -344,9 +397,16 @@ type Actor = {
|
|
|
344
397
|
readonly id: string;
|
|
345
398
|
readonly kind: ActorKind;
|
|
346
399
|
readonly binding?: Binding;
|
|
347
|
-
/**
|
|
400
|
+
/**
|
|
401
|
+
* `true` denies every permission without `readOnlyHint` (`not-delegated`),
|
|
402
|
+
* with or without a policy delegation.
|
|
403
|
+
*/
|
|
348
404
|
readonly readOnly?: boolean;
|
|
349
|
-
/**
|
|
405
|
+
/**
|
|
406
|
+
* The stable name the application gives this OAuth client (`ClientNames`),
|
|
407
|
+
* set by the subject resolver from the verified client id; policy delegations
|
|
408
|
+
* match it with `to: { kind, client }`.
|
|
409
|
+
*/
|
|
350
410
|
readonly client?: string;
|
|
351
411
|
readonly [key: string]: unknown;
|
|
352
412
|
};
|
|
@@ -369,7 +429,16 @@ type Subject<TPrincipal extends Principal = Principal> = {
|
|
|
369
429
|
readonly context: Readonly<Record<string, unknown>>;
|
|
370
430
|
readonly session?: string;
|
|
371
431
|
readonly expiresAt?: number;
|
|
372
|
-
/**
|
|
432
|
+
/**
|
|
433
|
+
* When the verified token was issued (`iat`), in seconds since the epoch. A
|
|
434
|
+
* `VersionCache` trusts the token's `authzVersion` for its `maxStaleMs` after
|
|
435
|
+
* it.
|
|
436
|
+
*/
|
|
437
|
+
readonly issuedAt?: number;
|
|
438
|
+
/**
|
|
439
|
+
* The token's memberships are behind the source's authorization version:
|
|
440
|
+
* `fresh` permissions deny.
|
|
441
|
+
*/
|
|
373
442
|
readonly stale?: true;
|
|
374
443
|
/**
|
|
375
444
|
* The resolver checked the session against the Auth server for this request
|
|
@@ -381,7 +450,10 @@ type Subject<TPrincipal extends Principal = Principal> = {
|
|
|
381
450
|
//#endregion
|
|
382
451
|
//#region src/core/decision.d.ts
|
|
383
452
|
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" | "no-tenant" | "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";
|
|
384
|
-
/**
|
|
453
|
+
/**
|
|
454
|
+
* The `detail` each denial reason carries, where PermDock sets a structured
|
|
455
|
+
* one.
|
|
456
|
+
*/
|
|
385
457
|
type DenialDetails = {
|
|
386
458
|
readonly limit: LimitDetail;
|
|
387
459
|
/** The window the inactive allow applies in. */
|
|
@@ -413,18 +485,21 @@ type MatchedGrant = {
|
|
|
413
485
|
readonly check?: Grant["check"];
|
|
414
486
|
readonly approval?: "human" | ApprovalRequirement;
|
|
415
487
|
readonly provider?: string;
|
|
416
|
-
/**
|
|
488
|
+
/**
|
|
489
|
+
* The hosted policy document fingerprint and grant id, when a hosted grant
|
|
490
|
+
* matched.
|
|
491
|
+
*/
|
|
417
492
|
readonly hosted?: HostedGrantRef;
|
|
418
493
|
/** A break-glass grant overrode a matching deny. */
|
|
419
494
|
readonly breakGlass?: true;
|
|
420
495
|
};
|
|
421
496
|
/**
|
|
422
497
|
* Something the caller owes alongside a granted action. `over-limit`: a soft
|
|
423
|
-
* `limit` was past its count; `near-limit`: usage reached `alertAt`.
|
|
424
|
-
* `
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
498
|
+
* `limit` was past its count; `near-limit`: usage reached `alertAt`. `notify` /
|
|
499
|
+
* `review`: a break-glass grant's declared follow-ups. `justify`: the
|
|
500
|
+
* break-glass reason, carried so audit records why. `app`: a follow-up the
|
|
501
|
+
* application declared on the grant (`allow(p, { obligations })`); PermDock
|
|
502
|
+
* carries it and never acts on it.
|
|
428
503
|
*/
|
|
429
504
|
type Obligation = {
|
|
430
505
|
readonly kind: "over-limit" | "near-limit" | "notify" | "review";
|
|
@@ -445,8 +520,8 @@ type Quota = {
|
|
|
445
520
|
readonly resetsAt: string;
|
|
446
521
|
};
|
|
447
522
|
/**
|
|
448
|
-
* The `detail` of a `limit` denial: the grant's `count`, its `per` window
|
|
449
|
-
*
|
|
523
|
+
* The `detail` of a `limit` denial: the grant's `count`, its `per` window in
|
|
524
|
+
* seconds and when the window resets (RFC 3339).
|
|
450
525
|
*/
|
|
451
526
|
type LimitDetail = {
|
|
452
527
|
readonly count: number;
|
|
@@ -454,14 +529,13 @@ type LimitDetail = {
|
|
|
454
529
|
readonly resetsAt: string;
|
|
455
530
|
};
|
|
456
531
|
/**
|
|
457
|
-
* Why a candidate grant for the permission was passed over before its
|
|
458
|
-
*
|
|
459
|
-
*
|
|
460
|
-
*
|
|
461
|
-
*
|
|
462
|
-
*
|
|
463
|
-
*
|
|
464
|
-
* asserted purpose).
|
|
532
|
+
* Why a candidate grant for the permission was passed over before its condition
|
|
533
|
+
* ran: `via-only` (the subject holds no membership of its kind), `purpose` (no
|
|
534
|
+
* asserted purpose it lists), `field` (its `fields` do not cover the requested
|
|
535
|
+
* field), `grantee` (its `to` did not match and added no denial), `role` (a
|
|
536
|
+
* role it names is not held), `validity` (a deny outside its `validFrom` /
|
|
537
|
+
* `validUntil`; an inactive allow adds an `inactive-grant` denial instead),
|
|
538
|
+
* `break-glass-inactive` (a break-glass grant with no asserted purpose).
|
|
465
539
|
*/
|
|
466
540
|
type TraceSkipReason = "via-only" | "purpose" | "field" | "grantee" | "role" | "validity" | "unknown-level" | "break-glass-inactive";
|
|
467
541
|
type TraceSkip = {
|
|
@@ -469,15 +543,18 @@ type TraceSkip = {
|
|
|
469
543
|
readonly permission: string;
|
|
470
544
|
readonly effect: "allow" | "deny";
|
|
471
545
|
readonly why: TraceSkipReason;
|
|
472
|
-
/**
|
|
546
|
+
/**
|
|
547
|
+
* The level a custom role names that its resource does not declare, for
|
|
548
|
+
* `unknown-level`.
|
|
549
|
+
*/
|
|
473
550
|
readonly level?: string;
|
|
474
551
|
};
|
|
475
552
|
/**
|
|
476
|
-
* What `explain` saw: how many candidate grants it examined before the
|
|
477
|
-
*
|
|
478
|
-
*
|
|
479
|
-
*
|
|
480
|
-
*
|
|
553
|
+
* What `explain` saw: how many candidate grants it examined before the outcome,
|
|
554
|
+
* which allows matched (including the ones a deny overrode), which denies
|
|
555
|
+
* matched, and which grants it passed over. `denies[0]` is the deny that
|
|
556
|
+
* produced a `deny` outcome, or the deny a break-glass grant lifted. Pure local
|
|
557
|
+
* computation; never on a decision event.
|
|
481
558
|
*/
|
|
482
559
|
type Trace = {
|
|
483
560
|
readonly evaluated: number;
|
|
@@ -504,8 +581,8 @@ type GrantedDecision = {
|
|
|
504
581
|
type DeniedDecision = {
|
|
505
582
|
readonly outcome: "denied";
|
|
506
583
|
/**
|
|
507
|
-
* The key of the permission that was checked. Absent on a denial for a
|
|
508
|
-
*
|
|
584
|
+
* The key of the permission that was checked. Absent on a denial for a check
|
|
585
|
+
* that named no declared permission.
|
|
509
586
|
*/
|
|
510
587
|
readonly permission?: string;
|
|
511
588
|
readonly denials: readonly Denial[];
|
|
@@ -552,7 +629,10 @@ type RelationGrantee = {
|
|
|
552
629
|
* to `resource`, then walk its parents only when `depth` is set.
|
|
553
630
|
*/
|
|
554
631
|
readonly through?: "parent" | readonly string[];
|
|
555
|
-
/**
|
|
632
|
+
/**
|
|
633
|
+
* Parent hops walked above the first `resource` instance; absent means
|
|
634
|
+
* `DEFAULT_RELATION_DEPTH` for `'parent'` and `0` for links.
|
|
635
|
+
*/
|
|
556
636
|
readonly depth?: number;
|
|
557
637
|
};
|
|
558
638
|
type PlanGrantee = {
|
|
@@ -601,23 +681,26 @@ type UserApprover = {
|
|
|
601
681
|
readonly id: string;
|
|
602
682
|
};
|
|
603
683
|
/**
|
|
604
|
-
* Whoever holds `permission` in the request's tenant, through any role,
|
|
605
|
-
*
|
|
606
|
-
* (`ApprovalVerdict.permissions`) that the handler computes from the
|
|
607
|
-
*
|
|
684
|
+
* Whoever holds `permission` in the request's tenant, through any role, custom
|
|
685
|
+
* roles included. Checked only through verdict facts
|
|
686
|
+
* (`ApprovalVerdict.permissions`) that the handler computes from the approver's
|
|
687
|
+
* own instance.
|
|
608
688
|
*/
|
|
609
689
|
type PermissionApprover = {
|
|
610
690
|
readonly kind: "permission";
|
|
611
691
|
readonly permission: string;
|
|
612
692
|
};
|
|
613
|
-
/**
|
|
693
|
+
/**
|
|
694
|
+
* An approver who matches at least one item; an item that is a list matches
|
|
695
|
+
* when every entry does.
|
|
696
|
+
*/
|
|
614
697
|
type AnyOfApprover = {
|
|
615
698
|
readonly kind: "any-of";
|
|
616
699
|
readonly of: readonly (Approver | readonly Approver[])[];
|
|
617
700
|
};
|
|
618
701
|
/**
|
|
619
|
-
* Who may approve: a subject-only grantee, a `relation()` the approver holds
|
|
620
|
-
*
|
|
702
|
+
* Who may approve: a subject-only grantee, a `relation()` the approver holds on
|
|
703
|
+
* the requested row (checked when the verdict is given), `user(id)`,
|
|
621
704
|
* `holder(permission)`, or `anyOf(...)`. A list (or `allOf(...)`) matches an
|
|
622
705
|
* approver who satisfies every item.
|
|
623
706
|
*/
|
|
@@ -626,7 +709,10 @@ type ApproverInput = GranteeInput | UserApprover | PermissionApprover | {
|
|
|
626
709
|
readonly kind: "any-of";
|
|
627
710
|
readonly of: readonly ApproverInput[];
|
|
628
711
|
} | readonly ApproverInput[];
|
|
629
|
-
/**
|
|
712
|
+
/**
|
|
713
|
+
* Approves when the approver holds `permission` in the request's tenant (any
|
|
714
|
+
* role, custom roles included).
|
|
715
|
+
*/
|
|
630
716
|
declare function holder(permission: Permission): PermissionApprover;
|
|
631
717
|
/** Approves when the approver matches any one of `items`. */
|
|
632
718
|
declare function anyOf(...items: readonly ApproverInput[]): {
|
|
@@ -639,29 +725,35 @@ declare function allOf(...items: readonly ApproverInput[]): readonly ApproverInp
|
|
|
639
725
|
declare function user(id: string): UserApprover;
|
|
640
726
|
//#endregion
|
|
641
727
|
//#region src/core/scopes.d.ts
|
|
642
|
-
/**
|
|
728
|
+
/**
|
|
729
|
+
* One entry of `definePolicy({ scopes })`: the row field holding the scope id,
|
|
730
|
+
* and its parent scope.
|
|
731
|
+
*/
|
|
643
732
|
type ScopeDeclaration = {
|
|
644
733
|
readonly key: string;
|
|
645
734
|
readonly within?: string;
|
|
646
735
|
};
|
|
647
736
|
type PolicyScopesInput = Readonly<Record<string, ScopeDeclaration>>;
|
|
648
737
|
/**
|
|
649
|
-
* A declared scope, in declaration order. `key` is absent only on the
|
|
650
|
-
*
|
|
738
|
+
* A declared scope, in declaration order. `key` is absent only on the implicit
|
|
739
|
+
* `tenant` / `team` pair of a policy that declares no scopes.
|
|
651
740
|
*/
|
|
652
741
|
type Scope = {
|
|
653
742
|
readonly name: string;
|
|
654
743
|
readonly key?: string;
|
|
655
744
|
readonly within?: string;
|
|
656
745
|
};
|
|
657
|
-
/**
|
|
746
|
+
/**
|
|
747
|
+
* The names `role(..., { on })`, `memberOf` and memberships may use: declared
|
|
748
|
+
* names plus the aliases.
|
|
749
|
+
*/
|
|
658
750
|
type ScopeNames<S> = [S] extends [PolicyScopesInput] ? string extends keyof S ? string : (keyof S & string) | "tenant" | "team" : string;
|
|
659
751
|
//#endregion
|
|
660
752
|
//#region src/core/wire-delegation.d.ts
|
|
661
753
|
/**
|
|
662
|
-
* A delegation as every PermDock wire form carries it: OAuth `scope`
|
|
663
|
-
*
|
|
664
|
-
*
|
|
754
|
+
* A delegation as every PermDock wire form carries it: OAuth `scope` (RFC 6749,
|
|
755
|
+
* space-separated) and RFC 9396 `authorization_details`. An empty `scope` is an
|
|
756
|
+
* empty scope list, which delegates nothing.
|
|
665
757
|
*/
|
|
666
758
|
type WireDelegation = {
|
|
667
759
|
readonly scope?: string;
|
|
@@ -672,9 +764,9 @@ type WireDelegation = {
|
|
|
672
764
|
//#region src/core/wire-denial.d.ts
|
|
673
765
|
/**
|
|
674
766
|
* A denial as it leaves the process: in a decision event, a Problem Details
|
|
675
|
-
* body, an MCP or WebMCP refusal and the decision endpoint. `detail` is a
|
|
676
|
-
*
|
|
677
|
-
*
|
|
767
|
+
* body, an MCP or WebMCP refusal and the decision endpoint. `detail` is a JSON
|
|
768
|
+
* value (a string, or `LimitDetail` on `limit`); what a closure threw and a
|
|
769
|
+
* validation error stay in process.
|
|
678
770
|
*/
|
|
679
771
|
type WireDenial = {
|
|
680
772
|
readonly role: string | null;
|
|
@@ -682,7 +774,10 @@ type WireDenial = {
|
|
|
682
774
|
readonly to?: Grantee | readonly Grantee[];
|
|
683
775
|
readonly detail?: unknown;
|
|
684
776
|
};
|
|
685
|
-
/**
|
|
777
|
+
/**
|
|
778
|
+
* A `Decision` whose denials are `WireDenial`s, as the decision endpoint sends
|
|
779
|
+
* it.
|
|
780
|
+
*/
|
|
686
781
|
type WireDecision = GrantedDecision | ApprovalRequiredDecision | (Omit<DeniedDecision, "denials"> & {
|
|
687
782
|
readonly denials: readonly WireDenial[];
|
|
688
783
|
});
|
|
@@ -706,7 +801,10 @@ type DirectoryEvent = {
|
|
|
706
801
|
readonly iss?: string;
|
|
707
802
|
};
|
|
708
803
|
readonly active?: boolean;
|
|
709
|
-
/**
|
|
804
|
+
/**
|
|
805
|
+
* The application's own data, set where the event is built; plain JSON, never
|
|
806
|
+
* read by a decision.
|
|
807
|
+
*/
|
|
710
808
|
readonly x?: AppData;
|
|
711
809
|
};
|
|
712
810
|
type MembershipEvent = {
|
|
@@ -717,7 +815,10 @@ type MembershipEvent = {
|
|
|
717
815
|
readonly principal: {
|
|
718
816
|
readonly id: string;
|
|
719
817
|
};
|
|
720
|
-
/**
|
|
818
|
+
/**
|
|
819
|
+
* A declared scope name, or the `tenant` / `team` alias; absent for a global
|
|
820
|
+
* role change.
|
|
821
|
+
*/
|
|
721
822
|
readonly scope?: string;
|
|
722
823
|
/** The scope instance; present exactly when `scope` is. */
|
|
723
824
|
readonly id?: string;
|
|
@@ -734,13 +835,16 @@ type MembershipEvent = {
|
|
|
734
835
|
readonly id: string;
|
|
735
836
|
readonly kind: string;
|
|
736
837
|
};
|
|
737
|
-
/**
|
|
838
|
+
/**
|
|
839
|
+
* The application's own data, set where the event is built; plain JSON, never
|
|
840
|
+
* read by a decision.
|
|
841
|
+
*/
|
|
738
842
|
readonly x?: AppData;
|
|
739
843
|
};
|
|
740
844
|
/**
|
|
741
845
|
* An API key's lifecycle: `created`, `rotated` and `revoked` from the
|
|
742
|
-
* application or a credential store, `used` from `subjectFromApiKey`. A
|
|
743
|
-
*
|
|
846
|
+
* application or a credential store, `used` from `subjectFromApiKey`. A `used`
|
|
847
|
+
* event carries `sample`, the fraction of uses reported.
|
|
744
848
|
*/
|
|
745
849
|
type CredentialEvent = {
|
|
746
850
|
readonly type: "credential";
|
|
@@ -762,7 +866,10 @@ type CredentialEvent = {
|
|
|
762
866
|
readonly kind: string;
|
|
763
867
|
};
|
|
764
868
|
readonly sample?: number;
|
|
765
|
-
/**
|
|
869
|
+
/**
|
|
870
|
+
* The application's own data, set where the event is built; plain JSON, never
|
|
871
|
+
* read by a decision.
|
|
872
|
+
*/
|
|
766
873
|
readonly x?: AppData;
|
|
767
874
|
};
|
|
768
875
|
/**
|
|
@@ -798,7 +905,10 @@ type AutomationEvent = {
|
|
|
798
905
|
readonly id: string;
|
|
799
906
|
readonly kind: string;
|
|
800
907
|
};
|
|
801
|
-
/**
|
|
908
|
+
/**
|
|
909
|
+
* The application's own data, set where the event is built; plain JSON, never
|
|
910
|
+
* read by a decision.
|
|
911
|
+
*/
|
|
802
912
|
readonly x?: AppData;
|
|
803
913
|
};
|
|
804
914
|
type SinkEvent = DecisionEvent | DirectoryEvent | MembershipEvent | CredentialEvent | AccessEvent | AutomationEvent | DeliveryEvent;
|
|
@@ -807,14 +917,14 @@ type DeliveryChannel = "email" | "chat" | "webhook";
|
|
|
807
917
|
/** What an email is for; only `notification` mail carries `List-Unsubscribe`. */
|
|
808
918
|
type EmailCategory = "transactional" | "notification" | "security" | "approval";
|
|
809
919
|
/**
|
|
810
|
-
* Why a delivery failed. `denied` and `unlinked` are the router's refusals of
|
|
811
|
-
*
|
|
920
|
+
* Why a delivery failed. `denied` and `unlinked` are the router's refusals of a
|
|
921
|
+
* recipient; the rest come from a transport or a provider webhook.
|
|
812
922
|
*/
|
|
813
923
|
type DeliveryFailureCause = "denied" | "unlinked" | "no-transport" | "no-message" | "invalid-recipient" | "invalid-message" | "rate-limited" | "quota-exceeded" | "unauthorized" | "unavailable" | "suppressed" | "rejected";
|
|
814
924
|
/**
|
|
815
925
|
* One recipient's delivery: `sent` when a transport accepted it, then
|
|
816
|
-
* `delivered`, `bounced` or `complained` from the provider, or `failed`.
|
|
817
|
-
*
|
|
926
|
+
* `delivered`, `bounced` or `complained` from the provider, or `failed`. It
|
|
927
|
+
* carries no address, only the principal the router checked.
|
|
818
928
|
*/
|
|
819
929
|
type DeliveryEvent = {
|
|
820
930
|
readonly type: "delivery";
|
|
@@ -827,7 +937,10 @@ type DeliveryEvent = {
|
|
|
827
937
|
readonly id: string;
|
|
828
938
|
readonly key: string;
|
|
829
939
|
};
|
|
830
|
-
/**
|
|
940
|
+
/**
|
|
941
|
+
* The checked principal, or `trusted` for an address the server loaded
|
|
942
|
+
* itself.
|
|
943
|
+
*/
|
|
831
944
|
readonly recipient?: {
|
|
832
945
|
readonly principal?: {
|
|
833
946
|
readonly id: string;
|
|
@@ -851,7 +964,10 @@ type DeliveryEvent = {
|
|
|
851
964
|
readonly retryable?: boolean;
|
|
852
965
|
/** The denial reason when `cause` is `denied`. */
|
|
853
966
|
readonly reason?: string;
|
|
854
|
-
/**
|
|
967
|
+
/**
|
|
968
|
+
* The application's own data, set where the event is built; plain JSON, never
|
|
969
|
+
* read by a decision.
|
|
970
|
+
*/
|
|
855
971
|
readonly x?: AppData;
|
|
856
972
|
};
|
|
857
973
|
/**
|
|
@@ -891,7 +1007,10 @@ type AccessEvent = {
|
|
|
891
1007
|
};
|
|
892
1008
|
/** A `SupportSession`'s permission keys. */
|
|
893
1009
|
readonly permissions?: readonly string[];
|
|
894
|
-
/**
|
|
1010
|
+
/**
|
|
1011
|
+
* The application's own data, set where the event is built; plain JSON, never
|
|
1012
|
+
* read by a decision.
|
|
1013
|
+
*/
|
|
895
1014
|
readonly x?: AppData;
|
|
896
1015
|
};
|
|
897
1016
|
type DecisionEvent = {
|
|
@@ -915,14 +1034,20 @@ type DecisionEvent = {
|
|
|
915
1034
|
readonly id: string;
|
|
916
1035
|
readonly kind: string;
|
|
917
1036
|
};
|
|
918
|
-
/**
|
|
1037
|
+
/**
|
|
1038
|
+
* OAuth `scope` and RFC 9396 `authorization_details`, as every wire form
|
|
1039
|
+
* carries a delegation.
|
|
1040
|
+
*/
|
|
919
1041
|
readonly delegation?: WireDelegation;
|
|
920
1042
|
/** The API key the subject came from. */
|
|
921
1043
|
readonly credential?: {
|
|
922
1044
|
readonly id: string;
|
|
923
1045
|
readonly kind: CredentialKind;
|
|
924
1046
|
};
|
|
925
|
-
/**
|
|
1047
|
+
/**
|
|
1048
|
+
* The support session the subject came from: the `id` its `access` events
|
|
1049
|
+
* carry as `session.id`.
|
|
1050
|
+
*/
|
|
926
1051
|
readonly supportSession?: {
|
|
927
1052
|
readonly id: string;
|
|
928
1053
|
};
|
|
@@ -946,7 +1071,10 @@ type DecisionEvent = {
|
|
|
946
1071
|
};
|
|
947
1072
|
/** What a granted decision owes, as on `GrantedDecision.obligations`. */
|
|
948
1073
|
readonly obligations?: readonly Obligation[];
|
|
949
|
-
/**
|
|
1074
|
+
/**
|
|
1075
|
+
* Purposes of use the caller asserted (`context.purpose`); present when any
|
|
1076
|
+
* was.
|
|
1077
|
+
*/
|
|
950
1078
|
readonly purpose?: readonly string[];
|
|
951
1079
|
/** The justification the caller supplied (`context.reason`); present when set. */
|
|
952
1080
|
readonly reason?: string;
|
|
@@ -957,7 +1085,10 @@ type DecisionEvent = {
|
|
|
957
1085
|
/** The call that produced the decision. */
|
|
958
1086
|
readonly call: "can" | "decide" | "assert" | "filter" | "endpoint" | "adapter" | "approval" | "simulate" | "explain";
|
|
959
1087
|
readonly adapter?: AdapterId;
|
|
960
|
-
/**
|
|
1088
|
+
/**
|
|
1089
|
+
* The model id the agent model gate decided, or the model that drove the
|
|
1090
|
+
* call.
|
|
1091
|
+
*/
|
|
961
1092
|
readonly model?: string;
|
|
962
1093
|
/** Set on an approval lifecycle event (`com.permdock.approval.<phase>`). */
|
|
963
1094
|
readonly phase?: "requested" | "resolved" | "expired" | "cancelled";
|
|
@@ -966,7 +1097,10 @@ type DecisionEvent = {
|
|
|
966
1097
|
readonly denied: number;
|
|
967
1098
|
readonly approvalRequired: number;
|
|
968
1099
|
};
|
|
969
|
-
/**
|
|
1100
|
+
/**
|
|
1101
|
+
* The application's own data, set where the event is built; plain JSON, never
|
|
1102
|
+
* read by a decision.
|
|
1103
|
+
*/
|
|
970
1104
|
readonly x?: AppData;
|
|
971
1105
|
};
|
|
972
1106
|
type AuthEvent = {
|
|
@@ -985,7 +1119,10 @@ type AuthEvent = {
|
|
|
985
1119
|
//#region src/core/snapshot-types.d.ts
|
|
986
1120
|
type Snapshot = {
|
|
987
1121
|
readonly v: 1;
|
|
988
|
-
/**
|
|
1122
|
+
/**
|
|
1123
|
+
* RFC 3339. The epoch for a snapshot built without a clock. Signed, it is the
|
|
1124
|
+
* token's `iat`.
|
|
1125
|
+
*/
|
|
989
1126
|
readonly issuedAt: string;
|
|
990
1127
|
readonly subject: {
|
|
991
1128
|
readonly principal: {
|
|
@@ -995,13 +1132,19 @@ type Snapshot = {
|
|
|
995
1132
|
readonly tenant?: string;
|
|
996
1133
|
readonly memberships?: readonly Membership[];
|
|
997
1134
|
} | null;
|
|
998
|
-
/**
|
|
1135
|
+
/**
|
|
1136
|
+
* OAuth `scope` and RFC 9396 `authorization_details`, as the token carried
|
|
1137
|
+
* them.
|
|
1138
|
+
*/
|
|
999
1139
|
readonly delegation?: WireDelegation;
|
|
1000
1140
|
readonly context: Readonly<Record<string, unknown>>;
|
|
1001
1141
|
};
|
|
1002
1142
|
/** Roles held in the active tenant, in rank order. */
|
|
1003
1143
|
readonly roles: readonly string[];
|
|
1004
|
-
/**
|
|
1144
|
+
/**
|
|
1145
|
+
* The distinct `meta.audience` values of `roles`, in rank order; absent when
|
|
1146
|
+
* none has one.
|
|
1147
|
+
*/
|
|
1005
1148
|
readonly audiences?: readonly string[];
|
|
1006
1149
|
readonly grants: readonly SnapshotGrant[];
|
|
1007
1150
|
readonly tenants: readonly string[];
|
|
@@ -1013,18 +1156,24 @@ type Snapshot = {
|
|
|
1013
1156
|
readonly roles?: Readonly<Record<string, Role>>;
|
|
1014
1157
|
readonly plans?: Readonly<Record<string, Plan>>;
|
|
1015
1158
|
};
|
|
1016
|
-
/**
|
|
1159
|
+
/**
|
|
1160
|
+
* The policy's scopes in order, so a client checks the row against each
|
|
1161
|
+
* membership's instance.
|
|
1162
|
+
*/
|
|
1017
1163
|
readonly scopes?: readonly SnapshotScope[];
|
|
1018
|
-
/**
|
|
1164
|
+
/**
|
|
1165
|
+
* One entry per tenant in `tenants`: what the subject may hand out there.
|
|
1166
|
+
* Absent without tenants.
|
|
1167
|
+
*/
|
|
1019
1168
|
readonly assignable?: readonly SnapshotAssignable[];
|
|
1020
1169
|
/**
|
|
1021
|
-
* Allow grants of held roles that only a plan the subject lacks keeps
|
|
1022
|
-
*
|
|
1170
|
+
* Allow grants of held roles that only a plan the subject lacks keeps from
|
|
1171
|
+
* applying; they grant nothing and name the plan a denial asks for.
|
|
1023
1172
|
*/
|
|
1024
1173
|
readonly notEntitled?: readonly SnapshotNotEntitled[];
|
|
1025
1174
|
/**
|
|
1026
|
-
* The row id field per resource whose `id` option is not `id`, for the
|
|
1027
|
-
*
|
|
1175
|
+
* The row id field per resource whose `id` option is not `id`, for the grants
|
|
1176
|
+
* in `grants`. Absent when every one reads `id`.
|
|
1028
1177
|
*/
|
|
1029
1178
|
readonly ids?: Readonly<Record<string, string>>;
|
|
1030
1179
|
/**
|
|
@@ -1035,7 +1184,10 @@ type Snapshot = {
|
|
|
1035
1184
|
*/
|
|
1036
1185
|
readonly delegated?: readonly string[];
|
|
1037
1186
|
};
|
|
1038
|
-
/**
|
|
1187
|
+
/**
|
|
1188
|
+
* A grant the subject would hold on another plan: its permission, role and
|
|
1189
|
+
* `to`.
|
|
1190
|
+
*/
|
|
1039
1191
|
type SnapshotNotEntitled = {
|
|
1040
1192
|
readonly permission: string;
|
|
1041
1193
|
readonly role: string | null;
|
|
@@ -1046,17 +1198,29 @@ type SnapshotScope = {
|
|
|
1046
1198
|
readonly name: string;
|
|
1047
1199
|
readonly key: string;
|
|
1048
1200
|
readonly within?: string;
|
|
1049
|
-
/**
|
|
1201
|
+
/**
|
|
1202
|
+
* Resources whose rows this scope's key partitions, from their `memberOf`
|
|
1203
|
+
* relations.
|
|
1204
|
+
*/
|
|
1050
1205
|
readonly resources?: readonly string[];
|
|
1051
|
-
/**
|
|
1206
|
+
/**
|
|
1207
|
+
* Resource name to the field holding this scope's id, for a resource whose
|
|
1208
|
+
* field is not `key` (its own `id`).
|
|
1209
|
+
*/
|
|
1052
1210
|
readonly fields?: Readonly<Record<string, string>>;
|
|
1053
1211
|
};
|
|
1054
|
-
/**
|
|
1212
|
+
/**
|
|
1213
|
+
* The declared roles and the custom-role ceiling the subject may assign in one
|
|
1214
|
+
* tenant.
|
|
1215
|
+
*/
|
|
1055
1216
|
type SnapshotAssignable = {
|
|
1056
1217
|
readonly tenant: string;
|
|
1057
1218
|
readonly roles: readonly string[];
|
|
1058
1219
|
readonly permissions: readonly Permission[];
|
|
1059
|
-
/**
|
|
1220
|
+
/**
|
|
1221
|
+
* Permission key to the levels the subject may hand out; only permissions
|
|
1222
|
+
* whose resource declares levels.
|
|
1223
|
+
*/
|
|
1060
1224
|
readonly levels?: Readonly<Record<string, readonly string[]>>;
|
|
1061
1225
|
};
|
|
1062
1226
|
type SnapshotGrant = {
|
|
@@ -1074,7 +1238,10 @@ type SnapshotGrant = {
|
|
|
1074
1238
|
readonly membership?: Membership;
|
|
1075
1239
|
readonly portable?: false;
|
|
1076
1240
|
readonly fields?: readonly string[];
|
|
1077
|
-
/**
|
|
1241
|
+
/**
|
|
1242
|
+
* When the grant applies (RFC 3339, `from` inclusive, `until` exclusive);
|
|
1243
|
+
* absent means always.
|
|
1244
|
+
*/
|
|
1078
1245
|
readonly validity?: WireValidity;
|
|
1079
1246
|
/** The grant's declared `name`. */
|
|
1080
1247
|
readonly name?: string;
|
|
@@ -1098,10 +1265,52 @@ type LocalSnapshotManifest = {
|
|
|
1098
1265
|
readonly rank?: readonly string[];
|
|
1099
1266
|
/** Every declared grant, without a membership. */
|
|
1100
1267
|
readonly grants: readonly SnapshotGrant[];
|
|
1101
|
-
/**
|
|
1268
|
+
/**
|
|
1269
|
+
* Per custom-role scope (`global` for platform roles): the grants each entry
|
|
1270
|
+
* resolves to.
|
|
1271
|
+
*/
|
|
1102
1272
|
readonly custom: Readonly<Record<string, LocalCustomRoleTable>>;
|
|
1103
|
-
/**
|
|
1273
|
+
/**
|
|
1274
|
+
* The synced tables a device reads the user's memberships, roles and custom
|
|
1275
|
+
* roles from; `permdock powersync generate` adds it.
|
|
1276
|
+
*/
|
|
1104
1277
|
readonly rows?: LocalSnapshotRows;
|
|
1278
|
+
/**
|
|
1279
|
+
* What a device needs to compute `Snapshot.assignable` for the active tenant
|
|
1280
|
+
* the way `assignableIn` does on the server.
|
|
1281
|
+
*/
|
|
1282
|
+
readonly assignable?: LocalAssignable;
|
|
1283
|
+
};
|
|
1284
|
+
/**
|
|
1285
|
+
* The hand-out rules of a policy, as a device evaluates them over its synced
|
|
1286
|
+
* memberships and custom roles.
|
|
1287
|
+
*/
|
|
1288
|
+
type LocalAssignable = {
|
|
1289
|
+
/**
|
|
1290
|
+
* Declared roles a tenant admin may hand out or compose, in rank order, with
|
|
1291
|
+
* the scope each sits on and its allow keys.
|
|
1292
|
+
*/
|
|
1293
|
+
readonly roles: readonly {
|
|
1294
|
+
readonly name: string;
|
|
1295
|
+
readonly on: string;
|
|
1296
|
+
readonly allows: readonly string[];
|
|
1297
|
+
}[];
|
|
1298
|
+
/** Declared role names and permission keys with `meta.manageRoles: true`. */
|
|
1299
|
+
readonly manage: {
|
|
1300
|
+
readonly roles: readonly string[];
|
|
1301
|
+
readonly permissions: readonly string[];
|
|
1302
|
+
};
|
|
1303
|
+
/**
|
|
1304
|
+
* Declared role name to the roles it assigns, when any role declares
|
|
1305
|
+
* `assigns`.
|
|
1306
|
+
*/
|
|
1307
|
+
readonly assigns?: Readonly<Record<string, readonly string[]>>;
|
|
1308
|
+
/** The first scope's custom-role ceiling, in declaration order. */
|
|
1309
|
+
readonly permissions: readonly Permission[];
|
|
1310
|
+
/** Permission key to its level names, in declaration order. */
|
|
1311
|
+
readonly levels?: Readonly<Record<string, readonly string[]>>;
|
|
1312
|
+
/** Index of an allow in `grants` to the levels a holder of it may hand out. */
|
|
1313
|
+
readonly grants?: Readonly<Record<string, readonly string[]>>;
|
|
1105
1314
|
};
|
|
1106
1315
|
/** A column of a synced table, or a value every row has. */
|
|
1107
1316
|
type LocalRowValue = {
|
|
@@ -1110,9 +1319,9 @@ type LocalRowValue = {
|
|
|
1110
1319
|
readonly value: string;
|
|
1111
1320
|
};
|
|
1112
1321
|
/**
|
|
1113
|
-
* A column that holds a role key or user id: the value itself, the `column`
|
|
1114
|
-
*
|
|
1115
|
-
*
|
|
1322
|
+
* A column that holds a role key or user id: the value itself, the `column` of
|
|
1323
|
+
* the synced `through` table whose `id` it references, or a value each maps to
|
|
1324
|
+
* a role key (`null` for no role).
|
|
1116
1325
|
*/
|
|
1117
1326
|
type LocalRowColumn = {
|
|
1118
1327
|
readonly column: string;
|
|
@@ -1133,7 +1342,10 @@ type LocalMembershipRows = {
|
|
|
1133
1342
|
readonly user: LocalRowColumn;
|
|
1134
1343
|
readonly scope: LocalRowValue;
|
|
1135
1344
|
readonly id: string;
|
|
1136
|
-
/**
|
|
1345
|
+
/**
|
|
1346
|
+
* The role columns (the row holds every non-null key), or the fixed roles
|
|
1347
|
+
* every row holds.
|
|
1348
|
+
*/
|
|
1137
1349
|
readonly roles: readonly LocalRowColumn[] | {
|
|
1138
1350
|
readonly value: readonly string[];
|
|
1139
1351
|
};
|
|
@@ -1151,28 +1363,46 @@ type LocalSnapshotRows = {
|
|
|
1151
1363
|
/** The role columns; the row holds every non-null key. */
|
|
1152
1364
|
readonly roles: readonly LocalRowColumn[];
|
|
1153
1365
|
};
|
|
1154
|
-
/**
|
|
1366
|
+
/**
|
|
1367
|
+
* The custom-role tables (`tenant_id`, `scope`, `scope_id`, `role`, and
|
|
1368
|
+
* `permission`, `effect`, `level` or `include_role`).
|
|
1369
|
+
*/
|
|
1155
1370
|
readonly customRoles?: {
|
|
1156
1371
|
readonly permissions: string;
|
|
1157
1372
|
readonly includes: string;
|
|
1158
1373
|
};
|
|
1159
1374
|
};
|
|
1160
|
-
/**
|
|
1375
|
+
/**
|
|
1376
|
+
* Grants a custom role entry resolves to, held by a placeholder role the client
|
|
1377
|
+
* renames.
|
|
1378
|
+
*/
|
|
1161
1379
|
type LocalCustomRoleTable = {
|
|
1162
|
-
/**
|
|
1380
|
+
/**
|
|
1381
|
+
* `{ permission }` per permission key, and `{ permission, level }` per
|
|
1382
|
+
* declared level.
|
|
1383
|
+
*/
|
|
1163
1384
|
readonly permissions: Readonly<Record<string, {
|
|
1164
1385
|
readonly all: readonly SnapshotGrant[];
|
|
1165
1386
|
readonly levels?: Readonly<Record<string, readonly SnapshotGrant[]>>;
|
|
1387
|
+
/** The levels a holder of `all` may hand out. */
|
|
1388
|
+
readonly reach?: readonly string[];
|
|
1389
|
+
/** Level to the levels a holder of `levels[level]` may hand out. */
|
|
1390
|
+
readonly levelReach?: Readonly<Record<string, readonly string[]>>;
|
|
1166
1391
|
}>>;
|
|
1167
1392
|
/** `includes: [role]` per declared role. */
|
|
1168
1393
|
readonly includes: Readonly<Record<string, readonly SnapshotGrant[]>>;
|
|
1394
|
+
/**
|
|
1395
|
+
* Declared role to permission key to the levels a holder of its included
|
|
1396
|
+
* grants may hand out.
|
|
1397
|
+
*/
|
|
1398
|
+
readonly includeReach?: Readonly<Record<string, Readonly<Record<string, readonly string[]>>>>;
|
|
1169
1399
|
};
|
|
1170
1400
|
//#endregion
|
|
1171
1401
|
//#region src/core/time.d.ts
|
|
1172
1402
|
/**
|
|
1173
|
-
* The one time rule: NumericDate (whole seconds) for JWT registered claims
|
|
1174
|
-
*
|
|
1175
|
-
*
|
|
1403
|
+
* The one time rule: NumericDate (whole seconds) for JWT registered claims and
|
|
1404
|
+
* the claims SQL reads, RFC 3339 for every other JSON field, integer seconds
|
|
1405
|
+
* for durations, and an `Instant` for every runtime `now`.
|
|
1176
1406
|
*/
|
|
1177
1407
|
/**
|
|
1178
1408
|
* The part of a `Temporal.Instant` PermDock reads. Public options take it
|
|
@@ -1185,8 +1415,8 @@ type Instant = {
|
|
|
1185
1415
|
//#endregion
|
|
1186
1416
|
//#region src/core/internals.d.ts
|
|
1187
1417
|
/**
|
|
1188
|
-
* Any instance a feature function accepts: a server `PermDock`, one built
|
|
1189
|
-
*
|
|
1418
|
+
* Any instance a feature function accepts: a server `PermDock`, one built from
|
|
1419
|
+
* a snapshot, or an adapter's wrapper such as `PdpPermDock`.
|
|
1190
1420
|
*/
|
|
1191
1421
|
type InstanceHandle = {
|
|
1192
1422
|
readonly subject: Subject;
|
|
@@ -1194,19 +1424,26 @@ type InstanceHandle = {
|
|
|
1194
1424
|
//#endregion
|
|
1195
1425
|
//#region src/core/credential.d.ts
|
|
1196
1426
|
type CredentialKind = "user" | "service" | "feed";
|
|
1197
|
-
/**
|
|
1427
|
+
/**
|
|
1428
|
+
* A feed id: lowercase, so a mail system that lowercases a local part still
|
|
1429
|
+
* matches. At most 16 characters, so `pdfeed_<id>_<secret>` fits an email local
|
|
1430
|
+
* part.
|
|
1431
|
+
*/
|
|
1198
1432
|
declare function isFeedId(value: string): boolean;
|
|
1199
|
-
/**
|
|
1433
|
+
/**
|
|
1434
|
+
* One permission (a key) a credential may use: on every instance, or only on
|
|
1435
|
+
* `ids`.
|
|
1436
|
+
*/
|
|
1200
1437
|
type CredentialPermission = {
|
|
1201
1438
|
readonly permission: string;
|
|
1202
1439
|
readonly ids?: readonly string[];
|
|
1203
1440
|
};
|
|
1204
1441
|
/**
|
|
1205
|
-
* Credential v1: what a verified API key stands for, never the secret. A
|
|
1206
|
-
*
|
|
1207
|
-
*
|
|
1208
|
-
*
|
|
1209
|
-
*
|
|
1442
|
+
* Credential v1: what a verified API key stands for, never the secret. A `user`
|
|
1443
|
+
* credential acts as its owner (`principal`) narrowed to `permissions`, and to
|
|
1444
|
+
* the memberships inside `tenant` when it names one; a `service` credential is
|
|
1445
|
+
* its own `service` principal holding `roles` in `tenant`, narrowed the same
|
|
1446
|
+
* way.
|
|
1210
1447
|
*/
|
|
1211
1448
|
type Credential = {
|
|
1212
1449
|
readonly v: 1;
|
|
@@ -1215,12 +1452,15 @@ type Credential = {
|
|
|
1215
1452
|
/** The owner of a `user` credential, or the id of the service principal. */
|
|
1216
1453
|
readonly principal: string;
|
|
1217
1454
|
/**
|
|
1218
|
-
* The instance of the first scope the key is held to. Required on a
|
|
1219
|
-
*
|
|
1220
|
-
*
|
|
1455
|
+
* The instance of the first scope the key is held to. Required on a service
|
|
1456
|
+
* credential, where its roles are held; optional on a user credential, where
|
|
1457
|
+
* it keeps only the owner's memberships inside it.
|
|
1221
1458
|
*/
|
|
1222
1459
|
readonly tenant?: string;
|
|
1223
|
-
/**
|
|
1460
|
+
/**
|
|
1461
|
+
* Service: the roles it holds in `tenant`. Feed: the resource roles it holds
|
|
1462
|
+
* on `on`.
|
|
1463
|
+
*/
|
|
1224
1464
|
readonly roles?: readonly string[];
|
|
1225
1465
|
/** Feed only: the resource instance the roles are held on. */
|
|
1226
1466
|
readonly on?: {
|
|
@@ -1290,14 +1530,20 @@ type CredentialDecision = {
|
|
|
1290
1530
|
} | {
|
|
1291
1531
|
readonly outcome: "approval-required";
|
|
1292
1532
|
readonly credential: Credential;
|
|
1293
|
-
/**
|
|
1533
|
+
/**
|
|
1534
|
+
* Bound to the credential's content and its creator; pass it as
|
|
1535
|
+
* `approved` to resume.
|
|
1536
|
+
*/
|
|
1294
1537
|
readonly token: string;
|
|
1295
1538
|
} | {
|
|
1296
1539
|
readonly outcome: "denied";
|
|
1297
1540
|
readonly denials: readonly Denial[];
|
|
1298
1541
|
};
|
|
1299
1542
|
type DecideCredentialOptions = {
|
|
1300
|
-
/**
|
|
1543
|
+
/**
|
|
1544
|
+
* Where the tenant's `credentials` policy comes from. Without it, only the
|
|
1545
|
+
* no-expiry rule applies.
|
|
1546
|
+
*/
|
|
1301
1547
|
readonly settings?: SettingsSource;
|
|
1302
1548
|
/** The `token` of an approval the application consumed for this request. */
|
|
1303
1549
|
readonly approved?: string;
|
|
@@ -1311,49 +1557,48 @@ type DecideCredentialOptions = {
|
|
|
1311
1557
|
*/
|
|
1312
1558
|
declare function credentialPolicyViolation(credential: Credential, policy: CredentialPolicy | readonly CredentialPolicy[]): CredentialPolicyViolation | undefined;
|
|
1313
1559
|
/**
|
|
1314
|
-
* Validates an untrusted credential record and returns a frozen copy with
|
|
1315
|
-
*
|
|
1316
|
-
*
|
|
1317
|
-
*
|
|
1560
|
+
* Validates an untrusted credential record and returns a frozen copy with only
|
|
1561
|
+
* the v1 fields, or `undefined`. Unknown fields are dropped; a wrong type in a
|
|
1562
|
+
* known field, a service credential without `tenant` and `roles`, or a user
|
|
1563
|
+
* credential with `roles`, rejects the whole record.
|
|
1318
1564
|
*/
|
|
1319
1565
|
declare function parseCredential(input: unknown): Credential | undefined;
|
|
1320
1566
|
/**
|
|
1321
1567
|
* The delegation a credential narrows its principal to: OAuth scopes for
|
|
1322
|
-
* permissions on every instance, one RFC 9396 entry per id otherwise. A key
|
|
1323
|
-
*
|
|
1324
|
-
*
|
|
1568
|
+
* permissions on every instance, one RFC 9396 entry per id otherwise. A key the
|
|
1569
|
+
* definitions no longer declare is dropped, so a credential whose every key is
|
|
1570
|
+
* gone delegates nothing and every check is denied.
|
|
1325
1571
|
*/
|
|
1326
1572
|
declare function credentialDelegation(credential: Credential, permissions: PermissionTree): Delegation;
|
|
1327
1573
|
/**
|
|
1328
1574
|
* Decides whether the subject of `permdock` may create the credential in
|
|
1329
|
-
* `request`. The creator must be a signed-in user or service that is not
|
|
1330
|
-
*
|
|
1331
|
-
* delegation covers. A key's tenant must be one the creator is a member of;
|
|
1332
|
-
*
|
|
1575
|
+
* `request`. The creator must be a signed-in user or service that is not itself
|
|
1576
|
+
* a link or a credential; a delegated creator hands out only what its
|
|
1577
|
+
* delegation covers. A key's tenant must be one the creator is a member of; a
|
|
1578
|
+
* service key's roles among the creator's `assignableRoles` there and its
|
|
1333
1579
|
* permissions within `assignablePermissions` there (`exceeds-creator`). The
|
|
1334
|
-
* `credentials` policy of the key's tenant (its own, or for a user key
|
|
1335
|
-
*
|
|
1580
|
+
* `credentials` policy of the key's tenant (its own, or for a user key without
|
|
1581
|
+
* one the creator's active tenant) then applies (`credential-policy`; a
|
|
1336
1582
|
* settings source that throws denies with `rule: 'unavailable'`), and
|
|
1337
|
-
* `approval` makes the result `approval-required` until `approved` carries
|
|
1338
|
-
*
|
|
1339
|
-
*
|
|
1583
|
+
* `approval` makes the result `approval-required` until `approved` carries its
|
|
1584
|
+
* token. PermDock never stores the credential; the application does, after a
|
|
1585
|
+
* `granted` result.
|
|
1340
1586
|
*/
|
|
1341
1587
|
/**
|
|
1342
1588
|
* Decides whether the subject of `permdock` may create the credential in
|
|
1343
1589
|
* `request`: the creator's own reach, the `credentials` policy of the key's
|
|
1344
|
-
* tenant (the call's `settings`, else the instance's), and `approval`.
|
|
1345
|
-
*
|
|
1346
|
-
*
|
|
1347
|
-
* `unsupported`.
|
|
1590
|
+
* tenant (the call's `settings`, else the instance's), and `approval`. PermDock
|
|
1591
|
+
* never stores the credential; the application does, after a `granted` result.
|
|
1592
|
+
* An instance built from a snapshot denies with `unsupported`.
|
|
1348
1593
|
*/
|
|
1349
1594
|
declare function decideCredential(permdock: InstanceHandle, request: CredentialRequest, options?: DecideCredentialOptions): Promise<CredentialDecision>;
|
|
1350
1595
|
//#endregion
|
|
1351
1596
|
//#region src/core/support-session.d.ts
|
|
1352
1597
|
/**
|
|
1353
|
-
* SupportSession v1: a support staff member (`actor`, kind `support`)
|
|
1354
|
-
*
|
|
1355
|
-
*
|
|
1356
|
-
*
|
|
1598
|
+
* SupportSession v1: a support staff member (`actor`, kind `support`) viewing
|
|
1599
|
+
* the app as `principal` in `tenant`, for a stated `reason`. Each request in
|
|
1600
|
+
* the session acts as `principal` with their live rights, narrowed to
|
|
1601
|
+
* `permissions`.
|
|
1357
1602
|
*/
|
|
1358
1603
|
type SupportSession = {
|
|
1359
1604
|
readonly v: 1;
|
|
@@ -1417,92 +1662,129 @@ type DecideSupportSessionOptions = {
|
|
|
1417
1662
|
readonly approval?: boolean;
|
|
1418
1663
|
/** The `token` of an approval the application consumed for this request. */
|
|
1419
1664
|
readonly approved?: string;
|
|
1420
|
-
/**
|
|
1665
|
+
/**
|
|
1666
|
+
* The principal id that approved; required with `approved` and never the
|
|
1667
|
+
* actor.
|
|
1668
|
+
*/
|
|
1421
1669
|
readonly approvedBy?: string;
|
|
1422
1670
|
/** The start time; defaults to the clock. */
|
|
1423
1671
|
readonly now?: Instant;
|
|
1424
1672
|
};
|
|
1425
1673
|
/**
|
|
1426
|
-
* Validates an untrusted support-session record and returns a frozen copy
|
|
1427
|
-
*
|
|
1674
|
+
* Validates an untrusted support-session record and returns a frozen copy with
|
|
1675
|
+
* only the v1 fields, or `undefined`.
|
|
1428
1676
|
*/
|
|
1429
1677
|
declare function parseSupportSession(input: unknown): SupportSession | undefined;
|
|
1430
1678
|
/**
|
|
1431
|
-
* Decides whether the subject of `permdock` may start the support session
|
|
1432
|
-
*
|
|
1679
|
+
* Decides whether the subject of `permdock` may start the support session in
|
|
1680
|
+
* `request`. The actor must be a signed-in person acting for themselves
|
|
1433
1681
|
* (`exceeds-creator` otherwise), give a `reason` (`reason-required`), be a
|
|
1434
|
-
* member of the tenant (`tenant-mismatch`) and be able to use every
|
|
1435
|
-
*
|
|
1436
|
-
*
|
|
1437
|
-
*
|
|
1438
|
-
*
|
|
1682
|
+
* member of the tenant (`tenant-mismatch`) and be able to use every permission
|
|
1683
|
+
* (`exceeds-creator`). Without `permissions` the session gets the actor's
|
|
1684
|
+
* read-only permissions. The tenant's `supportSessions` policy then applies,
|
|
1685
|
+
* and the result is `approval-required` until `approved` carries its token and
|
|
1686
|
+
* `approvedBy` names someone other than the actor.
|
|
1439
1687
|
*/
|
|
1440
1688
|
/**
|
|
1441
|
-
* Decides whether the subject of `permdock` may start the support session
|
|
1442
|
-
*
|
|
1443
|
-
*
|
|
1444
|
-
*
|
|
1445
|
-
*
|
|
1689
|
+
* Decides whether the subject of `permdock` may start the support session in
|
|
1690
|
+
* `request` and returns the record to sign: a stated reason, membership of the
|
|
1691
|
+
* tenant, the actor's own reach, the tenant's `supportSessions` policy and
|
|
1692
|
+
* approval by someone else. An instance built from a snapshot denies with
|
|
1693
|
+
* `unsupported`.
|
|
1446
1694
|
*/
|
|
1447
1695
|
declare function decideSupportSession(permdock: InstanceHandle, request: SupportSessionRequest, options?: DecideSupportSessionOptions): Promise<SupportSessionDecision>;
|
|
1448
1696
|
//#endregion
|
|
1449
1697
|
//#region src/core/interfaces.d.ts
|
|
1450
1698
|
type DecisionProvider = {
|
|
1451
1699
|
readonly name: string;
|
|
1452
|
-
handles(permission: Permission)
|
|
1453
|
-
decide(request: {
|
|
1700
|
+
handles: (permission: Permission) => boolean;
|
|
1701
|
+
decide: (request: {
|
|
1454
1702
|
readonly permission: Permission;
|
|
1455
1703
|
readonly data?: unknown;
|
|
1456
1704
|
readonly subject: Subject;
|
|
1457
1705
|
readonly local: Decision;
|
|
1458
|
-
})
|
|
1706
|
+
}) => Promise<Decision>;
|
|
1459
1707
|
/**
|
|
1460
1708
|
* Ids of the resources of `permission.resource` the subject may act on.
|
|
1461
1709
|
* `null` means the provider could not answer and every row is denied;
|
|
1462
1710
|
* `undefined` means it cannot list, and each row is decided on its own.
|
|
1463
1711
|
*/
|
|
1464
|
-
permitted
|
|
1712
|
+
permitted?: (request: {
|
|
1465
1713
|
readonly permission: Permission;
|
|
1466
1714
|
readonly subject: Subject;
|
|
1467
|
-
})
|
|
1715
|
+
}) => Promise<readonly string[] | null | undefined>;
|
|
1716
|
+
};
|
|
1717
|
+
/**
|
|
1718
|
+
* Shares one read per key within one `getPermDock` call: the first call runs
|
|
1719
|
+
* `read`, every later call with the same key gets its answer. A source created
|
|
1720
|
+
* once at module scope uses it so the reads of one instance share a single
|
|
1721
|
+
* query and no answer outlives the instance.
|
|
1722
|
+
*/
|
|
1723
|
+
type SourceMemo = <T>(key: string, read: () => T) => T;
|
|
1724
|
+
/** What `getPermDock` passes to every source call besides its query. */
|
|
1725
|
+
type SourceContext = {
|
|
1726
|
+
/** Absent when the source is called outside `getPermDock`. */
|
|
1727
|
+
readonly memo?: SourceMemo;
|
|
1728
|
+
};
|
|
1729
|
+
/**
|
|
1730
|
+
* Whether an instance answers reads or writes: `read` may judge a token fresh
|
|
1731
|
+
* from a shared `VersionCache` within its `maxStaleMs`; `write` reads the
|
|
1732
|
+
* version live.
|
|
1733
|
+
*/
|
|
1734
|
+
type Intent = "read" | "write";
|
|
1735
|
+
/** The custom-role sources' second argument. */
|
|
1736
|
+
type CustomRoleContext = SourceContext & {
|
|
1737
|
+
readonly held: readonly string[];
|
|
1468
1738
|
};
|
|
1469
1739
|
type CustomRoleSource = {
|
|
1470
1740
|
/** Names the implementation in errors and events. */
|
|
1471
1741
|
readonly name?: string;
|
|
1472
1742
|
/**
|
|
1473
|
-
* The custom roles of one tenant. `getPermDock` passes `held`, the role
|
|
1474
|
-
*
|
|
1475
|
-
*
|
|
1743
|
+
* The custom roles of one tenant. `getPermDock` passes `held`, the role names
|
|
1744
|
+
* the subject's live memberships hold there, declared or not, so a source can
|
|
1745
|
+
* skip its read when none of them is a custom role.
|
|
1476
1746
|
*/
|
|
1477
|
-
rolesFor(tenant: string, context?:
|
|
1478
|
-
|
|
1479
|
-
}): CustomRole[] | Promise<CustomRole[]>;
|
|
1480
|
-
assignable?(tenant: string): string[] | Promise<string[]>;
|
|
1747
|
+
rolesFor: (tenant: string, context?: CustomRoleContext) => CustomRole[] | Promise<CustomRole[]>;
|
|
1748
|
+
assignable?: (tenant: string) => string[] | Promise<string[]>;
|
|
1481
1749
|
/**
|
|
1482
|
-
* Platform custom roles (`scope: 'global'`), read once per signed-in
|
|
1483
|
-
*
|
|
1484
|
-
*
|
|
1750
|
+
* Platform custom roles (`scope: 'global'`), read once per signed-in subject,
|
|
1751
|
+
* with `held`, the global role names the subject holds. A role here with a
|
|
1752
|
+
* tenant is ignored.
|
|
1485
1753
|
*/
|
|
1486
|
-
globalRoles
|
|
1487
|
-
readonly held: readonly string[];
|
|
1488
|
-
}): CustomRole[] | Promise<CustomRole[]>;
|
|
1754
|
+
globalRoles?: (context?: CustomRoleContext) => CustomRole[] | Promise<CustomRole[]>;
|
|
1489
1755
|
/**
|
|
1490
1756
|
* Shared custom roles (`shared: true`), defined once for every tenant and
|
|
1491
|
-
* read once per subject with a tenant membership, with `held`, the role
|
|
1492
|
-
*
|
|
1493
|
-
*
|
|
1757
|
+
* read once per subject with a tenant membership, with `held`, the role names
|
|
1758
|
+
* its live memberships hold in any tenant. A role here without `shared: true`
|
|
1759
|
+
* is ignored.
|
|
1494
1760
|
*/
|
|
1495
|
-
sharedRoles
|
|
1496
|
-
readonly held: readonly string[];
|
|
1497
|
-
}): CustomRole[] | Promise<CustomRole[]>;
|
|
1761
|
+
sharedRoles?: (context?: CustomRoleContext) => CustomRole[] | Promise<CustomRole[]>;
|
|
1498
1762
|
};
|
|
1499
1763
|
/**
|
|
1500
|
-
* A `CustomRoleSource` built for the subject the instance serves, for an
|
|
1501
|
-
* option shared by every request: it gets the resolved subject
|
|
1502
|
-
* actor and delegation) and returns that subject's source, or
|
|
1503
|
-
* for none. A throw reads no custom roles and reports
|
|
1764
|
+
* A `CustomRoleSource` built for the subject the instance serves, for an
|
|
1765
|
+
* adapter option shared by every request: it gets the resolved subject
|
|
1766
|
+
* (principal, actor and delegation) and returns that subject's source, or
|
|
1767
|
+
* `undefined` for none. A throw reads no custom roles and reports
|
|
1768
|
+
* `source-threw`.
|
|
1504
1769
|
*/
|
|
1505
1770
|
type CustomRoleSourceFactory = (subject: Subject) => CustomRoleSource | undefined;
|
|
1771
|
+
/**
|
|
1772
|
+
* The principal `MembershipSource.version` is asked about: what its token
|
|
1773
|
+
* claims.
|
|
1774
|
+
*/
|
|
1775
|
+
type VersionQuery = {
|
|
1776
|
+
readonly id: string;
|
|
1777
|
+
readonly roles?: readonly string[];
|
|
1778
|
+
readonly memberships?: readonly Membership[];
|
|
1779
|
+
readonly authzVersion?: number;
|
|
1780
|
+
/** When the token was issued, in seconds since the epoch (`iat`). */
|
|
1781
|
+
readonly issuedAt?: number;
|
|
1782
|
+
};
|
|
1783
|
+
/** `MembershipSource.version`'s second argument. */
|
|
1784
|
+
type VersionContext = SourceContext & {
|
|
1785
|
+
/** Absent outside `getPermDock`, where the read is live. */
|
|
1786
|
+
readonly intent?: Intent;
|
|
1787
|
+
};
|
|
1506
1788
|
/** One member of a scope instance, as `MembershipSource.list` returns it. */
|
|
1507
1789
|
type MemberEntry = {
|
|
1508
1790
|
readonly principal: {
|
|
@@ -1513,39 +1795,39 @@ type MemberEntry = {
|
|
|
1513
1795
|
type MembershipSource = {
|
|
1514
1796
|
/** Names the implementation in errors and events. */
|
|
1515
1797
|
readonly name?: string;
|
|
1516
|
-
membershipsFor(principal: {
|
|
1798
|
+
membershipsFor: (principal: {
|
|
1517
1799
|
readonly id: string;
|
|
1518
1800
|
readonly kind?: string;
|
|
1519
|
-
}, options: {
|
|
1801
|
+
}, options: SourceContext & {
|
|
1520
1802
|
readonly tenant?: string;
|
|
1521
|
-
})
|
|
1522
|
-
/**
|
|
1523
|
-
|
|
1803
|
+
}) => Membership[] | Promise<Membership[]>;
|
|
1804
|
+
/**
|
|
1805
|
+
* Every membership held in one scope instance, for member lists and access
|
|
1806
|
+
* reviews.
|
|
1807
|
+
*/
|
|
1808
|
+
list?: (query: {
|
|
1524
1809
|
readonly scope: string;
|
|
1525
1810
|
readonly id: string;
|
|
1526
|
-
})
|
|
1811
|
+
}) => MemberEntry[] | Promise<MemberEntry[]>;
|
|
1527
1812
|
/**
|
|
1528
1813
|
* The principal's current authorization version, bumped on every membership
|
|
1529
|
-
* change. A token whose `authzVersion` is behind it is stale for the
|
|
1530
|
-
*
|
|
1531
|
-
*
|
|
1532
|
-
*
|
|
1814
|
+
* change. A token whose `authzVersion` is behind it is stale for the policy's
|
|
1815
|
+
* `fresh` permissions. `roles` and `memberships` are what the token claims,
|
|
1816
|
+
* so a source can read more than the version in the same call when the claims
|
|
1817
|
+
* show it will be needed. `authzVersion` and `issuedAt` (seconds) are the
|
|
1818
|
+
* token's, for a `VersionCache`.
|
|
1533
1819
|
*/
|
|
1534
|
-
version
|
|
1535
|
-
readonly id: string;
|
|
1536
|
-
readonly roles?: readonly string[];
|
|
1537
|
-
readonly memberships?: readonly Membership[];
|
|
1538
|
-
}): number | undefined | Promise<number | undefined>;
|
|
1820
|
+
version?: (principal: VersionQuery, context?: VersionContext) => number | undefined | Promise<number | undefined>;
|
|
1539
1821
|
/**
|
|
1540
|
-
* The global roles the principal holds now. With `onStale: 'reread'`, a
|
|
1541
|
-
*
|
|
1542
|
-
*
|
|
1543
|
-
*
|
|
1822
|
+
* The global roles the principal holds now. With `onStale: 'reread'`, a stale
|
|
1823
|
+
* token's `principal.roles` is replaced by this answer, so a revoked platform
|
|
1824
|
+
* role is lost with the memberships. A throw or rejection leaves no global
|
|
1825
|
+
* roles. Without it, a reread keeps the token's roles.
|
|
1544
1826
|
*/
|
|
1545
|
-
globalRolesFor
|
|
1827
|
+
globalRolesFor?: (principal: {
|
|
1546
1828
|
readonly id: string;
|
|
1547
1829
|
readonly kind?: string;
|
|
1548
|
-
})
|
|
1830
|
+
}, context?: SourceContext) => readonly string[] | Promise<readonly string[]>;
|
|
1549
1831
|
/**
|
|
1550
1832
|
* Keep the memberships the verified token carries and read this source only
|
|
1551
1833
|
* when the token says they were truncated (`claimsFirst`).
|
|
@@ -1555,9 +1837,9 @@ type MembershipSource = {
|
|
|
1555
1837
|
* What a token behind `version` gets. Only permissions the policy marks
|
|
1556
1838
|
* `fresh` look at staleness: `'deny'` (the default) denies those with
|
|
1557
1839
|
* `stale-credentials` and leaves every other permission on the token's
|
|
1558
|
-
* claims; `'reread'` replaces the token's memberships (and global roles,
|
|
1559
|
-
*
|
|
1560
|
-
*
|
|
1840
|
+
* claims; `'reread'` replaces the token's memberships (and global roles, when
|
|
1841
|
+
* the source has `globalRolesFor`) with a live read for the whole subject, so
|
|
1842
|
+
* no decision keeps a revoked grant.
|
|
1561
1843
|
*/
|
|
1562
1844
|
readonly onStale?: "deny" | "reread";
|
|
1563
1845
|
};
|
|
@@ -1565,7 +1847,10 @@ type MembershipSource = {
|
|
|
1565
1847
|
type RelationChain = {
|
|
1566
1848
|
/** Whether the object itself is restricted: nothing above it reaches it. */
|
|
1567
1849
|
readonly restricted?: boolean;
|
|
1568
|
-
/**
|
|
1850
|
+
/**
|
|
1851
|
+
* Ancestors nearest first, at most `depth`; a restricted one ends the walk
|
|
1852
|
+
* after itself.
|
|
1853
|
+
*/
|
|
1569
1854
|
readonly ancestors: readonly {
|
|
1570
1855
|
readonly id: string;
|
|
1571
1856
|
readonly restricted?: boolean;
|
|
@@ -1579,7 +1864,10 @@ type HolderPeriod = {
|
|
|
1579
1864
|
/** Seconds since the epoch; from it on the relation no longer holds. */
|
|
1580
1865
|
readonly expiresAt?: number;
|
|
1581
1866
|
};
|
|
1582
|
-
/**
|
|
1867
|
+
/**
|
|
1868
|
+
* A group holding a relation on an object: whoever holds `relation` on the
|
|
1869
|
+
* group's instance holds it too.
|
|
1870
|
+
*/
|
|
1583
1871
|
type RelationGroup = {
|
|
1584
1872
|
readonly resource: string;
|
|
1585
1873
|
readonly id: string;
|
|
@@ -1597,10 +1885,9 @@ type RelationHolder = HolderPeriod & ({
|
|
|
1597
1885
|
readonly group: RelationGroup;
|
|
1598
1886
|
});
|
|
1599
1887
|
/**
|
|
1600
|
-
* The object graph: parent chains, links and who holds a relation on an
|
|
1601
|
-
*
|
|
1602
|
-
*
|
|
1603
|
-
* `relation-unavailable`.
|
|
1888
|
+
* The object graph: parent chains, links and who holds a relation on an object.
|
|
1889
|
+
* A source answers facts and never decides; a thrown or rejected call, or a
|
|
1890
|
+
* Promise the instance has not loaded, denies with `relation-unavailable`.
|
|
1604
1891
|
*/
|
|
1605
1892
|
type RelationSource = {
|
|
1606
1893
|
/** Names the implementation in errors and events. */
|
|
@@ -1609,31 +1896,34 @@ type RelationSource = {
|
|
|
1609
1896
|
* With `through: 'parent'`, the parent chain; with a link name, the one
|
|
1610
1897
|
* instance that link points to (`depth` is then 1).
|
|
1611
1898
|
*/
|
|
1612
|
-
ancestors(query: {
|
|
1899
|
+
ancestors: (query: {
|
|
1613
1900
|
readonly resource: string;
|
|
1614
1901
|
readonly id: string;
|
|
1615
1902
|
readonly through: string;
|
|
1616
1903
|
readonly depth: number;
|
|
1617
|
-
})
|
|
1618
|
-
related(query: {
|
|
1904
|
+
}) => RelationChain | Promise<RelationChain>;
|
|
1905
|
+
related: (query: {
|
|
1619
1906
|
readonly resource: string;
|
|
1620
1907
|
readonly id: string;
|
|
1621
1908
|
readonly relation: string;
|
|
1622
|
-
})
|
|
1623
|
-
row
|
|
1909
|
+
}) => RelationHolder[] | Promise<RelationHolder[]>;
|
|
1910
|
+
row?: (query: {
|
|
1624
1911
|
readonly resource: string;
|
|
1625
1912
|
readonly id: string;
|
|
1626
|
-
})
|
|
1913
|
+
}) => Readonly<Record<string, unknown>> | null | undefined | Promise<Readonly<Record<string, unknown>> | null | undefined>;
|
|
1627
1914
|
};
|
|
1628
|
-
/**
|
|
1915
|
+
/**
|
|
1916
|
+
* Plan and seat names a principal holds in a tenant, from billing (Stripe
|
|
1917
|
+
* Entitlements, a table).
|
|
1918
|
+
*/
|
|
1629
1919
|
type EntitlementSource = {
|
|
1630
1920
|
/** Names the implementation in errors and events. */
|
|
1631
1921
|
readonly name?: string;
|
|
1632
|
-
entitlementsFor(principal: {
|
|
1922
|
+
entitlementsFor: (principal: {
|
|
1633
1923
|
readonly id: string;
|
|
1634
1924
|
}, options: {
|
|
1635
1925
|
readonly tenant?: string;
|
|
1636
|
-
})
|
|
1926
|
+
}) => string[] | Promise<string[]>;
|
|
1637
1927
|
};
|
|
1638
1928
|
type JwtClaims = {
|
|
1639
1929
|
readonly iss?: string;
|
|
@@ -1662,29 +1952,32 @@ type VerificationFailure = {
|
|
|
1662
1952
|
type TokenVerifier<TClaims extends JwtClaims = JwtClaims> = {
|
|
1663
1953
|
/** Names the implementation in errors and events. */
|
|
1664
1954
|
readonly name?: string;
|
|
1665
|
-
verify(token: string, expectations: {
|
|
1955
|
+
verify: (token: string, expectations: {
|
|
1666
1956
|
readonly typ?: string | readonly string[];
|
|
1667
1957
|
readonly audience?: string | readonly string[];
|
|
1668
1958
|
readonly issuer?: string;
|
|
1669
1959
|
readonly clockTolerance?: number;
|
|
1670
|
-
})
|
|
1960
|
+
}) => Promise<VerifiedToken<TClaims> | VerificationFailure>;
|
|
1671
1961
|
};
|
|
1672
1962
|
type TokenSigner = {
|
|
1673
1963
|
/** Names the implementation in errors and events. */
|
|
1674
1964
|
readonly name?: string;
|
|
1675
|
-
sign(payload: Readonly<Record<string, unknown>>, options: {
|
|
1965
|
+
sign: (payload: Readonly<Record<string, unknown>>, options: {
|
|
1676
1966
|
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";
|
|
1677
1967
|
/** `aud`; a signer with no default audience refuses to sign without one. */
|
|
1678
1968
|
readonly audience?: string | readonly string[];
|
|
1679
1969
|
/** `exp`, a NumericDate; one hour after `iat` when absent. */
|
|
1680
1970
|
readonly expiresAt?: number;
|
|
1681
|
-
/**
|
|
1971
|
+
/**
|
|
1972
|
+
* `iat`, a NumericDate: the artefact's issue time. The signer's clock
|
|
1973
|
+
* when absent.
|
|
1974
|
+
*/
|
|
1682
1975
|
readonly issuedAt?: number;
|
|
1683
1976
|
/** `jti`: the artefact's id. A fresh UUID when absent. */
|
|
1684
1977
|
readonly jti?: string;
|
|
1685
|
-
})
|
|
1978
|
+
}) => Promise<string>;
|
|
1686
1979
|
readonly kid?: string;
|
|
1687
|
-
jwks
|
|
1980
|
+
jwks?: () => Promise<{
|
|
1688
1981
|
readonly keys: readonly JsonWebKeyLike[];
|
|
1689
1982
|
}>;
|
|
1690
1983
|
};
|
|
@@ -1694,8 +1987,8 @@ type SubjectResolver<TInput, TPrincipal extends Principal = Principal> = (input:
|
|
|
1694
1987
|
type SnapshotSource = {
|
|
1695
1988
|
/** Names the implementation in errors and events. */
|
|
1696
1989
|
readonly name?: string;
|
|
1697
|
-
get()
|
|
1698
|
-
subscribe
|
|
1990
|
+
get: () => Promise<Snapshot | string> | Snapshot | string;
|
|
1991
|
+
subscribe?: (listener: () => void) => () => void;
|
|
1699
1992
|
};
|
|
1700
1993
|
type WhereCompiler<TTarget, TOptions = unknown> = (condition: Condition, target: TTarget, options?: TOptions) => unknown;
|
|
1701
1994
|
type LimitConsumeInput = {
|
|
@@ -1715,31 +2008,31 @@ type LimitRemaining = {
|
|
|
1715
2008
|
type LimitStore = {
|
|
1716
2009
|
/** Names the implementation in errors and events. */
|
|
1717
2010
|
readonly name?: string;
|
|
1718
|
-
consume(input: LimitConsumeInput)
|
|
1719
|
-
remaining(input: LimitConsumeInput)
|
|
2011
|
+
consume: (input: LimitConsumeInput) => Promise<LimitRemaining> | LimitRemaining;
|
|
2012
|
+
remaining: (input: LimitConsumeInput) => LimitRemaining | undefined;
|
|
1720
2013
|
};
|
|
1721
2014
|
type DecisionSink = {
|
|
1722
2015
|
/** Names the implementation in errors and events. */
|
|
1723
2016
|
readonly name?: string;
|
|
1724
|
-
write(events: readonly SinkEvent[])
|
|
1725
|
-
flush
|
|
2017
|
+
write: (events: readonly SinkEvent[]) => Promise<void> | void;
|
|
2018
|
+
flush?: () => Promise<void>;
|
|
1726
2019
|
};
|
|
1727
2020
|
/**
|
|
1728
2021
|
* Looks up the credential an API key stands for. `null` for a key that is
|
|
1729
|
-
* malformed, unknown, revoked or whose secret does not match; never throws
|
|
1730
|
-
*
|
|
1731
|
-
*
|
|
2022
|
+
* malformed, unknown, revoked or whose secret does not match; never throws for
|
|
2023
|
+
* bad input. Verification is the application's (or `apiKeyVerifier`'s), never
|
|
2024
|
+
* core's.
|
|
1732
2025
|
*/
|
|
1733
2026
|
type CredentialVerifier = {
|
|
1734
2027
|
/** Names the implementation in errors and events. */
|
|
1735
2028
|
readonly name?: string;
|
|
1736
|
-
verify(secret: string)
|
|
2029
|
+
verify: (secret: string) => Credential | null | Promise<Credential | null>;
|
|
1737
2030
|
/**
|
|
1738
|
-
* Records a successful use at `at`, for a `lastUsedAt` column. Called
|
|
1739
|
-
*
|
|
1740
|
-
*
|
|
2031
|
+
* Records a successful use at `at`, for a `lastUsedAt` column. Called after a
|
|
2032
|
+
* key resolved and not awaited; a throw or a rejection is ignored, so it
|
|
2033
|
+
* never changes the subject.
|
|
1741
2034
|
*/
|
|
1742
|
-
touch
|
|
2035
|
+
touch?: (id: string, at: Instant) => void | Promise<void>;
|
|
1743
2036
|
};
|
|
1744
2037
|
/** What one tenant configures for itself. Every field only tightens. */
|
|
1745
2038
|
type TenantSettings = {
|
|
@@ -1749,13 +2042,13 @@ type TenantSettings = {
|
|
|
1749
2042
|
readonly supportSessions?: SupportSessionPolicy;
|
|
1750
2043
|
};
|
|
1751
2044
|
/**
|
|
1752
|
-
* Per-tenant settings, a subject input like `CustomRoleSource`: they tighten
|
|
1753
|
-
* a key may be and never grant. A throw denies.
|
|
2045
|
+
* Per-tenant settings, a subject input like `CustomRoleSource`: they tighten
|
|
2046
|
+
* what a key may be and never grant. A throw denies.
|
|
1754
2047
|
*/
|
|
1755
2048
|
type SettingsSource = {
|
|
1756
2049
|
/** Names the implementation in errors and events. */
|
|
1757
2050
|
readonly name?: string;
|
|
1758
|
-
settingsFor(tenant: string)
|
|
2051
|
+
settingsFor: (tenant: string) => TenantSettings | undefined | Promise<TenantSettings | undefined>;
|
|
1759
2052
|
};
|
|
1760
2053
|
//#endregion
|
|
1761
2054
|
//#region src/core/policy-fingerprint.d.ts
|
|
@@ -1785,13 +2078,16 @@ type ApprovalStage = {
|
|
|
1785
2078
|
readonly by: Approver | readonly Approver[];
|
|
1786
2079
|
/** Absent means 1. */
|
|
1787
2080
|
readonly quorum?: number;
|
|
1788
|
-
/**
|
|
2081
|
+
/**
|
|
2082
|
+
* After `after`, `to` may approve this stage as well as `by`; other stages
|
|
2083
|
+
* are unaffected.
|
|
2084
|
+
*/
|
|
1789
2085
|
readonly escalation?: ApprovalEscalation;
|
|
1790
2086
|
};
|
|
1791
2087
|
/**
|
|
1792
|
-
* `'any'`: `quorum` approvers from `by`. `'all'`: every stage completes, in
|
|
1793
|
-
*
|
|
1794
|
-
*
|
|
2088
|
+
* `'any'`: `quorum` approvers from `by`. `'all'`: every stage completes, in any
|
|
2089
|
+
* order. `'sequential'`: stages complete in order; an approver signs only the
|
|
2090
|
+
* first incomplete stage. An approver signs once per request.
|
|
1795
2091
|
*/
|
|
1796
2092
|
type ApprovalMode = "any" | "all" | "sequential";
|
|
1797
2093
|
type ApprovalRequirement = {
|
|
@@ -1805,15 +2101,24 @@ type ApprovalRequirement = {
|
|
|
1805
2101
|
readonly distinct?: boolean;
|
|
1806
2102
|
/** `'resource-change'` binds the approval to the row's `version` field. */
|
|
1807
2103
|
readonly staleOn?: "resource-change";
|
|
1808
|
-
/**
|
|
2104
|
+
/**
|
|
2105
|
+
* Distinct approvers a request needs before it is approved under `by`; absent
|
|
2106
|
+
* means 1.
|
|
2107
|
+
*/
|
|
1809
2108
|
readonly quorum?: number;
|
|
1810
|
-
/**
|
|
2109
|
+
/**
|
|
2110
|
+
* Seconds a request stays open; the store's default when absent, and never
|
|
2111
|
+
* longer than it.
|
|
2112
|
+
*/
|
|
1811
2113
|
readonly ttl?: number;
|
|
1812
2114
|
readonly escalation?: ApprovalEscalation;
|
|
1813
2115
|
};
|
|
1814
2116
|
type ApprovalOption = "human" | {
|
|
1815
2117
|
readonly by?: ApproverInput;
|
|
1816
|
-
/**
|
|
2118
|
+
/**
|
|
2119
|
+
* `'all'` or `'sequential'` with `stages`; absent means `'any'` with
|
|
2120
|
+
* `by`.
|
|
2121
|
+
*/
|
|
1817
2122
|
readonly mode?: ApprovalMode;
|
|
1818
2123
|
readonly stages?: readonly {
|
|
1819
2124
|
readonly by: ApproverInput;
|
|
@@ -1832,11 +2137,20 @@ type ApprovalOption = "human" | {
|
|
|
1832
2137
|
* changes, resuming denies with `stale-approval`.
|
|
1833
2138
|
*/
|
|
1834
2139
|
readonly staleOn?: "resource-change";
|
|
1835
|
-
/**
|
|
2140
|
+
/**
|
|
2141
|
+
* Distinct approvers needed (an integer of at least 1); the same approver
|
|
2142
|
+
* counts once. Absent means 1.
|
|
2143
|
+
*/
|
|
1836
2144
|
readonly quorum?: number;
|
|
1837
|
-
/**
|
|
2145
|
+
/**
|
|
2146
|
+
* Seconds the request stays open (`1800`); caps the approval store's
|
|
2147
|
+
* default.
|
|
2148
|
+
*/
|
|
1838
2149
|
readonly ttl?: number;
|
|
1839
|
-
/**
|
|
2150
|
+
/**
|
|
2151
|
+
* After `after` seconds (`14_400`), `to` may approve as well as `by`, at
|
|
2152
|
+
* any open stage; same kinds as `by`.
|
|
2153
|
+
*/
|
|
1840
2154
|
readonly escalation?: {
|
|
1841
2155
|
readonly after: number;
|
|
1842
2156
|
readonly to: ApproverInput;
|
|
@@ -1864,16 +2178,19 @@ type AssuranceRequirement = {
|
|
|
1864
2178
|
readonly amr?: readonly string[];
|
|
1865
2179
|
};
|
|
1866
2180
|
/**
|
|
1867
|
-
* Time-boxed role activation. A role with `activation` is never held
|
|
1868
|
-
*
|
|
1869
|
-
*
|
|
2181
|
+
* Time-boxed role activation. A role with `activation` is never held directly:
|
|
2182
|
+
* a membership lists it under `eligible`, and `permdock.activate` mints the
|
|
2183
|
+
* elevated membership to write.
|
|
1870
2184
|
*/
|
|
1871
2185
|
type ActivationOption = {
|
|
1872
2186
|
/** The longest an activation may last, in seconds (`14_400`). */
|
|
1873
2187
|
readonly maxDuration?: number;
|
|
1874
2188
|
/** `'required'` denies an activation without a reason. */
|
|
1875
2189
|
readonly justification?: "required" | "optional";
|
|
1876
|
-
/**
|
|
2190
|
+
/**
|
|
2191
|
+
* When set, `activate` returns `approval-required` before the membership can
|
|
2192
|
+
* be written.
|
|
2193
|
+
*/
|
|
1877
2194
|
readonly approval?: ApprovalOption;
|
|
1878
2195
|
/** How fresh the activator's authentication must be. */
|
|
1879
2196
|
readonly assurance?: AssuranceRequirement;
|
|
@@ -1921,10 +2238,16 @@ type SupportAccessOptions<S extends string = string> = {
|
|
|
1921
2238
|
readonly role: string;
|
|
1922
2239
|
/** The scope the support membership sits in; defaults to `tenant`. */
|
|
1923
2240
|
readonly on?: S;
|
|
1924
|
-
/**
|
|
2241
|
+
/**
|
|
2242
|
+
* Every decision under the support membership denies with `actor-required`
|
|
2243
|
+
* without an `act`.
|
|
2244
|
+
*/
|
|
1925
2245
|
readonly actorRequired?: boolean;
|
|
1926
2246
|
readonly consent: SupportConsent;
|
|
1927
|
-
/**
|
|
2247
|
+
/**
|
|
2248
|
+
* Permissions a support session never reaches, compiled to deny grants scoped
|
|
2249
|
+
* to `via: 'support'`.
|
|
2250
|
+
*/
|
|
1928
2251
|
readonly forbid?: readonly (Permission | PermissionTree)[];
|
|
1929
2252
|
/** The subgroup a consented membership records under `member.group`. */
|
|
1930
2253
|
readonly group?: string;
|
|
@@ -1945,38 +2268,56 @@ type GrantOptions<T = Record<string, unknown>> = {
|
|
|
1945
2268
|
readonly approval?: ApprovalOption;
|
|
1946
2269
|
readonly limit?: GrantLimit;
|
|
1947
2270
|
readonly reason?: string;
|
|
1948
|
-
readonly fields?: readonly (keyof T & string)[];
|
|
2271
|
+
readonly fields?: readonly (unknown extends T ? string : keyof T & string)[];
|
|
1949
2272
|
/**
|
|
1950
2273
|
* A stable name for the grant. On a deny, a `breakGlass` override may lift
|
|
1951
|
-
* it; on any grant, it is reported on `decision.matched.name` and on
|
|
1952
|
-
*
|
|
2274
|
+
* it; on any grant, it is reported on `decision.matched.name` and on decision
|
|
2275
|
+
* events.
|
|
1953
2276
|
*/
|
|
1954
2277
|
readonly name?: string;
|
|
1955
2278
|
readonly group?: string;
|
|
1956
|
-
/**
|
|
2279
|
+
/**
|
|
2280
|
+
* Display text and app data for the grant, reported on
|
|
2281
|
+
* `decision.matched.meta`; never read in evaluation.
|
|
2282
|
+
*/
|
|
1957
2283
|
readonly meta?: GrantMeta;
|
|
1958
2284
|
/**
|
|
1959
|
-
* Follow-ups the application owes when this allow grants: each becomes a
|
|
1960
|
-
*
|
|
2285
|
+
* Follow-ups the application owes when this allow grants: each becomes a `{
|
|
2286
|
+
* kind: 'app', name, detail? }` obligation on the decision. Allows only.
|
|
1961
2287
|
*/
|
|
1962
2288
|
readonly obligations?: readonly ObligationInput[];
|
|
1963
|
-
/**
|
|
2289
|
+
/**
|
|
2290
|
+
* Purposes of use (`context.purpose`) that make the grant apply;
|
|
2291
|
+
* non-portable.
|
|
2292
|
+
*/
|
|
1964
2293
|
readonly purpose?: readonly string[];
|
|
1965
|
-
/**
|
|
2294
|
+
/**
|
|
2295
|
+
* The grant applies from this instant on (RFC 3339 or an `Instant`); before
|
|
2296
|
+
* it an allow denies with `inactive-grant` and a deny does not apply.
|
|
2297
|
+
*/
|
|
1966
2298
|
readonly validFrom?: string | Instant;
|
|
1967
|
-
/**
|
|
2299
|
+
/**
|
|
2300
|
+
* The grant stops applying at this instant (exclusive; RFC 3339 or an
|
|
2301
|
+
* `Instant`).
|
|
2302
|
+
*/
|
|
1968
2303
|
readonly validUntil?: string | Instant;
|
|
1969
2304
|
/**
|
|
1970
|
-
* An allow on an instance action counts only on rows whose scope instance
|
|
1971
|
-
*
|
|
2305
|
+
* An allow on an instance action counts only on rows whose scope instance (or
|
|
2306
|
+
* the whole app, globally) is one where the subject also holds this
|
|
1972
2307
|
* permission through a role grant without a row condition.
|
|
1973
2308
|
*/
|
|
1974
2309
|
readonly requires?: Permission | readonly Permission[];
|
|
1975
2310
|
};
|
|
1976
|
-
/**
|
|
2311
|
+
/**
|
|
2312
|
+
* A grant's metadata. PermDock carries it to decisions, events, snapshots and
|
|
2313
|
+
* the catalog and never reads `x`.
|
|
2314
|
+
*/
|
|
1977
2315
|
type GrantMeta = {
|
|
1978
2316
|
readonly description?: string;
|
|
1979
|
-
/**
|
|
2317
|
+
/**
|
|
2318
|
+
* Data the application owns. Plain JSON, checked by `definePolicy(…, { x: {
|
|
2319
|
+
* grant } })`.
|
|
2320
|
+
*/
|
|
1980
2321
|
readonly x?: AppData;
|
|
1981
2322
|
};
|
|
1982
2323
|
/** An app obligation as declared on an allow: its name, or its name and detail. */
|
|
@@ -1986,22 +2327,25 @@ type ObligationInput = string | {
|
|
|
1986
2327
|
};
|
|
1987
2328
|
/**
|
|
1988
2329
|
* When a grant applies, in Unix seconds. `from` is inclusive, `until`
|
|
1989
|
-
* exclusive; either may be absent. Portable: `where()` drops an inactive
|
|
1990
|
-
*
|
|
2330
|
+
* exclusive; either may be absent. Portable: `where()` drops an inactive grant
|
|
2331
|
+
* at the decision clock and generated RLS compares against `now()`.
|
|
1991
2332
|
*/
|
|
1992
2333
|
type GrantValidity = {
|
|
1993
2334
|
readonly from?: number;
|
|
1994
2335
|
readonly until?: number;
|
|
1995
2336
|
};
|
|
1996
|
-
/**
|
|
2337
|
+
/**
|
|
2338
|
+
* A grant's validity in JSON (snapshots, catalogs, `inactive-grant` details):
|
|
2339
|
+
* RFC 3339 bounds.
|
|
2340
|
+
*/
|
|
1997
2341
|
type WireValidity = {
|
|
1998
2342
|
readonly from?: string;
|
|
1999
2343
|
readonly until?: string;
|
|
2000
2344
|
};
|
|
2001
2345
|
/**
|
|
2002
|
-
* The actor a policy delegation is for: an actor kind, narrowed to one id
|
|
2003
|
-
*
|
|
2004
|
-
*
|
|
2346
|
+
* The actor a policy delegation is for: an actor kind, narrowed to one id when
|
|
2347
|
+
* `id` is set, or to one named client when `client` is set (the name the
|
|
2348
|
+
* subject resolver gives a verified client id through `clients`).
|
|
2005
2349
|
*/
|
|
2006
2350
|
type DelegationTarget = {
|
|
2007
2351
|
readonly kind: ActorKind;
|
|
@@ -2017,42 +2361,66 @@ type PolicyDelegation = {
|
|
|
2017
2361
|
readonly from: Grantee | readonly Grantee[];
|
|
2018
2362
|
readonly to: DelegationTarget;
|
|
2019
2363
|
readonly permissions: readonly string[];
|
|
2020
|
-
/**
|
|
2364
|
+
/**
|
|
2365
|
+
* The keys of `permissions` whose `readOnlyHint` is true: all a `readOnly`
|
|
2366
|
+
* actor may use.
|
|
2367
|
+
*/
|
|
2021
2368
|
readonly readOnly: readonly string[];
|
|
2022
2369
|
readonly validity?: GrantValidity;
|
|
2023
2370
|
};
|
|
2024
2371
|
type DelegationInput = {
|
|
2025
|
-
/**
|
|
2372
|
+
/**
|
|
2373
|
+
* Who hands over: the same subject-only selectors as `approval.by` (a role,
|
|
2374
|
+
* `authenticated()`, a plan, `assurance()`); not `relation()`.
|
|
2375
|
+
*/
|
|
2026
2376
|
readonly from: GranteeInput;
|
|
2027
|
-
/**
|
|
2377
|
+
/**
|
|
2378
|
+
* Which actor may act: `actor('eve')`, an actor kind, `{ kind, id }` for one
|
|
2379
|
+
* agent, or `{ kind, client }` for one named OAuth client.
|
|
2380
|
+
*/
|
|
2028
2381
|
readonly to: ActorGrantee | string | DelegationTarget;
|
|
2029
2382
|
/** The leaves or subtrees the actor may use; a deny grant still applies. */
|
|
2030
2383
|
readonly permissions: readonly (Permission | PermissionTree)[];
|
|
2031
2384
|
readonly validFrom?: string | Instant;
|
|
2032
2385
|
readonly validUntil?: string | Instant;
|
|
2033
2386
|
};
|
|
2034
|
-
/**
|
|
2387
|
+
/**
|
|
2388
|
+
* A declared scope name (or the `tenant` / `team` alias), or the resource a
|
|
2389
|
+
* role is held on.
|
|
2390
|
+
*/
|
|
2035
2391
|
type RoleScope<S extends string = string> = S | Permission | PermissionTree | readonly (Permission | PermissionTree)[];
|
|
2036
2392
|
type RoleOptions<S extends string = string> = {
|
|
2037
2393
|
readonly on?: RoleScope<S>;
|
|
2038
2394
|
readonly assignable?: boolean;
|
|
2039
2395
|
/** Roles nobody may hold together with this one in the same scope instance. */
|
|
2040
2396
|
readonly exclusiveWith?: readonly string[];
|
|
2041
|
-
/**
|
|
2397
|
+
/**
|
|
2398
|
+
* Fewest holders a scope instance keeps (checked at commit); default 0. Needs
|
|
2399
|
+
* a named-scope `on`.
|
|
2400
|
+
*/
|
|
2042
2401
|
readonly min?: number;
|
|
2043
2402
|
/** Most holders a scope instance may have. Needs a named-scope `on`. */
|
|
2044
2403
|
readonly max?: number;
|
|
2045
|
-
/**
|
|
2404
|
+
/**
|
|
2405
|
+
* The holder count of a scope instance never changes: the role only moves by
|
|
2406
|
+
* transfer.
|
|
2407
|
+
*/
|
|
2046
2408
|
readonly transferOnly?: boolean;
|
|
2047
2409
|
/**
|
|
2048
|
-
* Roles a holder may assign and revoke. Once any role declares `assigns`,
|
|
2049
|
-
*
|
|
2410
|
+
* Roles a holder may assign and revoke. Once any role declares `assigns`, a
|
|
2411
|
+
* role nobody lists is assigned only by `meta.manageRoles` holders.
|
|
2050
2412
|
*/
|
|
2051
2413
|
readonly assigns?: readonly string[];
|
|
2052
|
-
/**
|
|
2414
|
+
/**
|
|
2415
|
+
* Membership kinds (`via`) that may hold the role; others hold it for
|
|
2416
|
+
* nothing.
|
|
2417
|
+
*/
|
|
2053
2418
|
readonly for?: readonly string[];
|
|
2054
2419
|
readonly meta?: RoleMeta;
|
|
2055
|
-
/**
|
|
2420
|
+
/**
|
|
2421
|
+
* Time-boxed activation: the role becomes eligible-only and `activate` mints
|
|
2422
|
+
* its membership.
|
|
2423
|
+
*/
|
|
2056
2424
|
readonly activation?: ActivationOption;
|
|
2057
2425
|
/** Reserved for restricted credentials; setting it throws until it ships. */
|
|
2058
2426
|
readonly restricted?: never;
|
|
@@ -2070,31 +2438,52 @@ type Grant = {
|
|
|
2070
2438
|
readonly check?: Condition;
|
|
2071
2439
|
readonly approval?: "human" | ApprovalRequirement;
|
|
2072
2440
|
readonly portable: boolean;
|
|
2073
|
-
/**
|
|
2441
|
+
/**
|
|
2442
|
+
* Set when `portable` is false only because the grant reads the relation
|
|
2443
|
+
* graph.
|
|
2444
|
+
*/
|
|
2074
2445
|
readonly graph?: true;
|
|
2075
2446
|
readonly closure?: ClosureGrantFn;
|
|
2076
2447
|
readonly limit?: GrantLimit;
|
|
2077
2448
|
readonly fields?: readonly string[];
|
|
2078
2449
|
readonly scope: GrantScope;
|
|
2079
|
-
/**
|
|
2450
|
+
/**
|
|
2451
|
+
* The grant's stable name: a `breakGlass` override lifts a named deny, and
|
|
2452
|
+
* `decision.matched.name` reports it.
|
|
2453
|
+
*/
|
|
2080
2454
|
readonly name?: string;
|
|
2081
2455
|
readonly group?: string;
|
|
2082
2456
|
readonly meta?: GrantMeta;
|
|
2083
2457
|
/** App obligations an allow adds to its granted decision. */
|
|
2084
2458
|
readonly obligations?: readonly AppObligation[];
|
|
2085
|
-
/**
|
|
2459
|
+
/**
|
|
2460
|
+
* Purposes of use that make the grant apply (`context.purpose`);
|
|
2461
|
+
* non-portable.
|
|
2462
|
+
*/
|
|
2086
2463
|
readonly purpose?: readonly string[];
|
|
2087
|
-
/**
|
|
2464
|
+
/**
|
|
2465
|
+
* Set on a break-glass allow: it overrides named denies and carries
|
|
2466
|
+
* obligations.
|
|
2467
|
+
*/
|
|
2088
2468
|
readonly breakGlass?: BreakGlassSpec;
|
|
2089
|
-
/**
|
|
2469
|
+
/**
|
|
2470
|
+
* The membership kind (`via`) this grant applies under; others never match
|
|
2471
|
+
* it.
|
|
2472
|
+
*/
|
|
2090
2473
|
readonly viaOnly?: MembershipVia;
|
|
2091
2474
|
/** Set only on a grant merged from a hosted policy document. */
|
|
2092
2475
|
readonly hosted?: HostedGrantRef;
|
|
2093
2476
|
/** When the grant applies; absent means always. */
|
|
2094
2477
|
readonly validity?: GrantValidity;
|
|
2095
|
-
/**
|
|
2478
|
+
/**
|
|
2479
|
+
* Set on a custom-role grant narrowed by a resource level
|
|
2480
|
+
* (`CustomRoleGrant.level`).
|
|
2481
|
+
*/
|
|
2096
2482
|
readonly level?: string;
|
|
2097
|
-
/**
|
|
2483
|
+
/**
|
|
2484
|
+
* The permission key the subject must also hold, through a role, on the row's
|
|
2485
|
+
* scope instance or globally.
|
|
2486
|
+
*/
|
|
2098
2487
|
readonly requires?: readonly string[];
|
|
2099
2488
|
};
|
|
2100
2489
|
/** Which hosted policy document and grant a merged grant came from. */
|
|
@@ -2114,13 +2503,22 @@ type RoleBinding<S extends string = string> = {
|
|
|
2114
2503
|
readonly assigns?: readonly string[];
|
|
2115
2504
|
readonly for?: readonly string[];
|
|
2116
2505
|
readonly meta?: RoleMeta;
|
|
2117
|
-
/**
|
|
2506
|
+
/**
|
|
2507
|
+
* Time-boxed activation: the role is eligible-only, and `activate` mints its
|
|
2508
|
+
* membership.
|
|
2509
|
+
*/
|
|
2118
2510
|
readonly activation?: ActivationSpec;
|
|
2119
|
-
/**
|
|
2511
|
+
/**
|
|
2512
|
+
* Support access: consent and `actorRequired` for a vendor-support
|
|
2513
|
+
* membership.
|
|
2514
|
+
*/
|
|
2120
2515
|
readonly support?: SupportSpec;
|
|
2121
2516
|
};
|
|
2122
2517
|
type ValidateMode = "boundary" | "always" | "never";
|
|
2123
|
-
/**
|
|
2518
|
+
/**
|
|
2519
|
+
* The declared scopes, in declaration order; empty when the policy declares
|
|
2520
|
+
* none.
|
|
2521
|
+
*/
|
|
2124
2522
|
type PolicyScopes = readonly Scope[];
|
|
2125
2523
|
type PolicyVocabulary = {
|
|
2126
2524
|
readonly permissions: PermissionTree;
|
|
@@ -2132,7 +2530,7 @@ type VocabularyFromInput<Input> = Input extends PolicyVocabulary ? Input : {
|
|
|
2132
2530
|
readonly roles?: RoleTree;
|
|
2133
2531
|
readonly plans?: PlanTree;
|
|
2134
2532
|
};
|
|
2135
|
-
type Policy<TUser = unknown, TPrincipal extends Principal = Principal, V extends PolicyVocabulary = PolicyVocabulary> = {
|
|
2533
|
+
type Policy<TUser = unknown, TPrincipal extends Principal = Principal, V extends PolicyVocabulary = PolicyVocabulary, S extends PolicyScopesInput = PolicyScopesInput> = {
|
|
2136
2534
|
readonly permissions: V["permissions"];
|
|
2137
2535
|
readonly roles: readonly RoleBinding[];
|
|
2138
2536
|
readonly rolesByName: ReadonlyMap<string, RoleBinding>;
|
|
@@ -2146,18 +2544,39 @@ type Policy<TUser = unknown, TPrincipal extends Principal = Principal, V extends
|
|
|
2146
2544
|
readonly onDenied?: (decision: unknown) => never | void;
|
|
2147
2545
|
readonly fingerprint: string;
|
|
2148
2546
|
readonly resources: ReadonlyMap<string, ResourceNode>;
|
|
2149
|
-
/**
|
|
2547
|
+
/**
|
|
2548
|
+
* The app data schemas `definePolicy` was given; symbol-keyed so freezing the
|
|
2549
|
+
* policy leaves the schemas alone.
|
|
2550
|
+
*/
|
|
2150
2551
|
readonly [POLICY_X]?: PolicyAppDataSchemas;
|
|
2552
|
+
readonly [POLICY_SCOPES]?: S;
|
|
2151
2553
|
readonly providers?: readonly DecisionProvider[];
|
|
2152
|
-
/**
|
|
2554
|
+
/**
|
|
2555
|
+
* Permission keys a hosted policy document may grant or deny; empty by
|
|
2556
|
+
* default.
|
|
2557
|
+
*/
|
|
2153
2558
|
readonly hostable: readonly string[];
|
|
2154
|
-
/**
|
|
2559
|
+
/**
|
|
2560
|
+
* Permission keys that deny with `stale-credentials` when the subject's token
|
|
2561
|
+
* is behind the source.
|
|
2562
|
+
*/
|
|
2155
2563
|
readonly fresh?: readonly string[];
|
|
2156
|
-
/**
|
|
2564
|
+
/**
|
|
2565
|
+
* Policy delegations in declaration order; absent or empty when the policy
|
|
2566
|
+
* declares none.
|
|
2567
|
+
*/
|
|
2157
2568
|
readonly delegations?: readonly PolicyDelegation[];
|
|
2158
|
-
/**
|
|
2569
|
+
/**
|
|
2570
|
+
* Grant levels by resource (`resource(…, { levels })`), normalised; absent
|
|
2571
|
+
* when none are declared.
|
|
2572
|
+
*/
|
|
2159
2573
|
readonly levels?: PolicyLevels;
|
|
2160
|
-
/**
|
|
2574
|
+
/** Resources declared with `orderedLevels: true`, sorted; absent when none. */
|
|
2575
|
+
readonly orderedLevels?: readonly string[];
|
|
2576
|
+
/**
|
|
2577
|
+
* Coarse OAuth scopes in declaration order; absent when the policy declares
|
|
2578
|
+
* none.
|
|
2579
|
+
*/
|
|
2161
2580
|
readonly oauthScopes?: readonly PolicyOAuthScope[];
|
|
2162
2581
|
readonly index: PolicyIndex;
|
|
2163
2582
|
};
|
|
@@ -2170,7 +2589,10 @@ type PolicyOAuthScope = {
|
|
|
2170
2589
|
readonly permissions: readonly string[];
|
|
2171
2590
|
readonly scopes: readonly string[];
|
|
2172
2591
|
};
|
|
2173
|
-
/**
|
|
2592
|
+
/**
|
|
2593
|
+
* Lookups built once per policy, so a decision does not rescan every role and
|
|
2594
|
+
* grant.
|
|
2595
|
+
*/
|
|
2174
2596
|
type PolicyIndex = {
|
|
2175
2597
|
readonly declaredRoles: ReadonlySet<string>;
|
|
2176
2598
|
readonly supports: readonly SupportSpec[];
|
|
@@ -2196,19 +2618,22 @@ type PolicyOptions<TUser, TPrincipal extends Principal, S extends PolicyScopesIn
|
|
|
2196
2618
|
readonly grants?: readonly (Omit<Grant, "role" | "scope"> | readonly Omit<Grant, "role" | "scope">[] | Grant)[];
|
|
2197
2619
|
/**
|
|
2198
2620
|
* Named scopes in order, each with the row field holding its id and an
|
|
2199
|
-
* optional parent (`within`, an earlier scope). `tenant` and `team` alias
|
|
2200
|
-
*
|
|
2621
|
+
* optional parent (`within`, an earlier scope). `tenant` and `team` alias the
|
|
2622
|
+
* first and second scope.
|
|
2201
2623
|
*/
|
|
2202
2624
|
readonly scopes?: S;
|
|
2203
|
-
/**
|
|
2625
|
+
/**
|
|
2626
|
+
* Maps the application's user to the principal PermDock decides for; `null`
|
|
2627
|
+
* is anonymous.
|
|
2628
|
+
*/
|
|
2204
2629
|
readonly subject: (user: TUser) => TPrincipal | null;
|
|
2205
2630
|
readonly context?: (user: TUser) => Readonly<Record<string, unknown>> | Promise<Readonly<Record<string, unknown>>>;
|
|
2206
2631
|
readonly validate?: ValidateMode;
|
|
2207
2632
|
readonly onDenied?: (decision: unknown) => never | void;
|
|
2208
2633
|
readonly providers?: readonly DecisionProvider[];
|
|
2209
2634
|
/**
|
|
2210
|
-
* Leaves or subtrees a hosted policy document (`PolicySource`) may touch.
|
|
2211
|
-
*
|
|
2635
|
+
* Leaves or subtrees a hosted policy document (`PolicySource`) may touch. The
|
|
2636
|
+
* default is none, so a policy without it ignores every hosted grant.
|
|
2212
2637
|
*/
|
|
2213
2638
|
readonly hostable?: readonly (Permission | PermissionTree)[];
|
|
2214
2639
|
/**
|
|
@@ -2219,8 +2644,8 @@ type PolicyOptions<TUser, TPrincipal extends Principal, S extends PolicyScopesIn
|
|
|
2219
2644
|
readonly fresh?: readonly (Permission | PermissionTree)[];
|
|
2220
2645
|
/**
|
|
2221
2646
|
* Standing delegations: holders of `from` let actors matching `to` use
|
|
2222
|
-
* `permissions` for them without a token saying so. A token delegation on
|
|
2223
|
-
*
|
|
2647
|
+
* `permissions` for them without a token saying so. A token delegation on the
|
|
2648
|
+
* call still applies as well; both must cover.
|
|
2224
2649
|
*/
|
|
2225
2650
|
readonly delegations?: readonly DelegationInput[];
|
|
2226
2651
|
/**
|
|
@@ -2251,4 +2676,4 @@ type SubjectOf<P> = {
|
|
|
2251
2676
|
readonly expiresAt?: number;
|
|
2252
2677
|
};
|
|
2253
2678
|
//#endregion
|
|
2254
|
-
export {
|
|
2679
|
+
export { LimitRemaining as $, Quota as $n, SnapshotGrant as $t, PolicyScopes as A, Grantee as An, SqlFunctionCondition as Ar, CredentialDecision as At, ValidateMode as B, relation as Bn, decideCredential as Bt, MembershipFixture as C, ApproverInput as Cn, MemberOfCondition as Cr, SupportSessionDecision as Ct, PolicyDelegation as D, anyOf as Dn, RelatedHop as Dr, parseSupportSession as Dt, PolicyAppDataSchemas as E, allOf as En, RelatedCondition as Er, decideSupportSession as Et, RoleScope as F, anyone as Fn, isSqlFunctionField as Fr, CredentialPolicyViolation as Ft, CustomRoleSource as G, DenialDetails as Gn, LocalCustomRoleTable as Gt, WireValidity as H, ApprovalRequiredDecision as Hn, parseCredential as Ht, SeparationConflict as I, assurance as In, CredentialRequest as It, DecisionSink as J, ExplainedDecision as Jn, LocalRowValue as Jt, CustomRoleSourceFactory as K, DenialReason as Kn, LocalMembershipRows as Kt, SubjectOf as L, authenticated as Ln, DecideCredentialOptions as Lt, PrincipalOf as M, InheritGrantee as Mn, isCondition as Mr, CredentialPermission as Mt, RoleBinding as N, RelationGrantee as Nn, isConditionDate as Nr, CredentialPermissionInput as Nt, PolicyOAuthScope as O, holder as On, RestrictedAncestors as Or, ApiKeyPrincipal as Ot, RoleOptions as P, actor as Pn, isConditionRef as Pr, CredentialPolicy as Pt, LimitConsumeInput as Q, Obligation as Qn, SnapshotAssignable as Qt, SupportAccessOptions as R, inherit as Rn, credentialDelegation as Rt, HostedGrantRef as S, Approver as Sn, ConditionValue as Sr, SupportSession as St, Policy as T, UserApprover as Tn, OpaqueCondition as Tr, SupportSessionRequest as Tt, CredentialVerifier as U, Decision as Un, InstanceHandle as Ut, VocabularyFromInput as V, AppObligation as Vn, isFeedId as Vt, CustomRoleContext as W, Denial as Wn, Instant as Wt, Intent as X, LimitDetail as Xn, LocalSnapshotRows as Xt, EntitlementSource as Y, GrantedDecision as Yn, LocalSnapshotManifest as Yt, JwtClaims as Z, MatchedGrant as Zn, Snapshot as Zt, GrantLimit as _, PolicyScopesInput as _n, ActorKind as _r, VerifiedToken as _t, ApprovalRequirement as a, CredentialEvent as an, AuthorizationDetail as ar, RelationHolder as at, GrantScope as b, ScopeNames as bn, Condition as br, WhereCompiler as bt, BreakGlassOptions as c, DeliveryEvent as cn, CustomRoleGrant as cr, SnapshotSource as ct, ClosureContext as d, EmailCategory as dn, JsonWebKeyLike as dr, SubjectResolver as dt, SnapshotNotEntitled as en, Trace as er, LimitStore as et, ClosureGrantFn as f, MembershipEvent as fn, Membership as fr, TenantSettings as ft, GrantCondition as g, WireDelegation as gn, VerifiedClaims as gr, VerificationFailure as gt, Grant as h, WireDenial as hn, Subject as hr, TokenVerifier as ht, ApprovalOption as i, AutomationEvent as in, Assurance as ir, RelationGroup as it, PolicyVocabulary as j, GranteeInput as jn, hasConditionOp as jr, CredentialKind as jt, PolicyOptions as k, user as kn, SqlFunctionArg as kr, Credential as kt, BreakGlassRequirements as l, DeliveryFailureCause as ln, Delegation as lr, SourceContext as lt, DelegationTarget as m, WireDecision as mn, SharedCustomRole as mr, TokenSigner as mt, ApprovalEscalation as n, AccessEvent as nn, TraceSkipReason as nr, MembershipSource as nt, ApprovalStage as o, DecisionEvent as on, Binding as or, RelationSource as ot, DelegationInput as p, SinkEvent as pn, Principal as pr, TokenFailureCause as pt, DecisionProvider as q, DeniedDecision as qn, LocalRowColumn as qt, ApprovalMode as r, AuthEvent as rn, Actor as rr, RelationChain as rt, AssuranceRequirement as s, DeliveryChannel as sn, CustomRole as sr, SettingsSource as st, ActivationOption as t, SnapshotScope as tn, TraceSkip as tr, MemberEntry as tt, BreakGlassSpec as u, DirectoryEvent as un, GnapAccess as ur, SourceMemo as ut, GrantMeta as v, Scope as vn, AdapterId as vr, VersionContext as vt, ObligationInput as w, PermissionApprover as wn, MemberOfParent as wr, SupportSessionPolicy as wt, GrantValidity as x, AnyOfApprover as xn, ConditionRef as xr, DecideSupportSessionOptions as xt, GrantOptions as y, ScopeDeclaration as yn, MembershipVia as yr, VersionQuery as yt, SupportConsent as z, plan as zn, credentialPolicyViolation as zt };
|