prompsit-cli 26.225.1206 → 26.227.2006

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 (361) hide show
  1. package/README.md +10 -4
  2. package/dist/api/auth-session.d.ts +11 -11
  3. package/dist/api/auth-session.d.ts.map +1 -1
  4. package/dist/api/auth-session.js +21 -17
  5. package/dist/api/auth-session.js.map +1 -1
  6. package/dist/api/client.d.ts +4 -4
  7. package/dist/api/client.d.ts.map +1 -1
  8. package/dist/api/client.js +8 -8
  9. package/dist/api/client.js.map +1 -1
  10. package/dist/api/curl.d.ts +30 -0
  11. package/dist/api/curl.d.ts.map +1 -0
  12. package/dist/api/curl.js +115 -0
  13. package/dist/api/curl.js.map +1 -0
  14. package/dist/api/errors.d.ts +2 -3
  15. package/dist/api/errors.d.ts.map +1 -1
  16. package/dist/api/errors.js +4 -2
  17. package/dist/api/errors.js.map +1 -1
  18. package/dist/api/http-utils.d.ts +5 -0
  19. package/dist/api/http-utils.d.ts.map +1 -0
  20. package/dist/api/http-utils.js +19 -0
  21. package/dist/api/http-utils.js.map +1 -0
  22. package/dist/api/models.d.ts +135 -89
  23. package/dist/api/models.d.ts.map +1 -1
  24. package/dist/api/models.js +62 -72
  25. package/dist/api/models.js.map +1 -1
  26. package/dist/api/resources/data.d.ts +3 -5
  27. package/dist/api/resources/data.d.ts.map +1 -1
  28. package/dist/api/resources/data.js +11 -12
  29. package/dist/api/resources/data.js.map +1 -1
  30. package/dist/api/resources/discovery.d.ts +26 -0
  31. package/dist/api/resources/discovery.d.ts.map +1 -0
  32. package/dist/api/resources/discovery.js +46 -0
  33. package/dist/api/resources/discovery.js.map +1 -0
  34. package/dist/api/resources/evaluation.d.ts +9 -12
  35. package/dist/api/resources/evaluation.d.ts.map +1 -1
  36. package/dist/api/resources/evaluation.js +45 -20
  37. package/dist/api/resources/evaluation.js.map +1 -1
  38. package/dist/api/resources/formats.d.ts +1 -1
  39. package/dist/api/resources/formats.js +2 -2
  40. package/dist/api/resources/formats.js.map +1 -1
  41. package/dist/api/resources/jobs.d.ts +7 -8
  42. package/dist/api/resources/jobs.d.ts.map +1 -1
  43. package/dist/api/resources/jobs.js +10 -49
  44. package/dist/api/resources/jobs.js.map +1 -1
  45. package/dist/api/resources/languages.d.ts +25 -0
  46. package/dist/api/resources/languages.d.ts.map +1 -0
  47. package/dist/api/resources/languages.js +44 -0
  48. package/dist/api/resources/languages.js.map +1 -0
  49. package/dist/api/resources/translation.d.ts +8 -16
  50. package/dist/api/resources/translation.d.ts.map +1 -1
  51. package/dist/api/resources/translation.js +11 -15
  52. package/dist/api/resources/translation.js.map +1 -1
  53. package/dist/api/sse-client.d.ts +10 -16
  54. package/dist/api/sse-client.d.ts.map +1 -1
  55. package/dist/api/sse-client.js +158 -197
  56. package/dist/api/sse-client.js.map +1 -1
  57. package/dist/api/sse-models.js +1 -1
  58. package/dist/api/sse-models.js.map +1 -1
  59. package/dist/api/trace.js +1 -1
  60. package/dist/api/trace.js.map +1 -1
  61. package/dist/api/transport.d.ts +28 -1
  62. package/dist/api/transport.d.ts.map +1 -1
  63. package/dist/api/transport.js +89 -17
  64. package/dist/api/transport.js.map +1 -1
  65. package/dist/cli/arg-order.d.ts +2 -0
  66. package/dist/cli/arg-order.d.ts.map +1 -1
  67. package/dist/cli/arg-order.js +2 -0
  68. package/dist/cli/arg-order.js.map +1 -1
  69. package/dist/cli/exit-codes.d.ts +0 -2
  70. package/dist/cli/exit-codes.d.ts.map +1 -1
  71. package/dist/cli/exit-codes.js +0 -2
  72. package/dist/cli/exit-codes.js.map +1 -1
  73. package/dist/cli/exit.d.ts +4 -4
  74. package/dist/cli/exit.d.ts.map +1 -1
  75. package/dist/cli/exit.js +4 -4
  76. package/dist/cli/exit.js.map +1 -1
  77. package/dist/cli/prompts.d.ts +0 -2
  78. package/dist/cli/prompts.d.ts.map +1 -1
  79. package/dist/cli/prompts.js +1 -1
  80. package/dist/cli/prompts.js.map +1 -1
  81. package/dist/commands/auth.d.ts.map +1 -1
  82. package/dist/commands/auth.js +0 -1
  83. package/dist/commands/auth.js.map +1 -1
  84. package/dist/commands/batch-processor.d.ts +38 -0
  85. package/dist/commands/batch-processor.d.ts.map +1 -0
  86. package/dist/commands/batch-processor.js +73 -0
  87. package/dist/commands/batch-processor.js.map +1 -0
  88. package/dist/commands/config/api-url.d.ts.map +1 -1
  89. package/dist/commands/config/api-url.js +4 -1
  90. package/dist/commands/config/api-url.js.map +1 -1
  91. package/dist/commands/config/command.d.ts.map +1 -1
  92. package/dist/commands/config/command.js +3 -2
  93. package/dist/commands/config/command.js.map +1 -1
  94. package/dist/commands/config/language.d.ts.map +1 -1
  95. package/dist/commands/config/language.js.map +1 -1
  96. package/dist/commands/config/reset.d.ts.map +1 -1
  97. package/dist/commands/config/reset.js.map +1 -1
  98. package/dist/commands/config/shared.js +3 -3
  99. package/dist/commands/config/shared.js.map +1 -1
  100. package/dist/commands/config/show.d.ts.map +1 -1
  101. package/dist/commands/config/show.js +0 -13
  102. package/dist/commands/config/show.js.map +1 -1
  103. package/dist/commands/data.d.ts.map +1 -1
  104. package/dist/commands/data.js +241 -68
  105. package/dist/commands/data.js.map +1 -1
  106. package/dist/commands/evaluate.d.ts.map +1 -1
  107. package/dist/commands/evaluate.js +111 -29
  108. package/dist/commands/evaluate.js.map +1 -1
  109. package/dist/commands/formats.d.ts +1 -1
  110. package/dist/commands/formats.d.ts.map +1 -1
  111. package/dist/commands/formats.js +5 -12
  112. package/dist/commands/formats.js.map +1 -1
  113. package/dist/commands/health.d.ts +1 -1
  114. package/dist/commands/health.d.ts.map +1 -1
  115. package/dist/commands/health.js +3 -10
  116. package/dist/commands/health.js.map +1 -1
  117. package/dist/commands/job-tracking.d.ts +13 -5
  118. package/dist/commands/job-tracking.d.ts.map +1 -1
  119. package/dist/commands/job-tracking.js +25 -18
  120. package/dist/commands/job-tracking.js.map +1 -1
  121. package/dist/commands/languages.d.ts +12 -0
  122. package/dist/commands/languages.d.ts.map +1 -0
  123. package/dist/commands/languages.js +48 -0
  124. package/dist/commands/languages.js.map +1 -0
  125. package/dist/commands/mappers.d.ts +15 -3
  126. package/dist/commands/mappers.d.ts.map +1 -1
  127. package/dist/commands/mappers.js +38 -18
  128. package/dist/commands/mappers.js.map +1 -1
  129. package/dist/commands/progress-animator.d.ts +2 -1
  130. package/dist/commands/progress-animator.d.ts.map +1 -1
  131. package/dist/commands/progress-animator.js +4 -2
  132. package/dist/commands/progress-animator.js.map +1 -1
  133. package/dist/commands/translate.d.ts.map +1 -1
  134. package/dist/commands/translate.js +149 -87
  135. package/dist/commands/translate.js.map +1 -1
  136. package/dist/config/credentials.d.ts +11 -87
  137. package/dist/config/credentials.d.ts.map +1 -1
  138. package/dist/config/credentials.js +28 -87
  139. package/dist/config/credentials.js.map +1 -1
  140. package/dist/config/env-parser.d.ts.map +1 -1
  141. package/dist/config/env-parser.js +3 -2
  142. package/dist/config/env-parser.js.map +1 -1
  143. package/dist/config/file-utils.js +1 -1
  144. package/dist/config/file-utils.js.map +1 -1
  145. package/dist/config/index.d.ts +4 -7
  146. package/dist/config/index.d.ts.map +1 -1
  147. package/dist/config/index.js +6 -12
  148. package/dist/config/index.js.map +1 -1
  149. package/dist/config/schemas.d.ts +4 -33
  150. package/dist/config/schemas.d.ts.map +1 -1
  151. package/dist/config/schemas.js +14 -19
  152. package/dist/config/schemas.js.map +1 -1
  153. package/dist/config/settings.d.ts +4 -4
  154. package/dist/config/settings.d.ts.map +1 -1
  155. package/dist/config/settings.js +16 -21
  156. package/dist/config/settings.js.map +1 -1
  157. package/dist/config/toml-io.js +1 -1
  158. package/dist/config/toml-io.js.map +1 -1
  159. package/dist/constants.d.ts +10 -9
  160. package/dist/constants.d.ts.map +1 -1
  161. package/dist/constants.js +10 -9
  162. package/dist/constants.js.map +1 -1
  163. package/dist/errors/catalog.d.ts.map +1 -1
  164. package/dist/errors/catalog.js +6 -8
  165. package/dist/errors/catalog.js.map +1 -1
  166. package/dist/errors/contracts.d.ts.map +1 -1
  167. package/dist/errors/contracts.js +2 -3
  168. package/dist/errors/contracts.js.map +1 -1
  169. package/dist/i18n/cache.d.ts +0 -2
  170. package/dist/i18n/cache.d.ts.map +1 -1
  171. package/dist/i18n/cache.js +4 -4
  172. package/dist/i18n/cache.js.map +1 -1
  173. package/dist/i18n/catalog.d.ts +34 -37
  174. package/dist/i18n/catalog.d.ts.map +1 -1
  175. package/dist/i18n/catalog.js +38 -40
  176. package/dist/i18n/catalog.js.map +1 -1
  177. package/dist/i18n/index.d.ts +0 -1
  178. package/dist/i18n/index.d.ts.map +1 -1
  179. package/dist/i18n/index.js +0 -3
  180. package/dist/i18n/index.js.map +1 -1
  181. package/dist/i18n/translator-adapter.js +1 -1
  182. package/dist/i18n/translator-adapter.js.map +1 -1
  183. package/dist/i18n/translator.d.ts.map +1 -1
  184. package/dist/i18n/translator.js +1 -0
  185. package/dist/i18n/translator.js.map +1 -1
  186. package/dist/index.d.ts +1 -2
  187. package/dist/index.d.ts.map +1 -1
  188. package/dist/index.js +2 -3
  189. package/dist/index.js.map +1 -1
  190. package/dist/logging/console-handler.js +1 -1
  191. package/dist/logging/console-handler.js.map +1 -1
  192. package/dist/logging/file-handler.d.ts.map +1 -1
  193. package/dist/logging/file-handler.js +4 -5
  194. package/dist/logging/file-handler.js.map +1 -1
  195. package/dist/logging/index.d.ts +2 -2
  196. package/dist/logging/index.d.ts.map +1 -1
  197. package/dist/logging/index.js +1 -1
  198. package/dist/logging/index.js.map +1 -1
  199. package/dist/logging/logger.d.ts +18 -22
  200. package/dist/logging/logger.d.ts.map +1 -1
  201. package/dist/logging/logger.js +38 -64
  202. package/dist/logging/logger.js.map +1 -1
  203. package/dist/logging/loki-handler.js +1 -1
  204. package/dist/logging/loki-handler.js.map +1 -1
  205. package/dist/logging/setup.d.ts +4 -3
  206. package/dist/logging/setup.d.ts.map +1 -1
  207. package/dist/logging/setup.js +136 -33
  208. package/dist/logging/setup.js.map +1 -1
  209. package/dist/output/ansi-utils.d.ts +13 -0
  210. package/dist/output/ansi-utils.d.ts.map +1 -0
  211. package/dist/output/ansi-utils.js +37 -0
  212. package/dist/output/ansi-utils.js.map +1 -0
  213. package/dist/output/index.d.ts +2 -5
  214. package/dist/output/index.d.ts.map +1 -1
  215. package/dist/output/index.js +3 -2
  216. package/dist/output/index.js.map +1 -1
  217. package/dist/output/output-events.d.ts +0 -1
  218. package/dist/output/output-events.d.ts.map +1 -1
  219. package/dist/output/tables/catalog.d.ts +5 -2
  220. package/dist/output/tables/catalog.d.ts.map +1 -1
  221. package/dist/output/tables/catalog.js +65 -9
  222. package/dist/output/tables/catalog.js.map +1 -1
  223. package/dist/output/tables/evaluation.d.ts.map +1 -1
  224. package/dist/output/tables/evaluation.js +3 -0
  225. package/dist/output/tables/evaluation.js.map +1 -1
  226. package/dist/output/tables/health-status.d.ts.map +1 -1
  227. package/dist/output/tables/health-status.js +11 -7
  228. package/dist/output/tables/health-status.js.map +1 -1
  229. package/dist/output/tables/index.d.ts +3 -3
  230. package/dist/output/tables/index.d.ts.map +1 -1
  231. package/dist/output/tables/index.js +2 -2
  232. package/dist/output/tables/index.js.map +1 -1
  233. package/dist/output/tables/render.d.ts.map +1 -1
  234. package/dist/output/tables/render.js +2 -10
  235. package/dist/output/tables/render.js.map +1 -1
  236. package/dist/output/terminal.d.ts +1 -5
  237. package/dist/output/terminal.d.ts.map +1 -1
  238. package/dist/output/terminal.js +25 -24
  239. package/dist/output/terminal.js.map +1 -1
  240. package/dist/output/view-models.d.ts +28 -2
  241. package/dist/output/view-models.d.ts.map +1 -1
  242. package/dist/program.d.ts.map +1 -1
  243. package/dist/program.js +21 -29
  244. package/dist/program.js.map +1 -1
  245. package/dist/repl/controller.d.ts.map +1 -1
  246. package/dist/repl/controller.js +82 -47
  247. package/dist/repl/controller.js.map +1 -1
  248. package/dist/repl/core/output-bridge.d.ts.map +1 -1
  249. package/dist/repl/core/output-bridge.js +6 -4
  250. package/dist/repl/core/output-bridge.js.map +1 -1
  251. package/dist/repl/core/progress-types.d.ts +1 -1
  252. package/dist/repl/core/progress-types.d.ts.map +1 -1
  253. package/dist/repl/core/progress-types.js +1 -1
  254. package/dist/repl/core/progress-types.js.map +1 -1
  255. package/dist/repl/examples.d.ts +5 -7
  256. package/dist/repl/examples.d.ts.map +1 -1
  257. package/dist/repl/examples.js +27 -14
  258. package/dist/repl/examples.js.map +1 -1
  259. package/dist/repl/executor.d.ts +2 -4
  260. package/dist/repl/executor.d.ts.map +1 -1
  261. package/dist/repl/executor.js +69 -58
  262. package/dist/repl/executor.js.map +1 -1
  263. package/dist/repl/help.d.ts +10 -3
  264. package/dist/repl/help.d.ts.map +1 -1
  265. package/dist/repl/help.js +31 -4
  266. package/dist/repl/help.js.map +1 -1
  267. package/dist/repl/history/command-history.js +5 -5
  268. package/dist/repl/history/command-history.js.map +1 -1
  269. package/dist/repl/history/output-render.d.ts +1 -3
  270. package/dist/repl/history/output-render.d.ts.map +1 -1
  271. package/dist/repl/history/output-render.js +4 -6
  272. package/dist/repl/history/output-render.js.map +1 -1
  273. package/dist/repl/history/output-store.d.ts.map +1 -1
  274. package/dist/repl/history/output-store.js +6 -3
  275. package/dist/repl/history/output-store.js.map +1 -1
  276. package/dist/repl/input/autocomplete-provider.d.ts.map +1 -1
  277. package/dist/repl/input/autocomplete-provider.js +1 -2
  278. package/dist/repl/input/autocomplete-provider.js.map +1 -1
  279. package/dist/repl/input/completer.d.ts +0 -2
  280. package/dist/repl/input/completer.d.ts.map +1 -1
  281. package/dist/repl/input/completer.js +9 -7
  282. package/dist/repl/input/completer.js.map +1 -1
  283. package/dist/repl/input/ghost-text.d.ts +1 -1
  284. package/dist/repl/input/ghost-text.d.ts.map +1 -1
  285. package/dist/repl/input/ghost-text.js +1 -1
  286. package/dist/repl/input/ghost-text.js.map +1 -1
  287. package/dist/repl/input/input-handler.d.ts.map +1 -1
  288. package/dist/repl/input/input-handler.js +21 -15
  289. package/dist/repl/input/input-handler.js.map +1 -1
  290. package/dist/repl/input/keybindings.d.ts +0 -5
  291. package/dist/repl/input/keybindings.d.ts.map +1 -1
  292. package/dist/repl/input/keybindings.js +0 -65
  293. package/dist/repl/input/keybindings.js.map +1 -1
  294. package/dist/repl/loop.d.ts +1 -2
  295. package/dist/repl/loop.d.ts.map +1 -1
  296. package/dist/repl/loop.js +14 -14
  297. package/dist/repl/loop.js.map +1 -1
  298. package/dist/repl/registry.d.ts +28 -20
  299. package/dist/repl/registry.d.ts.map +1 -1
  300. package/dist/repl/registry.js +229 -171
  301. package/dist/repl/registry.js.map +1 -1
  302. package/dist/repl/service.d.ts +1 -10
  303. package/dist/repl/service.d.ts.map +1 -1
  304. package/dist/repl/service.js +15 -26
  305. package/dist/repl/service.js.map +1 -1
  306. package/dist/repl/ui/components/curl-panel.js +4 -4
  307. package/dist/repl/ui/components/curl-panel.js.map +1 -1
  308. package/dist/repl/ui/components/ghost-text-editor.d.ts +4 -0
  309. package/dist/repl/ui/components/ghost-text-editor.d.ts.map +1 -1
  310. package/dist/repl/ui/components/ghost-text-editor.js +17 -6
  311. package/dist/repl/ui/components/ghost-text-editor.js.map +1 -1
  312. package/dist/repl/ui/components/history-component.d.ts.map +1 -1
  313. package/dist/repl/ui/components/history-component.js +7 -69
  314. package/dist/repl/ui/components/history-component.js.map +1 -1
  315. package/dist/repl/ui/components/progress-bar.js.map +1 -1
  316. package/dist/repl/ui/components/status-bar-line.js +1 -1
  317. package/dist/repl/ui/components/status-bar-line.js.map +1 -1
  318. package/dist/repl/ui/data.js +3 -3
  319. package/dist/repl/ui/data.js.map +1 -1
  320. package/dist/repl/ui/hint-state.d.ts +0 -1
  321. package/dist/repl/ui/hint-state.d.ts.map +1 -1
  322. package/dist/repl/ui/hint-state.js +1 -1
  323. package/dist/repl/ui/hint-state.js.map +1 -1
  324. package/dist/repl/ui/selection-utils.d.ts +28 -0
  325. package/dist/repl/ui/selection-utils.d.ts.map +1 -0
  326. package/dist/repl/ui/selection-utils.js +70 -0
  327. package/dist/repl/ui/selection-utils.js.map +1 -0
  328. package/dist/repl/ui/status-bar.d.ts +1 -4
  329. package/dist/repl/ui/status-bar.d.ts.map +1 -1
  330. package/dist/repl/ui/status-bar.js +6 -33
  331. package/dist/repl/ui/status-bar.js.map +1 -1
  332. package/dist/runtime/async-utils.d.ts +16 -0
  333. package/dist/runtime/async-utils.d.ts.map +1 -0
  334. package/dist/runtime/async-utils.js +40 -0
  335. package/dist/runtime/async-utils.js.map +1 -0
  336. package/dist/runtime/clipboard-win32.d.ts.map +1 -1
  337. package/dist/runtime/clipboard-win32.js +2 -1
  338. package/dist/runtime/clipboard-win32.js.map +1 -1
  339. package/dist/runtime/clipboard.d.ts.map +1 -1
  340. package/dist/runtime/clipboard.js +6 -2
  341. package/dist/runtime/clipboard.js.map +1 -1
  342. package/dist/runtime/external-transport.d.ts.map +1 -1
  343. package/dist/runtime/external-transport.js +1 -1
  344. package/dist/runtime/external-transport.js.map +1 -1
  345. package/dist/runtime/file-args.d.ts +38 -0
  346. package/dist/runtime/file-args.d.ts.map +1 -0
  347. package/dist/runtime/file-args.js +133 -0
  348. package/dist/runtime/file-args.js.map +1 -0
  349. package/dist/runtime/platform.d.ts +0 -2
  350. package/dist/runtime/platform.d.ts.map +1 -1
  351. package/dist/runtime/platform.js +0 -6
  352. package/dist/runtime/platform.js.map +1 -1
  353. package/dist/tui/settings-screen.d.ts +1 -13
  354. package/dist/tui/settings-screen.d.ts.map +1 -1
  355. package/dist/tui/settings-screen.js +46 -34
  356. package/dist/tui/settings-screen.js.map +1 -1
  357. package/dist/version.d.ts.map +1 -1
  358. package/dist/version.js +3 -2
  359. package/dist/version.js.map +1 -1
  360. package/examples/sample.tmx +6 -0
  361. package/package.json +18 -7
