@eui/mcp 1.5.1 → 1.5.2

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 (481) hide show
  1. package/dist/main.js +540 -209
  2. package/package.json +3 -2
  3. package/dist/config/__tests__/schema.property.test.d.ts +0 -2
  4. package/dist/config/__tests__/schema.property.test.d.ts.map +0 -1
  5. package/dist/config/__tests__/schema.property.test.js +0 -203
  6. package/dist/config/__tests__/schema.property.test.js.map +0 -1
  7. package/dist/config/__tests__/schema.test.d.ts +0 -2
  8. package/dist/config/__tests__/schema.test.d.ts.map +0 -1
  9. package/dist/config/__tests__/schema.test.js +0 -454
  10. package/dist/config/__tests__/schema.test.js.map +0 -1
  11. package/dist/config/index.d.ts +0 -6
  12. package/dist/config/index.d.ts.map +0 -1
  13. package/dist/config/index.js +0 -6
  14. package/dist/config/index.js.map +0 -1
  15. package/dist/config/loader.d.ts +0 -27
  16. package/dist/config/loader.d.ts.map +0 -1
  17. package/dist/config/loader.js +0 -224
  18. package/dist/config/loader.js.map +0 -1
  19. package/dist/config/schema.d.ts +0 -171
  20. package/dist/config/schema.d.ts.map +0 -1
  21. package/dist/config/schema.js +0 -100
  22. package/dist/config/schema.js.map +0 -1
  23. package/dist/index.d.ts +0 -3
  24. package/dist/index.d.ts.map +0 -1
  25. package/dist/index.js +0 -27
  26. package/dist/index.js.map +0 -1
  27. package/dist/loader/__tests__/cache-manager.property.test.d.ts +0 -2
  28. package/dist/loader/__tests__/cache-manager.property.test.d.ts.map +0 -1
  29. package/dist/loader/__tests__/cache-manager.property.test.js +0 -245
  30. package/dist/loader/__tests__/cache-manager.property.test.js.map +0 -1
  31. package/dist/loader/__tests__/cache-manager.test.d.ts +0 -2
  32. package/dist/loader/__tests__/cache-manager.test.d.ts.map +0 -1
  33. package/dist/loader/__tests__/cache-manager.test.js +0 -256
  34. package/dist/loader/__tests__/cache-manager.test.js.map +0 -1
  35. package/dist/loader/__tests__/documentation-loader.integration.test.d.ts +0 -2
  36. package/dist/loader/__tests__/documentation-loader.integration.test.d.ts.map +0 -1
  37. package/dist/loader/__tests__/documentation-loader.integration.test.js +0 -498
  38. package/dist/loader/__tests__/documentation-loader.integration.test.js.map +0 -1
  39. package/dist/loader/__tests__/documentation-loader.property.test.d.ts +0 -2
  40. package/dist/loader/__tests__/documentation-loader.property.test.d.ts.map +0 -1
  41. package/dist/loader/__tests__/documentation-loader.property.test.js +0 -258
  42. package/dist/loader/__tests__/documentation-loader.property.test.js.map +0 -1
  43. package/dist/loader/__tests__/errors.test.d.ts +0 -2
  44. package/dist/loader/__tests__/errors.test.d.ts.map +0 -1
  45. package/dist/loader/__tests__/errors.test.js +0 -132
  46. package/dist/loader/__tests__/errors.test.js.map +0 -1
  47. package/dist/loader/__tests__/http-client.property.test.d.ts +0 -2
  48. package/dist/loader/__tests__/http-client.property.test.d.ts.map +0 -1
  49. package/dist/loader/__tests__/http-client.property.test.js +0 -288
  50. package/dist/loader/__tests__/http-client.property.test.js.map +0 -1
  51. package/dist/loader/__tests__/http-client.test.d.ts +0 -2
  52. package/dist/loader/__tests__/http-client.test.d.ts.map +0 -1
  53. package/dist/loader/__tests__/http-client.test.js +0 -497
  54. package/dist/loader/__tests__/http-client.test.js.map +0 -1
  55. package/dist/loader/__tests__/local-documentation-source.property.test.d.ts +0 -2
  56. package/dist/loader/__tests__/local-documentation-source.property.test.d.ts.map +0 -1
  57. package/dist/loader/__tests__/local-documentation-source.property.test.js +0 -373
  58. package/dist/loader/__tests__/local-documentation-source.property.test.js.map +0 -1
  59. package/dist/loader/__tests__/local-documentation-source.test.d.ts +0 -2
  60. package/dist/loader/__tests__/local-documentation-source.test.d.ts.map +0 -1
  61. package/dist/loader/__tests__/local-documentation-source.test.js +0 -544
  62. package/dist/loader/__tests__/local-documentation-source.test.js.map +0 -1
  63. package/dist/loader/__tests__/path-type-detector.property.test.d.ts +0 -2
  64. package/dist/loader/__tests__/path-type-detector.property.test.d.ts.map +0 -1
  65. package/dist/loader/__tests__/path-type-detector.property.test.js +0 -245
  66. package/dist/loader/__tests__/path-type-detector.property.test.js.map +0 -1
  67. package/dist/loader/__tests__/path-type-detector.test.d.ts +0 -2
  68. package/dist/loader/__tests__/path-type-detector.test.d.ts.map +0 -1
  69. package/dist/loader/__tests__/path-type-detector.test.js +0 -390
  70. package/dist/loader/__tests__/path-type-detector.test.js.map +0 -1
  71. package/dist/loader/__tests__/remote-documentation-source.property.test.d.ts +0 -2
  72. package/dist/loader/__tests__/remote-documentation-source.property.test.d.ts.map +0 -1
  73. package/dist/loader/__tests__/remote-documentation-source.property.test.js +0 -462
  74. package/dist/loader/__tests__/remote-documentation-source.property.test.js.map +0 -1
  75. package/dist/loader/__tests__/remote-documentation-source.test.d.ts +0 -2
  76. package/dist/loader/__tests__/remote-documentation-source.test.d.ts.map +0 -1
  77. package/dist/loader/__tests__/remote-documentation-source.test.js +0 -707
  78. package/dist/loader/__tests__/remote-documentation-source.test.js.map +0 -1
  79. package/dist/loader/cache-manager.d.ts +0 -74
  80. package/dist/loader/cache-manager.d.ts.map +0 -1
  81. package/dist/loader/cache-manager.js +0 -107
  82. package/dist/loader/cache-manager.js.map +0 -1
  83. package/dist/loader/documentation-loader.d.ts +0 -57
  84. package/dist/loader/documentation-loader.d.ts.map +0 -1
  85. package/dist/loader/documentation-loader.js +0 -85
  86. package/dist/loader/documentation-loader.js.map +0 -1
  87. package/dist/loader/documentation-source.d.ts +0 -37
  88. package/dist/loader/documentation-source.d.ts.map +0 -1
  89. package/dist/loader/documentation-source.js +0 -2
  90. package/dist/loader/documentation-source.js.map +0 -1
  91. package/dist/loader/errors.d.ts +0 -34
  92. package/dist/loader/errors.d.ts.map +0 -1
  93. package/dist/loader/errors.js +0 -65
  94. package/dist/loader/errors.js.map +0 -1
  95. package/dist/loader/http-client.d.ts +0 -43
  96. package/dist/loader/http-client.d.ts.map +0 -1
  97. package/dist/loader/http-client.js +0 -144
  98. package/dist/loader/http-client.js.map +0 -1
  99. package/dist/loader/index.d.ts +0 -6
  100. package/dist/loader/index.d.ts.map +0 -1
  101. package/dist/loader/index.js +0 -5
  102. package/dist/loader/index.js.map +0 -1
  103. package/dist/loader/local-documentation-source.d.ts +0 -62
  104. package/dist/loader/local-documentation-source.d.ts.map +0 -1
  105. package/dist/loader/local-documentation-source.js +0 -192
  106. package/dist/loader/local-documentation-source.js.map +0 -1
  107. package/dist/loader/path-type-detector.d.ts +0 -34
  108. package/dist/loader/path-type-detector.d.ts.map +0 -1
  109. package/dist/loader/path-type-detector.js +0 -78
  110. package/dist/loader/path-type-detector.js.map +0 -1
  111. package/dist/loader/remote-documentation-source.d.ts +0 -108
  112. package/dist/loader/remote-documentation-source.d.ts.map +0 -1
  113. package/dist/loader/remote-documentation-source.js +0 -250
  114. package/dist/loader/remote-documentation-source.js.map +0 -1
  115. package/dist/main.d.ts +0 -2
  116. package/dist/main.d.ts.map +0 -1
  117. package/dist/main.js.map +0 -1
  118. package/dist/mcp/__tests__/server.property.test.d.ts +0 -2
  119. package/dist/mcp/__tests__/server.property.test.d.ts.map +0 -1
  120. package/dist/mcp/__tests__/server.property.test.js +0 -286
  121. package/dist/mcp/__tests__/server.property.test.js.map +0 -1
  122. package/dist/mcp/__tests__/server.test.d.ts +0 -2
  123. package/dist/mcp/__tests__/server.test.d.ts.map +0 -1
  124. package/dist/mcp/__tests__/server.test.js +0 -101
  125. package/dist/mcp/__tests__/server.test.js.map +0 -1
  126. package/dist/mcp/index.d.ts +0 -5
  127. package/dist/mcp/index.d.ts.map +0 -1
  128. package/dist/mcp/index.js +0 -5
  129. package/dist/mcp/index.js.map +0 -1
  130. package/dist/mcp/server.d.ts +0 -65
  131. package/dist/mcp/server.d.ts.map +0 -1
  132. package/dist/mcp/server.js +0 -242
  133. package/dist/mcp/server.js.map +0 -1
  134. package/dist/publish/__tests__/publish-utils.test.d.ts +0 -5
  135. package/dist/publish/__tests__/publish-utils.test.d.ts.map +0 -1
  136. package/dist/publish/__tests__/publish-utils.test.js +0 -189
  137. package/dist/publish/__tests__/publish-utils.test.js.map +0 -1
  138. package/dist/publish/index.d.ts +0 -8
  139. package/dist/publish/index.d.ts.map +0 -1
  140. package/dist/publish/index.js +0 -8
  141. package/dist/publish/index.js.map +0 -1
  142. package/dist/publish/publish-utils.d.ts +0 -74
  143. package/dist/publish/publish-utils.d.ts.map +0 -1
  144. package/dist/publish/publish-utils.js +0 -170
  145. package/dist/publish/publish-utils.js.map +0 -1
  146. package/dist/query/__tests__/deprecation-parser.test.d.ts +0 -2
  147. package/dist/query/__tests__/deprecation-parser.test.d.ts.map +0 -1
  148. package/dist/query/__tests__/deprecation-parser.test.js +0 -154
  149. package/dist/query/__tests__/deprecation-parser.test.js.map +0 -1
  150. package/dist/query/__tests__/deprecation-query.test.d.ts +0 -2
  151. package/dist/query/__tests__/deprecation-query.test.d.ts.map +0 -1
  152. package/dist/query/__tests__/deprecation-query.test.js +0 -199
  153. package/dist/query/__tests__/deprecation-query.test.js.map +0 -1
  154. package/dist/query/__tests__/index-builder-debug.test.d.ts +0 -2
  155. package/dist/query/__tests__/index-builder-debug.test.d.ts.map +0 -1
  156. package/dist/query/__tests__/index-builder-debug.test.js +0 -34
  157. package/dist/query/__tests__/index-builder-debug.test.js.map +0 -1
  158. package/dist/query/__tests__/index-builder.property.test.d.ts +0 -2
  159. package/dist/query/__tests__/index-builder.property.test.d.ts.map +0 -1
  160. package/dist/query/__tests__/index-builder.property.test.js +0 -422
  161. package/dist/query/__tests__/index-builder.property.test.js.map +0 -1
  162. package/dist/query/__tests__/index-builder.test.d.ts +0 -2
  163. package/dist/query/__tests__/index-builder.test.d.ts.map +0 -1
  164. package/dist/query/__tests__/index-builder.test.js +0 -55
  165. package/dist/query/__tests__/index-builder.test.js.map +0 -1
  166. package/dist/query/__tests__/result-formatter-deprecation.test.d.ts +0 -2
  167. package/dist/query/__tests__/result-formatter-deprecation.test.d.ts.map +0 -1
  168. package/dist/query/__tests__/result-formatter-deprecation.test.js +0 -159
  169. package/dist/query/__tests__/result-formatter-deprecation.test.js.map +0 -1
  170. package/dist/query/__tests__/result-formatter.integration.test.d.ts +0 -2
  171. package/dist/query/__tests__/result-formatter.integration.test.d.ts.map +0 -1
  172. package/dist/query/__tests__/result-formatter.integration.test.js +0 -140
  173. package/dist/query/__tests__/result-formatter.integration.test.js.map +0 -1
  174. package/dist/query/__tests__/result-formatter.property.test.d.ts +0 -2
  175. package/dist/query/__tests__/result-formatter.property.test.d.ts.map +0 -1
  176. package/dist/query/__tests__/result-formatter.property.test.js +0 -163
  177. package/dist/query/__tests__/result-formatter.property.test.js.map +0 -1
  178. package/dist/query/__tests__/result-formatter.test.d.ts +0 -2
  179. package/dist/query/__tests__/result-formatter.test.d.ts.map +0 -1
  180. package/dist/query/__tests__/result-formatter.test.js +0 -85
  181. package/dist/query/__tests__/result-formatter.test.js.map +0 -1
  182. package/dist/query/__tests__/search-engine.property.test.d.ts +0 -2
  183. package/dist/query/__tests__/search-engine.property.test.d.ts.map +0 -1
  184. package/dist/query/__tests__/search-engine.property.test.js +0 -389
  185. package/dist/query/__tests__/search-engine.property.test.js.map +0 -1
  186. package/dist/query/component-query.d.ts +0 -33
  187. package/dist/query/component-query.d.ts.map +0 -1
  188. package/dist/query/component-query.js +0 -63
  189. package/dist/query/component-query.js.map +0 -1
  190. package/dist/query/deprecation-parser.d.ts +0 -46
  191. package/dist/query/deprecation-parser.d.ts.map +0 -1
  192. package/dist/query/deprecation-parser.js +0 -81
  193. package/dist/query/deprecation-parser.js.map +0 -1
  194. package/dist/query/deprecation-query.d.ts +0 -19
  195. package/dist/query/deprecation-query.d.ts.map +0 -1
  196. package/dist/query/deprecation-query.js +0 -73
  197. package/dist/query/deprecation-query.js.map +0 -1
  198. package/dist/query/index-builder.d.ts +0 -79
  199. package/dist/query/index-builder.d.ts.map +0 -1
  200. package/dist/query/index-builder.js +0 -217
  201. package/dist/query/index-builder.js.map +0 -1
  202. package/dist/query/index.d.ts +0 -5
  203. package/dist/query/index.d.ts.map +0 -1
  204. package/dist/query/index.js +0 -6
  205. package/dist/query/index.js.map +0 -1
  206. package/dist/query/result-formatter.d.ts +0 -135
  207. package/dist/query/result-formatter.d.ts.map +0 -1
  208. package/dist/query/result-formatter.js +0 -226
  209. package/dist/query/result-formatter.js.map +0 -1
  210. package/dist/query/search-engine.d.ts +0 -54
  211. package/dist/query/search-engine.d.ts.map +0 -1
  212. package/dist/query/search-engine.js +0 -178
  213. package/dist/query/search-engine.js.map +0 -1
  214. package/dist/tools/__tests__/deprecation-tools.test.d.ts +0 -2
  215. package/dist/tools/__tests__/deprecation-tools.test.d.ts.map +0 -1
  216. package/dist/tools/__tests__/deprecation-tools.test.js +0 -178
  217. package/dist/tools/__tests__/deprecation-tools.test.js.map +0 -1
  218. package/dist/tools/__tests__/get-component-docs.property.test.d.ts +0 -2
  219. package/dist/tools/__tests__/get-component-docs.property.test.d.ts.map +0 -1
  220. package/dist/tools/__tests__/get-component-docs.property.test.js +0 -594
  221. package/dist/tools/__tests__/get-component-docs.property.test.js.map +0 -1
  222. package/dist/tools/__tests__/get-component-docs.test.d.ts +0 -2
  223. package/dist/tools/__tests__/get-component-docs.test.d.ts.map +0 -1
  224. package/dist/tools/__tests__/get-component-docs.test.js +0 -137
  225. package/dist/tools/__tests__/get-component-docs.test.js.map +0 -1
  226. package/dist/tools/__tests__/get-component-examples.property.test.d.ts +0 -2
  227. package/dist/tools/__tests__/get-component-examples.property.test.d.ts.map +0 -1
  228. package/dist/tools/__tests__/get-component-examples.property.test.js +0 -245
  229. package/dist/tools/__tests__/get-component-examples.property.test.js.map +0 -1
  230. package/dist/tools/__tests__/get-component-examples.test.d.ts +0 -2
  231. package/dist/tools/__tests__/get-component-examples.test.d.ts.map +0 -1
  232. package/dist/tools/__tests__/get-component-examples.test.js +0 -128
  233. package/dist/tools/__tests__/get-component-examples.test.js.map +0 -1
  234. package/dist/tools/__tests__/get-component-inputs.property.test.d.ts +0 -2
  235. package/dist/tools/__tests__/get-component-inputs.property.test.d.ts.map +0 -1
  236. package/dist/tools/__tests__/get-component-inputs.property.test.js +0 -310
  237. package/dist/tools/__tests__/get-component-inputs.property.test.js.map +0 -1
  238. package/dist/tools/__tests__/get-component-inputs.test.d.ts +0 -2
  239. package/dist/tools/__tests__/get-component-inputs.test.d.ts.map +0 -1
  240. package/dist/tools/__tests__/get-component-inputs.test.js +0 -245
  241. package/dist/tools/__tests__/get-component-inputs.test.js.map +0 -1
  242. package/dist/tools/__tests__/get-component-outputs.property.test.d.ts +0 -2
  243. package/dist/tools/__tests__/get-component-outputs.property.test.d.ts.map +0 -1
  244. package/dist/tools/__tests__/get-component-outputs.property.test.js +0 -227
  245. package/dist/tools/__tests__/get-component-outputs.property.test.js.map +0 -1
  246. package/dist/tools/__tests__/get-component-outputs.test.d.ts +0 -2
  247. package/dist/tools/__tests__/get-component-outputs.test.d.ts.map +0 -1
  248. package/dist/tools/__tests__/get-component-outputs.test.js +0 -189
  249. package/dist/tools/__tests__/get-component-outputs.test.js.map +0 -1
  250. package/dist/tools/__tests__/get-library-version.property.test.d.ts +0 -2
  251. package/dist/tools/__tests__/get-library-version.property.test.d.ts.map +0 -1
  252. package/dist/tools/__tests__/get-library-version.property.test.js +0 -115
  253. package/dist/tools/__tests__/get-library-version.property.test.js.map +0 -1
  254. package/dist/tools/__tests__/get-library-version.test.d.ts +0 -2
  255. package/dist/tools/__tests__/get-library-version.test.d.ts.map +0 -1
  256. package/dist/tools/__tests__/get-library-version.test.js +0 -97
  257. package/dist/tools/__tests__/get-library-version.test.js.map +0 -1
  258. package/dist/tools/__tests__/list-components.property.test.d.ts +0 -2
  259. package/dist/tools/__tests__/list-components.property.test.d.ts.map +0 -1
  260. package/dist/tools/__tests__/list-components.property.test.js +0 -241
  261. package/dist/tools/__tests__/list-components.property.test.js.map +0 -1
  262. package/dist/tools/__tests__/list-components.test.d.ts +0 -2
  263. package/dist/tools/__tests__/list-components.test.d.ts.map +0 -1
  264. package/dist/tools/__tests__/list-components.test.js +0 -170
  265. package/dist/tools/__tests__/list-components.test.js.map +0 -1
  266. package/dist/tools/__tests__/search-components.test.d.ts +0 -2
  267. package/dist/tools/__tests__/search-components.test.d.ts.map +0 -1
  268. package/dist/tools/__tests__/search-components.test.js +0 -239
  269. package/dist/tools/__tests__/search-components.test.js.map +0 -1
  270. package/dist/tools/get-component-docs.d.ts +0 -43
  271. package/dist/tools/get-component-docs.d.ts.map +0 -1
  272. package/dist/tools/get-component-docs.js +0 -55
  273. package/dist/tools/get-component-docs.js.map +0 -1
  274. package/dist/tools/get-component-examples.d.ts +0 -45
  275. package/dist/tools/get-component-examples.d.ts.map +0 -1
  276. package/dist/tools/get-component-examples.js +0 -56
  277. package/dist/tools/get-component-examples.js.map +0 -1
  278. package/dist/tools/get-component-inputs.d.ts +0 -44
  279. package/dist/tools/get-component-inputs.d.ts.map +0 -1
  280. package/dist/tools/get-component-inputs.js +0 -55
  281. package/dist/tools/get-component-inputs.js.map +0 -1
  282. package/dist/tools/get-component-outputs.d.ts +0 -44
  283. package/dist/tools/get-component-outputs.d.ts.map +0 -1
  284. package/dist/tools/get-component-outputs.js +0 -55
  285. package/dist/tools/get-component-outputs.js.map +0 -1
  286. package/dist/tools/get-deprecation-info.d.ts +0 -42
  287. package/dist/tools/get-deprecation-info.d.ts.map +0 -1
  288. package/dist/tools/get-deprecation-info.js +0 -55
  289. package/dist/tools/get-deprecation-info.js.map +0 -1
  290. package/dist/tools/get-eui-cli-guide.d.ts +0 -33
  291. package/dist/tools/get-eui-cli-guide.d.ts.map +0 -1
  292. package/dist/tools/get-eui-cli-guide.js +0 -160
  293. package/dist/tools/get-eui-cli-guide.js.map +0 -1
  294. package/dist/tools/get-eui-cli-instructions.d.ts +0 -33
  295. package/dist/tools/get-eui-cli-instructions.d.ts.map +0 -1
  296. package/dist/tools/get-eui-cli-instructions.js +0 -375
  297. package/dist/tools/get-eui-cli-instructions.js.map +0 -1
  298. package/dist/tools/get-library-version.d.ts +0 -34
  299. package/dist/tools/get-library-version.d.ts.map +0 -1
  300. package/dist/tools/get-library-version.js +0 -62
  301. package/dist/tools/get-library-version.js.map +0 -1
  302. package/dist/tools/index.d.ts +0 -12
  303. package/dist/tools/index.d.ts.map +0 -1
  304. package/dist/tools/index.js +0 -13
  305. package/dist/tools/index.js.map +0 -1
  306. package/dist/tools/list-components.d.ts +0 -69
  307. package/dist/tools/list-components.d.ts.map +0 -1
  308. package/dist/tools/list-components.js +0 -84
  309. package/dist/tools/list-components.js.map +0 -1
  310. package/dist/tools/list-deprecated.d.ts +0 -47
  311. package/dist/tools/list-deprecated.d.ts.map +0 -1
  312. package/dist/tools/list-deprecated.js +0 -56
  313. package/dist/tools/list-deprecated.js.map +0 -1
  314. package/dist/tools/search-components.d.ts +0 -69
  315. package/dist/tools/search-components.d.ts.map +0 -1
  316. package/dist/tools/search-components.js +0 -98
  317. package/dist/tools/search-components.js.map +0 -1
  318. package/dist/types/compodoc.d.ts +0 -262
  319. package/dist/types/compodoc.d.ts.map +0 -1
  320. package/dist/types/compodoc.js +0 -5
  321. package/dist/types/compodoc.js.map +0 -1
  322. package/dist/types/deprecation.d.ts +0 -33
  323. package/dist/types/deprecation.d.ts.map +0 -1
  324. package/dist/types/deprecation.js +0 -5
  325. package/dist/types/deprecation.js.map +0 -1
  326. package/dist/types/index.d.ts +0 -5
  327. package/dist/types/index.d.ts.map +0 -1
  328. package/dist/types/index.js +0 -5
  329. package/dist/types/index.js.map +0 -1
  330. package/dist/utils/__tests__/credential-masking.property.test.d.ts +0 -2
  331. package/dist/utils/__tests__/credential-masking.property.test.d.ts.map +0 -1
  332. package/dist/utils/__tests__/credential-masking.property.test.js +0 -145
  333. package/dist/utils/__tests__/credential-masking.property.test.js.map +0 -1
  334. package/dist/utils/__tests__/credential-masking.test.d.ts +0 -2
  335. package/dist/utils/__tests__/credential-masking.test.d.ts.map +0 -1
  336. package/dist/utils/__tests__/credential-masking.test.js +0 -188
  337. package/dist/utils/__tests__/credential-masking.test.js.map +0 -1
  338. package/dist/utils/__tests__/errors.test.d.ts +0 -2
  339. package/dist/utils/__tests__/errors.test.d.ts.map +0 -1
  340. package/dist/utils/__tests__/errors.test.js +0 -110
  341. package/dist/utils/__tests__/errors.test.js.map +0 -1
  342. package/dist/utils/__tests__/integration.test.d.ts +0 -2
  343. package/dist/utils/__tests__/integration.test.d.ts.map +0 -1
  344. package/dist/utils/__tests__/integration.test.js +0 -136
  345. package/dist/utils/__tests__/integration.test.js.map +0 -1
  346. package/dist/utils/__tests__/logger.test.d.ts +0 -2
  347. package/dist/utils/__tests__/logger.test.d.ts.map +0 -1
  348. package/dist/utils/__tests__/logger.test.js +0 -90
  349. package/dist/utils/__tests__/logger.test.js.map +0 -1
  350. package/dist/utils/__tests__/retry.test.d.ts +0 -2
  351. package/dist/utils/__tests__/retry.test.d.ts.map +0 -1
  352. package/dist/utils/__tests__/retry.test.js +0 -84
  353. package/dist/utils/__tests__/retry.test.js.map +0 -1
  354. package/dist/utils/circuit-breaker.d.ts +0 -91
  355. package/dist/utils/circuit-breaker.d.ts.map +0 -1
  356. package/dist/utils/circuit-breaker.js +0 -186
  357. package/dist/utils/circuit-breaker.js.map +0 -1
  358. package/dist/utils/credential-masking.d.ts +0 -90
  359. package/dist/utils/credential-masking.d.ts.map +0 -1
  360. package/dist/utils/credential-masking.js +0 -201
  361. package/dist/utils/credential-masking.js.map +0 -1
  362. package/dist/utils/error-handler.d.ts +0 -68
  363. package/dist/utils/error-handler.d.ts.map +0 -1
  364. package/dist/utils/error-handler.js +0 -184
  365. package/dist/utils/error-handler.js.map +0 -1
  366. package/dist/utils/errors.d.ts +0 -156
  367. package/dist/utils/errors.d.ts.map +0 -1
  368. package/dist/utils/errors.js +0 -242
  369. package/dist/utils/errors.js.map +0 -1
  370. package/dist/utils/index.d.ts +0 -10
  371. package/dist/utils/index.d.ts.map +0 -1
  372. package/dist/utils/index.js +0 -16
  373. package/dist/utils/index.js.map +0 -1
  374. package/dist/utils/logger.d.ts +0 -24
  375. package/dist/utils/logger.d.ts.map +0 -1
  376. package/dist/utils/logger.js +0 -55
  377. package/dist/utils/logger.js.map +0 -1
  378. package/dist/utils/retry.d.ts +0 -19
  379. package/dist/utils/retry.d.ts.map +0 -1
  380. package/dist/utils/retry.js +0 -81
  381. package/dist/utils/retry.js.map +0 -1
  382. package/dist/version/__tests__/changelog-commit-grouping.property.test.d.ts +0 -2
  383. package/dist/version/__tests__/changelog-commit-grouping.property.test.d.ts.map +0 -1
  384. package/dist/version/__tests__/changelog-commit-grouping.property.test.js +0 -297
  385. package/dist/version/__tests__/changelog-commit-grouping.property.test.js.map +0 -1
  386. package/dist/version/__tests__/changelog-commit-parsing.property.test.d.ts +0 -2
  387. package/dist/version/__tests__/changelog-commit-parsing.property.test.d.ts.map +0 -1
  388. package/dist/version/__tests__/changelog-commit-parsing.property.test.js +0 -396
  389. package/dist/version/__tests__/changelog-commit-parsing.property.test.js.map +0 -1
  390. package/dist/version/__tests__/changelog-file-updates.property.test.d.ts +0 -11
  391. package/dist/version/__tests__/changelog-file-updates.property.test.d.ts.map +0 -1
  392. package/dist/version/__tests__/changelog-file-updates.property.test.js +0 -452
  393. package/dist/version/__tests__/changelog-file-updates.property.test.js.map +0 -1
  394. package/dist/version/__tests__/dry-run-action.property.test.d.ts +0 -8
  395. package/dist/version/__tests__/dry-run-action.property.test.d.ts.map +0 -1
  396. package/dist/version/__tests__/dry-run-action.property.test.js +0 -50
  397. package/dist/version/__tests__/dry-run-action.property.test.js.map +0 -1
  398. package/dist/version/__tests__/dry-run-changelog.property.test.d.ts +0 -8
  399. package/dist/version/__tests__/dry-run-changelog.property.test.d.ts.map +0 -1
  400. package/dist/version/__tests__/dry-run-changelog.property.test.js +0 -53
  401. package/dist/version/__tests__/dry-run-changelog.property.test.js.map +0 -1
  402. package/dist/version/__tests__/dry-run-utils.test.d.ts +0 -7
  403. package/dist/version/__tests__/dry-run-utils.test.d.ts.map +0 -1
  404. package/dist/version/__tests__/dry-run-utils.test.js +0 -195
  405. package/dist/version/__tests__/dry-run-utils.test.js.map +0 -1
  406. package/dist/version/__tests__/dry-run-version.property.test.d.ts +0 -8
  407. package/dist/version/__tests__/dry-run-version.property.test.d.ts.map +0 -1
  408. package/dist/version/__tests__/dry-run-version.property.test.js +0 -59
  409. package/dist/version/__tests__/dry-run-version.property.test.js.map +0 -1
  410. package/dist/version/__tests__/git-tag-annotation.property.test.d.ts +0 -11
  411. package/dist/version/__tests__/git-tag-annotation.property.test.d.ts.map +0 -1
  412. package/dist/version/__tests__/git-tag-annotation.property.test.js +0 -271
  413. package/dist/version/__tests__/git-tag-annotation.property.test.js.map +0 -1
  414. package/dist/version/__tests__/git-tag-format.property.test.d.ts +0 -11
  415. package/dist/version/__tests__/git-tag-format.property.test.d.ts.map +0 -1
  416. package/dist/version/__tests__/git-tag-format.property.test.js +0 -411
  417. package/dist/version/__tests__/git-tag-format.property.test.js.map +0 -1
  418. package/dist/version/__tests__/git-tag-utils.test.d.ts +0 -2
  419. package/dist/version/__tests__/git-tag-utils.test.d.ts.map +0 -1
  420. package/dist/version/__tests__/git-tag-utils.test.js +0 -142
  421. package/dist/version/__tests__/git-tag-utils.test.js.map +0 -1
  422. package/dist/version/__tests__/npm-tag-selection.property.test.d.ts +0 -2
  423. package/dist/version/__tests__/npm-tag-selection.property.test.d.ts.map +0 -1
  424. package/dist/version/__tests__/npm-tag-selection.property.test.js +0 -79
  425. package/dist/version/__tests__/npm-tag-selection.property.test.js.map +0 -1
  426. package/dist/version/__tests__/release-title-format.property.test.d.ts +0 -11
  427. package/dist/version/__tests__/release-title-format.property.test.d.ts.map +0 -1
  428. package/dist/version/__tests__/release-title-format.property.test.js +0 -422
  429. package/dist/version/__tests__/release-title-format.property.test.js.map +0 -1
  430. package/dist/version/__tests__/release-utils.test.d.ts +0 -7
  431. package/dist/version/__tests__/release-utils.test.d.ts.map +0 -1
  432. package/dist/version/__tests__/release-utils.test.js +0 -176
  433. package/dist/version/__tests__/release-utils.test.js.map +0 -1
  434. package/dist/version/__tests__/rollback-changelog.property.test.d.ts +0 -8
  435. package/dist/version/__tests__/rollback-changelog.property.test.d.ts.map +0 -1
  436. package/dist/version/__tests__/rollback-changelog.property.test.js +0 -61
  437. package/dist/version/__tests__/rollback-changelog.property.test.js.map +0 -1
  438. package/dist/version/__tests__/rollback-utils.test.d.ts +0 -7
  439. package/dist/version/__tests__/rollback-utils.test.d.ts.map +0 -1
  440. package/dist/version/__tests__/rollback-utils.test.js +0 -74
  441. package/dist/version/__tests__/rollback-utils.test.js.map +0 -1
  442. package/dist/version/__tests__/version-manager.property.test.d.ts +0 -2
  443. package/dist/version/__tests__/version-manager.property.test.d.ts.map +0 -1
  444. package/dist/version/__tests__/version-manager.property.test.js +0 -143
  445. package/dist/version/__tests__/version-manager.property.test.js.map +0 -1
  446. package/dist/version/__tests__/version-manager.test.d.ts +0 -2
  447. package/dist/version/__tests__/version-manager.test.d.ts.map +0 -1
  448. package/dist/version/__tests__/version-manager.test.js +0 -203
  449. package/dist/version/__tests__/version-manager.test.js.map +0 -1
  450. package/dist/version/changelog-file-utils.d.ts +0 -69
  451. package/dist/version/changelog-file-utils.d.ts.map +0 -1
  452. package/dist/version/changelog-file-utils.js +0 -161
  453. package/dist/version/changelog-file-utils.js.map +0 -1
  454. package/dist/version/changelog-utils.d.ts +0 -98
  455. package/dist/version/changelog-utils.d.ts.map +0 -1
  456. package/dist/version/changelog-utils.js +0 -200
  457. package/dist/version/changelog-utils.js.map +0 -1
  458. package/dist/version/dry-run-utils.d.ts +0 -108
  459. package/dist/version/dry-run-utils.d.ts.map +0 -1
  460. package/dist/version/dry-run-utils.js +0 -128
  461. package/dist/version/dry-run-utils.js.map +0 -1
  462. package/dist/version/git-tag-utils.d.ts +0 -50
  463. package/dist/version/git-tag-utils.d.ts.map +0 -1
  464. package/dist/version/git-tag-utils.js +0 -66
  465. package/dist/version/git-tag-utils.js.map +0 -1
  466. package/dist/version/index.d.ts +0 -11
  467. package/dist/version/index.d.ts.map +0 -1
  468. package/dist/version/index.js +0 -11
  469. package/dist/version/index.js.map +0 -1
  470. package/dist/version/release-utils.d.ts +0 -94
  471. package/dist/version/release-utils.d.ts.map +0 -1
  472. package/dist/version/release-utils.js +0 -170
  473. package/dist/version/release-utils.js.map +0 -1
  474. package/dist/version/rollback-utils.d.ts +0 -47
  475. package/dist/version/rollback-utils.d.ts.map +0 -1
  476. package/dist/version/rollback-utils.js +0 -73
  477. package/dist/version/rollback-utils.js.map +0 -1
  478. package/dist/version/version-manager.d.ts +0 -98
  479. package/dist/version/version-manager.d.ts.map +0 -1
  480. package/dist/version/version-manager.js +0 -154
  481. package/dist/version/version-manager.js.map +0 -1
