[READ-ONLY] Mirror of https://github.com/probablykasper/readme-template-action. Integrate GitHub API data in your README.md
0

Configure Feed

Select the types of activity you want to include in your feed.

Convert to typescript

Kasper (Apr 6, 2021, 10:34 PM +0200) c7ec8e61 d2cedbf9

+4667 -5492
-29
.eslintrc.js
··· 1 - module.exports = { 2 - 'env': { 3 - 'es2020': true, 4 - 'node': true, 5 - 'browser': true 6 - }, 7 - 'extends': 'eslint:recommended', 8 - 'parserOptions': { 9 - 'ecmaVersion': 11 10 - }, 11 - 'rules': { 12 - 'indent': [ 13 - 'error', 14 - 2 15 - ], 16 - 'linebreak-style': [ 17 - 'error', 18 - 'unix' 19 - ], 20 - 'quotes': [ 21 - 'error', 22 - 'single' 23 - ], 24 - 'semi': [ 25 - 'error', 26 - 'never' 27 - ] 28 - } 29 - }
+2 -2
EXAMPLE_OUTPUT.md
··· 37 37 - **SIGNUP_DATE2**: 2015-03-04 38 38 - **SIGNUP_YEAR**: 2015 39 39 - **SIGNUP_AGO**: 6 years ago 40 - - **TOTAL_REPOS_SIZE_KB**: 1347086 40 + - **TOTAL_REPOS_SIZE_KB**: 1347089 41 41 - **TOTAL_REPOS_SIZE_MB**: 1347.1 42 42 - **TOTAL_REPOS_SIZE_GB**: 1.35 43 43 - **TOTAL_REPOSITORIES**: 64 ··· 62 62 63 63 | ⭐️Stars | 📦Repo | 📚Description | 64 64 | --------- | ----------- | -------------- | 65 + | 2 | [probablykasper/readme-template-action](https://github.com/probablykasper/readme-template-action) | Generate README.md from TEMPLATE.md with GitHub API data. Supports loops and custom queries | 65 66 | 0 | [probablykasper/v4.kasper.space](https://github.com/probablykasper/v4.kasper.space) | Personal website | 66 67 | 3 | [probablykasper/redlux](https://github.com/probablykasper/redlux) | AAC decoder for MPEG-4 and AAC files, with rodio support | 67 - | 0 | [probablykasper/probablykasper](https://github.com/probablykasper/probablykasper) | null |
+1 -1
action.yml
··· 14 14 required: true 15 15 default: README.md 16 16 runs: 17 - using: node12 17 + using: node14 18 18 main: dist/index.js 19 19 branding: 20 20 icon: book-open
+4596 -4557
dist/index.js
··· 1 1 module.exports = 2 - /******/ (function(modules, runtime) { // webpackBootstrap 3 - /******/ "use strict"; 4 - /******/ // The module cache 5 - /******/ var installedModules = {}; 6 - /******/ 7 - /******/ // The require function 8 - /******/ function __webpack_require__(moduleId) { 9 - /******/ 10 - /******/ // Check if module is in cache 11 - /******/ if(installedModules[moduleId]) { 12 - /******/ return installedModules[moduleId].exports; 13 - /******/ } 14 - /******/ // Create a new module (and put it into the cache) 15 - /******/ var module = installedModules[moduleId] = { 16 - /******/ i: moduleId, 17 - /******/ l: false, 18 - /******/ exports: {} 19 - /******/ }; 20 - /******/ 21 - /******/ // Execute the module function 22 - /******/ var threw = true; 23 - /******/ try { 24 - /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 25 - /******/ threw = false; 26 - /******/ } finally { 27 - /******/ if(threw) delete installedModules[moduleId]; 28 - /******/ } 29 - /******/ 30 - /******/ // Flag the module as loaded 31 - /******/ module.l = true; 32 - /******/ 33 - /******/ // Return the exports of the module 34 - /******/ return module.exports; 35 - /******/ } 36 - /******/ 37 - /******/ 38 - /******/ __webpack_require__.ab = __dirname + "/"; 39 - /******/ 40 - /******/ // the startup function 41 - /******/ function startup() { 42 - /******/ // Load entry module and return exports 43 - /******/ return __webpack_require__(713); 44 - /******/ }; 45 - /******/ // initialize runtime 46 - /******/ runtime(__webpack_require__); 47 - /******/ 48 - /******/ // run startup 49 - /******/ return startup(); 50 - /******/ }) 51 - /************************************************************************/ 52 - /******/ ({ 2 + /******/ (() => { // webpackBootstrap 3 + /******/ var __webpack_modules__ = ({ 4 + 5 + /***/ 351: 6 + /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 7 + 8 + "use strict"; 9 + 10 + var __importStar = (this && this.__importStar) || function (mod) { 11 + if (mod && mod.__esModule) return mod; 12 + var result = {}; 13 + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 14 + result["default"] = mod; 15 + return result; 16 + }; 17 + Object.defineProperty(exports, "__esModule", ({ value: true })); 18 + const os = __importStar(__nccwpck_require__(87)); 19 + const utils_1 = __nccwpck_require__(278); 20 + /** 21 + * Commands 22 + * 23 + * Command Format: 24 + * ::name key=value,key=value::message 25 + * 26 + * Examples: 27 + * ::warning::This is the message 28 + * ::set-env name=MY_VAR::some value 29 + */ 30 + function issueCommand(command, properties, message) { 31 + const cmd = new Command(command, properties, message); 32 + process.stdout.write(cmd.toString() + os.EOL); 33 + } 34 + exports.issueCommand = issueCommand; 35 + function issue(name, message = '') { 36 + issueCommand(name, {}, message); 37 + } 38 + exports.issue = issue; 39 + const CMD_STRING = '::'; 40 + class Command { 41 + constructor(command, properties, message) { 42 + if (!command) { 43 + command = 'missing.command'; 44 + } 45 + this.command = command; 46 + this.properties = properties; 47 + this.message = message; 48 + } 49 + toString() { 50 + let cmdStr = CMD_STRING + this.command; 51 + if (this.properties && Object.keys(this.properties).length > 0) { 52 + cmdStr += ' '; 53 + let first = true; 54 + for (const key in this.properties) { 55 + if (this.properties.hasOwnProperty(key)) { 56 + const val = this.properties[key]; 57 + if (val) { 58 + if (first) { 59 + first = false; 60 + } 61 + else { 62 + cmdStr += ','; 63 + } 64 + cmdStr += `${key}=${escapeProperty(val)}`; 65 + } 66 + } 67 + } 68 + } 69 + cmdStr += `${CMD_STRING}${escapeData(this.message)}`; 70 + return cmdStr; 71 + } 72 + } 73 + function escapeData(s) { 74 + return utils_1.toCommandValue(s) 75 + .replace(/%/g, '%25') 76 + .replace(/\r/g, '%0D') 77 + .replace(/\n/g, '%0A'); 78 + } 79 + function escapeProperty(s) { 80 + return utils_1.toCommandValue(s) 81 + .replace(/%/g, '%25') 82 + .replace(/\r/g, '%0D') 83 + .replace(/\n/g, '%0A') 84 + .replace(/:/g, '%3A') 85 + .replace(/,/g, '%2C'); 86 + } 87 + //# sourceMappingURL=command.js.map 88 + 89 + /***/ }), 90 + 91 + /***/ 186: 92 + /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 93 + 94 + "use strict"; 95 + 96 + var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 97 + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 98 + return new (P || (P = Promise))(function (resolve, reject) { 99 + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 100 + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 101 + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 102 + step((generator = generator.apply(thisArg, _arguments || [])).next()); 103 + }); 104 + }; 105 + var __importStar = (this && this.__importStar) || function (mod) { 106 + if (mod && mod.__esModule) return mod; 107 + var result = {}; 108 + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 109 + result["default"] = mod; 110 + return result; 111 + }; 112 + Object.defineProperty(exports, "__esModule", ({ value: true })); 113 + const command_1 = __nccwpck_require__(351); 114 + const file_command_1 = __nccwpck_require__(717); 115 + const utils_1 = __nccwpck_require__(278); 116 + const os = __importStar(__nccwpck_require__(87)); 117 + const path = __importStar(__nccwpck_require__(622)); 118 + /** 119 + * The code to exit an action 120 + */ 121 + var ExitCode; 122 + (function (ExitCode) { 123 + /** 124 + * A code indicating that the action was successful 125 + */ 126 + ExitCode[ExitCode["Success"] = 0] = "Success"; 127 + /** 128 + * A code indicating that the action was a failure 129 + */ 130 + ExitCode[ExitCode["Failure"] = 1] = "Failure"; 131 + })(ExitCode = exports.ExitCode || (exports.ExitCode = {})); 132 + //----------------------------------------------------------------------- 133 + // Variables 134 + //----------------------------------------------------------------------- 135 + /** 136 + * Sets env variable for this action and future actions in the job 137 + * @param name the name of the variable to set 138 + * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify 139 + */ 140 + // eslint-disable-next-line @typescript-eslint/no-explicit-any 141 + function exportVariable(name, val) { 142 + const convertedVal = utils_1.toCommandValue(val); 143 + process.env[name] = convertedVal; 144 + const filePath = process.env['GITHUB_ENV'] || ''; 145 + if (filePath) { 146 + const delimiter = '_GitHubActionsFileCommandDelimeter_'; 147 + const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; 148 + file_command_1.issueCommand('ENV', commandValue); 149 + } 150 + else { 151 + command_1.issueCommand('set-env', { name }, convertedVal); 152 + } 153 + } 154 + exports.exportVariable = exportVariable; 155 + /** 156 + * Registers a secret which will get masked from logs 157 + * @param secret value of the secret 158 + */ 159 + function setSecret(secret) { 160 + command_1.issueCommand('add-mask', {}, secret); 161 + } 162 + exports.setSecret = setSecret; 163 + /** 164 + * Prepends inputPath to the PATH (for this action and future actions) 165 + * @param inputPath 166 + */ 167 + function addPath(inputPath) { 168 + const filePath = process.env['GITHUB_PATH'] || ''; 169 + if (filePath) { 170 + file_command_1.issueCommand('PATH', inputPath); 171 + } 172 + else { 173 + command_1.issueCommand('add-path', {}, inputPath); 174 + } 175 + process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; 176 + } 177 + exports.addPath = addPath; 178 + /** 179 + * Gets the value of an input. The value is also trimmed. 180 + * 181 + * @param name name of the input to get 182 + * @param options optional. See InputOptions. 183 + * @returns string 184 + */ 185 + function getInput(name, options) { 186 + const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; 187 + if (options && options.required && !val) { 188 + throw new Error(`Input required and not supplied: ${name}`); 189 + } 190 + return val.trim(); 191 + } 192 + exports.getInput = getInput; 193 + /** 194 + * Sets the value of an output. 195 + * 196 + * @param name name of the output to set 197 + * @param value value to store. Non-string values will be converted to a string via JSON.stringify 198 + */ 199 + // eslint-disable-next-line @typescript-eslint/no-explicit-any 200 + function setOutput(name, value) { 201 + command_1.issueCommand('set-output', { name }, value); 202 + } 203 + exports.setOutput = setOutput; 204 + /** 205 + * Enables or disables the echoing of commands into stdout for the rest of the step. 206 + * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. 207 + * 208 + */ 209 + function setCommandEcho(enabled) { 210 + command_1.issue('echo', enabled ? 'on' : 'off'); 211 + } 212 + exports.setCommandEcho = setCommandEcho; 213 + //----------------------------------------------------------------------- 214 + // Results 215 + //----------------------------------------------------------------------- 216 + /** 217 + * Sets the action status to failed. 218 + * When the action exits it will be with an exit code of 1 219 + * @param message add error issue message 220 + */ 221 + function setFailed(message) { 222 + process.exitCode = ExitCode.Failure; 223 + error(message); 224 + } 225 + exports.setFailed = setFailed; 226 + //----------------------------------------------------------------------- 227 + // Logging Commands 228 + //----------------------------------------------------------------------- 229 + /** 230 + * Gets whether Actions Step Debug is on or not 231 + */ 232 + function isDebug() { 233 + return process.env['RUNNER_DEBUG'] === '1'; 234 + } 235 + exports.isDebug = isDebug; 236 + /** 237 + * Writes debug message to user log 238 + * @param message debug message 239 + */ 240 + function debug(message) { 241 + command_1.issueCommand('debug', {}, message); 242 + } 243 + exports.debug = debug; 244 + /** 245 + * Adds an error issue 246 + * @param message error issue message. Errors will be converted to string via toString() 247 + */ 248 + function error(message) { 249 + command_1.issue('error', message instanceof Error ? message.toString() : message); 250 + } 251 + exports.error = error; 252 + /** 253 + * Adds an warning issue 254 + * @param message warning issue message. Errors will be converted to string via toString() 255 + */ 256 + function warning(message) { 257 + command_1.issue('warning', message instanceof Error ? message.toString() : message); 258 + } 259 + exports.warning = warning; 260 + /** 261 + * Writes info to log with console.log. 262 + * @param message info message 263 + */ 264 + function info(message) { 265 + process.stdout.write(message + os.EOL); 266 + } 267 + exports.info = info; 268 + /** 269 + * Begin an output group. 270 + * 271 + * Output until the next `groupEnd` will be foldable in this group 272 + * 273 + * @param name The name of the output group 274 + */ 275 + function startGroup(name) { 276 + command_1.issue('group', name); 277 + } 278 + exports.startGroup = startGroup; 279 + /** 280 + * End an output group. 281 + */ 282 + function endGroup() { 283 + command_1.issue('endgroup'); 284 + } 285 + exports.endGroup = endGroup; 286 + /** 287 + * Wrap an asynchronous function call in a group. 288 + * 289 + * Returns the same type as the function itself. 290 + * 291 + * @param name The name of the group 292 + * @param fn The function to wrap in the group 293 + */ 294 + function group(name, fn) { 295 + return __awaiter(this, void 0, void 0, function* () { 296 + startGroup(name); 297 + let result; 298 + try { 299 + result = yield fn(); 300 + } 301 + finally { 302 + endGroup(); 303 + } 304 + return result; 305 + }); 306 + } 307 + exports.group = group; 308 + //----------------------------------------------------------------------- 309 + // Wrapper action state 310 + //----------------------------------------------------------------------- 311 + /** 312 + * Saves state for current action, the state can only be retrieved by this action's post job execution. 313 + * 314 + * @param name name of the state to store 315 + * @param value value to store. Non-string values will be converted to a string via JSON.stringify 316 + */ 317 + // eslint-disable-next-line @typescript-eslint/no-explicit-any 318 + function saveState(name, value) { 319 + command_1.issueCommand('save-state', { name }, value); 320 + } 321 + exports.saveState = saveState; 322 + /** 323 + * Gets the value of an state set by this action's main execution. 324 + * 325 + * @param name name of the state to get 326 + * @returns string 327 + */ 328 + function getState(name) { 329 + return process.env[`STATE_${name}`] || ''; 330 + } 331 + exports.getState = getState; 332 + //# sourceMappingURL=core.js.map 333 + 334 + /***/ }), 335 + 336 + /***/ 717: 337 + /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 338 + 339 + "use strict"; 340 + 341 + // For internal use, subject to change. 342 + var __importStar = (this && this.__importStar) || function (mod) { 343 + if (mod && mod.__esModule) return mod; 344 + var result = {}; 345 + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 346 + result["default"] = mod; 347 + return result; 348 + }; 349 + Object.defineProperty(exports, "__esModule", ({ value: true })); 350 + // We use any as a valid input type 351 + /* eslint-disable @typescript-eslint/no-explicit-any */ 352 + const fs = __importStar(__nccwpck_require__(747)); 353 + const os = __importStar(__nccwpck_require__(87)); 354 + const utils_1 = __nccwpck_require__(278); 355 + function issueCommand(command, message) { 356 + const filePath = process.env[`GITHUB_${command}`]; 357 + if (!filePath) { 358 + throw new Error(`Unable to find environment variable for file command ${command}`); 359 + } 360 + if (!fs.existsSync(filePath)) { 361 + throw new Error(`Missing file at path: ${filePath}`); 362 + } 363 + fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { 364 + encoding: 'utf8' 365 + }); 366 + } 367 + exports.issueCommand = issueCommand; 368 + //# sourceMappingURL=file-command.js.map 369 + 370 + /***/ }), 371 + 372 + /***/ 278: 373 + /***/ ((__unused_webpack_module, exports) => { 53 374 54 - /***/ 16: 55 - /***/ (function(module) { 375 + "use strict"; 56 376 57 - module.exports = require("tls"); 377 + // We use any as a valid input type 378 + /* eslint-disable @typescript-eslint/no-explicit-any */ 379 + Object.defineProperty(exports, "__esModule", ({ value: true })); 380 + /** 381 + * Sanitizes an input into a string so it can be passed into issueCommand safely 382 + * @param input input to sanitize into a string 383 + */ 384 + function toCommandValue(input) { 385 + if (input === null || input === undefined) { 386 + return ''; 387 + } 388 + else if (typeof input === 'string' || input instanceof String) { 389 + return input; 390 + } 391 + return JSON.stringify(input); 392 + } 393 + exports.toCommandValue = toCommandValue; 394 + //# sourceMappingURL=utils.js.map 395 + 396 + /***/ }), 397 + 398 + /***/ 53: 399 + /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 400 + 401 + "use strict"; 402 + 403 + Object.defineProperty(exports, "__esModule", ({ value: true })); 404 + exports.Context = void 0; 405 + const fs_1 = __nccwpck_require__(747); 406 + const os_1 = __nccwpck_require__(87); 407 + class Context { 408 + /** 409 + * Hydrate the context from the environment 410 + */ 411 + constructor() { 412 + this.payload = {}; 413 + if (process.env.GITHUB_EVENT_PATH) { 414 + if (fs_1.existsSync(process.env.GITHUB_EVENT_PATH)) { 415 + this.payload = JSON.parse(fs_1.readFileSync(process.env.GITHUB_EVENT_PATH, { encoding: 'utf8' })); 416 + } 417 + else { 418 + const path = process.env.GITHUB_EVENT_PATH; 419 + process.stdout.write(`GITHUB_EVENT_PATH ${path} does not exist${os_1.EOL}`); 420 + } 421 + } 422 + this.eventName = process.env.GITHUB_EVENT_NAME; 423 + this.sha = process.env.GITHUB_SHA; 424 + this.ref = process.env.GITHUB_REF; 425 + this.workflow = process.env.GITHUB_WORKFLOW; 426 + this.action = process.env.GITHUB_ACTION; 427 + this.actor = process.env.GITHUB_ACTOR; 428 + this.job = process.env.GITHUB_JOB; 429 + this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10); 430 + this.runId = parseInt(process.env.GITHUB_RUN_ID, 10); 431 + } 432 + get issue() { 433 + const payload = this.payload; 434 + return Object.assign(Object.assign({}, this.repo), { number: (payload.issue || payload.pull_request || payload).number }); 435 + } 436 + get repo() { 437 + if (process.env.GITHUB_REPOSITORY) { 438 + const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/'); 439 + return { owner, repo }; 440 + } 441 + if (this.payload.repository) { 442 + return { 443 + owner: this.payload.repository.owner.login, 444 + repo: this.payload.repository.name 445 + }; 446 + } 447 + throw new Error("context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'"); 448 + } 449 + } 450 + exports.Context = Context; 451 + //# sourceMappingURL=context.js.map 452 + 453 + /***/ }), 454 + 455 + /***/ 438: 456 + /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 457 + 458 + "use strict"; 459 + 460 + var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 461 + if (k2 === undefined) k2 = k; 462 + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 463 + }) : (function(o, m, k, k2) { 464 + if (k2 === undefined) k2 = k; 465 + o[k2] = m[k]; 466 + })); 467 + var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 468 + Object.defineProperty(o, "default", { enumerable: true, value: v }); 469 + }) : function(o, v) { 470 + o["default"] = v; 471 + }); 472 + var __importStar = (this && this.__importStar) || function (mod) { 473 + if (mod && mod.__esModule) return mod; 474 + var result = {}; 475 + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 476 + __setModuleDefault(result, mod); 477 + return result; 478 + }; 479 + Object.defineProperty(exports, "__esModule", ({ value: true })); 480 + exports.getOctokit = exports.context = void 0; 481 + const Context = __importStar(__nccwpck_require__(53)); 482 + const utils_1 = __nccwpck_require__(30); 483 + exports.context = new Context.Context(); 484 + /** 485 + * Returns a hydrated octokit ready to use for GitHub Actions 486 + * 487 + * @param token the repo PAT or GITHUB_TOKEN 488 + * @param options other options to set 489 + */ 490 + function getOctokit(token, options) { 491 + return new utils_1.GitHub(utils_1.getOctokitOptions(token, options)); 492 + } 493 + exports.getOctokit = getOctokit; 494 + //# sourceMappingURL=github.js.map 495 + 496 + /***/ }), 497 + 498 + /***/ 914: 499 + /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 500 + 501 + "use strict"; 502 + 503 + var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 504 + if (k2 === undefined) k2 = k; 505 + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 506 + }) : (function(o, m, k, k2) { 507 + if (k2 === undefined) k2 = k; 508 + o[k2] = m[k]; 509 + })); 510 + var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 511 + Object.defineProperty(o, "default", { enumerable: true, value: v }); 512 + }) : function(o, v) { 513 + o["default"] = v; 514 + }); 515 + var __importStar = (this && this.__importStar) || function (mod) { 516 + if (mod && mod.__esModule) return mod; 517 + var result = {}; 518 + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 519 + __setModuleDefault(result, mod); 520 + return result; 521 + }; 522 + Object.defineProperty(exports, "__esModule", ({ value: true })); 523 + exports.getApiBaseUrl = exports.getProxyAgent = exports.getAuthString = void 0; 524 + const httpClient = __importStar(__nccwpck_require__(925)); 525 + function getAuthString(token, options) { 526 + if (!token && !options.auth) { 527 + throw new Error('Parameter token or opts.auth is required'); 528 + } 529 + else if (token && options.auth) { 530 + throw new Error('Parameters token and opts.auth may not both be specified'); 531 + } 532 + return typeof options.auth === 'string' ? options.auth : `token ${token}`; 533 + } 534 + exports.getAuthString = getAuthString; 535 + function getProxyAgent(destinationUrl) { 536 + const hc = new httpClient.HttpClient(); 537 + return hc.getAgent(destinationUrl); 538 + } 539 + exports.getProxyAgent = getProxyAgent; 540 + function getApiBaseUrl() { 541 + return process.env['GITHUB_API_URL'] || 'https://api.github.com'; 542 + } 543 + exports.getApiBaseUrl = getApiBaseUrl; 544 + //# sourceMappingURL=utils.js.map 58 545 59 546 /***/ }), 60 547 61 548 /***/ 30: 62 - /***/ (function(__unusedmodule, exports, __webpack_require__) { 549 + /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { 63 550 64 551 "use strict"; 65 552 ··· 82 569 __setModuleDefault(result, mod); 83 570 return result; 84 571 }; 85 - Object.defineProperty(exports, "__esModule", { value: true }); 572 + Object.defineProperty(exports, "__esModule", ({ value: true })); 86 573 exports.getOctokitOptions = exports.GitHub = exports.context = void 0; 87 - const Context = __importStar(__webpack_require__(53)); 88 - const Utils = __importStar(__webpack_require__(914)); 574 + const Context = __importStar(__nccwpck_require__(53)); 575 + const Utils = __importStar(__nccwpck_require__(914)); 89 576 // octokit + plugins 90 - const core_1 = __webpack_require__(762); 91 - const plugin_rest_endpoint_methods_1 = __webpack_require__(44); 92 - const plugin_paginate_rest_1 = __webpack_require__(193); 577 + const core_1 = __nccwpck_require__(762); 578 + const plugin_rest_endpoint_methods_1 = __nccwpck_require__(44); 579 + const plugin_paginate_rest_1 = __nccwpck_require__(193); 93 580 exports.context = new Context.Context(); 94 581 const baseUrl = Utils.getApiBaseUrl(); 95 582 const defaults = { ··· 119 606 120 607 /***/ }), 121 608 609 + /***/ 925: 610 + /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 611 + 612 + "use strict"; 613 + 614 + Object.defineProperty(exports, "__esModule", ({ value: true })); 615 + const url = __nccwpck_require__(835); 616 + const http = __nccwpck_require__(605); 617 + const https = __nccwpck_require__(211); 618 + const pm = __nccwpck_require__(443); 619 + let tunnel; 620 + var HttpCodes; 621 + (function (HttpCodes) { 622 + HttpCodes[HttpCodes["OK"] = 200] = "OK"; 623 + HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; 624 + HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; 625 + HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; 626 + HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; 627 + HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; 628 + HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; 629 + HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; 630 + HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; 631 + HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; 632 + HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; 633 + HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; 634 + HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; 635 + HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; 636 + HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; 637 + HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; 638 + HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; 639 + HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; 640 + HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; 641 + HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; 642 + HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; 643 + HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; 644 + HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; 645 + HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; 646 + HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; 647 + HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; 648 + HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; 649 + })(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); 650 + var Headers; 651 + (function (Headers) { 652 + Headers["Accept"] = "accept"; 653 + Headers["ContentType"] = "content-type"; 654 + })(Headers = exports.Headers || (exports.Headers = {})); 655 + var MediaTypes; 656 + (function (MediaTypes) { 657 + MediaTypes["ApplicationJson"] = "application/json"; 658 + })(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); 659 + /** 660 + * Returns the proxy URL, depending upon the supplied url and proxy environment variables. 661 + * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com 662 + */ 663 + function getProxyUrl(serverUrl) { 664 + let proxyUrl = pm.getProxyUrl(url.parse(serverUrl)); 665 + return proxyUrl ? proxyUrl.href : ''; 666 + } 667 + exports.getProxyUrl = getProxyUrl; 668 + const HttpRedirectCodes = [ 669 + HttpCodes.MovedPermanently, 670 + HttpCodes.ResourceMoved, 671 + HttpCodes.SeeOther, 672 + HttpCodes.TemporaryRedirect, 673 + HttpCodes.PermanentRedirect 674 + ]; 675 + const HttpResponseRetryCodes = [ 676 + HttpCodes.BadGateway, 677 + HttpCodes.ServiceUnavailable, 678 + HttpCodes.GatewayTimeout 679 + ]; 680 + const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; 681 + const ExponentialBackoffCeiling = 10; 682 + const ExponentialBackoffTimeSlice = 5; 683 + class HttpClientResponse { 684 + constructor(message) { 685 + this.message = message; 686 + } 687 + readBody() { 688 + return new Promise(async (resolve, reject) => { 689 + let output = Buffer.alloc(0); 690 + this.message.on('data', (chunk) => { 691 + output = Buffer.concat([output, chunk]); 692 + }); 693 + this.message.on('end', () => { 694 + resolve(output.toString()); 695 + }); 696 + }); 697 + } 698 + } 699 + exports.HttpClientResponse = HttpClientResponse; 700 + function isHttps(requestUrl) { 701 + let parsedUrl = url.parse(requestUrl); 702 + return parsedUrl.protocol === 'https:'; 703 + } 704 + exports.isHttps = isHttps; 705 + class HttpClient { 706 + constructor(userAgent, handlers, requestOptions) { 707 + this._ignoreSslError = false; 708 + this._allowRedirects = true; 709 + this._allowRedirectDowngrade = false; 710 + this._maxRedirects = 50; 711 + this._allowRetries = false; 712 + this._maxRetries = 1; 713 + this._keepAlive = false; 714 + this._disposed = false; 715 + this.userAgent = userAgent; 716 + this.handlers = handlers || []; 717 + this.requestOptions = requestOptions; 718 + if (requestOptions) { 719 + if (requestOptions.ignoreSslError != null) { 720 + this._ignoreSslError = requestOptions.ignoreSslError; 721 + } 722 + this._socketTimeout = requestOptions.socketTimeout; 723 + if (requestOptions.allowRedirects != null) { 724 + this._allowRedirects = requestOptions.allowRedirects; 725 + } 726 + if (requestOptions.allowRedirectDowngrade != null) { 727 + this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; 728 + } 729 + if (requestOptions.maxRedirects != null) { 730 + this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); 731 + } 732 + if (requestOptions.keepAlive != null) { 733 + this._keepAlive = requestOptions.keepAlive; 734 + } 735 + if (requestOptions.allowRetries != null) { 736 + this._allowRetries = requestOptions.allowRetries; 737 + } 738 + if (requestOptions.maxRetries != null) { 739 + this._maxRetries = requestOptions.maxRetries; 740 + } 741 + } 742 + } 743 + options(requestUrl, additionalHeaders) { 744 + return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); 745 + } 746 + get(requestUrl, additionalHeaders) { 747 + return this.request('GET', requestUrl, null, additionalHeaders || {}); 748 + } 749 + del(requestUrl, additionalHeaders) { 750 + return this.request('DELETE', requestUrl, null, additionalHeaders || {}); 751 + } 752 + post(requestUrl, data, additionalHeaders) { 753 + return this.request('POST', requestUrl, data, additionalHeaders || {}); 754 + } 755 + patch(requestUrl, data, additionalHeaders) { 756 + return this.request('PATCH', requestUrl, data, additionalHeaders || {}); 757 + } 758 + put(requestUrl, data, additionalHeaders) { 759 + return this.request('PUT', requestUrl, data, additionalHeaders || {}); 760 + } 761 + head(requestUrl, additionalHeaders) { 762 + return this.request('HEAD', requestUrl, null, additionalHeaders || {}); 763 + } 764 + sendStream(verb, requestUrl, stream, additionalHeaders) { 765 + return this.request(verb, requestUrl, stream, additionalHeaders); 766 + } 767 + /** 768 + * Gets a typed object from an endpoint 769 + * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise 770 + */ 771 + async getJson(requestUrl, additionalHeaders = {}) { 772 + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 773 + let res = await this.get(requestUrl, additionalHeaders); 774 + return this._processResponse(res, this.requestOptions); 775 + } 776 + async postJson(requestUrl, obj, additionalHeaders = {}) { 777 + let data = JSON.stringify(obj, null, 2); 778 + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 779 + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 780 + let res = await this.post(requestUrl, data, additionalHeaders); 781 + return this._processResponse(res, this.requestOptions); 782 + } 783 + async putJson(requestUrl, obj, additionalHeaders = {}) { 784 + let data = JSON.stringify(obj, null, 2); 785 + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 786 + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 787 + let res = await this.put(requestUrl, data, additionalHeaders); 788 + return this._processResponse(res, this.requestOptions); 789 + } 790 + async patchJson(requestUrl, obj, additionalHeaders = {}) { 791 + let data = JSON.stringify(obj, null, 2); 792 + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 793 + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 794 + let res = await this.patch(requestUrl, data, additionalHeaders); 795 + return this._processResponse(res, this.requestOptions); 796 + } 797 + /** 798 + * Makes a raw http request. 799 + * All other methods such as get, post, patch, and request ultimately call this. 800 + * Prefer get, del, post and patch 801 + */ 802 + async request(verb, requestUrl, data, headers) { 803 + if (this._disposed) { 804 + throw new Error('Client has already been disposed.'); 805 + } 806 + let parsedUrl = url.parse(requestUrl); 807 + let info = this._prepareRequest(verb, parsedUrl, headers); 808 + // Only perform retries on reads since writes may not be idempotent. 809 + let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1 810 + ? this._maxRetries + 1 811 + : 1; 812 + let numTries = 0; 813 + let response; 814 + while (numTries < maxTries) { 815 + response = await this.requestRaw(info, data); 816 + // Check if it's an authentication challenge 817 + if (response && 818 + response.message && 819 + response.message.statusCode === HttpCodes.Unauthorized) { 820 + let authenticationHandler; 821 + for (let i = 0; i < this.handlers.length; i++) { 822 + if (this.handlers[i].canHandleAuthentication(response)) { 823 + authenticationHandler = this.handlers[i]; 824 + break; 825 + } 826 + } 827 + if (authenticationHandler) { 828 + return authenticationHandler.handleAuthentication(this, info, data); 829 + } 830 + else { 831 + // We have received an unauthorized response but have no handlers to handle it. 832 + // Let the response return to the caller. 833 + return response; 834 + } 835 + } 836 + let redirectsRemaining = this._maxRedirects; 837 + while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 && 838 + this._allowRedirects && 839 + redirectsRemaining > 0) { 840 + const redirectUrl = response.message.headers['location']; 841 + if (!redirectUrl) { 842 + // if there's no location to redirect to, we won't 843 + break; 844 + } 845 + let parsedRedirectUrl = url.parse(redirectUrl); 846 + if (parsedUrl.protocol == 'https:' && 847 + parsedUrl.protocol != parsedRedirectUrl.protocol && 848 + !this._allowRedirectDowngrade) { 849 + 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.'); 850 + } 851 + // we need to finish reading the response before reassigning response 852 + // which will leak the open socket. 853 + await response.readBody(); 854 + // strip authorization header if redirected to a different hostname 855 + if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { 856 + for (let header in headers) { 857 + // header names are case insensitive 858 + if (header.toLowerCase() === 'authorization') { 859 + delete headers[header]; 860 + } 861 + } 862 + } 863 + // let's make the request with the new redirectUrl 864 + info = this._prepareRequest(verb, parsedRedirectUrl, headers); 865 + response = await this.requestRaw(info, data); 866 + redirectsRemaining--; 867 + } 868 + if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) { 869 + // If not a retry code, return immediately instead of retrying 870 + return response; 871 + } 872 + numTries += 1; 873 + if (numTries < maxTries) { 874 + await response.readBody(); 875 + await this._performExponentialBackoff(numTries); 876 + } 877 + } 878 + return response; 879 + } 880 + /** 881 + * Needs to be called if keepAlive is set to true in request options. 882 + */ 883 + dispose() { 884 + if (this._agent) { 885 + this._agent.destroy(); 886 + } 887 + this._disposed = true; 888 + } 889 + /** 890 + * Raw request. 891 + * @param info 892 + * @param data 893 + */ 894 + requestRaw(info, data) { 895 + return new Promise((resolve, reject) => { 896 + let callbackForResult = function (err, res) { 897 + if (err) { 898 + reject(err); 899 + } 900 + resolve(res); 901 + }; 902 + this.requestRawWithCallback(info, data, callbackForResult); 903 + }); 904 + } 905 + /** 906 + * Raw request with callback. 907 + * @param info 908 + * @param data 909 + * @param onResult 910 + */ 911 + requestRawWithCallback(info, data, onResult) { 912 + let socket; 913 + if (typeof data === 'string') { 914 + info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); 915 + } 916 + let callbackCalled = false; 917 + let handleResult = (err, res) => { 918 + if (!callbackCalled) { 919 + callbackCalled = true; 920 + onResult(err, res); 921 + } 922 + }; 923 + let req = info.httpModule.request(info.options, (msg) => { 924 + let res = new HttpClientResponse(msg); 925 + handleResult(null, res); 926 + }); 927 + req.on('socket', sock => { 928 + socket = sock; 929 + }); 930 + // If we ever get disconnected, we want the socket to timeout eventually 931 + req.setTimeout(this._socketTimeout || 3 * 60000, () => { 932 + if (socket) { 933 + socket.end(); 934 + } 935 + handleResult(new Error('Request timeout: ' + info.options.path), null); 936 + }); 937 + req.on('error', function (err) { 938 + // err has statusCode property 939 + // res should have headers 940 + handleResult(err, null); 941 + }); 942 + if (data && typeof data === 'string') { 943 + req.write(data, 'utf8'); 944 + } 945 + if (data && typeof data !== 'string') { 946 + data.on('close', function () { 947 + req.end(); 948 + }); 949 + data.pipe(req); 950 + } 951 + else { 952 + req.end(); 953 + } 954 + } 955 + /** 956 + * Gets an http agent. This function is useful when you need an http agent that handles 957 + * routing through a proxy server - depending upon the url and proxy environment variables. 958 + * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com 959 + */ 960 + getAgent(serverUrl) { 961 + let parsedUrl = url.parse(serverUrl); 962 + return this._getAgent(parsedUrl); 963 + } 964 + _prepareRequest(method, requestUrl, headers) { 965 + const info = {}; 966 + info.parsedUrl = requestUrl; 967 + const usingSsl = info.parsedUrl.protocol === 'https:'; 968 + info.httpModule = usingSsl ? https : http; 969 + const defaultPort = usingSsl ? 443 : 80; 970 + info.options = {}; 971 + info.options.host = info.parsedUrl.hostname; 972 + info.options.port = info.parsedUrl.port 973 + ? parseInt(info.parsedUrl.port) 974 + : defaultPort; 975 + info.options.path = 976 + (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); 977 + info.options.method = method; 978 + info.options.headers = this._mergeHeaders(headers); 979 + if (this.userAgent != null) { 980 + info.options.headers['user-agent'] = this.userAgent; 981 + } 982 + info.options.agent = this._getAgent(info.parsedUrl); 983 + // gives handlers an opportunity to participate 984 + if (this.handlers) { 985 + this.handlers.forEach(handler => { 986 + handler.prepareRequest(info.options); 987 + }); 988 + } 989 + return info; 990 + } 991 + _mergeHeaders(headers) { 992 + const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); 993 + if (this.requestOptions && this.requestOptions.headers) { 994 + return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers)); 995 + } 996 + return lowercaseKeys(headers || {}); 997 + } 998 + _getExistingOrDefaultHeader(additionalHeaders, header, _default) { 999 + const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); 1000 + let clientHeader; 1001 + if (this.requestOptions && this.requestOptions.headers) { 1002 + clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; 1003 + } 1004 + return additionalHeaders[header] || clientHeader || _default; 1005 + } 1006 + _getAgent(parsedUrl) { 1007 + let agent; 1008 + let proxyUrl = pm.getProxyUrl(parsedUrl); 1009 + let useProxy = proxyUrl && proxyUrl.hostname; 1010 + if (this._keepAlive && useProxy) { 1011 + agent = this._proxyAgent; 1012 + } 1013 + if (this._keepAlive && !useProxy) { 1014 + agent = this._agent; 1015 + } 1016 + // if agent is already assigned use that agent. 1017 + if (!!agent) { 1018 + return agent; 1019 + } 1020 + const usingSsl = parsedUrl.protocol === 'https:'; 1021 + let maxSockets = 100; 1022 + if (!!this.requestOptions) { 1023 + maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; 1024 + } 1025 + if (useProxy) { 1026 + // If using proxy, need tunnel 1027 + if (!tunnel) { 1028 + tunnel = __nccwpck_require__(294); 1029 + } 1030 + const agentOptions = { 1031 + maxSockets: maxSockets, 1032 + keepAlive: this._keepAlive, 1033 + proxy: { 1034 + proxyAuth: proxyUrl.auth, 1035 + host: proxyUrl.hostname, 1036 + port: proxyUrl.port 1037 + } 1038 + }; 1039 + let tunnelAgent; 1040 + const overHttps = proxyUrl.protocol === 'https:'; 1041 + if (usingSsl) { 1042 + tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; 1043 + } 1044 + else { 1045 + tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; 1046 + } 1047 + agent = tunnelAgent(agentOptions); 1048 + this._proxyAgent = agent; 1049 + } 1050 + // if reusing agent across request and tunneling agent isn't assigned create a new agent 1051 + if (this._keepAlive && !agent) { 1052 + const options = { keepAlive: this._keepAlive, maxSockets: maxSockets }; 1053 + agent = usingSsl ? new https.Agent(options) : new http.Agent(options); 1054 + this._agent = agent; 1055 + } 1056 + // if not using private agent and tunnel agent isn't setup then use global agent 1057 + if (!agent) { 1058 + agent = usingSsl ? https.globalAgent : http.globalAgent; 1059 + } 1060 + if (usingSsl && this._ignoreSslError) { 1061 + // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process 1062 + // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options 1063 + // we have to cast it to any and change it directly 1064 + agent.options = Object.assign(agent.options || {}, { 1065 + rejectUnauthorized: false 1066 + }); 1067 + } 1068 + return agent; 1069 + } 1070 + _performExponentialBackoff(retryNumber) { 1071 + retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); 1072 + const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); 1073 + return new Promise(resolve => setTimeout(() => resolve(), ms)); 1074 + } 1075 + static dateTimeDeserializer(key, value) { 1076 + if (typeof value === 'string') { 1077 + let a = new Date(value); 1078 + if (!isNaN(a.valueOf())) { 1079 + return a; 1080 + } 1081 + } 1082 + return value; 1083 + } 1084 + async _processResponse(res, options) { 1085 + return new Promise(async (resolve, reject) => { 1086 + const statusCode = res.message.statusCode; 1087 + const response = { 1088 + statusCode: statusCode, 1089 + result: null, 1090 + headers: {} 1091 + }; 1092 + // not found leads to null obj returned 1093 + if (statusCode == HttpCodes.NotFound) { 1094 + resolve(response); 1095 + } 1096 + let obj; 1097 + let contents; 1098 + // get the result from the body 1099 + try { 1100 + contents = await res.readBody(); 1101 + if (contents && contents.length > 0) { 1102 + if (options && options.deserializeDates) { 1103 + obj = JSON.parse(contents, HttpClient.dateTimeDeserializer); 1104 + } 1105 + else { 1106 + obj = JSON.parse(contents); 1107 + } 1108 + response.result = obj; 1109 + } 1110 + response.headers = res.message.headers; 1111 + } 1112 + catch (err) { 1113 + // Invalid resource (contents not json); leaving result obj null 1114 + } 1115 + // note that 3xx redirects are handled by the http layer. 1116 + if (statusCode > 299) { 1117 + let msg; 1118 + // if exception/error in body, attempt to get better error 1119 + if (obj && obj.message) { 1120 + msg = obj.message; 1121 + } 1122 + else if (contents && contents.length > 0) { 1123 + // it may be the case that the exception is in the body message as string 1124 + msg = contents; 1125 + } 1126 + else { 1127 + msg = 'Failed request: (' + statusCode + ')'; 1128 + } 1129 + let err = new Error(msg); 1130 + // attach statusCode and body obj (if available) to the error object 1131 + err['statusCode'] = statusCode; 1132 + if (response.result) { 1133 + err['result'] = response.result; 1134 + } 1135 + reject(err); 1136 + } 1137 + else { 1138 + resolve(response); 1139 + } 1140 + }); 1141 + } 1142 + } 1143 + exports.HttpClient = HttpClient; 1144 + 1145 + 1146 + /***/ }), 1147 + 1148 + /***/ 443: 1149 + /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 1150 + 1151 + "use strict"; 1152 + 1153 + Object.defineProperty(exports, "__esModule", ({ value: true })); 1154 + const url = __nccwpck_require__(835); 1155 + function getProxyUrl(reqUrl) { 1156 + let usingSsl = reqUrl.protocol === 'https:'; 1157 + let proxyUrl; 1158 + if (checkBypass(reqUrl)) { 1159 + return proxyUrl; 1160 + } 1161 + let proxyVar; 1162 + if (usingSsl) { 1163 + proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY']; 1164 + } 1165 + else { 1166 + proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY']; 1167 + } 1168 + if (proxyVar) { 1169 + proxyUrl = url.parse(proxyVar); 1170 + } 1171 + return proxyUrl; 1172 + } 1173 + exports.getProxyUrl = getProxyUrl; 1174 + function checkBypass(reqUrl) { 1175 + if (!reqUrl.hostname) { 1176 + return false; 1177 + } 1178 + let noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; 1179 + if (!noProxy) { 1180 + return false; 1181 + } 1182 + // Determine the request port 1183 + let reqPort; 1184 + if (reqUrl.port) { 1185 + reqPort = Number(reqUrl.port); 1186 + } 1187 + else if (reqUrl.protocol === 'http:') { 1188 + reqPort = 80; 1189 + } 1190 + else if (reqUrl.protocol === 'https:') { 1191 + reqPort = 443; 1192 + } 1193 + // Format the request hostname and hostname with port 1194 + let upperReqHosts = [reqUrl.hostname.toUpperCase()]; 1195 + if (typeof reqPort === 'number') { 1196 + upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); 1197 + } 1198 + // Compare request host against noproxy 1199 + for (let upperNoProxyItem of noProxy 1200 + .split(',') 1201 + .map(x => x.trim().toUpperCase()) 1202 + .filter(x => x)) { 1203 + if (upperReqHosts.some(x => x === upperNoProxyItem)) { 1204 + return true; 1205 + } 1206 + } 1207 + return false; 1208 + } 1209 + exports.checkBypass = checkBypass; 1210 + 1211 + 1212 + /***/ }), 1213 + 1214 + /***/ 334: 1215 + /***/ ((__unused_webpack_module, exports) => { 1216 + 1217 + "use strict"; 1218 + 1219 + 1220 + Object.defineProperty(exports, "__esModule", ({ value: true })); 1221 + 1222 + async function auth(token) { 1223 + const tokenType = token.split(/\./).length === 3 ? "app" : /^v\d+\./.test(token) ? "installation" : "oauth"; 1224 + return { 1225 + type: "token", 1226 + token: token, 1227 + tokenType 1228 + }; 1229 + } 1230 + 1231 + /** 1232 + * Prefix token for usage in the Authorization header 1233 + * 1234 + * @param token OAuth token or JSON Web Token 1235 + */ 1236 + function withAuthorizationPrefix(token) { 1237 + if (token.split(/\./).length === 3) { 1238 + return `bearer ${token}`; 1239 + } 1240 + 1241 + return `token ${token}`; 1242 + } 1243 + 1244 + async function hook(token, request, route, parameters) { 1245 + const endpoint = request.endpoint.merge(route, parameters); 1246 + endpoint.headers.authorization = withAuthorizationPrefix(token); 1247 + return request(endpoint); 1248 + } 1249 + 1250 + const createTokenAuth = function createTokenAuth(token) { 1251 + if (!token) { 1252 + throw new Error("[@octokit/auth-token] No token passed to createTokenAuth"); 1253 + } 1254 + 1255 + if (typeof token !== "string") { 1256 + throw new Error("[@octokit/auth-token] Token passed to createTokenAuth is not a string"); 1257 + } 1258 + 1259 + token = token.replace(/^(token|bearer) +/i, ""); 1260 + return Object.assign(auth.bind(null, token), { 1261 + hook: hook.bind(null, token) 1262 + }); 1263 + }; 1264 + 1265 + exports.createTokenAuth = createTokenAuth; 1266 + //# sourceMappingURL=index.js.map 1267 + 1268 + 1269 + /***/ }), 1270 + 1271 + /***/ 762: 1272 + /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 1273 + 1274 + "use strict"; 1275 + 1276 + 1277 + Object.defineProperty(exports, "__esModule", ({ value: true })); 1278 + 1279 + var universalUserAgent = __nccwpck_require__(429); 1280 + var beforeAfterHook = __nccwpck_require__(682); 1281 + var request = __nccwpck_require__(234); 1282 + var graphql = __nccwpck_require__(668); 1283 + var authToken = __nccwpck_require__(334); 1284 + 1285 + function _defineProperty(obj, key, value) { 1286 + if (key in obj) { 1287 + Object.defineProperty(obj, key, { 1288 + value: value, 1289 + enumerable: true, 1290 + configurable: true, 1291 + writable: true 1292 + }); 1293 + } else { 1294 + obj[key] = value; 1295 + } 1296 + 1297 + return obj; 1298 + } 1299 + 1300 + function ownKeys(object, enumerableOnly) { 1301 + var keys = Object.keys(object); 1302 + 1303 + if (Object.getOwnPropertySymbols) { 1304 + var symbols = Object.getOwnPropertySymbols(object); 1305 + if (enumerableOnly) symbols = symbols.filter(function (sym) { 1306 + return Object.getOwnPropertyDescriptor(object, sym).enumerable; 1307 + }); 1308 + keys.push.apply(keys, symbols); 1309 + } 1310 + 1311 + return keys; 1312 + } 1313 + 1314 + function _objectSpread2(target) { 1315 + for (var i = 1; i < arguments.length; i++) { 1316 + var source = arguments[i] != null ? arguments[i] : {}; 1317 + 1318 + if (i % 2) { 1319 + ownKeys(Object(source), true).forEach(function (key) { 1320 + _defineProperty(target, key, source[key]); 1321 + }); 1322 + } else if (Object.getOwnPropertyDescriptors) { 1323 + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); 1324 + } else { 1325 + ownKeys(Object(source)).forEach(function (key) { 1326 + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 1327 + }); 1328 + } 1329 + } 1330 + 1331 + return target; 1332 + } 1333 + 1334 + const VERSION = "3.1.2"; 1335 + 1336 + class Octokit { 1337 + constructor(options = {}) { 1338 + const hook = new beforeAfterHook.Collection(); 1339 + const requestDefaults = { 1340 + baseUrl: request.request.endpoint.DEFAULTS.baseUrl, 1341 + headers: {}, 1342 + request: Object.assign({}, options.request, { 1343 + hook: hook.bind(null, "request") 1344 + }), 1345 + mediaType: { 1346 + previews: [], 1347 + format: "" 1348 + } 1349 + }; // prepend default user agent with `options.userAgent` if set 1350 + 1351 + requestDefaults.headers["user-agent"] = [options.userAgent, `octokit-core.js/${VERSION} ${universalUserAgent.getUserAgent()}`].filter(Boolean).join(" "); 1352 + 1353 + if (options.baseUrl) { 1354 + requestDefaults.baseUrl = options.baseUrl; 1355 + } 1356 + 1357 + if (options.previews) { 1358 + requestDefaults.mediaType.previews = options.previews; 1359 + } 1360 + 1361 + if (options.timeZone) { 1362 + requestDefaults.headers["time-zone"] = options.timeZone; 1363 + } 1364 + 1365 + this.request = request.request.defaults(requestDefaults); 1366 + this.graphql = graphql.withCustomRequest(this.request).defaults(_objectSpread2(_objectSpread2({}, requestDefaults), {}, { 1367 + baseUrl: requestDefaults.baseUrl.replace(/\/api\/v3$/, "/api") 1368 + })); 1369 + this.log = Object.assign({ 1370 + debug: () => {}, 1371 + info: () => {}, 1372 + warn: console.warn.bind(console), 1373 + error: console.error.bind(console) 1374 + }, options.log); 1375 + this.hook = hook; // (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance 1376 + // is unauthenticated. The `this.auth()` method is a no-op and no request hook is registred. 1377 + // (2) If only `options.auth` is set, use the default token authentication strategy. 1378 + // (3) If `options.authStrategy` is set then use it and pass in `options.auth`. Always pass own request as many strategies accept a custom request instance. 1379 + // TODO: type `options.auth` based on `options.authStrategy`. 1380 + 1381 + if (!options.authStrategy) { 1382 + if (!options.auth) { 1383 + // (1) 1384 + this.auth = async () => ({ 1385 + type: "unauthenticated" 1386 + }); 1387 + } else { 1388 + // (2) 1389 + const auth = authToken.createTokenAuth(options.auth); // @ts-ignore ¯\_(ツ)_/¯ 1390 + 1391 + hook.wrap("request", auth.hook); 1392 + this.auth = auth; 1393 + } 1394 + } else { 1395 + const auth = options.authStrategy(Object.assign({ 1396 + request: this.request 1397 + }, options.auth)); // @ts-ignore ¯\_(ツ)_/¯ 1398 + 1399 + hook.wrap("request", auth.hook); 1400 + this.auth = auth; 1401 + } // apply plugins 1402 + // https://stackoverflow.com/a/16345172 1403 + 1404 + 1405 + const classConstructor = this.constructor; 1406 + classConstructor.plugins.forEach(plugin => { 1407 + Object.assign(this, plugin(this, options)); 1408 + }); 1409 + } 1410 + 1411 + static defaults(defaults) { 1412 + const OctokitWithDefaults = class extends this { 1413 + constructor(...args) { 1414 + const options = args[0] || {}; 1415 + 1416 + if (typeof defaults === "function") { 1417 + super(defaults(options)); 1418 + return; 1419 + } 1420 + 1421 + super(Object.assign({}, defaults, options, options.userAgent && defaults.userAgent ? { 1422 + userAgent: `${options.userAgent} ${defaults.userAgent}` 1423 + } : null)); 1424 + } 1425 + 1426 + }; 1427 + return OctokitWithDefaults; 1428 + } 1429 + /** 1430 + * Attach a plugin (or many) to your Octokit instance. 1431 + * 1432 + * @example 1433 + * const API = Octokit.plugin(plugin1, plugin2, plugin3, ...) 1434 + */ 1435 + 1436 + 1437 + static plugin(...newPlugins) { 1438 + var _a; 1439 + 1440 + const currentPlugins = this.plugins; 1441 + const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a); 1442 + return NewOctokit; 1443 + } 1444 + 1445 + } 1446 + Octokit.VERSION = VERSION; 1447 + Octokit.plugins = []; 1448 + 1449 + exports.Octokit = Octokit; 1450 + //# sourceMappingURL=index.js.map 1451 + 1452 + 1453 + /***/ }), 1454 + 1455 + /***/ 440: 1456 + /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 1457 + 1458 + "use strict"; 1459 + 1460 + 1461 + Object.defineProperty(exports, "__esModule", ({ value: true })); 1462 + 1463 + function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } 1464 + 1465 + var isPlainObject = _interopDefault(__nccwpck_require__(840)); 1466 + var universalUserAgent = __nccwpck_require__(429); 1467 + 1468 + function lowercaseKeys(object) { 1469 + if (!object) { 1470 + return {}; 1471 + } 1472 + 1473 + return Object.keys(object).reduce((newObj, key) => { 1474 + newObj[key.toLowerCase()] = object[key]; 1475 + return newObj; 1476 + }, {}); 1477 + } 1478 + 1479 + function mergeDeep(defaults, options) { 1480 + const result = Object.assign({}, defaults); 1481 + Object.keys(options).forEach(key => { 1482 + if (isPlainObject(options[key])) { 1483 + if (!(key in defaults)) Object.assign(result, { 1484 + [key]: options[key] 1485 + });else result[key] = mergeDeep(defaults[key], options[key]); 1486 + } else { 1487 + Object.assign(result, { 1488 + [key]: options[key] 1489 + }); 1490 + } 1491 + }); 1492 + return result; 1493 + } 1494 + 1495 + function merge(defaults, route, options) { 1496 + if (typeof route === "string") { 1497 + let [method, url] = route.split(" "); 1498 + options = Object.assign(url ? { 1499 + method, 1500 + url 1501 + } : { 1502 + url: method 1503 + }, options); 1504 + } else { 1505 + options = Object.assign({}, route); 1506 + } // lowercase header names before merging with defaults to avoid duplicates 1507 + 1508 + 1509 + options.headers = lowercaseKeys(options.headers); 1510 + const mergedOptions = mergeDeep(defaults || {}, options); // mediaType.previews arrays are merged, instead of overwritten 1511 + 1512 + if (defaults && defaults.mediaType.previews.length) { 1513 + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(preview => !mergedOptions.mediaType.previews.includes(preview)).concat(mergedOptions.mediaType.previews); 1514 + } 1515 + 1516 + mergedOptions.mediaType.previews = mergedOptions.mediaType.previews.map(preview => preview.replace(/-preview/, "")); 1517 + return mergedOptions; 1518 + } 1519 + 1520 + function addQueryParameters(url, parameters) { 1521 + const separator = /\?/.test(url) ? "&" : "?"; 1522 + const names = Object.keys(parameters); 1523 + 1524 + if (names.length === 0) { 1525 + return url; 1526 + } 1527 + 1528 + return url + separator + names.map(name => { 1529 + if (name === "q") { 1530 + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); 1531 + } 1532 + 1533 + return `${name}=${encodeURIComponent(parameters[name])}`; 1534 + }).join("&"); 1535 + } 1536 + 1537 + const urlVariableRegex = /\{[^}]+\}/g; 1538 + 1539 + function removeNonChars(variableName) { 1540 + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); 1541 + } 1542 + 1543 + function extractUrlVariableNames(url) { 1544 + const matches = url.match(urlVariableRegex); 1545 + 1546 + if (!matches) { 1547 + return []; 1548 + } 1549 + 1550 + return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []); 1551 + } 1552 + 1553 + function omit(object, keysToOmit) { 1554 + return Object.keys(object).filter(option => !keysToOmit.includes(option)).reduce((obj, key) => { 1555 + obj[key] = object[key]; 1556 + return obj; 1557 + }, {}); 1558 + } 1559 + 1560 + // Based on https://github.com/bramstein/url-template, licensed under BSD 1561 + // TODO: create separate package. 1562 + // 1563 + // Copyright (c) 2012-2014, Bram Stein 1564 + // All rights reserved. 1565 + // Redistribution and use in source and binary forms, with or without 1566 + // modification, are permitted provided that the following conditions 1567 + // are met: 1568 + // 1. Redistributions of source code must retain the above copyright 1569 + // notice, this list of conditions and the following disclaimer. 1570 + // 2. Redistributions in binary form must reproduce the above copyright 1571 + // notice, this list of conditions and the following disclaimer in the 1572 + // documentation and/or other materials provided with the distribution. 1573 + // 3. The name of the author may not be used to endorse or promote products 1574 + // derived from this software without specific prior written permission. 1575 + // THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 1576 + // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1577 + // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 1578 + // EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 1579 + // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 1580 + // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1581 + // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 1582 + // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 1583 + // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 1584 + // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1585 + 1586 + /* istanbul ignore file */ 1587 + function encodeReserved(str) { 1588 + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) { 1589 + if (!/%[0-9A-Fa-f]/.test(part)) { 1590 + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); 1591 + } 1592 + 1593 + return part; 1594 + }).join(""); 1595 + } 1596 + 1597 + function encodeUnreserved(str) { 1598 + return encodeURIComponent(str).replace(/[!'()*]/g, function (c) { 1599 + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); 1600 + }); 1601 + } 1602 + 1603 + function encodeValue(operator, value, key) { 1604 + value = operator === "+" || operator === "#" ? encodeReserved(value) : encodeUnreserved(value); 1605 + 1606 + if (key) { 1607 + return encodeUnreserved(key) + "=" + value; 1608 + } else { 1609 + return value; 1610 + } 1611 + } 1612 + 1613 + function isDefined(value) { 1614 + return value !== undefined && value !== null; 1615 + } 1616 + 1617 + function isKeyOperator(operator) { 1618 + return operator === ";" || operator === "&" || operator === "?"; 1619 + } 1620 + 1621 + function getValues(context, operator, key, modifier) { 1622 + var value = context[key], 1623 + result = []; 1624 + 1625 + if (isDefined(value) && value !== "") { 1626 + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { 1627 + value = value.toString(); 1628 + 1629 + if (modifier && modifier !== "*") { 1630 + value = value.substring(0, parseInt(modifier, 10)); 1631 + } 1632 + 1633 + result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : "")); 1634 + } else { 1635 + if (modifier === "*") { 1636 + if (Array.isArray(value)) { 1637 + value.filter(isDefined).forEach(function (value) { 1638 + result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : "")); 1639 + }); 1640 + } else { 1641 + Object.keys(value).forEach(function (k) { 1642 + if (isDefined(value[k])) { 1643 + result.push(encodeValue(operator, value[k], k)); 1644 + } 1645 + }); 1646 + } 1647 + } else { 1648 + const tmp = []; 1649 + 1650 + if (Array.isArray(value)) { 1651 + value.filter(isDefined).forEach(function (value) { 1652 + tmp.push(encodeValue(operator, value)); 1653 + }); 1654 + } else { 1655 + Object.keys(value).forEach(function (k) { 1656 + if (isDefined(value[k])) { 1657 + tmp.push(encodeUnreserved(k)); 1658 + tmp.push(encodeValue(operator, value[k].toString())); 1659 + } 1660 + }); 1661 + } 1662 + 1663 + if (isKeyOperator(operator)) { 1664 + result.push(encodeUnreserved(key) + "=" + tmp.join(",")); 1665 + } else if (tmp.length !== 0) { 1666 + result.push(tmp.join(",")); 1667 + } 1668 + } 1669 + } 1670 + } else { 1671 + if (operator === ";") { 1672 + if (isDefined(value)) { 1673 + result.push(encodeUnreserved(key)); 1674 + } 1675 + } else if (value === "" && (operator === "&" || operator === "?")) { 1676 + result.push(encodeUnreserved(key) + "="); 1677 + } else if (value === "") { 1678 + result.push(""); 1679 + } 1680 + } 1681 + 1682 + return result; 1683 + } 1684 + 1685 + function parseUrl(template) { 1686 + return { 1687 + expand: expand.bind(null, template) 1688 + }; 1689 + } 1690 + 1691 + function expand(template, context) { 1692 + var operators = ["+", "#", ".", "/", ";", "?", "&"]; 1693 + return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function (_, expression, literal) { 1694 + if (expression) { 1695 + let operator = ""; 1696 + const values = []; 1697 + 1698 + if (operators.indexOf(expression.charAt(0)) !== -1) { 1699 + operator = expression.charAt(0); 1700 + expression = expression.substr(1); 1701 + } 1702 + 1703 + expression.split(/,/g).forEach(function (variable) { 1704 + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); 1705 + values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3])); 1706 + }); 1707 + 1708 + if (operator && operator !== "+") { 1709 + var separator = ","; 1710 + 1711 + if (operator === "?") { 1712 + separator = "&"; 1713 + } else if (operator !== "#") { 1714 + separator = operator; 1715 + } 1716 + 1717 + return (values.length !== 0 ? operator : "") + values.join(separator); 1718 + } else { 1719 + return values.join(","); 1720 + } 1721 + } else { 1722 + return encodeReserved(literal); 1723 + } 1724 + }); 1725 + } 1726 + 1727 + function parse(options) { 1728 + // https://fetch.spec.whatwg.org/#methods 1729 + let method = options.method.toUpperCase(); // replace :varname with {varname} to make it RFC 6570 compatible 1730 + 1731 + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{+$1}"); 1732 + let headers = Object.assign({}, options.headers); 1733 + let body; 1734 + let parameters = omit(options, ["method", "baseUrl", "url", "headers", "request", "mediaType"]); // extract variable names from URL to calculate remaining variables later 1735 + 1736 + const urlVariableNames = extractUrlVariableNames(url); 1737 + url = parseUrl(url).expand(parameters); 1738 + 1739 + if (!/^http/.test(url)) { 1740 + url = options.baseUrl + url; 1741 + } 1742 + 1743 + const omittedParameters = Object.keys(options).filter(option => urlVariableNames.includes(option)).concat("baseUrl"); 1744 + const remainingParameters = omit(parameters, omittedParameters); 1745 + const isBinaryRequset = /application\/octet-stream/i.test(headers.accept); 1746 + 1747 + if (!isBinaryRequset) { 1748 + if (options.mediaType.format) { 1749 + // e.g. application/vnd.github.v3+json => application/vnd.github.v3.raw 1750 + headers.accept = headers.accept.split(/,/).map(preview => preview.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, `application/vnd$1$2.${options.mediaType.format}`)).join(","); 1751 + } 1752 + 1753 + if (options.mediaType.previews.length) { 1754 + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; 1755 + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map(preview => { 1756 + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; 1757 + return `application/vnd.github.${preview}-preview${format}`; 1758 + }).join(","); 1759 + } 1760 + } // for GET/HEAD requests, set URL query parameters from remaining parameters 1761 + // for PATCH/POST/PUT/DELETE requests, set request body from remaining parameters 1762 + 1763 + 1764 + if (["GET", "HEAD"].includes(method)) { 1765 + url = addQueryParameters(url, remainingParameters); 1766 + } else { 1767 + if ("data" in remainingParameters) { 1768 + body = remainingParameters.data; 1769 + } else { 1770 + if (Object.keys(remainingParameters).length) { 1771 + body = remainingParameters; 1772 + } else { 1773 + headers["content-length"] = 0; 1774 + } 1775 + } 1776 + } // default content-type for JSON if body is set 1777 + 1778 + 1779 + if (!headers["content-type"] && typeof body !== "undefined") { 1780 + headers["content-type"] = "application/json; charset=utf-8"; 1781 + } // GitHub expects 'content-length: 0' header for PUT/PATCH requests without body. 1782 + // fetch does not allow to set `content-length` header, but we can set body to an empty string 1783 + 1784 + 1785 + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { 1786 + body = ""; 1787 + } // Only return body/request keys if present 1788 + 1789 + 1790 + return Object.assign({ 1791 + method, 1792 + url, 1793 + headers 1794 + }, typeof body !== "undefined" ? { 1795 + body 1796 + } : null, options.request ? { 1797 + request: options.request 1798 + } : null); 1799 + } 1800 + 1801 + function endpointWithDefaults(defaults, route, options) { 1802 + return parse(merge(defaults, route, options)); 1803 + } 1804 + 1805 + function withDefaults(oldDefaults, newDefaults) { 1806 + const DEFAULTS = merge(oldDefaults, newDefaults); 1807 + const endpoint = endpointWithDefaults.bind(null, DEFAULTS); 1808 + return Object.assign(endpoint, { 1809 + DEFAULTS, 1810 + defaults: withDefaults.bind(null, DEFAULTS), 1811 + merge: merge.bind(null, DEFAULTS), 1812 + parse 1813 + }); 1814 + } 1815 + 1816 + const VERSION = "6.0.5"; 1817 + 1818 + const userAgent = `octokit-endpoint.js/${VERSION} ${universalUserAgent.getUserAgent()}`; // DEFAULTS has all properties set that EndpointOptions has, except url. 1819 + // So we use RequestParameters and add method as additional required property. 1820 + 1821 + const DEFAULTS = { 1822 + method: "GET", 1823 + baseUrl: "https://api.github.com", 1824 + headers: { 1825 + accept: "application/vnd.github.v3+json", 1826 + "user-agent": userAgent 1827 + }, 1828 + mediaType: { 1829 + format: "", 1830 + previews: [] 1831 + } 1832 + }; 1833 + 1834 + const endpoint = withDefaults(null, DEFAULTS); 1835 + 1836 + exports.endpoint = endpoint; 1837 + //# sourceMappingURL=index.js.map 1838 + 1839 + 1840 + /***/ }), 1841 + 1842 + /***/ 668: 1843 + /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 1844 + 1845 + "use strict"; 1846 + 1847 + 1848 + Object.defineProperty(exports, "__esModule", ({ value: true })); 1849 + 1850 + var request = __nccwpck_require__(234); 1851 + var universalUserAgent = __nccwpck_require__(429); 1852 + 1853 + const VERSION = "4.5.4"; 1854 + 1855 + class GraphqlError extends Error { 1856 + constructor(request, response) { 1857 + const message = response.data.errors[0].message; 1858 + super(message); 1859 + Object.assign(this, response.data); 1860 + Object.assign(this, { 1861 + headers: response.headers 1862 + }); 1863 + this.name = "GraphqlError"; 1864 + this.request = request; // Maintains proper stack trace (only available on V8) 1865 + 1866 + /* istanbul ignore next */ 1867 + 1868 + if (Error.captureStackTrace) { 1869 + Error.captureStackTrace(this, this.constructor); 1870 + } 1871 + } 1872 + 1873 + } 1874 + 1875 + const NON_VARIABLE_OPTIONS = ["method", "baseUrl", "url", "headers", "request", "query", "mediaType"]; 1876 + function graphql(request, query, options) { 1877 + options = typeof query === "string" ? options = Object.assign({ 1878 + query 1879 + }, options) : options = query; 1880 + const requestOptions = Object.keys(options).reduce((result, key) => { 1881 + if (NON_VARIABLE_OPTIONS.includes(key)) { 1882 + result[key] = options[key]; 1883 + return result; 1884 + } 1885 + 1886 + if (!result.variables) { 1887 + result.variables = {}; 1888 + } 1889 + 1890 + result.variables[key] = options[key]; 1891 + return result; 1892 + }, {}); 1893 + return request(requestOptions).then(response => { 1894 + if (response.data.errors) { 1895 + const headers = {}; 1896 + 1897 + for (const key of Object.keys(response.headers)) { 1898 + headers[key] = response.headers[key]; 1899 + } 1900 + 1901 + throw new GraphqlError(requestOptions, { 1902 + headers, 1903 + data: response.data 1904 + }); 1905 + } 1906 + 1907 + return response.data.data; 1908 + }); 1909 + } 1910 + 1911 + function withDefaults(request$1, newDefaults) { 1912 + const newRequest = request$1.defaults(newDefaults); 1913 + 1914 + const newApi = (query, options) => { 1915 + return graphql(newRequest, query, options); 1916 + }; 1917 + 1918 + return Object.assign(newApi, { 1919 + defaults: withDefaults.bind(null, newRequest), 1920 + endpoint: request.request.endpoint 1921 + }); 1922 + } 1923 + 1924 + const graphql$1 = withDefaults(request.request, { 1925 + headers: { 1926 + "user-agent": `octokit-graphql.js/${VERSION} ${universalUserAgent.getUserAgent()}` 1927 + }, 1928 + method: "POST", 1929 + url: "/graphql" 1930 + }); 1931 + function withCustomRequest(customRequest) { 1932 + return withDefaults(customRequest, { 1933 + method: "POST", 1934 + url: "/graphql" 1935 + }); 1936 + } 1937 + 1938 + exports.graphql = graphql$1; 1939 + exports.withCustomRequest = withCustomRequest; 1940 + //# sourceMappingURL=index.js.map 1941 + 1942 + 1943 + /***/ }), 1944 + 1945 + /***/ 193: 1946 + /***/ ((__unused_webpack_module, exports) => { 1947 + 1948 + "use strict"; 1949 + 1950 + 1951 + Object.defineProperty(exports, "__esModule", ({ value: true })); 1952 + 1953 + const VERSION = "2.3.0"; 1954 + 1955 + /** 1956 + * Some “list” response that can be paginated have a different response structure 1957 + * 1958 + * They have a `total_count` key in the response (search also has `incomplete_results`, 1959 + * /installation/repositories also has `repository_selection`), as well as a key with 1960 + * the list of the items which name varies from endpoint to endpoint. 1961 + * 1962 + * Octokit normalizes these responses so that paginated results are always returned following 1963 + * the same structure. One challenge is that if the list response has only one page, no Link 1964 + * header is provided, so this header alone is not sufficient to check wether a response is 1965 + * paginated or not. 1966 + * 1967 + * We check if a "total_count" key is present in the response data, but also make sure that 1968 + * a "url" property is not, as the "Get the combined status for a specific ref" endpoint would 1969 + * otherwise match: https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref 1970 + */ 1971 + function normalizePaginatedListResponse(response) { 1972 + const responseNeedsNormalization = "total_count" in response.data && !("url" in response.data); 1973 + if (!responseNeedsNormalization) return response; // keep the additional properties intact as there is currently no other way 1974 + // to retrieve the same information. 1975 + 1976 + const incompleteResults = response.data.incomplete_results; 1977 + const repositorySelection = response.data.repository_selection; 1978 + const totalCount = response.data.total_count; 1979 + delete response.data.incomplete_results; 1980 + delete response.data.repository_selection; 1981 + delete response.data.total_count; 1982 + const namespaceKey = Object.keys(response.data)[0]; 1983 + const data = response.data[namespaceKey]; 1984 + response.data = data; 1985 + 1986 + if (typeof incompleteResults !== "undefined") { 1987 + response.data.incomplete_results = incompleteResults; 1988 + } 1989 + 1990 + if (typeof repositorySelection !== "undefined") { 1991 + response.data.repository_selection = repositorySelection; 1992 + } 1993 + 1994 + response.data.total_count = totalCount; 1995 + return response; 1996 + } 1997 + 1998 + function iterator(octokit, route, parameters) { 1999 + const options = typeof route === "function" ? route.endpoint(parameters) : octokit.request.endpoint(route, parameters); 2000 + const requestMethod = typeof route === "function" ? route : octokit.request; 2001 + const method = options.method; 2002 + const headers = options.headers; 2003 + let url = options.url; 2004 + return { 2005 + [Symbol.asyncIterator]: () => ({ 2006 + next() { 2007 + if (!url) { 2008 + return Promise.resolve({ 2009 + done: true 2010 + }); 2011 + } 2012 + 2013 + return requestMethod({ 2014 + method, 2015 + url, 2016 + headers 2017 + }).then(normalizePaginatedListResponse).then(response => { 2018 + // `response.headers.link` format: 2019 + // '<https://api.github.com/users/aseemk/followers?page=2>; rel="next", <https://api.github.com/users/aseemk/followers?page=2>; rel="last"' 2020 + // sets `url` to undefined if "next" URL is not present or `link` header is not set 2021 + url = ((response.headers.link || "").match(/<([^>]+)>;\s*rel="next"/) || [])[1]; 2022 + return { 2023 + value: response 2024 + }; 2025 + }); 2026 + } 2027 + 2028 + }) 2029 + }; 2030 + } 2031 + 2032 + function paginate(octokit, route, parameters, mapFn) { 2033 + if (typeof parameters === "function") { 2034 + mapFn = parameters; 2035 + parameters = undefined; 2036 + } 2037 + 2038 + return gather(octokit, [], iterator(octokit, route, parameters)[Symbol.asyncIterator](), mapFn); 2039 + } 2040 + 2041 + function gather(octokit, results, iterator, mapFn) { 2042 + return iterator.next().then(result => { 2043 + if (result.done) { 2044 + return results; 2045 + } 2046 + 2047 + let earlyExit = false; 2048 + 2049 + function done() { 2050 + earlyExit = true; 2051 + } 2052 + 2053 + results = results.concat(mapFn ? mapFn(result.value, done) : result.value.data); 2054 + 2055 + if (earlyExit) { 2056 + return results; 2057 + } 2058 + 2059 + return gather(octokit, results, iterator, mapFn); 2060 + }); 2061 + } 2062 + 2063 + /** 2064 + * @param octokit Octokit instance 2065 + * @param options Options passed to Octokit constructor 2066 + */ 2067 + 2068 + function paginateRest(octokit) { 2069 + return { 2070 + paginate: Object.assign(paginate.bind(null, octokit), { 2071 + iterator: iterator.bind(null, octokit) 2072 + }) 2073 + }; 2074 + } 2075 + paginateRest.VERSION = VERSION; 2076 + 2077 + exports.paginateRest = paginateRest; 2078 + //# sourceMappingURL=index.js.map 2079 + 2080 + 2081 + /***/ }), 2082 + 122 2083 /***/ 44: 123 - /***/ (function(__unusedmodule, exports) { 2084 + /***/ ((__unused_webpack_module, exports) => { 124 2085 125 2086 "use strict"; 126 2087 127 2088 128 - Object.defineProperty(exports, '__esModule', { value: true }); 2089 + Object.defineProperty(exports, "__esModule", ({ value: true })); 129 2090 130 2091 const Endpoints = { 131 2092 actions: { ··· 1334 3295 1335 3296 /***/ }), 1336 3297 1337 - /***/ 53: 1338 - /***/ (function(__unusedmodule, exports, __webpack_require__) { 3298 + /***/ 537: 3299 + /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 1339 3300 1340 3301 "use strict"; 1341 3302 1342 - Object.defineProperty(exports, "__esModule", { value: true }); 1343 - exports.Context = void 0; 1344 - const fs_1 = __webpack_require__(747); 1345 - const os_1 = __webpack_require__(87); 1346 - class Context { 1347 - /** 1348 - * Hydrate the context from the environment 1349 - */ 1350 - constructor() { 1351 - this.payload = {}; 1352 - if (process.env.GITHUB_EVENT_PATH) { 1353 - if (fs_1.existsSync(process.env.GITHUB_EVENT_PATH)) { 1354 - this.payload = JSON.parse(fs_1.readFileSync(process.env.GITHUB_EVENT_PATH, { encoding: 'utf8' })); 1355 - } 1356 - else { 1357 - const path = process.env.GITHUB_EVENT_PATH; 1358 - process.stdout.write(`GITHUB_EVENT_PATH ${path} does not exist${os_1.EOL}`); 1359 - } 1360 - } 1361 - this.eventName = process.env.GITHUB_EVENT_NAME; 1362 - this.sha = process.env.GITHUB_SHA; 1363 - this.ref = process.env.GITHUB_REF; 1364 - this.workflow = process.env.GITHUB_WORKFLOW; 1365 - this.action = process.env.GITHUB_ACTION; 1366 - this.actor = process.env.GITHUB_ACTOR; 1367 - this.job = process.env.GITHUB_JOB; 1368 - this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10); 1369 - this.runId = parseInt(process.env.GITHUB_RUN_ID, 10); 1370 - } 1371 - get issue() { 1372 - const payload = this.payload; 1373 - return Object.assign(Object.assign({}, this.repo), { number: (payload.issue || payload.pull_request || payload).number }); 1374 - } 1375 - get repo() { 1376 - if (process.env.GITHUB_REPOSITORY) { 1377 - const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/'); 1378 - return { owner, repo }; 1379 - } 1380 - if (this.payload.repository) { 1381 - return { 1382 - owner: this.payload.repository.owner.login, 1383 - repo: this.payload.repository.name 1384 - }; 1385 - } 1386 - throw new Error("context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'"); 1387 - } 1388 - } 1389 - exports.Context = Context; 1390 - //# sourceMappingURL=context.js.map 1391 3303 1392 - /***/ }), 1393 - 1394 - /***/ 87: 1395 - /***/ (function(module) { 1396 - 1397 - module.exports = require("os"); 1398 - 1399 - /***/ }), 1400 - 1401 - /***/ 176: 1402 - /***/ (function(module, __unusedexports, __webpack_require__) { 1403 - 1404 - "use strict"; 1405 - /* module decorator */ module = __webpack_require__.nmd(module); 1406 - 1407 - 1408 - var Module = __webpack_require__(282); 1409 - var path = __webpack_require__(622); 1410 - 1411 - module.exports = function requireFromString(code, filename, opts) { 1412 - if (typeof filename === 'object') { 1413 - opts = filename; 1414 - filename = undefined; 1415 - } 1416 - 1417 - opts = opts || {}; 1418 - filename = filename || ''; 1419 - 1420 - opts.appendPaths = opts.appendPaths || []; 1421 - opts.prependPaths = opts.prependPaths || []; 1422 - 1423 - if (typeof code !== 'string') { 1424 - throw new Error('code must be a string, not ' + typeof code); 1425 - } 1426 - 1427 - var paths = Module._nodeModulePaths(path.dirname(filename)); 1428 - 1429 - var parent = module.parent; 1430 - var m = new Module(filename, parent); 1431 - m.filename = filename; 1432 - m.paths = [].concat(opts.prependPaths).concat(paths).concat(opts.appendPaths); 1433 - m._compile(code, filename); 1434 - 1435 - var exports = m.exports; 1436 - parent && parent.children && parent.children.splice(parent.children.indexOf(m), 1); 1437 - 1438 - return exports; 1439 - }; 3304 + Object.defineProperty(exports, "__esModule", ({ value: true })); 1440 3305 3306 + function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } 1441 3307 1442 - /***/ }), 3308 + var deprecation = __nccwpck_require__(932); 3309 + var once = _interopDefault(__nccwpck_require__(223)); 1443 3310 1444 - /***/ 186: 1445 - /***/ (function(__unusedmodule, exports, __webpack_require__) { 1446 - 1447 - "use strict"; 1448 - 1449 - var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 1450 - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 1451 - return new (P || (P = Promise))(function (resolve, reject) { 1452 - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 1453 - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 1454 - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 1455 - step((generator = generator.apply(thisArg, _arguments || [])).next()); 1456 - }); 1457 - }; 1458 - var __importStar = (this && this.__importStar) || function (mod) { 1459 - if (mod && mod.__esModule) return mod; 1460 - var result = {}; 1461 - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 1462 - result["default"] = mod; 1463 - return result; 1464 - }; 1465 - Object.defineProperty(exports, "__esModule", { value: true }); 1466 - const command_1 = __webpack_require__(351); 1467 - const os = __importStar(__webpack_require__(87)); 1468 - const path = __importStar(__webpack_require__(622)); 3311 + const logOnce = once(deprecation => console.warn(deprecation)); 1469 3312 /** 1470 - * The code to exit an action 3313 + * Error with extra properties to help with debugging 1471 3314 */ 1472 - var ExitCode; 1473 - (function (ExitCode) { 1474 - /** 1475 - * A code indicating that the action was successful 1476 - */ 1477 - ExitCode[ExitCode["Success"] = 0] = "Success"; 1478 - /** 1479 - * A code indicating that the action was a failure 1480 - */ 1481 - ExitCode[ExitCode["Failure"] = 1] = "Failure"; 1482 - })(ExitCode = exports.ExitCode || (exports.ExitCode = {})); 1483 - //----------------------------------------------------------------------- 1484 - // Variables 1485 - //----------------------------------------------------------------------- 1486 - /** 1487 - * Sets env variable for this action and future actions in the job 1488 - * @param name the name of the variable to set 1489 - * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify 1490 - */ 1491 - // eslint-disable-next-line @typescript-eslint/no-explicit-any 1492 - function exportVariable(name, val) { 1493 - const convertedVal = command_1.toCommandValue(val); 1494 - process.env[name] = convertedVal; 1495 - command_1.issueCommand('set-env', { name }, convertedVal); 1496 - } 1497 - exports.exportVariable = exportVariable; 1498 - /** 1499 - * Registers a secret which will get masked from logs 1500 - * @param secret value of the secret 1501 - */ 1502 - function setSecret(secret) { 1503 - command_1.issueCommand('add-mask', {}, secret); 1504 - } 1505 - exports.setSecret = setSecret; 1506 - /** 1507 - * Prepends inputPath to the PATH (for this action and future actions) 1508 - * @param inputPath 1509 - */ 1510 - function addPath(inputPath) { 1511 - command_1.issueCommand('add-path', {}, inputPath); 1512 - process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; 1513 - } 1514 - exports.addPath = addPath; 1515 - /** 1516 - * Gets the value of an input. The value is also trimmed. 1517 - * 1518 - * @param name name of the input to get 1519 - * @param options optional. See InputOptions. 1520 - * @returns string 1521 - */ 1522 - function getInput(name, options) { 1523 - const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; 1524 - if (options && options.required && !val) { 1525 - throw new Error(`Input required and not supplied: ${name}`); 1526 - } 1527 - return val.trim(); 1528 - } 1529 - exports.getInput = getInput; 1530 - /** 1531 - * Sets the value of an output. 1532 - * 1533 - * @param name name of the output to set 1534 - * @param value value to store. Non-string values will be converted to a string via JSON.stringify 1535 - */ 1536 - // eslint-disable-next-line @typescript-eslint/no-explicit-any 1537 - function setOutput(name, value) { 1538 - command_1.issueCommand('set-output', { name }, value); 1539 - } 1540 - exports.setOutput = setOutput; 1541 - /** 1542 - * Enables or disables the echoing of commands into stdout for the rest of the step. 1543 - * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. 1544 - * 1545 - */ 1546 - function setCommandEcho(enabled) { 1547 - command_1.issue('echo', enabled ? 'on' : 'off'); 1548 - } 1549 - exports.setCommandEcho = setCommandEcho; 1550 - //----------------------------------------------------------------------- 1551 - // Results 1552 - //----------------------------------------------------------------------- 1553 - /** 1554 - * Sets the action status to failed. 1555 - * When the action exits it will be with an exit code of 1 1556 - * @param message add error issue message 1557 - */ 1558 - function setFailed(message) { 1559 - process.exitCode = ExitCode.Failure; 1560 - error(message); 1561 - } 1562 - exports.setFailed = setFailed; 1563 - //----------------------------------------------------------------------- 1564 - // Logging Commands 1565 - //----------------------------------------------------------------------- 1566 - /** 1567 - * Gets whether Actions Step Debug is on or not 1568 - */ 1569 - function isDebug() { 1570 - return process.env['RUNNER_DEBUG'] === '1'; 1571 - } 1572 - exports.isDebug = isDebug; 1573 - /** 1574 - * Writes debug message to user log 1575 - * @param message debug message 1576 - */ 1577 - function debug(message) { 1578 - command_1.issueCommand('debug', {}, message); 1579 - } 1580 - exports.debug = debug; 1581 - /** 1582 - * Adds an error issue 1583 - * @param message error issue message. Errors will be converted to string via toString() 1584 - */ 1585 - function error(message) { 1586 - command_1.issue('error', message instanceof Error ? message.toString() : message); 1587 - } 1588 - exports.error = error; 1589 - /** 1590 - * Adds an warning issue 1591 - * @param message warning issue message. Errors will be converted to string via toString() 1592 - */ 1593 - function warning(message) { 1594 - command_1.issue('warning', message instanceof Error ? message.toString() : message); 1595 - } 1596 - exports.warning = warning; 1597 - /** 1598 - * Writes info to log with console.log. 1599 - * @param message info message 1600 - */ 1601 - function info(message) { 1602 - process.stdout.write(message + os.EOL); 1603 - } 1604 - exports.info = info; 1605 - /** 1606 - * Begin an output group. 1607 - * 1608 - * Output until the next `groupEnd` will be foldable in this group 1609 - * 1610 - * @param name The name of the output group 1611 - */ 1612 - function startGroup(name) { 1613 - command_1.issue('group', name); 1614 - } 1615 - exports.startGroup = startGroup; 1616 - /** 1617 - * End an output group. 1618 - */ 1619 - function endGroup() { 1620 - command_1.issue('endgroup'); 1621 - } 1622 - exports.endGroup = endGroup; 1623 - /** 1624 - * Wrap an asynchronous function call in a group. 1625 - * 1626 - * Returns the same type as the function itself. 1627 - * 1628 - * @param name The name of the group 1629 - * @param fn The function to wrap in the group 1630 - */ 1631 - function group(name, fn) { 1632 - return __awaiter(this, void 0, void 0, function* () { 1633 - startGroup(name); 1634 - let result; 1635 - try { 1636 - result = yield fn(); 1637 - } 1638 - finally { 1639 - endGroup(); 1640 - } 1641 - return result; 1642 - }); 1643 - } 1644 - exports.group = group; 1645 - //----------------------------------------------------------------------- 1646 - // Wrapper action state 1647 - //----------------------------------------------------------------------- 1648 - /** 1649 - * Saves state for current action, the state can only be retrieved by this action's post job execution. 1650 - * 1651 - * @param name name of the state to store 1652 - * @param value value to store. Non-string values will be converted to a string via JSON.stringify 1653 - */ 1654 - // eslint-disable-next-line @typescript-eslint/no-explicit-any 1655 - function saveState(name, value) { 1656 - command_1.issueCommand('save-state', { name }, value); 1657 - } 1658 - exports.saveState = saveState; 1659 - /** 1660 - * Gets the value of an state set by this action's main execution. 1661 - * 1662 - * @param name name of the state to get 1663 - * @returns string 1664 - */ 1665 - function getState(name) { 1666 - return process.env[`STATE_${name}`] || ''; 1667 - } 1668 - exports.getState = getState; 1669 - //# sourceMappingURL=core.js.map 1670 3315 1671 - /***/ }), 1672 - 1673 - /***/ 193: 1674 - /***/ (function(__unusedmodule, exports) { 1675 - 1676 - "use strict"; 1677 - 1678 - 1679 - Object.defineProperty(exports, '__esModule', { value: true }); 1680 - 1681 - const VERSION = "2.3.0"; 1682 - 1683 - /** 1684 - * Some “list” response that can be paginated have a different response structure 1685 - * 1686 - * They have a `total_count` key in the response (search also has `incomplete_results`, 1687 - * /installation/repositories also has `repository_selection`), as well as a key with 1688 - * the list of the items which name varies from endpoint to endpoint. 1689 - * 1690 - * Octokit normalizes these responses so that paginated results are always returned following 1691 - * the same structure. One challenge is that if the list response has only one page, no Link 1692 - * header is provided, so this header alone is not sufficient to check wether a response is 1693 - * paginated or not. 1694 - * 1695 - * We check if a "total_count" key is present in the response data, but also make sure that 1696 - * a "url" property is not, as the "Get the combined status for a specific ref" endpoint would 1697 - * otherwise match: https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref 1698 - */ 1699 - function normalizePaginatedListResponse(response) { 1700 - const responseNeedsNormalization = "total_count" in response.data && !("url" in response.data); 1701 - if (!responseNeedsNormalization) return response; // keep the additional properties intact as there is currently no other way 1702 - // to retrieve the same information. 1703 - 1704 - const incompleteResults = response.data.incomplete_results; 1705 - const repositorySelection = response.data.repository_selection; 1706 - const totalCount = response.data.total_count; 1707 - delete response.data.incomplete_results; 1708 - delete response.data.repository_selection; 1709 - delete response.data.total_count; 1710 - const namespaceKey = Object.keys(response.data)[0]; 1711 - const data = response.data[namespaceKey]; 1712 - response.data = data; 1713 - 1714 - if (typeof incompleteResults !== "undefined") { 1715 - response.data.incomplete_results = incompleteResults; 1716 - } 1717 - 1718 - if (typeof repositorySelection !== "undefined") { 1719 - response.data.repository_selection = repositorySelection; 1720 - } 3316 + class RequestError extends Error { 3317 + constructor(message, statusCode, options) { 3318 + super(message); // Maintains proper stack trace (only available on V8) 1721 3319 1722 - response.data.total_count = totalCount; 1723 - return response; 1724 - } 1725 - 1726 - function iterator(octokit, route, parameters) { 1727 - const options = typeof route === "function" ? route.endpoint(parameters) : octokit.request.endpoint(route, parameters); 1728 - const requestMethod = typeof route === "function" ? route : octokit.request; 1729 - const method = options.method; 1730 - const headers = options.headers; 1731 - let url = options.url; 1732 - return { 1733 - [Symbol.asyncIterator]: () => ({ 1734 - next() { 1735 - if (!url) { 1736 - return Promise.resolve({ 1737 - done: true 1738 - }); 1739 - } 3320 + /* istanbul ignore next */ 1740 3321 1741 - return requestMethod({ 1742 - method, 1743 - url, 1744 - headers 1745 - }).then(normalizePaginatedListResponse).then(response => { 1746 - // `response.headers.link` format: 1747 - // '<https://api.github.com/users/aseemk/followers?page=2>; rel="next", <https://api.github.com/users/aseemk/followers?page=2>; rel="last"' 1748 - // sets `url` to undefined if "next" URL is not present or `link` header is not set 1749 - url = ((response.headers.link || "").match(/<([^>]+)>;\s*rel="next"/) || [])[1]; 1750 - return { 1751 - value: response 1752 - }; 1753 - }); 1754 - } 1755 - 1756 - }) 1757 - }; 1758 - } 1759 - 1760 - function paginate(octokit, route, parameters, mapFn) { 1761 - if (typeof parameters === "function") { 1762 - mapFn = parameters; 1763 - parameters = undefined; 1764 - } 1765 - 1766 - return gather(octokit, [], iterator(octokit, route, parameters)[Symbol.asyncIterator](), mapFn); 1767 - } 1768 - 1769 - function gather(octokit, results, iterator, mapFn) { 1770 - return iterator.next().then(result => { 1771 - if (result.done) { 1772 - return results; 3322 + if (Error.captureStackTrace) { 3323 + Error.captureStackTrace(this, this.constructor); 1773 3324 } 1774 3325 1775 - let earlyExit = false; 1776 - 1777 - function done() { 1778 - earlyExit = true; 1779 - } 1780 - 1781 - results = results.concat(mapFn ? mapFn(result.value, done) : result.value.data); 1782 - 1783 - if (earlyExit) { 1784 - return results; 1785 - } 1786 - 1787 - return gather(octokit, results, iterator, mapFn); 1788 - }); 1789 - } 1790 - 1791 - /** 1792 - * @param octokit Octokit instance 1793 - * @param options Options passed to Octokit constructor 1794 - */ 1795 - 1796 - function paginateRest(octokit) { 1797 - return { 1798 - paginate: Object.assign(paginate.bind(null, octokit), { 1799 - iterator: iterator.bind(null, octokit) 1800 - }) 1801 - }; 1802 - } 1803 - paginateRest.VERSION = VERSION; 1804 - 1805 - exports.paginateRest = paginateRest; 1806 - //# sourceMappingURL=index.js.map 1807 - 1808 - 1809 - /***/ }), 1810 - 1811 - /***/ 211: 1812 - /***/ (function(module) { 1813 - 1814 - module.exports = require("https"); 1815 - 1816 - /***/ }), 1817 - 1818 - /***/ 219: 1819 - /***/ (function(__unusedmodule, exports, __webpack_require__) { 1820 - 1821 - "use strict"; 1822 - 1823 - 1824 - var net = __webpack_require__(631); 1825 - var tls = __webpack_require__(16); 1826 - var http = __webpack_require__(605); 1827 - var https = __webpack_require__(211); 1828 - var events = __webpack_require__(614); 1829 - var assert = __webpack_require__(357); 1830 - var util = __webpack_require__(669); 1831 - 1832 - 1833 - exports.httpOverHttp = httpOverHttp; 1834 - exports.httpsOverHttp = httpsOverHttp; 1835 - exports.httpOverHttps = httpOverHttps; 1836 - exports.httpsOverHttps = httpsOverHttps; 1837 - 1838 - 1839 - function httpOverHttp(options) { 1840 - var agent = new TunnelingAgent(options); 1841 - agent.request = http.request; 1842 - return agent; 1843 - } 1844 - 1845 - function httpsOverHttp(options) { 1846 - var agent = new TunnelingAgent(options); 1847 - agent.request = http.request; 1848 - agent.createSocket = createSecureSocket; 1849 - agent.defaultPort = 443; 1850 - return agent; 1851 - } 1852 - 1853 - function httpOverHttps(options) { 1854 - var agent = new TunnelingAgent(options); 1855 - agent.request = https.request; 1856 - return agent; 1857 - } 1858 - 1859 - function httpsOverHttps(options) { 1860 - var agent = new TunnelingAgent(options); 1861 - agent.request = https.request; 1862 - agent.createSocket = createSecureSocket; 1863 - agent.defaultPort = 443; 1864 - return agent; 1865 - } 1866 - 1867 - 1868 - function TunnelingAgent(options) { 1869 - var self = this; 1870 - self.options = options || {}; 1871 - self.proxyOptions = self.options.proxy || {}; 1872 - self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; 1873 - self.requests = []; 1874 - self.sockets = []; 1875 - 1876 - self.on('free', function onFree(socket, host, port, localAddress) { 1877 - var options = toOptions(host, port, localAddress); 1878 - for (var i = 0, len = self.requests.length; i < len; ++i) { 1879 - var pending = self.requests[i]; 1880 - if (pending.host === options.host && pending.port === options.port) { 1881 - // Detect the request to connect same origin server, 1882 - // reuse the connection. 1883 - self.requests.splice(i, 1); 1884 - pending.request.onSocket(socket); 1885 - return; 3326 + this.name = "HttpError"; 3327 + this.status = statusCode; 3328 + Object.defineProperty(this, "code", { 3329 + get() { 3330 + logOnce(new deprecation.Deprecation("[@octokit/request-error] `error.code` is deprecated, use `error.status`.")); 3331 + return statusCode; 1886 3332 } 1887 - } 1888 - socket.destroy(); 1889 - self.removeSocket(socket); 1890 - }); 1891 - } 1892 - util.inherits(TunnelingAgent, events.EventEmitter); 1893 3333 1894 - TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { 1895 - var self = this; 1896 - var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); 1897 - 1898 - if (self.sockets.length >= this.maxSockets) { 1899 - // We are over limit so we'll add it to the queue. 1900 - self.requests.push(options); 1901 - return; 1902 - } 1903 - 1904 - // If we are under maxSockets create a new one. 1905 - self.createSocket(options, function(socket) { 1906 - socket.on('free', onFree); 1907 - socket.on('close', onCloseOrRemove); 1908 - socket.on('agentRemove', onCloseOrRemove); 1909 - req.onSocket(socket); 1910 - 1911 - function onFree() { 1912 - self.emit('free', socket, options); 1913 - } 1914 - 1915 - function onCloseOrRemove(err) { 1916 - self.removeSocket(socket); 1917 - socket.removeListener('free', onFree); 1918 - socket.removeListener('close', onCloseOrRemove); 1919 - socket.removeListener('agentRemove', onCloseOrRemove); 1920 - } 1921 - }); 1922 - }; 1923 - 1924 - TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { 1925 - var self = this; 1926 - var placeholder = {}; 1927 - self.sockets.push(placeholder); 1928 - 1929 - var connectOptions = mergeOptions({}, self.proxyOptions, { 1930 - method: 'CONNECT', 1931 - path: options.host + ':' + options.port, 1932 - agent: false, 1933 - headers: { 1934 - host: options.host + ':' + options.port 1935 - } 1936 - }); 1937 - if (options.localAddress) { 1938 - connectOptions.localAddress = options.localAddress; 1939 - } 1940 - if (connectOptions.proxyAuth) { 1941 - connectOptions.headers = connectOptions.headers || {}; 1942 - connectOptions.headers['Proxy-Authorization'] = 'Basic ' + 1943 - new Buffer(connectOptions.proxyAuth).toString('base64'); 1944 - } 1945 - 1946 - debug('making CONNECT request'); 1947 - var connectReq = self.request(connectOptions); 1948 - connectReq.useChunkedEncodingByDefault = false; // for v0.6 1949 - connectReq.once('response', onResponse); // for v0.6 1950 - connectReq.once('upgrade', onUpgrade); // for v0.6 1951 - connectReq.once('connect', onConnect); // for v0.7 or later 1952 - connectReq.once('error', onError); 1953 - connectReq.end(); 1954 - 1955 - function onResponse(res) { 1956 - // Very hacky. This is necessary to avoid http-parser leaks. 1957 - res.upgrade = true; 1958 - } 1959 - 1960 - function onUpgrade(res, socket, head) { 1961 - // Hacky. 1962 - process.nextTick(function() { 1963 - onConnect(res, socket, head); 1964 3334 }); 1965 - } 3335 + this.headers = options.headers || {}; // redact request credentials without mutating original request options 1966 3336 1967 - function onConnect(res, socket, head) { 1968 - connectReq.removeAllListeners(); 1969 - socket.removeAllListeners(); 3337 + const requestCopy = Object.assign({}, options.request); 1970 3338 1971 - if (res.statusCode !== 200) { 1972 - debug('tunneling socket could not be established, statusCode=%d', 1973 - res.statusCode); 1974 - socket.destroy(); 1975 - var error = new Error('tunneling socket could not be established, ' + 1976 - 'statusCode=' + res.statusCode); 1977 - error.code = 'ECONNRESET'; 1978 - options.request.emit('error', error); 1979 - self.removeSocket(placeholder); 1980 - return; 1981 - } 1982 - if (head.length > 0) { 1983 - debug('got illegal response body from proxy'); 1984 - socket.destroy(); 1985 - var error = new Error('got illegal response body from proxy'); 1986 - error.code = 'ECONNRESET'; 1987 - options.request.emit('error', error); 1988 - self.removeSocket(placeholder); 1989 - return; 3339 + if (options.request.headers.authorization) { 3340 + requestCopy.headers = Object.assign({}, options.request.headers, { 3341 + authorization: options.request.headers.authorization.replace(/ .*$/, " [REDACTED]") 3342 + }); 1990 3343 } 1991 - debug('tunneling connection has established'); 1992 - self.sockets[self.sockets.indexOf(placeholder)] = socket; 1993 - return cb(socket); 1994 - } 1995 - 1996 - function onError(cause) { 1997 - connectReq.removeAllListeners(); 1998 3344 1999 - debug('tunneling socket could not be established, cause=%s\n', 2000 - cause.message, cause.stack); 2001 - var error = new Error('tunneling socket could not be established, ' + 2002 - 'cause=' + cause.message); 2003 - error.code = 'ECONNRESET'; 2004 - options.request.emit('error', error); 2005 - self.removeSocket(placeholder); 2006 - } 2007 - }; 2008 - 2009 - TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { 2010 - var pos = this.sockets.indexOf(socket) 2011 - if (pos === -1) { 2012 - return; 2013 - } 2014 - this.sockets.splice(pos, 1); 2015 - 2016 - var pending = this.requests.shift(); 2017 - if (pending) { 2018 - // If we have pending requests and a socket gets closed a new one 2019 - // needs to be created to take over in the pool for the one that closed. 2020 - this.createSocket(pending, function(socket) { 2021 - pending.request.onSocket(socket); 2022 - }); 3345 + requestCopy.url = requestCopy.url // client_id & client_secret can be passed as URL query parameters to increase rate limit 3346 + // see https://developer.github.com/v3/#increasing-the-unauthenticated-rate-limit-for-oauth-applications 3347 + .replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]") // OAuth tokens can be passed as URL query parameters, although it is not recommended 3348 + // see https://developer.github.com/v3/#oauth2-token-sent-in-a-header 3349 + .replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); 3350 + this.request = requestCopy; 2023 3351 } 2024 - }; 2025 3352 2026 - function createSecureSocket(options, cb) { 2027 - var self = this; 2028 - TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { 2029 - var hostHeader = options.request.getHeader('host'); 2030 - var tlsOptions = mergeOptions({}, self.options, { 2031 - socket: socket, 2032 - servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host 2033 - }); 2034 - 2035 - // 0 is dummy port for v0.6 2036 - var secureSocket = tls.connect(0, tlsOptions); 2037 - self.sockets[self.sockets.indexOf(socket)] = secureSocket; 2038 - cb(secureSocket); 2039 - }); 2040 3353 } 2041 3354 2042 - 2043 - function toOptions(host, port, localAddress) { 2044 - if (typeof host === 'string') { // since v0.10 2045 - return { 2046 - host: host, 2047 - port: port, 2048 - localAddress: localAddress 2049 - }; 2050 - } 2051 - return host; // for v0.11 or later 2052 - } 2053 - 2054 - function mergeOptions(target) { 2055 - for (var i = 1, len = arguments.length; i < len; ++i) { 2056 - var overrides = arguments[i]; 2057 - if (typeof overrides === 'object') { 2058 - var keys = Object.keys(overrides); 2059 - for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { 2060 - var k = keys[j]; 2061 - if (overrides[k] !== undefined) { 2062 - target[k] = overrides[k]; 2063 - } 2064 - } 2065 - } 2066 - } 2067 - return target; 2068 - } 2069 - 2070 - 2071 - var debug; 2072 - if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { 2073 - debug = function() { 2074 - var args = Array.prototype.slice.call(arguments); 2075 - if (typeof args[0] === 'string') { 2076 - args[0] = 'TUNNEL: ' + args[0]; 2077 - } else { 2078 - args.unshift('TUNNEL:'); 2079 - } 2080 - console.error.apply(console, args); 2081 - } 2082 - } else { 2083 - debug = function() {}; 2084 - } 2085 - exports.debug = debug; // for test 2086 - 2087 - 2088 - /***/ }), 2089 - 2090 - /***/ 223: 2091 - /***/ (function(module, __unusedexports, __webpack_require__) { 2092 - 2093 - var wrappy = __webpack_require__(940) 2094 - module.exports = wrappy(once) 2095 - module.exports.strict = wrappy(onceStrict) 2096 - 2097 - once.proto = once(function () { 2098 - Object.defineProperty(Function.prototype, 'once', { 2099 - value: function () { 2100 - return once(this) 2101 - }, 2102 - configurable: true 2103 - }) 2104 - 2105 - Object.defineProperty(Function.prototype, 'onceStrict', { 2106 - value: function () { 2107 - return onceStrict(this) 2108 - }, 2109 - configurable: true 2110 - }) 2111 - }) 2112 - 2113 - function once (fn) { 2114 - var f = function () { 2115 - if (f.called) return f.value 2116 - f.called = true 2117 - return f.value = fn.apply(this, arguments) 2118 - } 2119 - f.called = false 2120 - return f 2121 - } 2122 - 2123 - function onceStrict (fn) { 2124 - var f = function () { 2125 - if (f.called) 2126 - throw new Error(f.onceError) 2127 - f.called = true 2128 - return f.value = fn.apply(this, arguments) 2129 - } 2130 - var name = fn.name || 'Function wrapped with `once`' 2131 - f.onceError = name + " shouldn't be called more than once" 2132 - f.called = false 2133 - return f 2134 - } 3355 + exports.RequestError = RequestError; 3356 + //# sourceMappingURL=index.js.map 2135 3357 2136 3358 2137 3359 /***/ }), 2138 3360 2139 3361 /***/ 234: 2140 - /***/ (function(__unusedmodule, exports, __webpack_require__) { 3362 + /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 2141 3363 2142 3364 "use strict"; 2143 3365 2144 3366 2145 - Object.defineProperty(exports, '__esModule', { value: true }); 3367 + Object.defineProperty(exports, "__esModule", ({ value: true })); 2146 3368 2147 3369 function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } 2148 3370 2149 - var endpoint = __webpack_require__(440); 2150 - var universalUserAgent = __webpack_require__(429); 2151 - var isPlainObject = _interopDefault(__webpack_require__(840)); 2152 - var nodeFetch = _interopDefault(__webpack_require__(467)); 2153 - var requestError = __webpack_require__(537); 3371 + var endpoint = __nccwpck_require__(440); 3372 + var universalUserAgent = __nccwpck_require__(429); 3373 + var isPlainObject = _interopDefault(__nccwpck_require__(840)); 3374 + var nodeFetch = _interopDefault(__nccwpck_require__(467)); 3375 + var requestError = __nccwpck_require__(537); 2154 3376 2155 3377 const VERSION = "5.4.7"; 2156 3378 ··· 2292 3514 2293 3515 /***/ }), 2294 3516 2295 - /***/ 282: 2296 - /***/ (function(module) { 2297 - 2298 - module.exports = require("module"); 2299 - 2300 - /***/ }), 2301 - 2302 - /***/ 294: 2303 - /***/ (function(module, __unusedexports, __webpack_require__) { 2304 - 2305 - module.exports = __webpack_require__(219); 2306 - 2307 - 2308 - /***/ }), 2309 - 2310 - /***/ 334: 2311 - /***/ (function(__unusedmodule, exports) { 2312 - 2313 - "use strict"; 2314 - 2315 - 2316 - Object.defineProperty(exports, '__esModule', { value: true }); 2317 - 2318 - async function auth(token) { 2319 - const tokenType = token.split(/\./).length === 3 ? "app" : /^v\d+\./.test(token) ? "installation" : "oauth"; 2320 - return { 2321 - type: "token", 2322 - token: token, 2323 - tokenType 2324 - }; 2325 - } 2326 - 2327 - /** 2328 - * Prefix token for usage in the Authorization header 2329 - * 2330 - * @param token OAuth token or JSON Web Token 2331 - */ 2332 - function withAuthorizationPrefix(token) { 2333 - if (token.split(/\./).length === 3) { 2334 - return `bearer ${token}`; 2335 - } 2336 - 2337 - return `token ${token}`; 2338 - } 2339 - 2340 - async function hook(token, request, route, parameters) { 2341 - const endpoint = request.endpoint.merge(route, parameters); 2342 - endpoint.headers.authorization = withAuthorizationPrefix(token); 2343 - return request(endpoint); 2344 - } 2345 - 2346 - const createTokenAuth = function createTokenAuth(token) { 2347 - if (!token) { 2348 - throw new Error("[@octokit/auth-token] No token passed to createTokenAuth"); 2349 - } 2350 - 2351 - if (typeof token !== "string") { 2352 - throw new Error("[@octokit/auth-token] Token passed to createTokenAuth is not a string"); 2353 - } 2354 - 2355 - token = token.replace(/^(token|bearer) +/i, ""); 2356 - return Object.assign(auth.bind(null, token), { 2357 - hook: hook.bind(null, token) 2358 - }); 2359 - }; 2360 - 2361 - exports.createTokenAuth = createTokenAuth; 2362 - //# sourceMappingURL=index.js.map 2363 - 2364 - 2365 - /***/ }), 2366 - 2367 - /***/ 351: 2368 - /***/ (function(__unusedmodule, exports, __webpack_require__) { 2369 - 2370 - "use strict"; 2371 - 2372 - var __importStar = (this && this.__importStar) || function (mod) { 2373 - if (mod && mod.__esModule) return mod; 2374 - var result = {}; 2375 - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 2376 - result["default"] = mod; 2377 - return result; 2378 - }; 2379 - Object.defineProperty(exports, "__esModule", { value: true }); 2380 - const os = __importStar(__webpack_require__(87)); 2381 - /** 2382 - * Commands 2383 - * 2384 - * Command Format: 2385 - * ::name key=value,key=value::message 2386 - * 2387 - * Examples: 2388 - * ::warning::This is the message 2389 - * ::set-env name=MY_VAR::some value 2390 - */ 2391 - function issueCommand(command, properties, message) { 2392 - const cmd = new Command(command, properties, message); 2393 - process.stdout.write(cmd.toString() + os.EOL); 2394 - } 2395 - exports.issueCommand = issueCommand; 2396 - function issue(name, message = '') { 2397 - issueCommand(name, {}, message); 2398 - } 2399 - exports.issue = issue; 2400 - const CMD_STRING = '::'; 2401 - class Command { 2402 - constructor(command, properties, message) { 2403 - if (!command) { 2404 - command = 'missing.command'; 2405 - } 2406 - this.command = command; 2407 - this.properties = properties; 2408 - this.message = message; 2409 - } 2410 - toString() { 2411 - let cmdStr = CMD_STRING + this.command; 2412 - if (this.properties && Object.keys(this.properties).length > 0) { 2413 - cmdStr += ' '; 2414 - let first = true; 2415 - for (const key in this.properties) { 2416 - if (this.properties.hasOwnProperty(key)) { 2417 - const val = this.properties[key]; 2418 - if (val) { 2419 - if (first) { 2420 - first = false; 2421 - } 2422 - else { 2423 - cmdStr += ','; 2424 - } 2425 - cmdStr += `${key}=${escapeProperty(val)}`; 2426 - } 2427 - } 2428 - } 2429 - } 2430 - cmdStr += `${CMD_STRING}${escapeData(this.message)}`; 2431 - return cmdStr; 2432 - } 2433 - } 2434 - /** 2435 - * Sanitizes an input into a string so it can be passed into issueCommand safely 2436 - * @param input input to sanitize into a string 2437 - */ 2438 - function toCommandValue(input) { 2439 - if (input === null || input === undefined) { 2440 - return ''; 2441 - } 2442 - else if (typeof input === 'string' || input instanceof String) { 2443 - return input; 2444 - } 2445 - return JSON.stringify(input); 2446 - } 2447 - exports.toCommandValue = toCommandValue; 2448 - function escapeData(s) { 2449 - return toCommandValue(s) 2450 - .replace(/%/g, '%25') 2451 - .replace(/\r/g, '%0D') 2452 - .replace(/\n/g, '%0A'); 2453 - } 2454 - function escapeProperty(s) { 2455 - return toCommandValue(s) 2456 - .replace(/%/g, '%25') 2457 - .replace(/\r/g, '%0D') 2458 - .replace(/\n/g, '%0A') 2459 - .replace(/:/g, '%3A') 2460 - .replace(/,/g, '%2C'); 2461 - } 2462 - //# sourceMappingURL=command.js.map 2463 - 2464 - /***/ }), 2465 - 2466 - /***/ 357: 2467 - /***/ (function(module) { 2468 - 2469 - module.exports = require("assert"); 2470 - 2471 - /***/ }), 2472 - 2473 - /***/ 413: 2474 - /***/ (function(module) { 2475 - 2476 - module.exports = require("stream"); 2477 - 2478 - /***/ }), 2479 - 2480 - /***/ 429: 2481 - /***/ (function(__unusedmodule, exports) { 2482 - 2483 - "use strict"; 2484 - 2485 - 2486 - Object.defineProperty(exports, '__esModule', { value: true }); 2487 - 2488 - function getUserAgent() { 2489 - if (typeof navigator === "object" && "userAgent" in navigator) { 2490 - return navigator.userAgent; 2491 - } 2492 - 2493 - if (typeof process === "object" && "version" in process) { 2494 - return `Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`; 2495 - } 2496 - 2497 - return "<environment undetectable>"; 2498 - } 2499 - 2500 - exports.getUserAgent = getUserAgent; 2501 - //# sourceMappingURL=index.js.map 2502 - 2503 - 2504 - /***/ }), 2505 - 2506 - /***/ 438: 2507 - /***/ (function(__unusedmodule, exports, __webpack_require__) { 2508 - 2509 - "use strict"; 2510 - 2511 - var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 2512 - if (k2 === undefined) k2 = k; 2513 - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 2514 - }) : (function(o, m, k, k2) { 2515 - if (k2 === undefined) k2 = k; 2516 - o[k2] = m[k]; 2517 - })); 2518 - var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 2519 - Object.defineProperty(o, "default", { enumerable: true, value: v }); 2520 - }) : function(o, v) { 2521 - o["default"] = v; 2522 - }); 2523 - var __importStar = (this && this.__importStar) || function (mod) { 2524 - if (mod && mod.__esModule) return mod; 2525 - var result = {}; 2526 - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 2527 - __setModuleDefault(result, mod); 2528 - return result; 2529 - }; 2530 - Object.defineProperty(exports, "__esModule", { value: true }); 2531 - exports.getOctokit = exports.context = void 0; 2532 - const Context = __importStar(__webpack_require__(53)); 2533 - const utils_1 = __webpack_require__(30); 2534 - exports.context = new Context.Context(); 2535 - /** 2536 - * Returns a hydrated octokit ready to use for GitHub Actions 2537 - * 2538 - * @param token the repo PAT or GITHUB_TOKEN 2539 - * @param options other options to set 2540 - */ 2541 - function getOctokit(token, options) { 2542 - return new utils_1.GitHub(utils_1.getOctokitOptions(token, options)); 2543 - } 2544 - exports.getOctokit = getOctokit; 2545 - //# sourceMappingURL=github.js.map 2546 - 2547 - /***/ }), 2548 - 2549 - /***/ 440: 2550 - /***/ (function(__unusedmodule, exports, __webpack_require__) { 2551 - 2552 - "use strict"; 2553 - 2554 - 2555 - Object.defineProperty(exports, '__esModule', { value: true }); 2556 - 2557 - function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } 2558 - 2559 - var isPlainObject = _interopDefault(__webpack_require__(840)); 2560 - var universalUserAgent = __webpack_require__(429); 2561 - 2562 - function lowercaseKeys(object) { 2563 - if (!object) { 2564 - return {}; 2565 - } 2566 - 2567 - return Object.keys(object).reduce((newObj, key) => { 2568 - newObj[key.toLowerCase()] = object[key]; 2569 - return newObj; 2570 - }, {}); 2571 - } 2572 - 2573 - function mergeDeep(defaults, options) { 2574 - const result = Object.assign({}, defaults); 2575 - Object.keys(options).forEach(key => { 2576 - if (isPlainObject(options[key])) { 2577 - if (!(key in defaults)) Object.assign(result, { 2578 - [key]: options[key] 2579 - });else result[key] = mergeDeep(defaults[key], options[key]); 2580 - } else { 2581 - Object.assign(result, { 2582 - [key]: options[key] 2583 - }); 2584 - } 2585 - }); 2586 - return result; 2587 - } 2588 - 2589 - function merge(defaults, route, options) { 2590 - if (typeof route === "string") { 2591 - let [method, url] = route.split(" "); 2592 - options = Object.assign(url ? { 2593 - method, 2594 - url 2595 - } : { 2596 - url: method 2597 - }, options); 2598 - } else { 2599 - options = Object.assign({}, route); 2600 - } // lowercase header names before merging with defaults to avoid duplicates 3517 + /***/ 682: 3518 + /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { 2601 3519 2602 - 2603 - options.headers = lowercaseKeys(options.headers); 2604 - const mergedOptions = mergeDeep(defaults || {}, options); // mediaType.previews arrays are merged, instead of overwritten 2605 - 2606 - if (defaults && defaults.mediaType.previews.length) { 2607 - mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(preview => !mergedOptions.mediaType.previews.includes(preview)).concat(mergedOptions.mediaType.previews); 2608 - } 2609 - 2610 - mergedOptions.mediaType.previews = mergedOptions.mediaType.previews.map(preview => preview.replace(/-preview/, "")); 2611 - return mergedOptions; 2612 - } 2613 - 2614 - function addQueryParameters(url, parameters) { 2615 - const separator = /\?/.test(url) ? "&" : "?"; 2616 - const names = Object.keys(parameters); 2617 - 2618 - if (names.length === 0) { 2619 - return url; 2620 - } 2621 - 2622 - return url + separator + names.map(name => { 2623 - if (name === "q") { 2624 - return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); 2625 - } 2626 - 2627 - return `${name}=${encodeURIComponent(parameters[name])}`; 2628 - }).join("&"); 2629 - } 2630 - 2631 - const urlVariableRegex = /\{[^}]+\}/g; 2632 - 2633 - function removeNonChars(variableName) { 2634 - return variableName.replace(/^\W+|\W+$/g, "").split(/,/); 2635 - } 2636 - 2637 - function extractUrlVariableNames(url) { 2638 - const matches = url.match(urlVariableRegex); 2639 - 2640 - if (!matches) { 2641 - return []; 2642 - } 2643 - 2644 - return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []); 2645 - } 2646 - 2647 - function omit(object, keysToOmit) { 2648 - return Object.keys(object).filter(option => !keysToOmit.includes(option)).reduce((obj, key) => { 2649 - obj[key] = object[key]; 2650 - return obj; 2651 - }, {}); 2652 - } 2653 - 2654 - // Based on https://github.com/bramstein/url-template, licensed under BSD 2655 - // TODO: create separate package. 2656 - // 2657 - // Copyright (c) 2012-2014, Bram Stein 2658 - // All rights reserved. 2659 - // Redistribution and use in source and binary forms, with or without 2660 - // modification, are permitted provided that the following conditions 2661 - // are met: 2662 - // 1. Redistributions of source code must retain the above copyright 2663 - // notice, this list of conditions and the following disclaimer. 2664 - // 2. Redistributions in binary form must reproduce the above copyright 2665 - // notice, this list of conditions and the following disclaimer in the 2666 - // documentation and/or other materials provided with the distribution. 2667 - // 3. The name of the author may not be used to endorse or promote products 2668 - // derived from this software without specific prior written permission. 2669 - // THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 2670 - // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 2671 - // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 2672 - // EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 2673 - // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 2674 - // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2675 - // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 2676 - // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 2677 - // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 2678 - // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3520 + var register = __nccwpck_require__(670) 3521 + var addHook = __nccwpck_require__(549) 3522 + var removeHook = __nccwpck_require__(819) 2679 3523 2680 - /* istanbul ignore file */ 2681 - function encodeReserved(str) { 2682 - return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) { 2683 - if (!/%[0-9A-Fa-f]/.test(part)) { 2684 - part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); 2685 - } 3524 + // bind with array of arguments: https://stackoverflow.com/a/21792913 3525 + var bind = Function.bind 3526 + var bindable = bind.bind(bind) 2686 3527 2687 - return part; 2688 - }).join(""); 2689 - } 3528 + function bindApi (hook, state, name) { 3529 + var removeHookRef = bindable(removeHook, null).apply(null, name ? [state, name] : [state]) 3530 + hook.api = { remove: removeHookRef } 3531 + hook.remove = removeHookRef 2690 3532 2691 - function encodeUnreserved(str) { 2692 - return encodeURIComponent(str).replace(/[!'()*]/g, function (c) { 2693 - return "%" + c.charCodeAt(0).toString(16).toUpperCase(); 2694 - }); 3533 + ;['before', 'error', 'after', 'wrap'].forEach(function (kind) { 3534 + var args = name ? [state, kind, name] : [state, kind] 3535 + hook[kind] = hook.api[kind] = bindable(addHook, null).apply(null, args) 3536 + }) 2695 3537 } 2696 3538 2697 - function encodeValue(operator, value, key) { 2698 - value = operator === "+" || operator === "#" ? encodeReserved(value) : encodeUnreserved(value); 2699 - 2700 - if (key) { 2701 - return encodeUnreserved(key) + "=" + value; 2702 - } else { 2703 - return value; 3539 + function HookSingular () { 3540 + var singularHookName = 'h' 3541 + var singularHookState = { 3542 + registry: {} 2704 3543 } 2705 - } 2706 - 2707 - function isDefined(value) { 2708 - return value !== undefined && value !== null; 3544 + var singularHook = register.bind(null, singularHookState, singularHookName) 3545 + bindApi(singularHook, singularHookState, singularHookName) 3546 + return singularHook 2709 3547 } 2710 3548 2711 - function isKeyOperator(operator) { 2712 - return operator === ";" || operator === "&" || operator === "?"; 2713 - } 2714 - 2715 - function getValues(context, operator, key, modifier) { 2716 - var value = context[key], 2717 - result = []; 2718 - 2719 - if (isDefined(value) && value !== "") { 2720 - if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { 2721 - value = value.toString(); 2722 - 2723 - if (modifier && modifier !== "*") { 2724 - value = value.substring(0, parseInt(modifier, 10)); 2725 - } 2726 - 2727 - result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : "")); 2728 - } else { 2729 - if (modifier === "*") { 2730 - if (Array.isArray(value)) { 2731 - value.filter(isDefined).forEach(function (value) { 2732 - result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : "")); 2733 - }); 2734 - } else { 2735 - Object.keys(value).forEach(function (k) { 2736 - if (isDefined(value[k])) { 2737 - result.push(encodeValue(operator, value[k], k)); 2738 - } 2739 - }); 2740 - } 2741 - } else { 2742 - const tmp = []; 2743 - 2744 - if (Array.isArray(value)) { 2745 - value.filter(isDefined).forEach(function (value) { 2746 - tmp.push(encodeValue(operator, value)); 2747 - }); 2748 - } else { 2749 - Object.keys(value).forEach(function (k) { 2750 - if (isDefined(value[k])) { 2751 - tmp.push(encodeUnreserved(k)); 2752 - tmp.push(encodeValue(operator, value[k].toString())); 2753 - } 2754 - }); 2755 - } 2756 - 2757 - if (isKeyOperator(operator)) { 2758 - result.push(encodeUnreserved(key) + "=" + tmp.join(",")); 2759 - } else if (tmp.length !== 0) { 2760 - result.push(tmp.join(",")); 2761 - } 2762 - } 2763 - } 2764 - } else { 2765 - if (operator === ";") { 2766 - if (isDefined(value)) { 2767 - result.push(encodeUnreserved(key)); 2768 - } 2769 - } else if (value === "" && (operator === "&" || operator === "?")) { 2770 - result.push(encodeUnreserved(key) + "="); 2771 - } else if (value === "") { 2772 - result.push(""); 2773 - } 3549 + function HookCollection () { 3550 + var state = { 3551 + registry: {} 2774 3552 } 2775 3553 2776 - return result; 2777 - } 2778 - 2779 - function parseUrl(template) { 2780 - return { 2781 - expand: expand.bind(null, template) 2782 - }; 2783 - } 2784 - 2785 - function expand(template, context) { 2786 - var operators = ["+", "#", ".", "/", ";", "?", "&"]; 2787 - return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function (_, expression, literal) { 2788 - if (expression) { 2789 - let operator = ""; 2790 - const values = []; 2791 - 2792 - if (operators.indexOf(expression.charAt(0)) !== -1) { 2793 - operator = expression.charAt(0); 2794 - expression = expression.substr(1); 2795 - } 2796 - 2797 - expression.split(/,/g).forEach(function (variable) { 2798 - var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); 2799 - values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3])); 2800 - }); 2801 - 2802 - if (operator && operator !== "+") { 2803 - var separator = ","; 2804 - 2805 - if (operator === "?") { 2806 - separator = "&"; 2807 - } else if (operator !== "#") { 2808 - separator = operator; 2809 - } 3554 + var hook = register.bind(null, state) 3555 + bindApi(hook, state) 2810 3556 2811 - return (values.length !== 0 ? operator : "") + values.join(separator); 2812 - } else { 2813 - return values.join(","); 2814 - } 2815 - } else { 2816 - return encodeReserved(literal); 2817 - } 2818 - }); 3557 + return hook 2819 3558 } 2820 3559 2821 - function parse(options) { 2822 - // https://fetch.spec.whatwg.org/#methods 2823 - let method = options.method.toUpperCase(); // replace :varname with {varname} to make it RFC 6570 compatible 2824 - 2825 - let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{+$1}"); 2826 - let headers = Object.assign({}, options.headers); 2827 - let body; 2828 - let parameters = omit(options, ["method", "baseUrl", "url", "headers", "request", "mediaType"]); // extract variable names from URL to calculate remaining variables later 2829 - 2830 - const urlVariableNames = extractUrlVariableNames(url); 2831 - url = parseUrl(url).expand(parameters); 2832 - 2833 - if (!/^http/.test(url)) { 2834 - url = options.baseUrl + url; 3560 + var collectionHookDeprecationMessageDisplayed = false 3561 + function Hook () { 3562 + if (!collectionHookDeprecationMessageDisplayed) { 3563 + console.warn('[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4') 3564 + collectionHookDeprecationMessageDisplayed = true 2835 3565 } 2836 - 2837 - const omittedParameters = Object.keys(options).filter(option => urlVariableNames.includes(option)).concat("baseUrl"); 2838 - const remainingParameters = omit(parameters, omittedParameters); 2839 - const isBinaryRequset = /application\/octet-stream/i.test(headers.accept); 2840 - 2841 - if (!isBinaryRequset) { 2842 - if (options.mediaType.format) { 2843 - // e.g. application/vnd.github.v3+json => application/vnd.github.v3.raw 2844 - headers.accept = headers.accept.split(/,/).map(preview => preview.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, `application/vnd$1$2.${options.mediaType.format}`)).join(","); 2845 - } 2846 - 2847 - if (options.mediaType.previews.length) { 2848 - const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; 2849 - headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map(preview => { 2850 - const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; 2851 - return `application/vnd.github.${preview}-preview${format}`; 2852 - }).join(","); 2853 - } 2854 - } // for GET/HEAD requests, set URL query parameters from remaining parameters 2855 - // for PATCH/POST/PUT/DELETE requests, set request body from remaining parameters 2856 - 2857 - 2858 - if (["GET", "HEAD"].includes(method)) { 2859 - url = addQueryParameters(url, remainingParameters); 2860 - } else { 2861 - if ("data" in remainingParameters) { 2862 - body = remainingParameters.data; 2863 - } else { 2864 - if (Object.keys(remainingParameters).length) { 2865 - body = remainingParameters; 2866 - } else { 2867 - headers["content-length"] = 0; 2868 - } 2869 - } 2870 - } // default content-type for JSON if body is set 2871 - 2872 - 2873 - if (!headers["content-type"] && typeof body !== "undefined") { 2874 - headers["content-type"] = "application/json; charset=utf-8"; 2875 - } // GitHub expects 'content-length: 0' header for PUT/PATCH requests without body. 2876 - // fetch does not allow to set `content-length` header, but we can set body to an empty string 2877 - 2878 - 2879 - if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { 2880 - body = ""; 2881 - } // Only return body/request keys if present 2882 - 2883 - 2884 - return Object.assign({ 2885 - method, 2886 - url, 2887 - headers 2888 - }, typeof body !== "undefined" ? { 2889 - body 2890 - } : null, options.request ? { 2891 - request: options.request 2892 - } : null); 3566 + return HookCollection() 2893 3567 } 2894 3568 2895 - function endpointWithDefaults(defaults, route, options) { 2896 - return parse(merge(defaults, route, options)); 2897 - } 3569 + Hook.Singular = HookSingular.bind() 3570 + Hook.Collection = HookCollection.bind() 2898 3571 2899 - function withDefaults(oldDefaults, newDefaults) { 2900 - const DEFAULTS = merge(oldDefaults, newDefaults); 2901 - const endpoint = endpointWithDefaults.bind(null, DEFAULTS); 2902 - return Object.assign(endpoint, { 2903 - DEFAULTS, 2904 - defaults: withDefaults.bind(null, DEFAULTS), 2905 - merge: merge.bind(null, DEFAULTS), 2906 - parse 2907 - }); 2908 - } 2909 - 2910 - const VERSION = "6.0.5"; 2911 - 2912 - const userAgent = `octokit-endpoint.js/${VERSION} ${universalUserAgent.getUserAgent()}`; // DEFAULTS has all properties set that EndpointOptions has, except url. 2913 - // So we use RequestParameters and add method as additional required property. 2914 - 2915 - const DEFAULTS = { 2916 - method: "GET", 2917 - baseUrl: "https://api.github.com", 2918 - headers: { 2919 - accept: "application/vnd.github.v3+json", 2920 - "user-agent": userAgent 2921 - }, 2922 - mediaType: { 2923 - format: "", 2924 - previews: [] 2925 - } 2926 - }; 2927 - 2928 - const endpoint = withDefaults(null, DEFAULTS); 2929 - 2930 - exports.endpoint = endpoint; 2931 - //# sourceMappingURL=index.js.map 2932 - 2933 - 2934 - /***/ }), 2935 - 2936 - /***/ 443: 2937 - /***/ (function(__unusedmodule, exports, __webpack_require__) { 2938 - 2939 - "use strict"; 2940 - 2941 - Object.defineProperty(exports, "__esModule", { value: true }); 2942 - const url = __webpack_require__(835); 2943 - function getProxyUrl(reqUrl) { 2944 - let usingSsl = reqUrl.protocol === 'https:'; 2945 - let proxyUrl; 2946 - if (checkBypass(reqUrl)) { 2947 - return proxyUrl; 2948 - } 2949 - let proxyVar; 2950 - if (usingSsl) { 2951 - proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY']; 2952 - } 2953 - else { 2954 - proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY']; 2955 - } 2956 - if (proxyVar) { 2957 - proxyUrl = url.parse(proxyVar); 2958 - } 2959 - return proxyUrl; 2960 - } 2961 - exports.getProxyUrl = getProxyUrl; 2962 - function checkBypass(reqUrl) { 2963 - if (!reqUrl.hostname) { 2964 - return false; 2965 - } 2966 - let noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; 2967 - if (!noProxy) { 2968 - return false; 2969 - } 2970 - // Determine the request port 2971 - let reqPort; 2972 - if (reqUrl.port) { 2973 - reqPort = Number(reqUrl.port); 2974 - } 2975 - else if (reqUrl.protocol === 'http:') { 2976 - reqPort = 80; 2977 - } 2978 - else if (reqUrl.protocol === 'https:') { 2979 - reqPort = 443; 2980 - } 2981 - // Format the request hostname and hostname with port 2982 - let upperReqHosts = [reqUrl.hostname.toUpperCase()]; 2983 - if (typeof reqPort === 'number') { 2984 - upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); 2985 - } 2986 - // Compare request host against noproxy 2987 - for (let upperNoProxyItem of noProxy 2988 - .split(',') 2989 - .map(x => x.trim().toUpperCase()) 2990 - .filter(x => x)) { 2991 - if (upperReqHosts.some(x => x === upperNoProxyItem)) { 2992 - return true; 2993 - } 2994 - } 2995 - return false; 2996 - } 2997 - exports.checkBypass = checkBypass; 2998 - 2999 - 3000 - /***/ }), 3001 - 3002 - /***/ 467: 3003 - /***/ (function(module, exports, __webpack_require__) { 3004 - 3005 - "use strict"; 3006 - 3007 - 3008 - Object.defineProperty(exports, '__esModule', { value: true }); 3009 - 3010 - function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } 3011 - 3012 - var Stream = _interopDefault(__webpack_require__(413)); 3013 - var http = _interopDefault(__webpack_require__(605)); 3014 - var Url = _interopDefault(__webpack_require__(835)); 3015 - var https = _interopDefault(__webpack_require__(211)); 3016 - var zlib = _interopDefault(__webpack_require__(761)); 3017 - 3018 - // Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js 3019 - 3020 - // fix for "Readable" isn't a named export issue 3021 - const Readable = Stream.Readable; 3022 - 3023 - const BUFFER = Symbol('buffer'); 3024 - const TYPE = Symbol('type'); 3025 - 3026 - class Blob { 3027 - constructor() { 3028 - this[TYPE] = ''; 3029 - 3030 - const blobParts = arguments[0]; 3031 - const options = arguments[1]; 3032 - 3033 - const buffers = []; 3034 - let size = 0; 3035 - 3036 - if (blobParts) { 3037 - const a = blobParts; 3038 - const length = Number(a.length); 3039 - for (let i = 0; i < length; i++) { 3040 - const element = a[i]; 3041 - let buffer; 3042 - if (element instanceof Buffer) { 3043 - buffer = element; 3044 - } else if (ArrayBuffer.isView(element)) { 3045 - buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); 3046 - } else if (element instanceof ArrayBuffer) { 3047 - buffer = Buffer.from(element); 3048 - } else if (element instanceof Blob) { 3049 - buffer = element[BUFFER]; 3050 - } else { 3051 - buffer = Buffer.from(typeof element === 'string' ? element : String(element)); 3052 - } 3053 - size += buffer.length; 3054 - buffers.push(buffer); 3055 - } 3056 - } 3057 - 3058 - this[BUFFER] = Buffer.concat(buffers); 3059 - 3060 - let type = options && options.type !== undefined && String(options.type).toLowerCase(); 3061 - if (type && !/[^\u0020-\u007E]/.test(type)) { 3062 - this[TYPE] = type; 3063 - } 3064 - } 3065 - get size() { 3066 - return this[BUFFER].length; 3067 - } 3068 - get type() { 3069 - return this[TYPE]; 3070 - } 3071 - text() { 3072 - return Promise.resolve(this[BUFFER].toString()); 3073 - } 3074 - arrayBuffer() { 3075 - const buf = this[BUFFER]; 3076 - const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); 3077 - return Promise.resolve(ab); 3078 - } 3079 - stream() { 3080 - const readable = new Readable(); 3081 - readable._read = function () {}; 3082 - readable.push(this[BUFFER]); 3083 - readable.push(null); 3084 - return readable; 3085 - } 3086 - toString() { 3087 - return '[object Blob]'; 3088 - } 3089 - slice() { 3090 - const size = this.size; 3091 - 3092 - const start = arguments[0]; 3093 - const end = arguments[1]; 3094 - let relativeStart, relativeEnd; 3095 - if (start === undefined) { 3096 - relativeStart = 0; 3097 - } else if (start < 0) { 3098 - relativeStart = Math.max(size + start, 0); 3099 - } else { 3100 - relativeStart = Math.min(start, size); 3101 - } 3102 - if (end === undefined) { 3103 - relativeEnd = size; 3104 - } else if (end < 0) { 3105 - relativeEnd = Math.max(size + end, 0); 3106 - } else { 3107 - relativeEnd = Math.min(end, size); 3108 - } 3109 - const span = Math.max(relativeEnd - relativeStart, 0); 3110 - 3111 - const buffer = this[BUFFER]; 3112 - const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); 3113 - const blob = new Blob([], { type: arguments[2] }); 3114 - blob[BUFFER] = slicedBuffer; 3115 - return blob; 3116 - } 3117 - } 3118 - 3119 - Object.defineProperties(Blob.prototype, { 3120 - size: { enumerable: true }, 3121 - type: { enumerable: true }, 3122 - slice: { enumerable: true } 3123 - }); 3124 - 3125 - Object.defineProperty(Blob.prototype, Symbol.toStringTag, { 3126 - value: 'Blob', 3127 - writable: false, 3128 - enumerable: false, 3129 - configurable: true 3130 - }); 3131 - 3132 - /** 3133 - * fetch-error.js 3134 - * 3135 - * FetchError interface for operational errors 3136 - */ 3137 - 3138 - /** 3139 - * Create FetchError instance 3140 - * 3141 - * @param String message Error message for human 3142 - * @param String type Error type for machine 3143 - * @param String systemError For Node.js system error 3144 - * @return FetchError 3145 - */ 3146 - function FetchError(message, type, systemError) { 3147 - Error.call(this, message); 3148 - 3149 - this.message = message; 3150 - this.type = type; 3151 - 3152 - // when err.type is `system`, err.code contains system error code 3153 - if (systemError) { 3154 - this.code = this.errno = systemError.code; 3155 - } 3156 - 3157 - // hide custom error implementation details from end-users 3158 - Error.captureStackTrace(this, this.constructor); 3159 - } 3160 - 3161 - FetchError.prototype = Object.create(Error.prototype); 3162 - FetchError.prototype.constructor = FetchError; 3163 - FetchError.prototype.name = 'FetchError'; 3164 - 3165 - let convert; 3166 - try { 3167 - convert = __webpack_require__(877).convert; 3168 - } catch (e) {} 3169 - 3170 - const INTERNALS = Symbol('Body internals'); 3171 - 3172 - // fix an issue where "PassThrough" isn't a named export for node <10 3173 - const PassThrough = Stream.PassThrough; 3174 - 3175 - /** 3176 - * Body mixin 3177 - * 3178 - * Ref: https://fetch.spec.whatwg.org/#body 3179 - * 3180 - * @param Stream body Readable stream 3181 - * @param Object opts Response options 3182 - * @return Void 3183 - */ 3184 - function Body(body) { 3185 - var _this = this; 3186 - 3187 - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, 3188 - _ref$size = _ref.size; 3189 - 3190 - let size = _ref$size === undefined ? 0 : _ref$size; 3191 - var _ref$timeout = _ref.timeout; 3192 - let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; 3193 - 3194 - if (body == null) { 3195 - // body is undefined or null 3196 - body = null; 3197 - } else if (isURLSearchParams(body)) { 3198 - // body is a URLSearchParams 3199 - body = Buffer.from(body.toString()); 3200 - } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { 3201 - // body is ArrayBuffer 3202 - body = Buffer.from(body); 3203 - } else if (ArrayBuffer.isView(body)) { 3204 - // body is ArrayBufferView 3205 - body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); 3206 - } else if (body instanceof Stream) ; else { 3207 - // none of the above 3208 - // coerce to string then buffer 3209 - body = Buffer.from(String(body)); 3210 - } 3211 - this[INTERNALS] = { 3212 - body, 3213 - disturbed: false, 3214 - error: null 3215 - }; 3216 - this.size = size; 3217 - this.timeout = timeout; 3218 - 3219 - if (body instanceof Stream) { 3220 - body.on('error', function (err) { 3221 - const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); 3222 - _this[INTERNALS].error = error; 3223 - }); 3224 - } 3225 - } 3226 - 3227 - Body.prototype = { 3228 - get body() { 3229 - return this[INTERNALS].body; 3230 - }, 3231 - 3232 - get bodyUsed() { 3233 - return this[INTERNALS].disturbed; 3234 - }, 3235 - 3236 - /** 3237 - * Decode response as ArrayBuffer 3238 - * 3239 - * @return Promise 3240 - */ 3241 - arrayBuffer() { 3242 - return consumeBody.call(this).then(function (buf) { 3243 - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); 3244 - }); 3245 - }, 3246 - 3247 - /** 3248 - * Return raw response as Blob 3249 - * 3250 - * @return Promise 3251 - */ 3252 - blob() { 3253 - let ct = this.headers && this.headers.get('content-type') || ''; 3254 - return consumeBody.call(this).then(function (buf) { 3255 - return Object.assign( 3256 - // Prevent copying 3257 - new Blob([], { 3258 - type: ct.toLowerCase() 3259 - }), { 3260 - [BUFFER]: buf 3261 - }); 3262 - }); 3263 - }, 3264 - 3265 - /** 3266 - * Decode response as json 3267 - * 3268 - * @return Promise 3269 - */ 3270 - json() { 3271 - var _this2 = this; 3272 - 3273 - return consumeBody.call(this).then(function (buffer) { 3274 - try { 3275 - return JSON.parse(buffer.toString()); 3276 - } catch (err) { 3277 - return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); 3278 - } 3279 - }); 3280 - }, 3281 - 3282 - /** 3283 - * Decode response as text 3284 - * 3285 - * @return Promise 3286 - */ 3287 - text() { 3288 - return consumeBody.call(this).then(function (buffer) { 3289 - return buffer.toString(); 3290 - }); 3291 - }, 3292 - 3293 - /** 3294 - * Decode response as buffer (non-spec api) 3295 - * 3296 - * @return Promise 3297 - */ 3298 - buffer() { 3299 - return consumeBody.call(this); 3300 - }, 3301 - 3302 - /** 3303 - * Decode response as text, while automatically detecting the encoding and 3304 - * trying to decode to UTF-8 (non-spec api) 3305 - * 3306 - * @return Promise 3307 - */ 3308 - textConverted() { 3309 - var _this3 = this; 3310 - 3311 - return consumeBody.call(this).then(function (buffer) { 3312 - return convertBody(buffer, _this3.headers); 3313 - }); 3314 - } 3315 - }; 3316 - 3317 - // In browsers, all properties are enumerable. 3318 - Object.defineProperties(Body.prototype, { 3319 - body: { enumerable: true }, 3320 - bodyUsed: { enumerable: true }, 3321 - arrayBuffer: { enumerable: true }, 3322 - blob: { enumerable: true }, 3323 - json: { enumerable: true }, 3324 - text: { enumerable: true } 3325 - }); 3326 - 3327 - Body.mixIn = function (proto) { 3328 - for (const name of Object.getOwnPropertyNames(Body.prototype)) { 3329 - // istanbul ignore else: future proof 3330 - if (!(name in proto)) { 3331 - const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); 3332 - Object.defineProperty(proto, name, desc); 3333 - } 3334 - } 3335 - }; 3336 - 3337 - /** 3338 - * Consume and convert an entire Body to a Buffer. 3339 - * 3340 - * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body 3341 - * 3342 - * @return Promise 3343 - */ 3344 - function consumeBody() { 3345 - var _this4 = this; 3346 - 3347 - if (this[INTERNALS].disturbed) { 3348 - return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); 3349 - } 3350 - 3351 - this[INTERNALS].disturbed = true; 3352 - 3353 - if (this[INTERNALS].error) { 3354 - return Body.Promise.reject(this[INTERNALS].error); 3355 - } 3356 - 3357 - let body = this.body; 3358 - 3359 - // body is null 3360 - if (body === null) { 3361 - return Body.Promise.resolve(Buffer.alloc(0)); 3362 - } 3363 - 3364 - // body is blob 3365 - if (isBlob(body)) { 3366 - body = body.stream(); 3367 - } 3368 - 3369 - // body is buffer 3370 - if (Buffer.isBuffer(body)) { 3371 - return Body.Promise.resolve(body); 3372 - } 3373 - 3374 - // istanbul ignore if: should never happen 3375 - if (!(body instanceof Stream)) { 3376 - return Body.Promise.resolve(Buffer.alloc(0)); 3377 - } 3378 - 3379 - // body is stream 3380 - // get ready to actually consume the body 3381 - let accum = []; 3382 - let accumBytes = 0; 3383 - let abort = false; 3384 - 3385 - return new Body.Promise(function (resolve, reject) { 3386 - let resTimeout; 3387 - 3388 - // allow timeout on slow response body 3389 - if (_this4.timeout) { 3390 - resTimeout = setTimeout(function () { 3391 - abort = true; 3392 - reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); 3393 - }, _this4.timeout); 3394 - } 3395 - 3396 - // handle stream errors 3397 - body.on('error', function (err) { 3398 - if (err.name === 'AbortError') { 3399 - // if the request was aborted, reject with this Error 3400 - abort = true; 3401 - reject(err); 3402 - } else { 3403 - // other errors, such as incorrect content-encoding 3404 - reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); 3405 - } 3406 - }); 3407 - 3408 - body.on('data', function (chunk) { 3409 - if (abort || chunk === null) { 3410 - return; 3411 - } 3412 - 3413 - if (_this4.size && accumBytes + chunk.length > _this4.size) { 3414 - abort = true; 3415 - reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); 3416 - return; 3417 - } 3418 - 3419 - accumBytes += chunk.length; 3420 - accum.push(chunk); 3421 - }); 3422 - 3423 - body.on('end', function () { 3424 - if (abort) { 3425 - return; 3426 - } 3427 - 3428 - clearTimeout(resTimeout); 3429 - 3430 - try { 3431 - resolve(Buffer.concat(accum, accumBytes)); 3432 - } catch (err) { 3433 - // handle streams that have accumulated too much data (issue #414) 3434 - reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); 3435 - } 3436 - }); 3437 - }); 3438 - } 3439 - 3440 - /** 3441 - * Detect buffer encoding and convert to target encoding 3442 - * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding 3443 - * 3444 - * @param Buffer buffer Incoming buffer 3445 - * @param String encoding Target encoding 3446 - * @return String 3447 - */ 3448 - function convertBody(buffer, headers) { 3449 - if (typeof convert !== 'function') { 3450 - throw new Error('The package `encoding` must be installed to use the textConverted() function'); 3451 - } 3452 - 3453 - const ct = headers.get('content-type'); 3454 - let charset = 'utf-8'; 3455 - let res, str; 3456 - 3457 - // header 3458 - if (ct) { 3459 - res = /charset=([^;]*)/i.exec(ct); 3460 - } 3461 - 3462 - // no charset in content type, peek at response body for at most 1024 bytes 3463 - str = buffer.slice(0, 1024).toString(); 3464 - 3465 - // html5 3466 - if (!res && str) { 3467 - res = /<meta.+?charset=(['"])(.+?)\1/i.exec(str); 3468 - } 3469 - 3470 - // html4 3471 - if (!res && str) { 3472 - res = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(str); 3473 - 3474 - if (res) { 3475 - res = /charset=(.*)/i.exec(res.pop()); 3476 - } 3477 - } 3478 - 3479 - // xml 3480 - if (!res && str) { 3481 - res = /<\?xml.+?encoding=(['"])(.+?)\1/i.exec(str); 3482 - } 3483 - 3484 - // found charset 3485 - if (res) { 3486 - charset = res.pop(); 3487 - 3488 - // prevent decode issues when sites use incorrect encoding 3489 - // ref: https://hsivonen.fi/encoding-menu/ 3490 - if (charset === 'gb2312' || charset === 'gbk') { 3491 - charset = 'gb18030'; 3492 - } 3493 - } 3494 - 3495 - // turn raw buffers into a single utf-8 buffer 3496 - return convert(buffer, 'UTF-8', charset).toString(); 3497 - } 3498 - 3499 - /** 3500 - * Detect a URLSearchParams object 3501 - * ref: https://github.com/bitinn/node-fetch/issues/296#issuecomment-307598143 3502 - * 3503 - * @param Object obj Object to detect by type or brand 3504 - * @return String 3505 - */ 3506 - function isURLSearchParams(obj) { 3507 - // Duck-typing as a necessary condition. 3508 - if (typeof obj !== 'object' || typeof obj.append !== 'function' || typeof obj.delete !== 'function' || typeof obj.get !== 'function' || typeof obj.getAll !== 'function' || typeof obj.has !== 'function' || typeof obj.set !== 'function') { 3509 - return false; 3510 - } 3511 - 3512 - // Brand-checking and more duck-typing as optional condition. 3513 - return obj.constructor.name === 'URLSearchParams' || Object.prototype.toString.call(obj) === '[object URLSearchParams]' || typeof obj.sort === 'function'; 3514 - } 3515 - 3516 - /** 3517 - * Check if `obj` is a W3C `Blob` object (which `File` inherits from) 3518 - * @param {*} obj 3519 - * @return {boolean} 3520 - */ 3521 - function isBlob(obj) { 3522 - return typeof obj === 'object' && typeof obj.arrayBuffer === 'function' && typeof obj.type === 'string' && typeof obj.stream === 'function' && typeof obj.constructor === 'function' && typeof obj.constructor.name === 'string' && /^(Blob|File)$/.test(obj.constructor.name) && /^(Blob|File)$/.test(obj[Symbol.toStringTag]); 3523 - } 3524 - 3525 - /** 3526 - * Clone body given Res/Req instance 3527 - * 3528 - * @param Mixed instance Response or Request instance 3529 - * @return Mixed 3530 - */ 3531 - function clone(instance) { 3532 - let p1, p2; 3533 - let body = instance.body; 3534 - 3535 - // don't allow cloning a used body 3536 - if (instance.bodyUsed) { 3537 - throw new Error('cannot clone body after it is used'); 3538 - } 3539 - 3540 - // check that body is a stream and not form-data object 3541 - // note: we can't clone the form-data object without having it as a dependency 3542 - if (body instanceof Stream && typeof body.getBoundary !== 'function') { 3543 - // tee instance body 3544 - p1 = new PassThrough(); 3545 - p2 = new PassThrough(); 3546 - body.pipe(p1); 3547 - body.pipe(p2); 3548 - // set instance body to teed body and return the other teed body 3549 - instance[INTERNALS].body = p1; 3550 - body = p2; 3551 - } 3552 - 3553 - return body; 3554 - } 3555 - 3556 - /** 3557 - * Performs the operation "extract a `Content-Type` value from |object|" as 3558 - * specified in the specification: 3559 - * https://fetch.spec.whatwg.org/#concept-bodyinit-extract 3560 - * 3561 - * This function assumes that instance.body is present. 3562 - * 3563 - * @param Mixed instance Any options.body input 3564 - */ 3565 - function extractContentType(body) { 3566 - if (body === null) { 3567 - // body is null 3568 - return null; 3569 - } else if (typeof body === 'string') { 3570 - // body is string 3571 - return 'text/plain;charset=UTF-8'; 3572 - } else if (isURLSearchParams(body)) { 3573 - // body is a URLSearchParams 3574 - return 'application/x-www-form-urlencoded;charset=UTF-8'; 3575 - } else if (isBlob(body)) { 3576 - // body is blob 3577 - return body.type || null; 3578 - } else if (Buffer.isBuffer(body)) { 3579 - // body is buffer 3580 - return null; 3581 - } else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { 3582 - // body is ArrayBuffer 3583 - return null; 3584 - } else if (ArrayBuffer.isView(body)) { 3585 - // body is ArrayBufferView 3586 - return null; 3587 - } else if (typeof body.getBoundary === 'function') { 3588 - // detect form data input from form-data module 3589 - return `multipart/form-data;boundary=${body.getBoundary()}`; 3590 - } else if (body instanceof Stream) { 3591 - // body is stream 3592 - // can't really do much about this 3593 - return null; 3594 - } else { 3595 - // Body constructor defaults other things to string 3596 - return 'text/plain;charset=UTF-8'; 3597 - } 3598 - } 3599 - 3600 - /** 3601 - * The Fetch Standard treats this as if "total bytes" is a property on the body. 3602 - * For us, we have to explicitly get it with a function. 3603 - * 3604 - * ref: https://fetch.spec.whatwg.org/#concept-body-total-bytes 3605 - * 3606 - * @param Body instance Instance of Body 3607 - * @return Number? Number of bytes, or null if not possible 3608 - */ 3609 - function getTotalBytes(instance) { 3610 - const body = instance.body; 3611 - 3612 - 3613 - if (body === null) { 3614 - // body is null 3615 - return 0; 3616 - } else if (isBlob(body)) { 3617 - return body.size; 3618 - } else if (Buffer.isBuffer(body)) { 3619 - // body is buffer 3620 - return body.length; 3621 - } else if (body && typeof body.getLengthSync === 'function') { 3622 - // detect form data input from form-data module 3623 - if (body._lengthRetrievers && body._lengthRetrievers.length == 0 || // 1.x 3624 - body.hasKnownLength && body.hasKnownLength()) { 3625 - // 2.x 3626 - return body.getLengthSync(); 3627 - } 3628 - return null; 3629 - } else { 3630 - // body is stream 3631 - return null; 3632 - } 3633 - } 3634 - 3635 - /** 3636 - * Write a Body to a Node.js WritableStream (e.g. http.Request) object. 3637 - * 3638 - * @param Body instance Instance of Body 3639 - * @return Void 3640 - */ 3641 - function writeToStream(dest, instance) { 3642 - const body = instance.body; 3643 - 3644 - 3645 - if (body === null) { 3646 - // body is null 3647 - dest.end(); 3648 - } else if (isBlob(body)) { 3649 - body.stream().pipe(dest); 3650 - } else if (Buffer.isBuffer(body)) { 3651 - // body is buffer 3652 - dest.write(body); 3653 - dest.end(); 3654 - } else { 3655 - // body is stream 3656 - body.pipe(dest); 3657 - } 3658 - } 3659 - 3660 - // expose Promise 3661 - Body.Promise = global.Promise; 3662 - 3663 - /** 3664 - * headers.js 3665 - * 3666 - * Headers class offers convenient helpers 3667 - */ 3668 - 3669 - const invalidTokenRegex = /[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/; 3670 - const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/; 3671 - 3672 - function validateName(name) { 3673 - name = `${name}`; 3674 - if (invalidTokenRegex.test(name) || name === '') { 3675 - throw new TypeError(`${name} is not a legal HTTP header name`); 3676 - } 3677 - } 3678 - 3679 - function validateValue(value) { 3680 - value = `${value}`; 3681 - if (invalidHeaderCharRegex.test(value)) { 3682 - throw new TypeError(`${value} is not a legal HTTP header value`); 3683 - } 3684 - } 3685 - 3686 - /** 3687 - * Find the key in the map object given a header name. 3688 - * 3689 - * Returns undefined if not found. 3690 - * 3691 - * @param String name Header name 3692 - * @return String|Undefined 3693 - */ 3694 - function find(map, name) { 3695 - name = name.toLowerCase(); 3696 - for (const key in map) { 3697 - if (key.toLowerCase() === name) { 3698 - return key; 3699 - } 3700 - } 3701 - return undefined; 3702 - } 3703 - 3704 - const MAP = Symbol('map'); 3705 - class Headers { 3706 - /** 3707 - * Headers class 3708 - * 3709 - * @param Object headers Response headers 3710 - * @return Void 3711 - */ 3712 - constructor() { 3713 - let init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined; 3714 - 3715 - this[MAP] = Object.create(null); 3716 - 3717 - if (init instanceof Headers) { 3718 - const rawHeaders = init.raw(); 3719 - const headerNames = Object.keys(rawHeaders); 3720 - 3721 - for (const headerName of headerNames) { 3722 - for (const value of rawHeaders[headerName]) { 3723 - this.append(headerName, value); 3724 - } 3725 - } 3726 - 3727 - return; 3728 - } 3729 - 3730 - // We don't worry about converting prop to ByteString here as append() 3731 - // will handle it. 3732 - if (init == null) ; else if (typeof init === 'object') { 3733 - const method = init[Symbol.iterator]; 3734 - if (method != null) { 3735 - if (typeof method !== 'function') { 3736 - throw new TypeError('Header pairs must be iterable'); 3737 - } 3738 - 3739 - // sequence<sequence<ByteString>> 3740 - // Note: per spec we have to first exhaust the lists then process them 3741 - const pairs = []; 3742 - for (const pair of init) { 3743 - if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { 3744 - throw new TypeError('Each header pair must be iterable'); 3745 - } 3746 - pairs.push(Array.from(pair)); 3747 - } 3748 - 3749 - for (const pair of pairs) { 3750 - if (pair.length !== 2) { 3751 - throw new TypeError('Each header pair must be a name/value tuple'); 3752 - } 3753 - this.append(pair[0], pair[1]); 3754 - } 3755 - } else { 3756 - // record<ByteString, ByteString> 3757 - for (const key of Object.keys(init)) { 3758 - const value = init[key]; 3759 - this.append(key, value); 3760 - } 3761 - } 3762 - } else { 3763 - throw new TypeError('Provided initializer must be an object'); 3764 - } 3765 - } 3766 - 3767 - /** 3768 - * Return combined header value given name 3769 - * 3770 - * @param String name Header name 3771 - * @return Mixed 3772 - */ 3773 - get(name) { 3774 - name = `${name}`; 3775 - validateName(name); 3776 - const key = find(this[MAP], name); 3777 - if (key === undefined) { 3778 - return null; 3779 - } 3780 - 3781 - return this[MAP][key].join(', '); 3782 - } 3783 - 3784 - /** 3785 - * Iterate over all headers 3786 - * 3787 - * @param Function callback Executed for each item with parameters (value, name, thisArg) 3788 - * @param Boolean thisArg `this` context for callback function 3789 - * @return Void 3790 - */ 3791 - forEach(callback) { 3792 - let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; 3793 - 3794 - let pairs = getHeaders(this); 3795 - let i = 0; 3796 - while (i < pairs.length) { 3797 - var _pairs$i = pairs[i]; 3798 - const name = _pairs$i[0], 3799 - value = _pairs$i[1]; 3800 - 3801 - callback.call(thisArg, value, name, this); 3802 - pairs = getHeaders(this); 3803 - i++; 3804 - } 3805 - } 3806 - 3807 - /** 3808 - * Overwrite header values given name 3809 - * 3810 - * @param String name Header name 3811 - * @param String value Header value 3812 - * @return Void 3813 - */ 3814 - set(name, value) { 3815 - name = `${name}`; 3816 - value = `${value}`; 3817 - validateName(name); 3818 - validateValue(value); 3819 - const key = find(this[MAP], name); 3820 - this[MAP][key !== undefined ? key : name] = [value]; 3821 - } 3822 - 3823 - /** 3824 - * Append a value onto existing header 3825 - * 3826 - * @param String name Header name 3827 - * @param String value Header value 3828 - * @return Void 3829 - */ 3830 - append(name, value) { 3831 - name = `${name}`; 3832 - value = `${value}`; 3833 - validateName(name); 3834 - validateValue(value); 3835 - const key = find(this[MAP], name); 3836 - if (key !== undefined) { 3837 - this[MAP][key].push(value); 3838 - } else { 3839 - this[MAP][name] = [value]; 3840 - } 3841 - } 3842 - 3843 - /** 3844 - * Check for header name existence 3845 - * 3846 - * @param String name Header name 3847 - * @return Boolean 3848 - */ 3849 - has(name) { 3850 - name = `${name}`; 3851 - validateName(name); 3852 - return find(this[MAP], name) !== undefined; 3853 - } 3854 - 3855 - /** 3856 - * Delete all header values given name 3857 - * 3858 - * @param String name Header name 3859 - * @return Void 3860 - */ 3861 - delete(name) { 3862 - name = `${name}`; 3863 - validateName(name); 3864 - const key = find(this[MAP], name); 3865 - if (key !== undefined) { 3866 - delete this[MAP][key]; 3867 - } 3868 - } 3869 - 3870 - /** 3871 - * Return raw headers (non-spec api) 3872 - * 3873 - * @return Object 3874 - */ 3875 - raw() { 3876 - return this[MAP]; 3877 - } 3878 - 3879 - /** 3880 - * Get an iterator on keys. 3881 - * 3882 - * @return Iterator 3883 - */ 3884 - keys() { 3885 - return createHeadersIterator(this, 'key'); 3886 - } 3887 - 3888 - /** 3889 - * Get an iterator on values. 3890 - * 3891 - * @return Iterator 3892 - */ 3893 - values() { 3894 - return createHeadersIterator(this, 'value'); 3895 - } 3896 - 3897 - /** 3898 - * Get an iterator on entries. 3899 - * 3900 - * This is the default iterator of the Headers object. 3901 - * 3902 - * @return Iterator 3903 - */ 3904 - [Symbol.iterator]() { 3905 - return createHeadersIterator(this, 'key+value'); 3906 - } 3907 - } 3908 - Headers.prototype.entries = Headers.prototype[Symbol.iterator]; 3909 - 3910 - Object.defineProperty(Headers.prototype, Symbol.toStringTag, { 3911 - value: 'Headers', 3912 - writable: false, 3913 - enumerable: false, 3914 - configurable: true 3915 - }); 3916 - 3917 - Object.defineProperties(Headers.prototype, { 3918 - get: { enumerable: true }, 3919 - forEach: { enumerable: true }, 3920 - set: { enumerable: true }, 3921 - append: { enumerable: true }, 3922 - has: { enumerable: true }, 3923 - delete: { enumerable: true }, 3924 - keys: { enumerable: true }, 3925 - values: { enumerable: true }, 3926 - entries: { enumerable: true } 3927 - }); 3928 - 3929 - function getHeaders(headers) { 3930 - let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; 3931 - 3932 - const keys = Object.keys(headers[MAP]).sort(); 3933 - return keys.map(kind === 'key' ? function (k) { 3934 - return k.toLowerCase(); 3935 - } : kind === 'value' ? function (k) { 3936 - return headers[MAP][k].join(', '); 3937 - } : function (k) { 3938 - return [k.toLowerCase(), headers[MAP][k].join(', ')]; 3939 - }); 3940 - } 3941 - 3942 - const INTERNAL = Symbol('internal'); 3943 - 3944 - function createHeadersIterator(target, kind) { 3945 - const iterator = Object.create(HeadersIteratorPrototype); 3946 - iterator[INTERNAL] = { 3947 - target, 3948 - kind, 3949 - index: 0 3950 - }; 3951 - return iterator; 3952 - } 3953 - 3954 - const HeadersIteratorPrototype = Object.setPrototypeOf({ 3955 - next() { 3956 - // istanbul ignore if 3957 - if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { 3958 - throw new TypeError('Value of `this` is not a HeadersIterator'); 3959 - } 3960 - 3961 - var _INTERNAL = this[INTERNAL]; 3962 - const target = _INTERNAL.target, 3963 - kind = _INTERNAL.kind, 3964 - index = _INTERNAL.index; 3965 - 3966 - const values = getHeaders(target, kind); 3967 - const len = values.length; 3968 - if (index >= len) { 3969 - return { 3970 - value: undefined, 3971 - done: true 3972 - }; 3973 - } 3974 - 3975 - this[INTERNAL].index = index + 1; 3976 - 3977 - return { 3978 - value: values[index], 3979 - done: false 3980 - }; 3981 - } 3982 - }, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); 3983 - 3984 - Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { 3985 - value: 'HeadersIterator', 3986 - writable: false, 3987 - enumerable: false, 3988 - configurable: true 3989 - }); 3990 - 3991 - /** 3992 - * Export the Headers object in a form that Node.js can consume. 3993 - * 3994 - * @param Headers headers 3995 - * @return Object 3996 - */ 3997 - function exportNodeCompatibleHeaders(headers) { 3998 - const obj = Object.assign({ __proto__: null }, headers[MAP]); 3999 - 4000 - // http.request() only supports string as Host header. This hack makes 4001 - // specifying custom Host header possible. 4002 - const hostHeaderKey = find(headers[MAP], 'Host'); 4003 - if (hostHeaderKey !== undefined) { 4004 - obj[hostHeaderKey] = obj[hostHeaderKey][0]; 4005 - } 4006 - 4007 - return obj; 4008 - } 4009 - 4010 - /** 4011 - * Create a Headers object from an object of headers, ignoring those that do 4012 - * not conform to HTTP grammar productions. 4013 - * 4014 - * @param Object obj Object of headers 4015 - * @return Headers 4016 - */ 4017 - function createHeadersLenient(obj) { 4018 - const headers = new Headers(); 4019 - for (const name of Object.keys(obj)) { 4020 - if (invalidTokenRegex.test(name)) { 4021 - continue; 4022 - } 4023 - if (Array.isArray(obj[name])) { 4024 - for (const val of obj[name]) { 4025 - if (invalidHeaderCharRegex.test(val)) { 4026 - continue; 4027 - } 4028 - if (headers[MAP][name] === undefined) { 4029 - headers[MAP][name] = [val]; 4030 - } else { 4031 - headers[MAP][name].push(val); 4032 - } 4033 - } 4034 - } else if (!invalidHeaderCharRegex.test(obj[name])) { 4035 - headers[MAP][name] = [obj[name]]; 4036 - } 4037 - } 4038 - return headers; 4039 - } 4040 - 4041 - const INTERNALS$1 = Symbol('Response internals'); 4042 - 4043 - // fix an issue where "STATUS_CODES" aren't a named export for node <10 4044 - const STATUS_CODES = http.STATUS_CODES; 4045 - 4046 - /** 4047 - * Response class 4048 - * 4049 - * @param Stream body Readable stream 4050 - * @param Object opts Response options 4051 - * @return Void 4052 - */ 4053 - class Response { 4054 - constructor() { 4055 - let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 4056 - let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 4057 - 4058 - Body.call(this, body, opts); 4059 - 4060 - const status = opts.status || 200; 4061 - const headers = new Headers(opts.headers); 4062 - 4063 - if (body != null && !headers.has('Content-Type')) { 4064 - const contentType = extractContentType(body); 4065 - if (contentType) { 4066 - headers.append('Content-Type', contentType); 4067 - } 4068 - } 4069 - 4070 - this[INTERNALS$1] = { 4071 - url: opts.url, 4072 - status, 4073 - statusText: opts.statusText || STATUS_CODES[status], 4074 - headers, 4075 - counter: opts.counter 4076 - }; 4077 - } 4078 - 4079 - get url() { 4080 - return this[INTERNALS$1].url || ''; 4081 - } 4082 - 4083 - get status() { 4084 - return this[INTERNALS$1].status; 4085 - } 4086 - 4087 - /** 4088 - * Convenience property representing if the request ended normally 4089 - */ 4090 - get ok() { 4091 - return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; 4092 - } 4093 - 4094 - get redirected() { 4095 - return this[INTERNALS$1].counter > 0; 4096 - } 4097 - 4098 - get statusText() { 4099 - return this[INTERNALS$1].statusText; 4100 - } 4101 - 4102 - get headers() { 4103 - return this[INTERNALS$1].headers; 4104 - } 4105 - 4106 - /** 4107 - * Clone this response 4108 - * 4109 - * @return Response 4110 - */ 4111 - clone() { 4112 - return new Response(clone(this), { 4113 - url: this.url, 4114 - status: this.status, 4115 - statusText: this.statusText, 4116 - headers: this.headers, 4117 - ok: this.ok, 4118 - redirected: this.redirected 4119 - }); 4120 - } 4121 - } 4122 - 4123 - Body.mixIn(Response.prototype); 4124 - 4125 - Object.defineProperties(Response.prototype, { 4126 - url: { enumerable: true }, 4127 - status: { enumerable: true }, 4128 - ok: { enumerable: true }, 4129 - redirected: { enumerable: true }, 4130 - statusText: { enumerable: true }, 4131 - headers: { enumerable: true }, 4132 - clone: { enumerable: true } 4133 - }); 4134 - 4135 - Object.defineProperty(Response.prototype, Symbol.toStringTag, { 4136 - value: 'Response', 4137 - writable: false, 4138 - enumerable: false, 4139 - configurable: true 4140 - }); 4141 - 4142 - const INTERNALS$2 = Symbol('Request internals'); 4143 - 4144 - // fix an issue where "format", "parse" aren't a named export for node <10 4145 - const parse_url = Url.parse; 4146 - const format_url = Url.format; 4147 - 4148 - const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; 4149 - 4150 - /** 4151 - * Check if a value is an instance of Request. 4152 - * 4153 - * @param Mixed input 4154 - * @return Boolean 4155 - */ 4156 - function isRequest(input) { 4157 - return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; 4158 - } 4159 - 4160 - function isAbortSignal(signal) { 4161 - const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); 4162 - return !!(proto && proto.constructor.name === 'AbortSignal'); 4163 - } 4164 - 4165 - /** 4166 - * Request class 4167 - * 4168 - * @param Mixed input Url or Request instance 4169 - * @param Object init Custom options 4170 - * @return Void 4171 - */ 4172 - class Request { 4173 - constructor(input) { 4174 - let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 4175 - 4176 - let parsedURL; 4177 - 4178 - // normalize input 4179 - if (!isRequest(input)) { 4180 - if (input && input.href) { 4181 - // in order to support Node.js' Url objects; though WHATWG's URL objects 4182 - // will fall into this branch also (since their `toString()` will return 4183 - // `href` property anyway) 4184 - parsedURL = parse_url(input.href); 4185 - } else { 4186 - // coerce input to a string before attempting to parse 4187 - parsedURL = parse_url(`${input}`); 4188 - } 4189 - input = {}; 4190 - } else { 4191 - parsedURL = parse_url(input.url); 4192 - } 4193 - 4194 - let method = init.method || input.method || 'GET'; 4195 - method = method.toUpperCase(); 4196 - 4197 - if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { 4198 - throw new TypeError('Request with GET/HEAD method cannot have body'); 4199 - } 4200 - 4201 - let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; 4202 - 4203 - Body.call(this, inputBody, { 4204 - timeout: init.timeout || input.timeout || 0, 4205 - size: init.size || input.size || 0 4206 - }); 4207 - 4208 - const headers = new Headers(init.headers || input.headers || {}); 4209 - 4210 - if (inputBody != null && !headers.has('Content-Type')) { 4211 - const contentType = extractContentType(inputBody); 4212 - if (contentType) { 4213 - headers.append('Content-Type', contentType); 4214 - } 4215 - } 4216 - 4217 - let signal = isRequest(input) ? input.signal : null; 4218 - if ('signal' in init) signal = init.signal; 4219 - 4220 - if (signal != null && !isAbortSignal(signal)) { 4221 - throw new TypeError('Expected signal to be an instanceof AbortSignal'); 4222 - } 4223 - 4224 - this[INTERNALS$2] = { 4225 - method, 4226 - redirect: init.redirect || input.redirect || 'follow', 4227 - headers, 4228 - parsedURL, 4229 - signal 4230 - }; 4231 - 4232 - // node-fetch-only options 4233 - this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; 4234 - this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; 4235 - this.counter = init.counter || input.counter || 0; 4236 - this.agent = init.agent || input.agent; 4237 - } 4238 - 4239 - get method() { 4240 - return this[INTERNALS$2].method; 4241 - } 4242 - 4243 - get url() { 4244 - return format_url(this[INTERNALS$2].parsedURL); 4245 - } 4246 - 4247 - get headers() { 4248 - return this[INTERNALS$2].headers; 4249 - } 4250 - 4251 - get redirect() { 4252 - return this[INTERNALS$2].redirect; 4253 - } 4254 - 4255 - get signal() { 4256 - return this[INTERNALS$2].signal; 4257 - } 4258 - 4259 - /** 4260 - * Clone this request 4261 - * 4262 - * @return Request 4263 - */ 4264 - clone() { 4265 - return new Request(this); 4266 - } 4267 - } 4268 - 4269 - Body.mixIn(Request.prototype); 4270 - 4271 - Object.defineProperty(Request.prototype, Symbol.toStringTag, { 4272 - value: 'Request', 4273 - writable: false, 4274 - enumerable: false, 4275 - configurable: true 4276 - }); 4277 - 4278 - Object.defineProperties(Request.prototype, { 4279 - method: { enumerable: true }, 4280 - url: { enumerable: true }, 4281 - headers: { enumerable: true }, 4282 - redirect: { enumerable: true }, 4283 - clone: { enumerable: true }, 4284 - signal: { enumerable: true } 4285 - }); 4286 - 4287 - /** 4288 - * Convert a Request to Node.js http request options. 4289 - * 4290 - * @param Request A Request instance 4291 - * @return Object The options object to be passed to http.request 4292 - */ 4293 - function getNodeRequestOptions(request) { 4294 - const parsedURL = request[INTERNALS$2].parsedURL; 4295 - const headers = new Headers(request[INTERNALS$2].headers); 4296 - 4297 - // fetch step 1.3 4298 - if (!headers.has('Accept')) { 4299 - headers.set('Accept', '*/*'); 4300 - } 4301 - 4302 - // Basic fetch 4303 - if (!parsedURL.protocol || !parsedURL.hostname) { 4304 - throw new TypeError('Only absolute URLs are supported'); 4305 - } 4306 - 4307 - if (!/^https?:$/.test(parsedURL.protocol)) { 4308 - throw new TypeError('Only HTTP(S) protocols are supported'); 4309 - } 4310 - 4311 - if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { 4312 - throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); 4313 - } 4314 - 4315 - // HTTP-network-or-cache fetch steps 2.4-2.7 4316 - let contentLengthValue = null; 4317 - if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { 4318 - contentLengthValue = '0'; 4319 - } 4320 - if (request.body != null) { 4321 - const totalBytes = getTotalBytes(request); 4322 - if (typeof totalBytes === 'number') { 4323 - contentLengthValue = String(totalBytes); 4324 - } 4325 - } 4326 - if (contentLengthValue) { 4327 - headers.set('Content-Length', contentLengthValue); 4328 - } 4329 - 4330 - // HTTP-network-or-cache fetch step 2.11 4331 - if (!headers.has('User-Agent')) { 4332 - headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); 4333 - } 4334 - 4335 - // HTTP-network-or-cache fetch step 2.15 4336 - if (request.compress && !headers.has('Accept-Encoding')) { 4337 - headers.set('Accept-Encoding', 'gzip,deflate'); 4338 - } 4339 - 4340 - let agent = request.agent; 4341 - if (typeof agent === 'function') { 4342 - agent = agent(parsedURL); 4343 - } 4344 - 4345 - if (!headers.has('Connection') && !agent) { 4346 - headers.set('Connection', 'close'); 4347 - } 4348 - 4349 - // HTTP-network fetch step 4.2 4350 - // chunked encoding is handled by Node.js 4351 - 4352 - return Object.assign({}, parsedURL, { 4353 - method: request.method, 4354 - headers: exportNodeCompatibleHeaders(headers), 4355 - agent 4356 - }); 4357 - } 4358 - 4359 - /** 4360 - * abort-error.js 4361 - * 4362 - * AbortError interface for cancelled requests 4363 - */ 4364 - 4365 - /** 4366 - * Create AbortError instance 4367 - * 4368 - * @param String message Error message for human 4369 - * @return AbortError 4370 - */ 4371 - function AbortError(message) { 4372 - Error.call(this, message); 4373 - 4374 - this.type = 'aborted'; 4375 - this.message = message; 4376 - 4377 - // hide custom error implementation details from end-users 4378 - Error.captureStackTrace(this, this.constructor); 4379 - } 4380 - 4381 - AbortError.prototype = Object.create(Error.prototype); 4382 - AbortError.prototype.constructor = AbortError; 4383 - AbortError.prototype.name = 'AbortError'; 4384 - 4385 - // fix an issue where "PassThrough", "resolve" aren't a named export for node <10 4386 - const PassThrough$1 = Stream.PassThrough; 4387 - const resolve_url = Url.resolve; 4388 - 4389 - /** 4390 - * Fetch function 4391 - * 4392 - * @param Mixed url Absolute url or Request instance 4393 - * @param Object opts Fetch options 4394 - * @return Promise 4395 - */ 4396 - function fetch(url, opts) { 4397 - 4398 - // allow custom promise 4399 - if (!fetch.Promise) { 4400 - throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); 4401 - } 4402 - 4403 - Body.Promise = fetch.Promise; 4404 - 4405 - // wrap http.request into fetch 4406 - return new fetch.Promise(function (resolve, reject) { 4407 - // build request object 4408 - const request = new Request(url, opts); 4409 - const options = getNodeRequestOptions(request); 4410 - 4411 - const send = (options.protocol === 'https:' ? https : http).request; 4412 - const signal = request.signal; 4413 - 4414 - let response = null; 4415 - 4416 - const abort = function abort() { 4417 - let error = new AbortError('The user aborted a request.'); 4418 - reject(error); 4419 - if (request.body && request.body instanceof Stream.Readable) { 4420 - request.body.destroy(error); 4421 - } 4422 - if (!response || !response.body) return; 4423 - response.body.emit('error', error); 4424 - }; 4425 - 4426 - if (signal && signal.aborted) { 4427 - abort(); 4428 - return; 4429 - } 4430 - 4431 - const abortAndFinalize = function abortAndFinalize() { 4432 - abort(); 4433 - finalize(); 4434 - }; 4435 - 4436 - // send request 4437 - const req = send(options); 4438 - let reqTimeout; 4439 - 4440 - if (signal) { 4441 - signal.addEventListener('abort', abortAndFinalize); 4442 - } 4443 - 4444 - function finalize() { 4445 - req.abort(); 4446 - if (signal) signal.removeEventListener('abort', abortAndFinalize); 4447 - clearTimeout(reqTimeout); 4448 - } 4449 - 4450 - if (request.timeout) { 4451 - req.once('socket', function (socket) { 4452 - reqTimeout = setTimeout(function () { 4453 - reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); 4454 - finalize(); 4455 - }, request.timeout); 4456 - }); 4457 - } 4458 - 4459 - req.on('error', function (err) { 4460 - reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); 4461 - finalize(); 4462 - }); 4463 - 4464 - req.on('response', function (res) { 4465 - clearTimeout(reqTimeout); 4466 - 4467 - const headers = createHeadersLenient(res.headers); 4468 - 4469 - // HTTP fetch step 5 4470 - if (fetch.isRedirect(res.statusCode)) { 4471 - // HTTP fetch step 5.2 4472 - const location = headers.get('Location'); 4473 - 4474 - // HTTP fetch step 5.3 4475 - const locationURL = location === null ? null : resolve_url(request.url, location); 4476 - 4477 - // HTTP fetch step 5.5 4478 - switch (request.redirect) { 4479 - case 'error': 4480 - reject(new FetchError(`redirect mode is set to error: ${request.url}`, 'no-redirect')); 4481 - finalize(); 4482 - return; 4483 - case 'manual': 4484 - // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. 4485 - if (locationURL !== null) { 4486 - // handle corrupted header 4487 - try { 4488 - headers.set('Location', locationURL); 4489 - } catch (err) { 4490 - // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request 4491 - reject(err); 4492 - } 4493 - } 4494 - break; 4495 - case 'follow': 4496 - // HTTP-redirect fetch step 2 4497 - if (locationURL === null) { 4498 - break; 4499 - } 4500 - 4501 - // HTTP-redirect fetch step 5 4502 - if (request.counter >= request.follow) { 4503 - reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); 4504 - finalize(); 4505 - return; 4506 - } 4507 - 4508 - // HTTP-redirect fetch step 6 (counter increment) 4509 - // Create a new Request object. 4510 - const requestOpts = { 4511 - headers: new Headers(request.headers), 4512 - follow: request.follow, 4513 - counter: request.counter + 1, 4514 - agent: request.agent, 4515 - compress: request.compress, 4516 - method: request.method, 4517 - body: request.body, 4518 - signal: request.signal, 4519 - timeout: request.timeout 4520 - }; 4521 - 4522 - // HTTP-redirect fetch step 9 4523 - if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { 4524 - reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); 4525 - finalize(); 4526 - return; 4527 - } 4528 - 4529 - // HTTP-redirect fetch step 11 4530 - if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { 4531 - requestOpts.method = 'GET'; 4532 - requestOpts.body = undefined; 4533 - requestOpts.headers.delete('content-length'); 4534 - } 4535 - 4536 - // HTTP-redirect fetch step 15 4537 - resolve(fetch(new Request(locationURL, requestOpts))); 4538 - finalize(); 4539 - return; 4540 - } 4541 - } 4542 - 4543 - // prepare response 4544 - res.once('end', function () { 4545 - if (signal) signal.removeEventListener('abort', abortAndFinalize); 4546 - }); 4547 - let body = res.pipe(new PassThrough$1()); 4548 - 4549 - const response_options = { 4550 - url: request.url, 4551 - status: res.statusCode, 4552 - statusText: res.statusMessage, 4553 - headers: headers, 4554 - size: request.size, 4555 - timeout: request.timeout, 4556 - counter: request.counter 4557 - }; 4558 - 4559 - // HTTP-network fetch step 12.1.1.3 4560 - const codings = headers.get('Content-Encoding'); 4561 - 4562 - // HTTP-network fetch step 12.1.1.4: handle content codings 4563 - 4564 - // in following scenarios we ignore compression support 4565 - // 1. compression support is disabled 4566 - // 2. HEAD request 4567 - // 3. no Content-Encoding header 4568 - // 4. no content response (204) 4569 - // 5. content not modified response (304) 4570 - if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { 4571 - response = new Response(body, response_options); 4572 - resolve(response); 4573 - return; 4574 - } 4575 - 4576 - // For Node v6+ 4577 - // Be less strict when decoding compressed responses, since sometimes 4578 - // servers send slightly invalid responses that are still accepted 4579 - // by common browsers. 4580 - // Always using Z_SYNC_FLUSH is what cURL does. 4581 - const zlibOptions = { 4582 - flush: zlib.Z_SYNC_FLUSH, 4583 - finishFlush: zlib.Z_SYNC_FLUSH 4584 - }; 4585 - 4586 - // for gzip 4587 - if (codings == 'gzip' || codings == 'x-gzip') { 4588 - body = body.pipe(zlib.createGunzip(zlibOptions)); 4589 - response = new Response(body, response_options); 4590 - resolve(response); 4591 - return; 4592 - } 4593 - 4594 - // for deflate 4595 - if (codings == 'deflate' || codings == 'x-deflate') { 4596 - // handle the infamous raw deflate response from old servers 4597 - // a hack for old IIS and Apache servers 4598 - const raw = res.pipe(new PassThrough$1()); 4599 - raw.once('data', function (chunk) { 4600 - // see http://stackoverflow.com/questions/37519828 4601 - if ((chunk[0] & 0x0F) === 0x08) { 4602 - body = body.pipe(zlib.createInflate()); 4603 - } else { 4604 - body = body.pipe(zlib.createInflateRaw()); 4605 - } 4606 - response = new Response(body, response_options); 4607 - resolve(response); 4608 - }); 4609 - return; 4610 - } 4611 - 4612 - // for br 4613 - if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { 4614 - body = body.pipe(zlib.createBrotliDecompress()); 4615 - response = new Response(body, response_options); 4616 - resolve(response); 4617 - return; 4618 - } 4619 - 4620 - // otherwise, use response as-is 4621 - response = new Response(body, response_options); 4622 - resolve(response); 4623 - }); 4624 - 4625 - writeToStream(req, request); 4626 - }); 4627 - } 4628 - /** 4629 - * Redirect code matching 4630 - * 4631 - * @param Number code Status code 4632 - * @return Boolean 4633 - */ 4634 - fetch.isRedirect = function (code) { 4635 - return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; 4636 - }; 4637 - 4638 - // expose Promise 4639 - fetch.Promise = global.Promise; 4640 - 4641 - module.exports = exports = fetch; 4642 - Object.defineProperty(exports, "__esModule", { value: true }); 4643 - exports.default = exports; 4644 - exports.Headers = Headers; 4645 - exports.Request = Request; 4646 - exports.Response = Response; 4647 - exports.FetchError = FetchError; 4648 - 4649 - 4650 - /***/ }), 4651 - 4652 - /***/ 537: 4653 - /***/ (function(__unusedmodule, exports, __webpack_require__) { 4654 - 4655 - "use strict"; 4656 - 4657 - 4658 - Object.defineProperty(exports, '__esModule', { value: true }); 4659 - 4660 - function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } 4661 - 4662 - var deprecation = __webpack_require__(932); 4663 - var once = _interopDefault(__webpack_require__(223)); 4664 - 4665 - const logOnce = once(deprecation => console.warn(deprecation)); 4666 - /** 4667 - * Error with extra properties to help with debugging 4668 - */ 4669 - 4670 - class RequestError extends Error { 4671 - constructor(message, statusCode, options) { 4672 - super(message); // Maintains proper stack trace (only available on V8) 4673 - 4674 - /* istanbul ignore next */ 4675 - 4676 - if (Error.captureStackTrace) { 4677 - Error.captureStackTrace(this, this.constructor); 4678 - } 4679 - 4680 - this.name = "HttpError"; 4681 - this.status = statusCode; 4682 - Object.defineProperty(this, "code", { 4683 - get() { 4684 - logOnce(new deprecation.Deprecation("[@octokit/request-error] `error.code` is deprecated, use `error.status`.")); 4685 - return statusCode; 4686 - } 4687 - 4688 - }); 4689 - this.headers = options.headers || {}; // redact request credentials without mutating original request options 4690 - 4691 - const requestCopy = Object.assign({}, options.request); 4692 - 4693 - if (options.request.headers.authorization) { 4694 - requestCopy.headers = Object.assign({}, options.request.headers, { 4695 - authorization: options.request.headers.authorization.replace(/ .*$/, " [REDACTED]") 4696 - }); 4697 - } 4698 - 4699 - requestCopy.url = requestCopy.url // client_id & client_secret can be passed as URL query parameters to increase rate limit 4700 - // see https://developer.github.com/v3/#increasing-the-unauthenticated-rate-limit-for-oauth-applications 4701 - .replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]") // OAuth tokens can be passed as URL query parameters, although it is not recommended 4702 - // see https://developer.github.com/v3/#oauth2-token-sent-in-a-header 4703 - .replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); 4704 - this.request = requestCopy; 4705 - } 4706 - 4707 - } 4708 - 4709 - exports.RequestError = RequestError; 4710 - //# sourceMappingURL=index.js.map 3572 + module.exports = Hook 3573 + // expose constructors as a named property for TypeScript 3574 + module.exports.Hook = Hook 3575 + module.exports.Singular = Hook.Singular 3576 + module.exports.Collection = Hook.Collection 4711 3577 4712 3578 4713 3579 /***/ }), 4714 3580 4715 3581 /***/ 549: 4716 - /***/ (function(module) { 3582 + /***/ ((module) => { 4717 3583 4718 3584 module.exports = addHook 4719 3585 ··· 4765 3631 4766 3632 /***/ }), 4767 3633 4768 - /***/ 604: 4769 - /***/ (function(module, __unusedexports, __webpack_require__) { 3634 + /***/ 670: 3635 + /***/ ((module) => { 4770 3636 4771 - const core = __webpack_require__(186) 4772 - const github = __webpack_require__(438) 4773 - const moment = __webpack_require__(623) 3637 + module.exports = register 4774 3638 4775 - const ghToken = core.getInput('TOKEN', { required: true }) 4776 - core.setSecret(ghToken) 4777 - const octokit = github.getOctokit(ghToken) 4778 - module.exports.octokit = octokit 3639 + function register (state, name, method, options) { 3640 + if (typeof method !== 'function') { 3641 + throw new Error('method for before hook must be a function') 3642 + } 4779 3643 4780 - module.exports.getUser = async function() { 4781 - const queryResult = await octokit.graphql(` 4782 - query { 4783 - viewer { 4784 - USERNAME: login 4785 - NAME: name 4786 - EMAIL: email 4787 - USER_ID: id 4788 - BIO: bio 4789 - COMPANY: company 4790 - SIGNUP_TIMESTAMP: createdAt 4791 - LOCATION: location 4792 - TWITTER_USERNAME: twitterUsername 4793 - AVATAR_URL: avatarUrl 4794 - WEBSITE_URL: websiteUrl 4795 - repositories { 4796 - totalCount 4797 - totalDiskUsage 4798 - } 4799 - } 4800 - } 4801 - `) 3644 + if (!options) { 3645 + options = {} 3646 + } 4802 3647 4803 - const user = queryResult.viewer 3648 + if (Array.isArray(name)) { 3649 + return name.reverse().reduce(function (callback, name) { 3650 + return register.bind(null, state, name, callback, options) 3651 + }, method)() 3652 + } 4804 3653 4805 - user.SIGNUP_DATE = moment(user.SIGNUP_TIMESTAMP).format('MMMM Do YYYY') 4806 - user.SIGNUP_DATE2 = moment(user.SIGNUP_TIMESTAMP).format('YYYY-MM-DD') 4807 - user.SIGNUP_YEAR = moment(user.SIGNUP_TIMESTAMP).format('YYYY') 4808 - user.SIGNUP_AGO = moment(user.SIGNUP_TIMESTAMP).fromNow() 4809 - user.TOTAL_REPOS_SIZE_KB = user.repositories.totalDiskUsage 4810 - user.TOTAL_REPOS_SIZE_MB = Math.round(user.repositories.totalDiskUsage/1000*10)/10 4811 - user.TOTAL_REPOS_SIZE_GB = Math.round(user.repositories.totalDiskUsage/1000/1000*100)/100 4812 - user.TOTAL_REPOSITORIES = user.repositories.totalCount 4813 - delete user.repositories 3654 + return Promise.resolve() 3655 + .then(function () { 3656 + if (!state.registry[name]) { 3657 + return method(options) 3658 + } 4814 3659 4815 - return user 3660 + return (state.registry[name]).reduce(function (method, registered) { 3661 + return registered.hook.bind(null, method, options) 3662 + }, method)() 3663 + }) 4816 3664 } 4817 3665 4818 - function fixRepoValues(repo) { 4819 3666 4820 - repo.REPO_CREATED_DATE = moment(repo.REPO_CREATED_TIMESTAMP).format('MMMM Do YYYY') 4821 - repo.REPO_CREATED_DATE2 = moment(repo.REPO_CREATED_TIMESTAMP).format('YYYY-MM-DD') 4822 - repo.REPO_CREATED_YEAR = moment(repo.REPO_CREATED_TIMESTAMP).format('YYYY') 4823 - repo.REPO_CREATED_AGO = moment(repo.REPO_CREATED_TIMESTAMP).fromNow() 3667 + /***/ }), 4824 3668 4825 - repo.REPO_PUSHED_DATE = moment(repo.REPO_PUSHED_TIMESTAMP).format('MMMM Do YYYY') 4826 - repo.REPO_PUSHED_DATE2 = moment(repo.REPO_PUSHED_TIMESTAMP).format('YYYY-MM-DD') 4827 - repo.REPO_PUSHED_YEAR = moment(repo.REPO_PUSHED_TIMESTAMP).format('YYYY') 4828 - repo.REPO_PUSHED_AGO = moment(repo.REPO_PUSHED_TIMESTAMP).fromNow() 3669 + /***/ 819: 3670 + /***/ ((module) => { 4829 3671 4830 - repo.REPO_STARS = repo.stargazers.totalCount 4831 - delete repo.stargazers 3672 + module.exports = removeHook 4832 3673 4833 - if (repo.primaryLanguage) { 4834 - repo.REPO_LANGUAGE = repo.primaryLanguage.name 4835 - } else { 4836 - repo.REPO_LANGUAGE = 'None' 3674 + function removeHook (state, name, method) { 3675 + if (!state.registry[name]) { 3676 + return 4837 3677 } 4838 - delete repo.primaryLanguage 4839 3678 4840 - repo.REPO_OWNER_USERNAME = repo.owner.login 4841 - delete repo.owner 3679 + var index = state.registry[name] 3680 + .map(function (registered) { return registered.orig }) 3681 + .indexOf(method) 4842 3682 4843 - repo.REPO_SIZE_KB = repo.diskUsage 4844 - repo.REPO_SIZE_MB = Math.round(repo.diskUsage/1000*10)/10 4845 - repo.REPO_SIZE_GB = Math.round(repo.diskUsage/1000/1000*100)/100 4846 - delete repo.diskUsage 3683 + if (index === -1) { 3684 + return 3685 + } 4847 3686 4848 - return repo 3687 + state.registry[name].splice(index, 1) 4849 3688 } 4850 3689 4851 - module.exports.getRepos = async function(args) { 4852 3690 4853 - const queryResult = await octokit.graphql(` 4854 - query { 4855 - viewer { 4856 - repositories(${args}) { 4857 - edges { 4858 - node { 4859 - REPO_NAME: name 4860 - owner { 4861 - login 4862 - } 4863 - REPO_FULL_NAME: nameWithOwner 4864 - REPO_DESCRIPTION: description 4865 - REPO_URL: url 4866 - REPO_HOMEPAGE_URL: homepageUrl 4867 - REPO_CREATED_TIMESTAMP: createdAt 4868 - REPO_PUSHED_TIMESTAMP: pushedAt 4869 - diskUsage 4870 - REPO_FORK_COUNT: forkCount 4871 - REPO_ID: id 4872 - stargazers { 4873 - totalCount 4874 - } 4875 - primaryLanguage { 4876 - name 4877 - } 4878 - } 4879 - } 4880 - } 4881 - } 4882 - } 4883 - `) 3691 + /***/ }), 4884 3692 4885 - const repoEdges = queryResult.viewer.repositories.edges 4886 - const repos = [] 4887 - for (const repoEdge of repoEdges) { 4888 - let repo = repoEdge.node 4889 - repo = fixRepoValues(repo) 4890 - repos.push(repo) 4891 - } 4892 - return repos 4893 - 4894 - } 3693 + /***/ 932: 3694 + /***/ ((__unused_webpack_module, exports) => { 3695 + 3696 + "use strict"; 3697 + 3698 + 3699 + Object.defineProperty(exports, "__esModule", ({ value: true })); 3700 + 3701 + class Deprecation extends Error { 3702 + constructor(message) { 3703 + super(message); // Maintains proper stack trace (only available on V8) 4895 3704 4896 - module.exports.getSpecificRepos = async function(username, repoNames) { 3705 + /* istanbul ignore next */ 4897 3706 4898 - let repoQueryProperties = '' 4899 - let index = -1 4900 - for (let repoName of repoNames) { 4901 - index += 1 4902 - let repoOwner = '' 4903 - if (repoName.includes('/')) { 4904 - repoOwner = repoName.split('/')[0] 4905 - repoName = repoName.split('/')[1] 4906 - } else { 4907 - repoOwner = username 3707 + if (Error.captureStackTrace) { 3708 + Error.captureStackTrace(this, this.constructor); 4908 3709 } 4909 3710 4910 - repoQueryProperties += ` 4911 - repo${index}: repository(owner: "${repoOwner}" name: "${repoName}") { 4912 - REPO_NAME: name 4913 - owner { 4914 - login 4915 - } 4916 - REPO_FULL_NAME: nameWithOwner 4917 - REPO_DESCRIPTION: description 4918 - REPO_URL: url 4919 - REPO_HOMEPAGE_URL: homepageUrl 4920 - REPO_CREATED_TIMESTAMP: createdAt 4921 - REPO_PUSHED_TIMESTAMP: pushedAt 4922 - REPO_FORK_COUNT: forkCount 4923 - REPO_ID: id 4924 - diskUsage 4925 - stargazers { 4926 - totalCount 4927 - } 4928 - primaryLanguage { 4929 - name 4930 - } 4931 - } 4932 - ` 3711 + this.name = 'Deprecation'; 4933 3712 } 4934 - const queryResult = await octokit.graphql(` 4935 - query { 4936 - ${repoQueryProperties} 4937 - } 4938 - `) 4939 - let repos = [] 4940 - for (let i = 0; i !== null; i++) { 4941 - let repo = queryResult['repo'+i] 4942 - if (!repo) break 4943 - repo = fixRepoValues(repo) 4944 - repos.push(repo) 4945 - } 4946 - return repos 3713 + 4947 3714 } 3715 + 3716 + exports.Deprecation = Deprecation; 4948 3717 4949 3718 4950 3719 /***/ }), 4951 3720 4952 - /***/ 605: 4953 - /***/ (function(module) { 3721 + /***/ 840: 3722 + /***/ ((module) => { 4954 3723 4955 - module.exports = require("http"); 3724 + "use strict"; 4956 3725 4957 - /***/ }), 4958 3726 4959 - /***/ 608: 4960 - /***/ (function(module) { 4961 - 4962 - module.exports.newErr = function(...args) { 4963 - const err = new Error(...args) 4964 - err.logMessageOnly = true 4965 - return err 4966 - } 3727 + /*! 3728 + * is-plain-object <https://github.com/jonschlinkert/is-plain-object> 3729 + * 3730 + * Copyright (c) 2014-2017, Jon Schlinkert. 3731 + * Released under the MIT License. 3732 + */ 4967 3733 4968 - module.exports.trimLeftChar = function(string, charToRemove) { 4969 - while(string.charAt(0)==charToRemove) { 4970 - string = string.substring(1) 4971 - } 4972 - return string 4973 - } 4974 - module.exports.trimRightChar = function(string, charToRemove) { 4975 - while(string.charAt(string.length-1)==charToRemove) { 4976 - string = string.substring(0,string.length-1) 4977 - } 4978 - return string 3734 + function isObject(o) { 3735 + return Object.prototype.toString.call(o) === '[object Object]'; 4979 3736 } 4980 3737 4981 - module.exports.deleteFirstLine = function(str) { 4982 - const lines = str.split('\n') 4983 - if (lines[0] === '') { 4984 - lines.splice(1, 1) 4985 - } else { 4986 - lines.splice(0, 1) 4987 - } 4988 - return lines.join('\n') 4989 - } 4990 - module.exports.deleteLastLine = function(str) { 4991 - const lines = str.split('\n') 4992 - if (lines[lines.length-1] === '') { 4993 - lines.splice(-2, 1) 4994 - } else { 4995 - lines.splice(-1, 1) 4996 - } 4997 - return lines.join('\n') 4998 - } 3738 + function isPlainObject(o) { 3739 + var ctor,prot; 4999 3740 3741 + if (isObject(o) === false) return false; 5000 3742 5001 - /***/ }), 3743 + // If has modified constructor 3744 + ctor = o.constructor; 3745 + if (ctor === undefined) return true; 5002 3746 5003 - /***/ 614: 5004 - /***/ (function(module) { 3747 + // If has modified prototype 3748 + prot = ctor.prototype; 3749 + if (isObject(prot) === false) return false; 5005 3750 5006 - module.exports = require("events"); 3751 + // If constructor does not have an Object-specific method 3752 + if (prot.hasOwnProperty('isPrototypeOf') === false) { 3753 + return false; 3754 + } 5007 3755 5008 - /***/ }), 3756 + // Most likely a plain Object 3757 + return true; 3758 + } 5009 3759 5010 - /***/ 622: 5011 - /***/ (function(module) { 3760 + module.exports = isPlainObject; 5012 3761 5013 - module.exports = require("path"); 5014 3762 5015 3763 /***/ }), 5016 3764 5017 3765 /***/ 623: 5018 - /***/ (function(module, __unusedexports, __webpack_require__) { 3766 + /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { 5019 3767 5020 - /* module decorator */ module = __webpack_require__.nmd(module); 3768 + /* module decorator */ module = __nccwpck_require__.nmd(module); 5021 3769 //! moment.js 5022 - //! version : 2.27.0 3770 + //! version : 2.29.1 5023 3771 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors 5024 3772 //! license : MIT 5025 3773 //! momentjs.com 5026 3774 5027 3775 ;(function (global, factory) { 5028 3776 true ? module.exports = factory() : 5029 - undefined 3777 + 0 5030 3778 }(this, (function () { 'use strict'; 5031 3779 5032 3780 var hookCallback; ··· 7559 6307 hooks.createFromInputFallback = deprecate( 7560 6308 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + 7561 6309 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + 7562 - 'discouraged and will be removed in an upcoming major release. Please refer to ' + 7563 - 'http://momentjs.com/guides/#/warnings/js-date/ for more info.', 6310 + 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.', 7564 6311 function (config) { 7565 6312 config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); 7566 6313 } ··· 8745 7492 function calendar$1(time, formats) { 8746 7493 // Support for single parameter, formats only overload to the calendar function 8747 7494 if (arguments.length === 1) { 8748 - if (isMomentInput(arguments[0])) { 7495 + if (!arguments[0]) { 7496 + time = undefined; 7497 + formats = undefined; 7498 + } else if (isMomentInput(arguments[0])) { 8749 7499 time = arguments[0]; 8750 7500 formats = undefined; 8751 7501 } else if (isCalendarSpec(arguments[0])) { ··· 9423 8173 eras = this.localeData().eras(); 9424 8174 for (i = 0, l = eras.length; i < l; ++i) { 9425 8175 // truncate time 9426 - val = this.startOf('day').valueOf(); 8176 + val = this.clone().startOf('day').valueOf(); 9427 8177 9428 8178 if (eras[i].since <= val && val <= eras[i].until) { 9429 8179 return eras[i].name; ··· 9443 8193 eras = this.localeData().eras(); 9444 8194 for (i = 0, l = eras.length; i < l; ++i) { 9445 8195 // truncate time 9446 - val = this.startOf('day').valueOf(); 8196 + val = this.clone().startOf('day').valueOf(); 9447 8197 9448 8198 if (eras[i].since <= val && val <= eras[i].until) { 9449 8199 return eras[i].narrow; ··· 9463 8213 eras = this.localeData().eras(); 9464 8214 for (i = 0, l = eras.length; i < l; ++i) { 9465 8215 // truncate time 9466 - val = this.startOf('day').valueOf(); 8216 + val = this.clone().startOf('day').valueOf(); 9467 8217 9468 8218 if (eras[i].since <= val && val <= eras[i].until) { 9469 8219 return eras[i].abbr; ··· 9486 8236 dir = eras[i].since <= eras[i].until ? +1 : -1; 9487 8237 9488 8238 // truncate time 9489 - val = this.startOf('day').valueOf(); 8239 + val = this.clone().startOf('day').valueOf(); 9490 8240 9491 8241 if ( 9492 8242 (eras[i].since <= val && val <= eras[i].until) || ··· 10637 9387 10638 9388 //! moment.js 10639 9389 10640 - hooks.version = '2.27.0'; 9390 + hooks.version = '2.29.1'; 10641 9391 10642 9392 setHookCallback(createLocal); 10643 9393 ··· 10689 9439 10690 9440 /***/ }), 10691 9441 10692 - /***/ 631: 10693 - /***/ (function(module) { 9442 + /***/ 467: 9443 + /***/ ((module, exports, __nccwpck_require__) => { 10694 9444 10695 - module.exports = require("net"); 9445 + "use strict"; 10696 9446 10697 - /***/ }), 10698 9447 10699 - /***/ 668: 10700 - /***/ (function(__unusedmodule, exports, __webpack_require__) { 9448 + Object.defineProperty(exports, "__esModule", ({ value: true })); 10701 9449 10702 - "use strict"; 9450 + function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } 10703 9451 9452 + var Stream = _interopDefault(__nccwpck_require__(413)); 9453 + var http = _interopDefault(__nccwpck_require__(605)); 9454 + var Url = _interopDefault(__nccwpck_require__(835)); 9455 + var https = _interopDefault(__nccwpck_require__(211)); 9456 + var zlib = _interopDefault(__nccwpck_require__(761)); 10704 9457 10705 - Object.defineProperty(exports, '__esModule', { value: true }); 9458 + // Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js 10706 9459 10707 - var request = __webpack_require__(234); 10708 - var universalUserAgent = __webpack_require__(429); 9460 + // fix for "Readable" isn't a named export issue 9461 + const Readable = Stream.Readable; 10709 9462 10710 - const VERSION = "4.5.4"; 9463 + const BUFFER = Symbol('buffer'); 9464 + const TYPE = Symbol('type'); 10711 9465 10712 - class GraphqlError extends Error { 10713 - constructor(request, response) { 10714 - const message = response.data.errors[0].message; 10715 - super(message); 10716 - Object.assign(this, response.data); 10717 - Object.assign(this, { 10718 - headers: response.headers 10719 - }); 10720 - this.name = "GraphqlError"; 10721 - this.request = request; // Maintains proper stack trace (only available on V8) 9466 + class Blob { 9467 + constructor() { 9468 + this[TYPE] = ''; 10722 9469 10723 - /* istanbul ignore next */ 9470 + const blobParts = arguments[0]; 9471 + const options = arguments[1]; 10724 9472 10725 - if (Error.captureStackTrace) { 10726 - Error.captureStackTrace(this, this.constructor); 10727 - } 10728 - } 9473 + const buffers = []; 9474 + let size = 0; 10729 9475 9476 + if (blobParts) { 9477 + const a = blobParts; 9478 + const length = Number(a.length); 9479 + for (let i = 0; i < length; i++) { 9480 + const element = a[i]; 9481 + let buffer; 9482 + if (element instanceof Buffer) { 9483 + buffer = element; 9484 + } else if (ArrayBuffer.isView(element)) { 9485 + buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); 9486 + } else if (element instanceof ArrayBuffer) { 9487 + buffer = Buffer.from(element); 9488 + } else if (element instanceof Blob) { 9489 + buffer = element[BUFFER]; 9490 + } else { 9491 + buffer = Buffer.from(typeof element === 'string' ? element : String(element)); 9492 + } 9493 + size += buffer.length; 9494 + buffers.push(buffer); 9495 + } 9496 + } 9497 + 9498 + this[BUFFER] = Buffer.concat(buffers); 9499 + 9500 + let type = options && options.type !== undefined && String(options.type).toLowerCase(); 9501 + if (type && !/[^\u0020-\u007E]/.test(type)) { 9502 + this[TYPE] = type; 9503 + } 9504 + } 9505 + get size() { 9506 + return this[BUFFER].length; 9507 + } 9508 + get type() { 9509 + return this[TYPE]; 9510 + } 9511 + text() { 9512 + return Promise.resolve(this[BUFFER].toString()); 9513 + } 9514 + arrayBuffer() { 9515 + const buf = this[BUFFER]; 9516 + const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); 9517 + return Promise.resolve(ab); 9518 + } 9519 + stream() { 9520 + const readable = new Readable(); 9521 + readable._read = function () {}; 9522 + readable.push(this[BUFFER]); 9523 + readable.push(null); 9524 + return readable; 9525 + } 9526 + toString() { 9527 + return '[object Blob]'; 9528 + } 9529 + slice() { 9530 + const size = this.size; 9531 + 9532 + const start = arguments[0]; 9533 + const end = arguments[1]; 9534 + let relativeStart, relativeEnd; 9535 + if (start === undefined) { 9536 + relativeStart = 0; 9537 + } else if (start < 0) { 9538 + relativeStart = Math.max(size + start, 0); 9539 + } else { 9540 + relativeStart = Math.min(start, size); 9541 + } 9542 + if (end === undefined) { 9543 + relativeEnd = size; 9544 + } else if (end < 0) { 9545 + relativeEnd = Math.max(size + end, 0); 9546 + } else { 9547 + relativeEnd = Math.min(end, size); 9548 + } 9549 + const span = Math.max(relativeEnd - relativeStart, 0); 9550 + 9551 + const buffer = this[BUFFER]; 9552 + const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); 9553 + const blob = new Blob([], { type: arguments[2] }); 9554 + blob[BUFFER] = slicedBuffer; 9555 + return blob; 9556 + } 10730 9557 } 10731 9558 10732 - const NON_VARIABLE_OPTIONS = ["method", "baseUrl", "url", "headers", "request", "query", "mediaType"]; 10733 - function graphql(request, query, options) { 10734 - options = typeof query === "string" ? options = Object.assign({ 10735 - query 10736 - }, options) : options = query; 10737 - const requestOptions = Object.keys(options).reduce((result, key) => { 10738 - if (NON_VARIABLE_OPTIONS.includes(key)) { 10739 - result[key] = options[key]; 10740 - return result; 10741 - } 9559 + Object.defineProperties(Blob.prototype, { 9560 + size: { enumerable: true }, 9561 + type: { enumerable: true }, 9562 + slice: { enumerable: true } 9563 + }); 10742 9564 10743 - if (!result.variables) { 10744 - result.variables = {}; 10745 - } 9565 + Object.defineProperty(Blob.prototype, Symbol.toStringTag, { 9566 + value: 'Blob', 9567 + writable: false, 9568 + enumerable: false, 9569 + configurable: true 9570 + }); 10746 9571 10747 - result.variables[key] = options[key]; 10748 - return result; 10749 - }, {}); 10750 - return request(requestOptions).then(response => { 10751 - if (response.data.errors) { 10752 - const headers = {}; 9572 + /** 9573 + * fetch-error.js 9574 + * 9575 + * FetchError interface for operational errors 9576 + */ 9577 + 9578 + /** 9579 + * Create FetchError instance 9580 + * 9581 + * @param String message Error message for human 9582 + * @param String type Error type for machine 9583 + * @param String systemError For Node.js system error 9584 + * @return FetchError 9585 + */ 9586 + function FetchError(message, type, systemError) { 9587 + Error.call(this, message); 10753 9588 10754 - for (const key of Object.keys(response.headers)) { 10755 - headers[key] = response.headers[key]; 10756 - } 9589 + this.message = message; 9590 + this.type = type; 10757 9591 10758 - throw new GraphqlError(requestOptions, { 10759 - headers, 10760 - data: response.data 10761 - }); 10762 - } 9592 + // when err.type is `system`, err.code contains system error code 9593 + if (systemError) { 9594 + this.code = this.errno = systemError.code; 9595 + } 10763 9596 10764 - return response.data.data; 10765 - }); 9597 + // hide custom error implementation details from end-users 9598 + Error.captureStackTrace(this, this.constructor); 10766 9599 } 10767 9600 10768 - function withDefaults(request$1, newDefaults) { 10769 - const newRequest = request$1.defaults(newDefaults); 9601 + FetchError.prototype = Object.create(Error.prototype); 9602 + FetchError.prototype.constructor = FetchError; 9603 + FetchError.prototype.name = 'FetchError'; 10770 9604 10771 - const newApi = (query, options) => { 10772 - return graphql(newRequest, query, options); 10773 - }; 9605 + let convert; 9606 + try { 9607 + convert = __nccwpck_require__(877).convert; 9608 + } catch (e) {} 10774 9609 10775 - return Object.assign(newApi, { 10776 - defaults: withDefaults.bind(null, newRequest), 10777 - endpoint: request.request.endpoint 10778 - }); 9610 + const INTERNALS = Symbol('Body internals'); 9611 + 9612 + // fix an issue where "PassThrough" isn't a named export for node <10 9613 + const PassThrough = Stream.PassThrough; 9614 + 9615 + /** 9616 + * Body mixin 9617 + * 9618 + * Ref: https://fetch.spec.whatwg.org/#body 9619 + * 9620 + * @param Stream body Readable stream 9621 + * @param Object opts Response options 9622 + * @return Void 9623 + */ 9624 + function Body(body) { 9625 + var _this = this; 9626 + 9627 + var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, 9628 + _ref$size = _ref.size; 9629 + 9630 + let size = _ref$size === undefined ? 0 : _ref$size; 9631 + var _ref$timeout = _ref.timeout; 9632 + let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; 9633 + 9634 + if (body == null) { 9635 + // body is undefined or null 9636 + body = null; 9637 + } else if (isURLSearchParams(body)) { 9638 + // body is a URLSearchParams 9639 + body = Buffer.from(body.toString()); 9640 + } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { 9641 + // body is ArrayBuffer 9642 + body = Buffer.from(body); 9643 + } else if (ArrayBuffer.isView(body)) { 9644 + // body is ArrayBufferView 9645 + body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); 9646 + } else if (body instanceof Stream) ; else { 9647 + // none of the above 9648 + // coerce to string then buffer 9649 + body = Buffer.from(String(body)); 9650 + } 9651 + this[INTERNALS] = { 9652 + body, 9653 + disturbed: false, 9654 + error: null 9655 + }; 9656 + this.size = size; 9657 + this.timeout = timeout; 9658 + 9659 + if (body instanceof Stream) { 9660 + body.on('error', function (err) { 9661 + const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); 9662 + _this[INTERNALS].error = error; 9663 + }); 9664 + } 10779 9665 } 10780 9666 10781 - const graphql$1 = withDefaults(request.request, { 10782 - headers: { 10783 - "user-agent": `octokit-graphql.js/${VERSION} ${universalUserAgent.getUserAgent()}` 10784 - }, 10785 - method: "POST", 10786 - url: "/graphql" 9667 + Body.prototype = { 9668 + get body() { 9669 + return this[INTERNALS].body; 9670 + }, 9671 + 9672 + get bodyUsed() { 9673 + return this[INTERNALS].disturbed; 9674 + }, 9675 + 9676 + /** 9677 + * Decode response as ArrayBuffer 9678 + * 9679 + * @return Promise 9680 + */ 9681 + arrayBuffer() { 9682 + return consumeBody.call(this).then(function (buf) { 9683 + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); 9684 + }); 9685 + }, 9686 + 9687 + /** 9688 + * Return raw response as Blob 9689 + * 9690 + * @return Promise 9691 + */ 9692 + blob() { 9693 + let ct = this.headers && this.headers.get('content-type') || ''; 9694 + return consumeBody.call(this).then(function (buf) { 9695 + return Object.assign( 9696 + // Prevent copying 9697 + new Blob([], { 9698 + type: ct.toLowerCase() 9699 + }), { 9700 + [BUFFER]: buf 9701 + }); 9702 + }); 9703 + }, 9704 + 9705 + /** 9706 + * Decode response as json 9707 + * 9708 + * @return Promise 9709 + */ 9710 + json() { 9711 + var _this2 = this; 9712 + 9713 + return consumeBody.call(this).then(function (buffer) { 9714 + try { 9715 + return JSON.parse(buffer.toString()); 9716 + } catch (err) { 9717 + return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); 9718 + } 9719 + }); 9720 + }, 9721 + 9722 + /** 9723 + * Decode response as text 9724 + * 9725 + * @return Promise 9726 + */ 9727 + text() { 9728 + return consumeBody.call(this).then(function (buffer) { 9729 + return buffer.toString(); 9730 + }); 9731 + }, 9732 + 9733 + /** 9734 + * Decode response as buffer (non-spec api) 9735 + * 9736 + * @return Promise 9737 + */ 9738 + buffer() { 9739 + return consumeBody.call(this); 9740 + }, 9741 + 9742 + /** 9743 + * Decode response as text, while automatically detecting the encoding and 9744 + * trying to decode to UTF-8 (non-spec api) 9745 + * 9746 + * @return Promise 9747 + */ 9748 + textConverted() { 9749 + var _this3 = this; 9750 + 9751 + return consumeBody.call(this).then(function (buffer) { 9752 + return convertBody(buffer, _this3.headers); 9753 + }); 9754 + } 9755 + }; 9756 + 9757 + // In browsers, all properties are enumerable. 9758 + Object.defineProperties(Body.prototype, { 9759 + body: { enumerable: true }, 9760 + bodyUsed: { enumerable: true }, 9761 + arrayBuffer: { enumerable: true }, 9762 + blob: { enumerable: true }, 9763 + json: { enumerable: true }, 9764 + text: { enumerable: true } 10787 9765 }); 10788 - function withCustomRequest(customRequest) { 10789 - return withDefaults(customRequest, { 10790 - method: "POST", 10791 - url: "/graphql" 10792 - }); 9766 + 9767 + Body.mixIn = function (proto) { 9768 + for (const name of Object.getOwnPropertyNames(Body.prototype)) { 9769 + // istanbul ignore else: future proof 9770 + if (!(name in proto)) { 9771 + const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); 9772 + Object.defineProperty(proto, name, desc); 9773 + } 9774 + } 9775 + }; 9776 + 9777 + /** 9778 + * Consume and convert an entire Body to a Buffer. 9779 + * 9780 + * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body 9781 + * 9782 + * @return Promise 9783 + */ 9784 + function consumeBody() { 9785 + var _this4 = this; 9786 + 9787 + if (this[INTERNALS].disturbed) { 9788 + return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); 9789 + } 9790 + 9791 + this[INTERNALS].disturbed = true; 9792 + 9793 + if (this[INTERNALS].error) { 9794 + return Body.Promise.reject(this[INTERNALS].error); 9795 + } 9796 + 9797 + let body = this.body; 9798 + 9799 + // body is null 9800 + if (body === null) { 9801 + return Body.Promise.resolve(Buffer.alloc(0)); 9802 + } 9803 + 9804 + // body is blob 9805 + if (isBlob(body)) { 9806 + body = body.stream(); 9807 + } 9808 + 9809 + // body is buffer 9810 + if (Buffer.isBuffer(body)) { 9811 + return Body.Promise.resolve(body); 9812 + } 9813 + 9814 + // istanbul ignore if: should never happen 9815 + if (!(body instanceof Stream)) { 9816 + return Body.Promise.resolve(Buffer.alloc(0)); 9817 + } 9818 + 9819 + // body is stream 9820 + // get ready to actually consume the body 9821 + let accum = []; 9822 + let accumBytes = 0; 9823 + let abort = false; 9824 + 9825 + return new Body.Promise(function (resolve, reject) { 9826 + let resTimeout; 9827 + 9828 + // allow timeout on slow response body 9829 + if (_this4.timeout) { 9830 + resTimeout = setTimeout(function () { 9831 + abort = true; 9832 + reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); 9833 + }, _this4.timeout); 9834 + } 9835 + 9836 + // handle stream errors 9837 + body.on('error', function (err) { 9838 + if (err.name === 'AbortError') { 9839 + // if the request was aborted, reject with this Error 9840 + abort = true; 9841 + reject(err); 9842 + } else { 9843 + // other errors, such as incorrect content-encoding 9844 + reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); 9845 + } 9846 + }); 9847 + 9848 + body.on('data', function (chunk) { 9849 + if (abort || chunk === null) { 9850 + return; 9851 + } 9852 + 9853 + if (_this4.size && accumBytes + chunk.length > _this4.size) { 9854 + abort = true; 9855 + reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); 9856 + return; 9857 + } 9858 + 9859 + accumBytes += chunk.length; 9860 + accum.push(chunk); 9861 + }); 9862 + 9863 + body.on('end', function () { 9864 + if (abort) { 9865 + return; 9866 + } 9867 + 9868 + clearTimeout(resTimeout); 9869 + 9870 + try { 9871 + resolve(Buffer.concat(accum, accumBytes)); 9872 + } catch (err) { 9873 + // handle streams that have accumulated too much data (issue #414) 9874 + reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); 9875 + } 9876 + }); 9877 + }); 10793 9878 } 10794 9879 10795 - exports.graphql = graphql$1; 10796 - exports.withCustomRequest = withCustomRequest; 10797 - //# sourceMappingURL=index.js.map 9880 + /** 9881 + * Detect buffer encoding and convert to target encoding 9882 + * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding 9883 + * 9884 + * @param Buffer buffer Incoming buffer 9885 + * @param String encoding Target encoding 9886 + * @return String 9887 + */ 9888 + function convertBody(buffer, headers) { 9889 + if (typeof convert !== 'function') { 9890 + throw new Error('The package `encoding` must be installed to use the textConverted() function'); 9891 + } 10798 9892 9893 + const ct = headers.get('content-type'); 9894 + let charset = 'utf-8'; 9895 + let res, str; 10799 9896 10800 - /***/ }), 9897 + // header 9898 + if (ct) { 9899 + res = /charset=([^;]*)/i.exec(ct); 9900 + } 10801 9901 10802 - /***/ 669: 10803 - /***/ (function(module) { 9902 + // no charset in content type, peek at response body for at most 1024 bytes 9903 + str = buffer.slice(0, 1024).toString(); 10804 9904 10805 - module.exports = require("util"); 9905 + // html5 9906 + if (!res && str) { 9907 + res = /<meta.+?charset=(['"])(.+?)\1/i.exec(str); 9908 + } 10806 9909 10807 - /***/ }), 9910 + // html4 9911 + if (!res && str) { 9912 + res = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(str); 10808 9913 10809 - /***/ 670: 10810 - /***/ (function(module) { 9914 + if (res) { 9915 + res = /charset=(.*)/i.exec(res.pop()); 9916 + } 9917 + } 10811 9918 10812 - module.exports = register 9919 + // xml 9920 + if (!res && str) { 9921 + res = /<\?xml.+?encoding=(['"])(.+?)\1/i.exec(str); 9922 + } 10813 9923 10814 - function register (state, name, method, options) { 10815 - if (typeof method !== 'function') { 10816 - throw new Error('method for before hook must be a function') 10817 - } 9924 + // found charset 9925 + if (res) { 9926 + charset = res.pop(); 10818 9927 10819 - if (!options) { 10820 - options = {} 10821 - } 9928 + // prevent decode issues when sites use incorrect encoding 9929 + // ref: https://hsivonen.fi/encoding-menu/ 9930 + if (charset === 'gb2312' || charset === 'gbk') { 9931 + charset = 'gb18030'; 9932 + } 9933 + } 10822 9934 10823 - if (Array.isArray(name)) { 10824 - return name.reverse().reduce(function (callback, name) { 10825 - return register.bind(null, state, name, callback, options) 10826 - }, method)() 10827 - } 9935 + // turn raw buffers into a single utf-8 buffer 9936 + return convert(buffer, 'UTF-8', charset).toString(); 9937 + } 10828 9938 10829 - return Promise.resolve() 10830 - .then(function () { 10831 - if (!state.registry[name]) { 10832 - return method(options) 10833 - } 9939 + /** 9940 + * Detect a URLSearchParams object 9941 + * ref: https://github.com/bitinn/node-fetch/issues/296#issuecomment-307598143 9942 + * 9943 + * @param Object obj Object to detect by type or brand 9944 + * @return String 9945 + */ 9946 + function isURLSearchParams(obj) { 9947 + // Duck-typing as a necessary condition. 9948 + if (typeof obj !== 'object' || typeof obj.append !== 'function' || typeof obj.delete !== 'function' || typeof obj.get !== 'function' || typeof obj.getAll !== 'function' || typeof obj.has !== 'function' || typeof obj.set !== 'function') { 9949 + return false; 9950 + } 10834 9951 10835 - return (state.registry[name]).reduce(function (method, registered) { 10836 - return registered.hook.bind(null, method, options) 10837 - }, method)() 10838 - }) 9952 + // Brand-checking and more duck-typing as optional condition. 9953 + return obj.constructor.name === 'URLSearchParams' || Object.prototype.toString.call(obj) === '[object URLSearchParams]' || typeof obj.sort === 'function'; 10839 9954 } 10840 9955 9956 + /** 9957 + * Check if `obj` is a W3C `Blob` object (which `File` inherits from) 9958 + * @param {*} obj 9959 + * @return {boolean} 9960 + */ 9961 + function isBlob(obj) { 9962 + return typeof obj === 'object' && typeof obj.arrayBuffer === 'function' && typeof obj.type === 'string' && typeof obj.stream === 'function' && typeof obj.constructor === 'function' && typeof obj.constructor.name === 'string' && /^(Blob|File)$/.test(obj.constructor.name) && /^(Blob|File)$/.test(obj[Symbol.toStringTag]); 9963 + } 10841 9964 10842 - /***/ }), 9965 + /** 9966 + * Clone body given Res/Req instance 9967 + * 9968 + * @param Mixed instance Response or Request instance 9969 + * @return Mixed 9970 + */ 9971 + function clone(instance) { 9972 + let p1, p2; 9973 + let body = instance.body; 10843 9974 10844 - /***/ 682: 10845 - /***/ (function(module, __unusedexports, __webpack_require__) { 9975 + // don't allow cloning a used body 9976 + if (instance.bodyUsed) { 9977 + throw new Error('cannot clone body after it is used'); 9978 + } 10846 9979 10847 - var register = __webpack_require__(670) 10848 - var addHook = __webpack_require__(549) 10849 - var removeHook = __webpack_require__(819) 9980 + // check that body is a stream and not form-data object 9981 + // note: we can't clone the form-data object without having it as a dependency 9982 + if (body instanceof Stream && typeof body.getBoundary !== 'function') { 9983 + // tee instance body 9984 + p1 = new PassThrough(); 9985 + p2 = new PassThrough(); 9986 + body.pipe(p1); 9987 + body.pipe(p2); 9988 + // set instance body to teed body and return the other teed body 9989 + instance[INTERNALS].body = p1; 9990 + body = p2; 9991 + } 10850 9992 10851 - // bind with array of arguments: https://stackoverflow.com/a/21792913 10852 - var bind = Function.bind 10853 - var bindable = bind.bind(bind) 9993 + return body; 9994 + } 10854 9995 10855 - function bindApi (hook, state, name) { 10856 - var removeHookRef = bindable(removeHook, null).apply(null, name ? [state, name] : [state]) 10857 - hook.api = { remove: removeHookRef } 10858 - hook.remove = removeHookRef 9996 + /** 9997 + * Performs the operation "extract a `Content-Type` value from |object|" as 9998 + * specified in the specification: 9999 + * https://fetch.spec.whatwg.org/#concept-bodyinit-extract 10000 + * 10001 + * This function assumes that instance.body is present. 10002 + * 10003 + * @param Mixed instance Any options.body input 10004 + */ 10005 + function extractContentType(body) { 10006 + if (body === null) { 10007 + // body is null 10008 + return null; 10009 + } else if (typeof body === 'string') { 10010 + // body is string 10011 + return 'text/plain;charset=UTF-8'; 10012 + } else if (isURLSearchParams(body)) { 10013 + // body is a URLSearchParams 10014 + return 'application/x-www-form-urlencoded;charset=UTF-8'; 10015 + } else if (isBlob(body)) { 10016 + // body is blob 10017 + return body.type || null; 10018 + } else if (Buffer.isBuffer(body)) { 10019 + // body is buffer 10020 + return null; 10021 + } else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { 10022 + // body is ArrayBuffer 10023 + return null; 10024 + } else if (ArrayBuffer.isView(body)) { 10025 + // body is ArrayBufferView 10026 + return null; 10027 + } else if (typeof body.getBoundary === 'function') { 10028 + // detect form data input from form-data module 10029 + return `multipart/form-data;boundary=${body.getBoundary()}`; 10030 + } else if (body instanceof Stream) { 10031 + // body is stream 10032 + // can't really do much about this 10033 + return null; 10034 + } else { 10035 + // Body constructor defaults other things to string 10036 + return 'text/plain;charset=UTF-8'; 10037 + } 10038 + } 10859 10039 10860 - ;['before', 'error', 'after', 'wrap'].forEach(function (kind) { 10861 - var args = name ? [state, kind, name] : [state, kind] 10862 - hook[kind] = hook.api[kind] = bindable(addHook, null).apply(null, args) 10863 - }) 10040 + /** 10041 + * The Fetch Standard treats this as if "total bytes" is a property on the body. 10042 + * For us, we have to explicitly get it with a function. 10043 + * 10044 + * ref: https://fetch.spec.whatwg.org/#concept-body-total-bytes 10045 + * 10046 + * @param Body instance Instance of Body 10047 + * @return Number? Number of bytes, or null if not possible 10048 + */ 10049 + function getTotalBytes(instance) { 10050 + const body = instance.body; 10051 + 10052 + 10053 + if (body === null) { 10054 + // body is null 10055 + return 0; 10056 + } else if (isBlob(body)) { 10057 + return body.size; 10058 + } else if (Buffer.isBuffer(body)) { 10059 + // body is buffer 10060 + return body.length; 10061 + } else if (body && typeof body.getLengthSync === 'function') { 10062 + // detect form data input from form-data module 10063 + if (body._lengthRetrievers && body._lengthRetrievers.length == 0 || // 1.x 10064 + body.hasKnownLength && body.hasKnownLength()) { 10065 + // 2.x 10066 + return body.getLengthSync(); 10067 + } 10068 + return null; 10069 + } else { 10070 + // body is stream 10071 + return null; 10072 + } 10864 10073 } 10865 10074 10866 - function HookSingular () { 10867 - var singularHookName = 'h' 10868 - var singularHookState = { 10869 - registry: {} 10870 - } 10871 - var singularHook = register.bind(null, singularHookState, singularHookName) 10872 - bindApi(singularHook, singularHookState, singularHookName) 10873 - return singularHook 10075 + /** 10076 + * Write a Body to a Node.js WritableStream (e.g. http.Request) object. 10077 + * 10078 + * @param Body instance Instance of Body 10079 + * @return Void 10080 + */ 10081 + function writeToStream(dest, instance) { 10082 + const body = instance.body; 10083 + 10084 + 10085 + if (body === null) { 10086 + // body is null 10087 + dest.end(); 10088 + } else if (isBlob(body)) { 10089 + body.stream().pipe(dest); 10090 + } else if (Buffer.isBuffer(body)) { 10091 + // body is buffer 10092 + dest.write(body); 10093 + dest.end(); 10094 + } else { 10095 + // body is stream 10096 + body.pipe(dest); 10097 + } 10874 10098 } 10875 10099 10876 - function HookCollection () { 10877 - var state = { 10878 - registry: {} 10879 - } 10100 + // expose Promise 10101 + Body.Promise = global.Promise; 10880 10102 10881 - var hook = register.bind(null, state) 10882 - bindApi(hook, state) 10103 + /** 10104 + * headers.js 10105 + * 10106 + * Headers class offers convenient helpers 10107 + */ 10883 10108 10884 - return hook 10109 + const invalidTokenRegex = /[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/; 10110 + const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/; 10111 + 10112 + function validateName(name) { 10113 + name = `${name}`; 10114 + if (invalidTokenRegex.test(name) || name === '') { 10115 + throw new TypeError(`${name} is not a legal HTTP header name`); 10116 + } 10885 10117 } 10886 10118 10887 - var collectionHookDeprecationMessageDisplayed = false 10888 - function Hook () { 10889 - if (!collectionHookDeprecationMessageDisplayed) { 10890 - console.warn('[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4') 10891 - collectionHookDeprecationMessageDisplayed = true 10892 - } 10893 - return HookCollection() 10119 + function validateValue(value) { 10120 + value = `${value}`; 10121 + if (invalidHeaderCharRegex.test(value)) { 10122 + throw new TypeError(`${value} is not a legal HTTP header value`); 10123 + } 10894 10124 } 10895 10125 10896 - Hook.Singular = HookSingular.bind() 10897 - Hook.Collection = HookCollection.bind() 10126 + /** 10127 + * Find the key in the map object given a header name. 10128 + * 10129 + * Returns undefined if not found. 10130 + * 10131 + * @param String name Header name 10132 + * @return String|Undefined 10133 + */ 10134 + function find(map, name) { 10135 + name = name.toLowerCase(); 10136 + for (const key in map) { 10137 + if (key.toLowerCase() === name) { 10138 + return key; 10139 + } 10140 + } 10141 + return undefined; 10142 + } 10898 10143 10899 - module.exports = Hook 10900 - // expose constructors as a named property for TypeScript 10901 - module.exports.Hook = Hook 10902 - module.exports.Singular = Hook.Singular 10903 - module.exports.Collection = Hook.Collection 10144 + const MAP = Symbol('map'); 10145 + class Headers { 10146 + /** 10147 + * Headers class 10148 + * 10149 + * @param Object headers Response headers 10150 + * @return Void 10151 + */ 10152 + constructor() { 10153 + let init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined; 10904 10154 10155 + this[MAP] = Object.create(null); 10905 10156 10906 - /***/ }), 10157 + if (init instanceof Headers) { 10158 + const rawHeaders = init.raw(); 10159 + const headerNames = Object.keys(rawHeaders); 10160 + 10161 + for (const headerName of headerNames) { 10162 + for (const value of rawHeaders[headerName]) { 10163 + this.append(headerName, value); 10164 + } 10165 + } 10166 + 10167 + return; 10168 + } 10169 + 10170 + // We don't worry about converting prop to ByteString here as append() 10171 + // will handle it. 10172 + if (init == null) ; else if (typeof init === 'object') { 10173 + const method = init[Symbol.iterator]; 10174 + if (method != null) { 10175 + if (typeof method !== 'function') { 10176 + throw new TypeError('Header pairs must be iterable'); 10177 + } 10178 + 10179 + // sequence<sequence<ByteString>> 10180 + // Note: per spec we have to first exhaust the lists then process them 10181 + const pairs = []; 10182 + for (const pair of init) { 10183 + if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { 10184 + throw new TypeError('Each header pair must be iterable'); 10185 + } 10186 + pairs.push(Array.from(pair)); 10187 + } 10188 + 10189 + for (const pair of pairs) { 10190 + if (pair.length !== 2) { 10191 + throw new TypeError('Each header pair must be a name/value tuple'); 10192 + } 10193 + this.append(pair[0], pair[1]); 10194 + } 10195 + } else { 10196 + // record<ByteString, ByteString> 10197 + for (const key of Object.keys(init)) { 10198 + const value = init[key]; 10199 + this.append(key, value); 10200 + } 10201 + } 10202 + } else { 10203 + throw new TypeError('Provided initializer must be an object'); 10204 + } 10205 + } 10907 10206 10908 - /***/ 713: 10909 - /***/ (function(__unusedmodule, __unusedexports, __webpack_require__) { 10207 + /** 10208 + * Return combined header value given name 10209 + * 10210 + * @param String name Header name 10211 + * @return Mixed 10212 + */ 10213 + get(name) { 10214 + name = `${name}`; 10215 + validateName(name); 10216 + const key = find(this[MAP], name); 10217 + if (key === undefined) { 10218 + return null; 10219 + } 10910 10220 10911 - const core = __webpack_require__(186) 10912 - const fs = __webpack_require__(747) 10913 - const moment = __webpack_require__(623) 10914 - const queries = __webpack_require__(604) 10915 - const { 10916 - newErr, 10917 - trimRightChar, 10918 - deleteFirstLine, 10919 - deleteLastLine, 10920 - } = __webpack_require__(608) 10221 + return this[MAP][key].join(', '); 10222 + } 10921 10223 10922 - // parses first found only 10923 - function parseBlock(str, openStr, closeStr) { 10924 - const openIndex = str.indexOf(openStr) 10925 - const endIndex = str.indexOf(closeStr) 10926 - if (openIndex < 0 || endIndex < 0) return null 10224 + /** 10225 + * Iterate over all headers 10226 + * 10227 + * @param Function callback Executed for each item with parameters (value, name, thisArg) 10228 + * @param Boolean thisArg `this` context for callback function 10229 + * @return Void 10230 + */ 10231 + forEach(callback) { 10232 + let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; 10927 10233 10928 - let beforeBlock = str.substring(0, openIndex) 10929 - beforeBlock = trimRightChar(beforeBlock, ' ') 10930 - if (beforeBlock.endsWith('\n')) { 10931 - beforeBlock = beforeBlock.substring(0, beforeBlock.length - 1) 10932 - } 10933 - let block = str.substring(openIndex+openStr.length, endIndex) 10934 - block = trimRightChar(block, ' ') 10935 - if (block.endsWith('\n')) { 10936 - block = block.substring(0, block.length - 1) 10937 - } 10938 - let afterBlock = str.substring(endIndex+closeStr.length) 10939 - return { beforeBlock, block, afterBlock } 10234 + let pairs = getHeaders(this); 10235 + let i = 0; 10236 + while (i < pairs.length) { 10237 + var _pairs$i = pairs[i]; 10238 + const name = _pairs$i[0], 10239 + value = _pairs$i[1]; 10240 + 10241 + callback.call(thisArg, value, name, this); 10242 + pairs = getHeaders(this); 10243 + i++; 10244 + } 10245 + } 10246 + 10247 + /** 10248 + * Overwrite header values given name 10249 + * 10250 + * @param String name Header name 10251 + * @param String value Header value 10252 + * @return Void 10253 + */ 10254 + set(name, value) { 10255 + name = `${name}`; 10256 + value = `${value}`; 10257 + validateName(name); 10258 + validateValue(value); 10259 + const key = find(this[MAP], name); 10260 + this[MAP][key !== undefined ? key : name] = [value]; 10261 + } 10262 + 10263 + /** 10264 + * Append a value onto existing header 10265 + * 10266 + * @param String name Header name 10267 + * @param String value Header value 10268 + * @return Void 10269 + */ 10270 + append(name, value) { 10271 + name = `${name}`; 10272 + value = `${value}`; 10273 + validateName(name); 10274 + validateValue(value); 10275 + const key = find(this[MAP], name); 10276 + if (key !== undefined) { 10277 + this[MAP][key].push(value); 10278 + } else { 10279 + this[MAP][name] = [value]; 10280 + } 10281 + } 10282 + 10283 + /** 10284 + * Check for header name existence 10285 + * 10286 + * @param String name Header name 10287 + * @return Boolean 10288 + */ 10289 + has(name) { 10290 + name = `${name}`; 10291 + validateName(name); 10292 + return find(this[MAP], name) !== undefined; 10293 + } 10294 + 10295 + /** 10296 + * Delete all header values given name 10297 + * 10298 + * @param String name Header name 10299 + * @return Void 10300 + */ 10301 + delete(name) { 10302 + name = `${name}`; 10303 + validateName(name); 10304 + const key = find(this[MAP], name); 10305 + if (key !== undefined) { 10306 + delete this[MAP][key]; 10307 + } 10308 + } 10309 + 10310 + /** 10311 + * Return raw headers (non-spec api) 10312 + * 10313 + * @return Object 10314 + */ 10315 + raw() { 10316 + return this[MAP]; 10317 + } 10318 + 10319 + /** 10320 + * Get an iterator on keys. 10321 + * 10322 + * @return Iterator 10323 + */ 10324 + keys() { 10325 + return createHeadersIterator(this, 'key'); 10326 + } 10327 + 10328 + /** 10329 + * Get an iterator on values. 10330 + * 10331 + * @return Iterator 10332 + */ 10333 + values() { 10334 + return createHeadersIterator(this, 'value'); 10335 + } 10336 + 10337 + /** 10338 + * Get an iterator on entries. 10339 + * 10340 + * This is the default iterator of the Headers object. 10341 + * 10342 + * @return Iterator 10343 + */ 10344 + [Symbol.iterator]() { 10345 + return createHeadersIterator(this, 'key+value'); 10346 + } 10940 10347 } 10348 + Headers.prototype.entries = Headers.prototype[Symbol.iterator]; 10941 10349 10942 - function getCustomTemplate(str) { 10943 - const parsed = parseBlock(str, '// {{ TEMPLATE: }}', '// {{ :TEMPLATE }}') 10944 - if (!parsed) return { customTemplate: {}, outputStr: str } 10945 - parsed.beforeBlock = deleteLastLine(parsed.beforeBlock) 10946 - parsed.afterBlock = deleteFirstLine(parsed.afterBlock) 10350 + Object.defineProperty(Headers.prototype, Symbol.toStringTag, { 10351 + value: 'Headers', 10352 + writable: false, 10353 + enumerable: false, 10354 + configurable: true 10355 + }); 10947 10356 10948 - const requireFromString = __webpack_require__(176) 10949 - const parsedCustomTemplate = requireFromString(parsed.block) 10357 + Object.defineProperties(Headers.prototype, { 10358 + get: { enumerable: true }, 10359 + forEach: { enumerable: true }, 10360 + set: { enumerable: true }, 10361 + append: { enumerable: true }, 10362 + has: { enumerable: true }, 10363 + delete: { enumerable: true }, 10364 + keys: { enumerable: true }, 10365 + values: { enumerable: true }, 10366 + entries: { enumerable: true } 10367 + }); 10950 10368 10951 - return { 10952 - customTemplate: parsedCustomTemplate, 10953 - outputStr: parsed.beforeBlock + parsed.afterBlock, 10954 - } 10369 + function getHeaders(headers) { 10370 + let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; 10955 10371 10372 + const keys = Object.keys(headers[MAP]).sort(); 10373 + return keys.map(kind === 'key' ? function (k) { 10374 + return k.toLowerCase(); 10375 + } : kind === 'value' ? function (k) { 10376 + return headers[MAP][k].join(', '); 10377 + } : function (k) { 10378 + return [k.toLowerCase(), headers[MAP][k].join(', ')]; 10379 + }); 10956 10380 } 10957 10381 10958 - function inject(str, values) { 10959 - for (const [key, value] of Object.entries(values)) { 10960 - const valueStr = '{{ '+key+' }}' 10961 - str = str.split(valueStr).join(value) 10962 - } 10963 - return str 10382 + const INTERNAL = Symbol('internal'); 10383 + 10384 + function createHeadersIterator(target, kind) { 10385 + const iterator = Object.create(HeadersIteratorPrototype); 10386 + iterator[INTERNAL] = { 10387 + target, 10388 + kind, 10389 + index: 0 10390 + }; 10391 + return iterator; 10964 10392 } 10965 10393 10966 - async function injectLoop(str, name, valuesListArg) { 10967 - const parsed = parseBlock(str, `{{ loop ${name} }}`, `{{ end ${name} }}`) 10968 - if (!parsed) return str 10969 - let valuesList = valuesListArg 10970 - if (typeof valuesListArg === 'function') valuesList = await valuesListArg() 10971 - let newBlock = '' 10972 - for (const values of valuesList) { 10973 - newBlock += inject(parsed.block, values) 10974 - } 10975 - return parsed.beforeBlock + newBlock + await injectLoop(parsed.afterBlock, name, valuesList) 10394 + const HeadersIteratorPrototype = Object.setPrototypeOf({ 10395 + next() { 10396 + // istanbul ignore if 10397 + if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { 10398 + throw new TypeError('Value of `this` is not a HeadersIterator'); 10399 + } 10400 + 10401 + var _INTERNAL = this[INTERNAL]; 10402 + const target = _INTERNAL.target, 10403 + kind = _INTERNAL.kind, 10404 + index = _INTERNAL.index; 10405 + 10406 + const values = getHeaders(target, kind); 10407 + const len = values.length; 10408 + if (index >= len) { 10409 + return { 10410 + value: undefined, 10411 + done: true 10412 + }; 10413 + } 10414 + 10415 + this[INTERNAL].index = index + 1; 10416 + 10417 + return { 10418 + value: values[index], 10419 + done: false 10420 + }; 10421 + } 10422 + }, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); 10423 + 10424 + Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { 10425 + value: 'HeadersIterator', 10426 + writable: false, 10427 + enumerable: false, 10428 + configurable: true 10429 + }); 10430 + 10431 + /** 10432 + * Export the Headers object in a form that Node.js can consume. 10433 + * 10434 + * @param Headers headers 10435 + * @return Object 10436 + */ 10437 + function exportNodeCompatibleHeaders(headers) { 10438 + const obj = Object.assign({ __proto__: null }, headers[MAP]); 10439 + 10440 + // http.request() only supports string as Host header. This hack makes 10441 + // specifying custom Host header possible. 10442 + const hostHeaderKey = find(headers[MAP], 'Host'); 10443 + if (hostHeaderKey !== undefined) { 10444 + obj[hostHeaderKey] = obj[hostHeaderKey][0]; 10445 + } 10446 + 10447 + return obj; 10976 10448 } 10977 10449 10978 - run() 10979 - async function run() { 10980 - try { 10450 + /** 10451 + * Create a Headers object from an object of headers, ignoring those that do 10452 + * not conform to HTTP grammar productions. 10453 + * 10454 + * @param Object obj Object of headers 10455 + * @return Headers 10456 + */ 10457 + function createHeadersLenient(obj) { 10458 + const headers = new Headers(); 10459 + for (const name of Object.keys(obj)) { 10460 + if (invalidTokenRegex.test(name)) { 10461 + continue; 10462 + } 10463 + if (Array.isArray(obj[name])) { 10464 + for (const val of obj[name]) { 10465 + if (invalidHeaderCharRegex.test(val)) { 10466 + continue; 10467 + } 10468 + if (headers[MAP][name] === undefined) { 10469 + headers[MAP][name] = [val]; 10470 + } else { 10471 + headers[MAP][name].push(val); 10472 + } 10473 + } 10474 + } else if (!invalidHeaderCharRegex.test(obj[name])) { 10475 + headers[MAP][name] = [obj[name]]; 10476 + } 10477 + } 10478 + return headers; 10479 + } 10981 10480 10982 - let templatePath = core.getInput('TEMPLATE', { required: true }) 10983 - console.log('template:', templatePath) 10984 - if (!fs.existsSync(templatePath)) throw newErr('Template file not found') 10985 - const templateFile = fs.readFileSync(templatePath).toString() 10481 + const INTERNALS$1 = Symbol('Response internals'); 10986 10482 10987 - let outputPath = core.getInput('OUTPUT', { required: true }) 10988 - console.log('output:', outputPath) 10483 + // fix an issue where "STATUS_CODES" aren't a named export for node <10 10484 + const STATUS_CODES = http.STATUS_CODES; 10989 10485 10990 - let { customTemplate, outputStr } = getCustomTemplate(templateFile) 10486 + /** 10487 + * Response class 10488 + * 10489 + * @param Stream body Readable stream 10490 + * @param Object opts Response options 10491 + * @return Void 10492 + */ 10493 + class Response { 10494 + constructor() { 10495 + let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 10496 + let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 10991 10497 10992 - console.log('User data') 10993 - console.log(' - Fetching') 10994 - const user = await queries.getUser() 10995 - console.log(' - Injecting') 10996 - outputStr = inject(outputStr, user) 10498 + Body.call(this, body, opts); 10997 10499 10998 - if (!customTemplate['3_MOST_STARRED_REPOS']) { 10999 - customTemplate['3_MOST_STARRED_REPOS'] = { 11000 - type: 'repos', 11001 - params: ` 11002 - first: 3, 11003 - privacy: PUBLIC, 11004 - ownerAffiliations:[OWNER], 11005 - orderBy: { field:STARGAZERS, direction: DESC } 11006 - ` 11007 - } 11008 - } 11009 - if (!customTemplate['3_NEWEST_REPOS']) { 11010 - customTemplate['3_NEWEST_REPOS'] = { 11011 - type: 'repos', 11012 - params: ` 11013 - first: 3, 11014 - privacy: PUBLIC, 11015 - ownerAffiliations:[OWNER], 11016 - orderBy: { field:CREATED_AT, direction: DESC } 11017 - ` 11018 - } 11019 - } 11020 - if (!customTemplate['3_RECENTLY_PUSHED_REPOS']) { 11021 - customTemplate['3_RECENTLY_PUSHED_REPOS'] = { 11022 - type: 'repos', 11023 - params: ` 11024 - first: 3, 11025 - privacy: PUBLIC, 11026 - ownerAffiliations:[OWNER], 11027 - orderBy: { field:PUSHED_AT, direction: DESC } 11028 - ` 11029 - } 11030 - } 10500 + const status = opts.status || 200; 10501 + const headers = new Headers(opts.headers); 11031 10502 11032 - for (const [templateName, template] of Object.entries(customTemplate)) { 11033 - if (template.type === 'repos' || template.type === 'specificRepos') { 10503 + if (body != null && !headers.has('Content-Type')) { 10504 + const contentType = extractContentType(body); 10505 + if (contentType) { 10506 + headers.append('Content-Type', contentType); 10507 + } 10508 + } 11034 10509 11035 - console.log(templateName) 11036 - console.log(' - Looking for') 11037 - outputStr = await injectLoop(outputStr, templateName, async () => { 11038 - console.log(' - Fetching') 11039 - const repos = template.type === 'repos' 11040 - ? await queries.getRepos(template.params) 11041 - : await queries.getSpecificRepos(user.USERNAME, template.repos) 11042 - if (typeof template.modifyVariables === 'function') { 11043 - for (let i = 0; i < repos.length; i++) { 11044 - repos[i] = template.modifyVariables(repos[i], moment, user) 11045 - } 11046 - } 11047 - console.log(' - Injecting') 11048 - return repos 11049 - }) 10510 + this[INTERNALS$1] = { 10511 + url: opts.url, 10512 + status, 10513 + statusText: opts.statusText || STATUS_CODES[status], 10514 + headers, 10515 + counter: opts.counter 10516 + }; 10517 + } 10518 + 10519 + get url() { 10520 + return this[INTERNALS$1].url || ''; 10521 + } 10522 + 10523 + get status() { 10524 + return this[INTERNALS$1].status; 10525 + } 10526 + 10527 + /** 10528 + * Convenience property representing if the request ended normally 10529 + */ 10530 + get ok() { 10531 + return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; 10532 + } 11050 10533 11051 - } else if (template.type === 'customQuery') { 10534 + get redirected() { 10535 + return this[INTERNALS$1].counter > 0; 10536 + } 11052 10537 11053 - console.log(templateName, '(customQuery)') 11054 - if (template.loop) { 11055 - console.log(' - Looking for') 11056 - outputStr = await injectLoop(outputStr, templateName, async () => { 11057 - console.log(' - Fetching') 11058 - const resultArray = await template.query(queries.octokit, moment, user) 11059 - console.log(' - Injecting') 11060 - return resultArray 11061 - }) 11062 - } else { 11063 - console.log(' - Fetching') 11064 - const resultObject = await template.query(queries.octokit, moment, user) 11065 - console.log(' - Injecting') 11066 - outputStr = inject(outputStr, resultObject) 11067 - } 11068 - 11069 - } else { 11070 - throw new Error(`Invalid template type "${template.type}"`) 11071 - } 11072 - } 10538 + get statusText() { 10539 + return this[INTERNALS$1].statusText; 10540 + } 11073 10541 11074 - fs.writeFileSync(outputPath, outputStr) 10542 + get headers() { 10543 + return this[INTERNALS$1].headers; 10544 + } 11075 10545 11076 - } catch (error) { 11077 - if (!error || !error.logMessageOnly) { 11078 - console.log(error) 11079 - } 11080 - core.setFailed(error.message) 11081 - } 10546 + /** 10547 + * Clone this response 10548 + * 10549 + * @return Response 10550 + */ 10551 + clone() { 10552 + return new Response(clone(this), { 10553 + url: this.url, 10554 + status: this.status, 10555 + statusText: this.statusText, 10556 + headers: this.headers, 10557 + ok: this.ok, 10558 + redirected: this.redirected 10559 + }); 10560 + } 11082 10561 } 11083 10562 10563 + Body.mixIn(Response.prototype); 11084 10564 11085 - /***/ }), 10565 + Object.defineProperties(Response.prototype, { 10566 + url: { enumerable: true }, 10567 + status: { enumerable: true }, 10568 + ok: { enumerable: true }, 10569 + redirected: { enumerable: true }, 10570 + statusText: { enumerable: true }, 10571 + headers: { enumerable: true }, 10572 + clone: { enumerable: true } 10573 + }); 11086 10574 11087 - /***/ 747: 11088 - /***/ (function(module) { 10575 + Object.defineProperty(Response.prototype, Symbol.toStringTag, { 10576 + value: 'Response', 10577 + writable: false, 10578 + enumerable: false, 10579 + configurable: true 10580 + }); 10581 + 10582 + const INTERNALS$2 = Symbol('Request internals'); 10583 + 10584 + // fix an issue where "format", "parse" aren't a named export for node <10 10585 + const parse_url = Url.parse; 10586 + const format_url = Url.format; 10587 + 10588 + const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; 10589 + 10590 + /** 10591 + * Check if a value is an instance of Request. 10592 + * 10593 + * @param Mixed input 10594 + * @return Boolean 10595 + */ 10596 + function isRequest(input) { 10597 + return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; 10598 + } 10599 + 10600 + function isAbortSignal(signal) { 10601 + const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); 10602 + return !!(proto && proto.constructor.name === 'AbortSignal'); 10603 + } 10604 + 10605 + /** 10606 + * Request class 10607 + * 10608 + * @param Mixed input Url or Request instance 10609 + * @param Object init Custom options 10610 + * @return Void 10611 + */ 10612 + class Request { 10613 + constructor(input) { 10614 + let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 10615 + 10616 + let parsedURL; 10617 + 10618 + // normalize input 10619 + if (!isRequest(input)) { 10620 + if (input && input.href) { 10621 + // in order to support Node.js' Url objects; though WHATWG's URL objects 10622 + // will fall into this branch also (since their `toString()` will return 10623 + // `href` property anyway) 10624 + parsedURL = parse_url(input.href); 10625 + } else { 10626 + // coerce input to a string before attempting to parse 10627 + parsedURL = parse_url(`${input}`); 10628 + } 10629 + input = {}; 10630 + } else { 10631 + parsedURL = parse_url(input.url); 10632 + } 10633 + 10634 + let method = init.method || input.method || 'GET'; 10635 + method = method.toUpperCase(); 10636 + 10637 + if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { 10638 + throw new TypeError('Request with GET/HEAD method cannot have body'); 10639 + } 10640 + 10641 + let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; 10642 + 10643 + Body.call(this, inputBody, { 10644 + timeout: init.timeout || input.timeout || 0, 10645 + size: init.size || input.size || 0 10646 + }); 11089 10647 11090 - module.exports = require("fs"); 10648 + const headers = new Headers(init.headers || input.headers || {}); 11091 10649 11092 - /***/ }), 10650 + if (inputBody != null && !headers.has('Content-Type')) { 10651 + const contentType = extractContentType(inputBody); 10652 + if (contentType) { 10653 + headers.append('Content-Type', contentType); 10654 + } 10655 + } 11093 10656 11094 - /***/ 761: 11095 - /***/ (function(module) { 10657 + let signal = isRequest(input) ? input.signal : null; 10658 + if ('signal' in init) signal = init.signal; 11096 10659 11097 - module.exports = require("zlib"); 10660 + if (signal != null && !isAbortSignal(signal)) { 10661 + throw new TypeError('Expected signal to be an instanceof AbortSignal'); 10662 + } 11098 10663 11099 - /***/ }), 10664 + this[INTERNALS$2] = { 10665 + method, 10666 + redirect: init.redirect || input.redirect || 'follow', 10667 + headers, 10668 + parsedURL, 10669 + signal 10670 + }; 11100 10671 11101 - /***/ 762: 11102 - /***/ (function(__unusedmodule, exports, __webpack_require__) { 10672 + // node-fetch-only options 10673 + this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; 10674 + this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; 10675 + this.counter = init.counter || input.counter || 0; 10676 + this.agent = init.agent || input.agent; 10677 + } 11103 10678 11104 - "use strict"; 10679 + get method() { 10680 + return this[INTERNALS$2].method; 10681 + } 11105 10682 10683 + get url() { 10684 + return format_url(this[INTERNALS$2].parsedURL); 10685 + } 11106 10686 11107 - Object.defineProperty(exports, '__esModule', { value: true }); 10687 + get headers() { 10688 + return this[INTERNALS$2].headers; 10689 + } 11108 10690 11109 - var universalUserAgent = __webpack_require__(429); 11110 - var beforeAfterHook = __webpack_require__(682); 11111 - var request = __webpack_require__(234); 11112 - var graphql = __webpack_require__(668); 11113 - var authToken = __webpack_require__(334); 10691 + get redirect() { 10692 + return this[INTERNALS$2].redirect; 10693 + } 11114 10694 11115 - function _defineProperty(obj, key, value) { 11116 - if (key in obj) { 11117 - Object.defineProperty(obj, key, { 11118 - value: value, 11119 - enumerable: true, 11120 - configurable: true, 11121 - writable: true 11122 - }); 11123 - } else { 11124 - obj[key] = value; 11125 - } 10695 + get signal() { 10696 + return this[INTERNALS$2].signal; 10697 + } 11126 10698 11127 - return obj; 10699 + /** 10700 + * Clone this request 10701 + * 10702 + * @return Request 10703 + */ 10704 + clone() { 10705 + return new Request(this); 10706 + } 11128 10707 } 11129 10708 11130 - function ownKeys(object, enumerableOnly) { 11131 - var keys = Object.keys(object); 10709 + Body.mixIn(Request.prototype); 10710 + 10711 + Object.defineProperty(Request.prototype, Symbol.toStringTag, { 10712 + value: 'Request', 10713 + writable: false, 10714 + enumerable: false, 10715 + configurable: true 10716 + }); 10717 + 10718 + Object.defineProperties(Request.prototype, { 10719 + method: { enumerable: true }, 10720 + url: { enumerable: true }, 10721 + headers: { enumerable: true }, 10722 + redirect: { enumerable: true }, 10723 + clone: { enumerable: true }, 10724 + signal: { enumerable: true } 10725 + }); 10726 + 10727 + /** 10728 + * Convert a Request to Node.js http request options. 10729 + * 10730 + * @param Request A Request instance 10731 + * @return Object The options object to be passed to http.request 10732 + */ 10733 + function getNodeRequestOptions(request) { 10734 + const parsedURL = request[INTERNALS$2].parsedURL; 10735 + const headers = new Headers(request[INTERNALS$2].headers); 10736 + 10737 + // fetch step 1.3 10738 + if (!headers.has('Accept')) { 10739 + headers.set('Accept', '*/*'); 10740 + } 10741 + 10742 + // Basic fetch 10743 + if (!parsedURL.protocol || !parsedURL.hostname) { 10744 + throw new TypeError('Only absolute URLs are supported'); 10745 + } 10746 + 10747 + if (!/^https?:$/.test(parsedURL.protocol)) { 10748 + throw new TypeError('Only HTTP(S) protocols are supported'); 10749 + } 10750 + 10751 + if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { 10752 + throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); 10753 + } 10754 + 10755 + // HTTP-network-or-cache fetch steps 2.4-2.7 10756 + let contentLengthValue = null; 10757 + if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { 10758 + contentLengthValue = '0'; 10759 + } 10760 + if (request.body != null) { 10761 + const totalBytes = getTotalBytes(request); 10762 + if (typeof totalBytes === 'number') { 10763 + contentLengthValue = String(totalBytes); 10764 + } 10765 + } 10766 + if (contentLengthValue) { 10767 + headers.set('Content-Length', contentLengthValue); 10768 + } 10769 + 10770 + // HTTP-network-or-cache fetch step 2.11 10771 + if (!headers.has('User-Agent')) { 10772 + headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); 10773 + } 11132 10774 11133 - if (Object.getOwnPropertySymbols) { 11134 - var symbols = Object.getOwnPropertySymbols(object); 11135 - if (enumerableOnly) symbols = symbols.filter(function (sym) { 11136 - return Object.getOwnPropertyDescriptor(object, sym).enumerable; 11137 - }); 11138 - keys.push.apply(keys, symbols); 11139 - } 10775 + // HTTP-network-or-cache fetch step 2.15 10776 + if (request.compress && !headers.has('Accept-Encoding')) { 10777 + headers.set('Accept-Encoding', 'gzip,deflate'); 10778 + } 11140 10779 11141 - return keys; 10780 + let agent = request.agent; 10781 + if (typeof agent === 'function') { 10782 + agent = agent(parsedURL); 10783 + } 10784 + 10785 + if (!headers.has('Connection') && !agent) { 10786 + headers.set('Connection', 'close'); 10787 + } 10788 + 10789 + // HTTP-network fetch step 4.2 10790 + // chunked encoding is handled by Node.js 10791 + 10792 + return Object.assign({}, parsedURL, { 10793 + method: request.method, 10794 + headers: exportNodeCompatibleHeaders(headers), 10795 + agent 10796 + }); 11142 10797 } 11143 10798 11144 - function _objectSpread2(target) { 11145 - for (var i = 1; i < arguments.length; i++) { 11146 - var source = arguments[i] != null ? arguments[i] : {}; 10799 + /** 10800 + * abort-error.js 10801 + * 10802 + * AbortError interface for cancelled requests 10803 + */ 11147 10804 11148 - if (i % 2) { 11149 - ownKeys(Object(source), true).forEach(function (key) { 11150 - _defineProperty(target, key, source[key]); 11151 - }); 11152 - } else if (Object.getOwnPropertyDescriptors) { 11153 - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); 11154 - } else { 11155 - ownKeys(Object(source)).forEach(function (key) { 11156 - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 11157 - }); 11158 - } 11159 - } 10805 + /** 10806 + * Create AbortError instance 10807 + * 10808 + * @param String message Error message for human 10809 + * @return AbortError 10810 + */ 10811 + function AbortError(message) { 10812 + Error.call(this, message); 10813 + 10814 + this.type = 'aborted'; 10815 + this.message = message; 11160 10816 11161 - return target; 10817 + // hide custom error implementation details from end-users 10818 + Error.captureStackTrace(this, this.constructor); 11162 10819 } 11163 10820 11164 - const VERSION = "3.1.2"; 10821 + AbortError.prototype = Object.create(Error.prototype); 10822 + AbortError.prototype.constructor = AbortError; 10823 + AbortError.prototype.name = 'AbortError'; 11165 10824 11166 - class Octokit { 11167 - constructor(options = {}) { 11168 - const hook = new beforeAfterHook.Collection(); 11169 - const requestDefaults = { 11170 - baseUrl: request.request.endpoint.DEFAULTS.baseUrl, 11171 - headers: {}, 11172 - request: Object.assign({}, options.request, { 11173 - hook: hook.bind(null, "request") 11174 - }), 11175 - mediaType: { 11176 - previews: [], 11177 - format: "" 11178 - } 11179 - }; // prepend default user agent with `options.userAgent` if set 10825 + // fix an issue where "PassThrough", "resolve" aren't a named export for node <10 10826 + const PassThrough$1 = Stream.PassThrough; 10827 + const resolve_url = Url.resolve; 11180 10828 11181 - requestDefaults.headers["user-agent"] = [options.userAgent, `octokit-core.js/${VERSION} ${universalUserAgent.getUserAgent()}`].filter(Boolean).join(" "); 10829 + /** 10830 + * Fetch function 10831 + * 10832 + * @param Mixed url Absolute url or Request instance 10833 + * @param Object opts Fetch options 10834 + * @return Promise 10835 + */ 10836 + function fetch(url, opts) { 11182 10837 11183 - if (options.baseUrl) { 11184 - requestDefaults.baseUrl = options.baseUrl; 11185 - } 10838 + // allow custom promise 10839 + if (!fetch.Promise) { 10840 + throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); 10841 + } 11186 10842 11187 - if (options.previews) { 11188 - requestDefaults.mediaType.previews = options.previews; 11189 - } 10843 + Body.Promise = fetch.Promise; 11190 10844 11191 - if (options.timeZone) { 11192 - requestDefaults.headers["time-zone"] = options.timeZone; 11193 - } 10845 + // wrap http.request into fetch 10846 + return new fetch.Promise(function (resolve, reject) { 10847 + // build request object 10848 + const request = new Request(url, opts); 10849 + const options = getNodeRequestOptions(request); 11194 10850 11195 - this.request = request.request.defaults(requestDefaults); 11196 - this.graphql = graphql.withCustomRequest(this.request).defaults(_objectSpread2(_objectSpread2({}, requestDefaults), {}, { 11197 - baseUrl: requestDefaults.baseUrl.replace(/\/api\/v3$/, "/api") 11198 - })); 11199 - this.log = Object.assign({ 11200 - debug: () => {}, 11201 - info: () => {}, 11202 - warn: console.warn.bind(console), 11203 - error: console.error.bind(console) 11204 - }, options.log); 11205 - this.hook = hook; // (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance 11206 - // is unauthenticated. The `this.auth()` method is a no-op and no request hook is registred. 11207 - // (2) If only `options.auth` is set, use the default token authentication strategy. 11208 - // (3) If `options.authStrategy` is set then use it and pass in `options.auth`. Always pass own request as many strategies accept a custom request instance. 11209 - // TODO: type `options.auth` based on `options.authStrategy`. 10851 + const send = (options.protocol === 'https:' ? https : http).request; 10852 + const signal = request.signal; 11210 10853 11211 - if (!options.authStrategy) { 11212 - if (!options.auth) { 11213 - // (1) 11214 - this.auth = async () => ({ 11215 - type: "unauthenticated" 11216 - }); 11217 - } else { 11218 - // (2) 11219 - const auth = authToken.createTokenAuth(options.auth); // @ts-ignore ¯\_(ツ)_/¯ 10854 + let response = null; 11220 10855 11221 - hook.wrap("request", auth.hook); 11222 - this.auth = auth; 11223 - } 11224 - } else { 11225 - const auth = options.authStrategy(Object.assign({ 11226 - request: this.request 11227 - }, options.auth)); // @ts-ignore ¯\_(ツ)_/¯ 10856 + const abort = function abort() { 10857 + let error = new AbortError('The user aborted a request.'); 10858 + reject(error); 10859 + if (request.body && request.body instanceof Stream.Readable) { 10860 + request.body.destroy(error); 10861 + } 10862 + if (!response || !response.body) return; 10863 + response.body.emit('error', error); 10864 + }; 11228 10865 11229 - hook.wrap("request", auth.hook); 11230 - this.auth = auth; 11231 - } // apply plugins 11232 - // https://stackoverflow.com/a/16345172 10866 + if (signal && signal.aborted) { 10867 + abort(); 10868 + return; 10869 + } 11233 10870 10871 + const abortAndFinalize = function abortAndFinalize() { 10872 + abort(); 10873 + finalize(); 10874 + }; 11234 10875 11235 - const classConstructor = this.constructor; 11236 - classConstructor.plugins.forEach(plugin => { 11237 - Object.assign(this, plugin(this, options)); 11238 - }); 11239 - } 10876 + // send request 10877 + const req = send(options); 10878 + let reqTimeout; 11240 10879 11241 - static defaults(defaults) { 11242 - const OctokitWithDefaults = class extends this { 11243 - constructor(...args) { 11244 - const options = args[0] || {}; 10880 + if (signal) { 10881 + signal.addEventListener('abort', abortAndFinalize); 10882 + } 11245 10883 11246 - if (typeof defaults === "function") { 11247 - super(defaults(options)); 11248 - return; 11249 - } 10884 + function finalize() { 10885 + req.abort(); 10886 + if (signal) signal.removeEventListener('abort', abortAndFinalize); 10887 + clearTimeout(reqTimeout); 10888 + } 11250 10889 11251 - super(Object.assign({}, defaults, options, options.userAgent && defaults.userAgent ? { 11252 - userAgent: `${options.userAgent} ${defaults.userAgent}` 11253 - } : null)); 11254 - } 10890 + if (request.timeout) { 10891 + req.once('socket', function (socket) { 10892 + reqTimeout = setTimeout(function () { 10893 + reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); 10894 + finalize(); 10895 + }, request.timeout); 10896 + }); 10897 + } 11255 10898 11256 - }; 11257 - return OctokitWithDefaults; 11258 - } 11259 - /** 11260 - * Attach a plugin (or many) to your Octokit instance. 11261 - * 11262 - * @example 11263 - * const API = Octokit.plugin(plugin1, plugin2, plugin3, ...) 11264 - */ 10899 + req.on('error', function (err) { 10900 + reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); 10901 + finalize(); 10902 + }); 10903 + 10904 + req.on('response', function (res) { 10905 + clearTimeout(reqTimeout); 10906 + 10907 + const headers = createHeadersLenient(res.headers); 10908 + 10909 + // HTTP fetch step 5 10910 + if (fetch.isRedirect(res.statusCode)) { 10911 + // HTTP fetch step 5.2 10912 + const location = headers.get('Location'); 10913 + 10914 + // HTTP fetch step 5.3 10915 + const locationURL = location === null ? null : resolve_url(request.url, location); 10916 + 10917 + // HTTP fetch step 5.5 10918 + switch (request.redirect) { 10919 + case 'error': 10920 + reject(new FetchError(`redirect mode is set to error: ${request.url}`, 'no-redirect')); 10921 + finalize(); 10922 + return; 10923 + case 'manual': 10924 + // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. 10925 + if (locationURL !== null) { 10926 + // handle corrupted header 10927 + try { 10928 + headers.set('Location', locationURL); 10929 + } catch (err) { 10930 + // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request 10931 + reject(err); 10932 + } 10933 + } 10934 + break; 10935 + case 'follow': 10936 + // HTTP-redirect fetch step 2 10937 + if (locationURL === null) { 10938 + break; 10939 + } 10940 + 10941 + // HTTP-redirect fetch step 5 10942 + if (request.counter >= request.follow) { 10943 + reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); 10944 + finalize(); 10945 + return; 10946 + } 10947 + 10948 + // HTTP-redirect fetch step 6 (counter increment) 10949 + // Create a new Request object. 10950 + const requestOpts = { 10951 + headers: new Headers(request.headers), 10952 + follow: request.follow, 10953 + counter: request.counter + 1, 10954 + agent: request.agent, 10955 + compress: request.compress, 10956 + method: request.method, 10957 + body: request.body, 10958 + signal: request.signal, 10959 + timeout: request.timeout 10960 + }; 10961 + 10962 + // HTTP-redirect fetch step 9 10963 + if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { 10964 + reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); 10965 + finalize(); 10966 + return; 10967 + } 10968 + 10969 + // HTTP-redirect fetch step 11 10970 + if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { 10971 + requestOpts.method = 'GET'; 10972 + requestOpts.body = undefined; 10973 + requestOpts.headers.delete('content-length'); 10974 + } 11265 10975 10976 + // HTTP-redirect fetch step 15 10977 + resolve(fetch(new Request(locationURL, requestOpts))); 10978 + finalize(); 10979 + return; 10980 + } 10981 + } 11266 10982 11267 - static plugin(...newPlugins) { 11268 - var _a; 10983 + // prepare response 10984 + res.once('end', function () { 10985 + if (signal) signal.removeEventListener('abort', abortAndFinalize); 10986 + }); 10987 + let body = res.pipe(new PassThrough$1()); 10988 + 10989 + const response_options = { 10990 + url: request.url, 10991 + status: res.statusCode, 10992 + statusText: res.statusMessage, 10993 + headers: headers, 10994 + size: request.size, 10995 + timeout: request.timeout, 10996 + counter: request.counter 10997 + }; 10998 + 10999 + // HTTP-network fetch step 12.1.1.3 11000 + const codings = headers.get('Content-Encoding'); 11001 + 11002 + // HTTP-network fetch step 12.1.1.4: handle content codings 11003 + 11004 + // in following scenarios we ignore compression support 11005 + // 1. compression support is disabled 11006 + // 2. HEAD request 11007 + // 3. no Content-Encoding header 11008 + // 4. no content response (204) 11009 + // 5. content not modified response (304) 11010 + if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { 11011 + response = new Response(body, response_options); 11012 + resolve(response); 11013 + return; 11014 + } 11015 + 11016 + // For Node v6+ 11017 + // Be less strict when decoding compressed responses, since sometimes 11018 + // servers send slightly invalid responses that are still accepted 11019 + // by common browsers. 11020 + // Always using Z_SYNC_FLUSH is what cURL does. 11021 + const zlibOptions = { 11022 + flush: zlib.Z_SYNC_FLUSH, 11023 + finishFlush: zlib.Z_SYNC_FLUSH 11024 + }; 11269 11025 11270 - const currentPlugins = this.plugins; 11271 - const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a); 11272 - return NewOctokit; 11273 - } 11026 + // for gzip 11027 + if (codings == 'gzip' || codings == 'x-gzip') { 11028 + body = body.pipe(zlib.createGunzip(zlibOptions)); 11029 + response = new Response(body, response_options); 11030 + resolve(response); 11031 + return; 11032 + } 11274 11033 11034 + // for deflate 11035 + if (codings == 'deflate' || codings == 'x-deflate') { 11036 + // handle the infamous raw deflate response from old servers 11037 + // a hack for old IIS and Apache servers 11038 + const raw = res.pipe(new PassThrough$1()); 11039 + raw.once('data', function (chunk) { 11040 + // see http://stackoverflow.com/questions/37519828 11041 + if ((chunk[0] & 0x0F) === 0x08) { 11042 + body = body.pipe(zlib.createInflate()); 11043 + } else { 11044 + body = body.pipe(zlib.createInflateRaw()); 11045 + } 11046 + response = new Response(body, response_options); 11047 + resolve(response); 11048 + }); 11049 + return; 11050 + } 11051 + 11052 + // for br 11053 + if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { 11054 + body = body.pipe(zlib.createBrotliDecompress()); 11055 + response = new Response(body, response_options); 11056 + resolve(response); 11057 + return; 11058 + } 11059 + 11060 + // otherwise, use response as-is 11061 + response = new Response(body, response_options); 11062 + resolve(response); 11063 + }); 11064 + 11065 + writeToStream(req, request); 11066 + }); 11275 11067 } 11276 - Octokit.VERSION = VERSION; 11277 - Octokit.plugins = []; 11068 + /** 11069 + * Redirect code matching 11070 + * 11071 + * @param Number code Status code 11072 + * @return Boolean 11073 + */ 11074 + fetch.isRedirect = function (code) { 11075 + return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; 11076 + }; 11278 11077 11279 - exports.Octokit = Octokit; 11280 - //# sourceMappingURL=index.js.map 11078 + // expose Promise 11079 + fetch.Promise = global.Promise; 11080 + 11081 + module.exports = exports = fetch; 11082 + Object.defineProperty(exports, "__esModule", ({ value: true })); 11083 + exports.default = exports; 11084 + exports.Headers = Headers; 11085 + exports.Request = Request; 11086 + exports.Response = Response; 11087 + exports.FetchError = FetchError; 11281 11088 11282 11089 11283 11090 /***/ }), 11284 11091 11285 - /***/ 819: 11286 - /***/ (function(module) { 11092 + /***/ 223: 11093 + /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { 11287 11094 11288 - module.exports = removeHook 11095 + var wrappy = __nccwpck_require__(940) 11096 + module.exports = wrappy(once) 11097 + module.exports.strict = wrappy(onceStrict) 11289 11098 11290 - function removeHook (state, name, method) { 11291 - if (!state.registry[name]) { 11292 - return 11293 - } 11099 + once.proto = once(function () { 11100 + Object.defineProperty(Function.prototype, 'once', { 11101 + value: function () { 11102 + return once(this) 11103 + }, 11104 + configurable: true 11105 + }) 11294 11106 11295 - var index = state.registry[name] 11296 - .map(function (registered) { return registered.orig }) 11297 - .indexOf(method) 11107 + Object.defineProperty(Function.prototype, 'onceStrict', { 11108 + value: function () { 11109 + return onceStrict(this) 11110 + }, 11111 + configurable: true 11112 + }) 11113 + }) 11298 11114 11299 - if (index === -1) { 11300 - return 11115 + function once (fn) { 11116 + var f = function () { 11117 + if (f.called) return f.value 11118 + f.called = true 11119 + return f.value = fn.apply(this, arguments) 11301 11120 } 11121 + f.called = false 11122 + return f 11123 + } 11302 11124 11303 - state.registry[name].splice(index, 1) 11125 + function onceStrict (fn) { 11126 + var f = function () { 11127 + if (f.called) 11128 + throw new Error(f.onceError) 11129 + f.called = true 11130 + return f.value = fn.apply(this, arguments) 11131 + } 11132 + var name = fn.name || 'Function wrapped with `once`' 11133 + f.onceError = name + " shouldn't be called more than once" 11134 + f.called = false 11135 + return f 11304 11136 } 11305 11137 11306 11138 11307 11139 /***/ }), 11308 11140 11309 - /***/ 835: 11310 - /***/ (function(module) { 11141 + /***/ 176: 11142 + /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { 11143 + 11144 + "use strict"; 11145 + /* module decorator */ module = __nccwpck_require__.nmd(module); 11146 + 11147 + 11148 + var Module = __nccwpck_require__(282); 11149 + var path = __nccwpck_require__(622); 11150 + 11151 + module.exports = function requireFromString(code, filename, opts) { 11152 + if (typeof filename === 'object') { 11153 + opts = filename; 11154 + filename = undefined; 11155 + } 11156 + 11157 + opts = opts || {}; 11158 + filename = filename || ''; 11159 + 11160 + opts.appendPaths = opts.appendPaths || []; 11161 + opts.prependPaths = opts.prependPaths || []; 11162 + 11163 + if (typeof code !== 'string') { 11164 + throw new Error('code must be a string, not ' + typeof code); 11165 + } 11166 + 11167 + var paths = Module._nodeModulePaths(path.dirname(filename)); 11168 + 11169 + var parent = module.parent; 11170 + var m = new Module(filename, parent); 11171 + m.filename = filename; 11172 + m.paths = [].concat(opts.prependPaths).concat(paths).concat(opts.appendPaths); 11173 + m._compile(code, filename); 11311 11174 11312 - module.exports = require("url"); 11175 + var exports = m.exports; 11176 + parent && parent.children && parent.children.splice(parent.children.indexOf(m), 1); 11177 + 11178 + return exports; 11179 + }; 11180 + 11313 11181 11314 11182 /***/ }), 11315 11183 11316 - /***/ 840: 11317 - /***/ (function(module) { 11184 + /***/ 294: 11185 + /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { 11186 + 11187 + module.exports = __nccwpck_require__(219); 11188 + 11189 + 11190 + /***/ }), 11191 + 11192 + /***/ 219: 11193 + /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { 11318 11194 11319 11195 "use strict"; 11320 11196 11321 11197 11322 - /*! 11323 - * is-plain-object <https://github.com/jonschlinkert/is-plain-object> 11324 - * 11325 - * Copyright (c) 2014-2017, Jon Schlinkert. 11326 - * Released under the MIT License. 11327 - */ 11198 + var net = __nccwpck_require__(631); 11199 + var tls = __nccwpck_require__(16); 11200 + var http = __nccwpck_require__(605); 11201 + var https = __nccwpck_require__(211); 11202 + var events = __nccwpck_require__(614); 11203 + var assert = __nccwpck_require__(357); 11204 + var util = __nccwpck_require__(669); 11328 11205 11329 - function isObject(o) { 11330 - return Object.prototype.toString.call(o) === '[object Object]'; 11206 + 11207 + exports.httpOverHttp = httpOverHttp; 11208 + exports.httpsOverHttp = httpsOverHttp; 11209 + exports.httpOverHttps = httpOverHttps; 11210 + exports.httpsOverHttps = httpsOverHttps; 11211 + 11212 + 11213 + function httpOverHttp(options) { 11214 + var agent = new TunnelingAgent(options); 11215 + agent.request = http.request; 11216 + return agent; 11331 11217 } 11332 11218 11333 - function isPlainObject(o) { 11334 - var ctor,prot; 11219 + function httpsOverHttp(options) { 11220 + var agent = new TunnelingAgent(options); 11221 + agent.request = http.request; 11222 + agent.createSocket = createSecureSocket; 11223 + agent.defaultPort = 443; 11224 + return agent; 11225 + } 11335 11226 11336 - if (isObject(o) === false) return false; 11227 + function httpOverHttps(options) { 11228 + var agent = new TunnelingAgent(options); 11229 + agent.request = https.request; 11230 + return agent; 11231 + } 11337 11232 11338 - // If has modified constructor 11339 - ctor = o.constructor; 11340 - if (ctor === undefined) return true; 11233 + function httpsOverHttps(options) { 11234 + var agent = new TunnelingAgent(options); 11235 + agent.request = https.request; 11236 + agent.createSocket = createSecureSocket; 11237 + agent.defaultPort = 443; 11238 + return agent; 11239 + } 11341 11240 11342 - // If has modified prototype 11343 - prot = ctor.prototype; 11344 - if (isObject(prot) === false) return false; 11345 11241 11346 - // If constructor does not have an Object-specific method 11347 - if (prot.hasOwnProperty('isPrototypeOf') === false) { 11348 - return false; 11349 - } 11242 + function TunnelingAgent(options) { 11243 + var self = this; 11244 + self.options = options || {}; 11245 + self.proxyOptions = self.options.proxy || {}; 11246 + self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; 11247 + self.requests = []; 11248 + self.sockets = []; 11350 11249 11351 - // Most likely a plain Object 11352 - return true; 11250 + self.on('free', function onFree(socket, host, port, localAddress) { 11251 + var options = toOptions(host, port, localAddress); 11252 + for (var i = 0, len = self.requests.length; i < len; ++i) { 11253 + var pending = self.requests[i]; 11254 + if (pending.host === options.host && pending.port === options.port) { 11255 + // Detect the request to connect same origin server, 11256 + // reuse the connection. 11257 + self.requests.splice(i, 1); 11258 + pending.request.onSocket(socket); 11259 + return; 11260 + } 11261 + } 11262 + socket.destroy(); 11263 + self.removeSocket(socket); 11264 + }); 11353 11265 } 11266 + util.inherits(TunnelingAgent, events.EventEmitter); 11354 11267 11355 - module.exports = isPlainObject; 11268 + TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { 11269 + var self = this; 11270 + var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); 11356 11271 11272 + if (self.sockets.length >= this.maxSockets) { 11273 + // We are over limit so we'll add it to the queue. 11274 + self.requests.push(options); 11275 + return; 11276 + } 11357 11277 11358 - /***/ }), 11278 + // If we are under maxSockets create a new one. 11279 + self.createSocket(options, function(socket) { 11280 + socket.on('free', onFree); 11281 + socket.on('close', onCloseOrRemove); 11282 + socket.on('agentRemove', onCloseOrRemove); 11283 + req.onSocket(socket); 11359 11284 11360 - /***/ 877: 11361 - /***/ (function(module) { 11285 + function onFree() { 11286 + self.emit('free', socket, options); 11287 + } 11362 11288 11363 - module.exports = eval("require")("encoding"); 11289 + function onCloseOrRemove(err) { 11290 + self.removeSocket(socket); 11291 + socket.removeListener('free', onFree); 11292 + socket.removeListener('close', onCloseOrRemove); 11293 + socket.removeListener('agentRemove', onCloseOrRemove); 11294 + } 11295 + }); 11296 + }; 11364 11297 11298 + TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { 11299 + var self = this; 11300 + var placeholder = {}; 11301 + self.sockets.push(placeholder); 11365 11302 11366 - /***/ }), 11303 + var connectOptions = mergeOptions({}, self.proxyOptions, { 11304 + method: 'CONNECT', 11305 + path: options.host + ':' + options.port, 11306 + agent: false, 11307 + headers: { 11308 + host: options.host + ':' + options.port 11309 + } 11310 + }); 11311 + if (options.localAddress) { 11312 + connectOptions.localAddress = options.localAddress; 11313 + } 11314 + if (connectOptions.proxyAuth) { 11315 + connectOptions.headers = connectOptions.headers || {}; 11316 + connectOptions.headers['Proxy-Authorization'] = 'Basic ' + 11317 + new Buffer(connectOptions.proxyAuth).toString('base64'); 11318 + } 11367 11319 11368 - /***/ 914: 11369 - /***/ (function(__unusedmodule, exports, __webpack_require__) { 11320 + debug('making CONNECT request'); 11321 + var connectReq = self.request(connectOptions); 11322 + connectReq.useChunkedEncodingByDefault = false; // for v0.6 11323 + connectReq.once('response', onResponse); // for v0.6 11324 + connectReq.once('upgrade', onUpgrade); // for v0.6 11325 + connectReq.once('connect', onConnect); // for v0.7 or later 11326 + connectReq.once('error', onError); 11327 + connectReq.end(); 11370 11328 11371 - "use strict"; 11329 + function onResponse(res) { 11330 + // Very hacky. This is necessary to avoid http-parser leaks. 11331 + res.upgrade = true; 11332 + } 11372 11333 11373 - var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 11374 - if (k2 === undefined) k2 = k; 11375 - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 11376 - }) : (function(o, m, k, k2) { 11377 - if (k2 === undefined) k2 = k; 11378 - o[k2] = m[k]; 11379 - })); 11380 - var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 11381 - Object.defineProperty(o, "default", { enumerable: true, value: v }); 11382 - }) : function(o, v) { 11383 - o["default"] = v; 11384 - }); 11385 - var __importStar = (this && this.__importStar) || function (mod) { 11386 - if (mod && mod.__esModule) return mod; 11387 - var result = {}; 11388 - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 11389 - __setModuleDefault(result, mod); 11390 - return result; 11391 - }; 11392 - Object.defineProperty(exports, "__esModule", { value: true }); 11393 - exports.getApiBaseUrl = exports.getProxyAgent = exports.getAuthString = void 0; 11394 - const httpClient = __importStar(__webpack_require__(925)); 11395 - function getAuthString(token, options) { 11396 - if (!token && !options.auth) { 11397 - throw new Error('Parameter token or opts.auth is required'); 11334 + function onUpgrade(res, socket, head) { 11335 + // Hacky. 11336 + process.nextTick(function() { 11337 + onConnect(res, socket, head); 11338 + }); 11339 + } 11340 + 11341 + function onConnect(res, socket, head) { 11342 + connectReq.removeAllListeners(); 11343 + socket.removeAllListeners(); 11344 + 11345 + if (res.statusCode !== 200) { 11346 + debug('tunneling socket could not be established, statusCode=%d', 11347 + res.statusCode); 11348 + socket.destroy(); 11349 + var error = new Error('tunneling socket could not be established, ' + 11350 + 'statusCode=' + res.statusCode); 11351 + error.code = 'ECONNRESET'; 11352 + options.request.emit('error', error); 11353 + self.removeSocket(placeholder); 11354 + return; 11398 11355 } 11399 - else if (token && options.auth) { 11400 - throw new Error('Parameters token and opts.auth may not both be specified'); 11356 + if (head.length > 0) { 11357 + debug('got illegal response body from proxy'); 11358 + socket.destroy(); 11359 + var error = new Error('got illegal response body from proxy'); 11360 + error.code = 'ECONNRESET'; 11361 + options.request.emit('error', error); 11362 + self.removeSocket(placeholder); 11363 + return; 11401 11364 } 11402 - return typeof options.auth === 'string' ? options.auth : `token ${token}`; 11365 + debug('tunneling connection has established'); 11366 + self.sockets[self.sockets.indexOf(placeholder)] = socket; 11367 + return cb(socket); 11368 + } 11369 + 11370 + function onError(cause) { 11371 + connectReq.removeAllListeners(); 11372 + 11373 + debug('tunneling socket could not be established, cause=%s\n', 11374 + cause.message, cause.stack); 11375 + var error = new Error('tunneling socket could not be established, ' + 11376 + 'cause=' + cause.message); 11377 + error.code = 'ECONNRESET'; 11378 + options.request.emit('error', error); 11379 + self.removeSocket(placeholder); 11380 + } 11381 + }; 11382 + 11383 + TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { 11384 + var pos = this.sockets.indexOf(socket) 11385 + if (pos === -1) { 11386 + return; 11387 + } 11388 + this.sockets.splice(pos, 1); 11389 + 11390 + var pending = this.requests.shift(); 11391 + if (pending) { 11392 + // If we have pending requests and a socket gets closed a new one 11393 + // needs to be created to take over in the pool for the one that closed. 11394 + this.createSocket(pending, function(socket) { 11395 + pending.request.onSocket(socket); 11396 + }); 11397 + } 11398 + }; 11399 + 11400 + function createSecureSocket(options, cb) { 11401 + var self = this; 11402 + TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { 11403 + var hostHeader = options.request.getHeader('host'); 11404 + var tlsOptions = mergeOptions({}, self.options, { 11405 + socket: socket, 11406 + servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host 11407 + }); 11408 + 11409 + // 0 is dummy port for v0.6 11410 + var secureSocket = tls.connect(0, tlsOptions); 11411 + self.sockets[self.sockets.indexOf(socket)] = secureSocket; 11412 + cb(secureSocket); 11413 + }); 11403 11414 } 11404 - exports.getAuthString = getAuthString; 11405 - function getProxyAgent(destinationUrl) { 11406 - const hc = new httpClient.HttpClient(); 11407 - return hc.getAgent(destinationUrl); 11415 + 11416 + 11417 + function toOptions(host, port, localAddress) { 11418 + if (typeof host === 'string') { // since v0.10 11419 + return { 11420 + host: host, 11421 + port: port, 11422 + localAddress: localAddress 11423 + }; 11424 + } 11425 + return host; // for v0.11 or later 11408 11426 } 11409 - exports.getProxyAgent = getProxyAgent; 11410 - function getApiBaseUrl() { 11411 - return process.env['GITHUB_API_URL'] || 'https://api.github.com'; 11427 + 11428 + function mergeOptions(target) { 11429 + for (var i = 1, len = arguments.length; i < len; ++i) { 11430 + var overrides = arguments[i]; 11431 + if (typeof overrides === 'object') { 11432 + var keys = Object.keys(overrides); 11433 + for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { 11434 + var k = keys[j]; 11435 + if (overrides[k] !== undefined) { 11436 + target[k] = overrides[k]; 11437 + } 11438 + } 11439 + } 11440 + } 11441 + return target; 11412 11442 } 11413 - exports.getApiBaseUrl = getApiBaseUrl; 11414 - //# sourceMappingURL=utils.js.map 11443 + 11444 + 11445 + var debug; 11446 + if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { 11447 + debug = function() { 11448 + var args = Array.prototype.slice.call(arguments); 11449 + if (typeof args[0] === 'string') { 11450 + args[0] = 'TUNNEL: ' + args[0]; 11451 + } else { 11452 + args.unshift('TUNNEL:'); 11453 + } 11454 + console.error.apply(console, args); 11455 + } 11456 + } else { 11457 + debug = function() {}; 11458 + } 11459 + exports.debug = debug; // for test 11460 + 11415 11461 11416 11462 /***/ }), 11417 11463 11418 - /***/ 925: 11419 - /***/ (function(__unusedmodule, exports, __webpack_require__) { 11464 + /***/ 429: 11465 + /***/ ((__unused_webpack_module, exports) => { 11420 11466 11421 11467 "use strict"; 11422 11468 11423 - Object.defineProperty(exports, "__esModule", { value: true }); 11424 - const url = __webpack_require__(835); 11425 - const http = __webpack_require__(605); 11426 - const https = __webpack_require__(211); 11427 - const pm = __webpack_require__(443); 11428 - let tunnel; 11429 - var HttpCodes; 11430 - (function (HttpCodes) { 11431 - HttpCodes[HttpCodes["OK"] = 200] = "OK"; 11432 - HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; 11433 - HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; 11434 - HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; 11435 - HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; 11436 - HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; 11437 - HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; 11438 - HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; 11439 - HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; 11440 - HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; 11441 - HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; 11442 - HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; 11443 - HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; 11444 - HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; 11445 - HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; 11446 - HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; 11447 - HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; 11448 - HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; 11449 - HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; 11450 - HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; 11451 - HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; 11452 - HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; 11453 - HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; 11454 - HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; 11455 - HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; 11456 - HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; 11457 - HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; 11458 - })(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); 11459 - var Headers; 11460 - (function (Headers) { 11461 - Headers["Accept"] = "accept"; 11462 - Headers["ContentType"] = "content-type"; 11463 - })(Headers = exports.Headers || (exports.Headers = {})); 11464 - var MediaTypes; 11465 - (function (MediaTypes) { 11466 - MediaTypes["ApplicationJson"] = "application/json"; 11467 - })(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); 11468 - /** 11469 - * Returns the proxy URL, depending upon the supplied url and proxy environment variables. 11470 - * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com 11471 - */ 11472 - function getProxyUrl(serverUrl) { 11473 - let proxyUrl = pm.getProxyUrl(url.parse(serverUrl)); 11474 - return proxyUrl ? proxyUrl.href : ''; 11469 + 11470 + Object.defineProperty(exports, "__esModule", ({ value: true })); 11471 + 11472 + function getUserAgent() { 11473 + if (typeof navigator === "object" && "userAgent" in navigator) { 11474 + return navigator.userAgent; 11475 + } 11476 + 11477 + if (typeof process === "object" && "version" in process) { 11478 + return `Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`; 11479 + } 11480 + 11481 + return "<environment undetectable>"; 11475 11482 } 11476 - exports.getProxyUrl = getProxyUrl; 11477 - const HttpRedirectCodes = [ 11478 - HttpCodes.MovedPermanently, 11479 - HttpCodes.ResourceMoved, 11480 - HttpCodes.SeeOther, 11481 - HttpCodes.TemporaryRedirect, 11482 - HttpCodes.PermanentRedirect 11483 - ]; 11484 - const HttpResponseRetryCodes = [ 11485 - HttpCodes.BadGateway, 11486 - HttpCodes.ServiceUnavailable, 11487 - HttpCodes.GatewayTimeout 11488 - ]; 11489 - const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; 11490 - const ExponentialBackoffCeiling = 10; 11491 - const ExponentialBackoffTimeSlice = 5; 11492 - class HttpClientResponse { 11493 - constructor(message) { 11494 - this.message = message; 11483 + 11484 + exports.getUserAgent = getUserAgent; 11485 + //# sourceMappingURL=index.js.map 11486 + 11487 + 11488 + /***/ }), 11489 + 11490 + /***/ 940: 11491 + /***/ ((module) => { 11492 + 11493 + // Returns a wrapper function that returns a wrapped callback 11494 + // The wrapper function should do some stuff, and return a 11495 + // presumably different callback function. 11496 + // This makes sure that own properties are retained, so that 11497 + // decorations and such are not lost along the way. 11498 + module.exports = wrappy 11499 + function wrappy (fn, cb) { 11500 + if (fn && cb) return wrappy(fn)(cb) 11501 + 11502 + if (typeof fn !== 'function') 11503 + throw new TypeError('need wrapper function') 11504 + 11505 + Object.keys(fn).forEach(function (k) { 11506 + wrapper[k] = fn[k] 11507 + }) 11508 + 11509 + return wrapper 11510 + 11511 + function wrapper() { 11512 + var args = new Array(arguments.length) 11513 + for (var i = 0; i < args.length; i++) { 11514 + args[i] = arguments[i] 11495 11515 } 11496 - readBody() { 11497 - return new Promise(async (resolve, reject) => { 11498 - let output = Buffer.alloc(0); 11499 - this.message.on('data', (chunk) => { 11500 - output = Buffer.concat([output, chunk]); 11501 - }); 11502 - this.message.on('end', () => { 11503 - resolve(output.toString()); 11504 - }); 11505 - }); 11516 + var ret = fn.apply(this, args) 11517 + var cb = args[args.length-1] 11518 + if (typeof ret === 'function' && ret !== cb) { 11519 + Object.keys(cb).forEach(function (k) { 11520 + ret[k] = cb[k] 11521 + }) 11506 11522 } 11523 + return ret 11524 + } 11507 11525 } 11508 - exports.HttpClientResponse = HttpClientResponse; 11509 - function isHttps(requestUrl) { 11510 - let parsedUrl = url.parse(requestUrl); 11511 - return parsedUrl.protocol === 'https:'; 11512 - } 11513 - exports.isHttps = isHttps; 11514 - class HttpClient { 11515 - constructor(userAgent, handlers, requestOptions) { 11516 - this._ignoreSslError = false; 11517 - this._allowRedirects = true; 11518 - this._allowRedirectDowngrade = false; 11519 - this._maxRedirects = 50; 11520 - this._allowRetries = false; 11521 - this._maxRetries = 1; 11522 - this._keepAlive = false; 11523 - this._disposed = false; 11524 - this.userAgent = userAgent; 11525 - this.handlers = handlers || []; 11526 - this.requestOptions = requestOptions; 11527 - if (requestOptions) { 11528 - if (requestOptions.ignoreSslError != null) { 11529 - this._ignoreSslError = requestOptions.ignoreSslError; 11530 - } 11531 - this._socketTimeout = requestOptions.socketTimeout; 11532 - if (requestOptions.allowRedirects != null) { 11533 - this._allowRedirects = requestOptions.allowRedirects; 11534 - } 11535 - if (requestOptions.allowRedirectDowngrade != null) { 11536 - this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; 11537 - } 11538 - if (requestOptions.maxRedirects != null) { 11539 - this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); 11540 - } 11541 - if (requestOptions.keepAlive != null) { 11542 - this._keepAlive = requestOptions.keepAlive; 11543 - } 11544 - if (requestOptions.allowRetries != null) { 11545 - this._allowRetries = requestOptions.allowRetries; 11546 - } 11547 - if (requestOptions.maxRetries != null) { 11548 - this._maxRetries = requestOptions.maxRetries; 11549 - } 11526 + 11527 + 11528 + /***/ }), 11529 + 11530 + /***/ 580: 11531 + /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => { 11532 + 11533 + "use strict"; 11534 + // ESM COMPAT FLAG 11535 + __nccwpck_require__.r(__webpack_exports__); 11536 + 11537 + // EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js 11538 + var core = __nccwpck_require__(186); 11539 + // EXTERNAL MODULE: external "fs" 11540 + var external_fs_ = __nccwpck_require__(747); 11541 + // EXTERNAL MODULE: ./node_modules/moment/moment.js 11542 + var moment = __nccwpck_require__(623); 11543 + // EXTERNAL MODULE: ./node_modules/@actions/github/lib/github.js 11544 + var github = __nccwpck_require__(438); 11545 + // CONCATENATED MODULE: ./src/queries.ts 11546 + 11547 + 11548 + 11549 + const ghToken = core.getInput('TOKEN', { required: true }); 11550 + core.setSecret(ghToken); 11551 + const octokit = github.getOctokit(ghToken); 11552 + async function getUser() { 11553 + const queryResult = await octokit.graphql(` 11554 + query { 11555 + viewer { 11556 + USERNAME: login 11557 + NAME: name 11558 + EMAIL: email 11559 + USER_ID: id 11560 + BIO: bio 11561 + COMPANY: company 11562 + SIGNUP_TIMESTAMP: createdAt 11563 + LOCATION: location 11564 + TWITTER_USERNAME: twitterUsername 11565 + AVATAR_URL: avatarUrl 11566 + WEBSITE_URL: websiteUrl 11567 + repositories { 11568 + totalCount 11569 + totalDiskUsage 11550 11570 } 11571 + } 11551 11572 } 11552 - options(requestUrl, additionalHeaders) { 11553 - return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); 11554 - } 11555 - get(requestUrl, additionalHeaders) { 11556 - return this.request('GET', requestUrl, null, additionalHeaders || {}); 11557 - } 11558 - del(requestUrl, additionalHeaders) { 11559 - return this.request('DELETE', requestUrl, null, additionalHeaders || {}); 11560 - } 11561 - post(requestUrl, data, additionalHeaders) { 11562 - return this.request('POST', requestUrl, data, additionalHeaders || {}); 11573 + `); 11574 + const user = queryResult.viewer; 11575 + user.SIGNUP_DATE = moment(user.SIGNUP_TIMESTAMP).format('MMMM Do YYYY'); 11576 + user.SIGNUP_DATE2 = moment(user.SIGNUP_TIMESTAMP).format('YYYY-MM-DD'); 11577 + user.SIGNUP_YEAR = moment(user.SIGNUP_TIMESTAMP).format('YYYY'); 11578 + user.SIGNUP_AGO = moment(user.SIGNUP_TIMESTAMP).fromNow(); 11579 + user.TOTAL_REPOS_SIZE_KB = user.repositories.totalDiskUsage; 11580 + user.TOTAL_REPOS_SIZE_MB = Math.round(user.repositories.totalDiskUsage / 1000 * 10) / 10; 11581 + user.TOTAL_REPOS_SIZE_GB = Math.round(user.repositories.totalDiskUsage / 1000 / 1000 * 100) / 100; 11582 + user.TOTAL_REPOSITORIES = user.repositories.totalCount; 11583 + delete user.repositories; 11584 + return user; 11585 + } 11586 + function fixRepoValues(repo) { 11587 + repo.REPO_CREATED_DATE = moment(repo.REPO_CREATED_TIMESTAMP).format('MMMM Do YYYY'); 11588 + repo.REPO_CREATED_DATE2 = moment(repo.REPO_CREATED_TIMESTAMP).format('YYYY-MM-DD'); 11589 + repo.REPO_CREATED_YEAR = moment(repo.REPO_CREATED_TIMESTAMP).format('YYYY'); 11590 + repo.REPO_CREATED_AGO = moment(repo.REPO_CREATED_TIMESTAMP).fromNow(); 11591 + repo.REPO_PUSHED_DATE = moment(repo.REPO_PUSHED_TIMESTAMP).format('MMMM Do YYYY'); 11592 + repo.REPO_PUSHED_DATE2 = moment(repo.REPO_PUSHED_TIMESTAMP).format('YYYY-MM-DD'); 11593 + repo.REPO_PUSHED_YEAR = moment(repo.REPO_PUSHED_TIMESTAMP).format('YYYY'); 11594 + repo.REPO_PUSHED_AGO = moment(repo.REPO_PUSHED_TIMESTAMP).fromNow(); 11595 + repo.REPO_STARS = repo.stargazers.totalCount; 11596 + delete repo.stargazers; 11597 + if (repo.primaryLanguage) { 11598 + repo.REPO_LANGUAGE = repo.primaryLanguage.name; 11563 11599 } 11564 - patch(requestUrl, data, additionalHeaders) { 11565 - return this.request('PATCH', requestUrl, data, additionalHeaders || {}); 11600 + else { 11601 + repo.REPO_LANGUAGE = 'None'; 11566 11602 } 11567 - put(requestUrl, data, additionalHeaders) { 11568 - return this.request('PUT', requestUrl, data, additionalHeaders || {}); 11603 + delete repo.primaryLanguage; 11604 + repo.REPO_OWNER_USERNAME = repo.owner.login; 11605 + delete repo.owner; 11606 + repo.REPO_SIZE_KB = repo.diskUsage; 11607 + repo.REPO_SIZE_MB = Math.round(repo.diskUsage / 1000 * 10) / 10; 11608 + repo.REPO_SIZE_GB = Math.round(repo.diskUsage / 1000 / 1000 * 100) / 100; 11609 + delete repo.diskUsage; 11610 + return repo; 11611 + } 11612 + async function getRepos(args) { 11613 + const queryResult = await octokit.graphql(` 11614 + query { 11615 + viewer { 11616 + repositories(${args}) { 11617 + edges { 11618 + node { 11619 + REPO_NAME: name 11620 + owner { 11621 + login 11622 + } 11623 + REPO_FULL_NAME: nameWithOwner 11624 + REPO_DESCRIPTION: description 11625 + REPO_URL: url 11626 + REPO_HOMEPAGE_URL: homepageUrl 11627 + REPO_CREATED_TIMESTAMP: createdAt 11628 + REPO_PUSHED_TIMESTAMP: pushedAt 11629 + diskUsage 11630 + REPO_FORK_COUNT: forkCount 11631 + REPO_ID: id 11632 + stargazers { 11633 + totalCount 11634 + } 11635 + primaryLanguage { 11636 + name 11637 + } 11638 + } 11639 + } 11640 + } 11641 + } 11569 11642 } 11570 - head(requestUrl, additionalHeaders) { 11571 - return this.request('HEAD', requestUrl, null, additionalHeaders || {}); 11643 + `); 11644 + const repoEdges = queryResult.viewer.repositories.edges; 11645 + const repos = []; 11646 + for (const repoEdge of repoEdges) { 11647 + let repo = repoEdge.node; 11648 + repo = fixRepoValues(repo); 11649 + repos.push(repo); 11572 11650 } 11573 - sendStream(verb, requestUrl, stream, additionalHeaders) { 11574 - return this.request(verb, requestUrl, stream, additionalHeaders); 11651 + return repos; 11652 + } 11653 + async function getSpecificRepos(username, repoNames) { 11654 + let repoQueryProperties = ''; 11655 + let index = -1; 11656 + for (let repoName of repoNames) { 11657 + index += 1; 11658 + let repoOwner = ''; 11659 + if (repoName.includes('/')) { 11660 + repoOwner = repoName.split('/')[0]; 11661 + repoName = repoName.split('/')[1]; 11662 + } 11663 + else { 11664 + repoOwner = username; 11665 + } 11666 + repoQueryProperties += ` 11667 + repo${index}: repository(owner: "${repoOwner}" name: "${repoName}") { 11668 + REPO_NAME: name 11669 + owner { 11670 + login 11671 + } 11672 + REPO_FULL_NAME: nameWithOwner 11673 + REPO_DESCRIPTION: description 11674 + REPO_URL: url 11675 + REPO_HOMEPAGE_URL: homepageUrl 11676 + REPO_CREATED_TIMESTAMP: createdAt 11677 + REPO_PUSHED_TIMESTAMP: pushedAt 11678 + REPO_FORK_COUNT: forkCount 11679 + REPO_ID: id 11680 + diskUsage 11681 + stargazers { 11682 + totalCount 11683 + } 11684 + primaryLanguage { 11685 + name 11686 + } 11687 + } 11688 + `; 11575 11689 } 11576 - /** 11577 - * Gets a typed object from an endpoint 11578 - * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise 11579 - */ 11580 - async getJson(requestUrl, additionalHeaders = {}) { 11581 - additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 11582 - let res = await this.get(requestUrl, additionalHeaders); 11583 - return this._processResponse(res, this.requestOptions); 11690 + const queryResult = await octokit.graphql(` 11691 + query { 11692 + ${repoQueryProperties} 11584 11693 } 11585 - async postJson(requestUrl, obj, additionalHeaders = {}) { 11586 - let data = JSON.stringify(obj, null, 2); 11587 - additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 11588 - additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 11589 - let res = await this.post(requestUrl, data, additionalHeaders); 11590 - return this._processResponse(res, this.requestOptions); 11694 + `); 11695 + let repos = []; 11696 + for (let i = 0; i !== null; i++) { 11697 + let repo = queryResult['repo' + i]; 11698 + if (!repo) 11699 + break; 11700 + repo = fixRepoValues(repo); 11701 + repos.push(repo); 11591 11702 } 11592 - async putJson(requestUrl, obj, additionalHeaders = {}) { 11593 - let data = JSON.stringify(obj, null, 2); 11594 - additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 11595 - additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 11596 - let res = await this.put(requestUrl, data, additionalHeaders); 11597 - return this._processResponse(res, this.requestOptions); 11703 + return repos; 11704 + } 11705 + 11706 + // CONCATENATED MODULE: ./src/utils.ts 11707 + function trimLeftChar(string, charToRemove) { 11708 + while (string.charAt(0) == charToRemove) { 11709 + string = string.substring(1); 11598 11710 } 11599 - async patchJson(requestUrl, obj, additionalHeaders = {}) { 11600 - let data = JSON.stringify(obj, null, 2); 11601 - additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 11602 - additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 11603 - let res = await this.patch(requestUrl, data, additionalHeaders); 11604 - return this._processResponse(res, this.requestOptions); 11711 + return string; 11712 + } 11713 + function trimRightChar(string, charToRemove) { 11714 + while (string.charAt(string.length - 1) == charToRemove) { 11715 + string = string.substring(0, string.length - 1); 11605 11716 } 11606 - /** 11607 - * Makes a raw http request. 11608 - * All other methods such as get, post, patch, and request ultimately call this. 11609 - * Prefer get, del, post and patch 11610 - */ 11611 - async request(verb, requestUrl, data, headers) { 11612 - if (this._disposed) { 11613 - throw new Error('Client has already been disposed.'); 11614 - } 11615 - let parsedUrl = url.parse(requestUrl); 11616 - let info = this._prepareRequest(verb, parsedUrl, headers); 11617 - // Only perform retries on reads since writes may not be idempotent. 11618 - let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1 11619 - ? this._maxRetries + 1 11620 - : 1; 11621 - let numTries = 0; 11622 - let response; 11623 - while (numTries < maxTries) { 11624 - response = await this.requestRaw(info, data); 11625 - // Check if it's an authentication challenge 11626 - if (response && 11627 - response.message && 11628 - response.message.statusCode === HttpCodes.Unauthorized) { 11629 - let authenticationHandler; 11630 - for (let i = 0; i < this.handlers.length; i++) { 11631 - if (this.handlers[i].canHandleAuthentication(response)) { 11632 - authenticationHandler = this.handlers[i]; 11633 - break; 11634 - } 11635 - } 11636 - if (authenticationHandler) { 11637 - return authenticationHandler.handleAuthentication(this, info, data); 11638 - } 11639 - else { 11640 - // We have received an unauthorized response but have no handlers to handle it. 11641 - // Let the response return to the caller. 11642 - return response; 11643 - } 11644 - } 11645 - let redirectsRemaining = this._maxRedirects; 11646 - while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 && 11647 - this._allowRedirects && 11648 - redirectsRemaining > 0) { 11649 - const redirectUrl = response.message.headers['location']; 11650 - if (!redirectUrl) { 11651 - // if there's no location to redirect to, we won't 11652 - break; 11653 - } 11654 - let parsedRedirectUrl = url.parse(redirectUrl); 11655 - if (parsedUrl.protocol == 'https:' && 11656 - parsedUrl.protocol != parsedRedirectUrl.protocol && 11657 - !this._allowRedirectDowngrade) { 11658 - 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.'); 11659 - } 11660 - // we need to finish reading the response before reassigning response 11661 - // which will leak the open socket. 11662 - await response.readBody(); 11663 - // strip authorization header if redirected to a different hostname 11664 - if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { 11665 - for (let header in headers) { 11666 - // header names are case insensitive 11667 - if (header.toLowerCase() === 'authorization') { 11668 - delete headers[header]; 11669 - } 11670 - } 11671 - } 11672 - // let's make the request with the new redirectUrl 11673 - info = this._prepareRequest(verb, parsedRedirectUrl, headers); 11674 - response = await this.requestRaw(info, data); 11675 - redirectsRemaining--; 11676 - } 11677 - if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) { 11678 - // If not a retry code, return immediately instead of retrying 11679 - return response; 11680 - } 11681 - numTries += 1; 11682 - if (numTries < maxTries) { 11683 - await response.readBody(); 11684 - await this._performExponentialBackoff(numTries); 11685 - } 11686 - } 11687 - return response; 11717 + return string; 11718 + } 11719 + function deleteFirstLine(str) { 11720 + const lines = str.split('\n'); 11721 + if (lines[0] === '') { 11722 + lines.splice(1, 1); 11688 11723 } 11689 - /** 11690 - * Needs to be called if keepAlive is set to true in request options. 11691 - */ 11692 - dispose() { 11693 - if (this._agent) { 11694 - this._agent.destroy(); 11695 - } 11696 - this._disposed = true; 11724 + else { 11725 + lines.splice(0, 1); 11697 11726 } 11698 - /** 11699 - * Raw request. 11700 - * @param info 11701 - * @param data 11702 - */ 11703 - requestRaw(info, data) { 11704 - return new Promise((resolve, reject) => { 11705 - let callbackForResult = function (err, res) { 11706 - if (err) { 11707 - reject(err); 11708 - } 11709 - resolve(res); 11710 - }; 11711 - this.requestRawWithCallback(info, data, callbackForResult); 11712 - }); 11727 + return lines.join('\n'); 11728 + } 11729 + function deleteLastLine(str) { 11730 + const lines = str.split('\n'); 11731 + if (lines[lines.length - 1] === '') { 11732 + lines.splice(-2, 1); 11713 11733 } 11714 - /** 11715 - * Raw request with callback. 11716 - * @param info 11717 - * @param data 11718 - * @param onResult 11719 - */ 11720 - requestRawWithCallback(info, data, onResult) { 11721 - let socket; 11722 - if (typeof data === 'string') { 11723 - info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); 11724 - } 11725 - let callbackCalled = false; 11726 - let handleResult = (err, res) => { 11727 - if (!callbackCalled) { 11728 - callbackCalled = true; 11729 - onResult(err, res); 11730 - } 11731 - }; 11732 - let req = info.httpModule.request(info.options, (msg) => { 11733 - let res = new HttpClientResponse(msg); 11734 - handleResult(null, res); 11735 - }); 11736 - req.on('socket', sock => { 11737 - socket = sock; 11738 - }); 11739 - // If we ever get disconnected, we want the socket to timeout eventually 11740 - req.setTimeout(this._socketTimeout || 3 * 60000, () => { 11741 - if (socket) { 11742 - socket.end(); 11743 - } 11744 - handleResult(new Error('Request timeout: ' + info.options.path), null); 11745 - }); 11746 - req.on('error', function (err) { 11747 - // err has statusCode property 11748 - // res should have headers 11749 - handleResult(err, null); 11750 - }); 11751 - if (data && typeof data === 'string') { 11752 - req.write(data, 'utf8'); 11753 - } 11754 - if (data && typeof data !== 'string') { 11755 - data.on('close', function () { 11756 - req.end(); 11757 - }); 11758 - data.pipe(req); 11759 - } 11760 - else { 11761 - req.end(); 11762 - } 11734 + else { 11735 + lines.splice(-1, 1); 11763 11736 } 11764 - /** 11765 - * Gets an http agent. This function is useful when you need an http agent that handles 11766 - * routing through a proxy server - depending upon the url and proxy environment variables. 11767 - * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com 11768 - */ 11769 - getAgent(serverUrl) { 11770 - let parsedUrl = url.parse(serverUrl); 11771 - return this._getAgent(parsedUrl); 11737 + return lines.join('\n'); 11738 + } 11739 + 11740 + // CONCATENATED MODULE: ./src/main.ts 11741 + 11742 + 11743 + 11744 + 11745 + 11746 + // parses first found only 11747 + function parseBlock(str, openStr, closeStr) { 11748 + const openIndex = str.indexOf(openStr); 11749 + const endIndex = str.indexOf(closeStr); 11750 + if (openIndex < 0 || endIndex < 0) 11751 + return null; 11752 + let beforeBlock = str.substring(0, openIndex); 11753 + beforeBlock = trimRightChar(beforeBlock, ' '); 11754 + if (beforeBlock.endsWith('\n')) { 11755 + beforeBlock = beforeBlock.substring(0, beforeBlock.length - 1); 11772 11756 } 11773 - _prepareRequest(method, requestUrl, headers) { 11774 - const info = {}; 11775 - info.parsedUrl = requestUrl; 11776 - const usingSsl = info.parsedUrl.protocol === 'https:'; 11777 - info.httpModule = usingSsl ? https : http; 11778 - const defaultPort = usingSsl ? 443 : 80; 11779 - info.options = {}; 11780 - info.options.host = info.parsedUrl.hostname; 11781 - info.options.port = info.parsedUrl.port 11782 - ? parseInt(info.parsedUrl.port) 11783 - : defaultPort; 11784 - info.options.path = 11785 - (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); 11786 - info.options.method = method; 11787 - info.options.headers = this._mergeHeaders(headers); 11788 - if (this.userAgent != null) { 11789 - info.options.headers['user-agent'] = this.userAgent; 11790 - } 11791 - info.options.agent = this._getAgent(info.parsedUrl); 11792 - // gives handlers an opportunity to participate 11793 - if (this.handlers) { 11794 - this.handlers.forEach(handler => { 11795 - handler.prepareRequest(info.options); 11796 - }); 11797 - } 11798 - return info; 11757 + let block = str.substring(openIndex + openStr.length, endIndex); 11758 + block = trimRightChar(block, ' '); 11759 + if (block.endsWith('\n')) { 11760 + block = block.substring(0, block.length - 1); 11799 11761 } 11800 - _mergeHeaders(headers) { 11801 - const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); 11802 - if (this.requestOptions && this.requestOptions.headers) { 11803 - return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers)); 11804 - } 11805 - return lowercaseKeys(headers || {}); 11762 + let afterBlock = str.substring(endIndex + closeStr.length); 11763 + return { beforeBlock, block, afterBlock }; 11764 + } 11765 + function getCustomTemplate(str) { 11766 + const parsed = parseBlock(str, '// {{ TEMPLATE: }}', '// {{ :TEMPLATE }}'); 11767 + if (!parsed) 11768 + return { customTemplate: {}, outputStr: str }; 11769 + parsed.beforeBlock = deleteLastLine(parsed.beforeBlock); 11770 + parsed.afterBlock = deleteFirstLine(parsed.afterBlock); 11771 + const requireFromString = __nccwpck_require__(176); 11772 + const parsedCustomTemplate = requireFromString(parsed.block); 11773 + return { 11774 + customTemplate: parsedCustomTemplate, 11775 + outputStr: parsed.beforeBlock + parsed.afterBlock, 11776 + }; 11777 + } 11778 + function inject(str, values) { 11779 + for (const [key, value] of Object.entries(values)) { 11780 + const valueStr = '{{ ' + key + ' }}'; 11781 + str = str.split(valueStr).join(value); 11806 11782 } 11807 - _getExistingOrDefaultHeader(additionalHeaders, header, _default) { 11808 - const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); 11809 - let clientHeader; 11810 - if (this.requestOptions && this.requestOptions.headers) { 11811 - clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; 11812 - } 11813 - return additionalHeaders[header] || clientHeader || _default; 11783 + return str; 11784 + } 11785 + async function injectLoop(str, name, valuesListArg) { 11786 + const parsed = parseBlock(str, `{{ loop ${name} }}`, `{{ end ${name} }}`); 11787 + if (!parsed) 11788 + return str; 11789 + let valuesList = valuesListArg; 11790 + if (typeof valuesListArg === 'function') 11791 + valuesList = await valuesListArg(); 11792 + let newBlock = ''; 11793 + for (const values of valuesList) { 11794 + newBlock += inject(parsed.block, values); 11814 11795 } 11815 - _getAgent(parsedUrl) { 11816 - let agent; 11817 - let proxyUrl = pm.getProxyUrl(parsedUrl); 11818 - let useProxy = proxyUrl && proxyUrl.hostname; 11819 - if (this._keepAlive && useProxy) { 11820 - agent = this._proxyAgent; 11821 - } 11822 - if (this._keepAlive && !useProxy) { 11823 - agent = this._agent; 11824 - } 11825 - // if agent is already assigned use that agent. 11826 - if (!!agent) { 11827 - return agent; 11796 + return parsed.beforeBlock + newBlock + await injectLoop(parsed.afterBlock, name, valuesList); 11797 + } 11798 + run(); 11799 + async function run() { 11800 + try { 11801 + let templatePath = core.getInput('TEMPLATE', { required: true }); 11802 + console.log('Template:', templatePath); 11803 + if (!external_fs_.existsSync(templatePath)) 11804 + throw 'Template file not found'; 11805 + const templateFile = external_fs_.readFileSync(templatePath).toString(); 11806 + let outputPath = core.getInput('OUTPUT', { required: true }); 11807 + console.log('output:', outputPath); 11808 + let { customTemplate, outputStr } = getCustomTemplate(templateFile); 11809 + console.log('User data'); 11810 + console.log(' - Fetching'); 11811 + const user = await getUser(); 11812 + console.log(' - Injecting'); 11813 + outputStr = inject(outputStr, user); 11814 + if (!customTemplate['3_MOST_STARRED_REPOS']) { 11815 + customTemplate['3_MOST_STARRED_REPOS'] = { 11816 + type: 'repos', 11817 + params: ` 11818 + first: 3, 11819 + privacy: PUBLIC, 11820 + ownerAffiliations:[OWNER], 11821 + orderBy: { field:STARGAZERS, direction: DESC } 11822 + ` 11823 + }; 11828 11824 } 11829 - const usingSsl = parsedUrl.protocol === 'https:'; 11830 - let maxSockets = 100; 11831 - if (!!this.requestOptions) { 11832 - maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; 11825 + if (!customTemplate['3_NEWEST_REPOS']) { 11826 + customTemplate['3_NEWEST_REPOS'] = { 11827 + type: 'repos', 11828 + params: ` 11829 + first: 3, 11830 + privacy: PUBLIC, 11831 + ownerAffiliations:[OWNER], 11832 + orderBy: { field:CREATED_AT, direction: DESC } 11833 + ` 11834 + }; 11833 11835 } 11834 - if (useProxy) { 11835 - // If using proxy, need tunnel 11836 - if (!tunnel) { 11837 - tunnel = __webpack_require__(294); 11838 - } 11839 - const agentOptions = { 11840 - maxSockets: maxSockets, 11841 - keepAlive: this._keepAlive, 11842 - proxy: { 11843 - proxyAuth: proxyUrl.auth, 11844 - host: proxyUrl.hostname, 11845 - port: proxyUrl.port 11846 - } 11836 + if (!customTemplate['3_RECENTLY_PUSHED_REPOS']) { 11837 + customTemplate['3_RECENTLY_PUSHED_REPOS'] = { 11838 + type: 'repos', 11839 + params: ` 11840 + first: 3, 11841 + privacy: PUBLIC, 11842 + ownerAffiliations:[OWNER], 11843 + orderBy: { field:PUSHED_AT, direction: DESC } 11844 + ` 11847 11845 }; 11848 - let tunnelAgent; 11849 - const overHttps = proxyUrl.protocol === 'https:'; 11850 - if (usingSsl) { 11851 - tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; 11852 - } 11853 - else { 11854 - tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; 11855 - } 11856 - agent = tunnelAgent(agentOptions); 11857 - this._proxyAgent = agent; 11858 - } 11859 - // if reusing agent across request and tunneling agent isn't assigned create a new agent 11860 - if (this._keepAlive && !agent) { 11861 - const options = { keepAlive: this._keepAlive, maxSockets: maxSockets }; 11862 - agent = usingSsl ? new https.Agent(options) : new http.Agent(options); 11863 - this._agent = agent; 11864 11846 } 11865 - // if not using private agent and tunnel agent isn't setup then use global agent 11866 - if (!agent) { 11867 - agent = usingSsl ? https.globalAgent : http.globalAgent; 11868 - } 11869 - if (usingSsl && this._ignoreSslError) { 11870 - // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process 11871 - // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options 11872 - // we have to cast it to any and change it directly 11873 - agent.options = Object.assign(agent.options || {}, { 11874 - rejectUnauthorized: false 11875 - }); 11876 - } 11877 - return agent; 11878 - } 11879 - _performExponentialBackoff(retryNumber) { 11880 - retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); 11881 - const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); 11882 - return new Promise(resolve => setTimeout(() => resolve(), ms)); 11883 - } 11884 - static dateTimeDeserializer(key, value) { 11885 - if (typeof value === 'string') { 11886 - let a = new Date(value); 11887 - if (!isNaN(a.valueOf())) { 11888 - return a; 11889 - } 11890 - } 11891 - return value; 11892 - } 11893 - async _processResponse(res, options) { 11894 - return new Promise(async (resolve, reject) => { 11895 - const statusCode = res.message.statusCode; 11896 - const response = { 11897 - statusCode: statusCode, 11898 - result: null, 11899 - headers: {} 11900 - }; 11901 - // not found leads to null obj returned 11902 - if (statusCode == HttpCodes.NotFound) { 11903 - resolve(response); 11904 - } 11905 - let obj; 11906 - let contents; 11907 - // get the result from the body 11908 - try { 11909 - contents = await res.readBody(); 11910 - if (contents && contents.length > 0) { 11911 - if (options && options.deserializeDates) { 11912 - obj = JSON.parse(contents, HttpClient.dateTimeDeserializer); 11913 - } 11914 - else { 11915 - obj = JSON.parse(contents); 11847 + for (const [templateName, template] of Object.entries(customTemplate)) { 11848 + if (template.type === 'repos' || template.type === 'specificRepos') { 11849 + console.log(templateName); 11850 + console.log(' - Looking for'); 11851 + outputStr = await injectLoop(outputStr, templateName, async () => { 11852 + console.log(' - Fetching'); 11853 + const repos = template.type === 'repos' 11854 + ? await getRepos(template.params) 11855 + : await getSpecificRepos(user.USERNAME, template.repos); 11856 + if (typeof template.modifyVariables === 'function') { 11857 + for (let i = 0; i < repos.length; i++) { 11858 + repos[i] = template.modifyVariables(repos[i], moment, user); 11859 + } 11916 11860 } 11917 - response.result = obj; 11918 - } 11919 - response.headers = res.message.headers; 11920 - } 11921 - catch (err) { 11922 - // Invalid resource (contents not json); leaving result obj null 11861 + console.log(' - Injecting'); 11862 + return repos; 11863 + }); 11923 11864 } 11924 - // note that 3xx redirects are handled by the http layer. 11925 - if (statusCode > 299) { 11926 - let msg; 11927 - // if exception/error in body, attempt to get better error 11928 - if (obj && obj.message) { 11929 - msg = obj.message; 11930 - } 11931 - else if (contents && contents.length > 0) { 11932 - // it may be the case that the exception is in the body message as string 11933 - msg = contents; 11865 + else if (template.type === 'customQuery') { 11866 + console.log(templateName, '(customQuery)'); 11867 + if (template.loop) { 11868 + console.log(' - Looking for'); 11869 + outputStr = await injectLoop(outputStr, templateName, async () => { 11870 + console.log(' - Fetching'); 11871 + const resultArray = await template.query(octokit, moment, user); 11872 + console.log(' - Injecting'); 11873 + return resultArray; 11874 + }); 11934 11875 } 11935 11876 else { 11936 - msg = 'Failed request: (' + statusCode + ')'; 11937 - } 11938 - let err = new Error(msg); 11939 - // attach statusCode and body obj (if available) to the error object 11940 - err['statusCode'] = statusCode; 11941 - if (response.result) { 11942 - err['result'] = response.result; 11877 + console.log(' - Fetching'); 11878 + const resultObject = await template.query(octokit, moment, user); 11879 + console.log(' - Injecting'); 11880 + outputStr = inject(outputStr, resultObject); 11943 11881 } 11944 - reject(err); 11945 11882 } 11946 - else { 11947 - resolve(response); 11883 + else if (template.type) { 11884 + throw new Error(`Invalid template type "${template.type}"`); 11948 11885 } 11949 - }); 11886 + } 11887 + external_fs_.writeFileSync(outputPath, outputStr); 11888 + } 11889 + catch (error) { 11890 + console.log(error); 11891 + if (typeof error === 'string') { 11892 + core.setFailed(error); 11893 + } 11894 + else { 11895 + core.setFailed(error.message); 11896 + } 11950 11897 } 11951 11898 } 11952 - exports.HttpClient = HttpClient; 11899 + 11900 + 11901 + /***/ }), 11902 + 11903 + /***/ 877: 11904 + /***/ ((module) => { 11905 + 11906 + module.exports = eval("require")("encoding"); 11953 11907 11954 11908 11955 11909 /***/ }), 11956 11910 11957 - /***/ 932: 11958 - /***/ (function(__unusedmodule, exports) { 11911 + /***/ 357: 11912 + /***/ ((module) => { 11959 11913 11960 11914 "use strict"; 11915 + module.exports = require("assert");; 11961 11916 11917 + /***/ }), 11962 11918 11963 - Object.defineProperty(exports, '__esModule', { value: true }); 11919 + /***/ 614: 11920 + /***/ ((module) => { 11964 11921 11965 - class Deprecation extends Error { 11966 - constructor(message) { 11967 - super(message); // Maintains proper stack trace (only available on V8) 11922 + "use strict"; 11923 + module.exports = require("events");; 11968 11924 11969 - /* istanbul ignore next */ 11925 + /***/ }), 11970 11926 11971 - if (Error.captureStackTrace) { 11972 - Error.captureStackTrace(this, this.constructor); 11973 - } 11927 + /***/ 747: 11928 + /***/ ((module) => { 11974 11929 11975 - this.name = 'Deprecation'; 11976 - } 11930 + "use strict"; 11931 + module.exports = require("fs");; 11977 11932 11978 - } 11933 + /***/ }), 11979 11934 11980 - exports.Deprecation = Deprecation; 11935 + /***/ 605: 11936 + /***/ ((module) => { 11981 11937 11938 + "use strict"; 11939 + module.exports = require("http");; 11982 11940 11983 11941 /***/ }), 11984 11942 11985 - /***/ 940: 11986 - /***/ (function(module) { 11943 + /***/ 211: 11944 + /***/ ((module) => { 11987 11945 11988 - // Returns a wrapper function that returns a wrapped callback 11989 - // The wrapper function should do some stuff, and return a 11990 - // presumably different callback function. 11991 - // This makes sure that own properties are retained, so that 11992 - // decorations and such are not lost along the way. 11993 - module.exports = wrappy 11994 - function wrappy (fn, cb) { 11995 - if (fn && cb) return wrappy(fn)(cb) 11946 + "use strict"; 11947 + module.exports = require("https");; 11996 11948 11997 - if (typeof fn !== 'function') 11998 - throw new TypeError('need wrapper function') 11949 + /***/ }), 11999 11950 12000 - Object.keys(fn).forEach(function (k) { 12001 - wrapper[k] = fn[k] 12002 - }) 11951 + /***/ 282: 11952 + /***/ ((module) => { 12003 11953 12004 - return wrapper 11954 + "use strict"; 11955 + module.exports = require("module");; 12005 11956 12006 - function wrapper() { 12007 - var args = new Array(arguments.length) 12008 - for (var i = 0; i < args.length; i++) { 12009 - args[i] = arguments[i] 12010 - } 12011 - var ret = fn.apply(this, args) 12012 - var cb = args[args.length-1] 12013 - if (typeof ret === 'function' && ret !== cb) { 12014 - Object.keys(cb).forEach(function (k) { 12015 - ret[k] = cb[k] 12016 - }) 12017 - } 12018 - return ret 12019 - } 12020 - } 11957 + /***/ }), 11958 + 11959 + /***/ 631: 11960 + /***/ ((module) => { 11961 + 11962 + "use strict"; 11963 + module.exports = require("net");; 11964 + 11965 + /***/ }), 11966 + 11967 + /***/ 87: 11968 + /***/ ((module) => { 12021 11969 11970 + "use strict"; 11971 + module.exports = require("os");; 11972 + 11973 + /***/ }), 11974 + 11975 + /***/ 622: 11976 + /***/ ((module) => { 11977 + 11978 + "use strict"; 11979 + module.exports = require("path");; 11980 + 11981 + /***/ }), 11982 + 11983 + /***/ 413: 11984 + /***/ ((module) => { 11985 + 11986 + "use strict"; 11987 + module.exports = require("stream");; 11988 + 11989 + /***/ }), 11990 + 11991 + /***/ 16: 11992 + /***/ ((module) => { 11993 + 11994 + "use strict"; 11995 + module.exports = require("tls");; 11996 + 11997 + /***/ }), 11998 + 11999 + /***/ 835: 12000 + /***/ ((module) => { 12001 + 12002 + "use strict"; 12003 + module.exports = require("url");; 12004 + 12005 + /***/ }), 12006 + 12007 + /***/ 669: 12008 + /***/ ((module) => { 12009 + 12010 + "use strict"; 12011 + module.exports = require("util");; 12012 + 12013 + /***/ }), 12014 + 12015 + /***/ 761: 12016 + /***/ ((module) => { 12017 + 12018 + "use strict"; 12019 + module.exports = require("zlib");; 12022 12020 12023 12021 /***/ }) 12024 12022 12025 - /******/ }, 12026 - /******/ function(__webpack_require__) { // webpackRuntimeModules 12027 - /******/ "use strict"; 12028 - /******/ 12023 + /******/ }); 12024 + /************************************************************************/ 12025 + /******/ // The module cache 12026 + /******/ var __webpack_module_cache__ = {}; 12027 + /******/ 12028 + /******/ // The require function 12029 + /******/ function __nccwpck_require__(moduleId) { 12030 + /******/ // Check if module is in cache 12031 + /******/ if(__webpack_module_cache__[moduleId]) { 12032 + /******/ return __webpack_module_cache__[moduleId].exports; 12033 + /******/ } 12034 + /******/ // Create a new module (and put it into the cache) 12035 + /******/ var module = __webpack_module_cache__[moduleId] = { 12036 + /******/ id: moduleId, 12037 + /******/ loaded: false, 12038 + /******/ exports: {} 12039 + /******/ }; 12040 + /******/ 12041 + /******/ // Execute the module function 12042 + /******/ var threw = true; 12043 + /******/ try { 12044 + /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__); 12045 + /******/ threw = false; 12046 + /******/ } finally { 12047 + /******/ if(threw) delete __webpack_module_cache__[moduleId]; 12048 + /******/ } 12049 + /******/ 12050 + /******/ // Flag the module as loaded 12051 + /******/ module.loaded = true; 12052 + /******/ 12053 + /******/ // Return the exports of the module 12054 + /******/ return module.exports; 12055 + /******/ } 12056 + /******/ 12057 + /************************************************************************/ 12058 + /******/ /* webpack/runtime/make namespace object */ 12059 + /******/ (() => { 12060 + /******/ // define __esModule on exports 12061 + /******/ __nccwpck_require__.r = (exports) => { 12062 + /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 12063 + /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 12064 + /******/ } 12065 + /******/ Object.defineProperty(exports, '__esModule', { value: true }); 12066 + /******/ }; 12067 + /******/ })(); 12068 + /******/ 12029 12069 /******/ /* webpack/runtime/node module decorator */ 12030 - /******/ !function() { 12031 - /******/ __webpack_require__.nmd = function(module) { 12070 + /******/ (() => { 12071 + /******/ __nccwpck_require__.nmd = (module) => { 12032 12072 /******/ module.paths = []; 12033 12073 /******/ if (!module.children) module.children = []; 12034 - /******/ Object.defineProperty(module, 'loaded', { 12035 - /******/ enumerable: true, 12036 - /******/ get: function() { return module.l; } 12037 - /******/ }); 12038 - /******/ Object.defineProperty(module, 'id', { 12039 - /******/ enumerable: true, 12040 - /******/ get: function() { return module.i; } 12041 - /******/ }); 12042 12074 /******/ return module; 12043 12075 /******/ }; 12044 - /******/ }(); 12076 + /******/ })(); 12045 12077 /******/ 12046 - /******/ } 12047 - ); 12078 + /******/ /* webpack/runtime/compat */ 12079 + /******/ 12080 + /******/ __nccwpck_require__.ab = __dirname + "/";/************************************************************************/ 12081 + /******/ // module exports must be returned from runtime so entry inlining is disabled 12082 + /******/ // startup 12083 + /******/ // Load entry module and return exports 12084 + /******/ return __nccwpck_require__(580); 12085 + /******/ })() 12086 + ;
+13 -862
package-lock.json
··· 4 4 "lockfileVersion": 1, 5 5 "dependencies": { 6 6 "@actions/core": { 7 - "version": "1.2.4", 8 - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz", 9 - "integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg==" 7 + "version": "1.2.6", 8 + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz", 9 + "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==" 10 10 }, 11 11 "@actions/github": { 12 12 "version": "4.0.0", ··· 25 25 "integrity": "sha512-G4JjJ6f9Hb3Zvejj+ewLLKLf99ZC+9v+yCxoYf9vSyH+WkzPLB2LuUtRMGNkooMqdugGBFStIKXOuvH1W+EctA==", 26 26 "requires": { 27 27 "tunnel": "0.0.6" 28 - } 29 - }, 30 - "@babel/code-frame": { 31 - "version": "7.10.4", 32 - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", 33 - "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", 34 - "dev": true, 35 - "requires": { 36 - "@babel/highlight": "^7.10.4" 37 - } 38 - }, 39 - "@babel/helper-validator-identifier": { 40 - "version": "7.10.4", 41 - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", 42 - "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", 43 - "dev": true 44 - }, 45 - "@babel/highlight": { 46 - "version": "7.10.4", 47 - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", 48 - "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", 49 - "dev": true, 50 - "requires": { 51 - "@babel/helper-validator-identifier": "^7.10.4", 52 - "chalk": "^2.0.0", 53 - "js-tokens": "^4.0.0" 54 - }, 55 - "dependencies": { 56 - "chalk": { 57 - "version": "2.4.2", 58 - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", 59 - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", 60 - "dev": true, 61 - "requires": { 62 - "ansi-styles": "^3.2.1", 63 - "escape-string-regexp": "^1.0.5", 64 - "supports-color": "^5.3.0" 65 - } 66 - } 67 28 } 68 29 }, 69 30 "@octokit/auth-token": { ··· 157 118 "@types/node": ">= 8" 158 119 } 159 120 }, 160 - "@types/color-name": { 161 - "version": "1.1.1", 162 - "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", 163 - "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", 164 - "dev": true 165 - }, 166 121 "@types/node": { 167 122 "version": "14.6.0", 168 123 "resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.0.tgz", 169 124 "integrity": "sha512-mikldZQitV94akrc4sCcSjtJfsTKt4p+e/s0AGscVA6XArQ9kFclP+ZiYUMnq987rc6QlYxXv/EivqlfSLxpKA==" 170 125 }, 171 126 "@vercel/ncc": { 172 - "version": "0.23.0", 173 - "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.23.0.tgz", 174 - "integrity": "sha512-Fcr1qlG9t54X4X9qbo/+jr1+t5Qc6H3TgIRBXmKkF/WDs6YFulAN6ilq2Ehx38RbgIOFxaZnjlAQ50GyexnMpQ==" 175 - }, 176 - "acorn": { 177 - "version": "7.4.0", 178 - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz", 179 - "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==", 180 - "dev": true 181 - }, 182 - "acorn-jsx": { 183 - "version": "5.2.0", 184 - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.2.0.tgz", 185 - "integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==", 186 - "dev": true 187 - }, 188 - "ajv": { 189 - "version": "6.12.4", 190 - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.4.tgz", 191 - "integrity": "sha512-eienB2c9qVQs2KWexhkrdMLVDoIQCz5KSeLxwg9Lzk4DOfBtIK9PQwwufcsn1jjGuf9WZmqPMbGxOzfcuphJCQ==", 192 - "dev": true, 193 - "requires": { 194 - "fast-deep-equal": "^3.1.1", 195 - "fast-json-stable-stringify": "^2.0.0", 196 - "json-schema-traverse": "^0.4.1", 197 - "uri-js": "^4.2.2" 198 - } 199 - }, 200 - "ansi-colors": { 201 - "version": "4.1.1", 202 - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", 203 - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", 204 - "dev": true 205 - }, 206 - "ansi-regex": { 207 - "version": "5.0.0", 208 - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", 209 - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", 210 - "dev": true 211 - }, 212 - "ansi-styles": { 213 - "version": "3.2.1", 214 - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", 215 - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", 216 - "dev": true, 217 - "requires": { 218 - "color-convert": "^1.9.0" 219 - } 220 - }, 221 - "argparse": { 222 - "version": "1.0.10", 223 - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", 224 - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", 225 - "dev": true, 226 - "requires": { 227 - "sprintf-js": "~1.0.2" 228 - } 229 - }, 230 - "astral-regex": { 231 - "version": "1.0.0", 232 - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", 233 - "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", 234 - "dev": true 235 - }, 236 - "balanced-match": { 237 - "version": "1.0.0", 238 - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", 239 - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", 240 - "dev": true 127 + "version": "0.28.0", 128 + "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.28.0.tgz", 129 + "integrity": "sha512-dKFgT0r61LmKcMsriSkoxOSp+A45ADRFxrYXvFMmuLEpvc2a+fBAIh8Pg1Q7RYtPTZE1kX/Tk+nmOpNGyb5P2w==" 241 130 }, 242 131 "before-after-hook": { 243 132 "version": "2.1.0", 244 133 "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz", 245 134 "integrity": "sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A==" 246 135 }, 247 - "brace-expansion": { 248 - "version": "1.1.11", 249 - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 250 - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 251 - "dev": true, 252 - "requires": { 253 - "balanced-match": "^1.0.0", 254 - "concat-map": "0.0.1" 255 - } 256 - }, 257 - "callsites": { 258 - "version": "3.1.0", 259 - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", 260 - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", 261 - "dev": true 262 - }, 263 - "chalk": { 264 - "version": "4.1.0", 265 - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", 266 - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", 267 - "dev": true, 268 - "requires": { 269 - "ansi-styles": "^4.1.0", 270 - "supports-color": "^7.1.0" 271 - }, 272 - "dependencies": { 273 - "ansi-styles": { 274 - "version": "4.2.1", 275 - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", 276 - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", 277 - "dev": true, 278 - "requires": { 279 - "@types/color-name": "^1.1.1", 280 - "color-convert": "^2.0.1" 281 - } 282 - }, 283 - "color-convert": { 284 - "version": "2.0.1", 285 - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", 286 - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", 287 - "dev": true, 288 - "requires": { 289 - "color-name": "~1.1.4" 290 - } 291 - }, 292 - "color-name": { 293 - "version": "1.1.4", 294 - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", 295 - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", 296 - "dev": true 297 - }, 298 - "has-flag": { 299 - "version": "4.0.0", 300 - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", 301 - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", 302 - "dev": true 303 - }, 304 - "supports-color": { 305 - "version": "7.1.0", 306 - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", 307 - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", 308 - "dev": true, 309 - "requires": { 310 - "has-flag": "^4.0.0" 311 - } 312 - } 313 - } 314 - }, 315 - "color-convert": { 316 - "version": "1.9.3", 317 - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", 318 - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", 319 - "dev": true, 320 - "requires": { 321 - "color-name": "1.1.3" 322 - } 323 - }, 324 - "color-name": { 325 - "version": "1.1.3", 326 - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", 327 - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", 328 - "dev": true 329 - }, 330 - "concat-map": { 331 - "version": "0.0.1", 332 - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 333 - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", 334 - "dev": true 335 - }, 336 - "cross-spawn": { 337 - "version": "7.0.3", 338 - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", 339 - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", 340 - "dev": true, 341 - "requires": { 342 - "path-key": "^3.1.0", 343 - "shebang-command": "^2.0.0", 344 - "which": "^2.0.1" 345 - } 346 - }, 347 - "debug": { 348 - "version": "4.1.1", 349 - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", 350 - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", 351 - "dev": true, 352 - "requires": { 353 - "ms": "^2.1.1" 354 - } 355 - }, 356 - "deep-is": { 357 - "version": "0.1.3", 358 - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", 359 - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", 360 - "dev": true 361 - }, 362 136 "deprecation": { 363 137 "version": "2.3.1", 364 138 "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", 365 139 "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" 366 140 }, 367 - "doctrine": { 368 - "version": "3.0.0", 369 - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", 370 - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", 371 - "dev": true, 372 - "requires": { 373 - "esutils": "^2.0.2" 374 - } 375 - }, 376 - "emoji-regex": { 377 - "version": "7.0.3", 378 - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", 379 - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", 380 - "dev": true 381 - }, 382 - "enquirer": { 383 - "version": "2.3.6", 384 - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", 385 - "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", 386 - "dev": true, 387 - "requires": { 388 - "ansi-colors": "^4.1.1" 389 - } 390 - }, 391 - "escape-string-regexp": { 392 - "version": "1.0.5", 393 - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", 394 - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", 395 - "dev": true 396 - }, 397 - "eslint": { 398 - "version": "7.7.0", 399 - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.7.0.tgz", 400 - "integrity": "sha512-1KUxLzos0ZVsyL81PnRN335nDtQ8/vZUD6uMtWbF+5zDtjKcsklIi78XoE0MVL93QvWTu+E5y44VyyCsOMBrIg==", 401 - "dev": true, 402 - "requires": { 403 - "@babel/code-frame": "^7.0.0", 404 - "ajv": "^6.10.0", 405 - "chalk": "^4.0.0", 406 - "cross-spawn": "^7.0.2", 407 - "debug": "^4.0.1", 408 - "doctrine": "^3.0.0", 409 - "enquirer": "^2.3.5", 410 - "eslint-scope": "^5.1.0", 411 - "eslint-utils": "^2.1.0", 412 - "eslint-visitor-keys": "^1.3.0", 413 - "espree": "^7.2.0", 414 - "esquery": "^1.2.0", 415 - "esutils": "^2.0.2", 416 - "file-entry-cache": "^5.0.1", 417 - "functional-red-black-tree": "^1.0.1", 418 - "glob-parent": "^5.0.0", 419 - "globals": "^12.1.0", 420 - "ignore": "^4.0.6", 421 - "import-fresh": "^3.0.0", 422 - "imurmurhash": "^0.1.4", 423 - "is-glob": "^4.0.0", 424 - "js-yaml": "^3.13.1", 425 - "json-stable-stringify-without-jsonify": "^1.0.1", 426 - "levn": "^0.4.1", 427 - "lodash": "^4.17.19", 428 - "minimatch": "^3.0.4", 429 - "natural-compare": "^1.4.0", 430 - "optionator": "^0.9.1", 431 - "progress": "^2.0.0", 432 - "regexpp": "^3.1.0", 433 - "semver": "^7.2.1", 434 - "strip-ansi": "^6.0.0", 435 - "strip-json-comments": "^3.1.0", 436 - "table": "^5.2.3", 437 - "text-table": "^0.2.0", 438 - "v8-compile-cache": "^2.0.3" 439 - } 440 - }, 441 - "eslint-scope": { 442 - "version": "5.1.0", 443 - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.0.tgz", 444 - "integrity": "sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w==", 445 - "dev": true, 446 - "requires": { 447 - "esrecurse": "^4.1.0", 448 - "estraverse": "^4.1.1" 449 - } 450 - }, 451 - "eslint-utils": { 452 - "version": "2.1.0", 453 - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", 454 - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", 455 - "dev": true, 456 - "requires": { 457 - "eslint-visitor-keys": "^1.1.0" 458 - } 459 - }, 460 - "eslint-visitor-keys": { 461 - "version": "1.3.0", 462 - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", 463 - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", 464 - "dev": true 465 - }, 466 - "espree": { 467 - "version": "7.2.0", 468 - "resolved": "https://registry.npmjs.org/espree/-/espree-7.2.0.tgz", 469 - "integrity": "sha512-H+cQ3+3JYRMEIOl87e7QdHX70ocly5iW4+dttuR8iYSPr/hXKFb+7dBsZ7+u1adC4VrnPlTkv0+OwuPnDop19g==", 470 - "dev": true, 471 - "requires": { 472 - "acorn": "^7.3.1", 473 - "acorn-jsx": "^5.2.0", 474 - "eslint-visitor-keys": "^1.3.0" 475 - } 476 - }, 477 - "esprima": { 478 - "version": "4.0.1", 479 - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", 480 - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", 481 - "dev": true 482 - }, 483 - "esquery": { 484 - "version": "1.3.1", 485 - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", 486 - "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", 487 - "dev": true, 488 - "requires": { 489 - "estraverse": "^5.1.0" 490 - }, 491 - "dependencies": { 492 - "estraverse": { 493 - "version": "5.2.0", 494 - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", 495 - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", 496 - "dev": true 497 - } 498 - } 499 - }, 500 - "esrecurse": { 501 - "version": "4.2.1", 502 - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", 503 - "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", 504 - "dev": true, 505 - "requires": { 506 - "estraverse": "^4.1.0" 507 - } 508 - }, 509 - "estraverse": { 510 - "version": "4.3.0", 511 - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", 512 - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", 513 - "dev": true 514 - }, 515 - "esutils": { 516 - "version": "2.0.3", 517 - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", 518 - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", 519 - "dev": true 520 - }, 521 - "fast-deep-equal": { 522 - "version": "3.1.3", 523 - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", 524 - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", 525 - "dev": true 526 - }, 527 - "fast-json-stable-stringify": { 528 - "version": "2.1.0", 529 - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", 530 - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", 531 - "dev": true 532 - }, 533 - "fast-levenshtein": { 534 - "version": "2.0.6", 535 - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", 536 - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", 537 - "dev": true 538 - }, 539 - "file-entry-cache": { 540 - "version": "5.0.1", 541 - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", 542 - "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", 543 - "dev": true, 544 - "requires": { 545 - "flat-cache": "^2.0.1" 546 - } 547 - }, 548 - "flat-cache": { 549 - "version": "2.0.1", 550 - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", 551 - "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", 552 - "dev": true, 553 - "requires": { 554 - "flatted": "^2.0.0", 555 - "rimraf": "2.6.3", 556 - "write": "1.0.3" 557 - } 558 - }, 559 - "flatted": { 560 - "version": "2.0.2", 561 - "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", 562 - "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", 563 - "dev": true 564 - }, 565 - "fs.realpath": { 566 - "version": "1.0.0", 567 - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 568 - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", 569 - "dev": true 570 - }, 571 - "functional-red-black-tree": { 572 - "version": "1.0.1", 573 - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", 574 - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", 575 - "dev": true 576 - }, 577 - "glob": { 578 - "version": "7.1.6", 579 - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", 580 - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", 581 - "dev": true, 582 - "requires": { 583 - "fs.realpath": "^1.0.0", 584 - "inflight": "^1.0.4", 585 - "inherits": "2", 586 - "minimatch": "^3.0.4", 587 - "once": "^1.3.0", 588 - "path-is-absolute": "^1.0.0" 589 - } 590 - }, 591 - "glob-parent": { 592 - "version": "5.1.1", 593 - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", 594 - "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", 595 - "dev": true, 596 - "requires": { 597 - "is-glob": "^4.0.1" 598 - } 599 - }, 600 - "globals": { 601 - "version": "12.4.0", 602 - "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", 603 - "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", 604 - "dev": true, 605 - "requires": { 606 - "type-fest": "^0.8.1" 607 - } 608 - }, 609 - "has-flag": { 610 - "version": "3.0.0", 611 - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", 612 - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", 613 - "dev": true 614 - }, 615 - "ignore": { 616 - "version": "4.0.6", 617 - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", 618 - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", 619 - "dev": true 620 - }, 621 - "import-fresh": { 622 - "version": "3.2.1", 623 - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", 624 - "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", 625 - "dev": true, 626 - "requires": { 627 - "parent-module": "^1.0.0", 628 - "resolve-from": "^4.0.0" 629 - } 630 - }, 631 - "imurmurhash": { 632 - "version": "0.1.4", 633 - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", 634 - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", 635 - "dev": true 636 - }, 637 - "inflight": { 638 - "version": "1.0.6", 639 - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 640 - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", 641 - "dev": true, 642 - "requires": { 643 - "once": "^1.3.0", 644 - "wrappy": "1" 645 - } 646 - }, 647 - "inherits": { 648 - "version": "2.0.4", 649 - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 650 - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", 651 - "dev": true 652 - }, 653 - "is-extglob": { 654 - "version": "2.1.1", 655 - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", 656 - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", 657 - "dev": true 658 - }, 659 - "is-fullwidth-code-point": { 660 - "version": "2.0.0", 661 - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", 662 - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", 663 - "dev": true 664 - }, 665 - "is-glob": { 666 - "version": "4.0.1", 667 - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", 668 - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", 669 - "dev": true, 670 - "requires": { 671 - "is-extglob": "^2.1.1" 672 - } 673 - }, 674 141 "is-plain-object": { 675 142 "version": "4.1.1", 676 143 "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-4.1.1.tgz", 677 144 "integrity": "sha512-5Aw8LLVsDlZsETVMhoMXzqsXwQqr/0vlnBYzIXJbYo2F4yYlhLHs+Ez7Bod7IIQKWkJbJfxrWD7pA1Dw1TKrwA==" 678 145 }, 679 - "isexe": { 680 - "version": "2.0.0", 681 - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", 682 - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", 683 - "dev": true 684 - }, 685 - "js-tokens": { 686 - "version": "4.0.0", 687 - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", 688 - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", 689 - "dev": true 690 - }, 691 - "js-yaml": { 692 - "version": "3.14.0", 693 - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", 694 - "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", 695 - "dev": true, 696 - "requires": { 697 - "argparse": "^1.0.7", 698 - "esprima": "^4.0.0" 699 - } 700 - }, 701 - "json-schema-traverse": { 702 - "version": "0.4.1", 703 - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", 704 - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", 705 - "dev": true 706 - }, 707 - "json-stable-stringify-without-jsonify": { 708 - "version": "1.0.1", 709 - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", 710 - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", 711 - "dev": true 712 - }, 713 - "levn": { 714 - "version": "0.4.1", 715 - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", 716 - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", 717 - "dev": true, 718 - "requires": { 719 - "prelude-ls": "^1.2.1", 720 - "type-check": "~0.4.0" 721 - } 722 - }, 723 - "lodash": { 724 - "version": "4.17.20", 725 - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", 726 - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", 727 - "dev": true 728 - }, 729 - "minimatch": { 730 - "version": "3.0.4", 731 - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 732 - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", 733 - "dev": true, 734 - "requires": { 735 - "brace-expansion": "^1.1.7" 736 - } 737 - }, 738 - "minimist": { 739 - "version": "1.2.5", 740 - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", 741 - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", 742 - "dev": true 743 - }, 744 - "mkdirp": { 745 - "version": "0.5.5", 746 - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", 747 - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", 748 - "dev": true, 749 - "requires": { 750 - "minimist": "^1.2.5" 751 - } 752 - }, 753 146 "moment": { 754 - "version": "2.27.0", 755 - "resolved": "https://registry.npmjs.org/moment/-/moment-2.27.0.tgz", 756 - "integrity": "sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ==" 757 - }, 758 - "ms": { 759 - "version": "2.1.2", 760 - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 761 - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", 762 - "dev": true 763 - }, 764 - "natural-compare": { 765 - "version": "1.4.0", 766 - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", 767 - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", 768 - "dev": true 147 + "version": "2.29.1", 148 + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", 149 + "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" 769 150 }, 770 151 "node-fetch": { 771 152 "version": "2.6.0", ··· 780 161 "wrappy": "1" 781 162 } 782 163 }, 783 - "optionator": { 784 - "version": "0.9.1", 785 - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", 786 - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", 787 - "dev": true, 788 - "requires": { 789 - "deep-is": "^0.1.3", 790 - "fast-levenshtein": "^2.0.6", 791 - "levn": "^0.4.1", 792 - "prelude-ls": "^1.2.1", 793 - "type-check": "^0.4.0", 794 - "word-wrap": "^1.2.3" 795 - } 796 - }, 797 - "parent-module": { 798 - "version": "1.0.1", 799 - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", 800 - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", 801 - "dev": true, 802 - "requires": { 803 - "callsites": "^3.0.0" 804 - } 805 - }, 806 - "path-is-absolute": { 807 - "version": "1.0.1", 808 - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 809 - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", 810 - "dev": true 811 - }, 812 - "path-key": { 813 - "version": "3.1.1", 814 - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", 815 - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", 816 - "dev": true 817 - }, 818 - "prelude-ls": { 819 - "version": "1.2.1", 820 - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", 821 - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", 822 - "dev": true 823 - }, 824 - "progress": { 825 - "version": "2.0.3", 826 - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", 827 - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", 828 - "dev": true 829 - }, 830 - "punycode": { 831 - "version": "2.1.1", 832 - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", 833 - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", 834 - "dev": true 835 - }, 836 - "regexpp": { 837 - "version": "3.1.0", 838 - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", 839 - "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", 840 - "dev": true 841 - }, 842 164 "require-from-string": { 843 165 "version": "2.0.2", 844 166 "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", 845 167 "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" 846 168 }, 847 - "resolve-from": { 848 - "version": "4.0.0", 849 - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", 850 - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", 851 - "dev": true 852 - }, 853 - "rimraf": { 854 - "version": "2.6.3", 855 - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", 856 - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", 857 - "dev": true, 858 - "requires": { 859 - "glob": "^7.1.3" 860 - } 861 - }, 862 - "semver": { 863 - "version": "7.3.2", 864 - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", 865 - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", 866 - "dev": true 867 - }, 868 - "shebang-command": { 869 - "version": "2.0.0", 870 - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", 871 - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", 872 - "dev": true, 873 - "requires": { 874 - "shebang-regex": "^3.0.0" 875 - } 876 - }, 877 - "shebang-regex": { 878 - "version": "3.0.0", 879 - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", 880 - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", 881 - "dev": true 882 - }, 883 - "slice-ansi": { 884 - "version": "2.1.0", 885 - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", 886 - "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", 887 - "dev": true, 888 - "requires": { 889 - "ansi-styles": "^3.2.0", 890 - "astral-regex": "^1.0.0", 891 - "is-fullwidth-code-point": "^2.0.0" 892 - } 893 - }, 894 - "sprintf-js": { 895 - "version": "1.0.3", 896 - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", 897 - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", 898 - "dev": true 899 - }, 900 - "string-width": { 901 - "version": "3.1.0", 902 - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", 903 - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", 904 - "dev": true, 905 - "requires": { 906 - "emoji-regex": "^7.0.1", 907 - "is-fullwidth-code-point": "^2.0.0", 908 - "strip-ansi": "^5.1.0" 909 - }, 910 - "dependencies": { 911 - "ansi-regex": { 912 - "version": "4.1.0", 913 - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", 914 - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", 915 - "dev": true 916 - }, 917 - "strip-ansi": { 918 - "version": "5.2.0", 919 - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", 920 - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", 921 - "dev": true, 922 - "requires": { 923 - "ansi-regex": "^4.1.0" 924 - } 925 - } 926 - } 927 - }, 928 - "strip-ansi": { 929 - "version": "6.0.0", 930 - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", 931 - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", 932 - "dev": true, 933 - "requires": { 934 - "ansi-regex": "^5.0.0" 935 - } 936 - }, 937 - "strip-json-comments": { 938 - "version": "3.1.1", 939 - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", 940 - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", 941 - "dev": true 942 - }, 943 - "supports-color": { 944 - "version": "5.5.0", 945 - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", 946 - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", 947 - "dev": true, 948 - "requires": { 949 - "has-flag": "^3.0.0" 950 - } 951 - }, 952 - "table": { 953 - "version": "5.4.6", 954 - "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", 955 - "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", 956 - "dev": true, 957 - "requires": { 958 - "ajv": "^6.10.2", 959 - "lodash": "^4.17.14", 960 - "slice-ansi": "^2.1.0", 961 - "string-width": "^3.0.0" 962 - } 963 - }, 964 - "text-table": { 965 - "version": "0.2.0", 966 - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", 967 - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", 968 - "dev": true 969 - }, 970 169 "tunnel": { 971 170 "version": "0.0.6", 972 171 "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", 973 172 "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" 974 173 }, 975 - "type-check": { 976 - "version": "0.4.0", 977 - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", 978 - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", 979 - "dev": true, 980 - "requires": { 981 - "prelude-ls": "^1.2.1" 982 - } 983 - }, 984 - "type-fest": { 985 - "version": "0.8.1", 986 - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", 987 - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", 174 + "typescript": { 175 + "version": "4.2.3", 176 + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz", 177 + "integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==", 988 178 "dev": true 989 179 }, 990 180 "universal-user-agent": { ··· 992 182 "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", 993 183 "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==" 994 184 }, 995 - "uri-js": { 996 - "version": "4.2.2", 997 - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", 998 - "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", 999 - "dev": true, 1000 - "requires": { 1001 - "punycode": "^2.1.0" 1002 - } 1003 - }, 1004 - "v8-compile-cache": { 1005 - "version": "2.1.1", 1006 - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", 1007 - "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==", 1008 - "dev": true 1009 - }, 1010 - "which": { 1011 - "version": "2.0.2", 1012 - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", 1013 - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", 1014 - "dev": true, 1015 - "requires": { 1016 - "isexe": "^2.0.0" 1017 - } 1018 - }, 1019 - "word-wrap": { 1020 - "version": "1.2.3", 1021 - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", 1022 - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", 1023 - "dev": true 1024 - }, 1025 185 "wrappy": { 1026 186 "version": "1.0.2", 1027 187 "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 1028 188 "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" 1029 - }, 1030 - "write": { 1031 - "version": "1.0.3", 1032 - "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", 1033 - "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", 1034 - "dev": true, 1035 - "requires": { 1036 - "mkdirp": "^0.5.1" 1037 - } 1038 189 } 1039 190 } 1040 191 }
+6 -6
package.json
··· 1 1 { 2 2 "name": "readme-template", 3 3 "scripts": { 4 - "build": "ncc build src/main.js -o dist", 5 - "test": "ncc build src/main.js -o dist && export $(cat .env | xargs) && node dist/index.js" 4 + "build": "ncc build src/main.ts -o dist", 5 + "test": "ncc build src/main.ts -o dist && export $(cat .env | xargs) && node dist/index.js" 6 6 }, 7 7 "dependencies": { 8 - "@actions/core": "^1.2.4", 8 + "@actions/core": "^1.2.6", 9 9 "@actions/github": "^4.0.0", 10 - "@vercel/ncc": "^0.23.0", 11 - "moment": "^2.27.0", 10 + "@vercel/ncc": "^0.28.0", 11 + "moment": "^2.29.1", 12 12 "require-from-string": "^2.0.2" 13 13 }, 14 14 "devDependencies": { 15 - "eslint": "^7.7.0" 15 + "typescript": "^4.2.3" 16 16 } 17 17 }
+27 -15
src/main.js src/main.ts
··· 1 - const core = require('@actions/core') 2 - const fs = require('fs') 3 - const moment = require('moment') 4 - const queries = require('./queries.js') 5 - const { 6 - newErr, 7 - trimRightChar, 1 + import * as core from '@actions/core' 2 + import * as fs from 'fs' 3 + import * as moment from 'moment' 4 + import * as queries from './queries' 5 + import { 6 + trimRightChar, 8 7 deleteFirstLine, 9 8 deleteLastLine, 10 - } = require('./utils.js') 9 + } from './utils' 11 10 12 11 // parses first found only 13 12 function parseBlock(str, openStr, closeStr) { ··· 29 28 return { beforeBlock, block, afterBlock } 30 29 } 31 30 31 + type Moment = typeof moment 32 + type CustomTemplate = { 33 + [name: string]: { 34 + type: string 35 + repos?: string[] 36 + params?: string 37 + modifyVariables?: (repo: any, moment: Moment, user: any) => any 38 + loop?: boolean 39 + query?: (octokit: any, moment: Moment, user: any) => any 40 + } 41 + } 32 42 function getCustomTemplate(str) { 33 43 const parsed = parseBlock(str, '// {{ TEMPLATE: }}', '// {{ :TEMPLATE }}') 34 44 if (!parsed) return { customTemplate: {}, outputStr: str } ··· 36 46 parsed.afterBlock = deleteFirstLine(parsed.afterBlock) 37 47 38 48 const requireFromString = require('require-from-string') 39 - const parsedCustomTemplate = requireFromString(parsed.block) 49 + const parsedCustomTemplate: CustomTemplate = requireFromString(parsed.block) 40 50 41 51 return { 42 52 customTemplate: parsedCustomTemplate, ··· 70 80 try { 71 81 72 82 let templatePath = core.getInput('TEMPLATE', { required: true }) 73 - console.log('template:', templatePath) 74 - if (!fs.existsSync(templatePath)) throw newErr('Template file not found') 83 + console.log('Template:', templatePath) 84 + if (!fs.existsSync(templatePath)) throw 'Template file not found' 75 85 const templateFile = fs.readFileSync(templatePath).toString() 76 86 77 87 let outputPath = core.getInput('OUTPUT', { required: true }) ··· 156 166 outputStr = inject(outputStr, resultObject) 157 167 } 158 168 159 - } else { 169 + } else if (template.type) { 160 170 throw new Error(`Invalid template type "${template.type}"`) 161 171 } 162 172 } ··· 164 174 fs.writeFileSync(outputPath, outputStr) 165 175 166 176 } catch (error) { 167 - if (!error || !error.logMessageOnly) { 168 - console.log(error) 177 + console.log(error) 178 + if (typeof error === 'string') { 179 + core.setFailed(error) 180 + } else { 181 + core.setFailed(error.message) 169 182 } 170 - core.setFailed(error.message) 171 183 } 172 184 }
+9 -10
src/queries.js src/queries.ts
··· 1 - const core = require('@actions/core') 2 - const github = require('@actions/github') 3 - const moment = require('moment') 1 + import * as core from '@actions/core' 2 + import * as github from '@actions/github' 3 + import * as moment from 'moment' 4 4 5 5 const ghToken = core.getInput('TOKEN', { required: true }) 6 6 core.setSecret(ghToken) 7 - const octokit = github.getOctokit(ghToken) 8 - module.exports.octokit = octokit 7 + export const octokit = github.getOctokit(ghToken) 9 8 10 - module.exports.getUser = async function() { 11 - const queryResult = await octokit.graphql(` 9 + export async function getUser() { 10 + const queryResult: any = await octokit.graphql(` 12 11 query { 13 12 viewer { 14 13 USERNAME: login ··· 78 77 return repo 79 78 } 80 79 81 - module.exports.getRepos = async function(args) { 80 + export async function getRepos(args) { 82 81 83 - const queryResult = await octokit.graphql(` 82 + const queryResult: any = await octokit.graphql(` 84 83 query { 85 84 viewer { 86 85 repositories(${args}) { ··· 123 122 124 123 } 125 124 126 - module.exports.getSpecificRepos = async function(username, repoNames) { 125 + export async function getSpecificRepos(username, repoNames) { 127 126 128 127 let repoQueryProperties = '' 129 128 let index = -1
+4 -10
src/utils.js src/utils.ts
··· 1 - module.exports.newErr = function(...args) { 2 - const err = new Error(...args) 3 - err.logMessageOnly = true 4 - return err 5 - } 6 - 7 - module.exports.trimLeftChar = function(string, charToRemove) { 1 + export function trimLeftChar(string, charToRemove) { 8 2 while(string.charAt(0)==charToRemove) { 9 3 string = string.substring(1) 10 4 } 11 5 return string 12 6 } 13 - module.exports.trimRightChar = function(string, charToRemove) { 7 + export function trimRightChar(string, charToRemove) { 14 8 while(string.charAt(string.length-1)==charToRemove) { 15 9 string = string.substring(0,string.length-1) 16 10 } 17 11 return string 18 12 } 19 13 20 - module.exports.deleteFirstLine = function(str) { 14 + export function deleteFirstLine(str) { 21 15 const lines = str.split('\n') 22 16 if (lines[0] === '') { 23 17 lines.splice(1, 1) ··· 26 20 } 27 21 return lines.join('\n') 28 22 } 29 - module.exports.deleteLastLine = function(str) { 23 + export function deleteLastLine(str) { 30 24 const lines = str.split('\n') 31 25 if (lines[lines.length-1] === '') { 32 26 lines.splice(-2, 1)
+9
tsconfig.json
··· 1 + { 2 + "parserOptions": { 3 + "sourceType": "module", 4 + }, 5 + "compilerOptions": { 6 + "target": "esnext", 7 + "moduleResolution": "node" 8 + } 9 + }