@open-nav/cli 0.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 +29 -0
- package/README.md +89 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +8 -0
- package/dist/bin.js.map +1 -0
- package/dist/commands.d.ts +37 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +711 -0
- package/dist/commands.js.map +1 -0
- package/dist/config.d.ts +93 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +192 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +26 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +25 -0
- package/dist/errors.js.map +1 -0
- package/dist/main.d.ts +23 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +237 -0
- package/dist/main.js.map +1 -0
- package/dist/output.d.ts +37 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +43 -0
- package/dist/output.js.map +1 -0
- package/dist/version.d.ts +7 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +8 -0
- package/dist/version.js.map +1 -0
- package/package.json +57 -0
- package/src/bin.ts +8 -0
- package/src/commands.ts +860 -0
- package/src/config.ts +246 -0
- package/src/errors.ts +27 -0
- package/src/main.ts +264 -0
- package/src/output.ts +85 -0
- package/src/version.ts +10 -0
package/dist/main.js
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { parseArgs } from 'node:util';
|
|
2
|
+
import { NavApiError, NavTransportError, NavValidationError } from '@open-nav/core';
|
|
3
|
+
import { PdfConversionError, ThemeError } from '@open-nav/invoicing';
|
|
4
|
+
import { COMMANDS, describeCommands, findCommand } from './commands.js';
|
|
5
|
+
import { ENV_VARS } from './config.js';
|
|
6
|
+
import { EXIT, UsageError } from './errors.js';
|
|
7
|
+
import { consoleWriter, resolveFormat, writeError } from './output.js';
|
|
8
|
+
import { VERSION } from './version.js';
|
|
9
|
+
const GLOBAL_OPTIONS = {
|
|
10
|
+
json: { type: 'boolean' },
|
|
11
|
+
pretty: { type: 'boolean' },
|
|
12
|
+
'env-file': { type: 'string' },
|
|
13
|
+
'no-env-file': { type: 'boolean' },
|
|
14
|
+
help: { type: 'boolean', short: 'h' },
|
|
15
|
+
version: { type: 'boolean' },
|
|
16
|
+
describe: { type: 'boolean' },
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Run the CLI and return an exit code.
|
|
20
|
+
*
|
|
21
|
+
* Everything is injectable so the whole surface can be tested without
|
|
22
|
+
* spawning a process or touching the filesystem.
|
|
23
|
+
*/
|
|
24
|
+
export async function run(options) {
|
|
25
|
+
const writer = options.writer ?? consoleWriter;
|
|
26
|
+
let parsed;
|
|
27
|
+
try {
|
|
28
|
+
parsed = parseArgs({
|
|
29
|
+
args: options.argv,
|
|
30
|
+
options: {
|
|
31
|
+
...GLOBAL_OPTIONS,
|
|
32
|
+
// Command options are accepted loosely here and validated by the
|
|
33
|
+
// command, so a new option never needs registering in two places.
|
|
34
|
+
operation: { type: 'string' },
|
|
35
|
+
language: { type: 'string' },
|
|
36
|
+
direction: { type: 'string' },
|
|
37
|
+
supplier: { type: 'string' },
|
|
38
|
+
from: { type: 'string' },
|
|
39
|
+
to: { type: 'string' },
|
|
40
|
+
page: { type: 'string' },
|
|
41
|
+
wait: { type: 'boolean' },
|
|
42
|
+
compress: { type: 'boolean' },
|
|
43
|
+
xml: { type: 'boolean' },
|
|
44
|
+
'skip-validation': { type: 'boolean' },
|
|
45
|
+
out: { type: 'string' },
|
|
46
|
+
note: { type: 'string' },
|
|
47
|
+
pdf: { type: 'string' },
|
|
48
|
+
theme: { type: 'string' },
|
|
49
|
+
logo: { type: 'string' },
|
|
50
|
+
browser: { type: 'string' },
|
|
51
|
+
'no-sandbox': { type: 'boolean' },
|
|
52
|
+
engine: { type: 'string' },
|
|
53
|
+
delay: { type: 'string' },
|
|
54
|
+
refresh: { type: 'boolean' },
|
|
55
|
+
'number-from': { type: 'string' },
|
|
56
|
+
'number-to': { type: 'string' },
|
|
57
|
+
'warnings-as-errors': { type: 'boolean' },
|
|
58
|
+
},
|
|
59
|
+
allowPositionals: true,
|
|
60
|
+
strict: true,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
catch (cause) {
|
|
64
|
+
writer.err(cause.message);
|
|
65
|
+
writer.err('Run "open-nav --help" for usage.');
|
|
66
|
+
return EXIT.usage;
|
|
67
|
+
}
|
|
68
|
+
const flags = parsed.values;
|
|
69
|
+
const explicitFormat = flags['json'] === true ? 'json' : flags['pretty'] === true ? 'text' : undefined;
|
|
70
|
+
const format = resolveFormat(explicitFormat, options.isTty ?? false);
|
|
71
|
+
if (flags['describe'] === true) {
|
|
72
|
+
writer.out(JSON.stringify(describeCommands(), null, 2));
|
|
73
|
+
return EXIT.ok;
|
|
74
|
+
}
|
|
75
|
+
if (flags['version'] === true) {
|
|
76
|
+
writer.out(VERSION);
|
|
77
|
+
return EXIT.ok;
|
|
78
|
+
}
|
|
79
|
+
const [commandName, ...positionals] = parsed.positionals;
|
|
80
|
+
if (flags['help'] === true || commandName === undefined || commandName === 'help') {
|
|
81
|
+
const topic = commandName === 'help' ? positionals[0] : undefined;
|
|
82
|
+
writeHelp(writer, topic);
|
|
83
|
+
return commandName === undefined && flags['help'] !== true ? EXIT.usage : EXIT.ok;
|
|
84
|
+
}
|
|
85
|
+
const command = findCommand(commandName);
|
|
86
|
+
if (!command) {
|
|
87
|
+
writer.err(`Unknown command: ${commandName}`);
|
|
88
|
+
writer.err(`Available: ${COMMANDS.map((entry) => entry.name).join(', ')}`);
|
|
89
|
+
return EXIT.usage;
|
|
90
|
+
}
|
|
91
|
+
const context = {
|
|
92
|
+
format,
|
|
93
|
+
writer,
|
|
94
|
+
load: {
|
|
95
|
+
...(flags['env-file'] ? { envFile: String(flags['env-file']) } : {}),
|
|
96
|
+
...(flags['no-env-file'] === true ? { noEnvFile: true } : {}),
|
|
97
|
+
...(options.env ? { env: options.env } : {}),
|
|
98
|
+
...(options.cwd ? { cwd: options.cwd } : {}),
|
|
99
|
+
},
|
|
100
|
+
...(options.readFile ? { readFile: options.readFile } : {}),
|
|
101
|
+
...(options.writeFile ? { writeFile: options.writeFile } : {}),
|
|
102
|
+
...(options.writeBinaryFile ? { writeBinaryFile: options.writeBinaryFile } : {}),
|
|
103
|
+
...(options.readBinaryFile ? { readBinaryFile: options.readBinaryFile } : {}),
|
|
104
|
+
...(options.fileExists ? { fileExists: options.fileExists } : {}),
|
|
105
|
+
};
|
|
106
|
+
try {
|
|
107
|
+
return await command.run(positionals, flags, context);
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
return reportError(writer, format, command.name, error);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function reportError(writer, format, command, error) {
|
|
114
|
+
if (error instanceof UsageError) {
|
|
115
|
+
writeError(writer, format, command, { message: error.message, code: 'USAGE' });
|
|
116
|
+
return EXIT.usage;
|
|
117
|
+
}
|
|
118
|
+
if (error instanceof NavApiError) {
|
|
119
|
+
writeError(writer, format, command, {
|
|
120
|
+
message: error.message,
|
|
121
|
+
...(error.errorCode ? { code: error.errorCode } : {}),
|
|
122
|
+
details: {
|
|
123
|
+
status: error.status,
|
|
124
|
+
funcCode: error.funcCode,
|
|
125
|
+
validationMessages: error.validationMessages,
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
return EXIT.rejected;
|
|
129
|
+
}
|
|
130
|
+
if (error instanceof NavValidationError) {
|
|
131
|
+
writeError(writer, format, command, {
|
|
132
|
+
message: error.message,
|
|
133
|
+
code: 'INVALID',
|
|
134
|
+
details: error.issues,
|
|
135
|
+
});
|
|
136
|
+
return EXIT.invalid;
|
|
137
|
+
}
|
|
138
|
+
if (error instanceof NavTransportError) {
|
|
139
|
+
writeError(writer, format, command, { message: error.message, code: 'UNAVAILABLE' });
|
|
140
|
+
return EXIT.unavailable;
|
|
141
|
+
}
|
|
142
|
+
if (error instanceof ThemeError) {
|
|
143
|
+
// A malformed theme is a configuration mistake, like a bad flag.
|
|
144
|
+
writeError(writer, format, command, { message: error.message, code: 'THEME' });
|
|
145
|
+
return EXIT.usage;
|
|
146
|
+
}
|
|
147
|
+
if (error instanceof PdfConversionError) {
|
|
148
|
+
// Nothing wrong with the document; the machine lacks a browser.
|
|
149
|
+
writeError(writer, format, command, { message: error.message, code: 'PDF_CONVERSION' });
|
|
150
|
+
return EXIT.unavailable;
|
|
151
|
+
}
|
|
152
|
+
writeError(writer, format, command, { message: error.message ?? String(error) });
|
|
153
|
+
return EXIT.failure;
|
|
154
|
+
}
|
|
155
|
+
function writeHelp(writer, topic) {
|
|
156
|
+
if (topic === 'config') {
|
|
157
|
+
writer.out('Configuration is read from the environment, or from a .env file');
|
|
158
|
+
writer.out('discovered by walking up from the working directory.');
|
|
159
|
+
writer.out('');
|
|
160
|
+
writer.out('Required:');
|
|
161
|
+
for (const variable of [
|
|
162
|
+
ENV_VARS.login,
|
|
163
|
+
ENV_VARS.password,
|
|
164
|
+
ENV_VARS.signKey,
|
|
165
|
+
ENV_VARS.exchangeKey,
|
|
166
|
+
ENV_VARS.taxNumber,
|
|
167
|
+
ENV_VARS.softwareId,
|
|
168
|
+
]) {
|
|
169
|
+
writer.out(` ${variable}`);
|
|
170
|
+
}
|
|
171
|
+
writer.out('');
|
|
172
|
+
writer.out('Optional:');
|
|
173
|
+
for (const variable of [
|
|
174
|
+
ENV_VARS.environment,
|
|
175
|
+
ENV_VARS.softwareName,
|
|
176
|
+
ENV_VARS.softwareVersion,
|
|
177
|
+
ENV_VARS.softwareOperation,
|
|
178
|
+
ENV_VARS.softwareDevName,
|
|
179
|
+
ENV_VARS.softwareDevContact,
|
|
180
|
+
ENV_VARS.softwareDevTaxNumber,
|
|
181
|
+
ENV_VARS.baseUrl,
|
|
182
|
+
]) {
|
|
183
|
+
writer.out(` ${variable}`);
|
|
184
|
+
}
|
|
185
|
+
writer.out('');
|
|
186
|
+
writer.out(`${ENV_VARS.environment} defaults to "test". Set it to "production" deliberately.`);
|
|
187
|
+
writer.out(`${ENV_VARS.taxNumber} is the 8 digit core tax number, not the 11 digit form.`);
|
|
188
|
+
writer.out('');
|
|
189
|
+
writer.out('Credentials are never taken as command line arguments: they would');
|
|
190
|
+
writer.out('be recorded in shell history, process listings and agent transcripts.');
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (topic !== undefined) {
|
|
194
|
+
const command = findCommand(topic);
|
|
195
|
+
if (!command) {
|
|
196
|
+
writer.err(`Unknown command: ${topic}`);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
writer.out(command.summary);
|
|
200
|
+
writer.out('');
|
|
201
|
+
writer.out(` ${command.usage}`);
|
|
202
|
+
if (command.options && command.options.length > 0) {
|
|
203
|
+
writer.out('');
|
|
204
|
+
const width = Math.max(...command.options.map((option) => option.flag.length));
|
|
205
|
+
for (const option of command.options) {
|
|
206
|
+
writer.out(` ${option.flag.padEnd(width)} ${option.description}`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (command.needsCredentials) {
|
|
210
|
+
writer.out('');
|
|
211
|
+
writer.out('Needs credentials. Run "open-nav config" to check them.');
|
|
212
|
+
}
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
writer.out('open-nav — command line access to the NAV Online Számla invoice service');
|
|
216
|
+
writer.out('');
|
|
217
|
+
writer.out(' open-nav <command> [options]');
|
|
218
|
+
writer.out('');
|
|
219
|
+
const width = Math.max(...COMMANDS.map((command) => command.name.length));
|
|
220
|
+
for (const command of COMMANDS) {
|
|
221
|
+
writer.out(` ${command.name.padEnd(width)} ${command.summary}`);
|
|
222
|
+
}
|
|
223
|
+
writer.out('');
|
|
224
|
+
writer.out('Options:');
|
|
225
|
+
writer.out(' --json Output JSON (the default when not a terminal)');
|
|
226
|
+
writer.out(' --pretty Output human readable text');
|
|
227
|
+
writer.out(' --env-file <path> Read configuration from this file');
|
|
228
|
+
writer.out(' --no-env-file Ignore .env files entirely');
|
|
229
|
+
writer.out(' --describe Print the command surface as JSON, for tooling');
|
|
230
|
+
writer.out(' --version Print the version');
|
|
231
|
+
writer.out('');
|
|
232
|
+
writer.out('Exit codes: 0 ok, 2 usage, 3 invalid document, 4 rejected by NAV, 5 unavailable.');
|
|
233
|
+
writer.out('');
|
|
234
|
+
writer.out('Help on a command: open-nav help <command>');
|
|
235
|
+
writer.out('Help on configuration: open-nav help config');
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAAuB,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAiB,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAA4B,MAAM,aAAa,CAAC;AACjG,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAgBvC,MAAM,cAAc,GAAG;IACrB,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IACzB,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IAC3B,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC9B,aAAa,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IAClC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE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AM,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACpE,CAAC;IACD,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACf,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACvB,MAAM,CAAC,GAAG,CAAC,qEAAqE,CAAC,CAAC;IAClF,MAAM,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;IAC/D,MAAM,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAC;IACtE,MAAM,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;IAC/D,MAAM,CAAC,GAAG,CAAC,sEAAsE,CAAC,CAAC;IACnF,MAAM,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;IACtD,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACf,MAAM,CAAC,GAAG,CAAC,kFAAkF,CAAC,CAAC;IAC/F,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACf,MAAM,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;IAC9D,MAAM,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;AAC7D,CAAC"}
|
package/dist/output.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { InvoiceValidationIssue } from '@open-nav/core';
|
|
2
|
+
/**
|
|
3
|
+
* Output format.
|
|
4
|
+
*
|
|
5
|
+
* JSON is the default whenever output is not a terminal, so a program or an
|
|
6
|
+
* agent calling this tool always gets something parseable without having to
|
|
7
|
+
* remember a flag. A human at a terminal gets readable text.
|
|
8
|
+
*/
|
|
9
|
+
export type Format = 'json' | 'text';
|
|
10
|
+
export declare function resolveFormat(explicit: Format | undefined, isTty: boolean): Format;
|
|
11
|
+
export interface Writer {
|
|
12
|
+
out: (line: string) => void;
|
|
13
|
+
err: (line: string) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const consoleWriter: Writer;
|
|
16
|
+
/** Envelope every JSON result shares, so callers can branch on `ok` alone. */
|
|
17
|
+
export interface ResultEnvelope {
|
|
18
|
+
ok: boolean;
|
|
19
|
+
command: string;
|
|
20
|
+
data?: unknown;
|
|
21
|
+
error?: {
|
|
22
|
+
message: string;
|
|
23
|
+
code?: string;
|
|
24
|
+
details?: unknown;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export declare function writeResult(writer: Writer, format: Format, command: string, data: unknown, renderText: (data: never) => string[]): void;
|
|
28
|
+
export declare function writeError(writer: Writer, format: Format, command: string, error: {
|
|
29
|
+
message: string;
|
|
30
|
+
code?: string;
|
|
31
|
+
details?: unknown;
|
|
32
|
+
}): void;
|
|
33
|
+
/** Render validation issues as aligned text. */
|
|
34
|
+
export declare function renderIssues(issues: InvoiceValidationIssue[]): string[];
|
|
35
|
+
/** A compact `key: value` block. */
|
|
36
|
+
export declare function renderFields(fields: Array<[string, string | number | boolean | undefined]>): string[];
|
|
37
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAErC,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAElF;AAED,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,aAAa,EAAE,MAG3B,CAAC;AAEF,8EAA8E;AAC9E,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAC/D;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,EAAE,GACpC,IAAI,CAON;AAED,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAC3D,IAAI,CAYN;AAED,gDAAgD;AAChD,wBAAgB,YAAY,CAAC,MAAM,EAAE,sBAAsB,EAAE,GAAG,MAAM,EAAE,CAMvE;AAED,oCAAoC;AACpC,wBAAgB,YAAY,CAC1B,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC,GAC7D,MAAM,EAAE,CAKV"}
|
package/dist/output.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export function resolveFormat(explicit, isTty) {
|
|
2
|
+
return explicit ?? (isTty ? 'text' : 'json');
|
|
3
|
+
}
|
|
4
|
+
export const consoleWriter = {
|
|
5
|
+
out: (line) => process.stdout.write(`${line}\n`),
|
|
6
|
+
err: (line) => process.stderr.write(`${line}\n`),
|
|
7
|
+
};
|
|
8
|
+
export function writeResult(writer, format, command, data, renderText) {
|
|
9
|
+
if (format === 'json') {
|
|
10
|
+
const envelope = { ok: true, command, data };
|
|
11
|
+
writer.out(JSON.stringify(envelope, null, 2));
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
for (const line of renderText(data))
|
|
15
|
+
writer.out(line);
|
|
16
|
+
}
|
|
17
|
+
export function writeError(writer, format, command, error) {
|
|
18
|
+
if (format === 'json') {
|
|
19
|
+
const envelope = { ok: false, command, error };
|
|
20
|
+
writer.out(JSON.stringify(envelope, null, 2));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
writer.err(error.code ? `${error.code}: ${error.message}` : error.message);
|
|
24
|
+
if (error.details !== undefined) {
|
|
25
|
+
writer.err(typeof error.details === 'string' ? error.details : JSON.stringify(error.details, null, 2));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** Render validation issues as aligned text. */
|
|
29
|
+
export function renderIssues(issues) {
|
|
30
|
+
return issues.map((issue) => {
|
|
31
|
+
const marker = issue.severity === 'error' ? 'error' : 'warn ';
|
|
32
|
+
const nav = issue.navMessage ? `\n NAV: ${issue.navMessage}` : '';
|
|
33
|
+
return ` ${marker} ${issue.code}\n ${issue.path}\n ${issue.message}${nav}`;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/** A compact `key: value` block. */
|
|
37
|
+
export function renderFields(fields) {
|
|
38
|
+
const width = Math.max(...fields.map(([label]) => label.length));
|
|
39
|
+
return fields
|
|
40
|
+
.filter(([, value]) => value !== undefined)
|
|
41
|
+
.map(([label, value]) => ` ${label.padEnd(width)} ${String(value)}`);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAWA,MAAM,UAAU,aAAa,CAAC,QAA4B,EAAE,KAAc;IACxE,OAAO,QAAQ,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC;AAOD,MAAM,CAAC,MAAM,aAAa,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|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The package's own version, read from its manifest rather than duplicated
|
|
3
|
+
* here. A hardcoded copy is a release-day footgun: it drifts silently, and
|
|
4
|
+
* the first thing a bug report quotes is `open-nav --version`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const VERSION: string;
|
|
7
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,MAEb,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
/**
|
|
3
|
+
* The package's own version, read from its manifest rather than duplicated
|
|
4
|
+
* here. A hardcoded copy is a release-day footgun: it drifts silently, and
|
|
5
|
+
* the first thing a bug report quotes is `open-nav --version`.
|
|
6
|
+
*/
|
|
7
|
+
export const VERSION = createRequire(import.meta.url)('../package.json').version;
|
|
8
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAClB,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,iBAAiB,CACjD,CAAC,OAAO,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@open-nav/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Command line tool for the Hungarian Tax Authority (NAV) Online Számla API",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"nav",
|
|
7
|
+
"onlineszamla",
|
|
8
|
+
"hungary",
|
|
9
|
+
"invoice",
|
|
10
|
+
"cli",
|
|
11
|
+
"agent"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "open-nav contributors",
|
|
15
|
+
"homepage": "https://github.com/eshton/open-nav#readme",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/eshton/open-nav.git",
|
|
19
|
+
"directory": "packages/cli"
|
|
20
|
+
},
|
|
21
|
+
"bugs": "https://github.com/eshton/open-nav/issues",
|
|
22
|
+
"type": "module",
|
|
23
|
+
"main": "./dist/main.js",
|
|
24
|
+
"types": "./dist/main.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/main.d.ts",
|
|
28
|
+
"import": "./dist/main.js",
|
|
29
|
+
"default": "./dist/main.js"
|
|
30
|
+
},
|
|
31
|
+
"./package.json": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
"bin": {
|
|
34
|
+
"open-nav": "./dist/bin.js"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist",
|
|
38
|
+
"src",
|
|
39
|
+
"README.md",
|
|
40
|
+
"LICENSE"
|
|
41
|
+
],
|
|
42
|
+
"sideEffects": false,
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=20.10.0"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@open-nav/core": "^0.1.0",
|
|
51
|
+
"@open-nav/invoicing": "^0.1.0",
|
|
52
|
+
"@open-nav/client": "^0.1.0"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "tsc -b"
|
|
56
|
+
}
|
|
57
|
+
}
|