@atxp/client 0.10.3 → 0.10.5

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 (722) hide show
  1. package/dist/_virtual/additionalItems.js +4 -0
  2. package/dist/_virtual/additionalItems.js.map +1 -0
  3. package/dist/_virtual/additionalItems2.js +4 -0
  4. package/dist/_virtual/additionalItems2.js.map +1 -0
  5. package/dist/_virtual/additionalProperties.js +4 -0
  6. package/dist/_virtual/additionalProperties.js.map +1 -0
  7. package/dist/_virtual/additionalProperties2.js +4 -0
  8. package/dist/_virtual/additionalProperties2.js.map +1 -0
  9. package/dist/_virtual/ajv.js +1 -1
  10. package/dist/_virtual/ajv2.js +4 -0
  11. package/dist/_virtual/ajv2.js.map +1 -0
  12. package/dist/_virtual/ajv3.js +4 -0
  13. package/dist/_virtual/ajv3.js.map +1 -0
  14. package/dist/_virtual/allOf.js +4 -0
  15. package/dist/_virtual/allOf.js.map +1 -0
  16. package/dist/_virtual/allOf2.js +4 -0
  17. package/dist/_virtual/allOf2.js.map +1 -0
  18. package/dist/_virtual/anyOf.js +4 -0
  19. package/dist/_virtual/anyOf.js.map +1 -0
  20. package/dist/_virtual/anyOf2.js +4 -0
  21. package/dist/_virtual/anyOf2.js.map +1 -0
  22. package/dist/_virtual/applicability.js +4 -0
  23. package/dist/_virtual/applicability.js.map +1 -0
  24. package/dist/_virtual/applicability2.js +4 -0
  25. package/dist/_virtual/applicability2.js.map +1 -0
  26. package/dist/_virtual/boolSchema.js +4 -0
  27. package/dist/_virtual/boolSchema.js.map +1 -0
  28. package/dist/_virtual/boolSchema2.js +4 -0
  29. package/dist/_virtual/boolSchema2.js.map +1 -0
  30. package/dist/_virtual/code.js +4 -0
  31. package/dist/_virtual/code.js.map +1 -0
  32. package/dist/_virtual/code2.js +4 -0
  33. package/dist/_virtual/code2.js.map +1 -0
  34. package/dist/_virtual/code3.js +4 -0
  35. package/dist/_virtual/code3.js.map +1 -0
  36. package/dist/_virtual/code4.js +4 -0
  37. package/dist/_virtual/code4.js.map +1 -0
  38. package/dist/_virtual/const.js +4 -0
  39. package/dist/_virtual/const.js.map +1 -0
  40. package/dist/_virtual/const2.js +4 -0
  41. package/dist/_virtual/const2.js.map +1 -0
  42. package/dist/_virtual/contains.js +4 -0
  43. package/dist/_virtual/contains.js.map +1 -0
  44. package/dist/_virtual/contains2.js +4 -0
  45. package/dist/_virtual/contains2.js.map +1 -0
  46. package/dist/_virtual/core.js +4 -0
  47. package/dist/_virtual/core.js.map +1 -0
  48. package/dist/_virtual/core2.js +4 -0
  49. package/dist/_virtual/core2.js.map +1 -0
  50. package/dist/_virtual/dataType.js +4 -0
  51. package/dist/_virtual/dataType.js.map +1 -0
  52. package/dist/_virtual/dataType2.js +4 -0
  53. package/dist/_virtual/dataType2.js.map +1 -0
  54. package/dist/_virtual/defaults.js +4 -0
  55. package/dist/_virtual/defaults.js.map +1 -0
  56. package/dist/_virtual/defaults2.js +4 -0
  57. package/dist/_virtual/defaults2.js.map +1 -0
  58. package/dist/_virtual/dependencies.js +4 -0
  59. package/dist/_virtual/dependencies.js.map +1 -0
  60. package/dist/_virtual/dependencies2.js +4 -0
  61. package/dist/_virtual/dependencies2.js.map +1 -0
  62. package/dist/_virtual/draft7.js +4 -0
  63. package/dist/_virtual/draft7.js.map +1 -0
  64. package/dist/_virtual/draft72.js +4 -0
  65. package/dist/_virtual/draft72.js.map +1 -0
  66. package/dist/_virtual/enum.js +4 -0
  67. package/dist/_virtual/enum.js.map +1 -0
  68. package/dist/_virtual/enum2.js +4 -0
  69. package/dist/_virtual/enum2.js.map +1 -0
  70. package/dist/_virtual/equal.js +4 -0
  71. package/dist/_virtual/equal.js.map +1 -0
  72. package/dist/_virtual/equal2.js +4 -0
  73. package/dist/_virtual/equal2.js.map +1 -0
  74. package/dist/_virtual/errors.js +4 -0
  75. package/dist/_virtual/errors.js.map +1 -0
  76. package/dist/_virtual/errors2.js +4 -0
  77. package/dist/_virtual/errors2.js.map +1 -0
  78. package/dist/_virtual/format.js +4 -0
  79. package/dist/_virtual/format.js.map +1 -0
  80. package/dist/_virtual/format2.js +4 -0
  81. package/dist/_virtual/format2.js.map +1 -0
  82. package/dist/_virtual/formats.js +4 -0
  83. package/dist/_virtual/formats.js.map +1 -0
  84. package/dist/_virtual/id.js +4 -0
  85. package/dist/_virtual/id.js.map +1 -0
  86. package/dist/_virtual/id2.js +4 -0
  87. package/dist/_virtual/id2.js.map +1 -0
  88. package/dist/_virtual/if.js +4 -0
  89. package/dist/_virtual/if.js.map +1 -0
  90. package/dist/_virtual/if2.js +4 -0
  91. package/dist/_virtual/if2.js.map +1 -0
  92. package/dist/_virtual/index.js +6 -2
  93. package/dist/_virtual/index.js.map +1 -1
  94. package/dist/_virtual/index10.js +4 -0
  95. package/dist/_virtual/index10.js.map +1 -0
  96. package/dist/_virtual/index11.js +4 -0
  97. package/dist/_virtual/index11.js.map +1 -0
  98. package/dist/_virtual/index12.js +4 -0
  99. package/dist/_virtual/index12.js.map +1 -0
  100. package/dist/_virtual/index13.js +4 -0
  101. package/dist/_virtual/index13.js.map +1 -0
  102. package/dist/_virtual/index14.js +4 -0
  103. package/dist/_virtual/index14.js.map +1 -0
  104. package/dist/_virtual/index15.js +4 -0
  105. package/dist/_virtual/index15.js.map +1 -0
  106. package/dist/_virtual/index16.js +4 -0
  107. package/dist/_virtual/index16.js.map +1 -0
  108. package/dist/_virtual/index17.js +4 -0
  109. package/dist/_virtual/index17.js.map +1 -0
  110. package/dist/_virtual/index18.js +4 -0
  111. package/dist/_virtual/index18.js.map +1 -0
  112. package/dist/_virtual/index19.js +4 -0
  113. package/dist/_virtual/index19.js.map +1 -0
  114. package/dist/_virtual/index2.js +4 -0
  115. package/dist/_virtual/index2.js.map +1 -0
  116. package/dist/_virtual/index20.js +4 -0
  117. package/dist/_virtual/index20.js.map +1 -0
  118. package/dist/_virtual/index21.js +4 -0
  119. package/dist/_virtual/index21.js.map +1 -0
  120. package/dist/_virtual/index3.js +4 -0
  121. package/dist/_virtual/index3.js.map +1 -0
  122. package/dist/_virtual/index4.js +4 -0
  123. package/dist/_virtual/index4.js.map +1 -0
  124. package/dist/_virtual/index5.js +4 -0
  125. package/dist/_virtual/index5.js.map +1 -0
  126. package/dist/_virtual/index6.js +4 -0
  127. package/dist/_virtual/index6.js.map +1 -0
  128. package/dist/_virtual/index7.js +4 -0
  129. package/dist/_virtual/index7.js.map +1 -0
  130. package/dist/_virtual/index8.js +4 -0
  131. package/dist/_virtual/index8.js.map +1 -0
  132. package/dist/_virtual/index9.js +4 -0
  133. package/dist/_virtual/index9.js.map +1 -0
  134. package/dist/_virtual/items.js +4 -0
  135. package/dist/_virtual/items.js.map +1 -0
  136. package/dist/_virtual/items2.js +4 -0
  137. package/dist/_virtual/items2.js.map +1 -0
  138. package/dist/_virtual/items2020.js +4 -0
  139. package/dist/_virtual/items2020.js.map +1 -0
  140. package/dist/_virtual/items20202.js +4 -0
  141. package/dist/_virtual/items20202.js.map +1 -0
  142. package/dist/_virtual/keyword.js +4 -0
  143. package/dist/_virtual/keyword.js.map +1 -0
  144. package/dist/_virtual/keyword2.js +4 -0
  145. package/dist/_virtual/keyword2.js.map +1 -0
  146. package/dist/_virtual/limit.js +4 -0
  147. package/dist/_virtual/limit.js.map +1 -0
  148. package/dist/_virtual/limitItems.js +4 -0
  149. package/dist/_virtual/limitItems.js.map +1 -0
  150. package/dist/_virtual/limitItems2.js +4 -0
  151. package/dist/_virtual/limitItems2.js.map +1 -0
  152. package/dist/_virtual/limitLength.js +4 -0
  153. package/dist/_virtual/limitLength.js.map +1 -0
  154. package/dist/_virtual/limitLength2.js +4 -0
  155. package/dist/_virtual/limitLength2.js.map +1 -0
  156. package/dist/_virtual/limitNumber.js +4 -0
  157. package/dist/_virtual/limitNumber.js.map +1 -0
  158. package/dist/_virtual/limitNumber2.js +4 -0
  159. package/dist/_virtual/limitNumber2.js.map +1 -0
  160. package/dist/_virtual/limitProperties.js +4 -0
  161. package/dist/_virtual/limitProperties.js.map +1 -0
  162. package/dist/_virtual/limitProperties2.js +4 -0
  163. package/dist/_virtual/limitProperties2.js.map +1 -0
  164. package/dist/_virtual/metadata.js +4 -0
  165. package/dist/_virtual/metadata.js.map +1 -0
  166. package/dist/_virtual/metadata2.js +4 -0
  167. package/dist/_virtual/metadata2.js.map +1 -0
  168. package/dist/_virtual/multipleOf.js +4 -0
  169. package/dist/_virtual/multipleOf.js.map +1 -0
  170. package/dist/_virtual/multipleOf2.js +4 -0
  171. package/dist/_virtual/multipleOf2.js.map +1 -0
  172. package/dist/_virtual/names.js +4 -0
  173. package/dist/_virtual/names.js.map +1 -0
  174. package/dist/_virtual/names2.js +4 -0
  175. package/dist/_virtual/names2.js.map +1 -0
  176. package/dist/_virtual/not.js +4 -0
  177. package/dist/_virtual/not.js.map +1 -0
  178. package/dist/_virtual/not2.js +4 -0
  179. package/dist/_virtual/not2.js.map +1 -0
  180. package/dist/_virtual/oneOf.js +4 -0
  181. package/dist/_virtual/oneOf.js.map +1 -0
  182. package/dist/_virtual/oneOf2.js +4 -0
  183. package/dist/_virtual/oneOf2.js.map +1 -0
  184. package/dist/_virtual/pattern.js +4 -0
  185. package/dist/_virtual/pattern.js.map +1 -0
  186. package/dist/_virtual/pattern2.js +4 -0
  187. package/dist/_virtual/pattern2.js.map +1 -0
  188. package/dist/_virtual/patternProperties.js +4 -0
  189. package/dist/_virtual/patternProperties.js.map +1 -0
  190. package/dist/_virtual/patternProperties2.js +4 -0
  191. package/dist/_virtual/patternProperties2.js.map +1 -0
  192. package/dist/_virtual/prefixItems.js +4 -0
  193. package/dist/_virtual/prefixItems.js.map +1 -0
  194. package/dist/_virtual/prefixItems2.js +4 -0
  195. package/dist/_virtual/prefixItems2.js.map +1 -0
  196. package/dist/_virtual/properties.js +4 -0
  197. package/dist/_virtual/properties.js.map +1 -0
  198. package/dist/_virtual/properties2.js +4 -0
  199. package/dist/_virtual/properties2.js.map +1 -0
  200. package/dist/_virtual/propertyNames.js +4 -0
  201. package/dist/_virtual/propertyNames.js.map +1 -0
  202. package/dist/_virtual/propertyNames2.js +4 -0
  203. package/dist/_virtual/propertyNames2.js.map +1 -0
  204. package/dist/_virtual/ref.js +4 -0
  205. package/dist/_virtual/ref.js.map +1 -0
  206. package/dist/_virtual/ref2.js +4 -0
  207. package/dist/_virtual/ref2.js.map +1 -0
  208. package/dist/_virtual/ref_error.js +4 -0
  209. package/dist/_virtual/ref_error.js.map +1 -0
  210. package/dist/_virtual/ref_error2.js +4 -0
  211. package/dist/_virtual/ref_error2.js.map +1 -0
  212. package/dist/_virtual/required.js +4 -0
  213. package/dist/_virtual/required.js.map +1 -0
  214. package/dist/_virtual/required2.js +4 -0
  215. package/dist/_virtual/required2.js.map +1 -0
  216. package/dist/_virtual/resolve.js +4 -0
  217. package/dist/_virtual/resolve.js.map +1 -0
  218. package/dist/_virtual/resolve2.js +4 -0
  219. package/dist/_virtual/resolve2.js.map +1 -0
  220. package/dist/_virtual/rules.js +4 -0
  221. package/dist/_virtual/rules.js.map +1 -0
  222. package/dist/_virtual/rules2.js +4 -0
  223. package/dist/_virtual/rules2.js.map +1 -0
  224. package/dist/_virtual/scope.js +4 -0
  225. package/dist/_virtual/scope.js.map +1 -0
  226. package/dist/_virtual/scope2.js +4 -0
  227. package/dist/_virtual/scope2.js.map +1 -0
  228. package/dist/_virtual/subschema.js +4 -0
  229. package/dist/_virtual/subschema.js.map +1 -0
  230. package/dist/_virtual/subschema2.js +4 -0
  231. package/dist/_virtual/subschema2.js.map +1 -0
  232. package/dist/_virtual/thenElse.js +4 -0
  233. package/dist/_virtual/thenElse.js.map +1 -0
  234. package/dist/_virtual/thenElse2.js +4 -0
  235. package/dist/_virtual/thenElse2.js.map +1 -0
  236. package/dist/_virtual/types.js +4 -0
  237. package/dist/_virtual/types.js.map +1 -0
  238. package/dist/_virtual/types2.js +4 -0
  239. package/dist/_virtual/types2.js.map +1 -0
  240. package/dist/_virtual/ucs2length.js +4 -0
  241. package/dist/_virtual/ucs2length.js.map +1 -0
  242. package/dist/_virtual/ucs2length2.js +4 -0
  243. package/dist/_virtual/ucs2length2.js.map +1 -0
  244. package/dist/_virtual/uniqueItems.js +4 -0
  245. package/dist/_virtual/uniqueItems.js.map +1 -0
  246. package/dist/_virtual/uniqueItems2.js +4 -0
  247. package/dist/_virtual/uniqueItems2.js.map +1 -0
  248. package/dist/_virtual/uri.js +4 -0
  249. package/dist/_virtual/uri.js.map +1 -0
  250. package/dist/_virtual/uri2.js +4 -0
  251. package/dist/_virtual/uri2.js.map +1 -0
  252. package/dist/_virtual/util.js +4 -0
  253. package/dist/_virtual/util.js.map +1 -0
  254. package/dist/_virtual/util2.js +4 -0
  255. package/dist/_virtual/util2.js.map +1 -0
  256. package/dist/_virtual/validation_error.js +4 -0
  257. package/dist/_virtual/validation_error.js.map +1 -0
  258. package/dist/_virtual/validation_error2.js +4 -0
  259. package/dist/_virtual/validation_error2.js.map +1 -0
  260. package/dist/atxpFetcher.d.ts.map +1 -1
  261. package/dist/atxpFetcher.js +19 -3
  262. package/dist/atxpFetcher.js.map +1 -1
  263. package/dist/index.cjs +20003 -11644
  264. package/dist/index.cjs.map +1 -1
  265. package/dist/index.d.ts +3 -1
  266. package/dist/index.js +20003 -11644
  267. package/dist/index.js.map +1 -1
  268. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js +277 -202
  269. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js.map +1 -1
  270. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js +399 -65
  271. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js.map +1 -1
  272. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js +195 -93
  273. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js.map +1 -1
  274. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js +187 -0
  275. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js.map +1 -0
  276. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js +60 -0
  277. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js.map +1 -0
  278. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js +18 -0
  279. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js.map +1 -0
  280. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js +25 -17
  281. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js.map +1 -1
  282. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +85 -0
  283. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -0
  284. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js +30 -0
  285. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map +1 -0
  286. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js +3 -3
  287. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js.map +1 -1
  288. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js +129 -123
  289. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js.map +1 -1
  290. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +785 -114
  291. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -1
  292. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js +41 -0
  293. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js.map +1 -0
  294. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +1207 -513
  295. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +1 -1
  296. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +90 -0
  297. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map +1 -0
  298. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/ajv.js +71 -0
  299. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/ajv.js.map +1 -0
  300. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/codegen/code.js +169 -0
  301. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/codegen/code.js.map +1 -0
  302. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/codegen/index.js +712 -0
  303. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/codegen/index.js.map +1 -0
  304. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/codegen/scope.js +157 -0
  305. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -0
  306. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/errors.js +139 -0
  307. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/errors.js.map +1 -0
  308. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/index.js +259 -0
  309. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/index.js.map +1 -0
  310. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/names.js +40 -0
  311. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/names.js.map +1 -0
  312. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/ref_error.js +24 -0
  313. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/ref_error.js.map +1 -0
  314. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/resolve.js +169 -0
  315. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/resolve.js.map +1 -0
  316. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/rules.js +37 -0
  317. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/rules.js.map +1 -0
  318. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/util.js +191 -0
  319. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/util.js.map +1 -0
  320. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/validate/applicability.js +30 -0
  321. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -0
  322. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/validate/boolSchema.js +64 -0
  323. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -0
  324. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/validate/dataType.js +219 -0
  325. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -0
  326. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/validate/defaults.js +48 -0
  327. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -0
  328. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/validate/index.js +541 -0
  329. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/validate/index.js.map +1 -0
  330. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/validate/keyword.js +139 -0
  331. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -0
  332. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/validate/subschema.js +94 -0
  333. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -0
  334. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/core.js +642 -0
  335. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/core.js.map +1 -0
  336. package/dist/node_modules/{ajv/lib → @modelcontextprotocol/sdk/node_modules/ajv/dist}/refs/data.json.js +3 -5
  337. package/dist/node_modules/{ajv/lib → @modelcontextprotocol/sdk/node_modules/ajv/dist}/refs/data.json.js.map +1 -1
  338. package/dist/node_modules/{ajv/lib → @modelcontextprotocol/sdk/node_modules/ajv/dist}/refs/json-schema-draft-07.json.js +2 -2
  339. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/runtime/equal.js +19 -0
  340. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/runtime/equal.js.map +1 -0
  341. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/runtime/ucs2length.js +35 -0
  342. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -0
  343. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/runtime/uri.js +18 -0
  344. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/runtime/uri.js.map +1 -0
  345. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/runtime/validation_error.js +22 -0
  346. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/runtime/validation_error.js.map +1 -0
  347. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +62 -0
  348. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -0
  349. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +121 -0
  350. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -0
  351. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/allOf.js +35 -0
  352. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -0
  353. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +24 -0
  354. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -0
  355. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/contains.js +108 -0
  356. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -0
  357. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +101 -0
  358. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -0
  359. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/if.js +79 -0
  360. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -0
  361. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/index.js +71 -0
  362. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -0
  363. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/items.js +66 -0
  364. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -0
  365. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/items2020.js +45 -0
  366. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -0
  367. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/not.js +38 -0
  368. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -0
  369. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +73 -0
  370. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -0
  371. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +89 -0
  372. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -0
  373. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +24 -0
  374. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -0
  375. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/properties.js +69 -0
  376. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -0
  377. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +51 -0
  378. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -0
  379. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +25 -0
  380. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -0
  381. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/code.js +145 -0
  382. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/code.js.map +1 -0
  383. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/core/id.js +21 -0
  384. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -0
  385. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/core/index.js +29 -0
  386. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -0
  387. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/core/ref.js +139 -0
  388. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -0
  389. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/discriminator/index.js +120 -0
  390. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -0
  391. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/discriminator/types.js +20 -0
  392. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -0
  393. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/draft7.js +33 -0
  394. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -0
  395. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/format/format.js +104 -0
  396. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -0
  397. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/format/index.js +18 -0
  398. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -0
  399. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/metadata.js +29 -0
  400. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -0
  401. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/const.js +39 -0
  402. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -0
  403. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/enum.js +62 -0
  404. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -0
  405. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/index.js +54 -0
  406. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -0
  407. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/limitItems.js +36 -0
  408. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -0
  409. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/limitLength.js +41 -0
  410. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -0
  411. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +39 -0
  412. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -0
  413. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +36 -0
  414. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -0
  415. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +38 -0
  416. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -0
  417. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/pattern.js +37 -0
  418. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -0
  419. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/required.js +93 -0
  420. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -0
  421. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +79 -0
  422. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -0
  423. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/json-schema-traverse/index.js +104 -0
  424. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/json-schema-traverse/index.js.map +1 -0
  425. package/dist/node_modules/ajv-formats/dist/formats.js +221 -0
  426. package/dist/node_modules/ajv-formats/dist/formats.js.map +1 -0
  427. package/dist/node_modules/ajv-formats/dist/index.js +53 -0
  428. package/dist/node_modules/ajv-formats/dist/index.js.map +1 -0
  429. package/dist/node_modules/ajv-formats/dist/limit.js +84 -0
  430. package/dist/node_modules/ajv-formats/dist/limit.js.map +1 -0
  431. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/ajv.js +71 -0
  432. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/ajv.js.map +1 -0
  433. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.js +169 -0
  434. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.js.map +1 -0
  435. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/index.js +712 -0
  436. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/index.js.map +1 -0
  437. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/scope.js +157 -0
  438. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -0
  439. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/errors.js +139 -0
  440. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/errors.js.map +1 -0
  441. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/index.js +259 -0
  442. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/index.js.map +1 -0
  443. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/names.js +40 -0
  444. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/names.js.map +1 -0
  445. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/ref_error.js +24 -0
  446. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/ref_error.js.map +1 -0
  447. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.js +169 -0
  448. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.js.map +1 -0
  449. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/rules.js +37 -0
  450. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/rules.js.map +1 -0
  451. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/util.js +191 -0
  452. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/util.js.map +1 -0
  453. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/applicability.js +30 -0
  454. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -0
  455. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/boolSchema.js +64 -0
  456. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -0
  457. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/dataType.js +219 -0
  458. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -0
  459. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/defaults.js +48 -0
  460. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -0
  461. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/index.js +541 -0
  462. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/index.js.map +1 -0
  463. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/keyword.js +139 -0
  464. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -0
  465. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/subschema.js +94 -0
  466. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -0
  467. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/core.js +642 -0
  468. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/core.js.map +1 -0
  469. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/refs/data.json.js +31 -0
  470. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/refs/data.json.js.map +1 -0
  471. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-draft-07.json.js +254 -0
  472. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-draft-07.json.js.map +1 -0
  473. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/equal.js +19 -0
  474. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/equal.js.map +1 -0
  475. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/ucs2length.js +35 -0
  476. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -0
  477. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.js +18 -0
  478. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.js.map +1 -0
  479. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/validation_error.js +22 -0
  480. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/validation_error.js.map +1 -0
  481. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +62 -0
  482. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -0
  483. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +121 -0
  484. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -0
  485. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/allOf.js +35 -0
  486. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -0
  487. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +24 -0
  488. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -0
  489. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/contains.js +108 -0
  490. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -0
  491. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +101 -0
  492. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -0
  493. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/if.js +79 -0
  494. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -0
  495. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/index.js +71 -0
  496. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -0
  497. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items.js +66 -0
  498. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -0
  499. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items2020.js +45 -0
  500. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -0
  501. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/not.js +38 -0
  502. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -0
  503. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +73 -0
  504. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -0
  505. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +89 -0
  506. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -0
  507. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +24 -0
  508. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -0
  509. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/properties.js +69 -0
  510. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -0
  511. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +51 -0
  512. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -0
  513. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +25 -0
  514. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -0
  515. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/code.js +145 -0
  516. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/code.js.map +1 -0
  517. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/id.js +21 -0
  518. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -0
  519. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/index.js +29 -0
  520. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -0
  521. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/ref.js +139 -0
  522. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -0
  523. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.js +120 -0
  524. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -0
  525. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/types.js +20 -0
  526. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -0
  527. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft7.js +33 -0
  528. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -0
  529. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/format.js +104 -0
  530. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -0
  531. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/index.js +18 -0
  532. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -0
  533. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/metadata.js +29 -0
  534. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -0
  535. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/const.js +39 -0
  536. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -0
  537. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/enum.js +62 -0
  538. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -0
  539. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/index.js +54 -0
  540. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -0
  541. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitItems.js +36 -0
  542. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -0
  543. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitLength.js +41 -0
  544. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -0
  545. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +39 -0
  546. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -0
  547. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +36 -0
  548. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -0
  549. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +38 -0
  550. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -0
  551. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/pattern.js +37 -0
  552. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -0
  553. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/required.js +93 -0
  554. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -0
  555. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +79 -0
  556. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -0
  557. package/dist/node_modules/{json-schema-traverse → ajv-formats/node_modules/json-schema-traverse}/index.js +6 -2
  558. package/dist/node_modules/ajv-formats/node_modules/json-schema-traverse/index.js.map +1 -0
  559. package/dist/node_modules/fast-uri/index.js +353 -0
  560. package/dist/node_modules/fast-uri/index.js.map +1 -0
  561. package/dist/node_modules/fast-uri/lib/schemes.js +279 -0
  562. package/dist/node_modules/fast-uri/lib/schemes.js.map +1 -0
  563. package/dist/node_modules/fast-uri/lib/utils.js +345 -0
  564. package/dist/node_modules/fast-uri/lib/utils.js.map +1 -0
  565. package/dist/node_modules/pkce-challenge/dist/index.browser.js +8 -5
  566. package/dist/node_modules/pkce-challenge/dist/index.browser.js.map +1 -1
  567. package/dist/node_modules/zod/v4/classic/coerce.js +9 -0
  568. package/dist/node_modules/zod/v4/classic/coerce.js.map +1 -0
  569. package/dist/node_modules/zod/v4/classic/compat.js +8 -0
  570. package/dist/node_modules/zod/v4/classic/compat.js.map +1 -0
  571. package/dist/node_modules/zod/v4/classic/errors.js +44 -0
  572. package/dist/node_modules/zod/v4/classic/errors.js.map +1 -0
  573. package/dist/node_modules/zod/v4/classic/iso.js +36 -0
  574. package/dist/node_modules/zod/v4/classic/iso.js.map +1 -0
  575. package/dist/node_modules/zod/v4/classic/parse.js +10 -0
  576. package/dist/node_modules/zod/v4/classic/parse.js.map +1 -0
  577. package/dist/node_modules/zod/v4/classic/schemas.js +674 -0
  578. package/dist/node_modules/zod/v4/classic/schemas.js.map +1 -0
  579. package/dist/node_modules/zod/v4/core/api.js +468 -0
  580. package/dist/node_modules/zod/v4/core/api.js.map +1 -0
  581. package/dist/node_modules/zod/v4/core/checks.js +413 -0
  582. package/dist/node_modules/zod/v4/core/checks.js.map +1 -0
  583. package/dist/node_modules/zod/v4/core/core.js +60 -0
  584. package/dist/node_modules/zod/v4/core/core.js.map +1 -0
  585. package/dist/node_modules/zod/v4/core/doc.js +38 -0
  586. package/dist/node_modules/zod/v4/core/doc.js.map +1 -0
  587. package/dist/node_modules/zod/v4/core/errors.js +86 -0
  588. package/dist/node_modules/zod/v4/core/errors.js.map +1 -0
  589. package/dist/node_modules/zod/v4/core/parse.js +59 -0
  590. package/dist/node_modules/zod/v4/core/parse.js.map +1 -0
  591. package/dist/node_modules/zod/v4/core/regexes.js +81 -0
  592. package/dist/node_modules/zod/v4/core/regexes.js.map +1 -0
  593. package/dist/node_modules/zod/v4/core/registries.js +52 -0
  594. package/dist/node_modules/zod/v4/core/registries.js.map +1 -0
  595. package/dist/node_modules/zod/v4/core/schemas.js +1328 -0
  596. package/dist/node_modules/zod/v4/core/schemas.js.map +1 -0
  597. package/dist/node_modules/zod/v4/core/util.js +335 -0
  598. package/dist/node_modules/zod/v4/core/util.js.map +1 -0
  599. package/dist/node_modules/zod/v4/core/versions.js +8 -0
  600. package/dist/node_modules/zod/v4/core/versions.js.map +1 -0
  601. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +2 -0
  602. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js.map +1 -0
  603. package/dist/oAuth.d.ts +3 -1
  604. package/dist/oAuth.d.ts.map +1 -1
  605. package/dist/oAuth.js +7 -1
  606. package/dist/oAuth.js.map +1 -1
  607. package/package.json +9 -9
  608. package/dist/_virtual/cache.js +0 -4
  609. package/dist/_virtual/cache.js.map +0 -1
  610. package/dist/_virtual/uri.all.js +0 -4
  611. package/dist/_virtual/uri.all.js.map +0 -1
  612. package/dist/atxpClient.d.ts +0 -12
  613. package/dist/atxpLocalAccount.d.ts +0 -50
  614. package/dist/clientTestHelpers.d.ts +0 -6
  615. package/dist/destinationMakers/atxpDestinationMaker.d.ts +0 -15
  616. package/dist/destinationMakers/index.d.ts +0 -9
  617. package/dist/destinationMakers/passthroughDestinationMaker.d.ts +0 -8
  618. package/dist/errors.d.ts +0 -117
  619. package/dist/node_modules/ajv/lib/ajv.js +0 -531
  620. package/dist/node_modules/ajv/lib/ajv.js.map +0 -1
  621. package/dist/node_modules/ajv/lib/cache.js +0 -37
  622. package/dist/node_modules/ajv/lib/cache.js.map +0 -1
  623. package/dist/node_modules/ajv/lib/compile/async.js +0 -102
  624. package/dist/node_modules/ajv/lib/compile/async.js.map +0 -1
  625. package/dist/node_modules/ajv/lib/compile/error_classes.js +0 -46
  626. package/dist/node_modules/ajv/lib/compile/error_classes.js.map +0 -1
  627. package/dist/node_modules/ajv/lib/compile/formats.js +0 -154
  628. package/dist/node_modules/ajv/lib/compile/formats.js.map +0 -1
  629. package/dist/node_modules/ajv/lib/compile/index.js +0 -404
  630. package/dist/node_modules/ajv/lib/compile/index.js.map +0 -1
  631. package/dist/node_modules/ajv/lib/compile/resolve.js +0 -286
  632. package/dist/node_modules/ajv/lib/compile/resolve.js.map +0 -1
  633. package/dist/node_modules/ajv/lib/compile/rules.js +0 -79
  634. package/dist/node_modules/ajv/lib/compile/rules.js.map +0 -1
  635. package/dist/node_modules/ajv/lib/compile/schema_obj.js +0 -21
  636. package/dist/node_modules/ajv/lib/compile/schema_obj.js.map +0 -1
  637. package/dist/node_modules/ajv/lib/compile/ucs2length.js +0 -30
  638. package/dist/node_modules/ajv/lib/compile/ucs2length.js.map +0 -1
  639. package/dist/node_modules/ajv/lib/compile/util.js +0 -252
  640. package/dist/node_modules/ajv/lib/compile/util.js.map +0 -1
  641. package/dist/node_modules/ajv/lib/data.js +0 -59
  642. package/dist/node_modules/ajv/lib/data.js.map +0 -1
  643. package/dist/node_modules/ajv/lib/definition_schema.js +0 -49
  644. package/dist/node_modules/ajv/lib/definition_schema.js.map +0 -1
  645. package/dist/node_modules/ajv/lib/dotjs/_limit.js +0 -173
  646. package/dist/node_modules/ajv/lib/dotjs/_limit.js.map +0 -1
  647. package/dist/node_modules/ajv/lib/dotjs/_limitItems.js +0 -90
  648. package/dist/node_modules/ajv/lib/dotjs/_limitItems.js.map +0 -1
  649. package/dist/node_modules/ajv/lib/dotjs/_limitLength.js +0 -95
  650. package/dist/node_modules/ajv/lib/dotjs/_limitLength.js.map +0 -1
  651. package/dist/node_modules/ajv/lib/dotjs/_limitProperties.js +0 -90
  652. package/dist/node_modules/ajv/lib/dotjs/_limitProperties.js.map +0 -1
  653. package/dist/node_modules/ajv/lib/dotjs/allOf.js +0 -52
  654. package/dist/node_modules/ajv/lib/dotjs/allOf.js.map +0 -1
  655. package/dist/node_modules/ajv/lib/dotjs/anyOf.js +0 -83
  656. package/dist/node_modules/ajv/lib/dotjs/anyOf.js.map +0 -1
  657. package/dist/node_modules/ajv/lib/dotjs/comment.js +0 -24
  658. package/dist/node_modules/ajv/lib/dotjs/comment.js.map +0 -1
  659. package/dist/node_modules/ajv/lib/dotjs/const.js +0 -62
  660. package/dist/node_modules/ajv/lib/dotjs/const.js.map +0 -1
  661. package/dist/node_modules/ajv/lib/dotjs/contains.js +0 -91
  662. package/dist/node_modules/ajv/lib/dotjs/contains.js.map +0 -1
  663. package/dist/node_modules/ajv/lib/dotjs/custom.js +0 -238
  664. package/dist/node_modules/ajv/lib/dotjs/custom.js.map +0 -1
  665. package/dist/node_modules/ajv/lib/dotjs/dependencies.js +0 -178
  666. package/dist/node_modules/ajv/lib/dotjs/dependencies.js.map +0 -1
  667. package/dist/node_modules/ajv/lib/dotjs/enum.js +0 -72
  668. package/dist/node_modules/ajv/lib/dotjs/enum.js.map +0 -1
  669. package/dist/node_modules/ajv/lib/dotjs/format.js +0 -160
  670. package/dist/node_modules/ajv/lib/dotjs/format.js.map +0 -1
  671. package/dist/node_modules/ajv/lib/dotjs/if.js +0 -113
  672. package/dist/node_modules/ajv/lib/dotjs/if.js.map +0 -1
  673. package/dist/node_modules/ajv/lib/dotjs/index.js +0 -68
  674. package/dist/node_modules/ajv/lib/dotjs/index.js.map +0 -1
  675. package/dist/node_modules/ajv/lib/dotjs/items.js +0 -150
  676. package/dist/node_modules/ajv/lib/dotjs/items.js.map +0 -1
  677. package/dist/node_modules/ajv/lib/dotjs/multipleOf.js +0 -90
  678. package/dist/node_modules/ajv/lib/dotjs/multipleOf.js.map +0 -1
  679. package/dist/node_modules/ajv/lib/dotjs/not.js +0 -94
  680. package/dist/node_modules/ajv/lib/dotjs/not.js.map +0 -1
  681. package/dist/node_modules/ajv/lib/dotjs/oneOf.js +0 -83
  682. package/dist/node_modules/ajv/lib/dotjs/oneOf.js.map +0 -1
  683. package/dist/node_modules/ajv/lib/dotjs/pattern.js +0 -85
  684. package/dist/node_modules/ajv/lib/dotjs/pattern.js.map +0 -1
  685. package/dist/node_modules/ajv/lib/dotjs/properties.js +0 -345
  686. package/dist/node_modules/ajv/lib/dotjs/properties.js.map +0 -1
  687. package/dist/node_modules/ajv/lib/dotjs/propertyNames.js +0 -91
  688. package/dist/node_modules/ajv/lib/dotjs/propertyNames.js.map +0 -1
  689. package/dist/node_modules/ajv/lib/dotjs/ref.js +0 -134
  690. package/dist/node_modules/ajv/lib/dotjs/ref.js.map +0 -1
  691. package/dist/node_modules/ajv/lib/dotjs/required.js +0 -276
  692. package/dist/node_modules/ajv/lib/dotjs/required.js.map +0 -1
  693. package/dist/node_modules/ajv/lib/dotjs/uniqueItems.js +0 -96
  694. package/dist/node_modules/ajv/lib/dotjs/uniqueItems.js.map +0 -1
  695. package/dist/node_modules/ajv/lib/dotjs/validate.js +0 -492
  696. package/dist/node_modules/ajv/lib/dotjs/validate.js.map +0 -1
  697. package/dist/node_modules/ajv/lib/keyword.js +0 -159
  698. package/dist/node_modules/ajv/lib/keyword.js.map +0 -1
  699. package/dist/node_modules/fast-json-stable-stringify/index.js +0 -69
  700. package/dist/node_modules/fast-json-stable-stringify/index.js.map +0 -1
  701. package/dist/node_modules/json-schema-traverse/index.js.map +0 -1
  702. package/dist/node_modules/uri-js/dist/es5/uri.all.js +0 -1418
  703. package/dist/node_modules/uri-js/dist/es5/uri.all.js.map +0 -1
  704. package/dist/node_modules/zod/v3/ZodError.js +0 -133
  705. package/dist/node_modules/zod/v3/ZodError.js.map +0 -1
  706. package/dist/node_modules/zod/v3/errors.js +0 -9
  707. package/dist/node_modules/zod/v3/errors.js.map +0 -1
  708. package/dist/node_modules/zod/v3/helpers/errorUtil.js +0 -9
  709. package/dist/node_modules/zod/v3/helpers/errorUtil.js.map +0 -1
  710. package/dist/node_modules/zod/v3/helpers/parseUtil.js +0 -112
  711. package/dist/node_modules/zod/v3/helpers/parseUtil.js.map +0 -1
  712. package/dist/node_modules/zod/v3/helpers/util.js +0 -136
  713. package/dist/node_modules/zod/v3/helpers/util.js.map +0 -1
  714. package/dist/node_modules/zod/v3/locales/en.js +0 -112
  715. package/dist/node_modules/zod/v3/locales/en.js.map +0 -1
  716. package/dist/node_modules/zod/v3/types.js +0 -3491
  717. package/dist/node_modules/zod/v3/types.js.map +0 -1
  718. package/dist/polygonConstants.d.ts +0 -53
  719. package/dist/setup.expo.d.ts +0 -2
  720. package/dist/types.d.ts +0 -75
  721. package/dist/worldConstants.d.ts +0 -53
  722. /package/dist/node_modules/{ajv/lib → @modelcontextprotocol/sdk/node_modules/ajv/dist}/refs/json-schema-draft-07.json.js.map +0 -0
