Showing
77 changed files
with
2888 additions
and
0 deletions
commands/breathe.js
0 → 100644
1 | +module.exports = { | ||
2 | + name: 'breathe', | ||
3 | + description: 'Embeds a gif', | ||
4 | + execute(message, args, Discord){ | ||
5 | + message.channel.send('https://images.squarespace-cdn.com/content/v1/5f6a71b620b6aa40a963641d/1609631567334-8E5V3K3WXD4PW4YWB0ZZ/6a-1575918606525.gif'); | ||
6 | + } | ||
7 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
commands/calm.js
0 → 100644
1 | +module.exports = { | ||
2 | + name: 'calm', | ||
3 | + description: 'Actual help section', | ||
4 | + execute(message, args){ | ||
5 | + message.channel.send("It's okay, I'm here to help! What would you like to do?\n\n;breathe : A gif to sync your breathing to!\n;cute : Some cute animal pictures to banish the bad feels!\n;checklist : I will guide you through an anxiety checklist\n;chat : If you just want a chat with me!"); | ||
6 | + } | ||
7 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
commands/chat.js
0 → 100644
File mode changed
commands/checklist.js
0 → 100644
File mode changed
commands/cute.js
0 → 100644
1 | +const subReddits = [ | ||
2 | + "r/aww" | ||
3 | +] | ||
4 | + | ||
5 | +module.exports = { | ||
6 | + name: 'cute', | ||
7 | + description: 'Embeds pictures pulled from listed subreddits', | ||
8 | + execute(message, args, Discord){ | ||
9 | + const randomIndex = randomInt(0, subReddits.length); | ||
10 | + axios | ||
11 | + .get(`https://reddit.com/${subReddits[randomIndex]}/.json`) | ||
12 | + .then((resp) => { | ||
13 | + const { | ||
14 | + title, | ||
15 | + url, | ||
16 | + subreddit_name_prefixed: subreddit | ||
17 | + } = getRandomPost(resp.data.data.children); | ||
18 | + }) | ||
19 | + | ||
20 | + const newEmbed = new Discord.cuteEmbed() | ||
21 | + .setTitle('${title}') | ||
22 | + .setImage('${url}'); | ||
23 | + } | ||
24 | +} | ||
25 | + | ||
26 | +//random int generator | ||
27 | +function randomInt(min, max) { | ||
28 | + return (Math.floor(Math.random() * (max - min))) + min; | ||
29 | +} | ||
30 | +//random post generator | ||
31 | +function getRandomPost(posts) { | ||
32 | + const randomIndex = randomInt(0, posts.length); | ||
33 | + return posts[randomIndex].data; | ||
34 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
commands/help.js
0 → 100644
1 | +//bot basic primer | ||
1 | const Discord = require('discord.js'); | 2 | const Discord = require('discord.js'); |
2 | 3 | ||
3 | const client = new Discord.Client(); | 4 | const client = new Discord.Client(); |
4 | 5 | ||
6 | +const prefix = ';'; | ||
7 | + | ||
8 | +const fs = require('fs'); | ||
9 | + | ||
10 | +//import 'regenerator-runtime/runtime'; -> do i need this? | ||
11 | +const axios = require("axios"); | ||
12 | + | ||
13 | +client.commands = new Discord.Collection(); | ||
14 | + | ||
15 | +const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); | ||
16 | +for(const file of commandFiles){ | ||
17 | + const command = require(`./commands/${file}`); | ||
18 | + client.commands.set(command.name, command); | ||
19 | +} | ||
20 | + | ||
5 | client.once('ready', () => { | 21 | client.once('ready', () => { |
6 | console.log('anxietymanager is online') | 22 | console.log('anxietymanager is online') |
7 | }); | 23 | }); |
8 | 24 | ||
9 | 25 | ||
26 | +//Command Calls | ||
27 | +client.on('message', message => { | ||
28 | + if(!message.content.startsWith(prefix)) return; | ||
29 | + | ||
30 | + const args = message.content.slice(prefix.length).split(/ +/); | ||
31 | + const command = args.shift().toLowerCase(); | ||
32 | + | ||
33 | + if(command == 'ping'){ | ||
34 | + message.channel.send('pong!'); | ||
35 | + } else if(command == 'help'){ | ||
36 | + client.commands.get('help').execute(message, args); | ||
37 | + } else if(command == 'calm'){ | ||
38 | + client.commands.get('calm').execute(message, args); | ||
39 | + } else if(command == 'breathe'){ | ||
40 | + client.commands.get('breathe').execute(message, args); | ||
41 | + } else if(command == 'cute'){ | ||
42 | + client.commands.get('cute').execute(message, args, Discord); | ||
43 | + } | ||
44 | +}); | ||
45 | + | ||
46 | + | ||
10 | 47 | ||
11 | client.login('OTgwOTAxNzg3MzY2MjE1Njgw.GVFGdS.z9ily3n-7rcJnqf2FrHg3KJn5h_u68llQzJOGU'); | 48 | client.login('OTgwOTAxNzg3MzY2MjE1Njgw.GVFGdS.z9ily3n-7rcJnqf2FrHg3KJn5h_u68llQzJOGU'); |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -38,6 +38,15 @@ | ... | @@ -38,6 +38,15 @@ |
38 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", | 38 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", |
39 | "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" | 39 | "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" |
40 | }, | 40 | }, |
41 | + "node_modules/axios": { | ||
42 | + "version": "0.27.2", | ||
43 | + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", | ||
44 | + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", | ||
45 | + "dependencies": { | ||
46 | + "follow-redirects": "^1.14.9", | ||
47 | + "form-data": "^4.0.0" | ||
48 | + } | ||
49 | + }, | ||
41 | "node_modules/combined-stream": { | 50 | "node_modules/combined-stream": { |
42 | "version": "1.0.8", | 51 | "version": "1.0.8", |
43 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", | 52 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", |
... | @@ -84,6 +93,38 @@ | ... | @@ -84,6 +93,38 @@ |
84 | "node": ">=6" | 93 | "node": ">=6" |
85 | } | 94 | } |
86 | }, | 95 | }, |
96 | + "node_modules/follow-redirects": { | ||
97 | + "version": "1.15.1", | ||
98 | + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", | ||
99 | + "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==", | ||
100 | + "funding": [ | ||
101 | + { | ||
102 | + "type": "individual", | ||
103 | + "url": "https://github.com/sponsors/RubenVerborgh" | ||
104 | + } | ||
105 | + ], | ||
106 | + "engines": { | ||
107 | + "node": ">=4.0" | ||
108 | + }, | ||
109 | + "peerDependenciesMeta": { | ||
110 | + "debug": { | ||
111 | + "optional": true | ||
112 | + } | ||
113 | + } | ||
114 | + }, | ||
115 | + "node_modules/form-data": { | ||
116 | + "version": "4.0.0", | ||
117 | + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", | ||
118 | + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", | ||
119 | + "dependencies": { | ||
120 | + "asynckit": "^0.4.0", | ||
121 | + "combined-stream": "^1.0.8", | ||
122 | + "mime-types": "^2.1.12" | ||
123 | + }, | ||
124 | + "engines": { | ||
125 | + "node": ">= 6" | ||
126 | + } | ||
127 | + }, | ||
87 | "node_modules/mime-db": { | 128 | "node_modules/mime-db": { |
88 | "version": "1.52.0", | 129 | "version": "1.52.0", |
89 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", | 130 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", | ... | ... |
node_modules/axios/CHANGELOG.md
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/axios/LICENSE
0 → 100644
1 | +Copyright (c) 2014-present Matt Zabriskie | ||
2 | + | ||
3 | +Permission is hereby granted, free of charge, to any person obtaining a copy | ||
4 | +of this software and associated documentation files (the "Software"), to deal | ||
5 | +in the Software without restriction, including without limitation the rights | ||
6 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
7 | +copies of the Software, and to permit persons to whom the Software is | ||
8 | +furnished to do so, subject to the following conditions: | ||
9 | + | ||
10 | +The above copyright notice and this permission notice shall be included in | ||
11 | +all copies or substantial portions of the Software. | ||
12 | + | ||
13 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
14 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
15 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
16 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
17 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
18 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
19 | +THE SOFTWARE. |
node_modules/axios/README.md
0 → 100755
This diff is collapsed. Click to expand it.
node_modules/axios/SECURITY.md
0 → 100644
node_modules/axios/UPGRADE_GUIDE.md
0 → 100644
1 | +# Upgrade Guide | ||
2 | + | ||
3 | +### 0.18.x -> 0.19.0 | ||
4 | + | ||
5 | +#### HTTPS Proxies | ||
6 | + | ||
7 | +Routing through an https proxy now requires setting the `protocol` attribute of the proxy configuration to `https` | ||
8 | + | ||
9 | +### 0.15.x -> 0.16.0 | ||
10 | + | ||
11 | +#### `Promise` Type Declarations | ||
12 | + | ||
13 | +The `Promise` type declarations have been removed from the axios typings in favor of the built-in type declarations. If you use axios in a TypeScript project that targets `ES5`, please make sure to include the `es2015.promise` lib. Please see [this post](https://blog.mariusschulz.com/2016/11/25/typescript-2-0-built-in-type-declarations) for details. | ||
14 | + | ||
15 | +### 0.13.x -> 0.14.0 | ||
16 | + | ||
17 | +#### TypeScript Definitions | ||
18 | + | ||
19 | +The axios TypeScript definitions have been updated to match the axios API and use the ES2015 module syntax. | ||
20 | + | ||
21 | +Please use the following `import` statement to import axios in TypeScript: | ||
22 | + | ||
23 | +```typescript | ||
24 | +import axios from 'axios'; | ||
25 | + | ||
26 | +axios.get('/foo') | ||
27 | + .then(response => console.log(response)) | ||
28 | + .catch(error => console.log(error)); | ||
29 | +``` | ||
30 | + | ||
31 | +#### `agent` Config Option | ||
32 | + | ||
33 | +The `agent` config option has been replaced with two new options: `httpAgent` and `httpsAgent`. Please use them instead. | ||
34 | + | ||
35 | +```js | ||
36 | +{ | ||
37 | + // Define a custom agent for HTTP | ||
38 | + httpAgent: new http.Agent({ keepAlive: true }), | ||
39 | + // Define a custom agent for HTTPS | ||
40 | + httpsAgent: new https.Agent({ keepAlive: true }) | ||
41 | +} | ||
42 | +``` | ||
43 | + | ||
44 | +#### `progress` Config Option | ||
45 | + | ||
46 | +The `progress` config option has been replaced with the `onUploadProgress` and `onDownloadProgress` options. | ||
47 | + | ||
48 | +```js | ||
49 | +{ | ||
50 | + // Define a handler for upload progress events | ||
51 | + onUploadProgress: function (progressEvent) { | ||
52 | + // ... | ||
53 | + }, | ||
54 | + | ||
55 | + // Define a handler for download progress events | ||
56 | + onDownloadProgress: function (progressEvent) { | ||
57 | + // ... | ||
58 | + } | ||
59 | +} | ||
60 | +``` | ||
61 | + | ||
62 | +### 0.12.x -> 0.13.0 | ||
63 | + | ||
64 | +The `0.13.0` release contains several changes to custom adapters and error handling. | ||
65 | + | ||
66 | +#### Error Handling | ||
67 | + | ||
68 | +Previous to this release an error could either be a server response with bad status code or an actual `Error`. With this release Promise will always reject with an `Error`. In the case that a response was received, the `Error` will also include the response. | ||
69 | + | ||
70 | +```js | ||
71 | +axios.get('/user/12345') | ||
72 | + .catch((error) => { | ||
73 | + console.log(error.message); | ||
74 | + console.log(error.code); // Not always specified | ||
75 | + console.log(error.config); // The config that was used to make the request | ||
76 | + console.log(error.response); // Only available if response was received from the server | ||
77 | + }); | ||
78 | +``` | ||
79 | + | ||
80 | +#### Request Adapters | ||
81 | + | ||
82 | +This release changes a few things about how request adapters work. Please take note if you are using your own custom adapter. | ||
83 | + | ||
84 | +1. Response transformer is now called outside of adapter. | ||
85 | +2. Request adapter returns a `Promise`. | ||
86 | + | ||
87 | +This means that you no longer need to invoke `transformData` on response data. You will also no longer receive `resolve` and `reject` as arguments in your adapter. | ||
88 | + | ||
89 | +Previous code: | ||
90 | + | ||
91 | +```js | ||
92 | +function myAdapter(resolve, reject, config) { | ||
93 | + var response = { | ||
94 | + data: transformData( | ||
95 | + responseData, | ||
96 | + responseHeaders, | ||
97 | + config.transformResponse | ||
98 | + ), | ||
99 | + status: request.status, | ||
100 | + statusText: request.statusText, | ||
101 | + headers: responseHeaders | ||
102 | + }; | ||
103 | + settle(resolve, reject, response); | ||
104 | +} | ||
105 | +``` | ||
106 | + | ||
107 | +New code: | ||
108 | + | ||
109 | +```js | ||
110 | +function myAdapter(config) { | ||
111 | + return new Promise(function (resolve, reject) { | ||
112 | + var response = { | ||
113 | + data: responseData, | ||
114 | + status: request.status, | ||
115 | + statusText: request.statusText, | ||
116 | + headers: responseHeaders | ||
117 | + }; | ||
118 | + settle(resolve, reject, response); | ||
119 | + }); | ||
120 | +} | ||
121 | +``` | ||
122 | + | ||
123 | +See the related commits for more details: | ||
124 | +- [Response transformers](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e) | ||
125 | +- [Request adapter Promise](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a) | ||
126 | + | ||
127 | +### 0.5.x -> 0.6.0 | ||
128 | + | ||
129 | +The `0.6.0` release contains mostly bug fixes, but there are a couple things to be aware of when upgrading. | ||
130 | + | ||
131 | +#### ES6 Promise Polyfill | ||
132 | + | ||
133 | +Up until the `0.6.0` release ES6 `Promise` was being polyfilled using [es6-promise](https://github.com/jakearchibald/es6-promise). With this release, the polyfill has been removed, and you will need to supply it yourself if your environment needs it. | ||
134 | + | ||
135 | +```js | ||
136 | +require('es6-promise').polyfill(); | ||
137 | +var axios = require('axios'); | ||
138 | +``` | ||
139 | + | ||
140 | +This will polyfill the global environment, and only needs to be done once. | ||
141 | + | ||
142 | +#### `axios.success`/`axios.error` | ||
143 | + | ||
144 | +The `success`, and `error` aliases were deprecated in [0.4.0](https://github.com/axios/axios/blob/master/CHANGELOG.md#040-oct-03-2014). As of this release they have been removed entirely. Instead please use `axios.then`, and `axios.catch` respectively. | ||
145 | + | ||
146 | +```js | ||
147 | +axios.get('some/url') | ||
148 | + .then(function (res) { | ||
149 | + /* ... */ | ||
150 | + }) | ||
151 | + .catch(function (err) { | ||
152 | + /* ... */ | ||
153 | + }); | ||
154 | +``` | ||
155 | + | ||
156 | +#### UMD | ||
157 | + | ||
158 | +Previous versions of axios shipped with an AMD, CommonJS, and Global build. This has all been rolled into a single UMD build. | ||
159 | + | ||
160 | +```js | ||
161 | +// AMD | ||
162 | +require(['bower_components/axios/dist/axios'], function (axios) { | ||
163 | + /* ... */ | ||
164 | +}); | ||
165 | + | ||
166 | +// CommonJS | ||
167 | +var axios = require('axios/dist/axios'); | ||
168 | +``` |
node_modules/axios/dist/axios.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/axios/dist/axios.map
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/axios/dist/axios.min.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/axios/dist/axios.min.map
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/axios/index.d.ts
0 → 100644
1 | +// TypeScript Version: 3.0 | ||
2 | +export type AxiosRequestHeaders = Record<string, string | number | boolean>; | ||
3 | + | ||
4 | +export type AxiosResponseHeaders = Record<string, string> & { | ||
5 | + "set-cookie"?: string[] | ||
6 | +}; | ||
7 | + | ||
8 | +export interface AxiosRequestTransformer { | ||
9 | + (data: any, headers?: AxiosRequestHeaders): any; | ||
10 | +} | ||
11 | + | ||
12 | +export interface AxiosResponseTransformer { | ||
13 | + (data: any, headers?: AxiosResponseHeaders): any; | ||
14 | +} | ||
15 | + | ||
16 | +export interface AxiosAdapter { | ||
17 | + (config: AxiosRequestConfig): AxiosPromise; | ||
18 | +} | ||
19 | + | ||
20 | +export interface AxiosBasicCredentials { | ||
21 | + username: string; | ||
22 | + password: string; | ||
23 | +} | ||
24 | + | ||
25 | +export interface AxiosProxyConfig { | ||
26 | + host: string; | ||
27 | + port: number; | ||
28 | + auth?: { | ||
29 | + username: string; | ||
30 | + password: string; | ||
31 | + }; | ||
32 | + protocol?: string; | ||
33 | +} | ||
34 | + | ||
35 | +export type Method = | ||
36 | + | 'get' | 'GET' | ||
37 | + | 'delete' | 'DELETE' | ||
38 | + | 'head' | 'HEAD' | ||
39 | + | 'options' | 'OPTIONS' | ||
40 | + | 'post' | 'POST' | ||
41 | + | 'put' | 'PUT' | ||
42 | + | 'patch' | 'PATCH' | ||
43 | + | 'purge' | 'PURGE' | ||
44 | + | 'link' | 'LINK' | ||
45 | + | 'unlink' | 'UNLINK'; | ||
46 | + | ||
47 | +export type ResponseType = | ||
48 | + | 'arraybuffer' | ||
49 | + | 'blob' | ||
50 | + | 'document' | ||
51 | + | 'json' | ||
52 | + | 'text' | ||
53 | + | 'stream'; | ||
54 | + | ||
55 | + export type responseEncoding = | ||
56 | + | 'ascii' | 'ASCII' | ||
57 | + | 'ansi' | 'ANSI' | ||
58 | + | 'binary' | 'BINARY' | ||
59 | + | 'base64' | 'BASE64' | ||
60 | + | 'base64url' | 'BASE64URL' | ||
61 | + | 'hex' | 'HEX' | ||
62 | + | 'latin1' | 'LATIN1' | ||
63 | + | 'ucs-2' | 'UCS-2' | ||
64 | + | 'ucs2' | 'UCS2' | ||
65 | + | 'utf-8' | 'UTF-8' | ||
66 | + | 'utf8' | 'UTF8' | ||
67 | + | 'utf16le' | 'UTF16LE'; | ||
68 | + | ||
69 | +export interface TransitionalOptions { | ||
70 | + silentJSONParsing?: boolean; | ||
71 | + forcedJSONParsing?: boolean; | ||
72 | + clarifyTimeoutError?: boolean; | ||
73 | +} | ||
74 | + | ||
75 | +export interface AxiosRequestConfig<D = any> { | ||
76 | + url?: string; | ||
77 | + method?: Method | string; | ||
78 | + baseURL?: string; | ||
79 | + transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[]; | ||
80 | + transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[]; | ||
81 | + headers?: AxiosRequestHeaders; | ||
82 | + params?: any; | ||
83 | + paramsSerializer?: (params: any) => string; | ||
84 | + data?: D; | ||
85 | + timeout?: number; | ||
86 | + timeoutErrorMessage?: string; | ||
87 | + withCredentials?: boolean; | ||
88 | + adapter?: AxiosAdapter; | ||
89 | + auth?: AxiosBasicCredentials; | ||
90 | + responseType?: ResponseType; | ||
91 | + responseEncoding?: responseEncoding | string; | ||
92 | + xsrfCookieName?: string; | ||
93 | + xsrfHeaderName?: string; | ||
94 | + onUploadProgress?: (progressEvent: any) => void; | ||
95 | + onDownloadProgress?: (progressEvent: any) => void; | ||
96 | + maxContentLength?: number; | ||
97 | + validateStatus?: ((status: number) => boolean) | null; | ||
98 | + maxBodyLength?: number; | ||
99 | + maxRedirects?: number; | ||
100 | + beforeRedirect?: (options: Record<string, any>, responseDetails: {headers: Record<string, string>}) => void; | ||
101 | + socketPath?: string | null; | ||
102 | + httpAgent?: any; | ||
103 | + httpsAgent?: any; | ||
104 | + proxy?: AxiosProxyConfig | false; | ||
105 | + cancelToken?: CancelToken; | ||
106 | + decompress?: boolean; | ||
107 | + transitional?: TransitionalOptions; | ||
108 | + signal?: AbortSignal; | ||
109 | + insecureHTTPParser?: boolean; | ||
110 | + env?: { | ||
111 | + FormData?: new (...args: any[]) => object; | ||
112 | + }; | ||
113 | +} | ||
114 | + | ||
115 | +export interface HeadersDefaults { | ||
116 | + common: AxiosRequestHeaders; | ||
117 | + delete: AxiosRequestHeaders; | ||
118 | + get: AxiosRequestHeaders; | ||
119 | + head: AxiosRequestHeaders; | ||
120 | + post: AxiosRequestHeaders; | ||
121 | + put: AxiosRequestHeaders; | ||
122 | + patch: AxiosRequestHeaders; | ||
123 | + options?: AxiosRequestHeaders; | ||
124 | + purge?: AxiosRequestHeaders; | ||
125 | + link?: AxiosRequestHeaders; | ||
126 | + unlink?: AxiosRequestHeaders; | ||
127 | +} | ||
128 | + | ||
129 | +export interface AxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> { | ||
130 | + headers: HeadersDefaults; | ||
131 | +} | ||
132 | + | ||
133 | +export interface AxiosResponse<T = any, D = any> { | ||
134 | + data: T; | ||
135 | + status: number; | ||
136 | + statusText: string; | ||
137 | + headers: AxiosResponseHeaders; | ||
138 | + config: AxiosRequestConfig<D>; | ||
139 | + request?: any; | ||
140 | +} | ||
141 | + | ||
142 | +export class AxiosError<T = unknown, D = any> extends Error { | ||
143 | + constructor( | ||
144 | + message?: string, | ||
145 | + code?: string, | ||
146 | + config?: AxiosRequestConfig<D>, | ||
147 | + request?: any, | ||
148 | + response?: AxiosResponse<T, D> | ||
149 | + ); | ||
150 | + | ||
151 | + config: AxiosRequestConfig<D>; | ||
152 | + code?: string; | ||
153 | + request?: any; | ||
154 | + response?: AxiosResponse<T, D>; | ||
155 | + isAxiosError: boolean; | ||
156 | + status?: string; | ||
157 | + toJSON: () => object; | ||
158 | + static readonly ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS"; | ||
159 | + static readonly ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE"; | ||
160 | + static readonly ERR_BAD_OPTION = "ERR_BAD_OPTION"; | ||
161 | + static readonly ERR_NETWORK = "ERR_NETWORK"; | ||
162 | + static readonly ERR_DEPRECATED = "ERR_DEPRECATED"; | ||
163 | + static readonly ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE"; | ||
164 | + static readonly ERR_BAD_REQUEST = "ERR_BAD_REQUEST"; | ||
165 | + static readonly ERR_CANCELED = "ERR_CANCELED"; | ||
166 | + static readonly ECONNABORTED = "ECONNABORTED"; | ||
167 | + static readonly ETIMEDOUT = "ETIMEDOUT"; | ||
168 | +} | ||
169 | + | ||
170 | +export class CanceledError<T> extends AxiosError<T> { | ||
171 | +} | ||
172 | + | ||
173 | +export interface AxiosPromise<T = any> extends Promise<AxiosResponse<T>> { | ||
174 | +} | ||
175 | + | ||
176 | +export interface CancelStatic { | ||
177 | + new (message?: string): Cancel; | ||
178 | +} | ||
179 | + | ||
180 | +export interface Cancel { | ||
181 | + message: string | undefined; | ||
182 | +} | ||
183 | + | ||
184 | +export interface Canceler { | ||
185 | + (message?: string): void; | ||
186 | +} | ||
187 | + | ||
188 | +export interface CancelTokenStatic { | ||
189 | + new (executor: (cancel: Canceler) => void): CancelToken; | ||
190 | + source(): CancelTokenSource; | ||
191 | +} | ||
192 | + | ||
193 | +export interface CancelToken { | ||
194 | + promise: Promise<Cancel>; | ||
195 | + reason?: Cancel; | ||
196 | + throwIfRequested(): void; | ||
197 | +} | ||
198 | + | ||
199 | +export interface CancelTokenSource { | ||
200 | + token: CancelToken; | ||
201 | + cancel: Canceler; | ||
202 | +} | ||
203 | + | ||
204 | +export interface AxiosInterceptorOptions { | ||
205 | + synchronous?: boolean; | ||
206 | + runWhen?: (config: AxiosRequestConfig) => boolean; | ||
207 | +} | ||
208 | + | ||
209 | +export interface AxiosInterceptorManager<V> { | ||
210 | + use<T = V>(onFulfilled?: (value: V) => T | Promise<T>, onRejected?: (error: any) => any, options?: AxiosInterceptorOptions): number; | ||
211 | + eject(id: number): void; | ||
212 | +} | ||
213 | + | ||
214 | +export class Axios { | ||
215 | + constructor(config?: AxiosRequestConfig); | ||
216 | + defaults: AxiosDefaults; | ||
217 | + interceptors: { | ||
218 | + request: AxiosInterceptorManager<AxiosRequestConfig>; | ||
219 | + response: AxiosInterceptorManager<AxiosResponse>; | ||
220 | + }; | ||
221 | + getUri(config?: AxiosRequestConfig): string; | ||
222 | + request<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>; | ||
223 | + get<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>; | ||
224 | + delete<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>; | ||
225 | + head<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>; | ||
226 | + options<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>; | ||
227 | + post<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>; | ||
228 | + put<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>; | ||
229 | + patch<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>; | ||
230 | + postForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>; | ||
231 | + putForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>; | ||
232 | + patchForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>; | ||
233 | +} | ||
234 | + | ||
235 | +export interface AxiosInstance extends Axios { | ||
236 | + (config: AxiosRequestConfig): AxiosPromise; | ||
237 | + (url: string, config?: AxiosRequestConfig): AxiosPromise; | ||
238 | +} | ||
239 | + | ||
240 | +export interface AxiosStatic extends AxiosInstance { | ||
241 | + create(config?: AxiosRequestConfig): AxiosInstance; | ||
242 | + Cancel: CancelStatic; | ||
243 | + CancelToken: CancelTokenStatic; | ||
244 | + Axios: typeof Axios; | ||
245 | + readonly VERSION: string; | ||
246 | + isCancel(value: any): boolean; | ||
247 | + all<T>(values: Array<T | Promise<T>>): Promise<T[]>; | ||
248 | + spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R; | ||
249 | + isAxiosError(payload: any): payload is AxiosError; | ||
250 | +} | ||
251 | + | ||
252 | +declare const axios: AxiosStatic; | ||
253 | + | ||
254 | +export default axios; |
node_modules/axios/index.js
0 → 100644
1 | +module.exports = require('./lib/axios'); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/axios/lib/adapters/README.md
0 → 100644
1 | +# axios // adapters | ||
2 | + | ||
3 | +The modules under `adapters/` are modules that handle dispatching a request and settling a returned `Promise` once a response is received. | ||
4 | + | ||
5 | +## Example | ||
6 | + | ||
7 | +```js | ||
8 | +var settle = require('./../core/settle'); | ||
9 | + | ||
10 | +module.exports = function myAdapter(config) { | ||
11 | + // At this point: | ||
12 | + // - config has been merged with defaults | ||
13 | + // - request transformers have already run | ||
14 | + // - request interceptors have already run | ||
15 | + | ||
16 | + // Make the request using config provided | ||
17 | + // Upon response settle the Promise | ||
18 | + | ||
19 | + return new Promise(function(resolve, reject) { | ||
20 | + | ||
21 | + var response = { | ||
22 | + data: responseData, | ||
23 | + status: request.status, | ||
24 | + statusText: request.statusText, | ||
25 | + headers: responseHeaders, | ||
26 | + config: config, | ||
27 | + request: request | ||
28 | + }; | ||
29 | + | ||
30 | + settle(resolve, reject, response); | ||
31 | + | ||
32 | + // From here: | ||
33 | + // - response transformers will run | ||
34 | + // - response interceptors will run | ||
35 | + }); | ||
36 | +} | ||
37 | +``` |
node_modules/axios/lib/adapters/http.js
0 → 100755
This diff is collapsed. Click to expand it.
node_modules/axios/lib/adapters/xhr.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var utils = require('./../utils'); | ||
4 | +var settle = require('./../core/settle'); | ||
5 | +var cookies = require('./../helpers/cookies'); | ||
6 | +var buildURL = require('./../helpers/buildURL'); | ||
7 | +var buildFullPath = require('../core/buildFullPath'); | ||
8 | +var parseHeaders = require('./../helpers/parseHeaders'); | ||
9 | +var isURLSameOrigin = require('./../helpers/isURLSameOrigin'); | ||
10 | +var transitionalDefaults = require('../defaults/transitional'); | ||
11 | +var AxiosError = require('../core/AxiosError'); | ||
12 | +var CanceledError = require('../cancel/CanceledError'); | ||
13 | +var parseProtocol = require('../helpers/parseProtocol'); | ||
14 | + | ||
15 | +module.exports = function xhrAdapter(config) { | ||
16 | + return new Promise(function dispatchXhrRequest(resolve, reject) { | ||
17 | + var requestData = config.data; | ||
18 | + var requestHeaders = config.headers; | ||
19 | + var responseType = config.responseType; | ||
20 | + var onCanceled; | ||
21 | + function done() { | ||
22 | + if (config.cancelToken) { | ||
23 | + config.cancelToken.unsubscribe(onCanceled); | ||
24 | + } | ||
25 | + | ||
26 | + if (config.signal) { | ||
27 | + config.signal.removeEventListener('abort', onCanceled); | ||
28 | + } | ||
29 | + } | ||
30 | + | ||
31 | + if (utils.isFormData(requestData) && utils.isStandardBrowserEnv()) { | ||
32 | + delete requestHeaders['Content-Type']; // Let the browser set it | ||
33 | + } | ||
34 | + | ||
35 | + var request = new XMLHttpRequest(); | ||
36 | + | ||
37 | + // HTTP basic authentication | ||
38 | + if (config.auth) { | ||
39 | + var username = config.auth.username || ''; | ||
40 | + var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ''; | ||
41 | + requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); | ||
42 | + } | ||
43 | + | ||
44 | + var fullPath = buildFullPath(config.baseURL, config.url); | ||
45 | + | ||
46 | + request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); | ||
47 | + | ||
48 | + // Set the request timeout in MS | ||
49 | + request.timeout = config.timeout; | ||
50 | + | ||
51 | + function onloadend() { | ||
52 | + if (!request) { | ||
53 | + return; | ||
54 | + } | ||
55 | + // Prepare the response | ||
56 | + var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; | ||
57 | + var responseData = !responseType || responseType === 'text' || responseType === 'json' ? | ||
58 | + request.responseText : request.response; | ||
59 | + var response = { | ||
60 | + data: responseData, | ||
61 | + status: request.status, | ||
62 | + statusText: request.statusText, | ||
63 | + headers: responseHeaders, | ||
64 | + config: config, | ||
65 | + request: request | ||
66 | + }; | ||
67 | + | ||
68 | + settle(function _resolve(value) { | ||
69 | + resolve(value); | ||
70 | + done(); | ||
71 | + }, function _reject(err) { | ||
72 | + reject(err); | ||
73 | + done(); | ||
74 | + }, response); | ||
75 | + | ||
76 | + // Clean up request | ||
77 | + request = null; | ||
78 | + } | ||
79 | + | ||
80 | + if ('onloadend' in request) { | ||
81 | + // Use onloadend if available | ||
82 | + request.onloadend = onloadend; | ||
83 | + } else { | ||
84 | + // Listen for ready state to emulate onloadend | ||
85 | + request.onreadystatechange = function handleLoad() { | ||
86 | + if (!request || request.readyState !== 4) { | ||
87 | + return; | ||
88 | + } | ||
89 | + | ||
90 | + // The request errored out and we didn't get a response, this will be | ||
91 | + // handled by onerror instead | ||
92 | + // With one exception: request that using file: protocol, most browsers | ||
93 | + // will return status as 0 even though it's a successful request | ||
94 | + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { | ||
95 | + return; | ||
96 | + } | ||
97 | + // readystate handler is calling before onerror or ontimeout handlers, | ||
98 | + // so we should call onloadend on the next 'tick' | ||
99 | + setTimeout(onloadend); | ||
100 | + }; | ||
101 | + } | ||
102 | + | ||
103 | + // Handle browser request cancellation (as opposed to a manual cancellation) | ||
104 | + request.onabort = function handleAbort() { | ||
105 | + if (!request) { | ||
106 | + return; | ||
107 | + } | ||
108 | + | ||
109 | + reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request)); | ||
110 | + | ||
111 | + // Clean up request | ||
112 | + request = null; | ||
113 | + }; | ||
114 | + | ||
115 | + // Handle low level network errors | ||
116 | + request.onerror = function handleError() { | ||
117 | + // Real errors are hidden from us by the browser | ||
118 | + // onerror should only fire if it's a network error | ||
119 | + reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, request)); | ||
120 | + | ||
121 | + // Clean up request | ||
122 | + request = null; | ||
123 | + }; | ||
124 | + | ||
125 | + // Handle timeout | ||
126 | + request.ontimeout = function handleTimeout() { | ||
127 | + var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded'; | ||
128 | + var transitional = config.transitional || transitionalDefaults; | ||
129 | + if (config.timeoutErrorMessage) { | ||
130 | + timeoutErrorMessage = config.timeoutErrorMessage; | ||
131 | + } | ||
132 | + reject(new AxiosError( | ||
133 | + timeoutErrorMessage, | ||
134 | + transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, | ||
135 | + config, | ||
136 | + request)); | ||
137 | + | ||
138 | + // Clean up request | ||
139 | + request = null; | ||
140 | + }; | ||
141 | + | ||
142 | + // Add xsrf header | ||
143 | + // This is only done if running in a standard browser environment. | ||
144 | + // Specifically not if we're in a web worker, or react-native. | ||
145 | + if (utils.isStandardBrowserEnv()) { | ||
146 | + // Add xsrf header | ||
147 | + var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? | ||
148 | + cookies.read(config.xsrfCookieName) : | ||
149 | + undefined; | ||
150 | + | ||
151 | + if (xsrfValue) { | ||
152 | + requestHeaders[config.xsrfHeaderName] = xsrfValue; | ||
153 | + } | ||
154 | + } | ||
155 | + | ||
156 | + // Add headers to the request | ||
157 | + if ('setRequestHeader' in request) { | ||
158 | + utils.forEach(requestHeaders, function setRequestHeader(val, key) { | ||
159 | + if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { | ||
160 | + // Remove Content-Type if data is undefined | ||
161 | + delete requestHeaders[key]; | ||
162 | + } else { | ||
163 | + // Otherwise add header to the request | ||
164 | + request.setRequestHeader(key, val); | ||
165 | + } | ||
166 | + }); | ||
167 | + } | ||
168 | + | ||
169 | + // Add withCredentials to request if needed | ||
170 | + if (!utils.isUndefined(config.withCredentials)) { | ||
171 | + request.withCredentials = !!config.withCredentials; | ||
172 | + } | ||
173 | + | ||
174 | + // Add responseType to request if needed | ||
175 | + if (responseType && responseType !== 'json') { | ||
176 | + request.responseType = config.responseType; | ||
177 | + } | ||
178 | + | ||
179 | + // Handle progress if needed | ||
180 | + if (typeof config.onDownloadProgress === 'function') { | ||
181 | + request.addEventListener('progress', config.onDownloadProgress); | ||
182 | + } | ||
183 | + | ||
184 | + // Not all browsers support upload events | ||
185 | + if (typeof config.onUploadProgress === 'function' && request.upload) { | ||
186 | + request.upload.addEventListener('progress', config.onUploadProgress); | ||
187 | + } | ||
188 | + | ||
189 | + if (config.cancelToken || config.signal) { | ||
190 | + // Handle cancellation | ||
191 | + // eslint-disable-next-line func-names | ||
192 | + onCanceled = function(cancel) { | ||
193 | + if (!request) { | ||
194 | + return; | ||
195 | + } | ||
196 | + reject(!cancel || (cancel && cancel.type) ? new CanceledError() : cancel); | ||
197 | + request.abort(); | ||
198 | + request = null; | ||
199 | + }; | ||
200 | + | ||
201 | + config.cancelToken && config.cancelToken.subscribe(onCanceled); | ||
202 | + if (config.signal) { | ||
203 | + config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled); | ||
204 | + } | ||
205 | + } | ||
206 | + | ||
207 | + if (!requestData) { | ||
208 | + requestData = null; | ||
209 | + } | ||
210 | + | ||
211 | + var protocol = parseProtocol(fullPath); | ||
212 | + | ||
213 | + if (protocol && [ 'http', 'https', 'file' ].indexOf(protocol) === -1) { | ||
214 | + reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config)); | ||
215 | + return; | ||
216 | + } | ||
217 | + | ||
218 | + | ||
219 | + // Send the request | ||
220 | + request.send(requestData); | ||
221 | + }); | ||
222 | +}; |
node_modules/axios/lib/axios.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var utils = require('./utils'); | ||
4 | +var bind = require('./helpers/bind'); | ||
5 | +var Axios = require('./core/Axios'); | ||
6 | +var mergeConfig = require('./core/mergeConfig'); | ||
7 | +var defaults = require('./defaults'); | ||
8 | + | ||
9 | +/** | ||
10 | + * Create an instance of Axios | ||
11 | + * | ||
12 | + * @param {Object} defaultConfig The default config for the instance | ||
13 | + * @return {Axios} A new instance of Axios | ||
14 | + */ | ||
15 | +function createInstance(defaultConfig) { | ||
16 | + var context = new Axios(defaultConfig); | ||
17 | + var instance = bind(Axios.prototype.request, context); | ||
18 | + | ||
19 | + // Copy axios.prototype to instance | ||
20 | + utils.extend(instance, Axios.prototype, context); | ||
21 | + | ||
22 | + // Copy context to instance | ||
23 | + utils.extend(instance, context); | ||
24 | + | ||
25 | + // Factory for creating new instances | ||
26 | + instance.create = function create(instanceConfig) { | ||
27 | + return createInstance(mergeConfig(defaultConfig, instanceConfig)); | ||
28 | + }; | ||
29 | + | ||
30 | + return instance; | ||
31 | +} | ||
32 | + | ||
33 | +// Create the default instance to be exported | ||
34 | +var axios = createInstance(defaults); | ||
35 | + | ||
36 | +// Expose Axios class to allow class inheritance | ||
37 | +axios.Axios = Axios; | ||
38 | + | ||
39 | +// Expose Cancel & CancelToken | ||
40 | +axios.CanceledError = require('./cancel/CanceledError'); | ||
41 | +axios.CancelToken = require('./cancel/CancelToken'); | ||
42 | +axios.isCancel = require('./cancel/isCancel'); | ||
43 | +axios.VERSION = require('./env/data').version; | ||
44 | +axios.toFormData = require('./helpers/toFormData'); | ||
45 | + | ||
46 | +// Expose AxiosError class | ||
47 | +axios.AxiosError = require('../lib/core/AxiosError'); | ||
48 | + | ||
49 | +// alias for CanceledError for backward compatibility | ||
50 | +axios.Cancel = axios.CanceledError; | ||
51 | + | ||
52 | +// Expose all/spread | ||
53 | +axios.all = function all(promises) { | ||
54 | + return Promise.all(promises); | ||
55 | +}; | ||
56 | +axios.spread = require('./helpers/spread'); | ||
57 | + | ||
58 | +// Expose isAxiosError | ||
59 | +axios.isAxiosError = require('./helpers/isAxiosError'); | ||
60 | + | ||
61 | +module.exports = axios; | ||
62 | + | ||
63 | +// Allow use of default import syntax in TypeScript | ||
64 | +module.exports.default = axios; |
node_modules/axios/lib/cancel/CancelToken.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var CanceledError = require('./CanceledError'); | ||
4 | + | ||
5 | +/** | ||
6 | + * A `CancelToken` is an object that can be used to request cancellation of an operation. | ||
7 | + * | ||
8 | + * @class | ||
9 | + * @param {Function} executor The executor function. | ||
10 | + */ | ||
11 | +function CancelToken(executor) { | ||
12 | + if (typeof executor !== 'function') { | ||
13 | + throw new TypeError('executor must be a function.'); | ||
14 | + } | ||
15 | + | ||
16 | + var resolvePromise; | ||
17 | + | ||
18 | + this.promise = new Promise(function promiseExecutor(resolve) { | ||
19 | + resolvePromise = resolve; | ||
20 | + }); | ||
21 | + | ||
22 | + var token = this; | ||
23 | + | ||
24 | + // eslint-disable-next-line func-names | ||
25 | + this.promise.then(function(cancel) { | ||
26 | + if (!token._listeners) return; | ||
27 | + | ||
28 | + var i; | ||
29 | + var l = token._listeners.length; | ||
30 | + | ||
31 | + for (i = 0; i < l; i++) { | ||
32 | + token._listeners[i](cancel); | ||
33 | + } | ||
34 | + token._listeners = null; | ||
35 | + }); | ||
36 | + | ||
37 | + // eslint-disable-next-line func-names | ||
38 | + this.promise.then = function(onfulfilled) { | ||
39 | + var _resolve; | ||
40 | + // eslint-disable-next-line func-names | ||
41 | + var promise = new Promise(function(resolve) { | ||
42 | + token.subscribe(resolve); | ||
43 | + _resolve = resolve; | ||
44 | + }).then(onfulfilled); | ||
45 | + | ||
46 | + promise.cancel = function reject() { | ||
47 | + token.unsubscribe(_resolve); | ||
48 | + }; | ||
49 | + | ||
50 | + return promise; | ||
51 | + }; | ||
52 | + | ||
53 | + executor(function cancel(message) { | ||
54 | + if (token.reason) { | ||
55 | + // Cancellation has already been requested | ||
56 | + return; | ||
57 | + } | ||
58 | + | ||
59 | + token.reason = new CanceledError(message); | ||
60 | + resolvePromise(token.reason); | ||
61 | + }); | ||
62 | +} | ||
63 | + | ||
64 | +/** | ||
65 | + * Throws a `CanceledError` if cancellation has been requested. | ||
66 | + */ | ||
67 | +CancelToken.prototype.throwIfRequested = function throwIfRequested() { | ||
68 | + if (this.reason) { | ||
69 | + throw this.reason; | ||
70 | + } | ||
71 | +}; | ||
72 | + | ||
73 | +/** | ||
74 | + * Subscribe to the cancel signal | ||
75 | + */ | ||
76 | + | ||
77 | +CancelToken.prototype.subscribe = function subscribe(listener) { | ||
78 | + if (this.reason) { | ||
79 | + listener(this.reason); | ||
80 | + return; | ||
81 | + } | ||
82 | + | ||
83 | + if (this._listeners) { | ||
84 | + this._listeners.push(listener); | ||
85 | + } else { | ||
86 | + this._listeners = [listener]; | ||
87 | + } | ||
88 | +}; | ||
89 | + | ||
90 | +/** | ||
91 | + * Unsubscribe from the cancel signal | ||
92 | + */ | ||
93 | + | ||
94 | +CancelToken.prototype.unsubscribe = function unsubscribe(listener) { | ||
95 | + if (!this._listeners) { | ||
96 | + return; | ||
97 | + } | ||
98 | + var index = this._listeners.indexOf(listener); | ||
99 | + if (index !== -1) { | ||
100 | + this._listeners.splice(index, 1); | ||
101 | + } | ||
102 | +}; | ||
103 | + | ||
104 | +/** | ||
105 | + * Returns an object that contains a new `CancelToken` and a function that, when called, | ||
106 | + * cancels the `CancelToken`. | ||
107 | + */ | ||
108 | +CancelToken.source = function source() { | ||
109 | + var cancel; | ||
110 | + var token = new CancelToken(function executor(c) { | ||
111 | + cancel = c; | ||
112 | + }); | ||
113 | + return { | ||
114 | + token: token, | ||
115 | + cancel: cancel | ||
116 | + }; | ||
117 | +}; | ||
118 | + | ||
119 | +module.exports = CancelToken; |
1 | +'use strict'; | ||
2 | + | ||
3 | +var AxiosError = require('../core/AxiosError'); | ||
4 | +var utils = require('../utils'); | ||
5 | + | ||
6 | +/** | ||
7 | + * A `CanceledError` is an object that is thrown when an operation is canceled. | ||
8 | + * | ||
9 | + * @class | ||
10 | + * @param {string=} message The message. | ||
11 | + */ | ||
12 | +function CanceledError(message) { | ||
13 | + // eslint-disable-next-line no-eq-null,eqeqeq | ||
14 | + AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED); | ||
15 | + this.name = 'CanceledError'; | ||
16 | +} | ||
17 | + | ||
18 | +utils.inherits(CanceledError, AxiosError, { | ||
19 | + __CANCEL__: true | ||
20 | +}); | ||
21 | + | ||
22 | +module.exports = CanceledError; |
node_modules/axios/lib/cancel/isCancel.js
0 → 100644
node_modules/axios/lib/core/Axios.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var utils = require('./../utils'); | ||
4 | +var buildURL = require('../helpers/buildURL'); | ||
5 | +var InterceptorManager = require('./InterceptorManager'); | ||
6 | +var dispatchRequest = require('./dispatchRequest'); | ||
7 | +var mergeConfig = require('./mergeConfig'); | ||
8 | +var buildFullPath = require('./buildFullPath'); | ||
9 | +var validator = require('../helpers/validator'); | ||
10 | + | ||
11 | +var validators = validator.validators; | ||
12 | +/** | ||
13 | + * Create a new instance of Axios | ||
14 | + * | ||
15 | + * @param {Object} instanceConfig The default config for the instance | ||
16 | + */ | ||
17 | +function Axios(instanceConfig) { | ||
18 | + this.defaults = instanceConfig; | ||
19 | + this.interceptors = { | ||
20 | + request: new InterceptorManager(), | ||
21 | + response: new InterceptorManager() | ||
22 | + }; | ||
23 | +} | ||
24 | + | ||
25 | +/** | ||
26 | + * Dispatch a request | ||
27 | + * | ||
28 | + * @param {Object} config The config specific for this request (merged with this.defaults) | ||
29 | + */ | ||
30 | +Axios.prototype.request = function request(configOrUrl, config) { | ||
31 | + /*eslint no-param-reassign:0*/ | ||
32 | + // Allow for axios('example/url'[, config]) a la fetch API | ||
33 | + if (typeof configOrUrl === 'string') { | ||
34 | + config = config || {}; | ||
35 | + config.url = configOrUrl; | ||
36 | + } else { | ||
37 | + config = configOrUrl || {}; | ||
38 | + } | ||
39 | + | ||
40 | + config = mergeConfig(this.defaults, config); | ||
41 | + | ||
42 | + // Set config.method | ||
43 | + if (config.method) { | ||
44 | + config.method = config.method.toLowerCase(); | ||
45 | + } else if (this.defaults.method) { | ||
46 | + config.method = this.defaults.method.toLowerCase(); | ||
47 | + } else { | ||
48 | + config.method = 'get'; | ||
49 | + } | ||
50 | + | ||
51 | + var transitional = config.transitional; | ||
52 | + | ||
53 | + if (transitional !== undefined) { | ||
54 | + validator.assertOptions(transitional, { | ||
55 | + silentJSONParsing: validators.transitional(validators.boolean), | ||
56 | + forcedJSONParsing: validators.transitional(validators.boolean), | ||
57 | + clarifyTimeoutError: validators.transitional(validators.boolean) | ||
58 | + }, false); | ||
59 | + } | ||
60 | + | ||
61 | + // filter out skipped interceptors | ||
62 | + var requestInterceptorChain = []; | ||
63 | + var synchronousRequestInterceptors = true; | ||
64 | + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { | ||
65 | + if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { | ||
66 | + return; | ||
67 | + } | ||
68 | + | ||
69 | + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; | ||
70 | + | ||
71 | + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); | ||
72 | + }); | ||
73 | + | ||
74 | + var responseInterceptorChain = []; | ||
75 | + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { | ||
76 | + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); | ||
77 | + }); | ||
78 | + | ||
79 | + var promise; | ||
80 | + | ||
81 | + if (!synchronousRequestInterceptors) { | ||
82 | + var chain = [dispatchRequest, undefined]; | ||
83 | + | ||
84 | + Array.prototype.unshift.apply(chain, requestInterceptorChain); | ||
85 | + chain = chain.concat(responseInterceptorChain); | ||
86 | + | ||
87 | + promise = Promise.resolve(config); | ||
88 | + while (chain.length) { | ||
89 | + promise = promise.then(chain.shift(), chain.shift()); | ||
90 | + } | ||
91 | + | ||
92 | + return promise; | ||
93 | + } | ||
94 | + | ||
95 | + | ||
96 | + var newConfig = config; | ||
97 | + while (requestInterceptorChain.length) { | ||
98 | + var onFulfilled = requestInterceptorChain.shift(); | ||
99 | + var onRejected = requestInterceptorChain.shift(); | ||
100 | + try { | ||
101 | + newConfig = onFulfilled(newConfig); | ||
102 | + } catch (error) { | ||
103 | + onRejected(error); | ||
104 | + break; | ||
105 | + } | ||
106 | + } | ||
107 | + | ||
108 | + try { | ||
109 | + promise = dispatchRequest(newConfig); | ||
110 | + } catch (error) { | ||
111 | + return Promise.reject(error); | ||
112 | + } | ||
113 | + | ||
114 | + while (responseInterceptorChain.length) { | ||
115 | + promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift()); | ||
116 | + } | ||
117 | + | ||
118 | + return promise; | ||
119 | +}; | ||
120 | + | ||
121 | +Axios.prototype.getUri = function getUri(config) { | ||
122 | + config = mergeConfig(this.defaults, config); | ||
123 | + var fullPath = buildFullPath(config.baseURL, config.url); | ||
124 | + return buildURL(fullPath, config.params, config.paramsSerializer); | ||
125 | +}; | ||
126 | + | ||
127 | +// Provide aliases for supported request methods | ||
128 | +utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { | ||
129 | + /*eslint func-names:0*/ | ||
130 | + Axios.prototype[method] = function(url, config) { | ||
131 | + return this.request(mergeConfig(config || {}, { | ||
132 | + method: method, | ||
133 | + url: url, | ||
134 | + data: (config || {}).data | ||
135 | + })); | ||
136 | + }; | ||
137 | +}); | ||
138 | + | ||
139 | +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { | ||
140 | + /*eslint func-names:0*/ | ||
141 | + | ||
142 | + function generateHTTPMethod(isForm) { | ||
143 | + return function httpMethod(url, data, config) { | ||
144 | + return this.request(mergeConfig(config || {}, { | ||
145 | + method: method, | ||
146 | + headers: isForm ? { | ||
147 | + 'Content-Type': 'multipart/form-data' | ||
148 | + } : {}, | ||
149 | + url: url, | ||
150 | + data: data | ||
151 | + })); | ||
152 | + }; | ||
153 | + } | ||
154 | + | ||
155 | + Axios.prototype[method] = generateHTTPMethod(); | ||
156 | + | ||
157 | + Axios.prototype[method + 'Form'] = generateHTTPMethod(true); | ||
158 | +}); | ||
159 | + | ||
160 | +module.exports = Axios; |
node_modules/axios/lib/core/AxiosError.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var utils = require('../utils'); | ||
4 | + | ||
5 | +/** | ||
6 | + * Create an Error with the specified message, config, error code, request and response. | ||
7 | + * | ||
8 | + * @param {string} message The error message. | ||
9 | + * @param {string} [code] The error code (for example, 'ECONNABORTED'). | ||
10 | + * @param {Object} [config] The config. | ||
11 | + * @param {Object} [request] The request. | ||
12 | + * @param {Object} [response] The response. | ||
13 | + * @returns {Error} The created error. | ||
14 | + */ | ||
15 | +function AxiosError(message, code, config, request, response) { | ||
16 | + Error.call(this); | ||
17 | + this.message = message; | ||
18 | + this.name = 'AxiosError'; | ||
19 | + code && (this.code = code); | ||
20 | + config && (this.config = config); | ||
21 | + request && (this.request = request); | ||
22 | + response && (this.response = response); | ||
23 | +} | ||
24 | + | ||
25 | +utils.inherits(AxiosError, Error, { | ||
26 | + toJSON: function toJSON() { | ||
27 | + return { | ||
28 | + // Standard | ||
29 | + message: this.message, | ||
30 | + name: this.name, | ||
31 | + // Microsoft | ||
32 | + description: this.description, | ||
33 | + number: this.number, | ||
34 | + // Mozilla | ||
35 | + fileName: this.fileName, | ||
36 | + lineNumber: this.lineNumber, | ||
37 | + columnNumber: this.columnNumber, | ||
38 | + stack: this.stack, | ||
39 | + // Axios | ||
40 | + config: this.config, | ||
41 | + code: this.code, | ||
42 | + status: this.response && this.response.status ? this.response.status : null | ||
43 | + }; | ||
44 | + } | ||
45 | +}); | ||
46 | + | ||
47 | +var prototype = AxiosError.prototype; | ||
48 | +var descriptors = {}; | ||
49 | + | ||
50 | +[ | ||
51 | + 'ERR_BAD_OPTION_VALUE', | ||
52 | + 'ERR_BAD_OPTION', | ||
53 | + 'ECONNABORTED', | ||
54 | + 'ETIMEDOUT', | ||
55 | + 'ERR_NETWORK', | ||
56 | + 'ERR_FR_TOO_MANY_REDIRECTS', | ||
57 | + 'ERR_DEPRECATED', | ||
58 | + 'ERR_BAD_RESPONSE', | ||
59 | + 'ERR_BAD_REQUEST', | ||
60 | + 'ERR_CANCELED' | ||
61 | +// eslint-disable-next-line func-names | ||
62 | +].forEach(function(code) { | ||
63 | + descriptors[code] = {value: code}; | ||
64 | +}); | ||
65 | + | ||
66 | +Object.defineProperties(AxiosError, descriptors); | ||
67 | +Object.defineProperty(prototype, 'isAxiosError', {value: true}); | ||
68 | + | ||
69 | +// eslint-disable-next-line func-names | ||
70 | +AxiosError.from = function(error, code, config, request, response, customProps) { | ||
71 | + var axiosError = Object.create(prototype); | ||
72 | + | ||
73 | + utils.toFlatObject(error, axiosError, function filter(obj) { | ||
74 | + return obj !== Error.prototype; | ||
75 | + }); | ||
76 | + | ||
77 | + AxiosError.call(axiosError, error.message, code, config, request, response); | ||
78 | + | ||
79 | + axiosError.name = error.name; | ||
80 | + | ||
81 | + customProps && Object.assign(axiosError, customProps); | ||
82 | + | ||
83 | + return axiosError; | ||
84 | +}; | ||
85 | + | ||
86 | +module.exports = AxiosError; |
1 | +'use strict'; | ||
2 | + | ||
3 | +var utils = require('./../utils'); | ||
4 | + | ||
5 | +function InterceptorManager() { | ||
6 | + this.handlers = []; | ||
7 | +} | ||
8 | + | ||
9 | +/** | ||
10 | + * Add a new interceptor to the stack | ||
11 | + * | ||
12 | + * @param {Function} fulfilled The function to handle `then` for a `Promise` | ||
13 | + * @param {Function} rejected The function to handle `reject` for a `Promise` | ||
14 | + * | ||
15 | + * @return {Number} An ID used to remove interceptor later | ||
16 | + */ | ||
17 | +InterceptorManager.prototype.use = function use(fulfilled, rejected, options) { | ||
18 | + this.handlers.push({ | ||
19 | + fulfilled: fulfilled, | ||
20 | + rejected: rejected, | ||
21 | + synchronous: options ? options.synchronous : false, | ||
22 | + runWhen: options ? options.runWhen : null | ||
23 | + }); | ||
24 | + return this.handlers.length - 1; | ||
25 | +}; | ||
26 | + | ||
27 | +/** | ||
28 | + * Remove an interceptor from the stack | ||
29 | + * | ||
30 | + * @param {Number} id The ID that was returned by `use` | ||
31 | + */ | ||
32 | +InterceptorManager.prototype.eject = function eject(id) { | ||
33 | + if (this.handlers[id]) { | ||
34 | + this.handlers[id] = null; | ||
35 | + } | ||
36 | +}; | ||
37 | + | ||
38 | +/** | ||
39 | + * Iterate over all the registered interceptors | ||
40 | + * | ||
41 | + * This method is particularly useful for skipping over any | ||
42 | + * interceptors that may have become `null` calling `eject`. | ||
43 | + * | ||
44 | + * @param {Function} fn The function to call for each interceptor | ||
45 | + */ | ||
46 | +InterceptorManager.prototype.forEach = function forEach(fn) { | ||
47 | + utils.forEach(this.handlers, function forEachHandler(h) { | ||
48 | + if (h !== null) { | ||
49 | + fn(h); | ||
50 | + } | ||
51 | + }); | ||
52 | +}; | ||
53 | + | ||
54 | +module.exports = InterceptorManager; |
node_modules/axios/lib/core/README.md
0 → 100644
1 | +# axios // core | ||
2 | + | ||
3 | +The modules found in `core/` should be modules that are specific to the domain logic of axios. These modules would most likely not make sense to be consumed outside of the axios module, as their logic is too specific. Some examples of core modules are: | ||
4 | + | ||
5 | +- Dispatching requests | ||
6 | + - Requests sent via `adapters/` (see lib/adapters/README.md) | ||
7 | +- Managing interceptors | ||
8 | +- Handling config |
node_modules/axios/lib/core/buildFullPath.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var isAbsoluteURL = require('../helpers/isAbsoluteURL'); | ||
4 | +var combineURLs = require('../helpers/combineURLs'); | ||
5 | + | ||
6 | +/** | ||
7 | + * Creates a new URL by combining the baseURL with the requestedURL, | ||
8 | + * only when the requestedURL is not already an absolute URL. | ||
9 | + * If the requestURL is absolute, this function returns the requestedURL untouched. | ||
10 | + * | ||
11 | + * @param {string} baseURL The base URL | ||
12 | + * @param {string} requestedURL Absolute or relative URL to combine | ||
13 | + * @returns {string} The combined full path | ||
14 | + */ | ||
15 | +module.exports = function buildFullPath(baseURL, requestedURL) { | ||
16 | + if (baseURL && !isAbsoluteURL(requestedURL)) { | ||
17 | + return combineURLs(baseURL, requestedURL); | ||
18 | + } | ||
19 | + return requestedURL; | ||
20 | +}; |
1 | +'use strict'; | ||
2 | + | ||
3 | +var utils = require('./../utils'); | ||
4 | +var transformData = require('./transformData'); | ||
5 | +var isCancel = require('../cancel/isCancel'); | ||
6 | +var defaults = require('../defaults'); | ||
7 | +var CanceledError = require('../cancel/CanceledError'); | ||
8 | + | ||
9 | +/** | ||
10 | + * Throws a `CanceledError` if cancellation has been requested. | ||
11 | + */ | ||
12 | +function throwIfCancellationRequested(config) { | ||
13 | + if (config.cancelToken) { | ||
14 | + config.cancelToken.throwIfRequested(); | ||
15 | + } | ||
16 | + | ||
17 | + if (config.signal && config.signal.aborted) { | ||
18 | + throw new CanceledError(); | ||
19 | + } | ||
20 | +} | ||
21 | + | ||
22 | +/** | ||
23 | + * Dispatch a request to the server using the configured adapter. | ||
24 | + * | ||
25 | + * @param {object} config The config that is to be used for the request | ||
26 | + * @returns {Promise} The Promise to be fulfilled | ||
27 | + */ | ||
28 | +module.exports = function dispatchRequest(config) { | ||
29 | + throwIfCancellationRequested(config); | ||
30 | + | ||
31 | + // Ensure headers exist | ||
32 | + config.headers = config.headers || {}; | ||
33 | + | ||
34 | + // Transform request data | ||
35 | + config.data = transformData.call( | ||
36 | + config, | ||
37 | + config.data, | ||
38 | + config.headers, | ||
39 | + config.transformRequest | ||
40 | + ); | ||
41 | + | ||
42 | + // Flatten headers | ||
43 | + config.headers = utils.merge( | ||
44 | + config.headers.common || {}, | ||
45 | + config.headers[config.method] || {}, | ||
46 | + config.headers | ||
47 | + ); | ||
48 | + | ||
49 | + utils.forEach( | ||
50 | + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], | ||
51 | + function cleanHeaderConfig(method) { | ||
52 | + delete config.headers[method]; | ||
53 | + } | ||
54 | + ); | ||
55 | + | ||
56 | + var adapter = config.adapter || defaults.adapter; | ||
57 | + | ||
58 | + return adapter(config).then(function onAdapterResolution(response) { | ||
59 | + throwIfCancellationRequested(config); | ||
60 | + | ||
61 | + // Transform response data | ||
62 | + response.data = transformData.call( | ||
63 | + config, | ||
64 | + response.data, | ||
65 | + response.headers, | ||
66 | + config.transformResponse | ||
67 | + ); | ||
68 | + | ||
69 | + return response; | ||
70 | + }, function onAdapterRejection(reason) { | ||
71 | + if (!isCancel(reason)) { | ||
72 | + throwIfCancellationRequested(config); | ||
73 | + | ||
74 | + // Transform response data | ||
75 | + if (reason && reason.response) { | ||
76 | + reason.response.data = transformData.call( | ||
77 | + config, | ||
78 | + reason.response.data, | ||
79 | + reason.response.headers, | ||
80 | + config.transformResponse | ||
81 | + ); | ||
82 | + } | ||
83 | + } | ||
84 | + | ||
85 | + return Promise.reject(reason); | ||
86 | + }); | ||
87 | +}; |
node_modules/axios/lib/core/mergeConfig.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var utils = require('../utils'); | ||
4 | + | ||
5 | +/** | ||
6 | + * Config-specific merge-function which creates a new config-object | ||
7 | + * by merging two configuration objects together. | ||
8 | + * | ||
9 | + * @param {Object} config1 | ||
10 | + * @param {Object} config2 | ||
11 | + * @returns {Object} New object resulting from merging config2 to config1 | ||
12 | + */ | ||
13 | +module.exports = function mergeConfig(config1, config2) { | ||
14 | + // eslint-disable-next-line no-param-reassign | ||
15 | + config2 = config2 || {}; | ||
16 | + var config = {}; | ||
17 | + | ||
18 | + function getMergedValue(target, source) { | ||
19 | + if (utils.isPlainObject(target) && utils.isPlainObject(source)) { | ||
20 | + return utils.merge(target, source); | ||
21 | + } else if (utils.isPlainObject(source)) { | ||
22 | + return utils.merge({}, source); | ||
23 | + } else if (utils.isArray(source)) { | ||
24 | + return source.slice(); | ||
25 | + } | ||
26 | + return source; | ||
27 | + } | ||
28 | + | ||
29 | + // eslint-disable-next-line consistent-return | ||
30 | + function mergeDeepProperties(prop) { | ||
31 | + if (!utils.isUndefined(config2[prop])) { | ||
32 | + return getMergedValue(config1[prop], config2[prop]); | ||
33 | + } else if (!utils.isUndefined(config1[prop])) { | ||
34 | + return getMergedValue(undefined, config1[prop]); | ||
35 | + } | ||
36 | + } | ||
37 | + | ||
38 | + // eslint-disable-next-line consistent-return | ||
39 | + function valueFromConfig2(prop) { | ||
40 | + if (!utils.isUndefined(config2[prop])) { | ||
41 | + return getMergedValue(undefined, config2[prop]); | ||
42 | + } | ||
43 | + } | ||
44 | + | ||
45 | + // eslint-disable-next-line consistent-return | ||
46 | + function defaultToConfig2(prop) { | ||
47 | + if (!utils.isUndefined(config2[prop])) { | ||
48 | + return getMergedValue(undefined, config2[prop]); | ||
49 | + } else if (!utils.isUndefined(config1[prop])) { | ||
50 | + return getMergedValue(undefined, config1[prop]); | ||
51 | + } | ||
52 | + } | ||
53 | + | ||
54 | + // eslint-disable-next-line consistent-return | ||
55 | + function mergeDirectKeys(prop) { | ||
56 | + if (prop in config2) { | ||
57 | + return getMergedValue(config1[prop], config2[prop]); | ||
58 | + } else if (prop in config1) { | ||
59 | + return getMergedValue(undefined, config1[prop]); | ||
60 | + } | ||
61 | + } | ||
62 | + | ||
63 | + var mergeMap = { | ||
64 | + 'url': valueFromConfig2, | ||
65 | + 'method': valueFromConfig2, | ||
66 | + 'data': valueFromConfig2, | ||
67 | + 'baseURL': defaultToConfig2, | ||
68 | + 'transformRequest': defaultToConfig2, | ||
69 | + 'transformResponse': defaultToConfig2, | ||
70 | + 'paramsSerializer': defaultToConfig2, | ||
71 | + 'timeout': defaultToConfig2, | ||
72 | + 'timeoutMessage': defaultToConfig2, | ||
73 | + 'withCredentials': defaultToConfig2, | ||
74 | + 'adapter': defaultToConfig2, | ||
75 | + 'responseType': defaultToConfig2, | ||
76 | + 'xsrfCookieName': defaultToConfig2, | ||
77 | + 'xsrfHeaderName': defaultToConfig2, | ||
78 | + 'onUploadProgress': defaultToConfig2, | ||
79 | + 'onDownloadProgress': defaultToConfig2, | ||
80 | + 'decompress': defaultToConfig2, | ||
81 | + 'maxContentLength': defaultToConfig2, | ||
82 | + 'maxBodyLength': defaultToConfig2, | ||
83 | + 'beforeRedirect': defaultToConfig2, | ||
84 | + 'transport': defaultToConfig2, | ||
85 | + 'httpAgent': defaultToConfig2, | ||
86 | + 'httpsAgent': defaultToConfig2, | ||
87 | + 'cancelToken': defaultToConfig2, | ||
88 | + 'socketPath': defaultToConfig2, | ||
89 | + 'responseEncoding': defaultToConfig2, | ||
90 | + 'validateStatus': mergeDirectKeys | ||
91 | + }; | ||
92 | + | ||
93 | + utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) { | ||
94 | + var merge = mergeMap[prop] || mergeDeepProperties; | ||
95 | + var configValue = merge(prop); | ||
96 | + (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue); | ||
97 | + }); | ||
98 | + | ||
99 | + return config; | ||
100 | +}; |
node_modules/axios/lib/core/settle.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var AxiosError = require('./AxiosError'); | ||
4 | + | ||
5 | +/** | ||
6 | + * Resolve or reject a Promise based on response status. | ||
7 | + * | ||
8 | + * @param {Function} resolve A function that resolves the promise. | ||
9 | + * @param {Function} reject A function that rejects the promise. | ||
10 | + * @param {object} response The response. | ||
11 | + */ | ||
12 | +module.exports = function settle(resolve, reject, response) { | ||
13 | + var validateStatus = response.config.validateStatus; | ||
14 | + if (!response.status || !validateStatus || validateStatus(response.status)) { | ||
15 | + resolve(response); | ||
16 | + } else { | ||
17 | + reject(new AxiosError( | ||
18 | + 'Request failed with status code ' + response.status, | ||
19 | + [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], | ||
20 | + response.config, | ||
21 | + response.request, | ||
22 | + response | ||
23 | + )); | ||
24 | + } | ||
25 | +}; |
node_modules/axios/lib/core/transformData.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var utils = require('./../utils'); | ||
4 | +var defaults = require('../defaults'); | ||
5 | + | ||
6 | +/** | ||
7 | + * Transform the data for a request or a response | ||
8 | + * | ||
9 | + * @param {Object|String} data The data to be transformed | ||
10 | + * @param {Array} headers The headers for the request or response | ||
11 | + * @param {Array|Function} fns A single function or Array of functions | ||
12 | + * @returns {*} The resulting transformed data | ||
13 | + */ | ||
14 | +module.exports = function transformData(data, headers, fns) { | ||
15 | + var context = this || defaults; | ||
16 | + /*eslint no-param-reassign:0*/ | ||
17 | + utils.forEach(fns, function transform(fn) { | ||
18 | + data = fn.call(context, data, headers); | ||
19 | + }); | ||
20 | + | ||
21 | + return data; | ||
22 | +}; |
node_modules/axios/lib/defaults/index.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var utils = require('../utils'); | ||
4 | +var normalizeHeaderName = require('../helpers/normalizeHeaderName'); | ||
5 | +var AxiosError = require('../core/AxiosError'); | ||
6 | +var transitionalDefaults = require('./transitional'); | ||
7 | +var toFormData = require('../helpers/toFormData'); | ||
8 | + | ||
9 | +var DEFAULT_CONTENT_TYPE = { | ||
10 | + 'Content-Type': 'application/x-www-form-urlencoded' | ||
11 | +}; | ||
12 | + | ||
13 | +function setContentTypeIfUnset(headers, value) { | ||
14 | + if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { | ||
15 | + headers['Content-Type'] = value; | ||
16 | + } | ||
17 | +} | ||
18 | + | ||
19 | +function getDefaultAdapter() { | ||
20 | + var adapter; | ||
21 | + if (typeof XMLHttpRequest !== 'undefined') { | ||
22 | + // For browsers use XHR adapter | ||
23 | + adapter = require('../adapters/xhr'); | ||
24 | + } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { | ||
25 | + // For node use HTTP adapter | ||
26 | + adapter = require('../adapters/http'); | ||
27 | + } | ||
28 | + return adapter; | ||
29 | +} | ||
30 | + | ||
31 | +function stringifySafely(rawValue, parser, encoder) { | ||
32 | + if (utils.isString(rawValue)) { | ||
33 | + try { | ||
34 | + (parser || JSON.parse)(rawValue); | ||
35 | + return utils.trim(rawValue); | ||
36 | + } catch (e) { | ||
37 | + if (e.name !== 'SyntaxError') { | ||
38 | + throw e; | ||
39 | + } | ||
40 | + } | ||
41 | + } | ||
42 | + | ||
43 | + return (encoder || JSON.stringify)(rawValue); | ||
44 | +} | ||
45 | + | ||
46 | +var defaults = { | ||
47 | + | ||
48 | + transitional: transitionalDefaults, | ||
49 | + | ||
50 | + adapter: getDefaultAdapter(), | ||
51 | + | ||
52 | + transformRequest: [function transformRequest(data, headers) { | ||
53 | + normalizeHeaderName(headers, 'Accept'); | ||
54 | + normalizeHeaderName(headers, 'Content-Type'); | ||
55 | + | ||
56 | + if (utils.isFormData(data) || | ||
57 | + utils.isArrayBuffer(data) || | ||
58 | + utils.isBuffer(data) || | ||
59 | + utils.isStream(data) || | ||
60 | + utils.isFile(data) || | ||
61 | + utils.isBlob(data) | ||
62 | + ) { | ||
63 | + return data; | ||
64 | + } | ||
65 | + if (utils.isArrayBufferView(data)) { | ||
66 | + return data.buffer; | ||
67 | + } | ||
68 | + if (utils.isURLSearchParams(data)) { | ||
69 | + setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); | ||
70 | + return data.toString(); | ||
71 | + } | ||
72 | + | ||
73 | + var isObjectPayload = utils.isObject(data); | ||
74 | + var contentType = headers && headers['Content-Type']; | ||
75 | + | ||
76 | + var isFileList; | ||
77 | + | ||
78 | + if ((isFileList = utils.isFileList(data)) || (isObjectPayload && contentType === 'multipart/form-data')) { | ||
79 | + var _FormData = this.env && this.env.FormData; | ||
80 | + return toFormData(isFileList ? {'files[]': data} : data, _FormData && new _FormData()); | ||
81 | + } else if (isObjectPayload || contentType === 'application/json') { | ||
82 | + setContentTypeIfUnset(headers, 'application/json'); | ||
83 | + return stringifySafely(data); | ||
84 | + } | ||
85 | + | ||
86 | + return data; | ||
87 | + }], | ||
88 | + | ||
89 | + transformResponse: [function transformResponse(data) { | ||
90 | + var transitional = this.transitional || defaults.transitional; | ||
91 | + var silentJSONParsing = transitional && transitional.silentJSONParsing; | ||
92 | + var forcedJSONParsing = transitional && transitional.forcedJSONParsing; | ||
93 | + var strictJSONParsing = !silentJSONParsing && this.responseType === 'json'; | ||
94 | + | ||
95 | + if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) { | ||
96 | + try { | ||
97 | + return JSON.parse(data); | ||
98 | + } catch (e) { | ||
99 | + if (strictJSONParsing) { | ||
100 | + if (e.name === 'SyntaxError') { | ||
101 | + throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response); | ||
102 | + } | ||
103 | + throw e; | ||
104 | + } | ||
105 | + } | ||
106 | + } | ||
107 | + | ||
108 | + return data; | ||
109 | + }], | ||
110 | + | ||
111 | + /** | ||
112 | + * A timeout in milliseconds to abort a request. If set to 0 (default) a | ||
113 | + * timeout is not created. | ||
114 | + */ | ||
115 | + timeout: 0, | ||
116 | + | ||
117 | + xsrfCookieName: 'XSRF-TOKEN', | ||
118 | + xsrfHeaderName: 'X-XSRF-TOKEN', | ||
119 | + | ||
120 | + maxContentLength: -1, | ||
121 | + maxBodyLength: -1, | ||
122 | + | ||
123 | + env: { | ||
124 | + FormData: require('./env/FormData') | ||
125 | + }, | ||
126 | + | ||
127 | + validateStatus: function validateStatus(status) { | ||
128 | + return status >= 200 && status < 300; | ||
129 | + }, | ||
130 | + | ||
131 | + headers: { | ||
132 | + common: { | ||
133 | + 'Accept': 'application/json, text/plain, */*' | ||
134 | + } | ||
135 | + } | ||
136 | +}; | ||
137 | + | ||
138 | +utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { | ||
139 | + defaults.headers[method] = {}; | ||
140 | +}); | ||
141 | + | ||
142 | +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { | ||
143 | + defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); | ||
144 | +}); | ||
145 | + | ||
146 | +module.exports = defaults; |
node_modules/axios/lib/env/README.md
0 → 100644
node_modules/axios/lib/env/data.js
0 → 100644
node_modules/axios/lib/helpers/README.md
0 → 100644
1 | +# axios // helpers | ||
2 | + | ||
3 | +The modules found in `helpers/` should be generic modules that are _not_ specific to the domain logic of axios. These modules could theoretically be published to npm on their own and consumed by other modules or apps. Some examples of generic modules are things like: | ||
4 | + | ||
5 | +- Browser polyfills | ||
6 | +- Managing cookies | ||
7 | +- Parsing HTTP headers |
node_modules/axios/lib/helpers/bind.js
0 → 100644
node_modules/axios/lib/helpers/buildURL.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var utils = require('./../utils'); | ||
4 | + | ||
5 | +function encode(val) { | ||
6 | + return encodeURIComponent(val). | ||
7 | + replace(/%3A/gi, ':'). | ||
8 | + replace(/%24/g, '$'). | ||
9 | + replace(/%2C/gi, ','). | ||
10 | + replace(/%20/g, '+'). | ||
11 | + replace(/%5B/gi, '['). | ||
12 | + replace(/%5D/gi, ']'); | ||
13 | +} | ||
14 | + | ||
15 | +/** | ||
16 | + * Build a URL by appending params to the end | ||
17 | + * | ||
18 | + * @param {string} url The base of the url (e.g., http://www.google.com) | ||
19 | + * @param {object} [params] The params to be appended | ||
20 | + * @returns {string} The formatted url | ||
21 | + */ | ||
22 | +module.exports = function buildURL(url, params, paramsSerializer) { | ||
23 | + /*eslint no-param-reassign:0*/ | ||
24 | + if (!params) { | ||
25 | + return url; | ||
26 | + } | ||
27 | + | ||
28 | + var serializedParams; | ||
29 | + if (paramsSerializer) { | ||
30 | + serializedParams = paramsSerializer(params); | ||
31 | + } else if (utils.isURLSearchParams(params)) { | ||
32 | + serializedParams = params.toString(); | ||
33 | + } else { | ||
34 | + var parts = []; | ||
35 | + | ||
36 | + utils.forEach(params, function serialize(val, key) { | ||
37 | + if (val === null || typeof val === 'undefined') { | ||
38 | + return; | ||
39 | + } | ||
40 | + | ||
41 | + if (utils.isArray(val)) { | ||
42 | + key = key + '[]'; | ||
43 | + } else { | ||
44 | + val = [val]; | ||
45 | + } | ||
46 | + | ||
47 | + utils.forEach(val, function parseValue(v) { | ||
48 | + if (utils.isDate(v)) { | ||
49 | + v = v.toISOString(); | ||
50 | + } else if (utils.isObject(v)) { | ||
51 | + v = JSON.stringify(v); | ||
52 | + } | ||
53 | + parts.push(encode(key) + '=' + encode(v)); | ||
54 | + }); | ||
55 | + }); | ||
56 | + | ||
57 | + serializedParams = parts.join('&'); | ||
58 | + } | ||
59 | + | ||
60 | + if (serializedParams) { | ||
61 | + var hashmarkIndex = url.indexOf('#'); | ||
62 | + if (hashmarkIndex !== -1) { | ||
63 | + url = url.slice(0, hashmarkIndex); | ||
64 | + } | ||
65 | + | ||
66 | + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; | ||
67 | + } | ||
68 | + | ||
69 | + return url; | ||
70 | +}; |
1 | +'use strict'; | ||
2 | + | ||
3 | +/** | ||
4 | + * Creates a new URL by combining the specified URLs | ||
5 | + * | ||
6 | + * @param {string} baseURL The base URL | ||
7 | + * @param {string} relativeURL The relative URL | ||
8 | + * @returns {string} The combined URL | ||
9 | + */ | ||
10 | +module.exports = function combineURLs(baseURL, relativeURL) { | ||
11 | + return relativeURL | ||
12 | + ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') | ||
13 | + : baseURL; | ||
14 | +}; |
node_modules/axios/lib/helpers/cookies.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var utils = require('./../utils'); | ||
4 | + | ||
5 | +module.exports = ( | ||
6 | + utils.isStandardBrowserEnv() ? | ||
7 | + | ||
8 | + // Standard browser envs support document.cookie | ||
9 | + (function standardBrowserEnv() { | ||
10 | + return { | ||
11 | + write: function write(name, value, expires, path, domain, secure) { | ||
12 | + var cookie = []; | ||
13 | + cookie.push(name + '=' + encodeURIComponent(value)); | ||
14 | + | ||
15 | + if (utils.isNumber(expires)) { | ||
16 | + cookie.push('expires=' + new Date(expires).toGMTString()); | ||
17 | + } | ||
18 | + | ||
19 | + if (utils.isString(path)) { | ||
20 | + cookie.push('path=' + path); | ||
21 | + } | ||
22 | + | ||
23 | + if (utils.isString(domain)) { | ||
24 | + cookie.push('domain=' + domain); | ||
25 | + } | ||
26 | + | ||
27 | + if (secure === true) { | ||
28 | + cookie.push('secure'); | ||
29 | + } | ||
30 | + | ||
31 | + document.cookie = cookie.join('; '); | ||
32 | + }, | ||
33 | + | ||
34 | + read: function read(name) { | ||
35 | + var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); | ||
36 | + return (match ? decodeURIComponent(match[3]) : null); | ||
37 | + }, | ||
38 | + | ||
39 | + remove: function remove(name) { | ||
40 | + this.write(name, '', Date.now() - 86400000); | ||
41 | + } | ||
42 | + }; | ||
43 | + })() : | ||
44 | + | ||
45 | + // Non standard browser env (web workers, react-native) lack needed support. | ||
46 | + (function nonStandardBrowserEnv() { | ||
47 | + return { | ||
48 | + write: function write() {}, | ||
49 | + read: function read() { return null; }, | ||
50 | + remove: function remove() {} | ||
51 | + }; | ||
52 | + })() | ||
53 | +); |
1 | +'use strict'; | ||
2 | + | ||
3 | +/*eslint no-console:0*/ | ||
4 | + | ||
5 | +/** | ||
6 | + * Supply a warning to the developer that a method they are using | ||
7 | + * has been deprecated. | ||
8 | + * | ||
9 | + * @param {string} method The name of the deprecated method | ||
10 | + * @param {string} [instead] The alternate method to use if applicable | ||
11 | + * @param {string} [docs] The documentation URL to get further details | ||
12 | + */ | ||
13 | +module.exports = function deprecatedMethod(method, instead, docs) { | ||
14 | + try { | ||
15 | + console.warn( | ||
16 | + 'DEPRECATED method `' + method + '`.' + | ||
17 | + (instead ? ' Use `' + instead + '` instead.' : '') + | ||
18 | + ' This method will be removed in a future release.'); | ||
19 | + | ||
20 | + if (docs) { | ||
21 | + console.warn('For more information about usage see ' + docs); | ||
22 | + } | ||
23 | + } catch (e) { /* Ignore */ } | ||
24 | +}; |
1 | +'use strict'; | ||
2 | + | ||
3 | +/** | ||
4 | + * Determines whether the specified URL is absolute | ||
5 | + * | ||
6 | + * @param {string} url The URL to test | ||
7 | + * @returns {boolean} True if the specified URL is absolute, otherwise false | ||
8 | + */ | ||
9 | +module.exports = function isAbsoluteURL(url) { | ||
10 | + // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL). | ||
11 | + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed | ||
12 | + // by any combination of letters, digits, plus, period, or hyphen. | ||
13 | + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); | ||
14 | +}; |
1 | +'use strict'; | ||
2 | + | ||
3 | +var utils = require('./../utils'); | ||
4 | + | ||
5 | +/** | ||
6 | + * Determines whether the payload is an error thrown by Axios | ||
7 | + * | ||
8 | + * @param {*} payload The value to test | ||
9 | + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false | ||
10 | + */ | ||
11 | +module.exports = function isAxiosError(payload) { | ||
12 | + return utils.isObject(payload) && (payload.isAxiosError === true); | ||
13 | +}; |
1 | +'use strict'; | ||
2 | + | ||
3 | +var utils = require('./../utils'); | ||
4 | + | ||
5 | +module.exports = ( | ||
6 | + utils.isStandardBrowserEnv() ? | ||
7 | + | ||
8 | + // Standard browser envs have full support of the APIs needed to test | ||
9 | + // whether the request URL is of the same origin as current location. | ||
10 | + (function standardBrowserEnv() { | ||
11 | + var msie = /(msie|trident)/i.test(navigator.userAgent); | ||
12 | + var urlParsingNode = document.createElement('a'); | ||
13 | + var originURL; | ||
14 | + | ||
15 | + /** | ||
16 | + * Parse a URL to discover it's components | ||
17 | + * | ||
18 | + * @param {String} url The URL to be parsed | ||
19 | + * @returns {Object} | ||
20 | + */ | ||
21 | + function resolveURL(url) { | ||
22 | + var href = url; | ||
23 | + | ||
24 | + if (msie) { | ||
25 | + // IE needs attribute set twice to normalize properties | ||
26 | + urlParsingNode.setAttribute('href', href); | ||
27 | + href = urlParsingNode.href; | ||
28 | + } | ||
29 | + | ||
30 | + urlParsingNode.setAttribute('href', href); | ||
31 | + | ||
32 | + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils | ||
33 | + return { | ||
34 | + href: urlParsingNode.href, | ||
35 | + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', | ||
36 | + host: urlParsingNode.host, | ||
37 | + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', | ||
38 | + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', | ||
39 | + hostname: urlParsingNode.hostname, | ||
40 | + port: urlParsingNode.port, | ||
41 | + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? | ||
42 | + urlParsingNode.pathname : | ||
43 | + '/' + urlParsingNode.pathname | ||
44 | + }; | ||
45 | + } | ||
46 | + | ||
47 | + originURL = resolveURL(window.location.href); | ||
48 | + | ||
49 | + /** | ||
50 | + * Determine if a URL shares the same origin as the current location | ||
51 | + * | ||
52 | + * @param {String} requestURL The URL to test | ||
53 | + * @returns {boolean} True if URL shares the same origin, otherwise false | ||
54 | + */ | ||
55 | + return function isURLSameOrigin(requestURL) { | ||
56 | + var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; | ||
57 | + return (parsed.protocol === originURL.protocol && | ||
58 | + parsed.host === originURL.host); | ||
59 | + }; | ||
60 | + })() : | ||
61 | + | ||
62 | + // Non standard browser envs (web workers, react-native) lack needed support. | ||
63 | + (function nonStandardBrowserEnv() { | ||
64 | + return function isURLSameOrigin() { | ||
65 | + return true; | ||
66 | + }; | ||
67 | + })() | ||
68 | +); |
1 | +'use strict'; | ||
2 | + | ||
3 | +var utils = require('../utils'); | ||
4 | + | ||
5 | +module.exports = function normalizeHeaderName(headers, normalizedName) { | ||
6 | + utils.forEach(headers, function processHeader(value, name) { | ||
7 | + if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { | ||
8 | + headers[normalizedName] = value; | ||
9 | + delete headers[name]; | ||
10 | + } | ||
11 | + }); | ||
12 | +}; |
node_modules/axios/lib/helpers/null.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var utils = require('./../utils'); | ||
4 | + | ||
5 | +// Headers whose duplicates are ignored by node | ||
6 | +// c.f. https://nodejs.org/api/http.html#http_message_headers | ||
7 | +var ignoreDuplicateOf = [ | ||
8 | + 'age', 'authorization', 'content-length', 'content-type', 'etag', | ||
9 | + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', | ||
10 | + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', | ||
11 | + 'referer', 'retry-after', 'user-agent' | ||
12 | +]; | ||
13 | + | ||
14 | +/** | ||
15 | + * Parse headers into an object | ||
16 | + * | ||
17 | + * ``` | ||
18 | + * Date: Wed, 27 Aug 2014 08:58:49 GMT | ||
19 | + * Content-Type: application/json | ||
20 | + * Connection: keep-alive | ||
21 | + * Transfer-Encoding: chunked | ||
22 | + * ``` | ||
23 | + * | ||
24 | + * @param {String} headers Headers needing to be parsed | ||
25 | + * @returns {Object} Headers parsed into an object | ||
26 | + */ | ||
27 | +module.exports = function parseHeaders(headers) { | ||
28 | + var parsed = {}; | ||
29 | + var key; | ||
30 | + var val; | ||
31 | + var i; | ||
32 | + | ||
33 | + if (!headers) { return parsed; } | ||
34 | + | ||
35 | + utils.forEach(headers.split('\n'), function parser(line) { | ||
36 | + i = line.indexOf(':'); | ||
37 | + key = utils.trim(line.substr(0, i)).toLowerCase(); | ||
38 | + val = utils.trim(line.substr(i + 1)); | ||
39 | + | ||
40 | + if (key) { | ||
41 | + if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { | ||
42 | + return; | ||
43 | + } | ||
44 | + if (key === 'set-cookie') { | ||
45 | + parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); | ||
46 | + } else { | ||
47 | + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; | ||
48 | + } | ||
49 | + } | ||
50 | + }); | ||
51 | + | ||
52 | + return parsed; | ||
53 | +}; |
node_modules/axios/lib/helpers/spread.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +/** | ||
4 | + * Syntactic sugar for invoking a function and expanding an array for arguments. | ||
5 | + * | ||
6 | + * Common use case would be to use `Function.prototype.apply`. | ||
7 | + * | ||
8 | + * ```js | ||
9 | + * function f(x, y, z) {} | ||
10 | + * var args = [1, 2, 3]; | ||
11 | + * f.apply(null, args); | ||
12 | + * ``` | ||
13 | + * | ||
14 | + * With `spread` this example can be re-written. | ||
15 | + * | ||
16 | + * ```js | ||
17 | + * spread(function(x, y, z) {})([1, 2, 3]); | ||
18 | + * ``` | ||
19 | + * | ||
20 | + * @param {Function} callback | ||
21 | + * @returns {Function} | ||
22 | + */ | ||
23 | +module.exports = function spread(callback) { | ||
24 | + return function wrap(arr) { | ||
25 | + return callback.apply(null, arr); | ||
26 | + }; | ||
27 | +}; |
node_modules/axios/lib/helpers/toFormData.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var utils = require('../utils'); | ||
4 | + | ||
5 | +/** | ||
6 | + * Convert a data object to FormData | ||
7 | + * @param {Object} obj | ||
8 | + * @param {?Object} [formData] | ||
9 | + * @returns {Object} | ||
10 | + **/ | ||
11 | + | ||
12 | +function toFormData(obj, formData) { | ||
13 | + // eslint-disable-next-line no-param-reassign | ||
14 | + formData = formData || new FormData(); | ||
15 | + | ||
16 | + var stack = []; | ||
17 | + | ||
18 | + function convertValue(value) { | ||
19 | + if (value === null) return ''; | ||
20 | + | ||
21 | + if (utils.isDate(value)) { | ||
22 | + return value.toISOString(); | ||
23 | + } | ||
24 | + | ||
25 | + if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) { | ||
26 | + return typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); | ||
27 | + } | ||
28 | + | ||
29 | + return value; | ||
30 | + } | ||
31 | + | ||
32 | + function build(data, parentKey) { | ||
33 | + if (utils.isPlainObject(data) || utils.isArray(data)) { | ||
34 | + if (stack.indexOf(data) !== -1) { | ||
35 | + throw Error('Circular reference detected in ' + parentKey); | ||
36 | + } | ||
37 | + | ||
38 | + stack.push(data); | ||
39 | + | ||
40 | + utils.forEach(data, function each(value, key) { | ||
41 | + if (utils.isUndefined(value)) return; | ||
42 | + var fullKey = parentKey ? parentKey + '.' + key : key; | ||
43 | + var arr; | ||
44 | + | ||
45 | + if (value && !parentKey && typeof value === 'object') { | ||
46 | + if (utils.endsWith(key, '{}')) { | ||
47 | + // eslint-disable-next-line no-param-reassign | ||
48 | + value = JSON.stringify(value); | ||
49 | + } else if (utils.endsWith(key, '[]') && (arr = utils.toArray(value))) { | ||
50 | + // eslint-disable-next-line func-names | ||
51 | + arr.forEach(function(el) { | ||
52 | + !utils.isUndefined(el) && formData.append(fullKey, convertValue(el)); | ||
53 | + }); | ||
54 | + return; | ||
55 | + } | ||
56 | + } | ||
57 | + | ||
58 | + build(value, fullKey); | ||
59 | + }); | ||
60 | + | ||
61 | + stack.pop(); | ||
62 | + } else { | ||
63 | + formData.append(parentKey, convertValue(data)); | ||
64 | + } | ||
65 | + } | ||
66 | + | ||
67 | + build(obj); | ||
68 | + | ||
69 | + return formData; | ||
70 | +} | ||
71 | + | ||
72 | +module.exports = toFormData; |
node_modules/axios/lib/helpers/validator.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var VERSION = require('../env/data').version; | ||
4 | +var AxiosError = require('../core/AxiosError'); | ||
5 | + | ||
6 | +var validators = {}; | ||
7 | + | ||
8 | +// eslint-disable-next-line func-names | ||
9 | +['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) { | ||
10 | + validators[type] = function validator(thing) { | ||
11 | + return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; | ||
12 | + }; | ||
13 | +}); | ||
14 | + | ||
15 | +var deprecatedWarnings = {}; | ||
16 | + | ||
17 | +/** | ||
18 | + * Transitional option validator | ||
19 | + * @param {function|boolean?} validator - set to false if the transitional option has been removed | ||
20 | + * @param {string?} version - deprecated version / removed since version | ||
21 | + * @param {string?} message - some message with additional info | ||
22 | + * @returns {function} | ||
23 | + */ | ||
24 | +validators.transitional = function transitional(validator, version, message) { | ||
25 | + function formatMessage(opt, desc) { | ||
26 | + return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); | ||
27 | + } | ||
28 | + | ||
29 | + // eslint-disable-next-line func-names | ||
30 | + return function(value, opt, opts) { | ||
31 | + if (validator === false) { | ||
32 | + throw new AxiosError( | ||
33 | + formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), | ||
34 | + AxiosError.ERR_DEPRECATED | ||
35 | + ); | ||
36 | + } | ||
37 | + | ||
38 | + if (version && !deprecatedWarnings[opt]) { | ||
39 | + deprecatedWarnings[opt] = true; | ||
40 | + // eslint-disable-next-line no-console | ||
41 | + console.warn( | ||
42 | + formatMessage( | ||
43 | + opt, | ||
44 | + ' has been deprecated since v' + version + ' and will be removed in the near future' | ||
45 | + ) | ||
46 | + ); | ||
47 | + } | ||
48 | + | ||
49 | + return validator ? validator(value, opt, opts) : true; | ||
50 | + }; | ||
51 | +}; | ||
52 | + | ||
53 | +/** | ||
54 | + * Assert object's properties type | ||
55 | + * @param {object} options | ||
56 | + * @param {object} schema | ||
57 | + * @param {boolean?} allowUnknown | ||
58 | + */ | ||
59 | + | ||
60 | +function assertOptions(options, schema, allowUnknown) { | ||
61 | + if (typeof options !== 'object') { | ||
62 | + throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE); | ||
63 | + } | ||
64 | + var keys = Object.keys(options); | ||
65 | + var i = keys.length; | ||
66 | + while (i-- > 0) { | ||
67 | + var opt = keys[i]; | ||
68 | + var validator = schema[opt]; | ||
69 | + if (validator) { | ||
70 | + var value = options[opt]; | ||
71 | + var result = value === undefined || validator(value, opt, options); | ||
72 | + if (result !== true) { | ||
73 | + throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE); | ||
74 | + } | ||
75 | + continue; | ||
76 | + } | ||
77 | + if (allowUnknown !== true) { | ||
78 | + throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION); | ||
79 | + } | ||
80 | + } | ||
81 | +} | ||
82 | + | ||
83 | +module.exports = { | ||
84 | + assertOptions: assertOptions, | ||
85 | + validators: validators | ||
86 | +}; |
node_modules/axios/lib/utils.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/axios/package.json
0 → 100644
1 | +{ | ||
2 | + "name": "axios", | ||
3 | + "version": "0.27.2", | ||
4 | + "description": "Promise based HTTP client for the browser and node.js", | ||
5 | + "main": "index.js", | ||
6 | + "types": "index.d.ts", | ||
7 | + "scripts": { | ||
8 | + "test": "grunt test && dtslint", | ||
9 | + "start": "node ./sandbox/server.js", | ||
10 | + "preversion": "grunt version && npm test", | ||
11 | + "build": "NODE_ENV=production grunt build", | ||
12 | + "examples": "node ./examples/server.js", | ||
13 | + "coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", | ||
14 | + "fix": "eslint --fix lib/**/*.js" | ||
15 | + }, | ||
16 | + "repository": { | ||
17 | + "type": "git", | ||
18 | + "url": "https://github.com/axios/axios.git" | ||
19 | + }, | ||
20 | + "keywords": [ | ||
21 | + "xhr", | ||
22 | + "http", | ||
23 | + "ajax", | ||
24 | + "promise", | ||
25 | + "node" | ||
26 | + ], | ||
27 | + "author": "Matt Zabriskie", | ||
28 | + "license": "MIT", | ||
29 | + "bugs": { | ||
30 | + "url": "https://github.com/axios/axios/issues" | ||
31 | + }, | ||
32 | + "homepage": "https://axios-http.com", | ||
33 | + "devDependencies": { | ||
34 | + "abortcontroller-polyfill": "^1.7.3", | ||
35 | + "coveralls": "^3.1.1", | ||
36 | + "dtslint": "^4.2.1", | ||
37 | + "es6-promise": "^4.2.8", | ||
38 | + "formidable": "^2.0.1", | ||
39 | + "grunt": "^1.4.1", | ||
40 | + "grunt-banner": "^0.6.0", | ||
41 | + "grunt-cli": "^1.4.3", | ||
42 | + "grunt-contrib-clean": "^2.0.0", | ||
43 | + "grunt-contrib-watch": "^1.1.0", | ||
44 | + "grunt-eslint": "^24.0.0", | ||
45 | + "grunt-karma": "^4.0.2", | ||
46 | + "grunt-mocha-test": "^0.13.3", | ||
47 | + "grunt-webpack": "^5.0.0", | ||
48 | + "istanbul-instrumenter-loader": "^3.0.1", | ||
49 | + "jasmine-core": "^2.4.1", | ||
50 | + "karma": "^6.3.17", | ||
51 | + "karma-chrome-launcher": "^3.1.1", | ||
52 | + "karma-firefox-launcher": "^2.1.2", | ||
53 | + "karma-jasmine": "^1.1.1", | ||
54 | + "karma-jasmine-ajax": "^0.1.13", | ||
55 | + "karma-safari-launcher": "^1.0.0", | ||
56 | + "karma-sauce-launcher": "^4.3.6", | ||
57 | + "karma-sinon": "^1.0.5", | ||
58 | + "karma-sourcemap-loader": "^0.3.8", | ||
59 | + "karma-webpack": "^4.0.2", | ||
60 | + "load-grunt-tasks": "^5.1.0", | ||
61 | + "minimist": "^1.2.6", | ||
62 | + "mocha": "^8.2.1", | ||
63 | + "sinon": "^4.5.0", | ||
64 | + "terser-webpack-plugin": "^4.2.3", | ||
65 | + "typescript": "^4.6.3", | ||
66 | + "url-search-params": "^0.10.0", | ||
67 | + "webpack": "^4.44.2", | ||
68 | + "webpack-dev-server": "^3.11.0" | ||
69 | + }, | ||
70 | + "browser": { | ||
71 | + "./lib/adapters/http.js": "./lib/adapters/xhr.js", | ||
72 | + "./lib/defaults/env/FormData.js": "./lib/helpers/null.js" | ||
73 | + }, | ||
74 | + "jsdelivr": "dist/axios.min.js", | ||
75 | + "unpkg": "dist/axios.min.js", | ||
76 | + "typings": "./index.d.ts", | ||
77 | + "dependencies": { | ||
78 | + "follow-redirects": "^1.14.9", | ||
79 | + "form-data": "^4.0.0" | ||
80 | + }, | ||
81 | + "bundlesize": [ | ||
82 | + { | ||
83 | + "path": "./dist/axios.min.js", | ||
84 | + "threshold": "5kB" | ||
85 | + } | ||
86 | + ] | ||
87 | +} |
node_modules/axios/tsconfig.json
0 → 100644
node_modules/axios/tslint.json
0 → 100644
node_modules/follow-redirects/LICENSE
0 → 100644
1 | +Copyright 2014–present Olivier Lalonde <olalonde@gmail.com>, James Talmage <james@talmage.io>, Ruben Verborgh | ||
2 | + | ||
3 | +Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
4 | +this software and associated documentation files (the "Software"), to deal in | ||
5 | +the Software without restriction, including without limitation the rights to | ||
6 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
7 | +of the Software, and to permit persons to whom the Software is furnished to do | ||
8 | +so, subject to the following conditions: | ||
9 | + | ||
10 | +The above copyright notice and this permission notice shall be included in all | ||
11 | +copies or substantial portions of the Software. | ||
12 | + | ||
13 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
14 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
15 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
16 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
17 | +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR | ||
18 | +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
node_modules/follow-redirects/README.md
0 → 100644
1 | +## Follow Redirects | ||
2 | + | ||
3 | +Drop-in replacement for Node's `http` and `https` modules that automatically follows redirects. | ||
4 | + | ||
5 | +[![npm version](https://img.shields.io/npm/v/follow-redirects.svg)](https://www.npmjs.com/package/follow-redirects) | ||
6 | +[![Build Status](https://github.com/follow-redirects/follow-redirects/workflows/CI/badge.svg)](https://github.com/follow-redirects/follow-redirects/actions) | ||
7 | +[![Coverage Status](https://coveralls.io/repos/follow-redirects/follow-redirects/badge.svg?branch=master)](https://coveralls.io/r/follow-redirects/follow-redirects?branch=master) | ||
8 | +[![npm downloads](https://img.shields.io/npm/dm/follow-redirects.svg)](https://www.npmjs.com/package/follow-redirects) | ||
9 | +[![Sponsor on GitHub](https://img.shields.io/static/v1?label=Sponsor&message=%F0%9F%92%96&logo=GitHub)](https://github.com/sponsors/RubenVerborgh) | ||
10 | + | ||
11 | +`follow-redirects` provides [request](https://nodejs.org/api/http.html#http_http_request_options_callback) and [get](https://nodejs.org/api/http.html#http_http_get_options_callback) | ||
12 | + methods that behave identically to those found on the native [http](https://nodejs.org/api/http.html#http_http_request_options_callback) and [https](https://nodejs.org/api/https.html#https_https_request_options_callback) | ||
13 | + modules, with the exception that they will seamlessly follow redirects. | ||
14 | + | ||
15 | +```javascript | ||
16 | +const { http, https } = require('follow-redirects'); | ||
17 | + | ||
18 | +http.get('http://bit.ly/900913', response => { | ||
19 | + response.on('data', chunk => { | ||
20 | + console.log(chunk); | ||
21 | + }); | ||
22 | +}).on('error', err => { | ||
23 | + console.error(err); | ||
24 | +}); | ||
25 | +``` | ||
26 | + | ||
27 | +You can inspect the final redirected URL through the `responseUrl` property on the `response`. | ||
28 | +If no redirection happened, `responseUrl` is the original request URL. | ||
29 | + | ||
30 | +```javascript | ||
31 | +const request = https.request({ | ||
32 | + host: 'bitly.com', | ||
33 | + path: '/UHfDGO', | ||
34 | +}, response => { | ||
35 | + console.log(response.responseUrl); | ||
36 | + // 'http://duckduckgo.com/robots.txt' | ||
37 | +}); | ||
38 | +request.end(); | ||
39 | +``` | ||
40 | + | ||
41 | +## Options | ||
42 | +### Global options | ||
43 | +Global options are set directly on the `follow-redirects` module: | ||
44 | + | ||
45 | +```javascript | ||
46 | +const followRedirects = require('follow-redirects'); | ||
47 | +followRedirects.maxRedirects = 10; | ||
48 | +followRedirects.maxBodyLength = 20 * 1024 * 1024; // 20 MB | ||
49 | +``` | ||
50 | + | ||
51 | +The following global options are supported: | ||
52 | + | ||
53 | +- `maxRedirects` (default: `21`) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted. | ||
54 | + | ||
55 | +- `maxBodyLength` (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted. | ||
56 | + | ||
57 | +### Per-request options | ||
58 | +Per-request options are set by passing an `options` object: | ||
59 | + | ||
60 | +```javascript | ||
61 | +const url = require('url'); | ||
62 | +const { http, https } = require('follow-redirects'); | ||
63 | + | ||
64 | +const options = url.parse('http://bit.ly/900913'); | ||
65 | +options.maxRedirects = 10; | ||
66 | +options.beforeRedirect = (options, response, request) => { | ||
67 | + // Use this to adjust the request options upon redirecting, | ||
68 | + // to inspect the latest response headers, | ||
69 | + // or to cancel the request by throwing an error | ||
70 | + | ||
71 | + // response.headers = the redirect response headers | ||
72 | + // response.statusCode = the redirect response code (eg. 301, 307, etc.) | ||
73 | + | ||
74 | + // request.url = the requested URL that resulted in a redirect | ||
75 | + // request.headers = the headers in the request that resulted in a redirect | ||
76 | + // request.method = the method of the request that resulted in a redirect | ||
77 | + if (options.hostname === "example.com") { | ||
78 | + options.auth = "user:password"; | ||
79 | + } | ||
80 | +}; | ||
81 | +http.request(options); | ||
82 | +``` | ||
83 | + | ||
84 | +In addition to the [standard HTTP](https://nodejs.org/api/http.html#http_http_request_options_callback) and [HTTPS options](https://nodejs.org/api/https.html#https_https_request_options_callback), | ||
85 | +the following per-request options are supported: | ||
86 | +- `followRedirects` (default: `true`) – whether redirects should be followed. | ||
87 | + | ||
88 | +- `maxRedirects` (default: `21`) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted. | ||
89 | + | ||
90 | +- `maxBodyLength` (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted. | ||
91 | + | ||
92 | +- `beforeRedirect` (default: `undefined`) – optionally change the request `options` on redirects, or abort the request by throwing an error. | ||
93 | + | ||
94 | +- `agents` (default: `undefined`) – sets the `agent` option per protocol, since HTTP and HTTPS use different agents. Example value: `{ http: new http.Agent(), https: new https.Agent() }` | ||
95 | + | ||
96 | +- `trackRedirects` (default: `false`) – whether to store the redirected response details into the `redirects` array on the response object. | ||
97 | + | ||
98 | + | ||
99 | +### Advanced usage | ||
100 | +By default, `follow-redirects` will use the Node.js default implementations | ||
101 | +of [`http`](https://nodejs.org/api/http.html) | ||
102 | +and [`https`](https://nodejs.org/api/https.html). | ||
103 | +To enable features such as caching and/or intermediate request tracking, | ||
104 | +you might instead want to wrap `follow-redirects` around custom protocol implementations: | ||
105 | + | ||
106 | +```javascript | ||
107 | +const { http, https } = require('follow-redirects').wrap({ | ||
108 | + http: require('your-custom-http'), | ||
109 | + https: require('your-custom-https'), | ||
110 | +}); | ||
111 | +``` | ||
112 | + | ||
113 | +Such custom protocols only need an implementation of the `request` method. | ||
114 | + | ||
115 | +## Browser Usage | ||
116 | + | ||
117 | +Due to the way the browser works, | ||
118 | +the `http` and `https` browser equivalents perform redirects by default. | ||
119 | + | ||
120 | +By requiring `follow-redirects` this way: | ||
121 | +```javascript | ||
122 | +const http = require('follow-redirects/http'); | ||
123 | +const https = require('follow-redirects/https'); | ||
124 | +``` | ||
125 | +you can easily tell webpack and friends to replace | ||
126 | +`follow-redirect` by the built-in versions: | ||
127 | + | ||
128 | +```json | ||
129 | +{ | ||
130 | + "follow-redirects/http" : "http", | ||
131 | + "follow-redirects/https" : "https" | ||
132 | +} | ||
133 | +``` | ||
134 | + | ||
135 | +## Contributing | ||
136 | + | ||
137 | +Pull Requests are always welcome. Please [file an issue](https://github.com/follow-redirects/follow-redirects/issues) | ||
138 | + detailing your proposal before you invest your valuable time. Additional features and bug fixes should be accompanied | ||
139 | + by tests. You can run the test suite locally with a simple `npm test` command. | ||
140 | + | ||
141 | +## Debug Logging | ||
142 | + | ||
143 | +`follow-redirects` uses the excellent [debug](https://www.npmjs.com/package/debug) for logging. To turn on logging | ||
144 | + set the environment variable `DEBUG=follow-redirects` for debug output from just this module. When running the test | ||
145 | + suite it is sometimes advantageous to set `DEBUG=*` to see output from the express server as well. | ||
146 | + | ||
147 | +## Authors | ||
148 | + | ||
149 | +- [Ruben Verborgh](https://ruben.verborgh.org/) | ||
150 | +- [Olivier Lalonde](mailto:olalonde@gmail.com) | ||
151 | +- [James Talmage](mailto:james@talmage.io) | ||
152 | + | ||
153 | +## License | ||
154 | + | ||
155 | +[MIT License](https://github.com/follow-redirects/follow-redirects/blob/master/LICENSE) |
node_modules/follow-redirects/debug.js
0 → 100644
1 | +var debug; | ||
2 | + | ||
3 | +module.exports = function () { | ||
4 | + if (!debug) { | ||
5 | + try { | ||
6 | + /* eslint global-require: off */ | ||
7 | + debug = require("debug")("follow-redirects"); | ||
8 | + } | ||
9 | + catch (error) { /* */ } | ||
10 | + if (typeof debug !== "function") { | ||
11 | + debug = function () { /* */ }; | ||
12 | + } | ||
13 | + } | ||
14 | + debug.apply(null, arguments); | ||
15 | +}; |
node_modules/follow-redirects/http.js
0 → 100644
1 | +module.exports = require("./").http; |
node_modules/follow-redirects/https.js
0 → 100644
1 | +module.exports = require("./").https; |
node_modules/follow-redirects/index.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/follow-redirects/package.json
0 → 100644
1 | +{ | ||
2 | + "name": "follow-redirects", | ||
3 | + "version": "1.15.1", | ||
4 | + "description": "HTTP and HTTPS modules that follow redirects.", | ||
5 | + "license": "MIT", | ||
6 | + "main": "index.js", | ||
7 | + "files": [ | ||
8 | + "*.js" | ||
9 | + ], | ||
10 | + "engines": { | ||
11 | + "node": ">=4.0" | ||
12 | + }, | ||
13 | + "scripts": { | ||
14 | + "test": "npm run lint && npm run mocha", | ||
15 | + "lint": "eslint *.js test", | ||
16 | + "mocha": "nyc mocha" | ||
17 | + }, | ||
18 | + "repository": { | ||
19 | + "type": "git", | ||
20 | + "url": "git@github.com:follow-redirects/follow-redirects.git" | ||
21 | + }, | ||
22 | + "homepage": "https://github.com/follow-redirects/follow-redirects", | ||
23 | + "bugs": { | ||
24 | + "url": "https://github.com/follow-redirects/follow-redirects/issues" | ||
25 | + }, | ||
26 | + "keywords": [ | ||
27 | + "http", | ||
28 | + "https", | ||
29 | + "url", | ||
30 | + "redirect", | ||
31 | + "client", | ||
32 | + "location", | ||
33 | + "utility" | ||
34 | + ], | ||
35 | + "author": "Ruben Verborgh <ruben@verborgh.org> (https://ruben.verborgh.org/)", | ||
36 | + "contributors": [ | ||
37 | + "Olivier Lalonde <olalonde@gmail.com> (http://www.syskall.com)", | ||
38 | + "James Talmage <james@talmage.io>" | ||
39 | + ], | ||
40 | + "funding": [ | ||
41 | + { | ||
42 | + "type": "individual", | ||
43 | + "url": "https://github.com/sponsors/RubenVerborgh" | ||
44 | + } | ||
45 | + ], | ||
46 | + "peerDependenciesMeta": { | ||
47 | + "debug": { | ||
48 | + "optional": true | ||
49 | + } | ||
50 | + }, | ||
51 | + "devDependencies": { | ||
52 | + "concat-stream": "^2.0.0", | ||
53 | + "eslint": "^5.16.0", | ||
54 | + "express": "^4.16.4", | ||
55 | + "lolex": "^3.1.0", | ||
56 | + "mocha": "^6.0.2", | ||
57 | + "nyc": "^14.1.1" | ||
58 | + } | ||
59 | +} |
node_modules/form-data/License
0 → 100644
1 | +Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors | ||
2 | + | ||
3 | + Permission is hereby granted, free of charge, to any person obtaining a copy | ||
4 | + of this software and associated documentation files (the "Software"), to deal | ||
5 | + in the Software without restriction, including without limitation the rights | ||
6 | + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
7 | + copies of the Software, and to permit persons to whom the Software is | ||
8 | + furnished to do so, subject to the following conditions: | ||
9 | + | ||
10 | + The above copyright notice and this permission notice shall be included in | ||
11 | + all copies or substantial portions of the Software. | ||
12 | + | ||
13 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
14 | + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
15 | + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
16 | + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
17 | + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
18 | + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
19 | + THE SOFTWARE. |
node_modules/form-data/README.md.bak
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/form-data/Readme.md
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/form-data/index.d.ts
0 → 100644
1 | +// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz> | ||
2 | +// Leon Yu <https://github.com/leonyu> | ||
3 | +// BendingBender <https://github.com/BendingBender> | ||
4 | +// Maple Miao <https://github.com/mapleeit> | ||
5 | + | ||
6 | +/// <reference types="node" /> | ||
7 | +import * as stream from 'stream'; | ||
8 | +import * as http from 'http'; | ||
9 | + | ||
10 | +export = FormData; | ||
11 | + | ||
12 | +// Extracted because @types/node doesn't export interfaces. | ||
13 | +interface ReadableOptions { | ||
14 | + highWaterMark?: number; | ||
15 | + encoding?: string; | ||
16 | + objectMode?: boolean; | ||
17 | + read?(this: stream.Readable, size: number): void; | ||
18 | + destroy?(this: stream.Readable, error: Error | null, callback: (error: Error | null) => void): void; | ||
19 | + autoDestroy?: boolean; | ||
20 | +} | ||
21 | + | ||
22 | +interface Options extends ReadableOptions { | ||
23 | + writable?: boolean; | ||
24 | + readable?: boolean; | ||
25 | + dataSize?: number; | ||
26 | + maxDataSize?: number; | ||
27 | + pauseStreams?: boolean; | ||
28 | +} | ||
29 | + | ||
30 | +declare class FormData extends stream.Readable { | ||
31 | + constructor(options?: Options); | ||
32 | + append(key: string, value: any, options?: FormData.AppendOptions | string): void; | ||
33 | + getHeaders(userHeaders?: FormData.Headers): FormData.Headers; | ||
34 | + submit( | ||
35 | + params: string | FormData.SubmitOptions, | ||
36 | + callback?: (error: Error | null, response: http.IncomingMessage) => void | ||
37 | + ): http.ClientRequest; | ||
38 | + getBuffer(): Buffer; | ||
39 | + setBoundary(boundary: string): void; | ||
40 | + getBoundary(): string; | ||
41 | + getLength(callback: (err: Error | null, length: number) => void): void; | ||
42 | + getLengthSync(): number; | ||
43 | + hasKnownLength(): boolean; | ||
44 | +} | ||
45 | + | ||
46 | +declare namespace FormData { | ||
47 | + interface Headers { | ||
48 | + [key: string]: any; | ||
49 | + } | ||
50 | + | ||
51 | + interface AppendOptions { | ||
52 | + header?: string | Headers; | ||
53 | + knownLength?: number; | ||
54 | + filename?: string; | ||
55 | + filepath?: string; | ||
56 | + contentType?: string; | ||
57 | + } | ||
58 | + | ||
59 | + interface SubmitOptions extends http.RequestOptions { | ||
60 | + protocol?: 'https:' | 'http:'; | ||
61 | + } | ||
62 | +} |
node_modules/form-data/lib/browser.js
0 → 100644
node_modules/form-data/lib/form_data.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/form-data/lib/populate.js
0 → 100644
node_modules/form-data/package.json
0 → 100644
1 | +{ | ||
2 | + "author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)", | ||
3 | + "name": "form-data", | ||
4 | + "description": "A library to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.", | ||
5 | + "version": "4.0.0", | ||
6 | + "repository": { | ||
7 | + "type": "git", | ||
8 | + "url": "git://github.com/form-data/form-data.git" | ||
9 | + }, | ||
10 | + "main": "./lib/form_data", | ||
11 | + "browser": "./lib/browser", | ||
12 | + "typings": "./index.d.ts", | ||
13 | + "scripts": { | ||
14 | + "pretest": "rimraf coverage test/tmp", | ||
15 | + "test": "istanbul cover test/run.js", | ||
16 | + "posttest": "istanbul report lcov text", | ||
17 | + "lint": "eslint lib/*.js test/*.js test/integration/*.js", | ||
18 | + "report": "istanbul report lcov text", | ||
19 | + "ci-lint": "is-node-modern 8 && npm run lint || is-node-not-modern 8", | ||
20 | + "ci-test": "npm run test && npm run browser && npm run report", | ||
21 | + "predebug": "rimraf coverage test/tmp", | ||
22 | + "debug": "verbose=1 ./test/run.js", | ||
23 | + "browser": "browserify -t browserify-istanbul test/run-browser.js | obake --coverage", | ||
24 | + "check": "istanbul check-coverage coverage/coverage*.json", | ||
25 | + "files": "pkgfiles --sort=name", | ||
26 | + "get-version": "node -e \"console.log(require('./package.json').version)\"", | ||
27 | + "update-readme": "sed -i.bak 's/\\/master\\.svg/\\/v'$(npm --silent run get-version)'.svg/g' README.md", | ||
28 | + "restore-readme": "mv README.md.bak README.md", | ||
29 | + "prepublish": "in-publish && npm run update-readme || not-in-publish", | ||
30 | + "postpublish": "npm run restore-readme" | ||
31 | + }, | ||
32 | + "pre-commit": [ | ||
33 | + "lint", | ||
34 | + "ci-test", | ||
35 | + "check" | ||
36 | + ], | ||
37 | + "engines": { | ||
38 | + "node": ">= 6" | ||
39 | + }, | ||
40 | + "dependencies": { | ||
41 | + "asynckit": "^0.4.0", | ||
42 | + "combined-stream": "^1.0.8", | ||
43 | + "mime-types": "^2.1.12" | ||
44 | + }, | ||
45 | + "devDependencies": { | ||
46 | + "@types/node": "^12.0.10", | ||
47 | + "browserify": "^13.1.1", | ||
48 | + "browserify-istanbul": "^2.0.0", | ||
49 | + "coveralls": "^3.0.4", | ||
50 | + "cross-spawn": "^6.0.5", | ||
51 | + "eslint": "^6.0.1", | ||
52 | + "fake": "^0.2.2", | ||
53 | + "far": "^0.0.7", | ||
54 | + "formidable": "^1.0.17", | ||
55 | + "in-publish": "^2.0.0", | ||
56 | + "is-node-modern": "^1.0.0", | ||
57 | + "istanbul": "^0.4.5", | ||
58 | + "obake": "^0.1.2", | ||
59 | + "puppeteer": "^1.19.0", | ||
60 | + "pkgfiles": "^2.3.0", | ||
61 | + "pre-commit": "^1.1.3", | ||
62 | + "request": "^2.88.0", | ||
63 | + "rimraf": "^2.7.1", | ||
64 | + "tape": "^4.6.2", | ||
65 | + "typescript": "^3.5.2" | ||
66 | + }, | ||
67 | + "license": "MIT" | ||
68 | +} |
... | @@ -9,6 +9,7 @@ | ... | @@ -9,6 +9,7 @@ |
9 | "version": "1.0.0", | 9 | "version": "1.0.0", |
10 | "license": "ISC", | 10 | "license": "ISC", |
11 | "dependencies": { | 11 | "dependencies": { |
12 | + "axios": "^0.27.2", | ||
12 | "discord.js": "^12.5.3" | 13 | "discord.js": "^12.5.3" |
13 | } | 14 | } |
14 | }, | 15 | }, |
... | @@ -46,6 +47,15 @@ | ... | @@ -46,6 +47,15 @@ |
46 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", | 47 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", |
47 | "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" | 48 | "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" |
48 | }, | 49 | }, |
50 | + "node_modules/axios": { | ||
51 | + "version": "0.27.2", | ||
52 | + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", | ||
53 | + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", | ||
54 | + "dependencies": { | ||
55 | + "follow-redirects": "^1.14.9", | ||
56 | + "form-data": "^4.0.0" | ||
57 | + } | ||
58 | + }, | ||
49 | "node_modules/combined-stream": { | 59 | "node_modules/combined-stream": { |
50 | "version": "1.0.8", | 60 | "version": "1.0.8", |
51 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", | 61 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", |
... | @@ -92,6 +102,38 @@ | ... | @@ -92,6 +102,38 @@ |
92 | "node": ">=6" | 102 | "node": ">=6" |
93 | } | 103 | } |
94 | }, | 104 | }, |
105 | + "node_modules/follow-redirects": { | ||
106 | + "version": "1.15.1", | ||
107 | + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", | ||
108 | + "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==", | ||
109 | + "funding": [ | ||
110 | + { | ||
111 | + "type": "individual", | ||
112 | + "url": "https://github.com/sponsors/RubenVerborgh" | ||
113 | + } | ||
114 | + ], | ||
115 | + "engines": { | ||
116 | + "node": ">=4.0" | ||
117 | + }, | ||
118 | + "peerDependenciesMeta": { | ||
119 | + "debug": { | ||
120 | + "optional": true | ||
121 | + } | ||
122 | + } | ||
123 | + }, | ||
124 | + "node_modules/form-data": { | ||
125 | + "version": "4.0.0", | ||
126 | + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", | ||
127 | + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", | ||
128 | + "dependencies": { | ||
129 | + "asynckit": "^0.4.0", | ||
130 | + "combined-stream": "^1.0.8", | ||
131 | + "mime-types": "^2.1.12" | ||
132 | + }, | ||
133 | + "engines": { | ||
134 | + "node": ">= 6" | ||
135 | + } | ||
136 | + }, | ||
95 | "node_modules/mime-db": { | 137 | "node_modules/mime-db": { |
96 | "version": "1.52.0", | 138 | "version": "1.52.0", |
97 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", | 139 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", |
... | @@ -234,6 +276,15 @@ | ... | @@ -234,6 +276,15 @@ |
234 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", | 276 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", |
235 | "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" | 277 | "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" |
236 | }, | 278 | }, |
279 | + "axios": { | ||
280 | + "version": "0.27.2", | ||
281 | + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", | ||
282 | + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", | ||
283 | + "requires": { | ||
284 | + "follow-redirects": "^1.14.9", | ||
285 | + "form-data": "^4.0.0" | ||
286 | + } | ||
287 | + }, | ||
237 | "combined-stream": { | 288 | "combined-stream": { |
238 | "version": "1.0.8", | 289 | "version": "1.0.8", |
239 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", | 290 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", |
... | @@ -267,6 +318,21 @@ | ... | @@ -267,6 +318,21 @@ |
267 | "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", | 318 | "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", |
268 | "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" | 319 | "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" |
269 | }, | 320 | }, |
321 | + "follow-redirects": { | ||
322 | + "version": "1.15.1", | ||
323 | + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", | ||
324 | + "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==" | ||
325 | + }, | ||
326 | + "form-data": { | ||
327 | + "version": "4.0.0", | ||
328 | + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", | ||
329 | + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", | ||
330 | + "requires": { | ||
331 | + "asynckit": "^0.4.0", | ||
332 | + "combined-stream": "^1.0.8", | ||
333 | + "mime-types": "^2.1.12" | ||
334 | + } | ||
335 | + }, | ||
270 | "mime-db": { | 336 | "mime-db": { |
271 | "version": "1.52.0", | 337 | "version": "1.52.0", |
272 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", | 338 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", | ... | ... |
-
Please register or login to post a comment