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
@@ -0,0 +1,92 @@
1
+ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
2
+ import { basename, dirname, join } from 'node:path';
3
+ import { COMPLETION_SHELLS } from './shell-scripts.js';
4
+ /** Marca lo que agrega arcli, para reconocerlo y sacarlo despues sin tocar nada mas. */
5
+ const MARKER = '# arcli: autocompletado con Tab (se saca con "arcli completado desinstalar")';
6
+ export function currentCompletionEnvironment() {
7
+ return {
8
+ home: process.env.HOME ?? '',
9
+ platform: process.platform,
10
+ shell: process.env.SHELL,
11
+ xdgConfigHome: process.env.XDG_CONFIG_HOME,
12
+ zdotdir: process.env.ZDOTDIR,
13
+ };
14
+ }
15
+ /** El shell de `$SHELL`, si es uno que arcli sabe completar. */
16
+ export function detectShell(shellPath) {
17
+ const name = shellPath ? basename(shellPath) : '';
18
+ return COMPLETION_SHELLS.find((shell) => shell === name);
19
+ }
20
+ /** Donde va el autocompletado: la linea en el rc de bash o zsh, o un archivo propio en fish. */
21
+ export function resolveCompletionPath(shell, environment) {
22
+ if (shell === 'fish') {
23
+ return join(environment.xdgConfigHome ?? join(environment.home, '.config'), 'fish', 'completions', 'arcli.fish');
24
+ }
25
+ if (shell === 'zsh') {
26
+ return join(environment.zdotdir ?? environment.home, '.zshrc');
27
+ }
28
+ if (environment.platform !== 'darwin') {
29
+ return join(environment.home, '.bashrc');
30
+ }
31
+ // La Terminal de macOS abre bash como login shell: lee el primero que exista de estos. Crear .bash_profile
32
+ // cuando solo hay .profile haria que bash deje de leer .profile.
33
+ const loginFiles = ['.bash_profile', '.bash_login', '.profile'].map((name) => join(environment.home, name));
34
+ return loginFiles.find((path) => existsSync(path)) ?? loginFiles[0];
35
+ }
36
+ function activationLine(shell) {
37
+ return shell === 'fish'
38
+ ? 'arcli completado fish | source'
39
+ : `command -v arcli >/dev/null 2>&1 && eval "$(arcli completado ${shell})"`;
40
+ }
41
+ function readText(path) {
42
+ return existsSync(path) ? readFileSync(path, 'utf8') : '';
43
+ }
44
+ /** Lo agrego arcli o se agrego a mano: cualquier linea que active `arcli completado <shell>`. */
45
+ function isActivationLine(line, shell) {
46
+ return line === MARKER || line.includes(`arcli completado ${shell}`);
47
+ }
48
+ export function getCompletionState(shell, environment) {
49
+ const path = resolveCompletionPath(shell, environment);
50
+ const installed = readText(path)
51
+ .split('\n')
52
+ .some((line) => line !== MARKER && isActivationLine(line, shell) && !line.trimStart().startsWith('#'));
53
+ return { installed, path, shell };
54
+ }
55
+ export function installCompletion(shell, environment) {
56
+ const state = getCompletionState(shell, environment);
57
+ if (state.installed) {
58
+ return { ...state, changed: false };
59
+ }
60
+ const block = `${MARKER}\n${activationLine(shell)}\n`;
61
+ mkdirSync(dirname(state.path), { recursive: true });
62
+ if (shell === 'fish') {
63
+ writeFileSync(state.path, block);
64
+ }
65
+ else {
66
+ const current = readText(state.path);
67
+ const separator = current === '' ? '' : current.endsWith('\n') ? '\n' : '\n\n';
68
+ writeFileSync(state.path, `${current}${separator}${block}`);
69
+ }
70
+ return { ...state, changed: true, installed: true };
71
+ }
72
+ export function uninstallCompletion(shell, environment) {
73
+ const state = getCompletionState(shell, environment);
74
+ const current = readText(state.path);
75
+ if (!current.includes(MARKER) && !state.installed) {
76
+ return { ...state, changed: false };
77
+ }
78
+ if (shell === 'fish') {
79
+ rmSync(state.path, { force: true });
80
+ return { ...state, changed: true, installed: false };
81
+ }
82
+ const lines = current.split('\n');
83
+ const kept = lines.filter((line, index) => {
84
+ if (isActivationLine(line, shell)) {
85
+ return false;
86
+ }
87
+ // La linea en blanco que se agrego antes del bloque tambien se va.
88
+ return !(line === '' && lines[index + 1] === MARKER);
89
+ });
90
+ writeFileSync(state.path, kept.join('\n'));
91
+ return { ...state, changed: true, installed: false };
92
+ }
@@ -0,0 +1,46 @@
1
+ export const COMPLETION_SHELLS = ['bash', 'zsh', 'fish'];
2
+ /** Comando oculto que el script del shell llama en cada Tab. */
3
+ export const COMPLETE_COMMAND = '__completar';
4
+ /**
5
+ * Scripts minimos: cada Tab le pregunta a `arcli __completar` que sigue, asi la lista sale siempre de la version
6
+ * instalada. Sin candidatos, el shell completa rutas de archivo (para `--cargar` y las rutas de config).
7
+ */
8
+ const SCRIPTS = {
9
+ bash: `# Autocompletado de arcli para bash. Activalo con: eval "$(arcli completado bash)"
10
+ _arcli_completar() {
11
+ # Copiadas antes de cambiar IFS: bash 3.2 (el de macOS) junta "\${arr[@]:1:n}" en una palabra si IFS cambio.
12
+ local palabras=("\${COMP_WORDS[@]:1:COMP_CWORD}")
13
+ local IFS=$'\\n'
14
+ COMPREPLY=($(arcli ${COMPLETE_COMMAND} -- "\${palabras[@]}" 2>/dev/null))
15
+ }
16
+ complete -o default -F _arcli_completar arcli
17
+ `,
18
+ fish: `# Autocompletado de arcli para fish. Activalo con: arcli completado fish | source
19
+ function __arcli_completar
20
+ set -l palabras (commandline -opc)[2..-1] (commandline -ct)
21
+ set -l candidatos (arcli ${COMPLETE_COMMAND} -- $palabras 2>/dev/null)
22
+ if test (count $candidatos) -gt 0
23
+ printf '%s\\n' $candidatos
24
+ else
25
+ __fish_complete_path (commandline -ct)
26
+ end
27
+ end
28
+ complete -c arcli -f -a '(__arcli_completar)'
29
+ `,
30
+ zsh: `# Autocompletado de arcli para zsh. Activalo con: eval "$(arcli completado zsh)"
31
+ (( $+functions[compdef] )) || { autoload -Uz compinit && compinit; }
32
+ _arcli() {
33
+ local -a candidatos
34
+ candidatos=("\${(@f)$(arcli ${COMPLETE_COMMAND} -- "\${(@)words[2,CURRENT]}" 2>/dev/null)}")
35
+ if (( \${#candidatos} )) && [[ -n "\${candidatos[1]}" ]]; then
36
+ compadd -- "\${candidatos[@]}"
37
+ else
38
+ _files
39
+ fi
40
+ }
41
+ compdef _arcli arcli
42
+ `,
43
+ };
44
+ export function buildCompletionScript(shell) {
45
+ return SCRIPTS[shell];
46
+ }
@@ -0,0 +1,90 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { formatArcaDateAsArgentineDate, formatDateAsArcaDate } from '../../lib/dates/arca-date.js';
3
+ import { AppError } from '../../lib/errors/app-error.js';
4
+ import { CERTIFICATE_GUIDE_URL } from '../../lib/links.js';
5
+ import { isCertificateExpiringSoon, readCertificateExpiry, } from '../../lib/security/certificate.js';
6
+ import { arcliEnvironmentSchema, formatEnvironmentLabel } from './config.schemas.js';
7
+ /** A menos de estos dias de vencer, el certificado se avisa en cada comando y en `config revisar`. */
8
+ export const CERTIFICATE_EXPIRY_WARNING_DAYS = 30;
9
+ /** Fecha de vencimiento como dd/mm/aaaa del dia en Argentina. */
10
+ export function formatCertificateExpiryDate(expiresAt) {
11
+ return formatArcaDateAsArgentineDate(formatDateAsArcaDate(expiresAt));
12
+ }
13
+ function formatDaysRemaining(days) {
14
+ if (days <= 0) {
15
+ return 'hoy';
16
+ }
17
+ return days === 1 ? 'en 1 día' : `en ${days} días`;
18
+ }
19
+ export function describeCertificateExpiry(expiry, environment) {
20
+ if (!expiry.isExpired && !isCertificateExpiringSoon(expiry, CERTIFICATE_EXPIRY_WARNING_DAYS)) {
21
+ return undefined;
22
+ }
23
+ const expiresOn = formatCertificateExpiryDate(expiry.expiresAt);
24
+ const status = expiry.isExpired
25
+ ? `venció el ${expiresOn}`
26
+ : `vence el ${expiresOn} (${formatDaysRemaining(expiry.daysRemaining)})`;
27
+ const summary = `El certificado de ${formatEnvironmentLabel(environment)} ${status}.`;
28
+ return {
29
+ daysRemaining: expiry.daysRemaining,
30
+ environment,
31
+ expired: expiry.isExpired,
32
+ expiresOn,
33
+ message: `${summary} Renovalo: ${CERTIFICATE_GUIDE_URL}`,
34
+ summary,
35
+ };
36
+ }
37
+ /**
38
+ * Aviso del certificado ya leido (PEM). Si no se puede leer la fecha, no hay aviso: el error de un certificado
39
+ * invalido lo informa el flujo de siempre (WSAA o `config revisar`).
40
+ */
41
+ export function inspectCertificateExpiry(pemContent, environment, now = new Date()) {
42
+ try {
43
+ return describeCertificateExpiry(readCertificateExpiry(pemContent, now), environment);
44
+ }
45
+ catch {
46
+ return undefined;
47
+ }
48
+ }
49
+ /**
50
+ * Avisos de todos los certificados configurados (testing y produccion), sin importar con cual se trabaja: quien
51
+ * factura en testing tambien tiene que enterarse de que vence el de produccion. El del entorno activo va primero.
52
+ * Un certificado sin configurar o que no se puede leer no avisa.
53
+ */
54
+ export function inspectConfiguredCertificates(certPaths, options) {
55
+ const environments = arcliEnvironmentSchema.options.filter((environment) => environment !== options.activeEnvironment);
56
+ const notices = [];
57
+ for (const environment of [options.activeEnvironment, ...environments]) {
58
+ const pem = environment === options.activeEnvironment ? options.activePem : undefined;
59
+ const content = pem ?? readCertificateQuietly(certPaths[environment]);
60
+ const notice = content === undefined ? undefined : inspectCertificateExpiry(content, environment, options.now);
61
+ if (notice) {
62
+ notices.push(notice);
63
+ }
64
+ }
65
+ return notices;
66
+ }
67
+ function readCertificateQuietly(filePath) {
68
+ if (!filePath) {
69
+ return undefined;
70
+ }
71
+ try {
72
+ return readFileSync(filePath, 'utf8');
73
+ }
74
+ catch {
75
+ return undefined;
76
+ }
77
+ }
78
+ /** Con el certificado vencido WSAA rechaza el login: se corta antes, sin ir a ARCA. */
79
+ export class CertificateExpiredError extends AppError {
80
+ notice;
81
+ constructor(notice) {
82
+ super(`El certificado de ${formatEnvironmentLabel(notice.environment)} venció el ${notice.expiresOn}: ARCA no lo acepta.`, {
83
+ code: 'CERTIFICATE_EXPIRED',
84
+ details: { entorno: notice.environment, vencimiento: notice.expiresOn },
85
+ suggestion: `Generá uno nuevo siguiendo la guía y cargalo con "arcli config establecer cert.${notice.environment} <ruta>": ${CERTIFICATE_GUIDE_URL}`,
86
+ });
87
+ this.name = 'CertificateExpiredError';
88
+ this.notice = notice;
89
+ }
90
+ }
@@ -2,7 +2,8 @@ import { CERTIFICATE_GUIDE_URL } from '../../lib/links.js';
2
2
  import { isCertificateExpiringSoon, readCertificateExpiry } from '../../lib/security/certificate.js';
