kitcn
Version:
kitcn - React Query integration and CLI tools for Convex
29 lines • 1.11 kB
TypeScript
//#region src/auth-start/index.d.ts
type MaybePromise<T> = Promise<T> | T;
type StartLoaderAuthClient = {
clearAuth: () => void;
setAuth: (fetchToken: () => Promise<string | null>) => void;
};
type StartLoaderServerHttpClient = {
clearAuth?: () => void;
setAuth: (token: string) => void;
};
type StartLoaderConvexQueryClient = {
convexClient: StartLoaderAuthClient;
serverHttpClient?: StartLoaderServerHttpClient;
};
type StartLoaderAuthTarget = StartLoaderAuthClient | StartLoaderConvexQueryClient;
type SyncConvexAuthForStartLoaderOptions = {
convex: StartLoaderAuthTarget;
getToken: () => MaybePromise<null | string | undefined>;
};
type StartLoaderAuthState = {
isAuthenticated: boolean;
token: null | string;
};
declare const syncConvexAuthForStartLoader: ({
convex,
getToken
}: SyncConvexAuthForStartLoaderOptions) => Promise<StartLoaderAuthState>;
//#endregion
export { MaybePromise, StartLoaderAuthClient, StartLoaderAuthState, StartLoaderAuthTarget, StartLoaderConvexQueryClient, StartLoaderServerHttpClient, SyncConvexAuthForStartLoaderOptions, syncConvexAuthForStartLoader };