@mcp-abap-adt/adt-clients 3.10.0 → 3.10.2
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/dist/core/shared/AdtUtils.d.ts +1 -1
- package/dist/core/shared/AdtUtils.d.ts.map +1 -1
- package/dist/core/shared/AdtUtilsLegacy.d.ts +10 -0
- package/dist/core/shared/AdtUtilsLegacy.d.ts.map +1 -1
- package/dist/core/shared/AdtUtilsLegacy.js +32 -0
- package/dist/executors/program/ProgramExecutor.d.ts +1 -5
- package/dist/executors/program/ProgramExecutor.d.ts.map +1 -1
- package/dist/executors/program/ProgramExecutor.js +4 -62
- package/package.json +1 -1
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
import type { IAdtResponse as AxiosResponse, IAbapConnection, ILogger } from '@mcp-abap-adt/interfaces';
|
|
31
31
|
import type { AdtObjectType, AdtSourceObjectType, IGetDiscoveryParams, IGetPackageContentsListOptions, IGetPackageHierarchyOptions, IGetSqlQueryParams, IGetTableContentsParams, IGetVirtualFoldersContentsParams, IGetWhereUsedListParams, IGetWhereUsedParams, IGetWhereUsedScopeParams, IInactiveObjectsResponse, IObjectReference, IPackageContentItem, IPackageHierarchyNode, IReadOptions, ISearchObjectsParams, IWhereUsedListResult } from './types';
|
|
32
32
|
export declare class AdtUtils {
|
|
33
|
-
|
|
33
|
+
protected connection: IAbapConnection;
|
|
34
34
|
private logger;
|
|
35
35
|
constructor(connection: IAbapConnection, logger: ILogger);
|
|
36
36
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdtUtils.d.ts","sourceRoot":"","sources":["../../../src/core/shared/AdtUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EACV,YAAY,IAAI,aAAa,EAC7B,eAAe,EACf,OAAO,EACR,MAAM,0BAA0B,CAAC;AAsDlC,OAAO,KAAK,EACV,aAAa,EACb,mB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IAAI,GAAE,MAAyB,GAC9B,OAAO,CAAC,aAAa,CAAC;CAG1B"}
|
|
@@ -5,9 +5,19 @@
|
|
|
5
5
|
* - getTableContents → /sap/bc/adt/datapreview/ddic (not available)
|
|
6
6
|
* - getSqlQuery → /sap/bc/adt/datapreview/freestyle (not available)
|
|
7
7
|
* - getTransaction → /sap/bc/adt/repository/informationsystem/objectproperties (not available)
|
|
8
|
+
* - activateObjectsGroup → /sap/bc/adt/activation/runs (not available, uses /sap/bc/adt/activation)
|
|
8
9
|
*/
|
|
10
|
+
import type { IAdtResponse as AxiosResponse } from '@mcp-abap-adt/interfaces';
|
|
9
11
|
import { AdtUtils } from './AdtUtils';
|
|
12
|
+
import type { IObjectReference } from './types';
|
|
10
13
|
export declare class AdtUtilsLegacy extends AdtUtils {
|
|
14
|
+
/**
|
|
15
|
+
* Legacy group activation — synchronous POST to /sap/bc/adt/activation
|
|
16
|
+
*
|
|
17
|
+
* Modern systems use async /sap/bc/adt/activation/runs with polling.
|
|
18
|
+
* Legacy systems use synchronous /sap/bc/adt/activation — response contains result directly.
|
|
19
|
+
*/
|
|
20
|
+
activateObjectsGroup(objects: IObjectReference[], preauditRequested?: boolean): Promise<AxiosResponse>;
|
|
11
21
|
getTableContents(): Promise<never>;
|
|
12
22
|
getSqlQuery(): Promise<never>;
|
|
13
23
|
getTransaction(): Promise<never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdtUtilsLegacy.d.ts","sourceRoot":"","sources":["../../../src/core/shared/AdtUtilsLegacy.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"AdtUtilsLegacy.d.ts","sourceRoot":"","sources":["../../../src/core/shared/AdtUtilsLegacy.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAUhD,qBAAa,cAAe,SAAQ,QAAQ;IAC1C;;;;;OAKG;IACY,oBAAoB,CACjC,OAAO,EAAE,gBAAgB,EAAE,EAC3B,iBAAiB,GAAE,OAAe,GACjC,OAAO,CAAC,aAAa,CAAC;IA2BV,gBAAgB,IAAI,OAAO,CAAC,KAAK,CAAC;IAMlC,WAAW,IAAI,OAAO,CAAC,KAAK,CAAC;IAM7B,cAAc,IAAI,OAAO,CAAC,KAAK,CAAC;CAQhD"}
|
|
@@ -6,9 +6,12 @@
|
|
|
6
6
|
* - getTableContents → /sap/bc/adt/datapreview/ddic (not available)
|
|
7
7
|
* - getSqlQuery → /sap/bc/adt/datapreview/freestyle (not available)
|
|
8
8
|
* - getTransaction → /sap/bc/adt/repository/informationsystem/objectproperties (not available)
|
|
9
|
+
* - activateObjectsGroup → /sap/bc/adt/activation/runs (not available, uses /sap/bc/adt/activation)
|
|
9
10
|
*/
|
|
10
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
12
|
exports.AdtUtilsLegacy = void 0;
|
|
13
|
+
const activationUtils_1 = require("../../utils/activationUtils");
|
|
14
|
+
const timeouts_1 = require("../../utils/timeouts");
|
|
12
15
|
const AdtUtils_1 = require("./AdtUtils");
|
|
13
16
|
function unsupportedError(operation, endpoint) {
|
|
14
17
|
return (`${operation} is not supported on this SAP system (legacy, BASIS < 7.50). ` +
|
|
@@ -16,6 +19,35 @@ function unsupportedError(operation, endpoint) {
|
|
|
16
19
|
`ADT discovery catalog (/sap/bc/adt/discovery).`);
|
|
17
20
|
}
|
|
18
21
|
class AdtUtilsLegacy extends AdtUtils_1.AdtUtils {
|
|
22
|
+
/**
|
|
23
|
+
* Legacy group activation — synchronous POST to /sap/bc/adt/activation
|
|
24
|
+
*
|
|
25
|
+
* Modern systems use async /sap/bc/adt/activation/runs with polling.
|
|
26
|
+
* Legacy systems use synchronous /sap/bc/adt/activation — response contains result directly.
|
|
27
|
+
*/
|
|
28
|
+
async activateObjectsGroup(objects, preauditRequested = false) {
|
|
29
|
+
const url = `/sap/bc/adt/activation?method=activate&preauditRequested=${preauditRequested}`;
|
|
30
|
+
const objectReferences = objects
|
|
31
|
+
.map((obj) => {
|
|
32
|
+
const uri = (0, activationUtils_1.buildObjectUri)(obj.name, obj.type, obj.parentName);
|
|
33
|
+
const typeAttr = obj.type ? ` adtcore:type="${obj.type}"` : '';
|
|
34
|
+
return ` <adtcore:objectReference adtcore:uri="${uri}"${typeAttr} adtcore:name="${obj.name}"/>`;
|
|
35
|
+
})
|
|
36
|
+
.join('\n');
|
|
37
|
+
const xmlBody = `<?xml version="1.0" encoding="UTF-8"?><adtcore:objectReferences xmlns:adtcore="http://www.sap.com/adt/core">
|
|
38
|
+
${objectReferences}
|
|
39
|
+
</adtcore:objectReferences>`;
|
|
40
|
+
return this.connection.makeAdtRequest({
|
|
41
|
+
url,
|
|
42
|
+
method: 'POST',
|
|
43
|
+
timeout: (0, timeouts_1.getTimeout)('default'),
|
|
44
|
+
data: xmlBody,
|
|
45
|
+
headers: {
|
|
46
|
+
Accept: 'application/xml',
|
|
47
|
+
'Content-Type': 'application/xml',
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
19
51
|
async getTableContents() {
|
|
20
52
|
throw new Error(unsupportedError('Table contents', '/sap/bc/adt/datapreview/ddic'));
|
|
21
53
|
}
|
|
@@ -8,20 +8,16 @@ export interface IProgramExecuteWithProfilerOptions {
|
|
|
8
8
|
}
|
|
9
9
|
export interface IProgramExecuteWithProfilingOptions {
|
|
10
10
|
profilerParameters?: IProfilerTraceParameters;
|
|
11
|
-
traceLookupUris?: string[];
|
|
12
11
|
}
|
|
13
12
|
export interface IProgramExecuteWithProfilingResult {
|
|
14
13
|
response: AxiosResponse;
|
|
15
14
|
profilerId: string;
|
|
16
|
-
traceId: string;
|
|
17
|
-
traceRequestsResponse: AxiosResponse;
|
|
18
15
|
}
|
|
19
16
|
export interface IProgramExecutor extends IExecutor<IProgramExecutionTarget, AxiosResponse, IProgramExecuteWithProfilerOptions, IProgramExecuteWithProfilingOptions, IProgramExecuteWithProfilingResult> {
|
|
20
17
|
}
|
|
21
18
|
export declare class ProgramExecutor implements IProgramExecutor {
|
|
22
19
|
private readonly connection;
|
|
23
|
-
|
|
24
|
-
constructor(connection: IAbapConnection, logger?: ILogger);
|
|
20
|
+
constructor(connection: IAbapConnection, _logger?: ILogger);
|
|
25
21
|
run(target: IProgramExecutionTarget): Promise<AxiosResponse>;
|
|
26
22
|
runWithProfiler(target: IProgramExecutionTarget, options: IProgramExecuteWithProfilerOptions): Promise<AxiosResponse>;
|
|
27
23
|
runWithProfiling(target: IProgramExecutionTarget, options?: IProgramExecuteWithProfilingOptions): Promise<IProgramExecuteWithProfilingResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgramExecutor.d.ts","sourceRoot":"","sources":["../../../src/executors/program/ProgramExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,IAAI,aAAa,EAC7B,eAAe,EACf,SAAS,EACT,OAAO,EACR,MAAM,0BAA0B,CAAC;AAElC,OAAO,
|
|
1
|
+
{"version":3,"file":"ProgramExecutor.d.ts","sourceRoot":"","sources":["../../../src/executors/program/ProgramExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,IAAI,aAAa,EAC7B,eAAe,EACf,SAAS,EACT,OAAO,EACR,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,+BAA+B,CAAC;AAIvC,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kCAAkC;IACjD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mCAAmC;IAClD,kBAAkB,CAAC,EAAE,wBAAwB,CAAC;CAC/C;AAED,MAAM,WAAW,kCAAkC;IACjD,QAAQ,EAAE,aAAa,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CAIpB;AAED,MAAM,WAAW,gBACf,SAAQ,SAAS,CACf,uBAAuB,EACvB,aAAa,EACb,kCAAkC,EAClC,mCAAmC,EACnC,kCAAkC,CACnC;CAAG;AAEN,qBAAa,eAAgB,YAAW,gBAAgB;IACtD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkB;gBAEjC,UAAU,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,OAAO;IAIpD,GAAG,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,aAAa,CAAC;IAO5D,eAAe,CACnB,MAAM,EAAE,uBAAuB,EAC/B,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,aAAa,CAAC;IAUnB,gBAAgB,CACpB,MAAM,EAAE,uBAAuB,EAC/B,OAAO,GAAE,mCAAwC,GAChD,OAAO,CAAC,kCAAkC,CAAC;YA8BhC,iBAAiB;CAiBhC"}
|
|
@@ -7,10 +7,8 @@ const internalUtils_1 = require("../../utils/internalUtils");
|
|
|
7
7
|
const timeouts_1 = require("../../utils/timeouts");
|
|
8
8
|
class ProgramExecutor {
|
|
9
9
|
connection;
|
|
10
|
-
|
|
11
|
-
constructor(connection, logger) {
|
|
10
|
+
constructor(connection, _logger) {
|
|
12
11
|
this.connection = connection;
|
|
13
|
-
this.logger = logger;
|
|
14
12
|
}
|
|
15
13
|
async run(target) {
|
|
16
14
|
if (!target.programName) {
|
|
@@ -38,65 +36,9 @@ class ProgramExecutor {
|
|
|
38
36
|
throw new Error('Failed to extract profilerId from trace parameters response');
|
|
39
37
|
}
|
|
40
38
|
const response = await this.runWithProfilerId(normalizedProgramName, profilerId);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
`/sap/bc/adt/programs/programrun/${encodeURIComponent(normalizedProgramName)}`,
|
|
45
|
-
];
|
|
46
|
-
let traceRequestsResponse;
|
|
47
|
-
for (const uri of lookupUris) {
|
|
48
|
-
if (!uri) {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
try {
|
|
52
|
-
const current = await (0, profiler_1.getTraceRequestsByUri)(this.connection, uri);
|
|
53
|
-
const traceId = (0, profiler_1.extractTraceIdFromTraceRequestsResponse)(current);
|
|
54
|
-
if (traceId) {
|
|
55
|
-
return {
|
|
56
|
-
response,
|
|
57
|
-
profilerId,
|
|
58
|
-
traceId,
|
|
59
|
-
traceRequestsResponse: current,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
traceRequestsResponse = current;
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
this.logger?.debug?.('Trace lookup by URI failed, trying next URI', {
|
|
66
|
-
programName: normalizedProgramName,
|
|
67
|
-
uri,
|
|
68
|
-
error: error instanceof Error ? error.message : String(error),
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
let fallbackResponse;
|
|
73
|
-
let fallbackTraceId;
|
|
74
|
-
try {
|
|
75
|
-
fallbackResponse = await (0, profiler_1.listTraceRequests)(this.connection);
|
|
76
|
-
fallbackTraceId =
|
|
77
|
-
(0, profiler_1.extractTraceIdFromTraceRequestsResponse)(fallbackResponse);
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
this.logger?.debug?.('Trace requests list failed, trying trace files', {
|
|
81
|
-
programName: normalizedProgramName,
|
|
82
|
-
error: error instanceof Error ? error.message : String(error),
|
|
83
|
-
});
|
|
84
|
-
fallbackResponse = await (0, profiler_1.listTraceFiles)(this.connection);
|
|
85
|
-
fallbackTraceId =
|
|
86
|
-
(0, profiler_1.extractTraceIdFromTraceRequestsResponse)(fallbackResponse);
|
|
87
|
-
}
|
|
88
|
-
if (!fallbackTraceId) {
|
|
89
|
-
this.logger?.warn?.('Fallback trace response did not contain trace id', {
|
|
90
|
-
programName: normalizedProgramName,
|
|
91
|
-
});
|
|
92
|
-
throw new Error(`Failed to resolve traceId after profiled execution for program ${normalizedProgramName}`);
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
response,
|
|
96
|
-
profilerId,
|
|
97
|
-
traceId: fallbackTraceId,
|
|
98
|
-
traceRequestsResponse: traceRequestsResponse ?? fallbackResponse,
|
|
99
|
-
};
|
|
39
|
+
// Fire-and-forget: SAP writes the trace asynchronously after program completes.
|
|
40
|
+
// The caller is responsible for polling RuntimeListProfilerTraceFiles to find the trace.
|
|
41
|
+
return { response, profilerId };
|
|
100
42
|
}
|
|
101
43
|
async runWithProfilerId(programName, profilerId) {
|
|
102
44
|
const normalizedProgramName = (0, internalUtils_1.encodeSapObjectName)(programName).toUpperCase();
|