@mcp-abap-adt/core 7.0.3 → 7.1.1
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 +19 -0
- package/dist/handlers/function_include/high/handleCreateFunctionInclude.d.ts +52 -0
- package/dist/handlers/function_include/high/handleCreateFunctionInclude.d.ts.map +1 -0
- package/dist/handlers/function_include/high/handleCreateFunctionInclude.js +99 -0
- package/dist/handlers/function_include/high/handleCreateFunctionInclude.js.map +1 -0
- package/dist/handlers/function_include/high/handleDeleteFunctionInclude.d.ts +48 -0
- package/dist/handlers/function_include/high/handleDeleteFunctionInclude.d.ts.map +1 -0
- package/dist/handlers/function_include/high/handleDeleteFunctionInclude.js +110 -0
- package/dist/handlers/function_include/high/handleDeleteFunctionInclude.js.map +1 -0
- package/dist/handlers/function_include/high/handleUpdateFunctionInclude.d.ts +52 -0
- package/dist/handlers/function_include/high/handleUpdateFunctionInclude.d.ts.map +1 -0
- package/dist/handlers/function_include/high/handleUpdateFunctionInclude.js +131 -0
- package/dist/handlers/function_include/high/handleUpdateFunctionInclude.js.map +1 -0
- package/dist/handlers/function_include/readonly/handleListFunctionGroupIncludes.d.ts +26 -0
- package/dist/handlers/function_include/readonly/handleListFunctionGroupIncludes.d.ts.map +1 -0
- package/dist/handlers/function_include/readonly/handleListFunctionGroupIncludes.js +46 -0
- package/dist/handlers/function_include/readonly/handleListFunctionGroupIncludes.js.map +1 -0
- package/dist/handlers/function_include/readonly/handleListFunctionModules.d.ts +26 -0
- package/dist/handlers/function_include/readonly/handleListFunctionModules.d.ts.map +1 -0
- package/dist/handlers/function_include/readonly/handleListFunctionModules.js +46 -0
- package/dist/handlers/function_include/readonly/handleListFunctionModules.js.map +1 -0
- package/dist/handlers/function_include/readonly/handleReadFunctionInclude.d.ts +38 -0
- package/dist/handlers/function_include/readonly/handleReadFunctionInclude.d.ts.map +1 -0
- package/dist/handlers/function_include/readonly/handleReadFunctionInclude.js +94 -0
- package/dist/handlers/function_include/readonly/handleReadFunctionInclude.js.map +1 -0
- package/dist/handlers/include/readonly/handleGetIncludesList.d.ts.map +1 -1
- package/dist/handlers/include/readonly/handleGetIncludesList.js +63 -69
- package/dist/handlers/include/readonly/handleGetIncludesList.js.map +1 -1
- package/dist/handlers/structure/readonly/handleGetStructuresList.d.ts +62 -0
- package/dist/handlers/structure/readonly/handleGetStructuresList.d.ts.map +1 -0
- package/dist/handlers/structure/readonly/handleGetStructuresList.js +248 -0
- package/dist/handlers/structure/readonly/handleGetStructuresList.js.map +1 -0
- package/dist/lib/handlers/groups/HighLevelHandlersGroup.d.ts.map +1 -1
- package/dist/lib/handlers/groups/HighLevelHandlersGroup.js +15 -0
- package/dist/lib/handlers/groups/HighLevelHandlersGroup.js.map +1 -1
- package/dist/lib/handlers/groups/ReadOnlyHandlersGroup.d.ts.map +1 -1
- package/dist/lib/handlers/groups/ReadOnlyHandlersGroup.js +20 -0
- package/dist/lib/handlers/groups/ReadOnlyHandlersGroup.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [7.1.1] - 2026-06-19
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- **`UpdateFunctionInclude` now supports an `activate` parameter** (default `false`) — when `true`, the include is activated after the source update so the new source becomes the active version, mirroring `UpdateFunctionModule`. Previously the tool always left the updated source inactive.
|
|
9
|
+
- Integration-test + `test-config.yaml.template` fixes for the new function-include / structure tools (verified end-to-end on a real system): the FUGR-include lifecycle update source is now a valid declaration (a bare executable statement in an include caused "Statement is not accessible"); the `ListFunctionGroupIncludes` test no longer asserts the generated `L<FUGR>UXX` collector is absent (the tool faithfully returns ALL `FUGR/I` includes — collector filtering is a backup-tool concern); the template seeds the shared `ZMCP_SHR_FGRP` / `Z_MCP_SHR_FM` the function-include tests reference.
|
|
10
|
+
|
|
11
|
+
## [7.1.0] - 2026-06-18
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- **Function-group include tools.** Six new MCP tools expose ADT function-group include operations:
|
|
15
|
+
- Read-only: `ReadFunctionInclude` (source + metadata), `ListFunctionGroupIncludes` (a FUGR's includes — TOP + custom), `ListFunctionModules` (a FUGR's function modules).
|
|
16
|
+
- High-level: `CreateFunctionInclude`, `UpdateFunctionInclude`, `DeleteFunctionInclude`.
|
|
17
|
+
- The list tools surface the new adt-clients `getUtils().listFunctionGroupIncludes()` / `listFunctionModules()` (nodestructure drill-down). `DeleteFunctionInclude` surfaces SAP's refusal message when an include can only be deleted via the Function Builder.
|
|
18
|
+
- Integration tests (`FunctionIncludeReadOnlyHandlers`, `FunctionIncludeHighHandlers`) and `tests/test-config.yaml.template` cases for the new tools.
|
|
19
|
+
- **Structure embedding tools (tree output).** New read-only `GetStructuresList` — recursively lists the structures embedded in an ABAP structure (or table) as a TREE. Each node records the embedded structure name, the `attribute` it is embedded under (named include `attr : include X;` vs anonymous `include X;` → `null`), and `kind`: `include` (from the source) or `append` (an extension found via where-used whose source is `extend type <this> with …`). Includes come from the DDL/classic source (`include X;`, `.INCLUDE`/`.APPEND`); appends are resolved via where-used (toggle with `include_extensions`, default true). Cycle-guarded. `GetIncludesList` reworked from a flat list to a recursive TREE (each include may have child includes; cycle-guarded, depth-capped). Integration test `GetStructuresListHandler` + `tests/test-config.yaml.template` case (shared structures `ZMCP_SHR_STRU` / `ZMCP_SHR_STRU_INC`).
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
- Bumped `@mcp-abap-adt/adt-clients` from `^5.6.0` to `^5.8.0` (adds `listFunctionModules`/`listFunctionGroupIncludes`; `getFunctionInclude().read()` returns source; `delete()` surfaces server-refused deletions). Clean registry install (no `link:true`/`file:`).
|
|
23
|
+
|
|
5
24
|
## [7.0.3] - 2026-06-13
|
|
6
25
|
|
|
7
26
|
### Changed
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CreateFunctionInclude Handler - ABAP Function Group Include Creation via ADT API
|
|
3
|
+
*
|
|
4
|
+
* Workflow: validate -> create (include in initial state)
|
|
5
|
+
* Source code is set via UpdateFunctionInclude handler.
|
|
6
|
+
*/
|
|
7
|
+
import type { HandlerContext } from '../../../lib/handlers/interfaces';
|
|
8
|
+
export declare const TOOL_DEFINITION: {
|
|
9
|
+
readonly name: "CreateFunctionInclude";
|
|
10
|
+
readonly available_in: readonly ["onprem", "cloud", "legacy"];
|
|
11
|
+
readonly description: "Operation: Create. Subject: FunctionInclude. Will be useful for creating function group include. Create a new ABAP include within an existing function group. Creates the include in initial state.";
|
|
12
|
+
readonly inputSchema: {
|
|
13
|
+
readonly type: "object";
|
|
14
|
+
readonly properties: {
|
|
15
|
+
readonly function_group_name: {
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
readonly description: "Parent function group name (e.g., ZTEST_FG_001)";
|
|
18
|
+
};
|
|
19
|
+
readonly include_name: {
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
readonly description: "Include name (e.g., LZTEST_FG_001F01).";
|
|
22
|
+
};
|
|
23
|
+
readonly description: {
|
|
24
|
+
readonly type: "string";
|
|
25
|
+
readonly description: "Optional description for the include";
|
|
26
|
+
};
|
|
27
|
+
readonly transport_request: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
readonly description: "Transport request number (e.g., E19K905635). Required for transportable packages.";
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
readonly required: readonly ["function_group_name", "include_name"];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
interface CreateFunctionIncludeArgs {
|
|
36
|
+
function_group_name: string;
|
|
37
|
+
include_name: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
transport_request?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Main handler for CreateFunctionInclude MCP tool
|
|
43
|
+
*/
|
|
44
|
+
export declare function handleCreateFunctionInclude(context: HandlerContext, args: CreateFunctionIncludeArgs): Promise<{
|
|
45
|
+
isError: boolean;
|
|
46
|
+
content: {
|
|
47
|
+
type: string;
|
|
48
|
+
text: any;
|
|
49
|
+
}[];
|
|
50
|
+
}>;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=handleCreateFunctionInclude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleCreateFunctionInclude.d.ts","sourceRoot":"","sources":["../../../../src/handlers/function_include/high/handleCreateFunctionInclude.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAOvE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BlB,CAAC;AAEX,UAAU,yBAAyB;IACjC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,yBAAyB;;;;;;GAuFhC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* CreateFunctionInclude Handler - ABAP Function Group Include Creation via ADT API
|
|
4
|
+
*
|
|
5
|
+
* Workflow: validate -> create (include in initial state)
|
|
6
|
+
* Source code is set via UpdateFunctionInclude handler.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.TOOL_DEFINITION = void 0;
|
|
10
|
+
exports.handleCreateFunctionInclude = handleCreateFunctionInclude;
|
|
11
|
+
const clients_1 = require("../../../lib/clients");
|
|
12
|
+
const utils_1 = require("../../../lib/utils");
|
|
13
|
+
exports.TOOL_DEFINITION = {
|
|
14
|
+
name: 'CreateFunctionInclude',
|
|
15
|
+
available_in: ['onprem', 'cloud', 'legacy'],
|
|
16
|
+
description: 'Operation: Create. Subject: FunctionInclude. Will be useful for creating function group include. Create a new ABAP include within an existing function group. Creates the include in initial state.',
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
function_group_name: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'Parent function group name (e.g., ZTEST_FG_001)',
|
|
23
|
+
},
|
|
24
|
+
include_name: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
description: 'Include name (e.g., LZTEST_FG_001F01).',
|
|
27
|
+
},
|
|
28
|
+
description: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
description: 'Optional description for the include',
|
|
31
|
+
},
|
|
32
|
+
transport_request: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
description: 'Transport request number (e.g., E19K905635). Required for transportable packages.',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
required: ['function_group_name', 'include_name'],
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Main handler for CreateFunctionInclude MCP tool
|
|
42
|
+
*/
|
|
43
|
+
async function handleCreateFunctionInclude(context, args) {
|
|
44
|
+
const { connection, logger } = context;
|
|
45
|
+
try {
|
|
46
|
+
if (!args?.function_group_name) {
|
|
47
|
+
return (0, utils_1.return_error)(new Error('function_group_name is required'));
|
|
48
|
+
}
|
|
49
|
+
if (!args?.include_name) {
|
|
50
|
+
return (0, utils_1.return_error)(new Error('include_name is required'));
|
|
51
|
+
}
|
|
52
|
+
const functionGroupName = args.function_group_name.toUpperCase();
|
|
53
|
+
const includeName = args.include_name.toUpperCase();
|
|
54
|
+
logger?.info(`Starting function include creation: ${includeName} in ${functionGroupName}`);
|
|
55
|
+
try {
|
|
56
|
+
const client = (0, clients_1.createAdtClient)(connection, logger);
|
|
57
|
+
await client.getFunctionInclude().create({
|
|
58
|
+
functionGroupName,
|
|
59
|
+
includeName,
|
|
60
|
+
description: args.description || includeName,
|
|
61
|
+
sourceCode: '',
|
|
62
|
+
transportRequest: args.transport_request,
|
|
63
|
+
});
|
|
64
|
+
logger?.info(`Function include created: ${includeName}`);
|
|
65
|
+
return (0, utils_1.return_response)({
|
|
66
|
+
data: JSON.stringify({
|
|
67
|
+
success: true,
|
|
68
|
+
function_group_name: functionGroupName,
|
|
69
|
+
include_name: includeName,
|
|
70
|
+
transport_request: args.transport_request || 'local',
|
|
71
|
+
message: `Function include ${includeName} created successfully. Use UpdateFunctionInclude to set source code.`,
|
|
72
|
+
}),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
logger?.error(`Error creating function include ${includeName}: ${error?.message || error}`);
|
|
77
|
+
if (error.message?.includes('already exists') ||
|
|
78
|
+
error.response?.status === 409) {
|
|
79
|
+
return (0, utils_1.return_error)(new Error(`Function include ${includeName} already exists in group ${functionGroupName}. Please delete it first or use a different name.`));
|
|
80
|
+
}
|
|
81
|
+
if (error.response?.status === 404) {
|
|
82
|
+
return (0, utils_1.return_error)(new Error(`Function group ${functionGroupName} not found. Create the function group first.`));
|
|
83
|
+
}
|
|
84
|
+
if (error.response?.status === 400) {
|
|
85
|
+
return (0, utils_1.return_error)(new Error(`Bad request. Check if include name is valid and function group exists.`));
|
|
86
|
+
}
|
|
87
|
+
const errorMessage = error.response?.data
|
|
88
|
+
? typeof error.response.data === 'string'
|
|
89
|
+
? error.response.data
|
|
90
|
+
: JSON.stringify(error.response.data)
|
|
91
|
+
: error.message || String(error);
|
|
92
|
+
return (0, utils_1.return_error)(new Error(`Failed to create function include ${includeName}: ${errorMessage}`));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
return (0, utils_1.return_error)(error);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=handleCreateFunctionInclude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleCreateFunctionInclude.js","sourceRoot":"","sources":["../../../../src/handlers/function_include/high/handleCreateFunctionInclude.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAkDH,kEAyFC;AAzID,kDAAuD;AAEvD,8CAI4B;AAEf,QAAA,eAAe,GAAG;IAC7B,IAAI,EAAE,uBAAuB;IAC7B,YAAY,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAU;IACpD,WAAW,EACT,qMAAqM;IACvM,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,mBAAmB,EAAE;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iDAAiD;aAC/D;YACD,YAAY,EAAE;gBACZ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,wCAAwC;aACtD;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sCAAsC;aACpD;YACD,iBAAiB,EAAE;gBACjB,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,mFAAmF;aACtF;SACF;QACD,QAAQ,EAAE,CAAC,qBAAqB,EAAE,cAAc,CAAC;KAClD;CACO,CAAC;AASX;;GAEG;AACI,KAAK,UAAU,2BAA2B,CAC/C,OAAuB,EACvB,IAA+B;IAE/B,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACvC,IAAI,CAAC;QACH,IAAI,CAAC,IAAI,EAAE,mBAAmB,EAAE,CAAC;YAC/B,OAAO,IAAA,oBAAY,EAAC,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC,CAAC;QACpE,CAAC;QACD,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC;YACxB,OAAO,IAAA,oBAAY,EAAC,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC,CAAC;QAC7D,CAAC;QAED,MAAM,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,CAAC,WAAW,EAAE,CAAC;QACjE,MAAM,WAAW,GAA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nC,OAAO,IAAA,oBAAY,EACjB,IAAI,KAAK,CACP,kBAAkB,iBAAiB,8CAA8C,CAClF,CACF,CAAC;YACJ,CAAC;YAED,IAAI,KAAK,CAAC,QAAQ,EAAE,MAAM,KAAK,GAAG,EAAE,CAAC;gBACnC,OAAO,IAAA,oBAAY,EACjB,IAAI,KAAK,CACP,wEAAwE,CACzE,CACF,CAAC;YACJ,CAAC;YAED,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,EAAE,IAAI;gBACvC,CAAC,CAAC,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,QAAQ;oBACvC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI;oBACrB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;gBACvC,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;YAEnC,OAAO,IAAA,oBAAY,EACjB,IAAI,KAAK,CACP,qCAAqC,WAAW,KAAK,YAAY,EAAE,CACpE,CACF,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,IAAA,oBAAY,EAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DeleteFunctionInclude Handler - Delete ABAP Function Group Include via AdtClient
|
|
3
|
+
*
|
|
4
|
+
* Uses AdtClient.getFunctionInclude().delete() for the high-level delete operation.
|
|
5
|
+
* Note: the ADT backend rejects deletion of function module includes (those must be
|
|
6
|
+
* deleted via the Function Builder); that server message propagates as an error.
|
|
7
|
+
*/
|
|
8
|
+
import type { HandlerContext } from '../../../lib/handlers/interfaces';
|
|
9
|
+
export declare const TOOL_DEFINITION: {
|
|
10
|
+
readonly name: "DeleteFunctionInclude";
|
|
11
|
+
readonly available_in: readonly ["onprem", "cloud", "legacy"];
|
|
12
|
+
readonly description: "Delete an ABAP function group include from the SAP system. Note: function module includes must be deleted via the Function Builder; the backend rejects such deletions. Transport request optional for $TMP objects.";
|
|
13
|
+
readonly inputSchema: {
|
|
14
|
+
readonly type: "object";
|
|
15
|
+
readonly properties: {
|
|
16
|
+
readonly function_group_name: {
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
readonly description: "Function group name containing the include (e.g., Z_MY_FG).";
|
|
19
|
+
};
|
|
20
|
+
readonly include_name: {
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
readonly description: "Include name (e.g., LZ_MY_FGF01).";
|
|
23
|
+
};
|
|
24
|
+
readonly transport_request: {
|
|
25
|
+
readonly type: "string";
|
|
26
|
+
readonly description: "Transport request number (e.g., E19K905635). Required for transportable objects. Optional for local objects ($TMP).";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
readonly required: readonly ["function_group_name", "include_name"];
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
interface DeleteFunctionIncludeArgs {
|
|
33
|
+
function_group_name: string;
|
|
34
|
+
include_name: string;
|
|
35
|
+
transport_request?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Main handler for DeleteFunctionInclude MCP tool
|
|
39
|
+
*/
|
|
40
|
+
export declare function handleDeleteFunctionInclude(context: HandlerContext, args: DeleteFunctionIncludeArgs): Promise<{
|
|
41
|
+
isError: boolean;
|
|
42
|
+
content: {
|
|
43
|
+
type: string;
|
|
44
|
+
text: any;
|
|
45
|
+
}[];
|
|
46
|
+
}>;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=handleDeleteFunctionInclude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleDeleteFunctionInclude.d.ts","sourceRoot":"","sources":["../../../../src/handlers/function_include/high/handleDeleteFunctionInclude.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAOvE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;CAyBlB,CAAC;AAEX,UAAU,yBAAyB;IACjC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,yBAAyB;;;;;;GA4FhC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* DeleteFunctionInclude Handler - Delete ABAP Function Group Include via AdtClient
|
|
4
|
+
*
|
|
5
|
+
* Uses AdtClient.getFunctionInclude().delete() for the high-level delete operation.
|
|
6
|
+
* Note: the ADT backend rejects deletion of function module includes (those must be
|
|
7
|
+
* deleted via the Function Builder); that server message propagates as an error.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.TOOL_DEFINITION = void 0;
|
|
11
|
+
exports.handleDeleteFunctionInclude = handleDeleteFunctionInclude;
|
|
12
|
+
const clients_1 = require("../../../lib/clients");
|
|
13
|
+
const utils_1 = require("../../../lib/utils");
|
|
14
|
+
exports.TOOL_DEFINITION = {
|
|
15
|
+
name: 'DeleteFunctionInclude',
|
|
16
|
+
available_in: ['onprem', 'cloud', 'legacy'],
|
|
17
|
+
description: 'Delete an ABAP function group include from the SAP system. Note: function module includes must be deleted via the Function Builder; the backend rejects such deletions. Transport request optional for $TMP objects.',
|
|
18
|
+
inputSchema: {
|
|
19
|
+
type: 'object',
|
|
20
|
+
properties: {
|
|
21
|
+
function_group_name: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
description: 'Function group name containing the include (e.g., Z_MY_FG).',
|
|
24
|
+
},
|
|
25
|
+
include_name: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
description: 'Include name (e.g., LZ_MY_FGF01).',
|
|
28
|
+
},
|
|
29
|
+
transport_request: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'Transport request number (e.g., E19K905635). Required for transportable objects. Optional for local objects ($TMP).',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
required: ['function_group_name', 'include_name'],
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Main handler for DeleteFunctionInclude MCP tool
|
|
39
|
+
*/
|
|
40
|
+
async function handleDeleteFunctionInclude(context, args) {
|
|
41
|
+
const { connection, logger } = context;
|
|
42
|
+
try {
|
|
43
|
+
const { function_group_name, include_name, transport_request } = args;
|
|
44
|
+
if (!function_group_name || !include_name) {
|
|
45
|
+
return (0, utils_1.return_error)(new Error('function_group_name and include_name are required'));
|
|
46
|
+
}
|
|
47
|
+
const client = (0, clients_1.createAdtClient)(connection, logger);
|
|
48
|
+
const functionGroupName = function_group_name.toUpperCase();
|
|
49
|
+
const includeName = include_name.toUpperCase();
|
|
50
|
+
logger?.info(`Starting function include deletion: ${includeName} in ${functionGroupName}`);
|
|
51
|
+
try {
|
|
52
|
+
const obj = client.getFunctionInclude();
|
|
53
|
+
const r = await obj.delete({
|
|
54
|
+
functionGroupName,
|
|
55
|
+
includeName,
|
|
56
|
+
transportRequest: transport_request,
|
|
57
|
+
});
|
|
58
|
+
if (!r || !r.deleteResult) {
|
|
59
|
+
throw new Error(`Delete did not return a response for function include ${includeName}`);
|
|
60
|
+
}
|
|
61
|
+
logger?.info(`✅ DeleteFunctionInclude completed successfully: ${includeName}`);
|
|
62
|
+
return (0, utils_1.return_response)({
|
|
63
|
+
data: JSON.stringify({
|
|
64
|
+
success: true,
|
|
65
|
+
function_group_name: functionGroupName,
|
|
66
|
+
include_name: includeName,
|
|
67
|
+
transport_request: transport_request || null,
|
|
68
|
+
message: `Function include ${includeName} deleted successfully.`,
|
|
69
|
+
}, null, 2),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
logger?.error(`Error deleting function include ${includeName}: ${error?.message || error}`);
|
|
74
|
+
let errorMessage = `Failed to delete function include: ${error.message || String(error)}`;
|
|
75
|
+
if (error.response?.status === 404) {
|
|
76
|
+
errorMessage = `Function include ${includeName} not found. It may already be deleted.`;
|
|
77
|
+
}
|
|
78
|
+
else if (error.response?.status === 423) {
|
|
79
|
+
errorMessage = `Function include ${includeName} is locked by another user. Cannot delete.`;
|
|
80
|
+
}
|
|
81
|
+
else if (error.response?.status === 400) {
|
|
82
|
+
errorMessage = `Bad request. Check if transport request is required and valid.`;
|
|
83
|
+
}
|
|
84
|
+
else if (error.response?.data &&
|
|
85
|
+
typeof error.response.data === 'string') {
|
|
86
|
+
try {
|
|
87
|
+
const { XMLParser } = require('fast-xml-parser');
|
|
88
|
+
const parser = new XMLParser({
|
|
89
|
+
ignoreAttributes: false,
|
|
90
|
+
attributeNamePrefix: '@_',
|
|
91
|
+
});
|
|
92
|
+
const errorData = parser.parse(error.response.data);
|
|
93
|
+
const errorMsg = errorData['exc:exception']?.message?.['#text'] ||
|
|
94
|
+
errorData['exc:exception']?.message;
|
|
95
|
+
if (errorMsg) {
|
|
96
|
+
errorMessage = `SAP Error: ${errorMsg}`;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
catch (_parseError) {
|
|
100
|
+
// Ignore parse errors
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return (0, utils_1.return_error)(new Error(errorMessage));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
return (0, utils_1.return_error)(error);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=handleDeleteFunctionInclude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleDeleteFunctionInclude.js","sourceRoot":"","sources":["../../../../src/handlers/function_include/high/handleDeleteFunctionInclude.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AA8CH,kE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AC;YAClF,CAAC;iBAAM,IACL,KAAK,CAAC,QAAQ,EAAE,IAAI;gBACpB,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,QAAQ,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"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UpdateFunctionInclude Handler - Update Existing ABAP Function Group Include Source Code
|
|
3
|
+
*
|
|
4
|
+
* Uses AdtClient.getFunctionInclude().update() for the high-level update operation.
|
|
5
|
+
* Session and lock management handled internally by the builder.
|
|
6
|
+
*/
|
|
7
|
+
import type { HandlerContext } from '../../../lib/handlers/interfaces';
|
|
8
|
+
export declare const TOOL_DEFINITION: {
|
|
9
|
+
readonly name: "UpdateFunctionInclude";
|
|
10
|
+
readonly available_in: readonly ["onprem", "cloud", "legacy"];
|
|
11
|
+
readonly description: "Operation: Update. Subject: FunctionInclude. Will be useful for updating a function group include. Update source code of an existing ABAP function group include.";
|
|
12
|
+
readonly inputSchema: {
|
|
13
|
+
readonly type: "object";
|
|
14
|
+
readonly properties: {
|
|
15
|
+
readonly function_group_name: {
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
readonly description: "Function group name containing the include (e.g., ZOK_FG_MCP01).";
|
|
18
|
+
};
|
|
19
|
+
readonly include_name: {
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
readonly description: "Include name (e.g., LZOK_FG_MCP01F01). Include must already exist.";
|
|
22
|
+
};
|
|
23
|
+
readonly source_code: {
|
|
24
|
+
readonly type: "string";
|
|
25
|
+
readonly description: "Complete ABAP include source code.";
|
|
26
|
+
};
|
|
27
|
+
readonly transport_request: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
readonly description: "Transport request number (e.g., E19K905635). Required for transportable includes.";
|
|
30
|
+
};
|
|
31
|
+
readonly activate: {
|
|
32
|
+
readonly type: "boolean";
|
|
33
|
+
readonly description: "Activate the include after the source update. Default: false. Set true to make the updated source the active version immediately.";
|
|
34
|
+
readonly default: false;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
readonly required: readonly ["function_group_name", "include_name", "source_code"];
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
interface UpdateFunctionIncludeArgs {
|
|
41
|
+
function_group_name: string;
|
|
42
|
+
include_name: string;
|
|
43
|
+
source_code: string;
|
|
44
|
+
transport_request?: string;
|
|
45
|
+
activate?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Main handler for UpdateFunctionInclude MCP tool
|
|
49
|
+
*/
|
|
50
|
+
export declare function handleUpdateFunctionInclude(context: HandlerContext, args: UpdateFunctionIncludeArgs): Promise<any>;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=handleUpdateFunctionInclude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleUpdateFunctionInclude.d.ts","sourceRoot":"","sources":["../../../../src/handlers/function_include/high/handleUpdateFunctionInclude.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGvE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoClB,CAAC;AAEX,UAAU,yBAAyB;IACjC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,GAAG,CAAC,CAwGd"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* UpdateFunctionInclude Handler - Update Existing ABAP Function Group Include Source Code
|
|
4
|
+
*
|
|
5
|
+
* Uses AdtClient.getFunctionInclude().update() for the high-level update operation.
|
|
6
|
+
* Session and lock management handled internally by the builder.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.TOOL_DEFINITION = void 0;
|
|
10
|
+
exports.handleUpdateFunctionInclude = handleUpdateFunctionInclude;
|
|
11
|
+
const clients_1 = require("../../../lib/clients");
|
|
12
|
+
const utils_1 = require("../../../lib/utils");
|
|
13
|
+
exports.TOOL_DEFINITION = {
|
|
14
|
+
name: 'UpdateFunctionInclude',
|
|
15
|
+
available_in: ['onprem', 'cloud', 'legacy'],
|
|
16
|
+
description: 'Operation: Update. Subject: FunctionInclude. Will be useful for updating a function group include. Update source code of an existing ABAP function group include.',
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
function_group_name: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'Function group name containing the include (e.g., ZOK_FG_MCP01).',
|
|
23
|
+
},
|
|
24
|
+
include_name: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
description: 'Include name (e.g., LZOK_FG_MCP01F01). Include must already exist.',
|
|
27
|
+
},
|
|
28
|
+
source_code: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
description: 'Complete ABAP include source code.',
|
|
31
|
+
},
|
|
32
|
+
transport_request: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
description: 'Transport request number (e.g., E19K905635). Required for transportable includes.',
|
|
35
|
+
},
|
|
36
|
+
activate: {
|
|
37
|
+
type: 'boolean',
|
|
38
|
+
description: 'Activate the include after the source update. Default: false. Set true to make the updated source the active version immediately.',
|
|
39
|
+
default: false,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
required: ['function_group_name', 'include_name', 'source_code'],
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Main handler for UpdateFunctionInclude MCP tool
|
|
47
|
+
*/
|
|
48
|
+
async function handleUpdateFunctionInclude(context, args) {
|
|
49
|
+
const { connection, logger } = context;
|
|
50
|
+
try {
|
|
51
|
+
if (!args.function_group_name || args.function_group_name.length > 30) {
|
|
52
|
+
return (0, utils_1.return_error)(new Error('Function group name is required and must not exceed 30 characters'));
|
|
53
|
+
}
|
|
54
|
+
if (!args.include_name) {
|
|
55
|
+
return (0, utils_1.return_error)(new Error('include_name is required'));
|
|
56
|
+
}
|
|
57
|
+
if (!args.source_code) {
|
|
58
|
+
return (0, utils_1.return_error)(new Error('Source code is required'));
|
|
59
|
+
}
|
|
60
|
+
const functionGroupName = args.function_group_name.toUpperCase();
|
|
61
|
+
const includeName = args.include_name.toUpperCase();
|
|
62
|
+
logger?.info(`Starting function include source update: ${includeName} in ${functionGroupName}`);
|
|
63
|
+
try {
|
|
64
|
+
const client = (0, clients_1.createAdtClient)(connection, logger);
|
|
65
|
+
const shouldActivate = args.activate === true;
|
|
66
|
+
await client.getFunctionInclude().update({
|
|
67
|
+
functionGroupName,
|
|
68
|
+
includeName,
|
|
69
|
+
sourceCode: args.source_code,
|
|
70
|
+
transportRequest: args.transport_request,
|
|
71
|
+
}, { activateOnUpdate: shouldActivate });
|
|
72
|
+
logger?.info(`✅ UpdateFunctionInclude completed successfully: ${includeName}`);
|
|
73
|
+
const result = {
|
|
74
|
+
success: true,
|
|
75
|
+
function_group_name: functionGroupName,
|
|
76
|
+
include_name: includeName,
|
|
77
|
+
transport_request: args.transport_request || null,
|
|
78
|
+
activated: shouldActivate,
|
|
79
|
+
message: `Function include ${includeName} source code updated successfully${shouldActivate ? ' and activated' : ''}`,
|
|
80
|
+
};
|
|
81
|
+
return (0, utils_1.return_response)({
|
|
82
|
+
data: JSON.stringify(result, null, 2),
|
|
83
|
+
status: 200,
|
|
84
|
+
statusText: 'OK',
|
|
85
|
+
headers: {},
|
|
86
|
+
config: {},
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
logger?.error(`Error updating function include source ${includeName}: ${error?.message || error}`);
|
|
91
|
+
let errorMessage = error.response?.data
|
|
92
|
+
? typeof error.response.data === 'string'
|
|
93
|
+
? error.response.data
|
|
94
|
+
: JSON.stringify(error.response.data)
|
|
95
|
+
: error.message || String(error);
|
|
96
|
+
if (error.response?.status === 404) {
|
|
97
|
+
errorMessage = `Function include ${includeName} not found in group ${functionGroupName}.`;
|
|
98
|
+
}
|
|
99
|
+
else if (error.response?.status === 423) {
|
|
100
|
+
errorMessage = `Function include ${includeName} is locked by another user or lock handle is invalid.`;
|
|
101
|
+
}
|
|
102
|
+
else if (error.response?.status === 400 && !args.transport_request) {
|
|
103
|
+
errorMessage = `Update failed for ${includeName}. The object may be assigned to a transport request. Pass transport_request explicitly.`;
|
|
104
|
+
}
|
|
105
|
+
else if (error.response?.data &&
|
|
106
|
+
typeof error.response.data === 'string') {
|
|
107
|
+
try {
|
|
108
|
+
const { XMLParser } = require('fast-xml-parser');
|
|
109
|
+
const parser = new XMLParser({
|
|
110
|
+
ignoreAttributes: false,
|
|
111
|
+
attributeNamePrefix: '@_',
|
|
112
|
+
});
|
|
113
|
+
const errorData = parser.parse(error.response.data);
|
|
114
|
+
const errorMsg = errorData['exc:exception']?.message?.['#text'] ||
|
|
115
|
+
errorData['exc:exception']?.message;
|
|
116
|
+
if (errorMsg) {
|
|
117
|
+
errorMessage = `SAP Error: ${errorMsg}`;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
catch (_parseError) {
|
|
121
|
+
// Keep original error message if XML parsing fails
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return (0, utils_1.return_error)(new Error(`Failed to update function include source: ${errorMessage}`));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
return (0, utils_1.return_error)(error);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=handleUpdateFunctionInclude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleUpdateFunctionInclude.js","sourceRoot":"","sources":["../../../../src/handlers/function_include/high/handleUpdateFunctionInclude.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAuDH,kEA2GC;AAhKD,kDAAuD;AAEvD,8CAAmE;AAEtD,QAAA,eAAe,GAAG;IAC7B,IAAI,EAAE,uBAAuB;IAC7B,YAAY,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAU;IACpD,WAAW,EACT,mKAAmK;IACrK,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,mBAAmB,EAAE;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,kEAAkE;aACrE;YACD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EAAE,CAAC;oBAC1C,CAAC;gBACH,CAAC;gBAAC,OAAO,WAAW,EAAE,CAAC;oBACrB,mDAAmD;gBACrD,CAAC;YACH,CAAC;YAED,OAAO,IAAA,oBAAY,EACjB,IAAI,KAAK,CAAC,6CAA6C,YAAY,EAAE,CAAC,CACvE,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,IAAA,oBAAY,EAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { HandlerContext } from '../../../lib/handlers/interfaces';
|
|
2
|
+
export declare const TOOL_DEFINITION: {
|
|
3
|
+
readonly name: "ListFunctionGroupIncludes";
|
|
4
|
+
readonly available_in: readonly ["onprem", "cloud", "legacy"];
|
|
5
|
+
readonly description: "[read-only] List the includes (TOP, custom) of an ABAP function group.";
|
|
6
|
+
readonly inputSchema: {
|
|
7
|
+
readonly type: "object";
|
|
8
|
+
readonly properties: {
|
|
9
|
+
readonly function_group_name: {
|
|
10
|
+
readonly type: "string";
|
|
11
|
+
readonly description: "Function group name (e.g., Z_MY_FG).";
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
readonly required: readonly ["function_group_name"];
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare function handleListFunctionGroupIncludes(context: HandlerContext, args: {
|
|
18
|
+
function_group_name: string;
|
|
19
|
+
}): Promise<{
|
|
20
|
+
isError: boolean;
|
|
21
|
+
content: {
|
|
22
|
+
type: string;
|
|
23
|
+
text: any;
|
|
24
|
+
}[];
|
|
25
|
+
}>;
|
|
26
|
+
//# sourceMappingURL=handleListFunctionGroupIncludes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleListFunctionGroupIncludes.d.ts","sourceRoot":"","sources":["../../../../src/handlers/function_include/readonly/handleListFunctionGroupIncludes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAOvE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;CAelB,CAAC;AAEX,wBAAsB,+BAA+B,CACnD,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE;IAAE,mBAAmB,EAAE,MAAM,CAAA;CAAE;;;;;;GA6BtC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TOOL_DEFINITION = void 0;
|
|
4
|
+
exports.handleListFunctionGroupIncludes = handleListFunctionGroupIncludes;
|
|
5
|
+
const clients_1 = require("../../../lib/clients");
|
|
6
|
+
const utils_1 = require("../../../lib/utils");
|
|
7
|
+
exports.TOOL_DEFINITION = {
|
|
8
|
+
name: 'ListFunctionGroupIncludes',
|
|
9
|
+
available_in: ['onprem', 'cloud', 'legacy'],
|
|
10
|
+
description: '[read-only] List the includes (TOP, custom) of an ABAP function group.',
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
function_group_name: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Function group name (e.g., Z_MY_FG).',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
required: ['function_group_name'],
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
async function handleListFunctionGroupIncludes(context, args) {
|
|
23
|
+
const { connection, logger } = context;
|
|
24
|
+
try {
|
|
25
|
+
const { function_group_name } = args;
|
|
26
|
+
if (!function_group_name)
|
|
27
|
+
return (0, utils_1.return_error)(new Error('function_group_name is required'));
|
|
28
|
+
const client = (0, clients_1.createAdtClient)(connection, logger);
|
|
29
|
+
const functionGroupName = function_group_name.toUpperCase();
|
|
30
|
+
const includes = await client
|
|
31
|
+
.getUtils()
|
|
32
|
+
.listFunctionGroupIncludes(functionGroupName);
|
|
33
|
+
return (0, utils_1.return_response)({
|
|
34
|
+
data: JSON.stringify({
|
|
35
|
+
success: true,
|
|
36
|
+
function_group_name: functionGroupName,
|
|
37
|
+
total: includes.length,
|
|
38
|
+
includes,
|
|
39
|
+
}, null, 2),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
return (0, utils_1.return_error)(error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=handleListFunctionGroupIncludes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleListFunctionGroupIncludes.js","sourceRoot":"","sources":["../../../../src/handlers/function_include/readonly/handleListFunctionGroupIncludes.ts"],"names":[],"mappings":";;;AAyBA,0EA+BC;AAxDD,kDAAuD;AAEvD,8CAI4B;AAEf,QAAA,eAAe,GAAG;IAC7B,IAAI,EAAE,2BAA2B;IACjC,YAAY,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAU;IACpD,WAAW,EACT,wEAAwE;IAC1E,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,mBAAmB,EAAE;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sCAAsC;aACpD;SACF;QACD,QAAQ,EAAE,CAAC,qBAAqB,CAAC;KAClC;CACO,CAAC;AAEJ,KAAK,UAAU,+BAA+B,CACnD,OAAuB,EACvB,IAAqC;IAErC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACvC,IAAI,CAAC;QACH,MAAM,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAAC;QACrC,IAAI,CAAC,mBAAmB;YACtB,OAAO,IAAA,oBAAY,EAAC,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC,CAAC;QAEpE,MAAM,MAAM,GAAG,IAAA,yBAAe,EAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QACnD,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,WAAW,EAAE,CAAC;QAC5D,MA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