node_modules

This commit is contained in:
wadecong 2021-07-21 15:17:14 +08:00
parent 5e3f23f92c
commit 806116bda4
No known key found for this signature in database
GPG key ID: 38BC0BA7310B82D0
734 changed files with 224451 additions and 0 deletions

21
node_modules/@octokit/plugin-retry/LICENSE generated vendored Normal file
View file

@ -0,0 +1,21 @@
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.

105
node_modules/@octokit/plugin-retry/README.md generated vendored Normal file
View file

@ -0,0 +1,105 @@
# plugin-retry.js
> Retries requests for server 4xx/5xx responses except `400`, `401`, `403` and `404`.
[![@latest](https://img.shields.io/npm/v/@octokit/plugin-retry.svg)](https://www.npmjs.com/package/@octokit/plugin-retry)
[![Build Status](https://github.com/octokit/plugin-retry.js/workflows/Test/badge.svg)](https://github.com/octokit/plugin-retry.js/actions?workflow=Test)
## Usage
<table>
<tbody valign=top align=left>
<tr><th>
Browsers
</th><td width=100%>
Load `@octokit/plugin-retry` and [`@octokit/core`](https://github.com/octokit/core.js) (or core-compatible module) directly from [cdn.pika.dev](https://cdn.pika.dev)
```html
<script type="module">
import { Octokit } from "https://cdn.pika.dev/@octokit/core";
import { retry } from "https://cdn.pika.dev/@octokit/plugin-retry";
</script>
```
</td></tr>
<tr><th>
Node
</th><td>
Install with `npm install @octokit/core @octokit/plugin-retry`. Optionally replace `@octokit/core` with a core-compatible module
```js
const { Octokit } = require("@octokit/core");
const { retry } = require("@octokit/plugin-retry");
```
</td></tr>
</tbody>
</table>
**Note**: If you use it with `@octokit/rest` v16, install `@octokit/core` as a devDependency. This is only temporary and will no longer be necessary with `@octokit/rest` v17.
```js
const MyOctokit = Octokit.plugin(retry);
const octokit = new MyOctokit({ auth: "secret123" });
// retries request up to 3 times in case of a 500 response
octokit.request("/").catch((error) => {
if (error.request.request.retryCount) {
console.log(
`request failed after ${error.request.request.retryCount} retries`
);
}
console.error(error);
});
```
To override the default `doNotRetry` list:
```js
const octokit = new MyOctokit({
auth: "secret123",
retry: {
doNotRetry: [
/* List of HTTP 4xx/5xx status codes */
],
},
});
```
To override the number of retries:
```js
const octokit = new MyOctokit({
auth: "secret123",
request: { retries: 1 },
});
```
You can manually ask for retries for any request by passing `{ request: { retries: numRetries, retryAfter: delayInSeconds }}`
```js
octokit
.request("/", { request: { retries: 1, retryAfter: 1 } })
.catch((error) => {
if (error.request.request.retryCount) {
console.log(
`request failed after ${error.request.request.retryCount} retries`
);
}
console.error(error);
});
```
Pass `{ retry: { enabled: false } }` to disable this plugin.
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md)
## License
[MIT](LICENSE)

75
node_modules/@octokit/plugin-retry/dist-node/index.js generated vendored Normal file
View file

@ -0,0 +1,75 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var Bottleneck = _interopDefault(require('bottleneck/light'));
// @ts-ignore
async function errorRequest(octokit, state, error, options) {
if (!error.request || !error.request.request) {
// address https://github.com/octokit/plugin-retry.js/issues/8
throw error;
} // retry all >= 400 && not doNotRetry
if (error.status >= 400 && !state.doNotRetry.includes(error.status)) {
const retries = options.request.retries != null ? options.request.retries : state.retries;
const retryAfter = Math.pow((options.request.retryCount || 0) + 1, 2);
throw octokit.retry.retryRequest(error, retries, retryAfter);
} // Maybe eventually there will be more cases here
throw error;
}
// @ts-ignore
async function wrapRequest(state, request, options) {
const limiter = new Bottleneck(); // @ts-ignore
limiter.on("failed", function (error, info) {
const maxRetries = ~~error.request.request.retries;
const after = ~~error.request.request.retryAfter;
options.request.retryCount = info.retryCount + 1;
if (maxRetries > info.retryCount) {
// Returning a number instructs the limiter to retry
// the request after that number of milliseconds have passed
return after * state.retryAfterBaseValue;
}
});
return limiter.schedule(request, options);
}
const VERSION = "3.0.2";
function retry(octokit, octokitOptions = {}) {
const state = Object.assign({
enabled: true,
retryAfterBaseValue: 1000,
doNotRetry: [400, 401, 403, 404, 422],
retries: 3
}, octokitOptions.retry);
octokit.retry = {
retryRequest: (error, retries, retryAfter) => {
error.request.request = Object.assign({}, error.request.request, {
retries: retries,
retryAfter: retryAfter
});
return error;
}
};
if (!state.enabled) {
return;
}
octokit.hook.error("request", errorRequest.bind(null, octokit, state));
octokit.hook.wrap("request", wrapRequest.bind(null, state));
}
retry.VERSION = VERSION;
exports.VERSION = VERSION;
exports.retry = retry;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,15 @@
// @ts-ignore
export async function errorRequest(octokit, state, error, options) {
if (!error.request || !error.request.request) {
// address https://github.com/octokit/plugin-retry.js/issues/8
throw error;
}
// retry all >= 400 && not doNotRetry
if (error.status >= 400 && !state.doNotRetry.includes(error.status)) {
const retries = options.request.retries != null ? options.request.retries : state.retries;
const retryAfter = Math.pow((options.request.retryCount || 0) + 1, 2);
throw octokit.retry.retryRequest(error, retries, retryAfter);
}
// Maybe eventually there will be more cases here
throw error;
}

26
node_modules/@octokit/plugin-retry/dist-src/index.js generated vendored Normal file
View file

@ -0,0 +1,26 @@
import { errorRequest } from "./error-request";
import { wrapRequest } from "./wrap-request";
export const VERSION = "0.0.0-development";
export function retry(octokit, octokitOptions = {}) {
const state = Object.assign({
enabled: true,
retryAfterBaseValue: 1000,
doNotRetry: [400, 401, 403, 404, 422],
retries: 3,
}, octokitOptions.retry);
octokit.retry = {
retryRequest: (error, retries, retryAfter) => {
error.request.request = Object.assign({}, error.request.request, {
retries: retries,
retryAfter: retryAfter,
});
return error;
},
};
if (!state.enabled) {
return;
}
octokit.hook.error("request", errorRequest.bind(null, octokit, state));
octokit.hook.wrap("request", wrapRequest.bind(null, state));
}
retry.VERSION = VERSION;

View file

@ -0,0 +1 @@
export const VERSION = "3.0.2";

View file

@ -0,0 +1,18 @@
// @ts-ignore
import Bottleneck from "bottleneck/light";
// @ts-ignore
export async function wrapRequest(state, request, options) {
const limiter = new Bottleneck();
// @ts-ignore
limiter.on("failed", function (error, info) {
const maxRetries = ~~error.request.request.retries;
const after = ~~error.request.request.retryAfter;
options.request.retryCount = info.retryCount + 1;
if (maxRetries > info.retryCount) {
// Returning a number instructs the limiter to retry
// the request after that number of milliseconds have passed
return after * state.retryAfterBaseValue;
}
});
return limiter.schedule(request, options);
}

View file

@ -0,0 +1 @@
export declare function errorRequest(octokit: any, state: any, error: any, options: any): Promise<void>;

View file

@ -0,0 +1,6 @@
import { Octokit } from "@octokit/core";
export declare const VERSION = "0.0.0-development";
export declare function retry(octokit: Octokit, octokitOptions?: ConstructorParameters<typeof Octokit>[0]): void;
export declare namespace retry {
var VERSION: string;
}

View file

@ -0,0 +1 @@
export declare const VERSION = "3.0.2";

View file

@ -0,0 +1 @@
export declare function wrapRequest(state: any, request: any, options: any): Promise<any>;

63
node_modules/@octokit/plugin-retry/dist-web/index.js generated vendored Normal file
View file

@ -0,0 +1,63 @@
import Bottleneck from 'bottleneck/light';
// @ts-ignore
async function errorRequest(octokit, state, error, options) {
if (!error.request || !error.request.request) {
// address https://github.com/octokit/plugin-retry.js/issues/8
throw error;
}
// retry all >= 400 && not doNotRetry
if (error.status >= 400 && !state.doNotRetry.includes(error.status)) {
const retries = options.request.retries != null ? options.request.retries : state.retries;
const retryAfter = Math.pow((options.request.retryCount || 0) + 1, 2);
throw octokit.retry.retryRequest(error, retries, retryAfter);
}
// Maybe eventually there will be more cases here
throw error;
}
// @ts-ignore
// @ts-ignore
async function wrapRequest(state, request, options) {
const limiter = new Bottleneck();
// @ts-ignore
limiter.on("failed", function (error, info) {
const maxRetries = ~~error.request.request.retries;
const after = ~~error.request.request.retryAfter;
options.request.retryCount = info.retryCount + 1;
if (maxRetries > info.retryCount) {
// Returning a number instructs the limiter to retry
// the request after that number of milliseconds have passed
return after * state.retryAfterBaseValue;
}
});
return limiter.schedule(request, options);
}
const VERSION = "3.0.2";
function retry(octokit, octokitOptions = {}) {
const state = Object.assign({
enabled: true,
retryAfterBaseValue: 1000,
doNotRetry: [400, 401, 403, 404, 422],
retries: 3,
}, octokitOptions.retry);
octokit.retry = {
retryRequest: (error, retries, retryAfter) => {
error.request.request = Object.assign({}, error.request.request, {
retries: retries,
retryAfter: retryAfter,
});
return error;
},
};
if (!state.enabled) {
return;
}
octokit.hook.error("request", errorRequest.bind(null, octokit, state));
octokit.hook.wrap("request", wrapRequest.bind(null, state));
}
retry.VERSION = VERSION;
export { VERSION, retry };
//# sourceMappingURL=index.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../dist-src/error-request.js","../dist-src/wrap-request.js","../dist-src/index.js"],"sourcesContent":["// @ts-ignore\nexport async function errorRequest(octokit, state, error, options) {\n if (!error.request || !error.request.request) {\n // address https://github.com/octokit/plugin-retry.js/issues/8\n throw error;\n }\n // retry all >= 400 && not doNotRetry\n if (error.status >= 400 && !state.doNotRetry.includes(error.status)) {\n const retries = options.request.retries != null ? options.request.retries : state.retries;\n const retryAfter = Math.pow((options.request.retryCount || 0) + 1, 2);\n throw octokit.retry.retryRequest(error, retries, retryAfter);\n }\n // Maybe eventually there will be more cases here\n throw error;\n}\n","// @ts-ignore\nimport Bottleneck from \"bottleneck/light\";\n// @ts-ignore\nexport async function wrapRequest(state, request, options) {\n const limiter = new Bottleneck();\n // @ts-ignore\n limiter.on(\"failed\", function (error, info) {\n const maxRetries = ~~error.request.request.retries;\n const after = ~~error.request.request.retryAfter;\n options.request.retryCount = info.retryCount + 1;\n if (maxRetries > info.retryCount) {\n // Returning a number instructs the limiter to retry\n // the request after that number of milliseconds have passed\n return after * state.retryAfterBaseValue;\n }\n });\n return limiter.schedule(request, options);\n}\n","import { errorRequest } from \"./error-request\";\nimport { wrapRequest } from \"./wrap-request\";\nexport const VERSION = \"3.0.2\";\nexport function retry(octokit, octokitOptions = {}) {\n const state = Object.assign({\n enabled: true,\n retryAfterBaseValue: 1000,\n doNotRetry: [400, 401, 403, 404, 422],\n retries: 3,\n }, octokitOptions.retry);\n octokit.retry = {\n retryRequest: (error, retries, retryAfter) => {\n error.request.request = Object.assign({}, error.request.request, {\n retries: retries,\n retryAfter: retryAfter,\n });\n return error;\n },\n };\n if (!state.enabled) {\n return;\n }\n octokit.hook.error(\"request\", errorRequest.bind(null, octokit, state));\n octokit.hook.wrap(\"request\", wrapRequest.bind(null, state));\n}\nretry.VERSION = VERSION;\n"],"names":[],"mappings":"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"}

View 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.

View file

@ -0,0 +1,65 @@
# types.ts
> Shared TypeScript definitions for Octokit projects
[![@latest](https://img.shields.io/npm/v/@octokit/types.svg)](https://www.npmjs.com/package/@octokit/types)
[![Build Status](https://github.com/octokit/types.ts/workflows/Test/badge.svg)](https://github.com/octokit/types.ts/actions?workflow=Test)
[![Greenkeeper](https://badges.greenkeeper.io/octokit/types.ts.svg)](https://greenkeeper.io/)
<!-- toc -->
- [Usage](#usage)
- [Examples](#examples)
- [Get parameter and response data types for a REST API endpoint](#get-parameter-and-response-data-types-for-a-rest-api-endpoint)
- [Get response types from endpoint methods](#get-response-types-from-endpoint-methods)
- [Contributing](#contributing)
- [License](#license)
<!-- tocstop -->
## Usage
See all exported types at https://octokit.github.io/types.ts
## Examples
### Get parameter and response data types for a REST API endpoint
```ts
import { Endpoints } from "./src";
type listUserReposParameters = Endpoints["GET /repos/:owner/:repo"]["parameters"];
type listUserReposResponse = Endpoints["GET /repos/:owner/:repo"]["response"];
async function listRepos(
options: listUserReposParameters
): listUserReposResponse["data"] {
// ...
}
```
### Get response types from endpoint methods
```ts
import {
GetResponseTypeFromEndpointMethod,
GetResponseDataTypeFromEndpointMethod,
} from "@octokit/types";
import { Octokit } from "@octokit/rest";
const octokit = new Octokit();
type CreateLabelResponseType = GetResponseTypeFromEndpointMethod<
typeof octokit.issues.createLabel
>;
type CreateLabelResponseDataType = GetResponseDataTypeFromEndpointMethod<
typeof octokit.issues.createLabel
>;
```
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md)
## License
[MIT](LICENSE)

View file

@ -0,0 +1,8 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const VERSION = "4.0.1";
exports.VERSION = VERSION;
//# sourceMappingURL=index.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../dist-src/VERSION.js"],"sourcesContent":["export const VERSION = \"0.0.0-development\";\n"],"names":["VERSION"],"mappings":";;;;MAAaA,OAAO,GAAG;;;;"}

View file

@ -0,0 +1 @@
export const VERSION = "4.0.1";

View file

@ -0,0 +1 @@
export * from "./VERSION";

View file

@ -0,0 +1,31 @@
import { EndpointOptions } from "./EndpointOptions";
import { OctokitResponse } from "./OctokitResponse";
import { RequestInterface } from "./RequestInterface";
import { RequestParameters } from "./RequestParameters";
import { Route } from "./Route";
/**
* Interface to implement complex authentication strategies for Octokit.
* An object Implementing the AuthInterface can directly be passed as the
* `auth` option in the Octokit constructor.
*
* For the official implementations of the most common authentication
* strategies, see https://github.com/octokit/auth.js
*/
export interface AuthInterface<AuthOptions extends any[], Authentication extends any> {
(...args: AuthOptions): Promise<Authentication>;
hook: {
/**
* Sends a request using the passed `request` instance
*
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<T = any>(request: RequestInterface, options: EndpointOptions): Promise<OctokitResponse<T>>;
/**
* Sends a request using the passed `request` instance
*
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<T = any>(request: RequestInterface, route: Route, parameters?: RequestParameters): Promise<OctokitResponse<T>>;
};
}

View file

@ -0,0 +1,21 @@
import { RequestHeaders } from "./RequestHeaders";
import { RequestMethod } from "./RequestMethod";
import { RequestParameters } from "./RequestParameters";
import { Url } from "./Url";
/**
* The `.endpoint()` method is guaranteed to set all keys defined by RequestParameters
* as well as the method property.
*/
export declare type EndpointDefaults = RequestParameters & {
baseUrl: Url;
method: RequestMethod;
url?: Url;
headers: RequestHeaders & {
accept: string;
"user-agent": string;
};
mediaType: {
format: string;
previews: string[];
};
};

View file

@ -0,0 +1,65 @@
import { EndpointDefaults } from "./EndpointDefaults";
import { RequestOptions } from "./RequestOptions";
import { RequestParameters } from "./RequestParameters";
import { Route } from "./Route";
import { Endpoints } from "./generated/Endpoints";
export interface EndpointInterface<D extends object = object> {
/**
* Transforms a GitHub REST API endpoint into generic request options
*
* @param {object} endpoint Must set `url` unless it's set defaults. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<O extends RequestParameters = RequestParameters>(options: O & {
method?: string;
} & ("url" extends keyof D ? {
url?: string;
} : {
url: string;
})): RequestOptions & Pick<D & O, keyof RequestOptions>;
/**
* Transforms a GitHub REST API endpoint into generic request options
*
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<R extends Route, P extends RequestParameters = R extends keyof Endpoints ? Endpoints[R]["parameters"] & RequestParameters : RequestParameters>(route: keyof Endpoints | R, parameters?: P): (R extends keyof Endpoints ? Endpoints[R]["request"] : RequestOptions) & Pick<P, keyof RequestOptions>;
/**
* Object with current default route and parameters
*/
DEFAULTS: D & EndpointDefaults;
/**
* Returns a new `endpoint` interface with new defaults
*/
defaults: <O extends RequestParameters = RequestParameters>(newDefaults: O) => EndpointInterface<D & O>;
merge: {
/**
* Merges current endpoint defaults with passed route and parameters,
* without transforming them into request options.
*
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*
*/
<R extends Route, P extends RequestParameters = R extends keyof Endpoints ? Endpoints[R]["parameters"] & RequestParameters : RequestParameters>(route: keyof Endpoints | R, parameters?: P): D & (R extends keyof Endpoints ? Endpoints[R]["request"] & Endpoints[R]["parameters"] : EndpointDefaults) & P;
/**
* Merges current endpoint defaults with passed route and parameters,
* without transforming them into request 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`.
*/
<P extends RequestParameters = RequestParameters>(options: P): EndpointDefaults & D & P;
/**
* Returns current default options.
*
* @deprecated use endpoint.DEFAULTS instead
*/
(): D & EndpointDefaults;
};
/**
* Stateless method to turn endpoint options into request options.
* Calling `endpoint(options)` is the same as calling `endpoint.parse(endpoint.merge(options))`.
*
* @param {object} options `method`, `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
parse: <O extends EndpointDefaults = EndpointDefaults>(options: O) => RequestOptions & Pick<O, keyof RequestOptions>;
}

View file

@ -0,0 +1,7 @@
import { RequestMethod } from "./RequestMethod";
import { Url } from "./Url";
import { RequestParameters } from "./RequestParameters";
export declare type EndpointOptions = RequestParameters & {
method: RequestMethod;
url: Url;
};

View file

@ -0,0 +1,4 @@
/**
* Browser's fetch method (or compatible such as fetch-mock)
*/
export declare type Fetch = any;

View file

@ -0,0 +1,5 @@
declare type Unwrap<T> = T extends Promise<infer U> ? U : T;
declare type AnyFunction = (...args: any[]) => any;
export declare type GetResponseTypeFromEndpointMethod<T extends AnyFunction> = Unwrap<ReturnType<T>>;
export declare type GetResponseDataTypeFromEndpointMethod<T extends AnyFunction> = Unwrap<ReturnType<T>>["data"];
export {};

View file

@ -0,0 +1,17 @@
import { ResponseHeaders } from "./ResponseHeaders";
import { Url } from "./Url";
export declare type OctokitResponse<T> = {
headers: ResponseHeaders;
/**
* http response code
*/
status: number;
/**
* URL of response after all redirects
*/
url: Url;
/**
* This is the data you would see in https://developer.Octokit.com/v3/
*/
data: T;
};

View file

@ -0,0 +1,15 @@
export declare type RequestHeaders = {
/**
* Avoid setting `headers.accept`, use `mediaType.{format|previews}` option instead.
*/
accept?: string;
/**
* Use `authorization` to send authenticated request, remember `token ` / `bearer ` prefixes. Example: `token 1234567890abcdef1234567890abcdef12345678`
*/
authorization?: string;
/**
* `user-agent` is set do a default and can be overwritten as needed.
*/
"user-agent"?: string;
[header: string]: string | number | undefined;
};

View file

@ -0,0 +1,34 @@
import { EndpointInterface } from "./EndpointInterface";
import { OctokitResponse } from "./OctokitResponse";
import { RequestParameters } from "./RequestParameters";
import { Route } from "./Route";
import { Endpoints } from "./generated/Endpoints";
export interface RequestInterface<D extends object = object> {
/**
* Sends a request based on endpoint 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`.
*/
<T = any, O extends RequestParameters = RequestParameters>(options: O & {
method?: string;
} & ("url" extends keyof D ? {
url?: string;
} : {
url: string;
})): Promise<OctokitResponse<T>>;
/**
* Sends a request based on endpoint options
*
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<R extends Route>(route: keyof Endpoints | R, options?: R extends keyof Endpoints ? Endpoints[R]["parameters"] & RequestParameters : RequestParameters): R extends keyof Endpoints ? Promise<Endpoints[R]["response"]> : Promise<OctokitResponse<any>>;
/**
* Returns a new `request` with updated route and parameters
*/
defaults: <O extends RequestParameters = RequestParameters>(newDefaults: O) => RequestInterface<D & O>;
/**
* Octokit endpoint API, see {@link https://github.com/octokit/endpoint.js|@octokit/endpoint}
*/
endpoint: EndpointInterface<D>;
}

View file

@ -0,0 +1,4 @@
/**
* HTTP Verb supported by GitHub's REST API
*/
export declare type RequestMethod = "DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT";

View file

@ -0,0 +1,14 @@
import { RequestHeaders } from "./RequestHeaders";
import { RequestMethod } from "./RequestMethod";
import { RequestRequestOptions } from "./RequestRequestOptions";
import { Url } from "./Url";
/**
* Generic request options as they are returned by the `endpoint()` method
*/
export declare type RequestOptions = {
method: RequestMethod;
url: Url;
headers: RequestHeaders;
body?: any;
request?: RequestRequestOptions;
};

View file

@ -0,0 +1,45 @@
import { RequestRequestOptions } from "./RequestRequestOptions";
import { RequestHeaders } from "./RequestHeaders";
import { Url } from "./Url";
/**
* Parameters that can be passed into `request(route, parameters)` or `endpoint(route, parameters)` methods
*/
export declare type RequestParameters = {
/**
* Base URL to be used when a relative URL is passed, such as `/orgs/:org`.
* If `baseUrl` is `https://enterprise.acme-inc.com/api/v3`, then the request
* will be sent to `https://enterprise.acme-inc.com/api/v3/orgs/:org`.
*/
baseUrl?: Url;
/**
* HTTP headers. Use lowercase keys.
*/
headers?: RequestHeaders;
/**
* Media type options, see {@link https://developer.github.com/v3/media/|GitHub Developer Guide}
*/
mediaType?: {
/**
* `json` by default. Can be `raw`, `text`, `html`, `full`, `diff`, `patch`, `sha`, `base64`. Depending on endpoint
*/
format?: string;
/**
* Custom media type names of {@link https://developer.github.com/v3/media/|API Previews} without the `-preview` suffix.
* Example for single preview: `['squirrel-girl']`.
* Example for multiple previews: `['squirrel-girl', 'mister-fantastic']`.
*/
previews?: string[];
};
/**
* Pass custom meta information for the request. The `request` object will be returned as is.
*/
request?: RequestRequestOptions;
/**
* Any additional parameter will be passed as follows
* 1. URL parameter if `':parameter'` or `{parameter}` is part of `url`
* 2. Query parameter if `method` is `'GET'` or `'HEAD'`
* 3. Request body if `parameter` is `'data'`
* 4. JSON in the request body in the form of `body[parameter]` unless `parameter` key is `'data'`
*/
[parameter: string]: unknown;
};

View file

@ -0,0 +1,26 @@
/// <reference types="node" />
import { Agent } from "http";
import { Fetch } from "./Fetch";
import { Signal } from "./Signal";
/**
* Octokit-specific request options which are ignored for the actual request, but can be used by Octokit or plugins to manipulate how the request is sent or how a response is handled
*/
export declare type RequestRequestOptions = {
/**
* Node only. Useful for custom proxy, certificate, or dns lookup.
*/
agent?: Agent;
/**
* Custom replacement for built-in fetch method. Useful for testing or request hooks.
*/
fetch?: Fetch;
/**
* Use an `AbortController` instance to cancel a request. In node you can only cancel streamed requests.
*/
signal?: Signal;
/**
* Node only. Request/response timeout in ms, it resets on redirect. 0 to disable (OS limit applies). `options.request.signal` is recommended instead.
*/
timeout?: number;
[option: string]: any;
};

View file

@ -0,0 +1,20 @@
export declare type ResponseHeaders = {
"cache-control"?: string;
"content-length"?: number;
"content-type"?: string;
date?: string;
etag?: string;
"last-modified"?: string;
link?: string;
location?: string;
server?: string;
status?: string;
vary?: string;
"x-github-mediatype"?: string;
"x-github-request-id"?: string;
"x-oauth-scopes"?: string;
"x-ratelimit-limit"?: string;
"x-ratelimit-remaining"?: string;
"x-ratelimit-reset"?: string;
[header: string]: string | number | undefined;
};

View file

@ -0,0 +1,4 @@
/**
* String consisting of an optional HTTP method and relative path or absolute URL. Examples: `'/orgs/:org'`, `'PUT /orgs/:org'`, `GET https://example.com/foo/bar`
*/
export declare type Route = string;

View file

@ -0,0 +1,6 @@
/**
* Abort signal
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
*/
export declare type Signal = any;

View file

@ -0,0 +1,4 @@
import { AuthInterface } from "./AuthInterface";
export interface StrategyInterface<StrategyOptions extends any[], AuthOptions extends any[], Authentication extends object> {
(...args: StrategyOptions): AuthInterface<AuthOptions, Authentication>;
}

View file

@ -0,0 +1,4 @@
/**
* Relative or absolute URL. Examples: `'/orgs/:org'`, `https://example.com/foo/bar`
*/
export declare type Url = string;

View file

@ -0,0 +1 @@
export declare const VERSION = "4.0.1";

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,20 @@
export * from "./AuthInterface";
export * from "./EndpointDefaults";
export * from "./EndpointInterface";
export * from "./EndpointOptions";
export * from "./Fetch";
export * from "./OctokitResponse";
export * from "./RequestHeaders";
export * from "./RequestInterface";
export * from "./RequestMethod";
export * from "./RequestOptions";
export * from "./RequestParameters";
export * from "./RequestRequestOptions";
export * from "./ResponseHeaders";
export * from "./Route";
export * from "./Signal";
export * from "./StrategyInterface";
export * from "./Url";
export * from "./VERSION";
export * from "./GetResponseTypeFromEndpointMethod";
export * from "./generated/Endpoints";

View file

@ -0,0 +1,4 @@
const VERSION = "4.0.1";
export { VERSION };
//# sourceMappingURL=index.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../dist-src/VERSION.js"],"sourcesContent":["export const VERSION = \"0.0.0-development\";\n"],"names":[],"mappings":"AAAY,MAAC,OAAO,GAAG;;;;"}

View file

@ -0,0 +1,49 @@
{
"name": "@octokit/types",
"description": "Shared TypeScript definitions for Octokit projects",
"version": "4.0.1",
"license": "MIT",
"files": [
"dist-*/",
"bin/"
],
"pika": true,
"sideEffects": false,
"keywords": [
"github",
"api",
"sdk",
"toolkit",
"typescript"
],
"repository": "https://github.com/octokit/types.ts",
"dependencies": {
"@types/node": ">= 8"
},
"devDependencies": {
"@octokit/graphql": "^4.2.2",
"@pika/pack": "^0.5.0",
"@pika/plugin-build-node": "^0.9.0",
"@pika/plugin-build-web": "^0.9.0",
"@pika/plugin-ts-standard-pkg": "^0.9.0",
"handlebars": "^4.7.6",
"json-schema-to-typescript": "^9.1.0",
"lodash.set": "^4.3.2",
"npm-run-all": "^4.1.5",
"pascal-case": "^3.1.1",
"prettier": "^2.0.0",
"semantic-release": "^17.0.0",
"semantic-release-plugin-update-version-in-files": "^1.0.0",
"sort-keys": "^4.0.0",
"string-to-jsdoc-comment": "^1.0.0",
"typedoc": "^0.17.0",
"typescript": "^3.6.4"
},
"publishConfig": {
"access": "public"
},
"source": "dist-src/index.js",
"types": "dist-types/index.d.ts",
"main": "dist-node/index.js",
"module": "dist-web/index.js"
}

49
node_modules/@octokit/plugin-retry/package.json generated vendored Normal file
View file

@ -0,0 +1,49 @@
{
"name": "@octokit/plugin-retry",
"description": "Automatic retry plugin for octokit",
"version": "3.0.2",
"license": "MIT",
"files": [
"dist-*/",
"bin/"
],
"pika": true,
"sideEffects": false,
"homepage": "https://github.com/octokit/plugin-retry.js#readme",
"bugs": {
"url": "https://github.com/octokit/plugin-retry.js/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/octokit/plugin-retry.js.git"
},
"dependencies": {
"@octokit/types": "^4.0.1",
"bottleneck": "^2.15.3"
},
"devDependencies": {
"@octokit/core": "^2.0.0",
"@octokit/request-error": "^2.0.0",
"@pika/pack": "^0.5.0",
"@pika/plugin-build-node": "^0.9.0",
"@pika/plugin-build-web": "^0.9.0",
"@pika/plugin-ts-standard-pkg": "^0.9.0",
"@types/fetch-mock": "^7.3.1",
"@types/jest": "^25.1.0",
"@types/node": "^14.0.0",
"fetch-mock": "^9.0.0",
"jest": "^24.9.0",
"prettier": "^2.0.1",
"semantic-release": "^17.0.0",
"semantic-release-plugin-update-version-in-files": "^1.0.0",
"ts-jest": "^25.1.0",
"typescript": "^3.7.2"
},
"publishConfig": {
"access": "public"
},
"source": "dist-src/index.js",
"types": "dist-types/index.d.ts",
"main": "dist-node/index.js",
"module": "dist-web/index.js"
}