@sap-ux/backend-proxy-middleware 0.5.0 → 0.6.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.
- package/dist/base/proxy.d.ts.map +1 -1
- package/dist/base/proxy.js +11 -8
- package/dist/base/proxy.js.map +1 -1
- package/package.json +9 -9
package/dist/base/proxy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/base/proxy.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGrE,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAC3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAW7C,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB,EAAsB,MAAM,SAAS,CAAC;AAG3F,OAAO,KAAK,EAA4D,aAAa,EAAE,MAAM,eAAe,CAAC;AAG7G,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/B;;GAEG;AACH,eAAO,MAAM,kBAAkB;IAC3B;;;;;;;OAOG;yBACkB,aAAa;IAMlC;;;;;;OAMG;yBACkB,eAAe;IAUpC;;;;;;;OAOG;iBAEM,KAAK,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,OACzB,eAAe,GAAG;QAAE,IAAI,CAAC,EAAE,QAAQ,CAAA;KAAE;CAkBjD,CAAC;AAqBF;;GAEG;AACH,eAAO,MAAM,aAAa;IACtB;;;;;;OAMG;yBACkB,MAAM,UAAU,MAAM,UAAU,MAAM,KAAK,MAAM;IAItE;;;;;OAKG;0BACmB,MAAM,UAAU,MAAM,KAAK,MAAM;IAWvD;;;;;;OAMG;2BACoB,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System(proxyOptions, system, oAuthRequired, tokenChange
|
|
|
229
229
|
return __awaiter(this, void 0, void 0, function* () {
|
|
230
230
|
if (oAuthRequired) {
|
|
231
231
|
if (system.serviceKeys) {
|
|
232
|
-
const provider = axios_extension_1.
|
|
232
|
+
const provider = axios_extension_1.createForAbapOnCloud({
|
|
233
|
+
environment: axios_extension_1.AbapCloudEnvironment.Standalone,
|
|
234
|
+
service: JSON.parse(system.serviceKeys),
|
|
235
|
+
refreshToken: system.refreshToken,
|
|
236
|
+
refreshTokenChangedCb: tokenChangedCallback
|
|
237
|
+
});
|
|
233
238
|
// sending a request to the backend to get cookies
|
|
234
239
|
yield provider.getAtoInfo();
|
|
235
240
|
proxyOptions.headers['cookie'] = provider.cookies.toString();
|
|
@@ -239,15 +244,13 @@ function enhanceConfigForSystem(proxyOptions, system, oAuthRequired, tokenChange
|
|
|
239
244
|
}
|
|
240
245
|
}
|
|
241
246
|
else if (system.authenticationType === store_1.AuthenticationType.ReentranceTicket) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
);
|
|
247
|
+
const provider = axios_extension_1.createForAbapOnCloud({
|
|
248
|
+
environment: axios_extension_1.AbapCloudEnvironment.EmbeddedSteampunk,
|
|
249
|
+
url: system.url
|
|
250
|
+
});
|
|
247
251
|
// sending a request to the backend to get cookies
|
|
248
|
-
|
|
252
|
+
yield provider.getAtoInfo();
|
|
249
253
|
proxyOptions.headers['cookie'] = provider.cookies.toString();
|
|
250
|
-
*/
|
|
251
254
|
}
|
|
252
255
|
else if ((system.username || process.env.FIORI_TOOLS_USER) &&
|
|
253
256
|
(system.password || process.env.FIORI_TOOLS_PASSWORD)) {
|
package/dist/base/proxy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/base/proxy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yDAAoD;AAGpD,iEAA8D;AAC9D,sDAA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AAM,CAAC,CAAC,CAAC;IACjG,CAAC;CAAA;AAFD,kCAEC"}
|
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.
|
|
12
|
+
"version": "0.6.0",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"main": "dist/index.js",
|
|
15
15
|
"files": [
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"ui5.yaml"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@sap-ux/axios-extension": "0.
|
|
22
|
-
"@sap-ux/btp-utils": "0.
|
|
23
|
-
"@sap-ux/logger": "0.
|
|
24
|
-
"@sap-ux/store": "0.
|
|
21
|
+
"@sap-ux/axios-extension": "0.7.0",
|
|
22
|
+
"@sap-ux/btp-utils": "0.10.0",
|
|
23
|
+
"@sap-ux/logger": "0.2.0",
|
|
24
|
+
"@sap-ux/store": "0.2.0",
|
|
25
25
|
"chalk": "4.1.2",
|
|
26
26
|
"dotenv": "16.0.0",
|
|
27
27
|
"express": "4.17.2",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/express": "4.17.13",
|
|
35
35
|
"@types/prompts": "2.0.14",
|
|
36
|
+
"@types/http-proxy": "^1.17.5",
|
|
36
37
|
"nock": "13.2.4",
|
|
37
38
|
"supertest": "6.2.2",
|
|
38
39
|
"@types/supertest": "2.0.12",
|
|
@@ -42,8 +43,8 @@
|
|
|
42
43
|
"dependencies": []
|
|
43
44
|
},
|
|
44
45
|
"engines": {
|
|
45
|
-
"pnpm": ">=6.26.1",
|
|
46
|
-
"node": ">=
|
|
46
|
+
"pnpm": ">=6.26.1 < 7.0.0 || >=7.1.0",
|
|
47
|
+
"node": ">= 14.16.0 < 15.0.0 || >=16.1.0 < 17.0.0 || >=18.0.0 < 19.0.0"
|
|
47
48
|
},
|
|
48
49
|
"scripts": {
|
|
49
50
|
"build": "pnpm clean && tsc",
|
|
@@ -53,6 +54,5 @@
|
|
|
53
54
|
"lint:fix": "eslint . --ext .ts --fix",
|
|
54
55
|
"test": "jest --ci --forceExit --detectOpenHandles --colors",
|
|
55
56
|
"watch": "tsc --watch"
|
|
56
|
-
}
|
|
57
|
-
"readme": "# `@sap-ux/backend-proxy-middleware`\n\nThe `@sap-ux/backend-proxy-middleware` is a [Custom UI5 Server Middleware](https://sap.github.io/ui5-tooling/pages/extensibility/CustomServerMiddleware) for proxying requests to backend servers. The middleware is agnostic to running in local environments and SAP Business Application Studio. Additionally, if credentials are maintained with the SAP Fiori tools then these will be used.\n\nIt can be used either with the `ui5 serve` or the `fiori run` commands.\n\n## Configuration Options\n\n### `backend`\n| Option | Type | Description |\n| ------------- | ------------- | ----------- |\n| `url` | `string` mandatory (local) | Mandatory URL pointing to the backend system. *Not required if destination is provided and the proxy is running SAP Business Application Studio |\n| `destination` | `string` mandatory (if no url) | Required if the backend system is available as destination in SAP Business Application Studio. |\n| `destinationInstance` | `string` optional | If a destination needs to be read by a specific instance of a destination service then you need to provide the id of the service as optional property `destinationInstance`.|\n| `path` | `string` mandatory | Path that is to be proxied |\n| `pathReplace` | `string` optional | If provided then the path will be replaced with this value before forwarding |\n| `client` | `string` optional | sap-client parameter |\n| `scp` | `boolean` optional | If set to true the proxy will execute the required OAuth routine for the ABAP environment on SAP BTP |\n| `apiHub` | `boolean` optional | If set to true then the proxy will connect to the SAP API Business Hub\n| `proxy` | `string` optional | If set then it will override the proxy settings from node.\n\nAdditional optional experimental property `bsp` (type `string`): The BSP property is only needed for the FLP Embedded Flow. The property refers to the BSP Application Name. In that case, we need to redirect the manifest.appdescr request to the local manifest.json in order to overwrite the deployed application with the local one.\n\n### `options`\nOptional object that can be used to directly set options of the used `http-proxy-middleware` modules (https://www.npmjs.com/package/http-proxy-middleware#http-proxy-middleware-options). Note: only declarative options (i.e. no functions) are supported.\n\n## Configuration Examples\n\n### [Connecting to a backend system](#connecting-to-a-backend-system)\n\nExecuting `ui5 serve` in your project with the configuration below in the `ui5.yaml` file would forward any request starting with the `path` parameter to the provided backend `url`.\n\n```\n- name: backend-proxy-middleware\n afterMiddleware: compression\n configuration:\n backend:\n path: /sap\n url: https://my.backend.example:1234\n```\n\n### [Connecting to a backend system with destination](#connecting-to-a-backend-system-with-destination)\n\nIf working in SAP Business Application Studio and the backend is configured as destination then you can also provide the `destination` in the configuration. \nIf a destination needs to be read by a specific instance of a destination service then you need to provide the id of the service as optional property `destinationInstance`.\n\n```\n- name: backend-proxy-middleware\n afterMiddleware: compression\n configuration:\n backend:\n path: /sap\n destination: my_example_destination\n```\n\n### [Connecting to a backend system with destination and principal propagation](#connecting-to-a-backend-system-with-destination-and-principal-propagation)\n\nIf the backend destination is configured to use principal propagation, then in some cases the requests might fail. If this occurs then you will need to set the optional property `xfwd` to `true`. This will add the x-forwared headers to the proxy requests.\n\n```\n- name: backend-proxy-middleware\n afterMiddleware: compression\n configuration:\n backend:\n path: /sap\n destination: my_example_destination\n options:\n xfwd: true\n```\n\n### [Connecting to the SAP Business Technology Platform](#connecting-to-the-sap-business-technology-platform)\nIf you want to connect to an ABAP Environment on SAP Business Technology Platform then you will need to set the optional property `scp` to `true`. For any other target, remove this property or set it to `false`.\n\n```\n- name: backend-proxy-middleware\n afterMiddleware: compression\n configuration:\n backend:\n path: /sap\n url: https://my.steampunk.example:1234\n scp: true\n```\n\n### [Connecting to the SAP API Business Hub](#connecting-to-the-sap-api-business-hub)\nIf you want to connect to the SAP API Business Hub then you will need to set the optional property `apiHub` to `true`, and set the corresponding `path` and `url`, e.g.\n\n```\n- name: backend-proxy-middleware\n afterMiddleware: compression\n configuration:\n backend:\n path: /s4hanacloud\n url: https://api.sap.com\n apiHub: true\n```\n\n### [Proxying WebSockets](#proxying-websockets)\nIf you want the proxy to handle also WebSockets, then you need to set the optional property `ws` to `true`, e.g.\n\n```\n- name: backend-proxy-middleware\n afterMiddleware: compression\n configuration:\n backend:\n path: /sap\n url: https://my.backend.example:1234\n options:\n ws: true\n```\n\n### [Changing the path to which a request is proxied](#changing-the-path-to-which-a-request-is-proxied)\nIf you want to configure the proxy to send requests from a certain path `/services/odata` to your backend (local url or destination) with a specified entry path `/my/entry/path`. Then you need to do the following:\n\n```\n- name: backend-proxy-middleware\n afterMiddleware: compression\n configuration:\n backend:\n - path: /services/odata\n pathReplace: /my/entry/path\n url: https://my.backend.example:1234\n destination: my_example_destination\n```\n\n### [Providing Proxy Configuration](#providing-proxy-configuration)\nBy default the `backend-proxy-middleware` will read the proxy configuration from the Node.js environment variables `proxy`, `https-proxy` and `noproxy`. If those variables are not set, then you can also provide the proxy configuration in the `ui5.yaml` file. \n**Please note: if you want to exclude any domains from the proxy then you will need to set the `noproxy` variable, e.g. `npm config set noproxy \"sap.com\"`**.\n\n```\n- name: backend-proxy-middleware\n afterMiddleware: compression\n configuration:\n proxy: https://myproxy.example:8443\n backend:\n - path: /sap\n url: https://my.backend.example:1234\n\n```\n## Programmatic Usage\nAlternatively you can only use the underlying proxy function, e.g. for the case when you want to use the `backend-proxy-middleware` functionality in your `express` server.\n\n```Typescript\nimport { createProxy } from '@sap-ux/backend-proxy-middleware';\nconst proxy = createProxy(backend, options);\n```\n- **config** - The backend configuration\n- **options** - Options of the [http-proxy-middleware](https://www.npmjs.com/package/http-proxy-middleware#options)\n\n## Keywords\n* Backend Proxy Middleware\n* Fiori tools\n* Fiori elements\n* SAP UI5"
|
|
57
|
+
}
|
|
58
58
|
}
|