@mcp-abap-adt/adt-clients 5.7.0 → 5.7.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.
@@ -1 +1 @@
1
- {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/core/functionInclude/delete.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,YAAY,IAAI,aAAa,EAC7B,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAUlC,MAAM,WAAW,4BAA4B;IAC3C,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAQD;;GAEG;AACH,wBAAsB,aAAa,CACjC,UAAU,EAAE,eAAe,EAC3B,MAAM,EAAE,4BAA4B,GACnC,OAAO,CAAC,aAAa,CAAC,CAyBxB;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,eAAe,EAC3B,MAAM,EAAE,4BAA4B,GACnC,OAAO,CAAC,aAAa,CAAC,CA0CxB"}
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/core/functionInclude/delete.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,YAAY,IAAI,aAAa,EAC7B,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAgElC,MAAM,WAAW,4BAA4B;IAC3C,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAQD;;GAEG;AACH,wBAAsB,aAAa,CACjC,UAAU,EAAE,eAAe,EAC3B,MAAM,EAAE,4BAA4B,GACnC,OAAO,CAAC,aAAa,CAAC,CAyBxB;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,eAAe,EAC3B,MAAM,EAAE,4BAA4B,GACnC,OAAO,CAAC,aAAa,CAAC,CA8CxB"}
@@ -5,9 +5,49 @@
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.checkDeletion = checkDeletion;
7
7
  exports.deleteFunctionInclude = deleteFunctionInclude;
8
+ const fast_xml_parser_1 = require("fast-xml-parser");
8
9
  const contentTypes_1 = require("../../constants/contentTypes");
9
10
  const internalUtils_1 = require("../../utils/internalUtils");
10
11
  const timeouts_1 = require("../../utils/timeouts");
12
+ /**
13
+ * Parse a `del:deletionResult` and throw if the server did not delete.
14
+ *
15
+ * The ADT deletion service answers HTTP 200 even when it refuses to delete:
16
+ * `<del:object del:isDeleted="false"><del:message del:type="E"><del:text>…`.
17
+ * Some function-group includes can only be removed via the Function Builder, so
18
+ * we MUST surface that instead of reporting a phantom success.
19
+ */
20
+ function assertDeleted(responseData, includeName) {
21
+ const parser = new fast_xml_parser_1.XMLParser({
22
+ ignoreAttributes: false,
23
+ attributeNamePrefix: '@_',
24
+ });
25
+ let deleteObject;
26
+ try {
27
+ const result = parser.parse(String(responseData ?? ''));
28
+ const deletionResult = (result['del:deletionResult'] ??
29
+ result.deletionResult);
30
+ deleteObject = (deletionResult?.['del:object'] ??
31
+ deletionResult?.object);
32
+ }
33
+ catch {
34
+ // Malformed/empty body — treat as a failed parse below.
35
+ deleteObject = undefined;
36
+ }
37
+ const isDeleted = deleteObject?.['@_del:isDeleted'] === 'true' ||
38
+ deleteObject?.['@_isDeleted'] === 'true';
39
+ if (isDeleted) {
40
+ return;
41
+ }
42
+ // `del:text` may be a plain string, or an object ({ '#text', atom:link }) when
43
+ // the message carries a longtext link — normalize both to the text.
44
+ const rawText = deleteObject?.['del:message']?.['del:text'] ??
45
+ deleteObject?.message?.text;
46
+ const message = typeof rawText === 'string'
47
+ ? rawText
48
+ : rawText?.['#text'];
49
+ throw new Error(`Function include ${includeName} was not deleted${message ? `: ${message}` : ' (server reported isDeleted=false)'}`);
50
+ }
11
51
  function objectUri(groupName, includeName) {
12
52
  const groupLower = (0, internalUtils_1.encodeSapObjectName)(groupName).toLowerCase();
13
53
  const encodedInclude = (0, internalUtils_1.encodeSapObjectName)(includeName.toUpperCase());
@@ -69,6 +109,9 @@ async function deleteFunctionInclude(connection, params) {
69
109
  'Content-Type': contentTypes_1.CT_DELETION,
70
110
  },
71
111
  });
112
+ // The service returns HTTP 200 even when it refuses to delete; verify the
113
+ // result element instead of assuming success.
114
+ assertDeleted(response.data, params.include_name);
72
115
  return {
73
116
  ...response,
74
117
  data: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/adt-clients",
3
- "version": "5.7.0",
3
+ "version": "5.7.1",
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",