arcli 2.0.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 (511) hide show
  1. package/CHANGELOG.md +106 -1
  2. package/README.md +21 -14
  3. package/dist/cli/arca-runtime.js +41 -0
  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 +28 -12
  7. package/dist/cli/commands/billing.command.interactive-preview.js +12 -13
  8. package/dist/cli/commands/billing.command.options.js +83 -39
  9. package/dist/cli/commands/billing.command.output.js +3 -3
  10. package/dist/cli/commands/billing.command.parser.js +44 -30
  11. package/dist/cli/commands/billing.command.pdf.js +9 -6
  12. package/dist/cli/commands/billing.command.shared.js +86 -49
  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 +44 -45
  16. package/dist/cli/commands/cuit-argument.js +10 -0
  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 +8 -16
  24. package/dist/cli/commands/interactive.command.js +9 -8
  25. package/dist/cli/commands/padron.command.js +46 -0
  26. package/dist/cli/commands/parameters.command.js +13 -13
  27. package/dist/cli/commands/pdf.command.js +17 -31
  28. package/dist/cli/commands/storybook.command.js +4 -4
  29. package/dist/cli/commands/vouchers.command.js +14 -14
  30. package/dist/cli/error-output.js +89 -11
  31. package/dist/cli/global-options.js +55 -0
  32. package/dist/cli/help-argv.js +0 -1
  33. package/dist/cli/help.js +243 -391
  34. package/dist/cli/ignored-global-options.js +32 -0
  35. package/dist/cli/index.js +12 -14
  36. package/dist/cli/interactive/advanced-options.js +13 -14
  37. package/dist/cli/interactive/config.flow.js +59 -20
  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 +63 -33
  41. package/dist/cli/interactive/invoice-picker.js +7 -7
  42. package/dist/cli/interactive/invoice.flow.js +35 -13
  43. package/dist/cli/interactive/note.flow.js +16 -16
  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 +52 -0
  47. package/dist/cli/interactive/repeat.flow.js +10 -11
  48. package/dist/cli/interactive/session.js +13 -8
  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 +14 -5
  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 +2 -2
  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 +29 -0
  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 +2 -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 +10 -8
  71. package/dist/lib/security/pem.js +2 -3
  72. package/dist/modules/billing/billing-response.js +16 -5
  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 +12 -5
  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 +27 -11
  80. package/dist/modules/billing/billing.display.js +14 -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 +278 -0
  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 +59 -0
  89. package/dist/modules/billing/billing.presenter.js +0 -1
  90. package/dist/modules/billing/billing.schemas.js +20 -6
  91. package/dist/modules/billing/billing.serialize.js +11 -15
  92. package/dist/modules/billing/billing.service.js +25 -4
  93. package/dist/modules/billing/billing.text.js +4 -13
  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 +90 -0
  103. package/dist/modules/config/config-doctor.js +42 -28
  104. package/dist/modules/config/config-value-parser.js +32 -17
  105. package/dist/modules/config/config.export-credentials.js +23 -0
  106. package/dist/modules/config/config.presenter.js +28 -6
  107. package/dist/modules/config/config.schemas.js +27 -12
  108. package/dist/modules/config/config.sections.js +31 -11
  109. package/dist/modules/config/config.service.js +38 -9
  110. package/dist/modules/examples/examples.js +72 -37
  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 +17 -3
  125. package/dist/modules/interactive/equivalent-command.js +6 -3
  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 +23 -0
  131. package/dist/modules/padron/padron.presenter.js +48 -0
  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 +14 -12
  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 +35 -23
  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 +18 -4
  151. package/dist/services/arca/arca-client.factory.js +27 -1
  152. package/dist/services/arca/arca-context.resolver.js +17 -7
  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 +103 -0
  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 +26 -11
  163. package/dist/services/pdf/pdf-plugin.js +41 -14
  164. package/dist/ui/components/certificateBanner.js +8 -0
  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 +1 -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 +1 -2
  178. package/dist/ui/presenters/errors.presenter.js +14 -12
  179. package/dist/ui/presenters/errors.zod-presenter.js +13 -35
  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 +13 -2
  198. package/dist/ui/theme/index.js +0 -1
  199. package/dist/ui/theme/theme.js +0 -1
  200. package/llms.txt +122 -45
  201. package/package.json +1 -2
  202. package/dist/cli/commands/billing-family.command.d.ts +0 -2
  203. package/dist/cli/commands/billing-family.command.js.map +0 -1
  204. package/dist/cli/commands/billing-shortcuts.command.d.ts +0 -2
  205. package/dist/cli/commands/billing-shortcuts.command.js.map +0 -1
  206. package/dist/cli/commands/billing.command.batch.d.ts +0 -22
  207. package/dist/cli/commands/billing.command.batch.js.map +0 -1
  208. package/dist/cli/commands/billing.command.interactive-preview.d.ts +0 -18
  209. package/dist/cli/commands/billing.command.interactive-preview.js.map +0 -1
  210. package/dist/cli/commands/billing.command.options.d.ts +0 -2
  211. package/dist/cli/commands/billing.command.options.js.map +0 -1
  212. package/dist/cli/commands/billing.command.output.d.ts +0 -14
  213. package/dist/cli/commands/billing.command.output.js.map +0 -1
  214. package/dist/cli/commands/billing.command.parser.d.ts +0 -28
  215. package/dist/cli/commands/billing.command.parser.js.map +0 -1
  216. package/dist/cli/commands/billing.command.pdf.d.ts +0 -24
  217. package/dist/cli/commands/billing.command.pdf.js.map +0 -1
  218. package/dist/cli/commands/billing.command.shared.d.ts +0 -7
  219. package/dist/cli/commands/billing.command.shared.js.map +0 -1
  220. package/dist/cli/commands/billing.command.shortcuts.d.ts +0 -7
  221. package/dist/cli/commands/billing.command.shortcuts.js.map +0 -1
  222. package/dist/cli/commands/config.command.d.ts +0 -7
  223. package/dist/cli/commands/config.command.js.map +0 -1
  224. package/dist/cli/commands/examples.command.d.ts +0 -2
  225. package/dist/cli/commands/examples.command.js.map +0 -1
  226. package/dist/cli/commands/fce-obligation.command.d.ts +0 -2
  227. package/dist/cli/commands/fce-obligation.command.js.map +0 -1
  228. package/dist/cli/commands/interactive.command.d.ts +0 -3
  229. package/dist/cli/commands/interactive.command.js.map +0 -1
  230. package/dist/cli/commands/parameters.command.d.ts +0 -2
  231. package/dist/cli/commands/parameters.command.js.map +0 -1
  232. package/dist/cli/commands/pdf.command.d.ts +0 -2
  233. package/dist/cli/commands/pdf.command.js.map +0 -1
  234. package/dist/cli/commands/storybook.command.d.ts +0 -2
  235. package/dist/cli/commands/storybook.command.js.map +0 -1
  236. package/dist/cli/commands/vouchers.command.d.ts +0 -2
  237. package/dist/cli/commands/vouchers.command.js.map +0 -1
  238. package/dist/cli/error-output.d.ts +0 -7
  239. package/dist/cli/error-output.js.map +0 -1
  240. package/dist/cli/help-argv.d.ts +0 -5
  241. package/dist/cli/help-argv.js.map +0 -1
  242. package/dist/cli/help.d.ts +0 -12
  243. package/dist/cli/help.js.map +0 -1
  244. package/dist/cli/index.d.ts +0 -2
  245. package/dist/cli/index.js.map +0 -1
  246. package/dist/cli/interactive/advanced-options.d.ts +0 -21
  247. package/dist/cli/interactive/advanced-options.js.map +0 -1
  248. package/dist/cli/interactive/config.flow.d.ts +0 -5
  249. package/dist/cli/interactive/config.flow.js.map +0 -1
  250. package/dist/cli/interactive/history.flow.d.ts +0 -6
  251. package/dist/cli/interactive/history.flow.js.map +0 -1
  252. package/dist/cli/interactive/interactive-mode.d.ts +0 -3
  253. package/dist/cli/interactive/interactive-mode.js.map +0 -1
  254. package/dist/cli/interactive/invoice-picker.d.ts +0 -25
  255. package/dist/cli/interactive/invoice-picker.js.map +0 -1
  256. package/dist/cli/interactive/invoice.flow.d.ts +0 -20
  257. package/dist/cli/interactive/invoice.flow.js.map +0 -1
  258. package/dist/cli/interactive/note.flow.d.ts +0 -32
  259. package/dist/cli/interactive/note.flow.js.map +0 -1
  260. package/dist/cli/interactive/pdf.flow.d.ts +0 -5
  261. package/dist/cli/interactive/pdf.flow.js.map +0 -1
  262. package/dist/cli/interactive/prompts.d.ts +0 -57
  263. package/dist/cli/interactive/prompts.js.map +0 -1
  264. package/dist/cli/interactive/repeat.flow.d.ts +0 -13
  265. package/dist/cli/interactive/repeat.flow.js.map +0 -1
  266. package/dist/cli/interactive/session.d.ts +0 -22
  267. package/dist/cli/interactive/session.js.map +0 -1
  268. package/dist/cli/interactive/status.flow.d.ts +0 -3
  269. package/dist/cli/interactive/status.flow.js.map +0 -1
  270. package/dist/cli/interactive/update.flow.d.ts +0 -6
  271. package/dist/cli/interactive/update.flow.js.map +0 -1
  272. package/dist/cli/interactive/validators.d.ts +0 -9
  273. package/dist/cli/interactive/validators.js.map +0 -1
  274. package/dist/cli/option-parsers.d.ts +0 -6
  275. package/dist/cli/option-parsers.js.map +0 -1
  276. package/dist/cli/program.d.ts +0 -2
  277. package/dist/cli/program.js.map +0 -1
  278. package/dist/cli/spinner.d.ts +0 -8
  279. package/dist/cli/spinner.js.map +0 -1
  280. package/dist/cli/types.d.ts +0 -6
  281. package/dist/cli/types.js.map +0 -1
  282. package/dist/cli/version.d.ts +0 -1
  283. package/dist/cli/version.js.map +0 -1
  284. package/dist/index.d.ts +0 -1
  285. package/dist/index.js.map +0 -1
  286. package/dist/lib/dates/arca-date.d.ts +0 -19
  287. package/dist/lib/dates/arca-date.js.map +0 -1
  288. package/dist/lib/errors/app-error.d.ts +0 -17
  289. package/dist/lib/errors/app-error.js.map +0 -1
  290. package/dist/lib/files/read-json-file.d.ts +0 -1
  291. package/dist/lib/files/read-json-file.js.map +0 -1
  292. package/dist/lib/files/restrict-to-owner.d.ts +0 -7
  293. package/dist/lib/files/restrict-to-owner.js.map +0 -1
  294. package/dist/lib/identity/format-cuit.d.ts +0 -2
  295. package/dist/lib/identity/format-cuit.js.map +0 -1
  296. package/dist/lib/links.d.ts +0 -2
  297. package/dist/lib/links.js.map +0 -1
  298. package/dist/lib/numbers/argentine-amount.d.ts +0 -23
  299. package/dist/lib/numbers/argentine-amount.js.map +0 -1
  300. package/dist/lib/numbers/strict-integer.d.ts +0 -4
  301. package/dist/lib/numbers/strict-integer.js.map +0 -1
  302. package/dist/lib/paths/mask-path.d.ts +0 -1
  303. package/dist/lib/paths/mask-path.js.map +0 -1
  304. package/dist/lib/security/certificate.d.ts +0 -7
  305. package/dist/lib/security/certificate.js.map +0 -1
  306. package/dist/lib/security/pem.d.ts +0 -5
  307. package/dist/lib/security/pem.js.map +0 -1
  308. package/dist/modules/billing/billing-response.d.ts +0 -4
  309. package/dist/modules/billing/billing-response.js.map +0 -1
  310. package/dist/modules/billing/billing.amounts.d.ts +0 -21
  311. package/dist/modules/billing/billing.amounts.js.map +0 -1
  312. package/dist/modules/billing/billing.associated-period.d.ts +0 -8
  313. package/dist/modules/billing/billing.associated-period.js.map +0 -1
  314. package/dist/modules/billing/billing.associated-vouchers.d.ts +0 -12
  315. package/dist/modules/billing/billing.associated-vouchers.js.map +0 -1
  316. package/dist/modules/billing/billing.batch.d.ts +0 -23
  317. package/dist/modules/billing/billing.batch.js.map +0 -1
  318. package/dist/modules/billing/billing.constants.d.ts +0 -2
  319. package/dist/modules/billing/billing.constants.js.map +0 -1
  320. package/dist/modules/billing/billing.currency.d.ts +0 -18
  321. package/dist/modules/billing/billing.currency.js.map +0 -1
  322. package/dist/modules/billing/billing.date-range.d.ts +0 -9
  323. package/dist/modules/billing/billing.date-range.js.map +0 -1
  324. package/dist/modules/billing/billing.display.d.ts +0 -13
  325. package/dist/modules/billing/billing.display.js.map +0 -1
  326. package/dist/modules/billing/billing.errors.d.ts +0 -12
  327. package/dist/modules/billing/billing.errors.js.map +0 -1
  328. package/dist/modules/billing/billing.fce.d.ts +0 -21
  329. package/dist/modules/billing/billing.fce.js.map +0 -1
  330. package/dist/modules/billing/billing.iva-receptor.d.ts +0 -8
  331. package/dist/modules/billing/billing.iva-receptor.js.map +0 -1
  332. package/dist/modules/billing/billing.json-format.d.ts +0 -6
  333. package/dist/modules/billing/billing.json-format.js.map +0 -1
  334. package/dist/modules/billing/billing.labels.d.ts +0 -9
  335. package/dist/modules/billing/billing.labels.js.map +0 -1
  336. package/dist/modules/billing/billing.mappers.d.ts +0 -8
  337. package/dist/modules/billing/billing.mappers.js.map +0 -1
  338. package/dist/modules/billing/billing.presenter.d.ts +0 -7
  339. package/dist/modules/billing/billing.presenter.js.map +0 -1
  340. package/dist/modules/billing/billing.schemas.d.ts +0 -142
  341. package/dist/modules/billing/billing.schemas.js.map +0 -1
  342. package/dist/modules/billing/billing.serialize.d.ts +0 -8
  343. package/dist/modules/billing/billing.serialize.js.map +0 -1
  344. package/dist/modules/billing/billing.service.d.ts +0 -27
  345. package/dist/modules/billing/billing.service.js.map +0 -1
  346. package/dist/modules/billing/billing.text.d.ts +0 -8
  347. package/dist/modules/billing/billing.text.js.map +0 -1
  348. package/dist/modules/billing/billing.types.d.ts +0 -13
  349. package/dist/modules/billing/billing.types.internal.d.ts +0 -30
  350. package/dist/modules/billing/billing.types.internal.js.map +0 -1
  351. package/dist/modules/billing/billing.types.js.map +0 -1
  352. package/dist/modules/billing/billing.validation.d.ts +0 -7
  353. package/dist/modules/billing/billing.validation.js.map +0 -1
  354. package/dist/modules/billing/voucher-kind-map.d.ts +0 -9
  355. package/dist/modules/billing/voucher-kind-map.js.map +0 -1
  356. package/dist/modules/config/config-doctor.d.ts +0 -15
  357. package/dist/modules/config/config-doctor.js.map +0 -1
  358. package/dist/modules/config/config-value-parser.d.ts +0 -2
  359. package/dist/modules/config/config-value-parser.js.map +0 -1
  360. package/dist/modules/config/config.presenter.d.ts +0 -15
  361. package/dist/modules/config/config.presenter.js.map +0 -1
  362. package/dist/modules/config/config.schemas.d.ts +0 -154
  363. package/dist/modules/config/config.schemas.js.map +0 -1
  364. package/dist/modules/config/config.sections.d.ts +0 -14
  365. package/dist/modules/config/config.sections.js.map +0 -1
  366. package/dist/modules/config/config.service.d.ts +0 -35
  367. package/dist/modules/config/config.service.js.map +0 -1
  368. package/dist/modules/examples/examples.d.ts +0 -1
  369. package/dist/modules/examples/examples.js.map +0 -1
  370. package/dist/modules/fce/fce-obligation.d.ts +0 -20
  371. package/dist/modules/fce/fce-obligation.js.map +0 -1
  372. package/dist/modules/fce/fce-obligation.presenter.d.ts +0 -9
  373. package/dist/modules/fce/fce-obligation.presenter.js.map +0 -1
  374. package/dist/modules/interactive/amount-input.d.ts +0 -4
  375. package/dist/modules/interactive/amount-input.js.map +0 -1
  376. package/dist/modules/interactive/choices.d.ts +0 -13
  377. package/dist/modules/interactive/choices.js.map +0 -1
  378. package/dist/modules/interactive/config-fields.d.ts +0 -20
  379. package/dist/modules/interactive/config-fields.js.map +0 -1
  380. package/dist/modules/interactive/equivalent-command.d.ts +0 -8
  381. package/dist/modules/interactive/equivalent-command.js.map +0 -1
  382. package/dist/modules/interactive/invoice-copy.d.ts +0 -19
  383. package/dist/modules/interactive/invoice-copy.js.map +0 -1
  384. package/dist/modules/interactive/periods.d.ts +0 -7
  385. package/dist/modules/interactive/periods.js.map +0 -1
  386. package/dist/modules/interactive/wizard.d.ts +0 -16
  387. package/dist/modules/interactive/wizard.js.map +0 -1
  388. package/dist/modules/parameters/health.d.ts +0 -17
  389. package/dist/modules/parameters/health.js.map +0 -1
  390. package/dist/modules/parameters/parameters.d.ts +0 -50
  391. package/dist/modules/parameters/parameters.js.map +0 -1
  392. package/dist/modules/parameters/parameters.presenter.d.ts +0 -12
  393. package/dist/modules/parameters/parameters.presenter.js.map +0 -1
  394. package/dist/modules/parameters/status.d.ts +0 -31
  395. package/dist/modules/parameters/status.js.map +0 -1
  396. package/dist/modules/pdf/pdf-data.mapper.d.ts +0 -4
  397. package/dist/modules/pdf/pdf-data.mapper.js.map +0 -1
  398. package/dist/modules/pdf/pdf-decision.d.ts +0 -14
  399. package/dist/modules/pdf/pdf-decision.js.map +0 -1
  400. package/dist/modules/pdf/pdf-file-name.d.ts +0 -3
  401. package/dist/modules/pdf/pdf-file-name.js.map +0 -1
  402. package/dist/modules/pdf/pdf-issuer.d.ts +0 -8
  403. package/dist/modules/pdf/pdf-issuer.js.map +0 -1
  404. package/dist/modules/pdf/pdf.errors.d.ts +0 -9
  405. package/dist/modules/pdf/pdf.errors.js.map +0 -1
  406. package/dist/modules/pdf/pdf.types.d.ts +0 -91
  407. package/dist/modules/pdf/pdf.types.js.map +0 -1
  408. package/dist/modules/storybook/showcase-theme.d.ts +0 -7
  409. package/dist/modules/storybook/showcase-theme.js.map +0 -1
  410. package/dist/modules/storybook/showcase.d.ts +0 -2
  411. package/dist/modules/storybook/showcase.js.map +0 -1
  412. package/dist/modules/update-check/changelog.d.ts +0 -23
  413. package/dist/modules/update-check/changelog.js.map +0 -1
  414. package/dist/modules/update-check/update-check.presenter.d.ts +0 -6
  415. package/dist/modules/update-check/update-check.presenter.js.map +0 -1
  416. package/dist/modules/update-check/update-check.service.d.ts +0 -11
  417. package/dist/modules/update-check/update-check.service.js.map +0 -1
  418. package/dist/modules/vouchers/voucher-history.d.ts +0 -39
  419. package/dist/modules/vouchers/voucher-history.js.map +0 -1
  420. package/dist/modules/vouchers/voucher-history.presenter.d.ts +0 -29
  421. package/dist/modules/vouchers/voucher-history.presenter.js.map +0 -1
  422. package/dist/services/arca/arca-billing.gateway.d.ts +0 -10
  423. package/dist/services/arca/arca-billing.gateway.js.map +0 -1
  424. package/dist/services/arca/arca-client.factory.d.ts +0 -5
  425. package/dist/services/arca/arca-client.factory.js.map +0 -1
  426. package/dist/services/arca/arca-context.resolver.d.ts +0 -44
  427. package/dist/services/arca/arca-context.resolver.js.map +0 -1
  428. package/dist/services/arca/arca-fce-obligation.gateway.d.ts +0 -7
  429. package/dist/services/arca/arca-fce-obligation.gateway.js.map +0 -1
  430. package/dist/services/arca/arca-parameters.gateway.d.ts +0 -10
  431. package/dist/services/arca/arca-parameters.gateway.js.map +0 -1
  432. package/dist/services/arca/arca-voucher-history.gateway.d.ts +0 -8
  433. package/dist/services/arca/arca-voucher-history.gateway.js.map +0 -1
  434. package/dist/services/clipboard/clipboard.d.ts +0 -2
  435. package/dist/services/clipboard/clipboard.js.map +0 -1
  436. package/dist/services/pdf/escape-html.d.ts +0 -6
  437. package/dist/services/pdf/escape-html.js.map +0 -1
  438. package/dist/services/pdf/pdf-browser.d.ts +0 -5
  439. package/dist/services/pdf/pdf-browser.js.map +0 -1
  440. package/dist/services/pdf/pdf-exporter.d.ts +0 -19
  441. package/dist/services/pdf/pdf-exporter.js.map +0 -1
  442. package/dist/services/pdf/pdf-plugin.d.ts +0 -50
  443. package/dist/services/pdf/pdf-plugin.js.map +0 -1
  444. package/dist/ui/components/contentPanel.d.ts +0 -5
  445. package/dist/ui/components/contentPanel.js.map +0 -1
  446. package/dist/ui/components/errorPanel.d.ts +0 -1
  447. package/dist/ui/components/errorPanel.js.map +0 -1
  448. package/dist/ui/components/index.d.ts +0 -9
  449. package/dist/ui/components/index.js.map +0 -1
  450. package/dist/ui/components/keyValuePanel.d.ts +0 -3
  451. package/dist/ui/components/keyValuePanel.js.map +0 -1
  452. package/dist/ui/components/noticePanel.d.ts +0 -3
  453. package/dist/ui/components/noticePanel.js.map +0 -1
  454. package/dist/ui/components/rawPanel.d.ts +0 -1
  455. package/dist/ui/components/rawPanel.js.map +0 -1
  456. package/dist/ui/components/sectionHeading.d.ts +0 -3
  457. package/dist/ui/components/sectionHeading.js.map +0 -1
  458. package/dist/ui/components/statusBar.d.ts +0 -19
  459. package/dist/ui/components/statusBar.js.map +0 -1
  460. package/dist/ui/components/statusPanel.d.ts +0 -3
  461. package/dist/ui/components/statusPanel.js.map +0 -1
  462. package/dist/ui/components/testingBanner.d.ts +0 -2
  463. package/dist/ui/components/testingBanner.js.map +0 -1
  464. package/dist/ui/index.d.ts +0 -5
  465. package/dist/ui/index.js.map +0 -1
  466. package/dist/ui/presenters/billing.presenter.d.ts +0 -2
  467. package/dist/ui/presenters/billing.presenter.js.map +0 -1
  468. package/dist/ui/presenters/config.presenter.d.ts +0 -1
  469. package/dist/ui/presenters/config.presenter.js.map +0 -1
  470. package/dist/ui/presenters/errors.presenter.d.ts +0 -1
  471. package/dist/ui/presenters/errors.presenter.js.map +0 -1
  472. package/dist/ui/presenters/errors.zod-presenter.d.ts +0 -4
  473. package/dist/ui/presenters/errors.zod-presenter.js.map +0 -1
  474. package/dist/ui/presenters/index.d.ts +0 -6
  475. package/dist/ui/presenters/index.js.map +0 -1
  476. package/dist/ui/presenters/pdf.presenter.d.ts +0 -13
  477. package/dist/ui/presenters/pdf.presenter.js.map +0 -1
  478. package/dist/ui/presenters/showcase.presenter.d.ts +0 -1
  479. package/dist/ui/presenters/showcase.presenter.js.map +0 -1
  480. package/dist/ui/primitives/index.d.ts +0 -10
  481. package/dist/ui/primitives/index.js.map +0 -1
  482. package/dist/ui/primitives/renderDivider.d.ts +0 -5
  483. package/dist/ui/primitives/renderDivider.js.map +0 -1
  484. package/dist/ui/primitives/renderFooter.d.ts +0 -7
  485. package/dist/ui/primitives/renderFooter.js.map +0 -1
  486. package/dist/ui/primitives/renderJson.d.ts +0 -3
  487. package/dist/ui/primitives/renderJson.js.map +0 -1
  488. package/dist/ui/primitives/renderKeyValue.d.ts +0 -14
  489. package/dist/ui/primitives/renderKeyValue.js.map +0 -1
  490. package/dist/ui/primitives/renderLogo.d.ts +0 -3
  491. package/dist/ui/primitives/renderLogo.js.map +0 -1
  492. package/dist/ui/primitives/renderObject.d.ts +0 -1
  493. package/dist/ui/primitives/renderObject.js.map +0 -1
  494. package/dist/ui/primitives/renderPanel.d.ts +0 -27
  495. package/dist/ui/primitives/renderPanel.js.map +0 -1
  496. package/dist/ui/primitives/renderSubtitle.d.ts +0 -7
  497. package/dist/ui/primitives/renderSubtitle.js.map +0 -1
  498. package/dist/ui/primitives/renderTable.d.ts +0 -6
  499. package/dist/ui/primitives/renderTable.js.map +0 -1
  500. package/dist/ui/primitives/terminalWidth.d.ts +0 -4
  501. package/dist/ui/primitives/terminalWidth.js.map +0 -1
  502. package/dist/ui/primitives/text.d.ts +0 -28
  503. package/dist/ui/primitives/text.js.map +0 -1
  504. package/dist/ui/stream/index.d.ts +0 -1
  505. package/dist/ui/stream/index.js.map +0 -1
  506. package/dist/ui/stream/terminal-stream.d.ts +0 -16
  507. package/dist/ui/stream/terminal-stream.js.map +0 -1
  508. package/dist/ui/theme/index.d.ts +0 -1
  509. package/dist/ui/theme/index.js.map +0 -1
  510. package/dist/ui/theme/theme.d.ts +0 -68
  511. 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
