arcli 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +106 -1
- package/README.md +21 -14
- package/dist/cli/arca-runtime.js +41 -0
- package/dist/cli/commands/billing-family.command.js +36 -9
- package/dist/cli/commands/billing-shortcuts.command.js +8 -2
- package/dist/cli/commands/billing.command.batch.js +28 -12
- package/dist/cli/commands/billing.command.interactive-preview.js +12 -13
- package/dist/cli/commands/billing.command.options.js +83 -39
- package/dist/cli/commands/billing.command.output.js +3 -3
- package/dist/cli/commands/billing.command.parser.js +44 -30
- package/dist/cli/commands/billing.command.pdf.js +9 -6
- package/dist/cli/commands/billing.command.shared.js +86 -49
- package/dist/cli/commands/billing.command.shortcuts.js +3 -4
- package/dist/cli/commands/completion.command.js +140 -0
- package/dist/cli/commands/config.command.js +44 -45
- package/dist/cli/commands/cuit-argument.js +10 -0
- package/dist/cli/commands/examples.command.js +0 -1
- package/dist/cli/commands/export-shortcut.command.js +19 -0
- package/dist/cli/commands/export.command.js +106 -0
- package/dist/cli/commands/export.command.options.js +140 -0
- package/dist/cli/commands/export.command.parser.js +84 -0
- package/dist/cli/commands/export.command.pdf.js +61 -0
- package/dist/cli/commands/fce-obligation.command.js +8 -16
- package/dist/cli/commands/interactive.command.js +9 -8
- package/dist/cli/commands/padron.command.js +46 -0
- package/dist/cli/commands/parameters.command.js +13 -13
- package/dist/cli/commands/pdf.command.js +17 -31
- package/dist/cli/commands/storybook.command.js +4 -4
- package/dist/cli/commands/vouchers.command.js +14 -14
- package/dist/cli/error-output.js +89 -11
- package/dist/cli/global-options.js +55 -0
- package/dist/cli/help-argv.js +0 -1
- package/dist/cli/help.js +243 -391
- package/dist/cli/ignored-global-options.js +32 -0
- package/dist/cli/index.js +12 -14
- package/dist/cli/interactive/advanced-options.js +13 -14
- package/dist/cli/interactive/config.flow.js +59 -20
- package/dist/cli/interactive/export.flow.js +263 -0
- package/dist/cli/interactive/history.flow.js +2 -3
- package/dist/cli/interactive/interactive-mode.js +63 -33
- package/dist/cli/interactive/invoice-picker.js +7 -7
- package/dist/cli/interactive/invoice.flow.js +35 -13
- package/dist/cli/interactive/note.flow.js +16 -16
- package/dist/cli/interactive/pdf.flow.js +9 -7
- package/dist/cli/interactive/prompts.js +0 -1
- package/dist/cli/interactive/receiver-padron.js +52 -0
- package/dist/cli/interactive/repeat.flow.js +10 -11
- package/dist/cli/interactive/session.js +13 -8
- package/dist/cli/interactive/status.flow.js +0 -1
- package/dist/cli/interactive/update.flow.js +0 -1
- package/dist/cli/interactive/validators.js +7 -6
- package/dist/cli/option-parsers.js +14 -4
- package/dist/cli/program.js +14 -5
- package/dist/cli/skipped-options.js +14 -0
- package/dist/cli/spinner.js +0 -1
- package/dist/cli/types.js +0 -1
- package/dist/cli/version.js +1 -2
- package/dist/index.js +0 -1
- package/dist/lib/dates/arca-date.js +3 -4
- package/dist/lib/errors/app-error.js +2 -2
- package/dist/lib/files/read-json-file.js +2 -3
- package/dist/lib/files/restrict-to-owner.js +0 -1
- package/dist/lib/files/write-new-file.js +29 -0
- package/dist/lib/identity/cuit.js +26 -0
- package/dist/lib/identity/format-cuit.js +1 -2
- package/dist/lib/links.js +2 -1
- package/dist/lib/numbers/argentine-amount.js +3 -4
- package/dist/lib/numbers/strict-integer.js +0 -1
- package/dist/lib/paths/mask-path.js +0 -1
- package/dist/lib/security/certificate.js +10 -8
- package/dist/lib/security/pem.js +2 -3
- package/dist/modules/billing/billing-response.js +16 -5
- package/dist/modules/billing/billing.amounts.js +3 -4
- package/dist/modules/billing/billing.associated-period.js +7 -8
- package/dist/modules/billing/billing.associated-vouchers.js +5 -6
- package/dist/modules/billing/billing.batch.js +12 -5
- package/dist/modules/billing/billing.constants.js +0 -1
- package/dist/modules/billing/billing.currency.js +4 -5
- package/dist/modules/billing/billing.date-range.js +27 -11
- package/dist/modules/billing/billing.display.js +14 -8
- package/dist/modules/billing/billing.errors.js +2 -3
- package/dist/modules/billing/billing.fce.js +3 -4
- package/dist/modules/billing/billing.iva-receptor.js +2 -3
- package/dist/modules/billing/billing.json-format.js +0 -1
- package/dist/modules/billing/billing.json-input.js +278 -0
- package/dist/modules/billing/billing.labels.js +1 -2
- package/dist/modules/billing/billing.mappers.js +0 -1
- package/dist/modules/billing/billing.padron.js +59 -0
- package/dist/modules/billing/billing.presenter.js +0 -1
- package/dist/modules/billing/billing.schemas.js +20 -6
- package/dist/modules/billing/billing.serialize.js +11 -15
- package/dist/modules/billing/billing.service.js +25 -4
- package/dist/modules/billing/billing.text.js +4 -13
- package/dist/modules/billing/billing.types.internal.js +0 -1
- package/dist/modules/billing/billing.types.js +0 -1
- package/dist/modules/billing/billing.validation.js +13 -11
- package/dist/modules/billing/voucher-kind-map.js +15 -16
- package/dist/modules/completion/completion.js +53 -0
- package/dist/modules/completion/completion.presenter.js +35 -0
- package/dist/modules/completion/installer.js +92 -0
- package/dist/modules/completion/shell-scripts.js +46 -0
- package/dist/modules/config/certificate-expiry.js +90 -0
- package/dist/modules/config/config-doctor.js +42 -28
- package/dist/modules/config/config-value-parser.js +32 -17
- package/dist/modules/config/config.export-credentials.js +23 -0
- package/dist/modules/config/config.presenter.js +28 -6
- package/dist/modules/config/config.schemas.js +27 -12
- package/dist/modules/config/config.sections.js +31 -11
- package/dist/modules/config/config.service.js +38 -9
- package/dist/modules/examples/examples.js +72 -37
- package/dist/modules/export/export.items.js +149 -0
- package/dist/modules/export/export.json-input.js +91 -0
- package/dist/modules/export/export.mappers.js +293 -0
- package/dist/modules/export/export.presenter.js +2 -0
- package/dist/modules/export/export.response.js +86 -0
- package/dist/modules/export/export.serialize.js +70 -0
- package/dist/modules/export/export.service.js +146 -0
- package/dist/modules/export/export.text.js +177 -0
- package/dist/modules/export/export.types.js +36 -0
- package/dist/modules/fce/fce-obligation.js +3 -4
- package/dist/modules/fce/fce-obligation.presenter.js +2 -3
- package/dist/modules/interactive/amount-input.js +0 -1
- package/dist/modules/interactive/choices.js +10 -2
- package/dist/modules/interactive/config-fields.js +17 -3
- package/dist/modules/interactive/equivalent-command.js +6 -3
- package/dist/modules/interactive/export-equivalent-command.js +40 -0
- package/dist/modules/interactive/invoice-copy.js +1 -2
- package/dist/modules/interactive/periods.js +0 -1
- package/dist/modules/interactive/wizard.js +0 -1
- package/dist/modules/padron/padron.js +23 -0
- package/dist/modules/padron/padron.presenter.js +48 -0
- package/dist/modules/parameters/health.js +0 -1
- package/dist/modules/parameters/parameters.js +2 -3
- package/dist/modules/parameters/parameters.presenter.js +14 -12
- package/dist/modules/parameters/status.js +0 -1
- package/dist/modules/pdf/pdf-data.mapper.js +94 -3
- package/dist/modules/pdf/pdf-decision.js +0 -1
- package/dist/modules/pdf/pdf-file-name.js +0 -1
- package/dist/modules/pdf/pdf-issuer.js +3 -3
- package/dist/modules/pdf/pdf-legends.js +35 -0
- package/dist/modules/pdf/pdf.errors.js +0 -1
- package/dist/modules/pdf/pdf.types.js +0 -1
- package/dist/modules/storybook/showcase-theme.js +0 -1
- package/dist/modules/storybook/showcase.js +35 -23
- package/dist/modules/update-check/changelog.js +0 -1
- package/dist/modules/update-check/update-check.presenter.js +6 -7
- package/dist/modules/update-check/update-check.service.js +0 -1
- package/dist/modules/vouchers/voucher-history.js +0 -1
- package/dist/modules/vouchers/voucher-history.presenter.js +3 -4
- package/dist/services/arca/arca-billing.gateway.js +18 -4
- package/dist/services/arca/arca-client.factory.js +27 -1
- package/dist/services/arca/arca-context.resolver.js +17 -7
- package/dist/services/arca/arca-export.gateway.js +146 -0
- package/dist/services/arca/arca-fce-obligation.gateway.js +2 -3
- package/dist/services/arca/arca-padron.gateway.js +103 -0
- package/dist/services/arca/arca-parameters.gateway.js +2 -3
- package/dist/services/arca/arca-voucher-history.gateway.js +2 -3
- package/dist/services/arca/last-voucher.js +26 -0
- package/dist/services/clipboard/clipboard.js +0 -1
- package/dist/services/pdf/escape-html.js +0 -1
- package/dist/services/pdf/pdf-browser.js +0 -1
- package/dist/services/pdf/pdf-exporter.js +26 -11
- package/dist/services/pdf/pdf-plugin.js +41 -14
- package/dist/ui/components/certificateBanner.js +8 -0
- package/dist/ui/components/contentPanel.js +0 -1
- package/dist/ui/components/errorPanel.js +0 -1
- package/dist/ui/components/index.js +1 -1
- package/dist/ui/components/keyValuePanel.js +0 -1
- package/dist/ui/components/noticePanel.js +0 -1
- package/dist/ui/components/rawPanel.js +0 -1
- package/dist/ui/components/sectionHeading.js +0 -1
- package/dist/ui/components/statusBar.js +0 -1
- package/dist/ui/components/statusPanel.js +0 -1
- package/dist/ui/components/testingBanner.js +0 -1
- package/dist/ui/index.js +0 -1
- package/dist/ui/presenters/billing.presenter.js +0 -1
- package/dist/ui/presenters/config.presenter.js +1 -2
- package/dist/ui/presenters/errors.presenter.js +14 -12
- package/dist/ui/presenters/errors.zod-presenter.js +13 -35
- package/dist/ui/presenters/export.presenter.js +1 -0
- package/dist/ui/presenters/index.js +1 -1
- package/dist/ui/presenters/pdf.presenter.js +1 -2
- package/dist/ui/presenters/showcase.presenter.js +0 -1
- package/dist/ui/primitives/index.js +0 -1
- package/dist/ui/primitives/renderDivider.js +0 -1
- package/dist/ui/primitives/renderFooter.js +0 -1
- package/dist/ui/primitives/renderJson.js +0 -1
- package/dist/ui/primitives/renderKeyValue.js +0 -1
- package/dist/ui/primitives/renderLogo.js +0 -1
- package/dist/ui/primitives/renderObject.js +0 -1
- package/dist/ui/primitives/renderPanel.js +0 -1
- package/dist/ui/primitives/renderSubtitle.js +0 -1
- package/dist/ui/primitives/renderTable.js +0 -1
- package/dist/ui/primitives/terminalWidth.js +0 -1
- package/dist/ui/primitives/text.js +0 -1
- package/dist/ui/stream/index.js +0 -1
- package/dist/ui/stream/terminal-stream.js +13 -2
- package/dist/ui/theme/index.js +0 -1
- package/dist/ui/theme/theme.js +0 -1
- package/llms.txt +122 -45
- package/package.json +1 -2
- package/dist/cli/commands/billing-family.command.d.ts +0 -2
- package/dist/cli/commands/billing-family.command.js.map +0 -1
- package/dist/cli/commands/billing-shortcuts.command.d.ts +0 -2
- package/dist/cli/commands/billing-shortcuts.command.js.map +0 -1
- package/dist/cli/commands/billing.command.batch.d.ts +0 -22
- package/dist/cli/commands/billing.command.batch.js.map +0 -1
- package/dist/cli/commands/billing.command.interactive-preview.d.ts +0 -18
- package/dist/cli/commands/billing.command.interactive-preview.js.map +0 -1
- package/dist/cli/commands/billing.command.options.d.ts +0 -2
- package/dist/cli/commands/billing.command.options.js.map +0 -1
- package/dist/cli/commands/billing.command.output.d.ts +0 -14
- package/dist/cli/commands/billing.command.output.js.map +0 -1
- package/dist/cli/commands/billing.command.parser.d.ts +0 -28
- package/dist/cli/commands/billing.command.parser.js.map +0 -1
- package/dist/cli/commands/billing.command.pdf.d.ts +0 -24
- package/dist/cli/commands/billing.command.pdf.js.map +0 -1
- package/dist/cli/commands/billing.command.shared.d.ts +0 -7
- package/dist/cli/commands/billing.command.shared.js.map +0 -1
- package/dist/cli/commands/billing.command.shortcuts.d.ts +0 -7
- package/dist/cli/commands/billing.command.shortcuts.js.map +0 -1
- package/dist/cli/commands/config.command.d.ts +0 -7
- package/dist/cli/commands/config.command.js.map +0 -1
- package/dist/cli/commands/examples.command.d.ts +0 -2
- package/dist/cli/commands/examples.command.js.map +0 -1
- package/dist/cli/commands/fce-obligation.command.d.ts +0 -2
- package/dist/cli/commands/fce-obligation.command.js.map +0 -1
- package/dist/cli/commands/interactive.command.d.ts +0 -3
- package/dist/cli/commands/interactive.command.js.map +0 -1
- package/dist/cli/commands/parameters.command.d.ts +0 -2
- package/dist/cli/commands/parameters.command.js.map +0 -1
- package/dist/cli/commands/pdf.command.d.ts +0 -2
- package/dist/cli/commands/pdf.command.js.map +0 -1
- package/dist/cli/commands/storybook.command.d.ts +0 -2
- package/dist/cli/commands/storybook.command.js.map +0 -1
- package/dist/cli/commands/vouchers.command.d.ts +0 -2
- package/dist/cli/commands/vouchers.command.js.map +0 -1
- package/dist/cli/error-output.d.ts +0 -7
- package/dist/cli/error-output.js.map +0 -1
- package/dist/cli/help-argv.d.ts +0 -5
- package/dist/cli/help-argv.js.map +0 -1
- package/dist/cli/help.d.ts +0 -12
- package/dist/cli/help.js.map +0 -1
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/interactive/advanced-options.d.ts +0 -21
- package/dist/cli/interactive/advanced-options.js.map +0 -1
- package/dist/cli/interactive/config.flow.d.ts +0 -5
- package/dist/cli/interactive/config.flow.js.map +0 -1
- package/dist/cli/interactive/history.flow.d.ts +0 -6
- package/dist/cli/interactive/history.flow.js.map +0 -1
- package/dist/cli/interactive/interactive-mode.d.ts +0 -3
- package/dist/cli/interactive/interactive-mode.js.map +0 -1
- package/dist/cli/interactive/invoice-picker.d.ts +0 -25
- package/dist/cli/interactive/invoice-picker.js.map +0 -1
- package/dist/cli/interactive/invoice.flow.d.ts +0 -20
- package/dist/cli/interactive/invoice.flow.js.map +0 -1
- package/dist/cli/interactive/note.flow.d.ts +0 -32
- package/dist/cli/interactive/note.flow.js.map +0 -1
- package/dist/cli/interactive/pdf.flow.d.ts +0 -5
- package/dist/cli/interactive/pdf.flow.js.map +0 -1
- package/dist/cli/interactive/prompts.d.ts +0 -57
- package/dist/cli/interactive/prompts.js.map +0 -1
- package/dist/cli/interactive/repeat.flow.d.ts +0 -13
- package/dist/cli/interactive/repeat.flow.js.map +0 -1
- package/dist/cli/interactive/session.d.ts +0 -22
- package/dist/cli/interactive/session.js.map +0 -1
- package/dist/cli/interactive/status.flow.d.ts +0 -3
- package/dist/cli/interactive/status.flow.js.map +0 -1
- package/dist/cli/interactive/update.flow.d.ts +0 -6
- package/dist/cli/interactive/update.flow.js.map +0 -1
- package/dist/cli/interactive/validators.d.ts +0 -9
- package/dist/cli/interactive/validators.js.map +0 -1
- package/dist/cli/option-parsers.d.ts +0 -6
- package/dist/cli/option-parsers.js.map +0 -1
- package/dist/cli/program.d.ts +0 -2
- package/dist/cli/program.js.map +0 -1
- package/dist/cli/spinner.d.ts +0 -8
- package/dist/cli/spinner.js.map +0 -1
- package/dist/cli/types.d.ts +0 -6
- package/dist/cli/types.js.map +0 -1
- package/dist/cli/version.d.ts +0 -1
- package/dist/cli/version.js.map +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/dates/arca-date.d.ts +0 -19
- package/dist/lib/dates/arca-date.js.map +0 -1
- package/dist/lib/errors/app-error.d.ts +0 -17
- package/dist/lib/errors/app-error.js.map +0 -1
- package/dist/lib/files/read-json-file.d.ts +0 -1
- package/dist/lib/files/read-json-file.js.map +0 -1
- package/dist/lib/files/restrict-to-owner.d.ts +0 -7
- package/dist/lib/files/restrict-to-owner.js.map +0 -1
- package/dist/lib/identity/format-cuit.d.ts +0 -2
- package/dist/lib/identity/format-cuit.js.map +0 -1
- package/dist/lib/links.d.ts +0 -2
- package/dist/lib/links.js.map +0 -1
- package/dist/lib/numbers/argentine-amount.d.ts +0 -23
- package/dist/lib/numbers/argentine-amount.js.map +0 -1
- package/dist/lib/numbers/strict-integer.d.ts +0 -4
- package/dist/lib/numbers/strict-integer.js.map +0 -1
- package/dist/lib/paths/mask-path.d.ts +0 -1
- package/dist/lib/paths/mask-path.js.map +0 -1
- package/dist/lib/security/certificate.d.ts +0 -7
- package/dist/lib/security/certificate.js.map +0 -1
- package/dist/lib/security/pem.d.ts +0 -5
- package/dist/lib/security/pem.js.map +0 -1
- package/dist/modules/billing/billing-response.d.ts +0 -4
- package/dist/modules/billing/billing-response.js.map +0 -1
- package/dist/modules/billing/billing.amounts.d.ts +0 -21
- package/dist/modules/billing/billing.amounts.js.map +0 -1
- package/dist/modules/billing/billing.associated-period.d.ts +0 -8
- package/dist/modules/billing/billing.associated-period.js.map +0 -1
- package/dist/modules/billing/billing.associated-vouchers.d.ts +0 -12
- package/dist/modules/billing/billing.associated-vouchers.js.map +0 -1
- package/dist/modules/billing/billing.batch.d.ts +0 -23
- package/dist/modules/billing/billing.batch.js.map +0 -1
- package/dist/modules/billing/billing.constants.d.ts +0 -2
- package/dist/modules/billing/billing.constants.js.map +0 -1
- package/dist/modules/billing/billing.currency.d.ts +0 -18
- package/dist/modules/billing/billing.currency.js.map +0 -1
- package/dist/modules/billing/billing.date-range.d.ts +0 -9
- package/dist/modules/billing/billing.date-range.js.map +0 -1
- package/dist/modules/billing/billing.display.d.ts +0 -13
- package/dist/modules/billing/billing.display.js.map +0 -1
- package/dist/modules/billing/billing.errors.d.ts +0 -12
- package/dist/modules/billing/billing.errors.js.map +0 -1
- package/dist/modules/billing/billing.fce.d.ts +0 -21
- package/dist/modules/billing/billing.fce.js.map +0 -1
- package/dist/modules/billing/billing.iva-receptor.d.ts +0 -8
- package/dist/modules/billing/billing.iva-receptor.js.map +0 -1
- package/dist/modules/billing/billing.json-format.d.ts +0 -6
- package/dist/modules/billing/billing.json-format.js.map +0 -1
- package/dist/modules/billing/billing.labels.d.ts +0 -9
- package/dist/modules/billing/billing.labels.js.map +0 -1
- package/dist/modules/billing/billing.mappers.d.ts +0 -8
- package/dist/modules/billing/billing.mappers.js.map +0 -1
- package/dist/modules/billing/billing.presenter.d.ts +0 -7
- package/dist/modules/billing/billing.presenter.js.map +0 -1
- package/dist/modules/billing/billing.schemas.d.ts +0 -142
- package/dist/modules/billing/billing.schemas.js.map +0 -1
- package/dist/modules/billing/billing.serialize.d.ts +0 -8
- package/dist/modules/billing/billing.serialize.js.map +0 -1
- package/dist/modules/billing/billing.service.d.ts +0 -27
- package/dist/modules/billing/billing.service.js.map +0 -1
- package/dist/modules/billing/billing.text.d.ts +0 -8
- package/dist/modules/billing/billing.text.js.map +0 -1
- package/dist/modules/billing/billing.types.d.ts +0 -13
- package/dist/modules/billing/billing.types.internal.d.ts +0 -30
- package/dist/modules/billing/billing.types.internal.js.map +0 -1
- package/dist/modules/billing/billing.types.js.map +0 -1
- package/dist/modules/billing/billing.validation.d.ts +0 -7
- package/dist/modules/billing/billing.validation.js.map +0 -1
- package/dist/modules/billing/voucher-kind-map.d.ts +0 -9
- package/dist/modules/billing/voucher-kind-map.js.map +0 -1
- package/dist/modules/config/config-doctor.d.ts +0 -15
- package/dist/modules/config/config-doctor.js.map +0 -1
- package/dist/modules/config/config-value-parser.d.ts +0 -2
- package/dist/modules/config/config-value-parser.js.map +0 -1
- package/dist/modules/config/config.presenter.d.ts +0 -15
- package/dist/modules/config/config.presenter.js.map +0 -1
- package/dist/modules/config/config.schemas.d.ts +0 -154
- package/dist/modules/config/config.schemas.js.map +0 -1
- package/dist/modules/config/config.sections.d.ts +0 -14
- package/dist/modules/config/config.sections.js.map +0 -1
- package/dist/modules/config/config.service.d.ts +0 -35
- package/dist/modules/config/config.service.js.map +0 -1
- package/dist/modules/examples/examples.d.ts +0 -1
- package/dist/modules/examples/examples.js.map +0 -1
- package/dist/modules/fce/fce-obligation.d.ts +0 -20
- package/dist/modules/fce/fce-obligation.js.map +0 -1
- package/dist/modules/fce/fce-obligation.presenter.d.ts +0 -9
- package/dist/modules/fce/fce-obligation.presenter.js.map +0 -1
- package/dist/modules/interactive/amount-input.d.ts +0 -4
- package/dist/modules/interactive/amount-input.js.map +0 -1
- package/dist/modules/interactive/choices.d.ts +0 -13
- package/dist/modules/interactive/choices.js.map +0 -1
- package/dist/modules/interactive/config-fields.d.ts +0 -20
- package/dist/modules/interactive/config-fields.js.map +0 -1
- package/dist/modules/interactive/equivalent-command.d.ts +0 -8
- package/dist/modules/interactive/equivalent-command.js.map +0 -1
- package/dist/modules/interactive/invoice-copy.d.ts +0 -19
- package/dist/modules/interactive/invoice-copy.js.map +0 -1
- package/dist/modules/interactive/periods.d.ts +0 -7
- package/dist/modules/interactive/periods.js.map +0 -1
- package/dist/modules/interactive/wizard.d.ts +0 -16
- package/dist/modules/interactive/wizard.js.map +0 -1
- package/dist/modules/parameters/health.d.ts +0 -17
- package/dist/modules/parameters/health.js.map +0 -1
- package/dist/modules/parameters/parameters.d.ts +0 -50
- package/dist/modules/parameters/parameters.js.map +0 -1
- package/dist/modules/parameters/parameters.presenter.d.ts +0 -12
- package/dist/modules/parameters/parameters.presenter.js.map +0 -1
- package/dist/modules/parameters/status.d.ts +0 -31
- package/dist/modules/parameters/status.js.map +0 -1
- package/dist/modules/pdf/pdf-data.mapper.d.ts +0 -4
- package/dist/modules/pdf/pdf-data.mapper.js.map +0 -1
- package/dist/modules/pdf/pdf-decision.d.ts +0 -14
- package/dist/modules/pdf/pdf-decision.js.map +0 -1
- package/dist/modules/pdf/pdf-file-name.d.ts +0 -3
- package/dist/modules/pdf/pdf-file-name.js.map +0 -1
- package/dist/modules/pdf/pdf-issuer.d.ts +0 -8
- package/dist/modules/pdf/pdf-issuer.js.map +0 -1
- package/dist/modules/pdf/pdf.errors.d.ts +0 -9
- package/dist/modules/pdf/pdf.errors.js.map +0 -1
- package/dist/modules/pdf/pdf.types.d.ts +0 -91
- package/dist/modules/pdf/pdf.types.js.map +0 -1
- package/dist/modules/storybook/showcase-theme.d.ts +0 -7
- package/dist/modules/storybook/showcase-theme.js.map +0 -1
- package/dist/modules/storybook/showcase.d.ts +0 -2
- package/dist/modules/storybook/showcase.js.map +0 -1
- package/dist/modules/update-check/changelog.d.ts +0 -23
- package/dist/modules/update-check/changelog.js.map +0 -1
- package/dist/modules/update-check/update-check.presenter.d.ts +0 -6
- package/dist/modules/update-check/update-check.presenter.js.map +0 -1
- package/dist/modules/update-check/update-check.service.d.ts +0 -11
- package/dist/modules/update-check/update-check.service.js.map +0 -1
- package/dist/modules/vouchers/voucher-history.d.ts +0 -39
- package/dist/modules/vouchers/voucher-history.js.map +0 -1
- package/dist/modules/vouchers/voucher-history.presenter.d.ts +0 -29
- package/dist/modules/vouchers/voucher-history.presenter.js.map +0 -1
- package/dist/services/arca/arca-billing.gateway.d.ts +0 -10
- package/dist/services/arca/arca-billing.gateway.js.map +0 -1
- package/dist/services/arca/arca-client.factory.d.ts +0 -5
- package/dist/services/arca/arca-client.factory.js.map +0 -1
- package/dist/services/arca/arca-context.resolver.d.ts +0 -44
- package/dist/services/arca/arca-context.resolver.js.map +0 -1
- package/dist/services/arca/arca-fce-obligation.gateway.d.ts +0 -7
- package/dist/services/arca/arca-fce-obligation.gateway.js.map +0 -1
- package/dist/services/arca/arca-parameters.gateway.d.ts +0 -10
- package/dist/services/arca/arca-parameters.gateway.js.map +0 -1
- package/dist/services/arca/arca-voucher-history.gateway.d.ts +0 -8
- package/dist/services/arca/arca-voucher-history.gateway.js.map +0 -1
- package/dist/services/clipboard/clipboard.d.ts +0 -2
- package/dist/services/clipboard/clipboard.js.map +0 -1
- package/dist/services/pdf/escape-html.d.ts +0 -6
- package/dist/services/pdf/escape-html.js.map +0 -1
- package/dist/services/pdf/pdf-browser.d.ts +0 -5
- package/dist/services/pdf/pdf-browser.js.map +0 -1
- package/dist/services/pdf/pdf-exporter.d.ts +0 -19
- package/dist/services/pdf/pdf-exporter.js.map +0 -1
- package/dist/services/pdf/pdf-plugin.d.ts +0 -50
- package/dist/services/pdf/pdf-plugin.js.map +0 -1
- package/dist/ui/components/contentPanel.d.ts +0 -5
- package/dist/ui/components/contentPanel.js.map +0 -1
- package/dist/ui/components/errorPanel.d.ts +0 -1
- package/dist/ui/components/errorPanel.js.map +0 -1
- package/dist/ui/components/index.d.ts +0 -9
- package/dist/ui/components/index.js.map +0 -1
- package/dist/ui/components/keyValuePanel.d.ts +0 -3
- package/dist/ui/components/keyValuePanel.js.map +0 -1
- package/dist/ui/components/noticePanel.d.ts +0 -3
- package/dist/ui/components/noticePanel.js.map +0 -1
- package/dist/ui/components/rawPanel.d.ts +0 -1
- package/dist/ui/components/rawPanel.js.map +0 -1
- package/dist/ui/components/sectionHeading.d.ts +0 -3
- package/dist/ui/components/sectionHeading.js.map +0 -1
- package/dist/ui/components/statusBar.d.ts +0 -19
- package/dist/ui/components/statusBar.js.map +0 -1
- package/dist/ui/components/statusPanel.d.ts +0 -3
- package/dist/ui/components/statusPanel.js.map +0 -1
- package/dist/ui/components/testingBanner.d.ts +0 -2
- package/dist/ui/components/testingBanner.js.map +0 -1
- package/dist/ui/index.d.ts +0 -5
- package/dist/ui/index.js.map +0 -1
- package/dist/ui/presenters/billing.presenter.d.ts +0 -2
- package/dist/ui/presenters/billing.presenter.js.map +0 -1
- package/dist/ui/presenters/config.presenter.d.ts +0 -1
- package/dist/ui/presenters/config.presenter.js.map +0 -1
- package/dist/ui/presenters/errors.presenter.d.ts +0 -1
- package/dist/ui/presenters/errors.presenter.js.map +0 -1
- package/dist/ui/presenters/errors.zod-presenter.d.ts +0 -4
- package/dist/ui/presenters/errors.zod-presenter.js.map +0 -1
- package/dist/ui/presenters/index.d.ts +0 -6
- package/dist/ui/presenters/index.js.map +0 -1
- package/dist/ui/presenters/pdf.presenter.d.ts +0 -13
- package/dist/ui/presenters/pdf.presenter.js.map +0 -1
- package/dist/ui/presenters/showcase.presenter.d.ts +0 -1
- package/dist/ui/presenters/showcase.presenter.js.map +0 -1
- package/dist/ui/primitives/index.d.ts +0 -10
- package/dist/ui/primitives/index.js.map +0 -1
- package/dist/ui/primitives/renderDivider.d.ts +0 -5
- package/dist/ui/primitives/renderDivider.js.map +0 -1
- package/dist/ui/primitives/renderFooter.d.ts +0 -7
- package/dist/ui/primitives/renderFooter.js.map +0 -1
- package/dist/ui/primitives/renderJson.d.ts +0 -3
- package/dist/ui/primitives/renderJson.js.map +0 -1
- package/dist/ui/primitives/renderKeyValue.d.ts +0 -14
- package/dist/ui/primitives/renderKeyValue.js.map +0 -1
- package/dist/ui/primitives/renderLogo.d.ts +0 -3
- package/dist/ui/primitives/renderLogo.js.map +0 -1
- package/dist/ui/primitives/renderObject.d.ts +0 -1
- package/dist/ui/primitives/renderObject.js.map +0 -1
- package/dist/ui/primitives/renderPanel.d.ts +0 -27
- package/dist/ui/primitives/renderPanel.js.map +0 -1
- package/dist/ui/primitives/renderSubtitle.d.ts +0 -7
- package/dist/ui/primitives/renderSubtitle.js.map +0 -1
- package/dist/ui/primitives/renderTable.d.ts +0 -6
- package/dist/ui/primitives/renderTable.js.map +0 -1
- package/dist/ui/primitives/terminalWidth.d.ts +0 -4
- package/dist/ui/primitives/terminalWidth.js.map +0 -1
- package/dist/ui/primitives/text.d.ts +0 -28
- package/dist/ui/primitives/text.js.map +0 -1
- package/dist/ui/stream/index.d.ts +0 -1
- package/dist/ui/stream/index.js.map +0 -1
- package/dist/ui/stream/terminal-stream.d.ts +0 -16
- package/dist/ui/stream/terminal-stream.js.map +0 -1
- package/dist/ui/theme/index.d.ts +0 -1
- package/dist/ui/theme/index.js.map +0 -1
- package/dist/ui/theme/theme.d.ts +0 -68
- package/dist/ui/theme/theme.js.map +0 -1
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { Option } from 'commander';
|
|
2
2
|
import { EXCHANGE_RATE_DECIMALS } from '../../lib/numbers/argentine-amount.js';
|
|
3
|
-
import { amountOption, documentNumberOption, integerOption } from '../option-parsers.js';
|
|
3
|
+
import { amountOption, cuitOption, documentNumberOption, integerOption } from '../option-parsers.js';
|
|
4
4
|
export function registerBillingOptions(command) {
|
|
5
5
|
command
|
|
6
|
-
.option('-m, --monto <
|
|
7
|
-
.option('--alicuota <tasa>', '
|
|
8
|
-
.option('--exento <
|
|
6
|
+
.option('-m, --monto <numero>', 'importe total del comprobante, por ejemplo 15000 o 1.500,50', amountOption('--monto'))
|
|
7
|
+
.option('--alicuota <tasa>', 'alícuota de IVA para A y B: general (21), reducida (10.5), incrementada (27), cero (0), 5 o 2.5. Repetible como TASA:MONTO para varias alícuotas', (value, previous) => [...(previous ?? []), value])
|
|
8
|
+
.option('--exento <numero>', 'parte exenta del monto total (A y B)', amountOption('--exento'))
|
|
9
9
|
// No puede llamarse --no-gravado: commander interpreta --no-* como negacion de un flag booleano.
|
|
10
|
-
.option('--nogravado <
|
|
11
|
-
.option('-d, --dia <
|
|
12
|
-
.option('--punto-venta <
|
|
13
|
-
.option('--pv <
|
|
14
|
-
.option('--cargar <
|
|
10
|
+
.option('--nogravado <numero>', 'parte no gravada del monto total (A y B)', amountOption('--nogravado'))
|
|
11
|
+
.option('-d, --dia <numero>', 'día de vencimiento o referencia del servicio', integerOption('--dia'))
|
|
12
|
+
.option('--punto-venta <numero>', 'punto de venta (alias: --pv)', integerOption('--punto-venta'))
|
|
13
|
+
.option('--pv <numero>', 'alias de punto de venta', integerOption('--pv'))
|
|
14
|
+
.option('--cargar <ruta>', 'cargar datos base desde un archivo JSON')
|
|
15
15
|
.option('-f, --fecha <fecha>', 'fecha del comprobante; acepta D, D/M, D/M/YY o D/M/YYYY con - o /')
|
|
16
16
|
.option('-c, --concepto <tipo>', 'productos, servicios o productos y servicios (alias: cs, cp, csp)')
|
|
17
17
|
.option('--cs', 'usar concepto servicios')
|
|
18
18
|
.option('--cp', 'usar concepto productos')
|
|
19
19
|
.option('--csp', 'usar concepto productos y servicios')
|
|
20
|
-
.option('--moneda <codigo>', '
|
|
20
|
+
.option('--moneda <codigo>', 'código de moneda, por ejemplo ARS o USD (alias: --mda)')
|
|
21
21
|
.option('--mda <codigo>', 'alias de moneda, por ejemplo ARS o USD')
|
|
22
|
-
.option('--cm <
|
|
23
|
-
.option('--cotizacion-moneda <
|
|
24
|
-
.option('--misma-moneda', 'el pago se cancela en la misma moneda extranjera; usa la
|
|
25
|
-
.option('--cuit <
|
|
26
|
-
.option('--cuil <
|
|
27
|
-
.option('--dni <
|
|
28
|
-
.option('--consumidor-final', 'usar consumidor final con documento 0')
|
|
22
|
+
.option('--cm <numero>', 'alias de cotización de la moneda', amountOption('--cm', EXCHANGE_RATE_DECIMALS))
|
|
23
|
+
.option('--cotizacion-moneda <numero>', 'cotización de la moneda, por ejemplo 1.452,50 (alias: --cm)', amountOption('--cotizacion-moneda', EXCHANGE_RATE_DECIMALS))
|
|
24
|
+
.option('--misma-moneda', 'el pago se cancela en la misma moneda extranjera; usa la cotización oficial de ARCA')
|
|
25
|
+
.option('--cuit <numero>', 'usar CUIT del receptor', documentNumberOption('--cuit'))
|
|
26
|
+
.option('--cuil <numero>', 'usar CUIL del receptor', documentNumberOption('--cuil'))
|
|
27
|
+
.option('--dni <numero>', 'usar DNI del receptor', documentNumberOption('--dni'))
|
|
28
|
+
.option('--consumidor-final', 'usar consumidor final con documento 0 (alias: --cfinal)')
|
|
29
29
|
.option('--cfinal', 'alias de consumidor final con documento 0')
|
|
30
|
-
.option('--iva-receptor <tipo>', '
|
|
31
|
-
.option('--ir <tipo>', 'alias
|
|
30
|
+
.option('--iva-receptor <tipo>', 'condición IVA del receptor; con --cuit, sin este flag, se toma del padrón (alias: --ir)')
|
|
31
|
+
.option('--ir <tipo>', 'alias rápido de condición IVA del receptor')
|
|
32
32
|
.option('--ir-ce', 'IVA receptor: cliente del exterior')
|
|
33
33
|
.option('--ir-cf', 'IVA receptor: consumidor final')
|
|
34
34
|
.option('--ir-il', 'IVA receptor: IVA liberado')
|
|
@@ -40,34 +40,78 @@ export function registerBillingOptions(command) {
|
|
|
40
40
|
.option('--ir-rm', 'IVA receptor: responsable monotributo')
|
|
41
41
|
.option('--ir-se', 'IVA receptor: sujeto exento')
|
|
42
42
|
.option('--ir-snc', 'IVA receptor: sujeto no categorizado')
|
|
43
|
-
.option('--sd <fecha>', 'alias
|
|
44
|
-
.option('--servicio-desde <fecha>', 'fecha de inicio de servicio')
|
|
45
|
-
.option('--sh <fecha>', 'alias
|
|
46
|
-
.option('--servicio-hasta <fecha>', 'fecha de fin de servicio')
|
|
47
|
-
.option('--vencimiento <fecha>', 'fecha de vencimiento del pago; por defecto el fin del servicio')
|
|
43
|
+
.option('--sd <fecha>', 'alias rápido de fecha de inicio de servicio')
|
|
44
|
+
.option('--servicio-desde <fecha>', 'fecha de inicio de servicio (alias: --sd)')
|
|
45
|
+
.option('--sh <fecha>', 'alias rápido de fecha de fin de servicio')
|
|
46
|
+
.option('--servicio-hasta <fecha>', 'fecha de fin de servicio (alias: --sh)')
|
|
47
|
+
.option('--vencimiento <fecha>', 'fecha de vencimiento del pago; por defecto el fin del servicio (alias: --vto)')
|
|
48
48
|
.option('--vto <fecha>', 'alias de fecha de vencimiento del pago')
|
|
49
|
-
.option('--at <
|
|
50
|
-
.option('--apv <
|
|
51
|
-
.option('--asociado-punto-venta <
|
|
52
|
-
.option('--ar <
|
|
53
|
-
.option('--ac <
|
|
54
|
-
.option('--acuit <
|
|
55
|
-
.option('--periodo-desde <fecha>', 'inicio del
|
|
56
|
-
.option('--pd <fecha>', 'alias de inicio del
|
|
57
|
-
.option('--periodo-hasta <fecha>', 'fin del
|
|
58
|
-
.option('--ph <fecha>', 'alias de fin del
|
|
49
|
+
.option('--at <numero>', 'tipo ARCA del comprobante asociado', integerOption('--at'))
|
|
50
|
+
.option('--apv <numero>', 'punto de venta del comprobante asociado (alias: --asociado-punto-venta)', integerOption('--apv'))
|
|
51
|
+
.option('--asociado-punto-venta <numero>', 'punto de venta del comprobante asociado', integerOption('--asociado-punto-venta'))
|
|
52
|
+
.option('--ar <numero>', 'número del comprobante asociado', integerOption('--ar'))
|
|
53
|
+
.option('--ac <atajo>', 'atajo del comprobante asociado, por ejemplo fc o fa')
|
|
54
|
+
.option('--acuit <numero>', 'CUIT del comprobante asociado; en NC/ND FCE por defecto el CUIT emisor', cuitOption('--acuit'))
|
|
55
|
+
.option('--periodo-desde <fecha>', 'inicio del período asociado; alternativa a --ac en notas comunes (alias: --pd)')
|
|
56
|
+
.option('--pd <fecha>', 'alias de inicio del período asociado')
|
|
57
|
+
.option('--periodo-hasta <fecha>', 'fin del período asociado; alternativa a --ac en notas comunes (alias: --ph)')
|
|
58
|
+
.option('--ph <fecha>', 'alias de fin del período asociado')
|
|
59
59
|
.option('--afecha <fecha>', 'fecha del comprobante asociado; obligatoria en NC/ND FCE')
|
|
60
60
|
.option('--cbu <cbu>', 'CBU del emisor para facturas FCE (22 digitos)')
|
|
61
61
|
.option('--alias <alias>', 'alias del CBU del emisor para facturas FCE')
|
|
62
62
|
.option('--transferencia <modalidad>', 'modalidad de transferencia FCE: sca o adc (por defecto sca)')
|
|
63
|
-
.option('--anulacion', 'NC/ND FCE de
|
|
64
|
-
.option('--exportar-pdf', 'generar el PDF del comprobante emitido, aunque la config diga otra cosa')
|
|
63
|
+
.option('--anulacion', 'NC/ND FCE de anulación (la factura asociada fue rechazada por el comprador)')
|
|
64
|
+
.option('--exportar-pdf', 'generar el PDF del comprobante emitido, aunque la config diga otra cosa (alias: --pdf)')
|
|
65
65
|
.option('--pdf', 'alias de --exportar-pdf')
|
|
66
66
|
.option('--sin-pdf', 'no generar el PDF, aunque la config diga otra cosa')
|
|
67
|
-
.option('--descripcion <texto>', 'detalle del comprobante en el PDF; por defecto "
|
|
68
|
-
.option('--receptor-nombre <texto>', 'nombre o
|
|
67
|
+
.option('--descripcion <texto>', 'detalle del comprobante en el PDF; por defecto "Según detalle"')
|
|
68
|
+
.option('--receptor-nombre <texto>', 'nombre o razón social del receptor en el PDF')
|
|
69
69
|
.option('--receptor-domicilio <texto>', 'domicilio del receptor en el PDF')
|
|
70
70
|
.option('--previsualizar', 'mostrar el payload antes de emitir en ARCA')
|
|
71
71
|
.addOption(new Option('--emitir', 'emitir realmente en ARCA'));
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
/** Alias de otra opcion: se mencionan en la descripcion de la principal y no ocupan un renglon propio. */
|
|
74
|
+
const ALIAS_FLAGS = new Set([
|
|
75
|
+
'--asociado-punto-venta',
|
|
76
|
+
'--cfinal',
|
|
77
|
+
'--cm',
|
|
78
|
+
'--ir',
|
|
79
|
+
'--mda',
|
|
80
|
+
'--pd',
|
|
81
|
+
'--pdf',
|
|
82
|
+
'--ph',
|
|
83
|
+
'--pv',
|
|
84
|
+
'--sd',
|
|
85
|
+
'--sh',
|
|
86
|
+
'--vto',
|
|
87
|
+
]);
|
|
88
|
+
const OPTION_APPLIES = {
|
|
89
|
+
'--alicuota': (scope) => scope.letters.some((letter) => letter !== 'c'),
|
|
90
|
+
'--exento': (scope) => scope.letters.some((letter) => letter !== 'c'),
|
|
91
|
+
'--nogravado': (scope) => scope.letters.some((letter) => letter !== 'c'),
|
|
92
|
+
'--at': (scope) => scope.isNote,
|
|
93
|
+
'--apv': (scope) => scope.isNote,
|
|
94
|
+
'--ar': (scope) => scope.isNote,
|
|
95
|
+
'--ac': (scope) => scope.isNote,
|
|
96
|
+
'--acuit': (scope) => scope.isNote,
|
|
97
|
+
'--afecha': (scope) => scope.isNote,
|
|
98
|
+
'--periodo-desde': (scope) => scope.isNote && !scope.isElectronicCredit,
|
|
99
|
+
'--periodo-hasta': (scope) => scope.isNote && !scope.isElectronicCredit,
|
|
100
|
+
'--cbu': (scope) => scope.isElectronicCredit && !scope.isNote,
|
|
101
|
+
'--alias': (scope) => scope.isElectronicCredit && !scope.isNote,
|
|
102
|
+
'--transferencia': (scope) => scope.isElectronicCredit && !scope.isNote,
|
|
103
|
+
'--anulacion': (scope) => scope.isElectronicCredit && scope.isNote,
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Saca de la ayuda los alias y lo que no aplica a estos comprobantes. Solo se ocultan: siguen aceptandose y,
|
|
107
|
+
* si no aplican, la validacion de siempre explica por que.
|
|
108
|
+
*/
|
|
109
|
+
export function hideInapplicableBillingOptions(command, scope) {
|
|
110
|
+
for (const option of command.options) {
|
|
111
|
+
const flag = option.long ?? '';
|
|
112
|
+
const applies = OPTION_APPLIES[flag];
|
|
113
|
+
if (ALIAS_FLAGS.has(flag) || (applies && !applies(scope))) {
|
|
114
|
+
option.hideHelp();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -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,
|
|
@@ -44,4 +45,3 @@ export function writePdfOutcomes(before, after) {
|
|
|
44
45
|
writeTerminalOutput(blocks.join('\n'));
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
|
-
//# sourceMappingURL=billing.command.output.js.map
|
|
@@ -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';
|
|
@@ -17,7 +18,7 @@ function pickNumber(...values) {
|
|
|
17
18
|
function parseRateAmount(flagValue, raw) {
|
|
18
19
|
const result = parseArgentineAmount(raw);
|
|
19
20
|
if (!result.ok) {
|
|
20
|
-
throw new InputValidationError(`--alicuota "${flagValue}": el monto no es
|
|
21
|
+
throw new InputValidationError(`--alicuota "${flagValue}": el monto no es válido: ${result.reason}.`);
|
|
21
22
|
}
|
|
22
23
|
return result.value;
|
|
23
24
|
}
|
|
@@ -32,12 +33,12 @@ function parseIvaRateFlags(values) {
|
|
|
32
33
|
const withAmount = values.filter((value) => value.includes(':'));
|
|
33
34
|
if (withAmount.length === 0) {
|
|
34
35
|
if (values.length > 1) {
|
|
35
|
-
throw new InputValidationError('Para varias
|
|
36
|
+
throw new InputValidationError('Para varias alícuotas usá --alicuota TASA:MONTO en cada una, por ejemplo --alicuota general:1210 --alicuota reducida:552,50.');
|
|
36
37
|
}
|
|
37
38
|
return { ivaRate: values[0] };
|
|
38
39
|
}
|
|
39
40
|
if (withAmount.length !== values.length) {
|
|
40
|
-
throw new InputValidationError('No
|
|
41
|
+
throw new InputValidationError('No mezcles --alicuota TASA con --alicuota TASA:MONTO: usá una sola forma.');
|
|
41
42
|
}
|
|
42
43
|
return {
|
|
43
44
|
ivaRateAmounts: values.map((value) => {
|
|
@@ -60,13 +61,13 @@ function sumRateAmounts(rateAmounts, exemptAmount, untaxedAmount) {
|
|
|
60
61
|
*/
|
|
61
62
|
function resolveShouldEmit(options) {
|
|
62
63
|
if (options.cliEmit && options.cliPreview) {
|
|
63
|
-
throw new InputValidationError('
|
|
64
|
+
throw new InputValidationError('Usá --emitir o --previsualizar, pero no ambos a la vez.');
|
|
64
65
|
}
|
|
65
66
|
if (options.cliEmit !== undefined || options.cliPreview !== undefined) {
|
|
66
67
|
return options.cliEmit === true;
|
|
67
68
|
}
|
|
68
69
|
if (options.fileEmit === true && options.filePreview === true) {
|
|
69
|
-
throw new InputValidationError('En el archivo
|
|
70
|
+
throw new InputValidationError('En el archivo usá "emitir" o "previsualizar", pero no ambos en true.');
|
|
70
71
|
}
|
|
71
72
|
if (typeof options.fileEmit === 'boolean') {
|
|
72
73
|
return options.fileEmit;
|
|
@@ -80,7 +81,7 @@ function resolveShouldEmit(options) {
|
|
|
80
81
|
function resolvePdfFlag(commandOptions, fileInput) {
|
|
81
82
|
const exportPdf = commandOptions.exportarPdf === true || commandOptions.pdf === true;
|
|
82
83
|
if (exportPdf && commandOptions.sinPdf === true) {
|
|
83
|
-
throw new InputValidationError('
|
|
84
|
+
throw new InputValidationError('Usá --exportar-pdf o --sin-pdf, pero no ambos a la vez.');
|
|
84
85
|
}
|
|
85
86
|
if (exportPdf) {
|
|
86
87
|
return true;
|
|
@@ -94,7 +95,7 @@ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaul
|
|
|
94
95
|
const hasAssociatedShortcut = typeof commandOptions.ac === 'string';
|
|
95
96
|
const hasAssociatedType = typeof commandOptions.at === 'number';
|
|
96
97
|
if (hasAssociatedShortcut && hasAssociatedType) {
|
|
97
|
-
throw new InputValidationError('
|
|
98
|
+
throw new InputValidationError('Usá --ac o --at para identificar el comprobante asociado, pero no ambos a la vez.');
|
|
98
99
|
}
|
|
99
100
|
const associatedVoucherFromFlags = commandOptions.ar ||
|
|
100
101
|
commandOptions.apv ||
|
|
@@ -128,24 +129,31 @@ 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. Con
|
|
137
|
+
// consultarPadron=false el IVA de la config tambien es definitivo: 'default' haria consultar el padron igual.
|
|
138
|
+
const ivaConditionSource = explicitIvaCondition || (resolvedIvaCondition && defaults.lookupIvaConditionInPadron !== true)
|
|
139
|
+
? undefined
|
|
140
|
+
: resolvedIvaCondition
|
|
141
|
+
? 'default'
|
|
142
|
+
: 'missing';
|
|
135
143
|
if (typeof commandOptions.concepto === 'string' && conceptShortcut) {
|
|
136
|
-
throw new InputValidationError('
|
|
144
|
+
throw new InputValidationError('Usá --concepto o un flag corto de concepto (--cs, --cp, --csp), pero no ambos.');
|
|
137
145
|
}
|
|
138
146
|
if (typeof commandOptions.ivaReceptor === 'string' && typeof commandOptions.ir === 'string') {
|
|
139
|
-
throw new InputValidationError('
|
|
147
|
+
throw new InputValidationError('Usá --iva-receptor o --ir para indicar IVA receptor, pero no ambos.');
|
|
140
148
|
}
|
|
141
149
|
if ((typeof commandOptions.ivaReceptor === 'string' || typeof commandOptions.ir === 'string') && ivaShortcut) {
|
|
142
|
-
throw new InputValidationError('
|
|
150
|
+
throw new InputValidationError('Usá --iva-receptor, --ir o un flag corto --ir-*, pero no varios a la vez.');
|
|
143
151
|
}
|
|
144
152
|
if (!resolvedConcept) {
|
|
145
|
-
throw new InputValidationError('Falta el concepto.
|
|
153
|
+
throw new InputValidationError('Falta el concepto. Usá --concepto <tipo>, o bien --cs/--cp/--csp, o configurá uno por defecto con "arcli config establecer concepto servicios".');
|
|
146
154
|
}
|
|
147
|
-
if (!resolvedIvaCondition) {
|
|
148
|
-
throw new InputValidationError('Falta IVA receptor.
|
|
155
|
+
if (!resolvedIvaCondition && !willLookupPadron) {
|
|
156
|
+
throw new InputValidationError('Falta IVA receptor. Usá --iva-receptor <tipo>, --ir <tipo>, un flag --ir-*, o configurá uno por defecto con "arcli config establecer ivaReceptor consumidor-final".');
|
|
149
157
|
}
|
|
150
158
|
const associatedVoucherFromFile = fileInput?.comprobanteAsociado
|
|
151
159
|
? {
|
|
@@ -164,7 +172,7 @@ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaul
|
|
|
164
172
|
const sameCurrency = flagSameCurrency || (flagExchangeRate === undefined && fileInput?.mismaMoneda === true);
|
|
165
173
|
const explicitExchangeRate = flagExchangeRate ?? (flagSameCurrency ? undefined : fileInput?.cotizacionMoneda);
|
|
166
174
|
if (sameCurrency && typeof explicitExchangeRate === 'number') {
|
|
167
|
-
throw new InputValidationError('Con --misma-moneda la
|
|
175
|
+
throw new InputValidationError('Con --misma-moneda la cotización se toma de ARCA. Sacá --cotizacion-moneda o --cm.');
|
|
168
176
|
}
|
|
169
177
|
// La cotizacion por defecto de la config solo aplica a moneda extranjera sin --misma-moneda.
|
|
170
178
|
const exchangeRate = explicitExchangeRate ??
|
|
@@ -197,7 +205,7 @@ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaul
|
|
|
197
205
|
concept: resolvedConcept,
|
|
198
206
|
currencyCode,
|
|
199
207
|
documentNumber: documentIdentity.documentNumber ?? fileInput?.numeroDocumento,
|
|
200
|
-
documentType
|
|
208
|
+
documentType,
|
|
201
209
|
dryRun: !shouldEmit,
|
|
202
210
|
dueDay: pickNumber(commandOptions.dia, fileInput?.dia),
|
|
203
211
|
emit: shouldEmit,
|
|
@@ -207,7 +215,9 @@ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaul
|
|
|
207
215
|
? undefined
|
|
208
216
|
: (flagRates.ivaRate ?? fileInput?.alicuotaIva ?? (usesIvaRateDefault ? defaults.defaultIvaRate : undefined)),
|
|
209
217
|
ivaRateAmounts,
|
|
210
|
-
|
|
218
|
+
// Sin valor todavia: lo completa el padron antes de emitir (ver `ivaConditionSource`).
|
|
219
|
+
ivaCondition: resolvedIvaCondition ?? 'consumidor-final',
|
|
220
|
+
ivaConditionSource,
|
|
211
221
|
paymentDueDate: pickString(commandOptions.vencimiento, commandOptions.vto, fileInput?.vencimientoPago),
|
|
212
222
|
pdf: resolvePdfFlag(commandOptions, fileInput),
|
|
213
223
|
pdfDescription: pickString(commandOptions.descripcion, fileInput?.descripcion),
|
|
@@ -218,7 +228,8 @@ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaul
|
|
|
218
228
|
serviceEndDate: pickString(commandOptions.servicioHasta, commandOptions.sh, fileInput?.servicioHasta),
|
|
219
229
|
serviceStartDate: pickString(commandOptions.servicioDesde, commandOptions.sd, fileInput?.servicioDesde),
|
|
220
230
|
shortcut,
|
|
221
|
-
|
|
231
|
+
// Sin redondear: un monto con mas de 2 decimales es un error del schema, no se ajusta en silencio.
|
|
232
|
+
totalAmount,
|
|
222
233
|
transferMode: pickString(commandOptions.transferencia, fileInput?.transferencia),
|
|
223
234
|
untaxedAmount,
|
|
224
235
|
}),
|
|
@@ -228,30 +239,33 @@ function parseBillingCommandInputFromSource(command, shortcut, fileInput, defaul
|
|
|
228
239
|
export function parseBillingCommandPlan(command, shortcut, defaults = {}) {
|
|
229
240
|
const commandOptions = command.optsWithGlobals();
|
|
230
241
|
const inputFilePath = typeof commandOptions.cargar === 'string' ? commandOptions.cargar : undefined;
|
|
231
|
-
|
|
232
|
-
const
|
|
242
|
+
// Se lee sin asumir la forma: cada item se valida con `parseBillingJsonInput` (en un lote, por separado).
|
|
243
|
+
const source = inputFilePath ? readJsonFile(inputFilePath) : undefined;
|
|
244
|
+
const fileInputs = inputFilePath ? readBillingJsonItems(source) : [];
|
|
245
|
+
const isBatch = Array.isArray(source);
|
|
233
246
|
if (fileInputs.length === 0) {
|
|
234
247
|
const { __modeSource, ...input } = parseBillingCommandInputFromSource(command, shortcut, undefined, defaults);
|
|
235
248
|
return {
|
|
236
249
|
inputIndexes: [1],
|
|
237
250
|
inputs: [input],
|
|
238
251
|
invalidItems: [],
|
|
252
|
+
isBatch: false,
|
|
239
253
|
modeSource: __modeSource,
|
|
240
254
|
total: 1,
|
|
241
255
|
};
|
|
242
256
|
}
|
|
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 };
|
|
257
|
+
// Un objeto suelto falla como siempre. En un lote (un array, aunque tenga un solo elemento) se leen todos
|
|
258
|
+
// y se juntan los errores, para informarlos de una vez en lugar de cortar en el primero.
|
|
259
|
+
if (!isBatch) {
|
|
260
|
+
const { __modeSource, ...input } = parseBillingCommandInputFromSource(command, shortcut, parseBillingJsonInput(fileInputs[0]), defaults);
|
|
261
|
+
return { inputIndexes: [1], inputs: [input], invalidItems: [], isBatch: false, modeSource: __modeSource, total: 1 };
|
|
248
262
|
}
|
|
249
263
|
const parsed = [];
|
|
250
264
|
const inputIndexes = [];
|
|
251
265
|
const invalidItems = [];
|
|
252
266
|
fileInputs.forEach((fileInput, position) => {
|
|
253
267
|
try {
|
|
254
|
-
parsed.push(parseBillingCommandInputFromSource(command, shortcut, fileInput, defaults));
|
|
268
|
+
parsed.push(parseBillingCommandInputFromSource(command, shortcut, parseBillingJsonInput(fileInput), defaults));
|
|
255
269
|
inputIndexes.push(position + 1);
|
|
256
270
|
}
|
|
257
271
|
catch (error) {
|
|
@@ -267,6 +281,7 @@ export function parseBillingCommandPlan(command, shortcut, defaults = {}) {
|
|
|
267
281
|
inputIndexes,
|
|
268
282
|
inputs: parsed.map(({ __modeSource: _modeSource, ...input }) => input),
|
|
269
283
|
invalidItems,
|
|
284
|
+
isBatch: true,
|
|
270
285
|
modeSource,
|
|
271
286
|
total: fileInputs.length,
|
|
272
287
|
};
|
|
@@ -281,4 +296,3 @@ export function parseBillingCommandInputs(command, shortcut, defaults = {}) {
|
|
|
281
296
|
export function parseBillingCommandInput(command, shortcut, defaults = {}) {
|
|
282
297
|
return parseBillingCommandInputs(command, shortcut, defaults)[0];
|
|
283
298
|
}
|
|
284
|
-
//# sourceMappingURL=billing.command.parser.js.map
|
|
@@ -29,8 +29,12 @@ export const defaultPdfStepDependencies = {
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
|
+
/** Datos que solo van en el PDF y pasó quien factura; lo que completó el padrón no cuenta. */
|
|
32
33
|
function hasPdfOnlyData(input) {
|
|
33
|
-
|
|
34
|
+
const fromPadron = input?.receiverFromPadron ?? [];
|
|
35
|
+
return Boolean(input?.pdfDescription ||
|
|
36
|
+
(input?.receiverName && !fromPadron.includes('name')) ||
|
|
37
|
+
(input?.receiverAddress && !fromPadron.includes('address')));
|
|
34
38
|
}
|
|
35
39
|
async function resolveDecisions(options, deps) {
|
|
36
40
|
const decisions = options.results.map((result, index) => canHavePdf(result)
|
|
@@ -44,13 +48,13 @@ async function resolveDecisions(options, deps) {
|
|
|
44
48
|
if (pending === 0) {
|
|
45
49
|
return decisions;
|
|
46
50
|
}
|
|
47
|
-
const answer = await deps.confirm(pending === 1 ? '¿Generamos el PDF del comprobante?' : `¿Generamos los PDFs de los ${pending} comprobantes?`, pending === 1 ? '
|
|
51
|
+
const answer = await deps.confirm(pending === 1 ? '¿Generamos el PDF del comprobante?' : `¿Generamos los PDFs de los ${pending} comprobantes?`, pending === 1 ? 'Sí, generar el PDF' : 'Sí, generar los PDFs', 'No');
|
|
48
52
|
return decisions.map((decision) => (decision === 'preguntar' ? (answer ? 'generar' : 'omitir') : decision));
|
|
49
53
|
}
|
|
50
54
|
/** Si falta el plugin, en una terminal se ofrece instalarlo; sin terminal nunca se descarga solo. */
|
|
51
|
-
async function
|
|
55
|
+
export async function loadPdfRenderer(plugin, interactive, deps) {
|
|
52
56
|
if (!plugin.getStatus().installed && interactive) {
|
|
53
|
-
const install = await deps.confirm('Para generar PDFs hay que descargar un componente (~160 MB, o ~360 MB si no
|
|
57
|
+
const install = await deps.confirm('Para generar PDFs hay que descargar un componente (~160 MB, o ~360 MB si no tenés Chrome). ¿Instalarlo ahora?', 'Sí, instalar', 'No');
|
|
54
58
|
if (!install) {
|
|
55
59
|
throw new PdfError('PDF_PLUGIN_MISSING', 'No se instalo el plugin de PDF.', {
|
|
56
60
|
suggestion: PDF_INSTALL_SUGGESTION,
|
|
@@ -97,7 +101,7 @@ export async function attachPdfs(options, defaultDeps = defaultPdfStepDependenci
|
|
|
97
101
|
try {
|
|
98
102
|
// Antes de descargar nada: sin los datos del emisor no se puede armar ningun PDF.
|
|
99
103
|
resolvePdfIssuer(options.config, options.results[targets[0]].voucherKind.letter);
|
|
100
|
-
const renderer = await
|
|
104
|
+
const renderer = await loadPdfRenderer(deps.createPlugin(options.config), options.interactive, deps);
|
|
101
105
|
const folder = deps.resolveFolder(options.config);
|
|
102
106
|
for (const index of targets) {
|
|
103
107
|
const spinner = startSpinner('Generando PDF...');
|
|
@@ -142,4 +146,3 @@ export async function attachPdfs(options, defaultDeps = defaultPdfStepDependenci
|
|
|
142
146
|
return result;
|
|
143
147
|
});
|
|
144
148
|
}
|
|
145
|
-
//# sourceMappingURL=billing.command.pdf.js.map
|
|
@@ -2,27 +2,60 @@ import { BillingService } from '../../modules/billing/billing.service.js';
|
|
|
2
2
|
import { getVoucherKindByShortcut } from '../../modules/billing/voucher-kind-map.js';
|
|
3
3
|
import { ArcaBillingGateway } from '../../services/arca/arca-billing.gateway.js';
|
|
4
4
|
import { ArcaClientFactory } from '../../services/arca/arca-client.factory.js';
|
|
5
|
-
import { ArcaContextResolver } from '../../services/arca/arca-context.resolver.js';
|
|
6
5
|
import { ArcaFceObligationGateway } from '../../services/arca/arca-fce-obligation.gateway.js';
|
|
6
|
+
import { ArcaPadronGateway } from '../../services/arca/arca-padron.gateway.js';
|
|
7
|
+
import { certificateWarnings, resolveArcaRuntime } from '../arca-runtime.js';
|
|
8
|
+
import { getGlobalOptions, registerGlobalOptions } from '../global-options.js';
|
|
7
9
|
import { startSpinner } from '../spinner.js';
|
|
8
|
-
import { emitBatch,
|
|
10
|
+
import { emitBatch, prepareBatch } from './billing.command.batch.js';
|
|
9
11
|
import { runInteractiveBillingPreview } from './billing.command.interactive-preview.js';
|
|
10
12
|
import { writeBillingCommandResults, writePdfOutcomes } from './billing.command.output.js';
|
|
11
13
|
import { parseBillingCommandPlan, registerBillingOptions } from './billing.command.parser.js';
|
|
12
14
|
import { attachPdfs } from './billing.command.pdf.js';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
.
|
|
15
|
+
/** Exit code cuando ARCA rechaza algun comprobante: la operacion corrio bien, pero no hay CAE. */
|
|
16
|
+
export const REJECTED_EXIT_CODE = 2;
|
|
17
|
+
/** 2 si ARCA rechazo alguno de los comprobantes emitidos; si no, no se toca (queda en 0). */
|
|
18
|
+
export function setExitCodeForResults(results) {
|
|
19
|
+
if (results.some((result) => !result.dryRun && result.response.status === 'rechazado')) {
|
|
20
|
+
process.exitCode = REJECTED_EXIT_CODE;
|
|
21
|
+
}
|
|
19
22
|
}
|
|
20
23
|
export function registerBillingCommandOptions(command) {
|
|
21
24
|
registerGlobalOptions(command);
|
|
22
25
|
registerBillingOptions(command);
|
|
23
26
|
}
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
/** Los defaults de la config que completan lo que no viene por flags ni por JSON. */
|
|
28
|
+
export function resolveBillingCommandDefaults(config) {
|
|
29
|
+
return {
|
|
30
|
+
defaultCbu: config.cbu,
|
|
31
|
+
defaultCbuAlias: config.aliasCbu,
|
|
32
|
+
defaultConcept: config.conceptoPorDefecto,
|
|
33
|
+
defaultCurrencyCode: config.monedaPorDefecto,
|
|
34
|
+
defaultEmit: config.output.emitirPorDefecto,
|
|
35
|
+
defaultExchangeRate: config.cotizacionPorDefecto,
|
|
36
|
+
defaultIvaCondition: config.ivaReceptorPorDefecto,
|
|
37
|
+
defaultIvaRate: config.alicuotaPorDefecto,
|
|
38
|
+
lookupIvaConditionInPadron: config.consultarPadron !== false,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Imprime los resultados con su PDF, segun la config `pdf` o `--exportar-pdf`. Se usa con el lote completo y
|
|
43
|
+
* con los ya emitidos de un lote que se corto: esos tambien tienen CAE y merecen su PDF.
|
|
44
|
+
*/
|
|
45
|
+
export async function writeResultsWithPdfs(results, options) {
|
|
46
|
+
const pdfOptions = {
|
|
47
|
+
config: options.config,
|
|
48
|
+
inputs: options.inputs.slice(0, results.length),
|
|
49
|
+
interactive: options.interactive,
|
|
50
|
+
results,
|
|
51
|
+
};
|
|
52
|
+
// En JSON el PDF va dentro del mismo resultado; en texto primero se ve el CAE y despues se pregunta.
|
|
53
|
+
if (options.output.outputJson) {
|
|
54
|
+
writeBillingCommandResults(await attachPdfs(pdfOptions), options.output);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
writeBillingCommandResults(results, options.output);
|
|
58
|
+
writePdfOutcomes(results, await attachPdfs(pdfOptions));
|
|
26
59
|
}
|
|
27
60
|
async function resolveFceWarnings(inputs, service, gateway) {
|
|
28
61
|
const warnings = [];
|
|
@@ -32,34 +65,44 @@ async function resolveFceWarnings(inputs, service, gateway) {
|
|
|
32
65
|
}
|
|
33
66
|
return warnings;
|
|
34
67
|
}
|
|
35
|
-
export async function executeBillingCommand(command, shortcut) {
|
|
68
|
+
export async function executeBillingCommand(command, shortcut, options = {}) {
|
|
36
69
|
const globalOptions = getGlobalOptions(command);
|
|
37
70
|
let spinner = null;
|
|
38
71
|
const voucherKind = getVoucherKindByShortcut(shortcut);
|
|
39
72
|
try {
|
|
40
|
-
const runtime =
|
|
41
|
-
const plan = parseBillingCommandPlan(command, shortcut,
|
|
42
|
-
defaultCbu: runtime.config.cbu,
|
|
43
|
-
defaultCbuAlias: runtime.config.aliasCbu,
|
|
44
|
-
defaultConcept: runtime.config.conceptoPorDefecto,
|
|
45
|
-
defaultCurrencyCode: runtime.config.monedaPorDefecto,
|
|
46
|
-
defaultEmit: runtime.config.output.emitirPorDefecto,
|
|
47
|
-
defaultExchangeRate: runtime.config.cotizacionPorDefecto,
|
|
48
|
-
defaultIvaCondition: runtime.config.ivaReceptorPorDefecto,
|
|
49
|
-
defaultIvaRate: runtime.config.alicuotaPorDefecto,
|
|
50
|
-
});
|
|
73
|
+
const runtime = resolveArcaRuntime(globalOptions);
|
|
74
|
+
const plan = parseBillingCommandPlan(command, shortcut, resolveBillingCommandDefaults(runtime.config));
|
|
51
75
|
const service = new BillingService();
|
|
52
76
|
const arca = new ArcaClientFactory().create(runtime);
|
|
53
77
|
const gateway = new ArcaBillingGateway(arca);
|
|
54
78
|
const useRaw = typeof globalOptions.bruto === 'boolean' ? globalOptions.bruto : runtime.outputRaw;
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
79
|
+
const padronGateway = new ArcaPadronGateway(arca);
|
|
80
|
+
// En un lote, un fallo del padron o de la cotizacion sale con su indice, junto a los de validacion.
|
|
81
|
+
const prepared = await prepareBatch({
|
|
82
|
+
inputs: plan.inputs,
|
|
83
|
+
plan,
|
|
84
|
+
resolve: async (input) => {
|
|
85
|
+
const resolution = await service.resolveIvaConditionFromPadron(input, padronGateway);
|
|
86
|
+
return {
|
|
87
|
+
input: await service.resolveExchangeRate(resolution.input, gateway),
|
|
88
|
+
warnings: resolution.warnings,
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
validate: ({ input }) => {
|
|
92
|
+
service.buildVoucherPayload(input, runtime);
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
const plannedInputs = prepared.map(({ input }) => input);
|
|
96
|
+
const padronWarnings = prepared.map(({ warnings }) => warnings);
|
|
97
|
+
const fceWarnings = runtime.config.verificarFce
|
|
61
98
|
? await resolveFceWarnings(plannedInputs, service, new ArcaFceObligationGateway(arca))
|
|
62
99
|
: [];
|
|
100
|
+
const warnings = plannedInputs.map((_input, position) => [
|
|
101
|
+
...certificateWarnings(runtime),
|
|
102
|
+
...(options.extraWarnings ?? []),
|
|
103
|
+
...(padronWarnings[position] ?? []),
|
|
104
|
+
...(fceWarnings[position] ?? []),
|
|
105
|
+
]);
|
|
63
106
|
const preview = await runInteractiveBillingPreview({
|
|
64
107
|
inputs: plannedInputs,
|
|
65
108
|
modeSource: plan.modeSource,
|
|
@@ -77,39 +120,33 @@ export async function executeBillingCommand(command, shortcut) {
|
|
|
77
120
|
if (spinner) {
|
|
78
121
|
spinner.text = inputs.length > 1 ? `Procesando ${inputs.length} comprobantes...` : 'Procesando comprobante...';
|
|
79
122
|
}
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
123
|
+
const deliveryOptions = {
|
|
124
|
+
config: runtime.config,
|
|
125
|
+
inputs,
|
|
126
|
+
interactive: !runtime.outputJson && Boolean(process.stdin.isTTY && process.stdout.isTTY),
|
|
127
|
+
output: {
|
|
128
|
+
batch: plan.isBatch,
|
|
129
|
+
environment: runtime.environment,
|
|
130
|
+
outputJson: runtime.outputJson,
|
|
131
|
+
previewShown,
|
|
132
|
+
raw: useRaw,
|
|
133
|
+
},
|
|
85
134
|
};
|
|
86
135
|
const results = await emitBatch({
|
|
87
136
|
emit: (input, position) => service.execute({ gateway, input, runtime, warnings: warnings[position] }),
|
|
88
137
|
inputs,
|
|
89
|
-
onPartialResults: (partial) => {
|
|
138
|
+
onPartialResults: async (partial) => {
|
|
90
139
|
spinner?.stop();
|
|
91
|
-
|
|
140
|
+
await writeResultsWithPdfs(partial, deliveryOptions);
|
|
92
141
|
},
|
|
93
142
|
plan,
|
|
94
143
|
});
|
|
95
144
|
spinner?.stop();
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
inputs,
|
|
99
|
-
interactive: !runtime.outputJson && Boolean(process.stdin.isTTY && process.stdout.isTTY),
|
|
100
|
-
results,
|
|
101
|
-
};
|
|
102
|
-
// En JSON el PDF va dentro del mismo resultado; en texto primero se ve el CAE y despues se pregunta.
|
|
103
|
-
if (runtime.outputJson) {
|
|
104
|
-
writeBillingCommandResults(await attachPdfs(pdfOptions), outputOptions);
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
writeBillingCommandResults(results, outputOptions);
|
|
108
|
-
writePdfOutcomes(results, await attachPdfs(pdfOptions));
|
|
145
|
+
setExitCodeForResults(results);
|
|
146
|
+
await writeResultsWithPdfs(results, deliveryOptions);
|
|
109
147
|
}
|
|
110
148
|
catch (error) {
|
|
111
149
|
spinner?.stop();
|
|
112
150
|
throw error;
|
|
113
151
|
}
|
|
114
152
|
}
|
|
115
|
-
//# sourceMappingURL=billing.command.shared.js.map
|