@mcp-abap-adt/adt-clients 5.7.0 → 5.8.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/dist/core/functionInclude/AdtFunctionInclude.d.ts +14 -2
- package/dist/core/functionInclude/AdtFunctionInclude.d.ts.map +1 -1
- package/dist/core/functionInclude/AdtFunctionInclude.js +19 -5
- package/dist/core/functionInclude/delete.d.ts.map +1 -1
- package/dist/core/functionInclude/delete.js +43 -0
- package/package.json +1 -1
|
@@ -46,9 +46,21 @@ export declare class AdtFunctionInclude implements IAdtObject<IFunctionIncludeCo
|
|
|
46
46
|
*/
|
|
47
47
|
create(config: IFunctionIncludeConfig, options?: IAdtOperationOptions): Promise<IFunctionIncludeState>;
|
|
48
48
|
/**
|
|
49
|
-
* Read function include
|
|
49
|
+
* Read function include SOURCE code.
|
|
50
|
+
*
|
|
51
|
+
* Per the IAdtObject contract, `read()` returns source for objects that have
|
|
52
|
+
* it (metadata is available via `readMetadata()`). This object has source, so
|
|
53
|
+
* `read()` is an alias of `readSource()`. (Historically it returned metadata,
|
|
54
|
+
* which was inconsistent with class/program/function-module `read()`.)
|
|
50
55
|
*/
|
|
51
|
-
read(config: Partial<IFunctionIncludeConfig>, version?: 'active' | 'inactive',
|
|
56
|
+
read(config: Partial<IFunctionIncludeConfig>, version?: 'active' | 'inactive', _options?: IReadOptions): Promise<IFunctionIncludeState | undefined>;
|
|
57
|
+
/**
|
|
58
|
+
* Low-level metadata read (the object's `finclude` XML), with 404 -> undefined.
|
|
59
|
+
* Used by readMetadata() and by the create/update readiness polling, which
|
|
60
|
+
* need metadata semantics and long-polling options (the source endpoint does
|
|
61
|
+
* not take them).
|
|
62
|
+
*/
|
|
63
|
+
private readMetadataRaw;
|
|
52
64
|
/**
|
|
53
65
|
* Read function include source code.
|
|
54
66
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdtFunctionInclude.d.ts","sourceRoot":"","sources":["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,EAAE,OAAO,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAepE;;OAEG;IACG,MAAM,CACV,MAAM,EAAE,OAAO,CAAC,sBAAsB,CAAC,EACvC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,qBAAqB,CAAC;CAelC"}
|
|
@@ -165,9 +165,23 @@ class AdtFunctionInclude {
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
168
|
-
* Read function include
|
|
168
|
+
* Read function include SOURCE code.
|
|
169
|
+
*
|
|
170
|
+
* Per the IAdtObject contract, `read()` returns source for objects that have
|
|
171
|
+
* it (metadata is available via `readMetadata()`). This object has source, so
|
|
172
|
+
* `read()` is an alias of `readSource()`. (Historically it returned metadata,
|
|
173
|
+
* which was inconsistent with class/program/function-module `read()`.)
|
|
169
174
|
*/
|
|
170
|
-
async read(config, version,
|
|
175
|
+
async read(config, version, _options) {
|
|
176
|
+
return this.readSource(config, version);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Low-level metadata read (the object's `finclude` XML), with 404 -> undefined.
|
|
180
|
+
* Used by readMetadata() and by the create/update readiness polling, which
|
|
181
|
+
* need metadata semantics and long-polling options (the source endpoint does
|
|
182
|
+
* not take them).
|
|
183
|
+
*/
|
|
184
|
+
async readMetadataRaw(config, version, options) {
|
|
171
185
|
if (!config.functionGroupName) {
|
|
172
186
|
throw new Error('Function group name is required');
|
|
173
187
|
}
|
|
@@ -234,7 +248,7 @@ class AdtFunctionInclude {
|
|
|
234
248
|
throw error;
|
|
235
249
|
}
|
|
236
250
|
try {
|
|
237
|
-
const readState = await this.
|
|
251
|
+
const readState = await this.readMetadataRaw(config, options?.version ?? 'active', options);
|
|
238
252
|
if (readState) {
|
|
239
253
|
state.metadataResult = readState.readResult;
|
|
240
254
|
state.readResult = readState.readResult;
|
|
@@ -315,7 +329,7 @@ class AdtFunctionInclude {
|
|
|
315
329
|
// Wait for object to be ready after update
|
|
316
330
|
this.logger?.info?.('read (wait for object ready after update)');
|
|
317
331
|
try {
|
|
318
|
-
await this.
|
|
332
|
+
await this.readMetadataRaw({
|
|
319
333
|
functionGroupName: fullConfig.functionGroupName,
|
|
320
334
|
includeName: fullConfig.includeName,
|
|
321
335
|
}, 'active', { withLongPolling: true });
|
|
@@ -341,7 +355,7 @@ class AdtFunctionInclude {
|
|
|
341
355
|
const activateResponse = await (0, activation_1.activateFunctionInclude)(this.connection, fullConfig.functionGroupName, fullConfig.includeName);
|
|
342
356
|
state.activateResult = activateResponse;
|
|
343
357
|
try {
|
|
344
|
-
const readState = await this.
|
|
358
|
+
const readState = await this.readMetadataRaw({
|
|
345
359
|
functionGroupName: fullConfig.functionGroupName,
|
|
346
360
|
includeName: fullConfig.includeName,
|
|
347
361
|
}, 'active', { withLongPolling: true });
|
|
@@ -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;
|
|
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: {
|