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,146 @@
1
+ import { formatArcaDateAsArgentineDate } from '../../lib/dates/arca-date.js';
2
+ import { AppError } from '../../lib/errors/app-error.js';
3
+ const NOT_AUTHORIZED_MESSAGE = 'El certificado no está autorizado para el servicio wsfex (factura de exportación). Autorizalo igual que wsfe: en testing desde WSASS ("Crear autorización a servicio") y en producción desde el Administrador de Relaciones.';
4
+ /** El XML de ARCA a veces trae un solo elemento donde el WSDL promete un array. */
5
+ function asArray(value) {
6
+ if (value === undefined || value === null) {
7
+ return [];
8
+ }
9
+ return Array.isArray(value) ? value : [value];
10
+ }
11
+ function readText(value) {
12
+ return typeof value === 'string' ? value.trim() : '';
13
+ }
14
+ /**
15
+ * La fecha de la cotizacion viene como `dd/mm/yyyy`; el resto del modulo trabaja con fechas ARCA (`yyyymmdd`).
16
+ * Si ARCA no la informa se descarta: la cotizacion igual sirve.
17
+ */
18
+ function parseWsfexQuotationDate(value) {
19
+ const match = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(value);
20
+ return match ? `${match[3]}${match[2].padStart(2, '0')}${match[1].padStart(2, '0')}` : undefined;
21
+ }
22
+ /** WSFEX no lanza: devuelve `FEXErr` con codigo 0 cuando salio todo bien. */
23
+ function assertNoError(result, operation) {
24
+ const error = result?.FEXErr;
25
+ if (error?.ErrCode) {
26
+ throw new AppError(`ARCA devolvió un error al consultar ${operation}: ${readText(error.ErrMsg) || error.ErrCode}`, {
27
+ code: 'ARCA_EXPORT_ERROR',
28
+ details: { errores: [{ codigo: error.ErrCode, mensaje: readText(error.ErrMsg) }] },
29
+ });
30
+ }
31
+ }
32
+ export class ArcaExportGateway {
33
+ arca;
34
+ constructor(arca) {
35
+ this.arca = arca;
36
+ }
37
+ /** Todas las llamadas autentican en WSAA: si el certificado no esta autorizado a wsfex, el error lo dice. */
38
+ async call(request) {
39
+ try {
40
+ return await request(this.arca.wsfexService);
41
+ }
42
+ catch (error) {
43
+ if (error instanceof Error && error.message.includes('notAuthorized')) {
44
+ throw new AppError(NOT_AUTHORIZED_MESSAGE, { code: 'WSFEX_SERVICE_NOT_AUTHORIZED' });
45
+ }
46
+ throw error;
47
+ }
48
+ }
49
+ /**
50
+ * La unica llamada que emite. Un rechazo viene en `FEXResultAuth`, no como excepcion.
51
+ *
52
+ * El WSDL tipa `Permisos` como obligatorio, pero ARCA lo rechaza cuando `Permiso_existente` es `N` (error
53
+ * 1720) y en los tipos de exportacion 2 y 4 pide ese campo vacio (error 1550): sin permisos el `Cmp` no trae la
54
+ * clave y el serializador de SOAP omite los campos ausentes.
55
+ */
56
+ async authorize(payload) {
57
+ return this.call((service) => service.authorize({ Cmp: payload }));
58
+ }
59
+ /**
60
+ * La tabla de actividades de WSFEX es propia: tiene menos codigos que la del padron y el `Cmp` solo acepta los
61
+ * suyos. El WSDL no la tipa (devuelve `ClsFEXResponse_ActividadTipo`), asi que se lee como array tolerante.
62
+ */
63
+ async getActivities() {
64
+ const data = (await this.call((service) => service.getParamActividades({}))).FEXGetPARAM_ActividadesResult;
65
+ assertNoError(data, 'las actividades');
66
+ const rows = data?.FEXResultGet
67
+ ?.ClsFEXResponse_ActividadTipo;
68
+ return asArray(rows).flatMap((row) => {
69
+ const id = Number(row?.Id);
70
+ const name = readText(row?.Desc);
71
+ return Number.isInteger(id) && id > 0 ? [{ id, name }] : [];
72
+ });
73
+ }
74
+ async getCurrencies() {
75
+ const data = (await this.call((service) => service.getParamMon({}))).FEXGetPARAM_MONResult;
76
+ assertNoError(data, 'las monedas');
77
+ return asArray(data?.FEXResultGet?.ClsFEXResponse_Mon).flatMap((row) => {
78
+ const code = readText(row.Mon_Id);
79
+ return code ? [{ code, name: readText(row.Mon_Ds) }] : [];
80
+ });
81
+ }
82
+ async getDestinationCountries() {
83
+ const data = (await this.call((service) => service.getParamDstPais({}))).FEXGetPARAM_DST_paisResult;
84
+ assertNoError(data, 'los países de destino');
85
+ return asArray(data?.FEXResultGet?.ClsFEXResponse_DST_pais).flatMap((row) => {
86
+ const code = Number(row.DST_Codigo);
87
+ const name = readText(row.DST_Ds);
88
+ return Number.isInteger(code) && name ? [{ code, name }] : [];
89
+ });
90
+ }
91
+ async getDestinationCountryCuits() {
92
+ const data = (await this.call((service) => service.getParamDstCuit({}))).FEXGetPARAM_DST_CUITResult;
93
+ assertNoError(data, 'los CUIT de países');
94
+ return asArray(data?.FEXResultGet?.ClsFEXResponse_DST_cuit).flatMap((row) => {
95
+ const cuit = Number(row.DST_CUIT);
96
+ const countryName = readText(row.DST_Ds);
97
+ return Number.isInteger(cuit) && countryName ? [{ countryName, cuit }] : [];
98
+ });
99
+ }
100
+ async getIncoterms() {
101
+ const data = (await this.call((service) => service.getParamIncoterms({}))).FEXGetPARAM_IncotermsResult;
102
+ assertNoError(data, 'los incoterms');
103
+ return asArray(data?.FEXResultGet?.ClsFEXResponse_Inc).flatMap((row) => {
104
+ const code = readText(row.Inc_Id);
105
+ return code ? [{ code, name: readText(row.Inc_Ds) }] : [];
106
+ });
107
+ }
108
+ async getLanguages() {
109
+ const data = (await this.call((service) => service.getParamIdiomas({}))).FEXGetPARAM_IdiomasResult;
110
+ assertNoError(data, 'los idiomas');
111
+ return asArray(data?.FEXResultGet?.ClsFEXResponse_Idi).flatMap((row) => {
112
+ const id = Number(row.Idi_Id);
113
+ return Number.isInteger(id) ? [{ id, name: readText(row.Idi_Ds) }] : [];
114
+ });
115
+ }
116
+ async getUnits() {
117
+ const data = (await this.call((service) => service.getParamUMed({}))).FEXGetPARAM_UMedResult;
118
+ assertNoError(data, 'las unidades de medida');
119
+ return asArray(data?.FEXResultGet?.ClsFEXResponse_UMed).flatMap((row) => {
120
+ const id = Number(row.Umed_Id);
121
+ return Number.isInteger(id) ? [{ id, name: readText(row.Umed_Ds) }] : [];
122
+ });
123
+ }
124
+ async getLastRequestId() {
125
+ const data = (await this.call((service) => service.getLastId({}))).FEXGetLast_IDResult;
126
+ assertNoError(data, 'el último ID de solicitud');
127
+ return Number(data?.FEXResultGet?.Id) || 0;
128
+ }
129
+ /**
130
+ * La cotizacion de la `E` es la de aduana, que WSFEX publica una vez por dia: `FEXGetPARAM_MON_CON_COTIZACION`
131
+ * devuelve por moneda la ultima publicada hasta `arcaDate`, con el dia al que corresponde. `Fecha_CTZ` va en
132
+ * `yyyymmdd`: con guiones ARCA contesta el error 2054.
133
+ */
134
+ async getQuotations(arcaDate) {
135
+ const data = (await this.call((service) => service.getParamMonConCotizacion({ Fecha_CTZ: arcaDate })))
136
+ .FEXGetPARAM_MON_CON_COTIZACIONResult;
137
+ assertNoError(data, `las cotizaciones al ${formatArcaDateAsArgentineDate(arcaDate)}`);
138
+ return asArray(data?.FEXResultGet?.ClsFEXResponse_Mon_CON_Cotizacion).flatMap((row) => {
139
+ const code = readText(row.Mon_Id);
140
+ const rate = Number(row.Mon_ctz);
141
+ return code && Number.isFinite(rate) && rate > 0
142
+ ? [{ code, date: parseWsfexQuotationDate(readText(row.Fecha_ctz)), rate }]
143
+ : [];
144
+ });
145
+ }
146
+ }
@@ -1,5 +1,5 @@
1
1
  import { AppError } from '../../lib/errors/app-error.js';
