@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,372 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parentTypeId = exports.isCreatableTypeId = exports.isNonGroupType = exports.CreatableTypes = exports.isPackageType = exports.isGroupType = exports.createTestInclude = exports.createObject = exports.validateNewObject = exports.objectPath = exports.loadTypes = exports.isBindingOptions = exports.isPackageOptions = exports.hasPackageOptions = exports.BindinTypes = void 0;
4
+ const sprintf_js_1 = require("sprintf-js");
5
+ const AdtException_1 = require("../AdtException");
6
+ const utilities_1 = require("../utilities");
7
+ exports.BindinTypes = [
8
+ { description: "Odata V2 - Web API", bindingtype: "ODATA", category: "0" },
9
+ { description: "Odata V2 - UI", bindingtype: "ODATA", category: "1" }
10
+ ];
11
+ const hasPackageOptions = (o) => !!(o === null || o === void 0 ? void 0 : o.swcomp);
12
+ exports.hasPackageOptions = hasPackageOptions;
13
+ const isPackageOptions = (o) => (o === null || o === void 0 ? void 0 : o.objtype) === "DEVC/K" && (0, exports.hasPackageOptions)(o);
14
+ exports.isPackageOptions = isPackageOptions;
15
+ const isBindingOptions = (o) => (o === null || o === void 0 ? void 0 : o.objtype) === "SRVB/SVB" &&
16
+ !!(o === null || o === void 0 ? void 0 : o.service) &&
17
+ !!(o === null || o === void 0 ? void 0 : o.bindingtype);
18
+ exports.isBindingOptions = isBindingOptions;
19
+ const xmlEntry = (value, key) => value ? `<${key}>${(0, utilities_1.encodeEntity)(value)}</${key}>}` : `<${key}/>`;
20
+ const xmlAttribute = (value, key) => value ? `${key}="${(0, utilities_1.encodeEntity)(value)}"` : ``;
21
+ function createBodyPackage(options) {
22
+ const responsible = `adtcore:responsible="${options.responsible}"`;
23
+ const compname = xmlAttribute(options.swcomp, `pak:name`);
24
+ const description = xmlAttribute(options.description, "adtcore:description");
25
+ const superp = xmlAttribute(options.parentName, "adtcore:name");
26
+ const pkgname = xmlAttribute(options.name, "adtcore:name");
27
+ const pkgtype = xmlAttribute(options.packagetype, "pak:packageType");
28
+ return `<?xml version="1.0" encoding="UTF-8"?>
29
+ <pak:package xmlns:pak="http://www.sap.com/adt/packages"
30
+ xmlns:adtcore="http://www.sap.com/adt/core" ${description}
31
+ ${pkgname} adtcore:type="DEVC/K" adtcore:version="active" ${responsible}>
32
+ <adtcore:packageRef adtcore:name="YMU_RAP"/>
33
+ <pak:attributes ${pkgtype}/>
34
+ <pak:superPackage ${superp}/>
35
+ <pak:applicationComponent/>
36
+ <pak:transport>
37
+ <pak:softwareComponent ${compname}/>
38
+ <pak:transportLayer pak:name="${(0, utilities_1.encodeEntity)(options.transportLayer)}"/>
39
+ </pak:transport>
40
+ <pak:translation/>
41
+ <pak:useAccesses/>
42
+ <pak:packageInterfaces/>
43
+ <pak:subPackages/>
44
+ </pak:package>`;
45
+ }
46
+ function createBodyFunc(options, type) {
47
+ const responsible = `adtcore:responsible="${options.responsible}"`;
48
+ return `<?xml version="1.0" encoding="UTF-8"?>
49
+ <${type.rootName} ${type.nameSpace}
50
+ xmlns:adtcore="http://www.sap.com/adt/core"
51
+ adtcore:description="${(0, utilities_1.encodeEntity)(options.description)}"
52
+ adtcore:name="${options.name}" adtcore:type="${options.objtype}">
53
+ <adtcore:containerRef adtcore:name="${options.parentName}"
54
+ adtcore:type="FUGR/F"
55
+ adtcore:uri="${options.parentPath}" />
56
+ </${type.rootName}>`;
57
+ }
58
+ function createBodySimple(options, type, body = "") {
59
+ const responsible = `adtcore:responsible="${options.responsible}"`;
60
+ body = body || `<adtcore:packageRef adtcore:name="${options.parentName}"/>`;
61
+ return `<?xml version="1.0" encoding="UTF-8"?>
62
+ <${type.rootName} ${type.nameSpace}
63
+ xmlns:adtcore="http://www.sap.com/adt/core"
64
+ adtcore:description="${(0, utilities_1.encodeEntity)(options.description)}"
65
+ adtcore:name="${options.name}" adtcore:type="${options.objtype}"
66
+ ${responsible} ${type.extra || ""}>
67
+ ${body}
68
+ </${type.rootName}>`;
69
+ }
70
+ function createBodyBinding(options, type) {
71
+ const body = `<adtcore:packageRef adtcore:name="${options.parentName}"/>
72
+ <srvb:services srvb:name="${options.name}">
73
+ <srvb:content srvb:version="0001">
74
+ <srvb:serviceDefinition adtcore:name="${options.service}"/>
75
+ </srvb:content>
76
+ </srvb:services>
77
+ <srvb:binding srvb:category="0" srvb:type="${options.bindingtype}" srvb:version="V2">
78
+ <srvb:implementation adtcore:name=""/>
79
+ </srvb:binding>`;
80
+ return createBodySimple(options, type, body);
81
+ }
82
+ function createBody(options, type) {
83
+ switch (type.typeId) {
84
+ case "DEVC/K":
85
+ if ((0, exports.isPackageOptions)(options))
86
+ return createBodyPackage(options);
87
+ throw (0, AdtException_1.adtException)("Can't create a Package with incomplete data");
88
+ case "FUGR/FF":
89
+ case "FUGR/I":
90
+ return createBodyFunc(options, type);
91
+ case "SRVB/SVB":
92
+ if ((0, exports.isBindingOptions)(options))
93
+ return createBodyBinding(options, type);
94
+ throw (0, AdtException_1.adtException)("Can't create service binding with incomplete data");
95
+ default:
96
+ return createBodySimple(options, type);
97
+ }
98
+ }
99
+ async function loadTypes(h) {
100
+ const response = await h.request("/sap/bc/adt/repository/typestructure", {
101
+ method: "POST"
102
+ });
103
+ const raw = (0, utilities_1.fullParse)(response.body);
104
+ return (0, utilities_1.xmlArray)(raw, "asx:abap", "asx:values", "DATA", "SEU_ADT_OBJECT_TYPE_DESCRIPTOR").map((x) => {
105
+ return { ...x, CAPABILITIES: (0, utilities_1.xmlArray)(x, "CAPABILITIES", "SEU_ACTION") };
106
+ });
107
+ }
108
+ exports.loadTypes = loadTypes;
109
+ function objectPath(typeIdOrObjectOptions, name, parentName) {
110
+ if (!(0, utilities_1.isString)(typeIdOrObjectOptions))
111
+ return objectPath(typeIdOrObjectOptions.objtype, typeIdOrObjectOptions.name, typeIdOrObjectOptions.parentName);
112
+ const encodedname = encodeURIComponent(name || "");
113
+ const ot = exports.CreatableTypes.get(typeIdOrObjectOptions);
114
+ if (!ot)
115
+ return "";
116
+ return ("/sap/bc/adt/" +
117
+ (0, sprintf_js_1.sprintf)(ot.creationPath, encodeURIComponent(parentName || "")) +
118
+ "/" +
119
+ encodedname);
120
+ }
121
+ exports.objectPath = objectPath;
122
+ async function validateNewObject(h, options) {
123
+ const ot = exports.CreatableTypes.get(options.objtype);
124
+ if (!ot)
125
+ throw (0, AdtException_1.adtException)("Unsupported object type");
126
+ if (!ot.validationPath)
127
+ throw (0, AdtException_1.adtException)(`Validation not supported for object ${ot} ${options.objname}`);
128
+ const response = await h.request("/sap/bc/adt/" + ot.validationPath, {
129
+ method: "POST",
130
+ qs: options
131
+ });
132
+ const raw = (0, utilities_1.fullParse)(response.body);
133
+ const results = (0, utilities_1.xmlArray)(raw, "asx:abap", "asx:values", "DATA");
134
+ const record = (results && results[0]) || {};
135
+ const { SEVERITY, SHORT_TEXT, CHECK_RESULT } = record;
136
+ if (SEVERITY === "ERROR")
137
+ throw (0, AdtException_1.adtException)(record.SHORT_TEXT);
138
+ return {
139
+ SEVERITY,
140
+ SHORT_TEXT,
141
+ success: !!CHECK_RESULT || !!SEVERITY
142
+ };
143
+ }
144
+ exports.validateNewObject = validateNewObject;
145
+ async function createObject(h, options) {
146
+ const ot = exports.CreatableTypes.get(options.objtype);
147
+ if (!ot)
148
+ throw (0, AdtException_1.adtException)("Unsupported object type");
149
+ const url = "/sap/bc/adt/" +
150
+ (0, sprintf_js_1.sprintf)(ot.creationPath, encodeURIComponent(options.parentName.toLowerCase()));
151
+ options.responsible = (options.responsible || h.username).toUpperCase();
152
+ const body = createBody(options, ot);
153
+ const qs = {};
154
+ if (options.transport)
155
+ qs.corrNr = options.transport;
156
+ // will raise exceptions on failure
157
+ await h.request(url, {
158
+ body,
159
+ headers: { "Content-Type": "application/*" },
160
+ method: "POST",
161
+ qs
162
+ });
163
+ }
164
+ exports.createObject = createObject;
165
+ async function createTestInclude(h, clas, lockHandle, corrNr) {
166
+ const body = `<?xml version="1.0" encoding="UTF-8"?><class:abapClassInclude
167
+ xmlns:class="http://www.sap.com/adt/oo/classes" xmlns:adtcore="http://www.sap.com/adt/core"
168
+ adtcore:name="dummy" class:includeType="testclasses"/>`;
169
+ await h.request(`/sap/bc/adt/oo/classes/${encodeURIComponent(clas)}/includes`, {
170
+ body,
171
+ headers: { "Content-Type": "application/*" },
172
+ method: "POST",
173
+ qs: { lockHandle, corrNr }
174
+ });
175
+ }
176
+ exports.createTestInclude = createTestInclude;
177
+ function isGroupType(type) {
178
+ return type === "FUGR/FF" || type === "FUGR/I";
179
+ }
180
+ exports.isGroupType = isGroupType;
181
+ function isPackageType(type) {
182
+ return type === "DEVC/K";
183
+ }
184
+ exports.isPackageType = isPackageType;
185
+ exports.CreatableTypes = new Map();
186
+ function isNonGroupType(type) {
187
+ return exports.CreatableTypes.has(type) && !isGroupType(type);
188
+ }
189
+ exports.isNonGroupType = isNonGroupType;
190
+ function isCreatableTypeId(type) {
191
+ return isGroupType(type) || isNonGroupType(type);
192
+ }
193
+ exports.isCreatableTypeId = isCreatableTypeId;
194
+ function parentTypeId(type) {
195
+ return isGroupType(type) ? "FUGR/F" : "DEVC/K";
196
+ }
197
+ exports.parentTypeId = parentTypeId;
198
+ const ctypes = [
199
+ {
200
+ creationPath: "programs/programs",
201
+ label: "Program",
202
+ nameSpace: 'xmlns:program="http://www.sap.com/adt/programs/programs"',
203
+ rootName: "program:abapProgram",
204
+ typeId: "PROG/P",
205
+ validationPath: "programs/validation",
206
+ maxLen: 30
207
+ },
208
+ {
209
+ creationPath: "oo/classes",
210
+ label: "Class",
211
+ nameSpace: 'xmlns:class="http://www.sap.com/adt/oo/classes"',
212
+ rootName: "class:abapClass",
213
+ typeId: "CLAS/OC",
214
+ validationPath: "oo/validation/objectname",
215
+ maxLen: 30
216
+ },
217
+ {
218
+ creationPath: "oo/interfaces",
219
+ label: "Interface",
220
+ nameSpace: 'xmlns:intf="http://www.sap.com/adt/oo/interfaces"',
221
+ rootName: "intf:abapInterface",
222
+ typeId: "INTF/OI",
223
+ validationPath: "oo/validation/objectname",
224
+ maxLen: 30
225
+ },
226
+ {
227
+ creationPath: "programs/includes",
228
+ label: "Include",
229
+ nameSpace: 'xmlns:include="http://www.sap.com/adt/programs/includes"',
230
+ rootName: "include:abapInclude",
231
+ typeId: "PROG/I",
232
+ validationPath: "includes/validation",
233
+ maxLen: 30
234
+ },
235
+ {
236
+ creationPath: "functions/groups",
237
+ label: "Function Group",
238
+ nameSpace: 'xmlns:group="http://www.sap.com/adt/functions/groups"',
239
+ rootName: "group:abapFunctionGroup",
240
+ typeId: "FUGR/F",
241
+ validationPath: "functions/validation",
242
+ maxLen: 26
243
+ },
244
+ {
245
+ creationPath: "functions/groups/%s/fmodules",
246
+ label: "Function module",
247
+ nameSpace: 'xmlns:fmodule="http://www.sap.com/adt/functions/fmodules"',
248
+ rootName: "fmodule:abapFunctionModule",
249
+ typeId: "FUGR/FF",
250
+ validationPath: "functions/validation",
251
+ maxLen: 30
252
+ },
253
+ {
254
+ creationPath: "functions/groups/%s/includes",
255
+ label: "Function group include",
256
+ nameSpace: 'xmlns:finclude="http://www.sap.com/adt/functions/fincludes"',
257
+ rootName: "finclude:abapFunctionGroupInclude",
258
+ typeId: "FUGR/I",
259
+ validationPath: "functions/validation",
260
+ maxLen: 3
261
+ },
262
+ {
263
+ creationPath: "ddic/ddl/sources",
264
+ label: "CDS Data Definitions",
265
+ nameSpace: 'xmlns:ddl="http://www.sap.com/adt/ddic/ddlsources"',
266
+ rootName: "ddl:ddlSource",
267
+ typeId: "DDLS/DF",
268
+ validationPath: "ddic/ddl/validation",
269
+ maxLen: 30
270
+ },
271
+ {
272
+ creationPath: "acm/dcl/sources",
273
+ label: "CDS Access Control",
274
+ nameSpace: 'xmlns:dcl="http://www.sap.com/adt/acm/dclsources"',
275
+ rootName: "dcl:dclSource",
276
+ typeId: "DCLS/DL",
277
+ validationPath: "acm/dcl/validation",
278
+ maxLen: 30
279
+ },
280
+ {
281
+ creationPath: "ddic/ddlx/sources",
282
+ label: "CDS metadata extensions",
283
+ nameSpace: 'xmlns:ddlx="http://www.sap.com/adt/ddic/ddlxsources"',
284
+ rootName: "ddlx:ddlxSource",
285
+ typeId: "DDLX/EX",
286
+ validationPath: "ddic/ddlx/sources/validation",
287
+ maxLen: 30
288
+ },
289
+ {
290
+ creationPath: "ddic/ddla/sources",
291
+ label: "CDS Annotation definitions",
292
+ nameSpace: 'xmlns:ddla="http://www.sap.com/adt/ddic/ddlasources"',
293
+ rootName: "ddla:ddlaSource",
294
+ typeId: "DDLA/ADF",
295
+ validationPath: "ddic/ddla/sources/validation",
296
+ maxLen: 30
297
+ },
298
+ {
299
+ creationPath: "packages",
300
+ label: "Package",
301
+ nameSpace: 'xmlns:pak="http://www.sap.com/adt/packages"',
302
+ rootName: "pak:package",
303
+ typeId: "DEVC/K",
304
+ validationPath: "packages/validation",
305
+ maxLen: 30
306
+ },
307
+ {
308
+ creationPath: "ddic/tables",
309
+ label: "Table",
310
+ nameSpace: 'xmlns:blue="http://www.sap.com/wbobj/blue"',
311
+ rootName: "blue:blueSource",
312
+ typeId: "TABL/DT",
313
+ validationPath: "ddic/tables/validation",
314
+ maxLen: 16
315
+ },
316
+ {
317
+ creationPath: "ddic/srvd/sources",
318
+ label: "Service definition",
319
+ nameSpace: 'xmlns:srvd="http://www.sap.com/adt/ddic/srvdsources"',
320
+ rootName: "srvd:srvdSource",
321
+ typeId: "SRVD/SRV",
322
+ validationPath: "ddic/srvd/sources/validation",
323
+ extra: `srvd:srvdSourceType="S"`,
324
+ maxLen: 30
325
+ },
326
+ {
327
+ creationPath: "aps/iam/auth",
328
+ rootName: "auth:auth",
329
+ nameSpace: 'xmlns:auth="http://www.sap.com/iam/auth"',
330
+ label: "Authorization field",
331
+ typeId: "AUTH",
332
+ validationPath: "aps/iam/auth/validation",
333
+ maxLen: 10
334
+ },
335
+ {
336
+ creationPath: "aps/iam/suso",
337
+ validationPath: "aps/iam/suso/validation",
338
+ rootName: "susob:suso",
339
+ nameSpace: `xmlns:susob="http://www.sap.com/iam/suso"`,
340
+ label: "Authorization object",
341
+ typeId: "SUSO/B",
342
+ maxLen: 10
343
+ },
344
+ {
345
+ creationPath: "ddic/dataelements",
346
+ validationPath: "ddic/dataelements/validation",
347
+ rootName: "blue:wbobj",
348
+ nameSpace: 'xmlns:blue="http://www.sap.com/wbobj/dictionary/dtel"',
349
+ label: "Data Element",
350
+ typeId: "DTEL/DE",
351
+ maxLen: 30
352
+ },
353
+ {
354
+ creationPath: "businessservices/bindings",
355
+ validationPath: "businessservices/bindings/validation",
356
+ rootName: "srvb:serviceBinding",
357
+ nameSpace: 'xmlns:srvb="http://www.sap.com/adt/ddic/ServiceBindings"',
358
+ label: "Service binding",
359
+ typeId: "SRVB/SVB",
360
+ maxLen: 26
361
+ },
362
+ {
363
+ creationPath: "messageclass",
364
+ validationPath: "messageclass/validation",
365
+ rootName: "mc:messageClass",
366
+ nameSpace: `xmlns:mc="http://www.sap.com/adt/MessageClass"`,
367
+ label: "Message class",
368
+ typeId: "MSAG/N",
369
+ maxLen: 20
370
+ }
371
+ ];
372
+ ctypes.forEach(v => exports.CreatableTypes.set(v.typeId, v));
@@ -0,0 +1,71 @@
1
+ import { AdtHTTP } from "../AdtHTTP";
2
+ export type ObjectVersion = "active" | "inactive" | "workingArea";
3
+ export interface GenericMetaData {
4
+ "abapsource:activeUnicodeCheck"?: boolean;
5
+ "abapsource:fixPointArithmetic"?: boolean;
6
+ "abapsource:sourceUri"?: string;
7
+ "adtcore:changedAt": number;
8
+ "adtcore:changedBy": string;
9
+ "adtcore:createdAt": number;
10
+ "adtcore:description"?: string;
11
+ "adtcore:descriptionTextLimit"?: number;
12
+ "adtcore:language": string;
13
+ "adtcore:masterLanguage"?: string;
14
+ "adtcore:masterSystem"?: string;
15
+ "adtcore:name": string;
16
+ "adtcore:responsible": string;
17
+ "adtcore:type": string;
18
+ "adtcore:version": string;
19
+ }
20
+ export interface ProgramMetaData extends GenericMetaData {
21
+ "program:lockedByEditor": boolean;
22
+ "program:programType": string;
23
+ }
24
+ export interface FunctionGroupMetaData extends GenericMetaData {
25
+ "group:lockedByEditor": boolean;
26
+ }
27
+ export interface ClassMetaData extends GenericMetaData {
28
+ "abapoo:modeled": boolean;
29
+ "class:abstract": boolean;
30
+ "class:category": string;
31
+ "class:final": boolean;
32
+ "class:sharedMemoryEnabled": boolean;
33
+ "class:visibility": string;
34
+ }
35
+ export interface Link {
36
+ etag?: number;
37
+ href: string;
38
+ rel: string;
39
+ type?: string;
40
+ title?: string;
41
+ }
42
+ export type classIncludes = "definitions" | "implementations" | "macros" | "testclasses" | "main";
43
+ export interface ClassInclude {
44
+ "abapsource:sourceUri": string;
45
+ "adtcore:changedAt": number;
46
+ "adtcore:changedBy": string;
47
+ "adtcore:createdAt": number;
48
+ "adtcore:createdBy": string;
49
+ "adtcore:name": string;
50
+ "adtcore:type": string;
51
+ "adtcore:version": string;
52
+ "class:includeType": classIncludes;
53
+ links: Link[];
54
+ }
55
+ export type AbapMetaData = GenericMetaData | ProgramMetaData | FunctionGroupMetaData | ClassMetaData;
56
+ export interface AbapSimpleStructure {
57
+ objectUrl: string;
58
+ metaData: AbapMetaData;
59
+ links: Link[];
60
+ }
61
+ export interface AbapClassStructure {
62
+ objectUrl: string;
63
+ metaData: ClassMetaData;
64
+ links?: Link[];
65
+ includes: ClassInclude[];
66
+ }
67
+ export type AbapObjectStructure = AbapSimpleStructure | AbapClassStructure;
68
+ export declare function isClassMetaData(meta: AbapMetaData): meta is ClassMetaData;
69
+ export declare function isClassStructure(struc: AbapObjectStructure): struc is AbapClassStructure;
70
+ export declare function objectStructure(h: AdtHTTP, objectUrl: string, version?: ObjectVersion): Promise<AbapObjectStructure>;
71
+ //# sourceMappingURL=objectstructure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objectstructure.d.ts","sourceRoot":"","sources":["../../src/api/objectstructure.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAGpC,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,UAAU,GAAG,aAAa,CAAA;AAEjE,MAAM,WAAW,eAAe;IAC9B,+BAA+B,CAAC,EAAE,OAAO,CAAA;IACzC,+BAA+B,CAAC,EAAE,OAAO,CAAA;IACzC,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,8BAA8B,CAAC,EAAE,MAAM,CAAA;IACvC,kBAAkB,EAAE,MAAM,CAAA;IAC1B,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,cAAc,EAAE,MAAM,CAAA;IACtB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,cAAc,EAAE,MAAM,CAAA;IACtB,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AAED,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,wBAAwB,EAAE,OAAO,CAAA;IACjC,qBAAqB,EAAE,MAAM,CAAA;CAC9B;AAED,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,sBAAsB,EAAE,OAAO,CAAA;CAChC;AAED,MAAM,WAAW,aAAc,SAAQ,eAAe;IACpD,gBAAgB,EAAE,OAAO,CAAA;IACzB,gBAAgB,EAAE,OAAO,CAAA;IACzB,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,EAAE,OAAO,CAAA;IACtB,2BAA2B,EAAE,OAAO,CAAA;IACpC,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AA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7B;AAOD,wBAAsB,eAAe,CACnC,CAAC,EAAE,OAAO,EACV,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,mBAAmB,CAAC,CAmB9B"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.objectStructure = exports.isClassStructure = exports.isClassMetaData = void 0;
4
+ const AdtException_1 = require("../AdtException");
5
+ const utilities_1 = require("../utilities");
6
+ function isClassMetaData(meta) {
7
+ return meta["class:visibility"] !== undefined;
8
+ }
9
+ exports.isClassMetaData = isClassMetaData;
10
+ function isClassStructure(struc) {
11
+ return isClassMetaData(struc.metaData);
12
+ }
13
+ exports.isClassStructure = isClassStructure;
14
+ const convertIncludes = (i) => {
15
+ const imeta = (0, utilities_1.xmlNodeAttr)(i);
16
+ const links = i["atom:link"].map(utilities_1.xmlNodeAttr);
17
+ return { ...imeta, links };
18
+ };
19
+ async function objectStructure(h, objectUrl, version) {
20
+ (0, AdtException_1.ValidateObjectUrl)(objectUrl);
21
+ const qs = version ? { version } : {};
22
+ const response = await h.request(objectUrl, { qs });
23
+ const res = (0, utilities_1.fullParse)(response.body);
24
+ // return type depends on object type, but always have a single root
25
+ const root = (0, utilities_1.xmlRoot)(res);
26
+ const attr = (0, utilities_1.xmlNodeAttr)(root);
27
+ attr["adtcore:changedAt"] = Date.parse(attr["adtcore:changedAt"]) || 0;
28
+ attr["adtcore:createdAt"] = Date.parse(attr["adtcore:createdAt"]) || 0;
29
+ const links = (0, utilities_1.xmlArray)(root, "atom:link").map(utilities_1.xmlNodeAttr);
30
+ const metaData = attr;
31
+ if (isClassMetaData(metaData)) {
32
+ const includes = (0, utilities_1.xmlArray)(root, "class:include").map(convertIncludes);
33
+ return { objectUrl, metaData, includes, links };
34
+ }
35
+ return { objectUrl, metaData, links };
36
+ }
37
+ exports.objectStructure = objectStructure;
@@ -0,0 +1,122 @@
1
+ import { UriParts } from ".";
2
+ import { AdtHTTP } from "../AdtHTTP";
3
+ import { Range } from "./urlparser";
4
+ export interface FixProposal {
5
+ "adtcore:uri": string;
6
+ "adtcore:type": string;
7
+ "adtcore:name": string;
8
+ "adtcore:description": string;
9
+ uri: string;
10
+ line: string;
11
+ column: string;
12
+ userContent: string;
13
+ }
14
+ interface TextReplaceDelta {
15
+ rangeFragment: Range;
16
+ contentOld: string;
17
+ contentNew: string;
18
+ }
19
+ interface AffectedObjects {
20
+ uri: string;
21
+ type: string;
22
+ name: string;
23
+ parentUri: string;
24
+ userContent: string;
25
+ textReplaceDeltas: TextReplaceDelta[];
26
+ }
27
+ interface ChangePackageAffectedObject {
28
+ uri: string;
29
+ type: string;
30
+ name: string;
31
+ oldPackage: string;
32
+ newPackage: string;
33
+ parentUri: string;
34
+ userContent: string;
35
+ }
36
+ export interface ChangePackageRefactoringProposal {
37
+ oldPackage: string;
38
+ newPackage: string;
39
+ transport?: string;
40
+ title?: string;
41
+ rootUserContent?: string;
42
+ ignoreSyntaxErrorsAllowed: boolean;
43
+ ignoreSyntaxErrors: boolean;
44
+ adtObjectUri: string;
45
+ affectedObjects: ChangePackageAffectedObject;
46
+ userContent: string;
47
+ }
48
+ export interface ChangePackageRefactoring extends ChangePackageRefactoringProposal {
49
+ transport: string;
50
+ }
51
+ export interface RenameRefactoringProposal {
52
+ oldName: string;
53
+ newName: string;
54
+ transport?: string;
55
+ title?: string;
56
+ rootUserContent?: string;
57
+ ignoreSyntaxErrorsAllowed: boolean;
58
+ ignoreSyntaxErrors: boolean;
59
+ adtObjectUri: UriParts;
60
+ affectedObjects: AffectedObjects[];
61
+ userContent: string;
62
+ }
63
+ export interface RenameRefactoring extends RenameRefactoringProposal {
64
+ transport: string;
65
+ }
66
+ interface Exception {
67
+ name: string;
68
+ resumable: boolean;
69
+ userContent: string;
70
+ }
71
+ interface Parameter {
72
+ id: string;
73
+ name: string;
74
+ direction: string;
75
+ byValue: boolean;
76
+ typeType: string;
77
+ type: string;
78
+ userContent: string;
79
+ }
80
+ export interface GenericRefactoring {
81
+ title: string;
82
+ adtObjectUri: UriParts;
83
+ transport: string;
84
+ ignoreSyntaxErrorsAllowed: boolean;
85
+ ignoreSyntaxErrors: boolean;
86
+ userContent: string;
87
+ affectedObjects: AffectedObjects[];
88
+ }
89
+ export interface ExtractMethodProposal {
90
+ name: string;
91
+ isStatic: boolean;
92
+ isForTesting: boolean;
93
+ visibility: string;
94
+ classBasedExceptions: boolean;
95
+ genericRefactoring: GenericRefactoring;
96
+ content: string;
97
+ className: string;
98
+ isEventAllowed: boolean;
99
+ isEvent: boolean;
100
+ userContent: string;
101
+ parameters: Parameter[];
102
+ exceptions: Exception[];
103
+ }
104
+ export declare function fixProposals(h: AdtHTTP, uri: string, body: string, line: number, column: number): Promise<FixProposal[]>;
105
+ export interface Delta {
106
+ uri: string;
107
+ range: Range;
108
+ name: string;
109
+ type: string;
110
+ content: string;
111
+ }
112
+ export declare function fixEdits(h: AdtHTTP, proposal: FixProposal, source: string): Promise<Delta[]>;
113
+ export declare function renameEvaluate(h: AdtHTTP, uri: string, line: number, startColumn: number, endColumn: number): Promise<RenameRefactoringProposal>;
114
+ export declare function changePackagePreview(h: AdtHTTP, changePackageRefactoring: ChangePackageRefactoring, transport: string): Promise<ChangePackageRefactoring>;
115
+ export declare function changePackageExecute(h: AdtHTTP, packagename: ChangePackageRefactoring): Promise<ChangePackageRefactoring>;
116
+ export declare function renamePreview(h: AdtHTTP, renameRefactoring: RenameRefactoringProposal, transport: string): Promise<RenameRefactoring>;
117
+ export declare function renameExecute(h: AdtHTTP, rename: RenameRefactoring): Promise<RenameRefactoring>;
118
+ export declare function extractMethodEvaluate(h: AdtHTTP, uri: string, range: Range): Promise<ExtractMethodProposal>;
119
+ export declare function extractMethodPreview(h: AdtHTTP, proposal: ExtractMethodProposal): Promise<GenericRefactoring>;
120
+ export declare function extractMethodExecute(h: AdtHTTP, refactoring: GenericRefactoring): Promise<GenericRefactoring>;
121
+ export {};
122
+ //# sourceMapping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