permdock 0.6.0 → 0.8.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 +2 -3
- package/dist/{2020-C9VN-x8c.js → 2020-CJbO8Bvz.js} +1 -3
- package/dist/a2a/index.d.ts +7 -7
- package/dist/a2a/index.js +9 -9
- package/dist/action-result-CL-QCITA.d.ts +19 -0
- package/dist/{adapter-context-CRhqyzCk.js → adapter-context-CIQpQxbE.js} +8 -2
- package/dist/{adoption-scan-DCYe60Pi.js → adoption-scan-BLs67P1l.js} +5 -5
- package/dist/agent/index.d.ts +3 -3
- package/dist/agent/index.js +1 -1
- package/dist/ai-sdk/index.d.ts +31 -10
- package/dist/ai-sdk/index.js +22 -12
- 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-Dg5LeAcT.js → approval-prompt-B8hQY69x.js} +5 -6
- package/dist/{approval-prompt-DvSSPQJX.d.ts → approval-prompt-PYagyQUj.d.ts} +13 -11
- package/dist/approvals/index.d.ts +5 -5
- package/dist/approvals/index.js +7 -7
- package/dist/{approvals-p1PGoVjb.js → approvals-DnIBTuXE.js} +128 -78
- package/dist/{approvers-CqPOLD-o.js → approvers-B4r0N_Uz.js} +8 -2
- package/dist/{arazzo-41WuzHou.js → arazzo-3RhGfkAK.js} +2 -2
- package/dist/{arazzo-CaUVBn7D.js → arazzo-B5-ulWif.js} +6 -6
- package/dist/{args-IIolxxKA.js → args-0FrVs5EH.js} +125 -8
- package/dist/astro/index.d.ts +30 -12
- package/dist/astro/index.js +2 -2
- package/dist/{audience-DabClFLQ.js → audience-BAkBDMqn.js} +8 -8
- package/dist/{auth-DRLEizbL.js → auth--yPyZNgr.js} +21 -10
- package/dist/authzen/index.d.ts +171 -25
- package/dist/authzen/index.js +321 -149
- package/dist/{automation-BNM3TtDo.d.ts → automation-DqEoWHBc.d.ts} +42 -32
- package/dist/{automation-DVjOckjV.js → automation-x3KEUusw.js} +22 -21
- package/dist/base-url-BQbddZO5.js +9 -0
- package/dist/better-auth/index.d.ts +2 -2
- package/dist/better-auth/index.js +13 -7
- package/dist/better-supabase/index.d.ts +392 -220
- package/dist/better-supabase/index.js +293 -152
- package/dist/{bind-DOyrv6zi.d.ts → bind-Cp2hBHzP.d.ts} +27 -12
- package/dist/{bind-CAvgUuKs.js → bind-D_sZSVA3.js} +22 -10
- 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-Bu_eDqYw.js → build-instance-CNWaYJyr.js} +3 -3
- package/dist/{canonical-json-BC8_nMTw.js → canonical-json-DwilZ1iB.js} +6 -3
- package/dist/{capability-N1K9IpqS.js → capability-BqX94r07.js} +31 -25
- package/dist/{capability-Drg-1YhL.d.ts → capability-ChuiONQU.d.ts} +41 -29
- package/dist/{casbin-Dyu2gnUD.js → casbin-H0rKxBx2.js} +16 -8
- package/dist/{casbin-Cr7RLtA3.js → casbin-cbSbhT_k.js} +2 -2
- package/dist/{casl-64gpT-8x.js → casl-C4OINZHI.js} +2 -2
- package/dist/{casl-DjEDhTCP.js → casl-CHHoCldP.js} +19 -10
- package/dist/catalog/index.d.ts +104 -23
- package/dist/catalog/index.js +117 -8
- package/dist/{catalog-HD2gf5mY.js → catalog-BFpz2EmT.js} +57 -26
- package/dist/{catalog-DZVbrF-z.js → catalog-DCspHDc8.js} +3 -3
- package/dist/{catalog-doc-Cdn7-0pQ.js → catalog-doc-DjMKzJp9.js} +53 -16
- package/dist/{catalog-fingerprint-CCP0-yQS.js → catalog-fingerprint-e6aCWosn.js} +19 -15
- package/dist/catalog-mRQQQhNK.js +1 -0
- package/dist/catalog-operations-Dadrl7Z-.js +60 -0
- package/dist/{create-CQWIpUG-.js → challenge-DImNcR7B.js} +157 -39
- 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-CGkP3Z7A.js +40 -0
- 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 +186 -38
- package/dist/cloud/index.js +293 -31
- package/dist/{cloud-ytQ3uviA.js → cloud-BFlGMaak.js} +5 -6
- package/dist/{codemod-5mpSpnUY.js → codemod-DLQ9Zpo4.js} +3 -4
- package/dist/{codemod-ua2hHy7w.js → codemod-DWSN2erG.js} +523 -201
- package/dist/collect-B5BL3klN.js +1 -0
- package/dist/{collect-mLTY4nwb.js → collect-B7ZFAJU3.js} +36 -64
- package/dist/{collect-Ci6akVwH.js → collect-Bzv3le0A.js} +6 -6
- 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-1bsAezL0.d.ts → compile-BFzysW3o.d.ts} +36 -12
- package/dist/{compile-CMqMx_IN.js → compile-EzEMB-7v.js} +77 -33
- package/dist/{completion-BTFrHZhX.js → completion-saoYiRFO.js} +17 -8
- package/dist/config-BwPBfN0t.js +108 -0
- package/dist/{config-Bj2Ixq3d.js → config-DBeXXmBF.js} +2 -2
- package/dist/{config-report-DSpsLpCE.js → config-report-BipSWA6V.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-CYLQNMYq.js +434 -0
- package/dist/{context-B_u3_bDJ.js → context-BnIzxTNE.js} +4 -3
- package/dist/convex/index.d.ts +13 -7
- package/dist/convex/index.js +9 -6
- package/dist/core-H-mbhpZc.js +341 -0
- package/dist/core-hWIARPDz.d.ts +206 -0
- package/dist/{create-CBMmFie-.d.ts → create-BSNrVuxh.d.ts} +87 -34
- package/dist/{create-B30OMUOJ.d.ts → create-BVq1lNQE.d.ts} +49 -28
- package/dist/{create-D_NmPOdH.d.ts → create-CM1FciYG.d.ts} +37 -29
- package/dist/{create-CGm28gyI.js → create-Cq4Uox0f.js} +13 -9
- package/dist/{create-DCF2SvoT.js → create-_noSrY1T.js} +15 -21
- package/dist/{credential-BcoiejpY.js → credential-CyyyvCsL.js} +42 -39
- package/dist/{credentials-DPyHmYz5.js → credentials-CdDxp7jN.js} +6 -6
- package/dist/{deciding-columns-Sq12mEA6.js → deciding-columns-NB4wcyBf.js} +13 -2
- package/dist/{delegation-j6-rc37o.js → delegation-CDB6_keF.js} +31 -22
- package/dist/delivery/index.d.ts +5 -5
- package/dist/delivery/index.js +6 -5
- package/dist/{delivery-DCAgNyCn.js → delivery-BupfvJIV.js} +81 -20
- package/dist/{delivery-event-xX4obB8F.js → delivery-event-JioK5YbS.js} +6 -6
- package/dist/denied-text-CHNlVInN.d.ts +22 -0
- package/dist/{describe-BybMRY7A.js → describe-Bb4hGK5d.js} +6 -5
- package/dist/{describe-B5qgDvEW.d.ts → describe-ByS9LgHK.d.ts} +5 -5
- package/dist/{device-BARQ8eYG.js → device-BwbJNmb2.js} +11 -8
- package/dist/{diff-CmuSD3vc.js → diff-CN8IYhC_.js} +2 -2
- package/dist/{diff-3jbx6Rm4.js → diff-iZWV65nC.js} +23 -14
- package/dist/{digest-B3kc_PgQ.d.ts → digest-8Yx2CchM.d.ts} +3 -3
- package/dist/{doctor-BdZw53-k.js → doctor-CHD1M9R5.js} +485 -141
- package/dist/{doctor-3ZqNHX_G.js → doctor-D3wo-yuz.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-BWXBMaKK.d.ts → errors-CHwoRRpB.d.ts} +4 -1
- package/dist/{errors-CWTY6uih.js → errors-Vpu6rKHl.js} +14 -10
- package/dist/{errors-DH5QEGXh.d.ts → errors-zi_4T-rx.d.ts} +22 -6
- package/dist/{evaluate-CNClBvcj.js → evaluate-Dd8Ta0Ie.js} +185 -80
- package/dist/{evaluations-beAooV0n.js → evaluations-IBceAeKT.js} +41 -20
- package/dist/{evaluations-C_1vdSZc.d.ts → evaluations-z8dQFDaN.d.ts} +12 -6
- 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-Dw0MTS3D.d.ts → fetch-adapter-C1DCvpqV.d.ts} +9 -6
- package/dist/{fetch-adapter-DD_gfmrC.js → fetch-adapter-JL43jD3E.js} +14 -11
- package/dist/fields-D0vUI6dq.js +498 -0
- package/dist/{files-C5ZI27eV.js → files-B3AA05f1.js} +21 -5
- package/dist/{files-D_JIzUrP.js → files-BSjrtIHw.js} +11 -4
- package/dist/{fixtures-B7XrLeY7.js → fixtures-A1_sp_tR.js} +15 -6
- package/dist/{flags-C3DktBDY.js → flags-DXjoTVbS.js} +2 -2
- package/dist/{freeze-CrU8nQeX.js → freeze-jjan0lCv.js} +4 -1
- package/dist/{from-snapshot-CTCMsFZk.js → from-snapshot-DCakWRsr.js} +26 -16
- package/dist/gen-B5kvbAoZ.js +58 -0
- package/dist/gen-DWCYcMQM.js +827 -0
- package/dist/generate-CRVV5V7l.js +165 -0
- package/dist/generate-CezbCaTI.js +275 -0
- package/dist/{grantee-hxrUsbpM.js → grantee-Dke-9rd1.js} +4 -4
- package/dist/{grantee-conditions-CcXf8hMM.js → grantee-conditions-BrYPe-w0.js} +12 -12
- package/dist/{grantee-match-DbENBHLB.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-CBYVMjwh.js → helpers-DJicaG6f.js} +40 -28
- package/dist/hono/index.d.ts +16 -10
- package/dist/hono/index.js +5 -5
- package/dist/{hosted-BPk51-kX.d.ts → hosted-Cmtxogd0.d.ts} +44 -20
- package/dist/{hosted-B46-5LYE.js → hosted-D0IzESu_.js} +68 -25
- package/dist/{http-ujKm0JXE.js → http-DH94eh6f.js} +4 -4
- package/dist/{http-BBoKefeS.js → http-DKLXrFGk.js} +13 -7
- package/dist/{http-DXJ37RDA.js → http-DOL33cO0.js} +11 -8
- package/dist/{import-wyqXUyjm.js → import-CST57XLp.js} +64 -51
- package/dist/{import-CNV7I2Dw.js → import-_YqhhwvX.js} +6 -6
- package/dist/{index-B8YjkEZ4.d.ts → index-B8s204GL.d.ts} +64 -52
- package/dist/{index-Ch8LpNDp.d.ts → index-BT5-1VsX.d.ts} +64 -25
- package/dist/{index-DuWxc5dt.d.ts → index-BW_0MZOS.d.ts} +388 -149
- package/dist/index-BhxEUY9J.d.ts +233 -0
- package/dist/index-Bv5iXPqU.d.ts +210 -0
- package/dist/{index-C-6Letxg.d.ts → index-_9UiQIkt.d.ts} +164 -77
- package/dist/index.d.ts +22 -21
- package/dist/index.js +35 -33
- package/dist/{init-GG6Jh8HD.js → init-Dz_PsHdv.js} +5 -5
- package/dist/{init-DeMYsnYJ.js → init-cE3A8aXq.js} +10 -10
- package/dist/{instance-options-BsVpyGIk.d.ts → instance-options-B0KXqTrJ.d.ts} +4 -4
- package/dist/{instance-snapshot-BOEhcqIF.js → instance-snapshot--JWiTrvO.js} +81 -56
- 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 +125 -17
- package/dist/jwt/index.js +157 -16
- package/dist/{kernel-D0NVb1cK.js → kernel-C-fYydV2.js} +151 -16
- 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-DFS_ry0W.js → load-DjSU5KXO.js} +6 -6
- package/dist/load-Dm0pSYH3.js +1 -0
- package/dist/{login-Dfe5RlYk.js → login-D-8tMqzo.js} +4 -4
- package/dist/{login-imhuwvn3.js → login-DplQ0s84.js} +18 -15
- package/dist/{manifest-dvL2XEe1.js → manifest-Cgiq5oqc.js} +67 -37
- package/dist/{manifest-mx5ghSFM.d.ts → manifest-CzzWtnAb.d.ts} +144 -28
- package/dist/{manifest-schema-C0kK_8V0.js → manifest-schema-2r37XRhD.js} +80 -9
- package/dist/{manifest-C8IzW3Do.js → manifest-wg8WkkpD.js} +11 -7
- package/dist/{map-claims-D3oRmTk0.js → map-claims-BNWCJtmP.js} +27 -18
- package/dist/{map-error-Dr70oA_3.js → map-error-pasIGqMT.js} +7 -7
- package/dist/{markers-C6joDI3o.js → markers-BeHZ4x9Q.js} +20 -5
- package/dist/mcp/index.d.ts +154 -47
- package/dist/mcp/index.js +200 -41
- package/dist/{migrate-CIq4-E9F.js → migrate-B7oP_sQU.js} +102 -31
- 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 +72 -26
- package/dist/next/index.js +110 -6
- 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 +61 -30
- package/dist/openapi/index.js +2 -2
- package/dist/{openapi-B7HZ0f-r.js → openapi-BOsx0xn9.js} +34 -24
- package/dist/{openapi-C4dDTVEd.js → openapi-CBZUhA3l.js} +4 -5
- package/dist/{openapi-DD1SV-5-.js → openapi-VeHHU2l9.js} +23 -14
- package/dist/{operation-findings-DgATDpvh.js → operation-findings-CXtFzlKJ.js} +3 -3
- package/dist/{operations-X0VM7F3m.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-files-BHOIlrfD.js +1 -0
- package/dist/{output-files-DhRBBE4n.js → output-files-BIQ_9pIs.js} +29 -17
- package/dist/{output-1im__-08.js → output-tkju6U7R.js} +15 -7
- package/dist/ownership-B4L59T9u.js +1054 -0
- package/dist/parse-1_ZheTW5.js +151 -0
- package/dist/parse-local-manifest-BQhTlLQS.d.ts +10 -0
- package/dist/parse-local-manifest-DEiCF4ah.js +69 -0
- 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 +23 -12
- package/dist/{peer-CRvC7Hg1.js → peer-C9LvBCcb.js} +1 -1
- package/dist/peer-Q0fuZ6hx.js +982 -0
- package/dist/{permdock-SV8ZINYT.d.ts → permdock-B6Sf4T_S.d.ts} +270 -117
- package/dist/{permdock-BrAscV28.js → permdock-L-_I_3zP.js} +226 -74
- package/dist/{permission-registry-Br4jSNVi.js → permission-registry-B8tYxPIt.js} +24 -11
- package/dist/{vocabulary-CN8H_9UF.d.ts → permission-types-CAY-GU7e.d.ts} +130 -104
- package/dist/{permissions-u_KHg-sN.d.ts → permissions-Bx6UI8n1.d.ts} +6 -2
- package/dist/{permissions-B-wCP5ZC.js → permissions-CVXmRILq.js} +3 -3
- package/dist/{permissions-BPxlwVhN.js → permissions-mDcTWoBs.js} +8 -5
- package/dist/pg-DQTqRrou.js +60 -0
- package/dist/{pins-8ILTftC9.js → pins-nqarl3oE.js} +4 -1
- package/dist/pkce-CnmmYqUZ.js +21 -0
- package/dist/{policy-77FSAq_V.d.ts → policy-Ba4bDhaj.d.ts} +5 -5
- package/dist/{policy-DbM5YYtV.js → policy-CLQ8__GF.js} +49 -20
- package/dist/{policy-from-catalog-C2gMa2Dj.js → policy-from-catalog-CJgOm6aq.js} +28 -25
- package/dist/{policy-module-CTlwMvLI.js → policy-module-xym9fnSq.js} +12 -6
- package/dist/{policy-types-n0uRTsW8.d.ts → policy-types-CCiDRZBH.d.ts} +802 -334
- package/dist/postgres-store-DcyrPS-r.js +1028 -0
- package/dist/{postgrest-DAjUkF9w.js → postgrest-D4nuPXIQ.js} +88 -36
- package/dist/{postgrest-CEgRbefE.d.ts → postgrest-DicQyqm-.d.ts} +60 -30
- package/dist/powersync-DHNQX06W.js +1117 -0
- package/dist/{powersync-DISt6SUe.js → powersync-DXqGuq9A.js} +3 -3
- package/dist/powersync-Djf-zCpB.js +1 -0
- package/dist/preset/index.d.ts +38 -28
- package/dist/preset/index.js +1 -1
- package/dist/{preset-DZdU0tne.js → preset-BjLzeFpp.js} +58 -34
- 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-BYc6drYW.js +938 -0
- package/dist/protected-action-BE7N_Luo.d.ts +58 -0
- package/dist/protected-action-DUYqb-Ma.js +80 -0
- package/dist/{protected-BlF0F6wL.js → protected-action-QEA8arRB.js} +48 -14
- package/dist/{provider-B1al-AZz.js → provider-C55OGXJ7.js} +5 -4
- package/dist/{provider-DILL9oPK.d.ts → provider-DXfq5c2d.d.ts} +1 -1
- package/dist/{provider-store-DM6DNcta.js → provider-store-CaTv00tr.js} +13 -9
- package/dist/pull-B65ndFNZ.js +1 -0
- package/dist/{pull-jEwbf80J.js → pull-CwpGaQSi.js} +12 -11
- package/dist/{push-BD4f15co.js → push-DgssgzkK.js} +62 -16
- package/dist/{pushed-policy-DCW91KQU.d.ts → pushed-policy-D1Eoi6NM.d.ts} +12 -6
- package/dist/{pushed-policy-CqtxkV4G.js → pushed-policy-ITwYKvvH.js} +10 -7
- 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 +104 -51
- package/dist/react-native/index.js +394 -67
- package/dist/{refs-K6eWUJ0H.js → refs-C8BKxc_e.js} +17 -3
- 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-Bkm-Ne4l.d.ts → replay-DNftIb_R.d.ts} +1 -1
- package/dist/{request-context-C81Pip9n.js → request-context-C25ilqiJ.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-CF7xXLSG.js +201 -0
- package/dist/{resource-relations-D_jw0BFx.js → resource-relations-8-pCScBO.js} +18 -9
- package/dist/{retire-CALjIQ7e.js → retire-B2xffQgY.js} +15 -6
- package/dist/{revocations-R07lFBnX.d.ts → revocations-BaUXHM1N.d.ts} +6 -3
- package/dist/{rls-DTvYd-lI.js → rls-CNEH2_BG.js} +743 -624
- package/dist/{rls-BAqP4q66.js → rls-Ca8Jz9b5.js} +41 -10
- package/dist/{role-builder-uWQZ4v84.js → role-builder-BK2-T6oD.js} +41 -20
- package/dist/rolldown-runtime-C3I60J0A.js +4 -0
- package/dist/{row-conditions-h2HythXQ.js → row-conditions-BAGHOmVq.js} +4 -3
- package/dist/{rpc-VSl5ylaQ.js → rpc-fNqAIqQk.js} +8 -5
- package/dist/{run-CUKuz0A8.js → run-Bz26OTfO.js} +26 -23
- package/dist/run-D-JE8QWb.js +1 -0
- package/dist/{run-ticket-DocwaTKn.d.ts → run-ticket-DbWI9f99.d.ts} +33 -13
- package/dist/{run-ticket-sxFI6LAk.js → run-ticket-Dv7aF7Dk.js} +29 -8
- package/dist/{runtime-D3VTAiCA.js → runtime-BGnrOkVH.js} +5 -2
- package/dist/{saas-BCXRuXca.js → saas-iWnUdwCt.js} +42 -29
- package/dist/{scan-qvOe0hS3.js → scan-DCj1KQfn.js} +1 -1
- package/dist/{schema-B4v0Qrac.js → schema-BOJjqlWL.js} +3 -2
- package/dist/{schema-yLuBWWsh.js → schema-Dst9I9Gs.js} +9 -5
- package/dist/scim/index.d.ts +3 -2
- package/dist/scim/index.js +3 -1
- package/dist/scim-D8YupzX1.js +44 -0
- package/dist/{scim-ClHtpyV3.js → scim-jJBJ7g1Z.js} +35 -551
- package/dist/{scopes-CUPSjo9q.js → scopes-0Up_UA2t.js} +42 -24
- package/dist/server/index.d.ts +12 -12
- package/dist/server/index.js +13 -13
- package/dist/{server-C3WXAHZj.js → server-3cVlTLde.js} +31 -31
- package/dist/{server-types-CKQiCnON.d.ts → server-types-CIlpSA2G.d.ts} +81 -46
- package/dist/{sha256-D9ihqmvd.js → sha256-C-4WXKIu.js} +4 -3
- package/dist/{shared-BAK8t4Uo.js → shared-Afctg7B0.js} +100 -61
- package/dist/{shared-DvvFzYXe.js → shared-l0oGGetg.js} +9 -6
- package/dist/{signals-D3NcTKUS.js → signals-B1vHR3fN.js} +2 -2
- package/dist/{sink-BEZSlMS_.js → sink-D9_vh372.js} +32 -21
- package/dist/{sink-4-eQIRWf.d.ts → sink-Dvi7YZG_.d.ts} +44 -20
- package/dist/{skills-B6lVdD_W.js → skills-Bjj7BNEQ.js} +16 -12
- package/dist/{skills-CTYwkl44.js → skills-OuoMR49L.js} +3 -3
- package/dist/{snapshot-B7DkYg6g.js → snapshot-CXlzi69u.js} +21 -18
- package/dist/{snapshot-cache-PXI-vGpY.d.ts → snapshot-cache-BAXZ0KOp.d.ts} +21 -12
- package/dist/{snapshot-cache-DZHQ0KF6.js → snapshot-cache-Bx_4xC_6.js} +14 -11
- package/dist/solid/index.d.ts +55 -15
- 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-B1Os_YUu.d.ts +312 -0
- package/dist/{sources-vs5dGOsS.js → sources-CMAM-2A3.js} +156 -51
- package/dist/sources-qoIJQrJv.js +11 -0
- package/dist/{sql-B5T1IL83.js → sql-0WjxIp9g.js} +32 -7
- package/dist/sql-B80DFdpG.d.ts +10 -0
- package/dist/{src-Cu2m75uo.js → src-DZ0l9UAg.js} +305 -123
- package/dist/ssf/index.d.ts +4 -4
- package/dist/ssf/index.js +665 -224
- package/dist/{standard-webhooks-rbD7LS6h.d.ts → standard-webhooks-C-qX4mJW.d.ts} +7 -7
- package/dist/{standard-webhooks-DgFFD-Ga.js → standard-webhooks-D67a3nzk.js} +5 -5
- package/dist/{store-BDutJkDL.js → store-RNFvaJJv.js} +43 -29
- package/dist/{store-options-u0ycEe8s.js → store-options-Dil3lraY.js} +105 -15
- package/dist/stores-C0Kta5Ft.d.ts +59 -0
- package/dist/{stores-CGhM8BN_.js → stores-DxZWDXCs.js} +42 -5
- package/dist/{stream-CvdUS9V1.js → stream-CDvF0sJm.js} +5 -5
- package/dist/{stream-CeCMJmBB.d.ts → stream-ltuLdtTG.d.ts} +4 -3
- package/dist/{style-DiKWnAvn.js → style-DblOtSga.js} +1 -1
- package/dist/{style-Uao76wO7.js → style-Ds11Hmk4.js} +3 -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 -37
- package/dist/supabase/index.js +6 -6
- package/dist/supabase/middleware.d.ts +19 -13
- package/dist/supabase/middleware.js +7 -7
- package/dist/{supabase-x5JtR2tc.js → supabase-BL1qJzzY.js} +82 -36
- package/dist/{supabase-By_frk3U.js → supabase-D39cuGPt.js} +3 -3
- package/dist/{supabase-hook-BMoEhZir.js → supabase-hook-B-yXnzUl.js} +1206 -286
- package/dist/supabase-hook-H-MtE9Wd.js +1 -0
- package/dist/supautils-BU-pAEpf.js +808 -0
- package/dist/{support-session-C6xJQYut.js → support-session-BsmPCbz8.js} +22 -22
- 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-DqaJNJPn.js → tables-DeMNEy6V.js} +1025 -1085
- 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-DN2QAx9z.js → tenancy-5d1zVBvK.js} +36 -21
- package/dist/terminal/index.d.ts +23 -14
- package/dist/terminal/index.js +17 -20
- package/dist/testing/core.d.ts +2 -0
- package/dist/testing/core.js +1 -0
- package/dist/testing/fixtures/index.d.ts +15 -0
- package/dist/testing/fixtures/index.js +831 -0
- package/dist/testing/index.d.ts +235 -285
- package/dist/testing/index.js +502 -927
- 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-BtfSmdUo.js +444 -0
- package/dist/{thenable-yD7SabqG.js → thenable-BNSM1U2R.js} +12 -3
- package/dist/{time-DkWjdL98.js → time-nR1JesoH.js} +32 -8
- package/dist/{token-BLZcjQgt.js → token-DC9EQiet.js} +15 -13
- package/dist/{tool-refusal-CMLN5xhn.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-BIPIDa6a.d.ts +50 -0
- package/dist/{types-8RnwUAvE.d.ts → types-AMJ5qoU_.d.ts} +49 -30
- package/dist/{types-C_IiEs64.d.ts → types-B2mlGuhW.d.ts} +14 -11
- package/dist/{types-_WhUP7ud.d.ts → types-B4uqKDnp.d.ts} +25 -12
- package/dist/{types-CX7AvRqP.d.ts → types-BJk0BKRX.d.ts} +24 -14
- package/dist/types-B_d_g7T3.d.ts +262 -0
- package/dist/{types-BdtSDbBO.d.ts → types-B_tiYvk8.d.ts} +59 -32
- package/dist/{types-DqzsnlSA.js → types-CcUXciSj.js} +17 -5
- package/dist/{types-Dfv0aTER.d.ts → types-DC1Loeh3.d.ts} +449 -168
- package/dist/{types-lUlG3TVd.d.ts → types-DHKPcqzr.d.ts} +2 -2
- package/dist/{types-C791HFu9.d.ts → types-DjuMBNF9.d.ts} +68 -32
- package/dist/{types-C863OQiR.d.ts → types-HzqOtvsJ.d.ts} +23 -12
- package/dist/{types-Druu9wLM.d.ts → types-ZzRGoViD.d.ts} +77 -24
- package/dist/{types-BzzaHxt3.d.ts → types-ah9NlU6j.d.ts} +137 -48
- package/dist/{types-CVZSNocA.d.ts → types-djVzLlIV.d.ts} +31 -14
- package/dist/{types-BtHtcKMr.d.ts → types-yUuPR5Hy.d.ts} +47 -24
- package/dist/unplugin/index.d.ts +1 -1
- package/dist/unplugin/index.js +2 -2
- package/dist/usage-CYeXek0p.js +1 -0
- package/dist/{usage-SveTRTyr.js → usage-CxEzS4ey.js} +50 -26
- package/dist/{usage-CRVl9V3t.js → usage-ab0PdusX.js} +2 -2
- package/dist/{validation-error-ZfUHbKvf.js → validation-error-CYg2kJEw.js} +4 -1
- package/dist/{validation-error-DHUrAkku.d.ts → validation-error-YGg2mXyH.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-BaAKx7t6.js → verify-DZeqoWu5.js} +417 -489
- package/dist/version-DMQ0dnN5.js +48 -0
- package/dist/version-DizhmD72.js +1 -0
- package/dist/{views-DTIIO-oQ.js → views-CD8wuL4Z.js} +19 -6
- package/dist/vocabulary-DEJ5j4mR.d.ts +70 -0
- package/dist/vue/index.d.ts +71 -21
- package/dist/vue/index.js +50 -13
- package/dist/{waiter-B986w1oK.d.ts → waiter-Bu9zAlE0.d.ts} +13 -10
- package/dist/{waiter-BGUtGYoU.js → waiter-aBLM63_f.js} +1 -1
- package/dist/{watch-vea54PRw.js → watch-Cx_WciLE.js} +8 -8
- package/dist/watch-DB42U1ib.js +1 -0
- package/dist/webmcp/index.d.ts +11 -11
- package/dist/webmcp/index.js +8 -5
- package/dist/{where-scope-C9vfEphl.js → where-scope-DlCdCM_8.js} +56 -30
- package/dist/{who-can-DWBAcaCQ.js → who-can-rI7dCR9Q.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-gX61EtpB.js → wrap-B2wziJI_.js} +11 -5
- package/dist/{wrap-C5jC6sKI.d.ts → wrap-DlJE3gS_.d.ts} +8 -5
- package/package.json +25 -14
- package/schemas/catalog-v1.json +3 -0
- package/schemas/cli-result-v1.json +1 -0
- package/schemas/cloud-api-v1.json +152 -7
- package/schemas/connector-v1.json +8 -0
- package/schemas/supabase-claims-v1.json +5 -0
- package/schemas/supabase-manifest-v1.json +308 -75
- package/skills/permdock/SKILL.md +1 -0
- package/skills/permdock-agents/references/runtimes.md +3 -1
- package/skills/permdock-approvals/references/stores-and-resume.md +2 -1
- package/skills/permdock-credentials/references/tokens-keys-links.md +8 -6
- package/skills/permdock-data/references/queries-and-rls.md +6 -2
- package/skills/permdock-tenancy/SKILL.md +1 -1
- package/skills/permdock-tenancy/references/ownership-and-custom-roles.md +2 -1
- package/skills/permdock-wire/references/adapters.md +28 -22
- package/skills/permdock-wire/references/policy-options.md +1 -0
- package/dist/catalog-BoWglDPI.js +0 -1
- package/dist/collect-D7eQDffE.js +0 -1
- package/dist/config-bs_kZeYq.js +0 -162
- package/dist/denied-text-CiFQNuMV.d.ts +0 -19
- package/dist/fields-OYG_JR78.js +0 -203
- package/dist/generate-CNU1pIOo.js +0 -171
- package/dist/headers-BIjfMaoC.js +0 -8
- package/dist/headers-CIbDTUTK.d.ts +0 -7
- package/dist/index-Cp_ilKi1.d.ts +0 -91
- package/dist/index-CueFnxQc.d.ts +0 -110
- package/dist/load-BxEtwlBS.js +0 -1
- package/dist/output-files-B3IZJksC.js +0 -1
- package/dist/package-root-Dk_ETdkp.js +0 -31
- package/dist/parse-Cxq0WxrA.js +0 -53
- package/dist/parse-local-manifest-5ODwqu8b.d.ts +0 -10
- package/dist/parse-local-manifest-CVSs6J9I.js +0 -34
- package/dist/peer-C8swJ2GH.js +0 -50
- package/dist/policies-DP2nqRoF.js +0 -295
- package/dist/powersync-BkWWCS1K.js +0 -538
- package/dist/powersync-MMJ2mI2q.js +0 -1
- package/dist/problem-details-B45V5d2b.d.ts +0 -7
- package/dist/prompt-DfZLJLIn.js +0 -32
- package/dist/protected-RFGpakN9.d.ts +0 -38
- package/dist/pull-CvpINcMK.js +0 -1
- package/dist/run-DDwUaJDU.js +0 -1
- package/dist/sources-Xc4zkszI.d.ts +0 -190
- package/dist/stores-BUGNbJTt.d.ts +0 -30
- package/dist/supabase-hook-CCw5m35C.js +0 -1
- package/dist/supautils-B6HYL9eL.js +0 -91
- package/dist/text-diff-BQcUapOb.js +0 -15
- package/dist/types-B3_ooZgZ.d.ts +0 -172
- package/dist/usage-CZpSQP6L.js +0 -1
- package/dist/version-CEbQ5UeM.js +0 -18
- package/dist/version-DXkYUISx.js +0 -1
- package/dist/watch--ovlPOc0.js +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
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";
|
|
2
3
|
//#region src/conditions/ast.d.ts
|
|
3
4
|
type ConditionRef = {
|
|
4
5
|
readonly ref: string;
|
|
@@ -63,27 +64,34 @@ type RelatedCondition = {
|
|
|
63
64
|
readonly op: "related";
|
|
64
65
|
readonly resource: string;
|
|
65
66
|
readonly relation: string;
|
|
66
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* The row's own id field, or (with `parent` or `hops`) the field holding the
|
|
69
|
+
* next instance's id.
|
|
70
|
+
*/
|
|
67
71
|
readonly field: string;
|
|
68
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Parent hops walked above the first `resource` instance; `0` reads only that
|
|
74
|
+
* instance.
|
|
75
|
+
*/
|
|
69
76
|
readonly depth: number;
|
|
70
77
|
/** The row is a child of `resource`, reached through `field`. */
|
|
71
78
|
readonly parent?: true;
|
|
72
79
|
/**
|
|
73
|
-
* To-one links from the row to `resource`: `field` points at the first
|
|
74
|
-
*
|
|
75
|
-
*
|
|
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`.
|
|
76
83
|
*/
|
|
77
84
|
readonly hops?: readonly RelatedHop[];
|
|
78
85
|
/**
|
|
79
|
-
* The `resource` instances the subject holds a resource role on; replaces
|
|
80
|
-
*
|
|
86
|
+
* The `resource` instances the subject holds a resource role on; replaces the
|
|
87
|
+
* `relation` lookup (`relation` is then empty).
|
|
81
88
|
*/
|
|
82
89
|
readonly ids?: readonly string[];
|
|
83
90
|
readonly permission?: string;
|
|
84
91
|
/**
|
|
85
92
|
* The row's boolean column that keeps ancestor grants out: with `parent` or
|
|
86
|
-
* `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.
|
|
87
95
|
*/
|
|
88
96
|
readonly restricted?: string;
|
|
89
97
|
readonly restrictedAncestors?: RestrictedAncestors;
|
|
@@ -116,10 +124,10 @@ type SqlFunctionCondition = {
|
|
|
116
124
|
readonly twin: Condition;
|
|
117
125
|
};
|
|
118
126
|
/**
|
|
119
|
-
* The request's session was checked against the Auth server while the
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
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 } } }`.
|
|
123
131
|
*/
|
|
124
132
|
type LiveSessionCondition = {
|
|
125
133
|
readonly op: "liveSession";
|
|
@@ -144,14 +152,18 @@ type FieldOperator = {
|
|
|
144
152
|
readonly notIn?: unknown;
|
|
145
153
|
readonly isNull?: boolean;
|
|
146
154
|
};
|
|
147
|
-
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> = {
|
|
148
157
|
readonly and?: readonly WhereShorthand<T>[];
|
|
149
158
|
readonly or?: readonly WhereShorthand<T>[];
|
|
150
159
|
readonly not?: WhereShorthand<T>;
|
|
151
160
|
} & ("subject" extends keyof T ? { readonly [K in keyof T as Exclude<K, "subject">]?: FieldWhere<T[K]>; } & {
|
|
152
161
|
readonly subject?: SubjectWhere | FieldWhere<T["subject"]>;
|
|
153
162
|
} : { readonly [K in keyof T]?: FieldWhere<T[K]>; } & {
|
|
154
|
-
/**
|
|
163
|
+
/**
|
|
164
|
+
* Holds only when the resolver checked the session live (`liveSession:
|
|
165
|
+
* true`).
|
|
166
|
+
*/
|
|
155
167
|
readonly subject?: SubjectWhere;
|
|
156
168
|
});
|
|
157
169
|
type SubjectWhere = {
|
|
@@ -172,11 +184,20 @@ type FieldWhere<V> = V | FieldOperator | {
|
|
|
172
184
|
* credential kinds, delivery channels) stays closed.
|
|
173
185
|
*/
|
|
174
186
|
type OpenUnion<T extends string> = T | (string & NonNullable<unknown>);
|
|
175
|
-
/**
|
|
187
|
+
/**
|
|
188
|
+
* `actor.kind`: the values PermDock's adapters set, or an integrator's own; a
|
|
189
|
+
* policy delegation matches it by equality.
|
|
190
|
+
*/
|
|
176
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">;
|
|
177
|
-
/**
|
|
192
|
+
/**
|
|
193
|
+
* The adapter a decision event names: a PermDock entry, or an integrator's own
|
|
194
|
+
* adapter.
|
|
195
|
+
*/
|
|
178
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">;
|
|
179
|
-
/**
|
|
197
|
+
/**
|
|
198
|
+
* How a membership was obtained (`membership.via`); `viaOnly` and support rules
|
|
199
|
+
* match it by equality.
|
|
200
|
+
*/
|
|
180
201
|
type MembershipVia = OpenUnion<"direct" | "contact" | "credential" | "elevated" | "feed" | "link" | "share" | "support" | "support-session" | "scim">;
|
|
181
202
|
//#endregion
|
|
182
203
|
//#region src/core/subject.d.ts
|
|
@@ -209,8 +230,8 @@ type Assurance = {
|
|
|
209
230
|
/**
|
|
210
231
|
* Roles held in one scope instance (`scope` + `id`, with the id of every
|
|
211
232
|
* ancestor scope in `within`) or on one resource (`on`). Evaluation only sees
|
|
212
|
-
* the canonical form; `tenant` / `team` are accepted as input for the first
|
|
213
|
-
*
|
|
233
|
+
* the canonical form; `tenant` / `team` are accepted as input for the first and
|
|
234
|
+
* second declared scope and normalised away.
|
|
214
235
|
*/
|
|
215
236
|
type Membership = {
|
|
216
237
|
readonly scope?: string;
|
|
@@ -221,26 +242,44 @@ type Membership = {
|
|
|
221
242
|
readonly id: string;
|
|
222
243
|
};
|
|
223
244
|
readonly roles: readonly string[];
|
|
224
|
-
/**
|
|
245
|
+
/**
|
|
246
|
+
* Roles the holder may activate here but does not hold; `permdock.activate`
|
|
247
|
+
* writes an elevated membership.
|
|
248
|
+
*/
|
|
225
249
|
readonly eligible?: readonly string[];
|
|
226
250
|
readonly via?: MembershipVia;
|
|
227
251
|
readonly expiresAt?: number;
|
|
228
|
-
/**
|
|
252
|
+
/**
|
|
253
|
+
* The principal id that wrote this membership: who elevated, consented to or
|
|
254
|
+
* granted the access.
|
|
255
|
+
*/
|
|
229
256
|
readonly grantedBy?: string;
|
|
230
|
-
/**
|
|
257
|
+
/**
|
|
258
|
+
* Free text recording why the membership was written: the activation or
|
|
259
|
+
* consent justification.
|
|
260
|
+
*/
|
|
231
261
|
readonly reason?: string;
|
|
232
|
-
/**
|
|
262
|
+
/**
|
|
263
|
+
* A subgroup the holder belongs to inside the instance (`vendor-support`); a
|
|
264
|
+
* `junctionMembershipSource` group column fills it.
|
|
265
|
+
*/
|
|
233
266
|
readonly member?: {
|
|
234
267
|
readonly group: string;
|
|
235
268
|
};
|
|
236
|
-
/**
|
|
269
|
+
/**
|
|
270
|
+
* `idp`: the identity provider (SCIM) owns this membership; the application
|
|
271
|
+
* must not edit it.
|
|
272
|
+
*/
|
|
237
273
|
readonly managedBy?: "idp";
|
|
238
|
-
/**
|
|
274
|
+
/**
|
|
275
|
+
* Seats this membership holds (`dev-mode`, `editor`); `plan()` grantees match
|
|
276
|
+
* them inside the active tenant.
|
|
277
|
+
*/
|
|
239
278
|
readonly entitlements?: readonly string[];
|
|
240
279
|
/**
|
|
241
|
-
* Set when the instance or an ancestor instance is suspended: the
|
|
242
|
-
*
|
|
243
|
-
*
|
|
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.
|
|
244
283
|
*/
|
|
245
284
|
readonly keep?: readonly string[];
|
|
246
285
|
/**
|
|
@@ -256,13 +295,16 @@ type Membership = {
|
|
|
256
295
|
readonly team?: string;
|
|
257
296
|
};
|
|
258
297
|
/**
|
|
259
|
-
* One permission a custom role adds or removes. It names a declared
|
|
260
|
-
*
|
|
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.
|
|
261
300
|
*/
|
|
262
301
|
type CustomRoleGrant = {
|
|
263
302
|
readonly permission: string;
|
|
264
303
|
readonly effect?: "allow" | "deny";
|
|
265
|
-
/**
|
|
304
|
+
/**
|
|
305
|
+
* A level the permission's resource declares (`resource(…, { levels })`);
|
|
306
|
+
* allows only.
|
|
307
|
+
*/
|
|
266
308
|
readonly level?: string;
|
|
267
309
|
};
|
|
268
310
|
type CustomRoleBody = {
|
|
@@ -270,9 +312,9 @@ type CustomRoleBody = {
|
|
|
270
312
|
readonly includes?: readonly string[];
|
|
271
313
|
readonly grants?: readonly CustomRoleGrant[];
|
|
272
314
|
/**
|
|
273
|
-
* Display text and app data, carried onto the role leaf
|
|
274
|
-
*
|
|
275
|
-
*
|
|
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.
|
|
276
318
|
*/
|
|
277
319
|
readonly meta?: RoleMeta;
|
|
278
320
|
};
|
|
@@ -280,7 +322,10 @@ type CustomRoleBody = {
|
|
|
280
322
|
type TenantCustomRole = CustomRoleBody & {
|
|
281
323
|
/** The instance of the first scope that owns the role. */
|
|
282
324
|
readonly tenant: string;
|
|
283
|
-
/**
|
|
325
|
+
/**
|
|
326
|
+
* The scope the role is held at; defaults to the first scope. Its ceiling is
|
|
327
|
+
* that scope's assignable roles.
|
|
328
|
+
*/
|
|
284
329
|
readonly scope?: string;
|
|
285
330
|
/** Pins the role to one instance of `scope`. */
|
|
286
331
|
readonly id?: string;
|
|
@@ -301,14 +346,17 @@ type GlobalCustomRole = CustomRoleBody & {
|
|
|
301
346
|
readonly shared?: undefined;
|
|
302
347
|
};
|
|
303
348
|
/**
|
|
304
|
-
* A role the platform defines once for every tenant, held on memberships of
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
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.
|
|
308
353
|
*/
|
|
309
354
|
type SharedCustomRole = CustomRoleBody & {
|
|
310
355
|
readonly shared: true;
|
|
311
|
-
/**
|
|
356
|
+
/**
|
|
357
|
+
* The scope the role is held at, never `'global'`; defaults to the first
|
|
358
|
+
* scope.
|
|
359
|
+
*/
|
|
312
360
|
readonly scope?: string;
|
|
313
361
|
readonly tenant?: undefined;
|
|
314
362
|
readonly id?: undefined;
|
|
@@ -319,20 +367,28 @@ type Principal = {
|
|
|
319
367
|
readonly id: string;
|
|
320
368
|
readonly issuer?: string;
|
|
321
369
|
/**
|
|
322
|
-
* `contact`: an external person (a customer contact, a portal user). Only
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
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.
|
|
326
374
|
*/
|
|
327
375
|
readonly kind?: "user" | "service" | "workload" | "link" | "feed" | "contact";
|
|
328
376
|
readonly roles?: readonly string[];
|
|
329
377
|
readonly plans?: readonly string[];
|
|
330
378
|
readonly memberships?: readonly Membership[];
|
|
331
|
-
/**
|
|
379
|
+
/**
|
|
380
|
+
* The token dropped memberships to stay under its size budget; a
|
|
381
|
+
* `claimsFirst` source reads the rest.
|
|
382
|
+
*/
|
|
332
383
|
readonly membershipsTruncated?: boolean;
|
|
333
384
|
/** The authorization version the token was minted at (`authz_ver`). */
|
|
334
385
|
readonly authzVersion?: number;
|
|
335
386
|
readonly tenant?: string;
|
|
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
|
+
*/
|
|
391
|
+
readonly unheldTenant?: string;
|
|
336
392
|
readonly assurance?: Assurance;
|
|
337
393
|
readonly binding?: Binding;
|
|
338
394
|
readonly [key: string]: unknown;
|
|
@@ -341,9 +397,16 @@ type Actor = {
|
|
|
341
397
|
readonly id: string;
|
|
342
398
|
readonly kind: ActorKind;
|
|
343
399
|
readonly binding?: Binding;
|
|
344
|
-
/**
|
|
400
|
+
/**
|
|
401
|
+
* `true` denies every permission without `readOnlyHint` (`not-delegated`),
|
|
402
|
+
* with or without a policy delegation.
|
|
403
|
+
*/
|
|
345
404
|
readonly readOnly?: boolean;
|
|
346
|
-
/**
|
|
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
|
+
*/
|
|
347
410
|
readonly client?: string;
|
|
348
411
|
readonly [key: string]: unknown;
|
|
349
412
|
};
|
|
@@ -366,7 +429,10 @@ type Subject<TPrincipal extends Principal = Principal> = {
|
|
|
366
429
|
readonly context: Readonly<Record<string, unknown>>;
|
|
367
430
|
readonly session?: string;
|
|
368
431
|
readonly expiresAt?: number;
|
|
369
|
-
/**
|
|
432
|
+
/**
|
|
433
|
+
* The token's memberships are behind the source's authorization version:
|
|
434
|
+
* `fresh` permissions deny.
|
|
435
|
+
*/
|
|
370
436
|
readonly stale?: true;
|
|
371
437
|
/**
|
|
372
438
|
* The resolver checked the session against the Auth server for this request
|
|
@@ -377,8 +443,11 @@ type Subject<TPrincipal extends Principal = Principal> = {
|
|
|
377
443
|
};
|
|
378
444
|
//#endregion
|
|
379
445
|
//#region src/core/decision.d.ts
|
|
380
|
-
type DenialReason = "no-grant" | "condition" | "deny" | "inactive-grant" | "closure-error" | "opaque-condition" | "server-only" | "anonymous" | "not-delegated" | "no-delegation" | "agent-tool-not-delegated" | "insufficient-user-authentication" | "not-entitled" | "purpose" | "reason-required" | "actor-required" | "limit" | "limit-unavailable" | "relation-depth" | "relation-unavailable" | "validation" | "tenant-mismatch" | "no-membership" | "scope" | "expired-membership" | "stale-credentials" | "unknown-role" | "last-holder" | "max-holders" | "transfer-only" | "not-assignable-by" | "self-demotion" | "externally-managed" | "not-allowed-for-membership" | "conflicting-role" | "approval" | "stale-approval" | "pdp-denied" | "pdp-unavailable" | "pdp-invalid-response" | "undocumented" | "unsupported" | "exceeds-creator" | "credential-policy";
|
|
381
|
-
/**
|
|
446
|
+
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";
|
|
447
|
+
/**
|
|
448
|
+
* The `detail` each denial reason carries, where PermDock sets a structured
|
|
449
|
+
* one.
|
|
450
|
+
*/
|
|
382
451
|
type DenialDetails = {
|
|
383
452
|
readonly limit: LimitDetail;
|
|
384
453
|
/** The window the inactive allow applies in. */
|
|
@@ -410,18 +479,21 @@ type MatchedGrant = {
|
|
|
410
479
|
readonly check?: Grant["check"];
|
|
411
480
|
readonly approval?: "human" | ApprovalRequirement;
|
|
412
481
|
readonly provider?: string;
|
|
413
|
-
/**
|
|
482
|
+
/**
|
|
483
|
+
* The hosted policy document fingerprint and grant id, when a hosted grant
|
|
484
|
+
* matched.
|
|
485
|
+
*/
|
|
414
486
|
readonly hosted?: HostedGrantRef;
|
|
415
487
|
/** A break-glass grant overrode a matching deny. */
|
|
416
488
|
readonly breakGlass?: true;
|
|
417
489
|
};
|
|
418
490
|
/**
|
|
419
491
|
* Something the caller owes alongside a granted action. `over-limit`: a soft
|
|
420
|
-
* `limit` was past its count; `near-limit`: usage reached `alertAt`.
|
|
421
|
-
* `
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
492
|
+
* `limit` was past its count; `near-limit`: usage reached `alertAt`. `notify` /
|
|
493
|
+
* `review`: a break-glass grant's declared follow-ups. `justify`: the
|
|
494
|
+
* break-glass reason, carried so audit records why. `app`: a follow-up the
|
|
495
|
+
* application declared on the grant (`allow(p, { obligations })`); PermDock
|
|
496
|
+
* carries it and never acts on it.
|
|
425
497
|
*/
|
|
426
498
|
type Obligation = {
|
|
427
499
|
readonly kind: "over-limit" | "near-limit" | "notify" | "review";
|
|
@@ -442,8 +514,8 @@ type Quota = {
|
|
|
442
514
|
readonly resetsAt: string;
|
|
443
515
|
};
|
|
444
516
|
/**
|
|
445
|
-
* The `detail` of a `limit` denial: the grant's `count`, its `per` window
|
|
446
|
-
*
|
|
517
|
+
* The `detail` of a `limit` denial: the grant's `count`, its `per` window in
|
|
518
|
+
* seconds and when the window resets (RFC 3339).
|
|
447
519
|
*/
|
|
448
520
|
type LimitDetail = {
|
|
449
521
|
readonly count: number;
|
|
@@ -451,28 +523,32 @@ type LimitDetail = {
|
|
|
451
523
|
readonly resetsAt: string;
|
|
452
524
|
};
|
|
453
525
|
/**
|
|
454
|
-
* Why a candidate grant for the permission was passed over before its
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
*
|
|
459
|
-
*
|
|
460
|
-
*
|
|
461
|
-
* asserted purpose).
|
|
526
|
+
* Why a candidate grant for the permission was passed over before its condition
|
|
527
|
+
* ran: `via-only` (the subject holds no membership of its kind), `purpose` (no
|
|
528
|
+
* asserted purpose it lists), `field` (its `fields` do not cover the requested
|
|
529
|
+
* field), `grantee` (its `to` did not match and added no denial), `role` (a
|
|
530
|
+
* role it names is not held), `validity` (a deny outside its `validFrom` /
|
|
531
|
+
* `validUntil`; an inactive allow adds an `inactive-grant` denial instead),
|
|
532
|
+
* `break-glass-inactive` (a break-glass grant with no asserted purpose).
|
|
462
533
|
*/
|
|
463
|
-
type TraceSkipReason = "via-only" | "purpose" | "field" | "grantee" | "role" | "validity" | "break-glass-inactive";
|
|
534
|
+
type TraceSkipReason = "via-only" | "purpose" | "field" | "grantee" | "role" | "validity" | "unknown-level" | "break-glass-inactive";
|
|
464
535
|
type TraceSkip = {
|
|
465
536
|
readonly role: string | null;
|
|
466
537
|
readonly permission: string;
|
|
467
538
|
readonly effect: "allow" | "deny";
|
|
468
539
|
readonly why: TraceSkipReason;
|
|
540
|
+
/**
|
|
541
|
+
* The level a custom role names that its resource does not declare, for
|
|
542
|
+
* `unknown-level`.
|
|
543
|
+
*/
|
|
544
|
+
readonly level?: string;
|
|
469
545
|
};
|
|
470
546
|
/**
|
|
471
|
-
* What `explain` saw: how many candidate grants it examined before the
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
*
|
|
475
|
-
*
|
|
547
|
+
* What `explain` saw: how many candidate grants it examined before the outcome,
|
|
548
|
+
* which allows matched (including the ones a deny overrode), which denies
|
|
549
|
+
* matched, and which grants it passed over. `denies[0]` is the deny that
|
|
550
|
+
* produced a `deny` outcome, or the deny a break-glass grant lifted. Pure local
|
|
551
|
+
* computation; never on a decision event.
|
|
476
552
|
*/
|
|
477
553
|
type Trace = {
|
|
478
554
|
readonly evaluated: number;
|
|
@@ -499,8 +575,8 @@ type GrantedDecision = {
|
|
|
499
575
|
type DeniedDecision = {
|
|
500
576
|
readonly outcome: "denied";
|
|
501
577
|
/**
|
|
502
|
-
* The key of the permission that was checked. Absent on a denial for a
|
|
503
|
-
*
|
|
578
|
+
* The key of the permission that was checked. Absent on a denial for a check
|
|
579
|
+
* that named no declared permission.
|
|
504
580
|
*/
|
|
505
581
|
readonly permission?: string;
|
|
506
582
|
readonly denials: readonly Denial[];
|
|
@@ -547,7 +623,10 @@ type RelationGrantee = {
|
|
|
547
623
|
* to `resource`, then walk its parents only when `depth` is set.
|
|
548
624
|
*/
|
|
549
625
|
readonly through?: "parent" | readonly string[];
|
|
550
|
-
/**
|
|
626
|
+
/**
|
|
627
|
+
* Parent hops walked above the first `resource` instance; absent means
|
|
628
|
+
* `DEFAULT_RELATION_DEPTH` for `'parent'` and `0` for links.
|
|
629
|
+
*/
|
|
551
630
|
readonly depth?: number;
|
|
552
631
|
};
|
|
553
632
|
type PlanGrantee = {
|
|
@@ -596,23 +675,26 @@ type UserApprover = {
|
|
|
596
675
|
readonly id: string;
|
|
597
676
|
};
|
|
598
677
|
/**
|
|
599
|
-
* Whoever holds `permission` in the request's tenant, through any role,
|
|
600
|
-
*
|
|
601
|
-
* (`ApprovalVerdict.permissions`) that the handler computes from the
|
|
602
|
-
*
|
|
678
|
+
* Whoever holds `permission` in the request's tenant, through any role, custom
|
|
679
|
+
* roles included. Checked only through verdict facts
|
|
680
|
+
* (`ApprovalVerdict.permissions`) that the handler computes from the approver's
|
|
681
|
+
* own instance.
|
|
603
682
|
*/
|
|
604
683
|
type PermissionApprover = {
|
|
605
684
|
readonly kind: "permission";
|
|
606
685
|
readonly permission: string;
|
|
607
686
|
};
|
|
608
|
-
/**
|
|
687
|
+
/**
|
|
688
|
+
* An approver who matches at least one item; an item that is a list matches
|
|
689
|
+
* when every entry does.
|
|
690
|
+
*/
|
|
609
691
|
type AnyOfApprover = {
|
|
610
692
|
readonly kind: "any-of";
|
|
611
693
|
readonly of: readonly (Approver | readonly Approver[])[];
|
|
612
694
|
};
|
|
613
695
|
/**
|
|
614
|
-
* Who may approve: a subject-only grantee, a `relation()` the approver holds
|
|
615
|
-
*
|
|
696
|
+
* Who may approve: a subject-only grantee, a `relation()` the approver holds on
|
|
697
|
+
* the requested row (checked when the verdict is given), `user(id)`,
|
|
616
698
|
* `holder(permission)`, or `anyOf(...)`. A list (or `allOf(...)`) matches an
|
|
617
699
|
* approver who satisfies every item.
|
|
618
700
|
*/
|
|
@@ -621,7 +703,10 @@ type ApproverInput = GranteeInput | UserApprover | PermissionApprover | {
|
|
|
621
703
|
readonly kind: "any-of";
|
|
622
704
|
readonly of: readonly ApproverInput[];
|
|
623
705
|
} | readonly ApproverInput[];
|
|
624
|
-
/**
|
|
706
|
+
/**
|
|
707
|
+
* Approves when the approver holds `permission` in the request's tenant (any
|
|
708
|
+
* role, custom roles included).
|
|
709
|
+
*/
|
|
625
710
|
declare function holder(permission: Permission): PermissionApprover;
|
|
626
711
|
/** Approves when the approver matches any one of `items`. */
|
|
627
712
|
declare function anyOf(...items: readonly ApproverInput[]): {
|
|
@@ -634,29 +719,35 @@ declare function allOf(...items: readonly ApproverInput[]): readonly ApproverInp
|
|
|
634
719
|
declare function user(id: string): UserApprover;
|
|
635
720
|
//#endregion
|
|
636
721
|
//#region src/core/scopes.d.ts
|
|
637
|
-
/**
|
|
722
|
+
/**
|
|
723
|
+
* One entry of `definePolicy({ scopes })`: the row field holding the scope id,
|
|
724
|
+
* and its parent scope.
|
|
725
|
+
*/
|
|
638
726
|
type ScopeDeclaration = {
|
|
639
727
|
readonly key: string;
|
|
640
728
|
readonly within?: string;
|
|
641
729
|
};
|
|
642
730
|
type PolicyScopesInput = Readonly<Record<string, ScopeDeclaration>>;
|
|
643
731
|
/**
|
|
644
|
-
* A declared scope, in declaration order. `key` is absent only on the
|
|
645
|
-
*
|
|
732
|
+
* A declared scope, in declaration order. `key` is absent only on the implicit
|
|
733
|
+
* `tenant` / `team` pair of a policy that declares no scopes.
|
|
646
734
|
*/
|
|
647
735
|
type Scope = {
|
|
648
736
|
readonly name: string;
|
|
649
737
|
readonly key?: string;
|
|
650
738
|
readonly within?: string;
|
|
651
739
|
};
|
|
652
|
-
/**
|
|
740
|
+
/**
|
|
741
|
+
* The names `role(..., { on })`, `memberOf` and memberships may use: declared
|
|
742
|
+
* names plus the aliases.
|
|
743
|
+
*/
|
|
653
744
|
type ScopeNames<S> = [S] extends [PolicyScopesInput] ? string extends keyof S ? string : (keyof S & string) | "tenant" | "team" : string;
|
|
654
745
|
//#endregion
|
|
655
746
|
//#region src/core/wire-delegation.d.ts
|
|
656
747
|
/**
|
|
657
|
-
* A delegation as every PermDock wire form carries it: OAuth `scope`
|
|
658
|
-
*
|
|
659
|
-
*
|
|
748
|
+
* A delegation as every PermDock wire form carries it: OAuth `scope` (RFC 6749,
|
|
749
|
+
* space-separated) and RFC 9396 `authorization_details`. An empty `scope` is an
|
|
750
|
+
* empty scope list, which delegates nothing.
|
|
660
751
|
*/
|
|
661
752
|
type WireDelegation = {
|
|
662
753
|
readonly scope?: string;
|
|
@@ -667,9 +758,9 @@ type WireDelegation = {
|
|
|
667
758
|
//#region src/core/wire-denial.d.ts
|
|
668
759
|
/**
|
|
669
760
|
* A denial as it leaves the process: in a decision event, a Problem Details
|
|
670
|
-
* body, an MCP or WebMCP refusal and the decision endpoint. `detail` is a
|
|
671
|
-
*
|
|
672
|
-
*
|
|
761
|
+
* body, an MCP or WebMCP refusal and the decision endpoint. `detail` is a JSON
|
|
762
|
+
* value (a string, or `LimitDetail` on `limit`); what a closure threw and a
|
|
763
|
+
* validation error stay in process.
|
|
673
764
|
*/
|
|
674
765
|
type WireDenial = {
|
|
675
766
|
readonly role: string | null;
|
|
@@ -677,7 +768,10 @@ type WireDenial = {
|
|
|
677
768
|
readonly to?: Grantee | readonly Grantee[];
|
|
678
769
|
readonly detail?: unknown;
|
|
679
770
|
};
|
|
680
|
-
/**
|
|
771
|
+
/**
|
|
772
|
+
* A `Decision` whose denials are `WireDenial`s, as the decision endpoint sends
|
|
773
|
+
* it.
|
|
774
|
+
*/
|
|
681
775
|
type WireDecision = GrantedDecision | ApprovalRequiredDecision | (Omit<DeniedDecision, "denials"> & {
|
|
682
776
|
readonly denials: readonly WireDenial[];
|
|
683
777
|
});
|
|
@@ -701,7 +795,10 @@ type DirectoryEvent = {
|
|
|
701
795
|
readonly iss?: string;
|
|
702
796
|
};
|
|
703
797
|
readonly active?: boolean;
|
|
704
|
-
/**
|
|
798
|
+
/**
|
|
799
|
+
* The application's own data, set where the event is built; plain JSON, never
|
|
800
|
+
* read by a decision.
|
|
801
|
+
*/
|
|
705
802
|
readonly x?: AppData;
|
|
706
803
|
};
|
|
707
804
|
type MembershipEvent = {
|
|
@@ -712,7 +809,10 @@ type MembershipEvent = {
|
|
|
712
809
|
readonly principal: {
|
|
713
810
|
readonly id: string;
|
|
714
811
|
};
|
|
715
|
-
/**
|
|
812
|
+
/**
|
|
813
|
+
* A declared scope name, or the `tenant` / `team` alias; absent for a global
|
|
814
|
+
* role change.
|
|
815
|
+
*/
|
|
716
816
|
readonly scope?: string;
|
|
717
817
|
/** The scope instance; present exactly when `scope` is. */
|
|
718
818
|
readonly id?: string;
|
|
@@ -729,13 +829,16 @@ type MembershipEvent = {
|
|
|
729
829
|
readonly id: string;
|
|
730
830
|
readonly kind: string;
|
|
731
831
|
};
|
|
732
|
-
/**
|
|
832
|
+
/**
|
|
833
|
+
* The application's own data, set where the event is built; plain JSON, never
|
|
834
|
+
* read by a decision.
|
|
835
|
+
*/
|
|
733
836
|
readonly x?: AppData;
|
|
734
837
|
};
|
|
735
838
|
/**
|
|
736
839
|
* An API key's lifecycle: `created`, `rotated` and `revoked` from the
|
|
737
|
-
* application or a credential store, `used` from `subjectFromApiKey`. A
|
|
738
|
-
*
|
|
840
|
+
* application or a credential store, `used` from `subjectFromApiKey`. A `used`
|
|
841
|
+
* event carries `sample`, the fraction of uses reported.
|
|
739
842
|
*/
|
|
740
843
|
type CredentialEvent = {
|
|
741
844
|
readonly type: "credential";
|
|
@@ -757,7 +860,10 @@ type CredentialEvent = {
|
|
|
757
860
|
readonly kind: string;
|
|
758
861
|
};
|
|
759
862
|
readonly sample?: number;
|
|
760
|
-
/**
|
|
863
|
+
/**
|
|
864
|
+
* The application's own data, set where the event is built; plain JSON, never
|
|
865
|
+
* read by a decision.
|
|
866
|
+
*/
|
|
761
867
|
readonly x?: AppData;
|
|
762
868
|
};
|
|
763
869
|
/**
|
|
@@ -793,7 +899,10 @@ type AutomationEvent = {
|
|
|
793
899
|
readonly id: string;
|
|
794
900
|
readonly kind: string;
|
|
795
901
|
};
|
|
796
|
-
/**
|
|
902
|
+
/**
|
|
903
|
+
* The application's own data, set where the event is built; plain JSON, never
|
|
904
|
+
* read by a decision.
|
|
905
|
+
*/
|
|
797
906
|
readonly x?: AppData;
|
|
798
907
|
};
|
|
799
908
|
type SinkEvent = DecisionEvent | DirectoryEvent | MembershipEvent | CredentialEvent | AccessEvent | AutomationEvent | DeliveryEvent;
|
|
@@ -802,14 +911,14 @@ type DeliveryChannel = "email" | "chat" | "webhook";
|
|
|
802
911
|
/** What an email is for; only `notification` mail carries `List-Unsubscribe`. */
|
|
803
912
|
type EmailCategory = "transactional" | "notification" | "security" | "approval";
|
|
804
913
|
/**
|
|
805
|
-
* Why a delivery failed. `denied` and `unlinked` are the router's refusals of
|
|
806
|
-
*
|
|
914
|
+
* Why a delivery failed. `denied` and `unlinked` are the router's refusals of a
|
|
915
|
+
* recipient; the rest come from a transport or a provider webhook.
|
|
807
916
|
*/
|
|
808
917
|
type DeliveryFailureCause = "denied" | "unlinked" | "no-transport" | "no-message" | "invalid-recipient" | "invalid-message" | "rate-limited" | "quota-exceeded" | "unauthorized" | "unavailable" | "suppressed" | "rejected";
|
|
809
918
|
/**
|
|
810
919
|
* One recipient's delivery: `sent` when a transport accepted it, then
|
|
811
|
-
* `delivered`, `bounced` or `complained` from the provider, or `failed`.
|
|
812
|
-
*
|
|
920
|
+
* `delivered`, `bounced` or `complained` from the provider, or `failed`. It
|
|
921
|
+
* carries no address, only the principal the router checked.
|
|
813
922
|
*/
|
|
814
923
|
type DeliveryEvent = {
|
|
815
924
|
readonly type: "delivery";
|
|
@@ -822,7 +931,10 @@ type DeliveryEvent = {
|
|
|
822
931
|
readonly id: string;
|
|
823
932
|
readonly key: string;
|
|
824
933
|
};
|
|
825
|
-
/**
|
|
934
|
+
/**
|
|
935
|
+
* The checked principal, or `trusted` for an address the server loaded
|
|
936
|
+
* itself.
|
|
937
|
+
*/
|
|
826
938
|
readonly recipient?: {
|
|
827
939
|
readonly principal?: {
|
|
828
940
|
readonly id: string;
|
|
@@ -846,7 +958,10 @@ type DeliveryEvent = {
|
|
|
846
958
|
readonly retryable?: boolean;
|
|
847
959
|
/** The denial reason when `cause` is `denied`. */
|
|
848
960
|
readonly reason?: string;
|
|
849
|
-
/**
|
|
961
|
+
/**
|
|
962
|
+
* The application's own data, set where the event is built; plain JSON, never
|
|
963
|
+
* read by a decision.
|
|
964
|
+
*/
|
|
850
965
|
readonly x?: AppData;
|
|
851
966
|
};
|
|
852
967
|
/**
|
|
@@ -886,7 +1001,10 @@ type AccessEvent = {
|
|
|
886
1001
|
};
|
|
887
1002
|
/** A `SupportSession`'s permission keys. */
|
|
888
1003
|
readonly permissions?: readonly string[];
|
|
889
|
-
/**
|
|
1004
|
+
/**
|
|
1005
|
+
* The application's own data, set where the event is built; plain JSON, never
|
|
1006
|
+
* read by a decision.
|
|
1007
|
+
*/
|
|
890
1008
|
readonly x?: AppData;
|
|
891
1009
|
};
|
|
892
1010
|
type DecisionEvent = {
|
|
@@ -910,14 +1028,20 @@ type DecisionEvent = {
|
|
|
910
1028
|
readonly id: string;
|
|
911
1029
|
readonly kind: string;
|
|
912
1030
|
};
|
|
913
|
-
/**
|
|
1031
|
+
/**
|
|
1032
|
+
* OAuth `scope` and RFC 9396 `authorization_details`, as every wire form
|
|
1033
|
+
* carries a delegation.
|
|
1034
|
+
*/
|
|
914
1035
|
readonly delegation?: WireDelegation;
|
|
915
1036
|
/** The API key the subject came from. */
|
|
916
1037
|
readonly credential?: {
|
|
917
1038
|
readonly id: string;
|
|
918
1039
|
readonly kind: CredentialKind;
|
|
919
1040
|
};
|
|
920
|
-
/**
|
|
1041
|
+
/**
|
|
1042
|
+
* The support session the subject came from: the `id` its `access` events
|
|
1043
|
+
* carry as `session.id`.
|
|
1044
|
+
*/
|
|
921
1045
|
readonly supportSession?: {
|
|
922
1046
|
readonly id: string;
|
|
923
1047
|
};
|
|
@@ -941,7 +1065,10 @@ type DecisionEvent = {
|
|
|
941
1065
|
};
|
|
942
1066
|
/** What a granted decision owes, as on `GrantedDecision.obligations`. */
|
|
943
1067
|
readonly obligations?: readonly Obligation[];
|
|
944
|
-
/**
|
|
1068
|
+
/**
|
|
1069
|
+
* Purposes of use the caller asserted (`context.purpose`); present when any
|
|
1070
|
+
* was.
|
|
1071
|
+
*/
|
|
945
1072
|
readonly purpose?: readonly string[];
|
|
946
1073
|
/** The justification the caller supplied (`context.reason`); present when set. */
|
|
947
1074
|
readonly reason?: string;
|
|
@@ -952,7 +1079,10 @@ type DecisionEvent = {
|
|
|
952
1079
|
/** The call that produced the decision. */
|
|
953
1080
|
readonly call: "can" | "decide" | "assert" | "filter" | "endpoint" | "adapter" | "approval" | "simulate" | "explain";
|
|
954
1081
|
readonly adapter?: AdapterId;
|
|
955
|
-
/**
|
|
1082
|
+
/**
|
|
1083
|
+
* The model id the agent model gate decided, or the model that drove the
|
|
1084
|
+
* call.
|
|
1085
|
+
*/
|
|
956
1086
|
readonly model?: string;
|
|
957
1087
|
/** Set on an approval lifecycle event (`com.permdock.approval.<phase>`). */
|
|
958
1088
|
readonly phase?: "requested" | "resolved" | "expired" | "cancelled";
|
|
@@ -961,7 +1091,10 @@ type DecisionEvent = {
|
|
|
961
1091
|
readonly denied: number;
|
|
962
1092
|
readonly approvalRequired: number;
|
|
963
1093
|
};
|
|
964
|
-
/**
|
|
1094
|
+
/**
|
|
1095
|
+
* The application's own data, set where the event is built; plain JSON, never
|
|
1096
|
+
* read by a decision.
|
|
1097
|
+
*/
|
|
965
1098
|
readonly x?: AppData;
|
|
966
1099
|
};
|
|
967
1100
|
type AuthEvent = {
|
|
@@ -980,7 +1113,10 @@ type AuthEvent = {
|
|
|
980
1113
|
//#region src/core/snapshot-types.d.ts
|
|
981
1114
|
type Snapshot = {
|
|
982
1115
|
readonly v: 1;
|
|
983
|
-
/**
|
|
1116
|
+
/**
|
|
1117
|
+
* RFC 3339. The epoch for a snapshot built without a clock. Signed, it is the
|
|
1118
|
+
* token's `iat`.
|
|
1119
|
+
*/
|
|
984
1120
|
readonly issuedAt: string;
|
|
985
1121
|
readonly subject: {
|
|
986
1122
|
readonly principal: {
|
|
@@ -990,13 +1126,19 @@ type Snapshot = {
|
|
|
990
1126
|
readonly tenant?: string;
|
|
991
1127
|
readonly memberships?: readonly Membership[];
|
|
992
1128
|
} | null;
|
|
993
|
-
/**
|
|
1129
|
+
/**
|
|
1130
|
+
* OAuth `scope` and RFC 9396 `authorization_details`, as the token carried
|
|
1131
|
+
* them.
|
|
1132
|
+
*/
|
|
994
1133
|
readonly delegation?: WireDelegation;
|
|
995
1134
|
readonly context: Readonly<Record<string, unknown>>;
|
|
996
1135
|
};
|
|
997
1136
|
/** Roles held in the active tenant, in rank order. */
|
|
998
1137
|
readonly roles: readonly string[];
|
|
999
|
-
/**
|
|
1138
|
+
/**
|
|
1139
|
+
* The distinct `meta.audience` values of `roles`, in rank order; absent when
|
|
1140
|
+
* none has one.
|
|
1141
|
+
*/
|
|
1000
1142
|
readonly audiences?: readonly string[];
|
|
1001
1143
|
readonly grants: readonly SnapshotGrant[];
|
|
1002
1144
|
readonly tenants: readonly string[];
|
|
@@ -1008,18 +1150,24 @@ type Snapshot = {
|
|
|
1008
1150
|
readonly roles?: Readonly<Record<string, Role>>;
|
|
1009
1151
|
readonly plans?: Readonly<Record<string, Plan>>;
|
|
1010
1152
|
};
|
|
1011
|
-
/**
|
|
1153
|
+
/**
|
|
1154
|
+
* The policy's scopes in order, so a client checks the row against each
|
|
1155
|
+
* membership's instance.
|
|
1156
|
+
*/
|
|
1012
1157
|
readonly scopes?: readonly SnapshotScope[];
|
|
1013
|
-
/**
|
|
1158
|
+
/**
|
|
1159
|
+
* One entry per tenant in `tenants`: what the subject may hand out there.
|
|
1160
|
+
* Absent without tenants.
|
|
1161
|
+
*/
|
|
1014
1162
|
readonly assignable?: readonly SnapshotAssignable[];
|
|
1015
1163
|
/**
|
|
1016
|
-
* Allow grants of held roles that only a plan the subject lacks keeps
|
|
1017
|
-
*
|
|
1164
|
+
* Allow grants of held roles that only a plan the subject lacks keeps from
|
|
1165
|
+
* applying; they grant nothing and name the plan a denial asks for.
|
|
1018
1166
|
*/
|
|
1019
1167
|
readonly notEntitled?: readonly SnapshotNotEntitled[];
|
|
1020
1168
|
/**
|
|
1021
|
-
* The row id field per resource whose `id` option is not `id`, for the
|
|
1022
|
-
*
|
|
1169
|
+
* The row id field per resource whose `id` option is not `id`, for the grants
|
|
1170
|
+
* in `grants`. Absent when every one reads `id`.
|
|
1023
1171
|
*/
|
|
1024
1172
|
readonly ids?: Readonly<Record<string, string>>;
|
|
1025
1173
|
/**
|
|
@@ -1030,7 +1178,10 @@ type Snapshot = {
|
|
|
1030
1178
|
*/
|
|
1031
1179
|
readonly delegated?: readonly string[];
|
|
1032
1180
|
};
|
|
1033
|
-
/**
|
|
1181
|
+
/**
|
|
1182
|
+
* A grant the subject would hold on another plan: its permission, role and
|
|
1183
|
+
* `to`.
|
|
1184
|
+
*/
|
|
1034
1185
|
type SnapshotNotEntitled = {
|
|
1035
1186
|
readonly permission: string;
|
|
1036
1187
|
readonly role: string | null;
|
|
@@ -1041,17 +1192,29 @@ type SnapshotScope = {
|
|
|
1041
1192
|
readonly name: string;
|
|
1042
1193
|
readonly key: string;
|
|
1043
1194
|
readonly within?: string;
|
|
1044
|
-
/**
|
|
1195
|
+
/**
|
|
1196
|
+
* Resources whose rows this scope's key partitions, from their `memberOf`
|
|
1197
|
+
* relations.
|
|
1198
|
+
*/
|
|
1045
1199
|
readonly resources?: readonly string[];
|
|
1046
|
-
/**
|
|
1200
|
+
/**
|
|
1201
|
+
* Resource name to the field holding this scope's id, for a resource whose
|
|
1202
|
+
* field is not `key` (its own `id`).
|
|
1203
|
+
*/
|
|
1047
1204
|
readonly fields?: Readonly<Record<string, string>>;
|
|
1048
1205
|
};
|
|
1049
|
-
/**
|
|
1206
|
+
/**
|
|
1207
|
+
* The declared roles and the custom-role ceiling the subject may assign in one
|
|
1208
|
+
* tenant.
|
|
1209
|
+
*/
|
|
1050
1210
|
type SnapshotAssignable = {
|
|
1051
1211
|
readonly tenant: string;
|
|
1052
1212
|
readonly roles: readonly string[];
|
|
1053
1213
|
readonly permissions: readonly Permission[];
|
|
1054
|
-
/**
|
|
1214
|
+
/**
|
|
1215
|
+
* Permission key to the levels the subject may hand out; only permissions
|
|
1216
|
+
* whose resource declares levels.
|
|
1217
|
+
*/
|
|
1055
1218
|
readonly levels?: Readonly<Record<string, readonly string[]>>;
|
|
1056
1219
|
};
|
|
1057
1220
|
type SnapshotGrant = {
|
|
@@ -1069,7 +1232,10 @@ type SnapshotGrant = {
|
|
|
1069
1232
|
readonly membership?: Membership;
|
|
1070
1233
|
readonly portable?: false;
|
|
1071
1234
|
readonly fields?: readonly string[];
|
|
1072
|
-
/**
|
|
1235
|
+
/**
|
|
1236
|
+
* When the grant applies (RFC 3339, `from` inclusive, `until` exclusive);
|
|
1237
|
+
* absent means always.
|
|
1238
|
+
*/
|
|
1073
1239
|
readonly validity?: WireValidity;
|
|
1074
1240
|
/** The grant's declared `name`. */
|
|
1075
1241
|
readonly name?: string;
|
|
@@ -1093,25 +1259,144 @@ type LocalSnapshotManifest = {
|
|
|
1093
1259
|
readonly rank?: readonly string[];
|
|
1094
1260
|
/** Every declared grant, without a membership. */
|
|
1095
1261
|
readonly grants: readonly SnapshotGrant[];
|
|
1096
|
-
/**
|
|
1262
|
+
/**
|
|
1263
|
+
* Per custom-role scope (`global` for platform roles): the grants each entry
|
|
1264
|
+
* resolves to.
|
|
1265
|
+
*/
|
|
1097
1266
|
readonly custom: Readonly<Record<string, LocalCustomRoleTable>>;
|
|
1267
|
+
/**
|
|
1268
|
+
* The synced tables a device reads the user's memberships, roles and custom
|
|
1269
|
+
* roles from; `permdock powersync generate` adds it.
|
|
1270
|
+
*/
|
|
1271
|
+
readonly rows?: LocalSnapshotRows;
|
|
1272
|
+
/**
|
|
1273
|
+
* What a device needs to compute `Snapshot.assignable` for the active tenant
|
|
1274
|
+
* the way `assignableIn` does on the server.
|
|
1275
|
+
*/
|
|
1276
|
+
readonly assignable?: LocalAssignable;
|
|
1277
|
+
};
|
|
1278
|
+
/**
|
|
1279
|
+
* The hand-out rules of a policy, as a device evaluates them over its synced
|
|
1280
|
+
* memberships and custom roles.
|
|
1281
|
+
*/
|
|
1282
|
+
type LocalAssignable = {
|
|
1283
|
+
/**
|
|
1284
|
+
* Declared roles a tenant admin may hand out or compose, in rank order, with
|
|
1285
|
+
* the scope each sits on and its allow keys.
|
|
1286
|
+
*/
|
|
1287
|
+
readonly roles: readonly {
|
|
1288
|
+
readonly name: string;
|
|
1289
|
+
readonly on: string;
|
|
1290
|
+
readonly allows: readonly string[];
|
|
1291
|
+
}[];
|
|
1292
|
+
/** Declared role names and permission keys with `meta.manageRoles: true`. */
|
|
1293
|
+
readonly manage: {
|
|
1294
|
+
readonly roles: readonly string[];
|
|
1295
|
+
readonly permissions: readonly string[];
|
|
1296
|
+
};
|
|
1297
|
+
/**
|
|
1298
|
+
* Declared role name to the roles it assigns, when any role declares
|
|
1299
|
+
* `assigns`.
|
|
1300
|
+
*/
|
|
1301
|
+
readonly assigns?: Readonly<Record<string, readonly string[]>>;
|
|
1302
|
+
/** The first scope's custom-role ceiling, in declaration order. */
|
|
1303
|
+
readonly permissions: readonly Permission[];
|
|
1304
|
+
/** Permission key to its level names, in declaration order. */
|
|
1305
|
+
readonly levels?: Readonly<Record<string, readonly string[]>>;
|
|
1306
|
+
/** Index of an allow in `grants` to the levels a holder of it may hand out. */
|
|
1307
|
+
readonly grants?: Readonly<Record<string, readonly string[]>>;
|
|
1308
|
+
};
|
|
1309
|
+
/** A column of a synced table, or a value every row has. */
|
|
1310
|
+
type LocalRowValue = {
|
|
1311
|
+
readonly column: string;
|
|
1312
|
+
} | {
|
|
1313
|
+
readonly value: string;
|
|
1098
1314
|
};
|
|
1099
|
-
/**
|
|
1315
|
+
/**
|
|
1316
|
+
* A column that holds a role key or user id: the value itself, the `column` of
|
|
1317
|
+
* the synced `through` table whose `id` it references, or a value each maps to
|
|
1318
|
+
* a role key (`null` for no role).
|
|
1319
|
+
*/
|
|
1320
|
+
type LocalRowColumn = {
|
|
1321
|
+
readonly column: string;
|
|
1322
|
+
} | {
|
|
1323
|
+
readonly column: string;
|
|
1324
|
+
readonly through: {
|
|
1325
|
+
readonly table: string;
|
|
1326
|
+
readonly id: string;
|
|
1327
|
+
readonly column: string;
|
|
1328
|
+
};
|
|
1329
|
+
} | {
|
|
1330
|
+
readonly column: string;
|
|
1331
|
+
readonly map: Readonly<Record<string, string | null>>;
|
|
1332
|
+
};
|
|
1333
|
+
/** One synced membership table. Table names are the device's table names. */
|
|
1334
|
+
type LocalMembershipRows = {
|
|
1335
|
+
readonly table: string;
|
|
1336
|
+
readonly user: LocalRowColumn;
|
|
1337
|
+
readonly scope: LocalRowValue;
|
|
1338
|
+
readonly id: string;
|
|
1339
|
+
/**
|
|
1340
|
+
* The role columns (the row holds every non-null key), or the fixed roles
|
|
1341
|
+
* every row holds.
|
|
1342
|
+
*/
|
|
1343
|
+
readonly roles: readonly LocalRowColumn[] | {
|
|
1344
|
+
readonly value: readonly string[];
|
|
1345
|
+
};
|
|
1346
|
+
readonly via?: LocalRowValue;
|
|
1347
|
+
/** A row with a value in one of these columns is no membership on the device. */
|
|
1348
|
+
readonly expiresAt?: string;
|
|
1349
|
+
readonly disabledAt?: string;
|
|
1350
|
+
};
|
|
1351
|
+
type LocalSnapshotRows = {
|
|
1352
|
+
readonly memberships: readonly LocalMembershipRows[];
|
|
1353
|
+
/** The global roles table: one row per user and role. */
|
|
1354
|
+
readonly roles?: {
|
|
1355
|
+
readonly table: string;
|
|
1356
|
+
readonly user: string;
|
|
1357
|
+
/** The role columns; the row holds every non-null key. */
|
|
1358
|
+
readonly roles: readonly LocalRowColumn[];
|
|
1359
|
+
};
|
|
1360
|
+
/**
|
|
1361
|
+
* The custom-role tables (`tenant_id`, `scope`, `scope_id`, `role`, and
|
|
1362
|
+
* `permission`, `effect`, `level` or `include_role`).
|
|
1363
|
+
*/
|
|
1364
|
+
readonly customRoles?: {
|
|
1365
|
+
readonly permissions: string;
|
|
1366
|
+
readonly includes: string;
|
|
1367
|
+
};
|
|
1368
|
+
};
|
|
1369
|
+
/**
|
|
1370
|
+
* Grants a custom role entry resolves to, held by a placeholder role the client
|
|
1371
|
+
* renames.
|
|
1372
|
+
*/
|
|
1100
1373
|
type LocalCustomRoleTable = {
|
|
1101
|
-
/**
|
|
1374
|
+
/**
|
|
1375
|
+
* `{ permission }` per permission key, and `{ permission, level }` per
|
|
1376
|
+
* declared level.
|
|
1377
|
+
*/
|
|
1102
1378
|
readonly permissions: Readonly<Record<string, {
|
|
1103
1379
|
readonly all: readonly SnapshotGrant[];
|
|
1104
1380
|
readonly levels?: Readonly<Record<string, readonly SnapshotGrant[]>>;
|
|
1381
|
+
/** The levels a holder of `all` may hand out. */
|
|
1382
|
+
readonly reach?: readonly string[];
|
|
1383
|
+
/** Level to the levels a holder of `levels[level]` may hand out. */
|
|
1384
|
+
readonly levelReach?: Readonly<Record<string, readonly string[]>>;
|
|
1105
1385
|
}>>;
|
|
1106
1386
|
/** `includes: [role]` per declared role. */
|
|
1107
1387
|
readonly includes: Readonly<Record<string, readonly SnapshotGrant[]>>;
|
|
1388
|
+
/**
|
|
1389
|
+
* Declared role to permission key to the levels a holder of its included
|
|
1390
|
+
* grants may hand out.
|
|
1391
|
+
*/
|
|
1392
|
+
readonly includeReach?: Readonly<Record<string, Readonly<Record<string, readonly string[]>>>>;
|
|
1108
1393
|
};
|
|
1109
1394
|
//#endregion
|
|
1110
1395
|
//#region src/core/time.d.ts
|
|
1111
1396
|
/**
|
|
1112
|
-
* The one time rule: NumericDate (whole seconds) for JWT registered claims
|
|
1113
|
-
*
|
|
1114
|
-
*
|
|
1397
|
+
* The one time rule: NumericDate (whole seconds) for JWT registered claims and
|
|
1398
|
+
* the claims SQL reads, RFC 3339 for every other JSON field, integer seconds
|
|
1399
|
+
* for durations, and an `Instant` for every runtime `now`.
|
|
1115
1400
|
*/
|
|
1116
1401
|
/**
|
|
1117
1402
|
* The part of a `Temporal.Instant` PermDock reads. Public options take it
|
|
@@ -1124,8 +1409,8 @@ type Instant = {
|
|
|
1124
1409
|
//#endregion
|
|
1125
1410
|
//#region src/core/internals.d.ts
|
|
1126
1411
|
/**
|
|
1127
|
-
* Any instance a feature function accepts: a server `PermDock`, one built
|
|
1128
|
-
*
|
|
1412
|
+
* Any instance a feature function accepts: a server `PermDock`, one built from
|
|
1413
|
+
* a snapshot, or an adapter's wrapper such as `PdpPermDock`.
|
|
1129
1414
|
*/
|
|
1130
1415
|
type InstanceHandle = {
|
|
1131
1416
|
readonly subject: Subject;
|
|
@@ -1133,19 +1418,26 @@ type InstanceHandle = {
|
|
|
1133
1418
|
//#endregion
|
|
1134
1419
|
//#region src/core/credential.d.ts
|
|
1135
1420
|
type CredentialKind = "user" | "service" | "feed";
|
|
1136
|
-
/**
|
|
1421
|
+
/**
|
|
1422
|
+
* A feed id: lowercase, so a mail system that lowercases a local part still
|
|
1423
|
+
* matches. At most 16 characters, so `pdfeed_<id>_<secret>` fits an email local
|
|
1424
|
+
* part.
|
|
1425
|
+
*/
|
|
1137
1426
|
declare function isFeedId(value: string): boolean;
|
|
1138
|
-
/**
|
|
1427
|
+
/**
|
|
1428
|
+
* One permission (a key) a credential may use: on every instance, or only on
|
|
1429
|
+
* `ids`.
|
|
1430
|
+
*/
|
|
1139
1431
|
type CredentialPermission = {
|
|
1140
1432
|
readonly permission: string;
|
|
1141
1433
|
readonly ids?: readonly string[];
|
|
1142
1434
|
};
|
|
1143
1435
|
/**
|
|
1144
|
-
* Credential v1: what a verified API key stands for, never the secret. A
|
|
1145
|
-
*
|
|
1146
|
-
*
|
|
1147
|
-
*
|
|
1148
|
-
*
|
|
1436
|
+
* Credential v1: what a verified API key stands for, never the secret. A `user`
|
|
1437
|
+
* credential acts as its owner (`principal`) narrowed to `permissions`, and to
|
|
1438
|
+
* the memberships inside `tenant` when it names one; a `service` credential is
|
|
1439
|
+
* its own `service` principal holding `roles` in `tenant`, narrowed the same
|
|
1440
|
+
* way.
|
|
1149
1441
|
*/
|
|
1150
1442
|
type Credential = {
|
|
1151
1443
|
readonly v: 1;
|
|
@@ -1154,12 +1446,15 @@ type Credential = {
|
|
|
1154
1446
|
/** The owner of a `user` credential, or the id of the service principal. */
|
|
1155
1447
|
readonly principal: string;
|
|
1156
1448
|
/**
|
|
1157
|
-
* The instance of the first scope the key is held to. Required on a
|
|
1158
|
-
*
|
|
1159
|
-
*
|
|
1449
|
+
* The instance of the first scope the key is held to. Required on a service
|
|
1450
|
+
* credential, where its roles are held; optional on a user credential, where
|
|
1451
|
+
* it keeps only the owner's memberships inside it.
|
|
1160
1452
|
*/
|
|
1161
1453
|
readonly tenant?: string;
|
|
1162
|
-
/**
|
|
1454
|
+
/**
|
|
1455
|
+
* Service: the roles it holds in `tenant`. Feed: the resource roles it holds
|
|
1456
|
+
* on `on`.
|
|
1457
|
+
*/
|
|
1163
1458
|
readonly roles?: readonly string[];
|
|
1164
1459
|
/** Feed only: the resource instance the roles are held on. */
|
|
1165
1460
|
readonly on?: {
|
|
@@ -1229,14 +1524,20 @@ type CredentialDecision = {
|
|
|
1229
1524
|
} | {
|
|
1230
1525
|
readonly outcome: "approval-required";
|
|
1231
1526
|
readonly credential: Credential;
|
|
1232
|
-
/**
|
|
1527
|
+
/**
|
|
1528
|
+
* Bound to the credential's content and its creator; pass it as
|
|
1529
|
+
* `approved` to resume.
|
|
1530
|
+
*/
|
|
1233
1531
|
readonly token: string;
|
|
1234
1532
|
} | {
|
|
1235
1533
|
readonly outcome: "denied";
|
|
1236
1534
|
readonly denials: readonly Denial[];
|
|
1237
1535
|
};
|
|
1238
1536
|
type DecideCredentialOptions = {
|
|
1239
|
-
/**
|
|
1537
|
+
/**
|
|
1538
|
+
* Where the tenant's `credentials` policy comes from. Without it, only the
|
|
1539
|
+
* no-expiry rule applies.
|
|
1540
|
+
*/
|
|
1240
1541
|
readonly settings?: SettingsSource;
|
|
1241
1542
|
/** The `token` of an approval the application consumed for this request. */
|
|
1242
1543
|
readonly approved?: string;
|
|
@@ -1250,49 +1551,48 @@ type DecideCredentialOptions = {
|
|
|
1250
1551
|
*/
|
|
1251
1552
|
declare function credentialPolicyViolation(credential: Credential, policy: CredentialPolicy | readonly CredentialPolicy[]): CredentialPolicyViolation | undefined;
|
|
1252
1553
|
/**
|
|
1253
|
-
* Validates an untrusted credential record and returns a frozen copy with
|
|
1254
|
-
*
|
|
1255
|
-
*
|
|
1256
|
-
*
|
|
1554
|
+
* Validates an untrusted credential record and returns a frozen copy with only
|
|
1555
|
+
* the v1 fields, or `undefined`. Unknown fields are dropped; a wrong type in a
|
|
1556
|
+
* known field, a service credential without `tenant` and `roles`, or a user
|
|
1557
|
+
* credential with `roles`, rejects the whole record.
|
|
1257
1558
|
*/
|
|
1258
1559
|
declare function parseCredential(input: unknown): Credential | undefined;
|
|
1259
1560
|
/**
|
|
1260
1561
|
* The delegation a credential narrows its principal to: OAuth scopes for
|
|
1261
|
-
* permissions on every instance, one RFC 9396 entry per id otherwise. A key
|
|
1262
|
-
*
|
|
1263
|
-
*
|
|
1562
|
+
* permissions on every instance, one RFC 9396 entry per id otherwise. A key the
|
|
1563
|
+
* definitions no longer declare is dropped, so a credential whose every key is
|
|
1564
|
+
* gone delegates nothing and every check is denied.
|
|
1264
1565
|
*/
|
|
1265
1566
|
declare function credentialDelegation(credential: Credential, permissions: PermissionTree): Delegation;
|
|
1266
1567
|
/**
|
|
1267
1568
|
* Decides whether the subject of `permdock` may create the credential in
|
|
1268
|
-
* `request`. The creator must be a signed-in user or service that is not
|
|
1269
|
-
*
|
|
1270
|
-
* delegation covers. A key's tenant must be one the creator is a member of;
|
|
1271
|
-
*
|
|
1569
|
+
* `request`. The creator must be a signed-in user or service that is not itself
|
|
1570
|
+
* a link or a credential; a delegated creator hands out only what its
|
|
1571
|
+
* delegation covers. A key's tenant must be one the creator is a member of; a
|
|
1572
|
+
* service key's roles among the creator's `assignableRoles` there and its
|
|
1272
1573
|
* permissions within `assignablePermissions` there (`exceeds-creator`). The
|
|
1273
|
-
* `credentials` policy of the key's tenant (its own, or for a user key
|
|
1274
|
-
*
|
|
1574
|
+
* `credentials` policy of the key's tenant (its own, or for a user key without
|
|
1575
|
+
* one the creator's active tenant) then applies (`credential-policy`; a
|
|
1275
1576
|
* settings source that throws denies with `rule: 'unavailable'`), and
|
|
1276
|
-
* `approval` makes the result `approval-required` until `approved` carries
|
|
1277
|
-
*
|
|
1278
|
-
*
|
|
1577
|
+
* `approval` makes the result `approval-required` until `approved` carries its
|
|
1578
|
+
* token. PermDock never stores the credential; the application does, after a
|
|
1579
|
+
* `granted` result.
|
|
1279
1580
|
*/
|
|
1280
1581
|
/**
|
|
1281
1582
|
* Decides whether the subject of `permdock` may create the credential in
|
|
1282
1583
|
* `request`: the creator's own reach, the `credentials` policy of the key's
|
|
1283
|
-
* tenant (the call's `settings`, else the instance's), and `approval`.
|
|
1284
|
-
*
|
|
1285
|
-
*
|
|
1286
|
-
* `unsupported`.
|
|
1584
|
+
* tenant (the call's `settings`, else the instance's), and `approval`. PermDock
|
|
1585
|
+
* never stores the credential; the application does, after a `granted` result.
|
|
1586
|
+
* An instance built from a snapshot denies with `unsupported`.
|
|
1287
1587
|
*/
|
|
1288
1588
|
declare function decideCredential(permdock: InstanceHandle, request: CredentialRequest, options?: DecideCredentialOptions): Promise<CredentialDecision>;
|
|
1289
1589
|
//#endregion
|
|
1290
1590
|
//#region src/core/support-session.d.ts
|
|
1291
1591
|
/**
|
|
1292
|
-
* SupportSession v1: a support staff member (`actor`, kind `support`)
|
|
1293
|
-
*
|
|
1294
|
-
*
|
|
1295
|
-
*
|
|
1592
|
+
* SupportSession v1: a support staff member (`actor`, kind `support`) viewing
|
|
1593
|
+
* the app as `principal` in `tenant`, for a stated `reason`. Each request in
|
|
1594
|
+
* the session acts as `principal` with their live rights, narrowed to
|
|
1595
|
+
* `permissions`.
|
|
1296
1596
|
*/
|
|
1297
1597
|
type SupportSession = {
|
|
1298
1598
|
readonly v: 1;
|
|
@@ -1356,90 +1656,94 @@ type DecideSupportSessionOptions = {
|
|
|
1356
1656
|
readonly approval?: boolean;
|
|
1357
1657
|
/** The `token` of an approval the application consumed for this request. */
|
|
1358
1658
|
readonly approved?: string;
|
|
1359
|
-
/**
|
|
1659
|
+
/**
|
|
1660
|
+
* The principal id that approved; required with `approved` and never the
|
|
1661
|
+
* actor.
|
|
1662
|
+
*/
|
|
1360
1663
|
readonly approvedBy?: string;
|
|
1361
1664
|
/** The start time; defaults to the clock. */
|
|
1362
1665
|
readonly now?: Instant;
|
|
1363
1666
|
};
|
|
1364
1667
|
/**
|
|
1365
|
-
* Validates an untrusted support-session record and returns a frozen copy
|
|
1366
|
-
*
|
|
1668
|
+
* Validates an untrusted support-session record and returns a frozen copy with
|
|
1669
|
+
* only the v1 fields, or `undefined`.
|
|
1367
1670
|
*/
|
|
1368
1671
|
declare function parseSupportSession(input: unknown): SupportSession | undefined;
|
|
1369
1672
|
/**
|
|
1370
|
-
* Decides whether the subject of `permdock` may start the support session
|
|
1371
|
-
*
|
|
1673
|
+
* Decides whether the subject of `permdock` may start the support session in
|
|
1674
|
+
* `request`. The actor must be a signed-in person acting for themselves
|
|
1372
1675
|
* (`exceeds-creator` otherwise), give a `reason` (`reason-required`), be a
|
|
1373
|
-
* member of the tenant (`tenant-mismatch`) and be able to use every
|
|
1374
|
-
*
|
|
1375
|
-
*
|
|
1376
|
-
*
|
|
1377
|
-
*
|
|
1676
|
+
* member of the tenant (`tenant-mismatch`) and be able to use every permission
|
|
1677
|
+
* (`exceeds-creator`). Without `permissions` the session gets the actor's
|
|
1678
|
+
* read-only permissions. The tenant's `supportSessions` policy then applies,
|
|
1679
|
+
* and the result is `approval-required` until `approved` carries its token and
|
|
1680
|
+
* `approvedBy` names someone other than the actor.
|
|
1378
1681
|
*/
|
|
1379
1682
|
/**
|
|
1380
|
-
* Decides whether the subject of `permdock` may start the support session
|
|
1381
|
-
*
|
|
1382
|
-
*
|
|
1383
|
-
*
|
|
1384
|
-
*
|
|
1683
|
+
* Decides whether the subject of `permdock` may start the support session in
|
|
1684
|
+
* `request` and returns the record to sign: a stated reason, membership of the
|
|
1685
|
+
* tenant, the actor's own reach, the tenant's `supportSessions` policy and
|
|
1686
|
+
* approval by someone else. An instance built from a snapshot denies with
|
|
1687
|
+
* `unsupported`.
|
|
1385
1688
|
*/
|
|
1386
1689
|
declare function decideSupportSession(permdock: InstanceHandle, request: SupportSessionRequest, options?: DecideSupportSessionOptions): Promise<SupportSessionDecision>;
|
|
1387
1690
|
//#endregion
|
|
1388
1691
|
//#region src/core/interfaces.d.ts
|
|
1389
1692
|
type DecisionProvider = {
|
|
1390
1693
|
readonly name: string;
|
|
1391
|
-
handles(permission: Permission)
|
|
1392
|
-
decide(request: {
|
|
1694
|
+
handles: (permission: Permission) => boolean;
|
|
1695
|
+
decide: (request: {
|
|
1393
1696
|
readonly permission: Permission;
|
|
1394
1697
|
readonly data?: unknown;
|
|
1395
1698
|
readonly subject: Subject;
|
|
1396
1699
|
readonly local: Decision;
|
|
1397
|
-
})
|
|
1700
|
+
}) => Promise<Decision>;
|
|
1398
1701
|
/**
|
|
1399
1702
|
* Ids of the resources of `permission.resource` the subject may act on.
|
|
1400
1703
|
* `null` means the provider could not answer and every row is denied;
|
|
1401
1704
|
* `undefined` means it cannot list, and each row is decided on its own.
|
|
1402
1705
|
*/
|
|
1403
|
-
permitted
|
|
1706
|
+
permitted?: (request: {
|
|
1404
1707
|
readonly permission: Permission;
|
|
1405
1708
|
readonly subject: Subject;
|
|
1406
|
-
})
|
|
1709
|
+
}) => Promise<readonly string[] | null | undefined>;
|
|
1407
1710
|
};
|
|
1408
1711
|
type CustomRoleSource = {
|
|
1409
1712
|
/** Names the implementation in errors and events. */
|
|
1410
1713
|
readonly name?: string;
|
|
1411
1714
|
/**
|
|
1412
|
-
* The custom roles of one tenant. `getPermDock` passes `held`, the role
|
|
1413
|
-
*
|
|
1414
|
-
*
|
|
1715
|
+
* The custom roles of one tenant. `getPermDock` passes `held`, the role names
|
|
1716
|
+
* the subject's live memberships hold there, declared or not, so a source can
|
|
1717
|
+
* skip its read when none of them is a custom role.
|
|
1415
1718
|
*/
|
|
1416
|
-
rolesFor(tenant: string, context?: {
|
|
1719
|
+
rolesFor: (tenant: string, context?: {
|
|
1417
1720
|
readonly held: readonly string[];
|
|
1418
|
-
})
|
|
1419
|
-
assignable
|
|
1721
|
+
}) => CustomRole[] | Promise<CustomRole[]>;
|
|
1722
|
+
assignable?: (tenant: string) => string[] | Promise<string[]>;
|
|
1420
1723
|
/**
|
|
1421
|
-
* Platform custom roles (`scope: 'global'`), read once per signed-in
|
|
1422
|
-
*
|
|
1423
|
-
*
|
|
1724
|
+
* Platform custom roles (`scope: 'global'`), read once per signed-in subject,
|
|
1725
|
+
* with `held`, the global role names the subject holds. A role here with a
|
|
1726
|
+
* tenant is ignored.
|
|
1424
1727
|
*/
|
|
1425
|
-
globalRoles
|
|
1728
|
+
globalRoles?: (context?: {
|
|
1426
1729
|
readonly held: readonly string[];
|
|
1427
|
-
})
|
|
1730
|
+
}) => CustomRole[] | Promise<CustomRole[]>;
|
|
1428
1731
|
/**
|
|
1429
1732
|
* Shared custom roles (`shared: true`), defined once for every tenant and
|
|
1430
|
-
* read once per subject with a tenant membership, with `held`, the role
|
|
1431
|
-
*
|
|
1432
|
-
*
|
|
1733
|
+
* read once per subject with a tenant membership, with `held`, the role names
|
|
1734
|
+
* its live memberships hold in any tenant. A role here without `shared: true`
|
|
1735
|
+
* is ignored.
|
|
1433
1736
|
*/
|
|
1434
|
-
sharedRoles
|
|
1737
|
+
sharedRoles?: (context?: {
|
|
1435
1738
|
readonly held: readonly string[];
|
|
1436
|
-
})
|
|
1739
|
+
}) => CustomRole[] | Promise<CustomRole[]>;
|
|
1437
1740
|
};
|
|
1438
1741
|
/**
|
|
1439
|
-
* A `CustomRoleSource` built for the subject the instance serves, for an
|
|
1440
|
-
* option shared by every request: it gets the resolved subject
|
|
1441
|
-
* actor and delegation) and returns that subject's source, or
|
|
1442
|
-
* for none. A throw reads no custom roles and reports
|
|
1742
|
+
* A `CustomRoleSource` built for the subject the instance serves, for an
|
|
1743
|
+
* adapter option shared by every request: it gets the resolved subject
|
|
1744
|
+
* (principal, actor and delegation) and returns that subject's source, or
|
|
1745
|
+
* `undefined` for none. A throw reads no custom roles and reports
|
|
1746
|
+
* `source-threw`.
|
|
1443
1747
|
*/
|
|
1444
1748
|
type CustomRoleSourceFactory = (subject: Subject) => CustomRoleSource | undefined;
|
|
1445
1749
|
/** One member of a scope instance, as `MembershipSource.list` returns it. */
|
|
@@ -1452,41 +1756,65 @@ type MemberEntry = {
|
|
|
1452
1756
|
type MembershipSource = {
|
|
1453
1757
|
/** Names the implementation in errors and events. */
|
|
1454
1758
|
readonly name?: string;
|
|
1455
|
-
membershipsFor(principal: {
|
|
1759
|
+
membershipsFor: (principal: {
|
|
1456
1760
|
readonly id: string;
|
|
1457
1761
|
readonly kind?: string;
|
|
1458
1762
|
}, options: {
|
|
1459
1763
|
readonly tenant?: string;
|
|
1460
|
-
})
|
|
1461
|
-
/**
|
|
1462
|
-
|
|
1764
|
+
}) => Membership[] | Promise<Membership[]>;
|
|
1765
|
+
/**
|
|
1766
|
+
* Every membership held in one scope instance, for member lists and access
|
|
1767
|
+
* reviews.
|
|
1768
|
+
*/
|
|
1769
|
+
list?: (query: {
|
|
1463
1770
|
readonly scope: string;
|
|
1464
1771
|
readonly id: string;
|
|
1465
|
-
})
|
|
1772
|
+
}) => MemberEntry[] | Promise<MemberEntry[]>;
|
|
1466
1773
|
/**
|
|
1467
1774
|
* The principal's current authorization version, bumped on every membership
|
|
1468
|
-
* change. A token whose `authzVersion` is behind it is stale for the
|
|
1469
|
-
*
|
|
1470
|
-
*
|
|
1471
|
-
*
|
|
1775
|
+
* change. A token whose `authzVersion` is behind it is stale for the policy's
|
|
1776
|
+
* `fresh` permissions. `roles` and `memberships` are what the token claims,
|
|
1777
|
+
* so a source can read more than the version in the same call when the claims
|
|
1778
|
+
* show it will be needed.
|
|
1472
1779
|
*/
|
|
1473
|
-
version
|
|
1780
|
+
version?: (principal: {
|
|
1474
1781
|
readonly id: string;
|
|
1475
1782
|
readonly roles?: readonly string[];
|
|
1476
1783
|
readonly memberships?: readonly Membership[];
|
|
1477
|
-
})
|
|
1784
|
+
}) => number | undefined | Promise<number | undefined>;
|
|
1785
|
+
/**
|
|
1786
|
+
* The global roles the principal holds now. With `onStale: 'reread'`, a stale
|
|
1787
|
+
* token's `principal.roles` is replaced by this answer, so a revoked platform
|
|
1788
|
+
* role is lost with the memberships. A throw or rejection leaves no global
|
|
1789
|
+
* roles. Without it, a reread keeps the token's roles.
|
|
1790
|
+
*/
|
|
1791
|
+
globalRolesFor?: (principal: {
|
|
1792
|
+
readonly id: string;
|
|
1793
|
+
readonly kind?: string;
|
|
1794
|
+
}) => readonly string[] | Promise<readonly string[]>;
|
|
1478
1795
|
/**
|
|
1479
1796
|
* Keep the memberships the verified token carries and read this source only
|
|
1480
1797
|
* when the token says they were truncated (`claimsFirst`).
|
|
1481
1798
|
*/
|
|
1482
1799
|
readonly claimsFirst?: boolean;
|
|
1800
|
+
/**
|
|
1801
|
+
* What a token behind `version` gets. Only permissions the policy marks
|
|
1802
|
+
* `fresh` look at staleness: `'deny'` (the default) denies those with
|
|
1803
|
+
* `stale-credentials` and leaves every other permission on the token's
|
|
1804
|
+
* claims; `'reread'` replaces the token's memberships (and global roles, when
|
|
1805
|
+
* the source has `globalRolesFor`) with a live read for the whole subject, so
|
|
1806
|
+
* no decision keeps a revoked grant.
|
|
1807
|
+
*/
|
|
1483
1808
|
readonly onStale?: "deny" | "reread";
|
|
1484
1809
|
};
|
|
1485
1810
|
/** An object's parent chain, as `RelationSource.ancestors` returns it. */
|
|
1486
1811
|
type RelationChain = {
|
|
1487
1812
|
/** Whether the object itself is restricted: nothing above it reaches it. */
|
|
1488
1813
|
readonly restricted?: boolean;
|
|
1489
|
-
/**
|
|
1814
|
+
/**
|
|
1815
|
+
* Ancestors nearest first, at most `depth`; a restricted one ends the walk
|
|
1816
|
+
* after itself.
|
|
1817
|
+
*/
|
|
1490
1818
|
readonly ancestors: readonly {
|
|
1491
1819
|
readonly id: string;
|
|
1492
1820
|
readonly restricted?: boolean;
|
|
@@ -1500,7 +1828,10 @@ type HolderPeriod = {
|
|
|
1500
1828
|
/** Seconds since the epoch; from it on the relation no longer holds. */
|
|
1501
1829
|
readonly expiresAt?: number;
|
|
1502
1830
|
};
|
|
1503
|
-
/**
|
|
1831
|
+
/**
|
|
1832
|
+
* A group holding a relation on an object: whoever holds `relation` on the
|
|
1833
|
+
* group's instance holds it too.
|
|
1834
|
+
*/
|
|
1504
1835
|
type RelationGroup = {
|
|
1505
1836
|
readonly resource: string;
|
|
1506
1837
|
readonly id: string;
|
|
@@ -1518,10 +1849,9 @@ type RelationHolder = HolderPeriod & ({
|
|
|
1518
1849
|
readonly group: RelationGroup;
|
|
1519
1850
|
});
|
|
1520
1851
|
/**
|
|
1521
|
-
* The object graph: parent chains, links and who holds a relation on an
|
|
1522
|
-
*
|
|
1523
|
-
*
|
|
1524
|
-
* `relation-unavailable`.
|
|
1852
|
+
* The object graph: parent chains, links and who holds a relation on an object.
|
|
1853
|
+
* A source answers facts and never decides; a thrown or rejected call, or a
|
|
1854
|
+
* Promise the instance has not loaded, denies with `relation-unavailable`.
|
|
1525
1855
|
*/
|
|
1526
1856
|
type RelationSource = {
|
|
1527
1857
|
/** Names the implementation in errors and events. */
|
|
@@ -1530,31 +1860,34 @@ type RelationSource = {
|
|
|
1530
1860
|
* With `through: 'parent'`, the parent chain; with a link name, the one
|
|
1531
1861
|
* instance that link points to (`depth` is then 1).
|
|
1532
1862
|
*/
|
|
1533
|
-
ancestors(query: {
|
|
1863
|
+
ancestors: (query: {
|
|
1534
1864
|
readonly resource: string;
|
|
1535
1865
|
readonly id: string;
|
|
1536
1866
|
readonly through: string;
|
|
1537
1867
|
readonly depth: number;
|
|
1538
|
-
})
|
|
1539
|
-
related(query: {
|
|
1868
|
+
}) => RelationChain | Promise<RelationChain>;
|
|
1869
|
+
related: (query: {
|
|
1540
1870
|
readonly resource: string;
|
|
1541
1871
|
readonly id: string;
|
|
1542
1872
|
readonly relation: string;
|
|
1543
|
-
})
|
|
1544
|
-
row
|
|
1873
|
+
}) => RelationHolder[] | Promise<RelationHolder[]>;
|
|
1874
|
+
row?: (query: {
|
|
1545
1875
|
readonly resource: string;
|
|
1546
1876
|
readonly id: string;
|
|
1547
|
-
})
|
|
1877
|
+
}) => Readonly<Record<string, unknown>> | null | undefined | Promise<Readonly<Record<string, unknown>> | null | undefined>;
|
|
1548
1878
|
};
|
|
1549
|
-
/**
|
|
1879
|
+
/**
|
|
1880
|
+
* Plan and seat names a principal holds in a tenant, from billing (Stripe
|
|
1881
|
+
* Entitlements, a table).
|
|
1882
|
+
*/
|
|
1550
1883
|
type EntitlementSource = {
|
|
1551
1884
|
/** Names the implementation in errors and events. */
|
|
1552
1885
|
readonly name?: string;
|
|
1553
|
-
entitlementsFor(principal: {
|
|
1886
|
+
entitlementsFor: (principal: {
|
|
1554
1887
|
readonly id: string;
|
|
1555
1888
|
}, options: {
|
|
1556
1889
|
readonly tenant?: string;
|
|
1557
|
-
})
|
|
1890
|
+
}) => string[] | Promise<string[]>;
|
|
1558
1891
|
};
|
|
1559
1892
|
type JwtClaims = {
|
|
1560
1893
|
readonly iss?: string;
|
|
@@ -1583,29 +1916,32 @@ type VerificationFailure = {
|
|
|
1583
1916
|
type TokenVerifier<TClaims extends JwtClaims = JwtClaims> = {
|
|
1584
1917
|
/** Names the implementation in errors and events. */
|
|
1585
1918
|
readonly name?: string;
|
|
1586
|
-
verify(token: string, expectations: {
|
|
1919
|
+
verify: (token: string, expectations: {
|
|
1587
1920
|
readonly typ?: string | readonly string[];
|
|
1588
1921
|
readonly audience?: string | readonly string[];
|
|
1589
1922
|
readonly issuer?: string;
|
|
1590
1923
|
readonly clockTolerance?: number;
|
|
1591
|
-
})
|
|
1924
|
+
}) => Promise<VerifiedToken<TClaims> | VerificationFailure>;
|
|
1592
1925
|
};
|
|
1593
1926
|
type TokenSigner = {
|
|
1594
1927
|
/** Names the implementation in errors and events. */
|
|
1595
1928
|
readonly name?: string;
|
|
1596
|
-
sign(payload: Readonly<Record<string, unknown>>, options: {
|
|
1929
|
+
sign: (payload: Readonly<Record<string, unknown>>, options: {
|
|
1597
1930
|
readonly typ: "vnd.permdock.snapshot+jwt" | "vnd.permdock.approval+jwt" | "vnd.permdock.policy+jwt" | "vnd.permdock.capability+jwt" | "vnd.permdock.run+jwt" | "vnd.permdock.support-session+jwt" | "vnd.permdock.evidence+jwt" | "at+jwt" | "secevent+jwt";
|
|
1598
1931
|
/** `aud`; a signer with no default audience refuses to sign without one. */
|
|
1599
1932
|
readonly audience?: string | readonly string[];
|
|
1600
1933
|
/** `exp`, a NumericDate; one hour after `iat` when absent. */
|
|
1601
1934
|
readonly expiresAt?: number;
|
|
1602
|
-
/**
|
|
1935
|
+
/**
|
|
1936
|
+
* `iat`, a NumericDate: the artefact's issue time. The signer's clock
|
|
1937
|
+
* when absent.
|
|
1938
|
+
*/
|
|
1603
1939
|
readonly issuedAt?: number;
|
|
1604
1940
|
/** `jti`: the artefact's id. A fresh UUID when absent. */
|
|
1605
1941
|
readonly jti?: string;
|
|
1606
|
-
})
|
|
1942
|
+
}) => Promise<string>;
|
|
1607
1943
|
readonly kid?: string;
|
|
1608
|
-
jwks
|
|
1944
|
+
jwks?: () => Promise<{
|
|
1609
1945
|
readonly keys: readonly JsonWebKeyLike[];
|
|
1610
1946
|
}>;
|
|
1611
1947
|
};
|
|
@@ -1615,8 +1951,8 @@ type SubjectResolver<TInput, TPrincipal extends Principal = Principal> = (input:
|
|
|
1615
1951
|
type SnapshotSource = {
|
|
1616
1952
|
/** Names the implementation in errors and events. */
|
|
1617
1953
|
readonly name?: string;
|
|
1618
|
-
get()
|
|
1619
|
-
subscribe
|
|
1954
|
+
get: () => Promise<Snapshot | string> | Snapshot | string;
|
|
1955
|
+
subscribe?: (listener: () => void) => () => void;
|
|
1620
1956
|
};
|
|
1621
1957
|
type WhereCompiler<TTarget, TOptions = unknown> = (condition: Condition, target: TTarget, options?: TOptions) => unknown;
|
|
1622
1958
|
type LimitConsumeInput = {
|
|
@@ -1636,31 +1972,31 @@ type LimitRemaining = {
|
|
|
1636
1972
|
type LimitStore = {
|
|
1637
1973
|
/** Names the implementation in errors and events. */
|
|
1638
1974
|
readonly name?: string;
|
|
1639
|
-
consume(input: LimitConsumeInput)
|
|
1640
|
-
remaining(input: LimitConsumeInput)
|
|
1975
|
+
consume: (input: LimitConsumeInput) => Promise<LimitRemaining> | LimitRemaining;
|
|
1976
|
+
remaining: (input: LimitConsumeInput) => LimitRemaining | undefined;
|
|
1641
1977
|
};
|
|
1642
1978
|
type DecisionSink = {
|
|
1643
1979
|
/** Names the implementation in errors and events. */
|
|
1644
1980
|
readonly name?: string;
|
|
1645
|
-
write(events: readonly SinkEvent[])
|
|
1646
|
-
flush
|
|
1981
|
+
write: (events: readonly SinkEvent[]) => Promise<void> | void;
|
|
1982
|
+
flush?: () => Promise<void>;
|
|
1647
1983
|
};
|
|
1648
1984
|
/**
|
|
1649
1985
|
* Looks up the credential an API key stands for. `null` for a key that is
|
|
1650
|
-
* malformed, unknown, revoked or whose secret does not match; never throws
|
|
1651
|
-
*
|
|
1652
|
-
*
|
|
1986
|
+
* malformed, unknown, revoked or whose secret does not match; never throws for
|
|
1987
|
+
* bad input. Verification is the application's (or `apiKeyVerifier`'s), never
|
|
1988
|
+
* core's.
|
|
1653
1989
|
*/
|
|
1654
1990
|
type CredentialVerifier = {
|
|
1655
1991
|
/** Names the implementation in errors and events. */
|
|
1656
1992
|
readonly name?: string;
|
|
1657
|
-
verify(secret: string)
|
|
1993
|
+
verify: (secret: string) => Credential | null | Promise<Credential | null>;
|
|
1658
1994
|
/**
|
|
1659
|
-
* Records a successful use at `at`, for a `lastUsedAt` column. Called
|
|
1660
|
-
*
|
|
1661
|
-
*
|
|
1995
|
+
* Records a successful use at `at`, for a `lastUsedAt` column. Called after a
|
|
1996
|
+
* key resolved and not awaited; a throw or a rejection is ignored, so it
|
|
1997
|
+
* never changes the subject.
|
|
1662
1998
|
*/
|
|
1663
|
-
touch
|
|
1999
|
+
touch?: (id: string, at: Instant) => void | Promise<void>;
|
|
1664
2000
|
};
|
|
1665
2001
|
/** What one tenant configures for itself. Every field only tightens. */
|
|
1666
2002
|
type TenantSettings = {
|
|
@@ -1670,13 +2006,13 @@ type TenantSettings = {
|
|
|
1670
2006
|
readonly supportSessions?: SupportSessionPolicy;
|
|
1671
2007
|
};
|
|
1672
2008
|
/**
|
|
1673
|
-
* Per-tenant settings, a subject input like `CustomRoleSource`: they tighten
|
|
1674
|
-
* a key may be and never grant. A throw denies.
|
|
2009
|
+
* Per-tenant settings, a subject input like `CustomRoleSource`: they tighten
|
|
2010
|
+
* what a key may be and never grant. A throw denies.
|
|
1675
2011
|
*/
|
|
1676
2012
|
type SettingsSource = {
|
|
1677
2013
|
/** Names the implementation in errors and events. */
|
|
1678
2014
|
readonly name?: string;
|
|
1679
|
-
settingsFor(tenant: string)
|
|
2015
|
+
settingsFor: (tenant: string) => TenantSettings | undefined | Promise<TenantSettings | undefined>;
|
|
1680
2016
|
};
|
|
1681
2017
|
//#endregion
|
|
1682
2018
|
//#region src/core/policy-fingerprint.d.ts
|
|
@@ -1706,13 +2042,16 @@ type ApprovalStage = {
|
|
|
1706
2042
|
readonly by: Approver | readonly Approver[];
|
|
1707
2043
|
/** Absent means 1. */
|
|
1708
2044
|
readonly quorum?: number;
|
|
1709
|
-
/**
|
|
2045
|
+
/**
|
|
2046
|
+
* After `after`, `to` may approve this stage as well as `by`; other stages
|
|
2047
|
+
* are unaffected.
|
|
2048
|
+
*/
|
|
1710
2049
|
readonly escalation?: ApprovalEscalation;
|
|
1711
2050
|
};
|
|
1712
2051
|
/**
|
|
1713
|
-
* `'any'`: `quorum` approvers from `by`. `'all'`: every stage completes, in
|
|
1714
|
-
*
|
|
1715
|
-
*
|
|
2052
|
+
* `'any'`: `quorum` approvers from `by`. `'all'`: every stage completes, in any
|
|
2053
|
+
* order. `'sequential'`: stages complete in order; an approver signs only the
|
|
2054
|
+
* first incomplete stage. An approver signs once per request.
|
|
1716
2055
|
*/
|
|
1717
2056
|
type ApprovalMode = "any" | "all" | "sequential";
|
|
1718
2057
|
type ApprovalRequirement = {
|
|
@@ -1726,15 +2065,24 @@ type ApprovalRequirement = {
|
|
|
1726
2065
|
readonly distinct?: boolean;
|
|
1727
2066
|
/** `'resource-change'` binds the approval to the row's `version` field. */
|
|
1728
2067
|
readonly staleOn?: "resource-change";
|
|
1729
|
-
/**
|
|
2068
|
+
/**
|
|
2069
|
+
* Distinct approvers a request needs before it is approved under `by`; absent
|
|
2070
|
+
* means 1.
|
|
2071
|
+
*/
|
|
1730
2072
|
readonly quorum?: number;
|
|
1731
|
-
/**
|
|
2073
|
+
/**
|
|
2074
|
+
* Seconds a request stays open; the store's default when absent, and never
|
|
2075
|
+
* longer than it.
|
|
2076
|
+
*/
|
|
1732
2077
|
readonly ttl?: number;
|
|
1733
2078
|
readonly escalation?: ApprovalEscalation;
|
|
1734
2079
|
};
|
|
1735
2080
|
type ApprovalOption = "human" | {
|
|
1736
2081
|
readonly by?: ApproverInput;
|
|
1737
|
-
/**
|
|
2082
|
+
/**
|
|
2083
|
+
* `'all'` or `'sequential'` with `stages`; absent means `'any'` with
|
|
2084
|
+
* `by`.
|
|
2085
|
+
*/
|
|
1738
2086
|
readonly mode?: ApprovalMode;
|
|
1739
2087
|
readonly stages?: readonly {
|
|
1740
2088
|
readonly by: ApproverInput;
|
|
@@ -1753,11 +2101,20 @@ type ApprovalOption = "human" | {
|
|
|
1753
2101
|
* changes, resuming denies with `stale-approval`.
|
|
1754
2102
|
*/
|
|
1755
2103
|
readonly staleOn?: "resource-change";
|
|
1756
|
-
/**
|
|
2104
|
+
/**
|
|
2105
|
+
* Distinct approvers needed (an integer of at least 1); the same approver
|
|
2106
|
+
* counts once. Absent means 1.
|
|
2107
|
+
*/
|
|
1757
2108
|
readonly quorum?: number;
|
|
1758
|
-
/**
|
|
2109
|
+
/**
|
|
2110
|
+
* Seconds the request stays open (`1800`); caps the approval store's
|
|
2111
|
+
* default.
|
|
2112
|
+
*/
|
|
1759
2113
|
readonly ttl?: number;
|
|
1760
|
-
/**
|
|
2114
|
+
/**
|
|
2115
|
+
* After `after` seconds (`14_400`), `to` may approve as well as `by`, at
|
|
2116
|
+
* any open stage; same kinds as `by`.
|
|
2117
|
+
*/
|
|
1761
2118
|
readonly escalation?: {
|
|
1762
2119
|
readonly after: number;
|
|
1763
2120
|
readonly to: ApproverInput;
|
|
@@ -1785,16 +2142,19 @@ type AssuranceRequirement = {
|
|
|
1785
2142
|
readonly amr?: readonly string[];
|
|
1786
2143
|
};
|
|
1787
2144
|
/**
|
|
1788
|
-
* Time-boxed role activation. A role with `activation` is never held
|
|
1789
|
-
*
|
|
1790
|
-
*
|
|
2145
|
+
* Time-boxed role activation. A role with `activation` is never held directly:
|
|
2146
|
+
* a membership lists it under `eligible`, and `permdock.activate` mints the
|
|
2147
|
+
* elevated membership to write.
|
|
1791
2148
|
*/
|
|
1792
2149
|
type ActivationOption = {
|
|
1793
2150
|
/** The longest an activation may last, in seconds (`14_400`). */
|
|
1794
2151
|
readonly maxDuration?: number;
|
|
1795
2152
|
/** `'required'` denies an activation without a reason. */
|
|
1796
2153
|
readonly justification?: "required" | "optional";
|
|
1797
|
-
/**
|
|
2154
|
+
/**
|
|
2155
|
+
* When set, `activate` returns `approval-required` before the membership can
|
|
2156
|
+
* be written.
|
|
2157
|
+
*/
|
|
1798
2158
|
readonly approval?: ApprovalOption;
|
|
1799
2159
|
/** How fresh the activator's authentication must be. */
|
|
1800
2160
|
readonly assurance?: AssuranceRequirement;
|
|
@@ -1842,10 +2202,16 @@ type SupportAccessOptions<S extends string = string> = {
|
|
|
1842
2202
|
readonly role: string;
|
|
1843
2203
|
/** The scope the support membership sits in; defaults to `tenant`. */
|
|
1844
2204
|
readonly on?: S;
|
|
1845
|
-
/**
|
|
2205
|
+
/**
|
|
2206
|
+
* Every decision under the support membership denies with `actor-required`
|
|
2207
|
+
* without an `act`.
|
|
2208
|
+
*/
|
|
1846
2209
|
readonly actorRequired?: boolean;
|
|
1847
2210
|
readonly consent: SupportConsent;
|
|
1848
|
-
/**
|
|
2211
|
+
/**
|
|
2212
|
+
* Permissions a support session never reaches, compiled to deny grants scoped
|
|
2213
|
+
* to `via: 'support'`.
|
|
2214
|
+
*/
|
|
1849
2215
|
readonly forbid?: readonly (Permission | PermissionTree)[];
|
|
1850
2216
|
/** The subgroup a consented membership records under `member.group`. */
|
|
1851
2217
|
readonly group?: string;
|
|
@@ -1866,38 +2232,56 @@ type GrantOptions<T = Record<string, unknown>> = {
|
|
|
1866
2232
|
readonly approval?: ApprovalOption;
|
|
1867
2233
|
readonly limit?: GrantLimit;
|
|
1868
2234
|
readonly reason?: string;
|
|
1869
|
-
readonly fields?: readonly (keyof T & string)[];
|
|
2235
|
+
readonly fields?: readonly (unknown extends T ? string : keyof T & string)[];
|
|
1870
2236
|
/**
|
|
1871
2237
|
* A stable name for the grant. On a deny, a `breakGlass` override may lift
|
|
1872
|
-
* it; on any grant, it is reported on `decision.matched.name` and on
|
|
1873
|
-
*
|
|
2238
|
+
* it; on any grant, it is reported on `decision.matched.name` and on decision
|
|
2239
|
+
* events.
|
|
1874
2240
|
*/
|
|
1875
2241
|
readonly name?: string;
|
|
1876
2242
|
readonly group?: string;
|
|
1877
|
-
/**
|
|
2243
|
+
/**
|
|
2244
|
+
* Display text and app data for the grant, reported on
|
|
2245
|
+
* `decision.matched.meta`; never read in evaluation.
|
|
2246
|
+
*/
|
|
1878
2247
|
readonly meta?: GrantMeta;
|
|
1879
2248
|
/**
|
|
1880
|
-
* Follow-ups the application owes when this allow grants: each becomes a
|
|
1881
|
-
*
|
|
2249
|
+
* Follow-ups the application owes when this allow grants: each becomes a `{
|
|
2250
|
+
* kind: 'app', name, detail? }` obligation on the decision. Allows only.
|
|
1882
2251
|
*/
|
|
1883
2252
|
readonly obligations?: readonly ObligationInput[];
|
|
1884
|
-
/**
|
|
2253
|
+
/**
|
|
2254
|
+
* Purposes of use (`context.purpose`) that make the grant apply;
|
|
2255
|
+
* non-portable.
|
|
2256
|
+
*/
|
|
1885
2257
|
readonly purpose?: readonly string[];
|
|
1886
|
-
/**
|
|
2258
|
+
/**
|
|
2259
|
+
* The grant applies from this instant on (RFC 3339 or an `Instant`); before
|
|
2260
|
+
* it an allow denies with `inactive-grant` and a deny does not apply.
|
|
2261
|
+
*/
|
|
1887
2262
|
readonly validFrom?: string | Instant;
|
|
1888
|
-
/**
|
|
2263
|
+
/**
|
|
2264
|
+
* The grant stops applying at this instant (exclusive; RFC 3339 or an
|
|
2265
|
+
* `Instant`).
|
|
2266
|
+
*/
|
|
1889
2267
|
readonly validUntil?: string | Instant;
|
|
1890
2268
|
/**
|
|
1891
|
-
* An allow on an instance action counts only on rows whose scope instance
|
|
1892
|
-
*
|
|
2269
|
+
* An allow on an instance action counts only on rows whose scope instance (or
|
|
2270
|
+
* the whole app, globally) is one where the subject also holds this
|
|
1893
2271
|
* permission through a role grant without a row condition.
|
|
1894
2272
|
*/
|
|
1895
2273
|
readonly requires?: Permission | readonly Permission[];
|
|
1896
2274
|
};
|
|
1897
|
-
/**
|
|
2275
|
+
/**
|
|
2276
|
+
* A grant's metadata. PermDock carries it to decisions, events, snapshots and
|
|
2277
|
+
* the catalog and never reads `x`.
|
|
2278
|
+
*/
|
|
1898
2279
|
type GrantMeta = {
|
|
1899
2280
|
readonly description?: string;
|
|
1900
|
-
/**
|
|
2281
|
+
/**
|
|
2282
|
+
* Data the application owns. Plain JSON, checked by `definePolicy(…, { x: {
|
|
2283
|
+
* grant } })`.
|
|
2284
|
+
*/
|
|
1901
2285
|
readonly x?: AppData;
|
|
1902
2286
|
};
|
|
1903
2287
|
/** An app obligation as declared on an allow: its name, or its name and detail. */
|
|
@@ -1907,22 +2291,25 @@ type ObligationInput = string | {
|
|
|
1907
2291
|
};
|
|
1908
2292
|
/**
|
|
1909
2293
|
* When a grant applies, in Unix seconds. `from` is inclusive, `until`
|
|
1910
|
-
* exclusive; either may be absent. Portable: `where()` drops an inactive
|
|
1911
|
-
*
|
|
2294
|
+
* exclusive; either may be absent. Portable: `where()` drops an inactive grant
|
|
2295
|
+
* at the decision clock and generated RLS compares against `now()`.
|
|
1912
2296
|
*/
|
|
1913
2297
|
type GrantValidity = {
|
|
1914
2298
|
readonly from?: number;
|
|
1915
2299
|
readonly until?: number;
|
|
1916
2300
|
};
|
|
1917
|
-
/**
|
|
2301
|
+
/**
|
|
2302
|
+
* A grant's validity in JSON (snapshots, catalogs, `inactive-grant` details):
|
|
2303
|
+
* RFC 3339 bounds.
|
|
2304
|
+
*/
|
|
1918
2305
|
type WireValidity = {
|
|
1919
2306
|
readonly from?: string;
|
|
1920
2307
|
readonly until?: string;
|
|
1921
2308
|
};
|
|
1922
2309
|
/**
|
|
1923
|
-
* The actor a policy delegation is for: an actor kind, narrowed to one id
|
|
1924
|
-
*
|
|
1925
|
-
*
|
|
2310
|
+
* The actor a policy delegation is for: an actor kind, narrowed to one id when
|
|
2311
|
+
* `id` is set, or to one named client when `client` is set (the name the
|
|
2312
|
+
* subject resolver gives a verified client id through `clients`).
|
|
1926
2313
|
*/
|
|
1927
2314
|
type DelegationTarget = {
|
|
1928
2315
|
readonly kind: ActorKind;
|
|
@@ -1938,42 +2325,66 @@ type PolicyDelegation = {
|
|
|
1938
2325
|
readonly from: Grantee | readonly Grantee[];
|
|
1939
2326
|
readonly to: DelegationTarget;
|
|
1940
2327
|
readonly permissions: readonly string[];
|
|
1941
|
-
/**
|
|
2328
|
+
/**
|
|
2329
|
+
* The keys of `permissions` whose `readOnlyHint` is true: all a `readOnly`
|
|
2330
|
+
* actor may use.
|
|
2331
|
+
*/
|
|
1942
2332
|
readonly readOnly: readonly string[];
|
|
1943
2333
|
readonly validity?: GrantValidity;
|
|
1944
2334
|
};
|
|
1945
2335
|
type DelegationInput = {
|
|
1946
|
-
/**
|
|
2336
|
+
/**
|
|
2337
|
+
* Who hands over: the same subject-only selectors as `approval.by` (a role,
|
|
2338
|
+
* `authenticated()`, a plan, `assurance()`); not `relation()`.
|
|
2339
|
+
*/
|
|
1947
2340
|
readonly from: GranteeInput;
|
|
1948
|
-
/**
|
|
2341
|
+
/**
|
|
2342
|
+
* Which actor may act: `actor('eve')`, an actor kind, `{ kind, id }` for one
|
|
2343
|
+
* agent, or `{ kind, client }` for one named OAuth client.
|
|
2344
|
+
*/
|
|
1949
2345
|
readonly to: ActorGrantee | string | DelegationTarget;
|
|
1950
2346
|
/** The leaves or subtrees the actor may use; a deny grant still applies. */
|
|
1951
2347
|
readonly permissions: readonly (Permission | PermissionTree)[];
|
|
1952
2348
|
readonly validFrom?: string | Instant;
|
|
1953
2349
|
readonly validUntil?: string | Instant;
|
|
1954
2350
|
};
|
|
1955
|
-
/**
|
|
2351
|
+
/**
|
|
2352
|
+
* A declared scope name (or the `tenant` / `team` alias), or the resource a
|
|
2353
|
+
* role is held on.
|
|
2354
|
+
*/
|
|
1956
2355
|
type RoleScope<S extends string = string> = S | Permission | PermissionTree | readonly (Permission | PermissionTree)[];
|
|
1957
2356
|
type RoleOptions<S extends string = string> = {
|
|
1958
2357
|
readonly on?: RoleScope<S>;
|
|
1959
2358
|
readonly assignable?: boolean;
|
|
1960
2359
|
/** Roles nobody may hold together with this one in the same scope instance. */
|
|
1961
2360
|
readonly exclusiveWith?: readonly string[];
|
|
1962
|
-
/**
|
|
2361
|
+
/**
|
|
2362
|
+
* Fewest holders a scope instance keeps (checked at commit); default 0. Needs
|
|
2363
|
+
* a named-scope `on`.
|
|
2364
|
+
*/
|
|
1963
2365
|
readonly min?: number;
|
|
1964
2366
|
/** Most holders a scope instance may have. Needs a named-scope `on`. */
|
|
1965
2367
|
readonly max?: number;
|
|
1966
|
-
/**
|
|
2368
|
+
/**
|
|
2369
|
+
* The holder count of a scope instance never changes: the role only moves by
|
|
2370
|
+
* transfer.
|
|
2371
|
+
*/
|
|
1967
2372
|
readonly transferOnly?: boolean;
|
|
1968
2373
|
/**
|
|
1969
|
-
* Roles a holder may assign and revoke. Once any role declares `assigns`,
|
|
1970
|
-
*
|
|
2374
|
+
* Roles a holder may assign and revoke. Once any role declares `assigns`, a
|
|
2375
|
+
* role nobody lists is assigned only by `meta.manageRoles` holders.
|
|
1971
2376
|
*/
|
|
1972
2377
|
readonly assigns?: readonly string[];
|
|
1973
|
-
/**
|
|
2378
|
+
/**
|
|
2379
|
+
* Membership kinds (`via`) that may hold the role; others hold it for
|
|
2380
|
+
* nothing.
|
|
2381
|
+
*/
|
|
1974
2382
|
readonly for?: readonly string[];
|
|
1975
2383
|
readonly meta?: RoleMeta;
|
|
1976
|
-
/**
|
|
2384
|
+
/**
|
|
2385
|
+
* Time-boxed activation: the role becomes eligible-only and `activate` mints
|
|
2386
|
+
* its membership.
|
|
2387
|
+
*/
|
|
1977
2388
|
readonly activation?: ActivationOption;
|
|
1978
2389
|
/** Reserved for restricted credentials; setting it throws until it ships. */
|
|
1979
2390
|
readonly restricted?: never;
|
|
@@ -1991,31 +2402,52 @@ type Grant = {
|
|
|
1991
2402
|
readonly check?: Condition;
|
|
1992
2403
|
readonly approval?: "human" | ApprovalRequirement;
|
|
1993
2404
|
readonly portable: boolean;
|
|
1994
|
-
/**
|
|
2405
|
+
/**
|
|
2406
|
+
* Set when `portable` is false only because the grant reads the relation
|
|
2407
|
+
* graph.
|
|
2408
|
+
*/
|
|
1995
2409
|
readonly graph?: true;
|
|
1996
2410
|
readonly closure?: ClosureGrantFn;
|
|
1997
2411
|
readonly limit?: GrantLimit;
|
|
1998
2412
|
readonly fields?: readonly string[];
|
|
1999
2413
|
readonly scope: GrantScope;
|
|
2000
|
-
/**
|
|
2414
|
+
/**
|
|
2415
|
+
* The grant's stable name: a `breakGlass` override lifts a named deny, and
|
|
2416
|
+
* `decision.matched.name` reports it.
|
|
2417
|
+
*/
|
|
2001
2418
|
readonly name?: string;
|
|
2002
2419
|
readonly group?: string;
|
|
2003
2420
|
readonly meta?: GrantMeta;
|
|
2004
2421
|
/** App obligations an allow adds to its granted decision. */
|
|
2005
2422
|
readonly obligations?: readonly AppObligation[];
|
|
2006
|
-
/**
|
|
2423
|
+
/**
|
|
2424
|
+
* Purposes of use that make the grant apply (`context.purpose`);
|
|
2425
|
+
* non-portable.
|
|
2426
|
+
*/
|
|
2007
2427
|
readonly purpose?: readonly string[];
|
|
2008
|
-
/**
|
|
2428
|
+
/**
|
|
2429
|
+
* Set on a break-glass allow: it overrides named denies and carries
|
|
2430
|
+
* obligations.
|
|
2431
|
+
*/
|
|
2009
2432
|
readonly breakGlass?: BreakGlassSpec;
|
|
2010
|
-
/**
|
|
2433
|
+
/**
|
|
2434
|
+
* The membership kind (`via`) this grant applies under; others never match
|
|
2435
|
+
* it.
|
|
2436
|
+
*/
|
|
2011
2437
|
readonly viaOnly?: MembershipVia;
|
|
2012
2438
|
/** Set only on a grant merged from a hosted policy document. */
|
|
2013
2439
|
readonly hosted?: HostedGrantRef;
|
|
2014
2440
|
/** When the grant applies; absent means always. */
|
|
2015
2441
|
readonly validity?: GrantValidity;
|
|
2016
|
-
/**
|
|
2442
|
+
/**
|
|
2443
|
+
* Set on a custom-role grant narrowed by a resource level
|
|
2444
|
+
* (`CustomRoleGrant.level`).
|
|
2445
|
+
*/
|
|
2017
2446
|
readonly level?: string;
|
|
2018
|
-
/**
|
|
2447
|
+
/**
|
|
2448
|
+
* The permission key the subject must also hold, through a role, on the row's
|
|
2449
|
+
* scope instance or globally.
|
|
2450
|
+
*/
|
|
2019
2451
|
readonly requires?: readonly string[];
|
|
2020
2452
|
};
|
|
2021
2453
|
/** Which hosted policy document and grant a merged grant came from. */
|
|
@@ -2035,13 +2467,22 @@ type RoleBinding<S extends string = string> = {
|
|
|
2035
2467
|
readonly assigns?: readonly string[];
|
|
2036
2468
|
readonly for?: readonly string[];
|
|
2037
2469
|
readonly meta?: RoleMeta;
|
|
2038
|
-
/**
|
|
2470
|
+
/**
|
|
2471
|
+
* Time-boxed activation: the role is eligible-only, and `activate` mints its
|
|
2472
|
+
* membership.
|
|
2473
|
+
*/
|
|
2039
2474
|
readonly activation?: ActivationSpec;
|
|
2040
|
-
/**
|
|
2475
|
+
/**
|
|
2476
|
+
* Support access: consent and `actorRequired` for a vendor-support
|
|
2477
|
+
* membership.
|
|
2478
|
+
*/
|
|
2041
2479
|
readonly support?: SupportSpec;
|
|
2042
2480
|
};
|
|
2043
2481
|
type ValidateMode = "boundary" | "always" | "never";
|
|
2044
|
-
/**
|
|
2482
|
+
/**
|
|
2483
|
+
* The declared scopes, in declaration order; empty when the policy declares
|
|
2484
|
+
* none.
|
|
2485
|
+
*/
|
|
2045
2486
|
type PolicyScopes = readonly Scope[];
|
|
2046
2487
|
type PolicyVocabulary = {
|
|
2047
2488
|
readonly permissions: PermissionTree;
|
|
@@ -2053,7 +2494,7 @@ type VocabularyFromInput<Input> = Input extends PolicyVocabulary ? Input : {
|
|
|
2053
2494
|
readonly roles?: RoleTree;
|
|
2054
2495
|
readonly plans?: PlanTree;
|
|
2055
2496
|
};
|
|
2056
|
-
type Policy<TUser = unknown, TPrincipal extends Principal = Principal, V extends PolicyVocabulary = PolicyVocabulary> = {
|
|
2497
|
+
type Policy<TUser = unknown, TPrincipal extends Principal = Principal, V extends PolicyVocabulary = PolicyVocabulary, S extends PolicyScopesInput = PolicyScopesInput> = {
|
|
2057
2498
|
readonly permissions: V["permissions"];
|
|
2058
2499
|
readonly roles: readonly RoleBinding[];
|
|
2059
2500
|
readonly rolesByName: ReadonlyMap<string, RoleBinding>;
|
|
@@ -2067,18 +2508,39 @@ type Policy<TUser = unknown, TPrincipal extends Principal = Principal, V extends
|
|
|
2067
2508
|
readonly onDenied?: (decision: unknown) => never | void;
|
|
2068
2509
|
readonly fingerprint: string;
|
|
2069
2510
|
readonly resources: ReadonlyMap<string, ResourceNode>;
|
|
2070
|
-
/**
|
|
2511
|
+
/**
|
|
2512
|
+
* The app data schemas `definePolicy` was given; symbol-keyed so freezing the
|
|
2513
|
+
* policy leaves the schemas alone.
|
|
2514
|
+
*/
|
|
2071
2515
|
readonly [POLICY_X]?: PolicyAppDataSchemas;
|
|
2516
|
+
readonly [POLICY_SCOPES]?: S;
|
|
2072
2517
|
readonly providers?: readonly DecisionProvider[];
|
|
2073
|
-
/**
|
|
2518
|
+
/**
|
|
2519
|
+
* Permission keys a hosted policy document may grant or deny; empty by
|
|
2520
|
+
* default.
|
|
2521
|
+
*/
|
|
2074
2522
|
readonly hostable: readonly string[];
|
|
2075
|
-
/**
|
|
2523
|
+
/**
|
|
2524
|
+
* Permission keys that deny with `stale-credentials` when the subject's token
|
|
2525
|
+
* is behind the source.
|
|
2526
|
+
*/
|
|
2076
2527
|
readonly fresh?: readonly string[];
|
|
2077
|
-
/**
|
|
2528
|
+
/**
|
|
2529
|
+
* Policy delegations in declaration order; absent or empty when the policy
|
|
2530
|
+
* declares none.
|
|
2531
|
+
*/
|
|
2078
2532
|
readonly delegations?: readonly PolicyDelegation[];
|
|
2079
|
-
/**
|
|
2533
|
+
/**
|
|
2534
|
+
* Grant levels by resource (`resource(…, { levels })`), normalised; absent
|
|
2535
|
+
* when none are declared.
|
|
2536
|
+
*/
|
|
2080
2537
|
readonly levels?: PolicyLevels;
|
|
2081
|
-
/**
|
|
2538
|
+
/** Resources declared with `orderedLevels: true`, sorted; absent when none. */
|
|
2539
|
+
readonly orderedLevels?: readonly string[];
|
|
2540
|
+
/**
|
|
2541
|
+
* Coarse OAuth scopes in declaration order; absent when the policy declares
|
|
2542
|
+
* none.
|
|
2543
|
+
*/
|
|
2082
2544
|
readonly oauthScopes?: readonly PolicyOAuthScope[];
|
|
2083
2545
|
readonly index: PolicyIndex;
|
|
2084
2546
|
};
|
|
@@ -2091,7 +2553,10 @@ type PolicyOAuthScope = {
|
|
|
2091
2553
|
readonly permissions: readonly string[];
|
|
2092
2554
|
readonly scopes: readonly string[];
|
|
2093
2555
|
};
|
|
2094
|
-
/**
|
|
2556
|
+
/**
|
|
2557
|
+
* Lookups built once per policy, so a decision does not rescan every role and
|
|
2558
|
+
* grant.
|
|
2559
|
+
*/
|
|
2095
2560
|
type PolicyIndex = {
|
|
2096
2561
|
readonly declaredRoles: ReadonlySet<string>;
|
|
2097
2562
|
readonly supports: readonly SupportSpec[];
|
|
@@ -2117,19 +2582,22 @@ type PolicyOptions<TUser, TPrincipal extends Principal, S extends PolicyScopesIn
|
|
|
2117
2582
|
readonly grants?: readonly (Omit<Grant, "role" | "scope"> | readonly Omit<Grant, "role" | "scope">[] | Grant)[];
|
|
2118
2583
|
/**
|
|
2119
2584
|
* Named scopes in order, each with the row field holding its id and an
|
|
2120
|
-
* optional parent (`within`, an earlier scope). `tenant` and `team` alias
|
|
2121
|
-
*
|
|
2585
|
+
* optional parent (`within`, an earlier scope). `tenant` and `team` alias the
|
|
2586
|
+
* first and second scope.
|
|
2122
2587
|
*/
|
|
2123
2588
|
readonly scopes?: S;
|
|
2124
|
-
/**
|
|
2589
|
+
/**
|
|
2590
|
+
* Maps the application's user to the principal PermDock decides for; `null`
|
|
2591
|
+
* is anonymous.
|
|
2592
|
+
*/
|
|
2125
2593
|
readonly subject: (user: TUser) => TPrincipal | null;
|
|
2126
2594
|
readonly context?: (user: TUser) => Readonly<Record<string, unknown>> | Promise<Readonly<Record<string, unknown>>>;
|
|
2127
2595
|
readonly validate?: ValidateMode;
|
|
2128
2596
|
readonly onDenied?: (decision: unknown) => never | void;
|
|
2129
2597
|
readonly providers?: readonly DecisionProvider[];
|
|
2130
2598
|
/**
|
|
2131
|
-
* Leaves or subtrees a hosted policy document (`PolicySource`) may touch.
|
|
2132
|
-
*
|
|
2599
|
+
* Leaves or subtrees a hosted policy document (`PolicySource`) may touch. The
|
|
2600
|
+
* default is none, so a policy without it ignores every hosted grant.
|
|
2133
2601
|
*/
|
|
2134
2602
|
readonly hostable?: readonly (Permission | PermissionTree)[];
|
|
2135
2603
|
/**
|
|
@@ -2140,8 +2608,8 @@ type PolicyOptions<TUser, TPrincipal extends Principal, S extends PolicyScopesIn
|
|
|
2140
2608
|
readonly fresh?: readonly (Permission | PermissionTree)[];
|
|
2141
2609
|
/**
|
|
2142
2610
|
* Standing delegations: holders of `from` let actors matching `to` use
|
|
2143
|
-
* `permissions` for them without a token saying so. A token delegation on
|
|
2144
|
-
*
|
|
2611
|
+
* `permissions` for them without a token saying so. A token delegation on the
|
|
2612
|
+
* call still applies as well; both must cover.
|
|
2145
2613
|
*/
|
|
2146
2614
|
readonly delegations?: readonly DelegationInput[];
|
|
2147
2615
|
/**
|
|
@@ -2172,4 +2640,4 @@ type SubjectOf<P> = {
|
|
|
2172
2640
|
readonly expiresAt?: number;
|
|
2173
2641
|
};
|
|
2174
2642
|
//#endregion
|
|
2175
|
-
export { MemberEntry as $,
|
|
2643
|
+
export { MemberEntry as $, AuthorizationDetail as $n, CredentialEvent as $t, PolicyScopes as A, assurance as An, CredentialRequest as At, ValidateMode as B, DenialReason as Bn, LocalMembershipRows as Bt, MembershipFixture as C, user as Cn, SqlFunctionArg as Cr, Credential as Ct, PolicyDelegation as D, RelationGrantee as Dn, isConditionDate as Dr, CredentialPermissionInput as Dt, PolicyAppDataSchemas as E, InheritGrantee as En, isCondition as Er, CredentialPermission as Et, RoleScope as F, AppObligation as Fn, isFeedId as Ft, CustomRoleSourceFactory as G, MatchedGrant as Gn, Snapshot as Gt, WireValidity as H, ExplainedDecision as Hn, LocalRowValue as Ht, SeparationConflict as I, ApprovalRequiredDecision as In, parseCredential as It, EntitlementSource as J, Trace as Jn, SnapshotNotEntitled as Jt, DecisionProvider as K, Obligation as Kn, SnapshotAssignable as Kt, SubjectOf as L, Decision as Ln, InstanceHandle as Lt, PrincipalOf as M, inherit as Mn, credentialDelegation as Mt, RoleBinding as N, plan as Nn, credentialPolicyViolation as Nt, PolicyOAuthScope as O, actor as On, isConditionRef as Or, CredentialPolicy as Ot, RoleOptions as P, relation as Pn, decideCredential as Pt, LimitStore as Q, Assurance as Qn, AutomationEvent as Qt, SupportAccessOptions as R, Denial as Rn, Instant as Rt, HostedGrantRef as S, holder as Sn, RestrictedAncestors as Sr, ApiKeyPrincipal as St, Policy as T, GranteeInput as Tn, hasConditionOp as Tr, CredentialKind as Tt, CredentialVerifier as U, GrantedDecision as Un, LocalSnapshotManifest as Ut, VocabularyFromInput as V, DeniedDecision as Vn, LocalRowColumn as Vt, CustomRoleSource as W, LimitDetail as Wn, LocalSnapshotRows as Wt, LimitConsumeInput as X, TraceSkipReason as Xn, AccessEvent as Xt, JwtClaims as Y, TraceSkip as Yn, SnapshotScope as Yt, LimitRemaining as Z, Actor as Zn, AuthEvent as Zt, GrantLimit as _, ApproverInput as _n, MemberOfCondition as _r, SupportSessionDecision as _t, ApprovalRequirement as a, EmailCategory as an, JsonWebKeyLike as ar, SettingsSource as at, GrantScope as b, allOf as bn, RelatedCondition as br, decideSupportSession as bt, BreakGlassOptions as c, WireDecision as cn, SharedCustomRole as cr, TenantSettings as ct, ClosureContext as d, PolicyScopesInput as dn, ActorKind as dr, TokenVerifier as dt, DecisionEvent as en, Binding as er, MembershipSource as et, ClosureGrantFn as f, Scope as fn, AdapterId as fr, VerificationFailure as ft, GrantCondition as g, Approver as gn, ConditionValue as gr, SupportSession as gt, Grant as h, AnyOfApprover as hn, ConditionRef as hr, DecideSupportSessionOptions as ht, ApprovalOption as i, DirectoryEvent as in, GnapAccess as ir, RelationSource as it, PolicyVocabulary as j, authenticated as jn, DecideCredentialOptions as jt, PolicyOptions as k, anyone as kn, isSqlFunctionField as kr, CredentialPolicyViolation as kt, BreakGlassRequirements as l, WireDenial as ln, Subject as lr, TokenFailureCause as lt, DelegationTarget as m, ScopeNames as mn, Condition as mr, WhereCompiler as mt, ApprovalEscalation as n, DeliveryEvent as nn, CustomRoleGrant as nr, RelationGroup as nt, ApprovalStage as o, MembershipEvent as on, Membership as or, SnapshotSource as ot, DelegationInput as p, ScopeDeclaration as pn, MembershipVia as pr, VerifiedToken as pt, DecisionSink as q, Quota as qn, SnapshotGrant as qt, ApprovalMode as r, DeliveryFailureCause as rn, Delegation as rr, RelationHolder as rt, AssuranceRequirement as s, SinkEvent as sn, Principal as sr, SubjectResolver as st, ActivationOption as t, DeliveryChannel as tn, CustomRole as tr, RelationChain as tt, BreakGlassSpec as u, WireDelegation as un, VerifiedClaims as ur, TokenSigner as ut, GrantMeta as v, PermissionApprover as vn, MemberOfParent as vr, SupportSessionPolicy as vt, ObligationInput as w, Grantee as wn, SqlFunctionCondition as wr, CredentialDecision as wt, GrantValidity as x, anyOf as xn, RelatedHop as xr, parseSupportSession as xt, GrantOptions as y, UserApprover as yn, OpaqueCondition as yr, SupportSessionRequest as yt, SupportConsent as z, DenialDetails as zn, LocalCustomRoleTable as zt };
|