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,138 @@
1
+ import { Mn as Decision, Tt as TokenSigner, ft as RelationSource, hr as Subject, pr as Membership } from "./policy-CInmNGkM.js";
2
+ import { d as Permission, p as PermissionTree } from "./permissions-B4apnahQ.js";
3
+ import { a as ApprovalListFilter, c as ApprovalRequest, f as ApprovalStore, i as ApprovalInspectResult, m as ApprovalVerdict, r as ApprovalCancelMeta } from "./types-B8w5PFtS.js";
4
+ //#region src/approvals/errors.d.ts
5
+ type ApprovalErrorCode = "approval-not-found" | "approval-not-pending" | "approval-expired" | "approver-unauthenticated" | "approver-is-actor" | "approver-is-principal" | "approver-not-eligible" | "approver-repeated";
6
+ declare class ApprovalError extends Error {
7
+ override readonly name: "ApprovalError";
8
+ readonly code: ApprovalErrorCode;
9
+ constructor(code: ApprovalErrorCode, message: string);
10
+ }
11
+ /** Matches by `name` and `code`, so an error from another copy of the module still maps. */
12
+ declare function isApprovalError(value: unknown): value is ApprovalError;
13
+ //#endregion
14
+ //#region src/approvals/handler.d.ts
15
+ type ApprovalsHandlerOptions = {
16
+ readonly subject: (request: Request) => Subject | null | undefined | Promise<Subject | null | undefined>;
17
+ /** Refuse the principal even on grants that set `approval: { distinct: false }`. */
18
+ readonly requireDistinctApprover?: boolean;
19
+ readonly signer?: TokenSigner;
20
+ readonly audience?: string | readonly string[];
21
+ /** Where `relation()` approvers are read, by the request's resource id; without it they match nobody. */
22
+ readonly relations?: RelationSource;
23
+ /** The policy's permission tree, for `through` links and `includes` on relation approvers. */
24
+ readonly permissions?: PermissionTree;
25
+ };
26
+ declare function approvalsHandler(store: ApprovalStore, options: ApprovalsHandlerOptions): (request: Request) => Promise<Response>;
27
+ //#endregion
28
+ //#region src/approvals/relations.d.ts
29
+ type ApproverRelationsOptions = {
30
+ /** The object graph relation approvers are read from; without it they match nobody. */
31
+ readonly relations?: RelationSource;
32
+ /** The permission tree the policy declares; needed to follow `through` links and `includes`. */
33
+ readonly permissions?: PermissionTree;
34
+ readonly now?: Date;
35
+ };
36
+ /**
37
+ * The relation approvers of `request` that `subject` holds on its resource,
38
+ * keyed by `approverRelationKey`, for `ApprovalVerdict.relations`. Reads go
39
+ * through `relations` by the request's resource id; a request without an id,
40
+ * a missing source or a read that fails holds nothing.
41
+ */
42
+ declare function approverRelations(request: ApprovalRequest, subject: Subject, options: ApproverRelationsOptions): Promise<readonly string[]>;
43
+ //#endregion
44
+ //#region src/approvals/helpers.d.ts
45
+ declare function summariseSubject(subject: Subject): ApprovalRequest["subject"];
46
+ declare function requestApproval(store: ApprovalStore, decision: Extract<Decision, {
47
+ readonly outcome: "approval-required";
48
+ }>, meta: {
49
+ readonly permission: Permission | {
50
+ readonly key: string;
51
+ readonly scope: string;
52
+ readonly resource: string;
53
+ };
54
+ readonly resource?: {
55
+ readonly type: string;
56
+ readonly id?: string;
57
+ };
58
+ readonly subject: Subject;
59
+ readonly membership?: Membership;
60
+ readonly adapter?: string;
61
+ readonly ttl?: number;
62
+ readonly now?: Date;
63
+ readonly detail?: string;
64
+ }): Promise<ApprovalRequest>;
65
+ /**
66
+ * Checks `verdict.by` and resolves the request. Relation approvers are read
67
+ * through `options.relations` unless `verdict.relations` is already set.
68
+ */
69
+ declare function resolveApproval(store: ApprovalStore, token: string, verdict: ApprovalVerdict, options?: ApproverRelationsOptions & {
70
+ readonly requireDistinctApprover?: boolean;
71
+ }): Promise<ApprovalRequest>;
72
+ declare function inspectApproval(store: ApprovalStore, token: string, now?: Date): Promise<ApprovalInspectResult>;
73
+ /** Inspects `token` and, when it is approved, consumes it so it resumes once. */
74
+ declare function consumeApproval(store: ApprovalStore, token: string, now?: Date): Promise<ApprovalInspectResult>;
75
+ /**
76
+ * Applies a resume token to a decision. The token only matters when the
77
+ * decision is `approval-required` and the token is the one this call was
78
+ * issued; otherwise a new approval is requested. A matching token is consumed
79
+ * unless `consume` is `false`, so an approval resumes exactly one call. Under
80
+ * `staleOn: 'resource-change'`, a token issued for an earlier version of the
81
+ * same row denies with `stale-approval`; the next call without it asks again.
82
+ */
83
+ declare function resumeDecision(input: {
84
+ readonly decision: Decision;
85
+ readonly permission: Permission | {
86
+ readonly key: string;
87
+ readonly scope: string;
88
+ readonly resource: string;
89
+ };
90
+ readonly subject: Subject;
91
+ readonly store: ApprovalStore | undefined;
92
+ readonly resource: {
93
+ readonly type: string;
94
+ readonly id?: string;
95
+ };
96
+ readonly adapter: string;
97
+ readonly token: string | undefined;
98
+ /** `false` for checks that do not run the action, such as the decision endpoint. */
99
+ readonly consume?: boolean;
100
+ readonly now?: Date;
101
+ }): Promise<Decision>;
102
+ declare function cancelApprovals(store: ApprovalStore, filter: ApprovalListFilter, meta: ApprovalCancelMeta): Promise<number>;
103
+ declare function readApprovalHeader(headers: Headers | {
104
+ readonly get: (name: string) => string | null;
105
+ }): string | undefined;
106
+ declare function resumeFromHeader(store: ApprovalStore, headers: Headers | {
107
+ readonly get: (name: string) => string | null;
108
+ }, now?: Date): Promise<ApprovalInspectResult>;
109
+ //#endregion
110
+ //#region src/approvals/store.d.ts
111
+ /**
112
+ * Refuses `by` as an approver of `request`, or returns the index of the
113
+ * stage the approval counts for (`undefined` without `stages`). Eligibility
114
+ * is `approvers.by` or, under `stages`, the first incomplete stage
115
+ * (`sequential`) or any incomplete stage (`all`); `approvers.escalation.to`
116
+ * is eligible too once the request has waited `escalation.after`. A
117
+ * principal who already approved is refused, so one person never completes
118
+ * two stages. `relations` are the relation approvers `by` holds on the
119
+ * request's resource (see `ApprovalVerdict.relations`).
120
+ */
121
+ declare function assertApprover(request: ApprovalRequest, by: Subject, requireDistinctApprover: boolean, now?: Date, relations?: readonly string[]): number | undefined;
122
+ /**
123
+ * The request after `verdict`, for a store to persist: a rejection resolves
124
+ * it; an approval is appended to `approvals` and resolves it once there are
125
+ * `approvers.quorum` (default 1). Throws an `ApprovalError` when the request
126
+ * is not pending, has expired or `verdict.by` may not approve it. Stores
127
+ * should write the result only when the stored row is still pending with the
128
+ * same number of approvals, so two approvers racing both count.
129
+ */
130
+ declare function applyApprovalVerdict(request: ApprovalRequest, verdict: ApprovalVerdict, now?: Date): ApprovalRequest;
131
+ type MemoryApprovalStore = ApprovalStore & {
132
+ readonly ttl: number;
133
+ };
134
+ declare function memoryApprovalStore(options?: {
135
+ readonly ttl?: number;
136
+ }): MemoryApprovalStore;
137
+ //#endregion
138
+ export { approvalsHandler as _, cancelApprovals as a, isApprovalError as b, readApprovalHeader as c, resumeDecision as d, resumeFromHeader as f, ApprovalsHandlerOptions as g, approverRelations as h, memoryApprovalStore as i, requestApproval as l, ApproverRelationsOptions as m, applyApprovalVerdict as n, consumeApproval as o, summariseSubject as p, assertApprover as r, inspectApproval as s, MemoryApprovalStore as t, resolveApproval as u, ApprovalError as v, ApprovalErrorCode as y };
@@ -0,0 +1,177 @@
1
+ import { $ as DecisionSink, Et as TokenVerifier, ct as MembershipSource } from "./policy-CInmNGkM.js";
2
+ import { n as RevocationFeed } from "./revocations-Cy06JNx2.js";
3
+ //#region src/scim/types.d.ts
4
+ declare const SCIM_CONTENT_TYPE = "application/scim+json";
5
+ declare const USER_SCHEMA = "urn:ietf:params:scim:schemas:core:2.0:User";
6
+ declare const GROUP_SCHEMA = "urn:ietf:params:scim:schemas:core:2.0:Group";
7
+ declare const LIST_SCHEMA = "urn:ietf:params:scim:api:messages:2.0:ListResponse";
8
+ declare const ERROR_SCHEMA = "urn:ietf:params:scim:api:messages:2.0:Error";
9
+ declare const PATCH_SCHEMA = "urn:ietf:params:scim:api:messages:2.0:PatchOp";
10
+ declare const ROLES_EXTENSION = "urn:permdock:scim:schemas:extension:roles:1.0";
11
+ type DirectoryMeta = {
12
+ readonly created: string;
13
+ readonly lastModified: string;
14
+ readonly location?: string;
15
+ readonly resourceType?: "User" | "Group";
16
+ };
17
+ type DirectoryEmail = {
18
+ readonly value: string;
19
+ readonly primary?: boolean;
20
+ readonly type?: string;
21
+ };
22
+ type DirectoryUser = {
23
+ readonly id: string;
24
+ readonly externalId?: string;
25
+ readonly userName: string;
26
+ readonly active: boolean;
27
+ readonly emails?: readonly DirectoryEmail[];
28
+ readonly meta: DirectoryMeta;
29
+ };
30
+ type DirectoryGroupMember = {
31
+ readonly value: string;
32
+ };
33
+ type DirectoryGroup = {
34
+ readonly id: string;
35
+ readonly externalId?: string;
36
+ readonly displayName: string;
37
+ readonly members: readonly DirectoryGroupMember[];
38
+ readonly roles?: readonly string[];
39
+ readonly meta: DirectoryMeta;
40
+ };
41
+ type ScimCompareOp = "eq" | "ne" | "co" | "sw";
42
+ type ScimFilter = {
43
+ readonly op: ScimCompareOp;
44
+ readonly attribute: string;
45
+ readonly value: string | boolean;
46
+ } | {
47
+ readonly op: "pr";
48
+ readonly attribute: string;
49
+ } | {
50
+ readonly op: "and" | "or";
51
+ readonly filters: readonly ScimFilter[];
52
+ };
53
+ type ScimPage = {
54
+ readonly startIndex?: number;
55
+ readonly count?: number;
56
+ readonly cursor?: string;
57
+ };
58
+ type ScimPageResult<T> = {
59
+ readonly Resources: readonly T[];
60
+ readonly totalResults: number;
61
+ readonly startIndex?: number;
62
+ readonly itemsPerPage?: number;
63
+ readonly nextCursor?: string;
64
+ };
65
+ type ScimPatchOp = {
66
+ readonly op: "add" | "replace" | "remove";
67
+ readonly path?: string;
68
+ readonly value?: unknown;
69
+ };
70
+ type DirectoryStore = {
71
+ getUser(tenant: string, id: string): Promise<DirectoryUser | null>;
72
+ findUsers(tenant: string, filter: ScimFilter | undefined, page: ScimPage): Promise<ScimPageResult<DirectoryUser>>;
73
+ putUser(tenant: string, user: DirectoryUser): Promise<DirectoryUser>;
74
+ patchUser(tenant: string, id: string, ops: readonly ScimPatchOp[]): Promise<DirectoryUser>;
75
+ deleteUser(tenant: string, id: string): Promise<void>;
76
+ getGroup(tenant: string, id: string): Promise<DirectoryGroup | null>;
77
+ findGroups(tenant: string, filter: ScimFilter | undefined, page: ScimPage): Promise<ScimPageResult<DirectoryGroup>>;
78
+ putGroup(tenant: string, group: DirectoryGroup): Promise<DirectoryGroup>;
79
+ patchGroup(tenant: string, id: string, ops: readonly ScimPatchOp[]): Promise<DirectoryGroup>;
80
+ deleteGroup(tenant: string, id: string): Promise<void>;
81
+ groupsFor(tenant: string, userId: string): Promise<readonly DirectoryGroup[]>;
82
+ };
83
+ type ScimTokenOptions = {
84
+ readonly hash: "sha256";
85
+ readonly lookup: (tenant: string) => string | undefined | Promise<string | undefined>;
86
+ };
87
+ type DirectoryChange = {
88
+ readonly tenant: string;
89
+ readonly userIds: readonly string[];
90
+ /** `session-revoked` when a user was deactivated or deleted; `changed` otherwise. */
91
+ readonly kind: "session-revoked" | "changed";
92
+ };
93
+ type ScimHandlerOptions = {
94
+ readonly store: DirectoryStore;
95
+ readonly tenant: string | ((request: Request) => string | Promise<string>);
96
+ readonly token?: ScimTokenOptions;
97
+ readonly verifier?: TokenVerifier;
98
+ readonly audience?: string;
99
+ readonly groupRoles?: Readonly<Record<string, readonly string[]>>;
100
+ readonly assignable?: readonly string[];
101
+ readonly sink?: DecisionSink;
102
+ readonly onChange?: (change: DirectoryChange) => void | Promise<void>;
103
+ /**
104
+ * Publishes for each affected user's id, `externalId` and `userName`:
105
+ * `session-revoked` when a user is deactivated (`active: false`) or
106
+ * deleted, so open connections end; `changed` otherwise, so they revalidate.
107
+ */
108
+ readonly revocations?: RevocationFeed;
109
+ readonly onUnknownRole?: (name: string) => void;
110
+ };
111
+ type DirectoryMembershipMatch = "externalId" | "userName" | "either";
112
+ type DirectoryMembershipSourceOptions = {
113
+ readonly match?: DirectoryMembershipMatch;
114
+ readonly groupRoles?: Readonly<Record<string, readonly string[]>>;
115
+ readonly assignable?: readonly string[];
116
+ readonly onUnknownRole?: (name: string) => void;
117
+ };
118
+ declare class DirectoryUniquenessError extends Error {
119
+ override readonly name = "DirectoryUniquenessError";
120
+ readonly code: "uniqueness";
121
+ constructor(message?: string);
122
+ }
123
+ declare class DirectoryNotFoundError extends Error {
124
+ override readonly name = "DirectoryNotFoundError";
125
+ readonly code: "not-found";
126
+ constructor(message?: string);
127
+ }
128
+ //#endregion
129
+ //#region src/scim/auth.d.ts
130
+ type ScimCredential = {
131
+ readonly kind: "token";
132
+ } | {
133
+ readonly kind: "jwt";
134
+ readonly iss?: string;
135
+ };
136
+ type ScimAuthResult = {
137
+ readonly ok: true;
138
+ readonly credential: ScimCredential;
139
+ } | {
140
+ readonly ok: false;
141
+ readonly status: 401 | 403;
142
+ };
143
+ declare function authenticateScim(input: {
144
+ readonly request: Request;
145
+ readonly tenant: string;
146
+ readonly audience?: string;
147
+ readonly token?: ScimTokenOptions;
148
+ readonly verifier?: TokenVerifier;
149
+ }): Promise<ScimAuthResult>;
150
+ declare function sha256Hex(value: string): string;
151
+ //#endregion
152
+ //#region src/scim/discovery.d.ts
153
+ declare function serviceProviderConfig(): Record<string, unknown>;
154
+ declare function resourceTypes(): readonly Record<string, unknown>[];
155
+ declare function schemas(): readonly Record<string, unknown>[];
156
+ //#endregion
157
+ //#region src/scim/filter.d.ts
158
+ declare function parseScimFilter(input: string): ScimFilter | undefined;
159
+ declare function matchFilter(target: DirectoryUser | DirectoryGroup | Record<string, unknown>, filter: ScimFilter | undefined): boolean;
160
+ declare function filterSupported(filter: ScimFilter): boolean;
161
+ //#endregion
162
+ //#region src/scim/handler.d.ts
163
+ declare function scimHandler(options: ScimHandlerOptions): (request: Request) => Promise<Response>;
164
+ //#endregion
165
+ //#region src/scim/route.d.ts
166
+ declare function tenantFromPath(request: Request): string;
167
+ //#endregion
168
+ //#region src/scim/patch.d.ts
169
+ declare function normalizePatchOps(ops: readonly unknown[]): readonly ScimPatchOp[] | undefined;
170
+ //#endregion
171
+ //#region src/scim/source.d.ts
172
+ declare function directoryMembershipSource(store: DirectoryStore, options?: DirectoryMembershipSourceOptions): MembershipSource;
173
+ //#endregion
174
+ //#region src/scim/store.d.ts
175
+ declare function memoryDirectoryStore(): DirectoryStore;
176
+ //#endregion
177
+ export { ScimPageResult as A, LIST_SCHEMA as C, ScimFilter as D, SCIM_CONTENT_TYPE as E, ScimTokenOptions as M, USER_SCHEMA as N, ScimHandlerOptions as O, GROUP_SCHEMA as S, ROLES_EXTENSION as T, DirectoryNotFoundError as _, scimHandler as a, DirectoryUser as b, parseScimFilter as c, serviceProviderConfig as d, authenticateScim as f, DirectoryMembershipSourceOptions as g, DirectoryGroup as h, tenantFromPath as i, ScimPatchOp as j, ScimPage as k, resourceTypes as l, DirectoryChange as m, directoryMembershipSource as n, filterSupported as o, sha256Hex as p, normalizePatchOps as r, matchFilter as s, memoryDirectoryStore as t, schemas as u, DirectoryStore as v, PATCH_SCHEMA as w, ERROR_SCHEMA as x, DirectoryUniquenessError as y };
@@ -0,0 +1,9 @@
1
+ import { C as Policy, mr as Principal } from "./policy-CInmNGkM.js";
2
+ import { a as ReplayStore, f as SsfPermDock, p as SsfPermDockOptions } from "./types-i4BAOvdb.js";
3
+ //#region src/ssf/create.d.ts
4
+ declare function createPermDock<TUser, TPrincipal extends Principal = Principal>(policy: Policy<TUser, TPrincipal>, options: SsfPermDockOptions): SsfPermDock;
5
+ //#endregion
6
+ //#region src/ssf/replay.d.ts
7
+ declare function memoryReplayStore(): ReplayStore;
8
+ //#endregion
9
+ export { createPermDock as n, memoryReplayStore as t };