tp-react-elements-dev 1.14.14 → 1.15.0
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/_virtual/index.esm11.js +2 -2
- package/dist/_virtual/index.esm12.js +2 -2
- package/dist/_virtual/index.esm13.js +2 -2
- package/dist/_virtual/index.esm4.js +2 -2
- package/dist/_virtual/index.esm5.js +2 -2
- package/dist/_virtual/index.esm6.js +2 -2
- package/dist/_virtual/index.esm7.js +2 -2
- package/dist/components/Form/FormConstants.esm.js +6 -0
- package/dist/components/Form/FormRender.esm.js +3 -0
- package/dist/components/FormComponents/Select/SingleSelectSearchApi.d.ts +6 -2
- package/dist/components/FormComponents/Select/SingleSelectSearchApi.esm.js +82 -199
- package/dist/components/FormComponents/index.esm.js +2 -2
- package/dist/node_modules/axios/index.esm.js +25 -0
- package/dist/node_modules/axios/lib/adapters/adapters.esm.js +128 -0
- package/dist/node_modules/axios/lib/adapters/fetch.esm.js +288 -0
- package/dist/node_modules/axios/lib/adapters/xhr.esm.js +202 -0
- package/dist/node_modules/axios/lib/axios.esm.js +86 -0
- package/dist/node_modules/axios/lib/cancel/CancelToken.esm.js +133 -0
- package/dist/node_modules/axios/lib/cancel/CanceledError.esm.js +23 -0
- package/dist/node_modules/axios/lib/cancel/isCancel.esm.js +5 -0
- package/dist/node_modules/axios/lib/core/Axios.esm.js +236 -0
- package/dist/node_modules/axios/lib/core/AxiosError.esm.js +108 -0
- package/dist/node_modules/axios/lib/core/AxiosHeaders.esm.js +312 -0
- package/dist/node_modules/axios/lib/core/InterceptorManager.esm.js +69 -0
- package/dist/node_modules/axios/lib/core/buildFullPath.esm.js +22 -0
- package/dist/node_modules/axios/lib/core/dispatchRequest.esm.js +81 -0
- package/dist/node_modules/axios/lib/core/mergeConfig.esm.js +106 -0
- package/dist/node_modules/axios/lib/core/settle.esm.js +27 -0
- package/dist/node_modules/axios/lib/core/transformData.esm.js +28 -0
- package/dist/node_modules/axios/lib/defaults/index.esm.js +159 -0
- package/dist/node_modules/axios/lib/defaults/transitional.esm.js +7 -0
- package/dist/node_modules/axios/lib/env/data.esm.js +3 -0
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.esm.js +56 -0
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode.esm.js +77 -0
- package/dist/node_modules/axios/lib/helpers/bind.esm.js +14 -0
- package/dist/node_modules/axios/lib/helpers/buildURL.esm.js +67 -0
- package/dist/node_modules/axios/lib/helpers/combineURLs.esm.js +15 -0
- package/dist/node_modules/axios/lib/helpers/composeSignals.esm.js +48 -0
- package/dist/node_modules/axios/lib/helpers/cookies.esm.js +54 -0
- package/dist/node_modules/axios/lib/helpers/formDataToJSON.esm.js +93 -0
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.esm.js +15 -0
- package/dist/node_modules/axios/lib/helpers/isAxiosError.esm.js +14 -0
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.esm.js +16 -0
- package/dist/node_modules/axios/lib/helpers/null.esm.js +4 -0
- package/dist/node_modules/axios/lib/helpers/parseHeaders.esm.js +55 -0
- package/dist/node_modules/axios/lib/helpers/parseProtocol.esm.js +6 -0
- package/dist/node_modules/axios/lib/helpers/progressEventReducer.esm.js +46 -0
- package/dist/node_modules/axios/lib/helpers/resolveConfig.esm.js +62 -0
- package/dist/node_modules/axios/lib/helpers/speedometer.esm.js +53 -0
- package/dist/node_modules/axios/lib/helpers/spread.esm.js +28 -0
- package/dist/node_modules/axios/lib/helpers/throttle.esm.js +44 -0
- package/dist/node_modules/axios/lib/helpers/toFormData.esm.js +219 -0
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.esm.js +19 -0
- package/dist/node_modules/axios/lib/helpers/trackStream.esm.js +88 -0
- package/dist/node_modules/axios/lib/helpers/validator.esm.js +99 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob.esm.js +3 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData.esm.js +3 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.esm.js +5 -0
- package/dist/node_modules/axios/lib/platform/browser/index.esm.js +15 -0
- package/dist/node_modules/axios/lib/platform/common/utils.esm.js +45 -0
- package/dist/node_modules/axios/lib/platform/index.esm.js +9 -0
- package/dist/node_modules/axios/lib/utils.esm.js +782 -0
- package/dist/node_modules/react-date-range/dist/components/Calendar/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DateInput/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DateRange/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DateRangePicker/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DayCell/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/DefinedRange/index.esm.js +1 -1
- package/dist/node_modules/react-date-range/dist/components/InputRangeField/index.esm.js +1 -1
- package/dist/utils/Interface/FormInterface.d.ts +7 -1
- package/package.json +2 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import utils from '../utils.esm.js';
|
|
2
|
+
|
|
3
|
+
class InterceptorManager {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.handlers = [];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Add a new interceptor to the stack
|
|
10
|
+
*
|
|
11
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
12
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
13
|
+
*
|
|
14
|
+
* @return {Number} An ID used to remove interceptor later
|
|
15
|
+
*/
|
|
16
|
+
use(fulfilled, rejected, options) {
|
|
17
|
+
this.handlers.push({
|
|
18
|
+
fulfilled,
|
|
19
|
+
rejected,
|
|
20
|
+
synchronous: options ? options.synchronous : false,
|
|
21
|
+
runWhen: options ? options.runWhen : null
|
|
22
|
+
});
|
|
23
|
+
return this.handlers.length - 1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Remove an interceptor from the stack
|
|
28
|
+
*
|
|
29
|
+
* @param {Number} id The ID that was returned by `use`
|
|
30
|
+
*
|
|
31
|
+
* @returns {void}
|
|
32
|
+
*/
|
|
33
|
+
eject(id) {
|
|
34
|
+
if (this.handlers[id]) {
|
|
35
|
+
this.handlers[id] = null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Clear all interceptors from the stack
|
|
41
|
+
*
|
|
42
|
+
* @returns {void}
|
|
43
|
+
*/
|
|
44
|
+
clear() {
|
|
45
|
+
if (this.handlers) {
|
|
46
|
+
this.handlers = [];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Iterate over all the registered interceptors
|
|
52
|
+
*
|
|
53
|
+
* This method is particularly useful for skipping over any
|
|
54
|
+
* interceptors that may have become `null` calling `eject`.
|
|
55
|
+
*
|
|
56
|
+
* @param {Function} fn The function to call for each interceptor
|
|
57
|
+
*
|
|
58
|
+
* @returns {void}
|
|
59
|
+
*/
|
|
60
|
+
forEach(fn) {
|
|
61
|
+
utils.forEach(this.handlers, function forEachHandler(h) {
|
|
62
|
+
if (h !== null) {
|
|
63
|
+
fn(h);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { InterceptorManager as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import isAbsoluteURL from '../helpers/isAbsoluteURL.esm.js';
|
|
2
|
+
import combineURLs from '../helpers/combineURLs.esm.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Creates a new URL by combining the baseURL with the requestedURL,
|
|
6
|
+
* only when the requestedURL is not already an absolute URL.
|
|
7
|
+
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} baseURL The base URL
|
|
10
|
+
* @param {string} requestedURL Absolute or relative URL to combine
|
|
11
|
+
*
|
|
12
|
+
* @returns {string} The combined full path
|
|
13
|
+
*/
|
|
14
|
+
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
15
|
+
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
16
|
+
if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
|
|
17
|
+
return combineURLs(baseURL, requestedURL);
|
|
18
|
+
}
|
|
19
|
+
return requestedURL;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { buildFullPath as default };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import transformData from './transformData.esm.js';
|
|
2
|
+
import isCancel from '../cancel/isCancel.esm.js';
|
|
3
|
+
import defaults from '../defaults/index.esm.js';
|
|
4
|
+
import CanceledError from '../cancel/CanceledError.esm.js';
|
|
5
|
+
import AxiosHeaders from './AxiosHeaders.esm.js';
|
|
6
|
+
import adapters from '../adapters/adapters.esm.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} config The config that is to be used for the request
|
|
12
|
+
*
|
|
13
|
+
* @returns {void}
|
|
14
|
+
*/
|
|
15
|
+
function throwIfCancellationRequested(config) {
|
|
16
|
+
if (config.cancelToken) {
|
|
17
|
+
config.cancelToken.throwIfRequested();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (config.signal && config.signal.aborted) {
|
|
21
|
+
throw new CanceledError(null, config);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Dispatch a request to the server using the configured adapter.
|
|
27
|
+
*
|
|
28
|
+
* @param {object} config The config that is to be used for the request
|
|
29
|
+
*
|
|
30
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
31
|
+
*/
|
|
32
|
+
function dispatchRequest(config) {
|
|
33
|
+
throwIfCancellationRequested(config);
|
|
34
|
+
|
|
35
|
+
config.headers = AxiosHeaders.from(config.headers);
|
|
36
|
+
|
|
37
|
+
// Transform request data
|
|
38
|
+
config.data = transformData.call(
|
|
39
|
+
config,
|
|
40
|
+
config.transformRequest
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
|
44
|
+
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
|
48
|
+
|
|
49
|
+
return adapter(config).then(function onAdapterResolution(response) {
|
|
50
|
+
throwIfCancellationRequested(config);
|
|
51
|
+
|
|
52
|
+
// Transform response data
|
|
53
|
+
response.data = transformData.call(
|
|
54
|
+
config,
|
|
55
|
+
config.transformResponse,
|
|
56
|
+
response
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
response.headers = AxiosHeaders.from(response.headers);
|
|
60
|
+
|
|
61
|
+
return response;
|
|
62
|
+
}, function onAdapterRejection(reason) {
|
|
63
|
+
if (!isCancel(reason)) {
|
|
64
|
+
throwIfCancellationRequested(config);
|
|
65
|
+
|
|
66
|
+
// Transform response data
|
|
67
|
+
if (reason && reason.response) {
|
|
68
|
+
reason.response.data = transformData.call(
|
|
69
|
+
config,
|
|
70
|
+
config.transformResponse,
|
|
71
|
+
reason.response
|
|
72
|
+
);
|
|
73
|
+
reason.response.headers = AxiosHeaders.from(reason.response.headers);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return Promise.reject(reason);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { dispatchRequest as default };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import utils from '../utils.esm.js';
|
|
2
|
+
import AxiosHeaders from './AxiosHeaders.esm.js';
|
|
3
|
+
|
|
4
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Config-specific merge-function which creates a new config-object
|
|
8
|
+
* by merging two configuration objects together.
|
|
9
|
+
*
|
|
10
|
+
* @param {Object} config1
|
|
11
|
+
* @param {Object} config2
|
|
12
|
+
*
|
|
13
|
+
* @returns {Object} New object resulting from merging config2 to config1
|
|
14
|
+
*/
|
|
15
|
+
function mergeConfig(config1, config2) {
|
|
16
|
+
// eslint-disable-next-line no-param-reassign
|
|
17
|
+
config2 = config2 || {};
|
|
18
|
+
const config = {};
|
|
19
|
+
|
|
20
|
+
function getMergedValue(target, source, prop, caseless) {
|
|
21
|
+
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
22
|
+
return utils.merge.call({caseless}, target, source);
|
|
23
|
+
} else if (utils.isPlainObject(source)) {
|
|
24
|
+
return utils.merge({}, source);
|
|
25
|
+
} else if (utils.isArray(source)) {
|
|
26
|
+
return source.slice();
|
|
27
|
+
}
|
|
28
|
+
return source;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// eslint-disable-next-line consistent-return
|
|
32
|
+
function mergeDeepProperties(a, b, prop, caseless) {
|
|
33
|
+
if (!utils.isUndefined(b)) {
|
|
34
|
+
return getMergedValue(a, b, prop, caseless);
|
|
35
|
+
} else if (!utils.isUndefined(a)) {
|
|
36
|
+
return getMergedValue(undefined, a, prop, caseless);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// eslint-disable-next-line consistent-return
|
|
41
|
+
function valueFromConfig2(a, b) {
|
|
42
|
+
if (!utils.isUndefined(b)) {
|
|
43
|
+
return getMergedValue(undefined, b);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// eslint-disable-next-line consistent-return
|
|
48
|
+
function defaultToConfig2(a, b) {
|
|
49
|
+
if (!utils.isUndefined(b)) {
|
|
50
|
+
return getMergedValue(undefined, b);
|
|
51
|
+
} else if (!utils.isUndefined(a)) {
|
|
52
|
+
return getMergedValue(undefined, a);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// eslint-disable-next-line consistent-return
|
|
57
|
+
function mergeDirectKeys(a, b, prop) {
|
|
58
|
+
if (prop in config2) {
|
|
59
|
+
return getMergedValue(a, b);
|
|
60
|
+
} else if (prop in config1) {
|
|
61
|
+
return getMergedValue(undefined, a);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const mergeMap = {
|
|
66
|
+
url: valueFromConfig2,
|
|
67
|
+
method: valueFromConfig2,
|
|
68
|
+
data: valueFromConfig2,
|
|
69
|
+
baseURL: defaultToConfig2,
|
|
70
|
+
transformRequest: defaultToConfig2,
|
|
71
|
+
transformResponse: defaultToConfig2,
|
|
72
|
+
paramsSerializer: defaultToConfig2,
|
|
73
|
+
timeout: defaultToConfig2,
|
|
74
|
+
timeoutMessage: defaultToConfig2,
|
|
75
|
+
withCredentials: defaultToConfig2,
|
|
76
|
+
withXSRFToken: defaultToConfig2,
|
|
77
|
+
adapter: defaultToConfig2,
|
|
78
|
+
responseType: defaultToConfig2,
|
|
79
|
+
xsrfCookieName: defaultToConfig2,
|
|
80
|
+
xsrfHeaderName: defaultToConfig2,
|
|
81
|
+
onUploadProgress: defaultToConfig2,
|
|
82
|
+
onDownloadProgress: defaultToConfig2,
|
|
83
|
+
decompress: defaultToConfig2,
|
|
84
|
+
maxContentLength: defaultToConfig2,
|
|
85
|
+
maxBodyLength: defaultToConfig2,
|
|
86
|
+
beforeRedirect: defaultToConfig2,
|
|
87
|
+
transport: defaultToConfig2,
|
|
88
|
+
httpAgent: defaultToConfig2,
|
|
89
|
+
httpsAgent: defaultToConfig2,
|
|
90
|
+
cancelToken: defaultToConfig2,
|
|
91
|
+
socketPath: defaultToConfig2,
|
|
92
|
+
responseEncoding: defaultToConfig2,
|
|
93
|
+
validateStatus: mergeDirectKeys,
|
|
94
|
+
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
utils.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
|
98
|
+
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
99
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
100
|
+
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
return config;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { mergeConfig as default };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import AxiosError from './AxiosError.esm.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Resolve or reject a Promise based on response status.
|
|
5
|
+
*
|
|
6
|
+
* @param {Function} resolve A function that resolves the promise.
|
|
7
|
+
* @param {Function} reject A function that rejects the promise.
|
|
8
|
+
* @param {object} response The response.
|
|
9
|
+
*
|
|
10
|
+
* @returns {object} The response.
|
|
11
|
+
*/
|
|
12
|
+
function settle(resolve, reject, response) {
|
|
13
|
+
const 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
|
+
}
|
|
26
|
+
|
|
27
|
+
export { settle as default };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import utils from '../utils.esm.js';
|
|
2
|
+
import defaults from '../defaults/index.esm.js';
|
|
3
|
+
import AxiosHeaders from './AxiosHeaders.esm.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Transform the data for a request or a response
|
|
7
|
+
*
|
|
8
|
+
* @param {Array|Function} fns A single function or Array of functions
|
|
9
|
+
* @param {?Object} response The response object
|
|
10
|
+
*
|
|
11
|
+
* @returns {*} The resulting transformed data
|
|
12
|
+
*/
|
|
13
|
+
function transformData(fns, response) {
|
|
14
|
+
const config = this || defaults;
|
|
15
|
+
const context = response || config;
|
|
16
|
+
const headers = AxiosHeaders.from(context.headers);
|
|
17
|
+
let data = context.data;
|
|
18
|
+
|
|
19
|
+
utils.forEach(fns, function transform(fn) {
|
|
20
|
+
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
headers.normalize();
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { transformData as default };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import utils from '../utils.esm.js';
|
|
2
|
+
import AxiosError from '../core/AxiosError.esm.js';
|
|
3
|
+
import transitionalDefaults from './transitional.esm.js';
|
|
4
|
+
import toFormData from '../helpers/toFormData.esm.js';
|
|
5
|
+
import toURLEncodedForm from '../helpers/toURLEncodedForm.esm.js';
|
|
6
|
+
import platform from '../platform/index.esm.js';
|
|
7
|
+
import formDataToJSON from '../helpers/formDataToJSON.esm.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
|
11
|
+
* of the input
|
|
12
|
+
*
|
|
13
|
+
* @param {any} rawValue - The value to be stringified.
|
|
14
|
+
* @param {Function} parser - A function that parses a string into a JavaScript object.
|
|
15
|
+
* @param {Function} encoder - A function that takes a value and returns a string.
|
|
16
|
+
*
|
|
17
|
+
* @returns {string} A stringified version of the rawValue.
|
|
18
|
+
*/
|
|
19
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
20
|
+
if (utils.isString(rawValue)) {
|
|
21
|
+
try {
|
|
22
|
+
(parser || JSON.parse)(rawValue);
|
|
23
|
+
return utils.trim(rawValue);
|
|
24
|
+
} catch (e) {
|
|
25
|
+
if (e.name !== 'SyntaxError') {
|
|
26
|
+
throw e;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const defaults = {
|
|
35
|
+
|
|
36
|
+
transitional: transitionalDefaults,
|
|
37
|
+
|
|
38
|
+
adapter: ['xhr', 'http', 'fetch'],
|
|
39
|
+
|
|
40
|
+
transformRequest: [function transformRequest(data, headers) {
|
|
41
|
+
const contentType = headers.getContentType() || '';
|
|
42
|
+
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
43
|
+
const isObjectPayload = utils.isObject(data);
|
|
44
|
+
|
|
45
|
+
if (isObjectPayload && utils.isHTMLForm(data)) {
|
|
46
|
+
data = new FormData(data);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const isFormData = utils.isFormData(data);
|
|
50
|
+
|
|
51
|
+
if (isFormData) {
|
|
52
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (utils.isArrayBuffer(data) ||
|
|
56
|
+
utils.isBuffer(data) ||
|
|
57
|
+
utils.isStream(data) ||
|
|
58
|
+
utils.isFile(data) ||
|
|
59
|
+
utils.isBlob(data) ||
|
|
60
|
+
utils.isReadableStream(data)
|
|
61
|
+
) {
|
|
62
|
+
return data;
|
|
63
|
+
}
|
|
64
|
+
if (utils.isArrayBufferView(data)) {
|
|
65
|
+
return data.buffer;
|
|
66
|
+
}
|
|
67
|
+
if (utils.isURLSearchParams(data)) {
|
|
68
|
+
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
69
|
+
return data.toString();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let isFileList;
|
|
73
|
+
|
|
74
|
+
if (isObjectPayload) {
|
|
75
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
76
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
|
80
|
+
const _FormData = this.env && this.env.FormData;
|
|
81
|
+
|
|
82
|
+
return toFormData(
|
|
83
|
+
isFileList ? {'files[]': data} : data,
|
|
84
|
+
_FormData && new _FormData(),
|
|
85
|
+
this.formSerializer
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (isObjectPayload || hasJSONContentType ) {
|
|
91
|
+
headers.setContentType('application/json', false);
|
|
92
|
+
return stringifySafely(data);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return data;
|
|
96
|
+
}],
|
|
97
|
+
|
|
98
|
+
transformResponse: [function transformResponse(data) {
|
|
99
|
+
const transitional = this.transitional || defaults.transitional;
|
|
100
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
101
|
+
const JSONRequested = this.responseType === 'json';
|
|
102
|
+
|
|
103
|
+
if (utils.isResponse(data) || utils.isReadableStream(data)) {
|
|
104
|
+
return data;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
108
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
109
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
110
|
+
|
|
111
|
+
try {
|
|
112
|
+
return JSON.parse(data, this.parseReviver);
|
|
113
|
+
} catch (e) {
|
|
114
|
+
if (strictJSONParsing) {
|
|
115
|
+
if (e.name === 'SyntaxError') {
|
|
116
|
+
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
|
|
117
|
+
}
|
|
118
|
+
throw e;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return data;
|
|
124
|
+
}],
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
128
|
+
* timeout is not created.
|
|
129
|
+
*/
|
|
130
|
+
timeout: 0,
|
|
131
|
+
|
|
132
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
|
133
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
134
|
+
|
|
135
|
+
maxContentLength: -1,
|
|
136
|
+
maxBodyLength: -1,
|
|
137
|
+
|
|
138
|
+
env: {
|
|
139
|
+
FormData: platform.classes.FormData,
|
|
140
|
+
Blob: platform.classes.Blob
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
validateStatus: function validateStatus(status) {
|
|
144
|
+
return status >= 200 && status < 300;
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
headers: {
|
|
148
|
+
common: {
|
|
149
|
+
'Accept': 'application/json, text/plain, */*',
|
|
150
|
+
'Content-Type': undefined
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
156
|
+
defaults.headers[method] = {};
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
export { defaults as default };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import toFormData from './toFormData.esm.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* It encodes a string by replacing all characters that are not in the unreserved set with
|
|
5
|
+
* their percent-encoded equivalents
|
|
6
|
+
*
|
|
7
|
+
* @param {string} str - The string to encode.
|
|
8
|
+
*
|
|
9
|
+
* @returns {string} The encoded string.
|
|
10
|
+
*/
|
|
11
|
+
function encode(str) {
|
|
12
|
+
const charMap = {
|
|
13
|
+
'!': '%21',
|
|
14
|
+
"'": '%27',
|
|
15
|
+
'(': '%28',
|
|
16
|
+
')': '%29',
|
|
17
|
+
'~': '%7E',
|
|
18
|
+
'%20': '+',
|
|
19
|
+
'%00': '\x00'
|
|
20
|
+
};
|
|
21
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
22
|
+
return charMap[match];
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* It takes a params object and converts it to a FormData object
|
|
28
|
+
*
|
|
29
|
+
* @param {Object<string, any>} params - The parameters to be converted to a FormData object.
|
|
30
|
+
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
|
31
|
+
*
|
|
32
|
+
* @returns {void}
|
|
33
|
+
*/
|
|
34
|
+
function AxiosURLSearchParams(params, options) {
|
|
35
|
+
this._pairs = [];
|
|
36
|
+
|
|
37
|
+
params && toFormData(params, this, options);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const prototype = AxiosURLSearchParams.prototype;
|
|
41
|
+
|
|
42
|
+
prototype.append = function append(name, value) {
|
|
43
|
+
this._pairs.push([name, value]);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
prototype.toString = function toString(encoder) {
|
|
47
|
+
const _encode = encoder ? function(value) {
|
|
48
|
+
return encoder.call(this, value, encode);
|
|
49
|
+
} : encode;
|
|
50
|
+
|
|
51
|
+
return this._pairs.map(function each(pair) {
|
|
52
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
53
|
+
}, '').join('&');
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { AxiosURLSearchParams as default };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const HttpStatusCode = {
|
|
2
|
+
Continue: 100,
|
|
3
|
+
SwitchingProtocols: 101,
|
|
4
|
+
Processing: 102,
|
|
5
|
+
EarlyHints: 103,
|
|
6
|
+
Ok: 200,
|
|
7
|
+
Created: 201,
|
|
8
|
+
Accepted: 202,
|
|
9
|
+
NonAuthoritativeInformation: 203,
|
|
10
|
+
NoContent: 204,
|
|
11
|
+
ResetContent: 205,
|
|
12
|
+
PartialContent: 206,
|
|
13
|
+
MultiStatus: 207,
|
|
14
|
+
AlreadyReported: 208,
|
|
15
|
+
ImUsed: 226,
|
|
16
|
+
MultipleChoices: 300,
|
|
17
|
+
MovedPermanently: 301,
|
|
18
|
+
Found: 302,
|
|
19
|
+
SeeOther: 303,
|
|
20
|
+
NotModified: 304,
|
|
21
|
+
UseProxy: 305,
|
|
22
|
+
Unused: 306,
|
|
23
|
+
TemporaryRedirect: 307,
|
|
24
|
+
PermanentRedirect: 308,
|
|
25
|
+
BadRequest: 400,
|
|
26
|
+
Unauthorized: 401,
|
|
27
|
+
PaymentRequired: 402,
|
|
28
|
+
Forbidden: 403,
|
|
29
|
+
NotFound: 404,
|
|
30
|
+
MethodNotAllowed: 405,
|
|
31
|
+
NotAcceptable: 406,
|
|
32
|
+
ProxyAuthenticationRequired: 407,
|
|
33
|
+
RequestTimeout: 408,
|
|
34
|
+
Conflict: 409,
|
|
35
|
+
Gone: 410,
|
|
36
|
+
LengthRequired: 411,
|
|
37
|
+
PreconditionFailed: 412,
|
|
38
|
+
PayloadTooLarge: 413,
|
|
39
|
+
UriTooLong: 414,
|
|
40
|
+
UnsupportedMediaType: 415,
|
|
41
|
+
RangeNotSatisfiable: 416,
|
|
42
|
+
ExpectationFailed: 417,
|
|
43
|
+
ImATeapot: 418,
|
|
44
|
+
MisdirectedRequest: 421,
|
|
45
|
+
UnprocessableEntity: 422,
|
|
46
|
+
Locked: 423,
|
|
47
|
+
FailedDependency: 424,
|
|
48
|
+
TooEarly: 425,
|
|
49
|
+
UpgradeRequired: 426,
|
|
50
|
+
PreconditionRequired: 428,
|
|
51
|
+
TooManyRequests: 429,
|
|
52
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
53
|
+
UnavailableForLegalReasons: 451,
|
|
54
|
+
InternalServerError: 500,
|
|
55
|
+
NotImplemented: 501,
|
|
56
|
+
BadGateway: 502,
|
|
57
|
+
ServiceUnavailable: 503,
|
|
58
|
+
GatewayTimeout: 504,
|
|
59
|
+
HttpVersionNotSupported: 505,
|
|
60
|
+
VariantAlsoNegotiates: 506,
|
|
61
|
+
InsufficientStorage: 507,
|
|
62
|
+
LoopDetected: 508,
|
|
63
|
+
NotExtended: 510,
|
|
64
|
+
NetworkAuthenticationRequired: 511,
|
|
65
|
+
WebServerIsDown: 521,
|
|
66
|
+
ConnectionTimedOut: 522,
|
|
67
|
+
OriginIsUnreachable: 523,
|
|
68
|
+
TimeoutOccurred: 524,
|
|
69
|
+
SslHandshakeFailed: 525,
|
|
70
|
+
InvalidSslCertificate: 526,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
74
|
+
HttpStatusCode[value] = key;
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
export { HttpStatusCode as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a bound version of a function with a specified `this` context
|
|
3
|
+
*
|
|
4
|
+
* @param {Function} fn - The function to bind
|
|
5
|
+
* @param {*} thisArg - The value to be passed as the `this` parameter
|
|
6
|
+
* @returns {Function} A new function that will call the original function with the specified `this` context
|
|
7
|
+
*/
|
|
8
|
+
function bind(fn, thisArg) {
|
|
9
|
+
return function wrap() {
|
|
10
|
+
return fn.apply(thisArg, arguments);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { bind as default };
|