3
3
  import { readPemFile } from '../../lib/security/pem.js';
4
4
  import { listMissingIssuerKeys } from '../pdf/pdf-issuer.js';
5
- const CERTIFICATE_EXPIRY_WARNING_DAYS = 30;
5
+ import { CERTIFICATE_EXPIRY_WARNING_DAYS, formatCertificateExpiryDate } from './certificate-expiry.js';
6
+ import { arcliEnvironmentSchema, formatEnvironmentLabel, } from './config.schemas.js';
6
7
  function buildCertificateExpiryCheck(label, certPath) {
7
8
  if (!certPath) {
8
9
  return null;
@@ -10,14 +11,14 @@ function buildCertificateExpiryCheck(label, certPath) {
10
11
  try {
11
12
  const pemContent = readPemFile(certPath, 'certificado');
12
13
  const expiry = readCertificateExpiry(pemContent);
13
- const formattedDate = expiry.expiresAt.toLocaleDateString('es-AR');
14
+ const formattedDate = formatCertificateExpiryDate(expiry.expiresAt);
14
15
  if (expiry.isExpired) {
15
- return { category: 'error', detail: `El certificado vencio el ${formattedDate}.`, label };
16
+ return { category: 'error', detail: `El certificado venció el ${formattedDate}.`, label };
16
17
  }
17
18
  if (isCertificateExpiringSoon(expiry, CERTIFICATE_EXPIRY_WARNING_DAYS)) {
18
19
  return {
19
20
  category: 'warning',
20
- detail: `El certificado vence en ${expiry.daysRemaining} dias (${formattedDate}). Renuevelo pronto.`,
21
+ detail: `El certificado vence en ${expiry.daysRemaining} días (${formattedDate}). Renuevelo pronto.`,
21
22
  label,
22
23
  };
23
24
  }
@@ -31,20 +32,20 @@ function buildCertificateExpiryCheck(label, certPath) {
31
32
  };
32
33
  }
33
34
  }
34
- export function buildConfigDoctorReport(config, runtimeCheck) {
35
+ export function buildConfigDoctorReport(config, runtimeChecks = []) {
35
36
  const checks = [];
36
37
  const conditionalChecks = [
37
38
  {
38
39
  label: 'CUIT',
39
40
  ok: config.cuit,
40
41
  okDetail: 'CUIT listo para emitir comprobantes.',
41
- warningDetail: 'Configure su CUIT con "arcli config establecer cuit <valor>".',
42
+ warningDetail: 'Configurá su CUIT con "arcli config establecer cuit <valor>".',
42
43
  },
43
44
  {
44
45
  label: 'Punto de venta',
45
46
  ok: config.puntoVentaPorDefecto,
46
47
  okDetail: `Punto de venta por defecto: ${config.puntoVentaPorDefecto}.`,
47
- warningDetail: 'Configure un punto de venta por defecto con "arcli config establecer puntoVenta <valor>".',
48
+ warningDetail: 'Configurá un punto de venta por defecto con "arcli config establecer puntoVenta <valor>".',
48
49
  },
49
50
  {
50
51
  label: 'Concepto',
@@ -62,13 +63,13 @@ export function buildConfigDoctorReport(config, runtimeCheck) {
62
63
  label: 'Credenciales testing',
63
64
  ok: config.cert.testing && config.key.testing,
64
65
  okDetail: 'Certificado y clave de testing configurados.',
65
- warningDetail: `Faltan credenciales de testing. Configure "cert.testing" y "key.testing" con "arcli config establecer". Si todavia no tiene certificado: ${CERTIFICATE_GUIDE_URL}`,
66
+ warningDetail: `Faltan credenciales de testing. Configurá "cert.testing" y "key.testing" con "arcli config establecer". Si todavia no tiene certificado: ${CERTIFICATE_GUIDE_URL}`,
66
67
  },
67
68
  {
68
- label: 'Credenciales produccion',
69
+ label: 'Credenciales producción',
69
70
  ok: config.cert.produccion && config.key.produccion,
70
- okDetail: 'Certificado y clave de produccion configurados.',
71
- warningDetail: 'Todavia no hay credenciales de produccion configuradas. Puede cargarlas con "cert.produccion" y "key.produccion".',
71
+ okDetail: 'Certificado y clave de producción configurados.',
72
+ warningDetail: 'Todavía no hay credenciales de producción configuradas. Puede cargarlas con "cert.produccion" y "key.produccion".',
72
73
  },
73
74
  ];
74
75
  for (const check of conditionalChecks) {
@@ -78,13 +79,34 @@ export function buildConfigDoctorReport(config, runtimeCheck) {
78
79
  }
79
80
  for (const [label, certPath] of [
80
81
  ['Vencimiento cert. testing', config.cert.testing],
81
- ['Vencimiento cert. produccion', config.cert.produccion],
82
+ ['Vencimiento cert. producción', config.cert.produccion],
83
+ ['Vencimiento cert. exportación testing', config.exportacion?.cert.testing],
84
+ ['Vencimiento cert. exportación producción', config.exportacion?.cert.produccion],
82
85
  ]) {
83
86
  const certificateCheck = buildCertificateExpiryCheck(label, certPath);
84
87
  if (certificateCheck) {
85
88
  checks.push(certificateCheck);
86
89
  }
87
90
  }
91
+ // WSFEX es opcional: solo se avisa si hay algo configurado a medias.
92
+ for (const environment of arcliEnvironmentSchema.options) {
93
+ const cert = config.exportacion?.cert[environment];
94
+ const key = config.exportacion?.key[environment];
95
+ if (!cert && !key) {
96
+ continue;
97
+ }
98
+ checks.push(cert && key
99
+ ? {
100
+ category: 'ok',
101
+ detail: `Certificado y clave de exportación (${environment}) configurados.`,
102
+ label: 'Credenciales WSFEX',
103
+ }
104
+ : {
105
+ category: 'warning',
106
+ detail: `Para WSFEX en ${environment} configurá "exportacion.cert.${environment}" y "exportacion.key.${environment}" juntos.`,
107
+ label: 'Credenciales WSFEX',
108
+ });
109
+ }
88
110
  checks.push({
89
111
  category: 'ok',
90
112
  detail: `Entorno por defecto: ${config.entornoPorDefecto}.`,
@@ -93,7 +115,7 @@ export function buildConfigDoctorReport(config, runtimeCheck) {
93
115
  checks.push({
94
116
  category: 'ok',
95
117
  detail: `Emitir por defecto: ${config.output.emitirPorDefecto ? 'si' : 'no'}.`,
96
- label: 'Emision',
118
+ label: 'Emisión',
97
119
  });
98
120
  checks.push({
99
121
  category: 'ok',
@@ -113,27 +135,19 @@ export function buildConfigDoctorReport(config, runtimeCheck) {
113
135
  else if (config.pdf === 'siempre') {
114
136
  checks.push({
115
137
  category: 'warning',
116
- detail: `Con pdf=siempre faltan datos del emisor: ${missingIssuerKeys.join(', ')}. Configurelos con "arcli config establecer".`,
138
+ detail: `Con pdf=siempre faltan datos del emisor: ${missingIssuerKeys.join(', ')}. Configuralos con "arcli config establecer".`,
117
139
  label: 'PDF',
118
140
  });
119
141
  }
120
- if (runtimeCheck?.validation) {
121
- checks.push({
122
- category: 'ok',
123
- detail: `Configuracion valida para ${runtimeCheck.validation.environment}.`,
124
- label: 'Revision activa',
125
- });
126
- }
127
- else if (runtimeCheck?.error) {
128
- checks.push({
129
- category: 'error',
130
- detail: runtimeCheck.error,
131
- label: 'Revision activa',
132
- });
142
+ for (const runtimeCheck of runtimeChecks) {
143
+ const environment = formatEnvironmentLabel(runtimeCheck.environment);
144
+ const label = `Validación ${environment}`;
145
+ checks.push(runtimeCheck.error
146
+ ? { category: 'error', detail: runtimeCheck.error, label }
147
+ : { category: 'ok', detail: `Configuración válida para ${environment}.`, label });
133
148
  }
134
149
  return {
135
150
  checks,
136
151
  ok: checks.every((check) => check.category === 'ok'),
137
152
  };
138
153
  }
139
- //# sourceMappingURL=config-doctor.js.map
@@ -1,7 +1,10 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import { resolve } from 'node:path';
3
3
  import { parseArgentineDateInputAsArcaDate } from '../../lib/dates/arca-date.js';
4
+ import { InputValidationError } from '../../lib/errors/app-error.js';
5
+ import { parseCuit } from '../../lib/identity/cuit.js';
4
6
  import { EXCHANGE_RATE_DECIMALS, parseArgentineAmount } from '../../lib/numbers/argentine-amount.js';
7
+ import { parseStrictInteger } from '../../lib/numbers/strict-integer.js';
5
8
  import { readPemFile } from '../../lib/security/pem.js';
6
9
  import { IVA_RATE_HINT } from '../billing/billing.schemas.js';
7
10
  import { MAX_RECENT_VOUCHERS } from '../vouchers/voucher-history.js';
@@ -14,54 +17,61 @@ function parseBoolean(value) {
14
17
  if (normalizedValue === 'false' || normalizedValue === '0' || normalizedValue === 'no') {
15
18
  return false;
16
19
  }
17
- throw new Error(`El valor "${value}" no es un booleano valido. Use true/false, si/no o 1/0.`);
20
+ throw new InputValidationError(`El valor "${value}" no es un booleano válido. Usá true/false, si/no o 1/0.`);
18
21
  }
19
22
  function parseNonEmptyString(value) {
20
23
  const normalizedValue = value.trim();
21
24
  if (!normalizedValue) {
22
- throw new Error('El valor no puede estar vacio.');
25
+ throw new InputValidationError('El valor no puede estar vacío.');
23
26
  }
24
27
  return normalizedValue;
25
28
  }
26
29
  function parseIvaRate(value) {
27
30
  const result = arcliDefaultIvaRateSchema.safeParse(value);
28
31
  if (!result.success) {
29
- throw new Error(`La alicuota "${value}" no es valida. Use ${IVA_RATE_HINT}.`);
32
+ throw new InputValidationError(`La alícuota "${value}" no es válida. Usá ${IVA_RATE_HINT}.`);
30
33
  }
31
34
  return result.data;
32
35
  }
36
+ function parseConfigCuit(value) {
37
+ const result = parseCuit(value);
38
+ if (!result.ok) {
39
+ throw new InputValidationError(`El CUIT "${value}" no es válido: ${result.reason}.`);
40
+ }
41
+ return result.value;
42
+ }
33
43
  function parseCbu(value) {
34
44
  const normalizedValue = value.trim();
35
45
  if (!/^\d{22}$/.test(normalizedValue)) {
36
- throw new Error(`El CBU "${value}" no es valido: debe tener 22 digitos.`);
46
+ throw new InputValidationError(`El CBU "${value}" no es válido: debe tener 22 digitos.`);
37
47
  }
38
48
  return normalizedValue;
39
49
  }
40
50
  function parseCbuAlias(value) {
41
51
  const normalizedValue = value.trim();
42
52
  if (!/^[A-Za-z0-9.-]{6,20}$/.test(normalizedValue)) {
43
- throw new Error(`El alias "${value}" no es valido: debe tener entre 6 y 20 letras, numeros, puntos o guiones.`);
53
+ throw new InputValidationError(`El alias "${value}" no es válido: debe tener entre 6 y 20 letras, números, puntos o guiones.`);
44
54
  }
45
55
  return normalizedValue;
46
56
  }
47
57
  function parsePositiveInteger(value) {
48
- const parsedValue = Number.parseInt(value.trim(), 10);
49
- if (!Number.isInteger(parsedValue) || parsedValue <= 0) {
50
- throw new Error(`El valor "${value}" no es un entero positivo valido.`);
58
+ const parsedValue = parseStrictInteger(value);
59
+ if (parsedValue === undefined || parsedValue <= 0) {
60
+ throw new InputValidationError(`El valor "${value}" no es un entero positivo válido.`);
51
61
  }
52
62
  return parsedValue;
53
63
  }
54
64
  function parseRecentCount(value) {
55
- const parsedValue = Number(value.trim());
56
- if (!Number.isInteger(parsedValue) || parsedValue < 1 || parsedValue > MAX_RECENT_VOUCHERS) {
57
- throw new Error(`La cantidad "${value}" no es valida: tiene que ser un numero entre 1 y ${MAX_RECENT_VOUCHERS}.`);
65
+ const parsedValue = parseStrictInteger(value);
66
+ if (parsedValue === undefined || parsedValue < 1 || parsedValue > MAX_RECENT_VOUCHERS) {
67
+ throw new InputValidationError(`La cantidad "${value}" no es válida: tiene que ser un número entre 1 y ${MAX_RECENT_VOUCHERS}.`);
58
68
  }
59
69
  return parsedValue;
60
70
  }
61
71
  function parseExchangeRate(value) {
62
72
  const result = parseArgentineAmount(value, { maxDecimals: EXCHANGE_RATE_DECIMALS });
63
73
  if (!result.ok) {
64
- throw new Error(`La cotizacion "${value}" no es valida: ${result.reason}.`);
74
+ throw new InputValidationError(`La cotización "${value}" no es válida: ${result.reason}.`);
65
75
  }
66
76
  return result.value;
67
77
  }
@@ -74,21 +84,21 @@ function parsePemPath(value, label) {
74
84
  // La fecha de inicio de actividades es vieja: se pide con anio para no completarla con el actual.
75
85
  function parseFullDate(value) {
76
86
  if (!/^\d{1,2}([-/])\d{1,2}\1(\d{2}|\d{4})$/.test(value.trim())) {
77
- throw new Error(`La fecha "${value}" no es valida. Use D/MM/YYYY, por ejemplo 1/03/2020.`);
87
+ throw new InputValidationError(`La fecha "${value}" no es válida. Usá D/MM/YYYY, por ejemplo 1/03/2020.`);
78
88
  }
79
89
  return parseArgentineDateInputAsArcaDate(value);
80
90
  }
81
91
  function parseExistingFile(value, label) {
82
92
  const path = resolve(parseNonEmptyString(value));
83
93
  if (!existsSync(path)) {
84
- throw new Error(`No se encontro ${label} en "${path}".`);
94
+ throw new InputValidationError(`No se encontró ${label} en "${path}".`);
85
95
  }
86
96
  return path;
87
97
  }
88
98
  function parseLogoPath(value) {
89
99
  const path = parseExistingFile(value, 'el logo');
90
100
  if (!/\.(png|jpe?g)$/i.test(path)) {
91
- throw new Error('El logo debe ser un archivo PNG o JPG.');
101
+ throw new InputValidationError('El logo debe ser un archivo PNG o JPG.');
92
102
  }
93
103
  return path;
94
104
  }
@@ -107,7 +117,7 @@ export function parseConfigValue(key, value) {
107
117
  case 'cotizacionPorDefecto':
108
118
  return parseExchangeRate(value);
109
119
  case 'cuit':
110
- return value.trim();
120
+ return parseConfigCuit(value);
111
121
  case 'emisor.condicionIva':
112
122
  return arcliDefaultIvaConditionSchema.parse(value.trim().toLowerCase());
113
123
  case 'emisor.domicilio':
@@ -125,6 +135,7 @@ export function parseConfigValue(key, value) {
125
135
  case 'monedaPorDefecto':
126
136
  return value.trim().toUpperCase();
127
137
  case 'verificarFce':
138
+ case 'consultarPadron':
128
139
  case 'output.emitirPorDefecto':
129
140
  case 'output.jsonPorDefecto':
130
141
  case 'output.brutoPorDefecto':
@@ -136,17 +147,21 @@ export function parseConfigValue(key, value) {
136
147
  case 'pdfNavegador':
137
148
  return parseExistingFile(value, 'el navegador');
138
149
  case 'puntoVentaPorDefecto':
150
+ case 'exportacion.actividad':
139
151
  return parsePositiveInteger(value);
140
152
  case 'ticketPath':
141
153
  return resolve(parseNonEmptyString(value));
142
154
  case 'cert.produccion':
143
155
  case 'cert.testing':
156
+ case 'exportacion.cert.produccion':
157
+ case 'exportacion.cert.testing':
144
158
  return parsePemPath(value, 'certificado');
145
159
  case 'key.produccion':
146
160
  case 'key.testing':
161
+ case 'exportacion.key.produccion':
162
+ case 'exportacion.key.testing':
147
163
  return parsePemPath(value, 'clave privada');
148
164
  default:
149
165
  return parseNonEmptyString(value);
150
166
  }
151
167
  }
152
- //# sourceMappingURL=config-value-parser.js.map
@@ -0,0 +1,23 @@
1
+ import { ConfigurationError } from '../../lib/errors/app-error.js';
2
+ /**
3
+ * WSFEX exige un certificado autorizado al servicio `wsfex`, que en general no es el mismo que el de wsfe.
4
+ * `exportacion.cert`/`exportacion.key` son opcionales: sin ellos se usan los certificados generales.
5
+ */
6
+ export function resolveExportCredentials(config, environment) {
7
+ const dedicatedCert = config.exportacion?.cert[environment];
8
+ const dedicatedKey = config.exportacion?.key[environment];
9
+ if (Boolean(dedicatedCert) !== Boolean(dedicatedKey)) {
10
+ throw new ConfigurationError(`Para WSFEX en ${environment} configurá el certificado y la clave juntos.`, { faltan: dedicatedCert ? [`exportacion.key.${environment}`] : [`exportacion.cert.${environment}`] }, `Cargalos con "arcli config establecer exportacion.cert.${environment} <ruta>" y "arcli config establecer exportacion.key.${environment} <ruta>".`);
11
+ }
12
+ const cert = dedicatedCert ?? config.cert[environment];
13
+ const key = dedicatedKey ?? config.key[environment];
14
+ if (!cert || !key) {
15
+ throw new ConfigurationError(`Falta el certificado de WSFEX para ${environment}.`, {
16
+ faltan: [
17
+ ...(cert ? [] : [`exportacion.cert.${environment}`]),
18
+ ...(key ? [] : [`exportacion.key.${environment}`]),
19
+ ],
20
+ }, `Autorizá un certificado al servicio wsfex y cargalo con "arcli config establecer exportacion.cert.${environment} <ruta>" y "arcli config establecer exportacion.key.${environment} <ruta>".`);
21
+ }
22
+ return { cert, dedicated: Boolean(dedicatedCert), key };
23
+ }
@@ -4,6 +4,7 @@ import { colorize, keyValuePanel, resolveKeyValueLabelWidth, statusPanel, toneTe
4
4
  import { RECENT_VOUCHERS_LIMIT } from '../vouchers/voucher-history.js';
5
5
  import { CONFIG_LABELS, CONFIG_SECTIONS } from './config.sections.js';
6
6
  function toPublicSnapshot(config, paths) {
7
+ const dedicated = config.exportacion;
7
8
  return {
8
9
  alicuota: config.alicuotaPorDefecto,
9
10
  aliasCbu: config.aliasCbu,
@@ -19,6 +20,17 @@ function toPublicSnapshot(config, paths) {
19
20
  emisor: { ...config.emisor, logo: config.emisor.logo ? maskPath(config.emisor.logo) : undefined },
20
21
  emitir: config.output.emitirPorDefecto,
21
22
  entorno: config.entornoPorDefecto,
23
+ exportacion: {
24
+ actividad: dedicated?.actividad,
25
+ cert: {
26
+ produccion: dedicated?.cert.produccion ? maskPath(dedicated.cert.produccion) : undefined,
27
+ testing: dedicated?.cert.testing ? maskPath(dedicated.cert.testing) : undefined,
28
+ },
29
+ key: {
30
+ produccion: dedicated?.key.produccion ? maskPath(dedicated.key.produccion) : undefined,
31
+ testing: dedicated?.key.testing ? maskPath(dedicated.key.testing) : undefined,
32
+ },
33
+ },
22
34
  ivaReceptor: config.ivaReceptorPorDefecto,
23
35
  json: config.output.jsonPorDefecto,
24
36
  key: {
@@ -33,6 +45,7 @@ function toPublicSnapshot(config, paths) {
33
45
  bruto: config.output.brutoPorDefecto,
34
46
  ticketPath: maskPath(paths.ticketPath),
35
47
  verificarFce: config.verificarFce,
48
+ consultarPadron: config.consultarPadron ?? true,
36
49
  };
37
50
  }
38
51
  export function formatConfig(config, paths) {
@@ -41,6 +54,10 @@ export function formatConfig(config, paths) {
41
54
  export function formatConfigPath(configPath) {
42
55
  return configPath;
43
56
  }
57
+ /** `{ "ruta": "..." }`, como `ruta` en el JSON de `pdf desinstalar`. */
58
+ export function formatConfigPathAsJson(configPath) {
59
+ return JSON.stringify({ ruta: configPath }, null, 2);
60
+ }
44
61
  const NOT_SET = 'no configurado';
45
62
  const notSet = (value) => value ?? NOT_SET;
46
63
  const yesNo = (value) => (value ? 'si' : 'no');
@@ -56,7 +73,7 @@ const CONFIG_TEXT_VALUES = {
56
73
  concepto: (c) => notSet(c.concepto),
57
74
  cotizacion: (c) => c.cotizacion ?? 1,
58
75
  cuit: (c) => notSet(c.cuit),
59
- 'emisor.condicionIva': (c) => c.emisor.condicionIva ?? 'segun la letra',
76
+ 'emisor.condicionIva': (c) => c.emisor.condicionIva ?? 'según la letra',
60
77
  'emisor.domicilio': (c) => notSet(c.emisor.domicilio),
61
78
  'emisor.iibb': (c) => notSet(c.emisor.iibb),
62
79
  'emisor.inicioActividades': (c) => c.emisor.inicioActividades ? formatArcaDateAsArgentineDate(c.emisor.inicioActividades) : NOT_SET,
@@ -64,6 +81,11 @@ const CONFIG_TEXT_VALUES = {
64
81
  'emisor.razonSocial': (c) => notSet(c.emisor.razonSocial),
65
82
  emitir: (c) => yesNo(c.emitir),
66
83
  entorno: (c) => c.entorno,
84
+ 'exportacion.actividad': (c) => notSet(c.exportacion.actividad),
85
+ 'exportacion.cert.produccion': (c) => notSet(c.exportacion.cert.produccion),
86
+ 'exportacion.cert.testing': (c) => notSet(c.exportacion.cert.testing),
87
+ 'exportacion.key.produccion': (c) => notSet(c.exportacion.key.produccion),
88
+ 'exportacion.key.testing': (c) => notSet(c.exportacion.key.testing),
67
89
  ivaReceptor: (c) => notSet(c.ivaReceptor),
68
90
  json: (c) => yesNo(c.json),
69
91
  'key.produccion': (c) => notSet(c.key.produccion),
@@ -75,6 +97,7 @@ const CONFIG_TEXT_VALUES = {
75
97
  puntoVenta: (c) => notSet(c.puntoVenta),
76
98
  ticketPath: (c) => c.ticketPath,
77
99
  verificarFce: (c) => yesNo(c.verificarFce),
100
+ consultarPadron: (c) => yesNo(c.consultarPadron ?? true),
78
101
  };
79
102
  /**
80
103
  * La configuracion por secciones, en el mismo orden que "Modificar configuracion" del modo interactivo.
@@ -95,7 +118,7 @@ export function formatConfigAsText(config, paths) {
95
118
  // Los datos van corridos bajo el titulo, asi la seccion se lee aun sin color (NO_COLOR, pipes).
96
119
  ...section.rows.map(([label, value]) => ` ${colorize(label.padEnd(labelWidth), 'muted')}${gap}${value === NOT_SET ? colorize(value, 'muted') : value}`),
97
120
  ]);
98
- return keyValuePanel('Configuracion', lines, undefined, 'standard', undefined, 'sheet');
121
+ return keyValuePanel('Configuración', lines, undefined, 'standard', undefined, 'sheet');
99
122
  }
100
123
  export function formatConfigDoctor(report) {
101
124
  return JSON.stringify({
@@ -118,10 +141,9 @@ export function formatConfigDoctorAsText(report) {
118
141
  });
119
142
  const tone = report.ok ? 'success' : report.checks.some((check) => check.category === 'error') ? 'danger' : 'warning';
120
143
  const footer = report.ok
121
- ? 'Configuracion lista para usar ARCLI'
144
+ ? 'Configuración lista para usar ARCLI'
122
145
  : report.checks.some((check) => check.category === 'error')
123
146
  ? 'Hay puntos criticos por corregir antes de emitir'
124
- : 'Revise las recomendaciones antes de emitir en serio';
125
- return statusPanel('Revision de configuracion', lines, footer, 'wide', tone, 'checklist');
147
+ : 'Revisá las recomendaciones antes de emitir en serio';
148
+ return statusPanel('Revisión de configuración', lines, footer, 'wide', tone, 'checklist');
126
149
  }
127
- //# sourceMappingURL=config.presenter.js.map