arcli 0.1.1 → 1.1.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.
- package/LICENSE +21 -0
- package/README.md +164 -4
- package/dist/cli/commands/billing-family.command.d.ts +2 -0
- package/dist/cli/commands/billing-family.command.js +30 -0
- package/dist/cli/commands/billing-family.command.js.map +1 -0
- package/dist/cli/commands/billing-shortcuts.command.d.ts +2 -0
- package/dist/cli/commands/billing-shortcuts.command.js +18 -0
- package/dist/cli/commands/billing-shortcuts.command.js.map +1 -0
- package/dist/cli/commands/billing.command.interactive-preview.d.ts +17 -0
- package/dist/cli/commands/billing.command.interactive-preview.js +65 -0
- package/dist/cli/commands/billing.command.interactive-preview.js.map +1 -0
- package/dist/cli/commands/billing.command.options.d.ts +2 -0
- package/dist/cli/commands/billing.command.options.js +49 -0
- package/dist/cli/commands/billing.command.options.js.map +1 -0
- package/dist/cli/commands/billing.command.output.d.ts +12 -0
- package/dist/cli/commands/billing.command.output.js +33 -0
- package/dist/cli/commands/billing.command.output.js.map +1 -0
- package/dist/cli/commands/billing.command.parser.d.ts +18 -0
- package/dist/cli/commands/billing.command.parser.js +136 -0
- package/dist/cli/commands/billing.command.parser.js.map +1 -0
- package/dist/cli/commands/billing.command.shared.d.ts +7 -0
- package/dist/cli/commands/billing.command.shared.js +78 -0
- package/dist/cli/commands/billing.command.shared.js.map +1 -0
- package/dist/cli/commands/billing.command.shortcuts.d.ts +7 -0
- package/dist/cli/commands/billing.command.shortcuts.js +52 -0
- package/dist/cli/commands/billing.command.shortcuts.js.map +1 -0
- package/dist/cli/commands/config.command.d.ts +2 -0
- package/dist/cli/commands/config.command.js +125 -0
- package/dist/cli/commands/config.command.js.map +1 -0
- package/dist/cli/commands/examples.command.d.ts +2 -0
- package/dist/cli/commands/examples.command.js +14 -0
- package/dist/cli/commands/examples.command.js.map +1 -0
- package/dist/cli/commands/storybook.command.d.ts +2 -0
- package/dist/cli/commands/storybook.command.js +26 -0
- package/dist/cli/commands/storybook.command.js.map +1 -0
- package/dist/cli/help.d.ts +10 -0
- package/dist/cli/help.js +473 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +41 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/program.d.ts +2 -0
- package/dist/cli/program.js +28 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/types.d.ts +6 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/version.d.ts +1 -0
- package/dist/cli/version.js +2 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/dates/arca-date.d.ts +2 -0
- package/dist/lib/dates/arca-date.js +28 -0
- package/dist/lib/dates/arca-date.js.map +1 -0
- package/dist/lib/errors/app-error.d.ts +14 -0
- package/dist/lib/errors/app-error.js +29 -0
- package/dist/lib/errors/app-error.js.map +1 -0
- package/dist/lib/files/read-json-file.d.ts +1 -0
- package/dist/lib/files/read-json-file.js +21 -0
- package/dist/lib/files/read-json-file.js.map +1 -0
- package/dist/lib/paths/mask-path.d.ts +1 -0
- package/dist/lib/paths/mask-path.js +17 -0
- package/dist/lib/paths/mask-path.js.map +1 -0
- package/dist/lib/security/certificate.d.ts +7 -0
- package/dist/lib/security/certificate.js +16 -0
- package/dist/lib/security/certificate.js.map +1 -0
- package/dist/lib/security/pem.d.ts +5 -0
- package/dist/lib/security/pem.js +36 -0
- package/dist/lib/security/pem.js.map +1 -0
- package/dist/modules/billing/billing-response.d.ts +4 -0
- package/dist/modules/billing/billing-response.js +74 -0
- package/dist/modules/billing/billing-response.js.map +1 -0
- package/dist/modules/billing/billing.amounts.d.ts +9 -0
- package/dist/modules/billing/billing.amounts.js +30 -0
- package/dist/modules/billing/billing.amounts.js.map +1 -0
- package/dist/modules/billing/billing.associated-vouchers.d.ts +10 -0
- package/dist/modules/billing/billing.associated-vouchers.js +51 -0
- package/dist/modules/billing/billing.associated-vouchers.js.map +1 -0
- package/dist/modules/billing/billing.constants.d.ts +2 -0
- package/dist/modules/billing/billing.constants.js +3 -0
- package/dist/modules/billing/billing.constants.js.map +1 -0
- package/dist/modules/billing/billing.date-range.d.ts +8 -0
- package/dist/modules/billing/billing.date-range.js +45 -0
- package/dist/modules/billing/billing.date-range.js.map +1 -0
- package/dist/modules/billing/billing.display.d.ts +13 -0
- package/dist/modules/billing/billing.display.js +111 -0
- package/dist/modules/billing/billing.display.js.map +1 -0
- package/dist/modules/billing/billing.json-format.d.ts +6 -0
- package/dist/modules/billing/billing.json-format.js +5 -0
- package/dist/modules/billing/billing.json-format.js.map +1 -0
- package/dist/modules/billing/billing.labels.d.ts +9 -0
- package/dist/modules/billing/billing.labels.js +108 -0
- package/dist/modules/billing/billing.labels.js.map +1 -0
- package/dist/modules/billing/billing.mappers.d.ts +8 -0
- package/dist/modules/billing/billing.mappers.js +59 -0
- package/dist/modules/billing/billing.mappers.js.map +1 -0
- package/dist/modules/billing/billing.presenter.d.ts +7 -0
- package/dist/modules/billing/billing.presenter.js +3 -0
- package/dist/modules/billing/billing.presenter.js.map +1 -0
- package/dist/modules/billing/billing.schemas.d.ts +74 -0
- package/dist/modules/billing/billing.schemas.js +69 -0
- package/dist/modules/billing/billing.schemas.js.map +1 -0
- package/dist/modules/billing/billing.serialize.d.ts +8 -0
- package/dist/modules/billing/billing.serialize.js +51 -0
- package/dist/modules/billing/billing.serialize.js.map +1 -0
- package/dist/modules/billing/billing.service.d.ts +15 -0
- package/dist/modules/billing/billing.service.js +88 -0
- package/dist/modules/billing/billing.service.js.map +1 -0
- package/dist/modules/billing/billing.text.d.ts +8 -0
- package/dist/modules/billing/billing.text.js +44 -0
- package/dist/modules/billing/billing.text.js.map +1 -0
- package/dist/modules/billing/billing.types.d.ts +13 -0
- package/dist/modules/billing/billing.types.internal.d.ts +25 -0
- package/dist/modules/billing/billing.types.internal.js +2 -0
- package/dist/modules/billing/billing.types.internal.js.map +1 -0
- package/dist/modules/billing/billing.types.js +2 -0
- package/dist/modules/billing/billing.types.js.map +1 -0
- package/dist/modules/billing/billing.validation.d.ts +5 -0
- package/dist/modules/billing/billing.validation.js +45 -0
- package/dist/modules/billing/billing.validation.js.map +1 -0
- package/dist/modules/billing/voucher-kind-map.d.ts +9 -0
- package/dist/modules/billing/voucher-kind-map.js +180 -0
- package/dist/modules/billing/voucher-kind-map.js.map +1 -0
- package/dist/modules/config/config-doctor.d.ts +15 -0
- package/dist/modules/config/config-doctor.js +125 -0
- package/dist/modules/config/config-doctor.js.map +1 -0
- package/dist/modules/config/config-value-parser.d.ts +2 -0
- package/dist/modules/config/config-value-parser.js +71 -0
- package/dist/modules/config/config-value-parser.js.map +1 -0
- package/dist/modules/config/config.presenter.d.ts +7 -0
- package/dist/modules/config/config.presenter.js +80 -0
- package/dist/modules/config/config.presenter.js.map +1 -0
- package/dist/modules/config/config.schemas.d.ts +87 -0
- package/dist/modules/config/config.schemas.js +84 -0
- package/dist/modules/config/config.schemas.js.map +1 -0
- package/dist/modules/config/config.service.d.ts +20 -0
- package/dist/modules/config/config.service.js +78 -0
- package/dist/modules/config/config.service.js.map +1 -0
- package/dist/modules/examples/examples.d.ts +1 -0
- package/dist/modules/examples/examples.js +156 -0
- package/dist/modules/examples/examples.js.map +1 -0
- package/dist/modules/storybook/showcase-theme.d.ts +7 -0
- package/dist/modules/storybook/showcase-theme.js +6 -0
- package/dist/modules/storybook/showcase-theme.js.map +1 -0
- package/dist/modules/storybook/showcase.d.ts +2 -0
- package/dist/modules/storybook/showcase.js +310 -0
- package/dist/modules/storybook/showcase.js.map +1 -0
- package/dist/modules/update-check/update-check.presenter.d.ts +2 -0
- package/dist/modules/update-check/update-check.presenter.js +6 -0
- package/dist/modules/update-check/update-check.presenter.js.map +1 -0
- package/dist/modules/update-check/update-check.service.d.ts +8 -0
- package/dist/modules/update-check/update-check.service.js +72 -0
- package/dist/modules/update-check/update-check.service.js.map +1 -0
- package/dist/services/arca/arca-billing.gateway.d.ts +9 -0
- package/dist/services/arca/arca-billing.gateway.js +10 -0
- package/dist/services/arca/arca-billing.gateway.js.map +1 -0
- package/dist/services/arca/arca-client.factory.d.ts +5 -0
- package/dist/services/arca/arca-client.factory.js +7 -0
- package/dist/services/arca/arca-client.factory.js.map +1 -0
- package/dist/services/arca/arca-context.resolver.d.ts +44 -0
- package/dist/services/arca/arca-context.resolver.js +120 -0
- package/dist/services/arca/arca-context.resolver.js.map +1 -0
- package/dist/ui/components/contentPanel.d.ts +5 -0
- package/dist/ui/components/contentPanel.js +11 -0
- package/dist/ui/components/contentPanel.js.map +1 -0
- package/dist/ui/components/errorPanel.d.ts +1 -0
- package/dist/ui/components/errorPanel.js +13 -0
- package/dist/ui/components/errorPanel.js.map +1 -0
- package/dist/ui/components/index.d.ts +6 -0
- package/dist/ui/components/index.js +7 -0
- package/dist/ui/components/index.js.map +1 -0
- package/dist/ui/components/keyValuePanel.d.ts +3 -0
- package/dist/ui/components/keyValuePanel.js +14 -0
- package/dist/ui/components/keyValuePanel.js.map +1 -0
- package/dist/ui/components/noticePanel.d.ts +3 -0
- package/dist/ui/components/noticePanel.js +11 -0
- package/dist/ui/components/noticePanel.js.map +1 -0
- package/dist/ui/components/rawPanel.d.ts +1 -0
- package/dist/ui/components/rawPanel.js +5 -0
- package/dist/ui/components/rawPanel.js.map +1 -0
- package/dist/ui/components/statusPanel.d.ts +3 -0
- package/dist/ui/components/statusPanel.js +20 -0
- package/dist/ui/components/statusPanel.js.map +1 -0
- package/dist/ui/index.d.ts +5 -0
- package/dist/ui/index.js +6 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/presenters/billing.presenter.d.ts +2 -0
- package/dist/ui/presenters/billing.presenter.js +2 -0
- package/dist/ui/presenters/billing.presenter.js.map +1 -0
- package/dist/ui/presenters/config.presenter.d.ts +1 -0
- package/dist/ui/presenters/config.presenter.js +2 -0
- package/dist/ui/presenters/config.presenter.js.map +1 -0
- package/dist/ui/presenters/errors.presenter.d.ts +1 -0
- package/dist/ui/presenters/errors.presenter.js +89 -0
- package/dist/ui/presenters/errors.presenter.js.map +1 -0
- package/dist/ui/presenters/errors.zod-presenter.d.ts +2 -0
- package/dist/ui/presenters/errors.zod-presenter.js +82 -0
- package/dist/ui/presenters/errors.zod-presenter.js.map +1 -0
- package/dist/ui/presenters/index.d.ts +4 -0
- package/dist/ui/presenters/index.js +5 -0
- package/dist/ui/presenters/index.js.map +1 -0
- package/dist/ui/presenters/showcase.presenter.d.ts +1 -0
- package/dist/ui/presenters/showcase.presenter.js +2 -0
- package/dist/ui/presenters/showcase.presenter.js.map +1 -0
- package/dist/ui/primitives/index.d.ts +10 -0
- package/dist/ui/primitives/index.js +11 -0
- package/dist/ui/primitives/index.js.map +1 -0
- package/dist/ui/primitives/renderDivider.d.ts +5 -0
- package/dist/ui/primitives/renderDivider.js +5 -0
- package/dist/ui/primitives/renderDivider.js.map +1 -0
- package/dist/ui/primitives/renderFooter.d.ts +7 -0
- package/dist/ui/primitives/renderFooter.js +6 -0
- package/dist/ui/primitives/renderFooter.js.map +1 -0
- package/dist/ui/primitives/renderJson.d.ts +3 -0
- package/dist/ui/primitives/renderJson.js +19 -0
- package/dist/ui/primitives/renderJson.js.map +1 -0
- package/dist/ui/primitives/renderKeyValue.d.ts +14 -0
- package/dist/ui/primitives/renderKeyValue.js +34 -0
- package/dist/ui/primitives/renderKeyValue.js.map +1 -0
- package/dist/ui/primitives/renderLogo.d.ts +2 -0
- package/dist/ui/primitives/renderLogo.js +28 -0
- package/dist/ui/primitives/renderLogo.js.map +1 -0
- package/dist/ui/primitives/renderObject.d.ts +1 -0
- package/dist/ui/primitives/renderObject.js +19 -0
- package/dist/ui/primitives/renderObject.js.map +1 -0
- package/dist/ui/primitives/renderPanel.d.ts +23 -0
- package/dist/ui/primitives/renderPanel.js +114 -0
- package/dist/ui/primitives/renderPanel.js.map +1 -0
- package/dist/ui/primitives/renderSubtitle.d.ts +7 -0
- package/dist/ui/primitives/renderSubtitle.js +6 -0
- package/dist/ui/primitives/renderSubtitle.js.map +1 -0
- package/dist/ui/primitives/renderTable.d.ts +6 -0
- package/dist/ui/primitives/renderTable.js +14 -0
- package/dist/ui/primitives/renderTable.js.map +1 -0
- package/dist/ui/primitives/text.d.ts +18 -0
- package/dist/ui/primitives/text.js +154 -0
- package/dist/ui/primitives/text.js.map +1 -0
- package/dist/ui/stream/index.d.ts +1 -0
- package/dist/ui/stream/index.js +2 -0
- package/dist/ui/stream/index.js.map +1 -0
- package/dist/ui/stream/terminal-stream.d.ts +10 -0
- package/dist/ui/stream/terminal-stream.js +20 -0
- package/dist/ui/stream/terminal-stream.js.map +1 -0
- package/dist/ui/theme/index.d.ts +1 -0
- package/dist/ui/theme/index.js +2 -0
- package/dist/ui/theme/index.js.map +1 -0
- package/dist/ui/theme/theme.d.ts +27 -0
- package/dist/ui/theme/theme.js +41 -0
- package/dist/ui/theme/theme.js.map +1 -0
- package/llms.txt +157 -0
- package/package.json +98 -35
- package/.babelrc +0 -4
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -17
- package/.npmignore +0 -1
- package/lib/arcli.min.js +0 -1
- package/src/commander/index.js +0 -3
- package/src/config.js +0 -22
- package/src/index.js +0 -19
- package/src/init/index.js +0 -13
- package/src/logger/index.js +0 -8
- package/src/logger/winston.js +0 -55
- package/src/run.js +0 -4
- package/src/spinner/index.js +0 -8
- package/src/spinner/ora.js +0 -50
- package/tst/index.js +0 -29
- package/webpack.config.js +0 -47
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LcsGrz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,8 +1,168 @@
|
|
|
1
|
-
|
|
2
|
-
---
|
|
1
|
+
# ARCLI
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/arcli)
|
|
4
|
+
[](https://github.com/LcsGrz/arcli/actions/workflows/ci.yml)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](package.json)
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
d8888 8888888b. .d8888b. 888 8888888
|
|
10
|
+
d88888 888 Y88b d88P Y88b 888 888
|
|
11
|
+
d88P888 888 888 888 888 888 888
|
|
12
|
+
d88P 888 888 d88P 888 888 888
|
|
13
|
+
d88P 888 8888888P" 888 888 888
|
|
14
|
+
d88P 888 888 T88b 888 888 888 888
|
|
15
|
+
d8888888888 888 T88b Y88b d88P 888 888
|
|
16
|
+
d88P 888 888 T88b "Y8888P" 88888888 8888888
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Emití o previsualizá comprobantes ARCA desde tu terminal, con un flujo claro, seguro y rapido en lugar de utilizar UI.
|
|
20
|
+
|
|
21
|
+
## Características
|
|
22
|
+
|
|
23
|
+
- configuración persistente por usuario
|
|
24
|
+
- previsualización segura antes de emitir
|
|
25
|
+
- entrada por flags o JSON
|
|
26
|
+
- salida humana, JSON o respuesta bruta
|
|
27
|
+
- prompts interactivos cuando el flujo lo requiere
|
|
28
|
+
- integración real con ARCA
|
|
29
|
+
|
|
30
|
+
## Demo basica
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install -g arcli
|
|
34
|
+
arcli config
|
|
35
|
+
arcli config establecer cuit 20168598204
|
|
36
|
+
arcli config establecer puntoVenta 3
|
|
37
|
+
arcli config establecer cert.testing /ruta/al/certificado.crt
|
|
38
|
+
arcli config establecer key.testing /ruta/a/la/clave.key
|
|
39
|
+
|
|
40
|
+
arcli fc -m 15000 --cs --consumidor-final --ir-cf
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Inicio rápido
|
|
44
|
+
|
|
45
|
+
### 1. Instalar
|
|
46
|
+
|
|
47
|
+
Requiere Node.js 20 o superior.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install -g arcli
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 2. Crear o abrir la configuración
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
arcli config
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 3. Guardar defaults útiles
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
arcli config establecer cuit 20168598204
|
|
63
|
+
arcli config establecer puntoVenta 3
|
|
64
|
+
arcli config establecer concepto servicios
|
|
65
|
+
arcli config establecer ivaReceptor consumidor-final
|
|
66
|
+
arcli config establecer moneda ARS
|
|
67
|
+
arcli config establecer cotizacion 1
|
|
68
|
+
arcli config establecer emitir false
|
|
69
|
+
arcli config establecer bruto false
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 4. Configurar credenciales
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
arcli config establecer cert.testing /ruta/al/certificado.crt
|
|
76
|
+
arcli config establecer key.testing /ruta/a/la/clave.key
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Si después querés usar producción:
|
|
5
80
|
|
|
6
81
|
```bash
|
|
7
|
-
|
|
82
|
+
arcli config establecer cert.produccion /ruta/al/certificado.crt
|
|
83
|
+
arcli config establecer key.produccion /ruta/a/la/clave.key
|
|
8
84
|
```
|
|
85
|
+
|
|
86
|
+
### 5. Revisar el entorno activo
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
arcli config revisar
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 6. Previsualizar el primer comprobante
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
arcli fc -m 15000 --cs --consumidor-final --ir-cf
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 7. Emitir de verdad
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
arcli fc -m 15000 --cs --consumidor-final --ir-cf --emitir
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Cómo funciona
|
|
105
|
+
|
|
106
|
+
ARCLI toma datos por flags, JSON o config, valida lo que puede localmente, arma el payload y — si corresponde — llama a ARCA. La prioridad es `flags > JSON > config > defaults`.
|
|
107
|
+
|
|
108
|
+
Ver [docs/mental-model.md](docs/mental-model.md) para el modelo completo.
|
|
109
|
+
|
|
110
|
+
## Seguridad: testing vs producción
|
|
111
|
+
|
|
112
|
+
- Si no pasás nada, el entorno es `testing`.
|
|
113
|
+
- `testing` usa `cert.testing` y `key.testing`.
|
|
114
|
+
- `produccion` usa `cert.produccion` y `key.produccion`.
|
|
115
|
+
- Para emitir realmente en producción hacen falta:
|
|
116
|
+
- `--produccion`
|
|
117
|
+
- `--emitir`
|
|
118
|
+
|
|
119
|
+
Ejemplo:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
arcli fa -m 15000 --cs --cuit 20168598204 --ir-ri \
|
|
123
|
+
--produccion \
|
|
124
|
+
--emitir
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Documentación
|
|
128
|
+
|
|
129
|
+
- [Modelo mental](docs/mental-model.md)
|
|
130
|
+
- [Glosario](docs/glossary.md)
|
|
131
|
+
- [Referencia del CLI](docs/cli-reference.md)
|
|
132
|
+
- [Patrones de uso](docs/usage-patterns.md)
|
|
133
|
+
- [Configuración](docs/configuration.md)
|
|
134
|
+
- [Entrada y salida](docs/input-output.md)
|
|
135
|
+
- [Reglas de validación](docs/validation-rules.md)
|
|
136
|
+
- [Troubleshooting](docs/troubleshooting.md)
|
|
137
|
+
- [Limitaciones actuales](docs/limitations.md)
|
|
138
|
+
- [Guía de desarrollo](docs/development.md)
|
|
139
|
+
- [Testing](docs/ui-smoke-checklist.md)
|
|
140
|
+
- [Cómo contribuir](CONTRIBUTING.md)
|
|
141
|
+
- [llms.txt](llms.txt): referencia condensada para que un agente/IA con acceso a terminal ejecute el CLI directamente
|
|
142
|
+
- [Seguridad](SECURITY.md)
|
|
143
|
+
|
|
144
|
+
## ❤️ Agradecimientos
|
|
145
|
+
|
|
146
|
+
ARCLI existe apoyado en trabajo open source que ya resolvió partes difíciles del problema. En particular:
|
|
147
|
+
|
|
148
|
+
- [`@arcasdk/core`](https://github.com/ralcorta/arcasdk) creada por [Rodrigo Alcorta](https://github.com/ralcorta)
|
|
149
|
+
- [Arpit Bhayani](https://github.com/arpitbbhayani) por cederme el paquete de npm bajo el nombre de 'arcli', estaba siendo utilizado por el.
|
|
150
|
+
|
|
151
|
+
Y la comunidad open source que mantiene herramientas de este estilo vivas y usables
|
|
152
|
+
|
|
153
|
+
## ☕ Apoyar el proyecto
|
|
154
|
+
|
|
155
|
+
ARCLI es open source. Mantenerlo, probarlo contra servicios reales y documentarlo bien lleva tiempo.
|
|
156
|
+
|
|
157
|
+
- Si queres darme un mimo: [Cafesito](https://cafecito.app/lcsgrz)
|
|
158
|
+
- Reporta issues claros, repros buenos y feedback real de uso
|
|
159
|
+
- Dejame tu estrellita ★ :)
|
|
160
|
+
|
|
161
|
+
## Licencia
|
|
162
|
+
|
|
163
|
+
MIT © [LcsGrz](https://github.com/LcsGrz). Ver [LICENSE](LICENSE).
|
|
164
|
+
|
|
165
|
+
## Proyecto
|
|
166
|
+
|
|
167
|
+
- repo: [github.com/LcsGrz/arcli](https://github.com/LcsGrz/arcli)
|
|
168
|
+
- issues: [github.com/LcsGrz/arcli/issues](https://github.com/LcsGrz/arcli/issues)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { InputValidationError } from '../../lib/errors/app-error.js';
|
|
2
|
+
import { getVoucherKindByFamilyAndLetter, VOUCHER_FAMILIES, VOUCHER_KIND_MAP, VOUCHER_LETTERS, } from '../../modules/billing/voucher-kind-map.js';
|
|
3
|
+
import { configureSpanishHelp, createFamilyHelp } from '../help.js';
|
|
4
|
+
import { executeBillingCommand, registerBillingCommandOptions } from './billing.command.shared.js';
|
|
5
|
+
export function registerBillingFamilyCommands(program) {
|
|
6
|
+
for (const family of VOUCHER_FAMILIES) {
|
|
7
|
+
const familyShortcuts = Object.values(VOUCHER_KIND_MAP)
|
|
8
|
+
.filter((definition) => definition.family === family)
|
|
9
|
+
.map((definition) => definition.shortcut)
|
|
10
|
+
.join(', ');
|
|
11
|
+
const command = program
|
|
12
|
+
.command(family)
|
|
13
|
+
.description(`usar ${family} por letra A, B o C con ejemplos y atajos${familyShortcuts ? ` (${familyShortcuts})` : ''}`)
|
|
14
|
+
.argument('<letra>', 'letra del comprobante', (value) => value.toLowerCase());
|
|
15
|
+
configureSpanishHelp(command);
|
|
16
|
+
registerBillingCommandOptions(command);
|
|
17
|
+
command.action(async (letter) => {
|
|
18
|
+
if (!VOUCHER_LETTERS.includes(letter)) {
|
|
19
|
+
throw new InputValidationError(`La letra "${letter}" no es valida. Use a, b o c.`);
|
|
20
|
+
}
|
|
21
|
+
const definition = getVoucherKindByFamilyAndLetter(family, letter);
|
|
22
|
+
if (!definition) {
|
|
23
|
+
throw new InputValidationError(`No existe un comprobante para la familia "${family}" y letra "${letter}".`);
|
|
24
|
+
}
|
|
25
|
+
await executeBillingCommand(command, definition.shortcut);
|
|
26
|
+
});
|
|
27
|
+
command.addHelpText('after', createFamilyHelp(family));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=billing-family.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-family.command.js","sourceRoot":"","sources":["../../../src/cli/commands/billing-family.command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EACL,+BAA+B,EAC/B,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAChB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEjE,OAAO,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAEhG,MAAM,UAAU,6BAA6B,CAAC,OAAgB;IAC5D,KAAK,MAAM,MAAM,IAAI,gBAAgB,EAAE,CAAC;QACtC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC;aACpD,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,KAAK,MAAM,CAAC;aACpD,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;aACxC,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,MAAM,OAAO,GAAG,OAAO;aACpB,OAAO,CAAC,MAAM,CAAC;aACf,WAAW,CACV,QAAQ,MAAM,4CAA4C,eAAe,CAAC,CAAC,CAAC,KAAK,eAAe,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAC3G;aACA,QAAQ,CAAC,SAAS,EAAE,uBAAuB,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;QAExF,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAE9B,6BAA6B,CAAC,OAAO,CAAC,CAAC;QAEvC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,EAAE;YACtC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,MAAuB,CAAC,EAAE,CAAC;gBACvD,MAAM,IAAI,oBAAoB,CAAC,aAAa,MAAM,+BAA+B,CAAC,CAAC;YACrF,CAAC;YAED,MAAM,UAAU,GAAG,+BAA+B,CAAC,MAAM,EAAE,MAAuB,CAAC,CAAC;YAEpF,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,MAAM,IAAI,oBAAoB,CAAC,6CAA6C,MAAM,cAAc,MAAM,IAAI,CAAC,CAAC;YAC9G,CAAC;YAED,MAAM,qBAAqB,CAAC,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;IACzD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { VOUCHER_KIND_MAP, VOUCHER_SHORTCUTS } from '../../modules/billing/voucher-kind-map.js';
|
|
2
|
+
import { configureSpanishHelp, createShortcutHelp } from '../help.js';
|
|
3
|
+
import { executeBillingCommand, registerBillingCommandOptions } from './billing.command.shared.js';
|
|
4
|
+
export function registerBillingShortcutCommands(program) {
|
|
5
|
+
for (const shortcut of VOUCHER_SHORTCUTS) {
|
|
6
|
+
const definition = VOUCHER_KIND_MAP[shortcut];
|
|
7
|
+
const command = program
|
|
8
|
+
.command(shortcut)
|
|
9
|
+
.description(`${definition.displayName} por shortcut, con ayuda guiada para previsualizar o emitir`);
|
|
10
|
+
configureSpanishHelp(command);
|
|
11
|
+
registerBillingCommandOptions(command);
|
|
12
|
+
command.action(async () => {
|
|
13
|
+
await executeBillingCommand(command, shortcut);
|
|
14
|
+
});
|
|
15
|
+
command.addHelpText('after', createShortcutHelp(shortcut));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=billing-shortcuts.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-shortcuts.command.js","sourceRoot":"","sources":["../../../src/cli/commands/billing-shortcuts.command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEnE,OAAO,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAEhG,MAAM,UAAU,+BAA+B,CAAC,OAAgB;IAC9D,KAAK,MAAM,QAAQ,IAAI,iBAAiB,EAAE,CAAC;QACzC,MAAM,UAAU,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAC9C,MAAM,OAAO,GAAG,OAAO;aACpB,OAAO,CAAC,QAAQ,CAAC;aACjB,WAAW,CAAC,GAAG,UAAU,CAAC,WAAW,6DAA6D,CAAC,CAAC;QAEvG,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAE9B,6BAA6B,CAAC,OAAO,CAAC,CAAC;QAEvC,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;YACxB,MAAM,qBAAqB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BillingCommandInput } from '../../modules/billing/billing.schemas';
|
|
2
|
+
import type { BillingService } from '../../modules/billing/billing.service';
|
|
3
|
+
import type { ResolvedArcaRuntime } from '../../services/arca/arca-context.resolver';
|
|
4
|
+
export interface InteractiveBillingPreviewOutcome {
|
|
5
|
+
readonly confirmedInteractively: boolean;
|
|
6
|
+
readonly inputs: BillingCommandInput[];
|
|
7
|
+
readonly previewShown: boolean;
|
|
8
|
+
readonly proceed: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function runInteractiveBillingPreview(options: {
|
|
11
|
+
readonly inputs: BillingCommandInput[];
|
|
12
|
+
readonly modeSource: 'default' | 'file' | 'flags';
|
|
13
|
+
readonly runtime: ResolvedArcaRuntime;
|
|
14
|
+
readonly service: BillingService;
|
|
15
|
+
readonly useRaw: boolean;
|
|
16
|
+
readonly voucherLabel: string;
|
|
17
|
+
}): Promise<InteractiveBillingPreviewOutcome>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import select from '@inquirer/select';
|
|
2
|
+
import { writeTerminalOutput } from '../../ui/index.js';
|
|
3
|
+
import { formatBillingOutputs } from './billing.command.output.js';
|
|
4
|
+
async function promptForEmission(count, voucherLabel) {
|
|
5
|
+
return select({
|
|
6
|
+
choices: [
|
|
7
|
+
{ name: 'Si, emitir ahora', value: true },
|
|
8
|
+
{ name: 'No, dejar sin emitir', value: false },
|
|
9
|
+
],
|
|
10
|
+
default: true,
|
|
11
|
+
message: count > 1 ? `¿Desea emitir los ${count} comprobantes ahora?` : `¿Desea emitir ${voucherLabel} ahora?`,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function applyEmitDecision(inputs, shouldEmit) {
|
|
15
|
+
return inputs.map((input) => ({
|
|
16
|
+
...input,
|
|
17
|
+
dryRun: !shouldEmit,
|
|
18
|
+
emit: shouldEmit,
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
export async function runInteractiveBillingPreview(options) {
|
|
22
|
+
const shouldPromptForEmit = options.modeSource === 'default' &&
|
|
23
|
+
options.inputs.some((input) => !input.emit) &&
|
|
24
|
+
!options.runtime.outputJson &&
|
|
25
|
+
process.stdin.isTTY &&
|
|
26
|
+
process.stdout.isTTY;
|
|
27
|
+
if (!shouldPromptForEmit) {
|
|
28
|
+
return {
|
|
29
|
+
confirmedInteractively: false,
|
|
30
|
+
inputs: options.inputs,
|
|
31
|
+
previewShown: false,
|
|
32
|
+
proceed: true,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const previewGateway = {
|
|
36
|
+
createNextVoucher: async () => {
|
|
37
|
+
throw new Error('No deberia ejecutarse la emision real durante la vista previa.');
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
const previewResults = [];
|
|
41
|
+
for (const input of options.inputs) {
|
|
42
|
+
previewResults.push(await options.service.execute({
|
|
43
|
+
gateway: previewGateway,
|
|
44
|
+
input,
|
|
45
|
+
runtime: options.runtime,
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
writeTerminalOutput(formatBillingOutputs(previewResults, { environment: options.runtime.environment, raw: options.useRaw }));
|
|
49
|
+
const confirmed = await promptForEmission(options.inputs.length, options.voucherLabel);
|
|
50
|
+
if (!confirmed) {
|
|
51
|
+
return {
|
|
52
|
+
confirmedInteractively: false,
|
|
53
|
+
inputs: options.inputs,
|
|
54
|
+
previewShown: true,
|
|
55
|
+
proceed: false,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
confirmedInteractively: true,
|
|
60
|
+
inputs: applyEmitDecision(options.inputs, true),
|
|
61
|
+
previewShown: true,
|
|
62
|
+
proceed: true,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=billing.command.interactive-preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.command.interactive-preview.js","sourceRoot":"","sources":["../../../src/cli/commands/billing.command.interactive-preview.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAMtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CA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AAE,KAAK,IAAI,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;QACpF,CAAC;KACF,CAAC;IACF,MAAM,cAAc,GAA6B,EAAE,CAAC;IAEpD,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnC,cAAc,CAAC,IAAI,CACjB,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;YAC5B,OAAO,EAAE,cAAc;YACvB,KAAK;YACL,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,mBAAmB,CACjB,oBAAoB,CAAC,cAAc,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CACxG,CAAC;IAEF,MAAM,SAAS,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAEvF,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO;YACL,sBAAsB,EAAE,KAAK;YAC7B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,YAAY,EAAE,IAAI;YAClB,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;IAED,OAAO;QACL,sBAAsB,EAAE,IAAI;QAC5B,MAAM,EAAE,iBAAiB,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;QAC/C,YAAY,EAAE,IAAI;QAClB,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Option } from 'commander';
|
|
2
|
+
export function registerBillingOptions(command) {
|
|
3
|
+
command
|
|
4
|
+
.option('-m, --monto <number>', 'importe total del comprobante', parseFloat)
|
|
5
|
+
.option('-d, --dia <number>', 'dia de vencimiento o referencia del servicio', (value) => Number.parseInt(value, 10))
|
|
6
|
+
.option('--punto-venta <number>', 'punto de venta', (value) => Number.parseInt(value, 10))
|
|
7
|
+
.option('--pv <number>', 'alias de punto de venta', (value) => Number.parseInt(value, 10))
|
|
8
|
+
.option('--cargar <path>', 'cargar datos base desde un archivo JSON')
|
|
9
|
+
.option('-f, --fecha <fecha>', 'fecha del comprobante; acepta D, D/M, D/M/YY o D/M/YYYY con - o /')
|
|
10
|
+
.option('-c, --concepto <tipo>', 'productos, servicios o productos y servicios (alias: cs, cp, csp)')
|
|
11
|
+
.option('--cs', 'usar concepto servicios')
|
|
12
|
+
.option('--cp', 'usar concepto productos')
|
|
13
|
+
.option('--csp', 'usar concepto productos y servicios')
|
|
14
|
+
.option('--moneda <codigo>', 'codigo de moneda, por ejemplo ARS o USD')
|
|
15
|
+
.option('--mda <codigo>', 'alias de moneda, por ejemplo ARS o USD')
|
|
16
|
+
.option('--cm <number>', 'alias de cotizacion de la moneda', parseFloat)
|
|
17
|
+
.option('--cotizacion-moneda <number>', 'cotizacion de la moneda', parseFloat)
|
|
18
|
+
.option('--cuit <number>', 'usar CUIT del receptor', (value) => Number.parseInt(value, 10))
|
|
19
|
+
.option('--cuil <number>', 'usar CUIL del receptor', (value) => Number.parseInt(value, 10))
|
|
20
|
+
.option('--dni <number>', 'usar DNI del receptor', (value) => Number.parseInt(value, 10))
|
|
21
|
+
.option('--consumidor-final', 'usar consumidor final con documento 0')
|
|
22
|
+
.option('--cfinal', 'alias de consumidor final con documento 0')
|
|
23
|
+
.option('--iva-receptor <tipo>', 'condicion IVA del receptor')
|
|
24
|
+
.option('--ir <tipo>', 'alias rapido de condicion IVA del receptor')
|
|
25
|
+
.option('--ir-ce', 'IVA receptor: cliente del exterior')
|
|
26
|
+
.option('--ir-cf', 'IVA receptor: consumidor final')
|
|
27
|
+
.option('--ir-il', 'IVA receptor: IVA liberado')
|
|
28
|
+
.option('--ir-ina', 'IVA receptor: IVA no alcanzado')
|
|
29
|
+
.option('--ir-ms', 'IVA receptor: monotributista social')
|
|
30
|
+
.option('--ir-mtip', 'IVA receptor: monotributo trabajador independiente promovido')
|
|
31
|
+
.option('--ir-pe', 'IVA receptor: proveedor del exterior')
|
|
32
|
+
.option('--ir-ri', 'IVA receptor: responsable inscripto')
|
|
33
|
+
.option('--ir-rm', 'IVA receptor: responsable monotributo')
|
|
34
|
+
.option('--ir-se', 'IVA receptor: sujeto exento')
|
|
35
|
+
.option('--ir-snc', 'IVA receptor: sujeto no categorizado')
|
|
36
|
+
.option('--sd <fecha>', 'alias rapido de fecha de inicio de servicio')
|
|
37
|
+
.option('--servicio-desde <fecha>', 'fecha de inicio de servicio')
|
|
38
|
+
.option('--sh <fecha>', 'alias rapido de fecha de fin de servicio')
|
|
39
|
+
.option('--servicio-hasta <fecha>', 'fecha de fin de servicio')
|
|
40
|
+
.option('--at <number>', 'tipo ARCA del comprobante asociado', (value) => Number.parseInt(value, 10))
|
|
41
|
+
.option('--apv <number>', 'punto de venta del comprobante asociado', (value) => Number.parseInt(value, 10))
|
|
42
|
+
.option('--asociado-punto-venta <number>', 'punto de venta del comprobante asociado', (value) => Number.parseInt(value, 10))
|
|
43
|
+
.option('--ar <number>', 'numero del comprobante asociado', (value) => Number.parseInt(value, 10))
|
|
44
|
+
.option('--ac <shortcut>', 'atajo del comprobante asociado, por ejemplo fc o fa')
|
|
45
|
+
.option('--acuit <number>', 'CUIT del comprobante asociado')
|
|
46
|
+
.option('--previsualizar', 'mostrar el payload antes de emitir en ARCA')
|
|
47
|
+
.addOption(new Option('--emitir', 'emitir realmente en ARCA'));
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=billing.command.options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.command.options.js","sourceRoot":"","sources":["../../../src/cli/commands/billing.command.options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,UAAU,sBAAsB,CAAC,OAAgB;IACrD,OAAO;SACJ,MAAM,CAA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C,iCAAiC,EAAE,yCAAyC,EAAE,CAAC,KAAa,EAAE,EAAE,CACtG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAC3B;SACA,MAAM,CAAC,eAAe,EAAE,iCAAiC,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;SACzG,MAAM,CAAC,iBAAiB,EAAE,qDAAqD,CAAC;SAChF,MAAM,CAAC,kBAAkB,EAAE,+BAA+B,CAAC;SAC3D,MAAM,CAAC,iBAAiB,EAAE,4CAA4C,CAAC;SACvE,SAAS,CAAC,IAAI,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BillingExecutionResult } from '../../modules/billing/billing.types.internal';
|
|
2
|
+
export declare function formatBillingOutputs(results: BillingExecutionResult[], options: {
|
|
3
|
+
readonly environment: 'produccion' | 'testing';
|
|
4
|
+
readonly previewShown?: boolean;
|
|
5
|
+
readonly raw: boolean;
|
|
6
|
+
}): string;
|
|
7
|
+
export declare function writeBillingCommandResults(results: BillingExecutionResult[], options: {
|
|
8
|
+
readonly environment: 'produccion' | 'testing';
|
|
9
|
+
readonly outputJson: boolean;
|
|
10
|
+
readonly previewShown?: boolean;
|
|
11
|
+
readonly raw: boolean;
|
|
12
|
+
}): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { serializeBillingBatch } from '../../modules/billing/billing.serialize.js';
|
|
2
|
+
import { formatBillingResultAsJson, formatBillingResultAsText, writeTerminalJson, writeTerminalOutput } from '../../ui/index.js';
|
|
3
|
+
export function formatBillingOutputs(results, options) {
|
|
4
|
+
return results
|
|
5
|
+
.map((result, index) => {
|
|
6
|
+
const output = formatBillingResultAsText(result, {
|
|
7
|
+
environment: options.environment,
|
|
8
|
+
previewShown: options.previewShown,
|
|
9
|
+
raw: options.raw,
|
|
10
|
+
});
|
|
11
|
+
if (results.length === 1) {
|
|
12
|
+
return output;
|
|
13
|
+
}
|
|
14
|
+
return [`Lote ${index + 1}/${results.length}`, output].join('\n');
|
|
15
|
+
})
|
|
16
|
+
.join('\n\n');
|
|
17
|
+
}
|
|
18
|
+
export function writeBillingCommandResults(results, options) {
|
|
19
|
+
if (options.outputJson) {
|
|
20
|
+
if (results.length === 1) {
|
|
21
|
+
writeTerminalJson(formatBillingResultAsJson(results[0], { raw: options.raw }));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
writeTerminalJson(JSON.stringify(serializeBillingBatch(results, { raw: options.raw }), null, 2));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
writeTerminalOutput(formatBillingOutputs(results, {
|
|
28
|
+
environment: options.environment,
|
|
29
|
+
previewShown: options.previewShown,
|
|
30
|
+
raw: options.raw,
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=billing.command.output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.command.output.js","sourceRoot":"","sources":["../../../src/cli/commands/billing.command.output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAEhF,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAExH,MAAM,UAAU,oBAAoB,CAClC,OAAiC,EACjC,OAIC;IAED,OAAO,OAAO;SACX,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QACrB,MAAM,MAAM,GAAG,yBAAyB,CAAC,MAAM,EAAE;YAC/C,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,GAAG,EAAE,OAAO,CAAC,GAAG;SACjB,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,OAAO,CAAC,QAAQ,KAAK,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpE,CAAC,CAAC;SACD,IAAI,CAAC,MAAM,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,OAAiC,EACjC,OAKC;IAED,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QACvB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,iBAAiB,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YAE/E,OAAO;QACT,CAAC;QAED,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAEjG,OAAO;IACT,CAAC;IAED,mBAAmB,CACjB,oBAAoB,CAAC,OAAO,EAAE;QAC5B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import { type BillingCommandInput } from '../../modules/billing/billing.schemas';
|
|
3
|
+
import type { VoucherShortcut } from '../../modules/billing/billing.types';
|
|
4
|
+
export { registerBillingOptions } from './billing.command.options';
|
|
5
|
+
export interface BillingCommandDefaults {
|
|
6
|
+
readonly defaultConcept?: BillingCommandInput['concept'];
|
|
7
|
+
readonly defaultCurrencyCode?: string;
|
|
8
|
+
readonly defaultEmit?: boolean;
|
|
9
|
+
readonly defaultExchangeRate?: number;
|
|
10
|
+
readonly defaultIvaCondition?: BillingCommandInput['ivaCondition'];
|
|
11
|
+
}
|
|
12
|
+
export interface BillingCommandPlan {
|
|
13
|
+
readonly inputs: BillingCommandInput[];
|
|
14
|
+
readonly modeSource: 'default' | 'file' | 'flags';
|
|
15
|
+
}
|
|
16
|
+
export declare function parseBillingCommandPlan(command: Command, shortcut: VoucherShortcut, defaults?: BillingCommandDefaults): BillingCommandPlan;
|
|
17
|
+
export declare function parseBillingCommandInputs(command: Command, shortcut: VoucherShortcut, defaults?: BillingCommandDefaults): BillingCommandInput[];
|
|
18
|
+
export declare function parseBillingCommandInput(command: Command, shortcut: VoucherShortcut, defaults?: BillingCommandDefaults): BillingCommandInput;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { InputValidationError } from '../../lib/errors/app-error.js';
|
|
2
|
+
import { readJsonFile } from '../../lib/files/read-json-file.js';
|
|
3
|
+
import { billingCommandSchema } from '../../modules/billing/billing.schemas.js';
|
|
4
|
+
import { resolveConceptShortcut, resolveDocumentIdentity, resolveIvaShortcut } from './billing.command.shortcuts.js';
|
|
5
|
+
export { registerBillingOptions } from './billing.command.options.js';
|
|
6
|
+
function pickString(...values) {
|
|
7
|
+
return values.find((value) => typeof value === 'string');
|
|
8
|
+
}
|
|
9
|
+
function pickNumber(...values) {
|
|
10
|
+
return values.find((value) => typeof value === 'number');
|
|
11
|
+
}
|
|
12
|
+
function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaults = {}) {
|
|
13
|
+
const commandOptions = command.optsWithGlobals();
|
|
14
|
+
const emitirSource = command.getOptionValueSource('emitir');
|
|
15
|
+
const previsualizarSource = command.getOptionValueSource('previsualizar');
|
|
16
|
+
const hasAssociatedShortcut = typeof commandOptions.ac === 'string';
|
|
17
|
+
const hasAssociatedType = typeof commandOptions.at === 'number';
|
|
18
|
+
if (hasAssociatedShortcut && hasAssociatedType) {
|
|
19
|
+
throw new InputValidationError('Use --ac o --at para identificar el comprobante asociado, pero no ambos a la vez.');
|
|
20
|
+
}
|
|
21
|
+
const associatedVoucherFromFlags = commandOptions.ar ||
|
|
22
|
+
commandOptions.apv ||
|
|
23
|
+
commandOptions.asociadoPuntoVenta ||
|
|
24
|
+
commandOptions.at ||
|
|
25
|
+
commandOptions.acuit ||
|
|
26
|
+
commandOptions.ac
|
|
27
|
+
? {
|
|
28
|
+
cuit: pickString(commandOptions.acuit),
|
|
29
|
+
numero: pickNumber(commandOptions.ar),
|
|
30
|
+
puntoVenta: pickNumber(commandOptions.apv, commandOptions.asociadoPuntoVenta),
|
|
31
|
+
shortcut: pickString(commandOptions.ac),
|
|
32
|
+
tipo: pickNumber(commandOptions.at),
|
|
33
|
+
}
|
|
34
|
+
: undefined;
|
|
35
|
+
const modeSource = emitirSource === 'cli' || previsualizarSource === 'cli'
|
|
36
|
+
? 'flags'
|
|
37
|
+
: typeof fileInput?.emitir === 'boolean' || typeof fileInput?.previsualizar === 'boolean'
|
|
38
|
+
? 'file'
|
|
39
|
+
: 'default';
|
|
40
|
+
const shouldEmit = emitirSource === 'cli'
|
|
41
|
+
? Boolean(commandOptions.emitir)
|
|
42
|
+
: typeof fileInput?.emitir === 'boolean'
|
|
43
|
+
? fileInput.emitir
|
|
44
|
+
: Boolean(defaults.defaultEmit);
|
|
45
|
+
const shouldDryRun = previsualizarSource === 'cli'
|
|
46
|
+
? Boolean(commandOptions.previsualizar)
|
|
47
|
+
: typeof fileInput?.previsualizar === 'boolean'
|
|
48
|
+
? fileInput.previsualizar
|
|
49
|
+
: !shouldEmit;
|
|
50
|
+
const conceptShortcut = resolveConceptShortcut(commandOptions);
|
|
51
|
+
const documentIdentity = resolveDocumentIdentity(commandOptions);
|
|
52
|
+
const ivaShortcut = resolveIvaShortcut(commandOptions);
|
|
53
|
+
const resolvedConcept = pickString(commandOptions.concepto) ?? conceptShortcut ?? fileInput?.concepto ?? defaults.defaultConcept;
|
|
54
|
+
const resolvedIvaCondition = pickString(commandOptions.ivaReceptor, commandOptions.ir) ??
|
|
55
|
+
ivaShortcut ??
|
|
56
|
+
fileInput?.ivaReceptor ??
|
|
57
|
+
defaults.defaultIvaCondition;
|
|
58
|
+
if (typeof commandOptions.concepto === 'string' && conceptShortcut) {
|
|
59
|
+
throw new InputValidationError('Use --concepto o un flag corto de concepto (--cs, --cp, --csp), pero no ambos.');
|
|
60
|
+
}
|
|
61
|
+
if (typeof commandOptions.ivaReceptor === 'string' && typeof commandOptions.ir === 'string') {
|
|
62
|
+
throw new InputValidationError('Use --iva-receptor o --ir para indicar IVA receptor, pero no ambos.');
|
|
63
|
+
}
|
|
64
|
+
if ((typeof commandOptions.ivaReceptor === 'string' || typeof commandOptions.ir === 'string') && ivaShortcut) {
|
|
65
|
+
throw new InputValidationError('Use --iva-receptor, --ir o un flag corto --ir-*, pero no varios a la vez.');
|
|
66
|
+
}
|
|
67
|
+
if (shouldEmit && shouldDryRun) {
|
|
68
|
+
throw new InputValidationError('Use --emitir o --previsualizar, pero no ambos a la vez.');
|
|
69
|
+
}
|
|
70
|
+
if (!resolvedConcept) {
|
|
71
|
+
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".');
|
|
72
|
+
}
|
|
73
|
+
if (!resolvedIvaCondition) {
|
|
74
|
+
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".');
|
|
75
|
+
}
|
|
76
|
+
const associatedVoucherFromFile = fileInput?.comprobanteAsociado
|
|
77
|
+
? {
|
|
78
|
+
cuit: fileInput.comprobanteAsociado.cuit,
|
|
79
|
+
numero: fileInput.comprobanteAsociado.numero,
|
|
80
|
+
puntoVenta: fileInput.comprobanteAsociado.puntoVenta,
|
|
81
|
+
shortcut: fileInput.comprobanteAsociado.atajo,
|
|
82
|
+
tipo: fileInput.comprobanteAsociado.tipo,
|
|
83
|
+
}
|
|
84
|
+
: undefined;
|
|
85
|
+
return {
|
|
86
|
+
...billingCommandSchema.parse({
|
|
87
|
+
associatedVoucher: associatedVoucherFromFlags ?? associatedVoucherFromFile,
|
|
88
|
+
billingDate: pickString(commandOptions.fecha, fileInput?.fechaComprobante),
|
|
89
|
+
concept: resolvedConcept,
|
|
90
|
+
currencyCode: pickString(commandOptions.moneda, commandOptions.mda, fileInput?.codigoMoneda, defaults.defaultCurrencyCode),
|
|
91
|
+
documentNumber: documentIdentity.documentNumber ?? fileInput?.numeroDocumento,
|
|
92
|
+
documentType: documentIdentity.documentType ?? fileInput?.tipoDocumento,
|
|
93
|
+
dryRun: shouldDryRun,
|
|
94
|
+
dueDay: pickNumber(commandOptions.dia, fileInput?.dia),
|
|
95
|
+
emit: shouldEmit,
|
|
96
|
+
exchangeRate: pickNumber(commandOptions.cotizacionMoneda, commandOptions.cm, fileInput?.cotizacionMoneda, defaults.defaultExchangeRate),
|
|
97
|
+
ivaCondition: resolvedIvaCondition,
|
|
98
|
+
pointOfSale: pickNumber(commandOptions.puntoVenta, commandOptions.pv, fileInput?.puntoVenta),
|
|
99
|
+
serviceEndDate: pickString(commandOptions.servicioHasta, commandOptions.sh, fileInput?.servicioHasta),
|
|
100
|
+
serviceStartDate: pickString(commandOptions.servicioDesde, commandOptions.sd, fileInput?.servicioDesde),
|
|
101
|
+
shortcut,
|
|
102
|
+
totalAmount: pickNumber(commandOptions.monto, fileInput?.montoTotal),
|
|
103
|
+
}),
|
|
104
|
+
__modeSource: modeSource,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export function parseBillingCommandPlan(command, shortcut, defaults = {}) {
|
|
108
|
+
const commandOptions = command.optsWithGlobals();
|
|
109
|
+
const inputFilePath = typeof commandOptions.cargar === 'string' ? commandOptions.cargar : undefined;
|
|
110
|
+
const fileInputSource = inputFilePath ? readJsonFile(inputFilePath) : undefined;
|
|
111
|
+
const fileInputs = Array.isArray(fileInputSource) ? fileInputSource : [fileInputSource].filter(Boolean);
|
|
112
|
+
if (fileInputs.length === 0) {
|
|
113
|
+
const { __modeSource, ...input } = parseBillingCommandInputFromSource(command, shortcut, undefined, defaults);
|
|
114
|
+
return {
|
|
115
|
+
inputs: [input],
|
|
116
|
+
modeSource: __modeSource,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const inputs = fileInputs.map((fileInput) => parseBillingCommandInputFromSource(command, shortcut, fileInput, defaults));
|
|
120
|
+
const modeSource = inputs.some((input) => input.__modeSource === 'flags')
|
|
121
|
+
? 'flags'
|
|
122
|
+
: inputs.some((input) => input.__modeSource === 'file')
|
|
123
|
+
? 'file'
|
|
124
|
+
: 'default';
|
|
125
|
+
return {
|
|
126
|
+
inputs: inputs.map(({ __modeSource: _modeSource, ...input }) => input),
|
|
127
|
+
modeSource,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
export function parseBillingCommandInputs(command, shortcut, defaults = {}) {
|
|
131
|
+
return parseBillingCommandPlan(command, shortcut, defaults).inputs;
|
|
132
|
+
}
|
|
133
|
+
export function parseBillingCommandInput(command, shortcut, defaults = {}) {
|
|
134
|
+
return parseBillingCommandInputs(command, shortcut, defaults)[0];
|
|
135
|
+
}
|
|
136
|
+
//# 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,EAA4B,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAGvG,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAElH,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AA8BnE,SAAS,UAAU,CAAC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