Skip to content

Commit

Permalink
chore(deps): update dependency prettier to v3 (#435)
Browse files Browse the repository at this point in the history
* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* style: prettier

* docs: update ToC for README.md

* Last word on trailing commas

---------

Co-authored-by: prettier-toc-me[bot] <56236715+prettier-toc-me[bot]@users.noreply.github.com>
Co-authored-by: Create or Update Pull Request Action <[email protected]>
Co-authored-by: Keegan Campbell <[email protected]>
  • Loading branch information
4 people authored Jul 6, 2023
1 parent 7a781c5 commit 094e648
Show file tree
Hide file tree
Showing 26 changed files with 202 additions and 203 deletions.
55 changes: 27 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,32 @@

<!-- toc -->

- [oauth-app.js](#oauth-appjs)
- [Usage](#usage)
- [For OAuth Apps](#for-oauth-apps)
- [For GitHub Apps](#for-github-apps)
- [Examples](#examples)
- [`OAuthApp.defaults(options)`](#oauthappdefaultsoptions)
- [Constructor options](#constructor-options)
- [`app.on(eventName, eventHandler)`](#apponeventname-eventhandler)
- [`app.octokit`](#appoctokit)
- [`app.getUserOctokit(options)`](#appgetuseroctokitoptions)
- [`app.getWebFlowAuthorizationUrl(options)`](#appgetwebflowauthorizationurloptions)
- [`app.createToken(options)`](#appcreatetokenoptions)
- [For OAuth Web flow](#for-oauth-web-flow)
- [For OAuth Device flow](#for-oauth-device-flow)
- [`app.checkToken(options)`](#appchecktokenoptions)
- [`app.resetToken(options)`](#appresettokenoptions)
- [`app.refreshToken(options)`](#apprefreshtokenoptions)
- [`app.scopeToken(options)`](#appscopetokenoptions)
- [`app.deleteToken(options)`](#appdeletetokenoptions)
- [`app.deleteAuthorization(options)`](#appdeleteauthorizationoptions)
- [Middlewares](#middlewares)
- [`createNodeMiddleware(app, options)`](#createnodemiddlewareapp-options)
- [`createWebWorkerHandler(app, options)`](#createwebworkerhandlerapp-options)
- [`createAWSLambdaAPIGatewayV2Handler(app, options)`](#createawslambdaapigatewayv2handlerapp-options)
- [Build Custom Middlewares](#build-custom-middlewares)
- [Contributing](#contributing)
- [License](#license)
- [Usage](#usage)
- [For OAuth Apps](#for-oauth-apps)
- [For GitHub Apps](#for-github-apps)
- [Examples](#examples)
- [`OAuthApp.defaults(options)`](#oauthappdefaultsoptions)
- [Constructor options](#constructor-options)
- [`app.on(eventName, eventHandler)`](#apponeventname-eventhandler)
- [`app.octokit`](#appoctokit)
- [`app.getUserOctokit(options)`](#appgetuseroctokitoptions)
- [`app.getWebFlowAuthorizationUrl(options)`](#appgetwebflowauthorizationurloptions)
- [`app.createToken(options)`](#appcreatetokenoptions)
- [For OAuth Web flow](#for-oauth-web-flow)
- [For OAuth Device flow](#for-oauth-device-flow)
- [`app.checkToken(options)`](#appchecktokenoptions)
- [`app.resetToken(options)`](#appresettokenoptions)
- [`app.refreshToken(options)`](#apprefreshtokenoptions)
- [`app.scopeToken(options)`](#appscopetokenoptions)
- [`app.deleteToken(options)`](#appdeletetokenoptions)
- [`app.deleteAuthorization(options)`](#appdeleteauthorizationoptions)
- [Middlewares](#middlewares)
- [`createNodeMiddleware(app, options)`](#createnodemiddlewareapp-options)
- [`createWebWorkerHandler(app, options)`](#createwebworkerhandlerapp-options)
- [`createAWSLambdaAPIGatewayV2Handler(app, options)`](#createawslambdaapigatewayv2handlerapp-options)
- [Build Custom Middlewares](#build-custom-middlewares)
- [Contributing](#contributing)
- [License](#license)

<!-- tocstop -->

Expand Down Expand Up @@ -579,7 +578,7 @@ try {
`token valid, created on %s by %s for %s`,
created_at,
user.login,
app.name
app.name,
);
} catch (error) {
// token invalid or request error
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"glob": "^10.2.5",
"jest": "^29.0.0",
"nock": "^13.0.0",
"prettier": "2.8.8",
"prettier": "3.0.0",
"semantic-release-plugin-update-version-in-files": "^1.0.0",
"ts-jest": "^29.0.0",
"typescript": "^5.0.0"
Expand Down
2 changes: 1 addition & 1 deletion src/add-event-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
export function addEventHandler(
state: State,
eventName: EventAndActionName | EventAndActionName[],
eventHandler: EventHandler<Options<ClientType>>
eventHandler: EventHandler<Options<ClientType>>,
) {
if (Array.isArray(eventName)) {
for (const singleEventName of eventName) {
Expand Down
2 changes: 1 addition & 1 deletion src/emit-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { State, EventHandlerContext, ClientType, Options } from "./types";

export async function emitEvent(
state: State,
context: EventHandlerContext<Options<ClientType>>
context: EventHandlerContext<Options<ClientType>>,
) {
const { name, action } = context;

Expand Down
16 changes: 8 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ export { createAWSLambdaAPIGatewayV2Handler } from "./middleware/aws-lambda/api-
type Constructor<T> = new (...args: any[]) => T;

export class OAuthApp<
TOptions extends Options<ClientType> = Options<"oauth-app">
TOptions extends Options<ClientType> = Options<"oauth-app">,
> {
static VERSION = VERSION;

static defaults<
TDefaults extends Options<ClientType>,
S extends Constructor<OAuthApp<TDefaults>>
S extends Constructor<OAuthApp<TDefaults>>,
>(this: S, defaults: TDefaults) {
const OAuthAppWithDefaults = class extends this {
constructor(...args: any[]) {
Expand Down Expand Up @@ -127,28 +127,28 @@ export class OAuthApp<

this.getWebFlowAuthorizationUrl = getWebFlowAuthorizationUrlWithState.bind(
null,
state
state,
) as GetWebFlowAuthorizationUrlInterface<ClientTypeFromOptions<TOptions>>;

this.createToken = createTokenWithState.bind(
null,
state
state,
) as CreateTokenInterface<ClientTypeFromOptions<TOptions>>;
this.checkToken = checkTokenWithState.bind(
null,
state
state,
) as CheckTokenInterface<ClientTypeFromOptions<TOptions>>;
this.resetToken = resetTokenWithState.bind(
null,
state
state,
) as ResetTokenInterface<ClientTypeFromOptions<TOptions>>;
this.refreshToken = refreshTokenWithState.bind(
null,
state
state,
) as RefreshTokenInterface;
this.scopeToken = scopeTokenWithState.bind(
null,
state
state,
) as ScopeTokenInterface;
this.deleteToken = deleteTokenWithState.bind(null, state);
this.deleteAuthorization = deleteAuthorizationWithState.bind(null, state);
Expand Down
2 changes: 1 addition & 1 deletion src/methods/check-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type CheckTokenOptions = {

export async function checkTokenWithState(
state: State,
options: CheckTokenOptions
options: CheckTokenOptions,
): Promise<any> {
const result = await OAuthMethods.checkToken({
// @ts-expect-error not worth the extra code to appease TS
Expand Down
4 changes: 2 additions & 2 deletions src/methods/create-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function createTokenWithState(
options:
| CreateTokenWebFlowOptions
| CreateTokenOAuthAppDeviceFlowOptions
| CreateTokenGitHubAppDeviceFlowOptions
| CreateTokenGitHubAppDeviceFlowOptions,
): Promise<{
authentication:
| OAuthAppAuth.OAuthAppUserAuthentication
Expand Down Expand Up @@ -72,7 +72,7 @@ export interface CreateTokenInterface<TClientType extends ClientType> {
(
options: TClientType extends "oauth-app"
? CreateTokenOAuthAppDeviceFlowOptions
: CreateTokenGitHubAppDeviceFlowOptions
: CreateTokenGitHubAppDeviceFlowOptions,
): TClientType extends "oauth-app"
? Promise<{ authentication: OAuthAppAuth.OAuthAppUserAuthentication }>
: Promise<
Expand Down
4 changes: 2 additions & 2 deletions src/methods/delete-authorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type DeleteAuthorizationOptions = {

export async function deleteAuthorizationWithState(
state: State,
options: DeleteAuthorizationOptions
options: DeleteAuthorizationOptions,
): Promise<OAuthMethods.DeleteAuthorizationResponse> {
const optionsWithDefaults = {
clientId: state.clientId,
Expand Down Expand Up @@ -60,6 +60,6 @@ export async function deleteAuthorizationWithState(

export interface DeleteAuthorizationInterface {
(
options: DeleteAuthorizationOptions
options: DeleteAuthorizationOptions,
): Promise<OAuthMethods.DeleteAuthorizationResponse>;
}
2 changes: 1 addition & 1 deletion src/methods/delete-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type DeleteTokenOptions = {

export async function deleteTokenWithState(
state: State,
options: DeleteTokenOptions
options: DeleteTokenOptions,
): Promise<OAuthMethods.DeleteTokenResponse> {
const optionsWithDefaults = {
clientId: state.clientId,
Expand Down
6 changes: 3 additions & 3 deletions src/methods/get-user-octokit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export type GetUserOctokitGitHubAppOptions =

export async function getUserOctokitWithState(
state: State,
options: GetUserOctokitOAuthAppOptions | GetUserOctokitGitHubAppOptions
options: GetUserOctokitOAuthAppOptions | GetUserOctokitGitHubAppOptions,
) {
return state.octokit.auth({
type: "oauth-user",
Expand Down Expand Up @@ -61,11 +61,11 @@ export async function getUserOctokitWithState(
}

export interface GetUserOctokitWithStateInterface<
TClientType extends ClientType
TClientType extends ClientType,
> {
(
options: TClientType extends "oauth-app"
? GetUserOctokitOAuthAppOptions
: GetUserOctokitGitHubAppOptions
: GetUserOctokitGitHubAppOptions,
): Promise<OctokitInstance>;
}
6 changes: 3 additions & 3 deletions src/methods/get-web-flow-authorization-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type GetWebFlowAuthorizationUrlGitHubAppOptions = Omit<

export function getWebFlowAuthorizationUrlWithState(
state: State,
options: any
options: any,
): any {
const optionsWithDefaults = {
clientId: state.clientId,
Expand All @@ -33,12 +33,12 @@ export function getWebFlowAuthorizationUrlWithState(
}

export interface GetWebFlowAuthorizationUrlInterface<
TClientType extends ClientType
TClientType extends ClientType,
> {
(
options: TClientType extends "oauth-app"
? GetWebFlowAuthorizationUrlOAuthAppOptions
: GetWebFlowAuthorizationUrlGitHubAppOptions
: GetWebFlowAuthorizationUrlGitHubAppOptions,
): TClientType extends "oauth-app"
? OAuthMethods.GetWebFlowAuthorizationUrlOAuthAppResult
: OAuthMethods.GetWebFlowAuthorizationUrlGitHubAppResult;
Expand Down
4 changes: 2 additions & 2 deletions src/methods/refresh-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type RefreshTokenOptions = {

export async function refreshTokenWithState(
state: State,
options: RefreshTokenOptions
options: RefreshTokenOptions,
): Promise<
OAuthMethods.RefreshTokenResponse & {
authentication: {
Expand All @@ -21,7 +21,7 @@ export async function refreshTokenWithState(
> {
if (state.clientType === "oauth-app") {
throw new Error(
"[@octokit/oauth-app] app.refreshToken() is not supported for OAuth Apps"
"[@octokit/oauth-app] app.refreshToken() is not supported for OAuth Apps",
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/methods/reset-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type ResetTokenOptions = {

export async function resetTokenWithState(
state: State,
options: ResetTokenOptions
options: ResetTokenOptions,
): Promise<
(
| OAuthMethods.ResetTokenOAuthAppResponse
Expand Down
4 changes: 2 additions & 2 deletions src/methods/scope-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type ScopeTokenOptions = Omit<

export async function scopeTokenWithState(
state: State,
options: ScopeTokenOptions
options: ScopeTokenOptions,
): Promise<
OAuthMethods.ScopeTokenResponse & {
authentication: {
Expand All @@ -24,7 +24,7 @@ export async function scopeTokenWithState(
> {
if (state.clientType === "oauth-app") {
throw new Error(
"[@octokit/oauth-app] app.scopeToken() is not supported for OAuth Apps"
"[@octokit/oauth-app] app.scopeToken() is not supported for OAuth Apps",
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/middleware/aws-lambda/api-gateway-v2-send-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { OctokitResponse } from "../types";
import type { APIGatewayProxyStructuredResultV2 } from "aws-lambda";

export function sendResponse(
octokitResponse: OctokitResponse
octokitResponse: OctokitResponse,
): APIGatewayProxyStructuredResultV2 {
return {
statusCode: octokitResponse.status,
Expand Down
4 changes: 2 additions & 2 deletions src/middleware/aws-lambda/api-gateway-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import type {

export function createAWSLambdaAPIGatewayV2Handler(
app: OAuthApp<Options<ClientType>>,
options: HandlerOptions = {}
options: HandlerOptions = {},
) {
return async function (
event: APIGatewayProxyEventV2
event: APIGatewayProxyEventV2,
): Promise<APIGatewayProxyStructuredResultV2 | undefined> {
const request = parseRequest(event);
const response = await handleRequest(app, options, request);
Expand Down
Loading

0 comments on commit 094e648

Please sign in to comment.