hanbiro-react16-sdk 1.0.19 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ChatAIDraft/SettingPopper.js +5 -5
- package/dist/components/CountryFlag/flags/KRFlag.js +1 -1
- package/dist/hanbiro-react16-sdk.style.css +1 -1
- package/dist/hanbiro-react16-sdk.umd.js +2 -2
- package/dist/index.js +10 -10
- package/dist/utils/api.d.ts +9 -0
- package/dist/utils/api.js +55 -0
- package/package.json +9 -7
- package/dist/node_modules/axios/index.js +0 -38
- package/dist/node_modules/axios/lib/adapters/adapters.js +0 -71
- package/dist/node_modules/axios/lib/adapters/fetch.js +0 -272
- package/dist/node_modules/axios/lib/adapters/xhr.js +0 -153
- package/dist/node_modules/axios/lib/axios.js +0 -50
- package/dist/node_modules/axios/lib/cancel/CancelToken.js +0 -99
- package/dist/node_modules/axios/lib/cancel/CanceledError.js +0 -20
- package/dist/node_modules/axios/lib/cancel/isCancel.js +0 -6
- package/dist/node_modules/axios/lib/core/Axios.js +0 -220
- package/dist/node_modules/axios/lib/core/AxiosError.js +0 -76
- package/dist/node_modules/axios/lib/core/AxiosHeaders.js +0 -238
- package/dist/node_modules/axios/lib/core/InterceptorManager.js +0 -66
- package/dist/node_modules/axios/lib/core/buildFullPath.js +0 -12
- package/dist/node_modules/axios/lib/core/dispatchRequest.js +0 -48
- package/dist/node_modules/axios/lib/core/mergeConfig.js +0 -100
- package/dist/node_modules/axios/lib/core/settle.js +0 -20
- package/dist/node_modules/axios/lib/core/transformData.js +0 -17
- package/dist/node_modules/axios/lib/defaults/index.js +0 -120
- package/dist/node_modules/axios/lib/defaults/transitional.js +0 -9
- package/dist/node_modules/axios/lib/env/data.js +0 -4
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -34
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -77
- package/dist/node_modules/axios/lib/helpers/bind.js +0 -8
- package/dist/node_modules/axios/lib/helpers/buildURL.js +0 -32
- package/dist/node_modules/axios/lib/helpers/combineURLs.js +0 -6
- package/dist/node_modules/axios/lib/helpers/composeSignals.js +0 -41
- package/dist/node_modules/axios/lib/helpers/cookies.js +0 -49
- package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +0 -54
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -9
- package/dist/node_modules/axios/lib/helpers/isAxiosError.js +0 -7
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -11
- package/dist/node_modules/axios/lib/helpers/null.js +0 -4
- package/dist/node_modules/axios/lib/helpers/parseHeaders.js +0 -47
- package/dist/node_modules/axios/lib/helpers/parseProtocol.js +0 -7
- package/dist/node_modules/axios/lib/helpers/progressEventReducer.js +0 -44
- package/dist/node_modules/axios/lib/helpers/resolveConfig.js +0 -52
- package/dist/node_modules/axios/lib/helpers/speedometer.js +0 -36
- package/dist/node_modules/axios/lib/helpers/spread.js +0 -8
- package/dist/node_modules/axios/lib/helpers/throttle.js +0 -35
- package/dist/node_modules/axios/lib/helpers/toFormData.js +0 -120
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -33
- package/dist/node_modules/axios/lib/helpers/trackStream.js +0 -169
- package/dist/node_modules/axios/lib/helpers/validator.js +0 -70
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -4
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -4
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -5
- package/dist/node_modules/axios/lib/platform/browser/index.js +0 -15
- package/dist/node_modules/axios/lib/platform/common/utils.js +0 -15
- package/dist/node_modules/axios/lib/platform/index.js +0 -22
- package/dist/node_modules/axios/lib/utils.js +0 -429
- package/dist/utils/axiosAPI.d.ts +0 -1
- package/dist/utils/axiosAPI.js +0 -89
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import utils from "../utils.js";
|
|
2
|
-
import parseHeaders from "../helpers/parseHeaders.js";
|
|
3
|
-
const $internals = Symbol("internals");
|
|
4
|
-
function normalizeHeader(header) {
|
|
5
|
-
return header && String(header).trim().toLowerCase();
|
|
6
|
-
}
|
|
7
|
-
function normalizeValue(value) {
|
|
8
|
-
if (value === false || value == null) {
|
|
9
|
-
return value;
|
|
10
|
-
}
|
|
11
|
-
return utils.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
12
|
-
}
|
|
13
|
-
function parseTokens(str) {
|
|
14
|
-
const tokens = /* @__PURE__ */ Object.create(null);
|
|
15
|
-
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
16
|
-
let match;
|
|
17
|
-
while (match = tokensRE.exec(str)) {
|
|
18
|
-
tokens[match[1]] = match[2];
|
|
19
|
-
}
|
|
20
|
-
return tokens;
|
|
21
|
-
}
|
|
22
|
-
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
23
|
-
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
24
|
-
if (utils.isFunction(filter)) {
|
|
25
|
-
return filter.call(this, value, header);
|
|
26
|
-
}
|
|
27
|
-
if (isHeaderNameFilter) {
|
|
28
|
-
value = header;
|
|
29
|
-
}
|
|
30
|
-
if (!utils.isString(value)) return;
|
|
31
|
-
if (utils.isString(filter)) {
|
|
32
|
-
return value.indexOf(filter) !== -1;
|
|
33
|
-
}
|
|
34
|
-
if (utils.isRegExp(filter)) {
|
|
35
|
-
return filter.test(value);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function formatHeader(header) {
|
|
39
|
-
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
40
|
-
return char.toUpperCase() + str;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function buildAccessors(obj, header) {
|
|
44
|
-
const accessorName = utils.toCamelCase(" " + header);
|
|
45
|
-
["get", "set", "has"].forEach((methodName) => {
|
|
46
|
-
Object.defineProperty(obj, methodName + accessorName, {
|
|
47
|
-
value: function(arg1, arg2, arg3) {
|
|
48
|
-
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
49
|
-
},
|
|
50
|
-
configurable: true
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
class AxiosHeaders {
|
|
55
|
-
constructor(headers) {
|
|
56
|
-
headers && this.set(headers);
|
|
57
|
-
}
|
|
58
|
-
set(header, valueOrRewrite, rewrite) {
|
|
59
|
-
const self = this;
|
|
60
|
-
function setHeader(_value, _header, _rewrite) {
|
|
61
|
-
const lHeader = normalizeHeader(_header);
|
|
62
|
-
if (!lHeader) {
|
|
63
|
-
throw new Error("header name must be a non-empty string");
|
|
64
|
-
}
|
|
65
|
-
const key = utils.findKey(self, lHeader);
|
|
66
|
-
if (!key || self[key] === void 0 || _rewrite === true || _rewrite === void 0 && self[key] !== false) {
|
|
67
|
-
self[key || _header] = normalizeValue(_value);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
const setHeaders = (headers, _rewrite) => utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
71
|
-
if (utils.isPlainObject(header) || header instanceof this.constructor) {
|
|
72
|
-
setHeaders(header, valueOrRewrite);
|
|
73
|
-
} else if (utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
74
|
-
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
75
|
-
} else if (utils.isObject(header) && utils.isIterable(header)) {
|
|
76
|
-
let obj = {}, dest, key;
|
|
77
|
-
for (const entry of header) {
|
|
78
|
-
if (!utils.isArray(entry)) {
|
|
79
|
-
throw TypeError("Object iterator must return a key-value pair");
|
|
80
|
-
}
|
|
81
|
-
obj[key = entry[0]] = (dest = obj[key]) ? utils.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
|
|
82
|
-
}
|
|
83
|
-
setHeaders(obj, valueOrRewrite);
|
|
84
|
-
} else {
|
|
85
|
-
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
86
|
-
}
|
|
87
|
-
return this;
|
|
88
|
-
}
|
|
89
|
-
get(header, parser) {
|
|
90
|
-
header = normalizeHeader(header);
|
|
91
|
-
if (header) {
|
|
92
|
-
const key = utils.findKey(this, header);
|
|
93
|
-
if (key) {
|
|
94
|
-
const value = this[key];
|
|
95
|
-
if (!parser) {
|
|
96
|
-
return value;
|
|
97
|
-
}
|
|
98
|
-
if (parser === true) {
|
|
99
|
-
return parseTokens(value);
|
|
100
|
-
}
|
|
101
|
-
if (utils.isFunction(parser)) {
|
|
102
|
-
return parser.call(this, value, key);
|
|
103
|
-
}
|
|
104
|
-
if (utils.isRegExp(parser)) {
|
|
105
|
-
return parser.exec(value);
|
|
106
|
-
}
|
|
107
|
-
throw new TypeError("parser must be boolean|regexp|function");
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
has(header, matcher) {
|
|
112
|
-
header = normalizeHeader(header);
|
|
113
|
-
if (header) {
|
|
114
|
-
const key = utils.findKey(this, header);
|
|
115
|
-
return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
116
|
-
}
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
delete(header, matcher) {
|
|
120
|
-
const self = this;
|
|
121
|
-
let deleted = false;
|
|
122
|
-
function deleteHeader(_header) {
|
|
123
|
-
_header = normalizeHeader(_header);
|
|
124
|
-
if (_header) {
|
|
125
|
-
const key = utils.findKey(self, _header);
|
|
126
|
-
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
127
|
-
delete self[key];
|
|
128
|
-
deleted = true;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (utils.isArray(header)) {
|
|
133
|
-
header.forEach(deleteHeader);
|
|
134
|
-
} else {
|
|
135
|
-
deleteHeader(header);
|
|
136
|
-
}
|
|
137
|
-
return deleted;
|
|
138
|
-
}
|
|
139
|
-
clear(matcher) {
|
|
140
|
-
const keys = Object.keys(this);
|
|
141
|
-
let i = keys.length;
|
|
142
|
-
let deleted = false;
|
|
143
|
-
while (i--) {
|
|
144
|
-
const key = keys[i];
|
|
145
|
-
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
146
|
-
delete this[key];
|
|
147
|
-
deleted = true;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return deleted;
|
|
151
|
-
}
|
|
152
|
-
normalize(format) {
|
|
153
|
-
const self = this;
|
|
154
|
-
const headers = {};
|
|
155
|
-
utils.forEach(this, (value, header) => {
|
|
156
|
-
const key = utils.findKey(headers, header);
|
|
157
|
-
if (key) {
|
|
158
|
-
self[key] = normalizeValue(value);
|
|
159
|
-
delete self[header];
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
163
|
-
if (normalized !== header) {
|
|
164
|
-
delete self[header];
|
|
165
|
-
}
|
|
166
|
-
self[normalized] = normalizeValue(value);
|
|
167
|
-
headers[normalized] = true;
|
|
168
|
-
});
|
|
169
|
-
return this;
|
|
170
|
-
}
|
|
171
|
-
concat(...targets) {
|
|
172
|
-
return this.constructor.concat(this, ...targets);
|
|
173
|
-
}
|
|
174
|
-
toJSON(asStrings) {
|
|
175
|
-
const obj = /* @__PURE__ */ Object.create(null);
|
|
176
|
-
utils.forEach(this, (value, header) => {
|
|
177
|
-
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(", ") : value);
|
|
178
|
-
});
|
|
179
|
-
return obj;
|
|
180
|
-
}
|
|
181
|
-
[Symbol.iterator]() {
|
|
182
|
-
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
183
|
-
}
|
|
184
|
-
toString() {
|
|
185
|
-
return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
|
|
186
|
-
}
|
|
187
|
-
getSetCookie() {
|
|
188
|
-
return this.get("set-cookie") || [];
|
|
189
|
-
}
|
|
190
|
-
get [Symbol.toStringTag]() {
|
|
191
|
-
return "AxiosHeaders";
|
|
192
|
-
}
|
|
193
|
-
static from(thing) {
|
|
194
|
-
return thing instanceof this ? thing : new this(thing);
|
|
195
|
-
}
|
|
196
|
-
static concat(first, ...targets) {
|
|
197
|
-
const computed = new this(first);
|
|
198
|
-
targets.forEach((target) => computed.set(target));
|
|
199
|
-
return computed;
|
|
200
|
-
}
|
|
201
|
-
static accessor(header) {
|
|
202
|
-
const internals = this[$internals] = this[$internals] = {
|
|
203
|
-
accessors: {}
|
|
204
|
-
};
|
|
205
|
-
const accessors = internals.accessors;
|
|
206
|
-
const prototype = this.prototype;
|
|
207
|
-
function defineAccessor(_header) {
|
|
208
|
-
const lHeader = normalizeHeader(_header);
|
|
209
|
-
if (!accessors[lHeader]) {
|
|
210
|
-
buildAccessors(prototype, _header);
|
|
211
|
-
accessors[lHeader] = true;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
215
|
-
return this;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
AxiosHeaders.accessor([
|
|
219
|
-
"Content-Type",
|
|
220
|
-
"Content-Length",
|
|
221
|
-
"Accept",
|
|
222
|
-
"Accept-Encoding",
|
|
223
|
-
"User-Agent",
|
|
224
|
-
"Authorization"
|
|
225
|
-
]);
|
|
226
|
-
utils.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
|
227
|
-
let mapped = key[0].toUpperCase() + key.slice(1);
|
|
228
|
-
return {
|
|
229
|
-
get: () => value,
|
|
230
|
-
set(headerValue) {
|
|
231
|
-
this[mapped] = headerValue;
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
});
|
|
235
|
-
utils.freezeMethods(AxiosHeaders);
|
|
236
|
-
export {
|
|
237
|
-
AxiosHeaders as default
|
|
238
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import utils from "../utils.js";
|
|
2
|
-
class InterceptorManager {
|
|
3
|
-
constructor() {
|
|
4
|
-
this.handlers = [];
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Add a new interceptor to the stack
|
|
8
|
-
*
|
|
9
|
-
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
10
|
-
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
11
|
-
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
12
|
-
*
|
|
13
|
-
* @return {Number} An ID used to remove interceptor later
|
|
14
|
-
*/
|
|
15
|
-
use(fulfilled, rejected, options) {
|
|
16
|
-
this.handlers.push({
|
|
17
|
-
fulfilled,
|
|
18
|
-
rejected,
|
|
19
|
-
synchronous: options ? options.synchronous : false,
|
|
20
|
-
runWhen: options ? options.runWhen : null
|
|
21
|
-
});
|
|
22
|
-
return this.handlers.length - 1;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Remove an interceptor from the stack
|
|
26
|
-
*
|
|
27
|
-
* @param {Number} id The ID that was returned by `use`
|
|
28
|
-
*
|
|
29
|
-
* @returns {void}
|
|
30
|
-
*/
|
|
31
|
-
eject(id) {
|
|
32
|
-
if (this.handlers[id]) {
|
|
33
|
-
this.handlers[id] = null;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Clear all interceptors from the stack
|
|
38
|
-
*
|
|
39
|
-
* @returns {void}
|
|
40
|
-
*/
|
|
41
|
-
clear() {
|
|
42
|
-
if (this.handlers) {
|
|
43
|
-
this.handlers = [];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Iterate over all the registered interceptors
|
|
48
|
-
*
|
|
49
|
-
* This method is particularly useful for skipping over any
|
|
50
|
-
* interceptors that may have become `null` calling `eject`.
|
|
51
|
-
*
|
|
52
|
-
* @param {Function} fn The function to call for each interceptor
|
|
53
|
-
*
|
|
54
|
-
* @returns {void}
|
|
55
|
-
*/
|
|
56
|
-
forEach(fn) {
|
|
57
|
-
utils.forEach(this.handlers, function forEachHandler(h) {
|
|
58
|
-
if (h !== null) {
|
|
59
|
-
fn(h);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
export {
|
|
65
|
-
InterceptorManager as default
|
|
66
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import isAbsoluteURL from "../helpers/isAbsoluteURL.js";
|
|
2
|
-
import combineURLs from "../helpers/combineURLs.js";
|
|
3
|
-
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
4
|
-
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
5
|
-
if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
|
|
6
|
-
return combineURLs(baseURL, requestedURL);
|
|
7
|
-
}
|
|
8
|
-
return requestedURL;
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
buildFullPath as default
|
|
12
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import transformData from "./transformData.js";
|
|
2
|
-
import isCancel from "../cancel/isCancel.js";
|
|
3
|
-
import defaults from "../defaults/index.js";
|
|
4
|
-
import CanceledError from "../cancel/CanceledError.js";
|
|
5
|
-
import AxiosHeaders from "./AxiosHeaders.js";
|
|
6
|
-
import adapters from "../adapters/adapters.js";
|
|
7
|
-
function throwIfCancellationRequested(config) {
|
|
8
|
-
if (config.cancelToken) {
|
|
9
|
-
config.cancelToken.throwIfRequested();
|
|
10
|
-
}
|
|
11
|
-
if (config.signal && config.signal.aborted) {
|
|
12
|
-
throw new CanceledError(null, config);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function dispatchRequest(config) {
|
|
16
|
-
throwIfCancellationRequested(config);
|
|
17
|
-
config.headers = AxiosHeaders.from(config.headers);
|
|
18
|
-
config.data = transformData.call(config, config.transformRequest);
|
|
19
|
-
if (["post", "put", "patch"].indexOf(config.method) !== -1) {
|
|
20
|
-
config.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
21
|
-
}
|
|
22
|
-
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
|
23
|
-
return adapter(config).then(
|
|
24
|
-
function onAdapterResolution(response) {
|
|
25
|
-
throwIfCancellationRequested(config);
|
|
26
|
-
response.data = transformData.call(config, config.transformResponse, response);
|
|
27
|
-
response.headers = AxiosHeaders.from(response.headers);
|
|
28
|
-
return response;
|
|
29
|
-
},
|
|
30
|
-
function onAdapterRejection(reason) {
|
|
31
|
-
if (!isCancel(reason)) {
|
|
32
|
-
throwIfCancellationRequested(config);
|
|
33
|
-
if (reason && reason.response) {
|
|
34
|
-
reason.response.data = transformData.call(
|
|
35
|
-
config,
|
|
36
|
-
config.transformResponse,
|
|
37
|
-
reason.response
|
|
38
|
-
);
|
|
39
|
-
reason.response.headers = AxiosHeaders.from(reason.response.headers);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return Promise.reject(reason);
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
export {
|
|
47
|
-
dispatchRequest as default
|
|
48
|
-
};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
import utils from "../utils.js";
|
|
18
|
-
import AxiosHeaders from "./AxiosHeaders.js";
|
|
19
|
-
const headersToObject = (thing) => thing instanceof AxiosHeaders ? __spreadValues({}, thing) : thing;
|
|
20
|
-
function mergeConfig(config1, config2) {
|
|
21
|
-
config2 = config2 || {};
|
|
22
|
-
const config = {};
|
|
23
|
-
function getMergedValue(target, source, prop, caseless) {
|
|
24
|
-
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
25
|
-
return utils.merge.call({ caseless }, target, source);
|
|
26
|
-
} else if (utils.isPlainObject(source)) {
|
|
27
|
-
return utils.merge({}, source);
|
|
28
|
-
} else if (utils.isArray(source)) {
|
|
29
|
-
return source.slice();
|
|
30
|
-
}
|
|
31
|
-
return source;
|
|
32
|
-
}
|
|
33
|
-
function mergeDeepProperties(a, b, prop, caseless) {
|
|
34
|
-
if (!utils.isUndefined(b)) {
|
|
35
|
-
return getMergedValue(a, b, prop, caseless);
|
|
36
|
-
} else if (!utils.isUndefined(a)) {
|
|
37
|
-
return getMergedValue(void 0, a, prop, caseless);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function valueFromConfig2(a, b) {
|
|
41
|
-
if (!utils.isUndefined(b)) {
|
|
42
|
-
return getMergedValue(void 0, b);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function defaultToConfig2(a, b) {
|
|
46
|
-
if (!utils.isUndefined(b)) {
|
|
47
|
-
return getMergedValue(void 0, b);
|
|
48
|
-
} else if (!utils.isUndefined(a)) {
|
|
49
|
-
return getMergedValue(void 0, a);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function mergeDirectKeys(a, b, prop) {
|
|
53
|
-
if (prop in config2) {
|
|
54
|
-
return getMergedValue(a, b);
|
|
55
|
-
} else if (prop in config1) {
|
|
56
|
-
return getMergedValue(void 0, a);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
const mergeMap = {
|
|
60
|
-
url: valueFromConfig2,
|
|
61
|
-
method: valueFromConfig2,
|
|
62
|
-
data: valueFromConfig2,
|
|
63
|
-
baseURL: defaultToConfig2,
|
|
64
|
-
transformRequest: defaultToConfig2,
|
|
65
|
-
transformResponse: defaultToConfig2,
|
|
66
|
-
paramsSerializer: defaultToConfig2,
|
|
67
|
-
timeout: defaultToConfig2,
|
|
68
|
-
timeoutMessage: defaultToConfig2,
|
|
69
|
-
withCredentials: defaultToConfig2,
|
|
70
|
-
withXSRFToken: defaultToConfig2,
|
|
71
|
-
adapter: defaultToConfig2,
|
|
72
|
-
responseType: defaultToConfig2,
|
|
73
|
-
xsrfCookieName: defaultToConfig2,
|
|
74
|
-
xsrfHeaderName: defaultToConfig2,
|
|
75
|
-
onUploadProgress: defaultToConfig2,
|
|
76
|
-
onDownloadProgress: defaultToConfig2,
|
|
77
|
-
decompress: defaultToConfig2,
|
|
78
|
-
maxContentLength: defaultToConfig2,
|
|
79
|
-
maxBodyLength: defaultToConfig2,
|
|
80
|
-
beforeRedirect: defaultToConfig2,
|
|
81
|
-
transport: defaultToConfig2,
|
|
82
|
-
httpAgent: defaultToConfig2,
|
|
83
|
-
httpsAgent: defaultToConfig2,
|
|
84
|
-
cancelToken: defaultToConfig2,
|
|
85
|
-
socketPath: defaultToConfig2,
|
|
86
|
-
responseEncoding: defaultToConfig2,
|
|
87
|
-
validateStatus: mergeDirectKeys,
|
|
88
|
-
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
89
|
-
};
|
|
90
|
-
utils.forEach(Object.keys(__spreadValues(__spreadValues({}, config1), config2)), function computeConfigValue(prop) {
|
|
91
|
-
if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
|
|
92
|
-
const merge = utils.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
93
|
-
const configValue = merge(config1[prop], config2[prop], prop);
|
|
94
|
-
utils.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
|
|
95
|
-
});
|
|
96
|
-
return config;
|
|
97
|
-
}
|
|
98
|
-
export {
|
|
99
|
-
mergeConfig as default
|
|
100
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import AxiosError from "./AxiosError.js";
|
|
2
|
-
function settle(resolve, reject, response) {
|
|
3
|
-
const validateStatus = response.config.validateStatus;
|
|
4
|
-
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
5
|
-
resolve(response);
|
|
6
|
-
} else {
|
|
7
|
-
reject(
|
|
8
|
-
new AxiosError(
|
|
9
|
-
"Request failed with status code " + response.status,
|
|
10
|
-
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
11
|
-
response.config,
|
|
12
|
-
response.request,
|
|
13
|
-
response
|
|
14
|
-
)
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
settle as default
|
|
20
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import utils from "../utils.js";
|
|
2
|
-
import defaults from "../defaults/index.js";
|
|
3
|
-
import AxiosHeaders from "./AxiosHeaders.js";
|
|
4
|
-
function transformData(fns, response) {
|
|
5
|
-
const config = this || defaults;
|
|
6
|
-
const context = response || config;
|
|
7
|
-
const headers = AxiosHeaders.from(context.headers);
|
|
8
|
-
let data = context.data;
|
|
9
|
-
utils.forEach(fns, function transform(fn) {
|
|
10
|
-
data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
|
|
11
|
-
});
|
|
12
|
-
headers.normalize();
|
|
13
|
-
return data;
|
|
14
|
-
}
|
|
15
|
-
export {
|
|
16
|
-
transformData as default
|
|
17
|
-
};
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import utils from "../utils.js";
|
|
2
|
-
import AxiosError from "../core/AxiosError.js";
|
|
3
|
-
import transitionalDefaults from "./transitional.js";
|
|
4
|
-
import toFormData from "../helpers/toFormData.js";
|
|
5
|
-
import toURLEncodedForm from "../helpers/toURLEncodedForm.js";
|
|
6
|
-
import platform from "../platform/index.js";
|
|
7
|
-
import formDataToJSON from "../helpers/formDataToJSON.js";
|
|
8
|
-
function stringifySafely(rawValue, parser, encoder) {
|
|
9
|
-
if (utils.isString(rawValue)) {
|
|
10
|
-
try {
|
|
11
|
-
(parser || JSON.parse)(rawValue);
|
|
12
|
-
return utils.trim(rawValue);
|
|
13
|
-
} catch (e) {
|
|
14
|
-
if (e.name !== "SyntaxError") {
|
|
15
|
-
throw e;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return (encoder || JSON.stringify)(rawValue);
|
|
20
|
-
}
|
|
21
|
-
const defaults = {
|
|
22
|
-
transitional: transitionalDefaults,
|
|
23
|
-
adapter: ["xhr", "http", "fetch"],
|
|
24
|
-
transformRequest: [
|
|
25
|
-
function transformRequest(data, headers) {
|
|
26
|
-
const contentType = headers.getContentType() || "";
|
|
27
|
-
const hasJSONContentType = contentType.indexOf("application/json") > -1;
|
|
28
|
-
const isObjectPayload = utils.isObject(data);
|
|
29
|
-
if (isObjectPayload && utils.isHTMLForm(data)) {
|
|
30
|
-
data = new FormData(data);
|
|
31
|
-
}
|
|
32
|
-
const isFormData = utils.isFormData(data);
|
|
33
|
-
if (isFormData) {
|
|
34
|
-
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
35
|
-
}
|
|
36
|
-
if (utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data) || utils.isReadableStream(data)) {
|
|
37
|
-
return data;
|
|
38
|
-
}
|
|
39
|
-
if (utils.isArrayBufferView(data)) {
|
|
40
|
-
return data.buffer;
|
|
41
|
-
}
|
|
42
|
-
if (utils.isURLSearchParams(data)) {
|
|
43
|
-
headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
|
|
44
|
-
return data.toString();
|
|
45
|
-
}
|
|
46
|
-
let isFileList;
|
|
47
|
-
if (isObjectPayload) {
|
|
48
|
-
if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
|
|
49
|
-
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
50
|
-
}
|
|
51
|
-
if ((isFileList = utils.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
|
|
52
|
-
const _FormData = this.env && this.env.FormData;
|
|
53
|
-
return toFormData(
|
|
54
|
-
isFileList ? { "files[]": data } : data,
|
|
55
|
-
_FormData && new _FormData(),
|
|
56
|
-
this.formSerializer
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (isObjectPayload || hasJSONContentType) {
|
|
61
|
-
headers.setContentType("application/json", false);
|
|
62
|
-
return stringifySafely(data);
|
|
63
|
-
}
|
|
64
|
-
return data;
|
|
65
|
-
}
|
|
66
|
-
],
|
|
67
|
-
transformResponse: [
|
|
68
|
-
function transformResponse(data) {
|
|
69
|
-
const transitional = this.transitional || defaults.transitional;
|
|
70
|
-
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
71
|
-
const JSONRequested = this.responseType === "json";
|
|
72
|
-
if (utils.isResponse(data) || utils.isReadableStream(data)) {
|
|
73
|
-
return data;
|
|
74
|
-
}
|
|
75
|
-
if (data && utils.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
|
|
76
|
-
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
77
|
-
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
78
|
-
try {
|
|
79
|
-
return JSON.parse(data, this.parseReviver);
|
|
80
|
-
} catch (e) {
|
|
81
|
-
if (strictJSONParsing) {
|
|
82
|
-
if (e.name === "SyntaxError") {
|
|
83
|
-
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
|
|
84
|
-
}
|
|
85
|
-
throw e;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return data;
|
|
90
|
-
}
|
|
91
|
-
],
|
|
92
|
-
/**
|
|
93
|
-
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
94
|
-
* timeout is not created.
|
|
95
|
-
*/
|
|
96
|
-
timeout: 0,
|
|
97
|
-
xsrfCookieName: "XSRF-TOKEN",
|
|
98
|
-
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
99
|
-
maxContentLength: -1,
|
|
100
|
-
maxBodyLength: -1,
|
|
101
|
-
env: {
|
|
102
|
-
FormData: platform.classes.FormData,
|
|
103
|
-
Blob: platform.classes.Blob
|
|
104
|
-
},
|
|
105
|
-
validateStatus: function validateStatus(status) {
|
|
106
|
-
return status >= 200 && status < 300;
|
|
107
|
-
},
|
|
108
|
-
headers: {
|
|
109
|
-
common: {
|
|
110
|
-
Accept: "application/json, text/plain, */*",
|
|
111
|
-
"Content-Type": void 0
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
utils.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
|
|
116
|
-
defaults.headers[method] = {};
|
|
117
|
-
});
|
|
118
|
-
export {
|
|
119
|
-
defaults as default
|
|
120
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import toFormData from "./toFormData.js";
|
|
2
|
-
function encode(str) {
|
|
3
|
-
const charMap = {
|
|
4
|
-
"!": "%21",
|
|
5
|
-
"'": "%27",
|
|
6
|
-
"(": "%28",
|
|
7
|
-
")": "%29",
|
|
8
|
-
"~": "%7E",
|
|
9
|
-
"%20": "+",
|
|
10
|
-
"%00": "\0"
|
|
11
|
-
};
|
|
12
|
-
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
13
|
-
return charMap[match];
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
function AxiosURLSearchParams(params, options) {
|
|
17
|
-
this._pairs = [];
|
|
18
|
-
params && toFormData(params, this, options);
|
|
19
|
-
}
|
|
20
|
-
const prototype = AxiosURLSearchParams.prototype;
|
|
21
|
-
prototype.append = function append(name, value) {
|
|
22
|
-
this._pairs.push([name, value]);
|
|
23
|
-
};
|
|
24
|
-
prototype.toString = function toString(encoder) {
|
|
25
|
-
const _encode = encoder ? function(value) {
|
|
26
|
-
return encoder.call(this, value, encode);
|
|
27
|
-
} : encode;
|
|
28
|
-
return this._pairs.map(function each(pair) {
|
|
29
|
-
return _encode(pair[0]) + "=" + _encode(pair[1]);
|
|
30
|
-
}, "").join("&");
|
|
31
|
-
};
|
|
32
|
-
export {
|
|
33
|
-
AxiosURLSearchParams as default
|
|
34
|
-
};
|