@futdevpro/nts-dynamo 1.15.306 → 1.15.308
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/build/_collections/global-settings.const.d.ts.map +1 -1
- package/build/_collections/global-settings.const.js +1 -0
- package/build/_collections/global-settings.const.js.map +1 -1
- package/build/_models/interfaces/global-settings.interface.d.ts +6 -0
- package/build/_models/interfaces/global-settings.interface.d.ts.map +1 -1
- package/build/_modules/cli/_collections/cli-envelope.util.d.ts +52 -0
- package/build/_modules/cli/_collections/cli-envelope.util.d.ts.map +1 -0
- package/build/_modules/cli/_collections/cli-envelope.util.js +77 -0
- package/build/_modules/cli/_collections/cli-envelope.util.js.map +1 -0
- package/build/_modules/cli/_collections/cli-flag.util.d.ts +37 -0
- package/build/_modules/cli/_collections/cli-flag.util.d.ts.map +1 -0
- package/build/_modules/cli/_collections/cli-flag.util.js +174 -0
- package/build/_modules/cli/_collections/cli-flag.util.js.map +1 -0
- package/build/_modules/cli/_enums/cli-exit-code.type-enum.d.ts +20 -0
- package/build/_modules/cli/_enums/cli-exit-code.type-enum.d.ts.map +1 -0
- package/build/_modules/cli/_enums/cli-exit-code.type-enum.js +24 -0
- package/build/_modules/cli/_enums/cli-exit-code.type-enum.js.map +1 -0
- package/build/_modules/cli/_enums/cli-flag-value.type-enum.d.ts +16 -0
- package/build/_modules/cli/_enums/cli-flag-value.type-enum.d.ts.map +1 -0
- package/build/_modules/cli/_enums/cli-flag-value.type-enum.js +20 -0
- package/build/_modules/cli/_enums/cli-flag-value.type-enum.js.map +1 -0
- package/build/_modules/cli/_enums/cli-output.type-enum.d.ts +8 -0
- package/build/_modules/cli/_enums/cli-output.type-enum.d.ts.map +1 -0
- package/build/_modules/cli/_enums/cli-output.type-enum.js +12 -0
- package/build/_modules/cli/_enums/cli-output.type-enum.js.map +1 -0
- package/build/_modules/cli/_models/control-models/cli-command-params.control-model.d.ts +116 -0
- package/build/_modules/cli/_models/control-models/cli-command-params.control-model.d.ts.map +1 -0
- package/build/_modules/cli/_models/control-models/cli-command-params.control-model.js +237 -0
- package/build/_modules/cli/_models/control-models/cli-command-params.control-model.js.map +1 -0
- package/build/_modules/cli/_models/interfaces/cli-common-options.interface.d.ts +20 -0
- package/build/_modules/cli/_models/interfaces/cli-common-options.interface.d.ts.map +1 -0
- package/build/_modules/cli/_models/interfaces/cli-common-options.interface.js +3 -0
- package/build/_modules/cli/_models/interfaces/cli-common-options.interface.js.map +1 -0
- package/build/_modules/cli/_models/interfaces/cli-envelope.interface.d.ts +28 -0
- package/build/_modules/cli/_models/interfaces/cli-envelope.interface.d.ts.map +1 -0
- package/build/_modules/cli/_models/interfaces/cli-envelope.interface.js +3 -0
- package/build/_modules/cli/_models/interfaces/cli-envelope.interface.js.map +1 -0
- package/build/_modules/cli/_models/interfaces/cli-flag.interface.d.ts +47 -0
- package/build/_modules/cli/_models/interfaces/cli-flag.interface.d.ts.map +1 -0
- package/build/_modules/cli/_models/interfaces/cli-flag.interface.js +3 -0
- package/build/_modules/cli/_models/interfaces/cli-flag.interface.js.map +1 -0
- package/build/_modules/cli/_models/interfaces/cli-settings.interface.d.ts +25 -0
- package/build/_modules/cli/_models/interfaces/cli-settings.interface.d.ts.map +1 -0
- package/build/_modules/cli/_models/interfaces/cli-settings.interface.js +3 -0
- package/build/_modules/cli/_models/interfaces/cli-settings.interface.js.map +1 -0
- package/build/_modules/cli/_services/cli-program.control-service.d.ts +106 -0
- package/build/_modules/cli/_services/cli-program.control-service.d.ts.map +1 -0
- package/build/_modules/cli/_services/cli-program.control-service.js +271 -0
- package/build/_modules/cli/_services/cli-program.control-service.js.map +1 -0
- package/build/_modules/cli/index.d.ts +11 -0
- package/build/_modules/cli/index.d.ts.map +1 -1
- package/build/_modules/cli/index.js +15 -0
- package/build/_modules/cli/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type * as Commander from 'commander';
|
|
2
|
+
import { DyCLI_Command_Params, DyCLI_CommandValues } from '../_models/control-models/cli-command-params.control-model';
|
|
3
|
+
import { DyCLI_CommonOptions } from '../_models/interfaces/cli-common-options.interface';
|
|
4
|
+
import { DyCLI_Settings } from '../_models/interfaces/cli-settings.interface';
|
|
5
|
+
/** Where the program writes (injectable for specs). */
|
|
6
|
+
export interface DyCLI_ProgramIo {
|
|
7
|
+
/** Writes to stdout. */
|
|
8
|
+
stdout(text: string): void;
|
|
9
|
+
/** Writes to stderr. */
|
|
10
|
+
stderr(text: string): void;
|
|
11
|
+
}
|
|
12
|
+
/** Calls the server operation of a generated command (the MCP client of HP-DOPL MP-4.5 / MP-4.6). */
|
|
13
|
+
export type DyCLI_OperationCaller = (params: DyCLI_Command_Params, values: DyCLI_CommandValues, common: DyCLI_CommonOptions) => Promise<unknown>;
|
|
14
|
+
/**
|
|
15
|
+
* The commander program of a Dynamo CLI (HP-DOPL MP-4.3 + MP-4.4): the skeleton the fleet CLIs repeat by hand
|
|
16
|
+
* (`name / description / version / addHelpText / parse`), the common options, and ONE execution path per command —
|
|
17
|
+
* `before` → own `action` or the server call → `after` → the `fo` result envelope and the exit code.
|
|
18
|
+
*
|
|
19
|
+
* - Success: the envelope on stdout (or the `formatHuman` text when the command's output is `human` and no `--json`).
|
|
20
|
+
* - Failure: the envelope on stderr (or `<command>: <code>: <message>`), exit code by `DyCLI_Command_Params.exitCodeOf`.
|
|
21
|
+
* - An argument error (unknown option, invalid value, missing required flag): the `cli.parse` envelope, exit `usage`;
|
|
22
|
+
* `--help` / `--version` exit 0.
|
|
23
|
+
* - `run()` RETURNS the exit code and never calls `process.exit` — `process.exitCode = await program.run()`.
|
|
24
|
+
*
|
|
25
|
+
* `build()` gives the commander program before parsing, so `registerDynamoCommands(program, version)` of
|
|
26
|
+
* `@futdevpro/cli-dynamo` can still be called on it (or pass it as `configure`).
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const cli: DyCLI_Program_ControlService = new DyCLI_Program_ControlService({
|
|
31
|
+
* name: 'fo', description: 'Organizer CLI', version: '2.0.0',
|
|
32
|
+
* commands: [ listTasks, backup ],
|
|
33
|
+
* callOperation: mcpCaller, // generated commands call the server through MCP
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* process.exitCode = await cli.run();
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare class DyCLI_Program_ControlService {
|
|
40
|
+
/** The program name (the binary). */
|
|
41
|
+
readonly name: string;
|
|
42
|
+
/** The program description. */
|
|
43
|
+
readonly description: string;
|
|
44
|
+
/** The program version (`-v, --version`). */
|
|
45
|
+
readonly version: string;
|
|
46
|
+
/** The commands. */
|
|
47
|
+
readonly commands: DyCLI_Command_Params[];
|
|
48
|
+
/** Extra help text after the command list. */
|
|
49
|
+
readonly helpText?: string;
|
|
50
|
+
/** The exit code of the last command run through this program. */
|
|
51
|
+
private lastExitCode;
|
|
52
|
+
private readonly callOperation?;
|
|
53
|
+
private readonly configure?;
|
|
54
|
+
private readonly settings;
|
|
55
|
+
private readonly io;
|
|
56
|
+
/**
|
|
57
|
+
* @param set - the program settings; throws a coded `DyFM_Error` (500 `DyNTS-CLI-*`) when invalid
|
|
58
|
+
*/
|
|
59
|
+
constructor(set: {
|
|
60
|
+
name: string;
|
|
61
|
+
description: string;
|
|
62
|
+
version: string;
|
|
63
|
+
commands: DyCLI_Command_Params[];
|
|
64
|
+
helpText?: string;
|
|
65
|
+
callOperation?: DyCLI_OperationCaller;
|
|
66
|
+
configure?(program: Commander.Command): void | Promise<void>;
|
|
67
|
+
settings?: DyCLI_Settings | null;
|
|
68
|
+
io?: DyCLI_ProgramIo;
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* Builds the commander program with every command and its common options; nothing is parsed yet.
|
|
72
|
+
* @throws 501 `DyNTS-OPT-MIS` when `commander` is not installed
|
|
73
|
+
*/
|
|
74
|
+
build(): Promise<Commander.Command>;
|
|
75
|
+
/**
|
|
76
|
+
* Parses the command line and runs the command.
|
|
77
|
+
* @param argv - the full argv (default: `process.argv`)
|
|
78
|
+
* @returns the exit code — set it as `process.exitCode`
|
|
79
|
+
*/
|
|
80
|
+
run(argv?: string[]): Promise<number>;
|
|
81
|
+
/**
|
|
82
|
+
* Runs one command: `before` → `action` or the server call → `after`, then writes the envelope.
|
|
83
|
+
* @param params - the command
|
|
84
|
+
* @param values - the collected flag values
|
|
85
|
+
* @param common - the common options
|
|
86
|
+
* @returns the exit code
|
|
87
|
+
*/
|
|
88
|
+
execute(params: DyCLI_Command_Params, values: DyCLI_CommandValues, common: DyCLI_CommonOptions): Promise<number>;
|
|
89
|
+
/** Calls the operation of a generated command through the configured caller. */
|
|
90
|
+
private callServer;
|
|
91
|
+
/**
|
|
92
|
+
* Adds the common options a command does not already have (a command flag of the same name wins).
|
|
93
|
+
* @returns the added long flags
|
|
94
|
+
*/
|
|
95
|
+
private addCommonOptions;
|
|
96
|
+
/** The exit code of a commander argument error: the `usage` code of the settings (a command override does not apply). */
|
|
97
|
+
private exitCodeOfParse;
|
|
98
|
+
/**
|
|
99
|
+
* The common options from the parsed commander options — only the ones the program added to this command, so a
|
|
100
|
+
* command's own flag of the same name (e.g. the `dryRun` guardrail argument) stays a value, not a common option.
|
|
101
|
+
* @param options - the parsed options (`command.opts()`)
|
|
102
|
+
* @param added - the long flags of the common options added to the command
|
|
103
|
+
*/
|
|
104
|
+
private static commonOf;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=cli-program.control-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-program.control-service.d.ts","sourceRoot":"","sources":["../../../../src/_modules/cli/_services/cli-program.control-service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,SAAS,MAAM,WAAW,CAAC;AAW5C,OAAO,EACL,oBAAoB,EAAE,mBAAmB,EAC1C,MAAM,4DAA4D,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oDAAoD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EAAE,qBAAqB,CAAC;QACtC,SAAS,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7D,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;QACjC,EAAE,CAAC,EAAE,eAAe,CAAC;KACtB;IAoDD;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC;IAyBzC;;;;OAIG;IACG,GAAG,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IA6CzD;;;;;;OAMG;IACG,OAAO,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;IAyCtH,gFAAgF;YAClE,UAAU;IAexB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IA+BxB,yHAAyH;IACzH,OAAO,CAAC,eAAe;IAIvB;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ;CAiBxB"}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DyCLI_Program_ControlService = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
6
|
+
const global_settings_const_1 = require("../../../_collections/global-settings.const");
|
|
7
|
+
const cli_commander_util_1 = require("../_collections/cli-commander.util");
|
|
8
|
+
const cli_envelope_util_1 = require("../_collections/cli-envelope.util");
|
|
9
|
+
const cli_flag_util_1 = require("../_collections/cli-flag.util");
|
|
10
|
+
const cli_exit_code_type_enum_1 = require("../_enums/cli-exit-code.type-enum");
|
|
11
|
+
const cli_output_type_enum_1 = require("../_enums/cli-output.type-enum");
|
|
12
|
+
const cli_command_params_control_model_1 = require("../_models/control-models/cli-command-params.control-model");
|
|
13
|
+
/** The common options of every command. */
|
|
14
|
+
const DyCLI_outputOptions = ['json', 'pretty', 'dry-run'];
|
|
15
|
+
/** The common options of a command that calls a server operation. */
|
|
16
|
+
const DyCLI_remoteOptions = ['api-key', 'base-url', 'timeout'];
|
|
17
|
+
/**
|
|
18
|
+
* The commander program of a Dynamo CLI (HP-DOPL MP-4.3 + MP-4.4): the skeleton the fleet CLIs repeat by hand
|
|
19
|
+
* (`name / description / version / addHelpText / parse`), the common options, and ONE execution path per command —
|
|
20
|
+
* `before` → own `action` or the server call → `after` → the `fo` result envelope and the exit code.
|
|
21
|
+
*
|
|
22
|
+
* - Success: the envelope on stdout (or the `formatHuman` text when the command's output is `human` and no `--json`).
|
|
23
|
+
* - Failure: the envelope on stderr (or `<command>: <code>: <message>`), exit code by `DyCLI_Command_Params.exitCodeOf`.
|
|
24
|
+
* - An argument error (unknown option, invalid value, missing required flag): the `cli.parse` envelope, exit `usage`;
|
|
25
|
+
* `--help` / `--version` exit 0.
|
|
26
|
+
* - `run()` RETURNS the exit code and never calls `process.exit` — `process.exitCode = await program.run()`.
|
|
27
|
+
*
|
|
28
|
+
* `build()` gives the commander program before parsing, so `registerDynamoCommands(program, version)` of
|
|
29
|
+
* `@futdevpro/cli-dynamo` can still be called on it (or pass it as `configure`).
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const cli: DyCLI_Program_ControlService = new DyCLI_Program_ControlService({
|
|
34
|
+
* name: 'fo', description: 'Organizer CLI', version: '2.0.0',
|
|
35
|
+
* commands: [ listTasks, backup ],
|
|
36
|
+
* callOperation: mcpCaller, // generated commands call the server through MCP
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* process.exitCode = await cli.run();
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
class DyCLI_Program_ControlService {
|
|
43
|
+
/** The program name (the binary). */
|
|
44
|
+
name;
|
|
45
|
+
/** The program description. */
|
|
46
|
+
description;
|
|
47
|
+
/** The program version (`-v, --version`). */
|
|
48
|
+
version;
|
|
49
|
+
/** The commands. */
|
|
50
|
+
commands;
|
|
51
|
+
/** Extra help text after the command list. */
|
|
52
|
+
helpText;
|
|
53
|
+
/** The exit code of the last command run through this program. */
|
|
54
|
+
lastExitCode = 0;
|
|
55
|
+
callOperation;
|
|
56
|
+
configure;
|
|
57
|
+
settings;
|
|
58
|
+
io;
|
|
59
|
+
/**
|
|
60
|
+
* @param set - the program settings; throws a coded `DyFM_Error` (500 `DyNTS-CLI-*`) when invalid
|
|
61
|
+
*/
|
|
62
|
+
constructor(set) {
|
|
63
|
+
const invalid = (code, reason) => new fsm_dynamo_1.DyFM_Error({
|
|
64
|
+
status: 500,
|
|
65
|
+
errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|${code}`,
|
|
66
|
+
message: `DyCLI_Program_ControlService construction failed: ${reason}`,
|
|
67
|
+
});
|
|
68
|
+
if (typeof set?.name !== 'string' || !/^[a-z][a-z0-9-]*$/.test(set.name)) {
|
|
69
|
+
throw invalid('DyNTS-CLI-NAM', `the program name must be kebab-case (got: ${JSON.stringify(set?.name)})`);
|
|
70
|
+
}
|
|
71
|
+
if (typeof set.description !== 'string' || !set.description.trim() || typeof set.version !== 'string' ||
|
|
72
|
+
!set.version.trim()) {
|
|
73
|
+
throw invalid('DyNTS-CLI-DSC', 'the program needs a description and a version');
|
|
74
|
+
}
|
|
75
|
+
if (!Array.isArray(set.commands) ||
|
|
76
|
+
set.commands.some((command) => !(command instanceof cli_command_params_control_model_1.DyCLI_Command_Params))) {
|
|
77
|
+
throw invalid('DyNTS-CLI-CMD', 'commands must be DyCLI_Command_Params instances');
|
|
78
|
+
}
|
|
79
|
+
const names = set.commands.flatMap((command) => [command.command, ...command.aliases]);
|
|
80
|
+
const duplicate = names.find((name, index) => names.indexOf(name) !== index);
|
|
81
|
+
if (duplicate) {
|
|
82
|
+
throw invalid('DyNTS-CLI-DUP', `two commands use the name "${duplicate}"`);
|
|
83
|
+
}
|
|
84
|
+
if (set.callOperation !== undefined && typeof set.callOperation !== 'function') {
|
|
85
|
+
throw invalid('DyNTS-CLI-CAL', 'callOperation must be a function');
|
|
86
|
+
}
|
|
87
|
+
this.name = set.name;
|
|
88
|
+
this.description = set.description;
|
|
89
|
+
this.version = set.version;
|
|
90
|
+
this.commands = [...set.commands];
|
|
91
|
+
this.helpText = set.helpText;
|
|
92
|
+
this.callOperation = set.callOperation;
|
|
93
|
+
this.configure = set.configure;
|
|
94
|
+
this.settings = set.settings === undefined ? global_settings_const_1.DyNTS_global_settings.cli_settings : set.settings;
|
|
95
|
+
this.io = set.io ?? {
|
|
96
|
+
stdout: (text) => {
|
|
97
|
+
process.stdout.write(text);
|
|
98
|
+
},
|
|
99
|
+
stderr: (text) => {
|
|
100
|
+
process.stderr.write(text);
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Builds the commander program with every command and its common options; nothing is parsed yet.
|
|
106
|
+
* @throws 501 `DyNTS-OPT-MIS` when `commander` is not installed
|
|
107
|
+
*/
|
|
108
|
+
async build() {
|
|
109
|
+
const commander = await cli_commander_util_1.DyCLI_Commander_Util.load();
|
|
110
|
+
const program = new commander.Command(this.name)
|
|
111
|
+
.description(this.description)
|
|
112
|
+
.version(this.version, '-v, --version', 'output the current version');
|
|
113
|
+
if (this.helpText) {
|
|
114
|
+
program.addHelpText('after', this.helpText);
|
|
115
|
+
}
|
|
116
|
+
this.commands.forEach((params) => {
|
|
117
|
+
const command = params.buildCommand(commander, async (values) => {
|
|
118
|
+
this.lastExitCode = await this.execute(params, values, DyCLI_Program_ControlService.commonOf(command.opts(), common));
|
|
119
|
+
});
|
|
120
|
+
const common = this.addCommonOptions(commander, params, command);
|
|
121
|
+
program.addCommand(command);
|
|
122
|
+
});
|
|
123
|
+
await this.configure?.(program);
|
|
124
|
+
return program;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Parses the command line and runs the command.
|
|
128
|
+
* @param argv - the full argv (default: `process.argv`)
|
|
129
|
+
* @returns the exit code — set it as `process.exitCode`
|
|
130
|
+
*/
|
|
131
|
+
async run(argv = process.argv) {
|
|
132
|
+
const program = await this.build();
|
|
133
|
+
let parseMessage = '';
|
|
134
|
+
// commander must not exit the process: every command gets the override, and its messages are captured
|
|
135
|
+
[program, ...program.commands].forEach((command) => {
|
|
136
|
+
command.exitOverride().configureOutput({
|
|
137
|
+
writeOut: (text) => this.io.stdout(text),
|
|
138
|
+
writeErr: (text) => {
|
|
139
|
+
parseMessage += text;
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
this.lastExitCode = 0;
|
|
144
|
+
try {
|
|
145
|
+
await program.parseAsync(argv);
|
|
146
|
+
return this.lastExitCode;
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
const failure = error;
|
|
150
|
+
// help and version are not errors
|
|
151
|
+
if (failure?.code === 'commander.helpDisplayed' || failure?.code === 'commander.version' ||
|
|
152
|
+
failure?.code === 'commander.help') {
|
|
153
|
+
return 0;
|
|
154
|
+
}
|
|
155
|
+
if (typeof failure?.code !== 'string' || !failure.code.startsWith('commander.')) {
|
|
156
|
+
throw error;
|
|
157
|
+
}
|
|
158
|
+
const envelope = cli_envelope_util_1.DyCLI_Envelope_Util.failure({
|
|
159
|
+
action: 'cli.parse', requestId: (0, crypto_1.randomUUID)(), startedAt: Date.now(),
|
|
160
|
+
error: { code: 'INVALID_ARGS', message: (failure.message || parseMessage).replace(/^error:\s*/i, '').trim() },
|
|
161
|
+
});
|
|
162
|
+
this.io.stderr(cli_envelope_util_1.DyCLI_Envelope_Util.stringify(envelope, argv.includes('--pretty')));
|
|
163
|
+
return this.exitCodeOfParse();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Runs one command: `before` → `action` or the server call → `after`, then writes the envelope.
|
|
168
|
+
* @param params - the command
|
|
169
|
+
* @param values - the collected flag values
|
|
170
|
+
* @param common - the common options
|
|
171
|
+
* @returns the exit code
|
|
172
|
+
*/
|
|
173
|
+
async execute(params, values, common) {
|
|
174
|
+
const startedAt = Date.now();
|
|
175
|
+
const requestId = (0, crypto_1.randomUUID)();
|
|
176
|
+
const human = !common.json && params.getOutput(this.settings) === cli_output_type_enum_1.DyCLI_Output_Type.human;
|
|
177
|
+
try {
|
|
178
|
+
await params.before?.(values, params);
|
|
179
|
+
const result = params.action ?
|
|
180
|
+
await params.action(values, params, common) : await this.callServer(params, values, common);
|
|
181
|
+
await params.after?.(result, values, params);
|
|
182
|
+
if (human) {
|
|
183
|
+
this.io.stdout(`${params.formatHuman ? params.formatHuman(result) : JSON.stringify(result, null, 2)}\n`);
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
this.io.stdout(cli_envelope_util_1.DyCLI_Envelope_Util.stringify(cli_envelope_util_1.DyCLI_Envelope_Util.success({ action: params.command, requestId: requestId, startedAt: startedAt, result: result }), common.pretty));
|
|
187
|
+
}
|
|
188
|
+
return 0;
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
const envelope = cli_envelope_util_1.DyCLI_Envelope_Util.failure({
|
|
192
|
+
action: params.command, requestId: requestId, startedAt: startedAt, error: error,
|
|
193
|
+
});
|
|
194
|
+
if (human) {
|
|
195
|
+
this.io.stderr([
|
|
196
|
+
`${params.command}: ${envelope.error.code}: ${envelope.error.message}`,
|
|
197
|
+
...(envelope.error.nextStep ? [`next: ${envelope.error.nextStep}`] : []),
|
|
198
|
+
].join('\n') + '\n');
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
this.io.stderr(cli_envelope_util_1.DyCLI_Envelope_Util.stringify(envelope, common.pretty));
|
|
202
|
+
}
|
|
203
|
+
return params.exitCodeOf(error, this.settings);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/** Calls the operation of a generated command through the configured caller. */
|
|
207
|
+
async callServer(params, values, common) {
|
|
208
|
+
if (!this.callOperation) {
|
|
209
|
+
throw new fsm_dynamo_1.DyFM_Error({
|
|
210
|
+
status: 501,
|
|
211
|
+
errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-CLI-NOC`,
|
|
212
|
+
message: `command "${params.command}" calls a server operation, but the program has no callOperation`,
|
|
213
|
+
userMessage: `This CLI can not call "${params.command}": no server connection is configured.`,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
return this.callOperation(params, values, common);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Adds the common options a command does not already have (a command flag of the same name wins).
|
|
220
|
+
* @returns the added long flags
|
|
221
|
+
*/
|
|
222
|
+
addCommonOptions(commander, params, command) {
|
|
223
|
+
const own = params.flags.map((flag) => flag.flag);
|
|
224
|
+
const wanted = params.operation ? [...DyCLI_outputOptions, ...DyCLI_remoteOptions] : DyCLI_outputOptions;
|
|
225
|
+
const options = {
|
|
226
|
+
'json': () => new commander.Option('--json', 'print the JSON result envelope'),
|
|
227
|
+
'pretty': () => new commander.Option('--pretty', 'indent the JSON output'),
|
|
228
|
+
'dry-run': () => new commander.Option('--dry-run', 'validate and preview without saving'),
|
|
229
|
+
'api-key': () => new commander.Option('--api-key <key>', 'the API key of the server call'),
|
|
230
|
+
'base-url': () => new commander.Option('--base-url <url>', 'the server base URL'),
|
|
231
|
+
'timeout': () => new commander.Option('--timeout <ms>', 'the server call timeout in milliseconds')
|
|
232
|
+
.argParser((raw) => {
|
|
233
|
+
if (!/^\d+$/.test(raw.trim()) || Number(raw) < 1) {
|
|
234
|
+
throw new commander.InvalidArgumentError('--timeout must be a positive integer of milliseconds');
|
|
235
|
+
}
|
|
236
|
+
return Number(raw);
|
|
237
|
+
}),
|
|
238
|
+
};
|
|
239
|
+
const added = wanted.filter((flag) => !own.includes(flag) && !cli_flag_util_1.DyCLI_reservedFlags.includes(flag));
|
|
240
|
+
added.forEach((flag) => {
|
|
241
|
+
command.addOption(options[flag]());
|
|
242
|
+
});
|
|
243
|
+
return added;
|
|
244
|
+
}
|
|
245
|
+
/** The exit code of a commander argument error: the `usage` code of the settings (a command override does not apply). */
|
|
246
|
+
exitCodeOfParse() {
|
|
247
|
+
return this.settings?.exitCodes?.usage ?? cli_exit_code_type_enum_1.DyCLI_ExitCode_Type.usage;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* The common options from the parsed commander options — only the ones the program added to this command, so a
|
|
251
|
+
* command's own flag of the same name (e.g. the `dryRun` guardrail argument) stays a value, not a common option.
|
|
252
|
+
* @param options - the parsed options (`command.opts()`)
|
|
253
|
+
* @param added - the long flags of the common options added to the command
|
|
254
|
+
*/
|
|
255
|
+
static commonOf(options, added) {
|
|
256
|
+
const common = {};
|
|
257
|
+
const keys = {
|
|
258
|
+
'json': 'json', 'pretty': 'pretty', 'dry-run': 'dryRun', 'api-key': 'apiKey', 'base-url': 'baseUrl',
|
|
259
|
+
'timeout': 'timeoutMs',
|
|
260
|
+
};
|
|
261
|
+
added.forEach((flag) => {
|
|
262
|
+
const value = options?.[cli_flag_util_1.DyCLI_Flag_Util.attributeOf(flag)];
|
|
263
|
+
if (value !== undefined) {
|
|
264
|
+
common[keys[flag]] = value;
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
return common;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
exports.DyCLI_Program_ControlService = DyCLI_Program_ControlService;
|
|
271
|
+
//# sourceMappingURL=cli-program.control-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-program.control-service.js","sourceRoot":"","sources":["../../../../src/_modules/cli/_services/cli-program.control-service.ts"],"names":[],"mappings":";;;AAGA,mCAAoC;AAEpC,sDAAmD;AAEnD,uFAAoF;AACpF,2EAA0E;AAC1E,yEAAwE;AACxE,iEAAqF;AACrF,+EAAwE;AACxE,yEAAmE;AACnE,iHAEoE;AAoBpE,2CAA2C;AAC3C,MAAM,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C,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC;IAED,yHAAyH;IACjH,eAAe;QACrB,OAAO,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,IAAI,6CAAmB,CAAC,KAAK,CAAC;IACtE,CAAC;IAED;;;;;OAKG;IACK,MAAM,CAAC,QAAQ,CAAC,OAAyC,EAAE,KAAe;QAChF,MAAM,MAAM,GAAwB,EAAE,CAAC;QACvC,MAAM,IAAI,GAAkD;YAC1D,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS;YACnG,SAAS,EAAE,WAAW;SACvB,CAAC;QAEF,KAAK,CAAC,OAAO,CAAC,CAAC,IAAY,EAAQ,EAAE;YACnC,MAAM,KAAK,GAAY,OAAO,EAAE,CAAC,+BAAe,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;YAEpE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACvB,MAAqC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC;YAC7D,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAlSD,oEAkSC"}
|
|
@@ -1,2 +1,13 @@
|
|
|
1
|
+
export * from './_enums/cli-exit-code.type-enum';
|
|
2
|
+
export * from './_enums/cli-flag-value.type-enum';
|
|
3
|
+
export * from './_enums/cli-output.type-enum';
|
|
4
|
+
export * from './_models/interfaces/cli-common-options.interface';
|
|
5
|
+
export * from './_models/interfaces/cli-envelope.interface';
|
|
6
|
+
export * from './_models/interfaces/cli-flag.interface';
|
|
7
|
+
export * from './_models/interfaces/cli-settings.interface';
|
|
8
|
+
export * from './_models/control-models/cli-command-params.control-model';
|
|
1
9
|
export * from './_collections/cli-commander.util';
|
|
10
|
+
export * from './_collections/cli-envelope.util';
|
|
11
|
+
export * from './_collections/cli-flag.util';
|
|
12
|
+
export * from './_services/cli-program.control-service';
|
|
2
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/_modules/cli/index.ts"],"names":[],"mappings":"AAOA,cAAc,mCAAmC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/_modules/cli/index.ts"],"names":[],"mappings":"AAOA,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAG9C,cAAc,mDAAmD,CAAC;AAClE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC;AAG5D,cAAc,2DAA2D,CAAC;AAG1E,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAG7C,cAAc,yCAAyC,CAAC"}
|
|
@@ -4,6 +4,21 @@
|
|
|
4
4
|
// re-export this module, so a server never needs `commander`.
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
|
+
// ENUMS
|
|
8
|
+
tslib_1.__exportStar(require("./_enums/cli-exit-code.type-enum"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./_enums/cli-flag-value.type-enum"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./_enums/cli-output.type-enum"), exports);
|
|
11
|
+
// INTERFACES
|
|
12
|
+
tslib_1.__exportStar(require("./_models/interfaces/cli-common-options.interface"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./_models/interfaces/cli-envelope.interface"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./_models/interfaces/cli-flag.interface"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./_models/interfaces/cli-settings.interface"), exports);
|
|
16
|
+
// CONTROL MODELS
|
|
17
|
+
tslib_1.__exportStar(require("./_models/control-models/cli-command-params.control-model"), exports);
|
|
7
18
|
// COLLECTIONS
|
|
8
19
|
tslib_1.__exportStar(require("./_collections/cli-commander.util"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./_collections/cli-envelope.util"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./_collections/cli-flag.util"), exports);
|
|
22
|
+
// SERVICES
|
|
23
|
+
tslib_1.__exportStar(require("./_services/cli-program.control-service"), exports);
|
|
9
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/_modules/cli/index.ts"],"names":[],"mappings":";AAEA,qHAAqH;AACrH,qHAAqH;AACrH,8DAA8D;;;AAE9D,cAAc;AACd,4EAAkD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/_modules/cli/index.ts"],"names":[],"mappings":";AAEA,qHAAqH;AACrH,qHAAqH;AACrH,8DAA8D;;;AAE9D,QAAQ;AACR,2EAAiD;AACjD,4EAAkD;AAClD,wEAA8C;AAE9C,aAAa;AACb,4FAAkE;AAClE,sFAA4D;AAC5D,kFAAwD;AACxD,sFAA4D;AAE5D,iBAAiB;AACjB,oGAA0E;AAE1E,cAAc;AACd,4EAAkD;AAClD,2EAAiD;AACjD,uEAA6C;AAE7C,WAAW;AACX,kFAAwD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@futdevpro/nts-dynamo",
|
|
3
|
-
"version": "01.15.
|
|
3
|
+
"version": "01.15.308",
|
|
4
4
|
"description": "Dynamic NodeTS (NodeJS-Typescript), MongoDB Backend System Framework by Future Development Program Ltd.",
|
|
5
5
|
"DyBu_settings": {
|
|
6
6
|
"packageType": "server-package",
|