@octokit/oauth-app
Advanced tools
Comparing version 3.5.0 to 3.5.1
@@ -68,3 +68,3 @@ 'use strict'; | ||
const VERSION = "3.5.0"; | ||
const VERSION = "3.5.1"; | ||
@@ -180,3 +180,3 @@ function addEventHandler(state, eventName, eventHandler) { | ||
async function checkTokenWithState(state, options) { | ||
return await OAuthMethods.checkToken(_objectSpread2({ | ||
const result = await OAuthMethods.checkToken(_objectSpread2({ | ||
// @ts-expect-error not worth the extra code to appease TS | ||
@@ -188,2 +188,7 @@ clientType: state.clientType, | ||
}, options)); | ||
Object.assign(result.authentication, { | ||
type: "token", | ||
tokenType: "oauth" | ||
}); | ||
return result; | ||
} | ||
@@ -202,2 +207,6 @@ | ||
}, optionsWithDefaults)); | ||
const authentication = Object.assign(response.authentication, { | ||
type: "token", | ||
tokenType: "oauth" | ||
}); | ||
await emitEvent(state, { | ||
@@ -208,6 +217,3 @@ name: "token", | ||
scopes: response.authentication.scopes || undefined, | ||
authentication: _objectSpread2({ | ||
type: "token", | ||
tokenType: "oauth" | ||
}, response.authentication), | ||
authentication: authentication, | ||
octokit: new state.Octokit({ | ||
@@ -224,3 +230,5 @@ authStrategy: authOauthUser.createOAuthUserAuth, | ||
}); | ||
return response; | ||
return _objectSpread2(_objectSpread2({}, response), {}, { | ||
authentication | ||
}); | ||
} | ||
@@ -231,2 +239,6 @@ | ||
}, optionsWithDefaults)); | ||
const authentication = Object.assign(response.authentication, { | ||
type: "token", | ||
tokenType: "oauth" | ||
}); | ||
await emitEvent(state, { | ||
@@ -236,6 +248,3 @@ name: "token", | ||
token: response.authentication.token, | ||
authentication: _objectSpread2({ | ||
type: "token", | ||
tokenType: "oauth" | ||
}, response.authentication), | ||
authentication: authentication, | ||
octokit: new state.Octokit({ | ||
@@ -251,3 +260,5 @@ authStrategy: authOauthUser.createOAuthUserAuth, | ||
}); | ||
return response; | ||
return _objectSpread2(_objectSpread2({}, response), {}, { | ||
authentication | ||
}); | ||
} | ||
@@ -267,2 +278,6 @@ | ||
}); | ||
const authentication = Object.assign(response.authentication, { | ||
type: "token", | ||
tokenType: "oauth" | ||
}); | ||
await emitEvent(state, { | ||
@@ -272,6 +287,3 @@ name: "token", | ||
token: response.authentication.token, | ||
authentication: _objectSpread2({ | ||
type: "token", | ||
tokenType: "oauth" | ||
}, response.authentication), | ||
authentication: authentication, | ||
octokit: new state.Octokit({ | ||
@@ -287,3 +299,5 @@ authStrategy: authOauthUser.createOAuthUserAuth, | ||
}); | ||
return response; | ||
return _objectSpread2(_objectSpread2({}, response), {}, { | ||
authentication | ||
}); | ||
} | ||
@@ -302,2 +316,6 @@ | ||
}, options)); | ||
const authentication = Object.assign(response.authentication, { | ||
type: "token", | ||
tokenType: "oauth" | ||
}); | ||
await emitEvent(state, { | ||
@@ -307,6 +325,3 @@ name: "token", | ||
token: response.authentication.token, | ||
authentication: _objectSpread2({ | ||
type: "token", | ||
tokenType: "oauth" | ||
}, response.authentication), | ||
authentication: authentication, | ||
octokit: new state.Octokit({ | ||
@@ -322,3 +337,5 @@ authStrategy: authOauthUser.createOAuthUserAuth, | ||
}); | ||
return response; | ||
return _objectSpread2(_objectSpread2({}, response), {}, { | ||
authentication | ||
}); | ||
} | ||
@@ -550,12 +567,9 @@ | ||
const { | ||
authentication: { | ||
token, | ||
scopes | ||
} | ||
} = await app.createToken({ | ||
const result = await app.createToken({ | ||
state: oauthState, | ||
code, | ||
redirectUrl | ||
}); | ||
}); // @ts-ignore | ||
delete result.authentication.clientSecret; | ||
return { | ||
@@ -567,6 +581,3 @@ status: 201, | ||
}, | ||
text: JSON.stringify({ | ||
token, | ||
scopes | ||
}) | ||
text: JSON.stringify(result) | ||
}; | ||
@@ -586,3 +597,5 @@ } | ||
token | ||
}); | ||
}); // @ts-ignore | ||
delete result.authentication.clientSecret; | ||
return { | ||
@@ -609,3 +622,5 @@ status: 200, | ||
token | ||
}); | ||
}); // @ts-ignore | ||
delete result.authentication.clientSecret; | ||
return { | ||
@@ -640,3 +655,5 @@ status: 200, | ||
refreshToken | ||
}); | ||
}); // @ts-ignore | ||
delete result.authentication.clientSecret; | ||
return { | ||
@@ -663,3 +680,5 @@ status: 200, | ||
token | ||
}, json)); | ||
}, json)); // @ts-ignore | ||
delete result.authentication.clientSecret; | ||
return { | ||
@@ -666,0 +685,0 @@ status: 200, |
import * as OAuthMethods from "@octokit/oauth-methods"; | ||
export async function checkTokenWithState(state, options) { | ||
return await OAuthMethods.checkToken({ | ||
const result = await OAuthMethods.checkToken({ | ||
// @ts-expect-error not worth the extra code to appease TS | ||
@@ -11,2 +11,4 @@ clientType: state.clientType, | ||
}); | ||
Object.assign(result.authentication, { type: "token", tokenType: "oauth" }); | ||
return result; | ||
} |
@@ -15,2 +15,6 @@ import * as OAuthMethods from "@octokit/oauth-methods"; | ||
}); | ||
const authentication = Object.assign(response.authentication, { | ||
type: "token", | ||
tokenType: "oauth", | ||
}); | ||
await emitEvent(state, { | ||
@@ -20,7 +24,3 @@ name: "token", | ||
token: response.authentication.token, | ||
authentication: { | ||
type: "token", | ||
tokenType: "oauth", | ||
...response.authentication, | ||
}, | ||
authentication: authentication, | ||
octokit: new state.Octokit({ | ||
@@ -36,3 +36,3 @@ authStrategy: createOAuthUserAuth, | ||
}); | ||
return response; | ||
return { ...response, authentication }; | ||
} |
@@ -16,2 +16,6 @@ import * as OAuthMethods from "@octokit/oauth-methods"; | ||
}); | ||
const authentication = Object.assign(response.authentication, { | ||
type: "token", | ||
tokenType: "oauth", | ||
}); | ||
await emitEvent(state, { | ||
@@ -22,7 +26,3 @@ name: "token", | ||
scopes: response.authentication.scopes || undefined, | ||
authentication: { | ||
type: "token", | ||
tokenType: "oauth", | ||
...response.authentication, | ||
}, | ||
authentication: authentication, | ||
octokit: new state.Octokit({ | ||
@@ -39,3 +39,3 @@ authStrategy: createOAuthUserAuth, | ||
}); | ||
return response; | ||
return { ...response, authentication }; | ||
} | ||
@@ -46,2 +46,6 @@ const response = await OAuthMethods.resetToken({ | ||
}); | ||
const authentication = Object.assign(response.authentication, { | ||
type: "token", | ||
tokenType: "oauth", | ||
}); | ||
await emitEvent(state, { | ||
@@ -51,7 +55,3 @@ name: "token", | ||
token: response.authentication.token, | ||
authentication: { | ||
type: "token", | ||
tokenType: "oauth", | ||
...response.authentication, | ||
}, | ||
authentication: authentication, | ||
octokit: new state.Octokit({ | ||
@@ -67,3 +67,3 @@ authStrategy: createOAuthUserAuth, | ||
}); | ||
return response; | ||
return { ...response, authentication }; | ||
} |
@@ -15,2 +15,6 @@ import * as OAuthMethods from "@octokit/oauth-methods"; | ||
}); | ||
const authentication = Object.assign(response.authentication, { | ||
type: "token", | ||
tokenType: "oauth", | ||
}); | ||
await emitEvent(state, { | ||
@@ -20,7 +24,3 @@ name: "token", | ||
token: response.authentication.token, | ||
authentication: { | ||
type: "token", | ||
tokenType: "oauth", | ||
...response.authentication, | ||
}, | ||
authentication: authentication, | ||
octokit: new state.Octokit({ | ||
@@ -36,3 +36,3 @@ authStrategy: createOAuthUserAuth, | ||
}); | ||
return response; | ||
return { ...response, authentication }; | ||
} |
@@ -89,3 +89,3 @@ // @ts-ignore - requires esModuleInterop flag | ||
} | ||
const { authentication: { token, scopes }, } = await app.createToken({ | ||
const result = await app.createToken({ | ||
state: oauthState, | ||
@@ -95,2 +95,4 @@ code, | ||
}); | ||
// @ts-ignore | ||
delete result.authentication.clientSecret; | ||
return { | ||
@@ -102,3 +104,3 @@ status: 201, | ||
}, | ||
text: JSON.stringify({ token, scopes }), | ||
text: JSON.stringify(result), | ||
}; | ||
@@ -114,2 +116,4 @@ } | ||
}); | ||
// @ts-ignore | ||
delete result.authentication.clientSecret; | ||
return { | ||
@@ -129,5 +133,5 @@ status: 200, | ||
} | ||
const result = await app.resetToken({ | ||
token, | ||
}); | ||
const result = await app.resetToken({ token }); | ||
// @ts-ignore | ||
delete result.authentication.clientSecret; | ||
return { | ||
@@ -152,2 +156,4 @@ status: 200, | ||
const result = await app.refreshToken({ refreshToken }); | ||
// @ts-ignore | ||
delete result.authentication.clientSecret; | ||
return { | ||
@@ -171,2 +177,4 @@ status: 200, | ||
}); | ||
// @ts-ignore | ||
delete result.authentication.clientSecret; | ||
return { | ||
@@ -173,0 +181,0 @@ status: 200, |
@@ -1,1 +0,1 @@ | ||
export const VERSION = "3.5.0"; | ||
export const VERSION = "3.5.1"; |
@@ -8,3 +8,8 @@ import * as OAuthMethods from "@octokit/oauth-methods"; | ||
export interface CheckTokenInterface<TClientType extends ClientType> { | ||
(options: CheckTokenOptions): TClientType extends "oauth-app" ? Promise<OAuthMethods.CheckTokenOAuthAppResponse> : Promise<OAuthMethods.CheckTokenGitHubAppResponse>; | ||
(options: CheckTokenOptions): (TClientType extends "oauth-app" ? Promise<OAuthMethods.CheckTokenOAuthAppResponse> : Promise<OAuthMethods.CheckTokenGitHubAppResponse>) & { | ||
authentication: { | ||
type: "token"; | ||
tokenType: "oauth"; | ||
}; | ||
}; | ||
} |
@@ -6,5 +6,15 @@ import * as OAuthMethods from "@octokit/oauth-methods"; | ||
}; | ||
export declare function refreshTokenWithState(state: State, options: RefreshTokenOptions): Promise<OAuthMethods.RefreshTokenResponse>; | ||
export declare function refreshTokenWithState(state: State, options: RefreshTokenOptions): Promise<OAuthMethods.RefreshTokenResponse & { | ||
authentication: { | ||
type: "token"; | ||
tokenType: "oauth"; | ||
}; | ||
}>; | ||
export interface RefreshTokenInterface { | ||
(options: RefreshTokenOptions): Promise<OAuthMethods.RefreshTokenResponse>; | ||
(options: RefreshTokenOptions): Promise<OAuthMethods.RefreshTokenResponse & { | ||
authentication: { | ||
type: "token"; | ||
tokenType: "oauth"; | ||
}; | ||
}>; | ||
} |
@@ -6,5 +6,20 @@ import * as OAuthMethods from "@octokit/oauth-methods"; | ||
}; | ||
export declare function resetTokenWithState(state: State, options: ResetTokenOptions): Promise<OAuthMethods.ResetTokenOAuthAppResponse | OAuthMethods.ResetTokenGitHubAppResponse>; | ||
export declare function resetTokenWithState(state: State, options: ResetTokenOptions): Promise<(OAuthMethods.ResetTokenOAuthAppResponse | OAuthMethods.ResetTokenGitHubAppResponse) & { | ||
authentication: { | ||
type: "token"; | ||
tokenType: "oauth"; | ||
}; | ||
}>; | ||
export interface ResetTokenInterface<TClientType extends ClientType> { | ||
(options: ResetTokenOptions): TClientType extends "oauth-app" ? Promise<OAuthMethods.ResetTokenOAuthAppResponse> : Promise<OAuthMethods.ResetTokenGitHubAppResponse>; | ||
(options: ResetTokenOptions): TClientType extends "oauth-app" ? Promise<OAuthMethods.ResetTokenOAuthAppResponse & { | ||
authentication: { | ||
type: "token"; | ||
tokenType: "oauth"; | ||
}; | ||
}> : Promise<OAuthMethods.ResetTokenGitHubAppResponse & { | ||
authentication: { | ||
type: "token"; | ||
tokenType: "oauth"; | ||
}; | ||
}>; | ||
} |
@@ -5,6 +5,16 @@ import * as OAuthMethods from "@octokit/oauth-methods"; | ||
export declare type ScopeTokenOptions = Omit<OAuthMethods.ScopeTokenOptions, StateOptions>; | ||
export declare function scopeTokenWithState(state: State, options: ScopeTokenOptions): Promise<OAuthMethods.ScopeTokenResponse>; | ||
export declare function scopeTokenWithState(state: State, options: ScopeTokenOptions): Promise<OAuthMethods.ScopeTokenResponse & { | ||
authentication: { | ||
type: "token"; | ||
tokenType: "oauth"; | ||
}; | ||
}>; | ||
export interface ScopeTokenInterface { | ||
(options: ScopeTokenOptions): Promise<OAuthMethods.ScopeTokenResponse>; | ||
(options: ScopeTokenOptions): Promise<OAuthMethods.ScopeTokenResponse & { | ||
authentication: { | ||
type: "token"; | ||
tokenType: "oauth"; | ||
}; | ||
}>; | ||
} | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "3.5.0"; | ||
export declare const VERSION = "3.5.1"; |
{ | ||
"name": "@octokit/oauth-app", | ||
"description": "GitHub OAuth toolset for Node.js", | ||
"version": "3.5.0", | ||
"version": "3.5.1", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "files": [ |
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
150352
1743