@casys/mcp-server 0.27.0 → 0.27.1

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 (253) hide show
  1. package/CHANGELOG.md +6 -1770
  2. package/README.md +10 -638
  3. package/esm/mod.d.ts +1 -102
  4. package/esm/mod.js +1 -103
  5. package/package.json +17 -25
  6. package/esm/_dnt.polyfills.d.ts +0 -12
  7. package/esm/_dnt.polyfills.d.ts.map +0 -1
  8. package/esm/_dnt.polyfills.js +0 -15
  9. package/esm/_dnt.shims.d.ts +0 -2
  10. package/esm/_dnt.shims.d.ts.map +0 -1
  11. package/esm/_dnt.shims.js +0 -57
  12. package/esm/deps/jsr.io/@std/yaml/1.2.0/_chars.d.ts +0 -33
  13. package/esm/deps/jsr.io/@std/yaml/1.2.0/_chars.d.ts.map +0 -1
  14. package/esm/deps/jsr.io/@std/yaml/1.2.0/_chars.js +0 -48
  15. package/esm/deps/jsr.io/@std/yaml/1.2.0/_dumper_state.d.ts +0 -106
  16. package/esm/deps/jsr.io/@std/yaml/1.2.0/_dumper_state.d.ts.map +0 -1
  17. package/esm/deps/jsr.io/@std/yaml/1.2.0/_dumper_state.js +0 -636
  18. package/esm/deps/jsr.io/@std/yaml/1.2.0/_loader_state.d.ts +0 -67
  19. package/esm/deps/jsr.io/@std/yaml/1.2.0/_loader_state.d.ts.map +0 -1
  20. package/esm/deps/jsr.io/@std/yaml/1.2.0/_loader_state.js +0 -1393
  21. package/esm/deps/jsr.io/@std/yaml/1.2.0/_schema.d.ts +0 -44
  22. package/esm/deps/jsr.io/@std/yaml/1.2.0/_schema.d.ts.map +0 -1
  23. package/esm/deps/jsr.io/@std/yaml/1.2.0/_schema.js +0 -117
  24. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/binary.d.ts +0 -3
  25. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/binary.d.ts.map +0 -1
  26. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/binary.js +0 -103
  27. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/bool.d.ts +0 -3
  28. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/bool.d.ts.map +0 -1
  29. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/bool.js +0 -32
  30. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/float.d.ts +0 -3
  31. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/float.d.ts.map +0 -1
  32. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/float.js +0 -96
  33. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/int.d.ts +0 -3
  34. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/int.d.ts.map +0 -1
  35. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/int.js +0 -159
  36. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/map.d.ts +0 -3
  37. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/map.d.ts.map +0 -1
  38. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/map.js +0 -14
  39. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/merge.d.ts +0 -3
  40. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/merge.d.ts.map +0 -1
  41. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/merge.js +0 -10
  42. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/nil.d.ts +0 -3
  43. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/nil.d.ts.map +0 -1
  44. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/nil.js +0 -22
  45. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/omap.d.ts +0 -3
  46. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/omap.d.ts.map +0 -1
  47. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/omap.js +0 -29
  48. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.d.ts +0 -3
  49. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.d.ts.map +0 -1
  50. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.js +0 -19
  51. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.d.ts +0 -3
  52. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.d.ts.map +0 -1
  53. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.js +0 -30
  54. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/seq.d.ts +0 -3
  55. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/seq.d.ts.map +0 -1
  56. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/seq.js +0 -10
  57. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/set.d.ts +0 -3
  58. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/set.d.ts.map +0 -1
  59. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/set.js +0 -14
  60. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/str.d.ts +0 -3
  61. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/str.d.ts.map +0 -1
  62. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/str.js +0 -9
  63. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.d.ts +0 -3
  64. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.d.ts.map +0 -1
  65. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.js +0 -81
  66. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.d.ts +0 -3
  67. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.d.ts.map +0 -1
  68. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.js +0 -20
  69. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type.d.ts +0 -32
  70. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type.d.ts.map +0 -1
  71. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type.js +0 -6
  72. package/esm/deps/jsr.io/@std/yaml/1.2.0/_utils.d.ts +0 -4
  73. package/esm/deps/jsr.io/@std/yaml/1.2.0/_utils.d.ts.map +0 -1
  74. package/esm/deps/jsr.io/@std/yaml/1.2.0/_utils.js +0 -13
  75. package/esm/deps/jsr.io/@std/yaml/1.2.0/mod.d.ts +0 -51
  76. package/esm/deps/jsr.io/@std/yaml/1.2.0/mod.d.ts.map +0 -1
  77. package/esm/deps/jsr.io/@std/yaml/1.2.0/mod.js +0 -53
  78. package/esm/deps/jsr.io/@std/yaml/1.2.0/parse.d.ts +0 -79
  79. package/esm/deps/jsr.io/@std/yaml/1.2.0/parse.d.ts.map +0 -1
  80. package/esm/deps/jsr.io/@std/yaml/1.2.0/parse.js +0 -91
  81. package/esm/deps/jsr.io/@std/yaml/1.2.0/stringify.d.ts +0 -100
  82. package/esm/deps/jsr.io/@std/yaml/1.2.0/stringify.d.ts.map +0 -1
  83. package/esm/deps/jsr.io/@std/yaml/1.2.0/stringify.js +0 -33
  84. package/esm/deps/jsr.io/@std/yaml/1.2.0/types.d.ts +0 -111
  85. package/esm/deps/jsr.io/@std/yaml/1.2.0/types.d.ts.map +0 -1
  86. package/esm/deps/jsr.io/@std/yaml/1.2.0/types.js +0 -104
  87. package/esm/mod.d.ts.map +0 -1
  88. package/esm/package.json +0 -3
  89. package/esm/src/auth/as-metadata-proxy.d.ts +0 -112
  90. package/esm/src/auth/as-metadata-proxy.d.ts.map +0 -1
  91. package/esm/src/auth/as-metadata-proxy.js +0 -171
  92. package/esm/src/auth/config.d.ts +0 -117
  93. package/esm/src/auth/config.d.ts.map +0 -1
  94. package/esm/src/auth/config.js +0 -219
  95. package/esm/src/auth/jwt-provider.d.ts +0 -157
  96. package/esm/src/auth/jwt-provider.d.ts.map +0 -1
  97. package/esm/src/auth/jwt-provider.js +0 -187
  98. package/esm/src/auth/middleware.d.ts +0 -61
  99. package/esm/src/auth/middleware.d.ts.map +0 -1
  100. package/esm/src/auth/middleware.js +0 -209
  101. package/esm/src/auth/mod.d.ts +0 -23
  102. package/esm/src/auth/mod.d.ts.map +0 -1
  103. package/esm/src/auth/mod.js +0 -27
  104. package/esm/src/auth/multi-tenant-middleware.d.ts +0 -131
  105. package/esm/src/auth/multi-tenant-middleware.d.ts.map +0 -1
  106. package/esm/src/auth/multi-tenant-middleware.js +0 -128
  107. package/esm/src/auth/presets.d.ts +0 -231
  108. package/esm/src/auth/presets.d.ts.map +0 -1
  109. package/esm/src/auth/presets.js +0 -223
  110. package/esm/src/auth/provider.d.ts +0 -47
  111. package/esm/src/auth/provider.d.ts.map +0 -1
  112. package/esm/src/auth/provider.js +0 -34
  113. package/esm/src/auth/scope-middleware.d.ts +0 -30
  114. package/esm/src/auth/scope-middleware.d.ts.map +0 -1
  115. package/esm/src/auth/scope-middleware.js +0 -48
  116. package/esm/src/auth/static-token-provider.d.ts +0 -155
  117. package/esm/src/auth/static-token-provider.d.ts.map +0 -1
  118. package/esm/src/auth/static-token-provider.js +0 -256
  119. package/esm/src/auth/types.d.ts +0 -151
  120. package/esm/src/auth/types.d.ts.map +0 -1
  121. package/esm/src/auth/types.js +0 -64
  122. package/esm/src/client-auth/callback-server.d.ts +0 -34
  123. package/esm/src/client-auth/callback-server.d.ts.map +0 -1
  124. package/esm/src/client-auth/callback-server.js +0 -141
  125. package/esm/src/client-auth/client-id-metadata.d.ts +0 -29
  126. package/esm/src/client-auth/client-id-metadata.d.ts.map +0 -1
  127. package/esm/src/client-auth/client-id-metadata.js +0 -149
  128. package/esm/src/client-auth/connect.d.ts +0 -32
  129. package/esm/src/client-auth/connect.d.ts.map +0 -1
  130. package/esm/src/client-auth/connect.js +0 -47
  131. package/esm/src/client-auth/mod.d.ts +0 -19
  132. package/esm/src/client-auth/mod.d.ts.map +0 -1
  133. package/esm/src/client-auth/mod.js +0 -19
  134. package/esm/src/client-auth/provider.d.ts +0 -78
  135. package/esm/src/client-auth/provider.d.ts.map +0 -1
  136. package/esm/src/client-auth/provider.js +0 -246
  137. package/esm/src/client-auth/token-store/file-store.d.ts +0 -20
  138. package/esm/src/client-auth/token-store/file-store.d.ts.map +0 -1
  139. package/esm/src/client-auth/token-store/file-store.js +0 -62
  140. package/esm/src/client-auth/token-store/memory-store.d.ts +0 -14
  141. package/esm/src/client-auth/token-store/memory-store.d.ts.map +0 -1
  142. package/esm/src/client-auth/token-store/memory-store.js +0 -25
  143. package/esm/src/client-auth/types.d.ts +0 -89
  144. package/esm/src/client-auth/types.d.ts.map +0 -1
  145. package/esm/src/client-auth/types.js +0 -10
  146. package/esm/src/concurrency/rate-limiter.d.ts +0 -87
  147. package/esm/src/concurrency/rate-limiter.d.ts.map +0 -1
  148. package/esm/src/concurrency/rate-limiter.js +0 -165
  149. package/esm/src/concurrency/request-queue.d.ts +0 -71
  150. package/esm/src/concurrency/request-queue.d.ts.map +0 -1
  151. package/esm/src/concurrency/request-queue.js +0 -128
  152. package/esm/src/http/body.d.ts +0 -20
  153. package/esm/src/http/body.d.ts.map +0 -1
  154. package/esm/src/http/body.js +0 -63
  155. package/esm/src/http/request-guards.d.ts +0 -54
  156. package/esm/src/http/request-guards.d.ts.map +0 -1
  157. package/esm/src/http/request-guards.js +0 -114
  158. package/esm/src/http/wire.d.ts +0 -26
  159. package/esm/src/http/wire.d.ts.map +0 -1
  160. package/esm/src/http/wire.js +0 -35
  161. package/esm/src/inspector/launcher.d.ts +0 -48
  162. package/esm/src/inspector/launcher.d.ts.map +0 -1
  163. package/esm/src/inspector/launcher.js +0 -100
  164. package/esm/src/mcp-app.d.ts +0 -728
  165. package/esm/src/mcp-app.d.ts.map +0 -1
  166. package/esm/src/mcp-app.js +0 -3530
  167. package/esm/src/middleware/backpressure.d.ts +0 -24
  168. package/esm/src/middleware/backpressure.d.ts.map +0 -1
  169. package/esm/src/middleware/backpressure.js +0 -31
  170. package/esm/src/middleware/mod.d.ts +0 -11
  171. package/esm/src/middleware/mod.d.ts.map +0 -1
  172. package/esm/src/middleware/mod.js +0 -11
  173. package/esm/src/middleware/rate-limit.d.ts +0 -22
  174. package/esm/src/middleware/rate-limit.d.ts.map +0 -1
  175. package/esm/src/middleware/rate-limit.js +0 -33
  176. package/esm/src/middleware/runner.d.ts +0 -32
  177. package/esm/src/middleware/runner.d.ts.map +0 -1
  178. package/esm/src/middleware/runner.js +0 -49
  179. package/esm/src/middleware/types.d.ts +0 -76
  180. package/esm/src/middleware/types.d.ts.map +0 -1
  181. package/esm/src/middleware/types.js +0 -9
  182. package/esm/src/middleware/validation.d.ts +0 -24
  183. package/esm/src/middleware/validation.d.ts.map +0 -1
  184. package/esm/src/middleware/validation.js +0 -30
  185. package/esm/src/mrtr/capability-check.d.ts +0 -75
  186. package/esm/src/mrtr/capability-check.d.ts.map +0 -1
  187. package/esm/src/mrtr/capability-check.js +0 -233
  188. package/esm/src/mrtr/mod.d.ts +0 -18
  189. package/esm/src/mrtr/mod.d.ts.map +0 -1
  190. package/esm/src/mrtr/mod.js +0 -12
  191. package/esm/src/mrtr/replay-store.d.ts +0 -50
  192. package/esm/src/mrtr/replay-store.d.ts.map +0 -1
  193. package/esm/src/mrtr/replay-store.js +0 -61
  194. package/esm/src/mrtr/request-state.d.ts +0 -181
  195. package/esm/src/mrtr/request-state.d.ts.map +0 -1
  196. package/esm/src/mrtr/request-state.js +0 -313
  197. package/esm/src/mrtr/retry-guard.d.ts +0 -61
  198. package/esm/src/mrtr/retry-guard.d.ts.map +0 -1
  199. package/esm/src/mrtr/retry-guard.js +0 -53
  200. package/esm/src/mrtr/types.d.ts +0 -99
  201. package/esm/src/mrtr/types.d.ts.map +0 -1
  202. package/esm/src/mrtr/types.js +0 -14
  203. package/esm/src/observability/metrics.d.ts +0 -104
  204. package/esm/src/observability/metrics.d.ts.map +0 -1
  205. package/esm/src/observability/metrics.js +0 -207
  206. package/esm/src/observability/mod.d.ts +0 -12
  207. package/esm/src/observability/mod.d.ts.map +0 -1
  208. package/esm/src/observability/mod.js +0 -11
  209. package/esm/src/observability/otel.d.ts +0 -73
  210. package/esm/src/observability/otel.d.ts.map +0 -1
  211. package/esm/src/observability/otel.js +0 -260
  212. package/esm/src/runtime/runtime.d.ts +0 -10
  213. package/esm/src/runtime/runtime.d.ts.map +0 -1
  214. package/esm/src/runtime/runtime.deno.d.ts +0 -50
  215. package/esm/src/runtime/runtime.deno.d.ts.map +0 -1
  216. package/esm/src/runtime/runtime.deno.js +0 -120
  217. package/esm/src/runtime/runtime.js +0 -41
  218. package/esm/src/runtime/runtime.node.d.ts +0 -51
  219. package/esm/src/runtime/runtime.node.d.ts.map +0 -1
  220. package/esm/src/runtime/runtime.node.js +0 -268
  221. package/esm/src/runtime/types.d.ts +0 -107
  222. package/esm/src/runtime/types.d.ts.map +0 -1
  223. package/esm/src/runtime/types.js +0 -12
  224. package/esm/src/security/channel-hmac.d.ts +0 -43
  225. package/esm/src/security/channel-hmac.d.ts.map +0 -1
  226. package/esm/src/security/channel-hmac.js +0 -135
  227. package/esm/src/security/csp.d.ts +0 -50
  228. package/esm/src/security/csp.d.ts.map +0 -1
  229. package/esm/src/security/csp.js +0 -63
  230. package/esm/src/security/message-signer.d.ts +0 -88
  231. package/esm/src/security/message-signer.d.ts.map +0 -1
  232. package/esm/src/security/message-signer.js +0 -166
  233. package/esm/src/subscriptions/subscription-registry.d.ts +0 -256
  234. package/esm/src/subscriptions/subscription-registry.d.ts.map +0 -1
  235. package/esm/src/subscriptions/subscription-registry.js +0 -406
  236. package/esm/src/tasks/mod.d.ts +0 -13
  237. package/esm/src/tasks/mod.d.ts.map +0 -1
  238. package/esm/src/tasks/mod.js +0 -11
  239. package/esm/src/tasks/task-store.d.ts +0 -342
  240. package/esm/src/tasks/task-store.d.ts.map +0 -1
  241. package/esm/src/tasks/task-store.js +0 -649
  242. package/esm/src/transport/request-headers.d.ts +0 -145
  243. package/esm/src/transport/request-headers.d.ts.map +0 -1
  244. package/esm/src/transport/request-headers.js +0 -525
  245. package/esm/src/types.d.ts +0 -776
  246. package/esm/src/types.d.ts.map +0 -1
  247. package/esm/src/types.js +0 -92
  248. package/esm/src/ui/viewer-utils.d.ts +0 -45
  249. package/esm/src/ui/viewer-utils.d.ts.map +0 -1
  250. package/esm/src/ui/viewer-utils.js +0 -97
  251. package/esm/src/validation/schema-validator.d.ts +0 -115
  252. package/esm/src/validation/schema-validator.d.ts.map +0 -1
  253. package/esm/src/validation/schema-validator.js +0 -249
