permdock 0.0.0 → 0.1.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.
Files changed (290) hide show
  1. package/README.md +268 -1
  2. package/dist/a2a/index.d.ts +178 -0
  3. package/dist/a2a/index.js +271 -0
  4. package/dist/ai-sdk/index.d.ts +74 -0
  5. package/dist/ai-sdk/index.js +137 -0
  6. package/dist/approval-required-TzNB9oQA.js +6 -0
  7. package/dist/approvals/index.d.ts +3 -0
  8. package/dist/approvals/index.js +4 -0
  9. package/dist/approvals-DaxY-Bdg.js +218 -0
  10. package/dist/approvers-aH0PJkmf.js +20 -0
  11. package/dist/arazzo-CTeVuXr5.js +70 -0
  12. package/dist/arazzo-aoTkqYsJ.js +54 -0
  13. package/dist/authzen/index.d.ts +48 -0
  14. package/dist/authzen/index.js +336 -0
  15. package/dist/better-auth/index.d.ts +92 -0
  16. package/dist/better-auth/index.js +324 -0
  17. package/dist/budget-JqcRqyhK.d.ts +11 -0
  18. package/dist/budget-NbEtbJC_.js +11 -0
  19. package/dist/capability-B68OFnZx.js +171 -0
  20. package/dist/capability-BDG_nkxt.d.ts +99 -0
  21. package/dist/catalog/index.d.ts +12 -0
  22. package/dist/catalog/index.js +2 -0
  23. package/dist/catalog-B0E6bggc.js +48 -0
  24. package/dist/catalog-H-vFGwWK.js +55 -0
  25. package/dist/catalog-doc-BSo_Q_-6.js +298 -0
  26. package/dist/catalog-idsHc0vo.js +2 -0
  27. package/dist/catalog-path-CnI0XTFK.js +12 -0
  28. package/dist/claude-agent/index.d.ts +81 -0
  29. package/dist/claude-agent/index.js +83 -0
  30. package/dist/clerk/index.d.ts +56 -0
  31. package/dist/clerk/index.js +280 -0
  32. package/dist/cli/bin.d.ts +1 -0
  33. package/dist/cli/bin.js +20 -0
  34. package/dist/cli/index.d.ts +46 -0
  35. package/dist/cli/index.js +5 -0
  36. package/dist/cloud/index.d.ts +91 -0
  37. package/dist/cloud/index.js +390 -0
  38. package/dist/cloud-BNQTrmrr.js +50 -0
  39. package/dist/cloud-Cuxr6Czw.js +117 -0
  40. package/dist/collect-B7_TIfmg.js +49 -0
  41. package/dist/collect-O-tOtbnk.js +350 -0
  42. package/dist/collect-fRPAQIWb.js +2 -0
  43. package/dist/commands-BMh_Etm2.js +93 -0
  44. package/dist/compact-y6vfu2_f.js +19 -0
  45. package/dist/compare-pfyVnBjE.js +12 -0
  46. package/dist/compile-CQbvyIBr.d.ts +30 -0
  47. package/dist/compile-D22iwvuV.js +558 -0
  48. package/dist/config-BPYmjTOp.js +26 -0
  49. package/dist/connection-JvqwHODC.js +194 -0
  50. package/dist/context-CKEAabd7.js +73 -0
  51. package/dist/context-gtAwAILx.js +6 -0
  52. package/dist/convex/index.d.ts +40 -0
  53. package/dist/convex/index.js +55 -0
  54. package/dist/create-BKF3dgFk.d.ts +162 -0
  55. package/dist/create-CSkhDU9T.js +222 -0
  56. package/dist/credential-B_rkUNlY.js +326 -0
  57. package/dist/credentials-BgRX3WEg.js +268 -0
  58. package/dist/describe-Bt1YD5uS.js +99 -0
  59. package/dist/describe-DernyItf.d.ts +37 -0
  60. package/dist/diff-BUzf5Poi.js +48 -0
  61. package/dist/diff-x5Il8LVa.js +418 -0
  62. package/dist/digest-B3kc_PgQ.d.ts +19 -0
  63. package/dist/digest-BI-6aa6d.js +27 -0
  64. package/dist/doctor-BGle8Gqi.js +1314 -0
  65. package/dist/doctor-Bqo6FwUa.js +53 -0
  66. package/dist/drizzle/index.d.ts +72 -0
  67. package/dist/drizzle/index.js +160 -0
  68. package/dist/duration-xK2jGFVc.js +25 -0
  69. package/dist/elysia/index.d.ts +71 -0
  70. package/dist/elysia/index.js +103 -0
  71. package/dist/errors-DSMnAVNa.js +43 -0
  72. package/dist/errors-DbZ1YOnb.d.ts +138 -0
  73. package/dist/errors-Iy71s7Oj.js +177 -0
  74. package/dist/errors-m3u9TmDu.js +27 -0
  75. package/dist/evaluations-DsAU9ppl.js +479 -0
  76. package/dist/eve/index.d.ts +95 -0
  77. package/dist/eve/index.js +181 -0
  78. package/dist/express/index.d.ts +46 -0
  79. package/dist/express/index.js +108 -0
  80. package/dist/fastify/index.d.ts +56 -0
  81. package/dist/fastify/index.js +141 -0
  82. package/dist/files-B_wAGYmt.js +121 -0
  83. package/dist/fixtures-Cvaw0gDG.js +64 -0
  84. package/dist/freeze-y1_jQL4v.js +31 -0
  85. package/dist/from-snapshot-BMGnhmgv.js +552 -0
  86. package/dist/generate-CH7ThJ14.js +173 -0
  87. package/dist/grantee-Bv04_Vzf.js +521 -0
  88. package/dist/headers-B5RRv3Xm.js +6 -0
  89. package/dist/headers-C8SHQccD.d.ts +6 -0
  90. package/dist/helpers-DnSOrhB9.js +682 -0
  91. package/dist/hono/index.d.ts +70 -0
  92. package/dist/hono/index.js +131 -0
  93. package/dist/hosted-BwKQ1BTA.js +265 -0
  94. package/dist/http-DPuDaChb.d.ts +13 -0
  95. package/dist/http-GgVApX1k.js +111 -0
  96. package/dist/index-CltcQ4Bf.d.ts +138 -0
  97. package/dist/index-LF_hS-yn.d.ts +177 -0
  98. package/dist/index-fG6NSXlc.d.ts +9 -0
  99. package/dist/index-xIxJLwOQ.d.ts +415 -0
  100. package/dist/index.d.ts +11 -0
  101. package/dist/index.js +21 -0
  102. package/dist/jwt/index.d.ts +87 -0
  103. package/dist/jwt/index.js +571 -0
  104. package/dist/kernel-YOGCWNLf.js +211 -0
  105. package/dist/kysely/index.d.ts +77 -0
  106. package/dist/kysely/index.js +129 -0
  107. package/dist/load-BZ24CpZP.js +69 -0
  108. package/dist/load-QOOm1z70.js +2 -0
  109. package/dist/load-jose-BL6LH4bL.js +11 -0
  110. package/dist/lru-8q4WZjBV.js +28 -0
  111. package/dist/manifest-DDQbC6K0.d.ts +118 -0
  112. package/dist/map-DowSO96j.js +158 -0
  113. package/dist/map-claims-B_6I1Rn-.js +360 -0
  114. package/dist/map-error-RJ3ZsUyA.js +16 -0
  115. package/dist/markers-B0hYLvMD.js +60 -0
  116. package/dist/may-use-CnFEjVEp.js +37 -0
  117. package/dist/mcp/index.d.ts +127 -0
  118. package/dist/mcp/index.js +563 -0
  119. package/dist/nest/index.d.ts +80 -0
  120. package/dist/nest/index.js +270 -0
  121. package/dist/next/client.d.ts +24 -0
  122. package/dist/next/client.js +31 -0
  123. package/dist/next/index.d.ts +110 -0
  124. package/dist/next/index.js +195 -0
  125. package/dist/next/plugin.d.ts +14 -0
  126. package/dist/next/plugin.js +2 -0
  127. package/dist/node/index.d.ts +43 -0
  128. package/dist/node/index.js +66 -0
  129. package/dist/openai/index.d.ts +71 -0
  130. package/dist/openai/index.js +105 -0
  131. package/dist/openapi/index.d.ts +93 -0
  132. package/dist/openapi/index.js +3 -0
  133. package/dist/openapi-CwePaF7C.js +164 -0
  134. package/dist/openapi-DWD0Uc_4.js +250 -0
  135. package/dist/openapi-DcqM8nU7.js +306 -0
  136. package/dist/openapi-import-BWRUNNeW.js +5959 -0
  137. package/dist/openapi-schema-D8j_T9tO.js +6902 -0
  138. package/dist/orpc/index.d.ts +64 -0
  139. package/dist/orpc/index.js +188 -0
  140. package/dist/otel/index.d.ts +13 -0
  141. package/dist/otel/index.js +202 -0
  142. package/dist/package-root-zGkxO3oN.js +30 -0
  143. package/dist/parse-DPfIvFMU.js +135 -0
  144. package/dist/pdp/index.d.ts +22 -0
  145. package/dist/pdp/index.js +795 -0
  146. package/dist/peer-BOr_kJE1.js +31 -0
  147. package/dist/permdock-yoZ7EjxX.js +2956 -0
  148. package/dist/permissions-B4apnahQ.d.ts +185 -0
  149. package/dist/permissions-B8vCg_bI.d.ts +52 -0
  150. package/dist/permissions-CofRqesP.js +142 -0
  151. package/dist/permissions-DC7GROPA.js +600 -0
  152. package/dist/pg-4GJWDUxG.js +953 -0
  153. package/dist/pins-CqE1jZuF.js +12 -0
  154. package/dist/plugin-4gr7IxFJ.js +65 -0
  155. package/dist/policy-ANp36PnI.js +971 -0
  156. package/dist/policy-CInmNGkM.d.ts +1959 -0
  157. package/dist/policy-Cq2fB8Q5.d.ts +20 -0
  158. package/dist/prisma/index.d.ts +135 -0
  159. package/dist/prisma/index.js +430 -0
  160. package/dist/problem-Cgp9-KZA.js +226 -0
  161. package/dist/prompt-CXYhLfsS.js +32 -0
  162. package/dist/protected-B4K3BKoX.js +138 -0
  163. package/dist/protected-BuPAycJT.d.ts +26 -0
  164. package/dist/protected-wY7nXhY9.d.ts +23 -0
  165. package/dist/provider-_wx46HpB.js +48 -0
  166. package/dist/provider-wTAUda2v.d.ts +6 -0
  167. package/dist/react/index.d.ts +6 -0
  168. package/dist/react/index.js +6 -0
  169. package/dist/react/provider-client.d.ts +2 -0
  170. package/dist/react/provider-client.js +3 -0
  171. package/dist/react-native/index.d.ts +42 -0
  172. package/dist/react-native/index.js +174 -0
  173. package/dist/refs-ChLSxbST.js +90 -0
  174. package/dist/relations-r4soIFZB.js +426 -0
  175. package/dist/revocations-Cy06JNx2.d.ts +21 -0
  176. package/dist/rls-BOFU3chG.js +233 -0
  177. package/dist/rls-CJVja9Ww.js +2119 -0
  178. package/dist/rls-graph-DxQ39PJj.js +371 -0
  179. package/dist/rls-helpers-BxRuif0l.js +1346 -0
  180. package/dist/rls-import-CXV6LBlS.js +942 -0
  181. package/dist/rls-migrate-DrFPbf8p.js +366 -0
  182. package/dist/row-check-BajTgQZ-.d.ts +43 -0
  183. package/dist/run-CJ6UvS3a.js +155 -0
  184. package/dist/runtime-DP9ttFh1.js +27 -0
  185. package/dist/saas-BRrZzJkM.js +1193 -0
  186. package/dist/schema-P8yoma__.js +296 -0
  187. package/dist/scim/index.d.ts +2 -0
  188. package/dist/scim/index.js +2 -0
  189. package/dist/scim-9NFa0XVZ.js +1445 -0
  190. package/dist/scopes-cKVp_WTw.js +212 -0
  191. package/dist/server/index.d.ts +123 -0
  192. package/dist/server/index.js +8 -0
  193. package/dist/sha256-BO0swRXL.js +150 -0
  194. package/dist/sink-Bd9PSyfq.js +141 -0
  195. package/dist/sink-Cfr9-7YC.d.ts +104 -0
  196. package/dist/skills-C_lpV4Jx.js +50 -0
  197. package/dist/skills-Dx3QLnMY.js +110 -0
  198. package/dist/snapshot-DE8dE_hz.js +1051 -0
  199. package/dist/solid/index.d.ts +63 -0
  200. package/dist/solid/index.js +197 -0
  201. package/dist/source-DoBBYJi2.js +6 -0
  202. package/dist/sources-DOpW5Ila.d.ts +347 -0
  203. package/dist/sources-DVHM3Mwq.js +284 -0
  204. package/dist/sql-Bll1d7y0.js +22 -0
  205. package/dist/src-CTNT-PBW.js +430 -0
  206. package/dist/ssf/index.d.ts +3 -0
  207. package/dist/ssf/index.js +622 -0
  208. package/dist/store-Bq90395i.d.ts +27 -0
  209. package/dist/store-C6hFW6ta.js +508 -0
  210. package/dist/stores-CkG2HrSg.js +140 -0
  211. package/dist/stores-CvOnu_2T.d.ts +41 -0
  212. package/dist/stream-BhMfZOwr.d.ts +12 -0
  213. package/dist/stream-Q_xlB6Ko.js +52 -0
  214. package/dist/style-CTm1AXDT.js +22 -0
  215. package/dist/subject-C6dLxqHU.js +24 -0
  216. package/dist/subject-settings-xt7V845g.js +82 -0
  217. package/dist/supabase/index.d.ts +67 -0
  218. package/dist/supabase/index.js +4 -0
  219. package/dist/supabase/middleware.d.ts +77 -0
  220. package/dist/supabase/middleware.js +68 -0
  221. package/dist/supabase-D8UlBA7Z.js +83 -0
  222. package/dist/supabase-DTxGtYdi.js +796 -0
  223. package/dist/supabase-hook-DW-xP4hU.js +2 -0
  224. package/dist/supabase-hook-D_OqGb_V.js +1528 -0
  225. package/dist/svelte/Protected.svelte +34 -0
  226. package/dist/svelte/index.d.ts +10 -0
  227. package/dist/svelte/index.js +53 -0
  228. package/dist/svelte/runtime.d.ts +6 -0
  229. package/dist/svelte/runtime.js +3 -0
  230. package/dist/svelte/source.d.ts +10 -0
  231. package/dist/svelte/source.js +8 -0
  232. package/dist/terminal/index.d.ts +171 -0
  233. package/dist/terminal/index.js +821 -0
  234. package/dist/testing/index.d.ts +656 -0
  235. package/dist/testing/index.js +3208 -0
  236. package/dist/testing/saas/index.d.ts +194 -0
  237. package/dist/testing/saas/index.js +3 -0
  238. package/dist/testing/saas/permissions.d.ts +2 -0
  239. package/dist/testing/saas/permissions.js +2 -0
  240. package/dist/text-diff-BdkkYSbi.js +15 -0
  241. package/dist/thenable-okc2xDsj.js +10 -0
  242. package/dist/timeout-D51niuQP.js +8 -0
  243. package/dist/trpc/index.d.ts +80 -0
  244. package/dist/trpc/index.js +205 -0
  245. package/dist/types-B8w5PFtS.d.ts +141 -0
  246. package/dist/types-B9dmiiab.d.ts +66 -0
  247. package/dist/types-BBK-exvJ.d.ts +177 -0
  248. package/dist/types-BvBk1wgn.d.ts +118 -0
  249. package/dist/types-CxquUByI.d.ts +9 -0
  250. package/dist/types-D6Z6-rKJ.d.ts +312 -0
  251. package/dist/types-DbWdEfcm.d.ts +87 -0
  252. package/dist/types-bva3i4Gf.d.ts +98 -0
  253. package/dist/types-i4BAOvdb.d.ts +97 -0
  254. package/dist/unplugin/index.d.ts +7 -0
  255. package/dist/unplugin/index.js +30 -0
  256. package/dist/usage-1ozMubLY.js +42 -0
  257. package/dist/usage-CUnK6Ou9.js +530 -0
  258. package/dist/usage-PyEor6GA.js +2 -0
  259. package/dist/validity-D0uRmJKJ.js +224 -0
  260. package/dist/verifier-B90agnhl.js +461 -0
  261. package/dist/version-CnSh33Fj.js +16 -0
  262. package/dist/vocabulary-Dk0fs-Jk.d.ts +56 -0
  263. package/dist/vue/index.d.ts +57 -0
  264. package/dist/vue/index.js +203 -0
  265. package/dist/webmcp/index.d.ts +75 -0
  266. package/dist/webmcp/index.js +313 -0
  267. package/package.json +423 -4
  268. package/rulesets/permdock.yaml +29 -0
  269. package/schemas/catalog-v1.json +507 -0
  270. package/schemas/openapi/oas-3.1.json +1298 -0
  271. package/schemas/openapi/oas-3.2.json +1516 -0
  272. package/schemas/openapi/overlay-1.1.json +79 -0
  273. package/schemas/supabase-claims-v1.json +139 -0
  274. package/schemas/supabase-manifest-v1.json +217 -0
  275. package/skills/permdock/SKILL.md +66 -0
  276. package/skills/permdock-agents/SKILL.md +77 -0
  277. package/skills/permdock-agents/references/runtimes.md +211 -0
  278. package/skills/permdock-approvals/SKILL.md +80 -0
  279. package/skills/permdock-approvals/references/stores-and-resume.md +83 -0
  280. package/skills/permdock-audit/SKILL.md +67 -0
  281. package/skills/permdock-credentials/SKILL.md +55 -0
  282. package/skills/permdock-credentials/references/tokens-keys-links.md +127 -0
  283. package/skills/permdock-data/SKILL.md +57 -0
  284. package/skills/permdock-data/references/queries-and-rls.md +54 -0
  285. package/skills/permdock-data/references/relationships.md +65 -0
  286. package/skills/permdock-tenancy/SKILL.md +77 -0
  287. package/skills/permdock-tenancy/references/ownership-and-custom-roles.md +83 -0
  288. package/skills/permdock-wire/SKILL.md +116 -0
  289. package/skills/permdock-wire/references/adapters.md +480 -0
  290. package/skills/permdock-wire/references/policy-options.md +43 -0