2
- const NOT_AUTHORIZED_MESSAGE = 'El certificado no esta autorizado para el servicio wsfecred (Factura de Credito Electronica). Autoricelo igual que wsfe: en testing desde WSASS ("Crear autorizacion a servicio") y en produccion desde el Administrador de Relaciones.';
2
+ const NOT_AUTHORIZED_MESSAGE = 'El certificado no está autorizado para el servicio wsfecred (Factura de Crédito Electrónica). Autorizalo igual que wsfe: en testing desde WSASS ("Crear autorizacion a servicio") y en producción desde el Administrador de Relaciones.';
3
3
  function toIsoDate(arcaDate) {
4
4
  return `${arcaDate.slice(0, 4)}-${arcaDate.slice(4, 6)}-${arcaDate.slice(6, 8)}`;
5
5
  }
@@ -25,7 +25,7 @@ export class ArcaFceObligationGateway {
25
25
  const result = output.consultarMontoObligadoRecepcionReturn;
26
26
  const errors = result.arrayErrores?.codigoDescripcion ?? [];
27
27
  if (errors.length > 0) {
28
- throw new AppError(`ARCA no pudo informar si el receptor esta obligado a FCE: ${errors.map((item) => `${item.codigo} ${item.descripcion}`).join('; ')}`, { code: 'FCE_OBLIGATION_ERROR', details: { errors } });
28
+ throw new AppError(`ARCA no pudo informar si el receptor está obligado a FCE: ${errors.map((item) => `${item.codigo} ${item.descripcion}`).join('; ')}`, { code: 'FCE_OBLIGATION_ERROR', details: { errors } });
29
29
  }
30
30
  return {
31
31
  minimumAmount: Number(result.montoDesde ?? 0),
@@ -33,4 +33,3 @@ export class ArcaFceObligationGateway {
33
33
  };
34
34
  }
35
35
  }
