@sap-ux/axios-extension 1.0.0 → 1.0.2
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/adt-catalog/index.js +5 -1
- package/dist/abap/adt-catalog/services/transportcheck-service.js +5 -1
- package/dist/abap/app-index-service.d.ts +1 -1
- package/dist/abap/catalog/index.js +5 -1
- package/dist/abap/catalog/v2-catalog-service.js +11 -2
- package/dist/abap/index.js +5 -1
- package/dist/abap/lrep-service.d.ts +2 -2
- package/dist/abap/lrep-service.js +2 -2
- package/dist/abap/types/adt-types.d.ts +6 -6
- package/dist/abap/types/index.js +5 -1
- package/dist/abap/ui5-abap-repository-service.d.ts +1 -0
- package/dist/abap/ui5-abap-repository-service.js +4 -4
- package/dist/auth/connection.js +1 -1
- package/dist/auth/index.js +6 -2
- package/dist/auth/reentrance-ticket/index.js +1 -1
- package/dist/auth/reentrance-ticket/redirect.js +3 -3
- package/dist/auth/uaa.d.ts +1 -1
- package/dist/auth/uaa.js +2 -2
- package/dist/base/service-provider.d.ts +1 -1
- package/dist/factory.d.ts +2 -2
- package/dist/factory.js +9 -9
- package/dist/index.js +5 -1
- package/package.json +3 -3
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -5,7 +5,7 @@ export interface App {
|
|
|
5
5
|
'sap.app/id': string;
|
|
6
6
|
url: string;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export type AppIndex = Partial<App>[];
|
|
9
9
|
/**
|
|
10
10
|
* A class respresenting the app index service allowing to search applications deployed on an ABAP system.
|
|
11
11
|
*/
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -80,15 +80,24 @@ class V2CatalogService extends base_1.CatalogService {
|
|
|
80
80
|
*/
|
|
81
81
|
findService({ title, path }) {
|
|
82
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
let version = 1;
|
|
83
84
|
if (!title) {
|
|
84
|
-
|
|
85
|
+
const titleWithParameters = path.replace(/\/$/, '').split('/').pop().split(';');
|
|
86
|
+
title = titleWithParameters[0].toUpperCase();
|
|
85
87
|
if (!title) {
|
|
86
88
|
throw new Error(`Cannot determine service title from path: ${path}`);
|
|
87
89
|
}
|
|
90
|
+
const segParams = titleWithParameters.slice(1);
|
|
91
|
+
segParams.forEach((parameter) => {
|
|
92
|
+
const [key, value] = parameter.split('=');
|
|
93
|
+
if (key === 'v') {
|
|
94
|
+
version = parseInt(value, 10);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
88
97
|
}
|
|
89
98
|
const params = {
|
|
90
99
|
$format: 'json',
|
|
91
|
-
$filter: `Title eq '${title}'`
|
|
100
|
+
$filter: `Title eq '${title}' and TechnicalServiceVersion eq ${version}`
|
|
92
101
|
};
|
|
93
102
|
const response = yield this.get(`/${this.entitySet}`, { params });
|
|
94
103
|
const services = response.odata();
|
package/dist/abap/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -5,7 +5,7 @@ import type { Logger } from '@sap-ux/logger';
|
|
|
5
5
|
/**
|
|
6
6
|
* Object structure representing a namespace: containing an id (variant id) and a reference (base application id).
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type NamespaceObject = {
|
|
9
9
|
/**
|
|
10
10
|
* variant id
|
|
11
11
|
*/
|
|
@@ -18,7 +18,7 @@ export declare type NamespaceObject = {
|
|
|
18
18
|
/**
|
|
19
19
|
* Type representing a namespace. It is either a string or an object.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export type Namespace = NamespaceObject | string;
|
|
22
22
|
/**
|
|
23
23
|
* Required configuration to deploy an adaptation project.
|
|
24
24
|
*/
|
|
@@ -52,7 +52,7 @@ class LayeredRepositoryService extends axios_1.Axios {
|
|
|
52
52
|
return response;
|
|
53
53
|
}
|
|
54
54
|
catch (error) {
|
|
55
|
-
if (odata_request_error_1.isAxiosError(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
55
|
+
if ((0, odata_request_error_1.isAxiosError)(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
56
56
|
return error.response;
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
@@ -71,7 +71,7 @@ class LayeredRepositoryService extends axios_1.Axios {
|
|
|
71
71
|
deploy(archivePath, config) {
|
|
72
72
|
var _a;
|
|
73
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
const archive = fs_1.readFileSync(archivePath);
|
|
74
|
+
const archive = (0, fs_1.readFileSync)(archivePath);
|
|
75
75
|
const checkResponse = yield this.isExistingVariant(config.namespace);
|
|
76
76
|
const params = {
|
|
77
77
|
name: getNamespaceAsString(config.namespace),
|
|
@@ -9,9 +9,9 @@ export interface AdtSchemaData {
|
|
|
9
9
|
workspace: AdtWorkspace[];
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
12
|
+
export type AdtCategoryTerm = string;
|
|
13
|
+
export type AdtWorkspaceTitle = string;
|
|
14
|
+
export type AdtCategoryId = string;
|
|
15
15
|
/**
|
|
16
16
|
* AdtWorkspace groups ADT services based on their
|
|
17
17
|
* functionalities.
|
|
@@ -42,7 +42,7 @@ export interface AdtCollection {
|
|
|
42
42
|
templateLinks: any;
|
|
43
43
|
[key: string]: any;
|
|
44
44
|
}
|
|
45
|
-
export
|
|
45
|
+
export type AdtAcceptContentType = string[] | string;
|
|
46
46
|
/**
|
|
47
47
|
* Uniquely identifies a ADT service. Provide an AdtCategory
|
|
48
48
|
* as key to look for the service schema of the corresponding ADT service.
|
|
@@ -68,7 +68,7 @@ export declare enum TenantType {
|
|
|
68
68
|
/**
|
|
69
69
|
* Possible values for operations type property: (C)loud and on-(P)remise.
|
|
70
70
|
*/
|
|
71
|
-
export
|
|
71
|
+
export type OperationsType = 'C' | 'P';
|
|
72
72
|
export interface AtoSettings {
|
|
73
73
|
developmentPackage?: string;
|
|
74
74
|
developmentPrefix?: string;
|
|
@@ -77,6 +77,6 @@ export interface AtoSettings {
|
|
|
77
77
|
tenantType?: TenantType;
|
|
78
78
|
isTransportRequestRequired?: boolean;
|
|
79
79
|
}
|
|
80
|
-
export
|
|
80
|
+
export type AdtTransportStatus = 'S' | 'E';
|
|
81
81
|
export declare const LocalPackageText: string[];
|
|
82
82
|
//# sourceMappingURL=adt-types.d.ts.map
|
package/dist/abap/types/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -91,7 +91,7 @@ class Ui5AbapRepositoryService extends odata_service_1.ODataService {
|
|
|
91
91
|
const response = yield this.updateRepoRequest(!!info, bsp.name, payload, config);
|
|
92
92
|
// An app can be successfully deployed after a timeout exception, no value in showing exception headers
|
|
93
93
|
if ((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a['sap-message']) {
|
|
94
|
-
message_1.prettyPrintMessage({ msg: response.headers['sap-message'], log: this.log, host: frontendUrl });
|
|
94
|
+
(0, message_1.prettyPrintMessage)({ msg: response.headers['sap-message'], log: this.log, host: frontendUrl });
|
|
95
95
|
}
|
|
96
96
|
// log url of created/updated app
|
|
97
97
|
const path = '/sap/bc/ui5_ui5' + (!bsp.name.startsWith('/') ? '/sap/' : '') + bsp.name.toLowerCase();
|
|
@@ -125,7 +125,7 @@ class Ui5AbapRepositoryService extends odata_service_1.ODataService {
|
|
|
125
125
|
if (info) {
|
|
126
126
|
const response = yield this.deleteRepoRequest(bsp.name, config);
|
|
127
127
|
if ((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a['sap-message']) {
|
|
128
|
-
message_1.prettyPrintMessage({ msg: response.headers['sap-message'], log: this.log, host });
|
|
128
|
+
(0, message_1.prettyPrintMessage)({ msg: response.headers['sap-message'], log: this.log, host });
|
|
129
129
|
}
|
|
130
130
|
return response;
|
|
131
131
|
}
|
|
@@ -307,9 +307,9 @@ class Ui5AbapRepositoryService extends odata_service_1.ODataService {
|
|
|
307
307
|
logError({ error, host }) {
|
|
308
308
|
var _a;
|
|
309
309
|
this.log.error(error.message);
|
|
310
|
-
if (odata_request_error_1.isAxiosError(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data)) {
|
|
310
|
+
if ((0, odata_request_error_1.isAxiosError)(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data)) {
|
|
311
311
|
if (error.response.data['error']) {
|
|
312
|
-
message_1.prettyPrintError({ error: error.response.data['error'], host, log: this.log });
|
|
312
|
+
(0, message_1.prettyPrintError)({ error: error.response.data['error'], host, log: this.log });
|
|
313
313
|
}
|
|
314
314
|
else {
|
|
315
315
|
this.log.error(error.response.data);
|
package/dist/auth/connection.js
CHANGED
|
@@ -124,7 +124,7 @@ function getContentType(contentTypeHeader, responseData) {
|
|
|
124
124
|
}
|
|
125
125
|
else if (typeof responseData === 'string') {
|
|
126
126
|
// Try to infer it from the data
|
|
127
|
-
return (_b = (_a = detect_content_type_1.default(Buffer.from(responseData))) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : '';
|
|
127
|
+
return (_b = (_a = (0, detect_content_type_1.default)(Buffer.from(responseData))) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : '';
|
|
128
128
|
}
|
|
129
129
|
else {
|
|
130
130
|
return '';
|
package/dist/auth/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -87,7 +91,7 @@ exports.attachReentranceTicketAuthInterceptor = attachReentranceTicketAuthInterc
|
|
|
87
91
|
function getReentranceTicketAuthInterceptor({ provider, ejectCallback }) {
|
|
88
92
|
return (request) => __awaiter(this, void 0, void 0, function* () {
|
|
89
93
|
var _a;
|
|
90
|
-
const { reentranceTicket, apiUrl } = yield reentrance_ticket_1.getReentranceTicket({
|
|
94
|
+
const { reentranceTicket, apiUrl } = yield (0, reentrance_ticket_1.getReentranceTicket)({
|
|
91
95
|
backendUrl: provider.defaults.baseURL,
|
|
92
96
|
logger: provider.log
|
|
93
97
|
});
|
|
@@ -32,7 +32,7 @@ function getReentranceTicket({ backendUrl, logger, timeout = connection_1.defaul
|
|
|
32
32
|
return new Promise((resolve, reject) => {
|
|
33
33
|
const backend = new abap_system_1.ABAPSystem(backendUrl);
|
|
34
34
|
// Start local server to listen to redirect call, with timeout
|
|
35
|
-
const { server, redirectUrl } = redirect_1.setupRedirectHandling({ resolve, reject, timeout, backend, logger });
|
|
35
|
+
const { server, redirectUrl } = (0, redirect_1.setupRedirectHandling)({ resolve, reject, timeout, backend, logger });
|
|
36
36
|
server.listen();
|
|
37
37
|
const redirectPort = server.address().port;
|
|
38
38
|
// Open browser to handle SAML flow and return the reentrance ticket
|
|
@@ -24,7 +24,7 @@ function setupRedirectHandling({ resolve, reject, timeout, backend, logger }) {
|
|
|
24
24
|
let server;
|
|
25
25
|
const handleTimeout = () => {
|
|
26
26
|
server === null || server === void 0 ? void 0 : server.close();
|
|
27
|
-
reject(new error_1.TimeoutError(`Timeout. Did not get a response within ${message_1.prettyPrintTimeInMs(timeout)}`));
|
|
27
|
+
reject(new error_1.TimeoutError(`Timeout. Did not get a response within ${(0, message_1.prettyPrintTimeInMs)(timeout)}`));
|
|
28
28
|
};
|
|
29
29
|
const timer = setTimeout(handleTimeout, timeout);
|
|
30
30
|
server = http_1.default.createServer((req, res) => {
|
|
@@ -38,7 +38,7 @@ function setupRedirectHandling({ resolve, reject, timeout, backend, logger }) {
|
|
|
38
38
|
if (reentranceTicket) {
|
|
39
39
|
logger.debug('Got reentrance ticket: ' + reentranceTicket);
|
|
40
40
|
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
41
|
-
res.end(Buffer.from(static_1.redirectSuccessHtml(backend.logoffUrl())));
|
|
41
|
+
res.end(Buffer.from((0, static_1.redirectSuccessHtml)(backend.logoffUrl())));
|
|
42
42
|
server.close();
|
|
43
43
|
resolve({ reentranceTicket, apiUrl: backend.apiHostname() });
|
|
44
44
|
}
|
|
@@ -46,7 +46,7 @@ function setupRedirectHandling({ resolve, reject, timeout, backend, logger }) {
|
|
|
46
46
|
logger.error('Error getting reentrance ticket');
|
|
47
47
|
logger.debug(req);
|
|
48
48
|
res.writeHead(500, { 'Content-Type': 'text/html' });
|
|
49
|
-
res.end(Buffer.from(static_1.redirectErrorHtml()));
|
|
49
|
+
res.end(Buffer.from((0, static_1.redirectErrorHtml)()));
|
|
50
50
|
server.close();
|
|
51
51
|
reject(new error_1.ConnectionError('Error getting reentrance ticket'));
|
|
52
52
|
}
|
package/dist/auth/uaa.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { AxiosRequestConfig } from 'axios';
|
|
|
2
2
|
import type { Logger } from '@sap-ux/logger';
|
|
3
3
|
import type { ServiceInfo } from '@sap-ux/btp-utils';
|
|
4
4
|
import { Redirect } from './redirect';
|
|
5
|
-
export
|
|
5
|
+
export type RefreshTokenChanged = (refreshToken?: string) => void | Promise<void>;
|
|
6
6
|
/**
|
|
7
7
|
* A class representing interactions with an SAP BTP UAA service
|
|
8
8
|
*/
|
package/dist/auth/uaa.js
CHANGED
|
@@ -182,14 +182,14 @@ class Uaa {
|
|
|
182
182
|
let server;
|
|
183
183
|
const handleTimeout = () => {
|
|
184
184
|
server === null || server === void 0 ? void 0 : server.close();
|
|
185
|
-
reject(new error_1.UAATimeoutError(`Timeout. Did not get a response within ${message_1.prettyPrintTimeInMs(timeout)}`));
|
|
185
|
+
reject(new error_1.UAATimeoutError(`Timeout. Did not get a response within ${(0, message_1.prettyPrintTimeInMs)(timeout)}`));
|
|
186
186
|
};
|
|
187
187
|
const timer = setTimeout(handleTimeout, timeout);
|
|
188
188
|
server = http_1.default.createServer((req, res) => {
|
|
189
189
|
const reqUrl = new URL(req.url, `http://${req.headers.host}`);
|
|
190
190
|
if (reqUrl.pathname === redirect_1.Redirect.path) {
|
|
191
191
|
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
192
|
-
res.end(Buffer.from(static_1.redirectSuccessHtml(this.logoutUrl, this.systemId)));
|
|
192
|
+
res.end(Buffer.from((0, static_1.redirectSuccessHtml)(this.logoutUrl, this.systemId)));
|
|
193
193
|
this.log.info('Got authCode');
|
|
194
194
|
resolve({ authCode: reqUrl.searchParams.get('code') + '', redirect });
|
|
195
195
|
if (timer) {
|
|
@@ -3,7 +3,7 @@ import { Axios } from 'axios';
|
|
|
3
3
|
import type { Logger } from '@sap-ux/logger';
|
|
4
4
|
import { ODataService } from './odata-service';
|
|
5
5
|
import { Cookies } from '../auth';
|
|
6
|
-
export
|
|
6
|
+
export type Service = Axios & {
|
|
7
7
|
log: Logger;
|
|
8
8
|
};
|
|
9
9
|
export interface ProviderConfiguration {
|
package/dist/factory.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export interface AbapEmbeddedSteampunkOptions extends ReentranceTicketOptions {
|
|
|
43
43
|
environment: AbapCloudEnvironment.EmbeddedSteampunk;
|
|
44
44
|
}
|
|
45
45
|
/** Discriminated union of supported environments - {@link AbapCloudStandaloneOptions} and {@link AbapEmbeddedSteampunkOptions} */
|
|
46
|
-
|
|
46
|
+
type AbapCloudOptions = AbapCloudStandaloneOptions | AbapEmbeddedSteampunkOptions;
|
|
47
47
|
/**
|
|
48
48
|
* Create an instance of an ABAP service provider for a Cloud ABAP system.
|
|
49
49
|
*
|
|
@@ -54,7 +54,7 @@ export declare function createForAbapOnCloud(options: AbapCloudOptions & Partial
|
|
|
54
54
|
/**
|
|
55
55
|
* To create a destination provider only the destination name is absolutely required.
|
|
56
56
|
*/
|
|
57
|
-
export
|
|
57
|
+
export type MinimalDestinationConfig = Pick<Destination, 'Name'> & Partial<Destination>;
|
|
58
58
|
/**
|
|
59
59
|
* Create an instance of a service provider for the given destination.
|
|
60
60
|
*
|
package/dist/factory.js
CHANGED
|
@@ -40,7 +40,7 @@ const util_1 = require("util");
|
|
|
40
40
|
*/
|
|
41
41
|
function createInstance(ProviderType, config) {
|
|
42
42
|
var _a, _b;
|
|
43
|
-
const providerConfig = cloneDeep_1.default(config);
|
|
43
|
+
const providerConfig = (0, cloneDeep_1.default)(config);
|
|
44
44
|
providerConfig.httpsAgent = new https_1.Agent({
|
|
45
45
|
rejectUnauthorized: !providerConfig.ignoreCertErrors
|
|
46
46
|
});
|
|
@@ -63,9 +63,9 @@ function createInstance(ProviderType, config) {
|
|
|
63
63
|
head: {},
|
|
64
64
|
patch: {}
|
|
65
65
|
};
|
|
66
|
-
auth_1.attachConnectionHandler(instance);
|
|
66
|
+
(0, auth_1.attachConnectionHandler)(instance);
|
|
67
67
|
if ((_b = providerConfig.auth) === null || _b === void 0 ? void 0 : _b.password) {
|
|
68
|
-
auth_1.attachBasicAuthInterceptor(instance);
|
|
68
|
+
(0, auth_1.attachBasicAuthInterceptor)(instance);
|
|
69
69
|
}
|
|
70
70
|
if (config.cookies) {
|
|
71
71
|
config.cookies.split(';').forEach((singleCookieStr) => {
|
|
@@ -120,7 +120,7 @@ function createForAbapOnCloud(options) {
|
|
|
120
120
|
const { service, refreshToken, refreshTokenChangedCb, cookies } = options, config = __rest(options, ["service", "refreshToken", "refreshTokenChangedCb", "cookies"]);
|
|
121
121
|
provider = createInstance(abap_1.AbapServiceProvider, Object.assign({ baseURL: service.url, cookies }, config));
|
|
122
122
|
if (!cookies) {
|
|
123
|
-
auth_1.attachUaaAuthInterceptor(provider, service, refreshToken, refreshTokenChangedCb);
|
|
123
|
+
(0, auth_1.attachUaaAuthInterceptor)(provider, service, refreshToken, refreshTokenChangedCb);
|
|
124
124
|
}
|
|
125
125
|
break;
|
|
126
126
|
}
|
|
@@ -128,13 +128,13 @@ function createForAbapOnCloud(options) {
|
|
|
128
128
|
const { url, cookies } = options, config = __rest(options, ["url", "cookies"]);
|
|
129
129
|
provider = createInstance(abap_1.AbapServiceProvider, Object.assign({ baseURL: url }, config));
|
|
130
130
|
if (!cookies) {
|
|
131
|
-
auth_1.attachReentranceTicketAuthInterceptor({ provider });
|
|
131
|
+
(0, auth_1.attachReentranceTicketAuthInterceptor)({ provider });
|
|
132
132
|
}
|
|
133
133
|
break;
|
|
134
134
|
}
|
|
135
135
|
default:
|
|
136
136
|
const opts = options;
|
|
137
|
-
throw new Error(`Unknown environment type supplied: ${util_1.inspect(opts)}`);
|
|
137
|
+
throw new Error(`Unknown environment type supplied: ${(0, util_1.inspect)(opts)}`);
|
|
138
138
|
}
|
|
139
139
|
return provider;
|
|
140
140
|
}
|
|
@@ -150,12 +150,12 @@ exports.createForAbapOnCloud = createForAbapOnCloud;
|
|
|
150
150
|
function createForDestination(options, destination, destinationServiceInstance) {
|
|
151
151
|
var _a;
|
|
152
152
|
const { cookies } = options, config = __rest(options, ["cookies"]);
|
|
153
|
-
const providerConfig = Object.assign(Object.assign({}, config), { baseURL: btp_utils_1.getDestinationUrlForAppStudio(destination.Name, destination.Host ? new URL(destination.Host).pathname : undefined), cookies: cookies });
|
|
153
|
+
const providerConfig = Object.assign(Object.assign({}, config), { baseURL: (0, btp_utils_1.getDestinationUrlForAppStudio)(destination.Name, destination.Host ? new URL(destination.Host).pathname : undefined), cookies: cookies });
|
|
154
154
|
// SAML in AppStudio is not yet supported
|
|
155
155
|
providerConfig.params = (_a = providerConfig.params) !== null && _a !== void 0 ? _a : {};
|
|
156
156
|
providerConfig.params.saml2 = 'disabled';
|
|
157
157
|
let provider;
|
|
158
|
-
if (btp_utils_1.isAbapSystem(destination)) {
|
|
158
|
+
if ((0, btp_utils_1.isAbapSystem)(destination)) {
|
|
159
159
|
provider = createInstance(abap_1.AbapServiceProvider, providerConfig);
|
|
160
160
|
}
|
|
161
161
|
else {
|
|
@@ -164,7 +164,7 @@ function createForDestination(options, destination, destinationServiceInstance)
|
|
|
164
164
|
// resolve destination service user on first request if required
|
|
165
165
|
if (destinationServiceInstance) {
|
|
166
166
|
const oneTimeReqInterceptorId = provider.interceptors.request.use((request) => __awaiter(this, void 0, void 0, function* () {
|
|
167
|
-
const credentials = yield btp_utils_1.getCredentialsForDestinationService(destinationServiceInstance);
|
|
167
|
+
const credentials = yield (0, btp_utils_1.getCredentialsForDestinationService)(destinationServiceInstance);
|
|
168
168
|
provider.defaults.headers.common[btp_utils_1.BAS_DEST_INSTANCE_CRED_HEADER] = credentials;
|
|
169
169
|
provider.interceptors.request.eject(oneTimeReqInterceptorId);
|
|
170
170
|
return request;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/axios-extension",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Extension of the Axios module adding convinience methods to interact with SAP systems especially with OData services.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"private": false,
|
|
15
15
|
"main": "dist/index.js",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@sap-ux/btp-utils": "0.11.
|
|
18
|
-
"@sap-ux/logger": "0.3.
|
|
17
|
+
"@sap-ux/btp-utils": "0.11.5",
|
|
18
|
+
"@sap-ux/logger": "0.3.5",
|
|
19
19
|
"axios": "0.24.0",
|
|
20
20
|
"detect-content-type": "1.2.0",
|
|
21
21
|
"fast-xml-parser": "3.12.20",
|