@sap-ux/backend-proxy-middleware 0.10.18 → 0.10.20

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.
@@ -340,6 +340,17 @@ async function generateProxyMiddlewareOptions(backend, options = {}, logger = ne
340
340
  logger.info(`Backend proxy created for ${proxyOptions.target}`);
341
341
  return proxyOptions;
342
342
  }
343
+ /**
344
+ * Validate whether the provided value is a valid AuthenticationType.
345
+ *
346
+ * @param authType - authType string to validate
347
+ * @returns - validated AuthenticationType or undefined if invalid
348
+ */
349
+ function validateAuthType(authType) {
350
+ return authType && Object.values(store_1.AuthenticationType).includes(authType)
351
+ ? authType
352
+ : undefined;
353
+ }
343
354
  /**
344
355
  * Determine the correct authentication configuration for connections from a non-BAS platform.
345
356
  *
@@ -352,11 +363,12 @@ async function updateProxyConfigFromStore(backend, logger, proxyOptions) {
352
363
  // check if system credentials are stored in the store
353
364
  try {
354
365
  const systemStore = await (0, store_1.getService)({ logger, entityName: 'system' });
355
- const system = (await systemStore.read(new store_1.BackendSystemKey({ url: localBackend.url, client: localBackend.client }))) ?? {
356
- name: '<unknown>',
357
- url: localBackend.url,
358
- authenticationType: localBackend.authenticationType
359
- };
366
+ const system = (await systemStore.read(new store_1.BackendSystemKey({ url: localBackend.url, client: localBackend.client }))) ??
367
+ {
368
+ name: '<unknown>',
369
+ url: localBackend.url,
370
+ authenticationType: validateAuthType(localBackend.authenticationType)
371
+ };
360
372
  // Auth type is determined from app config as we may have multiple stored systems with the same url/client using different auth types
361
373
  await enhanceConfigForSystem(proxyOptions, system, localBackend.authenticationType ??
362
374
  (localBackend.scp ? store_1.AuthenticationType.OAuth2RefreshToken : store_1.AuthenticationType.Basic), (refreshToken, accessToken) => {
package/dist/ext/bsp.js CHANGED
@@ -80,7 +80,7 @@ async function addOptionsForEmbeddedBSP(bspPath, proxyOptions, logger) {
80
80
  if (req.url?.match(regex)) {
81
81
  const protocol = 'protocol' in req
82
82
  ? req.protocol
83
- : req.headers.referer?.substring(0, req.headers.referer.indexOf(':')) ?? 'http';
83
+ : (req.headers.referer?.substring(0, req.headers.referer.indexOf(':')) ?? 'http');
84
84
  return protocol + '://' + req.headers.host;
85
85
  }
86
86
  else {
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.10.18",
12
+ "version": "0.10.20",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -31,10 +31,10 @@
31
31
  "i18next": "25.3.0",
32
32
  "prompts": "2.4.2",
33
33
  "proxy-from-env": "1.1.0",
34
- "@sap-ux/axios-extension": "1.24.5",
35
- "@sap-ux/btp-utils": "1.1.5",
36
- "@sap-ux/logger": "0.7.1",
37
- "@sap-ux/store": "1.3.4"
34
+ "@sap-ux/axios-extension": "1.24.6",
35
+ "@sap-ux/btp-utils": "1.1.6",
36
+ "@sap-ux/logger": "0.7.2",
37
+ "@sap-ux/store": "1.4.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/connect": "^3.4.38",
@@ -57,8 +57,8 @@
57
57
  "watch": "tsc --watch",
58
58
  "clean": "rimraf --glob dist test/test-output coverage *.tsbuildinfo",
59
59
  "format": "prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",
60
- "lint": "eslint . --ext .ts",
61
- "lint:fix": "eslint . --ext .ts --fix",
60
+ "lint": "eslint",
61
+ "lint:fix": "eslint --fix",
62
62
  "test": "jest --ci --forceExit --detectOpenHandles --colors"
63
63
  }
64
64
  }