36
- //# sourceMappingURL=arca-fce-obligation.gateway.js.map
@@ -0,0 +1,103 @@
1
+ import { AppError } from '../../lib/errors/app-error.js';
2
+ import { deriveIvaCondition, } from '../../modules/padron/padron.js';
3
+ const NOT_AUTHORIZED_MESSAGE = 'El certificado no está autorizado para el servicio ws_sr_constancia_inscripcion (padrón). Autorizalo igual que wsfe: en testing desde WSASS ("Crear autorizacion a servicio") y en producción desde el Administrador de Relaciones.';
4
+ function asRecord(value) {
5
+ return value && typeof value === 'object' && !Array.isArray(value) ? value : undefined;
6
+ }
7
+ function asArray(value) {
8
+ if (Array.isArray(value))
9
+ return value;
10
+ return value === undefined || value === null ? [] : [value];
11
+ }
12
+ function asText(value) {
13
+ return typeof value === 'string' && value.trim() ? value.trim() : null;
14
+ }
15
+ function readName(general) {
16
+ const businessName = asText(general?.razonSocial);
17
+ if (businessName)
18
+ return businessName;
19
+ const fullName = [asText(general?.apellido), asText(general?.nombre)].filter(Boolean).join(' ');
20
+ return fullName || null;
21
+ }
22
+ function readAddress(general) {
23
+ const address = asRecord(general?.domicilioFiscal);
24
+ const parts = [
25
+ asText(address?.direccion),
26
+ asText(address?.localidad),
27
+ asText(address?.codPostal) ? `CP ${asText(address?.codPostal)}` : null,
28
+ asText(address?.descripcionProvincia),
29
+ ].filter(Boolean);
30
+ return parts.length > 0 ? parts.join(', ') : null;
31
+ }
32
+ function readTaxes(...sources) {
33
+ return sources.flatMap((source) => asArray(source?.impuesto).flatMap((item) => {
34
+ const tax = asRecord(item);
35
+ const id = Number(tax?.idImpuesto);
36
+ return Number.isInteger(id)
37
+ ? [
38
+ {
39
+ active: (asText(tax?.estadoImpuesto) ?? 'AC') === 'AC',
40
+ description: asText(tax?.descripcionImpuesto) ?? '',
41
+ id,
42
+ },
43
+ ]
44
+ : [];
45
+ }));
46
+ }
47
+ function readActivities(...sources) {
48
+ return sources.flatMap((source) => asArray(source?.actividad ?? source?.actividadMonotributista).flatMap((item) => {
49
+ const activity = asRecord(item);
50
+ const id = Number(activity?.idActividad);
51
+ return Number.isInteger(id) ? [{ description: asText(activity?.descripcionActividad) ?? '', id }] : [];
52
+ }));
53
+ }
54
+ function readMonotributoCategory(monotributo) {
55
+ const category = monotributo?.categoriaMonotributo;
56
+ return asText(category) ?? asText(asRecord(category)?.descripcionCategoria);
57
+ }
58
+ function readNotices(details) {
59
+ return asArray(asRecord(details.errorConstancia)?.error).flatMap((item) => asText(item) ?? []);
60
+ }
61
+ function readPersonType(value) {
62
+ const type = asText(value)?.toUpperCase();
63
+ return type === 'FISICA' ? 'fisica' : type === 'JURIDICA' ? 'juridica' : null;
64
+ }
65
+ /** Arma un `Taxpayer` con la respuesta de `getTaxpayerDetails`. */
66
+ export function mapTaxpayerDetails(cuit, raw) {
67
+ const details = asRecord(raw) ?? {};
68
+ const general = asRecord(details.datosGenerales);
69
+ const monotributo = asRecord(details.datosMonotributo);
70
+ const generalRegime = asRecord(details.datosRegimenGeneral);
71
+ const taxes = readTaxes(generalRegime, monotributo);
72
+ return {
73
+ activities: readActivities(generalRegime, monotributo),
74
+ address: readAddress(general),
75
+ cuit,
76
+ ivaCondition: deriveIvaCondition({ monotributo: Boolean(monotributo), taxes }),
77
+ keyStatus: asText(details.estadoClave) ?? asText(general?.estadoClave),
78
+ monotributoCategory: readMonotributoCategory(monotributo),
79
+ name: readName(general),
80
+ notices: readNotices(details),
81
+ personType: readPersonType(details.tipoPersona ?? general?.tipoPersona),
82
+ taxes,
83
+ };
84
+ }
85
+ export class ArcaPadronGateway {
86
+ arca;
87
+ constructor(arca) {
88
+ this.arca = arca;
89
+ }
90
+ async getTaxpayer(cuit) {
91
+ let details;
92
+ try {
93
+ details = await this.arca.registerInscriptionProofService.getTaxpayerDetails(cuit);
94
+ }
95
+ catch (error) {
96
+ if (error instanceof Error && error.message.includes('notAuthorized')) {
97
+ throw new AppError(NOT_AUTHORIZED_MESSAGE, { code: 'PADRON_SERVICE_NOT_AUTHORIZED' });
98
+ }
99
+ throw error;
100
+ }
101
+ return details ? mapTaxpayerDetails(cuit, details) : null;
102
+ }
103
+ }
@@ -5,7 +5,7 @@ const NO_RESULTS_CODE = 602;
5
5
  function readRows(result, key, operation) {
6
6
  const errors = result.errors?.err ?? [];
7
7
  if (errors.some((error) => error.code !== NO_RESULTS_CODE)) {
8
- throw new AppError(`ARCA devolvio un error al consultar ${operation}: ${errors.map((e) => e.msg).join('; ')}`, {
8
+ throw new AppError(`ARCA devolvió un error al consultar ${operation}: ${errors.map((e) => e.msg).join('; ')}`, {
9
9
  code: 'ARCA_PARAMETERS_ERROR',
10
10
  details: { errores: errors },
11
11
  });
@@ -45,7 +45,7 @@ export class ArcaParametersGateway {
45
45
  const result = await this.arca.electronicBillingService.getQuotation(code);
46
46
  const rate = result.resultGet?.monCotiz;
47
47
  if (typeof rate !== 'number' || rate <= 0) {
48
- throw new AppError(`ARCA no devolvio una cotizacion para ${currency}.`, {
48
+ throw new AppError(`ARCA no devolvió una cotización para ${currency}.`, {
49
49
  code: 'ARCA_QUOTATION_ERROR',
50
50
  details: { errors: result.errors },
51
51
  });
@@ -68,4 +68,3 @@ export class ArcaParametersGateway {
68
68
  return readRows(result, key, table).map(toEntry);
69
69
  }
70
70
  }
71
- //# sourceMappingURL=arca-parameters.gateway.js.map
@@ -1,11 +1,11 @@
1
+ import { getLastAuthorizedNumber } from './last-voucher.js';
1
2
  export class ArcaVoucherHistoryGateway {
2
3
  arca;
3
4
  constructor(arca) {
4
5
  this.arca = arca;
5
6
  }
6
7
  async getLastNumber(pointOfSale, voucherType) {
7
- const result = await this.arca.electronicBillingService.getLastVoucher(pointOfSale, voucherType);
8
- return result.cbteNro ?? 0;
8
+ return getLastAuthorizedNumber(this.arca, pointOfSale, voucherType);
9
9
  }
10
10
  async getVoucher(number, pointOfSale, voucherType) {
11
11
  const info = await this.arca.electronicBillingService.getVoucherInfo(number, pointOfSale, voucherType);
@@ -33,4 +33,3 @@ export class ArcaVoucherHistoryGateway {
33
33
  };
34
34
  }
35
35
  }
36
- //# sourceMappingURL=arca-voucher-history.gateway.js.map
@@ -0,0 +1,26 @@
1
+ import { AppError } from '../../lib/errors/app-error.js';
2
+ import { POINT_OF_SALE_GUIDE_URL } from '../../lib/links.js';
3
+ /**
4
+ * WSFEv1 11002: el punto de venta no esta habilitado para el web service.
5
+ * 10005 es el mismo problema cuando ARCA lo informa al emitir.
6
+ */
7
+ const POINT_OF_SALE_ERROR_CODES = new Set([10005, 11002]);
8
+ /**
9
+ * Pide el ultimo numero autorizado y corta si ARCA devolvio errores.
10
+ * El SDK los deja en `errors` y no lanza: sin este chequeo, un punto de venta invalido parece no tener comprobantes.
11
+ */
12
+ export async function getLastAuthorizedNumber(arca, pointOfSale, voucherType) {
13
+ const result = await arca.electronicBillingService.getLastVoucher(pointOfSale, voucherType);
14
+ const errors = result.errors?.err ?? [];
15
+ if (errors.length > 0) {
16
+ const pointOfSaleProblem = errors.some((error) => POINT_OF_SALE_ERROR_CODES.has(error.code));
17
+ throw new AppError(`ARCA devolvió un error al pedir el último comprobante del punto de venta ${pointOfSale}: ${errors.map((error) => `${error.code} ${error.msg}`).join('; ')}`, {
18
+ code: 'ARCA_LAST_VOUCHER_ERROR',
19
+ details: { errores: errors },
20
+ suggestion: pointOfSaleProblem
21
+ ? `El punto de venta no está habilitado para web service (los de "Factura en línea" no sirven). Revisá los habilitados con arcli parametros puntos-venta o creá uno para web service: ${POINT_OF_SALE_GUIDE_URL}`
22
+ : 'No se emitió nada. Revisá el mensaje de ARCA y reintentá.',
23
+ });
24
+ }
25
+ return result.cbteNro ?? 0;
26
+ }
@@ -14,4 +14,3 @@ export function copyToClipboard(text, platform = process.platform) {
14
14
  return !result.error && result.status === 0;
15
15
  });
16
16
  }
17
- //# sourceMappingURL=clipboard.js.map
@@ -22,4 +22,3 @@ export function escapeHtmlStrings(value) {
22
22
  }
23
23
  return value;
24
24
  }
25
- //# sourceMappingURL=escape-html.js.map
@@ -51,4 +51,3 @@ export function findDownloadedBrowser(cacheDir) {
51
51
  }
52
52
  return undefined;
53
53
  }
54
- //# sourceMappingURL=pdf-browser.js.map
@@ -1,8 +1,9 @@
1
- import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
1
+ import { mkdirSync, readFileSync } from 'node:fs';
2
2
  import { extname, join } from 'node:path';
3
3
  import { AppError } from '../../lib/errors/app-error.js';
4
+ import { writeNewFile } from '../../lib/files/write-new-file.js';
4
5
  import { PdfError } from '../../modules/pdf/pdf.errors.js';
5
- import { mapBillingResultToPdfData } from '../../modules/pdf/pdf-data.mapper.js';
6
+ import { mapBillingResultToPdfData, mapExportResultToPdfData } from '../../modules/pdf/pdf-data.mapper.js';
6
7
  import { buildPdfFileName } from '../../modules/pdf/pdf-file-name.js';
7
8
  import { resolvePdfIssuer } from '../../modules/pdf/pdf-issuer.js';
8
9
  import { escapeHtmlStrings } from './escape-html.js';
@@ -25,11 +26,14 @@ function readLogoAsDataUrl(path) {
25
26
  const mime = extname(path).toLowerCase() === '.png' ? 'image/png' : 'image/jpeg';
26
27
  return `data:${mime};base64,${readFileSync(path).toString('base64')}`;
27
28
  }
28
- /** Los de testing van a una subcarpeta y con un pie que avisa que no valen, para no mezclarlos con los reales. */
29
- export function resolvePdfTargetFolder(folder, environment) {
30
- return environment === 'testing' ? join(folder, 'testing') : folder;
29
+ /**
30
+ * Una subcarpeta por CUIT emisor, para que dos emisores con el mismo punto de venta y numero no se pisen. Los de
31
+ * testing van ademas a `testing/` y con un pie que avisa que no valen, para no mezclarlos con los reales.
32
+ */
33
+ export function resolvePdfTargetFolder(folder, environment, cuit) {
34
+ return environment === 'testing' ? join(folder, 'testing', cuit) : join(folder, cuit);
31
35
  }
32
- /** Genera y guarda el PDF de un comprobante emitido. Devuelve la ruta del archivo. */
36
+ /** Genera y guarda el PDF de un comprobante emitido, sin pisar uno existente. Devuelve la ruta del archivo. */
33
37
  export async function exportBillingPdf(input) {
34
38
  const { result } = input;
35
39
  const issuer = resolvePdfIssuer(input.config, result.voucherKind.letter);
@@ -39,10 +43,21 @@ export async function exportBillingPdf(input) {
39
43
  logo: readLogoAsDataUrl(input.config.emisor.logo),
40
44
  };
41
45
  const bytes = await input.renderer.render(escapeHtmlStrings(data), options);
42
- const folder = resolvePdfTargetFolder(input.folder, result.environment);
43
- const path = join(folder, buildPdfFileName(result.voucherKind, data.puntoVenta, data.cbteDesde));
46
+ const folder = resolvePdfTargetFolder(input.folder, result.environment, issuer.cuit);
44
47
  mkdirSync(folder, { recursive: true });
45
- writeFileSync(path, bytes);
46
- return path;
48
+ return writeNewFile(join(folder, buildPdfFileName(result.voucherKind, data.puntoVenta, data.cbteDesde)), bytes);
49
+ }
50
+ /** Igual que `exportBillingPdf`, con el detalle real de WSFEX y el CUIT del pais del cliente. */
51
+ export async function exportExportacionPdf(input) {
52
+ const { result } = input;
53
+ const issuer = resolvePdfIssuer(input.config, result.voucherKind.letter);
54
+ const data = mapExportResultToPdfData(result, issuer, input.extras);
55
+ const options = {
56
+ footerText: result.environment === 'testing' ? TESTING_FOOTER : undefined,
57
+ logo: readLogoAsDataUrl(input.config.emisor.logo),
58
+ };
59
+ const bytes = await input.renderer.render(escapeHtmlStrings(data), options);
60
+ const folder = resolvePdfTargetFolder(input.folder, result.environment, issuer.cuit);
61
+ mkdirSync(folder, { recursive: true });
62
+ return writeNewFile(join(folder, buildPdfFileName(result.voucherKind, data.puntoVenta, data.cbteDesde)), bytes);
47
63
  }
48
- //# sourceMappingURL=pdf-exporter.js.map
@@ -7,15 +7,33 @@ import { findDownloadedBrowser, findSystemBrowser } from './pdf-browser.js';
7
7
  export const PDF_PLUGIN_PACKAGE = '@arcasdk/pdf';
8
8
  /** Version probada con arcli. Se sube a mano despues de revisar los PDFs que genera. */
9
9
  export const PDF_PLUGIN_VERSION = '0.2.1';
10
- const runProcessWithSpawn = (command, args, options) => new Promise((resolve) => {
10
+ /** Limites de la instalacion: con un proxy colgado, npm o la descarga no terminan nunca. */
11
+ export const NPM_INSTALL_TIMEOUT_MS = 5 * 60_000;
12
+ export const BROWSER_DOWNLOAD_TIMEOUT_MS = 15 * 60_000;
13
+ export const runProcessWithSpawn = (command, args, options) => new Promise((resolve) => {
11
14
  // En Windows npm es un .cmd y necesita shell.
12
15
  const child = spawn(command, args, { cwd: options.cwd, env: options.env, shell: process.platform === 'win32' });
13
16
  let output = '';
17
+ const timer = setTimeout(() => {
18
+ child.kill();
19
+ // Con shell, el kill no llega a los nietos y sus pipes mantendrian vivo el proceso: se sueltan.
20
+ child.stdout.destroy();
21
+ child.stderr.destroy();
22
+ child.unref();
23
+ resolve({ code: null, output, timedOut: true });
24
+ }, options.timeoutMs);
25
+ const finish = (result) => {
26
+ clearTimeout(timer);
27
+ resolve(result);
28
+ };
14
29
  child.stdout.on('data', (chunk) => (output += chunk.toString()));
15
30
  child.stderr.on('data', (chunk) => (output += chunk.toString()));
16
- child.on('error', (error) => resolve({ code: 1, output: `${output}${error.message}` }));
17
- child.on('close', (code) => resolve({ code, output }));
31
+ child.on('error', (error) => finish({ code: 1, output: `${output}${error.message}` }));
32
+ child.on('close', (code) => finish({ code, output }));
18
33
  });
34
+ function describeTimeout(timeoutMs) {
35
+ return `no termino en ${timeoutMs / 60_000} minutos y se corto`;
36
+ }
19
37
  function lastLines(output, count = 5) {
20
38
  return output.trim().split('\n').slice(-count).join('\n');
21
39
  }
@@ -86,11 +104,14 @@ export class PdfPlugin {
86
104
  '--no-audit',
87
105
  '--no-fund',
88
106
  '--save-exact',
89
- ], { cwd: this.options.path, env: this.env });
107
+ ], { cwd: this.options.path, env: this.env, timeoutMs: NPM_INSTALL_TIMEOUT_MS });
90
108
  if (result.code !== 0) {
91
- throw new PdfError('PDF_PLUGIN_INSTALL_ERROR', `npm no pudo instalar ${PDF_PLUGIN_PACKAGE}.`, {
109
+ const message = result.timedOut
110
+ ? `La instalación de ${PDF_PLUGIN_PACKAGE} ${describeTimeout(NPM_INSTALL_TIMEOUT_MS)}.`
111
+ : `npm no pudo instalar ${PDF_PLUGIN_PACKAGE}.`;
112
+ throw new PdfError('PDF_PLUGIN_INSTALL_ERROR', message, {
92
113
  details: { salida: lastLines(result.output) },
93
- suggestion: 'Revise la conexion a internet o el proxy de npm y vuelva a correr `arcli pdf instalar`.',
114
+ suggestion: 'Revisá la conexión a internet o el proxy de npm y volvé a correr `arcli pdf instalar`.',
94
115
  });
95
116
  }
96
117
  }
@@ -98,11 +119,18 @@ export class PdfPlugin {
98
119
  onStep('Descargando el navegador para generar PDFs (unos 200 MB)...');
99
120
  const require = createRequire(join(this.options.path, 'package.json'));
100
121
  const puppeteerCli = join(require.resolve('puppeteer/package.json'), '..', 'lib', 'puppeteer', 'node', 'cli.js');
101
- const result = await this.runProcess(process.execPath, [puppeteerCli, 'browsers', 'install', 'chrome-headless-shell'], { cwd: this.options.path, env: { ...this.env, PUPPETEER_CACHE_DIR: this.browsersPath } });
122
+ const result = await this.runProcess(process.execPath, [puppeteerCli, 'browsers', 'install', 'chrome-headless-shell'], {
123
+ cwd: this.options.path,
124
+ env: { ...this.env, PUPPETEER_CACHE_DIR: this.browsersPath },
125
+ timeoutMs: BROWSER_DOWNLOAD_TIMEOUT_MS,
126
+ });
102
127
  if (result.code !== 0 || !findDownloadedBrowser(this.browsersPath)) {
103
- throw new PdfError('PDF_PLUGIN_INSTALL_ERROR', 'No se pudo descargar el navegador para generar PDFs.', {
128
+ const message = result.timedOut
129
+ ? `La descarga del navegador para generar PDFs ${describeTimeout(BROWSER_DOWNLOAD_TIMEOUT_MS)}.`
130
+ : 'No se pudo descargar el navegador para generar PDFs.';
131
+ throw new PdfError('PDF_PLUGIN_INSTALL_ERROR', message, {
104
132
  details: { salida: lastLines(result.output) },
105
- suggestion: 'Si ya tiene Chrome, Chromium o Edge, indique su ruta con `arcli config establecer pdfNavegador <ruta>`.',
133
+ suggestion: 'Si ya tiene Chrome, Chromium o Edge, indicá su ruta con `arcli config establecer pdfNavegador <ruta>`.',
106
134
  });
107
135
  }
108
136
  }
@@ -115,13 +143,13 @@ export class PdfPlugin {
115
143
  const installedVersion = this.readInstalledVersion();
116
144
  if (installedVersion !== PDF_PLUGIN_VERSION) {
117
145
  throw new PdfError('PDF_PLUGIN_MISSING', installedVersion
118
- ? `El plugin de PDF esta en la version ${installedVersion} y arcli usa la ${PDF_PLUGIN_VERSION}.`
146
+ ? `El plugin de PDF está en la versión ${installedVersion} y arcli usa la ${PDF_PLUGIN_VERSION}.`
119
147
  : 'Para generar PDFs falta instalar el plugin de PDF.', { suggestion: PDF_INSTALL_SUGGESTION });
120
148
  }
121
149
  const browser = this.resolveBrowser();
122
150
  if (!browser) {
123
- throw new PdfError('PDF_PLUGIN_MISSING', 'No se encontro un navegador para generar PDFs.', {
124
- suggestion: `${PDF_INSTALL_SUGGESTION} Descarga uno, o indique Chrome con \`arcli config establecer pdfNavegador <ruta>\`.`,
151
+ throw new PdfError('PDF_PLUGIN_MISSING', 'No se encontró un navegador para generar PDFs.', {
152
+ suggestion: `${PDF_INSTALL_SUGGESTION} Descarga uno, o indicá Chrome con \`arcli config establecer pdfNavegador <ruta>\`.`,
125
153
  });
126
154
  }
127
155
  // El SDK no deja elegir el ejecutable; Puppeteer lo toma de esta variable.
@@ -134,10 +162,9 @@ export class PdfPlugin {
134
162
  return await new sdk.InvoicePdfGenerator(options).generate(data);
135
163
  }
136
164
  catch (error) {
137
- throw new PdfError('PDF_GENERATION_ERROR', `No se pudo generar el PDF: ${error instanceof Error ? error.message : String(error)}`, { suggestion: 'Si el navegador falla, pruebe con otro: `arcli config establecer pdfNavegador <ruta>`.' });
165
+ throw new PdfError('PDF_GENERATION_ERROR', `No se pudo generar el PDF: ${error instanceof Error ? error.message : String(error)}`, { suggestion: 'Si el navegador falla, probá con otro: `arcli config establecer pdfNavegador <ruta>`.' });
138
166
  }
139
167
  },
140
168
  };
141
169
  }
142
170
  }
143
- //# sourceMappingURL=pdf-plugin.js.map
@@ -0,0 +1,8 @@
1
+ import { noticePanel } from './noticePanel.js';
2
+ /**
3
+ * Aviso del certificado por vencer (amarillo) o vencido (rojo), con el link en su propia linea para que no se
4
+ * corte. Unico lugar que lo arma: lo usan los comandos, el modo interactivo y el storybook.
5
+ */
6
+ export function certificateBanner({ expired, guideUrl, summary }) {
7
+ return noticePanel(`${summary}\nRenovalo: ${guideUrl}`, expired ? 'danger' : 'warning', 'warning');
8
+ }
@@ -9,4 +9,3 @@ export function contentPanel(title, content, width = 'wide', titleColor, content
9
9
  width,
10
10
  });
11
11
  }
12
- //# sourceMappingURL=contentPanel.js.map
@@ -10,4 +10,3 @@ export function errorPanel(title, message, details = [], hint) {
10
10
  }
11
11
  return contentPanel(title, lines.join('\n'), 'standard', 'danger', 'left', 'error');
12
12
  }
13
- //# sourceMappingURL=errorPanel.js.map
@@ -1,3 +1,4 @@
1
+ export * from './certificateBanner.js';
1
2
  export * from './contentPanel.js';
2
3
  export * from './errorPanel.js';
3
4
  export * from './keyValuePanel.js';
@@ -7,4 +8,3 @@ export * from './sectionHeading.js';
7
8
  export * from './statusBar.js';
8
9
  export * from './statusPanel.js';
9
10
  export * from './testingBanner.js';
10
- //# sourceMappingURL=index.js.map
@@ -12,4 +12,3 @@ export function keyValuePanel(title, rows, footer, width = 'standard', titleColo
12
12
  width,
13
13
  });
14
14
  }
