First upload version 0.0.1

This commit is contained in:
Neyra
2026-02-05 15:27:49 +08:00
commit 8e9b7201ed
4182 changed files with 593136 additions and 0 deletions

9
node_modules/@octokit/oauth-methods/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) 2021 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.

1613
node_modules/@octokit/oauth-methods/README.md generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,317 @@
// pkg/dist-src/version.js
var VERSION = "0.0.0-development";
// pkg/dist-src/get-web-flow-authorization-url.js
import { oauthAuthorizationUrl } from "@octokit/oauth-authorization-url";
import { request as defaultRequest } from "@octokit/request";
// pkg/dist-src/utils.js
import { RequestError } from "@octokit/request-error";
function requestToOAuthBaseUrl(request) {
const endpointDefaults = request.endpoint.DEFAULTS;
return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", "");
}
async function oauthRequest(request, route, parameters) {
const withOAuthParameters = {
baseUrl: requestToOAuthBaseUrl(request),
headers: {
accept: "application/json"
},
...parameters
};
const response = await request(route, withOAuthParameters);
if ("error" in response.data) {
const error = new RequestError(
`${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`,
400,
{
request: request.endpoint.merge(
route,
withOAuthParameters
)
}
);
error.response = response;
throw error;
}
return response;
}
// pkg/dist-src/get-web-flow-authorization-url.js
function getWebFlowAuthorizationUrl({
request = defaultRequest,
...options
}) {
const baseUrl = requestToOAuthBaseUrl(request);
return oauthAuthorizationUrl({
...options,
baseUrl
});
}
// pkg/dist-src/exchange-web-flow-code.js
import { request as defaultRequest2 } from "@octokit/request";
async function exchangeWebFlowCode(options) {
const request = options.request || defaultRequest2;
const response = await oauthRequest(
request,
"POST /login/oauth/access_token",
{
client_id: options.clientId,
client_secret: options.clientSecret,
code: options.code,
redirect_uri: options.redirectUrl
}
);
const authentication = {
clientType: options.clientType,
clientId: options.clientId,
clientSecret: options.clientSecret,
token: response.data.access_token,
scopes: response.data.scope.split(/\s+/).filter(Boolean)
};
if (options.clientType === "github-app") {
if ("refresh_token" in response.data) {
const apiTimeInMs = new Date(response.headers.date).getTime();
authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp(
apiTimeInMs,
response.data.expires_in
), authentication.refreshTokenExpiresAt = toTimestamp(
apiTimeInMs,
response.data.refresh_token_expires_in
);
}
delete authentication.scopes;
}
return { ...response, authentication };
}
function toTimestamp(apiTimeInMs, expirationInSeconds) {
return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString();
}
// pkg/dist-src/create-device-code.js
import { request as defaultRequest3 } from "@octokit/request";
async function createDeviceCode(options) {
const request = options.request || defaultRequest3;
const parameters = {
client_id: options.clientId
};
if ("scopes" in options && Array.isArray(options.scopes)) {
parameters.scope = options.scopes.join(" ");
}
return oauthRequest(request, "POST /login/device/code", parameters);
}
// pkg/dist-src/exchange-device-code.js
import { request as defaultRequest4 } from "@octokit/request";
async function exchangeDeviceCode(options) {
const request = options.request || defaultRequest4;
const response = await oauthRequest(
request,
"POST /login/oauth/access_token",
{
client_id: options.clientId,
device_code: options.code,
grant_type: "urn:ietf:params:oauth:grant-type:device_code"
}
);
const authentication = {
clientType: options.clientType,
clientId: options.clientId,
token: response.data.access_token,
scopes: response.data.scope.split(/\s+/).filter(Boolean)
};
if ("clientSecret" in options) {
authentication.clientSecret = options.clientSecret;
}
if (options.clientType === "github-app") {
if ("refresh_token" in response.data) {
const apiTimeInMs = new Date(response.headers.date).getTime();
authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp2(
apiTimeInMs,
response.data.expires_in
), authentication.refreshTokenExpiresAt = toTimestamp2(
apiTimeInMs,
response.data.refresh_token_expires_in
);
}
delete authentication.scopes;
}
return { ...response, authentication };
}
function toTimestamp2(apiTimeInMs, expirationInSeconds) {
return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString();
}
// pkg/dist-src/check-token.js
import { request as defaultRequest5 } from "@octokit/request";
async function checkToken(options) {
const request = options.request || defaultRequest5;
const response = await request("POST /applications/{client_id}/token", {
headers: {
authorization: `basic ${btoa(
`${options.clientId}:${options.clientSecret}`
)}`
},
client_id: options.clientId,
access_token: options.token
});
const authentication = {
clientType: options.clientType,
clientId: options.clientId,
clientSecret: options.clientSecret,
token: options.token,
scopes: response.data.scopes
};
if (response.data.expires_at)
authentication.expiresAt = response.data.expires_at;
if (options.clientType === "github-app") {
delete authentication.scopes;
}
return { ...response, authentication };
}
// pkg/dist-src/refresh-token.js
import { request as defaultRequest6 } from "@octokit/request";
async function refreshToken(options) {
const request = options.request || defaultRequest6;
const response = await oauthRequest(
request,
"POST /login/oauth/access_token",
{
client_id: options.clientId,
client_secret: options.clientSecret,
grant_type: "refresh_token",
refresh_token: options.refreshToken
}
);
const apiTimeInMs = new Date(response.headers.date).getTime();
const authentication = {
clientType: "github-app",
clientId: options.clientId,
clientSecret: options.clientSecret,
token: response.data.access_token,
refreshToken: response.data.refresh_token,
expiresAt: toTimestamp3(apiTimeInMs, response.data.expires_in),
refreshTokenExpiresAt: toTimestamp3(
apiTimeInMs,
response.data.refresh_token_expires_in
)
};
return { ...response, authentication };
}
function toTimestamp3(apiTimeInMs, expirationInSeconds) {
return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString();
}
// pkg/dist-src/scope-token.js
import { request as defaultRequest7 } from "@octokit/request";
async function scopeToken(options) {
const {
request: optionsRequest,
clientType,
clientId,
clientSecret,
token,
...requestOptions
} = options;
const request = options.request || defaultRequest7;
const response = await request(
"POST /applications/{client_id}/token/scoped",
{
headers: {
authorization: `basic ${btoa(`${clientId}:${clientSecret}`)}`
},
client_id: clientId,
access_token: token,
...requestOptions
}
);
const authentication = Object.assign(
{
clientType,
clientId,
clientSecret,
token: response.data.token
},
response.data.expires_at ? { expiresAt: response.data.expires_at } : {}
);
return { ...response, authentication };
}
// pkg/dist-src/reset-token.js
import { request as defaultRequest8 } from "@octokit/request";
async function resetToken(options) {
const request = options.request || defaultRequest8;
const auth = btoa(`${options.clientId}:${options.clientSecret}`);
const response = await request(
"PATCH /applications/{client_id}/token",
{
headers: {
authorization: `basic ${auth}`
},
client_id: options.clientId,
access_token: options.token
}
);
const authentication = {
clientType: options.clientType,
clientId: options.clientId,
clientSecret: options.clientSecret,
token: response.data.token,
scopes: response.data.scopes
};
if (response.data.expires_at)
authentication.expiresAt = response.data.expires_at;
if (options.clientType === "github-app") {
delete authentication.scopes;
}
return { ...response, authentication };
}
// pkg/dist-src/delete-token.js
import { request as defaultRequest9 } from "@octokit/request";
async function deleteToken(options) {
const request = options.request || defaultRequest9;
const auth = btoa(`${options.clientId}:${options.clientSecret}`);
return request(
"DELETE /applications/{client_id}/token",
{
headers: {
authorization: `basic ${auth}`
},
client_id: options.clientId,
access_token: options.token
}
);
}
// pkg/dist-src/delete-authorization.js
import { request as defaultRequest10 } from "@octokit/request";
async function deleteAuthorization(options) {
const request = options.request || defaultRequest10;
const auth = btoa(`${options.clientId}:${options.clientSecret}`);
return request(
"DELETE /applications/{client_id}/grant",
{
headers: {
authorization: `basic ${auth}`
},
client_id: options.clientId,
access_token: options.token
}
);
}
export {
VERSION,
checkToken,
createDeviceCode,
deleteAuthorization,
deleteToken,
exchangeDeviceCode,
exchangeWebFlowCode,
getWebFlowAuthorizationUrl,
refreshToken,
resetToken,
scopeToken
};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
import { request as defaultRequest } from "@octokit/request";
async function checkToken(options) {
const request = options.request || defaultRequest;
const response = await request("POST /applications/{client_id}/token", {
headers: {
authorization: `basic ${btoa(
`${options.clientId}:${options.clientSecret}`
)}`
},
client_id: options.clientId,
access_token: options.token
});
const authentication = {
clientType: options.clientType,
clientId: options.clientId,
clientSecret: options.clientSecret,
token: options.token,
scopes: response.data.scopes
};
if (response.data.expires_at)
authentication.expiresAt = response.data.expires_at;
if (options.clientType === "github-app") {
delete authentication.scopes;
}
return { ...response, authentication };
}
export {
checkToken
};

