@mcp-abap-adt/adt-clients 3.5.0 → 3.6.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.
@@ -20,6 +20,7 @@ import type { IInterfaceConfig, IInterfaceState } from '../core/interface';
20
20
  import type { IPackageConfig, IPackageState } from '../core/package';
21
21
  import type { IProgramConfig, IProgramState } from '../core/program';
22
22
  import type { AdtUtils } from '../core/shared/AdtUtils';
23
+ import type { IUnitTestConfig, IUnitTestState } from '../core/unitTest';
23
24
  import type { IViewConfig, IViewState } from '../core/view';
24
25
  import { AdtClient, type IAdtClientOptions } from './AdtClient';
25
26
  export declare class AdtClientLegacy extends AdtClient {
@@ -31,6 +32,7 @@ export declare class AdtClientLegacy extends AdtClient {
31
32
  getFunctionModule(): IAdtObject<IFunctionModuleConfig, IFunctionModuleState>;
32
33
  getPackage(): IAdtObject<IPackageConfig, IPackageState>;
33
34
  getView(): IAdtObject<IViewConfig, IViewState>;
35
+ getUnitTest(): IAdtObject<IUnitTestConfig, IUnitTestState>;
34
36
  getUtils(): AdtUtils;
35
37
  getDomain(): never;
36
38
  getDataElement(): never;
@@ -1 +1 @@
1
- {"version":3,"file":"AdtClientLegacy.d.ts","sourceRoot":"","sources":["../../src/clients/AdtClientLegacy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,OAAO,EACR,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE3E,OAAO,KAAK,EAAE,c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AAU,CACtC,qBAAqB,EACrB,oBAAoB,CACrB;IASQ,UAAU,IAAI,UAAU,CAAC,cAAc,EAAE,aAAa,CAAC;IAQvD,OAAO,IAAI,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC;IAM9C,WAAW,IAAI,UAAU,CAAC,eAAe,EAAE,cAAc,CAAC;IAM1D,QAAQ,IAAI,QAAQ;IAMpB,SAAS,IAAI,KAAK;IAIlB,cAAc,IAAI,KAAK;IAMvB,YAAY,IAAI,KAAK;IAMrB,QAAQ,IAAI,KAAK;IAIjB,YAAY,IAAI,KAAK;IAMrB,gBAAgB,IAAI,KAAK;IAMzB,oBAAoB,IAAI,KAAK;IAM7B,iBAAiB,IAAI,KAAK;IAS1B,UAAU,IAAI,KAAK;IASnB,qBAAqB,IAAI,KAAK;IAS9B,yBAAyB,IAAI,KAAK;IASlC,oBAAoB,IAAI,KAAK;IAM7B,cAAc,IAAI,KAAK;CAKjC"}
@@ -23,6 +23,7 @@ const AdtPackageLegacy_1 = require("../core/package/AdtPackageLegacy");
23
23
  const AdtProgramLegacy_1 = require("../core/program/AdtProgramLegacy");
24
24
  const AdtUtilsLegacy_1 = require("../core/shared/AdtUtilsLegacy");
25
25
  const contentTypes_1 = require("../core/shared/contentTypes");
26
+ const AdtUnitTestLegacy_1 = require("../core/unitTest/AdtUnitTestLegacy");
26
27
  const AdtViewLegacy_1 = require("../core/view/AdtViewLegacy");
27
28
  const AdtClient_1 = require("./AdtClient");
28
29
  /**
@@ -64,6 +65,10 @@ class AdtClientLegacy extends AdtClient_1.AdtClient {
64
65
  getView() {
65
66
  return new AdtViewLegacy_1.AdtViewLegacy(this.connection, this.logger, this.systemContext);
66
67
  }
68
+ // --- Unit tests with legacy endpoints ---
69
+ getUnitTest() {
70
+ return new AdtUnitTestLegacy_1.AdtUnitTestLegacy(this.connection, this.logger);
71
+ }
67
72
  // --- Utilities with legacy restrictions ---
68
73
  getUtils() {
69
74
  return new AdtUtilsLegacy_1.AdtUtilsLegacy(this.connection, this.logger);
@@ -0,0 +1,34 @@
1
+ /**
2
+ * AdtUnitTestLegacy - Unit test operations for legacy SAP systems (BASIS < 7.50)
3
+ *
4
+ * Extends AdtUnitTest and overrides run/status/result to use legacy endpoints:
5
+ * - /sap/bc/adt/abapunit/testruns instead of /sap/bc/adt/abapunit/runs
6
+ * - application/xml content types instead of versioned vnd.sap.adt.api.abapunit.* types
7
+ */
8
+ import type { IAdtResponse as AxiosResponse, IAbapConnection, IAdtOperationOptions, ILogger } from '@mcp-abap-adt/interfaces';
9
+ import { AdtUnitTest } from './AdtUnitTest';
10
+ import type { IUnitTestConfig, IUnitTestState } from './types';
11
+ export declare class AdtUnitTestLegacy extends AdtUnitTest {
12
+ constructor(connection: IAbapConnection, logger?: ILogger);
13
+ /**
14
+ * Create unit test run using legacy endpoint
15
+ */
16
+ create(config: IUnitTestConfig, _options?: IAdtOperationOptions): Promise<IUnitTestState>;
17
+ /**
18
+ * Get unit test status using legacy endpoint
19
+ */
20
+ getStatus(runId: string, withLongPolling?: boolean): Promise<AxiosResponse>;
21
+ /**
22
+ * Get unit test result using legacy endpoint
23
+ */
24
+ getResult(runId: string, options?: {
25
+ withNavigationUris?: boolean;
26
+ format?: 'abapunit' | 'junit';
27
+ }): Promise<AxiosResponse>;
28
+ /**
29
+ * Extract run ID from legacy response
30
+ * Legacy uses /testruns/ in URIs instead of /runs/
31
+ */
32
+ protected extractRunId(response: AxiosResponse): string | undefined;
33
+ }
34
+ //# sourceMappingURL=AdtUnitTestLegacy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdtUnitTestLegacy.d.ts","sourceRoot":"","sources":["../../../src/core/unitTest/AdtUnitTestLegacy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,YAAY,IAAI,aAAa,EAC7B,eAAe,EACf,oBAAoB,EACpB,OAAO,EACR,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE/D,qBAAa,iBAAkB,SAAQ,WAAW;gBACpC,UAAU,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,OAAO;IAIzD;;OAEG;IACY,MAAM,CACnB,MAAM,EAAE,eAAe,EACvB,QAAQ,CAAC,EAAE,oBAAoB,GAC9B,OAAO,CAAC,cAAc,CAAC;IAuC1B;;OAEG;IACY,SAAS,CACtB,KAAK,EAAE,MAAM,EACb,eAAe,GAAE,OAAc,GAC9B,OAAO,CAAC,aAAa,CAAC;IAUzB;;OAEG;IACY,SAAS,CACtB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;QAAE,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,UAAU,GAAG,OAAO,CAAA;KAAE,GACxE,OAAO,CAAC,aAAa,CAAC;IAUzB;;;OAGG;cACgB,YAAY,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS;CAqC7E"}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ /**
3
+ * AdtUnitTestLegacy - Unit test operations for legacy SAP systems (BASIS < 7.50)
4
+ *
5
+ * Extends AdtUnitTest and overrides run/status/result to use legacy endpoints:
6
+ * - /sap/bc/adt/abapunit/testruns instead of /sap/bc/adt/abapunit/runs
7
+ * - application/xml content types instead of versioned vnd.sap.adt.api.abapunit.* types
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.AdtUnitTestLegacy = void 0;
11
+ const internalUtils_1 = require("../../utils/internalUtils");
12
+ const AdtUnitTest_1 = require("./AdtUnitTest");
13
+ const runLegacy_1 = require("./runLegacy");
14
+ class AdtUnitTestLegacy extends AdtUnitTest_1.AdtUnitTest {
15
+ constructor(connection, logger) {
16
+ super(connection, logger);
17
+ }
18
+ /**
19
+ * Create unit test run using legacy endpoint
20
+ */
21
+ async create(config, _options) {
22
+ if (!config.tests || config.tests.length === 0) {
23
+ throw new Error('At least one test definition is required');
24
+ }
25
+ try {
26
+ this.logger?.info?.('Starting unit test run (legacy)');
27
+ const response = await (0, runLegacy_1.startClassUnitTestRunLegacy)(this.connection, config.tests, config.options);
28
+ this.logger?.debug?.('Unit test run response status:', response.status);
29
+ const runId = this.extractRunId(response);
30
+ if (!runId) {
31
+ this.logger?.error?.('Failed to extract run ID from response. Response data:', response.data);
32
+ throw new Error('Failed to start unit test run: run ID not returned');
33
+ }
34
+ this.logger?.info?.('Unit test run started (legacy), run ID:', runId);
35
+ this.lastRunId = runId;
36
+ return {
37
+ createResult: response,
38
+ runId,
39
+ errors: [],
40
+ };
41
+ }
42
+ catch (error) {
43
+ this.logger?.error('Create failed (legacy):', error);
44
+ throw error;
45
+ }
46
+ }
47
+ /**
48
+ * Get unit test status using legacy endpoint
49
+ */
50
+ async getStatus(runId, withLongPolling = true) {
51
+ const response = await (0, runLegacy_1.getClassUnitTestStatusLegacy)(this.connection, runId, withLongPolling);
52
+ this.lastStatusResponse = response;
53
+ return response;
54
+ }
55
+ /**
56
+ * Get unit test result using legacy endpoint
57
+ */
58
+ async getResult(runId, options) {
59
+ const response = await (0, runLegacy_1.getClassUnitTestResultLegacy)(this.connection, runId, options);
60
+ this.lastResultResponse = response;
61
+ return response;
62
+ }
63
+ /**
64
+ * Extract run ID from legacy response
65
+ * Legacy uses /testruns/ in URIs instead of /runs/
66
+ */
67
+ extractRunId(response) {
68
+ // Try headers first
69
+ const locationHeader = (0, internalUtils_1.headerValueToString)(response.headers?.location) ||
70
+ (0, internalUtils_1.headerValueToString)(response.headers?.['content-location']) ||
71
+ (0, internalUtils_1.headerValueToString)(response.headers?.['sap-adt-location']);
72
+ if (locationHeader) {
73
+ const match = locationHeader.match(/\/testruns\/([^/]+)/) ||
74
+ locationHeader.match(/\/runs\/([^/]+)/);
75
+ if (match) {
76
+ return match[1];
77
+ }
78
+ }
79
+ // Fallback: parse from response body (XML)
80
+ const data = response.data;
81
+ if (typeof data === 'string') {
82
+ const uriMatch = data.match(/uri="([^"]+)"/);
83
+ if (uriMatch) {
84
+ const uri = uriMatch[1];
85
+ const match = uri.match(/\/testruns\/([^/]+)/) || uri.match(/\/runs\/([^/]+)/);
86
+ if (match) {
87
+ return match[1];
88
+ }
89
+ }
90
+ }
91
+ else if (data?.uri) {
92
+ const match = data.uri.match(/\/testruns\/([^/]+)/) ||
93
+ data.uri.match(/\/runs\/([^/]+)/);
94
+ if (match) {
95
+ return match[1];
96
+ }
97
+ }
98
+ return undefined;
99
+ }
100
+ }
101
+ exports.AdtUnitTestLegacy = AdtUnitTestLegacy;
@@ -8,6 +8,7 @@ import type { IUnitTestConfig, IUnitTestState } from './types';
8
8
  export type { ICdsUnitTestConfig, ICdsUnitTestState } from './AdtCdsUnitTest';
9
9
  export { AdtCdsUnitTest } from './AdtCdsUnitTest';
10
10
  export { AdtUnitTest } from './AdtUnitTest';
11
+ export { AdtUnitTestLegacy } from './AdtUnitTestLegacy';
11
12
  export type { IUnitTestConfig, IUnitTestState } from './types';
12
13
  export type AdtUnitTestType = IAdtObject<IUnitTestConfig, IUnitTestState>;
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/unitTest/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE/D,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG/D,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/unitTest/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE/D,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG/D,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC"}
@@ -5,8 +5,10 @@
5
5
  * All functionality is available through Adt* classes.
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.AdtUnitTest = exports.AdtCdsUnitTest = void 0;
8
+ exports.AdtUnitTestLegacy = exports.AdtUnitTest = exports.AdtCdsUnitTest = void 0;
9
9
  var AdtCdsUnitTest_1 = require("./AdtCdsUnitTest");
10
10
  Object.defineProperty(exports, "AdtCdsUnitTest", { enumerable: true, get: function () { return AdtCdsUnitTest_1.AdtCdsUnitTest; } });
11
11
  var AdtUnitTest_1 = require("./AdtUnitTest");
12
12
  Object.defineProperty(exports, "AdtUnitTest", { enumerable: true, get: function () { return AdtUnitTest_1.AdtUnitTest; } });
13
+ var AdtUnitTestLegacy_1 = require("./AdtUnitTestLegacy");
14
+ Object.defineProperty(exports, "AdtUnitTestLegacy", { enumerable: true, get: function () { return AdtUnitTestLegacy_1.AdtUnitTestLegacy; } });
@@ -0,0 +1,19 @@
1
+ /**
2
+ * ABAP Unit test run operations for legacy systems (BASIS < 7.50)
3
+ *
4
+ * Legacy systems use:
5
+ * - /sap/bc/adt/abapunit/testruns instead of /sap/bc/adt/abapunit/runs
6
+ * - application/xml for Content-Type and Accept (not versioned vnd.sap.adt.api.abapunit.* types)
7
+ */
8
+ import type { IAdtResponse as AxiosResponse, IAbapConnection } from '@mcp-abap-adt/interfaces';
9
+ import type { IClassUnitTestDefinition, IClassUnitTestRunOptions } from './types';
10
+ /**
11
+ * Start ABAP Unit test run on legacy systems
12
+ * Uses /sap/bc/adt/abapunit/testruns endpoint with application/xml content type
13
+ */
14
+ export declare function startClassUnitTestRunLegacy(connection: IAbapConnection, tests: IClassUnitTestDefinition[], options?: IClassUnitTestRunOptions): Promise<AxiosResponse>;
15
+ export declare function getClassUnitTestStatusLegacy(connection: IAbapConnection, runId: string, withLongPolling?: boolean): Promise<AxiosResponse>;
16
+ export declare function getClassUnitTestResultLegacy(connection: IAbapConnection, runId: string, options?: {
17
+ withNavigationUris?: boolean;
18
+ }): Promise<AxiosResponse>;
19
+ //# sourceMappingURL=runLegacy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runLegacy.d.ts","sourceRoot":"","sources":["../../../src/core/unitTest/runLegacy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,YAAY,IAAI,aAAa,EAC7B,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,SAAS,CAAC;AASjB;;;GAGG;AACH,wBAAsB,2BAA2B,CAC/C,UAAU,EAAE,eAAe,EAC3B,KAAK,EAAE,wBAAwB,EAAE,EACjC,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,aAAa,CAAC,CAiDxB;AAED,wBAAsB,4BAA4B,CAChD,UAAU,EAAE,eAAe,EAC3B,KAAK,EAAE,MAAM,EACb,eAAe,GAAE,OAAc,GAC9B,OAAO,CAAC,aAAa,CAAC,CAaxB;AAED,wBAAsB,4BAA4B,CAChD,UAAU,EAAE,eAAe,EAC3B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IAAE,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAAE,GACzC,OAAO,CAAC,aAAa,CAAC,CAkBxB"}
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ /**
3
+ * ABAP Unit test run operations for legacy systems (BASIS < 7.50)
4
+ *
5
+ * Legacy systems use:
6
+ * - /sap/bc/adt/abapunit/testruns instead of /sap/bc/adt/abapunit/runs
7
+ * - application/xml for Content-Type and Accept (not versioned vnd.sap.adt.api.abapunit.* types)
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.startClassUnitTestRunLegacy = startClassUnitTestRunLegacy;
11
+ exports.getClassUnitTestStatusLegacy = getClassUnitTestStatusLegacy;
12
+ exports.getClassUnitTestResultLegacy = getClassUnitTestResultLegacy;
13
+ const internalUtils_1 = require("../../utils/internalUtils");
14
+ const timeouts_1 = require("../../utils/timeouts");
15
+ const CT_XML = 'application/xml';
16
+ const ACCEPT_XML = 'application/xml';
17
+ function boolAttr(value, fallback) {
18
+ return (value ?? fallback) ? 'true' : 'false';
19
+ }
20
+ /**
21
+ * Start ABAP Unit test run on legacy systems
22
+ * Uses /sap/bc/adt/abapunit/testruns endpoint with application/xml content type
23
+ */
24
+ async function startClassUnitTestRunLegacy(connection, tests, options) {
25
+ if (!tests.length) {
26
+ throw new Error('At least one test definition is required');
27
+ }
28
+ const scope = options?.scope ?? {
29
+ ownTests: true,
30
+ foreignTests: false,
31
+ addForeignTestsAsPreview: true,
32
+ };
33
+ const risk = options?.riskLevel ?? {
34
+ harmless: true,
35
+ dangerous: true,
36
+ critical: true,
37
+ };
38
+ const duration = options?.duration ?? {
39
+ short: true,
40
+ medium: true,
41
+ long: true,
42
+ };
43
+ const testsXml = tests
44
+ .map((test) => `<aunit:test containerClass="${(0, internalUtils_1.encodeSapObjectName)(test.containerClass).toUpperCase()}" class="${test.testClass}"/>`)
45
+ .join('');
46
+ const xml = `<?xml version="1.0" encoding="UTF-8"?><aunit:run xmlns:aunit="http://www.sap.com/adt/api/aunit" title="${options?.title || tests[0].testClass}" context="${options?.context || 'MCP ABAP ADT Client'}">
47
+ <aunit:options>
48
+ <aunit:scope ownTests="${boolAttr(scope.ownTests, true)}" foreignTests="${boolAttr(scope.foreignTests, false)}" addForeignTestsAsPreview="${boolAttr(scope.addForeignTestsAsPreview, true)}"/>
49
+ <aunit:riskLevel harmless="${boolAttr(risk.harmless, true)}" dangerous="${boolAttr(risk.dangerous, true)}" critical="${boolAttr(risk.critical, true)}"/>
50
+ <aunit:duration short="${boolAttr(duration.short, true)}" medium="${boolAttr(duration.medium, true)}" long="${boolAttr(duration.long, true)}"/>
51
+ </aunit:options>
52
+ <aunit:tests>
53
+ ${testsXml}
54
+ </aunit:tests>
55
+ </aunit:run>`;
56
+ return connection.makeAdtRequest({
57
+ url: '/sap/bc/adt/abapunit/testruns',
58
+ method: 'POST',
59
+ timeout: (0, timeouts_1.getTimeout)('default'),
60
+ data: xml,
61
+ headers: {
62
+ 'Content-Type': CT_XML,
63
+ Accept: ACCEPT_XML,
64
+ },
65
+ });
66
+ }
67
+ async function getClassUnitTestStatusLegacy(connection, runId, withLongPolling = true) {
68
+ if (!runId) {
69
+ throw new Error('runId is required');
70
+ }
71
+ const query = withLongPolling ? '?withLongPolling=true' : '';
72
+ return connection.makeAdtRequest({
73
+ url: `/sap/bc/adt/abapunit/testruns/${runId}${query}`,
74
+ method: 'GET',
75
+ timeout: (0, timeouts_1.getTimeout)('default'),
76
+ headers: {
77
+ Accept: ACCEPT_XML,
78
+ },
79
+ });
80
+ }
81
+ async function getClassUnitTestResultLegacy(connection, runId, options) {
82
+ if (!runId) {
83
+ throw new Error('runId is required');
84
+ }
85
+ const params = [];
86
+ if (options?.withNavigationUris === false) {
87
+ params.push('withNavigationUris=false');
88
+ }
89
+ const query = params.length ? `?${params.join('&')}` : '';
90
+ return connection.makeAdtRequest({
91
+ url: `/sap/bc/adt/abapunit/testruns/${runId}/results${query}`,
92
+ method: 'GET',
93
+ timeout: (0, timeouts_1.getTimeout)('default'),
94
+ headers: {
95
+ Accept: ACCEPT_XML,
96
+ },
97
+ });
98
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/adt-clients",
3
- "version": "3.5.0",
3
+ "version": "3.6.0",
4
4
  "description": "ADT clients for SAP ABAP systems - AdtClient and AdtRuntimeClient",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",