@rayutek/abap-adt-api 6.2.1-pkg-1.0.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/.abapgit.xml +27 -0
- package/LICENSE +21 -0
- package/README.md +23 -0
- package/build/AdtClient.d.ts +292 -0
- package/build/AdtClient.d.ts.map +1 -0
- package/build/AdtClient.js +628 -0
- package/build/AdtException.d.ts +62 -0
- package/build/AdtException.d.ts.map +1 -0
- package/build/AdtException.js +185 -0
- package/build/AdtHTTP.d.ts +113 -0
- package/build/AdtHTTP.d.ts.map +1 -0
- package/build/AdtHTTP.js +285 -0
- package/build/api/abapgit.d.ts +86 -0
- package/build/api/abapgit.d.ts.map +1 -0
- package/build/api/abapgit.js +300 -0
- package/build/api/activate.d.ts +39 -0
- package/build/api/activate.d.ts.map +1 -0
- package/build/api/activate.js +105 -0
- package/build/api/atc.d.ts +163 -0
- package/build/api/atc.d.ts.map +1 -0
- package/build/api/atc.js +440 -0
- package/build/api/cds.d.ts +52 -0
- package/build/api/cds.d.ts.map +1 -0
- package/build/api/cds.js +147 -0
- package/build/api/debugger.d.ts +238 -0
- package/build/api/debugger.d.ts.map +1 -0
- package/build/api/debugger.js +299 -0
- package/build/api/delete.d.ts +20 -0
- package/build/api/delete.d.ts.map +1 -0
- package/build/api/delete.js +29 -0
- package/build/api/discovery.d.ts +44 -0
- package/build/api/discovery.d.ts.map +1 -0
- package/build/api/discovery.js +78 -0
- package/build/api/feeds.d.ts +63 -0
- package/build/api/feeds.d.ts.map +1 -0
- package/build/api/feeds.js +65 -0
- package/build/api/index.d.ts +22 -0
- package/build/api/index.d.ts.map +1 -0
- package/build/api/index.js +37 -0
- package/build/api/nodeContents.d.ts +41 -0
- package/build/api/nodeContents.d.ts.map +1 -0
- package/build/api/nodeContents.js +78 -0
- package/build/api/objectcontents.d.ts +21 -0
- package/build/api/objectcontents.d.ts.map +1 -0
- package/build/api/objectcontents.js +68 -0
- package/build/api/objectcreator.d.ts +103 -0
- package/build/api/objectcreator.d.ts.map +1 -0
- package/build/api/objectcreator.js +372 -0
- package/build/api/objectstructure.d.ts +71 -0
- package/build/api/objectstructure.d.ts.map +1 -0
- package/build/api/objectstructure.js +37 -0
- package/build/api/refactor.d.ts +122 -0
- package/build/api/refactor.d.ts.map +1 -0
- package/build/api/refactor.js +470 -0
- package/build/api/revisions.d.ts +12 -0
- package/build/api/revisions.d.ts.map +1 -0
- package/build/api/revisions.js +61 -0
- package/build/api/search.d.ts +25 -0
- package/build/api/search.d.ts.map +1 -0
- package/build/api/search.js +67 -0
- package/build/api/syntax.d.ts +133 -0
- package/build/api/syntax.d.ts.map +1 -0
- package/build/api/syntax.js +327 -0
- package/build/api/tablecontents.d.ts +141 -0
- package/build/api/tablecontents.d.ts.map +1 -0
- package/build/api/tablecontents.js +186 -0
- package/build/api/trace.test.d.ts +2 -0
- package/build/api/trace.test.d.ts.map +1 -0
- package/build/api/trace.test.js +39 -0
- package/build/api/traces.d.ts +13 -0
- package/build/api/traces.d.ts.map +1 -0
- package/build/api/traces.js +97 -0
- package/build/api/tracetypes.d.ts +276 -0
- package/build/api/tracetypes.d.ts.map +1 -0
- package/build/api/tracetypes.js +474 -0
- package/build/api/transports.d.ts +158 -0
- package/build/api/transports.d.ts.map +1 -0
- package/build/api/transports.js +292 -0
- package/build/api/unittest.d.ts +81 -0
- package/build/api/unittest.d.ts.map +1 -0
- package/build/api/unittest.js +164 -0
- package/build/api/urlparser.d.ts +34 -0
- package/build/api/urlparser.d.ts.map +1 -0
- package/build/api/urlparser.js +86 -0
- package/build/index.d.ts +10 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +49 -0
- package/build/requestLogger.d.ts +30 -0
- package/build/requestLogger.d.ts.map +1 -0
- package/build/requestLogger.js +100 -0
- package/build/utilities.d.ts +42 -0
- package/build/utilities.d.ts.map +1 -0
- package/build/utilities.js +221 -0
- package/jest.config.js +32 -0
- package/package.json +45 -0
- package/setenv_sample.js +27 -0
package/build/api/atc.js
ADDED
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.atcChangeContact = exports.atcContactUri = exports.atcRequestExemption = exports.atcExemptProposal = exports.atcUsers = exports.atcWorklists = exports.createAtcRun = exports.atcCheckVariant = exports.atcCustomizing = exports.isProposalMessage = void 0;
|
|
27
|
+
const utilities_1 = require("../utilities");
|
|
28
|
+
const t = __importStar(require("io-ts"));
|
|
29
|
+
const __1 = require("..");
|
|
30
|
+
const urlparser_1 = require("./urlparser");
|
|
31
|
+
const exemptionKind = t.union([
|
|
32
|
+
t.literal("A"),
|
|
33
|
+
t.literal("I"),
|
|
34
|
+
t.literal(""),
|
|
35
|
+
t.string
|
|
36
|
+
]); // SATC_AC_RSLT_XMPT_KIND Atc based/Inline/none
|
|
37
|
+
const proposalFinding = (0, utilities_1.mixed)({
|
|
38
|
+
uri: t.string,
|
|
39
|
+
type: t.string,
|
|
40
|
+
name: t.string,
|
|
41
|
+
location: t.string,
|
|
42
|
+
processor: t.string,
|
|
43
|
+
lastChangedBy: t.string,
|
|
44
|
+
priority: t.number,
|
|
45
|
+
checkId: t.string,
|
|
46
|
+
checkTitle: t.string,
|
|
47
|
+
messageId: t.string,
|
|
48
|
+
messageTitle: t.string,
|
|
49
|
+
exemptionApproval: t.string,
|
|
50
|
+
exemptionKind,
|
|
51
|
+
checksum: t.number,
|
|
52
|
+
quickfixInfo: t.string
|
|
53
|
+
}, {
|
|
54
|
+
quickfixes: t.partial({
|
|
55
|
+
automatic: t.boolean,
|
|
56
|
+
manual: t.boolean,
|
|
57
|
+
pseudo: t.boolean
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
const restriction = t.type({
|
|
61
|
+
enabled: t.boolean,
|
|
62
|
+
singlefinding: t.boolean,
|
|
63
|
+
rangeOfFindings: t.type({
|
|
64
|
+
enabled: t.boolean,
|
|
65
|
+
restrictByObject: t.type({
|
|
66
|
+
object: t.boolean,
|
|
67
|
+
package: t.boolean,
|
|
68
|
+
subobject: t.boolean,
|
|
69
|
+
target: t.union([
|
|
70
|
+
t.literal("subobject"),
|
|
71
|
+
t.literal("object"),
|
|
72
|
+
t.literal("package"),
|
|
73
|
+
t.literal("")
|
|
74
|
+
])
|
|
75
|
+
}),
|
|
76
|
+
restrictByCheck: t.type({
|
|
77
|
+
check: t.boolean,
|
|
78
|
+
message: t.boolean,
|
|
79
|
+
target: t.union([t.literal("message"), t.literal("check"), t.literal("")])
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
const atcProposal = (0, utilities_1.mixed)({
|
|
84
|
+
finding: t.union([proposalFinding, t.string]),
|
|
85
|
+
package: t.string,
|
|
86
|
+
subObject: t.string,
|
|
87
|
+
subObjectType: t.string,
|
|
88
|
+
subObjectTypeDescr: t.string,
|
|
89
|
+
objectTypeDescr: t.string,
|
|
90
|
+
approver: t.string,
|
|
91
|
+
reason: t.union([t.literal("FPOS"), t.literal("OTHR"), t.literal("")]),
|
|
92
|
+
justification: t.string,
|
|
93
|
+
notify: t.union([
|
|
94
|
+
t.literal("never"),
|
|
95
|
+
t.literal("on_rejection"),
|
|
96
|
+
t.literal("always")
|
|
97
|
+
]),
|
|
98
|
+
restriction: restriction
|
|
99
|
+
}, {
|
|
100
|
+
apprIsArea: t.string,
|
|
101
|
+
checkClass: t.string,
|
|
102
|
+
validUntil: t.string
|
|
103
|
+
});
|
|
104
|
+
const atcProposalMessage = t.type({
|
|
105
|
+
type: t.string,
|
|
106
|
+
message: t.string
|
|
107
|
+
});
|
|
108
|
+
const atcRunResultInfo = t.type({
|
|
109
|
+
type: t.string,
|
|
110
|
+
description: t.string
|
|
111
|
+
});
|
|
112
|
+
const atcRunResult = t.type({
|
|
113
|
+
id: t.string,
|
|
114
|
+
timestamp: t.number,
|
|
115
|
+
infos: t.array(atcRunResultInfo)
|
|
116
|
+
});
|
|
117
|
+
const atcExcemption = t.type({
|
|
118
|
+
id: t.string,
|
|
119
|
+
justificationMandatory: t.boolean,
|
|
120
|
+
title: t.string
|
|
121
|
+
});
|
|
122
|
+
const atcProperty = t.type({
|
|
123
|
+
name: t.string,
|
|
124
|
+
value: t.union([t.boolean, t.string])
|
|
125
|
+
});
|
|
126
|
+
const atcCustomizingi = t.type({
|
|
127
|
+
properties: t.array(atcProperty),
|
|
128
|
+
excemptions: t.array(atcExcemption)
|
|
129
|
+
});
|
|
130
|
+
const objectSet = t.type({
|
|
131
|
+
name: t.string,
|
|
132
|
+
title: t.string,
|
|
133
|
+
kind: t.string
|
|
134
|
+
});
|
|
135
|
+
const link = t.type({
|
|
136
|
+
href: t.string,
|
|
137
|
+
rel: t.string,
|
|
138
|
+
type: t.string
|
|
139
|
+
});
|
|
140
|
+
const finding = t.type({
|
|
141
|
+
uri: t.string,
|
|
142
|
+
location: urlparser_1.uriParts,
|
|
143
|
+
priority: t.number,
|
|
144
|
+
checkId: t.string,
|
|
145
|
+
checkTitle: t.string,
|
|
146
|
+
messageId: t.string,
|
|
147
|
+
messageTitle: t.string,
|
|
148
|
+
exemptionApproval: t.string,
|
|
149
|
+
exemptionKind,
|
|
150
|
+
quickfixInfo: (0, utilities_1.orUndefined)(t.string),
|
|
151
|
+
link: link
|
|
152
|
+
});
|
|
153
|
+
const object = t.type({
|
|
154
|
+
uri: t.string,
|
|
155
|
+
type: t.string,
|
|
156
|
+
name: t.string,
|
|
157
|
+
packageName: t.string,
|
|
158
|
+
author: t.string,
|
|
159
|
+
objectTypeId: (0, utilities_1.orUndefined)(t.string),
|
|
160
|
+
findings: t.array(finding)
|
|
161
|
+
});
|
|
162
|
+
const atcWorklist = t.type({
|
|
163
|
+
id: t.string,
|
|
164
|
+
timestamp: t.number,
|
|
165
|
+
usedObjectSet: t.string,
|
|
166
|
+
objectSetIsComplete: t.boolean,
|
|
167
|
+
objectSets: t.array(objectSet),
|
|
168
|
+
objects: t.array(object)
|
|
169
|
+
});
|
|
170
|
+
const atcUser = t.type({
|
|
171
|
+
id: t.string,
|
|
172
|
+
title: t.string
|
|
173
|
+
});
|
|
174
|
+
exports.isProposalMessage = atcProposalMessage.is;
|
|
175
|
+
async function atcCustomizing(h) {
|
|
176
|
+
const headers = {
|
|
177
|
+
Accept: "application/xml, application/vnd.sap.atc.customizing-v1+xml"
|
|
178
|
+
};
|
|
179
|
+
const response = await h.request("/sap/bc/adt/atc/customizing", { headers });
|
|
180
|
+
const raw = (0, utilities_1.fullParse)(response.body, {
|
|
181
|
+
removeNSPrefix: true,
|
|
182
|
+
parseTagValue: false
|
|
183
|
+
});
|
|
184
|
+
const properties = (0, utilities_1.xmlArray)(raw, "customizing", "properties", "property").map(utilities_1.xmlNodeAttr);
|
|
185
|
+
const excemptions = (0, utilities_1.xmlArray)(raw, "customizing", "exemption", "reasons", "reason").map(utilities_1.xmlNodeAttr);
|
|
186
|
+
const retval = { properties, excemptions };
|
|
187
|
+
return (0, __1.validateParseResult)(atcCustomizingi.decode(retval));
|
|
188
|
+
}
|
|
189
|
+
exports.atcCustomizing = atcCustomizing;
|
|
190
|
+
async function atcCheckVariant(h, variant) {
|
|
191
|
+
const headers = { Accept: "text/plain" };
|
|
192
|
+
const response = await h.request(`/sap/bc/adt/atc/worklists?checkVariant=${variant}`, { method: "POST", headers });
|
|
193
|
+
return response.body;
|
|
194
|
+
}
|
|
195
|
+
exports.atcCheckVariant = atcCheckVariant;
|
|
196
|
+
async function createAtcRun(h, variant, mainUrl, maxResults = 100) {
|
|
197
|
+
const body = `<?xml version="1.0" encoding="UTF-8"?>
|
|
198
|
+
<atc:run maximumVerdicts="${maxResults}" xmlns:atc="http://www.sap.com/adt/atc">
|
|
199
|
+
<objectSets xmlns:adtcore="http://www.sap.com/adt/core">
|
|
200
|
+
<objectSet kind="inclusive">
|
|
201
|
+
<adtcore:objectReferences>
|
|
202
|
+
<adtcore:objectReference adtcore:uri="${mainUrl}"/>
|
|
203
|
+
</adtcore:objectReferences>
|
|
204
|
+
</objectSet>
|
|
205
|
+
</objectSets>
|
|
206
|
+
</atc:run>`;
|
|
207
|
+
const headers = {
|
|
208
|
+
Accept: "application/xml",
|
|
209
|
+
"Content-Type": "application/xml"
|
|
210
|
+
};
|
|
211
|
+
const response = await h.request(`/sap/bc/adt/atc/runs?worklistId=${variant}`, { method: "POST", headers, body });
|
|
212
|
+
const raw = (0, utilities_1.fullParse)(response.body, {
|
|
213
|
+
removeNSPrefix: true,
|
|
214
|
+
parseTagValue: false
|
|
215
|
+
});
|
|
216
|
+
const id = (0, utilities_1.xmlNode)(raw, "worklistRun", "worklistId");
|
|
217
|
+
const ts = (0, utilities_1.xmlNode)(raw, "worklistRun", "worklistTimestamp");
|
|
218
|
+
const infos = (0, utilities_1.xmlArray)(raw, "worklistRun", "infos", "info");
|
|
219
|
+
const retval = { id, timestamp: new Date(ts).getTime() / 1000, infos };
|
|
220
|
+
return (0, __1.validateParseResult)(atcRunResult.decode(retval));
|
|
221
|
+
}
|
|
222
|
+
exports.createAtcRun = createAtcRun;
|
|
223
|
+
async function atcWorklists(h, runResultId, timestamp, usedObjectSet, includeExemptedFindings = false) {
|
|
224
|
+
const headers = { Accept: "application/atc.worklist.v1+xml" };
|
|
225
|
+
const qs = { timestamp, usedObjectSet, includeExemptedFindings };
|
|
226
|
+
const response = await h.request(`/sap/bc/adt/atc/worklists/${runResultId}`, {
|
|
227
|
+
headers,
|
|
228
|
+
qs
|
|
229
|
+
});
|
|
230
|
+
const raw = (0, utilities_1.fullParse)(response.body, {
|
|
231
|
+
removeNSPrefix: true,
|
|
232
|
+
parseTagValue: false,
|
|
233
|
+
numberParseOptions: utilities_1.numberParseOptions
|
|
234
|
+
});
|
|
235
|
+
const root = (0, utilities_1.xmlNode)(raw, "worklist");
|
|
236
|
+
const attrs = (0, utilities_1.xmlNodeAttr)(root);
|
|
237
|
+
const objectSets = (0, utilities_1.xmlArray)(root, "objectSets", "objectSet").map(utilities_1.xmlNodeAttr);
|
|
238
|
+
const objects = (0, utilities_1.xmlArray)(root, "objects", "object").map(o => {
|
|
239
|
+
const oa = (0, utilities_1.xmlNodeAttr)(o);
|
|
240
|
+
const findings = (0, utilities_1.xmlArray)(o, "findings", "finding").map(f => {
|
|
241
|
+
const fa = (0, utilities_1.xmlNodeAttr)(f);
|
|
242
|
+
const priority = (0, utilities_1.toInt)(fa.priority);
|
|
243
|
+
const link = (0, utilities_1.xmlNodeAttr)((0, utilities_1.xmlNode)(f, "link"));
|
|
244
|
+
const location = (0, urlparser_1.parseUri)(fa.location);
|
|
245
|
+
const messageTitle = fa.messageTitle;
|
|
246
|
+
const checkTitle = fa.checkTitle;
|
|
247
|
+
return {
|
|
248
|
+
...fa,
|
|
249
|
+
priority,
|
|
250
|
+
messageTitle,
|
|
251
|
+
checkTitle,
|
|
252
|
+
location,
|
|
253
|
+
messageId: `${fa.messageId}`,
|
|
254
|
+
link
|
|
255
|
+
};
|
|
256
|
+
});
|
|
257
|
+
return { ...oa, findings };
|
|
258
|
+
});
|
|
259
|
+
const ts = new Date(attrs.timestamp).getTime() / 1000;
|
|
260
|
+
const result = { ...attrs, timestamp: ts, objectSets, objects };
|
|
261
|
+
return (0, __1.validateParseResult)(atcWorklist.decode(result));
|
|
262
|
+
}
|
|
263
|
+
exports.atcWorklists = atcWorklists;
|
|
264
|
+
async function atcUsers(h) {
|
|
265
|
+
const headers = { Accept: "application/atom+xml;type=feed" };
|
|
266
|
+
const response = await h.request(`/sap/bc/adt/system/users`, { headers });
|
|
267
|
+
const raw = (0, utilities_1.fullParse)(response.body, {
|
|
268
|
+
removeNSPrefix: true,
|
|
269
|
+
parseTagValue: false,
|
|
270
|
+
parseAttributeValue: false
|
|
271
|
+
});
|
|
272
|
+
const users = (0, utilities_1.xmlArray)(raw, "feed", "entry");
|
|
273
|
+
return (0, __1.validateParseResult)(t.array(atcUser).decode(users));
|
|
274
|
+
}
|
|
275
|
+
exports.atcUsers = atcUsers;
|
|
276
|
+
async function atcExemptProposal(h, markerId) {
|
|
277
|
+
const headers = {
|
|
278
|
+
Accept: "application/atc.xmpt.v1+xml, application/atc.xmptapp.v1+xml"
|
|
279
|
+
};
|
|
280
|
+
const qs = { markerId };
|
|
281
|
+
const response = await h.request(`/sap/bc/adt/atc/exemptions/apply`, {
|
|
282
|
+
headers,
|
|
283
|
+
qs
|
|
284
|
+
});
|
|
285
|
+
const raw = (0, utilities_1.fullParse)(response.body, {
|
|
286
|
+
removeNSPrefix: true,
|
|
287
|
+
parseTagValue: false,
|
|
288
|
+
parseAttributeValue: false
|
|
289
|
+
});
|
|
290
|
+
const root = (0, utilities_1.xmlNode)(raw, "exemptionApply", "exemptionProposal");
|
|
291
|
+
const { message, type } = (0, utilities_1.xmlNode)(raw, "exemptionApply", "status") || {};
|
|
292
|
+
if ((0, __1.isErrorMessageType)(type))
|
|
293
|
+
throw (0, __1.adtException)(message);
|
|
294
|
+
if (message && type)
|
|
295
|
+
return (0, __1.validateParseResult)(atcProposalMessage.decode({ message, type }));
|
|
296
|
+
const finding = (0, utilities_1.isString)(root.finding)
|
|
297
|
+
? root.finding
|
|
298
|
+
: (0, utilities_1.xmlNodeAttr)((0, utilities_1.xmlNode)(root, "finding"));
|
|
299
|
+
if (!(0, utilities_1.isString)(finding)) {
|
|
300
|
+
finding.priority = (0, utilities_1.toInt)(finding.priority);
|
|
301
|
+
finding.checksum = (0, utilities_1.toInt)(finding.checksum);
|
|
302
|
+
const qf = (0, utilities_1.xmlNodeAttr)((0, utilities_1.xmlNode)(root, "finding", "quickfixes"));
|
|
303
|
+
finding.quickfixes = {
|
|
304
|
+
automatic: qf.automatic === "true",
|
|
305
|
+
manual: qf.manual === "true",
|
|
306
|
+
pseudo: qf.pseudo === "true"
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
const { package: pa, subObject, subObjectType, subObjectTypeDescr, objectTypeDescr, approver, reason, justification, notify, apprIsArea, checkClass, validUntil } = root;
|
|
310
|
+
const { thisFinding, rangeOfFindings } = (0, utilities_1.xmlNode)(root, "restriction");
|
|
311
|
+
const { restrictByObject, restrictByCheck } = rangeOfFindings;
|
|
312
|
+
const result = {
|
|
313
|
+
finding,
|
|
314
|
+
package: pa,
|
|
315
|
+
subObject,
|
|
316
|
+
subObjectType,
|
|
317
|
+
subObjectTypeDescr,
|
|
318
|
+
objectTypeDescr,
|
|
319
|
+
approver,
|
|
320
|
+
reason,
|
|
321
|
+
justification,
|
|
322
|
+
notify,
|
|
323
|
+
apprIsArea,
|
|
324
|
+
checkClass,
|
|
325
|
+
validUntil,
|
|
326
|
+
restriction: {
|
|
327
|
+
enabled: thisFinding["@_enabled"] === "true",
|
|
328
|
+
singlefinding: thisFinding["#text"] === "true",
|
|
329
|
+
rangeOfFindings: {
|
|
330
|
+
enabled: rangeOfFindings["@_enabled"] === "true",
|
|
331
|
+
restrictByObject: {
|
|
332
|
+
object: restrictByObject["@_object"] === "true",
|
|
333
|
+
package: restrictByObject["@_package"] === "true",
|
|
334
|
+
subobject: restrictByObject["@_subobject"] === "true",
|
|
335
|
+
target: restrictByObject["#text"] || ""
|
|
336
|
+
},
|
|
337
|
+
restrictByCheck: {
|
|
338
|
+
check: restrictByCheck["@_check"] === "true",
|
|
339
|
+
message: restrictByCheck["@_message"] === "true",
|
|
340
|
+
target: restrictByCheck["#text"] || ""
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
return (0, __1.validateParseResult)(atcProposal.decode(result));
|
|
346
|
+
}
|
|
347
|
+
exports.atcExemptProposal = atcExemptProposal;
|
|
348
|
+
async function atcRequestExemption(h, proposal) {
|
|
349
|
+
const headers = {
|
|
350
|
+
"Content-Type": "application/atc.xmptprop.v1+xml",
|
|
351
|
+
Accept: "application/atc.xmpt.v1+xml, application/atc.xmptprop.v1+xml"
|
|
352
|
+
};
|
|
353
|
+
const { finding, restriction: { rangeOfFindings: { restrictByCheck, restrictByObject } }, restriction } = proposal;
|
|
354
|
+
const qs = { markerId: (0, utilities_1.isString)(finding) ? finding : finding.quickfixInfo };
|
|
355
|
+
const findingXml = (0, utilities_1.isString)(finding)
|
|
356
|
+
? `<atcexmpt:finding>${finding}</atcexmpt:finding>`
|
|
357
|
+
: `<atcfinding:finding adtcore:name="${finding.name}" adtcore:type="${finding.type}" adtcore:uri="${finding.uri}"
|
|
358
|
+
atcfinding:checkId="${finding.checkId}" atcfinding:checksum="${finding.checksum}" atcfinding:checkTitle="${(0, utilities_1.encodeEntity)(finding.checkTitle)}"
|
|
359
|
+
atcfinding:exemptionApproval="${finding.exemptionApproval}" atcfinding:exemptionKind="${finding.exemptionKind}"
|
|
360
|
+
atcfinding:lastChangedBy="${finding.lastChangedBy}"
|
|
361
|
+
atcfinding:location="${finding.location}" atcfinding:messageId="${finding.messageId}" atcfinding:messageTitle="${(0, utilities_1.encodeEntity)(finding.messageTitle)}"
|
|
362
|
+
atcfinding:priority="${finding.priority}" atcfinding:processor="${finding.processor}" atcfinding:quickfixInfo="${finding.quickfixInfo}">
|
|
363
|
+
<atcfinding:quickfixes atcfinding:automatic="false" atcfinding:manual="false" atcfinding:pseudo="false" />
|
|
364
|
+
</atcfinding:finding>`;
|
|
365
|
+
const body = `<?xml version="1.0" encoding="ASCII"?>
|
|
366
|
+
<atcexmpt:exemptionProposal xmlns:adtcore="http://www.sap.com/adt/core" xmlns:atcexmpt="http://www.sap.com/adt/atc/exemption" xmlns:atcfinding="http://www.sap.com/adt/atc/finding">
|
|
367
|
+
${findingXml}
|
|
368
|
+
<atcexmpt:package>${proposal.package}</atcexmpt:package>
|
|
369
|
+
<atcexmpt:subObject>${proposal.subObject}</atcexmpt:subObject>
|
|
370
|
+
<atcexmpt:subObjectType>${proposal.subObjectType}</atcexmpt:subObjectType>
|
|
371
|
+
<atcexmpt:subObjectTypeDescr>${proposal.subObjectTypeDescr}</atcexmpt:subObjectTypeDescr>
|
|
372
|
+
<atcexmpt:objectTypeDescr>${proposal.objectTypeDescr}</atcexmpt:objectTypeDescr>
|
|
373
|
+
<atcexmpt:restriction>
|
|
374
|
+
<atcexmpt:thisFinding enabled="${restriction.enabled}">${restriction.singlefinding}</atcexmpt:thisFinding>
|
|
375
|
+
<atcexmpt:rangeOfFindings enabled="${restriction.rangeOfFindings.enabled}">
|
|
376
|
+
<atcexmpt:restrictByObject object="${restrictByObject.object}" package="${restrictByObject.package}" subobject="${restrictByObject.subobject}">
|
|
377
|
+
${restrictByObject.target}</atcexmpt:restrictByObject>
|
|
378
|
+
<atcexmpt:restrictByCheck check="${restrictByCheck.check}" message="${restrictByCheck.message}">
|
|
379
|
+
${restrictByCheck.target}</atcexmpt:restrictByCheck>
|
|
380
|
+
</atcexmpt:rangeOfFindings>
|
|
381
|
+
</atcexmpt:restriction>
|
|
382
|
+
<atcexmpt:approver>${proposal.approver}</atcexmpt:approver>
|
|
383
|
+
<atcexmpt:reason>${proposal.reason}</atcexmpt:reason>
|
|
384
|
+
<atcexmpt:justification>${(0, utilities_1.encodeEntity)(proposal.justification)}</atcexmpt:justification>
|
|
385
|
+
<atcexmpt:notify>${proposal.notify}</atcexmpt:notify>
|
|
386
|
+
<atcexmpt:apprIsArea>${proposal.apprIsArea || ""}</atcexmpt:apprIsArea>
|
|
387
|
+
<atcexmpt:checkClass>${proposal.checkClass || ""}</atcexmpt:checkClass>
|
|
388
|
+
<atcexmpt:validUntil>${proposal.validUntil || ""}</atcexmpt:validUntil>
|
|
389
|
+
</atcexmpt:exemptionProposal>`;
|
|
390
|
+
const response = await h.request(`/sap/bc/adt/atc/exemptions/apply`, {
|
|
391
|
+
headers,
|
|
392
|
+
body,
|
|
393
|
+
qs,
|
|
394
|
+
method: "POST"
|
|
395
|
+
});
|
|
396
|
+
const raw = (0, utilities_1.fullParse)(response.body, {
|
|
397
|
+
removeNSPrefix: true,
|
|
398
|
+
parseTagValue: false,
|
|
399
|
+
parseAttributeValue: false
|
|
400
|
+
});
|
|
401
|
+
const result = (0, __1.validateParseResult)(atcProposalMessage.decode(raw === null || raw === void 0 ? void 0 : raw.status));
|
|
402
|
+
if ((0, __1.isErrorMessageType)(result.type))
|
|
403
|
+
throw (0, __1.adtException)(result.message);
|
|
404
|
+
return (0, __1.validateParseResult)(atcProposalMessage.decode(result));
|
|
405
|
+
}
|
|
406
|
+
exports.atcRequestExemption = atcRequestExemption;
|
|
407
|
+
async function atcContactUri(h, findingUri) {
|
|
408
|
+
const headers = {
|
|
409
|
+
"Content-Type": "application/vnd.sap.adt.atc.findingreferences.v1+xml",
|
|
410
|
+
Accept: "application/vnd.sap.adt.atc.items.v1+xml"
|
|
411
|
+
};
|
|
412
|
+
const qs = { step: "proposal" };
|
|
413
|
+
const body = `<?xml version="1.0" encoding="ASCII"?>
|
|
414
|
+
<atcfinding:findingReferences xmlns:adtcore="http://www.sap.com/adt/core" xmlns:atcfinding="http://www.sap.com/adt/atc/finding">
|
|
415
|
+
<atcfinding:findingReference adtcore:uri="${findingUri}"/>
|
|
416
|
+
</atcfinding:findingReferences>`;
|
|
417
|
+
const response = await h.request(`/sap/bc/adt/atc/items`, {
|
|
418
|
+
headers,
|
|
419
|
+
body,
|
|
420
|
+
method: "POST",
|
|
421
|
+
qs
|
|
422
|
+
});
|
|
423
|
+
const raw = (0, utilities_1.fullParse)(response.body, {
|
|
424
|
+
removeNSPrefix: true,
|
|
425
|
+
parseTagValue: false,
|
|
426
|
+
parseAttributeValue: false
|
|
427
|
+
});
|
|
428
|
+
const { uri } = (0, utilities_1.xmlNodeAttr)((0, utilities_1.xmlNode)(raw, "items", "item"));
|
|
429
|
+
return (0, __1.validateParseResult)(t.string.decode(uri));
|
|
430
|
+
}
|
|
431
|
+
exports.atcContactUri = atcContactUri;
|
|
432
|
+
async function atcChangeContact(h, itemUri, userId) {
|
|
433
|
+
const headers = { "Content-Type": "application/vnd.sap.adt.atc.items.v1+xml" };
|
|
434
|
+
const body = `<?xml version="1.0" encoding="ASCII"?>
|
|
435
|
+
<atcfinding:items xmlns:adtcore="http://www.sap.com/adt/core" xmlns:atcfinding="http://www.sap.com/adt/atc/finding">
|
|
436
|
+
<atcfinding:item adtcore:uri="${itemUri}" atcfinding:processor="${userId}" atcfinding:status="2"/>
|
|
437
|
+
</atcfinding:items>`;
|
|
438
|
+
await h.request(`/sap/bc/adt/atc/items`, { headers, body, method: "PUT" });
|
|
439
|
+
}
|
|
440
|
+
exports.atcChangeContact = atcChangeContact;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AdtHTTP } from "../AdtHTTP";
|
|
2
|
+
import { SyntaxCheckResult } from "./syntax";
|
|
3
|
+
export declare function syntaxCheckCDS(h: AdtHTTP, url: string, mainUrl?: string, content?: string): Promise<SyntaxCheckResult[]>;
|
|
4
|
+
export declare function annotationDefinitions(h: AdtHTTP): Promise<string>;
|
|
5
|
+
export interface DdicAnnotation {
|
|
6
|
+
key: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
9
|
+
export interface DdicProperties {
|
|
10
|
+
elementProps?: {
|
|
11
|
+
ddicIsKey: boolean;
|
|
12
|
+
ddicDataElement: string;
|
|
13
|
+
ddicDataType: string;
|
|
14
|
+
ddicLength: number;
|
|
15
|
+
ddicDecimals?: number;
|
|
16
|
+
ddicHeading?: string;
|
|
17
|
+
ddicLabelShort?: string;
|
|
18
|
+
ddicLabelMedium?: string;
|
|
19
|
+
ddicLabelLong?: string;
|
|
20
|
+
ddicHeadingLength?: number;
|
|
21
|
+
ddicLabelShortLength?: number;
|
|
22
|
+
ddicLabelMediumLength?: number;
|
|
23
|
+
ddicLabelLongLength?: number;
|
|
24
|
+
parentName?: string;
|
|
25
|
+
};
|
|
26
|
+
annotations: DdicAnnotation[];
|
|
27
|
+
}
|
|
28
|
+
export interface DdicElement {
|
|
29
|
+
type: string;
|
|
30
|
+
name: string;
|
|
31
|
+
properties: DdicProperties;
|
|
32
|
+
children: DdicElement[];
|
|
33
|
+
}
|
|
34
|
+
export declare function ddicElement(h: AdtHTTP, path: string | string[], getTargetForAssociation?: boolean, getExtensionViews?: boolean, getSecondaryObjects?: boolean): Promise<DdicElement>;
|
|
35
|
+
export interface DdicObjectReference {
|
|
36
|
+
uri: string;
|
|
37
|
+
type: string;
|
|
38
|
+
name: string;
|
|
39
|
+
path: string;
|
|
40
|
+
}
|
|
41
|
+
export declare function ddicRepositoryAccess(h: AdtHTTP, path: string | string[]): Promise<DdicObjectReference[]>;
|
|
42
|
+
export declare function publishServiceBinding(h: AdtHTTP, name: string, version: string): Promise<{
|
|
43
|
+
severity: string;
|
|
44
|
+
shortText: string;
|
|
45
|
+
longText: string;
|
|
46
|
+
}>;
|
|
47
|
+
export declare function unpublishServiceBinding(h: AdtHTTP, name: string, version: string): Promise<{
|
|
48
|
+
severity: string;
|
|
49
|
+
shortText: string;
|
|
50
|
+
longText: string;
|
|
51
|
+
}>;
|
|
52
|
+
//# sourceMappingURL=cds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cds.d.ts","sourceRoot":"","sources":["../../src/api/cds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAWpC,OAAO,EAAqB,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAE/D,wBAAsB,cAAc,CAClC,CAAC,EAAE,OAAO,EACV,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAyB9B;AAED,wBAAsB,qBAAqB,CAAC,CAAC,EAAE,OAAO,mBAWrD;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd;AACD,MAAM,WAAW,cAAc;IAC7B,YAAY,CAAC,EAAE;QACb,SAAS,EAAE,OAAO,CAAA;QAClB,eAAe,EAAE,MAAM,CAAA;QACvB,YAAY,EAAE,MAAM,CAAA;QACpB,UAAU,EAAE,MAAM,CAAA;QAClB,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,eAAe,CAAC,EAAE,MAAM,CAAA;QACxB,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,iBAAiB,CAAC,EAAE,MAAM,CAAA;QAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAA;QAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAA;QAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAA;QAC5B,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;IACD,WAAW,EAAE,cAAc,EAAE,CAAA;CAC9B;AACD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,cAAc,CAAA;IAC1B,QAAQ,EAAE,WAAW,EAAE,CAAA;CACxB;AA2ED,wBAAsB,WAAW,CAC/B,CAAC,EAAE,OAAO,EACV,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,uBAAuB,UAAQ,EAC/B,iBAAiB,UAAO,EACxB,mBAAmB,UAAO,wBAa3B;AACD,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAsB,oBAAoB,CACxC,CAAC,EAAE,OAAO,EACV,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,kCAqBxB;AAkBD,wBAAsB,qBAAqB,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;;GAEpF;AACD,wBAAsB,uBAAuB,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;;GAEtF"}
|
package/build/api/cds.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unpublishServiceBinding = exports.publishServiceBinding = exports.ddicRepositoryAccess = exports.ddicElement = exports.annotationDefinitions = exports.syntaxCheckCDS = void 0;
|
|
4
|
+
const utilities_1 = require("../utilities");
|
|
5
|
+
const syntax_1 = require("./syntax");
|
|
6
|
+
async function syntaxCheckCDS(h, url, mainUrl, content) {
|
|
7
|
+
const artifacts = mainUrl && content
|
|
8
|
+
? `<chkrun:artifacts>
|
|
9
|
+
<chkrun:artifact chkrun:contentType="text/plain; charset=utf-8" chkrun:uri="${mainUrl}">
|
|
10
|
+
<chkrun:content>${(0, utilities_1.btoa)(content)}</chkrun:content>
|
|
11
|
+
</chkrun:artifact>
|
|
12
|
+
</chkrun:artifacts>`
|
|
13
|
+
: "";
|
|
14
|
+
const response = await h.request("/sap/bc/adt/checkruns?reporters=abapCheckRun", {
|
|
15
|
+
method: "POST",
|
|
16
|
+
headers: {
|
|
17
|
+
"Content-Type": "application/vnd.sap.adt.checkobjects+xml",
|
|
18
|
+
Accept: "application/vnd.sap.adt.checkmessages+xml"
|
|
19
|
+
},
|
|
20
|
+
body: `<?xml version="1.0" encoding="UTF-8"?>
|
|
21
|
+
<chkrun:checkObjectList xmlns:adtcore="http://www.sap.com/adt/core" xmlns:chkrun="http://www.sap.com/adt/checkrun">
|
|
22
|
+
<chkrun:checkObject adtcore:uri="${url}" chkrun:version="active">${artifacts}</chkrun:checkObject>
|
|
23
|
+
</chkrun:checkObjectList>`
|
|
24
|
+
});
|
|
25
|
+
const raw = (0, utilities_1.fullParse)(response.body);
|
|
26
|
+
return (0, syntax_1.parseCheckResults)(raw);
|
|
27
|
+
}
|
|
28
|
+
exports.syntaxCheckCDS = syntaxCheckCDS;
|
|
29
|
+
async function annotationDefinitions(h) {
|
|
30
|
+
const headers = {
|
|
31
|
+
Accept: "application/vnd.sap.adt.cds.annotation.definitions.v1+xml, application/vnd.sap.adt.cds.annotation.definitions.v2+xml"
|
|
32
|
+
};
|
|
33
|
+
const response = await h.request("/sap/bc/adt/ddic/cds/annotation/definitions", { headers });
|
|
34
|
+
const raw = (0, utilities_1.fullParse)(response.body);
|
|
35
|
+
return (0, utilities_1.xmlNode)(raw, "cds:annotation", "cds:definitions");
|
|
36
|
+
}
|
|
37
|
+
exports.annotationDefinitions = annotationDefinitions;
|
|
38
|
+
function parseDDICProps(raw) {
|
|
39
|
+
const converted = (0, utilities_1.xmlArray)(raw, "abapsource:entry").reduce((prev, cur) => {
|
|
40
|
+
const key = cur["@_abapsource:key"];
|
|
41
|
+
const value = cur["#text"];
|
|
42
|
+
prev[key] = value;
|
|
43
|
+
return prev;
|
|
44
|
+
}, {});
|
|
45
|
+
const { ddicIsKey, ddicDataElement, ddicDataType, ddicLength, ddicDecimals, ddicHeading, ddicLabelShort, ddicLabelMedium, ddicLabelLong, ddicHeadingLength, ddicLabelShortLength, ddicLabelMediumLength, ddicLabelLongLength, parentName, ...rawanno } = converted;
|
|
46
|
+
const elementProps = (ddicDataType || ddicDataType === "") && {
|
|
47
|
+
ddicIsKey: !!ddicIsKey,
|
|
48
|
+
ddicDataElement,
|
|
49
|
+
ddicDataType,
|
|
50
|
+
ddicLength,
|
|
51
|
+
ddicDecimals,
|
|
52
|
+
ddicHeading,
|
|
53
|
+
ddicLabelShort,
|
|
54
|
+
ddicLabelMedium,
|
|
55
|
+
ddicLabelLong,
|
|
56
|
+
ddicHeadingLength,
|
|
57
|
+
ddicLabelShortLength,
|
|
58
|
+
ddicLabelMediumLength,
|
|
59
|
+
ddicLabelLongLength,
|
|
60
|
+
parentName
|
|
61
|
+
};
|
|
62
|
+
const annotations = [];
|
|
63
|
+
// tslint:disable-next-line: forin
|
|
64
|
+
for (const key in rawanno) {
|
|
65
|
+
const match = key.match(/annotation(Key|Value).([0-9]+)/);
|
|
66
|
+
if (match && match.groups) {
|
|
67
|
+
const mtype = match.groups[1];
|
|
68
|
+
const idx = (0, utilities_1.toInt)(match.groups[2]);
|
|
69
|
+
const anno = annotations[idx] || { key: "", value: "" };
|
|
70
|
+
if (mtype === "Key")
|
|
71
|
+
anno.key = rawanno[key];
|
|
72
|
+
else
|
|
73
|
+
anno.value = rawanno[key];
|
|
74
|
+
annotations[idx] = anno;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
elementProps,
|
|
79
|
+
annotations
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function parseDdicElement(raw) {
|
|
83
|
+
const type = raw["@_adtcore:type"];
|
|
84
|
+
const name = raw["@_adtcore:name"];
|
|
85
|
+
const properties = parseDDICProps(raw["abapsource:properties"]);
|
|
86
|
+
const children = (0, utilities_1.xmlArray)(raw, "abapsource:elementInfo").map(parseDdicElement);
|
|
87
|
+
return { type, name, properties, children };
|
|
88
|
+
}
|
|
89
|
+
async function ddicElement(h, path, getTargetForAssociation = false, getExtensionViews = true, getSecondaryObjects = true) {
|
|
90
|
+
const headers = { Accept: "application/vnd.sap.adt.elementinfo+xml" };
|
|
91
|
+
const qs = (0, utilities_1.formatQS)({
|
|
92
|
+
getTargetForAssociation,
|
|
93
|
+
getExtensionViews,
|
|
94
|
+
getSecondaryObjects,
|
|
95
|
+
path
|
|
96
|
+
});
|
|
97
|
+
const uri = `/sap/bc/adt/ddic/ddl/elementinfo?${qs}`;
|
|
98
|
+
const response = await h.request(uri, { headers });
|
|
99
|
+
const raw = (0, utilities_1.fullParse)(response.body);
|
|
100
|
+
return parseDdicElement(raw["abapsource:elementInfo"]);
|
|
101
|
+
}
|
|
102
|
+
exports.ddicElement = ddicElement;
|
|
103
|
+
async function ddicRepositoryAccess(h, path) {
|
|
104
|
+
const headers = { Accept: "application/*" };
|
|
105
|
+
const qs = (0, utilities_1.isArray)(path)
|
|
106
|
+
? (0, utilities_1.formatQS)({ requestScope: "all", path })
|
|
107
|
+
: `datasource=${encodeURIComponent(path)}`;
|
|
108
|
+
const url = `/sap/bc/adt/ddic/ddl/ddicrepositoryaccess?${qs}`;
|
|
109
|
+
const response = await h.request(url, { headers });
|
|
110
|
+
const raw = (0, utilities_1.fullParse)(response.body);
|
|
111
|
+
const records = raw["adtcore:objectReferences"]
|
|
112
|
+
? (0, utilities_1.xmlArray)(raw, "adtcore:objectReferences", "adtcore:objectReference")
|
|
113
|
+
: (0, utilities_1.xmlArray)(raw, "ddl:ddlObjectReferences", "ddl:ddlObjectReference");
|
|
114
|
+
return records.map(r => {
|
|
115
|
+
const attr = (0, utilities_1.xmlNodeAttr)(r);
|
|
116
|
+
return {
|
|
117
|
+
uri: attr["adtcore:uri"] || "",
|
|
118
|
+
type: attr["adtcore:type"] || "",
|
|
119
|
+
name: attr["adtcore:name"] || "",
|
|
120
|
+
path: attr["ddl:path"] || ""
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
exports.ddicRepositoryAccess = ddicRepositoryAccess;
|
|
125
|
+
async function publishUnpublishServiceBinding(h, base, name, version) {
|
|
126
|
+
const headers = { Accept: "application/*" };
|
|
127
|
+
const qs = `servicename=${encodeURIComponent(name)}&serviceversion=${version}`;
|
|
128
|
+
const url = `/sap/bc/adt/businessservices/odatav2/${base}?${qs}`;
|
|
129
|
+
const body = `<adtcore:objectReferences xmlns:adtcore="http://www.sap.com/adt/core">
|
|
130
|
+
<adtcore:objectReference adtcore:name="${name}"/>
|
|
131
|
+
</adtcore:objectReferences>`;
|
|
132
|
+
const response = await h.request(url, { headers, method: "POST", body });
|
|
133
|
+
const raw = (0, utilities_1.fullParse)(response.body);
|
|
134
|
+
const data = (0, utilities_1.xmlNode)(raw, "asx:abap/asx:values/DATA");
|
|
135
|
+
const severity = (0, utilities_1.xmlNode)(data, "SEVERITY");
|
|
136
|
+
const shortText = (0, utilities_1.xmlNode)(data, "SHORT_TEXT");
|
|
137
|
+
const longText = (0, utilities_1.xmlNode)(data, "LONG_TEXT");
|
|
138
|
+
return { severity, shortText, longText };
|
|
139
|
+
}
|
|
140
|
+
async function publishServiceBinding(h, name, version) {
|
|
141
|
+
return publishUnpublishServiceBinding(h, "publishjobs", name, version);
|
|
142
|
+
}
|
|
143
|
+
exports.publishServiceBinding = publishServiceBinding;
|
|
144
|
+
async function unpublishServiceBinding(h, name, version) {
|
|
145
|
+
return publishUnpublishServiceBinding(h, "unpublishjobs", name, version);
|
|
146
|
+
}
|
|
147
|
+
exports.unpublishServiceBinding = unpublishServiceBinding;
|