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
@@ -1,34 +1,34 @@
1
1
  import { Option } from 'commander';
2
2
  import { EXCHANGE_RATE_DECIMALS } from '../../lib/numbers/argentine-amount.js';
3
- import { amountOption, documentNumberOption, integerOption } from '../option-parsers.js';
3
+ import { amountOption, cuitOption, documentNumberOption, integerOption } from '../option-parsers.js';
4
4
  export function registerBillingOptions(command) {
5
5
  command
6
- .option('-m, --monto <number>', 'importe total del comprobante, por ejemplo 15000 o 1.500,50', amountOption('--monto'))
7
- .option('--alicuota <tasa>', 'alicuota de IVA para A y B: general (21), reducida (10.5), incrementada (27), cero (0), 5 o 2.5. Repetible como TASA:MONTO para varias alicuotas', (value, previous) => [...(previous ?? []), value])
8
- .option('--exento <number>', 'parte exenta del monto total (A y B)', amountOption('--exento'))
6
+ .option('-m, --monto <numero>', 'importe total del comprobante, por ejemplo 15000 o 1.500,50', amountOption('--monto'))
7
+ .option('--alicuota <tasa>', 'alícuota de IVA para A y B: general (21), reducida (10.5), incrementada (27), cero (0), 5 o 2.5. Repetible como TASA:MONTO para varias alícuotas', (value, previous) => [...(previous ?? []), value])
8
+ .option('--exento <numero>', 'parte exenta del monto total (A y B)', amountOption('--exento'))
9
9
  // No puede llamarse --no-gravado: commander interpreta --no-* como negacion de un flag booleano.
10
- .option('--nogravado <number>', 'parte no gravada del monto total (A y B)', amountOption('--nogravado'))
11
- .option('-d, --dia <number>', 'dia de vencimiento o referencia del servicio', integerOption('--dia'))
12
- .option('--punto-venta <number>', 'punto de venta', integerOption('--punto-venta'))
13
- .option('--pv <number>', 'alias de punto de venta', integerOption('--pv'))
14
- .option('--cargar <path>', 'cargar datos base desde un archivo JSON')
10
+ .option('--nogravado <numero>', 'parte no gravada del monto total (A y B)', amountOption('--nogravado'))
11
+ .option('-d, --dia <numero>', 'día de vencimiento o referencia del servicio', integerOption('--dia'))
12
+ .option('--punto-venta <numero>', 'punto de venta (alias: --pv)', integerOption('--punto-venta'))
13
+ .option('--pv <numero>', 'alias de punto de venta', integerOption('--pv'))
14
+ .option('--cargar <ruta>', 'cargar datos base desde un archivo JSON')
15
15
  .option('-f, --fecha <fecha>', 'fecha del comprobante; acepta D, D/M, D/M/YY o D/M/YYYY con - o /')
16
16
  .option('-c, --concepto <tipo>', 'productos, servicios o productos y servicios (alias: cs, cp, csp)')
17
17
  .option('--cs', 'usar concepto servicios')
18
18
  .option('--cp', 'usar concepto productos')
19
19
  .option('--csp', 'usar concepto productos y servicios')
20
- .option('--moneda <codigo>', 'codigo de moneda, por ejemplo ARS o USD')
20
+ .option('--moneda <codigo>', 'código de moneda, por ejemplo ARS o USD (alias: --mda)')
21
21
  .option('--mda <codigo>', 'alias de moneda, por ejemplo ARS o USD')
22
- .option('--cm <number>', 'alias de cotizacion de la moneda', amountOption('--cm', EXCHANGE_RATE_DECIMALS))
23
- .option('--cotizacion-moneda <number>', 'cotizacion de la moneda, por ejemplo 1.452,50', amountOption('--cotizacion-moneda', EXCHANGE_RATE_DECIMALS))
24
- .option('--misma-moneda', 'el pago se cancela en la misma moneda extranjera; usa la cotizacion oficial de ARCA')
25
- .option('--cuit <number>', 'usar CUIT del receptor', documentNumberOption('--cuit'))
26
- .option('--cuil <number>', 'usar CUIL del receptor', documentNumberOption('--cuil'))
27
- .option('--dni <number>', 'usar DNI del receptor', documentNumberOption('--dni'))
28
- .option('--consumidor-final', 'usar consumidor final con documento 0')
22
+ .option('--cm <numero>', 'alias de cotización de la moneda', amountOption('--cm', EXCHANGE_RATE_DECIMALS))
23
+ .option('--cotizacion-moneda <numero>', 'cotización de la moneda, por ejemplo 1.452,50 (alias: --cm)', amountOption('--cotizacion-moneda', EXCHANGE_RATE_DECIMALS))
24
+ .option('--misma-moneda', 'el pago se cancela en la misma moneda extranjera; usa la cotización oficial de ARCA')
25
+ .option('--cuit <numero>', 'usar CUIT del receptor', documentNumberOption('--cuit'))
26
+ .option('--cuil <numero>', 'usar CUIL del receptor', documentNumberOption('--cuil'))
27
+ .option('--dni <numero>', 'usar DNI del receptor', documentNumberOption('--dni'))
28
+ .option('--consumidor-final', 'usar consumidor final con documento 0 (alias: --cfinal)')
29
29
  .option('--cfinal', 'alias de consumidor final con documento 0')
30
- .option('--iva-receptor <tipo>', 'condicion IVA del receptor')
31
- .option('--ir <tipo>', 'alias rapido de condicion IVA del receptor')
30
+ .option('--iva-receptor <tipo>', 'condición IVA del receptor; con --cuit, sin este flag, se toma del padrón (alias: --ir)')
31
+ .option('--ir <tipo>', 'alias rápido de condición IVA del receptor')
32
32
  .option('--ir-ce', 'IVA receptor: cliente del exterior')
33
33
  .option('--ir-cf', 'IVA receptor: consumidor final')
34
34
  .option('--ir-il', 'IVA receptor: IVA liberado')
@@ -40,34 +40,78 @@ export function registerBillingOptions(command) {
40
40
  .option('--ir-rm', 'IVA receptor: responsable monotributo')
41
41
  .option('--ir-se', 'IVA receptor: sujeto exento')
42
42
  .option('--ir-snc', 'IVA receptor: sujeto no categorizado')
43
- .option('--sd <fecha>', 'alias rapido de fecha de inicio de servicio')
44
- .option('--servicio-desde <fecha>', 'fecha de inicio de servicio')
45
- .option('--sh <fecha>', 'alias rapido de fecha de fin de servicio')
46
- .option('--servicio-hasta <fecha>', 'fecha de fin de servicio')
47
- .option('--vencimiento <fecha>', 'fecha de vencimiento del pago; por defecto el fin del servicio')
43
+ .option('--sd <fecha>', 'alias rápido de fecha de inicio de servicio')
44
+ .option('--servicio-desde <fecha>', 'fecha de inicio de servicio (alias: --sd)')
45
+ .option('--sh <fecha>', 'alias rápido de fecha de fin de servicio')
46
+ .option('--servicio-hasta <fecha>', 'fecha de fin de servicio (alias: --sh)')
47
+ .option('--vencimiento <fecha>', 'fecha de vencimiento del pago; por defecto el fin del servicio (alias: --vto)')
48
48
  .option('--vto <fecha>', 'alias de fecha de vencimiento del pago')
49
- .option('--at <number>', 'tipo ARCA del comprobante asociado', integerOption('--at'))
50
- .option('--apv <number>', 'punto de venta del comprobante asociado', integerOption('--apv'))
51
- .option('--asociado-punto-venta <number>', 'punto de venta del comprobante asociado', integerOption('--asociado-punto-venta'))
52
- .option('--ar <number>', 'numero del comprobante asociado', integerOption('--ar'))
53
- .option('--ac <shortcut>', 'atajo del comprobante asociado, por ejemplo fc o fa')
54
- .option('--acuit <number>', 'CUIT del comprobante asociado; en NC/ND FCE por defecto el CUIT emisor')
55
- .option('--periodo-desde <fecha>', 'inicio del periodo asociado; alternativa a --ac en notas comunes')
56
- .option('--pd <fecha>', 'alias de inicio del periodo asociado')
57
- .option('--periodo-hasta <fecha>', 'fin del periodo asociado; alternativa a --ac en notas comunes')
58
- .option('--ph <fecha>', 'alias de fin del periodo asociado')
49
+ .option('--at <numero>', 'tipo ARCA del comprobante asociado', integerOption('--at'))
50
+ .option('--apv <numero>', 'punto de venta del comprobante asociado (alias: --asociado-punto-venta)', integerOption('--apv'))
51
+ .option('--asociado-punto-venta <numero>', 'punto de venta del comprobante asociado', integerOption('--asociado-punto-venta'))
52
+ .option('--ar <numero>', 'número del comprobante asociado', integerOption('--ar'))
53
+ .option('--ac <atajo>', 'atajo del comprobante asociado, por ejemplo fc o fa')
54
+ .option('--acuit <numero>', 'CUIT del comprobante asociado; en NC/ND FCE por defecto el CUIT emisor', cuitOption('--acuit'))
55
+ .option('--periodo-desde <fecha>', 'inicio del período asociado; alternativa a --ac en notas comunes (alias: --pd)')
56
+ .option('--pd <fecha>', 'alias de inicio del período asociado')
57
+ .option('--periodo-hasta <fecha>', 'fin del período asociado; alternativa a --ac en notas comunes (alias: --ph)')
58
+ .option('--ph <fecha>', 'alias de fin del período asociado')
59
59
  .option('--afecha <fecha>', 'fecha del comprobante asociado; obligatoria en NC/ND FCE')
60
60
  .option('--cbu <cbu>', 'CBU del emisor para facturas FCE (22 digitos)')
61
61
  .option('--alias <alias>', 'alias del CBU del emisor para facturas FCE')
62
62
  .option('--transferencia <modalidad>', 'modalidad de transferencia FCE: sca o adc (por defecto sca)')
63
- .option('--anulacion', 'NC/ND FCE de anulacion (la factura asociada fue rechazada por el comprador)')
64
- .option('--exportar-pdf', 'generar el PDF del comprobante emitido, aunque la config diga otra cosa')
63
+ .option('--anulacion', 'NC/ND FCE de anulación (la factura asociada fue rechazada por el comprador)')
64
+ .option('--exportar-pdf', 'generar el PDF del comprobante emitido, aunque la config diga otra cosa (alias: --pdf)')
65
65
  .option('--pdf', 'alias de --exportar-pdf')
66
66
  .option('--sin-pdf', 'no generar el PDF, aunque la config diga otra cosa')
67
- .option('--descripcion <texto>', 'detalle del comprobante en el PDF; por defecto "Segun detalle"')
68
- .option('--receptor-nombre <texto>', 'nombre o razon social del receptor en el PDF')
67
+ .option('--descripcion <texto>', 'detalle del comprobante en el PDF; por defecto "Según detalle"')
68
+ .option('--receptor-nombre <texto>', 'nombre o razón social del receptor en el PDF')
69
69
  .option('--receptor-domicilio <texto>', 'domicilio del receptor en el PDF')
70
70
  .option('--previsualizar', 'mostrar el payload antes de emitir en ARCA')
71
71
  .addOption(new Option('--emitir', 'emitir realmente en ARCA'));
72
72
  }
73
- //# sourceMappingURL=billing.command.options.js.map
73
+ /** Alias de otra opcion: se mencionan en la descripcion de la principal y no ocupan un renglon propio. */
74
+ const ALIAS_FLAGS = new Set([
75
+ '--asociado-punto-venta',
76
+ '--cfinal',
77
+ '--cm',
78
+ '--ir',
79
+ '--mda',
80
+ '--pd',
81
+ '--pdf',
82
+ '--ph',
83
+ '--pv',
84
+ '--sd',
85
+ '--sh',
86
+ '--vto',
87
+ ]);
88
+ const OPTION_APPLIES = {
89
+ '--alicuota': (scope) => scope.letters.some((letter) => letter !== 'c'),
90
+ '--exento': (scope) => scope.letters.some((letter) => letter !== 'c'),
91
+ '--nogravado': (scope) => scope.letters.some((letter) => letter !== 'c'),
92
+ '--at': (scope) => scope.isNote,
93
+ '--apv': (scope) => scope.isNote,
94
+ '--ar': (scope) => scope.isNote,
95
+ '--ac': (scope) => scope.isNote,
96
+ '--acuit': (scope) => scope.isNote,
97
+ '--afecha': (scope) => scope.isNote,
98
+ '--periodo-desde': (scope) => scope.isNote && !scope.isElectronicCredit,
99
+ '--periodo-hasta': (scope) => scope.isNote && !scope.isElectronicCredit,
100
+ '--cbu': (scope) => scope.isElectronicCredit && !scope.isNote,
101
+ '--alias': (scope) => scope.isElectronicCredit && !scope.isNote,
102
+ '--transferencia': (scope) => scope.isElectronicCredit && !scope.isNote,
103
+ '--anulacion': (scope) => scope.isElectronicCredit && scope.isNote,
104
+ };
105
+ /**
106
+ * Saca de la ayuda los alias y lo que no aplica a estos comprobantes. Solo se ocultan: siguen aceptandose y,
107
+ * si no aplican, la validacion de siempre explica por que.
108
+ */
109
+ export function hideInapplicableBillingOptions(command, scope) {
110
+ for (const option of command.options) {
111
+ const flag = option.long ?? '';
112
+ const applies = OPTION_APPLIES[flag];
113
+ if (ALIAS_FLAGS.has(flag) || (applies && !applies(scope))) {
114
+ option.hideHelp();
115
+ }
116
+ }
117
+ }
@@ -8,7 +8,7 @@ export function formatBillingOutputs(results, options) {
8
8
  previewShown: options.previewShown,
9
9
  raw: options.raw,
10
10
  });
