@eui/mcp 1.0.3

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 (191) hide show
  1. package/README.md +846 -0
  2. package/dist/config/index.d.ts +6 -0
  3. package/dist/config/index.d.ts.map +1 -0
  4. package/dist/config/index.js +6 -0
  5. package/dist/config/index.js.map +1 -0
  6. package/dist/config/loader.d.ts +27 -0
  7. package/dist/config/loader.d.ts.map +1 -0
  8. package/dist/config/loader.js +224 -0
  9. package/dist/config/loader.js.map +1 -0
  10. package/dist/config/schema.d.ts +171 -0
  11. package/dist/config/schema.d.ts.map +1 -0
  12. package/dist/config/schema.js +100 -0
  13. package/dist/config/schema.js.map +1 -0
  14. package/dist/index.d.ts +3 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +45 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/loader/cache-manager.d.ts +74 -0
  19. package/dist/loader/cache-manager.d.ts.map +1 -0
  20. package/dist/loader/cache-manager.js +107 -0
  21. package/dist/loader/cache-manager.js.map +1 -0
  22. package/dist/loader/documentation-loader.d.ts +57 -0
  23. package/dist/loader/documentation-loader.d.ts.map +1 -0
  24. package/dist/loader/documentation-loader.js +81 -0
  25. package/dist/loader/documentation-loader.js.map +1 -0
  26. package/dist/loader/documentation-source.d.ts +37 -0
  27. package/dist/loader/documentation-source.d.ts.map +1 -0
  28. package/dist/loader/documentation-source.js +2 -0
  29. package/dist/loader/documentation-source.js.map +1 -0
  30. package/dist/loader/errors.d.ts +34 -0
  31. package/dist/loader/errors.d.ts.map +1 -0
  32. package/dist/loader/errors.js +65 -0
  33. package/dist/loader/errors.js.map +1 -0
  34. package/dist/loader/http-client.d.ts +43 -0
  35. package/dist/loader/http-client.d.ts.map +1 -0
  36. package/dist/loader/http-client.js +144 -0
  37. package/dist/loader/http-client.js.map +1 -0
  38. package/dist/loader/index.d.ts +6 -0
  39. package/dist/loader/index.d.ts.map +1 -0
  40. package/dist/loader/index.js +5 -0
  41. package/dist/loader/index.js.map +1 -0
  42. package/dist/loader/local-documentation-source.d.ts +62 -0
  43. package/dist/loader/local-documentation-source.d.ts.map +1 -0
  44. package/dist/loader/local-documentation-source.js +190 -0
  45. package/dist/loader/local-documentation-source.js.map +1 -0
  46. package/dist/loader/path-type-detector.d.ts +34 -0
  47. package/dist/loader/path-type-detector.d.ts.map +1 -0
  48. package/dist/loader/path-type-detector.js +78 -0
  49. package/dist/loader/path-type-detector.js.map +1 -0
  50. package/dist/loader/remote-documentation-source.d.ts +112 -0
  51. package/dist/loader/remote-documentation-source.d.ts.map +1 -0
  52. package/dist/loader/remote-documentation-source.js +252 -0
  53. package/dist/loader/remote-documentation-source.js.map +1 -0
  54. package/dist/main.d.ts +3 -0
  55. package/dist/main.d.ts.map +1 -0
  56. package/dist/main.js +211 -0
  57. package/dist/main.js.map +1 -0
  58. package/dist/mcp/index.d.ts +5 -0
  59. package/dist/mcp/index.d.ts.map +1 -0
  60. package/dist/mcp/index.js +5 -0
  61. package/dist/mcp/index.js.map +1 -0
  62. package/dist/mcp/server.d.ts +65 -0
  63. package/dist/mcp/server.d.ts.map +1 -0
  64. package/dist/mcp/server.js +224 -0
  65. package/dist/mcp/server.js.map +1 -0
  66. package/dist/publish/index.d.ts +8 -0
  67. package/dist/publish/index.d.ts.map +1 -0
  68. package/dist/publish/index.js +8 -0
  69. package/dist/publish/index.js.map +1 -0
  70. package/dist/publish/publish-utils.d.ts +74 -0
  71. package/dist/publish/publish-utils.d.ts.map +1 -0
  72. package/dist/publish/publish-utils.js +170 -0
  73. package/dist/publish/publish-utils.js.map +1 -0
  74. package/dist/query/component-query.d.ts +33 -0
  75. package/dist/query/component-query.d.ts.map +1 -0
  76. package/dist/query/component-query.js +63 -0
  77. package/dist/query/component-query.js.map +1 -0
  78. package/dist/query/index-builder.d.ts +79 -0
  79. package/dist/query/index-builder.d.ts.map +1 -0
  80. package/dist/query/index-builder.js +217 -0
  81. package/dist/query/index-builder.js.map +1 -0
  82. package/dist/query/index.d.ts +5 -0
  83. package/dist/query/index.d.ts.map +1 -0
  84. package/dist/query/index.js +6 -0
  85. package/dist/query/index.js.map +1 -0
  86. package/dist/query/result-formatter.d.ts +108 -0
  87. package/dist/query/result-formatter.d.ts.map +1 -0
  88. package/dist/query/result-formatter.js +165 -0
  89. package/dist/query/result-formatter.js.map +1 -0
  90. package/dist/query/search-engine.d.ts +54 -0
  91. package/dist/query/search-engine.d.ts.map +1 -0
  92. package/dist/query/search-engine.js +178 -0
  93. package/dist/query/search-engine.js.map +1 -0
  94. package/dist/test-error.ts +1 -0
  95. package/dist/tools/get-component-docs.d.ts +43 -0
  96. package/dist/tools/get-component-docs.d.ts.map +1 -0
  97. package/dist/tools/get-component-docs.js +55 -0
  98. package/dist/tools/get-component-docs.js.map +1 -0
  99. package/dist/tools/get-component-examples.d.ts +45 -0
  100. package/dist/tools/get-component-examples.d.ts.map +1 -0
  101. package/dist/tools/get-component-examples.js +56 -0
  102. package/dist/tools/get-component-examples.js.map +1 -0
  103. package/dist/tools/get-component-inputs.d.ts +44 -0
  104. package/dist/tools/get-component-inputs.d.ts.map +1 -0
  105. package/dist/tools/get-component-inputs.js +55 -0
  106. package/dist/tools/get-component-inputs.js.map +1 -0
  107. package/dist/tools/get-component-outputs.d.ts +44 -0
  108. package/dist/tools/get-component-outputs.d.ts.map +1 -0
  109. package/dist/tools/get-component-outputs.js +55 -0
  110. package/dist/tools/get-component-outputs.js.map +1 -0
  111. package/dist/tools/index.d.ts +7 -0
  112. package/dist/tools/index.d.ts.map +1 -0
  113. package/dist/tools/index.js +8 -0
  114. package/dist/tools/index.js.map +1 -0
  115. package/dist/tools/list-components.d.ts +69 -0
  116. package/dist/tools/list-components.d.ts.map +1 -0
  117. package/dist/tools/list-components.js +84 -0
  118. package/dist/tools/list-components.js.map +1 -0
  119. package/dist/tools/search-components.d.ts +69 -0
  120. package/dist/tools/search-components.d.ts.map +1 -0
  121. package/dist/tools/search-components.js +98 -0
  122. package/dist/tools/search-components.js.map +1 -0
  123. package/dist/types/compodoc.d.ts +261 -0
  124. package/dist/types/compodoc.d.ts.map +1 -0
  125. package/dist/types/compodoc.js +5 -0
  126. package/dist/types/compodoc.js.map +1 -0
  127. package/dist/types/index.d.ts +5 -0
  128. package/dist/types/index.d.ts.map +1 -0
  129. package/dist/types/index.js +5 -0
  130. package/dist/types/index.js.map +1 -0
  131. package/dist/utils/circuit-breaker.d.ts +91 -0
  132. package/dist/utils/circuit-breaker.d.ts.map +1 -0
  133. package/dist/utils/circuit-breaker.js +186 -0
  134. package/dist/utils/circuit-breaker.js.map +1 -0
  135. package/dist/utils/credential-masking.d.ts +90 -0
  136. package/dist/utils/credential-masking.d.ts.map +1 -0
  137. package/dist/utils/credential-masking.js +202 -0
  138. package/dist/utils/credential-masking.js.map +1 -0
  139. package/dist/utils/error-handler.d.ts +68 -0
  140. package/dist/utils/error-handler.d.ts.map +1 -0
  141. package/dist/utils/error-handler.js +184 -0
  142. package/dist/utils/error-handler.js.map +1 -0
  143. package/dist/utils/errors.d.ts +156 -0
  144. package/dist/utils/errors.d.ts.map +1 -0
  145. package/dist/utils/errors.js +242 -0
  146. package/dist/utils/errors.js.map +1 -0
  147. package/dist/utils/index.d.ts +10 -0
  148. package/dist/utils/index.d.ts.map +1 -0
  149. package/dist/utils/index.js +16 -0
  150. package/dist/utils/index.js.map +1 -0
  151. package/dist/utils/logger.d.ts +76 -0
  152. package/dist/utils/logger.d.ts.map +1 -0
  153. package/dist/utils/logger.js +150 -0
  154. package/dist/utils/logger.js.map +1 -0
  155. package/dist/utils/retry.d.ts +19 -0
  156. package/dist/utils/retry.d.ts.map +1 -0
  157. package/dist/utils/retry.js +81 -0
  158. package/dist/utils/retry.js.map +1 -0
  159. package/dist/version/changelog-file-utils.d.ts +69 -0
  160. package/dist/version/changelog-file-utils.d.ts.map +1 -0
  161. package/dist/version/changelog-file-utils.js +161 -0
  162. package/dist/version/changelog-file-utils.js.map +1 -0
  163. package/dist/version/changelog-utils.d.ts +98 -0
  164. package/dist/version/changelog-utils.d.ts.map +1 -0
  165. package/dist/version/changelog-utils.js +198 -0
  166. package/dist/version/changelog-utils.js.map +1 -0
  167. package/dist/version/dry-run-utils.d.ts +108 -0
  168. package/dist/version/dry-run-utils.d.ts.map +1 -0
  169. package/dist/version/dry-run-utils.js +126 -0
  170. package/dist/version/dry-run-utils.js.map +1 -0
  171. package/dist/version/git-tag-utils.d.ts +50 -0
  172. package/dist/version/git-tag-utils.d.ts.map +1 -0
  173. package/dist/version/git-tag-utils.js +66 -0
  174. package/dist/version/git-tag-utils.js.map +1 -0
  175. package/dist/version/index.d.ts +11 -0
  176. package/dist/version/index.d.ts.map +1 -0
  177. package/dist/version/index.js +11 -0
  178. package/dist/version/index.js.map +1 -0
  179. package/dist/version/release-utils.d.ts +94 -0
  180. package/dist/version/release-utils.d.ts.map +1 -0
  181. package/dist/version/release-utils.js +170 -0
  182. package/dist/version/release-utils.js.map +1 -0
  183. package/dist/version/rollback-utils.d.ts +47 -0
  184. package/dist/version/rollback-utils.d.ts.map +1 -0
  185. package/dist/version/rollback-utils.js +73 -0
  186. package/dist/version/rollback-utils.js.map +1 -0
  187. package/dist/version/version-manager.d.ts +98 -0
  188. package/dist/version/version-manager.d.ts.map +1 -0
  189. package/dist/version/version-manager.js +158 -0
  190. package/dist/version/version-manager.js.map +1 -0
  191. package/package.json +61 -0
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Cache manager for storing documentation responses with HTTP cache headers
3
+ */
4
+ import { CompodocDocumentation } from '../types/compodoc.js';
5
+ /**
6
+ * Cache entry containing documentation data and HTTP cache headers
7
+ */
8
+ export interface CacheEntry {
9
+ /** ETag header value for conditional requests */
10
+ etag?: string;
11
+ /** Last-Modified header value for conditional requests */
12
+ lastModified?: string;
13
+ /** Cached documentation data */
14
+ data: CompodocDocumentation;
15
+ /** Timestamp when the entry was cached */
16
+ timestamp: number;
17
+ }
18
+ /**
19
+ * Manages caching of remote documentation responses with HTTP cache headers
20
+ *
21
+ * Supports conditional requests using ETag and Last-Modified headers to minimize
22
+ * bandwidth usage when polling for updates.
23
+ */
24
+ export declare class CacheManager {
25
+ private cache;
26
+ constructor();
27
+ /**
28
+ * Store documentation with cache headers
29
+ *
30
+ * @param url - The URL of the documentation source
31
+ * @param data - The documentation data to cache
32
+ * @param headers - HTTP response headers containing ETag and/or Last-Modified
33
+ */
34
+ set(url: string, data: CompodocDocumentation, headers: Map<string, string>): void;
35
+ /**
36
+ * Get cached documentation for a URL
37
+ *
38
+ * @param url - The URL to retrieve from cache
39
+ * @returns The cache entry if found, undefined otherwise
40
+ */
41
+ get(url: string): CacheEntry | undefined;
42
+ /**
43
+ * Get conditional request headers for a URL
44
+ *
45
+ * Returns If-None-Match (ETag) and/or If-Modified-Since (Last-Modified) headers
46
+ * if they exist in the cache for the given URL.
47
+ *
48
+ * @param url - The URL to get conditional headers for
49
+ * @returns Map of conditional request headers
50
+ */
51
+ getConditionalHeaders(url: string): Map<string, string>;
52
+ /**
53
+ * Clear cache for a specific URL
54
+ *
55
+ * @param url - The URL to clear from cache
56
+ */
57
+ clear(url: string): void;
58
+ /**
59
+ * Clear all cached entries
60
+ */
61
+ clearAll(): void;
62
+ /**
63
+ * Get header value case-insensitively
64
+ *
65
+ * HTTP headers are case-insensitive, so we need to search for them
66
+ * regardless of case.
67
+ *
68
+ * @param headers - Map of headers
69
+ * @param headerName - Name of the header to find (case-insensitive)
70
+ * @returns The header value if found, undefined otherwise
71
+ */
72
+ private getHeaderCaseInsensitive;
73
+ }
74
+ //# sourceMappingURL=cache-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-manager.d.ts","sourceRoot":"","sources":["../../src/loader/cache-manager.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAA0B;;IAMvC;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAqBjF;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAIxC;;;;;;;;OAQG;IACH,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAqBvD;;;;OAIG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIxB;;OAEG;IACH,QAAQ,IAAI,IAAI;IAIhB;;;;;;;;;OASG;IACH,OAAO,CAAC,wBAAwB;CAWjC"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Cache manager for storing documentation responses with HTTP cache headers
3
+ */
4
+ /**
5
+ * Manages caching of remote documentation responses with HTTP cache headers
6
+ *
7
+ * Supports conditional requests using ETag and Last-Modified headers to minimize
8
+ * bandwidth usage when polling for updates.
9
+ */
10
+ export class CacheManager {
11
+ cache;
12
+ constructor() {
13
+ this.cache = new Map();
14
+ }
15
+ /**
16
+ * Store documentation with cache headers
17
+ *
18
+ * @param url - The URL of the documentation source
19
+ * @param data - The documentation data to cache
20
+ * @param headers - HTTP response headers containing ETag and/or Last-Modified
21
+ */
22
+ set(url, data, headers) {
23
+ const entry = {
24
+ data,
25
+ timestamp: Date.now(),
26
+ };
27
+ // Extract ETag header (case-insensitive)
28
+ const etag = this.getHeaderCaseInsensitive(headers, 'etag');
29
+ if (etag) {
30
+ entry.etag = etag;
31
+ }
32
+ // Extract Last-Modified header (case-insensitive)
33
+ const lastModified = this.getHeaderCaseInsensitive(headers, 'last-modified');
34
+ if (lastModified) {
35
+ entry.lastModified = lastModified;
36
+ }
37
+ this.cache.set(url, entry);
38
+ }
39
+ /**
40
+ * Get cached documentation for a URL
41
+ *
42
+ * @param url - The URL to retrieve from cache
43
+ * @returns The cache entry if found, undefined otherwise
44
+ */
45
+ get(url) {
46
+ return this.cache.get(url);
47
+ }
48
+ /**
49
+ * Get conditional request headers for a URL
50
+ *
51
+ * Returns If-None-Match (ETag) and/or If-Modified-Since (Last-Modified) headers
52
+ * if they exist in the cache for the given URL.
53
+ *
54
+ * @param url - The URL to get conditional headers for
55
+ * @returns Map of conditional request headers
56
+ */
57
+ getConditionalHeaders(url) {
58
+ const headers = new Map();
59
+ const entry = this.cache.get(url);
60
+ if (!entry) {
61
+ return headers;
62
+ }
63
+ // Add If-None-Match header if ETag exists
64
+ if (entry.etag) {
65
+ headers.set('If-None-Match', entry.etag);
66
+ }
67
+ // Add If-Modified-Since header if Last-Modified exists
68
+ if (entry.lastModified) {
69
+ headers.set('If-Modified-Since', entry.lastModified);
70
+ }
71
+ return headers;
72
+ }
73
+ /**
74
+ * Clear cache for a specific URL
75
+ *
76
+ * @param url - The URL to clear from cache
77
+ */
78
+ clear(url) {
79
+ this.cache.delete(url);
80
+ }
81
+ /**
82
+ * Clear all cached entries
83
+ */
84
+ clearAll() {
85
+ this.cache.clear();
86
+ }
87
+ /**
88
+ * Get header value case-insensitively
89
+ *
90
+ * HTTP headers are case-insensitive, so we need to search for them
91
+ * regardless of case.
92
+ *
93
+ * @param headers - Map of headers
94
+ * @param headerName - Name of the header to find (case-insensitive)
95
+ * @returns The header value if found, undefined otherwise
96
+ */
97
+ getHeaderCaseInsensitive(headers, headerName) {
98
+ const lowerHeaderName = headerName.toLowerCase();
99
+ for (const [key, value] of headers.entries()) {
100
+ if (key.toLowerCase() === lowerHeaderName) {
101
+ return value;
102
+ }
103
+ }
104
+ return undefined;
105
+ }
106
+ }
107
+ //# sourceMappingURL=cache-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-manager.js","sourceRoot":"","sources":["../../src/loader/cache-manager.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkBH;;;;;GAKG;AACH,MAAM,OAAO,YAAY;IACf,KAAK,CAA0B;IAEvC;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACH,GAAG,CAAC,GAAW,EAAE,IAA2B,EAAE,OAA4B;QACxE,MAAM,KAAK,GAAe;YACxB,IAAI;YACJ,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC;QAEF,yCAAyC;QACzC,MAAM,IAAI,GAAG,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC5D,IAAI,IAAI,EAAE,CAAC;YACT,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QACpB,CAAC;QAED,kDAAkD;QAClD,MAAM,YAAY,GAAG,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;QAC7E,IAAI,YAAY,EAAE,CAAC;YACjB,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC;QACpC,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;;OAQG;IACH,qBAAqB,CAAC,GAAW;QAC/B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;QAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAElC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,0CAA0C;QAC1C,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC;QAED,uDAAuD;QACvD,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,GAAW;QACf,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;IAED;;;;;;;;;OASG;IACK,wBAAwB,CAAC,OAA4B,EAAE,UAAkB;QAC/E,MAAM,eAAe,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;QAEjD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;YAC7C,IAAI,GAAG,CAAC,WAAW,EAAE,KAAK,eAAe,EAAE,CAAC;gBAC1C,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Documentation loader - loads and parses Compodoc documentation.json
3
+ * Uses strategy pattern to delegate to LocalDocumentationSource or RemoteDocumentationSource
4
+ */
5
+ import { CompodocDocumentation } from '../types/compodoc.js';
6
+ export interface LoadResult {
7
+ success: boolean;
8
+ data?: CompodocDocumentation;
9
+ error?: string;
10
+ }
11
+ export interface DocumentationLoaderOptions {
12
+ path: string;
13
+ watchForChanges?: boolean;
14
+ reloadDebounce?: number;
15
+ timeout?: number;
16
+ maxRetries?: number;
17
+ pollingInterval?: number;
18
+ onReload?: (data: CompodocDocumentation) => void;
19
+ onError?: (error: Error) => void;
20
+ }
21
+ /**
22
+ * DocumentationLoader class
23
+ * Responsible for loading, parsing, and watching the documentation.json file
24
+ * Uses strategy pattern to delegate to appropriate source based on path type
25
+ */
26
+ export declare class DocumentationLoader {
27
+ private source;
28
+ constructor(options: DocumentationLoaderOptions);
29
+ /**
30
+ * Load the documentation from the configured source
31
+ */
32
+ load(): Promise<LoadResult>;
33
+ /**
34
+ * Get the currently loaded documentation
35
+ */
36
+ getCurrentData(): CompodocDocumentation | undefined;
37
+ /**
38
+ * Stop watching the file or polling the URL
39
+ */
40
+ stopWatching(): Promise<void>;
41
+ /**
42
+ * Clean up resources
43
+ */
44
+ dispose(): Promise<void>;
45
+ /**
46
+ * Create appropriate source based on path type
47
+ * @private
48
+ * @param options - DocumentationLoaderOptions
49
+ * @returns DocumentationSource instance (LocalDocumentationSource or RemoteDocumentationSource)
50
+ */
51
+ private createSource;
52
+ }
53
+ /**
54
+ * Helper function to load documentation without watching
55
+ */
56
+ export declare function loadDocumentation(filePath: string): Promise<LoadResult>;
57
+ //# sourceMappingURL=documentation-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentation-loader.d.ts","sourceRoot":"","sources":["../../src/loader/documentation-loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAM7D,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACjD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED;;;;GAIG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAsB;gBAExB,OAAO,EAAE,0BAA0B;IAI/C;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC;IAIjC;;OAEG;IACH,cAAc,IAAI,qBAAqB,GAAG,SAAS;IAInD;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAInC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B;;;;;OAKG;IACH,OAAO,CAAC,YAAY;CA0BrB;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAO7E"}
@@ -0,0 +1,81 @@
1
+ import { LocalDocumentationSource } from './local-documentation-source.js';
2
+ import { RemoteDocumentationSource } from './remote-documentation-source.js';
3
+ import { PathTypeDetector, PathType } from './path-type-detector.js';
4
+ /**
5
+ * DocumentationLoader class
6
+ * Responsible for loading, parsing, and watching the documentation.json file
7
+ * Uses strategy pattern to delegate to appropriate source based on path type
8
+ */
9
+ export class DocumentationLoader {
10
+ source;
11
+ constructor(options) {
12
+ this.source = this.createSource(options);
13
+ }
14
+ /**
15
+ * Load the documentation from the configured source
16
+ */
17
+ async load() {
18
+ return this.source.load();
19
+ }
20
+ /**
21
+ * Get the currently loaded documentation
22
+ */
23
+ getCurrentData() {
24
+ return this.source.getCurrentData();
25
+ }
26
+ /**
27
+ * Stop watching the file or polling the URL
28
+ */
29
+ async stopWatching() {
30
+ await this.source.stopMonitoring();
31
+ }
32
+ /**
33
+ * Clean up resources
34
+ */
35
+ async dispose() {
36
+ await this.source.dispose();
37
+ }
38
+ /**
39
+ * Create appropriate source based on path type
40
+ * @private
41
+ * @param options - DocumentationLoaderOptions
42
+ * @returns DocumentationSource instance (LocalDocumentationSource or RemoteDocumentationSource)
43
+ */
44
+ createSource(options) {
45
+ // Detect path type
46
+ const pathInfo = PathTypeDetector.detect(options.path);
47
+ // Create appropriate source based on path type
48
+ if (pathInfo.type === PathType.LOCAL) {
49
+ // Local file path - use LocalDocumentationSource
50
+ return new LocalDocumentationSource({
51
+ path: pathInfo.normalizedPath,
52
+ watchForChanges: options.watchForChanges ?? true,
53
+ reloadDebounce: options.reloadDebounce ?? 1000,
54
+ onReload: options.onReload,
55
+ onError: options.onError,
56
+ });
57
+ }
58
+ else {
59
+ // Remote URL (HTTP or HTTPS) - use RemoteDocumentationSource
60
+ return new RemoteDocumentationSource({
61
+ url: pathInfo.normalizedPath,
62
+ timeout: options.timeout ?? 10000,
63
+ maxRetries: options.maxRetries ?? 3,
64
+ pollingInterval: options.pollingInterval ?? 60000,
65
+ onReload: options.onReload,
66
+ onError: options.onError,
67
+ });
68
+ }
69
+ }
70
+ }
71
+ /**
72
+ * Helper function to load documentation without watching
73
+ */
74
+ export async function loadDocumentation(filePath) {
75
+ const loader = new DocumentationLoader({
76
+ path: filePath,
77
+ watchForChanges: false,
78
+ });
79
+ return loader.load();
80
+ }
81
+ //# sourceMappingURL=documentation-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentation-loader.js","sourceRoot":"","sources":["../../src/loader/documentation-loader.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAmBrE;;;;GAIG;AACH,MAAM,OAAO,mBAAmB;IACtB,MAAM,CAAsB;IAEpC,YAAY,OAAmC;QAC7C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IAC9B,CAAC;IAED;;;;;OAKG;IACK,YAAY,CAAC,OAAmC;QACtD,mBAAmB;QACnB,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAEvD,+CAA+C;QAC/C,IAAI,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,KAAK,EAAE,CAAC;YACrC,iDAAiD;YACjD,OAAO,IAAI,wBAAwB,CAAC;gBAClC,IAAI,EAAE,QAAQ,CAAC,cAAc;gBAC7B,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,IAAI;gBAChD,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,IAAI;gBAC9C,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;aACzB,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,6DAA6D;YAC7D,OAAO,IAAI,yBAAyB,CAAC;gBACnC,GAAG,EAAE,QAAQ,CAAC,cAAc;gBAC5B,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,KAAK;gBACjC,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,CAAC;gBACnC,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,KAAK;gBACjD,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;aACzB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,QAAgB;IACtD,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC;QACrC,IAAI,EAAE,QAAQ;QACd,eAAe,EAAE,KAAK;KACvB,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Documentation source interface
3
+ * Defines the contract for loading documentation from different sources (local files or remote URLs)
4
+ */
5
+ import { CompodocDocumentation } from '../types/compodoc.js';
6
+ import { LoadResult } from './documentation-loader.js';
7
+ /**
8
+ * DocumentationSource interface
9
+ * Common interface for both local and remote documentation sources
10
+ */
11
+ export interface DocumentationSource {
12
+ /**
13
+ * Load documentation from the source
14
+ * @returns Promise resolving to LoadResult with success status and data or error
15
+ */
16
+ load(): Promise<LoadResult>;
17
+ /**
18
+ * Start monitoring for changes (file watching for local sources, polling for remote sources)
19
+ */
20
+ startMonitoring(): void;
21
+ /**
22
+ * Stop monitoring for changes
23
+ * @returns Promise that resolves when monitoring has been stopped
24
+ */
25
+ stopMonitoring(): Promise<void>;
26
+ /**
27
+ * Get currently loaded documentation data
28
+ * @returns The currently loaded CompodocDocumentation or undefined if not loaded
29
+ */
30
+ getCurrentData(): CompodocDocumentation | undefined;
31
+ /**
32
+ * Clean up resources and dispose of the source
33
+ * @returns Promise that resolves when cleanup is complete
34
+ */
35
+ dispose(): Promise<void>;
36
+ }
37
+ //# sourceMappingURL=documentation-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentation-source.d.ts","sourceRoot":"","sources":["../../src/loader/documentation-source.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IAE5B;;OAEG;IACH,eAAe,IAAI,IAAI,CAAC;IAExB;;;OAGG;IACH,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhC;;;OAGG;IACH,cAAc,IAAI,qBAAqB,GAAG,SAAS,CAAC;IAEpD;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=documentation-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentation-source.js","sourceRoot":"","sources":["../../src/loader/documentation-source.ts"],"names":[],"mappings":""}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Custom error types for documentation loading
3
+ */
4
+ /**
5
+ * Base error class for network-related errors
6
+ */
7
+ export declare class NetworkError extends Error {
8
+ url: string;
9
+ cause?: Error | undefined;
10
+ constructor(message: string, url: string, cause?: Error | undefined);
11
+ }
12
+ /**
13
+ * Error thrown when a request times out
14
+ */
15
+ export declare class TimeoutError extends NetworkError {
16
+ timeout: number;
17
+ constructor(url: string, timeout: number);
18
+ }
19
+ /**
20
+ * Error thrown for HTTP errors (non-2xx status codes)
21
+ */
22
+ export declare class HttpError extends NetworkError {
23
+ statusCode: number;
24
+ statusText: string;
25
+ constructor(message: string, url: string, statusCode: number, statusText: string);
26
+ }
27
+ /**
28
+ * Error thrown when JSON parsing fails
29
+ */
30
+ export declare class ParseError extends Error {
31
+ content: string;
32
+ constructor(message: string, content: string);
33
+ }
34
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/loader/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;IAG5B,GAAG,EAAE,MAAM;IACX,KAAK,CAAC,EAAE,KAAK;gBAFpB,OAAO,EAAE,MAAM,EACR,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,KAAK,YAAA;CAUvB;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,YAAY;IACZ,OAAO,EAAE,MAAM;gBAAnC,GAAG,EAAE,MAAM,EAAS,OAAO,EAAE,MAAM;CAQhD;AAED;;GAEG;AACH,qBAAa,SAAU,SAAQ,YAAY;IAIhC,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,MAAM;gBAHzB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACJ,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM;CAS5B;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACC,OAAO,EAAE,MAAM;gBAAvC,OAAO,EAAE,MAAM,EAAS,OAAO,EAAE,MAAM;CAQpD"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Custom error types for documentation loading
3
+ */
4
+ /**
5
+ * Base error class for network-related errors
6
+ */
7
+ export class NetworkError extends Error {
8
+ url;
9
+ cause;
10
+ constructor(message, url, cause) {
11
+ super(message);
12
+ this.url = url;
13
+ this.cause = cause;
14
+ this.name = 'NetworkError';
15
+ // Maintains proper stack trace for where our error was thrown (only available on V8)
16
+ if (Error.captureStackTrace) {
17
+ Error.captureStackTrace(this, NetworkError);
18
+ }
19
+ }
20
+ }
21
+ /**
22
+ * Error thrown when a request times out
23
+ */
24
+ export class TimeoutError extends NetworkError {
25
+ timeout;
26
+ constructor(url, timeout) {
27
+ super(`Request timeout after ${timeout}ms`, url);
28
+ this.timeout = timeout;
29
+ this.name = 'TimeoutError';
30
+ if (Error.captureStackTrace) {
31
+ Error.captureStackTrace(this, TimeoutError);
32
+ }
33
+ }
34
+ }
35
+ /**
36
+ * Error thrown for HTTP errors (non-2xx status codes)
37
+ */
38
+ export class HttpError extends NetworkError {
39
+ statusCode;
40
+ statusText;
41
+ constructor(message, url, statusCode, statusText) {
42
+ super(message, url);
43
+ this.statusCode = statusCode;
44
+ this.statusText = statusText;
45
+ this.name = 'HttpError';
46
+ if (Error.captureStackTrace) {
47
+ Error.captureStackTrace(this, HttpError);
48
+ }
49
+ }
50
+ }
51
+ /**
52
+ * Error thrown when JSON parsing fails
53
+ */
54
+ export class ParseError extends Error {
55
+ content;
56
+ constructor(message, content) {
57
+ super(message);
58
+ this.content = content;
59
+ this.name = 'ParseError';
60
+ if (Error.captureStackTrace) {
61
+ Error.captureStackTrace(this, ParseError);
62
+ }
63
+ }
64
+ }
65
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/loader/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IAG5B;IACA;IAHT,YACE,OAAe,EACR,GAAW,EACX,KAAa;QAEpB,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,QAAG,GAAH,GAAG,CAAQ;QACX,UAAK,GAAL,KAAK,CAAQ;QAGpB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAE3B,qFAAqF;QACrF,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,YAAY;IACZ;IAAhC,YAAY,GAAW,EAAS,OAAe;QAC7C,KAAK,CAAC,yBAAyB,OAAO,IAAI,EAAE,GAAG,CAAC,CAAC;QADnB,YAAO,GAAP,OAAO,CAAQ;QAE7C,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAE3B,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,YAAY;IAIhC;IACA;IAJT,YACE,OAAe,EACf,GAAW,EACJ,UAAkB,EAClB,UAAkB;QAEzB,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAHb,eAAU,GAAV,UAAU,CAAQ;QAClB,eAAU,GAAV,UAAU,CAAQ;QAGzB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QAExB,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IACC;IAApC,YAAY,OAAe,EAAS,OAAe;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC;QADmB,YAAO,GAAP,OAAO,CAAQ;QAEjD,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QAEzB,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * HTTP client with timeout support and retry logic
3
+ */
4
+ export interface HttpClientOptions {
5
+ timeout: number;
6
+ maxRetries: number;
7
+ retryDelay: number;
8
+ userAgent?: string;
9
+ }
10
+ export interface HttpResponse {
11
+ status: number;
12
+ statusText: string;
13
+ data: string;
14
+ headers: Map<string, string>;
15
+ }
16
+ export declare class HttpClient {
17
+ private options;
18
+ constructor(options: HttpClientOptions);
19
+ /**
20
+ * Fetch content from URL with timeout support and retry logic
21
+ */
22
+ fetch(url: string, headers?: Map<string, string>): Promise<HttpResponse>;
23
+ /**
24
+ * Perform a single fetch attempt with timeout
25
+ */
26
+ private fetchOnce;
27
+ /**
28
+ * Check if error is retryable
29
+ * Retryable: network errors, timeouts, 5xx errors, 408, 429
30
+ * Non-retryable: 4xx client errors (except 408, 429)
31
+ */
32
+ private isRetryableError;
33
+ /**
34
+ * Calculate exponential backoff delay
35
+ * Formula: retryDelay * (2 ^ attempt)
36
+ */
37
+ private calculateBackoff;
38
+ /**
39
+ * Sleep for specified milliseconds
40
+ */
41
+ private sleep;
42
+ }
43
+ //# sourceMappingURL=http-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../src/loader/http-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAoB;gBAEvB,OAAO,EAAE,iBAAiB;IAItC;;OAEG;IACG,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC;IAmC9E;;OAEG;YACW,SAAS;IAoDvB;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAgDxB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;OAEG;IACH,OAAO,CAAC,KAAK;CAGd"}