+ }
@@ -1,8 +1,9 @@
1
1
  import { ConfigService } from '../../modules/config/config.service.js';
2
2
  import { buildConfigDoctorReport } from '../../modules/config/config-doctor.js';
3
3
  import { ArcaContextResolver } from '../../services/arca/arca-context.resolver.js';
4
- import { formatConfig, formatConfigAsText, formatConfigDoctor, formatConfigDoctorAsText, formatConfigPath, writeTerminalJson, writeTerminalOutput, } from '../../ui/index.js';
5
- import { configureSpanishHelp, createConfigHelp } from '../help.js';
4
+ import { formatConfig, formatConfigAsText, formatConfigDoctor, formatConfigDoctorAsText, formatConfigPath, formatConfigPathAsJson, writeTerminalJson, writeTerminalOutput, } from '../../ui/index.js';
5
+ import { registerJsonOption, resolveOutputJson } from '../global-options.js';
6
+ import { configureSpanishHelp, createConfigHelp, createConfigSetHelp } from '../help.js';
6
7
  import { startSpinner } from '../spinner.js';
7
8
  function createConfigService() {
8
9
  const service = new ConfigService();
@@ -16,34 +17,33 @@ function printConfigResult(textValue, jsonValue, useJson = false) {
16
17
  }
17
18
  writeTerminalOutput(textValue);
18
19
  }
