@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.
Files changed (96) hide show
  1. package/.abapgit.xml +27 -0
  2. package/LICENSE +21 -0
  3. package/README.md +23 -0
  4. package/build/AdtClient.d.ts +292 -0
  5. package/build/AdtClient.d.ts.map +1 -0
  6. package/build/AdtClient.js +628 -0
  7. package/build/AdtException.d.ts +62 -0
  8. package/build/AdtException.d.ts.map +1 -0
  9. package/build/AdtException.js +185 -0
  10. package/build/AdtHTTP.d.ts +113 -0
  11. package/build/AdtHTTP.d.ts.map +1 -0
  12. package/build/AdtHTTP.js +285 -0
  13. package/build/api/abapgit.d.ts +86 -0
  14. package/build/api/abapgit.d.ts.map +1 -0
  15. package/build/api/abapgit.js +300 -0
  16. package/build/api/activate.d.ts +39 -0
  17. package/build/api/activate.d.ts.map +1 -0
  18. package/build/api/activate.js +105 -0
  19. package/build/api/atc.d.ts +163 -0
  20. package/build/api/atc.d.ts.map +1 -0
  21. package/build/api/atc.js +440 -0
  22. package/build/api/cds.d.ts +52 -0
  23. package/build/api/cds.d.ts.map +1 -0
  24. package/build/api/cds.js +147 -0
  25. package/build/api/debugger.d.ts +238 -0
  26. package/build/api/debugger.d.ts.map +1 -0
  27. package/build/api/debugger.js +299 -0
  28. package/build/api/delete.d.ts +20 -0
  29. package/build/api/delete.d.ts.map +1 -0
  30. package/build/api/delete.js +29 -0
  31. package/build/api/discovery.d.ts +44 -0
  32. package/build/api/discovery.d.ts.map +1 -0
  33. package/build/api/discovery.js +78 -0
  34. package/build/api/feeds.d.ts +63 -0
  35. package/build/api/feeds.d.ts.map +1 -0
  36. package/build/api/feeds.js +65 -0
  37. package/build/api/index.d.ts +22 -0
  38. package/build/api/index.d.ts.map +1 -0
  39. package/build/api/index.js +37 -0
  40. package/build/api/nodeContents.d.ts +41 -0
  41. package/build/api/nodeContents.d.ts.map +1 -0
  42. package/build/api/nodeContents.js +78 -0
  43. package/build/api/objectcontents.d.ts +21 -0
  44. package/build/api/objectcontents.d.ts.map +1 -0
  45. package/build/api/objectcontents.js +68 -0
  46. package/build/api/objectcreator.d.ts +103 -0
  47. package/build/api/objectcreator.d.ts.map +1 -0
  48. package/build/api/objectcreator.js +372 -0
  49. package/build/api/objectstructure.d.ts +71 -0
  50. package/build/api/objectstructure.d.ts.map +1 -0
  51. package/build/api/objectstructure.js +37 -0
  52. package/build/api/refactor.d.ts +122 -0
  53. package/build/api/refactor.d.ts.map +1 -0
  54. package/build/api/refactor.js +470 -0
  55. package/build/api/revisions.d.ts +12 -0
  56. package/build/api/revisions.d.ts.map +1 -0
  57. package/build/api/revisions.js +61 -0
  58. package/build/api/search.d.ts +25 -0
  59. package/build/api/search.d.ts.map +1 -0
  60. package/build/api/search.js +67 -0
  61. package/build/api/syntax.d.ts +133 -0
  62. package/build/api/syntax.d.ts.map +1 -0
  63. package/build/api/syntax.js +327 -0
  64. package/build/api/tablecontents.d.ts +141 -0
  65. package/build/api/tablecontents.d.ts.map +1 -0
  66. package/build/api/tablecontents.js +186 -0
  67. package/build/api/trace.test.d.ts +2 -0
  68. package/build/api/trace.test.d.ts.map +1 -0
  69. package/build/api/trace.test.js +39 -0
  70. package/build/api/traces.d.ts +13 -0
  71. package/build/api/traces.d.ts.map +1 -0
  72. package/build/api/traces.js +97 -0
  73. package/build/api/tracetypes.d.ts +276 -0
  74. package/build/api/tracetypes.d.ts.map +1 -0
  75. package/build/api/tracetypes.js +474 -0
  76. package/build/api/transports.d.ts +158 -0
  77. package/build/api/transports.d.ts.map +1 -0
  78. package/build/api/transports.js +292 -0
  79. package/build/api/unittest.d.ts +81 -0
  80. package/build/api/unittest.d.ts.map +1 -0
  81. package/build/api/unittest.js +164 -0
  82. package/build/api/urlparser.d.ts +34 -0
  83. package/build/api/urlparser.d.ts.map +1 -0
  84. package/build/api/urlparser.js +86 -0
  85. package/build/index.d.ts +10 -0
  86. package/build/index.d.ts.map +1 -0
  87. package/build/index.js +49 -0
  88. package/build/requestLogger.d.ts +30 -0
  89. package/build/requestLogger.d.ts.map +1 -0
  90. package/build/requestLogger.js +100 -0
  91. package/build/utilities.d.ts +42 -0
  92. package/build/utilities.d.ts.map +1 -0
  93. package/build/utilities.js +221 -0
  94. package/jest.config.js +32 -0
  95. package/package.json +45 -0
  96. package/setenv_sample.js +27 -0
