arcli 2.1.0 → 2.2.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 (539) hide show
  1. package/CHANGELOG.md +52 -1
  2. package/README.md +6 -0
  3. package/dist/cli/arca-runtime.js +0 -1
  4. package/dist/cli/commands/billing-family.command.js +36 -9
  5. package/dist/cli/commands/billing-shortcuts.command.js +8 -2
  6. package/dist/cli/commands/billing.command.batch.js +0 -1
  7. package/dist/cli/commands/billing.command.interactive-preview.js +9 -13
  8. package/dist/cli/commands/billing.command.options.js +83 -39
  9. package/dist/cli/commands/billing.command.output.js +0 -1
  10. package/dist/cli/commands/billing.command.parser.js +18 -17
  11. package/dist/cli/commands/billing.command.pdf.js +9 -6
  12. package/dist/cli/commands/billing.command.shared.js +2 -2
  13. package/dist/cli/commands/billing.command.shortcuts.js +3 -4
  14. package/dist/cli/commands/completion.command.js +140 -0
  15. package/dist/cli/commands/config.command.js +9 -10
  16. package/dist/cli/commands/cuit-argument.js +6 -6
  17. package/dist/cli/commands/examples.command.js +0 -1
  18. package/dist/cli/commands/export-shortcut.command.js +19 -0
  19. package/dist/cli/commands/export.command.js +106 -0
  20. package/dist/cli/commands/export.command.options.js +140 -0
  21. package/dist/cli/commands/export.command.parser.js +84 -0
  22. package/dist/cli/commands/export.command.pdf.js +61 -0
  23. package/dist/cli/commands/fce-obligation.command.js +2 -3
  24. package/dist/cli/commands/interactive.command.js +2 -3
  25. package/dist/cli/commands/padron.command.js +5 -6
  26. package/dist/cli/commands/parameters.command.js +5 -6
  27. package/dist/cli/commands/pdf.command.js +1 -2
  28. package/dist/cli/commands/storybook.command.js +4 -4
  29. package/dist/cli/commands/vouchers.command.js +9 -9
  30. package/dist/cli/error-output.js +21 -3
  31. package/dist/cli/global-options.js +2 -3
  32. package/dist/cli/help-argv.js +0 -1
  33. package/dist/cli/help.js +186 -380
  34. package/dist/cli/ignored-global-options.js +1 -2
  35. package/dist/cli/index.js +5 -3
  36. package/dist/cli/interactive/advanced-options.js +13 -14
  37. package/dist/cli/interactive/config.flow.js +55 -17
  38. package/dist/cli/interactive/export.flow.js +263 -0
  39. package/dist/cli/interactive/history.flow.js +2 -3
  40. package/dist/cli/interactive/interactive-mode.js +16 -17
  41. package/dist/cli/interactive/invoice-picker.js +7 -7
  42. package/dist/cli/interactive/invoice.flow.js +32 -11
  43. package/dist/cli/interactive/note.flow.js +12 -13
  44. package/dist/cli/interactive/pdf.flow.js +9 -7
  45. package/dist/cli/interactive/prompts.js +0 -1
  46. package/dist/cli/interactive/receiver-padron.js +3 -4
  47. package/dist/cli/interactive/repeat.flow.js +7 -8
  48. package/dist/cli/interactive/session.js +9 -7
  49. package/dist/cli/interactive/status.flow.js +0 -1
  50. package/dist/cli/interactive/update.flow.js +0 -1
  51. package/dist/cli/interactive/validators.js +7 -6
  52. package/dist/cli/option-parsers.js +14 -4
  53. package/dist/cli/program.js +6 -3
  54. package/dist/cli/skipped-options.js +14 -0
  55. package/dist/cli/spinner.js +0 -1
  56. package/dist/cli/types.js +0 -1
  57. package/dist/cli/version.js +1 -2
  58. package/dist/index.js +0 -1
  59. package/dist/lib/dates/arca-date.js +3 -4
  60. package/dist/lib/errors/app-error.js +0 -1
  61. package/dist/lib/files/read-json-file.js +2 -3
  62. package/dist/lib/files/restrict-to-owner.js +0 -1
  63. package/dist/lib/files/write-new-file.js +0 -1
  64. package/dist/lib/identity/cuit.js +26 -0
  65. package/dist/lib/identity/format-cuit.js +1 -2
  66. package/dist/lib/links.js +0 -1
  67. package/dist/lib/numbers/argentine-amount.js +3 -4
  68. package/dist/lib/numbers/strict-integer.js +0 -1
  69. package/dist/lib/paths/mask-path.js +0 -1
  70. package/dist/lib/security/certificate.js +0 -1
  71. package/dist/lib/security/pem.js +2 -3
  72. package/dist/modules/billing/billing-response.js +6 -7
  73. package/dist/modules/billing/billing.amounts.js +3 -4
  74. package/dist/modules/billing/billing.associated-period.js +7 -8
  75. package/dist/modules/billing/billing.associated-vouchers.js +5 -6
  76. package/dist/modules/billing/billing.batch.js +7 -6
  77. package/dist/modules/billing/billing.constants.js +0 -1
  78. package/dist/modules/billing/billing.currency.js +4 -5
  79. package/dist/modules/billing/billing.date-range.js +1 -2
  80. package/dist/modules/billing/billing.display.js +10 -8
  81. package/dist/modules/billing/billing.errors.js +2 -3
  82. package/dist/modules/billing/billing.fce.js +3 -4
  83. package/dist/modules/billing/billing.iva-receptor.js +2 -3
  84. package/dist/modules/billing/billing.json-format.js +0 -1
  85. package/dist/modules/billing/billing.json-input.js +5 -6
  86. package/dist/modules/billing/billing.labels.js +1 -2
  87. package/dist/modules/billing/billing.mappers.js +0 -1
  88. package/dist/modules/billing/billing.padron.js +9 -5
  89. package/dist/modules/billing/billing.presenter.js +0 -1
  90. package/dist/modules/billing/billing.schemas.js +14 -6
  91. package/dist/modules/billing/billing.serialize.js +6 -3
  92. package/dist/modules/billing/billing.service.js +4 -4
  93. package/dist/modules/billing/billing.text.js +0 -1
  94. package/dist/modules/billing/billing.types.internal.js +0 -1
  95. package/dist/modules/billing/billing.types.js +0 -1
  96. package/dist/modules/billing/billing.validation.js +13 -11
  97. package/dist/modules/billing/voucher-kind-map.js +15 -16
  98. package/dist/modules/completion/completion.js +53 -0
  99. package/dist/modules/completion/completion.presenter.js +35 -0
  100. package/dist/modules/completion/installer.js +92 -0
  101. package/dist/modules/completion/shell-scripts.js +46 -0
  102. package/dist/modules/config/certificate-expiry.js +3 -4
  103. package/dist/modules/config/config-doctor.js +36 -14
  104. package/dist/modules/config/config-value-parser.js +29 -16
  105. package/dist/modules/config/config.export-credentials.js +23 -0
  106. package/dist/modules/config/config.presenter.js +22 -6
  107. package/dist/modules/config/config.schemas.js +24 -12
  108. package/dist/modules/config/config.sections.js +26 -11
  109. package/dist/modules/config/config.service.js +6 -2
  110. package/dist/modules/examples/examples.js +44 -10
  111. package/dist/modules/export/export.items.js +149 -0
  112. package/dist/modules/export/export.json-input.js +91 -0
  113. package/dist/modules/export/export.mappers.js +293 -0
  114. package/dist/modules/export/export.presenter.js +2 -0
  115. package/dist/modules/export/export.response.js +86 -0
  116. package/dist/modules/export/export.serialize.js +70 -0
  117. package/dist/modules/export/export.service.js +146 -0
  118. package/dist/modules/export/export.text.js +177 -0
  119. package/dist/modules/export/export.types.js +36 -0
  120. package/dist/modules/fce/fce-obligation.js +3 -4
  121. package/dist/modules/fce/fce-obligation.presenter.js +2 -3
  122. package/dist/modules/interactive/amount-input.js +0 -1
  123. package/dist/modules/interactive/choices.js +10 -2
  124. package/dist/modules/interactive/config-fields.js +11 -3
  125. package/dist/modules/interactive/equivalent-command.js +4 -1
  126. package/dist/modules/interactive/export-equivalent-command.js +40 -0
  127. package/dist/modules/interactive/invoice-copy.js +1 -2
  128. package/dist/modules/interactive/periods.js +0 -1
  129. package/dist/modules/interactive/wizard.js +0 -1
  130. package/dist/modules/padron/padron.js +0 -1
  131. package/dist/modules/padron/padron.presenter.js +6 -7
  132. package/dist/modules/parameters/health.js +0 -1
  133. package/dist/modules/parameters/parameters.js +2 -3
  134. package/dist/modules/parameters/parameters.presenter.js +12 -13
  135. package/dist/modules/parameters/status.js +0 -1
  136. package/dist/modules/pdf/pdf-data.mapper.js +94 -3
  137. package/dist/modules/pdf/pdf-decision.js +0 -1
  138. package/dist/modules/pdf/pdf-file-name.js +0 -1
  139. package/dist/modules/pdf/pdf-issuer.js +3 -3
  140. package/dist/modules/pdf/pdf-legends.js +35 -0
  141. package/dist/modules/pdf/pdf.errors.js +0 -1
  142. package/dist/modules/pdf/pdf.types.js +0 -1
  143. package/dist/modules/storybook/showcase-theme.js +0 -1
  144. package/dist/modules/storybook/showcase.js +20 -21
  145. package/dist/modules/update-check/changelog.js +0 -1
  146. package/dist/modules/update-check/update-check.presenter.js +6 -7
  147. package/dist/modules/update-check/update-check.service.js +0 -1
  148. package/dist/modules/vouchers/voucher-history.js +0 -1
  149. package/dist/modules/vouchers/voucher-history.presenter.js +3 -4
  150. package/dist/services/arca/arca-billing.gateway.js +4 -5
  151. package/dist/services/arca/arca-client.factory.js +23 -2
  152. package/dist/services/arca/arca-context.resolver.js +5 -6
  153. package/dist/services/arca/arca-export.gateway.js +146 -0
  154. package/dist/services/arca/arca-fce-obligation.gateway.js +2 -3
  155. package/dist/services/arca/arca-padron.gateway.js +1 -2
  156. package/dist/services/arca/arca-parameters.gateway.js +2 -3
  157. package/dist/services/arca/arca-voucher-history.gateway.js +2 -3
  158. package/dist/services/arca/last-voucher.js +26 -0
  159. package/dist/services/clipboard/clipboard.js +0 -1
  160. package/dist/services/pdf/escape-html.js +0 -1
  161. package/dist/services/pdf/pdf-browser.js +0 -1
  162. package/dist/services/pdf/pdf-exporter.js +15 -2
  163. package/dist/services/pdf/pdf-plugin.js +41 -14
  164. package/dist/ui/components/certificateBanner.js +0 -1
  165. package/dist/ui/components/contentPanel.js +0 -1
  166. package/dist/ui/components/errorPanel.js +0 -1
  167. package/dist/ui/components/index.js +0 -1
  168. package/dist/ui/components/keyValuePanel.js +0 -1
  169. package/dist/ui/components/noticePanel.js +0 -1
  170. package/dist/ui/components/rawPanel.js +0 -1
  171. package/dist/ui/components/sectionHeading.js +0 -1
  172. package/dist/ui/components/statusBar.js +0 -1
  173. package/dist/ui/components/statusPanel.js +0 -1
  174. package/dist/ui/components/testingBanner.js +0 -1
  175. package/dist/ui/index.js +0 -1
  176. package/dist/ui/presenters/billing.presenter.js +0 -1
  177. package/dist/ui/presenters/config.presenter.js +0 -1
  178. package/dist/ui/presenters/errors.presenter.js +10 -11
  179. package/dist/ui/presenters/errors.zod-presenter.js +8 -9
  180. package/dist/ui/presenters/export.presenter.js +1 -0
  181. package/dist/ui/presenters/index.js +1 -1
  182. package/dist/ui/presenters/pdf.presenter.js +1 -2
  183. package/dist/ui/presenters/showcase.presenter.js +0 -1
  184. package/dist/ui/primitives/index.js +0 -1
  185. package/dist/ui/primitives/renderDivider.js +0 -1
  186. package/dist/ui/primitives/renderFooter.js +0 -1
  187. package/dist/ui/primitives/renderJson.js +0 -1
  188. package/dist/ui/primitives/renderKeyValue.js +0 -1
  189. package/dist/ui/primitives/renderLogo.js +0 -1
  190. package/dist/ui/primitives/renderObject.js +0 -1
  191. package/dist/ui/primitives/renderPanel.js +0 -1
  192. package/dist/ui/primitives/renderSubtitle.js +0 -1
  193. package/dist/ui/primitives/renderTable.js +0 -1
  194. package/dist/ui/primitives/terminalWidth.js +0 -1
  195. package/dist/ui/primitives/text.js +0 -1
  196. package/dist/ui/stream/index.js +0 -1
  197. package/dist/ui/stream/terminal-stream.js +0 -1
  198. package/dist/ui/theme/index.js +0 -1
  199. package/dist/ui/theme/theme.js +0 -1
  200. package/llms.txt +64 -5
  201. package/package.json +1 -2
  202. package/dist/cli/arca-runtime.d.ts +0 -20
  203. package/dist/cli/arca-runtime.js.map +0 -1
  204. package/dist/cli/commands/billing-family.command.d.ts +0 -2
  205. package/dist/cli/commands/billing-family.command.js.map +0 -1
  206. package/dist/cli/commands/billing-shortcuts.command.d.ts +0 -2
  207. package/dist/cli/commands/billing-shortcuts.command.js.map +0 -1
  208. package/dist/cli/commands/billing.command.batch.d.ts +0 -32
  209. package/dist/cli/commands/billing.command.batch.js.map +0 -1
  210. package/dist/cli/commands/billing.command.interactive-preview.d.ts +0 -18
  211. package/dist/cli/commands/billing.command.interactive-preview.js.map +0 -1
  212. package/dist/cli/commands/billing.command.options.d.ts +0 -2
  213. package/dist/cli/commands/billing.command.options.js.map +0 -1
  214. package/dist/cli/commands/billing.command.output.d.ts +0 -18
  215. package/dist/cli/commands/billing.command.output.js.map +0 -1
  216. package/dist/cli/commands/billing.command.parser.d.ts +0 -35
  217. package/dist/cli/commands/billing.command.parser.js.map +0 -1
  218. package/dist/cli/commands/billing.command.pdf.d.ts +0 -24
  219. package/dist/cli/commands/billing.command.pdf.js.map +0 -1
  220. package/dist/cli/commands/billing.command.shared.d.ts +0 -26
  221. package/dist/cli/commands/billing.command.shared.js.map +0 -1
  222. package/dist/cli/commands/billing.command.shortcuts.d.ts +0 -7
  223. package/dist/cli/commands/billing.command.shortcuts.js.map +0 -1
  224. package/dist/cli/commands/config.command.d.ts +0 -6
  225. package/dist/cli/commands/config.command.js.map +0 -1
  226. package/dist/cli/commands/cuit-argument.d.ts +0 -2
  227. package/dist/cli/commands/cuit-argument.js.map +0 -1
  228. package/dist/cli/commands/examples.command.d.ts +0 -2
  229. package/dist/cli/commands/examples.command.js.map +0 -1
  230. package/dist/cli/commands/fce-obligation.command.d.ts +0 -2
  231. package/dist/cli/commands/fce-obligation.command.js.map +0 -1
  232. package/dist/cli/commands/interactive.command.d.ts +0 -3
  233. package/dist/cli/commands/interactive.command.js.map +0 -1
  234. package/dist/cli/commands/padron.command.d.ts +0 -2
  235. package/dist/cli/commands/padron.command.js.map +0 -1
  236. package/dist/cli/commands/parameters.command.d.ts +0 -2
  237. package/dist/cli/commands/parameters.command.js.map +0 -1
  238. package/dist/cli/commands/pdf.command.d.ts +0 -2
  239. package/dist/cli/commands/pdf.command.js.map +0 -1
  240. package/dist/cli/commands/storybook.command.d.ts +0 -2
  241. package/dist/cli/commands/storybook.command.js.map +0 -1
  242. package/dist/cli/commands/vouchers.command.d.ts +0 -2
  243. package/dist/cli/commands/vouchers.command.js.map +0 -1
  244. package/dist/cli/error-output.d.ts +0 -25
  245. package/dist/cli/error-output.js.map +0 -1
  246. package/dist/cli/global-options.d.ts +0 -26
  247. package/dist/cli/global-options.js.map +0 -1
  248. package/dist/cli/help-argv.d.ts +0 -5
  249. package/dist/cli/help-argv.js.map +0 -1
  250. package/dist/cli/help.d.ts +0 -14
  251. package/dist/cli/help.js.map +0 -1
  252. package/dist/cli/ignored-global-options.d.ts +0 -6
  253. package/dist/cli/ignored-global-options.js.map +0 -1
  254. package/dist/cli/index.d.ts +0 -2
  255. package/dist/cli/index.js.map +0 -1
  256. package/dist/cli/interactive/advanced-options.d.ts +0 -21
  257. package/dist/cli/interactive/advanced-options.js.map +0 -1
  258. package/dist/cli/interactive/config.flow.d.ts +0 -4
  259. package/dist/cli/interactive/config.flow.js.map +0 -1
  260. package/dist/cli/interactive/history.flow.d.ts +0 -6
  261. package/dist/cli/interactive/history.flow.js.map +0 -1
  262. package/dist/cli/interactive/interactive-mode.d.ts +0 -3
  263. package/dist/cli/interactive/interactive-mode.js.map +0 -1
  264. package/dist/cli/interactive/invoice-picker.d.ts +0 -25
  265. package/dist/cli/interactive/invoice-picker.js.map +0 -1
  266. package/dist/cli/interactive/invoice.flow.d.ts +0 -22
  267. package/dist/cli/interactive/invoice.flow.js.map +0 -1
  268. package/dist/cli/interactive/note.flow.d.ts +0 -34
  269. package/dist/cli/interactive/note.flow.js.map +0 -1
  270. package/dist/cli/interactive/pdf.flow.d.ts +0 -5
  271. package/dist/cli/interactive/pdf.flow.js.map +0 -1
  272. package/dist/cli/interactive/prompts.d.ts +0 -57
  273. package/dist/cli/interactive/prompts.js.map +0 -1
  274. package/dist/cli/interactive/receiver-padron.d.ts +0 -29
  275. package/dist/cli/interactive/receiver-padron.js.map +0 -1
  276. package/dist/cli/interactive/repeat.flow.d.ts +0 -13
  277. package/dist/cli/interactive/repeat.flow.js.map +0 -1
  278. package/dist/cli/interactive/session.d.ts +0 -22
  279. package/dist/cli/interactive/session.js.map +0 -1
  280. package/dist/cli/interactive/status.flow.d.ts +0 -3
  281. package/dist/cli/interactive/status.flow.js.map +0 -1
  282. package/dist/cli/interactive/update.flow.d.ts +0 -6
  283. package/dist/cli/interactive/update.flow.js.map +0 -1
  284. package/dist/cli/interactive/validators.d.ts +0 -9
  285. package/dist/cli/interactive/validators.js.map +0 -1
  286. package/dist/cli/option-parsers.d.ts +0 -6
  287. package/dist/cli/option-parsers.js.map +0 -1
  288. package/dist/cli/program.d.ts +0 -6
  289. package/dist/cli/program.js.map +0 -1
  290. package/dist/cli/spinner.d.ts +0 -8
  291. package/dist/cli/spinner.js.map +0 -1
  292. package/dist/cli/types.d.ts +0 -6
  293. package/dist/cli/types.js.map +0 -1
  294. package/dist/cli/version.d.ts +0 -1
  295. package/dist/cli/version.js.map +0 -1
  296. package/dist/index.d.ts +0 -1
  297. package/dist/index.js.map +0 -1
  298. package/dist/lib/dates/arca-date.d.ts +0 -19
  299. package/dist/lib/dates/arca-date.js.map +0 -1
  300. package/dist/lib/errors/app-error.d.ts +0 -17
  301. package/dist/lib/errors/app-error.js.map +0 -1
  302. package/dist/lib/files/read-json-file.d.ts +0 -1
  303. package/dist/lib/files/read-json-file.js.map +0 -1
  304. package/dist/lib/files/restrict-to-owner.d.ts +0 -7
  305. package/dist/lib/files/restrict-to-owner.js.map +0 -1
  306. package/dist/lib/files/write-new-file.d.ts +0 -5
  307. package/dist/lib/files/write-new-file.js.map +0 -1
  308. package/dist/lib/identity/format-cuit.d.ts +0 -2
  309. package/dist/lib/identity/format-cuit.js.map +0 -1
  310. package/dist/lib/links.d.ts +0 -4
  311. package/dist/lib/links.js.map +0 -1
  312. package/dist/lib/numbers/argentine-amount.d.ts +0 -23
  313. package/dist/lib/numbers/argentine-amount.js.map +0 -1
  314. package/dist/lib/numbers/strict-integer.d.ts +0 -4
  315. package/dist/lib/numbers/strict-integer.js.map +0 -1
  316. package/dist/lib/paths/mask-path.d.ts +0 -1
  317. package/dist/lib/paths/mask-path.js.map +0 -1
  318. package/dist/lib/security/certificate.d.ts +0 -11
  319. package/dist/lib/security/certificate.js.map +0 -1
  320. package/dist/lib/security/pem.d.ts +0 -5
  321. package/dist/lib/security/pem.js.map +0 -1
  322. package/dist/modules/billing/billing-response.d.ts +0 -4
  323. package/dist/modules/billing/billing-response.js.map +0 -1
  324. package/dist/modules/billing/billing.amounts.d.ts +0 -21
  325. package/dist/modules/billing/billing.amounts.js.map +0 -1
  326. package/dist/modules/billing/billing.associated-period.d.ts +0 -8
  327. package/dist/modules/billing/billing.associated-period.js.map +0 -1
  328. package/dist/modules/billing/billing.associated-vouchers.d.ts +0 -12
  329. package/dist/modules/billing/billing.associated-vouchers.js.map +0 -1
  330. package/dist/modules/billing/billing.batch.d.ts +0 -23
  331. package/dist/modules/billing/billing.batch.js.map +0 -1
  332. package/dist/modules/billing/billing.constants.d.ts +0 -2
  333. package/dist/modules/billing/billing.constants.js.map +0 -1
  334. package/dist/modules/billing/billing.currency.d.ts +0 -18
  335. package/dist/modules/billing/billing.currency.js.map +0 -1
  336. package/dist/modules/billing/billing.date-range.d.ts +0 -9
  337. package/dist/modules/billing/billing.date-range.js.map +0 -1
  338. package/dist/modules/billing/billing.display.d.ts +0 -13
  339. package/dist/modules/billing/billing.display.js.map +0 -1
  340. package/dist/modules/billing/billing.errors.d.ts +0 -12
  341. package/dist/modules/billing/billing.errors.js.map +0 -1
  342. package/dist/modules/billing/billing.fce.d.ts +0 -21
  343. package/dist/modules/billing/billing.fce.js.map +0 -1
  344. package/dist/modules/billing/billing.iva-receptor.d.ts +0 -8
  345. package/dist/modules/billing/billing.iva-receptor.js.map +0 -1
  346. package/dist/modules/billing/billing.json-format.d.ts +0 -6
  347. package/dist/modules/billing/billing.json-format.js.map +0 -1
  348. package/dist/modules/billing/billing.json-input.d.ts +0 -58
  349. package/dist/modules/billing/billing.json-input.js.map +0 -1
  350. package/dist/modules/billing/billing.labels.d.ts +0 -9
  351. package/dist/modules/billing/billing.labels.js.map +0 -1
  352. package/dist/modules/billing/billing.mappers.d.ts +0 -8
  353. package/dist/modules/billing/billing.mappers.js.map +0 -1
  354. package/dist/modules/billing/billing.padron.d.ts +0 -14
  355. package/dist/modules/billing/billing.padron.js.map +0 -1
  356. package/dist/modules/billing/billing.presenter.d.ts +0 -7
  357. package/dist/modules/billing/billing.presenter.js.map +0 -1
  358. package/dist/modules/billing/billing.schemas.d.ts +0 -147
  359. package/dist/modules/billing/billing.schemas.js.map +0 -1
  360. package/dist/modules/billing/billing.serialize.d.ts +0 -9
  361. package/dist/modules/billing/billing.serialize.js.map +0 -1
  362. package/dist/modules/billing/billing.service.d.ts +0 -30
  363. package/dist/modules/billing/billing.service.js.map +0 -1
  364. package/dist/modules/billing/billing.text.d.ts +0 -8
  365. package/dist/modules/billing/billing.text.js.map +0 -1
  366. package/dist/modules/billing/billing.types.d.ts +0 -13
  367. package/dist/modules/billing/billing.types.internal.d.ts +0 -38
  368. package/dist/modules/billing/billing.types.internal.js.map +0 -1
  369. package/dist/modules/billing/billing.types.js.map +0 -1
  370. package/dist/modules/billing/billing.validation.d.ts +0 -7
  371. package/dist/modules/billing/billing.validation.js.map +0 -1
  372. package/dist/modules/billing/voucher-kind-map.d.ts +0 -9
  373. package/dist/modules/billing/voucher-kind-map.js.map +0 -1
  374. package/dist/modules/config/certificate-expiry.d.ts +0 -42
  375. package/dist/modules/config/certificate-expiry.js.map +0 -1
  376. package/dist/modules/config/config-doctor.d.ts +0 -16
  377. package/dist/modules/config/config-doctor.js.map +0 -1
  378. package/dist/modules/config/config-value-parser.d.ts +0 -2
  379. package/dist/modules/config/config-value-parser.js.map +0 -1
  380. package/dist/modules/config/config.presenter.d.ts +0 -17
  381. package/dist/modules/config/config.presenter.js.map +0 -1
  382. package/dist/modules/config/config.schemas.d.ts +0 -156
  383. package/dist/modules/config/config.schemas.js.map +0 -1
  384. package/dist/modules/config/config.sections.d.ts +0 -14
  385. package/dist/modules/config/config.sections.js.map +0 -1
  386. package/dist/modules/config/config.service.d.ts +0 -35
  387. package/dist/modules/config/config.service.js.map +0 -1
  388. package/dist/modules/examples/examples.d.ts +0 -6
  389. package/dist/modules/examples/examples.js.map +0 -1
  390. package/dist/modules/fce/fce-obligation.d.ts +0 -20
  391. package/dist/modules/fce/fce-obligation.js.map +0 -1
  392. package/dist/modules/fce/fce-obligation.presenter.d.ts +0 -9
  393. package/dist/modules/fce/fce-obligation.presenter.js.map +0 -1
  394. package/dist/modules/interactive/amount-input.d.ts +0 -4
  395. package/dist/modules/interactive/amount-input.js.map +0 -1
  396. package/dist/modules/interactive/choices.d.ts +0 -13
  397. package/dist/modules/interactive/choices.js.map +0 -1
  398. package/dist/modules/interactive/config-fields.d.ts +0 -20
  399. package/dist/modules/interactive/config-fields.js.map +0 -1
  400. package/dist/modules/interactive/equivalent-command.d.ts +0 -8
  401. package/dist/modules/interactive/equivalent-command.js.map +0 -1
  402. package/dist/modules/interactive/invoice-copy.d.ts +0 -19
  403. package/dist/modules/interactive/invoice-copy.js.map +0 -1
  404. package/dist/modules/interactive/periods.d.ts +0 -7
  405. package/dist/modules/interactive/periods.js.map +0 -1
  406. package/dist/modules/interactive/wizard.d.ts +0 -16
  407. package/dist/modules/interactive/wizard.js.map +0 -1
  408. package/dist/modules/padron/padron.d.ts +0 -46
  409. package/dist/modules/padron/padron.js.map +0 -1
  410. package/dist/modules/padron/padron.presenter.d.ts +0 -7
  411. package/dist/modules/padron/padron.presenter.js.map +0 -1
  412. package/dist/modules/parameters/health.d.ts +0 -17
  413. package/dist/modules/parameters/health.js.map +0 -1
  414. package/dist/modules/parameters/parameters.d.ts +0 -50
  415. package/dist/modules/parameters/parameters.js.map +0 -1
  416. package/dist/modules/parameters/parameters.presenter.d.ts +0 -12
  417. package/dist/modules/parameters/parameters.presenter.js.map +0 -1
  418. package/dist/modules/parameters/status.d.ts +0 -31
  419. package/dist/modules/parameters/status.js.map +0 -1
  420. package/dist/modules/pdf/pdf-data.mapper.d.ts +0 -4
  421. package/dist/modules/pdf/pdf-data.mapper.js.map +0 -1
  422. package/dist/modules/pdf/pdf-decision.d.ts +0 -14
  423. package/dist/modules/pdf/pdf-decision.js.map +0 -1
  424. package/dist/modules/pdf/pdf-file-name.d.ts +0 -3
  425. package/dist/modules/pdf/pdf-file-name.js.map +0 -1
  426. package/dist/modules/pdf/pdf-issuer.d.ts +0 -8
  427. package/dist/modules/pdf/pdf-issuer.js.map +0 -1
  428. package/dist/modules/pdf/pdf.errors.d.ts +0 -9
  429. package/dist/modules/pdf/pdf.errors.js.map +0 -1
  430. package/dist/modules/pdf/pdf.types.d.ts +0 -91
  431. package/dist/modules/pdf/pdf.types.js.map +0 -1
  432. package/dist/modules/storybook/showcase-theme.d.ts +0 -7
  433. package/dist/modules/storybook/showcase-theme.js.map +0 -1
  434. package/dist/modules/storybook/showcase.d.ts +0 -2
  435. package/dist/modules/storybook/showcase.js.map +0 -1
  436. package/dist/modules/update-check/changelog.d.ts +0 -23
  437. package/dist/modules/update-check/changelog.js.map +0 -1
  438. package/dist/modules/update-check/update-check.presenter.d.ts +0 -6
  439. package/dist/modules/update-check/update-check.presenter.js.map +0 -1
  440. package/dist/modules/update-check/update-check.service.d.ts +0 -11
  441. package/dist/modules/update-check/update-check.service.js.map +0 -1
  442. package/dist/modules/vouchers/voucher-history.d.ts +0 -39
  443. package/dist/modules/vouchers/voucher-history.js.map +0 -1
  444. package/dist/modules/vouchers/voucher-history.presenter.d.ts +0 -29
  445. package/dist/modules/vouchers/voucher-history.presenter.js.map +0 -1
  446. package/dist/services/arca/arca-billing.gateway.d.ts +0 -16
  447. package/dist/services/arca/arca-billing.gateway.js.map +0 -1
  448. package/dist/services/arca/arca-client.factory.d.ts +0 -6
  449. package/dist/services/arca/arca-client.factory.js.map +0 -1
  450. package/dist/services/arca/arca-context.resolver.d.ts +0 -55
  451. package/dist/services/arca/arca-context.resolver.js.map +0 -1
  452. package/dist/services/arca/arca-fce-obligation.gateway.d.ts +0 -7
  453. package/dist/services/arca/arca-fce-obligation.gateway.js.map +0 -1
  454. package/dist/services/arca/arca-padron.gateway.d.ts +0 -9
  455. package/dist/services/arca/arca-padron.gateway.js.map +0 -1
  456. package/dist/services/arca/arca-parameters.gateway.d.ts +0 -10
  457. package/dist/services/arca/arca-parameters.gateway.js.map +0 -1
  458. package/dist/services/arca/arca-voucher-history.gateway.d.ts +0 -8
  459. package/dist/services/arca/arca-voucher-history.gateway.js.map +0 -1
  460. package/dist/services/clipboard/clipboard.d.ts +0 -2
  461. package/dist/services/clipboard/clipboard.js.map +0 -1
  462. package/dist/services/pdf/escape-html.d.ts +0 -6
  463. package/dist/services/pdf/escape-html.js.map +0 -1
  464. package/dist/services/pdf/pdf-browser.d.ts +0 -5
  465. package/dist/services/pdf/pdf-browser.js.map +0 -1
  466. package/dist/services/pdf/pdf-exporter.d.ts +0 -22
  467. package/dist/services/pdf/pdf-exporter.js.map +0 -1
  468. package/dist/services/pdf/pdf-plugin.d.ts +0 -50
  469. package/dist/services/pdf/pdf-plugin.js.map +0 -1
  470. package/dist/ui/components/certificateBanner.d.ts +0 -11
  471. package/dist/ui/components/certificateBanner.js.map +0 -1
  472. package/dist/ui/components/contentPanel.d.ts +0 -5
  473. package/dist/ui/components/contentPanel.js.map +0 -1
  474. package/dist/ui/components/errorPanel.d.ts +0 -1
  475. package/dist/ui/components/errorPanel.js.map +0 -1
  476. package/dist/ui/components/index.d.ts +0 -10
  477. package/dist/ui/components/index.js.map +0 -1
  478. package/dist/ui/components/keyValuePanel.d.ts +0 -3
  479. package/dist/ui/components/keyValuePanel.js.map +0 -1
  480. package/dist/ui/components/noticePanel.d.ts +0 -3
  481. package/dist/ui/components/noticePanel.js.map +0 -1
  482. package/dist/ui/components/rawPanel.d.ts +0 -1
  483. package/dist/ui/components/rawPanel.js.map +0 -1
  484. package/dist/ui/components/sectionHeading.d.ts +0 -3
  485. package/dist/ui/components/sectionHeading.js.map +0 -1
  486. package/dist/ui/components/statusBar.d.ts +0 -19
  487. package/dist/ui/components/statusBar.js.map +0 -1
  488. package/dist/ui/components/statusPanel.d.ts +0 -3
  489. package/dist/ui/components/statusPanel.js.map +0 -1
  490. package/dist/ui/components/testingBanner.d.ts +0 -2
  491. package/dist/ui/components/testingBanner.js.map +0 -1
  492. package/dist/ui/index.d.ts +0 -5
  493. package/dist/ui/index.js.map +0 -1
  494. package/dist/ui/presenters/billing.presenter.d.ts +0 -2
  495. package/dist/ui/presenters/billing.presenter.js.map +0 -1
  496. package/dist/ui/presenters/config.presenter.d.ts +0 -1
  497. package/dist/ui/presenters/config.presenter.js.map +0 -1
  498. package/dist/ui/presenters/errors.presenter.d.ts +0 -1
  499. package/dist/ui/presenters/errors.presenter.js.map +0 -1
  500. package/dist/ui/presenters/errors.zod-presenter.d.ts +0 -4
  501. package/dist/ui/presenters/errors.zod-presenter.js.map +0 -1
  502. package/dist/ui/presenters/index.d.ts +0 -6
  503. package/dist/ui/presenters/index.js.map +0 -1
  504. package/dist/ui/presenters/pdf.presenter.d.ts +0 -13
  505. package/dist/ui/presenters/pdf.presenter.js.map +0 -1
  506. package/dist/ui/presenters/showcase.presenter.d.ts +0 -1
  507. package/dist/ui/presenters/showcase.presenter.js.map +0 -1
  508. package/dist/ui/primitives/index.d.ts +0 -10
  509. package/dist/ui/primitives/index.js.map +0 -1
  510. package/dist/ui/primitives/renderDivider.d.ts +0 -5
  511. package/dist/ui/primitives/renderDivider.js.map +0 -1
  512. package/dist/ui/primitives/renderFooter.d.ts +0 -7
  513. package/dist/ui/primitives/renderFooter.js.map +0 -1
  514. package/dist/ui/primitives/renderJson.d.ts +0 -3
  515. package/dist/ui/primitives/renderJson.js.map +0 -1
  516. package/dist/ui/primitives/renderKeyValue.d.ts +0 -14
  517. package/dist/ui/primitives/renderKeyValue.js.map +0 -1
  518. package/dist/ui/primitives/renderLogo.d.ts +0 -3
  519. package/dist/ui/primitives/renderLogo.js.map +0 -1
  520. package/dist/ui/primitives/renderObject.d.ts +0 -1
  521. package/dist/ui/primitives/renderObject.js.map +0 -1
  522. package/dist/ui/primitives/renderPanel.d.ts +0 -27
  523. package/dist/ui/primitives/renderPanel.js.map +0 -1
  524. package/dist/ui/primitives/renderSubtitle.d.ts +0 -7
  525. package/dist/ui/primitives/renderSubtitle.js.map +0 -1
  526. package/dist/ui/primitives/renderTable.d.ts +0 -6
  527. package/dist/ui/primitives/renderTable.js.map +0 -1
  528. package/dist/ui/primitives/terminalWidth.d.ts +0 -4
  529. package/dist/ui/primitives/terminalWidth.js.map +0 -1
  530. package/dist/ui/primitives/text.d.ts +0 -28
  531. package/dist/ui/primitives/text.js.map +0 -1
  532. package/dist/ui/stream/index.d.ts +0 -1
  533. package/dist/ui/stream/index.js.map +0 -1
  534. package/dist/ui/stream/terminal-stream.d.ts +0 -21
  535. package/dist/ui/stream/terminal-stream.js.map +0 -1
  536. package/dist/ui/theme/index.d.ts +0 -1
  537. package/dist/ui/theme/index.js.map +0 -1
  538. package/dist/ui/theme/theme.d.ts +0 -68
  539. package/dist/ui/theme/theme.js.map +0 -1
