@sap-ux/axios-extension 1.14.3 → 1.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abap/abap-service-provider.js +62 -77
- package/dist/abap/adt-catalog/adt-catalog-service.js +27 -41
- package/dist/abap/adt-catalog/adt-schema-store.js +4 -0
- package/dist/abap/adt-catalog/generators/ui-service-generator.d.ts +0 -2
- package/dist/abap/adt-catalog/generators/ui-service-generator.js +60 -79
- package/dist/abap/adt-catalog/services/adt-service.js +4 -0
- package/dist/abap/adt-catalog/services/ato-service.js +15 -26
- package/dist/abap/adt-catalog/services/businessobjects-service.js +23 -35
- package/dist/abap/adt-catalog/services/filestore-service.js +21 -32
- package/dist/abap/adt-catalog/services/generator-service.js +23 -34
- package/dist/abap/adt-catalog/services/list-package-service.js +24 -36
- package/dist/abap/adt-catalog/services/transportcheck-service.js +29 -44
- package/dist/abap/adt-catalog/services/transportrequest-service.js +17 -28
- package/dist/abap/app-index-service.js +22 -34
- package/dist/abap/catalog/base.d.ts +9 -0
- package/dist/abap/catalog/base.js +15 -17
- package/dist/abap/catalog/v2-catalog-service.d.ts +9 -1
- package/dist/abap/catalog/v2-catalog-service.js +113 -114
- package/dist/abap/catalog/v4-catalog-service.d.ts +8 -1
- package/dist/abap/catalog/v4-catalog-service.js +36 -41
- package/dist/abap/lrep-service.js +97 -120
- package/dist/abap/message.js +6 -8
- package/dist/abap/ui5-abap-repository-service.js +142 -168
- package/dist/auth/connection.js +13 -22
- package/dist/auth/error.js +1 -0
- package/dist/auth/index.js +16 -28
- package/dist/auth/redirect.js +2 -1
- package/dist/auth/reentrance-ticket/abap-system.js +3 -0
- package/dist/auth/reentrance-ticket/index.js +11 -23
- package/dist/auth/reentrance-ticket/redirect.js +2 -3
- package/dist/auth/uaa.js +77 -96
- package/dist/base/odata-request-error.js +1 -1
- package/dist/base/odata-service.js +35 -51
- package/dist/base/patchTls.js +1 -0
- package/dist/base/service-provider.js +9 -9
- package/dist/factory.js +25 -35
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/package.json +4 -4
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.AbapServiceProvider = void 0;
|
|
13
4
|
const service_provider_1 = require("../base/service-provider");
|
|
@@ -26,6 +17,11 @@ const ui_service_generator_1 = require("./adt-catalog/generators/ui-service-gene
|
|
|
26
17
|
* Extension of the service provider for ABAP services.
|
|
27
18
|
*/
|
|
28
19
|
class AbapServiceProvider extends service_provider_1.ServiceProvider {
|
|
20
|
+
atoSettings;
|
|
21
|
+
/**
|
|
22
|
+
* Maintain the public facing URL which is required for destination related flows
|
|
23
|
+
*/
|
|
24
|
+
_publicUrl;
|
|
29
25
|
/**
|
|
30
26
|
* Get the name of the currently logged in user. This is the basic implementation that could be overwritten by subclasses.
|
|
31
27
|
* The function returns a promise because it may be required to fetch the information from the backend.
|
|
@@ -33,8 +29,7 @@ class AbapServiceProvider extends service_provider_1.ServiceProvider {
|
|
|
33
29
|
* @returns the username
|
|
34
30
|
*/
|
|
35
31
|
user() {
|
|
36
|
-
|
|
37
|
-
return Promise.resolve((_a = this.defaults.auth) === null || _a === void 0 ? void 0 : _a.username);
|
|
32
|
+
return Promise.resolve(this.defaults.auth?.username);
|
|
38
33
|
}
|
|
39
34
|
/**
|
|
40
35
|
* Set the ATO settings for the provider so that it does not try to fetch them with the first request.
|
|
@@ -49,26 +44,24 @@ class AbapServiceProvider extends service_provider_1.ServiceProvider {
|
|
|
49
44
|
*
|
|
50
45
|
* @returns ABAP Transport Organizer settings
|
|
51
46
|
*/
|
|
52
|
-
getAtoInfo() {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
this.atoSettings = yield atoService.getAtoInfo();
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
this.atoSettings = {};
|
|
65
|
-
}
|
|
47
|
+
async getAtoInfo() {
|
|
48
|
+
if (this.atoSettings) {
|
|
49
|
+
return this.atoSettings;
|
|
50
|
+
}
|
|
51
|
+
let atoService;
|
|
52
|
+
try {
|
|
53
|
+
atoService = await this.getAdtService(services_1.AtoService);
|
|
54
|
+
if (atoService) {
|
|
55
|
+
this.atoSettings = await atoService.getAtoInfo();
|
|
66
56
|
}
|
|
67
|
-
|
|
57
|
+
else {
|
|
68
58
|
this.atoSettings = {};
|
|
69
59
|
}
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
this.atoSettings = {};
|
|
63
|
+
}
|
|
64
|
+
return this.atoSettings;
|
|
72
65
|
}
|
|
73
66
|
/**
|
|
74
67
|
* Set the public facing URL, typically used for a destination related flows.
|
|
@@ -91,16 +84,14 @@ class AbapServiceProvider extends service_provider_1.ServiceProvider {
|
|
|
91
84
|
*
|
|
92
85
|
* @returns true if it an S/4HANA cloud system
|
|
93
86
|
*/
|
|
94
|
-
isS4Cloud() {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
this.atoSettings.developmentPackage !== '');
|
|
103
|
-
});
|
|
87
|
+
async isS4Cloud() {
|
|
88
|
+
if (this.atoSettings === undefined) {
|
|
89
|
+
await this.getAtoInfo();
|
|
90
|
+
}
|
|
91
|
+
return (this.atoSettings.tenantType === types_1.TenantType.Customer &&
|
|
92
|
+
this.atoSettings.operationsType === 'C' &&
|
|
93
|
+
this.atoSettings.developmentPrefix !== '' &&
|
|
94
|
+
this.atoSettings.developmentPackage !== '');
|
|
104
95
|
}
|
|
105
96
|
/**
|
|
106
97
|
* Create or get an existing instance of AdtCatalogService for fetching ADT schema.
|
|
@@ -121,15 +112,16 @@ class AbapServiceProvider extends service_provider_1.ServiceProvider {
|
|
|
121
112
|
* @returns an instance of the catalog service.
|
|
122
113
|
*/
|
|
123
114
|
catalog(version) {
|
|
124
|
-
var _a, _b;
|
|
125
115
|
let service;
|
|
126
116
|
if (version === odata_service_1.ODataVersion.v2) {
|
|
127
117
|
service =
|
|
128
|
-
|
|
118
|
+
this.services[catalog_1.V2CatalogService.PATH] ??
|
|
119
|
+
this.createService(catalog_1.V2CatalogService.PATH, catalog_1.V2CatalogService);
|
|
129
120
|
}
|
|
130
121
|
else if (version === odata_service_1.ODataVersion.v4) {
|
|
131
122
|
service =
|
|
132
|
-
|
|
123
|
+
this.services[catalog_1.V4CatalogService.PATH] ??
|
|
124
|
+
this.createService(catalog_1.V4CatalogService.PATH, catalog_1.V4CatalogService);
|
|
133
125
|
}
|
|
134
126
|
else {
|
|
135
127
|
throw new Error('not implemented yet');
|
|
@@ -146,7 +138,7 @@ class AbapServiceProvider extends service_provider_1.ServiceProvider {
|
|
|
146
138
|
* @returns an instance of the UI5 ABAP repository service.
|
|
147
139
|
*/
|
|
148
140
|
getUi5AbapRepository(alias) {
|
|
149
|
-
const path = alias
|
|
141
|
+
const path = alias ?? ui5_abap_repository_service_1.Ui5AbapRepositoryService.PATH;
|
|
150
142
|
if (!this.services[path]) {
|
|
151
143
|
this.services[path] = this.createService(path, ui5_abap_repository_service_1.Ui5AbapRepositoryService);
|
|
152
144
|
}
|
|
@@ -170,7 +162,7 @@ class AbapServiceProvider extends service_provider_1.ServiceProvider {
|
|
|
170
162
|
* @returns an instance of the design time adaptation service.
|
|
171
163
|
*/
|
|
172
164
|
getLayeredRepository(alias) {
|
|
173
|
-
const path = alias
|
|
165
|
+
const path = alias ?? lrep_service_1.LayeredRepositoryService.PATH;
|
|
174
166
|
if (!this.services[path]) {
|
|
175
167
|
this.services[path] = this.createService(path, lrep_service_1.LayeredRepositoryService);
|
|
176
168
|
}
|
|
@@ -186,23 +178,21 @@ class AbapServiceProvider extends service_provider_1.ServiceProvider {
|
|
|
186
178
|
* @param adtServiceSubclass Subclass of class AdtService, type is specified by using AdtService class constructor signature.
|
|
187
179
|
* @returns Subclass type of class AdtService
|
|
188
180
|
*/
|
|
189
|
-
getAdtService(adtServiceSubclass) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
|
-
// Create singleton instance of AdtService subclass
|
|
201
|
-
this.services[subclassName] = this.createService(adtSchema.href, adtServiceSubclass);
|
|
202
|
-
this.services[subclassName].attachAdtSchema(adtSchema);
|
|
181
|
+
async getAdtService(adtServiceSubclass) {
|
|
182
|
+
const subclassName = adtServiceSubclass.name;
|
|
183
|
+
if (!this.services[subclassName]) {
|
|
184
|
+
// Retrieve ADT schema for the specific input AdtService subclass
|
|
185
|
+
const adtCatalogService = this.getAdtCatalogService();
|
|
186
|
+
const adtSchema = await adtCatalogService.getServiceDefinition(adtServiceSubclass.getAdtCatagory());
|
|
187
|
+
// No ADT schema available neither locally nor from service query.
|
|
188
|
+
if (!adtSchema) {
|
|
189
|
+
return null;
|
|
203
190
|
}
|
|
204
|
-
|
|
205
|
-
|
|
191
|
+
// Create singleton instance of AdtService subclass
|
|
192
|
+
this.services[subclassName] = this.createService(adtSchema.href, adtServiceSubclass);
|
|
193
|
+
this.services[subclassName].attachAdtSchema(adtSchema);
|
|
194
|
+
}
|
|
195
|
+
return this.services[subclassName];
|
|
206
196
|
}
|
|
207
197
|
/**
|
|
208
198
|
* Create a UI Service generator for the given business object.
|
|
@@ -210,17 +200,15 @@ class AbapServiceProvider extends service_provider_1.ServiceProvider {
|
|
|
210
200
|
* @param bo - business object
|
|
211
201
|
* @returns a UI Service generator
|
|
212
202
|
*/
|
|
213
|
-
getUiServiceGenerator(bo) {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
return gen;
|
|
223
|
-
});
|
|
203
|
+
async getUiServiceGenerator(bo) {
|
|
204
|
+
const generatorService = await this.getAdtService(services_1.GeneratorService);
|
|
205
|
+
if (!generatorService) {
|
|
206
|
+
throw new Error('Generators are not support on this system');
|
|
207
|
+
}
|
|
208
|
+
const config = await generatorService.getUIServiceGeneratorConfig(bo.name);
|
|
209
|
+
const gen = this.createService(this.getServiceUrlFromConfig(config), ui_service_generator_1.UiServiceGenerator);
|
|
210
|
+
gen.configure(config, bo);
|
|
211
|
+
return gen;
|
|
224
212
|
}
|
|
225
213
|
/**
|
|
226
214
|
* Get the service URL from the generator config.
|
|
@@ -229,9 +217,8 @@ class AbapServiceProvider extends service_provider_1.ServiceProvider {
|
|
|
229
217
|
* @returns the service URL
|
|
230
218
|
*/
|
|
231
219
|
getServiceUrlFromConfig(config) {
|
|
232
|
-
var _a;
|
|
233
220
|
// make code in this function defensive against undefined href
|
|
234
|
-
if (Array.isArray(config.link) && !
|
|
221
|
+
if (Array.isArray(config.link) && !config.link[0]?.href) {
|
|
235
222
|
throw new Error('No service URL found in the generator config');
|
|
236
223
|
}
|
|
237
224
|
const endIndex = config.link[0].href.indexOf(config.id) + config.id.length;
|
|
@@ -243,11 +230,9 @@ class AbapServiceProvider extends service_provider_1.ServiceProvider {
|
|
|
243
230
|
* @param path - service binding path
|
|
244
231
|
* @returns a service provider instance to lock the service binding
|
|
245
232
|
*/
|
|
246
|
-
createLockServiceBindingGenerator(path) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
return gen;
|
|
250
|
-
});
|
|
233
|
+
async createLockServiceBindingGenerator(path) {
|
|
234
|
+
const gen = this.createService(path, ui_service_generator_1.UiServiceGenerator);
|
|
235
|
+
return gen;
|
|
251
236
|
}
|
|
252
237
|
}
|
|
253
238
|
exports.AbapServiceProvider = AbapServiceProvider;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.AdtCatalogService = void 0;
|
|
13
4
|
const axios_1 = require("axios");
|
|
@@ -18,11 +9,12 @@ const fast_xml_parser_1 = require("fast-xml-parser");
|
|
|
18
9
|
* Adt service specification for a given ADT service.
|
|
19
10
|
*/
|
|
20
11
|
class AdtCatalogService extends axios_1.Axios {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
// Discovery service url provided by ADT team
|
|
13
|
+
static ADT_DISCOVERY_SERVICE_PATH = '/sap/bc/adt/discovery';
|
|
14
|
+
// Cache of fetched discovery schema
|
|
15
|
+
schemaStore = new adt_schema_store_1.AdtSchemaStore();
|
|
16
|
+
// Instantiated by calling ServiceProvider.createService()
|
|
17
|
+
log;
|
|
26
18
|
/**
|
|
27
19
|
* Adt Catalog Service which fetches the Adt service
|
|
28
20
|
* specification for a given ADT service.
|
|
@@ -30,20 +22,18 @@ class AdtCatalogService extends axios_1.Axios {
|
|
|
30
22
|
* @param adtCategory Adt service Id
|
|
31
23
|
* @returns Service schema of the input Adt service
|
|
32
24
|
*/
|
|
33
|
-
getServiceDefinition(adtCategory) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
});
|
|
25
|
+
async getServiceDefinition(adtCategory) {
|
|
26
|
+
await this.checkOrLoadAdtDiscoverySchema();
|
|
27
|
+
// Find the schema for the input service url path
|
|
28
|
+
const serviceSchema = this.schemaStore.getAdtCollection(adtCategory);
|
|
29
|
+
const isValidSchema = this.validateServiceSchema(adtCategory, serviceSchema);
|
|
30
|
+
if (isValidSchema) {
|
|
31
|
+
return serviceSchema;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.log.warn('Invalid Discovery Schema');
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
47
37
|
}
|
|
48
38
|
/**
|
|
49
39
|
*
|
|
@@ -70,19 +60,17 @@ class AdtCatalogService extends axios_1.Axios {
|
|
|
70
60
|
*
|
|
71
61
|
* @returns Promise<void>
|
|
72
62
|
*/
|
|
73
|
-
checkOrLoadAdtDiscoverySchema() {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
63
|
+
async checkOrLoadAdtDiscoverySchema() {
|
|
64
|
+
if (!this.schemaStore.isAdtSchemaEmpty()) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const response = await this.get('', {
|
|
68
|
+
headers: {
|
|
69
|
+
Accept: 'application/*'
|
|
77
70
|
}
|
|
78
|
-
const response = yield this.get('', {
|
|
79
|
-
headers: {
|
|
80
|
-
Accept: 'application/*'
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
const schemaData = this.parseAdtSchemaData(response.data);
|
|
84
|
-
this.schemaStore.updateSchemaData(schemaData);
|
|
85
71
|
});
|
|
72
|
+
const schemaData = this.parseAdtSchemaData(response.data);
|
|
73
|
+
this.schemaStore.updateSchemaData(schemaData);
|
|
86
74
|
}
|
|
87
75
|
/**
|
|
88
76
|
*
|
|
@@ -111,6 +99,4 @@ class AdtCatalogService extends axios_1.Axios {
|
|
|
111
99
|
}
|
|
112
100
|
}
|
|
113
101
|
exports.AdtCatalogService = AdtCatalogService;
|
|
114
|
-
// Discovery service url provided by ADT team
|
|
115
|
-
AdtCatalogService.ADT_DISCOVERY_SERVICE_PATH = '/sap/bc/adt/discovery';
|
|
116
102
|
//# sourceMappingURL=adt-catalog-service.js.map
|
|
@@ -5,6 +5,10 @@ exports.AdtSchemaStore = void 0;
|
|
|
5
5
|
* This class stores the ADT schema fetched by calling ADT discovery service.
|
|
6
6
|
*/
|
|
7
7
|
class AdtSchemaStore {
|
|
8
|
+
/**
|
|
9
|
+
* ADT schema is modeled as a map for fast access
|
|
10
|
+
*/
|
|
11
|
+
adtSchema;
|
|
8
12
|
/**
|
|
9
13
|
* Given the ID of a particular ADT service, return the schema of this service.
|
|
10
14
|
*
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Logger } from '@sap-ux/logger';
|
|
2
1
|
import type { GeneratorEntry } from './types';
|
|
3
2
|
import type { BusinessObject, ValidationResponse } from '../../types';
|
|
4
3
|
import { AdtService } from '../services';
|
|
@@ -6,7 +5,6 @@ import { AdtService } from '../services';
|
|
|
6
5
|
*
|
|
7
6
|
*/
|
|
8
7
|
export declare class UiServiceGenerator extends AdtService {
|
|
9
|
-
log: Logger;
|
|
10
8
|
protected bo: BusinessObject;
|
|
11
9
|
/**
|
|
12
10
|
* Configure the UI service generator.
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.UiServiceGenerator = void 0;
|
|
13
4
|
const services_1 = require("../services");
|
|
@@ -15,6 +6,7 @@ const services_1 = require("../services");
|
|
|
15
6
|
*
|
|
16
7
|
*/
|
|
17
8
|
class UiServiceGenerator extends services_1.AdtService {
|
|
9
|
+
bo;
|
|
18
10
|
/**
|
|
19
11
|
* Configure the UI service generator.
|
|
20
12
|
*
|
|
@@ -29,18 +21,16 @@ class UiServiceGenerator extends services_1.AdtService {
|
|
|
29
21
|
*
|
|
30
22
|
* @returns The schema of the service binding.
|
|
31
23
|
*/
|
|
32
|
-
getSchema() {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
return JSON.parse(response.data);
|
|
24
|
+
async getSchema() {
|
|
25
|
+
const response = await this.get('/schema', {
|
|
26
|
+
headers: {
|
|
27
|
+
Accept: 'application/vnd.sap.adt.repository.generator.schema.v1+json'
|
|
28
|
+
},
|
|
29
|
+
params: {
|
|
30
|
+
referencedObject: this.bo.uri
|
|
31
|
+
}
|
|
43
32
|
});
|
|
33
|
+
return JSON.parse(response.data);
|
|
44
34
|
}
|
|
45
35
|
/**
|
|
46
36
|
* Get the content of the service binding.
|
|
@@ -48,26 +38,24 @@ class UiServiceGenerator extends services_1.AdtService {
|
|
|
48
38
|
* @param pckg - The package name.
|
|
49
39
|
* @returns The content of the service binding.
|
|
50
40
|
*/
|
|
51
|
-
getContent(pckg) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
package: pckg
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
const content = response.data;
|
|
63
|
-
const contentObj = JSON.parse(content);
|
|
64
|
-
if (!contentObj['metadata']) {
|
|
65
|
-
contentObj['metadata'] = {
|
|
66
|
-
package: pckg
|
|
67
|
-
};
|
|
41
|
+
async getContent(pckg) {
|
|
42
|
+
const response = await this.get('/content', {
|
|
43
|
+
headers: {
|
|
44
|
+
Accept: 'application/vnd.sap.adt.repository.generator.content.v1+json'
|
|
45
|
+
},
|
|
46
|
+
params: {
|
|
47
|
+
referencedObject: this.bo.uri,
|
|
48
|
+
package: pckg
|
|
68
49
|
}
|
|
69
|
-
return JSON.stringify(contentObj);
|
|
70
50
|
});
|
|
51
|
+
const content = response.data;
|
|
52
|
+
const contentObj = JSON.parse(content);
|
|
53
|
+
if (!contentObj['metadata']) {
|
|
54
|
+
contentObj['metadata'] = {
|
|
55
|
+
package: pckg
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return JSON.stringify(contentObj);
|
|
71
59
|
}
|
|
72
60
|
/**
|
|
73
61
|
* Validate the package before generation.
|
|
@@ -75,20 +63,18 @@ class UiServiceGenerator extends services_1.AdtService {
|
|
|
75
63
|
* @param pckg - The package to be validated.
|
|
76
64
|
* @returns The response of the validation.
|
|
77
65
|
*/
|
|
78
|
-
validatePackage(pckg) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
return this.parseResponse(response.data);
|
|
66
|
+
async validatePackage(pckg) {
|
|
67
|
+
const response = await this.get('/validation', {
|
|
68
|
+
headers: {
|
|
69
|
+
Accept: 'application/vnd.sap.adt.validationMessages.v1+xml'
|
|
70
|
+
},
|
|
71
|
+
params: {
|
|
72
|
+
referencedObject: this.bo.uri,
|
|
73
|
+
package: pckg,
|
|
74
|
+
checks: 'package'
|
|
75
|
+
}
|
|
91
76
|
});
|
|
77
|
+
return this.parseResponse(response.data);
|
|
92
78
|
}
|
|
93
79
|
/**
|
|
94
80
|
* Validate the service content and package before generation.
|
|
@@ -96,22 +82,19 @@ class UiServiceGenerator extends services_1.AdtService {
|
|
|
96
82
|
* @param content - The content to be validated.
|
|
97
83
|
* @returns The response of the validation.
|
|
98
84
|
*/
|
|
99
|
-
validateContent(content) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
checks: 'package,referencedobject,authorization'
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
const data = this.parseResponse(response.data);
|
|
113
|
-
return (_a = data.validationMessages) === null || _a === void 0 ? void 0 : _a.validationMessage;
|
|
85
|
+
async validateContent(content) {
|
|
86
|
+
const response = await this.post('/validation', content, {
|
|
87
|
+
headers: {
|
|
88
|
+
'Content-Type': 'application/vnd.sap.adt.repository.generator.content.v1+json',
|
|
89
|
+
Accept: 'application/vnd.sap.adt.validationMessages.v1+xml'
|
|
90
|
+
},
|
|
91
|
+
params: {
|
|
92
|
+
referencedObject: this.bo.uri,
|
|
93
|
+
checks: 'package,referencedobject,authorization'
|
|
94
|
+
}
|
|
114
95
|
});
|
|
96
|
+
const data = this.parseResponse(response.data);
|
|
97
|
+
return data.validationMessages?.validationMessage;
|
|
115
98
|
}
|
|
116
99
|
/**
|
|
117
100
|
* Generate the service binding.
|
|
@@ -120,20 +103,18 @@ class UiServiceGenerator extends services_1.AdtService {
|
|
|
120
103
|
* @param transport - The transport.
|
|
121
104
|
* @returns The object references.
|
|
122
105
|
*/
|
|
123
|
-
generate(content, transport) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
return JSON.parse(response.data);
|
|
106
|
+
async generate(content, transport) {
|
|
107
|
+
const response = await this.post('', content, {
|
|
108
|
+
headers: {
|
|
109
|
+
'Content-Type': 'application/vnd.sap.adt.repository.generator.content.v1+json',
|
|
110
|
+
Accept: 'application/vnd.sap.adt.repository.generator.v1+json, application/vnd.sap.as+xml;charset=UTF-8;dataname=com.sap.adt.StatusMessage'
|
|
111
|
+
},
|
|
112
|
+
params: {
|
|
113
|
+
referencedObject: this.bo.uri,
|
|
114
|
+
corrNr: transport
|
|
115
|
+
}
|
|
136
116
|
});
|
|
117
|
+
return this.parseResponse(response.data);
|
|
137
118
|
}
|
|
138
119
|
}
|
|
139
120
|
exports.UiServiceGenerator = UiServiceGenerator;
|
|
@@ -8,6 +8,10 @@ const fast_xml_parser_1 = require("fast-xml-parser");
|
|
|
8
8
|
* should be implemented as subclass of AdtService.
|
|
9
9
|
*/
|
|
10
10
|
class AdtService extends axios_1.Axios {
|
|
11
|
+
// Instantiated by calling ServiceProvider.createService()
|
|
12
|
+
log;
|
|
13
|
+
// ADT schema for the corresponding AdtService subclass
|
|
14
|
+
serviceSchema;
|
|
11
15
|
/**
|
|
12
16
|
* Subclass that implements each specific ADT service
|
|
13
17
|
* should provide AdtCatagory for the corresponding AdtService.
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.AtoService = void 0;
|
|
13
4
|
const adt_service_1 = require("./adt-service");
|
|
@@ -16,6 +7,13 @@ const fast_xml_parser_1 = require("fast-xml-parser");
|
|
|
16
7
|
* AtoService implements ADT requests for fetching ATO settings.
|
|
17
8
|
*/
|
|
18
9
|
class AtoService extends adt_service_1.AdtService {
|
|
10
|
+
/**
|
|
11
|
+
* @see AdtService.getAdtCatagory()
|
|
12
|
+
*/
|
|
13
|
+
static adtCategory = {
|
|
14
|
+
scheme: 'http://www.sap.com/adt/categories/ato',
|
|
15
|
+
term: 'settings'
|
|
16
|
+
};
|
|
19
17
|
/**
|
|
20
18
|
* @see AdtService.getAdtCatagory()
|
|
21
19
|
* @returns AdtCategory
|
|
@@ -28,16 +26,14 @@ class AtoService extends adt_service_1.AdtService {
|
|
|
28
26
|
*
|
|
29
27
|
* @returns AtoSettings
|
|
30
28
|
*/
|
|
31
|
-
getAtoInfo() {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return this.parseAtoResponse(response.data);
|
|
40
|
-
});
|
|
29
|
+
async getAtoInfo() {
|
|
30
|
+
const acceptHeaders = {
|
|
31
|
+
headers: {
|
|
32
|
+
Accept: 'application/*'
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const response = await this.get('', acceptHeaders);
|
|
36
|
+
return this.parseAtoResponse(response.data);
|
|
41
37
|
}
|
|
42
38
|
/**
|
|
43
39
|
* Parse an XML document for ATO (Adaptation Transport Organizer) settings.
|
|
@@ -63,11 +59,4 @@ class AtoService extends adt_service_1.AdtService {
|
|
|
63
59
|
}
|
|
64
60
|
}
|
|
65
61
|
exports.AtoService = AtoService;
|
|
66
|
-
/**
|
|
67
|
-
* @see AdtService.getAdtCatagory()
|
|
68
|
-
*/
|
|
69
|
-
AtoService.adtCategory = {
|
|
70
|
-
scheme: 'http://www.sap.com/adt/categories/ato',
|
|
71
|
-
term: 'settings'
|
|
72
|
-
};
|
|
73
62
|
//# sourceMappingURL=ato-service.js.map
|