Github actions require checking in the entire node_modules or using a vercel service what the fuck github
This commit is contained in:
21
node_modules/@octokit/auth-token/LICENSE
generated
vendored
Normal file
21
node_modules/@octokit/auth-token/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
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.
|
||||
285
node_modules/@octokit/auth-token/README.md
generated
vendored
Normal file
285
node_modules/@octokit/auth-token/README.md
generated
vendored
Normal file
@@ -0,0 +1,285 @@
|
||||
# auth-token.js
|
||||
|
||||
> GitHub API token authentication for browsers and Node.js
|
||||
|
||||
[](https://www.npmjs.com/package/@octokit/auth-token)
|
||||
[](https://github.com/octokit/auth-token.js/actions?query=workflow%3ATest)
|
||||
|
||||
`@octokit/auth-token` is the simplest of [GitHub’s authentication strategies](https://github.com/octokit/auth.js).
|
||||
|
||||
It is useful if you want to support multiple authentication strategies, as it’s API is compatible with its sibling packages for [basic](https://github.com/octokit/auth-basic.js), [GitHub App](https://github.com/octokit/auth-app.js) and [OAuth app](https://github.com/octokit/auth.js) authentication.
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Usage](#usage)
|
||||
- [`createTokenAuth(token) options`](#createtokenauthtoken-options)
|
||||
- [`auth()`](#auth)
|
||||
- [Authentication object](#authentication-object)
|
||||
- [`auth.hook(request, route, options)` or `auth.hook(request, options)`](#authhookrequest-route-options-or-authhookrequest-options)
|
||||
- [Find more information](#find-more-information)
|
||||
- [Find out what scopes are enabled for oauth tokens](#find-out-what-scopes-are-enabled-for-oauth-tokens)
|
||||
- [Find out if token is a personal access token or if it belongs to an OAuth app](#find-out-if-token-is-a-personal-access-token-or-if-it-belongs-to-an-oauth-app)
|
||||
- [Find out what permissions are enabled for a repository](#find-out-what-permissions-are-enabled-for-a-repository)
|
||||
- [Use token for git operations](#use-token-for-git-operations)
|
||||
- [License](#license)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
## Usage
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
|
||||
Load `@octokit/auth-token` directly from [cdn.skypack.dev](https://cdn.skypack.dev)
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { createTokenAuth } from "https://cdn.skypack.dev/@octokit/auth-token";
|
||||
</script>
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Node
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install @octokit/auth-token</code>
|
||||
|
||||
```js
|
||||
const { createTokenAuth } = require("@octokit/auth-token");
|
||||
// or: import { createTokenAuth } from "@octokit/auth-token";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
```js
|
||||
const auth = createTokenAuth("ghp_PersonalAccessToken01245678900000000");
|
||||
const authentication = await auth();
|
||||
// {
|
||||
// type: 'token',
|
||||
// token: 'ghp_PersonalAccessToken01245678900000000',
|
||||
// tokenType: 'oauth'
|
||||
// }
|
||||
```
|
||||
|
||||
## `createTokenAuth(token) options`
|
||||
|
||||
The `createTokenAuth` method accepts a single argument of type string, which is the token. The passed token can be one of the following:
|
||||
|
||||
- [Personal access token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line)
|
||||
- [OAuth access token](https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/)
|
||||
- [GITHUB_TOKEN provided to GitHub Actions](https://developer.github.com/actions/creating-github-actions/accessing-the-runtime-environment/#environment-variables)
|
||||
- Installation access token ([server-to-server](https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation))
|
||||
- User authentication for installation ([user-to-server](https://docs.github.com/en/developers/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps))
|
||||
|
||||
Examples
|
||||
|
||||
```js
|
||||
// Personal access token or OAuth access token
|
||||
createTokenAuth("ghp_PersonalAccessToken01245678900000000");
|
||||
// {
|
||||
// type: 'token',
|
||||
// token: 'ghp_PersonalAccessToken01245678900000000',
|
||||
// tokenType: 'oauth'
|
||||
// }
|
||||
|
||||
// Installation access token or GitHub Action token
|
||||
createTokenAuth("ghs_InstallallationOrActionToken00000000");
|
||||
// {
|
||||
// type: 'token',
|
||||
// token: 'ghs_InstallallationOrActionToken00000000',
|
||||
// tokenType: 'installation'
|
||||
// }
|
||||
|
||||
// Installation access token or GitHub Action token
|
||||
createTokenAuth("ghu_InstallationUserToServer000000000000");
|
||||
// {
|
||||
// type: 'token',
|
||||
// token: 'ghu_InstallationUserToServer000000000000',
|
||||
// tokenType: 'user-to-server'
|
||||
// }
|
||||
```
|
||||
|
||||
## `auth()`
|
||||
|
||||
The `auth()` method has no options. It returns a promise which resolves with the the authentication object.
|
||||
|
||||
## Authentication object
|
||||
|
||||
<table width="100%">
|
||||
<thead align=left>
|
||||
<tr>
|
||||
<th width=150>
|
||||
name
|
||||
</th>
|
||||
<th width=70>
|
||||
type
|
||||
</th>
|
||||
<th>
|
||||
description
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody align=left valign=top>
|
||||
<tr>
|
||||
<th>
|
||||
<code>type</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>string</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>"token"</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>token</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>string</code>
|
||||
</th>
|
||||
<td>
|
||||
The provided token.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>tokenType</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>string</code>
|
||||
</th>
|
||||
<td>
|
||||
Can be either <code>"oauth"</code> for personal access tokens and OAuth tokens, <code>"installation"</code> for installation access tokens (includes <code>GITHUB_TOKEN</code> provided to GitHub Actions), <code>"app"</code> for a GitHub App JSON Web Token, or <code>"user-to-server"</code> for a user authentication token through an app installation.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## `auth.hook(request, route, options)` or `auth.hook(request, options)`
|
||||
|
||||
`auth.hook()` hooks directly into the request life cycle. It authenticates the request using the provided token.
|
||||
|
||||
The `request` option is an instance of [`@octokit/request`](https://github.com/octokit/request.js#readme). The `route`/`options` parameters are the same as for the [`request()` method](https://github.com/octokit/request.js#request).
|
||||
|
||||
`auth.hook()` can be called directly to send an authenticated request
|
||||
|
||||
```js
|
||||
const { data: authorizations } = await auth.hook(
|
||||
request,
|
||||
"GET /authorizations"
|
||||
);
|
||||
```
|
||||
|
||||
Or it can be passed as option to [`request()`](https://github.com/octokit/request.js#request).
|
||||
|
||||
```js
|
||||
const requestWithAuth = request.defaults({
|
||||
request: {
|
||||
hook: auth.hook,
|
||||
},
|
||||
});
|
||||
|
||||
const { data: authorizations } = await requestWithAuth("GET /authorizations");
|
||||
```
|
||||
|
||||
## Find more information
|
||||
|
||||
`auth()` does not send any requests, it only transforms the provided token string into an authentication object.
|
||||
|
||||
Here is a list of things you can do to retrieve further information
|
||||
|
||||
### Find out what scopes are enabled for oauth tokens
|
||||
|
||||
Note that this does not work for installations. There is no way to retrieve permissions based on an installation access tokens.
|
||||
|
||||
```js
|
||||
const TOKEN = "ghp_PersonalAccessToken01245678900000000";
|
||||
|
||||
const auth = createTokenAuth(TOKEN);
|
||||
const authentication = await auth();
|
||||
|
||||
const response = await request("HEAD /");
|
||||
const scopes = response.headers["x-oauth-scopes"].split(/,\s+/);
|
||||
|
||||
if (scopes.length) {
|
||||
console.log(
|
||||
`"${TOKEN}" has ${scopes.length} scopes enabled: ${scopes.join(", ")}`
|
||||
);
|
||||
} else {
|
||||
console.log(`"${TOKEN}" has no scopes enabled`);
|
||||
}
|
||||
```
|
||||
|
||||
### Find out if token is a personal access token or if it belongs to an OAuth app
|
||||
|
||||
```js
|
||||
const TOKEN = "ghp_PersonalAccessToken01245678900000000";
|
||||
|
||||
const auth = createTokenAuth(TOKEN);
|
||||
const authentication = await auth();
|
||||
|
||||
const response = await request("HEAD /");
|
||||
const clientId = response.headers["x-oauth-client-id"];
|
||||
|
||||
if (clientId) {
|
||||
console.log(
|
||||
`"${token}" is an OAuth token, its app’s client_id is ${clientId}.`
|
||||
);
|
||||
} else {
|
||||
console.log(`"${token}" is a personal access token`);
|
||||
}
|
||||
```
|
||||
|
||||
### Find out what permissions are enabled for a repository
|
||||
|
||||
Note that the `permissions` key is not set when authenticated using an installation access token.
|
||||
|
||||
```js
|
||||
const TOKEN = "ghp_PersonalAccessToken01245678900000000";
|
||||
|
||||
const auth = createTokenAuth(TOKEN);
|
||||
const authentication = await auth();
|
||||
|
||||
const response = await request("GET /repos/{owner}/{repo}", {
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
});
|
||||
|
||||
console.log(response.data.permissions);
|
||||
// {
|
||||
// admin: true,
|
||||
// push: true,
|
||||
// pull: true
|
||||
// }
|
||||
```
|
||||
|
||||
### Use token for git operations
|
||||
|
||||
Both OAuth and installation access tokens can be used for git operations. However, when using with an installation, [the token must be prefixed with `x-access-token`](https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/#http-based-git-access-by-an-installation).
|
||||
|
||||
This example is using the [`execa`](https://github.com/sindresorhus/execa) package to run a `git push` command.
|
||||
|
||||
```js
|
||||
const TOKEN = "ghp_PersonalAccessToken01245678900000000";
|
||||
|
||||
const auth = createTokenAuth(TOKEN);
|
||||
const { token, tokenType } = await auth();
|
||||
const tokenWithPrefix =
|
||||
tokenType === "installation" ? `x-access-token:${token}` : token;
|
||||
|
||||
const repositoryUrl = `https://${tokenWithPrefix}@github.com/octocat/hello-world.git`;
|
||||
|
||||
const { stdout } = await execa("git", ["push", repositoryUrl]);
|
||||
console.log(stdout);
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
79
node_modules/@octokit/auth-token/dist-node/index.js
generated
vendored
Normal file
79
node_modules/@octokit/auth-token/dist-node/index.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var dist_src_exports = {};
|
||||
__export(dist_src_exports, {
|
||||
createTokenAuth: () => createTokenAuth
|
||||
});
|
||||
module.exports = __toCommonJS(dist_src_exports);
|
||||
|
||||
// pkg/dist-src/auth.js
|
||||
var REGEX_IS_INSTALLATION_LEGACY = /^v1\./;
|
||||
var REGEX_IS_INSTALLATION = /^ghs_/;
|
||||
var REGEX_IS_USER_TO_SERVER = /^ghu_/;
|
||||
async function auth(token) {
|
||||
const isApp = token.split(/\./).length === 3;
|
||||
const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || REGEX_IS_INSTALLATION.test(token);
|
||||
const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);
|
||||
const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
|
||||
return {
|
||||
type: "token",
|
||||
token,
|
||||
tokenType
|
||||
};
|
||||
}
|
||||
|
||||
// pkg/dist-src/with-authorization-prefix.js
|
||||
function withAuthorizationPrefix(token) {
|
||||
if (token.split(/\./).length === 3) {
|
||||
return `bearer ${token}`;
|
||||
}
|
||||
return `token ${token}`;
|
||||
}
|
||||
|
||||
// pkg/dist-src/hook.js
|
||||
async function hook(token, request, route, parameters) {
|
||||
const endpoint = request.endpoint.merge(
|
||||
route,
|
||||
parameters
|
||||
);
|
||||
endpoint.headers.authorization = withAuthorizationPrefix(token);
|
||||
return request(endpoint);
|
||||
}
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var createTokenAuth = function createTokenAuth2(token) {
|
||||
if (!token) {
|
||||
throw new Error("[@octokit/auth-token] No token passed to createTokenAuth");
|
||||
}
|
||||
if (typeof token !== "string") {
|
||||
throw new Error(
|
||||
"[@octokit/auth-token] Token passed to createTokenAuth is not a string"
|
||||
);
|
||||
}
|
||||
token = token.replace(/^(token|bearer) +/i, "");
|
||||
return Object.assign(auth.bind(null, token), {
|
||||
hook: hook.bind(null, token)
|
||||
});
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
createTokenAuth
|
||||
});
|
||||
7
node_modules/@octokit/auth-token/dist-node/index.js.map
generated
vendored
Normal file
7
node_modules/@octokit/auth-token/dist-node/index.js.map
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../dist-src/index.js", "../dist-src/auth.js", "../dist-src/with-authorization-prefix.js", "../dist-src/hook.js"],
|
||||
"sourcesContent": ["import { auth } from \"./auth\";\nimport { hook } from \"./hook\";\nconst createTokenAuth = function createTokenAuth2(token) {\n if (!token) {\n throw new Error(\"[@octokit/auth-token] No token passed to createTokenAuth\");\n }\n if (typeof token !== \"string\") {\n throw new Error(\n \"[@octokit/auth-token] Token passed to createTokenAuth is not a string\"\n );\n }\n token = token.replace(/^(token|bearer) +/i, \"\");\n return Object.assign(auth.bind(null, token), {\n hook: hook.bind(null, token)\n });\n};\nexport {\n createTokenAuth\n};\n", "const REGEX_IS_INSTALLATION_LEGACY = /^v1\\./;\nconst REGEX_IS_INSTALLATION = /^ghs_/;\nconst REGEX_IS_USER_TO_SERVER = /^ghu_/;\nasync function auth(token) {\n const isApp = token.split(/\\./).length === 3;\n const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || REGEX_IS_INSTALLATION.test(token);\n const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);\n const tokenType = isApp ? \"app\" : isInstallation ? \"installation\" : isUserToServer ? \"user-to-server\" : \"oauth\";\n return {\n type: \"token\",\n token,\n tokenType\n };\n}\nexport {\n auth\n};\n", "function withAuthorizationPrefix(token) {\n if (token.split(/\\./).length === 3) {\n return `bearer ${token}`;\n }\n return `token ${token}`;\n}\nexport {\n withAuthorizationPrefix\n};\n", "import { withAuthorizationPrefix } from \"./with-authorization-prefix\";\nasync function hook(token, request, route, parameters) {\n const endpoint = request.endpoint.merge(\n route,\n parameters\n );\n endpoint.headers.authorization = withAuthorizationPrefix(token);\n return request(endpoint);\n}\nexport {\n hook\n};\n"],
|
||||
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAM,+BAA+B;AACrC,IAAM,wBAAwB;AAC9B,IAAM,0BAA0B;AAChC,eAAe,KAAK,OAAO;AACzB,QAAM,QAAQ,MAAM,MAAM,IAAI,EAAE,WAAW;AAC3C,QAAM,iBAAiB,6BAA6B,KAAK,KAAK,KAAK,sBAAsB,KAAK,KAAK;AACnG,QAAM,iBAAiB,wBAAwB,KAAK,KAAK;AACzD,QAAM,YAAY,QAAQ,QAAQ,iBAAiB,iBAAiB,iBAAiB,mBAAmB;AACxG,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACF;AACF;;;ACbA,SAAS,wBAAwB,OAAO;AACtC,MAAI,MAAM,MAAM,IAAI,EAAE,WAAW,GAAG;AAClC,WAAO,UAAU;AAAA,EACnB;AACA,SAAO,SAAS;AAClB;;;ACJA,eAAe,KAAK,OAAO,SAAS,OAAO,YAAY;AACrD,QAAM,WAAW,QAAQ,SAAS;AAAA,IAChC;AAAA,IACA;AAAA,EACF;AACA,WAAS,QAAQ,gBAAgB,wBAAwB,KAAK;AAC9D,SAAO,QAAQ,QAAQ;AACzB;;;AHNA,IAAM,kBAAkB,SAAS,iBAAiB,OAAO;AACvD,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,0DAA0D;AAAA,EAC5E;AACA,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,UAAQ,MAAM,QAAQ,sBAAsB,EAAE;AAC9C,SAAO,OAAO,OAAO,KAAK,KAAK,MAAM,KAAK,GAAG;AAAA,IAC3C,MAAM,KAAK,KAAK,MAAM,KAAK;AAAA,EAC7B,CAAC;AACH;",
|
||||
"names": []
|
||||
}
|
||||
17
node_modules/@octokit/auth-token/dist-src/auth.js
generated
vendored
Normal file
17
node_modules/@octokit/auth-token/dist-src/auth.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
const REGEX_IS_INSTALLATION_LEGACY = /^v1\./;
|
||||
const REGEX_IS_INSTALLATION = /^ghs_/;
|
||||
const REGEX_IS_USER_TO_SERVER = /^ghu_/;
|
||||
async function auth(token) {
|
||||
const isApp = token.split(/\./).length === 3;
|
||||
const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || REGEX_IS_INSTALLATION.test(token);
|
||||
const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);
|
||||
const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
|
||||
return {
|
||||
type: "token",
|
||||
token,
|
||||
tokenType
|
||||
};
|
||||
}
|
||||
export {
|
||||
auth
|
||||
};
|
||||
12
node_modules/@octokit/auth-token/dist-src/hook.js
generated
vendored
Normal file
12
node_modules/@octokit/auth-token/dist-src/hook.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { withAuthorizationPrefix } from "./with-authorization-prefix";
|
||||
async function hook(token, request, route, parameters) {
|
||||
const endpoint = request.endpoint.merge(
|
||||
route,
|
||||
parameters
|
||||
);
|
||||
endpoint.headers.authorization = withAuthorizationPrefix(token);
|
||||
return request(endpoint);
|
||||
}
|
||||
export {
|
||||
hook
|
||||
};
|
||||
19
node_modules/@octokit/auth-token/dist-src/index.js
generated
vendored
Normal file
19
node_modules/@octokit/auth-token/dist-src/index.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import { auth } from "./auth";
|
||||
import { hook } from "./hook";
|
||||
const createTokenAuth = function createTokenAuth2(token) {
|
||||
if (!token) {
|
||||
throw new Error("[@octokit/auth-token] No token passed to createTokenAuth");
|
||||
}
|
||||
if (typeof token !== "string") {
|
||||
throw new Error(
|
||||
"[@octokit/auth-token] Token passed to createTokenAuth is not a string"
|
||||
);
|
||||
}
|
||||
token = token.replace(/^(token|bearer) +/i, "");
|
||||
return Object.assign(auth.bind(null, token), {
|
||||
hook: hook.bind(null, token)
|
||||
});
|
||||
};
|
||||
export {
|
||||
createTokenAuth
|
||||
};
|
||||
9
node_modules/@octokit/auth-token/dist-src/with-authorization-prefix.js
generated
vendored
Normal file
9
node_modules/@octokit/auth-token/dist-src/with-authorization-prefix.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
function withAuthorizationPrefix(token) {
|
||||
if (token.split(/\./).length === 3) {
|
||||
return `bearer ${token}`;
|
||||
}
|
||||
return `token ${token}`;
|
||||
}
|
||||
export {
|
||||
withAuthorizationPrefix
|
||||
};
|
||||
2
node_modules/@octokit/auth-token/dist-types/auth.d.ts
generated
vendored
Normal file
2
node_modules/@octokit/auth-token/dist-types/auth.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { Token, Authentication } from "./types";
|
||||
export declare function auth(token: Token): Promise<Authentication>;
|
||||
2
node_modules/@octokit/auth-token/dist-types/hook.d.ts
generated
vendored
Normal file
2
node_modules/@octokit/auth-token/dist-types/hook.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { AnyResponse, EndpointOptions, RequestInterface, RequestParameters, Route, Token } from "./types";
|
||||
export declare function hook(token: Token, request: RequestInterface, route: Route | EndpointOptions, parameters?: RequestParameters): Promise<AnyResponse>;
|
||||
7
node_modules/@octokit/auth-token/dist-types/index.d.ts
generated
vendored
Normal file
7
node_modules/@octokit/auth-token/dist-types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { StrategyInterface, Token, Authentication } from "./types";
|
||||
export type Types = {
|
||||
StrategyOptions: Token;
|
||||
AuthOptions: never;
|
||||
Authentication: Authentication;
|
||||
};
|
||||
export declare const createTokenAuth: StrategyInterface;
|
||||
33
node_modules/@octokit/auth-token/dist-types/types.d.ts
generated
vendored
Normal file
33
node_modules/@octokit/auth-token/dist-types/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import * as OctokitTypes from "@octokit/types";
|
||||
export type AnyResponse = OctokitTypes.OctokitResponse<any>;
|
||||
export type StrategyInterface = OctokitTypes.StrategyInterface<[
|
||||
Token
|
||||
], [
|
||||
], Authentication>;
|
||||
export type EndpointDefaults = OctokitTypes.EndpointDefaults;
|
||||
export type EndpointOptions = OctokitTypes.EndpointOptions;
|
||||
export type RequestParameters = OctokitTypes.RequestParameters;
|
||||
export type RequestInterface = OctokitTypes.RequestInterface;
|
||||
export type Route = OctokitTypes.Route;
|
||||
export type Token = string;
|
||||
export type OAuthTokenAuthentication = {
|
||||
type: "token";
|
||||
tokenType: "oauth";
|
||||
token: Token;
|
||||
};
|
||||
export type InstallationTokenAuthentication = {
|
||||
type: "token";
|
||||
tokenType: "installation";
|
||||
token: Token;
|
||||
};
|
||||
export type AppAuthentication = {
|
||||
type: "token";
|
||||
tokenType: "app";
|
||||
token: Token;
|
||||
};
|
||||
export type UserToServerAuthentication = {
|
||||
type: "token";
|
||||
tokenType: "user-to-server";
|
||||
token: Token;
|
||||
};
|
||||
export type Authentication = OAuthTokenAuthentication | InstallationTokenAuthentication | AppAuthentication | UserToServerAuthentication;
|
||||
6
node_modules/@octokit/auth-token/dist-types/with-authorization-prefix.d.ts
generated
vendored
Normal file
6
node_modules/@octokit/auth-token/dist-types/with-authorization-prefix.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Prefix token for usage in the Authorization header
|
||||
*
|
||||
* @param token OAuth token or JSON Web Token
|
||||
*/
|
||||
export declare function withAuthorizationPrefix(token: string): string;
|
||||
52
node_modules/@octokit/auth-token/dist-web/index.js
generated
vendored
Normal file
52
node_modules/@octokit/auth-token/dist-web/index.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
// pkg/dist-src/auth.js
|
||||
var REGEX_IS_INSTALLATION_LEGACY = /^v1\./;
|
||||
var REGEX_IS_INSTALLATION = /^ghs_/;
|
||||
var REGEX_IS_USER_TO_SERVER = /^ghu_/;
|
||||
async function auth(token) {
|
||||
const isApp = token.split(/\./).length === 3;
|
||||
const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || REGEX_IS_INSTALLATION.test(token);
|
||||
const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);
|
||||
const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
|
||||
return {
|
||||
type: "token",
|
||||
token,
|
||||
tokenType
|
||||
};
|
||||
}
|
||||
|
||||
// pkg/dist-src/with-authorization-prefix.js
|
||||
function withAuthorizationPrefix(token) {
|
||||
if (token.split(/\./).length === 3) {
|
||||
return `bearer ${token}`;
|
||||
}
|
||||
return `token ${token}`;
|
||||
}
|
||||
|
||||
// pkg/dist-src/hook.js
|
||||
async function hook(token, request, route, parameters) {
|
||||
const endpoint = request.endpoint.merge(
|
||||
route,
|
||||
parameters
|
||||
);
|
||||
endpoint.headers.authorization = withAuthorizationPrefix(token);
|
||||
return request(endpoint);
|
||||
}
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var createTokenAuth = function createTokenAuth2(token) {
|
||||
if (!token) {
|
||||
throw new Error("[@octokit/auth-token] No token passed to createTokenAuth");
|
||||
}
|
||||
if (typeof token !== "string") {
|
||||
throw new Error(
|
||||
"[@octokit/auth-token] Token passed to createTokenAuth is not a string"
|
||||
);
|
||||
}
|
||||
token = token.replace(/^(token|bearer) +/i, "");
|
||||
return Object.assign(auth.bind(null, token), {
|
||||
hook: hook.bind(null, token)
|
||||
});
|
||||
};
|
||||
export {
|
||||
createTokenAuth
|
||||
};
|
||||
7
node_modules/@octokit/auth-token/dist-web/index.js.map
generated
vendored
Normal file
7
node_modules/@octokit/auth-token/dist-web/index.js.map
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../dist-src/auth.js", "../dist-src/with-authorization-prefix.js", "../dist-src/hook.js", "../dist-src/index.js"],
|
||||
"sourcesContent": ["const REGEX_IS_INSTALLATION_LEGACY = /^v1\\./;\nconst REGEX_IS_INSTALLATION = /^ghs_/;\nconst REGEX_IS_USER_TO_SERVER = /^ghu_/;\nasync function auth(token) {\n const isApp = token.split(/\\./).length === 3;\n const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || REGEX_IS_INSTALLATION.test(token);\n const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);\n const tokenType = isApp ? \"app\" : isInstallation ? \"installation\" : isUserToServer ? \"user-to-server\" : \"oauth\";\n return {\n type: \"token\",\n token,\n tokenType\n };\n}\nexport {\n auth\n};\n", "function withAuthorizationPrefix(token) {\n if (token.split(/\\./).length === 3) {\n return `bearer ${token}`;\n }\n return `token ${token}`;\n}\nexport {\n withAuthorizationPrefix\n};\n", "import { withAuthorizationPrefix } from \"./with-authorization-prefix\";\nasync function hook(token, request, route, parameters) {\n const endpoint = request.endpoint.merge(\n route,\n parameters\n );\n endpoint.headers.authorization = withAuthorizationPrefix(token);\n return request(endpoint);\n}\nexport {\n hook\n};\n", "import { auth } from \"./auth\";\nimport { hook } from \"./hook\";\nconst createTokenAuth = function createTokenAuth2(token) {\n if (!token) {\n throw new Error(\"[@octokit/auth-token] No token passed to createTokenAuth\");\n }\n if (typeof token !== \"string\") {\n throw new Error(\n \"[@octokit/auth-token] Token passed to createTokenAuth is not a string\"\n );\n }\n token = token.replace(/^(token|bearer) +/i, \"\");\n return Object.assign(auth.bind(null, token), {\n hook: hook.bind(null, token)\n });\n};\nexport {\n createTokenAuth\n};\n"],
|
||||
"mappings": ";AAAA,IAAM,+BAA+B;AACrC,IAAM,wBAAwB;AAC9B,IAAM,0BAA0B;AAChC,eAAe,KAAK,OAAO;AACzB,QAAM,QAAQ,MAAM,MAAM,IAAI,EAAE,WAAW;AAC3C,QAAM,iBAAiB,6BAA6B,KAAK,KAAK,KAAK,sBAAsB,KAAK,KAAK;AACnG,QAAM,iBAAiB,wBAAwB,KAAK,KAAK;AACzD,QAAM,YAAY,QAAQ,QAAQ,iBAAiB,iBAAiB,iBAAiB,mBAAmB;AACxG,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACF;AACF;;;ACbA,SAAS,wBAAwB,OAAO;AACtC,MAAI,MAAM,MAAM,IAAI,EAAE,WAAW,GAAG;AAClC,WAAO,UAAU;AAAA,EACnB;AACA,SAAO,SAAS;AAClB;;;ACJA,eAAe,KAAK,OAAO,SAAS,OAAO,YAAY;AACrD,QAAM,WAAW,QAAQ,SAAS;AAAA,IAChC;AAAA,IACA;AAAA,EACF;AACA,WAAS,QAAQ,gBAAgB,wBAAwB,KAAK;AAC9D,SAAO,QAAQ,QAAQ;AACzB;;;ACNA,IAAM,kBAAkB,SAAS,iBAAiB,OAAO;AACvD,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,0DAA0D;AAAA,EAC5E;AACA,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,UAAQ,MAAM,QAAQ,sBAAsB,EAAE;AAC9C,SAAO,OAAO,OAAO,KAAK,KAAK,MAAM,KAAK,GAAG;AAAA,IAC3C,MAAM,KAAK,KAAK,MAAM,KAAK;AAAA,EAC7B,CAAC;AACH;",
|
||||
"names": []
|
||||
}
|
||||
44
node_modules/@octokit/auth-token/package.json
generated
vendored
Normal file
44
node_modules/@octokit/auth-token/package.json
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "@octokit/auth-token",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"version": "4.0.0",
|
||||
"description": "GitHub API token authentication for browsers and Node.js",
|
||||
"repository": "github:octokit/auth-token.js",
|
||||
"keywords": [
|
||||
"github",
|
||||
"octokit",
|
||||
"authentication",
|
||||
"api"
|
||||
],
|
||||
"author": "Gregor Martynus (https://github.com/gr2m)",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@octokit/request": "^6.0.0",
|
||||
"@octokit/tsconfig": "^2.0.0",
|
||||
"@octokit/types": "^9.2.3",
|
||||
"@types/fetch-mock": "^7.3.1",
|
||||
"@types/jest": "^29.0.0",
|
||||
"esbuild": "^0.18.0",
|
||||
"fetch-mock": "^9.0.0",
|
||||
"glob": "^10.2.6",
|
||||
"jest": "^29.0.0",
|
||||
"prettier": "2.8.8",
|
||||
"semantic-release": "^21.0.0",
|
||||
"ts-jest": "^29.0.0",
|
||||
"typescript": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"files": [
|
||||
"dist-*/**",
|
||||
"bin/**"
|
||||
],
|
||||
"main": "dist-node/index.js",
|
||||
"browser": "dist-web/index.js",
|
||||
"types": "dist-types/index.d.ts",
|
||||
"module": "dist-src/index.js",
|
||||
"sideEffects": false
|
||||
}
|
||||
21
node_modules/@octokit/core/LICENSE
generated
vendored
Normal file
21
node_modules/@octokit/core/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
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.
|
||||
448
node_modules/@octokit/core/README.md
generated
vendored
Normal file
448
node_modules/@octokit/core/README.md
generated
vendored
Normal file
@@ -0,0 +1,448 @@
|
||||
# core.js
|
||||
|
||||
> Extendable client for GitHub's REST & GraphQL APIs
|
||||
|
||||
[](https://www.npmjs.com/package/@octokit/core)
|
||||
[](https://github.com/octokit/core.js/actions?query=workflow%3ATest+branch%3Amain)
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Usage](#usage)
|
||||
- [REST API example](#rest-api-example)
|
||||
- [GraphQL example](#graphql-example)
|
||||
- [Options](#options)
|
||||
- [Defaults](#defaults)
|
||||
- [Authentication](#authentication)
|
||||
- [Logging](#logging)
|
||||
- [Hooks](#hooks)
|
||||
- [Plugins](#plugins)
|
||||
- [Build your own Octokit with Plugins and Defaults](#build-your-own-octokit-with-plugins-and-defaults)
|
||||
- [LICENSE](#license)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
If you need a minimalistic library to utilize GitHub's [REST API](https://developer.github.com/v3/) and [GraphQL API](https://developer.github.com/v4/) which you can extend with plugins as needed, then `@octokit/core` is a great starting point.
|
||||
|
||||
If you don't need the Plugin API then using [`@octokit/request`](https://github.com/octokit/request.js/) or [`@octokit/graphql`](https://github.com/octokit/graphql.js/) directly is a good alternative.
|
||||
|
||||
## Usage
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
Load <code>@octokit/core</code> directly from <a href="https://esm.sh">esm.sh</a>
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { Octokit } from "https://esm.sh/@octokit/core";
|
||||
</script>
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Node
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install @octokit/core</code>
|
||||
|
||||
```js
|
||||
const { Octokit } = require("@octokit/core");
|
||||
// or: import { Octokit } from "@octokit/core";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
### REST API example
|
||||
|
||||
```js
|
||||
// Create a personal access token at https://github.com/settings/tokens/new?scopes=repo
|
||||
const octokit = new Octokit({ auth: `personal-access-token123` });
|
||||
|
||||
const response = await octokit.request("GET /orgs/{org}/repos", {
|
||||
org: "octokit",
|
||||
type: "private",
|
||||
});
|
||||
```
|
||||
|
||||
See [`@octokit/request`](https://github.com/octokit/request.js) for full documentation of the `.request` method.
|
||||
|
||||
### GraphQL example
|
||||
|
||||
```js
|
||||
const octokit = new Octokit({ auth: `secret123` });
|
||||
|
||||
const response = await octokit.graphql(
|
||||
`query ($login: String!) {
|
||||
organization(login: $login) {
|
||||
repositories(privacy: PRIVATE) {
|
||||
totalCount
|
||||
}
|
||||
}
|
||||
}`,
|
||||
{ login: "octokit" },
|
||||
);
|
||||
```
|
||||
|
||||
See [`@octokit/graphql`](https://github.com/octokit/graphql.js) for full documentation of the `.graphql` method.
|
||||
|
||||
## 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>options.authStrategy</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>Function<code>
|
||||
</td>
|
||||
<td>
|
||||
Defaults to <a href="https://github.com/octokit/auth-token.js#readme"><code>@octokit/auth-token</code></a>. See <a href="#authentication">Authentication</a> below for examples.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.auth</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>String</code> or <code>Object</code>
|
||||
</td>
|
||||
<td>
|
||||
See <a href="#authentication">Authentication</a> below for examples.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.baseUrl</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>String</code>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
When using with GitHub Enterprise Server, set `options.baseUrl` to the root URL of the API. For example, if your GitHub Enterprise Server's hostname is `github.acme-inc.com`, then set `options.baseUrl` to `https://github.acme-inc.com/api/v3`. Example
|
||||
|
||||
```js
|
||||
const octokit = new Octokit({
|
||||
baseUrl: "https://github.acme-inc.com/api/v3",
|
||||
});
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.previews</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>Array of Strings</code>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
Some REST API endpoints require preview headers to be set, or enable
|
||||
additional features. Preview headers can be set on a per-request basis, e.g.
|
||||
|
||||
```js
|
||||
octokit.request("POST /repos/{owner}/{repo}/pulls", {
|
||||
mediaType: {
|
||||
previews: ["shadow-cat"],
|
||||
},
|
||||
owner,
|
||||
repo,
|
||||
title: "My pull request",
|
||||
base: "main",
|
||||
head: "my-feature",
|
||||
draft: true,
|
||||
});
|
||||
```
|
||||
|
||||
You can also set previews globally, by setting the `options.previews` option on the constructor. Example:
|
||||
|
||||
```js
|
||||
const octokit = new Octokit({
|
||||
previews: ["shadow-cat"],
|
||||
});
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.request</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>Object</code>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
Set a default request timeout (`options.request.timeout`) or an [`http(s).Agent`](https://nodejs.org/api/http.html#http_class_http_agent) e.g. for proxy usage (Node only, `options.request.agent`).
|
||||
|
||||
There are more `options.request.*` options, see [`@octokit/request` options](https://github.com/octokit/request.js#request). `options.request` can also be set on a per-request basis.
|
||||
|
||||
</td></tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.timeZone</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>String</code>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
Sets the `Time-Zone` header which defines a timezone according to the [list of names from the Olson database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
|
||||
|
||||
```js
|
||||
const octokit = new Octokit({
|
||||
timeZone: "America/Los_Angeles",
|
||||
});
|
||||
```
|
||||
|
||||
The time zone header will determine the timezone used for generating the timestamp when creating commits. See [GitHub's Timezones documentation](https://developer.github.com/v3/#timezones).
|
||||
|
||||
</td></tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>options.userAgent</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>String</code>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
A custom user agent string for your app or library. Example
|
||||
|
||||
```js
|
||||
const octokit = new Octokit({
|
||||
userAgent: "my-app/v1.2.3",
|
||||
});
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## Defaults
|
||||
|
||||
You can create a new Octokit class with customized default options.
|
||||
|
||||
```js
|
||||
const MyOctokit = Octokit.defaults({
|
||||
auth: "personal-access-token123",
|
||||
baseUrl: "https://github.acme-inc.com/api/v3",
|
||||
userAgent: "my-app/v1.2.3",
|
||||
});
|
||||
const octokit1 = new MyOctokit();
|
||||
const octokit2 = new MyOctokit();
|
||||
```
|
||||
|
||||
If you pass additional options to your new constructor, the options will be merged shallowly.
|
||||
|
||||
```js
|
||||
const MyOctokit = Octokit.defaults({
|
||||
foo: {
|
||||
opt1: 1,
|
||||
},
|
||||
});
|
||||
const octokit = new MyOctokit({
|
||||
foo: {
|
||||
opt2: 1,
|
||||
},
|
||||
});
|
||||
// options will be { foo: { opt2: 1 }}
|
||||
```
|
||||
|
||||
If you need a deep or conditional merge, you can pass a function instead.
|
||||
|
||||
```js
|
||||
const MyOctokit = Octokit.defaults((options) => {
|
||||
return {
|
||||
foo: Object.assign({}, options.foo, { opt1: 1 }),
|
||||
};
|
||||
});
|
||||
const octokit = new MyOctokit({
|
||||
foo: { opt2: 1 },
|
||||
});
|
||||
// options will be { foo: { opt1: 1, opt2: 1 }}
|
||||
```
|
||||
|
||||
Be careful about mutating the `options` object in the `Octokit.defaults` callback, as it can have unforeseen consequences.
|
||||
|
||||
## Authentication
|
||||
|
||||
Authentication is optional for some REST API endpoints accessing public data, but is required for GraphQL queries. Using authentication also increases your [API rate limit](https://developer.github.com/v3/#rate-limiting).
|
||||
|
||||
By default, Octokit authenticates using the [token authentication strategy](https://github.com/octokit/auth-token.js). Pass in a token using `options.auth`. It can be a personal access token, an OAuth token, an installation access token or a JSON Web Token for GitHub App authentication. The `Authorization` header will be set according to the type of token.
|
||||
|
||||
```js
|
||||
import { Octokit } from "@octokit/core";
|
||||
|
||||
const octokit = new Octokit({
|
||||
auth: "mypersonalaccesstoken123",
|
||||
});
|
||||
|
||||
const { data } = await octokit.request("/user");
|
||||
```
|
||||
|
||||
To use a different authentication strategy, set `options.authStrategy`. A list of authentication strategies is available at [octokit/authentication-strategies.js](https://github.com/octokit/authentication-strategies.js/#readme).
|
||||
|
||||
Example
|
||||
|
||||
```js
|
||||
import { Octokit } from "@octokit/core";
|
||||
import { createAppAuth } from "@octokit/auth-app";
|
||||
|
||||
const appOctokit = new Octokit({
|
||||
authStrategy: createAppAuth,
|
||||
auth: {
|
||||
appId: 123,
|
||||
privateKey: process.env.PRIVATE_KEY,
|
||||
},
|
||||
});
|
||||
|
||||
const { data } = await appOctokit.request("/app");
|
||||
```
|
||||
|
||||
The `.auth()` method returned by the current authentication strategy can be accessed at `octokit.auth()`. Example
|
||||
|
||||
```js
|
||||
const { token } = await appOctokit.auth({
|
||||
type: "installation",
|
||||
installationId: 123,
|
||||
});
|
||||
```
|
||||
|
||||
## Logging
|
||||
|
||||
There are four built-in log methods
|
||||
|
||||
1. `octokit.log.debug(message[, additionalInfo])`
|
||||
1. `octokit.log.info(message[, additionalInfo])`
|
||||
1. `octokit.log.warn(message[, additionalInfo])`
|
||||
1. `octokit.log.error(message[, additionalInfo])`
|
||||
|
||||
They can be configured using the [`log` client option](client-options). By default, `octokit.log.debug()` and `octokit.log.info()` are no-ops, while the other two call `console.warn()` and `console.error()` respectively.
|
||||
|
||||
This is useful if you build reusable [plugins](#plugins).
|
||||
|
||||
If you would like to make the log level configurable using an environment variable or external option, we recommend the [console-log-level](https://github.com/watson/console-log-level) package. Example
|
||||
|
||||
```js
|
||||
const octokit = new Octokit({
|
||||
log: require("console-log-level")({ level: "info" }),
|
||||
});
|
||||
```
|
||||
|
||||
## Hooks
|
||||
|
||||
You can customize Octokit's request lifecycle with hooks.
|
||||
|
||||
```js
|
||||
octokit.hook.before("request", async (options) => {
|
||||
validate(options);
|
||||
});
|
||||
octokit.hook.after("request", async (response, options) => {
|
||||
console.log(`${options.method} ${options.url}: ${response.status}`);
|
||||
});
|
||||
octokit.hook.error("request", async (error, options) => {
|
||||
if (error.status === 304) {
|
||||
return findInCache(error.response.headers.etag);
|
||||
}
|
||||
|
||||
throw error;
|
||||
});
|
||||
octokit.hook.wrap("request", async (request, options) => {
|
||||
// add logic before, after, catch errors or replace the request altogether
|
||||
return request(options);
|
||||
});
|
||||
```
|
||||
|
||||
See [before-after-hook](https://github.com/gr2m/before-after-hook#readme) for more documentation on hooks.
|
||||
|
||||
## Plugins
|
||||
|
||||
Octokit’s functionality can be extended using plugins. The `Octokit.plugin()` method accepts a plugin (or many) and returns a new constructor.
|
||||
|
||||
A plugin is a function which gets two arguments:
|
||||
|
||||
1. the current instance
|
||||
2. the options passed to the constructor.
|
||||
|
||||
In order to extend `octokit`'s API, the plugin must return an object with the new methods. Please refrain from adding methods directly to the `octokit` instance, especialy if you depend on keys that do not exist in `@octokit/core`, such as `octokit.rest`.
|
||||
|
||||
```js
|
||||
// index.js
|
||||
const { Octokit } = require("@octokit/core")
|
||||
const MyOctokit = Octokit.plugin(
|
||||
require("./lib/my-plugin"),
|
||||
require("octokit-plugin-example")
|
||||
);
|
||||
|
||||
const octokit = new MyOctokit({ greeting: "Moin moin" });
|
||||
octokit.helloWorld(); // logs "Moin moin, world!"
|
||||
octokit.request("GET /"); // logs "GET / - 200 in 123ms"
|
||||
|
||||
// lib/my-plugin.js
|
||||
module.exports = (octokit, options = { greeting: "Hello" }) => {
|
||||
// hook into the request lifecycle
|
||||
octokit.hook.wrap("request", async (request, options) => {
|
||||
const time = Date.now();
|
||||
const response = await request(options);
|
||||
console.log(
|
||||
`${options.method} ${options.url} – ${response.status} in ${Date.now() -
|
||||
time}ms`
|
||||
);
|
||||
return response;
|
||||
});
|
||||
|
||||
// add a custom method
|
||||
return {
|
||||
helloWorld: () => console.log(`${options.greeting}, world!`);
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## Build your own Octokit with Plugins and Defaults
|
||||
|
||||
You can build your own Octokit class with preset default options and plugins. In fact, this is mostly how the `@octokit/<context>` modules work, such as [`@octokit/action`](https://github.com/octokit/action.js):
|
||||
|
||||
```js
|
||||
const { Octokit } = require("@octokit/core");
|
||||
const MyActionOctokit = Octokit.plugin(
|
||||
require("@octokit/plugin-paginate-rest").paginateRest,
|
||||
require("@octokit/plugin-throttling").throttling,
|
||||
require("@octokit/plugin-retry").retry,
|
||||
).defaults({
|
||||
throttle: {
|
||||
onAbuseLimit: (retryAfter, options) => {
|
||||
/* ... */
|
||||
},
|
||||
onRateLimit: (retryAfter, options) => {
|
||||
/* ... */
|
||||
},
|
||||
},
|
||||
authStrategy: require("@octokit/auth-action").createActionAuth,
|
||||
userAgent: `my-octokit-action/v1.2.3`,
|
||||
});
|
||||
|
||||
const octokit = new MyActionOctokit();
|
||||
const installations = await octokit.paginate("GET /app/installations");
|
||||
```
|
||||
|
||||
## LICENSE
|
||||
|
||||
[MIT](LICENSE)
|
||||
163
node_modules/@octokit/core/dist-node/index.js
generated
vendored
Normal file
163
node_modules/@octokit/core/dist-node/index.js
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var dist_src_exports = {};
|
||||
__export(dist_src_exports, {
|
||||
Octokit: () => Octokit
|
||||
});
|
||||
module.exports = __toCommonJS(dist_src_exports);
|
||||
var import_universal_user_agent = require("universal-user-agent");
|
||||
var import_before_after_hook = require("before-after-hook");
|
||||
var import_request = require("@octokit/request");
|
||||
var import_graphql = require("@octokit/graphql");
|
||||
var import_auth_token = require("@octokit/auth-token");
|
||||
|
||||
// pkg/dist-src/version.js
|
||||
var VERSION = "5.2.0";
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var noop = () => {
|
||||
};
|
||||
var consoleWarn = console.warn.bind(console);
|
||||
var consoleError = console.error.bind(console);
|
||||
var userAgentTrail = `octokit-core.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`;
|
||||
var Octokit = class {
|
||||
static {
|
||||
this.VERSION = VERSION;
|
||||
}
|
||||
static defaults(defaults) {
|
||||
const OctokitWithDefaults = class extends this {
|
||||
constructor(...args) {
|
||||
const options = args[0] || {};
|
||||
if (typeof defaults === "function") {
|
||||
super(defaults(options));
|
||||
return;
|
||||
}
|
||||
super(
|
||||
Object.assign(
|
||||
{},
|
||||
defaults,
|
||||
options,
|
||||
options.userAgent && defaults.userAgent ? {
|
||||
userAgent: `${options.userAgent} ${defaults.userAgent}`
|
||||
} : null
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
return OctokitWithDefaults;
|
||||
}
|
||||
static {
|
||||
this.plugins = [];
|
||||
}
|
||||
/**
|
||||
* Attach a plugin (or many) to your Octokit instance.
|
||||
*
|
||||
* @example
|
||||
* const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
|
||||
*/
|
||||
static plugin(...newPlugins) {
|
||||
const currentPlugins = this.plugins;
|
||||
const NewOctokit = class extends this {
|
||||
static {
|
||||
this.plugins = currentPlugins.concat(
|
||||
newPlugins.filter((plugin) => !currentPlugins.includes(plugin))
|
||||
);
|
||||
}
|
||||
};
|
||||
return NewOctokit;
|
||||
}
|
||||
constructor(options = {}) {
|
||||
const hook = new import_before_after_hook.Collection();
|
||||
const requestDefaults = {
|
||||
baseUrl: import_request.request.endpoint.DEFAULTS.baseUrl,
|
||||
headers: {},
|
||||
request: Object.assign({}, options.request, {
|
||||
// @ts-ignore internal usage only, no need to type
|
||||
hook: hook.bind(null, "request")
|
||||
}),
|
||||
mediaType: {
|
||||
previews: [],
|
||||
format: ""
|
||||
}
|
||||
};
|
||||
requestDefaults.headers["user-agent"] = options.userAgent ? `${options.userAgent} ${userAgentTrail}` : userAgentTrail;
|
||||
if (options.baseUrl) {
|
||||
requestDefaults.baseUrl = options.baseUrl;
|
||||
}
|
||||
if (options.previews) {
|
||||
requestDefaults.mediaType.previews = options.previews;
|
||||
}
|
||||
if (options.timeZone) {
|
||||
requestDefaults.headers["time-zone"] = options.timeZone;
|
||||
}
|
||||
this.request = import_request.request.defaults(requestDefaults);
|
||||
this.graphql = (0, import_graphql.withCustomRequest)(this.request).defaults(requestDefaults);
|
||||
this.log = Object.assign(
|
||||
{
|
||||
debug: noop,
|
||||
info: noop,
|
||||
warn: consoleWarn,
|
||||
error: consoleError
|
||||
},
|
||||
options.log
|
||||
);
|
||||
this.hook = hook;
|
||||
if (!options.authStrategy) {
|
||||
if (!options.auth) {
|
||||
this.auth = async () => ({
|
||||
type: "unauthenticated"
|
||||
});
|
||||
} else {
|
||||
const auth = (0, import_auth_token.createTokenAuth)(options.auth);
|
||||
hook.wrap("request", auth.hook);
|
||||
this.auth = auth;
|
||||
}
|
||||
} else {
|
||||
const { authStrategy, ...otherOptions } = options;
|
||||
const auth = authStrategy(
|
||||
Object.assign(
|
||||
{
|
||||
request: this.request,
|
||||
log: this.log,
|
||||
// we pass the current octokit instance as well as its constructor options
|
||||
// to allow for authentication strategies that return a new octokit instance
|
||||
// that shares the same internal state as the current one. The original
|
||||
// requirement for this was the "event-octokit" authentication strategy
|
||||
// of https://github.com/probot/octokit-auth-probot.
|
||||
octokit: this,
|
||||
octokitOptions: otherOptions
|
||||
},
|
||||
options.auth
|
||||
)
|
||||
);
|
||||
hook.wrap("request", auth.hook);
|
||||
this.auth = auth;
|
||||
}
|
||||
const classConstructor = this.constructor;
|
||||
for (let i = 0; i < classConstructor.plugins.length; ++i) {
|
||||
Object.assign(this, classConstructor.plugins[i](this, options));
|
||||
}
|
||||
}
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
Octokit
|
||||
});
|
||||
7
node_modules/@octokit/core/dist-node/index.js.map
generated
vendored
Normal file
7
node_modules/@octokit/core/dist-node/index.js.map
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../dist-src/index.js", "../dist-src/version.js"],
|
||||
"sourcesContent": ["import { getUserAgent } from \"universal-user-agent\";\nimport { Collection } from \"before-after-hook\";\nimport { request } from \"@octokit/request\";\nimport { graphql, withCustomRequest } from \"@octokit/graphql\";\nimport { createTokenAuth } from \"@octokit/auth-token\";\nimport { VERSION } from \"./version.js\";\nconst noop = () => {\n};\nconst consoleWarn = console.warn.bind(console);\nconst consoleError = console.error.bind(console);\nconst userAgentTrail = `octokit-core.js/${VERSION} ${getUserAgent()}`;\nclass Octokit {\n static {\n this.VERSION = VERSION;\n }\n static defaults(defaults) {\n const OctokitWithDefaults = class extends this {\n constructor(...args) {\n const options = args[0] || {};\n if (typeof defaults === \"function\") {\n super(defaults(options));\n return;\n }\n super(\n Object.assign(\n {},\n defaults,\n options,\n options.userAgent && defaults.userAgent ? {\n userAgent: `${options.userAgent} ${defaults.userAgent}`\n } : null\n )\n );\n }\n };\n return OctokitWithDefaults;\n }\n static {\n this.plugins = [];\n }\n /**\n * Attach a plugin (or many) to your Octokit instance.\n *\n * @example\n * const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)\n */\n static plugin(...newPlugins) {\n const currentPlugins = this.plugins;\n const NewOctokit = class extends this {\n static {\n this.plugins = currentPlugins.concat(\n newPlugins.filter((plugin) => !currentPlugins.includes(plugin))\n );\n }\n };\n return NewOctokit;\n }\n constructor(options = {}) {\n const hook = new Collection();\n const requestDefaults = {\n baseUrl: request.endpoint.DEFAULTS.baseUrl,\n headers: {},\n request: Object.assign({}, options.request, {\n // @ts-ignore internal usage only, no need to type\n hook: hook.bind(null, \"request\")\n }),\n mediaType: {\n previews: [],\n format: \"\"\n }\n };\n requestDefaults.headers[\"user-agent\"] = options.userAgent ? `${options.userAgent} ${userAgentTrail}` : userAgentTrail;\n if (options.baseUrl) {\n requestDefaults.baseUrl = options.baseUrl;\n }\n if (options.previews) {\n requestDefaults.mediaType.previews = options.previews;\n }\n if (options.timeZone) {\n requestDefaults.headers[\"time-zone\"] = options.timeZone;\n }\n this.request = request.defaults(requestDefaults);\n this.graphql = withCustomRequest(this.request).defaults(requestDefaults);\n this.log = Object.assign(\n {\n debug: noop,\n info: noop,\n warn: consoleWarn,\n error: consoleError\n },\n options.log\n );\n this.hook = hook;\n if (!options.authStrategy) {\n if (!options.auth) {\n this.auth = async () => ({\n type: \"unauthenticated\"\n });\n } else {\n const auth = createTokenAuth(options.auth);\n hook.wrap(\"request\", auth.hook);\n this.auth = auth;\n }\n } else {\n const { authStrategy, ...otherOptions } = options;\n const auth = authStrategy(\n Object.assign(\n {\n request: this.request,\n log: this.log,\n // we pass the current octokit instance as well as its constructor options\n // to allow for authentication strategies that return a new octokit instance\n // that shares the same internal state as the current one. The original\n // requirement for this was the \"event-octokit\" authentication strategy\n // of https://github.com/probot/octokit-auth-probot.\n octokit: this,\n octokitOptions: otherOptions\n },\n options.auth\n )\n );\n hook.wrap(\"request\", auth.hook);\n this.auth = auth;\n }\n const classConstructor = this.constructor;\n for (let i = 0; i < classConstructor.plugins.length; ++i) {\n Object.assign(this, classConstructor.plugins[i](this, options));\n }\n }\n}\nexport {\n Octokit\n};\n", "const VERSION = \"5.2.0\";\nexport {\n VERSION\n};\n"],
|
||||
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAA6B;AAC7B,+BAA2B;AAC3B,qBAAwB;AACxB,qBAA2C;AAC3C,wBAAgC;;;ACJhC,IAAM,UAAU;;;ADMhB,IAAM,OAAO,MAAM;AACnB;AACA,IAAM,cAAc,QAAQ,KAAK,KAAK,OAAO;AAC7C,IAAM,eAAe,QAAQ,MAAM,KAAK,OAAO;AAC/C,IAAM,iBAAiB,mBAAmB,OAAO,QAAI,0CAAa,CAAC;AACnE,IAAM,UAAN,MAAc;AAAA,EACZ,OAAO;AACL,SAAK,UAAU;AAAA,EACjB;AAAA,EACA,OAAO,SAAS,UAAU;AACxB,UAAM,sBAAsB,cAAc,KAAK;AAAA,MAC7C,eAAe,MAAM;AACnB,cAAM,UAAU,KAAK,CAAC,KAAK,CAAC;AAC5B,YAAI,OAAO,aAAa,YAAY;AAClC,gBAAM,SAAS,OAAO,CAAC;AACvB;AAAA,QACF;AACA;AAAA,UACE,OAAO;AAAA,YACL,CAAC;AAAA,YACD;AAAA,YACA;AAAA,YACA,QAAQ,aAAa,SAAS,YAAY;AAAA,cACxC,WAAW,GAAG,QAAQ,SAAS,IAAI,SAAS,SAAS;AAAA,YACvD,IAAI;AAAA,UACN;AAAA,QACF;AAAA,MACF;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EACA,OAAO;AACL,SAAK,UAAU,CAAC;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,UAAU,YAAY;AAC3B,UAAM,iBAAiB,KAAK;AAC5B,UAAM,aAAa,cAAc,KAAK;AAAA,MACpC,OAAO;AACL,aAAK,UAAU,eAAe;AAAA,UAC5B,WAAW,OAAO,CAAC,WAAW,CAAC,eAAe,SAAS,MAAM,CAAC;AAAA,QAChE;AAAA,MACF;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EACA,YAAY,UAAU,CAAC,GAAG;AACxB,UAAM,OAAO,IAAI,oCAAW;AAC5B,UAAM,kBAAkB;AAAA,MACtB,SAAS,uBAAQ,SAAS,SAAS;AAAA,MACnC,SAAS,CAAC;AAAA,MACV,SAAS,OAAO,OAAO,CAAC,GAAG,QAAQ,SAAS;AAAA;AAAA,QAE1C,MAAM,KAAK,KAAK,MAAM,SAAS;AAAA,MACjC,CAAC;AAAA,MACD,WAAW;AAAA,QACT,UAAU,CAAC;AAAA,QACX,QAAQ;AAAA,MACV;AAAA,IACF;AACA,oBAAgB,QAAQ,YAAY,IAAI,QAAQ,YAAY,GAAG,QAAQ,SAAS,IAAI,cAAc,KAAK;AACvG,QAAI,QAAQ,SAAS;AACnB,sBAAgB,UAAU,QAAQ;AAAA,IACpC;AACA,QAAI,QAAQ,UAAU;AACpB,sBAAgB,UAAU,WAAW,QAAQ;AAAA,IAC/C;AACA,QAAI,QAAQ,UAAU;AACpB,sBAAgB,QAAQ,WAAW,IAAI,QAAQ;AAAA,IACjD;AACA,SAAK,UAAU,uBAAQ,SAAS,eAAe;AAC/C,SAAK,cAAU,kCAAkB,KAAK,OAAO,EAAE,SAAS,eAAe;AACvE,SAAK,MAAM,OAAO;AAAA,MAChB;AAAA,QACE,OAAO;AAAA,QACP,MAAM;AAAA,QACN,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,QAAQ;AAAA,IACV;AACA,SAAK,OAAO;AACZ,QAAI,CAAC,QAAQ,cAAc;AACzB,UAAI,CAAC,QAAQ,MAAM;AACjB,aAAK,OAAO,aAAa;AAAA,UACvB,MAAM;AAAA,QACR;AAAA,MACF,OAAO;AACL,cAAM,WAAO,mCAAgB,QAAQ,IAAI;AACzC,aAAK,KAAK,WAAW,KAAK,IAAI;AAC9B,aAAK,OAAO;AAAA,MACd;AAAA,IACF,OAAO;AACL,YAAM,EAAE,cAAc,GAAG,aAAa,IAAI;AAC1C,YAAM,OAAO;AAAA,QACX,OAAO;AAAA,UACL;AAAA,YACE,SAAS,KAAK;AAAA,YACd,KAAK,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAMV,SAAS;AAAA,YACT,gBAAgB;AAAA,UAClB;AAAA,UACA,QAAQ;AAAA,QACV;AAAA,MACF;AACA,WAAK,KAAK,WAAW,KAAK,IAAI;AAC9B,WAAK,OAAO;AAAA,IACd;AACA,UAAM,mBAAmB,KAAK;AAC9B,aAAS,IAAI,GAAG,IAAI,iBAAiB,QAAQ,QAAQ,EAAE,GAAG;AACxD,aAAO,OAAO,MAAM,iBAAiB,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC;AAAA,IAChE;AAAA,EACF;AACF;",
|
||||
"names": []
|
||||
}
|
||||
133
node_modules/@octokit/core/dist-src/index.js
generated
vendored
Normal file
133
node_modules/@octokit/core/dist-src/index.js
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
import { getUserAgent } from "universal-user-agent";
|
||||
import { Collection } from "before-after-hook";
|
||||
import { request } from "@octokit/request";
|
||||
import { graphql, withCustomRequest } from "@octokit/graphql";
|
||||
import { createTokenAuth } from "@octokit/auth-token";
|
||||
import { VERSION } from "./version.js";
|
||||
const noop = () => {
|
||||
};
|
||||
const consoleWarn = console.warn.bind(console);
|
||||
const consoleError = console.error.bind(console);
|
||||
const userAgentTrail = `octokit-core.js/${VERSION} ${getUserAgent()}`;
|
||||
class Octokit {
|
||||
static {
|
||||
this.VERSION = VERSION;
|
||||
}
|
||||
static defaults(defaults) {
|
||||
const OctokitWithDefaults = class extends this {
|
||||
constructor(...args) {
|
||||
const options = args[0] || {};
|
||||
if (typeof defaults === "function") {
|
||||
super(defaults(options));
|
||||
return;
|
||||
}
|
||||
super(
|
||||
Object.assign(
|
||||
{},
|
||||
defaults,
|
||||
options,
|
||||
options.userAgent && defaults.userAgent ? {
|
||||
userAgent: `${options.userAgent} ${defaults.userAgent}`
|
||||
} : null
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
return OctokitWithDefaults;
|
||||
}
|
||||
static {
|
||||
this.plugins = [];
|
||||
}
|
||||
/**
|
||||
* Attach a plugin (or many) to your Octokit instance.
|
||||
*
|
||||
* @example
|
||||
* const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
|
||||
*/
|
||||
static plugin(...newPlugins) {
|
||||
const currentPlugins = this.plugins;
|
||||
const NewOctokit = class extends this {
|
||||
static {
|
||||
this.plugins = currentPlugins.concat(
|
||||
newPlugins.filter((plugin) => !currentPlugins.includes(plugin))
|
||||
);
|
||||
}
|
||||
};
|
||||
return NewOctokit;
|
||||
}
|
||||
constructor(options = {}) {
|
||||
const hook = new Collection();
|
||||
const requestDefaults = {
|
||||
baseUrl: request.endpoint.DEFAULTS.baseUrl,
|
||||
headers: {},
|
||||
request: Object.assign({}, options.request, {
|
||||
// @ts-ignore internal usage only, no need to type
|
||||
hook: hook.bind(null, "request")
|
||||
}),
|
||||
mediaType: {
|
||||
previews: [],
|
||||
format: ""
|
||||
}
|
||||
};
|
||||
requestDefaults.headers["user-agent"] = options.userAgent ? `${options.userAgent} ${userAgentTrail}` : userAgentTrail;
|
||||
if (options.baseUrl) {
|
||||
requestDefaults.baseUrl = options.baseUrl;
|
||||
}
|
||||
if (options.previews) {
|
||||
requestDefaults.mediaType.previews = options.previews;
|
||||
}
|
||||
if (options.timeZone) {
|
||||
requestDefaults.headers["time-zone"] = options.timeZone;
|
||||
}
|
||||
this.request = request.defaults(requestDefaults);
|
||||
this.graphql = withCustomRequest(this.request).defaults(requestDefaults);
|
||||
this.log = Object.assign(
|
||||
{
|
||||
debug: noop,
|
||||
info: noop,
|
||||
warn: consoleWarn,
|
||||
error: consoleError
|
||||
},
|
||||
options.log
|
||||
);
|
||||
this.hook = hook;
|
||||
if (!options.authStrategy) {
|
||||
if (!options.auth) {
|
||||
this.auth = async () => ({
|
||||
type: "unauthenticated"
|
||||
});
|
||||
} else {
|
||||
const auth = createTokenAuth(options.auth);
|
||||
hook.wrap("request", auth.hook);
|
||||
this.auth = auth;
|
||||
}
|
||||
} else {
|
||||
const { authStrategy, ...otherOptions } = options;
|
||||
const auth = authStrategy(
|
||||
Object.assign(
|
||||
{
|
||||
request: this.request,
|
||||
log: this.log,
|
||||
// we pass the current octokit instance as well as its constructor options
|
||||
// to allow for authentication strategies that return a new octokit instance
|
||||
// that shares the same internal state as the current one. The original
|
||||
// requirement for this was the "event-octokit" authentication strategy
|
||||
// of https://github.com/probot/octokit-auth-probot.
|
||||
octokit: this,
|
||||
octokitOptions: otherOptions
|
||||
},
|
||||
options.auth
|
||||
)
|
||||
);
|
||||
hook.wrap("request", auth.hook);
|
||||
this.auth = auth;
|
||||
}
|
||||
const classConstructor = this.constructor;
|
||||
for (let i = 0; i < classConstructor.plugins.length; ++i) {
|
||||
Object.assign(this, classConstructor.plugins[i](this, options));
|
||||
}
|
||||
}
|
||||
}
|
||||
export {
|
||||
Octokit
|
||||
};
|
||||
4
node_modules/@octokit/core/dist-src/version.js
generated
vendored
Normal file
4
node_modules/@octokit/core/dist-src/version.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
const VERSION = "5.2.0";
|
||||
export {
|
||||
VERSION
|
||||
};
|
||||
31
node_modules/@octokit/core/dist-types/index.d.ts
generated
vendored
Normal file
31
node_modules/@octokit/core/dist-types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import type { HookCollection } from "before-after-hook";
|
||||
import { request } from "@octokit/request";
|
||||
import { graphql } from "@octokit/graphql";
|
||||
import type { Constructor, Hooks, OctokitOptions, OctokitPlugin, ReturnTypeOf, UnionToIntersection } from "./types.js";
|
||||
export type { OctokitOptions } from "./types.js";
|
||||
export declare class Octokit {
|
||||
static VERSION: string;
|
||||
static defaults<S extends Constructor<any>>(this: S, defaults: OctokitOptions | Function): S;
|
||||
static plugins: OctokitPlugin[];
|
||||
/**
|
||||
* Attach a plugin (or many) to your Octokit instance.
|
||||
*
|
||||
* @example
|
||||
* const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
|
||||
*/
|
||||
static plugin<S extends Constructor<any> & {
|
||||
plugins: any[];
|
||||
}, T extends OctokitPlugin[]>(this: S, ...newPlugins: T): S & Constructor<UnionToIntersection<ReturnTypeOf<T>>>;
|
||||
constructor(options?: OctokitOptions);
|
||||
request: typeof request;
|
||||
graphql: typeof graphql;
|
||||
log: {
|
||||
debug: (message: string, additionalInfo?: object) => any;
|
||||
info: (message: string, additionalInfo?: object) => any;
|
||||
warn: (message: string, additionalInfo?: object) => any;
|
||||
error: (message: string, additionalInfo?: object) => any;
|
||||
[key: string]: any;
|
||||
};
|
||||
hook: HookCollection<Hooks>;
|
||||
auth: (...args: unknown[]) => Promise<unknown>;
|
||||
}
|
||||
44
node_modules/@octokit/core/dist-types/types.d.ts
generated
vendored
Normal file
44
node_modules/@octokit/core/dist-types/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import * as OctokitTypes from "@octokit/types";
|
||||
import { RequestError } from "@octokit/request-error";
|
||||
import type { Octokit } from "./index.js";
|
||||
export type RequestParameters = OctokitTypes.RequestParameters;
|
||||
export interface OctokitOptions {
|
||||
authStrategy?: any;
|
||||
auth?: any;
|
||||
userAgent?: string;
|
||||
previews?: string[];
|
||||
baseUrl?: string;
|
||||
log?: {
|
||||
debug: (message: string) => unknown;
|
||||
info: (message: string) => unknown;
|
||||
warn: (message: string) => unknown;
|
||||
error: (message: string) => unknown;
|
||||
};
|
||||
request?: OctokitTypes.RequestRequestOptions;
|
||||
timeZone?: string;
|
||||
[option: string]: any;
|
||||
}
|
||||
export type Constructor<T> = new (...args: any[]) => T;
|
||||
export type ReturnTypeOf<T extends AnyFunction | AnyFunction[]> = T extends AnyFunction ? ReturnType<T> : T extends AnyFunction[] ? UnionToIntersection<Exclude<ReturnType<T[number]>, void>> : never;
|
||||
/**
|
||||
* @author https://stackoverflow.com/users/2887218/jcalz
|
||||
* @see https://stackoverflow.com/a/50375286/10325032
|
||||
*/
|
||||
export type UnionToIntersection<Union> = (Union extends any ? (argument: Union) => void : never) extends (argument: infer Intersection) => void ? Intersection : never;
|
||||
type AnyFunction = (...args: any) => any;
|
||||
export type OctokitPlugin = (octokit: Octokit, options: OctokitOptions) => {
|
||||
[key: string]: any;
|
||||
} | void;
|
||||
export type Hooks = {
|
||||
request: {
|
||||
Options: Required<OctokitTypes.EndpointDefaults>;
|
||||
Result: OctokitTypes.OctokitResponse<any>;
|
||||
Error: RequestError | Error;
|
||||
};
|
||||
[key: string]: {
|
||||
Options: unknown;
|
||||
Result: unknown;
|
||||
Error: unknown;
|
||||
};
|
||||
};
|
||||
export {};
|
||||
1
node_modules/@octokit/core/dist-types/version.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/core/dist-types/version.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare const VERSION = "5.2.0";
|
||||
138
node_modules/@octokit/core/dist-web/index.js
generated
vendored
Normal file
138
node_modules/@octokit/core/dist-web/index.js
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
// pkg/dist-src/index.js
|
||||
import { getUserAgent } from "universal-user-agent";
|
||||
import { Collection } from "before-after-hook";
|
||||
import { request } from "@octokit/request";
|
||||
import { graphql, withCustomRequest } from "@octokit/graphql";
|
||||
import { createTokenAuth } from "@octokit/auth-token";
|
||||
|
||||
// pkg/dist-src/version.js
|
||||
var VERSION = "5.2.0";
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var noop = () => {
|
||||
};
|
||||
var consoleWarn = console.warn.bind(console);
|
||||
var consoleError = console.error.bind(console);
|
||||
var userAgentTrail = `octokit-core.js/${VERSION} ${getUserAgent()}`;
|
||||
var Octokit = class {
|
||||
static {
|
||||
this.VERSION = VERSION;
|
||||
}
|
||||
static defaults(defaults) {
|
||||
const OctokitWithDefaults = class extends this {
|
||||
constructor(...args) {
|
||||
const options = args[0] || {};
|
||||
if (typeof defaults === "function") {
|
||||
super(defaults(options));
|
||||
return;
|
||||
}
|
||||
super(
|
||||
Object.assign(
|
||||
{},
|
||||
defaults,
|
||||
options,
|
||||
options.userAgent && defaults.userAgent ? {
|
||||
userAgent: `${options.userAgent} ${defaults.userAgent}`
|
||||
} : null
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
return OctokitWithDefaults;
|
||||
}
|
||||
static {
|
||||
this.plugins = [];
|
||||
}
|
||||
/**
|
||||
* Attach a plugin (or many) to your Octokit instance.
|
||||
*
|
||||
* @example
|
||||
* const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
|
||||
*/
|
||||
static plugin(...newPlugins) {
|
||||
const currentPlugins = this.plugins;
|
||||
const NewOctokit = class extends this {
|
||||
static {
|
||||
this.plugins = currentPlugins.concat(
|
||||
newPlugins.filter((plugin) => !currentPlugins.includes(plugin))
|
||||
);
|
||||
}
|
||||
};
|
||||
return NewOctokit;
|
||||
}
|
||||
constructor(options = {}) {
|
||||
const hook = new Collection();
|
||||
const requestDefaults = {
|
||||
baseUrl: request.endpoint.DEFAULTS.baseUrl,
|
||||
headers: {},
|
||||
request: Object.assign({}, options.request, {
|
||||
// @ts-ignore internal usage only, no need to type
|
||||
hook: hook.bind(null, "request")
|
||||
}),
|
||||
mediaType: {
|
||||
previews: [],
|
||||
format: ""
|
||||
}
|
||||
};
|
||||
requestDefaults.headers["user-agent"] = options.userAgent ? `${options.userAgent} ${userAgentTrail}` : userAgentTrail;
|
||||
if (options.baseUrl) {
|
||||
requestDefaults.baseUrl = options.baseUrl;
|
||||
}
|
||||
if (options.previews) {
|
||||
requestDefaults.mediaType.previews = options.previews;
|
||||
}
|
||||
if (options.timeZone) {
|
||||
requestDefaults.headers["time-zone"] = options.timeZone;
|
||||
}
|
||||
this.request = request.defaults(requestDefaults);
|
||||
this.graphql = withCustomRequest(this.request).defaults(requestDefaults);
|
||||
this.log = Object.assign(
|
||||
{
|
||||
debug: noop,
|
||||
info: noop,
|
||||
warn: consoleWarn,
|
||||
error: consoleError
|
||||
},
|
||||
options.log
|
||||
);
|
||||
this.hook = hook;
|
||||
if (!options.authStrategy) {
|
||||
if (!options.auth) {
|
||||
this.auth = async () => ({
|
||||
type: "unauthenticated"
|
||||
});
|
||||
} else {
|
||||
const auth = createTokenAuth(options.auth);
|
||||
hook.wrap("request", auth.hook);
|
||||
this.auth = auth;
|
||||
}
|
||||
} else {
|
||||
const { authStrategy, ...otherOptions } = options;
|
||||
const auth = authStrategy(
|
||||
Object.assign(
|
||||
{
|
||||
request: this.request,
|
||||
log: this.log,
|
||||
// we pass the current octokit instance as well as its constructor options
|
||||
// to allow for authentication strategies that return a new octokit instance
|
||||
// that shares the same internal state as the current one. The original
|
||||
// requirement for this was the "event-octokit" authentication strategy
|
||||
// of https://github.com/probot/octokit-auth-probot.
|
||||
octokit: this,
|
||||
octokitOptions: otherOptions
|
||||
},
|
||||
options.auth
|
||||
)
|
||||
);
|
||||
hook.wrap("request", auth.hook);
|
||||
this.auth = auth;
|
||||
}
|
||||
const classConstructor = this.constructor;
|
||||
for (let i = 0; i < classConstructor.plugins.length; ++i) {
|
||||
Object.assign(this, classConstructor.plugins[i](this, options));
|
||||
}
|
||||
}
|
||||
};
|
||||
export {
|
||||
Octokit
|
||||
};
|
||||
7
node_modules/@octokit/core/dist-web/index.js.map
generated
vendored
Normal file
7
node_modules/@octokit/core/dist-web/index.js.map
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../dist-src/index.js", "../dist-src/version.js"],
|
||||
"sourcesContent": ["import { getUserAgent } from \"universal-user-agent\";\nimport { Collection } from \"before-after-hook\";\nimport { request } from \"@octokit/request\";\nimport { graphql, withCustomRequest } from \"@octokit/graphql\";\nimport { createTokenAuth } from \"@octokit/auth-token\";\nimport { VERSION } from \"./version.js\";\nconst noop = () => {\n};\nconst consoleWarn = console.warn.bind(console);\nconst consoleError = console.error.bind(console);\nconst userAgentTrail = `octokit-core.js/${VERSION} ${getUserAgent()}`;\nclass Octokit {\n static {\n this.VERSION = VERSION;\n }\n static defaults(defaults) {\n const OctokitWithDefaults = class extends this {\n constructor(...args) {\n const options = args[0] || {};\n if (typeof defaults === \"function\") {\n super(defaults(options));\n return;\n }\n super(\n Object.assign(\n {},\n defaults,\n options,\n options.userAgent && defaults.userAgent ? {\n userAgent: `${options.userAgent} ${defaults.userAgent}`\n } : null\n )\n );\n }\n };\n return OctokitWithDefaults;\n }\n static {\n this.plugins = [];\n }\n /**\n * Attach a plugin (or many) to your Octokit instance.\n *\n * @example\n * const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)\n */\n static plugin(...newPlugins) {\n const currentPlugins = this.plugins;\n const NewOctokit = class extends this {\n static {\n this.plugins = currentPlugins.concat(\n newPlugins.filter((plugin) => !currentPlugins.includes(plugin))\n );\n }\n };\n return NewOctokit;\n }\n constructor(options = {}) {\n const hook = new Collection();\n const requestDefaults = {\n baseUrl: request.endpoint.DEFAULTS.baseUrl,\n headers: {},\n request: Object.assign({}, options.request, {\n // @ts-ignore internal usage only, no need to type\n hook: hook.bind(null, \"request\")\n }),\n mediaType: {\n previews: [],\n format: \"\"\n }\n };\n requestDefaults.headers[\"user-agent\"] = options.userAgent ? `${options.userAgent} ${userAgentTrail}` : userAgentTrail;\n if (options.baseUrl) {\n requestDefaults.baseUrl = options.baseUrl;\n }\n if (options.previews) {\n requestDefaults.mediaType.previews = options.previews;\n }\n if (options.timeZone) {\n requestDefaults.headers[\"time-zone\"] = options.timeZone;\n }\n this.request = request.defaults(requestDefaults);\n this.graphql = withCustomRequest(this.request).defaults(requestDefaults);\n this.log = Object.assign(\n {\n debug: noop,\n info: noop,\n warn: consoleWarn,\n error: consoleError\n },\n options.log\n );\n this.hook = hook;\n if (!options.authStrategy) {\n if (!options.auth) {\n this.auth = async () => ({\n type: \"unauthenticated\"\n });\n } else {\n const auth = createTokenAuth(options.auth);\n hook.wrap(\"request\", auth.hook);\n this.auth = auth;\n }\n } else {\n const { authStrategy, ...otherOptions } = options;\n const auth = authStrategy(\n Object.assign(\n {\n request: this.request,\n log: this.log,\n // we pass the current octokit instance as well as its constructor options\n // to allow for authentication strategies that return a new octokit instance\n // that shares the same internal state as the current one. The original\n // requirement for this was the \"event-octokit\" authentication strategy\n // of https://github.com/probot/octokit-auth-probot.\n octokit: this,\n octokitOptions: otherOptions\n },\n options.auth\n )\n );\n hook.wrap(\"request\", auth.hook);\n this.auth = auth;\n }\n const classConstructor = this.constructor;\n for (let i = 0; i < classConstructor.plugins.length; ++i) {\n Object.assign(this, classConstructor.plugins[i](this, options));\n }\n }\n}\nexport {\n Octokit\n};\n", "const VERSION = \"5.2.0\";\nexport {\n VERSION\n};\n"],
|
||||
"mappings": ";AAAA,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,SAAS,yBAAyB;AAC3C,SAAS,uBAAuB;;;ACJhC,IAAM,UAAU;;;ADMhB,IAAM,OAAO,MAAM;AACnB;AACA,IAAM,cAAc,QAAQ,KAAK,KAAK,OAAO;AAC7C,IAAM,eAAe,QAAQ,MAAM,KAAK,OAAO;AAC/C,IAAM,iBAAiB,mBAAmB,OAAO,IAAI,aAAa,CAAC;AACnE,IAAM,UAAN,MAAc;AAAA,EACZ,OAAO;AACL,SAAK,UAAU;AAAA,EACjB;AAAA,EACA,OAAO,SAAS,UAAU;AACxB,UAAM,sBAAsB,cAAc,KAAK;AAAA,MAC7C,eAAe,MAAM;AACnB,cAAM,UAAU,KAAK,CAAC,KAAK,CAAC;AAC5B,YAAI,OAAO,aAAa,YAAY;AAClC,gBAAM,SAAS,OAAO,CAAC;AACvB;AAAA,QACF;AACA;AAAA,UACE,OAAO;AAAA,YACL,CAAC;AAAA,YACD;AAAA,YACA;AAAA,YACA,QAAQ,aAAa,SAAS,YAAY;AAAA,cACxC,WAAW,GAAG,QAAQ,SAAS,IAAI,SAAS,SAAS;AAAA,YACvD,IAAI;AAAA,UACN;AAAA,QACF;AAAA,MACF;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EACA,OAAO;AACL,SAAK,UAAU,CAAC;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,UAAU,YAAY;AAC3B,UAAM,iBAAiB,KAAK;AAC5B,UAAM,aAAa,cAAc,KAAK;AAAA,MACpC,OAAO;AACL,aAAK,UAAU,eAAe;AAAA,UAC5B,WAAW,OAAO,CAAC,WAAW,CAAC,eAAe,SAAS,MAAM,CAAC;AAAA,QAChE;AAAA,MACF;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EACA,YAAY,UAAU,CAAC,GAAG;AACxB,UAAM,OAAO,IAAI,WAAW;AAC5B,UAAM,kBAAkB;AAAA,MACtB,SAAS,QAAQ,SAAS,SAAS;AAAA,MACnC,SAAS,CAAC;AAAA,MACV,SAAS,OAAO,OAAO,CAAC,GAAG,QAAQ,SAAS;AAAA;AAAA,QAE1C,MAAM,KAAK,KAAK,MAAM,SAAS;AAAA,MACjC,CAAC;AAAA,MACD,WAAW;AAAA,QACT,UAAU,CAAC;AAAA,QACX,QAAQ;AAAA,MACV;AAAA,IACF;AACA,oBAAgB,QAAQ,YAAY,IAAI,QAAQ,YAAY,GAAG,QAAQ,SAAS,IAAI,cAAc,KAAK;AACvG,QAAI,QAAQ,SAAS;AACnB,sBAAgB,UAAU,QAAQ;AAAA,IACpC;AACA,QAAI,QAAQ,UAAU;AACpB,sBAAgB,UAAU,WAAW,QAAQ;AAAA,IAC/C;AACA,QAAI,QAAQ,UAAU;AACpB,sBAAgB,QAAQ,WAAW,IAAI,QAAQ;AAAA,IACjD;AACA,SAAK,UAAU,QAAQ,SAAS,eAAe;AAC/C,SAAK,UAAU,kBAAkB,KAAK,OAAO,EAAE,SAAS,eAAe;AACvE,SAAK,MAAM,OAAO;AAAA,MAChB;AAAA,QACE,OAAO;AAAA,QACP,MAAM;AAAA,QACN,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,QAAQ;AAAA,IACV;AACA,SAAK,OAAO;AACZ,QAAI,CAAC,QAAQ,cAAc;AACzB,UAAI,CAAC,QAAQ,MAAM;AACjB,aAAK,OAAO,aAAa;AAAA,UACvB,MAAM;AAAA,QACR;AAAA,MACF,OAAO;AACL,cAAM,OAAO,gBAAgB,QAAQ,IAAI;AACzC,aAAK,KAAK,WAAW,KAAK,IAAI;AAC9B,aAAK,OAAO;AAAA,MACd;AAAA,IACF,OAAO;AACL,YAAM,EAAE,cAAc,GAAG,aAAa,IAAI;AAC1C,YAAM,OAAO;AAAA,QACX,OAAO;AAAA,UACL;AAAA,YACE,SAAS,KAAK;AAAA,YACd,KAAK,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAMV,SAAS;AAAA,YACT,gBAAgB;AAAA,UAClB;AAAA,UACA,QAAQ;AAAA,QACV;AAAA,MACF;AACA,WAAK,KAAK,WAAW,KAAK,IAAI;AAC9B,WAAK,OAAO;AAAA,IACd;AACA,UAAM,mBAAmB,KAAK;AAC9B,aAAS,IAAI,GAAG,IAAI,iBAAiB,QAAQ,QAAQ,EAAE,GAAG;AACxD,aAAO,OAAO,MAAM,iBAAiB,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC;AAAA,IAChE;AAAA,EACF;AACF;",
|
||||
"names": []
|
||||
}
|
||||
64
node_modules/@octokit/core/package.json
generated
vendored
Normal file
64
node_modules/@octokit/core/package.json
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "@octokit/core",
|
||||
"version": "5.2.0",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"provenance": true
|
||||
},
|
||||
"description": "Extendable client for GitHub's REST & GraphQL APIs",
|
||||
"repository": "github:octokit/core.js",
|
||||
"keywords": [
|
||||
"octokit",
|
||||
"github",
|
||||
"api",
|
||||
"sdk",
|
||||
"toolkit"
|
||||
],
|
||||
"author": "Gregor Martynus (https://github.com/gr2m)",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/auth-token": "^4.0.0",
|
||||
"@octokit/graphql": "^7.1.0",
|
||||
"@octokit/request": "^8.3.1",
|
||||
"@octokit/request-error": "^5.1.0",
|
||||
"@octokit/types": "^13.0.0",
|
||||
"before-after-hook": "^2.2.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@octokit/auth-action": "^4.1.0",
|
||||
"@octokit/auth-app": "^6.0.0",
|
||||
"@octokit/auth-oauth-app": "^7.1.0",
|
||||
"@octokit/tsconfig": "^2.0.0",
|
||||
"@sinonjs/fake-timers": "^11.2.2",
|
||||
"@types/fetch-mock": "^7.3.1",
|
||||
"@types/jest": "^29.0.0",
|
||||
"@types/lolex": "^5.1.0",
|
||||
"@types/node": "^20.0.0",
|
||||
"@types/sinonjs__fake-timers": "^8.1.5",
|
||||
"esbuild": "^0.19.0",
|
||||
"fetch-mock": "npm:@gr2m/fetch-mock@9.11.0-pull-request-644.1",
|
||||
"glob": "^10.2.5",
|
||||
"http-proxy-agent": "^7.0.0",
|
||||
"jest": "^29.0.0",
|
||||
"prettier": "3.2.4",
|
||||
"proxy": "^2.0.0",
|
||||
"semantic-release": "^23.0.0",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||
"ts-jest": "^29.0.0",
|
||||
"typescript": "^5.0.0",
|
||||
"undici": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"files": [
|
||||
"dist-*/**",
|
||||
"bin/**"
|
||||
],
|
||||
"main": "dist-node/index.js",
|
||||
"module": "dist-web/index.js",
|
||||
"types": "dist-types/index.d.ts",
|
||||
"source": "dist-src/index.js",
|
||||
"sideEffects": false
|
||||
}
|
||||
21
node_modules/@octokit/endpoint/LICENSE
generated
vendored
Normal file
21
node_modules/@octokit/endpoint/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
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.
|
||||
410
node_modules/@octokit/endpoint/README.md
generated
vendored
Normal file
410
node_modules/@octokit/endpoint/README.md
generated
vendored
Normal file
@@ -0,0 +1,410 @@
|
||||
# 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
|
||||
const { endpoint } = require("@octokit/endpoint");
|
||||
// or: 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);
|
||||
```
|
||||
|
||||
## 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)
|
||||
378
node_modules/@octokit/endpoint/dist-node/index.js
generated
vendored
Normal file
378
node_modules/@octokit/endpoint/dist-node/index.js
generated
vendored
Normal file
@@ -0,0 +1,378 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var dist_src_exports = {};
|
||||
__export(dist_src_exports, {
|
||||
endpoint: () => endpoint
|
||||
});
|
||||
module.exports = __toCommonJS(dist_src_exports);
|
||||
|
||||
// pkg/dist-src/defaults.js
|
||||
var import_universal_user_agent = require("universal-user-agent");
|
||||
|
||||
// pkg/dist-src/version.js
|
||||
var VERSION = "9.0.5";
|
||||
|
||||
// pkg/dist-src/defaults.js
|
||||
var userAgent = `octokit-endpoint.js/${VERSION} ${(0, import_universal_user_agent.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+$/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-]+(?=-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);
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
endpoint
|
||||
});
|
||||
7
node_modules/@octokit/endpoint/dist-node/index.js.map
generated
vendored
Normal file
7
node_modules/@octokit/endpoint/dist-node/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
17
node_modules/@octokit/endpoint/dist-src/defaults.js
generated
vendored
Normal file
17
node_modules/@octokit/endpoint/dist-src/defaults.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { getUserAgent } from "universal-user-agent";
|
||||
import { VERSION } from "./version";
|
||||
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
|
||||
};
|
||||
9
node_modules/@octokit/endpoint/dist-src/endpoint-with-defaults.js
generated
vendored
Normal file
9
node_modules/@octokit/endpoint/dist-src/endpoint-with-defaults.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { DEFAULTS } from "./defaults";
|
||||
import { merge } from "./merge";
|
||||
import { parse } from "./parse";
|
||||
function endpointWithDefaults(defaults, route, options) {
|
||||
return parse(merge(defaults, route, options));
|
||||
}
|
||||
export {
|
||||
endpointWithDefaults
|
||||
};
|
||||
6
node_modules/@octokit/endpoint/dist-src/index.js
generated
vendored
Normal file
6
node_modules/@octokit/endpoint/dist-src/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { withDefaults } from "./with-defaults";
|
||||
import { DEFAULTS } from "./defaults";
|
||||
const endpoint = withDefaults(null, DEFAULTS);
|
||||
export {
|
||||
endpoint
|
||||
};
|
||||
27
node_modules/@octokit/endpoint/dist-src/merge.js
generated
vendored
Normal file
27
node_modules/@octokit/endpoint/dist-src/merge.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { lowercaseKeys } from "./util/lowercase-keys";
|
||||
import { mergeDeep } from "./util/merge-deep";
|
||||
import { removeUndefinedProperties } from "./util/remove-undefined-properties";
|
||||
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/endpoint/dist-src/parse.js
generated
vendored
Normal file
70
node_modules/@octokit/endpoint/dist-src/parse.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
import { addQueryParameters } from "./util/add-query-parameters";
|
||||
import { extractUrlVariableNames } from "./util/extract-url-variable-names";
|
||||
import { omit } from "./util/omit";
|
||||
import { parseUrl } from "./util/url-template";
|
||||
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-]+(?=-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
|
||||
};
|
||||
16
node_modules/@octokit/endpoint/dist-src/util/add-query-parameters.js
generated
vendored
Normal file
16
node_modules/@octokit/endpoint/dist-src/util/add-query-parameters.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
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
|
||||
};
|
||||
14
node_modules/@octokit/endpoint/dist-src/util/extract-url-variable-names.js
generated
vendored
Normal file
14
node_modules/@octokit/endpoint/dist-src/util/extract-url-variable-names.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
const urlVariableRegex = /\{[^}]+\}/g;
|
||||
function removeNonChars(variableName) {
|
||||
return variableName.replace(/^\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
|
||||
};
|
||||
14
node_modules/@octokit/endpoint/dist-src/util/is-plain-object.js
generated
vendored
Normal file
14
node_modules/@octokit/endpoint/dist-src/util/is-plain-object.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
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
|
||||
};
|
||||
12
node_modules/@octokit/endpoint/dist-src/util/lowercase-keys.js
generated
vendored
Normal file
12
node_modules/@octokit/endpoint/dist-src/util/lowercase-keys.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
function lowercaseKeys(object) {
|
||||
if (!object) {
|
||||
return {};
|
||||
}
|
||||
return Object.keys(object).reduce((newObj, key) => {
|
||||
newObj[key.toLowerCase()] = object[key];
|
||||
return newObj;
|
||||
}, {});
|
||||
}
|
||||
export {
|
||||
lowercaseKeys
|
||||
};
|
||||
18
node_modules/@octokit/endpoint/dist-src/util/merge-deep.js
generated
vendored
Normal file
18
node_modules/@octokit/endpoint/dist-src/util/merge-deep.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { isPlainObject } from "./is-plain-object";
|
||||
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/endpoint/dist-src/util/omit.js
generated
vendored
Normal file
12
node_modules/@octokit/endpoint/dist-src/util/omit.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
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
|
||||
};
|
||||
11
node_modules/@octokit/endpoint/dist-src/util/remove-undefined-properties.js
generated
vendored
Normal file
11
node_modules/@octokit/endpoint/dist-src/util/remove-undefined-properties.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
function removeUndefinedProperties(obj) {
|
||||
for (const key in obj) {
|
||||
if (obj[key] === void 0) {
|
||||
delete obj[key];
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
export {
|
||||
removeUndefinedProperties
|
||||
};
|
||||
133
node_modules/@octokit/endpoint/dist-src/util/url-template.js
generated
vendored
Normal file
133
node_modules/@octokit/endpoint/dist-src/util/url-template.js
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
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/endpoint/dist-src/version.js
generated
vendored
Normal file
4
node_modules/@octokit/endpoint/dist-src/version.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
const VERSION = "9.0.5";
|
||||
export {
|
||||
VERSION
|
||||
};
|
||||
16
node_modules/@octokit/endpoint/dist-src/with-defaults.js
generated
vendored
Normal file
16
node_modules/@octokit/endpoint/dist-src/with-defaults.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { endpointWithDefaults } from "./endpoint-with-defaults";
|
||||
import { merge } from "./merge";
|
||||
import { parse } from "./parse";
|
||||
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
|
||||
};
|
||||
2
node_modules/@octokit/endpoint/dist-types/defaults.d.ts
generated
vendored
Normal file
2
node_modules/@octokit/endpoint/dist-types/defaults.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { EndpointDefaults } from "@octokit/types";
|
||||
export declare const DEFAULTS: EndpointDefaults;
|
||||
3
node_modules/@octokit/endpoint/dist-types/endpoint-with-defaults.d.ts
generated
vendored
Normal file
3
node_modules/@octokit/endpoint/dist-types/endpoint-with-defaults.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { EndpointOptions, RequestParameters, Route } from "@octokit/types";
|
||||
import { DEFAULTS } from "./defaults";
|
||||
export declare function endpointWithDefaults(defaults: typeof DEFAULTS, route: Route | EndpointOptions, options?: RequestParameters): import("@octokit/types").RequestOptions;
|
||||
1
node_modules/@octokit/endpoint/dist-types/index.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/endpoint/dist-types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare const endpoint: import("@octokit/types").EndpointInterface<object>;
|
||||
2
node_modules/@octokit/endpoint/dist-types/merge.d.ts
generated
vendored
Normal file
2
node_modules/@octokit/endpoint/dist-types/merge.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
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/endpoint/dist-types/parse.d.ts
generated
vendored
Normal file
2
node_modules/@octokit/endpoint/dist-types/parse.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { EndpointDefaults, RequestOptions } from "@octokit/types";
|
||||
export declare function parse(options: EndpointDefaults): RequestOptions;
|
||||
4
node_modules/@octokit/endpoint/dist-types/util/add-query-parameters.d.ts
generated
vendored
Normal file
4
node_modules/@octokit/endpoint/dist-types/util/add-query-parameters.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export declare function addQueryParameters(url: string, parameters: {
|
||||
[x: string]: string | undefined;
|
||||
q?: string;
|
||||
}): string;
|
||||
1
node_modules/@octokit/endpoint/dist-types/util/extract-url-variable-names.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/endpoint/dist-types/util/extract-url-variable-names.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function extractUrlVariableNames(url: string): string[];
|
||||
1
node_modules/@octokit/endpoint/dist-types/util/is-plain-object.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/endpoint/dist-types/util/is-plain-object.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function isPlainObject(value: unknown): value is Object;
|
||||
5
node_modules/@octokit/endpoint/dist-types/util/lowercase-keys.d.ts
generated
vendored
Normal file
5
node_modules/@octokit/endpoint/dist-types/util/lowercase-keys.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export declare function lowercaseKeys(object?: {
|
||||
[key: string]: any;
|
||||
}): {
|
||||
[key: string]: any;
|
||||
};
|
||||
1
node_modules/@octokit/endpoint/dist-types/util/merge-deep.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/endpoint/dist-types/util/merge-deep.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function mergeDeep(defaults: any, options: any): object;
|
||||
5
node_modules/@octokit/endpoint/dist-types/util/omit.d.ts
generated
vendored
Normal file
5
node_modules/@octokit/endpoint/dist-types/util/omit.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export declare function omit(object: {
|
||||
[key: string]: any;
|
||||
}, keysToOmit: string[]): {
|
||||
[key: string]: any;
|
||||
};
|
||||
1
node_modules/@octokit/endpoint/dist-types/util/remove-undefined-properties.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/endpoint/dist-types/util/remove-undefined-properties.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function removeUndefinedProperties(obj: any): any;
|
||||
3
node_modules/@octokit/endpoint/dist-types/util/url-template.d.ts
generated
vendored
Normal file
3
node_modules/@octokit/endpoint/dist-types/util/url-template.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export declare function parseUrl(template: string): {
|
||||
expand: (context: object) => string;
|
||||
};
|
||||
1
node_modules/@octokit/endpoint/dist-types/version.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/endpoint/dist-types/version.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare const VERSION = "9.0.5";
|
||||
2
node_modules/@octokit/endpoint/dist-types/with-defaults.d.ts
generated
vendored
Normal file
2
node_modules/@octokit/endpoint/dist-types/with-defaults.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { EndpointInterface, RequestParameters, EndpointDefaults } from "@octokit/types";
|
||||
export declare function withDefaults(oldDefaults: EndpointDefaults | null, newDefaults: RequestParameters): EndpointInterface;
|
||||
351
node_modules/@octokit/endpoint/dist-web/index.js
generated
vendored
Normal file
351
node_modules/@octokit/endpoint/dist-web/index.js
generated
vendored
Normal file
@@ -0,0 +1,351 @@
|
||||
// pkg/dist-src/defaults.js
|
||||
import { getUserAgent } from "universal-user-agent";
|
||||
|
||||
// pkg/dist-src/version.js
|
||||
var VERSION = "9.0.5";
|
||||
|
||||
// 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+$/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-]+(?=-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
|
||||
};
|
||||
7
node_modules/@octokit/endpoint/dist-web/index.js.map
generated
vendored
Normal file
7
node_modules/@octokit/endpoint/dist-web/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
45
node_modules/@octokit/endpoint/package.json
generated
vendored
Normal file
45
node_modules/@octokit/endpoint/package.json
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "@octokit/endpoint",
|
||||
"version": "9.0.5",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"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": "^2.0.0",
|
||||
"@types/jest": "^29.0.0",
|
||||
"esbuild": "^0.19.0",
|
||||
"glob": "^10.2.7",
|
||||
"jest": "^29.0.0",
|
||||
"prettier": "3.1.0",
|
||||
"semantic-release": "^22.0.0",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||
"ts-jest": "^29.0.0",
|
||||
"typescript": "^5.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@octokit/types": "^13.1.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"files": [
|
||||
"dist-*/**",
|
||||
"bin/**"
|
||||
],
|
||||
"main": "dist-node/index.js",
|
||||
"browser": "dist-web/index.js",
|
||||
"types": "dist-types/index.d.ts",
|
||||
"module": "dist-src/index.js",
|
||||
"sideEffects": false
|
||||
}
|
||||
21
node_modules/@octokit/graphql/LICENSE
generated
vendored
Normal file
21
node_modules/@octokit/graphql/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
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.
|
||||
409
node_modules/@octokit/graphql/README.md
generated
vendored
Normal file
409
node_modules/@octokit/graphql/README.md
generated
vendored
Normal file
@@ -0,0 +1,409 @@
|
||||
# graphql.js
|
||||
|
||||
> GitHub GraphQL API client for browsers and Node
|
||||
|
||||
[](https://www.npmjs.com/package/@octokit/graphql)
|
||||
[](https://github.com/octokit/graphql.js/actions?query=workflow%3ATest+branch%3Amain)
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Usage](#usage)
|
||||
- [Send a simple query](#send-a-simple-query)
|
||||
- [Authentication](#authentication)
|
||||
- [Variables](#variables)
|
||||
- [Pass query together with headers and variables](#pass-query-together-with-headers-and-variables)
|
||||
- [Use with GitHub Enterprise](#use-with-github-enterprise)
|
||||
- [Use custom `@octokit/request` instance](#use-custom-octokitrequest-instance)
|
||||
- [TypeScript](#typescript)
|
||||
- [Additional Types](#additional-types)
|
||||
- [Errors](#errors)
|
||||
- [Partial responses](#partial-responses)
|
||||
- [Writing tests](#writing-tests)
|
||||
- [License](#license)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
## Usage
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
|
||||
Load `@octokit/graphql` directly from [esm.sh](https://esm.sh)
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { graphql } from "https://esm.sh/@octokit/graphql";
|
||||
</script>
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Node
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install @octokit/graphql</code>
|
||||
|
||||
```js
|
||||
const { graphql } = require("@octokit/graphql");
|
||||
// or: import { graphql } from "@octokit/graphql";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
### Send a simple query
|
||||
|
||||
```js
|
||||
const { repository } = await graphql(
|
||||
`
|
||||
{
|
||||
repository(owner: "octokit", name: "graphql.js") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
{
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
},
|
||||
);
|
||||
```
|
||||
|
||||
### Authentication
|
||||
|
||||
The simplest way to authenticate a request is to set the `Authorization` header, e.g. to a [personal access token](https://github.com/settings/tokens/).
|
||||
|
||||
```js
|
||||
const graphqlWithAuth = graphql.defaults({
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
});
|
||||
const { repository } = await graphqlWithAuth(`
|
||||
{
|
||||
repository(owner: "octokit", name: "graphql.js") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`);
|
||||
```
|
||||
|
||||
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
|
||||
const { createAppAuth } = require("@octokit/auth-app");
|
||||
const auth = createAppAuth({
|
||||
appId: process.env.APP_ID,
|
||||
privateKey: process.env.PRIVATE_KEY,
|
||||
installationId: 123,
|
||||
});
|
||||
const graphqlWithAuth = graphql.defaults({
|
||||
request: {
|
||||
hook: auth.hook,
|
||||
},
|
||||
});
|
||||
|
||||
const { repository } = await graphqlWithAuth(
|
||||
`{
|
||||
repository(owner: "octokit", name: "graphql.js") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`,
|
||||
);
|
||||
```
|
||||
|
||||
### Variables
|
||||
|
||||
⚠️ Do not use [template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) in the query strings as they make your code vulnerable to query injection attacks (see [#2](https://github.com/octokit/graphql.js/issues/2)). Use variables instead:
|
||||
|
||||
```js
|
||||
const { lastIssues } = await graphql(
|
||||
`
|
||||
query lastIssues($owner: String!, $repo: String!, $num: Int = 3) {
|
||||
repository(owner: $owner, name: $repo) {
|
||||
issues(last: $num) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
{
|
||||
owner: "octokit",
|
||||
repo: "graphql.js",
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
},
|
||||
);
|
||||
```
|
||||
|
||||
### Pass query together with headers and variables
|
||||
|
||||
```js
|
||||
const { graphql } = require("@octokit/graphql");
|
||||
const { lastIssues } = await graphql({
|
||||
query: `query lastIssues($owner: String!, $repo: String!, $num: Int = 3) {
|
||||
repository(owner:$owner, name:$repo) {
|
||||
issues(last:$num) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`,
|
||||
owner: "octokit",
|
||||
repo: "graphql.js",
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
### Use with GitHub Enterprise
|
||||
|
||||
```js
|
||||
let { graphql } = require("@octokit/graphql");
|
||||
graphql = graphql.defaults({
|
||||
baseUrl: "https://github-enterprise.acme-inc.com/api",
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
});
|
||||
const { repository } = await graphql(`
|
||||
{
|
||||
repository(owner: "acme-project", name: "acme-repo") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`);
|
||||
```
|
||||
|
||||
### Use custom `@octokit/request` instance
|
||||
|
||||
```js
|
||||
const { request } = require("@octokit/request");
|
||||
const { withCustomRequest } = require("@octokit/graphql");
|
||||
|
||||
let requestCounter = 0;
|
||||
const myRequest = request.defaults({
|
||||
headers: {
|
||||
authorization: "bearer secret123",
|
||||
},
|
||||
request: {
|
||||
hook(request, options) {
|
||||
requestCounter++;
|
||||
return request(options);
|
||||
},
|
||||
},
|
||||
});
|
||||
const myGraphql = withCustomRequest(myRequest);
|
||||
await request("/");
|
||||
await myGraphql(`
|
||||
{
|
||||
repository(owner: "acme-project", name: "acme-repo") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`);
|
||||
// requestCounter is now 2
|
||||
```
|
||||
|
||||
## TypeScript
|
||||
|
||||
`@octokit/graphql` is exposing proper types for its usage with TypeScript projects.
|
||||
|
||||
### Additional Types
|
||||
|
||||
Additionally, `GraphQlQueryResponseData` has been exposed to users:
|
||||
|
||||
```ts
|
||||
import type { GraphQlQueryResponseData } from "@octokit/graphql";
|
||||
```
|
||||
|
||||
## Errors
|
||||
|
||||
In case of a GraphQL error, `error.message` is set to a combined message describing all errors returned by the endpoint.
|
||||
All errors can be accessed at `error.errors`. `error.request` has the request options such as query, variables and headers set for easier debugging.
|
||||
|
||||
```js
|
||||
let { graphql, GraphqlResponseError } = require("@octokit/graphql");
|
||||
graphql = graphql.defaults({
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
});
|
||||
const query = `{
|
||||
viewer {
|
||||
bioHtml
|
||||
}
|
||||
}`;
|
||||
|
||||
try {
|
||||
const result = await graphql(query);
|
||||
} catch (error) {
|
||||
if (error instanceof GraphqlResponseError) {
|
||||
// do something with the error, allowing you to detect a graphql response error,
|
||||
// compared to accidentally catching unrelated errors.
|
||||
|
||||
// server responds with an object like the following (as an example)
|
||||
// class GraphqlResponseError {
|
||||
// "headers": {
|
||||
// "status": "403",
|
||||
// },
|
||||
// "data": null,
|
||||
// "errors": [{
|
||||
// "message": "Field 'bioHtml' doesn't exist on type 'User'",
|
||||
// "locations": [{
|
||||
// "line": 3,
|
||||
// "column": 5
|
||||
// }]
|
||||
// }]
|
||||
// }
|
||||
|
||||
console.log("Request failed:", error.request); // { query, variables: {}, headers: { authorization: 'token secret123' } }
|
||||
console.log(error.message); // Field 'bioHtml' doesn't exist on type 'User'
|
||||
} else {
|
||||
// handle non-GraphQL error
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Partial responses
|
||||
|
||||
A GraphQL query may respond with partial data accompanied by errors. In this case we will throw an error but the partial data will still be accessible through `error.data`
|
||||
|
||||
```js
|
||||
let { graphql } = require("@octokit/graphql");
|
||||
graphql = graphql.defaults({
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
});
|
||||
const query = `{
|
||||
repository(name: "probot", owner: "probot") {
|
||||
name
|
||||
ref(qualifiedName: "master") {
|
||||
target {
|
||||
... on Commit {
|
||||
history(first: 25, after: "invalid cursor") {
|
||||
nodes {
|
||||
message
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`;
|
||||
|
||||
try {
|
||||
const result = await graphql(query);
|
||||
} catch (error) {
|
||||
// server responds with
|
||||
// {
|
||||
// "data": {
|
||||
// "repository": {
|
||||
// "name": "probot",
|
||||
// "ref": null
|
||||
// }
|
||||
// },
|
||||
// "errors": [
|
||||
// {
|
||||
// "type": "INVALID_CURSOR_ARGUMENTS",
|
||||
// "path": [
|
||||
// "repository",
|
||||
// "ref",
|
||||
// "target",
|
||||
// "history"
|
||||
// ],
|
||||
// "locations": [
|
||||
// {
|
||||
// "line": 7,
|
||||
// "column": 11
|
||||
// }
|
||||
// ],
|
||||
// "message": "`invalid cursor` does not appear to be a valid cursor."
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
|
||||
console.log("Request failed:", error.request); // { query, variables: {}, headers: { authorization: 'token secret123' } }
|
||||
console.log(error.message); // `invalid cursor` does not appear to be a valid cursor.
|
||||
console.log(error.data); // { repository: { name: 'probot', ref: null } }
|
||||
}
|
||||
```
|
||||
|
||||
## Writing tests
|
||||
|
||||
You can pass a replacement for [the built-in fetch implementation](https://github.com/bitinn/node-fetch) as `request.fetch` option. For example, using [fetch-mock](http://www.wheresrhys.co.uk/fetch-mock/) works great to write tests
|
||||
|
||||
```js
|
||||
const assert = require("assert");
|
||||
const fetchMock = require("fetch-mock/es5/server");
|
||||
|
||||
const { graphql } = require("@octokit/graphql");
|
||||
|
||||
graphql("{ viewer { login } }", {
|
||||
headers: {
|
||||
authorization: "token secret123",
|
||||
},
|
||||
request: {
|
||||
fetch: fetchMock
|
||||
.sandbox()
|
||||
.post("https://api.github.com/graphql", (url, options) => {
|
||||
assert.strictEqual(options.headers.authorization, "token secret123");
|
||||
assert.strictEqual(
|
||||
options.body,
|
||||
'{"query":"{ viewer { login } }"}',
|
||||
"Sends correct query",
|
||||
);
|
||||
return { data: {} };
|
||||
}),
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
154
node_modules/@octokit/graphql/dist-node/index.js
generated
vendored
Normal file
154
node_modules/@octokit/graphql/dist-node/index.js
generated
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var dist_src_exports = {};
|
||||
__export(dist_src_exports, {
|
||||
GraphqlResponseError: () => GraphqlResponseError,
|
||||
graphql: () => graphql2,
|
||||
withCustomRequest: () => withCustomRequest
|
||||
});
|
||||
module.exports = __toCommonJS(dist_src_exports);
|
||||
var import_request3 = require("@octokit/request");
|
||||
var import_universal_user_agent = require("universal-user-agent");
|
||||
|
||||
// pkg/dist-src/version.js
|
||||
var VERSION = "7.1.0";
|
||||
|
||||
// pkg/dist-src/with-defaults.js
|
||||
var import_request2 = require("@octokit/request");
|
||||
|
||||
// pkg/dist-src/graphql.js
|
||||
var import_request = require("@octokit/request");
|
||||
|
||||
// pkg/dist-src/error.js
|
||||
function _buildMessageForResponseErrors(data) {
|
||||
return `Request failed due to following response errors:
|
||||
` + data.errors.map((e) => ` - ${e.message}`).join("\n");
|
||||
}
|
||||
var GraphqlResponseError = class extends Error {
|
||||
constructor(request2, headers, response) {
|
||||
super(_buildMessageForResponseErrors(response));
|
||||
this.request = request2;
|
||||
this.headers = headers;
|
||||
this.response = response;
|
||||
this.name = "GraphqlResponseError";
|
||||
this.errors = response.errors;
|
||||
this.data = response.data;
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// pkg/dist-src/graphql.js
|
||||
var NON_VARIABLE_OPTIONS = [
|
||||
"method",
|
||||
"baseUrl",
|
||||
"url",
|
||||
"headers",
|
||||
"request",
|
||||
"query",
|
||||
"mediaType"
|
||||
];
|
||||
var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"];
|
||||
var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
|
||||
function graphql(request2, query, options) {
|
||||
if (options) {
|
||||
if (typeof query === "string" && "query" in options) {
|
||||
return Promise.reject(
|
||||
new Error(`[@octokit/graphql] "query" cannot be used as variable name`)
|
||||
);
|
||||
}
|
||||
for (const key in options) {
|
||||
if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key))
|
||||
continue;
|
||||
return Promise.reject(
|
||||
new Error(
|
||||
`[@octokit/graphql] "${key}" cannot be used as variable name`
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
const parsedOptions = typeof query === "string" ? Object.assign({ query }, options) : query;
|
||||
const requestOptions = Object.keys(
|
||||
parsedOptions
|
||||
).reduce((result, key) => {
|
||||
if (NON_VARIABLE_OPTIONS.includes(key)) {
|
||||
result[key] = parsedOptions[key];
|
||||
return result;
|
||||
}
|
||||
if (!result.variables) {
|
||||
result.variables = {};
|
||||
}
|
||||
result.variables[key] = parsedOptions[key];
|
||||
return result;
|
||||
}, {});
|
||||
const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl;
|
||||
if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) {
|
||||
requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql");
|
||||
}
|
||||
return request2(requestOptions).then((response) => {
|
||||
if (response.data.errors) {
|
||||
const headers = {};
|
||||
for (const key of Object.keys(response.headers)) {
|
||||
headers[key] = response.headers[key];
|
||||
}
|
||||
throw new GraphqlResponseError(
|
||||
requestOptions,
|
||||
headers,
|
||||
response.data
|
||||
);
|
||||
}
|
||||
return response.data.data;
|
||||
});
|
||||
}
|
||||
|
||||
// pkg/dist-src/with-defaults.js
|
||||
function withDefaults(request2, newDefaults) {
|
||||
const newRequest = request2.defaults(newDefaults);
|
||||
const newApi = (query, options) => {
|
||||
return graphql(newRequest, query, options);
|
||||
};
|
||||
return Object.assign(newApi, {
|
||||
defaults: withDefaults.bind(null, newRequest),
|
||||
endpoint: newRequest.endpoint
|
||||
});
|
||||
}
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var graphql2 = withDefaults(import_request3.request, {
|
||||
headers: {
|
||||
"user-agent": `octokit-graphql.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
|
||||
},
|
||||
method: "POST",
|
||||
url: "/graphql"
|
||||
});
|
||||
function withCustomRequest(customRequest) {
|
||||
return withDefaults(customRequest, {
|
||||
method: "POST",
|
||||
url: "/graphql"
|
||||
});
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
GraphqlResponseError,
|
||||
graphql,
|
||||
withCustomRequest
|
||||
});
|
||||
7
node_modules/@octokit/graphql/dist-node/index.js.map
generated
vendored
Normal file
7
node_modules/@octokit/graphql/dist-node/index.js.map
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../dist-src/index.js", "../dist-src/version.js", "../dist-src/with-defaults.js", "../dist-src/graphql.js", "../dist-src/error.js"],
|
||||
"sourcesContent": ["import { request } from \"@octokit/request\";\nimport { getUserAgent } from \"universal-user-agent\";\nimport { VERSION } from \"./version\";\nimport { withDefaults } from \"./with-defaults\";\nconst graphql = withDefaults(request, {\n headers: {\n \"user-agent\": `octokit-graphql.js/${VERSION} ${getUserAgent()}`\n },\n method: \"POST\",\n url: \"/graphql\"\n});\nimport { GraphqlResponseError } from \"./error\";\nfunction withCustomRequest(customRequest) {\n return withDefaults(customRequest, {\n method: \"POST\",\n url: \"/graphql\"\n });\n}\nexport {\n GraphqlResponseError,\n graphql,\n withCustomRequest\n};\n", "const VERSION = \"7.1.0\";\nexport {\n VERSION\n};\n", "import { request as Request } from \"@octokit/request\";\nimport { graphql } from \"./graphql\";\nfunction withDefaults(request, newDefaults) {\n const newRequest = request.defaults(newDefaults);\n const newApi = (query, options) => {\n return graphql(newRequest, query, options);\n };\n return Object.assign(newApi, {\n defaults: withDefaults.bind(null, newRequest),\n endpoint: newRequest.endpoint\n });\n}\nexport {\n withDefaults\n};\n", "import { request as Request } from \"@octokit/request\";\nimport { GraphqlResponseError } from \"./error\";\nconst NON_VARIABLE_OPTIONS = [\n \"method\",\n \"baseUrl\",\n \"url\",\n \"headers\",\n \"request\",\n \"query\",\n \"mediaType\"\n];\nconst FORBIDDEN_VARIABLE_OPTIONS = [\"query\", \"method\", \"url\"];\nconst GHES_V3_SUFFIX_REGEX = /\\/api\\/v3\\/?$/;\nfunction graphql(request, query, options) {\n if (options) {\n if (typeof query === \"string\" && \"query\" in options) {\n return Promise.reject(\n new Error(`[@octokit/graphql] \"query\" cannot be used as variable name`)\n );\n }\n for (const key in options) {\n if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key))\n continue;\n return Promise.reject(\n new Error(\n `[@octokit/graphql] \"${key}\" cannot be used as variable name`\n )\n );\n }\n }\n const parsedOptions = typeof query === \"string\" ? Object.assign({ query }, options) : query;\n const requestOptions = Object.keys(\n parsedOptions\n ).reduce((result, key) => {\n if (NON_VARIABLE_OPTIONS.includes(key)) {\n result[key] = parsedOptions[key];\n return result;\n }\n if (!result.variables) {\n result.variables = {};\n }\n result.variables[key] = parsedOptions[key];\n return result;\n }, {});\n const baseUrl = parsedOptions.baseUrl || request.endpoint.DEFAULTS.baseUrl;\n if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) {\n requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, \"/api/graphql\");\n }\n return request(requestOptions).then((response) => {\n if (response.data.errors) {\n const headers = {};\n for (const key of Object.keys(response.headers)) {\n headers[key] = response.headers[key];\n }\n throw new GraphqlResponseError(\n requestOptions,\n headers,\n response.data\n );\n }\n return response.data.data;\n });\n}\nexport {\n graphql\n};\n", "function _buildMessageForResponseErrors(data) {\n return `Request failed due to following response errors:\n` + data.errors.map((e) => ` - ${e.message}`).join(\"\\n\");\n}\nclass GraphqlResponseError extends Error {\n constructor(request, headers, response) {\n super(_buildMessageForResponseErrors(response));\n this.request = request;\n this.headers = headers;\n this.response = response;\n this.name = \"GraphqlResponseError\";\n this.errors = response.errors;\n this.data = response.data;\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n}\nexport {\n GraphqlResponseError\n};\n"],
|
||||
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,iBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA,IAAAC,kBAAwB;AACxB,kCAA6B;;;ACD7B,IAAM,UAAU;;;ACAhB,IAAAC,kBAAmC;;;ACAnC,qBAAmC;;;ACAnC,SAAS,+BAA+B,MAAM;AAC5C,SAAO;AAAA,IACL,KAAK,OAAO,IAAI,CAAC,MAAM,MAAM,EAAE,OAAO,EAAE,EAAE,KAAK,IAAI;AACvD;AACA,IAAM,uBAAN,cAAmC,MAAM;AAAA,EACvC,YAAYC,UAAS,SAAS,UAAU;AACtC,UAAM,+BAA+B,QAAQ,CAAC;AAC9C,SAAK,UAAUA;AACf,SAAK,UAAU;AACf,SAAK,WAAW;AAChB,SAAK,OAAO;AACZ,SAAK,SAAS,SAAS;AACvB,SAAK,OAAO,SAAS;AACrB,QAAI,MAAM,mBAAmB;AAC3B,YAAM,kBAAkB,MAAM,KAAK,WAAW;AAAA,IAChD;AAAA,EACF;AACF;;;ADfA,IAAM,uBAAuB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,IAAM,6BAA6B,CAAC,SAAS,UAAU,KAAK;AAC5D,IAAM,uBAAuB;AAC7B,SAAS,QAAQC,UAAS,OAAO,SAAS;AACxC,MAAI,SAAS;AACX,QAAI,OAAO,UAAU,YAAY,WAAW,SAAS;AACnD,aAAO,QAAQ;AAAA,QACb,IAAI,MAAM,4DAA4D;AAAA,MACxE;AAAA,IACF;AACA,eAAW,OAAO,SAAS;AACzB,UAAI,CAAC,2BAA2B,SAAS,GAAG;AAC1C;AACF,aAAO,QAAQ;AAAA,QACb,IAAI;AAAA,UACF,uBAAuB,GAAG;AAAA,QAC5B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,QAAM,gBAAgB,OAAO,UAAU,WAAW,OAAO,OAAO,EAAE,MAAM,GAAG,OAAO,IAAI;AACtF,QAAM,iBAAiB,OAAO;AAAA,IAC5B;AAAA,EACF,EAAE,OAAO,CAAC,QAAQ,QAAQ;AACxB,QAAI,qBAAqB,SAAS,GAAG,GAAG;AACtC,aAAO,GAAG,IAAI,cAAc,GAAG;AAC/B,aAAO;AAAA,IACT;AACA,QAAI,CAAC,OAAO,WAAW;AACrB,aAAO,YAAY,CAAC;AAAA,IACtB;AACA,WAAO,UAAU,GAAG,IAAI,cAAc,GAAG;AACzC,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACL,QAAM,UAAU,cAAc,WAAWA,SAAQ,SAAS,SAAS;AACnE,MAAI,qBAAqB,KAAK,OAAO,GAAG;AACtC,mBAAe,MAAM,QAAQ,QAAQ,sBAAsB,cAAc;AAAA,EAC3E;AACA,SAAOA,SAAQ,cAAc,EAAE,KAAK,CAAC,aAAa;AAChD,QAAI,SAAS,KAAK,QAAQ;AACxB,YAAM,UAAU,CAAC;AACjB,iBAAW,OAAO,OAAO,KAAK,SAAS,OAAO,GAAG;AAC/C,gBAAQ,GAAG,IAAI,SAAS,QAAQ,GAAG;AAAA,MACrC;AACA,YAAM,IAAI;AAAA,QACR;AAAA,QACA;AAAA,QACA,SAAS;AAAA,MACX;AAAA,IACF;AACA,WAAO,SAAS,KAAK;AAAA,EACvB,CAAC;AACH;;;AD5DA,SAAS,aAAaC,UAAS,aAAa;AAC1C,QAAM,aAAaA,SAAQ,SAAS,WAAW;AAC/C,QAAM,SAAS,CAAC,OAAO,YAAY;AACjC,WAAO,QAAQ,YAAY,OAAO,OAAO;AAAA,EAC3C;AACA,SAAO,OAAO,OAAO,QAAQ;AAAA,IAC3B,UAAU,aAAa,KAAK,MAAM,UAAU;AAAA,IAC5C,UAAU,WAAW;AAAA,EACvB,CAAC;AACH;;;AFPA,IAAMC,WAAU,aAAa,yBAAS;AAAA,EACpC,SAAS;AAAA,IACP,cAAc,sBAAsB,OAAO,QAAI,0CAAa,CAAC;AAAA,EAC/D;AAAA,EACA,QAAQ;AAAA,EACR,KAAK;AACP,CAAC;AAED,SAAS,kBAAkB,eAAe;AACxC,SAAO,aAAa,eAAe;AAAA,IACjC,QAAQ;AAAA,IACR,KAAK;AAAA,EACP,CAAC;AACH;",
|
||||
"names": ["graphql", "import_request", "import_request", "request", "request", "request", "graphql"]
|
||||
}
|
||||
21
node_modules/@octokit/graphql/dist-src/error.js
generated
vendored
Normal file
21
node_modules/@octokit/graphql/dist-src/error.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
function _buildMessageForResponseErrors(data) {
|
||||
return `Request failed due to following response errors:
|
||||
` + data.errors.map((e) => ` - ${e.message}`).join("\n");
|
||||
}
|
||||
class GraphqlResponseError extends Error {
|
||||
constructor(request, headers, response) {
|
||||
super(_buildMessageForResponseErrors(response));
|
||||
this.request = request;
|
||||
this.headers = headers;
|
||||
this.response = response;
|
||||
this.name = "GraphqlResponseError";
|
||||
this.errors = response.errors;
|
||||
this.data = response.data;
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
}
|
||||
export {
|
||||
GraphqlResponseError
|
||||
};
|
||||
66
node_modules/@octokit/graphql/dist-src/graphql.js
generated
vendored
Normal file
66
node_modules/@octokit/graphql/dist-src/graphql.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
import { request as Request } from "@octokit/request";
|
||||
import { GraphqlResponseError } from "./error";
|
||||
const NON_VARIABLE_OPTIONS = [
|
||||
"method",
|
||||
"baseUrl",
|
||||
"url",
|
||||
"headers",
|
||||
"request",
|
||||
"query",
|
||||
"mediaType"
|
||||
];
|
||||
const FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"];
|
||||
const GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
|
||||
function graphql(request, query, options) {
|
||||
if (options) {
|
||||
if (typeof query === "string" && "query" in options) {
|
||||
return Promise.reject(
|
||||
new Error(`[@octokit/graphql] "query" cannot be used as variable name`)
|
||||
);
|
||||
}
|
||||
for (const key in options) {
|
||||
if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key))
|
||||
continue;
|
||||
return Promise.reject(
|
||||
new Error(
|
||||
`[@octokit/graphql] "${key}" cannot be used as variable name`
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
const parsedOptions = typeof query === "string" ? Object.assign({ query }, options) : query;
|
||||
const requestOptions = Object.keys(
|
||||
parsedOptions
|
||||
).reduce((result, key) => {
|
||||
if (NON_VARIABLE_OPTIONS.includes(key)) {
|
||||
result[key] = parsedOptions[key];
|
||||
return result;
|
||||
}
|
||||
if (!result.variables) {
|
||||
result.variables = {};
|
||||
}
|
||||
result.variables[key] = parsedOptions[key];
|
||||
return result;
|
||||
}, {});
|
||||
const baseUrl = parsedOptions.baseUrl || request.endpoint.DEFAULTS.baseUrl;
|
||||
if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) {
|
||||
requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql");
|
||||
}
|
||||
return request(requestOptions).then((response) => {
|
||||
if (response.data.errors) {
|
||||
const headers = {};
|
||||
for (const key of Object.keys(response.headers)) {
|
||||
headers[key] = response.headers[key];
|
||||
}
|
||||
throw new GraphqlResponseError(
|
||||
requestOptions,
|
||||
headers,
|
||||
response.data
|
||||
);
|
||||
}
|
||||
return response.data.data;
|
||||
});
|
||||
}
|
||||
export {
|
||||
graphql
|
||||
};
|
||||
23
node_modules/@octokit/graphql/dist-src/index.js
generated
vendored
Normal file
23
node_modules/@octokit/graphql/dist-src/index.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import { request } from "@octokit/request";
|
||||
import { getUserAgent } from "universal-user-agent";
|
||||
import { VERSION } from "./version";
|
||||
import { withDefaults } from "./with-defaults";
|
||||
const graphql = withDefaults(request, {
|
||||
headers: {
|
||||
"user-agent": `octokit-graphql.js/${VERSION} ${getUserAgent()}`
|
||||
},
|
||||
method: "POST",
|
||||
url: "/graphql"
|
||||
});
|
||||
import { GraphqlResponseError } from "./error";
|
||||
function withCustomRequest(customRequest) {
|
||||
return withDefaults(customRequest, {
|
||||
method: "POST",
|
||||
url: "/graphql"
|
||||
});
|
||||
}
|
||||
export {
|
||||
GraphqlResponseError,
|
||||
graphql,
|
||||
withCustomRequest
|
||||
};
|
||||
4
node_modules/@octokit/graphql/dist-src/version.js
generated
vendored
Normal file
4
node_modules/@octokit/graphql/dist-src/version.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
const VERSION = "7.1.0";
|
||||
export {
|
||||
VERSION
|
||||
};
|
||||
15
node_modules/@octokit/graphql/dist-src/with-defaults.js
generated
vendored
Normal file
15
node_modules/@octokit/graphql/dist-src/with-defaults.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { request as Request } from "@octokit/request";
|
||||
import { graphql } from "./graphql";
|
||||
function withDefaults(request, newDefaults) {
|
||||
const newRequest = request.defaults(newDefaults);
|
||||
const newApi = (query, options) => {
|
||||
return graphql(newRequest, query, options);
|
||||
};
|
||||
return Object.assign(newApi, {
|
||||
defaults: withDefaults.bind(null, newRequest),
|
||||
endpoint: newRequest.endpoint
|
||||
});
|
||||
}
|
||||
export {
|
||||
withDefaults
|
||||
};
|
||||
13
node_modules/@octokit/graphql/dist-types/error.d.ts
generated
vendored
Normal file
13
node_modules/@octokit/graphql/dist-types/error.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { ResponseHeaders } from "@octokit/types";
|
||||
import type { GraphQlEndpointOptions, GraphQlQueryResponse } from "./types";
|
||||
type ServerResponseData<T> = Required<GraphQlQueryResponse<T>>;
|
||||
export declare class GraphqlResponseError<ResponseData> extends Error {
|
||||
readonly request: GraphQlEndpointOptions;
|
||||
readonly headers: ResponseHeaders;
|
||||
readonly response: ServerResponseData<ResponseData>;
|
||||
name: string;
|
||||
readonly errors: GraphQlQueryResponse<never>["errors"];
|
||||
readonly data: ResponseData;
|
||||
constructor(request: GraphQlEndpointOptions, headers: ResponseHeaders, response: ServerResponseData<ResponseData>);
|
||||
}
|
||||
export {};
|
||||
3
node_modules/@octokit/graphql/dist-types/graphql.d.ts
generated
vendored
Normal file
3
node_modules/@octokit/graphql/dist-types/graphql.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { request as Request } from "@octokit/request";
|
||||
import type { RequestParameters, GraphQlQueryResponseData } from "./types";
|
||||
export declare function graphql<ResponseData = GraphQlQueryResponseData>(request: typeof Request, query: string | RequestParameters, options?: RequestParameters): Promise<ResponseData>;
|
||||
5
node_modules/@octokit/graphql/dist-types/index.d.ts
generated
vendored
Normal file
5
node_modules/@octokit/graphql/dist-types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { request } from "@octokit/request";
|
||||
export declare const graphql: import("./types").graphql;
|
||||
export type { GraphQlQueryResponseData } from "./types";
|
||||
export { GraphqlResponseError } from "./error";
|
||||
export declare function withCustomRequest(customRequest: typeof request): import("./types").graphql;
|
||||
55
node_modules/@octokit/graphql/dist-types/types.d.ts
generated
vendored
Normal file
55
node_modules/@octokit/graphql/dist-types/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
import type { EndpointOptions, RequestParameters as RequestParametersType, EndpointInterface } from "@octokit/types";
|
||||
export type GraphQlEndpointOptions = EndpointOptions & {
|
||||
variables?: {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
};
|
||||
export type RequestParameters = RequestParametersType;
|
||||
export type Query = string;
|
||||
export interface graphql {
|
||||
/**
|
||||
* Sends a GraphQL query request based on endpoint options
|
||||
* The GraphQL query must be specified in `options`.
|
||||
*
|
||||
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||
*/
|
||||
<ResponseData>(options: RequestParameters): GraphQlResponse<ResponseData>;
|
||||
/**
|
||||
* Sends a GraphQL query request based on endpoint options
|
||||
*
|
||||
* @param {string} query GraphQL query. Example: `'query { viewer { login } }'`.
|
||||
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||
*/
|
||||
<ResponseData>(query: Query, parameters?: RequestParameters): GraphQlResponse<ResponseData>;
|
||||
/**
|
||||
* Returns a new `endpoint` with updated route and parameters
|
||||
*/
|
||||
defaults: (newDefaults: RequestParameters) => graphql;
|
||||
/**
|
||||
* Octokit endpoint API, see {@link https://github.com/octokit/endpoint.js|@octokit/endpoint}
|
||||
*/
|
||||
endpoint: EndpointInterface;
|
||||
}
|
||||
export type GraphQlResponse<ResponseData> = Promise<ResponseData>;
|
||||
export type GraphQlQueryResponseData = {
|
||||
[key: string]: any;
|
||||
};
|
||||
export type GraphQlQueryResponse<ResponseData> = {
|
||||
data: ResponseData;
|
||||
errors?: [
|
||||
{
|
||||
type: string;
|
||||
message: string;
|
||||
path: [string];
|
||||
extensions: {
|
||||
[key: string]: any;
|
||||
};
|
||||
locations: [
|
||||
{
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
1
node_modules/@octokit/graphql/dist-types/version.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/graphql/dist-types/version.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare const VERSION = "7.1.0";
|
||||
3
node_modules/@octokit/graphql/dist-types/with-defaults.d.ts
generated
vendored
Normal file
3
node_modules/@octokit/graphql/dist-types/with-defaults.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { request as Request } from "@octokit/request";
|
||||
import type { graphql as ApiInterface, RequestParameters } from "./types";
|
||||
export declare function withDefaults(request: typeof Request, newDefaults: RequestParameters): ApiInterface;
|
||||
127
node_modules/@octokit/graphql/dist-web/index.js
generated
vendored
Normal file
127
node_modules/@octokit/graphql/dist-web/index.js
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
// pkg/dist-src/index.js
|
||||
import { request } from "@octokit/request";
|
||||
import { getUserAgent } from "universal-user-agent";
|
||||
|
||||
// pkg/dist-src/version.js
|
||||
var VERSION = "7.1.0";
|
||||
|
||||
// pkg/dist-src/with-defaults.js
|
||||
import { request as Request2 } from "@octokit/request";
|
||||
|
||||
// pkg/dist-src/graphql.js
|
||||
import { request as Request } from "@octokit/request";
|
||||
|
||||
// pkg/dist-src/error.js
|
||||
function _buildMessageForResponseErrors(data) {
|
||||
return `Request failed due to following response errors:
|
||||
` + data.errors.map((e) => ` - ${e.message}`).join("\n");
|
||||
}
|
||||
var GraphqlResponseError = class extends Error {
|
||||
constructor(request2, headers, response) {
|
||||
super(_buildMessageForResponseErrors(response));
|
||||
this.request = request2;
|
||||
this.headers = headers;
|
||||
this.response = response;
|
||||
this.name = "GraphqlResponseError";
|
||||
this.errors = response.errors;
|
||||
this.data = response.data;
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// pkg/dist-src/graphql.js
|
||||
var NON_VARIABLE_OPTIONS = [
|
||||
"method",
|
||||
"baseUrl",
|
||||
"url",
|
||||
"headers",
|
||||
"request",
|
||||
"query",
|
||||
"mediaType"
|
||||
];
|
||||
var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"];
|
||||
var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
|
||||
function graphql(request2, query, options) {
|
||||
if (options) {
|
||||
if (typeof query === "string" && "query" in options) {
|
||||
return Promise.reject(
|
||||
new Error(`[@octokit/graphql] "query" cannot be used as variable name`)
|
||||
);
|
||||
}
|
||||
for (const key in options) {
|
||||
if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key))
|
||||
continue;
|
||||
return Promise.reject(
|
||||
new Error(
|
||||
`[@octokit/graphql] "${key}" cannot be used as variable name`
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
const parsedOptions = typeof query === "string" ? Object.assign({ query }, options) : query;
|
||||
const requestOptions = Object.keys(
|
||||
parsedOptions
|
||||
).reduce((result, key) => {
|
||||
if (NON_VARIABLE_OPTIONS.includes(key)) {
|
||||
result[key] = parsedOptions[key];
|
||||
return result;
|
||||
}
|
||||
if (!result.variables) {
|
||||
result.variables = {};
|
||||
}
|
||||
result.variables[key] = parsedOptions[key];
|
||||
return result;
|
||||
}, {});
|
||||
const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl;
|
||||
if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) {
|
||||
requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql");
|
||||
}
|
||||
return request2(requestOptions).then((response) => {
|
||||
if (response.data.errors) {
|
||||
const headers = {};
|
||||
for (const key of Object.keys(response.headers)) {
|
||||
headers[key] = response.headers[key];
|
||||
}
|
||||
throw new GraphqlResponseError(
|
||||
requestOptions,
|
||||
headers,
|
||||
response.data
|
||||
);
|
||||
}
|
||||
return response.data.data;
|
||||
});
|
||||
}
|
||||
|
||||
// pkg/dist-src/with-defaults.js
|
||||
function withDefaults(request2, newDefaults) {
|
||||
const newRequest = request2.defaults(newDefaults);
|
||||
const newApi = (query, options) => {
|
||||
return graphql(newRequest, query, options);
|
||||
};
|
||||
return Object.assign(newApi, {
|
||||
defaults: withDefaults.bind(null, newRequest),
|
||||
endpoint: newRequest.endpoint
|
||||
});
|
||||
}
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var graphql2 = withDefaults(request, {
|
||||
headers: {
|
||||
"user-agent": `octokit-graphql.js/${VERSION} ${getUserAgent()}`
|
||||
},
|
||||
method: "POST",
|
||||
url: "/graphql"
|
||||
});
|
||||
function withCustomRequest(customRequest) {
|
||||
return withDefaults(customRequest, {
|
||||
method: "POST",
|
||||
url: "/graphql"
|
||||
});
|
||||
}
|
||||
export {
|
||||
GraphqlResponseError,
|
||||
graphql2 as graphql,
|
||||
withCustomRequest
|
||||
};
|
||||
7
node_modules/@octokit/graphql/dist-web/index.js.map
generated
vendored
Normal file
7
node_modules/@octokit/graphql/dist-web/index.js.map
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../dist-src/index.js", "../dist-src/version.js", "../dist-src/with-defaults.js", "../dist-src/graphql.js", "../dist-src/error.js"],
|
||||
"sourcesContent": ["import { request } from \"@octokit/request\";\nimport { getUserAgent } from \"universal-user-agent\";\nimport { VERSION } from \"./version\";\nimport { withDefaults } from \"./with-defaults\";\nconst graphql = withDefaults(request, {\n headers: {\n \"user-agent\": `octokit-graphql.js/${VERSION} ${getUserAgent()}`\n },\n method: \"POST\",\n url: \"/graphql\"\n});\nimport { GraphqlResponseError } from \"./error\";\nfunction withCustomRequest(customRequest) {\n return withDefaults(customRequest, {\n method: \"POST\",\n url: \"/graphql\"\n });\n}\nexport {\n GraphqlResponseError,\n graphql,\n withCustomRequest\n};\n", "const VERSION = \"7.1.0\";\nexport {\n VERSION\n};\n", "import { request as Request } from \"@octokit/request\";\nimport { graphql } from \"./graphql\";\nfunction withDefaults(request, newDefaults) {\n const newRequest = request.defaults(newDefaults);\n const newApi = (query, options) => {\n return graphql(newRequest, query, options);\n };\n return Object.assign(newApi, {\n defaults: withDefaults.bind(null, newRequest),\n endpoint: newRequest.endpoint\n });\n}\nexport {\n withDefaults\n};\n", "import { request as Request } from \"@octokit/request\";\nimport { GraphqlResponseError } from \"./error\";\nconst NON_VARIABLE_OPTIONS = [\n \"method\",\n \"baseUrl\",\n \"url\",\n \"headers\",\n \"request\",\n \"query\",\n \"mediaType\"\n];\nconst FORBIDDEN_VARIABLE_OPTIONS = [\"query\", \"method\", \"url\"];\nconst GHES_V3_SUFFIX_REGEX = /\\/api\\/v3\\/?$/;\nfunction graphql(request, query, options) {\n if (options) {\n if (typeof query === \"string\" && \"query\" in options) {\n return Promise.reject(\n new Error(`[@octokit/graphql] \"query\" cannot be used as variable name`)\n );\n }\n for (const key in options) {\n if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key))\n continue;\n return Promise.reject(\n new Error(\n `[@octokit/graphql] \"${key}\" cannot be used as variable name`\n )\n );\n }\n }\n const parsedOptions = typeof query === \"string\" ? Object.assign({ query }, options) : query;\n const requestOptions = Object.keys(\n parsedOptions\n ).reduce((result, key) => {\n if (NON_VARIABLE_OPTIONS.includes(key)) {\n result[key] = parsedOptions[key];\n return result;\n }\n if (!result.variables) {\n result.variables = {};\n }\n result.variables[key] = parsedOptions[key];\n return result;\n }, {});\n const baseUrl = parsedOptions.baseUrl || request.endpoint.DEFAULTS.baseUrl;\n if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) {\n requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, \"/api/graphql\");\n }\n return request(requestOptions).then((response) => {\n if (response.data.errors) {\n const headers = {};\n for (const key of Object.keys(response.headers)) {\n headers[key] = response.headers[key];\n }\n throw new GraphqlResponseError(\n requestOptions,\n headers,\n response.data\n );\n }\n return response.data.data;\n });\n}\nexport {\n graphql\n};\n", "function _buildMessageForResponseErrors(data) {\n return `Request failed due to following response errors:\n` + data.errors.map((e) => ` - ${e.message}`).join(\"\\n\");\n}\nclass GraphqlResponseError extends Error {\n constructor(request, headers, response) {\n super(_buildMessageForResponseErrors(response));\n this.request = request;\n this.headers = headers;\n this.response = response;\n this.name = \"GraphqlResponseError\";\n this.errors = response.errors;\n this.data = response.data;\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n}\nexport {\n GraphqlResponseError\n};\n"],
|
||||
"mappings": ";AAAA,SAAS,eAAe;AACxB,SAAS,oBAAoB;;;ACD7B,IAAM,UAAU;;;ACAhB,SAAS,WAAWA,gBAAe;;;ACAnC,SAAS,WAAW,eAAe;;;ACAnC,SAAS,+BAA+B,MAAM;AAC5C,SAAO;AAAA,IACL,KAAK,OAAO,IAAI,CAAC,MAAM,MAAM,EAAE,OAAO,EAAE,EAAE,KAAK,IAAI;AACvD;AACA,IAAM,uBAAN,cAAmC,MAAM;AAAA,EACvC,YAAYC,UAAS,SAAS,UAAU;AACtC,UAAM,+BAA+B,QAAQ,CAAC;AAC9C,SAAK,UAAUA;AACf,SAAK,UAAU;AACf,SAAK,WAAW;AAChB,SAAK,OAAO;AACZ,SAAK,SAAS,SAAS;AACvB,SAAK,OAAO,SAAS;AACrB,QAAI,MAAM,mBAAmB;AAC3B,YAAM,kBAAkB,MAAM,KAAK,WAAW;AAAA,IAChD;AAAA,EACF;AACF;;;ADfA,IAAM,uBAAuB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,IAAM,6BAA6B,CAAC,SAAS,UAAU,KAAK;AAC5D,IAAM,uBAAuB;AAC7B,SAAS,QAAQC,UAAS,OAAO,SAAS;AACxC,MAAI,SAAS;AACX,QAAI,OAAO,UAAU,YAAY,WAAW,SAAS;AACnD,aAAO,QAAQ;AAAA,QACb,IAAI,MAAM,4DAA4D;AAAA,MACxE;AAAA,IACF;AACA,eAAW,OAAO,SAAS;AACzB,UAAI,CAAC,2BAA2B,SAAS,GAAG;AAC1C;AACF,aAAO,QAAQ;AAAA,QACb,IAAI;AAAA,UACF,uBAAuB,GAAG;AAAA,QAC5B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,QAAM,gBAAgB,OAAO,UAAU,WAAW,OAAO,OAAO,EAAE,MAAM,GAAG,OAAO,IAAI;AACtF,QAAM,iBAAiB,OAAO;AAAA,IAC5B;AAAA,EACF,EAAE,OAAO,CAAC,QAAQ,QAAQ;AACxB,QAAI,qBAAqB,SAAS,GAAG,GAAG;AACtC,aAAO,GAAG,IAAI,cAAc,GAAG;AAC/B,aAAO;AAAA,IACT;AACA,QAAI,CAAC,OAAO,WAAW;AACrB,aAAO,YAAY,CAAC;AAAA,IACtB;AACA,WAAO,UAAU,GAAG,IAAI,cAAc,GAAG;AACzC,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACL,QAAM,UAAU,cAAc,WAAWA,SAAQ,SAAS,SAAS;AACnE,MAAI,qBAAqB,KAAK,OAAO,GAAG;AACtC,mBAAe,MAAM,QAAQ,QAAQ,sBAAsB,cAAc;AAAA,EAC3E;AACA,SAAOA,SAAQ,cAAc,EAAE,KAAK,CAAC,aAAa;AAChD,QAAI,SAAS,KAAK,QAAQ;AACxB,YAAM,UAAU,CAAC;AACjB,iBAAW,OAAO,OAAO,KAAK,SAAS,OAAO,GAAG;AAC/C,gBAAQ,GAAG,IAAI,SAAS,QAAQ,GAAG;AAAA,MACrC;AACA,YAAM,IAAI;AAAA,QACR;AAAA,QACA;AAAA,QACA,SAAS;AAAA,MACX;AAAA,IACF;AACA,WAAO,SAAS,KAAK;AAAA,EACvB,CAAC;AACH;;;AD5DA,SAAS,aAAaC,UAAS,aAAa;AAC1C,QAAM,aAAaA,SAAQ,SAAS,WAAW;AAC/C,QAAM,SAAS,CAAC,OAAO,YAAY;AACjC,WAAO,QAAQ,YAAY,OAAO,OAAO;AAAA,EAC3C;AACA,SAAO,OAAO,OAAO,QAAQ;AAAA,IAC3B,UAAU,aAAa,KAAK,MAAM,UAAU;AAAA,IAC5C,UAAU,WAAW;AAAA,EACvB,CAAC;AACH;;;AFPA,IAAMC,WAAU,aAAa,SAAS;AAAA,EACpC,SAAS;AAAA,IACP,cAAc,sBAAsB,OAAO,IAAI,aAAa,CAAC;AAAA,EAC/D;AAAA,EACA,QAAQ;AAAA,EACR,KAAK;AACP,CAAC;AAED,SAAS,kBAAkB,eAAe;AACxC,SAAO,aAAa,eAAe;AAAA,IACjC,QAAQ;AAAA,IACR,KAAK;AAAA,EACP,CAAC;AACH;",
|
||||
"names": ["Request", "request", "request", "request", "graphql"]
|
||||
}
|
||||
49
node_modules/@octokit/graphql/package.json
generated
vendored
Normal file
49
node_modules/@octokit/graphql/package.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "@octokit/graphql",
|
||||
"version": "7.1.0",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"provenance": true
|
||||
},
|
||||
"description": "GitHub GraphQL API client for browsers and Node",
|
||||
"repository": "github:octokit/graphql.js",
|
||||
"keywords": [
|
||||
"octokit",
|
||||
"github",
|
||||
"api",
|
||||
"graphql"
|
||||
],
|
||||
"author": "Gregor Martynus (https://github.com/gr2m)",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/request": "^8.3.0",
|
||||
"@octokit/types": "^13.0.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@octokit/tsconfig": "^2.0.0",
|
||||
"@types/fetch-mock": "^7.2.5",
|
||||
"@types/jest": "^29.0.0",
|
||||
"@types/node": "^18.0.0",
|
||||
"esbuild": "^0.19.0",
|
||||
"fetch-mock": "npm:@gr2m/fetch-mock@9.11.0-pull-request-644.1",
|
||||
"glob": "^10.2.6",
|
||||
"jest": "^29.0.0",
|
||||
"prettier": "3.0.3",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||
"ts-jest": "^29.0.0",
|
||||
"typescript": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"files": [
|
||||
"dist-*/**",
|
||||
"bin/**"
|
||||
],
|
||||
"main": "dist-node/index.js",
|
||||
"module": "dist-web/index.js",
|
||||
"types": "dist-types/index.d.ts",
|
||||
"source": "dist-src/index.js",
|
||||
"sideEffects": false
|
||||
}
|
||||
7
node_modules/@octokit/openapi-types/LICENSE
generated
vendored
Normal file
7
node_modules/@octokit/openapi-types/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
Copyright 2020 Gregor Martynus
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
17
node_modules/@octokit/openapi-types/README.md
generated
vendored
Normal file
17
node_modules/@octokit/openapi-types/README.md
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
# @octokit/openapi-types
|
||||
|
||||
> Generated TypeScript definitions based on GitHub's OpenAPI spec
|
||||
|
||||
This package is continuously updated based on [GitHub's OpenAPI specification](https://github.com/github/rest-api-description/)
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import { components } from "@octokit/openapi-types";
|
||||
|
||||
type Repository = components["schemas"]["full-repository"];
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
21
node_modules/@octokit/openapi-types/package.json
generated
vendored
Normal file
21
node_modules/@octokit/openapi-types/package.json
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "@octokit/openapi-types",
|
||||
"description": "Generated TypeScript definitions based on GitHub's OpenAPI spec for api.github.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/octokit/openapi-types.ts.git",
|
||||
"directory": "packages/openapi-types"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"provenance": true
|
||||
},
|
||||
"version": "22.2.0",
|
||||
"main": "",
|
||||
"types": "types.d.ts",
|
||||
"author": "Gregor Martynus (https://twitter.com/gr2m)",
|
||||
"license": "MIT",
|
||||
"octokit": {
|
||||
"openapi-version": "16.5.0"
|
||||
}
|
||||
}
|
||||
110231
node_modules/@octokit/openapi-types/types.d.ts
generated
vendored
Normal file
110231
node_modules/@octokit/openapi-types/types.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7
node_modules/@octokit/plugin-paginate-rest/LICENSE
generated
vendored
Normal file
7
node_modules/@octokit/plugin-paginate-rest/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
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 (including the next paragraph) 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.
|
||||
269
node_modules/@octokit/plugin-paginate-rest/README.md
generated
vendored
Normal file
269
node_modules/@octokit/plugin-paginate-rest/README.md
generated
vendored
Normal file
@@ -0,0 +1,269 @@
|
||||
# plugin-paginate-rest.js
|
||||
|
||||
> Octokit plugin to paginate REST API endpoint responses
|
||||
|
||||
[](https://www.npmjs.com/package/@octokit/plugin-paginate-rest)
|
||||
[](https://github.com/octokit/plugin-paginate-rest.js/actions?workflow=Test)
|
||||
|
||||
## Usage
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
|
||||
Load `@octokit/plugin-paginate-rest` and [`@octokit/core`](https://github.com/octokit/core.js) (or core-compatible module) directly from [esm.sh](https://esm.sh)
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { Octokit } from "https://esm.sh/@octokit/core";
|
||||
import {
|
||||
paginateRest,
|
||||
composePaginateRest,
|
||||
} from "https://esm.sh/@octokit/plugin-paginate-rest";
|
||||
</script>
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Node
|
||||
</th><td>
|
||||
|
||||
Install with `npm install @octokit/core @octokit/plugin-paginate-rest`. Optionally replace `@octokit/core` with a core-compatible module
|
||||
|
||||
```js
|
||||
const { Octokit } = require("@octokit/core");
|
||||
const {
|
||||
paginateRest,
|
||||
composePaginateRest,
|
||||
} = require("@octokit/plugin-paginate-rest");
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
```js
|
||||
const MyOctokit = Octokit.plugin(paginateRest);
|
||||
const octokit = new MyOctokit({ auth: "secret123" });
|
||||
|
||||
// See https://developer.github.com/v3/issues/#list-issues-for-a-repository
|
||||
const issues = await octokit.paginate("GET /repos/{owner}/{repo}/issues", {
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
since: "2010-10-01",
|
||||
per_page: 100,
|
||||
});
|
||||
```
|
||||
|
||||
If you want to utilize the pagination methods in another plugin, use `composePaginateRest`.
|
||||
|
||||
```js
|
||||
function myPlugin(octokit, options) {
|
||||
return {
|
||||
allStars({owner, repo}) => {
|
||||
return composePaginateRest(
|
||||
octokit,
|
||||
"GET /repos/{owner}/{repo}/stargazers",
|
||||
{owner, repo }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## `octokit.paginate()`
|
||||
|
||||
The `paginateRest` plugin adds a new `octokit.paginate()` method which accepts the same parameters as [`octokit.request`](https://github.com/octokit/request.js#request). Only "List ..." endpoints such as [List issues for a repository](https://developer.github.com/v3/issues/#list-issues-for-a-repository) are supporting pagination. Their [response includes a Link header](https://developer.github.com/v3/issues/#response-1). For other endpoints, `octokit.paginate()` behaves the same as `octokit.request()`.
|
||||
|
||||
The `per_page` parameter is usually defaulting to `30`, and can be set to up to `100`, which helps retrieving a big amount of data without hitting the rate limits too soon.
|
||||
|
||||
An optional `mapFunction` can be passed to map each page response to a new value, usually an array with only the data you need. This can help to reduce memory usage, as only the relevant data has to be kept in memory until the pagination is complete.
|
||||
|
||||
```js
|
||||
const issueTitles = await octokit.paginate(
|
||||
"GET /repos/{owner}/{repo}/issues",
|
||||
{
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
since: "2010-10-01",
|
||||
per_page: 100,
|
||||
},
|
||||
(response) => response.data.map((issue) => issue.title),
|
||||
);
|
||||
```
|
||||
|
||||
The `mapFunction` gets a 2nd argument `done` which can be called to end the pagination early.
|
||||
|
||||
```js
|
||||
const issues = await octokit.paginate(
|
||||
"GET /repos/{owner}/{repo}/issues",
|
||||
{
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
since: "2010-10-01",
|
||||
per_page: 100,
|
||||
},
|
||||
(response, done) => {
|
||||
if (response.data.find((issue) => issue.title.includes("something"))) {
|
||||
done();
|
||||
}
|
||||
return response.data;
|
||||
},
|
||||
);
|
||||
```
|
||||
|
||||
Alternatively you can pass a `request` method as first argument. This is great when using in combination with [`@octokit/plugin-rest-endpoint-methods`](https://github.com/octokit/plugin-rest-endpoint-methods.js/):
|
||||
|
||||
```js
|
||||
const issues = await octokit.paginate(octokit.rest.issues.listForRepo, {
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
since: "2010-10-01",
|
||||
per_page: 100,
|
||||
});
|
||||
```
|
||||
|
||||
## `octokit.paginate.iterator()`
|
||||
|
||||
If your target runtime environments supports async iterators (such as most modern browsers and Node 10+), you can iterate through each response
|
||||
|
||||
```js
|
||||
const parameters = {
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
since: "2010-10-01",
|
||||
per_page: 100,
|
||||
};
|
||||
for await (const response of octokit.paginate.iterator(
|
||||
"GET /repos/{owner}/{repo}/issues",
|
||||
parameters,
|
||||
)) {
|
||||
// do whatever you want with each response, break out of the loop, etc.
|
||||
const issues = response.data;
|
||||
console.log("%d issues found", issues.length);
|
||||
}
|
||||
```
|
||||
|
||||
Alternatively you can pass a `request` method as first argument. This is great when using in combination with [`@octokit/plugin-rest-endpoint-methods`](https://github.com/octokit/plugin-rest-endpoint-methods.js/):
|
||||
|
||||
```js
|
||||
const parameters = {
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
since: "2010-10-01",
|
||||
per_page: 100,
|
||||
};
|
||||
for await (const response of octokit.paginate.iterator(
|
||||
octokit.rest.issues.listForRepo,
|
||||
parameters,
|
||||
)) {
|
||||
// do whatever you want with each response, break out of the loop, etc.
|
||||
const issues = response.data;
|
||||
console.log("%d issues found", issues.length);
|
||||
}
|
||||
```
|
||||
|
||||
## `composePaginateRest` and `composePaginateRest.iterator`
|
||||
|
||||
The `compose*` methods work just like their `octokit.*` counterparts described above, with the differenct that both methods require an `octokit` instance to be passed as first argument
|
||||
|
||||
## How it works
|
||||
|
||||
`octokit.paginate()` wraps `octokit.request()`. As long as a `rel="next"` link value is present in the response's `Link` header, it sends another request for that URL, and so on.
|
||||
|
||||
Most of GitHub's paginating REST API endpoints return an array, but there are a few exceptions which return an object with a key that includes the items array. For example:
|
||||
|
||||
- [Search repositories](https://developer.github.com/v3/search/#example) (key `items`)
|
||||
- [List check runs for a specific ref](https://developer.github.com/v3/checks/runs/#response-3) (key: `check_runs`)
|
||||
- [List check suites for a specific ref](https://developer.github.com/v3/checks/suites/#response-1) (key: `check_suites`)
|
||||
- [List repositories](https://developer.github.com/v3/apps/installations/#list-repositories) for an installation (key: `repositories`)
|
||||
- [List installations for a user](https://developer.github.com/v3/apps/installations/#response-1) (key `installations`)
|
||||
|
||||
`octokit.paginate()` is working around these inconsistencies so you don't have to worry about it.
|
||||
|
||||
If a response is lacking the `Link` header, `octokit.paginate()` still resolves with an array, even if the response returns a single object.
|
||||
|
||||
## Types
|
||||
|
||||
The plugin also exposes some types and runtime type guards for TypeScript projects.
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
Types
|
||||
</th><td>
|
||||
|
||||
```typescript
|
||||
import {
|
||||
PaginateInterface,
|
||||
PaginatingEndpoints,
|
||||
} from "@octokit/plugin-paginate-rest";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Guards
|
||||
</th><td>
|
||||
|
||||
```typescript
|
||||
import { isPaginatingEndpoint } from "@octokit/plugin-paginate-rest";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
### PaginateInterface
|
||||
|
||||
An `interface` that declares all the overloads of the `.paginate` method.
|
||||
|
||||
### PaginatingEndpoints
|
||||
|
||||
An `interface` which describes all API endpoints supported by the plugin. Some overloads of `.paginate()` method and `composePaginateRest()` function depend on `PaginatingEndpoints`, using the `keyof PaginatingEndpoints` as a type for one of its arguments.
|
||||
|
||||
```typescript
|
||||
import { Octokit } from "@octokit/core";
|
||||
import {
|
||||
PaginatingEndpoints,
|
||||
composePaginateRest,
|
||||
} from "@octokit/plugin-paginate-rest";
|
||||
|
||||
type DataType<T> = "data" extends keyof T ? T["data"] : unknown;
|
||||
|
||||
async function myPaginatePlugin<E extends keyof PaginatingEndpoints>(
|
||||
octokit: Octokit,
|
||||
endpoint: E,
|
||||
parameters?: PaginatingEndpoints[E]["parameters"],
|
||||
): Promise<DataType<PaginatingEndpoints[E]["response"]>> {
|
||||
return await composePaginateRest(octokit, endpoint, parameters);
|
||||
}
|
||||
```
|
||||
|
||||
### isPaginatingEndpoint
|
||||
|
||||
A type guard, `isPaginatingEndpoint(arg)` returns `true` if `arg` is one of the keys in `PaginatingEndpoints` (is `keyof PaginatingEndpoints`).
|
||||
|
||||
```typescript
|
||||
import { Octokit } from "@octokit/core";
|
||||
import {
|
||||
isPaginatingEndpoint,
|
||||
composePaginateRest,
|
||||
} from "@octokit/plugin-paginate-rest";
|
||||
|
||||
async function myPlugin(octokit: Octokit, arg: unknown) {
|
||||
if (isPaginatingEndpoint(arg)) {
|
||||
return await composePaginateRest(octokit, arg);
|
||||
}
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
398
node_modules/@octokit/plugin-paginate-rest/dist-node/index.js
generated
vendored
Normal file
398
node_modules/@octokit/plugin-paginate-rest/dist-node/index.js
generated
vendored
Normal file
@@ -0,0 +1,398 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var dist_src_exports = {};
|
||||
__export(dist_src_exports, {
|
||||
composePaginateRest: () => composePaginateRest,
|
||||
isPaginatingEndpoint: () => isPaginatingEndpoint,
|
||||
paginateRest: () => paginateRest,
|
||||
paginatingEndpoints: () => paginatingEndpoints
|
||||
});
|
||||
module.exports = __toCommonJS(dist_src_exports);
|
||||
|
||||
// pkg/dist-src/version.js
|
||||
var VERSION = "9.2.1";
|
||||
|
||||
// pkg/dist-src/normalize-paginated-list-response.js
|
||||
function normalizePaginatedListResponse(response) {
|
||||
if (!response.data) {
|
||||
return {
|
||||
...response,
|
||||
data: []
|
||||
};
|
||||
}
|
||||
const responseNeedsNormalization = "total_count" in response.data && !("url" in response.data);
|
||||
if (!responseNeedsNormalization)
|
||||
return response;
|
||||
const incompleteResults = response.data.incomplete_results;
|
||||
const repositorySelection = response.data.repository_selection;
|
||||
const totalCount = response.data.total_count;
|
||||
delete response.data.incomplete_results;
|
||||
delete response.data.repository_selection;
|
||||
delete response.data.total_count;
|
||||
const namespaceKey = Object.keys(response.data)[0];
|
||||
const data = response.data[namespaceKey];
|
||||
response.data = data;
|
||||
if (typeof incompleteResults !== "undefined") {
|
||||
response.data.incomplete_results = incompleteResults;
|
||||
}
|
||||
if (typeof repositorySelection !== "undefined") {
|
||||
response.data.repository_selection = repositorySelection;
|
||||
}
|
||||
response.data.total_count = totalCount;
|
||||
return response;
|
||||
}
|
||||
|
||||
// pkg/dist-src/iterator.js
|
||||
function iterator(octokit, route, parameters) {
|
||||
const options = typeof route === "function" ? route.endpoint(parameters) : octokit.request.endpoint(route, parameters);
|
||||
const requestMethod = typeof route === "function" ? route : octokit.request;
|
||||
const method = options.method;
|
||||
const headers = options.headers;
|
||||
let url = options.url;
|
||||
return {
|
||||
[Symbol.asyncIterator]: () => ({
|
||||
async next() {
|
||||
if (!url)
|
||||
return { done: true };
|
||||
try {
|
||||
const response = await requestMethod({ method, url, headers });
|
||||
const normalizedResponse = normalizePaginatedListResponse(response);
|
||||
url = ((normalizedResponse.headers.link || "").match(
|
||||
/<([^>]+)>;\s*rel="next"/
|
||||
) || [])[1];
|
||||
return { value: normalizedResponse };
|
||||
} catch (error) {
|
||||
if (error.status !== 409)
|
||||
throw error;
|
||||
url = "";
|
||||
return {
|
||||
value: {
|
||||
status: 200,
|
||||
headers: {},
|
||||
data: []
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
// pkg/dist-src/paginate.js
|
||||
function paginate(octokit, route, parameters, mapFn) {
|
||||
if (typeof parameters === "function") {
|
||||
mapFn = parameters;
|
||||
parameters = void 0;
|
||||
}
|
||||
return gather(
|
||||
octokit,
|
||||
[],
|
||||
iterator(octokit, route, parameters)[Symbol.asyncIterator](),
|
||||
mapFn
|
||||
);
|
||||
}
|
||||
function gather(octokit, results, iterator2, mapFn) {
|
||||
return iterator2.next().then((result) => {
|
||||
if (result.done) {
|
||||
return results;
|
||||
}
|
||||
let earlyExit = false;
|
||||
function done() {
|
||||
earlyExit = true;
|
||||
}
|
||||
results = results.concat(
|
||||
mapFn ? mapFn(result.value, done) : result.value.data
|
||||
);
|
||||
if (earlyExit) {
|
||||
return results;
|
||||
}
|
||||
return gather(octokit, results, iterator2, mapFn);
|
||||
});
|
||||
}
|
||||
|
||||
// pkg/dist-src/compose-paginate.js
|
||||
var composePaginateRest = Object.assign(paginate, {
|
||||
iterator
|
||||
});
|
||||
|
||||
// pkg/dist-src/generated/paginating-endpoints.js
|
||||
var paginatingEndpoints = [
|
||||
"GET /advisories",
|
||||
"GET /app/hook/deliveries",
|
||||
"GET /app/installation-requests",
|
||||
"GET /app/installations",
|
||||
"GET /assignments/{assignment_id}/accepted_assignments",
|
||||
"GET /classrooms",
|
||||
"GET /classrooms/{classroom_id}/assignments",
|
||||
"GET /enterprises/{enterprise}/dependabot/alerts",
|
||||
"GET /enterprises/{enterprise}/secret-scanning/alerts",
|
||||
"GET /events",
|
||||
"GET /gists",
|
||||
"GET /gists/public",
|
||||
"GET /gists/starred",
|
||||
"GET /gists/{gist_id}/comments",
|
||||
"GET /gists/{gist_id}/commits",
|
||||
"GET /gists/{gist_id}/forks",
|
||||
"GET /installation/repositories",
|
||||
"GET /issues",
|
||||
"GET /licenses",
|
||||
"GET /marketplace_listing/plans",
|
||||
"GET /marketplace_listing/plans/{plan_id}/accounts",
|
||||
"GET /marketplace_listing/stubbed/plans",
|
||||
"GET /marketplace_listing/stubbed/plans/{plan_id}/accounts",
|
||||
"GET /networks/{owner}/{repo}/events",
|
||||
"GET /notifications",
|
||||
"GET /organizations",
|
||||
"GET /orgs/{org}/actions/cache/usage-by-repository",
|
||||
"GET /orgs/{org}/actions/permissions/repositories",
|
||||
"GET /orgs/{org}/actions/runners",
|
||||
"GET /orgs/{org}/actions/secrets",
|
||||
"GET /orgs/{org}/actions/secrets/{secret_name}/repositories",
|
||||
"GET /orgs/{org}/actions/variables",
|
||||
"GET /orgs/{org}/actions/variables/{name}/repositories",
|
||||
"GET /orgs/{org}/blocks",
|
||||
"GET /orgs/{org}/code-scanning/alerts",
|
||||
"GET /orgs/{org}/codespaces",
|
||||
"GET /orgs/{org}/codespaces/secrets",
|
||||
"GET /orgs/{org}/codespaces/secrets/{secret_name}/repositories",
|
||||
"GET /orgs/{org}/copilot/billing/seats",
|
||||
"GET /orgs/{org}/dependabot/alerts",
|
||||
"GET /orgs/{org}/dependabot/secrets",
|
||||
"GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories",
|
||||
"GET /orgs/{org}/events",
|
||||
"GET /orgs/{org}/failed_invitations",
|
||||
"GET /orgs/{org}/hooks",
|
||||
"GET /orgs/{org}/hooks/{hook_id}/deliveries",
|
||||
"GET /orgs/{org}/installations",
|
||||
"GET /orgs/{org}/invitations",
|
||||
"GET /orgs/{org}/invitations/{invitation_id}/teams",
|
||||
"GET /orgs/{org}/issues",
|
||||
"GET /orgs/{org}/members",
|
||||
"GET /orgs/{org}/members/{username}/codespaces",
|
||||
"GET /orgs/{org}/migrations",
|
||||
"GET /orgs/{org}/migrations/{migration_id}/repositories",
|
||||
"GET /orgs/{org}/organization-roles/{role_id}/teams",
|
||||
"GET /orgs/{org}/organization-roles/{role_id}/users",
|
||||
"GET /orgs/{org}/outside_collaborators",
|
||||
"GET /orgs/{org}/packages",
|
||||
"GET /orgs/{org}/packages/{package_type}/{package_name}/versions",
|
||||
"GET /orgs/{org}/personal-access-token-requests",
|
||||
"GET /orgs/{org}/personal-access-token-requests/{pat_request_id}/repositories",
|
||||
"GET /orgs/{org}/personal-access-tokens",
|
||||
"GET /orgs/{org}/personal-access-tokens/{pat_id}/repositories",
|
||||
"GET /orgs/{org}/projects",
|
||||
"GET /orgs/{org}/properties/values",
|
||||
"GET /orgs/{org}/public_members",
|
||||
"GET /orgs/{org}/repos",
|
||||
"GET /orgs/{org}/rulesets",
|
||||
"GET /orgs/{org}/rulesets/rule-suites",
|
||||
"GET /orgs/{org}/secret-scanning/alerts",
|
||||
"GET /orgs/{org}/security-advisories",
|
||||
"GET /orgs/{org}/teams",
|
||||
"GET /orgs/{org}/teams/{team_slug}/discussions",
|
||||
"GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments",
|
||||
"GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions",
|
||||
"GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions",
|
||||
"GET /orgs/{org}/teams/{team_slug}/invitations",
|
||||
"GET /orgs/{org}/teams/{team_slug}/members",
|
||||
"GET /orgs/{org}/teams/{team_slug}/projects",
|
||||
"GET /orgs/{org}/teams/{team_slug}/repos",
|
||||
"GET /orgs/{org}/teams/{team_slug}/teams",
|
||||
"GET /projects/columns/{column_id}/cards",
|
||||
"GET /projects/{project_id}/collaborators",
|
||||
"GET /projects/{project_id}/columns",
|
||||
"GET /repos/{owner}/{repo}/actions/artifacts",
|
||||
"GET /repos/{owner}/{repo}/actions/caches",
|
||||
"GET /repos/{owner}/{repo}/actions/organization-secrets",
|
||||
"GET /repos/{owner}/{repo}/actions/organization-variables",
|
||||
"GET /repos/{owner}/{repo}/actions/runners",
|
||||
"GET /repos/{owner}/{repo}/actions/runs",
|
||||
"GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts",
|
||||
"GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs",
|
||||
"GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs",
|
||||
"GET /repos/{owner}/{repo}/actions/secrets",
|
||||
"GET /repos/{owner}/{repo}/actions/variables",
|
||||
"GET /repos/{owner}/{repo}/actions/workflows",
|
||||
"GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs",
|
||||
"GET /repos/{owner}/{repo}/activity",
|
||||
"GET /repos/{owner}/{repo}/assignees",
|
||||
"GET /repos/{owner}/{repo}/branches",
|
||||
"GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations",
|
||||
"GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs",
|
||||
"GET /repos/{owner}/{repo}/code-scanning/alerts",
|
||||
"GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances",
|
||||
"GET /repos/{owner}/{repo}/code-scanning/analyses",
|
||||
"GET /repos/{owner}/{repo}/codespaces",
|
||||
"GET /repos/{owner}/{repo}/codespaces/devcontainers",
|
||||
"GET /repos/{owner}/{repo}/codespaces/secrets",
|
||||
"GET /repos/{owner}/{repo}/collaborators",
|
||||
"GET /repos/{owner}/{repo}/comments",
|
||||
"GET /repos/{owner}/{repo}/comments/{comment_id}/reactions",
|
||||
"GET /repos/{owner}/{repo}/commits",
|
||||
"GET /repos/{owner}/{repo}/commits/{commit_sha}/comments",
|
||||
"GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls",
|
||||
"GET /repos/{owner}/{repo}/commits/{ref}/check-runs",
|
||||
"GET /repos/{owner}/{repo}/commits/{ref}/check-suites",
|
||||
"GET /repos/{owner}/{repo}/commits/{ref}/status",
|
||||
"GET /repos/{owner}/{repo}/commits/{ref}/statuses",
|
||||
"GET /repos/{owner}/{repo}/contributors",
|
||||
"GET /repos/{owner}/{repo}/dependabot/alerts",
|
||||
"GET /repos/{owner}/{repo}/dependabot/secrets",
|
||||
"GET /repos/{owner}/{repo}/deployments",
|
||||
"GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses",
|
||||
"GET /repos/{owner}/{repo}/environments",
|
||||
"GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies",
|
||||
"GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/apps",
|
||||
"GET /repos/{owner}/{repo}/events",
|
||||
"GET /repos/{owner}/{repo}/forks",
|
||||
"GET /repos/{owner}/{repo}/hooks",
|
||||
"GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries",
|
||||
"GET /repos/{owner}/{repo}/invitations",
|
||||
"GET /repos/{owner}/{repo}/issues",
|
||||
"GET /repos/{owner}/{repo}/issues/comments",
|
||||
"GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions",
|
||||
"GET /repos/{owner}/{repo}/issues/events",
|
||||
"GET /repos/{owner}/{repo}/issues/{issue_number}/comments",
|
||||
"GET /repos/{owner}/{repo}/issues/{issue_number}/events",
|
||||
"GET /repos/{owner}/{repo}/issues/{issue_number}/labels",
|
||||
"GET /repos/{owner}/{repo}/issues/{issue_number}/reactions",
|
||||
"GET /repos/{owner}/{repo}/issues/{issue_number}/timeline",
|
||||
"GET /repos/{owner}/{repo}/keys",
|
||||
"GET /repos/{owner}/{repo}/labels",
|
||||
"GET /repos/{owner}/{repo}/milestones",
|
||||
"GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels",
|
||||
"GET /repos/{owner}/{repo}/notifications",
|
||||
"GET /repos/{owner}/{repo}/pages/builds",
|
||||
"GET /repos/{owner}/{repo}/projects",
|
||||
"GET /repos/{owner}/{repo}/pulls",
|
||||
"GET /repos/{owner}/{repo}/pulls/comments",
|
||||
"GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions",
|
||||
"GET /repos/{owner}/{repo}/pulls/{pull_number}/comments",
|
||||
"GET /repos/{owner}/{repo}/pulls/{pull_number}/commits",
|
||||
"GET /repos/{owner}/{repo}/pulls/{pull_number}/files",
|
||||
"GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews",
|
||||
"GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments",
|
||||
"GET /repos/{owner}/{repo}/releases",
|
||||
"GET /repos/{owner}/{repo}/releases/{release_id}/assets",
|
||||
"GET /repos/{owner}/{repo}/releases/{release_id}/reactions",
|
||||
"GET /repos/{owner}/{repo}/rules/branches/{branch}",
|
||||
"GET /repos/{owner}/{repo}/rulesets",
|
||||
"GET /repos/{owner}/{repo}/rulesets/rule-suites",
|
||||
"GET /repos/{owner}/{repo}/secret-scanning/alerts",
|
||||
"GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations",
|
||||
"GET /repos/{owner}/{repo}/security-advisories",
|
||||
"GET /repos/{owner}/{repo}/stargazers",
|
||||
"GET /repos/{owner}/{repo}/subscribers",
|
||||
"GET /repos/{owner}/{repo}/tags",
|
||||
"GET /repos/{owner}/{repo}/teams",
|
||||
"GET /repos/{owner}/{repo}/topics",
|
||||
"GET /repositories",
|
||||
"GET /repositories/{repository_id}/environments/{environment_name}/secrets",
|
||||
"GET /repositories/{repository_id}/environments/{environment_name}/variables",
|
||||
"GET /search/code",
|
||||
"GET /search/commits",
|
||||
"GET /search/issues",
|
||||
"GET /search/labels",
|
||||
"GET /search/repositories",
|
||||
"GET /search/topics",
|
||||
"GET /search/users",
|
||||
"GET /teams/{team_id}/discussions",
|
||||
"GET /teams/{team_id}/discussions/{discussion_number}/comments",
|
||||
"GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions",
|
||||
"GET /teams/{team_id}/discussions/{discussion_number}/reactions",
|
||||
"GET /teams/{team_id}/invitations",
|
||||
"GET /teams/{team_id}/members",
|
||||
"GET /teams/{team_id}/projects",
|
||||
"GET /teams/{team_id}/repos",
|
||||
"GET /teams/{team_id}/teams",
|
||||
"GET /user/blocks",
|
||||
"GET /user/codespaces",
|
||||
"GET /user/codespaces/secrets",
|
||||
"GET /user/emails",
|
||||
"GET /user/followers",
|
||||
"GET /user/following",
|
||||
"GET /user/gpg_keys",
|
||||
"GET /user/installations",
|
||||
"GET /user/installations/{installation_id}/repositories",
|
||||
"GET /user/issues",
|
||||
"GET /user/keys",
|
||||
"GET /user/marketplace_purchases",
|
||||
"GET /user/marketplace_purchases/stubbed",
|
||||
"GET /user/memberships/orgs",
|
||||
"GET /user/migrations",
|
||||
"GET /user/migrations/{migration_id}/repositories",
|
||||
"GET /user/orgs",
|
||||
"GET /user/packages",
|
||||
"GET /user/packages/{package_type}/{package_name}/versions",
|
||||
"GET /user/public_emails",
|
||||
"GET /user/repos",
|
||||
"GET /user/repository_invitations",
|
||||
"GET /user/social_accounts",
|
||||
"GET /user/ssh_signing_keys",
|
||||
"GET /user/starred",
|
||||
"GET /user/subscriptions",
|
||||
"GET /user/teams",
|
||||
"GET /users",
|
||||
"GET /users/{username}/events",
|
||||
"GET /users/{username}/events/orgs/{org}",
|
||||
"GET /users/{username}/events/public",
|
||||
"GET /users/{username}/followers",
|
||||
"GET /users/{username}/following",
|
||||
"GET /users/{username}/gists",
|
||||
"GET /users/{username}/gpg_keys",
|
||||
"GET /users/{username}/keys",
|
||||
"GET /users/{username}/orgs",
|
||||
"GET /users/{username}/packages",
|
||||
"GET /users/{username}/projects",
|
||||
"GET /users/{username}/received_events",
|
||||
"GET /users/{username}/received_events/public",
|
||||
"GET /users/{username}/repos",
|
||||
"GET /users/{username}/social_accounts",
|
||||
"GET /users/{username}/ssh_signing_keys",
|
||||
"GET /users/{username}/starred",
|
||||
"GET /users/{username}/subscriptions"
|
||||
];
|
||||
|
||||
// pkg/dist-src/paginating-endpoints.js
|
||||
function isPaginatingEndpoint(arg) {
|
||||
if (typeof arg === "string") {
|
||||
return paginatingEndpoints.includes(arg);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
function paginateRest(octokit) {
|
||||
return {
|
||||
paginate: Object.assign(paginate.bind(null, octokit), {
|
||||
iterator: iterator.bind(null, octokit)
|
||||
})
|
||||
};
|
||||
}
|
||||
paginateRest.VERSION = VERSION;
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
composePaginateRest,
|
||||
isPaginatingEndpoint,
|
||||
paginateRest,
|
||||
paginatingEndpoints
|
||||
});
|
||||
7
node_modules/@octokit/plugin-paginate-rest/dist-node/index.js.map
generated
vendored
Normal file
7
node_modules/@octokit/plugin-paginate-rest/dist-node/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/@octokit/plugin-paginate-rest/dist-src/compose-paginate.js
generated
vendored
Normal file
8
node_modules/@octokit/plugin-paginate-rest/dist-src/compose-paginate.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { paginate } from "./paginate.js";
|
||||
import { iterator } from "./iterator.js";
|
||||
const composePaginateRest = Object.assign(paginate, {
|
||||
iterator
|
||||
});
|
||||
export {
|
||||
composePaginateRest
|
||||
};
|
||||
239
node_modules/@octokit/plugin-paginate-rest/dist-src/generated/paginating-endpoints.js
generated
vendored
Normal file
239
node_modules/@octokit/plugin-paginate-rest/dist-src/generated/paginating-endpoints.js
generated
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
const paginatingEndpoints = [
|
||||
"GET /advisories",
|
||||
"GET /app/hook/deliveries",
|
||||
"GET /app/installation-requests",
|
||||
"GET /app/installations",
|
||||
"GET /assignments/{assignment_id}/accepted_assignments",
|
||||
"GET /classrooms",
|
||||
"GET /classrooms/{classroom_id}/assignments",
|
||||
"GET /enterprises/{enterprise}/dependabot/alerts",
|
||||
"GET /enterprises/{enterprise}/secret-scanning/alerts",
|
||||
"GET /events",
|
||||
"GET /gists",
|
||||
"GET /gists/public",
|
||||
"GET /gists/starred",
|
||||
"GET /gists/{gist_id}/comments",
|
||||
"GET /gists/{gist_id}/commits",
|
||||
"GET /gists/{gist_id}/forks",
|
||||
"GET /installation/repositories",
|
||||
"GET /issues",
|
||||
"GET /licenses",
|
||||
"GET /marketplace_listing/plans",
|
||||
"GET /marketplace_listing/plans/{plan_id}/accounts",
|
||||
"GET /marketplace_listing/stubbed/plans",
|
||||
"GET /marketplace_listing/stubbed/plans/{plan_id}/accounts",
|
||||
"GET /networks/{owner}/{repo}/events",
|
||||
"GET /notifications",
|
||||
"GET /organizations",
|
||||
"GET /orgs/{org}/actions/cache/usage-by-repository",
|
||||
"GET /orgs/{org}/actions/permissions/repositories",
|
||||
"GET /orgs/{org}/actions/runners",
|
||||
"GET /orgs/{org}/actions/secrets",
|
||||
"GET /orgs/{org}/actions/secrets/{secret_name}/repositories",
|
||||
"GET /orgs/{org}/actions/variables",
|
||||
"GET /orgs/{org}/actions/variables/{name}/repositories",
|
||||
"GET /orgs/{org}/blocks",
|
||||
"GET /orgs/{org}/code-scanning/alerts",
|
||||
"GET /orgs/{org}/codespaces",
|
||||
"GET /orgs/{org}/codespaces/secrets",
|
||||
"GET /orgs/{org}/codespaces/secrets/{secret_name}/repositories",
|
||||
"GET /orgs/{org}/copilot/billing/seats",
|
||||
"GET /orgs/{org}/dependabot/alerts",
|
||||
"GET /orgs/{org}/dependabot/secrets",
|
||||
"GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories",
|
||||
"GET /orgs/{org}/events",
|
||||
"GET /orgs/{org}/failed_invitations",
|
||||
"GET /orgs/{org}/hooks",
|
||||
"GET /orgs/{org}/hooks/{hook_id}/deliveries",
|
||||
"GET /orgs/{org}/installations",
|
||||
"GET /orgs/{org}/invitations",
|
||||
"GET /orgs/{org}/invitations/{invitation_id}/teams",
|
||||
"GET /orgs/{org}/issues",
|
||||
"GET /orgs/{org}/members",
|
||||
"GET /orgs/{org}/members/{username}/codespaces",
|
||||
"GET /orgs/{org}/migrations",
|
||||
"GET /orgs/{org}/migrations/{migration_id}/repositories",
|
||||
"GET /orgs/{org}/organization-roles/{role_id}/teams",
|
||||
"GET /orgs/{org}/organization-roles/{role_id}/users",
|
||||
"GET /orgs/{org}/outside_collaborators",
|
||||
"GET /orgs/{org}/packages",
|
||||
"GET /orgs/{org}/packages/{package_type}/{package_name}/versions",
|
||||
"GET /orgs/{org}/personal-access-token-requests",
|
||||
"GET /orgs/{org}/personal-access-token-requests/{pat_request_id}/repositories",
|
||||
"GET /orgs/{org}/personal-access-tokens",
|
||||
"GET /orgs/{org}/personal-access-tokens/{pat_id}/repositories",
|
||||
"GET /orgs/{org}/projects",
|
||||
"GET /orgs/{org}/properties/values",
|
||||
"GET /orgs/{org}/public_members",
|
||||
"GET /orgs/{org}/repos",
|
||||
"GET /orgs/{org}/rulesets",
|
||||
"GET /orgs/{org}/rulesets/rule-suites",
|
||||
"GET /orgs/{org}/secret-scanning/alerts",
|
||||
"GET /orgs/{org}/security-advisories",
|
||||
"GET /orgs/{org}/teams",
|
||||
"GET /orgs/{org}/teams/{team_slug}/discussions",
|
||||
"GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments",
|
||||
"GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions",
|
||||
"GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions",
|
||||
"GET /orgs/{org}/teams/{team_slug}/invitations",
|
||||
"GET /orgs/{org}/teams/{team_slug}/members",
|
||||
"GET /orgs/{org}/teams/{team_slug}/projects",
|
||||
"GET /orgs/{org}/teams/{team_slug}/repos",
|
||||
"GET /orgs/{org}/teams/{team_slug}/teams",
|
||||
"GET /projects/columns/{column_id}/cards",
|
||||
"GET /projects/{project_id}/collaborators",
|
||||
"GET /projects/{project_id}/columns",
|
||||
"GET /repos/{owner}/{repo}/actions/artifacts",
|
||||
"GET /repos/{owner}/{repo}/actions/caches",
|
||||
"GET /repos/{owner}/{repo}/actions/organization-secrets",
|
||||
"GET /repos/{owner}/{repo}/actions/organization-variables",
|
||||
"GET /repos/{owner}/{repo}/actions/runners",
|
||||
"GET /repos/{owner}/{repo}/actions/runs",
|
||||
"GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts",
|
||||
"GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs",
|
||||
"GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs",
|
||||
"GET /repos/{owner}/{repo}/actions/secrets",
|
||||
"GET /repos/{owner}/{repo}/actions/variables",
|
||||
"GET /repos/{owner}/{repo}/actions/workflows",
|
||||
"GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs",
|
||||
"GET /repos/{owner}/{repo}/activity",
|
||||
"GET /repos/{owner}/{repo}/assignees",
|
||||
"GET /repos/{owner}/{repo}/branches",
|
||||
"GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations",
|
||||
"GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs",
|
||||
"GET /repos/{owner}/{repo}/code-scanning/alerts",
|
||||
"GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances",
|
||||
"GET /repos/{owner}/{repo}/code-scanning/analyses",
|
||||
"GET /repos/{owner}/{repo}/codespaces",
|
||||
"GET /repos/{owner}/{repo}/codespaces/devcontainers",
|
||||
"GET /repos/{owner}/{repo}/codespaces/secrets",
|
||||
"GET /repos/{owner}/{repo}/collaborators",
|
||||
"GET /repos/{owner}/{repo}/comments",
|
||||
"GET /repos/{owner}/{repo}/comments/{comment_id}/reactions",
|
||||
"GET /repos/{owner}/{repo}/commits",
|
||||
"GET /repos/{owner}/{repo}/commits/{commit_sha}/comments",
|
||||
"GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls",
|
||||
"GET /repos/{owner}/{repo}/commits/{ref}/check-runs",
|
||||
"GET /repos/{owner}/{repo}/commits/{ref}/check-suites",
|
||||
"GET /repos/{owner}/{repo}/commits/{ref}/status",
|
||||
"GET /repos/{owner}/{repo}/commits/{ref}/statuses",
|
||||
"GET /repos/{owner}/{repo}/contributors",
|
||||
"GET /repos/{owner}/{repo}/dependabot/alerts",
|
||||
"GET /repos/{owner}/{repo}/dependabot/secrets",
|
||||
"GET /repos/{owner}/{repo}/deployments",
|
||||
"GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses",
|
||||
"GET /repos/{owner}/{repo}/environments",
|
||||
"GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies",
|
||||
"GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/apps",
|
||||
"GET /repos/{owner}/{repo}/events",
|
||||
"GET /repos/{owner}/{repo}/forks",
|
||||
"GET /repos/{owner}/{repo}/hooks",
|
||||
"GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries",
|
||||
"GET /repos/{owner}/{repo}/invitations",
|
||||
"GET /repos/{owner}/{repo}/issues",
|
||||
"GET /repos/{owner}/{repo}/issues/comments",
|
||||
"GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions",
|
||||
"GET /repos/{owner}/{repo}/issues/events",
|
||||
"GET /repos/{owner}/{repo}/issues/{issue_number}/comments",
|
||||
"GET /repos/{owner}/{repo}/issues/{issue_number}/events",
|
||||
"GET /repos/{owner}/{repo}/issues/{issue_number}/labels",
|
||||
"GET /repos/{owner}/{repo}/issues/{issue_number}/reactions",
|
||||
"GET /repos/{owner}/{repo}/issues/{issue_number}/timeline",
|
||||
"GET /repos/{owner}/{repo}/keys",
|
||||
"GET /repos/{owner}/{repo}/labels",
|
||||
"GET /repos/{owner}/{repo}/milestones",
|
||||
"GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels",
|
||||
"GET /repos/{owner}/{repo}/notifications",
|
||||
"GET /repos/{owner}/{repo}/pages/builds",
|
||||
"GET /repos/{owner}/{repo}/projects",
|
||||
"GET /repos/{owner}/{repo}/pulls",
|
||||
"GET /repos/{owner}/{repo}/pulls/comments",
|
||||
"GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions",
|
||||
"GET /repos/{owner}/{repo}/pulls/{pull_number}/comments",
|
||||
"GET /repos/{owner}/{repo}/pulls/{pull_number}/commits",
|
||||
"GET /repos/{owner}/{repo}/pulls/{pull_number}/files",
|
||||
"GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews",
|
||||
"GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments",
|
||||
"GET /repos/{owner}/{repo}/releases",
|
||||
"GET /repos/{owner}/{repo}/releases/{release_id}/assets",
|
||||
"GET /repos/{owner}/{repo}/releases/{release_id}/reactions",
|
||||
"GET /repos/{owner}/{repo}/rules/branches/{branch}",
|
||||
"GET /repos/{owner}/{repo}/rulesets",
|
||||
"GET /repos/{owner}/{repo}/rulesets/rule-suites",
|
||||
"GET /repos/{owner}/{repo}/secret-scanning/alerts",
|
||||
"GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations",
|
||||
"GET /repos/{owner}/{repo}/security-advisories",
|
||||
"GET /repos/{owner}/{repo}/stargazers",
|
||||
"GET /repos/{owner}/{repo}/subscribers",
|
||||
"GET /repos/{owner}/{repo}/tags",
|
||||
"GET /repos/{owner}/{repo}/teams",
|
||||
"GET /repos/{owner}/{repo}/topics",
|
||||
"GET /repositories",
|
||||
"GET /repositories/{repository_id}/environments/{environment_name}/secrets",
|
||||
"GET /repositories/{repository_id}/environments/{environment_name}/variables",
|
||||
"GET /search/code",
|
||||
"GET /search/commits",
|
||||
"GET /search/issues",
|
||||
"GET /search/labels",
|
||||
"GET /search/repositories",
|
||||
"GET /search/topics",
|
||||
"GET /search/users",
|
||||
"GET /teams/{team_id}/discussions",
|
||||
"GET /teams/{team_id}/discussions/{discussion_number}/comments",
|
||||
"GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions",
|
||||
"GET /teams/{team_id}/discussions/{discussion_number}/reactions",
|
||||
"GET /teams/{team_id}/invitations",
|
||||
"GET /teams/{team_id}/members",
|
||||
"GET /teams/{team_id}/projects",
|
||||
"GET /teams/{team_id}/repos",
|
||||
"GET /teams/{team_id}/teams",
|
||||
"GET /user/blocks",
|
||||
"GET /user/codespaces",
|
||||
"GET /user/codespaces/secrets",
|
||||
"GET /user/emails",
|
||||
"GET /user/followers",
|
||||
"GET /user/following",
|
||||
"GET /user/gpg_keys",
|
||||
"GET /user/installations",
|
||||
"GET /user/installations/{installation_id}/repositories",
|
||||
"GET /user/issues",
|
||||
"GET /user/keys",
|
||||
"GET /user/marketplace_purchases",
|
||||
"GET /user/marketplace_purchases/stubbed",
|
||||
"GET /user/memberships/orgs",
|
||||
"GET /user/migrations",
|
||||
"GET /user/migrations/{migration_id}/repositories",
|
||||
"GET /user/orgs",
|
||||
"GET /user/packages",
|
||||
"GET /user/packages/{package_type}/{package_name}/versions",
|
||||
"GET /user/public_emails",
|
||||
"GET /user/repos",
|
||||
"GET /user/repository_invitations",
|
||||
"GET /user/social_accounts",
|
||||
"GET /user/ssh_signing_keys",
|
||||
"GET /user/starred",
|
||||
"GET /user/subscriptions",
|
||||
"GET /user/teams",
|
||||
"GET /users",
|
||||
"GET /users/{username}/events",
|
||||
"GET /users/{username}/events/orgs/{org}",
|
||||
"GET /users/{username}/events/public",
|
||||
"GET /users/{username}/followers",
|
||||
"GET /users/{username}/following",
|
||||
"GET /users/{username}/gists",
|
||||
"GET /users/{username}/gpg_keys",
|
||||
"GET /users/{username}/keys",
|
||||
"GET /users/{username}/orgs",
|
||||
"GET /users/{username}/packages",
|
||||
"GET /users/{username}/projects",
|
||||
"GET /users/{username}/received_events",
|
||||
"GET /users/{username}/received_events/public",
|
||||
"GET /users/{username}/repos",
|
||||
"GET /users/{username}/social_accounts",
|
||||
"GET /users/{username}/ssh_signing_keys",
|
||||
"GET /users/{username}/starred",
|
||||
"GET /users/{username}/subscriptions"
|
||||
];
|
||||
export {
|
||||
paginatingEndpoints
|
||||
};
|
||||
22
node_modules/@octokit/plugin-paginate-rest/dist-src/index.js
generated
vendored
Normal file
22
node_modules/@octokit/plugin-paginate-rest/dist-src/index.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { VERSION } from "./version.js";
|
||||
import { paginate } from "./paginate.js";
|
||||
import { iterator } from "./iterator.js";
|
||||
import { composePaginateRest } from "./compose-paginate.js";
|
||||
import {
|
||||
isPaginatingEndpoint,
|
||||
paginatingEndpoints
|
||||
} from "./paginating-endpoints.js";
|
||||
function paginateRest(octokit) {
|
||||
return {
|
||||
paginate: Object.assign(paginate.bind(null, octokit), {
|
||||
iterator: iterator.bind(null, octokit)
|
||||
})
|
||||
};
|
||||
}
|
||||
paginateRest.VERSION = VERSION;
|
||||
export {
|
||||
composePaginateRest,
|
||||
isPaginatingEndpoint,
|
||||
paginateRest,
|
||||
paginatingEndpoints
|
||||
};
|
||||
38
node_modules/@octokit/plugin-paginate-rest/dist-src/iterator.js
generated
vendored
Normal file
38
node_modules/@octokit/plugin-paginate-rest/dist-src/iterator.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
import { normalizePaginatedListResponse } from "./normalize-paginated-list-response.js";
|
||||
function iterator(octokit, route, parameters) {
|
||||
const options = typeof route === "function" ? route.endpoint(parameters) : octokit.request.endpoint(route, parameters);
|
||||
const requestMethod = typeof route === "function" ? route : octokit.request;
|
||||
const method = options.method;
|
||||
const headers = options.headers;
|
||||
let url = options.url;
|
||||
return {
|
||||
[Symbol.asyncIterator]: () => ({
|
||||
async next() {
|
||||
if (!url)
|
||||
return { done: true };
|
||||
try {
|
||||
const response = await requestMethod({ method, url, headers });
|
||||
const normalizedResponse = normalizePaginatedListResponse(response);
|
||||
url = ((normalizedResponse.headers.link || "").match(
|
||||
/<([^>]+)>;\s*rel="next"/
|
||||
) || [])[1];
|
||||
return { value: normalizedResponse };
|
||||
} catch (error) {
|
||||
if (error.status !== 409)
|
||||
throw error;
|
||||
url = "";
|
||||
return {
|
||||
value: {
|
||||
status: 200,
|
||||
headers: {},
|
||||
data: []
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
}
|
||||
export {
|
||||
iterator
|
||||
};
|
||||
31
node_modules/@octokit/plugin-paginate-rest/dist-src/normalize-paginated-list-response.js
generated
vendored
Normal file
31
node_modules/@octokit/plugin-paginate-rest/dist-src/normalize-paginated-list-response.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
function normalizePaginatedListResponse(response) {
|
||||
if (!response.data) {
|
||||
return {
|
||||
...response,
|
||||
data: []
|
||||
};
|
||||
}
|
||||
const responseNeedsNormalization = "total_count" in response.data && !("url" in response.data);
|
||||
if (!responseNeedsNormalization)
|
||||
return response;
|
||||
const incompleteResults = response.data.incomplete_results;
|
||||
const repositorySelection = response.data.repository_selection;
|
||||
const totalCount = response.data.total_count;
|
||||
delete response.data.incomplete_results;
|
||||
delete response.data.repository_selection;
|
||||
delete response.data.total_count;
|
||||
const namespaceKey = Object.keys(response.data)[0];
|
||||
const data = response.data[namespaceKey];
|
||||
response.data = data;
|
||||
if (typeof incompleteResults !== "undefined") {
|
||||
response.data.incomplete_results = incompleteResults;
|
||||
}
|
||||
if (typeof repositorySelection !== "undefined") {
|
||||
response.data.repository_selection = repositorySelection;
|
||||
}
|
||||
response.data.total_count = totalCount;
|
||||
return response;
|
||||
}
|
||||
export {
|
||||
normalizePaginatedListResponse
|
||||
};
|
||||
34
node_modules/@octokit/plugin-paginate-rest/dist-src/paginate.js
generated
vendored
Normal file
34
node_modules/@octokit/plugin-paginate-rest/dist-src/paginate.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import { iterator } from "./iterator.js";
|
||||
function paginate(octokit, route, parameters, mapFn) {
|
||||
if (typeof parameters === "function") {
|
||||
mapFn = parameters;
|
||||
parameters = void 0;
|
||||
}
|
||||
return gather(
|
||||
octokit,
|
||||
[],
|
||||
iterator(octokit, route, parameters)[Symbol.asyncIterator](),
|
||||
mapFn
|
||||
);
|
||||
}
|
||||
function gather(octokit, results, iterator2, mapFn) {
|
||||
return iterator2.next().then((result) => {
|
||||
if (result.done) {
|
||||
return results;
|
||||
}
|
||||
let earlyExit = false;
|
||||
function done() {
|
||||
earlyExit = true;
|
||||
}
|
||||
results = results.concat(
|
||||
mapFn ? mapFn(result.value, done) : result.value.data
|
||||
);
|
||||
if (earlyExit) {
|
||||
return results;
|
||||
}
|
||||
return gather(octokit, results, iterator2, mapFn);
|
||||
});
|
||||
}
|
||||
export {
|
||||
paginate
|
||||
};
|
||||
15
node_modules/@octokit/plugin-paginate-rest/dist-src/paginating-endpoints.js
generated
vendored
Normal file
15
node_modules/@octokit/plugin-paginate-rest/dist-src/paginating-endpoints.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import {
|
||||
paginatingEndpoints
|
||||
} from "./generated/paginating-endpoints.js";
|
||||
import { paginatingEndpoints as paginatingEndpoints2 } from "./generated/paginating-endpoints.js";
|
||||
function isPaginatingEndpoint(arg) {
|
||||
if (typeof arg === "string") {
|
||||
return paginatingEndpoints.includes(arg);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
export {
|
||||
isPaginatingEndpoint,
|
||||
paginatingEndpoints2 as paginatingEndpoints
|
||||
};
|
||||
4
node_modules/@octokit/plugin-paginate-rest/dist-src/version.js
generated
vendored
Normal file
4
node_modules/@octokit/plugin-paginate-rest/dist-src/version.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
const VERSION = "9.2.1";
|
||||
export {
|
||||
VERSION
|
||||
};
|
||||
2
node_modules/@octokit/plugin-paginate-rest/dist-types/compose-paginate.d.ts
generated
vendored
Normal file
2
node_modules/@octokit/plugin-paginate-rest/dist-types/compose-paginate.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { ComposePaginateInterface } from "./types.js";
|
||||
export declare const composePaginateRest: ComposePaginateInterface;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user