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,11 +1,13 @@
|
|
|
1
1
|
import { Separator } from '@inquirer/select';
|
|
2
2
|
import { formatCuit } from '../../lib/identity/format-cuit.js';
|
|
3
|
+
import { CertificateExpiredError, inspectConfiguredCertificates, } from '../../modules/config/certificate-expiry.js';
|
|
3
4
|
import { ConfigService } from '../../modules/config/config.service.js';
|
|
4
5
|
import { listMissingSetupKeys } from '../../modules/interactive/config-fields.js';
|
|
5
6
|
import { checkArcaHealth } from '../../modules/parameters/health.js';
|
|
6
7
|
import { checkForUpdate } from '../../modules/update-check/update-check.service.js';
|
|
7
8
|
import { ArcaParametersGateway } from '../../services/arca/arca-parameters.gateway.js';
|
|
8
9
|
import { colorize, formatCliError, noticePanel, renderLogo, statusBar, writeTerminalError, writeTerminalOutput, } from '../../ui/index.js';
|
|
10
|
+
import { renderCertificateNotices } from '../arca-runtime.js';
|
|
9
11
|
import { startSpinner } from '../spinner.js';
|
|
10
12
|
import { CLI_VERSION } from '../version.js';
|
|
11
13
|
import { runConfigMenu, runGuidedSetup } from './config.flow.js';
|
|
@@ -33,13 +35,13 @@ function resolveSession(options) {
|
|
|
33
35
|
}
|
|
34
36
|
catch (error) {
|
|
35
37
|
writeTerminalError(formatCliError(error, false));
|
|
36
|
-
writeTerminalOutput(noticePanel('Revisala desde "
|
|
38
|
+
writeTerminalOutput(noticePanel('Revisala desde "Configuración" en el menú.', 'warning'));
|
|
37
39
|
return undefined;
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
async function runOption(option, options) {
|
|
41
43
|
if (option === 'config') {
|
|
42
|
-
await runConfigMenu(
|
|
44
|
+
await runConfigMenu();
|
|
43
45
|
return;
|
|
44
46
|
}
|
|
45
47
|
const session = resolveSession(options);
|
|
@@ -65,39 +67,68 @@ const HEALTH_LABELS = {
|
|
|
65
67
|
funcionando: ['ARCA funcionando', 'success'],
|
|
66
68
|
'sin-respuesta': ['ARCA sin respuesta', 'danger'],
|
|
67
69
|
};
|
|
68
|
-
|
|
70
|
+
/** La razon social, si es tan larga que no entra en la barra, se corta. */
|
|
71
|
+
const MAX_ISSUER_NAME_LENGTH = 32;
|
|
72
|
+
function environmentSegment(environment) {
|
|
73
|
+
return environment === 'produccion'
|
|
74
|
+
? { color: 'production', text: 'PRODUCCIÓN' }
|
|
75
|
+
: { color: 'testing', text: 'TESTING' };
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Recuadro de los certificados por vencer o vencidos, de cualquier entorno, debajo de la barra: queda arriba de
|
|
79
|
+
* todo lo que se haga en la sesion.
|
|
80
|
+
*/
|
|
81
|
+
function withCertificateBox(bar, notices) {
|
|
82
|
+
const box = renderCertificateNotices(notices);
|
|
83
|
+
return box ? `${bar}\n\n${box}` : bar;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Con el certificado activo vencido la sesion no se crea, asi que los del resto de los entornos se leen aparte de
|
|
87
|
+
* la config. Si no se puede, queda solo el vencido.
|
|
88
|
+
*/
|
|
89
|
+
function noticesWithExpired(expired) {
|
|
90
|
+
const service = new ConfigService();
|
|
69
91
|
try {
|
|
70
|
-
|
|
92
|
+
const others = inspectConfiguredCertificates(service.getConfig().cert ?? {}, {
|
|
93
|
+
activeEnvironment: expired.environment,
|
|
94
|
+
}).filter((notice) => notice.environment !== expired.environment);
|
|
95
|
+
return [expired, ...others];
|
|
71
96
|
}
|
|
72
97
|
catch {
|
|
73
|
-
return
|
|
98
|
+
return [expired];
|
|
99
|
+
}
|
|
100
|
+
finally {
|
|
101
|
+
service.close();
|
|
74
102
|
}
|
|
75
103
|
}
|
|
76
|
-
/** La razon social, si es tan larga que no entra en la barra, se corta. */
|
|
77
|
-
const MAX_ISSUER_NAME_LENGTH = 32;
|
|
78
104
|
/**
|
|
79
105
|
* Barra de estado: a la izquierda, quien emite (razon social, o el CUIT si no esta configurada) y el punto de
|
|
80
|
-
* venta; a la derecha, como esta ARCA y el entorno, cada uno en su color.
|
|
106
|
+
* venta; a la derecha, como esta ARCA y el entorno, cada uno en su color. Con el certificado por vencer o
|
|
107
|
+
* vencido, debajo va su recuadro.
|
|
81
108
|
*/
|
|
82
109
|
async function buildHeader(options) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
110
|
+
let session;
|
|
111
|
+
try {
|
|
112
|
+
session = createInteractiveSession(options);
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
// Vencido no se consulta ARCA (WSAA lo rechazaria): se dice por que en lugar de "falta configurar".
|
|
116
|
+
if (error instanceof CertificateExpiredError) {
|
|
117
|
+
const bar = statusBar([{ text: 'certificado vencido' }], [{ color: 'danger', text: 'ARCA SIN VERIFICAR' }, environmentSegment(error.notice.environment)], { rightSeparator: 'rule' });
|
|
118
|
+
return withCertificateBox(bar, noticesWithExpired(error.notice));
|
|
119
|
+
}
|
|
120
|
+
return statusBar([{ text: 'falta completar la configuración' }], [{ color: 'muted', text: 'ARCA SIN VERIFICAR' }]);
|
|
86
121
|
}
|
|
87
122
|
const spinner = startSpinner('Consultando el estado de ARCA...');
|
|
88
123
|
const health = await checkArcaHealth({ gateway: new ArcaParametersGateway(session.arca) });
|
|
89
124
|
spinner?.stop();
|
|
90
125
|
const [label, color] = HEALTH_LABELS[health];
|
|
91
|
-
const { config, context, environment, pointOfSale } = session.runtime;
|
|
92
|
-
|
|
126
|
+
const { certificateNotices, config, context, environment, pointOfSale } = session.runtime;
|
|
127
|
+
const bar = statusBar([
|
|
93
128
|
{ text: formatIssuer(config.emisor?.razonSocial, context.cuit) },
|
|
94
129
|
{ text: `PV ${pointOfSale ?? 'sin configurar'}` },
|
|
95
|
-
], [
|
|
96
|
-
|
|
97
|
-
environment === 'produccion'
|
|
98
|
-
? { color: 'production', text: 'PRODUCCION' }
|
|
99
|
-
: { color: 'testing', text: 'TESTING' },
|
|
100
|
-
], { rightSeparator: 'rule' });
|
|
130
|
+
], [{ color, text: label.toUpperCase() }, environmentSegment(environment)], { rightSeparator: 'rule' });
|
|
131
|
+
return withCertificateBox(bar, certificateNotices);
|
|
101
132
|
}
|
|
102
133
|
function formatIssuer(businessName, cuit) {
|
|
103
134
|
if (!businessName) {
|
|
@@ -108,7 +139,7 @@ function formatIssuer(businessName, cuit) {
|
|
|
108
139
|
: businessName;
|
|
109
140
|
}
|
|
110
141
|
function updateChoice(update) {
|
|
111
|
-
const name = `Actualizar a la
|
|
142
|
+
const name = `Actualizar a la versión ${update.latestVersion}`;
|
|
112
143
|
return { name: colorize(name, 'highlight'), short: name, value: 'actualizar' };
|
|
113
144
|
}
|
|
114
145
|
/** Asistente paso a paso encima del CLI. Ctrl+C cancela el flujo actual; en el menu, sale. */
|
|
@@ -127,7 +158,7 @@ export async function runInteractiveMode(options = {}) {
|
|
|
127
158
|
if (listMissingSetup().length > 0) {
|
|
128
159
|
menuUnderHeader = false;
|
|
129
160
|
try {
|
|
130
|
-
if (await confirm('Falta completar la
|
|
161
|
+
if (await confirm('Falta completar la configuración. ¿La hacemos ahora, paso a paso?', 'Sí, configurar', 'Después')) {
|
|
131
162
|
await runGuidedSetup();
|
|
132
163
|
writeTerminalOutput(await buildHeader(options));
|
|
133
164
|
menuUnderHeader = true;
|
|
@@ -142,29 +173,29 @@ export async function runInteractiveMode(options = {}) {
|
|
|
142
173
|
for (;;) {
|
|
143
174
|
let option;
|
|
144
175
|
try {
|
|
145
|
-
option = await chooseOne('¿
|
|
176
|
+
option = await chooseOne('¿Qué querés hacer?', [
|
|
146
177
|
...(update ? [updateChoice(update), new Separator(' ')] : []),
|
|
147
178
|
{ name: 'Emitir factura', value: 'factura' },
|
|
148
179
|
{
|
|
149
|
-
description: 'Copia una de las
|
|
180
|
+
description: 'Copia una de las últimas, con fechas nuevas',
|
|
150
181
|
name: 'Repetir una factura anterior',
|
|
151
182
|
value: 'repetir',
|
|
152
183
|
},
|
|
153
184
|
{
|
|
154
|
-
description: 'Descuento,
|
|
155
|
-
name: 'Emitir nota de
|
|
185
|
+
description: 'Descuento, devolución o anulación de una factura',
|
|
186
|
+
name: 'Emitir nota de crédito',
|
|
156
187
|
value: 'nota-credito',
|
|
157
188
|
},
|
|
158
|
-
{ description: 'Cargo adicional sobre una factura', name: 'Emitir nota de
|
|
189
|
+
{ description: 'Cargo adicional sobre una factura', name: 'Emitir nota de débito', value: 'nota-debito' },
|
|
159
190
|
{
|
|
160
|
-
description: 'Los
|
|
191
|
+
description: 'Los últimos de cada tipo, o buscar uno por número',
|
|
161
192
|
name: 'Consultar comprobantes',
|
|
162
193
|
value: 'historial',
|
|
163
194
|
},
|
|
164
|
-
{ description: 'Servidores, punto de venta y
|
|
195
|
+
{ description: 'Servidores, punto de venta y cotización del dólar', name: 'Estado de ARCA', value: 'estado' },
|
|
165
196
|
{
|
|
166
|
-
description: 'Revisar,
|
|
167
|
-
name: '
|
|
197
|
+
description: 'Revisar, configuración guiada, cambiar un dato y PDF',
|
|
198
|
+
name: 'Configuración',
|
|
168
199
|
value: 'config',
|
|
169
200
|
},
|
|
170
201
|
new Separator(' '),
|
|
@@ -192,13 +223,12 @@ export async function runInteractiveMode(options = {}) {
|
|
|
192
223
|
}
|
|
193
224
|
catch (error) {
|
|
194
225
|
if (isPromptCancellation(error)) {
|
|
195
|
-
writeTerminalOutput(colorize('Cancelado. No se
|
|
226
|
+
writeTerminalOutput(colorize('Cancelado. No se emitió nada.', 'muted'));
|
|
196
227
|
}
|
|
197
228
|
else {
|
|
198
229
|
writeTerminalError(formatCliError(error, false));
|
|
199
230
|
}
|
|
200
231
|
}
|
|
201
232
|
}
|
|
202
|
-
writeTerminalOutput(colorize('¡Hasta la
|
|
233
|
+
writeTerminalOutput(colorize('¡Hasta la próxima!', 'muted'));
|
|
203
234
|
}
|
|
204
|
-
//# sourceMappingURL=interactive-mode.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Separator } from '@inquirer/select';
|
|
2
|
+
import { parseStrictInteger } from '../../lib/numbers/strict-integer.js';
|
|
2
3
|
import { BACK } from '../../modules/interactive/wizard.js';
|
|
3
4
|
import { listVouchersFrom, RECENT_VOUCHERS_LIMIT } from '../../modules/vouchers/voucher-history.js';
|
|
4
5
|
import { formatVoucherNumber, formatVoucherPickerRows } from '../../modules/vouchers/voucher-history.presenter.js';
|
|
@@ -27,8 +28,8 @@ async function withSpinner(text, run) {
|
|
|
27
28
|
}
|
|
28
29
|
function validatePositiveInteger(label) {
|
|
29
30
|
return (value) => {
|
|
30
|
-
const number =
|
|
31
|
-
return
|
|
31
|
+
const number = parseStrictInteger(value);
|
|
32
|
+
return number !== undefined && number > 0 ? true : `${label} tiene que ser un número entero mayor a 0.`;
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
/** Pide punto de venta y numero, y lo busca en ARCA. Volver o un comprobante inexistente vuelven a la lista. */
|
|
@@ -40,7 +41,7 @@ async function askVoucherByNumber(session, voucherKind, defaultPointOfSale) {
|
|
|
40
41
|
if (pointOfSaleAnswer === BACK) {
|
|
41
42
|
return BACK;
|
|
42
43
|
}
|
|
43
|
-
const numberAnswer = await askTextStep('
|
|
44
|
+
const numberAnswer = await askTextStep('Número:', { validate: validatePositiveInteger('El número') });
|
|
44
45
|
if (numberAnswer === BACK) {
|
|
45
46
|
return BACK;
|
|
46
47
|
}
|
|
@@ -93,13 +94,13 @@ export async function pickInvoice(session, options) {
|
|
|
93
94
|
choices.push(new Separator(' '), new Separator(colorize(' Cargando…', 'muted')));
|
|
94
95
|
}
|
|
95
96
|
else if (nextNumber > 0) {
|
|
96
|
-
choices.push(new Separator(' '), { name: '+ Cargar
|
|
97
|
+
choices.push(new Separator(' '), { name: '+ Cargar más…', value: LOAD_MORE });
|
|
97
98
|
}
|
|
98
99
|
choices.push(listRule(), new Separator(' '));
|
|
99
100
|
}
|
|
100
101
|
choices.push({
|
|
101
|
-
description: 'Uno
|
|
102
|
-
name: '# Ingresar el
|
|
102
|
+
description: 'Uno más viejo o de otro punto de venta',
|
|
103
|
+
name: '# Ingresar el número a mano…',
|
|
103
104
|
value: BY_NUMBER,
|
|
104
105
|
});
|
|
105
106
|
// +2: el separador y "Volver" que agrega chooseStep.
|
|
@@ -150,4 +151,3 @@ export async function pickInvoice(session, options) {
|
|
|
150
151
|
defaultChoice = answer;
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
|
-
//# sourceMappingURL=invoice-picker.js.map
|
|
@@ -1,23 +1,37 @@
|
|
|
1
1
|
import { billingCommandSchema } from '../../modules/billing/billing.schemas.js';
|
|
2
|
+
import { EXPORT_VOUCHER_KIND } from '../../modules/export/export.types.js';
|
|
2
3
|
import { parseAmountInput } from '../../modules/interactive/amount-input.js';
|
|
3
|
-
import { conceptChoices,
|
|
4
|
+
import { conceptChoices, exportInvoiceChoice, invoiceKindChoices, receiverChoices, } from '../../modules/interactive/choices.js';
|
|
4
5
|
import { BACK, runWizard } from '../../modules/interactive/wizard.js';
|
|
5
6
|
import { askAdvancedOptions } from './advanced-options.js';
|
|
7
|
+
import { runExportFlow } from './export.flow.js';
|
|
6
8
|
import { askTextStep, chooseStep } from './prompts.js';
|
|
9
|
+
import { askReceiverIvaCondition, receiverInputFields } from './receiver-padron.js';
|
|
7
10
|
import { previewAndEmit } from './session.js';
|
|
8
11
|
import { normalizeDocumentNumber, validateAmount, validateCbu, validateCuit, validateDni } from './validators.js';
|
|
9
12
|
const isFceInvoice = (state) => state.voucherKind?.family === 'factura-credito-electronica';
|
|
10
13
|
/** Pasos del flujo de factura; cada uno se puede deshacer con "Volver". */
|
|
11
14
|
export function invoiceSteps(session) {
|
|
12
15
|
const { config } = session.runtime;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const pickVoucherKind = {
|
|
17
|
+
name: 'comprobante',
|
|
18
|
+
run: async () => {
|
|
19
|
+
// Volver desde el primer paso de la E vuelve a este selector.
|
|
20
|
+
for (;;) {
|
|
21
|
+
const voucherKind = await chooseStep('¿Qué comprobante querés emitir?', [...invoiceKindChoices(), exportInvoiceChoice()]);
|
|
22
|
+
if (voucherKind === BACK) {
|
|
23
|
+
return BACK;
|
|
24
|
+
}
|
|
25
|
+
if (voucherKind !== EXPORT_VOUCHER_KIND) {
|
|
26
|
+
return { voucherKind: voucherKind };
|
|
27
|
+
}
|
|
28
|
+
if ((await runExportFlow(session)) !== BACK) {
|
|
29
|
+
return { exported: true };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
20
32
|
},
|
|
33
|
+
};
|
|
34
|
+
const billingSteps = [
|
|
21
35
|
{
|
|
22
36
|
name: 'receptor',
|
|
23
37
|
run: async (state) => {
|
|
@@ -45,15 +59,14 @@ export function invoiceSteps(session) {
|
|
|
45
59
|
{
|
|
46
60
|
name: 'iva-receptor',
|
|
47
61
|
run: async (state) => {
|
|
48
|
-
|
|
49
|
-
return ivaCondition === BACK ? BACK : { ivaCondition };
|
|
62
|
+
return askReceiverIvaCondition(session, state, state.voucherKind?.letter ?? 'c', config.ivaReceptorPorDefecto);
|
|
50
63
|
},
|
|
51
64
|
skip: (state) => state.documentType === 'consumidor-final',
|
|
52
65
|
},
|
|
53
66
|
{
|
|
54
67
|
name: 'concepto',
|
|
55
68
|
run: async () => {
|
|
56
|
-
const concept = await chooseStep('¿
|
|
69
|
+
const concept = await chooseStep('¿Qué estás facturando?', conceptChoices(), config.conceptoPorDefecto);
|
|
57
70
|
return concept === BACK ? BACK : { concept };
|
|
58
71
|
},
|
|
59
72
|
},
|
|
@@ -84,6 +97,13 @@ export function invoiceSteps(session) {
|
|
|
84
97
|
},
|
|
85
98
|
},
|
|
86
99
|
];
|
|
100
|
+
return [
|
|
101
|
+
pickVoucherKind,
|
|
102
|
+
...billingSteps.map((step) => ({
|
|
103
|
+
...step,
|
|
104
|
+
skip: (state) => Boolean(state.exported) || Boolean(step.skip?.(state)),
|
|
105
|
+
})),
|
|
106
|
+
];
|
|
87
107
|
}
|
|
88
108
|
/** Arma la entrada del CLI con lo que respondio el usuario. */
|
|
89
109
|
export function buildInvoiceInput(state, session) {
|
|
@@ -93,10 +113,13 @@ export function buildInvoiceInput(state, session) {
|
|
|
93
113
|
return billingCommandSchema.parse({
|
|
94
114
|
...state.advanced,
|
|
95
115
|
cbu: isFceInvoice(state) ? (state.cbu ?? config.cbu) : undefined,
|
|
116
|
+
// Como en el CLI: en una FCE el alias de la config se informa junto con el CBU.
|
|
117
|
+
cbuAlias: isFceInvoice(state) ? config.aliasCbu : undefined,
|
|
96
118
|
concept: state.concept,
|
|
97
119
|
documentNumber: state.documentNumber,
|
|
98
120
|
documentType: state.documentType,
|
|
99
121
|
ivaCondition: state.ivaCondition,
|
|
122
|
+
...receiverInputFields(state),
|
|
100
123
|
// 21% sin alicuota configurada es el default del CLI. Si hay config, se deja explicito para que el
|
|
101
124
|
// comando equivalente no tome la de la config.
|
|
102
125
|
ivaRate: ivaRate === '21' && !config.alicuotaPorDefecto ? undefined : ivaRate,
|
|
@@ -107,9 +130,8 @@ export function buildInvoiceInput(state, session) {
|
|
|
107
130
|
}
|
|
108
131
|
export async function runInvoiceFlow(session) {
|
|
109
132
|
const state = await runWizard(invoiceSteps(session), { advanced: { currencyCode: 'ARS', sameCurrency: false } });
|
|
110
|
-
if (!state) {
|
|
133
|
+
if (!state || state.exported) {
|
|
111
134
|
return;
|
|
112
135
|
}
|
|
113
136
|
await previewAndEmit(session, buildInvoiceInput(state, session));
|
|
114
137
|
}
|
|
115
|
-
//# sourceMappingURL=invoice.flow.js.map
|
|
@@ -2,13 +2,14 @@ import { formatArcaDateAsArgentineDate } from '../../lib/dates/arca-date.js';
|
|
|
2
2
|
import { formatMoneyLabel } from '../../modules/billing/billing.labels.js';
|
|
3
3
|
import { billingCommandSchema, } from '../../modules/billing/billing.schemas.js';
|
|
4
4
|
import { parseAmountInput } from '../../modules/interactive/amount-input.js';
|
|
5
|
-
import { conceptChoices, invoiceKindChoices,
|
|
5
|
+
import { conceptChoices, invoiceKindChoices, ivaRateChoices, noteKindChoices, receiverChoices, } from '../../modules/interactive/choices.js';
|
|
6
6
|
import { copyInvoiceAmounts } from '../../modules/interactive/invoice-copy.js';
|
|
7
7
|
import { BACK, runWizard } from '../../modules/interactive/wizard.js';
|
|
8
8
|
import { resolveDocumentType } from '../../modules/vouchers/voucher-history.js';
|
|
9
9
|
import { noticePanel, writeTerminalOutput } from '../../ui/index.js';
|
|
10
10
|
import { pickInvoice } from './invoice-picker.js';
|
|
11
11
|
import { askTextStep, chooseStep } from './prompts.js';
|
|
12
|
+
import { askReceiverIvaCondition, receiverInputFields } from './receiver-padron.js';
|
|
12
13
|
import { previewAndEmit, requirePointOfSale } from './session.js';
|
|
13
14
|
import { normalizeDocumentNumber, validateAmount, validateCuit, validateDate, validateDni } from './validators.js';
|
|
14
15
|
const CONCEPTS_BY_CODE = {
|
|
@@ -19,7 +20,7 @@ const CONCEPTS_BY_CODE = {
|
|
|
19
20
|
const isPeriod = (state) => state.target === 'periodo';
|
|
20
21
|
async function askNoteAmount(state) {
|
|
21
22
|
const invoice = state.invoice;
|
|
22
|
-
const label = state.kind === 'debito' ? 'Monto de la nota de
|
|
23
|
+
const label = state.kind === 'debito' ? 'Monto de la nota de débito:' : 'Monto de la nota de crédito:';
|
|
23
24
|
// Con varias alicuotas o tributos no se puede armar una nota igual a la factura: solo parcial.
|
|
24
25
|
const canAnnulTotal = Boolean(invoice && !copyInvoiceAmounts(invoice, state.invoiceKind?.letter ?? 'c').limitation);
|
|
25
26
|
if (state.kind === 'credito' && invoice && canAnnulTotal) {
|
|
@@ -50,22 +51,22 @@ export function noteSteps(session, pointOfSale) {
|
|
|
50
51
|
{
|
|
51
52
|
name: 'tipo-factura',
|
|
52
53
|
run: async () => {
|
|
53
|
-
const invoiceKind = await chooseStep('¿Sobre
|
|
54
|
+
const invoiceKind = await chooseStep('¿Sobre qué tipo de factura?', invoiceKindChoices());
|
|
54
55
|
return invoiceKind === BACK ? BACK : { invoiceKind, target: 'factura' };
|
|
55
56
|
},
|
|
56
57
|
},
|
|
57
58
|
{
|
|
58
59
|
name: 'asociacion',
|
|
59
60
|
run: async () => {
|
|
60
|
-
const target = await chooseStep('¿A
|
|
61
|
+
const target = await chooseStep('¿A qué la asociamos?', [
|
|
61
62
|
{
|
|
62
|
-
description: 'Elegis una de las
|
|
63
|
+
description: 'Elegis una de las últimas emitidas o la ingresas a mano',
|
|
63
64
|
name: 'A una factura',
|
|
64
65
|
value: 'factura',
|
|
65
66
|
},
|
|
66
67
|
{
|
|
67
68
|
description: 'Por ejemplo, un descuento sobre todo el mes',
|
|
68
|
-
name: 'A un
|
|
69
|
+
name: 'A un período',
|
|
69
70
|
value: 'periodo',
|
|
70
71
|
},
|
|
71
72
|
]);
|
|
@@ -79,7 +80,7 @@ export function noteSteps(session, pointOfSale) {
|
|
|
79
80
|
run: async (state) => {
|
|
80
81
|
const invoiceKind = state.invoiceKind;
|
|
81
82
|
const picked = await pickInvoice(session, {
|
|
82
|
-
message: `¿Sobre
|
|
83
|
+
message: `¿Sobre qué ${invoiceKind.displayName}?`,
|
|
83
84
|
pointOfSale,
|
|
84
85
|
voucherKind: invoiceKind,
|
|
85
86
|
});
|
|
@@ -94,7 +95,7 @@ export function noteSteps(session, pointOfSale) {
|
|
|
94
95
|
}
|
|
95
96
|
const copy = copyInvoiceAmounts(invoice, invoiceKind.letter);
|
|
96
97
|
if (copy.limitation) {
|
|
97
|
-
writeTerminalOutput(noticePanel(`${copy.limitation} La nota solo puede ser parcial; revisa la
|
|
98
|
+
writeTerminalOutput(noticePanel(`${copy.limitation} La nota solo puede ser parcial; revisa la alícuota.`, 'warning'));
|
|
98
99
|
}
|
|
99
100
|
// La nota hereda de la factura el receptor, el concepto, la moneda y la alicuota (si se puede deducir).
|
|
100
101
|
return {
|
|
@@ -112,11 +113,11 @@ export function noteSteps(session, pointOfSale) {
|
|
|
112
113
|
{
|
|
113
114
|
name: 'periodo',
|
|
114
115
|
run: async () => {
|
|
115
|
-
const periodFrom = await askTextStep('
|
|
116
|
+
const periodFrom = await askTextStep('Período desde:', { validate: validateDate });
|
|
116
117
|
if (periodFrom === BACK) {
|
|
117
118
|
return BACK;
|
|
118
119
|
}
|
|
119
|
-
const periodTo = await askTextStep('
|
|
120
|
+
const periodTo = await askTextStep('Período hasta:', { validate: validateDate });
|
|
120
121
|
return periodTo === BACK ? BACK : { invoice: undefined, invoicePointOfSale: undefined, periodFrom, periodTo };
|
|
121
122
|
},
|
|
122
123
|
skip: (state) => !isPeriod(state),
|
|
@@ -149,7 +150,7 @@ export function noteSteps(session, pointOfSale) {
|
|
|
149
150
|
{
|
|
150
151
|
name: 'concepto',
|
|
151
152
|
run: async () => {
|
|
152
|
-
const concept = await chooseStep('¿
|
|
153
|
+
const concept = await chooseStep('¿Qué concepto ajusta la nota?', conceptChoices());
|
|
153
154
|
return concept === BACK ? BACK : { concept };
|
|
154
155
|
},
|
|
155
156
|
skip: (state) => !isPeriod(state),
|
|
@@ -165,15 +166,14 @@ export function noteSteps(session, pointOfSale) {
|
|
|
165
166
|
name: 'iva-receptor',
|
|
166
167
|
run: async (state) => {
|
|
167
168
|
// ARCA no devuelve la condicion IVA de la factura, asi que se pregunta, filtrada por la letra.
|
|
168
|
-
|
|
169
|
-
return ivaCondition === BACK ? BACK : { ivaCondition };
|
|
169
|
+
return askReceiverIvaCondition(session, state, state.invoiceKind?.letter ?? 'c');
|
|
170
170
|
},
|
|
171
171
|
skip: (state) => state.documentType === 'consumidor-final',
|
|
172
172
|
},
|
|
173
173
|
{
|
|
174
174
|
name: 'alicuota',
|
|
175
175
|
run: async (state) => {
|
|
176
|
-
const ivaRate = await chooseStep(isPeriod(state) ? '
|
|
176
|
+
const ivaRate = await chooseStep(isPeriod(state) ? 'Alícuota de IVA:' : 'Alícuota de IVA de la factura:', ivaRateChoices());
|
|
177
177
|
return ivaRate === BACK ? BACK : { ivaRate };
|
|
178
178
|
},
|
|
179
179
|
// En la C no hay IVA; si la factura deja deducir la alicuota, no se pregunta.
|
|
@@ -183,7 +183,7 @@ export function noteSteps(session, pointOfSale) {
|
|
|
183
183
|
name: 'anulacion',
|
|
184
184
|
run: async () => {
|
|
185
185
|
const cancellation = await chooseStep('¿El comprador rechazo la factura?', [
|
|
186
|
-
{ name: '
|
|
186
|
+
{ name: 'Sí, es una nota de anulación', value: true },
|
|
187
187
|
{ name: 'No', value: false },
|
|
188
188
|
]);
|
|
189
189
|
return cancellation === BACK ? BACK : { cancellation };
|
|
@@ -218,6 +218,7 @@ export function buildNoteInput(state, session, pointOfSale) {
|
|
|
218
218
|
exchangeRate: copy?.exchangeRate,
|
|
219
219
|
exemptAmount: state.annulsTotal ? copy?.exemptAmount : undefined,
|
|
220
220
|
ivaCondition: state.ivaCondition,
|
|
221
|
+
...receiverInputFields(state),
|
|
221
222
|
ivaRate: state.ivaRate === '21' && !session.runtime.config.alicuotaPorDefecto ? undefined : state.ivaRate,
|
|
222
223
|
shortcut: noteKind.shortcut,
|
|
223
224
|
totalAmount: state.totalAmount,
|
|
@@ -235,4 +236,3 @@ export async function runNoteFlow(session, kind) {
|
|
|
235
236
|
}
|
|
236
237
|
await previewAndEmit(session, buildNoteInput(state, session, pointOfSale));
|
|
237
238
|
}
|
|
238
|
-
//# sourceMappingURL=note.flow.js.map
|
|
@@ -10,7 +10,7 @@ const ISSUER_QUESTIONS = {
|
|
|
10
10
|
cuit: 'CUIT del emisor',
|
|
11
11
|
'emisor.domicilio': 'Domicilio comercial del emisor',
|
|
12
12
|
'emisor.inicioActividades': 'Fecha de inicio de actividades (D/MM/YYYY)',
|
|
13
|
-
'emisor.razonSocial': '
|
|
13
|
+
'emisor.razonSocial': 'Razón social o nombre del emisor',
|
|
14
14
|
};
|
|
15
15
|
function validateConfigValue(key, value) {
|
|
16
16
|
try {
|
|
@@ -42,7 +42,7 @@ async function completeIssuer(config) {
|
|
|
42
42
|
answers.push([key, value]);
|
|
43
43
|
completed = applyIssuerValue(completed, key, value);
|
|
44
44
|
}
|
|
45
|
-
if (await confirm('¿Guardamos estos datos en la config para la
|
|
45
|
+
if (await confirm('¿Guardamos estos datos en la config para la próxima?', 'Sí, guardar', 'No, solo esta vez')) {
|
|
46
46
|
const service = new ConfigService();
|
|
47
47
|
try {
|
|
48
48
|
for (const [key, value] of answers) {
|
|
@@ -67,12 +67,15 @@ export async function offerPdf(config, input, result) {
|
|
|
67
67
|
// Ya se emitio: un Ctrl+C aca no puede terminar en "No se emitio nada".
|
|
68
68
|
try {
|
|
69
69
|
if (decision === 'preguntar' &&
|
|
70
|
-
!(await confirm('¿Generamos el PDF del comprobante?', '
|
|
70
|
+
!(await confirm('¿Generamos el PDF del comprobante?', 'Sí, generar el PDF', 'No'))) {
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
const description = await askText('
|
|
74
|
-
|
|
75
|
-
const
|
|
73
|
+
const description = await askText('Descripción del comprobante (Enter para "Según detalle")');
|
|
74
|
+
// Lo que trajo el padron se propone: Enter lo deja, en lugar de borrarlo.
|
|
75
|
+
const receiverName = await askText(input.receiverName
|
|
76
|
+
? 'Nombre o razón social del receptor:'
|
|
77
|
+
: 'Nombre o razón social del receptor (Enter para omitir)', { defaultValue: input.receiverName });
|
|
78
|
+
const receiverAddress = await askText(input.receiverAddress ? 'Domicilio del receptor:' : 'Domicilio del receptor (Enter para omitir)', { defaultValue: input.receiverAddress });
|
|
76
79
|
const completedConfig = await completeIssuer(config);
|
|
77
80
|
const withPdf = await attachPdfs({
|
|
78
81
|
config: completedConfig,
|
|
@@ -97,4 +100,3 @@ export async function offerPdf(config, input, result) {
|
|
|
97
100
|
writeTerminalOutput(noticePanel('El comprobante ya quedo emitido; no se genero el PDF.', 'muted'));
|
|
98
101
|
}
|
|
99
102
|
}
|
|
100
|
-
//# sourceMappingURL=pdf.flow.js.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { isIvaConditionAllowed } from '../../modules/billing/billing.iva-receptor.js';
|
|
2
|
+
import { ivaConditionChoices } from '../../modules/interactive/choices.js';
|
|
3
|
+
import { BACK } from '../../modules/interactive/wizard.js';
|
|
4
|
+
import { ArcaPadronGateway } from '../../services/arca/arca-padron.gateway.js';
|
|
5
|
+
import { startSpinner } from '../spinner.js';
|
|
6
|
+
import { chooseStep } from './prompts.js';
|
|
7
|
+
/** Consulta el padron si hay un CUIT y la config lo permite. Si falla, sigue sin datos: el usuario elige igual. */
|
|
8
|
+
async function lookupReceiver(session, state) {
|
|
9
|
+
const cuit = state.documentNumber;
|
|
10
|
+
if (state.documentType !== 'cuit' || !cuit || session.runtime.config.consultarPadron === false) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
if (state.receiver?.cuit === cuit) {
|
|
14
|
+
return state.receiver;
|
|
15
|
+
}
|
|
16
|
+
const spinner = startSpinner('Consultando el padrón...');
|
|
17
|
+
try {
|
|
18
|
+
const taxpayer = await new ArcaPadronGateway(session.arca).getTaxpayer(cuit);
|
|
19
|
+
return {
|
|
20
|
+
address: taxpayer?.address ?? undefined,
|
|
21
|
+
cuit,
|
|
22
|
+
ivaCondition: taxpayer?.ivaCondition ?? undefined,
|
|
23
|
+
name: taxpayer?.name ?? undefined,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return { cuit };
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
spinner?.stop();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Pregunta la condicion IVA del receptor. Con un CUIT, propone la del padron (marcada) y muestra el nombre;
|
|
35
|
+
* si no, la de la config.
|
|
36
|
+
*/
|
|
37
|
+
export async function askReceiverIvaCondition(session, state, letter, configDefault) {
|
|
38
|
+
const receiver = await lookupReceiver(session, state);
|
|
39
|
+
const fromPadron = receiver?.ivaCondition && isIvaConditionAllowed(letter, receiver.ivaCondition) ? receiver.ivaCondition : undefined;
|
|
40
|
+
const choices = ivaConditionChoices(letter).map((choice) => choice.value === fromPadron ? { ...choice, name: `${choice.name} (según el padrón)` } : choice);
|
|
41
|
+
const ivaCondition = await chooseStep(receiver?.name ? `Condición frente al IVA de ${receiver.name}:` : 'Condición frente al IVA del receptor:', choices, fromPadron ?? configDefault);
|
|
42
|
+
return ivaCondition === BACK ? BACK : { ivaCondition, receiver };
|
|
43
|
+
}
|
|
44
|
+
/** Nombre, domicilio y origen del IVA para la entrada del CLI: el PDF y la vista previa los muestran. */
|
|
45
|
+
export function receiverInputFields(state) {
|
|
46
|
+
const receiver = state.documentType === 'cuit' && state.receiver?.cuit === state.documentNumber ? state.receiver : undefined;
|
|
47
|
+
return {
|
|
48
|
+
ivaConditionSource: receiver?.ivaCondition && receiver.ivaCondition === state.ivaCondition ? 'padron' : undefined,
|
|
49
|
+
receiverAddress: receiver?.address,
|
|
50
|
+
receiverName: receiver?.name,
|
|
51
|
+
};
|
|
52
|
+
}
|