arcli 0.1.2 → 1.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 (292) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/LICENSE +21 -0
  3. package/README.md +169 -4
  4. package/dist/cli/commands/billing-family.command.d.ts +2 -0
  5. package/dist/cli/commands/billing-family.command.js +30 -0
  6. package/dist/cli/commands/billing-family.command.js.map +1 -0
  7. package/dist/cli/commands/billing-shortcuts.command.d.ts +2 -0
  8. package/dist/cli/commands/billing-shortcuts.command.js +18 -0
  9. package/dist/cli/commands/billing-shortcuts.command.js.map +1 -0
  10. package/dist/cli/commands/billing.command.interactive-preview.d.ts +18 -0
  11. package/dist/cli/commands/billing.command.interactive-preview.js +69 -0
  12. package/dist/cli/commands/billing.command.interactive-preview.js.map +1 -0
  13. package/dist/cli/commands/billing.command.options.d.ts +2 -0
  14. package/dist/cli/commands/billing.command.options.js +65 -0
  15. package/dist/cli/commands/billing.command.options.js.map +1 -0
  16. package/dist/cli/commands/billing.command.output.d.ts +12 -0
  17. package/dist/cli/commands/billing.command.output.js +33 -0
  18. package/dist/cli/commands/billing.command.output.js.map +1 -0
  19. package/dist/cli/commands/billing.command.parser.d.ts +21 -0
  20. package/dist/cli/commands/billing.command.parser.js +170 -0
  21. package/dist/cli/commands/billing.command.parser.js.map +1 -0
  22. package/dist/cli/commands/billing.command.shared.d.ts +7 -0
  23. package/dist/cli/commands/billing.command.shared.js +99 -0
  24. package/dist/cli/commands/billing.command.shared.js.map +1 -0
  25. package/dist/cli/commands/billing.command.shortcuts.d.ts +7 -0
  26. package/dist/cli/commands/billing.command.shortcuts.js +52 -0
  27. package/dist/cli/commands/billing.command.shortcuts.js.map +1 -0
  28. package/dist/cli/commands/config.command.d.ts +2 -0
  29. package/dist/cli/commands/config.command.js +125 -0
  30. package/dist/cli/commands/config.command.js.map +1 -0
  31. package/dist/cli/commands/examples.command.d.ts +2 -0
  32. package/dist/cli/commands/examples.command.js +14 -0
  33. package/dist/cli/commands/examples.command.js.map +1 -0
  34. package/dist/cli/commands/fce-obligation.command.d.ts +2 -0
  35. package/dist/cli/commands/fce-obligation.command.js +51 -0
  36. package/dist/cli/commands/fce-obligation.command.js.map +1 -0
  37. package/dist/cli/commands/storybook.command.d.ts +2 -0
  38. package/dist/cli/commands/storybook.command.js +26 -0
  39. package/dist/cli/commands/storybook.command.js.map +1 -0
  40. package/dist/cli/help.d.ts +11 -0
  41. package/dist/cli/help.js +534 -0
  42. package/dist/cli/help.js.map +1 -0
  43. package/dist/cli/index.d.ts +2 -0
  44. package/dist/cli/index.js +41 -0
  45. package/dist/cli/index.js.map +1 -0
  46. package/dist/cli/program.d.ts +2 -0
  47. package/dist/cli/program.js +30 -0
  48. package/dist/cli/program.js.map +1 -0
  49. package/dist/cli/types.d.ts +6 -0
  50. package/dist/cli/types.js +2 -0
  51. package/dist/cli/types.js.map +1 -0
  52. package/dist/cli/version.d.ts +1 -0
  53. package/dist/cli/version.js +2 -0
  54. package/dist/cli/version.js.map +1 -0
  55. package/dist/index.d.ts +1 -0
  56. package/dist/index.js +2 -0
  57. package/dist/index.js.map +1 -0
  58. package/dist/lib/dates/arca-date.d.ts +6 -0
  59. package/dist/lib/dates/arca-date.js +45 -0
  60. package/dist/lib/dates/arca-date.js.map +1 -0
  61. package/dist/lib/errors/app-error.d.ts +14 -0
  62. package/dist/lib/errors/app-error.js +29 -0
  63. package/dist/lib/errors/app-error.js.map +1 -0
  64. package/dist/lib/files/read-json-file.d.ts +1 -0
  65. package/dist/lib/files/read-json-file.js +21 -0
  66. package/dist/lib/files/read-json-file.js.map +1 -0
  67. package/dist/lib/paths/mask-path.d.ts +1 -0
  68. package/dist/lib/paths/mask-path.js +17 -0
  69. package/dist/lib/paths/mask-path.js.map +1 -0
  70. package/dist/lib/security/certificate.d.ts +7 -0
  71. package/dist/lib/security/certificate.js +16 -0
  72. package/dist/lib/security/certificate.js.map +1 -0
  73. package/dist/lib/security/pem.d.ts +5 -0
  74. package/dist/lib/security/pem.js +36 -0
  75. package/dist/lib/security/pem.js.map +1 -0
  76. package/dist/modules/billing/billing-response.d.ts +4 -0
  77. package/dist/modules/billing/billing-response.js +74 -0
  78. package/dist/modules/billing/billing-response.js.map +1 -0
  79. package/dist/modules/billing/billing.amounts.d.ts +19 -0
  80. package/dist/modules/billing/billing.amounts.js +72 -0
  81. package/dist/modules/billing/billing.amounts.js.map +1 -0
  82. package/dist/modules/billing/billing.associated-period.d.ts +8 -0
  83. package/dist/modules/billing/billing.associated-period.js +40 -0
  84. package/dist/modules/billing/billing.associated-period.js.map +1 -0
  85. package/dist/modules/billing/billing.associated-vouchers.d.ts +12 -0
  86. package/dist/modules/billing/billing.associated-vouchers.js +73 -0
  87. package/dist/modules/billing/billing.associated-vouchers.js.map +1 -0
  88. package/dist/modules/billing/billing.constants.d.ts +2 -0
  89. package/dist/modules/billing/billing.constants.js +3 -0
  90. package/dist/modules/billing/billing.constants.js.map +1 -0
  91. package/dist/modules/billing/billing.currency.d.ts +18 -0
  92. package/dist/modules/billing/billing.currency.js +53 -0
  93. package/dist/modules/billing/billing.currency.js.map +1 -0
  94. package/dist/modules/billing/billing.date-range.d.ts +9 -0
  95. package/dist/modules/billing/billing.date-range.js +52 -0
  96. package/dist/modules/billing/billing.date-range.js.map +1 -0
  97. package/dist/modules/billing/billing.display.d.ts +13 -0
  98. package/dist/modules/billing/billing.display.js +137 -0
  99. package/dist/modules/billing/billing.display.js.map +1 -0
  100. package/dist/modules/billing/billing.fce.d.ts +21 -0
  101. package/dist/modules/billing/billing.fce.js +59 -0
  102. package/dist/modules/billing/billing.fce.js.map +1 -0
  103. package/dist/modules/billing/billing.iva-receptor.d.ts +7 -0
  104. package/dist/modules/billing/billing.iva-receptor.js +58 -0
  105. package/dist/modules/billing/billing.iva-receptor.js.map +1 -0
  106. package/dist/modules/billing/billing.json-format.d.ts +6 -0
  107. package/dist/modules/billing/billing.json-format.js +5 -0
  108. package/dist/modules/billing/billing.json-format.js.map +1 -0
  109. package/dist/modules/billing/billing.labels.d.ts +9 -0
  110. package/dist/modules/billing/billing.labels.js +108 -0
  111. package/dist/modules/billing/billing.labels.js.map +1 -0
  112. package/dist/modules/billing/billing.mappers.d.ts +8 -0
  113. package/dist/modules/billing/billing.mappers.js +60 -0
  114. package/dist/modules/billing/billing.mappers.js.map +1 -0
  115. package/dist/modules/billing/billing.presenter.d.ts +7 -0
  116. package/dist/modules/billing/billing.presenter.js +3 -0
  117. package/dist/modules/billing/billing.presenter.js.map +1 -0
  118. package/dist/modules/billing/billing.schemas.d.ts +107 -0
  119. package/dist/modules/billing/billing.schemas.js +106 -0
  120. package/dist/modules/billing/billing.schemas.js.map +1 -0
  121. package/dist/modules/billing/billing.serialize.d.ts +8 -0
  122. package/dist/modules/billing/billing.serialize.js +53 -0
  123. package/dist/modules/billing/billing.serialize.js.map +1 -0
  124. package/dist/modules/billing/billing.service.d.ts +27 -0
  125. package/dist/modules/billing/billing.service.js +146 -0
  126. package/dist/modules/billing/billing.service.js.map +1 -0
  127. package/dist/modules/billing/billing.text.d.ts +8 -0
  128. package/dist/modules/billing/billing.text.js +52 -0
  129. package/dist/modules/billing/billing.text.js.map +1 -0
  130. package/dist/modules/billing/billing.types.d.ts +13 -0
  131. package/dist/modules/billing/billing.types.internal.d.ts +27 -0
  132. package/dist/modules/billing/billing.types.internal.js +2 -0
  133. package/dist/modules/billing/billing.types.internal.js.map +1 -0
  134. package/dist/modules/billing/billing.types.js +2 -0
  135. package/dist/modules/billing/billing.types.js.map +1 -0
  136. package/dist/modules/billing/billing.validation.d.ts +7 -0
  137. package/dist/modules/billing/billing.validation.js +80 -0
  138. package/dist/modules/billing/billing.validation.js.map +1 -0
  139. package/dist/modules/billing/voucher-kind-map.d.ts +9 -0
  140. package/dist/modules/billing/voucher-kind-map.js +180 -0
  141. package/dist/modules/billing/voucher-kind-map.js.map +1 -0
  142. package/dist/modules/config/config-doctor.d.ts +15 -0
  143. package/dist/modules/config/config-doctor.js +125 -0
  144. package/dist/modules/config/config-doctor.js.map +1 -0
  145. package/dist/modules/config/config-value-parser.d.ts +2 -0
  146. package/dist/modules/config/config-value-parser.js +99 -0
  147. package/dist/modules/config/config-value-parser.js.map +1 -0
  148. package/dist/modules/config/config.presenter.d.ts +7 -0
  149. package/dist/modules/config/config.presenter.js +88 -0
  150. package/dist/modules/config/config.presenter.js.map +1 -0
  151. package/dist/modules/config/config.schemas.d.ts +110 -0
  152. package/dist/modules/config/config.schemas.js +103 -0
  153. package/dist/modules/config/config.schemas.js.map +1 -0
  154. package/dist/modules/config/config.service.d.ts +20 -0
  155. package/dist/modules/config/config.service.js +82 -0
  156. package/dist/modules/config/config.service.js.map +1 -0
  157. package/dist/modules/examples/examples.d.ts +1 -0
  158. package/dist/modules/examples/examples.js +191 -0
  159. package/dist/modules/examples/examples.js.map +1 -0
  160. package/dist/modules/fce/fce-obligation.d.ts +20 -0
  161. package/dist/modules/fce/fce-obligation.js +33 -0
  162. package/dist/modules/fce/fce-obligation.js.map +1 -0
  163. package/dist/modules/fce/fce-obligation.presenter.d.ts +9 -0
  164. package/dist/modules/fce/fce-obligation.presenter.js +32 -0
  165. package/dist/modules/fce/fce-obligation.presenter.js.map +1 -0
  166. package/dist/modules/storybook/showcase-theme.d.ts +7 -0
  167. package/dist/modules/storybook/showcase-theme.js +6 -0
  168. package/dist/modules/storybook/showcase-theme.js.map +1 -0
  169. package/dist/modules/storybook/showcase.d.ts +2 -0
  170. package/dist/modules/storybook/showcase.js +310 -0
  171. package/dist/modules/storybook/showcase.js.map +1 -0
  172. package/dist/modules/update-check/update-check.presenter.d.ts +2 -0
  173. package/dist/modules/update-check/update-check.presenter.js +6 -0
  174. package/dist/modules/update-check/update-check.presenter.js.map +1 -0
  175. package/dist/modules/update-check/update-check.service.d.ts +8 -0
  176. package/dist/modules/update-check/update-check.service.js +72 -0
  177. package/dist/modules/update-check/update-check.service.js.map +1 -0
  178. package/dist/services/arca/arca-billing.gateway.d.ts +10 -0
  179. package/dist/services/arca/arca-billing.gateway.js +22 -0
  180. package/dist/services/arca/arca-billing.gateway.js.map +1 -0
  181. package/dist/services/arca/arca-client.factory.d.ts +5 -0
  182. package/dist/services/arca/arca-client.factory.js +7 -0
  183. package/dist/services/arca/arca-client.factory.js.map +1 -0
  184. package/dist/services/arca/arca-context.resolver.d.ts +44 -0
  185. package/dist/services/arca/arca-context.resolver.js +120 -0
  186. package/dist/services/arca/arca-context.resolver.js.map +1 -0
  187. package/dist/services/arca/arca-fce-obligation.gateway.d.ts +7 -0
  188. package/dist/services/arca/arca-fce-obligation.gateway.js +36 -0
  189. package/dist/services/arca/arca-fce-obligation.gateway.js.map +1 -0
  190. package/dist/ui/components/contentPanel.d.ts +5 -0
  191. package/dist/ui/components/contentPanel.js +11 -0
  192. package/dist/ui/components/contentPanel.js.map +1 -0
  193. package/dist/ui/components/errorPanel.d.ts +1 -0
  194. package/dist/ui/components/errorPanel.js +13 -0
  195. package/dist/ui/components/errorPanel.js.map +1 -0
  196. package/dist/ui/components/index.d.ts +6 -0
  197. package/dist/ui/components/index.js +7 -0
  198. package/dist/ui/components/index.js.map +1 -0
  199. package/dist/ui/components/keyValuePanel.d.ts +3 -0
  200. package/dist/ui/components/keyValuePanel.js +14 -0
  201. package/dist/ui/components/keyValuePanel.js.map +1 -0
  202. package/dist/ui/components/noticePanel.d.ts +3 -0
  203. package/dist/ui/components/noticePanel.js +11 -0
  204. package/dist/ui/components/noticePanel.js.map +1 -0
  205. package/dist/ui/components/rawPanel.d.ts +1 -0
  206. package/dist/ui/components/rawPanel.js +5 -0
  207. package/dist/ui/components/rawPanel.js.map +1 -0
  208. package/dist/ui/components/statusPanel.d.ts +3 -0
  209. package/dist/ui/components/statusPanel.js +20 -0
  210. package/dist/ui/components/statusPanel.js.map +1 -0
  211. package/dist/ui/index.d.ts +5 -0
  212. package/dist/ui/index.js +6 -0
  213. package/dist/ui/index.js.map +1 -0
  214. package/dist/ui/presenters/billing.presenter.d.ts +2 -0
  215. package/dist/ui/presenters/billing.presenter.js +2 -0
  216. package/dist/ui/presenters/billing.presenter.js.map +1 -0
  217. package/dist/ui/presenters/config.presenter.d.ts +1 -0
  218. package/dist/ui/presenters/config.presenter.js +2 -0
  219. package/dist/ui/presenters/config.presenter.js.map +1 -0
  220. package/dist/ui/presenters/errors.presenter.d.ts +1 -0
  221. package/dist/ui/presenters/errors.presenter.js +89 -0
  222. package/dist/ui/presenters/errors.presenter.js.map +1 -0
  223. package/dist/ui/presenters/errors.zod-presenter.d.ts +2 -0
  224. package/dist/ui/presenters/errors.zod-presenter.js +103 -0
  225. package/dist/ui/presenters/errors.zod-presenter.js.map +1 -0
  226. package/dist/ui/presenters/index.d.ts +4 -0
  227. package/dist/ui/presenters/index.js +5 -0
  228. package/dist/ui/presenters/index.js.map +1 -0
  229. package/dist/ui/presenters/showcase.presenter.d.ts +1 -0
  230. package/dist/ui/presenters/showcase.presenter.js +2 -0
  231. package/dist/ui/presenters/showcase.presenter.js.map +1 -0
  232. package/dist/ui/primitives/index.d.ts +10 -0
  233. package/dist/ui/primitives/index.js +11 -0
  234. package/dist/ui/primitives/index.js.map +1 -0
  235. package/dist/ui/primitives/renderDivider.d.ts +5 -0
  236. package/dist/ui/primitives/renderDivider.js +5 -0
  237. package/dist/ui/primitives/renderDivider.js.map +1 -0
  238. package/dist/ui/primitives/renderFooter.d.ts +7 -0
  239. package/dist/ui/primitives/renderFooter.js +6 -0
  240. package/dist/ui/primitives/renderFooter.js.map +1 -0
  241. package/dist/ui/primitives/renderJson.d.ts +3 -0
  242. package/dist/ui/primitives/renderJson.js +19 -0
  243. package/dist/ui/primitives/renderJson.js.map +1 -0
  244. package/dist/ui/primitives/renderKeyValue.d.ts +14 -0
  245. package/dist/ui/primitives/renderKeyValue.js +34 -0
  246. package/dist/ui/primitives/renderKeyValue.js.map +1 -0
  247. package/dist/ui/primitives/renderLogo.d.ts +2 -0
  248. package/dist/ui/primitives/renderLogo.js +28 -0
  249. package/dist/ui/primitives/renderLogo.js.map +1 -0
  250. package/dist/ui/primitives/renderObject.d.ts +1 -0
  251. package/dist/ui/primitives/renderObject.js +19 -0
  252. package/dist/ui/primitives/renderObject.js.map +1 -0
  253. package/dist/ui/primitives/renderPanel.d.ts +23 -0
  254. package/dist/ui/primitives/renderPanel.js +114 -0
  255. package/dist/ui/primitives/renderPanel.js.map +1 -0
  256. package/dist/ui/primitives/renderSubtitle.d.ts +7 -0
  257. package/dist/ui/primitives/renderSubtitle.js +6 -0
  258. package/dist/ui/primitives/renderSubtitle.js.map +1 -0
  259. package/dist/ui/primitives/renderTable.d.ts +6 -0
  260. package/dist/ui/primitives/renderTable.js +14 -0
  261. package/dist/ui/primitives/renderTable.js.map +1 -0
  262. package/dist/ui/primitives/text.d.ts +18 -0
  263. package/dist/ui/primitives/text.js +154 -0
  264. package/dist/ui/primitives/text.js.map +1 -0
  265. package/dist/ui/stream/index.d.ts +1 -0
  266. package/dist/ui/stream/index.js +2 -0
  267. package/dist/ui/stream/index.js.map +1 -0
  268. package/dist/ui/stream/terminal-stream.d.ts +10 -0
  269. package/dist/ui/stream/terminal-stream.js +20 -0
  270. package/dist/ui/stream/terminal-stream.js.map +1 -0
  271. package/dist/ui/theme/index.d.ts +1 -0
  272. package/dist/ui/theme/index.js +2 -0
  273. package/dist/ui/theme/index.js.map +1 -0
  274. package/dist/ui/theme/theme.d.ts +27 -0
  275. package/dist/ui/theme/theme.js +41 -0
  276. package/dist/ui/theme/theme.js.map +1 -0
  277. package/llms.txt +161 -0
  278. package/package.json +99 -35
  279. package/.babelrc +0 -4
  280. package/.eslintignore +0 -1
  281. package/.eslintrc.js +0 -17
  282. package/.npmignore +0 -1
  283. package/lib/arcli.js +0 -275
  284. package/lib/arcli.min.js +0 -1
  285. package/src/config.js +0 -22
  286. package/src/consoler.js +0 -10
  287. package/src/index.js +0 -21
  288. package/src/init.js +0 -13
  289. package/src/run.js +0 -4
  290. package/src/spinner.js +0 -39
  291. package/tst/index.js +0 -26
  292. package/webpack.config.js +0 -47
