promidas 2.0.0

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 (295) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +179 -0
  3. package/dist/builder.d.ts +158 -0
  4. package/dist/builder.d.ts.map +1 -0
  5. package/dist/builder.js +255 -0
  6. package/dist/builder.js.map +1 -0
  7. package/dist/factory.d.ts +154 -0
  8. package/dist/factory.d.ts.map +1 -0
  9. package/dist/factory.js +243 -0
  10. package/dist/factory.js.map +1 -0
  11. package/dist/fetcher/client/config.d.ts +140 -0
  12. package/dist/fetcher/client/config.d.ts.map +1 -0
  13. package/dist/fetcher/client/config.js +2 -0
  14. package/dist/fetcher/client/config.js.map +1 -0
  15. package/dist/fetcher/client/fetch-with-progress.d.ts +156 -0
  16. package/dist/fetcher/client/fetch-with-progress.d.ts.map +1 -0
  17. package/dist/fetcher/client/fetch-with-progress.js +313 -0
  18. package/dist/fetcher/client/fetch-with-progress.js.map +1 -0
  19. package/dist/fetcher/client/fetch-with-timeout.d.ts +6 -0
  20. package/dist/fetcher/client/fetch-with-timeout.d.ts.map +1 -0
  21. package/dist/fetcher/client/fetch-with-timeout.js +48 -0
  22. package/dist/fetcher/client/fetch-with-timeout.js.map +1 -0
  23. package/dist/fetcher/client/protopedia-api-custom-client.d.ts +141 -0
  24. package/dist/fetcher/client/protopedia-api-custom-client.d.ts.map +1 -0
  25. package/dist/fetcher/client/protopedia-api-custom-client.js +268 -0
  26. package/dist/fetcher/client/protopedia-api-custom-client.js.map +1 -0
  27. package/dist/fetcher/client/select-custom-fetch.d.ts +58 -0
  28. package/dist/fetcher/client/select-custom-fetch.d.ts.map +1 -0
  29. package/dist/fetcher/client/select-custom-fetch.js +58 -0
  30. package/dist/fetcher/client/select-custom-fetch.js.map +1 -0
  31. package/dist/fetcher/errors/fetcher-error.d.ts +10 -0
  32. package/dist/fetcher/errors/fetcher-error.d.ts.map +1 -0
  33. package/dist/fetcher/errors/fetcher-error.js +15 -0
  34. package/dist/fetcher/errors/fetcher-error.js.map +1 -0
  35. package/dist/fetcher/index.d.ts +73 -0
  36. package/dist/fetcher/index.d.ts.map +1 -0
  37. package/dist/fetcher/index.js +70 -0
  38. package/dist/fetcher/index.js.map +1 -0
  39. package/dist/fetcher/types/index.d.ts +9 -0
  40. package/dist/fetcher/types/index.d.ts.map +1 -0
  41. package/dist/fetcher/types/index.js +7 -0
  42. package/dist/fetcher/types/index.js.map +1 -0
  43. package/dist/fetcher/types/progress-event.types.d.ts +221 -0
  44. package/dist/fetcher/types/progress-event.types.d.ts.map +1 -0
  45. package/dist/fetcher/types/progress-event.types.js +10 -0
  46. package/dist/fetcher/types/progress-event.types.js.map +1 -0
  47. package/dist/fetcher/types/prototype-api.types.d.ts +106 -0
  48. package/dist/fetcher/types/prototype-api.types.d.ts.map +1 -0
  49. package/dist/fetcher/types/prototype-api.types.js +2 -0
  50. package/dist/fetcher/types/prototype-api.types.js.map +1 -0
  51. package/dist/fetcher/types/result.types.d.ts +75 -0
  52. package/dist/fetcher/types/result.types.d.ts.map +1 -0
  53. package/dist/fetcher/types/result.types.js +2 -0
  54. package/dist/fetcher/types/result.types.js.map +1 -0
  55. package/dist/fetcher/utils/create-client-fetch.d.ts +63 -0
  56. package/dist/fetcher/utils/create-client-fetch.d.ts.map +1 -0
  57. package/dist/fetcher/utils/create-client-fetch.js +89 -0
  58. package/dist/fetcher/utils/create-client-fetch.js.map +1 -0
  59. package/dist/fetcher/utils/create-fetch-with-stripped-headers.d.ts +6 -0
  60. package/dist/fetcher/utils/create-fetch-with-stripped-headers.d.ts.map +1 -0
  61. package/dist/fetcher/utils/create-fetch-with-stripped-headers.js +40 -0
  62. package/dist/fetcher/utils/create-fetch-with-stripped-headers.js.map +1 -0
  63. package/dist/fetcher/utils/errors/handler.d.ts +58 -0
  64. package/dist/fetcher/utils/errors/handler.d.ts.map +1 -0
  65. package/dist/fetcher/utils/errors/handler.js +243 -0
  66. package/dist/fetcher/utils/errors/handler.js.map +1 -0
  67. package/dist/fetcher/utils/errors/messages.d.ts +75 -0
  68. package/dist/fetcher/utils/errors/messages.d.ts.map +1 -0
  69. package/dist/fetcher/utils/errors/messages.js +88 -0
  70. package/dist/fetcher/utils/errors/messages.js.map +1 -0
  71. package/dist/fetcher/utils/index.d.ts +13 -0
  72. package/dist/fetcher/utils/index.d.ts.map +1 -0
  73. package/dist/fetcher/utils/index.js +12 -0
  74. package/dist/fetcher/utils/index.js.map +1 -0
  75. package/dist/fetcher/utils/log-timestamp-normalization-warnings.d.ts +10 -0
  76. package/dist/fetcher/utils/log-timestamp-normalization-warnings.d.ts.map +1 -0
  77. package/dist/fetcher/utils/log-timestamp-normalization-warnings.js +32 -0
  78. package/dist/fetcher/utils/log-timestamp-normalization-warnings.js.map +1 -0
  79. package/dist/fetcher/utils/normalize-protopedia-timestamp.d.ts +59 -0
  80. package/dist/fetcher/utils/normalize-protopedia-timestamp.d.ts.map +1 -0
  81. package/dist/fetcher/utils/normalize-protopedia-timestamp.js +81 -0
  82. package/dist/fetcher/utils/normalize-protopedia-timestamp.js.map +1 -0
  83. package/dist/fetcher/utils/normalize-prototype.d.ts +56 -0
  84. package/dist/fetcher/utils/normalize-prototype.d.ts.map +1 -0
  85. package/dist/fetcher/utils/normalize-prototype.js +113 -0
  86. package/dist/fetcher/utils/normalize-prototype.js.map +1 -0
  87. package/dist/fetcher/utils/sanitize-options.d.ts +14 -0
  88. package/dist/fetcher/utils/sanitize-options.d.ts.map +1 -0
  89. package/dist/fetcher/utils/sanitize-options.js +16 -0
  90. package/dist/fetcher/utils/sanitize-options.js.map +1 -0
  91. package/dist/fetcher/utils/string-parsers.d.ts +45 -0
  92. package/dist/fetcher/utils/string-parsers.d.ts.map +1 -0
  93. package/dist/fetcher/utils/string-parsers.js +53 -0
  94. package/dist/fetcher/utils/string-parsers.js.map +1 -0
  95. package/dist/index.d.ts +66 -0
  96. package/dist/index.d.ts.map +1 -0
  97. package/dist/index.js +70 -0
  98. package/dist/index.js.map +1 -0
  99. package/dist/logger/console-logger.d.ts +74 -0
  100. package/dist/logger/console-logger.d.ts.map +1 -0
  101. package/dist/logger/console-logger.js +113 -0
  102. package/dist/logger/console-logger.js.map +1 -0
  103. package/dist/logger/factory.d.ts +88 -0
  104. package/dist/logger/factory.d.ts.map +1 -0
  105. package/dist/logger/factory.js +94 -0
  106. package/dist/logger/factory.js.map +1 -0
  107. package/dist/logger/index.d.ts +42 -0
  108. package/dist/logger/index.d.ts.map +1 -0
  109. package/dist/logger/index.js +41 -0
  110. package/dist/logger/index.js.map +1 -0
  111. package/dist/logger/logger.types.d.ts +49 -0
  112. package/dist/logger/logger.types.d.ts.map +1 -0
  113. package/dist/logger/logger.types.js +2 -0
  114. package/dist/logger/logger.types.js.map +1 -0
  115. package/dist/repository/errors/validation-error.d.ts +24 -0
  116. package/dist/repository/errors/validation-error.d.ts.map +1 -0
  117. package/dist/repository/errors/validation-error.js +26 -0
  118. package/dist/repository/errors/validation-error.js.map +1 -0
  119. package/dist/repository/index.d.ts +122 -0
  120. package/dist/repository/index.d.ts.map +1 -0
  121. package/dist/repository/index.js +44 -0
  122. package/dist/repository/index.js.map +1 -0
  123. package/dist/repository/protopedia-in-memory-repository.d.ts +560 -0
  124. package/dist/repository/protopedia-in-memory-repository.d.ts.map +1 -0
  125. package/dist/repository/protopedia-in-memory-repository.js +929 -0
  126. package/dist/repository/protopedia-in-memory-repository.js.map +1 -0
  127. package/dist/repository/schemas/index.d.ts +9 -0
  128. package/dist/repository/schemas/index.d.ts.map +1 -0
  129. package/dist/repository/schemas/index.js +11 -0
  130. package/dist/repository/schemas/index.js.map +1 -0
  131. package/dist/repository/schemas/params.d.ts +44 -0
  132. package/dist/repository/schemas/params.d.ts.map +1 -0
  133. package/dist/repository/schemas/params.js +44 -0
  134. package/dist/repository/schemas/params.js.map +1 -0
  135. package/dist/repository/schemas/serializable-snapshot.d.ts +33 -0
  136. package/dist/repository/schemas/serializable-snapshot.d.ts.map +1 -0
  137. package/dist/repository/schemas/serializable-snapshot.js +45 -0
  138. package/dist/repository/schemas/serializable-snapshot.js.map +1 -0
  139. package/dist/repository/types/analysis.types.d.ts +89 -0
  140. package/dist/repository/types/analysis.types.d.ts.map +1 -0
  141. package/dist/repository/types/analysis.types.js +2 -0
  142. package/dist/repository/types/analysis.types.js.map +1 -0
  143. package/dist/repository/types/index.d.ts +12 -0
  144. package/dist/repository/types/index.d.ts.map +1 -0
  145. package/dist/repository/types/index.js +7 -0
  146. package/dist/repository/types/index.js.map +1 -0
  147. package/dist/repository/types/repository-events.types.d.ts +110 -0
  148. package/dist/repository/types/repository-events.types.d.ts.map +1 -0
  149. package/dist/repository/types/repository-events.types.js +2 -0
  150. package/dist/repository/types/repository-events.types.js.map +1 -0
  151. package/dist/repository/types/repository.types.d.ts +330 -0
  152. package/dist/repository/types/repository.types.d.ts.map +1 -0
  153. package/dist/repository/types/repository.types.js +2 -0
  154. package/dist/repository/types/repository.types.js.map +1 -0
  155. package/dist/repository/types/result.types.d.ts +55 -0
  156. package/dist/repository/types/result.types.d.ts.map +1 -0
  157. package/dist/repository/types/result.types.js +2 -0
  158. package/dist/repository/types/result.types.js.map +1 -0
  159. package/dist/repository/types/serialization.types.d.ts +61 -0
  160. package/dist/repository/types/serialization.types.d.ts.map +1 -0
  161. package/dist/repository/types/serialization.types.js +2 -0
  162. package/dist/repository/types/serialization.types.js.map +1 -0
  163. package/dist/repository/types/snapshot-operation.types.d.ts +140 -0
  164. package/dist/repository/types/snapshot-operation.types.d.ts.map +1 -0
  165. package/dist/repository/types/snapshot-operation.types.js +2 -0
  166. package/dist/repository/types/snapshot-operation.types.js.map +1 -0
  167. package/dist/repository/utils/convert-fetch-result.d.ts +46 -0
  168. package/dist/repository/utils/convert-fetch-result.d.ts.map +1 -0
  169. package/dist/repository/utils/convert-fetch-result.js +59 -0
  170. package/dist/repository/utils/convert-fetch-result.js.map +1 -0
  171. package/dist/repository/utils/convert-store-result.d.ts +36 -0
  172. package/dist/repository/utils/convert-store-result.d.ts.map +1 -0
  173. package/dist/repository/utils/convert-store-result.js +36 -0
  174. package/dist/repository/utils/convert-store-result.js.map +1 -0
  175. package/dist/repository/utils/emit-repository-event-safely.d.ts +5 -0
  176. package/dist/repository/utils/emit-repository-event-safely.d.ts.map +1 -0
  177. package/dist/repository/utils/emit-repository-event-safely.js +17 -0
  178. package/dist/repository/utils/emit-repository-event-safely.js.map +1 -0
  179. package/dist/repository/utils/index.d.ts +3 -0
  180. package/dist/repository/utils/index.d.ts.map +1 -0
  181. package/dist/repository/utils/index.js +3 -0
  182. package/dist/repository/utils/index.js.map +1 -0
  183. package/dist/repository/validation/index.d.ts +9 -0
  184. package/dist/repository/validation/index.d.ts.map +1 -0
  185. package/dist/repository/validation/index.js +10 -0
  186. package/dist/repository/validation/index.js.map +1 -0
  187. package/dist/repository/validation/params-validators.d.ts +46 -0
  188. package/dist/repository/validation/params-validators.d.ts.map +1 -0
  189. package/dist/repository/validation/params-validators.js +68 -0
  190. package/dist/repository/validation/params-validators.js.map +1 -0
  191. package/dist/repository/validation/serializable-snapshot.d.ts +47 -0
  192. package/dist/repository/validation/serializable-snapshot.d.ts.map +1 -0
  193. package/dist/repository/validation/serializable-snapshot.js +104 -0
  194. package/dist/repository/validation/serializable-snapshot.js.map +1 -0
  195. package/dist/schemas/index.d.ts +8 -0
  196. package/dist/schemas/index.d.ts.map +1 -0
  197. package/dist/schemas/index.js +8 -0
  198. package/dist/schemas/index.js.map +1 -0
  199. package/dist/schemas/normalized-prototype.d.ts +56 -0
  200. package/dist/schemas/normalized-prototype.d.ts.map +1 -0
  201. package/dist/schemas/normalized-prototype.js +123 -0
  202. package/dist/schemas/normalized-prototype.js.map +1 -0
  203. package/dist/store/errors/store-error.d.ts +148 -0
  204. package/dist/store/errors/store-error.d.ts.map +1 -0
  205. package/dist/store/errors/store-error.js +156 -0
  206. package/dist/store/errors/store-error.js.map +1 -0
  207. package/dist/store/index.d.ts +84 -0
  208. package/dist/store/index.d.ts.map +1 -0
  209. package/dist/store/index.js +83 -0
  210. package/dist/store/index.js.map +1 -0
  211. package/dist/store/store.d.ts +295 -0
  212. package/dist/store/store.d.ts.map +1 -0
  213. package/dist/store/store.js +411 -0
  214. package/dist/store/store.js.map +1 -0
  215. package/dist/store/types/index.d.ts +2 -0
  216. package/dist/store/types/index.d.ts.map +1 -0
  217. package/dist/store/types/index.js +2 -0
  218. package/dist/store/types/index.js.map +1 -0
  219. package/dist/store/types/result.types.d.ts +67 -0
  220. package/dist/store/types/result.types.d.ts.map +1 -0
  221. package/dist/store/types/result.types.js +2 -0
  222. package/dist/store/types/result.types.js.map +1 -0
  223. package/dist/types/codes.d.ts +44 -0
  224. package/dist/types/codes.d.ts.map +1 -0
  225. package/dist/types/codes.js +9 -0
  226. package/dist/types/codes.js.map +1 -0
  227. package/dist/types/index.d.ts +61 -0
  228. package/dist/types/index.d.ts.map +1 -0
  229. package/dist/types/index.js +60 -0
  230. package/dist/types/index.js.map +1 -0
  231. package/dist/types/normalized-prototype.d.ts +95 -0
  232. package/dist/types/normalized-prototype.d.ts.map +1 -0
  233. package/dist/types/normalized-prototype.js +2 -0
  234. package/dist/types/normalized-prototype.js.map +1 -0
  235. package/dist/utils/converters/index.d.ts +15 -0
  236. package/dist/utils/converters/index.d.ts.map +1 -0
  237. package/dist/utils/converters/index.js +15 -0
  238. package/dist/utils/converters/index.js.map +1 -0
  239. package/dist/utils/converters/license-type.d.ts +23 -0
  240. package/dist/utils/converters/license-type.d.ts.map +1 -0
  241. package/dist/utils/converters/license-type.js +38 -0
  242. package/dist/utils/converters/license-type.js.map +1 -0
  243. package/dist/utils/converters/release-flag.d.ts +24 -0
  244. package/dist/utils/converters/release-flag.d.ts.map +1 -0
  245. package/dist/utils/converters/release-flag.js +40 -0
  246. package/dist/utils/converters/release-flag.js.map +1 -0
  247. package/dist/utils/converters/status.d.ts +23 -0
  248. package/dist/utils/converters/status.d.ts.map +1 -0
  249. package/dist/utils/converters/status.js +40 -0
  250. package/dist/utils/converters/status.js.map +1 -0
  251. package/dist/utils/converters/thanks-flag.d.ts +25 -0
  252. package/dist/utils/converters/thanks-flag.d.ts.map +1 -0
  253. package/dist/utils/converters/thanks-flag.js +41 -0
  254. package/dist/utils/converters/thanks-flag.js.map +1 -0
  255. package/dist/utils/deep-merge.d.ts +38 -0
  256. package/dist/utils/deep-merge.d.ts.map +1 -0
  257. package/dist/utils/deep-merge.js +85 -0
  258. package/dist/utils/deep-merge.js.map +1 -0
  259. package/dist/utils/index.d.ts +80 -0
  260. package/dist/utils/index.d.ts.map +1 -0
  261. package/dist/utils/index.js +85 -0
  262. package/dist/utils/index.js.map +1 -0
  263. package/dist/utils/logger-utils.d.ts +100 -0
  264. package/dist/utils/logger-utils.d.ts.map +1 -0
  265. package/dist/utils/logger-utils.js +265 -0
  266. package/dist/utils/logger-utils.js.map +1 -0
  267. package/dist/utils/time/constants.d.ts +14 -0
  268. package/dist/utils/time/constants.d.ts.map +1 -0
  269. package/dist/utils/time/constants.js +14 -0
  270. package/dist/utils/time/constants.js.map +1 -0
  271. package/dist/utils/time/index.d.ts +28 -0
  272. package/dist/utils/time/index.d.ts.map +1 -0
  273. package/dist/utils/time/index.js +28 -0
  274. package/dist/utils/time/index.js.map +1 -0
  275. package/dist/utils/time/parser.d.ts +91 -0
  276. package/dist/utils/time/parser.d.ts.map +1 -0
  277. package/dist/utils/time/parser.js +143 -0
  278. package/dist/utils/time/parser.js.map +1 -0
  279. package/dist/utils/validation/index.d.ts +8 -0
  280. package/dist/utils/validation/index.d.ts.map +1 -0
  281. package/dist/utils/validation/index.js +7 -0
  282. package/dist/utils/validation/index.js.map +1 -0
  283. package/dist/utils/validation/normalized-prototype.d.ts +64 -0
  284. package/dist/utils/validation/normalized-prototype.d.ts.map +1 -0
  285. package/dist/utils/validation/normalized-prototype.js +97 -0
  286. package/dist/utils/validation/normalized-prototype.js.map +1 -0
  287. package/dist/utils/validation/types.d.ts +62 -0
  288. package/dist/utils/validation/types.d.ts.map +1 -0
  289. package/dist/utils/validation/types.js +8 -0
  290. package/dist/utils/validation/types.js.map +1 -0
  291. package/dist/version.d.ts +6 -0
  292. package/dist/version.d.ts.map +1 -0
  293. package/dist/version.js +6 -0
  294. package/dist/version.js.map +1 -0
  295. package/package.json +138 -0
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @module protopedia/utils
3
+ *
4
+ * Utility functions for ProtoPedia API data processing.
5
+ */
6
+ export { splitPipeSeparatedString } from './string-parsers.js';
7
+ export { normalizePrototype } from './normalize-prototype.js';
8
+ export { normalizeProtoPediaTimestamp } from './normalize-protopedia-timestamp.js';
9
+ export { handleApiError } from './errors/handler.js';
10
+ export { PromidasTimeoutError } from '../errors/fetcher-error.js';
11
+ export { resolveErrorMessage, constructDisplayMessage, } from './errors/messages.js';
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/fetcher/utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAG9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAEnF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Logger } from '../../logger/index.js';
2
+ import type { NormalizedPrototype } from '../../types/index.js';
3
+ import type { UpstreamPrototype } from '../types/prototype-api.types.js';
4
+ export declare function logTimestampNormalizationWarnings(params: {
5
+ logger: Logger;
6
+ original: UpstreamPrototype;
7
+ normalized: NormalizedPrototype;
8
+ index: number;
9
+ }): void;
10
+ //# sourceMappingURL=log-timestamp-normalization-warnings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-timestamp-normalization-warnings.d.ts","sourceRoot":"","sources":["../../../lib/fetcher/utils/log-timestamp-normalization-warnings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,wBAAgB,iCAAiC,CAAC,MAAM,EAAE;IACxD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,UAAU,EAAE,mBAAmB,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,IAAI,CAwCP"}
@@ -0,0 +1,32 @@
1
+ export function logTimestampNormalizationWarnings(params) {
2
+ const { logger, original, normalized, index } = params;
3
+ // Check for date normalization failures.
4
+ // If the normalized value is the same as the original (and not null/undefined)
5
+ // but doesn't look like a normalized UTC ISO string (ending in 'Z'), it likely failed parsing.
6
+ const context = { prototypeId: original.id, index };
7
+ if (original.createDate &&
8
+ normalized.createDate === original.createDate &&
9
+ !normalized.createDate.endsWith('Z')) {
10
+ logger.warn('Failed to parse and normalize createDate', {
11
+ ...context,
12
+ originalValue: original.createDate,
13
+ });
14
+ }
15
+ if (original.updateDate &&
16
+ normalized.updateDate === original.updateDate &&
17
+ !normalized.updateDate.endsWith('Z')) {
18
+ logger.warn('Failed to parse and normalize updateDate', {
19
+ ...context,
20
+ originalValue: original.updateDate,
21
+ });
22
+ }
23
+ if (original.releaseDate &&
24
+ normalized.releaseDate === original.releaseDate &&
25
+ !normalized.releaseDate.endsWith('Z')) {
26
+ logger.warn('Failed to parse and normalize releaseDate', {
27
+ ...context,
28
+ originalValue: original.releaseDate,
29
+ });
30
+ }
31
+ }
32
+ //# sourceMappingURL=log-timestamp-normalization-warnings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-timestamp-normalization-warnings.js","sourceRoot":"","sources":["../../../lib/fetcher/utils/log-timestamp-normalization-warnings.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,iCAAiC,CAAC,MAKjD;IACC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAEvD,yCAAyC;IACzC,+EAA+E;IAC/E,+FAA+F;IAC/F,MAAM,OAAO,GAAG,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC;IAEpD,IACE,QAAQ,CAAC,UAAU;QACnB,UAAU,CAAC,UAAU,KAAK,QAAQ,CAAC,UAAU;QAC7C,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EACpC,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,0CAA0C,EAAE;YACtD,GAAG,OAAO;YACV,aAAa,EAAE,QAAQ,CAAC,UAAU;SACnC,CAAC,CAAC;IACL,CAAC;IAED,IACE,QAAQ,CAAC,UAAU;QACnB,UAAU,CAAC,UAAU,KAAK,QAAQ,CAAC,UAAU;QAC7C,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EACpC,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,0CAA0C,EAAE;YACtD,GAAG,OAAO;YACV,aAAa,EAAE,QAAQ,CAAC,UAAU;SACnC,CAAC,CAAC;IACL,CAAC;IAED,IACE,QAAQ,CAAC,WAAW;QACpB,UAAU,CAAC,WAAW,KAAK,QAAQ,CAAC,WAAW;QAC/C,CAAC,UAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,EACrC,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,2CAA2C,EAAE;YACvD,GAAG,OAAO;YACV,aAAa,EAAE,QAAQ,CAAC,WAAW;SACpC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Timestamp normalization utilities for ProtoPedia.
3
+ *
4
+ * @module utils/time/normalize
5
+ */
6
+ /**
7
+ * Normalize ProtoPedia timestamps to UTC ISO strings.
8
+ *
9
+ * This function attempts to parse timestamps using multiple strategies:
10
+ *
11
+ * 1. **ProtoPedia format** (`parseProtoPediaTimestamp`):
12
+ * - Current format: `YYYY-MM-DD HH:MM:SS.0` (space separator, `.0` for zero milliseconds)
13
+ * - Accepts variable-length fractional seconds for future compatibility
14
+ * - Timezone: Always treated as JST (UTC+9)
15
+ * - Returns UTC ISO string with JST offset subtracted
16
+ *
17
+ * 2. **W3C-DTF with timezone** (`parseW3cDtfTimestamp`):
18
+ * - Accepts W3C-DTF Level 4-6 formats with mandatory timezone designator (TZD)
19
+ * - Examples: `2025-11-14T12:03Z`, `2025-11-14T12:03:07+09:00`
20
+ * - Returns UTC ISO string
21
+ * - **Does NOT accept** timezone-less formats or offset without colon
22
+ *
23
+ * 3. **Passthrough**:
24
+ * - If both parsers fail, returns the input value as-is
25
+ * - Allows downstream code to handle or log unexpected formats
26
+ *
27
+ * **Special cases**:
28
+ * - `null` input → `null` output (preserves explicit null in API responses)
29
+ * - `undefined` input → `undefined` output (preserves field absence)
30
+ * - Empty string or invalid format → returned as-is
31
+ *
32
+ * **Testing note**:
33
+ * This function is primarily tested through integration scenarios.
34
+ * Detailed format validation and edge cases are covered by unit tests
35
+ * for `parseProtoPediaTimestamp` and `parseW3cDtfTimestamp`.
36
+ *
37
+ * @param value - Timestamp string, null, or undefined from API response
38
+ * @returns UTC ISO string, null, undefined, or original value
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * // ProtoPedia format (JST)
43
+ * normalizeProtoPediaTimestamp('2025-11-14 12:03:07.0')
44
+ * // => '2025-11-14T03:03:07.000Z'
45
+ *
46
+ * // ISO 8601 with timezone
47
+ * normalizeProtoPediaTimestamp('2025-11-14T12:03:07+09:00')
48
+ * // => '2025-11-14T03:03:07.000Z'
49
+ *
50
+ * // null/undefined preservation
51
+ * normalizeProtoPediaTimestamp(null) // => null
52
+ * normalizeProtoPediaTimestamp(undefined) // => undefined
53
+ *
54
+ * // Invalid format passthrough
55
+ * normalizeProtoPediaTimestamp('invalid') // => 'invalid'
56
+ * ```
57
+ */
58
+ export declare function normalizeProtoPediaTimestamp(value: string | null | undefined): string | null | undefined;
59
+ //# sourceMappingURL=normalize-protopedia-timestamp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-protopedia-timestamp.d.ts","sourceRoot":"","sources":["../../../lib/fetcher/utils/normalize-protopedia-timestamp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC/B,MAAM,GAAG,IAAI,GAAG,SAAS,CAuB3B"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Timestamp normalization utilities for ProtoPedia.
3
+ *
4
+ * @module utils/time/normalize
5
+ */
6
+ import { parseProtoPediaTimestamp } from '../../utils/time/parser.js';
7
+ import { parseW3cDtfTimestamp } from '../../utils/time/parser.js';
8
+ /**
9
+ * Normalize ProtoPedia timestamps to UTC ISO strings.
10
+ *
11
+ * This function attempts to parse timestamps using multiple strategies:
12
+ *
13
+ * 1. **ProtoPedia format** (`parseProtoPediaTimestamp`):
14
+ * - Current format: `YYYY-MM-DD HH:MM:SS.0` (space separator, `.0` for zero milliseconds)
15
+ * - Accepts variable-length fractional seconds for future compatibility
16
+ * - Timezone: Always treated as JST (UTC+9)
17
+ * - Returns UTC ISO string with JST offset subtracted
18
+ *
19
+ * 2. **W3C-DTF with timezone** (`parseW3cDtfTimestamp`):
20
+ * - Accepts W3C-DTF Level 4-6 formats with mandatory timezone designator (TZD)
21
+ * - Examples: `2025-11-14T12:03Z`, `2025-11-14T12:03:07+09:00`
22
+ * - Returns UTC ISO string
23
+ * - **Does NOT accept** timezone-less formats or offset without colon
24
+ *
25
+ * 3. **Passthrough**:
26
+ * - If both parsers fail, returns the input value as-is
27
+ * - Allows downstream code to handle or log unexpected formats
28
+ *
29
+ * **Special cases**:
30
+ * - `null` input → `null` output (preserves explicit null in API responses)
31
+ * - `undefined` input → `undefined` output (preserves field absence)
32
+ * - Empty string or invalid format → returned as-is
33
+ *
34
+ * **Testing note**:
35
+ * This function is primarily tested through integration scenarios.
36
+ * Detailed format validation and edge cases are covered by unit tests
37
+ * for `parseProtoPediaTimestamp` and `parseW3cDtfTimestamp`.
38
+ *
39
+ * @param value - Timestamp string, null, or undefined from API response
40
+ * @returns UTC ISO string, null, undefined, or original value
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * // ProtoPedia format (JST)
45
+ * normalizeProtoPediaTimestamp('2025-11-14 12:03:07.0')
46
+ * // => '2025-11-14T03:03:07.000Z'
47
+ *
48
+ * // ISO 8601 with timezone
49
+ * normalizeProtoPediaTimestamp('2025-11-14T12:03:07+09:00')
50
+ * // => '2025-11-14T03:03:07.000Z'
51
+ *
52
+ * // null/undefined preservation
53
+ * normalizeProtoPediaTimestamp(null) // => null
54
+ * normalizeProtoPediaTimestamp(undefined) // => undefined
55
+ *
56
+ * // Invalid format passthrough
57
+ * normalizeProtoPediaTimestamp('invalid') // => 'invalid'
58
+ * ```
59
+ */
60
+ export function normalizeProtoPediaTimestamp(value) {
61
+ // Preserve null/undefined as-is
62
+ if (value === null) {
63
+ return null;
64
+ }
65
+ if (value === undefined) {
66
+ return undefined;
67
+ }
68
+ // Try ProtoPedia format first (JST-based, strict format)
69
+ const protoPediaResult = parseProtoPediaTimestamp(value);
70
+ if (protoPediaResult !== undefined) {
71
+ return protoPediaResult;
72
+ }
73
+ // Fall back to W3C-DTF parsing (handles ISO 8601 with explicit timezone)
74
+ const w3cDtfResult = parseW3cDtfTimestamp(value);
75
+ if (w3cDtfResult !== undefined) {
76
+ return w3cDtfResult;
77
+ }
78
+ // Return as-is if unparseable (allows downstream handling)
79
+ return value;
80
+ }
81
+ //# sourceMappingURL=normalize-protopedia-timestamp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-protopedia-timestamp.js","sourceRoot":"","sources":["../../../lib/fetcher/utils/normalize-protopedia-timestamp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,MAAM,UAAU,4BAA4B,CAC1C,KAAgC;IAEhC,gCAAgC;IAChC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,yDAAyD;IACzD,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,KAAK,CAAC,CAAC;IACzD,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,yEAAyE;IACzE,MAAM,YAAY,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IACjD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,2DAA2D;IAC3D,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Prototype normalization utilities for ProtoPedia API responses.
3
+ *
4
+ * @module fetcher/utils/normalize-prototype
5
+ */
6
+ import type { NormalizedPrototype } from '../../types/index.js';
7
+ import type { UpstreamPrototype } from '../types/prototype-api.types.js';
8
+ /**
9
+ * Transform an upstream prototype object into the normalized shape.
10
+ *
11
+ * This function maps all fields from {@link UpstreamPrototype} to
12
+ * {@link NormalizedPrototype}, applying the following transformations:
13
+ *
14
+ * **Pipe-separated fields** (split into trimmed arrays):
15
+ * - tags, users, awards, events, materials
16
+ * - Uses {@link splitPipeSeparatedString}
17
+ * - Empty segments filtered out
18
+ * - null/undefined → empty array
19
+ *
20
+ * **Timestamp fields** (normalized to UTC ISO strings):
21
+ * - createDate, updateDate: ProtoPedia JST format → UTC
22
+ * - releaseDate: ProtoPedia JST format → UTC, null/undefined → undefined
23
+ * - Uses {@link normalizeProtoPediaTimestamp}
24
+ * - Fallback to original string if parsing fails
25
+ *
26
+ * **Optional fields** (default values when null/undefined):
27
+ * - releaseFlg: 2 (Released)
28
+ * - revision: 0
29
+ * - licenseType: 1
30
+ * - thanksFlg: 0
31
+ * - String fields (summary, freeComment, etc.): ''
32
+ *
33
+ * **Other fields**: Copied as-is
34
+ *
35
+ * @param prototype - The raw prototype object from the ProtoPedia API.
36
+ * @returns A {@link NormalizedPrototype} instance with all fields normalized.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const upstream: UpstreamPrototype = {
41
+ * id: 123,
42
+ * prototypeNm: 'My Project',
43
+ * tags: 'IoT | AI | Robotics',
44
+ * users: 'user1|user2',
45
+ * createDate: '2024-01-01 12:00:00.0',
46
+ * // ...other fields
47
+ * };
48
+ *
49
+ * const normalized = normalizePrototype(upstream);
50
+ * // normalized.tags => ['IoT', 'AI', 'Robotics']
51
+ * // normalized.users => ['user1', 'user2']
52
+ * // normalized.createDate => '2024-01-01T03:00:00.000Z' (JST → UTC)
53
+ * ```
54
+ */
55
+ export declare function normalizePrototype(p: UpstreamPrototype): NormalizedPrototype;
56
+ //# sourceMappingURL=normalize-prototype.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-prototype.d.ts","sourceRoot":"","sources":["../../../lib/fetcher/utils/normalize-prototype.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAEV,mBAAmB,EAIpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAKzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,iBAAiB,GAAG,mBAAmB,CA4E5E"}
@@ -0,0 +1,113 @@
1
+ import { normalizeProtoPediaTimestamp } from './normalize-protopedia-timestamp.js';
2
+ import { splitPipeSeparatedString } from './string-parsers.js';
3
+ /**
4
+ * Transform an upstream prototype object into the normalized shape.
5
+ *
6
+ * This function maps all fields from {@link UpstreamPrototype} to
7
+ * {@link NormalizedPrototype}, applying the following transformations:
8
+ *
9
+ * **Pipe-separated fields** (split into trimmed arrays):
10
+ * - tags, users, awards, events, materials
11
+ * - Uses {@link splitPipeSeparatedString}
12
+ * - Empty segments filtered out
13
+ * - null/undefined → empty array
14
+ *
15
+ * **Timestamp fields** (normalized to UTC ISO strings):
16
+ * - createDate, updateDate: ProtoPedia JST format → UTC
17
+ * - releaseDate: ProtoPedia JST format → UTC, null/undefined → undefined
18
+ * - Uses {@link normalizeProtoPediaTimestamp}
19
+ * - Fallback to original string if parsing fails
20
+ *
21
+ * **Optional fields** (default values when null/undefined):
22
+ * - releaseFlg: 2 (Released)
23
+ * - revision: 0
24
+ * - licenseType: 1
25
+ * - thanksFlg: 0
26
+ * - String fields (summary, freeComment, etc.): ''
27
+ *
28
+ * **Other fields**: Copied as-is
29
+ *
30
+ * @param prototype - The raw prototype object from the ProtoPedia API.
31
+ * @returns A {@link NormalizedPrototype} instance with all fields normalized.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const upstream: UpstreamPrototype = {
36
+ * id: 123,
37
+ * prototypeNm: 'My Project',
38
+ * tags: 'IoT | AI | Robotics',
39
+ * users: 'user1|user2',
40
+ * createDate: '2024-01-01 12:00:00.0',
41
+ * // ...other fields
42
+ * };
43
+ *
44
+ * const normalized = normalizePrototype(upstream);
45
+ * // normalized.tags => ['IoT', 'AI', 'Robotics']
46
+ * // normalized.users => ['user1', 'user2']
47
+ * // normalized.createDate => '2024-01-01T03:00:00.000Z' (JST → UTC)
48
+ * ```
49
+ */
50
+ export function normalizePrototype(p) {
51
+ // Precompute adjusted date fields
52
+ // createDate: Required field - preserve original value if parsing fails
53
+ // Always ProtoPedia format → UTC ISO string
54
+ const adjustedCreateDate = normalizeProtoPediaTimestamp(p.createDate) ?? p.createDate;
55
+ // updateDate: Optional field - preserve original value if parsing fails
56
+ // Always ProtoPedia format → UTC ISO string
57
+ const adjustedUpdateDate = normalizeProtoPediaTimestamp(p.updateDate) ?? p.updateDate;
58
+ // releaseDate: Optional field - drop to undefined if parsing fails
59
+ // This differs from createDate/updateDate: unparseable release dates
60
+ // are treated as invalid/missing data rather than preserved as-is
61
+ // ProtoPedia format → UTC ISO string, null or undefined → undefined
62
+ const adjustedReleaseDate = normalizeProtoPediaTimestamp(p.releaseDate) ?? undefined;
63
+ const normalized = {
64
+ /* ID */
65
+ id: p.id,
66
+ /* Editorial information */
67
+ createDate: adjustedCreateDate,
68
+ updateDate: adjustedUpdateDate,
69
+ releaseDate: adjustedReleaseDate,
70
+ createId: p.createId,
71
+ updateId: p.updateId,
72
+ releaseFlg: (p.releaseFlg ??
73
+ 2) /* Default to 'Released' */,
74
+ /* Basic information */
75
+ status: p.status,
76
+ prototypeNm: p.prototypeNm,
77
+ summary: p.summary ?? '' /* Default to empty string */,
78
+ freeComment: p.freeComment ?? '' /* Default to empty string */,
79
+ systemDescription: p.systemDescription ?? '' /* Default to empty string */,
80
+ /** Users and Team */
81
+ users: splitPipeSeparatedString(p.users),
82
+ teamNm: p.teamNm ?? '' /* Default to empty string */,
83
+ /** Tags, Materials, Events, and Awards */
84
+ tags: splitPipeSeparatedString(p.tags),
85
+ materials: splitPipeSeparatedString(p.materials),
86
+ events: splitPipeSeparatedString(p.events),
87
+ awards: splitPipeSeparatedString(p.awards),
88
+ /* URLs */
89
+ officialLink: p.officialLink,
90
+ videoUrl: p.videoUrl,
91
+ mainUrl: p.mainUrl,
92
+ relatedLink: p.relatedLink,
93
+ relatedLink2: p.relatedLink2,
94
+ relatedLink3: p.relatedLink3,
95
+ relatedLink4: p.relatedLink4,
96
+ relatedLink5: p.relatedLink5,
97
+ /* counts */
98
+ viewCount: p.viewCount,
99
+ goodCount: p.goodCount,
100
+ commentCount: p.commentCount,
101
+ /* Others */
102
+ uuid: p.uuid,
103
+ nid: p.nid,
104
+ revision: p.revision ?? 0 /* Default to 0 */,
105
+ licenseType: (p.licenseType ??
106
+ 1) /* Default to 1(表示(CC:BY)) */,
107
+ thanksFlg: (p.thanksFlg ??
108
+ 0) /* Default to 0(Message not yet shown) */,
109
+ slideMode: p.slideMode,
110
+ };
111
+ return normalized;
112
+ }
113
+ //# sourceMappingURL=normalize-prototype.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-prototype.js","sourceRoot":"","sources":["../../../lib/fetcher/utils/normalize-prototype.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Utilities for sanitizing API client options.
3
+ *
4
+ * @module
5
+ */
6
+ import type { ProtoPediaApiClientOptions } from 'protopedia-api-v2-client';
7
+ /**
8
+ * Sanitizes ProtopediaApiClientOptions for logging by redacting the token.
9
+ *
10
+ * @param options The options object to sanitize.
11
+ * @returns A new options object with the token redacted.
12
+ */
13
+ export declare function sanitizeProtopediaApiClientOptions(options: ProtoPediaApiClientOptions | undefined): ProtoPediaApiClientOptions | undefined;
14
+ //# sourceMappingURL=sanitize-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize-options.d.ts","sourceRoot":"","sources":["../../../lib/fetcher/utils/sanitize-options.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAE3E;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,0BAA0B,GAAG,SAAS,GAC9C,0BAA0B,GAAG,SAAS,CAQxC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Sanitizes ProtopediaApiClientOptions for logging by redacting the token.
3
+ *
4
+ * @param options The options object to sanitize.
5
+ * @returns A new options object with the token redacted.
6
+ */
7
+ export function sanitizeProtopediaApiClientOptions(options) {
8
+ if (!options) {
9
+ return undefined;
10
+ }
11
+ if (options.token) {
12
+ return { ...options, token: '***' };
13
+ }
14
+ return options;
15
+ }
16
+ //# sourceMappingURL=sanitize-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize-options.js","sourceRoot":"","sources":["../../../lib/fetcher/utils/sanitize-options.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,MAAM,UAAU,kCAAkC,CAChD,OAA+C;IAE/C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IACtC,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * String parsing utilities for ProtoPedia API responses.
3
+ *
4
+ * @module fetcher/utils/string-parsers
5
+ */
6
+ /**
7
+ * Split a pipe-separated string into an array of trimmed segments.
8
+ *
9
+ * The ProtoPedia API returns certain fields (tags, users, awards, events,
10
+ * materials) as pipe-delimited strings. This helper parses such a string
11
+ * into a clean array.
12
+ *
13
+ * **Behavior:**
14
+ * - Splits by pipe character (`|`)
15
+ * - Trims whitespace from each segment
16
+ * - **Filters out empty segments** (empty strings after trimming)
17
+ * - Returns empty array for null, undefined, or empty string input
18
+ *
19
+ * @param value - The pipe-separated string to split. Returns empty array
20
+ * for null, undefined, or empty string.
21
+ * @returns An array of non-empty trimmed string segments.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * splitPipeSeparatedString('tag1|tag2|tag3');
26
+ * // => ['tag1', 'tag2', 'tag3']
27
+ *
28
+ * splitPipeSeparatedString('tag1 | tag2');
29
+ * // => ['tag1', 'tag2'] (whitespace trimmed)
30
+ *
31
+ * splitPipeSeparatedString('a||b');
32
+ * // => ['a', 'b'] (empty segment filtered out)
33
+ *
34
+ * splitPipeSeparatedString('tag1| |tag2');
35
+ * // => ['tag1', 'tag2'] (whitespace-only segment filtered out)
36
+ *
37
+ * splitPipeSeparatedString('');
38
+ * // => []
39
+ *
40
+ * splitPipeSeparatedString(null);
41
+ * // => []
42
+ * ```
43
+ */
44
+ export declare const splitPipeSeparatedString: (value: string | null | undefined) => string[];
45
+ //# sourceMappingURL=string-parsers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-parsers.d.ts","sourceRoot":"","sources":["../../../lib/fetcher/utils/string-parsers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,wBAAwB,GACnC,OAAO,MAAM,GAAG,IAAI,GAAG,SAAS,KAC/B,MAAM,EAQR,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * String parsing utilities for ProtoPedia API responses.
3
+ *
4
+ * @module fetcher/utils/string-parsers
5
+ */
6
+ /**
7
+ * Split a pipe-separated string into an array of trimmed segments.
8
+ *
9
+ * The ProtoPedia API returns certain fields (tags, users, awards, events,
10
+ * materials) as pipe-delimited strings. This helper parses such a string
11
+ * into a clean array.
12
+ *
13
+ * **Behavior:**
14
+ * - Splits by pipe character (`|`)
15
+ * - Trims whitespace from each segment
16
+ * - **Filters out empty segments** (empty strings after trimming)
17
+ * - Returns empty array for null, undefined, or empty string input
18
+ *
19
+ * @param value - The pipe-separated string to split. Returns empty array
20
+ * for null, undefined, or empty string.
21
+ * @returns An array of non-empty trimmed string segments.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * splitPipeSeparatedString('tag1|tag2|tag3');
26
+ * // => ['tag1', 'tag2', 'tag3']
27
+ *
28
+ * splitPipeSeparatedString('tag1 | tag2');
29
+ * // => ['tag1', 'tag2'] (whitespace trimmed)
30
+ *
31
+ * splitPipeSeparatedString('a||b');
32
+ * // => ['a', 'b'] (empty segment filtered out)
33
+ *
34
+ * splitPipeSeparatedString('tag1| |tag2');
35
+ * // => ['tag1', 'tag2'] (whitespace-only segment filtered out)
36
+ *
37
+ * splitPipeSeparatedString('');
38
+ * // => []
39
+ *
40
+ * splitPipeSeparatedString(null);
41
+ * // => []
42
+ * ```
43
+ */
44
+ export const splitPipeSeparatedString = (value) => {
45
+ if (typeof value !== 'string' || value.length === 0) {
46
+ return [];
47
+ }
48
+ return value
49
+ .split('|')
50
+ .map((s) => s.trim())
51
+ .filter((s) => s.length > 0);
52
+ };
53
+ //# sourceMappingURL=string-parsers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-parsers.js","sourceRoot":"","sources":["../../../lib/fetcher/utils/string-parsers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,KAAgC,EACtB,EAAE;IACZ,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,KAAK;SACT,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACjC,CAAC,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Public entrypoint for the promidas library.
3
+ *
4
+ * ## Quick Start
5
+ *
6
+ * For most use cases, use the Builder to create a Repository:
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { PromidasRepositoryBuilder } from 'promidas';
11
+ *
12
+ * const repo = new PromidasRepositoryBuilder()
13
+ * .setStoreConfig({ ttlMs: 30 * 60 * 1000 })
14
+ * .setApiClientConfig({
15
+ * protoPediaApiClientOptions: { token: process.env.PROTOPEDIA_API_V2_TOKEN }
16
+ * })
17
+ * .build();
18
+ *
19
+ * await repo.setupSnapshot({ limit: 100 });
20
+ * const prototype = await repo.getRandomPrototypeFromSnapshot();
21
+ * ```
22
+ *
23
+ * ## Standalone Module Usage
24
+ *
25
+ * For advanced use cases or when you need specific modules independently,
26
+ * use subpath imports:
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * // Type definitions
31
+ * import type { NormalizedPrototype } from 'promidas/types';
32
+ *
33
+ * // Utility functions and converters
34
+ * import {
35
+ * parseProtoPediaTimestamp,
36
+ * getPrototypeStatusLabel
37
+ * } from 'promidas/utils';
38
+ *
39
+ * // Logger interface and implementations
40
+ * import { createConsoleLogger } from 'promidas/logger';
41
+ *
42
+ * // API client and data fetching
43
+ * import {
44
+ * ProtopediaApiCustomClient
45
+ * } from 'promidas/fetcher';
46
+ *
47
+ * // In-memory store
48
+ * import { PrototypeInMemoryStore } from 'promidas/store';
49
+ *
50
+ * // Repository builder
51
+ * import { PromidasRepositoryBuilder } from 'promidas';
52
+ * ```
53
+ *
54
+ * ## Available Subpath Exports
55
+ *
56
+ * - `promidas/types` — Type definitions (NormalizedPrototype)
57
+ * - `promidas/utils` — Utility functions and converters
58
+ * - `promidas/logger` — Logger interface and implementations
59
+ * - `promidas/fetcher` — API client and data fetching utilities
60
+ * - `promidas/store` — In-memory store implementation
61
+ *
62
+ * @packageDocumentation
63
+ */
64
+ export { PromidasRepositoryBuilder, type PrototypeInMemoryStoreConfig, type PrototypeInMemoryStats, type ProtoPediaApiClientOptions, type ProtopediaInMemoryRepository, type ProtopediaInMemoryRepositoryConfig, } from './builder.js';
65
+ export { createPromidasForLocal, createPromidasForServer } from './factory.js';
66
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAGH,OAAO,EAEL,yBAAyB,EAGzB,KAAK,4BAA4B,EACjC,KAAK,sBAAsB,EAO3B,KAAK,0BAA0B,EAG/B,KAAK,4BAA4B,EACjC,KAAK,kCAAkC,GACxC,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC"}