permdock 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -47
- package/dist/a2a/index.d.ts +7 -16
- package/dist/a2a/index.js +59 -98
- package/dist/adapter-context-mlWsVGGg.js +23 -0
- package/dist/ai-sdk/index.d.ts +37 -16
- package/dist/ai-sdk/index.js +30 -13
- package/dist/approvals/index.d.ts +3 -3
- package/dist/approvals/index.js +5 -4
- package/dist/{approvals-DaxY-Bdg.js → approvals-DbYAuNkG.js} +17 -11
- package/dist/approvers-DT4AVyIg.js +52 -0
- package/dist/{arazzo-CTeVuXr5.js → arazzo-BAgw9ap6.js} +2 -2
- package/dist/{arazzo-aoTkqYsJ.js → arazzo-CKwwqFWz.js} +2 -2
- package/dist/authzen/index.d.ts +4 -13
- package/dist/authzen/index.js +16 -50
- package/dist/better-auth/index.d.ts +20 -3
- package/dist/better-auth/index.js +27 -7
- package/dist/better-supabase/index.d.ts +223 -0
- package/dist/better-supabase/index.js +648 -0
- package/dist/bind-C_ob3LKa.d.ts +25 -0
- package/dist/bind-CuzGytRf.js +97 -0
- package/dist/boundary-BM8a_P6E.js +13 -0
- package/dist/boundary-BmHxVH1J.d.ts +15 -0
- package/dist/canonical-json-DemiK4Vp.js +26 -0
- package/dist/{capability-BDG_nkxt.d.ts → capability-2kYTMWDv.d.ts} +2 -2
- package/dist/{capability-B68OFnZx.js → capability-4qPdO9gk.js} +7 -5
- package/dist/catalog/index.d.ts +1 -1
- package/dist/catalog/index.js +1 -1
- package/dist/catalog-CRW5Mx_B.js +2 -0
- package/dist/{catalog-H-vFGwWK.js → catalog-DWF5cYqB.js} +4 -4
- package/dist/{catalog-B0E6bggc.js → catalog-dFZdWCGN.js} +2 -2
- package/dist/{catalog-doc-BSo_Q_-6.js → catalog-doc-DdGm82XT.js} +20 -32
- package/dist/claude-agent/index.d.ts +5 -14
- package/dist/claude-agent/index.js +4 -10
- package/dist/clerk/index.d.ts +12 -3
- package/dist/clerk/index.js +26 -5
- package/dist/cli/bin.js +1 -1
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +2 -2
- package/dist/clients-C7zLFuWT.d.ts +12 -0
- package/dist/clients-DjU5ABMy.js +23 -0
- package/dist/cloud/index.d.ts +4 -5
- package/dist/cloud/index.js +20 -6
- package/dist/{cloud-BNQTrmrr.js → cloud-CB_ELYuX.js} +2 -2
- package/dist/{cloud-Cuxr6Czw.js → cloud-DWLXO2af.js} +7 -6
- package/dist/collect-DClJsheJ.js +83 -0
- package/dist/{collect-O-tOtbnk.js → collect-DSTE3ml9.js} +194 -42
- package/dist/collect-DSWOk19R.js +2 -0
- package/dist/{commands-BMh_Etm2.js → commands-DSxCqG9A.js} +16 -12
- package/dist/compile/index.d.ts +3 -0
- package/dist/compile/index.js +2 -0
- package/dist/{compile-D22iwvuV.js → compile-Ba4blROR.js} +85 -30
- package/dist/compile-BkRyBDBw.d.ts +94 -0
- package/dist/config-BJiM-xAm.js +157 -0
- package/dist/config-Dnszbv-6.js +36 -0
- package/dist/config-report-DMvWKUxL.js +44 -0
- package/dist/{connection-JvqwHODC.js → connection-CU8MQxRi.js} +1 -1
- package/dist/{context-CKEAabd7.js → context-Bcy85rGi.js} +36 -27
- package/dist/convex/index.d.ts +9 -4
- package/dist/convex/index.js +14 -4
- package/dist/create-B1d519XK.d.ts +245 -0
- package/dist/create-CMwIl-w2.js +253 -0
- package/dist/{credential-B_rkUNlY.js → credential-8P81ff4u.js} +26 -46
- package/dist/delegation-D8pUEuce.js +103 -0
- package/dist/{describe-Bt1YD5uS.js → describe-B_gVZEVi.js} +10 -15
- package/dist/{describe-DernyItf.d.ts → describe-DMYiCjJV.d.ts} +9 -10
- package/dist/{diff-x5Il8LVa.js → diff-2VaeChzX.js} +44 -11
- package/dist/{diff-BUzf5Poi.js → diff-DBIhz_f2.js} +2 -2
- package/dist/{doctor-Bqo6FwUa.js → doctor-BwCAMLx_.js} +2 -2
- package/dist/doctor-collect-CHk6XWOA.js +665 -0
- package/dist/doctor-igIiM_Hl.js +1194 -0
- package/dist/drizzle/index.d.ts +4 -3
- package/dist/drizzle/index.js +3 -3
- package/dist/elysia/index.d.ts +6 -28
- package/dist/elysia/index.js +16 -60
- package/dist/{errors-DSMnAVNa.js → errors-CWfoNg9N.js} +8 -4
- package/dist/{errors-Iy71s7Oj.js → errors-Cz5zn0mW.js} +17 -71
- package/dist/{errors-DbZ1YOnb.d.ts → errors-DPdqI50v.d.ts} +8 -21
- package/dist/{errors-m3u9TmDu.js → errors-DRnGZHzF.js} +4 -1
- package/dist/evaluation-items-CfCCejQd.js +40 -0
- package/dist/{evaluations-DsAU9ppl.js → evaluations-tz6D9A2G.js} +28 -46
- package/dist/eve/index.d.ts +6 -15
- package/dist/eve/index.js +7 -12
- package/dist/expiry-BoBJ8Tvc.js +7 -0
- package/dist/express/index.d.ts +6 -29
- package/dist/express/index.js +28 -58
- package/dist/fastify/index.d.ts +6 -29
- package/dist/fastify/index.js +16 -65
- package/dist/fields-BMl1RxoX.js +26 -0
- package/dist/{files-B_wAGYmt.js → files-DWUN9PzI.js} +5 -1
- package/dist/{fixtures-Cvaw0gDG.js → fixtures-ht28Cplr.js} +5 -2
- package/dist/{freeze-y1_jQL4v.js → freeze-CrU8nQeX.js} +31 -2
- package/dist/{from-snapshot-BMGnhmgv.js → from-snapshot-CTLijvdm.js} +66 -48
- package/dist/{grantee-Bv04_Vzf.js → grantee-Cv5Sogfv.js} +88 -7
- package/dist/graph-sql-B-dsAT6j.d.ts +29 -0
- package/dist/{headers-B5RRv3Xm.js → headers-BZSDieNT.js} +1 -1
- package/dist/{headers-C8SHQccD.d.ts → headers-Cf-zWvsO.d.ts} +1 -1
- package/dist/helpers-H_KARDVC.js +421 -0
- package/dist/hono/index.d.ts +6 -28
- package/dist/hono/index.js +11 -43
- package/dist/{hosted-BwKQ1BTA.js → hosted-DJQw46hn.js} +6 -5
- package/dist/{http-GgVApX1k.js → http-BIhmLfCc.js} +4 -20
- package/dist/http-SO7qGttf.js +44 -0
- package/dist/ids-DC4V4CFu.js +18 -0
- package/dist/index-0nNqHspG.d.ts +6 -0
- package/dist/{index-xIxJLwOQ.d.ts → index-BNc7Wer_.d.ts} +75 -7
- package/dist/{index-CltcQ4Bf.d.ts → index-C7Tw7MaW.d.ts} +68 -5
- package/dist/{index-LF_hS-yn.d.ts → index-C8z4RjQV.d.ts} +1 -1
- package/dist/index.d.ts +14 -9
- package/dist/index.js +22 -17
- package/dist/instance-options-Dhhcnm3y.js +22 -0
- package/dist/instance-options-jARdwfPN.d.ts +11 -0
- package/dist/{parse-DPfIvFMU.js → json-schema-BsAflUGW.js} +28 -57
- package/dist/jwt/index.d.ts +10 -6
- package/dist/jwt/index.js +32 -13
- package/dist/kernel-_RRHmnMY.js +208 -0
- package/dist/kysely/index.d.ts +4 -3
- package/dist/kysely/index.js +3 -3
- package/dist/live-options-H2eG8dfJ.js +60 -0
- package/dist/{load-BZ24CpZP.js → load-DhWEB9P1.js} +16 -10
- package/dist/load-DwJUafYN.js +2 -0
- package/dist/manifest-iaoBXHKc.js +783 -0
- package/dist/manifest-uDS9y5de.d.ts +206 -0
- package/dist/{map-DowSO96j.js → map-AcxK9o_D.js} +4 -15
- package/dist/{map-claims-B_6I1Rn-.js → map-claims-Z4QZOiFF.js} +13 -4
- package/dist/map-error-pgUWNNtG.js +23 -0
- package/dist/may-use-DndQ5tQ-.js +77 -0
- package/dist/mcp/index.d.ts +54 -22
- package/dist/mcp/index.js +218 -178
- package/dist/nest/index.d.ts +26 -31
- package/dist/nest/index.js +75 -84
- package/dist/next/client.d.ts +7 -8
- package/dist/next/client.js +11 -9
- package/dist/next/index.d.ts +30 -47
- package/dist/next/index.js +45 -60
- package/dist/next/plugin.d.ts +1 -1
- package/dist/next/plugin.js +32 -1
- package/dist/node/index.d.ts +9 -28
- package/dist/node/index.js +11 -43
- package/dist/openai/index.d.ts +6 -15
- package/dist/openai/index.js +7 -20
- package/dist/openapi/index.d.ts +87 -4
- package/dist/openapi/index.js +3 -3
- package/dist/{openapi-DcqM8nU7.js → openapi-BqRBvAng.js} +237 -5
- package/dist/{openapi-DWD0Uc_4.js → openapi-CqqEbHsL.js} +5 -5
- package/dist/{openapi-import-BWRUNNeW.js → openapi-import-cmwetbzw.js} +1 -1
- package/dist/{openapi-CwePaF7C.js → openapi-l0xYHkcv.js} +3 -3
- package/dist/{openapi-schema-D8j_T9tO.js → openapi-schema--ARjyfQr.js} +2 -2
- package/dist/orpc/index.d.ts +15 -28
- package/dist/orpc/index.js +74 -117
- package/dist/otel/index.d.ts +2 -2
- package/dist/parse-BuyjxhZV.js +53 -0
- package/dist/parse-local-manifest-BrMozJCo.js +36 -0
- package/dist/parse-local-manifest-JLnaBH0S.d.ts +10 -0
- package/dist/pdp/index.d.ts +2 -2
- package/dist/pdp/index.js +14 -127
- package/dist/{permdock-yoZ7EjxX.js → permdock-CbgvLnuo.js} +672 -149
- package/dist/{permissions-B8vCg_bI.d.ts → permissions-CDgvKG5L.d.ts} +2 -2
- package/dist/{permissions-DC7GROPA.js → permissions-DVoF6dMt.js} +77 -15
- package/dist/{permissions-B4apnahQ.d.ts → permissions-DttnqqxC.d.ts} +34 -5
- package/dist/{permissions-CofRqesP.js → permissions-RJrovw98.js} +3 -3
- package/dist/{pins-CqE1jZuF.js → pins-8ILTftC9.js} +2 -2
- package/dist/{policy-Cq2fB8Q5.d.ts → policy-D2W7uv19.d.ts} +2 -2
- package/dist/{policy-CInmNGkM.d.ts → policy-IB6yxpC3.d.ts} +351 -42
- package/dist/{policy-ANp36PnI.js → policy-xyWg7QdR.js} +173 -22
- package/dist/powersync-BylawD_U.js +540 -0
- package/dist/powersync-DliZK_-y.js +62 -0
- package/dist/powersync-e_AZrKbg.js +2 -0
- package/dist/prisma/index.d.ts +3 -2
- package/dist/prisma/index.js +45 -20
- package/dist/{problem-Cgp9-KZA.js → problem-B43ztKIm.js} +74 -109
- package/dist/problem-details-DX075l9V.d.ts +7 -0
- package/dist/problem-details-_AMOYz-w.js +144 -0
- package/dist/{protected-BuPAycJT.d.ts → protected-BdnIEFkY.d.ts} +5 -4
- package/dist/protected-utU-SLuy.js +100 -0
- package/dist/protected-xAr24FEC.d.ts +40 -0
- package/dist/provider-CSQd7m92.js +52 -0
- package/dist/{provider-wTAUda2v.d.ts → provider-DZY281jO.d.ts} +1 -1
- package/dist/provider-store-Cfbvo4DE.js +43 -0
- package/dist/react/index.d.ts +7 -5
- package/dist/react/index.js +5 -4
- package/dist/react/provider-client.d.ts +1 -1
- package/dist/react/provider-client.js +1 -1
- package/dist/react-native/index.d.ts +166 -10
- package/dist/react-native/index.js +607 -85
- package/dist/{refs-ChLSxbST.js → refs-KYb4ntaz.js} +4 -3
- package/dist/{relations-r4soIFZB.js → relations-cjOL01hZ.js} +110 -31
- package/dist/replay-BsOyTrdV.js +28 -0
- package/dist/replay-CYyiLiwO.d.ts +5 -0
- package/dist/resource-ref-CaS9yVPi.js +20 -0
- package/dist/revocations-Bhr0aMIC.js +27 -0
- package/dist/{rls-BOFU3chG.js → rls-B4ur8nKQ.js} +8 -3
- package/dist/rls-DQtdgTHB.js +2521 -0
- package/dist/rls-fields-74oZPXWL.js +3582 -0
- package/dist/{rls-graph-DxQ39PJj.js → rls-graph-CHwx0V8q.js} +100 -36
- package/dist/{rls-import-CXV6LBlS.js → rls-import-BTFVk3jH.js} +7 -6
- package/dist/{rls-migrate-DrFPbf8p.js → rls-migrate-CN4TlJTO.js} +6 -5
- package/dist/rls-ownership-RuFqaqGz.js +843 -0
- package/dist/rls-shared-Cewd_-zI.js +495 -0
- package/dist/rls-verify-CVQTHTh5.js +746 -0
- package/dist/{row-check-BajTgQZ-.d.ts → row-check-Dt35czLy.d.ts} +12 -15
- package/dist/row-conditions-h2HythXQ.js +27 -0
- package/dist/rpc-DL9Sqvb1.js +89 -0
- package/dist/{run-CJ6UvS3a.js → run-DKDbM4Du.js} +31 -12
- package/dist/runtime-CB8gQFvS.js +11 -0
- package/dist/{saas-BRrZzJkM.js → saas-DhpJjnBA.js} +17 -7
- package/dist/{schema-P8yoma__.js → schema-D3MnDMxa.js} +8 -4
- package/dist/scim/index.d.ts +1 -1
- package/dist/scim/index.js +1 -1
- package/dist/{scim-9NFa0XVZ.js → scim-BFGBBAqR.js} +1 -1
- package/dist/{scopes-cKVp_WTw.js → scopes-CVdPrWN-.js} +35 -8
- package/dist/server/index.d.ts +22 -11
- package/dist/server/index.js +11 -8
- package/dist/{credentials-BgRX3WEg.js → server-DlZ28Oz5.js} +1 -1
- package/dist/shared-DRu8VFVM.js +123 -0
- package/dist/{sink-Cfr9-7YC.d.ts → sink-B1fZzIMf.d.ts} +1 -1
- package/dist/skills-Biq5uup3.js +192 -0
- package/dist/{skills-C_lpV4Jx.js → skills-Bx-U0irG.js} +10 -4
- package/dist/{snapshot-DE8dE_hz.js → snapshot-Enxd0n-s.js} +138 -214
- package/dist/snapshot-cache-B-LxUahj.d.ts +45 -0
- package/dist/snapshot-cache-D6jLelln.js +44 -0
- package/dist/solid/index.d.ts +39 -9
- package/dist/solid/index.js +76 -85
- package/dist/sources-4p0-4xQm.js +545 -0
- package/dist/sources-BdOYLw9j.d.ts +192 -0
- package/dist/{sql-Bll1d7y0.js → sql-xdg5f4Fi.js} +6 -1
- package/dist/{src-CTNT-PBW.js → src-BDwEZWrZ.js} +149 -11
- package/dist/ssf/index.d.ts +3 -2
- package/dist/ssf/index.js +3 -29
- package/dist/store-DMAWwAJV.js +371 -0
- package/dist/{store-Bq90395i.d.ts → store-jOBYpiXC.d.ts} +13 -4
- package/dist/store-options-ByhZq1jV.js +716 -0
- package/dist/{stores-CkG2HrSg.js → stores-BT2pSCub.js} +10 -63
- package/dist/{stores-CvOnu_2T.d.ts → stores-C0IMQrGI.d.ts} +20 -9
- package/dist/{stream-BhMfZOwr.d.ts → stream-D1RXubw2.d.ts} +2 -2
- package/dist/{stream-Q_xlB6Ko.js → stream-DDpvynSB.js} +16 -2
- package/dist/subject-settings-BwBmCdTR.js +128 -0
- package/dist/supabase/index.d.ts +133 -6
- package/dist/supabase/index.js +4 -3
- package/dist/supabase/middleware.d.ts +32 -27
- package/dist/supabase/middleware.js +56 -22
- package/dist/{supabase-D8UlBA7Z.js → supabase-Boqb9a_Y.js} +3 -3
- package/dist/{supabase-DTxGtYdi.js → supabase-C0qESOa-.js} +347 -367
- package/dist/supabase-config-BpPXt3x1.js +472 -0
- package/dist/supabase-hook-6sYLXg_u.js +2 -0
- package/dist/{supabase-hook-D_OqGb_V.js → supabase-hook-CSLQ4zJ3.js} +1037 -705
- package/dist/supautils-Cn4R4cJ4.js +91 -0
- package/dist/svelte/PermissionBoundary.svelte +37 -0
- package/dist/svelte/Protected.svelte +8 -2
- package/dist/svelte/index.d.ts +9 -6
- package/dist/svelte/index.js +61 -7
- package/dist/svelte/runtime.d.ts +4 -3
- package/dist/svelte/runtime.js +4 -3
- package/dist/svelte/source.d.ts +9 -6
- package/dist/svelte/source.js +7 -4
- package/dist/terminal/index.d.ts +6 -14
- package/dist/terminal/index.js +44 -32
- package/dist/testing/index.d.ts +105 -16
- package/dist/testing/index.js +504 -40
- 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/token-CIWxJOCh.js +50 -0
- package/dist/trpc/index.d.ts +7 -26
- package/dist/trpc/index.js +17 -100
- package/dist/types-BnIEz1sU.d.ts +48 -0
- package/dist/{types-CxquUByI.d.ts → types-Bvc4oWT6.d.ts} +1 -1
- package/dist/{sources-DOpW5Ila.d.ts → types-C97IskBw.d.ts} +86 -127
- package/dist/types-CKNSyIf_.d.ts +52 -0
- package/dist/types-Cq_H8N_X.d.ts +197 -0
- package/dist/{types-D6Z6-rKJ.d.ts → types-DbjRN55U.d.ts} +273 -22
- package/dist/{types-BBK-exvJ.d.ts → types-Dnemwd77.d.ts} +7 -1
- package/dist/{types-BvBk1wgn.d.ts → types-DxiCGmmd.d.ts} +5 -3
- package/dist/{types-B9dmiiab.d.ts → types-QCuYJh4q.d.ts} +1 -1
- package/dist/{types-B8w5PFtS.d.ts → types-aqOHTHcp.d.ts} +17 -1
- package/dist/unplugin/index.d.ts +1 -1
- package/dist/unplugin/index.js +10 -9
- package/dist/usage-DorAJiU_.js +2 -0
- package/dist/{usage-1ozMubLY.js → usage-GTixvDDU.js} +2 -2
- package/dist/{usage-CUnK6Ou9.js → usage-ItS7nLcl.js} +225 -62
- package/dist/validation-error-Ba264OaJ.d.ts +26 -0
- package/dist/validation-error-CnjZ4t92.js +33 -0
- package/dist/{validity-D0uRmJKJ.js → validity-uOp8UpYn.js} +57 -36
- package/dist/{verifier-B90agnhl.js → verifier-BxBo6I44.js} +10 -5
- package/dist/version-BvacVTZR.js +17 -0
- package/dist/views-Soe7bGSC.js +95 -0
- package/dist/{vocabulary-Dk0fs-Jk.d.ts → vocabulary-DA8a8zif.d.ts} +1 -1
- package/dist/vue/index.d.ts +35 -13
- package/dist/vue/index.js +86 -93
- package/dist/watch-BwxLTYMZ.js +2 -0
- package/dist/watch-DVBJ9cBq.js +128 -0
- package/dist/webmcp/index.d.ts +2 -2
- package/dist/webmcp/index.js +7 -13
- package/package.json +62 -36
- package/schemas/approval-request-v1.json +175 -0
- package/schemas/catalog-v1.json +29 -1
- package/schemas/supabase-claims-v1.json +6 -1
- package/schemas/supabase-manifest-v1.json +150 -6
- package/skills/permdock/SKILL.md +7 -7
- package/skills/permdock-agents/SKILL.md +5 -5
- package/skills/permdock-agents/references/runtimes.md +12 -10
- package/skills/permdock-approvals/SKILL.md +4 -4
- package/skills/permdock-approvals/references/stores-and-resume.md +15 -4
- package/skills/permdock-audit/SKILL.md +3 -3
- package/skills/permdock-credentials/SKILL.md +4 -4
- package/skills/permdock-credentials/references/tokens-keys-links.md +7 -2
- package/skills/permdock-data/SKILL.md +4 -4
- package/skills/permdock-data/references/queries-and-rls.md +14 -6
- package/skills/permdock-data/references/relationships.md +5 -3
- package/skills/permdock-tenancy/SKILL.md +9 -6
- package/skills/permdock-tenancy/references/ownership-and-custom-roles.md +14 -8
- package/skills/permdock-wire/SKILL.md +4 -4
- package/skills/permdock-wire/references/adapters.md +42 -30
- package/skills/permdock-wire/references/policy-options.md +5 -3
- package/dist/approvers-aH0PJkmf.js +0 -20
- package/dist/catalog-idsHc0vo.js +0 -2
- package/dist/collect-B7_TIfmg.js +0 -49
- package/dist/collect-fRPAQIWb.js +0 -2
- package/dist/compile-CQbvyIBr.d.ts +0 -30
- package/dist/config-BPYmjTOp.js +0 -26
- package/dist/context-gtAwAILx.js +0 -6
- package/dist/create-BKF3dgFk.d.ts +0 -162
- package/dist/create-CSkhDU9T.js +0 -222
- package/dist/doctor-BGle8Gqi.js +0 -1314
- package/dist/helpers-DnSOrhB9.js +0 -682
- package/dist/index-fG6NSXlc.d.ts +0 -9
- package/dist/kernel-YOGCWNLf.js +0 -211
- package/dist/load-QOOm1z70.js +0 -2
- package/dist/manifest-DDQbC6K0.d.ts +0 -118
- package/dist/map-error-RJ3ZsUyA.js +0 -16
- package/dist/may-use-CnFEjVEp.js +0 -37
- package/dist/pg-4GJWDUxG.js +0 -953
- package/dist/plugin-4gr7IxFJ.js +0 -65
- package/dist/protected-B4K3BKoX.js +0 -138
- package/dist/protected-wY7nXhY9.d.ts +0 -23
- package/dist/provider-_wx46HpB.js +0 -48
- package/dist/rls-CJVja9Ww.js +0 -2119
- package/dist/rls-helpers-BxRuif0l.js +0 -1346
- package/dist/runtime-DP9ttFh1.js +0 -27
- package/dist/skills-Dx3QLnMY.js +0 -110
- package/dist/source-DoBBYJi2.js +0 -6
- package/dist/sources-DVHM3Mwq.js +0 -284
- package/dist/store-C6hFW6ta.js +0 -508
- package/dist/subject-settings-xt7V845g.js +0 -82
- package/dist/supabase-hook-DW-xP4hU.js +0 -2
- package/dist/types-DbWdEfcm.d.ts +0 -87
- package/dist/types-bva3i4Gf.d.ts +0 -98
- package/dist/types-i4BAOvdb.d.ts +0 -97
- package/dist/usage-PyEor6GA.js +0 -2
- package/dist/version-CnSh33Fj.js +0 -16
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as RoleTree, i as RoleMeta, n as PlanTree, r as Role, t as Plan } from "./vocabulary-
|
|
1
|
+
import { f as Permission, m as PermissionTree, p as PermissionKind, y as ResourceNode } from "./permissions-DttnqqxC.js";
|
|
2
|
+
import { a as RoleTree, i as RoleMeta, n as PlanTree, r as Role, t as Plan } from "./vocabulary-DA8a8zif.js";
|
|
3
3
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
4
|
//#region src/conditions/ast.d.ts
|
|
5
5
|
type ConditionRef = {
|
|
@@ -82,11 +82,21 @@ type RelatedCondition = {
|
|
|
82
82
|
* the `relation` lookup (`relation` is then empty).
|
|
83
83
|
*/
|
|
84
84
|
readonly ids?: readonly string[];
|
|
85
|
+
readonly permission?: string;
|
|
85
86
|
/**
|
|
86
87
|
* The row's boolean column that keeps ancestor grants out: with `parent` or
|
|
87
88
|
* `hops`, a restricted row matches nothing; without, the walk stops at the row.
|
|
88
89
|
*/
|
|
89
90
|
readonly restricted?: string;
|
|
91
|
+
readonly restrictedAncestors?: RestrictedAncestors;
|
|
92
|
+
readonly passRestricted?: true;
|
|
93
|
+
};
|
|
94
|
+
type RestrictedAncestors = {
|
|
95
|
+
readonly resource: string;
|
|
96
|
+
readonly id: string;
|
|
97
|
+
readonly parent: string;
|
|
98
|
+
readonly depth: number;
|
|
99
|
+
readonly field: string;
|
|
90
100
|
};
|
|
91
101
|
type RelatedHop = {
|
|
92
102
|
readonly link: string;
|
|
@@ -107,7 +117,16 @@ type SqlFunctionCondition = {
|
|
|
107
117
|
readonly args: readonly SqlFunctionArg[];
|
|
108
118
|
readonly twin: Condition;
|
|
109
119
|
};
|
|
110
|
-
|
|
120
|
+
/**
|
|
121
|
+
* The request's session was checked against the Auth server while the
|
|
122
|
+
* subject was resolved (`liveSession: true`), not only verified from the
|
|
123
|
+
* token: a revoked session still verifies until `exp`. Written
|
|
124
|
+
* `{ subject: { session: { live: true } } }`.
|
|
125
|
+
*/
|
|
126
|
+
type LiveSessionCondition = {
|
|
127
|
+
readonly op: "liveSession";
|
|
128
|
+
};
|
|
129
|
+
type Condition = ComparisonCondition | InCondition | IsNullCondition | AndCondition | OrCondition | NotCondition | MemberOfCondition | RelatedCondition | OpaqueCondition | SqlFunctionCondition | LiveSessionCondition;
|
|
111
130
|
declare function isConditionRef(value: unknown): value is ConditionRef;
|
|
112
131
|
declare function isConditionDate(value: unknown): value is ConditionDate;
|
|
113
132
|
declare function isCondition(value: unknown): value is Condition;
|
|
@@ -172,6 +191,12 @@ type Membership = {
|
|
|
172
191
|
readonly managedBy?: "idp";
|
|
173
192
|
/** Seats this membership holds (`dev-mode`, `editor`); `plan()` grantees match them inside the active tenant. */
|
|
174
193
|
readonly entitlements?: readonly string[];
|
|
194
|
+
/**
|
|
195
|
+
* Set when the instance or an ancestor instance is suspended: the
|
|
196
|
+
* permission keys the membership still grants (`suspension.scopes.<scope>.keep`).
|
|
197
|
+
* Every other grant, allow or deny, ignores it, and so do role listings.
|
|
198
|
+
*/
|
|
199
|
+
readonly keep?: readonly string[];
|
|
175
200
|
/** Input only: an instance of the first scope. */
|
|
176
201
|
readonly tenant?: string;
|
|
177
202
|
/** Input only: an instance of the second scope, inside `tenant`. */
|
|
@@ -184,6 +209,8 @@ type Membership = {
|
|
|
184
209
|
type CustomRoleGrant = {
|
|
185
210
|
readonly permission: string;
|
|
186
211
|
readonly effect?: "allow" | "deny";
|
|
212
|
+
/** A level the permission's resource declares (`resource(…, { levels })`); allows only. */
|
|
213
|
+
readonly level?: string;
|
|
187
214
|
};
|
|
188
215
|
type CustomRoleBody = {
|
|
189
216
|
readonly name: string;
|
|
@@ -236,6 +263,8 @@ type Actor = {
|
|
|
236
263
|
readonly binding?: Binding;
|
|
237
264
|
/** `true` narrows every policy delegation to this actor to its read-only permissions (`readOnlyHint`). */
|
|
238
265
|
readonly readOnly?: boolean;
|
|
266
|
+
/** The stable name the application gives this OAuth client (`ClientNames`), set by the subject resolver from the verified client id; policy delegations match it with `to: { kind, client }`. */
|
|
267
|
+
readonly client?: string;
|
|
239
268
|
readonly [key: string]: unknown;
|
|
240
269
|
};
|
|
241
270
|
type AuthorizationDetail = {
|
|
@@ -259,6 +288,12 @@ type Subject<TPrincipal extends Principal = Principal> = {
|
|
|
259
288
|
readonly expiresAt?: number;
|
|
260
289
|
/** The token's memberships are behind the source's authorization version: `fresh` permissions deny. */
|
|
261
290
|
readonly stale?: true;
|
|
291
|
+
/**
|
|
292
|
+
* The resolver checked the session against the Auth server for this request
|
|
293
|
+
* (`liveSession: true`), so `{ subject: { session: { live: true } } }` holds.
|
|
294
|
+
* Never read from claims.
|
|
295
|
+
*/
|
|
296
|
+
readonly liveSession?: true;
|
|
262
297
|
};
|
|
263
298
|
//#endregion
|
|
264
299
|
//#region src/core/scopes.d.ts
|
|
@@ -322,7 +357,13 @@ type AssuranceGrantee = {
|
|
|
322
357
|
readonly amr?: readonly string[];
|
|
323
358
|
readonly maxAge?: number;
|
|
324
359
|
};
|
|
325
|
-
type
|
|
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;
|
|
326
367
|
type GranteeInput = Grantee | Role | Plan | string | readonly GranteeInput[];
|
|
327
368
|
declare function anyone(): AnyoneGrantee;
|
|
328
369
|
declare function authenticated(): AuthenticatedGrantee;
|
|
@@ -330,6 +371,9 @@ declare function relation(resource: Permission | PermissionTree, name: string, o
|
|
|
330
371
|
readonly through?: "parent" | readonly string[];
|
|
331
372
|
readonly depth?: number;
|
|
332
373
|
}): RelationGrantee;
|
|
374
|
+
declare function inherit(permission: Permission, options: {
|
|
375
|
+
readonly through: "parent" | readonly string[];
|
|
376
|
+
}): InheritGrantee;
|
|
333
377
|
declare function plan(name: Plan | string): PlanGrantee;
|
|
334
378
|
declare function actor(kind: string): ActorGrantee;
|
|
335
379
|
declare function assurance(options: {
|
|
@@ -466,11 +510,14 @@ type ApprovalPolicy = {
|
|
|
466
510
|
readonly tenant?: string;
|
|
467
511
|
/** Actor kinds it applies to (`['agent']`); absent: every call. A call without an actor never matches a list. */
|
|
468
512
|
readonly actors?: readonly string[];
|
|
469
|
-
/** A portable condition over the row. */
|
|
513
|
+
/** A portable condition over the row; instance permissions only, since a collection action has no row. */
|
|
470
514
|
readonly where?: Condition;
|
|
471
515
|
/** A portable condition over the call's input (the proposed row). */
|
|
472
516
|
readonly check?: Condition;
|
|
473
|
-
/**
|
|
517
|
+
/**
|
|
518
|
+
* The same shape as `allow(..., { approval })`. An `escalation` here widens
|
|
519
|
+
* only this entry's stages, never the code's.
|
|
520
|
+
*/
|
|
474
521
|
readonly approval: ApprovalOption;
|
|
475
522
|
};
|
|
476
523
|
/**
|
|
@@ -484,7 +531,31 @@ type ApprovalPolicySource = {
|
|
|
484
531
|
readonly tenants: readonly string[];
|
|
485
532
|
}): readonly ApprovalPolicy[] | Promise<readonly ApprovalPolicy[]>;
|
|
486
533
|
};
|
|
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";
|
|
487
536
|
declare function memoryApprovalPolicies(policies: readonly ApprovalPolicy[]): ApprovalPolicySource;
|
|
537
|
+
/**
|
|
538
|
+
* Why an `ApprovalPolicy` entry does not load. `unknown-permission`: the
|
|
539
|
+
* policy declares no such key (the entry applies to nothing). `invalid`: a
|
|
540
|
+
* field has the wrong shape or the approval option does not normalise.
|
|
541
|
+
* `where-on-collection`: `where` reads a row, which a collection action
|
|
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`.
|
|
545
|
+
*/
|
|
546
|
+
type ApprovalPolicyProblem = "unknown-permission" | "invalid" | "where-on-collection" | "stale-on-without-version";
|
|
547
|
+
type ApprovalPolicyValidation = {
|
|
548
|
+
readonly ok: true;
|
|
549
|
+
} | {
|
|
550
|
+
readonly ok: false;
|
|
551
|
+
readonly problem: ApprovalPolicyProblem;
|
|
552
|
+
};
|
|
553
|
+
/**
|
|
554
|
+
* Checks one entry against the policy the way `approvalPoliciesFor` loads
|
|
555
|
+
* it, for an application to refuse a bad entry when it is saved instead of
|
|
556
|
+
* finding every call denied. Never throws.
|
|
557
|
+
*/
|
|
558
|
+
declare function validateApprovalPolicy(policy: Policy, entry: unknown): ApprovalPolicyValidation;
|
|
488
559
|
//#endregion
|
|
489
560
|
//#region src/core/arazzo.d.ts
|
|
490
561
|
type ArazzoSimulateInput = {
|
|
@@ -558,13 +629,9 @@ type RoleChangeTarget = {
|
|
|
558
629
|
/** `idp` when the identity provider owns the target's membership: the application cannot change it. */
|
|
559
630
|
readonly managedBy?: "idp";
|
|
560
631
|
};
|
|
561
|
-
type
|
|
632
|
+
type RoleChangeBase = {
|
|
562
633
|
readonly kind: "assign" | "revoke" | "transfer";
|
|
563
634
|
readonly role: string | Role;
|
|
564
|
-
/** The scope the role is held at (a declared name or alias). */
|
|
565
|
-
readonly scope: string;
|
|
566
|
-
/** The scope instance. */
|
|
567
|
-
readonly id: string;
|
|
568
635
|
/** Ids of the instance's ancestor scopes; a holder there may assign here. */
|
|
569
636
|
readonly within?: Readonly<Record<string, string>>;
|
|
570
637
|
readonly target: RoleChangeTarget;
|
|
@@ -575,6 +642,20 @@ type RoleChange = {
|
|
|
575
642
|
*/
|
|
576
643
|
readonly holders?: number;
|
|
577
644
|
};
|
|
645
|
+
/**
|
|
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
|
+
});
|
|
578
659
|
/**
|
|
579
660
|
* `granted` names the role that authorised the change (`null` when a
|
|
580
661
|
* `meta.manageRoles` holder or the declared-role ceiling did); `denied` lists
|
|
@@ -712,6 +793,13 @@ type DecideOptions = {
|
|
|
712
793
|
readonly field?: string;
|
|
713
794
|
/** `true` attaches a `trace` to the decision: the grants evaluated, matched and skipped. Off by default and free when off. */
|
|
714
795
|
readonly explain?: boolean;
|
|
796
|
+
/**
|
|
797
|
+
* A declared scope name: only memberships of that scope answer the check.
|
|
798
|
+
* Naming the first scope keeps nested memberships out of a tenant-level
|
|
799
|
+
* guard on a collection action. Global roles still apply; resource roles
|
|
800
|
+
* and memberships of other scopes are skipped with reason `scope`.
|
|
801
|
+
*/
|
|
802
|
+
readonly scope?: string;
|
|
715
803
|
};
|
|
716
804
|
type SimulateOptions = {
|
|
717
805
|
/** Decision clock in Unix seconds for the whole batch: grant validity, membership expiry and limits are read as of this instant. Defaults to the current time. */
|
|
@@ -738,14 +826,34 @@ type WhereResult = {
|
|
|
738
826
|
/** The policy's resource graph, for `related`; not enumerable either. */
|
|
739
827
|
readonly resources?: ReadonlyMap<string, ResourceNode>;
|
|
740
828
|
};
|
|
829
|
+
type SnapshotOptions = {
|
|
830
|
+
readonly include?: readonly (Permission | {
|
|
831
|
+
readonly [key: string]: unknown;
|
|
832
|
+
})[];
|
|
833
|
+
readonly tenants?: "all";
|
|
834
|
+
readonly signer?: TokenSigner;
|
|
835
|
+
readonly audience?: string | readonly string[];
|
|
836
|
+
};
|
|
741
837
|
type PermDock<V extends PolicyVocabulary = PolicyVocabulary> = {
|
|
742
838
|
readonly can: {
|
|
743
839
|
(permission: Permission<string, unknown, "instance">, data: unknown, options?: DecideOptions): boolean;
|
|
744
840
|
(permission: Permission<string, unknown, "collection">, data?: unknown, options?: DecideOptions): boolean;
|
|
841
|
+
/**
|
|
842
|
+
* A permission held as `Permission` at run time (from a list, a catalog
|
|
843
|
+
* or `findPermission`), whose kind the type does not say: pass `data`,
|
|
844
|
+
* or `undefined` for a check without a row.
|
|
845
|
+
*/
|
|
846
|
+
(permission: Permission, data: unknown, options?: DecideOptions): boolean;
|
|
745
847
|
};
|
|
746
848
|
readonly decide: {
|
|
747
849
|
(permission: Permission<string, unknown, "instance">, data: unknown, options?: DecideOptions): Decision;
|
|
748
850
|
(permission: Permission<string, unknown, "collection">, data?: unknown, options?: DecideOptions): Decision;
|
|
851
|
+
/**
|
|
852
|
+
* A permission held as `Permission` at run time (from a list, a catalog
|
|
853
|
+
* or `findPermission`), whose kind the type does not say: pass `data`,
|
|
854
|
+
* or `undefined` for a check without a row.
|
|
855
|
+
*/
|
|
856
|
+
(permission: Permission, data: unknown, options?: DecideOptions): Decision;
|
|
749
857
|
};
|
|
750
858
|
readonly assert: {
|
|
751
859
|
(permission: Permission<string, unknown, "instance">, data: unknown, options?: DecideOptions): Extract<Decision, {
|
|
@@ -754,6 +862,14 @@ type PermDock<V extends PolicyVocabulary = PolicyVocabulary> = {
|
|
|
754
862
|
(permission: Permission<string, unknown, "collection">, data?: unknown, options?: DecideOptions): Extract<Decision, {
|
|
755
863
|
readonly outcome: "granted";
|
|
756
864
|
}>;
|
|
865
|
+
/**
|
|
866
|
+
* A permission held as `Permission` at run time (from a list, a catalog
|
|
867
|
+
* or `findPermission`), whose kind the type does not say: pass `data`,
|
|
868
|
+
* or `undefined` for a check without a row.
|
|
869
|
+
*/
|
|
870
|
+
(permission: Permission, data: unknown, options?: DecideOptions): Extract<Decision, {
|
|
871
|
+
readonly outcome: "granted";
|
|
872
|
+
}>;
|
|
757
873
|
};
|
|
758
874
|
/**
|
|
759
875
|
* `decide` with `explain: true`: the same decision, with a `trace` that
|
|
@@ -764,6 +880,7 @@ type PermDock<V extends PolicyVocabulary = PolicyVocabulary> = {
|
|
|
764
880
|
readonly explain: {
|
|
765
881
|
(permission: Permission<string, unknown, "instance">, data: unknown, options?: Omit<DecideOptions, "explain">): ExplainedDecision;
|
|
766
882
|
(permission: Permission<string, unknown, "collection">, data?: unknown, options?: Omit<DecideOptions, "explain">): ExplainedDecision;
|
|
883
|
+
(permission: Permission, data: unknown, options?: Omit<DecideOptions, "explain">): ExplainedDecision;
|
|
767
884
|
};
|
|
768
885
|
readonly filter: <T>(permission: Permission<string, T, "instance">, rows: readonly T[], options?: DecideOptions) => T[];
|
|
769
886
|
readonly pick: <T>(permission: Permission<string, T, "instance">, row: T, options?: DecideOptions) => Partial<T>;
|
|
@@ -780,14 +897,15 @@ type PermDock<V extends PolicyVocabulary = PolicyVocabulary> = {
|
|
|
780
897
|
}): PermDock<V>;
|
|
781
898
|
(plan: ArazzoSimulateInput): ArazzoPlan;
|
|
782
899
|
};
|
|
783
|
-
readonly snapshot:
|
|
784
|
-
|
|
785
|
-
readonly
|
|
786
|
-
})
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
900
|
+
readonly snapshot: {
|
|
901
|
+
(options?: SnapshotOptions & {
|
|
902
|
+
readonly signer?: undefined;
|
|
903
|
+
}): Snapshot;
|
|
904
|
+
(options: SnapshotOptions & {
|
|
905
|
+
readonly signer: TokenSigner;
|
|
906
|
+
}): Promise<string>;
|
|
907
|
+
(options?: SnapshotOptions): Snapshot | Promise<string>;
|
|
908
|
+
};
|
|
791
909
|
readonly on: (event: "decision" | "denied" | "approval" | "auth" | "error", handler: (payload: unknown) => void) => () => void;
|
|
792
910
|
readonly tenant: (id: string) => PermDock<V>;
|
|
793
911
|
readonly team: (id: string) => PermDock<V>;
|
|
@@ -805,8 +923,14 @@ type PermDock<V extends PolicyVocabulary = PolicyVocabulary> = {
|
|
|
805
923
|
}) => readonly Role[];
|
|
806
924
|
/** The distinct `meta.audience` values of the roles held in the active tenant, in rank order. */
|
|
807
925
|
readonly audiences: () => readonly string[];
|
|
926
|
+
/**
|
|
927
|
+
* The roles the subject may hand out in a tenant (the active one by
|
|
928
|
+
* default), or with `scope: 'global'` the global roles it may hand out. A
|
|
929
|
+
* snapshot answers only the tenant form.
|
|
930
|
+
*/
|
|
808
931
|
readonly assignableRoles: (options?: {
|
|
809
932
|
readonly tenant?: string;
|
|
933
|
+
readonly scope?: "global";
|
|
810
934
|
}) => readonly Role[];
|
|
811
935
|
/**
|
|
812
936
|
* The custom-role ceiling the subject may hand out: in a tenant (empty
|
|
@@ -818,6 +942,15 @@ type PermDock<V extends PolicyVocabulary = PolicyVocabulary> = {
|
|
|
818
942
|
readonly tenant?: string;
|
|
819
943
|
readonly scope?: "global";
|
|
820
944
|
}) => readonly Permission[];
|
|
945
|
+
/**
|
|
946
|
+
* The levels of `permission` (`resource(…, { levels })`) the subject may
|
|
947
|
+
* hand out in a custom role: those it holds, or every level with
|
|
948
|
+
* `meta.manageRoles`. Empty when the permission is not assignable.
|
|
949
|
+
*/
|
|
950
|
+
readonly assignableLevels: (permission: Permission, options?: {
|
|
951
|
+
readonly tenant?: string;
|
|
952
|
+
readonly scope?: "global";
|
|
953
|
+
}) => readonly string[];
|
|
821
954
|
/**
|
|
822
955
|
* Whether the subject may assign, revoke or transfer a role in one scope
|
|
823
956
|
* instance: `assigns`, the ceiling, `for`, `exclusiveWith`, `min`, `max`
|
|
@@ -851,12 +984,22 @@ type PermDock<V extends PolicyVocabulary = PolicyVocabulary> = {
|
|
|
851
984
|
readonly plans: V["plans"] extends PlanTree ? V["plans"] : PlanTree;
|
|
852
985
|
readonly permissions: V["permissions"] extends Policy["permissions"] ? V["permissions"] : Policy["permissions"];
|
|
853
986
|
readonly subject: Subject;
|
|
987
|
+
/**
|
|
988
|
+
* The same subject, tenant, team, actor, delegation, sink and limits with
|
|
989
|
+
* other sources: `customRoles`, `approvalPolicies` or `relations`. The
|
|
990
|
+
* sources it names are read again for the subject's tenants; the others
|
|
991
|
+
* keep what this instance loaded. Returns a promise when a source it names
|
|
992
|
+
* answers asynchronously.
|
|
993
|
+
*/
|
|
994
|
+
readonly derive: (options: DeriveOptions) => PermDock<V> | Promise<PermDock<V>>;
|
|
854
995
|
};
|
|
996
|
+
/** What `permdock.derive` may replace: the sources read after the subject is resolved. */
|
|
997
|
+
type DeriveOptions = Pick<PermDockOptions, "customRoles" | "approvalPolicies" | "relations">;
|
|
855
998
|
type PermDockOptions = {
|
|
856
999
|
readonly tenant?: string;
|
|
857
1000
|
/** One source, or several composed with `composeMemberships`. */
|
|
858
1001
|
readonly memberships?: MembershipSource | readonly MembershipSource[];
|
|
859
|
-
readonly customRoles?: RoleSource;
|
|
1002
|
+
readonly customRoles?: RoleSource | RoleSourceFactory;
|
|
860
1003
|
/** Plans and seats from billing, merged into `principal.plans` for the active tenant. */
|
|
861
1004
|
readonly entitlements?: EntitlementSource;
|
|
862
1005
|
readonly actor?: Actor;
|
|
@@ -884,8 +1027,9 @@ type CredentialPermission = {
|
|
|
884
1027
|
/**
|
|
885
1028
|
* Credential v1: what a verified API key stands for, never the secret. A
|
|
886
1029
|
* `user` credential acts as its owner (`principal`) narrowed to
|
|
887
|
-
* `permissions
|
|
888
|
-
*
|
|
1030
|
+
* `permissions`, and to the memberships inside `tenant` when it names one;
|
|
1031
|
+
* a `service` credential is its own `service` principal holding `roles` in
|
|
1032
|
+
* `tenant`, narrowed the same way.
|
|
889
1033
|
*/
|
|
890
1034
|
type Credential = {
|
|
891
1035
|
readonly v: 1;
|
|
@@ -893,7 +1037,11 @@ type Credential = {
|
|
|
893
1037
|
readonly kind: CredentialKind;
|
|
894
1038
|
/** The owner of a `user` credential, or the id of the service principal. */
|
|
895
1039
|
readonly principal: string;
|
|
896
|
-
/**
|
|
1040
|
+
/**
|
|
1041
|
+
* The instance of the first scope the key is held to. Required on a
|
|
1042
|
+
* service credential, where its roles are held; optional on a user
|
|
1043
|
+
* credential, where it keeps only the owner's memberships inside it.
|
|
1044
|
+
*/
|
|
897
1045
|
readonly tenant?: string;
|
|
898
1046
|
/** Service only: the roles it holds in `tenant`. */
|
|
899
1047
|
readonly roles?: readonly string[];
|
|
@@ -935,6 +1083,8 @@ type CredentialRequestBase = {
|
|
|
935
1083
|
};
|
|
936
1084
|
type CredentialRequest = (CredentialRequestBase & {
|
|
937
1085
|
readonly kind: "user";
|
|
1086
|
+
/** Holds the key to the creator's memberships inside this tenant. */
|
|
1087
|
+
readonly tenant?: string;
|
|
938
1088
|
}) | (CredentialRequestBase & {
|
|
939
1089
|
readonly kind: "service";
|
|
940
1090
|
/** The service principal's id; defaults to the credential id. */
|
|
@@ -972,7 +1122,7 @@ declare function credentialPolicyViolation(credential: Credential, policy: Crede
|
|
|
972
1122
|
* Validates an untrusted credential record and returns a frozen copy with
|
|
973
1123
|
* only the v1 fields, or `undefined`. Unknown fields are dropped; a wrong
|
|
974
1124
|
* type in a known field, a service credential without `tenant` and `roles`,
|
|
975
|
-
* or a user credential with
|
|
1125
|
+
* or a user credential with `roles`, rejects the whole record.
|
|
976
1126
|
*/
|
|
977
1127
|
declare function parseCredential(input: unknown): Credential | undefined;
|
|
978
1128
|
/**
|
|
@@ -986,7 +1136,9 @@ declare function credentialDelegation(credential: Credential, permissions: Permi
|
|
|
986
1136
|
* The subject a verified credential acts as. A `user` credential is its
|
|
987
1137
|
* owner, passed live as `owner` (roles and memberships as of this request),
|
|
988
1138
|
* with the credential's delegation: every check is the owner's rights
|
|
989
|
-
* intersected with the key's.
|
|
1139
|
+
* intersected with the key's. One that names a `tenant` makes it the active
|
|
1140
|
+
* tenant, and `createPermDock` then keeps only the owner's memberships
|
|
1141
|
+
* inside it and no global role. A `service` credential is a `service`
|
|
990
1142
|
* principal whose only membership is `roles` in `tenant`. An owner whose id
|
|
991
1143
|
* is not the credential's `principal`, or who is not a user, is anonymous.
|
|
992
1144
|
*/
|
|
@@ -998,11 +1150,11 @@ declare function credentialSubject(credential: Credential, options: {
|
|
|
998
1150
|
* Decides whether the subject of `permdock` may create the credential in
|
|
999
1151
|
* `request`. The creator must be a signed-in user or service that is not
|
|
1000
1152
|
* itself a link or a credential; a delegated creator hands out only what its
|
|
1001
|
-
* delegation covers. A
|
|
1002
|
-
*
|
|
1153
|
+
* delegation covers. A key's tenant must be one the creator is a member of;
|
|
1154
|
+
* a service key's roles among the creator's `assignableRoles` there and its
|
|
1003
1155
|
* permissions within `assignablePermissions` there (`exceeds-creator`). The
|
|
1004
|
-
* `credentials` policy of the key's tenant (
|
|
1005
|
-
*
|
|
1156
|
+
* `credentials` policy of the key's tenant (its own, or for a user key
|
|
1157
|
+
* without one the creator's active tenant) then applies (`credential-policy`; a
|
|
1006
1158
|
* settings source that throws denies with `rule: 'unavailable'`), and
|
|
1007
1159
|
* `approval` makes the result `approval-required` until `approved` carries
|
|
1008
1160
|
* its token. PermDock never stores the credential; the application does,
|
|
@@ -1049,11 +1201,31 @@ type DecisionProvider = {
|
|
|
1049
1201
|
}): Promise<readonly string[] | null | undefined>;
|
|
1050
1202
|
};
|
|
1051
1203
|
type RoleSource = {
|
|
1052
|
-
|
|
1204
|
+
/**
|
|
1205
|
+
* The custom roles of one tenant. `createPermDock` passes `held`, the role
|
|
1206
|
+
* names the subject's live memberships hold there, declared or not, so a
|
|
1207
|
+
* source can skip its read when none of them is a custom role.
|
|
1208
|
+
*/
|
|
1209
|
+
rolesFor(tenant: string, context?: {
|
|
1210
|
+
readonly held: readonly string[];
|
|
1211
|
+
}): CustomRole[] | Promise<CustomRole[]>;
|
|
1053
1212
|
assignable?(tenant: string): string[] | Promise<string[]>;
|
|
1054
|
-
/**
|
|
1055
|
-
|
|
1213
|
+
/**
|
|
1214
|
+
* Platform custom roles (`scope: 'global'`), read once per signed-in
|
|
1215
|
+
* subject, with `held`, the global role names the subject holds. A role
|
|
1216
|
+
* here with a tenant is ignored.
|
|
1217
|
+
*/
|
|
1218
|
+
globalRoles?(context?: {
|
|
1219
|
+
readonly held: readonly string[];
|
|
1220
|
+
}): CustomRole[] | Promise<CustomRole[]>;
|
|
1056
1221
|
};
|
|
1222
|
+
/**
|
|
1223
|
+
* A `RoleSource` built for the subject the instance serves, for an adapter
|
|
1224
|
+
* option shared by every request: it gets the resolved subject (principal,
|
|
1225
|
+
* actor and delegation) and returns that subject's source, or `undefined`
|
|
1226
|
+
* for none. A throw reads no custom roles and reports `source-threw`.
|
|
1227
|
+
*/
|
|
1228
|
+
type RoleSourceFactory = (subject: Subject) => RoleSource | undefined;
|
|
1057
1229
|
/** One member of a scope instance, as `MembershipSource.list` returns it. */
|
|
1058
1230
|
type MemberEntry = {
|
|
1059
1231
|
readonly principal: {
|
|
@@ -1076,16 +1248,21 @@ type MembershipSource = {
|
|
|
1076
1248
|
/**
|
|
1077
1249
|
* The principal's current authorization version, bumped on every membership
|
|
1078
1250
|
* change. A token whose `authzVersion` is behind it is stale for the
|
|
1079
|
-
* policy's `fresh` permissions.
|
|
1251
|
+
* policy's `fresh` permissions. `roles` and `memberships` are what the
|
|
1252
|
+
* token claims, so a source can read more than the version in the same
|
|
1253
|
+
* call when the claims show it will be needed.
|
|
1080
1254
|
*/
|
|
1081
1255
|
version?(principal: {
|
|
1082
1256
|
readonly id: string;
|
|
1257
|
+
readonly roles?: readonly string[];
|
|
1258
|
+
readonly memberships?: readonly Membership[];
|
|
1083
1259
|
}): number | undefined | Promise<number | undefined>;
|
|
1084
1260
|
/**
|
|
1085
1261
|
* Keep the memberships the verified token carries and read this source only
|
|
1086
1262
|
* when the token says they were truncated (`claimsFirst`).
|
|
1087
1263
|
*/
|
|
1088
1264
|
readonly claimsFirst?: boolean;
|
|
1265
|
+
readonly onStale?: "deny" | "reread";
|
|
1089
1266
|
};
|
|
1090
1267
|
/** An object's parent chain, as `RelationSource.ancestors` returns it. */
|
|
1091
1268
|
type RelationChain = {
|
|
@@ -1144,6 +1321,10 @@ type RelationSource = {
|
|
|
1144
1321
|
readonly id: string;
|
|
1145
1322
|
readonly relation: string;
|
|
1146
1323
|
}): RelationHolder[] | Promise<RelationHolder[]>;
|
|
1324
|
+
row?(query: {
|
|
1325
|
+
readonly resource: string;
|
|
1326
|
+
readonly id: string;
|
|
1327
|
+
}): Readonly<Record<string, unknown>> | null | undefined | Promise<Readonly<Record<string, unknown>> | null | undefined>;
|
|
1147
1328
|
};
|
|
1148
1329
|
/** Plan and seat names a principal holds in a tenant, from billing (Stripe Entitlements, a table). */
|
|
1149
1330
|
type EntitlementSource = {
|
|
@@ -1236,6 +1417,11 @@ type Snapshot = {
|
|
|
1236
1417
|
* from applying; they grant nothing and name the plan a denial asks for.
|
|
1237
1418
|
*/
|
|
1238
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>>;
|
|
1239
1425
|
/**
|
|
1240
1426
|
* The permission keys the policy's delegations let the actor use for the
|
|
1241
1427
|
* principal, sorted; present only when one applies. Outside it a check is
|
|
@@ -1257,12 +1443,16 @@ type SnapshotScope = {
|
|
|
1257
1443
|
readonly within?: string;
|
|
1258
1444
|
/** Resources whose rows this scope's key partitions, from their `memberOf` relations. */
|
|
1259
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>>;
|
|
1260
1448
|
};
|
|
1261
1449
|
/** The declared roles and the custom-role ceiling the subject may assign in one tenant. */
|
|
1262
1450
|
type SnapshotAssignable = {
|
|
1263
1451
|
readonly tenant: string;
|
|
1264
1452
|
readonly roles: readonly string[];
|
|
1265
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[]>>;
|
|
1266
1456
|
};
|
|
1267
1457
|
type SnapshotGrant = {
|
|
1268
1458
|
readonly permission: string;
|
|
@@ -1282,6 +1472,34 @@ type SnapshotGrant = {
|
|
|
1282
1472
|
/** When the grant applies (Unix seconds, `from` inclusive, `until` exclusive); absent means always. */
|
|
1283
1473
|
readonly validity?: GrantValidity;
|
|
1284
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
|
+
};
|
|
1285
1503
|
type SnapshotSource = {
|
|
1286
1504
|
get(): Promise<Snapshot | string> | Snapshot | string;
|
|
1287
1505
|
subscribe?(listener: () => void): () => void;
|
|
@@ -1502,6 +1720,12 @@ type SettingsSource = {
|
|
|
1502
1720
|
settingsFor(tenant: string): TenantSettings | undefined | Promise<TenantSettings | undefined>;
|
|
1503
1721
|
};
|
|
1504
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
|
+
};
|
|
1505
1729
|
declare function memoryRoleSource(customRoles: readonly CustomRole[]): RoleSource;
|
|
1506
1730
|
//#endregion
|
|
1507
1731
|
//#region src/conditions/normalize.d.ts
|
|
@@ -1521,9 +1745,20 @@ type WhereShorthand<T = Record<string, unknown>> = {
|
|
|
1521
1745
|
readonly and?: readonly WhereShorthand<T>[];
|
|
1522
1746
|
readonly or?: readonly WhereShorthand<T>[];
|
|
1523
1747
|
readonly not?: WhereShorthand<T>;
|
|
1524
|
-
} & { readonly [K in keyof T]?: T[K]
|
|
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 | {
|
|
1525
1760
|
readonly ref: string;
|
|
1526
|
-
};
|
|
1761
|
+
};
|
|
1527
1762
|
//#endregion
|
|
1528
1763
|
//#region src/core/approvers.d.ts
|
|
1529
1764
|
/** One named approver, by principal id. */
|
|
@@ -1531,13 +1766,41 @@ type UserApprover = {
|
|
|
1531
1766
|
readonly kind: "user";
|
|
1532
1767
|
readonly id: string;
|
|
1533
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
|
+
};
|
|
1534
1784
|
/**
|
|
1535
1785
|
* Who may approve: a subject-only grantee, a `relation()` the approver holds
|
|
1536
|
-
* on the requested row (checked when the verdict is given),
|
|
1537
|
-
*
|
|
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.
|
|
1538
1789
|
*/
|
|
1539
|
-
type Approver = Grantee | UserApprover;
|
|
1540
|
-
type ApproverInput = GranteeInput | UserApprover |
|
|
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[];
|
|
1541
1804
|
/** A named approver for `approval.by`, matched on the approver's principal id. */
|
|
1542
1805
|
declare function user(id: string): UserApprover;
|
|
1543
1806
|
//#endregion
|
|
@@ -1565,6 +1828,8 @@ type ApprovalStage = {
|
|
|
1565
1828
|
readonly by: Approver | readonly Approver[];
|
|
1566
1829
|
/** Absent means 1. */
|
|
1567
1830
|
readonly quorum?: number;
|
|
1831
|
+
/** After `after`, `to` may approve this stage as well as `by`; other stages are unaffected. */
|
|
1832
|
+
readonly escalation?: ApprovalEscalation;
|
|
1568
1833
|
};
|
|
1569
1834
|
/**
|
|
1570
1835
|
* `'any'`: `quorum` approvers from `by`. `'all'`: every stage completes, in
|
|
@@ -1596,6 +1861,11 @@ type ApprovalOption = "human" | {
|
|
|
1596
1861
|
readonly stages?: readonly {
|
|
1597
1862
|
readonly by: ApproverInput;
|
|
1598
1863
|
readonly quorum?: number;
|
|
1864
|
+
/** After `after`, `to` may approve this stage as well as `by`. */
|
|
1865
|
+
readonly escalation?: {
|
|
1866
|
+
readonly after: string;
|
|
1867
|
+
readonly to: ApproverInput;
|
|
1868
|
+
};
|
|
1599
1869
|
}[];
|
|
1600
1870
|
/** `false` lets the request's principal approve it; absent means `true`. */
|
|
1601
1871
|
readonly distinct?: boolean;
|
|
@@ -1720,12 +1990,19 @@ type GrantOptions<T = Record<string, unknown>> = {
|
|
|
1720
1990
|
readonly fields?: readonly (keyof T & string)[];
|
|
1721
1991
|
/** A name a `breakGlass` override may lift; only meaningful on a deny. */
|
|
1722
1992
|
readonly name?: string;
|
|
1993
|
+
readonly group?: string;
|
|
1723
1994
|
/** Purposes of use (`context.purpose`) that make the grant apply; non-portable. */
|
|
1724
1995
|
readonly purpose?: readonly string[];
|
|
1725
1996
|
/** 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. */
|
|
1726
1997
|
readonly validFrom?: string | number;
|
|
1727
1998
|
/** The grant stops applying at this instant (exclusive; RFC 3339 string or Unix seconds). */
|
|
1728
1999
|
readonly validUntil?: string | number;
|
|
2000
|
+
/**
|
|
2001
|
+
* An allow on an instance action counts only on rows whose scope instance
|
|
2002
|
+
* (or the whole app, globally) is one where the subject also holds this
|
|
2003
|
+
* permission through a role grant without a row condition.
|
|
2004
|
+
*/
|
|
2005
|
+
readonly requires?: Permission | readonly Permission[];
|
|
1729
2006
|
};
|
|
1730
2007
|
/**
|
|
1731
2008
|
* When a grant applies, in Unix seconds. `from` is inclusive, `until`
|
|
@@ -1736,10 +2013,15 @@ type GrantValidity = {
|
|
|
1736
2013
|
readonly from?: number;
|
|
1737
2014
|
readonly until?: number;
|
|
1738
2015
|
};
|
|
1739
|
-
/**
|
|
2016
|
+
/**
|
|
2017
|
+
* The actor a policy delegation is for: an actor kind, narrowed to one id
|
|
2018
|
+
* when `id` is set, or to one named client when `client` is set (the name
|
|
2019
|
+
* the subject resolver gives a verified client id through `clients`).
|
|
2020
|
+
*/
|
|
1740
2021
|
type DelegationTarget = {
|
|
1741
2022
|
readonly kind: string;
|
|
1742
2023
|
readonly id?: string;
|
|
2024
|
+
readonly client?: string;
|
|
1743
2025
|
};
|
|
1744
2026
|
/**
|
|
1745
2027
|
* A normalised policy delegation: holders of `from` let actors matching `to`
|
|
@@ -1757,7 +2039,7 @@ type PolicyDelegation = {
|
|
|
1757
2039
|
type DelegationInput = {
|
|
1758
2040
|
/** Who hands over: the same subject-only selectors as `approval.by` (a role, `authenticated()`, a plan, `assurance()`); not `relation()`. */
|
|
1759
2041
|
readonly from: GranteeInput;
|
|
1760
|
-
/** Which actor may act: `actor('eve')`, an actor kind, or `{ kind,
|
|
2042
|
+
/** Which actor may act: `actor('eve')`, an actor kind, `{ kind, id }` for one agent, or `{ kind, client }` for one named OAuth client. */
|
|
1761
2043
|
readonly to: ActorGrantee | string | DelegationTarget;
|
|
1762
2044
|
/** The leaves or subtrees the actor may use; a deny grant still applies. */
|
|
1763
2045
|
readonly permissions: readonly (Permission | PermissionTree)[];
|
|
@@ -1811,6 +2093,7 @@ type Grant = {
|
|
|
1811
2093
|
readonly scope: GrantScope;
|
|
1812
2094
|
/** A name a `breakGlass` override may lift; only meaningful on a deny. */
|
|
1813
2095
|
readonly name?: string;
|
|
2096
|
+
readonly group?: string;
|
|
1814
2097
|
/** Purposes of use that make the grant apply (`context.purpose`); non-portable. */
|
|
1815
2098
|
readonly purpose?: readonly string[];
|
|
1816
2099
|
/** Set on a break-glass allow: it overrides named denies and carries obligations. */
|
|
@@ -1821,6 +2104,10 @@ type Grant = {
|
|
|
1821
2104
|
readonly hosted?: HostedGrantRef;
|
|
1822
2105
|
/** When the grant applies; absent means always. */
|
|
1823
2106
|
readonly validity?: GrantValidity;
|
|
2107
|
+
/** Set on a custom-role grant narrowed by a resource level (`CustomRoleGrant.level`). */
|
|
2108
|
+
readonly level?: string;
|
|
2109
|
+
/** The permission key the subject must also hold, through a role, on the row's scope instance or globally. */
|
|
2110
|
+
readonly requires?: readonly string[];
|
|
1824
2111
|
};
|
|
1825
2112
|
/** Which hosted policy document and grant a merged grant came from. */
|
|
1826
2113
|
type HostedGrantRef = {
|
|
@@ -1878,8 +2165,21 @@ type Policy<TUser = unknown, TPrincipal extends Principal = Principal, V extends
|
|
|
1878
2165
|
readonly fresh?: readonly string[];
|
|
1879
2166
|
/** Policy delegations in declaration order; absent or empty when the policy declares none. */
|
|
1880
2167
|
readonly delegations?: readonly PolicyDelegation[];
|
|
2168
|
+
/** Grant levels by resource (`resource(…, { levels })`), normalised; absent when none are declared. */
|
|
2169
|
+
readonly levels?: PolicyLevels;
|
|
2170
|
+
/** Coarse OAuth scopes in declaration order; absent when the policy declares none. */
|
|
2171
|
+
readonly oauthScopes?: readonly PolicyOAuthScope[];
|
|
1881
2172
|
readonly index: PolicyIndex;
|
|
1882
2173
|
};
|
|
2174
|
+
/**
|
|
2175
|
+
* A coarse OAuth scope an authorization server issues (`mcp:read`) and the
|
|
2176
|
+
* permission keys it covers, with their own scopes (`task:read`).
|
|
2177
|
+
*/
|
|
2178
|
+
type PolicyOAuthScope = {
|
|
2179
|
+
readonly scope: string;
|
|
2180
|
+
readonly permissions: readonly string[];
|
|
2181
|
+
readonly scopes: readonly string[];
|
|
2182
|
+
};
|
|
1883
2183
|
/** Lookups built once per policy, so a decision does not rescan every role and grant. */
|
|
1884
2184
|
type PolicyIndex = {
|
|
1885
2185
|
readonly declaredRoles: ReadonlySet<string>;
|
|
@@ -1901,6 +2201,8 @@ declare function role(name: string | Role, grants: RoleGrants, options?: RoleOpt
|
|
|
1901
2201
|
/** Options built at runtime: the scope name is only checked by `definePolicy`. */
|
|
1902
2202
|
declare function role(name: string | Role, grants: RoleGrants, options?: RoleOptions): RoleBinding;
|
|
1903
2203
|
declare function normalizeAssurance(input: AssuranceRequirement | undefined): AssuranceRequirement | undefined;
|
|
2204
|
+
/** Resource name to level name to its normalised condition. */
|
|
2205
|
+
type PolicyLevels = Readonly<Record<string, Readonly<Record<string, Condition>>>>;
|
|
1904
2206
|
type DefinePolicyOptions<TUser, TPrincipal extends Principal, S extends PolicyScopesInput = PolicyScopesInput> = {
|
|
1905
2207
|
readonly roles?: readonly RoleBinding<ScopeNames<S>>[];
|
|
1906
2208
|
readonly grants?: readonly (Omit<Grant, "role" | "scope"> | readonly Omit<Grant, "role" | "scope">[] | Grant)[];
|
|
@@ -1933,6 +2235,13 @@ type DefinePolicyOptions<TUser, TPrincipal extends Principal, S extends PolicySc
|
|
|
1933
2235
|
* the call still applies as well; both must cover.
|
|
1934
2236
|
*/
|
|
1935
2237
|
readonly delegations?: readonly DelegationInput[];
|
|
2238
|
+
/**
|
|
2239
|
+
* Coarse OAuth scopes the authorization server issues, each covering
|
|
2240
|
+
* permissions: a token holding `mcp:read` is delegated every permission
|
|
2241
|
+
* listed under it, as if it held each permission's own scope. Scope
|
|
2242
|
+
* challenges name the first coarse scope that covers the permission.
|
|
2243
|
+
*/
|
|
2244
|
+
readonly oauthScopes?: Readonly<Record<string, readonly (Permission | PermissionTree)[]>>;
|
|
1936
2245
|
};
|
|
1937
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>>;
|
|
1938
2247
|
type MembershipFixture = {
|
|
@@ -1956,4 +2265,4 @@ type SubjectOf<P> = {
|
|
|
1956
2265
|
readonly expiresAt?: number;
|
|
1957
2266
|
};
|
|
1958
2267
|
//#endregion
|
|
1959
|
-
export {
|
|
2268
|
+
export { AccessEvent as $, ExplainedDecision as $n, CredentialPrincipal as $t, RoleOptions as A, RoleChangeOptions as An, GnapAccess as Ar, SnapshotSource as At, normalizeApproval as B, simulateArazzo as Bn, MemberOfParent as Br, memoryMembershipSource as Bt, Policy as C, mergeHostedGrants as Cn, Actor as Cr, SettingsSource as Ct, PolicyVocabulary as D, WhoCan as Dn, CustomRole as Dr, SnapshotGrant as Dt, PolicyScopes as E, HoldingVia as En, Binding as Er, SnapshotAssignable as Et, SupportConsent as F, ArazzoFinding as Fn, VerifiedClaims as Fr, TokenVerifier as Ft, Approver as G, ApprovalPolicyValidation as Gn, SqlFunctionArg as Gr, WireDenial as Gt, role as H, ApprovalPolicy as Hn, RelatedCondition as Hr, memorySettings as Ht, ValidateMode as I, ArazzoPlan as In, Condition as Ir, VerificationFailure as It, UserApprover as J, ApprovalRequiredDecision as Jn, isCondition as Jr, CredentialKind as Jt, ApproverInput as K, memoryApprovalPolicies as Kn, SqlFunctionCondition as Kr, Credential as Kt, allow as L, ArazzoSimulateInput as Ln, ConditionRef as Lr, VerifiedToken as Lt, SeparationConflict as M, ActivateInput as Mn, Membership as Mr, TenantSettings as Mt, SubjectOf as N, breakGlass as Nn, Principal as Nr, TokenFailureCause as Nt, PrincipalOf as O, RoleChange as On, CustomRoleGrant as Or, SnapshotNotEntitled as Ot, SupportAccessOptions as P, supportAccess as Pn, Subject as Pr, TokenSigner as Pt, user as Q, DeniedDecision as Qn, CredentialPolicyViolation as Qt, definePolicy as R, ArazzoStepResult as Rn, ConditionValue as Rr, WhereCompiler as Rt, MembershipFixture as S, memoryPolicySource as Sn, ScopeNames as Sr, RoleSourceFactory as St, PolicyOAuthScope as T, Holder as Tn, AuthorizationDetail as Tr, Snapshot as Tt, separationConflicts as U, ApprovalPolicyProblem as Un, RelatedHop as Ur, memorySnapshotSource as Ut, normalizeAssurance as V, APPROVAL_POLICY_UNAVAILABLE as Vn, OpaqueCondition as Vr, memoryRoleSource as Vt, AnyOfApprover as W, ApprovalPolicySource as Wn, RestrictedAncestors as Wr, WireDecision as Wt, anyOf as X, Denial as Xn, isConditionRef as Xr, CredentialPermissionInput as Xt, allOf as Y, Decision as Yn, isConditionDate as Yr, CredentialPermission as Yt, holder as Z, DenialReason as Zn, isSqlFunctionField as Zr, CredentialPolicy as Zt, GrantLimit as _, HostedGrantDropReason as _n, plan as _r, RelationChain as _t, ApprovalRequirement as a, decideCredential as an, Trace as ar, DecisionSink as at, GrantValidity as b, PolicySource as bn, Scope as br, RelationSource as bt, BreakGlassOptions as c, DeriveOptions as cn, Grantee as cr, JwtClaims as ct, ClosureContext as d, RowPair as dn, RelationGrantee as dr, LimitStore as dt, CredentialRequest as en, GrantedDecision as er, AuthEvent as et, ClosureGrantFn as f, SimulateOptions as fn, actor as fr, LocalCustomRoleTable as ft, GrantCondition as g, HostedGrant as gn, inherit as gr, MembershipSource as gt, Grant as h, createPermDock as hn, authenticated as hr, MembershipEvent as ht, ApprovalOption as i, credentialSubject as in, Quota as ir, DecisionProvider as it, RoleScope as j, RoleChangeTarget as jn, JsonWebKeyLike as jr, SubjectResolver as jt, RoleBinding as k, RoleChangeDecision as kn, Delegation as kr, SnapshotScope as kt, BreakGlassRequirements as l, PermDock as ln, GranteeInput as lr, LimitConsumeInput as lt, DelegationTarget as m, WhereResult as mn, assurance as mr, MemberEntry as mt, ApprovalEscalation as n, credentialDelegation as nn, MatchedGrant as nr, CredentialVerifier as nt, ApprovalStage as o, parseCredential as on, TraceSkip as or, DirectoryEvent as ot, DelegationInput as p, SnapshotOptions as pn, anyone as pr, LocalSnapshotManifest as pt, PermissionApprover as q, validateApprovalPolicy as qn, hasConditionOp as qr, CredentialDecision as qt, ApprovalMode as r, credentialPolicyViolation as rn, Obligation as rr, DecisionEvent as rt, AssuranceRequirement as s, DecideOptions as sn, TraceSkipReason as sr, EntitlementSource as st, ActivationOption as t, DecideCredentialOptions as tn, LimitDetail as tr, CredentialEvent as tt, BreakGlassSpec as u, PermDockOptions as un, InheritGrantee as ur, LimitRemaining as ut, GrantOptions as v, HostedGrantDropped as vn, relation as vr, RelationGroup as vt, PolicyDelegation as w, parsePolicyDocument as wn, Assurance as wr, SinkEvent as wt, HostedGrantRef as x, isPortableCondition as xn, ScopeDeclaration as xr, RoleSource as xt, GrantScope as y, PolicyDocument as yn, PolicyScopesInput as yr, RelationHolder as yt, deny as z, arazzoFindings as zn, MemberOfCondition as zr, memoryEntitlementSource as zt };
|