View File

@@ -0,0 +1,15 @@
import { request as defaultRequest } from "@octokit/request";
import { oauthRequest } from "./utils.js";
async function createDeviceCode(options) {
const request = options.request || defaultRequest;
const parameters = {
client_id: options.clientId
};
if ("scopes" in options && Array.isArray(options.scopes)) {
parameters.scope = options.scopes.join(" ");
}
return oauthRequest(request, "POST /login/device/code", parameters);
}
export {
createDeviceCode
};

View File

@@ -0,0 +1,18 @@
import { request as defaultRequest } from "@octokit/request";
async function deleteAuthorization(options) {
const request = options.request || defaultRequest;
const auth = btoa(`${options.clientId}:${options.clientSecret}`);
return request(
"DELETE /applications/{client_id}/grant",
{
headers: {
authorization: `basic ${auth}`
},
client_id: options.clientId,
access_token: options.token
}
);
}
export {
deleteAuthorization
};

View File

@@ -0,0 +1,18 @@
import { request as defaultRequest } from "@octokit/request";
async function deleteToken(options) {
const request = options.request || defaultRequest;
const auth = btoa(`${options.clientId}:${options.clientSecret}`);
return request(
"DELETE /applications/{client_id}/token",
{
headers: {
authorization: `basic ${auth}`
},
client_id: options.clientId,
access_token: options.token
}
);
}
export {
deleteToken
};

