@sap-ux/backend-proxy-middleware 0.6.6 → 0.6.9
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/base/proxy.js +6 -2
- package/dist/base/types.d.ts +4 -0
- package/package.json +2 -2
package/dist/base/proxy.js
CHANGED
|
@@ -274,6 +274,8 @@ function generateProxyMiddlewareOptions(backend, options = {}, logger = new logg
|
|
|
274
274
|
const proxyOptions = Object.assign(Object.assign({ headers: {} }, exports.ProxyEventHandlers), options);
|
|
275
275
|
proxyOptions.changeOrigin = true;
|
|
276
276
|
proxyOptions.logProvider = () => logger;
|
|
277
|
+
// always set the target to the url provided in yaml
|
|
278
|
+
proxyOptions.target = backend.url;
|
|
277
279
|
// overwrite url if running in AppStudio
|
|
278
280
|
if (btp_utils_1.isAppStudio()) {
|
|
279
281
|
const destBackend = backend;
|
|
@@ -285,7 +287,6 @@ function generateProxyMiddlewareOptions(backend, options = {}, logger = new logg
|
|
|
285
287
|
}
|
|
286
288
|
else {
|
|
287
289
|
const localBackend = backend;
|
|
288
|
-
proxyOptions.target = localBackend.url;
|
|
289
290
|
// check if system credentials are stored in the store
|
|
290
291
|
const systemStore = yield store_1.getService({ logger, entityName: 'system' });
|
|
291
292
|
const system = yield systemStore.read(new store_1.BackendSystemKey({ url: localBackend.url, client: localBackend.client }));
|
|
@@ -311,11 +312,14 @@ function generateProxyMiddlewareOptions(backend, options = {}, logger = new logg
|
|
|
311
312
|
proxyOptions.headers['apikey'] = apiHubKey;
|
|
312
313
|
}
|
|
313
314
|
}
|
|
315
|
+
if (!proxyOptions.target) {
|
|
316
|
+
throw new Error(`Unable to determine target from configuration:\n${JSON.stringify(backend, null, 2)}`);
|
|
317
|
+
}
|
|
314
318
|
backend.proxy = config_1.getCorporateProxyServer(backend.proxy);
|
|
315
319
|
if (backend.proxy && !config_1.isHostExcludedFromProxy(proxyOptions.target)) {
|
|
316
320
|
proxyOptions.agent = new https_proxy_agent_1.HttpsProxyAgent(backend.proxy);
|
|
317
321
|
}
|
|
318
|
-
logger.info(`Backend proxy created for ${proxyOptions.target
|
|
322
|
+
logger.info(`Backend proxy created for ${proxyOptions.target} ${backend.path ? backend.path : ''}`);
|
|
319
323
|
return proxyOptions;
|
|
320
324
|
});
|
|
321
325
|
}
|
package/dist/base/types.d.ts
CHANGED
|
@@ -31,6 +31,10 @@ export interface BaseBackendConfig {
|
|
|
31
31
|
bsp?: string;
|
|
32
32
|
}
|
|
33
33
|
export interface DestinationBackendConfig extends BaseBackendConfig {
|
|
34
|
+
/**
|
|
35
|
+
* Optional URL pointing to the backend system
|
|
36
|
+
*/
|
|
37
|
+
url?: string;
|
|
34
38
|
/**
|
|
35
39
|
* Required if the backend system is available as destination in SAP Business Application Studio.
|
|
36
40
|
*/
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Abackend-proxy-middleware"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.6.
|
|
12
|
+
"version": "0.6.9",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"!dist/**/*.map"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@sap-ux/axios-extension": "0.
|
|
24
|
+
"@sap-ux/axios-extension": "0.8.0",
|
|
25
25
|
"@sap-ux/btp-utils": "0.10.2",
|
|
26
26
|
"@sap-ux/logger": "0.2.1",
|
|
27
27
|
"@sap-ux/store": "0.3.1",
|