arcli 2.0.0 → 2.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/CHANGELOG.md +55 -1
- package/README.md +15 -14
- package/dist/cli/arca-runtime.d.ts +20 -0
- package/dist/cli/arca-runtime.js +42 -0
- package/dist/cli/arca-runtime.js.map +1 -0
- package/dist/cli/commands/billing.command.batch.d.ts +15 -5
- package/dist/cli/commands/billing.command.batch.js +28 -11
- package/dist/cli/commands/billing.command.batch.js.map +1 -1
- package/dist/cli/commands/billing.command.interactive-preview.js +4 -1
- package/dist/cli/commands/billing.command.interactive-preview.js.map +1 -1
- package/dist/cli/commands/billing.command.options.js +1 -1
- package/dist/cli/commands/billing.command.options.js.map +1 -1
- package/dist/cli/commands/billing.command.output.d.ts +4 -0
- package/dist/cli/commands/billing.command.output.js +3 -2
- package/dist/cli/commands/billing.command.output.js.map +1 -1
- package/dist/cli/commands/billing.command.parser.d.ts +7 -0
- package/dist/cli/commands/billing.command.parser.js +28 -15
- package/dist/cli/commands/billing.command.parser.js.map +1 -1
- package/dist/cli/commands/billing.command.shared.d.ts +22 -3
- package/dist/cli/commands/billing.command.shared.js +84 -47
- package/dist/cli/commands/billing.command.shared.js.map +1 -1
- package/dist/cli/commands/config.command.d.ts +3 -4
- package/dist/cli/commands/config.command.js +39 -39
- package/dist/cli/commands/config.command.js.map +1 -1
- package/dist/cli/commands/cuit-argument.d.ts +2 -0
- package/dist/cli/commands/cuit-argument.js +10 -0
- package/dist/cli/commands/cuit-argument.js.map +1 -0
- package/dist/cli/commands/fce-obligation.command.js +6 -13
- package/dist/cli/commands/fce-obligation.command.js.map +1 -1
- package/dist/cli/commands/interactive.command.js +8 -6
- package/dist/cli/commands/interactive.command.js.map +1 -1
- package/dist/cli/commands/padron.command.d.ts +2 -0
- package/dist/cli/commands/padron.command.js +47 -0
- package/dist/cli/commands/padron.command.js.map +1 -0
- package/dist/cli/commands/parameters.command.js +8 -7
- package/dist/cli/commands/parameters.command.js.map +1 -1
- package/dist/cli/commands/pdf.command.js +17 -30
- package/dist/cli/commands/pdf.command.js.map +1 -1
- package/dist/cli/commands/vouchers.command.js +5 -5
- package/dist/cli/commands/vouchers.command.js.map +1 -1
- package/dist/cli/error-output.d.ts +20 -2
- package/dist/cli/error-output.js +70 -10
- package/dist/cli/error-output.js.map +1 -1
- package/dist/cli/global-options.d.ts +26 -0
- package/dist/cli/global-options.js +56 -0
- package/dist/cli/global-options.js.map +1 -0
- package/dist/cli/help.d.ts +2 -0
- package/dist/cli/help.js +75 -29
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/ignored-global-options.d.ts +6 -0
- package/dist/cli/ignored-global-options.js +33 -0
- package/dist/cli/ignored-global-options.js.map +1 -0
- package/dist/cli/index.js +7 -11
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/interactive/config.flow.d.ts +1 -2
- package/dist/cli/interactive/config.flow.js +4 -3
- package/dist/cli/interactive/config.flow.js.map +1 -1
- package/dist/cli/interactive/interactive-mode.js +48 -17
- package/dist/cli/interactive/interactive-mode.js.map +1 -1
- package/dist/cli/interactive/invoice.flow.d.ts +2 -0
- package/dist/cli/interactive/invoice.flow.js +4 -3
- package/dist/cli/interactive/invoice.flow.js.map +1 -1
- package/dist/cli/interactive/note.flow.d.ts +2 -0
- package/dist/cli/interactive/note.flow.js +4 -3
- package/dist/cli/interactive/note.flow.js.map +1 -1
- package/dist/cli/interactive/receiver-padron.d.ts +29 -0
- package/dist/cli/interactive/receiver-padron.js +53 -0
- package/dist/cli/interactive/receiver-padron.js.map +1 -0
- package/dist/cli/interactive/repeat.flow.js +3 -3
- package/dist/cli/interactive/repeat.flow.js.map +1 -1
- package/dist/cli/interactive/session.js +4 -1
- package/dist/cli/interactive/session.js.map +1 -1
- package/dist/cli/program.d.ts +5 -1
- package/dist/cli/program.js +8 -2
- package/dist/cli/program.js.map +1 -1
- package/dist/cli/version.d.ts +1 -1
- package/dist/cli/version.js +1 -1
- package/dist/lib/errors/app-error.d.ts +1 -1
- package/dist/lib/errors/app-error.js +2 -1
- package/dist/lib/errors/app-error.js.map +1 -1
- package/dist/lib/files/write-new-file.d.ts +5 -0
- package/dist/lib/files/write-new-file.js +30 -0
- package/dist/lib/files/write-new-file.js.map +1 -0
- package/dist/lib/links.d.ts +2 -0
- package/dist/lib/links.js +2 -0
- package/dist/lib/links.js.map +1 -1
- package/dist/lib/security/certificate.d.ts +5 -1
- package/dist/lib/security/certificate.js +10 -7
- package/dist/lib/security/certificate.js.map +1 -1
- package/dist/modules/billing/billing-response.js +12 -0
- package/dist/modules/billing/billing-response.js.map +1 -1
- package/dist/modules/billing/billing.batch.js +7 -1
- package/dist/modules/billing/billing.batch.js.map +1 -1
- package/dist/modules/billing/billing.date-range.js +27 -10
- package/dist/modules/billing/billing.date-range.js.map +1 -1
- package/dist/modules/billing/billing.display.js +5 -1
- package/dist/modules/billing/billing.display.js.map +1 -1
- package/dist/modules/billing/billing.json-input.d.ts +58 -0
- package/dist/modules/billing/billing.json-input.js +279 -0
- package/dist/modules/billing/billing.json-input.js.map +1 -0
- package/dist/modules/billing/billing.padron.d.ts +14 -0
- package/dist/modules/billing/billing.padron.js +55 -0
- package/dist/modules/billing/billing.padron.js.map +1 -0
- package/dist/modules/billing/billing.schemas.d.ts +5 -0
- package/dist/modules/billing/billing.schemas.js +6 -0
- package/dist/modules/billing/billing.schemas.js.map +1 -1
- package/dist/modules/billing/billing.serialize.d.ts +1 -0
- package/dist/modules/billing/billing.serialize.js +5 -12
- package/dist/modules/billing/billing.serialize.js.map +1 -1
- package/dist/modules/billing/billing.service.d.ts +3 -0
- package/dist/modules/billing/billing.service.js +22 -1
- package/dist/modules/billing/billing.service.js.map +1 -1
- package/dist/modules/billing/billing.text.js +4 -12
- package/dist/modules/billing/billing.text.js.map +1 -1
- package/dist/modules/billing/billing.types.internal.d.ts +10 -2
- package/dist/modules/config/certificate-expiry.d.ts +42 -0
- package/dist/modules/config/certificate-expiry.js +91 -0
- package/dist/modules/config/certificate-expiry.js.map +1 -0
- package/dist/modules/config/config-doctor.d.ts +5 -4
- package/dist/modules/config/config-doctor.js +8 -16
- package/dist/modules/config/config-doctor.js.map +1 -1
- package/dist/modules/config/config-value-parser.d.ts +1 -1
- package/dist/modules/config/config-value-parser.js +13 -11
- package/dist/modules/config/config-value-parser.js.map +1 -1
- package/dist/modules/config/config.presenter.d.ts +2 -0
- package/dist/modules/config/config.presenter.js +6 -0
- package/dist/modules/config/config.presenter.js.map +1 -1
- package/dist/modules/config/config.schemas.d.ts +2 -0
- package/dist/modules/config/config.schemas.js +3 -0
- package/dist/modules/config/config.schemas.js.map +1 -1
- package/dist/modules/config/config.sections.js +6 -1
- package/dist/modules/config/config.sections.js.map +1 -1
- package/dist/modules/config/config.service.js +33 -8
- package/dist/modules/config/config.service.js.map +1 -1
- package/dist/modules/examples/examples.d.ts +5 -0
- package/dist/modules/examples/examples.js +29 -28
- package/dist/modules/examples/examples.js.map +1 -1
- package/dist/modules/interactive/config-fields.js +6 -0
- package/dist/modules/interactive/config-fields.js.map +1 -1
- package/dist/modules/interactive/equivalent-command.js +2 -2
- package/dist/modules/interactive/equivalent-command.js.map +1 -1
- package/dist/modules/padron/padron.d.ts +46 -0
- package/dist/modules/padron/padron.js +24 -0
- package/dist/modules/padron/padron.js.map +1 -0
- package/dist/modules/padron/padron.presenter.d.ts +7 -0
- package/dist/modules/padron/padron.presenter.js +49 -0
- package/dist/modules/padron/padron.presenter.js.map +1 -0
- package/dist/modules/parameters/parameters.presenter.js +5 -2
- package/dist/modules/parameters/parameters.presenter.js.map +1 -1
- package/dist/modules/storybook/showcase.js +17 -4
- package/dist/modules/storybook/showcase.js.map +1 -1
- package/dist/services/arca/arca-billing.gateway.d.ts +8 -2
- package/dist/services/arca/arca-billing.gateway.js +17 -2
- package/dist/services/arca/arca-billing.gateway.js.map +1 -1
- package/dist/services/arca/arca-client.factory.d.ts +2 -1
- package/dist/services/arca/arca-client.factory.js +5 -0
- package/dist/services/arca/arca-client.factory.js.map +1 -1
- package/dist/services/arca/arca-context.resolver.d.ts +11 -0
- package/dist/services/arca/arca-context.resolver.js +12 -1
- package/dist/services/arca/arca-context.resolver.js.map +1 -1
- package/dist/services/arca/arca-padron.gateway.d.ts +9 -0
- package/dist/services/arca/arca-padron.gateway.js +104 -0
- package/dist/services/arca/arca-padron.gateway.js.map +1 -0
- package/dist/services/pdf/pdf-exporter.d.ts +6 -3
- package/dist/services/pdf/pdf-exporter.js +11 -9
- package/dist/services/pdf/pdf-exporter.js.map +1 -1
- package/dist/ui/components/certificateBanner.d.ts +11 -0
- package/dist/ui/components/certificateBanner.js +9 -0
- package/dist/ui/components/certificateBanner.js.map +1 -0
- package/dist/ui/components/index.d.ts +1 -0
- package/dist/ui/components/index.js +1 -0
- package/dist/ui/components/index.js.map +1 -1
- package/dist/ui/presenters/config.presenter.d.ts +1 -1
- package/dist/ui/presenters/config.presenter.js +1 -1
- package/dist/ui/presenters/config.presenter.js.map +1 -1
- package/dist/ui/presenters/errors.presenter.js +4 -1
- package/dist/ui/presenters/errors.presenter.js.map +1 -1
- package/dist/ui/presenters/errors.zod-presenter.js +5 -26
- package/dist/ui/presenters/errors.zod-presenter.js.map +1 -1
- package/dist/ui/stream/terminal-stream.d.ts +5 -0
- package/dist/ui/stream/terminal-stream.js +13 -1
- package/dist/ui/stream/terminal-stream.js.map +1 -1
- package/llms.txt +59 -41
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive.command.js","sourceRoot":"","sources":["../../../src/cli/commands/interactive.command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"interactive.command.js","sourceRoot":"","sources":["../../../src/cli/commands/interactive.command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,MAAM,UAAU,qBAAqB;IACnC,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,OAAgB;IACzD,MAAM,OAAO,GAAG,OAAO;SACpB,OAAO,CAAC,aAAa,CAAC;SACtB,WAAW,CAAC,4FAA4F,CAAC,CAAC;IAE7G,yEAAyE;IACzE,0BAA0B,CAAC,OAAO,CAAC,CAAC;IACpC,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAE9B,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,QAAiB,EAAE,IAAa,EAAE,EAAE;QACxD,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;YAC7B,MAAM,IAAI,oBAAoB,CAC5B,oFAAoF,CACrF,CAAC;QACJ,CAAC;QAED,uFAAuF;QACvF,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAEvD,MAAM,kBAAkB,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AppError } from '../../lib/errors/app-error.js';
|
|
2
|
+
import { formatPadronAsJson, formatPadronAsText } from '../../modules/padron/padron.presenter.js';
|
|
3
|
+
import { ArcaClientFactory } from '../../services/arca/arca-client.factory.js';
|
|
4
|
+
import { ArcaPadronGateway } from '../../services/arca/arca-padron.gateway.js';
|
|
5
|
+
import { writeTerminalJson, writeTerminalOutput } from '../../ui/index.js';
|
|
6
|
+
import { resolveArcaRuntime } from '../arca-runtime.js';
|
|
7
|
+
import { getGlobalOptions, registerQueryOptions } from '../global-options.js';
|
|
8
|
+
import { configureSpanishHelp, createPadronHelp } from '../help.js';
|
|
9
|
+
import { startSpinner } from '../spinner.js';
|
|
10
|
+
import { parseCuitArgument } from './cuit-argument.js';
|
|
11
|
+
export function registerPadronCommand(program) {
|
|
12
|
+
const command = program
|
|
13
|
+
.command('padron')
|
|
14
|
+
.argument('<cuit>', 'CUIT a consultar')
|
|
15
|
+
.description('consultar en el padron de ARCA el nombre, domicilio y condicion IVA de un CUIT')
|
|
16
|
+
.addHelpText('after', createPadronHelp());
|
|
17
|
+
registerQueryOptions(command);
|
|
18
|
+
configureSpanishHelp(command);
|
|
19
|
+
command.action(async (rawCuit, _options, self) => {
|
|
20
|
+
const cuit = parseCuitArgument(rawCuit);
|
|
21
|
+
const runtime = resolveArcaRuntime(getGlobalOptions(self));
|
|
22
|
+
const spinner = runtime.outputJson ? null : startSpinner('Consultando el padron...');
|
|
23
|
+
try {
|
|
24
|
+
const taxpayer = await new ArcaPadronGateway(new ArcaClientFactory().create(runtime)).getTaxpayer(cuit);
|
|
25
|
+
spinner?.stop();
|
|
26
|
+
if (!taxpayer) {
|
|
27
|
+
throw new AppError(`El CUIT ${cuit} no figura en el padron de ARCA (${runtime.environment}).`, {
|
|
28
|
+
code: 'TAXPAYER_NOT_FOUND',
|
|
29
|
+
suggestion: runtime.environment === 'testing'
|
|
30
|
+
? 'El padron de testing tiene datos ficticios: pruebe con 20201797064.'
|
|
31
|
+
: 'Revise el numero.',
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const report = { environment: runtime.environment, taxpayer };
|
|
35
|
+
if (runtime.outputJson) {
|
|
36
|
+
writeTerminalJson(formatPadronAsJson(report));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
writeTerminalOutput(formatPadronAsText(report));
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
spinner?.stop();
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=padron.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"padron.command.js","sourceRoot":"","sources":["../../../src/cli/commands/padron.command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,MAAM,OAAO,GAAG,OAAO;SACpB,OAAO,CAAC,QAAQ,CAAC;SACjB,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;SACtC,WAAW,CAAC,gFAAgF,CAAC;SAC7F,WAAW,CAAC,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAE5C,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC9B,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAE9B,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,OAAe,EAAE,QAAiB,EAAE,IAAa,EAAE,EAAE;QACzE,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACxC,MAAM,OAAO,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3D,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAC;QAErF,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,iBAAiB,CAAC,IAAI,iBAAiB,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YAExG,OAAO,EAAE,IAAI,EAAE,CAAC;YAEhB,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,MAAM,IAAI,QAAQ,CAAC,WAAW,IAAI,oCAAoC,OAAO,CAAC,WAAW,IAAI,EAAE;oBAC7F,IAAI,EAAE,oBAAoB;oBAC1B,UAAU,EACR,OAAO,CAAC,WAAW,KAAK,SAAS;wBAC/B,CAAC,CAAC,qEAAqE;wBACvE,CAAC,CAAC,mBAAmB;iBAC1B,CAAC,CAAC;YACL,CAAC;YAED,MAAM,MAAM,GAAG,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,CAAC;YAE9D,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;gBACvB,iBAAiB,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;gBAE9C,OAAO;YACT,CAAC;YAED,mBAAmB,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,IAAI,EAAE,CAAC;YAChB,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -4,14 +4,14 @@ import { filterCurrentEntries, resolveParameterTable, salesPointToEntry } from '
|
|
|
4
4
|
import { formatParameterEntriesAsJson, formatParameterEntriesAsText, formatParameterTablesAsJson, formatParameterTablesAsText, formatQuotationAsJson, formatQuotationAsText, formatStatusAsJson, formatStatusAsText, } from '../../modules/parameters/parameters.presenter.js';
|
|
5
5
|
import { buildStatusReport } from '../../modules/parameters/status.js';
|
|
6
6
|
import { ArcaClientFactory } from '../../services/arca/arca-client.factory.js';
|
|
7
|
-
import { ArcaContextResolver } from '../../services/arca/arca-context.resolver.js';
|
|
8
7
|
import { ArcaParametersGateway } from '../../services/arca/arca-parameters.gateway.js';
|
|
9
8
|
import { writeTerminalJson, writeTerminalOutput } from '../../ui/index.js';
|
|
9
|
+
import { resolveArcaRuntime } from '../arca-runtime.js';
|
|
10
|
+
import { getGlobalOptions, registerQueryOptions, resolveOutputJson } from '../global-options.js';
|
|
10
11
|
import { configureSpanishHelp } from '../help.js';
|
|
11
12
|
import { startSpinner } from '../spinner.js';
|
|
12
|
-
import { getGlobalOptions, registerGlobalOptions } from './billing.command.shared.js';
|
|
13
13
|
function createContext(command) {
|
|
14
|
-
const runtime =
|
|
14
|
+
const runtime = resolveArcaRuntime(getGlobalOptions(command));
|
|
15
15
|
return { gateway: new ArcaParametersGateway(new ArcaClientFactory().create(runtime)), runtime };
|
|
16
16
|
}
|
|
17
17
|
async function withSpinner(runtime, run) {
|
|
@@ -36,12 +36,13 @@ export function registerParametersCommands(program) {
|
|
|
36
36
|
.argument('[tabla]', 'tabla a consultar; sin tabla lista las disponibles')
|
|
37
37
|
.argument('[moneda]', 'solo para "cotizacion": codigo de moneda, por ejemplo USD')
|
|
38
38
|
.description('consultar tablas de ARCA: puntos de venta, tipos, alicuotas, monedas y cotizacion');
|
|
39
|
-
|
|
39
|
+
registerQueryOptions(parameters);
|
|
40
40
|
configureSpanishHelp(parameters);
|
|
41
41
|
parameters.action(async (rawTable, currency, _options, self) => {
|
|
42
42
|
if (!rawTable) {
|
|
43
|
-
// No consulta ARCA: no hace falta config ni credenciales para ver las tablas
|
|
44
|
-
|
|
43
|
+
// No consulta ARCA: no hace falta config ni credenciales para ver las tablas (si la config no se puede
|
|
44
|
+
// leer, sale en texto salvo con --json).
|
|
45
|
+
if (resolveOutputJson(self)) {
|
|
45
46
|
writeTerminalJson(formatParameterTablesAsJson());
|
|
46
47
|
}
|
|
47
48
|
else {
|
|
@@ -68,7 +69,7 @@ export function registerParametersCommands(program) {
|
|
|
68
69
|
const status = program
|
|
69
70
|
.command('estado')
|
|
70
71
|
.description('ver si ARCA responde y si el punto de venta configurado esta habilitado');
|
|
71
|
-
|
|
72
|
+
registerQueryOptions(status);
|
|
72
73
|
configureSpanishHelp(status);
|
|
73
74
|
status.action(async (_options, self) => {
|
|
74
75
|
const { gateway, runtime } = createContext(self);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameters.command.js","sourceRoot":"","sources":["../../../src/cli/commands/parameters.command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACrH,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,2BAA2B,EAC3B,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"parameters.command.js","sourceRoot":"","sources":["../../../src/cli/commands/parameters.command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE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ACnD,IAAI,CAAC;gBACH,OAAO,MAAM,iBAAiB,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;YAClH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,QAAQ,CAAC,sBAAsB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE;oBACjG,IAAI,EAAE,kBAAkB;iBACzB,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -2,22 +2,23 @@ import { join } from 'node:path';
|
|
|
2
2
|
import { ConfigService } from '../../modules/config/config.service.js';
|
|
3
3
|
import { PdfPlugin } from '../../services/pdf/pdf-plugin.js';
|
|
4
4
|
import { formatPdfPluginStatusAsJson, formatPdfPluginStatusAsText, noticePanel, writeTerminalJson, writeTerminalOutput, } from '../../ui/index.js';
|
|
5
|
+
import { registerJsonOption, resolveOutputJson } from '../global-options.js';
|
|
5
6
|
import { configureSpanishHelp } from '../help.js';
|
|
6
7
|
import { startSpinner } from '../spinner.js';
|
|
7
|
-
function
|
|
8
|
+
function createContext(command) {
|
|
8
9
|
const service = new ConfigService();
|
|
9
10
|
try {
|
|
10
11
|
const config = service.getConfig();
|
|
11
|
-
return
|
|
12
|
+
return {
|
|
13
|
+
json: resolveOutputJson(command, config),
|
|
14
|
+
plugin: new PdfPlugin({ configuredBrowser: config.pdfNavegador, path: join(service.getPluginsPath(), 'pdf') }),
|
|
15
|
+
};
|
|
12
16
|
}
|
|
13
17
|
finally {
|
|
14
18
|
service.close();
|
|
15
19
|
}
|
|
16
20
|
}
|
|
17
|
-
function
|
|
18
|
-
return command.optsWithGlobals().json === true;
|
|
19
|
-
}
|
|
20
|
-
function printStatus(plugin, json, title) {
|
|
21
|
+
function printStatus({ json, plugin }, title) {
|
|
21
22
|
const status = plugin.getStatus();
|
|
22
23
|
if (json) {
|
|
23
24
|
writeTerminalJson(formatPdfPluginStatusAsJson(status));
|
|
@@ -26,26 +27,16 @@ function printStatus(plugin, json, title) {
|
|
|
26
27
|
writeTerminalOutput(formatPdfPluginStatusAsText(status, title));
|
|
27
28
|
}
|
|
28
29
|
export function registerPdfCommand(program) {
|
|
29
|
-
const pdfCommand = program
|
|
30
|
-
.command('pdf')
|
|
31
|
-
.description('instalar o revisar el plugin que genera los PDFs de los comprobantes')
|
|
32
|
-
.option('--json', 'imprimir salida JSON')
|
|
33
|
-
.action((_options, command) => printStatus(createPlugin(), wantsJson(command)));
|
|
30
|
+
const pdfCommand = registerJsonOption(program.command('pdf').description('instalar o revisar el plugin que genera los PDFs de los comprobantes')).action((_options, command) => printStatus(createContext(command)));
|
|
34
31
|
configureSpanishHelp(pdfCommand);
|
|
35
|
-
const estadoCommand = pdfCommand
|
|
36
|
-
.command('estado')
|
|
37
|
-
.description('mostrar si el plugin esta instalado, su version y el navegador que usa')
|
|
38
|
-
.option('--json', 'imprimir salida JSON')
|
|
39
|
-
.action((_options, command) => printStatus(createPlugin(), wantsJson(command)));
|
|
32
|
+
const estadoCommand = registerJsonOption(pdfCommand.command('estado').description('mostrar si el plugin esta instalado, su version y el navegador que usa')).action((_options, command) => printStatus(createContext(command)));
|
|
40
33
|
configureSpanishHelp(estadoCommand);
|
|
41
34
|
// Pedir el comando ya es la confirmacion: no se vuelve a preguntar, asi tambien sirve en scripts.
|
|
42
|
-
const instalarCommand = pdfCommand
|
|
35
|
+
const instalarCommand = registerJsonOption(pdfCommand
|
|
43
36
|
.command('instalar')
|
|
44
|
-
.description('descargar el plugin de PDF (~160 MB, o ~360 MB si no hay Chrome instalado)')
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const json = wantsJson(command);
|
|
48
|
-
const plugin = createPlugin();
|
|
37
|
+
.description('descargar el plugin de PDF (~160 MB, o ~360 MB si no hay Chrome instalado)')).action(async (_options, command) => {
|
|
38
|
+
const context = createContext(command);
|
|
39
|
+
const { json, plugin } = context;
|
|
49
40
|
const spinner = json ? null : startSpinner('Instalando el plugin de PDF...');
|
|
50
41
|
try {
|
|
51
42
|
await plugin.install((message) => {
|
|
@@ -57,17 +48,13 @@ export function registerPdfCommand(program) {
|
|
|
57
48
|
finally {
|
|
58
49
|
spinner?.stop();
|
|
59
50
|
}
|
|
60
|
-
printStatus(
|
|
51
|
+
printStatus(context, 'Plugin de PDF instalado');
|
|
61
52
|
});
|
|
62
53
|
configureSpanishHelp(instalarCommand);
|
|
63
|
-
const desinstalarCommand = pdfCommand
|
|
64
|
-
|
|
65
|
-
.description('borrar el plugin de PDF y el navegador que haya descargado')
|
|
66
|
-
.option('--json', 'imprimir salida JSON')
|
|
67
|
-
.action((_options, command) => {
|
|
68
|
-
const plugin = createPlugin();
|
|
54
|
+
const desinstalarCommand = registerJsonOption(pdfCommand.command('desinstalar').description('borrar el plugin de PDF y el navegador que haya descargado')).action((_options, command) => {
|
|
55
|
+
const { json, plugin } = createContext(command);
|
|
69
56
|
plugin.uninstall();
|
|
70
|
-
if (
|
|
57
|
+
if (json) {
|
|
71
58
|
writeTerminalJson(JSON.stringify({ desinstalado: true, ruta: plugin.getStatus().path }, null, 2));
|
|
72
59
|
return;
|
|
73
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pdf.command.js","sourceRoot":"","sources":["../../../src/cli/commands/pdf.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EACL,2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AgC,CAAC,CAAC;QAE7E,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC/B,IAAI,OAAO,EAAE,CAAC;oBACZ,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC;gBACzB,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,OAAO,EAAE,IAAI,EAAE,CAAC;QAClB,CAAC;QAED,WAAW,CAAC,OAAO,EAAE,yBAAyB,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IACH,oBAAoB,CAAC,eAAe,CAAC,CAAC;IAEtC,MAAM,kBAAkB,GAAG,kBAAkB,CAC3C,UAAU,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC,4DAA4D,CAAC,CAC5G,CAAC,MAAM,CAAC,CAAC,QAAiB,EAAE,OAAgB,EAAE,EAAE;QAC/C,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;QAEhD,MAAM,CAAC,SAAS,EAAE,CAAC;QAEnB,IAAI,IAAI,EAAE,CAAC;YACT,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAElG,OAAO;QACT,CAAC;QAED,mBAAmB,CAAC,WAAW,CAAC,6BAA6B,EAAE,SAAS,CAAC,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;IACH,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -3,13 +3,13 @@ import { getVoucherKindByShortcut, VOUCHER_SHORTCUTS } from '../../modules/billi
|
|
|
3
3
|
import { listRecentVouchers, MAX_RECENT_VOUCHERS, RECENT_VOUCHERS_LIMIT } from '../../modules/vouchers/voucher-history.js';
|
|
4
4
|
import { formatVoucherDetailAsJson, formatVoucherDetailAsText, formatVoucherListAsJson, formatVoucherListAsText, formatVoucherNumber, } from '../../modules/vouchers/voucher-history.presenter.js';
|
|
5
5
|
import { ArcaClientFactory } from '../../services/arca/arca-client.factory.js';
|
|
6
|
-
import { ArcaContextResolver } from '../../services/arca/arca-context.resolver.js';
|
|
7
6
|
import { ArcaVoucherHistoryGateway } from '../../services/arca/arca-voucher-history.gateway.js';
|
|
8
7
|
import { writeTerminalJson, writeTerminalOutput } from '../../ui/index.js';
|
|
8
|
+
import { resolveArcaRuntime } from '../arca-runtime.js';
|
|
9
|
+
import { getGlobalOptions, registerQueryOptions } from '../global-options.js';
|
|
9
10
|
import { configureSpanishHelp, createVoucherQueryHelp } from '../help.js';
|
|
10
11
|
import { integerOption } from '../option-parsers.js';
|
|
11
12
|
import { startSpinner } from '../spinner.js';
|
|
12
|
-
import { getGlobalOptions, registerGlobalOptions } from './billing.command.shared.js';
|
|
13
13
|
function requireVoucherKind(shortcut) {
|
|
14
14
|
const voucherKind = getVoucherKindByShortcut(shortcut.trim().toLowerCase());
|
|
15
15
|
if (!voucherKind) {
|
|
@@ -25,7 +25,7 @@ function requirePointOfSale(options, runtime) {
|
|
|
25
25
|
return pointOfSale;
|
|
26
26
|
}
|
|
27
27
|
function createContext(command) {
|
|
28
|
-
const runtime =
|
|
28
|
+
const runtime = resolveArcaRuntime(getGlobalOptions(command));
|
|
29
29
|
return { gateway: new ArcaVoucherHistoryGateway(new ArcaClientFactory().create(runtime)), runtime };
|
|
30
30
|
}
|
|
31
31
|
function addPointOfSaleOptions(command) {
|
|
@@ -48,7 +48,7 @@ export function registerVoucherQueryCommands(program) {
|
|
|
48
48
|
.argument('<tipo>', 'atajo del comprobante, por ejemplo fb, fc o nca')
|
|
49
49
|
.description('listar los ultimos comprobantes emitidos en ARCA')
|
|
50
50
|
.option('--cantidad <numero>', `cuantos comprobantes mostrar (1 a ${MAX_RECENT_VOUCHERS}; por defecto config.comprobantesPorLista o ${RECENT_VOUCHERS_LIMIT})`, integerOption('--cantidad'))).addHelpText('after', createVoucherQueryHelp());
|
|
51
|
-
|
|
51
|
+
registerQueryOptions(recent);
|
|
52
52
|
configureSpanishHelp(recent);
|
|
53
53
|
recent.action(async (shortcut, options, self) => {
|
|
54
54
|
const voucherKind = requireVoucherKind(shortcut);
|
|
@@ -72,7 +72,7 @@ export function registerVoucherQueryCommands(program) {
|
|
|
72
72
|
.argument('<tipo>', 'atajo del comprobante, por ejemplo fb, fc o nca')
|
|
73
73
|
.argument('<numero>', 'numero del comprobante')
|
|
74
74
|
.description('ver el detalle de un comprobante emitido en ARCA')).addHelpText('after', createVoucherQueryHelp());
|
|
75
|
-
|
|
75
|
+
registerQueryOptions(detail);
|
|
76
76
|
configureSpanishHelp(detail);
|
|
77
77
|
detail.action(async (shortcut, rawNumber, options, self) => {
|
|
78
78
|
const voucherKind = requireVoucherKind(shortcut);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vouchers.command.js","sourceRoot":"","sources":["../../../src/cli/commands/vouchers.command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AACrG,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AACxH,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"vouchers.command.js","sourceRoot":"","sources":["../../../src/cli/commands/vouchers.command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAA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E,MAAM,CAAC,aAAa,OAAO,CAAC,WAAW,IAAI,EAC1H,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAC9B,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;QAEvF,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACvB,iBAAiB,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC;YAErD,OAAO;QACT,CAAC;QAED,mBAAmB,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
import { type Command, CommanderError } from 'commander';
|
|
2
|
+
import { AppError } from '../lib/errors/app-error';
|
|
3
|
+
import { readJsonDefault } from './global-options';
|
|
2
4
|
/**
|
|
3
5
|
* Los errores salen en JSON con `--json` o, sin el flag, si la config tiene `json=true`, igual que los
|
|
4
6
|
* resultados. La config se lee recien al fallar; si tambien falla (config invalida), sale en texto.
|
|
5
7
|
*/
|
|
6
8
|
export declare function shouldPrintErrorAsJson(argv: readonly string[], readDefault?: typeof readJsonDefault): boolean;
|
|
7
|
-
|
|
9
|
+
/** Ayuda o version: commander ya las imprimio y solo queda salir con su exit code. */
|
|
10
|
+
export declare function isCommanderExit(error: unknown): error is CommanderError;
|
|
11
|
+
/** Un error de uso de commander: opcion desconocida, valor faltante, argumento de mas, etc. */
|
|
12
|
+
export declare function isCommanderUsageError(error: unknown): error is CommanderError;
|
|
13
|
+
/** El error de uso de commander como `INPUT_VALIDATION_ERROR`, en el mismo formato que el resto. */
|
|
14
|
+
export declare function toUsageError(error: CommanderError): AppError;
|
|
15
|
+
/**
|
|
16
|
+
* Commander tira los errores de uso en vez de cortar el proceso, para que `index.ts` los maneje como el resto. En
|
|
17
|
+
* texto commander los escribe como siempre (con la pista de la ayuda); en JSON se callan y sale el JSON de error.
|
|
18
|
+
* Va antes de registrar los comandos: los subcomandos copian esta config al crearse.
|
|
19
|
+
*/
|
|
20
|
+
export declare function configureUsageErrors(program: Command, errorsAsJson: () => boolean): void;
|
|
21
|
+
/**
|
|
22
|
+
* Imprime un error que corto la ejecucion y devuelve el exit code. Ayuda y version no son errores; los errores de
|
|
23
|
+
* uso en texto ya los escribio commander.
|
|
24
|
+
*/
|
|
25
|
+
export declare function reportCliError(error: unknown, errorsAsJson: boolean): number;
|
package/dist/cli/error-output.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return service.getConfig().output.jsonPorDefecto;
|
|
6
|
-
}
|
|
7
|
-
finally {
|
|
8
|
-
service.close();
|
|
9
|
-
}
|
|
10
|
-
}
|
|
1
|
+
import { CommanderError } from 'commander';
|
|
2
|
+
import { AppError } from '../lib/errors/app-error.js';
|
|
3
|
+
import { formatCliError, writeTerminalError, writeTerminalJsonError } from '../ui/index.js';
|
|
4
|
+
import { readJsonDefault } from './global-options.js';
|
|
11
5
|
/**
|
|
12
6
|
* Los errores salen en JSON con `--json` o, sin el flag, si la config tiene `json=true`, igual que los
|
|
13
7
|
* resultados. La config se lee recien al fallar; si tambien falla (config invalida), sale en texto.
|
|
@@ -23,4 +17,70 @@ export function shouldPrintErrorAsJson(argv, readDefault = readJsonDefault) {
|
|
|
23
17
|
return false;
|
|
24
18
|
}
|
|
25
19
|
}
|
|
20
|
+
/** Lo que commander señaliza por `exitOverride` sin que sea un error de uso: ayuda y version, ya impresas. */
|
|
21
|
+
const COMMANDER_NON_ERROR_CODES = new Set(['commander.help', 'commander.helpDisplayed', 'commander.version']);
|
|
22
|
+
/** Ayuda o version: commander ya las imprimio y solo queda salir con su exit code. */
|
|
23
|
+
export function isCommanderExit(error) {
|
|
24
|
+
return error instanceof CommanderError && COMMANDER_NON_ERROR_CODES.has(error.code);
|
|
25
|
+
}
|
|
26
|
+
/** Un error de uso de commander: opcion desconocida, valor faltante, argumento de mas, etc. */
|
|
27
|
+
export function isCommanderUsageError(error) {
|
|
28
|
+
return error instanceof CommanderError && !COMMANDER_NON_ERROR_CODES.has(error.code);
|
|
29
|
+
}
|
|
30
|
+
/** El error de uso de commander como `INPUT_VALIDATION_ERROR`, en el mismo formato que el resto. */
|
|
31
|
+
export function toUsageError(error) {
|
|
32
|
+
// Commander arma el mensaje con "error: " adelante y, a veces, una segunda linea "(Did you mean --monto?)".
|
|
33
|
+
const message = error.message
|
|
34
|
+
.replace(/^error:\s*/i, '')
|
|
35
|
+
.replace(/\s*\n\s*/g, ' ')
|
|
36
|
+
.trim();
|
|
37
|
+
return new AppError(message, {
|
|
38
|
+
code: 'INPUT_VALIDATION_ERROR',
|
|
39
|
+
suggestion: 'Usá "arcli ayuda" o "arcli <comando> --ayuda" para ver comandos y opciones.',
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Commander tira los errores de uso en vez de cortar el proceso, para que `index.ts` los maneje como el resto. En
|
|
44
|
+
* texto commander los escribe como siempre (con la pista de la ayuda); en JSON se callan y sale el JSON de error.
|
|
45
|
+
* Va antes de registrar los comandos: los subcomandos copian esta config al crearse.
|
|
46
|
+
*/
|
|
47
|
+
export function configureUsageErrors(program, errorsAsJson) {
|
|
48
|
+
let failing = false;
|
|
49
|
+
program.exitOverride().configureOutput({
|
|
50
|
+
outputError: (message, write) => {
|
|
51
|
+
failing = true;
|
|
52
|
+
if (!errorsAsJson()) {
|
|
53
|
+
write(message);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
writeErr: (text) => {
|
|
57
|
+
// Despues de un error, commander escribe la pista de la ayuda: en JSON no va.
|
|
58
|
+
if (!(failing && errorsAsJson())) {
|
|
59
|
+
process.stderr.write(text);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Imprime un error que corto la ejecucion y devuelve el exit code. Ayuda y version no son errores; los errores de
|
|
66
|
+
* uso en texto ya los escribio commander.
|
|
67
|
+
*/
|
|
68
|
+
export function reportCliError(error, errorsAsJson) {
|
|
69
|
+
if (isCommanderExit(error)) {
|
|
70
|
+
return error.exitCode;
|
|
71
|
+
}
|
|
72
|
+
if (isCommanderUsageError(error)) {
|
|
73
|
+
if (errorsAsJson) {
|
|
74
|
+
writeTerminalJsonError(formatCliError(toUsageError(error), true));
|
|
75
|
+
}
|
|
76
|
+
return error.exitCode;
|
|
77
|
+
}
|
|
78
|
+
if (errorsAsJson) {
|
|
79
|
+
writeTerminalJsonError(formatCliError(error, true));
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
writeTerminalError(formatCliError(error, false));
|
|
83
|
+
}
|
|
84
|
+
return 1;
|
|
85
|
+
}
|
|
26
86
|
//# sourceMappingURL=error-output.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-output.js","sourceRoot":"","sources":["../../src/cli/error-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"error-output.js","sourceRoot":"","sources":["../../src/cli/error-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAEnF,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAuB,EAAE,WAAW,GAAG,eAAe;IAC3F,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,OAAO,WAAW,EAAE,CAAC;IACv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AE,EAAE;YACjB,8EAA8E;YAC9E,IAAI,CAAC,CAAC,OAAO,IAAI,YAAY,EAAE,CAAC,EAAE,CAAC;gBACjC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc,EAAE,YAAqB;IAClE,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,QAAQ,CAAC;IACxB,CAAC;IAED,IAAI,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,IAAI,YAAY,EAAE,CAAC;YACjB,sBAAsB,CAAC,cAAc,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;QACpE,CAAC;QAED,OAAO,KAAK,CAAC,QAAQ,CAAC;IACxB,CAAC;IAED,IAAI,YAAY,EAAE,CAAC;QACjB,sBAAsB,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IACtD,CAAC;SAAM,CAAC;QACN,kBAAkB,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { ArcliConfig } from '../modules/config/config.schemas';
|
|
3
|
+
import type { GlobalCliOptions } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Las opciones globales las parsea el programa (commander no usa opciones posicionales), asi que estan en
|
|
6
|
+
* cualquier comando. Cada comando declara solo las que usa: asi salen en su ayuda y, si se pasa otra, el aviso de
|
|
7
|
+
* `ignored-global-options` avisa que no aplica.
|
|
8
|
+
*/
|
|
9
|
+
export declare function registerEnvironmentOptions(command: Command): Command;
|
|
10
|
+
export declare function registerJsonOption(command: Command): Command;
|
|
11
|
+
/** Solo facturacion muestra la respuesta bruta de ARCA. */
|
|
12
|
+
export declare function registerRawOption(command: Command): Command;
|
|
13
|
+
/** Las cuatro: el programa (para que cualquier comando las acepte) y los comandos de facturacion. */
|
|
14
|
+
export declare function registerGlobalOptions(command: Command): Command;
|
|
15
|
+
/** Entorno y salida: comandos que consultan ARCA pero no tienen respuesta bruta que mostrar. */
|
|
16
|
+
export declare function registerQueryOptions(command: Command): Command;
|
|
17
|
+
export declare function getGlobalOptions(command: Command): GlobalCliOptions;
|
|
18
|
+
type OutputConfig = Pick<ArcliConfig, 'output'>;
|
|
19
|
+
/** `json` de la config. Si la config no se puede leer, texto: el error de la config ya sale por su lado. */
|
|
20
|
+
export declare function readJsonDefault(): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* La unica forma de decidir si un comando imprime JSON: `--json` o, sin el flag, `json=true` de la config. Sin
|
|
23
|
+
* config a mano (comandos que no la necesitan), se lee al llamar.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveOutputJson(command: Command, config?: OutputConfig): boolean;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ConfigService } from '../modules/config/config.service.js';
|
|
2
|
+
/**
|
|
3
|
+
* Las opciones globales las parsea el programa (commander no usa opciones posicionales), asi que estan en
|
|
4
|
+
* cualquier comando. Cada comando declara solo las que usa: asi salen en su ayuda y, si se pasa otra, el aviso de
|
|
5
|
+
* `ignored-global-options` avisa que no aplica.
|
|
6
|
+
*/
|
|
7
|
+
export function registerEnvironmentOptions(command) {
|
|
8
|
+
return command
|
|
9
|
+
.option('--testing', 'usar entorno de testing en esta ejecucion')
|
|
10
|
+
.option('--produccion', 'usar entorno de produccion en esta ejecucion');
|
|
11
|
+
}
|
|
12
|
+
export function registerJsonOption(command) {
|
|
13
|
+
return command.option('--json', 'imprimir salida JSON');
|
|
14
|
+
}
|
|
15
|
+
/** Solo facturacion muestra la respuesta bruta de ARCA. */
|
|
16
|
+
export function registerRawOption(command) {
|
|
17
|
+
return command.option('--bruto', 'mostrar la respuesta bruta de ARCA cuando exista');
|
|
18
|
+
}
|
|
19
|
+
/** Las cuatro: el programa (para que cualquier comando las acepte) y los comandos de facturacion. */
|
|
20
|
+
export function registerGlobalOptions(command) {
|
|
21
|
+
return registerRawOption(registerJsonOption(registerEnvironmentOptions(command)));
|
|
22
|
+
}
|
|
23
|
+
/** Entorno y salida: comandos que consultan ARCA pero no tienen respuesta bruta que mostrar. */
|
|
24
|
+
export function registerQueryOptions(command) {
|
|
25
|
+
return registerJsonOption(registerEnvironmentOptions(command));
|
|
26
|
+
}
|
|
27
|
+
export function getGlobalOptions(command) {
|
|
28
|
+
return command.optsWithGlobals();
|
|
29
|
+
}
|
|
30
|
+
/** `json` de la config. Si la config no se puede leer, texto: el error de la config ya sale por su lado. */
|
|
31
|
+
export function readJsonDefault() {
|
|
32
|
+
try {
|
|
33
|
+
const service = new ConfigService();
|
|
34
|
+
try {
|
|
35
|
+
return service.getConfig().output.jsonPorDefecto;
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
service.close();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* La unica forma de decidir si un comando imprime JSON: `--json` o, sin el flag, `json=true` de la config. Sin
|
|
47
|
+
* config a mano (comandos que no la necesitan), se lee al llamar.
|
|
48
|
+
*/
|
|
49
|
+
export function resolveOutputJson(command, config) {
|
|
50
|
+
const flag = getGlobalOptions(command).json;
|
|
51
|
+
if (typeof flag === 'boolean') {
|
|
52
|
+
return flag;
|
|
53
|
+
}
|
|
54
|
+
return config ? config.output.jsonPorDefecto : readJsonDefault();
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=global-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-options.js","sourceRoot":"","sources":["../../src/cli/global-options.ts"],"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,UAAU,iBAAiB,CAAC,OAAgB,EAAE,MAAqB;IACvE,MAAM,IAAI,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC;IAE5C,IAAI,OAAO,IAAI,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;AACnE,CAAC"}
|
package/dist/cli/help.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
2
|
import type { VoucherFamily, VoucherShortcut } from '../modules/billing/billing.types';
|
|
3
|
+
export declare function createConfigSetHelp(): string;
|
|
3
4
|
export declare function createConfigHelp(): string;
|
|
4
5
|
export declare function createStorybookHelp(): string;
|
|
5
6
|
export declare function createExamplesHelp(): string;
|
|
6
7
|
export declare function createFceObligationHelp(): string;
|
|
8
|
+
export declare function createPadronHelp(): string;
|
|
7
9
|
export declare function createVoucherQueryHelp(): string;
|
|
8
10
|
export declare function createShortcutHelp(shortcut: VoucherShortcut): string;
|
|
9
11
|
export declare function createFamilyHelp(family: VoucherFamily): string;
|