first commit
This commit is contained in:
committed by
mrugesh mohapatra
parent
5bb3556bfd
commit
04913efd16
3
probot/presolver/.gitignore
vendored
3
probot/presolver/.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
.env
|
||||
.git
|
||||
.git
|
||||
node_modules
|
1
probot/presolver/node_modules/.bin/acorn
generated
vendored
1
probot/presolver/node_modules/.bin/acorn
generated
vendored
@ -1 +0,0 @@
|
||||
../acorn/bin/acorn
|
1
probot/presolver/node_modules/.bin/atob
generated
vendored
1
probot/presolver/node_modules/.bin/atob
generated
vendored
@ -1 +0,0 @@
|
||||
../atob/bin/atob.js
|
1
probot/presolver/node_modules/.bin/babylon
generated
vendored
1
probot/presolver/node_modules/.bin/babylon
generated
vendored
@ -1 +0,0 @@
|
||||
../babylon/bin/babylon.js
|
1
probot/presolver/node_modules/.bin/bunyan
generated
vendored
1
probot/presolver/node_modules/.bin/bunyan
generated
vendored
@ -1 +0,0 @@
|
||||
../bunyan/bin/bunyan
|
1
probot/presolver/node_modules/.bin/escodegen
generated
vendored
1
probot/presolver/node_modules/.bin/escodegen
generated
vendored
@ -1 +0,0 @@
|
||||
../escodegen/bin/escodegen.js
|
1
probot/presolver/node_modules/.bin/esgenerate
generated
vendored
1
probot/presolver/node_modules/.bin/esgenerate
generated
vendored
@ -1 +0,0 @@
|
||||
../escodegen/bin/esgenerate.js
|
1
probot/presolver/node_modules/.bin/eslint
generated
vendored
1
probot/presolver/node_modules/.bin/eslint
generated
vendored
@ -1 +0,0 @@
|
||||
../eslint/bin/eslint.js
|
1
probot/presolver/node_modules/.bin/esparse
generated
vendored
1
probot/presolver/node_modules/.bin/esparse
generated
vendored
@ -1 +0,0 @@
|
||||
../esprima/bin/esparse.js
|
1
probot/presolver/node_modules/.bin/esvalidate
generated
vendored
1
probot/presolver/node_modules/.bin/esvalidate
generated
vendored
@ -1 +0,0 @@
|
||||
../esprima/bin/esvalidate.js
|
1
probot/presolver/node_modules/.bin/handlebars
generated
vendored
1
probot/presolver/node_modules/.bin/handlebars
generated
vendored
@ -1 +0,0 @@
|
||||
../handlebars/bin/handlebars
|
1
probot/presolver/node_modules/.bin/import-local-fixture
generated
vendored
1
probot/presolver/node_modules/.bin/import-local-fixture
generated
vendored
@ -1 +0,0 @@
|
||||
../import-local/fixtures/cli.js
|
1
probot/presolver/node_modules/.bin/is-ci
generated
vendored
1
probot/presolver/node_modules/.bin/is-ci
generated
vendored
@ -1 +0,0 @@
|
||||
../is-ci/bin.js
|
1
probot/presolver/node_modules/.bin/jest
generated
vendored
1
probot/presolver/node_modules/.bin/jest
generated
vendored
@ -1 +0,0 @@
|
||||
../jest/bin/jest.js
|
1
probot/presolver/node_modules/.bin/jest-runtime
generated
vendored
1
probot/presolver/node_modules/.bin/jest-runtime
generated
vendored
@ -1 +0,0 @@
|
||||
../jest-runtime/bin/jest-runtime.js
|
1
probot/presolver/node_modules/.bin/js-yaml
generated
vendored
1
probot/presolver/node_modules/.bin/js-yaml
generated
vendored
@ -1 +0,0 @@
|
||||
../js-yaml/bin/js-yaml.js
|
1
probot/presolver/node_modules/.bin/jsesc
generated
vendored
1
probot/presolver/node_modules/.bin/jsesc
generated
vendored
@ -1 +0,0 @@
|
||||
../jsesc/bin/jsesc
|
1
probot/presolver/node_modules/.bin/json5
generated
vendored
1
probot/presolver/node_modules/.bin/json5
generated
vendored
@ -1 +0,0 @@
|
||||
../json5/lib/cli.js
|
1
probot/presolver/node_modules/.bin/loose-envify
generated
vendored
1
probot/presolver/node_modules/.bin/loose-envify
generated
vendored
@ -1 +0,0 @@
|
||||
../loose-envify/cli.js
|
1
probot/presolver/node_modules/.bin/mime
generated
vendored
1
probot/presolver/node_modules/.bin/mime
generated
vendored
@ -1 +0,0 @@
|
||||
../mime/cli.js
|
1
probot/presolver/node_modules/.bin/mkdirp
generated
vendored
1
probot/presolver/node_modules/.bin/mkdirp
generated
vendored
@ -1 +0,0 @@
|
||||
../mkdirp/bin/cmd.js
|
1
probot/presolver/node_modules/.bin/ncp
generated
vendored
1
probot/presolver/node_modules/.bin/ncp
generated
vendored
@ -1 +0,0 @@
|
||||
../ncp/bin/ncp
|
1
probot/presolver/node_modules/.bin/nodemon
generated
vendored
1
probot/presolver/node_modules/.bin/nodemon
generated
vendored
@ -1 +0,0 @@
|
||||
../nodemon/bin/nodemon.js
|
1
probot/presolver/node_modules/.bin/nodetouch
generated
vendored
1
probot/presolver/node_modules/.bin/nodetouch
generated
vendored
@ -1 +0,0 @@
|
||||
../touch/bin/nodetouch.js
|
1
probot/presolver/node_modules/.bin/nopt
generated
vendored
1
probot/presolver/node_modules/.bin/nopt
generated
vendored
@ -1 +0,0 @@
|
||||
../nopt/bin/nopt.js
|
1
probot/presolver/node_modules/.bin/probot
generated
vendored
1
probot/presolver/node_modules/.bin/probot
generated
vendored
@ -1 +0,0 @@
|
||||
../probot/bin/probot.js
|
1
probot/presolver/node_modules/.bin/raven
generated
vendored
1
probot/presolver/node_modules/.bin/raven
generated
vendored
@ -1 +0,0 @@
|
||||
../raven/bin/raven
|
1
probot/presolver/node_modules/.bin/rc
generated
vendored
1
probot/presolver/node_modules/.bin/rc
generated
vendored
@ -1 +0,0 @@
|
||||
../rc/cli.js
|
1
probot/presolver/node_modules/.bin/rimraf
generated
vendored
1
probot/presolver/node_modules/.bin/rimraf
generated
vendored
@ -1 +0,0 @@
|
||||
../rimraf/bin.js
|
1
probot/presolver/node_modules/.bin/sane
generated
vendored
1
probot/presolver/node_modules/.bin/sane
generated
vendored
@ -1 +0,0 @@
|
||||
../sane/src/cli.js
|
1
probot/presolver/node_modules/.bin/semver
generated
vendored
1
probot/presolver/node_modules/.bin/semver
generated
vendored
@ -1 +0,0 @@
|
||||
../semver/bin/semver
|
1
probot/presolver/node_modules/.bin/shjs
generated
vendored
1
probot/presolver/node_modules/.bin/shjs
generated
vendored
@ -1 +0,0 @@
|
||||
../shelljs/bin/shjs
|
1
probot/presolver/node_modules/.bin/smee
generated
vendored
1
probot/presolver/node_modules/.bin/smee
generated
vendored
@ -1 +0,0 @@
|
||||
../smee-client/bin/smee.js
|
1
probot/presolver/node_modules/.bin/sshpk-conv
generated
vendored
1
probot/presolver/node_modules/.bin/sshpk-conv
generated
vendored
@ -1 +0,0 @@
|
||||
../sshpk/bin/sshpk-conv
|
1
probot/presolver/node_modules/.bin/sshpk-sign
generated
vendored
1
probot/presolver/node_modules/.bin/sshpk-sign
generated
vendored
@ -1 +0,0 @@
|
||||
../sshpk/bin/sshpk-sign
|
1
probot/presolver/node_modules/.bin/sshpk-verify
generated
vendored
1
probot/presolver/node_modules/.bin/sshpk-verify
generated
vendored
@ -1 +0,0 @@
|
||||
../sshpk/bin/sshpk-verify
|
1
probot/presolver/node_modules/.bin/standard
generated
vendored
1
probot/presolver/node_modules/.bin/standard
generated
vendored
@ -1 +0,0 @@
|
||||
../standard/bin/cmd.js
|
1
probot/presolver/node_modules/.bin/uglifyjs
generated
vendored
1
probot/presolver/node_modules/.bin/uglifyjs
generated
vendored
@ -1 +0,0 @@
|
||||
../uglify-js/bin/uglifyjs
|
1
probot/presolver/node_modules/.bin/uuid
generated
vendored
1
probot/presolver/node_modules/.bin/uuid
generated
vendored
@ -1 +0,0 @@
|
||||
../uuid/bin/uuid
|
1
probot/presolver/node_modules/.bin/watch
generated
vendored
1
probot/presolver/node_modules/.bin/watch
generated
vendored
@ -1 +0,0 @@
|
||||
../watch/cli.js
|
1
probot/presolver/node_modules/.bin/which
generated
vendored
1
probot/presolver/node_modules/.bin/which
generated
vendored
@ -1 +0,0 @@
|
||||
../which/bin/which
|
22
probot/presolver/node_modules/@babel/code-frame/LICENSE
generated
vendored
22
probot/presolver/node_modules/@babel/code-frame/LICENSE
generated
vendored
@ -1,22 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-2018 Sebastian McKenzie <sebmck@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
19
probot/presolver/node_modules/@babel/code-frame/README.md
generated
vendored
19
probot/presolver/node_modules/@babel/code-frame/README.md
generated
vendored
@ -1,19 +0,0 @@
|
||||
# @babel/code-frame
|
||||
|
||||
> Generate errors that contain a code frame that point to source locations.
|
||||
|
||||
See our website [@babel/code-frame](https://babeljs.io/docs/en/next/babel-code-frame.html) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/code-frame
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/code-frame --dev
|
||||
```
|
173
probot/presolver/node_modules/@babel/code-frame/lib/index.js
generated
vendored
173
probot/presolver/node_modules/@babel/code-frame/lib/index.js
generated
vendored
@ -1,173 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.codeFrameColumns = codeFrameColumns;
|
||||
exports.default = _default;
|
||||
|
||||
function _highlight() {
|
||||
const data = _interopRequireWildcard(require("@babel/highlight"));
|
||||
|
||||
_highlight = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
|
||||
let deprecationWarningShown = false;
|
||||
|
||||
function getDefs(chalk) {
|
||||
return {
|
||||
gutter: chalk.grey,
|
||||
marker: chalk.red.bold,
|
||||
message: chalk.red.bold
|
||||
};
|
||||
}
|
||||
|
||||
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
||||
|
||||
function getMarkerLines(loc, source, opts) {
|
||||
const startLoc = Object.assign({
|
||||
column: 0,
|
||||
line: -1
|
||||
}, loc.start);
|
||||
const endLoc = Object.assign({}, startLoc, loc.end);
|
||||
const {
|
||||
linesAbove = 2,
|
||||
linesBelow = 3
|
||||
} = opts || {};
|
||||
const startLine = startLoc.line;
|
||||
const startColumn = startLoc.column;
|
||||
const endLine = endLoc.line;
|
||||
const endColumn = endLoc.column;
|
||||
let start = Math.max(startLine - (linesAbove + 1), 0);
|
||||
let end = Math.min(source.length, endLine + linesBelow);
|
||||
|
||||
if (startLine === -1) {
|
||||
start = 0;
|
||||
}
|
||||
|
||||
if (endLine === -1) {
|
||||
end = source.length;
|
||||
}
|
||||
|
||||
const lineDiff = endLine - startLine;
|
||||
const markerLines = {};
|
||||
|
||||
if (lineDiff) {
|
||||
for (let i = 0; i <= lineDiff; i++) {
|
||||
const lineNumber = i + startLine;
|
||||
|
||||
if (!startColumn) {
|
||||
markerLines[lineNumber] = true;
|
||||
} else if (i === 0) {
|
||||
const sourceLength = source[lineNumber - 1].length;
|
||||
markerLines[lineNumber] = [startColumn, sourceLength - startColumn];
|
||||
} else if (i === lineDiff) {
|
||||
markerLines[lineNumber] = [0, endColumn];
|
||||
} else {
|
||||
const sourceLength = source[lineNumber - i].length;
|
||||
markerLines[lineNumber] = [0, sourceLength];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (startColumn === endColumn) {
|
||||
if (startColumn) {
|
||||
markerLines[startLine] = [startColumn, 0];
|
||||
} else {
|
||||
markerLines[startLine] = true;
|
||||
}
|
||||
} else {
|
||||
markerLines[startLine] = [startColumn, endColumn - startColumn];
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
start,
|
||||
end,
|
||||
markerLines
|
||||
};
|
||||
}
|
||||
|
||||
function codeFrameColumns(rawLines, loc, opts = {}) {
|
||||
const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight().shouldHighlight)(opts);
|
||||
const chalk = (0, _highlight().getChalk)(opts);
|
||||
const defs = getDefs(chalk);
|
||||
|
||||
const maybeHighlight = (chalkFn, string) => {
|
||||
return highlighted ? chalkFn(string) : string;
|
||||
};
|
||||
|
||||
if (highlighted) rawLines = (0, _highlight().default)(rawLines, opts);
|
||||
const lines = rawLines.split(NEWLINE);
|
||||
const {
|
||||
start,
|
||||
end,
|
||||
markerLines
|
||||
} = getMarkerLines(loc, lines, opts);
|
||||
const hasColumns = loc.start && typeof loc.start.column === "number";
|
||||
const numberMaxWidth = String(end).length;
|
||||
let frame = lines.slice(start, end).map((line, index) => {
|
||||
const number = start + 1 + index;
|
||||
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
|
||||
const gutter = ` ${paddedNumber} | `;
|
||||
const hasMarker = markerLines[number];
|
||||
const lastMarkerLine = !markerLines[number + 1];
|
||||
|
||||
if (hasMarker) {
|
||||
let markerLine = "";
|
||||
|
||||
if (Array.isArray(hasMarker)) {
|
||||
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
||||
const numberOfMarkers = hasMarker[1] || 1;
|
||||
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
|
||||
|
||||
if (lastMarkerLine && opts.message) {
|
||||
markerLine += " " + maybeHighlight(defs.message, opts.message);
|
||||
}
|
||||
}
|
||||
|
||||
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
|
||||
} else {
|
||||
return ` ${maybeHighlight(defs.gutter, gutter)}${line}`;
|
||||
}
|
||||
}).join("\n");
|
||||
|
||||
if (opts.message && !hasColumns) {
|
||||
frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
|
||||
}
|
||||
|
||||
if (highlighted) {
|
||||
return chalk.reset(frame);
|
||||
} else {
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
function _default(rawLines, lineNumber, colNumber, opts = {}) {
|
||||
if (!deprecationWarningShown) {
|
||||
deprecationWarningShown = true;
|
||||
const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
|
||||
|
||||
if (process.emitWarning) {
|
||||
process.emitWarning(message, "DeprecationWarning");
|
||||
} else {
|
||||
const deprecationError = new Error(message);
|
||||
deprecationError.name = "DeprecationWarning";
|
||||
console.warn(new Error(message));
|
||||
}
|
||||
}
|
||||
|
||||
colNumber = Math.max(colNumber, 0);
|
||||
const location = {
|
||||
start: {
|
||||
column: colNumber,
|
||||
line: lineNumber
|
||||
}
|
||||
};
|
||||
return codeFrameColumns(rawLines, location, opts);
|
||||
}
|
49
probot/presolver/node_modules/@babel/code-frame/package.json
generated
vendored
49
probot/presolver/node_modules/@babel/code-frame/package.json
generated
vendored
@ -1,49 +0,0 @@
|
||||
{
|
||||
"_from": "@babel/code-frame@^7.0.0-beta.35",
|
||||
"_id": "@babel/code-frame@7.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==",
|
||||
"_location": "/@babel/code-frame",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@babel/code-frame@^7.0.0-beta.35",
|
||||
"name": "@babel/code-frame",
|
||||
"escapedName": "@babel%2fcode-frame",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "^7.0.0-beta.35",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^7.0.0-beta.35"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jest-message-util"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz",
|
||||
"_shasum": "06e2ab19bdb535385559aabb5ba59729482800f8",
|
||||
"_spec": "@babel/code-frame@^7.0.0-beta.35",
|
||||
"_where": "/Users/traceybushman/Documents/FreeCodeCamp/presolver/node_modules/jest-message-util",
|
||||
"author": {
|
||||
"name": "Sebastian McKenzie",
|
||||
"email": "sebmck@gmail.com"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/highlight": "^7.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Generate errors that contain a code frame that point to source locations.",
|
||||
"devDependencies": {
|
||||
"chalk": "^2.0.0",
|
||||
"strip-ansi": "^4.0.0"
|
||||
},
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "@babel/code-frame",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-code-frame"
|
||||
},
|
||||
"version": "7.0.0"
|
||||
}
|
22
probot/presolver/node_modules/@babel/highlight/LICENSE
generated
vendored
22
probot/presolver/node_modules/@babel/highlight/LICENSE
generated
vendored
@ -1,22 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-2018 Sebastian McKenzie <sebmck@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
19
probot/presolver/node_modules/@babel/highlight/README.md
generated
vendored
19
probot/presolver/node_modules/@babel/highlight/README.md
generated
vendored
@ -1,19 +0,0 @@
|
||||
# @babel/highlight
|
||||
|
||||
> Syntax highlight JavaScript strings for output in terminals.
|
||||
|
||||
See our website [@babel/highlight](https://babeljs.io/docs/en/next/babel-highlight.html) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/highlight
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/highlight --dev
|
||||
```
|
129
probot/presolver/node_modules/@babel/highlight/lib/index.js
generated
vendored
129
probot/presolver/node_modules/@babel/highlight/lib/index.js
generated
vendored
@ -1,129 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.shouldHighlight = shouldHighlight;
|
||||
exports.getChalk = getChalk;
|
||||
exports.default = highlight;
|
||||
|
||||
function _jsTokens() {
|
||||
const data = _interopRequireWildcard(require("js-tokens"));
|
||||
|
||||
_jsTokens = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _esutils() {
|
||||
const data = _interopRequireDefault(require("esutils"));
|
||||
|
||||
_esutils = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require("chalk"));
|
||||
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function getDefs(chalk) {
|
||||
return {
|
||||
keyword: chalk.cyan,
|
||||
capitalized: chalk.yellow,
|
||||
jsx_tag: chalk.yellow,
|
||||
punctuator: chalk.yellow,
|
||||
number: chalk.magenta,
|
||||
string: chalk.green,
|
||||
regex: chalk.magenta,
|
||||
comment: chalk.grey,
|
||||
invalid: chalk.white.bgRed.bold
|
||||
};
|
||||
}
|
||||
|
||||
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
||||
const JSX_TAG = /^[a-z][\w-]*$/i;
|
||||
const BRACKET = /^[()[\]{}]$/;
|
||||
|
||||
function getTokenType(match) {
|
||||
const [offset, text] = match.slice(-2);
|
||||
const token = (0, _jsTokens().matchToToken)(match);
|
||||
|
||||
if (token.type === "name") {
|
||||
if (_esutils().default.keyword.isReservedWordES6(token.value)) {
|
||||
return "keyword";
|
||||
}
|
||||
|
||||
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
|
||||
return "jsx_tag";
|
||||
}
|
||||
|
||||
if (token.value[0] !== token.value[0].toLowerCase()) {
|
||||
return "capitalized";
|
||||
}
|
||||
}
|
||||
|
||||
if (token.type === "punctuator" && BRACKET.test(token.value)) {
|
||||
return "bracket";
|
||||
}
|
||||
|
||||
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
|
||||
return "punctuator";
|
||||
}
|
||||
|
||||
return token.type;
|
||||
}
|
||||
|
||||
function highlightTokens(defs, text) {
|
||||
return text.replace(_jsTokens().default, function (...args) {
|
||||
const type = getTokenType(args);
|
||||
const colorize = defs[type];
|
||||
|
||||
if (colorize) {
|
||||
return args[0].split(NEWLINE).map(str => colorize(str)).join("\n");
|
||||
} else {
|
||||
return args[0];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function shouldHighlight(options) {
|
||||
return _chalk().default.supportsColor || options.forceColor;
|
||||
}
|
||||
|
||||
function getChalk(options) {
|
||||
let chalk = _chalk().default;
|
||||
|
||||
if (options.forceColor) {
|
||||
chalk = new (_chalk().default.constructor)({
|
||||
enabled: true,
|
||||
level: 1
|
||||
});
|
||||
}
|
||||
|
||||
return chalk;
|
||||
}
|
||||
|
||||
function highlight(code, options = {}) {
|
||||
if (shouldHighlight(options)) {
|
||||
const chalk = getChalk(options);
|
||||
const defs = getDefs(chalk);
|
||||
return highlightTokens(defs, code);
|
||||
} else {
|
||||
return code;
|
||||
}
|
||||
}
|
151
probot/presolver/node_modules/@babel/highlight/node_modules/js-tokens/CHANGELOG.md
generated
vendored
151
probot/presolver/node_modules/@babel/highlight/node_modules/js-tokens/CHANGELOG.md
generated
vendored
@ -1,151 +0,0 @@
|
||||
### Version 4.0.0 (2018-01-28) ###
|
||||
|
||||
- Added: Support for ES2018. The only change needed was recognizing the `s`
|
||||
regex flag.
|
||||
- Changed: _All_ tokens returned by the `matchToToken` function now have a
|
||||
`closed` property. It is set to `undefined` for the tokens where “closed”
|
||||
doesn’t make sense. This means that all tokens objects have the same shape,
|
||||
which might improve performance.
|
||||
|
||||
These are the breaking changes:
|
||||
|
||||
- `'/a/s'.match(jsTokens)` no longer returns `['/', 'a', '/', 's']`, but
|
||||
`['/a/s']`. (There are of course other variations of this.)
|
||||
- Code that rely on some token objects not having the `closed` property could
|
||||
now behave differently.
|
||||
|
||||
|
||||
### Version 3.0.2 (2017-06-28) ###
|
||||
|
||||
- No code changes. Just updates to the readme.
|
||||
|
||||
|
||||
### Version 3.0.1 (2017-01-30) ###
|
||||
|
||||
- Fixed: ES2015 unicode escapes with more than 6 hex digits are now matched
|
||||
correctly.
|
||||
|
||||
|
||||
### Version 3.0.0 (2017-01-11) ###
|
||||
|
||||
This release contains one breaking change, that should [improve performance in
|
||||
V8][v8-perf]:
|
||||
|
||||
> So how can you, as a JavaScript developer, ensure that your RegExps are fast?
|
||||
> If you are not interested in hooking into RegExp internals, make sure that
|
||||
> neither the RegExp instance, nor its prototype is modified in order to get the
|
||||
> best performance:
|
||||
>
|
||||
> ```js
|
||||
> var re = /./g;
|
||||
> re.exec(''); // Fast path.
|
||||
> re.new_property = 'slow';
|
||||
> ```
|
||||
|
||||
This module used to export a single regex, with `.matchToToken` bolted
|
||||
on, just like in the above example. This release changes the exports of
|
||||
the module to avoid this issue.
|
||||
|
||||
Before:
|
||||
|
||||
```js
|
||||
import jsTokens from "js-tokens"
|
||||
// or:
|
||||
var jsTokens = require("js-tokens")
|
||||
var matchToToken = jsTokens.matchToToken
|
||||
```
|
||||
|
||||
After:
|
||||
|
||||
```js
|
||||
import jsTokens, {matchToToken} from "js-tokens"
|
||||
// or:
|
||||
var jsTokens = require("js-tokens").default
|
||||
var matchToToken = require("js-tokens").matchToToken
|
||||
```
|
||||
|
||||
[v8-perf]: http://v8project.blogspot.se/2017/01/speeding-up-v8-regular-expressions.html
|
||||
|
||||
|
||||
### Version 2.0.0 (2016-06-19) ###
|
||||
|
||||
- Added: Support for ES2016. In other words, support for the `**` exponentiation
|
||||
operator.
|
||||
|
||||
These are the breaking changes:
|
||||
|
||||
- `'**'.match(jsTokens)` no longer returns `['*', '*']`, but `['**']`.
|
||||
- `'**='.match(jsTokens)` no longer returns `['*', '*=']`, but `['**=']`.
|
||||
|
||||
|
||||
### Version 1.0.3 (2016-03-27) ###
|
||||
|
||||
- Improved: Made the regex ever so slightly smaller.
|
||||
- Updated: The readme.
|
||||
|
||||
|
||||
### Version 1.0.2 (2015-10-18) ###
|
||||
|
||||
- Improved: Limited npm package contents for a smaller download. Thanks to
|
||||
@zertosh!
|
||||
|
||||
|
||||
### Version 1.0.1 (2015-06-20) ###
|
||||
|
||||
- Fixed: Declared an undeclared variable.
|
||||
|
||||
|
||||
### Version 1.0.0 (2015-02-26) ###
|
||||
|
||||
- Changed: Merged the 'operator' and 'punctuation' types into 'punctuator'. That
|
||||
type is now equivalent to the Punctuator token in the ECMAScript
|
||||
specification. (Backwards-incompatible change.)
|
||||
- Fixed: A `-` followed by a number is now correctly matched as a punctuator
|
||||
followed by a number. It used to be matched as just a number, but there is no
|
||||
such thing as negative number literals. (Possibly backwards-incompatible
|
||||
change.)
|
||||
|
||||
|
||||
### Version 0.4.1 (2015-02-21) ###
|
||||
|
||||
- Added: Support for the regex `u` flag.
|
||||
|
||||
|
||||
### Version 0.4.0 (2015-02-21) ###
|
||||
|
||||
- Improved: `jsTokens.matchToToken` performance.
|
||||
- Added: Support for octal and binary number literals.
|
||||
- Added: Support for template strings.
|
||||
|
||||
|
||||
### Version 0.3.1 (2015-01-06) ###
|
||||
|
||||
- Fixed: Support for unicode spaces. They used to be allowed in names (which is
|
||||
very confusing), and some unicode newlines were wrongly allowed in strings and
|
||||
regexes.
|
||||
|
||||
|
||||
### Version 0.3.0 (2014-12-19) ###
|
||||
|
||||
- Changed: The `jsTokens.names` array has been replaced with the
|
||||
`jsTokens.matchToToken` function. The capturing groups of `jsTokens` are no
|
||||
longer part of the public API; instead use said function. See this [gist] for
|
||||
an example. (Backwards-incompatible change.)
|
||||
- Changed: The empty string is now considered an “invalid” token, instead an
|
||||
“empty” token (its own group). (Backwards-incompatible change.)
|
||||
- Removed: component support. (Backwards-incompatible change.)
|
||||
|
||||
[gist]: https://gist.github.com/lydell/be49dbf80c382c473004
|
||||
|
||||
|
||||
### Version 0.2.0 (2014-06-19) ###
|
||||
|
||||
- Changed: Match ES6 function arrows (`=>`) as an operator, instead of its own
|
||||
category (“functionArrow”), for simplicity. (Backwards-incompatible change.)
|
||||
- Added: ES6 splats (`...`) are now matched as an operator (instead of three
|
||||
punctuations). (Backwards-incompatible change.)
|
||||
|
||||
|
||||
### Version 0.1.0 (2014-03-08) ###
|
||||
|
||||
- Initial release.
|
21
probot/presolver/node_modules/@babel/highlight/node_modules/js-tokens/LICENSE
generated
vendored
21
probot/presolver/node_modules/@babel/highlight/node_modules/js-tokens/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014, 2015, 2016, 2017, 2018 Simon Lydell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
240
probot/presolver/node_modules/@babel/highlight/node_modules/js-tokens/README.md
generated
vendored
240
probot/presolver/node_modules/@babel/highlight/node_modules/js-tokens/README.md
generated
vendored
@ -1,240 +0,0 @@
|
||||
Overview [](https://travis-ci.org/lydell/js-tokens)
|
||||
========
|
||||
|
||||
A regex that tokenizes JavaScript.
|
||||
|
||||
```js
|
||||
var jsTokens = require("js-tokens").default
|
||||
|
||||
var jsString = "var foo=opts.foo;\n..."
|
||||
|
||||
jsString.match(jsTokens)
|
||||
// ["var", " ", "foo", "=", "opts", ".", "foo", ";", "\n", ...]
|
||||
```
|
||||
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
`npm install js-tokens`
|
||||
|
||||
```js
|
||||
import jsTokens from "js-tokens"
|
||||
// or:
|
||||
var jsTokens = require("js-tokens").default
|
||||
```
|
||||
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
### `jsTokens` ###
|
||||
|
||||
A regex with the `g` flag that matches JavaScript tokens.
|
||||
|
||||
The regex _always_ matches, even invalid JavaScript and the empty string.
|
||||
|
||||
The next match is always directly after the previous.
|
||||
|
||||
### `var token = matchToToken(match)` ###
|
||||
|
||||
```js
|
||||
import {matchToToken} from "js-tokens"
|
||||
// or:
|
||||
var matchToToken = require("js-tokens").matchToToken
|
||||
```
|
||||
|
||||
Takes a `match` returned by `jsTokens.exec(string)`, and returns a `{type:
|
||||
String, value: String}` object. The following types are available:
|
||||
|
||||
- string
|
||||
- comment
|
||||
- regex
|
||||
- number
|
||||
- name
|
||||
- punctuator
|
||||
- whitespace
|
||||
- invalid
|
||||
|
||||
Multi-line comments and strings also have a `closed` property indicating if the
|
||||
token was closed or not (see below).
|
||||
|
||||
Comments and strings both come in several flavors. To distinguish them, check if
|
||||
the token starts with `//`, `/*`, `'`, `"` or `` ` ``.
|
||||
|
||||
Names are ECMAScript IdentifierNames, that is, including both identifiers and
|
||||
keywords. You may use [is-keyword-js] to tell them apart.
|
||||
|
||||
Whitespace includes both line terminators and other whitespace.
|
||||
|
||||
[is-keyword-js]: https://github.com/crissdev/is-keyword-js
|
||||
|
||||
|
||||
ECMAScript support
|
||||
==================
|
||||
|
||||
The intention is to always support the latest ECMAScript version whose feature
|
||||
set has been finalized.
|
||||
|
||||
If adding support for a newer version requires changes, a new version with a
|
||||
major verion bump will be released.
|
||||
|
||||
Currently, ECMAScript 2018 is supported.
|
||||
|
||||
|
||||
Invalid code handling
|
||||
=====================
|
||||
|
||||
Unterminated strings are still matched as strings. JavaScript strings cannot
|
||||
contain (unescaped) newlines, so unterminated strings simply end at the end of
|
||||
the line. Unterminated template strings can contain unescaped newlines, though,
|
||||
so they go on to the end of input.
|
||||
|
||||
Unterminated multi-line comments are also still matched as comments. They
|
||||
simply go on to the end of the input.
|
||||
|
||||
Unterminated regex literals are likely matched as division and whatever is
|
||||
inside the regex.
|
||||
|
||||
Invalid ASCII characters have their own capturing group.
|
||||
|
||||
Invalid non-ASCII characters are treated as names, to simplify the matching of
|
||||
names (except unicode spaces which are treated as whitespace). Note: See also
|
||||
the [ES2018](#es2018) section.
|
||||
|
||||
Regex literals may contain invalid regex syntax. They are still matched as
|
||||
regex literals. They may also contain repeated regex flags, to keep the regex
|
||||
simple.
|
||||
|
||||
Strings may contain invalid escape sequences.
|
||||
|
||||
|
||||
Limitations
|
||||
===========
|
||||
|
||||
Tokenizing JavaScript using regexes—in fact, _one single regex_—won’t be
|
||||
perfect. But that’s not the point either.
|
||||
|
||||
You may compare jsTokens with [esprima] by using `esprima-compare.js`.
|
||||
See `npm run esprima-compare`!
|
||||
|
||||
[esprima]: http://esprima.org/
|
||||
|
||||
### Template string interpolation ###
|
||||
|
||||
Template strings are matched as single tokens, from the starting `` ` `` to the
|
||||
ending `` ` ``, including interpolations (whose tokens are not matched
|
||||
individually).
|
||||
|
||||
Matching template string interpolations requires recursive balancing of `{` and
|
||||
`}`—something that JavaScript regexes cannot do. Only one level of nesting is
|
||||
supported.
|
||||
|
||||
### Division and regex literals collision ###
|
||||
|
||||
Consider this example:
|
||||
|
||||
```js
|
||||
var g = 9.82
|
||||
var number = bar / 2/g
|
||||
|
||||
var regex = / 2/g
|
||||
```
|
||||
|
||||
A human can easily understand that in the `number` line we’re dealing with
|
||||
division, and in the `regex` line we’re dealing with a regex literal. How come?
|
||||
Because humans can look at the whole code to put the `/` characters in context.
|
||||
A JavaScript regex cannot. It only sees forwards. (Well, ES2018 regexes can also
|
||||
look backwards. See the [ES2018](#es2018) section).
|
||||
|
||||
When the `jsTokens` regex scans throught the above, it will see the following
|
||||
at the end of both the `number` and `regex` rows:
|
||||
|
||||
```js
|
||||
/ 2/g
|
||||
```
|
||||
|
||||
It is then impossible to know if that is a regex literal, or part of an
|
||||
expression dealing with division.
|
||||
|
||||
Here is a similar case:
|
||||
|
||||
```js
|
||||
foo /= 2/g
|
||||
foo(/= 2/g)
|
||||
```
|
||||
|
||||
The first line divides the `foo` variable with `2/g`. The second line calls the
|
||||
`foo` function with the regex literal `/= 2/g`. Again, since `jsTokens` only
|
||||
sees forwards, it cannot tell the two cases apart.
|
||||
|
||||
There are some cases where we _can_ tell division and regex literals apart,
|
||||
though.
|
||||
|
||||
First off, we have the simple cases where there’s only one slash in the line:
|
||||
|
||||
```js
|
||||
var foo = 2/g
|
||||
foo /= 2
|
||||
```
|
||||
|
||||
Regex literals cannot contain newlines, so the above cases are correctly
|
||||
identified as division. Things are only problematic when there are more than
|
||||
one non-comment slash in a single line.
|
||||
|
||||
Secondly, not every character is a valid regex flag.
|
||||
|
||||
```js
|
||||
var number = bar / 2/e
|
||||
```
|
||||
|
||||
The above example is also correctly identified as division, because `e` is not a
|
||||
valid regex flag. I initially wanted to future-proof by allowing `[a-zA-Z]*`
|
||||
(any letter) as flags, but it is not worth it since it increases the amount of
|
||||
ambigous cases. So only the standard `g`, `m`, `i`, `y` and `u` flags are
|
||||
allowed. This means that the above example will be identified as division as
|
||||
long as you don’t rename the `e` variable to some permutation of `gmiyus` 1 to 6
|
||||
characters long.
|
||||
|
||||
Lastly, we can look _forward_ for information.
|
||||
|
||||
- If the token following what looks like a regex literal is not valid after a
|
||||
regex literal, but is valid in a division expression, then the regex literal
|
||||
is treated as division instead. For example, a flagless regex cannot be
|
||||
followed by a string, number or name, but all of those three can be the
|
||||
denominator of a division.
|
||||
- Generally, if what looks like a regex literal is followed by an operator, the
|
||||
regex literal is treated as division instead. This is because regexes are
|
||||
seldomly used with operators (such as `+`, `*`, `&&` and `==`), but division
|
||||
could likely be part of such an expression.
|
||||
|
||||
Please consult the regex source and the test cases for precise information on
|
||||
when regex or division is matched (should you need to know). In short, you
|
||||
could sum it up as:
|
||||
|
||||
If the end of a statement looks like a regex literal (even if it isn’t), it
|
||||
will be treated as one. Otherwise it should work as expected (if you write sane
|
||||
code).
|
||||
|
||||
### ES2018 ###
|
||||
|
||||
ES2018 added some nice regex improvements to the language.
|
||||
|
||||
- [Unicode property escapes] should allow telling names and invalid non-ASCII
|
||||
characters apart without blowing up the regex size.
|
||||
- [Lookbehind assertions] should allow matching telling division and regex
|
||||
literals apart in more cases.
|
||||
- [Named capture groups] might simplify some things.
|
||||
|
||||
These things would be nice to do, but are not critical. They probably have to
|
||||
wait until the oldest maintained Node.js LTS release supports those features.
|
||||
|
||||
[Unicode property escapes]: http://2ality.com/2017/07/regexp-unicode-property-escapes.html
|
||||
[Lookbehind assertions]: http://2ality.com/2017/05/regexp-lookbehind-assertions.html
|
||||
[Named capture groups]: http://2ality.com/2017/05/regexp-named-capture-groups.html
|
||||
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
[MIT](LICENSE).
|
23
probot/presolver/node_modules/@babel/highlight/node_modules/js-tokens/index.js
generated
vendored
23
probot/presolver/node_modules/@babel/highlight/node_modules/js-tokens/index.js
generated
vendored
@ -1,23 +0,0 @@
|
||||
// Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell
|
||||
// License: MIT. (See LICENSE.)
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
})
|
||||
|
||||
// This regex comes from regex.coffee, and is inserted here by generate-index.js
|
||||
// (run `npm run build`).
|
||||
exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g
|
||||
|
||||
exports.matchToToken = function(match) {
|
||||
var token = {type: "invalid", value: match[0], closed: undefined}
|
||||
if (match[ 1]) token.type = "string" , token.closed = !!(match[3] || match[4])
|
||||
else if (match[ 5]) token.type = "comment"
|
||||
else if (match[ 6]) token.type = "comment", token.closed = !!match[7]
|
||||
else if (match[ 8]) token.type = "regex"
|
||||
else if (match[ 9]) token.type = "number"
|
||||
else if (match[10]) token.type = "name"
|
||||
else if (match[11]) token.type = "punctuator"
|
||||
else if (match[12]) token.type = "whitespace"
|
||||
return token
|
||||
}
|
64
probot/presolver/node_modules/@babel/highlight/node_modules/js-tokens/package.json
generated
vendored
64
probot/presolver/node_modules/@babel/highlight/node_modules/js-tokens/package.json
generated
vendored
@ -1,64 +0,0 @@
|
||||
{
|
||||
"_from": "js-tokens@^4.0.0",
|
||||
"_id": "js-tokens@4.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
|
||||
"_location": "/@babel/highlight/js-tokens",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "js-tokens@^4.0.0",
|
||||
"name": "js-tokens",
|
||||
"escapedName": "js-tokens",
|
||||
"rawSpec": "^4.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/highlight"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||
"_shasum": "19203fb59991df98e3a287050d4647cdeaf32499",
|
||||
"_spec": "js-tokens@^4.0.0",
|
||||
"_where": "/Users/traceybushman/Documents/FreeCodeCamp/presolver/node_modules/@babel/highlight",
|
||||
"author": {
|
||||
"name": "Simon Lydell"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/lydell/js-tokens/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "A regex that tokenizes JavaScript.",
|
||||
"devDependencies": {
|
||||
"coffeescript": "2.1.1",
|
||||
"esprima": "4.0.0",
|
||||
"everything.js": "1.0.3",
|
||||
"mocha": "5.0.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/lydell/js-tokens#readme",
|
||||
"keywords": [
|
||||
"JavaScript",
|
||||
"js",
|
||||
"token",
|
||||
"tokenize",
|
||||
"regex"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "js-tokens",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lydell/js-tokens.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node generate-index.js",
|
||||
"dev": "npm run build && npm test",
|
||||
"esprima-compare": "node esprima-compare ./index.js everything.js/es5.js",
|
||||
"test": "mocha --ui tdd"
|
||||
},
|
||||
"version": "4.0.0"
|
||||
}
|
50
probot/presolver/node_modules/@babel/highlight/package.json
generated
vendored
50
probot/presolver/node_modules/@babel/highlight/package.json
generated
vendored
@ -1,50 +0,0 @@
|
||||
{
|
||||
"_from": "@babel/highlight@^7.0.0",
|
||||
"_id": "@babel/highlight@7.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==",
|
||||
"_location": "/@babel/highlight",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@babel/highlight@^7.0.0",
|
||||
"name": "@babel/highlight",
|
||||
"escapedName": "@babel%2fhighlight",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "^7.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^7.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/code-frame"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz",
|
||||
"_shasum": "f710c38c8d458e6dd9a201afb637fcb781ce99e4",
|
||||
"_spec": "@babel/highlight@^7.0.0",
|
||||
"_where": "/Users/traceybushman/Documents/FreeCodeCamp/presolver/node_modules/@babel/code-frame",
|
||||
"author": {
|
||||
"name": "suchipi",
|
||||
"email": "me@suchipi.com"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"chalk": "^2.0.0",
|
||||
"esutils": "^2.0.2",
|
||||
"js-tokens": "^4.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Syntax highlight JavaScript strings for output in terminals.",
|
||||
"devDependencies": {
|
||||
"strip-ansi": "^4.0.0"
|
||||
},
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "@babel/highlight",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-highlight"
|
||||
},
|
||||
"version": "7.0.0"
|
||||
}
|
22
probot/presolver/node_modules/@octokit/rest/LICENSE
generated
vendored
22
probot/presolver/node_modules/@octokit/rest/LICENSE
generated
vendored
@ -1,22 +0,0 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2012 Cloud9 IDE, Inc. (Mike de Boer)
|
||||
Copyright (c) 2017-2018 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
230
probot/presolver/node_modules/@octokit/rest/README.md
generated
vendored
230
probot/presolver/node_modules/@octokit/rest/README.md
generated
vendored
@ -1,230 +0,0 @@
|
||||
# rest.js
|
||||
|
||||
> GitHub REST API client for JavaScript
|
||||
|
||||
[](https://www.npmjs.com/package/@octokit/rest)
|
||||
[](https://travis-ci.org/octokit/rest.js)
|
||||
[](https://coveralls.io/github/octokit/rest.js)
|
||||
[](https://greenkeeper.io/)
|
||||
|
||||
## Usage
|
||||
|
||||
### Node
|
||||
|
||||
Install with `npm install @octokit/rest`.
|
||||
|
||||
```js
|
||||
const octokit = require('@octokit/rest')()
|
||||
|
||||
// Compare: https://developer.github.com/v3/repos/#list-organization-repositories
|
||||
octokit.repos.getForOrg({
|
||||
org: 'octokit',
|
||||
type: 'public'
|
||||
}).then(({ data, headers, status }) => {
|
||||
// handle data
|
||||
})
|
||||
```
|
||||
|
||||
### Browser
|
||||
|
||||
1. Download `octokit-rest.min.js` from the latest release: https://github.com/octokit/rest.js/releases
|
||||
|
||||
2. Load it as script into your web application:
|
||||
|
||||
```html
|
||||
<script src="octokit-rest.min.js"></script>
|
||||
```
|
||||
|
||||
3. Initialize `octokit`
|
||||
|
||||
```js
|
||||
const octokit = new Octokit()
|
||||
|
||||
// Compare: https://developer.github.com/v3/repos/#list-organization-repositories
|
||||
octokit.repos.getForOrg({
|
||||
org: 'octokit',
|
||||
type: 'public'
|
||||
}).then(({data, headers, status}) => {
|
||||
// handle data
|
||||
})
|
||||
```
|
||||
|
||||
### Client options
|
||||
|
||||
All available client options with default values
|
||||
|
||||
<!-- HEADS UP: when changing the options for the constructor, make sure to also
|
||||
update the type definition templates in scripts/templates/* -->
|
||||
```js
|
||||
const octokit = require('@octokit/rest')({
|
||||
timeout: 0, // 0 means no request timeout
|
||||
headers: {
|
||||
accept: 'application/vnd.github.v3+json',
|
||||
'user-agent': 'octokit/rest.js v1.2.3' // v1.2.3 will be current version
|
||||
},
|
||||
|
||||
// custom GitHub Enterprise URL
|
||||
baseUrl: 'https://api.github.com',
|
||||
|
||||
// Node only: advanced request options can be passed as http(s) agent
|
||||
agent: undefined
|
||||
})
|
||||
```
|
||||
|
||||
`@octokit/rest` API docs: https://octokit.github.io/rest.js/
|
||||
GitHub v3 REST API docs: https://developer.github.com/v3/
|
||||
|
||||
## API Previews
|
||||
|
||||
To take advantage of [GitHub’s API Previews](https://developer.github.com/v3/previews/),
|
||||
pass a custom `accept` header, which you can do with any endpoint method documented
|
||||
in the [API docs](https://octokit.github.io/rest.js/), e.g.
|
||||
|
||||
```js
|
||||
const { data: { topics } } = octokit.repos.get({
|
||||
owner: 'octokit',
|
||||
repo: 'rest.js',
|
||||
headers: {
|
||||
accept: 'application/vnd.github.mercy-preview+json'
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
Multiple preview headers can be combined by separating them with commas
|
||||
|
||||
```js
|
||||
const { data: { topics, codeOfConduct } } = octokit.repos.get({
|
||||
owner: 'octokit',
|
||||
repo: 'rest.js',
|
||||
headers: {
|
||||
accept: 'application/vnd.github.mercy-preview+json,application/vnd.github.scarlet-witch-preview+json'
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Authentication
|
||||
|
||||
Most GitHub API calls don't require authentication. Rules of thumb:
|
||||
|
||||
1. If you can see the information by visiting the site without being logged in, you don't have to be authenticated to retrieve the same information through the API.
|
||||
2. If you want to change data, you have to be authenticated.
|
||||
|
||||
```javascript
|
||||
// basic
|
||||
octokit.authenticate({
|
||||
type: 'basic',
|
||||
username: 'yourusername',
|
||||
password: 'password'
|
||||
})
|
||||
|
||||
// oauth
|
||||
octokit.authenticate({
|
||||
type: 'oauth',
|
||||
token: 'secrettoken123'
|
||||
})
|
||||
|
||||
// oauth key/secret (to get a token)
|
||||
octokit.authenticate({
|
||||
type: 'oauth',
|
||||
key: 'client_id',
|
||||
secret: 'client_secret'
|
||||
})
|
||||
|
||||
// token (https://github.com/settings/tokens)
|
||||
octokit.authenticate({
|
||||
type: 'token',
|
||||
token: 'secrettoken123'
|
||||
})
|
||||
|
||||
// GitHub app
|
||||
octokit.authenticate({
|
||||
type: 'app',
|
||||
token: 'secrettoken123'
|
||||
})
|
||||
```
|
||||
|
||||
Note: `authenticate` is synchronous because it only sets the credentials
|
||||
for the following requests.
|
||||
|
||||
## Pagination
|
||||
|
||||
There are a few pagination-related methods:
|
||||
|
||||
- `hasNextPage(response)`
|
||||
- `hasPreviousPage(response)`
|
||||
- `hasFirstPage(response)`
|
||||
- `hasLastPage(response)`
|
||||
- `getNextPage(response)`
|
||||
- `getPreviousPage(response)`
|
||||
- `getFirstPage(response)`
|
||||
- `getLastPage(response)`
|
||||
|
||||
Usage
|
||||
|
||||
```js
|
||||
async function paginate (method) {
|
||||
let response = await method({ per_page: 100 })
|
||||
let { data } = response
|
||||
while (octokit.hasNextPage(response)) {
|
||||
response = await octokit.getNextPage(response)
|
||||
data = data.concat(response.data)
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
paginate(octokit.repos.getAll)
|
||||
.then(data => {
|
||||
// handle all results
|
||||
})
|
||||
```
|
||||
|
||||
## Debug
|
||||
|
||||
Set `DEBUG=octokit:rest*` for additional debug logs.
|
||||
|
||||
## Tests
|
||||
|
||||
Before running any tests you have to start the [fixtures server](https://github.com/octokit/fixtures-server)
|
||||
|
||||
```
|
||||
$ npm run start-fixtures-server
|
||||
```
|
||||
|
||||
In a second terminal, run the tests
|
||||
|
||||
```bash
|
||||
$ npm test
|
||||
```
|
||||
|
||||
Or run a specific test
|
||||
|
||||
```bash
|
||||
$ ./node_modules/.bin/mocha test/scenarios/get-repository-test.js
|
||||
```
|
||||
|
||||
Run browser tests
|
||||
|
||||
```bash
|
||||
$ npm run test:browser
|
||||
```
|
||||
|
||||
**Note**: In order to run the same [scenario tests](test/scenarios) in both Node
|
||||
and browser, we simulate the Cypress environment in Node, see [test/mocha-node-setup.js](test/mocha-node-setup.js).
|
||||
|
||||
The examples are run as part of the tests. You can set an `EXAMPLES_GITHUB_TOKEN` environment
|
||||
variable (or set it in a `.env` file) to avoid running against GitHub's rate limit.
|
||||
|
||||
## Contributing
|
||||
|
||||
We would love you to contribute to `@octokit/rest`, pull requests are very welcomed!
|
||||
Please see [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
|
||||
|
||||
## Credits
|
||||
|
||||
`@octokit/rest` was originally created as [`node-github`](https://www.npmjs.com/package/github)
|
||||
in 2012 by Mike de Boer from Cloud9 IDE, Inc.
|
||||
It was adopted and renamed by GitHub in 2017
|
||||
|
||||
## LICENSE
|
||||
|
||||
[MIT](LICENSE)
|
25841
probot/presolver/node_modules/@octokit/rest/index.d.ts
generated
vendored
25841
probot/presolver/node_modules/@octokit/rest/index.d.ts
generated
vendored
File diff suppressed because one or more lines are too long
31
probot/presolver/node_modules/@octokit/rest/index.js
generated
vendored
31
probot/presolver/node_modules/@octokit/rest/index.js
generated
vendored
@ -1,31 +0,0 @@
|
||||
module.exports = GitHubApi
|
||||
|
||||
const defaultsDeep = require('lodash/defaultsDeep')
|
||||
const Hook = require('before-after-hook')
|
||||
|
||||
const parseClientOptions = require('./lib/parse-client-options')
|
||||
const request = require('./lib/request')
|
||||
const ENDPOINT_DEFAULTS = require('./lib/endpoint').DEFAULTS
|
||||
|
||||
const PLUGINS = [
|
||||
require('./lib/plugins/authentication'),
|
||||
require('./lib/plugins/endpoint-methods'),
|
||||
require('./lib/plugins/pagination')
|
||||
]
|
||||
|
||||
function GitHubApi (options) {
|
||||
const defaults = defaultsDeep(parseClientOptions(options), ENDPOINT_DEFAULTS)
|
||||
|
||||
const hook = new Hook()
|
||||
const api = {
|
||||
// NOTE: github.hook, github.plugin and github.request are experimental APIs
|
||||
// at this point and can change at any time
|
||||
hook,
|
||||
plugin: (pluginFunction) => pluginFunction(api),
|
||||
request: (options) => api.hook('request', defaultsDeep(options, defaults), request)
|
||||
}
|
||||
|
||||
PLUGINS.forEach(api.plugin)
|
||||
|
||||
return api
|
||||
}
|
4293
probot/presolver/node_modules/@octokit/rest/index.js.flow
generated
vendored
4293
probot/presolver/node_modules/@octokit/rest/index.js.flow
generated
vendored
File diff suppressed because it is too large
Load Diff
8
probot/presolver/node_modules/@octokit/rest/lib/defaults.js
generated
vendored
8
probot/presolver/node_modules/@octokit/rest/lib/defaults.js
generated
vendored
@ -1,8 +0,0 @@
|
||||
module.exports = {
|
||||
agent: undefined, // https://nodejs.org/api/https.html#https_class_https_agent
|
||||
headers: {
|
||||
accept: 'application/vnd.github.v3+json'
|
||||
},
|
||||
timeout: 0,
|
||||
baseUrl: 'https://api.github.com'
|
||||
}
|
12
probot/presolver/node_modules/@octokit/rest/lib/deprecate.js
generated
vendored
12
probot/presolver/node_modules/@octokit/rest/lib/deprecate.js
generated
vendored
@ -1,12 +0,0 @@
|
||||
module.exports = deprecate
|
||||
|
||||
const loggedMessages = {}
|
||||
|
||||
function deprecate (message) {
|
||||
if (loggedMessages[message]) {
|
||||
return
|
||||
}
|
||||
|
||||
console.warn(`DEPRECATED (@octokit/rest): ${message}`)
|
||||
loggedMessages[message] = 1
|
||||
}
|
69
probot/presolver/node_modules/@octokit/rest/lib/endpoint/README.md
generated
vendored
69
probot/presolver/node_modules/@octokit/rest/lib/endpoint/README.md
generated
vendored
@ -1,69 +0,0 @@
|
||||
[back to `@octokit/rest`]('../..')
|
||||
|
||||
# `@octokit/rest/endpoint`
|
||||
|
||||
> Turn REST API endpoint options into generic request options
|
||||
|
||||
---
|
||||
|
||||
# ⚠️ This is not a public API at this point and can change at any time
|
||||
|
||||
---
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const octokitRestEndpoint = require('@octokit/rest/lib/endpoint')
|
||||
|
||||
const options = octokitRestEndpoint({
|
||||
// request options
|
||||
method: 'GET',
|
||||
url: '/orgs/:org/repos',
|
||||
// parameters
|
||||
org: 'octokit',
|
||||
type: 'private'
|
||||
})
|
||||
```
|
||||
|
||||
`options` would now look something like
|
||||
|
||||
```js
|
||||
{
|
||||
method: 'GET',
|
||||
url: 'https://api.github.com/orgs/octokit/repos?type=private',
|
||||
headers: {
|
||||
'user-agent': 'myApp v1.2.3',
|
||||
accept: 'application/vnd.github.v3+json'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can pass them to your request library of preference.
|
||||
|
||||
## Options
|
||||
|
||||
### `method`
|
||||
|
||||
Any supported [http verb](https://developer.github.com/v3/#http-verbs), case insensitive.
|
||||
|
||||
### `url`
|
||||
|
||||
A path or full URL which may contain `:variable` or `{variable}` placeholders,
|
||||
e.g. `/orgs/:org/repos`. The `url` is parsed using
|
||||
|
||||
## Defaults
|
||||
|
||||
| Name | Value |
|
||||
|------------------------|-------------------------------------------------------------------------------------|
|
||||
| **method** | `'get'` |
|
||||
| **baseUrl** | `'https://api.github.com'` |
|
||||
| **headers.accept** | `'application/vnd.github.v3+json'` |
|
||||
| **headers.user-agent** | `'octokit/rest.js v1.2.3'` (1.2.3 being the current `@octokit/rest` version number) plus what ever [universal-user-agent](https://www.npmjs.com/package/universal-user-agent) returns. If you pass a custom value such as `myApp v1.2.3` then it will be used as prefix |
|
||||
|
||||
_To be done_: change defaults with
|
||||
|
||||
```js
|
||||
const octokitRestEndpoint = require('@octokit/rest/lib/endpoint').defaults({
|
||||
baseUrl: 'http://my-custom-host/api/v3'
|
||||
})
|
||||
```
|
22
probot/presolver/node_modules/@octokit/rest/lib/endpoint/add-query-parameters.js
generated
vendored
22
probot/presolver/node_modules/@octokit/rest/lib/endpoint/add-query-parameters.js
generated
vendored
@ -1,22 +0,0 @@
|
||||
module.exports = addQueryParameters
|
||||
|
||||
function addQueryParameters (url, parameters) {
|
||||
const separator = /\?/.test(url) ? '&' : '?'
|
||||
const names = Object.keys(parameters)
|
||||
|
||||
if (names.length === 0) {
|
||||
return url
|
||||
}
|
||||
|
||||
return url + separator + names
|
||||
.map(name => {
|
||||
if (name === 'q') {
|
||||
return 'q=' + parameters.q.split('+')
|
||||
.map(encodeURIComponent)
|
||||
.join('+')
|
||||
}
|
||||
|
||||
return `${name}=${encodeURIComponent(parameters[name])}`
|
||||
})
|
||||
.join('&')
|
||||
}
|
8
probot/presolver/node_modules/@octokit/rest/lib/endpoint/defaults.js
generated
vendored
8
probot/presolver/node_modules/@octokit/rest/lib/endpoint/defaults.js
generated
vendored
@ -1,8 +0,0 @@
|
||||
module.exports = {
|
||||
method: 'get',
|
||||
baseUrl: 'https://api.github.com',
|
||||
headers: {
|
||||
accept: 'application/vnd.github.v3+json'
|
||||
},
|
||||
request: {}
|
||||
}
|
18
probot/presolver/node_modules/@octokit/rest/lib/endpoint/extract-url-variable-names.js
generated
vendored
18
probot/presolver/node_modules/@octokit/rest/lib/endpoint/extract-url-variable-names.js
generated
vendored
@ -1,18 +0,0 @@
|
||||
module.exports = extractUrlVariableName
|
||||
|
||||
const flatten = require('lodash/flatten')
|
||||
|
||||
const urlVariableRegex = /\{[^}]+\}/g
|
||||
function extractUrlVariableName (url) {
|
||||
const matches = url.match(urlVariableRegex)
|
||||
|
||||
if (!matches) {
|
||||
return []
|
||||
}
|
||||
|
||||
return flatten(matches.map(removeNonChars))
|
||||
}
|
||||
|
||||
function removeNonChars (variableName) {
|
||||
return variableName.replace(/^\W+|\W+$/g, '').split(/,/)
|
||||
}
|
72
probot/presolver/node_modules/@octokit/rest/lib/endpoint/index.js
generated
vendored
72
probot/presolver/node_modules/@octokit/rest/lib/endpoint/index.js
generated
vendored
@ -1,72 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = restEndpoint
|
||||
|
||||
const defaultsDeep = require('lodash/defaultsDeep')
|
||||
const intersection = require('lodash/intersection')
|
||||
const mapKeys = require('lodash/mapKeys')
|
||||
const omit = require('lodash/omit')
|
||||
const urlTemplate = require('url-template')
|
||||
const getUserAgent = require('universal-user-agent')
|
||||
|
||||
const addQueryParameters = require('./add-query-parameters')
|
||||
const extractUrlVariableNames = require('./extract-url-variable-names')
|
||||
const pkg = require('../../package.json')
|
||||
|
||||
const DEFAULTS = module.exports.DEFAULTS = require('./defaults')
|
||||
const NON_PARAMETERS = [
|
||||
'request',
|
||||
'baseUrl'
|
||||
]
|
||||
|
||||
function restEndpoint (options) {
|
||||
// lowercase header names (#760)
|
||||
options.headers = mapKeys(options.headers, (value, key) => key.toLowerCase())
|
||||
|
||||
let userAgent = `octokit.js/${pkg.version} ${getUserAgent()}`
|
||||
if (options.headers['user-agent']) {
|
||||
userAgent = `${options.headers['user-agent']} ${userAgent}`
|
||||
}
|
||||
options.headers['user-agent'] = userAgent
|
||||
|
||||
options = defaultsDeep({}, options, DEFAULTS)
|
||||
|
||||
let method = options.method.toLowerCase()
|
||||
let baseUrl = options.baseUrl
|
||||
let url = options.url
|
||||
let body = options.body
|
||||
let headers = options.headers
|
||||
let remainingOptions = omit(options, ['method', 'baseUrl', 'url', 'headers'])
|
||||
|
||||
// replace :varname with {varname} to make it RFC 6570 compatible
|
||||
url = url.replace(/:([a-z]\w+)/g, '{+$1}')
|
||||
|
||||
// extract variable names from URL to calculate remaining variables later
|
||||
const urlVariableNames = extractUrlVariableNames(url)
|
||||
|
||||
url = urlTemplate.parse(url).expand(remainingOptions)
|
||||
|
||||
if (!/^http/.test(url)) {
|
||||
url = (baseUrl) + url
|
||||
}
|
||||
|
||||
const requestOptions = remainingOptions.request
|
||||
remainingOptions = omit(remainingOptions, intersection(Object.keys(options), urlVariableNames).concat(NON_PARAMETERS))
|
||||
|
||||
if (method === 'get' || method === 'head') {
|
||||
url = addQueryParameters(url, remainingOptions)
|
||||
} else {
|
||||
if ('input' in remainingOptions) {
|
||||
body = remainingOptions.input
|
||||
} else {
|
||||
body = Object.keys(remainingOptions).length ? remainingOptions : undefined
|
||||
}
|
||||
}
|
||||
|
||||
return Object.assign(requestOptions, {
|
||||
method,
|
||||
url,
|
||||
headers,
|
||||
body
|
||||
})
|
||||
}
|
53
probot/presolver/node_modules/@octokit/rest/lib/get-request-agent.js
generated
vendored
53
probot/presolver/node_modules/@octokit/rest/lib/get-request-agent.js
generated
vendored
@ -1,53 +0,0 @@
|
||||
module.exports = getRequestAgent
|
||||
|
||||
const urlParse = require('url').parse
|
||||
|
||||
const HttpAgent = require('http').Agent
|
||||
const HttpsAgent = require('https').Agent
|
||||
const HttpProxyAgent = require('http-proxy-agent')
|
||||
const HttpsProxyAgent = require('https-proxy-agent')
|
||||
const merge = require('lodash/merge')
|
||||
const omit = require('lodash/omit')
|
||||
const pick = require('lodash/pick')
|
||||
|
||||
const deprecate = require('./deprecate')
|
||||
|
||||
function getRequestAgent (baseUrl, options) {
|
||||
if (options.agent) {
|
||||
return options.agent
|
||||
}
|
||||
|
||||
const agentOptionNames = ['ca', 'proxy', 'rejectUnauthorized', 'family'].filter(key => key in options)
|
||||
|
||||
if (agentOptionNames.length === 0) {
|
||||
return
|
||||
}
|
||||
agentOptionNames.forEach(option => {
|
||||
deprecate(`options.${option} (use "options.agent" instead)`)
|
||||
})
|
||||
|
||||
const agentOptions = pick(options, agentOptionNames)
|
||||
|
||||
const protocol = urlParse(baseUrl).protocol.replace(':', '')
|
||||
|
||||
/* istanbul ignore if */
|
||||
if ('proxy' in options) {
|
||||
const proxyAgentOptions = merge(
|
||||
urlParse(agentOptions.proxy),
|
||||
omit(agentOptions, 'proxy')
|
||||
)
|
||||
|
||||
if (protocol === 'http') {
|
||||
return new HttpProxyAgent(proxyAgentOptions)
|
||||
}
|
||||
|
||||
return new HttpsProxyAgent(proxyAgentOptions)
|
||||
}
|
||||
|
||||
/* istanbul ignore if */
|
||||
if (protocol === 'http') {
|
||||
return new HttpAgent(agentOptions)
|
||||
}
|
||||
|
||||
return new HttpsAgent(agentOptions)
|
||||
}
|
75
probot/presolver/node_modules/@octokit/rest/lib/parse-client-options.js
generated
vendored
75
probot/presolver/node_modules/@octokit/rest/lib/parse-client-options.js
generated
vendored
@ -1,75 +0,0 @@
|
||||
module.exports = parseOptions
|
||||
|
||||
const defaults = require('lodash/defaults')
|
||||
const pick = require('lodash/pick')
|
||||
|
||||
const deprecate = require('./deprecate')
|
||||
const getRequestAgent = require('./get-request-agent')
|
||||
const DEFAULTS = require('./defaults')
|
||||
const OPTION_NAMES = [
|
||||
'timeout',
|
||||
'baseUrl',
|
||||
'agent',
|
||||
'headers'
|
||||
]
|
||||
|
||||
function parseOptions (userOptions) {
|
||||
if (!userOptions) {
|
||||
userOptions = {}
|
||||
}
|
||||
|
||||
if ('followRedirects' in userOptions) {
|
||||
deprecate('followRedirects option is no longer supported. All redirects are followed correctly')
|
||||
}
|
||||
|
||||
if ('protocol' in userOptions) {
|
||||
deprecate('protocol option is no longer supported')
|
||||
}
|
||||
|
||||
if ('host' in userOptions) {
|
||||
deprecate('host option is no longer supported')
|
||||
}
|
||||
|
||||
if ('port' in userOptions) {
|
||||
deprecate('port option is no longer supported')
|
||||
}
|
||||
|
||||
if ('pathPrefix' in userOptions) {
|
||||
deprecate('pathPrefix option is no longer supported')
|
||||
}
|
||||
|
||||
if ('Promise' in userOptions) {
|
||||
deprecate('Promise option is no longer supported. The native Promise API is used')
|
||||
}
|
||||
|
||||
const options = defaults(pick(userOptions, OPTION_NAMES), DEFAULTS)
|
||||
|
||||
const clientDefaults = {
|
||||
baseUrl: options.baseUrl,
|
||||
headers: options.headers,
|
||||
request: {
|
||||
timeout: options.timeout
|
||||
}
|
||||
}
|
||||
if (userOptions.protocol) {
|
||||
clientDefaults.baseUrl = `${userOptions.protocol}://${userOptions.host}`
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (userOptions.port) {
|
||||
clientDefaults.baseUrl += `:${userOptions.port}`
|
||||
}
|
||||
|
||||
// Check if a prefix is passed in the options and strip any leading or trailing slashes from it.
|
||||
/* istanbul ignore else */
|
||||
if (userOptions.pathPrefix) {
|
||||
clientDefaults.baseUrl += '/' + userOptions.pathPrefix.replace(/(^[/]+|[/]+$)/g, '')
|
||||
}
|
||||
}
|
||||
/* istanbul ignore else */
|
||||
|
||||
if (!process.browser) {
|
||||
clientDefaults.request.agent = getRequestAgent(clientDefaults.baseUrl, userOptions)
|
||||
}
|
||||
|
||||
return clientDefaults
|
||||
}
|
31
probot/presolver/node_modules/@octokit/rest/lib/plugins/README.md
generated
vendored
31
probot/presolver/node_modules/@octokit/rest/lib/plugins/README.md
generated
vendored
@ -1,31 +0,0 @@
|
||||
# `@octokit/plugins/*`
|
||||
|
||||
---
|
||||
|
||||
# ⚠️ Plugins are currently experimental. APIs can change at any time.
|
||||
|
||||
---
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const octokit = require('@octokit/rest')()
|
||||
|
||||
function myPlugin (octokit) {
|
||||
octokit.myMethod = function () {
|
||||
// ...
|
||||
}
|
||||
octokit.hook.before('request', (options) => {
|
||||
// change options or cancel request.
|
||||
// return promise for async methods
|
||||
})
|
||||
octokit.hook.after('request', (result, options) => {
|
||||
// ...
|
||||
})
|
||||
}
|
||||
|
||||
octokit.plugin(myPlugin)
|
||||
|
||||
octokit.myMethod()
|
||||
octokit.request({ url: '/' }) // runs before/after hooks defined above
|
||||
```
|
35
probot/presolver/node_modules/@octokit/rest/lib/plugins/authentication/authenticate.js
generated
vendored
35
probot/presolver/node_modules/@octokit/rest/lib/plugins/authentication/authenticate.js
generated
vendored
@ -1,35 +0,0 @@
|
||||
module.exports = authenticate
|
||||
|
||||
function authenticate (state, options) {
|
||||
if (!options) {
|
||||
state.auth = false
|
||||
return
|
||||
}
|
||||
|
||||
switch (options.type) {
|
||||
case 'basic':
|
||||
if (!options.username || !options.password) {
|
||||
throw new Error('Basic authentication requires both a username and password to be set')
|
||||
}
|
||||
break
|
||||
|
||||
case 'oauth':
|
||||
if (!options.token && !(options.key && options.secret)) {
|
||||
throw new Error('OAuth2 authentication requires a token or key & secret to be set')
|
||||
}
|
||||
break
|
||||
|
||||
case 'token':
|
||||
case 'integration':
|
||||
case 'app':
|
||||
if (!options.token) {
|
||||
throw new Error('Token authentication requires a token to be set')
|
||||
}
|
||||
break
|
||||
|
||||
default:
|
||||
throw new Error("Invalid authentication type, must be 'basic', 'integration', or 'oauth'")
|
||||
}
|
||||
|
||||
state.auth = options
|
||||
}
|
48
probot/presolver/node_modules/@octokit/rest/lib/plugins/authentication/before-request.js
generated
vendored
48
probot/presolver/node_modules/@octokit/rest/lib/plugins/authentication/before-request.js
generated
vendored
@ -1,48 +0,0 @@
|
||||
module.exports = authenticationBeforeRequest
|
||||
|
||||
const btoa = require('btoa-lite')
|
||||
const uniq = require('lodash/uniq')
|
||||
|
||||
const deprecate = require('../../deprecate')
|
||||
|
||||
function authenticationBeforeRequest (state, options) {
|
||||
if (!state.auth.type) {
|
||||
return
|
||||
}
|
||||
|
||||
if (state.auth.type === 'basic') {
|
||||
const hash = btoa(`${state.auth.username}:${state.auth.password}`)
|
||||
options.headers['authorization'] = `Basic ${hash}`
|
||||
return
|
||||
}
|
||||
|
||||
if (state.auth.type === 'token') {
|
||||
options.headers['authorization'] = `token ${state.auth.token}`
|
||||
return
|
||||
}
|
||||
|
||||
// deprecate state.auth.type === 'integration', rename to 'app'
|
||||
if (state.auth.type === 'integration') {
|
||||
deprecate('authentication type "integration" is deprecated. Use "app" instead.')
|
||||
state.auth.type = 'app'
|
||||
}
|
||||
|
||||
if (state.auth.type === 'app') {
|
||||
options.headers['authorization'] = `Bearer ${state.auth.token}`
|
||||
const acceptHeaders = options.headers['accept'].split(',')
|
||||
.concat('application/vnd.github.machine-man-preview+json')
|
||||
options.headers['accept'] = uniq(acceptHeaders).filter(Boolean).join(',')
|
||||
return
|
||||
}
|
||||
|
||||
options.url += options.url.indexOf('?') === -1 ? '?' : '&'
|
||||
|
||||
if (state.auth.token) {
|
||||
options.url += `access_token=${encodeURIComponent(state.auth.token)}`
|
||||
return
|
||||
}
|
||||
|
||||
const key = encodeURIComponent(state.auth.key)
|
||||
const secret = encodeURIComponent(state.auth.secret)
|
||||
options.url += `client_id=${key}&client_secret=${secret}`
|
||||
}
|
12
probot/presolver/node_modules/@octokit/rest/lib/plugins/authentication/index.js
generated
vendored
12
probot/presolver/node_modules/@octokit/rest/lib/plugins/authentication/index.js
generated
vendored
@ -1,12 +0,0 @@
|
||||
module.exports = authenticationPlugin
|
||||
|
||||
const authenticate = require('./authenticate')
|
||||
const beforeRequest = require('./before-request')
|
||||
|
||||
function authenticationPlugin (octokit) {
|
||||
const state = {
|
||||
auth: false
|
||||
}
|
||||
octokit.authenticate = authenticate.bind(null, state)
|
||||
octokit.hook.before('request', beforeRequest.bind(null, state))
|
||||
}
|
33
probot/presolver/node_modules/@octokit/rest/lib/plugins/endpoint-methods/index.js
generated
vendored
33
probot/presolver/node_modules/@octokit/rest/lib/plugins/endpoint-methods/index.js
generated
vendored
@ -1,33 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = apiPlugin
|
||||
|
||||
const get = require('lodash/get')
|
||||
const pick = require('lodash/pick')
|
||||
|
||||
const method = require('./method')
|
||||
|
||||
const ENDPOINT_DEFAULTS = require('../../routes.json')
|
||||
|
||||
function apiPlugin (octokit) {
|
||||
Object.keys(ENDPOINT_DEFAULTS).forEach(namespaceName => {
|
||||
octokit[namespaceName] = {}
|
||||
|
||||
Object.keys(ENDPOINT_DEFAULTS[namespaceName]).forEach(apiName => {
|
||||
let apiOptions = ENDPOINT_DEFAULTS[namespaceName][apiName]
|
||||
let deprecated
|
||||
|
||||
if (apiOptions.alias) {
|
||||
deprecated = apiOptions.deprecated
|
||||
apiOptions = get(ENDPOINT_DEFAULTS, apiOptions.alias)
|
||||
}
|
||||
|
||||
const endpointDefaults = pick(apiOptions, ['method', 'url', 'headers', 'request'])
|
||||
if (deprecated) {
|
||||
endpointDefaults.deprecated = deprecated
|
||||
}
|
||||
|
||||
octokit[namespaceName][apiName] = method.bind(null, octokit, endpointDefaults, apiOptions.params)
|
||||
})
|
||||
})
|
||||
}
|
34
probot/presolver/node_modules/@octokit/rest/lib/plugins/endpoint-methods/method.js
generated
vendored
34
probot/presolver/node_modules/@octokit/rest/lib/plugins/endpoint-methods/method.js
generated
vendored
@ -1,34 +0,0 @@
|
||||
module.exports = apiMethod
|
||||
|
||||
const clone = require('lodash/clone')
|
||||
const defaultsDeep = require('lodash/defaultsDeep')
|
||||
const mapKeys = require('lodash/mapKeys')
|
||||
|
||||
const deprecate = require('../../deprecate')
|
||||
const validate = require('./validate')
|
||||
|
||||
function apiMethod (octokit, endpointDefaults, endpointParams, options, callback) {
|
||||
// Do not alter passed options (#786)
|
||||
options = clone(options) || {}
|
||||
|
||||
// lowercase header names (#760)
|
||||
options.headers = mapKeys(options.headers, (value, key) => key.toLowerCase())
|
||||
|
||||
if (endpointDefaults.deprecated) {
|
||||
deprecate(endpointDefaults.deprecated)
|
||||
delete endpointDefaults.deprecated
|
||||
}
|
||||
|
||||
const endpointOptions = defaultsDeep(options, endpointDefaults)
|
||||
|
||||
const promise = Promise.resolve(endpointOptions)
|
||||
.then(validate.bind(null, endpointParams))
|
||||
.then(octokit.request)
|
||||
|
||||
if (callback) {
|
||||
promise.then(callback.bind(null, null), callback)
|
||||
return
|
||||
}
|
||||
|
||||
return promise
|
||||
}
|
117
probot/presolver/node_modules/@octokit/rest/lib/plugins/endpoint-methods/validate.js
generated
vendored
117
probot/presolver/node_modules/@octokit/rest/lib/plugins/endpoint-methods/validate.js
generated
vendored
@ -1,117 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = validate
|
||||
|
||||
const set = require('lodash/set')
|
||||
const get = require('lodash/get')
|
||||
const HttpError = require('../../request/http-error')
|
||||
const deprecate = require('../../deprecate')
|
||||
|
||||
function validate (endpointParams, options) {
|
||||
// Alias are handled before validation, as validation rules
|
||||
// ar set the aliased parameter. The `mapTo` property is the other way
|
||||
// around, the final parameter name is the mapTo value, but validation
|
||||
// rules are on parameter with the mapTo property
|
||||
Object.keys(options).forEach(optionName => {
|
||||
if (!endpointParams[optionName] || !endpointParams[optionName].alias) {
|
||||
return
|
||||
}
|
||||
|
||||
set(options, endpointParams[optionName].alias, options[optionName])
|
||||
delete options[optionName]
|
||||
|
||||
// right now all parameters with an alias property also have a deprecated
|
||||
// property, but that might change in future, so we wrap it in the if block,
|
||||
// but ignore if for coverage
|
||||
/* istanbul ignore else */
|
||||
if (endpointParams[optionName].deprecated) {
|
||||
deprecate(`"${optionName}" parameter has been renamed to "${endpointParams[optionName].alias}"`)
|
||||
}
|
||||
})
|
||||
|
||||
Object.keys(endpointParams).forEach(parameterName => {
|
||||
const parameter = get(endpointParams, parameterName)
|
||||
const expectedType = parameter.type
|
||||
let parentParameterName
|
||||
let parentValue
|
||||
let parentParamIsPresent = true
|
||||
let parentParameterIsArray = false
|
||||
|
||||
if (/\./.test(parameterName)) {
|
||||
parentParameterName = parameterName.replace(/\.[^.]+$/, '')
|
||||
parentParameterIsArray = parentParameterName.slice(-2) === '[]'
|
||||
if (parentParameterIsArray) {
|
||||
parentParameterName = parentParameterName.slice(0, -2)
|
||||
}
|
||||
parentValue = get(options, parentParameterName)
|
||||
parentParamIsPresent = parentParameterName === 'headers' || (typeof parentValue === 'object' && parentValue !== null)
|
||||
}
|
||||
|
||||
let values = parentParameterIsArray
|
||||
? (get(options, parentParameterName) || []).map(value => value[parameterName.split(/\./).pop()])
|
||||
: [get(options, parameterName)]
|
||||
|
||||
values.forEach((value, i) => {
|
||||
const valueIsPresent = typeof value !== 'undefined'
|
||||
const valueIsNull = value === null
|
||||
const currentParameterName = parentParameterIsArray
|
||||
? parameterName.replace(/\[\]/, `[${i}]`)
|
||||
: parameterName
|
||||
|
||||
if (!parameter.required && !valueIsPresent) {
|
||||
return
|
||||
}
|
||||
|
||||
// if the parent parameter is of type object but allows null
|
||||
// then the child parameters can be ignored
|
||||
if (!parentParamIsPresent) {
|
||||
return
|
||||
}
|
||||
|
||||
if (parameter.allowNull && valueIsNull) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!parameter.allowNull && valueIsNull) {
|
||||
throw new HttpError(`'${currentParameterName}' cannot be null`, 400)
|
||||
}
|
||||
|
||||
if (parameter.required && !valueIsPresent) {
|
||||
throw new HttpError(`Empty value for parameter '${currentParameterName}': ${JSON.stringify(value)}`, 400)
|
||||
}
|
||||
|
||||
// parse to integer before checking for enum
|
||||
// so that string "1" will match enum with number 1
|
||||
if (expectedType === 'integer') {
|
||||
const unparsedValue = value
|
||||
value = parseInt(value, 10)
|
||||
if (isNaN(value)) {
|
||||
throw new HttpError(`Invalid value for parameter '${currentParameterName}': ${JSON.stringify(unparsedValue)} is NaN`, 400)
|
||||
}
|
||||
}
|
||||
|
||||
if (parameter.enum && parameter.enum.indexOf(value) === -1) {
|
||||
throw new HttpError(`Invalid value for parameter '${currentParameterName}': ${JSON.stringify(value)}`, 400)
|
||||
}
|
||||
|
||||
if (parameter.validation) {
|
||||
const regex = new RegExp(parameter.validation)
|
||||
if (!regex.test(value)) {
|
||||
throw new HttpError(`Invalid value for parameter '${currentParameterName}': ${JSON.stringify(value)}`, 400)
|
||||
}
|
||||
}
|
||||
|
||||
if (expectedType === 'object' && typeof value === 'string') {
|
||||
try {
|
||||
value = JSON.parse(value)
|
||||
} catch (exception) {
|
||||
throw new HttpError(`JSON parse error of value for parameter '${currentParameterName}': ${JSON.stringify(value)}`, 400)
|
||||
}
|
||||
}
|
||||
|
||||
set(options, parameter.mapTo || currentParameterName, value)
|
||||
})
|
||||
})
|
||||
|
||||
return options
|
||||
}
|
7
probot/presolver/node_modules/@octokit/rest/lib/plugins/pagination/get-first-page.js
generated
vendored
7
probot/presolver/node_modules/@octokit/rest/lib/plugins/pagination/get-first-page.js
generated
vendored
@ -1,7 +0,0 @@
|
||||
module.exports = getFirstPage
|
||||
|
||||
const getPage = require('./get-page')
|
||||
|
||||
function getFirstPage (octokit, link, headers, callback) {
|
||||
return getPage(octokit, link, 'first', headers, callback)
|
||||
}
|
7
probot/presolver/node_modules/@octokit/rest/lib/plugins/pagination/get-last-page.js
generated
vendored
7
probot/presolver/node_modules/@octokit/rest/lib/plugins/pagination/get-last-page.js
generated
vendored
@ -1,7 +0,0 @@
|
||||
module.exports = getLastPage
|
||||
|
||||
const getPage = require('./get-page')
|
||||
|
||||
function getLastPage (octokit, link, headers, callback) {
|
||||
return getPage(octokit, link, 'last', headers, callback)
|
||||
}
|
7
probot/presolver/node_modules/@octokit/rest/lib/plugins/pagination/get-next-page.js
generated
vendored
7
probot/presolver/node_modules/@octokit/rest/lib/plugins/pagination/get-next-page.js
generated
vendored
@ -1,7 +0,0 @@
|
||||
module.exports = getNextPage
|
||||
|
||||
const getPage = require('./get-page')
|
||||
|
||||
function getNextPage (octokit, link, headers, callback) {
|
||||
return getPage(octokit, link, 'next', headers, callback)
|
||||
}
|
15
probot/presolver/node_modules/@octokit/rest/lib/plugins/pagination/get-page-links.js
generated
vendored
15
probot/presolver/node_modules/@octokit/rest/lib/plugins/pagination/get-page-links.js
generated
vendored
@ -1,15 +0,0 @@
|
||||
module.exports = getPageLinks
|
||||
|
||||
function getPageLinks (link) {
|
||||
link = link.link || link.headers.link || ''
|
||||
|
||||
const links = {}
|
||||
|
||||
// link format:
|
||||
// '<https://api.github.com/users/aseemk/followers?page=2>; rel="next", <https://api.github.com/users/aseemk/followers?page=2>; rel="last"'
|
||||
link.replace(/<([^>]*)>;\s*rel="([\w]*)"/g, (m, uri, type) => {
|
||||
links[type] = uri
|
||||
})
|
||||
|
||||
return links
|
||||
}
|
49
probot/presolver/node_modules/@octokit/rest/lib/plugins/pagination/get-page.js
generated
vendored
49
probot/presolver/node_modules/@octokit/rest/lib/plugins/pagination/get-page.js
generated
vendored
@ -1,49 +0,0 @@
|
||||
module.exports = getPage
|
||||
|
||||
const HttpError = require('../../request/http-error')
|
||||
const getPageLinks = require('./get-page-links')
|
||||
|
||||
function getPage (octokit, link, which, headers, callback) {
|
||||
if (typeof headers === 'function') {
|
||||
callback = headers
|
||||
headers = null
|
||||
}
|
||||
|
||||
const url = getPageLinks(link)[which]
|
||||
|
||||
if (!url) {
|
||||
const urlError = new HttpError(`No ${which} page found`, 404)
|
||||
if (callback) {
|
||||
return callback(urlError)
|
||||
}
|
||||
return Promise.reject(urlError)
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
url,
|
||||
headers: applyAcceptHeader(link, headers)
|
||||
}
|
||||
|
||||
const promise = octokit.request(requestOptions)
|
||||
|
||||
if (callback) {
|
||||
promise.then(callback.bind(null, null), callback)
|
||||
return
|
||||
}
|
||||
|
||||
return promise
|
||||
}
|
||||
|
||||
function applyAcceptHeader (res, headers) {
|
||||
const previous = res.headers && res.headers['x-github-media-type']
|
||||
|
||||
if (!previous || (headers && headers.accept)) {
|
||||
return headers
|
||||
}
|
||||
headers = headers || {}
|
||||
headers.accept = 'application/vnd.' + previous
|
||||
.replace('; param=', '.')
|
||||
.replace('; format=', '+')
|
||||
|
||||
return headers
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
module.exports = getPreviousPage
|
||||
|
||||
const getPage = require('./get-page')
|
||||
|
||||
function getPreviousPage (octokit, link, headers, callback) {
|
||||
return getPage(octokit, link, 'prev', headers, callback)
|
||||
}
|
7
probot/presolver/node_modules/@octokit/rest/lib/plugins/pagination/has-first-page.js
generated
vendored
7
probot/presolver/node_modules/@octokit/rest/lib/plugins/pagination/has-first-page.js
generated
vendored
@ -1,7 +0,0 @@
|
||||
module.exports = hasFirstPage
|
||||
|
||||
const getPageLinks = require('./get-page-links')
|
||||
|
||||
function hasFirstPage (link) {
|
||||
return getPageLinks(link).first
|
||||
}
|
7
probot/presolver/node_modules/@octokit/rest/lib/plugins/pagination/has-last-page.js
generated
vendored
7
probot/presolver/node_modules/@octokit/rest/lib/plugins/pagination/has-last-page.js
generated
vendored
@ -1,7 +0,0 @@
|
||||
module.exports = hasLastPage
|
||||
|
||||
const getPageLinks = require('./get-page-links')
|
||||
|
||||
function hasLastPage (link) {
|
||||
return getPageLinks(link).last
|
||||
}
|
7
probot/presolver/node_modules/@octokit/rest/lib/plugins/pagination/has-next-page.js
generated
vendored
7
probot/presolver/node_modules/@octokit/rest/lib/plugins/pagination/has-next-page.js
generated
vendored
@ -1,7 +0,0 @@
|
||||
module.exports = hasNextPage
|
||||
|
||||
const getPageLinks = require('./get-page-links')
|
||||
|
||||
function hasNextPage (link) {
|
||||
return getPageLinks(link).next
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
module.exports = hasPreviousPage
|
||||
|
||||
const getPageLinks = require('./get-page-links')
|
||||
|
||||
function hasPreviousPage (link) {
|
||||
return getPageLinks(link).prev
|
||||
}
|
12
probot/presolver/node_modules/@octokit/rest/lib/plugins/pagination/index.js
generated
vendored
12
probot/presolver/node_modules/@octokit/rest/lib/plugins/pagination/index.js
generated
vendored
@ -1,12 +0,0 @@
|
||||
module.exports = paginationPlugin
|
||||
|
||||
function paginationPlugin (octokit) {
|
||||
octokit.getFirstPage = require('./get-first-page').bind(null, octokit)
|
||||
octokit.getLastPage = require('./get-last-page').bind(null, octokit)
|
||||
octokit.getNextPage = require('./get-next-page').bind(null, octokit)
|
||||
octokit.getPreviousPage = require('./get-previous-page').bind(null, octokit)
|
||||
octokit.hasFirstPage = require('./has-first-page')
|
||||
octokit.hasLastPage = require('./has-last-page')
|
||||
octokit.hasNextPage = require('./has-next-page')
|
||||
octokit.hasPreviousPage = require('./has-previous-page')
|
||||
}
|
31
probot/presolver/node_modules/@octokit/rest/lib/request/README.md
generated
vendored
31
probot/presolver/node_modules/@octokit/rest/lib/request/README.md
generated
vendored
@ -1,31 +0,0 @@
|
||||
[back to `@octokit/rest`]('../..')
|
||||
|
||||
# `@octokit/rest/request`
|
||||
|
||||
> Turn REST API endpoint options into generic request options
|
||||
|
||||
---
|
||||
|
||||
# ⚠️ This is not a public API at this point and can change at any time
|
||||
|
||||
---
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const octokitRestRequest = require('@octokit/rest/lib/request')
|
||||
|
||||
octokitRestRequest({
|
||||
// request options
|
||||
method: 'GET',
|
||||
url: '/orgs/:org/repos',
|
||||
// parameters
|
||||
org: 'octokit',
|
||||
type: 'private'
|
||||
}) // returns promise
|
||||
```
|
||||
|
||||
Sends a `GET` request to https://api.github.com/orgs/octokit/repos?type=private&per_page=20&page=2
|
||||
with `user-agent` and `accept` headers set.
|
||||
|
||||
It accepts the same options and has the same defaults as [`@octokit/rest/endpoint`](../endpoint)
|
@ -1,5 +0,0 @@
|
||||
module.exports = getBufferResponse
|
||||
|
||||
function getBufferResponse (response) {
|
||||
return response.arrayBuffer()
|
||||
}
|
5
probot/presolver/node_modules/@octokit/rest/lib/request/get-buffer-response.js
generated
vendored
5
probot/presolver/node_modules/@octokit/rest/lib/request/get-buffer-response.js
generated
vendored
@ -1,5 +0,0 @@
|
||||
module.exports = getBufferResponse
|
||||
|
||||
function getBufferResponse (response) {
|
||||
return response.buffer()
|
||||
}
|
36
probot/presolver/node_modules/@octokit/rest/lib/request/http-error.js
generated
vendored
36
probot/presolver/node_modules/@octokit/rest/lib/request/http-error.js
generated
vendored
@ -1,36 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
const STATUS_CODES = {
|
||||
304: 'Not Modified', // See PR #673 (https://github.com/octokit/rest.js/pull/673)
|
||||
400: 'Bad Request',
|
||||
404: 'Not Found',
|
||||
500: 'Internal Server Error',
|
||||
504: 'Gateway Timeout'
|
||||
}
|
||||
|
||||
module.exports = class HttpError extends Error {
|
||||
constructor (message, code, headers) {
|
||||
super(message)
|
||||
// Maintains proper stack trace for where our error was thrown (only available on V8)
|
||||
/* istanbul ignore else */
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, this.constructor)
|
||||
}
|
||||
this.name = 'HttpError'
|
||||
this.code = code
|
||||
this.status = STATUS_CODES[code]
|
||||
this.headers = headers
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.message
|
||||
}
|
||||
|
||||
toJSON () {
|
||||
return {
|
||||
code: this.code,
|
||||
status: this.status,
|
||||
message: this.message
|
||||
}
|
||||
}
|
||||
}
|
9
probot/presolver/node_modules/@octokit/rest/lib/request/index.js
generated
vendored
9
probot/presolver/node_modules/@octokit/rest/lib/request/index.js
generated
vendored
@ -1,9 +0,0 @@
|
||||
module.exports = restRequest
|
||||
|
||||
const restEndpoint = require('../endpoint')
|
||||
const request = require('./request')
|
||||
|
||||
function restRequest (endpointOptions) {
|
||||
const requestOptions = restEndpoint(endpointOptions)
|
||||
return request(requestOptions)
|
||||
}
|
32
probot/presolver/node_modules/@octokit/rest/lib/request/is-array-buffer.js
generated
vendored
32
probot/presolver/node_modules/@octokit/rest/lib/request/is-array-buffer.js
generated
vendored
@ -1,32 +0,0 @@
|
||||
/*!
|
||||
* isArrayBuffer v1.0.0
|
||||
* https://github.com/fengyuanchen/is-array-buffer
|
||||
*
|
||||
* Copyright (c) 2015-2017 Chen Fengyuan
|
||||
* Released under the MIT license
|
||||
*
|
||||
* Date: 2017-07-26T11:00:44.931Z
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
// temporary workaround for https://github.com/octokit/rest.js/issues/774
|
||||
|
||||
const hasArrayBuffer = typeof ArrayBuffer === 'function'
|
||||
const toString = Object.prototype.toString
|
||||
|
||||
/**
|
||||
* Check if the given value is an ArrayBuffer.
|
||||
* @param {*} value - The value to check.
|
||||
* @returns {boolean} Returns `true` if the given is an ArrayBuffer, else `false`.
|
||||
* @example
|
||||
* isArrayBuffer(new ArrayBuffer())
|
||||
* // => true
|
||||
* isArrayBuffer(new Array())
|
||||
* // => false
|
||||
*/
|
||||
function isArrayBuffer (value) {
|
||||
return hasArrayBuffer && (value instanceof ArrayBuffer || toString.call(value) === '[object ArrayBuffer]')
|
||||
}
|
||||
|
||||
module.exports = isArrayBuffer
|
107
probot/presolver/node_modules/@octokit/rest/lib/request/request.js
generated
vendored
107
probot/presolver/node_modules/@octokit/rest/lib/request/request.js
generated
vendored
@ -1,107 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = request
|
||||
|
||||
const fetch = require('node-fetch').default
|
||||
const debug = require('debug')('octokit:rest')
|
||||
const defaults = require('lodash/defaults')
|
||||
const isPlainObject = require('lodash/isPlainObject')
|
||||
const pick = require('lodash/pick')
|
||||
|
||||
const deprecate = require('../deprecate')
|
||||
const getBuffer = require('./get-buffer-response')
|
||||
const HttpError = require('./http-error')
|
||||
|
||||
function request (requestOptions) {
|
||||
debug('REQUEST:', requestOptions)
|
||||
|
||||
// calculate content length unless body is a stream, in which case the
|
||||
// content length is already set per option
|
||||
if (requestOptions.body) {
|
||||
defaults(requestOptions.headers, {
|
||||
'content-type': 'application/json; charset=utf-8'
|
||||
})
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#methods
|
||||
requestOptions.method = requestOptions.method.toUpperCase()
|
||||
|
||||
// GitHub expects "content-length: 0" header for PUT/PATCH requests without body
|
||||
// fetch does not allow to set `content-length` header, but we can set body to an empty string
|
||||
if (['PATCH', 'PUT'].indexOf(requestOptions.method) >= 0 && !requestOptions.body) {
|
||||
requestOptions.body = ''
|
||||
}
|
||||
|
||||
if (isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) {
|
||||
requestOptions.body = JSON.stringify(requestOptions.body)
|
||||
}
|
||||
|
||||
let headers = {}
|
||||
let status
|
||||
|
||||
return fetch(requestOptions.url, pick(requestOptions, 'method', 'body', 'headers', 'timeout', 'agent'))
|
||||
|
||||
.then(response => {
|
||||
status = response.status
|
||||
for (const keyAndValue of response.headers.entries()) {
|
||||
headers[keyAndValue[0]] = keyAndValue[1]
|
||||
}
|
||||
|
||||
if (status === 204 || status === 205) {
|
||||
return
|
||||
}
|
||||
|
||||
// GitHub API returns 200 for HEAD requsets
|
||||
if (requestOptions.method === 'HEAD') {
|
||||
if (status < 400) {
|
||||
return
|
||||
}
|
||||
|
||||
throw new HttpError(response.statusText, status, headers)
|
||||
}
|
||||
|
||||
if (status === 304) {
|
||||
requestOptions.url = response.headers.location
|
||||
throw new HttpError('Not modified', status, headers)
|
||||
}
|
||||
|
||||
if (status >= 400) {
|
||||
return response.text()
|
||||
|
||||
.then(message => {
|
||||
throw new HttpError(message, status, headers)
|
||||
})
|
||||
}
|
||||
|
||||
const contentType = response.headers.get('content-type')
|
||||
if (/application\/json/.test(contentType)) {
|
||||
return response.json()
|
||||
}
|
||||
|
||||
if (!contentType || /^text\/|charset=utf-8$/.test(contentType)) {
|
||||
return response.text()
|
||||
}
|
||||
|
||||
return getBuffer(response)
|
||||
})
|
||||
|
||||
.then(data => {
|
||||
return {
|
||||
data,
|
||||
status,
|
||||
headers,
|
||||
get meta () {
|
||||
deprecate('response.meta – use response.headers instead (#896)')
|
||||
return headers
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.catch(error => {
|
||||
if (error instanceof HttpError) {
|
||||
throw error
|
||||
}
|
||||
|
||||
throw new HttpError(error.message, 500, headers)
|
||||
})
|
||||
}
|
11021
probot/presolver/node_modules/@octokit/rest/lib/routes.json
generated
vendored
11021
probot/presolver/node_modules/@octokit/rest/lib/routes.json
generated
vendored
File diff suppressed because it is too large
Load Diff
199
probot/presolver/node_modules/@octokit/rest/package.json
generated
vendored
199
probot/presolver/node_modules/@octokit/rest/package.json
generated
vendored
@ -1,199 +0,0 @@
|
||||
{
|
||||
"_from": "@octokit/rest@^15.13.1",
|
||||
"_id": "@octokit/rest@15.15.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-TnuzjE880qbknEFAVqEr3VeOcE0yXo0kJEW+EK8TASpzMbykKCydei6WUmDSV3bq7aI+llkMrBYes1kIjpU7fA==",
|
||||
"_location": "/@octokit/rest",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@octokit/rest@^15.13.1",
|
||||
"name": "@octokit/rest",
|
||||
"escapedName": "@octokit%2frest",
|
||||
"scope": "@octokit",
|
||||
"rawSpec": "^15.13.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^15.13.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/probot"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-15.15.1.tgz",
|
||||
"_shasum": "7863f50f7c5753211ea3e29e10b84c93159e9e37",
|
||||
"_spec": "@octokit/rest@^15.13.1",
|
||||
"_where": "/Users/traceybushman/Documents/FreeCodeCamp/presolver/node_modules/probot",
|
||||
"apidoc": {
|
||||
"template": {
|
||||
"withCompare": false
|
||||
}
|
||||
},
|
||||
"author": {
|
||||
"name": "Gregor Martynus",
|
||||
"url": "https://github.com/gr2m"
|
||||
},
|
||||
"browser": {
|
||||
"./lib/get-request-agent.js": false,
|
||||
"./lib/request/get-buffer-response.js": "./lib/request/get-buffer-response-browser.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/octokit/rest.js/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"bundlesize": [
|
||||
{
|
||||
"path": "./dist/octokit-rest.min.js.gz",
|
||||
"maxSize": "33 kB"
|
||||
}
|
||||
],
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Mike de Boer",
|
||||
"email": "info@mikedeboer.nl"
|
||||
},
|
||||
{
|
||||
"name": "Fabian Jakobs",
|
||||
"email": "fabian@c9.io"
|
||||
},
|
||||
{
|
||||
"name": "Joe Gallo",
|
||||
"email": "joe@brassafrax.com"
|
||||
},
|
||||
{
|
||||
"name": "Gregor Martynus",
|
||||
"url": "https://github.com/gr2m"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"before-after-hook": "^1.1.0",
|
||||
"btoa-lite": "^1.0.0",
|
||||
"debug": "^3.1.0",
|
||||
"http-proxy-agent": "^2.1.0",
|
||||
"https-proxy-agent": "^2.2.0",
|
||||
"lodash": "^4.17.4",
|
||||
"node-fetch": "^2.1.1",
|
||||
"universal-user-agent": "^2.0.0",
|
||||
"url-template": "^2.0.8"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "GitHub REST API client for Node.js",
|
||||
"devDependencies": {
|
||||
"@gimenete/type-writer": "^0.1.3",
|
||||
"@gr2m/node-fetch": "^2.0.0",
|
||||
"@octokit/fixtures-server": "^3.0.0",
|
||||
"@octokit/routes": "14.6.2",
|
||||
"@types/node": "^10.1.2",
|
||||
"apidoc": "^0.17.6",
|
||||
"bundlesize": "^0.17.0",
|
||||
"chai": "^4.1.2",
|
||||
"compression-webpack-plugin": "^2.0.0",
|
||||
"coveralls": "^3.0.0",
|
||||
"cypress": "^3.0.0",
|
||||
"dotenv": "^6.0.0",
|
||||
"gh-pages-with-token": "^1.0.0",
|
||||
"glob": "^7.1.2",
|
||||
"mkdirp": "^0.5.1",
|
||||
"mocha": "^5.0.0",
|
||||
"mustache": "^3.0.0",
|
||||
"nock": "^10.0.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"nyc": "^12.0.1",
|
||||
"prettier": "^1.14.2",
|
||||
"proxy": "^0.2.4",
|
||||
"proxyquire": "^2.0.0",
|
||||
"semantic-release": "^15.0.0",
|
||||
"sinon": "^6.0.0",
|
||||
"sinon-chai": "^3.0.0",
|
||||
"standard": "^12.0.0",
|
||||
"standard-markdown": "^5.0.1",
|
||||
"string-to-arraybuffer": "^1.0.0",
|
||||
"typescript": "^2.9.2",
|
||||
"webpack": "^4.0.0",
|
||||
"webpack-bundle-analyzer": "^3.0.0",
|
||||
"webpack-cli": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"index.js.flow",
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/octokit/rest.js#readme",
|
||||
"keywords": [
|
||||
"octokit",
|
||||
"github",
|
||||
"rest",
|
||||
"api-client"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "@octokit/rest",
|
||||
"nyc": {
|
||||
"ignore": [
|
||||
"examples",
|
||||
"test"
|
||||
]
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"tag": "latest"
|
||||
},
|
||||
"release": {
|
||||
"publish": [
|
||||
"@semantic-release/npm",
|
||||
{
|
||||
"path": "@semantic-release/github",
|
||||
"assets": [
|
||||
"dist/*",
|
||||
"!dist/*.map.gz"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/octokit/rest.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm-run-all build:*",
|
||||
"build:browser": "npm-run-all build:browser:*",
|
||||
"build:browser:development": "webpack --mode development --entry . --output-library=Octokit --output=./dist/octokit-rest.js --profile --json > dist/bundle-stats.json",
|
||||
"build:browser:production": "webpack --mode production --entry . --plugin=compression-webpack-plugin --output-library=Octokit --output-path=./dist --output-filename=octokit-rest.min.js --devtool source-map",
|
||||
"build:docs": "node scripts/generate-api-docs",
|
||||
"build:flow": "node scripts/generate-flow-types",
|
||||
"build:ts": "node scripts/generate-typescript-types",
|
||||
"coverage": "nyc report --reporter=html && open coverage/index.html",
|
||||
"coverage:upload": "nyc report --reporter=text-lcov | coveralls",
|
||||
"deploy-docs": "gh-pages-with-token -d doc",
|
||||
"generate-bundle-report": "webpack-bundle-analyzer dist/bundle-stats.json --mode=static --no-open --report dist/bundle-report.html",
|
||||
"generate-routes": "node scripts/generate-routes",
|
||||
"postbuild:docs": "apidoc -i doc/ -o doc/",
|
||||
"postvalidate:ts": "tsc --noEmit --target es6 test/typescript-validate.ts",
|
||||
"prebuild:browser": "mkdirp dist/",
|
||||
"prebuild:docs": "mkdirp doc/",
|
||||
"pretest": "standard && standard-markdown *.md",
|
||||
"prevalidate:ts": "npm run -s build:ts",
|
||||
"semantic-release": "semantic-release",
|
||||
"start-fixtures-server": "octokit-fixtures-server",
|
||||
"test": "nyc mocha test/mocha-node-setup.js \"test/**/*-test.js\"",
|
||||
"test:browser": "cypress run --browser chrome",
|
||||
"test:examples": "node test/examples.js",
|
||||
"validate:ts": "tsc --target es6 index.d.ts"
|
||||
},
|
||||
"standard": {
|
||||
"globals": [
|
||||
"describe",
|
||||
"before",
|
||||
"beforeEach",
|
||||
"afterEach",
|
||||
"after",
|
||||
"it",
|
||||
"expect",
|
||||
"cy"
|
||||
]
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "15.15.1"
|
||||
}
|
31
probot/presolver/node_modules/@octokit/webhooks/.travis.yml
generated
vendored
31
probot/presolver/node_modules/@octokit/webhooks/.travis.yml
generated
vendored
@ -1,31 +0,0 @@
|
||||
language: node_js
|
||||
cache:
|
||||
directories:
|
||||
- ~/.npm
|
||||
|
||||
node_js: lts/*
|
||||
|
||||
# Trigger a push build on master and greenkeeper branches + PRs build on every branches
|
||||
# Avoid double build on PRs (See https://github.com/travis-ci/travis-ci/issues/1147)
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- /^greenkeeper.*$/
|
||||
|
||||
stages:
|
||||
- test
|
||||
- name: release
|
||||
if: branch = master AND type IN (push)
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: test
|
||||
node_js: 6
|
||||
- node_js: 8
|
||||
- node_js: 10
|
||||
# run semantic-release and coverage in paralell
|
||||
- stage: release
|
||||
script: npm run semantic-release
|
||||
- script:
|
||||
- npm run test
|
||||
- npm run coverage:upload
|
46
probot/presolver/node_modules/@octokit/webhooks/CODE_OF_CONDUCT.md
generated
vendored
46
probot/presolver/node_modules/@octokit/webhooks/CODE_OF_CONDUCT.md
generated
vendored
@ -1,46 +0,0 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at opensource+octokit@github.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
20
probot/presolver/node_modules/@octokit/webhooks/LICENSE.md
generated
vendored
20
probot/presolver/node_modules/@octokit/webhooks/LICENSE.md
generated
vendored
@ -1,20 +0,0 @@
|
||||
Copyright (c) 2017 Gregor Martynus
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
769
probot/presolver/node_modules/@octokit/webhooks/README.md
generated
vendored
769
probot/presolver/node_modules/@octokit/webhooks/README.md
generated
vendored
@ -1,769 +0,0 @@
|
||||
# @octokit/webhooks
|
||||
|
||||
> GitHub webhook events toolset for Node.js
|
||||
|
||||
[](https://travis-ci.org/octokit/webhooks.js)
|
||||
[](https://coveralls.io/github/octokit/webhooks.js?branch=master)
|
||||
[](https://greenkeeper.io/)
|
||||
|
||||
[GitHub webhooks](https://developer.github.com/webhooks/) can be registered in multiple ways
|
||||
|
||||
1. In repository or organization settings on [github.com](https://github.com/).
|
||||
2. Using the REST API for [repositories](https://developer.github.com/v3/repos/hooks/) or [organizations](https://developer.github.com/v3/orgs/hooks/)
|
||||
3. By installing a [GitHub App](https://developer.github.com/apps/).
|
||||
|
||||
`@octokit/webhooks` helps to handle webhook events received from GitHub.
|
||||
|
||||
Note that while setting a secret is optional on GitHub, it is required to be set in order to use `@octokit/webhooks`. Content Type must be set to `application/json`, `application/x-www-form-urlencoded` is not supported.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
// install with: npm install @octokit/webhooks
|
||||
const WebhooksApi = require('@octokit/webhooks')
|
||||
const webhooks = new WebhooksApi({
|
||||
secret: 'mysecret'
|
||||
})
|
||||
|
||||
webhooks.on('*', ({id, name, payload}) => {
|
||||
console.log(name, 'event received')
|
||||
})
|
||||
|
||||
require('http').createServer(webhooks.middleware).listen(3000)
|
||||
// can now receive webhook events at port 3000
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
1. [Constructor](#constructor)
|
||||
2. [webhooks.sign()](#webhookssign)
|
||||
3. [webhooks.verify()](#webhooksverify)
|
||||
4. [webhooks.verifyAndReceive()](#webhooksverifyandreceive)
|
||||
4. [webhooks.receive()](#webhooksreceive)
|
||||
5. [webhooks.on()](#webhookson)
|
||||
6. [webhooks.removeListener()](#webhooksremoveListener)
|
||||
7. [webhooks.middleware()](#webhooksmiddleware)
|
||||
8. [Webhook events](#webhook-events)
|
||||
9. [Special events](#special-events)
|
||||
1. [`*` wildcard event](#-wildcard-event)
|
||||
1. [`error` event](#error-event)
|
||||
|
||||
### Constructor
|
||||
|
||||
```js
|
||||
new WebhooksApi({secret[, path]})
|
||||
```
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
secret
|
||||
</code>
|
||||
<em>(String)</em>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required.</strong>
|
||||
Secret as configured in GitHub Settings.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
transform
|
||||
</code>
|
||||
<em>(Function)</em>
|
||||
</td>
|
||||
<td>
|
||||
Only relevant for <a href="#webhookson"><code>webhooks.on</code></a>.
|
||||
Transform emitted event before calling handlers. Can be asynchronous.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
path
|
||||
</code>
|
||||
<em>(String)</em>
|
||||
</td>
|
||||
<td>
|
||||
Only relevant for <a href="#webhooksmiddleware"><code>webhooks.middleware</code></a>.
|
||||
Custom path to match requests against. Defaults to <code>/</code>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Returns the `webhooks` API.
|
||||
|
||||
### webhooks.sign()
|
||||
|
||||
```js
|
||||
webhooks.sign(eventPayload)
|
||||
```
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
eventPayload
|
||||
</code>
|
||||
<em>
|
||||
(Object)
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required.</strong>
|
||||
Webhook request payload as received from GitHub
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Returns a `signature` string. Throws error if `eventPayload` is not passed.
|
||||
|
||||
Can also be used [standalone](sign/).
|
||||
|
||||
### webhooks.verify()
|
||||
|
||||
```js
|
||||
webhooks.verify(eventPayload, signature)
|
||||
```
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
eventPayload
|
||||
</code>
|
||||
<em>
|
||||
(Object)
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required.</strong>
|
||||
Webhook event request payload as received from GitHub.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
signature
|
||||
</code>
|
||||
<em>
|
||||
(String)
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required.</strong>
|
||||
Signature string as calculated by <code><a href="#webhookssign">webhooks.sign()</a></code>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Returns `true` or `false`. Throws error if `eventPayload` or `signature` not passed.
|
||||
|
||||
Can also be used [standalone](verify/).
|
||||
|
||||
### webhooks.verifyAndReceive()
|
||||
|
||||
```js
|
||||
webhooks.verifyAndReceive({id, name, payload, signature})
|
||||
```
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
id
|
||||
</code>
|
||||
<em>
|
||||
String
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
Unique webhook event request id
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
name
|
||||
</code>
|
||||
<em>
|
||||
String
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required.</strong>
|
||||
Name of the event. (Event names are set as <a href="https://developer.github.com/webhooks/#delivery-headers"><code>X-GitHub-Event</code> header</a>
|
||||
in the webhook event request.)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
payload
|
||||
</code>
|
||||
<em>
|
||||
Object
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required.</strong>
|
||||
Webhook event request payload as received from GitHub.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
signature
|
||||
</code>
|
||||
<em>
|
||||
(String)
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required.</strong>
|
||||
Signature string as calculated by <code><a href="#webhookssign">webhooks.sign()</a></code>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Returns a promise.
|
||||
|
||||
Verifies event using [webhooks.verify()](#webhooksverify), then handles the event using [webhooks.receive()](#webhooksreceive).
|
||||
|
||||
Additionally, if verification fails, rejects return promise and emits an `error` event.
|
||||
|
||||
Example
|
||||
|
||||
```js
|
||||
const WebhooksApi = require('@octokit/webhooks')
|
||||
const webhooks = new WebhooksApi({
|
||||
secret: 'mysecret'
|
||||
})
|
||||
eventHandler.on('error', handleSignatureVerificationError)
|
||||
|
||||
// put this inside your webhooks route handler
|
||||
eventHandler.verifyAndReceive({
|
||||
id: request.headers['x-github-delivery'],
|
||||
name: request.headers['x-github-event'],
|
||||
payload: request.body,
|
||||
signature: request.headers['x-github-signature']
|
||||
}).catch(handleErrorsFromHooks)
|
||||
```
|
||||
|
||||
### webhooks.receive()
|
||||
|
||||
```js
|
||||
webhooks.receive({id, name, payload})
|
||||
```
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
id
|
||||
</code>
|
||||
<em>
|
||||
String
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
Unique webhook event request id
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
name
|
||||
</code>
|
||||
<em>
|
||||
String
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required.</strong>
|
||||
Name of the event. (Event names are set as <a href="https://developer.github.com/webhooks/#delivery-headers"><code>X-GitHub-Event</code> header</a>
|
||||
in the webhook event request.)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
payload
|
||||
</code>
|
||||
<em>
|
||||
Object
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required.</strong>
|
||||
Webhook event request payload as received from GitHub.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Returns a promise. Runs all handlers set with [`webhooks.on()`](#webhookson) in parallel and waits for them to finish. If one of the handlers rejects or throws an error, then `webhooks.receive()` rejects. The returned error has an `.errors` property which holds an array of all errors caught from the handlers. If no errors occur, `webhooks.receive()` resolves without passing any value.
|
||||
|
||||
The `.receive()` method belongs to the [receiver](receiver/) module which can be used standalone.
|
||||
|
||||
### webhooks.on()
|
||||
|
||||
```js
|
||||
webhooks.on(eventName, handler)
|
||||
webhooks.on(eventNames, handler)
|
||||
```
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
eventName
|
||||
</code>
|
||||
<em>
|
||||
String
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required.</strong>
|
||||
Name of the event. One of <a href="#listofalleventnames">GitHub’s supported event names</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
eventNames
|
||||
</code>
|
||||
<em>
|
||||
Array
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required.</strong>
|
||||
Array of event names.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
handler
|
||||
</code>
|
||||
<em>
|
||||
Function
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required.</strong>
|
||||
Method to be run each time the event with the passed name is received.
|
||||
the <code>handler</code> function can be an async function, throw an error or
|
||||
return a Promise. The handler is called with an event object: <code>{id, name, payload}</code>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
The `.on()` method belongs to the [receiver](receiver/) module which can be used standalone.
|
||||
|
||||
### webhooks.removeListener()
|
||||
|
||||
```js
|
||||
webhooks.removeListener(eventName, handler)
|
||||
webhooks.removeListener(eventNames, handler)
|
||||
```
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
eventName
|
||||
</code>
|
||||
<em>
|
||||
String
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required.</strong>
|
||||
Name of the event. One of <a href="#listofalleventnames">GitHub’s supported event names</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
eventNames
|
||||
</code>
|
||||
<em>
|
||||
Array
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required.</strong>
|
||||
Array of event names.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
handler
|
||||
</code>
|
||||
<em>
|
||||
Function
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required.</strong>
|
||||
Method which was previously passed to <code><a href="webhookson">webhooks.on()</a></code>. If the same handler was registered multiple times for the same event, only the most recent handler gets removed.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
The `.removeListener()` method belongs to the [receiver](receiver/) module which can be used standalone.
|
||||
|
||||
### webhooks.middleware()
|
||||
|
||||
```js
|
||||
webhooks.middleware(request, response[, next])
|
||||
```
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
request
|
||||
</code>
|
||||
<em>
|
||||
Object
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required.</strong>
|
||||
A Node.js <a href="https://nodejs.org/docs/latest/api/http.html#http_class_http_clientrequest">http.ClientRequest</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
response
|
||||
</code>
|
||||
<em>
|
||||
Object
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required.</strong>
|
||||
A Node.js <a href="https://nodejs.org/docs/latest/api/http.html#http_class_http_serverresponse">http.ServerResponse</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
next
|
||||
</code>
|
||||
<em>
|
||||
Function
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
Optional function which invokes the next middleware, as used by <a href="https://github.com/senchalabs/connect">Connect</a> and <a href="http://expressjs.com/">Express</a>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Returns a `requestListener` (or _middleware_) method which can be directly passed to [`http.createServer()`](https://nodejs.org/docs/latest/api/http.html#http_http_createserver_requestlistener), <a href="http://expressjs.com/">Express</a> and other compatible Node.js server frameworks.
|
||||
|
||||
Can also be used [standalone](middleware/).
|
||||
|
||||
### Webhook events
|
||||
|
||||
See the full list of [event types with example payloads](https://developer.github.com/v3/activity/events/types/).
|
||||
|
||||
If there are actions for a webhook, events are emitted for both, the webhook name as well as a combination of the webhook name and the action, e.g. `installation` and `installation.created`.
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Event</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>commit_comment</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.created</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>create</code>
|
||||
</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>delete</code>
|
||||
</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>deployment</code>
|
||||
</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>deployment_status</code>
|
||||
</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>fork</code>
|
||||
</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>gollum</code>
|
||||
</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>installation</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.created</code><br><code>.deleted</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>installation_repositories</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.added</code><br><code>.removed</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>issue_comment</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.created</code><br><code>.edited</code><br><code>.deleted</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>issues</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.assigned</code><br><code>.unassigned</code><br><code>.labeled</code><br><code>.unlabeled</code><br><code>.opened</code><br><code>.edited</code><br><code>.milestoned</code><br><code>.demilestoned</code><br><code>.closed</code><br><code>.reopened</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>label</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.created</code><br><code>.edited</code><br><code>.deleted</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>marketplace_purchase</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.purchased</code><br><code>.cancelled</code><br><code>.changed</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>member</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.added</code><br><code>.edited</code><br><code>.deleted</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>membership</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.added</code><br><code>.removed</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>milestone</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.created</code><br><code>.closed</code><br><code>.opened</code><br><code>.edited</code><br><code>.deleted</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>org_block</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.blocked</code><br><code>.unblocked</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>organization</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.member_added</code><br><code>.member_removed</code><br><code>.member_invited</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>page_build</code>
|
||||
</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>ping</code>
|
||||
</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>project</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.created</code><br><code>.edited</code><br><code>.converted</code><br><code>.moved</code><br><code>.deleted</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>project_card</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.created</code><br><code>.edited</code><br><code>.closed</code><br><code>.reopened</code><br><code>.deleted</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>project_column</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.created</code><br><code>.edited</code><br><code>.moved</code><br><code>.deleted</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>public</code>
|
||||
</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>pull_request</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.assigned</code><br><code>.unassigned</code><br><code>.review_requested</code><br><code>.review_request_removed</code><br><code>.labeled</code><br><code>.unlabeled</code><br><code>.opened</code><br><code>.edited</code><br><code>.closed</code><br><code>.reopened</code><br><code>.synchronize</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>pull_request_review</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.submitted</code><br><code>.edited</code><br><code>.dismissed</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>pull_request_review_comment</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.created</code><br><code>.edited</code><br><code>.deleted</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>push</code>
|
||||
</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>release</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.published</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>repository</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.created</code><br><code>.deleted</code><br><code>.archived</code><br><code>.unarchived</code><br><code>.publicized</code><br><code>.privatized</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>status</code>
|
||||
</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>team</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.created</code><br><code>.deleted</code><br><code>.edited</code><br><code>.added_to_repository</code><br><code>.removed_from_repository</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>team_add</code>
|
||||
</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left valign=top>
|
||||
<code>watch</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>.started</code>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
### Special events
|
||||
|
||||
Besides the webhook events, there are [special events](#specialevents) emitted by `@octokit/webhooks`.
|
||||
|
||||
#### `*` wildcard event
|
||||
|
||||
The `*` event is emitted for all webhook events [listed above](#listofwebhookevents).
|
||||
|
||||
```js
|
||||
webhooks.on('*', (event) => {
|
||||
console.log(`"${event.name}" event received"`)
|
||||
})
|
||||
```
|
||||
|
||||
#### `error` event
|
||||
|
||||
If a webhook event handler throws an error or returns a promise that rejects, an `error` event is triggered. You can subscribe to this event for logging or reporting events. The passed `error` object has a `.event` property which has all information on the event:
|
||||
|
||||
- `id`: The unique webhook event request id
|
||||
- `name`: The name of the event
|
||||
- `payload`: The event request payload
|
||||
|
||||
```js
|
||||
webhooks.on('error', (error) => {
|
||||
console.log(`Error occured in "${error.event.name} handler: ${error.stack}"`)
|
||||
})
|
||||
```
|
||||
|
||||
Asynchronous `error` event handler are not blocking the `.receive()` method from completing.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE.md)
|
42
probot/presolver/node_modules/@octokit/webhooks/event-handler/README.md
generated
vendored
42
probot/presolver/node_modules/@octokit/webhooks/event-handler/README.md
generated
vendored
@ -1,42 +0,0 @@
|
||||
# event-handler
|
||||
|
||||
If you implement the route to receive webhook events from GitHub yourself then you can use the `event-handler` as a standalone module
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
const EventHandler = require('@octokit/webhooks/event-handler')
|
||||
const eventHandler = new EventHandler({
|
||||
async transform (event) {
|
||||
// optionally transform passed event before handlers are called
|
||||
return event
|
||||
}
|
||||
})
|
||||
eventHandler.on('installation', asyncInstallationHook)
|
||||
|
||||
// put this inside your webhooks route handler
|
||||
eventHandler.receive({
|
||||
id: request.headers['x-github-delivery'],
|
||||
name: request.headers['x-github-event'],
|
||||
payload: request.body
|
||||
}).catch(handleErrorsFromHooks)
|
||||
```
|
||||
|
||||
## 🚨 Verify events
|
||||
|
||||
If you receive events through a publicly accessible URL, make sure to verify that the event request is coming from GitHub:
|
||||
|
||||
```js
|
||||
const verify = require('@octokit/webhooks/verify')
|
||||
const secret = 'mysecret'
|
||||
|
||||
if (!verify(secret, request.payload, request.headers['x-github-signature'])) {
|
||||
throw new Error('Signature does not match event payload & secret')
|
||||
}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
The `event-handler` API implements [`.receive()`](../#webhooksreceive), [`.on()`](../#webhookson) and [`.removeListener()`](../#webhooksremovelistener).
|
||||
|
||||
Back to [@octokit/webhooks README](..).
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user