19
- export function buildRuntimeCheck(options) {
20
- try {
21
- return {
22
- validation: new ArcaContextResolver({
23
- options: {
24
- produccion: options.produccion,
25
- testing: options.testing,
26
- },
27
- }).validate(),
28
- };
29
- }
30
- catch (error) {
31
- return {
32
- error: error instanceof Error ? error.message : 'No se pudo completar la revision activa.',
33
- };
34
- }
20
+ const ENVIRONMENTS = ['testing', 'produccion'];
21
+ /** Valida el entorno por defecto y cualquier otro que tenga cert o key cargados: `revisar` cubre los dos. */
22
+ export function buildRuntimeChecks(config) {
23
+ return ENVIRONMENTS.filter((environment) => environment === config.entornoPorDefecto || Boolean(config.cert[environment] || config.key[environment])).map((environment) => {
24
+ try {
25
+ new ArcaContextResolver({ options: { [environment]: true } }).validate();
26
+ return { environment };
27
+ }
28
+ catch (error) {
29
+ return {
30
+ environment,
31
+ error: error instanceof Error ? error.message : 'No se pudo completar la validación.',
32
+ };
33
+ }
34
+ });
35
35
  }
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
- configCommand.option('--json', 'imprimir salida JSON').action((options) => {
41
+ registerJsonOption(configCommand).action((_options, command) => {
42
42
  const service = createConfigService();
43
43
  try {
44
44
  const config = service.getConfig();
45
45
  const paths = service.resolvePaths(config);
46
- printConfigResult(formatConfigAsText(config, paths), formatConfig(config, paths), options.json);
46
+ printConfigResult(formatConfigAsText(config, paths), formatConfig(config, paths), resolveOutputJson(command, config));
47
47
  }
48
48
  finally {
49
49
  service.close();
@@ -52,17 +52,17 @@ 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 activa')
56
- .option('--json', 'imprimir salida JSON')
57
- .option('--testing', 'revisar para testing')
58
- .option('--produccion', 'revisar para produccion')
59
- .action((options) => {
55
+ .description('revisar configuración, defaults, credenciales y validación de cada entorno')
56
+ .action((_options, command) => {
60
57
  const service = createConfigService();
61
- const spinner = options.json ? null : startSpinner('Generando revision...');
58
+ let spinner = null;
62
59
  try {
63
- const report = buildConfigDoctorReport(service.getConfig(), buildRuntimeCheck(options));
60
+ const config = service.getConfig();
61
+ const useJson = resolveOutputJson(command, config);
62
+ spinner = useJson ? null : startSpinner('Generando revisión...');
63
+ const report = buildConfigDoctorReport(config, buildRuntimeChecks(config));
64
64
  spinner?.stop();
65
- printConfigResult(formatConfigDoctorAsText(report), formatConfigDoctor(report), options.json);
65
+ printConfigResult(formatConfigDoctorAsText(report), formatConfigDoctor(report), useJson);
66
66
  }
67
67
  catch (error) {
68
68
  spinner?.stop();
@@ -72,14 +72,13 @@ export function registerConfigCommand(program) {
72
72
  service.close();
73
73
  }
74
74
  });
75
+ registerJsonOption(revisarCommand);
75
76
  configureSpanishHelp(revisarCommand);
76
- const rutaCommand = configCommand
77
- .command('ruta')
78
- .description('mostrar la ruta del archivo de configuracion')
79
- .action(() => {
77
+ const rutaCommand = registerJsonOption(configCommand.command('ruta').description('mostrar la ruta del archivo de configuración')).action((_options, command) => {
80
78
  const service = createConfigService();
81
79
  try {
82
- writeTerminalOutput(formatConfigPath(service.getPath()));
80
+ const path = service.getPath();
81
+ printConfigResult(formatConfigPath(path), formatConfigPathAsJson(path), resolveOutputJson(command, service.getConfig()));
83
82
  }
84
83
  finally {
85
84
  service.close();
@@ -88,40 +87,40 @@ export function registerConfigCommand(program) {
88
87
  configureSpanishHelp(rutaCommand);
89
88
  const establecerCommand = configCommand
90
89
  .command('establecer')
91
- .description('guardar un valor de configuracion')
92
- .option('--json', 'imprimir salida JSON')
93
- .argument('<clave>', 'clave publica de configuracion')
90
+ .description('guardar un valor de configuración')
91
+ .argument('<clave>', 'clave publica de configuración')
94
92
  .argument('<valor>', 'valor a guardar')
95
- .action((key, value, options) => {
93
+ .addHelpText('after', createConfigSetHelp())
94
+ .action((key, value, _options, command) => {
96
95
  // Sin ensureInitialized: si la config quedo invalida, establecer o eliminar la clave es la forma de arreglarla.
97
96
  const service = new ConfigService();
98
97
  try {
99
98
  const config = service.setValue(key, value);
100
99
  const paths = service.resolvePaths(config);
101
- printConfigResult(formatConfigAsText(config, paths), formatConfig(config, paths), options.json);
100
+ printConfigResult(formatConfigAsText(config, paths), formatConfig(config, paths), resolveOutputJson(command, config));
102
101
  }
103
102
  finally {
104
103
  service.close();
105
104
  }
106
105
  });
106
+ registerJsonOption(establecerCommand);
107
107
  configureSpanishHelp(establecerCommand);
108
108
  const eliminarCommand = configCommand
109
109
  .command('eliminar')
110
- .description('eliminar un valor de configuracion')
111
- .option('--json', 'imprimir salida JSON')
112
- .argument('<clave>', 'clave publica de configuracion')
113
- .action((key, options) => {
110
+ .description('eliminar un valor de configuración')
111
+ .argument('<clave>', 'clave publica de configuración')
112
+ .action((key, _options, command) => {
114
113
  // Sin ensureInitialized: si la config quedo invalida, establecer o eliminar la clave es la forma de arreglarla.
115
114
  const service = new ConfigService();
116
115
  try {
117
116
  const config = service.unsetValue(key);
118
117
  const paths = service.resolvePaths(config);
119
- printConfigResult(formatConfigAsText(config, paths), formatConfig(config, paths), options.json);
118
+ printConfigResult(formatConfigAsText(config, paths), formatConfig(config, paths), resolveOutputJson(command, config));
120
119
  }
121
120
  finally {
122
121
  service.close();
123
122
  }
124
123
  });
124
+ registerJsonOption(eliminarCommand);
125
125
  configureSpanishHelp(eliminarCommand);
126
126
  }
127
- //# sourceMappingURL=config.command.js.map
@@ -0,0 +1,10 @@
1
+ import { InputValidationError } from '../../lib/errors/app-error.js';
2
+ import { parseCuit } from '../../lib/identity/cuit.js';
3
+ /** CUIT de un argumento posicional, con o sin guiones. */
4
+ export function parseCuitArgument(value) {
5
+ const result = parseCuit(value);
6
+ if (!result.ok) {
7
+ throw new InputValidationError(`El CUIT "${value}" no es válido: ${result.reason}.`);
8
+ }
9
+ return Number(result.value);
10
+ }
@@ -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
+ }