permdock 0.3.1 → 0.4.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/dist/a2a/index.d.ts +7 -5
- package/dist/a2a/index.js +14 -21
- package/dist/ai-sdk/index.d.ts +18 -6
- package/dist/ai-sdk/index.js +8 -5
- package/dist/app-data-CV8pqqMi.js +59 -0
- package/dist/approvals/index.d.ts +2 -2
- package/dist/approvals/index.js +3 -3
- package/dist/{approvals-DbYAuNkG.js → approvals-DZL76lKW.js} +35 -19
- package/dist/{approvers-DT4AVyIg.js → approvers-CqPOLD-o.js} +1 -1
- package/dist/{arazzo-BAgw9ap6.js → arazzo-C4BcskbX.js} +6 -5
- package/dist/{arazzo-C9chp3ST.js → arazzo-CD8d0WLb.js} +2 -2
- package/dist/authzen/index.d.ts +3 -3
- package/dist/authzen/index.js +161 -23
- package/dist/better-auth/index.d.ts +2 -2
- package/dist/better-auth/index.js +6 -19
- package/dist/better-supabase/index.d.ts +112 -87
- package/dist/better-supabase/index.js +257 -156
- package/dist/{bind-C_ob3LKa.d.ts → bind-BzqG8SMb.d.ts} +16 -5
- package/dist/{bind-CuzGytRf.js → bind-kk-uyCwH.js} +14 -6
- package/dist/build-instance-DIIV9DbC.js +51 -0
- package/dist/{canonical-json-DemiK4Vp.js → canonical-json-CFKyFOke.js} +1 -3
- package/dist/{capability-2kYTMWDv.d.ts → capability-CksyCWDH.d.ts} +2 -2
- package/dist/{capability-4qPdO9gk.js → capability-txATtKV4.js} +3 -2
- package/dist/catalog/index.d.ts +1 -1
- package/dist/catalog/index.js +1 -1
- package/dist/catalog-6yWAX6Ps.js +2 -0
- package/dist/{catalog-CYj-mX2O.js → catalog-WHG4kBq7.js} +2 -2
- package/dist/{catalog-doc-DdGm82XT.js → catalog-doc-DWtg0gGR.js} +17 -10
- package/dist/{catalog-DWF5cYqB.js → catalog-tZUyOfOv.js} +4 -4
- package/dist/claude-agent/index.d.ts +4 -4
- package/dist/claude-agent/index.js +4 -5
- package/dist/clerk/index.d.ts +3 -3
- package/dist/clerk/index.js +8 -33
- package/dist/cli/bin.js +1 -1
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +3 -3
- package/dist/cloud/index.d.ts +4 -4
- package/dist/cloud/index.js +9 -15
- package/dist/{cloud-CfwZ39Rl.js → cloud-C7bSDgX4.js} +2 -2
- package/dist/{cloud-DWLXO2af.js → cloud-PeBN3IEn.js} +5 -5
- package/dist/{collect-DSTE3ml9.js → collect-2SrB7lfk.js} +6 -8
- package/dist/collect-Bw2Jdq1q.js +2 -0
- package/dist/{collect-CHB22Sx4.js → collect-CQx4hX4N.js} +3 -3
- package/dist/{commands-BeaGNj_o.js → commands-Cpip4ULx.js} +13 -13
- package/dist/{compact-y6vfu2_f.js → compact-CAf557ZB.js} +11 -1
- package/dist/compile/index.d.ts +1 -1
- package/dist/compile/index.js +1 -1
- package/dist/{compile-Ba4blROR.js → compile-CcEu2ZQ1.js} +6 -5
- package/dist/{compile-BkRyBDBw.d.ts → compile-CtTP7eur.d.ts} +2 -2
- package/dist/{config-BJiM-xAm.js → config-BIjREpyE.js} +4 -4
- package/dist/{config-ir40y8m0.js → config-DLt6BvV7.js} +2 -2
- package/dist/{config-report-CdCgbRnV.js → config-report--Xb9APJS.js} +5 -6
- package/dist/{connection-CU8MQxRi.js → connection-DUsczpB5.js} +3 -2
- package/dist/constants-DcJABbLW.js +20 -0
- package/dist/{context-Bcy85rGi.js → context-DieZVJXu.js} +16 -5
- package/dist/convex/index.d.ts +4 -4
- package/dist/convex/index.js +14 -16
- package/dist/create-BBO24vj6.js +324 -0
- package/dist/{credential-8P81ff4u.js → credential-kue0qpbm.js} +4 -4
- package/dist/deciding-columns-Sq12mEA6.js +123 -0
- package/dist/delegation-input-FTxMK3ji.js +19 -0
- package/dist/denied-text-DfRk15uw.d.ts +19 -0
- package/dist/{describe-DMYiCjJV.d.ts → describe-C3ldA9os.d.ts} +11 -2
- package/dist/{describe-B_gVZEVi.js → describe-Cgkp7eP0.js} +5 -4
- package/dist/{diff-C9RDjjhs.js → diff-Cnghh_Ip.js} +2 -2
- package/dist/{diff-2VaeChzX.js → diff-rpqoe7Ag.js} +9 -9
- package/dist/{doctor-Djh6JDEk.js → doctor-CuVJvhV_.js} +2 -2
- package/dist/doctor-owlv6ddh.js +2166 -0
- package/dist/drizzle/index.d.ts +2 -2
- package/dist/drizzle/index.js +6 -14
- package/dist/elysia/index.d.ts +4 -4
- package/dist/elysia/index.js +7 -7
- package/dist/{errors-DPdqI50v.d.ts → errors-OD_4c__H.d.ts} +2 -2
- package/dist/{errors-Cz5zn0mW.js → errors-drnfxYtm.js} +3 -3
- package/dist/{evaluations-tz6D9A2G.js → evaluations-C9YJsv3H.js} +45 -7
- package/dist/eve/index.d.ts +5 -5
- package/dist/eve/index.js +5 -5
- package/dist/express/index.d.ts +4 -4
- package/dist/express/index.js +8 -7
- package/dist/fastify/index.d.ts +15 -5
- package/dist/fastify/index.js +9 -29
- package/dist/fields-fwfXN01n.js +1016 -0
- package/dist/{files-DWUN9PzI.js → files-D_JIzUrP.js} +12 -3
- package/dist/{fixtures-ht28Cplr.js → fixtures-h2eG2OZV.js} +5 -6
- package/dist/{from-snapshot-CTLijvdm.js → from-snapshot-7REQZe0H.js} +32 -22
- package/dist/{generate-CH7ThJ14.js → generate-CNU1pIOo.js} +1 -3
- package/dist/grantee-CXY-0C87.js +254 -0
- package/dist/grantee-conditions-MQs5NIuX.js +270 -0
- package/dist/grantee-match-fxYp9Nmt.js +141 -0
- package/dist/{helpers-H_KARDVC.js → helpers-C9YmyBIa.js} +7 -6
- package/dist/hono/index.d.ts +4 -4
- package/dist/hono/index.js +8 -8
- package/dist/hosted-CBHgkzDl.js +655 -0
- package/dist/{http-SO7qGttf.js → http-BBoKefeS.js} +35 -2
- package/dist/{http-BIhmLfCc.js → http-BEbdMZ05.js} +2 -24
- package/dist/{rls-import-4lLW_pbb.js → import-BFIlhetD.js} +86 -80
- package/dist/{openapi-import-cmwetbzw.js → import-UHk1N7vH.js} +6 -7
- package/dist/{index-C8z4RjQV.d.ts → index-BwMe94Xq.d.ts} +1 -1
- package/dist/{index-0nNqHspG.d.ts → index-DgM7w96K.d.ts} +2 -2
- package/dist/{index-C7Tw7MaW.d.ts → index-Dz7didpC.d.ts} +3 -3
- package/dist/{index-BNc7Wer_.d.ts → index-UdVQgq48.d.ts} +105 -38
- package/dist/index.d.ts +15 -13
- package/dist/index.js +22 -22
- package/dist/{instance-options-jARdwfPN.d.ts → instance-options-plkrsAog.d.ts} +1 -1
- package/dist/{json-schema-BsAflUGW.js → json-schema-DBkdUuCO.js} +1 -3
- package/dist/jwt/index.d.ts +4 -4
- package/dist/jwt/index.js +13 -13
- package/dist/{kernel-_RRHmnMY.js → kernel-CB3LrIJM.js} +81 -32
- package/dist/kysely/index.d.ts +2 -2
- package/dist/kysely/index.js +6 -14
- package/dist/{live-options-H2eG8dfJ.js → live-options-BaAFCIiu.js} +16 -3
- package/dist/load-B_shHrmd.js +2 -0
- package/dist/{load-DhWEB9P1.js → load-C3_oTHyO.js} +11 -3
- package/dist/{manifest-iaoBXHKc.js → manifest-BngWKryL.js} +5 -18
- package/dist/{map-claims-Z4QZOiFF.js → map-claims-AVlBaJoa.js} +7 -16
- package/dist/{map-error-pgUWNNtG.js → map-error-BE27PYkE.js} +5 -5
- package/dist/{markers-B0hYLvMD.js → markers-CiwAOZtO.js} +6 -2
- package/dist/{may-use-DndQ5tQ-.js → may-use-BOn_dR_w.js} +4 -3
- package/dist/mcp/index.d.ts +26 -9
- package/dist/mcp/index.js +456 -446
- package/dist/{rls-migrate-CN4TlJTO.js → migrate-BwlB5-Wk.js} +75 -15
- package/dist/nest/index.d.ts +4 -4
- package/dist/nest/index.js +11 -12
- package/dist/next/index.d.ts +31 -8
- package/dist/next/index.js +29 -33
- package/dist/next/plugin.d.ts +1 -1
- package/dist/next/plugin.js +1 -1
- package/dist/node/index.d.ts +4 -4
- package/dist/node/index.js +4 -4
- package/dist/ocsf-uYFXGVw2.js +115 -0
- package/dist/openai/index.d.ts +5 -5
- package/dist/openai/index.js +4 -4
- package/dist/openapi/index.d.ts +3 -3
- package/dist/openapi/index.js +1 -1
- package/dist/{openapi-CqqEbHsL.js → openapi-BJdBmYDG.js} +19 -23
- package/dist/{openapi-BqRBvAng.js → openapi-DBzHQbov.js} +2 -5
- package/dist/{openapi-CQTsgKoB.js → openapi-DcQ1Kg40.js} +3 -3
- package/dist/orpc/index.d.ts +5 -5
- package/dist/orpc/index.js +9 -11
- package/dist/otel/index.d.ts +2 -2
- package/dist/otel/index.js +26 -23
- package/dist/output-files-CgIsvdSa.js +140 -0
- package/dist/{rls-ownership-DcYlZ09B.js → ownership-BgnbOJFT.js} +387 -379
- package/dist/{package-root-zGkxO3oN.js → package-root-DtNnpmUd.js} +3 -2
- package/dist/{parse-BuyjxhZV.js → parse-CVFQHk6c.js} +3 -3
- package/dist/{parse-local-manifest-BrMozJCo.js → parse-local-manifest-C-q02Pal.js} +2 -4
- package/dist/{parse-local-manifest-JLnaBH0S.d.ts → parse-local-manifest-DvYUR0QL.d.ts} +1 -1
- package/dist/pdp/index.d.ts +2 -2
- package/dist/pdp/index.js +8 -9
- package/dist/{permdock-CbgvLnuo.js → permdock-L26udHSk.js} +1387 -1220
- package/dist/{rls-fields-CZOMlwHl.js → permission-keys-B26jeyUv.js} +1268 -2053
- package/dist/permission-registry-BsblpB-z.js +385 -0
- package/dist/{permissions-DttnqqxC.d.ts → permission-types-Dg39z9Kv.d.ts} +59 -31
- package/dist/{permissions-RJrovw98.js → permissions-CCJ6lmxB.js} +3 -3
- package/dist/{permissions-CDgvKG5L.d.ts → permissions-COH-KRgT.d.ts} +2 -2
- package/dist/{policy-IB6yxpC3.d.ts → policy-types-sp9P1iIV.d.ts} +661 -582
- package/dist/{policy-D2W7uv19.d.ts → policy-ur0BBK_e.d.ts} +2 -2
- package/dist/{powersync-DE19b9dT.js → powersync-BFSbSElQ.js} +2 -2
- package/dist/powersync-DCDgZgfZ.js +2 -0
- package/dist/{powersync-Dv1_aWF7.js → powersync-cZe4kzhL.js} +26 -27
- package/dist/prisma/index.d.ts +1 -1
- package/dist/prisma/index.js +6 -12
- package/dist/{problem-B43ztKIm.js → problem-CnWraVhC.js} +8 -7
- package/dist/{problem-details-_AMOYz-w.js → problem-details-DECUnXAn.js} +2 -2
- package/dist/{problem-details-DX075l9V.d.ts → problem-details-rIIo8B2C.d.ts} +1 -1
- package/dist/{protected-BdnIEFkY.d.ts → protected-B3_P7xuw.d.ts} +9 -6
- package/dist/{protected-utU-SLuy.js → protected-BN7BUdY1.js} +20 -8
- package/dist/{provider-CSQd7m92.js → provider-Bi-0HNL3.js} +23 -10
- package/dist/{provider-DZY281jO.d.ts → provider-kwHC9CZD.d.ts} +1 -1
- package/dist/{provider-store-Cfbvo4DE.js → provider-store-Ctt-81Ni.js} +6 -3
- package/dist/react/index.d.ts +7 -7
- package/dist/react/index.js +5 -5
- package/dist/react/provider-client.d.ts +1 -1
- package/dist/react/provider-client.js +1 -1
- package/dist/react-native/index.d.ts +20 -11
- package/dist/react-native/index.js +33 -17
- package/dist/{refs-KYb4ntaz.js → refs-f3imMjNW.js} +1 -1
- package/dist/relation-walk-BXnlLtg2.js +186 -0
- package/dist/relations-CvmSpG67.js +163 -0
- package/dist/{replay-CYyiLiwO.d.ts → replay-COpmZUfx.d.ts} +1 -1
- package/dist/request-context-BVM7aWNs.js +71 -0
- package/dist/request-context-C2_1lchh.d.ts +5 -0
- package/dist/resource-relations-D1Un3pcz.js +243 -0
- package/dist/retire-BFcxL6un.js +240 -0
- package/dist/{rls-P-BeBx0n.js → rls-55DQTuf5.js} +14 -2
- package/dist/{rls-DiinlRML.js → rls-BEktUaqg.js} +884 -484
- package/dist/{policy-xyWg7QdR.js → role-builder-B4GbKM-i.js} +235 -541
- package/dist/{rpc-DL9Sqvb1.js → rpc-nYC3cR_u.js} +15 -5
- package/dist/{run-BWc9qqvE.js → run-DMcNW_8T.js} +3 -3
- package/dist/{runtime-CB8gQFvS.js → runtime-D_tMXnsq.js} +1 -1
- package/dist/{saas-DhpJjnBA.js → saas-DtaA4JuW.js} +9 -8
- package/dist/{openapi-schema--ARjyfQr.js → schema-Bol6gqXA.js} +3 -5
- package/dist/{schema-D3MnDMxa.js → schema-DjQBcAP9.js} +4 -2
- package/dist/scim/index.d.ts +1 -1
- package/dist/scim/index.js +1 -1
- package/dist/{scim-BFGBBAqR.js → scim-vFR1O5oG.js} +6 -12
- package/dist/{scopes-CVdPrWN-.js → scopes-tvpa34ep.js} +10 -2
- package/dist/server/index.d.ts +18 -8
- package/dist/server/index.js +8 -8
- package/dist/{server-DlZ28Oz5.js → server-ZYEHtNHS.js} +4 -4
- package/dist/{create-B1d519XK.d.ts → server-types-DdqBwZN_.d.ts} +69 -33
- package/dist/shared-1uhI-e-b.js +294 -0
- package/dist/{shared-DRu8VFVM.js → shared-JhMeOsDF.js} +1 -1
- package/dist/{sink-Bd9PSyfq.js → sink-BTtmfPnE.js} +1 -1
- package/dist/{sink-B1fZzIMf.d.ts → sink-CPN4zLfs.d.ts} +1 -1
- package/dist/{skills-Biq5uup3.js → skills-BZdRQkxs.js} +4 -3
- package/dist/{skills-C5CbhhpG.js → skills-Dle4ZoLF.js} +2 -2
- package/dist/{snapshot-Enxd0n-s.js → snapshot-Dc9CHPME.js} +116 -13
- package/dist/{snapshot-cache-D6jLelln.js → snapshot-cache-Cod40D-X.js} +1 -1
- package/dist/{snapshot-cache-B-LxUahj.d.ts → snapshot-cache-J5T7t_vD.d.ts} +1 -1
- package/dist/solid/index.d.ts +22 -22
- package/dist/solid/index.js +40 -10
- package/dist/{sources-4p0-4xQm.js → sources-B1-b-R0t.js} +25 -26
- package/dist/{sources-BdOYLw9j.d.ts → sources-Dljy06zL.d.ts} +6 -2
- package/dist/{sql-xdg5f4Fi.js → sql-t8teWOfo.js} +19 -3
- package/dist/{src-BDwEZWrZ.js → src-Bb7no-hS.js} +194 -123
- package/dist/ssf/index.d.ts +3 -3
- package/dist/ssf/index.js +58 -61
- package/dist/store-9KO4BlkB.d.ts +147 -0
- package/dist/{store-DMAWwAJV.js → store-ILkLUj_o.js} +4 -4
- package/dist/{store-options-ByhZq1jV.js → store-options-CbUHDoSe.js} +16 -7
- package/dist/{stores-BT2pSCub.js → stores-BHXdSbw9.js} +7 -3
- package/dist/stores-Cxz_80g-.d.ts +31 -0
- package/dist/{stream-DDpvynSB.js → stream-BMui98KK.js} +2 -1
- package/dist/{stream-D1RXubw2.d.ts → stream-Dwsg6WwE.d.ts} +2 -2
- package/dist/{subject-settings-BwBmCdTR.js → subject-settings-CkEwrw3W.js} +23 -5
- package/dist/supabase/index.d.ts +4 -4
- package/dist/supabase/index.js +3 -3
- package/dist/supabase/middleware.d.ts +11 -5
- package/dist/supabase/middleware.js +10 -7
- package/dist/{supabase-C0qESOa-.js → supabase-C1TWlnYt.js} +36 -52
- package/dist/{supabase-s4o9s1O1.js → supabase-Dbqr141s.js} +2 -2
- package/dist/supabase-hook-BULg7Ut_.js +2 -0
- package/dist/{supabase-hook-ntETYCQu.js → supabase-hook-Cva3ikXz.js} +730 -781
- package/dist/{supautils-u8jXTGrt.js → supautils-B6HYL9eL.js} +2 -2
- package/dist/svelte/Protected.svelte +9 -2
- package/dist/svelte/index.d.ts +6 -6
- package/dist/svelte/index.js +25 -11
- package/dist/svelte/runtime.d.ts +10 -3
- package/dist/svelte/runtime.js +4 -3
- package/dist/svelte/source.d.ts +6 -6
- package/dist/svelte/source.js +4 -4
- package/dist/{validity-uOp8UpYn.js → tenancy-DshjqY0n.js} +3 -39
- package/dist/terminal/index.d.ts +5 -5
- package/dist/terminal/index.js +18 -34
- package/dist/testing/index.d.ts +89 -77
- package/dist/testing/index.js +1276 -1262
- package/dist/testing/saas/index.d.ts +4 -4
- 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/thenable-QSmvt-vZ.js +65 -0
- package/dist/{token-CIWxJOCh.js → token-Bx9qy30p.js} +1 -1
- package/dist/tool-refusal-CQ7OEia9.js +41 -0
- package/dist/trpc/index.d.ts +5 -5
- package/dist/trpc/index.js +7 -8
- package/dist/{types-DbjRN55U.d.ts → types-7rJVLWe5.d.ts} +82 -4
- package/dist/{types-aqOHTHcp.d.ts → types-Br9IXUBG.d.ts} +1 -1
- package/dist/types-ByUo56un.d.ts +88 -0
- package/dist/{types-Cq_H8N_X.d.ts → types-C0dee0Qf.d.ts} +2 -2
- package/dist/{types-DxiCGmmd.d.ts → types-CIlTojhq.d.ts} +2 -2
- package/dist/{types-QCuYJh4q.d.ts → types-CUcFZfpU.d.ts} +1 -1
- package/dist/{types-C97IskBw.d.ts → types-CqrjB9o6.d.ts} +1 -1
- package/dist/{types-BnIEz1sU.d.ts → types-DHrmBJLH.d.ts} +24 -6
- package/dist/{types-Dnemwd77.d.ts → types-DpWfQdSh.d.ts} +5 -1
- package/dist/{types-Bvc4oWT6.d.ts → types-DvupZE0w.d.ts} +1 -1
- package/dist/unplugin/index.d.ts +1 -1
- package/dist/unplugin/index.js +1 -1
- package/dist/{usage-B0YuTQRO.js → usage-4G6t643F.js} +2 -2
- package/dist/{usage-ItS7nLcl.js → usage-CG9nOYZw.js} +7 -7
- package/dist/usage-iFLJ0-rr.js +2 -0
- package/dist/{validation-error-Ba264OaJ.d.ts → validation-error-BSSw0l_8.d.ts} +1 -1
- package/dist/{validation-error-CnjZ4t92.js → validation-error-ZfUHbKvf.js} +1 -1
- package/dist/validity-dVrUEPJt.js +62 -0
- package/dist/{verifier-BxBo6I44.js → verifier-DMr_Zmb_.js} +51 -15
- package/dist/{rls-verify-CMv9H3wV.js → verify-BztUB3GX.js} +668 -239
- package/dist/{version-BvacVTZR.js → version-BEogC-rB.js} +1 -1
- package/dist/{views-Soe7bGSC.js → views-CJsrBS1f.js} +23 -1
- package/dist/{vocabulary-DA8a8zif.d.ts → vocabulary-hhEFLFoL.d.ts} +15 -6
- package/dist/vue/index.d.ts +24 -19
- package/dist/vue/index.js +24 -8
- package/dist/watch-C8TpsAl4.js +2 -0
- package/dist/{watch-DVBJ9cBq.js → watch-zeucB7eF.js} +6 -6
- package/dist/webmcp/index.d.ts +2 -2
- package/dist/webmcp/index.js +13 -37
- package/dist/wrap-Cr93qqdP.d.ts +14 -0
- package/dist/wrap-DWsU_5Bd.js +26 -0
- package/package.json +8 -8
- package/schemas/catalog-v1.json +6 -0
- package/skills/permdock-credentials/SKILL.md +1 -1
- package/skills/permdock-credentials/references/tokens-keys-links.md +7 -2
- package/skills/permdock-data/references/queries-and-rls.md +4 -0
- package/skills/permdock-tenancy/references/ownership-and-custom-roles.md +1 -0
- package/skills/permdock-wire/SKILL.md +2 -2
- package/skills/permdock-wire/references/adapters.md +9 -1
- package/skills/permdock-wire/references/policy-options.md +10 -1
- package/dist/catalog-CRW5Mx_B.js +0 -2
- package/dist/collect-DSWOk19R.js +0 -2
- package/dist/create-CMwIl-w2.js +0 -253
- package/dist/delegation-D8pUEuce.js +0 -103
- package/dist/doctor-DvH0IQff.js +0 -1194
- package/dist/doctor-collect-CjdO0wQX.js +0 -665
- package/dist/evaluation-items-CfCCejQd.js +0 -40
- package/dist/fields-BMl1RxoX.js +0 -26
- package/dist/grantee-Cv5Sogfv.js +0 -602
- package/dist/hosted-DJQw46hn.js +0 -266
- package/dist/instance-options-Dhhcnm3y.js +0 -22
- package/dist/load-DwJUafYN.js +0 -2
- package/dist/map-AcxK9o_D.js +0 -147
- package/dist/permissions-DVoF6dMt.js +0 -662
- package/dist/powersync-CrBX8hY6.js +0 -2
- package/dist/protected-xAr24FEC.d.ts +0 -40
- package/dist/relations-cjOL01hZ.js +0 -505
- package/dist/rls-graph-CHwx0V8q.js +0 -435
- package/dist/rls-shared-Cewd_-zI.js +0 -495
- package/dist/store-jOBYpiXC.d.ts +0 -36
- package/dist/stores-C0IMQrGI.d.ts +0 -52
- package/dist/supabase-config-Bj3iDH2I.js +0 -472
- package/dist/supabase-hook-gd3s8bxB.js +0 -2
- package/dist/thenable-okc2xDsj.js +0 -10
- package/dist/types-CKNSyIf_.d.ts +0 -52
- package/dist/usage-DorAJiU_.js +0 -2
- package/dist/watch-BwxLTYMZ.js +0 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as RoleTree, i as RoleMeta, n as PlanTree, r as Role, t as Plan } from "./vocabulary-
|
|
3
|
-
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
1
|
+
import { D as AppData, O as AppDataSchema, d as Permission, f as PermissionKind, k as MetaValue, p as PermissionTree, y as ResourceNode } from "./permission-types-Dg39z9Kv.js";
|
|
2
|
+
import { a as RoleTree, i as RoleMeta, n as PlanTree, r as Role, t as Plan } from "./vocabulary-hhEFLFoL.js";
|
|
4
3
|
//#region src/conditions/ast.d.ts
|
|
5
4
|
type ConditionRef = {
|
|
6
5
|
readonly ref: string;
|
|
@@ -133,6 +132,38 @@ declare function isCondition(value: unknown): value is Condition;
|
|
|
133
132
|
declare function isSqlFunctionField(value: unknown): value is SqlFunctionField;
|
|
134
133
|
declare function hasConditionOp(condition: Condition | undefined, op: Condition["op"]): boolean;
|
|
135
134
|
//#endregion
|
|
135
|
+
//#region src/conditions/normalize.d.ts
|
|
136
|
+
type FieldOperator = {
|
|
137
|
+
readonly eq?: unknown;
|
|
138
|
+
readonly ne?: unknown;
|
|
139
|
+
readonly gt?: unknown;
|
|
140
|
+
readonly gte?: unknown;
|
|
141
|
+
readonly lt?: unknown;
|
|
142
|
+
readonly lte?: unknown;
|
|
143
|
+
readonly contains?: unknown;
|
|
144
|
+
readonly in?: unknown;
|
|
145
|
+
readonly notIn?: unknown;
|
|
146
|
+
readonly isNull?: boolean;
|
|
147
|
+
};
|
|
148
|
+
type WhereShorthand<T = Record<string, unknown>> = {
|
|
149
|
+
readonly and?: readonly WhereShorthand<T>[];
|
|
150
|
+
readonly or?: readonly WhereShorthand<T>[];
|
|
151
|
+
readonly not?: WhereShorthand<T>;
|
|
152
|
+
} & ("subject" extends keyof T ? { readonly [K in keyof T as Exclude<K, "subject">]?: FieldWhere<T[K]>; } & {
|
|
153
|
+
readonly subject?: SubjectWhere | FieldWhere<T["subject"]>;
|
|
154
|
+
} : { readonly [K in keyof T]?: FieldWhere<T[K]>; } & {
|
|
155
|
+
/** Holds only when the resolver checked the session live (`liveSession: true`). */
|
|
156
|
+
readonly subject?: SubjectWhere;
|
|
157
|
+
});
|
|
158
|
+
type SubjectWhere = {
|
|
159
|
+
readonly session: {
|
|
160
|
+
readonly live: true;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
type FieldWhere<V> = V | FieldOperator | {
|
|
164
|
+
readonly ref: string;
|
|
165
|
+
};
|
|
166
|
+
//#endregion
|
|
136
167
|
//#region src/core/subject.d.ts
|
|
137
168
|
type JsonWebKeyLike = {
|
|
138
169
|
readonly kty?: string;
|
|
@@ -197,6 +228,13 @@ type Membership = {
|
|
|
197
228
|
* Every other grant, allow or deny, ignores it, and so do role listings.
|
|
198
229
|
*/
|
|
199
230
|
readonly keep?: readonly string[];
|
|
231
|
+
/**
|
|
232
|
+
* Data the application owns about this membership (a department, a seat
|
|
233
|
+
* label). Plain JSON from a trusted membership source, checked by
|
|
234
|
+
* `definePolicy(…, { x: { membership } })`. Never read in evaluation,
|
|
235
|
+
* conditions or RLS, and never written into token claims.
|
|
236
|
+
*/
|
|
237
|
+
readonly x?: AppData;
|
|
200
238
|
/** Input only: an instance of the first scope. */
|
|
201
239
|
readonly tenant?: string;
|
|
202
240
|
/** Input only: an instance of the second scope, inside `tenant`. */
|
|
@@ -216,7 +254,12 @@ type CustomRoleBody = {
|
|
|
216
254
|
readonly name: string;
|
|
217
255
|
readonly includes?: readonly string[];
|
|
218
256
|
readonly grants?: readonly CustomRoleGrant[];
|
|
219
|
-
|
|
257
|
+
/**
|
|
258
|
+
* Display text and app data, carried onto the role leaf
|
|
259
|
+
* `assignableRoles()` returns. `x` is checked by the role tree's
|
|
260
|
+
* `defineRoles(…, { x })` schema; an invalid `x` is dropped, not the role.
|
|
261
|
+
*/
|
|
262
|
+
readonly meta?: RoleMeta;
|
|
220
263
|
};
|
|
221
264
|
/** A role a tenant defines, held on memberships inside that tenant. */
|
|
222
265
|
type TenantCustomRole = CustomRoleBody & {
|
|
@@ -296,98 +339,26 @@ type Subject<TPrincipal extends Principal = Principal> = {
|
|
|
296
339
|
readonly liveSession?: true;
|
|
297
340
|
};
|
|
298
341
|
//#endregion
|
|
299
|
-
//#region src/core/
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
readonly
|
|
342
|
+
//#region src/core/decision.d.ts
|
|
343
|
+
type DenialReason = "no-grant" | "condition" | "deny" | "inactive-grant" | "closure-error" | "opaque-condition" | "server-only" | "anonymous" | "not-delegated" | "no-delegation" | "insufficient-user-authentication" | "not-entitled" | "purpose" | "reason-required" | "actor-required" | "limit" | "limit-unavailable" | "relation-depth" | "relation-unavailable" | "validation" | "tenant-mismatch" | "no-membership" | "scope" | "expired-membership" | "stale-credentials" | "unknown-role" | "last-holder" | "max-holders" | "transfer-only" | "not-assignable-by" | "self-demotion" | "externally-managed" | "not-allowed-for-membership" | "conflicting-role" | "approval" | "stale-approval" | "pdp-denied" | "pdp-unavailable" | "pdp-invalid-response" | "undocumented" | "unsupported" | "exceeds-creator" | "credential-policy";
|
|
344
|
+
/** The `detail` each denial reason carries, where PermDock sets a structured one. */
|
|
345
|
+
type DenialDetails = {
|
|
346
|
+
readonly limit: LimitDetail;
|
|
347
|
+
/** The window the inactive allow applies in. */
|
|
348
|
+
readonly "inactive-grant": GrantValidity;
|
|
349
|
+
/** The matching deny's declared `name`. */
|
|
350
|
+
readonly deny: {
|
|
351
|
+
readonly name?: string;
|
|
352
|
+
};
|
|
304
353
|
};
|
|
305
|
-
type PolicyScopesInput = Readonly<Record<string, ScopeDeclaration>>;
|
|
306
354
|
/**
|
|
307
|
-
*
|
|
308
|
-
*
|
|
355
|
+
* Why a candidate grant did not apply. `Denial<"limit">` types `detail` for a
|
|
356
|
+
* reason in `DenialDetails`; any other reason's detail is `unknown`.
|
|
309
357
|
*/
|
|
310
|
-
type
|
|
311
|
-
readonly name: string;
|
|
312
|
-
readonly key?: string;
|
|
313
|
-
readonly within?: string;
|
|
314
|
-
};
|
|
315
|
-
/** The names `role(..., { on })`, `memberOf` and memberships may use: declared names plus the aliases. */
|
|
316
|
-
type ScopeNames<S> = [S] extends [PolicyScopesInput] ? string extends keyof S ? string : (keyof S & string) | "tenant" | "team" : string;
|
|
317
|
-
//#endregion
|
|
318
|
-
//#region src/core/grantee.d.ts
|
|
319
|
-
type RoleGrantee = {
|
|
320
|
-
readonly kind: "role";
|
|
321
|
-
readonly role: string;
|
|
322
|
-
/** `'global'`, a scope name, or one resource. */
|
|
323
|
-
readonly scope: string | {
|
|
324
|
-
readonly resource: string;
|
|
325
|
-
};
|
|
326
|
-
};
|
|
327
|
-
type AnyoneGrantee = {
|
|
328
|
-
readonly kind: "anyone";
|
|
329
|
-
};
|
|
330
|
-
type AuthenticatedGrantee = {
|
|
331
|
-
readonly kind: "authenticated";
|
|
332
|
-
};
|
|
333
|
-
type RelationGrantee = {
|
|
334
|
-
readonly kind: "relation";
|
|
335
|
-
readonly resource: string;
|
|
336
|
-
readonly relation: string;
|
|
337
|
-
/**
|
|
338
|
-
* `'parent'`: follow the row's `parent` chain upward to `resource`, then its
|
|
339
|
-
* own parents. A list of link names: follow those to-one links from the row
|
|
340
|
-
* to `resource`, then walk its parents only when `depth` is set.
|
|
341
|
-
*/
|
|
342
|
-
readonly through?: "parent" | readonly string[];
|
|
343
|
-
/** Parent hops walked above the first `resource` instance; absent means `DEFAULT_RELATION_DEPTH` for `'parent'` and `0` for links. */
|
|
344
|
-
readonly depth?: number;
|
|
345
|
-
};
|
|
346
|
-
type PlanGrantee = {
|
|
347
|
-
readonly kind: "plan";
|
|
348
|
-
readonly plan: string;
|
|
349
|
-
};
|
|
350
|
-
type ActorGrantee = {
|
|
351
|
-
readonly kind: "actor";
|
|
352
|
-
readonly actor: string;
|
|
353
|
-
};
|
|
354
|
-
type AssuranceGrantee = {
|
|
355
|
-
readonly kind: "assurance";
|
|
356
|
-
readonly acr?: readonly string[];
|
|
357
|
-
readonly amr?: readonly string[];
|
|
358
|
-
readonly maxAge?: number;
|
|
359
|
-
};
|
|
360
|
-
type InheritGrantee = {
|
|
361
|
-
readonly kind: "inherit";
|
|
362
|
-
readonly permission: string;
|
|
363
|
-
readonly resource: string;
|
|
364
|
-
readonly through: "parent" | readonly string[];
|
|
365
|
-
};
|
|
366
|
-
type Grantee = RoleGrantee | InheritGrantee | AnyoneGrantee | AuthenticatedGrantee | RelationGrantee | PlanGrantee | ActorGrantee | AssuranceGrantee;
|
|
367
|
-
type GranteeInput = Grantee | Role | Plan | string | readonly GranteeInput[];
|
|
368
|
-
declare function anyone(): AnyoneGrantee;
|
|
369
|
-
declare function authenticated(): AuthenticatedGrantee;
|
|
370
|
-
declare function relation(resource: Permission | PermissionTree, name: string, options?: {
|
|
371
|
-
readonly through?: "parent" | readonly string[];
|
|
372
|
-
readonly depth?: number;
|
|
373
|
-
}): RelationGrantee;
|
|
374
|
-
declare function inherit(permission: Permission, options: {
|
|
375
|
-
readonly through: "parent" | readonly string[];
|
|
376
|
-
}): InheritGrantee;
|
|
377
|
-
declare function plan(name: Plan | string): PlanGrantee;
|
|
378
|
-
declare function actor(kind: string): ActorGrantee;
|
|
379
|
-
declare function assurance(options: {
|
|
380
|
-
readonly acr?: string | readonly string[];
|
|
381
|
-
readonly amr?: string | readonly string[];
|
|
382
|
-
readonly maxAge?: number;
|
|
383
|
-
}): AssuranceGrantee;
|
|
384
|
-
//#endregion
|
|
385
|
-
//#region src/core/decision.d.ts
|
|
386
|
-
type DenialReason = "no-grant" | "condition" | "deny" | "inactive-grant" | "closure-error" | "opaque-condition" | "server-only" | "anonymous" | "not-delegated" | "no-delegation" | "insufficient-user-authentication" | "not-entitled" | "purpose" | "reason-required" | "actor-required" | "limit" | "limit-unavailable" | "relation-depth" | "relation-unavailable" | "validation" | "tenant-mismatch" | "no-membership" | "scope" | "expired-membership" | "stale-credentials" | "unknown-role" | "last-holder" | "max-holders" | "transfer-only" | "not-assignable-by" | "self-demotion" | "externally-managed" | "not-allowed-for-membership" | "conflicting-role" | "approval" | "stale-approval" | "pdp-denied" | "pdp-unavailable" | "pdp-invalid-response" | "undocumented" | "unsupported" | "exceeds-creator" | "credential-policy";
|
|
387
|
-
type Denial = {
|
|
358
|
+
type Denial<R extends DenialReason = DenialReason> = {
|
|
388
359
|
readonly role: string | null;
|
|
389
|
-
readonly reason:
|
|
390
|
-
readonly detail?: unknown;
|
|
360
|
+
readonly reason: R;
|
|
361
|
+
readonly detail?: [R] extends [keyof DenialDetails] ? DenialDetails[R] : unknown;
|
|
391
362
|
readonly to?: Grantee | readonly Grantee[];
|
|
392
363
|
};
|
|
393
364
|
type MatchedGrant = {
|
|
@@ -395,6 +366,8 @@ type MatchedGrant = {
|
|
|
395
366
|
readonly permission: string;
|
|
396
367
|
/** The grant's declared `name`, when it has one. */
|
|
397
368
|
readonly name?: string;
|
|
369
|
+
/** The grant's declared `meta`, when it has one; PermDock never reads it. */
|
|
370
|
+
readonly meta?: GrantMeta;
|
|
398
371
|
readonly to?: Grantee | readonly Grantee[];
|
|
399
372
|
readonly where?: Grant["where"];
|
|
400
373
|
readonly check?: Grant["check"];
|
|
@@ -410,12 +383,21 @@ type MatchedGrant = {
|
|
|
410
383
|
* `limit` was past its count; `near-limit`: usage reached `alertAt`.
|
|
411
384
|
* `notify` / `review`: a break-glass grant's declared follow-ups.
|
|
412
385
|
* `justify`: the break-glass reason, carried so audit records why.
|
|
386
|
+
* `app`: a follow-up the application declared on the grant
|
|
387
|
+
* (`allow(p, { obligations })`); PermDock carries it and never acts on it.
|
|
413
388
|
*/
|
|
414
389
|
type Obligation = {
|
|
415
390
|
readonly kind: "over-limit" | "near-limit" | "notify" | "review";
|
|
416
391
|
} | {
|
|
417
392
|
readonly kind: "justify";
|
|
418
393
|
readonly reason: string;
|
|
394
|
+
} | AppObligation;
|
|
395
|
+
/** An obligation the application declares on an allow and handles itself. */
|
|
396
|
+
type AppObligation = {
|
|
397
|
+
readonly kind: "app";
|
|
398
|
+
/** Lower case letters, digits, `_` and `-`, starting with a letter. */
|
|
399
|
+
readonly name: string;
|
|
400
|
+
readonly detail?: MetaValue;
|
|
419
401
|
};
|
|
420
402
|
/** What is left of the `limit` that applied; `resetsAt` is Unix seconds. */
|
|
421
403
|
type Quota = {
|
|
@@ -479,6 +461,11 @@ type GrantedDecision = {
|
|
|
479
461
|
};
|
|
480
462
|
type DeniedDecision = {
|
|
481
463
|
readonly outcome: "denied";
|
|
464
|
+
/**
|
|
465
|
+
* The key of the permission that was checked. Absent on a denial for a
|
|
466
|
+
* check that named no declared permission.
|
|
467
|
+
*/
|
|
468
|
+
readonly permission?: string;
|
|
482
469
|
readonly denials: readonly Denial[];
|
|
483
470
|
readonly alternatives: readonly Permission[];
|
|
484
471
|
/** Present only with `explain: true`. */
|
|
@@ -498,64 +485,116 @@ type ExplainedDecision = Decision & {
|
|
|
498
485
|
};
|
|
499
486
|
type Decision = GrantedDecision | DeniedDecision | ApprovalRequiredDecision;
|
|
500
487
|
//#endregion
|
|
501
|
-
//#region src/core/
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
*/
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
readonly
|
|
515
|
-
|
|
516
|
-
|
|
488
|
+
//#region src/core/grantee.d.ts
|
|
489
|
+
type RoleGrantee = {
|
|
490
|
+
readonly kind: "role";
|
|
491
|
+
readonly role: string;
|
|
492
|
+
/** `'global'`, a scope name, or one resource. */
|
|
493
|
+
readonly scope: string | {
|
|
494
|
+
readonly resource: string;
|
|
495
|
+
};
|
|
496
|
+
};
|
|
497
|
+
type AnyoneGrantee = {
|
|
498
|
+
readonly kind: "anyone";
|
|
499
|
+
};
|
|
500
|
+
type AuthenticatedGrantee = {
|
|
501
|
+
readonly kind: "authenticated";
|
|
502
|
+
};
|
|
503
|
+
type RelationGrantee = {
|
|
504
|
+
readonly kind: "relation";
|
|
505
|
+
readonly resource: string;
|
|
506
|
+
readonly relation: string;
|
|
517
507
|
/**
|
|
518
|
-
*
|
|
519
|
-
*
|
|
508
|
+
* `'parent'`: follow the row's `parent` chain upward to `resource`, then its
|
|
509
|
+
* own parents. A list of link names: follow those to-one links from the row
|
|
510
|
+
* to `resource`, then walk its parents only when `depth` is set.
|
|
520
511
|
*/
|
|
521
|
-
readonly
|
|
512
|
+
readonly through?: "parent" | readonly string[];
|
|
513
|
+
/** Parent hops walked above the first `resource` instance; absent means `DEFAULT_RELATION_DEPTH` for `'parent'` and `0` for links. */
|
|
514
|
+
readonly depth?: number;
|
|
515
|
+
};
|
|
516
|
+
type PlanGrantee = {
|
|
517
|
+
readonly kind: "plan";
|
|
518
|
+
readonly plan: string;
|
|
519
|
+
};
|
|
520
|
+
type ActorGrantee = {
|
|
521
|
+
readonly kind: "actor";
|
|
522
|
+
readonly actor: string;
|
|
523
|
+
};
|
|
524
|
+
type AssuranceGrantee = {
|
|
525
|
+
readonly kind: "assurance";
|
|
526
|
+
readonly acr?: readonly string[];
|
|
527
|
+
readonly amr?: readonly string[];
|
|
528
|
+
readonly maxAge?: number;
|
|
529
|
+
};
|
|
530
|
+
type InheritGrantee = {
|
|
531
|
+
readonly kind: "inherit";
|
|
532
|
+
readonly permission: string;
|
|
533
|
+
readonly resource: string;
|
|
534
|
+
readonly through: "parent" | readonly string[];
|
|
535
|
+
};
|
|
536
|
+
type Grantee = RoleGrantee | InheritGrantee | AnyoneGrantee | AuthenticatedGrantee | RelationGrantee | PlanGrantee | ActorGrantee | AssuranceGrantee;
|
|
537
|
+
type GranteeInput = Grantee | Role | Plan | string | readonly GranteeInput[];
|
|
538
|
+
declare function anyone(): AnyoneGrantee;
|
|
539
|
+
declare function authenticated(): AuthenticatedGrantee;
|
|
540
|
+
declare function relation(resource: Permission | PermissionTree, name: string, options?: {
|
|
541
|
+
readonly through?: "parent" | readonly string[];
|
|
542
|
+
readonly depth?: number;
|
|
543
|
+
}): RelationGrantee;
|
|
544
|
+
declare function inherit(permission: Permission, options: {
|
|
545
|
+
readonly through: "parent" | readonly string[];
|
|
546
|
+
}): InheritGrantee;
|
|
547
|
+
declare function plan(name: Plan | string): PlanGrantee;
|
|
548
|
+
declare function actor(kind: string): ActorGrantee;
|
|
549
|
+
declare function assurance(options: {
|
|
550
|
+
readonly acr?: string | readonly string[];
|
|
551
|
+
readonly amr?: string | readonly string[];
|
|
552
|
+
readonly maxAge?: number;
|
|
553
|
+
}): AssuranceGrantee;
|
|
554
|
+
//#endregion
|
|
555
|
+
//#region src/core/approvers.d.ts
|
|
556
|
+
/** One named approver, by principal id. */
|
|
557
|
+
type UserApprover = {
|
|
558
|
+
readonly kind: "user";
|
|
559
|
+
readonly id: string;
|
|
522
560
|
};
|
|
523
561
|
/**
|
|
524
|
-
*
|
|
525
|
-
*
|
|
526
|
-
*
|
|
527
|
-
*
|
|
562
|
+
* Whoever holds `permission` in the request's tenant, through any role,
|
|
563
|
+
* custom roles included. Checked only through verdict facts
|
|
564
|
+
* (`ApprovalVerdict.permissions`) that the handler computes from the
|
|
565
|
+
* approver's own instance.
|
|
528
566
|
*/
|
|
529
|
-
type
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
567
|
+
type PermissionApprover = {
|
|
568
|
+
readonly kind: "permission";
|
|
569
|
+
readonly permission: string;
|
|
570
|
+
};
|
|
571
|
+
/** An approver who matches at least one item; an item that is a list matches when every entry does. */
|
|
572
|
+
type AnyOfApprover = {
|
|
573
|
+
readonly kind: "any-of";
|
|
574
|
+
readonly of: readonly (Approver | readonly Approver[])[];
|
|
533
575
|
};
|
|
534
|
-
/** The denial detail when an `ApprovalPolicySource` fails: every call an allow would grant denies with reason `approval`. */
|
|
535
|
-
declare const APPROVAL_POLICY_UNAVAILABLE = "approval-policy-unavailable";
|
|
536
|
-
declare function memoryApprovalPolicies(policies: readonly ApprovalPolicy[]): ApprovalPolicySource;
|
|
537
576
|
/**
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
*
|
|
542
|
-
* never has, so the entry could never match; use `check` over the input.
|
|
543
|
-
* `stale-on-without-version`: `staleOn` needs an instance permission whose
|
|
544
|
-
* resource declares `version`.
|
|
577
|
+
* Who may approve: a subject-only grantee, a `relation()` the approver holds
|
|
578
|
+
* on the requested row (checked when the verdict is given), `user(id)`,
|
|
579
|
+
* `holder(permission)`, or `anyOf(...)`. A list (or `allOf(...)`) matches an
|
|
580
|
+
* approver who satisfies every item.
|
|
545
581
|
*/
|
|
546
|
-
type
|
|
547
|
-
type
|
|
548
|
-
readonly
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
582
|
+
type Approver = Grantee | UserApprover | PermissionApprover | AnyOfApprover;
|
|
583
|
+
type ApproverInput = GranteeInput | UserApprover | PermissionApprover | {
|
|
584
|
+
readonly kind: "any-of";
|
|
585
|
+
readonly of: readonly ApproverInput[];
|
|
586
|
+
} | readonly ApproverInput[];
|
|
587
|
+
/** Approves when the approver holds `permission` in the request's tenant (any role, custom roles included). */
|
|
588
|
+
declare function holder(permission: Permission): PermissionApprover;
|
|
589
|
+
/** Approves when the approver matches any one of `items`. */
|
|
590
|
+
declare function anyOf(...items: readonly ApproverInput[]): {
|
|
591
|
+
readonly kind: "any-of";
|
|
592
|
+
readonly of: readonly ApproverInput[];
|
|
552
593
|
};
|
|
553
|
-
/**
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
*/
|
|
558
|
-
declare function validateApprovalPolicy(policy: Policy, entry: unknown): ApprovalPolicyValidation;
|
|
594
|
+
/** Approves when the approver matches every one of `items`; the same as a list. */
|
|
595
|
+
declare function allOf(...items: readonly ApproverInput[]): readonly ApproverInput[];
|
|
596
|
+
/** A named approver for `approval.by`, matched on the approver's principal id. */
|
|
597
|
+
declare function user(id: string): UserApprover;
|
|
559
598
|
//#endregion
|
|
560
599
|
//#region src/core/arazzo.d.ts
|
|
561
600
|
type ArazzoSimulateInput = {
|
|
@@ -618,6 +657,218 @@ type ActivateInput = {
|
|
|
618
657
|
readonly reason?: string;
|
|
619
658
|
};
|
|
620
659
|
//#endregion
|
|
660
|
+
//#region src/core/wire-denial.d.ts
|
|
661
|
+
/**
|
|
662
|
+
* A denial as it leaves the process: in a decision event, a Problem Details
|
|
663
|
+
* body, an MCP or WebMCP refusal and the decision endpoint. `detail` is a
|
|
664
|
+
* JSON value (a string, or `LimitDetail` on `limit`); what a closure threw
|
|
665
|
+
* and a validation error stay in process.
|
|
666
|
+
*/
|
|
667
|
+
type WireDenial = {
|
|
668
|
+
readonly role: string | null;
|
|
669
|
+
readonly reason: DenialReason;
|
|
670
|
+
readonly to?: Grantee | readonly Grantee[];
|
|
671
|
+
readonly detail?: unknown;
|
|
672
|
+
};
|
|
673
|
+
/** A `Decision` whose denials are `WireDenial`s, as the decision endpoint sends it. */
|
|
674
|
+
type WireDecision = GrantedDecision | ApprovalRequiredDecision | (Omit<DeniedDecision, "denials"> & {
|
|
675
|
+
readonly denials: readonly WireDenial[];
|
|
676
|
+
});
|
|
677
|
+
//#endregion
|
|
678
|
+
//#region src/core/event-types.d.ts
|
|
679
|
+
type DirectoryEvent = {
|
|
680
|
+
readonly type: "directory";
|
|
681
|
+
readonly at: string;
|
|
682
|
+
readonly source: "scim";
|
|
683
|
+
readonly operation: "create" | "replace" | "patch" | "delete";
|
|
684
|
+
readonly tenant: string;
|
|
685
|
+
readonly resource: {
|
|
686
|
+
readonly type: "User" | "Group";
|
|
687
|
+
readonly id: string;
|
|
688
|
+
};
|
|
689
|
+
readonly credential: {
|
|
690
|
+
readonly kind: "token";
|
|
691
|
+
} | {
|
|
692
|
+
readonly kind: "jwt";
|
|
693
|
+
readonly iss?: string;
|
|
694
|
+
};
|
|
695
|
+
readonly active?: boolean;
|
|
696
|
+
};
|
|
697
|
+
type MembershipEvent = {
|
|
698
|
+
readonly type: "membership";
|
|
699
|
+
readonly at: string;
|
|
700
|
+
readonly source: string;
|
|
701
|
+
readonly operation: "added" | "removed" | "changed";
|
|
702
|
+
readonly principal: {
|
|
703
|
+
readonly id: string;
|
|
704
|
+
};
|
|
705
|
+
/** A declared scope name, or the `tenant` / `team` alias; absent for a global role change. */
|
|
706
|
+
readonly scope?: string;
|
|
707
|
+
/** The scope instance; present exactly when `scope` is. */
|
|
708
|
+
readonly id?: string;
|
|
709
|
+
/** The id of every ancestor scope, keyed by scope name. */
|
|
710
|
+
readonly within?: Readonly<Record<string, string>>;
|
|
711
|
+
readonly via?: string;
|
|
712
|
+
/** When the membership lapses, in seconds since the epoch. */
|
|
713
|
+
readonly expiresAt?: number;
|
|
714
|
+
readonly roles: {
|
|
715
|
+
readonly added: readonly string[];
|
|
716
|
+
readonly removed: readonly string[];
|
|
717
|
+
};
|
|
718
|
+
readonly by?: {
|
|
719
|
+
readonly id: string;
|
|
720
|
+
readonly kind: string;
|
|
721
|
+
};
|
|
722
|
+
};
|
|
723
|
+
/**
|
|
724
|
+
* An API key's lifecycle: `created`, `rotated` and `revoked` from the
|
|
725
|
+
* application or a credential store, `used` from `subjectFromApiKey`. A
|
|
726
|
+
* `used` event carries `sample`, the fraction of uses reported.
|
|
727
|
+
*/
|
|
728
|
+
type CredentialEvent = {
|
|
729
|
+
readonly type: "credential";
|
|
730
|
+
readonly at: string;
|
|
731
|
+
readonly source: string;
|
|
732
|
+
readonly operation: "created" | "used" | "rotated" | "revoked";
|
|
733
|
+
readonly credential: {
|
|
734
|
+
readonly id: string;
|
|
735
|
+
readonly kind: CredentialKind;
|
|
736
|
+
};
|
|
737
|
+
readonly principal: {
|
|
738
|
+
readonly id: string;
|
|
739
|
+
};
|
|
740
|
+
readonly tenant?: string;
|
|
741
|
+
readonly expiresAt?: number;
|
|
742
|
+
readonly by?: {
|
|
743
|
+
readonly id: string;
|
|
744
|
+
readonly kind: string;
|
|
745
|
+
};
|
|
746
|
+
readonly sample?: number;
|
|
747
|
+
};
|
|
748
|
+
type SinkEvent = DecisionEvent | DirectoryEvent | MembershipEvent | CredentialEvent | AccessEvent;
|
|
749
|
+
/**
|
|
750
|
+
* A support-access session lifecycle event: a tenant consented to vendor
|
|
751
|
+
* support (`started`), the session lapsed (`ended`), or the tenant pulled
|
|
752
|
+
* consent early (`revoked`). It never decides; it records what happened for
|
|
753
|
+
* audit and revocation.
|
|
754
|
+
*/
|
|
755
|
+
type AccessEvent = {
|
|
756
|
+
readonly type: "access";
|
|
757
|
+
readonly at: string;
|
|
758
|
+
readonly source: string;
|
|
759
|
+
readonly operation: "started" | "ended" | "revoked";
|
|
760
|
+
readonly tenant: string;
|
|
761
|
+
readonly principal: {
|
|
762
|
+
readonly id: string;
|
|
763
|
+
};
|
|
764
|
+
/** The membership kind the session runs under (`support`). */
|
|
765
|
+
readonly via: string;
|
|
766
|
+
readonly roles: readonly string[];
|
|
767
|
+
readonly member?: {
|
|
768
|
+
readonly group: string;
|
|
769
|
+
};
|
|
770
|
+
readonly expiresAt?: number;
|
|
771
|
+
/** The tenant principal that consented. */
|
|
772
|
+
readonly grantedBy?: string;
|
|
773
|
+
readonly reason?: string;
|
|
774
|
+
readonly actor?: {
|
|
775
|
+
readonly id: string;
|
|
776
|
+
readonly kind: string;
|
|
777
|
+
};
|
|
778
|
+
};
|
|
779
|
+
type DecisionEvent = {
|
|
780
|
+
readonly type: "decision";
|
|
781
|
+
readonly at: string;
|
|
782
|
+
readonly outcome: "granted" | "denied" | "approval-required";
|
|
783
|
+
readonly permission: string;
|
|
784
|
+
readonly scope: string;
|
|
785
|
+
readonly resource: {
|
|
786
|
+
readonly type: string;
|
|
787
|
+
readonly id?: string;
|
|
788
|
+
};
|
|
789
|
+
readonly subject: {
|
|
790
|
+
readonly principal: {
|
|
791
|
+
readonly id: string;
|
|
792
|
+
readonly roles: readonly string[];
|
|
793
|
+
readonly tenant?: string;
|
|
794
|
+
} | null;
|
|
795
|
+
readonly actor?: {
|
|
796
|
+
readonly id: string;
|
|
797
|
+
readonly kind: string;
|
|
798
|
+
};
|
|
799
|
+
readonly delegation?: {
|
|
800
|
+
readonly scopes?: readonly string[];
|
|
801
|
+
readonly authorizationDetails?: readonly unknown[];
|
|
802
|
+
};
|
|
803
|
+
/** The API key the subject came from. */
|
|
804
|
+
readonly credential?: {
|
|
805
|
+
readonly id: string;
|
|
806
|
+
readonly kind: CredentialKind;
|
|
807
|
+
};
|
|
808
|
+
};
|
|
809
|
+
readonly tenant?: string;
|
|
810
|
+
readonly membership?: Membership;
|
|
811
|
+
readonly via?: string | null;
|
|
812
|
+
readonly matched?: {
|
|
813
|
+
readonly role: string | null;
|
|
814
|
+
readonly permission: string;
|
|
815
|
+
/** The grant's declared `name`. */
|
|
816
|
+
readonly name?: string;
|
|
817
|
+
/** The grant's declared `meta`; PermDock never reads it. */
|
|
818
|
+
readonly meta?: GrantMeta;
|
|
819
|
+
readonly to?: Grantee | readonly Grantee[];
|
|
820
|
+
readonly hosted?: HostedGrantRef;
|
|
821
|
+
readonly breakGlass?: true;
|
|
822
|
+
};
|
|
823
|
+
/** What a granted decision owes, as on `GrantedDecision.obligations`. */
|
|
824
|
+
readonly obligations?: readonly Obligation[];
|
|
825
|
+
/** Purposes of use the caller asserted (`context.purpose`); present when any was. */
|
|
826
|
+
readonly purpose?: readonly string[];
|
|
827
|
+
/** The justification the caller supplied (`context.reason`); present when set. */
|
|
828
|
+
readonly reason?: string;
|
|
829
|
+
readonly denials?: readonly WireDenial[];
|
|
830
|
+
readonly alternatives?: readonly string[];
|
|
831
|
+
readonly token?: string;
|
|
832
|
+
readonly trusted: boolean;
|
|
833
|
+
readonly source: "can" | "decide" | "assert" | "filter" | "endpoint" | "adapter" | "approval" | "simulate" | "explain";
|
|
834
|
+
readonly adapter?: string;
|
|
835
|
+
readonly phase?: "requested" | "resolved";
|
|
836
|
+
readonly counts?: {
|
|
837
|
+
readonly granted: number;
|
|
838
|
+
readonly denied: number;
|
|
839
|
+
readonly approvalRequired: number;
|
|
840
|
+
};
|
|
841
|
+
};
|
|
842
|
+
type AuthEvent = {
|
|
843
|
+
readonly reason: "invalid-token" | "schema" | "unknown-role" | "groups-overflow" | "source-threw";
|
|
844
|
+
readonly cause?: string;
|
|
845
|
+
readonly source: string;
|
|
846
|
+
readonly kid?: string;
|
|
847
|
+
readonly alg?: string;
|
|
848
|
+
readonly typ?: string;
|
|
849
|
+
readonly issuer?: string;
|
|
850
|
+
readonly requestId?: string;
|
|
851
|
+
};
|
|
852
|
+
//#endregion
|
|
853
|
+
//#region src/core/scopes.d.ts
|
|
854
|
+
/** One entry of `definePolicy({ scopes })`: the row field holding the scope id, and its parent scope. */
|
|
855
|
+
type ScopeDeclaration = {
|
|
856
|
+
readonly key: string;
|
|
857
|
+
readonly within?: string;
|
|
858
|
+
};
|
|
859
|
+
type PolicyScopesInput = Readonly<Record<string, ScopeDeclaration>>;
|
|
860
|
+
/**
|
|
861
|
+
* A declared scope, in declaration order. `key` is absent only on the
|
|
862
|
+
* implicit `tenant` / `team` pair of a policy that declares no scopes.
|
|
863
|
+
*/
|
|
864
|
+
type Scope = {
|
|
865
|
+
readonly name: string;
|
|
866
|
+
readonly key?: string;
|
|
867
|
+
readonly within?: string;
|
|
868
|
+
};
|
|
869
|
+
/** The names `role(..., { on })`, `memberOf` and memberships may use: declared names plus the aliases. */
|
|
870
|
+
type ScopeNames<S> = [S] extends [PolicyScopesInput] ? string extends keyof S ? string : (keyof S & string) | "tenant" | "team" : string;
|
|
871
|
+
//#endregion
|
|
621
872
|
//#region src/core/ownership.d.ts
|
|
622
873
|
/** Who a role change is about: their principal id and their membership in the scope instance. */
|
|
623
874
|
type RoleChangeTarget = {
|
|
@@ -643,41 +894,168 @@ type RoleChangeBase = {
|
|
|
643
894
|
readonly holders?: number;
|
|
644
895
|
};
|
|
645
896
|
/**
|
|
646
|
-
* A role held at a named scope instance (`scope` is a declared name or alias
|
|
647
|
-
* and `id` the instance), or a global role: `scope: 'global'` with no `id`.
|
|
648
|
-
* A global change has no tenant, so `within` and `holders` do not apply to it.
|
|
649
|
-
*/
|
|
650
|
-
type RoleChange = RoleChangeBase & ({
|
|
651
|
-
/** The scope the role is held at (a declared name or alias). */
|
|
652
|
-
readonly scope: string;
|
|
653
|
-
/** The scope instance. */
|
|
654
|
-
readonly id: string;
|
|
655
|
-
} | {
|
|
656
|
-
readonly scope: "global";
|
|
657
|
-
readonly id?: undefined;
|
|
658
|
-
});
|
|
659
|
-
/**
|
|
660
|
-
* `granted` names the role that authorised the change (`null` when a
|
|
661
|
-
* `meta.manageRoles` holder or the declared-role ceiling did); `denied` lists
|
|
662
|
-
* every rule the change breaks.
|
|
897
|
+
* A role held at a named scope instance (`scope` is a declared name or alias
|
|
898
|
+
* and `id` the instance), or a global role: `scope: 'global'` with no `id`.
|
|
899
|
+
* A global change has no tenant, so `within` and `holders` do not apply to it.
|
|
900
|
+
*/
|
|
901
|
+
type RoleChange = RoleChangeBase & ({
|
|
902
|
+
/** The scope the role is held at (a declared name or alias). */
|
|
903
|
+
readonly scope: string;
|
|
904
|
+
/** The scope instance. */
|
|
905
|
+
readonly id: string;
|
|
906
|
+
} | {
|
|
907
|
+
readonly scope: "global";
|
|
908
|
+
readonly id?: undefined;
|
|
909
|
+
});
|
|
910
|
+
/**
|
|
911
|
+
* `granted` names the role that authorised the change (`null` when a
|
|
912
|
+
* `meta.manageRoles` holder or the declared-role ceiling did); `denied` lists
|
|
913
|
+
* every rule the change breaks.
|
|
914
|
+
*/
|
|
915
|
+
type RoleChangeDecision = {
|
|
916
|
+
readonly outcome: "granted";
|
|
917
|
+
readonly change: RoleChange;
|
|
918
|
+
readonly role: string | null;
|
|
919
|
+
} | {
|
|
920
|
+
readonly outcome: "denied";
|
|
921
|
+
readonly change: RoleChange;
|
|
922
|
+
readonly denials: readonly Denial[];
|
|
923
|
+
};
|
|
924
|
+
type RoleChangeOptions = {
|
|
925
|
+
/**
|
|
926
|
+
* `true` when the application loaded `change.within` from its own store
|
|
927
|
+
* (the instance's stored parent), not from the request. Without it, a
|
|
928
|
+
* nested instance's tenant comes only from a live membership the actor
|
|
929
|
+
* holds on that instance or under it.
|
|
930
|
+
*/
|
|
931
|
+
readonly trusted?: boolean;
|
|
932
|
+
};
|
|
933
|
+
//#endregion
|
|
934
|
+
//#region src/core/snapshot-types.d.ts
|
|
935
|
+
type Snapshot = {
|
|
936
|
+
readonly v: 1;
|
|
937
|
+
readonly issuedAt: number;
|
|
938
|
+
readonly subject: {
|
|
939
|
+
readonly principal: {
|
|
940
|
+
readonly id: string;
|
|
941
|
+
readonly roles: readonly string[];
|
|
942
|
+
readonly plans?: readonly string[];
|
|
943
|
+
readonly tenant?: string;
|
|
944
|
+
readonly memberships?: readonly Membership[];
|
|
945
|
+
} | null;
|
|
946
|
+
readonly delegation?: Subject["delegation"];
|
|
947
|
+
readonly context: Readonly<Record<string, unknown>>;
|
|
948
|
+
};
|
|
949
|
+
/** Roles held in the active tenant, in rank order. */
|
|
950
|
+
readonly roles: readonly string[];
|
|
951
|
+
/** The distinct `meta.audience` values of `roles`, in rank order; absent when none has one. */
|
|
952
|
+
readonly audiences?: readonly string[];
|
|
953
|
+
readonly grants: readonly SnapshotGrant[];
|
|
954
|
+
readonly tenants: readonly string[];
|
|
955
|
+
readonly include?: readonly string[];
|
|
956
|
+
readonly simulated?: true;
|
|
957
|
+
readonly expiresAt?: number;
|
|
958
|
+
readonly vocabulary?: {
|
|
959
|
+
readonly roles?: Readonly<Record<string, Role>>;
|
|
960
|
+
readonly plans?: Readonly<Record<string, Plan>>;
|
|
961
|
+
};
|
|
962
|
+
/** The policy's scopes in order, so a client checks the row against each membership's instance. */
|
|
963
|
+
readonly scopes?: readonly SnapshotScope[];
|
|
964
|
+
/** One entry per tenant in `tenants`: what the subject may hand out there. Absent without tenants. */
|
|
965
|
+
readonly assignable?: readonly SnapshotAssignable[];
|
|
966
|
+
/**
|
|
967
|
+
* Allow grants of held roles that only a plan the subject lacks keeps
|
|
968
|
+
* from applying; they grant nothing and name the plan a denial asks for.
|
|
969
|
+
*/
|
|
970
|
+
readonly notEntitled?: readonly SnapshotNotEntitled[];
|
|
971
|
+
/**
|
|
972
|
+
* The row id field per resource whose `id` option is not `id`, for the
|
|
973
|
+
* grants in `grants`. Absent when every one reads `id`.
|
|
974
|
+
*/
|
|
975
|
+
readonly ids?: Readonly<Record<string, string>>;
|
|
976
|
+
/**
|
|
977
|
+
* The permission keys the policy's delegations let the actor use for the
|
|
978
|
+
* principal, sorted; present only when one applies. Outside it a check is
|
|
979
|
+
* `not-delegated`; inside it a token delegation, when there is one, must
|
|
980
|
+
* still cover.
|
|
981
|
+
*/
|
|
982
|
+
readonly delegated?: readonly string[];
|
|
983
|
+
};
|
|
984
|
+
/** A grant the subject would hold on another plan: its permission, role and `to`. */
|
|
985
|
+
type SnapshotNotEntitled = {
|
|
986
|
+
readonly permission: string;
|
|
987
|
+
readonly role: string | null;
|
|
988
|
+
readonly to: Grantee | readonly Grantee[];
|
|
989
|
+
};
|
|
990
|
+
/** One declared scope as a snapshot carries it. */
|
|
991
|
+
type SnapshotScope = {
|
|
992
|
+
readonly name: string;
|
|
993
|
+
readonly key: string;
|
|
994
|
+
readonly within?: string;
|
|
995
|
+
/** Resources whose rows this scope's key partitions, from their `memberOf` relations. */
|
|
996
|
+
readonly resources?: readonly string[];
|
|
997
|
+
/** Resource name to the field holding this scope's id, for a resource whose field is not `key` (its own `id`). */
|
|
998
|
+
readonly fields?: Readonly<Record<string, string>>;
|
|
999
|
+
};
|
|
1000
|
+
/** The declared roles and the custom-role ceiling the subject may assign in one tenant. */
|
|
1001
|
+
type SnapshotAssignable = {
|
|
1002
|
+
readonly tenant: string;
|
|
1003
|
+
readonly roles: readonly string[];
|
|
1004
|
+
readonly permissions: readonly Permission[];
|
|
1005
|
+
/** Permission key to the levels the subject may hand out; only permissions whose resource declares levels. */
|
|
1006
|
+
readonly levels?: Readonly<Record<string, readonly string[]>>;
|
|
1007
|
+
};
|
|
1008
|
+
type SnapshotGrant = {
|
|
1009
|
+
readonly permission: string;
|
|
1010
|
+
readonly effect: "allow" | "deny";
|
|
1011
|
+
readonly role: string | null;
|
|
1012
|
+
readonly to: Grantee | readonly Grantee[];
|
|
1013
|
+
readonly where?: Condition;
|
|
1014
|
+
readonly check?: Condition;
|
|
1015
|
+
readonly approval?: "human" | ApprovalRequirement;
|
|
1016
|
+
/** A scope name or one resource; absent for a global grant. */
|
|
1017
|
+
readonly scope?: string | {
|
|
1018
|
+
readonly resource: string;
|
|
1019
|
+
};
|
|
1020
|
+
readonly membership?: Membership;
|
|
1021
|
+
readonly portable?: false;
|
|
1022
|
+
readonly fields?: readonly string[];
|
|
1023
|
+
/** When the grant applies (Unix seconds, `from` inclusive, `until` exclusive); absent means always. */
|
|
1024
|
+
readonly validity?: GrantValidity;
|
|
1025
|
+
/** The grant's declared `name`. */
|
|
1026
|
+
readonly name?: string;
|
|
1027
|
+
/** The grant's declared `meta`; visible to the client that holds the snapshot. */
|
|
1028
|
+
readonly meta?: GrantMeta;
|
|
1029
|
+
/** The app obligations an allow declares, emitted on a granted decision. */
|
|
1030
|
+
readonly obligations?: readonly AppObligation[];
|
|
1031
|
+
};
|
|
1032
|
+
/**
|
|
1033
|
+
* What a policy grants, as JSON a client builds snapshots from without the
|
|
1034
|
+
* policy: `localSnapshotManifest(policy)` writes it, `localSnapshot` in
|
|
1035
|
+
* `permdock/react-native` reads it.
|
|
663
1036
|
*/
|
|
664
|
-
type
|
|
665
|
-
readonly
|
|
666
|
-
readonly
|
|
667
|
-
readonly
|
|
668
|
-
|
|
669
|
-
readonly
|
|
670
|
-
|
|
671
|
-
readonly
|
|
1037
|
+
type LocalSnapshotManifest = {
|
|
1038
|
+
readonly v: 1;
|
|
1039
|
+
readonly scopes?: readonly SnapshotScope[];
|
|
1040
|
+
readonly vocabulary?: Snapshot["vocabulary"];
|
|
1041
|
+
/** Declared role names; a custom role cannot take one. */
|
|
1042
|
+
readonly roles: readonly string[];
|
|
1043
|
+
/** Declared role names in rank order, when an `assigns` graph ranks them. */
|
|
1044
|
+
readonly rank?: readonly string[];
|
|
1045
|
+
/** Every declared grant, without a membership. */
|
|
1046
|
+
readonly grants: readonly SnapshotGrant[];
|
|
1047
|
+
/** Per custom-role scope (`global` for platform roles): the grants each entry resolves to. */
|
|
1048
|
+
readonly custom: Readonly<Record<string, LocalCustomRoleTable>>;
|
|
672
1049
|
};
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
1050
|
+
/** Grants a custom role entry resolves to, held by a placeholder role the client renames. */
|
|
1051
|
+
type LocalCustomRoleTable = {
|
|
1052
|
+
/** `{ permission }` per permission key, and `{ permission, level }` per declared level. */
|
|
1053
|
+
readonly permissions: Readonly<Record<string, {
|
|
1054
|
+
readonly all: readonly SnapshotGrant[];
|
|
1055
|
+
readonly levels?: Readonly<Record<string, readonly SnapshotGrant[]>>;
|
|
1056
|
+
}>>;
|
|
1057
|
+
/** `includes: [role]` per declared role. */
|
|
1058
|
+
readonly includes: Readonly<Record<string, readonly SnapshotGrant[]>>;
|
|
681
1059
|
};
|
|
682
1060
|
//#endregion
|
|
683
1061
|
//#region src/core/validation.d.ts
|
|
@@ -722,6 +1100,65 @@ type WhoCan = {
|
|
|
722
1100
|
readonly complete: boolean;
|
|
723
1101
|
};
|
|
724
1102
|
//#endregion
|
|
1103
|
+
//#region src/core/approval-policies.d.ts
|
|
1104
|
+
/**
|
|
1105
|
+
* One approval requirement kept as data, for a tenant or the whole platform.
|
|
1106
|
+
* It adds to what the code requires and never removes a requirement.
|
|
1107
|
+
*/
|
|
1108
|
+
type ApprovalPolicy = {
|
|
1109
|
+
/** The permission key; a former key from `renamed` resolves. */
|
|
1110
|
+
readonly permission: string;
|
|
1111
|
+
/** Absent: every tenant. */
|
|
1112
|
+
readonly tenant?: string;
|
|
1113
|
+
/** Actor kinds it applies to (`['agent']`); absent: every call. A call without an actor never matches a list. */
|
|
1114
|
+
readonly actors?: readonly string[];
|
|
1115
|
+
/** A portable condition over the row; instance permissions only, since a collection action has no row. */
|
|
1116
|
+
readonly where?: Condition;
|
|
1117
|
+
/** A portable condition over the call's input (the proposed row). */
|
|
1118
|
+
readonly check?: Condition;
|
|
1119
|
+
/**
|
|
1120
|
+
* The same shape as `allow(..., { approval })`. An `escalation` here widens
|
|
1121
|
+
* only this entry's stages, never the code's.
|
|
1122
|
+
*/
|
|
1123
|
+
readonly approval: ApprovalOption;
|
|
1124
|
+
};
|
|
1125
|
+
/**
|
|
1126
|
+
* Data-driven approval requirements, a subject input like `RoleSource`:
|
|
1127
|
+
* read once per instance for the subject's tenants (entries without a
|
|
1128
|
+
* tenant always apply). A throw, a rejected promise or an invalid entry
|
|
1129
|
+
* denies every call an allow would otherwise permit.
|
|
1130
|
+
*/
|
|
1131
|
+
type ApprovalPolicySource = {
|
|
1132
|
+
approvalPoliciesFor(query: {
|
|
1133
|
+
readonly tenants: readonly string[];
|
|
1134
|
+
}): readonly ApprovalPolicy[] | Promise<readonly ApprovalPolicy[]>;
|
|
1135
|
+
};
|
|
1136
|
+
/** The denial detail when an `ApprovalPolicySource` fails: every call an allow would grant denies with reason `approval`. */
|
|
1137
|
+
declare const APPROVAL_POLICY_UNAVAILABLE = "approval-policy-unavailable";
|
|
1138
|
+
declare function memoryApprovalPolicies(policies: readonly ApprovalPolicy[]): ApprovalPolicySource;
|
|
1139
|
+
/**
|
|
1140
|
+
* Why an `ApprovalPolicy` entry does not load. `unknown-permission`: the
|
|
1141
|
+
* policy declares no such key (the entry applies to nothing). `invalid`: a
|
|
1142
|
+
* field has the wrong shape or the approval option does not normalise.
|
|
1143
|
+
* `where-on-collection`: `where` reads a row, which a collection action
|
|
1144
|
+
* never has, so the entry could never match; use `check` over the input.
|
|
1145
|
+
* `stale-on-without-version`: `staleOn` needs an instance permission whose
|
|
1146
|
+
* resource declares `version`.
|
|
1147
|
+
*/
|
|
1148
|
+
type ApprovalPolicyProblem = "unknown-permission" | "invalid" | "where-on-collection" | "stale-on-without-version";
|
|
1149
|
+
type ApprovalPolicyValidation = {
|
|
1150
|
+
readonly ok: true;
|
|
1151
|
+
} | {
|
|
1152
|
+
readonly ok: false;
|
|
1153
|
+
readonly problem: ApprovalPolicyProblem;
|
|
1154
|
+
};
|
|
1155
|
+
/**
|
|
1156
|
+
* Checks one entry against the policy the way `approvalPoliciesFor` loads
|
|
1157
|
+
* it, for an application to refuse a bad entry when it is saved instead of
|
|
1158
|
+
* finding every call denied. Never throws.
|
|
1159
|
+
*/
|
|
1160
|
+
declare function validateApprovalPolicy(policy: Policy, entry: unknown): ApprovalPolicyValidation;
|
|
1161
|
+
//#endregion
|
|
725
1162
|
//#region src/core/hosted.d.ts
|
|
726
1163
|
/** One grant authored in PermDock Cloud; its grantee is a declared role, plan or relation. */
|
|
727
1164
|
type HostedGrant = {
|
|
@@ -1014,6 +1451,11 @@ type PermDockOptions = {
|
|
|
1014
1451
|
readonly relations?: RelationSource;
|
|
1015
1452
|
/** Approval requirements kept as data; they add to the code's and never remove one. A throw denies. */
|
|
1016
1453
|
readonly approvalPolicies?: ApprovalPolicySource;
|
|
1454
|
+
/**
|
|
1455
|
+
* Request values an adapter's `context` hook derived on the server, merged
|
|
1456
|
+
* into `subject.context`; keys from `policy.context` win on a clash.
|
|
1457
|
+
*/
|
|
1458
|
+
readonly context?: Readonly<Record<string, unknown>>;
|
|
1017
1459
|
};
|
|
1018
1460
|
declare function createPermDock<TUser, TPrincipal extends Principal = Principal, V extends PolicyVocabulary = PolicyVocabulary>(policy: Policy<TUser, TPrincipal, V>, user: TUser | Subject | null, options?: PermDockOptions): PermDock<V> | Promise<PermDock<V>>;
|
|
1019
1461
|
//#endregion
|
|
@@ -1162,24 +1604,6 @@ declare function credentialSubject(credential: Credential, options: {
|
|
|
1162
1604
|
*/
|
|
1163
1605
|
declare function decideCredential(permdock: PermDock, request: CredentialRequest, options?: DecideCredentialOptions): Promise<CredentialDecision>;
|
|
1164
1606
|
//#endregion
|
|
1165
|
-
//#region src/core/wire-denial.d.ts
|
|
1166
|
-
/**
|
|
1167
|
-
* A denial as it leaves the process: in a decision event, a Problem Details
|
|
1168
|
-
* body, an MCP or WebMCP refusal and the decision endpoint. `detail` is a
|
|
1169
|
-
* JSON value (a string, or `LimitDetail` on `limit`); what a closure threw
|
|
1170
|
-
* and a validation error stay in process.
|
|
1171
|
-
*/
|
|
1172
|
-
type WireDenial = {
|
|
1173
|
-
readonly role: string | null;
|
|
1174
|
-
readonly reason: DenialReason;
|
|
1175
|
-
readonly to?: Grantee | readonly Grantee[];
|
|
1176
|
-
readonly detail?: unknown;
|
|
1177
|
-
};
|
|
1178
|
-
/** A `Decision` whose denials are `WireDenial`s, as the decision endpoint sends it. */
|
|
1179
|
-
type WireDecision = GrantedDecision | ApprovalRequiredDecision | (Omit<DeniedDecision, "denials"> & {
|
|
1180
|
-
readonly denials: readonly WireDenial[];
|
|
1181
|
-
});
|
|
1182
|
-
//#endregion
|
|
1183
1607
|
//#region src/core/interfaces.d.ts
|
|
1184
1608
|
type DecisionProvider = {
|
|
1185
1609
|
readonly name: string;
|
|
@@ -1334,7 +1758,6 @@ type EntitlementSource = {
|
|
|
1334
1758
|
readonly tenant?: string;
|
|
1335
1759
|
}): string[] | Promise<string[]>;
|
|
1336
1760
|
};
|
|
1337
|
-
declare function memoryEntitlementSource(entries: Readonly<Record<string, readonly string[]>>): EntitlementSource;
|
|
1338
1761
|
type JwtClaims = {
|
|
1339
1762
|
readonly iss?: string;
|
|
1340
1763
|
readonly sub?: string;
|
|
@@ -1380,126 +1803,7 @@ type TokenSigner = {
|
|
|
1380
1803
|
};
|
|
1381
1804
|
type SubjectResolver<TInput, TPrincipal extends Principal = Principal> = (input: TInput, options?: {
|
|
1382
1805
|
readonly tenant?: string;
|
|
1383
|
-
}) => Subject<TPrincipal> | Promise<Subject<TPrincipal>>;
|
|
1384
|
-
type Snapshot = {
|
|
1385
|
-
readonly v: 1;
|
|
1386
|
-
readonly issuedAt: number;
|
|
1387
|
-
readonly subject: {
|
|
1388
|
-
readonly principal: {
|
|
1389
|
-
readonly id: string;
|
|
1390
|
-
readonly roles: readonly string[];
|
|
1391
|
-
readonly plans?: readonly string[];
|
|
1392
|
-
readonly tenant?: string;
|
|
1393
|
-
readonly memberships?: readonly Membership[];
|
|
1394
|
-
} | null;
|
|
1395
|
-
readonly delegation?: Subject["delegation"];
|
|
1396
|
-
readonly context: Readonly<Record<string, unknown>>;
|
|
1397
|
-
};
|
|
1398
|
-
/** Roles held in the active tenant, in rank order. */
|
|
1399
|
-
readonly roles: readonly string[];
|
|
1400
|
-
/** The distinct `meta.audience` values of `roles`, in rank order; absent when none has one. */
|
|
1401
|
-
readonly audiences?: readonly string[];
|
|
1402
|
-
readonly grants: readonly SnapshotGrant[];
|
|
1403
|
-
readonly tenants: readonly string[];
|
|
1404
|
-
readonly include?: readonly string[];
|
|
1405
|
-
readonly simulated?: true;
|
|
1406
|
-
readonly expiresAt?: number;
|
|
1407
|
-
readonly vocabulary?: {
|
|
1408
|
-
readonly roles?: Readonly<Record<string, Role>>;
|
|
1409
|
-
readonly plans?: Readonly<Record<string, Plan>>;
|
|
1410
|
-
};
|
|
1411
|
-
/** The policy's scopes in order, so a client checks the row against each membership's instance. */
|
|
1412
|
-
readonly scopes?: readonly SnapshotScope[];
|
|
1413
|
-
/** One entry per tenant in `tenants`: what the subject may hand out there. Absent without tenants. */
|
|
1414
|
-
readonly assignable?: readonly SnapshotAssignable[];
|
|
1415
|
-
/**
|
|
1416
|
-
* Allow grants of held roles that only a plan the subject lacks keeps
|
|
1417
|
-
* from applying; they grant nothing and name the plan a denial asks for.
|
|
1418
|
-
*/
|
|
1419
|
-
readonly notEntitled?: readonly SnapshotNotEntitled[];
|
|
1420
|
-
/**
|
|
1421
|
-
* The row id field per resource whose `id` option is not `id`, for the
|
|
1422
|
-
* grants in `grants`. Absent when every one reads `id`.
|
|
1423
|
-
*/
|
|
1424
|
-
readonly ids?: Readonly<Record<string, string>>;
|
|
1425
|
-
/**
|
|
1426
|
-
* The permission keys the policy's delegations let the actor use for the
|
|
1427
|
-
* principal, sorted; present only when one applies. Outside it a check is
|
|
1428
|
-
* `not-delegated`; inside it a token delegation, when there is one, must
|
|
1429
|
-
* still cover.
|
|
1430
|
-
*/
|
|
1431
|
-
readonly delegated?: readonly string[];
|
|
1432
|
-
};
|
|
1433
|
-
/** A grant the subject would hold on another plan: its permission, role and `to`. */
|
|
1434
|
-
type SnapshotNotEntitled = {
|
|
1435
|
-
readonly permission: string;
|
|
1436
|
-
readonly role: string | null;
|
|
1437
|
-
readonly to: Grantee | readonly Grantee[];
|
|
1438
|
-
};
|
|
1439
|
-
/** One declared scope as a snapshot carries it. */
|
|
1440
|
-
type SnapshotScope = {
|
|
1441
|
-
readonly name: string;
|
|
1442
|
-
readonly key: string;
|
|
1443
|
-
readonly within?: string;
|
|
1444
|
-
/** Resources whose rows this scope's key partitions, from their `memberOf` relations. */
|
|
1445
|
-
readonly resources?: readonly string[];
|
|
1446
|
-
/** Resource name to the field holding this scope's id, for a resource whose field is not `key` (its own `id`). */
|
|
1447
|
-
readonly fields?: Readonly<Record<string, string>>;
|
|
1448
|
-
};
|
|
1449
|
-
/** The declared roles and the custom-role ceiling the subject may assign in one tenant. */
|
|
1450
|
-
type SnapshotAssignable = {
|
|
1451
|
-
readonly tenant: string;
|
|
1452
|
-
readonly roles: readonly string[];
|
|
1453
|
-
readonly permissions: readonly Permission[];
|
|
1454
|
-
/** Permission key to the levels the subject may hand out; only permissions whose resource declares levels. */
|
|
1455
|
-
readonly levels?: Readonly<Record<string, readonly string[]>>;
|
|
1456
|
-
};
|
|
1457
|
-
type SnapshotGrant = {
|
|
1458
|
-
readonly permission: string;
|
|
1459
|
-
readonly effect: "allow" | "deny";
|
|
1460
|
-
readonly role: string | null;
|
|
1461
|
-
readonly to: Grantee | readonly Grantee[];
|
|
1462
|
-
readonly where?: Condition;
|
|
1463
|
-
readonly check?: Condition;
|
|
1464
|
-
readonly approval?: "human" | ApprovalRequirement;
|
|
1465
|
-
/** A scope name or one resource; absent for a global grant. */
|
|
1466
|
-
readonly scope?: string | {
|
|
1467
|
-
readonly resource: string;
|
|
1468
|
-
};
|
|
1469
|
-
readonly membership?: Membership;
|
|
1470
|
-
readonly portable?: false;
|
|
1471
|
-
readonly fields?: readonly string[];
|
|
1472
|
-
/** When the grant applies (Unix seconds, `from` inclusive, `until` exclusive); absent means always. */
|
|
1473
|
-
readonly validity?: GrantValidity;
|
|
1474
|
-
};
|
|
1475
|
-
/**
|
|
1476
|
-
* What a policy grants, as JSON a client builds snapshots from without the
|
|
1477
|
-
* policy: `localSnapshotManifest(policy)` writes it, `localSnapshot` in
|
|
1478
|
-
* `permdock/react-native` reads it.
|
|
1479
|
-
*/
|
|
1480
|
-
type LocalSnapshotManifest = {
|
|
1481
|
-
readonly v: 1;
|
|
1482
|
-
readonly scopes?: readonly SnapshotScope[];
|
|
1483
|
-
readonly vocabulary?: Snapshot["vocabulary"];
|
|
1484
|
-
/** Declared role names; a custom role cannot take one. */
|
|
1485
|
-
readonly roles: readonly string[];
|
|
1486
|
-
/** Declared role names in rank order, when an `assigns` graph ranks them. */
|
|
1487
|
-
readonly rank?: readonly string[];
|
|
1488
|
-
/** Every declared grant, without a membership. */
|
|
1489
|
-
readonly grants: readonly SnapshotGrant[];
|
|
1490
|
-
/** Per custom-role scope (`global` for platform roles): the grants each entry resolves to. */
|
|
1491
|
-
readonly custom: Readonly<Record<string, LocalCustomRoleTable>>;
|
|
1492
|
-
};
|
|
1493
|
-
/** Grants a custom role entry resolves to, held by a placeholder role the client renames. */
|
|
1494
|
-
type LocalCustomRoleTable = {
|
|
1495
|
-
/** `{ permission }` per permission key, and `{ permission, level }` per declared level. */
|
|
1496
|
-
readonly permissions: Readonly<Record<string, {
|
|
1497
|
-
readonly all: readonly SnapshotGrant[];
|
|
1498
|
-
readonly levels?: Readonly<Record<string, readonly SnapshotGrant[]>>;
|
|
1499
|
-
}>>;
|
|
1500
|
-
/** `includes: [role]` per declared role. */
|
|
1501
|
-
readonly includes: Readonly<Record<string, readonly SnapshotGrant[]>>;
|
|
1502
|
-
};
|
|
1806
|
+
}) => Subject<TPrincipal> | Promise<Subject<TPrincipal>>;
|
|
1503
1807
|
type SnapshotSource = {
|
|
1504
1808
|
get(): Promise<Snapshot | string> | Snapshot | string;
|
|
1505
1809
|
subscribe?(listener: () => void): () => void;
|
|
@@ -1525,106 +1829,6 @@ type DecisionSink = {
|
|
|
1525
1829
|
write(events: readonly SinkEvent[]): Promise<void> | void;
|
|
1526
1830
|
flush?(): Promise<void>;
|
|
1527
1831
|
};
|
|
1528
|
-
type DirectoryEvent = {
|
|
1529
|
-
readonly type: "directory";
|
|
1530
|
-
readonly at: string;
|
|
1531
|
-
readonly source: "scim";
|
|
1532
|
-
readonly operation: "create" | "replace" | "patch" | "delete";
|
|
1533
|
-
readonly tenant: string;
|
|
1534
|
-
readonly resource: {
|
|
1535
|
-
readonly type: "User" | "Group";
|
|
1536
|
-
readonly id: string;
|
|
1537
|
-
};
|
|
1538
|
-
readonly credential: {
|
|
1539
|
-
readonly kind: "token";
|
|
1540
|
-
} | {
|
|
1541
|
-
readonly kind: "jwt";
|
|
1542
|
-
readonly iss?: string;
|
|
1543
|
-
};
|
|
1544
|
-
readonly active?: boolean;
|
|
1545
|
-
};
|
|
1546
|
-
type MembershipEvent = {
|
|
1547
|
-
readonly type: "membership";
|
|
1548
|
-
readonly at: string;
|
|
1549
|
-
readonly source: string;
|
|
1550
|
-
readonly operation: "added" | "removed" | "changed";
|
|
1551
|
-
readonly principal: {
|
|
1552
|
-
readonly id: string;
|
|
1553
|
-
};
|
|
1554
|
-
/** A declared scope name, or the `tenant` / `team` alias; absent for a global role change. */
|
|
1555
|
-
readonly scope?: string;
|
|
1556
|
-
/** The scope instance; present exactly when `scope` is. */
|
|
1557
|
-
readonly id?: string;
|
|
1558
|
-
/** The id of every ancestor scope, keyed by scope name. */
|
|
1559
|
-
readonly within?: Readonly<Record<string, string>>;
|
|
1560
|
-
readonly via?: string;
|
|
1561
|
-
/** When the membership lapses, in seconds since the epoch. */
|
|
1562
|
-
readonly expiresAt?: number;
|
|
1563
|
-
readonly roles: {
|
|
1564
|
-
readonly added: readonly string[];
|
|
1565
|
-
readonly removed: readonly string[];
|
|
1566
|
-
};
|
|
1567
|
-
readonly by?: {
|
|
1568
|
-
readonly id: string;
|
|
1569
|
-
readonly kind: string;
|
|
1570
|
-
};
|
|
1571
|
-
};
|
|
1572
|
-
/**
|
|
1573
|
-
* An API key's lifecycle: `created`, `rotated` and `revoked` from the
|
|
1574
|
-
* application or a credential store, `used` from `subjectFromApiKey`. A
|
|
1575
|
-
* `used` event carries `sample`, the fraction of uses reported.
|
|
1576
|
-
*/
|
|
1577
|
-
type CredentialEvent = {
|
|
1578
|
-
readonly type: "credential";
|
|
1579
|
-
readonly at: string;
|
|
1580
|
-
readonly source: string;
|
|
1581
|
-
readonly operation: "created" | "used" | "rotated" | "revoked";
|
|
1582
|
-
readonly credential: {
|
|
1583
|
-
readonly id: string;
|
|
1584
|
-
readonly kind: CredentialKind;
|
|
1585
|
-
};
|
|
1586
|
-
readonly principal: {
|
|
1587
|
-
readonly id: string;
|
|
1588
|
-
};
|
|
1589
|
-
readonly tenant?: string;
|
|
1590
|
-
readonly expiresAt?: number;
|
|
1591
|
-
readonly by?: {
|
|
1592
|
-
readonly id: string;
|
|
1593
|
-
readonly kind: string;
|
|
1594
|
-
};
|
|
1595
|
-
readonly sample?: number;
|
|
1596
|
-
};
|
|
1597
|
-
type SinkEvent = DecisionEvent | DirectoryEvent | MembershipEvent | CredentialEvent | AccessEvent;
|
|
1598
|
-
/**
|
|
1599
|
-
* A support-access session lifecycle event: a tenant consented to vendor
|
|
1600
|
-
* support (`started`), the session lapsed (`ended`), or the tenant pulled
|
|
1601
|
-
* consent early (`revoked`). It never decides; it records what happened for
|
|
1602
|
-
* audit and revocation.
|
|
1603
|
-
*/
|
|
1604
|
-
type AccessEvent = {
|
|
1605
|
-
readonly type: "access";
|
|
1606
|
-
readonly at: string;
|
|
1607
|
-
readonly source: string;
|
|
1608
|
-
readonly operation: "started" | "ended" | "revoked";
|
|
1609
|
-
readonly tenant: string;
|
|
1610
|
-
readonly principal: {
|
|
1611
|
-
readonly id: string;
|
|
1612
|
-
};
|
|
1613
|
-
/** The membership kind the session runs under (`support`). */
|
|
1614
|
-
readonly via: string;
|
|
1615
|
-
readonly roles: readonly string[];
|
|
1616
|
-
readonly member?: {
|
|
1617
|
-
readonly group: string;
|
|
1618
|
-
};
|
|
1619
|
-
readonly expiresAt?: number;
|
|
1620
|
-
/** The tenant principal that consented. */
|
|
1621
|
-
readonly grantedBy?: string;
|
|
1622
|
-
readonly reason?: string;
|
|
1623
|
-
readonly actor?: {
|
|
1624
|
-
readonly id: string;
|
|
1625
|
-
readonly kind: string;
|
|
1626
|
-
};
|
|
1627
|
-
};
|
|
1628
1832
|
/**
|
|
1629
1833
|
* Looks up the credential an API key stands for. `null` for a key that is
|
|
1630
1834
|
* malformed, unknown, revoked or whose secret does not match; never throws
|
|
@@ -1640,73 +1844,6 @@ type CredentialVerifier = {
|
|
|
1640
1844
|
*/
|
|
1641
1845
|
touch?(id: string, at: number): void | Promise<void>;
|
|
1642
1846
|
};
|
|
1643
|
-
type DecisionEvent = {
|
|
1644
|
-
readonly type: "decision";
|
|
1645
|
-
readonly at: string;
|
|
1646
|
-
readonly outcome: "granted" | "denied" | "approval-required";
|
|
1647
|
-
readonly permission: string;
|
|
1648
|
-
readonly scope: string;
|
|
1649
|
-
readonly resource: {
|
|
1650
|
-
readonly type: string;
|
|
1651
|
-
readonly id?: string;
|
|
1652
|
-
};
|
|
1653
|
-
readonly subject: {
|
|
1654
|
-
readonly principal: {
|
|
1655
|
-
readonly id: string;
|
|
1656
|
-
readonly roles: readonly string[];
|
|
1657
|
-
readonly tenant?: string;
|
|
1658
|
-
} | null;
|
|
1659
|
-
readonly actor?: {
|
|
1660
|
-
readonly id: string;
|
|
1661
|
-
readonly kind: string;
|
|
1662
|
-
};
|
|
1663
|
-
readonly delegation?: {
|
|
1664
|
-
readonly scopes?: readonly string[];
|
|
1665
|
-
readonly authorizationDetails?: readonly unknown[];
|
|
1666
|
-
};
|
|
1667
|
-
/** The API key the subject came from. */
|
|
1668
|
-
readonly credential?: {
|
|
1669
|
-
readonly id: string;
|
|
1670
|
-
readonly kind: CredentialKind;
|
|
1671
|
-
};
|
|
1672
|
-
};
|
|
1673
|
-
readonly tenant?: string;
|
|
1674
|
-
readonly membership?: Membership;
|
|
1675
|
-
readonly via?: string | null;
|
|
1676
|
-
readonly matched?: {
|
|
1677
|
-
readonly role: string | null;
|
|
1678
|
-
readonly permission: string;
|
|
1679
|
-
readonly to?: Grantee | readonly Grantee[];
|
|
1680
|
-
readonly hosted?: HostedGrantRef;
|
|
1681
|
-
readonly breakGlass?: true;
|
|
1682
|
-
};
|
|
1683
|
-
/** Purposes of use the caller asserted (`context.purpose`); present when any was. */
|
|
1684
|
-
readonly purpose?: readonly string[];
|
|
1685
|
-
/** The justification the caller supplied (`context.reason`); present when set. */
|
|
1686
|
-
readonly reason?: string;
|
|
1687
|
-
readonly denials?: readonly WireDenial[];
|
|
1688
|
-
readonly alternatives?: readonly string[];
|
|
1689
|
-
readonly token?: string;
|
|
1690
|
-
readonly trusted: boolean;
|
|
1691
|
-
readonly source: "can" | "decide" | "assert" | "filter" | "endpoint" | "adapter" | "approval" | "simulate" | "explain";
|
|
1692
|
-
readonly adapter?: string;
|
|
1693
|
-
readonly phase?: "requested" | "resolved";
|
|
1694
|
-
readonly counts?: {
|
|
1695
|
-
readonly granted: number;
|
|
1696
|
-
readonly denied: number;
|
|
1697
|
-
readonly approvalRequired: number;
|
|
1698
|
-
};
|
|
1699
|
-
};
|
|
1700
|
-
type AuthEvent = {
|
|
1701
|
-
readonly reason: "invalid-token" | "schema" | "unknown-role" | "groups-overflow" | "source-threw";
|
|
1702
|
-
readonly cause?: string;
|
|
1703
|
-
readonly source: string;
|
|
1704
|
-
readonly kid?: string;
|
|
1705
|
-
readonly alg?: string;
|
|
1706
|
-
readonly typ?: string;
|
|
1707
|
-
readonly issuer?: string;
|
|
1708
|
-
readonly requestId?: string;
|
|
1709
|
-
};
|
|
1710
1847
|
/** What one tenant configures for itself. Every field only tightens. */
|
|
1711
1848
|
type TenantSettings = {
|
|
1712
1849
|
/** Rules for API keys created in, or used against, this tenant. */
|
|
@@ -1719,92 +1856,11 @@ type TenantSettings = {
|
|
|
1719
1856
|
type SettingsSource = {
|
|
1720
1857
|
settingsFor(tenant: string): TenantSettings | undefined | Promise<TenantSettings | undefined>;
|
|
1721
1858
|
};
|
|
1722
|
-
declare function memorySettings(settings: Readonly<Record<string, TenantSettings>>): SettingsSource;
|
|
1723
|
-
/** Memberships keyed by principal id; `tenant` is not a filter, as for a database source. */
|
|
1724
|
-
declare function memoryMembershipSource(entries: Readonly<Record<string, readonly Membership[]>>): MembershipSource;
|
|
1725
|
-
/** A snapshot held in memory; `set` replaces it and notifies every subscriber. */
|
|
1726
|
-
declare function memorySnapshotSource(initial: Snapshot | string): SnapshotSource & {
|
|
1727
|
-
set(snapshot: Snapshot | string): void;
|
|
1728
|
-
};
|
|
1729
|
-
declare function memoryRoleSource(customRoles: readonly CustomRole[]): RoleSource;
|
|
1730
|
-
//#endregion
|
|
1731
|
-
//#region src/conditions/normalize.d.ts
|
|
1732
|
-
type FieldOperator = {
|
|
1733
|
-
readonly eq?: unknown;
|
|
1734
|
-
readonly ne?: unknown;
|
|
1735
|
-
readonly gt?: unknown;
|
|
1736
|
-
readonly gte?: unknown;
|
|
1737
|
-
readonly lt?: unknown;
|
|
1738
|
-
readonly lte?: unknown;
|
|
1739
|
-
readonly contains?: unknown;
|
|
1740
|
-
readonly in?: unknown;
|
|
1741
|
-
readonly notIn?: unknown;
|
|
1742
|
-
readonly isNull?: boolean;
|
|
1743
|
-
};
|
|
1744
|
-
type WhereShorthand<T = Record<string, unknown>> = {
|
|
1745
|
-
readonly and?: readonly WhereShorthand<T>[];
|
|
1746
|
-
readonly or?: readonly WhereShorthand<T>[];
|
|
1747
|
-
readonly not?: WhereShorthand<T>;
|
|
1748
|
-
} & ("subject" extends keyof T ? { readonly [K in keyof T as Exclude<K, "subject">]?: FieldWhere<T[K]>; } & {
|
|
1749
|
-
readonly subject?: SubjectWhere | FieldWhere<T["subject"]>;
|
|
1750
|
-
} : { readonly [K in keyof T]?: FieldWhere<T[K]>; } & {
|
|
1751
|
-
/** Holds only when the resolver checked the session live (`liveSession: true`). */
|
|
1752
|
-
readonly subject?: SubjectWhere;
|
|
1753
|
-
});
|
|
1754
|
-
type SubjectWhere = {
|
|
1755
|
-
readonly session: {
|
|
1756
|
-
readonly live: true;
|
|
1757
|
-
};
|
|
1758
|
-
};
|
|
1759
|
-
type FieldWhere<V> = V | FieldOperator | {
|
|
1760
|
-
readonly ref: string;
|
|
1761
|
-
};
|
|
1762
1859
|
//#endregion
|
|
1763
|
-
//#region src/core/
|
|
1764
|
-
|
|
1765
|
-
type UserApprover = {
|
|
1766
|
-
readonly kind: "user";
|
|
1767
|
-
readonly id: string;
|
|
1768
|
-
};
|
|
1769
|
-
/**
|
|
1770
|
-
* Whoever holds `permission` in the request's tenant, through any role,
|
|
1771
|
-
* custom roles included. Checked only through verdict facts
|
|
1772
|
-
* (`ApprovalVerdict.permissions`) that the handler computes from the
|
|
1773
|
-
* approver's own instance.
|
|
1774
|
-
*/
|
|
1775
|
-
type PermissionApprover = {
|
|
1776
|
-
readonly kind: "permission";
|
|
1777
|
-
readonly permission: string;
|
|
1778
|
-
};
|
|
1779
|
-
/** An approver who matches at least one item; an item that is a list matches when every entry does. */
|
|
1780
|
-
type AnyOfApprover = {
|
|
1781
|
-
readonly kind: "any-of";
|
|
1782
|
-
readonly of: readonly (Approver | readonly Approver[])[];
|
|
1783
|
-
};
|
|
1784
|
-
/**
|
|
1785
|
-
* Who may approve: a subject-only grantee, a `relation()` the approver holds
|
|
1786
|
-
* on the requested row (checked when the verdict is given), `user(id)`,
|
|
1787
|
-
* `holder(permission)`, or `anyOf(...)`. A list (or `allOf(...)`) matches an
|
|
1788
|
-
* approver who satisfies every item.
|
|
1789
|
-
*/
|
|
1790
|
-
type Approver = Grantee | UserApprover | PermissionApprover | AnyOfApprover;
|
|
1791
|
-
type ApproverInput = GranteeInput | UserApprover | PermissionApprover | {
|
|
1792
|
-
readonly kind: "any-of";
|
|
1793
|
-
readonly of: readonly ApproverInput[];
|
|
1794
|
-
} | readonly ApproverInput[];
|
|
1795
|
-
/** Approves when the approver holds `permission` in the request's tenant (any role, custom roles included). */
|
|
1796
|
-
declare function holder(permission: Permission): PermissionApprover;
|
|
1797
|
-
/** Approves when the approver matches any one of `items`. */
|
|
1798
|
-
declare function anyOf(...items: readonly ApproverInput[]): {
|
|
1799
|
-
readonly kind: "any-of";
|
|
1800
|
-
readonly of: readonly ApproverInput[];
|
|
1801
|
-
};
|
|
1802
|
-
/** Approves when the approver matches every one of `items`; the same as a list. */
|
|
1803
|
-
declare function allOf(...items: readonly ApproverInput[]): readonly ApproverInput[];
|
|
1804
|
-
/** A named approver for `approval.by`, matched on the approver's principal id. */
|
|
1805
|
-
declare function user(id: string): UserApprover;
|
|
1860
|
+
//#region src/core/policy-fingerprint.d.ts
|
|
1861
|
+
declare const POLICY_X: unique symbol;
|
|
1806
1862
|
//#endregion
|
|
1807
|
-
//#region src/core/policy.d.ts
|
|
1863
|
+
//#region src/core/policy-types.d.ts
|
|
1808
1864
|
type ClosureContext = {
|
|
1809
1865
|
readonly subject: {
|
|
1810
1866
|
readonly principal: Principal | null;
|
|
@@ -1988,9 +2044,20 @@ type GrantOptions<T = Record<string, unknown>> = {
|
|
|
1988
2044
|
readonly limit?: GrantLimit;
|
|
1989
2045
|
readonly reason?: string;
|
|
1990
2046
|
readonly fields?: readonly (keyof T & string)[];
|
|
1991
|
-
/**
|
|
2047
|
+
/**
|
|
2048
|
+
* A stable name for the grant. On a deny, a `breakGlass` override may lift
|
|
2049
|
+
* it; on any grant, it is reported on `decision.matched.name` and on
|
|
2050
|
+
* decision events.
|
|
2051
|
+
*/
|
|
1992
2052
|
readonly name?: string;
|
|
1993
2053
|
readonly group?: string;
|
|
2054
|
+
/** Display text and app data for the grant, reported on `decision.matched.meta`; never read in evaluation. */
|
|
2055
|
+
readonly meta?: GrantMeta;
|
|
2056
|
+
/**
|
|
2057
|
+
* Follow-ups the application owes when this allow grants: each becomes a
|
|
2058
|
+
* `{ kind: 'app', name, detail? }` obligation on the decision. Allows only.
|
|
2059
|
+
*/
|
|
2060
|
+
readonly obligations?: readonly ObligationInput[];
|
|
1994
2061
|
/** Purposes of use (`context.purpose`) that make the grant apply; non-portable. */
|
|
1995
2062
|
readonly purpose?: readonly string[];
|
|
1996
2063
|
/** The grant applies from this instant on (RFC 3339 string or Unix seconds); before it an allow denies with `inactive-grant` and a deny does not apply. */
|
|
@@ -2004,6 +2071,17 @@ type GrantOptions<T = Record<string, unknown>> = {
|
|
|
2004
2071
|
*/
|
|
2005
2072
|
readonly requires?: Permission | readonly Permission[];
|
|
2006
2073
|
};
|
|
2074
|
+
/** A grant's metadata. PermDock carries it to decisions, events, snapshots and the catalog and never reads `x`. */
|
|
2075
|
+
type GrantMeta = {
|
|
2076
|
+
readonly description?: string;
|
|
2077
|
+
/** Data the application owns. Plain JSON, checked by `definePolicy(…, { x: { grant } })`. */
|
|
2078
|
+
readonly x?: AppData;
|
|
2079
|
+
};
|
|
2080
|
+
/** An app obligation as declared on an allow: its name, or its name and detail. */
|
|
2081
|
+
type ObligationInput = string | {
|
|
2082
|
+
readonly name: string;
|
|
2083
|
+
readonly detail?: MetaValue;
|
|
2084
|
+
};
|
|
2007
2085
|
/**
|
|
2008
2086
|
* When a grant applies, in Unix seconds. `from` is inclusive, `until`
|
|
2009
2087
|
* exclusive; either may be absent. Portable: `where()` drops an inactive
|
|
@@ -2091,9 +2169,12 @@ type Grant = {
|
|
|
2091
2169
|
readonly limit?: GrantLimit;
|
|
2092
2170
|
readonly fields?: readonly string[];
|
|
2093
2171
|
readonly scope: GrantScope;
|
|
2094
|
-
/**
|
|
2172
|
+
/** The grant's stable name: a `breakGlass` override lifts a named deny, and `decision.matched.name` reports it. */
|
|
2095
2173
|
readonly name?: string;
|
|
2096
2174
|
readonly group?: string;
|
|
2175
|
+
readonly meta?: GrantMeta;
|
|
2176
|
+
/** App obligations an allow adds to its granted decision. */
|
|
2177
|
+
readonly obligations?: readonly AppObligation[];
|
|
2097
2178
|
/** Purposes of use that make the grant apply (`context.purpose`); non-portable. */
|
|
2098
2179
|
readonly purpose?: readonly string[];
|
|
2099
2180
|
/** Set on a break-glass allow: it overrides named denies and carries obligations. */
|
|
@@ -2158,6 +2239,8 @@ type Policy<TUser = unknown, TPrincipal extends Principal = Principal, V extends
|
|
|
2158
2239
|
readonly onDenied?: (decision: unknown) => never | void;
|
|
2159
2240
|
readonly fingerprint: string;
|
|
2160
2241
|
readonly resources: ReadonlyMap<string, ResourceNode>;
|
|
2242
|
+
/** The app data schemas `definePolicy` was given; symbol-keyed so freezing the policy leaves the schemas alone. */
|
|
2243
|
+
readonly [POLICY_X]?: PolicyAppDataSchemas;
|
|
2161
2244
|
readonly providers?: readonly DecisionProvider[];
|
|
2162
2245
|
/** Permission keys a hosted policy document may grant or deny; empty by default. */
|
|
2163
2246
|
readonly hostable: readonly string[];
|
|
@@ -2187,23 +2270,21 @@ type PolicyIndex = {
|
|
|
2187
2270
|
/** The grants `grantList` returns, by permission key, in the same order. */
|
|
2188
2271
|
readonly grantsByKey: ReadonlyMap<string, readonly Grant[]>;
|
|
2189
2272
|
};
|
|
2190
|
-
declare function normalizeApproval(approval: ApprovalOption | undefined, permission?: string): Grant["approval"];
|
|
2191
2273
|
type GrantCondition<T, K extends PermissionKind> = K extends "collection" ? Omit<GrantOptions<T>, "where" | "fields"> | ClosureGrantFn<T> : GrantOptions<T> | ClosureGrantFn<T>;
|
|
2192
|
-
declare function allow<T, K extends PermissionKind = PermissionKind>(permission: Permission<string, T, K> | readonly Permission<string, T, K>[], condition?: GrantCondition<T, K>): Omit<Grant, "role" | "scope"> | Omit<Grant, "role" | "scope">[];
|
|
2193
|
-
declare function deny<T, K extends PermissionKind = PermissionKind>(permission: Permission<string, T, K> | readonly Permission<string, T, K>[], condition?: GrantCondition<T, K>): Omit<Grant, "role" | "scope"> | Omit<Grant, "role" | "scope">[];
|
|
2194
|
-
type RoleGrants = readonly (Omit<Grant, "role" | "scope"> | readonly Omit<Grant, "role" | "scope">[])[];
|
|
2195
|
-
/** A role held at a named scope: `on` is checked against `definePolicy({ scopes })`. */
|
|
2196
|
-
declare function role<const S extends string>(name: string | Role, grants: RoleGrants, options: RoleOptions<S> & {
|
|
2197
|
-
readonly on: S;
|
|
2198
|
-
}): RoleBinding<S>;
|
|
2199
|
-
/** A global role, or one held on a resource. */
|
|
2200
|
-
declare function role(name: string | Role, grants: RoleGrants, options?: RoleOptions<never>): RoleBinding<never>;
|
|
2201
|
-
/** Options built at runtime: the scope name is only checked by `definePolicy`. */
|
|
2202
|
-
declare function role(name: string | Role, grants: RoleGrants, options?: RoleOptions): RoleBinding;
|
|
2203
|
-
declare function normalizeAssurance(input: AssuranceRequirement | undefined): AssuranceRequirement | undefined;
|
|
2204
2274
|
/** Resource name to level name to its normalised condition. */
|
|
2205
2275
|
type PolicyLevels = Readonly<Record<string, Readonly<Record<string, Condition>>>>;
|
|
2276
|
+
/**
|
|
2277
|
+
* Standard Schemas for the app data a policy carries. `grant` checks every
|
|
2278
|
+
* grant's `meta.x` at `definePolicy` and throws on invalid data; `membership`
|
|
2279
|
+
* checks `Membership.x` as each subject resolves, dropping an invalid `x`
|
|
2280
|
+
* (never the membership) with an `on('auth')` event of reason `schema`.
|
|
2281
|
+
*/
|
|
2282
|
+
type PolicyAppDataSchemas = {
|
|
2283
|
+
readonly grant?: AppDataSchema<unknown>;
|
|
2284
|
+
readonly membership?: AppDataSchema<unknown>;
|
|
2285
|
+
};
|
|
2206
2286
|
type DefinePolicyOptions<TUser, TPrincipal extends Principal, S extends PolicyScopesInput = PolicyScopesInput> = {
|
|
2287
|
+
readonly x?: PolicyAppDataSchemas;
|
|
2207
2288
|
readonly roles?: readonly RoleBinding<ScopeNames<S>>[];
|
|
2208
2289
|
readonly grants?: readonly (Omit<Grant, "role" | "scope"> | readonly Omit<Grant, "role" | "scope">[] | Grant)[];
|
|
2209
2290
|
/**
|
|
@@ -2243,7 +2324,6 @@ type DefinePolicyOptions<TUser, TPrincipal extends Principal, S extends PolicySc
|
|
|
2243
2324
|
*/
|
|
2244
2325
|
readonly oauthScopes?: Readonly<Record<string, readonly (Permission | PermissionTree)[]>>;
|
|
2245
2326
|
};
|
|
2246
|
-
declare function definePolicy<TUser, TPrincipal extends Principal, const Input extends PermissionTree | PolicyVocabulary, const S extends PolicyScopesInput = PolicyScopesInput>(permissions: Input, options: DefinePolicyOptions<TUser, TPrincipal, S>): Policy<TUser, TPrincipal, VocabularyFromInput<Input>>;
|
|
2247
2327
|
type MembershipFixture = {
|
|
2248
2328
|
readonly principal?: string;
|
|
2249
2329
|
readonly tenant?: string;
|
|
@@ -2254,7 +2334,6 @@ type SeparationConflict = {
|
|
|
2254
2334
|
readonly tenant?: string;
|
|
2255
2335
|
readonly roles: readonly [string, string];
|
|
2256
2336
|
};
|
|
2257
|
-
declare function separationConflicts(policy: Policy, memberships: readonly MembershipFixture[]): readonly SeparationConflict[];
|
|
2258
2337
|
type PrincipalOf<P> = P extends Policy<unknown, infer TPrincipal> ? TPrincipal : Principal;
|
|
2259
2338
|
type SubjectOf<P> = {
|
|
2260
2339
|
readonly principal: PrincipalOf<P> | null;
|
|
@@ -2265,4 +2344,4 @@ type SubjectOf<P> = {
|
|
|
2265
2344
|
readonly expiresAt?: number;
|
|
2266
2345
|
};
|
|
2267
2346
|
//#endregion
|
|
2268
|
-
export {
|
|
2347
|
+
export { RelationGroup as $, inherit as $n, validateApprovalPolicy as $t, PolicyScopes as A, ArazzoFinding as An, VerifiedClaims as Ar, DeriveOptions as At, ValidateMode as B, UserApprover as Bn, SqlFunctionArg as Br, HostedGrantDropped as Bt, HostedGrantRef as C, MembershipEvent as Cn, CustomRoleGrant as Cr, DecideCredentialOptions as Ct, PolicyAppDataSchemas as D, ActivateInput as Dn, Membership as Dr, decideCredential as Dt, Policy as E, WireDenial as En, JsonWebKeyLike as Er, credentialSubject as Et, RoleScope as F, simulateArazzo as Fn, MemberOfParent as Fr, SnapshotOptions as Ft, EntitlementSource as G, Grantee as Gn, isConditionRef as Gr, mergeHostedGrants as Gt, CredentialVerifier as H, anyOf as Hn, hasConditionOp as Hr, PolicySource as Ht, SeparationConflict as I, AnyOfApprover as In, OpaqueCondition as Ir, WhereResult as It, LimitRemaining as J, RelationGrantee as Jn, ApprovalPolicy as Jt, JwtClaims as K, GranteeInput as Kn, isSqlFunctionField as Kr, parsePolicyDocument as Kt, SubjectOf as L, Approver as Ln, RelatedCondition as Lr, createPermDock as Lt, PrincipalOf as M, ArazzoSimulateInput as Mn, ConditionRef as Mr, PermDockOptions as Mt, RoleBinding as N, ArazzoStepResult as Nn, ConditionValue as Nr, RowPair as Nt, PolicyDelegation as O, breakGlass as On, Principal as Or, parseCredential as Ot, RoleOptions as P, arazzoFindings as Pn, MemberOfCondition as Pr, SimulateOptions as Pt, RelationChain as Q, authenticated as Qn, memoryApprovalPolicies as Qt, SupportAccessOptions as R, ApproverInput as Rn, RelatedHop as Rr, HostedGrant as Rt, GrantValidity as S, DirectoryEvent as Sn, CustomRole as Sr, CredentialRequest as St, ObligationInput as T, WireDecision as Tn, GnapAccess as Tr, credentialPolicyViolation as Tt, DecisionProvider as U, holder as Un, isCondition as Ur, isPortableCondition as Ut, VocabularyFromInput as V, allOf as Vn, SqlFunctionCondition as Vr, PolicyDocument as Vt, DecisionSink as W, user as Wn, isConditionDate as Wr, memoryPolicySource as Wt, MemberEntry as X, anyone as Xn, ApprovalPolicySource as Xt, LimitStore as Y, actor as Yn, ApprovalPolicyProblem as Yt, MembershipSource as Z, assurance as Zn, ApprovalPolicyValidation as Zt, GrantCondition as _, ScopeNames as _n, TraceSkipReason as _r, CredentialPermission as _t, ApprovalRequirement as a, Snapshot as an, Denial as ar, SnapshotSource as at, GrantOptions as b, CredentialEvent as bn, AuthorizationDetail as br, CredentialPolicyViolation as bt, BreakGlassOptions as c, SnapshotNotEntitled as cn, DeniedDecision as cr, TokenFailureCause as ct, ClosureContext as d, RoleChangeDecision as dn, LimitDetail as dr, VerificationFailure as dt, Holder as en, plan as er, RelationHolder as et, ClosureGrantFn as f, RoleChangeOptions as fn, MatchedGrant as fr, VerifiedToken as ft, Grant as g, ScopeDeclaration as gn, TraceSkip as gr, CredentialKind as gt, DelegationTarget as h, Scope as hn, Trace as hr, CredentialDecision as ht, ApprovalOption as i, LocalSnapshotManifest as in, Decision as ir, SettingsSource as it, PolicyVocabulary as j, ArazzoPlan as jn, Condition as jr, PermDock as jt, PolicyOAuthScope as k, supportAccess as kn, Subject as kr, DecideOptions as kt, BreakGlassRequirements as l, SnapshotScope as ln, ExplainedDecision as lr, TokenSigner as lt, DelegationInput as m, PolicyScopesInput as mn, Quota as mr, Credential as mt, ApprovalEscalation as n, WhoCan as nn, AppObligation as nr, RoleSource as nt, ApprovalStage as o, SnapshotAssignable as on, DenialDetails as or, SubjectResolver as ot, DefinePolicyOptions as p, RoleChangeTarget as pn, Obligation as pr, WhereCompiler as pt, LimitConsumeInput as q, InheritGrantee as qn, APPROVAL_POLICY_UNAVAILABLE as qt, ApprovalMode as r, LocalCustomRoleTable as rn, ApprovalRequiredDecision as rr, RoleSourceFactory as rt, AssuranceRequirement as s, SnapshotGrant as sn, DenialReason as sr, TenantSettings as st, ActivationOption as t, HoldingVia as tn, relation as tr, RelationSource as tt, BreakGlassSpec as u, RoleChange as un, GrantedDecision as ur, TokenVerifier as ut, GrantLimit as v, AccessEvent as vn, Actor as vr, CredentialPermissionInput as vt, MembershipFixture as w, SinkEvent as wn, Delegation as wr, credentialDelegation as wt, GrantScope as x, DecisionEvent as xn, Binding as xr, CredentialPrincipal as xt, GrantMeta as y, AuthEvent as yn, Assurance as yr, CredentialPolicy as yt, SupportConsent as z, PermissionApprover as zn, RestrictedAncestors as zr, HostedGrantDropReason as zt };
|