@@ -1,14 +1,19 @@
1
1
  import pkceChallenge from '../../../../../pkce-challenge/dist/index.browser.js';
2
2
  import { LATEST_PROTOCOL_VERSION } from '../types.js';
3
- import { OAuthProtectedResourceMetadataSchema, OAuthMetadataSchema, OpenIdProviderDiscoveryMetadataSchema, OAuthClientInformationFullSchema, OAuthTokensSchema, OAuthErrorResponseSchema } from '../shared/auth.js';
3
+ import { OAuthProtectedResourceMetadataSchema, OAuthMetadataSchema, OpenIdProviderDiscoveryMetadataSchema, OAuthClientInformationFullSchema, OAuthErrorResponseSchema, OAuthTokensSchema } from '../shared/auth.js';
4
4
  import { resourceUrlFromServerUrl, checkResourceAllowed } from '../shared/auth-utils.js';
5
- import { InvalidClientError, UnauthorizedClientError, InvalidGrantError, OAuthError, ServerError, OAUTH_ERRORS } from '../server/auth/errors.js';
5
+ import { InvalidClientError, UnauthorizedClientError, InvalidGrantError, InvalidClientMetadataError, OAuthError, ServerError, OAUTH_ERRORS } from '../server/auth/errors.js';
6
6
 