@@ -1,707 +0,0 @@
1
- /**
2
- * Unit tests for RemoteDocumentationSource
3
- * Feature: url-based-documentation-path
4
- * Tests successful fetch, polling, 304 responses, error handling, and cleanup
5
- * Requirements: 5.1, 5.2, 5.4, 5.5, 8.4, 8.5
6
- */
7
- import { describe, it, expect, jest, beforeEach, afterEach } from '@jest/globals';
8
- import { RemoteDocumentationSource } from '../remote-documentation-source.js';
9
- import { HttpClient } from '../http-client.js';
10
- // Helper to create minimal valid CompodocDocumentation
11
- const createMockDocumentation = (id = 'default') => ({
12
- components: [{ name: `Component${id}`, id: `comp-${id}`, file: 'test.ts', type: 'component', deprecated: false }],
13
- modules: [],
14
- directives: [],
15
- pipes: [],
16
- classes: [],
17
- interfaces: [],
18
- injectables: [],
19
- });
20
- describe('RemoteDocumentationSource Unit Tests', () => {
21
- let source;
22
- let originalFetch;
23
- beforeEach(() => {
24
- jest.clearAllMocks();
25
- jest.useRealTimers();
26
- // Store original fetch method
27
- originalFetch = HttpClient.prototype.fetch;
28
- });
29
- afterEach(async () => {
30
- // Restore original fetch method
31
- HttpClient.prototype.fetch = originalFetch;
32
- if (source) {
33
- await source.dispose();
34
- }
35
- });
36
- describe('Successful Fetch and Parse (Requirement 5.1)', () => {
37
- it('should successfully fetch and parse documentation from URL', async () => {
38
- const mockDoc = createMockDocumentation('test1');
39
- const mockFetch = jest.fn().mockResolvedValue({
40
- status: 200,
41
- statusText: 'OK',
42
- data: JSON.stringify(mockDoc),
43
- headers: new Map(),
44
- });
45
- HttpClient.prototype.fetch = mockFetch;
46
- source = new RemoteDocumentationSource({
47
- url: 'https://example.com/docs.json',
48
- timeout: 5000,
49
- maxRetries: 3,
50
- pollingInterval: 60000,
51
- });
52
- const result = await source.load();
53
- expect(result.success).toBe(true);
54
- expect(result.data).toBeDefined();
55
- expect(result.data?.components).toHaveLength(1);
56
- expect(result.data?.components[0].name).toBe('Componenttest1');
57
- expect(mockFetch).toHaveBeenCalledTimes(1);
58
- });
59
- it('should store fetched documentation in currentData', async () => {
60
- const mockDoc = createMockDocumentation('test2');
61
- const mockFetch = jest.fn().mockResolvedValue({
62
- status: 200,
63
- statusText: 'OK',
64
- data: JSON.stringify(mockDoc),
65
- headers: new Map(),
66
- });
67
- HttpClient.prototype.fetch = mockFetch;
68
- source = new RemoteDocumentationSource({
69
- url: 'https://example.com/docs.json',
70
- timeout: 5000,
71
- maxRetries: 3,
72
- pollingInterval: 60000,
73
- });
74
- await source.load();
75
- const currentData = source.getCurrentData();
76
- expect(currentData).toBeDefined();
77
- expect(currentData?.components[0].name).toBe('Componenttest2');
78
- });
79
- it('should cache documentation with ETag header', async () => {
80
- const mockDoc = createMockDocumentation('cached');
81
- const headers = new Map();
82
- headers.set('ETag', '"abc123"');
83
- const mockFetch = jest.fn().mockResolvedValue({
84
- status: 200,
85
- statusText: 'OK',
86
- data: JSON.stringify(mockDoc),
87
- headers,
88
- });
89
- HttpClient.prototype.fetch = mockFetch;
90
- source = new RemoteDocumentationSource({
91
- url: 'https://example.com/docs.json',
92
- timeout: 5000,
93
- maxRetries: 3,
94
- pollingInterval: 60000,
95
- });
96
- await source.load();
97
- // Second load should include If-None-Match header
98
- mockFetch.mockResolvedValue({
99
- status: 304,
100
- statusText: 'Not Modified',
101
- data: '',
102
- headers: new Map(),
103
- });
104
- const result = await source.load();
105
- expect(result.success).toBe(true);
106
- expect(result.data).toBeDefined();
107
- expect(mockFetch).toHaveBeenCalledTimes(2);
108
- // Verify conditional header was sent
109
- const calls = mockFetch.mock.calls;
110
- const conditionalHeaders = calls[1]?.[1];
111
- expect(conditionalHeaders?.get('If-None-Match')).toBe('"abc123"');
112
- });
113
- it('should parse complex documentation structures', async () => {
114
- const complexDoc = {
115
- components: [
116
- { name: 'Button', id: 'btn-1', file: 'button.ts', type: 'component', deprecated: false, selector: 'app-button' },
117
- { name: 'Input', id: 'inp-1', file: 'input.ts', type: 'component', deprecated: true, deprecationMessage: 'Use Input2' },
118
- ],
119
- modules: [
120
- { name: 'AppModule', id: 'mod-1', file: 'app.module.ts', type: 'module', deprecated: false },
121
- ],
122
- directives: [],
123
- pipes: [],
124
- classes: [],
125
- interfaces: [],
126
- injectables: [],
127
- };
128
- const mockFetch = jest.fn().mockResolvedValue({
129
- status: 200,
130
- statusText: 'OK',
131
- data: JSON.stringify(complexDoc),
132
- headers: new Map(),
133
- });
134
- HttpClient.prototype.fetch = mockFetch;
135
- source = new RemoteDocumentationSource({
136
- url: 'https://example.com/docs.json',
137
- timeout: 5000,
138
- maxRetries: 3,
139
- pollingInterval: 60000,
140
- });
141
- const result = await source.load();
142
- expect(result.success).toBe(true);
143
- expect(result.data?.components).toHaveLength(2);
144
- expect(result.data?.modules).toHaveLength(1);
145
- expect(result.data?.components[1].deprecationMessage).toBe('Use Input2');
146
- });
147
- });
148
- describe('Polling Interval Timing (Requirement 5.1, 5.2)', () => {
149
- it('should start polling at configured interval', async () => {
150
- jest.useFakeTimers();
151
- const mockDoc = createMockDocumentation('poll1');
152
- const mockFetch = jest.fn().mockResolvedValue({
153
- status: 200,
154
- statusText: 'OK',
155
- data: JSON.stringify(mockDoc),
156
- headers: new Map(),
157
- });
158
- HttpClient.prototype.fetch = mockFetch;
159
- source = new RemoteDocumentationSource({
160
- url: 'https://example.com/docs.json',
161
- timeout: 5000,
162
- maxRetries: 3,
163
- pollingInterval: 10000, // 10 seconds
164
- });
165
- await source.load();
166
- mockFetch.mockClear();
167
- source.startMonitoring();
168
- // Advance time by 10 seconds
169
- jest.advanceTimersByTime(10000);
170
- await Promise.resolve(); // Allow promises to resolve
171
- expect(mockFetch).toHaveBeenCalledTimes(1);
172
- // Advance another 10 seconds
173
- jest.advanceTimersByTime(10000);
174
- await Promise.resolve();
175
- expect(mockFetch).toHaveBeenCalledTimes(2);
176
- jest.useRealTimers();
177
- });
178
- it('should not start polling if already monitoring', async () => {
179
- jest.useFakeTimers();
180
- const mockDoc = createMockDocumentation('poll2');
181
- const mockFetch = jest.fn().mockResolvedValue({
182
- status: 200,
183
- statusText: 'OK',
184
- data: JSON.stringify(mockDoc),
185
- headers: new Map(),
186
- });
187
- HttpClient.prototype.fetch = mockFetch;
188
- source = new RemoteDocumentationSource({
189
- url: 'https://example.com/docs.json',
190
- timeout: 5000,
191
- maxRetries: 3,
192
- pollingInterval: 10000,
193
- });
194
- await source.load();
195
- mockFetch.mockClear();
196
- source.startMonitoring();
197
- source.startMonitoring(); // Call again
198
- jest.advanceTimersByTime(10000);
199
- await Promise.resolve();
200
- // Should only poll once, not twice
201
- expect(mockFetch).toHaveBeenCalledTimes(1);
202
- jest.useRealTimers();
203
- });
204
- it('should stop polling when stopMonitoring is called', async () => {
205
- jest.useFakeTimers();
206
- const mockDoc = createMockDocumentation('poll3');
207
- const mockFetch = jest.fn().mockResolvedValue({
208
- status: 200,
209
- statusText: 'OK',
210
- data: JSON.stringify(mockDoc),
211
- headers: new Map(),
212
- });
213
- HttpClient.prototype.fetch = mockFetch;
214
- source = new RemoteDocumentationSource({
215
- url: 'https://example.com/docs.json',
216
- timeout: 5000,
217
- maxRetries: 3,
218
- pollingInterval: 10000,
219
- });
220
- await source.load();
221
- mockFetch.mockClear();
222
- source.startMonitoring();
223
- // Advance time and verify polling happens
224
- jest.advanceTimersByTime(10000);
225
- await Promise.resolve();
226
- expect(mockFetch).toHaveBeenCalledTimes(1);
227
- // Stop monitoring
228
- await source.stopMonitoring();
229
- mockFetch.mockClear();
230
- // Advance time again - should not poll
231
- jest.advanceTimersByTime(10000);
232
- await Promise.resolve();
233
- expect(mockFetch).not.toHaveBeenCalled();
234
- jest.useRealTimers();
235
- });
236
- it('should invoke onReload callback when polling detects changes', async () => {
237
- jest.useFakeTimers();
238
- const mockDoc1 = createMockDocumentation('v1');
239
- const mockDoc2 = createMockDocumentation('v2');
240
- let callCount = 0;
241
- const mockFetch = jest.fn().mockImplementation(() => {
242
- callCount++;
243
- return Promise.resolve({
244
- status: 200,
245
- statusText: 'OK',
246
- data: JSON.stringify(callCount === 1 ? mockDoc1 : mockDoc2),
247
- headers: new Map(),
248
- });
249
- });
250
- HttpClient.prototype.fetch = mockFetch;
251
- const onReloadSpy = jest.fn();
252
- source = new RemoteDocumentationSource({
253
- url: 'https://example.com/docs.json',
254
- timeout: 5000,
255
- maxRetries: 3,
256
- pollingInterval: 10000,
257
- onReload: onReloadSpy,
258
- });
259
- await source.load();
260
- expect(onReloadSpy).not.toHaveBeenCalled(); // Not called on initial load
261
- source.startMonitoring();
262
- // Advance time to trigger poll
263
- jest.advanceTimersByTime(10000);
264
- await Promise.resolve();
265
- expect(onReloadSpy).toHaveBeenCalledTimes(1);
266
- expect(onReloadSpy).toHaveBeenCalledWith(expect.objectContaining({
267
- components: expect.arrayContaining([
268
- expect.objectContaining({ name: 'Componentv2' })
269
- ])
270
- }));
271
- jest.useRealTimers();
272
- });
273
- });
274
- describe('304 Not Modified Response Handling (Requirement 8.4)', () => {
275
- it('should use cached data when server returns 304', async () => {
276
- const mockDoc = createMockDocumentation('cached');
277
- const headers = new Map();
278
- headers.set('ETag', '"version1"');
279
- const mockFetch = jest.fn()
280
- .mockResolvedValueOnce({
281
- status: 200,
282
- statusText: 'OK',
283
- data: JSON.stringify(mockDoc),
284
- headers,
285
- })
286
- .mockResolvedValueOnce({
287
- status: 304,
288
- statusText: 'Not Modified',
289
- data: '',
290
- headers: new Map(),
291
- });
292
- HttpClient.prototype.fetch = mockFetch;
293
- source = new RemoteDocumentationSource({
294
- url: 'https://example.com/docs.json',
295
- timeout: 5000,
296
- maxRetries: 3,
297
- pollingInterval: 60000,
298
- });
299
- // First load
300
- const result1 = await source.load();
301
- expect(result1.success).toBe(true);
302
- expect(result1.data?.components[0].name).toBe('Componentcached');
303
- // Second load with 304
304
- const result2 = await source.load();
305
- expect(result2.success).toBe(true);
306
- expect(result2.data?.components[0].name).toBe('Componentcached');
307
- expect(mockFetch).toHaveBeenCalledTimes(2);
308
- });
309
- it('should not invoke onReload callback when polling returns 304', async () => {
310
- jest.useFakeTimers();
311
- const mockDoc = createMockDocumentation('unchanged');
312
- const headers = new Map();
313
- headers.set('ETag', '"same"');
314
- const mockFetch = jest.fn()
315
- .mockResolvedValueOnce({
316
- status: 200,
317
- statusText: 'OK',
318
- data: JSON.stringify(mockDoc),
319
- headers,
320
- })
321
- .mockResolvedValue({
322
- status: 304,
323
- statusText: 'Not Modified',
324
- data: '',
325
- headers: new Map(),
326
- });
327
- HttpClient.prototype.fetch = mockFetch;
328
- const onReloadSpy = jest.fn();
329
- source = new RemoteDocumentationSource({
330
- url: 'https://example.com/docs.json',
331
- timeout: 5000,
332
- maxRetries: 3,
333
- pollingInterval: 10000,
334
- onReload: onReloadSpy,
335
- });
336
- await source.load();
337
- source.startMonitoring();
338
- // Advance time to trigger poll
339
- jest.advanceTimersByTime(10000);
340
- await Promise.resolve();
341
- // onReload should not be called for 304
342
- expect(onReloadSpy).not.toHaveBeenCalled();
343
- jest.useRealTimers();
344
- });
345
- it('should send conditional headers when cache exists', async () => {
346
- const mockDoc = createMockDocumentation('test');
347
- const headers = new Map();
348
- headers.set('ETag', '"etag123"');
349
- headers.set('Last-Modified', 'Wed, 21 Oct 2015 07:28:00 GMT');
350
- const mockFetch = jest.fn()
351
- .mockResolvedValueOnce({
352
- status: 200,
353
- statusText: 'OK',
354
- data: JSON.stringify(mockDoc),
355
- headers,
356
- })
357
- .mockResolvedValueOnce({
358
- status: 304,
359
- statusText: 'Not Modified',
360
- data: '',
361
- headers: new Map(),
362
- });
363
- HttpClient.prototype.fetch = mockFetch;
364
- source = new RemoteDocumentationSource({
365
- url: 'https://example.com/docs.json',
366
- timeout: 5000,
367
- maxRetries: 3,
368
- pollingInterval: 60000,
369
- });
370
- await source.load();
371
- await source.load(); // Second load
372
- // Verify conditional headers were sent on second call
373
- const calls = mockFetch.mock.calls;
374
- const conditionalHeaders = calls[1]?.[1];
375
- expect(conditionalHeaders?.get('If-None-Match')).toBe('"etag123"');
376
- expect(conditionalHeaders?.get('If-Modified-Since')).toBe('Wed, 21 Oct 2015 07:28:00 GMT');
377
- });
378
- });
379
- describe('Error Handling During Polling (Requirement 5.4)', () => {
380
- it('should continue using cached data when polling encounters error', async () => {
381
- jest.useFakeTimers();
382
- const mockDoc = createMockDocumentation('stable');
383
- const mockFetch = jest.fn()
384
- .mockResolvedValueOnce({
385
- status: 200,
386
- statusText: 'OK',
387
- data: JSON.stringify(mockDoc),
388
- headers: new Map(),
389
- })
390
- .mockRejectedValue(new Error('Network error'));
391
- HttpClient.prototype.fetch = mockFetch;
392
- source = new RemoteDocumentationSource({
393
- url: 'https://example.com/docs.json',
394
- timeout: 5000,
395
- maxRetries: 3,
396
- pollingInterval: 10000,
397
- });
398
- await source.load();
399
- const dataBefore = source.getCurrentData();
400
- source.startMonitoring();
401
- // Advance time to trigger poll with error
402
- jest.advanceTimersByTime(10000);
403
- await Promise.resolve();
404
- const dataAfter = source.getCurrentData();
405
- // Data should remain unchanged
406
- expect(dataAfter).toEqual(dataBefore);
407
- expect(dataAfter?.components[0].name).toBe('Componentstable');
408
- jest.useRealTimers();
409
- });
410
- it('should invoke onError callback when polling fails', async () => {
411
- jest.useFakeTimers();
412
- const mockDoc = createMockDocumentation('test');
413
- const networkError = new Error('Connection timeout');
414
- const mockFetch = jest.fn()
415
- .mockResolvedValueOnce({
416
- status: 200,
417
- statusText: 'OK',
418
- data: JSON.stringify(mockDoc),
419
- headers: new Map(),
420
- })
421
- .mockRejectedValue(networkError);
422
- HttpClient.prototype.fetch = mockFetch;
423
- const onErrorSpy = jest.fn();
424
- source = new RemoteDocumentationSource({
425
- url: 'https://example.com/docs.json',
426
- timeout: 5000,
427
- maxRetries: 3,
428
- pollingInterval: 10000,
429
- onError: onErrorSpy,
430
- });
431
- await source.load();
432
- source.startMonitoring();
433
- // Advance time to trigger poll with error
434
- jest.advanceTimersByTime(10000);
435
- await Promise.resolve();
436
- expect(onErrorSpy).toHaveBeenCalledTimes(1);
437
- expect(onErrorSpy).toHaveBeenCalledWith(expect.objectContaining({
438
- message: 'Connection timeout'
439
- }));
440
- jest.useRealTimers();
441
- });
442
- it('should handle HTTP errors during polling gracefully', async () => {
443
- jest.useFakeTimers();
444
- const mockDoc = createMockDocumentation('test');
445
- const mockFetch = jest.fn()
446
- .mockResolvedValueOnce({
447
- status: 200,
448
- statusText: 'OK',
449
- data: JSON.stringify(mockDoc),
450
- headers: new Map(),
451
- })
452
- .mockResolvedValue({
453
- status: 500,
454
- statusText: 'Internal Server Error',
455
- data: '',
456
- headers: new Map(),
457
- });
458
- HttpClient.prototype.fetch = mockFetch;
459
- const onErrorSpy = jest.fn();
460
- source = new RemoteDocumentationSource({
461
- url: 'https://example.com/docs.json',
462
- timeout: 5000,
463
- maxRetries: 3,
464
- pollingInterval: 10000,
465
- onError: onErrorSpy,
466
- });
467
- await source.load();
468
- const dataBefore = source.getCurrentData();
469
- source.startMonitoring();
470
- // Advance time to trigger poll
471
- jest.advanceTimersByTime(10000);
472
- await Promise.resolve();
473
- // Should invoke error callback
474
- expect(onErrorSpy).toHaveBeenCalled();
475
- // Data should remain unchanged
476
- expect(source.getCurrentData()).toEqual(dataBefore);
477
- jest.useRealTimers();
478
- });
479
- it('should handle parse errors during polling gracefully', async () => {
480
- jest.useFakeTimers();
481
- const mockDoc = createMockDocumentation('test');
482
- const mockFetch = jest.fn()
483
- .mockResolvedValueOnce({
484
- status: 200,
485
- statusText: 'OK',
486
- data: JSON.stringify(mockDoc),
487
- headers: new Map(),
488
- })
489
- .mockResolvedValue({
490
- status: 200,
491
- statusText: 'OK',
492
- data: 'invalid json {',
493
- headers: new Map(),
494
- });
495
- HttpClient.prototype.fetch = mockFetch;
496
- const onErrorSpy = jest.fn();
497
- source = new RemoteDocumentationSource({
498
- url: 'https://example.com/docs.json',
499
- timeout: 5000,
500
- maxRetries: 3,
501
- pollingInterval: 10000,
502
- onError: onErrorSpy,
503
- });
504
- await source.load();
505
- const dataBefore = source.getCurrentData();
506
- source.startMonitoring();
507
- // Advance time to trigger poll
508
- jest.advanceTimersByTime(10000);
509
- await Promise.resolve();
510
- // Should invoke error callback
511
- expect(onErrorSpy).toHaveBeenCalled();
512
- // Data should remain unchanged
513
- expect(source.getCurrentData()).toEqual(dataBefore);
514
- jest.useRealTimers();
515
- });
516
- });
517
- describe('Cleanup on Dispose (Requirement 5.5, 8.5)', () => {
518
- it('should stop polling when dispose is called', async () => {
519
- jest.useFakeTimers();
520
- const mockDoc = createMockDocumentation('test');
521
- const mockFetch = jest.fn().mockResolvedValue({
522
- status: 200,
523
- statusText: 'OK',
524
- data: JSON.stringify(mockDoc),
525
- headers: new Map(),
526
- });
527
- HttpClient.prototype.fetch = mockFetch;
528
- source = new RemoteDocumentationSource({
529
- url: 'https://example.com/docs.json',
530
- timeout: 5000,
531
- maxRetries: 3,
532
- pollingInterval: 10000,
533
- });
534
- await source.load();
535
- mockFetch.mockClear();
536
- source.startMonitoring();
537
- await source.dispose();
538
- // Advance time - should not poll
539
- jest.advanceTimersByTime(10000);
540
- await Promise.resolve();
541
- expect(mockFetch).not.toHaveBeenCalled();
542
- jest.useRealTimers();
543
- });
544
- it('should clear cached data when dispose is called', async () => {
545
- const mockDoc = createMockDocumentation('test');
546
- const mockFetch = jest.fn().mockResolvedValue({
547
- status: 200,
548
- statusText: 'OK',
549
- data: JSON.stringify(mockDoc),
550
- headers: new Map(),
551
- });
552
- HttpClient.prototype.fetch = mockFetch;
553
- source = new RemoteDocumentationSource({
554
- url: 'https://example.com/docs.json',
555
- timeout: 5000,
556
- maxRetries: 3,
557
- pollingInterval: 60000,
558
- });
559
- await source.load();
560
- expect(source.getCurrentData()).toBeDefined();
561
- await source.dispose();
562
- expect(source.getCurrentData()).toBeUndefined();
563
- });
564
- it('should clear callbacks when dispose is called', async () => {
565
- jest.useFakeTimers();
566
- const mockDoc = createMockDocumentation('test');
567
- const mockFetch = jest.fn().mockResolvedValue({
568
- status: 200,
569
- statusText: 'OK',
570
- data: JSON.stringify(mockDoc),
571
- headers: new Map(),
572
- });
573
- HttpClient.prototype.fetch = mockFetch;
574
- const onReloadSpy = jest.fn();
575
- const onErrorSpy = jest.fn();
576
- source = new RemoteDocumentationSource({
577
- url: 'https://example.com/docs.json',
578
- timeout: 5000,
579
- maxRetries: 3,
580
- pollingInterval: 10000,
581
- onReload: onReloadSpy,
582
- onError: onErrorSpy,
583
- });
584
- await source.load();
585
- await source.dispose();
586
- // Callbacks should be cleared and not invoked
587
- // This is verified by the fact that dispose clears the callbacks
588
- expect(onReloadSpy).not.toHaveBeenCalled();
589
- expect(onErrorSpy).not.toHaveBeenCalled();
590
- jest.useRealTimers();
591
- });
592
- it('should handle dispose when not monitoring', async () => {
593
- const mockDoc = createMockDocumentation('test');
594
- const mockFetch = jest.fn().mockResolvedValue({
595
- status: 200,
596
- statusText: 'OK',
597
- data: JSON.stringify(mockDoc),
598
- headers: new Map(),
599
- });
600
- HttpClient.prototype.fetch = mockFetch;
601
- source = new RemoteDocumentationSource({
602
- url: 'https://example.com/docs.json',
603
- timeout: 5000,
604
- maxRetries: 3,
605
- pollingInterval: 60000,
606
- });
607
- await source.load();
608
- // Dispose without starting monitoring
609
- await expect(source.dispose()).resolves.not.toThrow();
610
- });
611
- it('should handle multiple dispose calls gracefully', async () => {
612
- const mockDoc = createMockDocumentation('test');
613
- const mockFetch = jest.fn().mockResolvedValue({
614
- status: 200,
615
- statusText: 'OK',
616
- data: JSON.stringify(mockDoc),
617
- headers: new Map(),
618
- });
619
- HttpClient.prototype.fetch = mockFetch;
620
- source = new RemoteDocumentationSource({
621
- url: 'https://example.com/docs.json',
622
- timeout: 5000,
623
- maxRetries: 3,
624
- pollingInterval: 60000,
625
- });
626
- await source.load();
627
- await source.dispose();
628
- // Second dispose should not throw
629
- await expect(source.dispose()).resolves.not.toThrow();
630
- });
631
- });
632
- describe('Error Scenarios', () => {
633
- it('should return error for non-200 status codes', async () => {
634
- const mockFetch = jest.fn().mockResolvedValue({
635
- status: 404,
636
- statusText: 'Not Found',
637
- data: '',
638
- headers: new Map(),
639
- });
640
- HttpClient.prototype.fetch = mockFetch;
641
- source = new RemoteDocumentationSource({
642
- url: 'https://example.com/docs.json',
643
- timeout: 5000,
644
- maxRetries: 3,
645
- pollingInterval: 60000,
646
- });
647
- const result = await source.load();
648
- expect(result.success).toBe(false);
649
- expect(result.error).toBeDefined();
650
- expect(result.error).toContain('404');
651
- });
652
- it('should return error for invalid JSON', async () => {
653
- const mockFetch = jest.fn().mockResolvedValue({
654
- status: 200,
655
- statusText: 'OK',
656
- data: 'not valid json {',
657
- headers: new Map(),
658
- });
659
- HttpClient.prototype.fetch = mockFetch;
660
- source = new RemoteDocumentationSource({
661
- url: 'https://example.com/docs.json',
662
- timeout: 5000,
663
- maxRetries: 3,
664
- pollingInterval: 60000,
665
- });
666
- const result = await source.load();
667
- expect(result.success).toBe(false);
668
- expect(result.error).toBeDefined();
669
- expect(result.error).toMatch(/parse|json/i);
670
- });
671
- it('should return error for invalid documentation structure', async () => {
672
- const invalidDoc = { components: 'not an array' };
673
- const mockFetch = jest.fn().mockResolvedValue({
674
- status: 200,
675
- statusText: 'OK',
676
- data: JSON.stringify(invalidDoc),
677
- headers: new Map(),
678
- });
679
- HttpClient.prototype.fetch = mockFetch;
680
- source = new RemoteDocumentationSource({
681
- url: 'https://example.com/docs.json',
682
- timeout: 5000,
683
- maxRetries: 3,
684
- pollingInterval: 60000,
685
- });
686
- const result = await source.load();
687
- expect(result.success).toBe(false);
688
- expect(result.error).toBeDefined();
689
- expect(result.error).toMatch(/must be an array/i);
690
- });
691
- it('should return error for network failures', async () => {
692
- const mockFetch = jest.fn().mockRejectedValue(new Error('Network connection failed'));
693
- HttpClient.prototype.fetch = mockFetch;
694
- source = new RemoteDocumentationSource({
695
- url: 'https://example.com/docs.json',
696
- timeout: 5000,
697
- maxRetries: 3,
698
- pollingInterval: 60000,
699
- });
700
- const result = await source.load();
701
- expect(result.success).toBe(false);
702
- expect(result.error).toBeDefined();
703
- expect(result.error).toContain('Network connection failed');
704
- });
705
- });
706
- });
707
- //# sourceMappingURL=remote-documentation-source.test.js.map