diff --git a/package.json b/package.json index c748c3ef..0ac0b1e6 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "@babel/runtime": "^7.16.7", "@types/jsonwebtoken": "^9.0.1", "@types/qs": "^6.9.7", - "axios": "^1.4.0", + "axios": "0.x", "faye": "^1.4.0", "follow-redirects": "1.15.2", "form-data": "^4.0.0", diff --git a/src/client.ts b/src/client.ts index bd16850c..dee7408e 100644 --- a/src/client.ts +++ b/src/client.ts @@ -5,6 +5,7 @@ import * as https from 'https'; import * as axios from 'axios'; import * as Faye from 'faye'; import jwtDecode from 'jwt-decode'; +import AxiosProgressEvent from 'axios'; import { Personalization } from './personalization'; import { Collections } from './collections'; @@ -671,7 +672,7 @@ export class StreamClient void, + onUploadProgress?: (progressEvent: typeof AxiosProgressEvent) => void, ) { const fd = utils.addFileToFormData(uri, name, contentType); return this.doAxiosRequest('POST', { diff --git a/src/files.ts b/src/files.ts index 2655626e..42caca85 100644 --- a/src/files.ts +++ b/src/files.ts @@ -1,4 +1,4 @@ -import { AxiosProgressEvent } from 'axios'; +import AxiosProgressEvent from 'axios'; import { StreamClient } from './client'; export class StreamFileStore { @@ -25,7 +25,7 @@ export class StreamFileStore { uri: string | File | Buffer | NodeJS.ReadStream, name?: string, contentType?: string, - onUploadProgress?: (progressEvent: AxiosProgressEvent) => void, + onUploadProgress?: (progressEvent: typeof AxiosProgressEvent) => void, ) { return this.client.upload('files/', uri, name, contentType, onUploadProgress); } diff --git a/src/images.ts b/src/images.ts index 3297ebba..f56c4694 100644 --- a/src/images.ts +++ b/src/images.ts @@ -1,4 +1,4 @@ -import { AxiosProgressEvent } from 'axios'; +import AxiosProgressEvent from 'axios'; import { StreamClient, FileUploadAPIResponse } from './client'; export type ImageProcessOptions = { @@ -33,7 +33,7 @@ export class StreamImageStore { uri: string | File | Buffer | NodeJS.ReadStream, name?: string, contentType?: string, - onUploadProgress?: (progressEvent: AxiosProgressEvent) => void, + onUploadProgress?: (progressEvent: typeof AxiosProgressEvent) => void, ) { return this.client.upload('images/', uri, name, contentType, onUploadProgress); } diff --git a/yarn.lock b/yarn.lock index 205116a6..b942a847 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2349,14 +2349,13 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.12.0.tgz#ce1c9d143389679e253b314241ea9aa5cec980d3" integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg== -axios@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f" - integrity sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA== +axios@0.x: + version "0.27.2" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972" + integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ== dependencies: - follow-redirects "^1.15.0" + follow-redirects "^1.14.9" form-data "^4.0.0" - proxy-from-env "^1.1.0" b4a@^1.6.4: version "1.6.4" @@ -4459,11 +4458,16 @@ flatted@^3.1.0, flatted@^3.2.7: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== -follow-redirects@1.15.2, follow-redirects@^1.0.0, follow-redirects@^1.15.0: +follow-redirects@1.15.2, follow-redirects@^1.0.0: version "1.15.2" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== +follow-redirects@^1.14.9: + version "1.15.3" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.3.tgz#fe2f3ef2690afce7e82ed0b44db08165b207123a" + integrity sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q== + for-each@^0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e"