@@ -0,0 +1,415 @@
1
+ import { C as Policy, E as PolicyVocabulary, Er as SqlFunctionCondition, Pn as DenialReason, Sr as OpaqueCondition, Tr as SqlFunctionArg, Z as DecisionEvent, Zt as PermDock, at as LimitStore, cr as CustomRole, ct as MembershipSource, ft as RelationSource, gt as Snapshot, h as Grant, hr as Subject, mr as Principal, pr as Membership, q as AccessEvent, tt as EntitlementSource, ur as Delegation, vr as ConditionRef, w as PolicyDelegation } from "./policy-CInmNGkM.js";
2
+ import { d as Permission, n as ActionMeta, p as PermissionTree, t as ActionList, x as ResourceRelationInput, y as ResourceParent } from "./permissions-B4apnahQ.js";
3
+ //#region src/core/custom-roles.d.ts
4
+ type CustomRoleDropReason = "unknown-permission" | "outside-ceiling" | "condition-not-allowed";
5
+ /** Why part of a custom role was left out: a permission, or an undeclared include. */
6
+ type CustomRoleDrop = {
7
+ readonly permission: string;
8
+ readonly reason: CustomRoleDropReason;
9
+ } | {
10
+ readonly role: string;
11
+ readonly reason: "unknown-role";
12
+ };
13
+ /** A stored grant that named a permission by a key it was renamed from. */
14
+ type CustomRoleRename = {
15
+ readonly from: string;
16
+ readonly to: string;
17
+ };
18
+ type ResolvedCustomRole = {
19
+ /** Declared grants re-targeted to the custom role; conditions and approvals kept. */
20
+ readonly grants: readonly Grant[];
21
+ readonly dropped: readonly CustomRoleDrop[];
22
+ /** Grants stored under a former key (`definePermissions` `renamed`), resolved to the current one. */
23
+ readonly renamed: readonly CustomRoleRename[];
24
+ };
25
+ type CustomRoleValidation = {
26
+ readonly ok: boolean;
27
+ /** Permission keys the role allows after the ceiling, sorted. */
28
+ readonly permissions: readonly string[];
29
+ readonly dropped: readonly CustomRoleDrop[];
30
+ /** Grants to rewrite in storage: each still resolves, under its current key. */
31
+ readonly renamed: readonly CustomRoleRename[];
32
+ };
33
+ /**
34
+ * The one resolver behind evaluation, snapshots and `validateCustomRole`.
35
+ * Included roles' grants plus the role's own allows, minus its denies, all
36
+ * intersected with the ceiling. An allow inherits the condition, approval and
37
+ * limit of the declared grant it comes from: an included assignable role's
38
+ * grant when there is one, otherwise every ceiling grant of that permission,
39
+ * together with the denies of the roles those grants belong to.
40
+ */
41
+ declare function resolveCustomRole(policy: Policy, role: CustomRole): ResolvedCustomRole;
42
+ declare function validateCustomRole(policy: Policy, role: CustomRole): CustomRoleValidation;
43
+ /**
44
+ * The compact JWT form of custom roles for the `memberships[].grants` claim
45
+ * RLS reads in `jwt` mode: role name to entries, where `key` allows, `-key`
46
+ * denies and `@role` includes. Put a team custom role on its team membership.
47
+ * Pass `policy` to write keys stored under a former name as the current key.
48
+ */
49
+ declare function customRoleClaim(roles: readonly CustomRole[], policy?: Policy): Readonly<Record<string, readonly string[]>>;
50
+ //#endregion
51
+ //#region src/core/relations.d.ts
52
+ type MemoryEdge = {
53
+ /** The object's id. */
54
+ readonly id: string;
55
+ readonly principal: string;
56
+ readonly startsAt?: number;
57
+ readonly expiresAt?: number;
58
+ };
59
+ type MemoryRelationsData = {
60
+ /** Rows per resource: parent pointers, links, restricted flags and relation columns are read from them. */
61
+ readonly rows?: Readonly<Record<string, readonly Readonly<Record<string, unknown>>[]>>;
62
+ /** Edge-table rows per resource and relation. */
63
+ readonly edges?: Readonly<Record<string, Readonly<Record<string, readonly MemoryEdge[]>>>>;
64
+ /**
65
+ * Edge tables as the database holds them, keyed by `edge` name: each row
66
+ * is read through the relation's `object`, `subject`, `expiresAt`, `match`
67
+ * and `groups` columns. A relation whose table is here ignores `edges`.
68
+ */
69
+ readonly tables?: Readonly<Record<string, readonly Readonly<Record<string, unknown>>[]>>;
70
+ };
71
+ /**
72
+ * An in-process `RelationSource` over plain rows and edges, read against the
73
+ * resource definitions in `permissions`. For tests, fixtures and small apps.
74
+ */
75
+ declare function memoryRelations(permissions: PermissionTree, data?: MemoryRelationsData): RelationSource;
76
+ //#endregion
77
+ //#region src/core/snapshot.d.ts
78
+ declare function parseSnapshot(json: unknown): Snapshot;
79
+ //#endregion
80
+ //#region src/core/from-snapshot.d.ts
81
+ declare function fromSnapshot(snapshot: Snapshot, options?: {
82
+ readonly tenant?: string;
83
+ readonly team?: string;
84
+ }): PermDock;
85
+ declare function emptySnapshot(): Snapshot;
86
+ //#endregion
87
+ //#region src/conditions/refs.d.ts
88
+ type KnownRefField = "id" | "issuer" | "kind" | "tenant" | "team" | "roles" | "plans" | "memberships" | "assurance" | "binding" | "session";
89
+ type SubjectRef = ConditionRef & { readonly [K in KnownRefField]: SubjectRef; } & {
90
+ readonly [key: string]: SubjectRef;
91
+ };
92
+ declare const principal: SubjectRef;
93
+ declare const context: SubjectRef;
94
+ //#endregion
95
+ //#region src/core/approval-required.d.ts
96
+ declare function requiresApproval(approval: Grant["approval"] | undefined): boolean;
97
+ //#endregion
98
+ //#region src/conditions/opaque.d.ts
99
+ declare function opaque(input: {
100
+ readonly sql: string;
101
+ readonly fingerprint: string;
102
+ }): OpaqueCondition;
103
+ //#endregion
104
+ //#region src/conditions/sql-function.d.ts
105
+ declare function sqlFunction(name: string, options: {
106
+ readonly args?: readonly SqlFunctionArg[];
107
+ readonly twin: unknown;
108
+ }): SqlFunctionCondition;
109
+ //#endregion
110
+ //#region src/core/memberships.d.ts
111
+ /**
112
+ * One `MembershipSource` over several: memberships are merged and
113
+ * de-duplicated, `list` concatenates the sources that can list, and `version`
114
+ * is the highest version any source reports. A source that throws makes the
115
+ * whole lookup throw, which the subject resolver turns into no memberships.
116
+ */
117
+ declare function composeMemberships(sources: readonly MembershipSource[]): MembershipSource;
118
+ /**
119
+ * Trust the memberships the verified token carries, and read `source` only
120
+ * when the token marks them truncated. With `version`, a token minted before
121
+ * the latest membership change is stale for the policy's `fresh` permissions.
122
+ */
123
+ declare function claimsFirst(source: MembershipSource | readonly MembershipSource[], options?: {
124
+ readonly version?: MembershipSource["version"];
125
+ }): MembershipSource;
126
+ /** Whether the identity provider owns `membership`: the application must not add, change or remove it. */
127
+ declare function isExternallyManaged(membership: Membership): boolean;
128
+ //#endregion
129
+ //#region src/core/stripe-entitlements.d.ts
130
+ /** The part of the Stripe Node SDK this source calls: `stripe.entitlements.activeEntitlements.list`. */
131
+ type StripeEntitlementsClient = {
132
+ readonly entitlements: {
133
+ readonly activeEntitlements: {
134
+ list(params: {
135
+ readonly customer: string;
136
+ readonly limit?: number;
137
+ readonly starting_after?: string;
138
+ }): PromiseLike<{
139
+ readonly data: readonly {
140
+ readonly id: string;
141
+ readonly lookup_key: string;
142
+ }[];
143
+ readonly has_more: boolean;
144
+ }>;
145
+ };
146
+ };
147
+ };
148
+ /**
149
+ * Plan names from Stripe Entitlements: the `lookup_key` of every active
150
+ * entitlement of the tenant's Stripe customer. `customer` maps the active
151
+ * tenant to its customer id; no tenant or no customer means no entitlements.
152
+ * Pass it as `entitlements`, and grant with `plan('<lookup_key>')`.
153
+ */
154
+ declare function fromStripeEntitlements(options: {
155
+ readonly stripe: StripeEntitlementsClient;
156
+ readonly customer: (tenant: string, principal: {
157
+ readonly id: string;
158
+ }) => string | undefined | PromiseLike<string | undefined>;
159
+ }): EntitlementSource;
160
+ //#endregion
161
+ //#region src/core/limits.d.ts
162
+ declare function memoryLimitStore(): LimitStore & {
163
+ /** Live counters, for tests and diagnostics. */
164
+ size(): number;
165
+ };
166
+ //#endregion
167
+ //#region src/core/may-access.d.ts
168
+ /**
169
+ * An optimistic routing hint for a proxy or middleware, never a decision.
170
+ * `false` only when the subject's declared roles provably lack `permission`;
171
+ * `true` whenever custom roles, plans, memberships the claims do not carry or
172
+ * row conditions could still grant it. Synchronous, no network, never throws.
173
+ * Pages, Server Actions and RLS remain the enforcement points.
174
+ */
175
+ declare function mayAccess(policy: Policy, user: unknown, permission: Permission, options?: {
176
+ readonly tenant?: string;
177
+ }): boolean;
178
+ //#endregion
179
+ //#region src/core/may-use.d.ts
180
+ /**
181
+ * Whether `permission` could be granted to this instance's subject for some
182
+ * row: the grants its snapshot carries for the active tenant, minus an
183
+ * unconditional deny, within its delegation. A listing hint for tools and
184
+ * skills, never a decision; the call itself is decided in full.
185
+ */
186
+ declare function mayUse(permdock: PermDock, permission: Permission): boolean;
187
+ //#endregion
188
+ //#region src/core/instance.d.ts
189
+ type SnapshotInclude = readonly (Permission | {
190
+ readonly [key: string]: unknown;
191
+ })[];
192
+ //#endregion
193
+ //#region src/core/snapshot-for.d.ts
194
+ type SnapshotForOptions = {
195
+ /** Active tenant; ignored unless the subject holds a membership in it. */
196
+ readonly tenant?: string;
197
+ /** Database mode: replaces the memberships carried by the subject. */
198
+ readonly memberships?: readonly Membership[];
199
+ /** The tenant's custom roles, typically from a shared, tagged cache. */
200
+ readonly customRoles?: readonly CustomRole[];
201
+ /** Per tenant, the role names `RoleSource.assignable` returns; narrows `assignable`. */
202
+ readonly assignable?: Readonly<Record<string, readonly string[]>>;
203
+ /** Plans of the active tenant; replaces `principal.plans`. */
204
+ readonly plans?: readonly string[];
205
+ readonly include?: SnapshotInclude;
206
+ readonly tenants?: "all";
207
+ /** Epoch seconds for `issuedAt` and membership expiry. Defaults to the clock. */
208
+ readonly now?: number;
209
+ };
210
+ /**
211
+ * Builds the serializable access snapshot for a subject without a request,
212
+ * a network call or a cache directive: call it inside the app's own
213
+ * `'use cache: private'` function. Synchronous; the policy's `subject` and
214
+ * `context` mappers must be synchronous too.
215
+ */
216
+ declare function snapshotFor<TUser, TPrincipal extends Principal = Principal, V extends PolicyVocabulary = PolicyVocabulary>(policy: Policy<TUser, TPrincipal, V>, user: TUser | Subject | null, options?: SnapshotForOptions): Snapshot;
217
+ //#endregion
218
+ //#region src/core/presets.d.ts
219
+ type ReadOnlyMeta = {
220
+ readonly readOnly: true;
221
+ };
222
+ type DestructiveMeta = {
223
+ readonly destructive: true;
224
+ };
225
+ type CrudActions = {
226
+ readonly read: ReadOnlyMeta;
227
+ readonly update: ActionMeta;
228
+ readonly delete: DestructiveMeta;
229
+ };
230
+ type CrudCollection = {
231
+ readonly create: ActionMeta;
232
+ readonly list: ReadOnlyMeta;
233
+ };
234
+ type ReadableActions = {
235
+ readonly read: ReadOnlyMeta;
236
+ };
237
+ type ReadableCollection = {
238
+ readonly list: ReadOnlyMeta;
239
+ };
240
+ type WritableActions = {
241
+ readonly read: ReadOnlyMeta;
242
+ readonly update: ActionMeta;
243
+ };
244
+ declare const CRUD_ACTIONS: CrudActions;
245
+ declare const CRUD_COLLECTION: CrudCollection;
246
+ declare const READABLE_ACTIONS: ReadableActions;
247
+ declare const READABLE_COLLECTION: ReadableCollection;
248
+ declare const WRITABLE_ACTIONS: WritableActions;
249
+ type EmptyRecord = Record<never, never>;
250
+ declare const WRITABLE_COLLECTION: EmptyRecord;
251
+ type ActionNames<A extends ActionList | undefined> = A extends readonly string[] ? A[number] & string : A extends Record<string, ActionMeta> ? keyof A & string : never;
252
+ type ToActionRecord<A extends ActionList | undefined> = [ActionNames<A>] extends [never] ? EmptyRecord : { readonly [K in ActionNames<A>]: ActionMeta; };
253
+ type OverlayMeta<Base extends ActionMeta, Extra extends ActionMeta> = Omit<Base, keyof Extra> & Extra;
254
+ type MergeActionRecords<Base extends Record<string, ActionMeta>, Extra extends Record<string, ActionMeta>> = { readonly [K in keyof Base | keyof Extra]: K extends keyof Extra ? K extends keyof Base ? OverlayMeta<Base[K] & ActionMeta, Extra[K] & ActionMeta> : Extra[K] & ActionMeta : K extends keyof Base ? Base[K] & ActionMeta : never; };
255
+ type PresetOptions<A extends ActionList | undefined = undefined, C extends ActionList | undefined = undefined> = {
256
+ readonly id?: string;
257
+ readonly parent?: ResourceParent;
258
+ readonly relations?: Readonly<Record<string, ResourceRelationInput>>;
259
+ readonly restricted?: string;
260
+ readonly disclosure?: "hide" | "reveal";
261
+ readonly actions?: A;
262
+ readonly collection?: C;
263
+ };
264
+ type PresetResult<BaseA extends Record<string, ActionMeta>, BaseC extends Record<string, ActionMeta>, A extends ActionList | undefined, C extends ActionList | undefined> = {
265
+ readonly id?: string;
266
+ readonly parent?: ResourceParent;
267
+ readonly relations?: Readonly<Record<string, ResourceRelationInput>>;
268
+ readonly restricted?: string;
269
+ readonly disclosure?: "hide" | "reveal";
270
+ readonly actions: MergeActionRecords<BaseA, ToActionRecord<A>>;
271
+ readonly collection?: MergeActionRecords<BaseC, ToActionRecord<C>>;
272
+ };
273
+ declare function crud<const A extends ActionList | undefined = undefined, const C extends ActionList | undefined = undefined>(options?: PresetOptions<A, C>): PresetResult<typeof CRUD_ACTIONS, typeof CRUD_COLLECTION, A, C>;
274
+ declare function readable<const A extends ActionList | undefined = undefined, const C extends ActionList | undefined = undefined>(options?: PresetOptions<A, C>): PresetResult<typeof READABLE_ACTIONS, typeof READABLE_COLLECTION, A, C>;
275
+ declare function writable<const A extends ActionList | undefined = undefined, const C extends ActionList | undefined = undefined>(options?: PresetOptions<A, C>): PresetResult<typeof WRITABLE_ACTIONS, typeof WRITABLE_COLLECTION, A, C>;
276
+ //#endregion
277
+ //#region src/core/duration.d.ts
278
+ declare function parseDuration(input: unknown): number | undefined;
279
+ //#endregion
280
+ //#region src/core/ocsf.d.ts
281
+ /** The OCSF schema version `toOcsf` emits. */
282
+ declare const OCSF_VERSION = "1.3.0";
283
+ /** An OCSF Authorize Session (class 3003, category Identity and Access Management) event. */
284
+ type OcsfAuthorizeSession = {
285
+ readonly class_uid: 3003;
286
+ readonly category_uid: 3;
287
+ readonly activity_id: 1;
288
+ readonly type_uid: 300301;
289
+ readonly severity_id: 1 | 4;
290
+ readonly time: number;
291
+ readonly status_id: 0 | 1 | 2 | 99;
292
+ readonly status: "Unknown" | "Success" | "Failure" | "Other";
293
+ readonly status_detail?: string;
294
+ readonly message: string;
295
+ readonly privileges: readonly string[];
296
+ /** OCSF requires `user`; an anonymous subject is `{ name: 'anonymous' }`. */
297
+ readonly user: {
298
+ readonly uid: string;
299
+ } | {
300
+ readonly name: "anonymous";
301
+ };
302
+ readonly actor?: {
303
+ readonly user?: {
304
+ readonly uid: string;
305
+ };
306
+ readonly app_name?: string;
307
+ };
308
+ readonly metadata: {
309
+ readonly version: typeof OCSF_VERSION;
310
+ readonly product: {
311
+ readonly name: "PermDock";
312
+ readonly vendor_name: "PermDock";
313
+ readonly feature?: {
314
+ readonly name: string;
315
+ };
316
+ };
317
+ readonly tenant_uid?: string;
318
+ readonly correlation_uid?: string;
319
+ };
320
+ readonly unmapped: {
321
+ readonly outcome: DecisionEvent["outcome"];
322
+ readonly scope: string;
323
+ readonly resource: DecisionEvent["resource"];
324
+ readonly source: DecisionEvent["source"];
325
+ readonly phase?: DecisionEvent["phase"];
326
+ readonly role?: string | null;
327
+ readonly via?: string | null;
328
+ /** Set high-severity break-glass events apart in a SIEM. */
329
+ readonly breakGlass?: true;
330
+ readonly purpose?: readonly string[];
331
+ readonly reason?: string;
332
+ };
333
+ };
334
+ /** Projects a decision or approval event onto OCSF Authorize Session; the event itself is unchanged. */
335
+ declare function toOcsf(event: DecisionEvent): OcsfAuthorizeSession;
336
+ /**
337
+ * An OCSF Account Change (class 3001) event for a support-access lifecycle
338
+ * event: `started` enables the session, `ended` and `revoked` disable it.
339
+ * Support access is high severity, so a SIEM can alert on vendor access.
340
+ */
341
+ type OcsfAccountChange = {
342
+ readonly class_uid: 3001;
343
+ readonly category_uid: 3;
344
+ /** 2 Enable for `started`, 5 Disable for `ended` and `revoked`. */
345
+ readonly activity_id: 2 | 5;
346
+ readonly type_uid: 300102 | 300105;
347
+ readonly severity_id: 4;
348
+ readonly time: number;
349
+ readonly message: string;
350
+ readonly user: {
351
+ readonly uid: string;
352
+ };
353
+ readonly actor?: {
354
+ readonly user?: {
355
+ readonly uid: string;
356
+ };
357
+ };
358
+ readonly metadata: {
359
+ readonly version: typeof OCSF_VERSION;
360
+ readonly product: {
361
+ readonly name: "PermDock";
362
+ readonly vendor_name: "PermDock";
363
+ };
364
+ readonly tenant_uid: string;
365
+ };
366
+ readonly unmapped: {
367
+ readonly operation: AccessEvent["operation"];
368
+ readonly via: string;
369
+ readonly roles: readonly string[];
370
+ readonly member?: {
371
+ readonly group: string;
372
+ };
373
+ readonly grantedBy?: string;
374
+ readonly reason?: string;
375
+ };
376
+ };
377
+ declare function accessToOcsf(event: AccessEvent): OcsfAccountChange;
378
+ //#endregion
379
+ //#region src/core/csv.d.ts
380
+ /** The CSV export columns, in order; the header row of every CSV file. */
381
+ declare const CSV_COLUMNS: readonly ["time", "principal", "actor", "tenant", "permission", "outcome", "matched.role", "via", "denials.reason", "token"];
382
+ /**
383
+ * One RFC 4180 row for a decision or approval event, without a line
384
+ * terminator; join rows with CRLF under a `CSV_COLUMNS` header.
385
+ */
386
+ declare function toCsvRow(event: DecisionEvent): string;
387
+ //#endregion
388
+ //#region src/core/catalog-fingerprint.d.ts
389
+ /**
390
+ * The catalog v1 fingerprint: base64url SHA-256 of canonical JSON (keys
391
+ * sorted, no whitespace) without `generatedAt`, `generator`, `fingerprint`
392
+ * and every `permissions[].usages`, so neither the CLI version, the clock nor
393
+ * call sites change it.
394
+ */
395
+ declare function catalogFingerprint(catalog: unknown): string;
396
+ //#endregion
397
+ //#region src/core/delegation.d.ts
398
+ type DelegatedPermission = Pick<Permission, "scope" | "resource" | "action">;
399
+ /**
400
+ * Whether a delegated caller may use a permission its principal holds, through
401
+ * OAuth `scopes`, RFC 9396 `authorizationDetails` or GNAP `access`.
402
+ * `undefined` means covered; otherwise the denial reason `decide` would add.
403
+ */
404
+ declare function coveredByDelegation(permission: DelegatedPermission, delegation: Delegation | undefined, resourceId?: string, hasActor?: boolean): DenialReason | undefined;
405
+ /**
406
+ * The permission keys the policy's delegations let `subject.actor` use for
407
+ * `subject.principal` right now: the union over every active delegation whose
408
+ * `to` matches the actor and whose `from` the principal holds. `undefined`
409
+ * when none applies, so the call falls back to the token delegation alone.
410
+ * An actor with `readOnly: true` gets only each delegation's read-only keys.
411
+ * Attenuation only: a key here still needs a matching allow and no deny.
412
+ */
413
+ declare function delegatedPermissions(delegations: readonly PolicyDelegation[] | undefined, subject: Subject, heldRoles: ReadonlySet<string>, now: number): ReadonlySet<string> | undefined;
414
+ //#endregion
415
+ export { emptySnapshot as A, ResolvedCustomRole as B, composeMemberships as C, requiresApproval as D, opaque as E, memoryRelations as F, resolveCustomRole as H, CustomRoleDrop as I, CustomRoleDropReason as L, parseSnapshot as M, MemoryEdge as N, context as O, MemoryRelationsData as P, CustomRoleRename as R, claimsFirst as S, sqlFunction as T, validateCustomRole as U, customRoleClaim as V, mayUse as _, toCsvRow as a, StripeEntitlementsClient as b, OcsfAuthorizeSession as c, parseDuration as d, crud as f, snapshotFor as g, SnapshotForOptions as h, CSV_COLUMNS as i, fromSnapshot as j, principal as k, accessToOcsf as l, writable as m, delegatedPermissions as n, OCSF_VERSION as o, readable as p, catalogFingerprint as r, OcsfAccountChange as s, coveredByDelegation as t, toOcsf as u, mayAccess as v, isExternallyManaged as w, fromStripeEntitlements as x, memoryLimitStore as y, CustomRoleValidation as z };
@@ -0,0 +1,11 @@
1
+ import { $ as DecisionSink, $n as relation, $t as RowPair, A as RoleScope, An as memoryApprovalPolicies, Ar as isConditionRef, At as memoryEntitlementSource, B as normalizeAssurance, Bn as Obligation, Bt as CredentialPolicy, C as Policy, Cn as ArazzoPlan, Cr as RelatedCondition, Ct as TenantSettings, D as PrincipalOf, Dn as simulateArazzo, Dr as hasConditionOp, Dt as VerificationFailure, En as arazzoFindings, Er as SqlFunctionCondition, Et as TokenVerifier, F as ValidateMode, Fn as DeniedDecision, Ft as Credential, G as UserApprover, Gn as Grantee, Gt as credentialDelegation, H as separationConflicts, Hn as Trace, Ht as CredentialPrincipal, I as allow, In as ExplainedDecision, It as CredentialDecision, J as AuthEvent, Jn as actor, Jt as decideCredential, K as user, Kn as GranteeInput, Kt as credentialPolicyViolation, L as definePolicy, Ln as GrantedDecision, Lt as CredentialKind, M as SubjectOf, Mn as Decision, Mt as memorySettings, N as SupportAccessOptions, Nn as Denial, Nt as WireDecision, O as RoleBinding, On as ApprovalPolicy, Or as isCondition, Ot as VerifiedToken, P as SupportConsent, Pn as DenialReason, Pt as WireDenial, Q as DecisionProvider, Qn as plan, Qt as PermDockOptions, R as deny, Rn as LimitDetail, Rt as CredentialPermission, S as MembershipFixture, Sn as ArazzoFinding, St as SubjectResolver, T as PolicyScopes, Tn as ArazzoStepResult, Tr as SqlFunctionArg, Tt as TokenSigner, U as Approver, Un as TraceSkip, Ut as CredentialRequest, V as role, Vn as Quota, Vt as CredentialPolicyViolation, W as ApproverInput, Wn as TraceSkipReason, Wt as DecideCredentialOptions, X as CredentialVerifier, Xn as assurance, Xt as DecideOptions, Y as CredentialEvent, Yn as anyone, Yt as parseCredential, Z as DecisionEvent, Zn as authenticated, Zt as PermDock, _ as GrantLimit, _n as RoleChangeOptions, _r as Condition, _t as SnapshotAssignable, a as ApprovalRequirement, an as HostedGrantDropped, ar as Assurance, at as LimitStore, b as GrantValidity, bn as breakGlass, br as MemberOfCondition, bt as SnapshotScope, c as BreakGlassOptions, cn as isPortableCondition, cr as CustomRole, ct as MembershipSource, d as ClosureContext, dn as parsePolicyDocument, dr as GnapAccess, dt as RelationHolder, en as SimulateOptions, er as PolicyScopesInput, et as DirectoryEvent, f as ClosureGrantFn, fn as Holder, ft as RelationSource, g as GrantCondition, gn as RoleChangeDecision, gr as VerifiedClaims, gt as Snapshot, h as Grant, hn as RoleChange, hr as Subject, ht as SinkEvent, i as ApprovalOption, in as HostedGrantDropReason, ir as Actor, it as LimitRemaining, j as SeparationConflict, jn as ApprovalRequiredDecision, jr as isSqlFunctionField, jt as memoryRoleSource, k as RoleOptions, kn as ApprovalPolicySource, kr as isConditionDate, kt as WhereCompiler, l as BreakGlassRequirements, ln as memoryPolicySource, lr as CustomRoleGrant, lt as RelationChain, m as DelegationTarget, mn as WhoCan, mr as Principal, mt as SettingsSource, n as ApprovalEscalation, nn as createPermDock, nr as ScopeDeclaration, o as ApprovalStage, on as PolicyDocument, or as AuthorizationDetail, ot as MemberEntry, p as DelegationInput, pn as HoldingVia, pr as Membership, pt as RoleSource, q as AccessEvent, qn as RelationGrantee, qt as credentialSubject, r as ApprovalMode, rn as HostedGrant, rr as ScopeNames, rt as LimitConsumeInput, s as AssuranceRequirement, sn as PolicySource, sr as Binding, st as MembershipEvent, t as ActivationOption, tn as WhereResult, tr as Scope, tt as EntitlementSource, u as BreakGlassSpec, un as mergeHostedGrants, ur as Delegation, ut as RelationGroup, v as GrantOptions, vn as RoleChangeTarget, vr as ConditionRef, vt as SnapshotGrant, w as PolicyDelegation, wn as ArazzoSimulateInput, wr as RelatedHop, wt as TokenFailureCause, x as HostedGrantRef, xn as supportAccess, xr as MemberOfParent, xt as SnapshotSource, y as GrantScope, yn as ActivateInput, yr as ConditionValue, yt as SnapshotNotEntitled, z as normalizeApproval, zn as MatchedGrant, zt as CredentialPermissionInput } from "./policy-CInmNGkM.js";
2
+ import { C as findPermission, D as listPermissions, E as isPermission, O as mergePermissions, S as definePermissions, T as getResource, _ as ResourceNode, a as EdgeGroups, b as ResourceRelation, c as FieldRelation, d as Permission, f as PermissionKind, g as ResourceLink, h as ResourceInit, i as DefinePermissionsOptions, k as resource, m as PrincipalRelation, n as ActionMeta, o as EdgeMatch, p as PermissionTree, r as ComputedRelation, s as EdgeRelation, u as MetaValue, v as ResourceOptions, w as formerKeys, x as ResourceRelationInput, y as ResourceParent } from "./permissions-B4apnahQ.js";
3
+ import { a as RoleTree, c as defineRoles, d as isRole, f as listPlans, i as RoleMeta, l as findRole, n as PlanTree, o as Vocabulary, p as listRoles, r as Role, s as definePlans, t as Plan, u as isPlan } from "./vocabulary-Dk0fs-Jk.js";
4
+ import { A as emptySnapshot, B as ResolvedCustomRole, C as composeMemberships, D as requiresApproval, E as opaque, F as memoryRelations, H as resolveCustomRole, I as CustomRoleDrop, L as CustomRoleDropReason, M as parseSnapshot, N as MemoryEdge, O as context, P as MemoryRelationsData, R as CustomRoleRename, S as claimsFirst, T as sqlFunction, U as validateCustomRole, V as customRoleClaim, _ as mayUse, a as toCsvRow, b as StripeEntitlementsClient, c as OcsfAuthorizeSession, d as parseDuration, f as crud, g as snapshotFor, h as SnapshotForOptions, i as CSV_COLUMNS, j as fromSnapshot, k as principal, l as accessToOcsf, m as writable, n as delegatedPermissions, o as OCSF_VERSION, p as readable, r as catalogFingerprint, s as OcsfAccountChange, t as coveredByDelegation, u as toOcsf, v as mayAccess, w as isExternallyManaged, x as fromStripeEntitlements, y as memoryLimitStore, z as CustomRoleValidation } from "./index-xIxJLwOQ.js";
5
+ import { a as PermDockValidationError, i as PermDockRevokedError, n as PermDockApprovalRequiredError, o as ProblemDetails, r as PermDockDeniedError, s as RevokedCode } from "./errors-DbZ1YOnb.js";
6
+ import { a as CloudEvent, c as MemorySinkOptions, d as credentialEvent, f as membershipEvent, h as toCloudEvent, i as CatalogFindingCode, l as SignDecisionBatchOptions, m as signDecisionBatch, n as CatalogEventData, o as CloudEventType, p as memorySink, r as CatalogFinding, s as MemorySink, t as CLOUD_EVENT_TYPES, u as accessEvent } from "./sink-Cfr9-7YC.js";
7
+ import { i as memoryRevocationFeed, n as RevocationFeed, r as RevocationListener, t as RevocationEvent } from "./revocations-Cy06JNx2.js";
8
+ import { a as requiredPlans, i as describe, n as DescribeMessages, r as DescribeOptions, t as DecisionDescription } from "./describe-DernyItf.js";
9
+ import { n as parsePermDockDigest, t as PermDockDigest } from "./digest-B3kc_PgQ.js";
10
+ import { a as LinkPolicyViolation, c as capabilitySubject, d as signCapability, i as LinkPolicy, l as linkPolicyViolation, n as CapabilityInput, o as LinkPrincipal, r as CapabilityRedeemer, s as SignCapabilityOptions, t as Capability, u as parseCapability } from "./capability-BDG_nkxt.js";
11
+ export { type AccessEvent, type ActionMeta, type ActivateInput, type ActivationOption, type Actor, type ApprovalEscalation, type ApprovalMode, type ApprovalOption, type ApprovalPolicy, type ApprovalPolicySource, type ApprovalRequiredDecision, type ApprovalRequirement, type ApprovalStage, type Approver, type ApproverInput, type ArazzoFinding, type ArazzoPlan, type ArazzoSimulateInput, type ArazzoStepResult, type Assurance, type AssuranceRequirement, type AuthEvent, type AuthorizationDetail, type Binding, type BreakGlassOptions, type BreakGlassRequirements, type BreakGlassSpec, CLOUD_EVENT_TYPES, CSV_COLUMNS, type Capability, type CapabilityInput, type CapabilityRedeemer, type CatalogEventData, type CatalogFinding, type CatalogFindingCode, type ClosureContext, type ClosureGrantFn, type CloudEvent, type CloudEventType, type ComputedRelation, type Condition, type ConditionRef, type ConditionValue, type Credential, type CredentialDecision, type CredentialEvent, type CredentialKind, type CredentialPermission, type CredentialPermissionInput, type CredentialPolicy, type CredentialPolicyViolation, type CredentialPrincipal, type CredentialRequest, type CredentialVerifier, type CustomRole, type CustomRoleDrop, type CustomRoleDropReason, type CustomRoleGrant, type CustomRoleRename, type CustomRoleValidation, type DecideCredentialOptions, type DecideOptions, type Decision, type DecisionDescription, type DecisionEvent, type DecisionProvider, type DecisionSink, type DefinePermissionsOptions, type Delegation, type DelegationInput, type DelegationTarget, type Denial, type DenialReason, type DeniedDecision, type DescribeMessages, type DescribeOptions, type DirectoryEvent, type EdgeGroups, type EdgeMatch, type EdgeRelation, type EntitlementSource, type ExplainedDecision, type FieldRelation, type GnapAccess, type Grant, type GrantCondition, type GrantLimit, type GrantOptions, type GrantScope, type GrantValidity, type GrantedDecision, type Grantee, type GranteeInput, type Holder, type HoldingVia, type HostedGrant, type HostedGrantDropReason, type HostedGrantDropped, type HostedGrantRef, type LimitConsumeInput, type LimitDetail, type LimitRemaining, type LimitStore, type LinkPolicy, type LinkPolicyViolation, type LinkPrincipal, type MatchedGrant, type MemberEntry, type MemberOfCondition, type MemberOfParent, type Membership, type MembershipEvent, type MembershipFixture, type MembershipSource, type MemoryEdge, type MemoryRelationsData, type MemorySink, type MemorySinkOptions, type MetaValue, OCSF_VERSION, type Obligation, type OcsfAccountChange, type OcsfAuthorizeSession, type PermDock, PermDockApprovalRequiredError, PermDockDeniedError, type PermDockDigest, type PermDockOptions, PermDockRevokedError, PermDockValidationError, type Permission, type PermissionKind, type PermissionTree, type Plan, type PlanTree, type Policy, type PolicyDelegation, type PolicyDocument, type PolicyScopes, type PolicyScopesInput, type PolicySource, type Principal, type PrincipalOf, type PrincipalRelation, type ProblemDetails, type Quota, type RelatedCondition, type RelatedHop, type RelationChain, type RelationGrantee, type RelationGroup, type RelationHolder, type RelationSource, type ResolvedCustomRole, type ResourceInit, type ResourceLink, type ResourceNode, type ResourceOptions, type ResourceParent, type ResourceRelation, type ResourceRelationInput, type RevocationEvent, type RevocationFeed, type RevocationListener, type RevokedCode, type Role, type RoleBinding, type RoleChange, type RoleChangeDecision, type RoleChangeOptions, type RoleChangeTarget, type RoleMeta, type RoleOptions, type RoleScope, type RoleSource, type RoleTree, type RowPair, type Scope, type ScopeDeclaration, type ScopeNames, type SeparationConflict, type SettingsSource, type SignCapabilityOptions, type SignDecisionBatchOptions, type SimulateOptions, type SinkEvent, type Snapshot, type SnapshotAssignable, type SnapshotForOptions, type SnapshotGrant, type SnapshotNotEntitled, type SnapshotScope, type SnapshotSource, type SqlFunctionArg, type SqlFunctionCondition, type StripeEntitlementsClient, type Subject, type SubjectOf, type SubjectResolver, type SupportAccessOptions, type SupportConsent, type TenantSettings, type TokenFailureCause, type TokenSigner, type TokenVerifier, type Trace, type TraceSkip, type TraceSkipReason, type UserApprover, type ValidateMode, type VerificationFailure, type VerifiedClaims, type VerifiedToken, type Vocabulary, type WhereCompiler, type WhereResult, type WhoCan, type WireDecision, type WireDenial, accessEvent, accessToOcsf, actor, allow, anyone, arazzoFindings, assurance, authenticated, breakGlass, capabilitySubject, catalogFingerprint, claimsFirst, composeMemberships, context, coveredByDelegation, createPermDock, credentialDelegation, credentialEvent, credentialPolicyViolation, credentialSubject, crud, customRoleClaim, decideCredential, definePermissions, definePlans, definePolicy, defineRoles, delegatedPermissions, deny, describe, emptySnapshot, findPermission, findRole, formerKeys, fromSnapshot, fromStripeEntitlements, getResource, hasConditionOp, isCondition, isConditionDate, isConditionRef, isExternallyManaged, isPermission, isPlan, isPortableCondition, isRole, isSqlFunctionField, linkPolicyViolation, listPermissions, listPlans, listRoles, mayAccess, mayUse, membershipEvent, memoryApprovalPolicies, memoryEntitlementSource, memoryLimitStore, memoryPolicySource, memoryRelations, memoryRevocationFeed, memoryRoleSource, memorySettings, memorySink, mergeHostedGrants, mergePermissions, normalizeApproval, normalizeAssurance, opaque, parseCapability, parseCredential, parseDuration, parsePermDockDigest, parsePolicyDocument, parseSnapshot, plan, principal, readable, relation, requiredPlans, requiresApproval, resolveCustomRole, resource, role, separationConflicts, signCapability, signDecisionBatch, simulateArazzo, snapshotFor, sqlFunction, supportAccess, toCloudEvent, toCsvRow, toOcsf, user, validateCustomRole, writable };
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ import { _ as mergePermissions, a as formerKeys, c as getResource, f as isPermission, g as listPermissions, i as findPermission, n as definePermissions, y as resource } from "./permissions-DC7GROPA.js";
2
+ import { a as hasConditionOp, c as isConditionRef, l as isSqlFunctionField, o as isCondition, r as principal, s as isConditionDate, t as context } from "./refs-ChLSxbST.js";
3
+ import { a as definePolicy, d as role, f as separationConflicts, l as normalizeApproval, m as memoryLimitStore, o as deny, t as allow, u as normalizeAssurance, y as opaque } from "./policy-ANp36PnI.js";
4
+ import { a as accessToOcsf, c as readable, d as mayAccess, f as fromStripeEntitlements, g as sqlFunction, h as memorySettings, i as OCSF_VERSION, l as writable, m as memoryRoleSource, n as CSV_COLUMNS, o as toOcsf, p as memoryEntitlementSource, r as toCsvRow, s as crud, t as catalogFingerprint, u as snapshotFor } from "./src-CTNT-PBW.js";
5
+ import { r as user } from "./approvers-aH0PJkmf.js";
6
+ import { C as listPlans, S as isRole, a as authenticated, b as findRole, d as relation, i as assurance, n as anyone, t as actor, u as plan, v as definePlans, w as listRoles, x as isPlan, y as defineRoles } from "./grantee-Bv04_Vzf.js";
7
+ import { n as requiredPlans, t as describe } from "./describe-Bt1YD5uS.js";
8
+ import { r as parsePermDockDigest } from "./digest-BI-6aa6d.js";
9
+ import { i as PermDockValidationError, n as PermDockDeniedError, r as PermDockRevokedError, t as PermDockApprovalRequiredError } from "./errors-Iy71s7Oj.js";
10
+ import { a as decideCredential, n as credentialPolicyViolation, o as parseCredential, r as credentialSubject, s as memoryRevocationFeed, t as credentialDelegation } from "./credential-B_rkUNlY.js";
11
+ import { d as delegatedPermissions, h as simulateArazzo, n as parseSnapshot, p as arazzoFindings, u as coveredByDelegation } from "./snapshot-DE8dE_hz.js";
12
+ import { t as parseDuration } from "./duration-xK2jGFVc.js";
13
+ import { t as requiresApproval } from "./approval-required-TzNB9oQA.js";
14
+ import { i as parsePolicyDocument, n as memoryPolicySource, r as mergeHostedGrants, t as isPortableCondition } from "./hosted-BwKQ1BTA.js";
15
+ import { c as supportAccess, f as resolveCustomRole, g as isExternallyManaged, h as composeMemberships, l as customRoleClaim, m as claimsFirst, p as validateCustomRole, s as breakGlass, t as createPermDock, v as memoryApprovalPolicies } from "./permdock-yoZ7EjxX.js";
16
+ import { t as memoryRelations } from "./relations-r4soIFZB.js";
17
+ import { n as fromSnapshot, t as emptySnapshot } from "./from-snapshot-BMGnhmgv.js";
18
+ import { t as mayUse } from "./may-use-CnFEjVEp.js";
19
+ import { a as memorySink, i as membershipEvent, n as accessEvent, o as signDecisionBatch, r as credentialEvent, s as toCloudEvent, t as CLOUD_EVENT_TYPES } from "./sink-Bd9PSyfq.js";
20
+ import { c as signCapability, i as linkPolicyViolation, o as parseCapability, t as capabilitySubject } from "./capability-B68OFnZx.js";
21
+ export { CLOUD_EVENT_TYPES, CSV_COLUMNS, OCSF_VERSION, PermDockApprovalRequiredError, PermDockDeniedError, PermDockRevokedError, PermDockValidationError, accessEvent, accessToOcsf, actor, allow, anyone, arazzoFindings, assurance, authenticated, breakGlass, capabilitySubject, catalogFingerprint, claimsFirst, composeMemberships, context, coveredByDelegation, createPermDock, credentialDelegation, credentialEvent, credentialPolicyViolation, credentialSubject, crud, customRoleClaim, decideCredential, definePermissions, definePlans, definePolicy, defineRoles, delegatedPermissions, deny, describe, emptySnapshot, findPermission, findRole, formerKeys, fromSnapshot, fromStripeEntitlements, getResource, hasConditionOp, isCondition, isConditionDate, isConditionRef, isExternallyManaged, isPermission, isPlan, isPortableCondition, isRole, isSqlFunctionField, linkPolicyViolation, listPermissions, listPlans, listRoles, mayAccess, mayUse, membershipEvent, memoryApprovalPolicies, memoryEntitlementSource, memoryLimitStore, memoryPolicySource, memoryRelations, memoryRevocationFeed, memoryRoleSource, memorySettings, memorySink, mergeHostedGrants, mergePermissions, normalizeApproval, normalizeAssurance, opaque, parseCapability, parseCredential, parseDuration, parsePermDockDigest, parsePolicyDocument, parseSnapshot, plan, principal, readable, relation, requiredPlans, requiresApproval, resolveCustomRole, resource, role, separationConflicts, signCapability, signDecisionBatch, simulateArazzo, snapshotFor, sqlFunction, supportAccess, toCloudEvent, toCsvRow, toOcsf, user, validateCustomRole, writable };
@@ -0,0 +1,87 @@
1
+ import { Et as TokenVerifier, J as AuthEvent, Tt as TokenSigner, hr as Subject, mr as Principal, nt as JwtClaims, wt as TokenFailureCause } from "../policy-CInmNGkM.js";
2
+ import { a as JsonWebKeySet, c as JwtJwks, d as MappedSubject, i as JoseTokenVerifierOptions, l as JwtPrincipal, n as DpopProofResult, o as JwtAlgorithm, r as JoseTokenSignerOptions, s as JwtClaimPaths, t as DiscoveryInput, u as JwtSubjectOptions } from "../types-bva3i4Gf.js";
3
+ import { a as ReplayStore } from "../types-i4BAOvdb.js";
4
+ import { i as LinkPolicy, o as LinkPrincipal, t as Capability } from "../capability-BDG_nkxt.js";
5
+ import { StandardSchemaV1 } from "@standard-schema/spec";
6
+ //#region src/jwt/capability.d.ts
7
+ /** `on('auth')` causes: a verification failure, or one of the three capability checks. */
8
+ type CapabilityFailureCause = TokenFailureCause | "capability-revoked" | "capability-replayed" | "redeemer-mismatch" | "link-policy";
9
+ type CapabilitySubjectOptions = Omit<JoseTokenVerifierOptions, "typ" | "issuer" | "audience" | "profile"> & {
10
+ /** The issuer the capability was signed by (`iss`); required. */
11
+ readonly issuer: string;
12
+ /** The application the capability was signed for (`aud`); required. */
13
+ readonly audience: string | readonly string[];
14
+ readonly verifier?: TokenVerifier;
15
+ /**
16
+ * The link policies of the scope instances the linked resource sits in
17
+ * (its tenant, its customer); every one must hold. A throw denies.
18
+ */
19
+ readonly linkPolicy?: (capability: Capability) => LinkPolicy | readonly LinkPolicy[] | undefined | Promise<LinkPolicy | readonly LinkPolicy[] | undefined>;
20
+ /** `true` when the application revoked the link id (`sub`); a throw denies. */
21
+ readonly revoked?: (id: string) => boolean | Promise<boolean>;
22
+ /** Claims the `jti` of a one-time capability; a one-time capability without it is refused. */
23
+ readonly replay?: ReplayStore;
24
+ /** The request's own verified subject, checked against the capability's `redeemer`. */
25
+ readonly viewer?: Subject;
26
+ readonly onAuth?: (event: AuthEvent) => void;
27
+ readonly requestId?: string;
28
+ };
29
+ /**
30
+ * Resolves a `permdock-capability+jwt` into the `link` subject it acts as.
31
+ * Every failure (signature, `typ`, `iss`, `aud`, expiry, a malformed claim,
32
+ * a revoked link, a replayed one-time token, a redeemer the viewer does not
33
+ * satisfy, a throwing store) is the anonymous subject, never a throw.
34
+ */
35
+ export declare function subjectFromCapability(token: string | undefined | null, options: CapabilitySubjectOptions): Promise<Subject<LinkPrincipal> | Subject>;
36
+ //#endregion
37
+ //#region src/jwt/ci-oidc.d.ts
38
+ type CiOidcProvider = "github" | "gitlab" | "buildkite";
39
+ type CiOidcSubjectOptions = Omit<JoseTokenVerifierOptions, "typ" | "issuer" | "audience" | "discovery" | "profile"> & {
40
+ readonly provider: CiOidcProvider;
41
+ /** The audience the job requested the token for; required. */
42
+ readonly audience: string | readonly string[];
43
+ /**
44
+ * A self-managed GitLab or GitHub Enterprise Server issuer. Its keys come
45
+ * from OpenID discovery unless `jwks` is set.
46
+ */
47
+ readonly issuer?: string;
48
+ /** Validates the verified claims; a failure or a Promise is the anonymous subject. */
49
+ readonly schema?: StandardSchemaV1;
50
+ readonly verifier?: TokenVerifier;
51
+ readonly onAuth?: (event: AuthEvent) => void;
52
+ readonly requestId?: string;
53
+ };
54
+ /** A CI job: never a user. `ref` is a full ref (`refs/heads/main`, `refs/tags/v1`). */
55
+ type CiOidcPrincipal = Principal & {
56
+ readonly kind: "workload";
57
+ readonly issuer: string;
58
+ readonly provider: CiOidcProvider;
59
+ readonly repository?: string;
60
+ readonly ref?: string;
61
+ readonly environment?: string;
62
+ };
63
+ /**
64
+ * Resolves a CI provider's OIDC token (GitHub Actions, GitLab CI, Buildkite)
65
+ * into a `workload` principal whose id is `sub`. Every failure (signature,
66
+ * issuer, audience, expiry, a missing `sub`, the `schema`) is the anonymous
67
+ * subject, never a throw and never a user.
68
+ */
69
+ export declare function subjectFromCiOidc(token: string | undefined | null, options: CiOidcSubjectOptions): Promise<Subject<CiOidcPrincipal> | Subject>;
70
+ //#endregion
71
+ //#region src/jwt/dpop.d.ts
72
+ export declare function verifyDpopProof(request: Request, claims: JwtClaims, accessToken?: string): Promise<DpopProofResult>;
73
+ //#endregion
74
+ //#region src/jwt/introspection.d.ts
75
+ export declare function subjectFromIntrospection(response: unknown, options?: JwtSubjectOptions): MappedSubject;
76
+ //#endregion
77
+ //#region src/jwt/signer.d.ts
78
+ export declare function joseTokenSigner(options: JoseTokenSignerOptions): TokenSigner;
79
+ //#endregion
80
+ //#region src/jwt/subject.d.ts
81
+ export declare function subjectFromJwt(token: string | undefined | null, options: JwtSubjectOptions, request?: Request): Promise<MappedSubject>;
82
+ export declare function createJwtSubjectResolver(options: JwtSubjectOptions): (token: string | undefined | null, request?: Request) => Promise<MappedSubject>;
83
+ //#endregion
84
+ //#region src/jwt/verifier.d.ts
85
+ export declare function joseTokenVerifier(options: JoseTokenVerifierOptions): TokenVerifier;
86
+ //#endregion
87
+ export type { CapabilityFailureCause, CapabilitySubjectOptions, CiOidcPrincipal, CiOidcProvider, CiOidcSubjectOptions, DiscoveryInput, DpopProofResult, JoseTokenSignerOptions, JoseTokenVerifierOptions, JsonWebKeySet, JwtAlgorithm, JwtClaimPaths, JwtJwks, JwtPrincipal, JwtSubjectOptions, MappedSubject };