@nocobase/plugin-ai-gigachat 2.3.0-beta.13 → 2.3.0-beta.14
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/externalVersion.js +5 -5
- package/dist/node_modules/gigachat/package.json +1 -1
- package/dist/node_modules/langchain-gigachat/package.json +1 -1
- package/package.json +2 -2
- package/dist/node_modules/gigachat/node_modules/axios/dist/axios.js +0 -5249
- package/dist/node_modules/gigachat/node_modules/axios/dist/axios.min.js +0 -5
- package/dist/node_modules/gigachat/node_modules/axios/dist/browser/axios.cjs +0 -5146
- package/dist/node_modules/gigachat/node_modules/axios/dist/esm/axios.js +0 -5167
- package/dist/node_modules/gigachat/node_modules/axios/dist/esm/axios.min.js +0 -3
- package/dist/node_modules/gigachat/node_modules/axios/dist/node/axios.cjs +0 -5996
- package/dist/node_modules/gigachat/node_modules/axios/index.d.cts +0 -738
- package/dist/node_modules/gigachat/node_modules/axios/index.d.ts +0 -755
- package/dist/node_modules/gigachat/node_modules/axios/index.js +0 -45
- package/dist/node_modules/gigachat/node_modules/axios/lib/adapters/adapters.js +0 -132
- package/dist/node_modules/gigachat/node_modules/axios/lib/adapters/fetch.js +0 -643
- package/dist/node_modules/gigachat/node_modules/axios/lib/adapters/http.js +0 -1417
- package/dist/node_modules/gigachat/node_modules/axios/lib/adapters/xhr.js +0 -228
- package/dist/node_modules/gigachat/node_modules/axios/lib/axios.js +0 -89
- package/dist/node_modules/gigachat/node_modules/axios/lib/cancel/CancelToken.js +0 -135
- package/dist/node_modules/gigachat/node_modules/axios/lib/cancel/CanceledError.js +0 -22
- package/dist/node_modules/gigachat/node_modules/axios/lib/cancel/isCancel.js +0 -5
- package/dist/node_modules/gigachat/node_modules/axios/lib/core/Axios.js +0 -283
- package/dist/node_modules/gigachat/node_modules/axios/lib/core/AxiosError.js +0 -188
- package/dist/node_modules/gigachat/node_modules/axios/lib/core/AxiosHeaders.js +0 -351
- package/dist/node_modules/gigachat/node_modules/axios/lib/core/InterceptorManager.js +0 -72
- package/dist/node_modules/gigachat/node_modules/axios/lib/core/buildFullPath.js +0 -50
- package/dist/node_modules/gigachat/node_modules/axios/lib/core/dispatchRequest.js +0 -89
- package/dist/node_modules/gigachat/node_modules/axios/lib/core/mergeConfig.js +0 -159
- package/dist/node_modules/gigachat/node_modules/axios/lib/core/settle.js +0 -27
- package/dist/node_modules/gigachat/node_modules/axios/lib/core/transformData.js +0 -28
- package/dist/node_modules/gigachat/node_modules/axios/lib/defaults/index.js +0 -177
- package/dist/node_modules/gigachat/node_modules/axios/lib/defaults/transitional.js +0 -10
- package/dist/node_modules/gigachat/node_modules/axios/lib/env/classes/FormData.js +0 -2
- package/dist/node_modules/gigachat/node_modules/axios/lib/env/data.js +0 -1
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/AxiosTransformStream.js +0 -156
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -59
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/Http2Sessions.js +0 -119
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -77
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +0 -29
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/bind.js +0 -14
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/buildURL.js +0 -69
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/callbackify.js +0 -18
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/combineURLs.js +0 -15
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/composeSignals.js +0 -57
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/cookies.js +0 -64
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/deprecatedMethod.js +0 -31
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +0 -105
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/formDataToJSON.js +0 -119
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/formDataToStream.js +0 -119
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/fromDataURI.js +0 -68
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -19
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/isAxiosError.js +0 -14
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -16
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/null.js +0 -2
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/parseHeaders.js +0 -69
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/parseProtocol.js +0 -6
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/progressEventReducer.js +0 -54
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/readBlob.js +0 -15
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/resolveConfig.js +0 -119
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +0 -60
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/shouldBypassProxy.js +0 -210
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/speedometer.js +0 -55
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/spread.js +0 -28
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/throttle.js +0 -44
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/toFormData.js +0 -285
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -19
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/trackStream.js +0 -89
- package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/validator.js +0 -112
- package/dist/node_modules/gigachat/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -3
- package/dist/node_modules/gigachat/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -3
- package/dist/node_modules/gigachat/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -4
- package/dist/node_modules/gigachat/node_modules/axios/lib/platform/browser/index.js +0 -13
- package/dist/node_modules/gigachat/node_modules/axios/lib/platform/common/utils.js +0 -52
- package/dist/node_modules/gigachat/node_modules/axios/lib/platform/index.js +0 -7
- package/dist/node_modules/gigachat/node_modules/axios/lib/platform/node/classes/FormData.js +0 -3
- package/dist/node_modules/gigachat/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +0 -4
- package/dist/node_modules/gigachat/node_modules/axios/lib/platform/node/index.js +0 -37
- package/dist/node_modules/gigachat/node_modules/axios/lib/utils.js +0 -1017
- package/dist/node_modules/gigachat/node_modules/axios/package.json +0 -201
- package/dist/node_modules/gigachat/node_modules/follow-redirects/debug.js +0 -15
- package/dist/node_modules/gigachat/node_modules/follow-redirects/http.js +0 -1
- package/dist/node_modules/gigachat/node_modules/follow-redirects/https.js +0 -1
- package/dist/node_modules/gigachat/node_modules/follow-redirects/index.js +0 -709
- package/dist/node_modules/gigachat/node_modules/follow-redirects/package.json +0 -58
- package/dist/node_modules/gigachat/node_modules/proxy-from-env/index.cjs +0 -105
- package/dist/node_modules/gigachat/node_modules/proxy-from-env/index.js +0 -103
- package/dist/node_modules/gigachat/node_modules/proxy-from-env/package.json +0 -43
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import utils from '../utils.js';
|
|
4
|
-
import AxiosHeaders from './AxiosHeaders.js';
|
|
5
|
-
|
|
6
|
-
const headersToObject = (thing) => (thing instanceof AxiosHeaders ? { ...thing } : thing);
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Config-specific merge-function which creates a new config-object
|
|
10
|
-
* by merging two configuration objects together.
|
|
11
|
-
*
|
|
12
|
-
* @param {Object} config1
|
|
13
|
-
* @param {Object} config2
|
|
14
|
-
*
|
|
15
|
-
* @returns {Object} New object resulting from merging config2 to config1
|
|
16
|
-
*/
|
|
17
|
-
export default function mergeConfig(config1, config2) {
|
|
18
|
-
// eslint-disable-next-line no-param-reassign
|
|
19
|
-
config1 = config1 || {};
|
|
20
|
-
config2 = config2 || {};
|
|
21
|
-
|
|
22
|
-
// Use a null-prototype object so that downstream reads such as `config.auth`
|
|
23
|
-
// or `config.baseURL` cannot inherit polluted values from Object.prototype.
|
|
24
|
-
// `hasOwnProperty` is restored as a non-enumerable own slot to preserve
|
|
25
|
-
// ergonomics for user code that relies on it.
|
|
26
|
-
const config = Object.create(null);
|
|
27
|
-
Object.defineProperty(config, 'hasOwnProperty', {
|
|
28
|
-
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
29
|
-
// this data descriptor into an accessor descriptor on the way in.
|
|
30
|
-
__proto__: null,
|
|
31
|
-
value: Object.prototype.hasOwnProperty,
|
|
32
|
-
enumerable: false,
|
|
33
|
-
writable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
function getMergedValue(target, source, prop, caseless) {
|
|
38
|
-
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
39
|
-
return utils.merge.call({ caseless }, target, source);
|
|
40
|
-
} else if (utils.isPlainObject(source)) {
|
|
41
|
-
return utils.merge({}, source);
|
|
42
|
-
} else if (utils.isArray(source)) {
|
|
43
|
-
return source.slice();
|
|
44
|
-
}
|
|
45
|
-
return source;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function mergeDeepProperties(a, b, prop, caseless) {
|
|
49
|
-
if (!utils.isUndefined(b)) {
|
|
50
|
-
return getMergedValue(a, b, prop, caseless);
|
|
51
|
-
} else if (!utils.isUndefined(a)) {
|
|
52
|
-
return getMergedValue(undefined, a, prop, caseless);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// eslint-disable-next-line consistent-return
|
|
57
|
-
function valueFromConfig2(a, b) {
|
|
58
|
-
if (!utils.isUndefined(b)) {
|
|
59
|
-
return getMergedValue(undefined, b);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// eslint-disable-next-line consistent-return
|
|
64
|
-
function defaultToConfig2(a, b) {
|
|
65
|
-
if (!utils.isUndefined(b)) {
|
|
66
|
-
return getMergedValue(undefined, b);
|
|
67
|
-
} else if (!utils.isUndefined(a)) {
|
|
68
|
-
return getMergedValue(undefined, a);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function getMergedTransitionalOption(prop) {
|
|
73
|
-
const transitional2 = utils.hasOwnProp(config2, 'transitional') ? config2.transitional : undefined;
|
|
74
|
-
|
|
75
|
-
if (!utils.isUndefined(transitional2)) {
|
|
76
|
-
if (utils.isPlainObject(transitional2)) {
|
|
77
|
-
if (utils.hasOwnProp(transitional2, prop)) {
|
|
78
|
-
return transitional2[prop];
|
|
79
|
-
}
|
|
80
|
-
} else {
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const transitional1 = utils.hasOwnProp(config1, 'transitional') ? config1.transitional : undefined;
|
|
86
|
-
|
|
87
|
-
if (utils.isPlainObject(transitional1) && utils.hasOwnProp(transitional1, prop)) {
|
|
88
|
-
return transitional1[prop];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return undefined;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// eslint-disable-next-line consistent-return
|
|
95
|
-
function mergeDirectKeys(a, b, prop) {
|
|
96
|
-
if (utils.hasOwnProp(config2, prop)) {
|
|
97
|
-
return getMergedValue(a, b);
|
|
98
|
-
} else if (utils.hasOwnProp(config1, prop)) {
|
|
99
|
-
return getMergedValue(undefined, a);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const mergeMap = {
|
|
104
|
-
url: valueFromConfig2,
|
|
105
|
-
method: valueFromConfig2,
|
|
106
|
-
data: valueFromConfig2,
|
|
107
|
-
baseURL: defaultToConfig2,
|
|
108
|
-
transformRequest: defaultToConfig2,
|
|
109
|
-
transformResponse: defaultToConfig2,
|
|
110
|
-
paramsSerializer: defaultToConfig2,
|
|
111
|
-
timeout: defaultToConfig2,
|
|
112
|
-
timeoutMessage: defaultToConfig2,
|
|
113
|
-
withCredentials: defaultToConfig2,
|
|
114
|
-
withXSRFToken: defaultToConfig2,
|
|
115
|
-
adapter: defaultToConfig2,
|
|
116
|
-
responseType: defaultToConfig2,
|
|
117
|
-
xsrfCookieName: defaultToConfig2,
|
|
118
|
-
xsrfHeaderName: defaultToConfig2,
|
|
119
|
-
onUploadProgress: defaultToConfig2,
|
|
120
|
-
onDownloadProgress: defaultToConfig2,
|
|
121
|
-
decompress: defaultToConfig2,
|
|
122
|
-
maxContentLength: defaultToConfig2,
|
|
123
|
-
maxBodyLength: defaultToConfig2,
|
|
124
|
-
beforeRedirect: defaultToConfig2,
|
|
125
|
-
transport: defaultToConfig2,
|
|
126
|
-
httpAgent: defaultToConfig2,
|
|
127
|
-
httpsAgent: defaultToConfig2,
|
|
128
|
-
cancelToken: defaultToConfig2,
|
|
129
|
-
socketPath: defaultToConfig2,
|
|
130
|
-
allowedSocketPaths: defaultToConfig2,
|
|
131
|
-
responseEncoding: defaultToConfig2,
|
|
132
|
-
validateStatus: mergeDirectKeys,
|
|
133
|
-
headers: (a, b, prop) =>
|
|
134
|
-
mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
utils.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
138
|
-
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
|
|
139
|
-
const merge = utils.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
140
|
-
const a = utils.hasOwnProp(config1, prop) ? config1[prop] : undefined;
|
|
141
|
-
const b = utils.hasOwnProp(config2, prop) ? config2[prop] : undefined;
|
|
142
|
-
const configValue = merge(a, b, prop);
|
|
143
|
-
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
if (
|
|
147
|
-
utils.hasOwnProp(config2, 'validateStatus') &&
|
|
148
|
-
utils.isUndefined(config2.validateStatus) &&
|
|
149
|
-
getMergedTransitionalOption('validateStatusUndefinedResolves') === false
|
|
150
|
-
) {
|
|
151
|
-
if (utils.hasOwnProp(config1, 'validateStatus')) {
|
|
152
|
-
config.validateStatus = getMergedValue(undefined, config1.validateStatus);
|
|
153
|
-
} else {
|
|
154
|
-
delete config.validateStatus;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return config;
|
|
159
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import AxiosError from './AxiosError.js';
|
|
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
|
-
* @returns {object} The response.
|
|
13
|
-
*/
|
|
14
|
-
export default function settle(resolve, reject, response) {
|
|
15
|
-
const validateStatus = response.config.validateStatus;
|
|
16
|
-
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
17
|
-
resolve(response);
|
|
18
|
-
} else {
|
|
19
|
-
reject(new AxiosError(
|
|
20
|
-
'Request failed with status code ' + response.status,
|
|
21
|
-
response.status >= 400 && response.status < 500 ? AxiosError.ERR_BAD_REQUEST : AxiosError.ERR_BAD_RESPONSE,
|
|
22
|
-
response.config,
|
|
23
|
-
response.request,
|
|
24
|
-
response
|
|
25
|
-
));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import utils from '../utils.js';
|
|
4
|
-
import defaults from '../defaults/index.js';
|
|
5
|
-
import AxiosHeaders from '../core/AxiosHeaders.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Transform the data for a request or a response
|
|
9
|
-
*
|
|
10
|
-
* @param {Array|Function} fns A single function or Array of functions
|
|
11
|
-
* @param {?Object} response The response object
|
|
12
|
-
*
|
|
13
|
-
* @returns {*} The resulting transformed data
|
|
14
|
-
*/
|
|
15
|
-
export default function transformData(fns, response) {
|
|
16
|
-
const config = this || defaults;
|
|
17
|
-
const context = response || config;
|
|
18
|
-
const headers = AxiosHeaders.from(context.headers);
|
|
19
|
-
let data = context.data;
|
|
20
|
-
|
|
21
|
-
utils.forEach(fns, function transform(fn) {
|
|
22
|
-
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
headers.normalize();
|
|
26
|
-
|
|
27
|
-
return data;
|
|
28
|
-
}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import utils from '../utils.js';
|
|
4
|
-
import AxiosError from '../core/AxiosError.js';
|
|
5
|
-
import transitionalDefaults from './transitional.js';
|
|
6
|
-
import toFormData from '../helpers/toFormData.js';
|
|
7
|
-
import toURLEncodedForm from '../helpers/toURLEncodedForm.js';
|
|
8
|
-
import platform from '../platform/index.js';
|
|
9
|
-
import formDataToJSON from '../helpers/formDataToJSON.js';
|
|
10
|
-
|
|
11
|
-
const own = (obj, key) => (obj != null && utils.hasOwnProp(obj, key) ? obj[key] : undefined);
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
|
15
|
-
* of the input
|
|
16
|
-
*
|
|
17
|
-
* @param {any} rawValue - The value to be stringified.
|
|
18
|
-
* @param {Function} parser - A function that parses a string into a JavaScript object.
|
|
19
|
-
* @param {Function} encoder - A function that takes a value and returns a string.
|
|
20
|
-
*
|
|
21
|
-
* @returns {string} A stringified version of the rawValue.
|
|
22
|
-
*/
|
|
23
|
-
function stringifySafely(rawValue, parser, encoder) {
|
|
24
|
-
if (utils.isString(rawValue)) {
|
|
25
|
-
try {
|
|
26
|
-
(parser || JSON.parse)(rawValue);
|
|
27
|
-
return utils.trim(rawValue);
|
|
28
|
-
} catch (e) {
|
|
29
|
-
if (e.name !== 'SyntaxError') {
|
|
30
|
-
throw e;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return (encoder || JSON.stringify)(rawValue);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const defaults = {
|
|
39
|
-
transitional: transitionalDefaults,
|
|
40
|
-
|
|
41
|
-
adapter: ['xhr', 'http', 'fetch'],
|
|
42
|
-
|
|
43
|
-
transformRequest: [
|
|
44
|
-
function transformRequest(data, headers) {
|
|
45
|
-
const contentType = headers.getContentType() || '';
|
|
46
|
-
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
47
|
-
const isObjectPayload = utils.isObject(data);
|
|
48
|
-
|
|
49
|
-
if (isObjectPayload && utils.isHTMLForm(data)) {
|
|
50
|
-
data = new FormData(data);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const isFormData = utils.isFormData(data);
|
|
54
|
-
|
|
55
|
-
if (isFormData) {
|
|
56
|
-
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (
|
|
60
|
-
utils.isArrayBuffer(data) ||
|
|
61
|
-
utils.isBuffer(data) ||
|
|
62
|
-
utils.isStream(data) ||
|
|
63
|
-
utils.isFile(data) ||
|
|
64
|
-
utils.isBlob(data) ||
|
|
65
|
-
utils.isReadableStream(data)
|
|
66
|
-
) {
|
|
67
|
-
return data;
|
|
68
|
-
}
|
|
69
|
-
if (utils.isArrayBufferView(data)) {
|
|
70
|
-
return data.buffer;
|
|
71
|
-
}
|
|
72
|
-
if (utils.isURLSearchParams(data)) {
|
|
73
|
-
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
74
|
-
return data.toString();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
let isFileList;
|
|
78
|
-
|
|
79
|
-
if (isObjectPayload) {
|
|
80
|
-
const formSerializer = own(this, 'formSerializer');
|
|
81
|
-
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
82
|
-
return toURLEncodedForm(data, formSerializer).toString();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (
|
|
86
|
-
(isFileList = utils.isFileList(data)) ||
|
|
87
|
-
contentType.indexOf('multipart/form-data') > -1
|
|
88
|
-
) {
|
|
89
|
-
const env = own(this, 'env');
|
|
90
|
-
const _FormData = env && env.FormData;
|
|
91
|
-
|
|
92
|
-
return toFormData(
|
|
93
|
-
isFileList ? { 'files[]': data } : data,
|
|
94
|
-
_FormData && new _FormData(),
|
|
95
|
-
formSerializer
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (isObjectPayload || hasJSONContentType) {
|
|
101
|
-
headers.setContentType('application/json', false);
|
|
102
|
-
return stringifySafely(data);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return data;
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
|
|
109
|
-
transformResponse: [
|
|
110
|
-
function transformResponse(data) {
|
|
111
|
-
const transitional = own(this, 'transitional') || defaults.transitional;
|
|
112
|
-
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
113
|
-
const responseType = own(this, 'responseType');
|
|
114
|
-
const JSONRequested = responseType === 'json';
|
|
115
|
-
|
|
116
|
-
if (utils.isResponse(data) || utils.isReadableStream(data)) {
|
|
117
|
-
return data;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (
|
|
121
|
-
data &&
|
|
122
|
-
utils.isString(data) &&
|
|
123
|
-
((forcedJSONParsing && !responseType) || JSONRequested)
|
|
124
|
-
) {
|
|
125
|
-
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
126
|
-
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
127
|
-
|
|
128
|
-
try {
|
|
129
|
-
return JSON.parse(data, own(this, 'parseReviver'));
|
|
130
|
-
} catch (e) {
|
|
131
|
-
if (strictJSONParsing) {
|
|
132
|
-
if (e.name === 'SyntaxError') {
|
|
133
|
-
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
|
|
134
|
-
}
|
|
135
|
-
throw e;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return data;
|
|
141
|
-
},
|
|
142
|
-
],
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
146
|
-
* timeout is not created.
|
|
147
|
-
*/
|
|
148
|
-
timeout: 0,
|
|
149
|
-
|
|
150
|
-
xsrfCookieName: 'XSRF-TOKEN',
|
|
151
|
-
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
152
|
-
|
|
153
|
-
maxContentLength: -1,
|
|
154
|
-
maxBodyLength: -1,
|
|
155
|
-
|
|
156
|
-
env: {
|
|
157
|
-
FormData: platform.classes.FormData,
|
|
158
|
-
Blob: platform.classes.Blob,
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
validateStatus: function validateStatus(status) {
|
|
162
|
-
return status >= 200 && status < 300;
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
headers: {
|
|
166
|
-
common: {
|
|
167
|
-
Accept: 'application/json, text/plain, */*',
|
|
168
|
-
'Content-Type': undefined,
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], (method) => {
|
|
174
|
-
defaults.headers[method] = {};
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
export default defaults;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const VERSION = "1.18.1";
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import stream from 'stream';
|
|
4
|
-
import utils from '../utils.js';
|
|
5
|
-
|
|
6
|
-
const kInternals = Symbol('internals');
|
|
7
|
-
|
|
8
|
-
class AxiosTransformStream extends stream.Transform {
|
|
9
|
-
constructor(options) {
|
|
10
|
-
options = utils.toFlatObject(
|
|
11
|
-
options,
|
|
12
|
-
{
|
|
13
|
-
maxRate: 0,
|
|
14
|
-
chunkSize: 64 * 1024,
|
|
15
|
-
minChunkSize: 100,
|
|
16
|
-
timeWindow: 500,
|
|
17
|
-
ticksRate: 2,
|
|
18
|
-
samplesCount: 15,
|
|
19
|
-
},
|
|
20
|
-
null,
|
|
21
|
-
(prop, source) => {
|
|
22
|
-
return !utils.isUndefined(source[prop]);
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
super({
|
|
27
|
-
readableHighWaterMark: options.chunkSize,
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const internals = (this[kInternals] = {
|
|
31
|
-
timeWindow: options.timeWindow,
|
|
32
|
-
chunkSize: options.chunkSize,
|
|
33
|
-
maxRate: options.maxRate,
|
|
34
|
-
minChunkSize: options.minChunkSize,
|
|
35
|
-
bytesSeen: 0,
|
|
36
|
-
isCaptured: false,
|
|
37
|
-
notifiedBytesLoaded: 0,
|
|
38
|
-
ts: Date.now(),
|
|
39
|
-
bytes: 0,
|
|
40
|
-
onReadCallback: null,
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
this.on('newListener', (event) => {
|
|
44
|
-
if (event === 'progress') {
|
|
45
|
-
if (!internals.isCaptured) {
|
|
46
|
-
internals.isCaptured = true;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
_read(size) {
|
|
53
|
-
const internals = this[kInternals];
|
|
54
|
-
|
|
55
|
-
if (internals.onReadCallback) {
|
|
56
|
-
internals.onReadCallback();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return super._read(size);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
_transform(chunk, encoding, callback) {
|
|
63
|
-
const internals = this[kInternals];
|
|
64
|
-
const maxRate = internals.maxRate;
|
|
65
|
-
|
|
66
|
-
const readableHighWaterMark = this.readableHighWaterMark;
|
|
67
|
-
|
|
68
|
-
const timeWindow = internals.timeWindow;
|
|
69
|
-
|
|
70
|
-
const divider = 1000 / timeWindow;
|
|
71
|
-
const bytesThreshold = maxRate / divider;
|
|
72
|
-
const minChunkSize =
|
|
73
|
-
internals.minChunkSize !== false
|
|
74
|
-
? Math.max(internals.minChunkSize, bytesThreshold * 0.01)
|
|
75
|
-
: 0;
|
|
76
|
-
|
|
77
|
-
const pushChunk = (_chunk, _callback) => {
|
|
78
|
-
const bytes = Buffer.byteLength(_chunk);
|
|
79
|
-
internals.bytesSeen += bytes;
|
|
80
|
-
internals.bytes += bytes;
|
|
81
|
-
|
|
82
|
-
internals.isCaptured && this.emit('progress', internals.bytesSeen);
|
|
83
|
-
|
|
84
|
-
if (this.push(_chunk)) {
|
|
85
|
-
process.nextTick(_callback);
|
|
86
|
-
} else {
|
|
87
|
-
internals.onReadCallback = () => {
|
|
88
|
-
internals.onReadCallback = null;
|
|
89
|
-
process.nextTick(_callback);
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const transformChunk = (_chunk, _callback) => {
|
|
95
|
-
const chunkSize = Buffer.byteLength(_chunk);
|
|
96
|
-
let chunkRemainder = null;
|
|
97
|
-
let maxChunkSize = readableHighWaterMark;
|
|
98
|
-
let bytesLeft;
|
|
99
|
-
let passed = 0;
|
|
100
|
-
|
|
101
|
-
if (maxRate) {
|
|
102
|
-
const now = Date.now();
|
|
103
|
-
|
|
104
|
-
if (!internals.ts || (passed = now - internals.ts) >= timeWindow) {
|
|
105
|
-
internals.ts = now;
|
|
106
|
-
bytesLeft = bytesThreshold - internals.bytes;
|
|
107
|
-
internals.bytes = bytesLeft < 0 ? -bytesLeft : 0;
|
|
108
|
-
passed = 0;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
bytesLeft = bytesThreshold - internals.bytes;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (maxRate) {
|
|
115
|
-
if (bytesLeft <= 0) {
|
|
116
|
-
// next time window
|
|
117
|
-
return setTimeout(() => {
|
|
118
|
-
_callback(null, _chunk);
|
|
119
|
-
}, timeWindow - passed);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (bytesLeft < maxChunkSize) {
|
|
123
|
-
maxChunkSize = bytesLeft;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (maxChunkSize && chunkSize > maxChunkSize && chunkSize - maxChunkSize > minChunkSize) {
|
|
128
|
-
chunkRemainder = _chunk.subarray(maxChunkSize);
|
|
129
|
-
_chunk = _chunk.subarray(0, maxChunkSize);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
pushChunk(
|
|
133
|
-
_chunk,
|
|
134
|
-
chunkRemainder
|
|
135
|
-
? () => {
|
|
136
|
-
process.nextTick(_callback, null, chunkRemainder);
|
|
137
|
-
}
|
|
138
|
-
: _callback
|
|
139
|
-
);
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
transformChunk(chunk, function transformNextChunk(err, _chunk) {
|
|
143
|
-
if (err) {
|
|
144
|
-
return callback(err);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (_chunk) {
|
|
148
|
-
transformChunk(_chunk, transformNextChunk);
|
|
149
|
-
} else {
|
|
150
|
-
callback(null);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export default AxiosTransformStream;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import toFormData from './toFormData.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* It encodes a string by replacing all characters that are not in the unreserved set with
|
|
7
|
-
* their percent-encoded equivalents
|
|
8
|
-
*
|
|
9
|
-
* @param {string} str - The string to encode.
|
|
10
|
-
*
|
|
11
|
-
* @returns {string} The encoded string.
|
|
12
|
-
*/
|
|
13
|
-
function encode(str) {
|
|
14
|
-
const charMap = {
|
|
15
|
-
'!': '%21',
|
|
16
|
-
"'": '%27',
|
|
17
|
-
'(': '%28',
|
|
18
|
-
')': '%29',
|
|
19
|
-
'~': '%7E',
|
|
20
|
-
'%20': '+',
|
|
21
|
-
};
|
|
22
|
-
return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
|
|
23
|
-
return charMap[match];
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* It takes a params object and converts it to a FormData object
|
|
29
|
-
*
|
|
30
|
-
* @param {Object<string, any>} params - The parameters to be converted to a FormData object.
|
|
31
|
-
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
|
32
|
-
*
|
|
33
|
-
* @returns {void}
|
|
34
|
-
*/
|
|
35
|
-
function AxiosURLSearchParams(params, options) {
|
|
36
|
-
this._pairs = [];
|
|
37
|
-
|
|
38
|
-
params && toFormData(params, this, options);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const prototype = AxiosURLSearchParams.prototype;
|
|
42
|
-
|
|
43
|
-
prototype.append = function append(name, value) {
|
|
44
|
-
this._pairs.push([name, value]);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
prototype.toString = function toString(encoder) {
|
|
48
|
-
const _encode = encoder
|
|
49
|
-
? (value) => encoder.call(this, value, encode)
|
|
50
|
-
: encode;
|
|
51
|
-
|
|
52
|
-
return this._pairs
|
|
53
|
-
.map(function each(pair) {
|
|
54
|
-
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
55
|
-
}, '')
|
|
56
|
-
.join('&');
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export default AxiosURLSearchParams;
|