arcli 0.1.1 → 1.1.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/LICENSE +21 -0
- package/README.md +164 -4
- package/dist/cli/commands/billing-family.command.d.ts +2 -0
- package/dist/cli/commands/billing-family.command.js +30 -0
- package/dist/cli/commands/billing-family.command.js.map +1 -0
- package/dist/cli/commands/billing-shortcuts.command.d.ts +2 -0
- package/dist/cli/commands/billing-shortcuts.command.js +18 -0
- package/dist/cli/commands/billing-shortcuts.command.js.map +1 -0
- package/dist/cli/commands/billing.command.interactive-preview.d.ts +17 -0
- package/dist/cli/commands/billing.command.interactive-preview.js +65 -0
- package/dist/cli/commands/billing.command.interactive-preview.js.map +1 -0
- package/dist/cli/commands/billing.command.options.d.ts +2 -0
- package/dist/cli/commands/billing.command.options.js +49 -0
- package/dist/cli/commands/billing.command.options.js.map +1 -0
- package/dist/cli/commands/billing.command.output.d.ts +12 -0
- package/dist/cli/commands/billing.command.output.js +33 -0
- package/dist/cli/commands/billing.command.output.js.map +1 -0
- package/dist/cli/commands/billing.command.parser.d.ts +18 -0
- package/dist/cli/commands/billing.command.parser.js +136 -0
- package/dist/cli/commands/billing.command.parser.js.map +1 -0
- package/dist/cli/commands/billing.command.shared.d.ts +7 -0
- package/dist/cli/commands/billing.command.shared.js +78 -0
- package/dist/cli/commands/billing.command.shared.js.map +1 -0
- package/dist/cli/commands/billing.command.shortcuts.d.ts +7 -0
- package/dist/cli/commands/billing.command.shortcuts.js +52 -0
- package/dist/cli/commands/billing.command.shortcuts.js.map +1 -0
- package/dist/cli/commands/config.command.d.ts +2 -0
- package/dist/cli/commands/config.command.js +125 -0
- package/dist/cli/commands/config.command.js.map +1 -0
- package/dist/cli/commands/examples.command.d.ts +2 -0
- package/dist/cli/commands/examples.command.js +14 -0
- package/dist/cli/commands/examples.command.js.map +1 -0
- package/dist/cli/commands/storybook.command.d.ts +2 -0
- package/dist/cli/commands/storybook.command.js +26 -0
- package/dist/cli/commands/storybook.command.js.map +1 -0
- package/dist/cli/help.d.ts +10 -0
- package/dist/cli/help.js +473 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +41 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/program.d.ts +2 -0
- package/dist/cli/program.js +28 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/types.d.ts +6 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/version.d.ts +1 -0
- package/dist/cli/version.js +2 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/dates/arca-date.d.ts +2 -0
- package/dist/lib/dates/arca-date.js +28 -0
- package/dist/lib/dates/arca-date.js.map +1 -0
- package/dist/lib/errors/app-error.d.ts +14 -0
- package/dist/lib/errors/app-error.js +29 -0
- package/dist/lib/errors/app-error.js.map +1 -0
- package/dist/lib/files/read-json-file.d.ts +1 -0
- package/dist/lib/files/read-json-file.js +21 -0
- package/dist/lib/files/read-json-file.js.map +1 -0
- package/dist/lib/paths/mask-path.d.ts +1 -0
- package/dist/lib/paths/mask-path.js +17 -0
- package/dist/lib/paths/mask-path.js.map +1 -0
- package/dist/lib/security/certificate.d.ts +7 -0
- package/dist/lib/security/certificate.js +16 -0
- package/dist/lib/security/certificate.js.map +1 -0
- package/dist/lib/security/pem.d.ts +5 -0
- package/dist/lib/security/pem.js +36 -0
- package/dist/lib/security/pem.js.map +1 -0
- package/dist/modules/billing/billing-response.d.ts +4 -0
- package/dist/modules/billing/billing-response.js +74 -0
- package/dist/modules/billing/billing-response.js.map +1 -0
- package/dist/modules/billing/billing.amounts.d.ts +9 -0
- package/dist/modules/billing/billing.amounts.js +30 -0
- package/dist/modules/billing/billing.amounts.js.map +1 -0
- package/dist/modules/billing/billing.associated-vouchers.d.ts +10 -0
- package/dist/modules/billing/billing.associated-vouchers.js +51 -0
- package/dist/modules/billing/billing.associated-vouchers.js.map +1 -0
- package/dist/modules/billing/billing.constants.d.ts +2 -0
- package/dist/modules/billing/billing.constants.js +3 -0
- package/dist/modules/billing/billing.constants.js.map +1 -0
- package/dist/modules/billing/billing.date-range.d.ts +8 -0
- package/dist/modules/billing/billing.date-range.js +45 -0
- package/dist/modules/billing/billing.date-range.js.map +1 -0
- package/dist/modules/billing/billing.display.d.ts +13 -0
- package/dist/modules/billing/billing.display.js +111 -0
- package/dist/modules/billing/billing.display.js.map +1 -0
- package/dist/modules/billing/billing.json-format.d.ts +6 -0
- package/dist/modules/billing/billing.json-format.js +5 -0
- package/dist/modules/billing/billing.json-format.js.map +1 -0
- package/dist/modules/billing/billing.labels.d.ts +9 -0
- package/dist/modules/billing/billing.labels.js +108 -0
- package/dist/modules/billing/billing.labels.js.map +1 -0
- package/dist/modules/billing/billing.mappers.d.ts +8 -0
- package/dist/modules/billing/billing.mappers.js +59 -0
- package/dist/modules/billing/billing.mappers.js.map +1 -0
- package/dist/modules/billing/billing.presenter.d.ts +7 -0
- package/dist/modules/billing/billing.presenter.js +3 -0
- package/dist/modules/billing/billing.presenter.js.map +1 -0
- package/dist/modules/billing/billing.schemas.d.ts +74 -0
- package/dist/modules/billing/billing.schemas.js +69 -0
- package/dist/modules/billing/billing.schemas.js.map +1 -0
- package/dist/modules/billing/billing.serialize.d.ts +8 -0
- package/dist/modules/billing/billing.serialize.js +51 -0
- package/dist/modules/billing/billing.serialize.js.map +1 -0
- package/dist/modules/billing/billing.service.d.ts +15 -0
- package/dist/modules/billing/billing.service.js +88 -0
- package/dist/modules/billing/billing.service.js.map +1 -0
- package/dist/modules/billing/billing.text.d.ts +8 -0
- package/dist/modules/billing/billing.text.js +44 -0
- package/dist/modules/billing/billing.text.js.map +1 -0
- package/dist/modules/billing/billing.types.d.ts +13 -0
- package/dist/modules/billing/billing.types.internal.d.ts +25 -0
- package/dist/modules/billing/billing.types.internal.js +2 -0
- package/dist/modules/billing/billing.types.internal.js.map +1 -0
- package/dist/modules/billing/billing.types.js +2 -0
- package/dist/modules/billing/billing.types.js.map +1 -0
- package/dist/modules/billing/billing.validation.d.ts +5 -0
- package/dist/modules/billing/billing.validation.js +45 -0
- package/dist/modules/billing/billing.validation.js.map +1 -0
- package/dist/modules/billing/voucher-kind-map.d.ts +9 -0
- package/dist/modules/billing/voucher-kind-map.js +180 -0
- package/dist/modules/billing/voucher-kind-map.js.map +1 -0
- package/dist/modules/config/config-doctor.d.ts +15 -0
- package/dist/modules/config/config-doctor.js +125 -0
- package/dist/modules/config/config-doctor.js.map +1 -0
- package/dist/modules/config/config-value-parser.d.ts +2 -0
- package/dist/modules/config/config-value-parser.js +71 -0
- package/dist/modules/config/config-value-parser.js.map +1 -0
- package/dist/modules/config/config.presenter.d.ts +7 -0
- package/dist/modules/config/config.presenter.js +80 -0
- package/dist/modules/config/config.presenter.js.map +1 -0
- package/dist/modules/config/config.schemas.d.ts +87 -0
- package/dist/modules/config/config.schemas.js +84 -0
- package/dist/modules/config/config.schemas.js.map +1 -0
- package/dist/modules/config/config.service.d.ts +20 -0
- package/dist/modules/config/config.service.js +78 -0
- package/dist/modules/config/config.service.js.map +1 -0
- package/dist/modules/examples/examples.d.ts +1 -0
- package/dist/modules/examples/examples.js +156 -0
- package/dist/modules/examples/examples.js.map +1 -0
- package/dist/modules/storybook/showcase-theme.d.ts +7 -0
- package/dist/modules/storybook/showcase-theme.js +6 -0
- package/dist/modules/storybook/showcase-theme.js.map +1 -0
- package/dist/modules/storybook/showcase.d.ts +2 -0
- package/dist/modules/storybook/showcase.js +310 -0
- package/dist/modules/storybook/showcase.js.map +1 -0
- package/dist/modules/update-check/update-check.presenter.d.ts +2 -0
- package/dist/modules/update-check/update-check.presenter.js +6 -0
- package/dist/modules/update-check/update-check.presenter.js.map +1 -0
- package/dist/modules/update-check/update-check.service.d.ts +8 -0
- package/dist/modules/update-check/update-check.service.js +72 -0
- package/dist/modules/update-check/update-check.service.js.map +1 -0
- package/dist/services/arca/arca-billing.gateway.d.ts +9 -0
- package/dist/services/arca/arca-billing.gateway.js +10 -0
- package/dist/services/arca/arca-billing.gateway.js.map +1 -0
- package/dist/services/arca/arca-client.factory.d.ts +5 -0
- package/dist/services/arca/arca-client.factory.js +7 -0
- package/dist/services/arca/arca-client.factory.js.map +1 -0
- package/dist/services/arca/arca-context.resolver.d.ts +44 -0
- package/dist/services/arca/arca-context.resolver.js +120 -0
- package/dist/services/arca/arca-context.resolver.js.map +1 -0
- package/dist/ui/components/contentPanel.d.ts +5 -0
- package/dist/ui/components/contentPanel.js +11 -0
- package/dist/ui/components/contentPanel.js.map +1 -0
- package/dist/ui/components/errorPanel.d.ts +1 -0
- package/dist/ui/components/errorPanel.js +13 -0
- package/dist/ui/components/errorPanel.js.map +1 -0
- package/dist/ui/components/index.d.ts +6 -0
- package/dist/ui/components/index.js +7 -0
- package/dist/ui/components/index.js.map +1 -0
- package/dist/ui/components/keyValuePanel.d.ts +3 -0
- package/dist/ui/components/keyValuePanel.js +14 -0
- package/dist/ui/components/keyValuePanel.js.map +1 -0
- package/dist/ui/components/noticePanel.d.ts +3 -0
- package/dist/ui/components/noticePanel.js +11 -0
- package/dist/ui/components/noticePanel.js.map +1 -0
- package/dist/ui/components/rawPanel.d.ts +1 -0
- package/dist/ui/components/rawPanel.js +5 -0
- package/dist/ui/components/rawPanel.js.map +1 -0
- package/dist/ui/components/statusPanel.d.ts +3 -0
- package/dist/ui/components/statusPanel.js +20 -0
- package/dist/ui/components/statusPanel.js.map +1 -0
- package/dist/ui/index.d.ts +5 -0
- package/dist/ui/index.js +6 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/presenters/billing.presenter.d.ts +2 -0
- package/dist/ui/presenters/billing.presenter.js +2 -0
- package/dist/ui/presenters/billing.presenter.js.map +1 -0
- package/dist/ui/presenters/config.presenter.d.ts +1 -0
- package/dist/ui/presenters/config.presenter.js +2 -0
- package/dist/ui/presenters/config.presenter.js.map +1 -0
- package/dist/ui/presenters/errors.presenter.d.ts +1 -0
- package/dist/ui/presenters/errors.presenter.js +89 -0
- package/dist/ui/presenters/errors.presenter.js.map +1 -0
- package/dist/ui/presenters/errors.zod-presenter.d.ts +2 -0
- package/dist/ui/presenters/errors.zod-presenter.js +82 -0
- package/dist/ui/presenters/errors.zod-presenter.js.map +1 -0
- package/dist/ui/presenters/index.d.ts +4 -0
- package/dist/ui/presenters/index.js +5 -0
- package/dist/ui/presenters/index.js.map +1 -0
- package/dist/ui/presenters/showcase.presenter.d.ts +1 -0
- package/dist/ui/presenters/showcase.presenter.js +2 -0
- package/dist/ui/presenters/showcase.presenter.js.map +1 -0
- package/dist/ui/primitives/index.d.ts +10 -0
- package/dist/ui/primitives/index.js +11 -0
- package/dist/ui/primitives/index.js.map +1 -0
- package/dist/ui/primitives/renderDivider.d.ts +5 -0
- package/dist/ui/primitives/renderDivider.js +5 -0
- package/dist/ui/primitives/renderDivider.js.map +1 -0
- package/dist/ui/primitives/renderFooter.d.ts +7 -0
- package/dist/ui/primitives/renderFooter.js +6 -0
- package/dist/ui/primitives/renderFooter.js.map +1 -0
- package/dist/ui/primitives/renderJson.d.ts +3 -0
- package/dist/ui/primitives/renderJson.js +19 -0
- package/dist/ui/primitives/renderJson.js.map +1 -0
- package/dist/ui/primitives/renderKeyValue.d.ts +14 -0
- package/dist/ui/primitives/renderKeyValue.js +34 -0
- package/dist/ui/primitives/renderKeyValue.js.map +1 -0
- package/dist/ui/primitives/renderLogo.d.ts +2 -0
- package/dist/ui/primitives/renderLogo.js +28 -0
- package/dist/ui/primitives/renderLogo.js.map +1 -0
- package/dist/ui/primitives/renderObject.d.ts +1 -0
- package/dist/ui/primitives/renderObject.js +19 -0
- package/dist/ui/primitives/renderObject.js.map +1 -0
- package/dist/ui/primitives/renderPanel.d.ts +23 -0
- package/dist/ui/primitives/renderPanel.js +114 -0
- package/dist/ui/primitives/renderPanel.js.map +1 -0
- package/dist/ui/primitives/renderSubtitle.d.ts +7 -0
- package/dist/ui/primitives/renderSubtitle.js +6 -0
- package/dist/ui/primitives/renderSubtitle.js.map +1 -0
- package/dist/ui/primitives/renderTable.d.ts +6 -0
- package/dist/ui/primitives/renderTable.js +14 -0
- package/dist/ui/primitives/renderTable.js.map +1 -0
- package/dist/ui/primitives/text.d.ts +18 -0
- package/dist/ui/primitives/text.js +154 -0
- package/dist/ui/primitives/text.js.map +1 -0
- package/dist/ui/stream/index.d.ts +1 -0
- package/dist/ui/stream/index.js +2 -0
- package/dist/ui/stream/index.js.map +1 -0
- package/dist/ui/stream/terminal-stream.d.ts +10 -0
- package/dist/ui/stream/terminal-stream.js +20 -0
- package/dist/ui/stream/terminal-stream.js.map +1 -0
- package/dist/ui/theme/index.d.ts +1 -0
- package/dist/ui/theme/index.js +2 -0
- package/dist/ui/theme/index.js.map +1 -0
- package/dist/ui/theme/theme.d.ts +27 -0
- package/dist/ui/theme/theme.js +41 -0
- package/dist/ui/theme/theme.js.map +1 -0
- package/llms.txt +157 -0
- package/package.json +98 -35
- package/.babelrc +0 -4
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -17
- package/.npmignore +0 -1
- package/lib/arcli.min.js +0 -1
- package/src/commander/index.js +0 -3
- package/src/config.js +0 -22
- package/src/index.js +0 -19
- package/src/init/index.js +0 -13
- package/src/logger/index.js +0 -8
- package/src/logger/winston.js +0 -55
- package/src/run.js +0 -4
- package/src/spinner/index.js +0 -8
- package/src/spinner/ora.js +0 -50
- package/tst/index.js +0 -29
- package/webpack.config.js +0 -47
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CreateVoucherResultDto } from '@arcasdk/core/lib/application/dto/electronic-billing';
|
|
2
|
+
import type { INextVoucher } from '@arcasdk/core/lib/domain/types/voucher.types';
|
|
3
|
+
import type { VoucherKindDefinition } from './billing.types';
|
|
4
|
+
export interface BillingGateway {
|
|
5
|
+
createNextVoucher(payload: INextVoucher): Promise<CreateVoucherResultDto>;
|
|
6
|
+
}
|
|
7
|
+
export interface BillingResponseSummary {
|
|
8
|
+
readonly cae: string | null;
|
|
9
|
+
readonly caeVencimiento: string | null;
|
|
10
|
+
readonly errors: unknown[];
|
|
11
|
+
readonly events: unknown[];
|
|
12
|
+
readonly observaciones: string[];
|
|
13
|
+
readonly observacion: string | null;
|
|
14
|
+
readonly raw: CreateVoucherResultDto | null;
|
|
15
|
+
readonly resultado: string | null;
|
|
16
|
+
readonly suggestions: string[];
|
|
17
|
+
readonly status: 'aprobado' | 'observado' | 'rechazado';
|
|
18
|
+
}
|
|
19
|
+
export interface BillingExecutionResult {
|
|
20
|
+
readonly dryRun: boolean;
|
|
21
|
+
readonly environment: 'produccion' | 'testing';
|
|
22
|
+
readonly payload: INextVoucher;
|
|
23
|
+
readonly response: BillingResponseSummary;
|
|
24
|
+
readonly voucherKind: VoucherKindDefinition;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.types.internal.js","sourceRoot":"","sources":["../../../src/modules/billing/billing.types.internal.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.types.js","sourceRoot":"","sources":["../../../src/modules/billing/billing.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BillingCommandInput } from './billing.schemas';
|
|
2
|
+
import type { VoucherKindDefinition } from './billing.types';
|
|
3
|
+
export declare function ensureDateOrder(serviceStartDate: string, serviceEndDate: string): void;
|
|
4
|
+
export declare function validateConceptDateInputs(input: BillingCommandInput): void;
|
|
5
|
+
export declare function validateDocumentIdentity(input: BillingCommandInput, voucherKind: VoucherKindDefinition): void;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { InputValidationError } from '../../lib/errors/app-error.js';
|
|
2
|
+
import { formatDocumentFlag, formatVoucherLabel } from './billing.mappers.js';
|
|
3
|
+
export function ensureDateOrder(serviceStartDate, serviceEndDate) {
|
|
4
|
+
if (serviceStartDate > serviceEndDate) {
|
|
5
|
+
throw new InputValidationError('La fecha de inicio de servicio no puede ser posterior a la fecha de fin.');
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export function validateConceptDateInputs(input) {
|
|
9
|
+
const hasAnyServiceDate = Boolean(input.serviceStartDate || input.serviceEndDate);
|
|
10
|
+
const hasPartialServiceDate = Boolean(input.serviceStartDate) !== Boolean(input.serviceEndDate);
|
|
11
|
+
if (input.concept === 'productos') {
|
|
12
|
+
if (hasAnyServiceDate) {
|
|
13
|
+
throw new InputValidationError('El concepto "productos" no usa fechas de servicio. Quite --servicio-desde y --servicio-hasta.');
|
|
14
|
+
}
|
|
15
|
+
if (input.dueDay) {
|
|
16
|
+
throw new InputValidationError('El concepto "productos" no usa --dia. Use solo fecha o monto.');
|
|
17
|
+
}
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (hasPartialServiceDate) {
|
|
21
|
+
throw new InputValidationError('Si informa fechas de servicio, debe enviar ambas: --servicio-desde y --servicio-hasta.');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function validateDocumentIdentity(input, voucherKind) {
|
|
25
|
+
if (input.documentType === 'consumidor-final') {
|
|
26
|
+
if (input.ivaCondition !== 'consumidor-final') {
|
|
27
|
+
throw new InputValidationError(`La ${formatVoucherLabel(voucherKind)} usa consumidor final solo con --ir-cf o --iva-receptor consumidor-final.`);
|
|
28
|
+
}
|
|
29
|
+
if (typeof input.documentNumber === 'number' && input.documentNumber !== 0) {
|
|
30
|
+
throw new InputValidationError(`La ${formatVoucherLabel(voucherKind)} usa consumidor final solo con documento 0. Use --consumidor-final.`);
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (typeof input.documentNumber !== 'number') {
|
|
35
|
+
throw new InputValidationError(`La ${formatVoucherLabel(voucherKind)} requiere documento del receptor. Use ${formatDocumentFlag(input.documentType)}.`);
|
|
36
|
+
}
|
|
37
|
+
if ((input.documentType === 'cuit' || input.documentType === 'cuil') &&
|
|
38
|
+
!/^\d{11}$/.test(String(input.documentNumber))) {
|
|
39
|
+
throw new InputValidationError(`${formatDocumentFlag(input.documentType)} debe tener 11 digitos en ${formatVoucherLabel(voucherKind)}.`);
|
|
40
|
+
}
|
|
41
|
+
if (input.documentType === 'dni' && !/^\d{7,8}$/.test(String(input.documentNumber))) {
|
|
42
|
+
throw new InputValidationError(`--dni debe tener 7 u 8 digitos en ${formatVoucherLabel(voucherKind)}.`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=billing.validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.validation.js","sourceRoot":"","sources":["../../../src/modules/billing/billing.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAI3E,MAAM,UAAU,eAAe,CAAC,gBAAwB,EAAE,cAAsB;IAC9E,IAAI,gBAAgB,GAAG,cAAc,EAAE,CAAC;QACtC,MAAM,IAAI,oBAAoB,CAAC,0EAA0E,CAAC,CAAC;IAC7G,CAAC;AACH,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,KAA0B;IAClE,MAAM,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,gBAAgB,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;IAClF,MAAM,qBAAqB,GAAG,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,KAAK,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAEhG,IAAI,KAAK,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;QAClC,IAAI,iBAAiB,EAAE,CAAC;YACtB,MAAM,IAAI,oBAAoB,CAC5B,+FAA+F,CAChG,CAAC;QACJ,CAAC;QAED,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IA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,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC;QACpF,MAAM,IAAI,oBAAoB,CAAC,qCAAqC,kBAAkB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC1G,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { VoucherFamily, VoucherKindDefinition, VoucherLetter, VoucherShortcut } from './billing.types';
|
|
2
|
+
export declare const VOUCHER_KIND_MAP: Record<VoucherShortcut, VoucherKindDefinition>;
|
|
3
|
+
export declare const VOUCHER_SHORTCUTS: readonly VoucherShortcut[];
|
|
4
|
+
export declare const VOUCHER_FAMILIES: readonly VoucherFamily[];
|
|
5
|
+
export declare const VOUCHER_LETTERS: readonly ["a", "b", "c"];
|
|
6
|
+
export declare function getVoucherKindByShortcut(shortcut: string): VoucherKindDefinition | null;
|
|
7
|
+
export declare function getVoucherKindByFamilyAndLetter(family: VoucherFamily, letter: VoucherLetter): VoucherKindDefinition | null;
|
|
8
|
+
export declare function getVoucherKindByArcaType(arcaType: number): VoucherKindDefinition | null;
|
|
9
|
+
export declare function isVoucherShortcut(value: string): value is VoucherShortcut;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
export const VOUCHER_KIND_MAP = {
|
|
2
|
+
fa: {
|
|
3
|
+
arcaType: 1,
|
|
4
|
+
displayName: 'Factura A',
|
|
5
|
+
family: 'factura',
|
|
6
|
+
isElectronicCredit: false,
|
|
7
|
+
letter: 'a',
|
|
8
|
+
requiresAssociatedVoucher: false,
|
|
9
|
+
shortcut: 'fa',
|
|
10
|
+
},
|
|
11
|
+
fb: {
|
|
12
|
+
arcaType: 6,
|
|
13
|
+
displayName: 'Factura B',
|
|
14
|
+
family: 'factura',
|
|
15
|
+
isElectronicCredit: false,
|
|
16
|
+
letter: 'b',
|
|
17
|
+
requiresAssociatedVoucher: false,
|
|
18
|
+
shortcut: 'fb',
|
|
19
|
+
},
|
|
20
|
+
fc: {
|
|
21
|
+
arcaType: 11,
|
|
22
|
+
displayName: 'Factura C',
|
|
23
|
+
family: 'factura',
|
|
24
|
+
isElectronicCredit: false,
|
|
25
|
+
letter: 'c',
|
|
26
|
+
requiresAssociatedVoucher: false,
|
|
27
|
+
shortcut: 'fc',
|
|
28
|
+
},
|
|
29
|
+
nca: {
|
|
30
|
+
arcaType: 3,
|
|
31
|
+
displayName: 'Nota de credito A',
|
|
32
|
+
family: 'nota-credito',
|
|
33
|
+
isElectronicCredit: false,
|
|
34
|
+
letter: 'a',
|
|
35
|
+
requiresAssociatedVoucher: true,
|
|
36
|
+
shortcut: 'nca',
|
|
37
|
+
},
|
|
38
|
+
ncb: {
|
|
39
|
+
arcaType: 8,
|
|
40
|
+
displayName: 'Nota de credito B',
|
|
41
|
+
family: 'nota-credito',
|
|
42
|
+
isElectronicCredit: false,
|
|
43
|
+
letter: 'b',
|
|
44
|
+
requiresAssociatedVoucher: true,
|
|
45
|
+
shortcut: 'ncb',
|
|
46
|
+
},
|
|
47
|
+
ncc: {
|
|
48
|
+
arcaType: 13,
|
|
49
|
+
displayName: 'Nota de credito C',
|
|
50
|
+
family: 'nota-credito',
|
|
51
|
+
isElectronicCredit: false,
|
|
52
|
+
letter: 'c',
|
|
53
|
+
requiresAssociatedVoucher: true,
|
|
54
|
+
shortcut: 'ncc',
|
|
55
|
+
},
|
|
56
|
+
nda: {
|
|
57
|
+
arcaType: 2,
|
|
58
|
+
displayName: 'Nota de debito A',
|
|
59
|
+
family: 'nota-debito',
|
|
60
|
+
isElectronicCredit: false,
|
|
61
|
+
letter: 'a',
|
|
62
|
+
requiresAssociatedVoucher: true,
|
|
63
|
+
shortcut: 'nda',
|
|
64
|
+
},
|
|
65
|
+
ndb: {
|
|
66
|
+
arcaType: 7,
|
|
67
|
+
displayName: 'Nota de debito B',
|
|
68
|
+
family: 'nota-debito',
|
|
69
|
+
isElectronicCredit: false,
|
|
70
|
+
letter: 'b',
|
|
71
|
+
requiresAssociatedVoucher: true,
|
|
72
|
+
shortcut: 'ndb',
|
|
73
|
+
},
|
|
74
|
+
ndc: {
|
|
75
|
+
arcaType: 12,
|
|
76
|
+
displayName: 'Nota de debito C',
|
|
77
|
+
family: 'nota-debito',
|
|
78
|
+
isElectronicCredit: false,
|
|
79
|
+
letter: 'c',
|
|
80
|
+
requiresAssociatedVoucher: true,
|
|
81
|
+
shortcut: 'ndc',
|
|
82
|
+
},
|
|
83
|
+
fcea: {
|
|
84
|
+
arcaType: 201,
|
|
85
|
+
displayName: 'Factura de credito electronica A',
|
|
86
|
+
family: 'factura-credito-electronica',
|
|
87
|
+
isElectronicCredit: true,
|
|
88
|
+
letter: 'a',
|
|
89
|
+
requiresAssociatedVoucher: false,
|
|
90
|
+
shortcut: 'fcea',
|
|
91
|
+
},
|
|
92
|
+
fceb: {
|
|
93
|
+
arcaType: 206,
|
|
94
|
+
displayName: 'Factura de credito electronica B',
|
|
95
|
+
family: 'factura-credito-electronica',
|
|
96
|
+
isElectronicCredit: true,
|
|
97
|
+
letter: 'b',
|
|
98
|
+
requiresAssociatedVoucher: false,
|
|
99
|
+
shortcut: 'fceb',
|
|
100
|
+
},
|
|
101
|
+
fcec: {
|
|
102
|
+
arcaType: 211,
|
|
103
|
+
displayName: 'Factura de credito electronica C',
|
|
104
|
+
family: 'factura-credito-electronica',
|
|
105
|
+
isElectronicCredit: true,
|
|
106
|
+
letter: 'c',
|
|
107
|
+
requiresAssociatedVoucher: false,
|
|
108
|
+
shortcut: 'fcec',
|
|
109
|
+
},
|
|
110
|
+
ncea: {
|
|
111
|
+
arcaType: 203,
|
|
112
|
+
displayName: 'Nota de credito electronica A',
|
|
113
|
+
family: 'nota-credito-electronica',
|
|
114
|
+
isElectronicCredit: true,
|
|
115
|
+
letter: 'a',
|
|
116
|
+
requiresAssociatedVoucher: true,
|
|
117
|
+
shortcut: 'ncea',
|
|
118
|
+
},
|
|
119
|
+
nceb: {
|
|
120
|
+
arcaType: 208,
|
|
121
|
+
displayName: 'Nota de credito electronica B',
|
|
122
|
+
family: 'nota-credito-electronica',
|
|
123
|
+
isElectronicCredit: true,
|
|
124
|
+
letter: 'b',
|
|
125
|
+
requiresAssociatedVoucher: true,
|
|
126
|
+
shortcut: 'nceb',
|
|
127
|
+
},
|
|
128
|
+
ncec: {
|
|
129
|
+
arcaType: 213,
|
|
130
|
+
displayName: 'Nota de credito electronica C',
|
|
131
|
+
family: 'nota-credito-electronica',
|
|
132
|
+
isElectronicCredit: true,
|
|
133
|
+
letter: 'c',
|
|
134
|
+
requiresAssociatedVoucher: true,
|
|
135
|
+
shortcut: 'ncec',
|
|
136
|
+
},
|
|
137
|
+
ndea: {
|
|
138
|
+
arcaType: 202,
|
|
139
|
+
displayName: 'Nota de debito electronica A',
|
|
140
|
+
family: 'nota-debito-electronica',
|
|
141
|
+
isElectronicCredit: true,
|
|
142
|
+
letter: 'a',
|
|
143
|
+
requiresAssociatedVoucher: true,
|
|
144
|
+
shortcut: 'ndea',
|
|
145
|
+
},
|
|
146
|
+
ndeb: {
|
|
147
|
+
arcaType: 207,
|
|
148
|
+
displayName: 'Nota de debito electronica B',
|
|
149
|
+
family: 'nota-debito-electronica',
|
|
150
|
+
isElectronicCredit: true,
|
|
151
|
+
letter: 'b',
|
|
152
|
+
requiresAssociatedVoucher: true,
|
|
153
|
+
shortcut: 'ndeb',
|
|
154
|
+
},
|
|
155
|
+
ndec: {
|
|
156
|
+
arcaType: 212,
|
|
157
|
+
displayName: 'Nota de debito electronica C',
|
|
158
|
+
family: 'nota-debito-electronica',
|
|
159
|
+
isElectronicCredit: true,
|
|
160
|
+
letter: 'c',
|
|
161
|
+
requiresAssociatedVoucher: true,
|
|
162
|
+
shortcut: 'ndec',
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
export const VOUCHER_SHORTCUTS = Object.freeze(Object.keys(VOUCHER_KIND_MAP));
|
|
166
|
+
export const VOUCHER_FAMILIES = Object.freeze(Array.from(new Set(VOUCHER_SHORTCUTS.map((shortcut) => VOUCHER_KIND_MAP[shortcut].family))));
|
|
167
|
+
export const VOUCHER_LETTERS = Object.freeze(['a', 'b', 'c']);
|
|
168
|
+
export function getVoucherKindByShortcut(shortcut) {
|
|
169
|
+
return VOUCHER_KIND_MAP[shortcut] ?? null;
|
|
170
|
+
}
|
|
171
|
+
export function getVoucherKindByFamilyAndLetter(family, letter) {
|
|
172
|
+
return (VOUCHER_SHORTCUTS.map((shortcut) => VOUCHER_KIND_MAP[shortcut]).find((definition) => definition.family === family && definition.letter === letter) ?? null);
|
|
173
|
+
}
|
|
174
|
+
export function getVoucherKindByArcaType(arcaType) {
|
|
175
|
+
return (VOUCHER_SHORTCUTS.map((shortcut) => VOUCHER_KIND_MAP[shortcut]).find((definition) => definition.arcaType === arcaType) ?? null);
|
|
176
|
+
}
|
|
177
|
+
export function isVoucherShortcut(value) {
|
|
178
|
+
return value in VOUCHER_KIND_MAP;
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=voucher-kind-map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voucher-kind-map.js","sourceRoot":"","sources":["../../../src/modules/billing/voucher-kind-map.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAmD;IAC9E,EAAE,EAAE;QACF,QAAQ,EAAE,CAAC;QACX,WAAW,EAAE,WAAW;QACxB,MAAM,EAAE,SAAS;QACjB,kBAAkB,EAAE,KAAK;QACzB,MAAM,EAAE,GAAG;QACX,yBAAyB,EAAE,KAAK;QAChC,QAAQ,EAAE,IAAI;KACf;IACD,EAAE,EAAE;QACF,QAAQ,EAAE,CAAC;QACX,WAAW,EAAE,WAAW;QACxB,MAAM,EAAE,SAAS;QACjB,kBAAkB,EAAE,KAAK;QACzB,MAAM,EAAE,GAAG;QACX,yBAAyB,EAAE,KAAK;QAChC,QAAQ,EAAE,IAAI;KACf;IACD,EAAE,EAAE;QACF,QAAQ,EAAE,EAAE;QACZ,W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,gBAAgB,CAAC,QAA2B,CAAC,IAAI,IAAI,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,MAAqB,EACrB,MAAqB;IAErB,OAAO,CACL,iBAAiB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAClE,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,KAAK,MAAM,IAAI,UAAU,CAAC,MAAM,KAAK,MAAM,CAC7E,IAAI,IAAI,CACV,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,QAAgB;IACvD,OAAO,CACL,iBAAiB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAClE,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,KAAK,QAAQ,CACjD,IAAI,IAAI,CACV,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,KAAK,IAAI,gBAAgB,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ArcaRuntimeValidation } from '../../services/arca/arca-context.resolver';
|
|
2
|
+
import type { ArcliConfig } from './config.schemas';
|
|
3
|
+
export interface ConfigDoctorReport {
|
|
4
|
+
readonly checks: ReadonlyArray<{
|
|
5
|
+
readonly category: 'error' | 'ok' | 'warning';
|
|
6
|
+
readonly detail: string;
|
|
7
|
+
readonly label: string;
|
|
8
|
+
}>;
|
|
9
|
+
readonly ok: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ConfigDoctorRuntimeCheck {
|
|
12
|
+
readonly error?: string;
|
|
13
|
+
readonly validation?: ArcaRuntimeValidation;
|
|
14
|
+
}
|
|
15
|
+
export declare function buildConfigDoctorReport(config: ArcliConfig, runtimeCheck?: ConfigDoctorRuntimeCheck): ConfigDoctorReport;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { isCertificateExpiringSoon, readCertificateExpiry } from '../../lib/security/certificate.js';
|
|
2
|
+
import { readPemFile } from '../../lib/security/pem.js';
|
|
3
|
+
const CERTIFICATE_EXPIRY_WARNING_DAYS = 30;
|
|
4
|
+
function buildCertificateExpiryCheck(label, certPath) {
|
|
5
|
+
if (!certPath) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
const pemContent = readPemFile(certPath, 'certificado');
|
|
10
|
+
const expiry = readCertificateExpiry(pemContent);
|
|
11
|
+
const formattedDate = expiry.expiresAt.toLocaleDateString('es-AR');
|
|
12
|
+
if (expiry.isExpired) {
|
|
13
|
+
return { category: 'error', detail: `El certificado vencio el ${formattedDate}.`, label };
|
|
14
|
+
}
|
|
15
|
+
if (isCertificateExpiringSoon(expiry, CERTIFICATE_EXPIRY_WARNING_DAYS)) {
|
|
16
|
+
return {
|
|
17
|
+
category: 'warning',
|
|
18
|
+
detail: `El certificado vence en ${expiry.daysRemaining} dias (${formattedDate}). Renuevelo pronto.`,
|
|
19
|
+
label,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return { category: 'ok', detail: `El certificado vence el ${formattedDate}.`, label };
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return {
|
|
26
|
+
category: 'warning',
|
|
27
|
+
detail: `No se pudo verificar el vencimiento del certificado: ${error instanceof Error ? error.message : String(error)}`,
|
|
28
|
+
label,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export function buildConfigDoctorReport(config, runtimeCheck) {
|
|
33
|
+
const checks = [];
|
|
34
|
+
const conditionalChecks = [
|
|
35
|
+
{
|
|
36
|
+
label: 'CUIT',
|
|
37
|
+
ok: config.cuit,
|
|
38
|
+
okDetail: 'CUIT listo para emitir comprobantes.',
|
|
39
|
+
warningDetail: 'Configure su CUIT con "arcli config establecer cuit <valor>".',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: 'Punto de venta',
|
|
43
|
+
ok: config.puntoVentaPorDefecto,
|
|
44
|
+
okDetail: `Punto de venta por defecto: ${config.puntoVentaPorDefecto}.`,
|
|
45
|
+
warningDetail: 'Configure un punto de venta por defecto con "arcli config establecer puntoVenta <valor>".',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: 'Concepto',
|
|
49
|
+
ok: config.conceptoPorDefecto,
|
|
50
|
+
okDetail: `Concepto por defecto: ${config.conceptoPorDefecto}.`,
|
|
51
|
+
warningDetail: 'Puede fijar un concepto por defecto con "arcli config establecer concepto servicios".',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: 'IVA receptor',
|
|
55
|
+
ok: config.ivaReceptorPorDefecto,
|
|
56
|
+
okDetail: `IVA receptor por defecto: ${config.ivaReceptorPorDefecto}.`,
|
|
57
|
+
warningDetail: 'Puede fijar un IVA receptor por defecto con "arcli config establecer ivaReceptor consumidor-final".',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: 'Credenciales testing',
|
|
61
|
+
ok: config.cert.testing && config.key.testing,
|
|
62
|
+
okDetail: 'Certificado y clave de testing configurados.',
|
|
63
|
+
warningDetail: 'Faltan credenciales de testing. Configure "cert.testing" y "key.testing" con "arcli config establecer".',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
label: 'Credenciales produccion',
|
|
67
|
+
ok: config.cert.produccion && config.key.produccion,
|
|
68
|
+
okDetail: 'Certificado y clave de produccion configurados.',
|
|
69
|
+
warningDetail: 'Todavia no hay credenciales de produccion configuradas. Puede cargarlas con "cert.produccion" y "key.produccion".',
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
for (const check of conditionalChecks) {
|
|
73
|
+
checks.push(check.ok
|
|
74
|
+
? { category: 'ok', detail: check.okDetail, label: check.label }
|
|
75
|
+
: { category: 'warning', detail: check.warningDetail, label: check.label });
|
|
76
|
+
}
|
|
77
|
+
for (const [label, certPath] of [
|
|
78
|
+
['Vencimiento cert. testing', config.cert.testing],
|
|
79
|
+
['Vencimiento cert. produccion', config.cert.produccion],
|
|
80
|
+
]) {
|
|
81
|
+
const certificateCheck = buildCertificateExpiryCheck(label, certPath);
|
|
82
|
+
if (certificateCheck) {
|
|
83
|
+
checks.push(certificateCheck);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
checks.push({
|
|
87
|
+
category: 'ok',
|
|
88
|
+
detail: `Entorno por defecto: ${config.entornoPorDefecto}.`,
|
|
89
|
+
label: 'Entorno',
|
|
90
|
+
});
|
|
91
|
+
checks.push({
|
|
92
|
+
category: 'ok',
|
|
93
|
+
detail: `Emitir por defecto: ${config.output.emitirPorDefecto ? 'si' : 'no'}.`,
|
|
94
|
+
label: 'Emision',
|
|
95
|
+
});
|
|
96
|
+
checks.push({
|
|
97
|
+
category: 'ok',
|
|
98
|
+
detail: `Salida JSON por defecto: ${config.output.jsonPorDefecto ? 'si' : 'no'}.`,
|
|
99
|
+
label: 'JSON',
|
|
100
|
+
});
|
|
101
|
+
checks.push({
|
|
102
|
+
category: 'ok',
|
|
103
|
+
detail: `Respuesta bruta por defecto: ${config.output.brutoPorDefecto ? 'si' : 'no'}.`,
|
|
104
|
+
label: 'Bruto',
|
|
105
|
+
});
|
|
106
|
+
if (runtimeCheck?.validation) {
|
|
107
|
+
checks.push({
|
|
108
|
+
category: 'ok',
|
|
109
|
+
detail: `Configuracion valida para ${runtimeCheck.validation.environment}.`,
|
|
110
|
+
label: 'Revision activa',
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
else if (runtimeCheck?.error) {
|
|
114
|
+
checks.push({
|
|
115
|
+
category: 'error',
|
|
116
|
+
detail: runtimeCheck.error,
|
|
117
|
+
label: 'Revision activa',
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
checks,
|
|
122
|
+
ok: checks.every((check) => check.category === 'ok'),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=config-doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-doctor.js","sourceRoot":"","sources":["../../../src/modules/config/config-doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAClG,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAKrD,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAgB3C,SAAS,2BAA2B,CAClC,KAAa,EACb,QAA4B;IAE5B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,WAAW,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QACxD,MAAM,MAAM,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;QACjD,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAEnE,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACrB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,4BAA4B,aAAa,GAAG,EAAE,KAAK,EAAE,CAAC;QAC5F,CAAC;QAED,IAAI,yBAAyB,CAAC,MAAM,EAAE,+BAA+B,CAAC,EAAE,CAAC;YACvE,OAAO;gBACL,QAAQ,EAAE,SAAS;gBACnB,MAAM,EAAE,2BAA2B,MAAM,CAAC,aAAa,UAAU,aAAa,sBAAsB;gBACpG,KAAK;aACN,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,2BAA2B,aAAa,GAAG,EAAE,KAAK,EAAE,CAAC;IACxF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,QAAQ,EAAE,SAAS;YACnB,MA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AI,CAAC,CAAC,CAAC,IAAI,GAAG;QACjF,KAAK,EAAE,MAAM;KACd,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,CAAC;QACV,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,gCAAgC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;QACtF,KAAK,EAAE,OAAO;KACf,CAAC,CAAC;IAEH,IAAI,YAAY,EAAE,UAAU,EAAE,CAAC;QAC7B,MAAM,CAAC,IAAI,CAAC;YACV,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,6BAA6B,YAAY,CAAC,UAAU,CAAC,WAAW,GAAG;YAC3E,KAAK,EAAE,iBAAiB;SACzB,CAAC,CAAC;IACL,CAAC;SAAM,IAAI,YAAY,EAAE,KAAK,EAAE,CAAC;QAC/B,MAAM,CAAC,IAAI,CAAC;YACV,QAAQ,EAAE,OAAO;YACjB,MAAM,EAAE,YAAY,CAAC,KAAK;YAC1B,KAAK,EAAE,iBAAiB;SACzB,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,MAAM;QACN,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC;KACrD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type CanonicalConfigKey = 'cert.produccion' | 'cert.testing' | 'conceptoPorDefecto' | 'cotizacionPorDefecto' | 'cuit' | 'entornoPorDefecto' | 'ivaReceptorPorDefecto' | 'key.produccion' | 'key.testing' | 'monedaPorDefecto' | 'output.emitirPorDefecto' | 'output.jsonPorDefecto' | 'output.brutoPorDefecto' | 'puntoVentaPorDefecto' | 'ticketPath';
|
|
2
|
+
export declare function parseConfigValue(key: CanonicalConfigKey, value: string): boolean | number | string;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { readPemFile } from '../../lib/security/pem.js';
|
|
2
|
+
import { arcliDefaultConceptSchema, arcliDefaultIvaConditionSchema, arcliEnvironmentSchema } from './config.schemas.js';
|
|
3
|
+
function parseBoolean(value) {
|
|
4
|
+
const normalizedValue = value.trim().toLowerCase();
|
|
5
|
+
if (normalizedValue === 'true' || normalizedValue === '1' || normalizedValue === 'si' || normalizedValue === 'sí') {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
if (normalizedValue === 'false' || normalizedValue === '0' || normalizedValue === 'no') {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
throw new Error(`El valor "${value}" no es un booleano valido. Use true/false, si/no o 1/0.`);
|
|
12
|
+
}
|
|
13
|
+
function parseNonEmptyString(value) {
|
|
14
|
+
const normalizedValue = value.trim();
|
|
15
|
+
if (!normalizedValue) {
|
|
16
|
+
throw new Error('El valor no puede estar vacio.');
|
|
17
|
+
}
|
|
18
|
+
return normalizedValue;
|
|
19
|
+
}
|
|
20
|
+
function parsePositiveInteger(value) {
|
|
21
|
+
const parsedValue = Number.parseInt(value.trim(), 10);
|
|
22
|
+
if (!Number.isInteger(parsedValue) || parsedValue <= 0) {
|
|
23
|
+
throw new Error(`El valor "${value}" no es un entero positivo valido.`);
|
|
24
|
+
}
|
|
25
|
+
return parsedValue;
|
|
26
|
+
}
|
|
27
|
+
function parsePositiveNumber(value) {
|
|
28
|
+
const parsedValue = Number.parseFloat(value.trim());
|
|
29
|
+
if (!Number.isFinite(parsedValue) || parsedValue <= 0) {
|
|
30
|
+
throw new Error(`El valor "${value}" no es un numero positivo valido.`);
|
|
31
|
+
}
|
|
32
|
+
return parsedValue;
|
|
33
|
+
}
|
|
34
|
+
function parsePemPath(value, label) {
|
|
35
|
+
const normalizedValue = parseNonEmptyString(value);
|
|
36
|
+
readPemFile(normalizedValue, label);
|
|
37
|
+
return normalizedValue;
|
|
38
|
+
}
|
|
39
|
+
export function parseConfigValue(key, value) {
|
|
40
|
+
switch (key) {
|
|
41
|
+
case 'conceptoPorDefecto':
|
|
42
|
+
return arcliDefaultConceptSchema.parse(value.trim().toLowerCase());
|
|
43
|
+
case 'cotizacionPorDefecto':
|
|
44
|
+
return parsePositiveNumber(value);
|
|
45
|
+
case 'cuit':
|
|
46
|
+
return value.trim();
|
|
47
|
+
case 'entornoPorDefecto':
|
|
48
|
+
return arcliEnvironmentSchema.parse(value.trim().toLowerCase());
|
|
49
|
+
case 'ivaReceptorPorDefecto':
|
|
50
|
+
return arcliDefaultIvaConditionSchema.parse(value.trim().toLowerCase());
|
|
51
|
+
case 'monedaPorDefecto':
|
|
52
|
+
return value.trim().toUpperCase();
|
|
53
|
+
case 'output.emitirPorDefecto':
|
|
54
|
+
case 'output.jsonPorDefecto':
|
|
55
|
+
case 'output.brutoPorDefecto':
|
|
56
|
+
return parseBoolean(value);
|
|
57
|
+
case 'puntoVentaPorDefecto':
|
|
58
|
+
return parsePositiveInteger(value);
|
|
59
|
+
case 'ticketPath':
|
|
60
|
+
return parseNonEmptyString(value);
|
|
61
|
+
case 'cert.produccion':
|
|
62
|
+
case 'cert.testing':
|
|
63
|
+
return parsePemPath(value, 'certificado');
|
|
64
|
+
case 'key.produccion':
|
|
65
|
+
case 'key.testing':
|
|
66
|
+
return parsePemPath(value, 'clave privada');
|
|
67
|
+
default:
|
|
68
|
+
return parseNonEmptyString(value);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=config-value-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-value-parser.js","sourceRoot":"","sources":["../../../src/modules/config/config-value-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAmBrH,SAAS,YAAY,CAAC,KAAa;IACjC,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW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EAAE,eAAe,CAAC,CAAC;QAC9C;YACE,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ArcliConfig } from './config.schemas';
|
|
2
|
+
import type { ConfigDoctorReport } from './config-doctor';
|
|
3
|
+
export declare function formatConfig(config: ArcliConfig, effectiveTicketPath: string): string;
|
|
4
|
+
export declare function formatConfigPath(configPath: string): string;
|
|
5
|
+
export declare function formatConfigAsText(config: ArcliConfig, effectiveTicketPath: string): string;
|
|
6
|
+
export declare function formatConfigDoctor(report: ConfigDoctorReport): string;
|
|
7
|
+
export declare function formatConfigDoctorAsText(report: ConfigDoctorReport): string;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { maskPath } from '../../lib/paths/mask-path.js';
|
|
2
|
+
import { keyValuePanel, renderKeyValueRows, resolveKeyValueLabelWidth, statusPanel, toneText } from '../../ui/index.js';
|
|
3
|
+
function toPublicSnapshot(config, effectiveTicketPath) {
|
|
4
|
+
return {
|
|
5
|
+
cert: {
|
|
6
|
+
produccion: config.cert.produccion ? maskPath(config.cert.produccion) : undefined,
|
|
7
|
+
testing: config.cert.testing ? maskPath(config.cert.testing) : undefined,
|
|
8
|
+
},
|
|
9
|
+
concepto: config.conceptoPorDefecto,
|
|
10
|
+
cotizacion: config.cotizacionPorDefecto,
|
|
11
|
+
cuit: config.cuit,
|
|
12
|
+
emitir: config.output.emitirPorDefecto,
|
|
13
|
+
entorno: config.entornoPorDefecto,
|
|
14
|
+
ivaReceptor: config.ivaReceptorPorDefecto,
|
|
15
|
+
json: config.output.jsonPorDefecto,
|
|
16
|
+
key: {
|
|
17
|
+
produccion: config.key.produccion ? maskPath(config.key.produccion) : undefined,
|
|
18
|
+
testing: config.key.testing ? maskPath(config.key.testing) : undefined,
|
|
19
|
+
},
|
|
20
|
+
moneda: config.monedaPorDefecto,
|
|
21
|
+
puntoVenta: config.puntoVentaPorDefecto,
|
|
22
|
+
bruto: config.output.brutoPorDefecto,
|
|
23
|
+
ticketPath: maskPath(effectiveTicketPath),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function formatConfig(config, effectiveTicketPath) {
|
|
27
|
+
return JSON.stringify(toPublicSnapshot(config, effectiveTicketPath), null, 2);
|
|
28
|
+
}
|
|
29
|
+
export function formatConfigPath(configPath) {
|
|
30
|
+
return configPath;
|
|
31
|
+
}
|
|
32
|
+
export function formatConfigAsText(config, effectiveTicketPath) {
|
|
33
|
+
const safeConfig = toPublicSnapshot(config, effectiveTicketPath);
|
|
34
|
+
const rows = [
|
|
35
|
+
['CUIT', safeConfig.cuit ?? 'no configurado'],
|
|
36
|
+
['Concepto', safeConfig.concepto ?? 'no configurado'],
|
|
37
|
+
['IVA receptor', safeConfig.ivaReceptor ?? 'no configurado'],
|
|
38
|
+
['Moneda', safeConfig.moneda ?? 'PES'],
|
|
39
|
+
['Cotizacion', safeConfig.cotizacion ?? 1],
|
|
40
|
+
['Entorno', safeConfig.entorno],
|
|
41
|
+
['Cert testing', safeConfig.cert.testing ?? 'no configurado'],
|
|
42
|
+
['Key testing', safeConfig.key.testing ?? 'no configurado'],
|
|
43
|
+
['Cert produccion', safeConfig.cert.produccion ?? 'no configurado'],
|
|
44
|
+
['Key produccion', safeConfig.key.produccion ?? 'no configurado'],
|
|
45
|
+
['Punto de venta', safeConfig.puntoVenta ?? 'no configurado'],
|
|
46
|
+
['Emitir', safeConfig.emitir ? 'si' : 'no'],
|
|
47
|
+
['Salida JSON', safeConfig.json ? 'si' : 'no'],
|
|
48
|
+
['Salida bruta', safeConfig.bruto ? 'si' : 'no'],
|
|
49
|
+
['Ruta tickets WSAA', safeConfig.ticketPath],
|
|
50
|
+
];
|
|
51
|
+
return keyValuePanel('Configuracion', renderKeyValueRows(rows, { labelWidth: resolveKeyValueLabelWidth('standard', rows, [35, 65]) }));
|
|
52
|
+
}
|
|
53
|
+
export function formatConfigDoctor(report) {
|
|
54
|
+
return JSON.stringify({
|
|
55
|
+
chequeos: report.checks.map((check) => ({
|
|
56
|
+
categoria: check.category,
|
|
57
|
+
detalle: check.detail,
|
|
58
|
+
etiqueta: check.label,
|
|
59
|
+
})),
|
|
60
|
+
ok: report.ok,
|
|
61
|
+
}, null, 2);
|
|
62
|
+
}
|
|
63
|
+
export function formatConfigDoctorAsText(report) {
|
|
64
|
+
const lines = report.checks.map((check) => {
|
|
65
|
+
const icon = check.category === 'ok'
|
|
66
|
+
? toneText('✓', 'success')
|
|
67
|
+
: check.category === 'warning'
|
|
68
|
+
? toneText('!', 'warning')
|
|
69
|
+
: toneText('x', 'danger');
|
|
70
|
+
return `${icon} ${check.label}: ${check.detail}`;
|
|
71
|
+
});
|
|
72
|
+
const tone = report.ok ? 'success' : report.checks.some((check) => check.category === 'error') ? 'danger' : 'warning';
|
|
73
|
+
const footer = report.ok
|
|
74
|
+
? 'Configuracion lista para usar ARCLI'
|
|
75
|
+
: report.checks.some((check) => check.category === 'error')
|
|
76
|
+
? 'Hay puntos criticos por corregir antes de emitir'
|
|
77
|
+
: 'Revise las recomendaciones antes de emitir en serio';
|
|
78
|
+
return statusPanel('Revision de configuracion', lines, footer, 'wide', tone);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=config.presenter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.presenter.js","sourceRoot":"","sources":["../../../src/modules/config/config.presenter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AA2B/G,SAAS,gBAAgB,CAAC,MAAmB,EAAE,mBAA2B;IACxE,OAAO;QACL,IAAI,EAAE;YACJ,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAA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