7
7
  class UnauthorizedError extends Error {
8
8
  constructor(message) {
9
- super(message !== null && message !== void 0 ? message : "Unauthorized");
9
+ super(message ?? 'Unauthorized');
10
10
  }
11
11
  }
12
+ function isClientAuthMethod(method) {
13
+ return ['client_secret_basic', 'client_secret_post', 'none'].includes(method);
14
+ }
15
+ const AUTHORIZATION_CODE_RESPONSE_TYPE = 'code';
16
+ const AUTHORIZATION_CODE_CHALLENGE_METHOD = 'S256';
12
17
  /**
13
18
  * Determines the best client authentication method to use based on server support and client configuration.
14
19
  *
@@ -25,20 +30,27 @@ function selectClientAuthMethod(clientInformation, supportedMethods) {
25
30
  const hasClientSecret = clientInformation.client_secret !== undefined;
26
31
  // If server doesn't specify supported methods, use RFC 6749 defaults
27
32
  if (supportedMethods.length === 0) {
28
- return hasClientSecret ? "client_secret_post" : "none";
33
+ return hasClientSecret ? 'client_secret_post' : 'none';
34
+ }
35
+ // Prefer the method returned by the server during client registration if valid and supported
36
+ if ('token_endpoint_auth_method' in clientInformation &&
37
+ clientInformation.token_endpoint_auth_method &&
38
+ isClientAuthMethod(clientInformation.token_endpoint_auth_method) &&
39
+ supportedMethods.includes(clientInformation.token_endpoint_auth_method)) {
40
+ return clientInformation.token_endpoint_auth_method;
29
41
  }
30
42
  // Try methods in priority order (most secure first)
31
- if (hasClientSecret && supportedMethods.includes("client_secret_basic")) {
32
- return "client_secret_basic";
43
+ if (hasClientSecret && supportedMethods.includes('client_secret_basic')) {
44
+ return 'client_secret_basic';
33
45
  }
34
- if (hasClientSecret && supportedMethods.includes("client_secret_post")) {
35
- return "client_secret_post";
46
+ if (hasClientSecret && supportedMethods.includes('client_secret_post')) {
47
+ return 'client_secret_post';
36
48
  }
37
- if (supportedMethods.includes("none")) {
38
- return "none";
49
+ if (supportedMethods.includes('none')) {
50
+ return 'none';
39
51
  }
40
52
  // Fallback: use what we have
41
- return hasClientSecret ? "client_secret_post" : "none";
53
+ return hasClientSecret ? 'client_secret_post' : 'none';
42
54
  }
43
55
  /**
44
56
  * Applies client authentication to the request based on the specified method.
@@ -57,13 +69,13 @@ function selectClientAuthMethod(clientInformation, supportedMethods) {
57
69
  function applyClientAuthentication(method, clientInformation, headers, params) {
58
70
  const { client_id, client_secret } = clientInformation;
59
71
  switch (method) {
60
- case "client_secret_basic":
72
+ case 'client_secret_basic':
61
73
  applyBasicAuth(client_id, client_secret, headers);
62
74
  return;
63
- case "client_secret_post":
75
+ case 'client_secret_post':
64
76
  applyPostAuth(client_id, client_secret, params);
65
77
  return;
66
- case "none":
78
+ case 'none':
67
79
  applyPublicAuth(client_id, params);
68
80
  return;
69
81
  default:
@@ -75,25 +87,25 @@ function applyClientAuthentication(method, clientInformation, headers, params) {
75
87
  */
