node-red-contrib-tak-registration 0.1.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/LICENSE +14 -0
- package/README.md +35 -0
- package/node_modules/adm-zip/LICENSE +21 -0
- package/node_modules/adm-zip/README.md +65 -0
- package/node_modules/adm-zip/adm-zip.js +783 -0
- package/node_modules/adm-zip/headers/entryHeader.js +338 -0
- package/node_modules/adm-zip/headers/index.js +2 -0
- package/node_modules/adm-zip/headers/mainHeader.js +129 -0
- package/node_modules/adm-zip/methods/deflater.js +33 -0
- package/node_modules/adm-zip/methods/index.js +3 -0
- package/node_modules/adm-zip/methods/inflater.js +31 -0
- package/node_modules/adm-zip/methods/zipcrypto.js +170 -0
- package/node_modules/adm-zip/package.json +77 -0
- package/node_modules/adm-zip/util/constants.js +142 -0
- package/node_modules/adm-zip/util/errors.js +35 -0
- package/node_modules/adm-zip/util/fattr.js +79 -0
- package/node_modules/adm-zip/util/fileSystem.js +11 -0
- package/node_modules/adm-zip/util/index.js +4 -0
- package/node_modules/adm-zip/util/utils.js +246 -0
- package/node_modules/adm-zip/zipEntry.js +333 -0
- package/node_modules/adm-zip/zipFile.js +384 -0
- package/node_modules/asynckit/LICENSE +21 -0
- package/node_modules/asynckit/README.md +233 -0
- package/node_modules/asynckit/bench.js +76 -0
- package/node_modules/asynckit/index.js +6 -0
- package/node_modules/asynckit/lib/abort.js +29 -0
- package/node_modules/asynckit/lib/async.js +34 -0
- package/node_modules/asynckit/lib/defer.js +26 -0
- package/node_modules/asynckit/lib/iterate.js +75 -0
- package/node_modules/asynckit/lib/readable_asynckit.js +91 -0
- package/node_modules/asynckit/lib/readable_parallel.js +25 -0
- package/node_modules/asynckit/lib/readable_serial.js +25 -0
- package/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
- package/node_modules/asynckit/lib/state.js +37 -0
- package/node_modules/asynckit/lib/streamify.js +141 -0
- package/node_modules/asynckit/lib/terminator.js +29 -0
- package/node_modules/asynckit/package.json +91 -0
- package/node_modules/asynckit/parallel.js +43 -0
- package/node_modules/asynckit/serial.js +17 -0
- package/node_modules/asynckit/serialOrdered.js +75 -0
- package/node_modules/asynckit/stream.js +21 -0
- package/node_modules/axios/CHANGELOG.md +836 -0
- package/node_modules/axios/LICENSE +19 -0
- package/node_modules/axios/README.md +892 -0
- package/node_modules/axios/SECURITY.md +5 -0
- package/node_modules/axios/UPGRADE_GUIDE.md +162 -0
- package/node_modules/axios/dist/axios.js +2275 -0
- package/node_modules/axios/dist/axios.map +1 -0
- package/node_modules/axios/dist/axios.min.js +2 -0
- package/node_modules/axios/dist/axios.min.map +1 -0
- package/node_modules/axios/index.d.ts +206 -0
- package/node_modules/axios/index.js +1 -0
- package/node_modules/axios/lib/adapters/README.md +37 -0
- package/node_modules/axios/lib/adapters/http.js +363 -0
- package/node_modules/axios/lib/adapters/xhr.js +212 -0
- package/node_modules/axios/lib/axios.js +57 -0
- package/node_modules/axios/lib/cancel/Cancel.js +19 -0
- package/node_modules/axios/lib/cancel/CancelToken.js +119 -0
- package/node_modules/axios/lib/cancel/isCancel.js +5 -0
- package/node_modules/axios/lib/core/Axios.js +148 -0
- package/node_modules/axios/lib/core/InterceptorManager.js +54 -0
- package/node_modules/axios/lib/core/README.md +8 -0
- package/node_modules/axios/lib/core/buildFullPath.js +20 -0
- package/node_modules/axios/lib/core/createError.js +18 -0
- package/node_modules/axios/lib/core/dispatchRequest.js +87 -0
- package/node_modules/axios/lib/core/enhanceError.js +43 -0
- package/node_modules/axios/lib/core/mergeConfig.js +99 -0
- package/node_modules/axios/lib/core/settle.js +25 -0
- package/node_modules/axios/lib/core/transformData.js +22 -0
- package/node_modules/axios/lib/defaults.js +134 -0
- package/node_modules/axios/lib/env/README.md +3 -0
- package/node_modules/axios/lib/env/data.js +3 -0
- package/node_modules/axios/lib/helpers/README.md +7 -0
- package/node_modules/axios/lib/helpers/bind.js +11 -0
- package/node_modules/axios/lib/helpers/buildURL.js +70 -0
- package/node_modules/axios/lib/helpers/combineURLs.js +14 -0
- package/node_modules/axios/lib/helpers/cookies.js +53 -0
- package/node_modules/axios/lib/helpers/deprecatedMethod.js +24 -0
- package/node_modules/axios/lib/helpers/isAbsoluteURL.js +14 -0
- package/node_modules/axios/lib/helpers/isAxiosError.js +11 -0
- package/node_modules/axios/lib/helpers/isURLSameOrigin.js +68 -0
- package/node_modules/axios/lib/helpers/normalizeHeaderName.js +12 -0
- package/node_modules/axios/lib/helpers/parseHeaders.js +53 -0
- package/node_modules/axios/lib/helpers/spread.js +27 -0
- package/node_modules/axios/lib/helpers/validator.js +82 -0
- package/node_modules/axios/lib/utils.js +349 -0
- package/node_modules/axios/package.json +113 -0
- package/node_modules/axios/tsconfig.json +14 -0
- package/node_modules/axios/tslint.json +6 -0
- package/node_modules/combined-stream/License +19 -0
- package/node_modules/combined-stream/Readme.md +138 -0
- package/node_modules/combined-stream/lib/combined_stream.js +208 -0
- package/node_modules/combined-stream/package.json +57 -0
- package/node_modules/combined-stream/yarn.lock +17 -0
- package/node_modules/delayed-stream/.npmignore +1 -0
- package/node_modules/delayed-stream/License +19 -0
- package/node_modules/delayed-stream/Makefile +7 -0
- package/node_modules/delayed-stream/Readme.md +141 -0
- package/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
- package/node_modules/delayed-stream/package.json +62 -0
- package/node_modules/follow-redirects/LICENSE +18 -0
- package/node_modules/follow-redirects/README.md +148 -0
- package/node_modules/follow-redirects/debug.js +15 -0
- package/node_modules/follow-redirects/http.js +1 -0
- package/node_modules/follow-redirects/https.js +1 -0
- package/node_modules/follow-redirects/index.js +569 -0
- package/node_modules/follow-redirects/package.json +95 -0
- package/node_modules/form-data/License +19 -0
- package/node_modules/form-data/README.md.bak +358 -0
- package/node_modules/form-data/Readme.md +358 -0
- package/node_modules/form-data/index.d.ts +62 -0
- package/node_modules/form-data/lib/browser.js +2 -0
- package/node_modules/form-data/lib/form_data.js +501 -0
- package/node_modules/form-data/lib/populate.js +10 -0
- package/node_modules/form-data/package.json +101 -0
- package/node_modules/mime-db/HISTORY.md +499 -0
- package/node_modules/mime-db/LICENSE +22 -0
- package/node_modules/mime-db/README.md +100 -0
- package/node_modules/mime-db/db.json +8471 -0
- package/node_modules/mime-db/index.js +11 -0
- package/node_modules/mime-db/package.json +102 -0
- package/node_modules/mime-types/HISTORY.md +388 -0
- package/node_modules/mime-types/LICENSE +23 -0
- package/node_modules/mime-types/README.md +113 -0
- package/node_modules/mime-types/index.js +188 -0
- package/node_modules/mime-types/package.json +87 -0
- package/node_modules/uuid/CHANGELOG.md +229 -0
- package/node_modules/uuid/CONTRIBUTING.md +18 -0
- package/node_modules/uuid/LICENSE.md +9 -0
- package/node_modules/uuid/README.md +505 -0
- package/node_modules/uuid/dist/bin/uuid +2 -0
- package/node_modules/uuid/dist/esm-browser/index.js +9 -0
- package/node_modules/uuid/dist/esm-browser/md5.js +215 -0
- package/node_modules/uuid/dist/esm-browser/nil.js +1 -0
- package/node_modules/uuid/dist/esm-browser/parse.js +35 -0
- package/node_modules/uuid/dist/esm-browser/regex.js +1 -0
- package/node_modules/uuid/dist/esm-browser/rng.js +19 -0
- package/node_modules/uuid/dist/esm-browser/sha1.js +96 -0
- package/node_modules/uuid/dist/esm-browser/stringify.js +30 -0
- package/node_modules/uuid/dist/esm-browser/v1.js +95 -0
- package/node_modules/uuid/dist/esm-browser/v3.js +4 -0
- package/node_modules/uuid/dist/esm-browser/v35.js +64 -0
- package/node_modules/uuid/dist/esm-browser/v4.js +24 -0
- package/node_modules/uuid/dist/esm-browser/v5.js +4 -0
- package/node_modules/uuid/dist/esm-browser/validate.js +7 -0
- package/node_modules/uuid/dist/esm-browser/version.js +11 -0
- package/node_modules/uuid/dist/esm-node/index.js +9 -0
- package/node_modules/uuid/dist/esm-node/md5.js +13 -0
- package/node_modules/uuid/dist/esm-node/nil.js +1 -0
- package/node_modules/uuid/dist/esm-node/parse.js +35 -0
- package/node_modules/uuid/dist/esm-node/regex.js +1 -0
- package/node_modules/uuid/dist/esm-node/rng.js +12 -0
- package/node_modules/uuid/dist/esm-node/sha1.js +13 -0
- package/node_modules/uuid/dist/esm-node/stringify.js +29 -0
- package/node_modules/uuid/dist/esm-node/v1.js +95 -0
- package/node_modules/uuid/dist/esm-node/v3.js +4 -0
- package/node_modules/uuid/dist/esm-node/v35.js +64 -0
- package/node_modules/uuid/dist/esm-node/v4.js +24 -0
- package/node_modules/uuid/dist/esm-node/v5.js +4 -0
- package/node_modules/uuid/dist/esm-node/validate.js +7 -0
- package/node_modules/uuid/dist/esm-node/version.js +11 -0
- package/node_modules/uuid/dist/index.js +79 -0
- package/node_modules/uuid/dist/md5-browser.js +223 -0
- package/node_modules/uuid/dist/md5.js +23 -0
- package/node_modules/uuid/dist/nil.js +8 -0
- package/node_modules/uuid/dist/parse.js +45 -0
- package/node_modules/uuid/dist/regex.js +8 -0
- package/node_modules/uuid/dist/rng-browser.js +26 -0
- package/node_modules/uuid/dist/rng.js +24 -0
- package/node_modules/uuid/dist/sha1-browser.js +104 -0
- package/node_modules/uuid/dist/sha1.js +23 -0
- package/node_modules/uuid/dist/stringify.js +39 -0
- package/node_modules/uuid/dist/umd/uuid.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidNIL.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidParse.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidStringify.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidValidate.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidVersion.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidv1.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidv3.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidv4.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidv5.min.js +1 -0
- package/node_modules/uuid/dist/uuid-bin.js +85 -0
- package/node_modules/uuid/dist/v1.js +107 -0
- package/node_modules/uuid/dist/v3.js +16 -0
- package/node_modules/uuid/dist/v35.js +78 -0
- package/node_modules/uuid/dist/v4.js +37 -0
- package/node_modules/uuid/dist/v5.js +16 -0
- package/node_modules/uuid/dist/validate.js +17 -0
- package/node_modules/uuid/dist/version.js +21 -0
- package/node_modules/uuid/package.json +164 -0
- package/node_modules/uuid/wrapper.mjs +10 -0
- package/package.json +32 -0
- package/tak-registration.html +111 -0
- package/tak-registration.js +169 -0
|
@@ -0,0 +1,87 @@
|
|
|
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 Cancel = require('../cancel/Cancel');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Throws a `Cancel` 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 Cancel('canceled');
|
|
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
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Update an Error with the specified config, error code, and response.
|
|
5
|
+
*
|
|
6
|
+
* @param {Error} error The error to update.
|
|
7
|
+
* @param {Object} config The config.
|
|
8
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
9
|
+
* @param {Object} [request] The request.
|
|
10
|
+
* @param {Object} [response] The response.
|
|
11
|
+
* @returns {Error} The error.
|
|
12
|
+
*/
|
|
13
|
+
module.exports = function enhanceError(error, config, code, request, response) {
|
|
14
|
+
error.config = config;
|
|
15
|
+
if (code) {
|
|
16
|
+
error.code = code;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
error.request = request;
|
|
20
|
+
error.response = response;
|
|
21
|
+
error.isAxiosError = true;
|
|
22
|
+
|
|
23
|
+
error.toJSON = function toJSON() {
|
|
24
|
+
return {
|
|
25
|
+
// Standard
|
|
26
|
+
message: this.message,
|
|
27
|
+
name: this.name,
|
|
28
|
+
// Microsoft
|
|
29
|
+
description: this.description,
|
|
30
|
+
number: this.number,
|
|
31
|
+
// Mozilla
|
|
32
|
+
fileName: this.fileName,
|
|
33
|
+
lineNumber: this.lineNumber,
|
|
34
|
+
columnNumber: this.columnNumber,
|
|
35
|
+
stack: this.stack,
|
|
36
|
+
// Axios
|
|
37
|
+
config: this.config,
|
|
38
|
+
code: this.code,
|
|
39
|
+
status: this.response && this.response.status ? this.response.status : null
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
return error;
|
|
43
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
'transport': defaultToConfig2,
|
|
84
|
+
'httpAgent': defaultToConfig2,
|
|
85
|
+
'httpsAgent': defaultToConfig2,
|
|
86
|
+
'cancelToken': defaultToConfig2,
|
|
87
|
+
'socketPath': defaultToConfig2,
|
|
88
|
+
'responseEncoding': defaultToConfig2,
|
|
89
|
+
'validateStatus': mergeDirectKeys
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
|
93
|
+
var merge = mergeMap[prop] || mergeDeepProperties;
|
|
94
|
+
var configValue = merge(prop);
|
|
95
|
+
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
return config;
|
|
99
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var createError = require('./createError');
|
|
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(createError(
|
|
18
|
+
'Request failed with status code ' + response.status,
|
|
19
|
+
response.config,
|
|
20
|
+
null,
|
|
21
|
+
response.request,
|
|
22
|
+
response
|
|
23
|
+
));
|
|
24
|
+
}
|
|
25
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('./utils');
|
|
4
|
+
var normalizeHeaderName = require('./helpers/normalizeHeaderName');
|
|
5
|
+
var enhanceError = require('./core/enhanceError');
|
|
6
|
+
|
|
7
|
+
var DEFAULT_CONTENT_TYPE = {
|
|
8
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
function setContentTypeIfUnset(headers, value) {
|
|
12
|
+
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
|
|
13
|
+
headers['Content-Type'] = value;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getDefaultAdapter() {
|
|
18
|
+
var adapter;
|
|
19
|
+
if (typeof XMLHttpRequest !== 'undefined') {
|
|
20
|
+
// For browsers use XHR adapter
|
|
21
|
+
adapter = require('./adapters/xhr');
|
|
22
|
+
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
|
23
|
+
// For node use HTTP adapter
|
|
24
|
+
adapter = require('./adapters/http');
|
|
25
|
+
}
|
|
26
|
+
return adapter;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
30
|
+
if (utils.isString(rawValue)) {
|
|
31
|
+
try {
|
|
32
|
+
(parser || JSON.parse)(rawValue);
|
|
33
|
+
return utils.trim(rawValue);
|
|
34
|
+
} catch (e) {
|
|
35
|
+
if (e.name !== 'SyntaxError') {
|
|
36
|
+
throw e;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var defaults = {
|
|
45
|
+
|
|
46
|
+
transitional: {
|
|
47
|
+
silentJSONParsing: true,
|
|
48
|
+
forcedJSONParsing: true,
|
|
49
|
+
clarifyTimeoutError: false
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
adapter: getDefaultAdapter(),
|
|
53
|
+
|
|
54
|
+
transformRequest: [function transformRequest(data, headers) {
|
|
55
|
+
normalizeHeaderName(headers, 'Accept');
|
|
56
|
+
normalizeHeaderName(headers, 'Content-Type');
|
|
57
|
+
|
|
58
|
+
if (utils.isFormData(data) ||
|
|
59
|
+
utils.isArrayBuffer(data) ||
|
|
60
|
+
utils.isBuffer(data) ||
|
|
61
|
+
utils.isStream(data) ||
|
|
62
|
+
utils.isFile(data) ||
|
|
63
|
+
utils.isBlob(data)
|
|
64
|
+
) {
|
|
65
|
+
return data;
|
|
66
|
+
}
|
|
67
|
+
if (utils.isArrayBufferView(data)) {
|
|
68
|
+
return data.buffer;
|
|
69
|
+
}
|
|
70
|
+
if (utils.isURLSearchParams(data)) {
|
|
71
|
+
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
|
72
|
+
return data.toString();
|
|
73
|
+
}
|
|
74
|
+
if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) {
|
|
75
|
+
setContentTypeIfUnset(headers, 'application/json');
|
|
76
|
+
return stringifySafely(data);
|
|
77
|
+
}
|
|
78
|
+
return data;
|
|
79
|
+
}],
|
|
80
|
+
|
|
81
|
+
transformResponse: [function transformResponse(data) {
|
|
82
|
+
var transitional = this.transitional || defaults.transitional;
|
|
83
|
+
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
84
|
+
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
85
|
+
var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
|
|
86
|
+
|
|
87
|
+
if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {
|
|
88
|
+
try {
|
|
89
|
+
return JSON.parse(data);
|
|
90
|
+
} catch (e) {
|
|
91
|
+
if (strictJSONParsing) {
|
|
92
|
+
if (e.name === 'SyntaxError') {
|
|
93
|
+
throw enhanceError(e, this, 'E_JSON_PARSE');
|
|
94
|
+
}
|
|
95
|
+
throw e;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return data;
|
|
101
|
+
}],
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
105
|
+
* timeout is not created.
|
|
106
|
+
*/
|
|
107
|
+
timeout: 0,
|
|
108
|
+
|
|
109
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
|
110
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
111
|
+
|
|
112
|
+
maxContentLength: -1,
|
|
113
|
+
maxBodyLength: -1,
|
|
114
|
+
|
|
115
|
+
validateStatus: function validateStatus(status) {
|
|
116
|
+
return status >= 200 && status < 300;
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
headers: {
|
|
120
|
+
common: {
|
|
121
|
+
'Accept': 'application/json, text/plain, */*'
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
|
127
|
+
defaults.headers[method] = {};
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
131
|
+
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
module.exports = defaults;
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Determines whether the payload is an error thrown by Axios
|
|
5
|
+
*
|
|
6
|
+
* @param {*} payload The value to test
|
|
7
|
+
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
8
|
+
*/
|
|
9
|
+
module.exports = function isAxiosError(payload) {
|
|
10
|
+
return (typeof payload === 'object') && (payload.isAxiosError === true);
|
|
11
|
+
};
|