@@ -14,7 +14,7 @@ export function resolveIvaShortcut(commandOptions) {
14
14
  commandOptions.irSnc ? 'sujeto-no-categorizado' : null,
15
15
  ].filter(Boolean);
16
16
  if (shortcuts.length > 1) {
17
- throw new InputValidationError('Use solo un flag de IVA receptor entre las opciones --ir-*.');
17
+ throw new InputValidationError('Usá solo un flag de IVA receptor entre las opciones --ir-*.');
18
18
  }
19
19
  return shortcuts[0];
20
20
  }
@@ -34,7 +34,7 @@ export function resolveDocumentIdentity(commandOptions) {
34
34
  : null,
35
35
  ].filter(Boolean);
36
36
  if (candidates.length > 1) {
37
- throw new InputValidationError('Use solo una identidad de receptor: --cuit, --cuil, --dni, --consumidor-final o --cfinal.');
37
+ throw new InputValidationError('Usá solo una identidad de receptor: --cuit, --cuil, --dni, --consumidor-final o --cfinal.');
38
38
  }
39
39
  return candidates[0] ?? {};
40
40
  }
@@ -45,8 +45,7 @@ export function resolveConceptShortcut(commandOptions) {
45
45
  commandOptions.csp ? 'productos-servicios' : null,
46
46
  ].filter(Boolean);