View File

@@ -0,0 +1,43 @@
import { request as defaultRequest } from "@octokit/request";
import { oauthRequest } from "./utils.js";
async function exchangeDeviceCode(options) {
const request = options.request || defaultRequest;
const response = await oauthRequest(
request,
"POST /login/oauth/access_token",
{
client_id: options.clientId,
device_code: options.code,
grant_type: "urn:ietf:params:oauth:grant-type:device_code"
}
);
const authentication = {
clientType: options.clientType,
clientId: options.clientId,
token: response.data.access_token,
scopes: response.data.scope.split(/\s+/).filter(Boolean)
};
if ("clientSecret" in options) {
authentication.clientSecret = options.clientSecret;
}
if (options.clientType === "github-app") {
if ("refresh_token" in response.data) {
const apiTimeInMs = new Date(response.headers.date).getTime();
authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp(
apiTimeInMs,
response.data.expires_in
), authentication.refreshTokenExpiresAt = toTimestamp(
apiTimeInMs,
response.data.refresh_token_expires_in
);
}
delete authentication.scopes;
}
return { ...response, authentication };
}
function toTimestamp(apiTimeInMs, expirationInSeconds) {
return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString();
}
export {
exchangeDeviceCode
};

View File

@@ -0,0 +1,42 @@
import { request as defaultRequest } from "@octokit/request";
import { oauthRequest } from "./utils.js";
async function exchangeWebFlowCode(options) {
const request = options.request || defaultRequest;
const response = await oauthRequest(
request,
"POST /login/oauth/access_token",
{
client_id: options.clientId,
client_secret: options.clientSecret,
code: options.code,
redirect_uri: options.redirectUrl
}
);
const authentication = {
clientType: options.clientType,
clientId: options.clientId,
clientSecret: options.clientSecret,
token: response.data.access_token,
scopes: response.data.scope.split(/\s+/).filter(Boolean)
};
if (options.clientType === "github-app") {
if ("refresh_token" in response.data) {
const apiTimeInMs = new Date(response.headers.date).getTime();
authentication.refreshToken = response.data.refresh_token, authentication.expiresAt = toTimestamp(
apiTimeInMs,
response.data.expires_in
), authentication.refreshTokenExpiresAt = toTimestamp(
apiTimeInMs,
response.data.refresh_token_expires_in
);
}
delete authentication.scopes;
}
return { ...response, authentication };
}
function toTimestamp(apiTimeInMs, expirationInSeconds) {
return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString();
}
export {
exchangeWebFlowCode
};

View File

@@ -0,0 +1,16 @@
import { oauthAuthorizationUrl } from "@octokit/oauth-authorization-url";
import { request as defaultRequest } from "@octokit/request";
import { requestToOAuthBaseUrl } from "./utils.js";
function getWebFlowAuthorizationUrl({
request = defaultRequest,
...options
}) {
const baseUrl = requestToOAuthBaseUrl(request);
return oauthAuthorizationUrl({
...options,
baseUrl
});
}
export {
getWebFlowAuthorizationUrl
};

