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,91 @@
1
+ /**
2
+ * Timestamp parsing utilities for ProtoPedia and W3C-DTF formats.
3
+ *
4
+ * @module utils/time/parse
5
+ */
6
+ /**
7
+ * Parse ProtoPedia timestamp (JST without explicit timezone offset).
8
+ *
9
+ * ProtoPedia timestamps are JST-based timestamps without explicit timezone offset.
10
+ * Current format: `YYYY-MM-DD HH:MM:SS.0` (space separator, `.0` for zero milliseconds)
11
+ * Example: `2025-11-14 12:03:07.0`
12
+ *
13
+ * ## Fractional Seconds Support
14
+ *
15
+ * Currently, ProtoPedia API outputs `.0` (single digit, no sub-second precision).
16
+ * However, this parser accepts any number of fractional digits to accommodate
17
+ * future API changes:
18
+ *
19
+ * - Current: `2025-10-08 18:03:48.0` (1 digit)
20
+ * - Future possibilities:
21
+ * - Milliseconds: `2025-10-08 18:03:48.123` (3 digits)
22
+ * - Microseconds: `2025-10-08 18:03:48.123456` (6 digits)
23
+ * - Nanoseconds: `2025-10-08 18:03:48.123456789` (9 digits)
24
+ *
25
+ * The regex pattern `\.(\d+)` accepts 1 or more digits to support all these cases,
26
+ * as the underlying Java implementation may begin storing sub-second precision
27
+ * in the database.
28
+ *
29
+ * @param value - String to parse
30
+ * @returns UTC ISO string if valid ProtoPedia timestamp, undefined otherwise
31
+ */
32
+ export declare function parseProtoPediaTimestamp(value: string): string | undefined;
33
+ /**
34
+ * Parse W3C Date and Time Formats (W3C-DTF) timestamps.
35
+ *
36
+ * Implements W3C-DTF Level 4-6, which are datetime formats with mandatory
37
+ * timezone designator (TZD). This is a strict profile of ISO 8601 designed
38
+ * for web standards.
39
+ *
40
+ * **Specification:** https://www.w3.org/TR/NOTE-datetime
41
+ *
42
+ * ## Supported Formats
43
+ *
44
+ * **Level 4: Complete date plus hours and minutes**
45
+ * - Format: `YYYY-MM-DDThh:mmTZD`
46
+ * - Examples: `2025-11-14T12:03Z`, `2025-11-14T12:03+09:00`
47
+ *
48
+ * **Level 5: Complete date plus hours, minutes and seconds**
49
+ * - Format: `YYYY-MM-DDThh:mm:ssTZD`
50
+ * - Examples: `2025-11-14T12:03:07Z`, `2025-11-14T12:03:07-05:00`
51
+ *
52
+ * **Level 6: Complete date plus hours, minutes, seconds and fractional seconds**
53
+ * - Format: `YYYY-MM-DDThh:mm:ss.sTZD`
54
+ * - Examples: `2025-11-14T12:03:07.123Z`, `2025-11-14T12:03:07.45+09:00`
55
+ * - Fractional seconds: 1 or more digits (no maximum)
56
+ *
57
+ * ## Timezone Designator (TZD)
58
+ *
59
+ * - `Z` or `z`: UTC (Coordinated Universal Time)
60
+ * - `+HH:MM` or `-HH:MM`: Offset from UTC (colon required per W3C-DTF)
61
+ *
62
+ * ## NOT Supported (returns undefined)
63
+ *
64
+ * - W3C-DTF Level 1-3 (year-only, year-month, date-only): `2025`, `2025-11`, `2025-11-14`
65
+ * - Timestamps without TZD: `2025-11-14T12:03:07` (timezone-dependent)
66
+ * - Offset without colon: `2025-11-14T12:03:07+0900` (not W3C-DTF compliant)
67
+ * - Other ISO 8601 variants (week dates, ordinal dates, basic format)
68
+ *
69
+ * @param value - String to parse
70
+ * @returns UTC ISO string if valid W3C-DTF Level 4-6, undefined otherwise
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * parseW3cDtfTimestamp('2025-11-14T12:03Z')
75
+ * // => '2025-11-14T12:03:00.000Z'
76
+ *
77
+ * parseW3cDtfTimestamp('2025-11-14T12:03:07+09:00')
78
+ * // => '2025-11-14T03:03:07.000Z'
79
+ *
80
+ * parseW3cDtfTimestamp('2025-11-14T12:03:07.123Z')
81
+ * // => '2025-11-14T12:03:07.123Z'
82
+ *
83
+ * parseW3cDtfTimestamp('2025-11-14T12:03:07')
84
+ * // => undefined (no TZD)
85
+ *
86
+ * parseW3cDtfTimestamp('2025-11-14')
87
+ * // => undefined (date-only, Level 3)
88
+ * ```
89
+ */
90
+ export declare function parseW3cDtfTimestamp(value: string): string | undefined;
91
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../lib/utils/time/parser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA6C1E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAuBtE"}
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Timestamp parsing utilities for ProtoPedia and W3C-DTF formats.
3
+ *
4
+ * @module utils/time/parse
5
+ */
6
+ import { JST_OFFSET_MS } from './constants.js';
7
+ /**
8
+ * Parse ProtoPedia timestamp (JST without explicit timezone offset).
9
+ *
10
+ * ProtoPedia timestamps are JST-based timestamps without explicit timezone offset.
11
+ * Current format: `YYYY-MM-DD HH:MM:SS.0` (space separator, `.0` for zero milliseconds)
12
+ * Example: `2025-11-14 12:03:07.0`
13
+ *
14
+ * ## Fractional Seconds Support
15
+ *
16
+ * Currently, ProtoPedia API outputs `.0` (single digit, no sub-second precision).
17
+ * However, this parser accepts any number of fractional digits to accommodate
18
+ * future API changes:
19
+ *
20
+ * - Current: `2025-10-08 18:03:48.0` (1 digit)
21
+ * - Future possibilities:
22
+ * - Milliseconds: `2025-10-08 18:03:48.123` (3 digits)
23
+ * - Microseconds: `2025-10-08 18:03:48.123456` (6 digits)
24
+ * - Nanoseconds: `2025-10-08 18:03:48.123456789` (9 digits)
25
+ *
26
+ * The regex pattern `\.(\d+)` accepts 1 or more digits to support all these cases,
27
+ * as the underlying Java implementation may begin storing sub-second precision
28
+ * in the database.
29
+ *
30
+ * @param value - String to parse
31
+ * @returns UTC ISO string if valid ProtoPedia timestamp, undefined otherwise
32
+ */
33
+ export function parseProtoPediaTimestamp(value) {
34
+ if (typeof value !== 'string' || value.length === 0) {
35
+ return undefined;
36
+ }
37
+ // Pattern matches current format and future sub-second precision:
38
+ // - Current: .0 (1 digit)
39
+ // - Future: .123 (milliseconds), .123456 (microseconds), .123456789 (nanoseconds)
40
+ // The `\.(\d+)` pattern accepts 1 or more digits to accommodate potential
41
+ // database schema changes in the underlying Java implementation.
42
+ const match = value.match(/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})\.(\d+)$/);
43
+ if (!match) {
44
+ return undefined;
45
+ }
46
+ const [, y, m, d, hh, mm, ss, fractional] = match;
47
+ const year = Number(y);
48
+ const month = Number(m);
49
+ const day = Number(d);
50
+ const hour = Number(hh);
51
+ const minute = Number(mm);
52
+ const second = Number(ss);
53
+ // Fractional seconds are required in the format
54
+ const padded = fractional.padEnd(3, '0').slice(0, 3);
55
+ const milli = Number(padded);
56
+ if ([year, month, day, hour, minute, second, milli].some((part) => Number.isNaN(part))) {
57
+ return undefined;
58
+ }
59
+ // ProtoPedia の既存レスポンスは JST 起点でなので、UTC へ換算するために固定オフセットを引く
60
+ const utcMs = Date.UTC(year, month - 1, day, hour, minute, second, milli) - JST_OFFSET_MS;
61
+ if (!Number.isFinite(utcMs)) {
62
+ return undefined;
63
+ }
64
+ const iso = new Date(utcMs).toISOString();
65
+ return iso;
66
+ }
67
+ /**
68
+ * Parse W3C Date and Time Formats (W3C-DTF) timestamps.
69
+ *
70
+ * Implements W3C-DTF Level 4-6, which are datetime formats with mandatory
71
+ * timezone designator (TZD). This is a strict profile of ISO 8601 designed
72
+ * for web standards.
73
+ *
74
+ * **Specification:** https://www.w3.org/TR/NOTE-datetime
75
+ *
76
+ * ## Supported Formats
77
+ *
78
+ * **Level 4: Complete date plus hours and minutes**
79
+ * - Format: `YYYY-MM-DDThh:mmTZD`
80
+ * - Examples: `2025-11-14T12:03Z`, `2025-11-14T12:03+09:00`
81
+ *
82
+ * **Level 5: Complete date plus hours, minutes and seconds**
83
+ * - Format: `YYYY-MM-DDThh:mm:ssTZD`
84
+ * - Examples: `2025-11-14T12:03:07Z`, `2025-11-14T12:03:07-05:00`
85
+ *
86
+ * **Level 6: Complete date plus hours, minutes, seconds and fractional seconds**
87
+ * - Format: `YYYY-MM-DDThh:mm:ss.sTZD`
88
+ * - Examples: `2025-11-14T12:03:07.123Z`, `2025-11-14T12:03:07.45+09:00`
89
+ * - Fractional seconds: 1 or more digits (no maximum)
90
+ *
91
+ * ## Timezone Designator (TZD)
92
+ *
93
+ * - `Z` or `z`: UTC (Coordinated Universal Time)
94
+ * - `+HH:MM` or `-HH:MM`: Offset from UTC (colon required per W3C-DTF)
95
+ *
96
+ * ## NOT Supported (returns undefined)
97
+ *
98
+ * - W3C-DTF Level 1-3 (year-only, year-month, date-only): `2025`, `2025-11`, `2025-11-14`
99
+ * - Timestamps without TZD: `2025-11-14T12:03:07` (timezone-dependent)
100
+ * - Offset without colon: `2025-11-14T12:03:07+0900` (not W3C-DTF compliant)
101
+ * - Other ISO 8601 variants (week dates, ordinal dates, basic format)
102
+ *
103
+ * @param value - String to parse
104
+ * @returns UTC ISO string if valid W3C-DTF Level 4-6, undefined otherwise
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * parseW3cDtfTimestamp('2025-11-14T12:03Z')
109
+ * // => '2025-11-14T12:03:00.000Z'
110
+ *
111
+ * parseW3cDtfTimestamp('2025-11-14T12:03:07+09:00')
112
+ * // => '2025-11-14T03:03:07.000Z'
113
+ *
114
+ * parseW3cDtfTimestamp('2025-11-14T12:03:07.123Z')
115
+ * // => '2025-11-14T12:03:07.123Z'
116
+ *
117
+ * parseW3cDtfTimestamp('2025-11-14T12:03:07')
118
+ * // => undefined (no TZD)
119
+ *
120
+ * parseW3cDtfTimestamp('2025-11-14')
121
+ * // => undefined (date-only, Level 3)
122
+ * ```
123
+ */
124
+ export function parseW3cDtfTimestamp(value) {
125
+ if (typeof value !== 'string' || value.length === 0) {
126
+ return undefined;
127
+ }
128
+ // W3C-DTF Level 4-6: datetime with mandatory TZD
129
+ // Level 4: hh:mm + TZD (seconds optional)
130
+ // Level 5: hh:mm:ss + TZD
131
+ // Level 6: hh:mm:ss.s + TZD (fractional seconds: 1+ digits)
132
+ // TZD: Z/z or ±HH:MM (colon required per W3C-DTF)
133
+ const w3cDtfPattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2})?(\.\d+)?([Zz]|[+-]\d{2}:\d{2})$/;
134
+ if (!w3cDtfPattern.test(value)) {
135
+ return undefined;
136
+ }
137
+ const parsed = new Date(value);
138
+ if (Number.isNaN(parsed.getTime())) {
139
+ return undefined;
140
+ }
141
+ return parsed.toISOString();
142
+ }
143
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../lib/utils/time/parser.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Data validation utilities.
3
+ *
4
+ * This module provides validation functions for common data structures.
5
+ */
6
+ export { validateNormalizedPrototype, validateNormalizedPrototypeArray, } from './normalized-prototype.js';
7
+ export type { ValidationErrorCode, ValidationFailure, ValidationResult, ValidationSuccess, } from './types.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/utils/validation/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,2BAA2B,EAC3B,gCAAgC,GACjC,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Data validation utilities.
3
+ *
4
+ * This module provides validation functions for common data structures.
5
+ */
6
+ export { validateNormalizedPrototype, validateNormalizedPrototypeArray, } from './normalized-prototype.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/utils/validation/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,2BAA2B,EAC3B,gCAAgC,GACjC,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Common data validators.
3
+ *
4
+ * This module provides validation utilities for common data structures
5
+ * used across multiple modules (fetcher, repository, store).
6
+ *
7
+ * These validators return Result types (ValidationResult) instead of throwing errors.
8
+ * For parameter validation at API boundaries, modules should throw appropriate errors.
9
+ */
10
+ import type { Logger } from '../../logger/logger.types.js';
11
+ import type { NormalizedPrototype } from '../../types/index.js';
12
+ import type { ValidationErrorCode, ValidationResult } from './types.js';
13
+ /**
14
+ * Validate a NormalizedPrototype object.
15
+ *
16
+ * Validates that the data conforms to the NormalizedPrototype schema,
17
+ * including field types, required properties, and ID constraints.
18
+ *
19
+ * @param data - Data to validate
20
+ * @param logger - Optional logger for validation events
21
+ * @returns Validation result with typed data or error details
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * const result = validateNormalizedPrototype(data);
26
+ * if (result.ok) {
27
+ * // data is NormalizedPrototype
28
+ * console.log(`Prototype ID: ${result.data.id}`);
29
+ * } else {
30
+ * console.error(result.message);
31
+ * }
32
+ * ```
33
+ */
34
+ export declare function validateNormalizedPrototype(data: unknown, logger?: Logger): ValidationResult<NormalizedPrototype, ValidationErrorCode>;
35
+ /**
36
+ * Validate an array of NormalizedPrototype objects.
37
+ *
38
+ * Validates that the data is an array and each element conforms to
39
+ * the NormalizedPrototype schema. Uses Zod's fail-fast behavior,
40
+ * stopping at the first validation error.
41
+ *
42
+ * @param data - Data to validate (should be an array)
43
+ * @param logger - Optional logger for validation events
44
+ * @returns Validation result with typed data array or error details
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * const result = validateNormalizedPrototypeArray(data);
49
+ * if (result.ok) {
50
+ * // data is NormalizedPrototype[]
51
+ * console.log(`Validated ${result.data.length} prototypes`);
52
+ * } else {
53
+ * console.error(result.message);
54
+ * }
55
+ * ```
56
+ *
57
+ * @remarks
58
+ * - Uses Zod's default fail-fast behavior (stops at first error)
59
+ * - For large datasets (5000+ items), this is more efficient than
60
+ * validating each item individually
61
+ * - Memory usage: ~2x input size at peak due to Zod's immutable design
62
+ */
63
+ export declare function validateNormalizedPrototypeArray(data: unknown, logger?: Logger): ValidationResult<NormalizedPrototype[], ValidationErrorCode>;
64
+ //# sourceMappingURL=normalized-prototype.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalized-prototype.d.ts","sourceRoot":"","sources":["../../../lib/utils/validation/normalized-prototype.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAE3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,OAAO,EACb,MAAM,CAAC,EAAE,MAAM,GACd,gBAAgB,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CA0B5D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,OAAO,EACb,MAAM,CAAC,EAAE,MAAM,GACd,gBAAgB,CAAC,mBAAmB,EAAE,EAAE,mBAAmB,CAAC,CA0B9D"}
@@ -0,0 +1,97 @@
1
+ import { normalizedPrototypeSchema } from '../../schemas/index.js';
2
+ /**
3
+ * Validate a NormalizedPrototype object.
4
+ *
5
+ * Validates that the data conforms to the NormalizedPrototype schema,
6
+ * including field types, required properties, and ID constraints.
7
+ *
8
+ * @param data - Data to validate
9
+ * @param logger - Optional logger for validation events
10
+ * @returns Validation result with typed data or error details
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const result = validateNormalizedPrototype(data);
15
+ * if (result.ok) {
16
+ * // data is NormalizedPrototype
17
+ * console.log(`Prototype ID: ${result.data.id}`);
18
+ * } else {
19
+ * console.error(result.message);
20
+ * }
21
+ * ```
22
+ */
23
+ export function validateNormalizedPrototype(data, logger) {
24
+ const validationResult = normalizedPrototypeSchema.safeParse(data);
25
+ if (!validationResult.success) {
26
+ logger?.warn('Prototype data validation failed', {
27
+ errors: validationResult.error.issues,
28
+ });
29
+ return {
30
+ ok: false,
31
+ code: 'VALIDATION_ERROR',
32
+ message: validationResult.error.issues
33
+ .map((issue) => `${issue.path.join('.')}: ${issue.message}`)
34
+ .join('; '),
35
+ };
36
+ }
37
+ logger?.info('Prototype data validated successfully', {
38
+ id: validationResult.data.id,
39
+ prototypeNm: validationResult.data.prototypeNm,
40
+ });
41
+ return {
42
+ ok: true,
43
+ data: validationResult.data,
44
+ };
45
+ }
46
+ /**
47
+ * Validate an array of NormalizedPrototype objects.
48
+ *
49
+ * Validates that the data is an array and each element conforms to
50
+ * the NormalizedPrototype schema. Uses Zod's fail-fast behavior,
51
+ * stopping at the first validation error.
52
+ *
53
+ * @param data - Data to validate (should be an array)
54
+ * @param logger - Optional logger for validation events
55
+ * @returns Validation result with typed data array or error details
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * const result = validateNormalizedPrototypeArray(data);
60
+ * if (result.ok) {
61
+ * // data is NormalizedPrototype[]
62
+ * console.log(`Validated ${result.data.length} prototypes`);
63
+ * } else {
64
+ * console.error(result.message);
65
+ * }
66
+ * ```
67
+ *
68
+ * @remarks
69
+ * - Uses Zod's default fail-fast behavior (stops at first error)
70
+ * - For large datasets (5000+ items), this is more efficient than
71
+ * validating each item individually
72
+ * - Memory usage: ~2x input size at peak due to Zod's immutable design
73
+ */
74
+ export function validateNormalizedPrototypeArray(data, logger) {
75
+ const arraySchema = normalizedPrototypeSchema.array();
76
+ const validationResult = arraySchema.safeParse(data);
77
+ if (!validationResult.success) {
78
+ logger?.warn('Prototype array validation failed', {
79
+ errors: validationResult.error.issues,
80
+ });
81
+ return {
82
+ ok: false,
83
+ code: 'VALIDATION_ERROR',
84
+ message: validationResult.error.issues
85
+ .map((issue) => `${issue.path.join('.')}: ${issue.message}`)
86
+ .join('; '),
87
+ };
88
+ }
89
+ logger?.info('Prototype array validated successfully', {
90
+ count: validationResult.data.length,
91
+ });
92
+ return {
93
+ ok: true,
94
+ data: validationResult.data,
95
+ };
96
+ }
97
+ //# sourceMappingURL=normalized-prototype.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalized-prototype.js","sourceRoot":"","sources":["../../../lib/utils/validation/normalized-prototype.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAKnE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,2BAA2B,CACzC,IAAa,EACb,MAAe;IAEf,MAAM,gBAAgB,GAAG,yBAAyB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAEnE,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAC9B,MAAM,EAAE,IAAI,CAAC,kCAAkC,EAAE;YAC/C,MAAM,EAAE,gBAAgB,CAAC,KAAK,CAAC,MAAM;SACtC,CAAC,CAAC;QAEH,OAAO;YACL,EAAE,EAAE,KAAK;YACT,IAAI,EAAE,kBAAkB;YACxB,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,MAAM;iBACnC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;iBAC3D,IAAI,CAAC,IAAI,CAAC;SACd,CAAC;IACJ,CAAC;IAED,MAAM,EAAE,IAAI,CAAC,uCAAuC,EAAE;QACpD,EAAE,EAAE,gBAAgB,CAAC,IAAI,CAAC,EAAE;QAC5B,WAAW,EAAE,gBAAgB,CAAC,IAAI,CAAC,WAAW;KAC/C,CAAC,CAAC;IAEH,OAAO;QACL,EAAE,EAAE,IAAI;QACR,IAAI,EAAE,gBAAgB,CAAC,IAAI;KAC5B,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,gCAAgC,CAC9C,IAAa,EACb,MAAe;IAEf,MAAM,WAAW,GAAG,yBAAyB,CAAC,KAAK,EAAE,CAAC;IACtD,MAAM,gBAAgB,GAAG,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAErD,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAC9B,MAAM,EAAE,IAAI,CAAC,mCAAmC,EAAE;YAChD,MAAM,EAAE,gBAAgB,CAAC,KAAK,CAAC,MAAM;SACtC,CAAC,CAAC;QAEH,OAAO;YACL,EAAE,EAAE,KAAK;YACT,IAAI,EAAE,kBAAkB;YACxB,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,MAAM;iBACnC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;iBAC3D,IAAI,CAAC,IAAI,CAAC;SACd,CAAC;IACJ,CAAC;IAED,MAAM,EAAE,IAAI,CAAC,wCAAwC,EAAE;QACrD,KAAK,EAAE,gBAAgB,CAAC,IAAI,CAAC,MAAM;KACpC,CAAC,CAAC;IAEH,OAAO;QACL,EAAE,EAAE,IAAI;QACR,IAAI,EAAE,gBAAgB,CAAC,IAAI;KAC5B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Validation result types.
3
+ *
4
+ * This module provides common type definitions for validation operations
5
+ * that return Result types instead of throwing exceptions.
6
+ */
7
+ /**
8
+ * Validation success result.
9
+ *
10
+ * @template T - The type of the validated data
11
+ */
12
+ export type ValidationSuccess<T> = {
13
+ ok: true;
14
+ data: T;
15
+ };
16
+ /**
17
+ * Validation failure result.
18
+ *
19
+ * @template TErrorCode - The type of the error code (defaults to string)
20
+ */
21
+ export type ValidationFailure<TErrorCode extends string = string> = {
22
+ ok: false;
23
+ code: TErrorCode;
24
+ message: string;
25
+ };
26
+ /**
27
+ * Validation error code for common data validation.
28
+ */
29
+ export type ValidationErrorCode = 'VALIDATION_ERROR';
30
+ /**
31
+ * Validation result type.
32
+ *
33
+ * A discriminated union type representing the result of a validation operation.
34
+ * Returns either success with typed data or failure with error details.
35
+ *
36
+ * @template T - The type of the validated data on success
37
+ * @template TErrorCode - The type of the error code (defaults to string)
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * // With specific error code
42
+ * type MyErrorCode = 'VALIDATION_ERROR' | 'PARSE_ERROR';
43
+ * function validate(data: unknown): ValidationResult<MyType, MyErrorCode> {
44
+ * if (isValid(data)) {
45
+ * return { ok: true, data };
46
+ * } else {
47
+ * return { ok: false, code: 'VALIDATION_ERROR', message: 'Invalid data' };
48
+ * }
49
+ * }
50
+ *
51
+ * // With default error code (string)
52
+ * function simpleValidate(data: unknown): ValidationResult<MyType> {
53
+ * if (isValid(data)) {
54
+ * return { ok: true, data };
55
+ * } else {
56
+ * return { ok: false, code: 'ERROR', message: 'Invalid' };
57
+ * }
58
+ * }
59
+ * ```
60
+ */
61
+ export type ValidationResult<T, TErrorCode extends string = string> = ValidationSuccess<T> | ValidationFailure<TErrorCode>;
62
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/utils/validation/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IACjC,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,CAAC,UAAU,SAAS,MAAM,GAAG,MAAM,IAAI;IAClE,EAAE,EAAE,KAAK,CAAC;IACV,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,EAAE,UAAU,SAAS,MAAM,GAAG,MAAM,IAC9D,iBAAiB,CAAC,CAAC,CAAC,GACpB,iBAAiB,CAAC,UAAU,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Validation result types.
3
+ *
4
+ * This module provides common type definitions for validation operations
5
+ * that return Result types instead of throwing exceptions.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/utils/validation/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file is auto-generated by scripts/generate-version.mjs
3
+ * Do not edit manually.
4
+ */
5
+ export declare const VERSION = "2.0.0";
6
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../lib/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,OAAO,UAAU,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file is auto-generated by scripts/generate-version.mjs
3
+ * Do not edit manually.
4
+ */
5
+ export const VERSION = '2.0.0';
6
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../lib/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}