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
|
@@ -13,28 +13,27 @@ export function resolveAssociatedPeriod(input, voucherKind, billingDate) {
|
|
|
13
13
|
}
|
|
14
14
|
const label = formatVoucherLabel(voucherKind);
|
|
15
15
|
if (!voucherKind.requiresAssociatedVoucher) {
|
|
16
|
-
throw new InputValidationError(`La ${label} no usa
|
|
16
|
+
throw new InputValidationError(`La ${label} no usa período asociado: solo aplica a notas de crédito o débito.`);
|
|
17
17
|
}
|
|
18
18
|
if (voucherKind.isElectronicCredit) {
|
|
19
|
-
throw new InputValidationError(`La ${label} no admite
|
|
19
|
+
throw new InputValidationError(`La ${label} no admite período asociado: ARCA solo lo acepta en notas comunes. Usá el comprobante asociado (--ac).`);
|
|
20
20
|
}
|
|
21
21
|
if (input.associatedVoucher) {
|
|
22
|
-
throw new InputValidationError('
|
|
22
|
+
throw new InputValidationError('Usá un comprobante asociado (--ac/--at) o un período asociado (--periodo-desde/--periodo-hasta), pero no ambos.');
|
|
23
23
|
}
|
|
24
24
|
if (!period.desde || !period.hasta) {
|
|
25
|
-
throw new InputValidationError('El
|
|
25
|
+
throw new InputValidationError('El período asociado requiere ambas fechas: --periodo-desde y --periodo-hasta.');
|
|
26
26
|
}
|
|
27
27
|
const FchDesde = parseArgentineDateInputAsArcaDate(period.desde);
|
|
28
28
|
const FchHasta = parseArgentineDateInputAsArcaDate(period.hasta);
|
|
29
29
|
if (FchDesde < MINIMUM_PERIOD_DATE) {
|
|
30
|
-
throw new InputValidationError('El
|
|
30
|
+
throw new InputValidationError('El período asociado tiene que ser posterior al 01/01/2006.');
|
|
31
31
|
}
|
|
32
32
|
if (FchDesde > FchHasta) {
|
|
33
|
-
throw new InputValidationError('En el
|
|
33
|
+
throw new InputValidationError('En el período asociado, --periodo-desde no puede ser posterior a --periodo-hasta.');
|
|
34
34
|
}
|
|
35
35
|
if (FchHasta > billingDate) {
|
|
36
|
-
throw new InputValidationError(`El
|
|
36
|
+
throw new InputValidationError(`El período asociado no puede terminar después de la fecha de la ${label} (${formatArcaDateAsArgentineDate(billingDate)}).`);
|
|
37
37
|
}
|
|
38
38
|
return { FchDesde, FchHasta };
|
|
39
39
|
}
|
|
40
|
-
//# sourceMappingURL=billing.associated-period.js.map
|
|
@@ -20,13 +20,13 @@ export function resolveAssociatedVouchers(options) {
|
|
|
20
20
|
const associatedVoucherType = associatedVoucher?.tipo ?? resolveAssociatedVoucherType(associatedVoucher?.shortcut, requireVoucherKind);
|
|
21
21
|
const associatedVoucherKind = resolveAssociatedVoucherKind(associatedVoucher, requireVoucherKind);
|
|
22
22
|
if (!associatedVoucher?.numero || !associatedVoucher.puntoVenta || !associatedVoucherType || !associatedCuit) {
|
|
23
|
-
throw new InputValidationError(`El comprobante ${formatVoucherLabel(voucherKind)} requiere comprobante asociado.
|
|
23
|
+
throw new InputValidationError(`El comprobante ${formatVoucherLabel(voucherKind)} requiere comprobante asociado. Usá --ac o --at, junto con --apv o --asociado-punto-venta, --ar y --acuit${voucherKind.isElectronicCredit ? '' : ', o un período con --periodo-desde y --periodo-hasta'}.`);
|
|
24
24
|
}
|
|
25
25
|
if (associatedVoucherKind) {
|
|
26
26
|
validateAssociatedVoucherKind(associatedVoucherKind, voucherKind);
|
|
27
27
|
}
|
|
28
28
|
if (voucherKind.isElectronicCredit && associatedCuit !== String(emitterCuit)) {
|
|
29
|
-
throw new InputValidationError(`En la ${formatVoucherLabel(voucherKind)} el comprobante asociado tiene que ser del CUIT emisor (${emitterCuit}).
|
|
29
|
+
throw new InputValidationError(`En la ${formatVoucherLabel(voucherKind)} el comprobante asociado tiene que ser del CUIT emisor (${emitterCuit}). Sacá --acuit o usá ese CUIT.`);
|
|
30
30
|
}
|
|
31
31
|
const associatedDate = resolveAssociatedVoucherDate(associatedVoucher.fecha, billingDate, voucherKind);
|
|
32
32
|
return [
|
|
@@ -47,14 +47,14 @@ function resolveAssociatedVoucherKind(associatedVoucher, requireVoucherKind) {
|
|
|
47
47
|
const byShortcut = associatedVoucher?.shortcut ? requireVoucherKind(associatedVoucher.shortcut) : undefined;
|
|
48
48
|
const byType = associatedVoucher?.tipo ? (getVoucherKindByArcaType(associatedVoucher.tipo) ?? undefined) : undefined;
|
|
49
49
|
if (byShortcut && associatedVoucher?.tipo && byShortcut.arcaType !== associatedVoucher.tipo) {
|
|
50
|
-
throw new InputValidationError(`El atajo "${associatedVoucher.shortcut}" es el tipo ${byShortcut.arcaType}, no el ${associatedVoucher.tipo}.
|
|
50
|
+
throw new InputValidationError(`El atajo "${associatedVoucher.shortcut}" es el tipo ${byShortcut.arcaType}, no el ${associatedVoucher.tipo}. Usá uno solo para el comprobante asociado.`);
|
|
51
51
|
}
|
|
52
52
|
return byShortcut ?? byType;
|
|
53
53
|
}
|
|
54
54
|
function resolveAssociatedVoucherDate(rawDate, billingDate, voucherKind) {
|
|
55
55
|
if (!rawDate) {
|
|
56
56
|
if (voucherKind.isElectronicCredit) {
|
|
57
|
-
throw new InputValidationError(`La ${formatVoucherLabel(voucherKind)} requiere la fecha del comprobante asociado.
|
|
57
|
+
throw new InputValidationError(`La ${formatVoucherLabel(voucherKind)} requiere la fecha del comprobante asociado. Usá --afecha <fecha>.`);
|
|
58
58
|
}
|
|
59
59
|
return undefined;
|
|
60
60
|
}
|
|
@@ -78,7 +78,6 @@ function validateAssociatedVoucherKind(associatedVoucherKind, voucherKind) {
|
|
|
78
78
|
throw new InputValidationError(`El comprobante asociado debe usar la misma letra que ${formatVoucherLabel(voucherKind)}.`);
|
|
79
79
|
}
|
|
80
80
|
if (associatedVoucherKind.isElectronicCredit !== voucherKind.isElectronicCredit) {
|
|
81
|
-
throw new InputValidationError(`El comprobante asociado debe pertenecer a la misma
|
|
81
|
+
throw new InputValidationError(`El comprobante asociado debe pertenecer a la misma categoría electrónica que ${formatVoucherLabel(voucherKind)}.`);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
//# sourceMappingURL=billing.associated-vouchers.js.map
|
|
@@ -12,7 +12,13 @@ export function describeBatchItemError(error) {
|
|
|
12
12
|
export class BatchValidationError extends AppError {
|
|
13
13
|
constructor(errors, total) {
|
|
14
14
|
const lines = errors.map((item) => `#${item.index}: ${item.message}`);
|
|
15
|
-
super([
|
|
15
|
+
super([
|
|
16
|
+
errors.length === 1
|
|
17
|
+
? `1 de ${total} ${total === 1 ? 'comprobante' : 'comprobantes'} del lote tiene errores. No se emitió ninguno.`
|
|
18
|
+
: `${errors.length} de ${total} comprobantes del lote tienen errores. No se emitió ninguno.`,
|
|
19
|
+
'',
|
|
20
|
+
...lines,
|
|
21
|
+
].join('\n'), {
|
|
16
22
|
code: 'BATCH_VALIDATION_ERROR',
|
|
17
23
|
details: { comprobantes: errors.map((item) => ({ error: item.message, indice: item.index })) },
|
|
18
24
|
});
|
|
@@ -25,13 +31,15 @@ export class BatchValidationError extends AppError {
|
|
|
25
31
|
*/
|
|
26
32
|
export class BatchEmissionError extends AppError {
|
|
27
33
|
constructor(options) {
|
|
28
|
-
const pending = Array.from({ length: options.total - options.failedIndex }, (_, offset) => options.failedIndex + 1 + offset);
|
|
29
34
|
const uncertain = options.cause instanceof EmissionUncertainError;
|
|
35
|
+
// Si el fallo fue antes de la llamada que emite (login, ultimo numero), ese comprobante tampoco se proceso.
|
|
36
|
+
const firstPending = uncertain ? options.failedIndex + 1 : options.failedIndex;
|
|
37
|
+
const pending = Array.from({ length: options.total - firstPending + 1 }, (_, offset) => firstPending + offset);
|
|
30
38
|
super([
|
|
31
|
-
`El lote se
|
|
39
|
+
`El lote se interrumpió en el comprobante #${options.failedIndex}: ${describeBatchItemError(options.cause)}`,
|
|
32
40
|
`Procesados: ${options.emitted} de ${options.total}.${pending.length > 0 ? ` Sin procesar: ${pending.map((index) => `#${index}`).join(', ')}.` : ''}`,
|
|
33
41
|
...(uncertain
|
|
34
|
-
? [`El #${options.failedIndex} puede haberse emitido:
|
|
42
|
+
? [`El #${options.failedIndex} puede haberse emitido: verificalo con "arcli ultimos" antes de reintentarlo.`]
|
|
35
43
|
: []),
|
|
36
44
|
].join('\n'), {
|
|
37
45
|
code: 'BATCH_EMISSION_ERROR',
|
|
@@ -46,4 +54,3 @@ export class BatchEmissionError extends AppError {
|
|
|
46
54
|
this.name = 'BatchEmissionError';
|
|
47
55
|
}
|
|
48
56
|
}
|
|
49
|
-
//# sourceMappingURL=billing.batch.js.map
|
|
@@ -20,7 +20,7 @@ export function resolveBillingCurrencyFields(input, billingDate, today) {
|
|
|
20
20
|
throw new InputValidationError('--misma-moneda solo aplica a comprobantes en moneda extranjera.');
|
|
21
21
|
}
|
|
22
22
|
if (typeof input.exchangeRate === 'number' && input.exchangeRate !== DEFAULT_EXCHANGE_RATE) {
|
|
23
|
-
throw new InputValidationError('En pesos la
|
|
23
|
+
throw new InputValidationError('En pesos la cotización debe ser 1. Sacá --cotizacion-moneda o usá --cm 1.');
|
|
24
24
|
}
|
|
25
25
|
// ARCA rechaza CanMisMonExt cuando MonId = PES (error 10241).
|
|
26
26
|
return {
|
|
@@ -30,10 +30,10 @@ export function resolveBillingCurrencyFields(input, billingDate, today) {
|
|
|
30
30
|
}
|
|
31
31
|
if (input.sameCurrency) {
|
|
32
32
|
if (billingDate < today) {
|
|
33
|
-
throw new InputValidationError('Con --misma-moneda la fecha del comprobante no puede ser anterior a hoy: ARCA exige la
|
|
33
|
+
throw new InputValidationError('Con --misma-moneda la fecha del comprobante no puede ser anterior a hoy: ARCA exige la cotización oficial de ese día y solo se puede consultar la vigente.');
|
|
34
34
|
}
|
|
35
35
|
if (typeof input.exchangeRate !== 'number') {
|
|
36
|
-
throw new InputValidationError(`No se pudo obtener la
|
|
36
|
+
throw new InputValidationError(`No se pudo obtener la cotización oficial de ${inputCurrencyCode} desde ARCA.`);
|
|
37
37
|
}
|
|
38
38
|
return {
|
|
39
39
|
CanMisMonExt: 'S',
|
|
@@ -42,7 +42,7 @@ export function resolveBillingCurrencyFields(input, billingDate, today) {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
if (typeof input.exchangeRate !== 'number' || input.exchangeRate === DEFAULT_EXCHANGE_RATE) {
|
|
45
|
-
throw new InputValidationError(`Falta la
|
|
45
|
+
throw new InputValidationError(`Falta la cotización de ${inputCurrencyCode}. Usá --cotizacion-moneda o --cm, o --misma-moneda si el pago se hace en ${inputCurrencyCode}.`);
|
|
46
46
|
}
|
|
47
47
|
return {
|
|
48
48
|
CanMisMonExt: 'N',
|
|
@@ -50,4 +50,3 @@ export function resolveBillingCurrencyFields(input, billingDate, today) {
|
|
|
50
50
|
MonId: currencyCode,
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
//# sourceMappingURL=billing.currency.js.map
|
|
@@ -1,19 +1,36 @@
|
|
|
1
1
|
import { calendarDateToArcaDate, formatDateAsArcaDate, maxArcaDate, parseArgentineDateInputAsArcaDate, toArgentineCalendarDate, } from '../../lib/dates/arca-date.js';
|
|
2
|
+
import { InputValidationError } from '../../lib/errors/app-error.js';
|
|
2
3
|
import { isElectronicCreditInvoice } from './billing.fce.js';
|
|
3
4
|
import { ensureDateOrder, validateBillingDateWindow, validateConceptDateInputs, validatePaymentDueDate, } from './billing.validation.js';
|
|
4
|
-
|
|
5
|
+
const MONTH_NAMES = [
|
|
6
|
+
'enero',
|
|
7
|
+
'febrero',
|
|
8
|
+
'marzo',
|
|
9
|
+
'abril',
|
|
10
|
+
'mayo',
|
|
11
|
+
'junio',
|
|
12
|
+
'julio',
|
|
13
|
+
'agosto',
|
|
14
|
+
'septiembre',
|
|
15
|
+
'octubre',
|
|
16
|
+
'noviembre',
|
|
17
|
+
'diciembre',
|
|
18
|
+
];
|
|
19
|
+
/**
|
|
20
|
+
* Fecha ARCA del proximo `dueDay`, contando desde hoy en Argentina. La cuenta va en UTC para no cruzar zonas y
|
|
21
|
+
* arranca del dia 1: sumar un mes al 31/03 daria el 1/05. Si el dia no existe en ese mes (31 en abril), es un error.
|
|
22
|
+
*/
|
|
5
23
|
function resolvePaymentDateFromDueDay(dueDay, now = new Date()) {
|
|
6
24
|
const today = toArgentineCalendarDate(now);
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
25
|
+
const monthOffset = dueDay < today.day ? 1 : 0;
|
|
26
|
+
const firstOfMonth = new Date(Date.UTC(today.year, today.month - 1 + monthOffset, 1));
|
|
27
|
+
const year = firstOfMonth.getUTCFullYear();
|
|
28
|
+
const monthIndex = firstOfMonth.getUTCMonth();
|
|
29
|
+
const daysInMonth = new Date(Date.UTC(year, monthIndex + 1, 0)).getUTCDate();
|
|
30
|
+
if (dueDay > daysInMonth) {
|
|
31
|
+
throw new InputValidationError(`--dia ${dueDay} no existe en ${MONTH_NAMES[monthIndex]} de ${year}. Indicá la fecha exacta con --servicio-hasta.`);
|
|
10
32
|
}
|
|
11
|
-
|
|
12
|
-
return calendarDateToArcaDate({
|
|
13
|
-
day: paymentDate.getUTCDate(),
|
|
14
|
-
month: paymentDate.getUTCMonth() + 1,
|
|
15
|
-
year: paymentDate.getUTCFullYear(),
|
|
16
|
-
});
|
|
33
|
+
return calendarDateToArcaDate({ day: dueDay, month: monthIndex + 1, year });
|
|
17
34
|
}
|
|
18
35
|
/**
|
|
19
36
|
* Que fechas lleva el comprobante:
|
|
@@ -54,4 +71,3 @@ export function resolveBillingDateRange(input, voucherKind, today = formatDateAs
|
|
|
54
71
|
validatePaymentDueDate(paymentDueDate, minimumPaymentDueDate);
|
|
55
72
|
return { billingDate, paymentDueDate, ...serviceDates };
|
|
56
73
|
}
|
|
57
|
-
//# sourceMappingURL=billing.date-range.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { keyValuePanel, renderKeyValueRows, renderTable, resolveKeyValueLabelWidth, statusPanel, testingBanner, toneText, } from '../../ui/index.js';
|
|
2
|
+
import { formatVoucherNumber } from '../vouchers/voucher-history.presenter.js';
|
|
2
3
|
import { resolveIvaRateLabel } from './billing.amounts.js';
|
|
3
4
|
import { formatConceptLabel, formatCurrencyLabel, formatDateLabel, formatDecimalLabel, formatDocumentTypeLabel, formatIvaConditionLabel, formatMoneyLabel, formatNumericLabel, formatTaxIdLabel, } from './billing.labels.js';
|
|
4
5
|
import { getVoucherKindByArcaType } from './voucher-kind-map.js';
|
|
@@ -47,7 +48,7 @@ function formatIvaRows(iva) {
|
|
|
47
48
|
}
|
|
48
49
|
const label = (aliquotId) => resolveIvaRateLabel(aliquotId) ?? String(aliquotId);
|
|
49
50
|
if (iva.length === 1 && iva[0]) {
|
|
50
|
-
return [['
|
|
51
|
+
return [['Alícuota IVA', label(iva[0].Id)]];
|
|
51
52
|
}
|
|
52
53
|
return iva.map((item) => [`IVA ${label(item.Id)}`, `${formatMoneyLabel(item.Importe)} sobre ${formatMoneyLabel(item.BaseImp)}`]);
|
|
53
54
|
}
|
|
@@ -59,7 +60,7 @@ function formatFriendlyPayloadRows(result) {
|
|
|
59
60
|
['Fecha del comprobante', formatDateLabel(payload.CbteFch)],
|
|
60
61
|
['Tipo de documento', formatDocumentTypeLabel(payload.DocTipo)],
|
|
61
62
|
[
|
|
62
|
-
'
|
|
63
|
+
'Número de documento',
|
|
63
64
|
typeof payload.DocNro === 'number'
|
|
64
65
|
? payload.DocNro === 0
|
|
65
66
|
? 'Sin especificar'
|
|
@@ -68,9 +69,13 @@ function formatFriendlyPayloadRows(result) {
|
|
|
68
69
|
: formatNumericLabel(payload.DocNro)
|
|
69
70
|
: 'No informado',
|
|
70
71
|
],
|
|
71
|
-
['
|
|
72
|
+
...(result.receiver?.name ? [['Receptor', result.receiver.name]] : []),
|
|
73
|
+
[
|
|
74
|
+
'IVA receptor',
|
|
75
|
+
`${formatIvaConditionLabel(payload.CondicionIVAReceptorId)}${result.receiver?.ivaConditionFromPadron ? ' (padrón)' : ''}`,
|
|
76
|
+
],
|
|
72
77
|
['Moneda', formatCurrencyLabel(payload.MonId)],
|
|
73
|
-
['
|
|
78
|
+
['Cotización', formatDecimalLabel(payload.MonCotiz)],
|
|
74
79
|
['Importe neto', formatMoneyLabel(payload.ImpNeto)],
|
|
75
80
|
['Importe IVA', formatMoneyLabel(payload.ImpIVA)],
|
|
76
81
|
...formatIvaRows(payload.Iva ?? []),
|
|
@@ -93,7 +98,7 @@ function formatFriendlyPayloadRows(result) {
|
|
|
93
98
|
const associatedKind = getVoucherKindByArcaType(associatedVoucher.Tipo);
|
|
94
99
|
rows.push(['Comprobante asociado', associatedKind ? associatedKind.displayName : String(associatedVoucher.Tipo)]);
|
|
95
100
|
rows.push(['Punto de venta asociado', formatNumericLabel(associatedVoucher.PtoVta)]);
|
|
96
|
-
rows.push(['
|
|
101
|
+
rows.push(['Número asociado', formatNumericLabel(associatedVoucher.Nro)]);
|
|
97
102
|
rows.push(['CUIT asociado', formatTaxIdLabel(associatedVoucher.Cuit)]);
|
|
98
103
|
if (associatedVoucher.CbteFch) {
|
|
99
104
|
rows.push(['Fecha asociado', formatDateLabel(associatedVoucher.CbteFch)]);
|
|
@@ -101,7 +106,7 @@ function formatFriendlyPayloadRows(result) {
|
|
|
101
106
|
}
|
|
102
107
|
if (payload.PeriodoAsoc) {
|
|
103
108
|
rows.push([
|
|
104
|
-
'
|
|
109
|
+
'Período asociado',
|
|
105
110
|
`${formatDateLabel(payload.PeriodoAsoc.FchDesde)} al ${formatDateLabel(payload.PeriodoAsoc.FchHasta)}`,
|
|
106
111
|
]);
|
|
107
112
|
}
|
|
@@ -126,7 +131,9 @@ export function formatResultPanel(result, status) {
|
|
|
126
131
|
const summaryRows = [
|
|
127
132
|
['CAE', result.response.cae ?? 'N/D'],
|
|
128
133
|
['Vencimiento CAE', formatDateLabel(result.response.caeVencimiento ?? undefined)],
|
|
129
|
-
|
|
134
|
+
result.voucherNumber === undefined
|
|
135
|
+
? ['Punto de venta', result.payload.PtoVta]
|
|
136
|
+
: ['Número', formatVoucherNumber(result.payload.PtoVta, result.voucherNumber)],
|
|
130
137
|
['Importe total', formatMoneyLabel(result.payload.ImpTotal)],
|
|
131
138
|
];
|
|
132
139
|
const countRows = [
|
|
@@ -143,4 +150,3 @@ export function formatResultPanel(result, status) {
|
|
|
143
150
|
const footer = toneText(status.label, status.tone);
|
|
144
151
|
return statusPanel(result.voucherKind.displayName, rows, footer, 'ticket', status.tone, 'ticket');
|
|
145
152
|
}
|
|
146
|
-
//# sourceMappingURL=billing.display.js.map
|
|
@@ -6,13 +6,12 @@ import { AppError } from '../../lib/errors/app-error.js';
|
|
|
6
6
|
export class EmissionUncertainError extends AppError {
|
|
7
7
|
constructor(options) {
|
|
8
8
|
const reason = options.cause instanceof Error ? options.cause.message : String(options.cause);
|
|
9
|
-
super(`No se pudo confirmar la
|
|
9
|
+
super(`No se pudo confirmar la emisión: ${reason}`, {
|
|
10
10
|
code: 'EMISSION_UNCERTAIN',
|
|
11
11
|
details: { causa: reason },
|
|
12
|
-
suggestion: `Puede haberse emitido igual. Antes de reintentar,
|
|
12
|
+
suggestion: `Puede haberse emitido igual. Antes de reintentar, verificá con "arcli ultimos ${options.shortcut} --pv ${options.pointOfSale}": si figura, ya esta emitido y no hay que repetirlo.`,
|
|
13
13
|
});
|
|
14
14
|
this.name = 'EmissionUncertainError';
|
|
15
15
|
this.cause = options.cause;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
//# sourceMappingURL=billing.errors.js.map
|
|
@@ -30,7 +30,7 @@ export function resolveElectronicCreditOptionals(input, voucherKind) {
|
|
|
30
30
|
if (!voucherKind.isElectronicCredit) {
|
|
31
31
|
const flags = input.cancellation ? [...invoiceOnlyFlags, '--anulacion'] : invoiceOnlyFlags;
|
|
32
32
|
if (flags.length > 0) {
|
|
33
|
-
throw new InputValidationError(`${flags.join(', ')} solo aplica a comprobantes de
|
|
33
|
+
throw new InputValidationError(`${flags.join(', ')} solo aplica a comprobantes de crédito electrónica (FCE).`);
|
|
34
34
|
}
|
|
35
35
|
return undefined;
|
|
36
36
|
}
|
|
@@ -41,10 +41,10 @@ export function resolveElectronicCreditOptionals(input, voucherKind) {
|
|
|
41
41
|
return [{ Id: FCE_OPTIONAL_IDS.cancellation, Valor: input.cancellation ? 'S' : 'N' }];
|
|
42
42
|
}
|
|
43
43
|
if (input.cancellation) {
|
|
44
|
-
throw new InputValidationError(`La ${label} no usa --anulacion: solo aplica a notas de
|
|
44
|
+
throw new InputValidationError(`La ${label} no usa --anulacion: solo aplica a notas de crédito o débito FCE.`);
|
|
45
45
|
}
|
|
46
46
|
if (!input.cbu) {
|
|
47
|
-
throw new InputValidationError(`La ${label} requiere el CBU del emisor.
|
|
47
|
+
throw new InputValidationError(`La ${label} requiere el CBU del emisor. Usá --cbu o configuralo con "arcli config establecer cbu <22 digitos>".`);
|
|
48
48
|
}
|
|
49
49
|
const optionals = [{ Id: FCE_OPTIONAL_IDS.cbu, Valor: input.cbu }];
|
|
50
50
|
if (input.cbuAlias) {
|
|
@@ -56,4 +56,3 @@ export function resolveElectronicCreditOptionals(input, voucherKind) {
|
|
|
56
56
|
});
|
|
57
57
|
return optionals;
|
|
58
58
|
}
|
|
59
|
-
//# sourceMappingURL=billing.fce.js.map
|
|
@@ -47,7 +47,7 @@ export function validateIvaConditionForVoucher(ivaCondition, voucherKind) {
|
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
const suggestedLetter = ['a', 'b'].find((letter) => isIvaConditionAllowed(letter, ivaCondition));
|
|
50
|
-
const suggestion = suggestedLetter ? `
|
|
50
|
+
const suggestion = suggestedLetter ? ` Usá un comprobante letra ${suggestedLetter.toUpperCase()}.` : '';
|
|
51
51
|
throw new InputValidationError(`La ${formatVoucherLabel(voucherKind)} no admite IVA receptor "${ivaCondition}".${suggestion}`);
|
|
52
52
|
}
|
|
53
53
|
export function validateConsumerIdentification(input, exchangeRate, voucherKind) {
|
|
@@ -55,7 +55,6 @@ export function validateConsumerIdentification(input, exchangeRate, voucherKind)
|
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
if (input.totalAmount * exchangeRate >= CONSUMER_IDENTIFICATION_THRESHOLD) {
|
|
58
|
-
throw new InputValidationError(`La ${formatVoucherLabel(voucherKind)} de $10.000.000 o
|
|
58
|
+
throw new InputValidationError(`La ${formatVoucherLabel(voucherKind)} de $10.000.000 o más requiere identificar al consumidor final. Usá --dni, --cuit o --cuil.`);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
//# sourceMappingURL=billing.iva-receptor.js.map
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { InputValidationError } from '../../lib/errors/app-error.js';
|
|
3
|
+
/**
|
|
4
|
+
* Forma del JSON de `--cargar`, campo por campo. Solo valida tipos y claves: los valores (montos positivos,
|
|
5
|
+
* alicuotas, conceptos...) los revisa despues `billingCommandSchema`, igual que si vinieran por flags.
|
|
6
|
+
* Es `.strict()`: una clave que no esta aca es un error, para que un typo no se ignore en silencio.
|
|
7
|
+
*/
|
|
8
|
+
const ivaRateJsonSchema = z.union([z.string(), z.number()], {
|
|
9
|
+
error: 'tiene que ser un texto ("general", "10.5") o un número (10.5)',
|
|
10
|
+
});
|
|
11
|
+
const associatedVoucherJsonSchema = z
|
|
12
|
+
.object({
|
|
13
|
+
atajo: z.string().optional(),
|
|
14
|
+
cuit: z.string().optional(),
|
|
15
|
+
fecha: z.string().optional(),
|
|
16
|
+
numero: z.number().optional(),
|
|
17
|
+
puntoVenta: z.number().optional(),
|
|
18
|
+
tipo: z.number().optional(),
|
|
19
|
+
})
|
|
20
|
+
.strict();
|
|
21
|
+
const associatedPeriodJsonSchema = z
|
|
22
|
+
.object({
|
|
23
|
+
desde: z.string().optional(),
|
|
24
|
+
hasta: z.string().optional(),
|
|
25
|
+
})
|
|
26
|
+
.strict();
|
|
27
|
+
const ivaRateAmountJsonSchema = z
|
|
28
|
+
.object({
|
|
29
|
+
monto: z.number(),
|
|
30
|
+
tasa: ivaRateJsonSchema,
|
|
31
|
+
})
|
|
32
|
+
.strict();
|
|
33
|
+
export const billingJsonInputSchema = z
|
|
34
|
+
.object({
|
|
35
|
+
aliasCbu: z.string().optional(),
|
|
36
|
+
alicuotaIva: ivaRateJsonSchema.optional(),
|
|
37
|
+
alicuotas: z.array(ivaRateAmountJsonSchema).optional(),
|
|
38
|
+
anulacion: z.boolean().optional(),
|
|
39
|
+
cbu: z.string().optional(),
|
|
40
|
+
codigoMoneda: z.string().optional(),
|
|
41
|
+
comprobanteAsociado: associatedVoucherJsonSchema.optional(),
|
|
42
|
+
concepto: z.string().optional(),
|
|
43
|
+
cotizacionMoneda: z.number().optional(),
|
|
44
|
+
descripcion: z.string().optional(),
|
|
45
|
+
dia: z.number().optional(),
|
|
46
|
+
emitir: z.boolean().optional(),
|
|
47
|
+
fechaComprobante: z.string().optional(),
|
|
48
|
+
importeExento: z.number().optional(),
|
|
49
|
+
importeNoGravado: z.number().optional(),
|
|
50
|
+
ivaReceptor: z.string().optional(),
|
|
51
|
+
mismaMoneda: z.boolean().optional(),
|
|
52
|
+
montoTotal: z.number().optional(),
|
|
53
|
+
numeroDocumento: z.number().optional(),
|
|
54
|
+
pdf: z.boolean().optional(),
|
|
55
|
+
periodoAsociado: associatedPeriodJsonSchema.optional(),
|
|
56
|
+
previsualizar: z.boolean().optional(),
|
|
57
|
+
puntoVenta: z.number().optional(),
|
|
58
|
+
receptorDomicilio: z.string().optional(),
|
|
59
|
+
receptorNombre: z.string().optional(),
|
|
60
|
+
servicioDesde: z.string().optional(),
|
|
61
|
+
servicioHasta: z.string().optional(),
|
|
62
|
+
tipoDocumento: z.string().optional(),
|
|
63
|
+
transferencia: z.string().optional(),
|
|
64
|
+
vencimientoPago: z.string().optional(),
|
|
65
|
+
})
|
|
66
|
+
.strict();
|
|
67
|
+
/**
|
|
68
|
+
* Campo de `BillingCommandInput` que alimenta cada clave del JSON; `null` si no tiene uno solo
|
|
69
|
+
* (`emitir` y `previsualizar` deciden juntos `emit` y `dryRun`). El tipo obliga a cubrir todas las claves.
|
|
70
|
+
*/
|
|
71
|
+
const BILLING_JSON_INTERNAL_KEYS = {
|
|
72
|
+
aliasCbu: 'cbuAlias',
|
|
73
|
+
alicuotaIva: 'ivaRate',
|
|
74
|
+
alicuotas: 'ivaRateAmounts',
|
|
75
|
+
anulacion: 'cancellation',
|
|
76
|
+
cbu: 'cbu',
|
|
77
|
+
codigoMoneda: 'currencyCode',
|
|
78
|
+
comprobanteAsociado: 'associatedVoucher',
|
|
79
|
+
concepto: 'concept',
|
|
80
|
+
cotizacionMoneda: 'exchangeRate',
|
|
81
|
+
descripcion: 'pdfDescription',
|
|
82
|
+
dia: 'dueDay',
|
|
83
|
+
emitir: null,
|
|
84
|
+
fechaComprobante: 'billingDate',
|
|
85
|
+
importeExento: 'exemptAmount',
|
|
86
|
+
importeNoGravado: 'untaxedAmount',
|
|
87
|
+
ivaReceptor: 'ivaCondition',
|
|
88
|
+
mismaMoneda: 'sameCurrency',
|
|
89
|
+
montoTotal: 'totalAmount',
|
|
90
|
+
numeroDocumento: 'documentNumber',
|
|
91
|
+
pdf: 'pdf',
|
|
92
|
+
periodoAsociado: 'associatedPeriod',
|
|
93
|
+
previsualizar: null,
|
|
94
|
+
puntoVenta: 'pointOfSale',
|
|
95
|
+
receptorDomicilio: 'receiverAddress',
|
|
96
|
+
receptorNombre: 'receiverName',
|
|
97
|
+
servicioDesde: 'serviceStartDate',
|
|
98
|
+
servicioHasta: 'serviceEndDate',
|
|
99
|
+
tipoDocumento: 'documentType',
|
|
100
|
+
transferencia: 'transferMode',
|
|
101
|
+
vencimientoPago: 'paymentDueDate',
|
|
102
|
+
};
|
|
103
|
+
/** Clave publica del JSON para cada campo interno; sirve para traducir las rutas de los errores de zod. */
|
|
104
|
+
export const BILLING_JSON_KEY_BY_INTERNAL_KEY = Object.fromEntries(Object.entries(BILLING_JSON_INTERNAL_KEYS)
|
|
105
|
+
.filter(([, internalKey]) => internalKey !== null)
|
|
106
|
+
.map(([jsonKey, internalKey]) => [internalKey, jsonKey]));
|
|
107
|
+
/** Claves validas en cada objeto del JSON; las de un array (`alicuotas`) van sin indice. */
|
|
108
|
+
const KEYS_BY_PARENT = {
|
|
109
|
+
'': Object.keys(billingJsonInputSchema.shape),
|
|
110
|
+
alicuotas: Object.keys(ivaRateAmountJsonSchema.shape),
|
|
111
|
+
comprobanteAsociado: Object.keys(associatedVoucherJsonSchema.shape),
|
|
112
|
+
periodoAsociado: Object.keys(associatedPeriodJsonSchema.shape),
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Nombres de flags (sin guiones) que alguien puede escribir en el JSON pensando que valen igual.
|
|
116
|
+
* Solo los que no se parecen a su clave: el resto lo encuentra la comparacion por parecido.
|
|
117
|
+
*/
|
|
118
|
+
const FLAG_NAME_HINTS = {
|
|
119
|
+
ac: 'comprobanteAsociado.atajo',
|
|
120
|
+
acuit: 'comprobanteAsociado.cuit',
|
|
121
|
+
afecha: 'comprobanteAsociado.fecha',
|
|
122
|
+
alias: 'aliasCbu',
|
|
123
|
+
alicuota: 'alicuotaIva',
|
|
124
|
+
apv: 'comprobanteAsociado.puntoVenta',
|
|
125
|
+
ar: 'comprobanteAsociado.numero',
|
|
126
|
+
at: 'comprobanteAsociado.tipo',
|
|
127
|
+
cm: 'cotizacionMoneda',
|
|
128
|
+
cuil: 'tipoDocumento": "cuil" con "numeroDocumento',
|
|
129
|
+
cuit: 'tipoDocumento": "cuit" con "numeroDocumento',
|
|
130
|
+
dni: 'tipoDocumento": "dni" con "numeroDocumento',
|
|
131
|
+
exento: 'importeExento',
|
|
132
|
+
exportarpdf: 'pdf',
|
|
133
|
+
fecha: 'fechaComprobante',
|
|
134
|
+
ir: 'ivaReceptor',
|
|
135
|
+
mda: 'codigoMoneda',
|
|
136
|
+
moneda: 'codigoMoneda',
|
|
137
|
+
monto: 'montoTotal',
|
|
138
|
+
nogravado: 'importeNoGravado',
|
|
139
|
+
pd: 'periodoAsociado.desde',
|
|
140
|
+
periododesde: 'periodoAsociado.desde',
|
|
141
|
+
periodohasta: 'periodoAsociado.hasta',
|
|
142
|
+
ph: 'periodoAsociado.hasta',
|
|
143
|
+
pv: 'puntoVenta',
|
|
144
|
+
sd: 'servicioDesde',
|
|
145
|
+
sh: 'servicioHasta',
|
|
146
|
+
sinpdf: 'pdf',
|
|
147
|
+
vencimiento: 'vencimientoPago',
|
|
148
|
+
vto: 'vencimientoPago',
|
|
149
|
+
};
|
|
150
|
+
function normalizeKey(key) {
|
|
151
|
+
return key.toLowerCase().replace(/[-_\s]/g, '');
|
|
152
|
+
}
|
|
153
|
+
function editDistance(a, b) {
|
|
154
|
+
let previous = Array.from({ length: b.length + 1 }, (_, index) => index);
|
|
155
|
+
for (let i = 1; i <= a.length; i += 1) {
|
|
156
|
+
const current = [i];
|
|
157
|
+
for (let j = 1; j <= b.length; j += 1) {
|
|
158
|
+
current[j] = Math.min((previous[j] ?? 0) + 1, (current[j - 1] ?? 0) + 1, (previous[j - 1] ?? 0) + (a[i - 1] === b[j - 1] ? 0 : 1));
|
|
159
|
+
}
|
|
160
|
+
previous = current;
|
|
161
|
+
}
|
|
162
|
+
return previous[b.length] ?? 0;
|
|
163
|
+
}
|
|
164
|
+
/** La clave valida mas parecida, o el nombre de flag conocido; `undefined` si ninguna se parece. */
|
|
165
|
+
function suggestKey(unknownKey, parent) {
|
|
166
|
+
const normalized = normalizeKey(unknownKey);
|
|
167
|
+
const validKeys = KEYS_BY_PARENT[parent] ?? [];
|
|
168
|
+
if (parent === '' && FLAG_NAME_HINTS[normalized]) {
|
|
169
|
+
return FLAG_NAME_HINTS[normalized];
|
|
170
|
+
}
|
|
171
|
+
const ranked = validKeys
|
|
172
|
+
.map((key) => ({ distance: editDistance(normalized, normalizeKey(key)), key }))
|
|
173
|
+
.sort((left, right) => left.distance - right.distance);
|
|
174
|
+
const best = ranked[0];
|
|
175
|
+
return best && best.distance <= Math.max(1, Math.floor(normalized.length / 4)) ? best.key : undefined;
|
|
176
|
+
}
|
|
177
|
+
function formatPath(path) {
|
|
178
|
+
return path
|
|
179
|
+
.map((segment, index) => typeof segment === 'number' ? `[${segment}]` : `${index === 0 ? '' : '.'}${String(segment)}`)
|
|
180
|
+
.join('');
|
|
181
|
+
}
|
|
182
|
+
function describeExpected(expected) {
|
|
183
|
+
switch (expected) {
|
|
184
|
+
case 'number':
|
|
185
|
+
return 'un número';
|
|
186
|
+
case 'string':
|
|
187
|
+
return 'un texto';
|
|
188
|
+
case 'boolean':
|
|
189
|
+
return 'true o false';
|
|
190
|
+
case 'array':
|
|
191
|
+
return 'un array';
|
|
192
|
+
case 'object':
|
|
193
|
+
return 'un objeto';
|
|
194
|
+
default:
|
|
195
|
+
return expected;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function describeReceived(input) {
|
|
199
|
+
if (input === null) {
|
|
200
|
+
return 'null';
|
|
201
|
+
}
|
|
202
|
+
if (Array.isArray(input)) {
|
|
203
|
+
return 'un array';
|
|
204
|
+
}
|
|
205
|
+
switch (typeof input) {
|
|
206
|
+
case 'string':
|
|
207
|
+
return `el texto ${JSON.stringify(input)}`;
|
|
208
|
+
case 'number':
|
|
209
|
+
case 'boolean':
|
|
210
|
+
return String(input);
|
|
211
|
+
case 'object':
|
|
212
|
+
return 'un objeto';
|
|
213
|
+
default:
|
|
214
|
+
return typeof input;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function describeIssue(issue) {
|
|
218
|
+
const path = issue.path.map((segment) => (typeof segment === 'number' ? segment : String(segment)));
|
|
219
|
+
const pathLabel = formatPath(path);
|
|
220
|
+
if (issue.code === 'unrecognized_keys') {
|
|
221
|
+
const parent = path.filter((segment) => typeof segment === 'string').join('.');
|
|
222
|
+
return issue.keys.map((key) => {
|
|
223
|
+
const fullKey = formatPath([...path, key]);
|
|
224
|
+
const suggestion = suggestKey(key, parent);
|
|
225
|
+
return {
|
|
226
|
+
mensaje: `La clave "${fullKey}" no existe${suggestion ? `: ¿quisiste decir "${suggestion}"?` : '.'}`,
|
|
227
|
+
ruta: [...path.map(String), key],
|
|
228
|
+
};
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
if (issue.code === 'invalid_type') {
|
|
232
|
+
if (issue.input === undefined) {
|
|
233
|
+
return [{ mensaje: `Falta "${pathLabel}".`, ruta: path.map(String) }];
|
|
234
|
+
}
|
|
235
|
+
if (path.length === 0) {
|
|
236
|
+
return [
|
|
237
|
+
{ mensaje: `Cada comprobante tiene que ser un objeto y llegó ${describeReceived(issue.input)}.`, ruta: [] },
|
|
238
|
+
];
|
|
239
|
+
}
|
|
240
|
+
const unquote = issue.expected === 'number' && typeof issue.input === 'string' && issue.input.trim() !== ''
|
|
241
|
+
? ' Escribilo sin comillas.'
|
|
242
|
+
: '';
|
|
243
|
+
return [
|
|
244
|
+
{
|
|
245
|
+
mensaje: `"${pathLabel}" tiene que ser ${describeExpected(issue.expected)} y llegó ${describeReceived(issue.input)}.${unquote}`,
|
|
246
|
+
ruta: path.map(String),
|
|
247
|
+
},
|
|
248
|
+
];
|
|
249
|
+
}
|
|
250
|
+
return [{ mensaje: `"${pathLabel}" ${issue.message}.`, ruta: path.map(String) }];
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Valida un comprobante del JSON de `--cargar`. Un tipo incorrecto o una clave desconocida es un error de
|
|
254
|
+
* entrada que nombra la clave; antes se descartaban sin aviso y se usaba la config.
|
|
255
|
+
*/
|
|
256
|
+
export function parseBillingJsonInput(value) {
|
|
257
|
+
const result = billingJsonInputSchema.safeParse(value, { reportInput: true });
|
|
258
|
+
if (result.success) {
|
|
259
|
+
return result.data;
|
|
260
|
+
}
|
|
261
|
+
const issues = result.error.issues.flatMap((issue) => describeIssue(issue));
|
|
262
|
+
throw new InputValidationError(`En el JSON de --cargar: ${issues.map((issue) => issue.mensaje).join(' ')}`, {
|
|
263
|
+
campos: issues,
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
/** El JSON de `--cargar` es un comprobante (objeto) o un lote (array no vacio). Devuelve los items sin validar. */
|
|
267
|
+
export function readBillingJsonItems(source) {
|
|
268
|
+
if (Array.isArray(source)) {
|
|
269
|
+
if (source.length === 0) {
|
|
270
|
+
throw new InputValidationError('El JSON de --cargar es un lote vacío: no hay comprobantes para procesar.');
|
|
271
|
+
}
|
|
272
|
+
return source;
|
|
273
|
+
}
|
|
274
|
+
if (typeof source !== 'object' || source === null) {
|
|
275
|
+
throw new InputValidationError(`El JSON de --cargar tiene que ser un objeto o un array de objetos y es ${describeReceived(source)}.`);
|
|
276
|
+
}
|
|
277
|
+
return [source];
|
|
278
|
+
}
|
|
@@ -76,7 +76,7 @@ export function formatCurrencyLabel(value) {
|
|
|
76
76
|
case 'PES':
|
|
77
77
|
return 'Pesos argentinos (ARS)';
|
|
78
78
|
case 'DOL':
|
|
79
|
-
return '
|
|
79
|
+
return 'Dólares estadounidenses (USD)';
|
|
80
80
|
default:
|
|
81
81
|
return value ?? 'N/D';
|
|
82
82
|
}
|
|
@@ -105,4 +105,3 @@ export function formatDecimalLabel(value) {
|
|
|
105
105
|
maximumFractionDigits: 6,
|
|
106
106
|
}).format(value);
|
|
107
107
|
}
|
|
108
|
-
//# sourceMappingURL=billing.labels.js.map
|