14
node_modules/@octokit/oauth-methods/dist-src/index.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import { VERSION } from "./version.js";
export * from "./get-web-flow-authorization-url.js";
export * from "./exchange-web-flow-code.js";
export * from "./create-device-code.js";
export * from "./exchange-device-code.js";
export * from "./check-token.js";
export * from "./refresh-token.js";
export * from "./scope-token.js";
export * from "./reset-token.js";
export * from "./delete-token.js";
export * from "./delete-authorization.js";
export {
VERSION
};

View File

@@ -0,0 +1,35 @@
import { request as defaultRequest } from "@octokit/request";
import { oauthRequest } from "./utils.js";
async function refreshToken(options) {
const request = options.request || defaultRequest;
const response = await oauthRequest(
request,
"POST /login/oauth/access_token",
{
client_id: options.clientId,
client_secret: options.clientSecret,
grant_type: "refresh_token",
refresh_token: options.refreshToken
}
);
const apiTimeInMs = new Date(response.headers.date).getTime();
const authentication = {
clientType: "github-app",
clientId: options.clientId,
clientSecret: options.clientSecret,
token: response.data.access_token,
refreshToken: response.data.refresh_token,
expiresAt: toTimestamp(apiTimeInMs, response.data.expires_in),
refreshTokenExpiresAt: toTimestamp(
apiTimeInMs,
response.data.refresh_token_expires_in
)
};
return { ...response, authentication };
}
function toTimestamp(apiTimeInMs, expirationInSeconds) {
return new Date(apiTimeInMs + expirationInSeconds * 1e3).toISOString();
}
export {
refreshToken
};

View File

@@ -0,0 +1,31 @@
import { request as defaultRequest } from "@octokit/request";
async function resetToken(options) {
const request = options.request || defaultRequest;
const auth = btoa(`${options.clientId}:${options.clientSecret}`);
const response = await request(
"PATCH /applications/{client_id}/token",
{
headers: {
authorization: `basic ${auth}`
},
client_id: options.clientId,
access_token: options.token
}
);
const authentication = {
clientType: options.clientType,
clientId: options.clientId,
clientSecret: options.clientSecret,
token: response.data.token,
scopes: response.data.scopes
};
if (response.data.expires_at)
authentication.expiresAt = response.data.expires_at;
if (options.clientType === "github-app") {
delete authentication.scopes;
}
return { ...response, authentication };
}
export {
resetToken
};

View File

@@ -0,0 +1,36 @@
import { request as defaultRequest } from "@octokit/request";
async function scopeToken(options) {
const {
request: optionsRequest,
clientType,
clientId,
clientSecret,
token,
...requestOptions
} = options;
const request = options.request || defaultRequest;
const response = await request(
"POST /applications/{client_id}/token/scoped",
{
headers: {
authorization: `basic ${btoa(`${clientId}:${clientSecret}`)}`
},
client_id: clientId,
access_token: token,
...requestOptions
}
);
const authentication = Object.assign(
{
clientType,
clientId,
clientSecret,
token: response.data.token
},
response.data.expires_at ? { expiresAt: response.data.expires_at } : {}
);
return { ...response, authentication };
}
export {
scopeToken
};

34
node_modules/@octokit/oauth-methods/dist-src/utils.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import { RequestError } from "@octokit/request-error";
function requestToOAuthBaseUrl(request) {
const endpointDefaults = request.endpoint.DEFAULTS;
return /^https:\/\/(api\.)?github\.com$/.test(endpointDefaults.baseUrl) ? "https://github.com" : endpointDefaults.baseUrl.replace("/api/v3", "");
}
async function oauthRequest(request, route, parameters) {
const withOAuthParameters = {
baseUrl: requestToOAuthBaseUrl(request),
headers: {
accept: "application/json"
},
...parameters
};
const response = await request(route, withOAuthParameters);
if ("error" in response.data) {
const error = new RequestError(
`${response.data.error_description} (${response.data.error}, ${response.data.error_uri})`,
400,
{
request: request.endpoint.merge(
route,
withOAuthParameters
)
}
);
error.response = response;
throw error;
}
return response;
}
export {
oauthRequest,
requestToOAuthBaseUrl
};

View File

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

View File

