arcli 2.1.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 +52 -1
- package/README.md +6 -0
- package/dist/cli/arca-runtime.js +0 -1
- 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 +0 -1
- package/dist/cli/commands/billing.command.interactive-preview.js +9 -13
- package/dist/cli/commands/billing.command.options.js +83 -39
- package/dist/cli/commands/billing.command.output.js +0 -1
- package/dist/cli/commands/billing.command.parser.js +18 -17
- package/dist/cli/commands/billing.command.pdf.js +9 -6
- package/dist/cli/commands/billing.command.shared.js +2 -2
- 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 +9 -10
- package/dist/cli/commands/cuit-argument.js +6 -6
- 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 +2 -3
- package/dist/cli/commands/interactive.command.js +2 -3
- package/dist/cli/commands/padron.command.js +5 -6
- package/dist/cli/commands/parameters.command.js +5 -6
- package/dist/cli/commands/pdf.command.js +1 -2
- package/dist/cli/commands/storybook.command.js +4 -4
- package/dist/cli/commands/vouchers.command.js +9 -9
- package/dist/cli/error-output.js +21 -3
- package/dist/cli/global-options.js +2 -3
- package/dist/cli/help-argv.js +0 -1
- package/dist/cli/help.js +186 -380
- package/dist/cli/ignored-global-options.js +1 -2
- package/dist/cli/index.js +5 -3
- package/dist/cli/interactive/advanced-options.js +13 -14
- package/dist/cli/interactive/config.flow.js +55 -17
- 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 +16 -17
- package/dist/cli/interactive/invoice-picker.js +7 -7
- package/dist/cli/interactive/invoice.flow.js +32 -11
- package/dist/cli/interactive/note.flow.js +12 -13
- package/dist/cli/interactive/pdf.flow.js +9 -7
- package/dist/cli/interactive/prompts.js +0 -1
- package/dist/cli/interactive/receiver-padron.js +3 -4
- package/dist/cli/interactive/repeat.flow.js +7 -8
- package/dist/cli/interactive/session.js +9 -7
- 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 +6 -3
- 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 +0 -1
- 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 +0 -1
- package/dist/lib/identity/cuit.js +26 -0
- package/dist/lib/identity/format-cuit.js +1 -2
- package/dist/lib/links.js +0 -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 +0 -1
- package/dist/lib/security/pem.js +2 -3
- package/dist/modules/billing/billing-response.js +6 -7
- 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 +7 -6
- 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 +1 -2
- package/dist/modules/billing/billing.display.js +10 -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 +5 -6
- 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 +9 -5
- package/dist/modules/billing/billing.presenter.js +0 -1
- package/dist/modules/billing/billing.schemas.js +14 -6
- package/dist/modules/billing/billing.serialize.js +6 -3
- package/dist/modules/billing/billing.service.js +4 -4
- package/dist/modules/billing/billing.text.js +0 -1
- 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 +3 -4
- package/dist/modules/config/config-doctor.js +36 -14
- package/dist/modules/config/config-value-parser.js +29 -16
- package/dist/modules/config/config.export-credentials.js +23 -0
- package/dist/modules/config/config.presenter.js +22 -6
- package/dist/modules/config/config.schemas.js +24 -12
- package/dist/modules/config/config.sections.js +26 -11
- package/dist/modules/config/config.service.js +6 -2
- package/dist/modules/examples/examples.js +44 -10
- 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 +11 -3
- package/dist/modules/interactive/equivalent-command.js +4 -1
- 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 +0 -1
- package/dist/modules/padron/padron.presenter.js +6 -7
- package/dist/modules/parameters/health.js +0 -1
- package/dist/modules/parameters/parameters.js +2 -3
- package/dist/modules/parameters/parameters.presenter.js +12 -13
- 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 +20 -21
- 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 +4 -5
- package/dist/services/arca/arca-client.factory.js +23 -2
- package/dist/services/arca/arca-context.resolver.js +5 -6
- 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 +1 -2
- 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 +15 -2
- package/dist/services/pdf/pdf-plugin.js +41 -14
- package/dist/ui/components/certificateBanner.js +0 -1
- package/dist/ui/components/contentPanel.js +0 -1
- package/dist/ui/components/errorPanel.js +0 -1
- package/dist/ui/components/index.js +0 -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 +0 -1
- package/dist/ui/presenters/errors.presenter.js +10 -11
- package/dist/ui/presenters/errors.zod-presenter.js +8 -9
- 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 +0 -1
- package/dist/ui/theme/index.js +0 -1
- package/dist/ui/theme/theme.js +0 -1
- package/llms.txt +64 -5
- package/package.json +1 -2
- package/dist/cli/arca-runtime.d.ts +0 -20
- package/dist/cli/arca-runtime.js.map +0 -1
- 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 -32
- 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 -18
- package/dist/cli/commands/billing.command.output.js.map +0 -1
- package/dist/cli/commands/billing.command.parser.d.ts +0 -35
- 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 -26
- 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 -6
- package/dist/cli/commands/config.command.js.map +0 -1
- package/dist/cli/commands/cuit-argument.d.ts +0 -2
- package/dist/cli/commands/cuit-argument.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/padron.command.d.ts +0 -2
- package/dist/cli/commands/padron.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 -25
- package/dist/cli/error-output.js.map +0 -1
- package/dist/cli/global-options.d.ts +0 -26
- package/dist/cli/global-options.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 -14
- package/dist/cli/help.js.map +0 -1
- package/dist/cli/ignored-global-options.d.ts +0 -6
- package/dist/cli/ignored-global-options.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 -4
- 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 -22
- package/dist/cli/interactive/invoice.flow.js.map +0 -1
- package/dist/cli/interactive/note.flow.d.ts +0 -34
- 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/receiver-padron.d.ts +0 -29
- package/dist/cli/interactive/receiver-padron.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 -6
- 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/files/write-new-file.d.ts +0 -5
- package/dist/lib/files/write-new-file.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 -4
- 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 -11
- 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.json-input.d.ts +0 -58
- package/dist/modules/billing/billing.json-input.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.padron.d.ts +0 -14
- package/dist/modules/billing/billing.padron.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 -147
- package/dist/modules/billing/billing.schemas.js.map +0 -1
- package/dist/modules/billing/billing.serialize.d.ts +0 -9
- package/dist/modules/billing/billing.serialize.js.map +0 -1
- package/dist/modules/billing/billing.service.d.ts +0 -30
- 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 -38
- 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/certificate-expiry.d.ts +0 -42
- package/dist/modules/config/certificate-expiry.js.map +0 -1
- package/dist/modules/config/config-doctor.d.ts +0 -16
- 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 -17
- package/dist/modules/config/config.presenter.js.map +0 -1
- package/dist/modules/config/config.schemas.d.ts +0 -156
- 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 -6
- 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/padron/padron.d.ts +0 -46
- package/dist/modules/padron/padron.js.map +0 -1
- package/dist/modules/padron/padron.presenter.d.ts +0 -7
- package/dist/modules/padron/padron.presenter.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 -16
- package/dist/services/arca/arca-billing.gateway.js.map +0 -1
- package/dist/services/arca/arca-client.factory.d.ts +0 -6
- package/dist/services/arca/arca-client.factory.js.map +0 -1
- package/dist/services/arca/arca-context.resolver.d.ts +0 -55
- 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-padron.gateway.d.ts +0 -9
- package/dist/services/arca/arca-padron.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 -22
- 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/certificateBanner.d.ts +0 -11
- package/dist/ui/components/certificateBanner.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 -10
- 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 -21
- 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
|
@@ -6,7 +6,7 @@ import { InputValidationError } from '../../lib/errors/app-error.js';
|
|
|
6
6
|
* Es `.strict()`: una clave que no esta aca es un error, para que un typo no se ignore en silencio.
|
|
7
7
|
*/
|
|
8
8
|
const ivaRateJsonSchema = z.union([z.string(), z.number()], {
|
|
9
|
-
error: 'tiene que ser un texto ("general", "10.5") o un
|
|
9
|
+
error: 'tiene que ser un texto ("general", "10.5") o un número (10.5)',
|
|
10
10
|
});
|
|
11
11
|
const associatedVoucherJsonSchema = z
|
|
12
12
|
.object({
|
|
@@ -182,7 +182,7 @@ function formatPath(path) {
|
|
|
182
182
|
function describeExpected(expected) {
|
|
183
183
|
switch (expected) {
|
|
184
184
|
case 'number':
|
|
185
|
-
return 'un
|
|
185
|
+
return 'un número';
|
|
186
186
|
case 'string':
|
|
187
187
|
return 'un texto';
|
|
188
188
|
case 'boolean':
|
|
@@ -234,7 +234,7 @@ function describeIssue(issue) {
|
|
|
234
234
|
}
|
|
235
235
|
if (path.length === 0) {
|
|
236
236
|
return [
|
|
237
|
-
{ mensaje: `Cada comprobante tiene que ser un objeto y
|
|
237
|
+
{ mensaje: `Cada comprobante tiene que ser un objeto y llegó ${describeReceived(issue.input)}.`, ruta: [] },
|
|
238
238
|
];
|
|
239
239
|
}
|
|
240
240
|
const unquote = issue.expected === 'number' && typeof issue.input === 'string' && issue.input.trim() !== ''
|
|
@@ -242,7 +242,7 @@ function describeIssue(issue) {
|
|
|
242
242
|
: '';
|
|
243
243
|
return [
|
|
244
244
|
{
|
|
245
|
-
mensaje: `"${pathLabel}" tiene que ser ${describeExpected(issue.expected)} y
|
|
245
|
+
mensaje: `"${pathLabel}" tiene que ser ${describeExpected(issue.expected)} y llegó ${describeReceived(issue.input)}.${unquote}`,
|
|
246
246
|
ruta: path.map(String),
|
|
247
247
|
},
|
|
248
248
|
];
|
|
@@ -267,7 +267,7 @@ export function parseBillingJsonInput(value) {
|
|
|
267
267
|
export function readBillingJsonItems(source) {
|
|
268
268
|
if (Array.isArray(source)) {
|
|
269
269
|
if (source.length === 0) {
|
|
270
|
-
throw new InputValidationError('El JSON de --cargar es un lote
|
|
270
|
+
throw new InputValidationError('El JSON de --cargar es un lote vacío: no hay comprobantes para procesar.');
|
|
271
271
|
}
|
|
272
272
|
return source;
|
|
273
273
|
}
|
|
@@ -276,4 +276,3 @@ export function readBillingJsonItems(source) {
|
|
|
276
276
|
}
|
|
277
277
|
return [source];
|
|
278
278
|
}
|
|
279
|
-
//# sourceMappingURL=billing.json-input.js.map
|
|
@@ -76,7 +76,7 @@ export function formatCurrencyLabel(value) {
|
|
|
76
76
|
case 'PES':
|
|
77
77
|
return 'Pesos argentinos (ARS)';
|
|
78
78
|
case 'DOL':
|
|
79
|
-
return '
|
|
79
|
+
return 'Dólares estadounidenses (USD)';
|
|
80
80
|
default:
|
|
81
81
|
return value ?? 'N/D';
|
|
82
82
|
}
|
|
@@ -105,4 +105,3 @@ export function formatDecimalLabel(value) {
|
|
|
105
105
|
maximumFractionDigits: 6,
|
|
106
106
|
}).format(value);
|
|
107
107
|
}
|
|
108
|
-
//# sourceMappingURL=billing.labels.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AppError, InputValidationError } from '../../lib/errors/app-error.js';
|
|
2
2
|
import { formatIvaConditionName } from '../pdf/pdf-issuer.js';
|
|
3
|
-
const MISSING_IVA_HINT = '
|
|
3
|
+
const MISSING_IVA_HINT = 'Usá --ir <tipo> o un flag --ir-*, o configurá uno por defecto con "arcli config establecer ivaReceptor <tipo>".';
|
|
4
4
|
/** Hay que consultar el padron: un CUIT sin IVA receptor explicito (vino de la config o falta). */
|
|
5
5
|
export function needsPadronLookup(input) {
|
|
6
6
|
return (input.documentType === 'cuit' &&
|
|
@@ -34,22 +34,26 @@ export async function resolveIvaConditionFromPadron(input, gateway) {
|
|
|
34
34
|
}
|
|
35
35
|
catch (error) {
|
|
36
36
|
const message = error instanceof Error ? error.message.replace(/\.$/, '') : 'error desconocido';
|
|
37
|
-
return fallBack(input, `No se pudo consultar el
|
|
37
|
+
return fallBack(input, `No se pudo consultar el padrón de ARCA (${message})`, lookupErrorHint(error));
|
|
38
38
|
}
|
|
39
39
|
if (!taxpayer) {
|
|
40
|
-
return fallBack(input, `El CUIT ${cuit} no figura en el
|
|
40
|
+
return fallBack(input, `El CUIT ${cuit} no figura en el padrón de ARCA`);
|
|
41
41
|
}
|
|
42
|
+
const fromPadron = [
|
|
43
|
+
...(!input.receiverAddress && taxpayer.address ? ['address'] : []),
|
|
44
|
+
...(!input.receiverName && taxpayer.name ? ['name'] : []),
|
|
45
|
+
];
|
|
42
46
|
const withReceiver = {
|
|
43
47
|
...input,
|
|
44
48
|
receiverAddress: input.receiverAddress ?? taxpayer.address ?? undefined,
|
|
49
|
+
receiverFromPadron: fromPadron.length > 0 ? fromPadron : undefined,
|
|
45
50
|
receiverName: input.receiverName ?? taxpayer.name ?? undefined,
|
|
46
51
|
};
|
|
47
52
|
if (!taxpayer.ivaCondition) {
|
|
48
|
-
return fallBack(withReceiver, `El
|
|
53
|
+
return fallBack(withReceiver, `El padrón de ARCA no informa la condición IVA del CUIT ${cuit}`);
|
|
49
54
|
}
|
|
50
55
|
return {
|
|
51
56
|
input: { ...withReceiver, ivaCondition: taxpayer.ivaCondition, ivaConditionSource: 'padron' },
|
|
52
57
|
warnings: [],
|
|
53
58
|
};
|
|
54
59
|
}
|
|
55
|
-
//# sourceMappingURL=billing.padron.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { parseCuit } from '../../lib/identity/cuit.js';
|
|
2
3
|
import { AMOUNT_DECIMALS, EXCHANGE_RATE_DECIMALS, hasAtMostDecimals } from '../../lib/numbers/argentine-amount.js';
|
|
3
4
|
const BILLING_CONCEPT_ALIASES = {
|
|
4
5
|
p: 'productos',
|
|
@@ -52,13 +53,13 @@ export function normalizeIvaRateInput(value) {
|
|
|
52
53
|
const normalized = value.trim().toLowerCase();
|
|
53
54
|
return IVA_RATE_ALIASES[normalized] ?? normalized.replace(',', '.').replace(/%$/, '');
|
|
54
55
|
}
|
|
55
|
-
export const billingIvaRateSchema = z.preprocess(normalizeIvaRateInput, z.enum(IVA_RATE_VALUES, { message: `La
|
|
56
|
+
export const billingIvaRateSchema = z.preprocess(normalizeIvaRateInput, z.enum(IVA_RATE_VALUES, { message: `La alícuota debe ser ${IVA_RATE_HINT}.` }));
|
|
56
57
|
/** Importe positivo con los decimales que acepta ARCA: 2 en importes y 6 en la cotizacion. */
|
|
57
58
|
function positiveAmountSchema(decimals = AMOUNT_DECIMALS) {
|
|
58
59
|
return z
|
|
59
60
|
.number()
|
|
60
61
|
.positive()
|
|
61
|
-
.refine((value) => hasAtMostDecimals(value, decimals), { message: `
|
|
62
|
+
.refine((value) => hasAtMostDecimals(value, decimals), { message: `Usá hasta ${decimals} decimales.` });
|
|
62
63
|
}
|
|
63
64
|
/** Una alicuota con el importe que le corresponde, IVA incluido (igual que --monto). */
|
|
64
65
|
const billingIvaRateAmountSchema = z.object({
|
|
@@ -69,8 +70,14 @@ const billingAssociatedVoucherSchema = z
|
|
|
69
70
|
.object({
|
|
70
71
|
cuit: z
|
|
71
72
|
.string()
|
|
72
|
-
.
|
|
73
|
-
|
|
73
|
+
.transform((value, context) => {
|
|
74
|
+
const result = parseCuit(value);
|
|
75
|
+
if (!result.ok) {
|
|
76
|
+
context.addIssue({ code: 'custom', message: `El CUIT del comprobante asociado ${result.reason}.` });
|
|
77
|
+
return z.NEVER;
|
|
78
|
+
}
|
|
79
|
+
return result.value;
|
|
80
|
+
})
|
|
74
81
|
.optional(),
|
|
75
82
|
fecha: z.string().trim().optional(),
|
|
76
83
|
numero: z.number().int().positive().optional(),
|
|
@@ -98,7 +105,7 @@ export const billingCommandSchema = z.object({
|
|
|
98
105
|
cbuAlias: z
|
|
99
106
|
.string()
|
|
100
107
|
.trim()
|
|
101
|
-
.regex(/^[A-Za-z0-9.-]{6,20}$/, 'El alias debe tener entre 6 y 20 caracteres (letras,
|
|
108
|
+
.regex(/^[A-Za-z0-9.-]{6,20}$/, 'El alias debe tener entre 6 y 20 caracteres (letras, números, punto o guion)')
|
|
102
109
|
.optional(),
|
|
103
110
|
concept: billingConceptSchema,
|
|
104
111
|
currencyCode: z.string().trim().length(3).default('ARS'),
|
|
@@ -125,6 +132,8 @@ export const billingCommandSchema = z.object({
|
|
|
125
132
|
pdfDescription: z.string().trim().min(1).max(200).optional(),
|
|
126
133
|
pointOfSale: z.number().int().positive().optional(),
|
|
127
134
|
receiverAddress: z.string().trim().min(1).max(200).optional(),
|
|
135
|
+
/** Que datos del receptor completo el padron (no los paso quien factura). */
|
|
136
|
+
receiverFromPadron: z.array(z.enum(['address', 'name'])).optional(),
|
|
128
137
|
receiverName: z.string().trim().min(1).max(200).optional(),
|
|
129
138
|
sameCurrency: z.boolean().default(false),
|
|
130
139
|
serviceEndDate: z.string().trim().optional(),
|
|
@@ -143,4 +152,3 @@ export const billingCommandSchema = z.object({
|
|
|
143
152
|
.pipe(z.enum(['adc', 'sca']))
|
|
144
153
|
.optional(),
|
|
145
154
|
});
|
|
146
|
-
//# sourceMappingURL=billing.schemas.js.map
|
|
@@ -3,7 +3,7 @@ function formatRawResponse(result) {
|
|
|
3
3
|
return result.response.raw;
|
|
4
4
|
}
|
|
5
5
|
return {
|
|
6
|
-
mensaje: 'Sin
|
|
6
|
+
mensaje: 'Sin emisión real. Usá --emitir para obtener una respuesta de ARCA.',
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
// Aditivo: la clave `pdf` solo aparece si se intento generar el PDF.
|
|
@@ -29,8 +29,12 @@ function formatVoucherSummary(result) {
|
|
|
29
29
|
eventos: result.response.events,
|
|
30
30
|
observaciones: result.response.observaciones,
|
|
31
31
|
observacion: result.response.observacion,
|
|
32
|
+
numero: result.voucherNumber ?? null,
|
|
32
33
|
...formatPdfOutcome(result),
|
|
33
|
-
|
|
34
|
+
// Lo que se envio a ARCA, con el numero que le toco.
|
|
35
|
+
solicitud: result.voucherNumber === undefined
|
|
36
|
+
? result.payload
|
|
37
|
+
: { ...result.payload, CbteDesde: result.voucherNumber, CbteHasta: result.voucherNumber },
|
|
34
38
|
previsualizacion: result.dryRun,
|
|
35
39
|
resultado: result.response.resultado,
|
|
36
40
|
sugerencias: result.response.suggestions,
|
|
@@ -56,4 +60,3 @@ export function serializeBillingBatch(results, options = {}) {
|
|
|
56
60
|
export function formatRawBillingResponse(result) {
|
|
57
61
|
return formatRawResponse(result);
|
|
58
62
|
}
|
|
59
|
-
//# sourceMappingURL=billing.serialize.js.map
|
|
@@ -69,6 +69,7 @@ export class BillingService {
|
|
|
69
69
|
payload,
|
|
70
70
|
receiver,
|
|
71
71
|
response: mapBillingResponse(response),
|
|
72
|
+
voucherNumber,
|
|
72
73
|
voucherKind,
|
|
73
74
|
warnings: options.warnings ?? [],
|
|
74
75
|
};
|
|
@@ -92,17 +93,17 @@ export class BillingService {
|
|
|
92
93
|
}
|
|
93
94
|
catch (error) {
|
|
94
95
|
const reason = error instanceof Error ? error.message : 'error desconocido';
|
|
95
|
-
return [`No se pudo verificar el
|
|
96
|
+
return [`No se pudo verificar el régimen FCE del receptor: ${reason}`];
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
99
|
buildVoucherPayload(input, runtime, voucherKind = this.requireVoucherKind(input.shortcut)) {
|
|
99
100
|
const pointOfSale = input.pointOfSale ?? runtime.pointOfSale;
|
|
100
101
|
// Resguardo: un IVA receptor que esperaba al padron nunca llega a ARCA con el valor provisorio.
|
|
101
102
|
if (input.ivaConditionSource === 'missing') {
|
|
102
|
-
throw new InputValidationError('Falta IVA receptor.
|
|
103
|
+
throw new InputValidationError('Falta IVA receptor. Usá --ir <tipo> o un flag --ir-*, o configurá uno por defecto con "arcli config establecer ivaReceptor <tipo>".');
|
|
103
104
|
}
|
|
104
105
|
if (!pointOfSale) {
|
|
105
|
-
throw new InputValidationError('Falta el punto de venta.
|
|
106
|
+
throw new InputValidationError('Falta el punto de venta. Usá --punto-venta o --pv, o configuralo con "arcli config establecer puntoVenta <valor>".');
|
|
106
107
|
}
|
|
107
108
|
const dateRange = resolveBillingDateRange(input, voucherKind);
|
|
108
109
|
const concept = resolveBillingConceptCode(input.concept);
|
|
@@ -171,4 +172,3 @@ export class BillingService {
|
|
|
171
172
|
return definition;
|
|
172
173
|
}
|
|
173
174
|
}
|
|
174
|
-
//# sourceMappingURL=billing.service.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { diffArcaDatesInDays, formatArcaDateAsArgentineDate } from '../../lib/dates/arca-date.js';
|
|
2
2
|
import { InputValidationError } from '../../lib/errors/app-error.js';
|
|
3
|
+
import { parseCuit } from '../../lib/identity/cuit.js';
|
|
3
4
|
import { formatDocumentFlag, formatVoucherLabel } from './billing.mappers.js';
|
|
4
5
|
export function ensureDateOrder(serviceStartDate, serviceEndDate) {
|
|
5
6
|
if (serviceStartDate > serviceEndDate) {
|
|
@@ -11,7 +12,7 @@ export function validateConceptDateInputs(input, voucherKind) {
|
|
|
11
12
|
const hasPartialServiceDate = Boolean(input.serviceStartDate) !== Boolean(input.serviceEndDate);
|
|
12
13
|
if (input.paymentDueDate) {
|
|
13
14
|
if (voucherKind.isElectronicCredit && voucherKind.family !== 'factura-credito-electronica') {
|
|
14
|
-
throw new InputValidationError(`La ${formatVoucherLabel(voucherKind)} no lleva vencimiento de pago.
|
|
15
|
+
throw new InputValidationError(`La ${formatVoucherLabel(voucherKind)} no lleva vencimiento de pago. Sacá --vencimiento.`);
|
|
15
16
|
}
|
|
16
17
|
if (!voucherKind.isElectronicCredit && input.concept === 'productos') {
|
|
17
18
|
throw new InputValidationError('El concepto "productos" no usa --vencimiento.');
|
|
@@ -19,10 +20,10 @@ export function validateConceptDateInputs(input, voucherKind) {
|
|
|
19
20
|
}
|
|
20
21
|
if (input.concept === 'productos') {
|
|
21
22
|
if (hasAnyServiceDate) {
|
|
22
|
-
throw new InputValidationError('El concepto "productos" no usa fechas de servicio.
|
|
23
|
+
throw new InputValidationError('El concepto "productos" no usa fechas de servicio. Sacá --servicio-desde y --servicio-hasta.');
|
|
23
24
|
}
|
|
24
25
|
if (input.dueDay) {
|
|
25
|
-
throw new InputValidationError('El concepto "productos" no usa --dia.
|
|
26
|
+
throw new InputValidationError('El concepto "productos" no usa --dia. Usá solo fecha o monto.');
|
|
26
27
|
}
|
|
27
28
|
return;
|
|
28
29
|
}
|
|
@@ -31,7 +32,7 @@ export function validateConceptDateInputs(input, voucherKind) {
|
|
|
31
32
|
}
|
|
32
33
|
// --dia arma el fin del servicio desde hoy; con una fecha explicita no se usaria y nadie se enteraria.
|
|
33
34
|
if (input.dueDay && (input.billingDate || input.serviceEndDate)) {
|
|
34
|
-
throw new InputValidationError('--dia no se combina con --fecha ni con --servicio-hasta: con esas fechas no se usa.
|
|
35
|
+
throw new InputValidationError('--dia no se combina con --fecha ni con --servicio-hasta: con esas fechas no se usa. Sacá --dia o esas fechas.');
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
export function validateDocumentIdentity(input, voucherKind) {
|
|
@@ -40,16 +41,18 @@ export function validateDocumentIdentity(input, voucherKind) {
|
|
|
40
41
|
throw new InputValidationError(`La ${formatVoucherLabel(voucherKind)} usa consumidor final solo con --ir-cf o --iva-receptor consumidor-final.`);
|
|
41
42
|
}
|
|
42
43
|
if (typeof input.documentNumber === 'number' && input.documentNumber !== 0) {
|
|
43
|
-
throw new InputValidationError(`La ${formatVoucherLabel(voucherKind)} usa consumidor final solo con documento 0.
|
|
44
|
+
throw new InputValidationError(`La ${formatVoucherLabel(voucherKind)} usa consumidor final solo con documento 0. Usá --consumidor-final.`);
|
|
44
45
|
}
|
|
45
46
|
return;
|
|
46
47
|
}
|
|
47
48
|
if (typeof input.documentNumber !== 'number') {
|
|
48
|
-
throw new InputValidationError(`La ${formatVoucherLabel(voucherKind)} requiere documento del receptor.
|
|
49
|
+
throw new InputValidationError(`La ${formatVoucherLabel(voucherKind)} requiere documento del receptor. Usá ${formatDocumentFlag(input.documentType)}.`);
|
|
49
50
|
}
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
if (input.documentType === 'cuit' || input.documentType === 'cuil') {
|
|
52
|
+
const result = parseCuit(input.documentNumber);
|
|
53
|
+
if (!result.ok) {
|
|
54
|
+
throw new InputValidationError(`${formatDocumentFlag(input.documentType)} ${input.documentNumber} no es válido en ${formatVoucherLabel(voucherKind)}: ${result.reason}.`);
|
|
55
|
+
}
|
|
53
56
|
}
|
|
54
57
|
if (input.documentType === 'dni' && !/^\d{7,8}$/.test(String(input.documentNumber))) {
|
|
55
58
|
throw new InputValidationError(`--dni debe tener 7 u 8 digitos en ${formatVoucherLabel(voucherKind)}.`);
|
|
@@ -70,7 +73,7 @@ export function validateBillingDateWindow(billingDate, today, concept, voucherKi
|
|
|
70
73
|
const offset = diffArcaDatesInDays(today, billingDate);
|
|
71
74
|
const label = formatArcaDateAsArgentineDate(billingDate);
|
|
72
75
|
if (offset < -window.maxDaysBefore || offset > window.maxDaysAfter) {
|
|
73
|
-
throw new InputValidationError(`La fecha ${label} esta fuera de rango para la ${formatVoucherLabel(voucherKind)}: ARCA acepta hasta ${window.maxDaysBefore}
|
|
76
|
+
throw new InputValidationError(`La fecha ${label} esta fuera de rango para la ${formatVoucherLabel(voucherKind)}: ARCA acepta hasta ${window.maxDaysBefore} días antes y ${window.maxDaysAfter} después de hoy.`);
|
|
74
77
|
}
|
|
75
78
|
if (window.sameMonthWhenFuture && offset > 0 && billingDate.slice(0, 6) !== today.slice(0, 6)) {
|
|
76
79
|
throw new InputValidationError(`La fecha ${label} es futura y cae en otro mes. Para la ${formatVoucherLabel(voucherKind)} ARCA solo acepta fechas futuras dentro del mes actual.`);
|
|
@@ -81,4 +84,3 @@ export function validatePaymentDueDate(paymentDueDate, minimumPaymentDueDate) {
|
|
|
81
84
|
throw new InputValidationError(`El vencimiento de pago (${formatArcaDateAsArgentineDate(paymentDueDate)}) no puede ser anterior al ${formatArcaDateAsArgentineDate(minimumPaymentDueDate)}.`);
|
|
82
85
|
}
|
|
83
86
|
}
|
|
84
|
-
//# sourceMappingURL=billing.validation.js.map
|
|
@@ -28,7 +28,7 @@ export const VOUCHER_KIND_MAP = {
|
|
|
28
28
|
},
|
|
29
29
|
nca: {
|
|
30
30
|
arcaType: 3,
|
|
31
|
-
displayName: 'Nota de
|
|
31
|
+
displayName: 'Nota de crédito A',
|
|
32
32
|
family: 'nota-credito',
|
|
33
33
|
isElectronicCredit: false,
|
|
34
34
|
letter: 'a',
|
|
@@ -37,7 +37,7 @@ export const VOUCHER_KIND_MAP = {
|
|
|
37
37
|
},
|
|
38
38
|
ncb: {
|
|
39
39
|
arcaType: 8,
|
|
40
|
-
displayName: 'Nota de
|
|
40
|
+
displayName: 'Nota de crédito B',
|
|
41
41
|
family: 'nota-credito',
|
|
42
42
|
isElectronicCredit: false,
|
|
43
43
|
letter: 'b',
|
|
@@ -46,7 +46,7 @@ export const VOUCHER_KIND_MAP = {
|
|
|
46
46
|
},
|
|
47
47
|
ncc: {
|
|
48
48
|
arcaType: 13,
|
|
49
|
-
displayName: 'Nota de
|
|
49
|
+
displayName: 'Nota de crédito C',
|
|
50
50
|
family: 'nota-credito',
|
|
51
51
|
isElectronicCredit: false,
|
|
52
52
|
letter: 'c',
|
|
@@ -55,7 +55,7 @@ export const VOUCHER_KIND_MAP = {
|
|
|
55
55
|
},
|
|
56
56
|
nda: {
|
|
57
57
|
arcaType: 2,
|
|
58
|
-
displayName: 'Nota de
|
|
58
|
+
displayName: 'Nota de débito A',
|
|
59
59
|
family: 'nota-debito',
|
|
60
60
|
isElectronicCredit: false,
|
|
61
61
|
letter: 'a',
|
|
@@ -64,7 +64,7 @@ export const VOUCHER_KIND_MAP = {
|
|
|
64
64
|
},
|
|
65
65
|
ndb: {
|
|
66
66
|
arcaType: 7,
|
|
67
|
-
displayName: 'Nota de
|
|
67
|
+
displayName: 'Nota de débito B',
|
|
68
68
|
family: 'nota-debito',
|
|
69
69
|
isElectronicCredit: false,
|
|
70
70
|
letter: 'b',
|
|
@@ -73,7 +73,7 @@ export const VOUCHER_KIND_MAP = {
|
|
|
73
73
|
},
|
|
74
74
|
ndc: {
|
|
75
75
|
arcaType: 12,
|
|
76
|
-
displayName: 'Nota de
|
|
76
|
+
displayName: 'Nota de débito C',
|
|
77
77
|
family: 'nota-debito',
|
|
78
78
|
isElectronicCredit: false,
|
|
79
79
|
letter: 'c',
|
|
@@ -82,7 +82,7 @@ export const VOUCHER_KIND_MAP = {
|
|
|
82
82
|
},
|
|
83
83
|
fcea: {
|
|
84
84
|
arcaType: 201,
|
|
85
|
-
displayName: 'Factura de
|
|
85
|
+
displayName: 'Factura de crédito electrónica A',
|
|
86
86
|
family: 'factura-credito-electronica',
|
|
87
87
|
isElectronicCredit: true,
|
|
88
88
|
letter: 'a',
|
|
@@ -91,7 +91,7 @@ export const VOUCHER_KIND_MAP = {
|
|
|
91
91
|
},
|
|
92
92
|
fceb: {
|
|
93
93
|
arcaType: 206,
|
|
94
|
-
displayName: 'Factura de
|
|
94
|
+
displayName: 'Factura de crédito electrónica B',
|
|
95
95
|
family: 'factura-credito-electronica',
|
|
96
96
|
isElectronicCredit: true,
|
|
97
97
|
letter: 'b',
|
|
@@ -100,7 +100,7 @@ export const VOUCHER_KIND_MAP = {
|
|
|
100
100
|
},
|
|
101
101
|
fcec: {
|
|
102
102
|
arcaType: 211,
|
|
103
|
-
displayName: 'Factura de
|
|
103
|
+
displayName: 'Factura de crédito electrónica C',
|
|
104
104
|
family: 'factura-credito-electronica',
|
|
105
105
|
isElectronicCredit: true,
|
|
106
106
|
letter: 'c',
|
|
@@ -109,7 +109,7 @@ export const VOUCHER_KIND_MAP = {
|
|
|
109
109
|
},
|
|
110
110
|
ncea: {
|
|
111
111
|
arcaType: 203,
|
|
112
|
-
displayName: 'Nota de
|
|
112
|
+
displayName: 'Nota de crédito electrónica A',
|
|
113
113
|
family: 'nota-credito-electronica',
|
|
114
114
|
isElectronicCredit: true,
|
|
115
115
|
letter: 'a',
|
|
@@ -118,7 +118,7 @@ export const VOUCHER_KIND_MAP = {
|
|
|
118
118
|
},
|
|
119
119
|
nceb: {
|
|
120
120
|
arcaType: 208,
|
|
121
|
-
displayName: 'Nota de
|
|
121
|
+
displayName: 'Nota de crédito electrónica B',
|
|
122
122
|
family: 'nota-credito-electronica',
|
|
123
123
|
isElectronicCredit: true,
|
|
124
124
|
letter: 'b',
|
|
@@ -127,7 +127,7 @@ export const VOUCHER_KIND_MAP = {
|
|
|
127
127
|
},
|
|
128
128
|
ncec: {
|
|
129
129
|
arcaType: 213,
|
|
130
|
-
displayName: 'Nota de
|
|
130
|
+
displayName: 'Nota de crédito electrónica C',
|
|
131
131
|
family: 'nota-credito-electronica',
|
|
132
132
|
isElectronicCredit: true,
|
|
133
133
|
letter: 'c',
|
|
@@ -136,7 +136,7 @@ export const VOUCHER_KIND_MAP = {
|
|
|
136
136
|
},
|
|
137
137
|
ndea: {
|
|
138
138
|
arcaType: 202,
|
|
139
|
-
displayName: 'Nota de
|
|
139
|
+
displayName: 'Nota de débito electrónica A',
|
|
140
140
|
family: 'nota-debito-electronica',
|
|
141
141
|
isElectronicCredit: true,
|
|
142
142
|
letter: 'a',
|
|
@@ -145,7 +145,7 @@ export const VOUCHER_KIND_MAP = {
|
|
|
145
145
|
},
|
|
146
146
|
ndeb: {
|
|
147
147
|
arcaType: 207,
|
|
148
|
-
displayName: 'Nota de
|
|
148
|
+
displayName: 'Nota de débito electrónica B',
|
|
149
149
|
family: 'nota-debito-electronica',
|
|
150
150
|
isElectronicCredit: true,
|
|
151
151
|
letter: 'b',
|
|
@@ -154,7 +154,7 @@ export const VOUCHER_KIND_MAP = {
|
|
|
154
154
|
},
|
|
155
155
|
ndec: {
|
|
156
156
|
arcaType: 212,
|
|
157
|
-
displayName: 'Nota de
|
|
157
|
+
displayName: 'Nota de débito electrónica C',
|
|
158
158
|
family: 'nota-debito-electronica',
|
|
159
159
|
isElectronicCredit: true,
|
|
160
160
|
letter: 'c',
|
|
@@ -177,4 +177,3 @@ export function getVoucherKindByArcaType(arcaType) {
|
|
|
177
177
|
export function isVoucherShortcut(value) {
|
|
178
178
|
return value in VOUCHER_KIND_MAP;
|
|
179
179
|
}
|
|
180
|
-
//# sourceMappingURL=voucher-kind-map.js.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
function resolveValues(values, previousArguments) {
|
|
2
|
+
if (!values) {
|
|
3
|
+
return [];
|
|
4
|
+
}
|
|
5
|
+
return typeof values === 'function' ? values(previousArguments) : values;
|
|
6
|
+
}
|
|
7
|
+
function findOption(command, word) {
|
|
8
|
+
return command.options.find((option) => option.flags.includes(word));
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Lo que puede seguir en la linea, segun las palabras escritas despues de `arcli`. La ultima es la que se esta
|
|
12
|
+
* completando (puede venir vacia). Sin candidatos devuelve una lista vacia y el shell completa rutas de archivo,
|
|
13
|
+
* que es lo que piden `--cargar` y las rutas de config.
|
|
14
|
+
*/
|
|
15
|
+
export function completeWords(root, words) {
|
|
16
|
+
const current = words.at(-1) ?? '';
|
|
17
|
+
const previous = words.slice(0, -1);
|
|
18
|
+
let command = root;
|
|
19
|
+
let positionals = [];
|
|
20
|
+
let pendingOption;
|
|
21
|
+
for (const word of previous) {
|
|
22
|
+
if (pendingOption) {
|
|
23
|
+
pendingOption = undefined;
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (word.startsWith('-')) {
|
|
27
|
+
const option = findOption(command, word);
|
|
28
|
+
pendingOption = option?.takesValue ? option : undefined;
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const subcommand = positionals.length === 0 ? command.subcommands.find((sub) => sub.name === word) : undefined;
|
|
32
|
+
if (subcommand) {
|
|
33
|
+
command = subcommand;
|
|
34
|
+
positionals = [];
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
positionals.push(word);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const matches = (candidates) => [...new Set(candidates)].filter((candidate) => candidate.startsWith(current));
|
|
41
|
+
if (pendingOption) {
|
|
42
|
+
return matches(resolveValues(pendingOption.values, positionals));
|
|
43
|
+
}
|
|
44
|
+
if (current.startsWith('-')) {
|
|
45
|
+
return matches(command.options
|
|
46
|
+
.filter((option) => !option.hidden)
|
|
47
|
+
.flatMap((option) => option.flags.filter((flag) => flag.startsWith('--'))));
|
|
48
|
+
}
|
|
49
|
+
return matches([
|
|
50
|
+
...(positionals.length === 0 ? command.subcommands.map((sub) => sub.name) : []),
|
|
51
|
+
...resolveValues(command.argumentValues[positionals.length], positionals),
|
|
52
|
+
]);
|
|
53
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { noticePanel } from '../../ui/index.js';
|
|
2
|
+
/** `/Users/vos/.zshrc` → `~/.zshrc`, como lo escribe la gente. */
|
|
3
|
+
function displayPath(path, home) {
|
|
4
|
+
return home && path.startsWith(`${home}/`) ? `~${path.slice(home.length)}` : path;
|
|
5
|
+
}
|
|
6
|
+
function reloadHint(state, home) {
|
|
7
|
+
return state.shell === 'fish'
|
|
8
|
+
? 'Abrí una terminal nueva.'
|
|
9
|
+
: `Abrí una terminal nueva o corré: source ${displayPath(state.path, home)}`;
|
|
10
|
+
}
|
|
11
|
+
export function formatCompletionStateAsText(state, home) {
|
|
12
|
+
const where = displayPath(state.path, home);
|
|
13
|
+
return state.installed
|
|
14
|
+
? noticePanel(`Autocompletado instalado para ${state.shell} (${where}).`, 'success')
|
|
15
|
+
: noticePanel(`Autocompletado no instalado para ${state.shell}. Instalalo con: arcli completado instalar`, 'muted');
|
|
16
|
+
}
|
|
17
|
+
export function formatCompletionResultAsText(result, home) {
|
|
18
|
+
const where = displayPath(result.path, home);
|
|
19
|
+
if (!result.changed) {
|
|
20
|
+
return noticePanel(result.installed
|
|
21
|
+
? `El autocompletado ya estaba instalado para ${result.shell} (${where}).`
|
|
22
|
+
: `El autocompletado no estaba instalado para ${result.shell}.`, 'muted');
|
|
23
|
+
}
|
|
24
|
+
return result.installed
|
|
25
|
+
? noticePanel(`Autocompletado instalado para ${result.shell} en ${where}.\n${reloadHint(result, home)}`, 'success')
|
|
26
|
+
: noticePanel(`Autocompletado desinstalado de ${where}.\nEn esta terminal sigue activo hasta cerrarla.`, 'success');
|
|
27
|
+
}
|
|
28
|
+
export function formatCompletionStateAsJson(state) {
|
|
29
|
+
return JSON.stringify({
|
|
30
|
+
...('changed' in state ? { cambio: state.changed } : {}),
|
|
31
|
+
instalado: state.installed,
|
|
32
|
+
ruta: state.path,
|
|
33
|
+
shell: state.shell,
|
|
34
|
+
}, null, 2);
|
|
35
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { basename, dirname, join } from 'node:path';
|
|
3
|
+
import { COMPLETION_SHELLS } from './shell-scripts.js';
|
|
4
|
+
/** Marca lo que agrega arcli, para reconocerlo y sacarlo despues sin tocar nada mas. */
|
|
5
|
+
const MARKER = '# arcli: autocompletado con Tab (se saca con "arcli completado desinstalar")';
|
|
6
|
+
export function currentCompletionEnvironment() {
|
|
7
|
+
return {
|
|
8
|
+
home: process.env.HOME ?? '',
|
|
9
|
+
platform: process.platform,
|
|
10
|
+
shell: process.env.SHELL,
|
|
11
|
+
xdgConfigHome: process.env.XDG_CONFIG_HOME,
|
|
12
|
+
zdotdir: process.env.ZDOTDIR,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** El shell de `$SHELL`, si es uno que arcli sabe completar. */
|
|
16
|
+
export function detectShell(shellPath) {
|
|
17
|
+
const name = shellPath ? basename(shellPath) : '';
|
|
18
|
+
return COMPLETION_SHELLS.find((shell) => shell === name);
|
|
19
|
+
}
|
|
20
|
+
/** Donde va el autocompletado: la linea en el rc de bash o zsh, o un archivo propio en fish. */
|
|
21
|
+
export function resolveCompletionPath(shell, environment) {
|
|
22
|
+
if (shell === 'fish') {
|
|
23
|
+
return join(environment.xdgConfigHome ?? join(environment.home, '.config'), 'fish', 'completions', 'arcli.fish');
|
|
24
|
+
}
|
|
25
|
+
if (shell === 'zsh') {
|
|
26
|
+
return join(environment.zdotdir ?? environment.home, '.zshrc');
|
|
27
|
+
}
|
|
28
|
+
if (environment.platform !== 'darwin') {
|
|
29
|
+
return join(environment.home, '.bashrc');
|
|
30
|
+
}
|
|
31
|
+
// La Terminal de macOS abre bash como login shell: lee el primero que exista de estos. Crear .bash_profile
|
|
32
|
+
// cuando solo hay .profile haria que bash deje de leer .profile.
|
|
33
|
+
const loginFiles = ['.bash_profile', '.bash_login', '.profile'].map((name) => join(environment.home, name));
|
|
34
|
+
return loginFiles.find((path) => existsSync(path)) ?? loginFiles[0];
|
|
35
|
+
}
|
|
36
|
+
function activationLine(shell) {
|
|
37
|
+
return shell === 'fish'
|
|
38
|
+
? 'arcli completado fish | source'
|
|
39
|
+
: `command -v arcli >/dev/null 2>&1 && eval "$(arcli completado ${shell})"`;
|
|
40
|
+
}
|
|
41
|
+
function readText(path) {
|
|
42
|
+
return existsSync(path) ? readFileSync(path, 'utf8') : '';
|
|
43
|
+
}
|
|
44
|
+
/** Lo agrego arcli o se agrego a mano: cualquier linea que active `arcli completado <shell>`. */
|
|
45
|
+
function isActivationLine(line, shell) {
|
|
46
|
+
return line === MARKER || line.includes(`arcli completado ${shell}`);
|
|
47
|
+
}
|
|
48
|
+
export function getCompletionState(shell, environment) {
|
|
49
|
+
const path = resolveCompletionPath(shell, environment);
|
|
50
|
+
const installed = readText(path)
|
|
51
|
+
.split('\n')
|
|
52
|
+
.some((line) => line !== MARKER && isActivationLine(line, shell) && !line.trimStart().startsWith('#'));
|
|
53
|
+
return { installed, path, shell };
|
|
54
|
+
}
|
|
55
|
+
export function installCompletion(shell, environment) {
|
|
56
|
+
const state = getCompletionState(shell, environment);
|
|
57
|
+
if (state.installed) {
|
|
58
|
+
return { ...state, changed: false };
|
|
59
|
+
}
|
|
60
|
+
const block = `${MARKER}\n${activationLine(shell)}\n`;
|
|
61
|
+
mkdirSync(dirname(state.path), { recursive: true });
|
|
62
|
+
if (shell === 'fish') {
|
|
63
|
+
writeFileSync(state.path, block);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const current = readText(state.path);
|
|
67
|
+
const separator = current === '' ? '' : current.endsWith('\n') ? '\n' : '\n\n';
|
|
68
|
+
writeFileSync(state.path, `${current}${separator}${block}`);
|
|
69
|
+
}
|
|
70
|
+
return { ...state, changed: true, installed: true };
|
|
71
|
+
}
|
|
72
|
+
export function uninstallCompletion(shell, environment) {
|
|
73
|
+
const state = getCompletionState(shell, environment);
|
|
74
|
+
const current = readText(state.path);
|
|
75
|
+
if (!current.includes(MARKER) && !state.installed) {
|
|
76
|
+
return { ...state, changed: false };
|
|
77
|
+
}
|
|
78
|
+
if (shell === 'fish') {
|
|
79
|
+
rmSync(state.path, { force: true });
|
|
80
|
+
return { ...state, changed: true, installed: false };
|
|
81
|
+
}
|
|
82
|
+
const lines = current.split('\n');
|
|
83
|
+
const kept = lines.filter((line, index) => {
|
|
84
|
+
if (isActivationLine(line, shell)) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
// La linea en blanco que se agrego antes del bloque tambien se va.
|
|
88
|
+
return !(line === '' && lines[index + 1] === MARKER);
|
|
89
|
+
});
|
|
90
|
+
writeFileSync(state.path, kept.join('\n'));
|
|
91
|
+
return { ...state, changed: true, installed: false };
|
|
92
|
+
}
|