@@ -0,0 +1,26 @@
1
+ import type { AuthSession } from "../auth-session.ts";
2
+ import { type FormatInfo, type QeFormatInfo, type DataScoreFormatsResponse, type DataAnnotateFormatsResponse, type AnnotateOptionsResponse } from "../models.ts";
3
+ /**
4
+ * Discovery API resource for format/options discovery across all services.
5
+ *
6
+ * All endpoints are public (LIGHT rate limit), but use AuthSession for
7
+ * consistency with the existing resource pattern.
8
+ */
9
+ export declare class DiscoveryResource {
10
+ private readonly session;
11
+ private readonly baseUrl;
12
+ constructor(session: AuthSession, baseUrl: string);
13
+ /** Shared GET + Zod parse. Eliminates boilerplate across 5 discovery methods. */
14
+ private get;
15
+ /** GET /v1/translation/document/formats — document translation formats. */
16
+ documentFormats(): Promise<FormatInfo[]>;
17
+ /** GET /v1/quality/score/formats — QE file scoring formats. */
18
+ qeFormats(): Promise<QeFormatInfo[]>;
19
+ /** GET /v1/data/score/formats — Bicleaner scoring formats. */
20
+ dataScoreFormats(): Promise<DataScoreFormatsResponse>;
21
+ /** GET /v1/data/annotate/formats — annotation input formats. */
22
+ dataAnnotateFormats(): Promise<DataAnnotateFormatsResponse>;
23
+ /** GET /v1/data/annotate/options — pipeline stages, LID models, defaults. */
24
+ annotateOptions(): Promise<AnnotateOptionsResponse>;
25
+ }
26
+ //# sourceMappingURL=discovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../../src/api/resources/discovery.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAML,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC7B,MAAM,cAAc,CAAC;AAGtB;;;;;GAKG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM;IAKjD,iFAAiF;YACnE,GAAG;IAKjB,2EAA2E;IACrE,eAAe,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAK9C,+DAA+D;IACzD,SAAS,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAK1C,8DAA8D;IACxD,gBAAgB,IAAI,OAAO,CAAC,wBAAwB,CAAC;IAI3D,gEAAgE;IAC1D,mBAAmB,IAAI,OAAO,CAAC,2BAA2B,CAAC;IAIjE,6EAA6E;IACvE,eAAe,IAAI,OAAO,CAAC,uBAAuB,CAAC;CAG1D"}
@@ -0,0 +1,46 @@
1
+ // Discovery API resource — format and options endpoints for all services.
2
+ // Replaces FormatsResource (which only covered document translation formats).
3
+ import { FormatsResponseSchema, QeFormatsResponseSchema, DataScoreFormatsResponseSchema, DataAnnotateFormatsResponseSchema, AnnotateOptionsResponseSchema, } from "../models.js";
4
+ import { Endpoint } from "../../constants.js";
5
+ /**
6
+ * Discovery API resource for format/options discovery across all services.
7
+ *
8
+ * All endpoints are public (LIGHT rate limit), but use AuthSession for
9
+ * consistency with the existing resource pattern.
10
+ */
11
+ export class DiscoveryResource {
12
+ session;
13
+ baseUrl;
14
+ constructor(session, baseUrl) {
15
+ this.session = session;
16
+ this.baseUrl = baseUrl;
17
+ }
18
+ /** Shared GET + Zod parse. Eliminates boilerplate across 5 discovery methods. */
19
+ async get(endpoint, schema) {
20
+ const data = await this.session.request("GET", `${this.baseUrl}${endpoint}`, {});
21
+ return schema.parse(data);
22
+ }
23
+ /** GET /v1/translation/document/formats — document translation formats. */
24
+ async documentFormats() {
25
+ const result = await this.get(Endpoint.DOCUMENT_FORMATS, FormatsResponseSchema);
26
+ return result.formats;
27
+ }
28
+ /** GET /v1/quality/score/formats — QE file scoring formats. */
29
+ async qeFormats() {
30
+ const result = await this.get(Endpoint.QE_FORMATS, QeFormatsResponseSchema);
31
+ return result.formats;
32
+ }
33
+ /** GET /v1/data/score/formats — Bicleaner scoring formats. */
34
+ async dataScoreFormats() {
35
+ return this.get(Endpoint.DATA_SCORE_FORMATS, DataScoreFormatsResponseSchema);
36
+ }
37
+ /** GET /v1/data/annotate/formats — annotation input formats. */
38
+ async dataAnnotateFormats() {
39
+ return this.get(Endpoint.DATA_ANNOTATE_FORMATS, DataAnnotateFormatsResponseSchema);
40
+ }
41
+ /** GET /v1/data/annotate/options — pipeline stages, LID models, defaults. */
42
+ async annotateOptions() {
43
+ return this.get(Endpoint.DATA_ANNOTATE_OPTIONS, AnnotateOptionsResponseSchema);
44
+ }
45
+ }
46
+ //# sourceMappingURL=discovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../../src/api/resources/discovery.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,8EAA8E;AAI9E,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,8BAA8B,EAC9B,iCAAiC,EACjC,6BAA6B,GAM9B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,OAAO,iBAAiB;IACX,OAAO,CAAc;IACrB,OAAO,CAAS;IAEjC,YAAY,OAAoB,EAAE,OAAe;QAC/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,iFAAiF;IACzE,KAAK,CAAC,GAAG,CAAI,QAAgB,EAAE,MAAoB;QACzD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAU,KAAK,EAAE,GAAG,IAAI,CAAC,OAAO,GAAG,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;QAC1F,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,2EAA2E;IAC3E,KAAK,CAAC,eAAe;QACnB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;QAChF,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,+DAA+D;IAC/D,KAAK,CAAC,SAAS;QACb,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,EAAE,uBAAuB,CAAC,CAAC;QAC5E,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,8DAA8D;IAC9D,KAAK,CAAC,gBAAgB;QACpB,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,kBAAkB,EAAE,8BAA8B,CAAC,CAAC;IAC/E,CAAC;IAED,gEAAgE;IAChE,KAAK,CAAC,mBAAmB;QACvB,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,qBAAqB,EAAE,iCAAiC,CAAC,CAAC;IACrF,CAAC;IAED,6EAA6E;IAC7E,KAAK,CAAC,eAAe;QACnB,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,qBAAqB,EAAE,6BAA6B,CAAC,CAAC;IACjF,CAAC;CACF"}
@@ -1,26 +1,23 @@
1
1
  import type { AuthSession } from "../auth-session.ts";