47
47
  if (shortcutConcepts.length > 1) {
48
- throw new InputValidationError('Use solo un flag de concepto entre --cs, --cp o --csp.');
48
+ throw new InputValidationError('Usá solo un flag de concepto entre --cs, --cp o --csp.');
49
49
  }
50
50
  return shortcutConcepts[0];
51
51
  }
52
- //# sourceMappingURL=billing.command.shortcuts.js.map
@@ -0,0 +1,140 @@
1
+ import { InputValidationError } from '../../lib/errors/app-error.js';
2
+ import { billingIvaConditionSchema, IVA_RATE_ALIASES } from '../../modules/billing/billing.schemas.js';
3
+ import { VOUCHER_LETTERS, VOUCHER_SHORTCUTS } from '../../modules/billing/voucher-kind-map.js';
4
+ import { completeWords } from '../../modules/completion/completion.js';
5
+ import { formatCompletionResultAsText, formatCompletionStateAsJson, formatCompletionStateAsText, } from '../../modules/completion/completion.presenter.js';
6
+ import { currentCompletionEnvironment, detectShell, getCompletionState, installCompletion, uninstallCompletion, } from '../../modules/completion/installer.js';
7
+ import { buildCompletionScript, COMPLETE_COMMAND, COMPLETION_SHELLS, } from '../../modules/completion/shell-scripts.js';
8
+ import { configPublicKeySchema } from '../../modules/config/config.schemas.js';
9
+ import { ConfigService } from '../../modules/config/config.service.js';
10
+ import { EXPORT_VOUCHER_KIND } from '../../modules/export/export.types.js';
11
+ import { CONFIG_FIELDS } from '../../modules/interactive/config-fields.js';
12
+ import { PARAMETER_TABLE_NAMES } from '../../modules/parameters/parameters.js';
13
+ import { writeTerminalJson, writeTerminalOutput } from '../../ui/index.js';
14
+ import { registerJsonOption, resolveOutputJson } from '../global-options.js';
15
+ import { configureSpanishHelp, createCompletionHelp } from '../help.js';
16
+ /** No se ofrecen: herramientas internas. */
17
+ const INTERNAL_COMMANDS = new Set([COMPLETE_COMMAND, 'storybook']);
18
+ const IVA_RATES = [...new Set([...Object.values(IVA_RATE_ALIASES), '5', '2.5', ...Object.keys(IVA_RATE_ALIASES)])];
19
+ /** Valores que aceptan las opciones, por flag largo. */
20
+ const OPTION_VALUES = {
21
+ '--ac': VOUCHER_SHORTCUTS,
22
+ '--alicuota': IVA_RATES,
23
+ '--concepto': ['productos', 'servicios', 'productos-servicios'],
24
+ '--ir': billingIvaConditionSchema.options,
25
+ '--iva-receptor': billingIvaConditionSchema.options,
26
+ '--mda': ['ARS', 'USD'],
27
+ '--moneda': ['ARS', 'USD'],
28
+ '--transferencia': ['sca', 'adc'],
29
+ };
30
+ /** `config establecer <clave> <valor>`: el valor depende de la clave. */
31
+ const configValues = ([key]) => CONFIG_FIELDS.find((field) => field.key === key)?.choices ?? [];
32
+ /** Valores de los argumentos posicionales, por nombre del argumento. */
33
+ const ARGUMENT_VALUES = {
34
+ clave: configPublicKeySchema.options,
35
+ letra: VOUCHER_LETTERS,
36
+ moneda: ['USD', 'DOL'],
37
+ shell: COMPLETION_SHELLS,
38
+ tabla: [...PARAMETER_TABLE_NAMES, 'cotizacion'],
39
+ tipo: VOUCHER_SHORTCUTS,
40
+ valor: configValues,
41
+ };
42
+ /** La familia `factura` tambien acepta la letra E (exportacion). */
43
+ function argumentValues(command, name) {
44
+ return name === 'letra' && command.name() === EXPORT_VOUCHER_KIND.family
45
+ ? [...VOUCHER_LETTERS, EXPORT_VOUCHER_KIND.letter]
46
+ : ARGUMENT_VALUES[name];
47
+ }
48
+ /** El arbol de commander como lo necesita el autocompletado. */
49
+ export function describeCompletionTree(command) {
50
+ return {
51
+ argumentValues: command.registeredArguments.map((argument) => argumentValues(command, argument.name())),
52
+ name: command.name(),
53
+ options: command.options.map((option) => ({
54
+ flags: [option.long, option.short].filter((flag) => Boolean(flag)),
55
+ hidden: option.hidden,
56
+ takesValue: option.required || option.optional,
57
+ values: option.long ? OPTION_VALUES[option.long] : undefined,
58
+ })),
59
+ subcommands: command.commands
60
+ .filter((subcommand) => !INTERNAL_COMMANDS.has(subcommand.name()))
61
+ .map(describeCompletionTree),
62
+ };
63
+ }
64
+ function parseShell(value) {
65
+ if (!COMPLETION_SHELLS.includes(value)) {
66
+ throw new InputValidationError(`El shell "${value}" no es válido. Usá ${COMPLETION_SHELLS.join(', ')}.`);
67
+ }
68
+ return value;
69
+ }
70
+ /** El shell pedido o, si no se paso, el de `$SHELL`. */
71
+ export function resolveShell(value, environment) {
72
+ if (value) {
73
+ return parseShell(value);
74
+ }
75
+ const detected = detectShell(environment.shell);
76
+ if (!detected) {
77
+ throw new InputValidationError(`No se pudo saber qué shell usás${environment.shell ? ` (${environment.shell})` : ''}. Indicalo: bash, zsh o fish.`);
78
+ }
79
+ return detected;
80
+ }
81
+ function isJson(command) {
82
+ const service = new ConfigService();
83
+ try {
84
+ return resolveOutputJson(command, service.getConfig());
85
+ }
86
+ finally {
87
+ service.close();
88
+ }
89
+ }
90
+ export function registerCompletionCommands(program) {
91
+ const environment = currentCompletionEnvironment();
92
+ const command = registerJsonOption(program
93
+ .command('completado')
94
+ .description('autocompletado con Tab para bash, zsh o fish: instalarlo, desinstalarlo o ver el script')
95
+ .argument('[shell]', `${COMPLETION_SHELLS.join(', ')}: imprime el script; sin shell, muestra si está instalado`)).action((shell, _options, self) => {
96
+ if (shell) {
97
+ process.stdout.write(buildCompletionScript(parseShell(shell)));
98
+ return;
99
+ }
100
+ const state = getCompletionState(resolveShell(undefined, environment), environment);
101
+ if (isJson(self)) {
102
+ writeTerminalJson(formatCompletionStateAsJson(state));
103
+ }
104
+ else {
105
+ writeTerminalOutput(formatCompletionStateAsText(state, environment.home));
106
+ }
107
+ });
108
+ configureSpanishHelp(command);
109
+ command.addHelpText('after', createCompletionHelp());
110
+ // Pedir el comando ya es la confirmacion, como en `pdf instalar`: no se vuelve a preguntar.
111
+ for (const [name, description, run] of [
112
+ ['instalar', 'agregar el autocompletado al archivo de inicio del shell', installCompletion],
113
+ ['desinstalar', 'sacar el autocompletado que agrego arcli', uninstallCompletion],
114
+ ]) {
115
+ const subcommand = registerJsonOption(command
116
+ .command(name)
117
+ .description(description)
118
+ .argument('[shell]', `${COMPLETION_SHELLS.join(', ')}; por defecto el de $SHELL`)).action((shell, _options, self) => {
119
+ const result = run(resolveShell(shell, environment), environment);
120
+ if (isJson(self)) {
121
+ writeTerminalJson(formatCompletionStateAsJson(result));
122
+ }
123
+ else {
124
+ writeTerminalOutput(formatCompletionResultAsText(result, environment.home));
125
+ }
126
+ });
127
+ configureSpanishHelp(subcommand);
128
+ }
129
+ // Lo llama el script del shell en cada Tab: `arcli __completar -- <palabras escritas>`. Una por linea.
130
+ program
131
+ .command(COMPLETE_COMMAND, { hidden: true })
132
+ .argument('[palabras...]')
133
+ .allowUnknownOption()
134
+ .action((words = []) => {
135
+ const candidates = completeWords(describeCompletionTree(program), words);
136
+ if (candidates.length > 0) {
137
+ process.stdout.write(`${candidates.join('\n')}\n`);
138
+ }
139
+ });
140
+ }
@@ -28,7 +28,7 @@ export function buildRuntimeChecks(config) {
28
28
  catch (error) {
29
29
  return {
30
30
  environment,
31
- error: error instanceof Error ? error.message : 'No se pudo completar la validacion.',
31
+ error: error instanceof Error ? error.message : 'No se pudo completar la validación.',
32
32
  };
33
33
  }
34
34
  });