@@ -1,100 +0,0 @@
1
- import { type SchemaType } from "./_schema.js";
2
- import type { StyleVariant } from "./_type.js";
3
- export type { SchemaType, StyleVariant };
4
- /** Options for {@linkcode stringify}. */
5
- export type StringifyOptions = {
6
- /**
7
- * Indentation width to use (in spaces).
8
- *
9
- * @default {2}
10
- */
11
- indent?: number;
12
- /**
13
- * When true, adds an indentation level to array elements.
14
- *
15
- * @default {true}
16
- */
17
- arrayIndent?: boolean;
18
- /**
19
- * Do not throw on invalid types (like function in the safe schema) and skip
20
- * pairs and single values with such types.
21
- *
22
- * @default {false}
23
- */
24
- skipInvalid?: boolean;
25
- /**
26
- * Specifies level of nesting, when to switch from block to flow style for
27
- * collections. `-1` means block style everywhere.
28
- *
29
- * @default {-1}
30
- */
31
- flowLevel?: number;
32
- /** Each tag may have own set of styles. - "tag" => "style" map. */
33
- styles?: Record<string, StyleVariant>;
34
- /**
35
- * Name of the schema to use.
36
- *
37
- * @default {"default"}
38
- */
39
- schema?: SchemaType;
40
- /**
41
- * If true, sort keys when dumping YAML in ascending, ASCII character order.
42
- * If a function, use the function to sort the keys.
43
- * If a function is specified, the function must return a negative value
44
- * if first argument is less than second argument, zero if they're equal
45
- * and a positive value otherwise.
46
- *
47
- * @default {false}
48
- */
49
- sortKeys?: boolean | ((a: string, b: string, depth: number) => number);
50
- /**
51
- * Set max line width.
52
- *
53
- * @default {80}
54
- */
55
- lineWidth?: number;
56
- /**
57
- * If false, don't convert duplicate objects into references.
58
- *
59
- * @default {true}
60
- */
61
- useAnchors?: boolean;
62
- /**
63
- * If false don't try to be compatible with older yaml versions.
64
- * Currently: don't quote "yes", "no" and so on,
65
- * as required for YAML 1.1.
66
- *
67
- * @default {true}
68
- */
69
- compatMode?: boolean;
70
- /**
71
- * If true flow sequences will be condensed, omitting the
72
- * space between `key: value` or `a, b`. Eg. `'[a,b]'` or `{a:{b:c}}`.
73
- * Can be useful when using yaml for pretty URL query params
74
- * as spaces are %-encoded.
75
- *
76
- * @default {false}
77
- */
78
- condenseFlow?: boolean;
79
- };
80
- /**
81
- * Converts a JavaScript object or value to a YAML document string.
82
- *
83
- * @example Usage
84
- * ```ts
85
- * import { stringify } from "@std/yaml/stringify";
86
- * import { assertEquals } from "@std/assert";
87
- *
88
- * const data = { id: 1, name: "Alice" };
89
- * const yaml = stringify(data);
90
- *
91
- * assertEquals(yaml, "id: 1\nname: Alice\n");
92
- * ```
93
- *
94
- * @throws {TypeError} If `data` contains invalid types.
95
- * @param data The data to serialize.
96
- * @param options The options for serialization.
97
- * @returns A YAML string.
98
- */
99
- export declare function stringify(data: unknown, options?: StringifyOptions): string;
100
- //# sourceMappingURL=stringify.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/yaml/1.2.0/stringify.ts"],"names":[],"mappings":"AAOA,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;AAEzC,yCAAyC;AACzC,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACtC;;;;OAIG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IACvE;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,OAAO,EACb,OAAO,GAAE,gBAAqB,GAC7B,MAAM,CAMR"}
@@ -1,33 +0,0 @@
1
- // Ported from js-yaml v3.13.1:
2
- // https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
3
- // Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
4
- // Copyright 2018-2026 the Deno authors. MIT license.
5
- // This module is browser compatible.
6
- import { DumperState } from "./_dumper_state.js";
7
- import { SCHEMA_MAP } from "./_schema.js";
8
- /**
9
- * Converts a JavaScript object or value to a YAML document string.
10
- *
11
- * @example Usage
12
- * ```ts
13
- * import { stringify } from "@std/yaml/stringify";
14
- * import { assertEquals } from "@std/assert";
15
- *
16
- * const data = { id: 1, name: "Alice" };
17
- * const yaml = stringify(data);
18
- *
19
- * assertEquals(yaml, "id: 1\nname: Alice\n");
20
- * ```
21
- *
22
- * @throws {TypeError} If `data` contains invalid types.
23
- * @param data The data to serialize.
24
- * @param options The options for serialization.
25
- * @returns A YAML string.
26
- */
27
- export function stringify(data, options = {}) {
28
- const state = new DumperState({
29
- ...options,
30
- schema: SCHEMA_MAP.get(options.schema),
31
- });
32
- return state.stringify(data);
33
- }
@@ -1,111 +0,0 @@
1
- /**
2
- * Type definitions for the YAML parser.
3
- *
4
- * @module
5
- */
6
- /**
7
- * Position information for error reporting.
8
- *
9
- * `line` and `column` are 1-indexed; `offset` is the 0-indexed character
10
- * offset into the source string.
11
- */
12
- export interface YamlPosition {
13
- /** Line number (1-indexed). */
14
- readonly line: number;
15
- /** Column number (1-indexed). */
16
- readonly column: number;
17
- /** Character offset in the input (0-indexed). */
18
- readonly offset: number;
19
- }
20
- /**
21
- * Error thrown when YAML parsing fails.
22
- *
23
- * Subclass of {@linkcode SyntaxError}, so existing
24
- * `instanceof SyntaxError` checks keep working. Carries structured
25
- * position information so consumers do not have to parse the message.
26
- *
27
- * @example Usage
28
- * ```ts
29
- * import { parse, YamlSyntaxError } from "@std/yaml";
30
- * import { assertInstanceOf } from "@std/assert";
31
- *
32
- * try {
33
- * parse(`"`);
34
- * } catch (error) {
35
- * assertInstanceOf(error, YamlSyntaxError);
36
- * assertInstanceOf(error, SyntaxError);
37
- * }
38
- * ```
39
- */
40
- export declare class YamlSyntaxError extends SyntaxError {
41
- /**
42
- * The line number where the error occurred (1-indexed).
43
- *
44
- * @example Usage
45
- * ```ts
46
- * import { YamlSyntaxError } from "@std/yaml";
47
- * import { assertEquals } from "@std/assert";
48
- *
49
- * const error = new YamlSyntaxError("Test", { line: 5, column: 10, offset: 50 });
50
- * assertEquals(error.line, 5);
51
- * ```
52
- */
53
- readonly line: number;
54
- /**
55
- * The column number where the error occurred (1-indexed).
56
- *
57
- * @example Usage
58
- * ```ts
59
- * import { YamlSyntaxError } from "@std/yaml";
60
- * import { assertEquals } from "@std/assert";
61
- *
62
- * const error = new YamlSyntaxError("Test", { line: 5, column: 10, offset: 50 });
63
- * assertEquals(error.column, 10);
64
- * ```
65
- */
66
- readonly column: number;
67
- /**
68
- * The character offset where the error occurred (0-indexed).
69
- *
70
- * @example Usage
71
- * ```ts
72
- * import { YamlSyntaxError } from "@std/yaml";
73
- * import { assertEquals } from "@std/assert";
74
- *
75
- * const error = new YamlSyntaxError("Test", { line: 5, column: 10, offset: 50 });
76
- * assertEquals(error.offset, 50);
77
- * ```
78
- */
79
- readonly offset: number;
80
- /**
81
- * A formatted snippet of the source around the error, including a caret
82
- * line indicating the column. Undefined when the source is empty.
83
- *
84
- * @example Usage
85
- * ```ts
86
- * import { YamlSyntaxError } from "@std/yaml";
87
- * import { assertEquals } from "@std/assert";
88
- *
89
- * const snippet = " foo: bar\n ^";
90
- * const error = new YamlSyntaxError(
91
- * "Test",
92
- * { line: 1, column: 6, offset: 5 },
93
- * snippet,
94
- * );
95
- * assertEquals(error.snippet, snippet);
96
- * ```
97
- */
98
- readonly snippet?: string;
99
- /**
100
- * Constructs a new YamlSyntaxError.
101
- *
102
- * The constructed `message` is `${message} at line ${line}, column ${column}`,
103
- * with `:\n${snippet}` appended when a snippet is provided.
104
- *
105
- * @param message The error message describing the syntax issue.
106
- * @param position The position in the YAML source where the error occurred.
107
- * @param snippet Optional formatted snippet of the source around the error.
108
- */
109
- constructor(message: string, position: YamlPosition, snippet?: string);
110
- }
111
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/yaml/1.2.0/types.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,eAAgB,SAAQ,WAAW;IAC9C;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;;;;;;OASG;gBACS,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,MAAM;CAWtE"}
@@ -1,104 +0,0 @@
1
- // Copyright 2018-2026 the Deno authors. MIT license.
2
- // This module is browser compatible.
3
- /**
4
- * Error thrown when YAML parsing fails.
5
- *
6
- * Subclass of {@linkcode SyntaxError}, so existing
7
- * `instanceof SyntaxError` checks keep working. Carries structured
8
- * position information so consumers do not have to parse the message.
9
- *
10
- * @example Usage
11
- * ```ts
12
- * import { parse, YamlSyntaxError } from "@std/yaml";
13
- * import { assertInstanceOf } from "@std/assert";
14
- *
15
- * try {
16
- * parse(`"`);
17
- * } catch (error) {
18
- * assertInstanceOf(error, YamlSyntaxError);
19
- * assertInstanceOf(error, SyntaxError);
20
- * }
21
- * ```
22
- */
23
- export class YamlSyntaxError extends SyntaxError {
24
- /**
25
- * The line number where the error occurred (1-indexed).
26
- *
27
- * @example Usage
28
- * ```ts
29
- * import { YamlSyntaxError } from "@std/yaml";
30
- * import { assertEquals } from "@std/assert";
31
- *
32
- * const error = new YamlSyntaxError("Test", { line: 5, column: 10, offset: 50 });
33
- * assertEquals(error.line, 5);
34
- * ```
35
- */
36
- line;
37
- /**
38
- * The column number where the error occurred (1-indexed).
39
- *
40
- * @example Usage
41
- * ```ts
42
- * import { YamlSyntaxError } from "@std/yaml";
43
- * import { assertEquals } from "@std/assert";
44
- *
45
- * const error = new YamlSyntaxError("Test", { line: 5, column: 10, offset: 50 });
46
- * assertEquals(error.column, 10);
47
- * ```
48
- */
49
- column;
50
- /**
51
- * The character offset where the error occurred (0-indexed).
52
- *
53
- * @example Usage
54
- * ```ts
55
- * import { YamlSyntaxError } from "@std/yaml";
56
- * import { assertEquals } from "@std/assert";
57
- *
58
- * const error = new YamlSyntaxError("Test", { line: 5, column: 10, offset: 50 });
59
- * assertEquals(error.offset, 50);
60
- * ```
61
- */
62
- offset;
63
- /**
64
- * A formatted snippet of the source around the error, including a caret
65
- * line indicating the column. Undefined when the source is empty.
66
- *
67
- * @example Usage
68
- * ```ts
69
- * import { YamlSyntaxError } from "@std/yaml";
70
- * import { assertEquals } from "@std/assert";
71
- *
72
- * const snippet = " foo: bar\n ^";
73
- * const error = new YamlSyntaxError(
74
- * "Test",
75
- * { line: 1, column: 6, offset: 5 },
76
- * snippet,
77
- * );
78
- * assertEquals(error.snippet, snippet);
79
- * ```
80
- */
81
- snippet;
82
- /**
83
- * Constructs a new YamlSyntaxError.
84
- *
85
- * The constructed `message` is `${message} at line ${line}, column ${column}`,
86
- * with `:\n${snippet}` appended when a snippet is provided.
87
- *
88
- * @param message The error message describing the syntax issue.
89
- * @param position The position in the YAML source where the error occurred.
90
- * @param snippet Optional formatted snippet of the source around the error.
91
- */
92
- constructor(message, position, snippet) {
93
- let fullMessage = `${message} at line ${position.line}, column ${position.column}`;
94
- if (snippet)
95
- fullMessage += `:\n${snippet}`;
96
- super(fullMessage);
97
- this.name = "YamlSyntaxError";
98
- this.line = position.line;
99
- this.column = position.column;
100
- this.offset = position.offset;
101
- if (snippet !== undefined)
102
- this.snippet = snippet;
103
- }
104
- }
package/esm/mod.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAGH,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;;;;;;GAOG;AACH,OAAO,EAAE,MAAM,IAAI,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGjE,OAAO,EAAE,YAAY,EAA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R compatibility discovery.
3
- *
4
- * Creates a Web Standard request handler that serves an RFC 8414
5
- * Authorization Server Metadata document enriched with
6
- * `registration_endpoint` (RFC 7591). This is a compatibility path for
7
- * MCP clients and IdPs that still rely on Dynamic Client Registration
8
- * (DCR), which is now optional (`MAY`) in the 2025-11-25 MCP spec.
9
- *
10
- * For new OAuth client integrations, prefer the spec-preferred Client ID
11
- * Metadata Documents (CIMD) on the client side. See
12
- * `src/client-auth/client-id-metadata.ts`.
13
- *
14
- * **Issuer field note (RFC 8414 §3.2)**:
15
- * The `issuer` field in the served metadata will be the upstream IdP's
16
- * issuer, not the URL where this handler is served. This intentionally
17
- * violates RFC 8414 §3.2 (`issuer` MUST match the AS URL) because
18
- * overriding `issuer` would cause JWT `iss` claim mismatches — the IdP
19
- * still issues tokens with its own `iss`, and clients verify
20
- * `token.iss === metadata.issuer`. The metadata-URL mismatch is the
21
- * lesser evil for this compatibility path and is not needed when clients
22
- * use CIMD or the upstream IdP ships native registration discovery.
23
- *
24
- * @module lib/server/auth/as-metadata-proxy
25
- */
26
- /**
27
- * Options for {@link createAsMetadataHandler}.
28
- *
29
- * Provide exactly one of:
30
- * - `upstreamMetadataUrl` — full URL of the upstream metadata document
31
- * - `upstreamIssuer` — OIDC issuer (derives `/.well-known/openid-configuration`)
32
- *
33
- * Providing both or neither throws at construction time.
34
- */
35
- export interface AsMetadataProxyOptions {
36
- /**
37
- * Full URL of the upstream AS metadata document to proxy.
38
- *
39
- * IdP-agnostic — pass the appropriate discovery endpoint:
40
- * - OIDC providers: `https://idp.example.com/.well-known/openid-configuration`
41
- * - RFC 8414 AS: `https://as.example.com/.well-known/oauth-authorization-server`
42
- * - Custom paths: any URL that returns a JSON metadata document
43
- *
44
- * Mutually exclusive with `upstreamIssuer`.
45
- */
46
- upstreamMetadataUrl?: string;
47
- /**
48
- * OIDC issuer URL (e.g., `https://my-tenant.zitadel.cloud`).
49
- * Convenience shorthand — derives `{upstreamIssuer}/.well-known/openid-configuration`.
50
- *
51
- * Mutually exclusive with `upstreamMetadataUrl`.
52
- */
53
- upstreamIssuer?: string;
54
- /**
55
- * Absolute HTTPS URL of the RFC 7591 DCR endpoint that the MCP server
56
- * exposes (implemented separately by the consumer — outside lib scope).
57
- * Injected as `registration_endpoint` in the enriched metadata.
58
- *
59
- * Must be a valid absolute HTTP(S) URL (validated at construction time).
60
- */
61
- registrationEndpoint: string;
62
- /**
63
- * TTL for the upstream metadata cache in milliseconds.
64
- * @default 86_400_000 (24 hours)
65
- *
66
- * Uses stale-while-revalidate: serves cached metadata even after
67
- * expiry while refreshing in the background.
68
- */
69
- cacheTtlMs?: number;
70
- /**
71
- * Additional RFC 8414 fields to inject or override in the metadata
72
- * (beyond `registration_endpoint`). Useful for overriding
73
- * `scopes_supported`, adding `code_challenge_methods_supported`, etc.
74
- *
75
- * **Warning**: avoid overriding `issuer` — see module-level JSDoc
76
- * for why this causes JWT validation failures.
77
- */
78
- extraFields?: Record<string, unknown>;
79
- /**
80
- * Custom `fetch` implementation. Defaults to `globalThis.fetch`.
81
- *
82
- * Use for dependency injection in tests, or for advanced scenarios
83
- * like mTLS, custom headers, or retry wrappers.
84
- */
85
- fetch?: typeof globalThis.fetch;
86
- }
87
- /**
88
- * Creates a Web Standard request handler that serves an RFC 8414
89
- * Authorization Server Metadata document enriched with
90
- * `registration_endpoint`.
91
- *
92
- * The handler is framework-agnostic — mount it in Fresh, Hono, Express
93
- * (via adapter), or any framework that accepts `(Request) => Response`.
94
- *
95
- * @example Explicit metadata URL (any AS)
96
- * ```typescript
97
- * const handler = createAsMetadataHandler({
98
- * upstreamMetadataUrl: "https://as.example.com/.well-known/oauth-authorization-server",
99
- * registrationEndpoint: "https://my-app.example.com/oauth/register",
100
- * });
101
- * ```
102
- *
103
- * @example OIDC issuer shorthand
104
- * ```typescript
105
- * const handler = createAsMetadataHandler({
106
- * upstreamIssuer: "https://my-tenant.zitadel.cloud",
107
- * registrationEndpoint: "https://my-app.example.com/oauth/register",
108
- * });
109
- * ```
110
- */
111
- export declare function createAsMetadataHandler(options: AsMetadataProxyOptions): (req: Request) => Promise<Response>;
112
- //# sourceMappingURL=as-metadata-proxy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"as-metadata-proxy.d.ts","sourceRoot":"","sources":["../../../src/src/auth/as-metadata-proxy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;OASG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;OAMG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAE7B;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEtC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AA0DD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,sBAAsB,GAC9B,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CA8GrC"}
@@ -1,171 +0,0 @@
1
- /**
2
- * AS Metadata Proxy for DCR compatibility discovery.
3
- *
4
- * Creates a Web Standard request handler that serves an RFC 8414
5
- * Authorization Server Metadata document enriched with
6
- * `registration_endpoint` (RFC 7591). This is a compatibility path for
7
- * MCP clients and IdPs that still rely on Dynamic Client Registration
8
- * (DCR), which is now optional (`MAY`) in the 2025-11-25 MCP spec.
9
- *
10
- * For new OAuth client integrations, prefer the spec-preferred Client ID
11
- * Metadata Documents (CIMD) on the client side. See
12
- * `src/client-auth/client-id-metadata.ts`.
13
- *
14
- * **Issuer field note (RFC 8414 §3.2)**:
15
- * The `issuer` field in the served metadata will be the upstream IdP's
16
- * issuer, not the URL where this handler is served. This intentionally
17
- * violates RFC 8414 §3.2 (`issuer` MUST match the AS URL) because
18
- * overriding `issuer` would cause JWT `iss` claim mismatches — the IdP
19
- * still issues tokens with its own `iss`, and clients verify
20
- * `token.iss === metadata.issuer`. The metadata-URL mismatch is the
21
- * lesser evil for this compatibility path and is not needed when clients
22
- * use CIMD or the upstream IdP ships native registration discovery.
23
- *
24
- * @module lib/server/auth/as-metadata-proxy
25
- */
26
- // ─── Implementation ──────────────────────────────────────────────────
27
- function stripTrailingSlash(url) {
28
- return url.endsWith("/") ? url.slice(0, -1) : url;
29
- }
30
- /**
31
- * Validates that a string is a parseable absolute HTTP(S) URL.
32
- * Throws at construction time for fast failure.
33
- */
34
- function validateUrl(value, label) {
35
- try {
36
- const parsed = new URL(value);
37
- if (!parsed.protocol.startsWith("http")) {
38
- throw new Error(`expected http(s) scheme`);
39
- }
40
- }
41
- catch (cause) {
42
- throw new Error(`AsMetadataProxyOptions.${label} is not a valid HTTP(S) URL: "${value}"`, { cause });
43
- }
44
- }
45
- /**
46
- * Resolves the upstream metadata URL from the flat options.
47
- * Enforces mutual exclusivity: exactly one of upstreamMetadataUrl
48
- * or upstreamIssuer must be provided.
49
- */
50
- function resolveMetadataUrl(options) {
51
- const { upstreamMetadataUrl, upstreamIssuer } = options;
52
- const hasUrl = upstreamMetadataUrl !== undefined;
53
- const hasIssuer = upstreamIssuer !== undefined;
54
- if (hasUrl && hasIssuer) {
55
- throw new Error("AsMetadataProxyOptions: provide either upstreamMetadataUrl or upstreamIssuer, not both");
56
- }
57
- if (!hasUrl && !hasIssuer) {
58
- throw new Error("AsMetadataProxyOptions: one of upstreamMetadataUrl or upstreamIssuer is required");
59
- }
60
- if (hasUrl) {
61
- validateUrl(upstreamMetadataUrl, "upstreamMetadataUrl");
62
- return upstreamMetadataUrl;
63
- }
64
- validateUrl(upstreamIssuer, "upstreamIssuer");
65
- return `${stripTrailingSlash(upstreamIssuer)}/.well-known/openid-configuration`;
66
- }
67
- /**
68
- * Creates a Web Standard request handler that serves an RFC 8414
69
- * Authorization Server Metadata document enriched with
70
- * `registration_endpoint`.
71
- *
72
- * The handler is framework-agnostic — mount it in Fresh, Hono, Express
73
- * (via adapter), or any framework that accepts `(Request) => Response`.
74
- *
75
- * @example Explicit metadata URL (any AS)
76
- * ```typescript
77
- * const handler = createAsMetadataHandler({
78
- * upstreamMetadataUrl: "https://as.example.com/.well-known/oauth-authorization-server",
79
- * registrationEndpoint: "https://my-app.example.com/oauth/register",
80
- * });
81
- * ```
82
- *
83
- * @example OIDC issuer shorthand
84
- * ```typescript
85
- * const handler = createAsMetadataHandler({
86
- * upstreamIssuer: "https://my-tenant.zitadel.cloud",
87
- * registrationEndpoint: "https://my-app.example.com/oauth/register",
88
- * });
89
- * ```
90
- */
91
- export function createAsMetadataHandler(options) {
92
- // ── Fail-fast validation at construction time ──
93
- const metadataUrl = resolveMetadataUrl(options);
94
- validateUrl(options.registrationEndpoint, "registrationEndpoint");
95
- if (options.cacheTtlMs !== undefined &&
96
- (options.cacheTtlMs < 0 || !Number.isFinite(options.cacheTtlMs))) {
97
- throw new Error("AsMetadataProxyOptions.cacheTtlMs must be a non-negative finite number");
98
- }
99
- const { registrationEndpoint, cacheTtlMs = 24 * 60 * 60 * 1000, extraFields, fetch: fetchFn = globalThis.fetch, } = options;
100
- let cached = null;
101
- let refreshing = false;
102
- async function fetchUpstream() {
103
- const res = await fetchFn(metadataUrl, {
104
- signal: AbortSignal.timeout(10_000),
105
- });
106
- if (!res.ok) {
107
- throw new Error(`AS metadata fetch failed: ${res.status} from ${metadataUrl}`);
108
- }
109
- const body = await res.json();
110
- if (body === null || typeof body !== "object" || Array.isArray(body)) {
111
- throw new Error(`AS metadata from ${metadataUrl} is not a JSON object (got ${Array.isArray(body) ? "array" : typeof body})`);
112
- }
113
- if (typeof body.issuer !== "string") {
114
- throw new Error(`AS metadata from ${metadataUrl} is missing required 'issuer' field`);
115
- }
116
- return body;
117
- }
118
- async function getMetadata() {
119
- const now = Date.now();
120
- // Fresh cache hit
121
- if (cached && now - cached.fetchedAt < cacheTtlMs) {
122
- return cached.metadata;
123
- }
124
- // Stale-while-revalidate: serve stale, refresh in background
125
- if (cached) {
126
- if (!refreshing) {
127
- refreshing = true;
128
- fetchUpstream()
129
- .then((m) => {
130
- cached = { metadata: m, fetchedAt: Date.now() };
131
- })
132
- .catch((e) => console.error("[as-metadata-proxy] background refresh failed:", e))
133
- .finally(() => {
134
- refreshing = false;
135
- });
136
- }
137
- return cached.metadata;
138
- }
139
- // Cold start: must await
140
- const metadata = await fetchUpstream();
141
- cached = { metadata, fetchedAt: now };
142
- return metadata;
143
- }
144
- return async (req) => {
145
- if (req.method !== "GET" && req.method !== "HEAD") {
146
- return new Response(null, {
147
- status: 405,
148
- headers: { "Allow": "GET, HEAD" },
149
- });
150
- }
151
- try {
152
- const upstream = await getMetadata();
153
- const enriched = {
154
- ...upstream,
155
- ...extraFields,
156
- registration_endpoint: registrationEndpoint,
157
- };
158
- return new Response(JSON.stringify(enriched), {
159
- headers: {
160
- "Content-Type": "application/json",
161
- "Cache-Control": "public, max-age=3600",
162
- },
163
- });
164
- }
165
- catch (err) {
166
- console.error("[as-metadata-proxy] upstream fetch failed:", err);
167
- const msg = err instanceof Error ? err.message : String(err);
168
- return new Response(JSON.stringify({ error: "as_metadata_unavailable", message: msg }), { status: 502, headers: { "Content-Type": "application/json" } });
169
- }
170
- };
171
- }