15
- //# sourceMappingURL=keyValuePanel.js.map
@@ -8,4 +8,3 @@ export function noticePanel(message, color = 'info', borderType = 'note') {
8
8
  width: 'compact',
9
9
  });
10
10
  }
11
- //# sourceMappingURL=noticePanel.js.map
@@ -2,4 +2,3 @@ import { contentPanel } from './contentPanel.js';
2
2
  export function rawPanel(title, content) {
3
3
  return contentPanel(title, content, 'wide', 'subtle', 'left', 'data');
4
4
  }
5
- //# sourceMappingURL=rawPanel.js.map
@@ -10,4 +10,3 @@ export function sectionHeading(title, color) {
10
10
  const rest = Math.max(2, width - 2 - stripAnsi(label).length);
11
11
  return `${colorize(fill.repeat(2), 'muted')}${label}${colorize(fill.repeat(rest), 'muted')}`;
12
12
  }
13
- //# sourceMappingURL=sectionHeading.js.map
@@ -30,4 +30,3 @@ export function statusBar(left, right = [], options = {}) {
30
30
  colorize(fill.repeat(2), 'muted'),
31
31
  ].join('');
32
32
  }
33
- //# sourceMappingURL=statusBar.js.map
@@ -18,4 +18,3 @@ export function statusPanel(title, rows, footer, width = 'standard', titleColor,
18
18
  width,
19
19
  });
