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
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { InputValidationError } from '../../lib/errors/app-error.js';
|
|
2
|
+
import { readJsonFile } from '../../lib/files/read-json-file.js';
|
|
3
|
+
import { mapExportJsonItems, readExportJsonInput } from '../../modules/export/export.json-input.js';
|
|
4
|
+
function pickString(...values) {
|
|
5
|
+
return values.find((value) => typeof value === 'string');
|
|
6
|
+
}
|
|
7
|
+
function pickNumber(...values) {
|
|
8
|
+
return values.find((value) => typeof value === 'number');
|
|
9
|
+
}
|
|
10
|
+
function pickBoolean(...values) {
|
|
11
|
+
return values.find((value) => typeof value === 'boolean');
|
|
12
|
+
}
|
|
13
|
+
function pickItems(flagsValue, fileItems) {
|
|
14
|
+
return Array.isArray(flagsValue) && flagsValue.length > 0 ? flagsValue : fileItems;
|
|
15
|
+
}
|
|
16
|
+
function pickList(flagsValue, fileValue) {
|
|
17
|
+
return Array.isArray(flagsValue) && flagsValue.length > 0 ? flagsValue : fileValue?.slice();
|
|
18
|
+
}
|
|
19
|
+
/** `--emitir` y `--previsualizar` deciden juntos, y el archivo de `--cargar` puede traer `emitir`. */
|
|
20
|
+
function resolveEmitDecision(flags, file, defaults) {
|
|
21
|
+
if (flags.emitir && flags.previsualizar) {
|
|
22
|
+
throw new InputValidationError('Usá --emitir o --previsualizar, no los dos.');
|
|
23
|
+
}
|
|
24
|
+
if (flags.emitir !== undefined) {
|
|
25
|
+
return { emit: flags.emitir, modeSource: 'flags' };
|
|
26
|
+
}
|
|
27
|
+
if (flags.previsualizar !== undefined) {
|
|
28
|
+
return { emit: !flags.previsualizar, modeSource: 'flags' };
|
|
29
|
+
}
|
|
30
|
+
if (file?.emitir !== undefined) {
|
|
31
|
+
return { emit: file.emitir, modeSource: 'file' };
|
|
32
|
+
}
|
|
33
|
+
if (file?.previsualizar !== undefined) {
|
|
34
|
+
return { emit: !file.previsualizar, modeSource: 'file' };
|
|
35
|
+
}
|
|
36
|
+
return { emit: defaults.defaultEmit ?? false, modeSource: 'default' };
|
|
37
|
+
}
|
|
38
|
+
/** Los flags ganan sobre el JSON de `--cargar`, igual que en facturacion. */
|
|
39
|
+
export function parseExportCommandPlan(command, defaults = {}) {
|
|
40
|
+
const options = command.optsWithGlobals();
|
|
41
|
+
const filePath = typeof options.cargar === 'string' ? options.cargar : undefined;
|
|
42
|
+
const file = filePath ? readExportJsonInput(readJsonFile(filePath)) : undefined;
|
|
43
|
+
const { emit, modeSource } = resolveEmitDecision({ emitir: pickBoolean(options.emitir), previsualizar: pickBoolean(options.previsualizar) }, file, defaults);
|
|
44
|
+
const destination = pickString(options.paisDestino, file?.paisDestino) ?? pickNumber(options.paisDestino, file?.paisDestino);
|
|
45
|
+
const currency = pickString(options.moneda, options.mda, file?.codigoMoneda);
|
|
46
|
+
const pdf = pickBoolean(options.exportarPdf, options.pdf) ?? (pickBoolean(options.sinPdf) === true ? false : undefined);
|
|
47
|
+
return {
|
|
48
|
+
input: {
|
|
49
|
+
activity: pickNumber(options.actividad, file?.actividad),
|
|
50
|
+
amount: pickNumber(options.monto, file?.monto),
|
|
51
|
+
clientAddress: pickString(options.domicilioCliente, file?.domicilioCliente),
|
|
52
|
+
clientCountryCuit: pickNumber(options.cuitPais, file?.cuitPais),
|
|
53
|
+
clientName: pickString(options.cliente, file?.cliente),
|
|
54
|
+
clientTaxId: pickString(options.idImpositivo, file?.idImpositivo),
|
|
55
|
+
commercialObservations: pickString(options.obsComerciales, file?.observacionesComerciales),
|
|
56
|
+
currencyCode: currency,
|
|
57
|
+
description: pickString(options.descripcion, file?.descripcion),
|
|
58
|
+
destinationCountry: destination === undefined ? undefined : String(destination),
|
|
59
|
+
emit,
|
|
60
|
+
exchangeRate: pickNumber(options.cotizacionMoneda, options.cm, file?.cotizacionMoneda),
|
|
61
|
+
exportType: pickNumber(options.tipoExpo, file?.tipoExpo),
|
|
62
|
+
incoterm: pickString(options.incoterm, file?.incoterm),
|
|
63
|
+
incotermDescription: pickString(options.incotermsDesc, file?.descripcionIncoterm),
|
|
64
|
+
items: pickItems(options.item, mapExportJsonItems(file?.items)),
|
|
65
|
+
language: pickNumber(options.idioma, file?.idioma),
|
|
66
|
+
modeSource,
|
|
67
|
+
observations: pickString(options.observaciones, file?.observaciones),
|
|
68
|
+
paymentDate: pickString(options.fechaPago, file?.fechaPago),
|
|
69
|
+
paymentTerms: pickString(options.formaPago, file?.formaPago),
|
|
70
|
+
pdf,
|
|
71
|
+
permits: pickList(options.permiso, file?.permisos),
|
|
72
|
+
permitsExisting: pickBoolean(options.permisoExistente, file?.permisoExistente),
|
|
73
|
+
pointOfSale: pickNumber(options.puntoVenta, options.pv, file?.puntoVenta),
|
|
74
|
+
requestId: pickNumber(options.idSolicitud, file?.idSolicitud),
|
|
75
|
+
sameCurrency: pickBoolean(options.mismaMoneda, file?.mismaMoneda),
|
|
76
|
+
voucherDate: pickString(options.fecha, file?.fechaComprobante),
|
|
77
|
+
voucherNumber: pickNumber(options.numero, file?.numero),
|
|
78
|
+
},
|
|
79
|
+
modeSource,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export function parseExportCommandInput(command, defaults = {}) {
|
|
83
|
+
return parseExportCommandPlan(command, defaults).input;
|
|
84
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { resolvePdfDecision } from '../../modules/pdf/pdf-decision.js';
|
|
2
|
+
import { resolvePdfIssuer } from '../../modules/pdf/pdf-issuer.js';
|
|
3
|
+
import { exportExportacionPdf, toPdfFailure } from '../../services/pdf/pdf-exporter.js';
|
|
4
|
+
import { isPromptCancellation } from '../interactive/prompts.js';
|
|
5
|
+
import { startSpinner } from '../spinner.js';
|
|
6
|
+
import { defaultPdfStepDependencies, loadPdfRenderer } from './billing.command.pdf.js';
|
|
7
|
+
/** Sin CAE no hay PDF: ni en vista previa ni en rechazados. */
|
|
8
|
+
function canHavePdf(result) {
|
|
9
|
+
return !result.dryRun && result.response.status !== 'rechazado' && Boolean(result.response.cae);
|
|
10
|
+
}
|
|
11
|
+
async function ask(deps, message, yesLabel) {
|
|
12
|
+
try {
|
|
13
|
+
return await deps.confirm(message, yesLabel, 'No');
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
// El comprobante ya se emitio: Ctrl+C en la pregunta del PDF es "No", no un error del comando.
|
|
17
|
+
if (isPromptCancellation(error)) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Genera el PDF del comprobante emitido. Nunca lanza: el comprobante ya esta emitido, asi que un error del PDF
|
|
25
|
+
* se devuelve en `pdf.error` y no cambia el codigo de salida.
|
|
26
|
+
*/
|
|
27
|
+
export async function attachExportPdf(result, options, deps = defaultPdfStepDependencies) {
|
|
28
|
+
if (!canHavePdf(result)) {
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
const decision = resolvePdfDecision({
|
|
32
|
+
flag: options.input.pdf,
|
|
33
|
+
interactive: options.interactive,
|
|
34
|
+
mode: options.config.pdf,
|
|
35
|
+
});
|
|
36
|
+
if (decision === 'omitir') {
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
if (decision === 'preguntar' && !(await ask(deps, '¿Generamos el PDF del comprobante?', 'Si, generar el PDF'))) {
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
const spinner = startSpinner('Generando PDF...');
|
|
43
|
+
try {
|
|
44
|
+
// Antes de descargar nada: sin los datos del emisor no se puede armar el PDF.
|
|
45
|
+
resolvePdfIssuer(options.config, result.voucherKind.letter);
|
|
46
|
+
const renderer = await loadPdfRenderer(deps.createPlugin(options.config), options.interactive, deps);
|
|
47
|
+
const path = await exportExportacionPdf({
|
|
48
|
+
config: options.config,
|
|
49
|
+
folder: deps.resolveFolder(options.config),
|
|
50
|
+
renderer,
|
|
51
|
+
result,
|
|
52
|
+
});
|
|
53
|
+
return { ...result, pdf: { path } };
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
return { ...result, pdf: toPdfFailure(error) };
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
spinner?.stop();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -1,35 +1,28 @@
|
|
|
1
1
|
import { formatDateAsArcaDate, parseArgentineDateInputAsArcaDate } from '../../lib/dates/arca-date.js';
|
|
2
|
-
import { InputValidationError } from '../../lib/errors/app-error.js';
|
|
3
2
|
import { formatFceObligationAsJson, formatFceObligationAsText } from '../../modules/fce/fce-obligation.presenter.js';
|
|
4
3
|
import { ArcaClientFactory } from '../../services/arca/arca-client.factory.js';
|
|
5
|
-
import { ArcaContextResolver } from '../../services/arca/arca-context.resolver.js';
|
|
6
4
|
import { ArcaFceObligationGateway } from '../../services/arca/arca-fce-obligation.gateway.js';
|
|
7
5
|
import { writeTerminalJson, writeTerminalOutput } from '../../ui/index.js';
|
|
6
|
+
import { resolveArcaRuntime } from '../arca-runtime.js';
|
|
7
|
+
import { getGlobalOptions, registerQueryOptions } from '../global-options.js';
|
|
8
8
|
import { configureSpanishHelp, createFceObligationHelp } from '../help.js';
|
|
9
9
|
import { startSpinner } from '../spinner.js';
|
|
10
|
-
import {
|
|
11
|
-
function parseCuit(value) {
|
|
12
|
-
const normalizedValue = value.trim();
|
|
13
|
-
if (!/^\d{11}$/.test(normalizedValue)) {
|
|
14
|
-
throw new InputValidationError(`El CUIT "${value}" no es valido: debe tener 11 digitos.`);
|
|
15
|
-
}
|
|
16
|
-
return Number(normalizedValue);
|
|
17
|
-
}
|
|
10
|
+
import { parseCuitArgument } from './cuit-argument.js';
|
|
18
11
|
export function registerFceObligationCommand(program) {
|
|
19
12
|
const command = program
|
|
20
13
|
.command('fce-obligado')
|
|
21
14
|
.argument('<cuit>', 'CUIT del receptor a consultar')
|
|
22
|
-
.description('consultar si un receptor
|
|
23
|
-
.option('-f, --fecha <fecha>', 'fecha de
|
|
15
|
+
.description('consultar si un receptor está obligado a recibir Factura de Crédito Electrónica (FCE)')
|
|
16
|
+
.option('-f, --fecha <fecha>', 'fecha de emisión a consultar; por defecto hoy')
|
|
24
17
|
.addHelpText('after', createFceObligationHelp());
|
|
25
|
-
|
|
18
|
+
registerQueryOptions(command);
|
|
26
19
|
configureSpanishHelp(command);
|
|
27
20
|
command.action(async (rawCuit, options, self) => {
|
|
28
|
-
const cuit =
|
|
21
|
+
const cuit = parseCuitArgument(rawCuit);
|
|
29
22
|
const issueDate = options.fecha
|
|
30
23
|
? parseArgentineDateInputAsArcaDate(options.fecha)
|
|
31
24
|
: formatDateAsArcaDate(new Date());
|
|
32
|
-
const runtime =
|
|
25
|
+
const runtime = resolveArcaRuntime(getGlobalOptions(self));
|
|
33
26
|
const spinner = runtime.outputJson ? null : startSpinner('Consultando ARCA...');
|
|
34
27
|
try {
|
|
35
28
|
const gateway = new ArcaFceObligationGateway(new ArcaClientFactory().create(runtime));
|
|
@@ -48,4 +41,3 @@ export function registerFceObligationCommand(program) {
|
|
|
48
41
|
}
|
|
49
42
|
});
|
|
50
43
|
}
|
|
51
|
-
//# sourceMappingURL=fce-obligation.command.js.map
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { InputValidationError } from '../../lib/errors/app-error.js';
|
|
2
|
+
import { getGlobalOptions, registerEnvironmentOptions } from '../global-options.js';
|
|
2
3
|
import { configureSpanishHelp } from '../help.js';
|
|
3
4
|
import { runInteractiveMode } from '../interactive/interactive-mode.js';
|
|
4
|
-
import { getGlobalOptions, registerGlobalOptions } from './billing.command.shared.js';
|
|
5
5
|
export function isInteractiveTerminal() {
|
|
6
6
|
return Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
7
7
|
}
|
|
8
8
|
export function registerInteractiveCommand(program) {
|
|
9
9
|
const command = program
|
|
10
10
|
.command('interactivo')
|
|
11
|
-
.description('asistente paso a paso para emitir comprobantes;
|
|
12
|
-
|
|
11
|
+
.description('asistente paso a paso para emitir comprobantes; también se abre con "arcli" sin argumentos');
|
|
12
|
+
// Solo el entorno: el asistente no tiene salida JSON ni respuesta bruta.
|
|
13
|
+
registerEnvironmentOptions(command);
|
|
13
14
|
configureSpanishHelp(command);
|
|
14
15
|
command.action(async (_options, self) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
throw new InputValidationError('El modo interactivo necesita una terminal interactiva y no admite --json. Use los comandos con flags.');
|
|
16
|
+
if (!isInteractiveTerminal()) {
|
|
17
|
+
throw new InputValidationError('El modo interactivo necesita una terminal interactiva. Usá los comandos con flags.');
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
// `--json` y `--bruto` se ignoran con un aviso: al asistente le llega solo el entorno.
|
|
20
|
+
const { produccion, testing } = getGlobalOptions(self);
|
|
21
|
+
await runInteractiveMode({ produccion, testing });
|
|
20
22
|
});
|
|
21
23
|
}
|
|
22
|
-
//# sourceMappingURL=interactive.command.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AppError } from '../../lib/errors/app-error.js';
|
|
2
|
+
import { formatPadronAsJson, formatPadronAsText } from '../../modules/padron/padron.presenter.js';
|
|
3
|
+
import { ArcaClientFactory } from '../../services/arca/arca-client.factory.js';
|
|
4
|
+
import { ArcaPadronGateway } from '../../services/arca/arca-padron.gateway.js';
|
|
5
|
+
import { writeTerminalJson, writeTerminalOutput } from '../../ui/index.js';
|
|
6
|
+
import { resolveArcaRuntime } from '../arca-runtime.js';
|
|
7
|
+
import { getGlobalOptions, registerQueryOptions } from '../global-options.js';
|
|
8
|
+
import { configureSpanishHelp, createPadronHelp } from '../help.js';
|
|
9
|
+
import { startSpinner } from '../spinner.js';
|
|
10
|
+
import { parseCuitArgument } from './cuit-argument.js';
|
|
11
|
+
export function registerPadronCommand(program) {
|
|
12
|
+
const command = program
|
|
13
|
+
.command('padron')
|
|
14
|
+
.argument('<cuit>', 'CUIT a consultar')
|
|
15
|
+
.description('consultar en el padrón de ARCA el nombre, domicilio y condición IVA de un CUIT')
|
|
16
|
+
.addHelpText('after', createPadronHelp());
|
|
17
|
+
registerQueryOptions(command);
|
|
18
|
+
configureSpanishHelp(command);
|
|
19
|
+
command.action(async (rawCuit, _options, self) => {
|
|
20
|
+
const cuit = parseCuitArgument(rawCuit);
|
|
21
|
+
const runtime = resolveArcaRuntime(getGlobalOptions(self));
|
|
22
|
+
const spinner = runtime.outputJson ? null : startSpinner('Consultando el padrón...');
|
|
23
|
+
try {
|
|
24
|
+
const taxpayer = await new ArcaPadronGateway(new ArcaClientFactory().create(runtime)).getTaxpayer(cuit);
|
|
25
|
+
spinner?.stop();
|
|
26
|
+
if (!taxpayer) {
|
|
27
|
+
throw new AppError(`El CUIT ${cuit} no figura en el padrón de ARCA (${runtime.environment}).`, {
|
|
28
|
+
code: 'TAXPAYER_NOT_FOUND',
|
|
29
|
+
suggestion: runtime.environment === 'testing'
|
|
30
|
+
? 'El padrón de testing tiene datos ficticios: probá con 20201797064.'
|
|
31
|
+
: 'Revisá el número.',
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const report = { environment: runtime.environment, taxpayer };
|
|
35
|
+
if (runtime.outputJson) {
|
|
36
|
+
writeTerminalJson(formatPadronAsJson(report));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
writeTerminalOutput(formatPadronAsText(report));
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
spinner?.stop();
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
@@ -4,14 +4,14 @@ import { filterCurrentEntries, resolveParameterTable, salesPointToEntry } from '
|
|
|
4
4
|
import { formatParameterEntriesAsJson, formatParameterEntriesAsText, formatParameterTablesAsJson, formatParameterTablesAsText, formatQuotationAsJson, formatQuotationAsText, formatStatusAsJson, formatStatusAsText, } from '../../modules/parameters/parameters.presenter.js';
|
|
5
5
|
import { buildStatusReport } from '../../modules/parameters/status.js';
|
|
6
6
|
import { ArcaClientFactory } from '../../services/arca/arca-client.factory.js';
|
|
7
|
-
import { ArcaContextResolver } from '../../services/arca/arca-context.resolver.js';
|
|
8
7
|
import { ArcaParametersGateway } from '../../services/arca/arca-parameters.gateway.js';
|
|
9
8
|
import { writeTerminalJson, writeTerminalOutput } from '../../ui/index.js';
|
|
9
|
+
import { resolveArcaRuntime } from '../arca-runtime.js';
|
|
10
|
+
import { getGlobalOptions, registerQueryOptions, resolveOutputJson } from '../global-options.js';
|
|
10
11
|
import { configureSpanishHelp } from '../help.js';
|
|
11
12
|
import { startSpinner } from '../spinner.js';
|
|
12
|
-
import { getGlobalOptions, registerGlobalOptions } from './billing.command.shared.js';
|
|
13
13
|
function createContext(command) {
|
|
14
|
-
const runtime =
|
|
14
|
+
const runtime = resolveArcaRuntime(getGlobalOptions(command));
|
|
15
15
|
return { gateway: new ArcaParametersGateway(new ArcaClientFactory().create(runtime)), runtime };
|
|
16
16
|
}
|
|
17
17
|
async function withSpinner(runtime, run) {
|
|
@@ -34,14 +34,15 @@ export function registerParametersCommands(program) {
|
|
|
34
34
|
const parameters = program
|
|
35
35
|
.command('parametros')
|
|
36
36
|
.argument('[tabla]', 'tabla a consultar; sin tabla lista las disponibles')
|
|
37
|
-
.argument('[moneda]', 'solo para "cotizacion":
|
|
38
|
-
.description('consultar tablas de ARCA: puntos de venta, tipos,
|
|
39
|
-
|
|
37
|
+
.argument('[moneda]', 'solo para "cotizacion": código de moneda, por ejemplo USD')
|
|
38
|
+
.description('consultar tablas de ARCA: puntos de venta, tipos, alícuotas, monedas y cotización');
|
|
39
|
+
registerQueryOptions(parameters);
|
|
40
40
|
configureSpanishHelp(parameters);
|
|
41
41
|
parameters.action(async (rawTable, currency, _options, self) => {
|
|
42
42
|
if (!rawTable) {
|
|
43
|
-
// No consulta ARCA: no hace falta config ni credenciales para ver las tablas
|
|
44
|
-
|
|
43
|
+
// No consulta ARCA: no hace falta config ni credenciales para ver las tablas (si la config no se puede
|
|
44
|
+
// leer, sale en texto salvo con --json).
|
|
45
|
+
if (resolveOutputJson(self)) {
|
|
45
46
|
writeTerminalJson(formatParameterTablesAsJson());
|
|
46
47
|
}
|
|
47
48
|
else {
|
|
@@ -51,7 +52,7 @@ export function registerParametersCommands(program) {
|
|
|
51
52
|
}
|
|
52
53
|
if (rawTable.trim().toLowerCase() === 'cotizacion') {
|
|
53
54
|
if (!currency) {
|
|
54
|
-
throw new InputValidationError('
|
|
55
|
+
throw new InputValidationError('Indicá la moneda, por ejemplo: arcli parametros cotizacion USD.');
|
|
55
56
|
}
|
|
56
57
|
const { gateway, runtime } = createContext(self);
|
|
57
58
|
const quotation = await withSpinner(runtime, () => gateway.getQuotation(currency));
|
|
@@ -67,8 +68,8 @@ export function registerParametersCommands(program) {
|
|
|
67
68
|
});
|
|
68
69
|
const status = program
|
|
69
70
|
.command('estado')
|
|
70
|
-
.description('ver si ARCA responde y si el punto de venta configurado
|
|
71
|
-
|
|
71
|
+
.description('ver si ARCA responde y si el punto de venta configurado está habilitado');
|
|
72
|
+
registerQueryOptions(status);
|
|
72
73
|
configureSpanishHelp(status);
|
|
73
74
|
status.action(async (_options, self) => {
|
|
74
75
|
const { gateway, runtime } = createContext(self);
|
|
@@ -77,7 +78,7 @@ export function registerParametersCommands(program) {
|
|
|
77
78
|
return await buildStatusReport({ environment: runtime.environment, gateway, pointOfSale: runtime.pointOfSale });
|
|
78
79
|
}
|
|
79
80
|
catch (error) {
|
|
80
|
-
throw new AppError(`ARCA no
|
|
81
|
+
throw new AppError(`ARCA no respondió: ${error instanceof Error ? error.message : String(error)}`, {
|
|
81
82
|
code: 'ARCA_UNAVAILABLE',
|
|
82
83
|
});
|
|
83
84
|
}
|
|
@@ -85,4 +86,3 @@ export function registerParametersCommands(program) {
|
|
|
85
86
|
write(runtime, formatStatusAsText(report), formatStatusAsJson(report));
|
|
86
87
|
});
|
|
87
88
|
}
|
|
88
|
-
//# sourceMappingURL=parameters.command.js.map
|
|
@@ -2,22 +2,23 @@ import { join } from 'node:path';
|
|
|
2
2
|
import { ConfigService } from '../../modules/config/config.service.js';
|
|
3
3
|
import { PdfPlugin } from '../../services/pdf/pdf-plugin.js';
|
|
4
4
|
import { formatPdfPluginStatusAsJson, formatPdfPluginStatusAsText, noticePanel, writeTerminalJson, writeTerminalOutput, } from '../../ui/index.js';
|
|
5
|
+
import { registerJsonOption, resolveOutputJson } from '../global-options.js';
|
|
5
6
|
import { configureSpanishHelp } from '../help.js';
|
|
6
7
|
import { startSpinner } from '../spinner.js';
|
|
7
|
-
function
|
|
8
|
+
function createContext(command) {
|
|
8
9
|
const service = new ConfigService();
|
|
9
10
|
try {
|
|
10
11
|
const config = service.getConfig();
|
|
11
|
-
return
|
|
12
|
+
return {
|
|
13
|
+
json: resolveOutputJson(command, config),
|
|
14
|
+
plugin: new PdfPlugin({ configuredBrowser: config.pdfNavegador, path: join(service.getPluginsPath(), 'pdf') }),
|
|
15
|
+
};
|
|
12
16
|
}
|
|
13
17
|
finally {
|
|
14
18
|
service.close();
|
|
15
19
|
}
|
|
16
20
|
}
|
|
17
|
-
function
|
|
18
|
-
return command.optsWithGlobals().json === true;
|
|
19
|
-
}
|
|
20
|
-
function printStatus(plugin, json, title) {
|
|
21
|
+
function printStatus({ json, plugin }, title) {
|
|
21
22
|
const status = plugin.getStatus();
|
|
22
23
|
if (json) {
|
|
23
24
|
writeTerminalJson(formatPdfPluginStatusAsJson(status));
|
|
@@ -26,26 +27,16 @@ function printStatus(plugin, json, title) {
|
|
|
26
27
|
writeTerminalOutput(formatPdfPluginStatusAsText(status, title));
|
|
27
28
|
}
|
|
28
29
|
export function registerPdfCommand(program) {
|
|
29
|
-
const pdfCommand = program
|
|
30
|
-
.command('pdf')
|
|
31
|
-
.description('instalar o revisar el plugin que genera los PDFs de los comprobantes')
|
|
32
|
-
.option('--json', 'imprimir salida JSON')
|
|
33
|
-
.action((_options, command) => printStatus(createPlugin(), wantsJson(command)));
|
|
30
|
+
const pdfCommand = registerJsonOption(program.command('pdf').description('instalar o revisar el plugin que genera los PDFs de los comprobantes')).action((_options, command) => printStatus(createContext(command)));
|
|
34
31
|
configureSpanishHelp(pdfCommand);
|
|
35
|
-
const estadoCommand = pdfCommand
|
|
36
|
-
.command('estado')
|
|
37
|
-
.description('mostrar si el plugin esta instalado, su version y el navegador que usa')
|
|
38
|
-
.option('--json', 'imprimir salida JSON')
|
|
39
|
-
.action((_options, command) => printStatus(createPlugin(), wantsJson(command)));
|
|
32
|
+
const estadoCommand = registerJsonOption(pdfCommand.command('estado').description('mostrar si el plugin está instalado, su versión y el navegador que usa')).action((_options, command) => printStatus(createContext(command)));
|
|
40
33
|
configureSpanishHelp(estadoCommand);
|
|
41
34
|
// Pedir el comando ya es la confirmacion: no se vuelve a preguntar, asi tambien sirve en scripts.
|
|
42
|
-
const instalarCommand = pdfCommand
|
|
35
|
+
const instalarCommand = registerJsonOption(pdfCommand
|
|
43
36
|
.command('instalar')
|
|
44
|
-
.description('descargar el plugin de PDF (~160 MB, o ~360 MB si no hay Chrome instalado)')
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const json = wantsJson(command);
|
|
48
|
-
const plugin = createPlugin();
|
|
37
|
+
.description('descargar el plugin de PDF (~160 MB, o ~360 MB si no hay Chrome instalado)')).action(async (_options, command) => {
|
|
38
|
+
const context = createContext(command);
|
|
39
|
+
const { json, plugin } = context;
|
|
49
40
|
const spinner = json ? null : startSpinner('Instalando el plugin de PDF...');
|
|
50
41
|
try {
|
|
51
42
|
await plugin.install((message) => {
|
|
@@ -57,17 +48,13 @@ export function registerPdfCommand(program) {
|
|
|
57
48
|
finally {
|
|
58
49
|
spinner?.stop();
|
|
59
50
|
}
|
|
60
|
-
printStatus(
|
|
51
|
+
printStatus(context, 'Plugin de PDF instalado');
|
|
61
52
|
});
|
|
62
53
|
configureSpanishHelp(instalarCommand);
|
|
63
|
-
const desinstalarCommand = pdfCommand
|
|
64
|
-
|
|
65
|
-
.description('borrar el plugin de PDF y el navegador que haya descargado')
|
|
66
|
-
.option('--json', 'imprimir salida JSON')
|
|
67
|
-
.action((_options, command) => {
|
|
68
|
-
const plugin = createPlugin();
|
|
54
|
+
const desinstalarCommand = registerJsonOption(pdfCommand.command('desinstalar').description('borrar el plugin de PDF y el navegador que haya descargado')).action((_options, command) => {
|
|
55
|
+
const { json, plugin } = createContext(command);
|
|
69
56
|
plugin.uninstall();
|
|
70
|
-
if (
|
|
57
|
+
if (json) {
|
|
71
58
|
writeTerminalJson(JSON.stringify({ desinstalado: true, ruta: plugin.getStatus().path }, null, 2));
|
|
72
59
|
return;
|
|
73
60
|
}
|
|
@@ -75,4 +62,3 @@ export function registerPdfCommand(program) {
|
|
|
75
62
|
});
|
|
76
63
|
configureSpanishHelp(desinstalarCommand);
|
|
77
64
|
}
|
|
78
|
-
//# sourceMappingURL=pdf.command.js.map
|
|
@@ -12,16 +12,16 @@ const STORYBOOK_SCENES = [
|
|
|
12
12
|
];
|
|
13
13
|
export function registerStorybookCommand(program) {
|
|
14
14
|
const command = program
|
|
15
|
-
.
|
|
15
|
+
// Herramienta de desarrollo: funciona, pero no se lista en la ayuda.
|
|
16
|
+
.command('storybook', { hidden: true })
|
|
16
17
|
.description('ver escenas visuales del CLI con datos de ejemplo')
|
|
17
|
-
.argument('[escena]', 'bordes, comprobantes, colores, componentes,
|
|
18
|
+
.argument('[escena]', 'bordes, comprobantes, colores, componentes, configuración, errores o json')
|
|
18
19
|
.action((scene) => {
|
|
19
20
|
if (scene && !STORYBOOK_SCENES.includes(scene)) {
|
|
20
|
-
throw new InputValidationError(`La escena "${scene}" no es
|
|
21
|
+
throw new InputValidationError(`La escena "${scene}" no es válida. Usá bordes, comprobantes, colores, componentes, configuración, errores o json.`);
|
|
21
22
|
}
|
|
22
23
|
writeTerminalOutput(renderStorybookShowcase(scene));
|
|
23
24
|
})
|
|
24
25
|
.addHelpText('after', createStorybookHelp());
|
|
25
26
|
configureSpanishHelp(command);
|
|
26
27
|
}
|
|
27
|
-
//# sourceMappingURL=storybook.command.js.map
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
import { AppError, InputValidationError } from '../../lib/errors/app-error.js';
|
|
2
|
+
import { parseStrictInteger } from '../../lib/numbers/strict-integer.js';
|
|
2
3
|
import { getVoucherKindByShortcut, VOUCHER_SHORTCUTS } from '../../modules/billing/voucher-kind-map.js';
|
|
3
4
|
import { listRecentVouchers, MAX_RECENT_VOUCHERS, RECENT_VOUCHERS_LIMIT } from '../../modules/vouchers/voucher-history.js';
|
|
4
5
|
import { formatVoucherDetailAsJson, formatVoucherDetailAsText, formatVoucherListAsJson, formatVoucherListAsText, formatVoucherNumber, } from '../../modules/vouchers/voucher-history.presenter.js';
|
|
5
6
|
import { ArcaClientFactory } from '../../services/arca/arca-client.factory.js';
|
|
6
|
-
import { ArcaContextResolver } from '../../services/arca/arca-context.resolver.js';
|
|
7
7
|
import { ArcaVoucherHistoryGateway } from '../../services/arca/arca-voucher-history.gateway.js';
|
|
8
8
|
import { writeTerminalJson, writeTerminalOutput } from '../../ui/index.js';
|
|
9
|
+
import { resolveArcaRuntime } from '../arca-runtime.js';
|
|
10
|
+
import { getGlobalOptions, registerQueryOptions } from '../global-options.js';
|
|
9
11
|
import { configureSpanishHelp, createVoucherQueryHelp } from '../help.js';
|
|
10
12
|
import { integerOption } from '../option-parsers.js';
|
|
11
13
|
import { startSpinner } from '../spinner.js';
|
|
12
|
-
import { getGlobalOptions, registerGlobalOptions } from './billing.command.shared.js';
|
|
13
14
|
function requireVoucherKind(shortcut) {
|
|
14
15
|
const voucherKind = getVoucherKindByShortcut(shortcut.trim().toLowerCase());
|
|
15
16
|
if (!voucherKind) {
|
|
16
|
-
throw new InputValidationError(`El tipo "${shortcut}" no es
|
|
17
|
+
throw new InputValidationError(`El tipo "${shortcut}" no es válido. Usá un atajo: ${VOUCHER_SHORTCUTS.join(', ')}.`);
|
|
17
18
|
}
|
|
18
19
|
return voucherKind;
|
|
19
20
|
}
|
|
20
21
|
function requirePointOfSale(options, runtime) {
|
|
21
22
|
const pointOfSale = options.pv ?? options.puntoVenta ?? runtime.pointOfSale;
|
|
22
23
|
if (!pointOfSale || !Number.isInteger(pointOfSale) || pointOfSale <= 0) {
|
|
23
|
-
throw new InputValidationError('Falta el punto de venta.
|
|
24
|
+
throw new InputValidationError('Falta el punto de venta. Usá --pv <numero> o configuralo con "arcli config establecer puntoVenta <numero>".');
|
|
24
25
|
}
|
|
25
26
|
return pointOfSale;
|
|
26
27
|
}
|
|
27
28
|
function createContext(command) {
|
|
28
|
-
const runtime =
|
|
29
|
+
const runtime = resolveArcaRuntime(getGlobalOptions(command));
|
|
29
30
|
return { gateway: new ArcaVoucherHistoryGateway(new ArcaClientFactory().create(runtime)), runtime };
|
|
30
31
|
}
|
|
31
32
|
function addPointOfSaleOptions(command) {
|
|
@@ -46,15 +47,15 @@ export function registerVoucherQueryCommands(program) {
|
|
|
46
47
|
const recent = addPointOfSaleOptions(program
|
|
47
48
|
.command('ultimos')
|
|
48
49
|
.argument('<tipo>', 'atajo del comprobante, por ejemplo fb, fc o nca')
|
|
49
|
-
.description('listar los
|
|
50
|
+
.description('listar los últimos comprobantes emitidos en ARCA')
|
|
50
51
|
.option('--cantidad <numero>', `cuantos comprobantes mostrar (1 a ${MAX_RECENT_VOUCHERS}; por defecto config.comprobantesPorLista o ${RECENT_VOUCHERS_LIMIT})`, integerOption('--cantidad'))).addHelpText('after', createVoucherQueryHelp());
|
|
51
|
-
|
|
52
|
+
registerQueryOptions(recent);
|
|
52
53
|
configureSpanishHelp(recent);
|
|
53
54
|
recent.action(async (shortcut, options, self) => {
|
|
54
55
|
const voucherKind = requireVoucherKind(shortcut);
|
|
55
56
|
const { cantidad } = options;
|
|
56
57
|
if (cantidad !== undefined && (!Number.isInteger(cantidad) || cantidad < 1 || cantidad > MAX_RECENT_VOUCHERS)) {
|
|
57
|
-
throw new InputValidationError(`--cantidad tiene que ser un
|
|
58
|
+
throw new InputValidationError(`--cantidad tiene que ser un número entre 1 y ${MAX_RECENT_VOUCHERS}.`);
|
|
58
59
|
}
|
|
59
60
|
const { gateway, runtime } = createContext(self);
|
|
60
61
|
const limit = cantidad ?? runtime.config.comprobantesPorLista ?? RECENT_VOUCHERS_LIMIT;
|
|
@@ -70,15 +71,15 @@ export function registerVoucherQueryCommands(program) {
|
|
|
70
71
|
const detail = addPointOfSaleOptions(program
|
|
71
72
|
.command('consultar')
|
|
72
73
|
.argument('<tipo>', 'atajo del comprobante, por ejemplo fb, fc o nca')
|
|
73
|
-
.argument('<numero>', '
|
|
74
|
+
.argument('<numero>', 'número del comprobante')
|
|
74
75
|
.description('ver el detalle de un comprobante emitido en ARCA')).addHelpText('after', createVoucherQueryHelp());
|
|
75
|
-
|
|
76
|
+
registerQueryOptions(detail);
|
|
76
77
|
configureSpanishHelp(detail);
|
|
77
78
|
detail.action(async (shortcut, rawNumber, options, self) => {
|
|
78
79
|
const voucherKind = requireVoucherKind(shortcut);
|
|
79
|
-
const number =
|
|
80
|
-
if (
|
|
81
|
-
throw new InputValidationError(`El
|
|
80
|
+
const number = parseStrictInteger(rawNumber);
|
|
81
|
+
if (number === undefined || number <= 0) {
|
|
82
|
+
throw new InputValidationError(`El número "${rawNumber}" no es válido: tiene que ser un entero positivo.`);
|
|
82
83
|
}
|
|
83
84
|
const { gateway, runtime } = createContext(self);
|
|
84
85
|
const pointOfSale = requirePointOfSale(options, runtime);
|
|
@@ -94,4 +95,3 @@ export function registerVoucherQueryCommands(program) {
|
|
|
94
95
|
writeTerminalOutput(formatVoucherDetailAsText(report));
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
|
-
//# sourceMappingURL=vouchers.command.js.map
|