@octokit/oauth-app
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -64,3 +64,3 @@ 'use strict'; | ||
const VERSION = "3.1.0"; | ||
const VERSION = "3.2.0"; | ||
@@ -680,3 +680,4 @@ function addEventHandler(state, eventName, eventHandler) { | ||
}; | ||
this.on = addEventHandler.bind(null, state); | ||
this.on = addEventHandler.bind(null, state); // @ts-expect-error TODO: figure this out | ||
this.octokit = octokit; | ||
@@ -683,0 +684,0 @@ this.getUserOctokit = getUserOctokitWithState.bind(null, state); |
@@ -41,2 +41,3 @@ import { createOAuthAppAuth } from "@octokit/auth-oauth-app"; | ||
this.on = addEventHandler.bind(null, state); | ||
// @ts-expect-error TODO: figure this out | ||
this.octokit = octokit; | ||
@@ -43,0 +44,0 @@ this.getUserOctokit = getUserOctokitWithState.bind(null, state); |
@@ -1,1 +0,1 @@ | ||
export const VERSION = "3.1.0"; | ||
export const VERSION = "3.2.0"; |
@@ -1,2 +0,2 @@ | ||
import { EventHandler, EventAndActionName, State, ClientType } from "./types"; | ||
export declare function addEventHandler(state: State, eventName: EventAndActionName | EventAndActionName[], eventHandler: EventHandler<ClientType>): void; | ||
import { EventHandler, EventAndActionName, State, ClientType, OAuthAppOctokitClassType } from "./types"; | ||
export declare function addEventHandler(state: State, eventName: EventAndActionName | EventAndActionName[], eventHandler: EventHandler<ClientType, OAuthAppOctokitClassType>): void; |
@@ -1,2 +0,2 @@ | ||
import { State, EventHandlerContext, ClientType } from "./types"; | ||
export declare function emitEvent(state: State, context: EventHandlerContext<ClientType>): Promise<void>; | ||
import { State, EventHandlerContext, ClientType, OAuthAppOctokitClassType } from "./types"; | ||
export declare function emitEvent(state: State, context: EventHandlerContext<ClientType, OAuthAppOctokitClassType>): Promise<void>; |
@@ -10,6 +10,6 @@ import { GetUserOctokitWithStateInterface } from "./methods/get-user-octokit"; | ||
import { DeleteAuthorizationInterface } from "./methods/delete-authorization"; | ||
import { ConstructorOptions, OctokitInstance, ClientType, AddEventHandler } from "./types"; | ||
import { ConstructorOptions, OAuthAppOctokitClassType, ClientType, AddEventHandler } from "./types"; | ||
export { createNodeMiddleware } from "./middleware/node/index"; | ||
declare type Constructor<T> = new (...args: any[]) => T; | ||
export declare class OAuthApp<TClientType extends ClientType = "oauth-app"> { | ||
export declare class OAuthApp<TClientType extends ClientType = "oauth-app", TOctokit extends OAuthAppOctokitClassType = OAuthAppOctokitClassType> { | ||
static VERSION: string; | ||
@@ -21,6 +21,6 @@ static defaults<TClientType extends ClientType, S extends Constructor<any>>(this: S, defaults: Partial<ConstructorOptions<TClientType>>): { | ||
} & S; | ||
constructor(options: ConstructorOptions<TClientType>); | ||
constructor(options: ConstructorOptions<TClientType, TOctokit>); | ||
type: TClientType; | ||
on: AddEventHandler<TClientType>; | ||
octokit: OctokitInstance; | ||
on: AddEventHandler<TClientType, TOctokit>; | ||
octokit: InstanceType<TOctokit>; | ||
getUserOctokit: GetUserOctokitWithStateInterface<TClientType>; | ||
@@ -27,0 +27,0 @@ getWebFlowAuthorizationUrl: GetWebFlowAuthorizationUrlInterface<TClientType>; |
import { OAuthAppUserAuthentication, GitHubAppUserAuthentication, GitHubAppUserAuthenticationWithExpiration } from "@octokit/auth-oauth-app"; | ||
import { OAuthAppOctokit } from "./oauth-app-octokit"; | ||
export declare type ClientType = "oauth-app" | "github-app"; | ||
export declare type OAuthAppOctokitClassType = typeof OAuthAppOctokit; | ||
export declare type Scope = string; | ||
@@ -11,3 +12,3 @@ export declare type ClientId = string; | ||
export declare type EventAndActionName = "token" | "token.created" | "token.reset" | "token.refreshed" | "token.scoped" | "token.deleted" | "authorization" | "authorization.deleted"; | ||
declare type CommonConstructorOptions = { | ||
declare type CommonConstructorOptions<TOctokit extends OAuthAppOctokitClassType> = { | ||
clientId: ClientId; | ||
@@ -18,11 +19,11 @@ clientSecret: ClientSecret; | ||
log?: typeof console; | ||
Octokit?: typeof OAuthAppOctokit; | ||
Octokit?: TOctokit; | ||
}; | ||
export declare type ConstructorOptions<TClientType extends ClientType> = TClientType extends "oauth-app" ? CommonConstructorOptions & { | ||
export declare type ConstructorOptions<TClientType extends ClientType, TOctokit extends OAuthAppOctokitClassType = OAuthAppOctokitClassType> = TClientType extends "oauth-app" ? CommonConstructorOptions<TOctokit> & { | ||
clientType?: TClientType; | ||
defaultScopes?: Scope[]; | ||
} : CommonConstructorOptions & { | ||
} : CommonConstructorOptions<TOctokit> & { | ||
clientType?: TClientType; | ||
}; | ||
export declare type OctokitInstance = InstanceType<typeof OAuthAppOctokit>; | ||
export declare type OctokitInstance = InstanceType<OAuthAppOctokitClassType>; | ||
export declare type State = { | ||
@@ -36,9 +37,9 @@ clientType: ClientType; | ||
log?: typeof console; | ||
Octokit: typeof OAuthAppOctokit; | ||
Octokit: OAuthAppOctokitClassType; | ||
octokit: OctokitInstance; | ||
eventHandlers: { | ||
[key: string]: EventHandler<ClientType>[]; | ||
[key: string]: EventHandler<ClientType, OAuthAppOctokitClassType>[]; | ||
}; | ||
}; | ||
export declare type EventHandlerContext<TClientType extends ClientType> = TClientType extends "oauth-app" ? { | ||
export declare type EventHandlerContext<TClientType extends ClientType, TOctokit extends OAuthAppOctokitClassType> = TClientType extends "oauth-app" ? { | ||
name: EventName; | ||
@@ -48,3 +49,3 @@ action: ActionName; | ||
scopes?: Scope[]; | ||
octokit: InstanceType<typeof OAuthAppOctokit>; | ||
octokit: InstanceType<TOctokit>; | ||
authentication?: OAuthAppUserAuthentication; | ||
@@ -55,7 +56,7 @@ } : { | ||
token: Token; | ||
octokit: InstanceType<typeof OAuthAppOctokit>; | ||
octokit: InstanceType<TOctokit>; | ||
authentication?: GitHubAppUserAuthentication | GitHubAppUserAuthenticationWithExpiration; | ||
}; | ||
export declare type EventHandler<TClientType extends ClientType> = (context: EventHandlerContext<TClientType>) => void; | ||
export declare type AddEventHandler<TClientType extends ClientType> = (eventName: EventAndActionName | EventAndActionName[], eventHandler: EventHandler<TClientType>) => void; | ||
export declare type EventHandler<TClientType extends ClientType, TOctokit extends OAuthAppOctokitClassType> = (context: EventHandlerContext<TClientType, TOctokit>) => void; | ||
export declare type AddEventHandler<TClientType extends ClientType, TOctokit extends OAuthAppOctokitClassType> = (eventName: EventAndActionName | EventAndActionName[], eventHandler: EventHandler<TClientType, TOctokit>) => void; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "3.1.0"; | ||
export declare const VERSION = "3.2.0"; |
{ | ||
"name": "@octokit/oauth-app", | ||
"description": "GitHub OAuth toolset for Node.js", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"license": "MIT", | ||
@@ -23,3 +23,3 @@ "files": [ | ||
"@octokit/auth-unauthenticated": "^2.0.0", | ||
"@octokit/core": "^3.0.0", | ||
"@octokit/core": "^3.3.2", | ||
"@octokit/oauth-authorization-url": "^4.2.1", | ||
@@ -26,0 +26,0 @@ "@octokit/oauth-methods": "^1.2.2", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
131281
1455
Updated@octokit/core@^3.3.2