1
1
import * as OctokitTypes from "@octokit/types" ;
2
2
import LRUCache from "lru-cache" ;
3
- import {
4
- GitHubAuthInterface ,
5
- AppAuthentication as OAuthAppAuthentication ,
6
- GitHubAppUserAuthentication ,
7
- GitHubAppUserAuthenticationWithExpiration ,
8
- AppAuthOptions as OAuthAppAuthOptions ,
9
- WebFlowAuthOptions ,
10
- GitHubAppDeviceFlowAuthOptions ,
11
- } from "@octokit/auth-oauth-app" ;
3
+ // import {
4
+ // GitHubAuthInterface as OAuthAppGitHubAuthInterface,
5
+ // AppAuthentication as OAuthAppAuthentication,
6
+ // GitHubAppUserAuthentication,
7
+ // GitHubAppUserAuthenticationWithExpiration,
8
+ // AppAuthOptions as OAuthAppAuthOptions,
9
+ // WebFlowAuthOptions,
10
+ // GitHubAppDeviceFlowAuthOptions,
11
+ // } from "@octokit/auth-oauth-app";
12
+ import * as OAuthAppAuth from "@octokit/auth-oauth-app" ;
12
13
13
14
export type AnyResponse = OctokitTypes . OctokitResponse < any > ;
14
15
export type EndpointDefaults = OctokitTypes . EndpointDefaults ;
@@ -70,6 +71,10 @@ export type InstallationAccessTokenAuthentication = InstallationAccessTokenData
70
71
tokenType : INSTALLATION_TOKEN_TYPE ;
71
72
} ;
72
73
74
+ export type OAuthAppAuthentication = OAuthAppAuth . AppAuthentication ;
75
+ export type GitHubAppUserAuthentication = OAuthAppAuth . GitHubAppUserAuthentication ;
76
+ export type GitHubAppUserAuthenticationWithExpiration = OAuthAppAuth . GitHubAppUserAuthenticationWithExpiration ;
77
+
73
78
export type Authentication =
74
79
| AppAuthentication
75
80
| OAuthAppAuthentication
@@ -104,17 +109,6 @@ export type Permissions = {
104
109
[ name : string ] : string ;
105
110
} ;
106
111
107
- type CommonAuthOptions = {
108
- installationId ?: number | string ;
109
- repositoryIds ?: number [ ] ;
110
- permissions ?: Permissions ;
111
- refresh ?: boolean ;
112
- // TODO: return type of `auth({ type: "installation", installationId, factory })`
113
- // should be Promise<ReturnType<factory>>
114
- factory ?: ( options : FactoryOptions ) => unknown ;
115
- [ key : string ] : unknown ;
116
- } ;
117
-
118
112
export type AuthType =
119
113
| "app"
120
114
| "installation"
@@ -138,12 +132,16 @@ export type InstallationAuthOptions = {
138
132
[ key : string ] : unknown ;
139
133
} ;
140
134
135
+ export type OAuthAppAuthOptions = OAuthAppAuth . AppAuthOptions ;
136
+ export type OAuthWebFlowAuthOptions = OAuthAppAuth . WebFlowAuthOptions ;
137
+ export type OAuthDeviceFlowAuthOptions = OAuthAppAuth . GitHubAppDeviceFlowAuthOptions ;
138
+
141
139
export type AuthOptions =
142
140
| AppAuthOptions
143
141
| OAuthAppAuthOptions
144
142
| InstallationAuthOptions
145
- | WebFlowAuthOptions
146
- | GitHubAppDeviceFlowAuthOptions ;
143
+ | OAuthWebFlowAuthOptions
144
+ | OAuthDeviceFlowAuthOptions ;
147
145
148
146
export type WithInstallationId = {
149
147
installationId : number ;
@@ -152,5 +150,5 @@ export type WithInstallationId = {
152
150
export type State = Required < Omit < CommonStrategyOptions , "installationId" > > & {
153
151
installationId ?: number ;
154
152
} & OAuthStrategyOptions & {
155
- oauthApp : GitHubAuthInterface ;
153
+ oauthApp : OAuthAppAuth . GitHubAuthInterface ;
156
154
} ;
0 commit comments