20
20
  }
21
- //# sourceMappingURL=statusPanel.js.map
@@ -3,4 +3,3 @@ import { noticePanel } from './noticePanel.js';
3
3
  export function testingBanner() {
4
4
  return noticePanel('Estas utilizando el entorno de TESTING', 'warning', 'warning');
5
5
  }
6
- //# sourceMappingURL=testingBanner.js.map
package/dist/ui/index.js CHANGED
@@ -3,4 +3,3 @@ export * from './presenters/index.js';
3
3
  export * from './primitives/index.js';
4
4
  export * from './stream/index.js';
5
5
  export * from './theme/index.js';
6
- //# sourceMappingURL=index.js.map
@@ -1,2 +1 @@
1
1
  export { formatBillingResultAsJson, formatBillingResultAsText } from '../../modules/billing/billing.presenter.js';
2
- //# sourceMappingURL=billing.presenter.js.map
@@ -1,2 +1 @@
1
- export { formatConfig, formatConfigAsText, formatConfigDoctor, formatConfigDoctorAsText, formatConfigPath, } from '../../modules/config/config.presenter.js';
2
- //# sourceMappingURL=config.presenter.js.map
1
+ export { formatConfig, formatConfigAsText, formatConfigDoctor, formatConfigDoctorAsText, formatConfigPath, formatConfigPathAsJson, } from '../../modules/config/config.presenter.js';