@@ -0,0 +1,24 @@
import type { RequestInterface, Endpoints } from "@octokit/types";
import type { OAuthAppAuthentication, GitHubAppAuthenticationWithExpirationEnabled, GitHubAppAuthenticationWithExpirationDisabled } from "./types.js";
export type CheckTokenOAuthAppOptions = {
clientType: "oauth-app";
clientId: string;
clientSecret: string;
token: string;
request?: RequestInterface;
};
export type CheckTokenGitHubAppOptions = {
clientType: "github-app";
clientId: string;
clientSecret: string;
token: string;
request?: RequestInterface;
};
export type CheckTokenOAuthAppResponse = Endpoints["POST /applications/{client_id}/token"]["response"] & {
authentication: OAuthAppAuthentication;
};
export type CheckTokenGitHubAppResponse = Endpoints["POST /applications/{client_id}/token"]["response"] & {
authentication: GitHubAppAuthenticationWithExpirationEnabled | GitHubAppAuthenticationWithExpirationDisabled;
};
export declare function checkToken(options: CheckTokenOAuthAppOptions): Promise<CheckTokenOAuthAppResponse>;
export declare function checkToken(options: CheckTokenGitHubAppOptions): Promise<CheckTokenGitHubAppResponse>;

View File

@@ -0,0 +1,20 @@
import type { OctokitResponse, RequestInterface } from "@octokit/types";
export type CreateDeviceCodeOAuthAppOptions = {
clientType: "oauth-app";
clientId: string;
scopes?: string[];
request?: RequestInterface;
};
export type CreateDeviceCodeGitHubAppOptions = {
clientType: "github-app";
clientId: string;
request?: RequestInterface;
};
export type CreateDeviceCodeDeviceTokenResponse = OctokitResponse<{
device_code: string;
user_code: string;
verification_uri: string;
expires_in: number;
interval: number;
}>;
export declare function createDeviceCode(options: CreateDeviceCodeOAuthAppOptions | CreateDeviceCodeGitHubAppOptions): Promise<CreateDeviceCodeDeviceTokenResponse>;

View File

@@ -0,0 +1,18 @@
import type { RequestInterface, Endpoints } from "@octokit/types";
export type DeleteAuthorizationOAuthAppOptions = {
clientType: "oauth-app";
clientId: string;
clientSecret: string;
token: string;
request?: RequestInterface;
};
export type DeleteAuthorizationGitHubAppOptions = {
clientType: "github-app";
clientId: string;
clientSecret: string;
token: string;
request?: RequestInterface;
};
export type DeleteAuthorizationResponse = Endpoints["DELETE /applications/{client_id}/grant"]["response"];
export declare function deleteAuthorization(options: DeleteAuthorizationOAuthAppOptions): Promise<DeleteAuthorizationResponse>;
export declare function deleteAuthorization(options: DeleteAuthorizationGitHubAppOptions): Promise<DeleteAuthorizationResponse>;

View File

@@ -0,0 +1,18 @@
import type { RequestInterface, Endpoints } from "@octokit/types";
export type DeleteTokenOAuthAppOptions = {
clientType: "oauth-app";
clientId: string;
clientSecret: string;
token: string;
request?: RequestInterface;
};
export type DeleteTokenGitHubAppOptions = {
clientType: "github-app";
clientId: string;
clientSecret: string;
token: string;
request?: RequestInterface;
};
export type DeleteTokenResponse = Endpoints["DELETE /applications/{client_id}/token"]["response"];
export declare function deleteToken(options: DeleteTokenOAuthAppOptions): Promise<DeleteTokenResponse>;
export declare function deleteToken(options: DeleteTokenGitHubAppOptions): Promise<DeleteTokenResponse>;

View File

