@toa.io/extensions.exposition 1.0.0-alpha.282 → 1.0.0-alpha.283

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 (312) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/components/exposition.octets/manifest.toa.yaml +11 -0
  3. package/components/exposition.octets/types/index.d.ts +3 -0
  4. package/components/exposition.octets/types/toa.d.ts +41 -0
  5. package/components/identity.bans/types/index.d.ts +3 -0
  6. package/components/identity.bans/types/toa.d.ts +34 -0
  7. package/components/identity.basic/manifest.toa.yaml +13 -2
  8. package/components/identity.basic/operations/add.d.ts +3 -3
  9. package/components/identity.basic/operations/authenticate.d.ts +2 -2
  10. package/components/identity.basic/operations/check.d.ts +1 -1
  11. package/components/identity.basic/operations/delete.d.ts +2 -2
  12. package/components/identity.basic/operations/incept.d.ts +2 -2
  13. package/components/identity.basic/operations/info.d.ts +1 -1
  14. package/components/identity.basic/operations/transit.d.ts +4 -3
  15. package/components/identity.basic/operations/transit.js +2 -1
  16. package/components/identity.basic/operations/transit.js.map +1 -1
  17. package/components/identity.basic/source/add.ts +3 -3
  18. package/components/identity.basic/source/authenticate.ts +2 -2
  19. package/components/identity.basic/source/check.ts +1 -1
  20. package/components/identity.basic/source/delete.ts +2 -2
  21. package/components/identity.basic/source/incept.ts +2 -2
  22. package/components/identity.basic/source/info.ts +1 -1
  23. package/components/identity.basic/source/transit.ts +6 -4
  24. package/components/identity.basic/tsconfig.tsbuildinfo +1 -1
  25. package/components/identity.basic/types/index.d.ts +21 -0
  26. package/components/identity.basic/types/toa.d.ts +121 -0
  27. package/components/identity.clients/manifest.toa.yaml +243 -0
  28. package/components/identity.clients/operations/describe.d.ts +27 -0
  29. package/components/identity.clients/operations/describe.js +44 -0
  30. package/components/identity.clients/operations/describe.js.map +1 -0
  31. package/components/identity.clients/operations/lib/Context.d.ts +29 -0
  32. package/components/identity.clients/operations/lib/Context.js +2 -0
  33. package/components/identity.clients/operations/lib/Context.js.map +1 -0
  34. package/components/identity.clients/operations/lib/Entity.d.ts +29 -0
  35. package/components/identity.clients/operations/lib/Entity.js +2 -0
  36. package/components/identity.clients/operations/lib/Entity.js.map +1 -0
  37. package/components/identity.clients/operations/lib/canonical.d.ts +11 -0
  38. package/components/identity.clients/operations/lib/canonical.js +24 -0
  39. package/components/identity.clients/operations/lib/canonical.js.map +1 -0
  40. package/components/identity.clients/operations/lib/cimd.d.ts +8 -0
  41. package/components/identity.clients/operations/lib/cimd.js +86 -0
  42. package/components/identity.clients/operations/lib/cimd.js.map +1 -0
  43. package/components/identity.clients/operations/lib/errors.d.ts +7 -0
  44. package/components/identity.clients/operations/lib/errors.js +5 -0
  45. package/components/identity.clients/operations/lib/errors.js.map +1 -0
  46. package/components/identity.clients/operations/lib/index.d.ts +6 -0
  47. package/components/identity.clients/operations/lib/index.js +7 -0
  48. package/components/identity.clients/operations/lib/index.js.map +1 -0
  49. package/components/identity.clients/operations/lib/redirect.d.ts +10 -0
  50. package/components/identity.clients/operations/lib/redirect.js +32 -0
  51. package/components/identity.clients/operations/lib/redirect.js.map +1 -0
  52. package/components/identity.clients/operations/register.d.ts +37 -0
  53. package/components/identity.clients/operations/register.js +84 -0
  54. package/components/identity.clients/operations/register.js.map +1 -0
  55. package/components/identity.clients/source/describe.ts +65 -0
  56. package/components/identity.clients/source/lib/Context.ts +38 -0
  57. package/components/identity.clients/source/lib/Entity.ts +31 -0
  58. package/components/identity.clients/source/lib/canonical.test.ts +43 -0
  59. package/components/identity.clients/source/lib/canonical.ts +27 -0
  60. package/components/identity.clients/source/lib/cimd.test.ts +120 -0
  61. package/components/identity.clients/source/lib/cimd.ts +107 -0
  62. package/components/identity.clients/source/lib/errors.ts +4 -0
  63. package/components/identity.clients/source/lib/index.ts +6 -0
  64. package/components/identity.clients/source/lib/redirect.test.ts +41 -0
  65. package/components/identity.clients/source/lib/redirect.ts +35 -0
  66. package/components/identity.clients/source/register.ts +125 -0
  67. package/components/identity.clients/tsconfig.json +10 -0
  68. package/components/identity.clients/tsconfig.tsbuildinfo +1 -0
  69. package/components/identity.clients/types/index.d.ts +3 -0
  70. package/components/identity.clients/types/toa.d.ts +109 -0
  71. package/components/identity.credentials/operations/list.d.ts +2 -1
  72. package/components/identity.credentials/operations/list.js.map +1 -1
  73. package/components/identity.credentials/source/list.ts +2 -1
  74. package/components/identity.credentials/tsconfig.tsbuildinfo +1 -1
  75. package/components/identity.credentials/types/index.d.ts +3 -0
  76. package/components/identity.credentials/types/toa.d.ts +30 -0
  77. package/components/identity.federation/manifest.toa.yaml +37 -1
  78. package/components/identity.federation/operations/authenticate.d.ts +1 -1
  79. package/components/identity.federation/operations/lib/Ctx.d.ts +2 -2
  80. package/components/identity.federation/operations/lib/decode.js +22 -8
  81. package/components/identity.federation/operations/lib/decode.js.map +1 -1
  82. package/components/identity.federation/operations/lib/errors.d.ts +7 -0
  83. package/components/identity.federation/operations/lib/errors.js +4 -0
  84. package/components/identity.federation/operations/lib/errors.js.map +1 -1
  85. package/components/identity.federation/operations/lib/exchange.js +11 -6
  86. package/components/identity.federation/operations/lib/exchange.js.map +1 -1
  87. package/components/identity.federation/operations/types/configuration.d.ts +1 -1
  88. package/components/identity.federation/operations/types/context.d.ts +3 -2
  89. package/components/identity.federation/source/authenticate.ts +1 -1
  90. package/components/identity.federation/source/lib/Ctx.ts +2 -2
  91. package/components/identity.federation/source/lib/decode.ts +25 -9
  92. package/components/identity.federation/source/lib/errors.ts +5 -0
  93. package/components/identity.federation/source/lib/exchange.ts +11 -7
  94. package/components/identity.federation/source/types/configuration.ts +1 -1
  95. package/components/identity.federation/source/types/context.ts +3 -2
  96. package/components/identity.federation/tsconfig.tsbuildinfo +1 -1
  97. package/components/identity.federation/types/index.d.ts +3 -0
  98. package/components/identity.federation/types/toa.d.ts +127 -0
  99. package/components/identity.grants/manifest.toa.yaml +245 -0
  100. package/components/identity.grants/operations/authorize.d.ts +35 -0
  101. package/components/identity.grants/operations/authorize.js +54 -0
  102. package/components/identity.grants/operations/authorize.js.map +1 -0
  103. package/components/identity.grants/operations/exchange.d.ts +37 -0
  104. package/components/identity.grants/operations/exchange.js +89 -0
  105. package/components/identity.grants/operations/exchange.js.map +1 -0
  106. package/components/identity.grants/operations/lib/code.d.ts +15 -0
  107. package/components/identity.grants/operations/lib/code.js +30 -0
  108. package/components/identity.grants/operations/lib/code.js.map +1 -0
  109. package/components/identity.grants/operations/lib/identify.d.ts +6 -0
  110. package/components/identity.grants/operations/lib/identify.js +15 -0
  111. package/components/identity.grants/operations/lib/identify.js.map +1 -0
  112. package/components/identity.grants/operations/lib/index.d.ts +3 -0
  113. package/components/identity.grants/operations/lib/index.js +3 -0
  114. package/components/identity.grants/operations/lib/index.js.map +1 -0
  115. package/components/identity.grants/operations/list.d.ts +13 -0
  116. package/components/identity.grants/operations/list.js +18 -0
  117. package/components/identity.grants/operations/list.js.map +1 -0
  118. package/components/identity.grants/operations/revoke.d.ts +18 -0
  119. package/components/identity.grants/operations/revoke.js +25 -0
  120. package/components/identity.grants/operations/revoke.js.map +1 -0
  121. package/components/identity.grants/source/authorize.ts +90 -0
  122. package/components/identity.grants/source/exchange.ts +130 -0
  123. package/components/identity.grants/source/lib/code.ts +39 -0
  124. package/components/identity.grants/source/lib/identify.ts +16 -0
  125. package/components/identity.grants/source/lib/index.ts +3 -0
  126. package/components/identity.grants/source/list.ts +28 -0
  127. package/components/identity.grants/source/revoke.ts +38 -0
  128. package/components/identity.grants/tsconfig.json +10 -0
  129. package/components/identity.grants/tsconfig.tsbuildinfo +1 -0
  130. package/components/identity.grants/types/index.d.ts +60 -0
  131. package/components/identity.grants/types/toa.d.ts +108 -0
  132. package/components/identity.keys/manifest.toa.yaml +1 -0
  133. package/components/identity.keys/operations/create.d.ts +1 -1
  134. package/components/identity.keys/operations/revoke.d.ts +1 -1
  135. package/components/identity.keys/source/create.ts +1 -1
  136. package/components/identity.keys/source/revoke.ts +1 -1
  137. package/components/identity.keys/tsconfig.tsbuildinfo +1 -1
  138. package/components/identity.keys/types/index.d.ts +3 -0
  139. package/components/identity.keys/types/toa.d.ts +47 -0
  140. package/components/identity.otp/operations/lib/Context.d.ts +4 -2
  141. package/components/identity.otp/source/lib/Context.ts +4 -2
  142. package/components/identity.otp/tsconfig.tsbuildinfo +1 -1
  143. package/components/identity.otp/types/index.d.ts +3 -0
  144. package/components/identity.otp/types/toa.d.ts +56 -0
  145. package/components/identity.passkeys/manifest.toa.yaml +3 -0
  146. package/components/identity.passkeys/operations/authenticate.d.ts +1 -1
  147. package/components/identity.passkeys/operations/challenge.d.ts +1 -1
  148. package/components/identity.passkeys/operations/create.d.ts +1 -1
  149. package/components/identity.passkeys/operations/types/Context.d.ts +2 -1
  150. package/components/identity.passkeys/operations/use.d.ts +1 -1
  151. package/components/identity.passkeys/source/authenticate.ts +1 -1
  152. package/components/identity.passkeys/source/challenge.ts +1 -1
  153. package/components/identity.passkeys/source/create.ts +1 -1
  154. package/components/identity.passkeys/source/types/Context.ts +2 -1
  155. package/components/identity.passkeys/source/use.ts +1 -1
  156. package/components/identity.passkeys/tsconfig.tsbuildinfo +1 -1
  157. package/components/identity.passkeys/types/index.d.ts +3 -0
  158. package/components/identity.passkeys/types/toa.d.ts +120 -0
  159. package/components/identity.roles/operations/principal.d.ts +1 -1
  160. package/components/identity.roles/source/principal.ts +1 -1
  161. package/components/identity.roles/tsconfig.tsbuildinfo +1 -1
  162. package/components/identity.roles/types/index.d.ts +3 -0
  163. package/components/identity.roles/types/toa.d.ts +43 -0
  164. package/components/identity.tokens/manifest.toa.yaml +34 -3
  165. package/components/identity.tokens/operations/authenticate.d.ts +2 -1
  166. package/components/identity.tokens/operations/authenticate.js +8 -0
  167. package/components/identity.tokens/operations/authenticate.js.map +1 -1
  168. package/components/identity.tokens/operations/decrypt.d.ts +2 -1
  169. package/components/identity.tokens/operations/decrypt.js +2 -2
  170. package/components/identity.tokens/operations/decrypt.js.map +1 -1
  171. package/components/identity.tokens/operations/encrypt.d.ts +2 -1
  172. package/components/identity.tokens/operations/encrypt.js.map +1 -1
  173. package/components/identity.tokens/operations/issue.d.ts +2 -1
  174. package/components/identity.tokens/operations/issue.js +2 -1
  175. package/components/identity.tokens/operations/issue.js.map +1 -1
  176. package/components/identity.tokens/operations/lib/form.d.ts +8 -0
  177. package/components/identity.tokens/operations/lib/form.js +24 -0
  178. package/components/identity.tokens/operations/lib/form.js.map +1 -0
  179. package/components/identity.tokens/operations/lib/index.d.ts +2 -1
  180. package/components/identity.tokens/operations/lib/index.js +1 -1
  181. package/components/identity.tokens/operations/lib/index.js.map +1 -1
  182. package/components/identity.tokens/source/authenticate.test.ts +8 -5
  183. package/components/identity.tokens/source/authenticate.ts +12 -1
  184. package/components/identity.tokens/source/decrypt.test.ts +1 -1
  185. package/components/identity.tokens/source/decrypt.ts +4 -3
  186. package/components/identity.tokens/source/encrypt.test.ts +1 -1
  187. package/components/identity.tokens/source/encrypt.ts +2 -1
  188. package/components/identity.tokens/source/issue.test.ts +71 -0
  189. package/components/identity.tokens/source/issue.ts +4 -2
  190. package/components/identity.tokens/source/lib/form.test.ts +25 -0
  191. package/components/identity.tokens/source/lib/form.ts +31 -0
  192. package/components/identity.tokens/source/lib/index.ts +2 -1
  193. package/components/identity.tokens/tsconfig.tsbuildinfo +1 -1
  194. package/components/identity.tokens/types/index.d.ts +61 -0
  195. package/components/identity.tokens/types/toa.d.ts +113 -0
  196. package/documentation/cache.md +10 -1
  197. package/documentation/consent.md +101 -0
  198. package/documentation/identity.md +3 -1
  199. package/documentation/io.md +36 -2
  200. package/documentation/oauth.md +179 -0
  201. package/documentation/protocol.md +4 -0
  202. package/features/auth.bearer.feature +120 -0
  203. package/features/cache.feature +46 -0
  204. package/features/oauth.clients.feature +195 -0
  205. package/features/oauth.discovery.feature +165 -0
  206. package/features/oauth.grants.feature +286 -0
  207. package/features/steps/Gateway.ts +6 -1
  208. package/features/steps/Parameters.ts +4 -0
  209. package/features/steps/components/echo/manifest.toa.yaml +2 -0
  210. package/features/steps/components/octets.tester/manifest.toa.yaml +2 -0
  211. package/features/steps/components/octets.tester/operations/redirect.js +6 -1
  212. package/features/steps/components/users/manifest.toa.yaml +1 -0
  213. package/package.json +8 -6
  214. package/readme.md +3 -0
  215. package/schemas/annotation.cos.yaml +30 -0
  216. package/source/Annotation.ts +23 -0
  217. package/source/Factory.ts +1 -1
  218. package/source/HTTP/Server.ts +9 -5
  219. package/source/HTTP/formats/form.ts +21 -0
  220. package/source/HTTP/formats/index.ts +17 -2
  221. package/source/HTTP/messages.test.ts +25 -1
  222. package/source/HTTP/messages.ts +10 -3
  223. package/source/Interception.ts +8 -2
  224. package/source/deployment.ts +4 -1
  225. package/source/directives/auth/Authorization.ts +46 -19
  226. package/source/directives/auth/Incept.ts +14 -9
  227. package/source/directives/auth/schemes.test.ts +8 -4
  228. package/source/directives/auth/schemes.ts +22 -9
  229. package/source/directives/auth/types.ts +5 -2
  230. package/source/directives/cache/Cache.ts +13 -4
  231. package/source/directives/cache/Control.ts +0 -3
  232. package/source/directives/flow/Fetch.ts +1 -1
  233. package/source/directives/index.ts +2 -1
  234. package/source/directives/io/IO.ts +2 -0
  235. package/source/directives/io/Output.ts +4 -1
  236. package/source/directives/io/Status.test.ts +84 -0
  237. package/source/directives/io/Status.ts +46 -0
  238. package/source/directives/oauth/Discovery.ts +76 -0
  239. package/source/directives/oauth/documents.ts +113 -0
  240. package/source/directives/oauth/index.ts +3 -0
  241. package/source/directives/octets/Delete.ts +1 -1
  242. package/source/directives/octets/Get.ts +1 -1
  243. package/source/directives/octets/Workflow.ts +1 -1
  244. package/source/directives/octets/workflows/Execution.ts +1 -1
  245. package/source/index.ts +6 -0
  246. package/source/octets.d.ts +17 -0
  247. package/source/userland.ts +47 -0
  248. package/transpiled/Annotation.d.ts +17 -0
  249. package/transpiled/Factory.js +1 -1
  250. package/transpiled/Factory.js.map +1 -1
  251. package/transpiled/HTTP/Server.d.ts +4 -1
  252. package/transpiled/HTTP/Server.js +4 -3
  253. package/transpiled/HTTP/Server.js.map +1 -1
  254. package/transpiled/HTTP/formats/form.d.ts +9 -0
  255. package/transpiled/HTTP/formats/form.js +18 -0
  256. package/transpiled/HTTP/formats/form.js.map +1 -0
  257. package/transpiled/HTTP/formats/index.d.ts +10 -2
  258. package/transpiled/HTTP/formats/index.js +10 -0
  259. package/transpiled/HTTP/formats/index.js.map +1 -1
  260. package/transpiled/HTTP/messages.d.ts +6 -0
  261. package/transpiled/HTTP/messages.js +3 -3
  262. package/transpiled/HTTP/messages.js.map +1 -1
  263. package/transpiled/Interception.d.ts +4 -1
  264. package/transpiled/Interception.js +4 -2
  265. package/transpiled/Interception.js.map +1 -1
  266. package/transpiled/deployment.js +2 -0
  267. package/transpiled/deployment.js.map +1 -1
  268. package/transpiled/directives/auth/Authorization.d.ts +1 -1
  269. package/transpiled/directives/auth/Authorization.js +38 -18
  270. package/transpiled/directives/auth/Authorization.js.map +1 -1
  271. package/transpiled/directives/auth/Incept.d.ts +1 -1
  272. package/transpiled/directives/auth/Incept.js +11 -7
  273. package/transpiled/directives/auth/Incept.js.map +1 -1
  274. package/transpiled/directives/auth/schemes.d.ts +16 -4
  275. package/transpiled/directives/auth/schemes.js +20 -8
  276. package/transpiled/directives/auth/schemes.js.map +1 -1
  277. package/transpiled/directives/auth/types.d.ts +4 -2
  278. package/transpiled/directives/cache/Cache.js +9 -2
  279. package/transpiled/directives/cache/Cache.js.map +1 -1
  280. package/transpiled/directives/cache/Control.js +0 -2
  281. package/transpiled/directives/cache/Control.js.map +1 -1
  282. package/transpiled/directives/index.js +2 -1
  283. package/transpiled/directives/index.js.map +1 -1
  284. package/transpiled/directives/io/IO.js +2 -0
  285. package/transpiled/directives/io/IO.js.map +1 -1
  286. package/transpiled/directives/io/Output.js +4 -1
  287. package/transpiled/directives/io/Output.js.map +1 -1
  288. package/transpiled/directives/io/Status.d.ts +19 -0
  289. package/transpiled/directives/io/Status.js +34 -0
  290. package/transpiled/directives/io/Status.js.map +1 -0
  291. package/transpiled/directives/oauth/Discovery.d.ts +23 -0
  292. package/transpiled/directives/oauth/Discovery.js +58 -0
  293. package/transpiled/directives/oauth/Discovery.js.map +1 -0
  294. package/transpiled/directives/oauth/documents.d.ts +9 -0
  295. package/transpiled/directives/oauth/documents.js +82 -0
  296. package/transpiled/directives/oauth/documents.js.map +1 -0
  297. package/transpiled/directives/oauth/index.d.ts +2 -0
  298. package/transpiled/directives/oauth/index.js +3 -0
  299. package/transpiled/directives/oauth/index.js.map +1 -0
  300. package/transpiled/index.d.ts +2 -0
  301. package/transpiled/userland.d.ts +39 -0
  302. package/transpiled/userland.js +7 -0
  303. package/transpiled/userland.js.map +1 -0
  304. package/tsconfig.tsbuildinfo +1 -1
  305. package/components/identity.basic/operations/types.d.ts +0 -61
  306. package/components/identity.basic/operations/types.js +0 -2
  307. package/components/identity.basic/operations/types.js.map +0 -1
  308. package/components/identity.basic/source/types.ts +0 -69
  309. package/components/identity.tokens/operations/lib/types.d.ts +0 -88
  310. package/components/identity.tokens/operations/lib/types.js +0 -2
  311. package/components/identity.tokens/operations/lib/types.js.map +0 -1
  312. package/components/identity.tokens/source/lib/types.ts +0 -102
