supertokens-node
Version:
NodeJS driver for SuperTokens core
51 lines (50 loc) • 1.93 kB
TypeScript
import RecipeModule from "../../recipeModule";
import { NormalisedAppinfo, APIHandled, RecipeListFunction, HTTPMethod } from "../../types";
import { TypeInput, TypeNormalisedInput, TypeProvider, RecipeInterface, User, APIInterface } from "./types";
import EmailVerificationRecipe from "../emailverification/recipe";
import * as express from "express";
import STError from "./error";
import NormalisedURLPath from "../../normalisedURLPath";
export default class Recipe extends RecipeModule {
private static instance;
static RECIPE_ID: string;
config: TypeNormalisedInput;
emailVerificationRecipe: EmailVerificationRecipe;
providers: TypeProvider[];
recipeInterfaceImpl: RecipeInterface;
apiImpl: APIInterface;
isInServerlessEnv: boolean;
constructor(
recipeId: string,
appInfo: NormalisedAppinfo,
isInServerlessEnv: boolean,
config: TypeInput,
recipes: {
emailVerificationInstance: EmailVerificationRecipe | undefined;
}
);
static init(config: TypeInput): RecipeListFunction;
static getInstanceOrThrowError(): Recipe;
static reset(): void;
getAPIsHandled: () => APIHandled[];
handleAPIRequest: (
id: string,
req: express.Request,
res: express.Response,
next: express.NextFunction,
path: NormalisedURLPath,
method: HTTPMethod
) => Promise<void>;
handleError: (
err: STError,
request: express.Request,
response: express.Response,
next: express.NextFunction
) => void;
getAllCORSHeaders: () => string[];
isErrorFromThisRecipe: (err: any) => err is STError;
getEmailForUserId: (userId: string) => Promise<string>;
createEmailVerificationToken: (userId: string) => Promise<string>;
verifyEmailUsingToken: (token: string) => Promise<User>;
isEmailVerified: (userId: string) => Promise<boolean>;
}