@sap-ux/axios-extension 1.7.2 → 1.8.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.
@@ -61,14 +61,12 @@ function attachUaaAuthInterceptor(provider, service, refreshToken, refreshTokenU
61
61
  token = token !== null && token !== void 0 ? token : (yield getToken());
62
62
  return uaa.getUserInfo(token);
63
63
  });
64
- const oneTimeInterceptorId = provider.interceptors.request.use((request) => __awaiter(this, void 0, void 0, function* () {
64
+ provider.interceptors.request.use((request) => __awaiter(this, void 0, void 0, function* () {
65
65
  var _b;
66
66
  token = token !== null && token !== void 0 ? token : (yield getToken());
67
67
  // add token as auth header
68
68
  request.headers = (_b = request.headers) !== null && _b !== void 0 ? _b : new axios_1.AxiosHeaders();
69
69
  request.headers.authorization = `bearer ${token}`;
70
- // remove this interceptor since it is not needed anymore
71
- provider.interceptors.request.eject(oneTimeInterceptorId);
72
70
  return request;
73
71
  }));
74
72
  }
@@ -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 type RefreshTokenChanged = (refreshToken?: string) => void | Promise<void>;
5
+ export type RefreshTokenChanged = (refreshToken?: string, accessToken?: 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
@@ -251,7 +251,7 @@ class Uaa {
251
251
  * @returns an access token.
252
252
  */
253
253
  getAccessToken(refreshToken, refreshTokenChangedCb) {
254
- var _a;
254
+ var _a, _b;
255
255
  return __awaiter(this, void 0, void 0, function* () {
256
256
  let response;
257
257
  let startFreshLogin = false;
@@ -285,12 +285,12 @@ class Uaa {
285
285
  this.log.info('Refresh token issued');
286
286
  newRefreshToken = response.data.refresh_token;
287
287
  }
288
- if (newRefreshToken && refreshTokenChangedCb) {
288
+ if (refreshTokenChangedCb) {
289
289
  this.log.info('Sending notification that refresh token changed');
290
- yield refreshTokenChangedCb(newRefreshToken);
290
+ yield refreshTokenChangedCb(newRefreshToken, (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.access_token);
291
291
  }
292
292
  this.log.info('Got access token successfully');
293
- return (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.access_token;
293
+ return (_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.access_token;
294
294
  });
295
295
  }
296
296
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/axios-extension",
3
- "version": "1.7.2",
3
+ "version": "1.8.0",
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",
@@ -14,7 +14,7 @@
14
14
  "private": false,
15
15
  "main": "dist/index.js",
16
16
  "dependencies": {
17
- "axios": "1.4.0",
17
+ "axios": "1.6.1",
18
18
  "detect-content-type": "1.2.0",
19
19
  "fast-xml-parser": "4.2.7",
20
20
  "lodash": "4.17.21",
@@ -22,14 +22,14 @@
22
22
  "qs": "6.7.3",
23
23
  "xpath": "0.0.33",
24
24
  "@xmldom/xmldom": "0.8.10",
25
- "@sap-ux/btp-utils": "0.12.0",
25
+ "@sap-ux/btp-utils": "0.12.1",
26
26
  "@sap-ux/logger": "0.4.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/lodash": "4.14.198",
30
- "nock": "13.2.1",
30
+ "nock": "13.4.0",
31
31
  "supertest": "6.3.3",
32
- "@sap-ux/project-access": "1.15.1"
32
+ "@sap-ux/project-access": "1.16.2"
33
33
  },
34
34
  "files": [
35
35
  "dist",