6870 lines
193 KiB
JavaScript
6870 lines
193 KiB
JavaScript
require('./sourcemap-register.js');/******/ (() => { // webpackBootstrap
|
||||
|
|
/******/ var __webpack_modules__ = ({
|
|||
|
|
|
|||
|
|
/***/ 7351:
|
|||
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
};
|
|||
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
|
exports.issue = exports.issueCommand = void 0;
|
|||
|
|
const os = __importStar(__nccwpck_require__(2087));
|
|||
|
|
const utils_1 = __nccwpck_require__(5278);
|
|||
|
|
/**
|
|||
|
|
* 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) {
|
|||
|
|
return utils_1.toCommandValue(s)
|
|||
|
|
.replace(/%/g, '%25')
|
|||
|
|
.replace(/\r/g, '%0D')
|
|||
|
|
.replace(/\n/g, '%0A');
|
|||
|
|
}
|
|||
|
|
function escapeProperty(s) {
|
|||
|
|
return utils_1.toCommandValue(s)
|
|||
|
|
.replace(/%/g, '%25')
|
|||
|
|
.replace(/\r/g, '%0D')
|
|||
|
|
.replace(/\n/g, '%0A')
|
|||
|
|
.replace(/:/g, '%3A')
|
|||
|
|
.replace(/,/g, '%2C');
|
|||
|
|
}
|
|||
|
|
//# sourceMappingURL=command.js.map
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 2186:
|
|||
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
};
|
|||
|
|
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 }));
|
|||
|
|
exports.getIDToken = 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;
|
|||
|
|
const command_1 = __nccwpck_require__(7351);
|
|||
|
|
const file_command_1 = __nccwpck_require__(717);
|
|||
|
|
const utils_1 = __nccwpck_require__(5278);
|
|||
|
|
const os = __importStar(__nccwpck_require__(2087));
|
|||
|
|
const path = __importStar(__nccwpck_require__(5622));
|
|||
|
|
const oidc_utils_1 = __nccwpck_require__(8041);
|
|||
|
|
/**
|
|||
|
|
* 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);
|
|||
|
|
}
|
|||
|
|
exports.setSecret = setSecret;
|
|||
|
|
/**
|
|||
|
|
* Prepends inputPath to the PATH (for this action and future actions)
|
|||
|
|
* @param inputPath
|
|||
|
|
*/
|
|||
|
|
function addPath(inputPath) {
|
|||
|
|
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']}`;
|
|||
|
|
}
|
|||
|
|
exports.addPath = addPath;
|
|||
|
|
/**
|
|||
|
|
* 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.
|
|||
|
|
*
|
|||
|
|
* @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}`);
|
|||
|
|
}
|
|||
|
|
if (options && options.trimWhitespace === false) {
|
|||
|
|
return val;
|
|||
|
|
}
|
|||
|
|
return val.trim();
|
|||
|
|
}
|
|||
|
|
exports.getInput = getInput;
|
|||
|
|
/**
|
|||
|
|
* 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;
|
|||
|
|
/**
|
|||
|
|
* Sets the value of an output.
|
|||
|
|
*
|
|||
|
|
* @param name name of the output to set
|
|||
|
|
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
|||
|
|
*/
|
|||
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|||
|
|
function setOutput(name, value) {
|
|||
|
|
process.stdout.write(os.EOL);
|
|||
|
|
command_1.issueCommand('set-output', { name }, value);
|
|||
|
|
}
|
|||
|
|
exports.setOutput = setOutput;
|
|||
|
|
/**
|
|||
|
|
* 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;
|
|||
|
|
//-----------------------------------------------------------------------
|
|||
|
|
// 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
|
|||
|
|
//-----------------------------------------------------------------------
|
|||
|
|
/**
|
|||
|
|
* Gets whether Actions Step Debug is on or not
|
|||
|
|
*/
|
|||
|
|
function isDebug() {
|
|||
|
|
return process.env['RUNNER_DEBUG'] === '1';
|
|||
|
|
}
|
|||
|
|
exports.isDebug = isDebug;
|
|||
|
|
/**
|
|||
|
|
* 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
|
|||
|
|
* @param message error issue message. Errors will be converted to string via toString()
|
|||
|
|
* @param properties optional properties to add to the annotation.
|
|||
|
|
*/
|
|||
|
|
function error(message, properties = {}) {
|
|||
|
|
command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
|||
|
|
}
|
|||
|
|
exports.error = error;
|
|||
|
|
/**
|
|||
|
|
* Adds a warning issue
|
|||
|
|
* @param message warning issue message. Errors will be converted to string via toString()
|
|||
|
|
* @param properties optional properties to add to the annotation.
|
|||
|
|
*/
|
|||
|
|
function warning(message, properties = {}) {
|
|||
|
|
command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
|||
|
|
}
|
|||
|
|
exports.warning = warning;
|
|||
|
|
/**
|
|||
|
|
* 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;
|
|||
|
|
/**
|
|||
|
|
* 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
|
|||
|
|
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
|||
|
|
*/
|
|||
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|||
|
|
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;
|
|||
|
|
function getIDToken(aud) {
|
|||
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|||
|
|
return yield oidc_utils_1.OidcClient.getIDToken(aud);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
exports.getIDToken = getIDToken;
|
|||
|
|
//# sourceMappingURL=core.js.map
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 717:
|
|||
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
// For internal use, subject to change.
|
|||
|
|
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;
|
|||
|
|
};
|
|||
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
|
exports.issueCommand = void 0;
|
|||
|
|
// We use any as a valid input type
|
|||
|
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|||
|
|
const fs = __importStar(__nccwpck_require__(5747));
|
|||
|
|
const os = __importStar(__nccwpck_require__(2087));
|
|||
|
|
const utils_1 = __nccwpck_require__(5278);
|
|||
|
|
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'
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
exports.issueCommand = issueCommand;
|
|||
|
|
//# sourceMappingURL=file-command.js.map
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 8041:
|
|||
|
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
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 }));
|
|||
|
|
exports.OidcClient = void 0;
|
|||
|
|
const http_client_1 = __nccwpck_require__(9925);
|
|||
|
|
const auth_1 = __nccwpck_require__(3702);
|
|||
|
|
const core_1 = __nccwpck_require__(2186);
|
|||
|
|
class OidcClient {
|
|||
|
|
static createHttpClient(allowRetry = true, maxRetry = 10) {
|
|||
|
|
const requestOptions = {
|
|||
|
|
allowRetries: allowRetry,
|
|||
|
|
maxRetries: maxRetry
|
|||
|
|
};
|
|||
|
|
return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions);
|
|||
|
|
}
|
|||
|
|
static getRequestToken() {
|
|||
|
|
const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'];
|
|||
|
|
if (!token) {
|
|||
|
|
throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable');
|
|||
|
|
}
|
|||
|
|
return token;
|
|||
|
|
}
|
|||
|
|
static getIDTokenUrl() {
|
|||
|
|
const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL'];
|
|||
|
|
if (!runtimeUrl) {
|
|||
|
|
throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable');
|
|||
|
|
}
|
|||
|
|
return runtimeUrl;
|
|||
|
|
}
|
|||
|
|
static getCall(id_token_url) {
|
|||
|
|
var _a;
|
|||
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|||
|
|
const httpclient = OidcClient.createHttpClient();
|
|||
|
|
const res = yield httpclient
|
|||
|
|
.getJson(id_token_url)
|
|||
|
|
.catch(error => {
|
|||
|
|
throw new Error(`Failed to get ID Token. \n
|
|||
|
|
Error Code : ${error.statusCode}\n
|
|||
|
|
Error Message: ${error.result.message}`);
|
|||
|
|
});
|
|||
|
|
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
|
|||
|
|
if (!id_token) {
|
|||
|
|
throw new Error('Response json body do not have ID Token field');
|
|||
|
|
}
|
|||
|
|
return id_token;
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
static getIDToken(audience) {
|
|||
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|||
|
|
try {
|
|||
|
|
// New ID Token is requested from action service
|
|||
|
|
let id_token_url = OidcClient.getIDTokenUrl();
|
|||
|
|
if (audience) {
|
|||
|
|
const encodedAudience = encodeURIComponent(audience);
|
|||
|
|
id_token_url = `${id_token_url}&audience=${encodedAudience}`;
|
|||
|
|
}
|
|||
|
|
core_1.debug(`ID token url is ${id_token_url}`);
|
|||
|
|
const id_token = yield OidcClient.getCall(id_token_url);
|
|||
|
|
core_1.setSecret(id_token);
|
|||
|
|
return id_token;
|
|||
|
|
}
|
|||
|
|
catch (error) {
|
|||
|
|
throw new Error(`Error message: ${error.message}`);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
exports.OidcClient = OidcClient;
|
|||
|
|
//# sourceMappingURL=oidc-utils.js.map
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 5278:
|
|||
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
// We use any as a valid input type
|
|||
|
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|||
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
|
exports.toCommandProperties = exports.toCommandValue = void 0;
|
|||
|
|
/**
|
|||
|
|
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
|||
|
|
* @param input input to sanitize into a string
|
|||
|
|
*/
|
|||
|
|
function toCommandValue(input) {
|
|||
|
|
if (input === null || input === undefined) {
|
|||
|
|
return '';
|
|||
|
|
}
|
|||
|
|
else if (typeof input === 'string' || input instanceof String) {
|
|||
|
|
return input;
|
|||
|
|
}
|
|||
|
|
return JSON.stringify(input);
|
|||
|
|
}
|
|||
|
|
exports.toCommandValue = toCommandValue;
|
|||
|
|
/**
|
|||
|
|
*
|
|||
|
|
* @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,
|
|||
|
|
file: annotationProperties.file,
|
|||
|
|
line: annotationProperties.startLine,
|
|||
|
|
endLine: annotationProperties.endLine,
|
|||
|
|
col: annotationProperties.startColumn,
|
|||
|
|
endColumn: annotationProperties.endColumn
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
exports.toCommandProperties = toCommandProperties;
|
|||
|
|
//# sourceMappingURL=utils.js.map
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 3702:
|
|||
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
|
class BasicCredentialHandler {
|
|||
|
|
constructor(username, password) {
|
|||
|
|
this.username = username;
|
|||
|
|
this.password = password;
|
|||
|
|
}
|
|||
|
|
prepareRequest(options) {
|
|||
|
|
options.headers['Authorization'] =
|
|||
|
|
'Basic ' +
|
|||
|
|
Buffer.from(this.username + ':' + this.password).toString('base64');
|
|||
|
|
}
|
|||
|
|
// This handler cannot handle 401
|
|||
|
|
canHandleAuthentication(response) {
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
handleAuthentication(httpClient, requestInfo, objs) {
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
exports.BasicCredentialHandler = BasicCredentialHandler;
|
|||
|
|
class BearerCredentialHandler {
|
|||
|
|
constructor(token) {
|
|||
|
|
this.token = token;
|
|||
|
|
}
|
|||
|
|
// currently implements pre-authorization
|
|||
|
|
// TODO: support preAuth = false where it hooks on 401
|
|||
|
|
prepareRequest(options) {
|
|||
|
|
options.headers['Authorization'] = 'Bearer ' + this.token;
|
|||
|
|
}
|
|||
|
|
// This handler cannot handle 401
|
|||
|
|
canHandleAuthentication(response) {
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
handleAuthentication(httpClient, requestInfo, objs) {
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
exports.BearerCredentialHandler = BearerCredentialHandler;
|
|||
|
|
class PersonalAccessTokenCredentialHandler {
|
|||
|
|
constructor(token) {
|
|||
|
|
this.token = token;
|
|||
|
|
}
|
|||
|
|
// currently implements pre-authorization
|
|||
|
|
// TODO: support preAuth = false where it hooks on 401
|
|||
|
|
prepareRequest(options) {
|
|||
|
|
options.headers['Authorization'] =
|
|||
|
|
'Basic ' + Buffer.from('PAT:' + this.token).toString('base64');
|
|||
|
|
}
|
|||
|
|
// This handler cannot handle 401
|
|||
|
|
canHandleAuthentication(response) {
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
handleAuthentication(httpClient, requestInfo, objs) {
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 9925:
|
|||
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
|
const http = __nccwpck_require__(8605);
|
|||
|
|
const https = __nccwpck_require__(7211);
|
|||
|
|
const pm = __nccwpck_require__(6443);
|
|||
|
|
let tunnel;
|
|||
|
|
var HttpCodes;
|
|||
|
|
(function (HttpCodes) {
|
|||
|
|
HttpCodes[HttpCodes["OK"] = 200] = "OK";
|
|||
|
|
HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices";
|
|||
|
|
HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently";
|
|||
|
|
HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved";
|
|||
|
|
HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther";
|
|||
|
|
HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified";
|
|||
|
|
HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy";
|
|||
|
|
HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy";
|
|||
|
|
HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
|||
|
|
HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect";
|
|||
|
|
HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest";
|
|||
|
|
HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized";
|
|||
|
|
HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired";
|
|||
|
|
HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden";
|
|||
|
|
HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound";
|
|||
|
|
HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
|||
|
|
HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable";
|
|||
|
|
HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
|
|||
|
|
HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout";
|
|||
|
|
HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict";
|
|||
|
|
HttpCodes[HttpCodes["Gone"] = 410] = "Gone";
|
|||
|
|
HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests";
|
|||
|
|
HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError";
|
|||
|
|
HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented";
|
|||
|
|
HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
|
|||
|
|
HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
|||
|
|
HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|||
|
|
})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {}));
|
|||
|
|
var Headers;
|
|||
|
|
(function (Headers) {
|
|||
|
|
Headers["Accept"] = "accept";
|
|||
|
|
Headers["ContentType"] = "content-type";
|
|||
|
|
})(Headers = exports.Headers || (exports.Headers = {}));
|
|||
|
|
var MediaTypes;
|
|||
|
|
(function (MediaTypes) {
|
|||
|
|
MediaTypes["ApplicationJson"] = "application/json";
|
|||
|
|
})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {}));
|
|||
|
|
/**
|
|||
|
|
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
|
|||
|
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
|||
|
|
*/
|
|||
|
|
function getProxyUrl(serverUrl) {
|
|||
|
|
let proxyUrl = pm.getProxyUrl(new URL(serverUrl));
|
|||
|
|
return proxyUrl ? proxyUrl.href : '';
|
|||
|
|
}
|
|||
|
|
exports.getProxyUrl = getProxyUrl;
|
|||
|
|
const HttpRedirectCodes = [
|
|||
|
|
HttpCodes.MovedPermanently,
|
|||
|
|
HttpCodes.ResourceMoved,
|
|||
|
|
HttpCodes.SeeOther,
|
|||
|
|
HttpCodes.TemporaryRedirect,
|
|||
|
|
HttpCodes.PermanentRedirect
|
|||
|
|
];
|
|||
|
|
const HttpResponseRetryCodes = [
|
|||
|
|
HttpCodes.BadGateway,
|
|||
|
|
HttpCodes.ServiceUnavailable,
|
|||
|
|
HttpCodes.GatewayTimeout
|
|||
|
|
];
|
|||
|
|
const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
|
|||
|
|
const ExponentialBackoffCeiling = 10;
|
|||
|
|
const ExponentialBackoffTimeSlice = 5;
|
|||
|
|
class HttpClientError extends Error {
|
|||
|
|
constructor(message, statusCode) {
|
|||
|
|
super(message);
|
|||
|
|
this.name = 'HttpClientError';
|
|||
|
|
this.statusCode = statusCode;
|
|||
|
|
Object.setPrototypeOf(this, HttpClientError.prototype);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
exports.HttpClientError = HttpClientError;
|
|||
|
|
class HttpClientResponse {
|
|||
|
|
constructor(message) {
|
|||
|
|
this.message = message;
|
|||
|
|
}
|
|||
|
|
readBody() {
|
|||
|
|
return new Promise(async (resolve, reject) => {
|
|||
|
|
let output = Buffer.alloc(0);
|
|||
|
|
this.message.on('data', (chunk) => {
|
|||
|
|
output = Buffer.concat([output, chunk]);
|
|||
|
|
});
|
|||
|
|
this.message.on('end', () => {
|
|||
|
|
resolve(output.toString());
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
exports.HttpClientResponse = HttpClientResponse;
|
|||
|
|
function isHttps(requestUrl) {
|
|||
|
|
let parsedUrl = new URL(requestUrl);
|
|||
|
|
return parsedUrl.protocol === 'https:';
|
|||
|
|
}
|
|||
|
|
exports.isHttps = isHttps;
|
|||
|
|
class HttpClient {
|
|||
|
|
constructor(userAgent, handlers, requestOptions) {
|
|||
|
|
this._ignoreSslError = false;
|
|||
|
|
this._allowRedirects = true;
|
|||
|
|
this._allowRedirectDowngrade = false;
|
|||
|
|
this._maxRedirects = 50;
|
|||
|
|
this._allowRetries = false;
|
|||
|
|
this._maxRetries = 1;
|
|||
|
|
this._keepAlive = false;
|
|||
|
|
this._disposed = false;
|
|||
|
|
this.userAgent = userAgent;
|
|||
|
|
this.handlers = handlers || [];
|
|||
|
|
this.requestOptions = requestOptions;
|
|||
|
|
if (requestOptions) {
|
|||
|
|
if (requestOptions.ignoreSslError != null) {
|
|||
|
|
this._ignoreSslError = requestOptions.ignoreSslError;
|
|||
|
|
}
|
|||
|
|
this._socketTimeout = requestOptions.socketTimeout;
|
|||
|
|
if (requestOptions.allowRedirects != null) {
|
|||
|
|
this._allowRedirects = requestOptions.allowRedirects;
|
|||
|
|
}
|
|||
|
|
if (requestOptions.allowRedirectDowngrade != null) {
|
|||
|
|
this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;
|
|||
|
|
}
|
|||
|
|
if (requestOptions.maxRedirects != null) {
|
|||
|
|
this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);
|
|||
|
|
}
|
|||
|
|
if (requestOptions.keepAlive != null) {
|
|||
|
|
this._keepAlive = requestOptions.keepAlive;
|
|||
|
|
}
|
|||
|
|
if (requestOptions.allowRetries != null) {
|
|||
|
|
this._allowRetries = requestOptions.allowRetries;
|
|||
|
|
}
|
|||
|
|
if (requestOptions.maxRetries != null) {
|
|||
|
|
this._maxRetries = requestOptions.maxRetries;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
options(requestUrl, additionalHeaders) {
|
|||
|
|
return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});
|
|||
|
|
}
|
|||
|
|
get(requestUrl, additionalHeaders) {
|
|||
|
|
return this.request('GET', requestUrl, null, additionalHeaders || {});
|
|||
|
|
}
|
|||
|
|
del(requestUrl, additionalHeaders) {
|
|||
|
|
return this.request('DELETE', requestUrl, null, additionalHeaders || {});
|
|||
|
|
}
|
|||
|
|
post(requestUrl, data, additionalHeaders) {
|
|||
|
|
return this.request('POST', requestUrl, data, additionalHeaders || {});
|
|||
|
|
}
|
|||
|
|
patch(requestUrl, data, additionalHeaders) {
|
|||
|
|
return this.request('PATCH', requestUrl, data, additionalHeaders || {});
|
|||
|
|
}
|
|||
|
|
put(requestUrl, data, additionalHeaders) {
|
|||
|
|
return this.request('PUT', requestUrl, data, additionalHeaders || {});
|
|||
|
|
}
|
|||
|
|
head(requestUrl, additionalHeaders) {
|
|||
|
|
return this.request('HEAD', requestUrl, null, additionalHeaders || {});
|
|||
|
|
}
|
|||
|
|
sendStream(verb, requestUrl, stream, additionalHeaders) {
|
|||
|
|
return this.request(verb, requestUrl, stream, additionalHeaders);
|
|||
|
|
}
|
|||
|
|
/**
|
|||
|
|
* Gets a typed object from an endpoint
|
|||
|
|
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
|
|||
|
|
*/
|
|||
|
|
async getJson(requestUrl, additionalHeaders = {}) {
|
|||
|
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|||
|
|
let res = await this.get(requestUrl, additionalHeaders);
|
|||
|
|
return this._processResponse(res, this.requestOptions);
|
|||
|
|
}
|
|||
|
|
async postJson(requestUrl, obj, additionalHeaders = {}) {
|
|||
|
|
let data = JSON.stringify(obj, null, 2);
|
|||
|
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|||
|
|
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
|||
|
|
let res = await this.post(requestUrl, data, additionalHeaders);
|
|||
|
|
return this._processResponse(res, this.requestOptions);
|
|||
|
|
}
|
|||
|
|
async putJson(requestUrl, obj, additionalHeaders = {}) {
|
|||
|
|
let data = JSON.stringify(obj, null, 2);
|
|||
|
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|||
|
|
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
|||
|
|
let res = await this.put(requestUrl, data, additionalHeaders);
|
|||
|
|
return this._processResponse(res, this.requestOptions);
|
|||
|
|
}
|
|||
|
|
async patchJson(requestUrl, obj, additionalHeaders = {}) {
|
|||
|
|
let data = JSON.stringify(obj, null, 2);
|
|||
|
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
|||
|
|
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
|||
|
|
let res = await this.patch(requestUrl, data, additionalHeaders);
|
|||
|
|
return this._processResponse(res, this.requestOptions);
|
|||
|
|
}
|
|||
|
|
/**
|
|||
|
|
* Makes a raw http request.
|
|||
|
|
* All other methods such as get, post, patch, and request ultimately call this.
|
|||
|
|
* Prefer get, del, post and patch
|
|||
|
|
*/
|
|||
|
|
async request(verb, requestUrl, data, headers) {
|
|||
|
|
if (this._disposed) {
|
|||
|
|
throw new Error('Client has already been disposed.');
|
|||
|
|
}
|
|||
|
|
let parsedUrl = new URL(requestUrl);
|
|||
|
|
let info = this._prepareRequest(verb, parsedUrl, headers);
|
|||
|
|
// Only perform retries on reads since writes may not be idempotent.
|
|||
|
|
let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1
|
|||
|
|
? this._maxRetries + 1
|
|||
|
|
: 1;
|
|||
|
|
let numTries = 0;
|
|||
|
|
let response;
|
|||
|
|
while (numTries < maxTries) {
|
|||
|
|
response = await this.requestRaw(info, data);
|
|||
|
|
// Check if it's an authentication challenge
|
|||
|
|
if (response &&
|
|||
|
|
response.message &&
|
|||
|
|
response.message.statusCode === HttpCodes.Unauthorized) {
|
|||
|
|
let authenticationHandler;
|
|||
|
|
for (let i = 0; i < this.handlers.length; i++) {
|
|||
|
|
if (this.handlers[i].canHandleAuthentication(response)) {
|
|||
|
|
authenticationHandler = this.handlers[i];
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (authenticationHandler) {
|
|||
|
|
return authenticationHandler.handleAuthentication(this, info, data);
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
// We have received an unauthorized response but have no handlers to handle it.
|
|||
|
|
// Let the response return to the caller.
|
|||
|
|
return response;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
let redirectsRemaining = this._maxRedirects;
|
|||
|
|
while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 &&
|
|||
|
|
this._allowRedirects &&
|
|||
|
|
redirectsRemaining > 0) {
|
|||
|
|
const redirectUrl = response.message.headers['location'];
|
|||
|
|
if (!redirectUrl) {
|
|||
|
|
// if there's no location to redirect to, we won't
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
let parsedRedirectUrl = new URL(redirectUrl);
|
|||
|
|
if (parsedUrl.protocol == 'https:' &&
|
|||
|
|
parsedUrl.protocol != parsedRedirectUrl.protocol &&
|
|||
|
|
!this._allowRedirectDowngrade) {
|
|||
|
|
throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');
|
|||
|
|
}
|
|||
|
|
// we need to finish reading the response before reassigning response
|
|||
|
|
// which will leak the open socket.
|
|||
|
|
await response.readBody();
|
|||
|
|
// strip authorization header if redirected to a different hostname
|
|||
|
|
if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
|
|||
|
|
for (let header in headers) {
|
|||
|
|
// header names are case insensitive
|
|||
|
|
if (header.toLowerCase() === 'authorization') {
|
|||
|
|
delete headers[header];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
// let's make the request with the new redirectUrl
|
|||
|
|
info = this._prepareRequest(verb, parsedRedirectUrl, headers);
|
|||
|
|
response = await this.requestRaw(info, data);
|
|||
|
|
redirectsRemaining--;
|
|||
|
|
}
|
|||
|
|
if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {
|
|||
|
|
// If not a retry code, return immediately instead of retrying
|
|||
|
|
return response;
|
|||
|
|
}
|
|||
|
|
numTries += 1;
|
|||
|
|
if (numTries < maxTries) {
|
|||
|
|
await response.readBody();
|
|||
|
|
await this._performExponentialBackoff(numTries);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return response;
|
|||
|
|
}
|
|||
|
|
/**
|
|||
|
|
* Needs to be called if keepAlive is set to true in request options.
|
|||
|
|
*/
|
|||
|
|
dispose() {
|
|||
|
|
if (this._agent) {
|
|||
|
|
this._agent.destroy();
|
|||
|
|
}
|
|||
|
|
this._disposed = true;
|
|||
|
|
}
|
|||
|
|
/**
|
|||
|
|
* Raw request.
|
|||
|
|
* @param info
|
|||
|
|
* @param data
|
|||
|
|
*/
|
|||
|
|
requestRaw(info, data) {
|
|||
|
|
return new Promise((resolve, reject) => {
|
|||
|
|
let callbackForResult = function (err, res) {
|
|||
|
|
if (err) {
|
|||
|
|
reject(err);
|
|||
|
|
}
|
|||
|
|
resolve(res);
|
|||
|
|
};
|
|||
|
|
this.requestRawWithCallback(info, data, callbackForResult);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
/**
|
|||
|
|
* Raw request with callback.
|
|||
|
|
* @param info
|
|||
|
|
* @param data
|
|||
|
|
* @param onResult
|
|||
|
|
*/
|
|||
|
|
requestRawWithCallback(info, data, onResult) {
|
|||
|
|
let socket;
|
|||
|
|
if (typeof data === 'string') {
|
|||
|
|
info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
|
|||
|
|
}
|
|||
|
|
let callbackCalled = false;
|
|||
|
|
let handleResult = (err, res) => {
|
|||
|
|
if (!callbackCalled) {
|
|||
|
|
callbackCalled = true;
|
|||
|
|
onResult(err, res);
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
let req = info.httpModule.request(info.options, (msg) => {
|
|||
|
|
let res = new HttpClientResponse(msg);
|
|||
|
|
handleResult(null, res);
|
|||
|
|
});
|
|||
|
|
req.on('socket', sock => {
|
|||
|
|
socket = sock;
|
|||
|
|
});
|
|||
|
|
// If we ever get disconnected, we want the socket to timeout eventually
|
|||
|
|
req.setTimeout(this._socketTimeout || 3 * 60000, () => {
|
|||
|
|
if (socket) {
|
|||
|
|
socket.end();
|
|||
|
|
}
|
|||
|
|
handleResult(new Error('Request timeout: ' + info.options.path), null);
|
|||
|
|
});
|
|||
|
|
req.on('error', function (err) {
|
|||
|
|
// err has statusCode property
|
|||
|
|
// res should have headers
|
|||
|
|
handleResult(err, null);
|
|||
|
|
});
|
|||
|
|
if (data && typeof data === 'string') {
|
|||
|
|
req.write(data, 'utf8');
|
|||
|
|
}
|
|||
|
|
if (data && typeof data !== 'string') {
|
|||
|
|
data.on('close', function () {
|
|||
|
|
req.end();
|
|||
|
|
});
|
|||
|
|
data.pipe(req);
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
req.end();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/**
|
|||
|
|
* Gets an http agent. This function is useful when you need an http agent that handles
|
|||
|
|
* routing through a proxy server - depending upon the url and proxy environment variables.
|
|||
|
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
|||
|
|
*/
|
|||
|
|
getAgent(serverUrl) {
|
|||
|
|
let parsedUrl = new URL(serverUrl);
|
|||
|
|
return this._getAgent(parsedUrl);
|
|||
|
|
}
|
|||
|
|
_prepareRequest(method, requestUrl, headers) {
|
|||
|
|
const info = {};
|
|||
|
|
info.parsedUrl = requestUrl;
|
|||
|
|
const usingSsl = info.parsedUrl.protocol === 'https:';
|
|||
|
|
info.httpModule = usingSsl ? https : http;
|
|||
|
|
const defaultPort = usingSsl ? 443 : 80;
|
|||
|
|
info.options = {};
|
|||
|
|
info.options.host = info.parsedUrl.hostname;
|
|||
|
|
info.options.port = info.parsedUrl.port
|
|||
|
|
? parseInt(info.parsedUrl.port)
|
|||
|
|
: defaultPort;
|
|||
|
|
info.options.path =
|
|||
|
|
(info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
|
|||
|
|
info.options.method = method;
|
|||
|
|
info.options.headers = this._mergeHeaders(headers);
|
|||
|
|
if (this.userAgent != null) {
|
|||
|
|
info.options.headers['user-agent'] = this.userAgent;
|
|||
|
|
}
|
|||
|
|
info.options.agent = this._getAgent(info.parsedUrl);
|
|||
|
|
// gives handlers an opportunity to participate
|
|||
|
|
if (this.handlers) {
|
|||
|
|
this.handlers.forEach(handler => {
|
|||
|
|
handler.prepareRequest(info.options);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
return info;
|
|||
|
|
}
|
|||
|
|
_mergeHeaders(headers) {
|
|||
|
|
const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
|
|||
|
|
if (this.requestOptions && this.requestOptions.headers) {
|
|||
|
|
return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers));
|
|||
|
|
}
|
|||
|
|
return lowercaseKeys(headers || {});
|
|||
|
|
}
|
|||
|
|
_getExistingOrDefaultHeader(additionalHeaders, header, _default) {
|
|||
|
|
const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
|
|||
|
|
let clientHeader;
|
|||
|
|
if (this.requestOptions && this.requestOptions.headers) {
|
|||
|
|
clientHeader = lowercaseKeys(this.requestOptions.headers)[header];
|
|||
|
|
}
|
|||
|
|
return additionalHeaders[header] || clientHeader || _default;
|
|||
|
|
}
|
|||
|
|
_getAgent(parsedUrl) {
|
|||
|
|
let agent;
|
|||
|
|
let proxyUrl = pm.getProxyUrl(parsedUrl);
|
|||
|
|
let useProxy = proxyUrl && proxyUrl.hostname;
|
|||
|
|
if (this._keepAlive && useProxy) {
|
|||
|
|
agent = this._proxyAgent;
|
|||
|
|
}
|
|||
|
|
if (this._keepAlive && !useProxy) {
|
|||
|
|
agent = this._agent;
|
|||
|
|
}
|
|||
|
|
// if agent is already assigned use that agent.
|
|||
|
|
if (!!agent) {
|
|||
|
|
return agent;
|
|||
|
|
}
|
|||
|
|
const usingSsl = parsedUrl.protocol === 'https:';
|
|||
|
|
let maxSockets = 100;
|
|||
|
|
if (!!this.requestOptions) {
|
|||
|
|
maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
|
|||
|
|
}
|
|||
|
|
if (useProxy) {
|
|||
|
|
// If using proxy, need tunnel
|
|||
|
|
if (!tunnel) {
|
|||
|
|
tunnel = __nccwpck_require__(4294);
|
|||
|
|
}
|
|||
|
|
const agentOptions = {
|
|||
|
|
maxSockets: maxSockets,
|
|||
|
|
keepAlive: this._keepAlive,
|
|||
|
|
proxy: {
|
|||
|
|
...((proxyUrl.username || proxyUrl.password) && {
|
|||
|
|
proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`
|
|||
|
|
}),
|
|||
|
|
host: proxyUrl.hostname,
|
|||
|
|
port: proxyUrl.port
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
let tunnelAgent;
|
|||
|
|
const overHttps = proxyUrl.protocol === 'https:';
|
|||
|
|
if (usingSsl) {
|
|||
|
|
tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
|
|||
|
|
}
|
|||
|
|
agent = tunnelAgent(agentOptions);
|
|||
|
|
this._proxyAgent = agent;
|
|||
|
|
}
|
|||
|
|
// if reusing agent across request and tunneling agent isn't assigned create a new agent
|
|||
|
|
if (this._keepAlive && !agent) {
|
|||
|
|
const options = { keepAlive: this._keepAlive, maxSockets: maxSockets };
|
|||
|
|
agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
|
|||
|
|
this._agent = agent;
|
|||
|
|
}
|
|||
|
|
// if not using private agent and tunnel agent isn't setup then use global agent
|
|||
|
|
if (!agent) {
|
|||
|
|
agent = usingSsl ? https.globalAgent : http.globalAgent;
|
|||
|
|
}
|
|||
|
|
if (usingSsl && this._ignoreSslError) {
|
|||
|
|
// we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
|
|||
|
|
// http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
|
|||
|
|
// we have to cast it to any and change it directly
|
|||
|
|
agent.options = Object.assign(agent.options || {}, {
|
|||
|
|
rejectUnauthorized: false
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
return agent;
|
|||
|
|
}
|
|||
|
|
_performExponentialBackoff(retryNumber) {
|
|||
|
|
retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
|
|||
|
|
const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);
|
|||
|
|
return new Promise(resolve => setTimeout(() => resolve(), ms));
|
|||
|
|
}
|
|||
|
|
static dateTimeDeserializer(key, value) {
|
|||
|
|
if (typeof value === 'string') {
|
|||
|
|
let a = new Date(value);
|
|||
|
|
if (!isNaN(a.valueOf())) {
|
|||
|
|
return a;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return value;
|
|||
|
|
}
|
|||
|
|
async _processResponse(res, options) {
|
|||
|
|
return new Promise(async (resolve, reject) => {
|
|||
|
|
const statusCode = res.message.statusCode;
|
|||
|
|
const response = {
|
|||
|
|
statusCode: statusCode,
|
|||
|
|
result: null,
|
|||
|
|
headers: {}
|
|||
|
|
};
|
|||
|
|
// not found leads to null obj returned
|
|||
|
|
if (statusCode == HttpCodes.NotFound) {
|
|||
|
|
resolve(response);
|
|||
|
|
}
|
|||
|
|
let obj;
|
|||
|
|
let contents;
|
|||
|
|
// get the result from the body
|
|||
|
|
try {
|
|||
|
|
contents = await res.readBody();
|
|||
|
|
if (contents && contents.length > 0) {
|
|||
|
|
if (options && options.deserializeDates) {
|
|||
|
|
obj = JSON.parse(contents, HttpClient.dateTimeDeserializer);
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
obj = JSON.parse(contents);
|
|||
|
|
}
|
|||
|
|
response.result = obj;
|
|||
|
|
}
|
|||
|
|
response.headers = res.message.headers;
|
|||
|
|
}
|
|||
|
|
catch (err) {
|
|||
|
|
// Invalid resource (contents not json); leaving result obj null
|
|||
|
|
}
|
|||
|
|
// note that 3xx redirects are handled by the http layer.
|
|||
|
|
if (statusCode > 299) {
|
|||
|
|
let msg;
|
|||
|
|
// if exception/error in body, attempt to get better error
|
|||
|
|
if (obj && obj.message) {
|
|||
|
|
msg = obj.message;
|
|||
|
|
}
|
|||
|
|
else if (contents && contents.length > 0) {
|
|||
|
|
// it may be the case that the exception is in the body message as string
|
|||
|
|
msg = contents;
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
msg = 'Failed request: (' + statusCode + ')';
|
|||
|
|
}
|
|||
|
|
let err = new HttpClientError(msg, statusCode);
|
|||
|
|
err.result = response.result;
|
|||
|
|
reject(err);
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
resolve(response);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
exports.HttpClient = HttpClient;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 6443:
|
|||
|
|
/***/ ((__unused_webpack_module, exports) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
|
function getProxyUrl(reqUrl) {
|
|||
|
|
let usingSsl = reqUrl.protocol === 'https:';
|
|||
|
|
let proxyUrl;
|
|||
|
|
if (checkBypass(reqUrl)) {
|
|||
|
|
return proxyUrl;
|
|||
|
|
}
|
|||
|
|
let proxyVar;
|
|||
|
|
if (usingSsl) {
|
|||
|
|
proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY'];
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY'];
|
|||
|
|
}
|
|||
|
|
if (proxyVar) {
|
|||
|
|
proxyUrl = new URL(proxyVar);
|
|||
|
|
}
|
|||
|
|
return proxyUrl;
|
|||
|
|
}
|
|||
|
|
exports.getProxyUrl = getProxyUrl;
|
|||
|
|
function checkBypass(reqUrl) {
|
|||
|
|
if (!reqUrl.hostname) {
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
let noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
|
|||
|
|
if (!noProxy) {
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
// Determine the request port
|
|||
|
|
let reqPort;
|
|||
|
|
if (reqUrl.port) {
|
|||
|
|
reqPort = Number(reqUrl.port);
|
|||
|
|
}
|
|||
|
|
else if (reqUrl.protocol === 'http:') {
|
|||
|
|
reqPort = 80;
|
|||
|
|
}
|
|||
|
|
else if (reqUrl.protocol === 'https:') {
|
|||
|
|
reqPort = 443;
|
|||
|
|
}
|
|||
|
|
// Format the request hostname and hostname with port
|
|||
|
|
let upperReqHosts = [reqUrl.hostname.toUpperCase()];
|
|||
|
|
if (typeof reqPort === 'number') {
|
|||
|
|
upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
|
|||
|
|
}
|
|||
|
|
// Compare request host against noproxy
|
|||
|
|
for (let upperNoProxyItem of noProxy
|
|||
|
|
.split(',')
|
|||
|
|
.map(x => x.trim().toUpperCase())
|
|||
|
|
.filter(x => x)) {
|
|||
|
|
if (upperReqHosts.some(x => x === upperNoProxyItem)) {
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
exports.checkBypass = checkBypass;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 6545:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
module.exports = __nccwpck_require__(2618);
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 8104:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var utils = __nccwpck_require__(328);
|
|||
|
|
var settle = __nccwpck_require__(3211);
|
|||
|
|
var buildFullPath = __nccwpck_require__(1934);
|
|||
|
|
var buildURL = __nccwpck_require__(646);
|
|||
|
|
var http = __nccwpck_require__(8605);
|
|||
|
|
var https = __nccwpck_require__(7211);
|
|||
|
|
var httpFollow = __nccwpck_require__(7707).http;
|
|||
|
|
var httpsFollow = __nccwpck_require__(7707).https;
|
|||
|
|
var url = __nccwpck_require__(8835);
|
|||
|
|
var zlib = __nccwpck_require__(8761);
|
|||
|
|
var VERSION = __nccwpck_require__(4322).version;
|
|||
|
|
var createError = __nccwpck_require__(5226);
|
|||
|
|
var enhanceError = __nccwpck_require__(1516);
|
|||
|
|
var defaults = __nccwpck_require__(8190);
|
|||
|
|
var Cancel = __nccwpck_require__(8875);
|
|||
|
|
|
|||
|
|
var isHttps = /https:?/;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
*
|
|||
|
|
* @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);
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/*eslint consistent-return:0*/
|
|||
|
|
module.exports = function httpAdapter(config) {
|
|||
|
|
return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
|
|||
|
|
var onCanceled;
|
|||
|
|
function done() {
|
|||
|
|
if (config.cancelToken) {
|
|||
|
|
config.cancelToken.unsubscribe(onCanceled);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (config.signal) {
|
|||
|
|
config.signal.removeEventListener('abort', onCanceled);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var resolve = function resolve(value) {
|
|||
|
|
done();
|
|||
|
|
resolvePromise(value);
|
|||
|
|
};
|
|||
|
|
var reject = function reject(value) {
|
|||
|
|
done();
|
|||
|
|
rejectPromise(value);
|
|||
|
|
};
|
|||
|
|
var data = config.data;
|
|||
|
|
var headers = config.headers;
|
|||
|
|
var headerNames = {};
|
|||
|
|
|
|||
|
|
Object.keys(headers).forEach(function storeLowerName(name) {
|
|||
|
|
headerNames[name.toLowerCase()] = name;
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// Set User-Agent (required by some servers)
|
|||
|
|
// See https://github.com/axios/axios/issues/69
|
|||
|
|
if ('user-agent' in headerNames) {
|
|||
|
|
// User-Agent is specified; handle case where no UA header is desired
|
|||
|
|
if (!headers[headerNames['user-agent']]) {
|
|||
|
|
delete headers[headerNames['user-agent']];
|
|||
|
|
}
|
|||
|
|
// Otherwise, use specified value
|
|||
|
|
} else {
|
|||
|
|
// Only set header if it hasn't been set in config
|
|||
|
|
headers['User-Agent'] = 'axios/' + 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
|
|||
|
|
if (!headerNames['content-length']) {
|
|||
|
|
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 && headerNames.authorization) {
|
|||
|
|
delete headers[headerNames.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,
|
|||
|
|
port: parsedProxyUrl.port,
|
|||
|
|
protocol: parsedProxyUrl.protocol
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
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 : '');
|
|||
|
|
setProxy(options, proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (config.maxBodyLength > -1) {
|
|||
|
|
options.maxBodyLength = config.maxBodyLength;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (config.insecureHTTPParser) {
|
|||
|
|
options.insecureHTTPParser = config.insecureHTTPParser;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 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;
|
|||
|
|
|
|||
|
|
|
|||
|
|
// 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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
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 = [];
|
|||
|
|
var totalResponseBytes = 0;
|
|||
|
|
stream.on('data', function handleStreamData(chunk) {
|
|||
|
|
responseBuffer.push(chunk);
|
|||
|
|
totalResponseBytes += chunk.length;
|
|||
|
|
|
|||
|
|
// make sure the content length is not over the maxContentLength if specified
|
|||
|
|
if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
|
|||
|
|
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);
|
|||
|
|
if (!config.responseEncoding || config.responseEncoding === 'utf8') {
|
|||
|
|
responseData = utils.stripBOM(responseData);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
response.data = responseData;
|
|||
|
|
settle(resolve, reject, response);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// Handle errors
|
|||
|
|
req.on('error', function handleRequestError(err) {
|
|||
|
|
if (req.aborted && err.code !== 'ERR_FR_TOO_MANY_REDIRECTS') return;
|
|||
|
|
reject(enhanceError(err, config, null, req));
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// Handle request timeout
|
|||
|
|
if (config.timeout) {
|
|||
|
|
// 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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 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.
|
|||
|
|
req.setTimeout(timeout, function handleRequestTimeout() {
|
|||
|
|
req.abort();
|
|||
|
|
var transitional = config.transitional || defaults.transitional;
|
|||
|
|
reject(createError(
|
|||
|
|
'timeout of ' + timeout + 'ms exceeded',
|
|||
|
|
config,
|
|||
|
|
transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
|
|||
|
|
req
|
|||
|
|
));
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (config.cancelToken || config.signal) {
|
|||
|
|
// Handle cancellation
|
|||
|
|
// eslint-disable-next-line func-names
|
|||
|
|
onCanceled = function(cancel) {
|
|||
|
|
if (req.aborted) return;
|
|||
|
|
|
|||
|
|
req.abort();
|
|||
|
|
reject(!cancel || (cancel && cancel.type) ? new Cancel('canceled') : cancel);
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
|||
|
|
if (config.signal) {
|
|||
|
|
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
// 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);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 3454:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var utils = __nccwpck_require__(328);
|
|||
|
|
var settle = __nccwpck_require__(3211);
|
|||
|
|
var cookies = __nccwpck_require__(1545);
|
|||
|
|
var buildURL = __nccwpck_require__(646);
|
|||
|
|
var buildFullPath = __nccwpck_require__(1934);
|
|||
|
|
var parseHeaders = __nccwpck_require__(6455);
|
|||
|
|
var isURLSameOrigin = __nccwpck_require__(3608);
|
|||
|
|
var createError = __nccwpck_require__(5226);
|
|||
|
|
var defaults = __nccwpck_require__(8190);
|
|||
|
|
var Cancel = __nccwpck_require__(8875);
|
|||
|
|
|
|||
|
|
module.exports = function xhrAdapter(config) {
|
|||
|
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|||
|
|
var requestData = config.data;
|
|||
|
|
var requestHeaders = config.headers;
|
|||
|
|
var responseType = config.responseType;
|
|||
|
|
var onCanceled;
|
|||
|
|
function done() {
|
|||
|
|
if (config.cancelToken) {
|
|||
|
|
config.cancelToken.unsubscribe(onCanceled);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (config.signal) {
|
|||
|
|
config.signal.removeEventListener('abort', onCanceled);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
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 || '';
|
|||
|
|
var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
|||
|
|
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;
|
|||
|
|
|
|||
|
|
function onloadend() {
|
|||
|
|
if (!request) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
// Prepare the response
|
|||
|
|
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
|||
|
|
var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
|||
|
|
request.responseText : request.response;
|
|||
|
|
var response = {
|
|||
|
|
data: responseData,
|
|||
|
|
status: request.status,
|
|||
|
|
statusText: request.statusText,
|
|||
|
|
headers: responseHeaders,
|
|||
|
|
config: config,
|
|||
|
|
request: request
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
settle(function _resolve(value) {
|
|||
|
|
resolve(value);
|
|||
|
|
done();
|
|||
|
|
}, function _reject(err) {
|
|||
|
|
reject(err);
|
|||
|
|
done();
|
|||
|
|
}, response);
|
|||
|
|
|
|||
|
|
// Clean up request
|
|||
|
|
request = null;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
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);
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 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 = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|||
|
|
var transitional = config.transitional || defaults.transitional;
|
|||
|
|
if (config.timeoutErrorMessage) {
|
|||
|
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
|||
|
|
}
|
|||
|
|
reject(createError(
|
|||
|
|
timeoutErrorMessage,
|
|||
|
|
config,
|
|||
|
|
transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
|
|||
|
|
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
|
|||
|
|
if (responseType && responseType !== 'json') {
|
|||
|
|
request.responseType = config.responseType;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 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 || config.signal) {
|
|||
|
|
// Handle cancellation
|
|||
|
|
// eslint-disable-next-line func-names
|
|||
|
|
onCanceled = function(cancel) {
|
|||
|
|
if (!request) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
reject(!cancel || (cancel && cancel.type) ? new Cancel('canceled') : cancel);
|
|||
|
|
request.abort();
|
|||
|
|
request = null;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
|||
|
|
if (config.signal) {
|
|||
|
|
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!requestData) {
|
|||
|
|
requestData = null;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Send the request
|
|||
|
|
request.send(requestData);
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 2618:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var utils = __nccwpck_require__(328);
|
|||
|
|
var bind = __nccwpck_require__(7065);
|
|||
|
|
var Axios = __nccwpck_require__(8178);
|
|||
|
|
var mergeConfig = __nccwpck_require__(4831);
|
|||
|
|
var defaults = __nccwpck_require__(8190);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 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);
|
|||
|
|
|
|||
|
|
// Factory for creating new instances
|
|||
|
|
instance.create = function create(instanceConfig) {
|
|||
|
|
return createInstance(mergeConfig(defaultConfig, instanceConfig));
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
return instance;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Create the default instance to be exported
|
|||
|
|
var axios = createInstance(defaults);
|
|||
|
|
|
|||
|
|
// Expose Axios class to allow class inheritance
|
|||
|
|
axios.Axios = Axios;
|
|||
|
|
|
|||
|
|
// Expose Cancel & CancelToken
|
|||
|
|
axios.Cancel = __nccwpck_require__(8875);
|
|||
|
|
axios.CancelToken = __nccwpck_require__(1587);
|
|||
|
|
axios.isCancel = __nccwpck_require__(4057);
|
|||
|
|
axios.VERSION = __nccwpck_require__(4322).version;
|
|||
|
|
|
|||
|
|
// Expose all/spread
|
|||
|
|
axios.all = function all(promises) {
|
|||
|
|
return Promise.all(promises);
|
|||
|
|
};
|
|||
|
|
axios.spread = __nccwpck_require__(4850);
|
|||
|
|
|
|||
|
|
// Expose isAxiosError
|
|||
|
|
axios.isAxiosError = __nccwpck_require__(650);
|
|||
|
|
|
|||
|
|
module.exports = axios;
|
|||
|
|
|
|||
|
|
// Allow use of default import syntax in TypeScript
|
|||
|
|
module.exports.default = axios;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 8875:
|
|||
|
|
/***/ ((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;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 1587:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var Cancel = __nccwpck_require__(8875);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 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;
|
|||
|
|
|
|||
|
|
// eslint-disable-next-line func-names
|
|||
|
|
this.promise.then(function(cancel) {
|
|||
|
|
if (!token._listeners) return;
|
|||
|
|
|
|||
|
|
var i;
|
|||
|
|
var l = token._listeners.length;
|
|||
|
|
|
|||
|
|
for (i = 0; i < l; i++) {
|
|||
|
|
token._listeners[i](cancel);
|
|||
|
|
}
|
|||
|
|
token._listeners = null;
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// eslint-disable-next-line func-names
|
|||
|
|
this.promise.then = function(onfulfilled) {
|
|||
|
|
var _resolve;
|
|||
|
|
// eslint-disable-next-line func-names
|
|||
|
|
var promise = new Promise(function(resolve) {
|
|||
|
|
token.subscribe(resolve);
|
|||
|
|
_resolve = resolve;
|
|||
|
|
}).then(onfulfilled);
|
|||
|
|
|
|||
|
|
promise.cancel = function reject() {
|
|||
|
|
token.unsubscribe(_resolve);
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
return promise;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Subscribe to the cancel signal
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
CancelToken.prototype.subscribe = function subscribe(listener) {
|
|||
|
|
if (this.reason) {
|
|||
|
|
listener(this.reason);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (this._listeners) {
|
|||
|
|
this._listeners.push(listener);
|
|||
|
|
} else {
|
|||
|
|
this._listeners = [listener];
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Unsubscribe from the cancel signal
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
|
|||
|
|
if (!this._listeners) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
var index = this._listeners.indexOf(listener);
|
|||
|
|
if (index !== -1) {
|
|||
|
|
this._listeners.splice(index, 1);
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 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;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 4057:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
module.exports = function isCancel(value) {
|
|||
|
|
return !!(value && value.__CANCEL__);
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 8178:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var utils = __nccwpck_require__(328);
|
|||
|
|
var buildURL = __nccwpck_require__(646);
|
|||
|
|
var InterceptorManager = __nccwpck_require__(3214);
|
|||
|
|
var dispatchRequest = __nccwpck_require__(5062);
|
|||
|
|
var mergeConfig = __nccwpck_require__(4831);
|
|||
|
|
var validator = __nccwpck_require__(1632);
|
|||
|
|
|
|||
|
|
var validators = validator.validators;
|
|||
|
|
/**
|
|||
|
|
* 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';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var transitional = config.transitional;
|
|||
|
|
|
|||
|
|
if (transitional !== undefined) {
|
|||
|
|
validator.assertOptions(transitional, {
|
|||
|
|
silentJSONParsing: validators.transitional(validators.boolean),
|
|||
|
|
forcedJSONParsing: validators.transitional(validators.boolean),
|
|||
|
|
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|||
|
|
}, false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// filter out skipped interceptors
|
|||
|
|
var requestInterceptorChain = [];
|
|||
|
|
var synchronousRequestInterceptors = true;
|
|||
|
|
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|||
|
|
if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|||
|
|
|
|||
|
|
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
var responseInterceptorChain = [];
|
|||
|
|
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|||
|
|
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
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());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
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) {
|
|||
|
|
return this.request(mergeConfig(config || {}, {
|
|||
|
|
method: method,
|
|||
|
|
url: url,
|
|||
|
|
data: (config || {}).data
|
|||
|
|
}));
|
|||
|
|
};
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|||
|
|
/*eslint func-names:0*/
|
|||
|
|
Axios.prototype[method] = function(url, data, config) {
|
|||
|
|
return this.request(mergeConfig(config || {}, {
|
|||
|
|
method: method,
|
|||
|
|
url: url,
|
|||
|
|
data: data
|
|||
|
|
}));
|
|||
|
|
};
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
module.exports = Axios;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 3214:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var utils = __nccwpck_require__(328);
|
|||
|
|
|
|||
|
|
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
|
|||
|
|
*/
|
|||
|
|
InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
|
|||
|
|
this.handlers.push({
|
|||
|
|
fulfilled: fulfilled,
|
|||
|
|
rejected: rejected,
|
|||
|
|
synchronous: options ? options.synchronous : false,
|
|||
|
|
runWhen: options ? options.runWhen : null
|
|||
|
|
});
|
|||
|
|
return this.handlers.length - 1;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Remove an interceptor from the stack
|
|||
|
|
*
|
|||
|
|
* @param {Number} id The ID that was returned by `use`
|
|||
|
|
*/
|
|||
|
|
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;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 1934:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var isAbsoluteURL = __nccwpck_require__(1301);
|
|||
|
|
var combineURLs = __nccwpck_require__(7189);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 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;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 5226:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var enhanceError = __nccwpck_require__(1516);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 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);
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 5062:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var utils = __nccwpck_require__(328);
|
|||
|
|
var transformData = __nccwpck_require__(9812);
|
|||
|
|
var isCancel = __nccwpck_require__(4057);
|
|||
|
|
var defaults = __nccwpck_require__(8190);
|
|||
|
|
var Cancel = __nccwpck_require__(8875);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Throws a `Cancel` if cancellation has been requested.
|
|||
|
|
*/
|
|||
|
|
function throwIfCancellationRequested(config) {
|
|||
|
|
if (config.cancelToken) {
|
|||
|
|
config.cancelToken.throwIfRequested();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (config.signal && config.signal.aborted) {
|
|||
|
|
throw new Cancel('canceled');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 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
|
|||
|
|
config.data = transformData.call(
|
|||
|
|
config,
|
|||
|
|
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
|
|||
|
|
response.data = transformData.call(
|
|||
|
|
config,
|
|||
|
|
response.data,
|
|||
|
|
response.headers,
|
|||
|
|
config.transformResponse
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
return response;
|
|||
|
|
}, function onAdapterRejection(reason) {
|
|||
|
|
if (!isCancel(reason)) {
|
|||
|
|
throwIfCancellationRequested(config);
|
|||
|
|
|
|||
|
|
// Transform response data
|
|||
|
|
if (reason && reason.response) {
|
|||
|
|
reason.response.data = transformData.call(
|
|||
|
|
config,
|
|||
|
|
reason.response.data,
|
|||
|
|
reason.response.headers,
|
|||
|
|
config.transformResponse
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Promise.reject(reason);
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 1516:
|
|||
|
|
/***/ ((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;
|
|||
|
|
|
|||
|
|
error.toJSON = function toJSON() {
|
|||
|
|
return {
|
|||
|
|
// Standard
|
|||
|
|
message: this.message,
|
|||
|
|
name: this.name,
|
|||
|
|
// Microsoft
|
|||
|
|
description: this.description,
|
|||
|
|
number: this.number,
|
|||
|
|
// Mozilla
|
|||
|
|
fileName: this.fileName,
|
|||
|
|
lineNumber: this.lineNumber,
|
|||
|
|
columnNumber: this.columnNumber,
|
|||
|
|
stack: this.stack,
|
|||
|
|
// Axios
|
|||
|
|
config: this.config,
|
|||
|
|
code: this.code,
|
|||
|
|
status: this.response && this.response.status ? this.response.status : null
|
|||
|
|
};
|
|||
|
|
};
|
|||
|
|
return error;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 4831:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var utils = __nccwpck_require__(328);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 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 = {};
|
|||
|
|
|
|||
|
|
function getMergedValue(target, source) {
|
|||
|
|
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|||
|
|
return utils.merge(target, source);
|
|||
|
|
} else if (utils.isPlainObject(source)) {
|
|||
|
|
return utils.merge({}, source);
|
|||
|
|
} else if (utils.isArray(source)) {
|
|||
|
|
return source.slice();
|
|||
|
|
}
|
|||
|
|
return source;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// eslint-disable-next-line consistent-return
|
|||
|
|
function mergeDeepProperties(prop) {
|
|||
|
|
if (!utils.isUndefined(config2[prop])) {
|
|||
|
|
return getMergedValue(config1[prop], config2[prop]);
|
|||
|
|
} else if (!utils.isUndefined(config1[prop])) {
|
|||
|
|
return getMergedValue(undefined, config1[prop]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// eslint-disable-next-line consistent-return
|
|||
|
|
function valueFromConfig2(prop) {
|
|||
|
|
if (!utils.isUndefined(config2[prop])) {
|
|||
|
|
return getMergedValue(undefined, config2[prop]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// eslint-disable-next-line consistent-return
|
|||
|
|
function defaultToConfig2(prop) {
|
|||
|
|
if (!utils.isUndefined(config2[prop])) {
|
|||
|
|
return getMergedValue(undefined, config2[prop]);
|
|||
|
|
} else if (!utils.isUndefined(config1[prop])) {
|
|||
|
|
return getMergedValue(undefined, config1[prop]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// eslint-disable-next-line consistent-return
|
|||
|
|
function mergeDirectKeys(prop) {
|
|||
|
|
if (prop in config2) {
|
|||
|
|
return getMergedValue(config1[prop], config2[prop]);
|
|||
|
|
} else if (prop in config1) {
|
|||
|
|
return getMergedValue(undefined, config1[prop]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var mergeMap = {
|
|||
|
|
'url': valueFromConfig2,
|
|||
|
|
'method': valueFromConfig2,
|
|||
|
|
'data': valueFromConfig2,
|
|||
|
|
'baseURL': defaultToConfig2,
|
|||
|
|
'transformRequest': defaultToConfig2,
|
|||
|
|
'transformResponse': defaultToConfig2,
|
|||
|
|
'paramsSerializer': defaultToConfig2,
|
|||
|
|
'timeout': defaultToConfig2,
|
|||
|
|
'timeoutMessage': defaultToConfig2,
|
|||
|
|
'withCredentials': defaultToConfig2,
|
|||
|
|
'adapter': defaultToConfig2,
|
|||
|
|
'responseType': defaultToConfig2,
|
|||
|
|
'xsrfCookieName': defaultToConfig2,
|
|||
|
|
'xsrfHeaderName': defaultToConfig2,
|
|||
|
|
'onUploadProgress': defaultToConfig2,
|
|||
|
|
'onDownloadProgress': defaultToConfig2,
|
|||
|
|
'decompress': defaultToConfig2,
|
|||
|
|
'maxContentLength': defaultToConfig2,
|
|||
|
|
'maxBodyLength': defaultToConfig2,
|
|||
|
|
'transport': defaultToConfig2,
|
|||
|
|
'httpAgent': defaultToConfig2,
|
|||
|
|
'httpsAgent': defaultToConfig2,
|
|||
|
|
'cancelToken': defaultToConfig2,
|
|||
|
|
'socketPath': defaultToConfig2,
|
|||
|
|
'responseEncoding': defaultToConfig2,
|
|||
|
|
'validateStatus': mergeDirectKeys
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
|||
|
|
var merge = mergeMap[prop] || mergeDeepProperties;
|
|||
|
|
var configValue = merge(prop);
|
|||
|
|
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
return config;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 3211:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var createError = __nccwpck_require__(5226);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 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;
|
|||
|
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|||
|
|
resolve(response);
|
|||
|
|
} else {
|
|||
|
|
reject(createError(
|
|||
|
|
'Request failed with status code ' + response.status,
|
|||
|
|
response.config,
|
|||
|
|
null,
|
|||
|
|
response.request,
|
|||
|
|
response
|
|||
|
|
));
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 9812:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var utils = __nccwpck_require__(328);
|
|||
|
|
var defaults = __nccwpck_require__(8190);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 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) {
|
|||
|
|
var context = this || defaults;
|
|||
|
|
/*eslint no-param-reassign:0*/
|
|||
|
|
utils.forEach(fns, function transform(fn) {
|
|||
|
|
data = fn.call(context, data, headers);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
return data;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 8190:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var utils = __nccwpck_require__(328);
|
|||
|
|
var normalizeHeaderName = __nccwpck_require__(6240);
|
|||
|
|
var enhanceError = __nccwpck_require__(1516);
|
|||
|
|
|
|||
|
|
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 = __nccwpck_require__(3454);
|
|||
|
|
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
|||
|
|
// For node use HTTP adapter
|
|||
|
|
adapter = __nccwpck_require__(8104);
|
|||
|
|
}
|
|||
|
|
return adapter;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
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);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var defaults = {
|
|||
|
|
|
|||
|
|
transitional: {
|
|||
|
|
silentJSONParsing: true,
|
|||
|
|
forcedJSONParsing: true,
|
|||
|
|
clarifyTimeoutError: false
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
adapter: getDefaultAdapter(),
|
|||
|
|
|
|||
|
|
transformRequest: [function transformRequest(data, headers) {
|
|||
|
|
normalizeHeaderName(headers, 'Accept');
|
|||
|
|
normalizeHeaderName(headers, 'Content-Type');
|
|||
|
|
|
|||
|
|
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();
|
|||
|
|
}
|
|||
|
|
if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) {
|
|||
|
|
setContentTypeIfUnset(headers, 'application/json');
|
|||
|
|
return stringifySafely(data);
|
|||
|
|
}
|
|||
|
|
return data;
|
|||
|
|
}],
|
|||
|
|
|
|||
|
|
transformResponse: [function transformResponse(data) {
|
|||
|
|
var transitional = this.transitional || defaults.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)) {
|
|||
|
|
try {
|
|||
|
|
return JSON.parse(data);
|
|||
|
|
} catch (e) {
|
|||
|
|
if (strictJSONParsing) {
|
|||
|
|
if (e.name === 'SyntaxError') {
|
|||
|
|
throw enhanceError(e, this, 'E_JSON_PARSE');
|
|||
|
|
}
|
|||
|
|
throw e;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
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,
|
|||
|
|
maxBodyLength: -1,
|
|||
|
|
|
|||
|
|
validateStatus: function validateStatus(status) {
|
|||
|
|
return status >= 200 && status < 300;
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 4322:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
module.exports = {
|
|||
|
|
"version": "0.24.0"
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 7065:
|
|||
|
|
/***/ ((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);
|
|||
|
|
};
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 646:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var utils = __nccwpck_require__(328);
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 7189:
|
|||
|
|
/***/ ((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;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 1545:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var utils = __nccwpck_require__(328);
|
|||
|
|
|
|||
|
|
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() {}
|
|||
|
|
};
|
|||
|
|
})()
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 1301:
|
|||
|
|
/***/ ((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);
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 650:
|
|||
|
|
/***/ ((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);
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 3608:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var utils = __nccwpck_require__(328);
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
};
|
|||
|
|
})()
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 6240:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var utils = __nccwpck_require__(328);
|
|||
|
|
|
|||
|
|
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];
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 6455:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var utils = __nccwpck_require__(328);
|
|||
|
|
|
|||
|
|
// 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;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 4850:
|
|||
|
|
/***/ ((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);
|
|||
|
|
};
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 1632:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var VERSION = __nccwpck_require__(4322).version;
|
|||
|
|
|
|||
|
|
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 = {};
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Transitional option validator
|
|||
|
|
* @param {function|boolean?} validator - set to false if the transitional option has been removed
|
|||
|
|
* @param {string?} version - deprecated version / removed since version
|
|||
|
|
* @param {string?} message - some message with additional info
|
|||
|
|
* @returns {function}
|
|||
|
|
*/
|
|||
|
|
validators.transitional = function transitional(validator, version, message) {
|
|||
|
|
function formatMessage(opt, desc) {
|
|||
|
|
return '[Axios v' + 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' + (version ? ' in ' + version : '')));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (version && !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 = {
|
|||
|
|
assertOptions: assertOptions,
|
|||
|
|
validators: validators
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 328:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var bind = __nccwpck_require__(7065);
|
|||
|
|
|
|||
|
|
// 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';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 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) {
|
|||
|
|
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 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) {
|
|||
|
|
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
|||
|
|
result[key] = merge(result[key], val);
|
|||
|
|
} else if (isPlainObject(val)) {
|
|||
|
|
result[key] = merge({}, val);
|
|||
|
|
} else if (isArray(val)) {
|
|||
|
|
result[key] = val.slice();
|
|||
|
|
} 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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
module.exports = {
|
|||
|
|
isArray: isArray,
|
|||
|
|
isArrayBuffer: isArrayBuffer,
|
|||
|
|
isBuffer: isBuffer,
|
|||
|
|
isFormData: isFormData,
|
|||
|
|
isArrayBufferView: isArrayBufferView,
|
|||
|
|
isString: isString,
|
|||
|
|
isNumber: isNumber,
|
|||
|
|
isObject: isObject,
|
|||
|
|
isPlainObject: isPlainObject,
|
|||
|
|
isUndefined: isUndefined,
|
|||
|
|
isDate: isDate,
|
|||
|
|
isFile: isFile,
|
|||
|
|
isBlob: isBlob,
|
|||
|
|
isFunction: isFunction,
|
|||
|
|
isStream: isStream,
|
|||
|
|
isURLSearchParams: isURLSearchParams,
|
|||
|
|
isStandardBrowserEnv: isStandardBrowserEnv,
|
|||
|
|
forEach: forEach,
|
|||
|
|
merge: merge,
|
|||
|
|
extend: extend,
|
|||
|
|
trim: trim,
|
|||
|
|
stripBOM: stripBOM
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 8222:
|
|||
|
|
/***/ ((module, exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
/* eslint-env browser */
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* This is the web browser implementation of `debug()`.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
exports.formatArgs = formatArgs;
|
|||
|
|
exports.save = save;
|
|||
|
|
exports.load = load;
|
|||
|
|
exports.useColors = useColors;
|
|||
|
|
exports.storage = localstorage();
|
|||
|
|
exports.destroy = (() => {
|
|||
|
|
let warned = false;
|
|||
|
|
|
|||
|
|
return () => {
|
|||
|
|
if (!warned) {
|
|||
|
|
warned = true;
|
|||
|
|
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
})();
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Colors.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
exports.colors = [
|
|||
|
|
'#0000CC',
|
|||
|
|
'#0000FF',
|
|||
|
|
'#0033CC',
|
|||
|
|
'#0033FF',
|
|||
|
|
'#0066CC',
|
|||
|
|
'#0066FF',
|
|||
|
|
'#0099CC',
|
|||
|
|
'#0099FF',
|
|||
|
|
'#00CC00',
|
|||
|
|
'#00CC33',
|
|||
|
|
'#00CC66',
|
|||
|
|
'#00CC99',
|
|||
|
|
'#00CCCC',
|
|||
|
|
'#00CCFF',
|
|||
|
|
'#3300CC',
|
|||
|
|
'#3300FF',
|
|||
|
|
'#3333CC',
|
|||
|
|
'#3333FF',
|
|||
|
|
'#3366CC',
|
|||
|
|
'#3366FF',
|
|||
|
|
'#3399CC',
|
|||
|
|
'#3399FF',
|
|||
|
|
'#33CC00',
|
|||
|
|
'#33CC33',
|
|||
|
|
'#33CC66',
|
|||
|
|
'#33CC99',
|
|||
|
|
'#33CCCC',
|
|||
|
|
'#33CCFF',
|
|||
|
|
'#6600CC',
|
|||
|
|
'#6600FF',
|
|||
|
|
'#6633CC',
|
|||
|
|
'#6633FF',
|
|||
|
|
'#66CC00',
|
|||
|
|
'#66CC33',
|
|||
|
|
'#9900CC',
|
|||
|
|
'#9900FF',
|
|||
|
|
'#9933CC',
|
|||
|
|
'#9933FF',
|
|||
|
|
'#99CC00',
|
|||
|
|
'#99CC33',
|
|||
|
|
'#CC0000',
|
|||
|
|
'#CC0033',
|
|||
|
|
'#CC0066',
|
|||
|
|
'#CC0099',
|
|||
|
|
'#CC00CC',
|
|||
|
|
'#CC00FF',
|
|||
|
|
'#CC3300',
|
|||
|
|
'#CC3333',
|
|||
|
|
'#CC3366',
|
|||
|
|
'#CC3399',
|
|||
|
|
'#CC33CC',
|
|||
|
|
'#CC33FF',
|
|||
|
|
'#CC6600',
|
|||
|
|
'#CC6633',
|
|||
|
|
'#CC9900',
|
|||
|
|
'#CC9933',
|
|||
|
|
'#CCCC00',
|
|||
|
|
'#CCCC33',
|
|||
|
|
'#FF0000',
|
|||
|
|
'#FF0033',
|
|||
|
|
'#FF0066',
|
|||
|
|
'#FF0099',
|
|||
|
|
'#FF00CC',
|
|||
|
|
'#FF00FF',
|
|||
|
|
'#FF3300',
|
|||
|
|
'#FF3333',
|
|||
|
|
'#FF3366',
|
|||
|
|
'#FF3399',
|
|||
|
|
'#FF33CC',
|
|||
|
|
'#FF33FF',
|
|||
|
|
'#FF6600',
|
|||
|
|
'#FF6633',
|
|||
|
|
'#FF9900',
|
|||
|
|
'#FF9933',
|
|||
|
|
'#FFCC00',
|
|||
|
|
'#FFCC33'
|
|||
|
|
];
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|||
|
|
* and the Firebug extension (any Firefox version) are known
|
|||
|
|
* to support "%c" CSS customizations.
|
|||
|
|
*
|
|||
|
|
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
// eslint-disable-next-line complexity
|
|||
|
|
function useColors() {
|
|||
|
|
// NB: In an Electron preload script, document will be defined but not fully
|
|||
|
|
// initialized. Since we know we're in Chrome, we'll just detect this case
|
|||
|
|
// explicitly
|
|||
|
|
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Internet Explorer and Edge do not support colors.
|
|||
|
|
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
|||
|
|
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|||
|
|
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
|||
|
|
// Is firebug? http://stackoverflow.com/a/398120/376773
|
|||
|
|
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
|||
|
|
// Is firefox >= v31?
|
|||
|
|
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|||
|
|
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
|||
|
|
// Double check webkit in userAgent just in case we are in a worker
|
|||
|
|
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Colorize log arguments if enabled.
|
|||
|
|
*
|
|||
|
|
* @api public
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
function formatArgs(args) {
|
|||
|
|
args[0] = (this.useColors ? '%c' : '') +
|
|||
|
|
this.namespace +
|
|||
|
|
(this.useColors ? ' %c' : ' ') +
|
|||
|
|
args[0] +
|
|||
|
|
(this.useColors ? '%c ' : ' ') +
|
|||
|
|
'+' + module.exports.humanize(this.diff);
|
|||
|
|
|
|||
|
|
if (!this.useColors) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
const c = 'color: ' + this.color;
|
|||
|
|
args.splice(1, 0, c, 'color: inherit');
|
|||
|
|
|
|||
|
|
// The final "%c" is somewhat tricky, because there could be other
|
|||
|
|
// arguments passed either before or after the %c, so we need to
|
|||
|
|
// figure out the correct index to insert the CSS into
|
|||
|
|
let index = 0;
|
|||
|
|
let lastC = 0;
|
|||
|
|
args[0].replace(/%[a-zA-Z%]/g, match => {
|
|||
|
|
if (match === '%%') {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
index++;
|
|||
|
|
if (match === '%c') {
|
|||
|
|
// We only are interested in the *last* %c
|
|||
|
|
// (the user may have provided their own)
|
|||
|
|
lastC = index;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
args.splice(lastC, 0, c);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Invokes `console.debug()` when available.
|
|||
|
|
* No-op when `console.debug` is not a "function".
|
|||
|
|
* If `console.debug` is not available, falls back
|
|||
|
|
* to `console.log`.
|
|||
|
|
*
|
|||
|
|
* @api public
|
|||
|
|
*/
|
|||
|
|
exports.log = console.debug || console.log || (() => {});
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Save `namespaces`.
|
|||
|
|
*
|
|||
|
|
* @param {String} namespaces
|
|||
|
|
* @api private
|
|||
|
|
*/
|
|||
|
|
function save(namespaces) {
|
|||
|
|
try {
|
|||
|
|
if (namespaces) {
|
|||
|
|
exports.storage.setItem('debug', namespaces);
|
|||
|
|
} else {
|
|||
|
|
exports.storage.removeItem('debug');
|
|||
|
|
}
|
|||
|
|
} catch (error) {
|
|||
|
|
// Swallow
|
|||
|
|
// XXX (@Qix-) should we be logging these?
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Load `namespaces`.
|
|||
|
|
*
|
|||
|
|
* @return {String} returns the previously persisted debug modes
|
|||
|
|
* @api private
|
|||
|
|
*/
|
|||
|
|
function load() {
|
|||
|
|
let r;
|
|||
|
|
try {
|
|||
|
|
r = exports.storage.getItem('debug');
|
|||
|
|
} catch (error) {
|
|||
|
|
// Swallow
|
|||
|
|
// XXX (@Qix-) should we be logging these?
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|||
|
|
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
|||
|
|
r = process.env.DEBUG;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return r;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Localstorage attempts to return the localstorage.
|
|||
|
|
*
|
|||
|
|
* This is necessary because safari throws
|
|||
|
|
* when a user disables cookies/localstorage
|
|||
|
|
* and you attempt to access it.
|
|||
|
|
*
|
|||
|
|
* @return {LocalStorage}
|
|||
|
|
* @api private
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
function localstorage() {
|
|||
|
|
try {
|
|||
|
|
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
|||
|
|
// The Browser also has localStorage in the global context.
|
|||
|
|
return localStorage;
|
|||
|
|
} catch (error) {
|
|||
|
|
// Swallow
|
|||
|
|
// XXX (@Qix-) should we be logging these?
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
module.exports = __nccwpck_require__(6243)(exports);
|
|||
|
|
|
|||
|
|
const {formatters} = module.exports;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
formatters.j = function (v) {
|
|||
|
|
try {
|
|||
|
|
return JSON.stringify(v);
|
|||
|
|
} catch (error) {
|
|||
|
|
return '[UnexpectedJSONParseError]: ' + error.message;
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 6243:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* This is the common logic for both the Node.js and web browser
|
|||
|
|
* implementations of `debug()`.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
function setup(env) {
|
|||
|
|
createDebug.debug = createDebug;
|
|||
|
|
createDebug.default = createDebug;
|
|||
|
|
createDebug.coerce = coerce;
|
|||
|
|
createDebug.disable = disable;
|
|||
|
|
createDebug.enable = enable;
|
|||
|
|
createDebug.enabled = enabled;
|
|||
|
|
createDebug.humanize = __nccwpck_require__(900);
|
|||
|
|
createDebug.destroy = destroy;
|
|||
|
|
|
|||
|
|
Object.keys(env).forEach(key => {
|
|||
|
|
createDebug[key] = env[key];
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* The currently active debug mode names, and names to skip.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
createDebug.names = [];
|
|||
|
|
createDebug.skips = [];
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Map of special "%n" handling functions, for the debug "format" argument.
|
|||
|
|
*
|
|||
|
|
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|||
|
|
*/
|
|||
|
|
createDebug.formatters = {};
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Selects a color for a debug namespace
|
|||
|
|
* @param {String} namespace The namespace string for the for the debug instance to be colored
|
|||
|
|
* @return {Number|String} An ANSI color code for the given namespace
|
|||
|
|
* @api private
|
|||
|
|
*/
|
|||
|
|
function selectColor(namespace) {
|
|||
|
|
let hash = 0;
|
|||
|
|
|
|||
|
|
for (let i = 0; i < namespace.length; i++) {
|
|||
|
|
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
|||
|
|
hash |= 0; // Convert to 32bit integer
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|||
|
|
}
|
|||
|
|
createDebug.selectColor = selectColor;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Create a debugger with the given `namespace`.
|
|||
|
|
*
|
|||
|
|
* @param {String} namespace
|
|||
|
|
* @return {Function}
|
|||
|
|
* @api public
|
|||
|
|
*/
|
|||
|
|
function createDebug(namespace) {
|
|||
|
|
let prevTime;
|
|||
|
|
let enableOverride = null;
|
|||
|
|
let namespacesCache;
|
|||
|
|
let enabledCache;
|
|||
|
|
|
|||
|
|
function debug(...args) {
|
|||
|
|
// Disabled?
|
|||
|
|
if (!debug.enabled) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
const self = debug;
|
|||
|
|
|
|||
|
|
// Set `diff` timestamp
|
|||
|
|
const curr = Number(new Date());
|
|||
|
|
const ms = curr - (prevTime || curr);
|
|||
|
|
self.diff = ms;
|
|||
|
|
self.prev = prevTime;
|
|||
|
|
self.curr = curr;
|
|||
|
|
prevTime = curr;
|
|||
|
|
|
|||
|
|
args[0] = createDebug.coerce(args[0]);
|
|||
|
|
|
|||
|
|
if (typeof args[0] !== 'string') {
|
|||
|
|
// Anything else let's inspect with %O
|
|||
|
|
args.unshift('%O');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Apply any `formatters` transformations
|
|||
|
|
let index = 0;
|
|||
|
|
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|||
|
|
// If we encounter an escaped % then don't increase the array index
|
|||
|
|
if (match === '%%') {
|
|||
|
|
return '%';
|
|||
|
|
}
|
|||
|
|
index++;
|
|||
|
|
const formatter = createDebug.formatters[format];
|
|||
|
|
if (typeof formatter === 'function') {
|
|||
|
|
const val = args[index];
|
|||
|
|
match = formatter.call(self, val);
|
|||
|
|
|
|||
|
|
// Now we need to remove `args[index]` since it's inlined in the `format`
|
|||
|
|
args.splice(index, 1);
|
|||
|
|
index--;
|
|||
|
|
}
|
|||
|
|
return match;
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// Apply env-specific formatting (colors, etc.)
|
|||
|
|
createDebug.formatArgs.call(self, args);
|
|||
|
|
|
|||
|
|
const logFn = self.log || createDebug.log;
|
|||
|
|
logFn.apply(self, args);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
debug.namespace = namespace;
|
|||
|
|
debug.useColors = createDebug.useColors();
|
|||
|
|
debug.color = createDebug.selectColor(namespace);
|
|||
|
|
debug.extend = extend;
|
|||
|
|
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
|
|||
|
|
|
|||
|
|
Object.defineProperty(debug, 'enabled', {
|
|||
|
|
enumerable: true,
|
|||
|
|
configurable: false,
|
|||
|
|
get: () => {
|
|||
|
|
if (enableOverride !== null) {
|
|||
|
|
return enableOverride;
|
|||
|
|
}
|
|||
|
|
if (namespacesCache !== createDebug.namespaces) {
|
|||
|
|
namespacesCache = createDebug.namespaces;
|
|||
|
|
enabledCache = createDebug.enabled(namespace);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return enabledCache;
|
|||
|
|
},
|
|||
|
|
set: v => {
|
|||
|
|
enableOverride = v;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// Env-specific initialization logic for debug instances
|
|||
|
|
if (typeof createDebug.init === 'function') {
|
|||
|
|
createDebug.init(debug);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return debug;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function extend(namespace, delimiter) {
|
|||
|
|
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
|||
|
|
newDebug.log = this.log;
|
|||
|
|
return newDebug;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Enables a debug mode by namespaces. This can include modes
|
|||
|
|
* separated by a colon and wildcards.
|
|||
|
|
*
|
|||
|
|
* @param {String} namespaces
|
|||
|
|
* @api public
|
|||
|
|
*/
|
|||
|
|
function enable(namespaces) {
|
|||
|
|
createDebug.save(namespaces);
|
|||
|
|
createDebug.namespaces = namespaces;
|
|||
|
|
|
|||
|
|
createDebug.names = [];
|
|||
|
|
createDebug.skips = [];
|
|||
|
|
|
|||
|
|
let i;
|
|||
|
|
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|||
|
|
const len = split.length;
|
|||
|
|
|
|||
|
|
for (i = 0; i < len; i++) {
|
|||
|
|
if (!split[i]) {
|
|||
|
|
// ignore empty strings
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
namespaces = split[i].replace(/\*/g, '.*?');
|
|||
|
|
|
|||
|
|
if (namespaces[0] === '-') {
|
|||
|
|
createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
|||
|
|
} else {
|
|||
|
|
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Disable debug output.
|
|||
|
|
*
|
|||
|
|
* @return {String} namespaces
|
|||
|
|
* @api public
|
|||
|
|
*/
|
|||
|
|
function disable() {
|
|||
|
|
const namespaces = [
|
|||
|
|
...createDebug.names.map(toNamespace),
|
|||
|
|
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
|||
|
|
].join(',');
|
|||
|
|
createDebug.enable('');
|
|||
|
|
return namespaces;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Returns true if the given mode name is enabled, false otherwise.
|
|||
|
|
*
|
|||
|
|
* @param {String} name
|
|||
|
|
* @return {Boolean}
|
|||
|
|
* @api public
|
|||
|
|
*/
|
|||
|
|
function enabled(name) {
|
|||
|
|
if (name[name.length - 1] === '*') {
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
let i;
|
|||
|
|
let len;
|
|||
|
|
|
|||
|
|
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
|||
|
|
if (createDebug.skips[i].test(name)) {
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
|||
|
|
if (createDebug.names[i].test(name)) {
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Convert regexp to namespace
|
|||
|
|
*
|
|||
|
|
* @param {RegExp} regxep
|
|||
|
|
* @return {String} namespace
|
|||
|
|
* @api private
|
|||
|
|
*/
|
|||
|
|
function toNamespace(regexp) {
|
|||
|
|
return regexp.toString()
|
|||
|
|
.substring(2, regexp.toString().length - 2)
|
|||
|
|
.replace(/\.\*\?$/, '*');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Coerce `val`.
|
|||
|
|
*
|
|||
|
|
* @param {Mixed} val
|
|||
|
|
* @return {Mixed}
|
|||
|
|
* @api private
|
|||
|
|
*/
|
|||
|
|
function coerce(val) {
|
|||
|
|
if (val instanceof Error) {
|
|||
|
|
return val.stack || val.message;
|
|||
|
|
}
|
|||
|
|
return val;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* XXX DO NOT USE. This is a temporary stub function.
|
|||
|
|
* XXX It WILL be removed in the next major release.
|
|||
|
|
*/
|
|||
|
|
function destroy() {
|
|||
|
|
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
createDebug.enable(createDebug.load());
|
|||
|
|
|
|||
|
|
return createDebug;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
module.exports = setup;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 8237:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Detect Electron renderer / nwjs process, which is node, but we should
|
|||
|
|
* treat as a browser.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
|||
|
|
module.exports = __nccwpck_require__(8222);
|
|||
|
|
} else {
|
|||
|
|
module.exports = __nccwpck_require__(5332);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 5332:
|
|||
|
|
/***/ ((module, exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Module dependencies.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
const tty = __nccwpck_require__(3867);
|
|||
|
|
const util = __nccwpck_require__(1669);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* This is the Node.js implementation of `debug()`.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
exports.init = init;
|
|||
|
|
exports.log = log;
|
|||
|
|
exports.formatArgs = formatArgs;
|
|||
|
|
exports.save = save;
|
|||
|
|
exports.load = load;
|
|||
|
|
exports.useColors = useColors;
|
|||
|
|
exports.destroy = util.deprecate(
|
|||
|
|
() => {},
|
|||
|
|
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Colors.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
exports.colors = [6, 2, 3, 4, 5, 1];
|
|||
|
|
|
|||
|
|
try {
|
|||
|
|
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
|||
|
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|||
|
|
const supportsColor = __nccwpck_require__(9318);
|
|||
|
|
|
|||
|
|
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|||
|
|
exports.colors = [
|
|||
|
|
20,
|
|||
|
|
21,
|
|||
|
|
26,
|
|||
|
|
27,
|
|||
|
|
32,
|
|||
|
|
33,
|
|||
|
|
38,
|
|||
|
|
39,
|
|||
|
|
40,
|
|||
|
|
41,
|
|||
|
|
42,
|
|||
|
|
43,
|
|||
|
|
44,
|
|||
|
|
45,
|
|||
|
|
56,
|
|||
|
|
57,
|
|||
|
|
62,
|
|||
|
|
63,
|
|||
|
|
68,
|
|||
|
|
69,
|
|||
|
|
74,
|
|||
|
|
75,
|
|||
|
|
76,
|
|||
|
|
77,
|
|||
|
|
78,
|
|||
|
|
79,
|
|||
|
|
80,
|
|||
|
|
81,
|
|||
|
|
92,
|
|||
|
|
93,
|
|||
|
|
98,
|
|||
|
|
99,
|
|||
|
|
112,
|
|||
|
|
113,
|
|||
|
|
128,
|
|||
|
|
129,
|
|||
|
|
134,
|
|||
|
|
135,
|
|||
|
|
148,
|
|||
|
|
149,
|
|||
|
|
160,
|
|||
|
|
161,
|
|||
|
|
162,
|
|||
|
|
163,
|
|||
|
|
164,
|
|||
|
|
165,
|
|||
|
|
166,
|
|||
|
|
167,
|
|||
|
|
168,
|
|||
|
|
169,
|
|||
|
|
170,
|
|||
|
|
171,
|
|||
|
|
172,
|
|||
|
|
173,
|
|||
|
|
178,
|
|||
|
|
179,
|
|||
|
|
184,
|
|||
|
|
185,
|
|||
|
|
196,
|
|||
|
|
197,
|
|||
|
|
198,
|
|||
|
|
199,
|
|||
|
|
200,
|
|||
|
|
201,
|
|||
|
|
202,
|
|||
|
|
203,
|
|||
|
|
204,
|
|||
|
|
205,
|
|||
|
|
206,
|
|||
|
|
207,
|
|||
|
|
208,
|
|||
|
|
209,
|
|||
|
|
214,
|
|||
|
|
215,
|
|||
|
|
220,
|
|||
|
|
221
|
|||
|
|
];
|
|||
|
|
}
|
|||
|
|
} catch (error) {
|
|||
|
|
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Build up the default `inspectOpts` object from the environment variables.
|
|||
|
|
*
|
|||
|
|
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
exports.inspectOpts = Object.keys(process.env).filter(key => {
|
|||
|
|
return /^debug_/i.test(key);
|
|||
|
|
}).reduce((obj, key) => {
|
|||
|
|
// Camel-case
|
|||
|
|
const prop = key
|
|||
|
|
.substring(6)
|
|||
|
|
.toLowerCase()
|
|||
|
|
.replace(/_([a-z])/g, (_, k) => {
|
|||
|
|
return k.toUpperCase();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// Coerce string value into JS value
|
|||
|
|
let val = process.env[key];
|
|||
|
|
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|||
|
|
val = true;
|
|||
|
|
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|||
|
|
val = false;
|
|||
|
|
} else if (val === 'null') {
|
|||
|
|
val = null;
|
|||
|
|
} else {
|
|||
|
|
val = Number(val);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
obj[prop] = val;
|
|||
|
|
return obj;
|
|||
|
|
}, {});
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Is stdout a TTY? Colored output is enabled when `true`.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
function useColors() {
|
|||
|
|
return 'colors' in exports.inspectOpts ?
|
|||
|
|
Boolean(exports.inspectOpts.colors) :
|
|||
|
|
tty.isatty(process.stderr.fd);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Adds ANSI color escape codes if enabled.
|
|||
|
|
*
|
|||
|
|
* @api public
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
function formatArgs(args) {
|
|||
|
|
const {namespace: name, useColors} = this;
|
|||
|
|
|
|||
|
|
if (useColors) {
|
|||
|
|
const c = this.color;
|
|||
|
|
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
|||
|
|
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
|||
|
|
|
|||
|
|
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
|||
|
|
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
|||
|
|
} else {
|
|||
|
|
args[0] = getDate() + name + ' ' + args[0];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function getDate() {
|
|||
|
|
if (exports.inspectOpts.hideDate) {
|
|||
|
|
return '';
|
|||
|
|
}
|
|||
|
|
return new Date().toISOString() + ' ';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
function log(...args) {
|
|||
|
|
return process.stderr.write(util.format(...args) + '\n');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Save `namespaces`.
|
|||
|
|
*
|
|||
|
|
* @param {String} namespaces
|
|||
|
|
* @api private
|
|||
|
|
*/
|
|||
|
|
function save(namespaces) {
|
|||
|
|
if (namespaces) {
|
|||
|
|
process.env.DEBUG = namespaces;
|
|||
|
|
} else {
|
|||
|
|
// If you set a process.env field to null or undefined, it gets cast to the
|
|||
|
|
// string 'null' or 'undefined'. Just delete instead.
|
|||
|
|
delete process.env.DEBUG;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Load `namespaces`.
|
|||
|
|
*
|
|||
|
|
* @return {String} returns the previously persisted debug modes
|
|||
|
|
* @api private
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
function load() {
|
|||
|
|
return process.env.DEBUG;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Init logic for `debug` instances.
|
|||
|
|
*
|
|||
|
|
* Create a new `inspectOpts` object in case `useColors` is set
|
|||
|
|
* differently for a particular `debug` instance.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
function init(debug) {
|
|||
|
|
debug.inspectOpts = {};
|
|||
|
|
|
|||
|
|
const keys = Object.keys(exports.inspectOpts);
|
|||
|
|
for (let i = 0; i < keys.length; i++) {
|
|||
|
|
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
module.exports = __nccwpck_require__(6243)(exports);
|
|||
|
|
|
|||
|
|
const {formatters} = module.exports;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Map %o to `util.inspect()`, all on a single line.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
formatters.o = function (v) {
|
|||
|
|
this.inspectOpts.colors = this.useColors;
|
|||
|
|
return util.inspect(v, this.inspectOpts)
|
|||
|
|
.split('\n')
|
|||
|
|
.map(str => str.trim())
|
|||
|
|
.join(' ');
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
formatters.O = function (v) {
|
|||
|
|
this.inspectOpts.colors = this.useColors;
|
|||
|
|
return util.inspect(v, this.inspectOpts);
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 1133:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
var debug;
|
|||
|
|
|
|||
|
|
module.exports = function () {
|
|||
|
|
if (!debug) {
|
|||
|
|
try {
|
|||
|
|
/* eslint global-require: off */
|
|||
|
|
debug = __nccwpck_require__(8237)("follow-redirects");
|
|||
|
|
}
|
|||
|
|
catch (error) { /* */ }
|
|||
|
|
if (typeof debug !== "function") {
|
|||
|
|
debug = function () { /* */ };
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
debug.apply(null, arguments);
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 7707:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
var url = __nccwpck_require__(8835);
|
|||
|
|
var URL = url.URL;
|
|||
|
|
var http = __nccwpck_require__(8605);
|
|||
|
|
var https = __nccwpck_require__(7211);
|
|||
|
|
var Writable = __nccwpck_require__(2413).Writable;
|
|||
|
|
var assert = __nccwpck_require__(2357);
|
|||
|
|
var debug = __nccwpck_require__(1133);
|
|||
|
|
|
|||
|
|
// Create handlers that pass events from native requests
|
|||
|
|
var events = ["abort", "aborted", "connect", "error", "socket", "timeout"];
|
|||
|
|
var eventHandlers = Object.create(null);
|
|||
|
|
events.forEach(function (event) {
|
|||
|
|
eventHandlers[event] = function (arg1, arg2, arg3) {
|
|||
|
|
this._redirectable.emit(event, arg1, arg2, arg3);
|
|||
|
|
};
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 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"
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
// An HTTP(S) request that can be redirected
|
|||
|
|
function RedirectableRequest(options, responseCallback) {
|
|||
|
|
// Initialize the request
|
|||
|
|
Writable.call(this);
|
|||
|
|
this._sanitizeOptions(options);
|
|||
|
|
this._options = options;
|
|||
|
|
this._ended = false;
|
|||
|
|
this._ending = false;
|
|||
|
|
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);
|
|||
|
|
|
|||
|
|
RedirectableRequest.prototype.abort = function () {
|
|||
|
|
abortRequest(this._currentRequest);
|
|||
|
|
this.emit("abort");
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// Writes buffered data to the current native request
|
|||
|
|
RedirectableRequest.prototype.write = function (data, encoding, callback) {
|
|||
|
|
// Writing is not allowed if end has been called
|
|||
|
|
if (this._ending) {
|
|||
|
|
throw new WriteAfterEndError();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Validate input and shift parameters if necessary
|
|||
|
|
if (!(typeof data === "string" || typeof data === "object" && ("length" in data))) {
|
|||
|
|
throw new TypeError("data should be a string, Buffer or Uint8Array");
|
|||
|
|
}
|
|||
|
|
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 {
|
|||
|
|
this.emit("error", new MaxBodyLengthExceededError());
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 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;
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// 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);
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// Global timeout for all underlying requests
|
|||
|
|
RedirectableRequest.prototype.setTimeout = function (msecs, callback) {
|
|||
|
|
var self = this;
|
|||
|
|
|
|||
|
|
// Destroys the socket on timeout
|
|||
|
|
function destroyOnTimeout(socket) {
|
|||
|
|
socket.setTimeout(msecs);
|
|||
|
|
socket.removeListener("timeout", socket.destroy);
|
|||
|
|
socket.addListener("timeout", socket.destroy);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Sets up a timer to trigger a timeout event
|
|||
|
|
function startTimer(socket) {
|
|||
|
|
if (self._timeout) {
|
|||
|
|
clearTimeout(self._timeout);
|
|||
|
|
}
|
|||
|
|
self._timeout = setTimeout(function () {
|
|||
|
|
self.emit("timeout");
|
|||
|
|
clearTimer();
|
|||
|
|
}, msecs);
|
|||
|
|
destroyOnTimeout(socket);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Stops a timeout from triggering
|
|||
|
|
function clearTimer() {
|
|||
|
|
if (self._timeout) {
|
|||
|
|
clearTimeout(self._timeout);
|
|||
|
|
self._timeout = null;
|
|||
|
|
}
|
|||
|
|
if (callback) {
|
|||
|
|
self.removeListener("timeout", callback);
|
|||
|
|
}
|
|||
|
|
if (!self.socket) {
|
|||
|
|
self._currentRequest.removeListener("socket", startTimer);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Attach callback if passed
|
|||
|
|
if (callback) {
|
|||
|
|
this.on("timeout", callback);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Start the timer if or when the socket is opened
|
|||
|
|
if (this.socket) {
|
|||
|
|
startTimer(this.socket);
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
this._currentRequest.once("socket", startTimer);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Clean up on events
|
|||
|
|
this.on("socket", destroyOnTimeout);
|
|||
|
|
this.once("response", clearTimer);
|
|||
|
|
this.once("error", clearTimer);
|
|||
|
|
|
|||
|
|
return this;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// Proxy all other public ClientRequest methods
|
|||
|
|
[
|
|||
|
|
"flushHeaders", "getHeader",
|
|||
|
|
"setNoDelay", "setSocketKeepAlive",
|
|||
|
|
].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]; },
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
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);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
// 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) {
|
|||
|
|
this.emit("error", new TypeError("Unsupported protocol " + protocol));
|
|||
|
|
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;
|
|||
|
|
for (var e = 0; e < events.length; e++) {
|
|||
|
|
request.on(events[e], eventHandlers[events[e]]);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 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;
|
|||
|
|
var self = this;
|
|||
|
|
var buffers = this._requestBodyBuffers;
|
|||
|
|
(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();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}());
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// Processes a response from the current native request
|
|||
|
|
RedirectableRequest.prototype._processResponse = function (response) {
|
|||
|
|
// Store the redirected response
|
|||
|
|
var statusCode = response.statusCode;
|
|||
|
|
if (this._options.trackRedirects) {
|
|||
|
|
this._redirects.push({
|
|||
|
|
url: this._currentUrl,
|
|||
|
|
headers: response.headers,
|
|||
|
|
statusCode: statusCode,
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 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 &&
|
|||
|
|
statusCode >= 300 && statusCode < 400) {
|
|||
|
|
// Abort the current request
|
|||
|
|
abortRequest(this._currentRequest);
|
|||
|
|
// Discard the remainder of the response to avoid waiting for data
|
|||
|
|
response.destroy();
|
|||
|
|
|
|||
|
|
// RFC7231§6.4: A client SHOULD detect and intervene
|
|||
|
|
// in cyclical redirections (i.e., "infinite" redirection loops).
|
|||
|
|
if (++this._redirectCount > this._options.maxRedirects) {
|
|||
|
|
this.emit("error", new TooManyRedirectsError());
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// RFC7231§6.4: Automatic redirection needs to done with
|
|||
|
|
// 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)) {
|
|||
|
|
this._options.method = "GET";
|
|||
|
|
// Drop a possible entity and headers related to it
|
|||
|
|
this._requestBodyBuffers = [];
|
|||
|
|
removeMatchingHeaders(/^content-/i, this._options.headers);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Drop the Host header, as the redirect might lead to a different host
|
|||
|
|
var previousHostName = removeMatchingHeaders(/^host$/i, this._options.headers) ||
|
|||
|
|
url.parse(this._currentUrl).hostname;
|
|||
|
|
|
|||
|
|
// Create the redirected request
|
|||
|
|
var redirectUrl = url.resolve(this._currentUrl, location);
|
|||
|
|
debug("redirecting to", redirectUrl);
|
|||
|
|
this._isRedirect = true;
|
|||
|
|
var redirectUrlParts = url.parse(redirectUrl);
|
|||
|
|
Object.assign(this._options, redirectUrlParts);
|
|||
|
|
|
|||
|
|
// 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);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
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
|
|||
|
|
function request(input, options, callback) {
|
|||
|
|
// 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);
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
callback = options;
|
|||
|
|
options = input;
|
|||
|
|
input = { protocol: protocol };
|
|||
|
|
}
|
|||
|
|
if (typeof options === "function") {
|
|||
|
|
callback = options;
|
|||
|
|
options = null;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Set defaults
|
|||
|
|
options = Object.assign({
|
|||
|
|
maxRedirects: exports.maxRedirects,
|
|||
|
|
maxBodyLength: exports.maxBodyLength,
|
|||
|
|
}, input, options);
|
|||
|
|
options.nativeProtocols = nativeProtocols;
|
|||
|
|
|
|||
|
|
assert.equal(options.protocol, protocol, "protocol mismatch");
|
|||
|
|
debug("options", options);
|
|||
|
|
return new RedirectableRequest(options, callback);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Executes a GET request, following redirects
|
|||
|
|
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 },
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
return exports;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function abortRequest(request) {
|
|||
|
|
for (var e = 0; e < events.length; e++) {
|
|||
|
|
request.removeListener(events[e], eventHandlers[events[e]]);
|
|||
|
|
}
|
|||
|
|
request.on("error", noop);
|
|||
|
|
request.abort();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Exports
|
|||
|
|
module.exports = wrap({ http: http, https: https });
|
|||
|
|
module.exports.wrap = wrap;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 1621:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
module.exports = (flag, argv = process.argv) => {
|
|||
|
|
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
|||
|
|
const position = argv.indexOf(prefix + flag);
|
|||
|
|
const terminatorPosition = argv.indexOf('--');
|
|||
|
|
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 900:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Helpers.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
var s = 1000;
|
|||
|
|
var m = s * 60;
|
|||
|
|
var h = m * 60;
|
|||
|
|
var d = h * 24;
|
|||
|
|
var w = d * 7;
|
|||
|
|
var y = d * 365.25;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Parse or format the given `val`.
|
|||
|
|
*
|
|||
|
|
* Options:
|
|||
|
|
*
|
|||
|
|
* - `long` verbose formatting [false]
|
|||
|
|
*
|
|||
|
|
* @param {String|Number} val
|
|||
|
|
* @param {Object} [options]
|
|||
|
|
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|||
|
|
* @return {String|Number}
|
|||
|
|
* @api public
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
module.exports = function(val, options) {
|
|||
|
|
options = options || {};
|
|||
|
|
var type = typeof val;
|
|||
|
|
if (type === 'string' && val.length > 0) {
|
|||
|
|
return parse(val);
|
|||
|
|
} else if (type === 'number' && isFinite(val)) {
|
|||
|
|
return options.long ? fmtLong(val) : fmtShort(val);
|
|||
|
|
}
|
|||
|
|
throw new Error(
|
|||
|
|
'val is not a non-empty string or a valid number. val=' +
|
|||
|
|
JSON.stringify(val)
|
|||
|
|
);
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Parse the given `str` and return milliseconds.
|
|||
|
|
*
|
|||
|
|
* @param {String} str
|
|||
|
|
* @return {Number}
|
|||
|
|
* @api private
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
function parse(str) {
|
|||
|
|
str = String(str);
|
|||
|
|
if (str.length > 100) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|||
|
|
str
|
|||
|
|
);
|
|||
|
|
if (!match) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
var n = parseFloat(match[1]);
|
|||
|
|
var type = (match[2] || 'ms').toLowerCase();
|
|||
|
|
switch (type) {
|
|||
|
|
case 'years':
|
|||
|
|
case 'year':
|
|||
|
|
case 'yrs':
|
|||
|
|
case 'yr':
|
|||
|
|
case 'y':
|
|||
|
|
return n * y;
|
|||
|
|
case 'weeks':
|
|||
|
|
case 'week':
|
|||
|
|
case 'w':
|
|||
|
|
return n * w;
|
|||
|
|
case 'days':
|
|||
|
|
case 'day':
|
|||
|
|
case 'd':
|
|||
|
|
return n * d;
|
|||
|
|
case 'hours':
|
|||
|
|
case 'hour':
|
|||
|
|
case 'hrs':
|
|||
|
|
case 'hr':
|
|||
|
|
case 'h':
|
|||
|
|
return n * h;
|
|||
|
|
case 'minutes':
|
|||
|
|
case 'minute':
|
|||
|
|
case 'mins':
|
|||
|
|
case 'min':
|
|||
|
|
case 'm':
|
|||
|
|
return n * m;
|
|||
|
|
case 'seconds':
|
|||
|
|
case 'second':
|
|||
|
|
case 'secs':
|
|||
|
|
case 'sec':
|
|||
|
|
case 's':
|
|||
|
|
return n * s;
|
|||
|
|
case 'milliseconds':
|
|||
|
|
case 'millisecond':
|
|||
|
|
case 'msecs':
|
|||
|
|
case 'msec':
|
|||
|
|
case 'ms':
|
|||
|
|
return n;
|
|||
|
|
default:
|
|||
|
|
return undefined;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Short format for `ms`.
|
|||
|
|
*
|
|||
|
|
* @param {Number} ms
|
|||
|
|
* @return {String}
|
|||
|
|
* @api private
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
function fmtShort(ms) {
|
|||
|
|
var msAbs = Math.abs(ms);
|
|||
|
|
if (msAbs >= d) {
|
|||
|
|
return Math.round(ms / d) + 'd';
|
|||
|
|
}
|
|||
|
|
if (msAbs >= h) {
|
|||
|
|
return Math.round(ms / h) + 'h';
|
|||
|
|
}
|
|||
|
|
if (msAbs >= m) {
|
|||
|
|
return Math.round(ms / m) + 'm';
|
|||
|
|
}
|
|||
|
|
if (msAbs >= s) {
|
|||
|
|
return Math.round(ms / s) + 's';
|
|||
|
|
}
|
|||
|
|
return ms + 'ms';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Long format for `ms`.
|
|||
|
|
*
|
|||
|
|
* @param {Number} ms
|
|||
|
|
* @return {String}
|
|||
|
|
* @api private
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
function fmtLong(ms) {
|
|||
|
|
var msAbs = Math.abs(ms);
|
|||
|
|
if (msAbs >= d) {
|
|||
|
|
return plural(ms, msAbs, d, 'day');
|
|||
|
|
}
|
|||
|
|
if (msAbs >= h) {
|
|||
|
|
return plural(ms, msAbs, h, 'hour');
|
|||
|
|
}
|
|||
|
|
if (msAbs >= m) {
|
|||
|
|
return plural(ms, msAbs, m, 'minute');
|
|||
|
|
}
|
|||
|
|
if (msAbs >= s) {
|
|||
|
|
return plural(ms, msAbs, s, 'second');
|
|||
|
|
}
|
|||
|
|
return ms + ' ms';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Pluralization helper.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
function plural(ms, msAbs, n, name) {
|
|||
|
|
var isPlural = msAbs >= n * 1.5;
|
|||
|
|
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 4307:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Copyright (c) 2014-present, Facebook, Inc.
|
|||
|
|
*
|
|||
|
|
* This source code is licensed under the MIT license found in the
|
|||
|
|
* LICENSE file in the root directory of this source tree.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
var runtime = (function (exports) {
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
var Op = Object.prototype;
|
|||
|
|
var hasOwn = Op.hasOwnProperty;
|
|||
|
|
var undefined; // More compressible than void 0.
|
|||
|
|
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|||
|
|
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|||
|
|
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|||
|
|
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|||
|
|
|
|||
|
|
function define(obj, key, value) {
|
|||
|
|
Object.defineProperty(obj, key, {
|
|||
|
|
value: value,
|
|||
|
|
enumerable: true,
|
|||
|
|
configurable: true,
|
|||
|
|
writable: true
|
|||
|
|
});
|
|||
|
|
return obj[key];
|
|||
|
|
}
|
|||
|
|
try {
|
|||
|
|
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|||
|
|
define({}, "");
|
|||
|
|
} catch (err) {
|
|||
|
|
define = function(obj, key, value) {
|
|||
|
|
return obj[key] = value;
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|||
|
|
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|||
|
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|||
|
|
var generator = Object.create(protoGenerator.prototype);
|
|||
|
|
var context = new Context(tryLocsList || []);
|
|||
|
|
|
|||
|
|
// The ._invoke method unifies the implementations of the .next,
|
|||
|
|
// .throw, and .return methods.
|
|||
|
|
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|||
|
|
|
|||
|
|
return generator;
|
|||
|
|
}
|
|||
|
|
exports.wrap = wrap;
|
|||
|
|
|
|||
|
|
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|||
|
|
// record like context.tryEntries[i].completion. This interface could
|
|||
|
|
// have been (and was previously) designed to take a closure to be
|
|||
|
|
// invoked without arguments, but in all the cases we care about we
|
|||
|
|
// already have an existing method we want to call, so there's no need
|
|||
|
|
// to create a new function object. We can even get away with assuming
|
|||
|
|
// the method takes exactly one argument, since that happens to be true
|
|||
|
|
// in every case, so we don't have to touch the arguments object. The
|
|||
|
|
// only additional allocation required is the completion record, which
|
|||
|
|
// has a stable shape and so hopefully should be cheap to allocate.
|
|||
|
|
function tryCatch(fn, obj, arg) {
|
|||
|
|
try {
|
|||
|
|
return { type: "normal", arg: fn.call(obj, arg) };
|
|||
|
|
} catch (err) {
|
|||
|
|
return { type: "throw", arg: err };
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var GenStateSuspendedStart = "suspendedStart";
|
|||
|
|
var GenStateSuspendedYield = "suspendedYield";
|
|||
|
|
var GenStateExecuting = "executing";
|
|||
|
|
var GenStateCompleted = "completed";
|
|||
|
|
|
|||
|
|
// Returning this object from the innerFn has the same effect as
|
|||
|
|
// breaking out of the dispatch switch statement.
|
|||
|
|
var ContinueSentinel = {};
|
|||
|
|
|
|||
|
|
// Dummy constructor functions that we use as the .constructor and
|
|||
|
|
// .constructor.prototype properties for functions that return Generator
|
|||
|
|
// objects. For full spec compliance, you may wish to configure your
|
|||
|
|
// minifier not to mangle the names of these two functions.
|
|||
|
|
function Generator() {}
|
|||
|
|
function GeneratorFunction() {}
|
|||
|
|
function GeneratorFunctionPrototype() {}
|
|||
|
|
|
|||
|
|
// This is a polyfill for %IteratorPrototype% for environments that
|
|||
|
|
// don't natively support it.
|
|||
|
|
var IteratorPrototype = {};
|
|||
|
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|||
|
|
return this;
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
var getProto = Object.getPrototypeOf;
|
|||
|
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|||
|
|
if (NativeIteratorPrototype &&
|
|||
|
|
NativeIteratorPrototype !== Op &&
|
|||
|
|
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|||
|
|
// This environment has a native %IteratorPrototype%; use it instead
|
|||
|
|
// of the polyfill.
|
|||
|
|
IteratorPrototype = NativeIteratorPrototype;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var Gp = GeneratorFunctionPrototype.prototype =
|
|||
|
|
Generator.prototype = Object.create(IteratorPrototype);
|
|||
|
|
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|||
|
|
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|||
|
|
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|||
|
|
GeneratorFunction.displayName = define(
|
|||
|
|
GeneratorFunctionPrototype,
|
|||
|
|
toStringTagSymbol,
|
|||
|
|
"GeneratorFunction"
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
// Helper for defining the .next, .throw, and .return methods of the
|
|||
|
|
// Iterator interface in terms of a single ._invoke method.
|
|||
|
|
function defineIteratorMethods(prototype) {
|
|||
|
|
["next", "throw", "return"].forEach(function(method) {
|
|||
|
|
define(prototype, method, function(arg) {
|
|||
|
|
return this._invoke(method, arg);
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
exports.isGeneratorFunction = function(genFun) {
|
|||
|
|
var ctor = typeof genFun === "function" && genFun.constructor;
|
|||
|
|
return ctor
|
|||
|
|
? ctor === GeneratorFunction ||
|
|||
|
|
// For the native GeneratorFunction constructor, the best we can
|
|||
|
|
// do is to check its .name property.
|
|||
|
|
(ctor.displayName || ctor.name) === "GeneratorFunction"
|
|||
|
|
: false;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
exports.mark = function(genFun) {
|
|||
|
|
if (Object.setPrototypeOf) {
|
|||
|
|
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|||
|
|
} else {
|
|||
|
|
genFun.__proto__ = GeneratorFunctionPrototype;
|
|||
|
|
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|||
|
|
}
|
|||
|
|
genFun.prototype = Object.create(Gp);
|
|||
|
|
return genFun;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// Within the body of any async function, `await x` is transformed to
|
|||
|
|
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|||
|
|
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|||
|
|
// meant to be awaited.
|
|||
|
|
exports.awrap = function(arg) {
|
|||
|
|
return { __await: arg };
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
function AsyncIterator(generator, PromiseImpl) {
|
|||
|
|
function invoke(method, arg, resolve, reject) {
|
|||
|
|
var record = tryCatch(generator[method], generator, arg);
|
|||
|
|
if (record.type === "throw") {
|
|||
|
|
reject(record.arg);
|
|||
|
|
} else {
|
|||
|
|
var result = record.arg;
|
|||
|
|
var value = result.value;
|
|||
|
|
if (value &&
|
|||
|
|
typeof value === "object" &&
|
|||
|
|
hasOwn.call(value, "__await")) {
|
|||
|
|
return PromiseImpl.resolve(value.__await).then(function(value) {
|
|||
|
|
invoke("next", value, resolve, reject);
|
|||
|
|
}, function(err) {
|
|||
|
|
invoke("throw", err, resolve, reject);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return PromiseImpl.resolve(value).then(function(unwrapped) {
|
|||
|
|
// When a yielded Promise is resolved, its final value becomes
|
|||
|
|
// the .value of the Promise<{value,done}> result for the
|
|||
|
|
// current iteration.
|
|||
|
|
result.value = unwrapped;
|
|||
|
|
resolve(result);
|
|||
|
|
}, function(error) {
|
|||
|
|
// If a rejected Promise was yielded, throw the rejection back
|
|||
|
|
// into the async generator function so it can be handled there.
|
|||
|
|
return invoke("throw", error, resolve, reject);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var previousPromise;
|
|||
|
|
|
|||
|
|
function enqueue(method, arg) {
|
|||
|
|
function callInvokeWithMethodAndArg() {
|
|||
|
|
return new PromiseImpl(function(resolve, reject) {
|
|||
|
|
invoke(method, arg, resolve, reject);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return previousPromise =
|
|||
|
|
// If enqueue has been called before, then we want to wait until
|
|||
|
|
// all previous Promises have been resolved before calling invoke,
|
|||
|
|
// so that results are always delivered in the correct order. If
|
|||
|
|
// enqueue has not been called before, then it is important to
|
|||
|
|
// call invoke immediately, without waiting on a callback to fire,
|
|||
|
|
// so that the async generator function has the opportunity to do
|
|||
|
|
// any necessary setup in a predictable way. This predictability
|
|||
|
|
// is why the Promise constructor synchronously invokes its
|
|||
|
|
// executor callback, and why async functions synchronously
|
|||
|
|
// execute code before the first await. Since we implement simple
|
|||
|
|
// async functions in terms of async generators, it is especially
|
|||
|
|
// important to get this right, even though it requires care.
|
|||
|
|
previousPromise ? previousPromise.then(
|
|||
|
|
callInvokeWithMethodAndArg,
|
|||
|
|
// Avoid propagating failures to Promises returned by later
|
|||
|
|
// invocations of the iterator.
|
|||
|
|
callInvokeWithMethodAndArg
|
|||
|
|
) : callInvokeWithMethodAndArg();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Define the unified helper method that is used to implement .next,
|
|||
|
|
// .throw, and .return (see defineIteratorMethods).
|
|||
|
|
this._invoke = enqueue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
defineIteratorMethods(AsyncIterator.prototype);
|
|||
|
|
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|||
|
|
return this;
|
|||
|
|
});
|
|||
|
|
exports.AsyncIterator = AsyncIterator;
|
|||
|
|
|
|||
|
|
// Note that simple async functions are implemented on top of
|
|||
|
|
// AsyncIterator objects; they just return a Promise for the value of
|
|||
|
|
// the final result produced by the iterator.
|
|||
|
|
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|||
|
|
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|||
|
|
|
|||
|
|
var iter = new AsyncIterator(
|
|||
|
|
wrap(innerFn, outerFn, self, tryLocsList),
|
|||
|
|
PromiseImpl
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
return exports.isGeneratorFunction(outerFn)
|
|||
|
|
? iter // If outerFn is a generator, return the full iterator.
|
|||
|
|
: iter.next().then(function(result) {
|
|||
|
|
return result.done ? result.value : iter.next();
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
function makeInvokeMethod(innerFn, self, context) {
|
|||
|
|
var state = GenStateSuspendedStart;
|
|||
|
|
|
|||
|
|
return function invoke(method, arg) {
|
|||
|
|
if (state === GenStateExecuting) {
|
|||
|
|
throw new Error("Generator is already running");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (state === GenStateCompleted) {
|
|||
|
|
if (method === "throw") {
|
|||
|
|
throw arg;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|||
|
|
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|||
|
|
return doneResult();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
context.method = method;
|
|||
|
|
context.arg = arg;
|
|||
|
|
|
|||
|
|
while (true) {
|
|||
|
|
var delegate = context.delegate;
|
|||
|
|
if (delegate) {
|
|||
|
|
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|||
|
|
if (delegateResult) {
|
|||
|
|
if (delegateResult === ContinueSentinel) continue;
|
|||
|
|
return delegateResult;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (context.method === "next") {
|
|||
|
|
// Setting context._sent for legacy support of Babel's
|
|||
|
|
// function.sent implementation.
|
|||
|
|
context.sent = context._sent = context.arg;
|
|||
|
|
|
|||
|
|
} else if (context.method === "throw") {
|
|||
|
|
if (state === GenStateSuspendedStart) {
|
|||
|
|
state = GenStateCompleted;
|
|||
|
|
throw context.arg;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
context.dispatchException(context.arg);
|
|||
|
|
|
|||
|
|
} else if (context.method === "return") {
|
|||
|
|
context.abrupt("return", context.arg);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
state = GenStateExecuting;
|
|||
|
|
|
|||
|
|
var record = tryCatch(innerFn, self, context);
|
|||
|
|
if (record.type === "normal") {
|
|||
|
|
// If an exception is thrown from innerFn, we leave state ===
|
|||
|
|
// GenStateExecuting and loop back for another invocation.
|
|||
|
|
state = context.done
|
|||
|
|
? GenStateCompleted
|
|||
|
|
: GenStateSuspendedYield;
|
|||
|
|
|
|||
|
|
if (record.arg === ContinueSentinel) {
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return {
|
|||
|
|
value: record.arg,
|
|||
|
|
done: context.done
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
} else if (record.type === "throw") {
|
|||
|
|
state = GenStateCompleted;
|
|||
|
|
// Dispatch the exception by looping back around to the
|
|||
|
|
// context.dispatchException(context.arg) call above.
|
|||
|
|
context.method = "throw";
|
|||
|
|
context.arg = record.arg;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Call delegate.iterator[context.method](context.arg) and handle the
|
|||
|
|
// result, either by returning a { value, done } result from the
|
|||
|
|
// delegate iterator, or by modifying context.method and context.arg,
|
|||
|
|
// setting context.delegate to null, and returning the ContinueSentinel.
|
|||
|
|
function maybeInvokeDelegate(delegate, context) {
|
|||
|
|
var method = delegate.iterator[context.method];
|
|||
|
|
if (method === undefined) {
|
|||
|
|
// A .throw or .return when the delegate iterator has no .throw
|
|||
|
|
// method always terminates the yield* loop.
|
|||
|
|
context.delegate = null;
|
|||
|
|
|
|||
|
|
if (context.method === "throw") {
|
|||
|
|
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|||
|
|
if (delegate.iterator["return"]) {
|
|||
|
|
// If the delegate iterator has a return method, give it a
|
|||
|
|
// chance to clean up.
|
|||
|
|
context.method = "return";
|
|||
|
|
context.arg = undefined;
|
|||
|
|
maybeInvokeDelegate(delegate, context);
|
|||
|
|
|
|||
|
|
if (context.method === "throw") {
|
|||
|
|
// If maybeInvokeDelegate(context) changed context.method from
|
|||
|
|
// "return" to "throw", let that override the TypeError below.
|
|||
|
|
return ContinueSentinel;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
context.method = "throw";
|
|||
|
|
context.arg = new TypeError(
|
|||
|
|
"The iterator does not provide a 'throw' method");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return ContinueSentinel;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|||
|
|
|
|||
|
|
if (record.type === "throw") {
|
|||
|
|
context.method = "throw";
|
|||
|
|
context.arg = record.arg;
|
|||
|
|
context.delegate = null;
|
|||
|
|
return ContinueSentinel;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var info = record.arg;
|
|||
|
|
|
|||
|
|
if (! info) {
|
|||
|
|
context.method = "throw";
|
|||
|
|
context.arg = new TypeError("iterator result is not an object");
|
|||
|
|
context.delegate = null;
|
|||
|
|
return ContinueSentinel;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (info.done) {
|
|||
|
|
// Assign the result of the finished delegate to the temporary
|
|||
|
|
// variable specified by delegate.resultName (see delegateYield).
|
|||
|
|
context[delegate.resultName] = info.value;
|
|||
|
|
|
|||
|
|
// Resume execution at the desired location (see delegateYield).
|
|||
|
|
context.next = delegate.nextLoc;
|
|||
|
|
|
|||
|
|
// If context.method was "throw" but the delegate handled the
|
|||
|
|
// exception, let the outer generator proceed normally. If
|
|||
|
|
// context.method was "next", forget context.arg since it has been
|
|||
|
|
// "consumed" by the delegate iterator. If context.method was
|
|||
|
|
// "return", allow the original .return call to continue in the
|
|||
|
|
// outer generator.
|
|||
|
|
if (context.method !== "return") {
|
|||
|
|
context.method = "next";
|
|||
|
|
context.arg = undefined;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} else {
|
|||
|
|
// Re-yield the result returned by the delegate method.
|
|||
|
|
return info;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// The delegate iterator is finished, so forget it and continue with
|
|||
|
|
// the outer generator.
|
|||
|
|
context.delegate = null;
|
|||
|
|
return ContinueSentinel;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Define Generator.prototype.{next,throw,return} in terms of the
|
|||
|
|
// unified ._invoke helper method.
|
|||
|
|
defineIteratorMethods(Gp);
|
|||
|
|
|
|||
|
|
define(Gp, toStringTagSymbol, "Generator");
|
|||
|
|
|
|||
|
|
// A Generator should always return itself as the iterator object when the
|
|||
|
|
// @@iterator function is called on it. Some browsers' implementations of the
|
|||
|
|
// iterator prototype chain incorrectly implement this, causing the Generator
|
|||
|
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|||
|
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|||
|
|
define(Gp, iteratorSymbol, function() {
|
|||
|
|
return this;
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
define(Gp, "toString", function() {
|
|||
|
|
return "[object Generator]";
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
function pushTryEntry(locs) {
|
|||
|
|
var entry = { tryLoc: locs[0] };
|
|||
|
|
|
|||
|
|
if (1 in locs) {
|
|||
|
|
entry.catchLoc = locs[1];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (2 in locs) {
|
|||
|
|
entry.finallyLoc = locs[2];
|
|||
|
|
entry.afterLoc = locs[3];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
this.tryEntries.push(entry);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function resetTryEntry(entry) {
|
|||
|
|
var record = entry.completion || {};
|
|||
|
|
record.type = "normal";
|
|||
|
|
delete record.arg;
|
|||
|
|
entry.completion = record;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function Context(tryLocsList) {
|
|||
|
|
// The root entry object (effectively a try statement without a catch
|
|||
|
|
// or a finally block) gives us a place to store values thrown from
|
|||
|
|
// locations where there is no enclosing try statement.
|
|||
|
|
this.tryEntries = [{ tryLoc: "root" }];
|
|||
|
|
tryLocsList.forEach(pushTryEntry, this);
|
|||
|
|
this.reset(true);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
exports.keys = function(object) {
|
|||
|
|
var keys = [];
|
|||
|
|
for (var key in object) {
|
|||
|
|
keys.push(key);
|
|||
|
|
}
|
|||
|
|
keys.reverse();
|
|||
|
|
|
|||
|
|
// Rather than returning an object with a next method, we keep
|
|||
|
|
// things simple and return the next function itself.
|
|||
|
|
return function next() {
|
|||
|
|
while (keys.length) {
|
|||
|
|
var key = keys.pop();
|
|||
|
|
if (key in object) {
|
|||
|
|
next.value = key;
|
|||
|
|
next.done = false;
|
|||
|
|
return next;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// To avoid creating an additional object, we just hang the .value
|
|||
|
|
// and .done properties off the next function object itself. This
|
|||
|
|
// also ensures that the minifier will not anonymize the function.
|
|||
|
|
next.done = true;
|
|||
|
|
return next;
|
|||
|
|
};
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
function values(iterable) {
|
|||
|
|
if (iterable) {
|
|||
|
|
var iteratorMethod = iterable[iteratorSymbol];
|
|||
|
|
if (iteratorMethod) {
|
|||
|
|
return iteratorMethod.call(iterable);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (typeof iterable.next === "function") {
|
|||
|
|
return iterable;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!isNaN(iterable.length)) {
|
|||
|
|
var i = -1, next = function next() {
|
|||
|
|
while (++i < iterable.length) {
|
|||
|
|
if (hasOwn.call(iterable, i)) {
|
|||
|
|
next.value = iterable[i];
|
|||
|
|
next.done = false;
|
|||
|
|
return next;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
next.value = undefined;
|
|||
|
|
next.done = true;
|
|||
|
|
|
|||
|
|
return next;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
return next.next = next;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Return an iterator with no values.
|
|||
|
|
return { next: doneResult };
|
|||
|
|
}
|
|||
|
|
exports.values = values;
|
|||
|
|
|
|||
|
|
function doneResult() {
|
|||
|
|
return { value: undefined, done: true };
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Context.prototype = {
|
|||
|
|
constructor: Context,
|
|||
|
|
|
|||
|
|
reset: function(skipTempReset) {
|
|||
|
|
this.prev = 0;
|
|||
|
|
this.next = 0;
|
|||
|
|
// Resetting context._sent for legacy support of Babel's
|
|||
|
|
// function.sent implementation.
|
|||
|
|
this.sent = this._sent = undefined;
|
|||
|
|
this.done = false;
|
|||
|
|
this.delegate = null;
|
|||
|
|
|
|||
|
|
this.method = "next";
|
|||
|
|
this.arg = undefined;
|
|||
|
|
|
|||
|
|
this.tryEntries.forEach(resetTryEntry);
|
|||
|
|
|
|||
|
|
if (!skipTempReset) {
|
|||
|
|
for (var name in this) {
|
|||
|
|
// Not sure about the optimal order of these conditions:
|
|||
|
|
if (name.charAt(0) === "t" &&
|
|||
|
|
hasOwn.call(this, name) &&
|
|||
|
|
!isNaN(+name.slice(1))) {
|
|||
|
|
this[name] = undefined;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
stop: function() {
|
|||
|
|
this.done = true;
|
|||
|
|
|
|||
|
|
var rootEntry = this.tryEntries[0];
|
|||
|
|
var rootRecord = rootEntry.completion;
|
|||
|
|
if (rootRecord.type === "throw") {
|
|||
|
|
throw rootRecord.arg;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return this.rval;
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
dispatchException: function(exception) {
|
|||
|
|
if (this.done) {
|
|||
|
|
throw exception;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var context = this;
|
|||
|
|
function handle(loc, caught) {
|
|||
|
|
record.type = "throw";
|
|||
|
|
record.arg = exception;
|
|||
|
|
context.next = loc;
|
|||
|
|
|
|||
|
|
if (caught) {
|
|||
|
|
// If the dispatched exception was caught by a catch block,
|
|||
|
|
// then let that catch block handle the exception normally.
|
|||
|
|
context.method = "next";
|
|||
|
|
context.arg = undefined;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return !! caught;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|||
|
|
var entry = this.tryEntries[i];
|
|||
|
|
var record = entry.completion;
|
|||
|
|
|
|||
|
|
if (entry.tryLoc === "root") {
|
|||
|
|
// Exception thrown outside of any try block that could handle
|
|||
|
|
// it, so set the completion value of the entire function to
|
|||
|
|
// throw the exception.
|
|||
|
|
return handle("end");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (entry.tryLoc <= this.prev) {
|
|||
|
|
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|||
|
|
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|||
|
|
|
|||
|
|
if (hasCatch && hasFinally) {
|
|||
|
|
if (this.prev < entry.catchLoc) {
|
|||
|
|
return handle(entry.catchLoc, true);
|
|||
|
|
} else if (this.prev < entry.finallyLoc) {
|
|||
|
|
return handle(entry.finallyLoc);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} else if (hasCatch) {
|
|||
|
|
if (this.prev < entry.catchLoc) {
|
|||
|
|
return handle(entry.catchLoc, true);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} else if (hasFinally) {
|
|||
|
|
if (this.prev < entry.finallyLoc) {
|
|||
|
|
return handle(entry.finallyLoc);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} else {
|
|||
|
|
throw new Error("try statement without catch or finally");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
abrupt: function(type, arg) {
|
|||
|
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|||
|
|
var entry = this.tryEntries[i];
|
|||
|
|
if (entry.tryLoc <= this.prev &&
|
|||
|
|
hasOwn.call(entry, "finallyLoc") &&
|
|||
|
|
this.prev < entry.finallyLoc) {
|
|||
|
|
var finallyEntry = entry;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (finallyEntry &&
|
|||
|
|
(type === "break" ||
|
|||
|
|
type === "continue") &&
|
|||
|
|
finallyEntry.tryLoc <= arg &&
|
|||
|
|
arg <= finallyEntry.finallyLoc) {
|
|||
|
|
// Ignore the finally entry if control is not jumping to a
|
|||
|
|
// location outside the try/catch block.
|
|||
|
|
finallyEntry = null;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|||
|
|
record.type = type;
|
|||
|
|
record.arg = arg;
|
|||
|
|
|
|||
|
|
if (finallyEntry) {
|
|||
|
|
this.method = "next";
|
|||
|
|
this.next = finallyEntry.finallyLoc;
|
|||
|
|
return ContinueSentinel;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return this.complete(record);
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
complete: function(record, afterLoc) {
|
|||
|
|
if (record.type === "throw") {
|
|||
|
|
throw record.arg;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (record.type === "break" ||
|
|||
|
|
record.type === "continue") {
|
|||
|
|
this.next = record.arg;
|
|||
|
|
} else if (record.type === "return") {
|
|||
|
|
this.rval = this.arg = record.arg;
|
|||
|
|
this.method = "return";
|
|||
|
|
this.next = "end";
|
|||
|
|
} else if (record.type === "normal" && afterLoc) {
|
|||
|
|
this.next = afterLoc;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return ContinueSentinel;
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
finish: function(finallyLoc) {
|
|||
|
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|||
|
|
var entry = this.tryEntries[i];
|
|||
|
|
if (entry.finallyLoc === finallyLoc) {
|
|||
|
|
this.complete(entry.completion, entry.afterLoc);
|
|||
|
|
resetTryEntry(entry);
|
|||
|
|
return ContinueSentinel;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
"catch": function(tryLoc) {
|
|||
|
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|||
|
|
var entry = this.tryEntries[i];
|
|||
|
|
if (entry.tryLoc === tryLoc) {
|
|||
|
|
var record = entry.completion;
|
|||
|
|
if (record.type === "throw") {
|
|||
|
|
var thrown = record.arg;
|
|||
|
|
resetTryEntry(entry);
|
|||
|
|
}
|
|||
|
|
return thrown;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// The context.catch method must only be called with a location
|
|||
|
|
// argument that corresponds to a known catch block.
|
|||
|
|
throw new Error("illegal catch attempt");
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
delegateYield: function(iterable, resultName, nextLoc) {
|
|||
|
|
this.delegate = {
|
|||
|
|
iterator: values(iterable),
|
|||
|
|
resultName: resultName,
|
|||
|
|
nextLoc: nextLoc
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
if (this.method === "next") {
|
|||
|
|
// Deliberately forget the last sent value so that we don't
|
|||
|
|
// accidentally pass it on to the delegate.
|
|||
|
|
this.arg = undefined;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return ContinueSentinel;
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// Regardless of whether this script is executing as a CommonJS module
|
|||
|
|
// or not, return the runtime object so that we can declare the variable
|
|||
|
|
// regeneratorRuntime in the outer scope, which allows this module to be
|
|||
|
|
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|||
|
|
return exports;
|
|||
|
|
|
|||
|
|
}(
|
|||
|
|
// If this script is executing as a CommonJS module, use module.exports
|
|||
|
|
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|||
|
|
// object. Either way, the resulting object will be used to initialize
|
|||
|
|
// the regeneratorRuntime variable at the top of this file.
|
|||
|
|
true ? module.exports : 0
|
|||
|
|
));
|
|||
|
|
|
|||
|
|
try {
|
|||
|
|
regeneratorRuntime = runtime;
|
|||
|
|
} catch (accidentalStrictMode) {
|
|||
|
|
// This module should not be running in strict mode, so the above
|
|||
|
|
// assignment should always work unless something is misconfigured. Just
|
|||
|
|
// in case runtime.js accidentally runs in strict mode, in modern engines
|
|||
|
|
// we can explicitly access globalThis. In older engines we can escape
|
|||
|
|
// strict mode using a global Function call. This could conceivably fail
|
|||
|
|
// if a Content Security Policy forbids using Function, but in that case
|
|||
|
|
// the proper solution is to fix the accidental strict mode problem. If
|
|||
|
|
// you've misconfigured your bundler to force strict mode and applied a
|
|||
|
|
// CSP to forbid Function, and you're not willing to fix either of those
|
|||
|
|
// problems, please detail your unique predicament in a GitHub issue.
|
|||
|
|
if (typeof globalThis === "object") {
|
|||
|
|
globalThis.regeneratorRuntime = runtime;
|
|||
|
|
} else {
|
|||
|
|
Function("r", "regeneratorRuntime = r")(runtime);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 9318:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
const os = __nccwpck_require__(2087);
|
|||
|
|
const tty = __nccwpck_require__(3867);
|
|||
|
|
const hasFlag = __nccwpck_require__(1621);
|
|||
|
|
|
|||
|
|
const {env} = process;
|
|||
|
|
|
|||
|
|
let forceColor;
|
|||
|
|
if (hasFlag('no-color') ||
|
|||
|
|
hasFlag('no-colors') ||
|
|||
|
|
hasFlag('color=false') ||
|
|||
|
|
hasFlag('color=never')) {
|
|||
|
|
forceColor = 0;
|
|||
|
|
} else if (hasFlag('color') ||
|
|||
|
|
hasFlag('colors') ||
|
|||
|
|
hasFlag('color=true') ||
|
|||
|
|
hasFlag('color=always')) {
|
|||
|
|
forceColor = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ('FORCE_COLOR' in env) {
|
|||
|
|
if (env.FORCE_COLOR === 'true') {
|
|||
|
|
forceColor = 1;
|
|||
|
|
} else if (env.FORCE_COLOR === 'false') {
|
|||
|
|
forceColor = 0;
|
|||
|
|
} else {
|
|||
|
|
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function translateLevel(level) {
|
|||
|
|
if (level === 0) {
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return {
|
|||
|
|
level,
|
|||
|
|
hasBasic: true,
|
|||
|
|
has256: level >= 2,
|
|||
|
|
has16m: level >= 3
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function supportsColor(haveStream, streamIsTTY) {
|
|||
|
|
if (forceColor === 0) {
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (hasFlag('color=16m') ||
|
|||
|
|
hasFlag('color=full') ||
|
|||
|
|
hasFlag('color=truecolor')) {
|
|||
|
|
return 3;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (hasFlag('color=256')) {
|
|||
|
|
return 2;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
const min = forceColor || 0;
|
|||
|
|
|
|||
|
|
if (env.TERM === 'dumb') {
|
|||
|
|
return min;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (process.platform === 'win32') {
|
|||
|
|
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
|
|||
|
|
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
|
|||
|
|
const osRelease = os.release().split('.');
|
|||
|
|
if (
|
|||
|
|
Number(osRelease[0]) >= 10 &&
|
|||
|
|
Number(osRelease[2]) >= 10586
|
|||
|
|
) {
|
|||
|
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ('CI' in env) {
|
|||
|
|
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
|||
|
|
return 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return min;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ('TEAMCITY_VERSION' in env) {
|
|||
|
|
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (env.COLORTERM === 'truecolor') {
|
|||
|
|
return 3;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ('TERM_PROGRAM' in env) {
|
|||
|
|
const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|||
|
|
|
|||
|
|
switch (env.TERM_PROGRAM) {
|
|||
|
|
case 'iTerm.app':
|
|||
|
|
return version >= 3 ? 3 : 2;
|
|||
|
|
case 'Apple_Terminal':
|
|||
|
|
return 2;
|
|||
|
|
// No default
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (/-256(color)?$/i.test(env.TERM)) {
|
|||
|
|
return 2;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|||
|
|
return 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ('COLORTERM' in env) {
|
|||
|
|
return 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return min;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function getSupportLevel(stream) {
|
|||
|
|
const level = supportsColor(stream, stream && stream.isTTY);
|
|||
|
|
return translateLevel(level);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
module.exports = {
|
|||
|
|
supportsColor: getSupportLevel,
|
|||
|
|
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|||
|
|
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 4294:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
module.exports = __nccwpck_require__(4219);
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 4219:
|
|||
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
|
|||
|
|
|
|||
|
|
var net = __nccwpck_require__(1631);
|
|||
|
|
var tls = __nccwpck_require__(4016);
|
|||
|
|
var http = __nccwpck_require__(8605);
|
|||
|
|
var https = __nccwpck_require__(7211);
|
|||
|
|
var events = __nccwpck_require__(8614);
|
|||
|
|
var assert = __nccwpck_require__(2357);
|
|||
|
|
var util = __nccwpck_require__(1669);
|
|||
|
|
|
|||
|
|
|
|||
|
|
exports.httpOverHttp = httpOverHttp;
|
|||
|
|
exports.httpsOverHttp = httpsOverHttp;
|
|||
|
|
exports.httpOverHttps = httpOverHttps;
|
|||
|
|
exports.httpsOverHttps = httpsOverHttps;
|
|||
|
|
|
|||
|
|
|
|||
|
|
function httpOverHttp(options) {
|
|||
|
|
var agent = new TunnelingAgent(options);
|
|||
|
|
agent.request = http.request;
|
|||
|
|
return agent;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function httpsOverHttp(options) {
|
|||
|
|
var agent = new TunnelingAgent(options);
|
|||
|
|
agent.request = http.request;
|
|||
|
|
agent.createSocket = createSecureSocket;
|
|||
|
|
agent.defaultPort = 443;
|
|||
|
|
return agent;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function httpOverHttps(options) {
|
|||
|
|
var agent = new TunnelingAgent(options);
|
|||
|
|
agent.request = https.request;
|
|||
|
|
return agent;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function httpsOverHttps(options) {
|
|||
|
|
var agent = new TunnelingAgent(options);
|
|||
|
|
agent.request = https.request;
|
|||
|
|
agent.createSocket = createSecureSocket;
|
|||
|
|
agent.defaultPort = 443;
|
|||
|
|
return agent;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
function TunnelingAgent(options) {
|
|||
|
|
var self = this;
|
|||
|
|
self.options = options || {};
|
|||
|
|
self.proxyOptions = self.options.proxy || {};
|
|||
|
|
self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets;
|
|||
|
|
self.requests = [];
|
|||
|
|
self.sockets = [];
|
|||
|
|
|
|||
|
|
self.on('free', function onFree(socket, host, port, localAddress) {
|
|||
|
|
var options = toOptions(host, port, localAddress);
|
|||
|
|
for (var i = 0, len = self.requests.length; i < len; ++i) {
|
|||
|
|
var pending = self.requests[i];
|
|||
|
|
if (pending.host === options.host && pending.port === options.port) {
|
|||
|
|
// Detect the request to connect same origin server,
|
|||
|
|
// reuse the connection.
|
|||
|
|
self.requests.splice(i, 1);
|
|||
|
|
pending.request.onSocket(socket);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
socket.destroy();
|
|||
|
|
self.removeSocket(socket);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
util.inherits(TunnelingAgent, events.EventEmitter);
|
|||
|
|
|
|||
|
|
TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) {
|
|||
|
|
var self = this;
|
|||
|
|
var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress));
|
|||
|
|
|
|||
|
|
if (self.sockets.length >= this.maxSockets) {
|
|||
|
|
// We are over limit so we'll add it to the queue.
|
|||
|
|
self.requests.push(options);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// If we are under maxSockets create a new one.
|
|||
|
|
self.createSocket(options, function(socket) {
|
|||
|
|
socket.on('free', onFree);
|
|||
|
|
socket.on('close', onCloseOrRemove);
|
|||
|
|
socket.on('agentRemove', onCloseOrRemove);
|
|||
|
|
req.onSocket(socket);
|
|||
|
|
|
|||
|
|
function onFree() {
|
|||
|
|
self.emit('free', socket, options);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function onCloseOrRemove(err) {
|
|||
|
|
self.removeSocket(socket);
|
|||
|
|
socket.removeListener('free', onFree);
|
|||
|
|
socket.removeListener('close', onCloseOrRemove);
|
|||
|
|
socket.removeListener('agentRemove', onCloseOrRemove);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
TunnelingAgent.prototype.createSocket = function createSocket(options, cb) {
|
|||
|
|
var self = this;
|
|||
|
|
var placeholder = {};
|
|||
|
|
self.sockets.push(placeholder);
|
|||
|
|
|
|||
|
|
var connectOptions = mergeOptions({}, self.proxyOptions, {
|
|||
|
|
method: 'CONNECT',
|
|||
|
|
path: options.host + ':' + options.port,
|
|||
|
|
agent: false,
|
|||
|
|
headers: {
|
|||
|
|
host: options.host + ':' + options.port
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
if (options.localAddress) {
|
|||
|
|
connectOptions.localAddress = options.localAddress;
|
|||
|
|
}
|
|||
|
|
if (connectOptions.proxyAuth) {
|
|||
|
|
connectOptions.headers = connectOptions.headers || {};
|
|||
|
|
connectOptions.headers['Proxy-Authorization'] = 'Basic ' +
|
|||
|
|
new Buffer(connectOptions.proxyAuth).toString('base64');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
debug('making CONNECT request');
|
|||
|
|
var connectReq = self.request(connectOptions);
|
|||
|
|
connectReq.useChunkedEncodingByDefault = false; // for v0.6
|
|||
|
|
connectReq.once('response', onResponse); // for v0.6
|
|||
|
|
connectReq.once('upgrade', onUpgrade); // for v0.6
|
|||
|
|
connectReq.once('connect', onConnect); // for v0.7 or later
|
|||
|
|
connectReq.once('error', onError);
|
|||
|
|
connectReq.end();
|
|||
|
|
|
|||
|
|
function onResponse(res) {
|
|||
|
|
// Very hacky. This is necessary to avoid http-parser leaks.
|
|||
|
|
res.upgrade = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function onUpgrade(res, socket, head) {
|
|||
|
|
// Hacky.
|
|||
|
|
process.nextTick(function() {
|
|||
|
|
onConnect(res, socket, head);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function onConnect(res, socket, head) {
|
|||
|
|
connectReq.removeAllListeners();
|
|||
|
|
socket.removeAllListeners();
|
|||
|
|
|
|||
|
|
if (res.statusCode !== 200) {
|
|||
|
|
debug('tunneling socket could not be established, statusCode=%d',
|
|||
|
|
res.statusCode);
|
|||
|
|
socket.destroy();
|
|||
|
|
var error = new Error('tunneling socket could not be established, ' +
|
|||
|
|
'statusCode=' + res.statusCode);
|
|||
|
|
error.code = 'ECONNRESET';
|
|||
|
|
options.request.emit('error', error);
|
|||
|
|
self.removeSocket(placeholder);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (head.length > 0) {
|
|||
|
|
debug('got illegal response body from proxy');
|
|||
|
|
socket.destroy();
|
|||
|
|
var error = new Error('got illegal response body from proxy');
|
|||
|
|
error.code = 'ECONNRESET';
|
|||
|
|
options.request.emit('error', error);
|
|||
|
|
self.removeSocket(placeholder);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
debug('tunneling connection has established');
|
|||
|
|
self.sockets[self.sockets.indexOf(placeholder)] = socket;
|
|||
|
|
return cb(socket);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function onError(cause) {
|
|||
|
|
connectReq.removeAllListeners();
|
|||
|
|
|
|||
|
|
debug('tunneling socket could not be established, cause=%s\n',
|
|||
|
|
cause.message, cause.stack);
|
|||
|
|
var error = new Error('tunneling socket could not be established, ' +
|
|||
|
|
'cause=' + cause.message);
|
|||
|
|
error.code = 'ECONNRESET';
|
|||
|
|
options.request.emit('error', error);
|
|||
|
|
self.removeSocket(placeholder);
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
TunnelingAgent.prototype.removeSocket = function removeSocket(socket) {
|
|||
|
|
var pos = this.sockets.indexOf(socket)
|
|||
|
|
if (pos === -1) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
this.sockets.splice(pos, 1);
|
|||
|
|
|
|||
|
|
var pending = this.requests.shift();
|
|||
|
|
if (pending) {
|
|||
|
|
// If we have pending requests and a socket gets closed a new one
|
|||
|
|
// needs to be created to take over in the pool for the one that closed.
|
|||
|
|
this.createSocket(pending, function(socket) {
|
|||
|
|
pending.request.onSocket(socket);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
function createSecureSocket(options, cb) {
|
|||
|
|
var self = this;
|
|||
|
|
TunnelingAgent.prototype.createSocket.call(self, options, function(socket) {
|
|||
|
|
var hostHeader = options.request.getHeader('host');
|
|||
|
|
var tlsOptions = mergeOptions({}, self.options, {
|
|||
|
|
socket: socket,
|
|||
|
|
servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 0 is dummy port for v0.6
|
|||
|
|
var secureSocket = tls.connect(0, tlsOptions);
|
|||
|
|
self.sockets[self.sockets.indexOf(socket)] = secureSocket;
|
|||
|
|
cb(secureSocket);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
function toOptions(host, port, localAddress) {
|
|||
|
|
if (typeof host === 'string') { // since v0.10
|
|||
|
|
return {
|
|||
|
|
host: host,
|
|||
|
|
port: port,
|
|||
|
|
localAddress: localAddress
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
return host; // for v0.11 or later
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function mergeOptions(target) {
|
|||
|
|
for (var i = 1, len = arguments.length; i < len; ++i) {
|
|||
|
|
var overrides = arguments[i];
|
|||
|
|
if (typeof overrides === 'object') {
|
|||
|
|
var keys = Object.keys(overrides);
|
|||
|
|
for (var j = 0, keyLen = keys.length; j < keyLen; ++j) {
|
|||
|
|
var k = keys[j];
|
|||
|
|
if (overrides[k] !== undefined) {
|
|||
|
|
target[k] = overrides[k];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return target;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
var debug;
|
|||
|
|
if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
|
|||
|
|
debug = function() {
|
|||
|
|
var args = Array.prototype.slice.call(arguments);
|
|||
|
|
if (typeof args[0] === 'string') {
|
|||
|
|
args[0] = 'TUNNEL: ' + args[0];
|
|||
|
|
} else {
|
|||
|
|
args.unshift('TUNNEL:');
|
|||
|
|
}
|
|||
|
|
console.error.apply(console, args);
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
debug = function() {};
|
|||
|
|
}
|
|||
|
|
exports.debug = debug; // for test
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 1319:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
const core = __nccwpck_require__(2186)
|
|||
|
|
|
|||
|
|
// Load variables from Actions runtime
|
|||
|
|
function getRequiredVars() {
|
|||
|
|
return {
|
|||
|
|
runTimeUrl: process.env.ACTIONS_RUNTIME_URL,
|
|||
|
|
workflowRun: process.env.GITHUB_RUN_ID,
|
|||
|
|
runTimeToken: process.env.ACTIONS_RUNTIME_TOKEN,
|
|||
|
|
repositoryNwo: process.env.GITHUB_REPOSITORY,
|
|||
|
|
buildVersion: process.env.GITHUB_SHA,
|
|||
|
|
buildActor: process.env.GITHUB_ACTOR,
|
|||
|
|
actionsId: process.env.GITHUB_ACTION,
|
|||
|
|
githubToken: core.getInput('token')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
module.exports = function getContext() {
|
|||
|
|
const requiredVars = getRequiredVars()
|
|||
|
|
for (const variable in requiredVars) {
|
|||
|
|
if (requiredVars[variable] === undefined) {
|
|||
|
|
throw new Error(`${variable} is undefined. Cannot continue.`)
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
core.debug('all variables are set')
|
|||
|
|
return requiredVars
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 2877:
|
|||
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|||
|
|
|
|||
|
|
__nccwpck_require__(4307)
|
|||
|
|
|
|||
|
|
const core = __nccwpck_require__(2186)
|
|||
|
|
const axios = __nccwpck_require__(6545)
|
|||
|
|
|
|||
|
|
// All variables we need from the runtime are loaded here
|
|||
|
|
const getContext = __nccwpck_require__(1319)
|
|||
|
|
|
|||
|
|
class Deployment {
|
|||
|
|
constructor() {
|
|||
|
|
const context = getContext()
|
|||
|
|
this.runTimeUrl = context.runTimeUrl
|
|||
|
|
this.repositoryNwo = context.repositoryNwo
|
|||
|
|
this.runTimeToken = context.runTimeToken
|
|||
|
|
this.buildVersion = context.buildVersion
|
|||
|
|
this.buildActor = context.buildActor
|
|||
|
|
this.actionsId = context.workflowRun
|
|||
|
|
this.githubToken = context.githubToken
|
|||
|
|
this.workflowRun = context.workflowRun
|
|||
|
|
this.requestedDeployment = false
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Ask the runtime for the unsigned artifact URL and deploy to GitHub Pages
|
|||
|
|
// by creating a deployment with that artifact
|
|||
|
|
async create(idToken) {
|
|||
|
|
try {
|
|||
|
|
core.info(`Actor: ${this.buildActor}`)
|
|||
|
|
core.info(`Action ID: ${this.actionsId}`)
|
|||
|
|
const pagesDeployEndpoint = `https://api.github.com/repos/${this.repositoryNwo}/pages/deployment`
|
|||
|
|
const artifactExgUrl = `${this.runTimeUrl}_apis/pipelines/workflows/${this.workflowRun}/artifacts?api-version=6.0-preview`
|
|||
|
|
core.info(`Artifact URL: ${artifactExgUrl}`)
|
|||
|
|
const {data} = await axios.get(artifactExgUrl, {
|
|||
|
|
headers: {
|
|||
|
|
Authorization: `Bearer ${this.runTimeToken}`,
|
|||
|
|
'Content-Type': 'application/json'
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
core.info(JSON.stringify(data))
|
|||
|
|
if (data.value.length == 0) {
|
|||
|
|
throw new Error('No uploaded artifact was found!')
|
|||
|
|
}
|
|||
|
|
const artifactUrl = `${data.value[0].url}&%24expand=SignedContent`
|
|||
|
|
const payload = {
|
|||
|
|
artifact_url: artifactUrl,
|
|||
|
|
pages_build_version: this.buildVersion,
|
|||
|
|
oidc_token: idToken
|
|||
|
|
}
|
|||
|
|
core.info(`Creating deployment with payload:\n${JSON.stringify(payload, null, '\t')}`)
|
|||
|
|
const response = await axios.post(pagesDeployEndpoint, payload, {
|
|||
|
|
headers: {
|
|||
|
|
Accept: 'application/vnd.github.v3+json',
|
|||
|
|
Authorization: `Bearer ${this.githubToken}`,
|
|||
|
|
'Content-type': 'application/json'
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
this.requestedDeployment = true
|
|||
|
|
core.info(`Created deployment for ${this.buildVersion}`)
|
|||
|
|
core.info(JSON.stringify(response.data))
|
|||
|
|
} catch (error) {
|
|||
|
|
core.info(`Failed to create deployment for ${this.buildVersion}.`)
|
|||
|
|
core.setFailed(error)
|
|||
|
|
throw error
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Poll the deployment endpoint for status
|
|||
|
|
async check() {
|
|||
|
|
try {
|
|||
|
|
const statusUrl = `https://api.github.com/repos/${this.repositoryNwo}/pages/deployment/status/${process.env['GITHUB_SHA']}`
|
|||
|
|
const timeout = core.getInput('timeout')
|
|||
|
|
const reportingInterval = core.getInput('reporting_interval')
|
|||
|
|
const maxErrorCount = core.getInput('error_count')
|
|||
|
|
var startTime = Date.now()
|
|||
|
|
var errorCount = 0
|
|||
|
|
|
|||
|
|
/*eslint no-constant-condition: ["error", { "checkLoops": false }]*/
|
|||
|
|
while (true) {
|
|||
|
|
// Handle reporting interval
|
|||
|
|
if (reportingInterval > 0) {
|
|||
|
|
await new Promise(r => setTimeout(r, reportingInterval))
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Check status
|
|||
|
|
var res = await axios.get(statusUrl, {
|
|||
|
|
headers: {
|
|||
|
|
Authorization: `token ${this.githubToken}`
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
if (res.data.status == 'succeed') {
|
|||
|
|
core.info('Reported success!')
|
|||
|
|
core.setOutput('status', 'succeed')
|
|||
|
|
break
|
|||
|
|
} else if (res.data.status == 'deployment_failed') {
|
|||
|
|
// Fall into permanent error, it may be caused by ongoing incident or malicious deployment content or exhausted automatic retry times.
|
|||
|
|
core.info('Deployment failed, try again later.')
|
|||
|
|
core.setOutput('status', 'failed')
|
|||
|
|
break
|
|||
|
|
} else if (res.data.status == 'deployment_attempt_error') {
|
|||
|
|
// A temporary error happened, a retry will be scheduled automatically.
|
|||
|
|
core.info(
|
|||
|
|
'Deployment temporarily failed, a retry will be automatically scheduled...'
|
|||
|
|
)
|
|||
|
|
} else {
|
|||
|
|
core.info('Current status: ' + res.data.status)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (res.status != 200) {
|
|||
|
|
errorCount++
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (errorCount >= maxErrorCount) {
|
|||
|
|
core.info('Too many errors, aborting!')
|
|||
|
|
core.setFailed('Failed with status code: ' + res.status)
|
|||
|
|
break
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
// Handle timeout
|
|||
|
|
if (Date.now() - startTime >= timeout) {
|
|||
|
|
core.info('Timeout reached, aborting!')
|
|||
|
|
core.setFailed('Timeout reached, aborting!')
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
} catch (error) {
|
|||
|
|
core.setFailed(error)
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
module.exports = {Deployment}
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 2357:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
module.exports = require("assert");
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 8614:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
module.exports = require("events");
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 5747:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
module.exports = require("fs");
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 8605:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
module.exports = require("http");
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 7211:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
module.exports = require("https");
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 1631:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
module.exports = require("net");
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 2087:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
module.exports = require("os");
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 5622:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
module.exports = require("path");
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 2413:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
module.exports = require("stream");
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 4016:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
module.exports = require("tls");
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 3867:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
module.exports = require("tty");
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 8835:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
module.exports = require("url");
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 1669:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
module.exports = require("util");
|
|||
|
|
|
|||
|
|
/***/ }),
|
|||
|
|
|
|||
|
|
/***/ 8761:
|
|||
|
|
/***/ ((module) => {
|
|||
|
|
|
|||
|
|
"use strict";
|
|||
|
|
module.exports = require("zlib");
|
|||
|
|
|
|||
|
|
/***/ })
|
|||
|
|
|
|||
|
|
/******/ });
|
|||
|
|
/************************************************************************/
|
|||
|
|
/******/ // The module cache
|
|||
|
|
/******/ var __webpack_module_cache__ = {};
|
|||
|
|
/******/
|
|||
|
|
/******/ // The require function
|
|||
|
|
/******/ function __nccwpck_require__(moduleId) {
|
|||
|
|
/******/ // Check if module is in cache
|
|||
|
|
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|||
|
|
/******/ if (cachedModule !== undefined) {
|
|||
|
|
/******/ return cachedModule.exports;
|
|||
|
|
/******/ }
|
|||
|
|
/******/ // Create a new module (and put it into the cache)
|
|||
|
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|||
|
|
/******/ // no module.id needed
|
|||
|
|
/******/ // no module.loaded needed
|
|||
|
|
/******/ exports: {}
|
|||
|
|
/******/ };
|
|||
|
|
/******/
|
|||
|
|
/******/ // Execute the module function
|
|||
|
|
/******/ var threw = true;
|
|||
|
|
/******/ try {
|
|||
|
|
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__);
|
|||
|
|
/******/ threw = false;
|
|||
|
|
/******/ } finally {
|
|||
|
|
/******/ if(threw) delete __webpack_module_cache__[moduleId];
|
|||
|
|
/******/ }
|
|||
|
|
/******/
|
|||
|
|
/******/ // Return the exports of the module
|
|||
|
|
/******/ return module.exports;
|
|||
|
|
/******/ }
|
|||
|
|
/******/
|
|||
|
|
/************************************************************************/
|
|||
|
|
/******/ /* webpack/runtime/compat */
|
|||
|
|
/******/
|
|||
|
|
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
|
|||
|
|
/******/
|
|||
|
|
/************************************************************************/
|
|||
|
|
var __webpack_exports__ = {};
|
|||
|
|
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|||
|
|
(() => {
|
|||
|
|
__nccwpck_require__(4307)
|
|||
|
|
|
|||
|
|
// This package assumes a site has already been built and the files exist in the current workspace
|
|||
|
|
// If there's an artifact named `artifact.tar`, it can upload that to actions on its own,
|
|||
|
|
// without the user having to do the tar process themselves.
|
|||
|
|
|
|||
|
|
const core = __nccwpck_require__(2186)
|
|||
|
|
// const github = require('@actions/github'); // TODO: Not used until we publish API endpoint to the @action/github package
|
|||
|
|
const axios = __nccwpck_require__(6545)
|
|||
|
|
|
|||
|
|
const {Deployment} = __nccwpck_require__(2877)
|
|||
|
|
const deployment = new Deployment()
|
|||
|
|
|
|||
|
|
// TODO: If the artifact hasn't been created, we can create it and upload to artifact storage ourselves
|
|||
|
|
// const tar = require('tar')
|
|||
|
|
|
|||
|
|
async function cancelHandler(evtOrExitCodeOrError) {
|
|||
|
|
try {
|
|||
|
|
if (deployment.requestedDeployment) {
|
|||
|
|
const pagesCancelDeployEndpoint = `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployment/cancel/${process.env.GITHUB_SHA}`
|
|||
|
|
await axios.put(
|
|||
|
|
pagesCancelDeployEndpoint,
|
|||
|
|
{},
|
|||
|
|
{
|
|||
|
|
headers: {
|
|||
|
|
Accept: 'application/vnd.github.v3+json',
|
|||
|
|
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`,
|
|||
|
|
'Content-type': 'application/json'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
)
|
|||
|
|
core.info(`Deployment cancelled with ${pagesCancelDeployEndpoint}`)
|
|||
|
|
}
|
|||
|
|
} catch (e) {
|
|||
|
|
console.info('Deployment cancellation failed', e)
|
|||
|
|
}
|
|||
|
|
process.exit(isNaN(+evtOrExitCodeOrError) ? 1 : +evtOrExitCodeOrError)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
async function main() {
|
|||
|
|
try {
|
|||
|
|
const idToken = await core.getIDToken()
|
|||
|
|
await deployment.create(idToken)
|
|||
|
|
await deployment.check()
|
|||
|
|
} catch (error) {
|
|||
|
|
core.setFailed(error)
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Register signal handlers for workflow cancellation
|
|||
|
|
process.on('SIGINT', cancelHandler)
|
|||
|
|
process.on('SIGTERM', cancelHandler)
|
|||
|
|
|
|||
|
|
// Main
|
|||
|
|
main()
|
|||
|
|
|
|||
|
|
})();
|
|||
|
|
|
|||
|
|
module.exports = __webpack_exports__;
|
|||
|
|
/******/ })()
|
|||
|
|
;
|
|||
|
|
//# sourceMappingURL=index.js.map
|