From f5cb927113f281016ac8f03c4fea964b67ed8981 Mon Sep 17 00:00:00 2001 From: Cameron Matheson Date: Mon, 16 Sep 2024 10:33:35 -0600 Subject: [PATCH] run prettier on everything --- .github/workflows/release.yml | 2 +- README.md | 28 ++++++++++++++-------------- src/context.ts | 12 +++++++----- src/index.ts | 6 +++--- src/provider.tsx | 4 ++-- src/state.ts | 2 +- src/types.ts | 6 ++++-- 7 files changed, 32 insertions(+), 28 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 956fe39..44e8c29 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 18 - registry-url: 'https://registry.npmjs.org' + registry-url: "https://registry.npmjs.org" - name: Install Dependencies run: | diff --git a/README.md b/README.md index 6176217..ab4ca00 100644 --- a/README.md +++ b/README.md @@ -91,11 +91,11 @@ function App() { Your app should be wrapped in the `AuthKitProvider` component. This component takes the following props: -* `clientId` (required): Your `WORKOS_CLIENT_ID` -* `apiHostname`: Defaults to `api.workos.com`. This should be set to your custom Authentication API domain in production. -* `redirectUri`: The url that WorkOS will redirect to upon successful authentication. (Used when constructing sign-in/sign-up URLs). -* `devMode`: Defaults to `true` if window.location is "localhost" or "127.0.0.1". Tokens will be stored in localStorage when this prop is true. -* `onRedirectCallback`: Called after exchanging the +- `clientId` (required): Your `WORKOS_CLIENT_ID` +- `apiHostname`: Defaults to `api.workos.com`. This should be set to your custom Authentication API domain in production. +- `redirectUri`: The url that WorkOS will redirect to upon successful authentication. (Used when constructing sign-in/sign-up URLs). +- `devMode`: Defaults to `true` if window.location is "localhost" or "127.0.0.1". Tokens will be stored in localStorage when this prop is true. +- `onRedirectCallback`: Called after exchanging the `authorization_code`. Can be used for things like redirecting to a "return to" path in the OAuth state. @@ -103,18 +103,18 @@ takes the following props: The `useAuth` hook returns user information and helper functions: -* `isLoading`: true while user information is being obtained from fetch during initial load. -* `user`: The WorkOS `User` object for this session. -* `getAccessToken`: Returns an access token. Will fetch a fresh access token if necessary. -* `signIn`: Redirects the user to the Hosted AuthKit sign-in page. Takes an optional `state` argument. -* `signUp`: Redirects the user to the Hosted AuthKit sign-up page. Takes an optional `state` argument. -* `signOut`: Ends the session. +- `isLoading`: true while user information is being obtained from fetch during initial load. +- `user`: The WorkOS `User` object for this session. +- `getAccessToken`: Returns an access token. Will fetch a fresh access token if necessary. +- `signIn`: Redirects the user to the Hosted AuthKit sign-in page. Takes an optional `state` argument. +- `signUp`: Redirects the user to the Hosted AuthKit sign-up page. Takes an optional `state` argument. +- `signOut`: Ends the session. The following claims may be populated if the user is part of an organization: -* `organizationId`: The currently-selected organization. -* `role`: The `role` of the user for the current organization. -* `permissions`: Permissions corresponding to this role. +- `organizationId`: The currently-selected organization. +- `role`: The `role` of the user for the current organization. +- `permissions`: Permissions corresponding to this role. ## Impersonation diff --git a/src/context.ts b/src/context.ts index e9d221f..d4e3a35 100644 --- a/src/context.ts +++ b/src/context.ts @@ -1,9 +1,11 @@ -'use client'; +"use client"; -import * as React from 'react'; -import { Client } from './types'; -import { State, initialState } from './state'; +import * as React from "react"; +import { Client } from "./types"; +import { State, initialState } from "./state"; export interface ContextValue extends Client, State {} -export const Context = React.createContext(initialState as ContextValue); +export const Context = React.createContext( + initialState as ContextValue, +); diff --git a/src/index.ts b/src/index.ts index 20adfe8..44e7120 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,3 @@ -export { useAuth } from './hook'; -export { AuthKitProvider } from './provider'; -export { getClaims } from '@workos-inc/authkit-js'; +export { useAuth } from "./hook"; +export { AuthKitProvider } from "./provider"; +export { getClaims } from "@workos-inc/authkit-js"; diff --git a/src/provider.tsx b/src/provider.tsx index 819863c..3e60601 100644 --- a/src/provider.tsx +++ b/src/provider.tsx @@ -44,7 +44,7 @@ export function AuthKitProvider(props: AuthKitProviderProps) { return isEquivalentWorkOSSession(prev, next) ? prev : next; }); }, - [client] + [client], ); React.useEffect(() => { @@ -86,7 +86,7 @@ export function AuthKitProvider(props: AuthKitProviderProps) { // poor-man's "deep equality" check function isEquivalentWorkOSSession( a: typeof initialState, - b: typeof initialState + b: typeof initialState, ) { return ( a.user?.updatedAt === b.user?.updatedAt && diff --git a/src/state.ts b/src/state.ts index 1d7482e..7618281 100644 --- a/src/state.ts +++ b/src/state.ts @@ -1,4 +1,4 @@ -import { User } from '@workos-inc/authkit-js'; +import { User } from "@workos-inc/authkit-js"; export interface State { isLoading: boolean; diff --git a/src/types.ts b/src/types.ts index 9c5f5f1..f23a607 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,4 +1,6 @@ -import { createClient } from '@workos-inc/authkit-js'; +import { createClient } from "@workos-inc/authkit-js"; export type Client = Awaited>; -export type CreateClientOptions = NonNullable[1]>; +export type CreateClientOptions = NonNullable< + Parameters[1] +>;