@@ -0,0 +1,57 @@
import type { OctokitResponse, RequestInterface } from "@octokit/types";
import type { OAuthAppAuthentication, GitHubAppAuthenticationWithExpirationEnabled, GitHubAppAuthenticationWithExpirationDisabled, GitHubAppAuthenticationWithRefreshToken, OAuthAppCreateTokenResponseData, GitHubAppCreateTokenResponseData, GitHubAppCreateTokenWithExpirationResponseData } from "./types.js";
export type ExchangeDeviceCodeOAuthAppOptionsWithoutClientSecret = {
clientType: "oauth-app";
clientId: string;
code: string;
redirectUrl?: string;
state?: string;
request?: RequestInterface;
scopes?: string[];
};
export type ExchangeDeviceCodeOAuthAppOptions = ExchangeDeviceCodeOAuthAppOptionsWithoutClientSecret & {
clientSecret: string;
};
export type ExchangeDeviceCodeGitHubAppOptionsWithoutClientSecret = {
clientType: "github-app";
clientId: string;
code: string;
redirectUrl?: string;
state?: string;
request?: RequestInterface;
};
export type ExchangeDeviceCodeGitHubAppOptions = ExchangeDeviceCodeGitHubAppOptionsWithoutClientSecret & {
clientSecret: string;
};
type OAuthAppAuthenticationWithoutClientSecret = Omit<OAuthAppAuthentication, "clientSecret">;
type GitHubAppAuthenticationWithoutClientSecret = Omit<GitHubAppAuthenticationWithExpirationEnabled | GitHubAppAuthenticationWithExpirationDisabled, "clientSecret">;
type GitHubAppAuthenticationWithExpirationWithoutClientSecret = Omit<GitHubAppAuthenticationWithRefreshToken, "clientSecret">;
export type ExchangeDeviceCodeOAuthAppResponse = OctokitResponse<OAuthAppCreateTokenResponseData> & {
authentication: OAuthAppAuthentication;
};
export type ExchangeDeviceCodeOAuthAppResponseWithoutClientSecret = OctokitResponse<OAuthAppCreateTokenResponseData> & {
authentication: OAuthAppAuthenticationWithoutClientSecret;
};
export type ExchangeDeviceCodeGitHubAppResponse = OctokitResponse<GitHubAppCreateTokenResponseData | GitHubAppCreateTokenWithExpirationResponseData> & {
authentication: GitHubAppAuthenticationWithExpirationEnabled | GitHubAppAuthenticationWithExpirationDisabled | GitHubAppAuthenticationWithRefreshToken;
};
export type ExchangeDeviceCodeGitHubAppResponseWithoutClientSecret = OctokitResponse<GitHubAppCreateTokenResponseData | GitHubAppCreateTokenWithExpirationResponseData> & {
authentication: GitHubAppAuthenticationWithoutClientSecret | GitHubAppAuthenticationWithExpirationWithoutClientSecret;
};
/**
* Exchange the code from GitHub's OAuth Web flow for OAuth Apps.
*/
export declare function exchangeDeviceCode(options: ExchangeDeviceCodeOAuthAppOptions): Promise<ExchangeDeviceCodeOAuthAppResponse>;
/**
* Exchange the code from GitHub's OAuth Web flow for OAuth Apps without clientSecret
*/
export declare function exchangeDeviceCode(options: ExchangeDeviceCodeOAuthAppOptionsWithoutClientSecret): Promise<ExchangeDeviceCodeOAuthAppResponseWithoutClientSecret>;
/**
* Exchange the code from GitHub's OAuth Web flow for GitHub Apps. `scopes` are not supported by GitHub Apps.
*/
export declare function exchangeDeviceCode(options: ExchangeDeviceCodeGitHubAppOptions): Promise<ExchangeDeviceCodeGitHubAppResponse>;
/**
* Exchange the code from GitHub's OAuth Web flow for GitHub Apps without using `clientSecret`. `scopes` are not supported by GitHub Apps.
*/
export declare function exchangeDeviceCode(options: ExchangeDeviceCodeGitHubAppOptionsWithoutClientSecret): Promise<ExchangeDeviceCodeGitHubAppResponseWithoutClientSecret>;
export {};

View File

@@ -0,0 +1,32 @@
import type { OctokitResponse, RequestInterface } from "@octokit/types";
import type { OAuthAppAuthentication, GitHubAppAuthenticationWithExpirationEnabled, GitHubAppAuthenticationWithExpirationDisabled, GitHubAppAuthenticationWithRefreshToken, OAuthAppCreateTokenResponseData, GitHubAppCreateTokenResponseData, GitHubAppCreateTokenWithExpirationResponseData } from "./types.js";
export type ExchangeWebFlowCodeOAuthAppOptions = {
clientType: "oauth-app";
clientId: string;
clientSecret: string;
code: string;
redirectUrl?: string;
request?: RequestInterface;
};
export type ExchangeWebFlowCodeGitHubAppOptions = {
clientType: "github-app";
clientId: string;
clientSecret: string;
code: string;
redirectUrl?: string;
request?: RequestInterface;
};
export type ExchangeWebFlowCodeOAuthAppResponse = OctokitResponse<OAuthAppCreateTokenResponseData> & {
authentication: OAuthAppAuthentication;
};
export type ExchangeWebFlowCodeGitHubAppResponse = OctokitResponse<GitHubAppCreateTokenResponseData | GitHubAppCreateTokenWithExpirationResponseData> & {
authentication: GitHubAppAuthenticationWithExpirationEnabled | GitHubAppAuthenticationWithExpirationDisabled | GitHubAppAuthenticationWithRefreshToken;
};
/**
* Exchange the code from GitHub's OAuth Web flow for OAuth Apps.
*/
export declare function exchangeWebFlowCode(options: ExchangeWebFlowCodeOAuthAppOptions): Promise<ExchangeWebFlowCodeOAuthAppResponse>;
/**
* Exchange the code from GitHub's OAuth Web flow for GitHub Apps. Note that `scopes` are not supported by GitHub Apps.
*/
export declare function exchangeWebFlowCode(options: ExchangeWebFlowCodeGitHubAppOptions): Promise<ExchangeWebFlowCodeGitHubAppResponse>;

View File

@@ -0,0 +1,25 @@
import type { OAuthAppResult, GitHubAppResult } from "@octokit/oauth-authorization-url";
import type { RequestInterface } from "@octokit/types";
export type GetWebFlowAuthorizationUrlOAuthAppOptions = {
clientType: "oauth-app";
clientId: string;
allowSignup?: boolean;
login?: string;
scopes?: string | string[];
redirectUrl?: string;
state?: string;
request?: RequestInterface;
};
export type GetWebFlowAuthorizationUrlGitHubAppOptions = {
clientType: "github-app";
clientId: string;
allowSignup?: boolean;
login?: string;
redirectUrl?: string;
state?: string;
request?: RequestInterface;
};
export type GetWebFlowAuthorizationUrlOAuthAppResult = OAuthAppResult;
export type GetWebFlowAuthorizationUrlGitHubAppResult = GitHubAppResult;
export declare function getWebFlowAuthorizationUrl(options: GetWebFlowAuthorizationUrlOAuthAppOptions): OAuthAppResult;
export declare function getWebFlowAuthorizationUrl(options: GetWebFlowAuthorizationUrlGitHubAppOptions): GitHubAppResult;

View File

@@ -0,0 +1,12 @@
export { VERSION } from "./version.js";
export * from "./get-web-flow-authorization-url.js";
export * from "./exchange-web-flow-code.js";
export * from "./create-device-code.js";
export * from "./exchange-device-code.js";
export * from "./check-token.js";
export * from "./refresh-token.js";
export * from "./scope-token.js";
export * from "./reset-token.js";
export * from "./delete-token.js";
export * from "./delete-authorization.js";
export type { OAuthAppAuthentication, GitHubAppAuthenticationWithExpirationDisabled, GitHubAppAuthenticationWithExpirationEnabled, GitHubAppAuthenticationWithRefreshToken, GitHubAppAuthentication, GitHubAppAuthenticationWithExpiration, } from "./types.js";

View File

@@ -0,0 +1,13 @@
import type { OctokitResponse, RequestInterface } from "@octokit/types";
import type { GitHubAppAuthenticationWithRefreshToken, GitHubAppCreateTokenWithExpirationResponseData } from "./types.js";
export type RefreshTokenOptions = {
clientType: "github-app";
clientId: string;
clientSecret: string;
refreshToken: string;
request?: RequestInterface;
};
export type RefreshTokenResponse = OctokitResponse<GitHubAppCreateTokenWithExpirationResponseData> & {
authentication: GitHubAppAuthenticationWithRefreshToken;
};
export declare function refreshToken(options: RefreshTokenOptions): Promise<RefreshTokenResponse>;

View File

@@ -0,0 +1,24 @@
import type { Endpoints, RequestInterface } from "@octokit/types";
import type { OAuthAppAuthentication, GitHubAppAuthenticationWithExpirationEnabled, GitHubAppAuthenticationWithExpirationDisabled } from "./types.js";
export type ResetTokenOAuthAppOptions = {
clientType: "oauth-app";
clientId: string;
clientSecret: string;
token: string;
request?: RequestInterface;
};
export type ResetTokenGitHubAppOptions = {
clientType: "github-app";
clientId: string;
clientSecret: string;
token: string;
request?: RequestInterface;
};
export type ResetTokenOAuthAppResponse = Endpoints["PATCH /applications/{client_id}/token"]["response"] & {
authentication: OAuthAppAuthentication;
};
export type ResetTokenGitHubAppResponse = Endpoints["PATCH /applications/{client_id}/token"]["response"] & {
authentication: GitHubAppAuthenticationWithExpirationEnabled | GitHubAppAuthenticationWithExpirationDisabled;
};
export declare function resetToken(options: ResetTokenOAuthAppOptions): Promise<ResetTokenOAuthAppResponse>;
export declare function resetToken(options: ResetTokenGitHubAppOptions): Promise<ResetTokenGitHubAppResponse>;

View File

