Github actions require checking in the entire node_modules or using a vercel service what the fuck github

This commit is contained in:
2024-06-15 11:40:38 +02:00
parent 5cfda63817
commit c835cadd76
614 changed files with 433819 additions and 0 deletions

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,76 @@
# plugin-rest-endpoint-methods.js
> Octokit plugin adding one method for all of api.github.com REST API endpoints
[![@latest](https://img.shields.io/npm/v/@octokit/plugin-rest-endpoint-methods.svg)](https://www.npmjs.com/package/@octokit/plugin-rest-endpoint-methods)
[![Build Status](https://github.com/octokit/plugin-rest-endpoint-methods.js/workflows/Test/badge.svg)](https://github.com/octokit/plugin-rest-endpoint-methods.js/actions?workflow=Test)
## Usage
<table>
<tbody valign=top align=left>
<tr><th>
Browsers
</th><td width=100%>
Load `@octokit/plugin-rest-endpoint-methods` and [`@octokit/core`](https://github.com/octokit/core.js) (or core-compatible module) directly from [esm.sh](https://esm.sh)
```html
<script type="module">
import { Octokit } from "https://esm.sh/@octokit/core";
import { restEndpointMethods } from "https://esm.sh/@octokit/plugin-rest-endpoint-methods";
</script>
```
</td></tr>
<tr><th>
Node
</th><td>
Install with `npm install @octokit/core @octokit/plugin-rest-endpoint-methods`. Optionally replace `@octokit/core` with a compatible module
```js
const { Octokit } = require("@octokit/core");
const {
restEndpointMethods,
} = require("@octokit/plugin-rest-endpoint-methods");
```
</td></tr>
</tbody>
</table>
```js
const MyOctokit = Octokit.plugin(restEndpointMethods);
const octokit = new MyOctokit({ auth: "secret123" });
// https://developer.github.com/v3/users/#get-the-authenticated-user
octokit.rest.users.getAuthenticated();
```
There is one method for each REST API endpoint documented at [https://developer.github.com/v3](https://developer.github.com/v3). All endpoint methods are documented in the [docs/](docs/) folder, e.g. [docs/users/getAuthenticated.md](docs/users/getAuthenticated.md)
## TypeScript
Parameter and response types for all endpoint methods exported as `{ RestEndpointMethodTypes }`.
Example
```ts
import { RestEndpointMethodTypes } from "@octokit/plugin-rest-endpoint-methods";
type UpdateLabelParameters =
RestEndpointMethodTypes["issues"]["updateLabel"]["parameters"];
type UpdateLabelResponse =
RestEndpointMethodTypes["issues"]["updateLabel"]["response"];
```
In order to get types beyond parameters and responses, check out [`@octokit/openapi-types`](https://github.com/octokit/openapi-types.ts/#readme), which is a direct transpilation from GitHub's official OpenAPI specification.
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md)
## License
[MIT](LICENSE)

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,125 @@
import ENDPOINTS from "./generated/endpoints.js";
const endpointMethodsMap = /* @__PURE__ */ new Map();
for (const [scope, endpoints] of Object.entries(ENDPOINTS)) {
for (const [methodName, endpoint] of Object.entries(endpoints)) {
const [route, defaults, decorations] = endpoint;
const [method, url] = route.split(/ /);
const endpointDefaults = Object.assign(
{
method,
url
},
defaults
);
if (!endpointMethodsMap.has(scope)) {
endpointMethodsMap.set(scope, /* @__PURE__ */ new Map());
}
endpointMethodsMap.get(scope).set(methodName, {
scope,
methodName,
endpointDefaults,
decorations
});
}
}
const handler = {
has({ scope }, methodName) {
return endpointMethodsMap.get(scope).has(methodName);
},
getOwnPropertyDescriptor(target, methodName) {
return {
value: this.get(target, methodName),
// ensures method is in the cache
configurable: true,
writable: true,
enumerable: true
};
},
defineProperty(target, methodName, descriptor) {
Object.defineProperty(target.cache, methodName, descriptor);
return true;
},
deleteProperty(target, methodName) {
delete target.cache[methodName];
return true;
},
ownKeys({ scope }) {
return [...endpointMethodsMap.get(scope).keys()];
},
set(target, methodName, value) {
return target.cache[methodName] = value;
},
get({ octokit, scope, cache }, methodName) {
if (cache[methodName]) {
return cache[methodName];
}
const method = endpointMethodsMap.get(scope).get(methodName);
if (!method) {
return void 0;
}
const { endpointDefaults, decorations } = method;
if (decorations) {
cache[methodName] = decorate(
octokit,
scope,
methodName,
endpointDefaults,
decorations
);
} else {
cache[methodName] = octokit.request.defaults(endpointDefaults);
}
return cache[methodName];
}
};
function endpointsToMethods(octokit) {
const newMethods = {};
for (const scope of endpointMethodsMap.keys()) {
newMethods[scope] = new Proxy({ octokit, scope, cache: {} }, handler);
}
return newMethods;
}
function decorate(octokit, scope, methodName, defaults, decorations) {
const requestWithDefaults = octokit.request.defaults(defaults);
function withDecorations(...args) {
let options = requestWithDefaults.endpoint.merge(...args);
if (decorations.mapToData) {
options = Object.assign({}, options, {
data: options[decorations.mapToData],
[decorations.mapToData]: void 0
});
return requestWithDefaults(options);
}
if (decorations.renamed) {
const [newScope, newMethodName] = decorations.renamed;
octokit.log.warn(
`octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()`
);
}
if (decorations.deprecated) {
octokit.log.warn(decorations.deprecated);
}
if (decorations.renamedParameters) {
const options2 = requestWithDefaults.endpoint.merge(...args);
for (const [name, alias] of Object.entries(
decorations.renamedParameters
)) {
if (name in options2) {
octokit.log.warn(
`"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias}" instead`
);
if (!(alias in options2)) {
options2[alias] = options2[name];
}
delete options2[name];
}
}
return requestWithDefaults(options2);
}
return requestWithDefaults(...args);
}
return Object.assign(withDecorations, requestWithDefaults);
}
export {
endpointsToMethods
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,21 @@
import { VERSION } from "./version.js";
import { endpointsToMethods } from "./endpoints-to-methods.js";
function restEndpointMethods(octokit) {
const api = endpointsToMethods(octokit);
return {
rest: api
};
}
restEndpointMethods.VERSION = VERSION;
function legacyRestEndpointMethods(octokit) {
const api = endpointsToMethods(octokit);
return {
...api,
rest: api
};
}
legacyRestEndpointMethods.VERSION = VERSION;
export {
legacyRestEndpointMethods,
restEndpointMethods
};

View File

@@ -0,0 +1,4 @@
const VERSION = "10.4.1";
export {
VERSION
};

View File

@@ -0,0 +1,3 @@
import type { Octokit } from "@octokit/core";
import type { RestEndpointMethods } from "./generated/method-types.js";
export declare function endpointsToMethods(octokit: Octokit): RestEndpointMethods;

View File

@@ -0,0 +1,3 @@
import type { EndpointsDefaultsAndDecorations } from "../types.js";
declare const Endpoints: EndpointsDefaultsAndDecorations;
export default Endpoints;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
import type { Octokit } from "@octokit/core";
export type { RestEndpointMethodTypes } from "./generated/parameters-and-response-types.js";
import type { Api } from "./types.js";
export declare function restEndpointMethods(octokit: Octokit): Api;
export declare namespace restEndpointMethods {
var VERSION: string;
}
export declare function legacyRestEndpointMethods(octokit: Octokit): Api["rest"] & Api;
export declare namespace legacyRestEndpointMethods {
var VERSION: string;
}

View File

@@ -0,0 +1,18 @@
import type { Route, RequestParameters } from "@octokit/types";
import type { RestEndpointMethods } from "./generated/method-types.js";
export type Api = {
rest: RestEndpointMethods;
};
export type EndpointDecorations = {
mapToData?: string;
deprecated?: string;
renamed?: [string, string];
renamedParameters?: {
[name: string]: string;
};
};
export type EndpointsDefaultsAndDecorations = {
[scope: string]: {
[methodName: string]: [Route, RequestParameters?, EndpointDecorations?];
};
};

View File

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

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
Copyright 2020 Gregor Martynus
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,17 @@
# @octokit/openapi-types
> Generated TypeScript definitions based on GitHub's OpenAPI spec
This package is continuously updated based on [GitHub's OpenAPI specification](https://github.com/github/rest-api-description/)
## Usage
```ts
import { components } from "@octokit/openapi-types";
type Repository = components["schemas"]["full-repository"];
```
## License
[MIT](LICENSE)

View File

@@ -0,0 +1,20 @@
{
"name": "@octokit/openapi-types",
"description": "Generated TypeScript definitions based on GitHub's OpenAPI spec for api.github.com",
"repository": {
"type": "git",
"url": "https://github.com/octokit/openapi-types.ts.git",
"directory": "packages/openapi-types"
},
"publishConfig": {
"access": "public"
},
"version": "20.0.0",
"main": "",
"types": "types.d.ts",
"author": "Gregor Martynus (https://twitter.com/gr2m)",
"license": "MIT",
"octokit": {
"openapi-version": "14.0.0"
}
}

File diff suppressed because it is too large Load Diff

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)
<!-- 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 "@octokit/types";
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,31 @@
import type { EndpointOptions } from "./EndpointOptions";
import type { OctokitResponse } from "./OctokitResponse";
import type { RequestInterface } from "./RequestInterface";
import type { RequestParameters } from "./RequestParameters";
import type { 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 type { RequestHeaders } from "./RequestHeaders";
import type { RequestMethod } from "./RequestMethod";
import type { RequestParameters } from "./RequestParameters";
import type { Url } from "./Url";
/**
* The `.endpoint()` method is guaranteed to set all keys defined by RequestParameters
* as well as the method property.
*/
export 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 type { EndpointDefaults } from "./EndpointDefaults";
import type { RequestOptions } from "./RequestOptions";
import type { RequestParameters } from "./RequestParameters";
import type { Route } from "./Route";
import type { 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 type { RequestMethod } from "./RequestMethod";
import type { Url } from "./Url";
import type { RequestParameters } from "./RequestParameters";
export type EndpointOptions = RequestParameters & {
method: RequestMethod;
url: Url;
};

View File

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

View File

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

View File

@@ -0,0 +1,17 @@
import type { ResponseHeaders } from "./ResponseHeaders";
import type { Url } from "./Url";
export interface OctokitResponse<T, S extends number = number> {
headers: ResponseHeaders;
/**
* http response code
*/
status: S;
/**
* URL of response after all redirects
*/
url: Url;
/**
* Response data as documented in the REST API reference documentation at https://docs.github.com/rest/reference
*/
data: T;
}

View File

@@ -0,0 +1,11 @@
export type RequestError = {
name: string;
status: number;
documentation_url: string;
errors?: Array<{
resource: string;
code: string;
field: string;
message?: string;
}>;
};

View File

@@ -0,0 +1,15 @@
export 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 type { EndpointInterface } from "./EndpointInterface";
import type { OctokitResponse } from "./OctokitResponse";
import type { RequestParameters } from "./RequestParameters";
import type { Route } from "./Route";
import type { 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 type RequestMethod = "DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT";

View File

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

View File

@@ -0,0 +1,45 @@
import type { RequestRequestOptions } from "./RequestRequestOptions";
import type { RequestHeaders } from "./RequestHeaders";
import type { Url } from "./Url";
/**
* Parameters that can be passed into `request(route, parameters)` or `endpoint(route, parameters)` methods
*/
export 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://docs.github.com/en/graphql/overview/schema-previews|GraphQL 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,20 @@
import type { Fetch } from "./Fetch";
import type { 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 type RequestRequestOptions = {
/**
* 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;
/**
* If set to `false`, the response body will not be parsed and will be returned as a stream.
*/
parseSuccessResponseBody?: boolean;
[option: string]: any;
};

View File

@@ -0,0 +1,21 @@
export 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-accepted-github-permissions"?: 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 type Route = string;

View File

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

View File

@@ -0,0 +1,4 @@
import type { 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 type Url = string;

View File

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

View File

@@ -0,0 +1,21 @@
export * from "./AuthInterface";
export * from "./EndpointDefaults";
export * from "./EndpointInterface";
export * from "./EndpointOptions";
export * from "./Fetch";
export * from "./OctokitResponse";
export * from "./RequestError";
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,46 @@
{
"name": "@octokit/types",
"version": "12.6.0",
"publishConfig": {
"access": "public"
},
"description": "Shared TypeScript definitions for Octokit projects",
"dependencies": {
"@octokit/openapi-types": "^20.0.0"
},
"repository": "github:octokit/types.ts",
"keywords": [
"github",
"api",
"sdk",
"toolkit",
"typescript"
],
"author": "Gregor Martynus (https://twitter.com/gr2m)",
"license": "MIT",
"devDependencies": {
"@octokit/tsconfig": "^2.0.0",
"@types/node": ">= 8",
"github-openapi-graphql-query": "^4.0.0",
"handlebars": "^4.7.6",
"json-schema-to-typescript": "^13.0.0",
"lodash.set": "^4.3.2",
"npm-run-all2": "^6.0.0",
"pascal-case": "^3.1.1",
"prettier": "^3.0.0",
"semantic-release": "^23.0.0",
"semantic-release-plugin-update-version-in-files": "^1.0.0",
"sort-keys": "^5.0.0",
"string-to-jsdoc-comment": "^1.0.0",
"typedoc": "^0.25.0",
"typescript": "^5.0.0"
},
"octokit": {
"openapi-version": "14.0.0"
},
"files": [
"dist-types/**"
],
"types": "dist-types/index.d.ts",
"sideEffects": false
}

View File

@@ -0,0 +1,60 @@
{
"name": "@octokit/plugin-rest-endpoint-methods",
"version": "10.4.1",
"description": "Octokit plugin adding one method for all of api.github.com REST API endpoints",
"repository": "github:octokit/plugin-rest-endpoint-methods.js",
"keywords": [
"github",
"api",
"sdk",
"toolkit"
],
"author": "Gregor Martynus (https://twitter.com/gr2m)",
"license": "MIT",
"dependencies": {
"@octokit/types": "^12.6.0"
},
"devDependencies": {
"@octokit/core": "^5.0.0",
"@octokit/tsconfig": "^2.0.0",
"@types/fetch-mock": "^7.3.1",
"@types/jest": "^29.0.0",
"@types/node": "^20.0.0",
"@types/sinon": "^17.0.0",
"esbuild": "^0.20.0",
"fetch-mock": "npm:@gr2m/fetch-mock@^9.11.0-pull-request-644.1",
"github-openapi-graphql-query": "^4.3.1",
"glob": "^10.2.6",
"jest": "^29.0.0",
"lodash.camelcase": "^4.3.0",
"lodash.set": "^4.3.2",
"lodash.upperfirst": "^4.3.1",
"mustache": "^4.0.0",
"npm-run-all2": "^6.0.0",
"prettier": "3.2.5",
"semantic-release-plugin-update-version-in-files": "^1.0.0",
"sinon": "^17.0.0",
"sort-keys": "^5.0.0",
"string-to-jsdoc-comment": "^1.0.0",
"ts-jest": "^29.0.0",
"typescript": "^5.0.0"
},
"peerDependencies": {
"@octokit/core": "5"
},
"publishConfig": {
"access": "public"
},
"engines": {
"node": ">= 18"
},
"files": [
"dist-*/**",
"bin/**"
],
"main": "dist-node/index.js",
"browser": "dist-web/index.js",
"types": "dist-types/index.d.ts",
"module": "dist-src/index.js",
"sideEffects": false
}