@sap-ux/axios-extension 1.21.0 → 1.21.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/README.adoc +5 -6
- package/dist/abap/abap-service-provider.d.ts +7 -0
- package/dist/abap/abap-service-provider.js +11 -1
- package/dist/abap/adt-catalog/generators/ui-service-generator.d.ts +3 -1
- package/dist/abap/adt-catalog/generators/ui-service-generator.js +7 -4
- package/dist/factory.js +1 -3
- package/package.json +2 -2
package/README.adoc
CHANGED
|
@@ -120,21 +120,20 @@ See more examples in link:./test/factory.test.ts[/test/factory.test.ts]
|
|
|
120
120
|
|
|
121
121
|
## Proxy Support
|
|
122
122
|
|
|
123
|
-
To enable support for TLS (Transport Layer Security)
|
|
123
|
+
To enable support for TLS (Transport Layer Security), enable the `HTTPS_PROXY` environment variable, as shown;
|
|
124
124
|
|
|
125
125
|
```bash
|
|
126
|
-
export TOOLSUITE_FEATURES=sap.ux.enablePatchProxy
|
|
127
126
|
export HTTPS_PROXY=<YOUR-PROXY:PORT>
|
|
127
|
+
# With Credentials
|
|
128
|
+
export HTTPS_PROXY=<USERNAME>:<PASSWORD>@<YOUR-PROXY:PORT>
|
|
128
129
|
```
|
|
129
130
|
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
Sample Configuration
|
|
132
132
|
```bash
|
|
133
|
-
export TOOLSUITE_FEATURES=sap.ux.enablePatchProxy
|
|
134
133
|
export HTTPS_PROXY=http://user:password@proxy.domain.com:3128
|
|
135
134
|
```
|
|
136
135
|
|
|
137
|
-
Ensure you restart any running processes to apply the changes.
|
|
136
|
+
Ensure you restart any running processes or applications to apply the changes.
|
|
138
137
|
|
|
139
138
|
Example Scenario
|
|
140
139
|
|
|
@@ -111,6 +111,13 @@ export declare class AbapServiceProvider extends ServiceProvider {
|
|
|
111
111
|
* @returns the service URL
|
|
112
112
|
*/
|
|
113
113
|
private getServiceUrlFromConfig;
|
|
114
|
+
/**
|
|
115
|
+
* Get the content type from the generator config.
|
|
116
|
+
*
|
|
117
|
+
* @param config - generator config
|
|
118
|
+
* @returns the type of the content link from service generator config
|
|
119
|
+
*/
|
|
120
|
+
private getContentType;
|
|
114
121
|
/**
|
|
115
122
|
* Create a service provider to lock a binding path.
|
|
116
123
|
*
|
|
@@ -204,7 +204,7 @@ class AbapServiceProvider extends service_provider_1.ServiceProvider {
|
|
|
204
204
|
}
|
|
205
205
|
const config = await generatorService.getUIServiceGeneratorConfig(referencedObject.uri);
|
|
206
206
|
const gen = this.createService(this.getServiceUrlFromConfig(config), ui_service_generator_1.UiServiceGenerator);
|
|
207
|
-
gen.configure(config, referencedObject);
|
|
207
|
+
gen.configure(config, referencedObject, this.getContentType(config));
|
|
208
208
|
return gen;
|
|
209
209
|
}
|
|
210
210
|
/**
|
|
@@ -221,6 +221,16 @@ class AbapServiceProvider extends service_provider_1.ServiceProvider {
|
|
|
221
221
|
const endIndex = config.link[0].href.indexOf(config.id) + config.id.length;
|
|
222
222
|
return config.link[0].href.substring(0, endIndex);
|
|
223
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* Get the content type from the generator config.
|
|
226
|
+
*
|
|
227
|
+
* @param config - generator config
|
|
228
|
+
* @returns the type of the content link from service generator config
|
|
229
|
+
*/
|
|
230
|
+
getContentType(config) {
|
|
231
|
+
const contentEndpoint = config.link?.find((link) => typeof link.href === 'string' && link.href.includes('/content'));
|
|
232
|
+
return contentEndpoint.type;
|
|
233
|
+
}
|
|
224
234
|
/**
|
|
225
235
|
* Create a service provider to lock a binding path.
|
|
226
236
|
*
|
|
@@ -6,13 +6,15 @@ import { AdtService } from '../services';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class UiServiceGenerator extends AdtService {
|
|
8
8
|
protected referencedObject: BusinessObject | AbapCDSView;
|
|
9
|
+
protected contentType: string;
|
|
9
10
|
/**
|
|
10
11
|
* Configure the UI service generator.
|
|
11
12
|
*
|
|
12
13
|
* @param _config - The generator configuration.
|
|
13
14
|
* @param referencedObject - The referenced object (business object or abap cds view).
|
|
15
|
+
* @param contentType - The header accept type for content.
|
|
14
16
|
*/
|
|
15
|
-
configure(_config: GeneratorEntry, referencedObject: BusinessObject | AbapCDSView): void;
|
|
17
|
+
configure(_config: GeneratorEntry, referencedObject: BusinessObject | AbapCDSView, contentType: string): void;
|
|
16
18
|
/**
|
|
17
19
|
* Get the schema of the service binding.
|
|
18
20
|
*
|
|
@@ -7,14 +7,17 @@ const services_1 = require("../services");
|
|
|
7
7
|
*/
|
|
8
8
|
class UiServiceGenerator extends services_1.AdtService {
|
|
9
9
|
referencedObject;
|
|
10
|
+
contentType;
|
|
10
11
|
/**
|
|
11
12
|
* Configure the UI service generator.
|
|
12
13
|
*
|
|
13
14
|
* @param _config - The generator configuration.
|
|
14
15
|
* @param referencedObject - The referenced object (business object or abap cds view).
|
|
16
|
+
* @param contentType - The header accept type for content.
|
|
15
17
|
*/
|
|
16
|
-
configure(_config, referencedObject) {
|
|
18
|
+
configure(_config, referencedObject, contentType) {
|
|
17
19
|
this.referencedObject = referencedObject;
|
|
20
|
+
this.contentType = contentType;
|
|
18
21
|
}
|
|
19
22
|
/**
|
|
20
23
|
* Get the schema of the service binding.
|
|
@@ -41,7 +44,7 @@ class UiServiceGenerator extends services_1.AdtService {
|
|
|
41
44
|
async getContent(pckg) {
|
|
42
45
|
const response = await this.get('/content', {
|
|
43
46
|
headers: {
|
|
44
|
-
Accept:
|
|
47
|
+
Accept: this.contentType
|
|
45
48
|
},
|
|
46
49
|
params: {
|
|
47
50
|
referencedObject: this.referencedObject.uri,
|
|
@@ -85,7 +88,7 @@ class UiServiceGenerator extends services_1.AdtService {
|
|
|
85
88
|
async validateContent(content) {
|
|
86
89
|
const response = await this.post('/validation', content, {
|
|
87
90
|
headers: {
|
|
88
|
-
'Content-Type':
|
|
91
|
+
'Content-Type': this.contentType,
|
|
89
92
|
Accept: 'application/vnd.sap.adt.validationMessages.v1+xml'
|
|
90
93
|
},
|
|
91
94
|
params: {
|
|
@@ -106,7 +109,7 @@ class UiServiceGenerator extends services_1.AdtService {
|
|
|
106
109
|
async generate(content, transport) {
|
|
107
110
|
const response = await this.post('', content, {
|
|
108
111
|
headers: {
|
|
109
|
-
'Content-Type':
|
|
112
|
+
'Content-Type': this.contentType,
|
|
110
113
|
Accept: 'application/vnd.sap.adt.repository.generator.v1+json, application/vnd.sap.as+xml;charset=UTF-8;dataname=com.sap.adt.StatusMessage'
|
|
111
114
|
},
|
|
112
115
|
params: {
|
package/dist/factory.js
CHANGED
|
@@ -20,7 +20,6 @@ const patchTls_1 = require("./base/patchTls");
|
|
|
20
20
|
const proxy_from_env_1 = require("proxy-from-env");
|
|
21
21
|
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
22
22
|
const http_proxy_agent_1 = require("http-proxy-agent");
|
|
23
|
-
const feature_toggle_1 = require("@sap-ux/feature-toggle");
|
|
24
23
|
/**
|
|
25
24
|
* PatchedHttpsProxyAgent is a custom implementation of HttpsProxyAgent that allows to pass additional options, currently not supported by the original implementation when calling tls.connect
|
|
26
25
|
*/
|
|
@@ -62,8 +61,7 @@ function createInstance(ProviderType, config) {
|
|
|
62
61
|
rejectUnauthorized: !providerConfig.ignoreCertErrors
|
|
63
62
|
};
|
|
64
63
|
const localProxy = (0, proxy_from_env_1.getProxyForUrl)(config.baseURL);
|
|
65
|
-
|
|
66
|
-
if (isPatchProxyEnabled && localProxy) {
|
|
64
|
+
if (localProxy) {
|
|
67
65
|
// axios doesn't handle proxies correctly, instead use a custom agent with axios proxy disabled
|
|
68
66
|
providerConfig.httpsAgent = new PatchedHttpsProxyAgent(localProxy, agentOptions);
|
|
69
67
|
providerConfig.httpAgent = new http_proxy_agent_1.HttpProxyAgent(localProxy);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/axios-extension",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.2",
|
|
4
4
|
"description": "Extension of the Axios module adding convenience methods to interact with SAP systems especially with OData services.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"nock": "13.4.0",
|
|
35
35
|
"supertest": "6.3.3",
|
|
36
36
|
"@types/proxy-from-env": "1.0.1",
|
|
37
|
-
"@sap-ux/project-access": "1.30.
|
|
37
|
+
"@sap-ux/project-access": "1.30.2"
|
|
38
38
|
},
|
|
39
39
|
"files": [
|
|
40
40
|
"dist",
|