Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0e2bbdd

Browse files
Merge pull request #314 from dhensby/pulls/typings
refactor(types): update types to be more concise
2 parents 463b517 + 9cc75bf commit 0e2bbdd

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

‎index.d.ts‎

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ declare namespace OAuth2Server {
5151
*/
5252
class Request {
5353
body?: any;
54-
headers?: {[key: string]: string;}|undefined;
55-
method?: string|undefined;
56-
query?: {[key: string]: string;}|undefined;
54+
headers?: Record<string, string>;
55+
method?: string;
56+
query?: Record<string, string>;
5757

5858
/**
5959
* Instantiates Request using the supplied options.
6060
*
6161
*/
62-
constructor(options?: {[key: string]: any} | http.IncomingMessage);
62+
constructor(options?: Record<string, any> | http.IncomingMessage);
6363

6464
/**
6565
* Returns the specified HTTP header field. The match is case-insensitive.
@@ -79,14 +79,14 @@ declare namespace OAuth2Server {
7979
*/
8080
class Response {
8181
body?: any;
82-
headers?: {[key: string]: string;}|undefined;
83-
status?: number|undefined;
82+
headers?: Record<string, string>;
83+
status?: number;
8484

8585
/**
8686
* Instantiates Response using the supplied options.
8787
*
8888
*/
89-
constructor(options?: {[key: string]: any;} | http.ServerResponse);
89+
constructor(options?: Record<string, any> | http.ServerResponse);
9090

9191
/**
9292
* Returns the specified HTTP header field. The match is case-insensitive.
@@ -173,66 +173,66 @@ declare namespace OAuth2Server {
173173
/**
174174
* Set the X-Accepted-OAuth-Scopes HTTP header on response objects.
175175
*/
176-
addAcceptedScopesHeader?: boolean|undefined;
176+
addAcceptedScopesHeader?: boolean;
177177

178178
/**
179179
* Set the X-OAuth-Scopes HTTP header on response objects.
180180
*/
181-
addAuthorizedScopesHeader?: boolean|undefined;
181+
addAuthorizedScopesHeader?: boolean;
182182

183183
/**
184184
* Allow clients to pass bearer tokens in the query string of a request.
185185
*/
186-
allowBearerTokensInQueryString?: boolean|undefined;
186+
allowBearerTokensInQueryString?: boolean;
187187
}
188188

189189
interface AuthorizeOptions {
190190
/**
191191
* The authenticate handler
192192
*/
193-
authenticateHandler?: {}|undefined;
193+
authenticateHandler?: {};
194194

195195
/**
196196
* Allow clients to specify an empty state
197197
*/
198-
allowEmptyState?: boolean|undefined;
198+
allowEmptyState?: boolean;
199199

200200
/**
201201
* Lifetime of generated authorization codes in seconds (default = 5 minutes).
202202
*/
203-
authorizationCodeLifetime?: number|undefined;
203+
authorizationCodeLifetime?: number;
204204
}
205205

206206
interface TokenOptions {
207207
/**
208208
* Lifetime of generated access tokens in seconds (default = 1 hour)
209209
*/
210-
accessTokenLifetime?: number|undefined;
210+
accessTokenLifetime?: number;
211211

212212
/**
213213
* Lifetime of generated refresh tokens in seconds (default = 2 weeks)
214214
*/
215-
refreshTokenLifetime?: number|undefined;
215+
refreshTokenLifetime?: number;
216216

217217
/**
218218
* Allow extended attributes to be set on the returned token
219219
*/
220-
allowExtendedTokenAttributes?: boolean|undefined;
220+
allowExtendedTokenAttributes?: boolean;
221221

222222
/**
223223
* Require a client secret. Defaults to true for all grant types.
224224
*/
225-
requireClientAuthentication?: {}|undefined;
225+
requireClientAuthentication?: {};
226226

227227
/**
228228
* Always revoke the used refresh token and issue a new one for the refresh_token grant.
229229
*/
230-
alwaysIssueNewRefreshToken?: boolean|undefined;
230+
alwaysIssueNewRefreshToken?: boolean;
231231

232232
/**
233233
* Additional supported grant types.
234234
*/
235-
extendedGrantTypes?: {[key: string]: typeof AbstractGrantType}|undefined;
235+
extendedGrantTypes?: Record<string, typeof AbstractGrantType>;
236236
}
237237

238238
/**
@@ -392,10 +392,10 @@ declare namespace OAuth2Server {
392392
*/
393393
interface Client {
394394
id: string;
395-
redirectUris?: string | string[]|undefined;
395+
redirectUris?: string | string[];
396396
grants: string | string[];
397-
accessTokenLifetime?: number|undefined;
398-
refreshTokenLifetime?: number|undefined;
397+
accessTokenLifetime?: number;
398+
refreshTokenLifetime?: number;
399399
[key: string]: any;
400400
}
401401

@@ -406,7 +406,7 @@ declare namespace OAuth2Server {
406406
authorizationCode: string;
407407
expiresAt: Date;
408408
redirectUri: string;
409-
scope?: string[]|undefined;
409+
scope?: string[];
410410
client: Client;
411411
user: User;
412412
codeChallenge?: string;
@@ -419,10 +419,10 @@ declare namespace OAuth2Server {
419419
*/
420420
interface Token {
421421
accessToken: string;
422-
accessTokenExpiresAt?: Date|undefined;
423-
refreshToken?: string|undefined;
424-
refreshTokenExpiresAt?: Date|undefined;
425-
scope?: string[]|undefined;
422+
accessTokenExpiresAt?: Date;
423+
refreshToken?: string;
424+
refreshTokenExpiresAt?: Date;
425+
scope?: string[];
426426
client: Client;
427427
user: User;
428428
[key: string]: any;
@@ -433,8 +433,8 @@ declare namespace OAuth2Server {
433433
*/
434434
interface RefreshToken {
435435
refreshToken: string;
436-
refreshTokenExpiresAt?: Date|undefined;
437-
scope?: string[]|undefined;
436+
refreshTokenExpiresAt?: Date;
437+
scope?: string[];
438438
client: Client;
439439
user: User;
440440
[key: string]: any;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /