From 72cf16998901688da2a0272b69abc74b4358a8b2 Mon Sep 17 00:00:00 2001 From: Jure Grabnar Date: Tue, 18 Jun 2019 16:34:22 +0200 Subject: [PATCH] Upgrade axios to 0.18.1 Closes SCI-3589 --- .../{axios_v0.16.x.js => axios_v0.18.x.js} | 79 +++++++++++++------ package.json | 4 +- yarn.lock | 28 +++++-- 3 files changed, 77 insertions(+), 34 deletions(-) rename flow-typed/npm/{axios_v0.16.x.js => axios_v0.18.x.js} (62%) diff --git a/flow-typed/npm/axios_v0.16.x.js b/flow-typed/npm/axios_v0.18.x.js similarity index 62% rename from flow-typed/npm/axios_v0.16.x.js rename to flow-typed/npm/axios_v0.18.x.js index 4a616fcde..aeca0a6d1 100644 --- a/flow-typed/npm/axios_v0.16.x.js +++ b/flow-typed/npm/axios_v0.18.x.js @@ -1,10 +1,17 @@ // flow-typed signature: 783541c5bb930cc2cb39610705a4adc1 -// flow-typed version: d84de54b07/axios_v0.16.x/flow_>=v0.25.x +// flow-typed version: 8b766558cb/axios_v0.18.x/flow_>=v0.25.x -declare module 'axios' { +declare module "axios" { + declare interface AxiosTransformer { + (data: T, headers?: Object): Object; + } declare interface ProxyConfig { host: string; port: number; + auth?: { + username: string, + password: string + }; } declare interface Cancel { constructor(message?: string): Cancel; @@ -17,7 +24,7 @@ declare module 'axios' { token: CancelToken; cancel: Canceler; } - declare interface CancelToken { + declare class CancelToken { constructor(executor: (cancel: Canceler) => void): CancelToken; static source(): CancelTokenSource; promise: Promise; @@ -30,22 +37,28 @@ declare module 'axios' { username: string, password: string }; - baseURL?: string, + baseURL?: string; cancelToken?: CancelToken; headers?: Object; httpAgent?: mixed; // Missing the type in the core flow node libdef httpsAgent?: mixed; // Missing the type in the core flow node libdef maxContentLength?: number; - maxRedirects?: 5, + maxRedirects?: number; params?: Object; paramsSerializer?: (params: Object) => string; progress?: (progressEvent: Event) => void | mixed; - proxy?: ProxyConfig; - responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'; + proxy?: ProxyConfig | false; + responseType?: + | "arraybuffer" + | "blob" + | "document" + | "json" + | "text" + | "stream"; timeout?: number; - transformRequest?: Array<(data: T) => U|Array<(data: T) => U>>; - transformResponse?: Array<(data: T) => U>; - validateStatus?: (status: number) => boolean, + transformRequest?: AxiosTransformer | Array>; + transformResponse?: AxiosTransformer | Array>; + validateStatus?: (status: number) => boolean; withCredentials?: boolean; xsrfCookieName?: string; xsrfHeaderName?: string; @@ -62,46 +75,64 @@ declare module 'axios' { data: T; headers?: Object; status: number; - statusText: string, - request: http$ClientRequest | XMLHttpRequest + statusText: string; + request: http$ClientRequest | XMLHttpRequest; } declare type $AxiosXHR = AxiosXHR; - declare class AxiosInterceptorIdent extends String {} + declare type AxiosInterceptorIdent = number; declare class AxiosRequestInterceptor { use( - successHandler: ?(response: AxiosXHRConfig) => Promise> | AxiosXHRConfig<*>, - errorHandler: ?(error: mixed) => mixed, + successHandler: ?( + response: AxiosXHRConfig + ) => Promise> | AxiosXHRConfig<*>, + errorHandler: ?(error: mixed) => mixed ): AxiosInterceptorIdent; eject(ident: AxiosInterceptorIdent): void; } declare class AxiosResponseInterceptor { use( successHandler: ?(response: AxiosXHR) => mixed, - errorHandler: ?(error: $AxiosError) => mixed, + errorHandler: ?(error: $AxiosError) => mixed ): AxiosInterceptorIdent; eject(ident: AxiosInterceptorIdent): void; } declare type AxiosPromise = Promise>; declare class Axios { constructor(config?: AxiosXHRConfigBase): void; - $call: (config: AxiosXHRConfig | string, config?: AxiosXHRConfig) => AxiosPromise; + $call: ( + config: AxiosXHRConfig | string, + config?: AxiosXHRConfig + ) => AxiosPromise; request(config: AxiosXHRConfig): AxiosPromise; delete(url: string, config?: AxiosXHRConfigBase): AxiosPromise; get(url: string, config?: AxiosXHRConfigBase): AxiosPromise; head(url: string, config?: AxiosXHRConfigBase): AxiosPromise; - post(url: string, data?: mixed, config?: AxiosXHRConfigBase): AxiosPromise; - put(url: string, data?: mixed, config?: AxiosXHRConfigBase): AxiosPromise; - patch(url: string, data?: mixed, config?: AxiosXHRConfigBase): AxiosPromise; + post( + url: string, + data?: mixed, + config?: AxiosXHRConfigBase + ): AxiosPromise; + put( + url: string, + data?: mixed, + config?: AxiosXHRConfigBase + ): AxiosPromise; + patch( + url: string, + data?: mixed, + config?: AxiosXHRConfigBase + ): AxiosPromise; interceptors: { request: AxiosRequestInterceptor, - response: AxiosResponseInterceptor, + response: AxiosResponseInterceptor }; - defaults: AxiosXHRConfig<*> & { headers: Object }; + defaults: { headers: Object } & AxiosXHRConfig<*>; } declare class AxiosError extends Error { config: AxiosXHRConfig; - response: AxiosXHR; + request?: http$ClientRequest | XMLHttpRequest; + response?: AxiosXHR; code?: string; } @@ -114,7 +145,7 @@ declare module 'axios' { isCancel(value: any): boolean; create(config?: AxiosXHRConfigBase): Axios; all: typeof Promise.all; - spread(callback: Function): (arr: Array) => Function + spread(callback: Function): (arr: Array) => Function; } declare module.exports: AxiosExport; } diff --git a/package.json b/package.json index 29a7833f0..0e3997764 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "dependencies": { "@rails/webpacker": "^3.5.5", "autoprefixer": "^7.2.6", - "axios": "^0.16.2", + "axios": "0.18.1", "babel-core": "^6.26.3", "babel-loader": "^7.1.5", "babel-plugin-syntax-dynamic-import": "^6.18.0", @@ -58,8 +58,8 @@ "coffee-loader": "^0.8.0", "coffeescript": "^1.12.6", "compression-webpack-plugin": "^1.1.11", - "css-loader": "^0.28.11", "croppie": "^2.6.4", + "css-loader": "^0.28.11", "extract-text-webpack-plugin": "^3.0.2", "fabric": "1.6.7", "file-loader": "^0.11.2", diff --git a/yarn.lock b/yarn.lock index 882fe37f0..47dafcb08 100644 --- a/yarn.lock +++ b/yarn.lock @@ -578,13 +578,13 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== -axios@^0.16.2: - version "0.16.2" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.16.2.tgz#ba4f92f17167dfbab40983785454b9ac149c3c6d" - integrity sha1-uk+S8XFn37q0CYN4VFS5rBScPG0= +axios@0.18.1: + version "0.18.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.18.1.tgz#ff3f0de2e7b5d180e757ad98000f1081b87bcea3" + integrity sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g== dependencies: - follow-redirects "^1.2.3" - is-buffer "^1.1.5" + follow-redirects "1.5.10" + is-buffer "^2.0.2" axobject-query@^0.1.0: version "0.1.0" @@ -2504,7 +2504,7 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.6, debug@^2.6.8, debug@^2.6. dependencies: ms "2.0.0" -debug@3.1.0: +debug@3.1.0, debug@=3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== @@ -3714,7 +3714,14 @@ flush-write-stream@^1.0.0: inherits "^2.0.3" readable-stream "^2.3.6" -follow-redirects@^1.0.0, follow-redirects@^1.2.3: +follow-redirects@1.5.10: + version "1.5.10" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a" + integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ== + dependencies: + debug "=3.1.0" + +follow-redirects@^1.0.0: version "1.7.0" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.7.0.tgz#489ebc198dc0e7f64167bd23b03c4c19b5784c76" integrity sha512-m/pZQy4Gj287eNy94nivy5wchN3Kp+Q5WgUPNy5lJSZ3sgkVKSYV/ZChMAQVIgx1SqfZ2zBZtPA2YlXIWxxJOQ== @@ -4588,6 +4595,11 @@ is-buffer@^1.1.5, is-buffer@~1.1.1: resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== +is-buffer@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.3.tgz#4ecf3fcf749cbd1e472689e109ac66261a25e725" + integrity sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw== + is-callable@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75"