2
- import { type EvaluationResponse, type Segment } from "../models.ts";
2
+ import { type EvaluationResponse, type EvaluateParams, type EvaluateFileParams, type EvaluateFileResult } from "../models.ts";
3
3
  /**
4
4
  * Evaluation API resource.
5
5
  *
6
- * Calls POST /v1/translation/score via AuthSession (requires auth).
7
- * Validates response with Zod schema at boundary.
6
+ * - evaluate(): POST /v1/quality/score (JSON inline, via AuthSession)
7
+ * - evaluateFile(): POST /v1/quality/score/file (multipart upload, binary response via requestRaw)
8
8
  */
9
9
  export declare class EvaluationResource {
10
10
  private readonly session;
11
11
  private readonly baseUrl;
12
12
  constructor(session: AuthSession, baseUrl: string);
13
+ /** Evaluate translation quality with specified metrics (inline segments). */
14
+ evaluate(params: EvaluateParams): Promise<EvaluationResponse>;
13
15
  /**
14
- * Evaluate translation quality with specified metrics.
16
+ * Score a file via POST /v1/quality/score/file (multipart upload, binary response).
15
17
  *
16
- * @param segments - Array of source/hypothesis/reference triplets
17
- * @param metrics - Array of metric names (e.g. ["bleu", "chrf", "metricx"])
18
- * @param aggregation - Aggregation mode (default "both" for corpus + segment)
19
- * @returns Validated EvaluationResponse with corpus_scores and segment_scores
20
- * @throws AuthenticationError if not authenticated
21
- * @throws ZodError if response schema mismatch
22
- * @throws APIError on API errors
18
+ * Uses requestRaw() (buffer + headers) because we need X-Corpus-Scores header.
19
+ * File size bounded by JOB_MAX_DOCUMENT_SIZE_MB (50MB) safe to buffer.
23
20
  */
24
- evaluate(segments: Segment[], metrics: string[], aggregation?: string): Promise<EvaluationResponse>;
21
+ evaluateFile(params: EvaluateFileParams, outputPath: string, signal?: AbortSignal): Promise<EvaluateFileResult>;
25
22
  }