@@ -0,0 +1,29 @@
import type { RequestInterface, Endpoints } from "@octokit/types";
import type { GitHubAppAuthenticationWithExpirationEnabled, GitHubAppAuthenticationWithExpirationDisabled } from "./types.js";
type CommonOptions = {
clientType: "github-app";
clientId: string;
clientSecret: string;
token: string;
permissions?: Endpoint["parameters"]["permissions"];
request?: RequestInterface;
};
type TargetOption = {
target: string;
};
type TargetIdOption = {
target_id: number;
};
type RepositoriesOption = {
repositories?: string[];
};
type RepositoryIdsOption = {
repository_ids?: number[];
};
type Endpoint = Endpoints["POST /applications/{client_id}/token/scoped"];
export type ScopeTokenOptions = (CommonOptions & TargetOption & RepositoriesOption) | (CommonOptions & TargetIdOption & RepositoriesOption) | (CommonOptions & TargetOption & RepositoryIdsOption) | (CommonOptions & TargetIdOption & RepositoryIdsOption);
export type ScopeTokenResponse = Endpoint["response"] & {
authentication: GitHubAppAuthenticationWithExpirationEnabled | GitHubAppAuthenticationWithExpirationDisabled;
};
export declare function scopeToken(options: ScopeTokenOptions): Promise<ScopeTokenResponse>;
export {};

View File

@@ -0,0 +1,58 @@
export type OAuthAppAuthentication = {
clientType: "oauth-app";
clientId: string;
clientSecret: string;
token: string;
scopes: string[];
};
export type GitHubAppAuthenticationWithExpirationDisabled = {
clientType: "github-app";
clientId: string;
clientSecret: string;
token: string;
};
export type GitHubAppAuthenticationWithExpirationEnabled = GitHubAppAuthenticationWithExpirationDisabled & {
expiresAt: string;
};
export type GitHubAppAuthenticationWithRefreshToken = GitHubAppAuthenticationWithExpirationEnabled & {
refreshToken: string;
refreshTokenExpiresAt: string;
};
/**
* @deprecated Use `GitHubAppAuthenticationWithExpirationDisabled` or
* `GitHubAppAuthenticationWithExpirationEnabled` instead.
*/
export type GitHubAppAuthentication = {
clientType: "github-app";
clientId: string;
clientSecret: string;
token: string;
};
/**
* @deprecated Use `GitHubAppAuthenticationWithRefreshToken` instead.
*/
export type GitHubAppAuthenticationWithExpiration = {
clientType: "github-app";
clientId: string;
clientSecret: string;
token: string;
refreshToken: string;
expiresAt: string;
refreshTokenExpiresAt: string;
};
export type OAuthAppCreateTokenResponseData = {
access_token: string;
scope: string;
token_type: "bearer";
};
export type GitHubAppCreateTokenResponseData = {
access_token: string;
token_type: "bearer";
};
export type GitHubAppCreateTokenWithExpirationResponseData = {
access_token: string;
token_type: "bearer";
expires_in: number;
refresh_token: string;
refresh_token_expires_in: number;
};

View File

@@ -0,0 +1,3 @@
import type { RequestInterface } from "@octokit/types";
export declare function requestToOAuthBaseUrl(request: RequestInterface): string;
export declare function oauthRequest(request: RequestInterface, route: string, parameters: Record<string, unknown>): Promise<import("@octokit/types").OctokitResponse<any, number>>;

View File

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

54
node_modules/@octokit/oauth-methods/package.json generated vendored Normal file
View File

@@ -0,0 +1,54 @@
{
"name": "@octokit/oauth-methods",
"type": "module",
"version": "6.0.2",
"description": "Set of stateless request methods to create, check, reset, refresh, and delete user access tokens for OAuth and GitHub Apps",
"repository": "https://github.com/octokit/oauth-methods.js",
"keywords": [
"github",
"api",
"sdk",
"toolkit",
"oauth"
],
"author": "Gregor Martynus (https://dev.to/gr2m)",
"license": "MIT",
"dependencies": {
"@octokit/oauth-authorization-url": "^8.0.0",
"@octokit/request": "^10.0.6",
"@octokit/request-error": "^7.0.2",
"@octokit/types": "^16.0.0"
},
"devDependencies": {
"@octokit/tsconfig": "^4.0.0",
"@types/node": "^24.0.0",
"@vitest/coverage-v8": "^3.0.0",
"esbuild": "^0.25.0",
"fetch-mock": "^11.0.0",
"glob": "^11.0.0",
"prettier": "3.5.3",
"semantic-release-plugin-update-version-in-files": "^2.0.0",
"typescript": "^5.0.0",
"vitest": "^3.0.0"
},
"publishConfig": {
"access": "public",
"provenance": true
},
"engines": {
"node": ">= 20"
},
"files": [
"dist-*/**",
"bin/**"
],
"types": "./dist-types/index.d.ts",
"exports": {
".": {
"types": "./dist-types/index.d.ts",
"import": "./dist-bundle/index.js",
"default": "./dist-bundle/index.js"
}
},
"sideEffects": false
}