76
88
  function applyBasicAuth(clientId, clientSecret, headers) {
77
89
  if (!clientSecret) {
78
- throw new Error("client_secret_basic authentication requires a client_secret");
90
+ throw new Error('client_secret_basic authentication requires a client_secret');
79
91
  }
80
92
  const credentials = btoa(`${clientId}:${clientSecret}`);
81
- headers.set("Authorization", `Basic ${credentials}`);
93
+ headers.set('Authorization', `Basic ${credentials}`);
82
94
  }
83
95
  /**
84
96
  * Applies POST body authentication (RFC 6749 Section 2.3.1)
85
97
  */
86
98
  function applyPostAuth(clientId, clientSecret, params) {
87
- params.set("client_id", clientId);
99
+ params.set('client_id', clientId);
88
100
  if (clientSecret) {
89
- params.set("client_secret", clientSecret);
101
+ params.set('client_secret', clientSecret);
90
102
  }
91
103
  }
92
104
  /**
93
105
  * Applies public client authentication (RFC 6749 Section 2.1)
94
106
  */
95
107
  function applyPublicAuth(clientId, params) {
96
- params.set("client_id", clientId);
108
+ params.set('client_id', clientId);
97
109
  }
98
110
  /**
99
111
  * Parses an OAuth error response from a string or Response object.
@@ -128,25 +140,24 @@ async function parseErrorResponse(input) {
128
140
  * instead of linking together the other lower-level functions in this module.
129
141
  */
