import type { Octokit } from "@octokit/core"; import type { createTokenAuth, Types as TokenAuthTypes } from "@octokit/auth-token"; import type * as AppAuth from "@octokit/auth-app"; import type { createUnauthenticatedAuth } from "@octokit/auth-unauthenticated"; type OctokitStrategyOptions = { octokit: InstanceType; octokitOptions: ConstructorParameters & { auth: unknown; }; }; export type StrategyOptions = (OctokitStrategyOptions & { token: string; }) | (OctokitStrategyOptions & AppAuth.StrategyOptions); export type AuthOptions = TokenAuthTypes["AuthOptions"] | AppAuth.InstallationAuthOptions | { type: "event-octokit"; event: { id: string; name: string; payload: Record & { action?: string; installation: { id: number; }; }; }; }; type TokenState = OctokitStrategyOptions & { type: "token"; auth: ReturnType; }; type AppState = OctokitStrategyOptions & { type: "app"; auth: ReturnType; }; type UnauthenticatedState = OctokitStrategyOptions & { type: "unauthenticated"; auth: ReturnType; }; export type State = TokenState | AppState | UnauthenticatedState; export {};