@@ -0,0 +1,628 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ADTClient = exports.createSSLConfig = void 0;
7
+ const AdtException_1 = require("./AdtException");
8
+ const AdtHTTP_1 = require("./AdtHTTP");
9
+ const api_1 = require("./api");
10
+ const utilities_1 = require("./utilities");
11
+ const https_1 = __importDefault(require("https"));
12
+ function createSSLConfig(allowUnauthorized, ca) {
13
+ const httpsAgent = new https_1.default.Agent({
14
+ keepAlive: true,
15
+ ca,
16
+ rejectUnauthorized: !allowUnauthorized // disable CA checks?
17
+ });
18
+ return { httpsAgent };
19
+ }
20
+ exports.createSSLConfig = createSSLConfig;
21
+ class ADTClient {
22
+ get httpClient() {
23
+ return this.h;
24
+ }
25
+ static mainInclude(object, withDefault = true) {
26
+ // packages don't really have any include
27
+ if ((0, api_1.isPackageType)(object.metaData["adtcore:type"]))
28
+ return object.objectUrl;
29
+ if ((0, api_1.isClassStructure)(object)) {
30
+ const mainInclude = object.includes.find(x => x["class:includeType"] === "main");
31
+ const mainLink = mainInclude &&
32
+ (mainInclude.links.find(x => x.type === "text/plain") ||
33
+ mainInclude.links.find(x => !x.type)); // CDS have no type for the plain text link...
34
+ if (mainLink)
35
+ return (0, utilities_1.followUrl)(object.objectUrl, mainLink.href);
36
+ }
37
+ else {
38
+ const source = object.metaData["abapsource:sourceUri"];
39
+ if (source)
40
+ return (0, utilities_1.followUrl)(object.objectUrl, source);
41
+ const mainLink = object.links.find(x => x.type === "text/plain");
42
+ if (mainLink)
43
+ return (0, utilities_1.followUrl)(object.objectUrl, mainLink.href);
44
+ }
45
+ return withDefault
46
+ ? (0, utilities_1.followUrl)(object.objectUrl, "/source/main")
47
+ : object.objectUrl;
48
+ }
49
+ static classIncludes(clas) {
50
+ const includes = new Map();
51
+ for (const i of clas.includes) {
52
+ const mainLink = i.links.find(x => x.type === "text/plain");
53
+ includes.set(i["class:includeType"], (0, utilities_1.followUrl)(clas.objectUrl, mainLink.href));
54
+ }
55
+ return includes;
56
+ }
57
+ get id() {
58
+ return this.h.id;
59
+ }
60
+ /**
61
+ * Create an ADT client
62
+ *
63
+ * @argument baseUrlOrClient Base url, i.e. http://vhcalnplci.local:8000
64
+ * @argument username SAP logon user
65
+ * @argument password Password
66
+ * @argument client Login client (optional)
67
+ * @argument language Language key (optional)
68
+ */
69
+ constructor(baseUrlOrClient, username, password, client = "", language = "", options = {}) {
70
+ this.wrapFetcher = fetcher => {
71
+ let fetchBearer;
72
+ if (this.fetcher)
73
+ return this.fetcher;
74
+ this.fetcher = () => {
75
+ fetchBearer = fetchBearer || fetcher();
76
+ return fetchBearer;
77
+ };
78
+ return this.fetcher;
79
+ };
80
+ this.hasTransportConfig = async () => {
81
+ const collection = await this.findCollectionByUrl("/sap/bc/adt/cts/transportrequests/searchconfiguration/configurations");
82
+ return !!collection;
83
+ };
84
+ this.isProposalMessage = api_1.isProposalMessage;
85
+ if (!(baseUrlOrClient && username && (password || !(0, utilities_1.isString)(baseUrlOrClient))))
86
+ throw (0, AdtException_1.adtException)("Invalid ADTClient configuration: url, login and password are required");
87
+ if (typeof password !== "string")
88
+ password = this.wrapFetcher(password);
89
+ this.options = {
90
+ baseUrlOrClient: baseUrlOrClient,
91
+ username,
92
+ password,
93
+ client,
94
+ language,
95
+ options
96
+ };
97
+ this.h = this.createHttp();
98
+ }
99
+ createHttp() {
100
+ const o = this.options;
101
+ return new AdtHTTP_1.AdtHTTP(o.baseUrlOrClient, o.username, o.password, o.client, o.language, o.options);
102
+ }
103
+ get pIsClone() {
104
+ return this.h.isClone;
105
+ }
106
+ set pIsClone(isClone) {
107
+ this.h.isClone = isClone;
108
+ }
109
+ get statelessClone() {
110
+ if (this.pIsClone)
111
+ return this;
112
+ if (!this.pClone) {
113
+ const pw = this.fetcher || this.password;
114
+ if (!pw)
115
+ throw (0, AdtException_1.adtException)("Not logged in");
116
+ this.pClone = new ADTClient(this.baseUrl, this.username, pw, this.client, this.language, this.options.options);
117
+ this.pClone.pIsClone = true;
118
+ }
119
+ return this.pClone;
120
+ }
121
+ get stateful() {
122
+ return this.h.stateful;
123
+ }
124
+ set stateful(stateful) {
125
+ if (this.pIsClone)
126
+ throw (0, AdtException_1.adtException)("Stateful sessions not allowed in stateless clones");
127
+ this.h.stateful = stateful;
128
+ }
129
+ get loggedin() {
130
+ return this.h.loggedin;
131
+ }
132
+ get isStateful() {
133
+ return this.h.isStateful;
134
+ }
135
+ get csrfToken() {
136
+ return this.h.csrfToken;
137
+ }
138
+ get baseUrl() {
139
+ return this.h.baseURL;
140
+ }
141
+ get client() {
142
+ return this.h.client;
143
+ }
144
+ get language() {
145
+ return this.h.language;
146
+ }
147
+ get username() {
148
+ return this.h.username;
149
+ }
150
+ get password() {
151
+ return this.h.password;
152
+ }
153
+ /**
154
+ * Logs on an ADT server. parameters provided on creation
155
+ */
156
+ login() {
157
+ // if loggedoff create a new client
158
+ if (!this.h.username)
159
+ this.h = this.createHttp();
160
+ return this.h.login();
161
+ }
162
+ /**
163
+ * Logs out current user, clearing cookies
164
+ * NOTE: you won't be able to login again with this client
165
+ *
166
+ * @memberof ADTClient
167
+ */
168
+ logout() {
169
+ return this.h.logout();
170
+ }
171
+ dropSession() {
172
+ return this.h.dropSession();
173
+ }
174
+ get sessionID() {
175
+ const cookies = this.h.ascookies() || "";
176
+ const sc = cookies.split(";").find(c => !!c.match(/SAP_SESSIONID/));
177
+ return sc ? sc.split("=") : "";
178
+ }
179
+ nodeContents(
180
+ // tslint:disable: variable-name
181
+ parent_type, parent_name, user_name, parent_tech_name, rebuild_tree, parentnodes) {
182
+ return (0, api_1.nodeContents)(this.h, parent_type, parent_name, user_name, parent_tech_name, rebuild_tree, parentnodes);
183
+ }
184
+ async reentranceTicket() {
185
+ const response = await this.h.request("/sap/bc/adt/security/reentranceticket");
186
+ return "" + response.body || "";
187
+ }
188
+ transportInfo(objSourceUrl, devClass, operation = "I") {
189
+ return (0, api_1.transportInfo)(this.h, objSourceUrl, devClass, operation);
190
+ }
191
+ createTransport(objSourceUrl, REQUEST_TEXT, DEVCLASS, transportLayer) {
192
+ return (0, api_1.createTransport)(this.h, objSourceUrl, REQUEST_TEXT, DEVCLASS, "I", transportLayer);
193
+ }
194
+ objectStructure(objectUrl, version) {
195
+ return (0, api_1.objectStructure)(this.h, objectUrl, version);
196
+ }
197
+ activate(objectNameOrObjects, objectUrlOrPreauditReq = true, mainInclude, preauditRequested = true) {
198
+ if ((0, utilities_1.isString)(objectNameOrObjects))
199
+ return (0, api_1.activate)(this.h, objectNameOrObjects, objectUrlOrPreauditReq, // validated downstream
200
+ mainInclude, preauditRequested);
201
+ else
202
+ return (0, api_1.activate)(this.h, objectNameOrObjects, objectUrlOrPreauditReq // validated downstream
203
+ );
204
+ }
205
+ inactiveObjects() {
206
+ return (0, api_1.inactiveObjects)(this.h);
207
+ }
208
+ mainPrograms(includeUrl) {
209
+ return (0, api_1.mainPrograms)(this.h, includeUrl);
210
+ }
211
+ lock(objectUrl, accessMode = "MODIFY") {
212
+ return (0, api_1.lock)(this.h, objectUrl, accessMode);
213
+ }
214
+ unLock(objectUrl, lockHandle) {
215
+ return (0, api_1.unLock)(this.h, objectUrl, lockHandle);
216
+ }
217
+ /**
218
+ * Retrieves a resource content (i.e. a program's source code)
219
+ *
220
+ * @param objectSourceUrl Resource URL
221
+ * @param gitUser Username, only used for abapGit objects
222
+ * @param gitPassword password, only used for abapGit objects
223
+ */
224
+ getObjectSource(objectSourceUrl, options) {
225
+ return (0, api_1.getObjectSource)(this.h, objectSourceUrl, options);
226
+ }
227
+ setObjectSource(objectSourceUrl, source, lockHandle, transport) {
228
+ return (0, api_1.setObjectSource)(this.h, objectSourceUrl, source, lockHandle, transport);
229
+ }
230
+ /**
231
+ * Search object by name pattern
232
+ *
233
+ * @param {string} query case sensitive in older systems, no wildcard added
234
+ * @param {string} [objType] if passed, only the first part is used i.e. PROG rather than PROG/P
235
+ * @param {number} [max=100] max number of results
236
+ * @returns
237
+ * @memberof ADTClient
238
+ */
239
+ searchObject(query, objType, max = 100) {
240
+ return (0, api_1.searchObject)(this.h, query, objType, max);
241
+ }
242
+ findObjectPath(objectUrl) {
243
+ return (0, api_1.findObjectPath)(this.h, objectUrl);
244
+ }
245
+ validateNewObject(options) {
246
+ return (0, api_1.validateNewObject)(this.h, options);
247
+ }
248
+ createObject(optionsOrType, name, parentName, description, parentPath, responsible = "", transport = "") {
249
+ if ((0, api_1.isCreatableTypeId)(optionsOrType)) {
250
+ if (!name || !parentName || !parentPath || !description)
251
+ throw (0, AdtException_1.adtException)("");
252
+ return (0, api_1.createObject)(this.h, {
253
+ description,
254
+ name,
255
+ objtype: optionsOrType,
256
+ parentName,
257
+ parentPath,
258
+ responsible,
259
+ transport
260
+ });
261
+ }
262
+ else
263
+ return (0, api_1.createObject)(this.h, optionsOrType);
264
+ }
265
+ async featureDetails(title) {
266
+ if (!this.discovery)
267
+ this.discovery = await this.adtDiscovery();
268
+ return this.discovery.find(d => d.title === title);
269
+ }
270
+ async collectionFeatureDetails(url) {
271
+ if (!this.discovery)
272
+ this.discovery = await this.adtDiscovery();
273
+ return this.discovery.find(f => f.collection.find(c => c.templateLinks.find(l => l.template === url)));
274
+ }
275
+ async findCollectionByUrl(url) {
276
+ if (!this.discovery)
277
+ this.discovery = await this.adtDiscovery();
278
+ for (const discoveryResult of this.discovery) {
279
+ const collection = discoveryResult.collection.find(c => c.href === url);
280
+ if (collection)
281
+ return { discoveryResult, collection };
282
+ }
283
+ }
284
+ createTestInclude(clas, lockHandle, transport = "") {
285
+ return (0, api_1.createTestInclude)(this.h, clas, lockHandle, transport);
286
+ }
287
+ objectRegistrationInfo(objectUrl) {
288
+ return (0, api_1.objectRegistrationInfo)(this.h, objectUrl);
289
+ }
290
+ deleteObject(objectUrl, lockHandle, transport) {
291
+ return (0, api_1.deleteObject)(this.h, objectUrl, lockHandle, transport);
292
+ }
293
+ loadTypes() {
294
+ return (0, api_1.loadTypes)(this.h);
295
+ }
296
+ adtDiscovery() {
297
+ return (0, api_1.adtDiscovery)(this.h);
298
+ }
299
+ adtCoreDiscovery() {
300
+ return (0, api_1.adtCoreDiscovery)(this.h);
301
+ }
302
+ adtCompatibiliyGraph() {
303
+ return (0, api_1.adtCompatibilityGraph)(this.h);
304
+ }
305
+ syntaxCheckTypes() {
306
+ return (0, api_1.syntaxCheckTypes)(this.h);
307
+ }
308
+ syntaxCheck(url, mainUrl, content, mainProgram = "", version = "active") {
309
+ if (url.match(/^\/sap\/bc\/adt\/((ddic\/ddlx?)|(acm\/dcl))\/sources\//))
310
+ return (0, api_1.syntaxCheckCDS)(this.h, url, mainUrl, content);
311
+ else {
312
+ if (!mainUrl || !content)
313
+ throw (0, AdtException_1.adtException)("mainUrl and content are required for syntax check");
314
+ return (0, api_1.syntaxCheck)(this.h, url, mainUrl, content, mainProgram, version);
315
+ }
316
+ }
317
+ codeCompletion(sourceUrl, source, line, column) {
318
+ return (0, api_1.codeCompletion)(this.h, sourceUrl, source, line, column);
319
+ }
320
+ codeCompletionFull(sourceUrl, source, line, column, patternKey) {
321
+ return (0, api_1.codeCompletionFull)(this.h, sourceUrl, source, line, column, patternKey);
322
+ }
323
+ async runClass(className) {
324
+ const response = await this.h.request("/sap/bc/adt/oo/classrun/" + className.toUpperCase(), {
325
+ method: "POST"
326
+ });
327
+ return "" + response.body;
328
+ }
329
+ /**
330
+ * Read code completion elements
331
+ * Will fail on older systems where this returns HTML fragments rather than XML
332
+ *
333
+ * @param {string} sourceUrl
334
+ * @param {string} source
335
+ * @param {number} line
336
+ * @param {number} column
337
+ * @returns
338
+ * @memberof ADTClient
339
+ */
340
+ codeCompletionElement(sourceUrl, source, line, column) {
341
+ return (0, api_1.codeCompletionElement)(this.h, sourceUrl, source, line, column);
342
+ }
343
+ findDefinition(url, source, line, startCol, endCol, implementation = false, mainProgram = "") {
344
+ return (0, api_1.findDefinition)(this.h, url, source, line, startCol, endCol, implementation, mainProgram);
345
+ }
346
+ usageReferences(url, line, column) {
347
+ return (0, api_1.usageReferences)(this.h, url, line, column);
348
+ }
349
+ usageReferenceSnippets(references) {
350
+ return (0, api_1.usageReferenceSnippets)(this.h, references);
351
+ }
352
+ fixProposals(url, source, line, column) {
353
+ return (0, api_1.fixProposals)(this.h, url, source, line, column);
354
+ }
355
+ fixEdits(proposal, source) {
356
+ return (0, api_1.fixEdits)(this.h, proposal, source);
357
+ }
358
+ unitTestRun(url, flags = api_1.DefaultUnitTestRunFlags) {
359
+ return (0, api_1.runUnitTest)(this.h, url, flags);
360
+ }
361
+ unitTestEvaluation(clas, flags = api_1.DefaultUnitTestRunFlags) {
362
+ return (0, api_1.unitTestEvaluation)(this.h, clas, flags);
363
+ }
364
+ unitTestOccurrenceMarkers(url, source) {
365
+ return (0, api_1.unitTestOccurrenceMarkers)(this.h, url, source);
366
+ }
367
+ classComponents(url) {
368
+ return (0, api_1.classComponents)(this.h, url);
369
+ }
370
+ fragmentMappings(url, type, name) {
371
+ return (0, api_1.fragmentMappings)(this.h, url, type, name);
372
+ }
373
+ objectTypes() {
374
+ return (0, api_1.objectTypes)(this.h);
375
+ }
376
+ prettyPrinterSetting() {
377
+ return (0, api_1.prettyPrinterSetting)(this.h);
378
+ }
379
+ setPrettyPrinterSetting(indent, style) {
380
+ return (0, api_1.setPrettyPrinterSetting)(this.h, indent, style);
381
+ }
382
+ prettyPrinter(source) {
383
+ return (0, api_1.prettyPrinter)(this.h, source);
384
+ }
385
+ typeHierarchy(url, body, line, offset, superTypes = false) {
386
+ return (0, api_1.typeHierarchy)(this.h, url, body, line, offset, superTypes);
387
+ }
388
+ transportConfigurations() {
389
+ return (0, api_1.transportConfigurations)(this.h);
390
+ }
391
+ getTransportConfiguration(url) {
392
+ return (0, api_1.getTransportConfiguration)(this.h, url);
393
+ }
394
+ setTransportsConfig(uri, etag, config) {
395
+ return (0, api_1.setTransportsConfig)(this.h, uri, etag, config);
396
+ }
397
+ createTransportsConfig() {
398
+ return (0, api_1.createTransportsConfig)(this.h);
399
+ }
400
+ userTransports(user, targets = true) {
401
+ return (0, api_1.userTransports)(this.h, user, targets);
402
+ }
403
+ transportsByConfig(configUri, targets = true) {
404
+ return (0, api_1.transportsByConfig)(this.h, configUri, targets);
405
+ }
406
+ transportDelete(transportNumber) {
407
+ return (0, api_1.transportDelete)(this.h, transportNumber);
408
+ }
409
+ transportRelease(transportNumber, ignoreLocks = false, IgnoreATC = false) {
410
+ return (0, api_1.transportRelease)(this.h, transportNumber, ignoreLocks, IgnoreATC);
411
+ }
412
+ transportSetOwner(transportNumber, targetuser) {
413
+ return (0, api_1.transportSetOwner)(this.h, transportNumber, targetuser);
414
+ }
415
+ transportAddUser(transportNumber, user) {
416
+ return (0, api_1.transportAddUser)(this.h, transportNumber, user);
417
+ }
418
+ systemUsers() {
419
+ return (0, api_1.systemUsers)(this.h);
420
+ }
421
+ transportReference(pgmid, obj_wbtype, obj_name, tr_number = "") {
422
+ return (0, api_1.transportReference)(this.h, pgmid, obj_wbtype, obj_name, tr_number);
423
+ }
424
+ revisions(objectUrl, clsInclude) {
425
+ return (0, api_1.revisions)(this.h, objectUrl, clsInclude);
426
+ }
427
+ abapDocumentation(objectUri, body, line, column, language = "EN") {
428
+ return (0, api_1.abapDocumentation)(this.h, objectUri, body, line, column, language);
429
+ }
430
+ packageSearchHelp(type, name = "*") {
431
+ return (0, api_1.packageSearchHelp)(this.h, type, name);
432
+ }
433
+ gitRepos() {
434
+ return (0, api_1.gitRepos)(this.h);
435
+ }
436
+ gitExternalRepoInfo(repourl, user = "", password = "") {
437
+ return (0, api_1.externalRepoInfo)(this.h, repourl, user, password);
438
+ }
439
+ gitCreateRepo(packageName, repourl, branch = "refs/heads/master", transport = "", user = "", password = "") {
440
+ return (0, api_1.createRepo)(this.h, packageName, repourl, branch, transport, user, password);
441
+ }
442
+ gitPullRepo(repoId, branch = "refs/heads/master", transport = "", user = "", password = "") {
443
+ return (0, api_1.pullRepo)(this.h, repoId, branch, transport, user, password);
444
+ }
445
+ gitUnlinkRepo(repoId) {
446
+ return (0, api_1.unlinkRepo)(this.h, repoId);
447
+ }
448
+ stageRepo(repo, user = "", password = "") {
449
+ return (0, api_1.stageRepo)(this.h, repo, user, password);
450
+ }
451
+ pushRepo(repo, staging, user = "", password = "") {
452
+ return (0, api_1.pushRepo)(this.h, repo, staging, user, password);
453
+ }
454
+ checkRepo(repo, user = "", password = "") {
455
+ return (0, api_1.checkRepo)(this.h, repo, user, password);
456
+ }
457
+ /**
458
+ * @deprecated since 1.2.1, duplicate of gitExternalRepoInfo
459
+ */
460
+ remoteRepoInfo(repo, user = "", password = "") {
461
+ return (0, api_1.remoteRepoInfo)(this.h, repo, user, password);
462
+ }
463
+ switchRepoBranch(repo, branch, create = false, user = "", password = "") {
464
+ return (0, api_1.switchRepoBranch)(this.h, repo, branch, create, user, password);
465
+ }
466
+ annotationDefinitions() {
467
+ return (0, api_1.annotationDefinitions)(this.h);
468
+ }
469
+ ddicElement(path, getTargetForAssociation = false, getExtensionViews = true, getSecondaryObjects = true) {
470
+ return (0, api_1.ddicElement)(this.h, path, getTargetForAssociation, getExtensionViews, getSecondaryObjects);
471
+ }
472
+ ddicRepositoryAccess(path) {
473
+ return (0, api_1.ddicRepositoryAccess)(this.h, path);
474
+ }
475
+ publishServiceBinding(name, version) {
476
+ return (0, api_1.publishServiceBinding)(this.h, name, version);
477
+ }
478
+ unPublishServiceBinding(name, version) {
479
+ return (0, api_1.unpublishServiceBinding)(this.h, name, version);
480
+ }
481
+ /** Reads table data - usually returns one line more than requested */
482
+ tableContents(ddicEntityName, rowNumber = 100, decode = true, sqlQuery = "") {
483
+ return (0, api_1.tableContents)(this.h, ddicEntityName, rowNumber, decode, sqlQuery);
484
+ }
485
+ /** Runs a given SQL query on the target */
486
+ runQuery(sqlQuery, rowNumber = 100, decode = true) {
487
+ return (0, api_1.runQuery)(this.h, sqlQuery, rowNumber, decode);
488
+ }
489
+ bindingDetails(binding, index = 0) {
490
+ return (0, api_1.bindingDetails)(this.h, binding, index);
491
+ }
492
+ feeds() {
493
+ return (0, api_1.feeds)(this.h);
494
+ }
495
+ dumps(query) {
496
+ return (0, api_1.dumps)(this.h, query);
497
+ }
498
+ debuggerListeners(debuggingMode, terminalId, ideId, user, checkConflict = true) {
499
+ return (0, api_1.debuggerListeners)(this.h, debuggingMode, terminalId, ideId, user, checkConflict);
500
+ }
501
+ debuggerListen(debuggingMode, terminalId, ideId, user, checkConflict = true, isNotifiedOnConflict = true) {
502
+ return (0, api_1.debuggerListen)(this.h, debuggingMode, terminalId, ideId, user, checkConflict, isNotifiedOnConflict);
503
+ }
504
+ debuggerDeleteListener(debuggingMode, terminalId, ideId, user) {
505
+ return (0, api_1.debuggerDeleteListener)(this.h, debuggingMode, terminalId, ideId, user);
506
+ }
507
+ debuggerSetBreakpoints(debuggingMode, terminalId, ideId, clientId, breakpoints, user, scope = "external", systemDebugging = false, deactivated = false, syncScupeUrl = "") {
508
+ return (0, api_1.debuggerSetBreakpoints)(this.h, debuggingMode, terminalId, ideId, clientId, breakpoints, user, scope, systemDebugging, deactivated, syncScupeUrl);
509
+ }
510
+ debuggerDeleteBreakpoints(breakpoint, debuggingMode, terminalId, ideId, requestUser, scope = "external") {
511
+ return (0, api_1.debuggerDeleteBreakpoints)(this.h, breakpoint, debuggingMode, terminalId, ideId, requestUser, scope);
512
+ }
513
+ debuggerAttach(debuggingMode, debuggeeId, user, dynproDebugging = false) {
514
+ return (0, api_1.debuggerAttach)(this.h, debuggingMode, debuggeeId, user, dynproDebugging);
515
+ }
516
+ debuggerSaveSettings(settings) {
517
+ return (0, api_1.debuggerSaveSettings)(this.h, settings);
518
+ }
519
+ async debuggerStackTrace(semanticURIs = true) {
520
+ const stack = await this.collectionFeatureDetails("/sap/bc/adt/debugger/stack");
521
+ if (stack)
522
+ return (0, api_1.debuggerStack)(this.h, semanticURIs);
523
+ else
524
+ return (0, api_1.simpleDebuggerStack)(this.h, semanticURIs);
525
+ }
526
+ debuggerVariables(parents) {
527
+ return (0, api_1.debuggerVariables)(this.h, parents);
528
+ }
529
+ debuggerChildVariables(parent = ["@DATAAGING", "@ROOT"]) {
530
+ return (0, api_1.debuggerChildVariables)(this.h, parent);
531
+ }
532
+ debuggerStep(steptype, url) {
533
+ return (0, api_1.debuggerStep)(this.h, steptype, url);
534
+ }
535
+ /**
536
+ * Go to stack entry
537
+ *
538
+ * @param urlOrPosition The stack entry stackUri in newer systems, the stack id in older ones that return a DebugStackSimple
539
+ */
540
+ debuggerGoToStack(urlOrPosition) {
541
+ if ((0, utilities_1.isString)(urlOrPosition))
542
+ return (0, api_1.debuggerGoToStack)(this.h, urlOrPosition);
543
+ else
544
+ return (0, api_1.debuggerGoToStackOld)(this.h, urlOrPosition);
545
+ }
546
+ debuggerSetVariableValue(variableName, value) {
547
+ return (0, api_1.debuggerSetVariableValue)(this.h, variableName, value);
548
+ }
549
+ changePackagePreview(changePackageRefactoring, transport = "") {
550
+ return (0, api_1.changePackagePreview)(this.h, changePackageRefactoring, transport);
551
+ }
552
+ changePackageExecute(refactoring) {
553
+ return (0, api_1.changePackageExecute)(this.h, refactoring);
554
+ }
555
+ renameEvaluate(uri, line, startColumn, endColumn) {
556
+ return (0, api_1.renameEvaluate)(this.h, uri, line, startColumn, endColumn);
557
+ }
558
+ renamePreview(renameRefactoring, transport = "") {
559
+ return (0, api_1.renamePreview)(this.h, renameRefactoring, transport);
560
+ }
561
+ renameExecute(refactoring) {
562
+ return (0, api_1.renameExecute)(this.h, refactoring);
563
+ }
564
+ atcCustomizing() {
565
+ return (0, api_1.atcCustomizing)(this.h);
566
+ }
567
+ atcCheckVariant(variant) {
568
+ return (0, api_1.atcCheckVariant)(this.h, variant);
569
+ }
570
+ createAtcRun(variant, mainUrl, maxResults = 100) {
571
+ return (0, api_1.createAtcRun)(this.h, variant, mainUrl, maxResults);
572
+ }
573
+ atcWorklists(runResultId, timestamp, usedObjectSet, includeExempted = false) {
574
+ return (0, api_1.atcWorklists)(this.h, runResultId, timestamp, usedObjectSet, includeExempted);
575
+ }
576
+ atcUsers() {
577
+ return (0, api_1.atcUsers)(this.h);
578
+ }
579
+ atcExemptProposal(markerId) {
580
+ return (0, api_1.atcExemptProposal)(this.h, markerId);
581
+ }
582
+ atcRequestExemption(proposal) {
583
+ return (0, api_1.atcRequestExemption)(this.h, proposal);
584
+ }
585
+ atcContactUri(findingUri) {
586
+ return (0, api_1.atcContactUri)(this.h, findingUri);
587
+ }
588
+ atcChangeContact(itemUri, userId) {
589
+ return (0, api_1.atcChangeContact)(this.h, itemUri, userId);
590
+ }
591
+ tracesList(user) {
592
+ return (0, api_1.tracesList)(this.h, user || this.username);
593
+ }
594
+ tracesListRequests(user) {
595
+ return (0, api_1.tracesListRequests)(this.h, user || this.username);
596
+ }
597
+ tracesHitList(id, withSystemEvents = false) {
598
+ return (0, api_1.tracesHitList)(this.h, id, withSystemEvents);
599
+ }
600
+ tracesDbAccess(id, withSystemEvents = false) {
601
+ return (0, api_1.tracesDbAccess)(this.h, id, withSystemEvents);
602
+ }
603
+ tracesStatements(id, options = {}) {
604
+ return (0, api_1.tracesStatements)(this.h, id, options);
605
+ }
606
+ tracesSetParameters(parameters) {
607
+ return (0, api_1.tracesSetParameters)(this.h, parameters);
608
+ }
609
+ tracesCreateConfiguration(config) {
610
+ return (0, api_1.tracesCreateConfiguration)(this.h, config);
611
+ }
612
+ tracesDeleteConfiguration(id) {
613
+ return (0, api_1.tracesDeleteConfiguration)(this.h, id);
614
+ }
615
+ tracesDelete(id) {
616
+ return (0, api_1.tracesDelete)(this.h, id);
617
+ }
618
+ extractMethodEvaluate(uri, range) {
619
+ return (0, api_1.extractMethodEvaluate)(this.h, uri, range);
620
+ }
621
+ extractMethodPreview(proposal) {
622
+ return (0, api_1.extractMethodPreview)(this.h, proposal);
623
+ }
624
+ extractMethodExecute(refactoring) {
625
+ return (0, api_1.extractMethodExecute)(this.h, refactoring);
626
+ }
627
+ }
628
+ exports.ADTClient = ADTClient;
@@ -0,0 +1,62 @@
1
+ import { AdtHTTP, HttpClientResponse, RequestOptions } from "./AdtHTTP";
2
+ import { AxiosResponse } from "axios";
3
+ import * as t from "io-ts";
4
+ export declare enum SAPRC {
5
+ Success = "S",
6
+ Info = "I",
7
+ Warning = "W",
8
+ Error = "E",
9
+ CriticalError = "A",
10
+ Exception = "X"
11
+ }
12
+ export interface ExceptionProperties {
13
+ conflictText: string;
14
+ ideUser: string;
15
+ "com.sap.adt.communicationFramework.subType": string;
16
+ "T100KEY-ID": string;
17
+ "T100KEY-NO": string;
18
+ }
19
+ export declare class AdtErrorException extends Error {
20
+ readonly err: number;
21
+ readonly properties: ExceptionProperties | Record<string, string>;
22
+ readonly type: string;
23
+ readonly message: string;
24
+ readonly parent?: Error | undefined;
25
+ readonly namespace?: string | undefined;
26
+ readonly localizedMessage?: string | undefined;
27
+ readonly response?: HttpClientResponse | undefined;
28
+ get typeID(): symbol;
29
+ static create(resp: HttpClientResponse, properties: ExceptionProperties | Record<string, string>): AdtErrorException;
30
+ static create(err: number, properties: ExceptionProperties | Record<string, string>, type: string, message: string, parent?: Error, namespace?: string, localizedMessage?: string, response?: HttpClientResponse): AdtErrorException;
31
+ constructor(err: number, properties: ExceptionProperties | Record<string, string>, type: string, message: string, parent?: Error | undefined, namespace?: string | undefined, localizedMessage?: string | undefined, response?: HttpClientResponse | undefined);
32
+ }
33
+ declare class AdtCsrfException extends Error {
34
+ readonly message: string;
35
+ readonly parent?: Error | undefined;
36
+ get typeID(): symbol;
37
+ constructor(message: string, parent?: Error | undefined);
38
+ }
39
+ declare class AdtHttpException extends Error {
40
+ readonly parent: Error;
41
+ get typeID(): symbol;
42
+ get code(): any;
43
+ get message(): string;
44
+ get name(): string;
45
+ constructor(parent: Error);
46
+ }
47
+ export type AdtException = AdtErrorException | AdtCsrfException | AdtHttpException;
48
+ export declare function isAdtError(e: unknown): e is AdtErrorException;
49
+ export declare function isCsrfError(e: unknown): e is AdtCsrfException;
50
+ export declare function isHttpError(e: unknown): e is AdtHttpException;
51
+ export declare function isAdtException(e: unknown): e is AdtException;
52
+ export declare const isLoginError: (adtErr: AdtException) => boolean;
53
+ export declare const fromResponse: (data: string, response: HttpClientResponse | AxiosResponse) => AdtErrorException | AdtCsrfException;
54
+ export declare const fromError: (error: unknown) => AdtException;
55
+ export declare function fromException(errOrResp: unknown, config?: RequestOptions): AdtException;
56
+ export declare function adtException(message: string, number?: number): AdtErrorException;
57
+ export declare function ValidateObjectUrl(url: string): void;
58
+ export declare function ValidateStateful(h: AdtHTTP): void;
59
+ export declare const validateParseResult: <T>(parseResult: t.Validation<T>) => T;
60
+ export declare const isErrorMessageType: (x: string | SAPRC | undefined) => boolean;
61
+ export {};
62
+ //# sourceMappingURL=AdtException.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdtException.d.ts","sourceRoot":"","sources":["../src/AdtException.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,kBAAkB,EAClB,cAAc,EACf,MAAM,WAAW,CAAA;AASlB,OAAc,EAAE,aAAa,EAAkC,MAAM,OAAO,CAAA;AAE5E,OAAO,KAAK,CAAC,MAAM,OAAO,CAAA;AAM1B,oBAAY,KAAK;IACf,OAAO,MAAM;IACb,IAAI,MAAM;IACV,OAAO,MAAM;IACb,KAAK,MAAM;IACX,aAAa,MAAM;IACnB,SAAS,MAAM;CAChB;AACD,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,4CAA4C,EAAE,MAAM,CAAA;IACpD,YAAY,EAAE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