@@ -0,0 +1,170 @@
1
+ import { InputValidationError } from '../../lib/errors/app-error.js';
2
+ import { readJsonFile } from '../../lib/files/read-json-file.js';
3
+ import { isForeignCurrency } from '../../modules/billing/billing.currency.js';
4
+ import { billingCommandSchema } from '../../modules/billing/billing.schemas.js';
5
+ import { getVoucherKindByShortcut } from '../../modules/billing/voucher-kind-map.js';
6
+ import { resolveConceptShortcut, resolveDocumentIdentity, resolveIvaShortcut } from './billing.command.shortcuts.js';
7
+ export { registerBillingOptions } from './billing.command.options.js';
8
+ function pickString(...values) {
9
+ return values.find((value) => typeof value === 'string');
10
+ }
11
+ function pickNumber(...values) {
12
+ return values.find((value) => typeof value === 'number');
13
+ }
14
+ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaults = {}) {
15
+ const commandOptions = command.optsWithGlobals();
16
+ const emitirSource = command.getOptionValueSource('emitir');
17
+ const previsualizarSource = command.getOptionValueSource('previsualizar');
18
+ const hasAssociatedShortcut = typeof commandOptions.ac === 'string';
19
+ const hasAssociatedType = typeof commandOptions.at === 'number';
20
+ if (hasAssociatedShortcut && hasAssociatedType) {
21
+ throw new InputValidationError('Use --ac o --at para identificar el comprobante asociado, pero no ambos a la vez.');
22
+ }
23
+ const associatedVoucherFromFlags = commandOptions.ar ||
24
+ commandOptions.apv ||
25
+ commandOptions.asociadoPuntoVenta ||
26
+ commandOptions.at ||
27
+ commandOptions.acuit ||
28
+ commandOptions.afecha ||
29
+ commandOptions.ac
30
+ ? {
31
+ cuit: pickString(commandOptions.acuit),
32
+ fecha: pickString(commandOptions.afecha),
33
+ numero: pickNumber(commandOptions.ar),
34
+ puntoVenta: pickNumber(commandOptions.apv, commandOptions.asociadoPuntoVenta),
35
+ shortcut: pickString(commandOptions.ac),
36
+ tipo: pickNumber(commandOptions.at),
37
+ }
38
+ : undefined;
39
+ const modeSource = emitirSource === 'cli' || previsualizarSource === 'cli'
40
+ ? 'flags'
41
+ : typeof fileInput?.emitir === 'boolean' || typeof fileInput?.previsualizar === 'boolean'
42
+ ? 'file'
43
+ : 'default';
44
+ const shouldEmit = emitirSource === 'cli'
45
+ ? Boolean(commandOptions.emitir)
46
+ : typeof fileInput?.emitir === 'boolean'
47
+ ? fileInput.emitir
48
+ : Boolean(defaults.defaultEmit);
49
+ const shouldDryRun = previsualizarSource === 'cli'
50
+ ? Boolean(commandOptions.previsualizar)
51
+ : typeof fileInput?.previsualizar === 'boolean'
52
+ ? fileInput.previsualizar
53
+ : !shouldEmit;
54
+ const conceptShortcut = resolveConceptShortcut(commandOptions);
55
+ const documentIdentity = resolveDocumentIdentity(commandOptions);
56
+ const ivaShortcut = resolveIvaShortcut(commandOptions);
57
+ const resolvedConcept = pickString(commandOptions.concepto) ?? conceptShortcut ?? fileInput?.concepto ?? defaults.defaultConcept;
58
+ const resolvedIvaCondition = pickString(commandOptions.ivaReceptor, commandOptions.ir) ??
59
+ ivaShortcut ??
60
+ fileInput?.ivaReceptor ??
61
+ defaults.defaultIvaCondition;
62
+ if (typeof commandOptions.concepto === 'string' && conceptShortcut) {
63
+ throw new InputValidationError('Use --concepto o un flag corto de concepto (--cs, --cp, --csp), pero no ambos.');
64
+ }
65
+ if (typeof commandOptions.ivaReceptor === 'string' && typeof commandOptions.ir === 'string') {
66
+ throw new InputValidationError('Use --iva-receptor o --ir para indicar IVA receptor, pero no ambos.');
67
+ }
68
+ if ((typeof commandOptions.ivaReceptor === 'string' || typeof commandOptions.ir === 'string') && ivaShortcut) {
69
+ throw new InputValidationError('Use --iva-receptor, --ir o un flag corto --ir-*, pero no varios a la vez.');
70
+ }
71
+ if (shouldEmit && shouldDryRun) {
72
+ throw new InputValidationError('Use --emitir o --previsualizar, pero no ambos a la vez.');
73
+ }
74
+ if (!resolvedConcept) {
75
+ throw new InputValidationError('Falta el concepto. Use --concepto <tipo>, o bien --cs/--cp/--csp, o configure uno por defecto con "arcli config establecer concepto servicios".');
76
+ }
77
+ if (!resolvedIvaCondition) {
78
+ throw new InputValidationError('Falta IVA receptor. Use --iva-receptor <tipo>, --ir <tipo>, un flag --ir-*, o configure uno por defecto con "arcli config establecer ivaReceptor consumidor-final".');
79
+ }
80
+ const associatedVoucherFromFile = fileInput?.comprobanteAsociado
81
+ ? {
82
+ cuit: fileInput.comprobanteAsociado.cuit,
83
+ fecha: fileInput.comprobanteAsociado.fecha,
84
+ numero: fileInput.comprobanteAsociado.numero,
85
+ puntoVenta: fileInput.comprobanteAsociado.puntoVenta,
86
+ shortcut: fileInput.comprobanteAsociado.atajo,
87
+ tipo: fileInput.comprobanteAsociado.tipo,
88
+ }
89
+ : undefined;
90
+ const currencyCode = pickString(commandOptions.moneda, commandOptions.mda, fileInput?.codigoMoneda, defaults.defaultCurrencyCode);
91
+ const sameCurrency = commandOptions.mismaMoneda === true || fileInput?.mismaMoneda === true;
92
+ const explicitExchangeRate = pickNumber(commandOptions.cotizacionMoneda, commandOptions.cm, fileInput?.cotizacionMoneda);
93
+ if (sameCurrency && typeof explicitExchangeRate === 'number') {
94
+ throw new InputValidationError('Con --misma-moneda la cotizacion se toma de ARCA. Quite --cotizacion-moneda o --cm.');
95
+ }
96
+ // La cotizacion por defecto de la config solo aplica a moneda extranjera sin --misma-moneda.
97
+ const exchangeRate = explicitExchangeRate ??
98
+ (!sameCurrency && isForeignCurrency({ currencyCode }) ? defaults.defaultExchangeRate : undefined);
99
+ // El CBU de la config solo aplica a facturas FCE: ARCA rechaza esos opcionales en otros comprobantes (10169).
100
+ const voucherKind = getVoucherKindByShortcut(shortcut);
101
+ const usesFceDefaults = voucherKind?.family === 'factura-credito-electronica';
102
+ // La C no discrimina IVA: la alicuota de la config solo aplica a A y B.
103
+ const usesIvaRateDefault = voucherKind?.letter !== 'c';
104
+ const periodFrom = pickString(commandOptions.periodoDesde, commandOptions.pd);
105
+ const periodTo = pickString(commandOptions.periodoHasta, commandOptions.ph);
106
+ const associatedPeriod = periodFrom || periodTo ? { desde: periodFrom, hasta: periodTo } : fileInput?.periodoAsociado;
107
+ return {
108
+ ...billingCommandSchema.parse({
109
+ associatedPeriod,
110
+ associatedVoucher: associatedVoucherFromFlags ?? associatedVoucherFromFile,
111
+ billingDate: pickString(commandOptions.fecha, fileInput?.fechaComprobante),
112
+ cancellation: commandOptions.anulacion === true || fileInput?.anulacion === true,
113
+ cbu: pickString(commandOptions.cbu, fileInput?.cbu, usesFceDefaults ? defaults.defaultCbu : undefined),
114
+ cbuAlias: pickString(commandOptions.alias, fileInput?.aliasCbu, usesFceDefaults ? defaults.defaultCbuAlias : undefined),
115
+ concept: resolvedConcept,
116
+ currencyCode,
117
+ documentNumber: documentIdentity.documentNumber ?? fileInput?.numeroDocumento,
118
+ documentType: documentIdentity.documentType ?? fileInput?.tipoDocumento,
119
+ dryRun: shouldDryRun,
120
+ dueDay: pickNumber(commandOptions.dia, fileInput?.dia),
121
+ emit: shouldEmit,
122
+ exchangeRate,
123
+ exemptAmount: pickNumber(commandOptions.exento, fileInput?.importeExento),
124
+ ivaRate: pickString(commandOptions.alicuota) ??
125
+ fileInput?.alicuotaIva ??
126
+ (usesIvaRateDefault ? defaults.defaultIvaRate : undefined),
127
+ ivaCondition: resolvedIvaCondition,
128
+ paymentDueDate: pickString(commandOptions.vencimiento, commandOptions.vto, fileInput?.vencimientoPago),
129
+ pointOfSale: pickNumber(commandOptions.puntoVenta, commandOptions.pv, fileInput?.puntoVenta),
130
+ sameCurrency,
131
+ serviceEndDate: pickString(commandOptions.servicioHasta, commandOptions.sh, fileInput?.servicioHasta),
132
+ serviceStartDate: pickString(commandOptions.servicioDesde, commandOptions.sd, fileInput?.servicioDesde),
133
+ shortcut,
134
+ totalAmount: pickNumber(commandOptions.monto, fileInput?.montoTotal),
135
+ transferMode: pickString(commandOptions.transferencia, fileInput?.transferencia),
136
+ untaxedAmount: pickNumber(commandOptions.nogravado, fileInput?.importeNoGravado),
137
+ }),
138
+ __modeSource: modeSource,
139
+ };
140
+ }
141
+ export function parseBillingCommandPlan(command, shortcut, defaults = {}) {
142
+ const commandOptions = command.optsWithGlobals();
143
+ const inputFilePath = typeof commandOptions.cargar === 'string' ? commandOptions.cargar : undefined;
144
+ const fileInputSource = inputFilePath ? readJsonFile(inputFilePath) : undefined;
145
+ const fileInputs = Array.isArray(fileInputSource) ? fileInputSource : [fileInputSource].filter(Boolean);
146
+ if (fileInputs.length === 0) {
147
+ const { __modeSource, ...input } = parseBillingCommandInputFromSource(command, shortcut, undefined, defaults);
148
+ return {
149
+ inputs: [input],
150
+ modeSource: __modeSource,
151
+ };
152
+ }
153
+ const inputs = fileInputs.map((fileInput) => parseBillingCommandInputFromSource(command, shortcut, fileInput, defaults));
154
+ const modeSource = inputs.some((input) => input.__modeSource === 'flags')
155
+ ? 'flags'
156
+ : inputs.some((input) => input.__modeSource === 'file')
157
+ ? 'file'
158
+ : 'default';
159
+ return {
160
+ inputs: inputs.map(({ __modeSource: _modeSource, ...input }) => input),
161
+ modeSource,
162
+ };
163
+ }
164
+ export function parseBillingCommandInputs(command, shortcut, defaults = {}) {
165
+ return parseBillingCommandPlan(command, shortcut, defaults).inputs;
166
+ }
167
+ export function parseBillingCommandInput(command, shortcut, defaults = {}) {
168
+ return parseBillingCommandInputs(command, shortcut, defaults)[0];
169
+ }
170
+ //# sourceMappingURL=billing.command.parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing.command.parser.js","sourceRoot":"","sources":["../../../src/cli/commands/billing.command.parser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAA4B,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAEvG,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAElF,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC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MAAM,UAAU,wBAAwB,CACtC,OAAgB,EAChB,QAAyB,EACzB,WAAmC,EAAE;IAErC,OAAO,yBAAyB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACnE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { Command } from 'commander';
2
+ import type { VoucherShortcut } from '../../modules/billing/billing.types';
3
+ import type { GlobalCliOptions } from '../types';
4
+ export declare function registerGlobalOptions(command: Command): void;
5
+ export declare function registerBillingCommandOptions(command: Command): void;
6
+ export declare function getGlobalOptions(command: Command): GlobalCliOptions;
7
+ export declare function executeBillingCommand(command: Command, shortcut: VoucherShortcut): Promise<void>;
@@ -0,0 +1,99 @@
1
+ import ora from 'ora';
2
+ import { BillingService } from '../../modules/billing/billing.service.js';
3
+ import { getVoucherKindByShortcut } from '../../modules/billing/voucher-kind-map.js';
4
+ import { ArcaBillingGateway } from '../../services/arca/arca-billing.gateway.js';
5
+ import { ArcaClientFactory } from '../../services/arca/arca-client.factory.js';
6
+ import { ArcaContextResolver } from '../../services/arca/arca-context.resolver.js';
7
+ import { ArcaFceObligationGateway } from '../../services/arca/arca-fce-obligation.gateway.js';
8
+ import { runInteractiveBillingPreview } from './billing.command.interactive-preview.js';
9
+ import { writeBillingCommandResults } from './billing.command.output.js';
10
+ import { parseBillingCommandPlan, registerBillingOptions } from './billing.command.parser.js';
11
+ export function registerGlobalOptions(command) {
12
+ command
13
+ .option('--testing', 'usar entorno de testing en esta ejecucion')
14
+ .option('--produccion', 'usar entorno de produccion en esta ejecucion')
15
+ .option('--json', 'imprimir salida JSON')
16
+ .option('--bruto', 'mostrar la respuesta bruta de ARCA cuando exista');
17
+ }
18
+ export function registerBillingCommandOptions(command) {
19
+ registerGlobalOptions(command);
20
+ registerBillingOptions(command);
21
+ }
22
+ export function getGlobalOptions(command) {
23
+ return command.optsWithGlobals();
24
+ }
25
+ async function resolveFceWarnings(inputs, service, gateway) {
26
+ const warnings = [];
27
+ // Secuencial a proposito: cada consulta a wsfecred reutiliza el mismo ticket WSAA.
28
+ for (const input of inputs) {
29
+ warnings.push(await service.resolveFceWarnings(input, gateway));
30
+ }
31
+ return warnings;
32
+ }
33
+ export async function executeBillingCommand(command, shortcut) {
34
+ const globalOptions = getGlobalOptions(command);
35
+ let spinner = null;
36
+ const voucherKind = getVoucherKindByShortcut(shortcut);
37
+ try {
38
+ const runtime = new ArcaContextResolver({ options: globalOptions }).resolve();
39
+ const plan = parseBillingCommandPlan(command, shortcut, {
40
+ defaultCbu: runtime.config.cbu,
41
+ defaultCbuAlias: runtime.config.aliasCbu,
42
+ defaultConcept: runtime.config.conceptoPorDefecto,
43
+ defaultCurrencyCode: runtime.config.monedaPorDefecto,
44
+ defaultEmit: runtime.config.output.emitirPorDefecto,
45
+ defaultExchangeRate: runtime.config.cotizacionPorDefecto,
46
+ defaultIvaCondition: runtime.config.ivaReceptorPorDefecto,
47
+ defaultIvaRate: runtime.config.alicuotaPorDefecto,
48
+ });
49
+ const service = new BillingService();
50
+ const arca = new ArcaClientFactory().create(runtime);
51
+ const gateway = new ArcaBillingGateway(arca);
52
+ const useRaw = typeof globalOptions.bruto === 'boolean' ? globalOptions.bruto : runtime.outputRaw;
53
+ const plannedInputs = [];
54
+ for (const input of plan.inputs) {
55
+ plannedInputs.push(await service.resolveExchangeRate(input, gateway));
56
+ }
57
+ const warnings = runtime.config.verificarFce
58
+ ? await resolveFceWarnings(plannedInputs, service, new ArcaFceObligationGateway(arca))
59
+ : [];
60
+ const preview = await runInteractiveBillingPreview({
61
+ inputs: plannedInputs,
62
+ modeSource: plan.modeSource,
63
+ runtime,
64
+ service,
65
+ useRaw,
66
+ voucherLabel: voucherKind?.displayName ?? 'este comprobante',
67
+ warnings,
68
+ });
69
+ if (!preview.proceed) {
70
+ return;
71
+ }
72
+ const { inputs, previewShown } = preview;
73
+ spinner = !runtime.outputJson && process.stdout.isTTY ? ora('Procesando comprobante...').start() : null;
74
+ if (spinner) {
75
+ spinner.text = inputs.length > 1 ? `Procesando ${inputs.length} comprobantes...` : 'Procesando comprobante...';
76
+ }
77
+ const results = [];
78
+ for (const [index, input] of inputs.entries()) {
79
+ results.push(await service.execute({
80
+ gateway,
81
+ input,
82
+ runtime,
83
+ warnings: warnings[index],
84
+ }));
85
+ }
86
+ spinner?.stop();
87
+ writeBillingCommandResults(results, {
88
+ environment: runtime.environment,
89
+ outputJson: runtime.outputJson,
90
+ previewShown,
91
+ raw: useRaw,
92
+ });
93
+ }
94
+ catch (error) {
95
+ spinner?.stop();
96
+ throw error;
97
+ }
98
+ }
99
+ //# sourceMappingURL=billing.command.shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing.command.shared.js","sourceRoot":"","sources":["../../../src/cli/commands/billing.command.shared.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAGvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAElF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAG3F,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAE3F,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,OAAO;SACJ,MAAM,CAAC,WAAW,EAAE,2CAA2C,CAAC;SAChE,MAAM,CAAC,cAAc,EAAE,8CAA8C,CAAC;SACtE,MAAM,CAAC,QAAQ,EAAE,sBAAsB,CAAC;SACxC,MAAM,CA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AE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;QAEzC,OAAO,GAAG,CAAC,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAExG,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,MAAM,CAAC,MAAM,kBAAkB,CAAC,CAAC,CAAC,2BAA2B,CAAC;QACjH,CAAC;QAED,MAAM,OAAO,GAA6B,EAAE,CAAC;QAE7C,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;YAC9C,OAAO,CAAC,IAAI,CACV,MAAM,OAAO,CAAC,OAAO,CAAC;gBACpB,OAAO;gBACP,KAAK;gBACL,OAAO;gBACP,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC;aAC1B,CAAC,CACH,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,CAAC;QAEhB,0BAA0B,CAAC,OAAO,EAAE;YAClC,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,YAAY;YACZ,GAAG,EAAE,MAAM;SACZ,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,IAAI,EAAE,CAAC;QAChB,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { BillingCommandInput } from '../../modules/billing/billing.schemas';
2
+ export declare function resolveIvaShortcut(commandOptions: Record<string, unknown>): BillingCommandInput['ivaCondition'] | undefined;
3
+ export declare function resolveDocumentIdentity(commandOptions: Record<string, unknown>): {
4
+ readonly documentNumber?: number;
5
+ readonly documentType?: BillingCommandInput['documentType'];
6
+ };
7
+ export declare function resolveConceptShortcut(commandOptions: Record<string, unknown>): BillingCommandInput['concept'] | undefined;
@@ -0,0 +1,52 @@
1
+ import { InputValidationError } from '../../lib/errors/app-error.js';
2
+ export function resolveIvaShortcut(commandOptions) {
3
+ const shortcuts = [
4
+ commandOptions.irCe ? 'cliente-del-exterior' : null,
5
+ commandOptions.irCf ? 'consumidor-final' : null,
6
+ commandOptions.irIl ? 'iva-liberado' : null,
7
+ commandOptions.irIna ? 'iva-no-alcanzado' : null,
8
+ commandOptions.irMs ? 'monotributista-social' : null,
9
+ commandOptions.irMtip ? 'monotributo-trabajador-independiente-promovido' : null,
10
+ commandOptions.irPe ? 'proveedor-del-exterior' : null,
11
+ commandOptions.irRi ? 'responsable-inscripto' : null,
12
+ commandOptions.irRm ? 'responsable-monotributo' : null,
13
+ commandOptions.irSe ? 'sujeto-exento' : null,
14
+ commandOptions.irSnc ? 'sujeto-no-categorizado' : null,
15
+ ].filter(Boolean);
16
+ if (shortcuts.length > 1) {
17
+ throw new InputValidationError('Use solo un flag de IVA receptor entre las opciones --ir-*.');
18
+ }
19
+ return shortcuts[0];
20
+ }
21
+ export function resolveDocumentIdentity(commandOptions) {
22
+ const candidates = [
23
+ typeof commandOptions.cuit === 'number'
24
+ ? { documentNumber: commandOptions.cuit, documentType: 'cuit' }
25
+ : null,
26
+ typeof commandOptions.cuil === 'number'
27
+ ? { documentNumber: commandOptions.cuil, documentType: 'cuil' }
28
+ : null,
29
+ typeof commandOptions.dni === 'number'
30
+ ? { documentNumber: commandOptions.dni, documentType: 'dni' }
31
+ : null,
32
+ commandOptions.cfinal || commandOptions.consumidorFinal
33
+ ? { documentNumber: 0, documentType: 'consumidor-final' }
34
+ : null,
35
+ ].filter(Boolean);
36
+ if (candidates.length > 1) {
37
+ throw new InputValidationError('Use solo una identidad de receptor: --cuit, --cuil, --dni, --consumidor-final o --cfinal.');
38
+ }
39
+ return candidates[0] ?? {};
40
+ }
41
+ export function resolveConceptShortcut(commandOptions) {
42
+ const shortcutConcepts = [
43
+ commandOptions.cs ? 'servicios' : null,
44
+ commandOptions.cp ? 'productos' : null,
45
+ commandOptions.csp ? 'productos-servicios' : null,
46
+ ].filter(Boolean);
47
+ if (shortcutConcepts.length > 1) {
48
+ throw new InputValidationError('Use solo un flag de concepto entre --cs, --cp o --csp.');
49
+ }
50
+ return shortcutConcepts[0];
51
+ }
52
+ //# sourceMappingURL=billing.command.shortcuts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing.command.shortcuts.js","sourceRoot":"","sources":["../../../src/cli/commands/billing.command.shortcuts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGlE,MAAM,UAAU,kBAAkB,CAChC,cAAuC;IAEvC,MAAM,SAAS,GAAG;QAChB,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI;QACnD,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI;QAC/C,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI;QAC3C,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI;QAChD,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,IAAI;QACpD,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,gDAAgD,CAAC,CAAC,CAAC,IAAI;QAC/E,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,IAAI;QACrD,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,IAAI;QACpD,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,IAAI;QACtD,cAAc,CAAC,IAAI,CAA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,MAAM,UAAU,sBAAsB,CACpC,cAAuC;IAEvC,MAAM,gBAAgB,GAAG;QACvB,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;QACtC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;QACtC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI;KAClD,CAAC,MAAM,CAAC,OAAO,CAAqC,CAAC;IAEtD,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,oBAAoB,CAAC,wDAAwD,CAAC,CAAC;IAC3F,CAAC;IAED,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerConfigCommand(program: Command): void;
@@ -0,0 +1,125 @@
1
+ import ora from 'ora';
2
+ import { ConfigService } from '../../modules/config/config.service.js';
3
+ import { buildConfigDoctorReport } from '../../modules/config/config-doctor.js';
4
+ import { ArcaContextResolver } from '../../services/arca/arca-context.resolver.js';
5
+ import { formatConfig, formatConfigAsText, formatConfigDoctor, formatConfigDoctorAsText, formatConfigPath, writeTerminalJson, writeTerminalOutput, } from '../../ui/index.js';
6
+ import { configureSpanishHelp, createConfigHelp } from '../help.js';
7
+ function createConfigService() {
8
+ const service = new ConfigService();
9
+ service.ensureInitialized();
10
+ return service;
11
+ }
12
+ function printConfigResult(textValue, jsonValue, useJson = false) {
13
+ if (useJson) {
14
+ writeTerminalJson(jsonValue);
15
+ return;
16
+ }
17
+ writeTerminalOutput(textValue);
18
+ }
19
+ function buildRuntimeCheck(options) {
20
+ try {
21
+ return {
22
+ validation: new ArcaContextResolver({
23
+ options: {
24
+ produccion: options.produccion,
25
+ testing: options.testing,
26
+ },
27
+ }).validate(),
28
+ };
29
+ }
30
+ catch (error) {
31
+ return {
32
+ error: error instanceof Error ? error.message : 'No se pudo completar la revision activa.',
33
+ };
34
+ }
35
+ }
36
+ export function registerConfigCommand(program) {
37
+ const configCommand = program
38
+ .command('config')
39
+ .description('guardar defaults, credenciales y revisar si el CLI esta listo para emitir');
40
+ configureSpanishHelp(configCommand);
41
+ configCommand.option('--json', 'imprimir salida JSON').action((options) => {
42
+ const service = createConfigService();
43
+ try {
44
+ const config = service.getConfig();
45
+ const ticketPath = service.resolveTicketPath(config);
46
+ printConfigResult(formatConfigAsText(config, ticketPath), formatConfig(config, ticketPath), options.json);
47
+ }
48
+ finally {
49
+ service.close();
50
+ }
51
+ });
52
+ configCommand.addHelpText('after', createConfigHelp());
53
+ const revisarCommand = configCommand
54
+ .command('revisar')
55
+ .description('revisar configuracion, defaults, credenciales y validacion activa')
56
+ .option('--json', 'imprimir salida JSON')
57
+ .option('--testing', 'revisar para testing')
58
+ .option('--produccion', 'revisar para produccion')
59
+ .action((options) => {
60
+ const service = createConfigService();
61
+ const spinner = !options.json && process.stdout.isTTY ? ora('Generando revision...').start() : null;
62
+ try {
63
+ const report = buildConfigDoctorReport(service.getConfig(), buildRuntimeCheck(options));
64
+ spinner?.stop();
65
+ printConfigResult(formatConfigDoctorAsText(report), formatConfigDoctor(report), options.json);
66
+ }
67
+ catch (error) {
68
+ spinner?.stop();
69
+ throw error;
70
+ }
71
+ finally {
72
+ service.close();
73
+ }
74
+ });
75
+ configureSpanishHelp(revisarCommand);
76
+ const rutaCommand = configCommand
77
+ .command('ruta')
78
+ .description('mostrar la ruta del archivo de configuracion')
79
+ .action(() => {
80
+ const service = createConfigService();
81
+ try {
82
+ writeTerminalOutput(formatConfigPath(service.getPath()));
83
+ }
84
+ finally {
85
+ service.close();
86
+ }
87
+ });
88
+ configureSpanishHelp(rutaCommand);
89
+ const establecerCommand = configCommand
90
+ .command('establecer')
91
+ .description('guardar un valor de configuracion')
92
+ .option('--json', 'imprimir salida JSON')
93
+ .argument('<clave>', 'clave publica de configuracion')
94
+ .argument('<valor>', 'valor a guardar')
95
+ .action((key, value, options) => {
96
+ const service = createConfigService();
97
+ try {
98
+ const config = service.setValue(key, value);
99
+ const ticketPath = service.resolveTicketPath(config);
100
+ printConfigResult(formatConfigAsText(config, ticketPath), formatConfig(config, ticketPath), options.json);
101
+ }
102
+ finally {
103
+ service.close();
104
+ }
105
+ });
106
+ configureSpanishHelp(establecerCommand);
107
+ const eliminarCommand = configCommand
108
+ .command('eliminar')
109
+ .description('eliminar un valor de configuracion')
110
+ .option('--json', 'imprimir salida JSON')
111
+ .argument('<clave>', 'clave publica de configuracion')
112
+ .action((key, options) => {
113
+ const service = createConfigService();
114
+ try {
115
+ const config = service.unsetValue(key);
116
+ const ticketPath = service.resolveTicketPath(config);
117
+ printConfigResult(formatConfigAsText(config, ticketPath), formatConfig(config, ticketPath), options.json);
118
+ }
119
+ finally {
120
+ service.close();
121
+ }
122
+ });
123
+ configureSpanishHelp(eliminarCommand);
124
+ }
125
+ //# sourceMappingURL=config.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.command.js","sourceRoot":"","sources":["../../../src/cli/commands/config.command.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAiC,MAAM,oCAAoC,CAAC;AAC5G,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEjE,SAAS,mBAAmB;IAC1B,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;IACpC,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAE5B,OAAO,OAAO,C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oC,CAAC;SACjD,MAAM,CAAC,QAAQ,EAAE,sBAAsB,CAAC;SACxC,QAAQ,CAAC,SAAS,EAAE,gCAAgC,CAAC;SACrD,MAAM,CAAC,CAAC,GAAW,EAAE,OAA2B,EAAE,EAAE;QACnD,MAAM,OAAO,GAAG,mBAAmB,EAAE,CAAC;QAEtC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YACvC,MAAM,UAAU,GAAG,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;YACrD,iBAAiB,CAAC,kBAAkB,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAC5G,CAAC;gBAAS,CAAC;YACT,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IACL,oBAAoB,CAAC,eAAe,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { Command } from 'commander';
2
+ export declare function registerExamplesCommand(program: Command): void;
@@ -0,0 +1,14 @@
1
+ import { renderExamples } from '../../modules/examples/examples.js';
2
+ import { writeTerminalOutput } from '../../ui/index.js';
3
+ import { configureSpanishHelp, createExamplesHelp } from '../help.js';
4
+ export function registerExamplesCommand(program) {
5
+ const command = program
6
+ .command('ejemplos')
7
+ .description('ver ejemplos listos para copiar de todos los comprobantes')
8
+ .action(() => {
9
+ writeTerminalOutput(renderExamples());
10
+ })
11
+ .addHelpText('after', createExamplesHelp());
12
+ configureSpanishHelp(command);
13
+ }
14
+ //# sourceMappingURL=examples.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"examples.command.js","sourceRoot":"","sources":["../../../src/cli/commands/examples.command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEnE,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACtD,MAAM,OAAO,GAAG,OAAO;SACpB,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,2DAA2D,CAAC;SACxE,MAAM,CAAC,GAAG,EAAE;QACX,mBAAmB,CAAC,cAAc,EAAE,CAAC,CAAC;IACxC,CAAC,CAAC;SACD,WAAW,CAAC,OAAO,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAE9C,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { Command } from 'commander';
2
+ export declare function registerFceObligationCommand(program: Command): void;
@@ -0,0 +1,51 @@
1
+ import ora from 'ora';
2
+ import { formatDateAsArcaDate, parseArgentineDateInputAsArcaDate } from '../../lib/dates/arca-date.js';
3
+ import { InputValidationError } from '../../lib/errors/app-error.js';
4
+ import { formatFceObligationAsJson, formatFceObligationAsText } from '../../modules/fce/fce-obligation.presenter.js';
5
+ import { ArcaClientFactory } from '../../services/arca/arca-client.factory.js';
6
+ import { ArcaContextResolver } from '../../services/arca/arca-context.resolver.js';
7
+ import { ArcaFceObligationGateway } from '../../services/arca/arca-fce-obligation.gateway.js';
8
+ import { writeTerminalJson, writeTerminalOutput } from '../../ui/index.js';
9
+ import { configureSpanishHelp, createFceObligationHelp } from '../help.js';
10
+ import { getGlobalOptions, registerGlobalOptions } from './billing.command.shared.js';
11
+ function parseCuit(value) {
12
+ const normalizedValue = value.trim();
13
+ if (!/^\d{11}$/.test(normalizedValue)) {
14
+ throw new InputValidationError(`El CUIT "${value}" no es valido: debe tener 11 digitos.`);
15
+ }
16
+ return Number(normalizedValue);
17
+ }
18
+ export function registerFceObligationCommand(program) {
19
+ const command = program
20
+ .command('fce-obligado')
21
+ .argument('<cuit>', 'CUIT del receptor a consultar')
22
+ .description('consultar si un receptor esta obligado a recibir Factura de Credito Electronica (FCE)')
23
+ .option('-f, --fecha <fecha>', 'fecha de emision a consultar; por defecto hoy')
24
+ .addHelpText('after', createFceObligationHelp());
25
+ registerGlobalOptions(command);
26
+ configureSpanishHelp(command);
27
+ command.action(async (rawCuit, options, self) => {
28
+ const cuit = parseCuit(rawCuit);
29
+ const issueDate = options.fecha
30
+ ? parseArgentineDateInputAsArcaDate(options.fecha)
31
+ : formatDateAsArcaDate(new Date());
32
+ const runtime = new ArcaContextResolver({ options: getGlobalOptions(self) }).resolve();
33
+ const spinner = !runtime.outputJson && process.stdout.isTTY ? ora('Consultando ARCA...').start() : null;
34
+ try {
35
+ const gateway = new ArcaFceObligationGateway(new ArcaClientFactory().create(runtime));
36
+ const obligation = await gateway.getObligation(cuit, issueDate);
37
+ const report = { cuit, environment: runtime.environment, issueDate, obligation };
38
+ spinner?.stop();
39
+ if (runtime.outputJson) {
40
+ writeTerminalJson(formatFceObligationAsJson(report));
41
+ return;
42
+ }
43
+ writeTerminalOutput(formatFceObligationAsText(report));
44
+ }
45
+ catch (error) {
46
+ spinner?.stop();
47
+ throw error;
48
+ }
49
+ });
50
+ }
51
+ //# sourceMappingURL=fce-obligation.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fce-obligation.command.js","sourceRoot":"","sources":["../../../src/cli/commands/fce-obligation.command.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,oBAAoB,EAAE,iCAAiC,EAAE,MAAM,2BAA2B,CAAC;AACpG,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AAClH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,iD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CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;QACvF,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAExG,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,IAAI,wBAAwB,CAAC,IAAI,iBAAiB,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;YACtF,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YAChE,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;YAEjF,OAAO,EAAE,IAAI,EAAE,CAAC;YAEhB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;gBACvB,iBAAiB,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC;gBAErD,OAAO;YACT,CAAC;YAED,mBAAmB,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC;QACzD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,IAAI,EAAE,CAAC;YAChB,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { Command } from 'commander';
2
+ export declare function registerStorybookCommand(program: Command): void;
@@ -0,0 +1,26 @@
1
+ import { InputValidationError } from '../../lib/errors/app-error.js';
2
+ import { renderStorybookShowcase, writeTerminalOutput } from '../../ui/index.js';
3
+ import { configureSpanishHelp, createStorybookHelp } from '../help.js';
4
+ const STORYBOOK_SCENES = [
5
+ 'colores',
6
+ 'componentes',
7
+ 'comprobantes',
8
+ 'configuracion',
9
+ 'errores',
10
+ 'json',
11
+ ];
12
+ export function registerStorybookCommand(program) {
13
+ const command = program
14
+ .command('storybook')
15
+ .description('ver escenas visuales del CLI con datos de ejemplo')
16
+ .argument('[escena]', 'comprobantes, colores, componentes, configuracion, errores o json')
17
+ .action((scene) => {
18
+ if (scene && !STORYBOOK_SCENES.includes(scene)) {
19
+ throw new InputValidationError(`La escena "${scene}" no es valida. Use comprobantes, colores, componentes, configuracion, errores o json.`);
20
+ }
21
+ writeTerminalOutput(renderStorybookShowcase(scene));
22
+ })
23
+ .addHelpText('after', createStorybookHelp());
24
+ configureSpanishHelp(command);
25
+ }
26
+ //# sourceMappingURL=storybook.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storybook.command.js","sourceRoot":"","sources":["../../../src/cli/commands/storybook.command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEpE,MAAM,gBAAgB,GAAqB;IACzC,SAAS;IACT,aAAa;IACb,cAAc;IACd,eAAe;IACf,SAAS;IACT,MAAM;CACP,CAAC;AAEF,MAAM,UAAU,wBAAwB,CAAC,OAAgB;IACvD,MAAM,OAAO,GAAG,OAAO;SACpB,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CAAC,mDAAmD,CAAC;SAChE,QAAQ,CAAC,UAAU,EAAE,mEAAmE,CAAC;SACzF,MAAM,CAAC,CAAC,KAAc,EAAE,EAAE;QACzB,IAAI,KAAK,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAuB,CAAC,EAAE,CAAC;YACjE,MAAM,IAAI,oBAAoB,CAC5B,cAAc,KAAK,wFAAwF,CAC5G,CAAC;QACJ,CAAC;QAED,mBAAmB,CAAC,uBAAuB,CAAC,KAAmC,CAAC,CAAC,CAAC;IACpF,CAAC,CAAC;SACD,WAAW,CAAC,OAAO,EAAE,mBAAmB,EAAE,CAAC,CAAC;IAE/C,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC"}