@mantra-ai/core 0.1.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 (385) hide show
  1. package/dist/ai/google/client.d.ts +67 -0
  2. package/dist/ai/google/client.d.ts.map +1 -0
  3. package/dist/ai/google/client.js +169 -0
  4. package/dist/ai/google/client.js.map +1 -0
  5. package/dist/ai/google/generate.d.ts +10 -0
  6. package/dist/ai/google/generate.d.ts.map +1 -0
  7. package/dist/ai/google/generate.js +137 -0
  8. package/dist/ai/google/generate.js.map +1 -0
  9. package/dist/ai/google/index.d.ts +4 -0
  10. package/dist/ai/google/index.d.ts.map +1 -0
  11. package/dist/ai/google/index.js +4 -0
  12. package/dist/ai/google/index.js.map +1 -0
  13. package/dist/ai/google/types.d.ts +88 -0
  14. package/dist/ai/google/types.d.ts.map +1 -0
  15. package/dist/ai/google/types.js +55 -0
  16. package/dist/ai/google/types.js.map +1 -0
  17. package/dist/ai/index.d.ts +3 -0
  18. package/dist/ai/index.d.ts.map +1 -0
  19. package/dist/ai/index.js +3 -0
  20. package/dist/ai/index.js.map +1 -0
  21. package/dist/ai/openai/client.d.ts +22 -0
  22. package/dist/ai/openai/client.d.ts.map +1 -0
  23. package/dist/ai/openai/client.js +49 -0
  24. package/dist/ai/openai/client.js.map +1 -0
  25. package/dist/ai/openai/generate.d.ts +14 -0
  26. package/dist/ai/openai/generate.d.ts.map +1 -0
  27. package/dist/ai/openai/generate.js +178 -0
  28. package/dist/ai/openai/generate.js.map +1 -0
  29. package/dist/ai/openai/index.d.ts +4 -0
  30. package/dist/ai/openai/index.d.ts.map +1 -0
  31. package/dist/ai/openai/index.js +4 -0
  32. package/dist/ai/openai/index.js.map +1 -0
  33. package/dist/ai/openai/types.d.ts +86 -0
  34. package/dist/ai/openai/types.d.ts.map +1 -0
  35. package/dist/ai/openai/types.js +56 -0
  36. package/dist/ai/openai/types.js.map +1 -0
  37. package/dist/ai/prompts/index.d.ts +1 -0
  38. package/dist/ai/prompts/index.d.ts.map +1 -0
  39. package/dist/ai/prompts/index.js +2 -0
  40. package/dist/ai/prompts/index.js.map +1 -0
  41. package/dist/errors/index.d.ts +3 -0
  42. package/dist/errors/index.d.ts.map +1 -0
  43. package/dist/errors/index.js +4 -0
  44. package/dist/errors/index.js.map +1 -0
  45. package/dist/errors/schemas.d.ts +304 -0
  46. package/dist/errors/schemas.d.ts.map +1 -0
  47. package/dist/errors/schemas.js +57 -0
  48. package/dist/errors/schemas.js.map +1 -0
  49. package/dist/errors/types.d.ts +30 -0
  50. package/dist/errors/types.d.ts.map +1 -0
  51. package/dist/errors/types.js +33 -0
  52. package/dist/errors/types.js.map +1 -0
  53. package/dist/index.d.ts +21 -0
  54. package/dist/index.d.ts.map +1 -0
  55. package/dist/index.js +21 -0
  56. package/dist/index.js.map +1 -0
  57. package/dist/normalization/jats/index.d.ts +4 -0
  58. package/dist/normalization/jats/index.d.ts.map +1 -0
  59. package/dist/normalization/jats/index.js +3 -0
  60. package/dist/normalization/jats/index.js.map +1 -0
  61. package/dist/normalization/jats/normalize.d.ts +7 -0
  62. package/dist/normalization/jats/normalize.d.ts.map +1 -0
  63. package/dist/normalization/jats/normalize.js +213 -0
  64. package/dist/normalization/jats/normalize.js.map +1 -0
  65. package/dist/normalization/jats/utils/build/finalize.d.ts +3 -0
  66. package/dist/normalization/jats/utils/build/finalize.d.ts.map +1 -0
  67. package/dist/normalization/jats/utils/build/finalize.js +462 -0
  68. package/dist/normalization/jats/utils/build/finalize.js.map +1 -0
  69. package/dist/normalization/jats/utils/build/flatten.d.ts +20 -0
  70. package/dist/normalization/jats/utils/build/flatten.d.ts.map +1 -0
  71. package/dist/normalization/jats/utils/build/flatten.js +502 -0
  72. package/dist/normalization/jats/utils/build/flatten.js.map +1 -0
  73. package/dist/normalization/jats/utils/build/meta.d.ts +10 -0
  74. package/dist/normalization/jats/utils/build/meta.d.ts.map +1 -0
  75. package/dist/normalization/jats/utils/build/meta.js +32 -0
  76. package/dist/normalization/jats/utils/build/meta.js.map +1 -0
  77. package/dist/normalization/jats/utils/build/version.d.ts +3 -0
  78. package/dist/normalization/jats/utils/build/version.d.ts.map +1 -0
  79. package/dist/normalization/jats/utils/build/version.js +11 -0
  80. package/dist/normalization/jats/utils/build/version.js.map +1 -0
  81. package/dist/normalization/jats/utils/category.d.ts +11 -0
  82. package/dist/normalization/jats/utils/category.d.ts.map +1 -0
  83. package/dist/normalization/jats/utils/category.js +431 -0
  84. package/dist/normalization/jats/utils/category.js.map +1 -0
  85. package/dist/normalization/jats/utils/collectors/abstracts.d.ts +3 -0
  86. package/dist/normalization/jats/utils/collectors/abstracts.d.ts.map +1 -0
  87. package/dist/normalization/jats/utils/collectors/abstracts.js +168 -0
  88. package/dist/normalization/jats/utils/collectors/abstracts.js.map +1 -0
  89. package/dist/normalization/jats/utils/collectors/back.d.ts +35 -0
  90. package/dist/normalization/jats/utils/collectors/back.d.ts.map +1 -0
  91. package/dist/normalization/jats/utils/collectors/back.js +801 -0
  92. package/dist/normalization/jats/utils/collectors/back.js.map +1 -0
  93. package/dist/normalization/jats/utils/collectors/contributors.d.ts +4 -0
  94. package/dist/normalization/jats/utils/collectors/contributors.d.ts.map +1 -0
  95. package/dist/normalization/jats/utils/collectors/contributors.js +77 -0
  96. package/dist/normalization/jats/utils/collectors/contributors.js.map +1 -0
  97. package/dist/normalization/jats/utils/collectors/keywords.d.ts +2 -0
  98. package/dist/normalization/jats/utils/collectors/keywords.d.ts.map +1 -0
  99. package/dist/normalization/jats/utils/collectors/keywords.js +14 -0
  100. package/dist/normalization/jats/utils/collectors/keywords.js.map +1 -0
  101. package/dist/normalization/jats/utils/collectors/meta.d.ts +6 -0
  102. package/dist/normalization/jats/utils/collectors/meta.d.ts.map +1 -0
  103. package/dist/normalization/jats/utils/collectors/meta.js +103 -0
  104. package/dist/normalization/jats/utils/collectors/meta.js.map +1 -0
  105. package/dist/normalization/jats/utils/collectors/sections.d.ts +7 -0
  106. package/dist/normalization/jats/utils/collectors/sections.d.ts.map +1 -0
  107. package/dist/normalization/jats/utils/collectors/sections.js +484 -0
  108. package/dist/normalization/jats/utils/collectors/sections.js.map +1 -0
  109. package/dist/normalization/jats/utils/licenses.d.ts +5 -0
  110. package/dist/normalization/jats/utils/licenses.d.ts.map +1 -0
  111. package/dist/normalization/jats/utils/licenses.js +64 -0
  112. package/dist/normalization/jats/utils/licenses.js.map +1 -0
  113. package/dist/normalization/jats/utils/po/nodes.d.ts +6 -0
  114. package/dist/normalization/jats/utils/po/nodes.d.ts.map +1 -0
  115. package/dist/normalization/jats/utils/po/nodes.js +60 -0
  116. package/dist/normalization/jats/utils/po/nodes.js.map +1 -0
  117. package/dist/normalization/jats/utils/po/query.d.ts +7 -0
  118. package/dist/normalization/jats/utils/po/query.d.ts.map +1 -0
  119. package/dist/normalization/jats/utils/po/query.js +67 -0
  120. package/dist/normalization/jats/utils/po/query.js.map +1 -0
  121. package/dist/normalization/jats/utils/po/serialize.d.ts +4 -0
  122. package/dist/normalization/jats/utils/po/serialize.d.ts.map +1 -0
  123. package/dist/normalization/jats/utils/po/serialize.js +329 -0
  124. package/dist/normalization/jats/utils/po/serialize.js.map +1 -0
  125. package/dist/normalization/jats/utils/po/text.d.ts +7 -0
  126. package/dist/normalization/jats/utils/po/text.d.ts.map +1 -0
  127. package/dist/normalization/jats/utils/po/text.js +114 -0
  128. package/dist/normalization/jats/utils/po/text.js.map +1 -0
  129. package/dist/normalization/jats/utils/references.d.ts +26 -0
  130. package/dist/normalization/jats/utils/references.d.ts.map +1 -0
  131. package/dist/normalization/jats/utils/references.js +371 -0
  132. package/dist/normalization/jats/utils/references.js.map +1 -0
  133. package/dist/normalization/jats/utils/strings.d.ts +8 -0
  134. package/dist/normalization/jats/utils/strings.d.ts.map +1 -0
  135. package/dist/normalization/jats/utils/strings.js +197 -0
  136. package/dist/normalization/jats/utils/strings.js.map +1 -0
  137. package/dist/normalization/jats/utils/types.d.ts +233 -0
  138. package/dist/normalization/jats/utils/types.d.ts.map +1 -0
  139. package/dist/normalization/jats/utils/types.js +2 -0
  140. package/dist/normalization/jats/utils/types.js.map +1 -0
  141. package/dist/normalization/jats/utils/xml.d.ts +5 -0
  142. package/dist/normalization/jats/utils/xml.d.ts.map +1 -0
  143. package/dist/normalization/jats/utils/xml.js +69 -0
  144. package/dist/normalization/jats/utils/xml.js.map +1 -0
  145. package/dist/normalization/normalized-doc-schema.d.ts +1094 -0
  146. package/dist/normalization/normalized-doc-schema.d.ts.map +1 -0
  147. package/dist/normalization/normalized-doc-schema.js +410 -0
  148. package/dist/normalization/normalized-doc-schema.js.map +1 -0
  149. package/dist/normalization/pdf/index.d.ts +4 -0
  150. package/dist/normalization/pdf/index.d.ts.map +1 -0
  151. package/dist/normalization/pdf/index.js +3 -0
  152. package/dist/normalization/pdf/index.js.map +1 -0
  153. package/dist/normalization/pdf/normalize.d.ts +31 -0
  154. package/dist/normalization/pdf/normalize.d.ts.map +1 -0
  155. package/dist/normalization/pdf/normalize.js +321 -0
  156. package/dist/normalization/pdf/normalize.js.map +1 -0
  157. package/dist/normalization/pdf/prompt.d.ts +3 -0
  158. package/dist/normalization/pdf/prompt.d.ts.map +1 -0
  159. package/dist/normalization/pdf/prompt.js +118 -0
  160. package/dist/normalization/pdf/prompt.js.map +1 -0
  161. package/dist/sources/arxiv/client.d.ts +4 -0
  162. package/dist/sources/arxiv/client.d.ts.map +1 -0
  163. package/dist/sources/arxiv/client.js +13 -0
  164. package/dist/sources/arxiv/client.js.map +1 -0
  165. package/dist/sources/biorxiv/client.d.ts +21 -0
  166. package/dist/sources/biorxiv/client.d.ts.map +1 -0
  167. package/dist/sources/biorxiv/client.js +173 -0
  168. package/dist/sources/biorxiv/client.js.map +1 -0
  169. package/dist/sources/crossref/client.d.ts +3 -0
  170. package/dist/sources/crossref/client.d.ts.map +1 -0
  171. package/dist/sources/crossref/client.js +24 -0
  172. package/dist/sources/crossref/client.js.map +1 -0
  173. package/dist/sources/europepmc/client.d.ts +3 -0
  174. package/dist/sources/europepmc/client.d.ts.map +1 -0
  175. package/dist/sources/europepmc/client.js +29 -0
  176. package/dist/sources/europepmc/client.js.map +1 -0
  177. package/dist/sources/medrxiv/browser.d.ts +16 -0
  178. package/dist/sources/medrxiv/browser.d.ts.map +1 -0
  179. package/dist/sources/medrxiv/browser.js +210 -0
  180. package/dist/sources/medrxiv/browser.js.map +1 -0
  181. package/dist/sources/medrxiv/client.d.ts +34 -0
  182. package/dist/sources/medrxiv/client.d.ts.map +1 -0
  183. package/dist/sources/medrxiv/client.js +673 -0
  184. package/dist/sources/medrxiv/client.js.map +1 -0
  185. package/dist/sources/medrxiv/shared.d.ts +7 -0
  186. package/dist/sources/medrxiv/shared.d.ts.map +1 -0
  187. package/dist/sources/medrxiv/shared.js +18 -0
  188. package/dist/sources/medrxiv/shared.js.map +1 -0
  189. package/dist/sources/plos/client.d.ts +13 -0
  190. package/dist/sources/plos/client.d.ts.map +1 -0
  191. package/dist/sources/plos/client.js +147 -0
  192. package/dist/sources/plos/client.js.map +1 -0
  193. package/dist/sources/preprint-discovery.d.ts +55 -0
  194. package/dist/sources/preprint-discovery.d.ts.map +1 -0
  195. package/dist/sources/preprint-discovery.js +115 -0
  196. package/dist/sources/preprint-discovery.js.map +1 -0
  197. package/dist/types/expand.d.ts +5 -0
  198. package/dist/types/expand.d.ts.map +1 -0
  199. package/dist/types/expand.js +20 -0
  200. package/dist/types/expand.js.map +1 -0
  201. package/dist/types/methods-types.d.ts +37 -0
  202. package/dist/types/methods-types.d.ts.map +1 -0
  203. package/dist/types/methods-types.js +2 -0
  204. package/dist/types/methods-types.js.map +1 -0
  205. package/dist/types/multi-input-types.d.ts +57 -0
  206. package/dist/types/multi-input-types.d.ts.map +1 -0
  207. package/dist/types/multi-input-types.js +2 -0
  208. package/dist/types/multi-input-types.js.map +1 -0
  209. package/dist/types/paper/types.d.ts +41 -0
  210. package/dist/types/paper/types.d.ts.map +1 -0
  211. package/dist/types/paper/types.js +2 -0
  212. package/dist/types/paper/types.js.map +1 -0
  213. package/dist/types/results-types.d.ts +122 -0
  214. package/dist/types/results-types.d.ts.map +1 -0
  215. package/dist/types/results-types.js +17 -0
  216. package/dist/types/results-types.js.map +1 -0
  217. package/dist/types/supp-types.d.ts +6 -0
  218. package/dist/types/supp-types.d.ts.map +1 -0
  219. package/dist/types/supp-types.js +2 -0
  220. package/dist/types/supp-types.js.map +1 -0
  221. package/dist/types/version.d.ts +1828 -0
  222. package/dist/types/version.d.ts.map +1 -0
  223. package/dist/types/version.js +311 -0
  224. package/dist/types/version.js.map +1 -0
  225. package/dist/types/work.d.ts +4455 -0
  226. package/dist/types/work.d.ts.map +1 -0
  227. package/dist/types/work.js +330 -0
  228. package/dist/types/work.js.map +1 -0
  229. package/dist/works/adapters/crossref.d.ts +28 -0
  230. package/dist/works/adapters/crossref.d.ts.map +1 -0
  231. package/dist/works/adapters/crossref.js +43 -0
  232. package/dist/works/adapters/crossref.js.map +1 -0
  233. package/dist/works/adapters/europepmc.d.ts +14 -0
  234. package/dist/works/adapters/europepmc.d.ts.map +1 -0
  235. package/dist/works/adapters/europepmc.js +46 -0
  236. package/dist/works/adapters/europepmc.js.map +1 -0
  237. package/dist/works/adapters/openalex.d.ts +5 -0
  238. package/dist/works/adapters/openalex.d.ts.map +1 -0
  239. package/dist/works/adapters/openalex.js +75 -0
  240. package/dist/works/adapters/openalex.js.map +1 -0
  241. package/dist/works/errors.d.ts +23 -0
  242. package/dist/works/errors.d.ts.map +1 -0
  243. package/dist/works/errors.js +37 -0
  244. package/dist/works/errors.js.map +1 -0
  245. package/dist/works/id/detect-identifier.d.ts +15 -0
  246. package/dist/works/id/detect-identifier.d.ts.map +1 -0
  247. package/dist/works/id/detect-identifier.js +50 -0
  248. package/dist/works/id/detect-identifier.js.map +1 -0
  249. package/dist/works/id/normalize-external-id.d.ts +3 -0
  250. package/dist/works/id/normalize-external-id.d.ts.map +1 -0
  251. package/dist/works/id/normalize-external-id.js +44 -0
  252. package/dist/works/id/normalize-external-id.js.map +1 -0
  253. package/dist/works/id/normalize-ids.d.ts +66 -0
  254. package/dist/works/id/normalize-ids.d.ts.map +1 -0
  255. package/dist/works/id/normalize-ids.js +112 -0
  256. package/dist/works/id/normalize-ids.js.map +1 -0
  257. package/dist/works/id/normalize-internals.d.ts +7 -0
  258. package/dist/works/id/normalize-internals.d.ts.map +1 -0
  259. package/dist/works/id/normalize-internals.js +65 -0
  260. package/dist/works/id/normalize-internals.js.map +1 -0
  261. package/dist/works/id/resolve.d.ts +31 -0
  262. package/dist/works/id/resolve.d.ts.map +1 -0
  263. package/dist/works/id/resolve.js +123 -0
  264. package/dist/works/id/resolve.js.map +1 -0
  265. package/dist/works/id/resolveIds/assign.d.ts +4 -0
  266. package/dist/works/id/resolveIds/assign.d.ts.map +1 -0
  267. package/dist/works/id/resolveIds/assign.js +15 -0
  268. package/dist/works/id/resolveIds/assign.js.map +1 -0
  269. package/dist/works/id/resolveIds/flags.d.ts +11 -0
  270. package/dist/works/id/resolveIds/flags.d.ts.map +1 -0
  271. package/dist/works/id/resolveIds/flags.js +27 -0
  272. package/dist/works/id/resolveIds/flags.js.map +1 -0
  273. package/dist/works/id/resolveIds/idctx.d.ts +4 -0
  274. package/dist/works/id/resolveIds/idctx.d.ts.map +1 -0
  275. package/dist/works/id/resolveIds/idctx.js +25 -0
  276. package/dist/works/id/resolveIds/idctx.js.map +1 -0
  277. package/dist/works/id/resolveIds/index.d.ts +13 -0
  278. package/dist/works/id/resolveIds/index.d.ts.map +1 -0
  279. package/dist/works/id/resolveIds/index.js +498 -0
  280. package/dist/works/id/resolveIds/index.js.map +1 -0
  281. package/dist/works/id/resolveIds/versioning.d.ts +27 -0
  282. package/dist/works/id/resolveIds/versioning.d.ts.map +1 -0
  283. package/dist/works/id/resolveIds/versioning.js +156 -0
  284. package/dist/works/id/resolveIds/versioning.js.map +1 -0
  285. package/dist/works/id/resolveIds/workWhere.d.ts +3 -0
  286. package/dist/works/id/resolveIds/workWhere.d.ts.map +1 -0
  287. package/dist/works/id/resolveIds/workWhere.js +35 -0
  288. package/dist/works/id/resolveIds/workWhere.js.map +1 -0
  289. package/dist/works/id/types.d.ts +6 -0
  290. package/dist/works/id/types.d.ts.map +1 -0
  291. package/dist/works/id/types.js +2 -0
  292. package/dist/works/id/types.js.map +1 -0
  293. package/dist/works/pdf-fallback/candidates.d.ts +12 -0
  294. package/dist/works/pdf-fallback/candidates.d.ts.map +1 -0
  295. package/dist/works/pdf-fallback/candidates.js +51 -0
  296. package/dist/works/pdf-fallback/candidates.js.map +1 -0
  297. package/dist/works/pdf-fallback/fetch.d.ts +21 -0
  298. package/dist/works/pdf-fallback/fetch.d.ts.map +1 -0
  299. package/dist/works/pdf-fallback/fetch.js +89 -0
  300. package/dist/works/pdf-fallback/fetch.js.map +1 -0
  301. package/dist/works/pdf-fallback/index.d.ts +28 -0
  302. package/dist/works/pdf-fallback/index.d.ts.map +1 -0
  303. package/dist/works/pdf-fallback/index.js +35 -0
  304. package/dist/works/pdf-fallback/index.js.map +1 -0
  305. package/dist/works/plan.d.ts +8 -0
  306. package/dist/works/plan.d.ts.map +1 -0
  307. package/dist/works/plan.js +62 -0
  308. package/dist/works/plan.js.map +1 -0
  309. package/dist/works/strategies/arxiv.d.ts +3 -0
  310. package/dist/works/strategies/arxiv.d.ts.map +1 -0
  311. package/dist/works/strategies/arxiv.js +56 -0
  312. package/dist/works/strategies/arxiv.js.map +1 -0
  313. package/dist/works/strategies/biorxiv.d.ts +3 -0
  314. package/dist/works/strategies/biorxiv.d.ts.map +1 -0
  315. package/dist/works/strategies/biorxiv.js +63 -0
  316. package/dist/works/strategies/biorxiv.js.map +1 -0
  317. package/dist/works/strategies/europepmc.d.ts +3 -0
  318. package/dist/works/strategies/europepmc.d.ts.map +1 -0
  319. package/dist/works/strategies/europepmc.js +15 -0
  320. package/dist/works/strategies/europepmc.js.map +1 -0
  321. package/dist/works/strategies/index.d.ts +12 -0
  322. package/dist/works/strategies/index.d.ts.map +1 -0
  323. package/dist/works/strategies/index.js +19 -0
  324. package/dist/works/strategies/index.js.map +1 -0
  325. package/dist/works/strategies/landing-url.d.ts +3 -0
  326. package/dist/works/strategies/landing-url.d.ts.map +1 -0
  327. package/dist/works/strategies/landing-url.js +10 -0
  328. package/dist/works/strategies/landing-url.js.map +1 -0
  329. package/dist/works/strategies/medrxiv.d.ts +3 -0
  330. package/dist/works/strategies/medrxiv.d.ts.map +1 -0
  331. package/dist/works/strategies/medrxiv.js +47 -0
  332. package/dist/works/strategies/medrxiv.js.map +1 -0
  333. package/dist/works/strategies/plos.d.ts +3 -0
  334. package/dist/works/strategies/plos.d.ts.map +1 -0
  335. package/dist/works/strategies/plos.js +15 -0
  336. package/dist/works/strategies/plos.js.map +1 -0
  337. package/dist/works/strategies/shared.d.ts +11 -0
  338. package/dist/works/strategies/shared.d.ts.map +1 -0
  339. package/dist/works/strategies/shared.js +97 -0
  340. package/dist/works/strategies/shared.js.map +1 -0
  341. package/dist/works/strategies/ten1101.d.ts +3 -0
  342. package/dist/works/strategies/ten1101.d.ts.map +1 -0
  343. package/dist/works/strategies/ten1101.js +84 -0
  344. package/dist/works/strategies/ten1101.js.map +1 -0
  345. package/dist/works/text/acquire-fulltext.d.ts +7 -0
  346. package/dist/works/text/acquire-fulltext.d.ts.map +1 -0
  347. package/dist/works/text/acquire-fulltext.js +62 -0
  348. package/dist/works/text/acquire-fulltext.js.map +1 -0
  349. package/dist/works/text/normalize.d.ts +40 -0
  350. package/dist/works/text/normalize.d.ts.map +1 -0
  351. package/dist/works/text/normalize.js +188 -0
  352. package/dist/works/text/normalize.js.map +1 -0
  353. package/dist/works/types.d.ts +215 -0
  354. package/dist/works/types.d.ts.map +1 -0
  355. package/dist/works/types.js +6 -0
  356. package/dist/works/types.js.map +1 -0
  357. package/dist/works/util/debug.d.ts +7 -0
  358. package/dist/works/util/debug.d.ts.map +1 -0
  359. package/dist/works/util/debug.js +9 -0
  360. package/dist/works/util/debug.js.map +1 -0
  361. package/dist/works/util/license.d.ts +9 -0
  362. package/dist/works/util/license.d.ts.map +1 -0
  363. package/dist/works/util/license.js +39 -0
  364. package/dist/works/util/license.js.map +1 -0
  365. package/dist/works/util/normalize.d.ts +2 -0
  366. package/dist/works/util/normalize.d.ts.map +1 -0
  367. package/dist/works/util/normalize.js +76 -0
  368. package/dist/works/util/normalize.js.map +1 -0
  369. package/dist/works/util/parse.d.ts +8 -0
  370. package/dist/works/util/parse.d.ts.map +1 -0
  371. package/dist/works/util/parse.js +32 -0
  372. package/dist/works/util/parse.js.map +1 -0
  373. package/dist/works/util/source.d.ts +10 -0
  374. package/dist/works/util/source.d.ts.map +1 -0
  375. package/dist/works/util/source.js +48 -0
  376. package/dist/works/util/source.js.map +1 -0
  377. package/dist/works/util/version-label.d.ts +2 -0
  378. package/dist/works/util/version-label.d.ts.map +1 -0
  379. package/dist/works/util/version-label.js +8 -0
  380. package/dist/works/util/version-label.js.map +1 -0
  381. package/dist/works/util/work-id.d.ts +2 -0
  382. package/dist/works/util/work-id.d.ts.map +1 -0
  383. package/dist/works/util/work-id.js +27 -0
  384. package/dist/works/util/work-id.js.map +1 -0
  385. package/package.json +208 -0
