github.com/nektos/act@v0.2.63/pkg/runner/testdata/actions/node12/dist/index.js (about) 1 module.exports = 2 /******/ (() => { // webpackBootstrap 3 /******/ var __webpack_modules__ = ({ 4 5 /***/ 932: 6 /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { 7 8 const core = __webpack_require__(186); 9 const github = __webpack_require__(438); 10 11 try { 12 // `who-to-greet` input defined in action metadata file 13 const nameToGreet = core.getInput('who-to-greet'); 14 console.log(`Hello ${nameToGreet}!`); 15 const time = (new Date()).toTimeString(); 16 core.setOutput("time", time); 17 // Get the JSON webhook payload for the event that triggered the workflow 18 const payload = JSON.stringify(github.context.payload, undefined, 2) 19 console.log(`The event payload: ${payload}`); 20 } catch (error) { 21 core.setFailed(error.message); 22 } 23 24 /***/ }), 25 26 /***/ 351: 27 /***/ (function(__unused_webpack_module, exports, __webpack_require__) { 28 29 "use strict"; 30 31 var __importStar = (this && this.__importStar) || function (mod) { 32 if (mod && mod.__esModule) return mod; 33 var result = {}; 34 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 35 result["default"] = mod; 36 return result; 37 }; 38 Object.defineProperty(exports, "__esModule", ({ value: true })); 39 const os = __importStar(__webpack_require__(87)); 40 const utils_1 = __webpack_require__(278); 41 /** 42 * Commands 43 * 44 * Command Format: 45 * ::name key=value,key=value::message 46 * 47 * Examples: 48 * ::warning::This is the message 49 * ::set-env name=MY_VAR::some value 50 */ 51 function issueCommand(command, properties, message) { 52 const cmd = new Command(command, properties, message); 53 process.stdout.write(cmd.toString() + os.EOL); 54 } 55 exports.issueCommand = issueCommand; 56 function issue(name, message = '') { 57 issueCommand(name, {}, message); 58 } 59 exports.issue = issue; 60 const CMD_STRING = '::'; 61 class Command { 62 constructor(command, properties, message) { 63 if (!command) { 64 command = 'missing.command'; 65 } 66 this.command = command; 67 this.properties = properties; 68 this.message = message; 69 } 70 toString() { 71 let cmdStr = CMD_STRING + this.command; 72 if (this.properties && Object.keys(this.properties).length > 0) { 73 cmdStr += ' '; 74 let first = true; 75 for (const key in this.properties) { 76 if (this.properties.hasOwnProperty(key)) { 77 const val = this.properties[key]; 78 if (val) { 79 if (first) { 80 first = false; 81 } 82 else { 83 cmdStr += ','; 84 } 85 cmdStr += `${key}=${escapeProperty(val)}`; 86 } 87 } 88 } 89 } 90 cmdStr += `${CMD_STRING}${escapeData(this.message)}`; 91 return cmdStr; 92 } 93 } 94 function escapeData(s) { 95 return utils_1.toCommandValue(s) 96 .replace(/%/g, '%25') 97 .replace(/\r/g, '%0D') 98 .replace(/\n/g, '%0A'); 99 } 100 function escapeProperty(s) { 101 return utils_1.toCommandValue(s) 102 .replace(/%/g, '%25') 103 .replace(/\r/g, '%0D') 104 .replace(/\n/g, '%0A') 105 .replace(/:/g, '%3A') 106 .replace(/,/g, '%2C'); 107 } 108 //# sourceMappingURL=command.js.map 109 110 /***/ }), 111 112 /***/ 186: 113 /***/ (function(__unused_webpack_module, exports, __webpack_require__) { 114 115 "use strict"; 116 117 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 118 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 119 return new (P || (P = Promise))(function (resolve, reject) { 120 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 121 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 122 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 123 step((generator = generator.apply(thisArg, _arguments || [])).next()); 124 }); 125 }; 126 var __importStar = (this && this.__importStar) || function (mod) { 127 if (mod && mod.__esModule) return mod; 128 var result = {}; 129 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 130 result["default"] = mod; 131 return result; 132 }; 133 Object.defineProperty(exports, "__esModule", ({ value: true })); 134 const command_1 = __webpack_require__(351); 135 const file_command_1 = __webpack_require__(717); 136 const utils_1 = __webpack_require__(278); 137 const os = __importStar(__webpack_require__(87)); 138 const path = __importStar(__webpack_require__(622)); 139 /** 140 * The code to exit an action 141 */ 142 var ExitCode; 143 (function (ExitCode) { 144 /** 145 * A code indicating that the action was successful 146 */ 147 ExitCode[ExitCode["Success"] = 0] = "Success"; 148 /** 149 * A code indicating that the action was a failure 150 */ 151 ExitCode[ExitCode["Failure"] = 1] = "Failure"; 152 })(ExitCode = exports.ExitCode || (exports.ExitCode = {})); 153 //----------------------------------------------------------------------- 154 // Variables 155 //----------------------------------------------------------------------- 156 /** 157 * Sets env variable for this action and future actions in the job 158 * @param name the name of the variable to set 159 * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify 160 */ 161 // eslint-disable-next-line @typescript-eslint/no-explicit-any 162 function exportVariable(name, val) { 163 const convertedVal = utils_1.toCommandValue(val); 164 process.env[name] = convertedVal; 165 const filePath = process.env['GITHUB_ENV'] || ''; 166 if (filePath) { 167 const delimiter = '_GitHubActionsFileCommandDelimeter_'; 168 const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; 169 file_command_1.issueCommand('ENV', commandValue); 170 } 171 else { 172 command_1.issueCommand('set-env', { name }, convertedVal); 173 } 174 } 175 exports.exportVariable = exportVariable; 176 /** 177 * Registers a secret which will get masked from logs 178 * @param secret value of the secret 179 */ 180 function setSecret(secret) { 181 command_1.issueCommand('add-mask', {}, secret); 182 } 183 exports.setSecret = setSecret; 184 /** 185 * Prepends inputPath to the PATH (for this action and future actions) 186 * @param inputPath 187 */ 188 function addPath(inputPath) { 189 const filePath = process.env['GITHUB_PATH'] || ''; 190 if (filePath) { 191 file_command_1.issueCommand('PATH', inputPath); 192 } 193 else { 194 command_1.issueCommand('add-path', {}, inputPath); 195 } 196 process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; 197 } 198 exports.addPath = addPath; 199 /** 200 * Gets the value of an input. The value is also trimmed. 201 * 202 * @param name name of the input to get 203 * @param options optional. See InputOptions. 204 * @returns string 205 */ 206 function getInput(name, options) { 207 const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; 208 if (options && options.required && !val) { 209 throw new Error(`Input required and not supplied: ${name}`); 210 } 211 return val.trim(); 212 } 213 exports.getInput = getInput; 214 /** 215 * Sets the value of an output. 216 * 217 * @param name name of the output to set 218 * @param value value to store. Non-string values will be converted to a string via JSON.stringify 219 */ 220 // eslint-disable-next-line @typescript-eslint/no-explicit-any 221 function setOutput(name, value) { 222 command_1.issueCommand('set-output', { name }, value); 223 } 224 exports.setOutput = setOutput; 225 /** 226 * Enables or disables the echoing of commands into stdout for the rest of the step. 227 * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. 228 * 229 */ 230 function setCommandEcho(enabled) { 231 command_1.issue('echo', enabled ? 'on' : 'off'); 232 } 233 exports.setCommandEcho = setCommandEcho; 234 //----------------------------------------------------------------------- 235 // Results 236 //----------------------------------------------------------------------- 237 /** 238 * Sets the action status to failed. 239 * When the action exits it will be with an exit code of 1 240 * @param message add error issue message 241 */ 242 function setFailed(message) { 243 process.exitCode = ExitCode.Failure; 244 error(message); 245 } 246 exports.setFailed = setFailed; 247 //----------------------------------------------------------------------- 248 // Logging Commands 249 //----------------------------------------------------------------------- 250 /** 251 * Gets whether Actions Step Debug is on or not 252 */ 253 function isDebug() { 254 return process.env['RUNNER_DEBUG'] === '1'; 255 } 256 exports.isDebug = isDebug; 257 /** 258 * Writes debug message to user log 259 * @param message debug message 260 */ 261 function debug(message) { 262 command_1.issueCommand('debug', {}, message); 263 } 264 exports.debug = debug; 265 /** 266 * Adds an error issue 267 * @param message error issue message. Errors will be converted to string via toString() 268 */ 269 function error(message) { 270 command_1.issue('error', message instanceof Error ? message.toString() : message); 271 } 272 exports.error = error; 273 /** 274 * Adds an warning issue 275 * @param message warning issue message. Errors will be converted to string via toString() 276 */ 277 function warning(message) { 278 command_1.issue('warning', message instanceof Error ? message.toString() : message); 279 } 280 exports.warning = warning; 281 /** 282 * Writes info to log with console.log. 283 * @param message info message 284 */ 285 function info(message) { 286 process.stdout.write(message + os.EOL); 287 } 288 exports.info = info; 289 /** 290 * Begin an output group. 291 * 292 * Output until the next `groupEnd` will be foldable in this group 293 * 294 * @param name The name of the output group 295 */ 296 function startGroup(name) { 297 command_1.issue('group', name); 298 } 299 exports.startGroup = startGroup; 300 /** 301 * End an output group. 302 */ 303 function endGroup() { 304 command_1.issue('endgroup'); 305 } 306 exports.endGroup = endGroup; 307 /** 308 * Wrap an asynchronous function call in a group. 309 * 310 * Returns the same type as the function itself. 311 * 312 * @param name The name of the group 313 * @param fn The function to wrap in the group 314 */ 315 function group(name, fn) { 316 return __awaiter(this, void 0, void 0, function* () { 317 startGroup(name); 318 let result; 319 try { 320 result = yield fn(); 321 } 322 finally { 323 endGroup(); 324 } 325 return result; 326 }); 327 } 328 exports.group = group; 329 //----------------------------------------------------------------------- 330 // Wrapper action state 331 //----------------------------------------------------------------------- 332 /** 333 * Saves state for current action, the state can only be retrieved by this action's post job execution. 334 * 335 * @param name name of the state to store 336 * @param value value to store. Non-string values will be converted to a string via JSON.stringify 337 */ 338 // eslint-disable-next-line @typescript-eslint/no-explicit-any 339 function saveState(name, value) { 340 command_1.issueCommand('save-state', { name }, value); 341 } 342 exports.saveState = saveState; 343 /** 344 * Gets the value of an state set by this action's main execution. 345 * 346 * @param name name of the state to get 347 * @returns string 348 */ 349 function getState(name) { 350 return process.env[`STATE_${name}`] || ''; 351 } 352 exports.getState = getState; 353 //# sourceMappingURL=core.js.map 354 355 /***/ }), 356 357 /***/ 717: 358 /***/ (function(__unused_webpack_module, exports, __webpack_require__) { 359 360 "use strict"; 361 362 // For internal use, subject to change. 363 var __importStar = (this && this.__importStar) || function (mod) { 364 if (mod && mod.__esModule) return mod; 365 var result = {}; 366 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 367 result["default"] = mod; 368 return result; 369 }; 370 Object.defineProperty(exports, "__esModule", ({ value: true })); 371 // We use any as a valid input type 372 /* eslint-disable @typescript-eslint/no-explicit-any */ 373 const fs = __importStar(__webpack_require__(747)); 374 const os = __importStar(__webpack_require__(87)); 375 const utils_1 = __webpack_require__(278); 376 function issueCommand(command, message) { 377 const filePath = process.env[`GITHUB_${command}`]; 378 if (!filePath) { 379 throw new Error(`Unable to find environment variable for file command ${command}`); 380 } 381 if (!fs.existsSync(filePath)) { 382 throw new Error(`Missing file at path: ${filePath}`); 383 } 384 fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { 385 encoding: 'utf8' 386 }); 387 } 388 exports.issueCommand = issueCommand; 389 //# sourceMappingURL=file-command.js.map 390 391 /***/ }), 392 393 /***/ 278: 394 /***/ ((__unused_webpack_module, exports) => { 395 396 "use strict"; 397 398 // We use any as a valid input type 399 /* eslint-disable @typescript-eslint/no-explicit-any */ 400 Object.defineProperty(exports, "__esModule", ({ value: true })); 401 /** 402 * Sanitizes an input into a string so it can be passed into issueCommand safely 403 * @param input input to sanitize into a string 404 */ 405 function toCommandValue(input) { 406 if (input === null || input === undefined) { 407 return ''; 408 } 409 else if (typeof input === 'string' || input instanceof String) { 410 return input; 411 } 412 return JSON.stringify(input); 413 } 414 exports.toCommandValue = toCommandValue; 415 //# sourceMappingURL=utils.js.map 416 417 /***/ }), 418 419 /***/ 53: 420 /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 421 422 "use strict"; 423 424 Object.defineProperty(exports, "__esModule", ({ value: true })); 425 exports.Context = void 0; 426 const fs_1 = __webpack_require__(747); 427 const os_1 = __webpack_require__(87); 428 class Context { 429 /** 430 * Hydrate the context from the environment 431 */ 432 constructor() { 433 this.payload = {}; 434 if (process.env.GITHUB_EVENT_PATH) { 435 if (fs_1.existsSync(process.env.GITHUB_EVENT_PATH)) { 436 this.payload = JSON.parse(fs_1.readFileSync(process.env.GITHUB_EVENT_PATH, { encoding: 'utf8' })); 437 } 438 else { 439 const path = process.env.GITHUB_EVENT_PATH; 440 process.stdout.write(`GITHUB_EVENT_PATH ${path} does not exist${os_1.EOL}`); 441 } 442 } 443 this.eventName = process.env.GITHUB_EVENT_NAME; 444 this.sha = process.env.GITHUB_SHA; 445 this.ref = process.env.GITHUB_REF; 446 this.workflow = process.env.GITHUB_WORKFLOW; 447 this.action = process.env.GITHUB_ACTION; 448 this.actor = process.env.GITHUB_ACTOR; 449 this.job = process.env.GITHUB_JOB; 450 this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10); 451 this.runId = parseInt(process.env.GITHUB_RUN_ID, 10); 452 } 453 get issue() { 454 const payload = this.payload; 455 return Object.assign(Object.assign({}, this.repo), { number: (payload.issue || payload.pull_request || payload).number }); 456 } 457 get repo() { 458 if (process.env.GITHUB_REPOSITORY) { 459 const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/'); 460 return { owner, repo }; 461 } 462 if (this.payload.repository) { 463 return { 464 owner: this.payload.repository.owner.login, 465 repo: this.payload.repository.name 466 }; 467 } 468 throw new Error("context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'"); 469 } 470 } 471 exports.Context = Context; 472 //# sourceMappingURL=context.js.map 473 474 /***/ }), 475 476 /***/ 438: 477 /***/ (function(__unused_webpack_module, exports, __webpack_require__) { 478 479 "use strict"; 480 481 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 482 if (k2 === undefined) k2 = k; 483 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 484 }) : (function(o, m, k, k2) { 485 if (k2 === undefined) k2 = k; 486 o[k2] = m[k]; 487 })); 488 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 489 Object.defineProperty(o, "default", { enumerable: true, value: v }); 490 }) : function(o, v) { 491 o["default"] = v; 492 }); 493 var __importStar = (this && this.__importStar) || function (mod) { 494 if (mod && mod.__esModule) return mod; 495 var result = {}; 496 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 497 __setModuleDefault(result, mod); 498 return result; 499 }; 500 Object.defineProperty(exports, "__esModule", ({ value: true })); 501 exports.getOctokit = exports.context = void 0; 502 const Context = __importStar(__webpack_require__(53)); 503 const utils_1 = __webpack_require__(30); 504 exports.context = new Context.Context(); 505 /** 506 * Returns a hydrated octokit ready to use for GitHub Actions 507 * 508 * @param token the repo PAT or GITHUB_TOKEN 509 * @param options other options to set 510 */ 511 function getOctokit(token, options) { 512 return new utils_1.GitHub(utils_1.getOctokitOptions(token, options)); 513 } 514 exports.getOctokit = getOctokit; 515 //# sourceMappingURL=github.js.map 516 517 /***/ }), 518 519 /***/ 914: 520 /***/ (function(__unused_webpack_module, exports, __webpack_require__) { 521 522 "use strict"; 523 524 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 525 if (k2 === undefined) k2 = k; 526 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 527 }) : (function(o, m, k, k2) { 528 if (k2 === undefined) k2 = k; 529 o[k2] = m[k]; 530 })); 531 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 532 Object.defineProperty(o, "default", { enumerable: true, value: v }); 533 }) : function(o, v) { 534 o["default"] = v; 535 }); 536 var __importStar = (this && this.__importStar) || function (mod) { 537 if (mod && mod.__esModule) return mod; 538 var result = {}; 539 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 540 __setModuleDefault(result, mod); 541 return result; 542 }; 543 Object.defineProperty(exports, "__esModule", ({ value: true })); 544 exports.getApiBaseUrl = exports.getProxyAgent = exports.getAuthString = void 0; 545 const httpClient = __importStar(__webpack_require__(925)); 546 function getAuthString(token, options) { 547 if (!token && !options.auth) { 548 throw new Error('Parameter token or opts.auth is required'); 549 } 550 else if (token && options.auth) { 551 throw new Error('Parameters token and opts.auth may not both be specified'); 552 } 553 return typeof options.auth === 'string' ? options.auth : `token ${token}`; 554 } 555 exports.getAuthString = getAuthString; 556 function getProxyAgent(destinationUrl) { 557 const hc = new httpClient.HttpClient(); 558 return hc.getAgent(destinationUrl); 559 } 560 exports.getProxyAgent = getProxyAgent; 561 function getApiBaseUrl() { 562 return process.env['GITHUB_API_URL'] || 'https://api.github.com'; 563 } 564 exports.getApiBaseUrl = getApiBaseUrl; 565 //# sourceMappingURL=utils.js.map 566 567 /***/ }), 568 569 /***/ 30: 570 /***/ (function(__unused_webpack_module, exports, __webpack_require__) { 571 572 "use strict"; 573 574 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 575 if (k2 === undefined) k2 = k; 576 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 577 }) : (function(o, m, k, k2) { 578 if (k2 === undefined) k2 = k; 579 o[k2] = m[k]; 580 })); 581 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 582 Object.defineProperty(o, "default", { enumerable: true, value: v }); 583 }) : function(o, v) { 584 o["default"] = v; 585 }); 586 var __importStar = (this && this.__importStar) || function (mod) { 587 if (mod && mod.__esModule) return mod; 588 var result = {}; 589 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 590 __setModuleDefault(result, mod); 591 return result; 592 }; 593 Object.defineProperty(exports, "__esModule", ({ value: true })); 594 exports.getOctokitOptions = exports.GitHub = exports.context = void 0; 595 const Context = __importStar(__webpack_require__(53)); 596 const Utils = __importStar(__webpack_require__(914)); 597 // octokit + plugins 598 const core_1 = __webpack_require__(762); 599 const plugin_rest_endpoint_methods_1 = __webpack_require__(44); 600 const plugin_paginate_rest_1 = __webpack_require__(193); 601 exports.context = new Context.Context(); 602 const baseUrl = Utils.getApiBaseUrl(); 603 const defaults = { 604 baseUrl, 605 request: { 606 agent: Utils.getProxyAgent(baseUrl) 607 } 608 }; 609 exports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(defaults); 610 /** 611 * Convience function to correctly format Octokit Options to pass into the constructor. 612 * 613 * @param token the repo PAT or GITHUB_TOKEN 614 * @param options other options to set 615 */ 616 function getOctokitOptions(token, options) { 617 const opts = Object.assign({}, options || {}); // Shallow clone - don't mutate the object provided by the caller 618 // Auth 619 const auth = Utils.getAuthString(token, opts); 620 if (auth) { 621 opts.auth = auth; 622 } 623 return opts; 624 } 625 exports.getOctokitOptions = getOctokitOptions; 626 //# sourceMappingURL=utils.js.map 627 628 /***/ }), 629 630 /***/ 925: 631 /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 632 633 "use strict"; 634 635 Object.defineProperty(exports, "__esModule", ({ value: true })); 636 const url = __webpack_require__(835); 637 const http = __webpack_require__(605); 638 const https = __webpack_require__(211); 639 const pm = __webpack_require__(443); 640 let tunnel; 641 var HttpCodes; 642 (function (HttpCodes) { 643 HttpCodes[HttpCodes["OK"] = 200] = "OK"; 644 HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; 645 HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; 646 HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; 647 HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; 648 HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; 649 HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; 650 HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; 651 HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; 652 HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; 653 HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; 654 HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; 655 HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; 656 HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; 657 HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; 658 HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; 659 HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; 660 HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; 661 HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; 662 HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; 663 HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; 664 HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; 665 HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; 666 HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; 667 HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; 668 HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; 669 HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; 670 })(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); 671 var Headers; 672 (function (Headers) { 673 Headers["Accept"] = "accept"; 674 Headers["ContentType"] = "content-type"; 675 })(Headers = exports.Headers || (exports.Headers = {})); 676 var MediaTypes; 677 (function (MediaTypes) { 678 MediaTypes["ApplicationJson"] = "application/json"; 679 })(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); 680 /** 681 * Returns the proxy URL, depending upon the supplied url and proxy environment variables. 682 * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com 683 */ 684 function getProxyUrl(serverUrl) { 685 let proxyUrl = pm.getProxyUrl(url.parse(serverUrl)); 686 return proxyUrl ? proxyUrl.href : ''; 687 } 688 exports.getProxyUrl = getProxyUrl; 689 const HttpRedirectCodes = [ 690 HttpCodes.MovedPermanently, 691 HttpCodes.ResourceMoved, 692 HttpCodes.SeeOther, 693 HttpCodes.TemporaryRedirect, 694 HttpCodes.PermanentRedirect 695 ]; 696 const HttpResponseRetryCodes = [ 697 HttpCodes.BadGateway, 698 HttpCodes.ServiceUnavailable, 699 HttpCodes.GatewayTimeout 700 ]; 701 const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; 702 const ExponentialBackoffCeiling = 10; 703 const ExponentialBackoffTimeSlice = 5; 704 class HttpClientResponse { 705 constructor(message) { 706 this.message = message; 707 } 708 readBody() { 709 return new Promise(async (resolve, reject) => { 710 let output = Buffer.alloc(0); 711 this.message.on('data', (chunk) => { 712 output = Buffer.concat([output, chunk]); 713 }); 714 this.message.on('end', () => { 715 resolve(output.toString()); 716 }); 717 }); 718 } 719 } 720 exports.HttpClientResponse = HttpClientResponse; 721 function isHttps(requestUrl) { 722 let parsedUrl = url.parse(requestUrl); 723 return parsedUrl.protocol === 'https:'; 724 } 725 exports.isHttps = isHttps; 726 class HttpClient { 727 constructor(userAgent, handlers, requestOptions) { 728 this._ignoreSslError = false; 729 this._allowRedirects = true; 730 this._allowRedirectDowngrade = false; 731 this._maxRedirects = 50; 732 this._allowRetries = false; 733 this._maxRetries = 1; 734 this._keepAlive = false; 735 this._disposed = false; 736 this.userAgent = userAgent; 737 this.handlers = handlers || []; 738 this.requestOptions = requestOptions; 739 if (requestOptions) { 740 if (requestOptions.ignoreSslError != null) { 741 this._ignoreSslError = requestOptions.ignoreSslError; 742 } 743 this._socketTimeout = requestOptions.socketTimeout; 744 if (requestOptions.allowRedirects != null) { 745 this._allowRedirects = requestOptions.allowRedirects; 746 } 747 if (requestOptions.allowRedirectDowngrade != null) { 748 this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; 749 } 750 if (requestOptions.maxRedirects != null) { 751 this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); 752 } 753 if (requestOptions.keepAlive != null) { 754 this._keepAlive = requestOptions.keepAlive; 755 } 756 if (requestOptions.allowRetries != null) { 757 this._allowRetries = requestOptions.allowRetries; 758 } 759 if (requestOptions.maxRetries != null) { 760 this._maxRetries = requestOptions.maxRetries; 761 } 762 } 763 } 764 options(requestUrl, additionalHeaders) { 765 return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); 766 } 767 get(requestUrl, additionalHeaders) { 768 return this.request('GET', requestUrl, null, additionalHeaders || {}); 769 } 770 del(requestUrl, additionalHeaders) { 771 return this.request('DELETE', requestUrl, null, additionalHeaders || {}); 772 } 773 post(requestUrl, data, additionalHeaders) { 774 return this.request('POST', requestUrl, data, additionalHeaders || {}); 775 } 776 patch(requestUrl, data, additionalHeaders) { 777 return this.request('PATCH', requestUrl, data, additionalHeaders || {}); 778 } 779 put(requestUrl, data, additionalHeaders) { 780 return this.request('PUT', requestUrl, data, additionalHeaders || {}); 781 } 782 head(requestUrl, additionalHeaders) { 783 return this.request('HEAD', requestUrl, null, additionalHeaders || {}); 784 } 785 sendStream(verb, requestUrl, stream, additionalHeaders) { 786 return this.request(verb, requestUrl, stream, additionalHeaders); 787 } 788 /** 789 * Gets a typed object from an endpoint 790 * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise 791 */ 792 async getJson(requestUrl, additionalHeaders = {}) { 793 additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 794 let res = await this.get(requestUrl, additionalHeaders); 795 return this._processResponse(res, this.requestOptions); 796 } 797 async postJson(requestUrl, obj, additionalHeaders = {}) { 798 let data = JSON.stringify(obj, null, 2); 799 additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 800 additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 801 let res = await this.post(requestUrl, data, additionalHeaders); 802 return this._processResponse(res, this.requestOptions); 803 } 804 async putJson(requestUrl, obj, additionalHeaders = {}) { 805 let data = JSON.stringify(obj, null, 2); 806 additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 807 additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 808 let res = await this.put(requestUrl, data, additionalHeaders); 809 return this._processResponse(res, this.requestOptions); 810 } 811 async patchJson(requestUrl, obj, additionalHeaders = {}) { 812 let data = JSON.stringify(obj, null, 2); 813 additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); 814 additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); 815 let res = await this.patch(requestUrl, data, additionalHeaders); 816 return this._processResponse(res, this.requestOptions); 817 } 818 /** 819 * Makes a raw http request. 820 * All other methods such as get, post, patch, and request ultimately call this. 821 * Prefer get, del, post and patch 822 */ 823 async request(verb, requestUrl, data, headers) { 824 if (this._disposed) { 825 throw new Error('Client has already been disposed.'); 826 } 827 let parsedUrl = url.parse(requestUrl); 828 let info = this._prepareRequest(verb, parsedUrl, headers); 829 // Only perform retries on reads since writes may not be idempotent. 830 let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1 831 ? this._maxRetries + 1 832 : 1; 833 let numTries = 0; 834 let response; 835 while (numTries < maxTries) { 836 response = await this.requestRaw(info, data); 837 // Check if it's an authentication challenge 838 if (response && 839 response.message && 840 response.message.statusCode === HttpCodes.Unauthorized) { 841 let authenticationHandler; 842 for (let i = 0; i < this.handlers.length; i++) { 843 if (this.handlers[i].canHandleAuthentication(response)) { 844 authenticationHandler = this.handlers[i]; 845 break; 846 } 847 } 848 if (authenticationHandler) { 849 return authenticationHandler.handleAuthentication(this, info, data); 850 } 851 else { 852 // We have received an unauthorized response but have no handlers to handle it. 853 // Let the response return to the caller. 854 return response; 855 } 856 } 857 let redirectsRemaining = this._maxRedirects; 858 while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 && 859 this._allowRedirects && 860 redirectsRemaining > 0) { 861 const redirectUrl = response.message.headers['location']; 862 if (!redirectUrl) { 863 // if there's no location to redirect to, we won't 864 break; 865 } 866 let parsedRedirectUrl = url.parse(redirectUrl); 867 if (parsedUrl.protocol == 'https:' && 868 parsedUrl.protocol != parsedRedirectUrl.protocol && 869 !this._allowRedirectDowngrade) { 870 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.'); 871 } 872 // we need to finish reading the response before reassigning response 873 // which will leak the open socket. 874 await response.readBody(); 875 // strip authorization header if redirected to a different hostname 876 if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { 877 for (let header in headers) { 878 // header names are case insensitive 879 if (header.toLowerCase() === 'authorization') { 880 delete headers[header]; 881 } 882 } 883 } 884 // let's make the request with the new redirectUrl 885 info = this._prepareRequest(verb, parsedRedirectUrl, headers); 886 response = await this.requestRaw(info, data); 887 redirectsRemaining--; 888 } 889 if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) { 890 // If not a retry code, return immediately instead of retrying 891 return response; 892 } 893 numTries += 1; 894 if (numTries < maxTries) { 895 await response.readBody(); 896 await this._performExponentialBackoff(numTries); 897 } 898 } 899 return response; 900 } 901 /** 902 * Needs to be called if keepAlive is set to true in request options. 903 */ 904 dispose() { 905 if (this._agent) { 906 this._agent.destroy(); 907 } 908 this._disposed = true; 909 } 910 /** 911 * Raw request. 912 * @param info 913 * @param data 914 */ 915 requestRaw(info, data) { 916 return new Promise((resolve, reject) => { 917 let callbackForResult = function (err, res) { 918 if (err) { 919 reject(err); 920 } 921 resolve(res); 922 }; 923 this.requestRawWithCallback(info, data, callbackForResult); 924 }); 925 } 926 /** 927 * Raw request with callback. 928 * @param info 929 * @param data 930 * @param onResult 931 */ 932 requestRawWithCallback(info, data, onResult) { 933 let socket; 934 if (typeof data === 'string') { 935 info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); 936 } 937 let callbackCalled = false; 938 let handleResult = (err, res) => { 939 if (!callbackCalled) { 940 callbackCalled = true; 941 onResult(err, res); 942 } 943 }; 944 let req = info.httpModule.request(info.options, (msg) => { 945 let res = new HttpClientResponse(msg); 946 handleResult(null, res); 947 }); 948 req.on('socket', sock => { 949 socket = sock; 950 }); 951 // If we ever get disconnected, we want the socket to timeout eventually 952 req.setTimeout(this._socketTimeout || 3 * 60000, () => { 953 if (socket) { 954 socket.end(); 955 } 956 handleResult(new Error('Request timeout: ' + info.options.path), null); 957 }); 958 req.on('error', function (err) { 959 // err has statusCode property 960 // res should have headers 961 handleResult(err, null); 962 }); 963 if (data && typeof data === 'string') { 964 req.write(data, 'utf8'); 965 } 966 if (data && typeof data !== 'string') { 967 data.on('close', function () { 968 req.end(); 969 }); 970 data.pipe(req); 971 } 972 else { 973 req.end(); 974 } 975 } 976 /** 977 * Gets an http agent. This function is useful when you need an http agent that handles 978 * routing through a proxy server - depending upon the url and proxy environment variables. 979 * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com 980 */ 981 getAgent(serverUrl) { 982 let parsedUrl = url.parse(serverUrl); 983 return this._getAgent(parsedUrl); 984 } 985 _prepareRequest(method, requestUrl, headers) { 986 const info = {}; 987 info.parsedUrl = requestUrl; 988 const usingSsl = info.parsedUrl.protocol === 'https:'; 989 info.httpModule = usingSsl ? https : http; 990 const defaultPort = usingSsl ? 443 : 80; 991 info.options = {}; 992 info.options.host = info.parsedUrl.hostname; 993 info.options.port = info.parsedUrl.port 994 ? parseInt(info.parsedUrl.port) 995 : defaultPort; 996 info.options.path = 997 (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); 998 info.options.method = method; 999 info.options.headers = this._mergeHeaders(headers); 1000 if (this.userAgent != null) { 1001 info.options.headers['user-agent'] = this.userAgent; 1002 } 1003 info.options.agent = this._getAgent(info.parsedUrl); 1004 // gives handlers an opportunity to participate 1005 if (this.handlers) { 1006 this.handlers.forEach(handler => { 1007 handler.prepareRequest(info.options); 1008 }); 1009 } 1010 return info; 1011 } 1012 _mergeHeaders(headers) { 1013 const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); 1014 if (this.requestOptions && this.requestOptions.headers) { 1015 return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers)); 1016 } 1017 return lowercaseKeys(headers || {}); 1018 } 1019 _getExistingOrDefaultHeader(additionalHeaders, header, _default) { 1020 const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); 1021 let clientHeader; 1022 if (this.requestOptions && this.requestOptions.headers) { 1023 clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; 1024 } 1025 return additionalHeaders[header] || clientHeader || _default; 1026 } 1027 _getAgent(parsedUrl) { 1028 let agent; 1029 let proxyUrl = pm.getProxyUrl(parsedUrl); 1030 let useProxy = proxyUrl && proxyUrl.hostname; 1031 if (this._keepAlive && useProxy) { 1032 agent = this._proxyAgent; 1033 } 1034 if (this._keepAlive && !useProxy) { 1035 agent = this._agent; 1036 } 1037 // if agent is already assigned use that agent. 1038 if (!!agent) { 1039 return agent; 1040 } 1041 const usingSsl = parsedUrl.protocol === 'https:'; 1042 let maxSockets = 100; 1043 if (!!this.requestOptions) { 1044 maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; 1045 } 1046 if (useProxy) { 1047 // If using proxy, need tunnel 1048 if (!tunnel) { 1049 tunnel = __webpack_require__(294); 1050 } 1051 const agentOptions = { 1052 maxSockets: maxSockets, 1053 keepAlive: this._keepAlive, 1054 proxy: { 1055 proxyAuth: proxyUrl.auth, 1056 host: proxyUrl.hostname, 1057 port: proxyUrl.port 1058 } 1059 }; 1060 let tunnelAgent; 1061 const overHttps = proxyUrl.protocol === 'https:'; 1062 if (usingSsl) { 1063 tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; 1064 } 1065 else { 1066 tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; 1067 } 1068 agent = tunnelAgent(agentOptions); 1069 this._proxyAgent = agent; 1070 } 1071 // if reusing agent across request and tunneling agent isn't assigned create a new agent 1072 if (this._keepAlive && !agent) { 1073 const options = { keepAlive: this._keepAlive, maxSockets: maxSockets }; 1074 agent = usingSsl ? new https.Agent(options) : new http.Agent(options); 1075 this._agent = agent; 1076 } 1077 // if not using private agent and tunnel agent isn't setup then use global agent 1078 if (!agent) { 1079 agent = usingSsl ? https.globalAgent : http.globalAgent; 1080 } 1081 if (usingSsl && this._ignoreSslError) { 1082 // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process 1083 // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options 1084 // we have to cast it to any and change it directly 1085 agent.options = Object.assign(agent.options || {}, { 1086 rejectUnauthorized: false 1087 }); 1088 } 1089 return agent; 1090 } 1091 _performExponentialBackoff(retryNumber) { 1092 retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); 1093 const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); 1094 return new Promise(resolve => setTimeout(() => resolve(), ms)); 1095 } 1096 static dateTimeDeserializer(key, value) { 1097 if (typeof value === 'string') { 1098 let a = new Date(value); 1099 if (!isNaN(a.valueOf())) { 1100 return a; 1101 } 1102 } 1103 return value; 1104 } 1105 async _processResponse(res, options) { 1106 return new Promise(async (resolve, reject) => { 1107 const statusCode = res.message.statusCode; 1108 const response = { 1109 statusCode: statusCode, 1110 result: null, 1111 headers: {} 1112 }; 1113 // not found leads to null obj returned 1114 if (statusCode == HttpCodes.NotFound) { 1115 resolve(response); 1116 } 1117 let obj; 1118 let contents; 1119 // get the result from the body 1120 try { 1121 contents = await res.readBody(); 1122 if (contents && contents.length > 0) { 1123 if (options && options.deserializeDates) { 1124 obj = JSON.parse(contents, HttpClient.dateTimeDeserializer); 1125 } 1126 else { 1127 obj = JSON.parse(contents); 1128 } 1129 response.result = obj; 1130 } 1131 response.headers = res.message.headers; 1132 } 1133 catch (err) { 1134 // Invalid resource (contents not json); leaving result obj null 1135 } 1136 // note that 3xx redirects are handled by the http layer. 1137 if (statusCode > 299) { 1138 let msg; 1139 // if exception/error in body, attempt to get better error 1140 if (obj && obj.message) { 1141 msg = obj.message; 1142 } 1143 else if (contents && contents.length > 0) { 1144 // it may be the case that the exception is in the body message as string 1145 msg = contents; 1146 } 1147 else { 1148 msg = 'Failed request: (' + statusCode + ')'; 1149 } 1150 let err = new Error(msg); 1151 // attach statusCode and body obj (if available) to the error object 1152 err['statusCode'] = statusCode; 1153 if (response.result) { 1154 err['result'] = response.result; 1155 } 1156 reject(err); 1157 } 1158 else { 1159 resolve(response); 1160 } 1161 }); 1162 } 1163 } 1164 exports.HttpClient = HttpClient; 1165 1166 1167 /***/ }), 1168 1169 /***/ 443: 1170 /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 1171 1172 "use strict"; 1173 1174 Object.defineProperty(exports, "__esModule", ({ value: true })); 1175 const url = __webpack_require__(835); 1176 function getProxyUrl(reqUrl) { 1177 let usingSsl = reqUrl.protocol === 'https:'; 1178 let proxyUrl; 1179 if (checkBypass(reqUrl)) { 1180 return proxyUrl; 1181 } 1182 let proxyVar; 1183 if (usingSsl) { 1184 proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY']; 1185 } 1186 else { 1187 proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY']; 1188 } 1189 if (proxyVar) { 1190 proxyUrl = url.parse(proxyVar); 1191 } 1192 return proxyUrl; 1193 } 1194 exports.getProxyUrl = getProxyUrl; 1195 function checkBypass(reqUrl) { 1196 if (!reqUrl.hostname) { 1197 return false; 1198 } 1199 let noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; 1200 if (!noProxy) { 1201 return false; 1202 } 1203 // Determine the request port 1204 let reqPort; 1205 if (reqUrl.port) { 1206 reqPort = Number(reqUrl.port); 1207 } 1208 else if (reqUrl.protocol === 'http:') { 1209 reqPort = 80; 1210 } 1211 else if (reqUrl.protocol === 'https:') { 1212 reqPort = 443; 1213 } 1214 // Format the request hostname and hostname with port 1215 let upperReqHosts = [reqUrl.hostname.toUpperCase()]; 1216 if (typeof reqPort === 'number') { 1217 upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); 1218 } 1219 // Compare request host against noproxy 1220 for (let upperNoProxyItem of noProxy 1221 .split(',') 1222 .map(x => x.trim().toUpperCase()) 1223 .filter(x => x)) { 1224 if (upperReqHosts.some(x => x === upperNoProxyItem)) { 1225 return true; 1226 } 1227 } 1228 return false; 1229 } 1230 exports.checkBypass = checkBypass; 1231 1232 1233 /***/ }), 1234 1235 /***/ 334: 1236 /***/ ((__unused_webpack_module, exports) => { 1237 1238 "use strict"; 1239 1240 1241 Object.defineProperty(exports, "__esModule", ({ value: true })); 1242 1243 async function auth(token) { 1244 const tokenType = token.split(/\./).length === 3 ? "app" : /^v\d+\./.test(token) ? "installation" : "oauth"; 1245 return { 1246 type: "token", 1247 token: token, 1248 tokenType 1249 }; 1250 } 1251 1252 /** 1253 * Prefix token for usage in the Authorization header 1254 * 1255 * @param token OAuth token or JSON Web Token 1256 */ 1257 function withAuthorizationPrefix(token) { 1258 if (token.split(/\./).length === 3) { 1259 return `bearer ${token}`; 1260 } 1261 1262 return `token ${token}`; 1263 } 1264 1265 async function hook(token, request, route, parameters) { 1266 const endpoint = request.endpoint.merge(route, parameters); 1267 endpoint.headers.authorization = withAuthorizationPrefix(token); 1268 return request(endpoint); 1269 } 1270 1271 const createTokenAuth = function createTokenAuth(token) { 1272 if (!token) { 1273 throw new Error("[@octokit/auth-token] No token passed to createTokenAuth"); 1274 } 1275 1276 if (typeof token !== "string") { 1277 throw new Error("[@octokit/auth-token] Token passed to createTokenAuth is not a string"); 1278 } 1279 1280 token = token.replace(/^(token|bearer) +/i, ""); 1281 return Object.assign(auth.bind(null, token), { 1282 hook: hook.bind(null, token) 1283 }); 1284 }; 1285 1286 exports.createTokenAuth = createTokenAuth; 1287 //# sourceMappingURL=index.js.map 1288 1289 1290 /***/ }), 1291 1292 /***/ 762: 1293 /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 1294 1295 "use strict"; 1296 1297 1298 Object.defineProperty(exports, "__esModule", ({ value: true })); 1299 1300 var universalUserAgent = __webpack_require__(429); 1301 var beforeAfterHook = __webpack_require__(682); 1302 var request = __webpack_require__(234); 1303 var graphql = __webpack_require__(668); 1304 var authToken = __webpack_require__(334); 1305 1306 function _defineProperty(obj, key, value) { 1307 if (key in obj) { 1308 Object.defineProperty(obj, key, { 1309 value: value, 1310 enumerable: true, 1311 configurable: true, 1312 writable: true 1313 }); 1314 } else { 1315 obj[key] = value; 1316 } 1317 1318 return obj; 1319 } 1320 1321 function ownKeys(object, enumerableOnly) { 1322 var keys = Object.keys(object); 1323 1324 if (Object.getOwnPropertySymbols) { 1325 var symbols = Object.getOwnPropertySymbols(object); 1326 if (enumerableOnly) symbols = symbols.filter(function (sym) { 1327 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 1328 }); 1329 keys.push.apply(keys, symbols); 1330 } 1331 1332 return keys; 1333 } 1334 1335 function _objectSpread2(target) { 1336 for (var i = 1; i < arguments.length; i++) { 1337 var source = arguments[i] != null ? arguments[i] : {}; 1338 1339 if (i % 2) { 1340 ownKeys(Object(source), true).forEach(function (key) { 1341 _defineProperty(target, key, source[key]); 1342 }); 1343 } else if (Object.getOwnPropertyDescriptors) { 1344 Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); 1345 } else { 1346 ownKeys(Object(source)).forEach(function (key) { 1347 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 1348 }); 1349 } 1350 } 1351 1352 return target; 1353 } 1354 1355 const VERSION = "3.1.2"; 1356 1357 class Octokit { 1358 constructor(options = {}) { 1359 const hook = new beforeAfterHook.Collection(); 1360 const requestDefaults = { 1361 baseUrl: request.request.endpoint.DEFAULTS.baseUrl, 1362 headers: {}, 1363 request: Object.assign({}, options.request, { 1364 hook: hook.bind(null, "request") 1365 }), 1366 mediaType: { 1367 previews: [], 1368 format: "" 1369 } 1370 }; // prepend default user agent with `options.userAgent` if set 1371 1372 requestDefaults.headers["user-agent"] = [options.userAgent, `octokit-core.js/${VERSION} ${universalUserAgent.getUserAgent()}`].filter(Boolean).join(" "); 1373 1374 if (options.baseUrl) { 1375 requestDefaults.baseUrl = options.baseUrl; 1376 } 1377 1378 if (options.previews) { 1379 requestDefaults.mediaType.previews = options.previews; 1380 } 1381 1382 if (options.timeZone) { 1383 requestDefaults.headers["time-zone"] = options.timeZone; 1384 } 1385 1386 this.request = request.request.defaults(requestDefaults); 1387 this.graphql = graphql.withCustomRequest(this.request).defaults(_objectSpread2(_objectSpread2({}, requestDefaults), {}, { 1388 baseUrl: requestDefaults.baseUrl.replace(/\/api\/v3$/, "/api") 1389 })); 1390 this.log = Object.assign({ 1391 debug: () => {}, 1392 info: () => {}, 1393 warn: console.warn.bind(console), 1394 error: console.error.bind(console) 1395 }, options.log); 1396 this.hook = hook; // (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance 1397 // is unauthenticated. The `this.auth()` method is a no-op and no request hook is registred. 1398 // (2) If only `options.auth` is set, use the default token authentication strategy. 1399 // (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. 1400 // TODO: type `options.auth` based on `options.authStrategy`. 1401 1402 if (!options.authStrategy) { 1403 if (!options.auth) { 1404 // (1) 1405 this.auth = async () => ({ 1406 type: "unauthenticated" 1407 }); 1408 } else { 1409 // (2) 1410 const auth = authToken.createTokenAuth(options.auth); // @ts-ignore ¯\_(ツ)_/¯ 1411 1412 hook.wrap("request", auth.hook); 1413 this.auth = auth; 1414 } 1415 } else { 1416 const auth = options.authStrategy(Object.assign({ 1417 request: this.request 1418 }, options.auth)); // @ts-ignore ¯\_(ツ)_/¯ 1419 1420 hook.wrap("request", auth.hook); 1421 this.auth = auth; 1422 } // apply plugins 1423 // https://stackoverflow.com/a/16345172 1424 1425 1426 const classConstructor = this.constructor; 1427 classConstructor.plugins.forEach(plugin => { 1428 Object.assign(this, plugin(this, options)); 1429 }); 1430 } 1431 1432 static defaults(defaults) { 1433 const OctokitWithDefaults = class extends this { 1434 constructor(...args) { 1435 const options = args[0] || {}; 1436 1437 if (typeof defaults === "function") { 1438 super(defaults(options)); 1439 return; 1440 } 1441 1442 super(Object.assign({}, defaults, options, options.userAgent && defaults.userAgent ? { 1443 userAgent: `${options.userAgent} ${defaults.userAgent}` 1444 } : null)); 1445 } 1446 1447 }; 1448 return OctokitWithDefaults; 1449 } 1450 /** 1451 * Attach a plugin (or many) to your Octokit instance. 1452 * 1453 * @example 1454 * const API = Octokit.plugin(plugin1, plugin2, plugin3, ...) 1455 */ 1456 1457 1458 static plugin(...newPlugins) { 1459 var _a; 1460 1461 const currentPlugins = this.plugins; 1462 const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a); 1463 return NewOctokit; 1464 } 1465 1466 } 1467 Octokit.VERSION = VERSION; 1468 Octokit.plugins = []; 1469 1470 exports.Octokit = Octokit; 1471 //# sourceMappingURL=index.js.map 1472 1473 1474 /***/ }), 1475 1476 /***/ 440: 1477 /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 1478 1479 "use strict"; 1480 1481 1482 Object.defineProperty(exports, "__esModule", ({ value: true })); 1483 1484 var isPlainObject = __webpack_require__(287); 1485 var universalUserAgent = __webpack_require__(429); 1486 1487 function lowercaseKeys(object) { 1488 if (!object) { 1489 return {}; 1490 } 1491 1492 return Object.keys(object).reduce((newObj, key) => { 1493 newObj[key.toLowerCase()] = object[key]; 1494 return newObj; 1495 }, {}); 1496 } 1497 1498 function mergeDeep(defaults, options) { 1499 const result = Object.assign({}, defaults); 1500 Object.keys(options).forEach(key => { 1501 if (isPlainObject.isPlainObject(options[key])) { 1502 if (!(key in defaults)) Object.assign(result, { 1503 [key]: options[key] 1504 });else result[key] = mergeDeep(defaults[key], options[key]); 1505 } else { 1506 Object.assign(result, { 1507 [key]: options[key] 1508 }); 1509 } 1510 }); 1511 return result; 1512 } 1513 1514 function merge(defaults, route, options) { 1515 if (typeof route === "string") { 1516 let [method, url] = route.split(" "); 1517 options = Object.assign(url ? { 1518 method, 1519 url 1520 } : { 1521 url: method 1522 }, options); 1523 } else { 1524 options = Object.assign({}, route); 1525 } // lowercase header names before merging with defaults to avoid duplicates 1526 1527 1528 options.headers = lowercaseKeys(options.headers); 1529 const mergedOptions = mergeDeep(defaults || {}, options); // mediaType.previews arrays are merged, instead of overwritten 1530 1531 if (defaults && defaults.mediaType.previews.length) { 1532 mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(preview => !mergedOptions.mediaType.previews.includes(preview)).concat(mergedOptions.mediaType.previews); 1533 } 1534 1535 mergedOptions.mediaType.previews = mergedOptions.mediaType.previews.map(preview => preview.replace(/-preview/, "")); 1536 return mergedOptions; 1537 } 1538 1539 function addQueryParameters(url, parameters) { 1540 const separator = /\?/.test(url) ? "&" : "?"; 1541 const names = Object.keys(parameters); 1542 1543 if (names.length === 0) { 1544 return url; 1545 } 1546 1547 return url + separator + names.map(name => { 1548 if (name === "q") { 1549 return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); 1550 } 1551 1552 return `${name}=${encodeURIComponent(parameters[name])}`; 1553 }).join("&"); 1554 } 1555 1556 const urlVariableRegex = /\{[^}]+\}/g; 1557 1558 function removeNonChars(variableName) { 1559 return variableName.replace(/^\W+|\W+$/g, "").split(/,/); 1560 } 1561 1562 function extractUrlVariableNames(url) { 1563 const matches = url.match(urlVariableRegex); 1564 1565 if (!matches) { 1566 return []; 1567 } 1568 1569 return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []); 1570 } 1571 1572 function omit(object, keysToOmit) { 1573 return Object.keys(object).filter(option => !keysToOmit.includes(option)).reduce((obj, key) => { 1574 obj[key] = object[key]; 1575 return obj; 1576 }, {}); 1577 } 1578 1579 // Based on https://github.com/bramstein/url-template, licensed under BSD 1580 // TODO: create separate package. 1581 // 1582 // Copyright (c) 2012-2014, Bram Stein 1583 // All rights reserved. 1584 // Redistribution and use in source and binary forms, with or without 1585 // modification, are permitted provided that the following conditions 1586 // are met: 1587 // 1. Redistributions of source code must retain the above copyright 1588 // notice, this list of conditions and the following disclaimer. 1589 // 2. Redistributions in binary form must reproduce the above copyright 1590 // notice, this list of conditions and the following disclaimer in the 1591 // documentation and/or other materials provided with the distribution. 1592 // 3. The name of the author may not be used to endorse or promote products 1593 // derived from this software without specific prior written permission. 1594 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 1595 // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1596 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 1597 // EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 1598 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 1599 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1600 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 1601 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 1602 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 1603 // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1604 1605 /* istanbul ignore file */ 1606 function encodeReserved(str) { 1607 return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) { 1608 if (!/%[0-9A-Fa-f]/.test(part)) { 1609 part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); 1610 } 1611 1612 return part; 1613 }).join(""); 1614 } 1615 1616 function encodeUnreserved(str) { 1617 return encodeURIComponent(str).replace(/[!'()*]/g, function (c) { 1618 return "%" + c.charCodeAt(0).toString(16).toUpperCase(); 1619 }); 1620 } 1621 1622 function encodeValue(operator, value, key) { 1623 value = operator === "+" || operator === "#" ? encodeReserved(value) : encodeUnreserved(value); 1624 1625 if (key) { 1626 return encodeUnreserved(key) + "=" + value; 1627 } else { 1628 return value; 1629 } 1630 } 1631 1632 function isDefined(value) { 1633 return value !== undefined && value !== null; 1634 } 1635 1636 function isKeyOperator(operator) { 1637 return operator === ";" || operator === "&" || operator === "?"; 1638 } 1639 1640 function getValues(context, operator, key, modifier) { 1641 var value = context[key], 1642 result = []; 1643 1644 if (isDefined(value) && value !== "") { 1645 if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { 1646 value = value.toString(); 1647 1648 if (modifier && modifier !== "*") { 1649 value = value.substring(0, parseInt(modifier, 10)); 1650 } 1651 1652 result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : "")); 1653 } else { 1654 if (modifier === "*") { 1655 if (Array.isArray(value)) { 1656 value.filter(isDefined).forEach(function (value) { 1657 result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : "")); 1658 }); 1659 } else { 1660 Object.keys(value).forEach(function (k) { 1661 if (isDefined(value[k])) { 1662 result.push(encodeValue(operator, value[k], k)); 1663 } 1664 }); 1665 } 1666 } else { 1667 const tmp = []; 1668 1669 if (Array.isArray(value)) { 1670 value.filter(isDefined).forEach(function (value) { 1671 tmp.push(encodeValue(operator, value)); 1672 }); 1673 } else { 1674 Object.keys(value).forEach(function (k) { 1675 if (isDefined(value[k])) { 1676 tmp.push(encodeUnreserved(k)); 1677 tmp.push(encodeValue(operator, value[k].toString())); 1678 } 1679 }); 1680 } 1681 1682 if (isKeyOperator(operator)) { 1683 result.push(encodeUnreserved(key) + "=" + tmp.join(",")); 1684 } else if (tmp.length !== 0) { 1685 result.push(tmp.join(",")); 1686 } 1687 } 1688 } 1689 } else { 1690 if (operator === ";") { 1691 if (isDefined(value)) { 1692 result.push(encodeUnreserved(key)); 1693 } 1694 } else if (value === "" && (operator === "&" || operator === "?")) { 1695 result.push(encodeUnreserved(key) + "="); 1696 } else if (value === "") { 1697 result.push(""); 1698 } 1699 } 1700 1701 return result; 1702 } 1703 1704 function parseUrl(template) { 1705 return { 1706 expand: expand.bind(null, template) 1707 }; 1708 } 1709 1710 function expand(template, context) { 1711 var operators = ["+", "#", ".", "/", ";", "?", "&"]; 1712 return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function (_, expression, literal) { 1713 if (expression) { 1714 let operator = ""; 1715 const values = []; 1716 1717 if (operators.indexOf(expression.charAt(0)) !== -1) { 1718 operator = expression.charAt(0); 1719 expression = expression.substr(1); 1720 } 1721 1722 expression.split(/,/g).forEach(function (variable) { 1723 var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); 1724 values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3])); 1725 }); 1726 1727 if (operator && operator !== "+") { 1728 var separator = ","; 1729 1730 if (operator === "?") { 1731 separator = "&"; 1732 } else if (operator !== "#") { 1733 separator = operator; 1734 } 1735 1736 return (values.length !== 0 ? operator : "") + values.join(separator); 1737 } else { 1738 return values.join(","); 1739 } 1740 } else { 1741 return encodeReserved(literal); 1742 } 1743 }); 1744 } 1745 1746 function parse(options) { 1747 // https://fetch.spec.whatwg.org/#methods 1748 let method = options.method.toUpperCase(); // replace :varname with {varname} to make it RFC 6570 compatible 1749 1750 let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{+$1}"); 1751 let headers = Object.assign({}, options.headers); 1752 let body; 1753 let parameters = omit(options, ["method", "baseUrl", "url", "headers", "request", "mediaType"]); // extract variable names from URL to calculate remaining variables later 1754 1755 const urlVariableNames = extractUrlVariableNames(url); 1756 url = parseUrl(url).expand(parameters); 1757 1758 if (!/^http/.test(url)) { 1759 url = options.baseUrl + url; 1760 } 1761 1762 const omittedParameters = Object.keys(options).filter(option => urlVariableNames.includes(option)).concat("baseUrl"); 1763 const remainingParameters = omit(parameters, omittedParameters); 1764 const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); 1765 1766 if (!isBinaryRequest) { 1767 if (options.mediaType.format) { 1768 // e.g. application/vnd.github.v3+json => application/vnd.github.v3.raw 1769 headers.accept = headers.accept.split(/,/).map(preview => preview.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, `application/vnd$1$2.${options.mediaType.format}`)).join(","); 1770 } 1771 1772 if (options.mediaType.previews.length) { 1773 const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; 1774 headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map(preview => { 1775 const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; 1776 return `application/vnd.github.${preview}-preview${format}`; 1777 }).join(","); 1778 } 1779 } // for GET/HEAD requests, set URL query parameters from remaining parameters 1780 // for PATCH/POST/PUT/DELETE requests, set request body from remaining parameters 1781 1782 1783 if (["GET", "HEAD"].includes(method)) { 1784 url = addQueryParameters(url, remainingParameters); 1785 } else { 1786 if ("data" in remainingParameters) { 1787 body = remainingParameters.data; 1788 } else { 1789 if (Object.keys(remainingParameters).length) { 1790 body = remainingParameters; 1791 } else { 1792 headers["content-length"] = 0; 1793 } 1794 } 1795 } // default content-type for JSON if body is set 1796 1797 1798 if (!headers["content-type"] && typeof body !== "undefined") { 1799 headers["content-type"] = "application/json; charset=utf-8"; 1800 } // GitHub expects 'content-length: 0' header for PUT/PATCH requests without body. 1801 // fetch does not allow to set `content-length` header, but we can set body to an empty string 1802 1803 1804 if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { 1805 body = ""; 1806 } // Only return body/request keys if present 1807 1808 1809 return Object.assign({ 1810 method, 1811 url, 1812 headers 1813 }, typeof body !== "undefined" ? { 1814 body 1815 } : null, options.request ? { 1816 request: options.request 1817 } : null); 1818 } 1819 1820 function endpointWithDefaults(defaults, route, options) { 1821 return parse(merge(defaults, route, options)); 1822 } 1823 1824 function withDefaults(oldDefaults, newDefaults) { 1825 const DEFAULTS = merge(oldDefaults, newDefaults); 1826 const endpoint = endpointWithDefaults.bind(null, DEFAULTS); 1827 return Object.assign(endpoint, { 1828 DEFAULTS, 1829 defaults: withDefaults.bind(null, DEFAULTS), 1830 merge: merge.bind(null, DEFAULTS), 1831 parse 1832 }); 1833 } 1834 1835 const VERSION = "6.0.6"; 1836 1837 const userAgent = `octokit-endpoint.js/${VERSION} ${universalUserAgent.getUserAgent()}`; // DEFAULTS has all properties set that EndpointOptions has, except url. 1838 // So we use RequestParameters and add method as additional required property. 1839 1840 const DEFAULTS = { 1841 method: "GET", 1842 baseUrl: "https://api.github.com", 1843 headers: { 1844 accept: "application/vnd.github.v3+json", 1845 "user-agent": userAgent 1846 }, 1847 mediaType: { 1848 format: "", 1849 previews: [] 1850 } 1851 }; 1852 1853 const endpoint = withDefaults(null, DEFAULTS); 1854 1855 exports.endpoint = endpoint; 1856 //# sourceMappingURL=index.js.map 1857 1858 1859 /***/ }), 1860 1861 /***/ 668: 1862 /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 1863 1864 "use strict"; 1865 1866 1867 Object.defineProperty(exports, "__esModule", ({ value: true })); 1868 1869 var request = __webpack_require__(234); 1870 var universalUserAgent = __webpack_require__(429); 1871 1872 const VERSION = "4.5.6"; 1873 1874 class GraphqlError extends Error { 1875 constructor(request, response) { 1876 const message = response.data.errors[0].message; 1877 super(message); 1878 Object.assign(this, response.data); 1879 Object.assign(this, { 1880 headers: response.headers 1881 }); 1882 this.name = "GraphqlError"; 1883 this.request = request; // Maintains proper stack trace (only available on V8) 1884 1885 /* istanbul ignore next */ 1886 1887 if (Error.captureStackTrace) { 1888 Error.captureStackTrace(this, this.constructor); 1889 } 1890 } 1891 1892 } 1893 1894 const NON_VARIABLE_OPTIONS = ["method", "baseUrl", "url", "headers", "request", "query", "mediaType"]; 1895 const GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/; 1896 function graphql(request, query, options) { 1897 if (typeof query === "string" && options && "query" in options) { 1898 return Promise.reject(new Error(`[@octokit/graphql] "query" cannot be used as variable name`)); 1899 } 1900 1901 const parsedOptions = typeof query === "string" ? Object.assign({ 1902 query 1903 }, options) : query; 1904 const requestOptions = Object.keys(parsedOptions).reduce((result, key) => { 1905 if (NON_VARIABLE_OPTIONS.includes(key)) { 1906 result[key] = parsedOptions[key]; 1907 return result; 1908 } 1909 1910 if (!result.variables) { 1911 result.variables = {}; 1912 } 1913 1914 result.variables[key] = parsedOptions[key]; 1915 return result; 1916 }, {}); // workaround for GitHub Enterprise baseUrl set with /api/v3 suffix 1917 // https://github.com/octokit/auth-app.js/issues/111#issuecomment-657610451 1918 1919 const baseUrl = parsedOptions.baseUrl || request.endpoint.DEFAULTS.baseUrl; 1920 1921 if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) { 1922 requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql"); 1923 } 1924 1925 return request(requestOptions).then(response => { 1926 if (response.data.errors) { 1927 const headers = {}; 1928 1929 for (const key of Object.keys(response.headers)) { 1930 headers[key] = response.headers[key]; 1931 } 1932 1933 throw new GraphqlError(requestOptions, { 1934 headers, 1935 data: response.data 1936 }); 1937 } 1938 1939 return response.data.data; 1940 }); 1941 } 1942 1943 function withDefaults(request$1, newDefaults) { 1944 const newRequest = request$1.defaults(newDefaults); 1945 1946 const newApi = (query, options) => { 1947 return graphql(newRequest, query, options); 1948 }; 1949 1950 return Object.assign(newApi, { 1951 defaults: withDefaults.bind(null, newRequest), 1952 endpoint: request.request.endpoint 1953 }); 1954 } 1955 1956 const graphql$1 = withDefaults(request.request, { 1957 headers: { 1958 "user-agent": `octokit-graphql.js/${VERSION} ${universalUserAgent.getUserAgent()}` 1959 }, 1960 method: "POST", 1961 url: "/graphql" 1962 }); 1963 function withCustomRequest(customRequest) { 1964 return withDefaults(customRequest, { 1965 method: "POST", 1966 url: "/graphql" 1967 }); 1968 } 1969 1970 exports.graphql = graphql$1; 1971 exports.withCustomRequest = withCustomRequest; 1972 //# sourceMappingURL=index.js.map 1973 1974 1975 /***/ }), 1976 1977 /***/ 193: 1978 /***/ ((__unused_webpack_module, exports) => { 1979 1980 "use strict"; 1981 1982 1983 Object.defineProperty(exports, "__esModule", ({ value: true })); 1984 1985 const VERSION = "2.4.0"; 1986 1987 /** 1988 * Some “list” response that can be paginated have a different response structure 1989 * 1990 * They have a `total_count` key in the response (search also has `incomplete_results`, 1991 * /installation/repositories also has `repository_selection`), as well as a key with 1992 * the list of the items which name varies from endpoint to endpoint. 1993 * 1994 * Octokit normalizes these responses so that paginated results are always returned following 1995 * the same structure. One challenge is that if the list response has only one page, no Link 1996 * header is provided, so this header alone is not sufficient to check wether a response is 1997 * paginated or not. 1998 * 1999 * We check if a "total_count" key is present in the response data, but also make sure that 2000 * a "url" property is not, as the "Get the combined status for a specific ref" endpoint would 2001 * otherwise match: https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref 2002 */ 2003 function normalizePaginatedListResponse(response) { 2004 const responseNeedsNormalization = "total_count" in response.data && !("url" in response.data); 2005 if (!responseNeedsNormalization) return response; // keep the additional properties intact as there is currently no other way 2006 // to retrieve the same information. 2007 2008 const incompleteResults = response.data.incomplete_results; 2009 const repositorySelection = response.data.repository_selection; 2010 const totalCount = response.data.total_count; 2011 delete response.data.incomplete_results; 2012 delete response.data.repository_selection; 2013 delete response.data.total_count; 2014 const namespaceKey = Object.keys(response.data)[0]; 2015 const data = response.data[namespaceKey]; 2016 response.data = data; 2017 2018 if (typeof incompleteResults !== "undefined") { 2019 response.data.incomplete_results = incompleteResults; 2020 } 2021 2022 if (typeof repositorySelection !== "undefined") { 2023 response.data.repository_selection = repositorySelection; 2024 } 2025 2026 response.data.total_count = totalCount; 2027 return response; 2028 } 2029 2030 function iterator(octokit, route, parameters) { 2031 const options = typeof route === "function" ? route.endpoint(parameters) : octokit.request.endpoint(route, parameters); 2032 const requestMethod = typeof route === "function" ? route : octokit.request; 2033 const method = options.method; 2034 const headers = options.headers; 2035 let url = options.url; 2036 return { 2037 [Symbol.asyncIterator]: () => ({ 2038 next() { 2039 if (!url) { 2040 return Promise.resolve({ 2041 done: true 2042 }); 2043 } 2044 2045 return requestMethod({ 2046 method, 2047 url, 2048 headers 2049 }).then(normalizePaginatedListResponse).then(response => { 2050 // `response.headers.link` format: 2051 // '<https://api.github.com/users/aseemk/followers?page=2>; rel="next", <https://api.github.com/users/aseemk/followers?page=2>; rel="last"' 2052 // sets `url` to undefined if "next" URL is not present or `link` header is not set 2053 url = ((response.headers.link || "").match(/<([^>]+)>;\s*rel="next"/) || [])[1]; 2054 return { 2055 value: response 2056 }; 2057 }); 2058 } 2059 2060 }) 2061 }; 2062 } 2063 2064 function paginate(octokit, route, parameters, mapFn) { 2065 if (typeof parameters === "function") { 2066 mapFn = parameters; 2067 parameters = undefined; 2068 } 2069 2070 return gather(octokit, [], iterator(octokit, route, parameters)[Symbol.asyncIterator](), mapFn); 2071 } 2072 2073 function gather(octokit, results, iterator, mapFn) { 2074 return iterator.next().then(result => { 2075 if (result.done) { 2076 return results; 2077 } 2078 2079 let earlyExit = false; 2080 2081 function done() { 2082 earlyExit = true; 2083 } 2084 2085 results = results.concat(mapFn ? mapFn(result.value, done) : result.value.data); 2086 2087 if (earlyExit) { 2088 return results; 2089 } 2090 2091 return gather(octokit, results, iterator, mapFn); 2092 }); 2093 } 2094 2095 /** 2096 * @param octokit Octokit instance 2097 * @param options Options passed to Octokit constructor 2098 */ 2099 2100 function paginateRest(octokit) { 2101 return { 2102 paginate: Object.assign(paginate.bind(null, octokit), { 2103 iterator: iterator.bind(null, octokit) 2104 }) 2105 }; 2106 } 2107 paginateRest.VERSION = VERSION; 2108 2109 exports.paginateRest = paginateRest; 2110 //# sourceMappingURL=index.js.map 2111 2112 2113 /***/ }), 2114 2115 /***/ 44: 2116 /***/ ((__unused_webpack_module, exports) => { 2117 2118 "use strict"; 2119 2120 2121 Object.defineProperty(exports, "__esModule", ({ value: true })); 2122 2123 const Endpoints = { 2124 actions: { 2125 addSelectedRepoToOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"], 2126 cancelWorkflowRun: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel"], 2127 createOrUpdateOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}"], 2128 createOrUpdateRepoSecret: ["PUT /repos/{owner}/{repo}/actions/secrets/{secret_name}"], 2129 createRegistrationTokenForOrg: ["POST /orgs/{org}/actions/runners/registration-token"], 2130 createRegistrationTokenForRepo: ["POST /repos/{owner}/{repo}/actions/runners/registration-token"], 2131 createRemoveTokenForOrg: ["POST /orgs/{org}/actions/runners/remove-token"], 2132 createRemoveTokenForRepo: ["POST /repos/{owner}/{repo}/actions/runners/remove-token"], 2133 createWorkflowDispatch: ["POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches"], 2134 deleteArtifact: ["DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"], 2135 deleteOrgSecret: ["DELETE /orgs/{org}/actions/secrets/{secret_name}"], 2136 deleteRepoSecret: ["DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name}"], 2137 deleteSelfHostedRunnerFromOrg: ["DELETE /orgs/{org}/actions/runners/{runner_id}"], 2138 deleteSelfHostedRunnerFromRepo: ["DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}"], 2139 deleteWorkflowRun: ["DELETE /repos/{owner}/{repo}/actions/runs/{run_id}"], 2140 deleteWorkflowRunLogs: ["DELETE /repos/{owner}/{repo}/actions/runs/{run_id}/logs"], 2141 downloadArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}"], 2142 downloadJobLogsForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs"], 2143 downloadWorkflowRunLogs: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs"], 2144 getArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"], 2145 getJobForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}"], 2146 getOrgPublicKey: ["GET /orgs/{org}/actions/secrets/public-key"], 2147 getOrgSecret: ["GET /orgs/{org}/actions/secrets/{secret_name}"], 2148 getRepoPublicKey: ["GET /repos/{owner}/{repo}/actions/secrets/public-key"], 2149 getRepoSecret: ["GET /repos/{owner}/{repo}/actions/secrets/{secret_name}"], 2150 getSelfHostedRunnerForOrg: ["GET /orgs/{org}/actions/runners/{runner_id}"], 2151 getSelfHostedRunnerForRepo: ["GET /repos/{owner}/{repo}/actions/runners/{runner_id}"], 2152 getWorkflow: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}"], 2153 getWorkflowRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}"], 2154 getWorkflowRunUsage: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/timing"], 2155 getWorkflowUsage: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing"], 2156 listArtifactsForRepo: ["GET /repos/{owner}/{repo}/actions/artifacts"], 2157 listJobsForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs"], 2158 listOrgSecrets: ["GET /orgs/{org}/actions/secrets"], 2159 listRepoSecrets: ["GET /repos/{owner}/{repo}/actions/secrets"], 2160 listRepoWorkflows: ["GET /repos/{owner}/{repo}/actions/workflows"], 2161 listRunnerApplicationsForOrg: ["GET /orgs/{org}/actions/runners/downloads"], 2162 listRunnerApplicationsForRepo: ["GET /repos/{owner}/{repo}/actions/runners/downloads"], 2163 listSelectedReposForOrgSecret: ["GET /orgs/{org}/actions/secrets/{secret_name}/repositories"], 2164 listSelfHostedRunnersForOrg: ["GET /orgs/{org}/actions/runners"], 2165 listSelfHostedRunnersForRepo: ["GET /repos/{owner}/{repo}/actions/runners"], 2166 listWorkflowRunArtifacts: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts"], 2167 listWorkflowRuns: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs"], 2168 listWorkflowRunsForRepo: ["GET /repos/{owner}/{repo}/actions/runs"], 2169 reRunWorkflow: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun"], 2170 removeSelectedRepoFromOrgSecret: ["DELETE /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"], 2171 setSelectedReposForOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}/repositories"] 2172 }, 2173 activity: { 2174 checkRepoIsStarredByAuthenticatedUser: ["GET /user/starred/{owner}/{repo}"], 2175 deleteRepoSubscription: ["DELETE /repos/{owner}/{repo}/subscription"], 2176 deleteThreadSubscription: ["DELETE /notifications/threads/{thread_id}/subscription"], 2177 getFeeds: ["GET /feeds"], 2178 getRepoSubscription: ["GET /repos/{owner}/{repo}/subscription"], 2179 getThread: ["GET /notifications/threads/{thread_id}"], 2180 getThreadSubscriptionForAuthenticatedUser: ["GET /notifications/threads/{thread_id}/subscription"], 2181 listEventsForAuthenticatedUser: ["GET /users/{username}/events"], 2182 listNotificationsForAuthenticatedUser: ["GET /notifications"], 2183 listOrgEventsForAuthenticatedUser: ["GET /users/{username}/events/orgs/{org}"], 2184 listPublicEvents: ["GET /events"], 2185 listPublicEventsForRepoNetwork: ["GET /networks/{owner}/{repo}/events"], 2186 listPublicEventsForUser: ["GET /users/{username}/events/public"], 2187 listPublicOrgEvents: ["GET /orgs/{org}/events"], 2188 listReceivedEventsForUser: ["GET /users/{username}/received_events"], 2189 listReceivedPublicEventsForUser: ["GET /users/{username}/received_events/public"], 2190 listRepoEvents: ["GET /repos/{owner}/{repo}/events"], 2191 listRepoNotificationsForAuthenticatedUser: ["GET /repos/{owner}/{repo}/notifications"], 2192 listReposStarredByAuthenticatedUser: ["GET /user/starred"], 2193 listReposStarredByUser: ["GET /users/{username}/starred"], 2194 listReposWatchedByUser: ["GET /users/{username}/subscriptions"], 2195 listStargazersForRepo: ["GET /repos/{owner}/{repo}/stargazers"], 2196 listWatchedReposForAuthenticatedUser: ["GET /user/subscriptions"], 2197 listWatchersForRepo: ["GET /repos/{owner}/{repo}/subscribers"], 2198 markNotificationsAsRead: ["PUT /notifications"], 2199 markRepoNotificationsAsRead: ["PUT /repos/{owner}/{repo}/notifications"], 2200 markThreadAsRead: ["PATCH /notifications/threads/{thread_id}"], 2201 setRepoSubscription: ["PUT /repos/{owner}/{repo}/subscription"], 2202 setThreadSubscription: ["PUT /notifications/threads/{thread_id}/subscription"], 2203 starRepoForAuthenticatedUser: ["PUT /user/starred/{owner}/{repo}"], 2204 unstarRepoForAuthenticatedUser: ["DELETE /user/starred/{owner}/{repo}"] 2205 }, 2206 apps: { 2207 addRepoToInstallation: ["PUT /user/installations/{installation_id}/repositories/{repository_id}"], 2208 checkToken: ["POST /applications/{client_id}/token"], 2209 createContentAttachment: ["POST /content_references/{content_reference_id}/attachments", { 2210 mediaType: { 2211 previews: ["corsair"] 2212 } 2213 }], 2214 createFromManifest: ["POST /app-manifests/{code}/conversions"], 2215 createInstallationAccessToken: ["POST /app/installations/{installation_id}/access_tokens"], 2216 deleteAuthorization: ["DELETE /applications/{client_id}/grant"], 2217 deleteInstallation: ["DELETE /app/installations/{installation_id}"], 2218 deleteToken: ["DELETE /applications/{client_id}/token"], 2219 getAuthenticated: ["GET /app"], 2220 getBySlug: ["GET /apps/{app_slug}"], 2221 getInstallation: ["GET /app/installations/{installation_id}"], 2222 getOrgInstallation: ["GET /orgs/{org}/installation"], 2223 getRepoInstallation: ["GET /repos/{owner}/{repo}/installation"], 2224 getSubscriptionPlanForAccount: ["GET /marketplace_listing/accounts/{account_id}"], 2225 getSubscriptionPlanForAccountStubbed: ["GET /marketplace_listing/stubbed/accounts/{account_id}"], 2226 getUserInstallation: ["GET /users/{username}/installation"], 2227 listAccountsForPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"], 2228 listAccountsForPlanStubbed: ["GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"], 2229 listInstallationReposForAuthenticatedUser: ["GET /user/installations/{installation_id}/repositories"], 2230 listInstallations: ["GET /app/installations"], 2231 listInstallationsForAuthenticatedUser: ["GET /user/installations"], 2232 listPlans: ["GET /marketplace_listing/plans"], 2233 listPlansStubbed: ["GET /marketplace_listing/stubbed/plans"], 2234 listReposAccessibleToInstallation: ["GET /installation/repositories"], 2235 listSubscriptionsForAuthenticatedUser: ["GET /user/marketplace_purchases"], 2236 listSubscriptionsForAuthenticatedUserStubbed: ["GET /user/marketplace_purchases/stubbed"], 2237 removeRepoFromInstallation: ["DELETE /user/installations/{installation_id}/repositories/{repository_id}"], 2238 resetToken: ["PATCH /applications/{client_id}/token"], 2239 revokeInstallationAccessToken: ["DELETE /installation/token"], 2240 suspendInstallation: ["PUT /app/installations/{installation_id}/suspended"], 2241 unsuspendInstallation: ["DELETE /app/installations/{installation_id}/suspended"] 2242 }, 2243 billing: { 2244 getGithubActionsBillingOrg: ["GET /orgs/{org}/settings/billing/actions"], 2245 getGithubActionsBillingUser: ["GET /users/{username}/settings/billing/actions"], 2246 getGithubPackagesBillingOrg: ["GET /orgs/{org}/settings/billing/packages"], 2247 getGithubPackagesBillingUser: ["GET /users/{username}/settings/billing/packages"], 2248 getSharedStorageBillingOrg: ["GET /orgs/{org}/settings/billing/shared-storage"], 2249 getSharedStorageBillingUser: ["GET /users/{username}/settings/billing/shared-storage"] 2250 }, 2251 checks: { 2252 create: ["POST /repos/{owner}/{repo}/check-runs", { 2253 mediaType: { 2254 previews: ["antiope"] 2255 } 2256 }], 2257 createSuite: ["POST /repos/{owner}/{repo}/check-suites", { 2258 mediaType: { 2259 previews: ["antiope"] 2260 } 2261 }], 2262 get: ["GET /repos/{owner}/{repo}/check-runs/{check_run_id}", { 2263 mediaType: { 2264 previews: ["antiope"] 2265 } 2266 }], 2267 getSuite: ["GET /repos/{owner}/{repo}/check-suites/{check_suite_id}", { 2268 mediaType: { 2269 previews: ["antiope"] 2270 } 2271 }], 2272 listAnnotations: ["GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations", { 2273 mediaType: { 2274 previews: ["antiope"] 2275 } 2276 }], 2277 listForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/check-runs", { 2278 mediaType: { 2279 previews: ["antiope"] 2280 } 2281 }], 2282 listForSuite: ["GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs", { 2283 mediaType: { 2284 previews: ["antiope"] 2285 } 2286 }], 2287 listSuitesForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/check-suites", { 2288 mediaType: { 2289 previews: ["antiope"] 2290 } 2291 }], 2292 rerequestSuite: ["POST /repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest", { 2293 mediaType: { 2294 previews: ["antiope"] 2295 } 2296 }], 2297 setSuitesPreferences: ["PATCH /repos/{owner}/{repo}/check-suites/preferences", { 2298 mediaType: { 2299 previews: ["antiope"] 2300 } 2301 }], 2302 update: ["PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}", { 2303 mediaType: { 2304 previews: ["antiope"] 2305 } 2306 }] 2307 }, 2308 codeScanning: { 2309 getAlert: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}", {}, { 2310 renamedParameters: { 2311 alert_id: "alert_number" 2312 } 2313 }], 2314 listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"], 2315 listRecentAnalyses: ["GET /repos/{owner}/{repo}/code-scanning/analyses"], 2316 updateAlert: ["PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}"], 2317 uploadSarif: ["POST /repos/{owner}/{repo}/code-scanning/sarifs"] 2318 }, 2319 codesOfConduct: { 2320 getAllCodesOfConduct: ["GET /codes_of_conduct", { 2321 mediaType: { 2322 previews: ["scarlet-witch"] 2323 } 2324 }], 2325 getConductCode: ["GET /codes_of_conduct/{key}", { 2326 mediaType: { 2327 previews: ["scarlet-witch"] 2328 } 2329 }], 2330 getForRepo: ["GET /repos/{owner}/{repo}/community/code_of_conduct", { 2331 mediaType: { 2332 previews: ["scarlet-witch"] 2333 } 2334 }] 2335 }, 2336 emojis: { 2337 get: ["GET /emojis"] 2338 }, 2339 gists: { 2340 checkIsStarred: ["GET /gists/{gist_id}/star"], 2341 create: ["POST /gists"], 2342 createComment: ["POST /gists/{gist_id}/comments"], 2343 delete: ["DELETE /gists/{gist_id}"], 2344 deleteComment: ["DELETE /gists/{gist_id}/comments/{comment_id}"], 2345 fork: ["POST /gists/{gist_id}/forks"], 2346 get: ["GET /gists/{gist_id}"], 2347 getComment: ["GET /gists/{gist_id}/comments/{comment_id}"], 2348 getRevision: ["GET /gists/{gist_id}/{sha}"], 2349 list: ["GET /gists"], 2350 listComments: ["GET /gists/{gist_id}/comments"], 2351 listCommits: ["GET /gists/{gist_id}/commits"], 2352 listForUser: ["GET /users/{username}/gists"], 2353 listForks: ["GET /gists/{gist_id}/forks"], 2354 listPublic: ["GET /gists/public"], 2355 listStarred: ["GET /gists/starred"], 2356 star: ["PUT /gists/{gist_id}/star"], 2357 unstar: ["DELETE /gists/{gist_id}/star"], 2358 update: ["PATCH /gists/{gist_id}"], 2359 updateComment: ["PATCH /gists/{gist_id}/comments/{comment_id}"] 2360 }, 2361 git: { 2362 createBlob: ["POST /repos/{owner}/{repo}/git/blobs"], 2363 createCommit: ["POST /repos/{owner}/{repo}/git/commits"], 2364 createRef: ["POST /repos/{owner}/{repo}/git/refs"], 2365 createTag: ["POST /repos/{owner}/{repo}/git/tags"], 2366 createTree: ["POST /repos/{owner}/{repo}/git/trees"], 2367 deleteRef: ["DELETE /repos/{owner}/{repo}/git/refs/{ref}"], 2368 getBlob: ["GET /repos/{owner}/{repo}/git/blobs/{file_sha}"], 2369 getCommit: ["GET /repos/{owner}/{repo}/git/commits/{commit_sha}"], 2370 getRef: ["GET /repos/{owner}/{repo}/git/ref/{ref}"], 2371 getTag: ["GET /repos/{owner}/{repo}/git/tags/{tag_sha}"], 2372 getTree: ["GET /repos/{owner}/{repo}/git/trees/{tree_sha}"], 2373 listMatchingRefs: ["GET /repos/{owner}/{repo}/git/matching-refs/{ref}"], 2374 updateRef: ["PATCH /repos/{owner}/{repo}/git/refs/{ref}"] 2375 }, 2376 gitignore: { 2377 getAllTemplates: ["GET /gitignore/templates"], 2378 getTemplate: ["GET /gitignore/templates/{name}"] 2379 }, 2380 interactions: { 2381 getRestrictionsForOrg: ["GET /orgs/{org}/interaction-limits", { 2382 mediaType: { 2383 previews: ["sombra"] 2384 } 2385 }], 2386 getRestrictionsForRepo: ["GET /repos/{owner}/{repo}/interaction-limits", { 2387 mediaType: { 2388 previews: ["sombra"] 2389 } 2390 }], 2391 removeRestrictionsForOrg: ["DELETE /orgs/{org}/interaction-limits", { 2392 mediaType: { 2393 previews: ["sombra"] 2394 } 2395 }], 2396 removeRestrictionsForRepo: ["DELETE /repos/{owner}/{repo}/interaction-limits", { 2397 mediaType: { 2398 previews: ["sombra"] 2399 } 2400 }], 2401 setRestrictionsForOrg: ["PUT /orgs/{org}/interaction-limits", { 2402 mediaType: { 2403 previews: ["sombra"] 2404 } 2405 }], 2406 setRestrictionsForRepo: ["PUT /repos/{owner}/{repo}/interaction-limits", { 2407 mediaType: { 2408 previews: ["sombra"] 2409 } 2410 }] 2411 }, 2412 issues: { 2413 addAssignees: ["POST /repos/{owner}/{repo}/issues/{issue_number}/assignees"], 2414 addLabels: ["POST /repos/{owner}/{repo}/issues/{issue_number}/labels"], 2415 checkUserCanBeAssigned: ["GET /repos/{owner}/{repo}/assignees/{assignee}"], 2416 create: ["POST /repos/{owner}/{repo}/issues"], 2417 createComment: ["POST /repos/{owner}/{repo}/issues/{issue_number}/comments"], 2418 createLabel: ["POST /repos/{owner}/{repo}/labels"], 2419 createMilestone: ["POST /repos/{owner}/{repo}/milestones"], 2420 deleteComment: ["DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}"], 2421 deleteLabel: ["DELETE /repos/{owner}/{repo}/labels/{name}"], 2422 deleteMilestone: ["DELETE /repos/{owner}/{repo}/milestones/{milestone_number}"], 2423 get: ["GET /repos/{owner}/{repo}/issues/{issue_number}"], 2424 getComment: ["GET /repos/{owner}/{repo}/issues/comments/{comment_id}"], 2425 getEvent: ["GET /repos/{owner}/{repo}/issues/events/{event_id}"], 2426 getLabel: ["GET /repos/{owner}/{repo}/labels/{name}"], 2427 getMilestone: ["GET /repos/{owner}/{repo}/milestones/{milestone_number}"], 2428 list: ["GET /issues"], 2429 listAssignees: ["GET /repos/{owner}/{repo}/assignees"], 2430 listComments: ["GET /repos/{owner}/{repo}/issues/{issue_number}/comments"], 2431 listCommentsForRepo: ["GET /repos/{owner}/{repo}/issues/comments"], 2432 listEvents: ["GET /repos/{owner}/{repo}/issues/{issue_number}/events"], 2433 listEventsForRepo: ["GET /repos/{owner}/{repo}/issues/events"], 2434 listEventsForTimeline: ["GET /repos/{owner}/{repo}/issues/{issue_number}/timeline", { 2435 mediaType: { 2436 previews: ["mockingbird"] 2437 } 2438 }], 2439 listForAuthenticatedUser: ["GET /user/issues"], 2440 listForOrg: ["GET /orgs/{org}/issues"], 2441 listForRepo: ["GET /repos/{owner}/{repo}/issues"], 2442 listLabelsForMilestone: ["GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels"], 2443 listLabelsForRepo: ["GET /repos/{owner}/{repo}/labels"], 2444 listLabelsOnIssue: ["GET /repos/{owner}/{repo}/issues/{issue_number}/labels"], 2445 listMilestones: ["GET /repos/{owner}/{repo}/milestones"], 2446 lock: ["PUT /repos/{owner}/{repo}/issues/{issue_number}/lock"], 2447 removeAllLabels: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels"], 2448 removeAssignees: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/assignees"], 2449 removeLabel: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}"], 2450 setLabels: ["PUT /repos/{owner}/{repo}/issues/{issue_number}/labels"], 2451 unlock: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock"], 2452 update: ["PATCH /repos/{owner}/{repo}/issues/{issue_number}"], 2453 updateComment: ["PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}"], 2454 updateLabel: ["PATCH /repos/{owner}/{repo}/labels/{name}"], 2455 updateMilestone: ["PATCH /repos/{owner}/{repo}/milestones/{milestone_number}"] 2456 }, 2457 licenses: { 2458 get: ["GET /licenses/{license}"], 2459 getAllCommonlyUsed: ["GET /licenses"], 2460 getForRepo: ["GET /repos/{owner}/{repo}/license"] 2461 }, 2462 markdown: { 2463 render: ["POST /markdown"], 2464 renderRaw: ["POST /markdown/raw", { 2465 headers: { 2466 "content-type": "text/plain; charset=utf-8" 2467 } 2468 }] 2469 }, 2470 meta: { 2471 get: ["GET /meta"] 2472 }, 2473 migrations: { 2474 cancelImport: ["DELETE /repos/{owner}/{repo}/import"], 2475 deleteArchiveForAuthenticatedUser: ["DELETE /user/migrations/{migration_id}/archive", { 2476 mediaType: { 2477 previews: ["wyandotte"] 2478 } 2479 }], 2480 deleteArchiveForOrg: ["DELETE /orgs/{org}/migrations/{migration_id}/archive", { 2481 mediaType: { 2482 previews: ["wyandotte"] 2483 } 2484 }], 2485 downloadArchiveForOrg: ["GET /orgs/{org}/migrations/{migration_id}/archive", { 2486 mediaType: { 2487 previews: ["wyandotte"] 2488 } 2489 }], 2490 getArchiveForAuthenticatedUser: ["GET /user/migrations/{migration_id}/archive", { 2491 mediaType: { 2492 previews: ["wyandotte"] 2493 } 2494 }], 2495 getCommitAuthors: ["GET /repos/{owner}/{repo}/import/authors"], 2496 getImportStatus: ["GET /repos/{owner}/{repo}/import"], 2497 getLargeFiles: ["GET /repos/{owner}/{repo}/import/large_files"], 2498 getStatusForAuthenticatedUser: ["GET /user/migrations/{migration_id}", { 2499 mediaType: { 2500 previews: ["wyandotte"] 2501 } 2502 }], 2503 getStatusForOrg: ["GET /orgs/{org}/migrations/{migration_id}", { 2504 mediaType: { 2505 previews: ["wyandotte"] 2506 } 2507 }], 2508 listForAuthenticatedUser: ["GET /user/migrations", { 2509 mediaType: { 2510 previews: ["wyandotte"] 2511 } 2512 }], 2513 listForOrg: ["GET /orgs/{org}/migrations", { 2514 mediaType: { 2515 previews: ["wyandotte"] 2516 } 2517 }], 2518 listReposForOrg: ["GET /orgs/{org}/migrations/{migration_id}/repositories", { 2519 mediaType: { 2520 previews: ["wyandotte"] 2521 } 2522 }], 2523 listReposForUser: ["GET /user/migrations/{migration_id}/repositories", { 2524 mediaType: { 2525 previews: ["wyandotte"] 2526 } 2527 }], 2528 mapCommitAuthor: ["PATCH /repos/{owner}/{repo}/import/authors/{author_id}"], 2529 setLfsPreference: ["PATCH /repos/{owner}/{repo}/import/lfs"], 2530 startForAuthenticatedUser: ["POST /user/migrations"], 2531 startForOrg: ["POST /orgs/{org}/migrations"], 2532 startImport: ["PUT /repos/{owner}/{repo}/import"], 2533 unlockRepoForAuthenticatedUser: ["DELETE /user/migrations/{migration_id}/repos/{repo_name}/lock", { 2534 mediaType: { 2535 previews: ["wyandotte"] 2536 } 2537 }], 2538 unlockRepoForOrg: ["DELETE /orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock", { 2539 mediaType: { 2540 previews: ["wyandotte"] 2541 } 2542 }], 2543 updateImport: ["PATCH /repos/{owner}/{repo}/import"] 2544 }, 2545 orgs: { 2546 blockUser: ["PUT /orgs/{org}/blocks/{username}"], 2547 checkBlockedUser: ["GET /orgs/{org}/blocks/{username}"], 2548 checkMembershipForUser: ["GET /orgs/{org}/members/{username}"], 2549 checkPublicMembershipForUser: ["GET /orgs/{org}/public_members/{username}"], 2550 convertMemberToOutsideCollaborator: ["PUT /orgs/{org}/outside_collaborators/{username}"], 2551 createInvitation: ["POST /orgs/{org}/invitations"], 2552 createWebhook: ["POST /orgs/{org}/hooks"], 2553 deleteWebhook: ["DELETE /orgs/{org}/hooks/{hook_id}"], 2554 get: ["GET /orgs/{org}"], 2555 getMembershipForAuthenticatedUser: ["GET /user/memberships/orgs/{org}"], 2556 getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"], 2557 getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"], 2558 list: ["GET /organizations"], 2559 listAppInstallations: ["GET /orgs/{org}/installations"], 2560 listBlockedUsers: ["GET /orgs/{org}/blocks"], 2561 listForAuthenticatedUser: ["GET /user/orgs"], 2562 listForUser: ["GET /users/{username}/orgs"], 2563 listInvitationTeams: ["GET /orgs/{org}/invitations/{invitation_id}/teams"], 2564 listMembers: ["GET /orgs/{org}/members"], 2565 listMembershipsForAuthenticatedUser: ["GET /user/memberships/orgs"], 2566 listOutsideCollaborators: ["GET /orgs/{org}/outside_collaborators"], 2567 listPendingInvitations: ["GET /orgs/{org}/invitations"], 2568 listPublicMembers: ["GET /orgs/{org}/public_members"], 2569 listWebhooks: ["GET /orgs/{org}/hooks"], 2570 pingWebhook: ["POST /orgs/{org}/hooks/{hook_id}/pings"], 2571 removeMember: ["DELETE /orgs/{org}/members/{username}"], 2572 removeMembershipForUser: ["DELETE /orgs/{org}/memberships/{username}"], 2573 removeOutsideCollaborator: ["DELETE /orgs/{org}/outside_collaborators/{username}"], 2574 removePublicMembershipForAuthenticatedUser: ["DELETE /orgs/{org}/public_members/{username}"], 2575 setMembershipForUser: ["PUT /orgs/{org}/memberships/{username}"], 2576 setPublicMembershipForAuthenticatedUser: ["PUT /orgs/{org}/public_members/{username}"], 2577 unblockUser: ["DELETE /orgs/{org}/blocks/{username}"], 2578 update: ["PATCH /orgs/{org}"], 2579 updateMembershipForAuthenticatedUser: ["PATCH /user/memberships/orgs/{org}"], 2580 updateWebhook: ["PATCH /orgs/{org}/hooks/{hook_id}"] 2581 }, 2582 projects: { 2583 addCollaborator: ["PUT /projects/{project_id}/collaborators/{username}", { 2584 mediaType: { 2585 previews: ["inertia"] 2586 } 2587 }], 2588 createCard: ["POST /projects/columns/{column_id}/cards", { 2589 mediaType: { 2590 previews: ["inertia"] 2591 } 2592 }], 2593 createColumn: ["POST /projects/{project_id}/columns", { 2594 mediaType: { 2595 previews: ["inertia"] 2596 } 2597 }], 2598 createForAuthenticatedUser: ["POST /user/projects", { 2599 mediaType: { 2600 previews: ["inertia"] 2601 } 2602 }], 2603 createForOrg: ["POST /orgs/{org}/projects", { 2604 mediaType: { 2605 previews: ["inertia"] 2606 } 2607 }], 2608 createForRepo: ["POST /repos/{owner}/{repo}/projects", { 2609 mediaType: { 2610 previews: ["inertia"] 2611 } 2612 }], 2613 delete: ["DELETE /projects/{project_id}", { 2614 mediaType: { 2615 previews: ["inertia"] 2616 } 2617 }], 2618 deleteCard: ["DELETE /projects/columns/cards/{card_id}", { 2619 mediaType: { 2620 previews: ["inertia"] 2621 } 2622 }], 2623 deleteColumn: ["DELETE /projects/columns/{column_id}", { 2624 mediaType: { 2625 previews: ["inertia"] 2626 } 2627 }], 2628 get: ["GET /projects/{project_id}", { 2629 mediaType: { 2630 previews: ["inertia"] 2631 } 2632 }], 2633 getCard: ["GET /projects/columns/cards/{card_id}", { 2634 mediaType: { 2635 previews: ["inertia"] 2636 } 2637 }], 2638 getColumn: ["GET /projects/columns/{column_id}", { 2639 mediaType: { 2640 previews: ["inertia"] 2641 } 2642 }], 2643 getPermissionForUser: ["GET /projects/{project_id}/collaborators/{username}/permission", { 2644 mediaType: { 2645 previews: ["inertia"] 2646 } 2647 }], 2648 listCards: ["GET /projects/columns/{column_id}/cards", { 2649 mediaType: { 2650 previews: ["inertia"] 2651 } 2652 }], 2653 listCollaborators: ["GET /projects/{project_id}/collaborators", { 2654 mediaType: { 2655 previews: ["inertia"] 2656 } 2657 }], 2658 listColumns: ["GET /projects/{project_id}/columns", { 2659 mediaType: { 2660 previews: ["inertia"] 2661 } 2662 }], 2663 listForOrg: ["GET /orgs/{org}/projects", { 2664 mediaType: { 2665 previews: ["inertia"] 2666 } 2667 }], 2668 listForRepo: ["GET /repos/{owner}/{repo}/projects", { 2669 mediaType: { 2670 previews: ["inertia"] 2671 } 2672 }], 2673 listForUser: ["GET /users/{username}/projects", { 2674 mediaType: { 2675 previews: ["inertia"] 2676 } 2677 }], 2678 moveCard: ["POST /projects/columns/cards/{card_id}/moves", { 2679 mediaType: { 2680 previews: ["inertia"] 2681 } 2682 }], 2683 moveColumn: ["POST /projects/columns/{column_id}/moves", { 2684 mediaType: { 2685 previews: ["inertia"] 2686 } 2687 }], 2688 removeCollaborator: ["DELETE /projects/{project_id}/collaborators/{username}", { 2689 mediaType: { 2690 previews: ["inertia"] 2691 } 2692 }], 2693 update: ["PATCH /projects/{project_id}", { 2694 mediaType: { 2695 previews: ["inertia"] 2696 } 2697 }], 2698 updateCard: ["PATCH /projects/columns/cards/{card_id}", { 2699 mediaType: { 2700 previews: ["inertia"] 2701 } 2702 }], 2703 updateColumn: ["PATCH /projects/columns/{column_id}", { 2704 mediaType: { 2705 previews: ["inertia"] 2706 } 2707 }] 2708 }, 2709 pulls: { 2710 checkIfMerged: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/merge"], 2711 create: ["POST /repos/{owner}/{repo}/pulls"], 2712 createReplyForReviewComment: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies"], 2713 createReview: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews"], 2714 createReviewComment: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/comments"], 2715 deletePendingReview: ["DELETE /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"], 2716 deleteReviewComment: ["DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}"], 2717 dismissReview: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals"], 2718 get: ["GET /repos/{owner}/{repo}/pulls/{pull_number}"], 2719 getReview: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"], 2720 getReviewComment: ["GET /repos/{owner}/{repo}/pulls/comments/{comment_id}"], 2721 list: ["GET /repos/{owner}/{repo}/pulls"], 2722 listCommentsForReview: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments"], 2723 listCommits: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/commits"], 2724 listFiles: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/files"], 2725 listRequestedReviewers: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"], 2726 listReviewComments: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/comments"], 2727 listReviewCommentsForRepo: ["GET /repos/{owner}/{repo}/pulls/comments"], 2728 listReviews: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews"], 2729 merge: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge"], 2730 removeRequestedReviewers: ["DELETE /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"], 2731 requestReviewers: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"], 2732 submitReview: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events"], 2733 update: ["PATCH /repos/{owner}/{repo}/pulls/{pull_number}"], 2734 updateBranch: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch", { 2735 mediaType: { 2736 previews: ["lydian"] 2737 } 2738 }], 2739 updateReview: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"], 2740 updateReviewComment: ["PATCH /repos/{owner}/{repo}/pulls/comments/{comment_id}"] 2741 }, 2742 rateLimit: { 2743 get: ["GET /rate_limit"] 2744 }, 2745 reactions: { 2746 createForCommitComment: ["POST /repos/{owner}/{repo}/comments/{comment_id}/reactions", { 2747 mediaType: { 2748 previews: ["squirrel-girl"] 2749 } 2750 }], 2751 createForIssue: ["POST /repos/{owner}/{repo}/issues/{issue_number}/reactions", { 2752 mediaType: { 2753 previews: ["squirrel-girl"] 2754 } 2755 }], 2756 createForIssueComment: ["POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions", { 2757 mediaType: { 2758 previews: ["squirrel-girl"] 2759 } 2760 }], 2761 createForPullRequestReviewComment: ["POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions", { 2762 mediaType: { 2763 previews: ["squirrel-girl"] 2764 } 2765 }], 2766 createForTeamDiscussionCommentInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions", { 2767 mediaType: { 2768 previews: ["squirrel-girl"] 2769 } 2770 }], 2771 createForTeamDiscussionInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions", { 2772 mediaType: { 2773 previews: ["squirrel-girl"] 2774 } 2775 }], 2776 deleteForCommitComment: ["DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}", { 2777 mediaType: { 2778 previews: ["squirrel-girl"] 2779 } 2780 }], 2781 deleteForIssue: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}", { 2782 mediaType: { 2783 previews: ["squirrel-girl"] 2784 } 2785 }], 2786 deleteForIssueComment: ["DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}", { 2787 mediaType: { 2788 previews: ["squirrel-girl"] 2789 } 2790 }], 2791 deleteForPullRequestComment: ["DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}", { 2792 mediaType: { 2793 previews: ["squirrel-girl"] 2794 } 2795 }], 2796 deleteForTeamDiscussion: ["DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}", { 2797 mediaType: { 2798 previews: ["squirrel-girl"] 2799 } 2800 }], 2801 deleteForTeamDiscussionComment: ["DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}", { 2802 mediaType: { 2803 previews: ["squirrel-girl"] 2804 } 2805 }], 2806 deleteLegacy: ["DELETE /reactions/{reaction_id}", { 2807 mediaType: { 2808 previews: ["squirrel-girl"] 2809 } 2810 }, { 2811 deprecated: "octokit.reactions.deleteLegacy() is deprecated, see https://developer.github.com/v3/reactions/#delete-a-reaction-legacy" 2812 }], 2813 listForCommitComment: ["GET /repos/{owner}/{repo}/comments/{comment_id}/reactions", { 2814 mediaType: { 2815 previews: ["squirrel-girl"] 2816 } 2817 }], 2818 listForIssue: ["GET /repos/{owner}/{repo}/issues/{issue_number}/reactions", { 2819 mediaType: { 2820 previews: ["squirrel-girl"] 2821 } 2822 }], 2823 listForIssueComment: ["GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions", { 2824 mediaType: { 2825 previews: ["squirrel-girl"] 2826 } 2827 }], 2828 listForPullRequestReviewComment: ["GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions", { 2829 mediaType: { 2830 previews: ["squirrel-girl"] 2831 } 2832 }], 2833 listForTeamDiscussionCommentInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions", { 2834 mediaType: { 2835 previews: ["squirrel-girl"] 2836 } 2837 }], 2838 listForTeamDiscussionInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions", { 2839 mediaType: { 2840 previews: ["squirrel-girl"] 2841 } 2842 }] 2843 }, 2844 repos: { 2845 acceptInvitation: ["PATCH /user/repository_invitations/{invitation_id}"], 2846 addAppAccessRestrictions: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps", {}, { 2847 mapToData: "apps" 2848 }], 2849 addCollaborator: ["PUT /repos/{owner}/{repo}/collaborators/{username}"], 2850 addStatusCheckContexts: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts", {}, { 2851 mapToData: "contexts" 2852 }], 2853 addTeamAccessRestrictions: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams", {}, { 2854 mapToData: "teams" 2855 }], 2856 addUserAccessRestrictions: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users", {}, { 2857 mapToData: "users" 2858 }], 2859 checkCollaborator: ["GET /repos/{owner}/{repo}/collaborators/{username}"], 2860 checkVulnerabilityAlerts: ["GET /repos/{owner}/{repo}/vulnerability-alerts", { 2861 mediaType: { 2862 previews: ["dorian"] 2863 } 2864 }], 2865 compareCommits: ["GET /repos/{owner}/{repo}/compare/{base}...{head}"], 2866 createCommitComment: ["POST /repos/{owner}/{repo}/commits/{commit_sha}/comments"], 2867 createCommitSignatureProtection: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures", { 2868 mediaType: { 2869 previews: ["zzzax"] 2870 } 2871 }], 2872 createCommitStatus: ["POST /repos/{owner}/{repo}/statuses/{sha}"], 2873 createDeployKey: ["POST /repos/{owner}/{repo}/keys"], 2874 createDeployment: ["POST /repos/{owner}/{repo}/deployments"], 2875 createDeploymentStatus: ["POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"], 2876 createDispatchEvent: ["POST /repos/{owner}/{repo}/dispatches"], 2877 createForAuthenticatedUser: ["POST /user/repos"], 2878 createFork: ["POST /repos/{owner}/{repo}/forks"], 2879 createInOrg: ["POST /orgs/{org}/repos"], 2880 createOrUpdateFileContents: ["PUT /repos/{owner}/{repo}/contents/{path}"], 2881 createPagesSite: ["POST /repos/{owner}/{repo}/pages", { 2882 mediaType: { 2883 previews: ["switcheroo"] 2884 } 2885 }], 2886 createRelease: ["POST /repos/{owner}/{repo}/releases"], 2887 createUsingTemplate: ["POST /repos/{template_owner}/{template_repo}/generate", { 2888 mediaType: { 2889 previews: ["baptiste"] 2890 } 2891 }], 2892 createWebhook: ["POST /repos/{owner}/{repo}/hooks"], 2893 declineInvitation: ["DELETE /user/repository_invitations/{invitation_id}"], 2894 delete: ["DELETE /repos/{owner}/{repo}"], 2895 deleteAccessRestrictions: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions"], 2896 deleteAdminBranchProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"], 2897 deleteBranchProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection"], 2898 deleteCommitComment: ["DELETE /repos/{owner}/{repo}/comments/{comment_id}"], 2899 deleteCommitSignatureProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures", { 2900 mediaType: { 2901 previews: ["zzzax"] 2902 } 2903 }], 2904 deleteDeployKey: ["DELETE /repos/{owner}/{repo}/keys/{key_id}"], 2905 deleteDeployment: ["DELETE /repos/{owner}/{repo}/deployments/{deployment_id}"], 2906 deleteFile: ["DELETE /repos/{owner}/{repo}/contents/{path}"], 2907 deleteInvitation: ["DELETE /repos/{owner}/{repo}/invitations/{invitation_id}"], 2908 deletePagesSite: ["DELETE /repos/{owner}/{repo}/pages", { 2909 mediaType: { 2910 previews: ["switcheroo"] 2911 } 2912 }], 2913 deletePullRequestReviewProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"], 2914 deleteRelease: ["DELETE /repos/{owner}/{repo}/releases/{release_id}"], 2915 deleteReleaseAsset: ["DELETE /repos/{owner}/{repo}/releases/assets/{asset_id}"], 2916 deleteWebhook: ["DELETE /repos/{owner}/{repo}/hooks/{hook_id}"], 2917 disableAutomatedSecurityFixes: ["DELETE /repos/{owner}/{repo}/automated-security-fixes", { 2918 mediaType: { 2919 previews: ["london"] 2920 } 2921 }], 2922 disableVulnerabilityAlerts: ["DELETE /repos/{owner}/{repo}/vulnerability-alerts", { 2923 mediaType: { 2924 previews: ["dorian"] 2925 } 2926 }], 2927 downloadArchive: ["GET /repos/{owner}/{repo}/{archive_format}/{ref}"], 2928 enableAutomatedSecurityFixes: ["PUT /repos/{owner}/{repo}/automated-security-fixes", { 2929 mediaType: { 2930 previews: ["london"] 2931 } 2932 }], 2933 enableVulnerabilityAlerts: ["PUT /repos/{owner}/{repo}/vulnerability-alerts", { 2934 mediaType: { 2935 previews: ["dorian"] 2936 } 2937 }], 2938 get: ["GET /repos/{owner}/{repo}"], 2939 getAccessRestrictions: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions"], 2940 getAdminBranchProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"], 2941 getAllStatusCheckContexts: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts"], 2942 getAllTopics: ["GET /repos/{owner}/{repo}/topics", { 2943 mediaType: { 2944 previews: ["mercy"] 2945 } 2946 }], 2947 getAppsWithAccessToProtectedBranch: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps"], 2948 getBranch: ["GET /repos/{owner}/{repo}/branches/{branch}"], 2949 getBranchProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection"], 2950 getClones: ["GET /repos/{owner}/{repo}/traffic/clones"], 2951 getCodeFrequencyStats: ["GET /repos/{owner}/{repo}/stats/code_frequency"], 2952 getCollaboratorPermissionLevel: ["GET /repos/{owner}/{repo}/collaborators/{username}/permission"], 2953 getCombinedStatusForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/status"], 2954 getCommit: ["GET /repos/{owner}/{repo}/commits/{ref}"], 2955 getCommitActivityStats: ["GET /repos/{owner}/{repo}/stats/commit_activity"], 2956 getCommitComment: ["GET /repos/{owner}/{repo}/comments/{comment_id}"], 2957 getCommitSignatureProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures", { 2958 mediaType: { 2959 previews: ["zzzax"] 2960 } 2961 }], 2962 getCommunityProfileMetrics: ["GET /repos/{owner}/{repo}/community/profile", { 2963 mediaType: { 2964 previews: ["black-panther"] 2965 } 2966 }], 2967 getContent: ["GET /repos/{owner}/{repo}/contents/{path}"], 2968 getContributorsStats: ["GET /repos/{owner}/{repo}/stats/contributors"], 2969 getDeployKey: ["GET /repos/{owner}/{repo}/keys/{key_id}"], 2970 getDeployment: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}"], 2971 getDeploymentStatus: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id}"], 2972 getLatestPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/latest"], 2973 getLatestRelease: ["GET /repos/{owner}/{repo}/releases/latest"], 2974 getPages: ["GET /repos/{owner}/{repo}/pages"], 2975 getPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/{build_id}"], 2976 getParticipationStats: ["GET /repos/{owner}/{repo}/stats/participation"], 2977 getPullRequestReviewProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"], 2978 getPunchCardStats: ["GET /repos/{owner}/{repo}/stats/punch_card"], 2979 getReadme: ["GET /repos/{owner}/{repo}/readme"], 2980 getRelease: ["GET /repos/{owner}/{repo}/releases/{release_id}"], 2981 getReleaseAsset: ["GET /repos/{owner}/{repo}/releases/assets/{asset_id}"], 2982 getReleaseByTag: ["GET /repos/{owner}/{repo}/releases/tags/{tag}"], 2983 getStatusChecksProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"], 2984 getTeamsWithAccessToProtectedBranch: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams"], 2985 getTopPaths: ["GET /repos/{owner}/{repo}/traffic/popular/paths"], 2986 getTopReferrers: ["GET /repos/{owner}/{repo}/traffic/popular/referrers"], 2987 getUsersWithAccessToProtectedBranch: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users"], 2988 getViews: ["GET /repos/{owner}/{repo}/traffic/views"], 2989 getWebhook: ["GET /repos/{owner}/{repo}/hooks/{hook_id}"], 2990 listBranches: ["GET /repos/{owner}/{repo}/branches"], 2991 listBranchesForHeadCommit: ["GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head", { 2992 mediaType: { 2993 previews: ["groot"] 2994 } 2995 }], 2996 listCollaborators: ["GET /repos/{owner}/{repo}/collaborators"], 2997 listCommentsForCommit: ["GET /repos/{owner}/{repo}/commits/{commit_sha}/comments"], 2998 listCommitCommentsForRepo: ["GET /repos/{owner}/{repo}/comments"], 2999 listCommitStatusesForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/statuses"], 3000 listCommits: ["GET /repos/{owner}/{repo}/commits"], 3001 listContributors: ["GET /repos/{owner}/{repo}/contributors"], 3002 listDeployKeys: ["GET /repos/{owner}/{repo}/keys"], 3003 listDeploymentStatuses: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"], 3004 listDeployments: ["GET /repos/{owner}/{repo}/deployments"], 3005 listForAuthenticatedUser: ["GET /user/repos"], 3006 listForOrg: ["GET /orgs/{org}/repos"], 3007 listForUser: ["GET /users/{username}/repos"], 3008 listForks: ["GET /repos/{owner}/{repo}/forks"], 3009 listInvitations: ["GET /repos/{owner}/{repo}/invitations"], 3010 listInvitationsForAuthenticatedUser: ["GET /user/repository_invitations"], 3011 listLanguages: ["GET /repos/{owner}/{repo}/languages"], 3012 listPagesBuilds: ["GET /repos/{owner}/{repo}/pages/builds"], 3013 listPublic: ["GET /repositories"], 3014 listPullRequestsAssociatedWithCommit: ["GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls", { 3015 mediaType: { 3016 previews: ["groot"] 3017 } 3018 }], 3019 listReleaseAssets: ["GET /repos/{owner}/{repo}/releases/{release_id}/assets"], 3020 listReleases: ["GET /repos/{owner}/{repo}/releases"], 3021 listTags: ["GET /repos/{owner}/{repo}/tags"], 3022 listTeams: ["GET /repos/{owner}/{repo}/teams"], 3023 listWebhooks: ["GET /repos/{owner}/{repo}/hooks"], 3024 merge: ["POST /repos/{owner}/{repo}/merges"], 3025 pingWebhook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/pings"], 3026 removeAppAccessRestrictions: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps", {}, { 3027 mapToData: "apps" 3028 }], 3029 removeCollaborator: ["DELETE /repos/{owner}/{repo}/collaborators/{username}"], 3030 removeStatusCheckContexts: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts", {}, { 3031 mapToData: "contexts" 3032 }], 3033 removeStatusCheckProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"], 3034 removeTeamAccessRestrictions: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams", {}, { 3035 mapToData: "teams" 3036 }], 3037 removeUserAccessRestrictions: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users", {}, { 3038 mapToData: "users" 3039 }], 3040 replaceAllTopics: ["PUT /repos/{owner}/{repo}/topics", { 3041 mediaType: { 3042 previews: ["mercy"] 3043 } 3044 }], 3045 requestPagesBuild: ["POST /repos/{owner}/{repo}/pages/builds"], 3046 setAdminBranchProtection: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"], 3047 setAppAccessRestrictions: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps", {}, { 3048 mapToData: "apps" 3049 }], 3050 setStatusCheckContexts: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts", {}, { 3051 mapToData: "contexts" 3052 }], 3053 setTeamAccessRestrictions: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams", {}, { 3054 mapToData: "teams" 3055 }], 3056 setUserAccessRestrictions: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users", {}, { 3057 mapToData: "users" 3058 }], 3059 testPushWebhook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/tests"], 3060 transfer: ["POST /repos/{owner}/{repo}/transfer"], 3061 update: ["PATCH /repos/{owner}/{repo}"], 3062 updateBranchProtection: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection"], 3063 updateCommitComment: ["PATCH /repos/{owner}/{repo}/comments/{comment_id}"], 3064 updateInformationAboutPagesSite: ["PUT /repos/{owner}/{repo}/pages"], 3065 updateInvitation: ["PATCH /repos/{owner}/{repo}/invitations/{invitation_id}"], 3066 updatePullRequestReviewProtection: ["PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"], 3067 updateRelease: ["PATCH /repos/{owner}/{repo}/releases/{release_id}"], 3068 updateReleaseAsset: ["PATCH /repos/{owner}/{repo}/releases/assets/{asset_id}"], 3069 updateStatusCheckPotection: ["PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"], 3070 updateWebhook: ["PATCH /repos/{owner}/{repo}/hooks/{hook_id}"], 3071 uploadReleaseAsset: ["POST /repos/{owner}/{repo}/releases/{release_id}/assets{?name,label}", { 3072 baseUrl: "https://uploads.github.com" 3073 }] 3074 }, 3075 search: { 3076 code: ["GET /search/code"], 3077 commits: ["GET /search/commits", { 3078 mediaType: { 3079 previews: ["cloak"] 3080 } 3081 }], 3082 issuesAndPullRequests: ["GET /search/issues"], 3083 labels: ["GET /search/labels"], 3084 repos: ["GET /search/repositories"], 3085 topics: ["GET /search/topics", { 3086 mediaType: { 3087 previews: ["mercy"] 3088 } 3089 }], 3090 users: ["GET /search/users"] 3091 }, 3092 teams: { 3093 addOrUpdateMembershipForUserInOrg: ["PUT /orgs/{org}/teams/{team_slug}/memberships/{username}"], 3094 addOrUpdateProjectPermissionsInOrg: ["PUT /orgs/{org}/teams/{team_slug}/projects/{project_id}", { 3095 mediaType: { 3096 previews: ["inertia"] 3097 } 3098 }], 3099 addOrUpdateRepoPermissionsInOrg: ["PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"], 3100 checkPermissionsForProjectInOrg: ["GET /orgs/{org}/teams/{team_slug}/projects/{project_id}", { 3101 mediaType: { 3102 previews: ["inertia"] 3103 } 3104 }], 3105 checkPermissionsForRepoInOrg: ["GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"], 3106 create: ["POST /orgs/{org}/teams"], 3107 createDiscussionCommentInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments"], 3108 createDiscussionInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions"], 3109 deleteDiscussionCommentInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"], 3110 deleteDiscussionInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"], 3111 deleteInOrg: ["DELETE /orgs/{org}/teams/{team_slug}"], 3112 getByName: ["GET /orgs/{org}/teams/{team_slug}"], 3113 getDiscussionCommentInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"], 3114 getDiscussionInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"], 3115 getMembershipForUserInOrg: ["GET /orgs/{org}/teams/{team_slug}/memberships/{username}"], 3116 list: ["GET /orgs/{org}/teams"], 3117 listChildInOrg: ["GET /orgs/{org}/teams/{team_slug}/teams"], 3118 listDiscussionCommentsInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments"], 3119 listDiscussionsInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions"], 3120 listForAuthenticatedUser: ["GET /user/teams"], 3121 listMembersInOrg: ["GET /orgs/{org}/teams/{team_slug}/members"], 3122 listPendingInvitationsInOrg: ["GET /orgs/{org}/teams/{team_slug}/invitations"], 3123 listProjectsInOrg: ["GET /orgs/{org}/teams/{team_slug}/projects", { 3124 mediaType: { 3125 previews: ["inertia"] 3126 } 3127 }], 3128 listReposInOrg: ["GET /orgs/{org}/teams/{team_slug}/repos"], 3129 removeMembershipForUserInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/memberships/{username}"], 3130 removeProjectInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/projects/{project_id}"], 3131 removeRepoInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"], 3132 updateDiscussionCommentInOrg: ["PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"], 3133 updateDiscussionInOrg: ["PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"], 3134 updateInOrg: ["PATCH /orgs/{org}/teams/{team_slug}"] 3135 }, 3136 users: { 3137 addEmailForAuthenticated: ["POST /user/emails"], 3138 block: ["PUT /user/blocks/{username}"], 3139 checkBlocked: ["GET /user/blocks/{username}"], 3140 checkFollowingForUser: ["GET /users/{username}/following/{target_user}"], 3141 checkPersonIsFollowedByAuthenticated: ["GET /user/following/{username}"], 3142 createGpgKeyForAuthenticated: ["POST /user/gpg_keys"], 3143 createPublicSshKeyForAuthenticated: ["POST /user/keys"], 3144 deleteEmailForAuthenticated: ["DELETE /user/emails"], 3145 deleteGpgKeyForAuthenticated: ["DELETE /user/gpg_keys/{gpg_key_id}"], 3146 deletePublicSshKeyForAuthenticated: ["DELETE /user/keys/{key_id}"], 3147 follow: ["PUT /user/following/{username}"], 3148 getAuthenticated: ["GET /user"], 3149 getByUsername: ["GET /users/{username}"], 3150 getContextForUser: ["GET /users/{username}/hovercard"], 3151 getGpgKeyForAuthenticated: ["GET /user/gpg_keys/{gpg_key_id}"], 3152 getPublicSshKeyForAuthenticated: ["GET /user/keys/{key_id}"], 3153 list: ["GET /users"], 3154 listBlockedByAuthenticated: ["GET /user/blocks"], 3155 listEmailsForAuthenticated: ["GET /user/emails"], 3156 listFollowedByAuthenticated: ["GET /user/following"], 3157 listFollowersForAuthenticatedUser: ["GET /user/followers"], 3158 listFollowersForUser: ["GET /users/{username}/followers"], 3159 listFollowingForUser: ["GET /users/{username}/following"], 3160 listGpgKeysForAuthenticated: ["GET /user/gpg_keys"], 3161 listGpgKeysForUser: ["GET /users/{username}/gpg_keys"], 3162 listPublicEmailsForAuthenticated: ["GET /user/public_emails"], 3163 listPublicKeysForUser: ["GET /users/{username}/keys"], 3164 listPublicSshKeysForAuthenticated: ["GET /user/keys"], 3165 setPrimaryEmailVisibilityForAuthenticated: ["PATCH /user/email/visibility"], 3166 unblock: ["DELETE /user/blocks/{username}"], 3167 unfollow: ["DELETE /user/following/{username}"], 3168 updateAuthenticated: ["PATCH /user"] 3169 } 3170 }; 3171 3172 const VERSION = "4.2.0"; 3173 3174 function endpointsToMethods(octokit, endpointsMap) { 3175 const newMethods = {}; 3176 3177 for (const [scope, endpoints] of Object.entries(endpointsMap)) { 3178 for (const [methodName, endpoint] of Object.entries(endpoints)) { 3179 const [route, defaults, decorations] = endpoint; 3180 const [method, url] = route.split(/ /); 3181 const endpointDefaults = Object.assign({ 3182 method, 3183 url 3184 }, defaults); 3185 3186 if (!newMethods[scope]) { 3187 newMethods[scope] = {}; 3188 } 3189 3190 const scopeMethods = newMethods[scope]; 3191 3192 if (decorations) { 3193 scopeMethods[methodName] = decorate(octokit, scope, methodName, endpointDefaults, decorations); 3194 continue; 3195 } 3196 3197 scopeMethods[methodName] = octokit.request.defaults(endpointDefaults); 3198 } 3199 } 3200 3201 return newMethods; 3202 } 3203 3204 function decorate(octokit, scope, methodName, defaults, decorations) { 3205 const requestWithDefaults = octokit.request.defaults(defaults); 3206 /* istanbul ignore next */ 3207 3208 function withDecorations(...args) { 3209 // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488 3210 let options = requestWithDefaults.endpoint.merge(...args); // There are currently no other decorations than `.mapToData` 3211 3212 if (decorations.mapToData) { 3213 options = Object.assign({}, options, { 3214 data: options[decorations.mapToData], 3215 [decorations.mapToData]: undefined 3216 }); 3217 return requestWithDefaults(options); 3218 } 3219 3220 if (decorations.renamed) { 3221 const [newScope, newMethodName] = decorations.renamed; 3222 octokit.log.warn(`octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()`); 3223 } 3224 3225 if (decorations.deprecated) { 3226 octokit.log.warn(decorations.deprecated); 3227 } 3228 3229 if (decorations.renamedParameters) { 3230 // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488 3231 const options = requestWithDefaults.endpoint.merge(...args); 3232 3233 for (const [name, alias] of Object.entries(decorations.renamedParameters)) { 3234 if (name in options) { 3235 octokit.log.warn(`"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias}" instead`); 3236 3237 if (!(alias in options)) { 3238 options[alias] = options[name]; 3239 } 3240 3241 delete options[name]; 3242 } 3243 } 3244 3245 return requestWithDefaults(options); 3246 } // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488 3247 3248 3249 return requestWithDefaults(...args); 3250 } 3251 3252 return Object.assign(withDecorations, requestWithDefaults); 3253 } 3254 3255 /** 3256 * This plugin is a 1:1 copy of internal @octokit/rest plugins. The primary 3257 * goal is to rebuild @octokit/rest on top of @octokit/core. Once that is 3258 * done, we will remove the registerEndpoints methods and return the methods 3259 * directly as with the other plugins. At that point we will also remove the 3260 * legacy workarounds and deprecations. 3261 * 3262 * See the plan at 3263 * https://github.com/octokit/plugin-rest-endpoint-methods.js/pull/1 3264 */ 3265 3266 function restEndpointMethods(octokit) { 3267 return endpointsToMethods(octokit, Endpoints); 3268 } 3269 restEndpointMethods.VERSION = VERSION; 3270 3271 exports.restEndpointMethods = restEndpointMethods; 3272 //# sourceMappingURL=index.js.map 3273 3274 3275 /***/ }), 3276 3277 /***/ 537: 3278 /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 3279 3280 "use strict"; 3281 3282 3283 Object.defineProperty(exports, "__esModule", ({ value: true })); 3284 3285 function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } 3286 3287 var deprecation = __webpack_require__(481); 3288 var once = _interopDefault(__webpack_require__(223)); 3289 3290 const logOnce = once(deprecation => console.warn(deprecation)); 3291 /** 3292 * Error with extra properties to help with debugging 3293 */ 3294 3295 class RequestError extends Error { 3296 constructor(message, statusCode, options) { 3297 super(message); // Maintains proper stack trace (only available on V8) 3298 3299 /* istanbul ignore next */ 3300 3301 if (Error.captureStackTrace) { 3302 Error.captureStackTrace(this, this.constructor); 3303 } 3304 3305 this.name = "HttpError"; 3306 this.status = statusCode; 3307 Object.defineProperty(this, "code", { 3308 get() { 3309 logOnce(new deprecation.Deprecation("[@octokit/request-error] `error.code` is deprecated, use `error.status`.")); 3310 return statusCode; 3311 } 3312 3313 }); 3314 this.headers = options.headers || {}; // redact request credentials without mutating original request options 3315 3316 const requestCopy = Object.assign({}, options.request); 3317 3318 if (options.request.headers.authorization) { 3319 requestCopy.headers = Object.assign({}, options.request.headers, { 3320 authorization: options.request.headers.authorization.replace(/ .*$/, " [REDACTED]") 3321 }); 3322 } 3323 3324 requestCopy.url = requestCopy.url // client_id & client_secret can be passed as URL query parameters to increase rate limit 3325 // see https://developer.github.com/v3/#increasing-the-unauthenticated-rate-limit-for-oauth-applications 3326 .replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]") // OAuth tokens can be passed as URL query parameters, although it is not recommended 3327 // see https://developer.github.com/v3/#oauth2-token-sent-in-a-header 3328 .replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); 3329 this.request = requestCopy; 3330 } 3331 3332 } 3333 3334 exports.RequestError = RequestError; 3335 //# sourceMappingURL=index.js.map 3336 3337 3338 /***/ }), 3339 3340 /***/ 234: 3341 /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 3342 3343 "use strict"; 3344 3345 3346 Object.defineProperty(exports, "__esModule", ({ value: true })); 3347 3348 function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } 3349 3350 var endpoint = __webpack_require__(440); 3351 var universalUserAgent = __webpack_require__(429); 3352 var isPlainObject = __webpack_require__(287); 3353 var nodeFetch = _interopDefault(__webpack_require__(467)); 3354 var requestError = __webpack_require__(537); 3355 3356 const VERSION = "5.4.9"; 3357 3358 function getBufferResponse(response) { 3359 return response.arrayBuffer(); 3360 } 3361 3362 function fetchWrapper(requestOptions) { 3363 if (isPlainObject.isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) { 3364 requestOptions.body = JSON.stringify(requestOptions.body); 3365 } 3366 3367 let headers = {}; 3368 let status; 3369 let url; 3370 const fetch = requestOptions.request && requestOptions.request.fetch || nodeFetch; 3371 return fetch(requestOptions.url, Object.assign({ 3372 method: requestOptions.method, 3373 body: requestOptions.body, 3374 headers: requestOptions.headers, 3375 redirect: requestOptions.redirect 3376 }, requestOptions.request)).then(response => { 3377 url = response.url; 3378 status = response.status; 3379 3380 for (const keyAndValue of response.headers) { 3381 headers[keyAndValue[0]] = keyAndValue[1]; 3382 } 3383 3384 if (status === 204 || status === 205) { 3385 return; 3386 } // GitHub API returns 200 for HEAD requests 3387 3388 3389 if (requestOptions.method === "HEAD") { 3390 if (status < 400) { 3391 return; 3392 } 3393 3394 throw new requestError.RequestError(response.statusText, status, { 3395 headers, 3396 request: requestOptions 3397 }); 3398 } 3399 3400 if (status === 304) { 3401 throw new requestError.RequestError("Not modified", status, { 3402 headers, 3403 request: requestOptions 3404 }); 3405 } 3406 3407 if (status >= 400) { 3408 return response.text().then(message => { 3409 const error = new requestError.RequestError(message, status, { 3410 headers, 3411 request: requestOptions 3412 }); 3413 3414 try { 3415 let responseBody = JSON.parse(error.message); 3416 Object.assign(error, responseBody); 3417 let errors = responseBody.errors; // Assumption `errors` would always be in Array format 3418 3419 error.message = error.message + ": " + errors.map(JSON.stringify).join(", "); 3420 } catch (e) {// ignore, see octokit/rest.js#684 3421 } 3422 3423 throw error; 3424 }); 3425 } 3426 3427 const contentType = response.headers.get("content-type"); 3428 3429 if (/application\/json/.test(contentType)) { 3430 return response.json(); 3431 } 3432 3433 if (!contentType || /^text\/|charset=utf-8$/.test(contentType)) { 3434 return response.text(); 3435 } 3436 3437 return getBufferResponse(response); 3438 }).then(data => { 3439 return { 3440 status, 3441 url, 3442 headers, 3443 data 3444 }; 3445 }).catch(error => { 3446 if (error instanceof requestError.RequestError) { 3447 throw error; 3448 } 3449 3450 throw new requestError.RequestError(error.message, 500, { 3451 headers, 3452 request: requestOptions 3453 }); 3454 }); 3455 } 3456 3457 function withDefaults(oldEndpoint, newDefaults) { 3458 const endpoint = oldEndpoint.defaults(newDefaults); 3459 3460 const newApi = function (route, parameters) { 3461 const endpointOptions = endpoint.merge(route, parameters); 3462 3463 if (!endpointOptions.request || !endpointOptions.request.hook) { 3464 return fetchWrapper(endpoint.parse(endpointOptions)); 3465 } 3466 3467 const request = (route, parameters) => { 3468 return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters))); 3469 }; 3470 3471 Object.assign(request, { 3472 endpoint, 3473 defaults: withDefaults.bind(null, endpoint) 3474 }); 3475 return endpointOptions.request.hook(request, endpointOptions); 3476 }; 3477 3478 return Object.assign(newApi, { 3479 endpoint, 3480 defaults: withDefaults.bind(null, endpoint) 3481 }); 3482 } 3483 3484 const request = withDefaults(endpoint.endpoint, { 3485 headers: { 3486 "user-agent": `octokit-request.js/${VERSION} ${universalUserAgent.getUserAgent()}` 3487 } 3488 }); 3489 3490 exports.request = request; 3491 //# sourceMappingURL=index.js.map 3492 3493 3494 /***/ }), 3495 3496 /***/ 682: 3497 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 3498 3499 var register = __webpack_require__(670) 3500 var addHook = __webpack_require__(549) 3501 var removeHook = __webpack_require__(819) 3502 3503 // bind with array of arguments: https://stackoverflow.com/a/21792913 3504 var bind = Function.bind 3505 var bindable = bind.bind(bind) 3506 3507 function bindApi (hook, state, name) { 3508 var removeHookRef = bindable(removeHook, null).apply(null, name ? [state, name] : [state]) 3509 hook.api = { remove: removeHookRef } 3510 hook.remove = removeHookRef 3511 3512 ;['before', 'error', 'after', 'wrap'].forEach(function (kind) { 3513 var args = name ? [state, kind, name] : [state, kind] 3514 hook[kind] = hook.api[kind] = bindable(addHook, null).apply(null, args) 3515 }) 3516 } 3517 3518 function HookSingular () { 3519 var singularHookName = 'h' 3520 var singularHookState = { 3521 registry: {} 3522 } 3523 var singularHook = register.bind(null, singularHookState, singularHookName) 3524 bindApi(singularHook, singularHookState, singularHookName) 3525 return singularHook 3526 } 3527 3528 function HookCollection () { 3529 var state = { 3530 registry: {} 3531 } 3532 3533 var hook = register.bind(null, state) 3534 bindApi(hook, state) 3535 3536 return hook 3537 } 3538 3539 var collectionHookDeprecationMessageDisplayed = false 3540 function Hook () { 3541 if (!collectionHookDeprecationMessageDisplayed) { 3542 console.warn('[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4') 3543 collectionHookDeprecationMessageDisplayed = true 3544 } 3545 return HookCollection() 3546 } 3547 3548 Hook.Singular = HookSingular.bind() 3549 Hook.Collection = HookCollection.bind() 3550 3551 module.exports = Hook 3552 // expose constructors as a named property for TypeScript 3553 module.exports.Hook = Hook 3554 module.exports.Singular = Hook.Singular 3555 module.exports.Collection = Hook.Collection 3556 3557 3558 /***/ }), 3559 3560 /***/ 549: 3561 /***/ ((module) => { 3562 3563 module.exports = addHook 3564 3565 function addHook (state, kind, name, hook) { 3566 var orig = hook 3567 if (!state.registry[name]) { 3568 state.registry[name] = [] 3569 } 3570 3571 if (kind === 'before') { 3572 hook = function (method, options) { 3573 return Promise.resolve() 3574 .then(orig.bind(null, options)) 3575 .then(method.bind(null, options)) 3576 } 3577 } 3578 3579 if (kind === 'after') { 3580 hook = function (method, options) { 3581 var result 3582 return Promise.resolve() 3583 .then(method.bind(null, options)) 3584 .then(function (result_) { 3585 result = result_ 3586 return orig(result, options) 3587 }) 3588 .then(function () { 3589 return result 3590 }) 3591 } 3592 } 3593 3594 if (kind === 'error') { 3595 hook = function (method, options) { 3596 return Promise.resolve() 3597 .then(method.bind(null, options)) 3598 .catch(function (error) { 3599 return orig(error, options) 3600 }) 3601 } 3602 } 3603 3604 state.registry[name].push({ 3605 hook: hook, 3606 orig: orig 3607 }) 3608 } 3609 3610 3611 /***/ }), 3612 3613 /***/ 670: 3614 /***/ ((module) => { 3615 3616 module.exports = register 3617 3618 function register (state, name, method, options) { 3619 if (typeof method !== 'function') { 3620 throw new Error('method for before hook must be a function') 3621 } 3622 3623 if (!options) { 3624 options = {} 3625 } 3626 3627 if (Array.isArray(name)) { 3628 return name.reverse().reduce(function (callback, name) { 3629 return register.bind(null, state, name, callback, options) 3630 }, method)() 3631 } 3632 3633 return Promise.resolve() 3634 .then(function () { 3635 if (!state.registry[name]) { 3636 return method(options) 3637 } 3638 3639 return (state.registry[name]).reduce(function (method, registered) { 3640 return registered.hook.bind(null, method, options) 3641 }, method)() 3642 }) 3643 } 3644 3645 3646 /***/ }), 3647 3648 /***/ 819: 3649 /***/ ((module) => { 3650 3651 module.exports = removeHook 3652 3653 function removeHook (state, name, method) { 3654 if (!state.registry[name]) { 3655 return 3656 } 3657 3658 var index = state.registry[name] 3659 .map(function (registered) { return registered.orig }) 3660 .indexOf(method) 3661 3662 if (index === -1) { 3663 return 3664 } 3665 3666 state.registry[name].splice(index, 1) 3667 } 3668 3669 3670 /***/ }), 3671 3672 /***/ 481: 3673 /***/ ((__unused_webpack_module, exports) => { 3674 3675 "use strict"; 3676 3677 3678 Object.defineProperty(exports, "__esModule", ({ value: true })); 3679 3680 class Deprecation extends Error { 3681 constructor(message) { 3682 super(message); // Maintains proper stack trace (only available on V8) 3683 3684 /* istanbul ignore next */ 3685 3686 if (Error.captureStackTrace) { 3687 Error.captureStackTrace(this, this.constructor); 3688 } 3689 3690 this.name = 'Deprecation'; 3691 } 3692 3693 } 3694 3695 exports.Deprecation = Deprecation; 3696 3697 3698 /***/ }), 3699 3700 /***/ 287: 3701 /***/ ((__unused_webpack_module, exports) => { 3702 3703 "use strict"; 3704 3705 3706 Object.defineProperty(exports, "__esModule", ({ value: true })); 3707 3708 /*! 3709 * is-plain-object <https://github.com/jonschlinkert/is-plain-object> 3710 * 3711 * Copyright (c) 2014-2017, Jon Schlinkert. 3712 * Released under the MIT License. 3713 */ 3714 3715 function isObject(o) { 3716 return Object.prototype.toString.call(o) === '[object Object]'; 3717 } 3718 3719 function isPlainObject(o) { 3720 var ctor,prot; 3721 3722 if (isObject(o) === false) return false; 3723 3724 // If has modified constructor 3725 ctor = o.constructor; 3726 if (ctor === undefined) return true; 3727 3728 // If has modified prototype 3729 prot = ctor.prototype; 3730 if (isObject(prot) === false) return false; 3731 3732 // If constructor does not have an Object-specific method 3733 if (prot.hasOwnProperty('isPrototypeOf') === false) { 3734 return false; 3735 } 3736 3737 // Most likely a plain Object 3738 return true; 3739 } 3740 3741 exports.isPlainObject = isPlainObject; 3742 3743 3744 /***/ }), 3745 3746 /***/ 467: 3747 /***/ ((module, exports, __webpack_require__) => { 3748 3749 "use strict"; 3750 3751 3752 Object.defineProperty(exports, "__esModule", ({ value: true })); 3753 3754 function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } 3755 3756 var Stream = _interopDefault(__webpack_require__(413)); 3757 var http = _interopDefault(__webpack_require__(605)); 3758 var Url = _interopDefault(__webpack_require__(835)); 3759 var https = _interopDefault(__webpack_require__(211)); 3760 var zlib = _interopDefault(__webpack_require__(761)); 3761 3762 // Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js 3763 3764 // fix for "Readable" isn't a named export issue 3765 const Readable = Stream.Readable; 3766 3767 const BUFFER = Symbol('buffer'); 3768 const TYPE = Symbol('type'); 3769 3770 class Blob { 3771 constructor() { 3772 this[TYPE] = ''; 3773 3774 const blobParts = arguments[0]; 3775 const options = arguments[1]; 3776 3777 const buffers = []; 3778 let size = 0; 3779 3780 if (blobParts) { 3781 const a = blobParts; 3782 const length = Number(a.length); 3783 for (let i = 0; i < length; i++) { 3784 const element = a[i]; 3785 let buffer; 3786 if (element instanceof Buffer) { 3787 buffer = element; 3788 } else if (ArrayBuffer.isView(element)) { 3789 buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); 3790 } else if (element instanceof ArrayBuffer) { 3791 buffer = Buffer.from(element); 3792 } else if (element instanceof Blob) { 3793 buffer = element[BUFFER]; 3794 } else { 3795 buffer = Buffer.from(typeof element === 'string' ? element : String(element)); 3796 } 3797 size += buffer.length; 3798 buffers.push(buffer); 3799 } 3800 } 3801 3802 this[BUFFER] = Buffer.concat(buffers); 3803 3804 let type = options && options.type !== undefined && String(options.type).toLowerCase(); 3805 if (type && !/[^\u0020-\u007E]/.test(type)) { 3806 this[TYPE] = type; 3807 } 3808 } 3809 get size() { 3810 return this[BUFFER].length; 3811 } 3812 get type() { 3813 return this[TYPE]; 3814 } 3815 text() { 3816 return Promise.resolve(this[BUFFER].toString()); 3817 } 3818 arrayBuffer() { 3819 const buf = this[BUFFER]; 3820 const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); 3821 return Promise.resolve(ab); 3822 } 3823 stream() { 3824 const readable = new Readable(); 3825 readable._read = function () {}; 3826 readable.push(this[BUFFER]); 3827 readable.push(null); 3828 return readable; 3829 } 3830 toString() { 3831 return '[object Blob]'; 3832 } 3833 slice() { 3834 const size = this.size; 3835 3836 const start = arguments[0]; 3837 const end = arguments[1]; 3838 let relativeStart, relativeEnd; 3839 if (start === undefined) { 3840 relativeStart = 0; 3841 } else if (start < 0) { 3842 relativeStart = Math.max(size + start, 0); 3843 } else { 3844 relativeStart = Math.min(start, size); 3845 } 3846 if (end === undefined) { 3847 relativeEnd = size; 3848 } else if (end < 0) { 3849 relativeEnd = Math.max(size + end, 0); 3850 } else { 3851 relativeEnd = Math.min(end, size); 3852 } 3853 const span = Math.max(relativeEnd - relativeStart, 0); 3854 3855 const buffer = this[BUFFER]; 3856 const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); 3857 const blob = new Blob([], { type: arguments[2] }); 3858 blob[BUFFER] = slicedBuffer; 3859 return blob; 3860 } 3861 } 3862 3863 Object.defineProperties(Blob.prototype, { 3864 size: { enumerable: true }, 3865 type: { enumerable: true }, 3866 slice: { enumerable: true } 3867 }); 3868 3869 Object.defineProperty(Blob.prototype, Symbol.toStringTag, { 3870 value: 'Blob', 3871 writable: false, 3872 enumerable: false, 3873 configurable: true 3874 }); 3875 3876 /** 3877 * fetch-error.js 3878 * 3879 * FetchError interface for operational errors 3880 */ 3881 3882 /** 3883 * Create FetchError instance 3884 * 3885 * @param String message Error message for human 3886 * @param String type Error type for machine 3887 * @param String systemError For Node.js system error 3888 * @return FetchError 3889 */ 3890 function FetchError(message, type, systemError) { 3891 Error.call(this, message); 3892 3893 this.message = message; 3894 this.type = type; 3895 3896 // when err.type is `system`, err.code contains system error code 3897 if (systemError) { 3898 this.code = this.errno = systemError.code; 3899 } 3900 3901 // hide custom error implementation details from end-users 3902 Error.captureStackTrace(this, this.constructor); 3903 } 3904 3905 FetchError.prototype = Object.create(Error.prototype); 3906 FetchError.prototype.constructor = FetchError; 3907 FetchError.prototype.name = 'FetchError'; 3908 3909 let convert; 3910 try { 3911 convert = __webpack_require__(877).convert; 3912 } catch (e) {} 3913 3914 const INTERNALS = Symbol('Body internals'); 3915 3916 // fix an issue where "PassThrough" isn't a named export for node <10 3917 const PassThrough = Stream.PassThrough; 3918 3919 /** 3920 * Body mixin 3921 * 3922 * Ref: https://fetch.spec.whatwg.org/#body 3923 * 3924 * @param Stream body Readable stream 3925 * @param Object opts Response options 3926 * @return Void 3927 */ 3928 function Body(body) { 3929 var _this = this; 3930 3931 var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, 3932 _ref$size = _ref.size; 3933 3934 let size = _ref$size === undefined ? 0 : _ref$size; 3935 var _ref$timeout = _ref.timeout; 3936 let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; 3937 3938 if (body == null) { 3939 // body is undefined or null 3940 body = null; 3941 } else if (isURLSearchParams(body)) { 3942 // body is a URLSearchParams 3943 body = Buffer.from(body.toString()); 3944 } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { 3945 // body is ArrayBuffer 3946 body = Buffer.from(body); 3947 } else if (ArrayBuffer.isView(body)) { 3948 // body is ArrayBufferView 3949 body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); 3950 } else if (body instanceof Stream) ; else { 3951 // none of the above 3952 // coerce to string then buffer 3953 body = Buffer.from(String(body)); 3954 } 3955 this[INTERNALS] = { 3956 body, 3957 disturbed: false, 3958 error: null 3959 }; 3960 this.size = size; 3961 this.timeout = timeout; 3962 3963 if (body instanceof Stream) { 3964 body.on('error', function (err) { 3965 const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); 3966 _this[INTERNALS].error = error; 3967 }); 3968 } 3969 } 3970 3971 Body.prototype = { 3972 get body() { 3973 return this[INTERNALS].body; 3974 }, 3975 3976 get bodyUsed() { 3977 return this[INTERNALS].disturbed; 3978 }, 3979 3980 /** 3981 * Decode response as ArrayBuffer 3982 * 3983 * @return Promise 3984 */ 3985 arrayBuffer() { 3986 return consumeBody.call(this).then(function (buf) { 3987 return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); 3988 }); 3989 }, 3990 3991 /** 3992 * Return raw response as Blob 3993 * 3994 * @return Promise 3995 */ 3996 blob() { 3997 let ct = this.headers && this.headers.get('content-type') || ''; 3998 return consumeBody.call(this).then(function (buf) { 3999 return Object.assign( 4000 // Prevent copying 4001 new Blob([], { 4002 type: ct.toLowerCase() 4003 }), { 4004 [BUFFER]: buf 4005 }); 4006 }); 4007 }, 4008 4009 /** 4010 * Decode response as json 4011 * 4012 * @return Promise 4013 */ 4014 json() { 4015 var _this2 = this; 4016 4017 return consumeBody.call(this).then(function (buffer) { 4018 try { 4019 return JSON.parse(buffer.toString()); 4020 } catch (err) { 4021 return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); 4022 } 4023 }); 4024 }, 4025 4026 /** 4027 * Decode response as text 4028 * 4029 * @return Promise 4030 */ 4031 text() { 4032 return consumeBody.call(this).then(function (buffer) { 4033 return buffer.toString(); 4034 }); 4035 }, 4036 4037 /** 4038 * Decode response as buffer (non-spec api) 4039 * 4040 * @return Promise 4041 */ 4042 buffer() { 4043 return consumeBody.call(this); 4044 }, 4045 4046 /** 4047 * Decode response as text, while automatically detecting the encoding and 4048 * trying to decode to UTF-8 (non-spec api) 4049 * 4050 * @return Promise 4051 */ 4052 textConverted() { 4053 var _this3 = this; 4054 4055 return consumeBody.call(this).then(function (buffer) { 4056 return convertBody(buffer, _this3.headers); 4057 }); 4058 } 4059 }; 4060 4061 // In browsers, all properties are enumerable. 4062 Object.defineProperties(Body.prototype, { 4063 body: { enumerable: true }, 4064 bodyUsed: { enumerable: true }, 4065 arrayBuffer: { enumerable: true }, 4066 blob: { enumerable: true }, 4067 json: { enumerable: true }, 4068 text: { enumerable: true } 4069 }); 4070 4071 Body.mixIn = function (proto) { 4072 for (const name of Object.getOwnPropertyNames(Body.prototype)) { 4073 // istanbul ignore else: future proof 4074 if (!(name in proto)) { 4075 const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); 4076 Object.defineProperty(proto, name, desc); 4077 } 4078 } 4079 }; 4080 4081 /** 4082 * Consume and convert an entire Body to a Buffer. 4083 * 4084 * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body 4085 * 4086 * @return Promise 4087 */ 4088 function consumeBody() { 4089 var _this4 = this; 4090 4091 if (this[INTERNALS].disturbed) { 4092 return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); 4093 } 4094 4095 this[INTERNALS].disturbed = true; 4096 4097 if (this[INTERNALS].error) { 4098 return Body.Promise.reject(this[INTERNALS].error); 4099 } 4100 4101 let body = this.body; 4102 4103 // body is null 4104 if (body === null) { 4105 return Body.Promise.resolve(Buffer.alloc(0)); 4106 } 4107 4108 // body is blob 4109 if (isBlob(body)) { 4110 body = body.stream(); 4111 } 4112 4113 // body is buffer 4114 if (Buffer.isBuffer(body)) { 4115 return Body.Promise.resolve(body); 4116 } 4117 4118 // istanbul ignore if: should never happen 4119 if (!(body instanceof Stream)) { 4120 return Body.Promise.resolve(Buffer.alloc(0)); 4121 } 4122 4123 // body is stream 4124 // get ready to actually consume the body 4125 let accum = []; 4126 let accumBytes = 0; 4127 let abort = false; 4128 4129 return new Body.Promise(function (resolve, reject) { 4130 let resTimeout; 4131 4132 // allow timeout on slow response body 4133 if (_this4.timeout) { 4134 resTimeout = setTimeout(function () { 4135 abort = true; 4136 reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); 4137 }, _this4.timeout); 4138 } 4139 4140 // handle stream errors 4141 body.on('error', function (err) { 4142 if (err.name === 'AbortError') { 4143 // if the request was aborted, reject with this Error 4144 abort = true; 4145 reject(err); 4146 } else { 4147 // other errors, such as incorrect content-encoding 4148 reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); 4149 } 4150 }); 4151 4152 body.on('data', function (chunk) { 4153 if (abort || chunk === null) { 4154 return; 4155 } 4156 4157 if (_this4.size && accumBytes + chunk.length > _this4.size) { 4158 abort = true; 4159 reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); 4160 return; 4161 } 4162 4163 accumBytes += chunk.length; 4164 accum.push(chunk); 4165 }); 4166 4167 body.on('end', function () { 4168 if (abort) { 4169 return; 4170 } 4171 4172 clearTimeout(resTimeout); 4173 4174 try { 4175 resolve(Buffer.concat(accum, accumBytes)); 4176 } catch (err) { 4177 // handle streams that have accumulated too much data (issue #414) 4178 reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); 4179 } 4180 }); 4181 }); 4182 } 4183 4184 /** 4185 * Detect buffer encoding and convert to target encoding 4186 * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding 4187 * 4188 * @param Buffer buffer Incoming buffer 4189 * @param String encoding Target encoding 4190 * @return String 4191 */ 4192 function convertBody(buffer, headers) { 4193 if (typeof convert !== 'function') { 4194 throw new Error('The package `encoding` must be installed to use the textConverted() function'); 4195 } 4196 4197 const ct = headers.get('content-type'); 4198 let charset = 'utf-8'; 4199 let res, str; 4200 4201 // header 4202 if (ct) { 4203 res = /charset=([^;]*)/i.exec(ct); 4204 } 4205 4206 // no charset in content type, peek at response body for at most 1024 bytes 4207 str = buffer.slice(0, 1024).toString(); 4208 4209 // html5 4210 if (!res && str) { 4211 res = /<meta.+?charset=(['"])(.+?)\1/i.exec(str); 4212 } 4213 4214 // html4 4215 if (!res && str) { 4216 res = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(str); 4217 if (!res) { 4218 res = /<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(str); 4219 if (res) { 4220 res.pop(); // drop last quote 4221 } 4222 } 4223 4224 if (res) { 4225 res = /charset=(.*)/i.exec(res.pop()); 4226 } 4227 } 4228 4229 // xml 4230 if (!res && str) { 4231 res = /<\?xml.+?encoding=(['"])(.+?)\1/i.exec(str); 4232 } 4233 4234 // found charset 4235 if (res) { 4236 charset = res.pop(); 4237 4238 // prevent decode issues when sites use incorrect encoding 4239 // ref: https://hsivonen.fi/encoding-menu/ 4240 if (charset === 'gb2312' || charset === 'gbk') { 4241 charset = 'gb18030'; 4242 } 4243 } 4244 4245 // turn raw buffers into a single utf-8 buffer 4246 return convert(buffer, 'UTF-8', charset).toString(); 4247 } 4248 4249 /** 4250 * Detect a URLSearchParams object 4251 * ref: https://github.com/bitinn/node-fetch/issues/296#issuecomment-307598143 4252 * 4253 * @param Object obj Object to detect by type or brand 4254 * @return String 4255 */ 4256 function isURLSearchParams(obj) { 4257 // Duck-typing as a necessary condition. 4258 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') { 4259 return false; 4260 } 4261 4262 // Brand-checking and more duck-typing as optional condition. 4263 return obj.constructor.name === 'URLSearchParams' || Object.prototype.toString.call(obj) === '[object URLSearchParams]' || typeof obj.sort === 'function'; 4264 } 4265 4266 /** 4267 * Check if `obj` is a W3C `Blob` object (which `File` inherits from) 4268 * @param {*} obj 4269 * @return {boolean} 4270 */ 4271 function isBlob(obj) { 4272 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]); 4273 } 4274 4275 /** 4276 * Clone body given Res/Req instance 4277 * 4278 * @param Mixed instance Response or Request instance 4279 * @return Mixed 4280 */ 4281 function clone(instance) { 4282 let p1, p2; 4283 let body = instance.body; 4284 4285 // don't allow cloning a used body 4286 if (instance.bodyUsed) { 4287 throw new Error('cannot clone body after it is used'); 4288 } 4289 4290 // check that body is a stream and not form-data object 4291 // note: we can't clone the form-data object without having it as a dependency 4292 if (body instanceof Stream && typeof body.getBoundary !== 'function') { 4293 // tee instance body 4294 p1 = new PassThrough(); 4295 p2 = new PassThrough(); 4296 body.pipe(p1); 4297 body.pipe(p2); 4298 // set instance body to teed body and return the other teed body 4299 instance[INTERNALS].body = p1; 4300 body = p2; 4301 } 4302 4303 return body; 4304 } 4305 4306 /** 4307 * Performs the operation "extract a `Content-Type` value from |object|" as 4308 * specified in the specification: 4309 * https://fetch.spec.whatwg.org/#concept-bodyinit-extract 4310 * 4311 * This function assumes that instance.body is present. 4312 * 4313 * @param Mixed instance Any options.body input 4314 */ 4315 function extractContentType(body) { 4316 if (body === null) { 4317 // body is null 4318 return null; 4319 } else if (typeof body === 'string') { 4320 // body is string 4321 return 'text/plain;charset=UTF-8'; 4322 } else if (isURLSearchParams(body)) { 4323 // body is a URLSearchParams 4324 return 'application/x-www-form-urlencoded;charset=UTF-8'; 4325 } else if (isBlob(body)) { 4326 // body is blob 4327 return body.type || null; 4328 } else if (Buffer.isBuffer(body)) { 4329 // body is buffer 4330 return null; 4331 } else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { 4332 // body is ArrayBuffer 4333 return null; 4334 } else if (ArrayBuffer.isView(body)) { 4335 // body is ArrayBufferView 4336 return null; 4337 } else if (typeof body.getBoundary === 'function') { 4338 // detect form data input from form-data module 4339 return `multipart/form-data;boundary=${body.getBoundary()}`; 4340 } else if (body instanceof Stream) { 4341 // body is stream 4342 // can't really do much about this 4343 return null; 4344 } else { 4345 // Body constructor defaults other things to string 4346 return 'text/plain;charset=UTF-8'; 4347 } 4348 } 4349 4350 /** 4351 * The Fetch Standard treats this as if "total bytes" is a property on the body. 4352 * For us, we have to explicitly get it with a function. 4353 * 4354 * ref: https://fetch.spec.whatwg.org/#concept-body-total-bytes 4355 * 4356 * @param Body instance Instance of Body 4357 * @return Number? Number of bytes, or null if not possible 4358 */ 4359 function getTotalBytes(instance) { 4360 const body = instance.body; 4361 4362 4363 if (body === null) { 4364 // body is null 4365 return 0; 4366 } else if (isBlob(body)) { 4367 return body.size; 4368 } else if (Buffer.isBuffer(body)) { 4369 // body is buffer 4370 return body.length; 4371 } else if (body && typeof body.getLengthSync === 'function') { 4372 // detect form data input from form-data module 4373 if (body._lengthRetrievers && body._lengthRetrievers.length == 0 || // 1.x 4374 body.hasKnownLength && body.hasKnownLength()) { 4375 // 2.x 4376 return body.getLengthSync(); 4377 } 4378 return null; 4379 } else { 4380 // body is stream 4381 return null; 4382 } 4383 } 4384 4385 /** 4386 * Write a Body to a Node.js WritableStream (e.g. http.Request) object. 4387 * 4388 * @param Body instance Instance of Body 4389 * @return Void 4390 */ 4391 function writeToStream(dest, instance) { 4392 const body = instance.body; 4393 4394 4395 if (body === null) { 4396 // body is null 4397 dest.end(); 4398 } else if (isBlob(body)) { 4399 body.stream().pipe(dest); 4400 } else if (Buffer.isBuffer(body)) { 4401 // body is buffer 4402 dest.write(body); 4403 dest.end(); 4404 } else { 4405 // body is stream 4406 body.pipe(dest); 4407 } 4408 } 4409 4410 // expose Promise 4411 Body.Promise = global.Promise; 4412 4413 /** 4414 * headers.js 4415 * 4416 * Headers class offers convenient helpers 4417 */ 4418 4419 const invalidTokenRegex = /[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/; 4420 const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/; 4421 4422 function validateName(name) { 4423 name = `${name}`; 4424 if (invalidTokenRegex.test(name) || name === '') { 4425 throw new TypeError(`${name} is not a legal HTTP header name`); 4426 } 4427 } 4428 4429 function validateValue(value) { 4430 value = `${value}`; 4431 if (invalidHeaderCharRegex.test(value)) { 4432 throw new TypeError(`${value} is not a legal HTTP header value`); 4433 } 4434 } 4435 4436 /** 4437 * Find the key in the map object given a header name. 4438 * 4439 * Returns undefined if not found. 4440 * 4441 * @param String name Header name 4442 * @return String|Undefined 4443 */ 4444 function find(map, name) { 4445 name = name.toLowerCase(); 4446 for (const key in map) { 4447 if (key.toLowerCase() === name) { 4448 return key; 4449 } 4450 } 4451 return undefined; 4452 } 4453 4454 const MAP = Symbol('map'); 4455 class Headers { 4456 /** 4457 * Headers class 4458 * 4459 * @param Object headers Response headers 4460 * @return Void 4461 */ 4462 constructor() { 4463 let init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined; 4464 4465 this[MAP] = Object.create(null); 4466 4467 if (init instanceof Headers) { 4468 const rawHeaders = init.raw(); 4469 const headerNames = Object.keys(rawHeaders); 4470 4471 for (const headerName of headerNames) { 4472 for (const value of rawHeaders[headerName]) { 4473 this.append(headerName, value); 4474 } 4475 } 4476 4477 return; 4478 } 4479 4480 // We don't worry about converting prop to ByteString here as append() 4481 // will handle it. 4482 if (init == null) ; else if (typeof init === 'object') { 4483 const method = init[Symbol.iterator]; 4484 if (method != null) { 4485 if (typeof method !== 'function') { 4486 throw new TypeError('Header pairs must be iterable'); 4487 } 4488 4489 // sequence<sequence<ByteString>> 4490 // Note: per spec we have to first exhaust the lists then process them 4491 const pairs = []; 4492 for (const pair of init) { 4493 if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { 4494 throw new TypeError('Each header pair must be iterable'); 4495 } 4496 pairs.push(Array.from(pair)); 4497 } 4498 4499 for (const pair of pairs) { 4500 if (pair.length !== 2) { 4501 throw new TypeError('Each header pair must be a name/value tuple'); 4502 } 4503 this.append(pair[0], pair[1]); 4504 } 4505 } else { 4506 // record<ByteString, ByteString> 4507 for (const key of Object.keys(init)) { 4508 const value = init[key]; 4509 this.append(key, value); 4510 } 4511 } 4512 } else { 4513 throw new TypeError('Provided initializer must be an object'); 4514 } 4515 } 4516 4517 /** 4518 * Return combined header value given name 4519 * 4520 * @param String name Header name 4521 * @return Mixed 4522 */ 4523 get(name) { 4524 name = `${name}`; 4525 validateName(name); 4526 const key = find(this[MAP], name); 4527 if (key === undefined) { 4528 return null; 4529 } 4530 4531 return this[MAP][key].join(', '); 4532 } 4533 4534 /** 4535 * Iterate over all headers 4536 * 4537 * @param Function callback Executed for each item with parameters (value, name, thisArg) 4538 * @param Boolean thisArg `this` context for callback function 4539 * @return Void 4540 */ 4541 forEach(callback) { 4542 let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; 4543 4544 let pairs = getHeaders(this); 4545 let i = 0; 4546 while (i < pairs.length) { 4547 var _pairs$i = pairs[i]; 4548 const name = _pairs$i[0], 4549 value = _pairs$i[1]; 4550 4551 callback.call(thisArg, value, name, this); 4552 pairs = getHeaders(this); 4553 i++; 4554 } 4555 } 4556 4557 /** 4558 * Overwrite header values given name 4559 * 4560 * @param String name Header name 4561 * @param String value Header value 4562 * @return Void 4563 */ 4564 set(name, value) { 4565 name = `${name}`; 4566 value = `${value}`; 4567 validateName(name); 4568 validateValue(value); 4569 const key = find(this[MAP], name); 4570 this[MAP][key !== undefined ? key : name] = [value]; 4571 } 4572 4573 /** 4574 * Append a value onto existing header 4575 * 4576 * @param String name Header name 4577 * @param String value Header value 4578 * @return Void 4579 */ 4580 append(name, value) { 4581 name = `${name}`; 4582 value = `${value}`; 4583 validateName(name); 4584 validateValue(value); 4585 const key = find(this[MAP], name); 4586 if (key !== undefined) { 4587 this[MAP][key].push(value); 4588 } else { 4589 this[MAP][name] = [value]; 4590 } 4591 } 4592 4593 /** 4594 * Check for header name existence 4595 * 4596 * @param String name Header name 4597 * @return Boolean 4598 */ 4599 has(name) { 4600 name = `${name}`; 4601 validateName(name); 4602 return find(this[MAP], name) !== undefined; 4603 } 4604 4605 /** 4606 * Delete all header values given name 4607 * 4608 * @param String name Header name 4609 * @return Void 4610 */ 4611 delete(name) { 4612 name = `${name}`; 4613 validateName(name); 4614 const key = find(this[MAP], name); 4615 if (key !== undefined) { 4616 delete this[MAP][key]; 4617 } 4618 } 4619 4620 /** 4621 * Return raw headers (non-spec api) 4622 * 4623 * @return Object 4624 */ 4625 raw() { 4626 return this[MAP]; 4627 } 4628 4629 /** 4630 * Get an iterator on keys. 4631 * 4632 * @return Iterator 4633 */ 4634 keys() { 4635 return createHeadersIterator(this, 'key'); 4636 } 4637 4638 /** 4639 * Get an iterator on values. 4640 * 4641 * @return Iterator 4642 */ 4643 values() { 4644 return createHeadersIterator(this, 'value'); 4645 } 4646 4647 /** 4648 * Get an iterator on entries. 4649 * 4650 * This is the default iterator of the Headers object. 4651 * 4652 * @return Iterator 4653 */ 4654 [Symbol.iterator]() { 4655 return createHeadersIterator(this, 'key+value'); 4656 } 4657 } 4658 Headers.prototype.entries = Headers.prototype[Symbol.iterator]; 4659 4660 Object.defineProperty(Headers.prototype, Symbol.toStringTag, { 4661 value: 'Headers', 4662 writable: false, 4663 enumerable: false, 4664 configurable: true 4665 }); 4666 4667 Object.defineProperties(Headers.prototype, { 4668 get: { enumerable: true }, 4669 forEach: { enumerable: true }, 4670 set: { enumerable: true }, 4671 append: { enumerable: true }, 4672 has: { enumerable: true }, 4673 delete: { enumerable: true }, 4674 keys: { enumerable: true }, 4675 values: { enumerable: true }, 4676 entries: { enumerable: true } 4677 }); 4678 4679 function getHeaders(headers) { 4680 let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; 4681 4682 const keys = Object.keys(headers[MAP]).sort(); 4683 return keys.map(kind === 'key' ? function (k) { 4684 return k.toLowerCase(); 4685 } : kind === 'value' ? function (k) { 4686 return headers[MAP][k].join(', '); 4687 } : function (k) { 4688 return [k.toLowerCase(), headers[MAP][k].join(', ')]; 4689 }); 4690 } 4691 4692 const INTERNAL = Symbol('internal'); 4693 4694 function createHeadersIterator(target, kind) { 4695 const iterator = Object.create(HeadersIteratorPrototype); 4696 iterator[INTERNAL] = { 4697 target, 4698 kind, 4699 index: 0 4700 }; 4701 return iterator; 4702 } 4703 4704 const HeadersIteratorPrototype = Object.setPrototypeOf({ 4705 next() { 4706 // istanbul ignore if 4707 if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { 4708 throw new TypeError('Value of `this` is not a HeadersIterator'); 4709 } 4710 4711 var _INTERNAL = this[INTERNAL]; 4712 const target = _INTERNAL.target, 4713 kind = _INTERNAL.kind, 4714 index = _INTERNAL.index; 4715 4716 const values = getHeaders(target, kind); 4717 const len = values.length; 4718 if (index >= len) { 4719 return { 4720 value: undefined, 4721 done: true 4722 }; 4723 } 4724 4725 this[INTERNAL].index = index + 1; 4726 4727 return { 4728 value: values[index], 4729 done: false 4730 }; 4731 } 4732 }, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); 4733 4734 Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { 4735 value: 'HeadersIterator', 4736 writable: false, 4737 enumerable: false, 4738 configurable: true 4739 }); 4740 4741 /** 4742 * Export the Headers object in a form that Node.js can consume. 4743 * 4744 * @param Headers headers 4745 * @return Object 4746 */ 4747 function exportNodeCompatibleHeaders(headers) { 4748 const obj = Object.assign({ __proto__: null }, headers[MAP]); 4749 4750 // http.request() only supports string as Host header. This hack makes 4751 // specifying custom Host header possible. 4752 const hostHeaderKey = find(headers[MAP], 'Host'); 4753 if (hostHeaderKey !== undefined) { 4754 obj[hostHeaderKey] = obj[hostHeaderKey][0]; 4755 } 4756 4757 return obj; 4758 } 4759 4760 /** 4761 * Create a Headers object from an object of headers, ignoring those that do 4762 * not conform to HTTP grammar productions. 4763 * 4764 * @param Object obj Object of headers 4765 * @return Headers 4766 */ 4767 function createHeadersLenient(obj) { 4768 const headers = new Headers(); 4769 for (const name of Object.keys(obj)) { 4770 if (invalidTokenRegex.test(name)) { 4771 continue; 4772 } 4773 if (Array.isArray(obj[name])) { 4774 for (const val of obj[name]) { 4775 if (invalidHeaderCharRegex.test(val)) { 4776 continue; 4777 } 4778 if (headers[MAP][name] === undefined) { 4779 headers[MAP][name] = [val]; 4780 } else { 4781 headers[MAP][name].push(val); 4782 } 4783 } 4784 } else if (!invalidHeaderCharRegex.test(obj[name])) { 4785 headers[MAP][name] = [obj[name]]; 4786 } 4787 } 4788 return headers; 4789 } 4790 4791 const INTERNALS$1 = Symbol('Response internals'); 4792 4793 // fix an issue where "STATUS_CODES" aren't a named export for node <10 4794 const STATUS_CODES = http.STATUS_CODES; 4795 4796 /** 4797 * Response class 4798 * 4799 * @param Stream body Readable stream 4800 * @param Object opts Response options 4801 * @return Void 4802 */ 4803 class Response { 4804 constructor() { 4805 let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 4806 let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 4807 4808 Body.call(this, body, opts); 4809 4810 const status = opts.status || 200; 4811 const headers = new Headers(opts.headers); 4812 4813 if (body != null && !headers.has('Content-Type')) { 4814 const contentType = extractContentType(body); 4815 if (contentType) { 4816 headers.append('Content-Type', contentType); 4817 } 4818 } 4819 4820 this[INTERNALS$1] = { 4821 url: opts.url, 4822 status, 4823 statusText: opts.statusText || STATUS_CODES[status], 4824 headers, 4825 counter: opts.counter 4826 }; 4827 } 4828 4829 get url() { 4830 return this[INTERNALS$1].url || ''; 4831 } 4832 4833 get status() { 4834 return this[INTERNALS$1].status; 4835 } 4836 4837 /** 4838 * Convenience property representing if the request ended normally 4839 */ 4840 get ok() { 4841 return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; 4842 } 4843 4844 get redirected() { 4845 return this[INTERNALS$1].counter > 0; 4846 } 4847 4848 get statusText() { 4849 return this[INTERNALS$1].statusText; 4850 } 4851 4852 get headers() { 4853 return this[INTERNALS$1].headers; 4854 } 4855 4856 /** 4857 * Clone this response 4858 * 4859 * @return Response 4860 */ 4861 clone() { 4862 return new Response(clone(this), { 4863 url: this.url, 4864 status: this.status, 4865 statusText: this.statusText, 4866 headers: this.headers, 4867 ok: this.ok, 4868 redirected: this.redirected 4869 }); 4870 } 4871 } 4872 4873 Body.mixIn(Response.prototype); 4874 4875 Object.defineProperties(Response.prototype, { 4876 url: { enumerable: true }, 4877 status: { enumerable: true }, 4878 ok: { enumerable: true }, 4879 redirected: { enumerable: true }, 4880 statusText: { enumerable: true }, 4881 headers: { enumerable: true }, 4882 clone: { enumerable: true } 4883 }); 4884 4885 Object.defineProperty(Response.prototype, Symbol.toStringTag, { 4886 value: 'Response', 4887 writable: false, 4888 enumerable: false, 4889 configurable: true 4890 }); 4891 4892 const INTERNALS$2 = Symbol('Request internals'); 4893 4894 // fix an issue where "format", "parse" aren't a named export for node <10 4895 const parse_url = Url.parse; 4896 const format_url = Url.format; 4897 4898 const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; 4899 4900 /** 4901 * Check if a value is an instance of Request. 4902 * 4903 * @param Mixed input 4904 * @return Boolean 4905 */ 4906 function isRequest(input) { 4907 return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; 4908 } 4909 4910 function isAbortSignal(signal) { 4911 const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); 4912 return !!(proto && proto.constructor.name === 'AbortSignal'); 4913 } 4914 4915 /** 4916 * Request class 4917 * 4918 * @param Mixed input Url or Request instance 4919 * @param Object init Custom options 4920 * @return Void 4921 */ 4922 class Request { 4923 constructor(input) { 4924 let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 4925 4926 let parsedURL; 4927 4928 // normalize input 4929 if (!isRequest(input)) { 4930 if (input && input.href) { 4931 // in order to support Node.js' Url objects; though WHATWG's URL objects 4932 // will fall into this branch also (since their `toString()` will return 4933 // `href` property anyway) 4934 parsedURL = parse_url(input.href); 4935 } else { 4936 // coerce input to a string before attempting to parse 4937 parsedURL = parse_url(`${input}`); 4938 } 4939 input = {}; 4940 } else { 4941 parsedURL = parse_url(input.url); 4942 } 4943 4944 let method = init.method || input.method || 'GET'; 4945 method = method.toUpperCase(); 4946 4947 if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { 4948 throw new TypeError('Request with GET/HEAD method cannot have body'); 4949 } 4950 4951 let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; 4952 4953 Body.call(this, inputBody, { 4954 timeout: init.timeout || input.timeout || 0, 4955 size: init.size || input.size || 0 4956 }); 4957 4958 const headers = new Headers(init.headers || input.headers || {}); 4959 4960 if (inputBody != null && !headers.has('Content-Type')) { 4961 const contentType = extractContentType(inputBody); 4962 if (contentType) { 4963 headers.append('Content-Type', contentType); 4964 } 4965 } 4966 4967 let signal = isRequest(input) ? input.signal : null; 4968 if ('signal' in init) signal = init.signal; 4969 4970 if (signal != null && !isAbortSignal(signal)) { 4971 throw new TypeError('Expected signal to be an instanceof AbortSignal'); 4972 } 4973 4974 this[INTERNALS$2] = { 4975 method, 4976 redirect: init.redirect || input.redirect || 'follow', 4977 headers, 4978 parsedURL, 4979 signal 4980 }; 4981 4982 // node-fetch-only options 4983 this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; 4984 this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; 4985 this.counter = init.counter || input.counter || 0; 4986 this.agent = init.agent || input.agent; 4987 } 4988 4989 get method() { 4990 return this[INTERNALS$2].method; 4991 } 4992 4993 get url() { 4994 return format_url(this[INTERNALS$2].parsedURL); 4995 } 4996 4997 get headers() { 4998 return this[INTERNALS$2].headers; 4999 } 5000 5001 get redirect() { 5002 return this[INTERNALS$2].redirect; 5003 } 5004 5005 get signal() { 5006 return this[INTERNALS$2].signal; 5007 } 5008 5009 /** 5010 * Clone this request 5011 * 5012 * @return Request 5013 */ 5014 clone() { 5015 return new Request(this); 5016 } 5017 } 5018 5019 Body.mixIn(Request.prototype); 5020 5021 Object.defineProperty(Request.prototype, Symbol.toStringTag, { 5022 value: 'Request', 5023 writable: false, 5024 enumerable: false, 5025 configurable: true 5026 }); 5027 5028 Object.defineProperties(Request.prototype, { 5029 method: { enumerable: true }, 5030 url: { enumerable: true }, 5031 headers: { enumerable: true }, 5032 redirect: { enumerable: true }, 5033 clone: { enumerable: true }, 5034 signal: { enumerable: true } 5035 }); 5036 5037 /** 5038 * Convert a Request to Node.js http request options. 5039 * 5040 * @param Request A Request instance 5041 * @return Object The options object to be passed to http.request 5042 */ 5043 function getNodeRequestOptions(request) { 5044 const parsedURL = request[INTERNALS$2].parsedURL; 5045 const headers = new Headers(request[INTERNALS$2].headers); 5046 5047 // fetch step 1.3 5048 if (!headers.has('Accept')) { 5049 headers.set('Accept', '*/*'); 5050 } 5051 5052 // Basic fetch 5053 if (!parsedURL.protocol || !parsedURL.hostname) { 5054 throw new TypeError('Only absolute URLs are supported'); 5055 } 5056 5057 if (!/^https?:$/.test(parsedURL.protocol)) { 5058 throw new TypeError('Only HTTP(S) protocols are supported'); 5059 } 5060 5061 if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { 5062 throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); 5063 } 5064 5065 // HTTP-network-or-cache fetch steps 2.4-2.7 5066 let contentLengthValue = null; 5067 if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { 5068 contentLengthValue = '0'; 5069 } 5070 if (request.body != null) { 5071 const totalBytes = getTotalBytes(request); 5072 if (typeof totalBytes === 'number') { 5073 contentLengthValue = String(totalBytes); 5074 } 5075 } 5076 if (contentLengthValue) { 5077 headers.set('Content-Length', contentLengthValue); 5078 } 5079 5080 // HTTP-network-or-cache fetch step 2.11 5081 if (!headers.has('User-Agent')) { 5082 headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); 5083 } 5084 5085 // HTTP-network-or-cache fetch step 2.15 5086 if (request.compress && !headers.has('Accept-Encoding')) { 5087 headers.set('Accept-Encoding', 'gzip,deflate'); 5088 } 5089 5090 let agent = request.agent; 5091 if (typeof agent === 'function') { 5092 agent = agent(parsedURL); 5093 } 5094 5095 if (!headers.has('Connection') && !agent) { 5096 headers.set('Connection', 'close'); 5097 } 5098 5099 // HTTP-network fetch step 4.2 5100 // chunked encoding is handled by Node.js 5101 5102 return Object.assign({}, parsedURL, { 5103 method: request.method, 5104 headers: exportNodeCompatibleHeaders(headers), 5105 agent 5106 }); 5107 } 5108 5109 /** 5110 * abort-error.js 5111 * 5112 * AbortError interface for cancelled requests 5113 */ 5114 5115 /** 5116 * Create AbortError instance 5117 * 5118 * @param String message Error message for human 5119 * @return AbortError 5120 */ 5121 function AbortError(message) { 5122 Error.call(this, message); 5123 5124 this.type = 'aborted'; 5125 this.message = message; 5126 5127 // hide custom error implementation details from end-users 5128 Error.captureStackTrace(this, this.constructor); 5129 } 5130 5131 AbortError.prototype = Object.create(Error.prototype); 5132 AbortError.prototype.constructor = AbortError; 5133 AbortError.prototype.name = 'AbortError'; 5134 5135 // fix an issue where "PassThrough", "resolve" aren't a named export for node <10 5136 const PassThrough$1 = Stream.PassThrough; 5137 const resolve_url = Url.resolve; 5138 5139 /** 5140 * Fetch function 5141 * 5142 * @param Mixed url Absolute url or Request instance 5143 * @param Object opts Fetch options 5144 * @return Promise 5145 */ 5146 function fetch(url, opts) { 5147 5148 // allow custom promise 5149 if (!fetch.Promise) { 5150 throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); 5151 } 5152 5153 Body.Promise = fetch.Promise; 5154 5155 // wrap http.request into fetch 5156 return new fetch.Promise(function (resolve, reject) { 5157 // build request object 5158 const request = new Request(url, opts); 5159 const options = getNodeRequestOptions(request); 5160 5161 const send = (options.protocol === 'https:' ? https : http).request; 5162 const signal = request.signal; 5163 5164 let response = null; 5165 5166 const abort = function abort() { 5167 let error = new AbortError('The user aborted a request.'); 5168 reject(error); 5169 if (request.body && request.body instanceof Stream.Readable) { 5170 request.body.destroy(error); 5171 } 5172 if (!response || !response.body) return; 5173 response.body.emit('error', error); 5174 }; 5175 5176 if (signal && signal.aborted) { 5177 abort(); 5178 return; 5179 } 5180 5181 const abortAndFinalize = function abortAndFinalize() { 5182 abort(); 5183 finalize(); 5184 }; 5185 5186 // send request 5187 const req = send(options); 5188 let reqTimeout; 5189 5190 if (signal) { 5191 signal.addEventListener('abort', abortAndFinalize); 5192 } 5193 5194 function finalize() { 5195 req.abort(); 5196 if (signal) signal.removeEventListener('abort', abortAndFinalize); 5197 clearTimeout(reqTimeout); 5198 } 5199 5200 if (request.timeout) { 5201 req.once('socket', function (socket) { 5202 reqTimeout = setTimeout(function () { 5203 reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); 5204 finalize(); 5205 }, request.timeout); 5206 }); 5207 } 5208 5209 req.on('error', function (err) { 5210 reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); 5211 finalize(); 5212 }); 5213 5214 req.on('response', function (res) { 5215 clearTimeout(reqTimeout); 5216 5217 const headers = createHeadersLenient(res.headers); 5218 5219 // HTTP fetch step 5 5220 if (fetch.isRedirect(res.statusCode)) { 5221 // HTTP fetch step 5.2 5222 const location = headers.get('Location'); 5223 5224 // HTTP fetch step 5.3 5225 const locationURL = location === null ? null : resolve_url(request.url, location); 5226 5227 // HTTP fetch step 5.5 5228 switch (request.redirect) { 5229 case 'error': 5230 reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect')); 5231 finalize(); 5232 return; 5233 case 'manual': 5234 // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. 5235 if (locationURL !== null) { 5236 // handle corrupted header 5237 try { 5238 headers.set('Location', locationURL); 5239 } catch (err) { 5240 // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request 5241 reject(err); 5242 } 5243 } 5244 break; 5245 case 'follow': 5246 // HTTP-redirect fetch step 2 5247 if (locationURL === null) { 5248 break; 5249 } 5250 5251 // HTTP-redirect fetch step 5 5252 if (request.counter >= request.follow) { 5253 reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); 5254 finalize(); 5255 return; 5256 } 5257 5258 // HTTP-redirect fetch step 6 (counter increment) 5259 // Create a new Request object. 5260 const requestOpts = { 5261 headers: new Headers(request.headers), 5262 follow: request.follow, 5263 counter: request.counter + 1, 5264 agent: request.agent, 5265 compress: request.compress, 5266 method: request.method, 5267 body: request.body, 5268 signal: request.signal, 5269 timeout: request.timeout, 5270 size: request.size 5271 }; 5272 5273 // HTTP-redirect fetch step 9 5274 if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { 5275 reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); 5276 finalize(); 5277 return; 5278 } 5279 5280 // HTTP-redirect fetch step 11 5281 if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { 5282 requestOpts.method = 'GET'; 5283 requestOpts.body = undefined; 5284 requestOpts.headers.delete('content-length'); 5285 } 5286 5287 // HTTP-redirect fetch step 15 5288 resolve(fetch(new Request(locationURL, requestOpts))); 5289 finalize(); 5290 return; 5291 } 5292 } 5293 5294 // prepare response 5295 res.once('end', function () { 5296 if (signal) signal.removeEventListener('abort', abortAndFinalize); 5297 }); 5298 let body = res.pipe(new PassThrough$1()); 5299 5300 const response_options = { 5301 url: request.url, 5302 status: res.statusCode, 5303 statusText: res.statusMessage, 5304 headers: headers, 5305 size: request.size, 5306 timeout: request.timeout, 5307 counter: request.counter 5308 }; 5309 5310 // HTTP-network fetch step 12.1.1.3 5311 const codings = headers.get('Content-Encoding'); 5312 5313 // HTTP-network fetch step 12.1.1.4: handle content codings 5314 5315 // in following scenarios we ignore compression support 5316 // 1. compression support is disabled 5317 // 2. HEAD request 5318 // 3. no Content-Encoding header 5319 // 4. no content response (204) 5320 // 5. content not modified response (304) 5321 if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { 5322 response = new Response(body, response_options); 5323 resolve(response); 5324 return; 5325 } 5326 5327 // For Node v6+ 5328 // Be less strict when decoding compressed responses, since sometimes 5329 // servers send slightly invalid responses that are still accepted 5330 // by common browsers. 5331 // Always using Z_SYNC_FLUSH is what cURL does. 5332 const zlibOptions = { 5333 flush: zlib.Z_SYNC_FLUSH, 5334 finishFlush: zlib.Z_SYNC_FLUSH 5335 }; 5336 5337 // for gzip 5338 if (codings == 'gzip' || codings == 'x-gzip') { 5339 body = body.pipe(zlib.createGunzip(zlibOptions)); 5340 response = new Response(body, response_options); 5341 resolve(response); 5342 return; 5343 } 5344 5345 // for deflate 5346 if (codings == 'deflate' || codings == 'x-deflate') { 5347 // handle the infamous raw deflate response from old servers 5348 // a hack for old IIS and Apache servers 5349 const raw = res.pipe(new PassThrough$1()); 5350 raw.once('data', function (chunk) { 5351 // see http://stackoverflow.com/questions/37519828 5352 if ((chunk[0] & 0x0F) === 0x08) { 5353 body = body.pipe(zlib.createInflate()); 5354 } else { 5355 body = body.pipe(zlib.createInflateRaw()); 5356 } 5357 response = new Response(body, response_options); 5358 resolve(response); 5359 }); 5360 return; 5361 } 5362 5363 // for br 5364 if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { 5365 body = body.pipe(zlib.createBrotliDecompress()); 5366 response = new Response(body, response_options); 5367 resolve(response); 5368 return; 5369 } 5370 5371 // otherwise, use response as-is 5372 response = new Response(body, response_options); 5373 resolve(response); 5374 }); 5375 5376 writeToStream(req, request); 5377 }); 5378 } 5379 /** 5380 * Redirect code matching 5381 * 5382 * @param Number code Status code 5383 * @return Boolean 5384 */ 5385 fetch.isRedirect = function (code) { 5386 return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; 5387 }; 5388 5389 // expose Promise 5390 fetch.Promise = global.Promise; 5391 5392 module.exports = exports = fetch; 5393 Object.defineProperty(exports, "__esModule", ({ value: true })); 5394 exports.default = exports; 5395 exports.Headers = Headers; 5396 exports.Request = Request; 5397 exports.Response = Response; 5398 exports.FetchError = FetchError; 5399 5400 5401 /***/ }), 5402 5403 /***/ 223: 5404 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 5405 5406 var wrappy = __webpack_require__(940) 5407 module.exports = wrappy(once) 5408 module.exports.strict = wrappy(onceStrict) 5409 5410 once.proto = once(function () { 5411 Object.defineProperty(Function.prototype, 'once', { 5412 value: function () { 5413 return once(this) 5414 }, 5415 configurable: true 5416 }) 5417 5418 Object.defineProperty(Function.prototype, 'onceStrict', { 5419 value: function () { 5420 return onceStrict(this) 5421 }, 5422 configurable: true 5423 }) 5424 }) 5425 5426 function once (fn) { 5427 var f = function () { 5428 if (f.called) return f.value 5429 f.called = true 5430 return f.value = fn.apply(this, arguments) 5431 } 5432 f.called = false 5433 return f 5434 } 5435 5436 function onceStrict (fn) { 5437 var f = function () { 5438 if (f.called) 5439 throw new Error(f.onceError) 5440 f.called = true 5441 return f.value = fn.apply(this, arguments) 5442 } 5443 var name = fn.name || 'Function wrapped with `once`' 5444 f.onceError = name + " shouldn't be called more than once" 5445 f.called = false 5446 return f 5447 } 5448 5449 5450 /***/ }), 5451 5452 /***/ 294: 5453 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 5454 5455 module.exports = __webpack_require__(219); 5456 5457 5458 /***/ }), 5459 5460 /***/ 219: 5461 /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 5462 5463 "use strict"; 5464 5465 5466 var net = __webpack_require__(631); 5467 var tls = __webpack_require__(16); 5468 var http = __webpack_require__(605); 5469 var https = __webpack_require__(211); 5470 var events = __webpack_require__(614); 5471 var assert = __webpack_require__(357); 5472 var util = __webpack_require__(669); 5473 5474 5475 exports.httpOverHttp = httpOverHttp; 5476 exports.httpsOverHttp = httpsOverHttp; 5477 exports.httpOverHttps = httpOverHttps; 5478 exports.httpsOverHttps = httpsOverHttps; 5479 5480 5481 function httpOverHttp(options) { 5482 var agent = new TunnelingAgent(options); 5483 agent.request = http.request; 5484 return agent; 5485 } 5486 5487 function httpsOverHttp(options) { 5488 var agent = new TunnelingAgent(options); 5489 agent.request = http.request; 5490 agent.createSocket = createSecureSocket; 5491 agent.defaultPort = 443; 5492 return agent; 5493 } 5494 5495 function httpOverHttps(options) { 5496 var agent = new TunnelingAgent(options); 5497 agent.request = https.request; 5498 return agent; 5499 } 5500 5501 function httpsOverHttps(options) { 5502 var agent = new TunnelingAgent(options); 5503 agent.request = https.request; 5504 agent.createSocket = createSecureSocket; 5505 agent.defaultPort = 443; 5506 return agent; 5507 } 5508 5509 5510 function TunnelingAgent(options) { 5511 var self = this; 5512 self.options = options || {}; 5513 self.proxyOptions = self.options.proxy || {}; 5514 self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; 5515 self.requests = []; 5516 self.sockets = []; 5517 5518 self.on('free', function onFree(socket, host, port, localAddress) { 5519 var options = toOptions(host, port, localAddress); 5520 for (var i = 0, len = self.requests.length; i < len; ++i) { 5521 var pending = self.requests[i]; 5522 if (pending.host === options.host && pending.port === options.port) { 5523 // Detect the request to connect same origin server, 5524 // reuse the connection. 5525 self.requests.splice(i, 1); 5526 pending.request.onSocket(socket); 5527 return; 5528 } 5529 } 5530 socket.destroy(); 5531 self.removeSocket(socket); 5532 }); 5533 } 5534 util.inherits(TunnelingAgent, events.EventEmitter); 5535 5536 TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { 5537 var self = this; 5538 var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); 5539 5540 if (self.sockets.length >= this.maxSockets) { 5541 // We are over limit so we'll add it to the queue. 5542 self.requests.push(options); 5543 return; 5544 } 5545 5546 // If we are under maxSockets create a new one. 5547 self.createSocket(options, function(socket) { 5548 socket.on('free', onFree); 5549 socket.on('close', onCloseOrRemove); 5550 socket.on('agentRemove', onCloseOrRemove); 5551 req.onSocket(socket); 5552 5553 function onFree() { 5554 self.emit('free', socket, options); 5555 } 5556 5557 function onCloseOrRemove(err) { 5558 self.removeSocket(socket); 5559 socket.removeListener('free', onFree); 5560 socket.removeListener('close', onCloseOrRemove); 5561 socket.removeListener('agentRemove', onCloseOrRemove); 5562 } 5563 }); 5564 }; 5565 5566 TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { 5567 var self = this; 5568 var placeholder = {}; 5569 self.sockets.push(placeholder); 5570 5571 var connectOptions = mergeOptions({}, self.proxyOptions, { 5572 method: 'CONNECT', 5573 path: options.host + ':' + options.port, 5574 agent: false, 5575 headers: { 5576 host: options.host + ':' + options.port 5577 } 5578 }); 5579 if (options.localAddress) { 5580 connectOptions.localAddress = options.localAddress; 5581 } 5582 if (connectOptions.proxyAuth) { 5583 connectOptions.headers = connectOptions.headers || {}; 5584 connectOptions.headers['Proxy-Authorization'] = 'Basic ' + 5585 new Buffer(connectOptions.proxyAuth).toString('base64'); 5586 } 5587 5588 debug('making CONNECT request'); 5589 var connectReq = self.request(connectOptions); 5590 connectReq.useChunkedEncodingByDefault = false; // for v0.6 5591 connectReq.once('response', onResponse); // for v0.6 5592 connectReq.once('upgrade', onUpgrade); // for v0.6 5593 connectReq.once('connect', onConnect); // for v0.7 or later 5594 connectReq.once('error', onError); 5595 connectReq.end(); 5596 5597 function onResponse(res) { 5598 // Very hacky. This is necessary to avoid http-parser leaks. 5599 res.upgrade = true; 5600 } 5601 5602 function onUpgrade(res, socket, head) { 5603 // Hacky. 5604 process.nextTick(function() { 5605 onConnect(res, socket, head); 5606 }); 5607 } 5608 5609 function onConnect(res, socket, head) { 5610 connectReq.removeAllListeners(); 5611 socket.removeAllListeners(); 5612 5613 if (res.statusCode !== 200) { 5614 debug('tunneling socket could not be established, statusCode=%d', 5615 res.statusCode); 5616 socket.destroy(); 5617 var error = new Error('tunneling socket could not be established, ' + 5618 'statusCode=' + res.statusCode); 5619 error.code = 'ECONNRESET'; 5620 options.request.emit('error', error); 5621 self.removeSocket(placeholder); 5622 return; 5623 } 5624 if (head.length > 0) { 5625 debug('got illegal response body from proxy'); 5626 socket.destroy(); 5627 var error = new Error('got illegal response body from proxy'); 5628 error.code = 'ECONNRESET'; 5629 options.request.emit('error', error); 5630 self.removeSocket(placeholder); 5631 return; 5632 } 5633 debug('tunneling connection has established'); 5634 self.sockets[self.sockets.indexOf(placeholder)] = socket; 5635 return cb(socket); 5636 } 5637 5638 function onError(cause) { 5639 connectReq.removeAllListeners(); 5640 5641 debug('tunneling socket could not be established, cause=%s\n', 5642 cause.message, cause.stack); 5643 var error = new Error('tunneling socket could not be established, ' + 5644 'cause=' + cause.message); 5645 error.code = 'ECONNRESET'; 5646 options.request.emit('error', error); 5647 self.removeSocket(placeholder); 5648 } 5649 }; 5650 5651 TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { 5652 var pos = this.sockets.indexOf(socket) 5653 if (pos === -1) { 5654 return; 5655 } 5656 this.sockets.splice(pos, 1); 5657 5658 var pending = this.requests.shift(); 5659 if (pending) { 5660 // If we have pending requests and a socket gets closed a new one 5661 // needs to be created to take over in the pool for the one that closed. 5662 this.createSocket(pending, function(socket) { 5663 pending.request.onSocket(socket); 5664 }); 5665 } 5666 }; 5667 5668 function createSecureSocket(options, cb) { 5669 var self = this; 5670 TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { 5671 var hostHeader = options.request.getHeader('host'); 5672 var tlsOptions = mergeOptions({}, self.options, { 5673 socket: socket, 5674 servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host 5675 }); 5676 5677 // 0 is dummy port for v0.6 5678 var secureSocket = tls.connect(0, tlsOptions); 5679 self.sockets[self.sockets.indexOf(socket)] = secureSocket; 5680 cb(secureSocket); 5681 }); 5682 } 5683 5684 5685 function toOptions(host, port, localAddress) { 5686 if (typeof host === 'string') { // since v0.10 5687 return { 5688 host: host, 5689 port: port, 5690 localAddress: localAddress 5691 }; 5692 } 5693 return host; // for v0.11 or later 5694 } 5695 5696 function mergeOptions(target) { 5697 for (var i = 1, len = arguments.length; i < len; ++i) { 5698 var overrides = arguments[i]; 5699 if (typeof overrides === 'object') { 5700 var keys = Object.keys(overrides); 5701 for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { 5702 var k = keys[j]; 5703 if (overrides[k] !== undefined) { 5704 target[k] = overrides[k]; 5705 } 5706 } 5707 } 5708 } 5709 return target; 5710 } 5711 5712 5713 var debug; 5714 if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { 5715 debug = function() { 5716 var args = Array.prototype.slice.call(arguments); 5717 if (typeof args[0] === 'string') { 5718 args[0] = 'TUNNEL: ' + args[0]; 5719 } else { 5720 args.unshift('TUNNEL:'); 5721 } 5722 console.error.apply(console, args); 5723 } 5724 } else { 5725 debug = function() {}; 5726 } 5727 exports.debug = debug; // for test 5728 5729 5730 /***/ }), 5731 5732 /***/ 429: 5733 /***/ ((__unused_webpack_module, exports) => { 5734 5735 "use strict"; 5736 5737 5738 Object.defineProperty(exports, "__esModule", ({ value: true })); 5739 5740 function getUserAgent() { 5741 if (typeof navigator === "object" && "userAgent" in navigator) { 5742 return navigator.userAgent; 5743 } 5744 5745 if (typeof process === "object" && "version" in process) { 5746 return `Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`; 5747 } 5748 5749 return "<environment undetectable>"; 5750 } 5751 5752 exports.getUserAgent = getUserAgent; 5753 //# sourceMappingURL=index.js.map 5754 5755 5756 /***/ }), 5757 5758 /***/ 940: 5759 /***/ ((module) => { 5760 5761 // Returns a wrapper function that returns a wrapped callback 5762 // The wrapper function should do some stuff, and return a 5763 // presumably different callback function. 5764 // This makes sure that own properties are retained, so that 5765 // decorations and such are not lost along the way. 5766 module.exports = wrappy 5767 function wrappy (fn, cb) { 5768 if (fn && cb) return wrappy(fn)(cb) 5769 5770 if (typeof fn !== 'function') 5771 throw new TypeError('need wrapper function') 5772 5773 Object.keys(fn).forEach(function (k) { 5774 wrapper[k] = fn[k] 5775 }) 5776 5777 return wrapper 5778 5779 function wrapper() { 5780 var args = new Array(arguments.length) 5781 for (var i = 0; i < args.length; i++) { 5782 args[i] = arguments[i] 5783 } 5784 var ret = fn.apply(this, args) 5785 var cb = args[args.length-1] 5786 if (typeof ret === 'function' && ret !== cb) { 5787 Object.keys(cb).forEach(function (k) { 5788 ret[k] = cb[k] 5789 }) 5790 } 5791 return ret 5792 } 5793 } 5794 5795 5796 /***/ }), 5797 5798 /***/ 877: 5799 /***/ ((module) => { 5800 5801 module.exports = eval("require")("encoding"); 5802 5803 5804 /***/ }), 5805 5806 /***/ 357: 5807 /***/ ((module) => { 5808 5809 "use strict"; 5810 module.exports = require("assert"); 5811 5812 /***/ }), 5813 5814 /***/ 614: 5815 /***/ ((module) => { 5816 5817 "use strict"; 5818 module.exports = require("events"); 5819 5820 /***/ }), 5821 5822 /***/ 747: 5823 /***/ ((module) => { 5824 5825 "use strict"; 5826 module.exports = require("fs"); 5827 5828 /***/ }), 5829 5830 /***/ 605: 5831 /***/ ((module) => { 5832 5833 "use strict"; 5834 module.exports = require("http"); 5835 5836 /***/ }), 5837 5838 /***/ 211: 5839 /***/ ((module) => { 5840 5841 "use strict"; 5842 module.exports = require("https"); 5843 5844 /***/ }), 5845 5846 /***/ 631: 5847 /***/ ((module) => { 5848 5849 "use strict"; 5850 module.exports = require("net"); 5851 5852 /***/ }), 5853 5854 /***/ 87: 5855 /***/ ((module) => { 5856 5857 "use strict"; 5858 module.exports = require("os"); 5859 5860 /***/ }), 5861 5862 /***/ 622: 5863 /***/ ((module) => { 5864 5865 "use strict"; 5866 module.exports = require("path"); 5867 5868 /***/ }), 5869 5870 /***/ 413: 5871 /***/ ((module) => { 5872 5873 "use strict"; 5874 module.exports = require("stream"); 5875 5876 /***/ }), 5877 5878 /***/ 16: 5879 /***/ ((module) => { 5880 5881 "use strict"; 5882 module.exports = require("tls"); 5883 5884 /***/ }), 5885 5886 /***/ 835: 5887 /***/ ((module) => { 5888 5889 "use strict"; 5890 module.exports = require("url"); 5891 5892 /***/ }), 5893 5894 /***/ 669: 5895 /***/ ((module) => { 5896 5897 "use strict"; 5898 module.exports = require("util"); 5899 5900 /***/ }), 5901 5902 /***/ 761: 5903 /***/ ((module) => { 5904 5905 "use strict"; 5906 module.exports = require("zlib"); 5907 5908 /***/ }) 5909 5910 /******/ }); 5911 /************************************************************************/ 5912 /******/ // The module cache 5913 /******/ var __webpack_module_cache__ = {}; 5914 /******/ 5915 /******/ // The require function 5916 /******/ function __webpack_require__(moduleId) { 5917 /******/ // Check if module is in cache 5918 /******/ if(__webpack_module_cache__[moduleId]) { 5919 /******/ return __webpack_module_cache__[moduleId].exports; 5920 /******/ } 5921 /******/ // Create a new module (and put it into the cache) 5922 /******/ var module = __webpack_module_cache__[moduleId] = { 5923 /******/ // no module.id needed 5924 /******/ // no module.loaded needed 5925 /******/ exports: {} 5926 /******/ }; 5927 /******/ 5928 /******/ // Execute the module function 5929 /******/ var threw = true; 5930 /******/ try { 5931 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 5932 /******/ threw = false; 5933 /******/ } finally { 5934 /******/ if(threw) delete __webpack_module_cache__[moduleId]; 5935 /******/ } 5936 /******/ 5937 /******/ // Return the exports of the module 5938 /******/ return module.exports; 5939 /******/ } 5940 /******/ 5941 /************************************************************************/ 5942 /******/ /* webpack/runtime/compat */ 5943 /******/ 5944 /******/ __webpack_require__.ab = __dirname + "/";/************************************************************************/ 5945 /******/ // module exports must be returned from runtime so entry inlining is disabled 5946 /******/ // startup 5947 /******/ // Load entry module and return exports 5948 /******/ return __webpack_require__(932); 5949 /******/ })() 5950 ;