arcli 2.0.0 → 2.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/CHANGELOG.md +55 -1
- package/README.md +15 -14
- package/dist/cli/arca-runtime.d.ts +20 -0
- package/dist/cli/arca-runtime.js +42 -0
- package/dist/cli/arca-runtime.js.map +1 -0
- package/dist/cli/commands/billing.command.batch.d.ts +15 -5
- package/dist/cli/commands/billing.command.batch.js +28 -11
- package/dist/cli/commands/billing.command.batch.js.map +1 -1
- package/dist/cli/commands/billing.command.interactive-preview.js +4 -1
- package/dist/cli/commands/billing.command.interactive-preview.js.map +1 -1
- package/dist/cli/commands/billing.command.options.js +1 -1
- package/dist/cli/commands/billing.command.options.js.map +1 -1
- package/dist/cli/commands/billing.command.output.d.ts +4 -0
- package/dist/cli/commands/billing.command.output.js +3 -2
- package/dist/cli/commands/billing.command.output.js.map +1 -1
- package/dist/cli/commands/billing.command.parser.d.ts +7 -0
- package/dist/cli/commands/billing.command.parser.js +28 -15
- package/dist/cli/commands/billing.command.parser.js.map +1 -1
- package/dist/cli/commands/billing.command.shared.d.ts +22 -3
- package/dist/cli/commands/billing.command.shared.js +84 -47
- package/dist/cli/commands/billing.command.shared.js.map +1 -1
- package/dist/cli/commands/config.command.d.ts +3 -4
- package/dist/cli/commands/config.command.js +39 -39
- package/dist/cli/commands/config.command.js.map +1 -1
- package/dist/cli/commands/cuit-argument.d.ts +2 -0
- package/dist/cli/commands/cuit-argument.js +10 -0
- package/dist/cli/commands/cuit-argument.js.map +1 -0
- package/dist/cli/commands/fce-obligation.command.js +6 -13
- package/dist/cli/commands/fce-obligation.command.js.map +1 -1
- package/dist/cli/commands/interactive.command.js +8 -6
- package/dist/cli/commands/interactive.command.js.map +1 -1
- package/dist/cli/commands/padron.command.d.ts +2 -0
- package/dist/cli/commands/padron.command.js +47 -0
- package/dist/cli/commands/padron.command.js.map +1 -0
- package/dist/cli/commands/parameters.command.js +8 -7
- package/dist/cli/commands/parameters.command.js.map +1 -1
- package/dist/cli/commands/pdf.command.js +17 -30
- package/dist/cli/commands/pdf.command.js.map +1 -1
- package/dist/cli/commands/vouchers.command.js +5 -5
- package/dist/cli/commands/vouchers.command.js.map +1 -1
- package/dist/cli/error-output.d.ts +20 -2
- package/dist/cli/error-output.js +70 -10
- package/dist/cli/error-output.js.map +1 -1
- package/dist/cli/global-options.d.ts +26 -0
- package/dist/cli/global-options.js +56 -0
- package/dist/cli/global-options.js.map +1 -0
- package/dist/cli/help.d.ts +2 -0
- package/dist/cli/help.js +75 -29
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/ignored-global-options.d.ts +6 -0
- package/dist/cli/ignored-global-options.js +33 -0
- package/dist/cli/ignored-global-options.js.map +1 -0
- package/dist/cli/index.js +7 -11
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/interactive/config.flow.d.ts +1 -2
- package/dist/cli/interactive/config.flow.js +4 -3
- package/dist/cli/interactive/config.flow.js.map +1 -1
- package/dist/cli/interactive/interactive-mode.js +48 -17
- package/dist/cli/interactive/interactive-mode.js.map +1 -1
- package/dist/cli/interactive/invoice.flow.d.ts +2 -0
- package/dist/cli/interactive/invoice.flow.js +4 -3
- package/dist/cli/interactive/invoice.flow.js.map +1 -1
- package/dist/cli/interactive/note.flow.d.ts +2 -0
- package/dist/cli/interactive/note.flow.js +4 -3
- package/dist/cli/interactive/note.flow.js.map +1 -1
- package/dist/cli/interactive/receiver-padron.d.ts +29 -0
- package/dist/cli/interactive/receiver-padron.js +53 -0
- package/dist/cli/interactive/receiver-padron.js.map +1 -0
- package/dist/cli/interactive/repeat.flow.js +3 -3
- package/dist/cli/interactive/repeat.flow.js.map +1 -1
- package/dist/cli/interactive/session.js +4 -1
- package/dist/cli/interactive/session.js.map +1 -1
- package/dist/cli/program.d.ts +5 -1
- package/dist/cli/program.js +8 -2
- package/dist/cli/program.js.map +1 -1
- package/dist/cli/version.d.ts +1 -1
- package/dist/cli/version.js +1 -1
- package/dist/lib/errors/app-error.d.ts +1 -1
- package/dist/lib/errors/app-error.js +2 -1
- package/dist/lib/errors/app-error.js.map +1 -1
- package/dist/lib/files/write-new-file.d.ts +5 -0
- package/dist/lib/files/write-new-file.js +30 -0
- package/dist/lib/files/write-new-file.js.map +1 -0
- package/dist/lib/links.d.ts +2 -0
- package/dist/lib/links.js +2 -0
- package/dist/lib/links.js.map +1 -1
- package/dist/lib/security/certificate.d.ts +5 -1
- package/dist/lib/security/certificate.js +10 -7
- package/dist/lib/security/certificate.js.map +1 -1
- package/dist/modules/billing/billing-response.js +12 -0
- package/dist/modules/billing/billing-response.js.map +1 -1
- package/dist/modules/billing/billing.batch.js +7 -1
- package/dist/modules/billing/billing.batch.js.map +1 -1
- package/dist/modules/billing/billing.date-range.js +27 -10
- package/dist/modules/billing/billing.date-range.js.map +1 -1
- package/dist/modules/billing/billing.display.js +5 -1
- package/dist/modules/billing/billing.display.js.map +1 -1
- package/dist/modules/billing/billing.json-input.d.ts +58 -0
- package/dist/modules/billing/billing.json-input.js +279 -0
- package/dist/modules/billing/billing.json-input.js.map +1 -0
- package/dist/modules/billing/billing.padron.d.ts +14 -0
- package/dist/modules/billing/billing.padron.js +55 -0
- package/dist/modules/billing/billing.padron.js.map +1 -0
- package/dist/modules/billing/billing.schemas.d.ts +5 -0
- package/dist/modules/billing/billing.schemas.js +6 -0
- package/dist/modules/billing/billing.schemas.js.map +1 -1
- package/dist/modules/billing/billing.serialize.d.ts +1 -0
- package/dist/modules/billing/billing.serialize.js +5 -12
- package/dist/modules/billing/billing.serialize.js.map +1 -1
- package/dist/modules/billing/billing.service.d.ts +3 -0
- package/dist/modules/billing/billing.service.js +22 -1
- package/dist/modules/billing/billing.service.js.map +1 -1
- package/dist/modules/billing/billing.text.js +4 -12
- package/dist/modules/billing/billing.text.js.map +1 -1
- package/dist/modules/billing/billing.types.internal.d.ts +10 -2
- package/dist/modules/config/certificate-expiry.d.ts +42 -0
- package/dist/modules/config/certificate-expiry.js +91 -0
- package/dist/modules/config/certificate-expiry.js.map +1 -0
- package/dist/modules/config/config-doctor.d.ts +5 -4
- package/dist/modules/config/config-doctor.js +8 -16
- package/dist/modules/config/config-doctor.js.map +1 -1
- package/dist/modules/config/config-value-parser.d.ts +1 -1
- package/dist/modules/config/config-value-parser.js +13 -11
- package/dist/modules/config/config-value-parser.js.map +1 -1
- package/dist/modules/config/config.presenter.d.ts +2 -0
- package/dist/modules/config/config.presenter.js +6 -0
- package/dist/modules/config/config.presenter.js.map +1 -1
- package/dist/modules/config/config.schemas.d.ts +2 -0
- package/dist/modules/config/config.schemas.js +3 -0
- package/dist/modules/config/config.schemas.js.map +1 -1
- package/dist/modules/config/config.sections.js +6 -1
- package/dist/modules/config/config.sections.js.map +1 -1
- package/dist/modules/config/config.service.js +33 -8
- package/dist/modules/config/config.service.js.map +1 -1
- package/dist/modules/examples/examples.d.ts +5 -0
- package/dist/modules/examples/examples.js +29 -28
- package/dist/modules/examples/examples.js.map +1 -1
- package/dist/modules/interactive/config-fields.js +6 -0
- package/dist/modules/interactive/config-fields.js.map +1 -1
- package/dist/modules/interactive/equivalent-command.js +2 -2
- package/dist/modules/interactive/equivalent-command.js.map +1 -1
- package/dist/modules/padron/padron.d.ts +46 -0
- package/dist/modules/padron/padron.js +24 -0
- package/dist/modules/padron/padron.js.map +1 -0
- package/dist/modules/padron/padron.presenter.d.ts +7 -0
- package/dist/modules/padron/padron.presenter.js +49 -0
- package/dist/modules/padron/padron.presenter.js.map +1 -0
- package/dist/modules/parameters/parameters.presenter.js +5 -2
- package/dist/modules/parameters/parameters.presenter.js.map +1 -1
- package/dist/modules/storybook/showcase.js +17 -4
- package/dist/modules/storybook/showcase.js.map +1 -1
- package/dist/services/arca/arca-billing.gateway.d.ts +8 -2
- package/dist/services/arca/arca-billing.gateway.js +17 -2
- package/dist/services/arca/arca-billing.gateway.js.map +1 -1
- package/dist/services/arca/arca-client.factory.d.ts +2 -1
- package/dist/services/arca/arca-client.factory.js +5 -0
- package/dist/services/arca/arca-client.factory.js.map +1 -1
- package/dist/services/arca/arca-context.resolver.d.ts +11 -0
- package/dist/services/arca/arca-context.resolver.js +12 -1
- package/dist/services/arca/arca-context.resolver.js.map +1 -1
- package/dist/services/arca/arca-padron.gateway.d.ts +9 -0
- package/dist/services/arca/arca-padron.gateway.js +104 -0
- package/dist/services/arca/arca-padron.gateway.js.map +1 -0
- package/dist/services/pdf/pdf-exporter.d.ts +6 -3
- package/dist/services/pdf/pdf-exporter.js +11 -9
- package/dist/services/pdf/pdf-exporter.js.map +1 -1
- package/dist/ui/components/certificateBanner.d.ts +11 -0
- package/dist/ui/components/certificateBanner.js +9 -0
- package/dist/ui/components/certificateBanner.js.map +1 -0
- package/dist/ui/components/index.d.ts +1 -0
- package/dist/ui/components/index.js +1 -0
- package/dist/ui/components/index.js.map +1 -1
- package/dist/ui/presenters/config.presenter.d.ts +1 -1
- package/dist/ui/presenters/config.presenter.js +1 -1
- package/dist/ui/presenters/config.presenter.js.map +1 -1
- package/dist/ui/presenters/errors.presenter.js +4 -1
- package/dist/ui/presenters/errors.presenter.js.map +1 -1
- package/dist/ui/presenters/errors.zod-presenter.js +5 -26
- package/dist/ui/presenters/errors.zod-presenter.js.map +1 -1
- package/dist/ui/stream/terminal-stream.d.ts +5 -0
- package/dist/ui/stream/terminal-stream.js +13 -1
- package/dist/ui/stream/terminal-stream.js.map +1 -1
- package/llms.txt +59 -41
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,59 @@ El formato sigue [Keep a Changelog](https://keepachangelog.com/es-ES/1.1.0/) y e
|
|
|
8
8
|
|
|
9
9
|
## [Sin publicar]
|
|
10
10
|
|
|
11
|
+
## [2.1.0] - 2026-10-23
|
|
12
|
+
|
|
13
|
+
Trae `arcli padron` y el IVA receptor desde el padrón al facturar con `--cuit`, el aviso de vencimiento del certificado y una guía para el punto de venta de web service. Además corrige un montón de cosas que salen de una revisión del repo: el JSON de `--cargar` se valida clave por clave, los errores con `--json` tienen siempre la misma forma, y los ejemplos de la ayuda y de los docs se pueden copiar y andan.
|
|
14
|
+
|
|
15
|
+
Algunos cambios rompen scripts que dependían del comportamiento anterior. Revisá la sección "Cambiado":
|
|
16
|
+
|
|
17
|
+
- **Exit code `2`** cuando ARCA rechaza un comprobante (antes, `0`).
|
|
18
|
+
- **Validación estricta del JSON de `--cargar`:** una clave desconocida o con otro tipo ahora es error.
|
|
19
|
+
- **Un array de un elemento en `--cargar`** sale como array.
|
|
20
|
+
- **`--bruto`** agrega `respuesta` en lugar de reemplazar el resumen.
|
|
21
|
+
- **`config revisar`** ya no recibe `--testing` ni `--produccion`.
|
|
22
|
+
- **Los PDFs** se guardan en una subcarpeta por CUIT.
|
|
23
|
+
|
|
24
|
+
Los comandos, los flags de facturación y las claves de config siguen siendo los mismos.
|
|
25
|
+
|
|
26
|
+
### Agregado
|
|
27
|
+
|
|
28
|
+
- **`arcli padron <cuit>`:** nombre o razón social, domicilio fiscal, condición IVA, impuestos, categoría de monotributo y actividad de un CUIT, desde el padrón de ARCA (`ws_sr_constancia_inscripcion`). Con `--json` para scripts.
|
|
29
|
+
- **IVA receptor desde el padrón:** al facturar con `--cuit` y sin `--ir`, ARCLI usa la condición IVA del padrón, antes que el `ivaReceptor` de la config. También completa el nombre y el domicilio del receptor para el PDF. Si el padrón no responde o no la informa, sigue con la config y avisa. El modo interactivo propone la misma condición al cargar un CUIT. Se desactiva con `arcli config establecer consultarPadron false`.
|
|
30
|
+
- **Aviso de vencimiento del certificado:** a menos de 30 días de vencer cualquiera de los certificados configurados (testing o producción, sin importar con cuál estés trabajando), los comandos que van a ARCA (facturación, `ultimos`, `consultar`, `padron`, `fce-obligado`, `parametros`, `estado`) avisan al principio, en stderr: `El certificado de produccion vence el 20/11/2026 (en 10 días)`, con el link a la [guía para renovarlo](docs/obtencion-certificados.md). Con `--json`, stdout queda solo con el JSON y en facturación el aviso va también en `avisos`. En el modo interactivo es un recuadro debajo de la barra de estado. Si vencen los dos, van en el mismo recuadro. Si ya venció el del entorno que se usa, cortan antes de autenticar en ARCA con el error `CERTIFICATE_EXPIRED` (antes fallaba el login en WSAA con un error inesperado).
|
|
31
|
+
- **Punto de venta para web service:** si ARCA rechaza el comprobante porque el punto de venta no es de web service (error `10005`), la `sugerencia` lo dice y apunta a la [guía para crear uno](docs/obtencion-certificados.md#punto-de-venta-para-web-service). `arcli estado` avisa lo mismo cuando el punto de venta configurado no está entre los habilitados. Desde el 1/11/2026 ARCA da de alta de oficio puntos de venta "Factura en línea" a monotributistas (RG 5893/2026), y esos no sirven para arcli.
|
|
32
|
+
|
|
33
|
+
### Cambiado
|
|
34
|
+
|
|
35
|
+
- **`--bruto` agrega la respuesta cruda sin quitar el resumen:** con `--json --bruto` ahora salen `cae`, `caeVencimiento`, `estado`, `resultado`, `errores`, `observaciones` y el resto del JSON de siempre, más `respuesta` con la respuesta cruda de ARCA. Antes `--bruto` reemplazaba el resumen y esos campos desaparecían, aunque la documentación decía que agregaba. En texto pasa lo mismo: el resultado se muestra como siempre y el panel `Respuesta bruta` va al final. Vale igual para `bruto=true` en la config.
|
|
36
|
+
- **Un array de un elemento en `--cargar` es un lote:** si el JSON es un array sale un array (con `indice`) y los errores son `BATCH_VALIDATION_ERROR` / `BATCH_EMISSION_ERROR`, tenga uno o muchos elementos. Antes un array de un elemento salía como objeto y con los errores de un comprobante suelto. Un objeto sigue devolviendo un objeto. Si un script leía `[0]` solo cuando había más de uno, ya puede leer siempre el array.
|
|
37
|
+
- **El JSON de `--cargar` se valida clave por clave:** una clave desconocida (`"montototal"`, `"vencimiento"`, `"moneda"`) o un valor con otro tipo (`"puntoVenta": "3"`, `"emitir": "true"`, `null`) ahora es error de entrada (`INPUT_VALIDATION_ERROR`, o `BATCH_VALIDATION_ERROR` con el índice en un lote) que nombra la clave y sugiere la correcta. Antes se ignoraban sin aviso: con `"puntoVenta": "3"` se emitía en el punto de venta de la config. Si un archivo que te funcionaba ahora falla, corregí la clave o sacale las comillas al número; las claves documentadas siguen igual. Un lote vacío (`[]`) también es error: antes se ignoraba el archivo y se usaban solo los flags. La tabla de claves y su flag equivalente está en [entrada y salida](docs/input-output.md#flags-y-claves-del-json).
|
|
38
|
+
- **`config revisar` revisa los dos entornos:** valida el entorno por defecto y cualquier otro que tenga `cert` o `key` configurados, cada uno en su línea (`Validacion testing`, `Validacion produccion`). La línea `Revision activa` del JSON ya no existe. Ya no recibe `--testing` ni `--produccion`: antes los aceptaba pero los ignoraba y revisaba siempre testing.
|
|
39
|
+
- **Exit code `2` cuando ARCA rechaza un comprobante:** antes salía con `0` y había que leer `estado` para enterarse. En un lote, `2` si ARCA rechazó al menos uno. `observado` sigue saliendo con `0`. Si un script trataba cualquier exit distinto de `0` como error de ARCLI, ahora también corta en un rechazo.
|
|
40
|
+
- **PDFs en una subcarpeta por CUIT emisor:** `~/arcli/comprobantes/20123456789/factura-c_0003-00000125.pdf` (en testing, `testing/20123456789/`). Si el archivo ya existe no se pisa: se guarda con `-2`, `-3` y así.
|
|
41
|
+
- **`sugerencia` siempre en el JSON de error:** todos los errores con `--json` traen las mismas cuatro claves (`codigo`, `detalles`, `error`, `sugerencia`), con `sugerencia: null` cuando no hay nada que sugerir. Antes faltaba en los errores sin sugerencia (`CONFIGURATION_ERROR`, `INPUT_VALIDATION_ERROR`…) y era `null` solo en los inesperados. Si un script chequeaba si la clave existe, ahora tiene que chequear si es `null`.
|
|
42
|
+
- **`--bruto` solo en los comandos de facturación:** `padron`, `fce-obligado`, `ultimos`, `consultar`, `parametros`, `estado` e `interactivo` ya no lo declaran (no lo usaban): pasado ahí, el comando corre igual y avisa en stderr que se ignora. Ya no aparece en su ayuda.
|
|
43
|
+
- **`arcli interactivo --json` ya no falla:** el asistente acepta solo `--testing` y `--produccion`; `--json` y `--bruto` se ignoran con un aviso. Sin terminal interactiva sigue fallando, con o sin `--json`.
|
|
44
|
+
- **Comando equivalente del modo interactivo:** siempre lleva `--testing` o `--produccion`. Antes, en testing no llevaba nada, y si la config pasaba a producción el comando pegado emitía ahí.
|
|
45
|
+
|
|
46
|
+
### Corregido
|
|
47
|
+
|
|
48
|
+
- **Ejemplos de la ayuda y de los docs que fallaban:** los ejemplos de `--ayuda` de las notas B y C, las B, las FCE y las familias, las NC/ND FCE de `arcli ejemplos` y varios de los docs (`pdf.md`, `usage-patterns.md`, `cli-reference.md`, el JSON de `llms.txt` y de `input-output.md`) daban error al copiarlos: asociado de otra letra, IVA receptor que la letra no admite, FCE sin `--cbu` o con `--acuit` ajeno, fechas fijas viejas o sin IVA receptor. Ahora cada nota asocia una factura de su letra y categoría, y un test pasa todos los ejemplos por el parser y arma la solicitud a ARCA.
|
|
49
|
+
- **"Puede haberse emitido" cuando seguro no se emitió:** un certificado vencido, un fallo de login en WSAA o un error al pedir el último número salían como `EMISSION_UNCERTAIN`, con la sugerencia de verificar con `arcli ultimos` antes de reintentar. En esos casos no llegó nada a ARCA: ahora salen con su error (`UNEXPECTED_ERROR` o `TRANSIENT_ERROR` en el JSON) y se puede reintentar directo. `EMISSION_UNCERTAIN` queda solo para un fallo en la llamada que emite (red, timeout, transacción activa). En un lote, ese caso ya no suma `detalles.sinConfirmar`.
|
|
50
|
+
- **Lote interrumpido, PDFs de los ya emitidos:** si un lote se cortaba a mitad, los comprobantes que ya tenían CAE quedaban sin PDF. Ahora se generan antes de mostrar el error, según `pdf` o `--exportar-pdf` como en un lote completo, y en `--json` cada uno lleva su campo `pdf`. Si falla el PDF, el error que se muestra sigue siendo el de la emisión.
|
|
51
|
+
- **Lote, fallos del padrón o de la cotización con su índice:** si la consulta al padrón (IVA receptor desde `--cuit`) o a la cotización oficial fallaba para un ítem, el lote cortaba con un error que no decía cuál era. Ahora sale en `BATCH_VALIDATION_ERROR`, junto con los demás ítems con problemas y su `#n`, antes de emitir ninguno.
|
|
52
|
+
- **`config.json` con JSON inválido** salía como "Error inesperado", sin decir qué archivo ni qué hacer. Ahora es un error de configuración (`CONFIGURATION_ERROR`) con la ruta del archivo y la sugerencia de corregirlo a mano o renombrarlo y volver a configurar. ARCLI no lo borra ni lo pisa.
|
|
53
|
+
- **`json=true` de la config en todos los comandos:** `pdf` (y sus subcomandos) y `parametros` sin tabla solo salían en JSON con `--json`. Ahora todos los comandos resuelven la salida igual: `--json` o, si no está, la clave `json` de la config. `config ruta` acepta `--json` y devuelve `{"ruta": "..."}`.
|
|
54
|
+
- **Errores de uso en JSON:** una opción desconocida (`arcli fc --montoo 1 --json`), un valor faltante o un comando que no existe salían en texto aunque se pidiera JSON. Ahora, con `--json` o `json=true`, salen como `INPUT_VALIDATION_ERROR` en el mismo formato que el resto de los errores, con exit code `1`. Sin JSON se ven igual que antes.
|
|
55
|
+
- **Opciones globales que no aplican:** `--testing`, `--produccion`, `--json` o `--bruto` en un comando que no las usa (`arcli config ruta --produccion`) se aceptaban sin decir nada. Ahora el comando corre igual y avisa en stderr que la opción se ignora.
|
|
56
|
+
- **`json=true` en `config`:** `config`, `config revisar`, `config establecer` y `config eliminar` respetan `json=true` de la config, como el resto de los comandos.
|
|
57
|
+
- **`--dia` corría un mes de más** a fin de mes: `--dia 15` el 31/03 daba el 15/05 en vez del 15/04, y ARCA lo aceptaba con las fechas de servicio y vencimiento equivocadas. Si el día no existe en ese mes (`--dia 31` con abril), ahora da error.
|
|
58
|
+
- **`--json` con `FORCE_COLOR`:** con `FORCE_COLOR=1` en el entorno, el JSON redirigido a un archivo o a otro programa salía con colores y no se podía parsear. Ahora solo se colorea en una terminal.
|
|
59
|
+
- **`--json` en `config`:** `config`, `config revisar`, `config establecer` y `config eliminar` ignoraban `--json` y salían en texto.
|
|
60
|
+
- **`config --ayuda` listaba la mitad de las claves:** mostraba 15 de 30. Ahora `config --ayuda` y `config establecer --ayuda` listan todas, por sección, con sus valores posibles.
|
|
61
|
+
- **Links de `llms.txt` y del README en el paquete de npm:** apuntaban a `docs/`, que no se publica en npm. Ahora son links a GitHub.
|
|
62
|
+
- **`config establecer` con un valor inválido** (`puntoVenta abc`, `comprobantesPorLista 99`) sale como error de entrada (`INPUT_VALIDATION_ERROR`) y no como error inesperado.
|
|
63
|
+
|
|
11
64
|
## [2.0.0] - 2026-10-12
|
|
12
65
|
|
|
13
66
|
Versión mayor: sale de una auditoría del proyecto. Lo que rompe es cómo se escriben algunos valores en los flags:
|
|
@@ -285,7 +338,8 @@ Primera versión publicada en npm.
|
|
|
285
338
|
- `llms.txt`: referencia condensada para que un agente de IA con acceso a terminal ejecute el CLI.
|
|
286
339
|
- Publicación con npm Trusted Publishers (OIDC).
|
|
287
340
|
|
|
288
|
-
[Sin publicar]: https://github.com/LcsGrz/arcli/compare/v2.
|
|
341
|
+
[Sin publicar]: https://github.com/LcsGrz/arcli/compare/v2.1.0...HEAD
|
|
342
|
+
[2.1.0]: https://github.com/LcsGrz/arcli/compare/v2.0.0...v2.1.0
|
|
289
343
|
[2.0.0]: https://github.com/LcsGrz/arcli/compare/v1.8.0...v2.0.0
|
|
290
344
|
[1.8.0]: https://github.com/LcsGrz/arcli/compare/v1.7.1...v1.8.0
|
|
291
345
|
[1.7.1]: https://github.com/LcsGrz/arcli/compare/v1.7.0...v1.7.1
|
package/README.md
CHANGED
|
@@ -19,7 +19,8 @@ CLI para previsualizar y emitir comprobantes electrónicos de ARCA (ex AFIP) des
|
|
|
19
19
|
- **Comprobantes:** Factura, Nota de Crédito y Nota de Débito A, B y C, y sus versiones de Factura de Crédito Electrónica (FCE), con CBU, transferencia, anulación y consulta del régimen del receptor.
|
|
20
20
|
- **Entrada y salida flexibles:** flags o JSON (incluso lotes); salida legible, `--json` o respuesta bruta de ARCA.
|
|
21
21
|
- **Validaciones locales** basadas en el manual de ARCA, para detectar errores antes de llamar al servicio.
|
|
22
|
-
- **Consultas sin emitir:** últimos comprobantes, detalle de uno, estado de los servidores, tablas de parámetros y
|
|
22
|
+
- **Consultas sin emitir:** últimos comprobantes, detalle de uno, estado de los servidores, tablas de parámetros, cotización oficial y padrón de un CUIT.
|
|
23
|
+
- **IVA receptor automático:** con `--cuit` y sin `--ir`, toma la condición IVA del padrón de ARCA.
|
|
23
24
|
- **PDF con el QR de ARCA** mediante un plugin que se descarga solo si lo usás.
|
|
24
25
|
|
|
25
26
|
## Instalación
|
|
@@ -32,7 +33,7 @@ npm install -g arcli
|
|
|
32
33
|
|
|
33
34
|
## Configuración
|
|
34
35
|
|
|
35
|
-
Necesitás tu CUIT, un punto de venta y un certificado con su clave privada de ARCA. Si todavía no los tenés, seguí [Cómo obtener los certificados](docs/obtencion-certificados.md).
|
|
36
|
+
Necesitás tu CUIT, un punto de venta y un certificado con su clave privada de ARCA. Si todavía no los tenés, seguí [Cómo obtener los certificados](https://github.com/LcsGrz/arcli/blob/main/docs/obtencion-certificados.md).
|
|
36
37
|
|
|
37
38
|
Lo más simple es correr `arcli` y seguir la configuración guiada. Para hacerlo por comandos (por ejemplo, en un servidor):
|
|
38
39
|
|
|
@@ -44,7 +45,7 @@ arcli config establecer key.testing /ruta/a/la/clave.key
|
|
|
44
45
|
arcli config revisar
|
|
45
46
|
```
|
|
46
47
|
|
|
47
|
-
`arcli config revisar` verifica que el entorno activo esté listo para emitir. Todas las claves disponibles están en [Configuración](docs/configuration.md).
|
|
48
|
+
`arcli config revisar` verifica que el entorno activo esté listo para emitir. Todas las claves disponibles están en [Configuración](https://github.com/LcsGrz/arcli/blob/main/docs/configuration.md).
|
|
48
49
|
|
|
49
50
|
## Uso
|
|
50
51
|
|
|
@@ -55,11 +56,11 @@ arcli fc --cargar ./facturas.json --emitir --json # lote desde JSON,
|
|
|
55
56
|
arcli fc -m 15000 --cs --consumidor-final --ir-cf --emitir --exportar-pdf
|
|
56
57
|
```
|
|
57
58
|
|
|
58
|
-
Otras consultas: `arcli ultimos`, `arcli consultar`, `arcli estado`, `arcli parametros`, `arcli fce-obligado`. Para ver todos los comprobantes y ejemplos: `arcli --ayuda` y `arcli ejemplos`.
|
|
59
|
+
Otras consultas: `arcli ultimos`, `arcli consultar`, `arcli estado`, `arcli parametros`, `arcli fce-obligado`, `arcli padron`. Para ver todos los comprobantes y ejemplos: `arcli --ayuda` y `arcli ejemplos`.
|
|
59
60
|
|
|
60
61
|
<p align="center"><img src="https://raw.githubusercontent.com/LcsGrz/arcli/main/docs/assets/demo/comandos.gif" alt="Vista previa de una Factura C y emisión con salida JSON filtrada con jq" width="760"></p>
|
|
61
62
|
|
|
62
|
-
La prioridad de los valores es `flags > JSON > config > defaults`. Ver el [modelo mental](docs/mental-model.md) y la [referencia del CLI](docs/cli-reference.md).
|
|
63
|
+
La prioridad de los valores es `flags > JSON > config > defaults`. Ver el [modelo mental](https://github.com/LcsGrz/arcli/blob/main/docs/mental-model.md) y la [referencia del CLI](https://github.com/LcsGrz/arcli/blob/main/docs/cli-reference.md).
|
|
63
64
|
|
|
64
65
|
### Testing y producción
|
|
65
66
|
|
|
@@ -67,14 +68,14 @@ Por defecto se usa el entorno `testing`, con `cert.testing` y `key.testing`. Par
|
|
|
67
68
|
|
|
68
69
|
## Documentación
|
|
69
70
|
|
|
70
|
-
El índice completo está en [docs/](docs/README.md). Lo principal:
|
|
71
|
+
El índice completo está en [docs/](https://github.com/LcsGrz/arcli/blob/main/docs/README.md). Lo principal:
|
|
71
72
|
|
|
72
|
-
- [Modo interactivo](docs/modo-interactivo.md) y [Patrones de uso](docs/usage-patterns.md)
|
|
73
|
-
- [Referencia del CLI](docs/cli-reference.md) y [Configuración](docs/configuration.md)
|
|
74
|
-
- [Entrada y salida](docs/input-output.md): formato del JSON
|
|
75
|
-
- [PDF de comprobantes](docs/pdf.md)
|
|
76
|
-
- [Cómo obtener los certificados](docs/obtencion-certificados.md)
|
|
77
|
-
- [Troubleshooting](docs/troubleshooting.md), [Reglas de validación](docs/validation-rules.md) y [Limitaciones](docs/limitations.md)
|
|
73
|
+
- [Modo interactivo](https://github.com/LcsGrz/arcli/blob/main/docs/modo-interactivo.md) y [Patrones de uso](https://github.com/LcsGrz/arcli/blob/main/docs/usage-patterns.md)
|
|
74
|
+
- [Referencia del CLI](https://github.com/LcsGrz/arcli/blob/main/docs/cli-reference.md) y [Configuración](https://github.com/LcsGrz/arcli/blob/main/docs/configuration.md)
|
|
75
|
+
- [Entrada y salida](https://github.com/LcsGrz/arcli/blob/main/docs/input-output.md): formato del JSON
|
|
76
|
+
- [PDF de comprobantes](https://github.com/LcsGrz/arcli/blob/main/docs/pdf.md)
|
|
77
|
+
- [Cómo obtener los certificados](https://github.com/LcsGrz/arcli/blob/main/docs/obtencion-certificados.md)
|
|
78
|
+
- [Troubleshooting](https://github.com/LcsGrz/arcli/blob/main/docs/troubleshooting.md), [Reglas de validación](https://github.com/LcsGrz/arcli/blob/main/docs/validation-rules.md) y [Limitaciones](https://github.com/LcsGrz/arcli/blob/main/docs/limitations.md)
|
|
78
79
|
- [llms.txt](llms.txt): referencia condensada para agentes de IA con acceso a terminal
|
|
79
80
|
- [Changelog](CHANGELOG.md)
|
|
80
81
|
|
|
@@ -87,11 +88,11 @@ yarn install
|
|
|
87
88
|
yarn dev --ayuda
|
|
88
89
|
```
|
|
89
90
|
|
|
90
|
-
Antes de abrir un PR: `yarn typecheck`, `yarn lint` y `yarn test`. Más en la [guía de desarrollo](docs/development.md) y la [arquitectura](docs/architecture.md).
|
|
91
|
+
Antes de abrir un PR: `yarn typecheck`, `yarn lint` y `yarn test`. Más en la [guía de desarrollo](https://github.com/LcsGrz/arcli/blob/main/docs/development.md) y la [arquitectura](https://github.com/LcsGrz/arcli/blob/main/docs/architecture.md).
|
|
91
92
|
|
|
92
93
|
## Contribuir
|
|
93
94
|
|
|
94
|
-
Leé [CONTRIBUTING.md](CONTRIBUTING.md). Para vulnerabilidades, ver [SECURITY.md](SECURITY.md); no subas certificados, claves ni tokens reales a issues ni PRs.
|
|
95
|
+
Leé [CONTRIBUTING.md](https://github.com/LcsGrz/arcli/blob/main/CONTRIBUTING.md). Para vulnerabilidades, ver [SECURITY.md](https://github.com/LcsGrz/arcli/blob/main/SECURITY.md); no subas certificados, claves ni tokens reales a issues ni PRs.
|
|
95
96
|
|
|
96
97
|
## Agradecimientos
|
|
97
98
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CertificateExpiryNotice } from '../modules/config/certificate-expiry';
|
|
2
|
+
import { type ResolvedArcaRuntime } from '../services/arca/arca-context.resolver';
|
|
3
|
+
import type { GlobalCliOptions } from './types';
|
|
4
|
+
type CertificateRuntime = Pick<ResolvedArcaRuntime, 'certificateExpiry' | 'certificateNotices' | 'outputJson'>;
|
|
5
|
+
/**
|
|
6
|
+
* Un solo recuadro con todos los certificados por vencer o vencidos, una linea por entorno y el link una vez. En
|
|
7
|
+
* rojo si alguno vencio. Lo usan los comandos y el modo interactivo.
|
|
8
|
+
*/
|
|
9
|
+
export declare function renderCertificateNotices(notices: readonly CertificateExpiryNotice[]): string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Aviso de los certificados por vencer o vencidos, de cualquier entorno, al principio del comando. Va a stderr:
|
|
12
|
+
* con `--json` stdout queda solo para el JSON. Si vencio el del entorno activo y hay `--json`, no se escribe: el
|
|
13
|
+
* error JSON de `CERTIFICATE_EXPIRED` (tambien en stderr) ya lo dice, y un texto antes lo romperia.
|
|
14
|
+
*/
|
|
15
|
+
export declare function writeCertificateNotice(runtime: CertificateRuntime): void;
|
|
16
|
+
/** Lo que se suma a `avisos` en el JSON de facturacion. En texto el aviso ya salio arriba: no se repite. */
|
|
17
|
+
export declare function certificateWarnings(runtime: CertificateRuntime): string[];
|
|
18
|
+
/** Config, credenciales y aviso del certificado: el paso comun de los comandos que van a ARCA. */
|
|
19
|
+
export declare function resolveArcaRuntime(options: GlobalCliOptions): ResolvedArcaRuntime;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { CERTIFICATE_GUIDE_URL } from '../lib/links.js';
|
|
2
|
+
import { ArcaContextResolver } from '../services/arca/arca-context.resolver.js';
|
|
3
|
+
import { certificateBanner, writeTerminalNotice } from '../ui/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Un solo recuadro con todos los certificados por vencer o vencidos, una linea por entorno y el link una vez. En
|
|
6
|
+
* rojo si alguno vencio. Lo usan los comandos y el modo interactivo.
|
|
7
|
+
*/
|
|
8
|
+
export function renderCertificateNotices(notices) {
|
|
9
|
+
if (notices.length === 0) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
return certificateBanner({
|
|
13
|
+
expired: notices.some((notice) => notice.expired),
|
|
14
|
+
guideUrl: CERTIFICATE_GUIDE_URL,
|
|
15
|
+
summary: notices.map((notice) => notice.summary).join('\n'),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Aviso de los certificados por vencer o vencidos, de cualquier entorno, al principio del comando. Va a stderr:
|
|
20
|
+
* con `--json` stdout queda solo para el JSON. Si vencio el del entorno activo y hay `--json`, no se escribe: el
|
|
21
|
+
* error JSON de `CERTIFICATE_EXPIRED` (tambien en stderr) ya lo dice, y un texto antes lo romperia.
|
|
22
|
+
*/
|
|
23
|
+
export function writeCertificateNotice(runtime) {
|
|
24
|
+
if (runtime.certificateExpiry?.expired && runtime.outputJson) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const banner = renderCertificateNotices(runtime.certificateNotices);
|
|
28
|
+
if (banner) {
|
|
29
|
+
writeTerminalNotice(banner);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** Lo que se suma a `avisos` en el JSON de facturacion. En texto el aviso ya salio arriba: no se repite. */
|
|
33
|
+
export function certificateWarnings(runtime) {
|
|
34
|
+
return runtime.outputJson ? runtime.certificateNotices.map((notice) => notice.message) : [];
|
|
35
|
+
}
|
|
36
|
+
/** Config, credenciales y aviso del certificado: el paso comun de los comandos que van a ARCA. */
|
|
37
|
+
export function resolveArcaRuntime(options) {
|
|
38
|
+
const runtime = new ArcaContextResolver({ options }).resolve();
|
|
39
|
+
writeCertificateNotice(runtime);
|
|
40
|
+
return runtime;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=arca-runtime.js.map
|
|
@@ -0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AC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9F,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,kBAAkB,CAAC,OAAyB;IAC1D,MAAM,OAAO,GAAG,IAAI,mBAAmB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IAE/D,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAEhC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -2,21 +2,31 @@ import { type BatchItemError } from '../../modules/billing/billing.batch';
|
|
|
2
2
|
interface BatchPlan {
|
|
3
3
|
readonly inputIndexes: readonly number[];
|
|
4
4
|
readonly invalidItems: readonly BatchItemError[];
|
|
5
|
+
/** Entro un array: se trata como lote aunque tenga un solo item. */
|
|
6
|
+
readonly isBatch: boolean;
|
|
5
7
|
readonly total: number;
|
|
6
8
|
}
|
|
7
9
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
+
* Prepara un lote antes de emitir: `resolve` completa cada item con lo que hay que consultar en ARCA (IVA
|
|
11
|
+
* receptor del padron, cotizacion) y `validate` aplica las reglas de negocio sobre lo resuelto. En un lote
|
|
12
|
+
* no corta en el primer fallo: junta todos, con su indice, en un solo `BatchValidationError`, y no se emite
|
|
13
|
+
* ninguno. Con un comprobante suelto (no un array) el error sale tal cual, como siempre.
|
|
10
14
|
*/
|
|
11
|
-
export declare function
|
|
15
|
+
export declare function prepareBatch<T, R>(options: {
|
|
16
|
+
readonly inputs: readonly T[];
|
|
17
|
+
readonly plan: BatchPlan;
|
|
18
|
+
readonly resolve: (input: T, position: number) => Promise<R>;
|
|
19
|
+
readonly validate: (resolved: R) => void;
|
|
20
|
+
}): Promise<R[]>;
|
|
12
21
|
/**
|
|
13
22
|
* Emite los items en orden. Si uno falla a mitad del lote, entrega lo ya procesado a `onPartialResults`
|
|
14
|
-
* antes de cortar: si no se mostrara, alguien volveria a correr el lote y duplicaria comprobantes.
|
|
23
|
+
* antes de cortar: si no se mostrara, alguien volveria a correr el lote y duplicaria comprobantes. Se
|
|
24
|
+
* espera a que termine (puede generar los PDFs de los ya emitidos), y si falla no tapa el error de emision.
|
|
15
25
|
*/
|
|
16
26
|
export declare function emitBatch<T, R>(options: {
|
|
17
27
|
readonly emit: (input: T, position: number) => Promise<R>;
|
|
18
28
|
readonly inputs: readonly T[];
|
|
19
|
-
readonly onPartialResults: (results: R[]) => void;
|
|
29
|
+
readonly onPartialResults: (results: R[]) => Promise<void> | void;
|
|
20
30
|
readonly plan: BatchPlan;
|
|
21
31
|
}): Promise<R[]>;
|
|
22
32
|
export {};
|
|
@@ -1,28 +1,40 @@
|
|
|
1
1
|
import { BatchEmissionError, BatchValidationError, describeBatchItemError, } from '../../modules/billing/billing.batch.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Prepara un lote antes de emitir: `resolve` completa cada item con lo que hay que consultar en ARCA (IVA
|
|
4
|
+
* receptor del padron, cotizacion) y `validate` aplica las reglas de negocio sobre lo resuelto. En un lote
|
|
5
|
+
* no corta en el primer fallo: junta todos, con su indice, en un solo `BatchValidationError`, y no se emite
|
|
6
|
+
* ninguno. Con un comprobante suelto (no un array) el error sale tal cual, como siempre.
|
|
5
7
|
*/
|
|
6
|
-
export function
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
export async function prepareBatch(options) {
|
|
9
|
+
const { inputs, plan, resolve, validate } = options;
|
|
10
|
+
const resolved = [];
|
|
11
|
+
if (!plan.isBatch) {
|
|
12
|
+
// Secuencial a proposito: cada servicio de ARCA reutiliza su ticket WSAA.
|
|
13
|
+
for (const [position, input] of inputs.entries()) {
|
|
14
|
+
resolved.push(await resolve(input, position));
|
|
15
|
+
}
|
|
16
|
+
return resolved;
|
|
9
17
|
}
|
|
10
18
|
const errors = [...plan.invalidItems];
|
|
11
|
-
inputs.
|
|
19
|
+
for (const [position, input] of inputs.entries()) {
|
|
12
20
|
try {
|
|
13
|
-
|
|
21
|
+
const item = await resolve(input, position);
|
|
22
|
+
validate(item);
|
|
23
|
+
resolved.push(item);
|
|
14
24
|
}
|
|
15
25
|
catch (error) {
|
|
16
26
|
errors.push({ index: plan.inputIndexes[position] ?? position + 1, message: describeBatchItemError(error) });
|
|
17
27
|
}
|
|
18
|
-
}
|
|
28
|
+
}
|
|
19
29
|
if (errors.length > 0) {
|
|
20
30
|
throw new BatchValidationError([...errors].sort((left, right) => left.index - right.index), plan.total);
|
|
21
31
|
}
|
|
32
|
+
return resolved;
|
|
22
33
|
}
|
|
23
34
|
/**
|
|
24
35
|
* Emite los items en orden. Si uno falla a mitad del lote, entrega lo ya procesado a `onPartialResults`
|
|
25
|
-
* antes de cortar: si no se mostrara, alguien volveria a correr el lote y duplicaria comprobantes.
|
|
36
|
+
* antes de cortar: si no se mostrara, alguien volveria a correr el lote y duplicaria comprobantes. Se
|
|
37
|
+
* espera a que termine (puede generar los PDFs de los ya emitidos), y si falla no tapa el error de emision.
|
|
26
38
|
*/
|
|
27
39
|
export async function emitBatch(options) {
|
|
28
40
|
const { emit, inputs, onPartialResults, plan } = options;
|
|
@@ -32,11 +44,16 @@ export async function emitBatch(options) {
|
|
|
32
44
|
results.push(await emit(input, position));
|
|
33
45
|
}
|
|
34
46
|
catch (error) {
|
|
35
|
-
if (plan.
|
|
47
|
+
if (!plan.isBatch) {
|
|
36
48
|
throw error;
|
|
37
49
|
}
|
|
38
50
|
if (results.length > 0) {
|
|
39
|
-
|
|
51
|
+
try {
|
|
52
|
+
await onPartialResults(results);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// Lo importante es el error de emision: los ya emitidos se pueden ver con "arcli ultimos".
|
|
56
|
+
}
|
|
40
57
|
}
|
|
41
58
|
throw new BatchEmissionError({
|
|
42
59
|
cause: error,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.command.batch.js","sourceRoot":"","sources":["../../../src/cli/commands/billing.command.batch.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBA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ACxD,KAAK,EAAE,IAAI,CAAC,KAAK;aAClB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -33,7 +33,10 @@ export async function runInteractiveBillingPreview(options) {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
const previewGateway = {
|
|
36
|
-
|
|
36
|
+
createVoucher: async () => {
|
|
37
|
+
throw new Error('No deberia ejecutarse la emision real durante la vista previa.');
|
|
38
|
+
},
|
|
39
|
+
getNextVoucherNumber: async () => {
|
|
37
40
|
throw new Error('No deberia ejecutarse la emision real durante la vista previa.');
|
|
38
41
|
},
|
|
39
42
|
getQuotation: async () => {
|
|
@@ -1 +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,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAShE,KAAK,UAAU,iBAAiB,CAAC,KAAa,EAAE,YAAoB;IAClE,OAAO,MAAM,CAAC;QACZ,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,IAAI,EAAE;YACzC,EAAE,IAAI,EAAE,sBAAsB,EAAE,KAAK,EAAE,KAAK,EAAE;SAC/C;QACD,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,qBAAqB,KAAK,sBAAsB,CAAC,CAAC,CAAC,iBAAiB,YAAY,SAAS;KAC/G,CAAC,CAAC;AACL,CAAC;AAED,SAAS,iBAAiB,CAAC,MAA6B,EAAE,UAAmB;IAC3E,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC5B,GAAG,KAAK;QACR,MAAM,EAAE,CAAC,UAAU;QACnB,IAAI,EAAE,UAAU;KACjB,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,OAQlD;IACC,MAAM,mBAAmB,GACvB,OAAO,CAAC,UAAU,KAAK,SAAS;QAChC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;QAC3C,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU;QAC3B,OAAO,CAAC,KAAK,CAAC,KAAK;QACnB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;IAEvB,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,OAAO;YACL,sBAAsB,EAAE,KAAK;YAC7B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,YAAY,EAAE,KAAK;YACnB,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED,MAAM,cAAc,GAAmB;QACrC,
|
|
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,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAShE,KAAK,UAAU,iBAAiB,CAAC,KAAa,EAAE,YAAoB;IAClE,OAAO,MAAM,CAAC;QACZ,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,IAAI,EAAE;YACzC,EAAE,IAAI,EAAE,sBAAsB,EAAE,KAAK,EAAE,KAAK,EAAE;SAC/C;QACD,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,qBAAqB,KAAK,sBAAsB,CAAC,CAAC,CAAC,iBAAiB,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OAAO,EAAE,EAAE,CAAC;QACtD,cAAc,CAAC,IAAI,CACjB,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;YAC5B,OAAO,EAAE,cAAc;YACvB,KAAK;YACL,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC;SACpC,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"}
|
|
@@ -27,7 +27,7 @@ export function registerBillingOptions(command) {
|
|
|
27
27
|
.option('--dni <number>', 'usar DNI del receptor', documentNumberOption('--dni'))
|
|
28
28
|
.option('--consumidor-final', 'usar consumidor final con documento 0')
|
|
29
29
|
.option('--cfinal', 'alias de consumidor final con documento 0')
|
|
30
|
-
.option('--iva-receptor <tipo>', 'condicion IVA del receptor')
|
|
30
|
+
.option('--iva-receptor <tipo>', 'condicion IVA del receptor; con --cuit, sin este flag, se toma del padron')
|
|
31
31
|
.option('--ir <tipo>', 'alias rapido de condicion IVA del receptor')
|
|
32
32
|
.option('--ir-ce', 'IVA receptor: cliente del exterior')
|
|
33
33
|
.option('--ir-cf', 'IVA receptor: consumidor final')
|
|
@@ -1 +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,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEtF,MAAM,UAAU,sBAAsB,CAAC,OAAgB;IACrD,OAAO;SACJ,MAAM,CACL,sBAAsB,EACtB,6DAA6D,EAC7D,YAAY,CAAC,SAAS,CAAC,CACxB;SACA,MAAM,CACL,mBAAmB,EACnB,kJAAkJ,EAClJ,CAAC,KAAa,EAAE,QAA8B,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,CAChF;SACA,MAAM,CAAC,mBAAmB,EAAE,sCAAsC,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;QAC9F,iGAAiG;SAChG,MAAM,CAAC,sBAAsB,EAAE,0CAA0C,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;SACvG,MAAM,CAAC,oBAAoB,EAAE,8CAA8C,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;SACpG,MAAM,CAAC,wBAAwB,EAAE,gBAAgB,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;SAClF,MAAM,CAAC,eAAe,EAAE,yBAAyB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;SACzE,MAAM,CAAC,iBAAiB,EAAE,yCAAyC,CAAC;SACpE,MAAM,CAAC,qBAAqB,EAAE,mEAAmE,CAAC;SAClG,MAAM,CAAC,uBAAuB,EAAE,mEAAmE,CAAC;SACpG,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC;SACzC,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC;SACzC,MAAM,CAAC,OAAO,EAAE,qCAAqC,CAAC;SACtD,MAAM,CAAC,mBAAmB,EAAE,yCAAyC,CAAC;SACtE,MAAM,CAAC,gBAAgB,EAAE,wCAAwC,CAAC;SAClE,MAAM,CAAC,eAAe,EAAE,kCAAkC,EAAE,YAAY,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;SACzG,MAAM,CACL,8BAA8B,EAC9B,+CAA+C,EAC/C,YAAY,CAAC,qBAAqB,EAAE,sBAAsB,CAAC,CAC5D;SACA,MAAM,CAAC,gBAAgB,EAAE,qFAAqF,CAAC;SAC/G,MAAM,CAAC,iBAAiB,EAAE,wBAAwB,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;SACnF,MAAM,CAAC,iBAAiB,EAAE,wBAAwB,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;SACnF,MAAM,CAAC,gBAAgB,EAAE,uBAAuB,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;SAChF,MAAM,CAAC,oBAAoB,EAAE,uCAAuC,CAAC;SACrE,MAAM,CAAC,UAAU,EAAE,2CAA2C,CAAC;SAC/D,MAAM,CAAC,uBAAuB,EAAE,
|
|
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,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEtF,MAAM,UAAU,sBAAsB,CAAC,OAAgB;IACrD,OAAO;SACJ,MAAM,CACL,sBAAsB,EACtB,6DAA6D,EAC7D,YAAY,CAAC,SAAS,CAAC,CACxB;SACA,MAAM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Aa,CAAC,OAAO,CAAC,CAAC;SAC3F,MAAM,CACL,iCAAiC,EACjC,yCAAyC,EACzC,aAAa,CAAC,wBAAwB,CAAC,CACxC;SACA,MAAM,CAAC,eAAe,EAAE,iCAAiC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;SACjF,MAAM,CAAC,iBAAiB,EAAE,qDAAqD,CAAC;SAChF,MAAM,CAAC,kBAAkB,EAAE,wEAAwE,CAAC;SACpG,MAAM,CAAC,yBAAyB,EAAE,kEAAkE,CAAC;SACrG,MAAM,CAAC,cAAc,EAAE,sCAAsC,CAAC;SAC9D,MAAM,CAAC,yBAAyB,EAAE,+DAA+D,CAAC;SAClG,MAAM,CAAC,cAAc,EAAE,mCAAmC,CAAC;SAC3D,MAAM,CAAC,kBAAkB,EAAE,0DAA0D,CAAC;SACtF,MAAM,CAAC,aAAa,EAAE,+CAA+C,CAAC;SACtE,MAAM,CAAC,iBAAiB,EAAE,4CAA4C,CAAC;SACvE,MAAM,CAAC,6BAA6B,EAAE,6DAA6D,CAAC;SACpG,MAAM,CAAC,aAAa,EAAE,6EAA6E,CAAC;SACpG,MAAM,CAAC,gBAAgB,EAAE,yEAAyE,CAAC;SACnG,MAAM,CAAC,OAAO,EAAE,yBAAyB,CAAC;SAC1C,MAAM,CAAC,WAAW,EAAE,oDAAoD,CAAC;SACzE,MAAM,CAAC,uBAAuB,EAAE,gEAAgE,CAAC;SACjG,MAAM,CAAC,2BAA2B,EAAE,8CAA8C,CAAC;SACnF,MAAM,CAAC,8BAA8B,EAAE,kCAAkC,CAAC;SAC1E,MAAM,CAAC,iBAAiB,EAAE,4CAA4C,CAAC;SACvE,SAAS,CAAC,IAAI,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { BillingExecutionResult } from '../../modules/billing/billing.types.internal';
|
|
2
2
|
export declare function formatBillingOutputs(results: BillingExecutionResult[], options: {
|
|
3
|
+
/** Entro un array en `--cargar`: se rotula como lote aunque tenga un solo resultado. */
|
|
4
|
+
readonly batch?: boolean;
|
|
3
5
|
readonly environment: 'produccion' | 'testing';
|
|
4
6
|
readonly previewShown?: boolean;
|
|
5
7
|
readonly raw: boolean;
|
|
6
8
|
}): string;
|
|
7
9
|
export declare function writeBillingCommandResults(results: BillingExecutionResult[], options: {
|
|
10
|
+
/** Entro un array en `--cargar`: el JSON sale como array aunque tenga un solo resultado. */
|
|
11
|
+
readonly batch?: boolean;
|
|
8
12
|
readonly environment: 'produccion' | 'testing';
|
|
9
13
|
readonly outputJson: boolean;
|
|
10
14
|
readonly previewShown?: boolean;
|
|
@@ -8,7 +8,7 @@ export function formatBillingOutputs(results, options) {
|
|
|
8
8
|
previewShown: options.previewShown,
|
|
9
9
|
raw: options.raw,
|
|
10
10
|
});
|
|
11
|
-
if (results.length === 1) {
|
|
11
|
+
if (results.length === 1 && !options.batch) {
|
|
12
12
|
return output;
|
|
13
13
|
}
|
|
14
14
|
return [`Lote ${index + 1}/${results.length}`, output].join('\n');
|
|
@@ -17,7 +17,7 @@ export function formatBillingOutputs(results, options) {
|
|
|
17
17
|
}
|
|
18
18
|
export function writeBillingCommandResults(results, options) {
|
|
19
19
|
if (options.outputJson) {
|
|
20
|
-
if (results.length === 1) {
|
|
20
|
+
if (results.length === 1 && !options.batch) {
|
|
21
21
|
writeTerminalJson(formatBillingResultAsJson(results[0], { raw: options.raw }));
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
@@ -25,6 +25,7 @@ export function writeBillingCommandResults(results, options) {
|
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
writeTerminalOutput(formatBillingOutputs(results, {
|
|
28
|
+
batch: options.batch,
|
|
28
29
|
environment: options.environment,
|
|
29
30
|
previewShown: options.previewShown,
|
|
30
31
|
raw: options.raw,
|
|
@@ -1 +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,EACL,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,WAAW,EACX,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,UAAU,CAAC;AAElB,MAAM,UAAU,oBAAoB,CAClC,OAAiC,EACjC,
|
|
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,EACL,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,WAAW,EACX,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,UAAU,CAAC;AAElB,MAAM,UAAU,oBAAoB,CAClC,OAAiC,EACjC,OAMC;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,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YAC3C,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,OAOC;IAED,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QACvB,IAAI,OAAO,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AC,CAAC,EAAE,CAAC;YAClE,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;SAClG,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACzC,CAAC;AACH,CAAC"}
|
|
@@ -12,6 +12,8 @@ export interface BillingCommandDefaults {
|
|
|
12
12
|
readonly defaultEmit?: boolean;
|
|
13
13
|
readonly defaultExchangeRate?: number;
|
|
14
14
|
readonly defaultIvaCondition?: BillingCommandInput['ivaCondition'];
|
|
15
|
+
/** Con un CUIT y sin IVA receptor explicito, se va a consultar el padron: no hace falta un default. */
|
|
16
|
+
readonly lookupIvaConditionInPadron?: boolean;
|
|
15
17
|
}
|
|
16
18
|
export interface BillingCommandPlan {
|
|
17
19
|
/** Posicion en el lote (desde 1) de cada item de `inputs`. */
|
|
@@ -19,6 +21,11 @@ export interface BillingCommandPlan {
|
|
|
19
21
|
readonly inputs: BillingCommandInput[];
|
|
20
22
|
/** Items del lote que no se pudieron leer; el comando no emite nada si hay alguno. */
|
|
21
23
|
readonly invalidItems: BatchItemError[];
|
|
24
|
+
/**
|
|
25
|
+
* `--cargar` trajo un array: es un lote aunque tenga un solo elemento (sale como array y con errores
|
|
26
|
+
* `BATCH_*`). Un objeto o los flags son un comprobante suelto.
|
|
27
|
+
*/
|
|
28
|
+
readonly isBatch: boolean;
|
|
22
29
|
readonly modeSource: 'default' | 'file' | 'flags';
|
|
23
30
|
/** Cantidad de items del lote (1 si no hay lote). */
|
|
24
31
|
readonly total: number;
|
|
@@ -4,6 +4,7 @@ import { readJsonFile } from '../../lib/files/read-json-file.js';
|
|
|
4
4
|
import { parseArgentineAmount } from '../../lib/numbers/argentine-amount.js';
|
|
5
5
|
import { BatchValidationError, describeBatchItemError } from '../../modules/billing/billing.batch.js';
|
|
6
6
|
import { isForeignCurrency } from '../../modules/billing/billing.currency.js';
|
|
7
|
+
import { parseBillingJsonInput, readBillingJsonItems, } from '../../modules/billing/billing.json-input.js';
|
|
7
8
|
import { billingCommandSchema } from '../../modules/billing/billing.schemas.js';
|
|
8
9
|
import { getVoucherKindByShortcut } from '../../modules/billing/voucher-kind-map.js';
|
|
9
10
|
import { resolveConceptShortcut, resolveDocumentIdentity, resolveIvaShortcut } from './billing.command.shortcuts.js';
|
|
@@ -128,10 +129,16 @@ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaul
|
|
|
128
129
|
const documentIdentity = resolveDocumentIdentity(commandOptions);
|
|
129
130
|
const ivaShortcut = resolveIvaShortcut(commandOptions);
|
|
130
131
|
const resolvedConcept = pickString(commandOptions.concepto) ?? conceptShortcut ?? fileInput?.concepto ?? defaults.defaultConcept;
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
const explicitIvaCondition = pickString(commandOptions.ivaReceptor, commandOptions.ir) ?? ivaShortcut ?? fileInput?.ivaReceptor;
|
|
133
|
+
const documentType = documentIdentity.documentType ?? fileInput?.tipoDocumento;
|
|
134
|
+
const willLookupPadron = !explicitIvaCondition && defaults.lookupIvaConditionInPadron === true && documentType === 'cuit';
|
|
135
|
+
const resolvedIvaCondition = explicitIvaCondition ?? defaults.defaultIvaCondition;
|
|
136
|
+
// Sin definir es explicito: asi la entrada que arma el parser es igual a la del modo interactivo.
|
|
137
|
+
const ivaConditionSource = explicitIvaCondition
|
|
138
|
+
? undefined
|
|
139
|
+
: resolvedIvaCondition
|
|
140
|
+
? 'default'
|
|
141
|
+
: 'missing';
|
|
135
142
|
if (typeof commandOptions.concepto === 'string' && conceptShortcut) {
|
|
136
143
|
throw new InputValidationError('Use --concepto o un flag corto de concepto (--cs, --cp, --csp), pero no ambos.');
|
|
137
144
|
}
|
|
@@ -144,7 +151,7 @@ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaul
|
|
|
144
151
|
if (!resolvedConcept) {
|
|
145
152
|
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".');
|
|
146
153
|
}
|
|
147
|
-
if (!resolvedIvaCondition) {
|
|
154
|
+
if (!resolvedIvaCondition && !willLookupPadron) {
|
|
148
155
|
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".');
|
|
149
156
|
}
|
|
150
157
|
const associatedVoucherFromFile = fileInput?.comprobanteAsociado
|
|
@@ -197,7 +204,7 @@ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaul
|
|
|
197
204
|
concept: resolvedConcept,
|
|
198
205
|
currencyCode,
|
|
199
206
|
documentNumber: documentIdentity.documentNumber ?? fileInput?.numeroDocumento,
|
|
200
|
-
documentType
|
|
207
|
+
documentType,
|
|
201
208
|
dryRun: !shouldEmit,
|
|
202
209
|
dueDay: pickNumber(commandOptions.dia, fileInput?.dia),
|
|
203
210
|
emit: shouldEmit,
|
|
@@ -207,7 +214,9 @@ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaul
|
|
|
207
214
|
? undefined
|
|
208
215
|
: (flagRates.ivaRate ?? fileInput?.alicuotaIva ?? (usesIvaRateDefault ? defaults.defaultIvaRate : undefined)),
|
|
209
216
|
ivaRateAmounts,
|
|
210
|
-
|
|
217
|
+
// Sin valor todavia: lo completa el padron antes de emitir (ver `ivaConditionSource`).
|
|
218
|
+
ivaCondition: resolvedIvaCondition ?? 'consumidor-final',
|
|
219
|
+
ivaConditionSource,
|
|
211
220
|
paymentDueDate: pickString(commandOptions.vencimiento, commandOptions.vto, fileInput?.vencimientoPago),
|
|
212
221
|
pdf: resolvePdfFlag(commandOptions, fileInput),
|
|
213
222
|
pdfDescription: pickString(commandOptions.descripcion, fileInput?.descripcion),
|
|
@@ -228,30 +237,33 @@ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaul
|
|
|
228
237
|
export function parseBillingCommandPlan(command, shortcut, defaults = {}) {
|
|
229
238
|
const commandOptions = command.optsWithGlobals();
|
|
230
239
|
const inputFilePath = typeof commandOptions.cargar === 'string' ? commandOptions.cargar : undefined;
|
|
231
|
-
|
|
232
|
-
const
|
|
240
|
+
// Se lee sin asumir la forma: cada item se valida con `parseBillingJsonInput` (en un lote, por separado).
|
|
241
|
+
const source = inputFilePath ? readJsonFile(inputFilePath) : undefined;
|
|
242
|
+
const fileInputs = inputFilePath ? readBillingJsonItems(source) : [];
|
|
243
|
+
const isBatch = Array.isArray(source);
|
|
233
244
|
if (fileInputs.length === 0) {
|
|
234
245
|
const { __modeSource, ...input } = parseBillingCommandInputFromSource(command, shortcut, undefined, defaults);
|
|
235
246
|
return {
|
|
236
247
|
inputIndexes: [1],
|
|
237
248
|
inputs: [input],
|
|
238
249
|
invalidItems: [],
|
|
250
|
+
isBatch: false,
|
|
239
251
|
modeSource: __modeSource,
|
|
240
252
|
total: 1,
|
|
241
253
|
};
|
|
242
254
|
}
|
|
243
|
-
// Un
|
|
244
|
-
// para informarlos de una vez en lugar de cortar en el primero.
|
|
245
|
-
if (
|
|
246
|
-
const { __modeSource, ...input } = parseBillingCommandInputFromSource(command, shortcut, fileInputs[0], defaults);
|
|
247
|
-
return { inputIndexes: [1], inputs: [input], invalidItems: [], modeSource: __modeSource, total: 1 };
|
|
255
|
+
// Un objeto suelto falla como siempre. En un lote (un array, aunque tenga un solo elemento) se leen todos
|
|
256
|
+
// y se juntan los errores, para informarlos de una vez en lugar de cortar en el primero.
|
|
257
|
+
if (!isBatch) {
|
|
258
|
+
const { __modeSource, ...input } = parseBillingCommandInputFromSource(command, shortcut, parseBillingJsonInput(fileInputs[0]), defaults);
|
|
259
|
+
return { inputIndexes: [1], inputs: [input], invalidItems: [], isBatch: false, modeSource: __modeSource, total: 1 };
|
|
248
260
|
}
|
|
249
261
|
const parsed = [];
|
|
250
262
|
const inputIndexes = [];
|
|
251
263
|
const invalidItems = [];
|
|
252
264
|
fileInputs.forEach((fileInput, position) => {
|
|
253
265
|
try {
|
|
254
|
-
parsed.push(parseBillingCommandInputFromSource(command, shortcut, fileInput, defaults));
|
|
266
|
+
parsed.push(parseBillingCommandInputFromSource(command, shortcut, parseBillingJsonInput(fileInput), defaults));
|
|
255
267
|
inputIndexes.push(position + 1);
|
|
256
268
|
}
|
|
257
269
|
catch (error) {
|
|
@@ -267,6 +279,7 @@ export function parseBillingCommandPlan(command, shortcut, defaults = {}) {
|
|
|
267
279
|
inputIndexes,
|
|
268
280
|
inputs: parsed.map(({ __modeSource: _modeSource, ...input }) => input),
|
|
269
281
|
invalidItems,
|
|
282
|
+
isBatch: true,
|
|
270
283
|
modeSource,
|
|
271
284
|
total: fileInputs.length,
|
|
272
285
|
};
|