@@ -1,5 +1,5 @@
1
1
  import { type Component } from '@toa.io/core';
2
- import { type Maybe } from '@toa.io/types';
2
+ import { type Maybe } from '@toa.io/core';
3
3
  import { type Parameter } from '../../RTD/index.js';
4
4
  import type * as http from '../../HTTP/index.js';
5
5
  import type * as io from '../../io.js';
@@ -14,6 +14,8 @@ export interface Identity {
14
14
  roles?: string[];
15
15
  permissions?: Record<string, string[]>;
16
16
  scheme: string | null;
17
+ /** The component that verified the credentials; none for a transient identity. */
18
+ provider?: Remote;
17
19
  refresh: boolean;
18
20
  }
19
21
  export interface Extension {
@@ -32,5 +34,5 @@ export type AuthenticationResult = Maybe<{
32
34
  export type Scheme = 'basic' | 'token' | 'bearer' | 'code' | 'otp';
33
35
  export type Remote = 'basic' | 'federation' | 'tokens' | 'roles' | 'bans' | 'otp';
34
36
  export type Discovery = Record<Remote, Promise<Component>>;
35
- export type Schemes = Record<Scheme, Component>;
37
+ export type Components = Partial<Record<Remote, Component>>;
36
38
  export type Create = (name: string, value: any, ...args: any[]) => Directive;
@@ -13,11 +13,18 @@ export class Cache {
13
13
  return null;
14
14
  }
15
15
  async settle(directives, context, response) {
16
+ const directive = directives[0];
17
+ response.headers ??= new Headers();
18
+ // `cache:exact` sets what it is given, whatever the method: whether a reply may be
19
+ // stored at all is not a question about the method's cacheability, and a token
20
+ // endpoint answers a POST it must not have kept
21
+ if (directive instanceof Exact) {
22
+ directive.set(context, response.headers);
23
+ return;
24
+ }
16
25
  const method = context.request.method;
17
26
  if (method !== 'GET' && method !== 'HEAD')
18
27
  return;
19
- const directive = directives[0];
20
- response.headers ??= new Headers();
21
28
  if (directive === undefined) {
22
29
  if (context.identity !== null && !Control.disabled(response.headers)) {
23
30
  response.headers.set('cache-control', 'private');
@@ -1 +1 @@
1
- {"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../../source/directives/cache/Cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAMlC,MAAM,OAAO,KAAK;IACA,IAAI,GAAW,OAAO,CAAA;IACtB,SAAS,GAAY,IAAI,CAAA;IAElC,MAAM,CAAE,IAAY,EAAE,KAAU;QACrC,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;QAEhC,IAAI,KAAK,KAAK,SAAS;YACrB,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,sBAAsB,CAAC,CAAA;QAEjE,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;IAEM,SAAS;QACd,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,KAAK,CAAC,MAAM,CAAE,UAAuB,EAAE,OAA6B,EAAE,QAA8B;QACzG,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAA;QAEr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IAEM,KAAK,CAAC,MAAM,CAAE,UAAuB,EAAE,OAA6B,EAAE,QAA8B;QACzG,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;QAE/B,QAAQ,CAAC,OAAO,KAAK,IAAI,OAAO,EAAE,CAAA;QAElC,mFAAmF;QACnF,+EAA+E;QAC/E,gDAAgD;QAChD,IAAI,SAAS,YAAY,KAAK,EAAE,CAAC;YAC/B,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;YAExC,OAAM;QACR,CAAC;QAED,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAA;QAErC,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,MAAM;YACvC,OAAM;QAER,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBACrE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,SAAS,CAAC,CAAA;gBAChD,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;YAClD,CAAC;QACH,CAAC;;YACC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC5C,CAAC;CACF;AAED,MAAM,YAAY,GAAkD;IAClE,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,KAAK;CACb,CAAA"}
@@ -14,8 +14,6 @@ export class Control {
14
14
  return (directives & NO_STORE) === NO_STORE;
15
15
  }
16
16
  set(context, headers) {
17
- if (!['GET', 'HEAD', 'OPTIONS'].includes(context.request.method))
18
- return;
19
17
  this.control ??= this.resolve(context);
20
18
  if (Control.disabled(headers))
21
19
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"Control.js","sourceRoot":"","sources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C,KAAK,CAAC,EAAE,CAAC;YAC5C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;YAEhB,OAAO,WAAW,GAAG,IAAI,CAAC,KAAK,CAAA;QACjC,CAAC;QAED,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;CACF;AAED,SAAS,IAAI,CAAE,KAAa;IAC1B,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;IAE7C,IAAI,UAAU,KAAK,IAAI;QACrB,OAAO,CAAC,CAAA;IAEV,IAAI,IAAI,GAAG,CAAC,CAAA;IAEZ,KAAK,MAAM,SAAS,IAAI,UAAU;QAChC,IAAI,IAAI,KAAK,CAAS,SAAS,EAC7B,SAAS,EAAE,OAAO,EAClB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,QAAQ,EACpB,UAAU,EAAE,QAAQ,EACpB,CAAC,CAAC,CAAA;IAEN,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,aAAa,GAAG,0CAA0C,CAAA;AAEhE,MAAM,MAAM,GAAG,CAAC,CAAA;AAChB,MAAM,OAAO,GAAG,CAAC,CAAA;AACjB,MAAM,QAAQ,GAAG,CAAC,CAAA;AAClB,MAAM,QAAQ,GAAG,CAAC,CAAA"}
@@ -7,6 +7,7 @@ import { io } from './io/index.js';
7
7
  import { map } from './map/index.js';
8
8
  import { req } from './require/index.js';
9
9
  import { flow } from './flow/index.js';
10
+ import { discovery } from './oauth/index.js';
10
11
  export const families = [authorization, io, cache, map, req, flow, octets, dev];
11
- export const interceptors = [cors];
12
+ export const interceptors = [cors, discovery];
12
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/directives/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,IAAI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AM,EAAE,GAAG,CAAC,CAAA;AAClG,MAAM,CAAC,MAAM,YAAY,GAAkB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import { Output } from './Output.js';
2
2
  import { Input } from './Input.js';
3
3
  import { Throttle } from './Throttle.js';
4
+ import { Status } from './Status.js';
4
5
  import { Sync } from './lib/throttle/index.js';
5
6
  import { ATOM_GROUP } from '../../const.js';
6
7
  export class IO {
@@ -48,6 +49,7 @@ export class IO {
48
49
  const constructors = {
49
50
  input: Input,
50
51
  output: Output,
52
+ status: Status,
51
53
  throttle: Throttle
52
54
  };
53
55
  const DENIAL = new Output([]);
@@ -1 +1 @@
1
- {"version":3,"file":"IO.js","sourceRoot":"","sources":["../../../source/directives/io/IO.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAA;AAK9C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAG3C,MAAM,OAAO,EAAE;IACG,IAAI,GAAG,IAAI,CAAA;IACX,SAAS,GAAG,IAAI,CAAA;IAExB,IAAI,CAAkB;IAE9B,uFAAuF;IAC/E,IAAI,GAAgB,IAAI,CAAA;IAEzB,KAAK,CAAE,IAAqB;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,sCAAsC;IAC/B,MAAM,CAAE,IAAY,EAAE,KAAc,EAAE,OAAgB,EAAE,KAAa;QAC1E,IAAI,CAAC,CAAC,IAAI,IAAI,YAAY,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,sBAAsB,CAAC,CAAA;QAE9D,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;QAEpC,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CAAC;QAED,IAAI,CAAC,UAAU;YACb,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QAEvC,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,MAAM,CAAE,UAAuB,EAAE,OAAqB,EAC3D,MAA4B;QAC5B,KAAK,MAAM,SAAS,IAAI,UAAU;YAChC,SAAS,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IACvC,CAAC;IAED;;;;OAIG;IACI,OAAO;QACZ,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,CAAA;IACtB,CAAC;CACF;AAED,MAAM,YAAY,GAAgC;IAChD,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,QAAQ;CACnB,CAAA;AAED,MAAM,MAAM,GAAc,IAAI,MAAM,CAAC,EAAE,CAAC,CAAA"}
@@ -24,7 +24,10 @@ export class Output {
24
24
  }
25
25
  restriction(context) {
26
26
  return (message) => {
27
- const error = message.status !== undefined && message.status >= 300;
27
+ // what the gateway built is its own — a code and a message — and a restriction has
28
+ // nothing to say about it; everything else is a reply the operation returned, and is
29
+ // restricted whatever status it carries
30
+ const error = message.authentic === true;
28
31
  const stream = message.body instanceof Stream;
29
32
  const none = message.body === undefined || message.body === null;
30
33
  if (this.disabled || error || stream || none)
@@ -1 +1 @@
1
- {"version":3,"file":"Output.js","sourceRoot":"","sources":["../../../source/directives/io/Output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAClC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAMvC,MAAM,OAAO,MAAM;IACA,QAAQ,GAAY,KAAK,CAAA;IACzB,OAAO,GAAY,IAAI,CAAA;IACvB,WAAW,GAAa,EAAE,CAAA;IAC1B,OAAO,CAAa;IAErC,YAAoB,WAAw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AAO,CAAC,IAAI,EAC5C,oEAAoE,CAAC,CAAA;YAEvE,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;gBAC7B,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,MAAiB,CAAC,CAAC,CAAA;;gBAExE,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QACzC,CAAC,CAAA;IACH,CAAC;IAED,uFAAuF;IAC/E,GAAG,CAAE,OAAgB;QAC3B,MAAM,MAAM,GAAY,EAAE,CAAA;QAE1B,+EAA+E;QAC/E,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;YACpC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;gBACvB,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;QAE9B,OAAO,MAAM,CAAA;IACf,CAAC;CACF"}
@@ -0,0 +1,19 @@
1
+ import type { Directive } from './Directive.js';
2
+ import type * as http from '../../HTTP/index.js';
3
+ /**
4
+ * The status of the reply, taken from a property of what the operation returned and removed
5
+ * from it — an outcome the operation knows and the transport does not, like a protocol that
6
+ * states its error as a body rather than as a status of its own.
7
+ *
8
+ * Settled rather than transformed, so the status is set before anything reads it. A reply of
9
+ * 300 or above is left as the operation built it, which `io:output` does not restrict: a
10
+ * failure and a success are different shapes, and one list of permitted properties does not
11
+ * describe both.
12
+ */
13
+ export declare class Status implements Directive {
14
+ private readonly property;
15
+ constructor(property: unknown);
16
+ static validate(value: unknown): asserts value is string;
17
+ preflight(): void;
18
+ settle(_: unknown, response: http.OutgoingMessage): void;
19
+ }
@@ -0,0 +1,34 @@
1
+ import assert from 'node:assert';
2
+ /**
3
+ * The status of the reply, taken from a property of what the operation returned and removed
4
+ * from it — an outcome the operation knows and the transport does not, like a protocol that
5
+ * states its error as a body rather than as a status of its own.
6
+ *
7
+ * Settled rather than transformed, so the status is set before anything reads it. A reply of
8
+ * 300 or above is left as the operation built it, which `io:output` does not restrict: a
9
+ * failure and a success are different shapes, and one list of permitted properties does not
10
+ * describe both.
11
+ */
12
+ export class Status {
13
+ property;
14
+ constructor(property) {
15
+ this.property = property;
16
+ }
17
+ static validate(value) {
18
+ assert.ok(typeof value === 'string', '`io:status` must be a string');
19
+ }
20
+ preflight() {
21
+ // nothing to do until the operation has answered
22
+ }
23
+ settle(_, response) {
24
+ const body = response.body;
25
+ if (body === null || typeof body !== 'object' || !(this.property in body))
26
+ return;
27
+ const value = body[this.property];
28
+ assert.ok(typeof value === 'number', `\`io:status\` expects '${this.property}' to be a number`);
29
+ response.status = value;
30
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
31
+ delete body[this.property];
32
+ }
33
+ }
34
+ //# sourceMappingURL=Status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Status.js","sourceRoot":"","sources":["../../../source/directives/io/Status.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAIhC;;;;;;;;;GASG;AACH,MAAM,OAAO,MAAM;IACA,QAAQ,CAAQ;IAEjC,YAAoB,QAAiB;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAkB,CAAA;IACpC,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAE,KAAc;QACpC,MAAM,CAAC,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,EAAE,8BAA8B,CAAC,CAAA;IACtE,CAAC;IAEM,SAAS;QACd,iDAAiD;IACnD,CAAC;IAEM,MAAM,CAAE,CAAU,EAAE,QAA8B;QACvD,MAAM,IAAI,GAAY,QAAQ,CAAC,IAAI,CAAA;QAEnC,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC;YACvE,OAAM;QAER,MAAM,KAAK,GAAa,IAAgC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAEvE,MAAM,CAAC,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,EACjC,0BAA0B,IAAI,CAAC,QAAQ,kBAAkB,CAAC,CAAA;QAE5D,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAA;QAEvB,gEAAgE;QAChE,OAAQ,IAAgC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACzD,CAAC;CACF"}
@@ -0,0 +1,23 @@
1
+ import type * as http from '../../HTTP/index.js';
2
+ import type { Input, Output } from '../../io.js';
3
+ import type { Interceptor } from '../../Interception.js';
4
+ /**
5
+ * What a client reads before it can authenticate: where the authorization server is, and
6
+ * what this resource expects. Both are fixed paths a specification names, both must be
7
+ * answered to anyone, and both are a function of the annotation alone — nothing is read to
8
+ * build them, so they are built once per authority and served as they are.
9
+ *
10
+ * An interceptor rather than a route because `auth` runs before any directive: a client
11
+ * re-reading discovery while holding a stale token would have it verified, and then be
12
+ * refused a document that has to be public.
13
+ */
14
+ export declare class Discovery implements Interceptor {
15
+ /**
16
+ * A map, because the key is the request's authority and an unconfigured host is passed
17
+ * through as itself: `Host: constructor` names something a plain object answers on its own.
18
+ */
19
+ private readonly authorities;
20
+ mount(options: http.Options): void;
21
+ reset(): void;
22
+ intercept(input: Input): Output;
23
+ }
@@ -0,0 +1,58 @@
1
+ import { documents } from './documents.js';
2
+ /**
3
+ * What a client reads before it can authenticate: where the authorization server is, and
4
+ * what this resource expects. Both are fixed paths a specification names, both must be
5
+ * answered to anyone, and both are a function of the annotation alone — nothing is read to
6
+ * build them, so they are built once per authority and served as they are.
7
+ *
8
+ * An interceptor rather than a route because `auth` runs before any directive: a client
9
+ * re-reading discovery while holding a stale token would have it verified, and then be
10
+ * refused a document that has to be public.
11
+ */
12
+ export class Discovery {
13
+ /**
14
+ * A map, because the key is the request's authority and an unconfigured host is passed
15
+ * through as itself: `Host: constructor` names something a plain object answers on its own.
16
+ */
17
+ authorities = new Map();
18
+ mount(options) {
19
+ this.authorities.clear();
20
+ if (options.oauth === undefined)
21
+ return;
22
+ for (const [authority, host] of Object.entries(options.authorities))
23
+ this.authorities.set(authority, documents(origin(host), options.oauth));
24
+ }
25
+ reset() {
26
+ this.authorities.clear();
27
+ }
28
+ intercept(input) {
29
+ const known = this.authorities.get(input.authority);
30
+ if (known === undefined)
31
+ return null;
32
+ // every reply, not just a document's: the challenge is what points a client here
33
+ input.pipelines.response.push((response) => {
34
+ if (response.status !== UNAUTHORIZED)
35
+ return;
36
+ response.headers ??= new Headers();
37
+ response.headers.set('www-authenticate', known.challenge(input.url.pathname));
38
+ });
39
+ const body = known.read(input.url.pathname);
40
+ if (body === undefined)
41
+ return null;
42
+ return { body, headers: new Headers({ 'cache-control': 'public, max-age=3600' }) };
43
+ }
44
+ }
45
+ /**
46
+ * The absolute URL an authority is reached at. Loopback is served over http and everything
47
+ * else over https: the gateway may sit behind a terminating proxy, so the connection does
48
+ * not say which, and the configured host does. Taken from the configuration rather than
49
+ * from the request's `host`, which is the client's to write.
50
+ */
51
+ function origin(host) {
52
+ const name = host.split(':')[0];
53
+ const loopback = name === 'localhost' || name === '127.0.0.1' || name === '[::1]' ||
54
+ name.endsWith('.localhost');
55
+ return `${loopback ? 'http' : 'https'}://${host}`;
56
+ }
57
+ const UNAUTHORIZED = 401;
58
+ //# sourceMappingURL=Discovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Discovery.js","sourceRoot":"","sources":["../../../source/directives/oauth/Discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAA;AAK1D;;;;;;;;;GASG;AACH,MAAM,OAAO,SAAS;IACpB;;;OAGG;IACc,WAAW,GAAG,IAAI,GAAG,EAAqB,CAAA;IAEpD,KAAK,CAAE,OAAqB;QACjC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,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IAC3B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAE/B,MAAM,QAAQ,GAAG,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,OAAO;QAC/E,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;IAE7B,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,MAAM,IAAI,EAAE,CAAA;AACnD,CAAC;AAED,MAAM,YAAY,GAAG,GAAG,CAAA"}
@@ -0,0 +1,9 @@
1
+ import type { OAuth } from '../../Annotation.js';
2
+ /** The discovery documents of one authority, and the challenge that points at them. */
3
+ export interface Documents {
4
+ /** The document a path names, or nothing when it names none. */
5
+ read: (pathname: string) => object | undefined;
6
+ /** `WWW-Authenticate` for a request to this path, which names the resource it failed at. */
7
+ challenge: (pathname: string) => string;
8
+ }
9
+ export declare function documents(issuer: string, oauth: OAuth): Documents;
@@ -0,0 +1,82 @@
1
+ export function documents(issuer, oauth) {
2
+ const server = authorizationServer(issuer, oauth);
3
+ const resources = protectedResources(issuer, oauth);
4
+ const scope = oauth.scopes === undefined ? '' : `, scope="${oauth.scopes.join(' ')}"`;
5
+ function read(pathname) {
6
+ if (pathname === AUTHORIZATION_SERVER || pathname === OPENID_CONFIGURATION)
7
+ return server;
8
+ if (pathname.startsWith(PROTECTED_RESOURCE))
9
+ return resources.get(pathname.slice(PROTECTED_RESOURCE.length));
10
+ return undefined;
11
+ }
12
+ function challenge(pathname) {
13
+ return `Bearer resource_metadata="${issuer}${PROTECTED_RESOURCE}${suffix(oauth, pathname)}"${scope}`;
14
+ }
15
+ return { read, challenge };
16
+ }
17
+ /**
18
+ * RFC 8414. `authorization_endpoint` is the application's own page and may be anywhere;
19
+ * everything else this extension serves. Both flags are load-bearing for a client that
20
+ * prefers Client ID Metadata Documents: without either it falls back to registration.
21
+ */
22
+ function authorizationServer(issuer, oauth) {
23
+ const metadata = {
24
+ issuer,
25
+ authorization_endpoint: oauth.authorize,
26
+ token_endpoint: `${issuer}${TOKEN}`,
27
+ response_types_supported: ['code'],
28
+ grant_types_supported: ['authorization_code'],
29
+ code_challenge_methods_supported: ['S256'],
30
+ token_endpoint_auth_methods_supported: ['none'],
31
+ client_id_metadata_document_supported: true,
32
+ authorization_response_iss_parameter_supported: true
33
+ };
34
+ if (oauth.registration === 'open')
35
+ metadata.registration_endpoint = `${issuer}${REGISTRATION}`;
36
+ if (oauth.scopes !== undefined)
37
+ metadata.scopes_supported = oauth.scopes;
38
+ return metadata;
39
+ }
40
+ /**
41
+ * RFC 9728, keyed by the path the well-known segment is followed by: a client resolving
42
+ * `https://host/mcp` reads `/.well-known/oauth-protected-resource/mcp`, and one that names
43
+ * no path reads the document at the origin.
44
+ */
45
+ function protectedResources(issuer, oauth) {
46
+ const map = new Map();
47
+ for (const path of oauth.resources ?? [])
48
+ map.set(canonical(path), resource(issuer, canonical(path), oauth));
49
+ map.set('', resource(issuer, '', oauth));
50
+ return map;
51
+ }
52
+ function resource(issuer, path, oauth) {
53
+ const metadata = {
54
+ resource: issuer + path,
55
+ authorization_servers: [issuer],
56
+ bearer_methods_supported: ['header']
57
+ };
58
+ if (oauth.scopes !== undefined)
59
+ metadata.scopes_supported = oauth.scopes;
60
+ return metadata;
61
+ }
62
+ /** The document a request to this path was refused against: the longest resource holding it. */
63
+ function suffix(oauth, pathname) {
64
+ let longest = '';
65
+ for (const path of oauth.resources ?? [])
66
+ if (pathname.startsWith(path) && path.length > longest.length)
67
+ longest = path;
68
+ return canonical(longest);
69
+ }
70
+ /**
71
+ * A resource is identified without its trailing slash — the form MCP asks for — while a
72
+ * route is declared with one, so `/mcp/` identifies `…/mcp`.
73
+ */
74
+ function canonical(path) {
75
+ return path.endsWith('/') ? path.slice(0, -1) : path;
76
+ }
77
+ const AUTHORIZATION_SERVER = '/.well-known/oauth-authorization-server';
78
+ const PROTECTED_RESOURCE = '/.well-known/oauth-protected-resource';
79
+ const OPENID_CONFIGURATION = '/.well-known/openid-configuration';
80
+ const TOKEN = '/identity/grants/';
81
+ const REGISTRATION = '/identity/clients/';
82
+ //# sourceMappingURL=documents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documents.js","sourceRoot":"","sources":["../../../source/directives/oauth/documents.ts"],"names":[],"mappings":"AAWA,MAAM,UAAU,SAAS,CAAE,MAAc,EAAE,KAAY;IACrD,MAAM,MAAM,GAAG,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IACjD,MAAM,SAAS,GAAG,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IACnD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAA;IAErF,SAAS,IAAI,CAAE,QAAgB;QAC7B,IAAI,QAAQ,KAAK,oBAAoB,IAAI,QAAQ,KAAK,oBAAoB;YACxE,OAAO,MAAM,CAAA;QAEf,IAAI,QAAQ,CAAC,UAAU,CAAC,kBAAkB,CAAC;YACzC,OAAO,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAA;QAEjE,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,SAAS,SAAS,CAAE,QAAgB;QAClC,OAAO,6BAA6B,MAAM,GAAG,kBAAkB,GAAG,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,KAAK,EAAE,CAAA;IACtG,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;AAC5B,CAAC;AAED;;;;GAIG;AACH,SAAS,mBAAmB,CAAE,MAAc,EAAE,KAAY;IACxD,MAAM,QAAQ,GAA4B;QACxC,MAAM;QACN,sBAAsB,EAAE,KAAK,CAAC,SAAS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B,QAAQ,CAAC,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAA;IAE1C,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,gGAAgG;AAChG,SAAS,MAAM,CAAE,KAAY,EAAE,QAAgB;IAC7C,IAAI,OAAO,GAAG,EAAE,CAAA;IAEhB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,SAAS,IAAI,EAAE;QACtC,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM;YAC3D,OAAO,GAAG,IAAI,CAAA;IAElB,OAAO,SAAS,CAAC,OAAO,CAAC,CAAA;AAC3B,CAAC;AAED;;;GAGG;AACH,SAAS,SAAS,CAAE,IAAY;IAC9B,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACtD,CAAC;AAED,MAAM,oBAAoB,GAAG,yCAAyC,CAAA;AACtE,MAAM,kBAAkB,GAAG,uCAAuC,CAAA;AAClE,MAAM,oBAAoB,GAAG,mCAAmC,CAAA;AAChE,MAAM,KAAK,GAAG,mBAAmB,CAAA;AACjC,MAAM,YAAY,GAAG,oBAAoB,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { Discovery } from './Discovery.js';
2
+ export declare const discovery: Discovery;
@@ -0,0 +1,3 @@
1
+ import { Discovery } from './Discovery.js';
2
+ export const discovery = new Discovery();
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/directives/oauth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAA"}
@@ -3,3 +3,5 @@ export { deployment } from './deployment.js';
3
3
  export { components } from './Composition.js';
4
4
  export { Factory } from './Factory.js';
5
5
  export type { Remotes } from './Remotes.js';
6
+ export type { Claims, Identity } from './userland.js';
7
+ export type * as octets from './octets.js';
@@ -0,0 +1,39 @@
1
+ /**
2
+ * What Exposition puts into an operation's input, for the operation to be written against.
3
+ *
4
+ * The gateway's own types are its business; these are the application's.
5
+ */
6
+ /**
7
+ * The identity behind the call, as `auth:delegate` embeds it:
8
+ *
9
+ * ```yaml
10
+ * /echo:
11
+ * GET:
12
+ * auth:assert: true
13
+ * auth:delegate: identity
14
+ * endpoint: echo
15
+ * ```
16
+ *
17
+ * ```javascript
18
+ * export async function computation ({ identity }, context) { }
19
+ * ```
20
+ */
21
+ export interface Identity {
22
+ readonly id: string;
23
+ /** What the identity holds. Delegation resolves them, so they are always here. */
24
+ roles: string[];
25
+ permissions?: Record<string, string[]>;
26
+ /** How the identity was authenticated; `null` for a transient one. */
27
+ scheme: string | null;
28
+ /** Whether the credentials presented are due to be exchanged. */
29
+ refresh: boolean;
30
+ /** The token's claims, where the identity was federated. */
31
+ claims?: Claims;
32
+ }
33
+ /** A federated token's payload: what it must carry, and whatever else the issuer put there. */
34
+ export interface Claims {
35
+ iss: string;
36
+ sub: string;
37
+ aud?: string | string[];
38
+ [claim: string]: unknown;
39
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * What Exposition puts into an operation's input, for the operation to be written against.
3
+ *
4
+ * The gateway's own types are its business; these are the application's.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=userland.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userland.js","sourceRoot":"","sources":["../source/userland.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}