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,33 @@
1
+ const MONEY_FORMATTER = new Intl.NumberFormat('es-AR', { maximumFractionDigits: 2, minimumFractionDigits: 0 });
2
+ function formatMoney(value) {
3
+ return `$${MONEY_FORMATTER.format(value)}`;
4
+ }
5
+ function isInvoice(voucherKind) {
6
+ return voucherKind.family === 'factura' || voucherKind.family === 'factura-credito-electronica';
7
+ }
8
+ /** Solo las facturas (comunes o FCE) a un receptor con CUIT dependen del regimen FCE. */
9
+ export function shouldCheckFceObligation(input, voucherKind) {
10
+ return isInvoice(voucherKind) && input.documentType === 'cuit' && typeof input.documentNumber === 'number';
11
+ }
12
+ /**
13
+ * Compara el comprobante elegido con lo que exige el regimen FCE MiPyMEs:
14
+ * con receptor obligado y monto igual o superior al minimo corresponde FCE; si no, factura comun.
15
+ */
16
+ export function evaluateFceObligation(obligation, voucherKind, amountInPesos) {
17
+ const requiresFce = obligation.obligated && amountInPesos >= obligation.minimumAmount;
18
+ const regularShortcut = `f${voucherKind.letter}`;
19
+ const fceShortcut = `fce${voucherKind.letter}`;
20
+ if (voucherKind.family === 'factura' && requiresFce) {
21
+ return [
22
+ `El receptor esta obligado a recibir FCE desde ${formatMoney(obligation.minimumAmount)} y este monto lo supera. Corresponde emitir ${fceShortcut} en lugar de ${regularShortcut}.`,
23
+ ];
24
+ }
25
+ if (voucherKind.family === 'factura-credito-electronica' && !requiresFce) {
26
+ const reason = obligation.obligated
27
+ ? `el monto es menor al minimo del regimen (${formatMoney(obligation.minimumAmount)})`
28
+ : 'el receptor no esta obligado a recibir FCE';
29
+ return [`Para este comprobante ${reason}. Corresponde emitir ${regularShortcut} en lugar de ${fceShortcut}.`];
30
+ }
31
+ return [];
32
+ }
33
+ //# sourceMappingURL=fce-obligation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fce-obligation.js","sourceRoot":"","sources":["../../../src/modules/fce/fce-obligation.ts"],"names":[],"mappings":"AAcA,MAAM,eAAe,GAAG,IAAI,IAA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AEjD,OAAO,CAAC,yBAAyB,MAAM,wBAAwB,eAAe,gBAAgB,WAAW,GAAG,CAAC,CAAC;IAChH,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { FceObligation } from './fce-obligation';
2
+ export interface FceObligationReport {
3
+ readonly cuit: number;
4
+ readonly environment: 'produccion' | 'testing';
5
+ readonly issueDate: string;
6
+ readonly obligation: FceObligation;
7
+ }
8
+ export declare function formatFceObligationAsJson(report: FceObligationReport): string;
9
+ export declare function formatFceObligationAsText(report: FceObligationReport): string;
@@ -0,0 +1,32 @@
1
+ import { keyValuePanel, renderKeyValueRows, resolveKeyValueLabelWidth } from '../../ui/index.js';
2
+ const MONEY_FORMATTER = new Intl.NumberFormat('es-AR', {
3
+ currency: 'ARS',
4
+ maximumFractionDigits: 2,
5
+ minimumFractionDigits: 2,
6
+ style: 'currency',
7
+ });
8
+ function formatArcaDate(value) {
9
+ return `${value.slice(6, 8)}/${value.slice(4, 6)}/${value.slice(0, 4)}`;
10
+ }
11
+ export function formatFceObligationAsJson(report) {
12
+ return JSON.stringify({
13
+ cuit: report.cuit,
14
+ entorno: report.environment,
15
+ fecha: report.issueDate,
16
+ montoDesde: report.obligation.minimumAmount,
17
+ obligado: report.obligation.obligated,
18
+ }, null, 2);
19
+ }
20
+ export function formatFceObligationAsText(report) {
21
+ const rows = [
22
+ ['CUIT', String(report.cuit)],
23
+ ['Fecha consultada', formatArcaDate(report.issueDate)],
24
+ ['Obligado a recibir FCE', report.obligation.obligated ? 'si' : 'no'],
25
+ ['Monto minimo', MONEY_FORMATTER.format(report.obligation.minimumAmount)],
26
+ ];
27
+ const footer = report.obligation.obligated
28
+ ? `Desde ese monto corresponde emitir FCE (fcea, fceb o fcec). Debajo, factura comun.`
29
+ : 'Corresponde emitir factura comun (fa, fb o fc).';
30
+ return keyValuePanel('Regimen FCE MiPyMEs', renderKeyValueRows(rows, { labelWidth: resolveKeyValueLabelWidth('standard', rows) }), footer);
31
+ }
32
+ //# sourceMappingURL=fce-obligation.presenter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fce-obligation.presenter.js","sourceRoot":"","sources":["../../../src/modules/fce/fce-obligation.presenter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAWxF,MAAM,eAAe,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;IACrD,QAAQ,EAAE,KAAK;IACf,qBAAqB,EAAE,CAAC;IACxB,qBAAqB,EAAE,CAAC;IACxB,KAAK,EAAE,UAAU;CAClB,CAAC,CAAC;AAEH,SAAS,cAAc,CAAC,KAAa;IACnC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,MAA2B;IACnE,OAAO,IAAI,CAAC,SAAS,CACnB;QACE,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,OAAO,EAAE,MAAM,CAAC,WAAW;QAC3B,KAAK,EAAE,MAAM,CAAC,SAAS;QACvB,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,aAAa;QAC3C,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS;KACtC,EACD,IAAI,EACJ,CAAC,CACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,MAA2B;IACnE,MAAM,IAAI,GAAqC;QAC7C,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC,kBAAkB,EAAE,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACtD,CAAC,wBAAwB,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QACrE,CAAC,cAAc,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;KAC1E,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,SAAS;QACxC,CAAC,CAAC,oFAAoF;QACtF,CAAC,CAAC,iDAAiD,CAAC;IAEtD,OAAO,aAAa,CAClB,qBAAqB,EACrB,kBAAkB,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,yBAAyB,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC,EACrF,MAAM,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { UiWidthPreset } from '../../ui';
2
+ export interface StorybookShowcaseTheme {
3
+ readonly borderColor: string;
4
+ readonly indexPanelWidth: UiWidthPreset;
5
+ readonly sceneWidth: UiWidthPreset;
6
+ }
7
+ export declare const STORYBOOK_SHOWCASE_THEME: StorybookShowcaseTheme;
@@ -0,0 +1,6 @@
1
+ export const STORYBOOK_SHOWCASE_THEME = {
2
+ borderColor: 'magenta',
3
+ indexPanelWidth: 'wide',
4
+ sceneWidth: 'wide',
5
+ };
6
+ //# sourceMappingURL=showcase-theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"showcase-theme.js","sourceRoot":"","sources":["../../../src/modules/storybook/showcase-theme.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,wBAAwB,GAA2B;IAC9D,WAAW,EAAE,SAAS;IACtB,eAAe,EAAE,MAAM;IACvB,UAAU,EAAE,MAAM;CACnB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export type StorybookScene = 'colores' | 'componentes' | 'comprobantes' | 'configuracion' | 'errores' | 'json';
2
+ export declare function renderStorybookShowcase(scene?: StorybookScene): string;
@@ -0,0 +1,310 @@
1
+ import { ConfigurationError, InputValidationError } from '../../lib/errors/app-error.js';
2
+ import { badge, contentPanel, formatCliError, highlightJsonValues, noticePanel, renderKeyValueRows, renderLogo, renderObject, renderPanel, resolveKeyValueLabelWidth, statusPanel, toneText, } from '../../ui/index.js';
3
+ import { formatBillingResultAsJson, formatBillingResultAsText } from '../billing/billing.presenter.js';
4
+ import { formatConfig, formatConfigAsText, formatConfigDoctor, formatConfigDoctorAsText, } from '../config/config.presenter.js';
5
+ import { buildConfigDoctorReport } from '../config/config-doctor.js';
6
+ import { renderUpdateNoticePanel } from '../update-check/update-check.presenter.js';
7
+ import { STORYBOOK_SHOWCASE_THEME } from './showcase-theme.js';
8
+ function createVoucherKind(partial) {
9
+ return {
10
+ arcaType: partial.arcaType ?? 11,
11
+ displayName: partial.displayName ?? 'Factura C',
12
+ family: partial.family ?? 'factura',
13
+ isElectronicCredit: partial.isElectronicCredit ?? false,
14
+ letter: partial.letter ?? 'c',
15
+ requiresAssociatedVoucher: partial.requiresAssociatedVoucher ?? false,
16
+ shortcut: partial.shortcut ?? 'fc',
17
+ };
18
+ }
19
+ function createBillingResult(partial = {}) {
20
+ return {
21
+ dryRun: partial.dryRun ?? false,
22
+ environment: partial.environment ?? 'produccion',
23
+ payload: {
24
+ CantReg: 1,
25
+ CbteFch: '20260320',
26
+ CbteTipo: 11,
27
+ Concepto: 2,
28
+ CondicionIVAReceptorId: 5,
29
+ DocNro: 0,
30
+ DocTipo: 99,
31
+ FchServDesde: '20260320',
32
+ FchServHasta: '20260320',
33
+ FchVtoPago: '20260320',
34
+ ImpIVA: 0,
35
+ ImpNeto: 1,
36
+ ImpOpEx: 0,
37
+ ImpTotConc: 0,
38
+ ImpTotal: 1,
39
+ ImpTrib: 0,
40
+ MonCotiz: 1,
41
+ MonId: 'PES',
42
+ PtoVta: 3,
43
+ ...(partial.payload ?? {}),
44
+ },
45
+ response: {
46
+ cae: '86120020280000',
47
+ caeVencimiento: '20260330',
48
+ errors: [],
49
+ events: [],
50
+ observaciones: [],
51
+ observacion: null,
52
+ raw: {
53
+ cae: '86120020280000',
54
+ caeFchVto: '20260330',
55
+ response: {
56
+ FeDetResp: {
57
+ FECAEDetResponse: [{ Resultado: 'A' }],
58
+ },
59
+ },
60
+ },
61
+ resultado: 'A',
62
+ status: 'aprobado',
63
+ suggestions: [],
64
+ ...(partial.response ?? {}),
65
+ },
66
+ voucherKind: partial.voucherKind ?? createVoucherKind({}),
67
+ };
68
+ }
69
+ function createSampleConfig() {
70
+ return {
71
+ cert: {
72
+ produccion: '/Users/demo/.arcli/produccion/certificado.crt',
73
+ testing: '/Users/demo/.arcli/testing/certificado.crt',
74
+ },
75
+ cuit: '20409509763',
76
+ conceptoPorDefecto: 'servicios',
77
+ cotizacionPorDefecto: 1,
78
+ entornoPorDefecto: 'testing',
79
+ ivaReceptorPorDefecto: 'consumidor-final',
80
+ key: {
81
+ produccion: '/Users/demo/.arcli/produccion/clave.key',
82
+ testing: '/Users/demo/.arcli/testing/clave.key',
83
+ },
84
+ monedaPorDefecto: 'PES',
85
+ output: {
86
+ emitirPorDefecto: false,
87
+ jsonPorDefecto: false,
88
+ brutoPorDefecto: false,
89
+ },
90
+ puntoVentaPorDefecto: 3,
91
+ };
92
+ }
93
+ function createSampleUpdateCheckResult() {
94
+ return {
95
+ currentVersion: '0.1.0',
96
+ latestVersion: '0.2.0',
97
+ };
98
+ }
99
+ function createSampleValidation() {
100
+ return {
101
+ certPath: '/Users/demo/.arcli/testing/certificado.crt',
102
+ cuit: 20409509763,
103
+ environment: 'testing',
104
+ keyPath: '/Users/demo/.arcli/testing/clave.key',
105
+ outputJson: false,
106
+ outputRaw: false,
107
+ pointOfSale: 3,
108
+ ticketPath: '/Users/demo/.arcli/tickets',
109
+ };
110
+ }
111
+ function sceneTitle(title, subtitle) {
112
+ return renderPanel({
113
+ borderColor: STORYBOOK_SHOWCASE_THEME.borderColor,
114
+ borderType: 'debug',
115
+ content: [],
116
+ subtitle,
117
+ subtitleColor: 'debug',
118
+ title,
119
+ width: STORYBOOK_SHOWCASE_THEME.sceneWidth,
120
+ });
121
+ }
122
+ function showcaseIndex() {
123
+ return renderPanel({
124
+ borderColor: STORYBOOK_SHOWCASE_THEME.borderColor,
125
+ borderType: 'debug',
126
+ content: [],
127
+ subtitle: 'Galeria visual del CLI',
128
+ subtitleColor: 'debug',
129
+ title: 'Terminal Storybook',
130
+ width: STORYBOOK_SHOWCASE_THEME.indexPanelWidth,
131
+ });
132
+ }
133
+ function buildColorsScene() {
134
+ return [
135
+ sceneTitle('Colores UI', 'Paleta semantica y tono debug'),
136
+ `${badge('OK', 'success')} ${toneText('Paneles base listos', 'success')}`,
137
+ `${badge('INFO', 'info')} ${toneText('Respuesta bruta o eventos', 'info')}`,
138
+ `${badge('WARN', 'warning')} ${toneText('Observaciones o sugerencias', 'warning')}`,
139
+ `${badge('ERROR', 'danger')} ${toneText('Errores o bloqueos', 'danger')}`,
140
+ `${badge('DEBUG', 'debug')} ${toneText('Storybook y debug visual', 'debug')}`,
141
+ ].join('\n\n');
142
+ }
143
+ function buildBillingScene() {
144
+ const preview = formatBillingResultAsText(createBillingResult({
145
+ dryRun: true,
146
+ response: {
147
+ ...createBillingResult().response,
148
+ raw: null,
149
+ status: 'observado',
150
+ resultado: null,
151
+ },
152
+ }));
153
+ const approved = formatBillingResultAsText(createBillingResult());
154
+ const observed = formatBillingResultAsText(createBillingResult({
155
+ response: {
156
+ ...createBillingResult().response,
157
+ observaciones: ['La CUIT receptora no existe en padron.'],
158
+ observacion: 'La CUIT receptora no existe en padron.',
159
+ raw: {
160
+ response: {
161
+ FeDetResp: {
162
+ FECAEDetResponse: [{ Resultado: 'A' }],
163
+ },
164
+ },
165
+ },
166
+ status: 'observado',
167
+ suggestions: ['Revise el CUIT del receptor o use uno valido de testing.'],
168
+ },
169
+ voucherKind: createVoucherKind({ displayName: 'Factura A', shortcut: 'fa', letter: 'a', arcaType: 1 }),
170
+ payload: {
171
+ ...createBillingResult().payload,
172
+ CbteTipo: 1,
173
+ DocTipo: 80,
174
+ DocNro: 20123456789,
175
+ CondicionIVAReceptorId: 1,
176
+ ImpNeto: 0.83,
177
+ ImpIVA: 0.17,
178
+ },
179
+ }));
180
+ const rejected = formatBillingResultAsText(createBillingResult({
181
+ response: {
182
+ ...createBillingResult().response,
183
+ cae: null,
184
+ caeVencimiento: null,
185
+ errors: [{ Code: 502, Msg: 'Error interno de base de datos - Autorizador CAE - Transacción Activa' }],
186
+ raw: {
187
+ response: {
188
+ Errors: {
189
+ Err: [{ Code: 502, Msg: 'Error interno de base de datos - Autorizador CAE - Transacción Activa' }],
190
+ },
191
+ },
192
+ },
193
+ resultado: 'R',
194
+ status: 'rechazado',
195
+ suggestions: ['ARCA devolvio un error transitorio. Espere unos segundos y vuelva a intentar la emision.'],
196
+ },
197
+ }));
198
+ const bruto = formatBillingResultAsText(createBillingResult(), { raw: true });
199
+ return [
200
+ sceneTitle('Comprobantes', 'Preview, aprobado, observado, rechazado y bruto'),
201
+ preview,
202
+ approved,
203
+ observed,
204
+ rejected,
205
+ bruto,
206
+ ].join('\n\n');
207
+ }
208
+ function buildConfigScene() {
209
+ const config = createSampleConfig();
210
+ const doctor = buildConfigDoctorReport(config, { validation: createSampleValidation() });
211
+ return [
212
+ sceneTitle('Configuracion', 'Vista actual y revision'),
213
+ formatConfigAsText(config, createSampleValidation().ticketPath),
214
+ formatConfigDoctorAsText(doctor),
215
+ ].join('\n\n');
216
+ }
217
+ function buildErrorScene() {
218
+ return [
219
+ sceneTitle('Errores', 'Configuracion, entrada y error inesperado'),
220
+ formatCliError(new ConfigurationError('Falta la ruta de la clave privada para testing.', {
221
+ path: '/Users/demo/.arcli/testing/clave.key',
222
+ }), false),
223
+ formatCliError(new InputValidationError('Falta el concepto.'), false),
224
+ formatCliError(new Error('Fallo inesperado de red.'), false),
225
+ ].join('\n\n');
226
+ }
227
+ function buildJsonScene() {
228
+ const billingJson = highlightJsonValues(formatBillingResultAsJson(createBillingResult(), { raw: true }));
229
+ const configJson = highlightJsonValues(formatConfig(createSampleConfig(), createSampleValidation().ticketPath));
230
+ const doctorJson = highlightJsonValues(formatConfigDoctor(buildConfigDoctorReport(createSampleConfig(), { validation: createSampleValidation() })));
231
+ return [
232
+ sceneTitle('Json', 'Contratos estructurados para automatizacion y respuesta bruta'),
233
+ contentPanel('Billing json', billingJson, 'wide', 'info'),
234
+ contentPanel('Config json', configJson, 'wide', 'info'),
235
+ contentPanel('Doctor json', doctorJson, 'wide', 'info'),
236
+ ].join('\n\n');
237
+ }
238
+ function buildComponentsScene() {
239
+ const notice = noticePanel('Estas utilizando el entorno de TESTING', 'warning');
240
+ const updateNotice = renderUpdateNoticePanel(createSampleUpdateCheckResult());
241
+ const keyValueRows = [
242
+ ['CUIT', '20-40950976-3'],
243
+ ['Punto de venta', 3],
244
+ ['Entorno', 'testing'],
245
+ ];
246
+ const statusRows = [
247
+ ['CAE', '86120020280000'],
248
+ ['Importe total', '1$'],
249
+ ['Errores', 0],
250
+ ];
251
+ const demoLabelWidth = resolveKeyValueLabelWidth('compact', [...keyValueRows, ...statusRows]);
252
+ const keyValue = renderPanel({
253
+ content: renderKeyValueRows(keyValueRows, { labelWidth: demoLabelWidth }),
254
+ contentAlign: 'left',
255
+ footer: toneText('TODO LISTO', 'success'),
256
+ footerColor: 'success',
257
+ footerDivider: true,
258
+ padding: {
259
+ bottom: 1,
260
+ left: 2,
261
+ right: 2,
262
+ top: 1,
263
+ },
264
+ title: 'Demo key value',
265
+ width: 'compact',
266
+ });
267
+ const status = statusPanel('Demo estado', [
268
+ ...renderKeyValueRows(statusRows.slice(0, 2), { labelWidth: demoLabelWidth }),
269
+ '',
270
+ ...renderKeyValueRows(statusRows.slice(2), { labelWidth: demoLabelWidth }),
271
+ ], 'APROBADO', 'compact', 'success');
272
+ const content = contentPanel('Demo contenido', renderObject({
273
+ cae: '86120020280000',
274
+ resultado: 'A',
275
+ payload: { CbteTipo: 11, ImpTotal: 1, PtoVta: 3 },
276
+ }), 'wide', 'info');
277
+ return [
278
+ sceneTitle('Componentes', 'Notice, badges y paneles base'),
279
+ notice,
280
+ updateNotice,
281
+ keyValue,
282
+ status,
283
+ content,
284
+ ].join('\n\n');
285
+ }
286
+ export function renderStorybookShowcase(scene) {
287
+ const logo = renderLogo().trim();
288
+ const scenes = {
289
+ colores: buildColorsScene(),
290
+ componentes: buildComponentsScene(),
291
+ comprobantes: buildBillingScene(),
292
+ configuracion: buildConfigScene(),
293
+ errores: buildErrorScene(),
294
+ json: buildJsonScene(),
295
+ };
296
+ if (!scene) {
297
+ return [
298
+ showcaseIndex(),
299
+ logo,
300
+ scenes.colores,
301
+ scenes.componentes,
302
+ scenes.configuracion,
303
+ scenes.comprobantes,
304
+ scenes.json,
305
+ scenes.errores,
306
+ ].join('\n\n');
307
+ }
308
+ return scenes[scene];
309
+ }
310
+ //# sourceMappingURL=showcase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"showcase.js","sourceRoot":"","sources":["../../../src/modules/storybook/showcase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEtF,OAAO,EACL,KAAK,EACL,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,yBAAyB,EACzB,WAAW,EACX,QAAQ,GACT,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAGpG,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAGjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAI5D,SAAS,iBAAiB,CAAC,OAAuC;IAChE,OAAO;QACL,QAAQ,EAAE,OAAO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R,MAAM;QACN,OAAO;KACR,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,KAAsB;IAC5D,MAAM,IAAI,GAAG,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC;IAEjC,MAAM,MAAM,GAAmC;QAC7C,OAAO,EAAE,gBAAgB,EAAE;QAC3B,WAAW,EAAE,oBAAoB,EAAE;QACnC,YAAY,EAAE,iBAAiB,EAAE;QACjC,aAAa,EAAE,gBAAgB,EAAE;QACjC,OAAO,EAAE,eAAe,EAAE;QAC1B,IAAI,EAAE,cAAc,EAAE;KACvB,CAAC;IAEF,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO;YACL,aAAa,EAAE;YACf,IAAI;YACJ,MAAM,CAAC,OAAO;YACd,MAAM,CAAC,WAAW;YAClB,MAAM,CAAC,aAAa;YACpB,MAAM,CAAC,YAAY;YACnB,MAAM,CAAC,IAAI;YACX,MAAM,CAAC,OAAO;SACf,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjB,CAAC;IAED,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { UpdateCheckResult } from './update-check.service';
2
+ export declare function renderUpdateNoticePanel(result: UpdateCheckResult): string;
@@ -0,0 +1,6 @@
1
+ import { noticePanel } from '../../ui/index.js';
2
+ export function renderUpdateNoticePanel(result) {
3
+ return noticePanel(`Nueva version disponible: ${result.latestVersion} (actual: ${result.currentVersion})\n` +
4
+ 'Actualiza con: npm install -g arcli@latest', 'info');
5
+ }
6
+ //# sourceMappingURL=update-check.presenter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-check.presenter.js","sourceRoot":"","sources":["../../../src/modules/update-check/update-check.presenter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIvC,MAAM,UAAU,uBAAuB,CAAC,MAAyB;IAC/D,OAAO,WAAW,CAChB,6BAA6B,MAAM,CAAC,aAAa,aAAa,MAAM,CAAC,cAAc,KAAK;QACtF,4CAA4C,EAC9C,MAAM,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ export interface UpdateCheckResult {
2
+ readonly currentVersion: string;
3
+ readonly latestVersion: string;
4
+ }
5
+ export interface CheckForUpdateOptions {
6
+ readonly cwd?: string;
7
+ }
8
+ export declare function checkForUpdate(currentVersion: string, options?: CheckForUpdateOptions): Promise<UpdateCheckResult | null>;
@@ -0,0 +1,72 @@
1
+ import Conf from 'conf';
2
+ const PACKAGE_NAME = 'arcli';
3
+ const REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
4
+ const CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
5
+ const FETCH_TIMEOUT_MS = 1500;
6
+ const CACHE_DEFAULTS = {
7
+ lastCheckedAt: 0,
8
+ latestVersion: '',
9
+ };
10
+ function isUpdateCheckDisabled() {
11
+ return Boolean(process.env.CI) || Boolean(process.env.NO_UPDATE_NOTIFIER) || process.stderr.isTTY !== true;
12
+ }
13
+ function isNewerVersion(latestVersion, currentVersion) {
14
+ const parse = (version) => version.split('.').map((part) => Number.parseInt(part, 10) || 0);
15
+ const [latestMajor, latestMinor, latestPatch] = parse(latestVersion);
16
+ const [currentMajor, currentMinor, currentPatch] = parse(currentVersion);
17
+ if (latestMajor !== currentMajor) {
18
+ return latestMajor > currentMajor;
19
+ }
20
+ if (latestMinor !== currentMinor) {
21
+ return latestMinor > currentMinor;
22
+ }
23
+ return latestPatch > currentPatch;
24
+ }
25
+ async function fetchLatestVersion() {
26
+ const controller = new AbortController();
27
+ const timeout = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
28
+ try {
29
+ const response = await fetch(REGISTRY_URL, { signal: controller.signal });
30
+ if (!response.ok) {
31
+ return null;
32
+ }
33
+ const payload = (await response.json());
34
+ return payload.version ?? null;
35
+ }
36
+ catch {
37
+ return null;
38
+ }
39
+ finally {
40
+ clearTimeout(timeout);
41
+ }
42
+ }
43
+ function createCacheStore(cwd) {
44
+ return new Conf({
45
+ configName: 'update-cache',
46
+ cwd,
47
+ defaults: CACHE_DEFAULTS,
48
+ projectName: PACKAGE_NAME,
49
+ projectSuffix: '',
50
+ });
51
+ }
52
+ export async function checkForUpdate(currentVersion, options = {}) {
53
+ if (isUpdateCheckDisabled()) {
54
+ return null;
55
+ }
56
+ const cache = createCacheStore(options.cwd);
57
+ const isCacheStale = Date.now() - cache.get('lastCheckedAt') > CHECK_INTERVAL_MS;
58
+ let latestVersion = cache.get('latestVersion');
59
+ if (isCacheStale) {
60
+ const fetchedVersion = await fetchLatestVersion();
61
+ if (fetchedVersion) {
62
+ latestVersion = fetchedVersion;
63
+ cache.set('latestVersion', fetchedVersion);
64
+ }
65
+ cache.set('lastCheckedAt', Date.now());
66
+ }
67
+ if (!latestVersion || !isNewerVersion(latestVersion, currentVersion)) {
68
+ return null;
69
+ }
70
+ return { currentVersion, latestVersion };
71
+ }
72
+ //# sourceMappingURL=update-check.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-check.service.js","sourceRoot":"","sources":["../../../src/modules/update-check/update-check.service.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,YAAY,GAAG,OAAO,CAAC;AAC7B,MAAM,YAAY,GAAG,8BAA8B,YAAY,SAAS,CAAC;AACzE,MAAM,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC9C,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAO9B,MAAM,cAAc,GAAqB;IACvC,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,EAAE;CAClB,CAAC;AAOF,SAAS,qBAAqB;IAC5B,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,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 -0,0 +1,10 @@
1
+ import type { Arca } from '@arcasdk/core';
2
+ import type { CreateVoucherResultDto } from '@arcasdk/core/lib/application/dto/electronic-billing';
3
+ import type { INextVoucher } from '@arcasdk/core/lib/domain/types/voucher.types';
4
+ import type { BillingGateway } from '../../modules/billing/billing.types.internal';
5
+ export declare class ArcaBillingGateway implements BillingGateway {
6
+ private readonly arca;
7
+ constructor(arca: Arca);
8
+ createNextVoucher(payload: INextVoucher): Promise<CreateVoucherResultDto>;
9
+ getQuotation(currencyCode: string): Promise<number>;
10
+ }
@@ -0,0 +1,22 @@
1
+ import { AppError } from '../../lib/errors/app-error.js';
2
+ export class ArcaBillingGateway {
3
+ arca;
4
+ constructor(arca) {
5
+ this.arca = arca;
6
+ }
7
+ async createNextVoucher(payload) {
8
+ return this.arca.electronicBillingService.createNextVoucher(payload);
9
+ }
10
+ async getQuotation(currencyCode) {
11
+ const result = await this.arca.electronicBillingService.getQuotation(currencyCode);
12
+ const exchangeRate = result.resultGet?.monCotiz;
13
+ if (typeof exchangeRate !== 'number' || exchangeRate <= 0) {
14
+ throw new AppError(`ARCA no devolvio una cotizacion valida para ${currencyCode}.`, {
15
+ code: 'ARCA_QUOTATION_ERROR',
16
+ details: { errors: result.errors },
17
+ });
18
+ }
19
+ return exchangeRate;
20
+ }
21
+ }
22
+ //# sourceMappingURL=arca-billing.gateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arca-billing.gateway.js","sourceRoot":"","sources":["../../../src/services/arca/arca-billing.gateway.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAGtD,MAAM,OAAO,kBAAkB;IACO;IAApC,YAAoC,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAAG,CAAC;IAE3C,KAAK,CAAC,iBAAiB,CAAC,OAAqB;QAClD,OAAO,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACvE,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,YAAoB;QAC5C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QACnF,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC;QAEhD,IAAI,OAAO,YAAY,KAAK,QAAQ,IAAI,YAAY,IAAI,CAAC,EAAE,CAAC;YAC1D,MAAM,IAAI,QAAQ,CAAC,+CAA+C,YAAY,GAAG,EAAE;gBACjF,IAAI,EAAE,sBAAsB;gBAC5B,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;aACnC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,YAAY,CAAC;IACtB,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ import { Arca } from '@arcasdk/core';
2
+ import type { ResolvedArcaRuntime } from './arca-context.resolver';
3
+ export declare class ArcaClientFactory {
4
+ create(runtime: Pick<ResolvedArcaRuntime, 'context'>): Arca;
5
+ }
@@ -0,0 +1,7 @@
1
+ import { Arca } from '@arcasdk/core';
2
+ export class ArcaClientFactory {
3
+ create(runtime) {
4
+ return new Arca(runtime.context);
5
+ }
6
+ }
7
+ //# sourceMappingURL=arca-client.factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arca-client.factory.js","sourceRoot":"","sources":["../../../src/services/arca/arca-client.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAIrC,MAAM,OAAO,iBAAiB;IACrB,MAAM,CAAC,OAA6C;QACzD,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;CACF"}
@@ -0,0 +1,44 @@
1
+ import type { Context } from '@arcasdk/core';
2
+ import type { GlobalCliOptions } from '../../cli/types';
3
+ import type { ArcliConfig, ArcliEnvironment } from '../../modules/config/config.schemas';
4
+ import { ConfigService } from '../../modules/config/config.service';
5
+ export interface ResolveArcaContextOptions {
6
+ readonly configService?: ConfigService;
7
+ readonly options?: GlobalCliOptions;
8
+ }
9
+ export interface ResolvedArcaRuntime {
10
+ readonly config: ArcliConfig;
11
+ readonly context: Context;
12
+ readonly environment: ArcliEnvironment;
13
+ readonly outputJson: boolean;
14
+ readonly outputRaw: boolean;
15
+ readonly pointOfSale?: number;
16
+ }
17
+ export interface ArcaRuntimeValidation {
18
+ readonly certPath: string;
19
+ readonly cuit: number;
20
+ readonly environment: ArcliEnvironment;
21
+ readonly keyPath: string;
22
+ readonly outputJson: boolean;
23
+ readonly outputRaw: boolean;
24
+ readonly pointOfSale?: number;
25
+ readonly ticketPath: string;
26
+ }
27
+ export declare class ArcaContextResolver {
28
+ private readonly configService?;
29
+ private readonly options;
30
+ constructor(options?: ResolveArcaContextOptions);
31
+ resolve(): ResolvedArcaRuntime;
32
+ validate(): ArcaRuntimeValidation & {
33
+ readonly config: ArcliConfig;
34
+ };
35
+ private readRequiredFile;
36
+ private ensurePathExists;
37
+ private resolveCuit;
38
+ private resolveEnvironment;
39
+ private resolveOutputJson;
40
+ private resolvePointOfSale;
41
+ private resolveOutputRaw;
42
+ private resolveCertificatePath;
43
+ private resolveKeyPath;
44
+ }