Fix dependabot errors
I explicitly had to downgrade "@octokit/plugin-retry" to "^6.0.0". Other dependencies were upgraded.
This commit is contained in:
parent
f338ec87a3
commit
5f98c40063
1536 changed files with 52911 additions and 424849 deletions
21
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/LICENSE
generated
vendored
21
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/LICENSE
generated
vendored
|
|
@ -1,21 +0,0 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 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.
|
||||
412
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/README.md
generated
vendored
412
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/README.md
generated
vendored
|
|
@ -1,412 +0,0 @@
|
|||
# endpoint.js
|
||||
|
||||
> Turns GitHub REST API endpoints into generic request options
|
||||
|
||||
[](https://www.npmjs.com/package/@octokit/endpoint)
|
||||
[](https://github.com/octokit/endpoint.js/actions/workflows/test.yml?query=branch%3Amain)
|
||||
|
||||
`@octokit/endpoint` combines [GitHub REST API routes](https://developer.github.com/v3/) with your parameters and turns them into generic request options that can be used in any request library.
|
||||
|
||||
<!-- update table of contents by running `npx markdown-toc README.md -i` -->
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Usage](#usage)
|
||||
- [API](#api)
|
||||
- [`endpoint(route, options)` or `endpoint(options)`](#endpointroute-options-or-endpointoptions)
|
||||
- [`endpoint.defaults()`](#endpointdefaults)
|
||||
- [`endpoint.DEFAULTS`](#endpointdefaults)
|
||||
- [`endpoint.merge(route, options)` or `endpoint.merge(options)`](#endpointmergeroute-options-or-endpointmergeoptions)
|
||||
- [`endpoint.parse()`](#endpointparse)
|
||||
- [Special cases](#special-cases)
|
||||
- [The `data` parameter – set request body directly](#the-data-parameter-%E2%80%93-set-request-body-directly)
|
||||
- [Set parameters for both the URL/query and the request body](#set-parameters-for-both-the-urlquery-and-the-request-body)
|
||||
- [LICENSE](#license)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
## Usage
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
Load <code>@octokit/endpoint</code> directly from <a href="https://esm.sh">esm.sh</a>
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { endpoint } from "https://esm.sh/@octokit/endpoint";
|
||||
</script>
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Node
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install @octokit/endpoint</code>
|
||||
|
||||
```js
|
||||
import { endpoint } from "@octokit/endpoint";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Example for [List organization repositories](https://developer.github.com/v3/repos/#list-organization-repositories)
|
||||
|
||||
```js
|
||||
const requestOptions = endpoint("GET /orgs/{org}/repos", {
|
||||
headers: {
|
||||
authorization: "token 0000000000000000000000000000000000000001",
|
||||
},
|
||||
org: "octokit",
|
||||
type: "private",
|
||||
});
|
||||
```
|
||||
|
||||
The resulting `requestOptions` looks as follows
|
||||
|
||||
```json
|
||||
{
|
||||
"method": "GET",
|
||||
"url": "https://api.github.com/orgs/octokit/repos?type=private",
|
||||
"headers": {
|
||||
"accept": "application/vnd.github.v3+json",
|
||||
"authorization": "token 0000000000000000000000000000000000000001",
|
||||
"user-agent": "octokit/endpoint.js v1.2.3"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can pass `requestOptions` to common request libraries
|
||||
|
||||
```js
|
||||
const { url, ...options } = requestOptions;
|
||||
// using with fetch (https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
|
||||
fetch(url, options);
|
||||
// using with request (https://github.com/request/request)
|
||||
request(requestOptions);
|
||||
// using with got (https://github.com/sindresorhus/got)
|
||||
got[options.method](url, options);
|
||||
// using with axios
|
||||
axios(requestOptions);
|
||||
```
|
||||
|
||||
> [!IMPORTANT]
|
||||
> As we use [conditional exports](https://nodejs.org/api/packages.html#conditional-exports), you will need to adapt your `tsconfig.json`. See the TypeScript docs on [package.json "exports"](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports).
|
||||
|
||||
## API
|
||||
|
||||
### `endpoint(route, options)` or `endpoint(options)`
|
||||
|
||||
<table>
|
||||
<thead align=left>
|
||||
<tr>
|
||||
<th>
|
||||
name
|
||||
</th>
|
||||
<th>
|
||||
type
|
||||
</th>
|
||||
<th width=100%>
|
||||
description
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody align=left valign=top>
|
||||
<tr>
|
||||
<th>
|
||||
<code>route</code>
|
||||
</th>
|
||||
<td>
|
||||
String
|
||||
</td>
|
||||
<td>
|
||||
If set, it has to be a string consisting of URL and the request method, e.g., <code>GET /orgs/{org}</code>. If it’s set to a URL, only the method defaults to <code>GET</code>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.method</code>
|
||||
</th>
|
||||
<td>
|
||||
String
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required unless <code>route</code> is set.</strong> Any supported <a href="https://developer.github.com/v3/#http-verbs">http verb</a>. <em>Defaults to <code>GET</code></em>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.url</code>
|
||||
</th>
|
||||
<td>
|
||||
String
|
||||
</td>
|
||||
<td>
|
||||
<strong>Required unless <code>route</code> is set.</strong> A path or full URL which may contain <code>:variable</code> or <code>{variable}</code> placeholders,
|
||||
e.g., <code>/orgs/{org}/repos</code>. The <code>url</code> is parsed using <a href="https://github.com/bramstein/url-template">url-template</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.baseUrl</code>
|
||||
</th>
|
||||
<td>
|
||||
String
|
||||
</td>
|
||||
<td>
|
||||
<em>Defaults to <code>https://api.github.com</code></em>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.headers</code>
|
||||
</th>
|
||||
<td>
|
||||
Object
|
||||
</td>
|
||||
<td>
|
||||
Custom headers. Passed headers are merged with defaults:<br>
|
||||
<em><code>headers['user-agent']</code> defaults to <code>octokit-endpoint.js/1.2.3</code> (where <code>1.2.3</code> is the released version)</em>.<br>
|
||||
<em><code>headers['accept']</code> defaults to <code>application/vnd.github.v3+json</code></em>.<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.mediaType.format</code>
|
||||
</th>
|
||||
<td>
|
||||
String
|
||||
</td>
|
||||
<td>
|
||||
Media type param, such as <code>raw</code>, <code>diff</code>, or <code>text+json</code>. See <a href="https://developer.github.com/v3/media/">Media Types</a>. Setting <code>options.mediaType.format</code> will amend the <code>headers.accept</code> value.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.data</code>
|
||||
</th>
|
||||
<td>
|
||||
Any
|
||||
</td>
|
||||
<td>
|
||||
Set request body directly instead of setting it to JSON based on additional parameters. See <a href="#data-parameter">"The <code>data</code> parameter"</a> below.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.request</code>
|
||||
</th>
|
||||
<td>
|
||||
Object
|
||||
</td>
|
||||
<td>
|
||||
Pass custom meta information for the request. The <code>request</code> object will be returned as is.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
All other options will be passed depending on the `method` and `url` options.
|
||||
|
||||
1. If the option key has a placeholder in the `url`, it will be used as the replacement. For example, if the passed options are `{url: '/orgs/{org}/repos', org: 'foo'}` the returned `options.url` is `https://api.github.com/orgs/foo/repos`.
|
||||
2. If the `method` is `GET` or `HEAD`, the option is passed as a query parameter.
|
||||
3. Otherwise, the parameter is passed in the request body as a JSON key.
|
||||
|
||||
**Result**
|
||||
|
||||
`endpoint()` is a synchronous method and returns an object with the following keys:
|
||||
|
||||
<table>
|
||||
<thead align=left>
|
||||
<tr>
|
||||
<th>
|
||||
key
|
||||
</th>
|
||||
<th>
|
||||
type
|
||||
</th>
|
||||
<th width=100%>
|
||||
description
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody align=left valign=top>
|
||||
<tr>
|
||||
<th><code>method</code></th>
|
||||
<td>String</td>
|
||||
<td>The http method. Always lowercase.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><code>url</code></th>
|
||||
<td>String</td>
|
||||
<td>The url with placeholders replaced with passed parameters.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><code>headers</code></th>
|
||||
<td>Object</td>
|
||||
<td>All header names are lowercased.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><code>body</code></th>
|
||||
<td>Any</td>
|
||||
<td>The request body if one is present. Only for <code>PATCH</code>, <code>POST</code>, <code>PUT</code>, <code>DELETE</code> requests.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><code>request</code></th>
|
||||
<td>Object</td>
|
||||
<td>Request meta option, it will be returned as it was passed into <code>endpoint()</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
### `endpoint.defaults()`
|
||||
|
||||
Override or set default options. Example:
|
||||
|
||||
```js
|
||||
const request = require("request");
|
||||
const myEndpoint = require("@octokit/endpoint").defaults({
|
||||
baseUrl: "https://github-enterprise.acme-inc.com/api/v3",
|
||||
headers: {
|
||||
"user-agent": "myApp/1.2.3",
|
||||
authorization: `token 0000000000000000000000000000000000000001`,
|
||||
},
|
||||
org: "my-project",
|
||||
per_page: 100,
|
||||
});
|
||||
|
||||
request(myEndpoint(`GET /orgs/{org}/repos`));
|
||||
```
|
||||
|
||||
You can call `.defaults()` again on the returned method, the defaults will cascade.
|
||||
|
||||
```js
|
||||
const myProjectEndpoint = endpoint.defaults({
|
||||
baseUrl: "https://github-enterprise.acme-inc.com/api/v3",
|
||||
headers: {
|
||||
"user-agent": "myApp/1.2.3",
|
||||
},
|
||||
org: "my-project",
|
||||
});
|
||||
const myProjectEndpointWithAuth = myProjectEndpoint.defaults({
|
||||
headers: {
|
||||
authorization: `token 0000000000000000000000000000000000000001`,
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
`myProjectEndpointWithAuth` now defaults the `baseUrl`, `headers['user-agent']`,
|
||||
`org` and `headers['authorization']` on top of `headers['accept']` that is set
|
||||
by the global default.
|
||||
|
||||
### `endpoint.DEFAULTS`
|
||||
|
||||
The current default options.
|
||||
|
||||
```js
|
||||
endpoint.DEFAULTS.baseUrl; // https://api.github.com
|
||||
const myEndpoint = endpoint.defaults({
|
||||
baseUrl: "https://github-enterprise.acme-inc.com/api/v3",
|
||||
});
|
||||
myEndpoint.DEFAULTS.baseUrl; // https://github-enterprise.acme-inc.com/api/v3
|
||||
```
|
||||
|
||||
### `endpoint.merge(route, options)` or `endpoint.merge(options)`
|
||||
|
||||
Get the defaulted endpoint options, but without parsing them into request options:
|
||||
|
||||
```js
|
||||
const myProjectEndpoint = endpoint.defaults({
|
||||
baseUrl: "https://github-enterprise.acme-inc.com/api/v3",
|
||||
headers: {
|
||||
"user-agent": "myApp/1.2.3",
|
||||
},
|
||||
org: "my-project",
|
||||
});
|
||||
myProjectEndpoint.merge("GET /orgs/{org}/repos", {
|
||||
headers: {
|
||||
authorization: `token 0000000000000000000000000000000000000001`,
|
||||
},
|
||||
org: "my-secret-project",
|
||||
type: "private",
|
||||
});
|
||||
|
||||
// {
|
||||
// baseUrl: 'https://github-enterprise.acme-inc.com/api/v3',
|
||||
// method: 'GET',
|
||||
// url: '/orgs/{org}/repos',
|
||||
// headers: {
|
||||
// accept: 'application/vnd.github.v3+json',
|
||||
// authorization: `token 0000000000000000000000000000000000000001`,
|
||||
// 'user-agent': 'myApp/1.2.3'
|
||||
// },
|
||||
// org: 'my-secret-project',
|
||||
// type: 'private'
|
||||
// }
|
||||
```
|
||||
|
||||
### `endpoint.parse()`
|
||||
|
||||
Stateless method to turn endpoint options into request options. Calling
|
||||
`endpoint(options)` is the same as calling `endpoint.parse(endpoint.merge(options))`.
|
||||
|
||||
## Special cases
|
||||
|
||||
<a name="data-parameter"></a>
|
||||
|
||||
### The `data` parameter – set request body directly
|
||||
|
||||
Some endpoints such as [Render a Markdown document in raw mode](https://developer.github.com/v3/markdown/#render-a-markdown-document-in-raw-mode) don’t have parameters that are sent as request body keys, instead, the request body needs to be set directly. In these cases, set the `data` parameter.
|
||||
|
||||
```js
|
||||
const options = endpoint("POST /markdown/raw", {
|
||||
data: "Hello world github/linguist#1 **cool**, and #1!",
|
||||
headers: {
|
||||
accept: "text/html;charset=utf-8",
|
||||
"content-type": "text/plain",
|
||||
},
|
||||
});
|
||||
|
||||
// options is
|
||||
// {
|
||||
// method: 'post',
|
||||
// url: 'https://api.github.com/markdown/raw',
|
||||
// headers: {
|
||||
// accept: 'text/html;charset=utf-8',
|
||||
// 'content-type': 'text/plain',
|
||||
// 'user-agent': userAgent
|
||||
// },
|
||||
// body: 'Hello world github/linguist#1 **cool**, and #1!'
|
||||
// }
|
||||
```
|
||||
|
||||
### Set parameters for both the URL/query and the request body
|
||||
|
||||
There are API endpoints that accept both query parameters as well as a body. In that case, you need to add the query parameters as templates to `options.url`, as defined in the [RFC 6570 URI Template specification](https://tools.ietf.org/html/rfc6570).
|
||||
|
||||
Example
|
||||
|
||||
```js
|
||||
endpoint(
|
||||
"POST https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label}",
|
||||
{
|
||||
name: "example.zip",
|
||||
label: "short description",
|
||||
headers: {
|
||||
"content-type": "text/plain",
|
||||
"content-length": 14,
|
||||
authorization: `token 0000000000000000000000000000000000000001`,
|
||||
},
|
||||
data: "Hello, world!",
|
||||
},
|
||||
);
|
||||
```
|
||||
|
||||
## LICENSE
|
||||
|
||||
[MIT](LICENSE)
|
||||
346
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-bundle/index.js
generated
vendored
346
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-bundle/index.js
generated
vendored
|
|
@ -1,346 +0,0 @@
|
|||
// pkg/dist-src/defaults.js
|
||||
import { getUserAgent } from "universal-user-agent";
|
||||
|
||||
// pkg/dist-src/version.js
|
||||
var VERSION = "0.0.0-development";
|
||||
|
||||
// pkg/dist-src/defaults.js
|
||||
var userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
|
||||
var DEFAULTS = {
|
||||
method: "GET",
|
||||
baseUrl: "https://api.github.com",
|
||||
headers: {
|
||||
accept: "application/vnd.github.v3+json",
|
||||
"user-agent": userAgent
|
||||
},
|
||||
mediaType: {
|
||||
format: ""
|
||||
}
|
||||
};
|
||||
|
||||
// pkg/dist-src/util/lowercase-keys.js
|
||||
function lowercaseKeys(object) {
|
||||
if (!object) {
|
||||
return {};
|
||||
}
|
||||
return Object.keys(object).reduce((newObj, key) => {
|
||||
newObj[key.toLowerCase()] = object[key];
|
||||
return newObj;
|
||||
}, {});
|
||||
}
|
||||
|
||||
// pkg/dist-src/util/is-plain-object.js
|
||||
function isPlainObject(value) {
|
||||
if (typeof value !== "object" || value === null) return false;
|
||||
if (Object.prototype.toString.call(value) !== "[object Object]") return false;
|
||||
const proto = Object.getPrototypeOf(value);
|
||||
if (proto === null) return true;
|
||||
const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
||||
return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
|
||||
}
|
||||
|
||||
// pkg/dist-src/util/merge-deep.js
|
||||
function mergeDeep(defaults, options) {
|
||||
const result = Object.assign({}, defaults);
|
||||
Object.keys(options).forEach((key) => {
|
||||
if (isPlainObject(options[key])) {
|
||||
if (!(key in defaults)) Object.assign(result, { [key]: options[key] });
|
||||
else result[key] = mergeDeep(defaults[key], options[key]);
|
||||
} else {
|
||||
Object.assign(result, { [key]: options[key] });
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
// pkg/dist-src/util/remove-undefined-properties.js
|
||||
function removeUndefinedProperties(obj) {
|
||||
for (const key in obj) {
|
||||
if (obj[key] === void 0) {
|
||||
delete obj[key];
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
// pkg/dist-src/merge.js
|
||||
function merge(defaults, route, options) {
|
||||
if (typeof route === "string") {
|
||||
let [method, url] = route.split(" ");
|
||||
options = Object.assign(url ? { method, url } : { url: method }, options);
|
||||
} else {
|
||||
options = Object.assign({}, route);
|
||||
}
|
||||
options.headers = lowercaseKeys(options.headers);
|
||||
removeUndefinedProperties(options);
|
||||
removeUndefinedProperties(options.headers);
|
||||
const mergedOptions = mergeDeep(defaults || {}, options);
|
||||
if (options.url === "/graphql") {
|
||||
if (defaults && defaults.mediaType.previews?.length) {
|
||||
mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(
|
||||
(preview) => !mergedOptions.mediaType.previews.includes(preview)
|
||||
).concat(mergedOptions.mediaType.previews);
|
||||
}
|
||||
mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, ""));
|
||||
}
|
||||
return mergedOptions;
|
||||
}
|
||||
|
||||
// pkg/dist-src/util/add-query-parameters.js
|
||||
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("&");
|
||||
}
|
||||
|
||||
// pkg/dist-src/util/extract-url-variable-names.js
|
||||
var urlVariableRegex = /\{[^{}}]+\}/g;
|
||||
function removeNonChars(variableName) {
|
||||
return variableName.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g, "").split(/,/);
|
||||
}
|
||||
function extractUrlVariableNames(url) {
|
||||
const matches = url.match(urlVariableRegex);
|
||||
if (!matches) {
|
||||
return [];
|
||||
}
|
||||
return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
|
||||
}
|
||||
|
||||
// pkg/dist-src/util/omit.js
|
||||
function omit(object, keysToOmit) {
|
||||
const result = { __proto__: null };
|
||||
for (const key of Object.keys(object)) {
|
||||
if (keysToOmit.indexOf(key) === -1) {
|
||||
result[key] = object[key];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// pkg/dist-src/util/url-template.js
|
||||
function encodeReserved(str) {
|
||||
return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) {
|
||||
if (!/%[0-9A-Fa-f]/.test(part)) {
|
||||
part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]");
|
||||
}
|
||||
return part;
|
||||
}).join("");
|
||||
}
|
||||
function encodeUnreserved(str) {
|
||||
return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
|
||||
return "%" + c.charCodeAt(0).toString(16).toUpperCase();
|
||||
});
|
||||
}
|
||||
function encodeValue(operator, value, key) {
|
||||
value = operator === "+" || operator === "#" ? encodeReserved(value) : encodeUnreserved(value);
|
||||
if (key) {
|
||||
return encodeUnreserved(key) + "=" + value;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
function isDefined(value) {
|
||||
return value !== void 0 && value !== null;
|
||||
}
|
||||
function isKeyOperator(operator) {
|
||||
return operator === ";" || operator === "&" || operator === "?";
|
||||
}
|
||||
function getValues(context, operator, key, modifier) {
|
||||
var value = context[key], result = [];
|
||||
if (isDefined(value) && value !== "") {
|
||||
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
||||
value = value.toString();
|
||||
if (modifier && modifier !== "*") {
|
||||
value = value.substring(0, parseInt(modifier, 10));
|
||||
}
|
||||
result.push(
|
||||
encodeValue(operator, value, isKeyOperator(operator) ? key : "")
|
||||
);
|
||||
} else {
|
||||
if (modifier === "*") {
|
||||
if (Array.isArray(value)) {
|
||||
value.filter(isDefined).forEach(function(value2) {
|
||||
result.push(
|
||||
encodeValue(operator, value2, isKeyOperator(operator) ? key : "")
|
||||
);
|
||||
});
|
||||
} else {
|
||||
Object.keys(value).forEach(function(k) {
|
||||
if (isDefined(value[k])) {
|
||||
result.push(encodeValue(operator, value[k], k));
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const tmp = [];
|
||||
if (Array.isArray(value)) {
|
||||
value.filter(isDefined).forEach(function(value2) {
|
||||
tmp.push(encodeValue(operator, value2));
|
||||
});
|
||||
} else {
|
||||
Object.keys(value).forEach(function(k) {
|
||||
if (isDefined(value[k])) {
|
||||
tmp.push(encodeUnreserved(k));
|
||||
tmp.push(encodeValue(operator, value[k].toString()));
|
||||
}
|
||||
});
|
||||
}
|
||||
if (isKeyOperator(operator)) {
|
||||
result.push(encodeUnreserved(key) + "=" + tmp.join(","));
|
||||
} else if (tmp.length !== 0) {
|
||||
result.push(tmp.join(","));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (operator === ";") {
|
||||
if (isDefined(value)) {
|
||||
result.push(encodeUnreserved(key));
|
||||
}
|
||||
} else if (value === "" && (operator === "&" || operator === "?")) {
|
||||
result.push(encodeUnreserved(key) + "=");
|
||||
} else if (value === "") {
|
||||
result.push("");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function parseUrl(template) {
|
||||
return {
|
||||
expand: expand.bind(null, template)
|
||||
};
|
||||
}
|
||||
function expand(template, context) {
|
||||
var operators = ["+", "#", ".", "/", ";", "?", "&"];
|
||||
template = template.replace(
|
||||
/\{([^\{\}]+)\}|([^\{\}]+)/g,
|
||||
function(_, expression, literal) {
|
||||
if (expression) {
|
||||
let operator = "";
|
||||
const values = [];
|
||||
if (operators.indexOf(expression.charAt(0)) !== -1) {
|
||||
operator = expression.charAt(0);
|
||||
expression = expression.substr(1);
|
||||
}
|
||||
expression.split(/,/g).forEach(function(variable) {
|
||||
var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
|
||||
values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
|
||||
});
|
||||
if (operator && operator !== "+") {
|
||||
var separator = ",";
|
||||
if (operator === "?") {
|
||||
separator = "&";
|
||||
} else if (operator !== "#") {
|
||||
separator = operator;
|
||||
}
|
||||
return (values.length !== 0 ? operator : "") + values.join(separator);
|
||||
} else {
|
||||
return values.join(",");
|
||||
}
|
||||
} else {
|
||||
return encodeReserved(literal);
|
||||
}
|
||||
}
|
||||
);
|
||||
if (template === "/") {
|
||||
return template;
|
||||
} else {
|
||||
return template.replace(/\/$/, "");
|
||||
}
|
||||
}
|
||||
|
||||
// pkg/dist-src/parse.js
|
||||
function parse(options) {
|
||||
let method = options.method.toUpperCase();
|
||||
let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}");
|
||||
let headers = Object.assign({}, options.headers);
|
||||
let body;
|
||||
let parameters = omit(options, [
|
||||
"method",
|
||||
"baseUrl",
|
||||
"url",
|
||||
"headers",
|
||||
"request",
|
||||
"mediaType"
|
||||
]);
|
||||
const urlVariableNames = extractUrlVariableNames(url);
|
||||
url = parseUrl(url).expand(parameters);
|
||||
if (!/^http/.test(url)) {
|
||||
url = options.baseUrl + url;
|
||||
}
|
||||
const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl");
|
||||
const remainingParameters = omit(parameters, omittedParameters);
|
||||
const isBinaryRequest = /application\/octet-stream/i.test(headers.accept);
|
||||
if (!isBinaryRequest) {
|
||||
if (options.mediaType.format) {
|
||||
headers.accept = headers.accept.split(/,/).map(
|
||||
(format) => format.replace(
|
||||
/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,
|
||||
`application/vnd$1$2.${options.mediaType.format}`
|
||||
)
|
||||
).join(",");
|
||||
}
|
||||
if (url.endsWith("/graphql")) {
|
||||
if (options.mediaType.previews?.length) {
|
||||
const previewsFromAcceptHeader = headers.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g) || [];
|
||||
headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {
|
||||
const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json";
|
||||
return `application/vnd.github.${preview}-preview${format}`;
|
||||
}).join(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (["GET", "HEAD"].includes(method)) {
|
||||
url = addQueryParameters(url, remainingParameters);
|
||||
} else {
|
||||
if ("data" in remainingParameters) {
|
||||
body = remainingParameters.data;
|
||||
} else {
|
||||
if (Object.keys(remainingParameters).length) {
|
||||
body = remainingParameters;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!headers["content-type"] && typeof body !== "undefined") {
|
||||
headers["content-type"] = "application/json; charset=utf-8";
|
||||
}
|
||||
if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") {
|
||||
body = "";
|
||||
}
|
||||
return Object.assign(
|
||||
{ method, url, headers },
|
||||
typeof body !== "undefined" ? { body } : null,
|
||||
options.request ? { request: options.request } : null
|
||||
);
|
||||
}
|
||||
|
||||
// pkg/dist-src/endpoint-with-defaults.js
|
||||
function endpointWithDefaults(defaults, route, options) {
|
||||
return parse(merge(defaults, route, options));
|
||||
}
|
||||
|
||||
// pkg/dist-src/with-defaults.js
|
||||
function withDefaults(oldDefaults, newDefaults) {
|
||||
const DEFAULTS2 = merge(oldDefaults, newDefaults);
|
||||
const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2);
|
||||
return Object.assign(endpoint2, {
|
||||
DEFAULTS: DEFAULTS2,
|
||||
defaults: withDefaults.bind(null, DEFAULTS2),
|
||||
merge: merge.bind(null, DEFAULTS2),
|
||||
parse
|
||||
});
|
||||
}
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var endpoint = withDefaults(null, DEFAULTS);
|
||||
export {
|
||||
endpoint
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
17
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-src/defaults.js
generated
vendored
17
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-src/defaults.js
generated
vendored
|
|
@ -1,17 +0,0 @@
|
|||
import { getUserAgent } from "universal-user-agent";
|
||||
import { VERSION } from "./version.js";
|
||||
const userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
|
||||
const DEFAULTS = {
|
||||
method: "GET",
|
||||
baseUrl: "https://api.github.com",
|
||||
headers: {
|
||||
accept: "application/vnd.github.v3+json",
|
||||
"user-agent": userAgent
|
||||
},
|
||||
mediaType: {
|
||||
format: ""
|
||||
}
|
||||
};
|
||||
export {
|
||||
DEFAULTS
|
||||
};
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
import { DEFAULTS } from "./defaults.js";
|
||||
import { merge } from "./merge.js";
|
||||
import { parse } from "./parse.js";
|
||||
function endpointWithDefaults(defaults, route, options) {
|
||||
return parse(merge(defaults, route, options));
|
||||
}
|
||||
export {
|
||||
endpointWithDefaults
|
||||
};
|
||||
6
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-src/index.js
generated
vendored
6
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-src/index.js
generated
vendored
|
|
@ -1,6 +0,0 @@
|
|||
import { withDefaults } from "./with-defaults.js";
|
||||
import { DEFAULTS } from "./defaults.js";
|
||||
const endpoint = withDefaults(null, DEFAULTS);
|
||||
export {
|
||||
endpoint
|
||||
};
|
||||
27
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-src/merge.js
generated
vendored
27
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-src/merge.js
generated
vendored
|
|
@ -1,27 +0,0 @@
|
|||
import { lowercaseKeys } from "./util/lowercase-keys.js";
|
||||
import { mergeDeep } from "./util/merge-deep.js";
|
||||
import { removeUndefinedProperties } from "./util/remove-undefined-properties.js";
|
||||
function merge(defaults, route, options) {
|
||||
if (typeof route === "string") {
|
||||
let [method, url] = route.split(" ");
|
||||
options = Object.assign(url ? { method, url } : { url: method }, options);
|
||||
} else {
|
||||
options = Object.assign({}, route);
|
||||
}
|
||||
options.headers = lowercaseKeys(options.headers);
|
||||
removeUndefinedProperties(options);
|
||||
removeUndefinedProperties(options.headers);
|
||||
const mergedOptions = mergeDeep(defaults || {}, options);
|
||||
if (options.url === "/graphql") {
|
||||
if (defaults && defaults.mediaType.previews?.length) {
|
||||
mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(
|
||||
(preview) => !mergedOptions.mediaType.previews.includes(preview)
|
||||
).concat(mergedOptions.mediaType.previews);
|
||||
}
|
||||
mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, ""));
|
||||
}
|
||||
return mergedOptions;
|
||||
}
|
||||
export {
|
||||
merge
|
||||
};
|
||||
70
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-src/parse.js
generated
vendored
70
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-src/parse.js
generated
vendored
|
|
@ -1,70 +0,0 @@
|
|||
import { addQueryParameters } from "./util/add-query-parameters.js";
|
||||
import { extractUrlVariableNames } from "./util/extract-url-variable-names.js";
|
||||
import { omit } from "./util/omit.js";
|
||||
import { parseUrl } from "./util/url-template.js";
|
||||
function parse(options) {
|
||||
let method = options.method.toUpperCase();
|
||||
let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}");
|
||||
let headers = Object.assign({}, options.headers);
|
||||
let body;
|
||||
let parameters = omit(options, [
|
||||
"method",
|
||||
"baseUrl",
|
||||
"url",
|
||||
"headers",
|
||||
"request",
|
||||
"mediaType"
|
||||
]);
|
||||
const urlVariableNames = extractUrlVariableNames(url);
|
||||
url = parseUrl(url).expand(parameters);
|
||||
if (!/^http/.test(url)) {
|
||||
url = options.baseUrl + url;
|
||||
}
|
||||
const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl");
|
||||
const remainingParameters = omit(parameters, omittedParameters);
|
||||
const isBinaryRequest = /application\/octet-stream/i.test(headers.accept);
|
||||
if (!isBinaryRequest) {
|
||||
if (options.mediaType.format) {
|
||||
headers.accept = headers.accept.split(/,/).map(
|
||||
(format) => format.replace(
|
||||
/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,
|
||||
`application/vnd$1$2.${options.mediaType.format}`
|
||||
)
|
||||
).join(",");
|
||||
}
|
||||
if (url.endsWith("/graphql")) {
|
||||
if (options.mediaType.previews?.length) {
|
||||
const previewsFromAcceptHeader = headers.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g) || [];
|
||||
headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {
|
||||
const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json";
|
||||
return `application/vnd.github.${preview}-preview${format}`;
|
||||
}).join(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (["GET", "HEAD"].includes(method)) {
|
||||
url = addQueryParameters(url, remainingParameters);
|
||||
} else {
|
||||
if ("data" in remainingParameters) {
|
||||
body = remainingParameters.data;
|
||||
} else {
|
||||
if (Object.keys(remainingParameters).length) {
|
||||
body = remainingParameters;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!headers["content-type"] && typeof body !== "undefined") {
|
||||
headers["content-type"] = "application/json; charset=utf-8";
|
||||
}
|
||||
if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") {
|
||||
body = "";
|
||||
}
|
||||
return Object.assign(
|
||||
{ method, url, headers },
|
||||
typeof body !== "undefined" ? { body } : null,
|
||||
options.request ? { request: options.request } : null
|
||||
);
|
||||
}
|
||||
export {
|
||||
parse
|
||||
};
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
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("&");
|
||||
}
|
||||
export {
|
||||
addQueryParameters
|
||||
};
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
const urlVariableRegex = /\{[^{}}]+\}/g;
|
||||
function removeNonChars(variableName) {
|
||||
return variableName.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g, "").split(/,/);
|
||||
}
|
||||
function extractUrlVariableNames(url) {
|
||||
const matches = url.match(urlVariableRegex);
|
||||
if (!matches) {
|
||||
return [];
|
||||
}
|
||||
return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
|
||||
}
|
||||
export {
|
||||
extractUrlVariableNames
|
||||
};
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
function isPlainObject(value) {
|
||||
if (typeof value !== "object" || value === null) return false;
|
||||
if (Object.prototype.toString.call(value) !== "[object Object]") return false;
|
||||
const proto = Object.getPrototypeOf(value);
|
||||
if (proto === null) return true;
|
||||
const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
||||
return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
|
||||
}
|
||||
export {
|
||||
isPlainObject
|
||||
};
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
function lowercaseKeys(object) {
|
||||
if (!object) {
|
||||
return {};
|
||||
}
|
||||
return Object.keys(object).reduce((newObj, key) => {
|
||||
newObj[key.toLowerCase()] = object[key];
|
||||
return newObj;
|
||||
}, {});
|
||||
}
|
||||
export {
|
||||
lowercaseKeys
|
||||
};
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
import { isPlainObject } from "./is-plain-object.js";
|
||||
function mergeDeep(defaults, options) {
|
||||
const result = Object.assign({}, defaults);
|
||||
Object.keys(options).forEach((key) => {
|
||||
if (isPlainObject(options[key])) {
|
||||
if (!(key in defaults)) Object.assign(result, { [key]: options[key] });
|
||||
else result[key] = mergeDeep(defaults[key], options[key]);
|
||||
} else {
|
||||
Object.assign(result, { [key]: options[key] });
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
export {
|
||||
mergeDeep
|
||||
};
|
||||
12
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-src/util/omit.js
generated
vendored
12
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-src/util/omit.js
generated
vendored
|
|
@ -1,12 +0,0 @@
|
|||
function omit(object, keysToOmit) {
|
||||
const result = { __proto__: null };
|
||||
for (const key of Object.keys(object)) {
|
||||
if (keysToOmit.indexOf(key) === -1) {
|
||||
result[key] = object[key];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
export {
|
||||
omit
|
||||
};
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
function removeUndefinedProperties(obj) {
|
||||
for (const key in obj) {
|
||||
if (obj[key] === void 0) {
|
||||
delete obj[key];
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
export {
|
||||
removeUndefinedProperties
|
||||
};
|
||||
133
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-src/util/url-template.js
generated
vendored
133
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-src/util/url-template.js
generated
vendored
|
|
@ -1,133 +0,0 @@
|
|||
function encodeReserved(str) {
|
||||
return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) {
|
||||
if (!/%[0-9A-Fa-f]/.test(part)) {
|
||||
part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]");
|
||||
}
|
||||
return part;
|
||||
}).join("");
|
||||
}
|
||||
function encodeUnreserved(str) {
|
||||
return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
|
||||
return "%" + c.charCodeAt(0).toString(16).toUpperCase();
|
||||
});
|
||||
}
|
||||
function encodeValue(operator, value, key) {
|
||||
value = operator === "+" || operator === "#" ? encodeReserved(value) : encodeUnreserved(value);
|
||||
if (key) {
|
||||
return encodeUnreserved(key) + "=" + value;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
function isDefined(value) {
|
||||
return value !== void 0 && value !== null;
|
||||
}
|
||||
function isKeyOperator(operator) {
|
||||
return operator === ";" || operator === "&" || operator === "?";
|
||||
}
|
||||
function getValues(context, operator, key, modifier) {
|
||||
var value = context[key], result = [];
|
||||
if (isDefined(value) && value !== "") {
|
||||
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
||||
value = value.toString();
|
||||
if (modifier && modifier !== "*") {
|
||||
value = value.substring(0, parseInt(modifier, 10));
|
||||
}
|
||||
result.push(
|
||||
encodeValue(operator, value, isKeyOperator(operator) ? key : "")
|
||||
);
|
||||
} else {
|
||||
if (modifier === "*") {
|
||||
if (Array.isArray(value)) {
|
||||
value.filter(isDefined).forEach(function(value2) {
|
||||
result.push(
|
||||
encodeValue(operator, value2, isKeyOperator(operator) ? key : "")
|
||||
);
|
||||
});
|
||||
} else {
|
||||
Object.keys(value).forEach(function(k) {
|
||||
if (isDefined(value[k])) {
|
||||
result.push(encodeValue(operator, value[k], k));
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const tmp = [];
|
||||
if (Array.isArray(value)) {
|
||||
value.filter(isDefined).forEach(function(value2) {
|
||||
tmp.push(encodeValue(operator, value2));
|
||||
});
|
||||
} else {
|
||||
Object.keys(value).forEach(function(k) {
|
||||
if (isDefined(value[k])) {
|
||||
tmp.push(encodeUnreserved(k));
|
||||
tmp.push(encodeValue(operator, value[k].toString()));
|
||||
}
|
||||
});
|
||||
}
|
||||
if (isKeyOperator(operator)) {
|
||||
result.push(encodeUnreserved(key) + "=" + tmp.join(","));
|
||||
} else if (tmp.length !== 0) {
|
||||
result.push(tmp.join(","));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (operator === ";") {
|
||||
if (isDefined(value)) {
|
||||
result.push(encodeUnreserved(key));
|
||||
}
|
||||
} else if (value === "" && (operator === "&" || operator === "?")) {
|
||||
result.push(encodeUnreserved(key) + "=");
|
||||
} else if (value === "") {
|
||||
result.push("");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function parseUrl(template) {
|
||||
return {
|
||||
expand: expand.bind(null, template)
|
||||
};
|
||||
}
|
||||
function expand(template, context) {
|
||||
var operators = ["+", "#", ".", "/", ";", "?", "&"];
|
||||
template = template.replace(
|
||||
/\{([^\{\}]+)\}|([^\{\}]+)/g,
|
||||
function(_, expression, literal) {
|
||||
if (expression) {
|
||||
let operator = "";
|
||||
const values = [];
|
||||
if (operators.indexOf(expression.charAt(0)) !== -1) {
|
||||
operator = expression.charAt(0);
|
||||
expression = expression.substr(1);
|
||||
}
|
||||
expression.split(/,/g).forEach(function(variable) {
|
||||
var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
|
||||
values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
|
||||
});
|
||||
if (operator && operator !== "+") {
|
||||
var separator = ",";
|
||||
if (operator === "?") {
|
||||
separator = "&";
|
||||
} else if (operator !== "#") {
|
||||
separator = operator;
|
||||
}
|
||||
return (values.length !== 0 ? operator : "") + values.join(separator);
|
||||
} else {
|
||||
return values.join(",");
|
||||
}
|
||||
} else {
|
||||
return encodeReserved(literal);
|
||||
}
|
||||
}
|
||||
);
|
||||
if (template === "/") {
|
||||
return template;
|
||||
} else {
|
||||
return template.replace(/\/$/, "");
|
||||
}
|
||||
}
|
||||
export {
|
||||
parseUrl
|
||||
};
|
||||
4
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-src/version.js
generated
vendored
4
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-src/version.js
generated
vendored
|
|
@ -1,4 +0,0 @@
|
|||
const VERSION = "10.1.3";
|
||||
export {
|
||||
VERSION
|
||||
};
|
||||
16
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-src/with-defaults.js
generated
vendored
16
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-src/with-defaults.js
generated
vendored
|
|
@ -1,16 +0,0 @@
|
|||
import { endpointWithDefaults } from "./endpoint-with-defaults.js";
|
||||
import { merge } from "./merge.js";
|
||||
import { parse } from "./parse.js";
|
||||
function withDefaults(oldDefaults, newDefaults) {
|
||||
const DEFAULTS = merge(oldDefaults, newDefaults);
|
||||
const endpoint = endpointWithDefaults.bind(null, DEFAULTS);
|
||||
return Object.assign(endpoint, {
|
||||
DEFAULTS,
|
||||
defaults: withDefaults.bind(null, DEFAULTS),
|
||||
merge: merge.bind(null, DEFAULTS),
|
||||
parse
|
||||
});
|
||||
}
|
||||
export {
|
||||
withDefaults
|
||||
};
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
import type { EndpointDefaults } from "@octokit/types";
|
||||
export declare const DEFAULTS: EndpointDefaults;
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
import type { EndpointOptions, RequestParameters, Route } from "@octokit/types";
|
||||
import { DEFAULTS } from "./defaults.js";
|
||||
export declare function endpointWithDefaults(defaults: typeof DEFAULTS, route: Route | EndpointOptions, options?: RequestParameters): import("@octokit/types").RequestOptions;
|
||||
1
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-types/index.d.ts
generated
vendored
1
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-types/index.d.ts
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
export declare const endpoint: import("@octokit/types").EndpointInterface<object>;
|
||||
2
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-types/merge.d.ts
generated
vendored
2
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-types/merge.d.ts
generated
vendored
|
|
@ -1,2 +0,0 @@
|
|||
import type { EndpointDefaults, RequestParameters, Route } from "@octokit/types";
|
||||
export declare function merge(defaults: EndpointDefaults | null, route?: Route | RequestParameters, options?: RequestParameters): EndpointDefaults;
|
||||
2
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-types/parse.d.ts
generated
vendored
2
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/dist-types/parse.d.ts
generated
vendored
|
|
@ -1,2 +0,0 @@
|
|||
import type { EndpointDefaults, RequestOptions } from "@octokit/types";
|
||||
export declare function parse(options: EndpointDefaults): RequestOptions;
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
export declare function addQueryParameters(url: string, parameters: {
|
||||
[x: string]: string | undefined;
|
||||
q?: string;
|
||||
}): string;
|
||||
|
|
@ -1 +0,0 @@
|
|||
export declare function extractUrlVariableNames(url: string): string[];
|
||||
|
|
@ -1 +0,0 @@
|
|||
export declare function isPlainObject(value: unknown): value is Object;
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
export declare function lowercaseKeys(object?: {
|
||||
[key: string]: any;
|
||||
}): {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
|
@ -1 +0,0 @@
|
|||
export declare function mergeDeep(defaults: any, options: any): object;
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
export declare function omit(object: {
|
||||
[key: string]: any;
|
||||
}, keysToOmit: string[]): {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
|
@ -1 +0,0 @@
|
|||
export declare function removeUndefinedProperties(obj: any): any;
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
export declare function parseUrl(template: string): {
|
||||
expand: (context: object) => string;
|
||||
};
|
||||
|
|
@ -1 +0,0 @@
|
|||
export declare const VERSION = "10.1.3";
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
import type { EndpointInterface, RequestParameters, EndpointDefaults } from "@octokit/types";
|
||||
export declare function withDefaults(oldDefaults: EndpointDefaults | null, newDefaults: RequestParameters): EndpointInterface;
|
||||
51
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/package.json
generated
vendored
51
node_modules/@octokit/auth-app/node_modules/@octokit/endpoint/package.json
generated
vendored
|
|
@ -1,51 +0,0 @@
|
|||
{
|
||||
"name": "@octokit/endpoint",
|
||||
"version": "10.1.3",
|
||||
"type": "module",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"provenance": true
|
||||
},
|
||||
"description": "Turns REST API endpoints into generic request options",
|
||||
"repository": "github:octokit/endpoint.js",
|
||||
"keywords": [
|
||||
"octokit",
|
||||
"github",
|
||||
"api",
|
||||
"rest"
|
||||
],
|
||||
"author": "Gregor Martynus (https://github.com/gr2m)",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@octokit/tsconfig": "^4.0.0",
|
||||
"@types/node": "^22.0.0",
|
||||
"@vitest/coverage-v8": "^3.0.0",
|
||||
"esbuild": "^0.25.0",
|
||||
"glob": "^11.0.0",
|
||||
"prettier": "3.4.2",
|
||||
"semantic-release": "^24.0.0",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||
"typescript": "^5.0.0",
|
||||
"vitest": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"files": [
|
||||
"dist-*/**",
|
||||
"bin/**"
|
||||
],
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"import": "./dist-bundle/index.js",
|
||||
"default": "./dist-bundle/index.js"
|
||||
}
|
||||
},
|
||||
"sideEffects": false
|
||||
}
|
||||
21
node_modules/@octokit/auth-app/node_modules/@octokit/request-error/LICENSE
generated
vendored
21
node_modules/@octokit/auth-app/node_modules/@octokit/request-error/LICENSE
generated
vendored
|
|
@ -1,21 +0,0 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2019 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.
|
||||
93
node_modules/@octokit/auth-app/node_modules/@octokit/request-error/README.md
generated
vendored
93
node_modules/@octokit/auth-app/node_modules/@octokit/request-error/README.md
generated
vendored
|
|
@ -1,93 +0,0 @@
|
|||
# request-error.js
|
||||
|
||||
> Error class for Octokit request errors
|
||||
|
||||
[](https://www.npmjs.com/package/@octokit/request-error)
|
||||
[](https://github.com/octokit/request-error.js/actions?query=workflow%3ATest)
|
||||
|
||||
## Usage
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
Load <code>@octokit/request-error</code> directly from <a href="https://esm.sh">esm.sh</a>
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { RequestError } from "https://esm.sh/@octokit/request-error";
|
||||
</script>
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Node
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install @octokit/request-error</code>
|
||||
|
||||
```js
|
||||
import { RequestError } from "@octokit/request-error";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
> [!IMPORTANT]
|
||||
> As we use [conditional exports](https://nodejs.org/api/packages.html#conditional-exports), you will need to adapt your `tsconfig.json` by setting `"moduleResolution": "node16", "module": "node16"`.
|
||||
>
|
||||
> See the TypeScript docs on [package.json "exports"](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports).<br>
|
||||
> See this [helpful guide on transitioning to ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) from [@sindresorhus](https://github.com/sindresorhus)
|
||||
|
||||
```js
|
||||
const error = new RequestError("Oops", 500, {
|
||||
request: {
|
||||
method: "POST",
|
||||
url: "https://api.github.com/foo",
|
||||
body: {
|
||||
bar: "baz",
|
||||
},
|
||||
headers: {
|
||||
authorization: "token secret123",
|
||||
},
|
||||
},
|
||||
response: {
|
||||
status: 500,
|
||||
url: "https://api.github.com/foo",
|
||||
headers: {
|
||||
"x-github-request-id": "1:2:3:4",
|
||||
},
|
||||
data: {
|
||||
foo: "bar",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
error.message; // Oops
|
||||
error.status; // 500
|
||||
error.request; // { method, url, headers, body }
|
||||
error.response; // { url, status, headers, data }
|
||||
```
|
||||
|
||||
### Usage with Octokit
|
||||
|
||||
```js
|
||||
try {
|
||||
// your code here that sends at least one Octokit request
|
||||
await octokit.request("GET /");
|
||||
} catch (error) {
|
||||
// Octokit errors always have a `error.status` property which is the http response code
|
||||
if (error.status) {
|
||||
// handle Octokit error
|
||||
} else {
|
||||
// handle all other errors
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## LICENSE
|
||||
|
||||
[MIT](LICENSE)
|
||||
40
node_modules/@octokit/auth-app/node_modules/@octokit/request-error/dist-src/index.js
generated
vendored
40
node_modules/@octokit/auth-app/node_modules/@octokit/request-error/dist-src/index.js
generated
vendored
|
|
@ -1,40 +0,0 @@
|
|||
class RequestError extends Error {
|
||||
name;
|
||||
/**
|
||||
* http status code
|
||||
*/
|
||||
status;
|
||||
/**
|
||||
* Request options that lead to the error.
|
||||
*/
|
||||
request;
|
||||
/**
|
||||
* Response object if a response was received
|
||||
*/
|
||||
response;
|
||||
constructor(message, statusCode, options) {
|
||||
super(message);
|
||||
this.name = "HttpError";
|
||||
this.status = Number.parseInt(statusCode);
|
||||
if (Number.isNaN(this.status)) {
|
||||
this.status = 0;
|
||||
}
|
||||
if ("response" in options) {
|
||||
this.response = options.response;
|
||||
}
|
||||
const requestCopy = Object.assign({}, options.request);
|
||||
if (options.request.headers.authorization) {
|
||||
requestCopy.headers = Object.assign({}, options.request.headers, {
|
||||
authorization: options.request.headers.authorization.replace(
|
||||
/(?<! ) .*$/,
|
||||
" [REDACTED]"
|
||||
)
|
||||
});
|
||||
}
|
||||
requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]");
|
||||
this.request = requestCopy;
|
||||
}
|
||||
}
|
||||
export {
|
||||
RequestError
|
||||
};
|
||||
21
node_modules/@octokit/auth-app/node_modules/@octokit/request-error/dist-types/index.d.ts
generated
vendored
21
node_modules/@octokit/auth-app/node_modules/@octokit/request-error/dist-types/index.d.ts
generated
vendored
|
|
@ -1,21 +0,0 @@
|
|||
import type { RequestOptions, OctokitResponse } from "@octokit/types";
|
||||
import type { RequestErrorOptions } from "./types.js";
|
||||
/**
|
||||
* Error with extra properties to help with debugging
|
||||
*/
|
||||
export declare class RequestError extends Error {
|
||||
name: "HttpError";
|
||||
/**
|
||||
* http status code
|
||||
*/
|
||||
status: number;
|
||||
/**
|
||||
* Request options that lead to the error.
|
||||
*/
|
||||
request: RequestOptions;
|
||||
/**
|
||||
* Response object if a response was received
|
||||
*/
|
||||
response?: OctokitResponse<unknown> | undefined;
|
||||
constructor(message: string, statusCode: number, options: RequestErrorOptions);
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import type { RequestOptions, OctokitResponse } from "@octokit/types";
|
||||
export type RequestErrorOptions = {
|
||||
response?: OctokitResponse<unknown> | undefined;
|
||||
request: RequestOptions;
|
||||
};
|
||||
50
node_modules/@octokit/auth-app/node_modules/@octokit/request-error/package.json
generated
vendored
50
node_modules/@octokit/auth-app/node_modules/@octokit/request-error/package.json
generated
vendored
|
|
@ -1,50 +0,0 @@
|
|||
{
|
||||
"name": "@octokit/request-error",
|
||||
"version": "6.1.7",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"provenance": true
|
||||
},
|
||||
"type": "module",
|
||||
"description": "Error class for Octokit request errors",
|
||||
"repository": "github:octokit/request-error.js",
|
||||
"keywords": [
|
||||
"octokit",
|
||||
"github",
|
||||
"api",
|
||||
"error"
|
||||
],
|
||||
"author": "Gregor Martynus (https://github.com/gr2m)",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@octokit/tsconfig": "^4.0.0",
|
||||
"@types/node": "^22.0.0",
|
||||
"@vitest/coverage-v8": "^3.0.0",
|
||||
"esbuild": "^0.25.0",
|
||||
"glob": "^11.0.0",
|
||||
"prettier": "3.4.2",
|
||||
"tinybench": "^3.0.0",
|
||||
"typescript": "^5.0.0",
|
||||
"vitest": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"files": [
|
||||
"dist-*/**",
|
||||
"bin/**"
|
||||
],
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"import": "./dist-src/index.js",
|
||||
"default": "./dist-src/index.js"
|
||||
}
|
||||
},
|
||||
"sideEffects": false,
|
||||
"unpkg": "dist-src/index.js"
|
||||
}
|
||||
21
node_modules/@octokit/auth-app/node_modules/@octokit/request/LICENSE
generated
vendored
21
node_modules/@octokit/auth-app/node_modules/@octokit/request/LICENSE
generated
vendored
|
|
@ -1,21 +0,0 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 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.
|
||||
579
node_modules/@octokit/auth-app/node_modules/@octokit/request/README.md
generated
vendored
579
node_modules/@octokit/auth-app/node_modules/@octokit/request/README.md
generated
vendored
|
|
@ -1,579 +0,0 @@
|
|||
# request.js
|
||||
|
||||
> Send parameterized requests to GitHub’s APIs with sensible defaults in browsers and Node
|
||||
|
||||
[](https://www.npmjs.com/package/@octokit/request)
|
||||
[](https://github.com/octokit/request.js/actions?query=workflow%3ATest+branch%3Amain)
|
||||
|
||||
`@octokit/request` is a request library for browsers & node that makes it easier
|
||||
to interact with [GitHub’s REST API](https://developer.github.com/v3/) and
|
||||
[GitHub’s GraphQL API](https://developer.github.com/v4/guides/forming-calls/#the-graphql-endpoint).
|
||||
|
||||
It uses [`@octokit/endpoint`](https://github.com/octokit/endpoint.js) to parse
|
||||
the passed options and sends the request using [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). You can pass a custom `fetch` function using the `options.request.fetch` option, see below.
|
||||
|
||||
<!-- update table of contents by running `npx markdown-toc README.md -i` -->
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [request.js](#requestjs)
|
||||
- [Features](#features)
|
||||
- [Usage](#usage)
|
||||
- [REST API example](#rest-api-example)
|
||||
- [GraphQL example](#graphql-example)
|
||||
- [Alternative: pass `method` \& `url` as part of options](#alternative-pass-method--url-as-part-of-options)
|
||||
- [Authentication](#authentication)
|
||||
- [request()](#request)
|
||||
- [`request.defaults()`](#requestdefaults)
|
||||
- [`request.endpoint`](#requestendpoint)
|
||||
- [Special cases](#special-cases)
|
||||
- [The `data` parameter – set request body directly](#the-data-parameter--set-request-body-directly)
|
||||
- [Set parameters for both the URL/query and the request body](#set-parameters-for-both-the-urlquery-and-the-request-body)
|
||||
- [Set a custom Agent to your requests](#set-a-custom-agent-to-your-requests)
|
||||
- [LICENSE](#license)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
## Features
|
||||
|
||||
🤩 1:1 mapping of REST API endpoint documentation, e.g. [Add labels to an issue](https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue) becomes
|
||||
|
||||
```js
|
||||
request("POST /repos/{owner}/{repo}/issues/{number}/labels", {
|
||||
mediaType: {
|
||||
previews: ["symmetra"],
|
||||
},
|
||||
owner: "octokit",
|
||||
repo: "request.js",
|
||||
number: 1,
|
||||
labels: ["🐛 bug"],
|
||||
});
|
||||
```
|
||||
|
||||
👶 [Small bundle size](https://bundlephobia.com/result?p=@octokit/request@5.0.3) (\<4kb minified + gzipped)
|
||||
|
||||
😎 [Authenticate](#authentication) with any of [GitHubs Authentication Strategies](https://github.com/octokit/auth.js).
|
||||
|
||||
👍 Sensible defaults
|
||||
|
||||
- `baseUrl`: `https://api.github.com`
|
||||
- `headers.accept`: `application/vnd.github.v3+json`
|
||||
- `headers['user-agent']`: `octokit-request.js/<current version> <OS information>`, e.g. `octokit-request.js/1.2.3 Node.js/10.15.0 (macOS Mojave; x64)`
|
||||
|
||||
👌 Simple to test: mock requests by passing a custom fetch method.
|
||||
|
||||
🧐 Simple to debug: Sets `error.request` to request options causing the error (with redacted credentials).
|
||||
|
||||
## Usage
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
Load <code>@octokit/request</code> directly from <a href="https://esm.sh">esm.sh</a>
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { request } from "https://esm.sh/@octokit/request";
|
||||
</script>
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Node
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install @octokit/request</code>
|
||||
|
||||
```js
|
||||
import { request } from "@octokit/request";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
### REST API example
|
||||
|
||||
```js
|
||||
// Following GitHub docs formatting:
|
||||
// https://developer.github.com/v3/repos/#list-organization-repositories
|
||||
const result = await request("GET /orgs/{org}/repos", {
|
||||
headers: {
|
||||
authorization: "token 0000000000000000000000000000000000000001",
|
||||
},
|
||||
org: "octokit",
|
||||
type: "private",
|
||||
});
|
||||
|
||||
console.log(`${result.data.length} repos found.`);
|
||||
```
|
||||
|
||||
### GraphQL example
|
||||
|
||||
For GraphQL request we recommend using [`@octokit/graphql`](https://github.com/octokit/graphql.js#readme)
|
||||
|
||||
```js
|
||||
const result = await request("POST /graphql", {
|
||||
headers: {
|
||||
authorization: "token 0000000000000000000000000000000000000001",
|
||||
},
|
||||
query: `query ($login: String!) {
|
||||
organization(login: $login) {
|
||||
repositories(privacy: PRIVATE) {
|
||||
totalCount
|
||||
}
|
||||
}
|
||||
}`,
|
||||
variables: {
|
||||
login: "octokit",
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
### Alternative: pass `method` & `url` as part of options
|
||||
|
||||
Alternatively, pass in a method and a url
|
||||
|
||||
```js
|
||||
const result = await request({
|
||||
method: "GET",
|
||||
url: "/orgs/{org}/repos",
|
||||
headers: {
|
||||
authorization: "token 0000000000000000000000000000000000000001",
|
||||
},
|
||||
org: "octokit",
|
||||
type: "private",
|
||||
});
|
||||
```
|
||||
|
||||
## Authentication
|
||||
|
||||
The simplest way to authenticate a request is to set the `Authorization` header directly, e.g. to a [personal access token](https://github.com/settings/tokens/).
|
||||
|
||||
```js
|
||||
const requestWithAuth = request.defaults({
|
||||
headers: {
|
||||
authorization: "token 0000000000000000000000000000000000000001",
|
||||
},
|
||||
});
|
||||
const result = await requestWithAuth("GET /user");
|
||||
```
|
||||
|
||||
For more complex authentication strategies such as GitHub Apps or Basic, we recommend the according authentication library exported by [`@octokit/auth`](https://github.com/octokit/auth.js).
|
||||
|
||||
```js
|
||||
import { createAppAuth } from "@octokit/auth-app";
|
||||
const auth = createAppAuth({
|
||||
appId: process.env.APP_ID,
|
||||
privateKey: process.env.PRIVATE_KEY,
|
||||
installationId: 123,
|
||||
});
|
||||
const requestWithAuth = request.defaults({
|
||||
request: {
|
||||
hook: auth.hook,
|
||||
},
|
||||
mediaType: {
|
||||
previews: ["machine-man"],
|
||||
},
|
||||
});
|
||||
|
||||
const { data: app } = await requestWithAuth("GET /app");
|
||||
const { data: app } = await requestWithAuth(
|
||||
"POST /repos/{owner}/{repo}/issues",
|
||||
{
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
title: "Hello from the engine room",
|
||||
},
|
||||
);
|
||||
```
|
||||
|
||||
## request()
|
||||
|
||||
`request(route, options)` or `request(options)`.
|
||||
|
||||
**Options**
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th align=left>
|
||||
name
|
||||
</th>
|
||||
<th align=left>
|
||||
type
|
||||
</th>
|
||||
<th align=left>
|
||||
description
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<th align=left>
|
||||
<code>route</code>
|
||||
</th>
|
||||
<td>
|
||||
String
|
||||
</td>
|
||||
<td>
|
||||
**Required**. If <code>route</code> is set it has to be a string consisting of the request method and URL, e.g. <code>GET /orgs/{org}</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left>
|
||||
<code>options.baseUrl</code>
|
||||
</th>
|
||||
<td>
|
||||
String
|
||||
</td>
|
||||
<td>
|
||||
The base URL that <code>route</code> or <code>url</code> will be prefixed with, if they use relative paths. <em>Defaults to <code>https://api.github.com</code></em>.
|
||||
</td>
|
||||
</tr>
|
||||
<th align=left>
|
||||
<code>options.headers</code>
|
||||
</th>
|
||||
<td>
|
||||
Object
|
||||
</td>
|
||||
<td>
|
||||
Custom headers. Passed headers are merged with defaults:<br>
|
||||
<em><code>headers['user-agent']</code> defaults to <code>octokit-rest.js/1.2.3</code> (where <code>1.2.3</code> is the released version)</em>.<br>
|
||||
<em><code>headers['accept']</code> defaults to <code>application/vnd.github.v3+json</code>.<br> Use <code>options.mediaType.{format,previews}</code> to request API previews and custom media types.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left>
|
||||
<code>options.method</code>
|
||||
</th>
|
||||
<td>
|
||||
String
|
||||
</td>
|
||||
<td>
|
||||
Any supported <a href="https://developer.github.com/v3/#http-verbs">http verb</a>, case-insensitive. <em>Defaults to <code>Get</code></em>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left>
|
||||
<code>options.mediaType.format</code>
|
||||
</th>
|
||||
<td>
|
||||
String
|
||||
</td>
|
||||
<td>
|
||||
Media type param, such as `raw`, `html`, or `full`. See <a href="https://developer.github.com/v3/media/">Media Types</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left>
|
||||
<code>options.mediaType.previews</code>
|
||||
</th>
|
||||
<td>
|
||||
Array of strings
|
||||
</td>
|
||||
<td>
|
||||
Name of previews, such as `mercy`, `symmetra`, or `scarlet-witch`. See <a href="https://docs.github.com/graphql/overview/schema-previews">GraphQL Schema Previews</a>.
|
||||
Note that these only apply to GraphQL requests and have no effect on REST routes.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left>
|
||||
<code>options.url</code>
|
||||
</th>
|
||||
<td>
|
||||
String
|
||||
</td>
|
||||
<td>
|
||||
**Required**. A path or full URL which may contain <code>:variable</code> or <code>{variable}</code> placeholders,
|
||||
e.g. <code>/orgs/{org}/repos</code>. The <code>url</code> is parsed using <a href="https://github.com/bramstein/url-template">url-template</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left>
|
||||
<code>options.data</code>
|
||||
</th>
|
||||
<td>
|
||||
Any
|
||||
</td>
|
||||
<td>
|
||||
Set request body directly instead of setting it to JSON based on additional parameters. See <a href="#data-parameter">"The `data` parameter"</a> below.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th align=left>
|
||||
<code>options.request.fetch</code>
|
||||
</th>
|
||||
<td>
|
||||
Function
|
||||
</td>
|
||||
<td>
|
||||
Custom replacement for <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API">fetch</a>. Useful for testing or request hooks.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left>
|
||||
<code>options.request.hook</code>
|
||||
</th>
|
||||
<td>
|
||||
Function
|
||||
</td>
|
||||
<td>
|
||||
Function with the signature <code>hook(request, endpointOptions)</code>, where <code>endpointOptions</code> are the parsed options as returned by <a href="https://github.com/octokit/endpoint.js#endpointmergeroute-options-or-endpointmergeoptions"><code>endpoint.merge()</code></a>, and <code>request</code> is <a href="https://github.com/octokit/request.js#request"><code>request()</code></a>. This option works great in conjunction with <a href="https://github.com/gr2m/before-after-hook">before-after-hook</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left>
|
||||
<a name="options-request-signal"></a><code>options.request.signal</code>
|
||||
</th>
|
||||
<td>
|
||||
<a href="https://github.com/bitinn/node-fetch/tree/e996bdab73baf996cf2dbf25643c8fe2698c3249#request-cancellation-with-abortsignal">new AbortController().signal</a>
|
||||
</td>
|
||||
<td>
|
||||
Use an <code>AbortController</code> instance to cancel a request. In node you can only cancel streamed requests.
|
||||
</td>
|
||||
</tr>
|
||||
<th align=left>
|
||||
<code>options.request.log</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>object</code>
|
||||
</td>
|
||||
<td>
|
||||
Used for internal logging. Defaults to <a href="https://developer.mozilla.org/en-US/docs/Web/API/console"><code>console</code></a>.
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<th align=left>
|
||||
<code>options.request.parseSuccessResponseBody</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>boolean</code>
|
||||
</td>
|
||||
<td>
|
||||
If set to <code>false</code> the returned `response` will be passed through from `fetch`. This is useful to stream response.body when downloading files from the GitHub API.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
All other options except `options.request.*` will be passed depending on the `method` and `url` options.
|
||||
|
||||
1. If the option key is a placeholder in the `url`, it will be used as replacement. For example, if the passed options are `{url: '/orgs/{org}/repos', org: 'foo'}` the returned `options.url` is `https://api.github.com/orgs/foo/repos`
|
||||
2. If the `method` is `GET` or `HEAD`, the option is passed as query parameter
|
||||
3. Otherwise the parameter is passed in the request body as JSON key.
|
||||
|
||||
**Result**
|
||||
|
||||
`request` returns a promise. If the request was successful, the promise resolves with an object containing 4 keys:
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th align=left>
|
||||
key
|
||||
</th>
|
||||
<th align=left>
|
||||
type
|
||||
</th>
|
||||
<th align=left>
|
||||
description
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<th align=left><code>status</code></th>
|
||||
<td>Integer</td>
|
||||
<td>Response status status</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left><code>url</code></th>
|
||||
<td>String</td>
|
||||
<td>URL of response. If a request results in redirects, this is the final URL. You can send a <code>HEAD</code> request to retrieve it without loading the full response body.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left><code>headers</code></th>
|
||||
<td>Object</td>
|
||||
<td>All response headers</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=left><code>data</code></th>
|
||||
<td>Any</td>
|
||||
<td>The response body as returned from server. If the response is JSON then it will be parsed into an object</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
If an error occurs, the promise is rejected with an `error` object containing 3 keys to help with debugging:
|
||||
|
||||
- `error.status` The http response status code
|
||||
- `error.request` The request options such as `method`, `url` and `data`
|
||||
- `error.response` The http response object with `url`, `headers`, and `data`
|
||||
|
||||
If the error is due to an `AbortSignal` being used, the resulting `AbortError` is bubbled up to the caller.
|
||||
|
||||
## `request.defaults()`
|
||||
|
||||
Override or set default options. Example:
|
||||
|
||||
```js
|
||||
import { request } from "@octokit/request";
|
||||
const myrequest = request.defaults({
|
||||
baseUrl: "https://github-enterprise.acme-inc.com/api/v3",
|
||||
headers: {
|
||||
"user-agent": "myApp/1.2.3",
|
||||
authorization: `token 0000000000000000000000000000000000000001`,
|
||||
},
|
||||
org: "my-project",
|
||||
per_page: 100,
|
||||
});
|
||||
|
||||
myrequest(`GET /orgs/{org}/repos`);
|
||||
```
|
||||
|
||||
You can call `.defaults()` again on the returned method, the defaults will cascade.
|
||||
|
||||
```js
|
||||
const myProjectRequest = request.defaults({
|
||||
baseUrl: "https://github-enterprise.acme-inc.com/api/v3",
|
||||
headers: {
|
||||
"user-agent": "myApp/1.2.3",
|
||||
},
|
||||
org: "my-project",
|
||||
});
|
||||
const myProjectRequestWithAuth = myProjectRequest.defaults({
|
||||
headers: {
|
||||
authorization: `token 0000000000000000000000000000000000000001`,
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
`myProjectRequest` now defaults the `baseUrl`, `headers['user-agent']`,
|
||||
`org` and `headers['authorization']` on top of `headers['accept']` that is set
|
||||
by the global default.
|
||||
|
||||
## `request.endpoint`
|
||||
|
||||
See https://github.com/octokit/endpoint.js. Example
|
||||
|
||||
```js
|
||||
const options = request.endpoint("GET /orgs/{org}/repos", {
|
||||
org: "my-project",
|
||||
type: "private",
|
||||
});
|
||||
|
||||
// {
|
||||
// method: 'GET',
|
||||
// url: 'https://api.github.com/orgs/my-project/repos?type=private',
|
||||
// headers: {
|
||||
// accept: 'application/vnd.github.v3+json',
|
||||
// authorization: 'token 0000000000000000000000000000000000000001',
|
||||
// 'user-agent': 'octokit/endpoint.js v1.2.3'
|
||||
// }
|
||||
// }
|
||||
```
|
||||
|
||||
All of the [`@octokit/endpoint`](https://github.com/octokit/endpoint.js) API can be used:
|
||||
|
||||
- [`octokitRequest.endpoint()`](#endpoint)
|
||||
- [`octokitRequest.endpoint.defaults()`](#endpointdefaults)
|
||||
- [`octokitRequest.endpoint.merge()`](#endpointdefaults)
|
||||
- [`octokitRequest.endpoint.parse()`](#endpointmerge)
|
||||
|
||||
## Special cases
|
||||
|
||||
<a name="data-parameter"></a>
|
||||
|
||||
### The `data` parameter – set request body directly
|
||||
|
||||
Some endpoints such as [Render a Markdown document in raw mode](https://developer.github.com/v3/markdown/#render-a-markdown-document-in-raw-mode) don’t have parameters that are sent as request body keys, instead the request body needs to be set directly. In these cases, set the `data` parameter.
|
||||
|
||||
```js
|
||||
const response = await request("POST /markdown/raw", {
|
||||
data: "Hello world github/linguist#1 **cool**, and #1!",
|
||||
headers: {
|
||||
accept: "text/html;charset=utf-8",
|
||||
"content-type": "text/plain",
|
||||
},
|
||||
});
|
||||
|
||||
// Request is sent as
|
||||
//
|
||||
// {
|
||||
// method: 'post',
|
||||
// url: 'https://api.github.com/markdown/raw',
|
||||
// headers: {
|
||||
// accept: 'text/html;charset=utf-8',
|
||||
// 'content-type': 'text/plain',
|
||||
// 'user-agent': userAgent
|
||||
// },
|
||||
// body: 'Hello world github/linguist#1 **cool**, and #1!'
|
||||
// }
|
||||
//
|
||||
// not as
|
||||
//
|
||||
// {
|
||||
// ...
|
||||
// body: '{"data": "Hello world github/linguist#1 **cool**, and #1!"}'
|
||||
// }
|
||||
```
|
||||
|
||||
### Set parameters for both the URL/query and the request body
|
||||
|
||||
There are API endpoints that accept both query parameters as well as a body. In that case you need to add the query parameters as templates to `options.url`, as defined in the [RFC 6570 URI Template specification](https://tools.ietf.org/html/rfc6570).
|
||||
|
||||
Example
|
||||
|
||||
```js
|
||||
request(
|
||||
"POST https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label}",
|
||||
{
|
||||
name: "example.zip",
|
||||
label: "short description",
|
||||
headers: {
|
||||
"content-type": "text/plain",
|
||||
"content-length": 14,
|
||||
authorization: `token 0000000000000000000000000000000000000001`,
|
||||
},
|
||||
data: "Hello, world!",
|
||||
},
|
||||
);
|
||||
```
|
||||
|
||||
### Set a custom Agent to your requests
|
||||
|
||||
The way to pass a custom `Agent` to requests is by creating a custom `fetch` function and pass it as `options.request.fetch`. A good example can be [undici's `fetch` implementation](https://undici.nodejs.org/#/?id=undicifetchinput-init-promise).
|
||||
|
||||
Example ([See example in CodeSandbox](https://codesandbox.io/p/sandbox/nifty-stitch-wdlwlf))
|
||||
|
||||
```js
|
||||
import { request } from "@octokit/request";
|
||||
import { fetch as undiciFetch, Agent } from "undici";
|
||||
|
||||
/** @type {typeof import("undici").fetch} */
|
||||
const myFetch = (url, options) => {
|
||||
return undiciFetch(url, {
|
||||
...options,
|
||||
dispatcher: new Agent({
|
||||
keepAliveTimeout: 10,
|
||||
keepAliveMaxTimeout: 10,
|
||||
}),
|
||||
});
|
||||
};
|
||||
|
||||
const { data } = await request("GET /users/{username}", {
|
||||
username: "octocat",
|
||||
headers: {
|
||||
"X-GitHub-Api-Version": "2022-11-28",
|
||||
},
|
||||
options: {
|
||||
request: {
|
||||
fetch: myFetch,
|
||||
},
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## LICENSE
|
||||
|
||||
[MIT](LICENSE)
|
||||
196
node_modules/@octokit/auth-app/node_modules/@octokit/request/dist-bundle/index.js
generated
vendored
196
node_modules/@octokit/auth-app/node_modules/@octokit/request/dist-bundle/index.js
generated
vendored
|
|
@ -1,196 +0,0 @@
|
|||
// pkg/dist-src/index.js
|
||||
import { endpoint } from "@octokit/endpoint";
|
||||
|
||||
// pkg/dist-src/defaults.js
|
||||
import { getUserAgent } from "universal-user-agent";
|
||||
|
||||
// pkg/dist-src/version.js
|
||||
var VERSION = "0.0.0-development";
|
||||
|
||||
// pkg/dist-src/defaults.js
|
||||
var defaults_default = {
|
||||
headers: {
|
||||
"user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`
|
||||
}
|
||||
};
|
||||
|
||||
// pkg/dist-src/fetch-wrapper.js
|
||||
import { safeParse } from "fast-content-type-parse";
|
||||
|
||||
// pkg/dist-src/is-plain-object.js
|
||||
function isPlainObject(value) {
|
||||
if (typeof value !== "object" || value === null) return false;
|
||||
if (Object.prototype.toString.call(value) !== "[object Object]") return false;
|
||||
const proto = Object.getPrototypeOf(value);
|
||||
if (proto === null) return true;
|
||||
const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
||||
return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
|
||||
}
|
||||
|
||||
// pkg/dist-src/fetch-wrapper.js
|
||||
import { RequestError } from "@octokit/request-error";
|
||||
async function fetchWrapper(requestOptions) {
|
||||
const fetch = requestOptions.request?.fetch || globalThis.fetch;
|
||||
if (!fetch) {
|
||||
throw new Error(
|
||||
"fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing"
|
||||
);
|
||||
}
|
||||
const log = requestOptions.request?.log || console;
|
||||
const parseSuccessResponseBody = requestOptions.request?.parseSuccessResponseBody !== false;
|
||||
const body = isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body;
|
||||
const requestHeaders = Object.fromEntries(
|
||||
Object.entries(requestOptions.headers).map(([name, value]) => [
|
||||
name,
|
||||
String(value)
|
||||
])
|
||||
);
|
||||
let fetchResponse;
|
||||
try {
|
||||
fetchResponse = await fetch(requestOptions.url, {
|
||||
method: requestOptions.method,
|
||||
body,
|
||||
redirect: requestOptions.request?.redirect,
|
||||
headers: requestHeaders,
|
||||
signal: requestOptions.request?.signal,
|
||||
// duplex must be set if request.body is ReadableStream or Async Iterables.
|
||||
// See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
|
||||
...requestOptions.body && { duplex: "half" }
|
||||
});
|
||||
} catch (error) {
|
||||
let message = "Unknown Error";
|
||||
if (error instanceof Error) {
|
||||
if (error.name === "AbortError") {
|
||||
error.status = 500;
|
||||
throw error;
|
||||
}
|
||||
message = error.message;
|
||||
if (error.name === "TypeError" && "cause" in error) {
|
||||
if (error.cause instanceof Error) {
|
||||
message = error.cause.message;
|
||||
} else if (typeof error.cause === "string") {
|
||||
message = error.cause;
|
||||
}
|
||||
}
|
||||
}
|
||||
const requestError = new RequestError(message, 500, {
|
||||
request: requestOptions
|
||||
});
|
||||
requestError.cause = error;
|
||||
throw requestError;
|
||||
}
|
||||
const status = fetchResponse.status;
|
||||
const url = fetchResponse.url;
|
||||
const responseHeaders = {};
|
||||
for (const [key, value] of fetchResponse.headers) {
|
||||
responseHeaders[key] = value;
|
||||
}
|
||||
const octokitResponse = {
|
||||
url,
|
||||
status,
|
||||
headers: responseHeaders,
|
||||
data: ""
|
||||
};
|
||||
if ("deprecation" in responseHeaders) {
|
||||
const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/);
|
||||
const deprecationLink = matches && matches.pop();
|
||||
log.warn(
|
||||
`[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
|
||||
);
|
||||
}
|
||||
if (status === 204 || status === 205) {
|
||||
return octokitResponse;
|
||||
}
|
||||
if (requestOptions.method === "HEAD") {
|
||||
if (status < 400) {
|
||||
return octokitResponse;
|
||||
}
|
||||
throw new RequestError(fetchResponse.statusText, status, {
|
||||
response: octokitResponse,
|
||||
request: requestOptions
|
||||
});
|
||||
}
|
||||
if (status === 304) {
|
||||
octokitResponse.data = await getResponseData(fetchResponse);
|
||||
throw new RequestError("Not modified", status, {
|
||||
response: octokitResponse,
|
||||
request: requestOptions
|
||||
});
|
||||
}
|
||||
if (status >= 400) {
|
||||
octokitResponse.data = await getResponseData(fetchResponse);
|
||||
throw new RequestError(toErrorMessage(octokitResponse.data), status, {
|
||||
response: octokitResponse,
|
||||
request: requestOptions
|
||||
});
|
||||
}
|
||||
octokitResponse.data = parseSuccessResponseBody ? await getResponseData(fetchResponse) : fetchResponse.body;
|
||||
return octokitResponse;
|
||||
}
|
||||
async function getResponseData(response) {
|
||||
const contentType = response.headers.get("content-type");
|
||||
if (!contentType) {
|
||||
return response.text().catch(() => "");
|
||||
}
|
||||
const mimetype = safeParse(contentType);
|
||||
if (isJSONResponse(mimetype)) {
|
||||
let text = "";
|
||||
try {
|
||||
text = await response.text();
|
||||
return JSON.parse(text);
|
||||
} catch (err) {
|
||||
return text;
|
||||
}
|
||||
} else if (mimetype.type.startsWith("text/") || mimetype.parameters.charset?.toLowerCase() === "utf-8") {
|
||||
return response.text().catch(() => "");
|
||||
} else {
|
||||
return response.arrayBuffer().catch(() => new ArrayBuffer(0));
|
||||
}
|
||||
}
|
||||
function isJSONResponse(mimetype) {
|
||||
return mimetype.type === "application/json" || mimetype.type === "application/scim+json";
|
||||
}
|
||||
function toErrorMessage(data) {
|
||||
if (typeof data === "string") {
|
||||
return data;
|
||||
}
|
||||
if (data instanceof ArrayBuffer) {
|
||||
return "Unknown error";
|
||||
}
|
||||
if ("message" in data) {
|
||||
const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : "";
|
||||
return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`;
|
||||
}
|
||||
return `Unknown error: ${JSON.stringify(data)}`;
|
||||
}
|
||||
|
||||
// pkg/dist-src/with-defaults.js
|
||||
function withDefaults(oldEndpoint, newDefaults) {
|
||||
const endpoint2 = oldEndpoint.defaults(newDefaults);
|
||||
const newApi = function(route, parameters) {
|
||||
const endpointOptions = endpoint2.merge(route, parameters);
|
||||
if (!endpointOptions.request || !endpointOptions.request.hook) {
|
||||
return fetchWrapper(endpoint2.parse(endpointOptions));
|
||||
}
|
||||
const request2 = (route2, parameters2) => {
|
||||
return fetchWrapper(
|
||||
endpoint2.parse(endpoint2.merge(route2, parameters2))
|
||||
);
|
||||
};
|
||||
Object.assign(request2, {
|
||||
endpoint: endpoint2,
|
||||
defaults: withDefaults.bind(null, endpoint2)
|
||||
});
|
||||
return endpointOptions.request.hook(request2, endpointOptions);
|
||||
};
|
||||
return Object.assign(newApi, {
|
||||
endpoint: endpoint2,
|
||||
defaults: withDefaults.bind(null, endpoint2)
|
||||
});
|
||||
}
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var request = withDefaults(endpoint, defaults_default);
|
||||
export {
|
||||
request
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
10
node_modules/@octokit/auth-app/node_modules/@octokit/request/dist-src/defaults.js
generated
vendored
10
node_modules/@octokit/auth-app/node_modules/@octokit/request/dist-src/defaults.js
generated
vendored
|
|
@ -1,10 +0,0 @@
|
|||
import { getUserAgent } from "universal-user-agent";
|
||||
import { VERSION } from "./version.js";
|
||||
var defaults_default = {
|
||||
headers: {
|
||||
"user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`
|
||||
}
|
||||
};
|
||||
export {
|
||||
defaults_default as default
|
||||
};
|
||||
140
node_modules/@octokit/auth-app/node_modules/@octokit/request/dist-src/fetch-wrapper.js
generated
vendored
140
node_modules/@octokit/auth-app/node_modules/@octokit/request/dist-src/fetch-wrapper.js
generated
vendored
|
|
@ -1,140 +0,0 @@
|
|||
import { safeParse } from "fast-content-type-parse";
|
||||
import { isPlainObject } from "./is-plain-object.js";
|
||||
import { RequestError } from "@octokit/request-error";
|
||||
async function fetchWrapper(requestOptions) {
|
||||
const fetch = requestOptions.request?.fetch || globalThis.fetch;
|
||||
if (!fetch) {
|
||||
throw new Error(
|
||||
"fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing"
|
||||
);
|
||||
}
|
||||
const log = requestOptions.request?.log || console;
|
||||
const parseSuccessResponseBody = requestOptions.request?.parseSuccessResponseBody !== false;
|
||||
const body = isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body;
|
||||
const requestHeaders = Object.fromEntries(
|
||||
Object.entries(requestOptions.headers).map(([name, value]) => [
|
||||
name,
|
||||
String(value)
|
||||
])
|
||||
);
|
||||
let fetchResponse;
|
||||
try {
|
||||
fetchResponse = await fetch(requestOptions.url, {
|
||||
method: requestOptions.method,
|
||||
body,
|
||||
redirect: requestOptions.request?.redirect,
|
||||
headers: requestHeaders,
|
||||
signal: requestOptions.request?.signal,
|
||||
// duplex must be set if request.body is ReadableStream or Async Iterables.
|
||||
// See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
|
||||
...requestOptions.body && { duplex: "half" }
|
||||
});
|
||||
} catch (error) {
|
||||
let message = "Unknown Error";
|
||||
if (error instanceof Error) {
|
||||
if (error.name === "AbortError") {
|
||||
error.status = 500;
|
||||
throw error;
|
||||
}
|
||||
message = error.message;
|
||||
if (error.name === "TypeError" && "cause" in error) {
|
||||
if (error.cause instanceof Error) {
|
||||
message = error.cause.message;
|
||||
} else if (typeof error.cause === "string") {
|
||||
message = error.cause;
|
||||
}
|
||||
}
|
||||
}
|
||||
const requestError = new RequestError(message, 500, {
|
||||
request: requestOptions
|
||||
});
|
||||
requestError.cause = error;
|
||||
throw requestError;
|
||||
}
|
||||
const status = fetchResponse.status;
|
||||
const url = fetchResponse.url;
|
||||
const responseHeaders = {};
|
||||
for (const [key, value] of fetchResponse.headers) {
|
||||
responseHeaders[key] = value;
|
||||
}
|
||||
const octokitResponse = {
|
||||
url,
|
||||
status,
|
||||
headers: responseHeaders,
|
||||
data: ""
|
||||
};
|
||||
if ("deprecation" in responseHeaders) {
|
||||
const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/);
|
||||
const deprecationLink = matches && matches.pop();
|
||||
log.warn(
|
||||
`[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
|
||||
);
|
||||
}
|
||||
if (status === 204 || status === 205) {
|
||||
return octokitResponse;
|
||||
}
|
||||
if (requestOptions.method === "HEAD") {
|
||||
if (status < 400) {
|
||||
return octokitResponse;
|
||||
}
|
||||
throw new RequestError(fetchResponse.statusText, status, {
|
||||
response: octokitResponse,
|
||||
request: requestOptions
|
||||
});
|
||||
}
|
||||
if (status === 304) {
|
||||
octokitResponse.data = await getResponseData(fetchResponse);
|
||||
throw new RequestError("Not modified", status, {
|
||||
response: octokitResponse,
|
||||
request: requestOptions
|
||||
});
|
||||
}
|
||||
if (status >= 400) {
|
||||
octokitResponse.data = await getResponseData(fetchResponse);
|
||||
throw new RequestError(toErrorMessage(octokitResponse.data), status, {
|
||||
response: octokitResponse,
|
||||
request: requestOptions
|
||||
});
|
||||
}
|
||||
octokitResponse.data = parseSuccessResponseBody ? await getResponseData(fetchResponse) : fetchResponse.body;
|
||||
return octokitResponse;
|
||||
}
|
||||
async function getResponseData(response) {
|
||||
const contentType = response.headers.get("content-type");
|
||||
if (!contentType) {
|
||||
return response.text().catch(() => "");
|
||||
}
|
||||
const mimetype = safeParse(contentType);
|
||||
if (isJSONResponse(mimetype)) {
|
||||
let text = "";
|
||||
try {
|
||||
text = await response.text();
|
||||
return JSON.parse(text);
|
||||
} catch (err) {
|
||||
return text;
|
||||
}
|
||||
} else if (mimetype.type.startsWith("text/") || mimetype.parameters.charset?.toLowerCase() === "utf-8") {
|
||||
return response.text().catch(() => "");
|
||||
} else {
|
||||
return response.arrayBuffer().catch(() => new ArrayBuffer(0));
|
||||
}
|
||||
}
|
||||
function isJSONResponse(mimetype) {
|
||||
return mimetype.type === "application/json" || mimetype.type === "application/scim+json";
|
||||
}
|
||||
function toErrorMessage(data) {
|
||||
if (typeof data === "string") {
|
||||
return data;
|
||||
}
|
||||
if (data instanceof ArrayBuffer) {
|
||||
return "Unknown error";
|
||||
}
|
||||
if ("message" in data) {
|
||||
const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : "";
|
||||
return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`;
|
||||
}
|
||||
return `Unknown error: ${JSON.stringify(data)}`;
|
||||
}
|
||||
export {
|
||||
fetchWrapper as default
|
||||
};
|
||||
7
node_modules/@octokit/auth-app/node_modules/@octokit/request/dist-src/index.js
generated
vendored
7
node_modules/@octokit/auth-app/node_modules/@octokit/request/dist-src/index.js
generated
vendored
|
|
@ -1,7 +0,0 @@
|
|||
import { endpoint } from "@octokit/endpoint";
|
||||
import defaults from "./defaults.js";
|
||||
import withDefaults from "./with-defaults.js";
|
||||
const request = withDefaults(endpoint, defaults);
|
||||
export {
|
||||
request
|
||||
};
|
||||
11
node_modules/@octokit/auth-app/node_modules/@octokit/request/dist-src/is-plain-object.js
generated
vendored
11
node_modules/@octokit/auth-app/node_modules/@octokit/request/dist-src/is-plain-object.js
generated
vendored
|
|
@ -1,11 +0,0 @@
|
|||
function isPlainObject(value) {
|
||||
if (typeof value !== "object" || value === null) return false;
|
||||
if (Object.prototype.toString.call(value) !== "[object Object]") return false;
|
||||
const proto = Object.getPrototypeOf(value);
|
||||
if (proto === null) return true;
|
||||
const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
||||
return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
|
||||
}
|
||||
export {
|
||||
isPlainObject
|
||||
};
|
||||
4
node_modules/@octokit/auth-app/node_modules/@octokit/request/dist-src/version.js
generated
vendored
4
node_modules/@octokit/auth-app/node_modules/@octokit/request/dist-src/version.js
generated
vendored
|
|
@ -1,4 +0,0 @@
|
|||
const VERSION = "9.2.2";
|
||||
export {
|
||||
VERSION
|
||||
};
|
||||
27
node_modules/@octokit/auth-app/node_modules/@octokit/request/dist-src/with-defaults.js
generated
vendored
27
node_modules/@octokit/auth-app/node_modules/@octokit/request/dist-src/with-defaults.js
generated
vendored
|
|
@ -1,27 +0,0 @@
|
|||
import fetchWrapper from "./fetch-wrapper.js";
|
||||
function withDefaults(oldEndpoint, newDefaults) {
|
||||
const endpoint = oldEndpoint.defaults(newDefaults);
|
||||
const newApi = function(route, parameters) {
|
||||
const endpointOptions = endpoint.merge(route, parameters);
|
||||
if (!endpointOptions.request || !endpointOptions.request.hook) {
|
||||
return fetchWrapper(endpoint.parse(endpointOptions));
|
||||
}
|
||||
const request = (route2, parameters2) => {
|
||||
return fetchWrapper(
|
||||
endpoint.parse(endpoint.merge(route2, parameters2))
|
||||
);
|
||||
};
|
||||
Object.assign(request, {
|
||||
endpoint,
|
||||
defaults: withDefaults.bind(null, endpoint)
|
||||
});
|
||||
return endpointOptions.request.hook(request, endpointOptions);
|
||||
};
|
||||
return Object.assign(newApi, {
|
||||
endpoint,
|
||||
defaults: withDefaults.bind(null, endpoint)
|
||||
});
|
||||
}
|
||||
export {
|
||||
withDefaults as default
|
||||
};
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
declare const _default: {
|
||||
headers: {
|
||||
"user-agent": string;
|
||||
};
|
||||
};
|
||||
export default _default;
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
import type { EndpointInterface, OctokitResponse } from "@octokit/types";
|
||||
export default function fetchWrapper(requestOptions: ReturnType<EndpointInterface>): Promise<OctokitResponse<any>>;
|
||||
1
node_modules/@octokit/auth-app/node_modules/@octokit/request/dist-types/index.d.ts
generated
vendored
1
node_modules/@octokit/auth-app/node_modules/@octokit/request/dist-types/index.d.ts
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
export declare const request: import("@octokit/types").RequestInterface<object>;
|
||||
|
|
@ -1 +0,0 @@
|
|||
export declare function isPlainObject(value: unknown): value is Object;
|
||||
1
node_modules/@octokit/auth-app/node_modules/@octokit/request/dist-types/version.d.ts
generated
vendored
1
node_modules/@octokit/auth-app/node_modules/@octokit/request/dist-types/version.d.ts
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
export declare const VERSION = "9.2.2";
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
import type { EndpointInterface, RequestInterface, RequestParameters } from "@octokit/types";
|
||||
export default function withDefaults(oldEndpoint: EndpointInterface, newDefaults: RequestParameters): RequestInterface;
|
||||
56
node_modules/@octokit/auth-app/node_modules/@octokit/request/package.json
generated
vendored
56
node_modules/@octokit/auth-app/node_modules/@octokit/request/package.json
generated
vendored
|
|
@ -1,56 +0,0 @@
|
|||
{
|
||||
"name": "@octokit/request",
|
||||
"version": "9.2.2",
|
||||
"type": "module",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"provenance": true
|
||||
},
|
||||
"description": "Send parameterized requests to GitHub's APIs with sensible defaults in browsers and Node",
|
||||
"repository": "github:octokit/request.js",
|
||||
"keywords": [
|
||||
"octokit",
|
||||
"github",
|
||||
"api",
|
||||
"request"
|
||||
],
|
||||
"author": "Gregor Martynus (https://github.com/gr2m)",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/endpoint": "^10.1.3",
|
||||
"@octokit/request-error": "^6.1.7",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"fast-content-type-parse": "^2.0.0",
|
||||
"universal-user-agent": "^7.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@octokit/auth-app": "^7.0.0",
|
||||
"@octokit/tsconfig": "^4.0.0",
|
||||
"@types/node": "^22.0.0",
|
||||
"@vitest/coverage-v8": "^3.0.0",
|
||||
"esbuild": "^0.25.0",
|
||||
"fetch-mock": "^12.0.0",
|
||||
"glob": "^11.0.0",
|
||||
"prettier": "3.5.1",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||
"typescript": "^5.0.0",
|
||||
"undici": "^6.19.2",
|
||||
"vitest": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"files": [
|
||||
"dist-*/**",
|
||||
"bin/**"
|
||||
],
|
||||
"types": "dist-types/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"import": "./dist-bundle/index.js",
|
||||
"default": "./dist-bundle/index.js"
|
||||
}
|
||||
},
|
||||
"sideEffects": false
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue