summaryrefslogtreecommitdiff
path: root/alarm/node_modules/axios/lib/core
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-10-18 08:59:09 +0200
committerMinteck <contact@minteck.org>2022-10-18 08:59:09 +0200
commit2c4ae43e688a9873e86211ea0e7aeb9ba770dd77 (patch)
tree17848d95522dab25d3cdeb9c4a6450e2a234861f /alarm/node_modules/axios/lib/core
parent108525534c28013cfe1897c30e4565f9893f3766 (diff)
downloadpluralconnect-2c4ae43e688a9873e86211ea0e7aeb9ba770dd77.tar.gz
pluralconnect-2c4ae43e688a9873e86211ea0e7aeb9ba770dd77.tar.bz2
pluralconnect-2c4ae43e688a9873e86211ea0e7aeb9ba770dd77.zip
Update
Diffstat (limited to 'alarm/node_modules/axios/lib/core')
-rw-r--r--alarm/node_modules/axios/lib/core/Axios.js188
-rw-r--r--alarm/node_modules/axios/lib/core/AxiosError.js100
-rw-r--r--alarm/node_modules/axios/lib/core/AxiosHeaders.js274
-rw-r--r--alarm/node_modules/axios/lib/core/InterceptorManager.js71
-rw-r--r--alarm/node_modules/axios/lib/core/README.md8
-rw-r--r--alarm/node_modules/axios/lib/core/buildFullPath.js21
-rw-r--r--alarm/node_modules/axios/lib/core/dispatchRequest.js76
-rw-r--r--alarm/node_modules/axios/lib/core/mergeConfig.js101
-rw-r--r--alarm/node_modules/axios/lib/core/settle.js27
-rw-r--r--alarm/node_modules/axios/lib/core/transformData.js28
10 files changed, 894 insertions, 0 deletions
diff --git a/alarm/node_modules/axios/lib/core/Axios.js b/alarm/node_modules/axios/lib/core/Axios.js
new file mode 100644
index 0000000..a7cf75c
--- /dev/null
+++ b/alarm/node_modules/axios/lib/core/Axios.js
@@ -0,0 +1,188 @@
+'use strict';
+
+import utils from './../utils.js';
+import buildURL from '../helpers/buildURL.js';
+import InterceptorManager from './InterceptorManager.js';
+import dispatchRequest from './dispatchRequest.js';
+import mergeConfig from './mergeConfig.js';
+import buildFullPath from './buildFullPath.js';
+import validator from '../helpers/validator.js';
+import AxiosHeaders from './AxiosHeaders.js';
+
+const validators = validator.validators;
+
+/**
+ * Create a new instance of Axios
+ *
+ * @param {Object} instanceConfig The default config for the instance
+ *
+ * @return {Axios} A new instance of Axios
+ */
+class Axios {
+ constructor(instanceConfig) {
+ this.defaults = instanceConfig;
+ this.interceptors = {
+ request: new InterceptorManager(),
+ response: new InterceptorManager()
+ };
+ }
+
+ /**
+ * Dispatch a request
+ *
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
+ * @param {?Object} config
+ *
+ * @returns {Promise} The Promise to be fulfilled
+ */
+ request(configOrUrl, config) {
+ /*eslint no-param-reassign:0*/
+ // Allow for axios('example/url'[, config]) a la fetch API
+ if (typeof configOrUrl === 'string') {
+ config = config || {};
+ config.url = configOrUrl;
+ } else {
+ config = configOrUrl || {};
+ }
+
+ config = mergeConfig(this.defaults, config);
+
+ const transitional = config.transitional;
+
+ if (transitional !== undefined) {
+ validator.assertOptions(transitional, {
+ silentJSONParsing: validators.transitional(validators.boolean),
+ forcedJSONParsing: validators.transitional(validators.boolean),
+ clarifyTimeoutError: validators.transitional(validators.boolean)
+ }, false);
+ }
+
+ // Set config.method
+ config.method = (config.method || this.defaults.method || 'get').toLowerCase();
+
+ // Flatten headers
+ const defaultHeaders = config.headers && utils.merge(
+ config.headers.common,
+ config.headers[config.method]
+ );
+
+ defaultHeaders && utils.forEach(
+ ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
+ function cleanHeaderConfig(method) {
+ delete config.headers[method];
+ }
+ );
+
+ config.headers = new AxiosHeaders(config.headers, defaultHeaders);
+
+ // filter out skipped interceptors
+ const requestInterceptorChain = [];
+ let synchronousRequestInterceptors = true;
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
+ if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
+ return;
+ }
+
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
+
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
+ });
+
+ const responseInterceptorChain = [];
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
+ });
+
+ let promise;
+ let i = 0;
+ let len;
+
+ if (!synchronousRequestInterceptors) {
+ const chain = [dispatchRequest.bind(this), undefined];
+ chain.unshift.apply(chain, requestInterceptorChain);
+ chain.push.apply(chain, responseInterceptorChain);
+ len = chain.length;
+
+ promise = Promise.resolve(config);
+
+ while (i < len) {
+ promise = promise.then(chain[i++], chain[i++]);
+ }
+
+ return promise;
+ }
+
+ len = requestInterceptorChain.length;
+
+ let newConfig = config;
+
+ i = 0;
+
+ while (i < len) {
+ const onFulfilled = requestInterceptorChain[i++];
+ const onRejected = requestInterceptorChain[i++];
+ try {
+ newConfig = onFulfilled(newConfig);
+ } catch (error) {
+ onRejected.call(this, error);
+ break;
+ }
+ }
+
+ try {
+ promise = dispatchRequest.call(this, newConfig);
+ } catch (error) {
+ return Promise.reject(error);
+ }
+
+ i = 0;
+ len = responseInterceptorChain.length;
+
+ while (i < len) {
+ promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
+ }
+
+ return promise;
+ }
+
+ getUri(config) {
+ config = mergeConfig(this.defaults, config);
+ const fullPath = buildFullPath(config.baseURL, config.url);
+ return buildURL(fullPath, config.params, config.paramsSerializer);
+ }
+}
+
+// Provide aliases for supported request methods
+utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
+ /*eslint func-names:0*/
+ Axios.prototype[method] = function(url, config) {
+ return this.request(mergeConfig(config || {}, {
+ method,
+ url,
+ data: (config || {}).data
+ }));
+ };
+});
+
+utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
+ /*eslint func-names:0*/
+
+ function generateHTTPMethod(isForm) {
+ return function httpMethod(url, data, config) {
+ return this.request(mergeConfig(config || {}, {
+ method,
+ headers: isForm ? {
+ 'Content-Type': 'multipart/form-data'
+ } : {},
+ url,
+ data
+ }));
+ };
+ }
+
+ Axios.prototype[method] = generateHTTPMethod();
+
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
+});
+
+export default Axios;
diff --git a/alarm/node_modules/axios/lib/core/AxiosError.js b/alarm/node_modules/axios/lib/core/AxiosError.js
new file mode 100644
index 0000000..1539e9a
--- /dev/null
+++ b/alarm/node_modules/axios/lib/core/AxiosError.js
@@ -0,0 +1,100 @@
+'use strict';
+
+import utils from '../utils.js';
+
+/**
+ * Create an Error with the specified message, config, error code, request and response.
+ *
+ * @param {string} message The error message.
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
+ * @param {Object} [config] The config.
+ * @param {Object} [request] The request.
+ * @param {Object} [response] The response.
+ *
+ * @returns {Error} The created error.
+ */
+function AxiosError(message, code, config, request, response) {
+ Error.call(this);
+
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(this, this.constructor);
+ } else {
+ this.stack = (new Error()).stack;
+ }
+
+ this.message = message;
+ this.name = 'AxiosError';
+ code && (this.code = code);
+ config && (this.config = config);
+ request && (this.request = request);
+ response && (this.response = response);
+}
+
+utils.inherits(AxiosError, Error, {
+ toJSON: function toJSON() {
+ return {
+ // Standard
+ message: this.message,
+ name: this.name,
+ // Microsoft
+ description: this.description,
+ number: this.number,
+ // Mozilla
+ fileName: this.fileName,
+ lineNumber: this.lineNumber,
+ columnNumber: this.columnNumber,
+ stack: this.stack,
+ // Axios
+ config: this.config,
+ code: this.code,
+ status: this.response && this.response.status ? this.response.status : null
+ };
+ }
+});
+
+const prototype = AxiosError.prototype;
+const descriptors = {};
+
+[
+ 'ERR_BAD_OPTION_VALUE',
+ 'ERR_BAD_OPTION',
+ 'ECONNABORTED',
+ 'ETIMEDOUT',
+ 'ERR_NETWORK',
+ 'ERR_FR_TOO_MANY_REDIRECTS',
+ 'ERR_DEPRECATED',
+ 'ERR_BAD_RESPONSE',
+ 'ERR_BAD_REQUEST',
+ 'ERR_CANCELED',
+ 'ERR_NOT_SUPPORT',
+ 'ERR_INVALID_URL'
+// eslint-disable-next-line func-names
+].forEach(code => {
+ descriptors[code] = {value: code};
+});
+
+Object.defineProperties(AxiosError, descriptors);
+Object.defineProperty(prototype, 'isAxiosError', {value: true});
+
+// eslint-disable-next-line func-names
+AxiosError.from = (error, code, config, request, response, customProps) => {
+ const axiosError = Object.create(prototype);
+
+ utils.toFlatObject(error, axiosError, function filter(obj) {
+ return obj !== Error.prototype;
+ }, prop => {
+ return prop !== 'isAxiosError';
+ });
+
+ AxiosError.call(axiosError, error.message, code, config, request, response);
+
+ axiosError.cause = error;
+
+ axiosError.name = error.name;
+
+ customProps && Object.assign(axiosError, customProps);
+
+ return axiosError;
+};
+
+export default AxiosError;
diff --git a/alarm/node_modules/axios/lib/core/AxiosHeaders.js b/alarm/node_modules/axios/lib/core/AxiosHeaders.js
new file mode 100644
index 0000000..9d56538
--- /dev/null
+++ b/alarm/node_modules/axios/lib/core/AxiosHeaders.js
@@ -0,0 +1,274 @@
+'use strict';
+
+import utils from '../utils.js';
+import parseHeaders from '../helpers/parseHeaders.js';
+
+const $internals = Symbol('internals');
+const $defaults = Symbol('defaults');
+
+function normalizeHeader(header) {
+ return header && String(header).trim().toLowerCase();
+}
+
+function normalizeValue(value) {
+ if (value === false || value == null) {
+ return value;
+ }
+
+ return String(value);
+}
+
+function parseTokens(str) {
+ const tokens = Object.create(null);
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
+ let match;
+
+ while ((match = tokensRE.exec(str))) {
+ tokens[match[1]] = match[2];
+ }
+
+ return tokens;
+}
+
+function matchHeaderValue(context, value, header, filter) {
+ if (utils.isFunction(filter)) {
+ return filter.call(this, value, header);
+ }
+
+ if (!utils.isString(value)) return;
+
+ if (utils.isString(filter)) {
+ return value.indexOf(filter) !== -1;
+ }
+
+ if (utils.isRegExp(filter)) {
+ return filter.test(value);
+ }
+}
+
+function formatHeader(header) {
+ return header.trim()
+ .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
+ return char.toUpperCase() + str;
+ });
+}
+
+function buildAccessors(obj, header) {
+ const accessorName = utils.toCamelCase(' ' + header);
+
+ ['get', 'set', 'has'].forEach(methodName => {
+ Object.defineProperty(obj, methodName + accessorName, {
+ value: function(arg1, arg2, arg3) {
+ return this[methodName].call(this, header, arg1, arg2, arg3);
+ },
+ configurable: true
+ });
+ });
+}
+
+function findKey(obj, key) {
+ key = key.toLowerCase();
+ const keys = Object.keys(obj);
+ let i = keys.length;
+ let _key;
+ while (i-- > 0) {
+ _key = keys[i];
+ if (key === _key.toLowerCase()) {
+ return _key;
+ }
+ }
+ return null;
+}
+
+function AxiosHeaders(headers, defaults) {
+ headers && this.set(headers);
+ this[$defaults] = defaults || null;
+}
+
+Object.assign(AxiosHeaders.prototype, {
+ set: function(header, valueOrRewrite, rewrite) {
+ const self = this;
+
+ function setHeader(_value, _header, _rewrite) {
+ const lHeader = normalizeHeader(_header);
+
+ if (!lHeader) {
+ throw new Error('header name must be a non-empty string');
+ }
+
+ const key = findKey(self, lHeader);
+
+ if (key && _rewrite !== true && (self[key] === false || _rewrite === false)) {
+ return;
+ }
+
+ if (utils.isArray(_value)) {
+ _value = _value.map(normalizeValue);
+ } else {
+ _value = normalizeValue(_value);
+ }
+
+ self[key || _header] = _value;
+ }
+
+ if (utils.isPlainObject(header)) {
+ utils.forEach(header, (_value, _header) => {
+ setHeader(_value, _header, valueOrRewrite);
+ });
+ } else {
+ setHeader(valueOrRewrite, header, rewrite);
+ }
+
+ return this;
+ },
+
+ get: function(header, parser) {
+ header = normalizeHeader(header);
+
+ if (!header) return undefined;
+
+ const key = findKey(this, header);
+
+ if (key) {
+ const value = this[key];
+
+ if (!parser) {
+ return value;
+ }
+
+ if (parser === true) {
+ return parseTokens(value);
+ }
+
+ if (utils.isFunction(parser)) {
+ return parser.call(this, value, key);
+ }
+
+ if (utils.isRegExp(parser)) {
+ return parser.exec(value);
+ }
+
+ throw new TypeError('parser must be boolean|regexp|function');
+ }
+ },
+
+ has: function(header, matcher) {
+ header = normalizeHeader(header);
+
+ if (header) {
+ const key = findKey(this, header);
+
+ return !!(key && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
+ }
+
+ return false;
+ },
+
+ delete: function(header, matcher) {
+ const self = this;
+ let deleted = false;
+
+ function deleteHeader(_header) {
+ _header = normalizeHeader(_header);
+
+ if (_header) {
+ const key = findKey(self, _header);
+
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
+ delete self[key];
+
+ deleted = true;
+ }
+ }
+ }
+
+ if (utils.isArray(header)) {
+ header.forEach(deleteHeader);
+ } else {
+ deleteHeader(header);
+ }
+
+ return deleted;
+ },
+
+ clear: function() {
+ return Object.keys(this).forEach(this.delete.bind(this));
+ },
+
+ normalize: function(format) {
+ const self = this;
+ const headers = {};
+
+ utils.forEach(this, (value, header) => {
+ const key = findKey(headers, header);
+
+ if (key) {
+ self[key] = normalizeValue(value);
+ delete self[header];
+ return;
+ }
+
+ const normalized = format ? formatHeader(header) : String(header).trim();
+
+ if (normalized !== header) {
+ delete self[header];
+ }
+
+ self[normalized] = normalizeValue(value);
+
+ headers[normalized] = true;
+ });
+
+ return this;
+ },
+
+ toJSON: function() {
+ const obj = Object.create(null);
+
+ utils.forEach(Object.assign({}, this[$defaults] || null, this),
+ (value, header) => {
+ if (value == null || value === false) return;
+ obj[header] = utils.isArray(value) ? value.join(', ') : value;
+ });
+
+ return obj;
+ }
+});
+
+Object.assign(AxiosHeaders, {
+ from: function(thing) {
+ if (utils.isString(thing)) {
+ return new this(parseHeaders(thing));
+ }
+ return thing instanceof this ? thing : new this(thing);
+ },
+
+ accessor: function(header) {
+ const internals = this[$internals] = (this[$internals] = {
+ accessors: {}
+ });
+
+ const accessors = internals.accessors;
+ const prototype = this.prototype;
+
+ function defineAccessor(_header) {
+ const lHeader = normalizeHeader(_header);
+
+ if (!accessors[lHeader]) {
+ buildAccessors(prototype, _header);
+ accessors[lHeader] = true;
+ }
+ }
+
+ utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
+
+ return this;
+ }
+});
+
+AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent']);
+
+utils.freezeMethods(AxiosHeaders.prototype);
+utils.freezeMethods(AxiosHeaders);
+
+export default AxiosHeaders;
diff --git a/alarm/node_modules/axios/lib/core/InterceptorManager.js b/alarm/node_modules/axios/lib/core/InterceptorManager.js
new file mode 100644
index 0000000..6657a9d
--- /dev/null
+++ b/alarm/node_modules/axios/lib/core/InterceptorManager.js
@@ -0,0 +1,71 @@
+'use strict';
+
+import utils from './../utils.js';
+
+class InterceptorManager {
+ constructor() {
+ this.handlers = [];
+ }
+
+ /**
+ * Add a new interceptor to the stack
+ *
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
+ *
+ * @return {Number} An ID used to remove interceptor later
+ */
+ use(fulfilled, rejected, options) {
+ this.handlers.push({
+ fulfilled,
+ rejected,
+ synchronous: options ? options.synchronous : false,
+ runWhen: options ? options.runWhen : null
+ });
+ return this.handlers.length - 1;
+ }
+
+ /**
+ * Remove an interceptor from the stack
+ *
+ * @param {Number} id The ID that was returned by `use`
+ *
+ * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
+ */
+ eject(id) {
+ if (this.handlers[id]) {
+ this.handlers[id] = null;
+ }
+ }
+
+ /**
+ * Clear all interceptors from the stack
+ *
+ * @returns {void}
+ */
+ clear() {
+ if (this.handlers) {
+ this.handlers = [];
+ }
+ }
+
+ /**
+ * Iterate over all the registered interceptors
+ *
+ * This method is particularly useful for skipping over any
+ * interceptors that may have become `null` calling `eject`.
+ *
+ * @param {Function} fn The function to call for each interceptor
+ *
+ * @returns {void}
+ */
+ forEach(fn) {
+ utils.forEach(this.handlers, function forEachHandler(h) {
+ if (h !== null) {
+ fn(h);
+ }
+ });
+ }
+}
+
+export default InterceptorManager;
diff --git a/alarm/node_modules/axios/lib/core/README.md b/alarm/node_modules/axios/lib/core/README.md
new file mode 100644
index 0000000..84559ce
--- /dev/null
+++ b/alarm/node_modules/axios/lib/core/README.md
@@ -0,0 +1,8 @@
+# axios // core
+
+The modules found in `core/` should be modules that are specific to the domain logic of axios. These modules would most likely not make sense to be consumed outside of the axios module, as their logic is too specific. Some examples of core modules are:
+
+- Dispatching requests
+ - Requests sent via `adapters/` (see lib/adapters/README.md)
+- Managing interceptors
+- Handling config
diff --git a/alarm/node_modules/axios/lib/core/buildFullPath.js b/alarm/node_modules/axios/lib/core/buildFullPath.js
new file mode 100644
index 0000000..b60927c
--- /dev/null
+++ b/alarm/node_modules/axios/lib/core/buildFullPath.js
@@ -0,0 +1,21 @@
+'use strict';
+
+import isAbsoluteURL from '../helpers/isAbsoluteURL.js';
+import combineURLs from '../helpers/combineURLs.js';
+
+/**
+ * Creates a new URL by combining the baseURL with the requestedURL,
+ * only when the requestedURL is not already an absolute URL.
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
+ *
+ * @param {string} baseURL The base URL
+ * @param {string} requestedURL Absolute or relative URL to combine
+ *
+ * @returns {string} The combined full path
+ */
+export default function buildFullPath(baseURL, requestedURL) {
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
+ return combineURLs(baseURL, requestedURL);
+ }
+ return requestedURL;
+}
diff --git a/alarm/node_modules/axios/lib/core/dispatchRequest.js b/alarm/node_modules/axios/lib/core/dispatchRequest.js
new file mode 100644
index 0000000..46ced28
--- /dev/null
+++ b/alarm/node_modules/axios/lib/core/dispatchRequest.js
@@ -0,0 +1,76 @@
+'use strict';
+
+import transformData from './transformData.js';
+import isCancel from '../cancel/isCancel.js';
+import defaults from '../defaults/index.js';
+import CanceledError from '../cancel/CanceledError.js';
+import AxiosHeaders from '../core/AxiosHeaders.js';
+
+/**
+ * Throws a `CanceledError` if cancellation has been requested.
+ *
+ * @param {Object} config The config that is to be used for the request
+ *
+ * @returns {void}
+ */
+function throwIfCancellationRequested(config) {
+ if (config.cancelToken) {
+ config.cancelToken.throwIfRequested();
+ }
+
+ if (config.signal && config.signal.aborted) {
+ throw new CanceledError();
+ }
+}
+
+/**
+ * Dispatch a request to the server using the configured adapter.
+ *
+ * @param {object} config The config that is to be used for the request
+ *
+ * @returns {Promise} The Promise to be fulfilled
+ */
+export default function dispatchRequest(config) {
+ throwIfCancellationRequested(config);
+
+ config.headers = AxiosHeaders.from(config.headers);
+
+ // Transform request data
+ config.data = transformData.call(
+ config,
+ config.transformRequest
+ );
+
+ const adapter = config.adapter || defaults.adapter;
+
+ return adapter(config).then(function onAdapterResolution(response) {
+ throwIfCancellationRequested(config);
+
+ // Transform response data
+ response.data = transformData.call(
+ config,
+ config.transformResponse,
+ response
+ );
+
+ response.headers = AxiosHeaders.from(response.headers);
+
+ return response;
+ }, function onAdapterRejection(reason) {
+ if (!isCancel(reason)) {
+ throwIfCancellationRequested(config);
+
+ // Transform response data
+ if (reason && reason.response) {
+ reason.response.data = transformData.call(
+ config,
+ config.transformResponse,
+ reason.response
+ );
+ reason.response.headers = AxiosHeaders.from(reason.response.headers);
+ }
+ }
+
+ return Promise.reject(reason);
+ });
+}
diff --git a/alarm/node_modules/axios/lib/core/mergeConfig.js b/alarm/node_modules/axios/lib/core/mergeConfig.js
new file mode 100644
index 0000000..328e631
--- /dev/null
+++ b/alarm/node_modules/axios/lib/core/mergeConfig.js
@@ -0,0 +1,101 @@
+'use strict';
+
+import utils from '../utils.js';
+
+/**
+ * Config-specific merge-function which creates a new config-object
+ * by merging two configuration objects together.
+ *
+ * @param {Object} config1
+ * @param {Object} config2
+ *
+ * @returns {Object} New object resulting from merging config2 to config1
+ */
+export default function mergeConfig(config1, config2) {
+ // eslint-disable-next-line no-param-reassign
+ config2 = config2 || {};
+ const config = {};
+
+ function getMergedValue(target, source) {
+ if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
+ return utils.merge(target, source);
+ } else if (utils.isPlainObject(source)) {
+ return utils.merge({}, source);
+ } else if (utils.isArray(source)) {
+ return source.slice();
+ }
+ return source;
+ }
+
+ // eslint-disable-next-line consistent-return
+ function mergeDeepProperties(prop) {
+ if (!utils.isUndefined(config2[prop])) {
+ return getMergedValue(config1[prop], config2[prop]);
+ } else if (!utils.isUndefined(config1[prop])) {
+ return getMergedValue(undefined, config1[prop]);
+ }
+ }
+
+ // eslint-disable-next-line consistent-return
+ function valueFromConfig2(prop) {
+ if (!utils.isUndefined(config2[prop])) {
+ return getMergedValue(undefined, config2[prop]);
+ }
+ }
+
+ // eslint-disable-next-line consistent-return
+ function defaultToConfig2(prop) {
+ if (!utils.isUndefined(config2[prop])) {
+ return getMergedValue(undefined, config2[prop]);
+ } else if (!utils.isUndefined(config1[prop])) {
+ return getMergedValue(undefined, config1[prop]);
+ }
+ }
+
+ // eslint-disable-next-line consistent-return
+ function mergeDirectKeys(prop) {
+ if (prop in config2) {
+ return getMergedValue(config1[prop], config2[prop]);
+ } else if (prop in config1) {
+ return getMergedValue(undefined, config1[prop]);
+ }
+ }
+
+ const mergeMap = {
+ 'url': valueFromConfig2,
+ 'method': valueFromConfig2,
+ 'data': valueFromConfig2,
+ 'baseURL': defaultToConfig2,
+ 'transformRequest': defaultToConfig2,
+ 'transformResponse': defaultToConfig2,
+ 'paramsSerializer': defaultToConfig2,
+ 'timeout': defaultToConfig2,
+ 'timeoutMessage': defaultToConfig2,
+ 'withCredentials': defaultToConfig2,
+ 'adapter': defaultToConfig2,
+ 'responseType': defaultToConfig2,
+ 'xsrfCookieName': defaultToConfig2,
+ 'xsrfHeaderName': defaultToConfig2,
+ 'onUploadProgress': defaultToConfig2,
+ 'onDownloadProgress': defaultToConfig2,
+ 'decompress': defaultToConfig2,
+ 'maxContentLength': defaultToConfig2,
+ 'maxBodyLength': defaultToConfig2,
+ 'beforeRedirect': defaultToConfig2,
+ 'transport': defaultToConfig2,
+ 'httpAgent': defaultToConfig2,
+ 'httpsAgent': defaultToConfig2,
+ 'cancelToken': defaultToConfig2,
+ 'socketPath': defaultToConfig2,
+ 'responseEncoding': defaultToConfig2,
+ 'validateStatus': mergeDirectKeys
+ };
+
+ utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
+ const merge = mergeMap[prop] || mergeDeepProperties;
+ const configValue = merge(prop);
+ (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
+ });
+
+ return config;
+}
diff --git a/alarm/node_modules/axios/lib/core/settle.js b/alarm/node_modules/axios/lib/core/settle.js
new file mode 100644
index 0000000..ac905c4
--- /dev/null
+++ b/alarm/node_modules/axios/lib/core/settle.js
@@ -0,0 +1,27 @@
+'use strict';
+
+import AxiosError from './AxiosError.js';
+
+/**
+ * Resolve or reject a Promise based on response status.
+ *
+ * @param {Function} resolve A function that resolves the promise.
+ * @param {Function} reject A function that rejects the promise.
+ * @param {object} response The response.
+ *
+ * @returns {object} The response.
+ */
+export default function settle(resolve, reject, response) {
+ const validateStatus = response.config.validateStatus;
+ if (!response.status || !validateStatus || validateStatus(response.status)) {
+ resolve(response);
+ } else {
+ reject(new AxiosError(
+ 'Request failed with status code ' + response.status,
+ [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
+ response.config,
+ response.request,
+ response
+ ));
+ }
+}
diff --git a/alarm/node_modules/axios/lib/core/transformData.js b/alarm/node_modules/axios/lib/core/transformData.js
new file mode 100644
index 0000000..eeb5a8a
--- /dev/null
+++ b/alarm/node_modules/axios/lib/core/transformData.js
@@ -0,0 +1,28 @@
+'use strict';
+
+import utils from './../utils.js';
+import defaults from '../defaults/index.js';
+import AxiosHeaders from '../core/AxiosHeaders.js';
+
+/**
+ * Transform the data for a request or a response
+ *
+ * @param {Array|Function} fns A single function or Array of functions
+ * @param {?Object} response The response object
+ *
+ * @returns {*} The resulting transformed data
+ */
+export default function transformData(fns, response) {
+ const config = this || defaults;
+ const context = response || config;
+ const headers = AxiosHeaders.from(context.headers);
+ let data = context.data;
+
+ utils.forEach(fns, function transform(fn) {
+ data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
+ });
+
+ headers.normalize();
+
+ return data;
+}