Skip to content

Commit d13201a

Browse files
committed
Version 1.6.0. Axios has been updated to version 1.13.2
1 parent 57e9a83 commit d13201a

11 files changed

+96
-66
lines changed

dist/ApiConfig.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ export type ApiConfig = {
66
apiKey?: string;
77
auth?: AxiosBasicCredentials;
88
withCredentials?: boolean;
9+
withXSRFToken?: boolean | undefined;
910
};
1011
export default ApiConfig;

dist/bitbar-cloud-api-client.js

Lines changed: 9 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bitbar-cloud-api-client.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bitbar-cloud-api-client.min.js

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bitbar-cloud-api-client.min.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 35 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bitbar/cloud-api-client",
3-
"version": "1.5.16",
3+
"version": "1.6.0",
44
"description": "Bitbar Cloud API Client for JavaScript",
55
"main": "dist/bitbar-cloud-api-client.min.js",
66
"types": "dist/index.d.ts",
@@ -69,14 +69,14 @@
6969
"ts-node": "^10.7.0",
7070
"tslib": "^2.3.1",
7171
"typedoc": "0.27.6",
72+
"typedoc-github-theme": "^0.2.1",
7273
"typescript": "^5.7.2",
73-
"typescript-eslint": "^8.3.0",
74-
"typedoc-github-theme": "^0.2.1"
74+
"typescript-eslint": "^8.3.0"
7575
},
7676
"dependencies": {
7777
"@babel/runtime": "^7.28.2",
7878
"@bitbar/finka": "^2.4.4",
79-
"axios": "^0.26.1",
79+
"axios": "^1.13.2",
8080
"form-data": "^4.0.4",
8181
"node-abort-controller": "^3.1.1",
8282
"qs": "6.10.3"

src/API.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import {AxiosInstance} from 'axios';
2+
23
// this version of axios has some issue paired with rollup and is not handling default import correctly
3-
// as a workaround we need to use require instead of import until migrating to newer axios version
4+
// as a workaround we need to use require instead of import until migrating to newer axios version.
5+
//
6+
// Axios has been updated to version 1.13.2. Due to issues related to how axios exports are handled between CommonJS and ES Module
7+
// as a workaround we need to use require instead of import in case we want to support both CJS and ESM.
8+
// For CommonJS output in the consumer project (f.ex cloud-frontend), the workaround may still be needed. For ESM, the default import should work.
49
const axios = require('axios').default;
510
// @ts-ignore
611
import {version} from '../package.json';
@@ -42,7 +47,6 @@ if (globalThis.isNodeJs) {
4247
// Disable max content length
4348
axios.defaults.maxContentLength = 1073741824; // 1GB
4449

45-
4650
/**
4751
* API
4852
* Root for other API resources
@@ -91,6 +95,8 @@ export class API {
9195
};
9296
}
9397

98+
// With XSRFToken
99+
this.axiosConfig.withXSRFToken = true;
94100
// With credentials
95101
this.axiosConfig.withCredentials = config.withCredentials == null ? false : config.withCredentials;
96102

src/ApiConfig.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ export type ApiConfig = {
3636
*
3737
*/
3838
withCredentials?: boolean;
39+
40+
41+
/**
42+
* With credentials? `undefined` (default) - set XSRF header only for the same origin requests
43+
*
44+
*/
45+
withXSRFToken?: boolean | undefined;
3946
}
4047

4148
export default ApiConfig;

src/api/APIEntity.spec.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,10 @@ describe('APIEntity', () => {
222222
});
223223

224224
describe('@formData', () => {
225-
it('should set data and content header in existing configuration', () => {
226-
const call = service.formData({
227-
test: 'me',
228-
properly: 1
229-
});
230-
expect((<any>service).requestConfig.data.test).toEqual('me');
231-
expect((<any>service).requestConfig.data.properly).toEqual(1);
232-
expect((<any>service).requestConfig.headers['Content-Type']).toEqual('multipart/form-data');
233-
expect(call).toEqual(service);
225+
it('should set data in requestConfig', () => {
226+
const data = {foo: 'bar'};
227+
service.formData(data);
228+
expect((<any>service).requestConfig.data).toEqual(data);
234229
});
235230
});
236231

@@ -304,7 +299,9 @@ describe('APIEntity', () => {
304299
params: {
305300
test: 'me'
306301
},
307-
paramsSerializer: (<any>service).paramsSerializer,
302+
paramsSerializer: {
303+
indexes: false,
304+
},
308305
signal: (<any>service).abortController.signal
309306
});
310307
});

0 commit comments

Comments
 (0)