@@ -36,7 +36,7 @@ export function buildRuntimeChecks(config) {
36
36
  export function registerConfigCommand(program) {
37
37
  const configCommand = program
38
38
  .command('config')
39
- .description('guardar defaults, credenciales y revisar si el CLI esta listo para emitir');
39
+ .description('guardar defaults, credenciales y revisar si el CLI está listo para emitir');
40
40
  configureSpanishHelp(configCommand);
41
41
  registerJsonOption(configCommand).action((_options, command) => {
42
42
  const service = createConfigService();
@@ -52,14 +52,14 @@ export function registerConfigCommand(program) {
52
52
  configCommand.addHelpText('after', createConfigHelp());
53
53
  const revisarCommand = configCommand
54
54
  .command('revisar')
55
- .description('revisar configuracion, defaults, credenciales y validacion de cada entorno')
55
+ .description('revisar configuración, defaults, credenciales y validación de cada entorno')
56
56
  .action((_options, command) => {
57
57
  const service = createConfigService();
58
58
  let spinner = null;
59
59
  try {
60
60
  const config = service.getConfig();
61
61
  const useJson = resolveOutputJson(command, config);
62
- spinner = useJson ? null : startSpinner('Generando revision...');
62
+ spinner = useJson ? null : startSpinner('Generando revisión...');
63
63
  const report = buildConfigDoctorReport(config, buildRuntimeChecks(config));
64
64
  spinner?.stop();
65
65
  printConfigResult(formatConfigDoctorAsText(report), formatConfigDoctor(report), useJson);
@@ -74,7 +74,7 @@ export function registerConfigCommand(program) {
74
74
  });
75
75
  registerJsonOption(revisarCommand);
76
76
  configureSpanishHelp(revisarCommand);
77
- const rutaCommand = registerJsonOption(configCommand.command('ruta').description('mostrar la ruta del archivo de configuracion')).action((_options, command) => {
77
+ const rutaCommand = registerJsonOption(configCommand.command('ruta').description('mostrar la ruta del archivo de configuración')).action((_options, command) => {
78
78
  const service = createConfigService();
79
79
  try {
80
80
  const path = service.getPath();
@@ -87,8 +87,8 @@ export function registerConfigCommand(program) {
87
87
  configureSpanishHelp(rutaCommand);
88
88
  const establecerCommand = configCommand
89
89
  .command('establecer')
90
- .description('guardar un valor de configuracion')
91
- .argument('<clave>', 'clave publica de configuracion')
90
+ .description('guardar un valor de configuración')
91
+ .argument('<clave>', 'clave publica de configuración')
92
92
  .argument('<valor>', 'valor a guardar')
93
93
  .addHelpText('after', createConfigSetHelp())
94
94
  .action((key, value, _options, command) => {
@@ -107,8 +107,8 @@ export function registerConfigCommand(program) {
107
107
  configureSpanishHelp(establecerCommand);
108
108
  const eliminarCommand = configCommand
109
109
  .command('eliminar')
110
- .description('eliminar un valor de configuracion')
111
- .argument('<clave>', 'clave publica de configuracion')
110
+ .description('eliminar un valor de configuración')
111
+ .argument('<clave>', 'clave publica de configuración')
112
112
  .action((key, _options, command) => {
113
113
  // Sin ensureInitialized: si la config quedo invalida, establecer o eliminar la clave es la forma de arreglarla.
114
114
  const service = new ConfigService();
@@ -124,4 +124,3 @@ export function registerConfigCommand(program) {
124
124
  registerJsonOption(eliminarCommand);
125
125
  configureSpanishHelp(eliminarCommand);
126
126
  }
127
- //# sourceMappingURL=config.command.js.map
@@ -1,10 +1,10 @@
1
1
  import { InputValidationError } from '../../lib/errors/app-error.js';
2
- /** CUIT de un argumento posicional: 11 digitos, sin guiones. */
2
+ import { parseCuit } from '../../lib/identity/cuit.js';
3
+ /** CUIT de un argumento posicional, con o sin guiones. */
3
4
  export function parseCuitArgument(value) {
4
- const normalizedValue = value.trim();
5
- if (!/^\d{11}$/.test(normalizedValue)) {
6
- throw new InputValidationError(`El CUIT "${value}" no es valido: debe tener 11 digitos.`);
5
+ const result = parseCuit(value);
6
+ if (!result.ok) {
7
+ throw new InputValidationError(`El CUIT "${value}" no es válido: ${result.reason}.`);
7
8
  }
8
- return Number(normalizedValue);
9
+ return Number(result.value);
9
10
  }
10
- //# sourceMappingURL=cuit-argument.js.map
@@ -11,4 +11,3 @@ export function registerExamplesCommand(program) {
11
11
  .addHelpText('after', createExamplesHelp());
12
12
  configureSpanishHelp(command);
13
13
  }
14
- //# sourceMappingURL=examples.command.js.map
@@ -0,0 +1,19 @@
1
+ import { EXPORT_VOUCHER_KIND } from '../../modules/export/export.types.js';
2
+ import { registerGlobalOptions } from '../global-options.js';
3
+ import { configureSpanishHelp, createExportShortcutHelp } from '../help.js';
4
+ import { executeExportCommand } from './export.command.js';
5
+ import { registerExportOptions } from './export.command.options.js';
6
+ /** `arcli fe`: el atajo de la factura E, como `fa`, `fb` y `fc`. Es lo mismo que `arcli factura e`. */
7
+ export function registerExportShortcutCommand(program) {
8
+ // Oculto en la lista de comandos: la ayuda principal lo muestra en la tabla de atajos.
9
+ const command = program
10
+ .command(EXPORT_VOUCHER_KIND.shortcut, { hidden: true })
11
+ .description(`${EXPORT_VOUCHER_KIND.displayName} por shortcut (WSFEX), con ayuda guiada para previsualizar o emitir`);
12
+ configureSpanishHelp(command);
13
+ registerGlobalOptions(command);
14
+ registerExportOptions(command);
15
+ command.action(async () => {
16
+ await executeExportCommand(command);
17
+ });
18
+ command.addHelpText('after', createExportShortcutHelp());
19
+ }
@@ -0,0 +1,106 @@
1
+ import { ExportService } from '../../modules/export/export.service.js';
2
+ import { EXPORT_VOUCHER_KIND } from '../../modules/export/export.types.js';
3
+ import { ArcaClientFactory } from '../../services/arca/arca-client.factory.js';
4
+ import { ArcaExportGateway } from '../../services/arca/arca-export.gateway.js';
5
+ import { formatExportResultAsJson, formatExportResultAsText, formatPdfOutcomeAsText, writeTerminalJson, writeTerminalOutput, } from '../../ui/index.js';
6
+ import { certificateWarnings, resolveArcaRuntime } from '../arca-runtime.js';
7
+ import { getGlobalOptions } from '../global-options.js';
8
+ import { chooseOne } from '../interactive/prompts.js';
9
+ import { startSpinner } from '../spinner.js';
10
+ import { REJECTED_EXIT_CODE } from './billing.command.shared.js';
11
+ import { parseExportCommandPlan } from './export.command.parser.js';
12
+ import { attachExportPdf } from './export.command.pdf.js';
13
+ const ITEMS_DESCRIPTION_WARNING = '--descripcion se usa solo cuando no hay --item: el detalle del comprobante sale de los items.';
14
+ function writeExportResult(result, options) {
15
+ if (options.outputJson) {
16
+ writeTerminalJson(formatExportResultAsJson(result, { raw: options.raw }));
17
+ return;
18
+ }
19
+ writeTerminalOutput(formatExportResultAsText(result, {
20
+ environment: options.environment,
21
+ previewShown: options.previewShown,
22
+ raw: options.raw,
23
+ }));
24
+ }
25
+ function resolveWarnings(certificateWarningsList, input) {
26
+ const ignored = input.items && input.items.length > 0 && input.description?.trim() ? [ITEMS_DESCRIPTION_WARNING] : [];
27
+ return [...certificateWarningsList, ...ignored];
28
+ }
29
+ /** Esc cuenta como no, igual que en A, B y C. */
30
+ async function promptForEmission() {
31
+ return chooseOne(`¿Querés emitir ${EXPORT_VOUCHER_KIND.displayName} ahora?`, [
32
+ { name: 'Sí, emitir ahora', value: true },
33
+ { name: 'No, dejar sin emitir', value: false },
34
+ ], true, { escapeLabel: 'no emitir', escapeValue: false });
35
+ }
36
+ /**
37
+ * Un comprobante por ejecucion: resuelve el payload contra WSFEX, muestra la vista previa si corresponde,
38
+ * emite y, si hay CAE, genera el PDF.
39
+ */
40
+ export async function executeExportCommand(command, options = {}) {
41
+ const globalOptions = getGlobalOptions(command);
42
+ let spinner = null;
43
+ try {
44
+ const runtime = resolveArcaRuntime(globalOptions);
45
+ const plan = parseExportCommandPlan(command, { defaultEmit: runtime.config.output.emitirPorDefecto });
46
+ const useRaw = typeof globalOptions.bruto === 'boolean' ? globalOptions.bruto : runtime.outputRaw;
47
+ const interactive = !runtime.outputJson && Boolean(process.stdin.isTTY && process.stdout.isTTY);
48
+ const service = new ExportService();
49
+ const gateway = new ArcaExportGateway(new ArcaClientFactory().createForExport(runtime));
50
+ spinner = runtime.outputJson ? null : startSpinner('Consultando WSFEX...');
51
+ const resolved = await service.resolve(plan.input, gateway, runtime);
52
+ // Los avisos de la resolucion (por ejemplo, la cotizacion de un dia anterior) van con los del certificado.
53
+ const warnings = [
54
+ ...resolveWarnings(certificateWarnings(runtime), plan.input),
55
+ ...(options.extraWarnings ?? []),
56
+ ...(resolved.warnings ?? []),
57
+ ];
58
+ spinner?.stop();
59
+ spinner = null;
60
+ let result = service.preview(resolved, runtime, warnings);
61
+ let previewShown = false;
62
+ if (!plan.input.emit) {
63
+ // Sin flags de emision y con terminal: se muestra la vista previa y se pregunta. Con --json o sin
64
+ // terminal nadie puede responder, asi que queda en vista previa.
65
+ if (plan.modeSource !== 'default' || !interactive) {
66
+ writeExportResult(result, {
67
+ environment: runtime.environment,
68
+ outputJson: runtime.outputJson,
69
+ previewShown: false,
70
+ raw: useRaw,
71
+ });
72
+ return;
73
+ }
74
+ writeTerminalOutput(formatExportResultAsText(result, { environment: runtime.environment, raw: useRaw }));
75
+ if (!(await promptForEmission())) {
76
+ return;
77
+ }
78
+ previewShown = true;
79
+ }
80
+ spinner = runtime.outputJson ? null : startSpinner('Emitiendo comprobante...');
81
+ result = await service.execute({ gateway, resolved, runtime, warnings });
82
+ spinner?.stop();
83
+ spinner = null;
84
+ result = await attachExportPdf(result, {
85
+ config: runtime.config,
86
+ input: plan.input,
87
+ interactive,
88
+ });
89
+ writeExportResult(result, {
90
+ environment: runtime.environment,
91
+ outputJson: runtime.outputJson,
92
+ previewShown,
93
+ raw: useRaw,
94
+ });
95
+ if (result.response.status === 'rechazado') {
96
+ process.exitCode = REJECTED_EXIT_CODE;
97
+ }
98
+ if (result.pdf && !runtime.outputJson) {
99
+ writeTerminalOutput(formatPdfOutcomeAsText(result.pdf));
100
+ }
101
+ }
102
+ catch (error) {
103
+ spinner?.stop();
104
+ throw error;
105
+ }
106
+ }
@@ -0,0 +1,140 @@
1
+ import { Option } from 'commander';
2
+ import { InputValidationError } from '../../lib/errors/app-error.js';
3
+ import { EXCHANGE_RATE_DECIMALS } from '../../lib/numbers/argentine-amount.js';
4
+ import { parseStrictInteger } from '../../lib/numbers/strict-integer.js';
5
+ import { parseExportItemArgument } from '../../modules/export/export.items.js';
6
+ import { amountOption, integerOption } from '../option-parsers.js';
7
+ function exportTypeOption(value) {
8
+ const parsed = parseStrictInteger(value);
9
+ if (parsed !== 1 && parsed !== 2 && parsed !== 4) {
10
+ throw new InputValidationError(`--tipo-expo "${value}" no es válido: usá 1 (bienes), 2 (servicios) o 4 (otros).`);
11
+ }
12
+ return parsed;
13
+ }
14
+ function repeatable(parse) {
15
+ return (value, previous) => [...(Array.isArray(previous) ? previous : []), parse(value)];
16
+ }
17
+ const EXPORT_OPTIONS = [
18
+ {
19
+ description: 'importe total del comprobante, por ejemplo 15000 o 1.500,50',
20
+ flags: '-m, --monto <numero>',
21
+ parser: amountOption('--monto'),
22
+ },
23
+ { description: 'nombre o razón social del cliente del exterior', flags: '--cliente <texto>' },
24
+ { description: 'domicilio del cliente en el exterior', flags: '--domicilio-cliente <texto>' },
25
+ {
26
+ description: 'país de destino por código o nombre, por ejemplo 203 o Brasil',
27
+ flags: '--pais-destino <codigo|nombre>',
28
+ },
29
+ { description: 'ID impositivo del cliente en su país', flags: '--id-impositivo <texto>' },
30
+ {
31
+ description: 'CUIT del país del cliente; sin este flag se resuelve desde el país de destino',
32
+ flags: '--cuit-pais <numero>',
33
+ parser: integerOption('--cuit-pais'),
34
+ },
35
+ {
36
+ description: 'tipo de exportación: 1 bienes, 2 servicios (por defecto), 4 otros',
37
+ flags: '--tipo-expo <1|2|4>',
38
+ parser: exportTypeOption,
39
+ },
40
+ {
41
+ description: 'código de la tabla de actividades de WSFEX, por ejemplo 620100; sin flag, exportacion.actividad de la config',
42
+ flags: '--actividad <codigo>',
43
+ parser: integerOption('--actividad'),
44
+ },
45
+ { description: 'código de incoterm, por ejemplo FOB', flags: '--incoterm <codigo>' },
46
+ { description: 'descripción del incoterm; por defecto la de la tabla de ARCA', flags: '--incoterms-desc <texto>' },
47
+ {
48
+ description: 'código de idioma del comprobante: 1 español (por defecto), 2 inglés, 3 portugués',
49
+ flags: '--idioma <codigo>',
50
+ parser: integerOption('--idioma'),
51
+ },
52
+ { description: 'forma de pago; por defecto "Transferencia Internacional"', flags: '--forma-pago <texto>' },
53
+ {
54
+ description: 'permiso de embarque ya existente; repetible. Requiere --permiso-existente y --tipo-expo 1',
55
+ flags: '--permiso <id>',
56
+ parser: repeatable((value) => value),
57
+ },
58
+ {
59
+ description: 'el permiso de embarque informado ya existe en ARCA',
60
+ flags: '--permiso-existente',
61
+ },
62
+ {
63
+ description: 'item del comprobante: "codigo|descripcion|cantidad|precio|unidad". Repetible; la suma tiene que dar --monto',
64
+ flags: '--item <partes>',
65
+ parser: repeatable((value) => parseExportItemArgument(value)),
66
+ },
67
+ {
68
+ description: 'número del comprobante; por defecto el siguiente de ARCA',
69
+ flags: '--numero <numero>',
70
+ parser: integerOption('--numero'),
71
+ },
72
+ {
73
+ description: 'ID de la solicitud; por defecto el siguiente de ARCA',
74
+ flags: '--id-solicitud <numero>',
75
+ parser: integerOption('--id-solicitud'),
76
+ },
77
+ {
78
+ description: 'punto de venta (alias: --pv)',
79
+ flags: '--punto-venta <numero>',
80
+ parser: integerOption('--punto-venta'),
81
+ },
82
+ { description: 'alias de --punto-venta', flags: '--pv <numero>', hidden: true, parser: integerOption('--pv') },
83
+ { description: 'fecha del comprobante; acepta D, D/M, D/M/YY o D/M/YYYY con - o /', flags: '-f, --fecha <fecha>' },
84
+ { description: 'fecha de pago; por defecto la del comprobante', flags: '--fecha-pago <fecha>' },
85
+ { description: 'código de moneda: USD o DOL (por defecto), ARS o PES (alias: --mda)', flags: '--moneda <codigo>' },
86
+ { description: 'alias de --moneda', flags: '--mda <codigo>', hidden: true },
87
+ {
88
+ description: 'cotización de la moneda; sin este flag se usa la de aduana que publica ARCA (alias: --cm)',
89
+ flags: '--cotizacion-moneda <numero>',
90
+ parser: amountOption('--cotizacion-moneda', EXCHANGE_RATE_DECIMALS),
91
+ },
92
+ {
93
+ description: 'alias de --cotizacion-moneda',
94
+ flags: '--cm <numero>',
95
+ hidden: true,
96
+ parser: amountOption('--cm', EXCHANGE_RATE_DECIMALS),
97
+ },
98
+ { description: 'el pago se cancela en la misma moneda extranjera', flags: '--misma-moneda' },
99
+ { description: 'observaciones del comprobante', flags: '--observaciones <texto>' },
100
+ { description: 'observaciones comerciales del comprobante', flags: '--obs-comerciales <texto>' },
101
+ {
102
+ description: 'descripción del comprobante cuando no se informan items; también va al PDF',
103
+ flags: '--descripcion <texto>',
104
+ },
105
+ { description: 'cargar los datos desde un archivo JSON', flags: '--cargar <ruta>' },
106
+ {
107
+ description: 'generar el PDF del comprobante emitido, aunque la config diga otra cosa (alias: --pdf)',
108
+ flags: '--exportar-pdf',
109
+ },
110
+ { description: 'alias de --exportar-pdf', flags: '--pdf', hidden: true },
111
+ { description: 'no generar el PDF, aunque la config diga otra cosa', flags: '--sin-pdf' },
112
+ { description: 'mostrar el payload antes de emitir en ARCA', flags: '--previsualizar' },
113
+ { description: 'emitir realmente en ARCA', flags: '--emitir' },
114
+ ];
115
+ /** Los flags largos que aplican a la factura E, incluidos los que comparte con A, B y C (`--monto`, `--fecha`...). */
116
+ export const EXPORT_OPTION_FLAGS = new Set(EXPORT_OPTIONS.map((definition) => new Option(definition.flags).long).filter((flag) => Boolean(flag)));
117
+ /**
118
+ * Registra las opciones de la factura E. `hidden` las registra sin mostrarlas: `arcli factura <letra>` las acepta
119
+ * para la letra E. Las que el comando ya tiene (`--monto`, `--fecha`...) se reusan. Devuelve las que agrego.
120
+ */
121
+ export function registerExportOptions(command, options = {}) {
122
+ const existing = new Set(command.options.flatMap((option) => [option.short, option.long]).filter((flag) => Boolean(flag)));
123
+ const added = [];
124
+ for (const definition of EXPORT_OPTIONS) {
125
+ const option = new Option(definition.flags, definition.description);
126
+ const flags = [option.short, option.long].filter((flag) => Boolean(flag));
127
+ if (flags.some((flag) => existing.has(flag))) {
128
+ continue;
129
+ }
130
+ if (definition.parser) {
131
+ option.argParser(definition.parser);
132
+ }
133
+ if (options.hidden || definition.hidden) {
134
+ option.hideHelp();
135
+ }
136
+ command.addOption(option);
137
+ added.push(option);
138
+ }
139
+ return added;
140
+ }
@@ -0,0 +1,84 @@
1
+ import { InputValidationError } from '../../lib/errors/app-error.js';
2
+ import { readJsonFile } from '../../lib/files/read-json-file.js';
3
+ import { mapExportJsonItems, readExportJsonInput } from '../../modules/export/export.json-input.js';
4
+ function pickString(...values) {
5
+ return values.find((value) => typeof value === 'string');
6
+ }
7
+ function pickNumber(...values) {
8
+ return values.find((value) => typeof value === 'number');
9
+ }
10
+ function pickBoolean(...values) {
11
+ return values.find((value) => typeof value === 'boolean');
12
+ }
13
+ function pickItems(flagsValue, fileItems) {
14
+ return Array.isArray(flagsValue) && flagsValue.length > 0 ? flagsValue : fileItems;
15
+ }
16
+ function pickList(flagsValue, fileValue) {
17
+ return Array.isArray(flagsValue) && flagsValue.length > 0 ? flagsValue : fileValue?.slice();
18
+ }
19
+ /** `--emitir` y `--previsualizar` deciden juntos, y el archivo de `--cargar` puede traer `emitir`. */
20
+ function resolveEmitDecision(flags, file, defaults) {
21
+ if (flags.emitir && flags.previsualizar) {
22
+ throw new InputValidationError('Usá --emitir o --previsualizar, no los dos.');
23
+ }
24
+ if (flags.emitir !== undefined) {
25
+ return { emit: flags.emitir, modeSource: 'flags' };
26
+ }
27
+ if (flags.previsualizar !== undefined) {
28
+ return { emit: !flags.previsualizar, modeSource: 'flags' };
29
+ }
30
+ if (file?.emitir !== undefined) {
31
+ return { emit: file.emitir, modeSource: 'file' };
32
+ }
33
+ if (file?.previsualizar !== undefined) {
34
+ return { emit: !file.previsualizar, modeSource: 'file' };
35
+ }
36
+ return { emit: defaults.defaultEmit ?? false, modeSource: 'default' };
37
+ }
38
+ /** Los flags ganan sobre el JSON de `--cargar`, igual que en facturacion. */
39
+ export function parseExportCommandPlan(command, defaults = {}) {
40
+ const options = command.optsWithGlobals();
41
+ const filePath = typeof options.cargar === 'string' ? options.cargar : undefined;
42
+ const file = filePath ? readExportJsonInput(readJsonFile(filePath)) : undefined;
43
+ const { emit, modeSource } = resolveEmitDecision({ emitir: pickBoolean(options.emitir), previsualizar: pickBoolean(options.previsualizar) }, file, defaults);
44
+ const destination = pickString(options.paisDestino, file?.paisDestino) ?? pickNumber(options.paisDestino, file?.paisDestino);
45
+ const currency = pickString(options.moneda, options.mda, file?.codigoMoneda);
46
+ const pdf = pickBoolean(options.exportarPdf, options.pdf) ?? (pickBoolean(options.sinPdf) === true ? false : undefined);
47
+ return {
48
+ input: {
49
+ activity: pickNumber(options.actividad, file?.actividad),
50
+ amount: pickNumber(options.monto, file?.monto),
51
+ clientAddress: pickString(options.domicilioCliente, file?.domicilioCliente),
52
+ clientCountryCuit: pickNumber(options.cuitPais, file?.cuitPais),
53
+ clientName: pickString(options.cliente, file?.cliente),
54
+ clientTaxId: pickString(options.idImpositivo, file?.idImpositivo),
55
+ commercialObservations: pickString(options.obsComerciales, file?.observacionesComerciales),
56
+ currencyCode: currency,
57
+ description: pickString(options.descripcion, file?.descripcion),
58
+ destinationCountry: destination === undefined ? undefined : String(destination),
59
+ emit,
60
+ exchangeRate: pickNumber(options.cotizacionMoneda, options.cm, file?.cotizacionMoneda),
61
+ exportType: pickNumber(options.tipoExpo, file?.tipoExpo),
62
+ incoterm: pickString(options.incoterm, file?.incoterm),
63
+ incotermDescription: pickString(options.incotermsDesc, file?.descripcionIncoterm),
64
+ items: pickItems(options.item, mapExportJsonItems(file?.items)),
65
+ language: pickNumber(options.idioma, file?.idioma),
66
+ modeSource,
67
+ observations: pickString(options.observaciones, file?.observaciones),
68
+ paymentDate: pickString(options.fechaPago, file?.fechaPago),
69
+ paymentTerms: pickString(options.formaPago, file?.formaPago),
70
+ pdf,
71
+ permits: pickList(options.permiso, file?.permisos),
72
+ permitsExisting: pickBoolean(options.permisoExistente, file?.permisoExistente),
73
+ pointOfSale: pickNumber(options.puntoVenta, options.pv, file?.puntoVenta),
74
+ requestId: pickNumber(options.idSolicitud, file?.idSolicitud),
75
+ sameCurrency: pickBoolean(options.mismaMoneda, file?.mismaMoneda),
76
+ voucherDate: pickString(options.fecha, file?.fechaComprobante),
77
+ voucherNumber: pickNumber(options.numero, file?.numero),
78
+ },
79
+ modeSource,
80
+ };
81
+ }
82
+ export function parseExportCommandInput(command, defaults = {}) {
83
+ return parseExportCommandPlan(command, defaults).input;
84
+ }