@futdevpro/nts-dynamo 1.15.307 → 1.15.309
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/_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-mcp-caller.util.d.ts +41 -0
- package/build/_modules/cli/_collections/cli-mcp-caller.util.d.ts.map +1 -0
- package/build/_modules/cli/_collections/cli-mcp-caller.util.js +67 -0
- package/build/_modules/cli/_collections/cli-mcp-caller.util.js.map +1 -0
- package/build/_modules/cli/_models/control-models/cli-command-params.control-model.d.ts +4 -3
- package/build/_modules/cli/_models/control-models/cli-command-params.control-model.d.ts.map +1 -1
- package/build/_modules/cli/_models/control-models/cli-command-params.control-model.js.map +1 -1
- 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/_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 +5 -0
- package/build/_modules/cli/index.d.ts.map +1 -1
- package/build/_modules/cli/index.js +6 -0
- package/build/_modules/cli/index.js.map +1 -1
- package/build/_modules/mcp/_collections/mcp-client.util.d.ts +86 -0
- package/build/_modules/mcp/_collections/mcp-client.util.d.ts.map +1 -0
- package/build/_modules/mcp/_collections/mcp-client.util.js +169 -0
- package/build/_modules/mcp/_collections/mcp-client.util.js.map +1 -0
- package/build/_modules/mcp/_collections/mcp-error.util.d.ts +7 -0
- package/build/_modules/mcp/_collections/mcp-error.util.d.ts.map +1 -1
- package/build/_modules/mcp/_collections/mcp-error.util.js +22 -0
- package/build/_modules/mcp/_collections/mcp-error.util.js.map +1 -1
- package/build/_modules/mcp/index.d.ts +1 -0
- package/build/_modules/mcp/index.d.ts.map +1 -1
- package/build/_modules/mcp/index.js +1 -0
- package/build/_modules/mcp/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -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,mBAAmB,GAAa,CAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAE,CAAC;AACtE,qEAAqE;AACrE,MAAM,mBAAmB,GAAa,CAAE,SAAS,EAAE,UAAU,EAAE,SAAS,CAAE,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;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,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,9 +1,14 @@
|
|
|
1
1
|
export * from './_enums/cli-exit-code.type-enum';
|
|
2
2
|
export * from './_enums/cli-flag-value.type-enum';
|
|
3
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';
|
|
4
6
|
export * from './_models/interfaces/cli-flag.interface';
|
|
5
7
|
export * from './_models/interfaces/cli-settings.interface';
|
|
6
8
|
export * from './_models/control-models/cli-command-params.control-model';
|
|
7
9
|
export * from './_collections/cli-commander.util';
|
|
10
|
+
export * from './_collections/cli-envelope.util';
|
|
8
11
|
export * from './_collections/cli-flag.util';
|
|
12
|
+
export * from './_collections/cli-mcp-caller.util';
|
|
13
|
+
export * from './_services/cli-program.control-service';
|
|
9
14
|
//# 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,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAG9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC;AAG5D,cAAc,2DAA2D,CAAC;AAG1E,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,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;AAC7C,cAAc,oCAAoC,CAAC;AAGnD,cAAc,yCAAyC,CAAC"}
|
|
@@ -9,11 +9,17 @@ tslib_1.__exportStar(require("./_enums/cli-exit-code.type-enum"), exports);
|
|
|
9
9
|
tslib_1.__exportStar(require("./_enums/cli-flag-value.type-enum"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./_enums/cli-output.type-enum"), exports);
|
|
11
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);
|
|
12
14
|
tslib_1.__exportStar(require("./_models/interfaces/cli-flag.interface"), exports);
|
|
13
15
|
tslib_1.__exportStar(require("./_models/interfaces/cli-settings.interface"), exports);
|
|
14
16
|
// CONTROL MODELS
|
|
15
17
|
tslib_1.__exportStar(require("./_models/control-models/cli-command-params.control-model"), exports);
|
|
16
18
|
// COLLECTIONS
|
|
17
19
|
tslib_1.__exportStar(require("./_collections/cli-commander.util"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./_collections/cli-envelope.util"), exports);
|
|
18
21
|
tslib_1.__exportStar(require("./_collections/cli-flag.util"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./_collections/cli-mcp-caller.util"), exports);
|
|
23
|
+
// SERVICES
|
|
24
|
+
tslib_1.__exportStar(require("./_services/cli-program.control-service"), exports);
|
|
19
25
|
//# 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,QAAQ;AACR,2EAAiD;AACjD,4EAAkD;AAClD,wEAA8C;AAE9C,aAAa;AACb,kFAAwD;AACxD,sFAA4D;AAE5D,iBAAiB;AACjB,oGAA0E;AAE1E,cAAc;AACd,4EAAkD;AAClD,uEAA6C"}
|
|
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;AAC7C,6EAAmD;AAEnD,WAAW;AACX,kFAAwD"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** One MCP server call target. */
|
|
2
|
+
export interface DyNTS_McpClient_Target {
|
|
3
|
+
/** The server base URL (e.g. `https://organizer.example.com/api`). */
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
/** The MCP endpoint path under the base URL; default: `/mcp` (the `DyNTS_McpHttpEndpoint_Util` default). */
|
|
6
|
+
endpointPath?: string;
|
|
7
|
+
/** Sent as `Authorization: Bearer <apiKey>`. */
|
|
8
|
+
apiKey?: string;
|
|
9
|
+
/** Extra request headers. */
|
|
10
|
+
headers?: {
|
|
11
|
+
[name: string]: string;
|
|
12
|
+
};
|
|
13
|
+
/** The request timeout in milliseconds; default: 20 000 (the organizer `fo` client). */
|
|
14
|
+
timeoutMs?: number;
|
|
15
|
+
}
|
|
16
|
+
/** The outcome of a `tools/call`. */
|
|
17
|
+
export interface DyNTS_McpClient_ToolResult {
|
|
18
|
+
/** The tool output: the first text block, parsed as JSON when it is JSON. */
|
|
19
|
+
data: unknown;
|
|
20
|
+
/** The non-fatal warnings of the call (the second `{ warnings }` block of a Dynamo MCP server). */
|
|
21
|
+
warnings: string[];
|
|
22
|
+
}
|
|
23
|
+
/** A tool as `tools/list` advertises it. */
|
|
24
|
+
export interface DyNTS_McpClient_Tool {
|
|
25
|
+
/** The tool name. */
|
|
26
|
+
name: string;
|
|
27
|
+
/** The tool description. */
|
|
28
|
+
description?: string;
|
|
29
|
+
/** The JSON schema of the arguments. */
|
|
30
|
+
inputSchema?: {
|
|
31
|
+
[key: string]: unknown;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The standard MCP client (HP-DOPL MP-4.5, DMCP-015): `tools/list` and `tools/call` over Streamable HTTP with plain
|
|
36
|
+
* `fetch` — no SDK, so a CLI stays light. It replaces the hand-written JSON-RPC clients of the fleet (organizer `fo`,
|
|
37
|
+
* the CCAP probe) with one tested implementation.
|
|
38
|
+
*
|
|
39
|
+
* Every failure is a coded `DyFM_Error` with an HTTP-like status, so a CLI maps it to the right exit code:
|
|
40
|
+
* - the server answered non-2xx → that status (`DyNTS-MCC-HTP`);
|
|
41
|
+
* - a JSON-RPC error → `DyNTS_McpError_Util.statusOfCode` (`DyNTS-MCC-RPC`);
|
|
42
|
+
* - a tool error (`isError`) → the status of its code, its own `errorCode` and message kept;
|
|
43
|
+
* - the server could not be reached or timed out → no status, the network code kept on `error` (`DyNTS-MCC-NET`);
|
|
44
|
+
* - an unreadable answer → 502 (`DyNTS-MCC-RES`).
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const result: DyNTS_McpClient_ToolResult = await DyNTS_McpClient_Util.callTool({
|
|
49
|
+
* baseUrl: 'https://organizer.example.com/api', apiKey: key, name: 'tasks.list', arguments: { projectId: 'p-1' },
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare class DyNTS_McpClient_Util {
|
|
54
|
+
/**
|
|
55
|
+
* Lists the advertised tools.
|
|
56
|
+
* @param target - the server
|
|
57
|
+
*/
|
|
58
|
+
static listTools(target: DyNTS_McpClient_Target): Promise<DyNTS_McpClient_Tool[]>;
|
|
59
|
+
/**
|
|
60
|
+
* Calls a tool.
|
|
61
|
+
* @param set - the server, the tool name and its arguments
|
|
62
|
+
* @throws a coded `DyFM_Error` — see the class description
|
|
63
|
+
*/
|
|
64
|
+
static callTool(set: DyNTS_McpClient_Target & {
|
|
65
|
+
name: string;
|
|
66
|
+
arguments?: object;
|
|
67
|
+
}): Promise<DyNTS_McpClient_ToolResult>;
|
|
68
|
+
/**
|
|
69
|
+
* Sends one JSON-RPC request and returns its `result`.
|
|
70
|
+
* @param set - the server, the method and its params
|
|
71
|
+
* @throws a coded `DyFM_Error` — see the class description
|
|
72
|
+
*/
|
|
73
|
+
static request(set: DyNTS_McpClient_Target & {
|
|
74
|
+
method: string;
|
|
75
|
+
params?: object;
|
|
76
|
+
}): Promise<unknown>;
|
|
77
|
+
/** The JSON-RPC message of an answer: a JSON body, or the last `data:` event of an SSE stream. */
|
|
78
|
+
private static parseBody;
|
|
79
|
+
/** A text parsed as JSON when it is JSON, else the text itself (`undefined` stays `undefined`). */
|
|
80
|
+
private static parseText;
|
|
81
|
+
/** The coded error of a tool error payload `{ ok: false, error: { code, message, errorCode } }`. */
|
|
82
|
+
private static toolError;
|
|
83
|
+
/** A coded client error. */
|
|
84
|
+
private static error;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=mcp-client.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-client.util.d.ts","sourceRoot":"","sources":["../../../../src/_modules/mcp/_collections/mcp-client.util.ts"],"names":[],"mappings":"AAMA,kCAAkC;AAClC,MAAM,WAAW,sBAAsB;IACrC,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,4GAA4G;IAC5G,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6BAA6B;IAC7B,OAAO,CAAC,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACrC,wFAAwF;IACxF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qCAAqC;AACrC,MAAM,WAAW,0BAA0B;IACzC,6EAA6E;IAC7E,IAAI,EAAE,OAAO,CAAC;IACd,mGAAmG;IACnG,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,4CAA4C;AAC5C,MAAM,WAAW,oBAAoB;IACnC,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,WAAW,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;CAC1C;AAKD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,oBAAoB;IAC/B;;;OAGG;WACU,SAAS,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAWvF;;;;OAIG;WACU,QAAQ,CAAC,GAAG,EAAE,sBAAsB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAoB9H;;;;OAIG;WACU,OAAO,CAAC,GAAG,EAAE,sBAAsB,GAAG;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IA2DzG,kGAAkG;IAClG,OAAO,CAAC,MAAM,CAAC,SAAS;IAcxB,mGAAmG;IACnG,OAAO,CAAC,MAAM,CAAC,SAAS;IAYxB,oGAAoG;IACpG,OAAO,CAAC,MAAM,CAAC,SAAS;IAexB,4BAA4B;IAC5B,OAAO,CAAC,MAAM,CAAC,KAAK;CAerB"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DyNTS_McpClient_Util = void 0;
|
|
4
|
+
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
5
|
+
const global_settings_const_1 = require("../../../_collections/global-settings.const");
|
|
6
|
+
const mcp_error_util_1 = require("./mcp-error.util");
|
|
7
|
+
/** The JSON-RPC request id counter of the process. */
|
|
8
|
+
let DyNTS_mcpClientRequestId = 0;
|
|
9
|
+
/**
|
|
10
|
+
* The standard MCP client (HP-DOPL MP-4.5, DMCP-015): `tools/list` and `tools/call` over Streamable HTTP with plain
|
|
11
|
+
* `fetch` — no SDK, so a CLI stays light. It replaces the hand-written JSON-RPC clients of the fleet (organizer `fo`,
|
|
12
|
+
* the CCAP probe) with one tested implementation.
|
|
13
|
+
*
|
|
14
|
+
* Every failure is a coded `DyFM_Error` with an HTTP-like status, so a CLI maps it to the right exit code:
|
|
15
|
+
* - the server answered non-2xx → that status (`DyNTS-MCC-HTP`);
|
|
16
|
+
* - a JSON-RPC error → `DyNTS_McpError_Util.statusOfCode` (`DyNTS-MCC-RPC`);
|
|
17
|
+
* - a tool error (`isError`) → the status of its code, its own `errorCode` and message kept;
|
|
18
|
+
* - the server could not be reached or timed out → no status, the network code kept on `error` (`DyNTS-MCC-NET`);
|
|
19
|
+
* - an unreadable answer → 502 (`DyNTS-MCC-RES`).
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const result: DyNTS_McpClient_ToolResult = await DyNTS_McpClient_Util.callTool({
|
|
24
|
+
* baseUrl: 'https://organizer.example.com/api', apiKey: key, name: 'tasks.list', arguments: { projectId: 'p-1' },
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
class DyNTS_McpClient_Util {
|
|
29
|
+
/**
|
|
30
|
+
* Lists the advertised tools.
|
|
31
|
+
* @param target - the server
|
|
32
|
+
*/
|
|
33
|
+
static async listTools(target) {
|
|
34
|
+
const result = await DyNTS_McpClient_Util.request({ ...target, method: 'tools/list', params: {} });
|
|
35
|
+
if (!Array.isArray(result?.tools)) {
|
|
36
|
+
throw DyNTS_McpClient_Util.error({ code: 'DyNTS-MCC-RES', status: 502, message: 'tools/list answered without tools' });
|
|
37
|
+
}
|
|
38
|
+
return result.tools;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Calls a tool.
|
|
42
|
+
* @param set - the server, the tool name and its arguments
|
|
43
|
+
* @throws a coded `DyFM_Error` — see the class description
|
|
44
|
+
*/
|
|
45
|
+
static async callTool(set) {
|
|
46
|
+
const result = await DyNTS_McpClient_Util.request({
|
|
47
|
+
...set, method: 'tools/call', params: { name: set.name, arguments: set.arguments ?? {} },
|
|
48
|
+
});
|
|
49
|
+
const texts = (Array.isArray(result?.content) ? result.content : [])
|
|
50
|
+
.filter((block) => block?.type === 'text' && typeof block.text === 'string')
|
|
51
|
+
.map((block) => block.text);
|
|
52
|
+
const data = DyNTS_McpClient_Util.parseText(texts[0]);
|
|
53
|
+
if (result?.isError === true) {
|
|
54
|
+
throw DyNTS_McpClient_Util.toolError(set.name, data);
|
|
55
|
+
}
|
|
56
|
+
const second = DyNTS_McpClient_Util.parseText(texts[1]);
|
|
57
|
+
const warnings = Array.isArray(second?.warnings) ?
|
|
58
|
+
second.warnings.filter((warning) => typeof warning === 'string') : [];
|
|
59
|
+
return { data: data, warnings: warnings };
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Sends one JSON-RPC request and returns its `result`.
|
|
63
|
+
* @param set - the server, the method and its params
|
|
64
|
+
* @throws a coded `DyFM_Error` — see the class description
|
|
65
|
+
*/
|
|
66
|
+
static async request(set) {
|
|
67
|
+
const url = `${set.baseUrl?.replace(/\/+$/, '') ?? ''}${set.endpointPath ?? '/mcp'}`;
|
|
68
|
+
const controller = new AbortController();
|
|
69
|
+
const timer = setTimeout(() => controller.abort(), set.timeoutMs ?? 20000);
|
|
70
|
+
let response;
|
|
71
|
+
let text;
|
|
72
|
+
try {
|
|
73
|
+
response = await fetch(url, {
|
|
74
|
+
method: 'POST',
|
|
75
|
+
headers: {
|
|
76
|
+
'content-type': 'application/json',
|
|
77
|
+
// a Streamable HTTP server may answer with JSON or with an SSE stream
|
|
78
|
+
'accept': 'application/json, text/event-stream',
|
|
79
|
+
...(set.apiKey ? { authorization: `Bearer ${set.apiKey}` } : {}),
|
|
80
|
+
...set.headers,
|
|
81
|
+
},
|
|
82
|
+
body: JSON.stringify({ jsonrpc: '2.0', id: ++DyNTS_mcpClientRequestId, method: set.method, params: set.params ?? {} }),
|
|
83
|
+
signal: controller.signal,
|
|
84
|
+
});
|
|
85
|
+
text = await response.text();
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
const aborted = error?.name === 'AbortError';
|
|
89
|
+
const code = aborted ? 'ETIMEDOUT' : error?.cause?.code;
|
|
90
|
+
throw DyNTS_McpClient_Util.error({
|
|
91
|
+
code: 'DyNTS-MCC-NET',
|
|
92
|
+
message: aborted ? `the MCP server did not answer within ${set.timeoutMs ?? 20000} ms (${url})` :
|
|
93
|
+
`the MCP server could not be reached (${url}${code ? `, ${code}` : ''})`,
|
|
94
|
+
cause: { code: code ?? 'ECONNREFUSED' },
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
finally {
|
|
98
|
+
clearTimeout(timer);
|
|
99
|
+
}
|
|
100
|
+
const body = DyNTS_McpClient_Util.parseBody(text, response.headers.get('content-type'));
|
|
101
|
+
if (!response.ok) {
|
|
102
|
+
throw DyNTS_McpClient_Util.error({
|
|
103
|
+
code: 'DyNTS-MCC-HTP', status: response.status,
|
|
104
|
+
message: `the MCP server answered HTTP ${response.status}${body?.error?.message ? `: ${body.error.message}` : ''}`,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
if (!body || typeof body !== 'object') {
|
|
108
|
+
throw DyNTS_McpClient_Util.error({ code: 'DyNTS-MCC-RES', status: 502, message: `unreadable MCP answer from ${url}` });
|
|
109
|
+
}
|
|
110
|
+
if (body.error) {
|
|
111
|
+
throw DyNTS_McpClient_Util.error({
|
|
112
|
+
code: 'DyNTS-MCC-RPC', status: mcp_error_util_1.DyNTS_McpError_Util.statusOfCode(body.error.code),
|
|
113
|
+
message: `${set.method}: ${body.error.message ?? 'JSON-RPC error'} (${body.error.code})`,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return body.result;
|
|
117
|
+
}
|
|
118
|
+
/** The JSON-RPC message of an answer: a JSON body, or the last `data:` event of an SSE stream. */
|
|
119
|
+
static parseBody(text, contentType) {
|
|
120
|
+
if (contentType?.includes('text/event-stream')) {
|
|
121
|
+
const events = text.split(/\r?\n/)
|
|
122
|
+
.filter((line) => line.startsWith('data:'))
|
|
123
|
+
.map((line) => line.slice(5).trim());
|
|
124
|
+
return DyNTS_McpClient_Util.parseText(events[events.length - 1]);
|
|
125
|
+
}
|
|
126
|
+
return DyNTS_McpClient_Util.parseText(text);
|
|
127
|
+
}
|
|
128
|
+
/** A text parsed as JSON when it is JSON, else the text itself (`undefined` stays `undefined`). */
|
|
129
|
+
static parseText(text) {
|
|
130
|
+
if (text === undefined) {
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
return JSON.parse(text);
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
return text;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/** The coded error of a tool error payload `{ ok: false, error: { code, message, errorCode } }`. */
|
|
141
|
+
static toolError(tool, payload) {
|
|
142
|
+
const failure = payload?.error ?? {};
|
|
143
|
+
const message = typeof failure.message === 'string' && failure.message ?
|
|
144
|
+
failure.message : `the tool "${tool}" failed`;
|
|
145
|
+
return new fsm_dynamo_1.DyFM_Error({
|
|
146
|
+
status: mcp_error_util_1.DyNTS_McpError_Util.statusOfCode(failure.code),
|
|
147
|
+
errorCode: failure.errorCode || `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-MCC-TOL`,
|
|
148
|
+
message: message,
|
|
149
|
+
userMessage: message,
|
|
150
|
+
additionalContent: { tool: tool, jsonRpcCode: failure.code },
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/** A coded client error. */
|
|
154
|
+
static error(set) {
|
|
155
|
+
const error = new fsm_dynamo_1.DyFM_Error({
|
|
156
|
+
status: set.status,
|
|
157
|
+
errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|${set.code}`,
|
|
158
|
+
message: set.message,
|
|
159
|
+
userMessage: set.message,
|
|
160
|
+
});
|
|
161
|
+
// the network code of an unreachable server, where a CLI looks for it (`DyCLI_Command_Params.exitCodeOf`)
|
|
162
|
+
if (set.cause) {
|
|
163
|
+
error.cause = set.cause;
|
|
164
|
+
}
|
|
165
|
+
return error;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
exports.DyNTS_McpClient_Util = DyNTS_McpClient_Util;
|
|
169
|
+
//# sourceMappingURL=mcp-client.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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,mBAAmB,gBAAgB;YAC5F,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,OAAO;YACpB,iBAAiB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,IAAI,EAAE;SAC7D,CAAC,CAAC;IACL,CAAC;IAED,4BAA4B;IACpB,MAAM,CAAC,KAAK,CAAC,GAAiF;QACpG,MAAM,KAAK,GAAe,IAAI,uBAAU,CAAC;YACvC,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,SAAS,EAAE,GAAG,6CAAqB,CAAC,mBAAmB,IAAI,GAAG,CAAC,IAAI,EAAE;YACrE,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,WAAW,EAAE,GAAG,CAAC,OAAO;SACzB,CAAC,CAAC;QAEH,0GAA0G;QAC1G,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;YACb,KAAgD,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;QACtE,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AArKD,oDAqKC"}
|
|
@@ -30,6 +30,13 @@ export declare class DyNTS_McpError_Util {
|
|
|
30
30
|
* @param status - the HTTP status of a `DyFM_Error`
|
|
31
31
|
*/
|
|
32
32
|
static codeOfStatus(status: number | undefined): DyNTS_McpErrorCode_Type;
|
|
33
|
+
/**
|
|
34
|
+
* The HTTP-like status of a JSON-RPC error code — the inverse of `codeOfStatus`, for a CLIENT that turns an MCP error
|
|
35
|
+
* back into a coded error (HP-DOPL MP-4.5): invalid params → 400 · method not found → 404 · forbidden → 403 ·
|
|
36
|
+
* conflict → 409 · internal → 500 · any other code → 502 (the server answered with something unknown).
|
|
37
|
+
* @param code - the JSON-RPC error code
|
|
38
|
+
*/
|
|
39
|
+
static statusOfCode(code: number | undefined): number;
|
|
33
40
|
/** A generic, caller-safe label of a code. */
|
|
34
41
|
private static labelOf;
|
|
35
42
|
/** Drops the undefined fields, so the serialized data stays compact. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-error.util.d.ts","sourceRoot":"","sources":["../../../../src/_modules/mcp/_collections/mcp-error.util.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAI7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAG5F;;;;;;;;;;;;GAYG;AACH,qBAAa,mBAAmB;IAC9B;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,sBAAsB;IAwChH;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,uBAAuB;IAgBxE,8CAA8C;IAC9C,OAAO,CAAC,MAAM,CAAC,OAAO;IAetB,wEAAwE;IACxE,OAAO,CAAC,MAAM,CAAC,gBAAgB;CAShC"}
|
|
1
|
+
{"version":3,"file":"mcp-error.util.d.ts","sourceRoot":"","sources":["../../../../src/_modules/mcp/_collections/mcp-error.util.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAI7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAG5F;;;;;;;;;;;;GAYG;AACH,qBAAa,mBAAmB;IAC9B;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,sBAAsB;IAwChH;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,uBAAuB;IAgBxE;;;;;OAKG;IACH,MAAM,CAAC,YAAY,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