@mcp-abap-adt/core 5.1.1 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +2 -2
- package/dist/handlers/compact/high/compactSchemas.d.ts +5 -10
- package/dist/handlers/compact/high/compactSchemas.d.ts.map +1 -1
- package/dist/handlers/compact/high/compactSchemas.js +4 -6
- package/dist/handlers/compact/high/compactSchemas.js.map +1 -1
- package/dist/handlers/compact/high/handleHandlerDumpList.d.ts +8 -14
- package/dist/handlers/compact/high/handleHandlerDumpList.d.ts.map +1 -1
- package/dist/handlers/compact/high/handleHandlerDumpList.js +9 -3
- package/dist/handlers/compact/high/handleHandlerDumpList.js.map +1 -1
- package/dist/handlers/interface/high/handleUpdateInterface.d.ts.map +1 -1
- package/dist/handlers/interface/high/handleUpdateInterface.js +5 -3
- package/dist/handlers/interface/high/handleUpdateInterface.js.map +1 -1
- package/dist/handlers/service_binding/high/handleCreateServiceBinding.d.ts +6 -11
- package/dist/handlers/service_binding/high/handleCreateServiceBinding.d.ts.map +1 -1
- package/dist/handlers/service_binding/high/handleCreateServiceBinding.js +12 -17
- package/dist/handlers/service_binding/high/handleCreateServiceBinding.js.map +1 -1
- package/dist/handlers/service_binding/high/handleUpdateServiceBinding.d.ts +7 -7
- package/dist/handlers/service_binding/high/handleUpdateServiceBinding.d.ts.map +1 -1
- package/dist/handlers/service_binding/high/handleUpdateServiceBinding.js +14 -7
- package/dist/handlers/service_binding/high/handleUpdateServiceBinding.js.map +1 -1
- package/dist/handlers/service_binding/low/handleActivateServiceBinding.d.ts +64 -0
- package/dist/handlers/service_binding/low/handleActivateServiceBinding.d.ts.map +1 -0
- package/dist/handlers/service_binding/low/handleActivateServiceBinding.js +127 -0
- package/dist/handlers/service_binding/low/handleActivateServiceBinding.js.map +1 -0
- package/dist/handlers/service_definition/low/handleActivateServiceDefinition.d.ts +64 -0
- package/dist/handlers/service_definition/low/handleActivateServiceDefinition.d.ts.map +1 -0
- package/dist/handlers/service_definition/low/handleActivateServiceDefinition.js +127 -0
- package/dist/handlers/service_definition/low/handleActivateServiceDefinition.js.map +1 -0
- package/dist/handlers/system/readonly/handleRuntimeGetDumpById.d.ts +4 -14
- package/dist/handlers/system/readonly/handleRuntimeGetDumpById.d.ts.map +1 -1
- package/dist/handlers/system/readonly/handleRuntimeGetDumpById.js +5 -79
- package/dist/handlers/system/readonly/handleRuntimeGetDumpById.js.map +1 -1
- package/dist/lib/handlers/groups/HighLevelHandlersGroup.d.ts.map +1 -1
- package/dist/lib/handlers/groups/HighLevelHandlersGroup.js +18 -0
- package/dist/lib/handlers/groups/HighLevelHandlersGroup.js.map +1 -1
- package/dist/lib/handlers/groups/LowLevelHandlersGroup.d.ts.map +1 -1
- package/dist/lib/handlers/groups/LowLevelHandlersGroup.js +16 -0
- package/dist/lib/handlers/groups/LowLevelHandlersGroup.js.map +1 -1
- package/dist/lib/handlers/groups/SystemHandlersGroup.d.ts.map +1 -1
- package/dist/lib/handlers/groups/SystemHandlersGroup.js +0 -5
- package/dist/lib/handlers/groups/SystemHandlersGroup.js.map +1 -1
- package/docs/user-guide/AVAILABLE_TOOLS.md +0 -18
- package/docs/user-guide/AVAILABLE_TOOLS_READONLY.md +0 -18
- package/package.json +3 -3
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ActivateServiceBinding Handler - Activate ABAP Service Binding
|
|
3
|
+
*
|
|
4
|
+
* Uses AdtClient.getServiceBinding().activate() from @mcp-abap-adt/adt-clients.
|
|
5
|
+
* Low-level handler: single method call.
|
|
6
|
+
*/
|
|
7
|
+
import type { HandlerContext } from '../../../lib/handlers/interfaces';
|
|
8
|
+
export declare const TOOL_DEFINITION: {
|
|
9
|
+
readonly name: "ActivateServiceBindingLow";
|
|
10
|
+
readonly available_in: readonly ["onprem", "cloud"];
|
|
11
|
+
readonly description: "[low-level] Activate an ABAP service binding. Returns activation status and any warnings/errors. Can use session_id and session_state from GetSession to maintain the same session.";
|
|
12
|
+
readonly inputSchema: {
|
|
13
|
+
readonly type: "object";
|
|
14
|
+
readonly properties: {
|
|
15
|
+
readonly name: {
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
readonly description: "Service binding name (e.g., ZSB_MY_SERVICE).";
|
|
18
|
+
};
|
|
19
|
+
readonly session_id: {
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
readonly description: "Session ID from GetSession. If not provided, a new session will be created.";
|
|
22
|
+
};
|
|
23
|
+
readonly session_state: {
|
|
24
|
+
readonly type: "object";
|
|
25
|
+
readonly description: "Session state from GetSession (cookies, csrf_token, cookie_store). Required if session_id is provided.";
|
|
26
|
+
readonly properties: {
|
|
27
|
+
readonly cookies: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
};
|
|
30
|
+
readonly csrf_token: {
|
|
31
|
+
readonly type: "string";
|
|
32
|
+
};
|
|
33
|
+
readonly cookie_store: {
|
|
34
|
+
readonly type: "object";
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
readonly required: readonly ["name"];
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
interface ActivateServiceBindingArgs {
|
|
43
|
+
name: string;
|
|
44
|
+
session_id?: string;
|
|
45
|
+
session_state?: {
|
|
46
|
+
cookies?: string;
|
|
47
|
+
csrf_token?: string;
|
|
48
|
+
cookie_store?: Record<string, string>;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Main handler for ActivateServiceBinding MCP tool
|
|
53
|
+
*
|
|
54
|
+
* Uses AdtClient.getServiceBinding().activate() - low-level single method call
|
|
55
|
+
*/
|
|
56
|
+
export declare function handleActivateServiceBinding(context: HandlerContext, args: ActivateServiceBindingArgs): Promise<{
|
|
57
|
+
isError: boolean;
|
|
58
|
+
content: {
|
|
59
|
+
type: string;
|
|
60
|
+
text: any;
|
|
61
|
+
}[];
|
|
62
|
+
}>;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=handleActivateServiceBinding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleActivateServiceBinding.d.ts","sourceRoot":"","sources":["../../../../src/handlers/service_binding/low/handleActivateServiceBinding.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AASvE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BlB,CAAC;AAEX,UAAU,0BAA0B;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACvC,CAAC;CACH;AAED;;;;GAIG;AACH,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,0BAA0B;;;;;;GA4GjC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ActivateServiceBinding Handler - Activate ABAP Service Binding
|
|
4
|
+
*
|
|
5
|
+
* Uses AdtClient.getServiceBinding().activate() from @mcp-abap-adt/adt-clients.
|
|
6
|
+
* Low-level handler: single method call.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.TOOL_DEFINITION = void 0;
|
|
10
|
+
exports.handleActivateServiceBinding = handleActivateServiceBinding;
|
|
11
|
+
const clients_1 = require("../../../lib/clients");
|
|
12
|
+
const utils_1 = require("../../../lib/utils");
|
|
13
|
+
exports.TOOL_DEFINITION = {
|
|
14
|
+
name: 'ActivateServiceBindingLow',
|
|
15
|
+
available_in: ['onprem', 'cloud'],
|
|
16
|
+
description: '[low-level] Activate an ABAP service binding. Returns activation status and any warnings/errors. Can use session_id and session_state from GetSession to maintain the same session.',
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
name: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'Service binding name (e.g., ZSB_MY_SERVICE).',
|
|
23
|
+
},
|
|
24
|
+
session_id: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
description: 'Session ID from GetSession. If not provided, a new session will be created.',
|
|
27
|
+
},
|
|
28
|
+
session_state: {
|
|
29
|
+
type: 'object',
|
|
30
|
+
description: 'Session state from GetSession (cookies, csrf_token, cookie_store). Required if session_id is provided.',
|
|
31
|
+
properties: {
|
|
32
|
+
cookies: { type: 'string' },
|
|
33
|
+
csrf_token: { type: 'string' },
|
|
34
|
+
cookie_store: { type: 'object' },
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
required: ['name'],
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Main handler for ActivateServiceBinding MCP tool
|
|
43
|
+
*
|
|
44
|
+
* Uses AdtClient.getServiceBinding().activate() - low-level single method call
|
|
45
|
+
*/
|
|
46
|
+
async function handleActivateServiceBinding(context, args) {
|
|
47
|
+
const { connection, logger } = context;
|
|
48
|
+
try {
|
|
49
|
+
const { name, session_id, session_state } = args;
|
|
50
|
+
// Validation
|
|
51
|
+
if (!name) {
|
|
52
|
+
return (0, utils_1.return_error)(new Error('name is required'));
|
|
53
|
+
}
|
|
54
|
+
const client = (0, clients_1.createAdtClient)(connection, logger);
|
|
55
|
+
// Restore session state if provided
|
|
56
|
+
if (session_id && session_state) {
|
|
57
|
+
await (0, utils_1.restoreSessionInConnection)(connection, session_id, session_state);
|
|
58
|
+
}
|
|
59
|
+
const serviceBindingName = name.toUpperCase();
|
|
60
|
+
logger?.info(`Starting service binding activation: ${serviceBindingName}`);
|
|
61
|
+
try {
|
|
62
|
+
// Activate service binding
|
|
63
|
+
const activateState = await client
|
|
64
|
+
.getServiceBinding()
|
|
65
|
+
.activate({ bindingName: serviceBindingName });
|
|
66
|
+
const response = activateState.activateResult;
|
|
67
|
+
if (!response) {
|
|
68
|
+
throw new Error(`Activation did not return a response for service binding ${serviceBindingName}`);
|
|
69
|
+
}
|
|
70
|
+
// Parse activation response
|
|
71
|
+
const activationResult = (0, utils_1.parseActivationResponse)(response.data);
|
|
72
|
+
const success = activationResult.activated && activationResult.checked;
|
|
73
|
+
logger?.info(`ActivateServiceBinding completed: ${serviceBindingName}`);
|
|
74
|
+
logger?.debug(`Activated: ${activationResult.activated}, Checked: ${activationResult.checked}, Messages: ${activationResult.messages.length}`);
|
|
75
|
+
return (0, utils_1.return_response)({
|
|
76
|
+
data: JSON.stringify({
|
|
77
|
+
success,
|
|
78
|
+
name: serviceBindingName,
|
|
79
|
+
activation: {
|
|
80
|
+
activated: activationResult.activated,
|
|
81
|
+
checked: activationResult.checked,
|
|
82
|
+
generated: activationResult.generated,
|
|
83
|
+
},
|
|
84
|
+
messages: activationResult.messages,
|
|
85
|
+
warnings: activationResult.messages.filter((m) => m.type === 'warning' || m.type === 'W'),
|
|
86
|
+
errors: activationResult.messages.filter((m) => m.type === 'error' || m.type === 'E'),
|
|
87
|
+
session_id: session_id || null,
|
|
88
|
+
session_state: null,
|
|
89
|
+
message: success
|
|
90
|
+
? `Service binding ${serviceBindingName} activated successfully`
|
|
91
|
+
: `Service binding ${serviceBindingName} activation completed with ${activationResult.messages.length} message(s)`,
|
|
92
|
+
}, null, 2),
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
logger?.error(`Error activating service binding ${serviceBindingName}: ${error?.message || error}`);
|
|
97
|
+
let errorMessage = `Failed to activate service binding: ${error.message || String(error)}`;
|
|
98
|
+
if (error.response?.status === 404) {
|
|
99
|
+
errorMessage = `Service binding ${serviceBindingName} not found.`;
|
|
100
|
+
}
|
|
101
|
+
else if (error.response?.data &&
|
|
102
|
+
typeof error.response.data === 'string') {
|
|
103
|
+
try {
|
|
104
|
+
const { XMLParser } = require('fast-xml-parser');
|
|
105
|
+
const parser = new XMLParser({
|
|
106
|
+
ignoreAttributes: false,
|
|
107
|
+
attributeNamePrefix: '@_',
|
|
108
|
+
});
|
|
109
|
+
const errorData = parser.parse(error.response.data);
|
|
110
|
+
const errorMsg = errorData['exc:exception']?.message?.['#text'] ||
|
|
111
|
+
errorData['exc:exception']?.message;
|
|
112
|
+
if (errorMsg) {
|
|
113
|
+
errorMessage = `SAP Error: ${errorMsg}`;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch (_parseError) {
|
|
117
|
+
// Ignore parse errors
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return (0, utils_1.return_error)(new Error(errorMessage));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
return (0, utils_1.return_error)(error);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=handleActivateServiceBinding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleActivateServiceBinding.js","sourceRoot":"","sources":["../../../../src/handlers/service_binding/low/handleActivateServiceBinding.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA2DH,oEA8GC;AAvKD,kDAAuD;AAEvD,8CAM4B;AAEf,QAAA,eAAe,GAAG;IAC7B,IAAI,EAAE,2BAA2B;IACjC,YAAY,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAU;IAC1C,WAAW,EACT,qLAAqL;IACvL,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,8CAA8C;aAC5D;YACD,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,6EAA6E;aACh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AAY,EAAC,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,IAAA,oBAAY,EAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ActivateServiceDefinition Handler - Activate ABAP Service Definition
|
|
3
|
+
*
|
|
4
|
+
* Uses AdtClient.getServiceDefinition().activate() from @mcp-abap-adt/adt-clients.
|
|
5
|
+
* Low-level handler: single method call.
|
|
6
|
+
*/
|
|
7
|
+
import type { HandlerContext } from '../../../lib/handlers/interfaces';
|
|
8
|
+
export declare const TOOL_DEFINITION: {
|
|
9
|
+
readonly name: "ActivateServiceDefinitionLow";
|
|
10
|
+
readonly available_in: readonly ["onprem", "cloud"];
|
|
11
|
+
readonly description: "[low-level] Activate an ABAP service definition. Returns activation status and any warnings/errors. Can use session_id and session_state from GetSession to maintain the same session.";
|
|
12
|
+
readonly inputSchema: {
|
|
13
|
+
readonly type: "object";
|
|
14
|
+
readonly properties: {
|
|
15
|
+
readonly name: {
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
readonly description: "Service definition name (e.g., ZSD_MY_SERVICE).";
|
|
18
|
+
};
|
|
19
|
+
readonly session_id: {
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
readonly description: "Session ID from GetSession. If not provided, a new session will be created.";
|
|
22
|
+
};
|
|
23
|
+
readonly session_state: {
|
|
24
|
+
readonly type: "object";
|
|
25
|
+
readonly description: "Session state from GetSession (cookies, csrf_token, cookie_store). Required if session_id is provided.";
|
|
26
|
+
readonly properties: {
|
|
27
|
+
readonly cookies: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
};
|
|
30
|
+
readonly csrf_token: {
|
|
31
|
+
readonly type: "string";
|
|
32
|
+
};
|
|
33
|
+
readonly cookie_store: {
|
|
34
|
+
readonly type: "object";
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
readonly required: readonly ["name"];
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
interface ActivateServiceDefinitionArgs {
|
|
43
|
+
name: string;
|
|
44
|
+
session_id?: string;
|
|
45
|
+
session_state?: {
|
|
46
|
+
cookies?: string;
|
|
47
|
+
csrf_token?: string;
|
|
48
|
+
cookie_store?: Record<string, string>;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Main handler for ActivateServiceDefinition MCP tool
|
|
53
|
+
*
|
|
54
|
+
* Uses AdtClient.getServiceDefinition().activate() - low-level single method call
|
|
55
|
+
*/
|
|
56
|
+
export declare function handleActivateServiceDefinition(context: HandlerContext, args: ActivateServiceDefinitionArgs): Promise<{
|
|
57
|
+
isError: boolean;
|
|
58
|
+
content: {
|
|
59
|
+
type: string;
|
|
60
|
+
text: any;
|
|
61
|
+
}[];
|
|
62
|
+
}>;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=handleActivateServiceDefinition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleActivateServiceDefinition.d.ts","sourceRoot":"","sources":["../../../../src/handlers/service_definition/low/handleActivateServiceDefinition.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AASvE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BlB,CAAC;AAEX,UAAU,6BAA6B;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACvC,CAAC;CACH;AAED;;;;GAIG;AACH,wBAAsB,+BAA+B,CACnD,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,6BAA6B;;;;;;GAgHpC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ActivateServiceDefinition Handler - Activate ABAP Service Definition
|
|
4
|
+
*
|
|
5
|
+
* Uses AdtClient.getServiceDefinition().activate() from @mcp-abap-adt/adt-clients.
|
|
6
|
+
* Low-level handler: single method call.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.TOOL_DEFINITION = void 0;
|
|
10
|
+
exports.handleActivateServiceDefinition = handleActivateServiceDefinition;
|
|
11
|
+
const clients_1 = require("../../../lib/clients");
|
|
12
|
+
const utils_1 = require("../../../lib/utils");
|
|
13
|
+
exports.TOOL_DEFINITION = {
|
|
14
|
+
name: 'ActivateServiceDefinitionLow',
|
|
15
|
+
available_in: ['onprem', 'cloud'],
|
|
16
|
+
description: '[low-level] Activate an ABAP service definition. Returns activation status and any warnings/errors. Can use session_id and session_state from GetSession to maintain the same session.',
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
name: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'Service definition name (e.g., ZSD_MY_SERVICE).',
|
|
23
|
+
},
|
|
24
|
+
session_id: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
description: 'Session ID from GetSession. If not provided, a new session will be created.',
|
|
27
|
+
},
|
|
28
|
+
session_state: {
|
|
29
|
+
type: 'object',
|
|
30
|
+
description: 'Session state from GetSession (cookies, csrf_token, cookie_store). Required if session_id is provided.',
|
|
31
|
+
properties: {
|
|
32
|
+
cookies: { type: 'string' },
|
|
33
|
+
csrf_token: { type: 'string' },
|
|
34
|
+
cookie_store: { type: 'object' },
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
required: ['name'],
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Main handler for ActivateServiceDefinition MCP tool
|
|
43
|
+
*
|
|
44
|
+
* Uses AdtClient.getServiceDefinition().activate() - low-level single method call
|
|
45
|
+
*/
|
|
46
|
+
async function handleActivateServiceDefinition(context, args) {
|
|
47
|
+
const { connection, logger } = context;
|
|
48
|
+
try {
|
|
49
|
+
const { name, session_id, session_state } = args;
|
|
50
|
+
// Validation
|
|
51
|
+
if (!name) {
|
|
52
|
+
return (0, utils_1.return_error)(new Error('name is required'));
|
|
53
|
+
}
|
|
54
|
+
const client = (0, clients_1.createAdtClient)(connection, logger);
|
|
55
|
+
// Restore session state if provided
|
|
56
|
+
if (session_id && session_state) {
|
|
57
|
+
await (0, utils_1.restoreSessionInConnection)(connection, session_id, session_state);
|
|
58
|
+
}
|
|
59
|
+
const serviceDefinitionName = name.toUpperCase();
|
|
60
|
+
logger?.info(`Starting service definition activation: ${serviceDefinitionName}`);
|
|
61
|
+
try {
|
|
62
|
+
// Activate service definition
|
|
63
|
+
const activateState = await client
|
|
64
|
+
.getServiceDefinition()
|
|
65
|
+
.activate({ serviceDefinitionName });
|
|
66
|
+
const response = activateState.activateResult;
|
|
67
|
+
if (!response) {
|
|
68
|
+
throw new Error(`Activation did not return a response for service definition ${serviceDefinitionName}`);
|
|
69
|
+
}
|
|
70
|
+
// Parse activation response
|
|
71
|
+
const activationResult = (0, utils_1.parseActivationResponse)(response.data);
|
|
72
|
+
const success = activationResult.activated && activationResult.checked;
|
|
73
|
+
logger?.info(`ActivateServiceDefinition completed: ${serviceDefinitionName}`);
|
|
74
|
+
logger?.debug(`Activated: ${activationResult.activated}, Checked: ${activationResult.checked}, Messages: ${activationResult.messages.length}`);
|
|
75
|
+
return (0, utils_1.return_response)({
|
|
76
|
+
data: JSON.stringify({
|
|
77
|
+
success,
|
|
78
|
+
name: serviceDefinitionName,
|
|
79
|
+
activation: {
|
|
80
|
+
activated: activationResult.activated,
|
|
81
|
+
checked: activationResult.checked,
|
|
82
|
+
generated: activationResult.generated,
|
|
83
|
+
},
|
|
84
|
+
messages: activationResult.messages,
|
|
85
|
+
warnings: activationResult.messages.filter((m) => m.type === 'warning' || m.type === 'W'),
|
|
86
|
+
errors: activationResult.messages.filter((m) => m.type === 'error' || m.type === 'E'),
|
|
87
|
+
session_id: session_id || null,
|
|
88
|
+
session_state: null,
|
|
89
|
+
message: success
|
|
90
|
+
? `Service definition ${serviceDefinitionName} activated successfully`
|
|
91
|
+
: `Service definition ${serviceDefinitionName} activation completed with ${activationResult.messages.length} message(s)`,
|
|
92
|
+
}, null, 2),
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
logger?.error(`Error activating service definition ${serviceDefinitionName}: ${error?.message || error}`);
|
|
97
|
+
let errorMessage = `Failed to activate service definition: ${error.message || String(error)}`;
|
|
98
|
+
if (error.response?.status === 404) {
|
|
99
|
+
errorMessage = `Service definition ${serviceDefinitionName} not found.`;
|
|
100
|
+
}
|
|
101
|
+
else if (error.response?.data &&
|
|
102
|
+
typeof error.response.data === 'string') {
|
|
103
|
+
try {
|
|
104
|
+
const { XMLParser } = require('fast-xml-parser');
|
|
105
|
+
const parser = new XMLParser({
|
|
106
|
+
ignoreAttributes: false,
|
|
107
|
+
attributeNamePrefix: '@_',
|
|
108
|
+
});
|
|
109
|
+
const errorData = parser.parse(error.response.data);
|
|
110
|
+
const errorMsg = errorData['exc:exception']?.message?.['#text'] ||
|
|
111
|
+
errorData['exc:exception']?.message;
|
|
112
|
+
if (errorMsg) {
|
|
113
|
+
errorMessage = `SAP Error: ${errorMsg}`;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch (_parseError) {
|
|
117
|
+
// Ignore parse errors
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return (0, utils_1.return_error)(new Error(errorMessage));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
return (0, utils_1.return_error)(error);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=handleActivateServiceDefinition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleActivateServiceDefinition.js","sourceRoot":"","sources":["../../../../src/handlers/service_definition/low/handleActivateServiceDefinition.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA2DH,0EAkHC;AA3KD,kDAAuD;AAEvD,8CAM4B;AAEf,QAAA,eAAe,GAAG;IAC7B,IAAI,EAAE,8BAA8B;IACpC,YAAY,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAU;IAC1C,WAAW,EACT,wLAAwL;IAC1L,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iDAAiD;aAC/D;YACD,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,6EAA6E;aAChF;YACD,aAAa,EAAE;gBACb,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,wGAAwG;gBAC1G,UAAU,EAAE;oBACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC3B,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC9B,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;iBACjC;aACF;SACF;QACD,QAAQ,EAAE,CAAC,MAAM,CAAC;KACnB;CACO,CAAC;AAYX;;;;GAIG;AACI,KAAK,UAAU,+BAA+B,CACnD,OAAuB,EACvB,IAAmC;IAEnC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACvC,IAAI,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,GACvC,IAAqC,CAAC;QAExC,aAAa;QACb,IAAI,CAAC,IAAI,EAAE,C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AAQ,EACvC,CAAC;gBACD,IAAI,CAAC;oBACH,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;oBACjD,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;wBAC3B,gBAAgB,EAAE,KAAK;wBACvB,mBAAmB,EAAE,IAAI;qBAC1B,CAAC,CAAC;oBACH,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;oBACpD,MAAM,QAAQ,GACZ,SAAS,CAAC,eAAe,CAAC,EAAE,OAAO,EAAE,CAAC,OAAO,CAAC;wBAC9C,SAAS,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;oBACtC,IAAI,QAAQ,EAAE,CAAC;wBACb,YAAY,GAAG,cAAc,QAAQ,EAAE,CAAC;oBAC1C,CAAC;gBACH,CAAC;gBAAC,OAAO,WAAW,EAAE,CAAC;oBACrB,sBAAsB;gBACxB,CAAC;YACH,CAAC;YAED,OAAO,IAAA,oBAAY,EAAC,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,IAAA,oBAAY,EAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
|
|
@@ -2,21 +2,13 @@ import type { HandlerContext } from '../../../lib/handlers/interfaces';
|
|
|
2
2
|
export declare const TOOL_DEFINITION: {
|
|
3
3
|
readonly name: "RuntimeGetDumpById";
|
|
4
4
|
readonly available_in: readonly ["onprem", "cloud"];
|
|
5
|
-
readonly description: "[runtime] Read a specific ABAP runtime dump
|
|
5
|
+
readonly description: "[runtime] Read a specific ABAP runtime dump by its ID. First use RuntimeListFeeds to find dumps and get their IDs, then pass dump_id here to read the full dump content.";
|
|
6
6
|
readonly inputSchema: {
|
|
7
7
|
readonly type: "object";
|
|
8
8
|
readonly properties: {
|
|
9
|
-
readonly datetime: {
|
|
10
|
-
readonly type: "string";
|
|
11
|
-
readonly description: "Dump datetime (ISO or \"YYYY-MM-DD HH:MM:SS\"). Combined with user, uniquely identifies the dump. Preferred over dump_id.";
|
|
12
|
-
};
|
|
13
|
-
readonly user: {
|
|
14
|
-
readonly type: "string";
|
|
15
|
-
readonly description: "SAP username whose dump to read. Required when using datetime lookup.";
|
|
16
|
-
};
|
|
17
9
|
readonly dump_id: {
|
|
18
10
|
readonly type: "string";
|
|
19
|
-
readonly description: "Full runtime dump ID.
|
|
11
|
+
readonly description: "Full runtime dump ID (e.g. from RuntimeListFeeds).";
|
|
20
12
|
};
|
|
21
13
|
readonly view: {
|
|
22
14
|
readonly type: "string";
|
|
@@ -31,13 +23,11 @@ export declare const TOOL_DEFINITION: {
|
|
|
31
23
|
readonly default: "both";
|
|
32
24
|
};
|
|
33
25
|
};
|
|
34
|
-
readonly required: readonly [];
|
|
26
|
+
readonly required: readonly ["dump_id"];
|
|
35
27
|
};
|
|
36
28
|
};
|
|
37
29
|
interface RuntimeGetDumpByIdArgs {
|
|
38
|
-
dump_id
|
|
39
|
-
datetime?: string;
|
|
40
|
-
user?: string;
|
|
30
|
+
dump_id: string;
|
|
41
31
|
view?: 'default' | 'summary' | 'formatted';
|
|
42
32
|
response_mode?: 'payload' | 'summary' | 'both';
|
|
43
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleRuntimeGetDumpById.d.ts","sourceRoot":"","sources":["../../../../src/handlers/system/readonly/handleRuntimeGetDumpById.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"handleRuntimeGetDumpById.d.ts","sourceRoot":"","sources":["../../../../src/handlers/system/readonly/handleRuntimeGetDumpById.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAIvE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BlB,CAAC;AAEX,UAAU,sBAAsB;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;IAC3C,aAAa,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;CAChD;AA6DD,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,sBAAsB;;;;;;GA+C7B"}
|
|
@@ -4,26 +4,17 @@ exports.TOOL_DEFINITION = void 0;
|
|
|
4
4
|
exports.handleRuntimeGetDumpById = handleRuntimeGetDumpById;
|
|
5
5
|
const adt_clients_1 = require("@mcp-abap-adt/adt-clients");
|
|
6
6
|
const utils_1 = require("../../../lib/utils");
|
|
7
|
-
const handleRuntimeListDumps_1 = require("./handleRuntimeListDumps");
|
|
8
7
|
const runtimePayloadParser_1 = require("./runtimePayloadParser");
|
|
9
8
|
exports.TOOL_DEFINITION = {
|
|
10
9
|
name: 'RuntimeGetDumpById',
|
|
11
10
|
available_in: ['onprem', 'cloud'],
|
|
12
|
-
description: '[runtime] Read a specific ABAP runtime dump
|
|
11
|
+
description: '[runtime] Read a specific ABAP runtime dump by its ID. First use RuntimeListFeeds to find dumps and get their IDs, then pass dump_id here to read the full dump content.',
|
|
13
12
|
inputSchema: {
|
|
14
13
|
type: 'object',
|
|
15
14
|
properties: {
|
|
16
|
-
datetime: {
|
|
17
|
-
type: 'string',
|
|
18
|
-
description: 'Dump datetime (ISO or "YYYY-MM-DD HH:MM:SS"). Combined with user, uniquely identifies the dump. Preferred over dump_id.',
|
|
19
|
-
},
|
|
20
|
-
user: {
|
|
21
|
-
type: 'string',
|
|
22
|
-
description: 'SAP username whose dump to read. Required when using datetime lookup.',
|
|
23
|
-
},
|
|
24
15
|
dump_id: {
|
|
25
16
|
type: 'string',
|
|
26
|
-
description: 'Full runtime dump ID.
|
|
17
|
+
description: 'Full runtime dump ID (e.g. from RuntimeListFeeds).',
|
|
27
18
|
},
|
|
28
19
|
view: {
|
|
29
20
|
type: 'string',
|
|
@@ -38,37 +29,9 @@ exports.TOOL_DEFINITION = {
|
|
|
38
29
|
default: 'both',
|
|
39
30
|
},
|
|
40
31
|
},
|
|
41
|
-
required: [],
|
|
32
|
+
required: ['dump_id'],
|
|
42
33
|
},
|
|
43
34
|
};
|
|
44
|
-
function parseDatetimeToMs(raw) {
|
|
45
|
-
const trimmed = raw.trim();
|
|
46
|
-
// "2026-03-31 18:53:47" — space-separated, treat as UTC
|
|
47
|
-
const spaceForm = trimmed.match(/^(\d{4}-\d{2}-\d{2})\s+(\d{2}:\d{2}:\d{2})$/);
|
|
48
|
-
if (spaceForm) {
|
|
49
|
-
return Date.parse(`${spaceForm[1]}T${spaceForm[2]}Z`);
|
|
50
|
-
}
|
|
51
|
-
// ISO with or without Z/offset — let Date handle it
|
|
52
|
-
const ms = Date.parse(trimmed);
|
|
53
|
-
if (!isNaN(ms))
|
|
54
|
-
return ms;
|
|
55
|
-
throw new Error(`Cannot parse datetime: "${raw}"`);
|
|
56
|
-
}
|
|
57
|
-
function datetimeToSapLocal(raw) {
|
|
58
|
-
// Convert UTC datetime to YYYYMMDDHHMMSS (best-effort, no TZ conversion —
|
|
59
|
-
// caller should pass system-local time if known, or we use UTC as fallback)
|
|
60
|
-
const ms = parseDatetimeToMs(raw);
|
|
61
|
-
if (isNaN(ms))
|
|
62
|
-
return undefined;
|
|
63
|
-
const d = new Date(ms);
|
|
64
|
-
const pad = (n) => String(n).padStart(2, '0');
|
|
65
|
-
return (d.getUTCFullYear().toString() +
|
|
66
|
-
pad(d.getUTCMonth() + 1) +
|
|
67
|
-
pad(d.getUTCDate()) +
|
|
68
|
-
pad(d.getUTCHours()) +
|
|
69
|
-
pad(d.getUTCMinutes()) +
|
|
70
|
-
pad(d.getUTCSeconds()));
|
|
71
|
-
}
|
|
72
35
|
function collectKeyFacts(value, target, depth = 0) {
|
|
73
36
|
if (!value || depth > 8 || Object.keys(target).length >= 20) {
|
|
74
37
|
return;
|
|
@@ -113,49 +76,12 @@ function collectKeyFacts(value, target, depth = 0) {
|
|
|
113
76
|
collectKeyFacts(nested, target, depth + 1);
|
|
114
77
|
}
|
|
115
78
|
}
|
|
116
|
-
async function resolveDumpId(context, datetime, user) {
|
|
117
|
-
const targetMs = parseDatetimeToMs(datetime);
|
|
118
|
-
// Build from/to window (±2 min) in YYYYMMDDHHMMSS for server-side filtering
|
|
119
|
-
const fromMs = targetMs - 2 * 60_000;
|
|
120
|
-
const toMs = targetMs + 2 * 60_000;
|
|
121
|
-
const fromSap = datetimeToSapLocal(new Date(fromMs).toISOString());
|
|
122
|
-
const toSap = datetimeToSapLocal(new Date(toMs).toISOString());
|
|
123
|
-
const listResult = await (0, handleRuntimeListDumps_1.handleRuntimeListDumps)(context, {
|
|
124
|
-
user,
|
|
125
|
-
from: fromSap,
|
|
126
|
-
to: toSap,
|
|
127
|
-
top: 20,
|
|
128
|
-
});
|
|
129
|
-
if (listResult.isError) {
|
|
130
|
-
const msg = listResult.content[0]?.text ?? 'unknown error';
|
|
131
|
-
throw new Error(`Failed to list dumps for user "${user}": ${msg}`);
|
|
132
|
-
}
|
|
133
|
-
const text = listResult.content.find((c) => c.type === 'text')?.text;
|
|
134
|
-
const data = JSON.parse(text);
|
|
135
|
-
const dumps = data.dumps ?? [];
|
|
136
|
-
// Find closest match within ±60 seconds
|
|
137
|
-
let best;
|
|
138
|
-
for (const d of dumps) {
|
|
139
|
-
const dMs = parseDatetimeToMs(d.datetime);
|
|
140
|
-
const diff = Math.abs(dMs - targetMs);
|
|
141
|
-
if (diff <= 60_000 && (!best || diff < best.diff)) {
|
|
142
|
-
best = { dump_id: d.dump_id, diff };
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
if (!best) {
|
|
146
|
-
throw new Error(`No dump found for user="${user}" near datetime="${datetime}" (±60s). Available: ${dumps.map((d) => d.datetime).join(', ')}`);
|
|
147
|
-
}
|
|
148
|
-
return best.dump_id;
|
|
149
|
-
}
|
|
150
79
|
async function handleRuntimeGetDumpById(context, args) {
|
|
151
80
|
const { connection, logger } = context;
|
|
152
81
|
try {
|
|
153
|
-
|
|
82
|
+
const dumpId = args?.dump_id?.trim();
|
|
154
83
|
if (!dumpId) {
|
|
155
|
-
|
|
156
|
-
throw new Error('Provide either "dump_id" or both "datetime" and "user"');
|
|
157
|
-
}
|
|
158
|
-
dumpId = await resolveDumpId(context, args.datetime, args.user);
|
|
84
|
+
throw new Error('dump_id is required. Use RuntimeListFeeds to find dump IDs first.');
|
|
159
85
|
}
|
|
160
86
|
const view = args.view ?? 'default';
|
|
161
87
|
const responseMode = args.response_mode ?? 'both';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleRuntimeGetDumpById.js","sourceRoot":"","sources":["../../../../src/handlers/system/readonly/handleRuntimeGetDumpById.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"handleRuntimeGetDumpById.js","sourceRoot":"","sources":["../../../../src/handlers/system/readonly/handleRuntimeGetDumpById.ts"],"names":[],"mappings":";;;AAqGA,4DAiDC;AAtJD,2DAA6D;AAE7D,8CAAmE;AACnE,iEAAmE;AAEtD,QAAA,eAAe,GAAG;IAC7B,IAAI,EAAE,oBAAoB;IAC1B,YAAY,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAU;IAC1C,WAAW,EACT,0KAA0K;IAC5K,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,oDAAoD;aAClE;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC;gBACzC,WAAW,EACT,2EAA2E;gBAC7E,OAAO,EAAE,SAAS;aACnB;YACD,aAAa,EAAE;gBACb,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,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O,CAAC,CAAC;YACxC,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;QAC3B,CAAC;QAED,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,KAAK,MAAM,EAAE,CAAC;YAC1D,MAAM,CAAC,OAAO,GAAG,aAAa,CAAC;QACjC,CAAC;QAED,OAAO,IAAA,uBAAe,EAAC;YACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;YACrC,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,MAAM,EAAE,QAAQ,CAAC,MAAM;SACxB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,EAAE,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;QAC1D,OAAO,IAAA,oBAAY,EAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HighLevelHandlersGroup.d.ts","sourceRoot":"","sources":["../../../../src/lib/handlers/groups/HighLevelHandlersGroup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HighLevelHandlersGroup.d.ts","sourceRoot":"","sources":["../../../../src/lib/handlers/groups/HighLevelHandlersGroup.ts"],"names":[],"mappings":"AA2dA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,gBAAgB;IAC1D,SAAS,CAAC,SAAS,SAAuB;IAE1C;;OAEG;IACH,WAAW,IAAI,YAAY,EAAE;CA2iB9B"}
|
|
@@ -84,10 +84,12 @@ const handleGetServiceBinding_1 = require("../../../handlers/service_binding/hig
|
|
|
84
84
|
const handleListServiceBindingTypes_1 = require("../../../handlers/service_binding/high/handleListServiceBindingTypes");
|
|
85
85
|
const handleUpdateServiceBinding_1 = require("../../../handlers/service_binding/high/handleUpdateServiceBinding");
|
|
86
86
|
const handleValidateServiceBinding_1 = require("../../../handlers/service_binding/high/handleValidateServiceBinding");
|
|
87
|
+
const handleActivateServiceBinding_1 = require("../../../handlers/service_binding/low/handleActivateServiceBinding");
|
|
87
88
|
const handleCreateServiceDefinition_1 = require("../../../handlers/service_definition/high/handleCreateServiceDefinition");
|
|
88
89
|
const handleDeleteServiceDefinition_1 = require("../../../handlers/service_definition/high/handleDeleteServiceDefinition");
|
|
89
90
|
const handleGetServiceDefinition_1 = require("../../../handlers/service_definition/high/handleGetServiceDefinition");
|
|
90
91
|
const handleUpdateServiceDefinition_1 = require("../../../handlers/service_definition/high/handleUpdateServiceDefinition");
|
|
92
|
+
const handleActivateServiceDefinition_1 = require("../../../handlers/service_definition/low/handleActivateServiceDefinition");
|
|
91
93
|
const handleCheckStructure_1 = require("../../../handlers/structure/high/handleCheckStructure");
|
|
92
94
|
const handleCreateStructure_1 = require("../../../handlers/structure/high/handleCreateStructure");
|
|
93
95
|
const handleDeleteStructure_1 = require("../../../handlers/structure/high/handleDeleteStructure");
|
|
@@ -237,6 +239,22 @@ class HighLevelHandlersGroup extends BaseHandlerGroup_js_1.BaseHandlerGroup {
|
|
|
237
239
|
},
|
|
238
240
|
handler: withContext(handleActivateMetadataExtension_1.handleActivateMetadataExtension),
|
|
239
241
|
},
|
|
242
|
+
{
|
|
243
|
+
toolDefinition: {
|
|
244
|
+
...handleActivateServiceDefinition_1.TOOL_DEFINITION,
|
|
245
|
+
name: 'ActivateServiceDefinition',
|
|
246
|
+
description: 'Activate an ABAP service definition. Use after CreateServiceDefinition or UpdateServiceDefinition if the object remains inactive.',
|
|
247
|
+
},
|
|
248
|
+
handler: withContext(handleActivateServiceDefinition_1.handleActivateServiceDefinition),
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
toolDefinition: {
|
|
252
|
+
...handleActivateServiceBinding_1.TOOL_DEFINITION,
|
|
253
|
+
name: 'ActivateServiceBinding',
|
|
254
|
+
description: 'Activate an ABAP service binding. Use after CreateServiceBinding or UpdateServiceBinding if the object remains inactive.',
|
|
255
|
+
},
|
|
256
|
+
handler: withContext(handleActivateServiceBinding_1.handleActivateServiceBinding),
|
|
257
|
+
},
|
|
240
258
|
{
|
|
241
259
|
toolDefinition: handleCreatePackage_1.TOOL_DEFINITION,
|
|
242
260
|
handler: withContext(handleCreatePackage_1.handleCreatePackage),
|