mirror of
https://github.com/ButlerLogic/action-autotag.git
synced 2025-09-14 09:04:02 +07:00
move node_modules
This commit is contained in:
21
node_modules/octokit/LICENSE
generated
vendored
Normal file
21
node_modules/octokit/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2023 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.
|
892
node_modules/octokit/README.md
generated
vendored
Normal file
892
node_modules/octokit/README.md
generated
vendored
Normal file
@ -0,0 +1,892 @@
|
||||
# octokit.js
|
||||
|
||||
> The all-batteries-included GitHub SDK for Browsers, Node.js, and Deno.
|
||||
|
||||
The `octokit` package integrates the three main Octokit libraries
|
||||
|
||||
1. **API client** (REST API requests, GraphQL API queries, Authentication)
|
||||
2. **App client** (GitHub App & installations, Webhooks, OAuth)
|
||||
3. **Action client** (Pre-authenticated API client for single repository)
|
||||
|
||||
## Table of contents
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Features](#features)
|
||||
- [Usage](#usage)
|
||||
- [`Octokit` API Client](#octokit-api-client)
|
||||
- [Constructor options](#constructor-options)
|
||||
- [Authentication](#authentication)
|
||||
- [Proxy Servers](#proxy-servers-nodejs-only)
|
||||
- [REST API](#rest-api)
|
||||
- [`octokit.rest` endpoint methods](#octokitrest-endpoint-methods)
|
||||
- [`octokit.request()`](#octokitrequest)
|
||||
- [Pagination](#pagination)
|
||||
- [Media Type previews and formats](#media-type-previews-and-formats)
|
||||
- [GraphQL API queries](#graphql-api-queries)
|
||||
- [Schema previews](#schema-previews)
|
||||
- [App client](#app-client)
|
||||
- [GitHub App](#github-app)
|
||||
- [Webhooks](#webhooks)
|
||||
- [OAuth](#oauth)
|
||||
- [App Server](#app-server)
|
||||
- [OAuth for browser apps](#oauth-for-browser-apps)
|
||||
- [Action client](#action-client)
|
||||
- [LICENSE](#license)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
## Features
|
||||
|
||||
- **Complete**. All features of GitHub's platform APIs are covered.
|
||||
- **Prescriptive**. All recommended best practises are implemented.
|
||||
- **Universal**. Works in all modern browsers, [Node.js](https://nodejs.org/), and [Deno](https://deno.land/).
|
||||
- **Tested**. All libraries have a 100% test coverage.
|
||||
- **Typed**. All libraries have extensive TypeScript declarations.
|
||||
- **Decomposable**. Use only the code you need. You can build your own Octokit in only a few lines of code or use the underlying static methods. Make your own tradeoff between functionality and bundle size.
|
||||
- **Extendable**. A feature missing? Add functionalities with plugins, hook into the request or webhook lifecycle or implement your own authentication strategy.
|
||||
|
||||
## Usage
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
Load <code>octokit</code> directly from <a href="https://cdn.skypack.dev">cdn.skypack.dev</a>
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { Octokit, App } from "https://cdn.skypack.dev/octokit";
|
||||
</script>
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Deno
|
||||
</th><td width=100%>
|
||||
Load <code>octokit</code> directly from <a href="https://cdn.skypack.dev">cdn.skypack.dev</a>
|
||||
|
||||
```ts
|
||||
import { Octokit, App } from "https://cdn.skypack.dev/octokit?dts";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Node 12+
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install octokit</code>, or <code>yarn add octokit</code>
|
||||
|
||||
```js
|
||||
import { Octokit, App } from "octokit";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Node 10 and below
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install octokit</code>, or <code>yarn add octokit</code>
|
||||
|
||||
```js
|
||||
const { Octokit, App } = require("octokit");
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## `Octokit` API Client
|
||||
|
||||
**standalone minimal Octokit**: [`@octokit/core`](https://github.com/octokit/core.js/#readme).
|
||||
|
||||
The `Octokit` client can be used to send requests to [GitHub's REST API](https://docs.github.com/rest/) and queries to [GitHub's GraphQL API](https://docs.github.com/graphql).
|
||||
|
||||
**Example**: Get the username for the authenticated user.
|
||||
|
||||
```js
|
||||
// Create a personal access token at https://github.com/settings/tokens/new?scopes=repo
|
||||
const octokit = new Octokit({ auth: `personal-access-token123` });
|
||||
|
||||
// Compare: https://docs.github.com/en/rest/reference/users#get-the-authenticated-user
|
||||
const {
|
||||
data: { login },
|
||||
} = await octokit.rest.users.getAuthenticated();
|
||||
console.log("Hello, %s", login);
|
||||
```
|
||||
|
||||
### Constructor options
|
||||
|
||||
The most commonly used options are
|
||||
|
||||
<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>userAgent</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>String</code>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
Setting a user agent is required for all requests sent to GitHub's Platform APIs. The user agent defaults to something like this: `octokit.js/v1.2.3 Node.js/v8.9.4 (macOS High Sierra; x64)`. It is recommend to set your own user agent, which will prepend the default one.
|
||||
|
||||
```js
|
||||
const octokit = new Octokit({
|
||||
userAgent: "my-app/v1.2.3",
|
||||
});
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>authStrategy</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>Function<code>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
Defaults to [`@octokit/auth-token`](https://github.com/octokit/auth-token.js#readme).
|
||||
|
||||
See [Authentication](#authentication) below.
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>auth</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>String</code> or <code>Object</code>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
Set to a [personal access token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) unless you changed the `authStrategy` option.
|
||||
|
||||
See [Authentication](#authentication) below.
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>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>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Advanced 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>request</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>Object</code>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
- `request.signal`: Use an [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) instance to cancel a request. [`abort-controller`](https://www.npmjs.com/package/abort-controller) is an implementation for Node.
|
||||
- `request.fetch`: Replacement for [built-in fetch method](https://github.com/bitinn/node-fetch). Useful for testing with [`fetch-mock`](https://github.com/wheresrhys/fetch-mock)
|
||||
|
||||
Node only
|
||||
|
||||
- `request.timeout` sets a request timeout, defaults to 0
|
||||
- `request.agent`: A [`http(s).Agent`](https://nodejs.org/api/http.html#http_class_http_agent) e.g. for proxy usage
|
||||
|
||||
The `request` option can also be set on a per-request basis.
|
||||
|
||||
</td></tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>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>throttle</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>Object</code>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
`Octokit` implements request throttling using [`@octokit/plugin-throttling`](https://github.com/octokit/plugin-throttling.js/#readme)
|
||||
|
||||
By default, requests are retried once and warnings are logged in case of hitting a rate or secondary rate limit.
|
||||
|
||||
```js
|
||||
{
|
||||
onRateLimit: (retryAfter, options, octokit) => {
|
||||
octokit.log.warn(
|
||||
`Request quota exhausted for request ${options.method} ${options.url}`
|
||||
);
|
||||
|
||||
if (options.request.retryCount === 0) {
|
||||
// only retries once
|
||||
octokit.log.info(`Retrying after ${retryAfter} seconds!`);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
onSecondaryRateLimit: (retryAfter, options, octokit) => {
|
||||
octokit.log.warn(
|
||||
`SecondaryRateLimit detected for request ${options.method} ${options.url}`
|
||||
);
|
||||
|
||||
if (options.request.retryCount === 0) {
|
||||
// only retries once
|
||||
octokit.log.info(`Retrying after ${retryAfter} seconds!`);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
To opt-out of this feature:
|
||||
|
||||
```js
|
||||
new Octokit({ throttle: { enabled: false } });
|
||||
```
|
||||
|
||||
Throttling in a cluster is supported using a Redis backend. See [`@octokit/plugin-throttling` Clustering](https://github.com/octokit/plugin-throttling.js/#clustering)
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>retry</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>Object</code>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
`Octokit` implements request retries using [`@octokit/plugin-retry`](https://github.com/octokit/plugin-retry.js/#readme)
|
||||
|
||||
To opt-out of this feature:
|
||||
|
||||
```js
|
||||
new Octokit({ retry: { enabled: false } });
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
### Authentication
|
||||
|
||||
By default, the `Octokit` API client supports authentication using a static token.
|
||||
|
||||
There are different means of authentication that are supported by GitHub, that are described in detail at [octokit/authentication-strategies.js](https://github.com/octokit/authentication-strategies.js/#readme). You can set each of them as the `authStrategy` constructor option, and pass the strategy options as the `auth` constructor option.
|
||||
|
||||
For example, in order to authenticate as a GitHub App Installation:
|
||||
|
||||
```js
|
||||
import { createAppAuth } from "@octokit/auth-app";
|
||||
const octokit = new Octokit({
|
||||
authStrategy: createAppAuth,
|
||||
auth: {
|
||||
appId: 1,
|
||||
privateKey: "-----BEGIN PRIVATE KEY-----\n...",
|
||||
installationId: 123,
|
||||
},
|
||||
});
|
||||
|
||||
// authenticates as app based on request URLs
|
||||
const {
|
||||
data: { slug },
|
||||
} = await octokit.rest.apps.getAuthenticated();
|
||||
|
||||
// creates an installation access token as needed
|
||||
// assumes that installationId 123 belongs to @octocat, otherwise the request will fail
|
||||
await octokit.rest.issues.create({
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
title: "Hello world from " + slug,
|
||||
});
|
||||
```
|
||||
|
||||
In most cases you can use the [`App`](#github-app) or [`OAuthApp`](#oauth-app) SDK which provide APIs and internal wiring to cover most usecase.
|
||||
|
||||
For example, to implement the above using `App`
|
||||
|
||||
```js
|
||||
const app = new App({ appId, privateKey });
|
||||
const { data: slug } = await app.octokit.rest.apps.getAuthenticated();
|
||||
const octokit = await app.getInstallationOctokit(123);
|
||||
await octokit.rest.issues.create({
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
title: "Hello world from " + slug,
|
||||
});
|
||||
```
|
||||
|
||||
Learn more about [how authentication strategies work](https://github.com/octokit/authentication-strategies.js/#how-authentication-strategies-work) or how to [create your own](https://github.com/octokit/authentication-strategies.js/#create-your-own-octokit-authentication-strategy-module).
|
||||
|
||||
### Proxy Servers (Node.js only)
|
||||
|
||||
By default, the `Octokit` API client does not make use of the standard proxy server environment variables. To add support for proxy servers you will need to provide an https client that supports them such as [proxy-agent](https://www.npmjs.com/package/proxy-agent).
|
||||
|
||||
For example, this would use a `proxy-agent` generated client that would configure the proxy based on the standard environment variables `http_proxy`, `https_proxy` and `no_proxy`:
|
||||
|
||||
```js
|
||||
import ProxyAgent from "proxy-agent";
|
||||
|
||||
const octokit = new Octokit({
|
||||
request: {
|
||||
agent: new ProxyAgent(),
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
If you are writing a module that uses `Octokit` and is designed to be used by other people, you should ensure that consumers can provide an alternative agent for your `Octokit` or as a parameter to specific calls such as:
|
||||
|
||||
```js
|
||||
octokit.rest.repos.get({
|
||||
owner,
|
||||
repo,
|
||||
request: { agent },
|
||||
});
|
||||
```
|
||||
|
||||
### REST API
|
||||
|
||||
There are two ways of using the GitHub REST API, the [`octokit.rest.*` endpoint methods](#octokitrest-endpoint-methods) and [`octokit.request`](#octokitrequest). Both act the same way, the `octokit.rest.*` methods are just added for convenience, they use `octokit.request` internally.
|
||||
|
||||
For example
|
||||
|
||||
```js
|
||||
await octokit.rest.issues.create({
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
title: "Hello, world!",
|
||||
body: "I created this issue using Octokit!",
|
||||
});
|
||||
```
|
||||
|
||||
Is the same as
|
||||
|
||||
```js
|
||||
await octokit.request("POST /repos/{owner}/{repo}/issues", {
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
title: "Hello, world!",
|
||||
body: "I created this issue using Octokit!",
|
||||
});
|
||||
```
|
||||
|
||||
In both cases a given request is authenticated, retried, and throttled transparently by the `octokit` instance which also manages the `accept` and `user-agent` headers as needed.
|
||||
|
||||
`octokit.request` can be used to send requests to other domains by passing a full URL and to send requests to endpoints that are not (yet) documented in [GitHub's REST API documentation](https://docs.github.com/rest).
|
||||
|
||||
#### `octokit.rest` endpoint methods
|
||||
|
||||
Every GitHub REST API endpoint has an associated `octokit.rest` endpoint method for better code readability and developer convenience. See [`@octokit/plugin-rest-endpoint-methods`](https://github.com/octokit/plugin-rest-endpoint-methods.js/#readme) for full details.
|
||||
|
||||
Example: [Create an issue](https://docs.github.com/en/rest/reference/issues#create-an-issue)
|
||||
|
||||
```js
|
||||
await octokit.rest.issues.create({
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
title: "Hello, world!",
|
||||
body: "I created this issue using Octokit!",
|
||||
});
|
||||
```
|
||||
|
||||
The `octokit.rest` endpoint methods are generated automatically from [GitHub's OpenAPI specification](https://github.com/github/rest-api-description/). We track operation ID and parameter name changes in order to implement deprecation warnings and reduce the frequency of breaking changes.
|
||||
|
||||
Under the covers, every endpoint method is just `octokit.request` with defaults set, so it supports the same parameters as well as the `.endpoint()` API.
|
||||
|
||||
#### `octokit.request()`
|
||||
|
||||
You can call the GitHub REST API directly using `octokit.request`. The `request` API matches GitHub's REST API documentation 1:1 so anything you see there, you can call using `request`. See [`@octokit/request`](https://github.com/octokit/request.js#readme) for all the details.
|
||||
|
||||
Example: [Create an issue](https://docs.github.com/en/rest/reference/issues#create-an-issue)
|
||||
|
||||
[](https://docs.github.com/en/rest/reference/issues#create-an-issue)
|
||||
|
||||
The `octokit.request` API call corresponding to that issue creation documentation looks like this:
|
||||
|
||||
```js
|
||||
// https://docs.github.com/en/rest/reference/issues#create-an-issue
|
||||
await octokit.request("POST /repos/{owner}/{repo}/issues", {
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
title: "Hello, world!",
|
||||
body: "I created this issue using Octokit!",
|
||||
});
|
||||
```
|
||||
|
||||
The 1st argument is the REST API route as listed in GitHub's API documentation. The 2nd argument is an object with all parameters, independent of whether they are used in the path, query, or body.
|
||||
|
||||
#### Pagination
|
||||
|
||||
All REST API endpoints that paginate return the first 30 items by default. If you want to retrieve all items, you can use the pagination API. The pagination API expects the REST API route as first argument, but you can also pass any of the `octokit.rest.*.list*` methods for convenience and better code readability.
|
||||
|
||||
Example: iterate through all issues in a repository
|
||||
|
||||
```js
|
||||
const iterator = octokit.paginate.iterator(octokit.rest.issues.listForRepo, {
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
per_page: 100,
|
||||
});
|
||||
|
||||
// iterate through each response
|
||||
for await (const { data: issues } of iterator) {
|
||||
for (const issue of issues) {
|
||||
console.log("Issue #%d: %s", issue.number, issue.title);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Using the [async iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of) is the most memory efficient way to iterate through all items. But you can also retrieve all items in a single call
|
||||
|
||||
```js
|
||||
const issues = await octokit.paginate(octokit.rest.issues.listForRepo, {
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
per_page: 100,
|
||||
});
|
||||
```
|
||||
|
||||
#### Media Type previews and formats
|
||||
|
||||
**Note**: The concept of _preview headers_ has been deprecated from REST API endpoints hosted via `api.github.com` but it still exists in GHES (GitHub Enterprise Server) version 3.2 and below. Instead of using _preview headers_ going forward, new features are now being tested using beta previews that users will have to opt-in to.
|
||||
|
||||
Media type previews and formats can be set using `mediaType: { format, previews }` on every request. Required API previews are set automatically on the respective REST API endpoint methods.
|
||||
|
||||
Example: retrieve the raw content of a `package.json` file
|
||||
|
||||
```js
|
||||
const { data } = await octokit.rest.repos.getContent({
|
||||
mediaType: {
|
||||
format: "raw",
|
||||
},
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
path: "package.json",
|
||||
});
|
||||
console.log("package name: %s", JSON.parse(data).name);
|
||||
```
|
||||
|
||||
Example: retrieve a repository with topics
|
||||
|
||||
```js
|
||||
const { data } = await octokit.rest.repos.getContent({
|
||||
mediaType: {
|
||||
previews: ["mercy"],
|
||||
},
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
});
|
||||
console.log("topics on octocat/hello-world: %j", data.topics);
|
||||
```
|
||||
|
||||
Learn more about [Media type formats](https://docs.github.com/en/rest/overview/media-types) and [previews](https://docs.github.com/en/enterprise-server@3.2/rest/overview/api-previews) used on GitHub Enterprise Server.
|
||||
|
||||
### GraphQL API queries
|
||||
|
||||
Octokit also supports GitHub's GraphQL API directly -- you can use the same queries shown in the documentation and available in the GraphQL explorer in your calls with `octokit.graphql`.
|
||||
|
||||
Example: get the login of the authenticated user
|
||||
|
||||
```js
|
||||
const {
|
||||
viewer: { login },
|
||||
} = await octokit.graphql(`{
|
||||
viewer {
|
||||
login
|
||||
}
|
||||
}`);
|
||||
```
|
||||
|
||||
Variables can be passed as 2nd argument
|
||||
|
||||
```js
|
||||
const { lastIssues } = await octokit.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",
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
#### Schema previews
|
||||
|
||||
Previews can be enabled using the `{mediaType: previews: [] }` option.
|
||||
|
||||
Example: create a label
|
||||
|
||||
```js
|
||||
await octokit.graphql(
|
||||
`mutation createLabel($repositoryId:ID!,name:String!,color:String!) {
|
||||
createLabel(input:{repositoryId:$repositoryId,name:$name}) {
|
||||
label: {
|
||||
id
|
||||
}
|
||||
}
|
||||
}`,
|
||||
{
|
||||
repositoryId: 1,
|
||||
name: "important",
|
||||
color: "cc0000",
|
||||
mediaType: {
|
||||
previews: ["bane"],
|
||||
},
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
Learn more about [GitHub's GraphQL schema previews](https://docs.github.com/en/graphql/overview/schema-previews)
|
||||
|
||||
## App client
|
||||
|
||||
The `App` client combines features for GitHub Apps, Webhooks, and OAuth
|
||||
|
||||
### GitHub App
|
||||
|
||||
**Standalone module**: [`@octokit/app`](https://github.com/octokit/app.js/#readme)
|
||||
|
||||
For integrators, GitHub Apps are a means of authentication and authorization. A GitHub app can be registered on a GitHub user or organization account. A GitHub App registration defines a set of permissions and webhooks events it wants to receive and provides a set of credentials in return. Users can grant access to repositories by installing them.
|
||||
|
||||
Some API endpoints require the GitHub app to authenticate as itself using a JSON Web Token (JWT). For requests affecting an installation, an installation access token has to be created using the app's credentials and the installation ID.
|
||||
|
||||
The `App` client takes care of all that for you.
|
||||
|
||||
Example: Dispatch a repository event in every repository the app is installed on
|
||||
|
||||
```js
|
||||
import { App } from "octokit";
|
||||
|
||||
const app = new App({ appId, privateKey });
|
||||
|
||||
for await (const { octokit, repository } of app.eachRepository.iterator()) {
|
||||
// https://docs.github.com/en/rest/reference/repos#create-a-repository-dispatch-event
|
||||
await octokit.rest.repos.createDispatchEvent({
|
||||
owner: repository.owner.login,
|
||||
repo: repository.name,
|
||||
event_type: "my_event",
|
||||
client_payload: {
|
||||
foo: "bar",
|
||||
},
|
||||
});
|
||||
console.log("Event distpatched for %s", repository.full_name);
|
||||
}
|
||||
```
|
||||
|
||||
Example: Get an `octokit` instance authenticated as an installation
|
||||
|
||||
```js
|
||||
const octokit = await app.getInstallationOctokit(123);
|
||||
```
|
||||
|
||||
Learn more about [apps](https://docs.github.com/apps).
|
||||
|
||||
### Webhooks
|
||||
|
||||
**Standalone module**: [`@octokit/webhooks`](https://github.com/octokit/webhooks.js/#readme)
|
||||
|
||||
When installing an app, events that the app registration requests will be sent as requests to the webhook URL set in the app's registration.
|
||||
|
||||
Webhook event requests are signed using the webhook secret, which is also part of the app's registration. You must verify that secret before handling the request payload.
|
||||
|
||||
The `app.webhooks.*` APIs provide methods to receiving, verifying, and handling webhook events.
|
||||
|
||||
Example: create a comment on new issues
|
||||
|
||||
```js
|
||||
import { createServer } from "node:http":
|
||||
import { App, createNodeMiddleware } from "octokit";
|
||||
|
||||
const app = new App({
|
||||
appId,
|
||||
privateKey,
|
||||
webhooks: { secret },
|
||||
});
|
||||
|
||||
app.webhooks.on("issues.opened", ({ octokit, payload }) => {
|
||||
return octokit.rest.issues.createComment({
|
||||
owner: payload.repository.owner.login,
|
||||
repo: payload.repository.name,
|
||||
body: "Hello, World!",
|
||||
});
|
||||
});
|
||||
|
||||
// Your app can now receive webhook events at `/api/github/webhooks`
|
||||
createServer(createNodeMiddleware(app)).listen(3000);
|
||||
```
|
||||
|
||||
For serverless environments, you can explicitly verify and receive an event
|
||||
|
||||
```js
|
||||
await app.webhooks.verifyAndReceive({
|
||||
id: request.headers["x-github-delivery"],
|
||||
name: request.headers["x-github-event"],
|
||||
signature: request.headers["x-hub-signature-256"],
|
||||
payload: request.body,
|
||||
});
|
||||
```
|
||||
|
||||
Learn more about [GitHub webhooks](https://docs.github.com/webhooks).
|
||||
|
||||
### OAuth
|
||||
|
||||
**Standalone module:** [`@octokit/oauth-app`](https://github.com/octokit/oauth-app.js/#readme)
|
||||
|
||||
Both OAuth Apps and GitHub Apps support authenticating GitHub users using OAuth, see [Authorizing OAuth Apps](https://docs.github.com/en/developers/apps/authorizing-oauth-apps) and [Identifying and authorizing users for GitHub Apps](https://docs.github.com/en/developers/apps/identifying-and-authorizing-users-for-github-apps).
|
||||
|
||||
There are some differences:
|
||||
|
||||
- Only OAuth Apps support scopes. GitHub apps have permissions, and access is granted via installations of the app on repositories.
|
||||
- Only GitHub Apps support expiring user tokens
|
||||
- Only GitHub Apps support creating a scoped token to reduce the permissions and repository access
|
||||
|
||||
`App` is for GitHub Apps. If you need OAuth App-specific functionality, use [`OAuthApp` instead](https://github.com/octokit/oauth-app.js/).
|
||||
|
||||
Example: Watch a repository when a user logs in using the OAuth web flow
|
||||
|
||||
```js
|
||||
import { createServer } from "node:http":
|
||||
import { App, createNodeMiddleware } from "octokit";
|
||||
|
||||
const app = new App({
|
||||
oauth: { clientId, clientSecret },
|
||||
});
|
||||
|
||||
app.oauth.on("token.created", async ({ token, octokit }) => {
|
||||
await octokit.rest.activity.setRepoSubscription({
|
||||
owner: "octocat",
|
||||
repo: "hello-world",
|
||||
subscribed: true,
|
||||
});
|
||||
});
|
||||
|
||||
// Your app can receive the OAuth redirect at /api/github/oauth/callback
|
||||
// Users can initiate the OAuth web flow by opening /api/oauth/login
|
||||
createServer(createNodeMiddleware(app)).listen(3000);
|
||||
```
|
||||
|
||||
For serverless environments, you can explicitly exchange the `code` from the OAuth web flow redirect for an access token.
|
||||
`app.oauth.createToken()` returns an authentication object and emits the "token.created" event.
|
||||
|
||||
```js
|
||||
const { token } = await app.oauth.createToken({
|
||||
code: request.query.code,
|
||||
});
|
||||
```
|
||||
|
||||
Example: create a token using the device flow.
|
||||
|
||||
```js
|
||||
const { token } = await app.oauth.createToken({
|
||||
async onVerification(verification) {
|
||||
await sendMessageToUser(
|
||||
request.body.phoneNumber,
|
||||
`Your code is ${verification.user_code}. Enter it at ${verification.verification_uri}`
|
||||
);
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
Example: Create an OAuth App Server with default scopes
|
||||
|
||||
```js
|
||||
import { createServer } from "node:http":
|
||||
import { OAuthApp, createNodeMiddleware } from "octokit";
|
||||
|
||||
const app = new OAuthApp({
|
||||
clientId,
|
||||
clientSecret,
|
||||
defaultScopes: ["repo", "gist"],
|
||||
});
|
||||
|
||||
app.oauth.on("token", async ({ token, octokit }) => {
|
||||
await octokit.rest.gists.create({
|
||||
description: "I created this gist using Octokit!",
|
||||
public: true,
|
||||
files: {
|
||||
"example.js": `/* some code here */`,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
// Your app can receive the OAuth redirect at /api/github/oauth/callback
|
||||
// Users can initiate the OAuth web flow by opening /api/oauth/login
|
||||
createServer(createNodeMiddleware(app)).listen(3000);
|
||||
```
|
||||
|
||||
### App Server
|
||||
|
||||
After registering your GitHub app, you need to create and deploy a server which can retrieve the webhook event requests from GitHub as well as accept redirects from the OAuth user web flow.
|
||||
|
||||
The simplest way to create such a server is to use `createNodeMiddleware()`, it works with both, Node's [`http.createServer()`](https://nodejs.org/api/http.html#http_http_createserver_options_requestlistener) method as well as an [Express middleware](https://expressjs.com/en/guide/using-middleware.html).
|
||||
|
||||
The default routes that the middleware exposes are
|
||||
|
||||
| Route | Route Description |
|
||||
| --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `POST /api/github/webhooks` | Endpoint to receive GitHub Webhook Event requests |
|
||||
| `GET /api/github/oauth/login` | Redirects to GitHub's authorization endpoint. Accepts optional `?state` and `?scopes` query parameters. `?scopes` is a comma-separated list of [supported OAuth scope names](https://docs.github.com/en/developers/apps/scopes-for-oauth-apps#available-scopes) |
|
||||
| `GET /api/github/oauth/callback` | The client's redirect endpoint. This is where the `token` event gets triggered |
|
||||
| `POST /api/github/oauth/token` | Exchange an authorization code for an OAuth Access token. If successful, the `token` event gets triggered. |
|
||||
| `GET /api/github/oauth/token` | Check if token is valid. Must authenticate using token in `Authorization` header. Uses GitHub's [`POST /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#check-a-token) endpoint |
|
||||
| `PATCH /api/github/oauth/token` | Resets a token (invalidates current one, returns new token). Must authenticate using token in `Authorization` header. Uses GitHub's [`PATCH /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#reset-a-token) endpoint. |
|
||||
| `PATCH /api/github/oauth/refresh-token` | Refreshes an expiring token (invalidates current one, returns new access token and refresh token). Must authenticate using token in `Authorization` header. Uses GitHub's [`POST https://github.com/login/oauth/access_token`](https://docs.github.com/en/developers/apps/refreshing-user-to-server-access-tokens#renewing-a-user-token-with-a-refresh-token) OAuth endpoint. |
|
||||
| `POST /api/github/oauth/token/scoped` | Creates a scoped token (does not invalidate the current one). Must authenticate using token in `Authorization` header. Uses GitHub's [`POST /applications/{client_id}/token/scoped`](https://docs.github.com/en/rest/reference/apps#create-a-scoped-access-token) endpoint. |
|
||||
| `DELETE /api/github/oauth/token` | Invalidates current token, basically the equivalent of a logout. Must authenticate using token in `Authorization` header. |
|
||||
| `DELETE /api/github/oauth/grant` | Revokes the user's grant, basically the equivalent of an uninstall. must authenticate using token in `Authorization` header. |
|
||||
|
||||
Example: create a GitHub server with express
|
||||
|
||||
```js
|
||||
import express from "express";
|
||||
import { App, createNodeMiddleware } from "octokit";
|
||||
|
||||
const expressApp = express();
|
||||
const octokitApp = new App({
|
||||
appId,
|
||||
privateKey,
|
||||
webhooks: { secret },
|
||||
oauth: { clientId, clientSecret },
|
||||
});
|
||||
|
||||
expressApp.use(createNodeMiddleware(app));
|
||||
|
||||
expressApp.listen(3000, () => {
|
||||
console.log(`Example app listening at http://localhost:3000`);
|
||||
});
|
||||
```
|
||||
|
||||
### OAuth for browser apps
|
||||
|
||||
You must not expose your app's client secret to the user, so you cannot use the `App` constructor. Instead, you have to create a server using the `App` constructor which exposes the `/api/github/oauth/*` routes, through which you can safely implement an OAuth login for apps running in a web browser.
|
||||
|
||||
If you set `(User) Authorization callback URL` to your own app, than you need to read out the `?code=...&state=...` query parameters, compare the `state` parameter to the value returned by `app.oauthLoginUrl()` earlier to protect against forgery attacks, then exchange the `code` for an OAuth Authorization token.
|
||||
|
||||
If you run an [app server](#app-server) as described above, the default route to do that is `POST /api/github/oauth/token`.
|
||||
|
||||
Once you successfully retrieved the token, it is also recommended to remove the `?code=...&state=...` query parameters from the browser's URL
|
||||
|
||||
```js
|
||||
const code = new URL(location.href).searchParams.get("code");
|
||||
if (code) {
|
||||
// remove ?code=... from URL
|
||||
const path =
|
||||
location.pathname +
|
||||
location.search.replace(/\b(code|state)=\w+/g, "").replace(/[?&]+$/, "");
|
||||
history.replaceState({}, "", path);
|
||||
|
||||
// exchange the code for a token with your backend.
|
||||
// If you use https://github.com/octokit/oauth-app.js
|
||||
// the exchange would look something like this
|
||||
const response = await fetch("/api/github/oauth/token", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ code }),
|
||||
});
|
||||
const { token } = await response.json();
|
||||
// `token` is the OAuth Access Token that can be use
|
||||
|
||||
const { Octokit } = await import("https://cdn.skypack.dev/@octokit/core");
|
||||
const octokit = new Octokit({ auth: token });
|
||||
|
||||
const {
|
||||
data: { login },
|
||||
} = await octokit.request("GET /user");
|
||||
alert("Hi there, " + login);
|
||||
}
|
||||
```
|
||||
|
||||
🚧 We are working on [`@octokit/auth-oauth-user-client`](https://github.com/octokit/auth-oauth-user-client.js#readme) to provide a simple API for all methods related to OAuth user tokens.
|
||||
|
||||
The plan is to add an new `GET /api/github/oauth/octokit.js` route to the node middleware which will return a JavaScript file that can be imported into an HTML file. It will make a pre-authenticated `octokit` Instance available.
|
||||
|
||||
## Action client
|
||||
|
||||
**standalone module:** [`@octokit/action`](https://github.com/octokit/action.js#readme)
|
||||
|
||||
🚧 A fully fledged `Action` client is pending. You can use [`@actions/github`](https://github.com/actions/toolkit/tree/main/packages/github) for the time being
|
||||
|
||||
## LICENSE
|
||||
|
||||
[MIT](LICENSE)
|
57
node_modules/octokit/dist-node/index.js
generated
vendored
Normal file
57
node_modules/octokit/dist-node/index.js
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var core = require('@octokit/core');
|
||||
var pluginPaginateRest = require('@octokit/plugin-paginate-rest');
|
||||
var pluginRestEndpointMethods = require('@octokit/plugin-rest-endpoint-methods');
|
||||
var pluginRetry = require('@octokit/plugin-retry');
|
||||
var pluginThrottling = require('@octokit/plugin-throttling');
|
||||
var app = require('@octokit/app');
|
||||
var oauthApp = require('@octokit/oauth-app');
|
||||
|
||||
const VERSION = "2.0.14";
|
||||
|
||||
const Octokit = core.Octokit.plugin(pluginRestEndpointMethods.restEndpointMethods, pluginPaginateRest.paginateRest, pluginRetry.retry, pluginThrottling.throttling).defaults({
|
||||
userAgent: `octokit.js/${VERSION}`,
|
||||
throttle: {
|
||||
onRateLimit,
|
||||
onSecondaryRateLimit
|
||||
}
|
||||
});
|
||||
// istanbul ignore next no need to test internals of the throttle plugin
|
||||
function onRateLimit(retryAfter, options, octokit) {
|
||||
octokit.log.warn(`Request quota exhausted for request ${options.method} ${options.url}`);
|
||||
if (options.request.retryCount === 0) {
|
||||
// only retries once
|
||||
octokit.log.info(`Retrying after ${retryAfter} seconds!`);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// istanbul ignore next no need to test internals of the throttle plugin
|
||||
function onSecondaryRateLimit(retryAfter, options, octokit) {
|
||||
octokit.log.warn(`SecondaryRateLimit detected for request ${options.method} ${options.url}`);
|
||||
if (options.request.retryCount === 0) {
|
||||
// only retries once
|
||||
octokit.log.info(`Retrying after ${retryAfter} seconds!`);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
const App = app.App.defaults({
|
||||
Octokit
|
||||
});
|
||||
const OAuthApp = oauthApp.OAuthApp.defaults({
|
||||
Octokit
|
||||
});
|
||||
|
||||
Object.defineProperty(exports, 'createNodeMiddleware', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return app.createNodeMiddleware;
|
||||
}
|
||||
});
|
||||
exports.App = App;
|
||||
exports.OAuthApp = OAuthApp;
|
||||
exports.Octokit = Octokit;
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/octokit/dist-node/index.js.map
generated
vendored
Normal file
1
node_modules/octokit/dist-node/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../dist-src/version.js","../dist-src/octokit.js","../dist-src/app.js"],"sourcesContent":["export const VERSION = \"2.0.14\";\n","import { Octokit as OctokitCore } from \"@octokit/core\";\nimport { paginateRest } from \"@octokit/plugin-paginate-rest\";\nimport { restEndpointMethods } from \"@octokit/plugin-rest-endpoint-methods\";\nimport { retry } from \"@octokit/plugin-retry\";\nimport { throttling } from \"@octokit/plugin-throttling\";\nimport { VERSION } from \"./version\";\nexport const Octokit = OctokitCore.plugin(restEndpointMethods, paginateRest, retry, throttling).defaults({\n userAgent: `octokit.js/${VERSION}`,\n throttle: {\n onRateLimit,\n onSecondaryRateLimit,\n },\n});\n// istanbul ignore next no need to test internals of the throttle plugin\nfunction onRateLimit(retryAfter, options, octokit) {\n octokit.log.warn(`Request quota exhausted for request ${options.method} ${options.url}`);\n if (options.request.retryCount === 0) {\n // only retries once\n octokit.log.info(`Retrying after ${retryAfter} seconds!`);\n return true;\n }\n}\n// istanbul ignore next no need to test internals of the throttle plugin\nfunction onSecondaryRateLimit(retryAfter, options, octokit) {\n octokit.log.warn(`SecondaryRateLimit detected for request ${options.method} ${options.url}`);\n if (options.request.retryCount === 0) {\n // only retries once\n octokit.log.info(`Retrying after ${retryAfter} seconds!`);\n return true;\n }\n}\n","import { App as DefaultApp } from \"@octokit/app\";\nimport { OAuthApp as DefaultOAuthApp } from \"@octokit/oauth-app\";\nimport { Octokit } from \"./octokit\";\nexport const App = DefaultApp.defaults({ Octokit });\nexport const OAuthApp = DefaultOAuthApp.defaults({ Octokit });\nexport { createNodeMiddleware } from \"@octokit/app\";\n"],"names":["VERSION","Octokit","OctokitCore","plugin","restEndpointMethods","paginateRest","retry","throttling","defaults","userAgent","throttle","onRateLimit","onSecondaryRateLimit","retryAfter","options","octokit","log","warn","method","url","request","retryCount","info","App","DefaultApp","OAuthApp","DefaultOAuthApp"],"mappings":";;;;;;;;;;;;AAAO,MAAMA,OAAO,GAAG,mBAAmB;;MCM7BC,OAAO,GAAGC,YAAW,CAACC,MAAM,CAACC,6CAAmB,EAAEC,+BAAY,EAAEC,iBAAK,EAAEC,2BAAU,CAAC,CAACC,QAAQ,CAAC;EACrGC,SAAS,EAAG,cAAaT,OAAQ,EAAC;EAClCU,QAAQ,EAAE;IACNC,WAAW;IACXC;;AAER,CAAC,CAAC;AACF;AACA,SAASD,WAAW,CAACE,UAAU,EAAEC,OAAO,EAAEC,OAAO,EAAE;EAC/CA,OAAO,CAACC,GAAG,CAACC,IAAI,CAAE,uCAAsCH,OAAO,CAACI,MAAO,IAAGJ,OAAO,CAACK,GAAI,EAAC,CAAC;EACxF,IAAIL,OAAO,CAACM,OAAO,CAACC,UAAU,KAAK,CAAC,EAAE;;IAElCN,OAAO,CAACC,GAAG,CAACM,IAAI,CAAE,kBAAiBT,UAAW,WAAU,CAAC;IACzD,OAAO,IAAI;;AAEnB;AACA;AACA,SAASD,oBAAoB,CAACC,UAAU,EAAEC,OAAO,EAAEC,OAAO,EAAE;EACxDA,OAAO,CAACC,GAAG,CAACC,IAAI,CAAE,2CAA0CH,OAAO,CAACI,MAAO,IAAGJ,OAAO,CAACK,GAAI,EAAC,CAAC;EAC5F,IAAIL,OAAO,CAACM,OAAO,CAACC,UAAU,KAAK,CAAC,EAAE;;IAElCN,OAAO,CAACC,GAAG,CAACM,IAAI,CAAE,kBAAiBT,UAAW,WAAU,CAAC;IACzD,OAAO,IAAI;;AAEnB;;MC3BaU,GAAG,GAAGC,OAAU,CAAChB,QAAQ,CAAC;EAAEP;AAAQ,CAAC,CAAC;AACnD,MAAawB,QAAQ,GAAGC,iBAAe,CAAClB,QAAQ,CAAC;EAAEP;AAAQ,CAAC,CAAC;;;;;;;;;;;;"}
|
6
node_modules/octokit/dist-src/app.js
generated
vendored
Normal file
6
node_modules/octokit/dist-src/app.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import { App as DefaultApp } from "@octokit/app";
|
||||
import { OAuthApp as DefaultOAuthApp } from "@octokit/oauth-app";
|
||||
import { Octokit } from "./octokit";
|
||||
export const App = DefaultApp.defaults({ Octokit });
|
||||
export const OAuthApp = DefaultOAuthApp.defaults({ Octokit });
|
||||
export { createNodeMiddleware } from "@octokit/app";
|
2
node_modules/octokit/dist-src/index.js
generated
vendored
Normal file
2
node_modules/octokit/dist-src/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export { Octokit } from "./octokit";
|
||||
export { App, OAuthApp, createNodeMiddleware } from "./app";
|
31
node_modules/octokit/dist-src/octokit.js
generated
vendored
Normal file
31
node_modules/octokit/dist-src/octokit.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
import { Octokit as OctokitCore } from "@octokit/core";
|
||||
import { paginateRest } from "@octokit/plugin-paginate-rest";
|
||||
import { restEndpointMethods } from "@octokit/plugin-rest-endpoint-methods";
|
||||
import { retry } from "@octokit/plugin-retry";
|
||||
import { throttling } from "@octokit/plugin-throttling";
|
||||
import { VERSION } from "./version";
|
||||
export const Octokit = OctokitCore.plugin(restEndpointMethods, paginateRest, retry, throttling).defaults({
|
||||
userAgent: `octokit.js/${VERSION}`,
|
||||
throttle: {
|
||||
onRateLimit,
|
||||
onSecondaryRateLimit,
|
||||
},
|
||||
});
|
||||
// istanbul ignore next no need to test internals of the throttle plugin
|
||||
function onRateLimit(retryAfter, options, octokit) {
|
||||
octokit.log.warn(`Request quota exhausted for request ${options.method} ${options.url}`);
|
||||
if (options.request.retryCount === 0) {
|
||||
// only retries once
|
||||
octokit.log.info(`Retrying after ${retryAfter} seconds!`);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// istanbul ignore next no need to test internals of the throttle plugin
|
||||
function onSecondaryRateLimit(retryAfter, options, octokit) {
|
||||
octokit.log.warn(`SecondaryRateLimit detected for request ${options.method} ${options.url}`);
|
||||
if (options.request.retryCount === 0) {
|
||||
// only retries once
|
||||
octokit.log.info(`Retrying after ${retryAfter} seconds!`);
|
||||
return true;
|
||||
}
|
||||
}
|
1
node_modules/octokit/dist-src/version.js
generated
vendored
Normal file
1
node_modules/octokit/dist-src/version.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export const VERSION = "2.0.14";
|
89
node_modules/octokit/dist-types/app.d.ts
generated
vendored
Normal file
89
node_modules/octokit/dist-types/app.d.ts
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
import { App as DefaultApp } from "@octokit/app";
|
||||
import { OAuthApp as DefaultOAuthApp } from "@octokit/oauth-app";
|
||||
export declare const App: (new (...args: any[]) => {
|
||||
octokit: import("@octokit/core").Octokit & {
|
||||
paginate: import("@octokit/plugin-paginate-rest").PaginateInterface;
|
||||
} & import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api & {
|
||||
retry: {
|
||||
retryRequest: (error: import("@octokit/request-error").RequestError, retries: number, retryAfter: number) => import("@octokit/request-error").RequestError;
|
||||
};
|
||||
};
|
||||
webhooks: import("@octokit/webhooks").Webhooks<{
|
||||
octokit: import("@octokit/core").Octokit & {
|
||||
paginate: import("@octokit/plugin-paginate-rest").PaginateInterface;
|
||||
} & import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api & {
|
||||
retry: {
|
||||
retryRequest: (error: import("@octokit/request-error").RequestError, retries: number, retryAfter: number) => import("@octokit/request-error").RequestError;
|
||||
};
|
||||
};
|
||||
}>;
|
||||
oauth: DefaultOAuthApp<{
|
||||
clientType: "github-app";
|
||||
Octokit: typeof import("@octokit/core").Octokit & import("@octokit/core/dist-types/types").Constructor<{
|
||||
paginate: import("@octokit/plugin-paginate-rest").PaginateInterface;
|
||||
} & import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api & {
|
||||
retry: {
|
||||
retryRequest: (error: import("@octokit/request-error").RequestError, retries: number, retryAfter: number) => import("@octokit/request-error").RequestError;
|
||||
};
|
||||
}>;
|
||||
}>;
|
||||
getInstallationOctokit: import("@octokit/app/dist-types/types").GetInstallationOctokitInterface<import("@octokit/core").Octokit & {
|
||||
paginate: import("@octokit/plugin-paginate-rest").PaginateInterface;
|
||||
} & import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api & {
|
||||
retry: {
|
||||
retryRequest: (error: import("@octokit/request-error").RequestError, retries: number, retryAfter: number) => import("@octokit/request-error").RequestError;
|
||||
};
|
||||
}>;
|
||||
eachInstallation: import("@octokit/app/dist-types/types").EachInstallationInterface<import("@octokit/core").Octokit & {
|
||||
paginate: import("@octokit/plugin-paginate-rest").PaginateInterface;
|
||||
} & import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api & {
|
||||
retry: {
|
||||
retryRequest: (error: import("@octokit/request-error").RequestError, retries: number, retryAfter: number) => import("@octokit/request-error").RequestError;
|
||||
};
|
||||
}>;
|
||||
eachRepository: import("@octokit/app/dist-types/types").EachRepositoryInterface<import("@octokit/core").Octokit & {
|
||||
paginate: import("@octokit/plugin-paginate-rest").PaginateInterface;
|
||||
} & import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api & {
|
||||
retry: {
|
||||
retryRequest: (error: import("@octokit/request-error").RequestError, retries: number, retryAfter: number) => import("@octokit/request-error").RequestError;
|
||||
};
|
||||
}>;
|
||||
log: {
|
||||
[key: string]: unknown;
|
||||
debug: (message: string, additionalInfo?: object | undefined) => void;
|
||||
info: (message: string, additionalInfo?: object | undefined) => void;
|
||||
warn: (message: string, additionalInfo?: object | undefined) => void;
|
||||
error: (message: string, additionalInfo?: object | undefined) => void;
|
||||
};
|
||||
}) & typeof DefaultApp;
|
||||
export type App = InstanceType<typeof App>;
|
||||
export declare const OAuthApp: (new (...args: any[]) => {
|
||||
type: "oauth-app";
|
||||
on: import("@octokit/oauth-app/dist-types/types").AddEventHandler<{
|
||||
Octokit: typeof import("@octokit/core").Octokit & import("@octokit/core/dist-types/types").Constructor<{
|
||||
paginate: import("@octokit/plugin-paginate-rest").PaginateInterface;
|
||||
} & import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api & {
|
||||
retry: {
|
||||
retryRequest: (error: import("@octokit/request-error").RequestError, retries: number, retryAfter: number) => import("@octokit/request-error").RequestError;
|
||||
};
|
||||
}>;
|
||||
}>;
|
||||
octokit: import("@octokit/core").Octokit & {
|
||||
paginate: import("@octokit/plugin-paginate-rest").PaginateInterface;
|
||||
} & import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api & {
|
||||
retry: {
|
||||
retryRequest: (error: import("@octokit/request-error").RequestError, retries: number, retryAfter: number) => import("@octokit/request-error").RequestError;
|
||||
};
|
||||
};
|
||||
getUserOctokit: import("@octokit/oauth-app/dist-types/methods/get-user-octokit").GetUserOctokitWithStateInterface<"oauth-app">;
|
||||
getWebFlowAuthorizationUrl: import("@octokit/oauth-app/dist-types/methods/get-web-flow-authorization-url").GetWebFlowAuthorizationUrlInterface<"oauth-app">;
|
||||
createToken: import("@octokit/oauth-app/dist-types/methods/create-token").CreateTokenInterface<"oauth-app">;
|
||||
checkToken: import("@octokit/oauth-app/dist-types/methods/check-token").CheckTokenInterface<"oauth-app">;
|
||||
resetToken: import("@octokit/oauth-app/dist-types/methods/reset-token").ResetTokenInterface<"oauth-app">;
|
||||
refreshToken: import("@octokit/oauth-app/dist-types/methods/refresh-token").RefreshTokenInterface;
|
||||
scopeToken: import("@octokit/oauth-app/dist-types/methods/scope-token").ScopeTokenInterface;
|
||||
deleteToken: import("@octokit/oauth-app/dist-types/methods/delete-token").DeleteTokenInterface;
|
||||
deleteAuthorization: import("@octokit/oauth-app/dist-types/methods/delete-authorization").DeleteAuthorizationInterface;
|
||||
}) & typeof DefaultOAuthApp;
|
||||
export type OAuthApp = InstanceType<typeof OAuthApp>;
|
||||
export { createNodeMiddleware } from "@octokit/app";
|
2
node_modules/octokit/dist-types/index.d.ts
generated
vendored
Normal file
2
node_modules/octokit/dist-types/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export { Octokit } from "./octokit";
|
||||
export { App, OAuthApp, createNodeMiddleware } from "./app";
|
9
node_modules/octokit/dist-types/octokit.d.ts
generated
vendored
Normal file
9
node_modules/octokit/dist-types/octokit.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import { Octokit as OctokitCore } from "@octokit/core";
|
||||
export declare const Octokit: typeof OctokitCore & import("@octokit/core/dist-types/types").Constructor<{
|
||||
paginate: import("@octokit/plugin-paginate-rest").PaginateInterface;
|
||||
} & import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api & {
|
||||
retry: {
|
||||
retryRequest: (error: import("@octokit/request-error").RequestError, retries: number, retryAfter: number) => import("@octokit/request-error").RequestError;
|
||||
};
|
||||
}>;
|
||||
export type Octokit = InstanceType<typeof Octokit>;
|
1
node_modules/octokit/dist-types/version.d.ts
generated
vendored
Normal file
1
node_modules/octokit/dist-types/version.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export declare const VERSION = "2.0.14";
|
42
node_modules/octokit/dist-web/index.js
generated
vendored
Normal file
42
node_modules/octokit/dist-web/index.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
import { Octokit as Octokit$1 } from '@octokit/core';
|
||||
import { paginateRest } from '@octokit/plugin-paginate-rest';
|
||||
import { restEndpointMethods } from '@octokit/plugin-rest-endpoint-methods';
|
||||
import { retry } from '@octokit/plugin-retry';
|
||||
import { throttling } from '@octokit/plugin-throttling';
|
||||
import { App as App$1 } from '@octokit/app';
|
||||
export { createNodeMiddleware } from '@octokit/app';
|
||||
import { OAuthApp as OAuthApp$1 } from '@octokit/oauth-app';
|
||||
|
||||
const VERSION = "2.0.14";
|
||||
|
||||
const Octokit = Octokit$1.plugin(restEndpointMethods, paginateRest, retry, throttling).defaults({
|
||||
userAgent: `octokit.js/${VERSION}`,
|
||||
throttle: {
|
||||
onRateLimit,
|
||||
onSecondaryRateLimit,
|
||||
},
|
||||
});
|
||||
// istanbul ignore next no need to test internals of the throttle plugin
|
||||
function onRateLimit(retryAfter, options, octokit) {
|
||||
octokit.log.warn(`Request quota exhausted for request ${options.method} ${options.url}`);
|
||||
if (options.request.retryCount === 0) {
|
||||
// only retries once
|
||||
octokit.log.info(`Retrying after ${retryAfter} seconds!`);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// istanbul ignore next no need to test internals of the throttle plugin
|
||||
function onSecondaryRateLimit(retryAfter, options, octokit) {
|
||||
octokit.log.warn(`SecondaryRateLimit detected for request ${options.method} ${options.url}`);
|
||||
if (options.request.retryCount === 0) {
|
||||
// only retries once
|
||||
octokit.log.info(`Retrying after ${retryAfter} seconds!`);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
const App = App$1.defaults({ Octokit });
|
||||
const OAuthApp = OAuthApp$1.defaults({ Octokit });
|
||||
|
||||
export { App, OAuthApp, Octokit };
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/octokit/dist-web/index.js.map
generated
vendored
Normal file
1
node_modules/octokit/dist-web/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../dist-src/version.js","../dist-src/octokit.js","../dist-src/app.js"],"sourcesContent":["export const VERSION = \"2.0.14\";\n","import { Octokit as OctokitCore } from \"@octokit/core\";\nimport { paginateRest } from \"@octokit/plugin-paginate-rest\";\nimport { restEndpointMethods } from \"@octokit/plugin-rest-endpoint-methods\";\nimport { retry } from \"@octokit/plugin-retry\";\nimport { throttling } from \"@octokit/plugin-throttling\";\nimport { VERSION } from \"./version\";\nexport const Octokit = OctokitCore.plugin(restEndpointMethods, paginateRest, retry, throttling).defaults({\n userAgent: `octokit.js/${VERSION}`,\n throttle: {\n onRateLimit,\n onSecondaryRateLimit,\n },\n});\n// istanbul ignore next no need to test internals of the throttle plugin\nfunction onRateLimit(retryAfter, options, octokit) {\n octokit.log.warn(`Request quota exhausted for request ${options.method} ${options.url}`);\n if (options.request.retryCount === 0) {\n // only retries once\n octokit.log.info(`Retrying after ${retryAfter} seconds!`);\n return true;\n }\n}\n// istanbul ignore next no need to test internals of the throttle plugin\nfunction onSecondaryRateLimit(retryAfter, options, octokit) {\n octokit.log.warn(`SecondaryRateLimit detected for request ${options.method} ${options.url}`);\n if (options.request.retryCount === 0) {\n // only retries once\n octokit.log.info(`Retrying after ${retryAfter} seconds!`);\n return true;\n }\n}\n","import { App as DefaultApp } from \"@octokit/app\";\nimport { OAuthApp as DefaultOAuthApp } from \"@octokit/oauth-app\";\nimport { Octokit } from \"./octokit\";\nexport const App = DefaultApp.defaults({ Octokit });\nexport const OAuthApp = DefaultOAuthApp.defaults({ Octokit });\nexport { createNodeMiddleware } from \"@octokit/app\";\n"],"names":["OctokitCore","DefaultApp","DefaultOAuthApp"],"mappings":";;;;;;;;;AAAO,MAAM,OAAO,GAAG,mBAAmB;;ACM9B,MAAC,OAAO,GAAGA,SAAW,CAAC,MAAM,CAAC,mBAAmB,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC;AACzG,IAAI,SAAS,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AACtC,IAAI,QAAQ,EAAE;AACd,QAAQ,WAAW;AACnB,QAAQ,oBAAoB;AAC5B,KAAK;AACL,CAAC,CAAC,CAAC;AACH;AACA,SAAS,WAAW,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE;AACnD,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,oCAAoC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7F,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,UAAU,KAAK,CAAC,EAAE;AAC1C;AACA,QAAQ,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;AAClE,QAAQ,OAAO,IAAI,CAAC;AACpB,KAAK;AACL,CAAC;AACD;AACA,SAAS,oBAAoB,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE;AAC5D,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,wCAAwC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACjG,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,UAAU,KAAK,CAAC,EAAE;AAC1C;AACA,QAAQ,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;AAClE,QAAQ,OAAO,IAAI,CAAC;AACpB,KAAK;AACL,CAAC;;AC3BW,MAAC,GAAG,GAAGC,KAAU,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;AACpD,AAAY,MAAC,QAAQ,GAAGC,UAAe,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;;;;"}
|
55
node_modules/octokit/package.json
generated
vendored
Normal file
55
node_modules/octokit/package.json
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
{
|
||||
"name": "octokit",
|
||||
"description": "The all-batteries-included GitHub SDK for Browsers, Node.js, and Deno",
|
||||
"version": "2.0.14",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist-*/",
|
||||
"bin/"
|
||||
],
|
||||
"source": "dist-src/index.js",
|
||||
"types": "dist-types/index.d.ts",
|
||||
"main": "dist-node/index.js",
|
||||
"module": "dist-web/index.js",
|
||||
"pika": true,
|
||||
"sideEffects": false,
|
||||
"keywords": [
|
||||
"github",
|
||||
"api",
|
||||
"sdk",
|
||||
"octokit"
|
||||
],
|
||||
"repository": "github:octokit/octokit.js",
|
||||
"dependencies": {
|
||||
"@octokit/app": "^13.1.1",
|
||||
"@octokit/core": "^4.0.4",
|
||||
"@octokit/oauth-app": "^4.0.6",
|
||||
"@octokit/plugin-paginate-rest": "^6.0.0",
|
||||
"@octokit/plugin-rest-endpoint-methods": "^7.0.0",
|
||||
"@octokit/plugin-retry": "^4.0.3",
|
||||
"@octokit/plugin-throttling": "^5.0.0",
|
||||
"@octokit/types": "^9.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@octokit/tsconfig": "^1.0.2",
|
||||
"@pika/pack": "^0.3.7",
|
||||
"@pika/plugin-build-node": "^0.9.2",
|
||||
"@pika/plugin-build-web": "^0.9.2",
|
||||
"@pika/plugin-ts-standard-pkg": "^0.9.2",
|
||||
"@types/jest": "^29.0.0",
|
||||
"@types/node": "^18.0.0",
|
||||
"@types/node-fetch": "^2.5.10",
|
||||
"fetch-mock": "^9.11.0",
|
||||
"jest": "^29.0.0",
|
||||
"mockdate": "^3.0.5",
|
||||
"node-fetch": "^2.6.7",
|
||||
"prettier": "2.8.3",
|
||||
"semantic-release": "^20.0.0",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.1.0",
|
||||
"ts-jest": "^29.0.0",
|
||||
"typescript": "^4.2.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user