2020-02-24 09:23:15 +00:00
|
|
|
|
module.exports =
|
|
|
|
|
/******/ (function(modules, runtime) { // webpackBootstrap
|
|
|
|
|
/******/ "use strict";
|
|
|
|
|
/******/ // The module cache
|
|
|
|
|
/******/ var installedModules = {};
|
|
|
|
|
/******/
|
|
|
|
|
/******/ // The require function
|
|
|
|
|
/******/ function __webpack_require__(moduleId) {
|
|
|
|
|
/******/
|
|
|
|
|
/******/ // Check if module is in cache
|
|
|
|
|
/******/ if(installedModules[moduleId]) {
|
|
|
|
|
/******/ return installedModules[moduleId].exports;
|
|
|
|
|
/******/ }
|
|
|
|
|
/******/ // Create a new module (and put it into the cache)
|
|
|
|
|
/******/ var module = installedModules[moduleId] = {
|
|
|
|
|
/******/ i: moduleId,
|
|
|
|
|
/******/ l: false,
|
|
|
|
|
/******/ exports: {}
|
|
|
|
|
/******/ };
|
|
|
|
|
/******/
|
|
|
|
|
/******/ // Execute the module function
|
2020-12-16 20:37:11 +00:00
|
|
|
|
/******/ var threw = true;
|
|
|
|
|
/******/ try {
|
|
|
|
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
|
|
|
/******/ threw = false;
|
|
|
|
|
/******/ } finally {
|
|
|
|
|
/******/ if(threw) delete installedModules[moduleId];
|
|
|
|
|
/******/ }
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/******/
|
|
|
|
|
/******/ // Flag the module as loaded
|
|
|
|
|
/******/ module.l = true;
|
|
|
|
|
/******/
|
|
|
|
|
/******/ // Return the exports of the module
|
|
|
|
|
/******/ return module.exports;
|
|
|
|
|
/******/ }
|
|
|
|
|
/******/
|
|
|
|
|
/******/
|
|
|
|
|
/******/ __webpack_require__.ab = __dirname + "/";
|
|
|
|
|
/******/
|
|
|
|
|
/******/ // the startup function
|
|
|
|
|
/******/ function startup() {
|
|
|
|
|
/******/ // Load entry module and return exports
|
|
|
|
|
/******/ return __webpack_require__(676);
|
|
|
|
|
/******/ };
|
|
|
|
|
/******/
|
|
|
|
|
/******/ // run startup
|
|
|
|
|
/******/ return startup();
|
|
|
|
|
/******/ })
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
/******/ ({
|
|
|
|
|
|
|
|
|
|
/***/ 26:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var enhanceError = __webpack_require__(369);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create an Error with the specified message, config, error code, request and response.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} message The error message.
|
|
|
|
|
* @param {Object} config The config.
|
|
|
|
|
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
|
|
|
* @param {Object} [request] The request.
|
|
|
|
|
* @param {Object} [response] The response.
|
|
|
|
|
* @returns {Error} The created error.
|
|
|
|
|
*/
|
|
|
|
|
module.exports = function createError(message, config, code, request, response) {
|
|
|
|
|
var error = new Error(message);
|
|
|
|
|
return enhanceError(error, config, code, request, response);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 35:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var bind = __webpack_require__(727);
|
|
|
|
|
|
|
|
|
|
// utils is a library of generic helper functions non-specific to axios
|
|
|
|
|
|
|
|
|
|
var toString = Object.prototype.toString;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine if a value is an Array
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} val The value to test
|
|
|
|
|
* @returns {boolean} True if value is an Array, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
function isArray(val) {
|
|
|
|
|
return toString.call(val) === '[object Array]';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine if a value is undefined
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} val The value to test
|
|
|
|
|
* @returns {boolean} True if the value is undefined, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
function isUndefined(val) {
|
|
|
|
|
return typeof val === 'undefined';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine if a value is a Buffer
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} val The value to test
|
|
|
|
|
* @returns {boolean} True if value is a Buffer, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
function isBuffer(val) {
|
|
|
|
|
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
|
|
|
|
&& typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine if a value is an ArrayBuffer
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} val The value to test
|
|
|
|
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
function isArrayBuffer(val) {
|
|
|
|
|
return toString.call(val) === '[object ArrayBuffer]';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine if a value is a FormData
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} val The value to test
|
|
|
|
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
function isFormData(val) {
|
|
|
|
|
return (typeof FormData !== 'undefined') && (val instanceof FormData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine if a value is a view on an ArrayBuffer
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} val The value to test
|
|
|
|
|
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
function isArrayBufferView(val) {
|
|
|
|
|
var result;
|
|
|
|
|
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
|
|
|
|
result = ArrayBuffer.isView(val);
|
|
|
|
|
} else {
|
|
|
|
|
result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine if a value is a String
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} val The value to test
|
|
|
|
|
* @returns {boolean} True if value is a String, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
function isString(val) {
|
|
|
|
|
return typeof val === 'string';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine if a value is a Number
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} val The value to test
|
|
|
|
|
* @returns {boolean} True if value is a Number, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
function isNumber(val) {
|
|
|
|
|
return typeof val === 'number';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine if a value is an Object
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} val The value to test
|
|
|
|
|
* @returns {boolean} True if value is an Object, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
function isObject(val) {
|
|
|
|
|
return val !== null && typeof val === 'object';
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* Determine if a value is a plain Object
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} val The value to test
|
|
|
|
|
* @return {boolean} True if value is a plain Object, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
function isPlainObject(val) {
|
|
|
|
|
if (toString.call(val) !== '[object Object]') {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var prototype = Object.getPrototypeOf(val);
|
|
|
|
|
return prototype === null || prototype === Object.prototype;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/**
|
|
|
|
|
* Determine if a value is a Date
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} val The value to test
|
|
|
|
|
* @returns {boolean} True if value is a Date, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
function isDate(val) {
|
|
|
|
|
return toString.call(val) === '[object Date]';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine if a value is a File
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} val The value to test
|
|
|
|
|
* @returns {boolean} True if value is a File, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
function isFile(val) {
|
|
|
|
|
return toString.call(val) === '[object File]';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine if a value is a Blob
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} val The value to test
|
|
|
|
|
* @returns {boolean} True if value is a Blob, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
function isBlob(val) {
|
|
|
|
|
return toString.call(val) === '[object Blob]';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine if a value is a Function
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} val The value to test
|
|
|
|
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
function isFunction(val) {
|
|
|
|
|
return toString.call(val) === '[object Function]';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine if a value is a Stream
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} val The value to test
|
|
|
|
|
* @returns {boolean} True if value is a Stream, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
function isStream(val) {
|
|
|
|
|
return isObject(val) && isFunction(val.pipe);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine if a value is a URLSearchParams object
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} val The value to test
|
|
|
|
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
function isURLSearchParams(val) {
|
|
|
|
|
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Trim excess whitespace off the beginning and end of a string
|
|
|
|
|
*
|
|
|
|
|
* @param {String} str The String to trim
|
|
|
|
|
* @returns {String} The String freed of excess whitespace
|
|
|
|
|
*/
|
|
|
|
|
function trim(str) {
|
2021-09-09 12:42:30 +00:00
|
|
|
|
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine if we're running in a standard browser environment
|
|
|
|
|
*
|
|
|
|
|
* This allows axios to run in a web worker, and react-native.
|
|
|
|
|
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
|
|
|
*
|
|
|
|
|
* web workers:
|
|
|
|
|
* typeof window -> undefined
|
|
|
|
|
* typeof document -> undefined
|
|
|
|
|
*
|
|
|
|
|
* react-native:
|
|
|
|
|
* navigator.product -> 'ReactNative'
|
|
|
|
|
* nativescript
|
|
|
|
|
* navigator.product -> 'NativeScript' or 'NS'
|
|
|
|
|
*/
|
|
|
|
|
function isStandardBrowserEnv() {
|
|
|
|
|
if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
|
|
|
|
|
navigator.product === 'NativeScript' ||
|
|
|
|
|
navigator.product === 'NS')) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return (
|
|
|
|
|
typeof window !== 'undefined' &&
|
|
|
|
|
typeof document !== 'undefined'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Iterate over an Array or an Object invoking a function for each item.
|
|
|
|
|
*
|
|
|
|
|
* If `obj` is an Array callback will be called passing
|
|
|
|
|
* the value, index, and complete array for each item.
|
|
|
|
|
*
|
|
|
|
|
* If 'obj' is an Object callback will be called passing
|
|
|
|
|
* the value, key, and complete object for each property.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object|Array} obj The object to iterate
|
|
|
|
|
* @param {Function} fn The callback to invoke for each item
|
|
|
|
|
*/
|
|
|
|
|
function forEach(obj, fn) {
|
|
|
|
|
// Don't bother if no value provided
|
|
|
|
|
if (obj === null || typeof obj === 'undefined') {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Force an array if not already something iterable
|
|
|
|
|
if (typeof obj !== 'object') {
|
|
|
|
|
/*eslint no-param-reassign:0*/
|
|
|
|
|
obj = [obj];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isArray(obj)) {
|
|
|
|
|
// Iterate over array values
|
|
|
|
|
for (var i = 0, l = obj.length; i < l; i++) {
|
|
|
|
|
fn.call(null, obj[i], i, obj);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// Iterate over object keys
|
|
|
|
|
for (var key in obj) {
|
|
|
|
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
|
|
|
fn.call(null, obj[key], key, obj);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Accepts varargs expecting each argument to be an object, then
|
|
|
|
|
* immutably merges the properties of each object and returns result.
|
|
|
|
|
*
|
|
|
|
|
* When multiple objects contain the same key the later object in
|
|
|
|
|
* the arguments list will take precedence.
|
|
|
|
|
*
|
|
|
|
|
* Example:
|
|
|
|
|
*
|
|
|
|
|
* ```js
|
|
|
|
|
* var result = merge({foo: 123}, {foo: 456});
|
|
|
|
|
* console.log(result.foo); // outputs 456
|
|
|
|
|
* ```
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} obj1 Object to merge
|
|
|
|
|
* @returns {Object} Result of all merge properties
|
|
|
|
|
*/
|
|
|
|
|
function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
|
|
var result = {};
|
|
|
|
|
function assignValue(val, key) {
|
2020-10-01 20:20:08 +00:00
|
|
|
|
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
2020-02-24 09:23:15 +00:00
|
|
|
|
result[key] = merge(result[key], val);
|
2020-10-01 20:20:08 +00:00
|
|
|
|
} else if (isPlainObject(val)) {
|
|
|
|
|
result[key] = merge({}, val);
|
|
|
|
|
} else if (isArray(val)) {
|
|
|
|
|
result[key] = val.slice();
|
2020-02-24 09:23:15 +00:00
|
|
|
|
} else {
|
|
|
|
|
result[key] = val;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
|
|
|
forEach(arguments[i], assignValue);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Extends object a by mutably adding to it the properties of object b.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} a The object to be extended
|
|
|
|
|
* @param {Object} b The object to copy properties from
|
|
|
|
|
* @param {Object} thisArg The object to bind function to
|
|
|
|
|
* @return {Object} The resulting value of object a
|
|
|
|
|
*/
|
|
|
|
|
function extend(a, b, thisArg) {
|
|
|
|
|
forEach(b, function assignValue(val, key) {
|
|
|
|
|
if (thisArg && typeof val === 'function') {
|
|
|
|
|
a[key] = bind(val, thisArg);
|
|
|
|
|
} else {
|
|
|
|
|
a[key] = val;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return a;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
|
|
|
|
*
|
|
|
|
|
* @param {string} content with BOM
|
|
|
|
|
* @return {string} content value without BOM
|
|
|
|
|
*/
|
|
|
|
|
function stripBOM(content) {
|
|
|
|
|
if (content.charCodeAt(0) === 0xFEFF) {
|
|
|
|
|
content = content.slice(1);
|
|
|
|
|
}
|
|
|
|
|
return content;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
module.exports = {
|
|
|
|
|
isArray: isArray,
|
|
|
|
|
isArrayBuffer: isArrayBuffer,
|
|
|
|
|
isBuffer: isBuffer,
|
|
|
|
|
isFormData: isFormData,
|
|
|
|
|
isArrayBufferView: isArrayBufferView,
|
|
|
|
|
isString: isString,
|
|
|
|
|
isNumber: isNumber,
|
|
|
|
|
isObject: isObject,
|
2020-10-01 20:20:08 +00:00
|
|
|
|
isPlainObject: isPlainObject,
|
2020-02-24 09:23:15 +00:00
|
|
|
|
isUndefined: isUndefined,
|
|
|
|
|
isDate: isDate,
|
|
|
|
|
isFile: isFile,
|
|
|
|
|
isBlob: isBlob,
|
|
|
|
|
isFunction: isFunction,
|
|
|
|
|
isStream: isStream,
|
|
|
|
|
isURLSearchParams: isURLSearchParams,
|
|
|
|
|
isStandardBrowserEnv: isStandardBrowserEnv,
|
|
|
|
|
forEach: forEach,
|
|
|
|
|
merge: merge,
|
|
|
|
|
extend: extend,
|
2020-10-01 20:20:08 +00:00
|
|
|
|
trim: trim,
|
|
|
|
|
stripBOM: stripBOM
|
2020-02-24 09:23:15 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 53:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
module.exports = __webpack_require__(352);
|
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 69:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
// populates missing values
|
|
|
|
|
module.exports = function(dst, src) {
|
|
|
|
|
|
|
|
|
|
Object.keys(src).forEach(function(prop)
|
|
|
|
|
{
|
|
|
|
|
dst[prop] = dst[prop] || src[prop];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return dst;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
/***/ 82:
|
|
|
|
|
/***/ (function(__unusedmodule, exports) {
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
"use strict";
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
// We use any as a valid input type
|
|
|
|
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2021-09-09 12:42:30 +00:00
|
|
|
|
exports.toCommandProperties = exports.toCommandValue = void 0;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/**
|
2020-10-01 20:20:08 +00:00
|
|
|
|
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
|
|
|
|
* @param input input to sanitize into a string
|
2020-02-24 09:23:15 +00:00
|
|
|
|
*/
|
2020-10-01 20:20:08 +00:00
|
|
|
|
function toCommandValue(input) {
|
|
|
|
|
if (input === null || input === undefined) {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
else if (typeof input === 'string' || input instanceof String) {
|
|
|
|
|
return input;
|
|
|
|
|
}
|
|
|
|
|
return JSON.stringify(input);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
2020-10-01 20:20:08 +00:00
|
|
|
|
exports.toCommandValue = toCommandValue;
|
2021-09-09 12:42:30 +00:00
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param annotationProperties
|
|
|
|
|
* @returns The command properties to send with the actual annotation command
|
|
|
|
|
* See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
|
|
|
|
|
*/
|
|
|
|
|
function toCommandProperties(annotationProperties) {
|
|
|
|
|
if (!Object.keys(annotationProperties).length) {
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
title: annotationProperties.title,
|
|
|
|
|
line: annotationProperties.startLine,
|
|
|
|
|
endLine: annotationProperties.endLine,
|
|
|
|
|
col: annotationProperties.startColumn,
|
|
|
|
|
endColumn: annotationProperties.endColumn
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
exports.toCommandProperties = toCommandProperties;
|
2020-10-01 20:20:08 +00:00
|
|
|
|
//# sourceMappingURL=utils.js.map
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
/***/ }),
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
/***/ 87:
|
|
|
|
|
/***/ (function(module) {
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
module.exports = require("os");
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 91:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var serialOrdered = __webpack_require__(892);
|
|
|
|
|
|
|
|
|
|
// Public API
|
|
|
|
|
module.exports = serial;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Runs iterator over provided array elements in series
|
|
|
|
|
*
|
|
|
|
|
* @param {array|object} list - array or object (named list) to iterate over
|
|
|
|
|
* @param {function} iterator - iterator to run
|
|
|
|
|
* @param {function} callback - invoked when all elements processed
|
|
|
|
|
* @returns {function} - jobs terminator
|
|
|
|
|
*/
|
|
|
|
|
function serial(list, iterator, callback)
|
|
|
|
|
{
|
|
|
|
|
return serialOrdered(list, iterator, null, callback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
/***/ }),
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
/***/ 102:
|
|
|
|
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
"use strict";
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
// For internal use, subject to change.
|
2021-09-09 12:42:30 +00:00
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
2020-10-01 20:20:08 +00:00
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
2021-09-09 12:42:30 +00:00
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
2020-10-01 20:20:08 +00:00
|
|
|
|
return result;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
};
|
2020-10-01 20:20:08 +00:00
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2021-09-09 12:42:30 +00:00
|
|
|
|
exports.issueCommand = void 0;
|
2020-10-01 20:20:08 +00:00
|
|
|
|
// We use any as a valid input type
|
|
|
|
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
|
|
|
const fs = __importStar(__webpack_require__(747));
|
|
|
|
|
const os = __importStar(__webpack_require__(87));
|
|
|
|
|
const utils_1 = __webpack_require__(82);
|
|
|
|
|
function issueCommand(command, message) {
|
|
|
|
|
const filePath = process.env[`GITHUB_${command}`];
|
|
|
|
|
if (!filePath) {
|
|
|
|
|
throw new Error(`Unable to find environment variable for file command ${command}`);
|
|
|
|
|
}
|
|
|
|
|
if (!fs.existsSync(filePath)) {
|
|
|
|
|
throw new Error(`Missing file at path: ${filePath}`);
|
|
|
|
|
}
|
|
|
|
|
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
|
|
|
|
|
encoding: 'utf8'
|
|
|
|
|
});
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
2020-10-01 20:20:08 +00:00
|
|
|
|
exports.issueCommand = issueCommand;
|
|
|
|
|
//# sourceMappingURL=file-command.js.map
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2021-01-05 17:57:45 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 104:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determines whether the payload is an error thrown by Axios
|
|
|
|
|
*
|
|
|
|
|
* @param {*} payload The value to test
|
|
|
|
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
module.exports = function isAxiosError(payload) {
|
|
|
|
|
return (typeof payload === 'object') && (payload.isAxiosError === true);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2021-09-09 12:42:30 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 106:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var pkg = __webpack_require__(361);
|
|
|
|
|
|
|
|
|
|
var validators = {};
|
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line func-names
|
|
|
|
|
['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
|
|
|
|
|
validators[type] = function validator(thing) {
|
|
|
|
|
return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var deprecatedWarnings = {};
|
|
|
|
|
var currentVerArr = pkg.version.split('.');
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Compare package versions
|
|
|
|
|
* @param {string} version
|
|
|
|
|
* @param {string?} thanVersion
|
|
|
|
|
* @returns {boolean}
|
|
|
|
|
*/
|
|
|
|
|
function isOlderVersion(version, thanVersion) {
|
|
|
|
|
var pkgVersionArr = thanVersion ? thanVersion.split('.') : currentVerArr;
|
|
|
|
|
var destVer = version.split('.');
|
|
|
|
|
for (var i = 0; i < 3; i++) {
|
|
|
|
|
if (pkgVersionArr[i] > destVer[i]) {
|
|
|
|
|
return true;
|
|
|
|
|
} else if (pkgVersionArr[i] < destVer[i]) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Transitional option validator
|
|
|
|
|
* @param {function|boolean?} validator
|
|
|
|
|
* @param {string?} version
|
|
|
|
|
* @param {string} message
|
|
|
|
|
* @returns {function}
|
|
|
|
|
*/
|
|
|
|
|
validators.transitional = function transitional(validator, version, message) {
|
|
|
|
|
var isDeprecated = version && isOlderVersion(version);
|
|
|
|
|
|
|
|
|
|
function formatMessage(opt, desc) {
|
|
|
|
|
return '[Axios v' + pkg.version + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line func-names
|
|
|
|
|
return function(value, opt, opts) {
|
|
|
|
|
if (validator === false) {
|
|
|
|
|
throw new Error(formatMessage(opt, ' has been removed in ' + version));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isDeprecated && !deprecatedWarnings[opt]) {
|
|
|
|
|
deprecatedWarnings[opt] = true;
|
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
|
console.warn(
|
|
|
|
|
formatMessage(
|
|
|
|
|
opt,
|
|
|
|
|
' has been deprecated since v' + version + ' and will be removed in the near future'
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return validator ? validator(value, opt, opts) : true;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Assert object's properties type
|
|
|
|
|
* @param {object} options
|
|
|
|
|
* @param {object} schema
|
|
|
|
|
* @param {boolean?} allowUnknown
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
function assertOptions(options, schema, allowUnknown) {
|
|
|
|
|
if (typeof options !== 'object') {
|
|
|
|
|
throw new TypeError('options must be an object');
|
|
|
|
|
}
|
|
|
|
|
var keys = Object.keys(options);
|
|
|
|
|
var i = keys.length;
|
|
|
|
|
while (i-- > 0) {
|
|
|
|
|
var opt = keys[i];
|
|
|
|
|
var validator = schema[opt];
|
|
|
|
|
if (validator) {
|
|
|
|
|
var value = options[opt];
|
|
|
|
|
var result = value === undefined || validator(value, opt, options);
|
|
|
|
|
if (result !== true) {
|
|
|
|
|
throw new TypeError('option ' + opt + ' must be ' + result);
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (allowUnknown !== true) {
|
|
|
|
|
throw Error('Unknown option ' + opt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
isOlderVersion: isOlderVersion,
|
|
|
|
|
assertOptions: assertOptions,
|
|
|
|
|
validators: validators
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 133:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var utils = __webpack_require__(35);
|
|
|
|
|
|
|
|
|
|
function encode(val) {
|
|
|
|
|
return encodeURIComponent(val).
|
|
|
|
|
replace(/%3A/gi, ':').
|
|
|
|
|
replace(/%24/g, '$').
|
|
|
|
|
replace(/%2C/gi, ',').
|
|
|
|
|
replace(/%20/g, '+').
|
|
|
|
|
replace(/%5B/gi, '[').
|
|
|
|
|
replace(/%5D/gi, ']');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Build a URL by appending params to the end
|
|
|
|
|
*
|
|
|
|
|
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
|
|
|
* @param {object} [params] The params to be appended
|
|
|
|
|
* @returns {string} The formatted url
|
|
|
|
|
*/
|
|
|
|
|
module.exports = function buildURL(url, params, paramsSerializer) {
|
|
|
|
|
/*eslint no-param-reassign:0*/
|
|
|
|
|
if (!params) {
|
|
|
|
|
return url;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var serializedParams;
|
|
|
|
|
if (paramsSerializer) {
|
|
|
|
|
serializedParams = paramsSerializer(params);
|
|
|
|
|
} else if (utils.isURLSearchParams(params)) {
|
|
|
|
|
serializedParams = params.toString();
|
|
|
|
|
} else {
|
|
|
|
|
var parts = [];
|
|
|
|
|
|
|
|
|
|
utils.forEach(params, function serialize(val, key) {
|
|
|
|
|
if (val === null || typeof val === 'undefined') {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (utils.isArray(val)) {
|
|
|
|
|
key = key + '[]';
|
|
|
|
|
} else {
|
|
|
|
|
val = [val];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
utils.forEach(val, function parseValue(v) {
|
|
|
|
|
if (utils.isDate(v)) {
|
|
|
|
|
v = v.toISOString();
|
|
|
|
|
} else if (utils.isObject(v)) {
|
|
|
|
|
v = JSON.stringify(v);
|
|
|
|
|
}
|
|
|
|
|
parts.push(encode(key) + '=' + encode(v));
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
serializedParams = parts.join('&');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (serializedParams) {
|
|
|
|
|
var hashmarkIndex = url.indexOf('#');
|
|
|
|
|
if (hashmarkIndex !== -1) {
|
|
|
|
|
url = url.slice(0, hashmarkIndex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return url;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 137:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Cancel = __webpack_require__(826);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
|
|
|
|
*
|
|
|
|
|
* @class
|
|
|
|
|
* @param {Function} executor The executor function.
|
|
|
|
|
*/
|
|
|
|
|
function CancelToken(executor) {
|
|
|
|
|
if (typeof executor !== 'function') {
|
|
|
|
|
throw new TypeError('executor must be a function.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var resolvePromise;
|
|
|
|
|
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
|
|
|
resolvePromise = resolve;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var token = this;
|
|
|
|
|
executor(function cancel(message) {
|
|
|
|
|
if (token.reason) {
|
|
|
|
|
// Cancellation has already been requested
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
token.reason = new Cancel(message);
|
|
|
|
|
resolvePromise(token.reason);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Throws a `Cancel` if cancellation has been requested.
|
|
|
|
|
*/
|
|
|
|
|
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
|
|
|
|
if (this.reason) {
|
|
|
|
|
throw this.reason;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
|
|
|
* cancels the `CancelToken`.
|
|
|
|
|
*/
|
|
|
|
|
CancelToken.source = function source() {
|
|
|
|
|
var cancel;
|
|
|
|
|
var token = new CancelToken(function executor(c) {
|
|
|
|
|
cancel = c;
|
|
|
|
|
});
|
|
|
|
|
return {
|
|
|
|
|
token: token,
|
|
|
|
|
cancel: cancel
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports = CancelToken;
|
|
|
|
|
|
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 147:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
// API
|
|
|
|
|
module.exports = state;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates initial state object
|
|
|
|
|
* for iteration over list
|
|
|
|
|
*
|
|
|
|
|
* @param {array|object} list - list to iterate over
|
|
|
|
|
* @param {function|null} sortMethod - function to use for keys sort,
|
|
|
|
|
* or `null` to keep them as is
|
|
|
|
|
* @returns {object} - initial state object
|
|
|
|
|
*/
|
|
|
|
|
function state(list, sortMethod)
|
|
|
|
|
{
|
|
|
|
|
var isNamedList = !Array.isArray(list)
|
|
|
|
|
, initState =
|
|
|
|
|
{
|
|
|
|
|
index : 0,
|
|
|
|
|
keyedList: isNamedList || sortMethod ? Object.keys(list) : null,
|
|
|
|
|
jobs : {},
|
|
|
|
|
results : isNamedList ? {} : [],
|
|
|
|
|
size : isNamedList ? Object.keys(list).length : list.length
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
if (sortMethod)
|
|
|
|
|
{
|
|
|
|
|
// sort array keys based on it's values
|
|
|
|
|
// sort object's keys just on own merit
|
|
|
|
|
initState.keyedList.sort(isNamedList ? sortMethod : function(a, b)
|
|
|
|
|
{
|
|
|
|
|
return sortMethod(list[a], list[b]);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return initState;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 152:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var Stream = __webpack_require__(413).Stream;
|
|
|
|
|
var util = __webpack_require__(669);
|
|
|
|
|
|
|
|
|
|
module.exports = DelayedStream;
|
|
|
|
|
function DelayedStream() {
|
|
|
|
|
this.source = null;
|
|
|
|
|
this.dataSize = 0;
|
|
|
|
|
this.maxDataSize = 1024 * 1024;
|
|
|
|
|
this.pauseStream = true;
|
|
|
|
|
|
|
|
|
|
this._maxDataSizeExceeded = false;
|
|
|
|
|
this._released = false;
|
|
|
|
|
this._bufferedEvents = [];
|
|
|
|
|
}
|
|
|
|
|
util.inherits(DelayedStream, Stream);
|
|
|
|
|
|
|
|
|
|
DelayedStream.create = function(source, options) {
|
|
|
|
|
var delayedStream = new this();
|
|
|
|
|
|
|
|
|
|
options = options || {};
|
|
|
|
|
for (var option in options) {
|
|
|
|
|
delayedStream[option] = options[option];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
delayedStream.source = source;
|
|
|
|
|
|
|
|
|
|
var realEmit = source.emit;
|
|
|
|
|
source.emit = function() {
|
|
|
|
|
delayedStream._handleEmit(arguments);
|
|
|
|
|
return realEmit.apply(source, arguments);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
source.on('error', function() {});
|
|
|
|
|
if (delayedStream.pauseStream) {
|
|
|
|
|
source.pause();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return delayedStream;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Object.defineProperty(DelayedStream.prototype, 'readable', {
|
|
|
|
|
configurable: true,
|
|
|
|
|
enumerable: true,
|
|
|
|
|
get: function() {
|
|
|
|
|
return this.source.readable;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
DelayedStream.prototype.setEncoding = function() {
|
|
|
|
|
return this.source.setEncoding.apply(this.source, arguments);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
DelayedStream.prototype.resume = function() {
|
|
|
|
|
if (!this._released) {
|
|
|
|
|
this.release();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.source.resume();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
DelayedStream.prototype.pause = function() {
|
|
|
|
|
this.source.pause();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
DelayedStream.prototype.release = function() {
|
|
|
|
|
this._released = true;
|
|
|
|
|
|
|
|
|
|
this._bufferedEvents.forEach(function(args) {
|
|
|
|
|
this.emit.apply(this, args);
|
|
|
|
|
}.bind(this));
|
|
|
|
|
this._bufferedEvents = [];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
DelayedStream.prototype.pipe = function() {
|
|
|
|
|
var r = Stream.prototype.pipe.apply(this, arguments);
|
|
|
|
|
this.resume();
|
|
|
|
|
return r;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
DelayedStream.prototype._handleEmit = function(args) {
|
|
|
|
|
if (this._released) {
|
|
|
|
|
this.emit.apply(this, args);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (args[0] === 'data') {
|
|
|
|
|
this.dataSize += args[1].length;
|
|
|
|
|
this._checkIfMaxDataSizeExceeded();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._bufferedEvents.push(args);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
|
|
|
|
|
if (this._maxDataSizeExceeded) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.dataSize <= this.maxDataSize) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._maxDataSizeExceeded = true;
|
|
|
|
|
var message =
|
|
|
|
|
'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'
|
|
|
|
|
this.emit('error', new Error(message));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 157:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var async = __webpack_require__(751)
|
|
|
|
|
, abort = __webpack_require__(566)
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
// API
|
|
|
|
|
module.exports = iterate;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Iterates over each job object
|
|
|
|
|
*
|
|
|
|
|
* @param {array|object} list - array or object (named list) to iterate over
|
|
|
|
|
* @param {function} iterator - iterator to run
|
|
|
|
|
* @param {object} state - current job status
|
|
|
|
|
* @param {function} callback - invoked when all elements processed
|
|
|
|
|
*/
|
|
|
|
|
function iterate(list, iterator, state, callback)
|
|
|
|
|
{
|
|
|
|
|
// store current index
|
|
|
|
|
var key = state['keyedList'] ? state['keyedList'][state.index] : state.index;
|
|
|
|
|
|
|
|
|
|
state.jobs[key] = runJob(iterator, key, list[key], function(error, output)
|
|
|
|
|
{
|
|
|
|
|
// don't repeat yourself
|
|
|
|
|
// skip secondary callbacks
|
|
|
|
|
if (!(key in state.jobs))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// clean up jobs
|
|
|
|
|
delete state.jobs[key];
|
|
|
|
|
|
|
|
|
|
if (error)
|
|
|
|
|
{
|
|
|
|
|
// don't process rest of the results
|
|
|
|
|
// stop still active jobs
|
|
|
|
|
// and reset the list
|
|
|
|
|
abort(state);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
state.results[key] = output;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// return salvaged results
|
|
|
|
|
callback(error, state.results);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Runs iterator over provided job element
|
|
|
|
|
*
|
|
|
|
|
* @param {function} iterator - iterator to invoke
|
|
|
|
|
* @param {string|number} key - key/index of the element in the list of jobs
|
|
|
|
|
* @param {mixed} item - job description
|
|
|
|
|
* @param {function} callback - invoked after iterator is done with the job
|
|
|
|
|
* @returns {function|mixed} - job abort function or something else
|
|
|
|
|
*/
|
|
|
|
|
function runJob(iterator, key, item, callback)
|
|
|
|
|
{
|
|
|
|
|
var aborter;
|
|
|
|
|
|
|
|
|
|
// allow shortcut if iterator expects only two arguments
|
|
|
|
|
if (iterator.length == 2)
|
|
|
|
|
{
|
|
|
|
|
aborter = iterator(item, async(callback));
|
|
|
|
|
}
|
|
|
|
|
// otherwise go with full three arguments
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
aborter = iterator(item, key, async(callback));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return aborter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 211:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
module.exports = require("https");
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 219:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var utils = __webpack_require__(35);
|
|
|
|
|
var settle = __webpack_require__(564);
|
2020-10-01 20:20:08 +00:00
|
|
|
|
var cookies = __webpack_require__(864);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
var buildURL = __webpack_require__(133);
|
|
|
|
|
var buildFullPath = __webpack_require__(960);
|
|
|
|
|
var parseHeaders = __webpack_require__(631);
|
|
|
|
|
var isURLSameOrigin = __webpack_require__(688);
|
|
|
|
|
var createError = __webpack_require__(26);
|
|
|
|
|
|
|
|
|
|
module.exports = function xhrAdapter(config) {
|
|
|
|
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
|
|
|
var requestData = config.data;
|
|
|
|
|
var requestHeaders = config.headers;
|
2021-09-09 12:42:30 +00:00
|
|
|
|
var responseType = config.responseType;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
|
|
|
|
if (utils.isFormData(requestData)) {
|
|
|
|
|
delete requestHeaders['Content-Type']; // Let the browser set it
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var request = new XMLHttpRequest();
|
|
|
|
|
|
|
|
|
|
// HTTP basic authentication
|
|
|
|
|
if (config.auth) {
|
|
|
|
|
var username = config.auth.username || '';
|
2020-12-16 20:37:11 +00:00
|
|
|
|
var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
2020-02-24 09:23:15 +00:00
|
|
|
|
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var fullPath = buildFullPath(config.baseURL, config.url);
|
|
|
|
|
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
|
|
|
|
|
|
|
|
|
// Set the request timeout in MS
|
|
|
|
|
request.timeout = config.timeout;
|
|
|
|
|
|
2021-09-09 12:42:30 +00:00
|
|
|
|
function onloadend() {
|
|
|
|
|
if (!request) {
|
2020-02-24 09:23:15 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// Prepare the response
|
|
|
|
|
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
2021-09-09 12:42:30 +00:00
|
|
|
|
var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
|
|
|
|
request.responseText : request.response;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
var response = {
|
|
|
|
|
data: responseData,
|
|
|
|
|
status: request.status,
|
|
|
|
|
statusText: request.statusText,
|
|
|
|
|
headers: responseHeaders,
|
|
|
|
|
config: config,
|
|
|
|
|
request: request
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
settle(resolve, reject, response);
|
|
|
|
|
|
|
|
|
|
// Clean up request
|
|
|
|
|
request = null;
|
2021-09-09 12:42:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ('onloadend' in request) {
|
|
|
|
|
// Use onloadend if available
|
|
|
|
|
request.onloadend = onloadend;
|
|
|
|
|
} else {
|
|
|
|
|
// Listen for ready state to emulate onloadend
|
|
|
|
|
request.onreadystatechange = function handleLoad() {
|
|
|
|
|
if (!request || request.readyState !== 4) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The request errored out and we didn't get a response, this will be
|
|
|
|
|
// handled by onerror instead
|
|
|
|
|
// With one exception: request that using file: protocol, most browsers
|
|
|
|
|
// will return status as 0 even though it's a successful request
|
|
|
|
|
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// readystate handler is calling before onerror or ontimeout handlers,
|
|
|
|
|
// so we should call onloadend on the next 'tick'
|
|
|
|
|
setTimeout(onloadend);
|
|
|
|
|
};
|
|
|
|
|
}
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
|
|
|
|
// Handle browser request cancellation (as opposed to a manual cancellation)
|
|
|
|
|
request.onabort = function handleAbort() {
|
|
|
|
|
if (!request) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reject(createError('Request aborted', config, 'ECONNABORTED', request));
|
|
|
|
|
|
|
|
|
|
// Clean up request
|
|
|
|
|
request = null;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Handle low level network errors
|
|
|
|
|
request.onerror = function handleError() {
|
|
|
|
|
// Real errors are hidden from us by the browser
|
|
|
|
|
// onerror should only fire if it's a network error
|
|
|
|
|
reject(createError('Network Error', config, null, request));
|
|
|
|
|
|
|
|
|
|
// Clean up request
|
|
|
|
|
request = null;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Handle timeout
|
|
|
|
|
request.ontimeout = function handleTimeout() {
|
|
|
|
|
var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
|
|
|
|
|
if (config.timeoutErrorMessage) {
|
|
|
|
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
|
|
|
}
|
2021-09-09 12:42:30 +00:00
|
|
|
|
reject(createError(
|
|
|
|
|
timeoutErrorMessage,
|
|
|
|
|
config,
|
|
|
|
|
config.transitional && config.transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
|
2020-02-24 09:23:15 +00:00
|
|
|
|
request));
|
|
|
|
|
|
|
|
|
|
// Clean up request
|
|
|
|
|
request = null;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Add xsrf header
|
|
|
|
|
// This is only done if running in a standard browser environment.
|
|
|
|
|
// Specifically not if we're in a web worker, or react-native.
|
|
|
|
|
if (utils.isStandardBrowserEnv()) {
|
|
|
|
|
// Add xsrf header
|
|
|
|
|
var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
|
|
|
|
|
cookies.read(config.xsrfCookieName) :
|
|
|
|
|
undefined;
|
|
|
|
|
|
|
|
|
|
if (xsrfValue) {
|
|
|
|
|
requestHeaders[config.xsrfHeaderName] = xsrfValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add headers to the request
|
|
|
|
|
if ('setRequestHeader' in request) {
|
|
|
|
|
utils.forEach(requestHeaders, function setRequestHeader(val, key) {
|
|
|
|
|
if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
|
|
|
|
|
// Remove Content-Type if data is undefined
|
|
|
|
|
delete requestHeaders[key];
|
|
|
|
|
} else {
|
|
|
|
|
// Otherwise add header to the request
|
|
|
|
|
request.setRequestHeader(key, val);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add withCredentials to request if needed
|
|
|
|
|
if (!utils.isUndefined(config.withCredentials)) {
|
|
|
|
|
request.withCredentials = !!config.withCredentials;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add responseType to request if needed
|
2021-09-09 12:42:30 +00:00
|
|
|
|
if (responseType && responseType !== 'json') {
|
|
|
|
|
request.responseType = config.responseType;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Handle progress if needed
|
|
|
|
|
if (typeof config.onDownloadProgress === 'function') {
|
|
|
|
|
request.addEventListener('progress', config.onDownloadProgress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Not all browsers support upload events
|
|
|
|
|
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
|
|
|
|
request.upload.addEventListener('progress', config.onUploadProgress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (config.cancelToken) {
|
|
|
|
|
// Handle cancellation
|
|
|
|
|
config.cancelToken.promise.then(function onCanceled(cancel) {
|
|
|
|
|
if (!request) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
request.abort();
|
|
|
|
|
reject(cancel);
|
|
|
|
|
// Clean up request
|
|
|
|
|
request = null;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
if (!requestData) {
|
2020-02-24 09:23:15 +00:00
|
|
|
|
requestData = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Send the request
|
|
|
|
|
request.send(requestData);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2020-07-30 16:27:27 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 230:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
const core = __webpack_require__(470);
|
|
|
|
|
|
|
|
|
|
class GithubActions {
|
|
|
|
|
debug(message) {
|
|
|
|
|
core.debug(message)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
warning(message) {
|
|
|
|
|
core.warning(message)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setOutput(name, output) {
|
|
|
|
|
core.setOutput(name, output)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setFailed(message) {
|
|
|
|
|
core.setFailed(message)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class LogActions {
|
|
|
|
|
debug(message) {
|
|
|
|
|
console.info(message)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
warning(message) {
|
|
|
|
|
console.warn(message)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setOutput(name, output) {
|
|
|
|
|
console.log(name, output)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setFailed(message) {
|
|
|
|
|
console.error(message)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = { GithubActions, LogActions }
|
|
|
|
|
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 283:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var utils = __webpack_require__(35);
|
|
|
|
|
|
|
|
|
|
function InterceptorManager() {
|
|
|
|
|
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
|
|
|
|
|
*/
|
2021-09-09 12:42:30 +00:00
|
|
|
|
InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
|
2020-02-24 09:23:15 +00:00
|
|
|
|
this.handlers.push({
|
|
|
|
|
fulfilled: fulfilled,
|
2021-09-09 12:42:30 +00:00
|
|
|
|
rejected: rejected,
|
|
|
|
|
synchronous: options ? options.synchronous : false,
|
|
|
|
|
runWhen: options ? options.runWhen : null
|
2020-02-24 09:23:15 +00:00
|
|
|
|
});
|
|
|
|
|
return this.handlers.length - 1;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Remove an interceptor from the stack
|
|
|
|
|
*
|
|
|
|
|
* @param {Number} id The ID that was returned by `use`
|
|
|
|
|
*/
|
|
|
|
|
InterceptorManager.prototype.eject = function eject(id) {
|
|
|
|
|
if (this.handlers[id]) {
|
|
|
|
|
this.handlers[id] = null;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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
|
|
|
|
|
*/
|
|
|
|
|
InterceptorManager.prototype.forEach = function forEach(fn) {
|
|
|
|
|
utils.forEach(this.handlers, function forEachHandler(h) {
|
|
|
|
|
if (h !== null) {
|
|
|
|
|
fn(h);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports = InterceptorManager;
|
|
|
|
|
|
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 334:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
module.exports =
|
|
|
|
|
{
|
|
|
|
|
parallel : __webpack_require__(424),
|
|
|
|
|
serial : __webpack_require__(91),
|
|
|
|
|
serialOrdered : __webpack_require__(892)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 352:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var utils = __webpack_require__(35);
|
|
|
|
|
var bind = __webpack_require__(727);
|
|
|
|
|
var Axios = __webpack_require__(779);
|
|
|
|
|
var mergeConfig = __webpack_require__(825);
|
|
|
|
|
var defaults = __webpack_require__(529);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create an instance of Axios
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} defaultConfig The default config for the instance
|
|
|
|
|
* @return {Axios} A new instance of Axios
|
|
|
|
|
*/
|
|
|
|
|
function createInstance(defaultConfig) {
|
|
|
|
|
var context = new Axios(defaultConfig);
|
|
|
|
|
var instance = bind(Axios.prototype.request, context);
|
|
|
|
|
|
|
|
|
|
// Copy axios.prototype to instance
|
|
|
|
|
utils.extend(instance, Axios.prototype, context);
|
|
|
|
|
|
|
|
|
|
// Copy context to instance
|
|
|
|
|
utils.extend(instance, context);
|
|
|
|
|
|
|
|
|
|
return instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create the default instance to be exported
|
|
|
|
|
var axios = createInstance(defaults);
|
|
|
|
|
|
|
|
|
|
// Expose Axios class to allow class inheritance
|
|
|
|
|
axios.Axios = Axios;
|
|
|
|
|
|
|
|
|
|
// Factory for creating new instances
|
|
|
|
|
axios.create = function create(instanceConfig) {
|
|
|
|
|
return createInstance(mergeConfig(axios.defaults, instanceConfig));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Expose Cancel & CancelToken
|
|
|
|
|
axios.Cancel = __webpack_require__(826);
|
|
|
|
|
axios.CancelToken = __webpack_require__(137);
|
|
|
|
|
axios.isCancel = __webpack_require__(732);
|
|
|
|
|
|
|
|
|
|
// Expose all/spread
|
|
|
|
|
axios.all = function all(promises) {
|
|
|
|
|
return Promise.all(promises);
|
|
|
|
|
};
|
|
|
|
|
axios.spread = __webpack_require__(879);
|
|
|
|
|
|
2021-01-05 17:57:45 +00:00
|
|
|
|
// Expose isAxiosError
|
|
|
|
|
axios.isAxiosError = __webpack_require__(104);
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
module.exports = axios;
|
|
|
|
|
|
|
|
|
|
// Allow use of default import syntax in TypeScript
|
|
|
|
|
module.exports.default = axios;
|
|
|
|
|
|
|
|
|
|
|
2020-07-30 16:27:27 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 354:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
const axios = __webpack_require__(53);
|
2021-01-24 12:14:13 +00:00
|
|
|
|
const FormData = __webpack_require__(928)
|
|
|
|
|
const fs = __webpack_require__(747)
|
2020-07-30 16:27:27 +00:00
|
|
|
|
|
|
|
|
|
const METHOD_GET = 'GET'
|
|
|
|
|
const METHOD_POST = 'POST'
|
|
|
|
|
|
2021-03-19 16:28:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* @param {Object} param0
|
|
|
|
|
* @param {string} param0.method HTTP Method
|
|
|
|
|
* @param {{ baseURL: string; timeout: number; headers: { [name: string]: string } }} param0.instanceConfig
|
|
|
|
|
* @param {string} param0.data Request Body as string, default {}
|
|
|
|
|
* @param {string} param0.files Map of Request Files (name: absolute path) as JSON String, default: {}
|
|
|
|
|
* @param {{ username: string; password: string }|undefined} param0.auth Optional HTTP Basic Auth
|
|
|
|
|
* @param {*} param0.actions
|
|
|
|
|
* @param {number[]} param0.ignoredCodes Prevent Action to fail if the API response with one of this StatusCodes
|
|
|
|
|
* @param {boolean} param0.preventFailureOnNoResponse Prevent Action to fail if the API respond without Response
|
|
|
|
|
* @param {boolean} param0.escapeData Escape unescaped JSON content in data
|
|
|
|
|
*
|
|
|
|
|
* @returns {void}
|
|
|
|
|
*/
|
|
|
|
|
const request = async({ method, instanceConfig, data, files, auth, actions, ignoredCodes, preventFailureOnNoResponse, escapeData }) => {
|
2020-07-30 16:27:27 +00:00
|
|
|
|
try {
|
2020-10-07 16:29:38 +00:00
|
|
|
|
if (escapeData) {
|
|
|
|
|
data = data.replace(/"[^"]*"/g, (match) => {
|
2021-02-19 11:51:47 +00:00
|
|
|
|
return match.replace(/[\n\r]\s*/g, "\\n");
|
2020-10-07 16:29:38 +00:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-16 20:37:11 +00:00
|
|
|
|
if (method === METHOD_GET) {
|
|
|
|
|
data = undefined;
|
|
|
|
|
}
|
2020-07-30 16:27:27 +00:00
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
if (files && files !== '{}') {
|
|
|
|
|
filesJson = convertToJSON(files)
|
|
|
|
|
dataJson = convertToJSON(data)
|
|
|
|
|
|
|
|
|
|
if (Object.keys(filesJson).length > 0) {
|
|
|
|
|
try {
|
|
|
|
|
data = convertToFormData(dataJson, filesJson)
|
|
|
|
|
instanceConfig = await updateConfig(instanceConfig, data, actions)
|
|
|
|
|
} catch(error) {
|
|
|
|
|
actions.setFailed({ message: `Unable to convert Data and Files into FormData: ${error.message}`, data: dataJson, files: filesJson })
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-30 16:27:27 +00:00
|
|
|
|
const requestData = {
|
|
|
|
|
auth,
|
|
|
|
|
method,
|
2021-02-19 11:51:47 +00:00
|
|
|
|
data,
|
|
|
|
|
maxContentLength: Infinity,
|
|
|
|
|
maxBodyLength: Infinity
|
2020-07-30 16:27:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-24 12:52:05 +00:00
|
|
|
|
actions.debug('Instance Configuration: ' + JSON.stringify(instanceConfig))
|
|
|
|
|
|
|
|
|
|
const instance = axios.create(instanceConfig);
|
|
|
|
|
|
2020-07-30 16:27:27 +00:00
|
|
|
|
actions.debug('Request Data: ' + JSON.stringify(requestData))
|
|
|
|
|
|
|
|
|
|
const response = await instance.request(requestData)
|
|
|
|
|
|
|
|
|
|
actions.setOutput('response', JSON.stringify(response.data))
|
|
|
|
|
} catch (error) {
|
|
|
|
|
if (error.toJSON) {
|
2021-03-19 16:28:53 +00:00
|
|
|
|
actions.setOutput('requestError', JSON.stringify(error.toJSON()));
|
2020-07-30 16:27:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-03-19 16:28:53 +00:00
|
|
|
|
if (error.response && ignoredCodes.includes(error.response.status)) {
|
|
|
|
|
actions.warning(JSON.stringify({ code: error.response.status, message: error.response.data }))
|
|
|
|
|
} else if (error.response) {
|
|
|
|
|
actions.setFailed(JSON.stringify({ code: error.response.status, message: error.response.data }))
|
2020-07-30 16:27:27 +00:00
|
|
|
|
} else if (error.request && !preventFailureOnNoResponse) {
|
|
|
|
|
actions.setFailed(JSON.stringify({ error: "no response received" }));
|
|
|
|
|
} else if (error.request && preventFailureOnNoResponse) {
|
|
|
|
|
actions.warning(JSON.stringify(error));
|
|
|
|
|
} else {
|
2020-10-07 16:29:38 +00:00
|
|
|
|
actions.setFailed(JSON.stringify({ message: error.message, data }));
|
2020-07-30 16:27:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-19 16:28:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* @param {string} value
|
|
|
|
|
*
|
|
|
|
|
* @returns {Object}
|
|
|
|
|
*/
|
2021-01-24 12:14:13 +00:00
|
|
|
|
const convertToJSON = (value) => {
|
|
|
|
|
try {
|
|
|
|
|
return JSON.parse(value)
|
|
|
|
|
} catch(e) {
|
|
|
|
|
return {}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-19 16:28:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* @param {Object} data
|
|
|
|
|
* @param {Object} files
|
|
|
|
|
*
|
|
|
|
|
* @returns {FormData}
|
|
|
|
|
*/
|
2021-01-24 12:14:13 +00:00
|
|
|
|
const convertToFormData = (data, files) => {
|
|
|
|
|
formData = new FormData()
|
|
|
|
|
|
|
|
|
|
for (const [key, value] of Object.entries(data)) {
|
|
|
|
|
formData.append(key, value)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const [key, value] of Object.entries(files)) {
|
|
|
|
|
formData.append(key, fs.createReadStream(value))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return formData
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-19 16:28:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* @param {{ baseURL: string; timeout: number; headers: { [name: string]: string } }} instanceConfig
|
|
|
|
|
* @param {FormData} formData
|
|
|
|
|
* @param {*} actions
|
|
|
|
|
*
|
|
|
|
|
* @returns {{ baseURL: string; timeout: number; headers: { [name: string]: string } }}
|
|
|
|
|
*/
|
2021-01-24 12:14:13 +00:00
|
|
|
|
const updateConfig = async (instanceConfig, formData, actions) => {
|
|
|
|
|
try {
|
2021-01-24 12:52:05 +00:00
|
|
|
|
const formHeaders = formData.getHeaders()
|
|
|
|
|
const contentType = formHeaders['content-type']
|
|
|
|
|
|
|
|
|
|
delete formHeaders['content-type']
|
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
return {
|
|
|
|
|
...instanceConfig,
|
|
|
|
|
headers: {
|
|
|
|
|
...instanceConfig.headers,
|
2021-01-24 12:52:05 +00:00
|
|
|
|
...formHeaders,
|
|
|
|
|
'Content-Length': await contentLength(formData),
|
|
|
|
|
'Content-Type': contentType
|
2021-01-24 12:14:13 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch(error) {
|
|
|
|
|
actions.setFailed({ message: `Unable to read Content-Length: ${error.message}`, data, files })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-19 16:28:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* @param {FormData} formData
|
|
|
|
|
*
|
|
|
|
|
* @returns {Promise<number>}
|
|
|
|
|
*/
|
2021-01-24 12:14:13 +00:00
|
|
|
|
const contentLength = (formData) => new Promise((resolve, reject) => {
|
|
|
|
|
formData.getLength((err, length) => {
|
|
|
|
|
if (err) {
|
|
|
|
|
reject (err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resolve(length)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
2020-07-30 16:27:27 +00:00
|
|
|
|
module.exports = {
|
|
|
|
|
request,
|
|
|
|
|
METHOD_POST,
|
|
|
|
|
METHOD_GET,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 357:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
module.exports = require("assert");
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 361:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
2021-09-09 12:42:30 +00:00
|
|
|
|
module.exports = {"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]};
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 369:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Update an Error with the specified config, error code, and response.
|
|
|
|
|
*
|
|
|
|
|
* @param {Error} error The error to update.
|
|
|
|
|
* @param {Object} config The config.
|
|
|
|
|
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
|
|
|
* @param {Object} [request] The request.
|
|
|
|
|
* @param {Object} [response] The response.
|
|
|
|
|
* @returns {Error} The error.
|
|
|
|
|
*/
|
|
|
|
|
module.exports = function enhanceError(error, config, code, request, response) {
|
|
|
|
|
error.config = config;
|
|
|
|
|
if (code) {
|
|
|
|
|
error.code = code;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
error.request = request;
|
|
|
|
|
error.response = response;
|
|
|
|
|
error.isAxiosError = true;
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
error.toJSON = function toJSON() {
|
2020-02-24 09:23:15 +00:00
|
|
|
|
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
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
return error;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 411:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var utils = __webpack_require__(35);
|
|
|
|
|
|
|
|
|
|
module.exports = function normalizeHeaderName(headers, normalizedName) {
|
|
|
|
|
utils.forEach(headers, function processHeader(value, name) {
|
|
|
|
|
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
|
|
|
|
|
headers[normalizedName] = value;
|
|
|
|
|
delete headers[name];
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 413:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
module.exports = require("stream");
|
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 424:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var iterate = __webpack_require__(157)
|
|
|
|
|
, initState = __webpack_require__(147)
|
|
|
|
|
, terminator = __webpack_require__(939)
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
// Public API
|
|
|
|
|
module.exports = parallel;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Runs iterator over provided array elements in parallel
|
|
|
|
|
*
|
|
|
|
|
* @param {array|object} list - array or object (named list) to iterate over
|
|
|
|
|
* @param {function} iterator - iterator to run
|
|
|
|
|
* @param {function} callback - invoked when all elements processed
|
|
|
|
|
* @returns {function} - jobs terminator
|
|
|
|
|
*/
|
|
|
|
|
function parallel(list, iterator, callback)
|
|
|
|
|
{
|
|
|
|
|
var state = initState(list);
|
|
|
|
|
|
|
|
|
|
while (state.index < (state['keyedList'] || list).length)
|
|
|
|
|
{
|
|
|
|
|
iterate(list, iterator, state, function(error, result)
|
|
|
|
|
{
|
|
|
|
|
if (error)
|
|
|
|
|
{
|
|
|
|
|
callback(error, result);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// looks like it's the last one
|
|
|
|
|
if (Object.keys(state.jobs).length === 0)
|
|
|
|
|
{
|
|
|
|
|
callback(null, state.results);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
state.index++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return terminator.bind(state, callback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 431:
|
|
|
|
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
2021-09-09 12:42:30 +00:00
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
2020-02-24 09:23:15 +00:00
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
2021-09-09 12:42:30 +00:00
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2021-09-09 12:42:30 +00:00
|
|
|
|
exports.issue = exports.issueCommand = void 0;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
const os = __importStar(__webpack_require__(87));
|
2020-10-01 20:20:08 +00:00
|
|
|
|
const utils_1 = __webpack_require__(82);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/**
|
|
|
|
|
* Commands
|
|
|
|
|
*
|
|
|
|
|
* Command Format:
|
|
|
|
|
* ::name key=value,key=value::message
|
|
|
|
|
*
|
|
|
|
|
* Examples:
|
|
|
|
|
* ::warning::This is the message
|
|
|
|
|
* ::set-env name=MY_VAR::some value
|
|
|
|
|
*/
|
|
|
|
|
function issueCommand(command, properties, message) {
|
|
|
|
|
const cmd = new Command(command, properties, message);
|
|
|
|
|
process.stdout.write(cmd.toString() + os.EOL);
|
|
|
|
|
}
|
|
|
|
|
exports.issueCommand = issueCommand;
|
|
|
|
|
function issue(name, message = '') {
|
|
|
|
|
issueCommand(name, {}, message);
|
|
|
|
|
}
|
|
|
|
|
exports.issue = issue;
|
|
|
|
|
const CMD_STRING = '::';
|
|
|
|
|
class Command {
|
|
|
|
|
constructor(command, properties, message) {
|
|
|
|
|
if (!command) {
|
|
|
|
|
command = 'missing.command';
|
|
|
|
|
}
|
|
|
|
|
this.command = command;
|
|
|
|
|
this.properties = properties;
|
|
|
|
|
this.message = message;
|
|
|
|
|
}
|
|
|
|
|
toString() {
|
|
|
|
|
let cmdStr = CMD_STRING + this.command;
|
|
|
|
|
if (this.properties && Object.keys(this.properties).length > 0) {
|
|
|
|
|
cmdStr += ' ';
|
|
|
|
|
let first = true;
|
|
|
|
|
for (const key in this.properties) {
|
|
|
|
|
if (this.properties.hasOwnProperty(key)) {
|
|
|
|
|
const val = this.properties[key];
|
|
|
|
|
if (val) {
|
|
|
|
|
if (first) {
|
|
|
|
|
first = false;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
cmdStr += ',';
|
|
|
|
|
}
|
|
|
|
|
cmdStr += `${key}=${escapeProperty(val)}`;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
|
|
|
|
|
return cmdStr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function escapeData(s) {
|
2020-10-01 20:20:08 +00:00
|
|
|
|
return utils_1.toCommandValue(s)
|
2020-02-24 09:23:15 +00:00
|
|
|
|
.replace(/%/g, '%25')
|
|
|
|
|
.replace(/\r/g, '%0D')
|
|
|
|
|
.replace(/\n/g, '%0A');
|
|
|
|
|
}
|
|
|
|
|
function escapeProperty(s) {
|
2020-10-01 20:20:08 +00:00
|
|
|
|
return utils_1.toCommandValue(s)
|
2020-02-24 09:23:15 +00:00
|
|
|
|
.replace(/%/g, '%25')
|
|
|
|
|
.replace(/\r/g, '%0D')
|
|
|
|
|
.replace(/\n/g, '%0A')
|
|
|
|
|
.replace(/:/g, '%3A')
|
|
|
|
|
.replace(/,/g, '%2C');
|
|
|
|
|
}
|
|
|
|
|
//# sourceMappingURL=command.js.map
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
/***/ 432:
|
|
|
|
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
2020-10-01 20:20:08 +00:00
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* mime-types
|
|
|
|
|
* Copyright(c) 2014 Jonathan Ong
|
|
|
|
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
|
|
|
* MIT Licensed
|
|
|
|
|
*/
|
2020-10-01 20:20:08 +00:00
|
|
|
|
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
/**
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
var db = __webpack_require__(852)
|
|
|
|
|
var extname = __webpack_require__(622).extname
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2021-01-24 12:14:13 +00:00
|
|
|
|
* Module variables.
|
|
|
|
|
* @private
|
2020-02-24 09:23:15 +00:00
|
|
|
|
*/
|
2021-01-24 12:14:13 +00:00
|
|
|
|
|
|
|
|
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/
|
|
|
|
|
var TEXT_TYPE_REGEXP = /^text\//i
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/**
|
2021-01-24 12:14:13 +00:00
|
|
|
|
* Module exports.
|
|
|
|
|
* @public
|
2020-02-24 09:23:15 +00:00
|
|
|
|
*/
|
2021-01-24 12:14:13 +00:00
|
|
|
|
|
|
|
|
|
exports.charset = charset
|
|
|
|
|
exports.charsets = { lookup: charset }
|
|
|
|
|
exports.contentType = contentType
|
|
|
|
|
exports.extension = extension
|
|
|
|
|
exports.extensions = Object.create(null)
|
|
|
|
|
exports.lookup = lookup
|
|
|
|
|
exports.types = Object.create(null)
|
|
|
|
|
|
|
|
|
|
// Populate the extensions/types maps
|
|
|
|
|
populateMaps(exports.extensions, exports.types)
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/**
|
2021-01-24 12:14:13 +00:00
|
|
|
|
* Get the default charset for a MIME type.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} type
|
|
|
|
|
* @return {boolean|string}
|
2020-02-24 09:23:15 +00:00
|
|
|
|
*/
|
2021-01-24 12:14:13 +00:00
|
|
|
|
|
|
|
|
|
function charset (type) {
|
|
|
|
|
if (!type || typeof type !== 'string') {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: use media-typer
|
|
|
|
|
var match = EXTRACT_TYPE_REGEXP.exec(type)
|
|
|
|
|
var mime = match && db[match[1].toLowerCase()]
|
|
|
|
|
|
|
|
|
|
if (mime && mime.charset) {
|
|
|
|
|
return mime.charset
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// default text/* to utf-8
|
|
|
|
|
if (match && TEXT_TYPE_REGEXP.test(match[1])) {
|
|
|
|
|
return 'UTF-8'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a full Content-Type header given a MIME type or extension.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} str
|
|
|
|
|
* @return {boolean|string}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
function contentType (str) {
|
|
|
|
|
// TODO: should this even be in this module?
|
|
|
|
|
if (!str || typeof str !== 'string') {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var mime = str.indexOf('/') === -1
|
|
|
|
|
? exports.lookup(str)
|
|
|
|
|
: str
|
|
|
|
|
|
|
|
|
|
if (!mime) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: use content-type or other module
|
|
|
|
|
if (mime.indexOf('charset') === -1) {
|
|
|
|
|
var charset = exports.charset(mime)
|
|
|
|
|
if (charset) mime += '; charset=' + charset.toLowerCase()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return mime
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the default extension for a MIME type.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} type
|
|
|
|
|
* @return {boolean|string}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
function extension (type) {
|
|
|
|
|
if (!type || typeof type !== 'string') {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: use media-typer
|
|
|
|
|
var match = EXTRACT_TYPE_REGEXP.exec(type)
|
|
|
|
|
|
|
|
|
|
// get extensions
|
|
|
|
|
var exts = match && exports.extensions[match[1].toLowerCase()]
|
|
|
|
|
|
|
|
|
|
if (!exts || !exts.length) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return exts[0]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Lookup the MIME type for a file path/extension.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} path
|
|
|
|
|
* @return {boolean|string}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
function lookup (path) {
|
|
|
|
|
if (!path || typeof path !== 'string') {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get the extension ("ext" or ".ext" or full path)
|
|
|
|
|
var extension = extname('x.' + path)
|
|
|
|
|
.toLowerCase()
|
|
|
|
|
.substr(1)
|
|
|
|
|
|
|
|
|
|
if (!extension) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return exports.types[extension] || false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Populate the extensions and types maps.
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
function populateMaps (extensions, types) {
|
|
|
|
|
// source preference (least -> most)
|
|
|
|
|
var preference = ['nginx', 'apache', undefined, 'iana']
|
|
|
|
|
|
|
|
|
|
Object.keys(db).forEach(function forEachMimeType (type) {
|
|
|
|
|
var mime = db[type]
|
|
|
|
|
var exts = mime.extensions
|
|
|
|
|
|
|
|
|
|
if (!exts || !exts.length) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// mime -> extensions
|
|
|
|
|
extensions[type] = exts
|
|
|
|
|
|
|
|
|
|
// extension -> mime
|
|
|
|
|
for (var i = 0; i < exts.length; i++) {
|
|
|
|
|
var extension = exts[i]
|
|
|
|
|
|
|
|
|
|
if (types[extension]) {
|
|
|
|
|
var from = preference.indexOf(db[types[extension]].source)
|
|
|
|
|
var to = preference.indexOf(mime.source)
|
|
|
|
|
|
|
|
|
|
if (types[extension] !== 'application/octet-stream' &&
|
|
|
|
|
(from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) {
|
|
|
|
|
// skip the remapping
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// set the extension -> mime
|
|
|
|
|
types[extension] = type
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 454:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var debug;
|
2021-03-19 16:28:53 +00:00
|
|
|
|
|
|
|
|
|
module.exports = function () {
|
|
|
|
|
if (!debug) {
|
|
|
|
|
try {
|
|
|
|
|
/* eslint global-require: off */
|
|
|
|
|
debug = __webpack_require__(944)("follow-redirects");
|
|
|
|
|
}
|
2021-09-09 12:42:30 +00:00
|
|
|
|
catch (error) { /* */ }
|
|
|
|
|
if (typeof debug !== "function") {
|
2021-03-19 16:28:53 +00:00
|
|
|
|
debug = function () { /* */ };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
debug.apply(null, arguments);
|
|
|
|
|
};
|
2021-01-24 12:14:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 470:
|
|
|
|
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
2021-09-09 12:42:30 +00:00
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
2021-01-24 12:14:13 +00:00
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
|
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
|
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2021-09-09 12:42:30 +00:00
|
|
|
|
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
|
2021-01-24 12:14:13 +00:00
|
|
|
|
const command_1 = __webpack_require__(431);
|
|
|
|
|
const file_command_1 = __webpack_require__(102);
|
|
|
|
|
const utils_1 = __webpack_require__(82);
|
|
|
|
|
const os = __importStar(__webpack_require__(87));
|
|
|
|
|
const path = __importStar(__webpack_require__(622));
|
|
|
|
|
/**
|
|
|
|
|
* The code to exit an action
|
|
|
|
|
*/
|
|
|
|
|
var ExitCode;
|
|
|
|
|
(function (ExitCode) {
|
|
|
|
|
/**
|
|
|
|
|
* A code indicating that the action was successful
|
|
|
|
|
*/
|
|
|
|
|
ExitCode[ExitCode["Success"] = 0] = "Success";
|
|
|
|
|
/**
|
|
|
|
|
* A code indicating that the action was a failure
|
|
|
|
|
*/
|
|
|
|
|
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
|
|
|
|
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
|
|
|
|
//-----------------------------------------------------------------------
|
|
|
|
|
// Variables
|
|
|
|
|
//-----------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* Sets env variable for this action and future actions in the job
|
|
|
|
|
* @param name the name of the variable to set
|
|
|
|
|
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
|
|
|
|
*/
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
|
|
function exportVariable(name, val) {
|
|
|
|
|
const convertedVal = utils_1.toCommandValue(val);
|
|
|
|
|
process.env[name] = convertedVal;
|
|
|
|
|
const filePath = process.env['GITHUB_ENV'] || '';
|
|
|
|
|
if (filePath) {
|
|
|
|
|
const delimiter = '_GitHubActionsFileCommandDelimeter_';
|
|
|
|
|
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
|
|
|
|
file_command_1.issueCommand('ENV', commandValue);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
command_1.issueCommand('set-env', { name }, convertedVal);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
exports.exportVariable = exportVariable;
|
|
|
|
|
/**
|
|
|
|
|
* Registers a secret which will get masked from logs
|
|
|
|
|
* @param secret value of the secret
|
|
|
|
|
*/
|
|
|
|
|
function setSecret(secret) {
|
|
|
|
|
command_1.issueCommand('add-mask', {}, secret);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
exports.setSecret = setSecret;
|
|
|
|
|
/**
|
|
|
|
|
* Prepends inputPath to the PATH (for this action and future actions)
|
|
|
|
|
* @param inputPath
|
|
|
|
|
*/
|
|
|
|
|
function addPath(inputPath) {
|
2020-10-01 20:20:08 +00:00
|
|
|
|
const filePath = process.env['GITHUB_PATH'] || '';
|
|
|
|
|
if (filePath) {
|
|
|
|
|
file_command_1.issueCommand('PATH', inputPath);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
command_1.issueCommand('add-path', {}, inputPath);
|
|
|
|
|
}
|
|
|
|
|
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
|
|
|
|
}
|
2020-02-24 09:23:15 +00:00
|
|
|
|
exports.addPath = addPath;
|
|
|
|
|
/**
|
2021-09-09 12:42:30 +00:00
|
|
|
|
* Gets the value of an input.
|
|
|
|
|
* Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
|
|
|
|
|
* Returns an empty string if the value is not defined.
|
2020-02-24 09:23:15 +00:00
|
|
|
|
*
|
|
|
|
|
* @param name name of the input to get
|
|
|
|
|
* @param options optional. See InputOptions.
|
|
|
|
|
* @returns string
|
|
|
|
|
*/
|
|
|
|
|
function getInput(name, options) {
|
|
|
|
|
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
|
|
|
|
|
if (options && options.required && !val) {
|
|
|
|
|
throw new Error(`Input required and not supplied: ${name}`);
|
|
|
|
|
}
|
2021-09-09 12:42:30 +00:00
|
|
|
|
if (options && options.trimWhitespace === false) {
|
|
|
|
|
return val;
|
|
|
|
|
}
|
2020-02-24 09:23:15 +00:00
|
|
|
|
return val.trim();
|
|
|
|
|
}
|
|
|
|
|
exports.getInput = getInput;
|
2021-09-09 12:42:30 +00:00
|
|
|
|
/**
|
|
|
|
|
* Gets the values of an multiline input. Each value is also trimmed.
|
|
|
|
|
*
|
|
|
|
|
* @param name name of the input to get
|
|
|
|
|
* @param options optional. See InputOptions.
|
|
|
|
|
* @returns string[]
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
function getMultilineInput(name, options) {
|
|
|
|
|
const inputs = getInput(name, options)
|
|
|
|
|
.split('\n')
|
|
|
|
|
.filter(x => x !== '');
|
|
|
|
|
return inputs;
|
|
|
|
|
}
|
|
|
|
|
exports.getMultilineInput = getMultilineInput;
|
|
|
|
|
/**
|
|
|
|
|
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
|
|
|
|
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
|
|
|
|
|
* The return value is also in boolean type.
|
|
|
|
|
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
|
|
|
|
|
*
|
|
|
|
|
* @param name name of the input to get
|
|
|
|
|
* @param options optional. See InputOptions.
|
|
|
|
|
* @returns boolean
|
|
|
|
|
*/
|
|
|
|
|
function getBooleanInput(name, options) {
|
|
|
|
|
const trueValue = ['true', 'True', 'TRUE'];
|
|
|
|
|
const falseValue = ['false', 'False', 'FALSE'];
|
|
|
|
|
const val = getInput(name, options);
|
|
|
|
|
if (trueValue.includes(val))
|
|
|
|
|
return true;
|
|
|
|
|
if (falseValue.includes(val))
|
|
|
|
|
return false;
|
|
|
|
|
throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
|
|
|
|
|
`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
|
|
|
|
|
}
|
|
|
|
|
exports.getBooleanInput = getBooleanInput;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/**
|
|
|
|
|
* Sets the value of an output.
|
|
|
|
|
*
|
|
|
|
|
* @param name name of the output to set
|
2020-10-01 20:20:08 +00:00
|
|
|
|
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
2020-02-24 09:23:15 +00:00
|
|
|
|
*/
|
2020-10-01 20:20:08 +00:00
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2020-02-24 09:23:15 +00:00
|
|
|
|
function setOutput(name, value) {
|
2021-09-09 12:42:30 +00:00
|
|
|
|
process.stdout.write(os.EOL);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
command_1.issueCommand('set-output', { name }, value);
|
|
|
|
|
}
|
|
|
|
|
exports.setOutput = setOutput;
|
2020-10-01 20:20:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
|
|
|
|
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
function setCommandEcho(enabled) {
|
|
|
|
|
command_1.issue('echo', enabled ? 'on' : 'off');
|
|
|
|
|
}
|
|
|
|
|
exports.setCommandEcho = setCommandEcho;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
//-----------------------------------------------------------------------
|
|
|
|
|
// Results
|
|
|
|
|
//-----------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* Sets the action status to failed.
|
|
|
|
|
* When the action exits it will be with an exit code of 1
|
|
|
|
|
* @param message add error issue message
|
|
|
|
|
*/
|
|
|
|
|
function setFailed(message) {
|
|
|
|
|
process.exitCode = ExitCode.Failure;
|
|
|
|
|
error(message);
|
|
|
|
|
}
|
|
|
|
|
exports.setFailed = setFailed;
|
|
|
|
|
//-----------------------------------------------------------------------
|
|
|
|
|
// Logging Commands
|
|
|
|
|
//-----------------------------------------------------------------------
|
2020-10-01 20:20:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* Gets whether Actions Step Debug is on or not
|
|
|
|
|
*/
|
|
|
|
|
function isDebug() {
|
|
|
|
|
return process.env['RUNNER_DEBUG'] === '1';
|
|
|
|
|
}
|
|
|
|
|
exports.isDebug = isDebug;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/**
|
|
|
|
|
* Writes debug message to user log
|
|
|
|
|
* @param message debug message
|
|
|
|
|
*/
|
|
|
|
|
function debug(message) {
|
|
|
|
|
command_1.issueCommand('debug', {}, message);
|
|
|
|
|
}
|
|
|
|
|
exports.debug = debug;
|
|
|
|
|
/**
|
|
|
|
|
* Adds an error issue
|
2020-10-01 20:20:08 +00:00
|
|
|
|
* @param message error issue message. Errors will be converted to string via toString()
|
2021-09-09 12:42:30 +00:00
|
|
|
|
* @param properties optional properties to add to the annotation.
|
2020-02-24 09:23:15 +00:00
|
|
|
|
*/
|
2021-09-09 12:42:30 +00:00
|
|
|
|
function error(message, properties = {}) {
|
|
|
|
|
command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
exports.error = error;
|
|
|
|
|
/**
|
2021-09-09 12:42:30 +00:00
|
|
|
|
* Adds a warning issue
|
2020-10-01 20:20:08 +00:00
|
|
|
|
* @param message warning issue message. Errors will be converted to string via toString()
|
2021-09-09 12:42:30 +00:00
|
|
|
|
* @param properties optional properties to add to the annotation.
|
2020-02-24 09:23:15 +00:00
|
|
|
|
*/
|
2021-09-09 12:42:30 +00:00
|
|
|
|
function warning(message, properties = {}) {
|
|
|
|
|
command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
exports.warning = warning;
|
2021-09-09 12:42:30 +00:00
|
|
|
|
/**
|
|
|
|
|
* Adds a notice issue
|
|
|
|
|
* @param message notice issue message. Errors will be converted to string via toString()
|
|
|
|
|
* @param properties optional properties to add to the annotation.
|
|
|
|
|
*/
|
|
|
|
|
function notice(message, properties = {}) {
|
|
|
|
|
command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
|
|
|
|
}
|
|
|
|
|
exports.notice = notice;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/**
|
|
|
|
|
* Writes info to log with console.log.
|
|
|
|
|
* @param message info message
|
|
|
|
|
*/
|
|
|
|
|
function info(message) {
|
|
|
|
|
process.stdout.write(message + os.EOL);
|
|
|
|
|
}
|
|
|
|
|
exports.info = info;
|
|
|
|
|
/**
|
|
|
|
|
* Begin an output group.
|
|
|
|
|
*
|
|
|
|
|
* Output until the next `groupEnd` will be foldable in this group
|
|
|
|
|
*
|
|
|
|
|
* @param name The name of the output group
|
|
|
|
|
*/
|
|
|
|
|
function startGroup(name) {
|
|
|
|
|
command_1.issue('group', name);
|
|
|
|
|
}
|
|
|
|
|
exports.startGroup = startGroup;
|
|
|
|
|
/**
|
|
|
|
|
* End an output group.
|
|
|
|
|
*/
|
|
|
|
|
function endGroup() {
|
|
|
|
|
command_1.issue('endgroup');
|
|
|
|
|
}
|
|
|
|
|
exports.endGroup = endGroup;
|
|
|
|
|
/**
|
|
|
|
|
* Wrap an asynchronous function call in a group.
|
|
|
|
|
*
|
|
|
|
|
* Returns the same type as the function itself.
|
|
|
|
|
*
|
|
|
|
|
* @param name The name of the group
|
|
|
|
|
* @param fn The function to wrap in the group
|
|
|
|
|
*/
|
|
|
|
|
function group(name, fn) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
startGroup(name);
|
|
|
|
|
let result;
|
|
|
|
|
try {
|
|
|
|
|
result = yield fn();
|
|
|
|
|
}
|
|
|
|
|
finally {
|
|
|
|
|
endGroup();
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
exports.group = group;
|
|
|
|
|
//-----------------------------------------------------------------------
|
|
|
|
|
// Wrapper action state
|
|
|
|
|
//-----------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
|
|
|
|
*
|
|
|
|
|
* @param name name of the state to store
|
2020-10-01 20:20:08 +00:00
|
|
|
|
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
2020-02-24 09:23:15 +00:00
|
|
|
|
*/
|
2020-10-01 20:20:08 +00:00
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2020-02-24 09:23:15 +00:00
|
|
|
|
function saveState(name, value) {
|
|
|
|
|
command_1.issueCommand('save-state', { name }, value);
|
|
|
|
|
}
|
|
|
|
|
exports.saveState = saveState;
|
|
|
|
|
/**
|
|
|
|
|
* Gets the value of an state set by this action's main execution.
|
|
|
|
|
*
|
|
|
|
|
* @param name name of the state to get
|
|
|
|
|
* @returns string
|
|
|
|
|
*/
|
|
|
|
|
function getState(name) {
|
|
|
|
|
return process.env[`STATE_${name}`] || '';
|
|
|
|
|
}
|
|
|
|
|
exports.getState = getState;
|
|
|
|
|
//# sourceMappingURL=core.js.map
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
/***/ 500:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
module.exports = defer;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Runs provided function on next iteration of the event loop
|
|
|
|
|
*
|
|
|
|
|
* @param {function} fn - function to run
|
|
|
|
|
*/
|
|
|
|
|
function defer(fn)
|
|
|
|
|
{
|
|
|
|
|
var nextTick = typeof setImmediate == 'function'
|
|
|
|
|
? setImmediate
|
|
|
|
|
: (
|
|
|
|
|
typeof process == 'object' && typeof process.nextTick == 'function'
|
|
|
|
|
? process.nextTick
|
|
|
|
|
: null
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (nextTick)
|
|
|
|
|
{
|
|
|
|
|
nextTick(fn);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
setTimeout(fn, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 512:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
2021-09-09 12:42:30 +00:00
|
|
|
|
module.exports = {"application/1d-interleaved-parityfec":{"source":"iana"},"application/3gpdash-qoe-report+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/3gpp-ims+xml":{"source":"iana","compressible":true},"application/3gpphal+json":{"source":"iana","compressible":true},"application/3gpphalforms+json":{"source":"iana","compressible":true},"application/a2l":{"source":"iana"},"application/activemessage":{"source":"iana"},"application/activity+json":{"source":"iana","compressible":true},"application/alto-costmap+json":{"source":"iana","compressible":true},"application/alto-costmapfilter+json":{"source":"iana","compressible":true},"application/alto-directory+json":{"source":"iana","compressible":true},"application/alto-endpointcost+json":{"source":"iana","compressible":true},"application/alto-endpointcostparams+json":{"source":"iana","compressible":true},"application/alto-endpointprop+json":{"source":"iana","compressible":true},"application/alto-endpointpropparams+json":{"source":"iana","compressible":true},"application/alto-error+json":{"source":"iana","compressible":true},"application/alto-networkmap+json":{"source":"iana","compressible":true},"application/alto-networkmapfilter+json":{"source":"iana","compressible":true},"application/alto-updatestreamcontrol+json":{"source":"iana","compressible":true},"application/alto-updatestreamparams+json":{"source":"iana","compressible":true},"application/aml":{"source":"iana"},"application/andrew-inset":{"source":"iana","extensions":["ez"]},"application/applefile":{"source":"iana"},"application/applixware":{"source":"apache","extensions":["aw"]},"application/atf":{"source":"iana"},"application/atfx":{"source":"iana"},"application/atom+xml":{"source":"iana","compressible":true,"extensions":["atom"]},"application/atomcat+xml":{"source":"iana","compressible":true,"extensions":["atomcat"]},"application/atomdeleted+xml":{"source":"iana","compressible":true,"extensions":["atomdeleted"]},"application/atomicmail":{"source":"iana"},"application/atomsvc+xml":{"source":"iana","compressible":true,"extensions":["atomsvc"]},"application/atsc-dwd+xml":{"source":"iana","compressible":true,"extensions":["dwd"]},"application/atsc-dynamic-event-message":{"source":"iana"},"application/atsc-held+xml":{"source":"iana","compressible":true,"extensions":["held"]},"application/atsc-rdt+json":{"source":"iana","compressible":true},"application/atsc-rsat+xml":{"source":"iana","compressible":true,"extensions":["rsat"]},"application/atxml":{"source":"iana"},"application/auth-policy+xml":{"source":"iana","compressible":true},"application/bacnet-xdd+zip":{"source":"iana","compressible":false},"application/batch-smtp":{"source":"iana"},"application/bdoc":{"compressible":false,"extensions":["bdoc"]},"application/beep+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/calendar+json":{"source":"iana","compressible":true},"application/calendar+xml":{"source":"iana","compressible":true,"extensions":["xcs"]},"application/call-completion":{"source":"iana"},"application/cals-1840":{"source":"iana"},"application/captive+json":{"source":"iana","compressible":true},"application/cbor":{"source":"iana"},"application/cbor-seq":{"source":"iana"},"application/cccex":{"source":"iana"},"application/ccmp+xml":{"source":"iana","compressible":true},"application/ccxml+xml":{"source":"iana","compressible":true,"extensions":["ccxml"]},"application/cdfx+xml":{"source":"iana","compressible":true,"extensions":["cdfx"]},"application/cdmi-capability":{"source":"iana","extensions":["cdmia"]},"application/cdmi-container":{"source":"iana","extensions":["cdmic"]},"application/cdmi-domain":{"source":"iana","extensions":["cdmid"]},"application/cdmi-object":{"source":"iana","extensions":["cdmio"]},"application/cdmi-queue":{"source":"iana","extensions":["cdmiq"]},"application/cdni":{"source":"iana"},"application/cea":{"source":"iana"},"application/cea-2018+xml":{"source":"iana","compressible":true},"application/cellml+xml":{"source":"iana","compressible":true},"application/cfw":{"source":"iana"},"applic
|
2021-01-24 12:14:13 +00:00
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/***/ 529:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var utils = __webpack_require__(35);
|
|
|
|
|
var normalizeHeaderName = __webpack_require__(411);
|
2021-09-09 12:42:30 +00:00
|
|
|
|
var enhanceError = __webpack_require__(369);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
|
|
|
|
var DEFAULT_CONTENT_TYPE = {
|
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function setContentTypeIfUnset(headers, value) {
|
|
|
|
|
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
|
|
|
|
|
headers['Content-Type'] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getDefaultAdapter() {
|
|
|
|
|
var adapter;
|
|
|
|
|
if (typeof XMLHttpRequest !== 'undefined') {
|
|
|
|
|
// For browsers use XHR adapter
|
|
|
|
|
adapter = __webpack_require__(219);
|
|
|
|
|
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
|
|
|
|
// For node use HTTP adapter
|
|
|
|
|
adapter = __webpack_require__(670);
|
|
|
|
|
}
|
|
|
|
|
return adapter;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-09 12:42:30 +00:00
|
|
|
|
function stringifySafely(rawValue, parser, encoder) {
|
|
|
|
|
if (utils.isString(rawValue)) {
|
|
|
|
|
try {
|
|
|
|
|
(parser || JSON.parse)(rawValue);
|
|
|
|
|
return utils.trim(rawValue);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
if (e.name !== 'SyntaxError') {
|
|
|
|
|
throw e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (encoder || JSON.stringify)(rawValue);
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
var defaults = {
|
2021-09-09 12:42:30 +00:00
|
|
|
|
|
|
|
|
|
transitional: {
|
|
|
|
|
silentJSONParsing: true,
|
|
|
|
|
forcedJSONParsing: true,
|
|
|
|
|
clarifyTimeoutError: false
|
|
|
|
|
},
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
adapter: getDefaultAdapter(),
|
|
|
|
|
|
|
|
|
|
transformRequest: [function transformRequest(data, headers) {
|
|
|
|
|
normalizeHeaderName(headers, 'Accept');
|
|
|
|
|
normalizeHeaderName(headers, 'Content-Type');
|
2021-09-09 12:42:30 +00:00
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
if (utils.isFormData(data) ||
|
|
|
|
|
utils.isArrayBuffer(data) ||
|
|
|
|
|
utils.isBuffer(data) ||
|
|
|
|
|
utils.isStream(data) ||
|
|
|
|
|
utils.isFile(data) ||
|
|
|
|
|
utils.isBlob(data)
|
|
|
|
|
) {
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
if (utils.isArrayBufferView(data)) {
|
|
|
|
|
return data.buffer;
|
|
|
|
|
}
|
|
|
|
|
if (utils.isURLSearchParams(data)) {
|
|
|
|
|
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
|
|
|
|
return data.toString();
|
|
|
|
|
}
|
2021-09-09 12:42:30 +00:00
|
|
|
|
if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) {
|
|
|
|
|
setContentTypeIfUnset(headers, 'application/json');
|
|
|
|
|
return stringifySafely(data);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
return data;
|
|
|
|
|
}],
|
|
|
|
|
|
|
|
|
|
transformResponse: [function transformResponse(data) {
|
2021-09-09 12:42:30 +00:00
|
|
|
|
var transitional = this.transitional;
|
|
|
|
|
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
|
|
|
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
|
|
|
var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
|
|
|
|
|
|
|
|
|
|
if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {
|
2020-02-24 09:23:15 +00:00
|
|
|
|
try {
|
2021-09-09 12:42:30 +00:00
|
|
|
|
return JSON.parse(data);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
if (strictJSONParsing) {
|
|
|
|
|
if (e.name === 'SyntaxError') {
|
|
|
|
|
throw enhanceError(e, this, 'E_JSON_PARSE');
|
|
|
|
|
}
|
|
|
|
|
throw e;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
2021-09-09 12:42:30 +00:00
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
return data;
|
|
|
|
|
}],
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
|
|
|
* timeout is not created.
|
|
|
|
|
*/
|
|
|
|
|
timeout: 0,
|
|
|
|
|
|
|
|
|
|
xsrfCookieName: 'XSRF-TOKEN',
|
|
|
|
|
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
|
|
|
|
|
|
|
|
maxContentLength: -1,
|
2020-10-01 20:20:08 +00:00
|
|
|
|
maxBodyLength: -1,
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
|
|
|
|
validateStatus: function validateStatus(status) {
|
|
|
|
|
return status >= 200 && status < 300;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
defaults.headers = {
|
|
|
|
|
common: {
|
|
|
|
|
'Accept': 'application/json, text/plain, */*'
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
|
|
|
|
defaults.headers[method] = {};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
|
|
|
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
module.exports = defaults;
|
|
|
|
|
|
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 547:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var util = __webpack_require__(669);
|
|
|
|
|
var Stream = __webpack_require__(413).Stream;
|
|
|
|
|
var DelayedStream = __webpack_require__(152);
|
|
|
|
|
|
|
|
|
|
module.exports = CombinedStream;
|
|
|
|
|
function CombinedStream() {
|
|
|
|
|
this.writable = false;
|
|
|
|
|
this.readable = true;
|
|
|
|
|
this.dataSize = 0;
|
|
|
|
|
this.maxDataSize = 2 * 1024 * 1024;
|
|
|
|
|
this.pauseStreams = true;
|
|
|
|
|
|
|
|
|
|
this._released = false;
|
|
|
|
|
this._streams = [];
|
|
|
|
|
this._currentStream = null;
|
|
|
|
|
this._insideLoop = false;
|
|
|
|
|
this._pendingNext = false;
|
|
|
|
|
}
|
|
|
|
|
util.inherits(CombinedStream, Stream);
|
|
|
|
|
|
|
|
|
|
CombinedStream.create = function(options) {
|
|
|
|
|
var combinedStream = new this();
|
|
|
|
|
|
|
|
|
|
options = options || {};
|
|
|
|
|
for (var option in options) {
|
|
|
|
|
combinedStream[option] = options[option];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return combinedStream;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CombinedStream.isStreamLike = function(stream) {
|
|
|
|
|
return (typeof stream !== 'function')
|
|
|
|
|
&& (typeof stream !== 'string')
|
|
|
|
|
&& (typeof stream !== 'boolean')
|
|
|
|
|
&& (typeof stream !== 'number')
|
|
|
|
|
&& (!Buffer.isBuffer(stream));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CombinedStream.prototype.append = function(stream) {
|
|
|
|
|
var isStreamLike = CombinedStream.isStreamLike(stream);
|
|
|
|
|
|
|
|
|
|
if (isStreamLike) {
|
|
|
|
|
if (!(stream instanceof DelayedStream)) {
|
|
|
|
|
var newStream = DelayedStream.create(stream, {
|
|
|
|
|
maxDataSize: Infinity,
|
|
|
|
|
pauseStream: this.pauseStreams,
|
|
|
|
|
});
|
|
|
|
|
stream.on('data', this._checkDataSize.bind(this));
|
|
|
|
|
stream = newStream;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._handleErrors(stream);
|
|
|
|
|
|
|
|
|
|
if (this.pauseStreams) {
|
|
|
|
|
stream.pause();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._streams.push(stream);
|
|
|
|
|
return this;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CombinedStream.prototype.pipe = function(dest, options) {
|
|
|
|
|
Stream.prototype.pipe.call(this, dest, options);
|
|
|
|
|
this.resume();
|
|
|
|
|
return dest;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CombinedStream.prototype._getNext = function() {
|
|
|
|
|
this._currentStream = null;
|
|
|
|
|
|
|
|
|
|
if (this._insideLoop) {
|
|
|
|
|
this._pendingNext = true;
|
|
|
|
|
return; // defer call
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._insideLoop = true;
|
|
|
|
|
try {
|
|
|
|
|
do {
|
|
|
|
|
this._pendingNext = false;
|
|
|
|
|
this._realGetNext();
|
|
|
|
|
} while (this._pendingNext);
|
|
|
|
|
} finally {
|
|
|
|
|
this._insideLoop = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CombinedStream.prototype._realGetNext = function() {
|
|
|
|
|
var stream = this._streams.shift();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (typeof stream == 'undefined') {
|
|
|
|
|
this.end();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (typeof stream !== 'function') {
|
|
|
|
|
this._pipeNext(stream);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var getStream = stream;
|
|
|
|
|
getStream(function(stream) {
|
|
|
|
|
var isStreamLike = CombinedStream.isStreamLike(stream);
|
|
|
|
|
if (isStreamLike) {
|
|
|
|
|
stream.on('data', this._checkDataSize.bind(this));
|
|
|
|
|
this._handleErrors(stream);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._pipeNext(stream);
|
|
|
|
|
}.bind(this));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CombinedStream.prototype._pipeNext = function(stream) {
|
|
|
|
|
this._currentStream = stream;
|
|
|
|
|
|
|
|
|
|
var isStreamLike = CombinedStream.isStreamLike(stream);
|
|
|
|
|
if (isStreamLike) {
|
|
|
|
|
stream.on('end', this._getNext.bind(this));
|
|
|
|
|
stream.pipe(this, {end: false});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var value = stream;
|
|
|
|
|
this.write(value);
|
|
|
|
|
this._getNext();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CombinedStream.prototype._handleErrors = function(stream) {
|
|
|
|
|
var self = this;
|
|
|
|
|
stream.on('error', function(err) {
|
|
|
|
|
self._emitError(err);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CombinedStream.prototype.write = function(data) {
|
|
|
|
|
this.emit('data', data);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CombinedStream.prototype.pause = function() {
|
|
|
|
|
if (!this.pauseStreams) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause();
|
|
|
|
|
this.emit('pause');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CombinedStream.prototype.resume = function() {
|
|
|
|
|
if (!this._released) {
|
|
|
|
|
this._released = true;
|
|
|
|
|
this.writable = true;
|
|
|
|
|
this._getNext();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume();
|
|
|
|
|
this.emit('resume');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CombinedStream.prototype.end = function() {
|
|
|
|
|
this._reset();
|
|
|
|
|
this.emit('end');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CombinedStream.prototype.destroy = function() {
|
|
|
|
|
this._reset();
|
|
|
|
|
this.emit('close');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CombinedStream.prototype._reset = function() {
|
|
|
|
|
this.writable = false;
|
|
|
|
|
this._streams = [];
|
|
|
|
|
this._currentStream = null;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CombinedStream.prototype._checkDataSize = function() {
|
|
|
|
|
this._updateDataSize();
|
|
|
|
|
if (this.dataSize <= this.maxDataSize) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var message =
|
|
|
|
|
'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.';
|
|
|
|
|
this._emitError(new Error(message));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CombinedStream.prototype._updateDataSize = function() {
|
|
|
|
|
this.dataSize = 0;
|
|
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
|
this._streams.forEach(function(stream) {
|
|
|
|
|
if (!stream.dataSize) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self.dataSize += stream.dataSize;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (this._currentStream && this._currentStream.dataSize) {
|
|
|
|
|
this.dataSize += this._currentStream.dataSize;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CombinedStream.prototype._emitError = function(err) {
|
|
|
|
|
this._reset();
|
|
|
|
|
this.emit('error', err);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 549:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var url = __webpack_require__(835);
|
2020-10-01 20:20:08 +00:00
|
|
|
|
var URL = url.URL;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
var http = __webpack_require__(605);
|
|
|
|
|
var https = __webpack_require__(211);
|
|
|
|
|
var Writable = __webpack_require__(413).Writable;
|
2020-10-01 20:20:08 +00:00
|
|
|
|
var assert = __webpack_require__(357);
|
|
|
|
|
var debug = __webpack_require__(454);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
|
|
|
|
// Create handlers that pass events from native requests
|
2021-09-09 12:42:30 +00:00
|
|
|
|
var events = ["abort", "aborted", "connect", "error", "socket", "timeout"];
|
2020-02-24 09:23:15 +00:00
|
|
|
|
var eventHandlers = Object.create(null);
|
2021-09-09 12:42:30 +00:00
|
|
|
|
events.forEach(function (event) {
|
2020-10-01 20:20:08 +00:00
|
|
|
|
eventHandlers[event] = function (arg1, arg2, arg3) {
|
|
|
|
|
this._redirectable.emit(event, arg1, arg2, arg3);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
// Error types with codes
|
|
|
|
|
var RedirectionError = createErrorType(
|
|
|
|
|
"ERR_FR_REDIRECTION_FAILURE",
|
|
|
|
|
""
|
|
|
|
|
);
|
|
|
|
|
var TooManyRedirectsError = createErrorType(
|
|
|
|
|
"ERR_FR_TOO_MANY_REDIRECTS",
|
|
|
|
|
"Maximum number of redirects exceeded"
|
|
|
|
|
);
|
|
|
|
|
var MaxBodyLengthExceededError = createErrorType(
|
|
|
|
|
"ERR_FR_MAX_BODY_LENGTH_EXCEEDED",
|
|
|
|
|
"Request body larger than maxBodyLength limit"
|
|
|
|
|
);
|
|
|
|
|
var WriteAfterEndError = createErrorType(
|
|
|
|
|
"ERR_STREAM_WRITE_AFTER_END",
|
|
|
|
|
"write after end"
|
|
|
|
|
);
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
// An HTTP(S) request that can be redirected
|
|
|
|
|
function RedirectableRequest(options, responseCallback) {
|
|
|
|
|
// Initialize the request
|
|
|
|
|
Writable.call(this);
|
2020-10-01 20:20:08 +00:00
|
|
|
|
this._sanitizeOptions(options);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
this._options = options;
|
2020-10-01 20:20:08 +00:00
|
|
|
|
this._ended = false;
|
|
|
|
|
this._ending = false;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
this._redirectCount = 0;
|
|
|
|
|
this._redirects = [];
|
|
|
|
|
this._requestBodyLength = 0;
|
|
|
|
|
this._requestBodyBuffers = [];
|
|
|
|
|
|
|
|
|
|
// Attach a callback if passed
|
|
|
|
|
if (responseCallback) {
|
|
|
|
|
this.on("response", responseCallback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// React to responses of native requests
|
|
|
|
|
var self = this;
|
|
|
|
|
this._onNativeResponse = function (response) {
|
|
|
|
|
self._processResponse(response);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Perform the first request
|
|
|
|
|
this._performRequest();
|
|
|
|
|
}
|
|
|
|
|
RedirectableRequest.prototype = Object.create(Writable.prototype);
|
|
|
|
|
|
2021-03-19 16:28:53 +00:00
|
|
|
|
RedirectableRequest.prototype.abort = function () {
|
2021-09-09 12:42:30 +00:00
|
|
|
|
abortRequest(this._currentRequest);
|
2021-03-19 16:28:53 +00:00
|
|
|
|
this.emit("abort");
|
|
|
|
|
};
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
// Writes buffered data to the current native request
|
|
|
|
|
RedirectableRequest.prototype.write = function (data, encoding, callback) {
|
2020-10-01 20:20:08 +00:00
|
|
|
|
// Writing is not allowed if end has been called
|
|
|
|
|
if (this._ending) {
|
|
|
|
|
throw new WriteAfterEndError();
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
// Validate input and shift parameters if necessary
|
|
|
|
|
if (!(typeof data === "string" || typeof data === "object" && ("length" in data))) {
|
2020-10-01 20:20:08 +00:00
|
|
|
|
throw new TypeError("data should be a string, Buffer or Uint8Array");
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
if (typeof encoding === "function") {
|
|
|
|
|
callback = encoding;
|
|
|
|
|
encoding = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Ignore empty buffers, since writing them doesn't invoke the callback
|
|
|
|
|
// https://github.com/nodejs/node/issues/22066
|
|
|
|
|
if (data.length === 0) {
|
|
|
|
|
if (callback) {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// Only write when we don't exceed the maximum body length
|
|
|
|
|
if (this._requestBodyLength + data.length <= this._options.maxBodyLength) {
|
|
|
|
|
this._requestBodyLength += data.length;
|
|
|
|
|
this._requestBodyBuffers.push({ data: data, encoding: encoding });
|
|
|
|
|
this._currentRequest.write(data, encoding, callback);
|
|
|
|
|
}
|
|
|
|
|
// Error when we exceed the maximum body length
|
|
|
|
|
else {
|
2020-10-01 20:20:08 +00:00
|
|
|
|
this.emit("error", new MaxBodyLengthExceededError());
|
2020-02-24 09:23:15 +00:00
|
|
|
|
this.abort();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Ends the current native request
|
|
|
|
|
RedirectableRequest.prototype.end = function (data, encoding, callback) {
|
|
|
|
|
// Shift parameters if necessary
|
|
|
|
|
if (typeof data === "function") {
|
|
|
|
|
callback = data;
|
|
|
|
|
data = encoding = null;
|
|
|
|
|
}
|
|
|
|
|
else if (typeof encoding === "function") {
|
|
|
|
|
callback = encoding;
|
|
|
|
|
encoding = null;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
// Write data if needed and end
|
|
|
|
|
if (!data) {
|
|
|
|
|
this._ended = this._ending = true;
|
|
|
|
|
this._currentRequest.end(null, null, callback);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
var self = this;
|
|
|
|
|
var currentRequest = this._currentRequest;
|
|
|
|
|
this.write(data, encoding, function () {
|
|
|
|
|
self._ended = true;
|
|
|
|
|
currentRequest.end(null, null, callback);
|
|
|
|
|
});
|
|
|
|
|
this._ending = true;
|
|
|
|
|
}
|
2020-02-24 09:23:15 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Sets a header value on the current native request
|
|
|
|
|
RedirectableRequest.prototype.setHeader = function (name, value) {
|
|
|
|
|
this._options.headers[name] = value;
|
|
|
|
|
this._currentRequest.setHeader(name, value);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Clears a header value on the current native request
|
|
|
|
|
RedirectableRequest.prototype.removeHeader = function (name) {
|
|
|
|
|
delete this._options.headers[name];
|
|
|
|
|
this._currentRequest.removeHeader(name);
|
|
|
|
|
};
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
// Global timeout for all underlying requests
|
|
|
|
|
RedirectableRequest.prototype.setTimeout = function (msecs, callback) {
|
2021-03-19 16:28:53 +00:00
|
|
|
|
var self = this;
|
2020-10-01 20:20:08 +00:00
|
|
|
|
if (callback) {
|
2021-03-19 16:28:53 +00:00
|
|
|
|
this.on("timeout", callback);
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-09 12:42:30 +00:00
|
|
|
|
function destroyOnTimeout(socket) {
|
|
|
|
|
socket.setTimeout(msecs);
|
|
|
|
|
socket.removeListener("timeout", socket.destroy);
|
|
|
|
|
socket.addListener("timeout", socket.destroy);
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-19 16:28:53 +00:00
|
|
|
|
// Sets up a timer to trigger a timeout event
|
2021-09-09 12:42:30 +00:00
|
|
|
|
function startTimer(socket) {
|
2021-03-19 16:28:53 +00:00
|
|
|
|
if (self._timeout) {
|
|
|
|
|
clearTimeout(self._timeout);
|
|
|
|
|
}
|
|
|
|
|
self._timeout = setTimeout(function () {
|
|
|
|
|
self.emit("timeout");
|
|
|
|
|
clearTimer();
|
|
|
|
|
}, msecs);
|
2021-09-09 12:42:30 +00:00
|
|
|
|
destroyOnTimeout(socket);
|
2021-03-19 16:28:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Prevent a timeout from triggering
|
|
|
|
|
function clearTimer() {
|
2021-09-09 12:42:30 +00:00
|
|
|
|
clearTimeout(self._timeout);
|
2021-03-19 16:28:53 +00:00
|
|
|
|
if (callback) {
|
|
|
|
|
self.removeListener("timeout", callback);
|
|
|
|
|
}
|
|
|
|
|
if (!this.socket) {
|
|
|
|
|
self._currentRequest.removeListener("socket", startTimer);
|
|
|
|
|
}
|
2020-10-01 20:20:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-03-19 16:28:53 +00:00
|
|
|
|
// Start the timer when the socket is opened
|
2020-10-01 20:20:08 +00:00
|
|
|
|
if (this.socket) {
|
2021-09-09 12:42:30 +00:00
|
|
|
|
startTimer(this.socket);
|
2020-10-01 20:20:08 +00:00
|
|
|
|
}
|
|
|
|
|
else {
|
2021-03-19 16:28:53 +00:00
|
|
|
|
this._currentRequest.once("socket", startTimer);
|
2020-10-01 20:20:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-09 12:42:30 +00:00
|
|
|
|
this.on("socket", destroyOnTimeout);
|
2020-10-01 20:20:08 +00:00
|
|
|
|
this.once("response", clearTimer);
|
|
|
|
|
this.once("error", clearTimer);
|
|
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
};
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
// Proxy all other public ClientRequest methods
|
|
|
|
|
[
|
2021-03-19 16:28:53 +00:00
|
|
|
|
"flushHeaders", "getHeader",
|
2020-10-01 20:20:08 +00:00
|
|
|
|
"setNoDelay", "setSocketKeepAlive",
|
2020-02-24 09:23:15 +00:00
|
|
|
|
].forEach(function (method) {
|
|
|
|
|
RedirectableRequest.prototype[method] = function (a, b) {
|
|
|
|
|
return this._currentRequest[method](a, b);
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Proxy all public ClientRequest properties
|
|
|
|
|
["aborted", "connection", "socket"].forEach(function (property) {
|
|
|
|
|
Object.defineProperty(RedirectableRequest.prototype, property, {
|
|
|
|
|
get: function () { return this._currentRequest[property]; },
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
RedirectableRequest.prototype._sanitizeOptions = function (options) {
|
|
|
|
|
// Ensure headers are always present
|
|
|
|
|
if (!options.headers) {
|
|
|
|
|
options.headers = {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Since http.request treats host as an alias of hostname,
|
|
|
|
|
// but the url module interprets host as hostname plus port,
|
|
|
|
|
// eliminate the host property to avoid confusion.
|
|
|
|
|
if (options.host) {
|
|
|
|
|
// Use hostname if set, because it has precedence
|
|
|
|
|
if (!options.hostname) {
|
|
|
|
|
options.hostname = options.host;
|
|
|
|
|
}
|
|
|
|
|
delete options.host;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Complete the URL object when necessary
|
|
|
|
|
if (!options.pathname && options.path) {
|
|
|
|
|
var searchPos = options.path.indexOf("?");
|
|
|
|
|
if (searchPos < 0) {
|
|
|
|
|
options.pathname = options.path;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
options.pathname = options.path.substring(0, searchPos);
|
|
|
|
|
options.search = options.path.substring(searchPos);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
// Executes the next native request (initial or redirect)
|
|
|
|
|
RedirectableRequest.prototype._performRequest = function () {
|
|
|
|
|
// Load the native protocol
|
|
|
|
|
var protocol = this._options.protocol;
|
|
|
|
|
var nativeProtocol = this._options.nativeProtocols[protocol];
|
|
|
|
|
if (!nativeProtocol) {
|
2020-10-01 20:20:08 +00:00
|
|
|
|
this.emit("error", new TypeError("Unsupported protocol " + protocol));
|
2020-02-24 09:23:15 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If specified, use the agent corresponding to the protocol
|
|
|
|
|
// (HTTP and HTTPS use different types of agents)
|
|
|
|
|
if (this._options.agents) {
|
|
|
|
|
var scheme = protocol.substr(0, protocol.length - 1);
|
|
|
|
|
this._options.agent = this._options.agents[scheme];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create the native request
|
|
|
|
|
var request = this._currentRequest =
|
|
|
|
|
nativeProtocol.request(this._options, this._onNativeResponse);
|
|
|
|
|
this._currentUrl = url.format(this._options);
|
|
|
|
|
|
|
|
|
|
// Set up event handlers
|
|
|
|
|
request._redirectable = this;
|
2021-09-09 12:42:30 +00:00
|
|
|
|
for (var e = 0; e < events.length; e++) {
|
|
|
|
|
request.on(events[e], eventHandlers[events[e]]);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// End a redirected request
|
|
|
|
|
// (The first request must be ended explicitly with RedirectableRequest#end)
|
|
|
|
|
if (this._isRedirect) {
|
|
|
|
|
// Write the request entity and end.
|
|
|
|
|
var i = 0;
|
2020-10-01 20:20:08 +00:00
|
|
|
|
var self = this;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
var buffers = this._requestBodyBuffers;
|
2020-10-01 20:20:08 +00:00
|
|
|
|
(function writeNext(error) {
|
|
|
|
|
// Only write if this request has not been redirected yet
|
|
|
|
|
/* istanbul ignore else */
|
|
|
|
|
if (request === self._currentRequest) {
|
|
|
|
|
// Report any write errors
|
|
|
|
|
/* istanbul ignore if */
|
|
|
|
|
if (error) {
|
|
|
|
|
self.emit("error", error);
|
|
|
|
|
}
|
|
|
|
|
// Write the next buffer if there are still left
|
|
|
|
|
else if (i < buffers.length) {
|
|
|
|
|
var buffer = buffers[i++];
|
|
|
|
|
/* istanbul ignore else */
|
|
|
|
|
if (!request.finished) {
|
|
|
|
|
request.write(buffer.data, buffer.encoding, writeNext);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// End the request if `end` has been called on us
|
|
|
|
|
else if (self._ended) {
|
|
|
|
|
request.end();
|
|
|
|
|
}
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
}());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Processes a response from the current native request
|
|
|
|
|
RedirectableRequest.prototype._processResponse = function (response) {
|
|
|
|
|
// Store the redirected response
|
2020-10-01 20:20:08 +00:00
|
|
|
|
var statusCode = response.statusCode;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
if (this._options.trackRedirects) {
|
|
|
|
|
this._redirects.push({
|
|
|
|
|
url: this._currentUrl,
|
|
|
|
|
headers: response.headers,
|
2020-10-01 20:20:08 +00:00
|
|
|
|
statusCode: statusCode,
|
2020-02-24 09:23:15 +00:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RFC7231§6.4: The 3xx (Redirection) class of status code indicates
|
|
|
|
|
// that further action needs to be taken by the user agent in order to
|
|
|
|
|
// fulfill the request. If a Location header field is provided,
|
|
|
|
|
// the user agent MAY automatically redirect its request to the URI
|
|
|
|
|
// referenced by the Location field value,
|
|
|
|
|
// even if the specific status code is not understood.
|
|
|
|
|
var location = response.headers.location;
|
|
|
|
|
if (location && this._options.followRedirects !== false &&
|
2020-10-01 20:20:08 +00:00
|
|
|
|
statusCode >= 300 && statusCode < 400) {
|
|
|
|
|
// Abort the current request
|
2021-09-09 12:42:30 +00:00
|
|
|
|
abortRequest(this._currentRequest);
|
2020-10-01 20:20:08 +00:00
|
|
|
|
// Discard the remainder of the response to avoid waiting for data
|
|
|
|
|
response.destroy();
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
// RFC7231§6.4: A client SHOULD detect and intervene
|
|
|
|
|
// in cyclical redirections (i.e., "infinite" redirection loops).
|
|
|
|
|
if (++this._redirectCount > this._options.maxRedirects) {
|
2020-10-01 20:20:08 +00:00
|
|
|
|
this.emit("error", new TooManyRedirectsError());
|
2020-02-24 09:23:15 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RFC7231§6.4: Automatic redirection needs to done with
|
2020-10-01 20:20:08 +00:00
|
|
|
|
// care for methods not known to be safe, […]
|
|
|
|
|
// RFC7231§6.4.2–3: For historical reasons, a user agent MAY change
|
|
|
|
|
// the request method from POST to GET for the subsequent request.
|
|
|
|
|
if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" ||
|
|
|
|
|
// RFC7231§6.4.4: The 303 (See Other) status code indicates that
|
|
|
|
|
// the server is redirecting the user agent to a different resource […]
|
|
|
|
|
// A user agent can perform a retrieval request targeting that URI
|
|
|
|
|
// (a GET or HEAD request if using HTTP) […]
|
|
|
|
|
(statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) {
|
2020-02-24 09:23:15 +00:00
|
|
|
|
this._options.method = "GET";
|
|
|
|
|
// Drop a possible entity and headers related to it
|
|
|
|
|
this._requestBodyBuffers = [];
|
2020-10-01 20:20:08 +00:00
|
|
|
|
removeMatchingHeaders(/^content-/i, this._options.headers);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Drop the Host header, as the redirect might lead to a different host
|
2020-10-01 20:20:08 +00:00
|
|
|
|
var previousHostName = removeMatchingHeaders(/^host$/i, this._options.headers) ||
|
|
|
|
|
url.parse(this._currentUrl).hostname;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
// Create the redirected request
|
2020-02-24 09:23:15 +00:00
|
|
|
|
var redirectUrl = url.resolve(this._currentUrl, location);
|
|
|
|
|
debug("redirecting to", redirectUrl);
|
|
|
|
|
this._isRedirect = true;
|
2020-10-01 20:20:08 +00:00
|
|
|
|
var redirectUrlParts = url.parse(redirectUrl);
|
|
|
|
|
Object.assign(this._options, redirectUrlParts);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
// Drop the Authorization header if redirecting to another host
|
|
|
|
|
if (redirectUrlParts.hostname !== previousHostName) {
|
|
|
|
|
removeMatchingHeaders(/^authorization$/i, this._options.headers);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Evaluate the beforeRedirect callback
|
|
|
|
|
if (typeof this._options.beforeRedirect === "function") {
|
|
|
|
|
var responseDetails = { headers: response.headers };
|
|
|
|
|
try {
|
|
|
|
|
this._options.beforeRedirect.call(null, this._options, responseDetails);
|
|
|
|
|
}
|
|
|
|
|
catch (err) {
|
|
|
|
|
this.emit("error", err);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this._sanitizeOptions(this._options);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Perform the redirected request
|
|
|
|
|
try {
|
|
|
|
|
this._performRequest();
|
|
|
|
|
}
|
|
|
|
|
catch (cause) {
|
|
|
|
|
var error = new RedirectionError("Redirected request failed: " + cause.message);
|
|
|
|
|
error.cause = cause;
|
|
|
|
|
this.emit("error", error);
|
|
|
|
|
}
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// The response is not a redirect; return it as-is
|
|
|
|
|
response.responseUrl = this._currentUrl;
|
|
|
|
|
response.redirects = this._redirects;
|
|
|
|
|
this.emit("response", response);
|
|
|
|
|
|
|
|
|
|
// Clean up
|
|
|
|
|
this._requestBodyBuffers = [];
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Wraps the key/value object of protocols with redirect functionality
|
|
|
|
|
function wrap(protocols) {
|
|
|
|
|
// Default settings
|
|
|
|
|
var exports = {
|
|
|
|
|
maxRedirects: 21,
|
|
|
|
|
maxBodyLength: 10 * 1024 * 1024,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Wrap each protocol
|
|
|
|
|
var nativeProtocols = {};
|
|
|
|
|
Object.keys(protocols).forEach(function (scheme) {
|
|
|
|
|
var protocol = scheme + ":";
|
|
|
|
|
var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];
|
|
|
|
|
var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol);
|
|
|
|
|
|
|
|
|
|
// Executes a request, following redirects
|
2020-12-16 20:37:11 +00:00
|
|
|
|
function request(input, options, callback) {
|
2020-10-01 20:20:08 +00:00
|
|
|
|
// Parse parameters
|
|
|
|
|
if (typeof input === "string") {
|
|
|
|
|
var urlStr = input;
|
|
|
|
|
try {
|
|
|
|
|
input = urlToOptions(new URL(urlStr));
|
|
|
|
|
}
|
|
|
|
|
catch (err) {
|
|
|
|
|
/* istanbul ignore next */
|
|
|
|
|
input = url.parse(urlStr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (URL && (input instanceof URL)) {
|
|
|
|
|
input = urlToOptions(input);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
else {
|
2020-10-01 20:20:08 +00:00
|
|
|
|
callback = options;
|
|
|
|
|
options = input;
|
|
|
|
|
input = { protocol: protocol };
|
|
|
|
|
}
|
|
|
|
|
if (typeof options === "function") {
|
|
|
|
|
callback = options;
|
|
|
|
|
options = null;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
2020-10-01 20:20:08 +00:00
|
|
|
|
|
|
|
|
|
// Set defaults
|
|
|
|
|
options = Object.assign({
|
|
|
|
|
maxRedirects: exports.maxRedirects,
|
|
|
|
|
maxBodyLength: exports.maxBodyLength,
|
|
|
|
|
}, input, options);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
options.nativeProtocols = nativeProtocols;
|
2020-10-01 20:20:08 +00:00
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
assert.equal(options.protocol, protocol, "protocol mismatch");
|
|
|
|
|
debug("options", options);
|
|
|
|
|
return new RedirectableRequest(options, callback);
|
2020-12-16 20:37:11 +00:00
|
|
|
|
}
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
|
|
|
|
// Executes a GET request, following redirects
|
2020-12-16 20:37:11 +00:00
|
|
|
|
function get(input, options, callback) {
|
|
|
|
|
var wrappedRequest = wrappedProtocol.request(input, options, callback);
|
|
|
|
|
wrappedRequest.end();
|
|
|
|
|
return wrappedRequest;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Expose the properties on the wrapped protocol
|
|
|
|
|
Object.defineProperties(wrappedProtocol, {
|
|
|
|
|
request: { value: request, configurable: true, enumerable: true, writable: true },
|
|
|
|
|
get: { value: get, configurable: true, enumerable: true, writable: true },
|
|
|
|
|
});
|
2020-02-24 09:23:15 +00:00
|
|
|
|
});
|
|
|
|
|
return exports;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
/* istanbul ignore next */
|
|
|
|
|
function noop() { /* empty */ }
|
|
|
|
|
|
|
|
|
|
// from https://github.com/nodejs/node/blob/master/lib/internal/url.js
|
|
|
|
|
function urlToOptions(urlObject) {
|
|
|
|
|
var options = {
|
|
|
|
|
protocol: urlObject.protocol,
|
|
|
|
|
hostname: urlObject.hostname.startsWith("[") ?
|
|
|
|
|
/* istanbul ignore next */
|
|
|
|
|
urlObject.hostname.slice(1, -1) :
|
|
|
|
|
urlObject.hostname,
|
|
|
|
|
hash: urlObject.hash,
|
|
|
|
|
search: urlObject.search,
|
|
|
|
|
pathname: urlObject.pathname,
|
|
|
|
|
path: urlObject.pathname + urlObject.search,
|
|
|
|
|
href: urlObject.href,
|
|
|
|
|
};
|
|
|
|
|
if (urlObject.port !== "") {
|
|
|
|
|
options.port = Number(urlObject.port);
|
|
|
|
|
}
|
|
|
|
|
return options;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function removeMatchingHeaders(regex, headers) {
|
|
|
|
|
var lastValue;
|
|
|
|
|
for (var header in headers) {
|
|
|
|
|
if (regex.test(header)) {
|
|
|
|
|
lastValue = headers[header];
|
|
|
|
|
delete headers[header];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return lastValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function createErrorType(code, defaultMessage) {
|
|
|
|
|
function CustomError(message) {
|
|
|
|
|
Error.captureStackTrace(this, this.constructor);
|
|
|
|
|
this.message = message || defaultMessage;
|
|
|
|
|
}
|
|
|
|
|
CustomError.prototype = new Error();
|
|
|
|
|
CustomError.prototype.constructor = CustomError;
|
|
|
|
|
CustomError.prototype.name = "Error [" + code + "]";
|
|
|
|
|
CustomError.prototype.code = code;
|
|
|
|
|
return CustomError;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-09 12:42:30 +00:00
|
|
|
|
function abortRequest(request) {
|
|
|
|
|
for (var e = 0; e < events.length; e++) {
|
|
|
|
|
request.removeListener(events[e], eventHandlers[events[e]]);
|
|
|
|
|
}
|
|
|
|
|
request.on("error", noop);
|
|
|
|
|
request.abort();
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
// Exports
|
|
|
|
|
module.exports = wrap({ http: http, https: https });
|
|
|
|
|
module.exports.wrap = wrap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 564:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var createError = __webpack_require__(26);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
module.exports = function settle(resolve, reject, response) {
|
|
|
|
|
var validateStatus = response.config.validateStatus;
|
2020-10-01 20:20:08 +00:00
|
|
|
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
2020-02-24 09:23:15 +00:00
|
|
|
|
resolve(response);
|
|
|
|
|
} else {
|
|
|
|
|
reject(createError(
|
|
|
|
|
'Request failed with status code ' + response.status,
|
|
|
|
|
response.config,
|
|
|
|
|
null,
|
|
|
|
|
response.request,
|
|
|
|
|
response
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 566:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
// API
|
|
|
|
|
module.exports = abort;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Aborts leftover active jobs
|
|
|
|
|
*
|
|
|
|
|
* @param {object} state - current state object
|
|
|
|
|
*/
|
|
|
|
|
function abort(state)
|
|
|
|
|
{
|
|
|
|
|
Object.keys(state.jobs).forEach(clean.bind(state));
|
|
|
|
|
|
|
|
|
|
// reset leftover jobs
|
|
|
|
|
state.jobs = {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Cleans up leftover job by invoking abort function for the provided job id
|
|
|
|
|
*
|
|
|
|
|
* @this state
|
|
|
|
|
* @param {string|number} key - job id to abort
|
|
|
|
|
*/
|
|
|
|
|
function clean(key)
|
|
|
|
|
{
|
|
|
|
|
if (typeof this.jobs[key] == 'function')
|
|
|
|
|
{
|
|
|
|
|
this.jobs[key]();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 589:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var utils = __webpack_require__(35);
|
2021-09-09 12:42:30 +00:00
|
|
|
|
var defaults = __webpack_require__(529);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Transform the data for a request or a response
|
|
|
|
|
*
|
|
|
|
|
* @param {Object|String} data The data to be transformed
|
|
|
|
|
* @param {Array} headers The headers for the request or response
|
|
|
|
|
* @param {Array|Function} fns A single function or Array of functions
|
|
|
|
|
* @returns {*} The resulting transformed data
|
|
|
|
|
*/
|
|
|
|
|
module.exports = function transformData(data, headers, fns) {
|
2021-09-09 12:42:30 +00:00
|
|
|
|
var context = this || defaults;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/*eslint no-param-reassign:0*/
|
|
|
|
|
utils.forEach(fns, function transform(fn) {
|
2021-09-09 12:42:30 +00:00
|
|
|
|
data = fn.call(context, data, headers);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 590:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determines whether the specified URL is absolute
|
|
|
|
|
*
|
|
|
|
|
* @param {string} url The URL to test
|
|
|
|
|
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
module.exports = function isAbsoluteURL(url) {
|
|
|
|
|
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
|
|
|
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
|
|
|
// by any combination of letters, digits, plus, period, or hyphen.
|
|
|
|
|
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 605:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
module.exports = require("http");
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 622:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
module.exports = require("path");
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 631:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var utils = __webpack_require__(35);
|
|
|
|
|
|
|
|
|
|
// Headers whose duplicates are ignored by node
|
|
|
|
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
|
|
|
var ignoreDuplicateOf = [
|
|
|
|
|
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
|
|
|
|
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
|
|
|
|
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
|
|
|
|
'referer', 'retry-after', 'user-agent'
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Parse headers into an object
|
|
|
|
|
*
|
|
|
|
|
* ```
|
|
|
|
|
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
|
|
|
|
* Content-Type: application/json
|
|
|
|
|
* Connection: keep-alive
|
|
|
|
|
* Transfer-Encoding: chunked
|
|
|
|
|
* ```
|
|
|
|
|
*
|
|
|
|
|
* @param {String} headers Headers needing to be parsed
|
|
|
|
|
* @returns {Object} Headers parsed into an object
|
|
|
|
|
*/
|
|
|
|
|
module.exports = function parseHeaders(headers) {
|
|
|
|
|
var parsed = {};
|
|
|
|
|
var key;
|
|
|
|
|
var val;
|
|
|
|
|
var i;
|
|
|
|
|
|
|
|
|
|
if (!headers) { return parsed; }
|
|
|
|
|
|
|
|
|
|
utils.forEach(headers.split('\n'), function parser(line) {
|
|
|
|
|
i = line.indexOf(':');
|
|
|
|
|
key = utils.trim(line.substr(0, i)).toLowerCase();
|
|
|
|
|
val = utils.trim(line.substr(i + 1));
|
|
|
|
|
|
|
|
|
|
if (key) {
|
|
|
|
|
if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (key === 'set-cookie') {
|
|
|
|
|
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
|
|
|
|
|
} else {
|
|
|
|
|
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return parsed;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 669:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
module.exports = require("util");
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 670:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var utils = __webpack_require__(35);
|
|
|
|
|
var settle = __webpack_require__(564);
|
|
|
|
|
var buildFullPath = __webpack_require__(960);
|
|
|
|
|
var buildURL = __webpack_require__(133);
|
|
|
|
|
var http = __webpack_require__(605);
|
|
|
|
|
var https = __webpack_require__(211);
|
|
|
|
|
var httpFollow = __webpack_require__(549).http;
|
|
|
|
|
var httpsFollow = __webpack_require__(549).https;
|
|
|
|
|
var url = __webpack_require__(835);
|
2020-10-01 20:20:08 +00:00
|
|
|
|
var zlib = __webpack_require__(761);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
var pkg = __webpack_require__(361);
|
|
|
|
|
var createError = __webpack_require__(26);
|
|
|
|
|
var enhanceError = __webpack_require__(369);
|
|
|
|
|
|
|
|
|
|
var isHttps = /https:?/;
|
|
|
|
|
|
2021-01-05 17:57:45 +00:00
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param {http.ClientRequestArgs} options
|
|
|
|
|
* @param {AxiosProxyConfig} proxy
|
|
|
|
|
* @param {string} location
|
|
|
|
|
*/
|
|
|
|
|
function setProxy(options, proxy, location) {
|
|
|
|
|
options.hostname = proxy.host;
|
|
|
|
|
options.host = proxy.host;
|
|
|
|
|
options.port = proxy.port;
|
|
|
|
|
options.path = location;
|
|
|
|
|
|
|
|
|
|
// Basic proxy authorization
|
|
|
|
|
if (proxy.auth) {
|
|
|
|
|
var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
|
|
|
|
|
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If a proxy is used, any redirects must also pass through the proxy
|
|
|
|
|
options.beforeRedirect = function beforeRedirect(redirection) {
|
|
|
|
|
redirection.headers.host = redirection.host;
|
|
|
|
|
setProxy(redirection, proxy, redirection.href);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/*eslint consistent-return:0*/
|
|
|
|
|
module.exports = function httpAdapter(config) {
|
|
|
|
|
return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
|
|
|
|
|
var resolve = function resolve(value) {
|
|
|
|
|
resolvePromise(value);
|
|
|
|
|
};
|
|
|
|
|
var reject = function reject(value) {
|
|
|
|
|
rejectPromise(value);
|
|
|
|
|
};
|
|
|
|
|
var data = config.data;
|
|
|
|
|
var headers = config.headers;
|
|
|
|
|
|
|
|
|
|
// Set User-Agent (required by some servers)
|
|
|
|
|
// See https://github.com/axios/axios/issues/69
|
2021-09-09 12:42:30 +00:00
|
|
|
|
if ('User-Agent' in headers || 'user-agent' in headers) {
|
|
|
|
|
// User-Agent is specified; handle case where no UA header is desired
|
|
|
|
|
if (!headers['User-Agent'] && !headers['user-agent']) {
|
|
|
|
|
delete headers['User-Agent'];
|
|
|
|
|
delete headers['user-agent'];
|
|
|
|
|
}
|
|
|
|
|
// Otherwise, use specified value
|
|
|
|
|
} else {
|
|
|
|
|
// Only set header if it hasn't been set in config
|
2020-02-24 09:23:15 +00:00
|
|
|
|
headers['User-Agent'] = 'axios/' + pkg.version;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data && !utils.isStream(data)) {
|
|
|
|
|
if (Buffer.isBuffer(data)) {
|
|
|
|
|
// Nothing to do...
|
|
|
|
|
} else if (utils.isArrayBuffer(data)) {
|
|
|
|
|
data = Buffer.from(new Uint8Array(data));
|
|
|
|
|
} else if (utils.isString(data)) {
|
|
|
|
|
data = Buffer.from(data, 'utf-8');
|
|
|
|
|
} else {
|
|
|
|
|
return reject(createError(
|
|
|
|
|
'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
|
|
|
|
|
config
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add Content-Length header if data exists
|
|
|
|
|
headers['Content-Length'] = data.length;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// HTTP basic authentication
|
|
|
|
|
var auth = undefined;
|
|
|
|
|
if (config.auth) {
|
|
|
|
|
var username = config.auth.username || '';
|
|
|
|
|
var password = config.auth.password || '';
|
|
|
|
|
auth = username + ':' + password;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Parse url
|
|
|
|
|
var fullPath = buildFullPath(config.baseURL, config.url);
|
|
|
|
|
var parsed = url.parse(fullPath);
|
|
|
|
|
var protocol = parsed.protocol || 'http:';
|
|
|
|
|
|
|
|
|
|
if (!auth && parsed.auth) {
|
|
|
|
|
var urlAuth = parsed.auth.split(':');
|
|
|
|
|
var urlUsername = urlAuth[0] || '';
|
|
|
|
|
var urlPassword = urlAuth[1] || '';
|
|
|
|
|
auth = urlUsername + ':' + urlPassword;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (auth) {
|
|
|
|
|
delete headers.Authorization;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var isHttpsRequest = isHttps.test(protocol);
|
|
|
|
|
var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
|
|
|
|
|
|
|
|
|
|
var options = {
|
|
|
|
|
path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''),
|
|
|
|
|
method: config.method.toUpperCase(),
|
|
|
|
|
headers: headers,
|
|
|
|
|
agent: agent,
|
|
|
|
|
agents: { http: config.httpAgent, https: config.httpsAgent },
|
|
|
|
|
auth: auth
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (config.socketPath) {
|
|
|
|
|
options.socketPath = config.socketPath;
|
|
|
|
|
} else {
|
|
|
|
|
options.hostname = parsed.hostname;
|
|
|
|
|
options.port = parsed.port;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var proxy = config.proxy;
|
|
|
|
|
if (!proxy && proxy !== false) {
|
|
|
|
|
var proxyEnv = protocol.slice(0, -1) + '_proxy';
|
|
|
|
|
var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()];
|
|
|
|
|
if (proxyUrl) {
|
|
|
|
|
var parsedProxyUrl = url.parse(proxyUrl);
|
|
|
|
|
var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY;
|
|
|
|
|
var shouldProxy = true;
|
|
|
|
|
|
|
|
|
|
if (noProxyEnv) {
|
|
|
|
|
var noProxy = noProxyEnv.split(',').map(function trim(s) {
|
|
|
|
|
return s.trim();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
shouldProxy = !noProxy.some(function proxyMatch(proxyElement) {
|
|
|
|
|
if (!proxyElement) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (proxyElement === '*') {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (proxyElement[0] === '.' &&
|
|
|
|
|
parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return parsed.hostname === proxyElement;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (shouldProxy) {
|
|
|
|
|
proxy = {
|
|
|
|
|
host: parsedProxyUrl.hostname,
|
2021-01-05 17:57:45 +00:00
|
|
|
|
port: parsedProxyUrl.port,
|
|
|
|
|
protocol: parsedProxyUrl.protocol
|
2020-02-24 09:23:15 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (parsedProxyUrl.auth) {
|
|
|
|
|
var proxyUrlAuth = parsedProxyUrl.auth.split(':');
|
|
|
|
|
proxy.auth = {
|
|
|
|
|
username: proxyUrlAuth[0],
|
|
|
|
|
password: proxyUrlAuth[1]
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (proxy) {
|
|
|
|
|
options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : '');
|
2021-01-05 17:57:45 +00:00
|
|
|
|
setProxy(options, proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var transport;
|
|
|
|
|
var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true);
|
|
|
|
|
if (config.transport) {
|
|
|
|
|
transport = config.transport;
|
|
|
|
|
} else if (config.maxRedirects === 0) {
|
|
|
|
|
transport = isHttpsProxy ? https : http;
|
|
|
|
|
} else {
|
|
|
|
|
if (config.maxRedirects) {
|
|
|
|
|
options.maxRedirects = config.maxRedirects;
|
|
|
|
|
}
|
|
|
|
|
transport = isHttpsProxy ? httpsFollow : httpFollow;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
if (config.maxBodyLength > -1) {
|
|
|
|
|
options.maxBodyLength = config.maxBodyLength;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create the request
|
|
|
|
|
var req = transport.request(options, function handleResponse(res) {
|
|
|
|
|
if (req.aborted) return;
|
|
|
|
|
|
|
|
|
|
// uncompress the response body transparently if required
|
|
|
|
|
var stream = res;
|
|
|
|
|
|
|
|
|
|
// return the last request in case of redirects
|
|
|
|
|
var lastRequest = res.req || req;
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
|
|
|
|
|
// if no content, is HEAD request or decompress disabled we should not decompress
|
|
|
|
|
if (res.statusCode !== 204 && lastRequest.method !== 'HEAD' && config.decompress !== false) {
|
|
|
|
|
switch (res.headers['content-encoding']) {
|
|
|
|
|
/*eslint default-case:0*/
|
|
|
|
|
case 'gzip':
|
|
|
|
|
case 'compress':
|
|
|
|
|
case 'deflate':
|
|
|
|
|
// add the unzipper to the body stream processing pipeline
|
|
|
|
|
stream = stream.pipe(zlib.createUnzip());
|
|
|
|
|
|
|
|
|
|
// remove the content-encoding in order to not confuse downstream operations
|
|
|
|
|
delete res.headers['content-encoding'];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
var response = {
|
|
|
|
|
status: res.statusCode,
|
|
|
|
|
statusText: res.statusMessage,
|
|
|
|
|
headers: res.headers,
|
|
|
|
|
config: config,
|
|
|
|
|
request: lastRequest
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (config.responseType === 'stream') {
|
|
|
|
|
response.data = stream;
|
|
|
|
|
settle(resolve, reject, response);
|
|
|
|
|
} else {
|
|
|
|
|
var responseBuffer = [];
|
2021-09-09 12:42:30 +00:00
|
|
|
|
var totalResponseBytes = 0;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
stream.on('data', function handleStreamData(chunk) {
|
|
|
|
|
responseBuffer.push(chunk);
|
2021-09-09 12:42:30 +00:00
|
|
|
|
totalResponseBytes += chunk.length;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
|
|
|
|
// make sure the content length is not over the maxContentLength if specified
|
2021-09-09 12:42:30 +00:00
|
|
|
|
if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
|
2020-02-24 09:23:15 +00:00
|
|
|
|
stream.destroy();
|
|
|
|
|
reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
|
|
|
|
config, null, lastRequest));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
stream.on('error', function handleStreamError(err) {
|
|
|
|
|
if (req.aborted) return;
|
|
|
|
|
reject(enhanceError(err, config, null, lastRequest));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
stream.on('end', function handleStreamEnd() {
|
|
|
|
|
var responseData = Buffer.concat(responseBuffer);
|
|
|
|
|
if (config.responseType !== 'arraybuffer') {
|
|
|
|
|
responseData = responseData.toString(config.responseEncoding);
|
2020-10-01 20:20:08 +00:00
|
|
|
|
if (!config.responseEncoding || config.responseEncoding === 'utf8') {
|
|
|
|
|
responseData = utils.stripBOM(responseData);
|
|
|
|
|
}
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
response.data = responseData;
|
|
|
|
|
settle(resolve, reject, response);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Handle errors
|
|
|
|
|
req.on('error', function handleRequestError(err) {
|
2020-10-01 20:20:08 +00:00
|
|
|
|
if (req.aborted && err.code !== 'ERR_FR_TOO_MANY_REDIRECTS') return;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
reject(enhanceError(err, config, null, req));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Handle request timeout
|
|
|
|
|
if (config.timeout) {
|
2021-09-09 12:42:30 +00:00
|
|
|
|
// This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
|
|
|
|
|
var timeout = parseInt(config.timeout, 10);
|
|
|
|
|
|
|
|
|
|
if (isNaN(timeout)) {
|
|
|
|
|
reject(createError(
|
|
|
|
|
'error trying to parse `config.timeout` to int',
|
|
|
|
|
config,
|
|
|
|
|
'ERR_PARSE_TIMEOUT',
|
|
|
|
|
req
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
// Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
|
|
|
|
|
// And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
|
|
|
|
|
// At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.
|
|
|
|
|
// And then these socket which be hang up will devoring CPU little by little.
|
|
|
|
|
// ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
|
2021-09-09 12:42:30 +00:00
|
|
|
|
req.setTimeout(timeout, function handleRequestTimeout() {
|
2020-02-24 09:23:15 +00:00
|
|
|
|
req.abort();
|
2021-09-09 12:42:30 +00:00
|
|
|
|
reject(createError(
|
|
|
|
|
'timeout of ' + timeout + 'ms exceeded',
|
|
|
|
|
config,
|
|
|
|
|
config.transitional && config.transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
|
|
|
|
|
req
|
|
|
|
|
));
|
2020-02-24 09:23:15 +00:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (config.cancelToken) {
|
|
|
|
|
// Handle cancellation
|
|
|
|
|
config.cancelToken.promise.then(function onCanceled(cancel) {
|
|
|
|
|
if (req.aborted) return;
|
|
|
|
|
|
|
|
|
|
req.abort();
|
|
|
|
|
reject(cancel);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Send the request
|
|
|
|
|
if (utils.isStream(data)) {
|
|
|
|
|
data.on('error', function handleStreamError(err) {
|
|
|
|
|
reject(enhanceError(err, config, null, req));
|
|
|
|
|
}).pipe(req);
|
|
|
|
|
} else {
|
|
|
|
|
req.end(data);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 676:
|
|
|
|
|
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
const core = __webpack_require__(470);
|
2020-07-30 16:27:27 +00:00
|
|
|
|
const { request, METHOD_POST } = __webpack_require__(354);
|
|
|
|
|
const { GithubActions } = __webpack_require__(230);
|
2020-04-21 11:55:30 +00:00
|
|
|
|
|
2020-04-21 11:30:34 +00:00
|
|
|
|
let auth = undefined
|
2020-03-25 10:23:19 +00:00
|
|
|
|
let customHeaders = {}
|
|
|
|
|
|
|
|
|
|
if (!!core.getInput('customHeaders')) {
|
|
|
|
|
try {
|
|
|
|
|
customHeaders = JSON.parse(core.getInput('customHeaders'));
|
|
|
|
|
} catch(error) {
|
|
|
|
|
core.error('Could not parse customHeaders string value')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
const headers = { 'Content-Type': core.getInput('contentType') || 'application/json' }
|
|
|
|
|
|
2020-04-21 11:30:34 +00:00
|
|
|
|
if (!!core.getInput('username') || !!core.getInput('password')) {
|
|
|
|
|
core.debug('Add BasicHTTP Auth config')
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2020-04-21 11:30:34 +00:00
|
|
|
|
auth = {
|
|
|
|
|
username: core.getInput('username'),
|
|
|
|
|
password: core.getInput('password')
|
|
|
|
|
}
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!!core.getInput('bearerToken')) {
|
2020-05-06 18:43:17 +00:00
|
|
|
|
headers['Authorization'] = `Bearer ${core.getInput('bearerToken')}`;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-21 11:30:34 +00:00
|
|
|
|
const instanceConfig = {
|
2020-02-24 09:23:15 +00:00
|
|
|
|
baseURL: core.getInput('url', { required: true }),
|
|
|
|
|
timeout: parseInt(core.getInput('timeout') || 5000, 10),
|
2020-03-25 10:23:19 +00:00
|
|
|
|
headers: { ...headers, ...customHeaders }
|
2020-04-21 11:30:34 +00:00
|
|
|
|
}
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2020-07-30 16:27:27 +00:00
|
|
|
|
const data = core.getInput('data') || '{}';
|
2021-01-24 12:14:13 +00:00
|
|
|
|
const files = core.getInput('files') || '{}';
|
2020-07-30 16:27:27 +00:00
|
|
|
|
const method = core.getInput('method') || METHOD_POST;
|
|
|
|
|
const preventFailureOnNoResponse = core.getInput('preventFailureOnNoResponse') === 'true';
|
2020-10-07 16:29:38 +00:00
|
|
|
|
const escapeData = core.getInput('escapeData') === 'true';
|
2020-04-21 11:30:34 +00:00
|
|
|
|
|
2021-03-19 16:28:53 +00:00
|
|
|
|
const ignoreStatusCodes = core.getInput('ignoreStatusCodes')
|
|
|
|
|
let ignoredCodes = []
|
|
|
|
|
|
|
|
|
|
if (typeof ignoreStatusCodes === 'string' && ignoreStatusCodes.length > 0) {
|
|
|
|
|
ignoredCodes = ignoreStatusCodes.split(',').map(statusCode => parseInt(statusCode.trim()))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
request({ data, method, instanceConfig, auth, preventFailureOnNoResponse, escapeData, files, ignoredCodes, actions: new GithubActions() })
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 688:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var utils = __webpack_require__(35);
|
|
|
|
|
|
|
|
|
|
module.exports = (
|
|
|
|
|
utils.isStandardBrowserEnv() ?
|
|
|
|
|
|
|
|
|
|
// Standard browser envs have full support of the APIs needed to test
|
|
|
|
|
// whether the request URL is of the same origin as current location.
|
|
|
|
|
(function standardBrowserEnv() {
|
|
|
|
|
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
|
|
|
|
var urlParsingNode = document.createElement('a');
|
|
|
|
|
var originURL;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Parse a URL to discover it's components
|
|
|
|
|
*
|
|
|
|
|
* @param {String} url The URL to be parsed
|
|
|
|
|
* @returns {Object}
|
|
|
|
|
*/
|
|
|
|
|
function resolveURL(url) {
|
|
|
|
|
var href = url;
|
|
|
|
|
|
|
|
|
|
if (msie) {
|
|
|
|
|
// IE needs attribute set twice to normalize properties
|
|
|
|
|
urlParsingNode.setAttribute('href', href);
|
|
|
|
|
href = urlParsingNode.href;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
urlParsingNode.setAttribute('href', href);
|
|
|
|
|
|
|
|
|
|
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
|
|
|
|
return {
|
|
|
|
|
href: urlParsingNode.href,
|
|
|
|
|
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
|
|
|
|
host: urlParsingNode.host,
|
|
|
|
|
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
|
|
|
|
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
|
|
|
|
hostname: urlParsingNode.hostname,
|
|
|
|
|
port: urlParsingNode.port,
|
|
|
|
|
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
|
|
|
|
urlParsingNode.pathname :
|
|
|
|
|
'/' + urlParsingNode.pathname
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
originURL = resolveURL(window.location.href);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine if a URL shares the same origin as the current location
|
|
|
|
|
*
|
|
|
|
|
* @param {String} requestURL The URL to test
|
|
|
|
|
* @returns {boolean} True if URL shares the same origin, otherwise false
|
|
|
|
|
*/
|
|
|
|
|
return function isURLSameOrigin(requestURL) {
|
|
|
|
|
var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
|
|
|
|
return (parsed.protocol === originURL.protocol &&
|
|
|
|
|
parsed.host === originURL.host);
|
|
|
|
|
};
|
|
|
|
|
})() :
|
|
|
|
|
|
|
|
|
|
// Non standard browser envs (web workers, react-native) lack needed support.
|
|
|
|
|
(function nonStandardBrowserEnv() {
|
|
|
|
|
return function isURLSameOrigin() {
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
})()
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 727:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = function bind(fn, thisArg) {
|
|
|
|
|
return function wrap() {
|
|
|
|
|
var args = new Array(arguments.length);
|
|
|
|
|
for (var i = 0; i < args.length; i++) {
|
|
|
|
|
args[i] = arguments[i];
|
|
|
|
|
}
|
|
|
|
|
return fn.apply(thisArg, args);
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 732:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = function isCancel(value) {
|
|
|
|
|
return !!(value && value.__CANCEL__);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
/***/ 747:
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
module.exports = require("fs");
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 751:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var defer = __webpack_require__(500);
|
|
|
|
|
|
|
|
|
|
// API
|
|
|
|
|
module.exports = async;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Runs provided callback asynchronously
|
|
|
|
|
* even if callback itself is not
|
|
|
|
|
*
|
|
|
|
|
* @param {function} callback - callback to invoke
|
|
|
|
|
* @returns {function} - augmented callback
|
|
|
|
|
*/
|
|
|
|
|
function async(callback)
|
|
|
|
|
{
|
|
|
|
|
var isAsync = false;
|
|
|
|
|
|
|
|
|
|
// check if async happened
|
|
|
|
|
defer(function() { isAsync = true; });
|
|
|
|
|
|
|
|
|
|
return function async_callback(err, result)
|
|
|
|
|
{
|
|
|
|
|
if (isAsync)
|
|
|
|
|
{
|
|
|
|
|
callback(err, result);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
defer(function nextTick_callback()
|
|
|
|
|
{
|
|
|
|
|
callback(err, result);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
/***/ }),
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
/***/ 761:
|
|
|
|
|
/***/ (function(module) {
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
module.exports = require("zlib");
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 779:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var utils = __webpack_require__(35);
|
|
|
|
|
var buildURL = __webpack_require__(133);
|
|
|
|
|
var InterceptorManager = __webpack_require__(283);
|
|
|
|
|
var dispatchRequest = __webpack_require__(946);
|
|
|
|
|
var mergeConfig = __webpack_require__(825);
|
2021-09-09 12:42:30 +00:00
|
|
|
|
var validator = __webpack_require__(106);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2021-09-09 12:42:30 +00:00
|
|
|
|
var validators = validator.validators;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/**
|
|
|
|
|
* Create a new instance of Axios
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} instanceConfig The default config for the instance
|
|
|
|
|
*/
|
|
|
|
|
function Axios(instanceConfig) {
|
|
|
|
|
this.defaults = instanceConfig;
|
|
|
|
|
this.interceptors = {
|
|
|
|
|
request: new InterceptorManager(),
|
|
|
|
|
response: new InterceptorManager()
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Dispatch a request
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} config The config specific for this request (merged with this.defaults)
|
|
|
|
|
*/
|
|
|
|
|
Axios.prototype.request = function request(config) {
|
|
|
|
|
/*eslint no-param-reassign:0*/
|
|
|
|
|
// Allow for axios('example/url'[, config]) a la fetch API
|
|
|
|
|
if (typeof config === 'string') {
|
|
|
|
|
config = arguments[1] || {};
|
|
|
|
|
config.url = arguments[0];
|
|
|
|
|
} else {
|
|
|
|
|
config = config || {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
config = mergeConfig(this.defaults, config);
|
|
|
|
|
|
|
|
|
|
// Set config.method
|
|
|
|
|
if (config.method) {
|
|
|
|
|
config.method = config.method.toLowerCase();
|
|
|
|
|
} else if (this.defaults.method) {
|
|
|
|
|
config.method = this.defaults.method.toLowerCase();
|
|
|
|
|
} else {
|
|
|
|
|
config.method = 'get';
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-09 12:42:30 +00:00
|
|
|
|
var transitional = config.transitional;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
2021-09-09 12:42:30 +00:00
|
|
|
|
if (transitional !== undefined) {
|
|
|
|
|
validator.assertOptions(transitional, {
|
|
|
|
|
silentJSONParsing: validators.transitional(validators.boolean, '1.0.0'),
|
|
|
|
|
forcedJSONParsing: validators.transitional(validators.boolean, '1.0.0'),
|
|
|
|
|
clarifyTimeoutError: validators.transitional(validators.boolean, '1.0.0')
|
|
|
|
|
}, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// filter out skipped interceptors
|
|
|
|
|
var requestInterceptorChain = [];
|
|
|
|
|
var synchronousRequestInterceptors = true;
|
2020-02-24 09:23:15 +00:00
|
|
|
|
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
2021-09-09 12:42:30 +00:00
|
|
|
|
if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
|
|
|
|
|
|
|
|
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
});
|
|
|
|
|
|
2021-09-09 12:42:30 +00:00
|
|
|
|
var responseInterceptorChain = [];
|
2020-02-24 09:23:15 +00:00
|
|
|
|
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
2021-09-09 12:42:30 +00:00
|
|
|
|
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
});
|
|
|
|
|
|
2021-09-09 12:42:30 +00:00
|
|
|
|
var promise;
|
|
|
|
|
|
|
|
|
|
if (!synchronousRequestInterceptors) {
|
|
|
|
|
var chain = [dispatchRequest, undefined];
|
|
|
|
|
|
|
|
|
|
Array.prototype.unshift.apply(chain, requestInterceptorChain);
|
|
|
|
|
chain = chain.concat(responseInterceptorChain);
|
|
|
|
|
|
|
|
|
|
promise = Promise.resolve(config);
|
|
|
|
|
while (chain.length) {
|
|
|
|
|
promise = promise.then(chain.shift(), chain.shift());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return promise;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var newConfig = config;
|
|
|
|
|
while (requestInterceptorChain.length) {
|
|
|
|
|
var onFulfilled = requestInterceptorChain.shift();
|
|
|
|
|
var onRejected = requestInterceptorChain.shift();
|
|
|
|
|
try {
|
|
|
|
|
newConfig = onFulfilled(newConfig);
|
|
|
|
|
} catch (error) {
|
|
|
|
|
onRejected(error);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
promise = dispatchRequest(newConfig);
|
|
|
|
|
} catch (error) {
|
|
|
|
|
return Promise.reject(error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (responseInterceptorChain.length) {
|
|
|
|
|
promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return promise;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Axios.prototype.getUri = function getUri(config) {
|
|
|
|
|
config = mergeConfig(this.defaults, config);
|
|
|
|
|
return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 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) {
|
2020-10-01 20:20:08 +00:00
|
|
|
|
return this.request(mergeConfig(config || {}, {
|
2020-02-24 09:23:15 +00:00
|
|
|
|
method: method,
|
2020-12-16 20:37:11 +00:00
|
|
|
|
url: url,
|
|
|
|
|
data: (config || {}).data
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}));
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
|
|
|
/*eslint func-names:0*/
|
|
|
|
|
Axios.prototype[method] = function(url, data, config) {
|
2020-10-01 20:20:08 +00:00
|
|
|
|
return this.request(mergeConfig(config || {}, {
|
2020-02-24 09:23:15 +00:00
|
|
|
|
method: method,
|
|
|
|
|
url: url,
|
|
|
|
|
data: data
|
|
|
|
|
}));
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
module.exports = Axios;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 825:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var utils = __webpack_require__(35);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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
|
|
|
|
|
*/
|
|
|
|
|
module.exports = function mergeConfig(config1, config2) {
|
|
|
|
|
// eslint-disable-next-line no-param-reassign
|
|
|
|
|
config2 = config2 || {};
|
|
|
|
|
var config = {};
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
var valueFromConfig2Keys = ['url', 'method', 'data'];
|
|
|
|
|
var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
|
2020-02-24 09:23:15 +00:00
|
|
|
|
var defaultToConfig2Keys = [
|
2020-10-01 20:20:08 +00:00
|
|
|
|
'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
|
|
|
|
'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
|
|
|
|
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
|
|
|
|
|
'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
|
|
|
|
|
'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
|
2020-02-24 09:23:15 +00:00
|
|
|
|
];
|
2020-10-01 20:20:08 +00:00
|
|
|
|
var directMergeKeys = ['validateStatus'];
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function mergeDeepProperties(prop) {
|
|
|
|
|
if (!utils.isUndefined(config2[prop])) {
|
|
|
|
|
config[prop] = getMergedValue(config1[prop], config2[prop]);
|
|
|
|
|
} else if (!utils.isUndefined(config1[prop])) {
|
|
|
|
|
config[prop] = getMergedValue(undefined, config1[prop]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
|
|
|
|
utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
|
2020-10-01 20:20:08 +00:00
|
|
|
|
if (!utils.isUndefined(config2[prop])) {
|
|
|
|
|
config[prop] = getMergedValue(undefined, config2[prop]);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
|
|
|
|
|
|
|
|
|
|
utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
|
|
|
|
|
if (!utils.isUndefined(config2[prop])) {
|
|
|
|
|
config[prop] = getMergedValue(undefined, config2[prop]);
|
|
|
|
|
} else if (!utils.isUndefined(config1[prop])) {
|
|
|
|
|
config[prop] = getMergedValue(undefined, config1[prop]);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
utils.forEach(directMergeKeys, function merge(prop) {
|
|
|
|
|
if (prop in config2) {
|
|
|
|
|
config[prop] = getMergedValue(config1[prop], config2[prop]);
|
|
|
|
|
} else if (prop in config1) {
|
|
|
|
|
config[prop] = getMergedValue(undefined, config1[prop]);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var axiosKeys = valueFromConfig2Keys
|
|
|
|
|
.concat(mergeDeepPropertiesKeys)
|
2020-10-01 20:20:08 +00:00
|
|
|
|
.concat(defaultToConfig2Keys)
|
|
|
|
|
.concat(directMergeKeys);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
|
|
|
|
var otherKeys = Object
|
2020-10-01 20:20:08 +00:00
|
|
|
|
.keys(config1)
|
|
|
|
|
.concat(Object.keys(config2))
|
2020-02-24 09:23:15 +00:00
|
|
|
|
.filter(function filterAxiosKeys(key) {
|
|
|
|
|
return axiosKeys.indexOf(key) === -1;
|
|
|
|
|
});
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
utils.forEach(otherKeys, mergeDeepProperties);
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
|
|
|
|
return config;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 826:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A `Cancel` is an object that is thrown when an operation is canceled.
|
|
|
|
|
*
|
|
|
|
|
* @class
|
|
|
|
|
* @param {string=} message The message.
|
|
|
|
|
*/
|
|
|
|
|
function Cancel(message) {
|
|
|
|
|
this.message = message;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Cancel.prototype.toString = function toString() {
|
|
|
|
|
return 'Cancel' + (this.message ? ': ' + this.message : '');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Cancel.prototype.__CANCEL__ = true;
|
|
|
|
|
|
|
|
|
|
module.exports = Cancel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 835:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
module.exports = require("url");
|
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 852:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* mime-db
|
|
|
|
|
* Copyright(c) 2014 Jonathan Ong
|
|
|
|
|
* MIT Licensed
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
module.exports = __webpack_require__(512)
|
|
|
|
|
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 864:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var utils = __webpack_require__(35);
|
|
|
|
|
|
|
|
|
|
module.exports = (
|
|
|
|
|
utils.isStandardBrowserEnv() ?
|
|
|
|
|
|
|
|
|
|
// Standard browser envs support document.cookie
|
|
|
|
|
(function standardBrowserEnv() {
|
|
|
|
|
return {
|
|
|
|
|
write: function write(name, value, expires, path, domain, secure) {
|
|
|
|
|
var cookie = [];
|
|
|
|
|
cookie.push(name + '=' + encodeURIComponent(value));
|
|
|
|
|
|
|
|
|
|
if (utils.isNumber(expires)) {
|
|
|
|
|
cookie.push('expires=' + new Date(expires).toGMTString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (utils.isString(path)) {
|
|
|
|
|
cookie.push('path=' + path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (utils.isString(domain)) {
|
|
|
|
|
cookie.push('domain=' + domain);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (secure === true) {
|
|
|
|
|
cookie.push('secure');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
document.cookie = cookie.join('; ');
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
read: function read(name) {
|
|
|
|
|
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
|
|
|
return (match ? decodeURIComponent(match[3]) : null);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
remove: function remove(name) {
|
|
|
|
|
this.write(name, '', Date.now() - 86400000);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
})() :
|
|
|
|
|
|
|
|
|
|
// Non standard browser env (web workers, react-native) lack needed support.
|
|
|
|
|
(function nonStandardBrowserEnv() {
|
|
|
|
|
return {
|
|
|
|
|
write: function write() {},
|
|
|
|
|
read: function read() { return null; },
|
|
|
|
|
remove: function remove() {}
|
|
|
|
|
};
|
|
|
|
|
})()
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 879:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
|
|
|
|
*
|
|
|
|
|
* Common use case would be to use `Function.prototype.apply`.
|
|
|
|
|
*
|
|
|
|
|
* ```js
|
|
|
|
|
* function f(x, y, z) {}
|
|
|
|
|
* var args = [1, 2, 3];
|
|
|
|
|
* f.apply(null, args);
|
|
|
|
|
* ```
|
|
|
|
|
*
|
|
|
|
|
* With `spread` this example can be re-written.
|
|
|
|
|
*
|
|
|
|
|
* ```js
|
|
|
|
|
* spread(function(x, y, z) {})([1, 2, 3]);
|
|
|
|
|
* ```
|
|
|
|
|
*
|
|
|
|
|
* @param {Function} callback
|
|
|
|
|
* @returns {Function}
|
|
|
|
|
*/
|
|
|
|
|
module.exports = function spread(callback) {
|
|
|
|
|
return function wrap(arr) {
|
|
|
|
|
return callback.apply(null, arr);
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 887:
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a new URL by combining the specified URLs
|
|
|
|
|
*
|
|
|
|
|
* @param {string} baseURL The base URL
|
|
|
|
|
* @param {string} relativeURL The relative URL
|
|
|
|
|
* @returns {string} The combined URL
|
|
|
|
|
*/
|
|
|
|
|
module.exports = function combineURLs(baseURL, relativeURL) {
|
|
|
|
|
return relativeURL
|
|
|
|
|
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
|
|
|
: baseURL;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 892:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var iterate = __webpack_require__(157)
|
|
|
|
|
, initState = __webpack_require__(147)
|
|
|
|
|
, terminator = __webpack_require__(939)
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
// Public API
|
|
|
|
|
module.exports = serialOrdered;
|
|
|
|
|
// sorting helpers
|
|
|
|
|
module.exports.ascending = ascending;
|
|
|
|
|
module.exports.descending = descending;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Runs iterator over provided sorted array elements in series
|
|
|
|
|
*
|
|
|
|
|
* @param {array|object} list - array or object (named list) to iterate over
|
|
|
|
|
* @param {function} iterator - iterator to run
|
|
|
|
|
* @param {function} sortMethod - custom sort function
|
|
|
|
|
* @param {function} callback - invoked when all elements processed
|
|
|
|
|
* @returns {function} - jobs terminator
|
|
|
|
|
*/
|
|
|
|
|
function serialOrdered(list, iterator, sortMethod, callback)
|
|
|
|
|
{
|
|
|
|
|
var state = initState(list, sortMethod);
|
|
|
|
|
|
|
|
|
|
iterate(list, iterator, state, function iteratorHandler(error, result)
|
|
|
|
|
{
|
|
|
|
|
if (error)
|
|
|
|
|
{
|
|
|
|
|
callback(error, result);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.index++;
|
|
|
|
|
|
|
|
|
|
// are we there yet?
|
|
|
|
|
if (state.index < (state['keyedList'] || list).length)
|
|
|
|
|
{
|
|
|
|
|
iterate(list, iterator, state, iteratorHandler);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// done here
|
|
|
|
|
callback(null, state.results);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return terminator.bind(state, callback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* -- Sort methods
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* sort helper to sort array elements in ascending order
|
|
|
|
|
*
|
|
|
|
|
* @param {mixed} a - an item to compare
|
|
|
|
|
* @param {mixed} b - an item to compare
|
|
|
|
|
* @returns {number} - comparison result
|
|
|
|
|
*/
|
|
|
|
|
function ascending(a, b)
|
|
|
|
|
{
|
|
|
|
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* sort helper to sort array elements in descending order
|
|
|
|
|
*
|
|
|
|
|
* @param {mixed} a - an item to compare
|
|
|
|
|
* @param {mixed} b - an item to compare
|
|
|
|
|
* @returns {number} - comparison result
|
|
|
|
|
*/
|
|
|
|
|
function descending(a, b)
|
|
|
|
|
{
|
|
|
|
|
return -1 * ascending(a, b);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 928:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var CombinedStream = __webpack_require__(547);
|
|
|
|
|
var util = __webpack_require__(669);
|
|
|
|
|
var path = __webpack_require__(622);
|
|
|
|
|
var http = __webpack_require__(605);
|
|
|
|
|
var https = __webpack_require__(211);
|
|
|
|
|
var parseUrl = __webpack_require__(835).parse;
|
|
|
|
|
var fs = __webpack_require__(747);
|
2021-09-09 12:42:30 +00:00
|
|
|
|
var Stream = __webpack_require__(413).Stream;
|
2021-01-24 12:14:13 +00:00
|
|
|
|
var mime = __webpack_require__(432);
|
|
|
|
|
var asynckit = __webpack_require__(334);
|
|
|
|
|
var populate = __webpack_require__(69);
|
|
|
|
|
|
|
|
|
|
// Public API
|
|
|
|
|
module.exports = FormData;
|
|
|
|
|
|
|
|
|
|
// make it a Stream
|
|
|
|
|
util.inherits(FormData, CombinedStream);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create readable "multipart/form-data" streams.
|
|
|
|
|
* Can be used to submit forms
|
|
|
|
|
* and file uploads to other web applications.
|
|
|
|
|
*
|
|
|
|
|
* @constructor
|
|
|
|
|
* @param {Object} options - Properties to be added/overriden for FormData and CombinedStream
|
|
|
|
|
*/
|
|
|
|
|
function FormData(options) {
|
|
|
|
|
if (!(this instanceof FormData)) {
|
|
|
|
|
return new FormData(options);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._overheadLength = 0;
|
|
|
|
|
this._valueLength = 0;
|
|
|
|
|
this._valuesToMeasure = [];
|
|
|
|
|
|
|
|
|
|
CombinedStream.call(this);
|
|
|
|
|
|
|
|
|
|
options = options || {};
|
|
|
|
|
for (var option in options) {
|
|
|
|
|
this[option] = options[option];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FormData.LINE_BREAK = '\r\n';
|
|
|
|
|
FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream';
|
|
|
|
|
|
|
|
|
|
FormData.prototype.append = function(field, value, options) {
|
|
|
|
|
|
|
|
|
|
options = options || {};
|
|
|
|
|
|
|
|
|
|
// allow filename as single option
|
|
|
|
|
if (typeof options == 'string') {
|
|
|
|
|
options = {filename: options};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var append = CombinedStream.prototype.append.bind(this);
|
|
|
|
|
|
|
|
|
|
// all that streamy business can't handle numbers
|
|
|
|
|
if (typeof value == 'number') {
|
|
|
|
|
value = '' + value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// https://github.com/felixge/node-form-data/issues/38
|
|
|
|
|
if (util.isArray(value)) {
|
|
|
|
|
// Please convert your array into string
|
|
|
|
|
// the way web server expects it
|
|
|
|
|
this._error(new Error('Arrays are not supported.'));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var header = this._multiPartHeader(field, value, options);
|
|
|
|
|
var footer = this._multiPartFooter();
|
|
|
|
|
|
|
|
|
|
append(header);
|
|
|
|
|
append(value);
|
|
|
|
|
append(footer);
|
|
|
|
|
|
|
|
|
|
// pass along options.knownLength
|
|
|
|
|
this._trackLength(header, value, options);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FormData.prototype._trackLength = function(header, value, options) {
|
|
|
|
|
var valueLength = 0;
|
|
|
|
|
|
|
|
|
|
// used w/ getLengthSync(), when length is known.
|
|
|
|
|
// e.g. for streaming directly from a remote server,
|
|
|
|
|
// w/ a known file a size, and not wanting to wait for
|
|
|
|
|
// incoming file to finish to get its size.
|
|
|
|
|
if (options.knownLength != null) {
|
|
|
|
|
valueLength += +options.knownLength;
|
|
|
|
|
} else if (Buffer.isBuffer(value)) {
|
|
|
|
|
valueLength = value.length;
|
|
|
|
|
} else if (typeof value === 'string') {
|
|
|
|
|
valueLength = Buffer.byteLength(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._valueLength += valueLength;
|
|
|
|
|
|
|
|
|
|
// @check why add CRLF? does this account for custom/multiple CRLFs?
|
|
|
|
|
this._overheadLength +=
|
|
|
|
|
Buffer.byteLength(header) +
|
|
|
|
|
FormData.LINE_BREAK.length;
|
|
|
|
|
|
2021-09-09 12:42:30 +00:00
|
|
|
|
// empty or either doesn't have path or not an http response or not a stream
|
|
|
|
|
if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) && !(value instanceof Stream))) {
|
2021-01-24 12:14:13 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// no need to bother with the length
|
|
|
|
|
if (!options.knownLength) {
|
|
|
|
|
this._valuesToMeasure.push(value);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FormData.prototype._lengthRetriever = function(value, callback) {
|
|
|
|
|
|
|
|
|
|
if (value.hasOwnProperty('fd')) {
|
|
|
|
|
|
|
|
|
|
// take read range into a account
|
|
|
|
|
// `end` = Infinity –> read file till the end
|
|
|
|
|
//
|
|
|
|
|
// TODO: Looks like there is bug in Node fs.createReadStream
|
|
|
|
|
// it doesn't respect `end` options without `start` options
|
|
|
|
|
// Fix it when node fixes it.
|
|
|
|
|
// https://github.com/joyent/node/issues/7819
|
|
|
|
|
if (value.end != undefined && value.end != Infinity && value.start != undefined) {
|
|
|
|
|
|
|
|
|
|
// when end specified
|
|
|
|
|
// no need to calculate range
|
|
|
|
|
// inclusive, starts with 0
|
|
|
|
|
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
|
|
|
|
|
|
|
|
// not that fast snoopy
|
|
|
|
|
} else {
|
|
|
|
|
// still need to fetch file size from fs
|
|
|
|
|
fs.stat(value.path, function(err, stat) {
|
|
|
|
|
|
|
|
|
|
var fileSize;
|
|
|
|
|
|
|
|
|
|
if (err) {
|
|
|
|
|
callback(err);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// update final size based on the range options
|
|
|
|
|
fileSize = stat.size - (value.start ? value.start : 0);
|
|
|
|
|
callback(null, fileSize);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// or http response
|
|
|
|
|
} else if (value.hasOwnProperty('httpVersion')) {
|
|
|
|
|
callback(null, +value.headers['content-length']);
|
|
|
|
|
|
|
|
|
|
// or request stream http://github.com/mikeal/request
|
|
|
|
|
} else if (value.hasOwnProperty('httpModule')) {
|
|
|
|
|
// wait till response come back
|
|
|
|
|
value.on('response', function(response) {
|
|
|
|
|
value.pause();
|
|
|
|
|
callback(null, +response.headers['content-length']);
|
|
|
|
|
});
|
|
|
|
|
value.resume();
|
|
|
|
|
|
|
|
|
|
// something else
|
|
|
|
|
} else {
|
|
|
|
|
callback('Unknown stream');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FormData.prototype._multiPartHeader = function(field, value, options) {
|
|
|
|
|
// custom header specified (as string)?
|
|
|
|
|
// it becomes responsible for boundary
|
|
|
|
|
// (e.g. to handle extra CRLFs on .NET servers)
|
|
|
|
|
if (typeof options.header == 'string') {
|
|
|
|
|
return options.header;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var contentDisposition = this._getContentDisposition(value, options);
|
|
|
|
|
var contentType = this._getContentType(value, options);
|
|
|
|
|
|
|
|
|
|
var contents = '';
|
|
|
|
|
var headers = {
|
|
|
|
|
// add custom disposition as third element or keep it two elements if not
|
|
|
|
|
'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []),
|
|
|
|
|
// if no content type. allow it to be empty array
|
|
|
|
|
'Content-Type': [].concat(contentType || [])
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// allow custom headers.
|
|
|
|
|
if (typeof options.header == 'object') {
|
|
|
|
|
populate(headers, options.header);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var header;
|
|
|
|
|
for (var prop in headers) {
|
|
|
|
|
if (!headers.hasOwnProperty(prop)) continue;
|
|
|
|
|
header = headers[prop];
|
|
|
|
|
|
|
|
|
|
// skip nullish headers.
|
|
|
|
|
if (header == null) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// convert all headers to arrays.
|
|
|
|
|
if (!Array.isArray(header)) {
|
|
|
|
|
header = [header];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// add non-empty headers.
|
|
|
|
|
if (header.length) {
|
|
|
|
|
contents += prop + ': ' + header.join('; ') + FormData.LINE_BREAK;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FormData.prototype._getContentDisposition = function(value, options) {
|
|
|
|
|
|
|
|
|
|
var filename
|
|
|
|
|
, contentDisposition
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
if (typeof options.filepath === 'string') {
|
|
|
|
|
// custom filepath for relative paths
|
|
|
|
|
filename = path.normalize(options.filepath).replace(/\\/g, '/');
|
|
|
|
|
} else if (options.filename || value.name || value.path) {
|
|
|
|
|
// custom filename take precedence
|
|
|
|
|
// formidable and the browser add a name property
|
|
|
|
|
// fs- and request- streams have path property
|
|
|
|
|
filename = path.basename(options.filename || value.name || value.path);
|
|
|
|
|
} else if (value.readable && value.hasOwnProperty('httpVersion')) {
|
|
|
|
|
// or try http response
|
|
|
|
|
filename = path.basename(value.client._httpMessage.path || '');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (filename) {
|
|
|
|
|
contentDisposition = 'filename="' + filename + '"';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return contentDisposition;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FormData.prototype._getContentType = function(value, options) {
|
|
|
|
|
|
|
|
|
|
// use custom content-type above all
|
|
|
|
|
var contentType = options.contentType;
|
|
|
|
|
|
|
|
|
|
// or try `name` from formidable, browser
|
|
|
|
|
if (!contentType && value.name) {
|
|
|
|
|
contentType = mime.lookup(value.name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// or try `path` from fs-, request- streams
|
|
|
|
|
if (!contentType && value.path) {
|
|
|
|
|
contentType = mime.lookup(value.path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// or if it's http-reponse
|
|
|
|
|
if (!contentType && value.readable && value.hasOwnProperty('httpVersion')) {
|
|
|
|
|
contentType = value.headers['content-type'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// or guess it from the filepath or filename
|
|
|
|
|
if (!contentType && (options.filepath || options.filename)) {
|
|
|
|
|
contentType = mime.lookup(options.filepath || options.filename);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// fallback to the default content type if `value` is not simple value
|
|
|
|
|
if (!contentType && typeof value == 'object') {
|
|
|
|
|
contentType = FormData.DEFAULT_CONTENT_TYPE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return contentType;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FormData.prototype._multiPartFooter = function() {
|
|
|
|
|
return function(next) {
|
|
|
|
|
var footer = FormData.LINE_BREAK;
|
|
|
|
|
|
|
|
|
|
var lastPart = (this._streams.length === 0);
|
|
|
|
|
if (lastPart) {
|
|
|
|
|
footer += this._lastBoundary();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
next(footer);
|
|
|
|
|
}.bind(this);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FormData.prototype._lastBoundary = function() {
|
|
|
|
|
return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FormData.prototype.getHeaders = function(userHeaders) {
|
|
|
|
|
var header;
|
|
|
|
|
var formHeaders = {
|
|
|
|
|
'content-type': 'multipart/form-data; boundary=' + this.getBoundary()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for (header in userHeaders) {
|
|
|
|
|
if (userHeaders.hasOwnProperty(header)) {
|
|
|
|
|
formHeaders[header.toLowerCase()] = userHeaders[header];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return formHeaders;
|
|
|
|
|
};
|
|
|
|
|
|
2021-02-19 11:51:47 +00:00
|
|
|
|
FormData.prototype.setBoundary = function(boundary) {
|
|
|
|
|
this._boundary = boundary;
|
|
|
|
|
};
|
|
|
|
|
|
2021-01-24 12:14:13 +00:00
|
|
|
|
FormData.prototype.getBoundary = function() {
|
|
|
|
|
if (!this._boundary) {
|
|
|
|
|
this._generateBoundary();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return this._boundary;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FormData.prototype.getBuffer = function() {
|
|
|
|
|
var dataBuffer = new Buffer.alloc( 0 );
|
|
|
|
|
var boundary = this.getBoundary();
|
|
|
|
|
|
|
|
|
|
// Create the form content. Add Line breaks to the end of data.
|
|
|
|
|
for (var i = 0, len = this._streams.length; i < len; i++) {
|
|
|
|
|
if (typeof this._streams[i] !== 'function') {
|
|
|
|
|
|
|
|
|
|
// Add content to the buffer.
|
|
|
|
|
if(Buffer.isBuffer(this._streams[i])) {
|
|
|
|
|
dataBuffer = Buffer.concat( [dataBuffer, this._streams[i]]);
|
|
|
|
|
}else {
|
|
|
|
|
dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(this._streams[i])]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add break after content.
|
|
|
|
|
if (typeof this._streams[i] !== 'string' || this._streams[i].substring( 2, boundary.length + 2 ) !== boundary) {
|
|
|
|
|
dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(FormData.LINE_BREAK)] );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add the footer and return the Buffer object.
|
|
|
|
|
return Buffer.concat( [dataBuffer, Buffer.from(this._lastBoundary())] );
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FormData.prototype._generateBoundary = function() {
|
|
|
|
|
// This generates a 50 character boundary similar to those used by Firefox.
|
|
|
|
|
// They are optimized for boyer-moore parsing.
|
|
|
|
|
var boundary = '--------------------------';
|
|
|
|
|
for (var i = 0; i < 24; i++) {
|
|
|
|
|
boundary += Math.floor(Math.random() * 10).toString(16);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._boundary = boundary;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Note: getLengthSync DOESN'T calculate streams length
|
|
|
|
|
// As workaround one can calculate file size manually
|
|
|
|
|
// and add it as knownLength option
|
|
|
|
|
FormData.prototype.getLengthSync = function() {
|
|
|
|
|
var knownLength = this._overheadLength + this._valueLength;
|
|
|
|
|
|
|
|
|
|
// Don't get confused, there are 3 "internal" streams for each keyval pair
|
|
|
|
|
// so it basically checks if there is any value added to the form
|
|
|
|
|
if (this._streams.length) {
|
|
|
|
|
knownLength += this._lastBoundary().length;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// https://github.com/form-data/form-data/issues/40
|
|
|
|
|
if (!this.hasKnownLength()) {
|
|
|
|
|
// Some async length retrievers are present
|
|
|
|
|
// therefore synchronous length calculation is false.
|
|
|
|
|
// Please use getLength(callback) to get proper length
|
|
|
|
|
this._error(new Error('Cannot calculate proper length in synchronous way.'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return knownLength;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Public API to check if length of added values is known
|
|
|
|
|
// https://github.com/form-data/form-data/issues/196
|
|
|
|
|
// https://github.com/form-data/form-data/issues/262
|
|
|
|
|
FormData.prototype.hasKnownLength = function() {
|
|
|
|
|
var hasKnownLength = true;
|
|
|
|
|
|
|
|
|
|
if (this._valuesToMeasure.length) {
|
|
|
|
|
hasKnownLength = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return hasKnownLength;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FormData.prototype.getLength = function(cb) {
|
|
|
|
|
var knownLength = this._overheadLength + this._valueLength;
|
|
|
|
|
|
|
|
|
|
if (this._streams.length) {
|
|
|
|
|
knownLength += this._lastBoundary().length;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!this._valuesToMeasure.length) {
|
|
|
|
|
process.nextTick(cb.bind(this, null, knownLength));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
|
|
|
|
|
if (err) {
|
|
|
|
|
cb(err);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
values.forEach(function(length) {
|
|
|
|
|
knownLength += length;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
cb(null, knownLength);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FormData.prototype.submit = function(params, cb) {
|
|
|
|
|
var request
|
|
|
|
|
, options
|
|
|
|
|
, defaults = {method: 'post'}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
// parse provided url if it's string
|
|
|
|
|
// or treat it as options object
|
|
|
|
|
if (typeof params == 'string') {
|
|
|
|
|
|
|
|
|
|
params = parseUrl(params);
|
|
|
|
|
options = populate({
|
|
|
|
|
port: params.port,
|
|
|
|
|
path: params.pathname,
|
|
|
|
|
host: params.hostname,
|
|
|
|
|
protocol: params.protocol
|
|
|
|
|
}, defaults);
|
|
|
|
|
|
|
|
|
|
// use custom params
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
options = populate(params, defaults);
|
|
|
|
|
// if no port provided use default one
|
|
|
|
|
if (!options.port) {
|
|
|
|
|
options.port = options.protocol == 'https:' ? 443 : 80;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// put that good code in getHeaders to some use
|
|
|
|
|
options.headers = this.getHeaders(params.headers);
|
|
|
|
|
|
|
|
|
|
// https if specified, fallback to http in any other case
|
|
|
|
|
if (options.protocol == 'https:') {
|
|
|
|
|
request = https.request(options);
|
|
|
|
|
} else {
|
|
|
|
|
request = http.request(options);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get content length and fire away
|
|
|
|
|
this.getLength(function(err, length) {
|
2021-09-09 12:42:30 +00:00
|
|
|
|
if (err && err !== 'Unknown stream') {
|
2021-01-24 12:14:13 +00:00
|
|
|
|
this._error(err);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// add content length
|
2021-09-09 12:42:30 +00:00
|
|
|
|
if (length) {
|
|
|
|
|
request.setHeader('Content-Length', length);
|
|
|
|
|
}
|
2021-01-24 12:14:13 +00:00
|
|
|
|
|
|
|
|
|
this.pipe(request);
|
|
|
|
|
if (cb) {
|
|
|
|
|
var onResponse;
|
|
|
|
|
|
|
|
|
|
var callback = function (error, responce) {
|
|
|
|
|
request.removeListener('error', callback);
|
|
|
|
|
request.removeListener('response', onResponse);
|
|
|
|
|
|
|
|
|
|
return cb.call(this, error, responce);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onResponse = callback.bind(this, null);
|
|
|
|
|
|
|
|
|
|
request.on('error', callback);
|
|
|
|
|
request.on('response', onResponse);
|
|
|
|
|
}
|
|
|
|
|
}.bind(this));
|
|
|
|
|
|
|
|
|
|
return request;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FormData.prototype._error = function(err) {
|
|
|
|
|
if (!this.error) {
|
|
|
|
|
this.error = err;
|
|
|
|
|
this.pause();
|
|
|
|
|
this.emit('error', err);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FormData.prototype.toString = function () {
|
|
|
|
|
return '[object FormData]';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 939:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var abort = __webpack_require__(566)
|
|
|
|
|
, async = __webpack_require__(751)
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
// API
|
|
|
|
|
module.exports = terminator;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Terminates jobs in the attached state context
|
|
|
|
|
*
|
|
|
|
|
* @this AsyncKitState#
|
|
|
|
|
* @param {function} callback - final callback to invoke after termination
|
|
|
|
|
*/
|
|
|
|
|
function terminator(callback)
|
|
|
|
|
{
|
|
|
|
|
if (!Object.keys(this.jobs).length)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// fast forward iteration index
|
|
|
|
|
this.index = this.size;
|
|
|
|
|
|
|
|
|
|
// abort jobs
|
|
|
|
|
abort(this);
|
|
|
|
|
|
|
|
|
|
// send back results we have so far
|
|
|
|
|
async(callback)(null, this.results);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-02-24 09:23:15 +00:00
|
|
|
|
/***/ }),
|
|
|
|
|
|
2020-10-01 20:20:08 +00:00
|
|
|
|
/***/ 944:
|
2020-12-16 20:37:11 +00:00
|
|
|
|
/***/ (function(module) {
|
2020-10-01 20:20:08 +00:00
|
|
|
|
|
2020-12-16 20:37:11 +00:00
|
|
|
|
module.exports = eval("require")("debug");
|
2020-02-24 09:23:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 946:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var utils = __webpack_require__(35);
|
|
|
|
|
var transformData = __webpack_require__(589);
|
|
|
|
|
var isCancel = __webpack_require__(732);
|
|
|
|
|
var defaults = __webpack_require__(529);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Throws a `Cancel` if cancellation has been requested.
|
|
|
|
|
*/
|
|
|
|
|
function throwIfCancellationRequested(config) {
|
|
|
|
|
if (config.cancelToken) {
|
|
|
|
|
config.cancelToken.throwIfRequested();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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
|
|
|
|
|
*/
|
|
|
|
|
module.exports = function dispatchRequest(config) {
|
|
|
|
|
throwIfCancellationRequested(config);
|
|
|
|
|
|
|
|
|
|
// Ensure headers exist
|
|
|
|
|
config.headers = config.headers || {};
|
|
|
|
|
|
|
|
|
|
// Transform request data
|
2021-09-09 12:42:30 +00:00
|
|
|
|
config.data = transformData.call(
|
|
|
|
|
config,
|
2020-02-24 09:23:15 +00:00
|
|
|
|
config.data,
|
|
|
|
|
config.headers,
|
|
|
|
|
config.transformRequest
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// Flatten headers
|
|
|
|
|
config.headers = utils.merge(
|
|
|
|
|
config.headers.common || {},
|
|
|
|
|
config.headers[config.method] || {},
|
|
|
|
|
config.headers
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
utils.forEach(
|
|
|
|
|
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
|
|
|
function cleanHeaderConfig(method) {
|
|
|
|
|
delete config.headers[method];
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
var adapter = config.adapter || defaults.adapter;
|
|
|
|
|
|
|
|
|
|
return adapter(config).then(function onAdapterResolution(response) {
|
|
|
|
|
throwIfCancellationRequested(config);
|
|
|
|
|
|
|
|
|
|
// Transform response data
|
2021-09-09 12:42:30 +00:00
|
|
|
|
response.data = transformData.call(
|
|
|
|
|
config,
|
2020-02-24 09:23:15 +00:00
|
|
|
|
response.data,
|
|
|
|
|
response.headers,
|
|
|
|
|
config.transformResponse
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return response;
|
|
|
|
|
}, function onAdapterRejection(reason) {
|
|
|
|
|
if (!isCancel(reason)) {
|
|
|
|
|
throwIfCancellationRequested(config);
|
|
|
|
|
|
|
|
|
|
// Transform response data
|
|
|
|
|
if (reason && reason.response) {
|
2021-09-09 12:42:30 +00:00
|
|
|
|
reason.response.data = transformData.call(
|
|
|
|
|
config,
|
2020-02-24 09:23:15 +00:00
|
|
|
|
reason.response.data,
|
|
|
|
|
reason.response.headers,
|
|
|
|
|
config.transformResponse
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Promise.reject(reason);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 960:
|
|
|
|
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var isAbsoluteURL = __webpack_require__(590);
|
|
|
|
|
var combineURLs = __webpack_require__(887);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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
|
|
|
|
|
*/
|
|
|
|
|
module.exports = function buildFullPath(baseURL, requestedURL) {
|
|
|
|
|
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
|
|
|
|
return combineURLs(baseURL, requestedURL);
|
|
|
|
|
}
|
|
|
|
|
return requestedURL;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
|
|
|
|
/******/ });
|