130
142
  async function auth(provider, options) {
131
- var _a, _b;
132
143
  try {
133
144
  return await authInternal(provider, options);
134
145
  }
135
146
  catch (error) {
136
147
  // Handle recoverable error types by invalidating credentials and retrying
137
148
  if (error instanceof InvalidClientError || error instanceof UnauthorizedClientError) {
138
- await ((_a = provider.invalidateCredentials) === null || _a === void 0 ? void 0 : _a.call(provider, 'all'));
149
+ await provider.invalidateCredentials?.('all');
139
150
  return await authInternal(provider, options);
140
151
  }
141
152
  else if (error instanceof InvalidGrantError) {
142
- await ((_b = provider.invalidateCredentials) === null || _b === void 0 ? void 0 : _b.call(provider, 'tokens'));
153
+ await provider.invalidateCredentials?.('tokens');
143
154
  return await authInternal(provider, options);
144
155
  }
145
156
  // Throw otherwise
146
157
  throw error;
147
158
  }
148
159
  }
149
- async function authInternal(provider, { serverUrl, authorizationCode, scope, resourceMetadataUrl, fetchFn, }) {
160
+ async function authInternal(provider, { serverUrl, authorizationCode, scope, resourceMetadataUrl, fetchFn }) {
150
161
  let resourceMetadata;
151
162
  let authorizationServerUrl;
152
163
  try {
@@ -155,56 +166,69 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
155
166
  authorizationServerUrl = resourceMetadata.authorization_servers[0];
156
167
  }
157
168
  }
158
- catch (_a) {
169
+ catch {
159
170
  // Ignore errors and fall back to /.well-known/oauth-authorization-server
160
171
  }
161
172
  /**
162
173
  * If we don't get a valid authorization server metadata from protected resource metadata,
163
- * fallback to the legacy MCP spec's implementation (version 2025-03-26): MCP server acts as the Authorization server.
174
+ * fallback to the legacy MCP spec's implementation (version 2025-03-26): MCP server base URL acts as the Authorization server.
164
175
  */
165
176
  if (!authorizationServerUrl) {
166
- authorizationServerUrl = serverUrl;
177
+ authorizationServerUrl = new URL('/', serverUrl);
167
178
  }
168
179
  const resource = await selectResourceURL(serverUrl, provider, resourceMetadata);
169
180
  const metadata = await discoverAuthorizationServerMetadata(authorizationServerUrl, {
170
- fetchFn,
181
+ fetchFn
171
182
  });
172
183
  // Handle client registration if needed
173
184
  let clientInformation = await Promise.resolve(provider.clientInformation());
174
185
  if (!clientInformation) {
175
186
  if (authorizationCode !== undefined) {
176
- throw new Error("Existing OAuth client information is required when exchanging an authorization code");
187
+ throw new Error('Existing OAuth client information is required when exchanging an authorization code');
177
188
  }
178
- if (!provider.saveClientInformation) {
179
- throw new Error("OAuth client information must be saveable for dynamic registration");
189
+ const supportsUrlBasedClientId = metadata?.client_id_metadata_document_supported === true;
190
+ const clientMetadataUrl = provider.clientMetadataUrl;
191
+ if (clientMetadataUrl && !isHttpsUrl(clientMetadataUrl)) {
192
+ throw new InvalidClientMetadataError(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${clientMetadataUrl}`);
193
+ }
194
+ const shouldUseUrlBasedClientId = supportsUrlBasedClientId && clientMetadataUrl;
195
+ if (shouldUseUrlBasedClientId) {
196
+ // SEP-991: URL-based Client IDs
197
+ clientInformation = {
198
+ client_id: clientMetadataUrl
199
+ };
200
+ await provider.saveClientInformation?.(clientInformation);
201
+ }
202
+ else {
203
+ // Fallback to dynamic registration
204
+ if (!provider.saveClientInformation) {
205
+ throw new Error('OAuth client information must be saveable for dynamic registration');
206
+ }
207
+ const fullInformation = await registerClient(authorizationServerUrl, {
208
+ metadata,
209
+ clientMetadata: provider.clientMetadata,
210
+ fetchFn
211
+ });
212
+ await provider.saveClientInformation(fullInformation);
213
+ clientInformation = fullInformation;
180
214
  }
181
- const fullInformation = await registerClient(authorizationServerUrl, {
182
- metadata,
183
- clientMetadata: provider.clientMetadata,
184
- fetchFn,
185
- });
186
- await provider.saveClientInformation(fullInformation);
187
- clientInformation = fullInformation;
188
215
  }
189
- // Exchange authorization code for tokens
190
- if (authorizationCode !== undefined) {
191
- const codeVerifier = await provider.codeVerifier();
192
- const tokens = await exchangeAuthorization(authorizationServerUrl, {
216
+ // Non-interactive flows (e.g., client_credentials, jwt-bearer) don't need a redirect URL
217
+ const nonInteractiveFlow = !provider.redirectUrl;
218
+ // Exchange authorization code for tokens, or fetch tokens directly for non-interactive flows
219
+ if (authorizationCode !== undefined || nonInteractiveFlow) {
220
+ const tokens = await fetchToken(provider, authorizationServerUrl, {
193
221
  metadata,
194
- clientInformation,
195
- authorizationCode,
196
- codeVerifier,
197
- redirectUri: provider.redirectUrl,
198
222
  resource,
199
- addClientAuthentication: provider.addClientAuthentication,
200
- fetchFn: fetchFn,
223
+ authorizationCode,
224
+ fetchFn
201
225
  });
202
226
  await provider.saveTokens(tokens);
203
- return "AUTHORIZED";
227
+ return 'AUTHORIZED';
204
228
  }
205
229
  const tokens = await provider.tokens();
206
230
  // Handle token refresh or new authorization
207
- if (tokens === null || tokens === void 0 ? void 0 : tokens.refresh_token) {
231
+ if (tokens?.refresh_token) {
208
232
  try {
209
233
  // Attempt to refresh the token
210
234
  const newTokens = await refreshAuthorization(authorizationServerUrl, {
@@ -213,10 +237,10 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
213
237
  refreshToken: tokens.refresh_token,
214
238
  resource,
215
239
  addClientAuthentication: provider.addClientAuthentication,
216
- fetchFn,
240
+ fetchFn
217
241
  });
218
242
  await provider.saveTokens(newTokens);
219
- return "AUTHORIZED";
243
+ return 'AUTHORIZED';
220
244
  }
221
245
  catch (error) {
222
246
  // If this is a ServerError, or an unknown type, log it out and try to continue. Otherwise, escalate so we can fix things and retry.
@@ -234,18 +258,33 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
234
258
  clientInformation,
235
259
  state,
236
260
  redirectUrl: provider.redirectUrl,
237
- scope: scope || provider.clientMetadata.scope,
238
- resource,
261
+ scope: scope || resourceMetadata?.scopes_supported?.join(' ') || provider.clientMetadata.scope,
262
+ resource
239
263
  });
240
264
  await provider.saveCodeVerifier(codeVerifier);
241
265
  await provider.redirectToAuthorization(authorizationUrl);
242
- return "REDIRECT";
266
+ return 'REDIRECT';
267
+ }
268
+ /**
269
+ * SEP-991: URL-based Client IDs
270
+ * Validate that the client_id is a valid URL with https scheme
271
+ */
272
+ function isHttpsUrl(value) {
273
+ if (!value)
274
+ return false;
275
+ try {
276
+ const url = new URL(value);
277
+ return url.protocol === 'https:' && url.pathname !== '/';
278
+ }
279
+ catch {
280
+ return false;
281
+ }
243
282
  }
244
283
  async function selectResourceURL(serverUrl, provider, resourceMetadata) {
245
284
  const defaultResource = resourceUrlFromServerUrl(serverUrl);
246
285
  // If provider has custom validation, delegate to it
247
286
  if (provider.validateResourceURL) {
248
- return await provider.validateResourceURL(defaultResource, resourceMetadata === null || resourceMetadata === void 0 ? void 0 : resourceMetadata.resource);
287
+ return await provider.validateResourceURL(defaultResource, resourceMetadata?.resource);
249
288
  }
250
289
  // Only include resource parameter when Protected Resource Metadata is present
251
290
  if (!resourceMetadata) {
@@ -259,28 +298,54 @@ async function selectResourceURL(serverUrl, provider, resourceMetadata) {
259
298
  return new URL(resourceMetadata.resource);
260
299
  }
261
300
  /**
262
- * Extract resource_metadata from response header.
301
+ * Extract resource_metadata, scope, and error from WWW-Authenticate header.
263
302
  */
264
- function extractResourceMetadataUrl(res) {
265
- const authenticateHeader = res.headers.get("WWW-Authenticate");
303
+ function extractWWWAuthenticateParams(res) {
304
+ const authenticateHeader = res.headers.get('WWW-Authenticate');
266
305
  if (!authenticateHeader) {
267
- return undefined;
306
+ return {};
268
307
  }
269
308
  const [type, scheme] = authenticateHeader.split(' ');
270
309
  if (type.toLowerCase() !== 'bearer' || !scheme) {
271
- return undefined;
310
+ return {};
272
311
  }
273
- const regex = /resource_metadata="([^"]*)"/;
274
- const match = regex.exec(authenticateHeader);
275
- if (!match) {
276
- return undefined;
277
- }
278
- try {
279
- return new URL(match[1]);
280
- }
281
- catch (_a) {
282
- return undefined;
312
+ const resourceMetadataMatch = extractFieldFromWwwAuth(res, 'resource_metadata') || undefined;
313
+ let resourceMetadataUrl;
314
+ if (resourceMetadataMatch) {
315
+ try {
316
+ resourceMetadataUrl = new URL(resourceMetadataMatch);
317
+ }
318
+ catch {
319
+ // Ignore invalid URL
320
+ }
283
321
  }
322
+ const scope = extractFieldFromWwwAuth(res, 'scope') || undefined;
323
+ const error = extractFieldFromWwwAuth(res, 'error') || undefined;
324
+ return {
325
+ resourceMetadataUrl,
326
+ scope,
327
+ error
328
+ };
329
+ }
330
+ /**
331
+ * Extracts a specific field's value from the WWW-Authenticate header string.
332
+ *
333
+ * @param response The HTTP response object containing the headers.
334
+ * @param fieldName The name of the field to extract (e.g., "realm", "nonce").
335
+ * @returns The field value
336
+ */
337
+ function extractFieldFromWwwAuth(response, fieldName) {
338
+ const wwwAuthHeader = response.headers.get('WWW-Authenticate');
339
+ if (!wwwAuthHeader) {
340
+ return null;
341
+ }
342
+ const pattern = new RegExp(`${fieldName}=(?:"([^"]+)"|([^\\s,]+))`);
343
+ const match = wwwAuthHeader.match(pattern);
344
+ if (match) {
345
+ // Pattern matches: field_name="value" or field_name=value (unquoted)
346
+ return match[1] || match[2];
347
+ }
348
+ return null;
284
349
  }
285
350
  /**
286
351
  * Looks up RFC 9728 OAuth 2.0 Protected Resource Metadata.
@@ -290,13 +355,15 @@ function extractResourceMetadataUrl(res) {
290
355
  */
291
356
  async function discoverOAuthProtectedResourceMetadata(serverUrl, opts, fetchFn = fetch) {
292
357
  const response = await discoverMetadataWithFallback(serverUrl, 'oauth-protected-resource', fetchFn, {
293
- protocolVersion: opts === null || opts === void 0 ? void 0 : opts.protocolVersion,
294
- metadataUrl: opts === null || opts === void 0 ? void 0 : opts.resourceMetadataUrl,
358
+ protocolVersion: opts?.protocolVersion,
359
+ metadataUrl: opts?.resourceMetadataUrl
295
360
  });
296
361
  if (!response || response.status === 404) {
362
+ await response?.body?.cancel();
297
363
  throw new Error(`Resource server does not implement OAuth 2.0 Protected Resource Metadata.`);
298
364
  }
299
365
  if (!response.ok) {
366
+ await response.body?.cancel();
300
367
  throw new Error(`HTTP ${response.status} trying to load well-known OAuth protected resource metadata.`);
301
368
  }
302
369
  return OAuthProtectedResourceMetadataSchema.parse(await response.json());
@@ -330,16 +397,14 @@ function buildWellKnownPath(wellKnownPrefix, pathname = '', options = {}) {
330
397
  if (pathname.endsWith('/')) {
331
398
  pathname = pathname.slice(0, -1);
332
399
  }
333
- return options.prependPathname
334
- ? `${pathname}/.well-known/${wellKnownPrefix}`
335
- : `/.well-known/${wellKnownPrefix}${pathname}`;
400
+ return options.prependPathname ? `${pathname}/.well-known/${wellKnownPrefix}` : `/.well-known/${wellKnownPrefix}${pathname}`;
336
401
  }
337
402
  /**
338
403
  * Tries to discover OAuth metadata at a specific URL
339
404
  */
340
405
  async function tryMetadataDiscovery(url, protocolVersion, fetchFn = fetch) {
341
406
  const headers = {
342
- "MCP-Protocol-Version": protocolVersion
407
+ 'MCP-Protocol-Version': protocolVersion
343
408
  };
344
409
  return await fetchWithCorsRetry(url, headers, fetchFn);
345
410
  }
@@ -347,28 +412,27 @@ async function tryMetadataDiscovery(url, protocolVersion, fetchFn = fetch) {
347
412
  * Determines if fallback to root discovery should be attempted
348
413
  */
349
414
  function shouldAttemptFallback(response, pathname) {
350
- return !response || (response.status >= 400 && response.status < 500) && pathname !== '/';
415
+ return !response || (response.status >= 400 && response.status < 500 && pathname !== '/');
351
416
  }
352
417
  /**
353
418
  * Generic function for discovering OAuth metadata with fallback support
354
419
  */
355
420
  async function discoverMetadataWithFallback(serverUrl, wellKnownType, fetchFn, opts) {
356
- var _a, _b;
357
421
  const issuer = new URL(serverUrl);
358
- const protocolVersion = (_a = opts === null || opts === void 0 ? void 0 : opts.protocolVersion) !== null && _a !== void 0 ? _a : LATEST_PROTOCOL_VERSION;
422
+ const protocolVersion = opts?.protocolVersion ?? LATEST_PROTOCOL_VERSION;
359
423
  let url;
360
- if (opts === null || opts === void 0 ? void 0 : opts.metadataUrl) {
424
+ if (opts?.metadataUrl) {
361
425
  url = new URL(opts.metadataUrl);
362
426
  }
363
427
  else {
364
428
  // Try path-aware discovery first
365
429
  const wellKnownPath = buildWellKnownPath(wellKnownType, issuer.pathname);
366
- url = new URL(wellKnownPath, (_b = opts === null || opts === void 0 ? void 0 : opts.metadataServerUrl) !== null && _b !== void 0 ? _b : issuer);
430
+ url = new URL(wellKnownPath, opts?.metadataServerUrl ?? issuer);
367
431
  url.search = issuer.search;
368
432
  }
369
433
  let response = await tryMetadataDiscovery(url, protocolVersion, fetchFn);
370
434
  // If path-aware discovery fails with 404 and we're not already at root, try fallback to root discovery
371
- if (!(opts === null || opts === void 0 ? void 0 : opts.metadataUrl) && shouldAttemptFallback(response, issuer.pathname)) {
435
+ if (!opts?.metadataUrl && shouldAttemptFallback(response, issuer.pathname)) {
372
436
  const rootUrl = new URL(`/.well-known/${wellKnownType}`, issuer);
373
437
  response = await tryMetadataDiscovery(rootUrl, protocolVersion, fetchFn);
374
438
  }
@@ -378,8 +442,7 @@ async function discoverMetadataWithFallback(serverUrl, wellKnownType, fetchFn, o
378
442
  * Builds a list of discovery URLs to try for authorization server metadata.
379
443
  * URLs are returned in priority order:
380
444
  * 1. OAuth metadata at the given URL
381
- * 2. OAuth metadata at root (if URL has path)
382
- * 3. OIDC metadata endpoints
445
+ * 2. OIDC metadata endpoints at the given URL
383
446
  */
384
447
  function buildDiscoveryUrls(authorizationServerUrl) {
385
448
  const url = typeof authorizationServerUrl === 'string' ? new URL(authorizationServerUrl) : authorizationServerUrl;
@@ -409,12 +472,7 @@ function buildDiscoveryUrls(authorizationServerUrl) {
409
472
  url: new URL(`/.well-known/oauth-authorization-server${pathname}`, url.origin),
410
473
  type: 'oauth'
411
474
  });
412
- // Root path: https://example.com/.well-known/oauth-authorization-server
413
- urlsToTry.push({
414
- url: new URL('/.well-known/oauth-authorization-server', url.origin),
415
- type: 'oauth'
416
- });
417
- // 3. OIDC metadata endpoints
475
+ // 2. OIDC metadata endpoints
418
476
  // RFC 8414 style: Insert /.well-known/openid-configuration before the path
419
477
  urlsToTry.push({
420
478
  url: new URL(`/.well-known/openid-configuration${pathname}`, url.origin),
@@ -443,9 +501,11 @@ function buildDiscoveryUrls(authorizationServerUrl) {
443
501
  * @param options.protocolVersion - MCP protocol version to use, defaults to LATEST_PROTOCOL_VERSION
444
502
  * @returns Promise resolving to authorization server metadata, or undefined if discovery fails
445
503
  */
446
- async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fetchFn = fetch, protocolVersion = LATEST_PROTOCOL_VERSION, } = {}) {
447
- var _a;
448
- const headers = { 'MCP-Protocol-Version': protocolVersion };
504
+ async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fetchFn = fetch, protocolVersion = LATEST_PROTOCOL_VERSION } = {}) {
505
+ const headers = {
506
+ 'MCP-Protocol-Version': protocolVersion,
507
+ Accept: 'application/json'
508
+ };
449
509
  // Get the list of URLs to try
450
510
  const urlsToTry = buildDiscoveryUrls(authorizationServerUrl);
451
511
  // Try each URL in order
@@ -459,6 +519,7 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fet
459
519
  continue;
460
520
  }
461
521
  if (!response.ok) {
522
+ await response.body?.cancel();
462
523
  // Continue looking for any 4xx response code.
463
524
  if (response.status >= 400 && response.status < 500) {
464
525
  continue; // Try next URL
@@ -470,12 +531,7 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fet
470
531
  return OAuthMetadataSchema.parse(await response.json());
471
532
  }
472
533
  else {
473
- const metadata = OpenIdProviderDiscoveryMetadataSchema.parse(await response.json());
474
- // MCP spec requires OIDC providers to support S256 PKCE
475
- if (!((_a = metadata.code_challenge_methods_supported) === null || _a === void 0 ? void 0 : _a.includes('S256'))) {
476
- throw new Error(`Incompatible OIDC provider at ${endpointUrl}: does not support S256 code challenge method required by MCP specification`);
477
- }
478
- return metadata;
534
+ return OpenIdProviderDiscoveryMetadataSchema.parse(await response.json());
479
535
  }
480
536
  }
481
537
  return undefined;
@@ -483,98 +539,91 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fet
483
539
  /**
484
540
  * Begins the authorization flow with the given server, by generating a PKCE challenge and constructing the authorization URL.
485
541
  */
486
- async function startAuthorization(authorizationServerUrl, { metadata, clientInformation, redirectUrl, scope, state, resource, }) {
487
- const responseType = "code";
488
- const codeChallengeMethod = "S256";
542
+ async function startAuthorization(authorizationServerUrl, { metadata, clientInformation, redirectUrl, scope, state, resource }) {
489
543
  let authorizationUrl;
490
544
  if (metadata) {
491
545
  authorizationUrl = new URL(metadata.authorization_endpoint);
492
- if (!metadata.response_types_supported.includes(responseType)) {
493
- throw new Error(`Incompatible auth server: does not support response type ${responseType}`);
546
+ if (!metadata.response_types_supported.includes(AUTHORIZATION_CODE_RESPONSE_TYPE)) {
547
+ throw new Error(`Incompatible auth server: does not support response type ${AUTHORIZATION_CODE_RESPONSE_TYPE}`);
494
548
  }
495
- if (!metadata.code_challenge_methods_supported ||
496
- !metadata.code_challenge_methods_supported.includes(codeChallengeMethod)) {
497
- throw new Error(`Incompatible auth server: does not support code challenge method ${codeChallengeMethod}`);
549
+ if (metadata.code_challenge_methods_supported &&
550
+ !metadata.code_challenge_methods_supported.includes(AUTHORIZATION_CODE_CHALLENGE_METHOD)) {
551
+ throw new Error(`Incompatible auth server: does not support code challenge method ${AUTHORIZATION_CODE_CHALLENGE_METHOD}`);
498
552
  }
499
553
  }
500
554
  else {
501
- authorizationUrl = new URL("/authorize", authorizationServerUrl);
555
+ authorizationUrl = new URL('/authorize', authorizationServerUrl);
502
556
  }
503
557
  // Generate PKCE challenge
504
558
  const challenge = await pkceChallenge();
505
559
  const codeVerifier = challenge.code_verifier;
506
560
  const codeChallenge = challenge.code_challenge;
507
- authorizationUrl.searchParams.set("response_type", responseType);
508
- authorizationUrl.searchParams.set("client_id", clientInformation.client_id);
509
- authorizationUrl.searchParams.set("code_challenge", codeChallenge);
510
- authorizationUrl.searchParams.set("code_challenge_method", codeChallengeMethod);
511
- authorizationUrl.searchParams.set("redirect_uri", String(redirectUrl));
561
+ authorizationUrl.searchParams.set('response_type', AUTHORIZATION_CODE_RESPONSE_TYPE);
562
+ authorizationUrl.searchParams.set('client_id', clientInformation.client_id);
563
+ authorizationUrl.searchParams.set('code_challenge', codeChallenge);
564
+ authorizationUrl.searchParams.set('code_challenge_method', AUTHORIZATION_CODE_CHALLENGE_METHOD);
565
+ authorizationUrl.searchParams.set('redirect_uri', String(redirectUrl));
512
566
  if (state) {
513
- authorizationUrl.searchParams.set("state", state);
567
+ authorizationUrl.searchParams.set('state', state);
514
568
  }
515
569
  if (scope) {
516
- authorizationUrl.searchParams.set("scope", scope);
570
+ authorizationUrl.searchParams.set('scope', scope);
517
571
  }
518
- if (scope === null || scope === void 0 ? void 0 : scope.includes("offline_access")) {
572
+ if (scope?.includes('offline_access')) {
519
573
  // if the request includes the OIDC-only "offline_access" scope,
520
574
  // we need to set the prompt to "consent" to ensure the user is prompted to grant offline access
521
575
  // https://openid.net/specs/openid-connect-core-1_0.html#OfflineAccess
522
- authorizationUrl.searchParams.append("prompt", "consent");
576
+ authorizationUrl.searchParams.append('prompt', 'consent');
523
577
  }
524
578
  if (resource) {
525
- authorizationUrl.searchParams.set("resource", resource.href);
579
+ authorizationUrl.searchParams.set('resource', resource.href);
526
580
  }
527
581
  return { authorizationUrl, codeVerifier };
528
582
  }
529
583
  /**
530
- * Exchanges an authorization code for an access token with the given server.
584
+ * Prepares token request parameters for an authorization code exchange.
531
585
  *
532
- * Supports multiple client authentication methods as specified in OAuth 2.1:
533
- * - Automatically selects the best authentication method based on server support
534
- * - Falls back to appropriate defaults when server metadata is unavailable
586
+ * This is the default implementation used by fetchToken when the provider
587
+ * doesn't implement prepareTokenRequest.
535
588
  *
536
- * @param authorizationServerUrl - The authorization server's base URL
537
- * @param options - Configuration object containing client info, auth code, etc.
538
- * @returns Promise resolving to OAuth tokens
539
- * @throws {Error} When token exchange fails or authentication is invalid
589
+ * @param authorizationCode - The authorization code received from the authorization endpoint
590
+ * @param codeVerifier - The PKCE code verifier
591
+ * @param redirectUri - The redirect URI used in the authorization request
592
+ * @returns URLSearchParams for the authorization_code grant
540
593
  */
541
- async function exchangeAuthorization(authorizationServerUrl, { metadata, clientInformation, authorizationCode, codeVerifier, redirectUri, resource, addClientAuthentication, fetchFn, }) {
542
- var _a;
543
- const grantType = "authorization_code";
544
- const tokenUrl = (metadata === null || metadata === void 0 ? void 0 : metadata.token_endpoint)
545
- ? new URL(metadata.token_endpoint)
546
- : new URL("/token", authorizationServerUrl);
547
- if ((metadata === null || metadata === void 0 ? void 0 : metadata.grant_types_supported) &&
548
- !metadata.grant_types_supported.includes(grantType)) {
549
- throw new Error(`Incompatible auth server: does not support grant type ${grantType}`);
550
- }
551
- // Exchange code for tokens
552
- const headers = new Headers({
553
- "Content-Type": "application/x-www-form-urlencoded",
554
- "Accept": "application/json",
555
- });
556
- const params = new URLSearchParams({
557
- grant_type: grantType,
594
+ function prepareAuthorizationCodeRequest(authorizationCode, codeVerifier, redirectUri) {
595
+ return new URLSearchParams({
596
+ grant_type: 'authorization_code',
558
597
  code: authorizationCode,
559
598
  code_verifier: codeVerifier,
560
- redirect_uri: String(redirectUri),
599
+ redirect_uri: String(redirectUri)
600
+ });
601
+ }
602
+ /**
603
+ * Internal helper to execute a token request with the given parameters.
604
+ * Used by exchangeAuthorization, refreshAuthorization, and fetchToken.
605
+ */
606
+ async function executeTokenRequest(authorizationServerUrl, { metadata, tokenRequestParams, clientInformation, addClientAuthentication, resource, fetchFn }) {
607
+ const tokenUrl = metadata?.token_endpoint ? new URL(metadata.token_endpoint) : new URL('/token', authorizationServerUrl);
608
+ const headers = new Headers({
609
+ 'Content-Type': 'application/x-www-form-urlencoded',
610
+ Accept: 'application/json'
561
611
  });
612
+ if (resource) {
613
+ tokenRequestParams.set('resource', resource.href);
614
+ }
562
615
  if (addClientAuthentication) {
563
- addClientAuthentication(headers, params, authorizationServerUrl, metadata);
616
+ await addClientAuthentication(headers, tokenRequestParams, tokenUrl, metadata);
564
617
  }
565
- else {
566
- // Determine and apply client authentication method
567
- const supportedMethods = (_a = metadata === null || metadata === void 0 ? void 0 : metadata.token_endpoint_auth_methods_supported) !== null && _a !== void 0 ? _a : [];
618
+ else if (clientInformation) {
619
+ const supportedMethods = metadata?.token_endpoint_auth_methods_supported ?? [];
568
620
  const authMethod = selectClientAuthMethod(clientInformation, supportedMethods);
569
- applyClientAuthentication(authMethod, clientInformation, headers, params);
570
- }
571
- if (resource) {
572
- params.set("resource", resource.href);
621
+ applyClientAuthentication(authMethod, clientInformation, headers, tokenRequestParams);
573
622
  }
574
- const response = await (fetchFn !== null && fetchFn !== void 0 ? fetchFn : fetch)(tokenUrl, {
575
- method: "POST",
623
+ const response = await (fetchFn ?? fetch)(tokenUrl, {
624
+ method: 'POST',
576
625
  headers,
577
- body: params,
626
+ body: tokenRequestParams
578
627
  });
579
628
  if (!response.ok) {
580
629
  throw await parseErrorResponse(response);
@@ -593,70 +642,96 @@ async function exchangeAuthorization(authorizationServerUrl, { metadata, clientI
593
642
  * @returns Promise resolving to OAuth tokens (preserves original refresh_token if not replaced)
594
643
  * @throws {Error} When token refresh fails or authentication is invalid
595
644
  */
596
- async function refreshAuthorization(authorizationServerUrl, { metadata, clientInformation, refreshToken, resource, addClientAuthentication, fetchFn, }) {
597
- var _a;
598
- const grantType = "refresh_token";
599
- let tokenUrl;
600
- if (metadata) {
601
- tokenUrl = new URL(metadata.token_endpoint);
602
- if (metadata.grant_types_supported &&
603
- !metadata.grant_types_supported.includes(grantType)) {
604
- throw new Error(`Incompatible auth server: does not support grant type ${grantType}`);
605
- }
606
- }
607
- else {
608
- tokenUrl = new URL("/token", authorizationServerUrl);
609
- }
610
- // Exchange refresh token
611
- const headers = new Headers({
612
- "Content-Type": "application/x-www-form-urlencoded",
645
+ async function refreshAuthorization(authorizationServerUrl, { metadata, clientInformation, refreshToken, resource, addClientAuthentication, fetchFn }) {
646
+ const tokenRequestParams = new URLSearchParams({
647
+ grant_type: 'refresh_token',
648
+ refresh_token: refreshToken
613
649
  });
614
- const params = new URLSearchParams({
615
- grant_type: grantType,
616
- refresh_token: refreshToken,
650
+ const tokens = await executeTokenRequest(authorizationServerUrl, {
651
+ metadata,
652
+ tokenRequestParams,
653
+ clientInformation,
654
+ addClientAuthentication,
655
+ resource,
656
+ fetchFn
617
657
  });
618
- if (addClientAuthentication) {
619
- addClientAuthentication(headers, params, authorizationServerUrl, metadata);
620
- }
621
- else {
622
- // Determine and apply client authentication method
623
- const supportedMethods = (_a = metadata === null || metadata === void 0 ? void 0 : metadata.token_endpoint_auth_methods_supported) !== null && _a !== void 0 ? _a : [];
624
- const authMethod = selectClientAuthMethod(clientInformation, supportedMethods);
625
- applyClientAuthentication(authMethod, clientInformation, headers, params);
626
- }
627
- if (resource) {
628
- params.set("resource", resource.href);
658
+ // Preserve original refresh token if server didn't return a new one
659
+ return { refresh_token: refreshToken, ...tokens };
660
+ }
661
+ /**
662
+ * Unified token fetching that works with any grant type via provider.prepareTokenRequest().
663
+ *
664
+ * This function provides a single entry point for obtaining tokens regardless of the
665
+ * OAuth grant type. The provider's prepareTokenRequest() method determines which grant
666
+ * to use and supplies the grant-specific parameters.
667
+ *
668
+ * @param provider - OAuth client provider that implements prepareTokenRequest()
669
+ * @param authorizationServerUrl - The authorization server's base URL
670
+ * @param options - Configuration for the token request
671
+ * @returns Promise resolving to OAuth tokens
672
+ * @throws {Error} When provider doesn't implement prepareTokenRequest or token fetch fails
673
+ *
674
+ * @example
675
+ * // Provider for client_credentials:
676
+ * class MyProvider implements OAuthClientProvider {
677
+ * prepareTokenRequest(scope) {
678
+ * const params = new URLSearchParams({ grant_type: 'client_credentials' });
679
+ * if (scope) params.set('scope', scope);
680
+ * return params;
681
+ * }
682
+ * // ... other methods
683
+ * }
684
+ *
685
+ * const tokens = await fetchToken(provider, authServerUrl, { metadata });
686
+ */
687
+ async function fetchToken(provider, authorizationServerUrl, { metadata, resource, authorizationCode, fetchFn } = {}) {
688
+ const scope = provider.clientMetadata.scope;
689
+ // Use provider's prepareTokenRequest if available, otherwise fall back to authorization_code
690
+ let tokenRequestParams;
691
+ if (provider.prepareTokenRequest) {
692
+ tokenRequestParams = await provider.prepareTokenRequest(scope);
693
+ }
694
+ // Default to authorization_code grant if no custom prepareTokenRequest
695
+ if (!tokenRequestParams) {
696
+ if (!authorizationCode) {
697
+ throw new Error('Either provider.prepareTokenRequest() or authorizationCode is required');
698
+ }
699
+ if (!provider.redirectUrl) {
700
+ throw new Error('redirectUrl is required for authorization_code flow');
701
+ }
702
+ const codeVerifier = await provider.codeVerifier();
703
+ tokenRequestParams = prepareAuthorizationCodeRequest(authorizationCode, codeVerifier, provider.redirectUrl);
629
704
  }
630
- const response = await (fetchFn !== null && fetchFn !== void 0 ? fetchFn : fetch)(tokenUrl, {
631
- method: "POST",
632
- headers,
633
- body: params,
705
+ const clientInformation = await provider.clientInformation();
706
+ return executeTokenRequest(authorizationServerUrl, {
707
+ metadata,
708
+ tokenRequestParams,
709
+ clientInformation: clientInformation ?? undefined,
710
+ addClientAuthentication: provider.addClientAuthentication,
711
+ resource,
712
+ fetchFn
634
713
  });
635
- if (!response.ok) {
636
- throw await parseErrorResponse(response);
637
- }
638
- return OAuthTokensSchema.parse({ refresh_token: refreshToken, ...(await response.json()) });
639
714
  }
640
715
  /**
641
716
  * Performs OAuth 2.0 Dynamic Client Registration according to RFC 7591.
642
717
  */
643
- async function registerClient(authorizationServerUrl, { metadata, clientMetadata, fetchFn, }) {
718
+ async function registerClient(authorizationServerUrl, { metadata, clientMetadata, fetchFn }) {
644
719
  let registrationUrl;
645
720
  if (metadata) {
646
721
  if (!metadata.registration_endpoint) {
647
- throw new Error("Incompatible auth server: does not support dynamic client registration");
722
+ throw new Error('Incompatible auth server: does not support dynamic client registration');
648
723
  }
649
724
  registrationUrl = new URL(metadata.registration_endpoint);
650
725
  }
651
726
  else {
652
- registrationUrl = new URL("/register", authorizationServerUrl);
727
+ registrationUrl = new URL('/register', authorizationServerUrl);
653
728
  }
654
- const response = await (fetchFn !== null && fetchFn !== void 0 ? fetchFn : fetch)(registrationUrl, {
655
- method: "POST",
729
+ const response = await (fetchFn ?? fetch)(registrationUrl, {
730
+ method: 'POST',
656
731
  headers: {
657
- "Content-Type": "application/json",
732
+ 'Content-Type': 'application/json'
658
733
  },
659
- body: JSON.stringify(clientMetadata),
734
+ body: JSON.stringify(clientMetadata)
660
735
  });
661
736
  if (!response.ok) {
662
737
  throw await parseErrorResponse(response);
@@ -664,5 +739,5 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
664
739
  return OAuthClientInformationFullSchema.parse(await response.json());
665
740
  }
666
741
 
667
- export { UnauthorizedError, auth, buildDiscoveryUrls, discoverAuthorizationServerMetadata, discoverOAuthProtectedResourceMetadata, exchangeAuthorization, extractResourceMetadataUrl, parseErrorResponse, refreshAuthorization, registerClient, selectResourceURL, startAuthorization };
742
+ export { UnauthorizedError, auth, buildDiscoveryUrls, discoverAuthorizationServerMetadata, discoverOAuthProtectedResourceMetadata, extractWWWAuthenticateParams, fetchToken, isHttpsUrl, parseErrorResponse, prepareAuthorizationCodeRequest, refreshAuthorization, registerClient, selectClientAuthMethod, selectResourceURL, startAuthorization };
668
743
  //# sourceMappingURL=auth.js.map