@@ -0,0 +1,304 @@
1
+ import { z } from "zod";
2
+ export declare const StandardErrorSchema: z.ZodObject<{
3
+ error: z.ZodString;
4
+ code: z.ZodString;
5
+ details: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString, z.ZodNull]>>;
6
+ correlation_id: z.ZodOptional<z.ZodString>;
7
+ endpoint: z.ZodOptional<z.ZodString>;
8
+ }, "strict", z.ZodTypeAny, {
9
+ error: string;
10
+ code: string;
11
+ details?: string | Record<string, unknown> | null | undefined;
12
+ correlation_id?: string | undefined;
13
+ endpoint?: string | undefined;
14
+ }, {
15
+ error: string;
16
+ code: string;
17
+ details?: string | Record<string, unknown> | null | undefined;
18
+ correlation_id?: string | undefined;
19
+ endpoint?: string | undefined;
20
+ }>;
21
+ export declare const Error400Schema: z.ZodObject<{
22
+ error: z.ZodString;
23
+ details: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString, z.ZodNull]>>;
24
+ correlation_id: z.ZodOptional<z.ZodString>;
25
+ endpoint: z.ZodOptional<z.ZodString>;
26
+ } & {
27
+ code: z.ZodEnum<["invalid_input", "invalid_cursor", "missing_idempotency_key", "invalid_expand_fields"]>;
28
+ }, "strict", z.ZodTypeAny, {
29
+ error: string;
30
+ code: "invalid_input" | "invalid_cursor" | "missing_idempotency_key" | "invalid_expand_fields";
31
+ details?: string | Record<string, unknown> | null | undefined;
32
+ correlation_id?: string | undefined;
33
+ endpoint?: string | undefined;
34
+ }, {
35
+ error: string;
36
+ code: "invalid_input" | "invalid_cursor" | "missing_idempotency_key" | "invalid_expand_fields";
37
+ details?: string | Record<string, unknown> | null | undefined;
38
+ correlation_id?: string | undefined;
39
+ endpoint?: string | undefined;
40
+ }>;
41
+ export declare const Error401Schema: z.ZodObject<{
42
+ error: z.ZodString;
43
+ details: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString, z.ZodNull]>>;
44
+ correlation_id: z.ZodOptional<z.ZodString>;
45
+ endpoint: z.ZodOptional<z.ZodString>;
46
+ } & {
47
+ code: z.ZodLiteral<"unauthorized">;
48
+ }, "strict", z.ZodTypeAny, {
49
+ error: string;
50
+ code: "unauthorized";
51
+ details?: string | Record<string, unknown> | null | undefined;
52
+ correlation_id?: string | undefined;
53
+ endpoint?: string | undefined;
54
+ }, {
55
+ error: string;
56
+ code: "unauthorized";
57
+ details?: string | Record<string, unknown> | null | undefined;
58
+ correlation_id?: string | undefined;
59
+ endpoint?: string | undefined;
60
+ }>;
61
+ export declare const Error403Schema: z.ZodObject<{
62
+ error: z.ZodString;
63
+ details: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString, z.ZodNull]>>;
64
+ correlation_id: z.ZodOptional<z.ZodString>;
65
+ endpoint: z.ZodOptional<z.ZodString>;
66
+ } & {
67
+ code: z.ZodLiteral<"license">;
68
+ }, "strict", z.ZodTypeAny, {
69
+ error: string;
70
+ code: "license";
71
+ details?: string | Record<string, unknown> | null | undefined;
72
+ correlation_id?: string | undefined;
73
+ endpoint?: string | undefined;
74
+ }, {
75
+ error: string;
76
+ code: "license";
77
+ details?: string | Record<string, unknown> | null | undefined;
78
+ correlation_id?: string | undefined;
79
+ endpoint?: string | undefined;
80
+ }>;
81
+ export declare const Error404Schema: z.ZodObject<{
82
+ error: z.ZodString;
83
+ details: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString, z.ZodNull]>>;
84
+ correlation_id: z.ZodOptional<z.ZodString>;
85
+ endpoint: z.ZodOptional<z.ZodString>;
86
+ } & {
87
+ code: z.ZodEnum<["not_found", "work_not_found", "version_not_found"]>;
88
+ }, "strict", z.ZodTypeAny, {
89
+ error: string;
90
+ code: "not_found" | "work_not_found" | "version_not_found";
91
+ details?: string | Record<string, unknown> | null | undefined;
92
+ correlation_id?: string | undefined;
93
+ endpoint?: string | undefined;
94
+ }, {
95
+ error: string;
96
+ code: "not_found" | "work_not_found" | "version_not_found";
97
+ details?: string | Record<string, unknown> | null | undefined;
98
+ correlation_id?: string | undefined;
99
+ endpoint?: string | undefined;
100
+ }>;
101
+ export declare const Error409Schema: z.ZodObject<{
102
+ error: z.ZodString;
103
+ details: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString, z.ZodNull]>>;
104
+ correlation_id: z.ZodOptional<z.ZodString>;
105
+ endpoint: z.ZodOptional<z.ZodString>;
106
+ } & {
107
+ code: z.ZodEnum<["not_ready", "idempotency_conflict"]>;
108
+ }, "strict", z.ZodTypeAny, {
109
+ error: string;
110
+ code: "idempotency_conflict" | "not_ready";
111
+ details?: string | Record<string, unknown> | null | undefined;
112
+ correlation_id?: string | undefined;
113
+ endpoint?: string | undefined;
114
+ }, {
115
+ error: string;
116
+ code: "idempotency_conflict" | "not_ready";
117
+ details?: string | Record<string, unknown> | null | undefined;
118
+ correlation_id?: string | undefined;
119
+ endpoint?: string | undefined;
120
+ }>;
121
+ export declare const Error413Schema: z.ZodObject<{
122
+ error: z.ZodString;
123
+ details: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString, z.ZodNull]>>;
124
+ correlation_id: z.ZodOptional<z.ZodString>;
125
+ endpoint: z.ZodOptional<z.ZodString>;
126
+ } & {
127
+ code: z.ZodLiteral<"payload_too_large">;
128
+ }, "strict", z.ZodTypeAny, {
129
+ error: string;
130
+ code: "payload_too_large";
131
+ details?: string | Record<string, unknown> | null | undefined;
132
+ correlation_id?: string | undefined;
133
+ endpoint?: string | undefined;
134
+ }, {
135
+ error: string;
136
+ code: "payload_too_large";
137
+ details?: string | Record<string, unknown> | null | undefined;
138
+ correlation_id?: string | undefined;
139
+ endpoint?: string | undefined;
140
+ }>;
141
+ export declare const Error500Schema: z.ZodObject<{
142
+ error: z.ZodString;
143
+ details: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString, z.ZodNull]>>;
144
+ correlation_id: z.ZodOptional<z.ZodString>;
145
+ endpoint: z.ZodOptional<z.ZodString>;
146
+ } & {
147
+ code: z.ZodLiteral<"server_error">;
148
+ }, "strict", z.ZodTypeAny, {
149
+ error: string;
150
+ code: "server_error";
151
+ details?: string | Record<string, unknown> | null | undefined;
152
+ correlation_id?: string | undefined;
153
+ endpoint?: string | undefined;
154
+ }, {
155
+ error: string;
156
+ code: "server_error";
157
+ details?: string | Record<string, unknown> | null | undefined;
158
+ correlation_id?: string | undefined;
159
+ endpoint?: string | undefined;
160
+ }>;
161
+ export declare const ErrorResponseSchema: z.ZodUnion<[z.ZodObject<{
162
+ error: z.ZodString;
163
+ details: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString, z.ZodNull]>>;
164
+ correlation_id: z.ZodOptional<z.ZodString>;
165
+ endpoint: z.ZodOptional<z.ZodString>;
166
+ } & {
167
+ code: z.ZodEnum<["invalid_input", "invalid_cursor", "missing_idempotency_key", "invalid_expand_fields"]>;
168
+ }, "strict", z.ZodTypeAny, {
169
+ error: string;
170
+ code: "invalid_input" | "invalid_cursor" | "missing_idempotency_key" | "invalid_expand_fields";
171
+ details?: string | Record<string, unknown> | null | undefined;
172
+ correlation_id?: string | undefined;
173
+ endpoint?: string | undefined;
174
+ }, {
175
+ error: string;
176
+ code: "invalid_input" | "invalid_cursor" | "missing_idempotency_key" | "invalid_expand_fields";
177
+ details?: string | Record<string, unknown> | null | undefined;
178
+ correlation_id?: string | undefined;
179
+ endpoint?: string | undefined;
180
+ }>, z.ZodObject<{
181
+ error: z.ZodString;
182
+ details: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString, z.ZodNull]>>;
183
+ correlation_id: z.ZodOptional<z.ZodString>;
184
+ endpoint: z.ZodOptional<z.ZodString>;
185
+ } & {
186
+ code: z.ZodLiteral<"unauthorized">;
187
+ }, "strict", z.ZodTypeAny, {
188
+ error: string;
189
+ code: "unauthorized";
190
+ details?: string | Record<string, unknown> | null | undefined;
191
+ correlation_id?: string | undefined;
192
+ endpoint?: string | undefined;
193
+ }, {
194
+ error: string;
195
+ code: "unauthorized";
196
+ details?: string | Record<string, unknown> | null | undefined;
197
+ correlation_id?: string | undefined;
198
+ endpoint?: string | undefined;
199
+ }>, z.ZodObject<{
200
+ error: z.ZodString;
201
+ details: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString, z.ZodNull]>>;
202
+ correlation_id: z.ZodOptional<z.ZodString>;
203
+ endpoint: z.ZodOptional<z.ZodString>;
204
+ } & {
205
+ code: z.ZodLiteral<"license">;
206
+ }, "strict", z.ZodTypeAny, {
207
+ error: string;
208
+ code: "license";
209
+ details?: string | Record<string, unknown> | null | undefined;
210
+ correlation_id?: string | undefined;
211
+ endpoint?: string | undefined;
212
+ }, {
213
+ error: string;
214
+ code: "license";
215
+ details?: string | Record<string, unknown> | null | undefined;
216
+ correlation_id?: string | undefined;
217
+ endpoint?: string | undefined;
218
+ }>, z.ZodObject<{
219
+ error: z.ZodString;
220
+ details: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString, z.ZodNull]>>;
221
+ correlation_id: z.ZodOptional<z.ZodString>;
222
+ endpoint: z.ZodOptional<z.ZodString>;
223
+ } & {
224
+ code: z.ZodEnum<["not_found", "work_not_found", "version_not_found"]>;
225
+ }, "strict", z.ZodTypeAny, {
226
+ error: string;
227
+ code: "not_found" | "work_not_found" | "version_not_found";
228
+ details?: string | Record<string, unknown> | null | undefined;
229
+ correlation_id?: string | undefined;
230
+ endpoint?: string | undefined;
231
+ }, {
232
+ error: string;
233
+ code: "not_found" | "work_not_found" | "version_not_found";
234
+ details?: string | Record<string, unknown> | null | undefined;
235
+ correlation_id?: string | undefined;
236
+ endpoint?: string | undefined;
237
+ }>, z.ZodObject<{
238
+ error: z.ZodString;
239
+ details: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString, z.ZodNull]>>;
240
+ correlation_id: z.ZodOptional<z.ZodString>;
241
+ endpoint: z.ZodOptional<z.ZodString>;
242
+ } & {
243
+ code: z.ZodEnum<["not_ready", "idempotency_conflict"]>;
244
+ }, "strict", z.ZodTypeAny, {
245
+ error: string;
246
+ code: "idempotency_conflict" | "not_ready";
247
+ details?: string | Record<string, unknown> | null | undefined;
248
+ correlation_id?: string | undefined;
249
+ endpoint?: string | undefined;
250
+ }, {
251
+ error: string;
252
+ code: "idempotency_conflict" | "not_ready";
253
+ details?: string | Record<string, unknown> | null | undefined;
254
+ correlation_id?: string | undefined;
255
+ endpoint?: string | undefined;
256
+ }>, z.ZodObject<{
257
+ error: z.ZodString;
258
+ details: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString, z.ZodNull]>>;
259
+ correlation_id: z.ZodOptional<z.ZodString>;
260
+ endpoint: z.ZodOptional<z.ZodString>;
261
+ } & {
262
+ code: z.ZodLiteral<"payload_too_large">;
263
+ }, "strict", z.ZodTypeAny, {
264
+ error: string;
265
+ code: "payload_too_large";
266
+ details?: string | Record<string, unknown> | null | undefined;
267
+ correlation_id?: string | undefined;
268
+ endpoint?: string | undefined;
269
+ }, {
270
+ error: string;
271
+ code: "payload_too_large";
272
+ details?: string | Record<string, unknown> | null | undefined;
273
+ correlation_id?: string | undefined;
274
+ endpoint?: string | undefined;
275
+ }>, z.ZodObject<{
276
+ error: z.ZodString;
277
+ details: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString, z.ZodNull]>>;
278
+ correlation_id: z.ZodOptional<z.ZodString>;
279
+ endpoint: z.ZodOptional<z.ZodString>;
280
+ } & {
281
+ code: z.ZodLiteral<"server_error">;
282
+ }, "strict", z.ZodTypeAny, {
283
+ error: string;
284
+ code: "server_error";
285
+ details?: string | Record<string, unknown> | null | undefined;
286
+ correlation_id?: string | undefined;
287
+ endpoint?: string | undefined;
288
+ }, {
289
+ error: string;
290
+ code: "server_error";
291
+ details?: string | Record<string, unknown> | null | undefined;
292
+ correlation_id?: string | undefined;
293
+ endpoint?: string | undefined;
294
+ }>]>;
295
+ export type StandardError = z.infer<typeof StandardErrorSchema>;
296
+ export type Error400 = z.infer<typeof Error400Schema>;
297
+ export type Error401 = z.infer<typeof Error401Schema>;
298
+ export type Error403 = z.infer<typeof Error403Schema>;
299
+ export type Error404 = z.infer<typeof Error404Schema>;
300
+ export type Error409 = z.infer<typeof Error409Schema>;
301
+ export type Error413 = z.infer<typeof Error413Schema>;
302
+ export type Error500 = z.infer<typeof Error500Schema>;
303
+ export type ErrorResponse = z.infer<typeof ErrorResponseSchema>;
304
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/errors/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;EAYiB,CAAC;AAGlD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;EAOzB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;EAEzB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;EAEzB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;EAMzB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;EAEzB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;EAEzB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;EAEzB,CAAC;AAGH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAQ9B,CAAC;AAGH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { z } from "zod";
2
+ // Standard error response schema - used across all endpoints
3
+ export const StandardErrorSchema = z
4
+ .object({
5
+ error: z.string().describe("Human-readable error message"),
6
+ code: z.string().describe("Machine-readable error code"),
7
+ details: z
8
+ .union([z.record(z.unknown()), z.string(), z.null()])
9
+ .optional()
10
+ .describe("Optional error context"),
11
+ correlation_id: z.string().optional().describe("Request correlation ID"),
12
+ endpoint: z.string().optional().describe("Endpoint that generated the error"),
13
+ })
14
+ .strict()
15
+ .describe("Standardized error response format");
16
+ // Specific error schemas for different HTTP status codes
17
+ export const Error400Schema = StandardErrorSchema.extend({
18
+ code: z.enum([
19
+ "invalid_input",
20
+ "invalid_cursor",
21
+ "missing_idempotency_key",
22
+ "invalid_expand_fields"
23
+ ]),
24
+ });
25
+ export const Error401Schema = StandardErrorSchema.extend({
26
+ code: z.literal("unauthorized"),
27
+ });
28
+ export const Error403Schema = StandardErrorSchema.extend({
29
+ code: z.literal("license"),
30
+ });
31
+ export const Error404Schema = StandardErrorSchema.extend({
32
+ code: z.enum([
33
+ "not_found",
34
+ "work_not_found",
35
+ "version_not_found"
36
+ ]),
37
+ });
38
+ export const Error409Schema = StandardErrorSchema.extend({
39
+ code: z.enum(["not_ready", "idempotency_conflict"]),
40
+ });
41
+ export const Error413Schema = StandardErrorSchema.extend({
42
+ code: z.literal("payload_too_large"),
43
+ });
44
+ export const Error500Schema = StandardErrorSchema.extend({
45
+ code: z.literal("server_error"),
46
+ });
47
+ // Union type for all error responses
48
+ export const ErrorResponseSchema = z.union([
49
+ Error400Schema,
50
+ Error401Schema,
51
+ Error403Schema,
52
+ Error404Schema,
53
+ Error409Schema,
54
+ Error413Schema,
55
+ Error500Schema,
56
+ ]);
57
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/errors/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,6DAA6D;AAC7D,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KACjC,MAAM,CAAC;IACN,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IAC1D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IACxD,OAAO,EAAE,CAAC;SACP,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;SACpD,QAAQ,EAAE;SACV,QAAQ,CAAC,wBAAwB,CAAC;IACrC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;IACxE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;CAC9E,CAAC;KACD,MAAM,EAAE;KACR,QAAQ,CAAC,oCAAoC,CAAC,CAAC;AAElD,yDAAyD;AACzD,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAC,MAAM,CAAC;IACvD,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;QACX,eAAe;QACf,gBAAgB;QAChB,yBAAyB;QACzB,uBAAuB;KACxB,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAC,MAAM,CAAC;IACvD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;CAChC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAC,MAAM,CAAC;IACvD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAC,MAAM,CAAC;IACvD,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;QACX,WAAW;QACX,gBAAgB;QAChB,mBAAmB;KACpB,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAC,MAAM,CAAC;IACvD,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,sBAAsB,CAAC,CAAC;CACpD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAC,MAAM,CAAC;IACvD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC;CACrC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAC,MAAM,CAAC;IACvD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;CAChC,CAAC,CAAC;AAEH,qCAAqC;AACrC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC;IACzC,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;CACf,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ export declare const ERROR_CODES: {
2
+ readonly INVALID_INPUT: "invalid_input";
3
+ readonly INVALID_CURSOR: "invalid_cursor";
4
+ readonly MISSING_IDEMPOTENCY_KEY: "missing_idempotency_key";
5
+ readonly INVALID_EXPAND_FIELDS: "invalid_expand_fields";
6
+ readonly UNAUTHORIZED: "unauthorized";
7
+ readonly IDEMPOTENCY_CONFLICT_CODE: "idempotency_conflict";
8
+ readonly LICENSE: "license";
9
+ readonly NOT_FOUND: "not_found";
10
+ readonly WORK_NOT_FOUND: "work_not_found";
11
+ readonly VERSION_NOT_FOUND: "version_not_found";
12
+ readonly NOT_READY: "not_ready";
13
+ readonly IDEMPOTENCY_CONFLICT: "idempotency_conflict";
14
+ readonly PAYLOAD_TOO_LARGE: "payload_too_large";
15
+ readonly SERVER_ERROR: "server_error";
16
+ };
17
+ export type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
18
+ export interface StandardErrorResponse {
19
+ error: string;
20
+ code: ErrorCode;
21
+ details?: Record<string, unknown> | string | null;
22
+ correlation_id?: string;
23
+ endpoint?: string;
24
+ }
25
+ export declare function createErrorResponse(error: string, code: ErrorCode, options?: {
26
+ details?: Record<string, unknown> | string | null;
27
+ correlation_id?: string;
28
+ endpoint?: string;
29
+ }): StandardErrorResponse;
30
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/errors/types.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;CA4Bd,CAAC;AAGX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAGvE,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;IAClD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAGD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,SAAS,EACf,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;IAClD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GACA,qBAAqB,CAMvB"}
@@ -0,0 +1,33 @@
1
+ // Error code constants
2
+ export const ERROR_CODES = {
3
+ // 400 Bad Request
4
+ INVALID_INPUT: "invalid_input",
5
+ INVALID_CURSOR: "invalid_cursor",
6
+ MISSING_IDEMPOTENCY_KEY: "missing_idempotency_key",
7
+ INVALID_EXPAND_FIELDS: "invalid_expand_fields",
8
+ // 401 Unauthorized
9
+ UNAUTHORIZED: "unauthorized",
10
+ IDEMPOTENCY_CONFLICT_CODE: "idempotency_conflict",
11
+ // 403 Forbidden
12
+ LICENSE: "license",
13
+ // 404 Not Found
14
+ NOT_FOUND: "not_found",
15
+ WORK_NOT_FOUND: "work_not_found",
16
+ VERSION_NOT_FOUND: "version_not_found",
17
+ // 409 Conflict
18
+ NOT_READY: "not_ready",
19
+ IDEMPOTENCY_CONFLICT: "idempotency_conflict",
20
+ // 413 Payload Too Large
21
+ PAYLOAD_TOO_LARGE: "payload_too_large",
22
+ // 500 Internal Server Error
23
+ SERVER_ERROR: "server_error",
24
+ };
25
+ // Helper function to create standardized error responses
26
+ export function createErrorResponse(error, code, options) {
27
+ return {
28
+ error,
29
+ code,
30
+ ...options,
31
+ };
32
+ }
33
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/errors/types.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,kBAAkB;IAClB,aAAa,EAAE,eAAe;IAC9B,cAAc,EAAE,gBAAgB;IAChC,uBAAuB,EAAE,yBAAyB;IAClD,qBAAqB,EAAE,uBAAuB;IAE9C,mBAAmB;IACnB,YAAY,EAAE,cAAc;IAC5B,yBAAyB,EAAE,sBAAsB;IAEjD,gBAAgB;IAChB,OAAO,EAAE,SAAS;IAElB,gBAAgB;IAChB,SAAS,EAAE,WAAW;IACtB,cAAc,EAAE,gBAAgB;IAChC,iBAAiB,EAAE,mBAAmB;IAEtC,eAAe;IACf,SAAS,EAAE,WAAW;IACtB,oBAAoB,EAAE,sBAAsB;IAE5C,wBAAwB;IACxB,iBAAiB,EAAE,mBAAmB;IAEtC,4BAA4B;IAC5B,YAAY,EAAE,cAAc;CACpB,CAAC;AAcX,yDAAyD;AACzD,MAAM,UAAU,mBAAmB,CACjC,KAAa,EACb,IAAe,EACf,OAIC;IAED,OAAO;QACL,KAAK;QACL,IAAI;QACJ,GAAG,OAAO;KACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,21 @@
1
+ export * from "./errors/types";
2
+ export * from "./errors/schemas";
3
+ export { PipelineError, PIPELINE_ERROR_CODES } from "./works/errors";
4
+ export type { PipelineErrorCode } from "./works/errors";
5
+ export type { VersionSource, ActionsExternalType, ActionsIdBody, Coordinator, VersionStage, WorkRollup, UpstreamSource, AdapterResult, UpstreamError, ResolutionMeta, ResolvedIds, ResolvedMetadata, CompleteIds, FullTextType, FullTextResult, IngestWorkResult, OpenAlexIds, OpenAlexLocation, OpenAlexWork, LoggerLike, IngestWorkOptions, IngestLogger, S3RawSaved, Step, StrategyAttempt, IngestResult, FetchTextResult, FetchTextFn, StrategyContext, FullTextStrategy, PlanOptions, } from "./works/types";
6
+ export { planSteps } from "./works/plan";
7
+ export type { IdentifierType, ResolvedIdentifier } from "./works/id/types";
8
+ export { normalizeDOI, detectDOI, normalizePMID, normalizePMCID, normalizeArXivId, deriveBioMedrxivDoi, } from "./works/id/normalize-internals";
9
+ export { normalizeAndMaybeResolveToDOI } from "./works/id/normalize-ids";
10
+ export { normalizeExternalId } from "./works/id/normalize-external-id";
11
+ export type { ExtKey } from "./works/id/normalize-external-id";
12
+ export { detectIdentifier } from "./works/id/detect-identifier";
13
+ export type { DetectedIdentifier } from "./works/id/detect-identifier";
14
+ export { parseDebugFlag } from "./works/util/debug";
15
+ export { normalizeLicenseHref, licenseBucket } from "./works/util/license";
16
+ export { normalizeVersionLabel } from "./works/util/version-label";
17
+ export { pickFirstString, parseArxivIdFromUrl, parseArxivIdFromDoi, parseBiorxivMedrxivIdFromDoi, } from "./works/util/parse";
18
+ export { createWorkId } from "./works/util/work-id";
19
+ export { NormalizedDocSchema, SectionCategoryEnum, } from "./normalization/normalized-doc-schema";
20
+ export type { NormalizedDoc } from "./normalization/normalized-doc-schema";
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AAGjC,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACrE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,YAAY,EACZ,UAAU,EACV,cAAc,EACd,aAAa,EACb,aAAa,EACb,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,eAAe,EACf,YAAY,EACZ,eAAe,EACf,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,WAAW,GACZ,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EACL,YAAY,EACZ,SAAS,EACT,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,YAAY,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,YAAY,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGvE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EACL,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,uCAAuC,CAAC;AAC/C,YAAY,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ // @mantra-ai/core barrel exports
2
+ // ── Errors ─────────────────────────────────────────────────────────
3
+ export * from "./errors/types";
4
+ export * from "./errors/schemas";
5
+ // ── Works: errors ──────────────────────────────────────────────────
6
+ export { PipelineError, PIPELINE_ERROR_CODES } from "./works/errors";
7
+ // ── Works: plan ────────────────────────────────────────────────────
8
+ export { planSteps } from "./works/plan";
9
+ export { normalizeDOI, detectDOI, normalizePMID, normalizePMCID, normalizeArXivId, deriveBioMedrxivDoi, } from "./works/id/normalize-internals";
10
+ export { normalizeAndMaybeResolveToDOI } from "./works/id/normalize-ids";
11
+ export { normalizeExternalId } from "./works/id/normalize-external-id";
12
+ export { detectIdentifier } from "./works/id/detect-identifier";
13
+ // ── Works: utilities ───────────────────────────────────────────────
14
+ export { parseDebugFlag } from "./works/util/debug";
15
+ export { normalizeLicenseHref, licenseBucket } from "./works/util/license";
16
+ export { normalizeVersionLabel } from "./works/util/version-label";
17
+ export { pickFirstString, parseArxivIdFromUrl, parseArxivIdFromDoi, parseBiorxivMedrxivIdFromDoi, } from "./works/util/parse";
18
+ export { createWorkId } from "./works/util/work-id";
19
+ // ── Normalization ──────────────────────────────────────────────────
20
+ export { NormalizedDocSchema, SectionCategoryEnum, } from "./normalization/normalized-doc-schema";
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iCAAiC;AAEjC,sEAAsE;AACtE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AAEjC,sEAAsE;AACtE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAsCrE,sEAAsE;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,OAAO,EACL,YAAY,EACZ,SAAS,EACT,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGhE,sEAAsE;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,sEAAsE;AACtE,OAAO,EACL,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,uCAAuC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { normalizeJatsXml, normalizeJatsToDoc } from "./normalize";
2
+ export { finalizeNormalizedJats } from "./utils/build/finalize";
3
+ export type { NormalizedJats, NormalizedDocEnvelope, BuildOptions, } from "./utils/types";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/normalization/jats/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,YAAY,GACb,MAAM,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { normalizeJatsXml, normalizeJatsToDoc } from "./normalize";
2
+ export { finalizeNormalizedJats } from "./utils/build/finalize";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/normalization/jats/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { NormalizedJats, BuildOptions, NormalizedDocEnvelope } from "./utils/types";
2
+ /**
3
+ * Entry point: normalize a JATS XML string to a simple domain JSON.
4
+ **/
5
+ export declare function normalizeJatsXml(xml: string): NormalizedJats;
6
+ export declare function normalizeJatsToDoc(xml: string, opts?: BuildOptions): NormalizedDocEnvelope;
7
+ //# sourceMappingURL=normalize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/normalization/jats/normalize.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,cAAc,EAQd,YAAY,EACZ,qBAAqB,EACtB,MAAM,eAAe,CAAC;AA6BvB;;IAEI;AAEJ,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CA6K5D;AAGD,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,YAAY,GAClB,qBAAqB,CAGvB"}