26
23
  //# sourceMappingURL=evaluation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evaluation.d.ts","sourceRoot":"","sources":["../../../src/api/resources/evaluation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAA4B,KAAK,kBAAkB,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAG/F;;;;;GAKG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM;IAKjD;;;;;;;;;;OAUG;IACG,QAAQ,CACZ,QAAQ,EAAE,OAAO,EAAE,EACnB,OAAO,EAAE,MAAM,EAAE,EACjB,WAAW,SAAS,GACnB,OAAO,CAAC,kBAAkB,CAAC;CAW/B"}
1
+ {"version":3,"file":"evaluation.d.ts","sourceRoot":"","sources":["../../../src/api/resources/evaluation.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAGtB;;;;;GAKG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM;IAKjD,6EAA6E;IACvE,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAcnE;;;;;OAKG;IACG,YAAY,CAChB,MAAM,EAAE,kBAAkB,EAC1B,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,kBAAkB,CAAC;CA6B/B"}
@@ -1,12 +1,15 @@
1
- // See API-477: Evaluation resource - POST /v1/translation/score with Zod validation
2
- // Uses AuthSession (authenticated requests with auto-refresh).
3
- import { EvaluationResponseSchema } from "../models.js";
1
+ // Evaluation resource - POST /v1/quality/score (inline) + POST /v1/quality/score/file (file)
2
+ // Both methods go through AuthSession for auth, retry, hooks, and error classification.
3
+ import { openAsBlob } from "node:fs";
4
+ import { writeFile } from "node:fs/promises";
5
+ import { basename } from "node:path";
6
+ import { EvaluationResponseSchema, } from "../models.js";
4
7
  import { Endpoint } from "../../constants.js";
5
8
  /**
6
9
  * Evaluation API resource.
7
10
  *
8
- * Calls POST /v1/translation/score via AuthSession (requires auth).
9
- * Validates response with Zod schema at boundary.
11
+ * - evaluate(): POST /v1/quality/score (JSON inline, via AuthSession)
12
+ * - evaluateFile(): POST /v1/quality/score/file (multipart upload, binary response via requestRaw)
10
13
  */
11
14
  export class EvaluationResource {
12
15
  session;
@@ -15,24 +18,46 @@ export class EvaluationResource {
15
18
  this.session = session;
16
19
  this.baseUrl = baseUrl;
17
20
  }
21
+ /** Evaluate translation quality with specified metrics (inline segments). */
22
+ async evaluate(params) {
23
+ const { segments, metrics, aggregation = "both" } = params;
24
+ const data = await this.session.request("POST", `${this.baseUrl}${Endpoint.EVALUATE}`, {
25
+ json: { segments, metrics, aggregation },
26
+ });
27
+ return EvaluationResponseSchema.parse(data);
28
+ }
18
29
  /**
19
- * Evaluate translation quality with specified metrics.
30
+ * Score a file via POST /v1/quality/score/file (multipart upload, binary response).
20
31
  *
21
- * @param segments - Array of source/hypothesis/reference triplets
22
- * @param metrics - Array of metric names (e.g. ["bleu", "chrf", "metricx"])
23
- * @param aggregation - Aggregation mode (default "both" for corpus + segment)
24
- * @returns Validated EvaluationResponse with corpus_scores and segment_scores
25
- * @throws AuthenticationError if not authenticated
26
- * @throws ZodError if response schema mismatch
27
- * @throws APIError on API errors
32
+ * Uses requestRaw() (buffer + headers) because we need X-Corpus-Scores header.
33
+ * File size bounded by JOB_MAX_DOCUMENT_SIZE_MB (50MB) safe to buffer.
28
34
  */
29
- async evaluate(segments, metrics, aggregation = "both") {
30
- const baseUrl = this.baseUrl;
31
- const body = { segments, metrics, aggregation };
32
- const data = await this.session.request("POST", `${baseUrl}${Endpoint.EVALUATE}`, {
33
- json: body,
34
- });
35
- return EvaluationResponseSchema.parse(data);
35
+ async evaluateFile(params, outputPath, signal) {
36
+ const { filePath, metrics, aggregation = "both", outputFormat } = params;
37
+ const url = `${this.baseUrl}${Endpoint.EVALUATE_FILE}`;
38
+ // Build multipart form (openAsBlob streams from disk without buffering)
39
+ const fileBlob = await openAsBlob(filePath);
40
+ const formData = new FormData();
41
+ formData.append("file", fileBlob, basename(filePath));
42
+ if (metrics?.length)
43
+ formData.append("metrics", metrics.join(","));
44
+ formData.append("aggregation", aggregation);
45
+ if (outputFormat)
46
+ formData.append("output_format", outputFormat);
47
+ const response = await this.session.requestRaw("POST", url, { body: formData }, signal);
48
+ // Parse corpus scores from X-Corpus-Scores header
49
+ let corpusScores = {};
50
+ const scoresHeader = response.headers["x-corpus-scores"];
51
+ if (typeof scoresHeader === "string") {
52
+ try {
53
+ corpusScores = JSON.parse(scoresHeader);
54
+ }
55
+ catch {
56
+ /* malformed header */
57
+ }
58
+ }
59
+ await writeFile(outputPath, response.body, { signal });
60
+ return { data: Buffer.alloc(0), filename: outputPath, corpusScores };
36
61
  }
37
62
  }
38
63
  //# sourceMappingURL=evaluation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"evaluation.js","sourceRoot":"","sources":["../../../src/api/resources/evaluation.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,+DAA+D;AAG/D,OAAO,EAAE,wBAAwB,EAAyC,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,OAAO,kBAAkB;IACZ,OAAO,CAAc;IACrB,OAAO,CAAS;IAEjC,YAAY,OAAoB,EAAE,OAAe;QAC/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,QAAQ,CACZ,QAAmB,EACnB,OAAiB,EACjB,WAAW,GAAG,MAAM;QAEpB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,MAAM,IAAI,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;QAEhD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAU,MAAM,EAAE,GAAG,OAAO,GAAG,QAAQ,CAAC,QAAQ,EAAE,EAAE;YACzF,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;QAEH,OAAO,wBAAwB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;CACF"}
1
+ {"version":3,"file":"evaluation.js","sourceRoot":"","sources":["../../../src/api/resources/evaluation.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,wFAAwF;AAExF,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;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,IAAI,OAAO,EAAE,MAAM;YAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACnE,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QAC5C,IAAI,YAAY;YAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;QAEjE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;QAExF,kDAAkD;QAClD,IAAI,YAAY,GAA2B,EAAE,CAAC;QAC9C,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACzD,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;YACrC,IAAI,CAAC;gBACH,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAA2B,CAAC;YACpE,CAAC;YAAC,MAAM,CAAC;gBACP,sBAAsB;YACxB,CAAC;QACH,CAAC;QAED,MAAM,SAAS,CAAC,UAAU,EAAE,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QAEvD,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;IACvE,CAAC;CACF"}
@@ -3,7 +3,7 @@ import { type FormatInfo } from "../models.ts";
3
3
  /**
4
4
  * Formats API resource.
5
5
  *
6
- * Calls GET /v1/formats via AuthSession (requires auth).
6
+ * Calls GET /v1/translation/document/formats via AuthSession (requires auth).
7
7
  * Validates response with Zod schema at boundary.
8
8
  */
9
9
  export declare class FormatsResource {
@@ -1,11 +1,11 @@
1
- // See API-484: Formats resource - GET /v1/formats with Zod validation
1
+ // See API-484: Formats resource - GET /v1/translation/document/formats with Zod validation
2
2
  // Uses AuthSession (authenticated requests with auto-refresh).
3
3
  import { FormatsResponseSchema } from "../models.js";
4
4
  import { Endpoint } from "../../constants.js";
5
5
  /**
6
6
  * Formats API resource.
7
7
  *
8
- * Calls GET /v1/formats via AuthSession (requires auth).
8
+ * Calls GET /v1/translation/document/formats via AuthSession (requires auth).
9
9
  * Validates response with Zod schema at boundary.
10
10
  */
11
11
  export class FormatsResource {
@@ -1 +1 @@
1
- {"version":3,"file":"formats.js","sourceRoot":"","sources":["../../../src/api/resources/formats.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,+DAA+D;AAG/D,OAAO,EAAE,qBAAqB,EAAmB,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IACT,OAAO,CAAc;IACrB,OAAO,CAAS;IAEjC,YAAY,OAAoB,EAAE,OAAe;QAC/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAU,KAAK,EAAE,GAAG,OAAO,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAE7F,MAAM,MAAM,GAAG,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjD,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;CACF"}
1
+ {"version":3,"file":"formats.js","sourceRoot":"","sources":["../../../src/api/resources/formats.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,+DAA+D;AAG/D,OAAO,EAAE,qBAAqB,EAAmB,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IACT,OAAO,CAAc;IACrB,OAAO,CAAS;IAEjC,YAAY,OAAoB,EAAE,OAAe;QAC/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAU,KAAK,EAAE,GAAG,OAAO,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAE7F,MAAM,MAAM,GAAG,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjD,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;CACF"}
@@ -19,17 +19,16 @@ export declare class JobsResource {
19
19
  */
20
20
  cancel(jobId: string): Promise<void>;
21
21
  /**
22
- * Download job result to file with streaming and auto-extension detection.
22
+ * Download job result to file via streaming.
23
23
  *
24
- * Parses Content-Disposition header for server-indicated filename/extension.
25
- * Streams response body to disk via pipeline to avoid OOM on large files.
24
+ * Uses requestToFile() for memory-safe streaming (annotation jobs can be up to 10GB).
25
+ * Client owns output filenames no Content-Disposition parsing.
26
26
  *
27
27
  * @param jobId - Job identifier
28
- * @param outputPath - Desired output file path
29
- * @returns Actual output path (may differ if server indicates format conversion)
30
- * @throws AuthenticationError if not authenticated
31
- * @throws APIError on API errors (404 not found, job not completed)
28
+ * @param outputPath - Output file path (computed by resolveOutputPaths)
29
+ * @param signal - Optional abort signal for cancellation
30
+ * @returns The output path
32
31
  */
33
- download(jobId: string, outputPath: string): Promise<string>;
32
+ download(jobId: string, outputPath: string, signal?: AbortSignal): Promise<string>;
34
33
  }
35
34
  //# sourceMappingURL=jobs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../../../src/api/resources/jobs.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAI/E;;;;;GAKG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM;IAKjD;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IASvD;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO1C;;;;;;;;;;;OAWG;IACG,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CA2CnE"}
1
+ {"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../../../src/api/resources/jobs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAG/E;;;;;GAKG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM;IAKjD;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IASvD;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO1C;;;;;;;;;;OAUG;IACG,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;CAMzF"}
@@ -1,14 +1,8 @@
1
1
  // Jobs resource - status, cancel, download with Zod validation
2
2
  // Used by translate file and data commands for job lifecycle.
3
- // Download uses got streaming + Content-Disposition header parsing.
4
- import { createWriteStream } from "node:fs";
5
- import { rename } from "node:fs/promises";
6
- import { pipeline } from "node:stream/promises";
7
- import { extname, dirname, basename, join } from "node:path";
8
- import got from "got";
3
+ // All methods go through AuthSession for auth, retry, hooks, and error classification.
9
4
  import { JobStatusResponseSchema } from "../models.js";
10
- import { getAccessToken } from "../../config/credentials.js";
11
- import { Endpoint, HEADER_AUTHORIZATION, BEARER_PREFIX } from "../../constants.js";
5
+ import { Endpoint } from "../../constants.js";
12
6
  /**
13
7
  * Jobs API resource.
14
8
  *
@@ -40,53 +34,20 @@ export class JobsResource {
40
34
  await this.session.request("DELETE", url);
41
35
  }
42
36
  /**
43
- * Download job result to file with streaming and auto-extension detection.
37
+ * Download job result to file via streaming.
44
38
  *
45
- * Parses Content-Disposition header for server-indicated filename/extension.
46
- * Streams response body to disk via pipeline to avoid OOM on large files.
39
+ * Uses requestToFile() for memory-safe streaming (annotation jobs can be up to 10GB).
40
+ * Client owns output filenames no Content-Disposition parsing.
47
41
  *
48
42
  * @param jobId - Job identifier
49
- * @param outputPath - Desired output file path
50
- * @returns Actual output path (may differ if server indicates format conversion)
51
- * @throws AuthenticationError if not authenticated
52
- * @throws APIError on API errors (404 not found, job not completed)
43
+ * @param outputPath - Output file path (computed by resolveOutputPaths)
44
+ * @param signal - Optional abort signal for cancellation
45
+ * @returns The output path
53
46
  */
54
- async download(jobId, outputPath) {
47
+ async download(jobId, outputPath, signal) {
55
48
  const baseUrl = this.baseUrl;
56
49
  const url = `${baseUrl}${Endpoint.JOB_RESULT.replace("{job_id}", jobId)}`;
57
- // Use got.stream() for memory-efficient download of large files.
58
- // Cannot use session.request because transport forces responseType:"json".
59
- const token = getAccessToken();
60
- const headers = {};
61
- if (token) {
62
- headers[HEADER_AUTHORIZATION] = `${BEARER_PREFIX} ${token}`;
63
- }
64
- // Stream to initial output path, then rename if Content-Disposition indicates
65
- // a different extension (e.g., PDF input converted to DOCX output).
66
- let actualPath = outputPath;
67
- const stream = got.stream(url, { method: "GET", headers });
68
- // Listen for response event to parse Content-Disposition before streaming body
69
- stream.on("response", (response) => {
70
- const cd = response.headers["content-disposition"] ?? "";
71
- if (cd.includes("filename=")) {
72
- const match = /filename="?([^";\s]+)"?/.exec(cd);
73
- if (match) {
74
- const serverExt = extname(match[1]);
75
- if (serverExt && serverExt !== extname(outputPath)) {
76
- const base = basename(outputPath, extname(outputPath));
77
- actualPath = join(dirname(outputPath), `${base}${serverExt}`);
78
- }
79
- }
80
- }
81
- });
82
- // Stream response body to file via pipeline (backpressure-aware)
83
- const fileStream = createWriteStream(outputPath);
84
- await pipeline(stream, fileStream);
85
- // If Content-Disposition indicated a different extension, rename the file
86
- if (actualPath !== outputPath) {
87
- await rename(outputPath, actualPath);
88
- }
89
- return actualPath;
50
+ return this.session.requestToFile("GET", url, outputPath, {}, signal);
90
51
  }
91
52
  }
92
53
  //# sourceMappingURL=jobs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"jobs.js","sourceRoot":"","sources":["../../../src/api/resources/jobs.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,8DAA8D;AAC9D,oEAAoE;AAEpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAE,uBAAuB,EAA0B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UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;QAEnE,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAU,QAAQ,EAAE,GAAG,CAAC,CAAC;IACrD,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,QAAQ,CAAC,KAAa,EAAE,UAAkB,EAAE,MAAoB;QACpE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,MAAM,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;QAE1E,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;IACxE,CAAC;CACF"}
@@ -0,0 +1,25 @@
1
+ import type { AuthSession } from "../auth-session.ts";
2
+ import { type LanguagePairDetail } from "../models.ts";
3
+ /**
4
+ * Languages API resource.
5
+ *
6
+ * Calls GET /v1/translation/languages via AuthSession (requires auth).
7
+ * Validates response with Zod schema at boundary.
8
+ */
9
+ export declare class LanguagesResource {
10
+ private readonly session;
11
+ private readonly baseUrl;
12
+ constructor(session: AuthSession, baseUrl: string);
13
+ /**
14
+ * List available language pairs.
15
+ *
16
+ * @param source - Optional source language code filter (BCP 47)
17
+ * @param target - Optional target language code filter (BCP 47)
18
+ * @returns Validated array of LanguagePairDetail objects
19
+ * @throws AuthenticationError if not authenticated
20
+ * @throws ZodError if response schema mismatch
21
+ * @throws APIError on API errors
22
+ */
23
+ list(source?: string, target?: string): Promise<LanguagePairDetail[]>;
24
+ }
25
+ //# sourceMappingURL=languages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languages.d.ts","sourceRoot":"","sources":["../../../src/api/resources/languages.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAA4B,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGjF;;;;;GAKG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM;IAKjD;;;;;;;;;OASG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;CAiB5E"}
@@ -0,0 +1,44 @@
1
+ // Languages resource - GET /v1/translation/languages with Zod validation
2
+ // Uses AuthSession (authenticated requests with auto-refresh).
3
+ import { z } from "zod";
4
+ import { LanguagePairDetailSchema } from "../models.js";
5
+ import { Endpoint } from "../../constants.js";
6
+ /**
7
+ * Languages API resource.
8
+ *
9
+ * Calls GET /v1/translation/languages via AuthSession (requires auth).
10
+ * Validates response with Zod schema at boundary.
11
+ */
12
+ export class LanguagesResource {
13
+ session;
14
+ baseUrl;
15
+ constructor(session, baseUrl) {
16
+ this.session = session;
17
+ this.baseUrl = baseUrl;
18
+ }
19
+ /**
20
+ * List available language pairs.
21
+ *
22
+ * @param source - Optional source language code filter (BCP 47)
23
+ * @param target - Optional target language code filter (BCP 47)
24
+ * @returns Validated array of LanguagePairDetail objects
25
+ * @throws AuthenticationError if not authenticated
26
+ * @throws ZodError if response schema mismatch
27
+ * @throws APIError on API errors
28
+ */
29
+ async list(source, target) {
30
+ const baseUrl = this.baseUrl;
31
+ const params = {};
32
+ if (source) {
33
+ params.source = source;
34
+ }
35
+ if (target) {
36
+ params.target = target;
37
+ }
38
+ const data = await this.session.request("GET", `${baseUrl}${Endpoint.LANGUAGES}`, {
39
+ searchParams: params,
40
+ });
41
+ return z.array(LanguagePairDetailSchema).parse(data);
42
+ }
43
+ }
44
+ //# sourceMappingURL=languages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languages.js","sourceRoot":"","sources":["../../../src/api/resources/languages.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,+DAA+D;AAE/D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,wBAAwB,EAA2B,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,OAAO,iBAAiB;IACX,OAAO,CAAc;IACrB,OAAO,CAAS;IAEjC,YAAY,OAAoB,EAAE,OAAe;QAC/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,IAAI,CAAC,MAAe,EAAE,MAAe;QACzC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,MAAM,MAAM,GAA2B,EAAE,CAAC;QAC1C,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QACzB,CAAC;QACD,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QACzB,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAU,KAAK,EAAE,GAAG,OAAO,GAAG,QAAQ,CAAC,SAAS,EAAE,EAAE;YACzF,YAAY,EAAE,MAAM;SACrB,CAAC,CAAC;QAEH,OAAO,CAAC,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC;CACF"}
@@ -1,12 +1,12 @@
1
1
  import type { AuthSession } from "../auth-session.ts";
2
- import { type TranslationResponse, type DocJobCreateResponse } from "../models.ts";
2
+ import { type TranslationResponse, type DocJobCreateResponse, type TranslateParams, type UploadDocumentParams } from "../models.ts";
3
3
  /**
4
4
  * Translation API resource.
5
5
  *
6
- * Calls POST /v1/translate via AuthSession (requires auth).
6
+ * Calls POST /v1/translation via AuthSession (requires auth).
7
7
  * Validates response with Zod schema at boundary.
8
- * - translate(): POST /v1/translate (text translation)
9
- * - uploadDocument(): POST /v1/documents/translate (async file processing)
8
+ * - translate(): POST /v1/translation (text translation)
9
+ * - uploadDocument(): POST /v1/translation/document (async file processing)
10
10
  */
11
11
  export declare class TranslationResource {
12
12
  private readonly session;
@@ -15,32 +15,24 @@ export declare class TranslationResource {
15
15
  /**
16
16
  * Translate texts via API.
17
17
  *
18
- * @param texts - Array of strings to translate
19
- * @param sourceLang - Source language code
20
- * @param targetLang - Target language code
21
- * @param enableQe - Enable quality estimation scores (default false)
18
+ * @param params - Translation parameters (texts, languages, QE flag)
22
19
  * @returns Validated TranslationResponse
23
20
  * @throws AuthenticationError if not authenticated
24
21
  * @throws ZodError if response schema mismatch
25
22
  * @throws APIError on API errors (422 invalid lang pair, etc.)
26
23
  */
27
- translate(texts: string[], sourceLang: string, targetLang: string, enableQe?: boolean): Promise<TranslationResponse>;
24
+ translate(params: TranslateParams): Promise<TranslationResponse>;
28
25
  /**
29
26
  * Upload document for async translation.
30
27
  *
31
28
  * Sends multipart/form-data POST with file + metadata fields.
32
29
  * Uses openAsBlob for memory-efficient streaming from disk.
33
30
  *
34
- * @param filePath - Path to document file
35
- * @param sourceLang - Source language code
36
- * @param targetLang - Target language code
37
- * @param options - Optional upload parameters
31
+ * @param params - Upload parameters (file path, languages, output format)
38
32
  * @returns Validated DocJobCreateResponse with job_id for tracking
39
33
  * @throws AuthenticationError if not authenticated
40
34
  * @throws APIError on API errors (422 unsupported format, 413 file too large)
41
35
  */
42
- uploadDocument(filePath: string, sourceLang: string, targetLang: string, options?: {
43
- outputFormat?: string;
44
- }): Promise<DocJobCreateResponse>;
36
+ uploadDocument(params: UploadDocumentParams): Promise<DocJobCreateResponse>;
45
37
  }
46
38
  //# sourceMappingURL=translation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../../src/api/resources/translation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAEL,KAAK,mBAAmB,EAExB,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AAKtB;;;;;;;GAOG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM;IAKjD;;;;;;;;;;;OAWG;IACG,SAAS,CACb,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,QAAQ,UAAQ,GACf,OAAO,CAAC,mBAAmB,CAAC;IAoB/B;;;;;;;;;;;;;OAaG;IACG,cAAc,CAClB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;QACR,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GACA,OAAO,CAAC,oBAAoB,CAAC;CAuBjC"}
1
+ {"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../../src/api/resources/translation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAEL,KAAK,mBAAmB,EAExB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AAKtB;;;;;;;GAOG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM;IAKjD;;;;;;;;OAQG;IACG,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAqBtE;;;;;;;;;;OAUG;IACG,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAwBlF"}
@@ -7,10 +7,10 @@ import { basename } from "node:path";
7
7
  /**
8
8
  * Translation API resource.
9
9
  *
10
- * Calls POST /v1/translate via AuthSession (requires auth).
10
+ * Calls POST /v1/translation via AuthSession (requires auth).
11
11
  * Validates response with Zod schema at boundary.
12
- * - translate(): POST /v1/translate (text translation)
13
- * - uploadDocument(): POST /v1/documents/translate (async file processing)
12
+ * - translate(): POST /v1/translation (text translation)
13
+ * - uploadDocument(): POST /v1/translation/document (async file processing)
14
14
  */
15
15
  export class TranslationResource {
16
16
  session;
@@ -22,16 +22,14 @@ export class TranslationResource {
22
22
  /**
23
23
  * Translate texts via API.
24
24
  *
25
- * @param texts - Array of strings to translate
26
- * @param sourceLang - Source language code
27
- * @param targetLang - Target language code
28
- * @param enableQe - Enable quality estimation scores (default false)
25
+ * @param params - Translation parameters (texts, languages, QE flag)
29
26
  * @returns Validated TranslationResponse
30
27
  * @throws AuthenticationError if not authenticated
31
28
  * @throws ZodError if response schema mismatch
32
29
  * @throws APIError on API errors (422 invalid lang pair, etc.)
33
30
  */
34
- async translate(texts, sourceLang, targetLang, enableQe = false) {
31
+ async translate(params) {
32
+ const { texts, sourceLang, targetLang, enableQe = false } = params;
35
33
  const baseUrl = this.baseUrl;
36
34
  const body = {
37
35
  texts,
@@ -52,15 +50,13 @@ export class TranslationResource {
52
50
  * Sends multipart/form-data POST with file + metadata fields.
53
51
  * Uses openAsBlob for memory-efficient streaming from disk.
54
52
  *
55
- * @param filePath - Path to document file
56
- * @param sourceLang - Source language code
57
- * @param targetLang - Target language code
58
- * @param options - Optional upload parameters
53
+ * @param params - Upload parameters (file path, languages, output format)
59
54
  * @returns Validated DocJobCreateResponse with job_id for tracking
60
55
  * @throws AuthenticationError if not authenticated
61
56
  * @throws APIError on API errors (422 unsupported format, 413 file too large)
62
57
  */
63
- async uploadDocument(filePath, sourceLang, targetLang, options) {
58
+ async uploadDocument(params) {
59
+ const { filePath, sourceLang, targetLang, outputFormat } = params;
64
60
  const baseUrl = this.baseUrl;
65
61
  // See API-494: openAsBlob streams from disk without buffering entire file
66
62
  const fileBlob = await openAsBlob(filePath);
@@ -69,8 +65,8 @@ export class TranslationResource {
69
65
  formData.append("file", fileBlob, fileName);
70
66
  formData.append("source_lang", sourceLang);
71
67
  formData.append("target_lang", targetLang);
72
- if (options?.outputFormat) {
73
- formData.append("output_format", options.outputFormat);
68
+ if (outputFormat) {
69
+ formData.append("output_format", outputFormat);
74
70
  }
75
71
  const data = await this.session.request("POST", `${baseUrl}${Endpoint.DOCUMENT_TRANSLATE}`, { body: formData });
76
72
  return DocJobCreateResponseSchema.parse(data);
@@ -1 +1 @@
1
- {"version":3,"file":"translation.js","sourceRoot":"","sources":["../../../src/api/resources/translation.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,+DAA+D;AAG/D,OAAO,EACL,yBAAyB,EAEzB,0BAA0B,GAE3B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC;;;;;;;GAOG;AACH,MAAM,OAAO,mBAAmB;IACb,OAAO,CAAc;IACrB,OAAO,CAAS;IAEjC,YAAY,OAAoB,EAAE,OAAe;QAC/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,SAAS,CACb,KAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,QAAQ,GAAG,KAAK;QAEhB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,MAAM,IAAI,GAA4B;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