Skip to content

Commit bb816df

Browse files
Merge pull request #559 from marisuch/master
Version 1.6.0. Axios has been updated to version 1.13.2
2 parents 1685349 + e7ade04 commit bb816df

12 files changed

Lines changed: 84 additions & 61 deletions

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22.13.0
1+
24.11.1

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: 4 additions & 3 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: 2 additions & 2 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 & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 47 additions & 35 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.19",
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 XSRFToken? `undefined` (default) - set XSRF header only for the same origin requests
43+
*
44+
*/
45+
withXSRFToken?: boolean | undefined;
3946
}
4047

4148
export default ApiConfig;

0 commit comments

Comments
 (0)