ibm-cloud-sdk-core 4.1.0 → 4.1.1

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/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v16.20.2
package/Authentication.md CHANGED
@@ -147,7 +147,7 @@ authenticator type is intended for situations in which the application will be m
147
147
  token itself in terms of initial acquisition and refreshing as needed.
148
148
 
149
149
 
150
- ## Identity and Access Management Authentication (IAM)
150
+ ## Identity and Access Management (IAM) Authentication
151
151
  The `IamAuthenticator` will accept a user-supplied api key and will perform
152
152
  the necessary interactions with the IAM token service to obtain a suitable
153
153
  bearer token for the specified api key. The authenticator will also obtain
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [4.1.1](https://github.com/IBM/node-sdk-core/compare/v4.1.0...v4.1.1) (2023-09-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * process cookies in failed responses ([#251](https://github.com/IBM/node-sdk-core/issues/251)) ([52f758b](https://github.com/IBM/node-sdk-core/commit/52f758bc5700b3ccd283e39cca7401ee8dcb60d9))
7
+
1
8
  # [4.1.0](https://github.com/IBM/node-sdk-core/compare/v4.0.9...v4.1.0) (2023-07-06)
2
9
 
3
10
 
@@ -18,7 +18,7 @@ protected createRequestAndDeserializeResponse(parameters: any, deserializerFn: (
18
18
  | --- | --- | --- |
19
19
  | parameters | any | see <code>parameters</code> in <code>createRequest</code> |
20
20
  | deserializerFn | (any: any) =&gt; any | the deserializer function that is applied on the response object |
21
- | isMap | boolean | _(Optional)_ is <code>true</code> when the response object should be handled as a map |
21
+ | isMap | boolean | _(Optional)_ is <code>true</code> when the response object should be handled as a map |
22
22
 
23
23
  **Returns:**
24
24
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "metadata": {
3
3
  "toolPackage": "@microsoft/api-extractor",
4
- "toolVersion": "7.36.0",
4
+ "toolVersion": "7.36.1",
5
5
  "schemaVersion": 1011,
6
6
  "oldestForwardsCompatibleVersion": 1001,
7
7
  "tsdocConfig": {
@@ -1028,7 +1028,7 @@
1028
1028
  {
1029
1029
  "kind": "Method",
1030
1030
  "canonicalReference": "ibm-cloud-sdk-core!BaseService#createRequestAndDeserializeResponse:member(1)",
1031
- "docComment": "/**\n * Wrapper around `createRequest` that enforces arrived response to be deserialized.\n *\n * @param parameters - see `parameters` in `createRequest`\n *\n * @param deserializerFn - the deserializer function that is applied on the response object\n *\n * @param isMap - is `true` when the response object should be handled as a map @protected\n *\n * @returns a Promise\n */\n",
1031
+ "docComment": "/**\n * Wrapper around `createRequest` that enforces arrived response to be deserialized.\n *\n * @param parameters - see `parameters` in `createRequest`\n *\n * @param deserializerFn - the deserializer function that is applied on the response object\n *\n * @param isMap - is `true` when the response object should be handled as a map\n *\n * @returns a Promise\n */\n",
1032
1032
  "excerptTokens": [
1033
1033
  {
1034
1034
  "kind": "Content",
@@ -157,7 +157,6 @@ export declare class BaseService {
157
157
  * @param parameters - see `parameters` in `createRequest`
158
158
  * @param deserializerFn - the deserializer function that is applied on the response object
159
159
  * @param isMap - is `true` when the response object should be handled as a map
160
- * @protected
161
160
  * @returns a Promise
162
161
  */
163
162
  protected createRequestAndDeserializeResponse(parameters: any, deserializerFn: (any: any) => any, isMap?: boolean): Promise<any>;
@@ -206,7 +206,6 @@ export class BaseService {
206
206
  * @param parameters - see `parameters` in `createRequest`
207
207
  * @param deserializerFn - the deserializer function that is applied on the response object
208
208
  * @param isMap - is `true` when the response object should be handled as a map
209
- * @protected
210
209
  * @returns a Promise
211
210
  */
212
211
  createRequestAndDeserializeResponse(parameters, deserializerFn, isMap) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * (C) Copyright IBM Corp. 2022.
2
+ * (C) Copyright IBM Corp. 2022, 2023.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -13,11 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { InternalAxiosRequestConfig, AxiosResponse } from 'axios';
16
+ import { Axios } from 'axios';
17
17
  import { CookieJar } from 'tough-cookie';
18
- export declare class CookieInterceptor {
19
- private readonly cookieJar;
20
- constructor(cookieJar: CookieJar | boolean);
21
- requestInterceptor(config: InternalAxiosRequestConfig): Promise<InternalAxiosRequestConfig<any>>;
22
- responseInterceptor(response: AxiosResponse): Promise<AxiosResponse<any, any>>;
23
- }
18
+ export declare const createCookieInterceptor: (cookieJar: CookieJar | boolean) => (axios: Axios) => void;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * (C) Copyright IBM Corp. 2022.
2
+ * (C) Copyright IBM Corp. 2022, 2023.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -22,31 +22,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  step((generator = generator.apply(thisArg, _arguments || [])).next());
23
23
  });
24
24
  };
25
+ import { isAxiosError } from 'axios';
25
26
  import extend from 'extend';
26
27
  import { CookieJar } from 'tough-cookie';
27
28
  import logger from './logger';
28
- export class CookieInterceptor {
29
- constructor(cookieJar) {
30
- if (cookieJar) {
31
- if (cookieJar === true) {
32
- logger.debug('CookieInterceptor: creating new CookieJar');
33
- this.cookieJar = new CookieJar();
34
- }
35
- else {
36
- logger.debug('CookieInterceptor: using supplied CookieJar');
37
- this.cookieJar = cookieJar;
38
- }
39
- }
40
- else {
41
- throw new Error('Must supply a cookie jar or true.');
42
- }
43
- }
44
- requestInterceptor(config) {
29
+ const internalCreateCookieInterceptor = (cookieJar) => {
30
+ /**
31
+ * This is called by Axios when a request is about to be sent in order to
32
+ * copy the cookie string from the URL to a request header.
33
+ *
34
+ * @param config the Axios request config
35
+ * @returns the request config
36
+ */
37
+ function requestInterceptor(config) {
45
38
  return __awaiter(this, void 0, void 0, function* () {
46
39
  logger.debug('CookieInterceptor: intercepting request');
47
40
  if (config && config.url) {
48
41
  logger.debug(`CookieInterceptor: getting cookies for: ${config.url}`);
49
- const cookieHeaderValue = yield this.cookieJar.getCookieString(config.url);
42
+ const cookieHeaderValue = yield cookieJar.getCookieString(config.url);
50
43
  if (cookieHeaderValue) {
51
44
  logger.debug('CookieInterceptor: setting cookie header');
52
45
  const cookieHeader = { cookie: cookieHeaderValue };
@@ -62,25 +55,65 @@ export class CookieInterceptor {
62
55
  return config;
63
56
  });
64
57
  }
65
- responseInterceptor(response) {
58
+ /**
59
+ * This is called by Axios when a 2xx response has been received.
60
+ * We'll invoke the configured cookie jar's setCookie() method to handle
61
+ * the "set-cookie" header.
62
+ * @param response the Axios response object
63
+ * @returns the response object
64
+ */
65
+ function responseInterceptor(response) {
66
66
  return __awaiter(this, void 0, void 0, function* () {
67
- logger.debug('CookieInterceptor: intercepting response.');
68
- if (response && response.headers) {
69
- logger.debug('CookieInterceptor: checking for set-cookie headers.');
70
- const cookies = response.headers['set-cookie'];
71
- if (cookies) {
72
- logger.debug(`CookieInterceptor: setting cookies in jar for URL ${response.config.url}.`);
73
- // Write cookies sequentially by chaining the promises in a reduce
74
- yield cookies.reduce((cookiePromise, cookie) => cookiePromise.then(() => this.cookieJar.setCookie(cookie, response.config.url)), Promise.resolve(null));
75
- }
76
- else {
77
- logger.debug('CookieInterceptor: no set-cookie headers.');
78
- }
67
+ logger.debug('CookieInterceptor: intercepting response to check for set-cookie headers.');
68
+ const cookies = response.headers['set-cookie'];
69
+ if (cookies) {
70
+ logger.debug(`CookieInterceptor: setting cookies in jar for URL ${response.config.url}.`);
71
+ // Write cookies sequentially by chaining the promises in a reduce
72
+ yield cookies.reduce((cookiePromise, cookie) => cookiePromise.then(() => cookieJar.setCookie(cookie, response.config.url)), Promise.resolve(null));
79
73
  }
80
74
  else {
81
- logger.debug('CookieInterceptor: no response headers.');
75
+ logger.debug('CookieInterceptor: no set-cookie headers.');
82
76
  }
83
77
  return response;
84
78
  });
85
79
  }
86
- }
80
+ /**
81
+ * This is called by Axios when a non-2xx response has been received.
82
+ * We'll simply invoke the "responseFulfilled" method since we want to
83
+ * do the same cookie handler as for a success response.
84
+ * @param error the Axios error object that describes the non-2xx response
85
+ * @returns the error object
86
+ */
87
+ function responseRejected(error) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ logger.debug('CookieIntercepter: intercepting error response');
90
+ if (isAxiosError(error)) {
91
+ logger.debug('CookieIntercepter: delegating to responseInterceptor()');
92
+ yield responseInterceptor(error.response);
93
+ }
94
+ else {
95
+ logger.debug('CookieInterceptor: no response field in error object, skipping...');
96
+ }
97
+ return Promise.reject(error);
98
+ });
99
+ }
100
+ return (axios) => {
101
+ axios.interceptors.request.use(requestInterceptor);
102
+ axios.interceptors.response.use(responseInterceptor, responseRejected);
103
+ };
104
+ };
105
+ export const createCookieInterceptor = (cookieJar) => {
106
+ if (cookieJar) {
107
+ if (cookieJar === true) {
108
+ logger.debug('CookieInterceptor: creating new CookieJar');
109
+ return internalCreateCookieInterceptor(new CookieJar());
110
+ }
111
+ else {
112
+ logger.debug('CookieInterceptor: using supplied CookieJar');
113
+ return internalCreateCookieInterceptor(cookieJar);
114
+ }
115
+ }
116
+ else {
117
+ throw new Error('Must supply a cookie jar or true.');
118
+ }
119
+ };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * (C) Copyright IBM Corp. 2014, 2022.
2
+ * (C) Copyright IBM Corp. 2014, 2023.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  /**
12
- * (C) Copyright IBM Corp. 2014, 2022.
12
+ * (C) Copyright IBM Corp. 2014, 2023.
13
13
  *
14
14
  * Licensed under the Apache License, Version 2.0 (the "License");
15
15
  * you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@ import { gzipSync } from 'zlib';
34
34
  import { buildRequestFileObject, isEmptyObject, isFileData, isFileWithMetadata, isJsonMimeType, stripTrailingSlash, } from './helper';
35
35
  import logger from './logger';
36
36
  import { streamToPromise } from './stream-to-promise';
37
- import { CookieInterceptor } from './cookie-support';
37
+ import { createCookieInterceptor } from './cookie-support';
38
38
  import { chainError } from './chain-error';
39
39
  export class RequestWrapper {
40
40
  constructor(axiosOptions) {
@@ -71,13 +71,9 @@ export class RequestWrapper {
71
71
  ['post', 'put', 'patch'].forEach((op) => {
72
72
  this.axiosInstance.defaults.headers[op]['Content-Type'] = 'application/json';
73
73
  });
74
- // if a cookie jar is provided, wrap the axios instance and update defaults
74
+ // if a cookie jar is provided, register our cookie interceptors with axios
75
75
  if (axiosOptions.jar) {
76
- const cookieInterceptor = new CookieInterceptor(axiosOptions.jar);
77
- const requestCookieInterceptor = (config) => cookieInterceptor.requestInterceptor(config);
78
- const responseCookieInterceptor = (response) => cookieInterceptor.responseInterceptor(response);
79
- this.axiosInstance.interceptors.request.use(requestCookieInterceptor);
80
- this.axiosInstance.interceptors.response.use(responseCookieInterceptor);
76
+ createCookieInterceptor(axiosOptions.jar)(this.axiosInstance);
81
77
  }
82
78
  // get retry config properties and conditionally enable retries
83
79
  if (axiosOptions.enableRetries) {
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.36.0"
8
+ "packageVersion": "7.36.1"
9
9
  }
10
10
  ]
11
11
  }
@@ -222,7 +222,6 @@ export declare class BaseService {
222
222
  * @param parameters - see `parameters` in `createRequest`
223
223
  * @param deserializerFn - the deserializer function that is applied on the response object
224
224
  * @param isMap - is `true` when the response object should be handled as a map
225
- * @protected
226
225
  * @returns a Promise
227
226
  */
228
227
  protected createRequestAndDeserializeResponse(parameters: any, deserializerFn: (any: any) => any, isMap?: boolean): Promise<any>;
@@ -157,7 +157,6 @@ export declare class BaseService {
157
157
  * @param parameters - see `parameters` in `createRequest`
158
158
  * @param deserializerFn - the deserializer function that is applied on the response object
159
159
  * @param isMap - is `true` when the response object should be handled as a map
160
- * @protected
161
160
  * @returns a Promise
162
161
  */
163
162
  protected createRequestAndDeserializeResponse(parameters: any, deserializerFn: (any: any) => any, isMap?: boolean): Promise<any>;
@@ -225,7 +225,6 @@ var BaseService = /** @class */ (function () {
225
225
  * @param parameters - see `parameters` in `createRequest`
226
226
  * @param deserializerFn - the deserializer function that is applied on the response object
227
227
  * @param isMap - is `true` when the response object should be handled as a map
228
- * @protected
229
228
  * @returns a Promise
230
229
  */
231
230
  BaseService.prototype.createRequestAndDeserializeResponse = function (parameters, deserializerFn, isMap) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * (C) Copyright IBM Corp. 2022.
2
+ * (C) Copyright IBM Corp. 2022, 2023.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -13,11 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { InternalAxiosRequestConfig, AxiosResponse } from 'axios';
16
+ import { Axios } from 'axios';
17
17
  import { CookieJar } from 'tough-cookie';
18
- export declare class CookieInterceptor {
19
- private readonly cookieJar;
20
- constructor(cookieJar: CookieJar | boolean);
21
- requestInterceptor(config: InternalAxiosRequestConfig): Promise<InternalAxiosRequestConfig<any>>;
22
- responseInterceptor(response: AxiosResponse): Promise<AxiosResponse<any, any>>;
23
- }
18
+ export declare const createCookieInterceptor: (cookieJar: CookieJar | boolean) => (axios: Axios) => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * (C) Copyright IBM Corp. 2022.
3
+ * (C) Copyright IBM Corp. 2022, 2023.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -54,27 +54,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
54
54
  return (mod && mod.__esModule) ? mod : { "default": mod };
55
55
  };
56
56
  Object.defineProperty(exports, "__esModule", { value: true });
57
- exports.CookieInterceptor = void 0;
57
+ exports.createCookieInterceptor = void 0;
58
+ var axios_1 = require("axios");
58
59
  var extend_1 = __importDefault(require("extend"));
59
60
  var tough_cookie_1 = require("tough-cookie");
60
61
  var logger_1 = __importDefault(require("./logger"));
61
- var CookieInterceptor = /** @class */ (function () {
62
- function CookieInterceptor(cookieJar) {
63
- if (cookieJar) {
64
- if (cookieJar === true) {
65
- logger_1.default.debug('CookieInterceptor: creating new CookieJar');
66
- this.cookieJar = new tough_cookie_1.CookieJar();
67
- }
68
- else {
69
- logger_1.default.debug('CookieInterceptor: using supplied CookieJar');
70
- this.cookieJar = cookieJar;
71
- }
72
- }
73
- else {
74
- throw new Error('Must supply a cookie jar or true.');
75
- }
76
- }
77
- CookieInterceptor.prototype.requestInterceptor = function (config) {
62
+ var internalCreateCookieInterceptor = function (cookieJar) {
63
+ /**
64
+ * This is called by Axios when a request is about to be sent in order to
65
+ * copy the cookie string from the URL to a request header.
66
+ *
67
+ * @param config the Axios request config
68
+ * @returns the request config
69
+ */
70
+ function requestInterceptor(config) {
78
71
  return __awaiter(this, void 0, void 0, function () {
79
72
  var cookieHeaderValue, cookieHeader;
80
73
  return __generator(this, function (_a) {
@@ -83,7 +76,7 @@ var CookieInterceptor = /** @class */ (function () {
83
76
  logger_1.default.debug('CookieInterceptor: intercepting request');
84
77
  if (!(config && config.url)) return [3 /*break*/, 2];
85
78
  logger_1.default.debug("CookieInterceptor: getting cookies for: ".concat(config.url));
86
- return [4 /*yield*/, this.cookieJar.getCookieString(config.url)];
79
+ return [4 /*yield*/, cookieJar.getCookieString(config.url)];
87
80
  case 1:
88
81
  cookieHeaderValue = _a.sent();
89
82
  if (cookieHeaderValue) {
@@ -102,23 +95,27 @@ var CookieInterceptor = /** @class */ (function () {
102
95
  }
103
96
  });
104
97
  });
105
- };
106
- CookieInterceptor.prototype.responseInterceptor = function (response) {
98
+ }
99
+ /**
100
+ * This is called by Axios when a 2xx response has been received.
101
+ * We'll invoke the configured cookie jar's setCookie() method to handle
102
+ * the "set-cookie" header.
103
+ * @param response the Axios response object
104
+ * @returns the response object
105
+ */
106
+ function responseInterceptor(response) {
107
107
  return __awaiter(this, void 0, void 0, function () {
108
108
  var cookies;
109
- var _this = this;
110
109
  return __generator(this, function (_a) {
111
110
  switch (_a.label) {
112
111
  case 0:
113
- logger_1.default.debug('CookieInterceptor: intercepting response.');
114
- if (!(response && response.headers)) return [3 /*break*/, 4];
115
- logger_1.default.debug('CookieInterceptor: checking for set-cookie headers.');
112
+ logger_1.default.debug('CookieInterceptor: intercepting response to check for set-cookie headers.');
116
113
  cookies = response.headers['set-cookie'];
117
114
  if (!cookies) return [3 /*break*/, 2];
118
115
  logger_1.default.debug("CookieInterceptor: setting cookies in jar for URL ".concat(response.config.url, "."));
119
116
  // Write cookies sequentially by chaining the promises in a reduce
120
117
  return [4 /*yield*/, cookies.reduce(function (cookiePromise, cookie) {
121
- return cookiePromise.then(function () { return _this.cookieJar.setCookie(cookie, response.config.url); });
118
+ return cookiePromise.then(function () { return cookieJar.setCookie(cookie, response.config.url); });
122
119
  }, Promise.resolve(null))];
123
120
  case 1:
124
121
  // Write cookies sequentially by chaining the promises in a reduce
@@ -127,15 +124,56 @@ var CookieInterceptor = /** @class */ (function () {
127
124
  case 2:
128
125
  logger_1.default.debug('CookieInterceptor: no set-cookie headers.');
129
126
  _a.label = 3;
130
- case 3: return [3 /*break*/, 5];
131
- case 4:
132
- logger_1.default.debug('CookieInterceptor: no response headers.');
133
- _a.label = 5;
134
- case 5: return [2 /*return*/, response];
127
+ case 3: return [2 /*return*/, response];
135
128
  }
136
129
  });
137
130
  });
131
+ }
132
+ /**
133
+ * This is called by Axios when a non-2xx response has been received.
134
+ * We'll simply invoke the "responseFulfilled" method since we want to
135
+ * do the same cookie handler as for a success response.
136
+ * @param error the Axios error object that describes the non-2xx response
137
+ * @returns the error object
138
+ */
139
+ function responseRejected(error) {
140
+ return __awaiter(this, void 0, void 0, function () {
141
+ return __generator(this, function (_a) {
142
+ switch (_a.label) {
143
+ case 0:
144
+ logger_1.default.debug('CookieIntercepter: intercepting error response');
145
+ if (!(0, axios_1.isAxiosError)(error)) return [3 /*break*/, 2];
146
+ logger_1.default.debug('CookieIntercepter: delegating to responseInterceptor()');
147
+ return [4 /*yield*/, responseInterceptor(error.response)];
148
+ case 1:
149
+ _a.sent();
150
+ return [3 /*break*/, 3];
151
+ case 2:
152
+ logger_1.default.debug('CookieInterceptor: no response field in error object, skipping...');
153
+ _a.label = 3;
154
+ case 3: return [2 /*return*/, Promise.reject(error)];
155
+ }
156
+ });
157
+ });
158
+ }
159
+ return function (axios) {
160
+ axios.interceptors.request.use(requestInterceptor);
161
+ axios.interceptors.response.use(responseInterceptor, responseRejected);
138
162
  };
139
- return CookieInterceptor;
140
- }());
141
- exports.CookieInterceptor = CookieInterceptor;
163
+ };
164
+ var createCookieInterceptor = function (cookieJar) {
165
+ if (cookieJar) {
166
+ if (cookieJar === true) {
167
+ logger_1.default.debug('CookieInterceptor: creating new CookieJar');
168
+ return internalCreateCookieInterceptor(new tough_cookie_1.CookieJar());
169
+ }
170
+ else {
171
+ logger_1.default.debug('CookieInterceptor: using supplied CookieJar');
172
+ return internalCreateCookieInterceptor(cookieJar);
173
+ }
174
+ }
175
+ else {
176
+ throw new Error('Must supply a cookie jar or true.');
177
+ }
178
+ };
179
+ exports.createCookieInterceptor = createCookieInterceptor;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * (C) Copyright IBM Corp. 2014, 2022.
2
+ * (C) Copyright IBM Corp. 2014, 2023.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -76,7 +76,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
76
76
  Object.defineProperty(exports, "__esModule", { value: true });
77
77
  exports.RequestWrapper = void 0;
78
78
  /**
79
- * (C) Copyright IBM Corp. 2014, 2022.
79
+ * (C) Copyright IBM Corp. 2014, 2023.
80
80
  *
81
81
  * Licensed under the Apache License, Version 2.0 (the "License");
82
82
  * you may not use this file except in compliance with the License.
@@ -139,15 +139,9 @@ var RequestWrapper = /** @class */ (function () {
139
139
  ['post', 'put', 'patch'].forEach(function (op) {
140
140
  _this.axiosInstance.defaults.headers[op]['Content-Type'] = 'application/json';
141
141
  });
142
- // if a cookie jar is provided, wrap the axios instance and update defaults
142
+ // if a cookie jar is provided, register our cookie interceptors with axios
143
143
  if (axiosOptions.jar) {
144
- var cookieInterceptor_1 = new cookie_support_1.CookieInterceptor(axiosOptions.jar);
145
- var requestCookieInterceptor = function (config) { return cookieInterceptor_1.requestInterceptor(config); };
146
- var responseCookieInterceptor = function (response) {
147
- return cookieInterceptor_1.responseInterceptor(response);
148
- };
149
- this.axiosInstance.interceptors.request.use(requestCookieInterceptor);
150
- this.axiosInstance.interceptors.response.use(responseCookieInterceptor);
144
+ (0, cookie_support_1.createCookieInterceptor)(axiosOptions.jar)(this.axiosInstance);
151
145
  }
152
146
  // get retry config properties and conditionally enable retries
153
147
  if (axiosOptions.enableRetries) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ibm-cloud-sdk-core",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "description": "Core functionality to support SDKs generated with IBM's OpenAPI SDK Generator.",
5
5
  "main": "index.js",
6
6
  "typings": "./es/index.d.ts",
@@ -55,7 +55,10 @@
55
55
  "lodash.isempty": "^4.4.0",
56
56
  "mime-types": "~2.1.18",
57
57
  "retry-axios": "^2.6.0",
58
- "tough-cookie": "^4.0.0"
58
+ "tough-cookie": "^4.1.3"
59
+ },
60
+ "overrides": {
61
+ "semver": "^7.5.3"
59
62
  },
60
63
  "browser": {
61
64
  "./auth/utils/read-credentials-file": "./auth/utils/read-credentials-file.browser",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "metadata": {
3
3
  "toolPackage": "@microsoft/api-extractor",
4
- "toolVersion": "7.36.0",
4
+ "toolVersion": "7.36.1",
5
5
  "schemaVersion": 1011,
6
6
  "oldestForwardsCompatibleVersion": 1001,
7
7
  "tsdocConfig": {
@@ -1028,7 +1028,7 @@
1028
1028
  {
1029
1029
  "kind": "Method",
1030
1030
  "canonicalReference": "ibm-cloud-sdk-core!BaseService#createRequestAndDeserializeResponse:member(1)",
1031
- "docComment": "/**\n * Wrapper around `createRequest` that enforces arrived response to be deserialized.\n *\n * @param parameters - see `parameters` in `createRequest`\n *\n * @param deserializerFn - the deserializer function that is applied on the response object\n *\n * @param isMap - is `true` when the response object should be handled as a map @protected\n *\n * @returns a Promise\n */\n",
1031
+ "docComment": "/**\n * Wrapper around `createRequest` that enforces arrived response to be deserialized.\n *\n * @param parameters - see `parameters` in `createRequest`\n *\n * @param deserializerFn - the deserializer function that is applied on the response object\n *\n * @param isMap - is `true` when the response object should be handled as a map\n *\n * @returns a Promise\n */\n",
1032
1032
  "excerptTokens": [
1033
1033
  {
1034
1034
  "kind": "Content",