11
- if (results.length === 1) {
11
+ if (results.length === 1 && !options.batch) {
12
12
  return output;
13
13
  }
14
14
  return [`Lote ${index + 1}/${results.length}`, output].join('\n');
@@ -17,7 +17,7 @@ export function formatBillingOutputs(results, options) {
17
17
  }
18
18
  export function writeBillingCommandResults(results, options) {
19
19
  if (options.outputJson) {
20
- if (results.length === 1) {
20
+ if (results.length === 1 && !options.batch) {
21
21
  writeTerminalJson(formatBillingResultAsJson(results[0], { raw: options.raw }));
22
22
  return;
23
23
  }
@@ -25,6 +25,7 @@ export function writeBillingCommandResults(results, options) {
25
25
  return;
26
26
  }
27
27
  writeTerminalOutput(formatBillingOutputs(results, {
28
+ batch: options.batch,
28
29
  environment: options.environment,
29
30
  previewShown: options.previewShown,
30
31
  raw: options.raw,
@@ -44,4 +45,3 @@ export function writePdfOutcomes(before, after) {
44
45
  writeTerminalOutput(blocks.join('\n'));
45
46
  }
46
47
  }
47
- //# sourceMappingURL=billing.command.output.js.map
@@ -4,6 +4,7 @@ import { readJsonFile } from '../../lib/files/read-json-file.js';
4
4
  import { parseArgentineAmount } from '../../lib/numbers/argentine-amount.js';
5
5
  import { BatchValidationError, describeBatchItemError } from '../../modules/billing/billing.batch.js';
6
6
  import { isForeignCurrency } from '../../modules/billing/billing.currency.js';
7
+ import { parseBillingJsonInput, readBillingJsonItems, } from '../../modules/billing/billing.json-input.js';
7
8
  import { billingCommandSchema } from '../../modules/billing/billing.schemas.js';
8
9
  import { getVoucherKindByShortcut } from '../../modules/billing/voucher-kind-map.js';
9
10
  import { resolveConceptShortcut, resolveDocumentIdentity, resolveIvaShortcut } from './billing.command.shortcuts.js';
@@ -17,7 +18,7 @@ function pickNumber(...values) {
17
18
  function parseRateAmount(flagValue, raw) {
18
19
  const result = parseArgentineAmount(raw);
19
20
  if (!result.ok) {
20
- throw new InputValidationError(`--alicuota "${flagValue}": el monto no es valido: ${result.reason}.`);
21
+ throw new InputValidationError(`--alicuota "${flagValue}": el monto no es válido: ${result.reason}.`);
21
22
  }
22
23
  return result.value;
23
24
  }
@@ -32,12 +33,12 @@ function parseIvaRateFlags(values) {
32
33
  const withAmount = values.filter((value) => value.includes(':'));
33
34
  if (withAmount.length === 0) {
34
35
  if (values.length > 1) {
35
- throw new InputValidationError('Para varias alicuotas use --alicuota TASA:MONTO en cada una, por ejemplo --alicuota general:1210 --alicuota reducida:552,50.');
36
+ throw new InputValidationError('Para varias alícuotas usá --alicuota TASA:MONTO en cada una, por ejemplo --alicuota general:1210 --alicuota reducida:552,50.');
36
37
  }
37
38
  return { ivaRate: values[0] };
38
39
  }
39
40
  if (withAmount.length !== values.length) {
40
- throw new InputValidationError('No mezcle --alicuota TASA con --alicuota TASA:MONTO: use una sola forma.');
41
+ throw new InputValidationError('No mezcles --alicuota TASA con --alicuota TASA:MONTO: usá una sola forma.');
41
42
  }
42
43
  return {
43
44
  ivaRateAmounts: values.map((value) => {
@@ -60,13 +61,13 @@ function sumRateAmounts(rateAmounts, exemptAmount, untaxedAmount) {
60
61
  */
61
62
  function resolveShouldEmit(options) {
62
63
  if (options.cliEmit && options.cliPreview) {
63
- throw new InputValidationError('Use --emitir o --previsualizar, pero no ambos a la vez.');
64
+ throw new InputValidationError('Usá --emitir o --previsualizar, pero no ambos a la vez.');
64
65
  }
65
66
  if (options.cliEmit !== undefined || options.cliPreview !== undefined) {
66
67
  return options.cliEmit === true;
67
68
  }
68
69
  if (options.fileEmit === true && options.filePreview === true) {
69
- throw new InputValidationError('En el archivo use "emitir" o "previsualizar", pero no ambos en true.');
70
+ throw new InputValidationError('En el archivo usá "emitir" o "previsualizar", pero no ambos en true.');
70
71
  }
71
72
  if (typeof options.fileEmit === 'boolean') {
72
73
  return options.fileEmit;
@@ -80,7 +81,7 @@ function resolveShouldEmit(options) {
80
81
  function resolvePdfFlag(commandOptions, fileInput) {
81
82
  const exportPdf = commandOptions.exportarPdf === true || commandOptions.pdf === true;
82
83
  if (exportPdf && commandOptions.sinPdf === true) {
83
- throw new InputValidationError('Use --exportar-pdf o --sin-pdf, pero no ambos a la vez.');
84
+ throw new InputValidationError('Usá --exportar-pdf o --sin-pdf, pero no ambos a la vez.');
84
85
  }
85
86
  if (exportPdf) {
86
87
  return true;
@@ -94,7 +95,7 @@ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaul
94
95
  const hasAssociatedShortcut = typeof commandOptions.ac === 'string';
95
96
  const hasAssociatedType = typeof commandOptions.at === 'number';
96
97
  if (hasAssociatedShortcut && hasAssociatedType) {
97
- throw new InputValidationError('Use --ac o --at para identificar el comprobante asociado, pero no ambos a la vez.');
98
+ throw new InputValidationError('Usá --ac o --at para identificar el comprobante asociado, pero no ambos a la vez.');
98
99
  }
99
100
  const associatedVoucherFromFlags = commandOptions.ar ||
100
101
  commandOptions.apv ||
@@ -128,24 +129,31 @@ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaul
128
129
  const documentIdentity = resolveDocumentIdentity(commandOptions);
129
130
  const ivaShortcut = resolveIvaShortcut(commandOptions);
130
131
  const resolvedConcept = pickString(commandOptions.concepto) ?? conceptShortcut ?? fileInput?.concepto ?? defaults.defaultConcept;
131
- const resolvedIvaCondition = pickString(commandOptions.ivaReceptor, commandOptions.ir) ??
132
- ivaShortcut ??
133
- fileInput?.ivaReceptor ??
134
- defaults.defaultIvaCondition;
132
+ const explicitIvaCondition = pickString(commandOptions.ivaReceptor, commandOptions.ir) ?? ivaShortcut ?? fileInput?.ivaReceptor;
133
+ const documentType = documentIdentity.documentType ?? fileInput?.tipoDocumento;
134
+ const willLookupPadron = !explicitIvaCondition && defaults.lookupIvaConditionInPadron === true && documentType === 'cuit';
135
+ const resolvedIvaCondition = explicitIvaCondition ?? defaults.defaultIvaCondition;
136
+ // Sin definir es explicito: asi la entrada que arma el parser es igual a la del modo interactivo. Con
137
+ // consultarPadron=false el IVA de la config tambien es definitivo: 'default' haria consultar el padron igual.
138
+ const ivaConditionSource = explicitIvaCondition || (resolvedIvaCondition && defaults.lookupIvaConditionInPadron !== true)
139
+ ? undefined
140
+ : resolvedIvaCondition
141
+ ? 'default'
142
+ : 'missing';
135
143
  if (typeof commandOptions.concepto === 'string' && conceptShortcut) {
136
- throw new InputValidationError('Use --concepto o un flag corto de concepto (--cs, --cp, --csp), pero no ambos.');
144
+ throw new InputValidationError('Usá --concepto o un flag corto de concepto (--cs, --cp, --csp), pero no ambos.');
137
145
  }
138
146
  if (typeof commandOptions.ivaReceptor === 'string' && typeof commandOptions.ir === 'string') {
139
- throw new InputValidationError('Use --iva-receptor o --ir para indicar IVA receptor, pero no ambos.');
147
+ throw new InputValidationError('Usá --iva-receptor o --ir para indicar IVA receptor, pero no ambos.');
140
148
  }
141
149
  if ((typeof commandOptions.ivaReceptor === 'string' || typeof commandOptions.ir === 'string') && ivaShortcut) {
142
- throw new InputValidationError('Use --iva-receptor, --ir o un flag corto --ir-*, pero no varios a la vez.');
150
+ throw new InputValidationError('Usá --iva-receptor, --ir o un flag corto --ir-*, pero no varios a la vez.');
143
151
  }
144
152
  if (!resolvedConcept) {
145
- throw new InputValidationError('Falta el concepto. Use --concepto <tipo>, o bien --cs/--cp/--csp, o configure uno por defecto con "arcli config establecer concepto servicios".');
153
+ throw new InputValidationError('Falta el concepto. Usá --concepto <tipo>, o bien --cs/--cp/--csp, o configurá uno por defecto con "arcli config establecer concepto servicios".');
146
154
  }
147
- if (!resolvedIvaCondition) {
148
- throw new InputValidationError('Falta IVA receptor. Use --iva-receptor <tipo>, --ir <tipo>, un flag --ir-*, o configure uno por defecto con "arcli config establecer ivaReceptor consumidor-final".');
155
+ if (!resolvedIvaCondition && !willLookupPadron) {
156
+ throw new InputValidationError('Falta IVA receptor. Usá --iva-receptor <tipo>, --ir <tipo>, un flag --ir-*, o configurá uno por defecto con "arcli config establecer ivaReceptor consumidor-final".');
149
157
  }
150
158
  const associatedVoucherFromFile = fileInput?.comprobanteAsociado
151
159
  ? {
@@ -164,7 +172,7 @@ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaul
164
172
  const sameCurrency = flagSameCurrency || (flagExchangeRate === undefined && fileInput?.mismaMoneda === true);
165
173
  const explicitExchangeRate = flagExchangeRate ?? (flagSameCurrency ? undefined : fileInput?.cotizacionMoneda);
166
174
  if (sameCurrency && typeof explicitExchangeRate === 'number') {
167
- throw new InputValidationError('Con --misma-moneda la cotizacion se toma de ARCA. Quite --cotizacion-moneda o --cm.');
175
+ throw new InputValidationError('Con --misma-moneda la cotización se toma de ARCA. Sacá --cotizacion-moneda o --cm.');
168
176
  }
169
177
  // La cotizacion por defecto de la config solo aplica a moneda extranjera sin --misma-moneda.
170
178
  const exchangeRate = explicitExchangeRate ??
@@ -197,7 +205,7 @@ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaul
197
205
  concept: resolvedConcept,
198
206
  currencyCode,
199
207
  documentNumber: documentIdentity.documentNumber ?? fileInput?.numeroDocumento,
200
- documentType: documentIdentity.documentType ?? fileInput?.tipoDocumento,
208
+ documentType,
201
209
  dryRun: !shouldEmit,
202
210
  dueDay: pickNumber(commandOptions.dia, fileInput?.dia),
203
211
  emit: shouldEmit,
@@ -207,7 +215,9 @@ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaul
207
215
  ? undefined
208
216
  : (flagRates.ivaRate ?? fileInput?.alicuotaIva ?? (usesIvaRateDefault ? defaults.defaultIvaRate : undefined)),
209
217
  ivaRateAmounts,
210
- ivaCondition: resolvedIvaCondition,
218
+ // Sin valor todavia: lo completa el padron antes de emitir (ver `ivaConditionSource`).
219
+ ivaCondition: resolvedIvaCondition ?? 'consumidor-final',
220
+ ivaConditionSource,
211
221
  paymentDueDate: pickString(commandOptions.vencimiento, commandOptions.vto, fileInput?.vencimientoPago),
212
222
  pdf: resolvePdfFlag(commandOptions, fileInput),
213
223
  pdfDescription: pickString(commandOptions.descripcion, fileInput?.descripcion),
@@ -218,7 +228,8 @@ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaul
218
228
  serviceEndDate: pickString(commandOptions.servicioHasta, commandOptions.sh, fileInput?.servicioHasta),
219
229
  serviceStartDate: pickString(commandOptions.servicioDesde, commandOptions.sd, fileInput?.servicioDesde),
220
230
  shortcut,
221
- totalAmount: totalAmount === undefined ? undefined : Math.round(totalAmount * 100) / 100,
231
+ // Sin redondear: un monto con mas de 2 decimales es un error del schema, no se ajusta en silencio.
232
+ totalAmount,
222
233
  transferMode: pickString(commandOptions.transferencia, fileInput?.transferencia),
223
234
  untaxedAmount,
224
235
  }),
@@ -228,30 +239,33 @@ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaul
228
239
  export function parseBillingCommandPlan(command, shortcut, defaults = {}) {
229
240
  const commandOptions = command.optsWithGlobals();
230
241
  const inputFilePath = typeof commandOptions.cargar === 'string' ? commandOptions.cargar : undefined;
231
- const fileInputSource = inputFilePath ? readJsonFile(inputFilePath) : undefined;
232
- const fileInputs = Array.isArray(fileInputSource) ? fileInputSource : [fileInputSource].filter(Boolean);
242
+ // Se lee sin asumir la forma: cada item se valida con `parseBillingJsonInput` (en un lote, por separado).
243
+ const source = inputFilePath ? readJsonFile(inputFilePath) : undefined;
244
+ const fileInputs = inputFilePath ? readBillingJsonItems(source) : [];
245
+ const isBatch = Array.isArray(source);
233
246
  if (fileInputs.length === 0) {
234
247
  const { __modeSource, ...input } = parseBillingCommandInputFromSource(command, shortcut, undefined, defaults);
235
248
  return {
236
249
  inputIndexes: [1],
237
250
  inputs: [input],
238
251
  invalidItems: [],
252
+ isBatch: false,
239
253
  modeSource: __modeSource,
240
254
  total: 1,
241
255
  };
242
256
  }
243
- // Un solo comprobante falla como siempre. En un lote se leen todos y se juntan los errores,
244
- // para informarlos de una vez en lugar de cortar en el primero.
245
- if (fileInputs.length === 1) {
246
- const { __modeSource, ...input } = parseBillingCommandInputFromSource(command, shortcut, fileInputs[0], defaults);
247
- return { inputIndexes: [1], inputs: [input], invalidItems: [], modeSource: __modeSource, total: 1 };
257
+ // Un objeto suelto falla como siempre. En un lote (un array, aunque tenga un solo elemento) se leen todos
258
+ // y se juntan los errores, para informarlos de una vez en lugar de cortar en el primero.
259
+ if (!isBatch) {
260
+ const { __modeSource, ...input } = parseBillingCommandInputFromSource(command, shortcut, parseBillingJsonInput(fileInputs[0]), defaults);
261
+ return { inputIndexes: [1], inputs: [input], invalidItems: [], isBatch: false, modeSource: __modeSource, total: 1 };
248
262
  }
249
263
  const parsed = [];
250
264
  const inputIndexes = [];
251
265
  const invalidItems = [];
252
266
  fileInputs.forEach((fileInput, position) => {
253
267
  try {
254
- parsed.push(parseBillingCommandInputFromSource(command, shortcut, fileInput, defaults));
268
+ parsed.push(parseBillingCommandInputFromSource(command, shortcut, parseBillingJsonInput(fileInput), defaults));
255
269
  inputIndexes.push(position + 1);
256
270
  }
257
271
  catch (error) {
@@ -267,6 +281,7 @@ export function parseBillingCommandPlan(command, shortcut, defaults = {}) {
267
281
  inputIndexes,
268
282
  inputs: parsed.map(({ __modeSource: _modeSource, ...input }) => input),
269
283
  invalidItems,
284
+ isBatch: true,
270
285
  modeSource,
271
286
  total: fileInputs.length,
272
287
  };
@@ -281,4 +296,3 @@ export function parseBillingCommandInputs(command, shortcut, defaults = {}) {
281
296
  export function parseBillingCommandInput(command, shortcut, defaults = {}) {
282
297
  return parseBillingCommandInputs(command, shortcut, defaults)[0];
283
298
  }
284
- //# sourceMappingURL=billing.command.parser.js.map
@@ -29,8 +29,12 @@ export const defaultPdfStepDependencies = {
29
29
  }
30
30
  },
31
31
  };
32
+ /** Datos que solo van en el PDF y pasó quien factura; lo que completó el padrón no cuenta. */
32
33
  function hasPdfOnlyData(input) {
33
- return Boolean(input?.pdfDescription || input?.receiverName || input?.receiverAddress);
34
+ const fromPadron = input?.receiverFromPadron ?? [];
35
+ return Boolean(input?.pdfDescription ||
36
+ (input?.receiverName && !fromPadron.includes('name')) ||
37
+ (input?.receiverAddress && !fromPadron.includes('address')));
34
38
  }
35
39
  async function resolveDecisions(options, deps) {
36
40
  const decisions = options.results.map((result, index) => canHavePdf(result)
@@ -44,13 +48,13 @@ async function resolveDecisions(options, deps) {
44
48
  if (pending === 0) {
45
49
  return decisions;
46
50
  }
47
- const answer = await deps.confirm(pending === 1 ? '¿Generamos el PDF del comprobante?' : `¿Generamos los PDFs de los ${pending} comprobantes?`, pending === 1 ? 'Si, generar el PDF' : 'Si, generar los PDFs', 'No');
51
+ const answer = await deps.confirm(pending === 1 ? '¿Generamos el PDF del comprobante?' : `¿Generamos los PDFs de los ${pending} comprobantes?`, pending === 1 ? 'Sí, generar el PDF' : 'Sí, generar los PDFs', 'No');
48
52
  return decisions.map((decision) => (decision === 'preguntar' ? (answer ? 'generar' : 'omitir') : decision));
49
53
  }
50
54
  /** Si falta el plugin, en una terminal se ofrece instalarlo; sin terminal nunca se descarga solo. */
51
- async function loadRenderer(plugin, interactive, deps) {
55
+ export async function loadPdfRenderer(plugin, interactive, deps) {
52
56
  if (!plugin.getStatus().installed && interactive) {
53
- const install = await deps.confirm('Para generar PDFs hay que descargar un componente (~160 MB, o ~360 MB si no tenes Chrome). ¿Instalarlo ahora?', 'Si, instalar', 'No');
57
+ const install = await deps.confirm('Para generar PDFs hay que descargar un componente (~160 MB, o ~360 MB si no tenés Chrome). ¿Instalarlo ahora?', 'Sí, instalar', 'No');
54
58
  if (!install) {
55
59
  throw new PdfError('PDF_PLUGIN_MISSING', 'No se instalo el plugin de PDF.', {
56
60
  suggestion: PDF_INSTALL_SUGGESTION,
@@ -97,7 +101,7 @@ export async function attachPdfs(options, defaultDeps = defaultPdfStepDependenci
97
101
  try {
98
102
  // Antes de descargar nada: sin los datos del emisor no se puede armar ningun PDF.
99
103
  resolvePdfIssuer(options.config, options.results[targets[0]].voucherKind.letter);
100
- const renderer = await loadRenderer(deps.createPlugin(options.config), options.interactive, deps);
104
+ const renderer = await loadPdfRenderer(deps.createPlugin(options.config), options.interactive, deps);
101
105
  const folder = deps.resolveFolder(options.config);
102
106
  for (const index of targets) {
103
107
  const spinner = startSpinner('Generando PDF...');
@@ -142,4 +146,3 @@ export async function attachPdfs(options, defaultDeps = defaultPdfStepDependenci
142
146
  return result;
143
147
  });
144
148
  }
145
- //# sourceMappingURL=billing.command.pdf.js.map
@@ -2,27 +2,60 @@ import { BillingService } from '../../modules/billing/billing.service.js';
2
2
  import { getVoucherKindByShortcut } from '../../modules/billing/voucher-kind-map.js';
3
3
  import { ArcaBillingGateway } from '../../services/arca/arca-billing.gateway.js';
4
4
  import { ArcaClientFactory } from '../../services/arca/arca-client.factory.js';
5
- import { ArcaContextResolver } from '../../services/arca/arca-context.resolver.js';
6
5
  import { ArcaFceObligationGateway } from '../../services/arca/arca-fce-obligation.gateway.js';
6
+ import { ArcaPadronGateway } from '../../services/arca/arca-padron.gateway.js';
7
+ import { certificateWarnings, resolveArcaRuntime } from '../arca-runtime.js';
8
+ import { getGlobalOptions, registerGlobalOptions } from '../global-options.js';
7
9
  import { startSpinner } from '../spinner.js';
8
- import { emitBatch, validateBatchBeforeEmitting } from './billing.command.batch.js';
10
+ import { emitBatch, prepareBatch } from './billing.command.batch.js';
9
11
  import { runInteractiveBillingPreview } from './billing.command.interactive-preview.js';
10
12
  import { writeBillingCommandResults, writePdfOutcomes } from './billing.command.output.js';
11
13
  import { parseBillingCommandPlan, registerBillingOptions } from './billing.command.parser.js';
12
14
  import { attachPdfs } from './billing.command.pdf.js';
13
- export function registerGlobalOptions(command) {
14
- command
15
- .option('--testing', 'usar entorno de testing en esta ejecucion')
16
- .option('--produccion', 'usar entorno de produccion en esta ejecucion')
17
- .option('--json', 'imprimir salida JSON')
18
- .option('--bruto', 'mostrar la respuesta bruta de ARCA cuando exista');
15
+ /** Exit code cuando ARCA rechaza algun comprobante: la operacion corrio bien, pero no hay CAE. */
16
+ export const REJECTED_EXIT_CODE = 2;
17
+ /** 2 si ARCA rechazo alguno de los comprobantes emitidos; si no, no se toca (queda en 0). */
18
+ export function setExitCodeForResults(results) {
19
+ if (results.some((result) => !result.dryRun && result.response.status === 'rechazado')) {
20
+ process.exitCode = REJECTED_EXIT_CODE;
21
+ }
19
22
  }
20
23
  export function registerBillingCommandOptions(command) {
21
24
  registerGlobalOptions(command);
22
25
  registerBillingOptions(command);
23
26
  }
24
- export function getGlobalOptions(command) {
25
- return command.optsWithGlobals();
27
+ /** Los defaults de la config que completan lo que no viene por flags ni por JSON. */
28
+ export function resolveBillingCommandDefaults(config) {
29
+ return {
30
+ defaultCbu: config.cbu,
31
+ defaultCbuAlias: config.aliasCbu,
32
+ defaultConcept: config.conceptoPorDefecto,
33
+ defaultCurrencyCode: config.monedaPorDefecto,
34
+ defaultEmit: config.output.emitirPorDefecto,
35
+ defaultExchangeRate: config.cotizacionPorDefecto,
36
+ defaultIvaCondition: config.ivaReceptorPorDefecto,
37
+ defaultIvaRate: config.alicuotaPorDefecto,
38
+ lookupIvaConditionInPadron: config.consultarPadron !== false,
39
+ };
40
+ }
41
+ /**
42
+ * Imprime los resultados con su PDF, segun la config `pdf` o `--exportar-pdf`. Se usa con el lote completo y
43
+ * con los ya emitidos de un lote que se corto: esos tambien tienen CAE y merecen su PDF.
44
+ */
45
+ export async function writeResultsWithPdfs(results, options) {
46
+ const pdfOptions = {
47
+ config: options.config,
48
+ inputs: options.inputs.slice(0, results.length),
49
+ interactive: options.interactive,
50
+ results,
51
+ };
52
+ // En JSON el PDF va dentro del mismo resultado; en texto primero se ve el CAE y despues se pregunta.
53
+ if (options.output.outputJson) {
54
+ writeBillingCommandResults(await attachPdfs(pdfOptions), options.output);
55
+ return;
56
+ }
57
+ writeBillingCommandResults(results, options.output);
58
+ writePdfOutcomes(results, await attachPdfs(pdfOptions));
26
59
  }
27
60
  async function resolveFceWarnings(inputs, service, gateway) {
28
61
  const warnings = [];
@@ -32,34 +65,44 @@ async function resolveFceWarnings(inputs, service, gateway) {
32
65
  }
33
66
  return warnings;
34
67
  }
35
- export async function executeBillingCommand(command, shortcut) {
68
+ export async function executeBillingCommand(command, shortcut, options = {}) {
36
69
  const globalOptions = getGlobalOptions(command);
37
70
  let spinner = null;
38
71
  const voucherKind = getVoucherKindByShortcut(shortcut);
39
72
  try {
40
- const runtime = new ArcaContextResolver({ options: globalOptions }).resolve();
41
- const plan = parseBillingCommandPlan(command, shortcut, {
42
- defaultCbu: runtime.config.cbu,
43
- defaultCbuAlias: runtime.config.aliasCbu,
44
- defaultConcept: runtime.config.conceptoPorDefecto,
45
- defaultCurrencyCode: runtime.config.monedaPorDefecto,
46
- defaultEmit: runtime.config.output.emitirPorDefecto,
47
- defaultExchangeRate: runtime.config.cotizacionPorDefecto,
48
- defaultIvaCondition: runtime.config.ivaReceptorPorDefecto,
49
- defaultIvaRate: runtime.config.alicuotaPorDefecto,
50
- });
73
+ const runtime = resolveArcaRuntime(globalOptions);
74
+ const plan = parseBillingCommandPlan(command, shortcut, resolveBillingCommandDefaults(runtime.config));
51
75
  const service = new BillingService();
52
76
  const arca = new ArcaClientFactory().create(runtime);
53
77
  const gateway = new ArcaBillingGateway(arca);
54
78
  const useRaw = typeof globalOptions.bruto === 'boolean' ? globalOptions.bruto : runtime.outputRaw;
55
- const plannedInputs = [];
56
- for (const input of plan.inputs) {
57
- plannedInputs.push(await service.resolveExchangeRate(input, gateway));
58
- }
59
- validateBatchBeforeEmitting(plan, plannedInputs, (input) => service.buildVoucherPayload(input, runtime));
60
- const warnings = runtime.config.verificarFce
79
+ const padronGateway = new ArcaPadronGateway(arca);
80
+ // En un lote, un fallo del padron o de la cotizacion sale con su indice, junto a los de validacion.
81
+ const prepared = await prepareBatch({
82
+ inputs: plan.inputs,
83
+ plan,
84
+ resolve: async (input) => {
85
+ const resolution = await service.resolveIvaConditionFromPadron(input, padronGateway);
86
+ return {
87
+ input: await service.resolveExchangeRate(resolution.input, gateway),
88
+ warnings: resolution.warnings,
89
+ };
90
+ },
91
+ validate: ({ input }) => {
92
+ service.buildVoucherPayload(input, runtime);
93
+ },
94
+ });
95
+ const plannedInputs = prepared.map(({ input }) => input);
96
+ const padronWarnings = prepared.map(({ warnings }) => warnings);
97
+ const fceWarnings = runtime.config.verificarFce
61
98
  ? await resolveFceWarnings(plannedInputs, service, new ArcaFceObligationGateway(arca))
62
99
  : [];
100
+ const warnings = plannedInputs.map((_input, position) => [
101
+ ...certificateWarnings(runtime),
102
+ ...(options.extraWarnings ?? []),
103
+ ...(padronWarnings[position] ?? []),
104
+ ...(fceWarnings[position] ?? []),
105
+ ]);
63
106
  const preview = await runInteractiveBillingPreview({
64
107
  inputs: plannedInputs,
65
108
  modeSource: plan.modeSource,
@@ -77,39 +120,33 @@ export async function executeBillingCommand(command, shortcut) {
77
120
  if (spinner) {
78
121
  spinner.text = inputs.length > 1 ? `Procesando ${inputs.length} comprobantes...` : 'Procesando comprobante...';
79
122
  }
80
- const outputOptions = {
81
- environment: runtime.environment,
82
- outputJson: runtime.outputJson,
83
- previewShown,
84
- raw: useRaw,
123
+ const deliveryOptions = {
124
+ config: runtime.config,
125
+ inputs,
126
+ interactive: !runtime.outputJson && Boolean(process.stdin.isTTY && process.stdout.isTTY),
127
+ output: {
128
+ batch: plan.isBatch,
129
+ environment: runtime.environment,
130
+ outputJson: runtime.outputJson,
131
+ previewShown,
132
+ raw: useRaw,
133
+ },
85
134
  };
86
135
  const results = await emitBatch({
87
136
  emit: (input, position) => service.execute({ gateway, input, runtime, warnings: warnings[position] }),
88
137
  inputs,
89
- onPartialResults: (partial) => {
138
+ onPartialResults: async (partial) => {
90
139
  spinner?.stop();
91
- writeBillingCommandResults(partial, outputOptions);
140
+ await writeResultsWithPdfs(partial, deliveryOptions);
92
141
  },
93
142
  plan,
94
143
  });
95
144
  spinner?.stop();
96
- const pdfOptions = {
97
- config: runtime.config,
98
- inputs,
99
- interactive: !runtime.outputJson && Boolean(process.stdin.isTTY && process.stdout.isTTY),
100
- results,
101
- };
102
- // En JSON el PDF va dentro del mismo resultado; en texto primero se ve el CAE y despues se pregunta.
103
- if (runtime.outputJson) {
104
- writeBillingCommandResults(await attachPdfs(pdfOptions), outputOptions);
105
- return;
106
- }
107
- writeBillingCommandResults(results, outputOptions);
108
- writePdfOutcomes(results, await attachPdfs(pdfOptions));
145
+ setExitCodeForResults(results);
146
+ await writeResultsWithPdfs(results, deliveryOptions);
109
147
  }
110
148
  catch (error) {
111
149
  spinner?.stop();
112
150
  throw error;
113
151
  }
114
152
  }
115
- //# sourceMappingURL=billing.command.shared.js.map