diff --git a/lib/build/recipe/accountlinking/types.d.ts b/lib/build/recipe/accountlinking/types.d.ts index 3530940ee..ba31192a2 100644 --- a/lib/build/recipe/accountlinking/types.d.ts +++ b/lib/build/recipe/accountlinking/types.d.ts @@ -1,6 +1,7 @@ // @ts-nocheck +import type { BaseRequest, BaseResponse } from "../../framework"; import OverrideableBuilder from "supertokens-js-override"; -import type { User, UserContext } from "../../types"; +import type { GeneralErrorResponse, NormalisedAppinfo, User, UserContext } from "../../types"; import RecipeUserId from "../../recipeUserId"; import { SessionContainerInterface } from "../session/types"; export declare type TypeInput = { @@ -175,6 +176,76 @@ export declare type RecipeInterface = { status: "OK"; }>; }; +export declare type APIOptions = { + recipeImplementation: RecipeInterface; + appInfo: NormalisedAppinfo; + config: TypeNormalisedInput; + recipeId: string; + isInServerlessEnv: boolean; + req: BaseRequest; + res: BaseResponse; +}; +export declare type APIInterface = { + userDetailsGET: + | undefined + | ((input: { + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + user: User; + } + | GeneralErrorResponse + >); + userEnabledDetailsGET: + | undefined + | ((input: { + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + enabledRecipes: string[]; + shouldDoAutomaticAccountLinking: boolean; + } + | GeneralErrorResponse + >); + loginMethodDELETE: + | undefined + | ((input: { + recipeId: string; + recipeUserId: string; + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + } + | GeneralErrorResponse + >); + updateUserDetailsPOST: + | undefined + | ((input: { + firstName: string; + lastName: string; + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + } + | { + status: "USER_DETAILS_UPDATE_NOT_ALLOWED"; + reason: string; + } + | GeneralErrorResponse + >); +}; export declare type AccountInfo = { email?: string; phoneNumber?: string; diff --git a/lib/build/recipe/emailpassword/api/implementation.js b/lib/build/recipe/emailpassword/api/implementation.js index 6619c14cf..6eea377fe 100644 --- a/lib/build/recipe/emailpassword/api/implementation.js +++ b/lib/build/recipe/emailpassword/api/implementation.js @@ -775,6 +775,8 @@ function getAPIImplementation() { user: postAuthChecks.user, }; }, + updatePasswordPOST: undefined, + changeEmailPOST: undefined, }; } exports.default = getAPIImplementation; diff --git a/lib/build/recipe/emailpassword/types.d.ts b/lib/build/recipe/emailpassword/types.d.ts index fa3eb1408..9757645b2 100644 --- a/lib/build/recipe/emailpassword/types.d.ts +++ b/lib/build/recipe/emailpassword/types.d.ts @@ -322,6 +322,49 @@ export declare type APIInterface = { } | GeneralErrorResponse >); + updatePasswordPOST: + | undefined + | ((input: { + newPassword: string; + oldPassword: string; + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + } + | { + status: "WRONG_CREDENTIALS_ERROR"; + } + | { + status: "PASSWORD_POLICY_VIOLATED_ERROR"; + failureReason: string; + } + | GeneralErrorResponse + >); + changeEmailPOST: + | undefined + | ((input: { + email: string; + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + } + | { + status: "EMAIL_VERIFICATION_SENT"; + } + | { + status: "EMAIL_ALREADY_EXISTS_ERROR"; + } + | { + status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; + } + | GeneralErrorResponse + >); }; export declare type TypeEmailPasswordPasswordResetEmailDeliveryInput = { type: "PASSWORD_RESET"; diff --git a/lib/build/recipe/multifactorauth/api/implementation.js b/lib/build/recipe/multifactorauth/api/implementation.js index 954ae11bd..9dea130f2 100644 --- a/lib/build/recipe/multifactorauth/api/implementation.js +++ b/lib/build/recipe/multifactorauth/api/implementation.js @@ -120,6 +120,9 @@ function getAPIInterface() { phoneNumbers: getPhoneNumbersForFactorsResult.factorIdToPhoneNumberMap, }; }, + factorsForUserGET: undefined, + addFactorForUserPOST: undefined, + deleteFactorForUserDELETE: undefined, }; } exports.default = getAPIInterface; diff --git a/lib/build/recipe/multifactorauth/types.d.ts b/lib/build/recipe/multifactorauth/types.d.ts index 53f7ac093..ca2452da3 100644 --- a/lib/build/recipe/multifactorauth/types.d.ts +++ b/lib/build/recipe/multifactorauth/types.d.ts @@ -106,6 +106,45 @@ export declare type APIInterface = { } | GeneralErrorResponse >); + factorsForUserGET: + | undefined + | ((input: { + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + factors: string[]; + } + | GeneralErrorResponse + >); + addFactorForUserPOST: + | undefined + | ((input: { + factorId: string; + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + } + | GeneralErrorResponse + >); + deleteFactorForUserDELETE: + | undefined + | ((input: { + factorId: string; + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + } + | GeneralErrorResponse + >); }; export declare type GetFactorsSetupForUserFromOtherRecipesFunc = ( user: User, diff --git a/lib/build/recipe/session/api/implementation.js b/lib/build/recipe/session/api/implementation.js index d079f77e9..b03e57366 100644 --- a/lib/build/recipe/session/api/implementation.js +++ b/lib/build/recipe/session/api/implementation.js @@ -51,6 +51,8 @@ function getAPIInterface() { status: "OK", }; }, + allSessionsGET: undefined, + revokeSessionPOST: undefined, }; } exports.default = getAPIInterface; diff --git a/lib/build/recipe/session/types.d.ts b/lib/build/recipe/session/types.d.ts index b573925ed..ffd51104d 100644 --- a/lib/build/recipe/session/types.d.ts +++ b/lib/build/recipe/session/types.d.ts @@ -323,6 +323,32 @@ export declare type APIInterface = { } | GeneralErrorResponse >); + allSessionsGET: + | undefined + | ((input: { + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + sessions: SessionInformation[]; + } + | GeneralErrorResponse + >); + revokeSessionPOST: + | undefined + | ((input: { + sessionHandle: string; + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + } + | GeneralErrorResponse + >); verifySession(input: { verifySessionOptions: VerifySessionOptions | undefined; options: APIOptions; diff --git a/lib/ts/recipe/accountlinking/types.ts b/lib/ts/recipe/accountlinking/types.ts index 83aec5230..298587c5c 100644 --- a/lib/ts/recipe/accountlinking/types.ts +++ b/lib/ts/recipe/accountlinking/types.ts @@ -13,8 +13,9 @@ * under the License. */ +import type { BaseRequest, BaseResponse } from "../../framework"; import OverrideableBuilder from "supertokens-js-override"; -import type { User, UserContext } from "../../types"; +import type { GeneralErrorResponse, NormalisedAppinfo, User, UserContext } from "../../types"; import RecipeUserId from "../../recipeUserId"; import { SessionContainerInterface } from "../session/types"; @@ -185,6 +186,78 @@ export type RecipeInterface = { }) => Promise<{ status: "OK" }>; }; +export type APIOptions = { + recipeImplementation: RecipeInterface; + appInfo: NormalisedAppinfo; + config: TypeNormalisedInput; + recipeId: string; + isInServerlessEnv: boolean; + req: BaseRequest; + res: BaseResponse; +}; + +export type APIInterface = { + userDetailsGET: + | undefined + | ((input: { + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + user: User; + } + | GeneralErrorResponse + >); + + userEnabledDetailsGET: + | undefined + | ((input: { + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + enabledRecipes: string[]; + shouldDoAutomaticAccountLinking: boolean; + } + | GeneralErrorResponse + >); + + loginMethodDELETE: + | undefined + | ((input: { + recipeId: string; + recipeUserId: string; + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + } + | GeneralErrorResponse + >); + + updateUserDetailsPOST: + | undefined + | ((input: { + firstName: string; + lastName: string; + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + } + | { status: "USER_DETAILS_UPDATE_NOT_ALLOWED"; reason: string } + | GeneralErrorResponse + >); +}; + export type AccountInfo = { email?: string; phoneNumber?: string; diff --git a/lib/ts/recipe/emailpassword/api/implementation.ts b/lib/ts/recipe/emailpassword/api/implementation.ts index 635ff2bd6..1eb46e992 100644 --- a/lib/ts/recipe/emailpassword/api/implementation.ts +++ b/lib/ts/recipe/emailpassword/api/implementation.ts @@ -926,5 +926,8 @@ export default function getAPIImplementation(): APIInterface { user: postAuthChecks.user, }; }, + + updatePasswordPOST: undefined, + changeEmailPOST: undefined, }; } diff --git a/lib/ts/recipe/emailpassword/types.ts b/lib/ts/recipe/emailpassword/types.ts index 0fdfbe088..fc780ea15 100644 --- a/lib/ts/recipe/emailpassword/types.ts +++ b/lib/ts/recipe/emailpassword/types.ts @@ -325,6 +325,40 @@ export type APIInterface = { } | GeneralErrorResponse >); + + updatePasswordPOST: + | undefined + | ((input: { + newPassword: string; + oldPassword: string; + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + } + | { status: "WRONG_CREDENTIALS_ERROR" } + | { status: "PASSWORD_POLICY_VIOLATED_ERROR"; failureReason: string } + | GeneralErrorResponse + >); + + changeEmailPOST: + | undefined + | ((input: { + email: string; + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + } + | { status: "EMAIL_VERIFICATION_SENT" } + | { status: "EMAIL_ALREADY_EXISTS_ERROR" } + | { status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR" } + | GeneralErrorResponse + >); }; export type TypeEmailPasswordPasswordResetEmailDeliveryInput = { diff --git a/lib/ts/recipe/multifactorauth/api/implementation.ts b/lib/ts/recipe/multifactorauth/api/implementation.ts index c0c8ced7e..d5f22266e 100644 --- a/lib/ts/recipe/multifactorauth/api/implementation.ts +++ b/lib/ts/recipe/multifactorauth/api/implementation.ts @@ -125,5 +125,8 @@ export default function getAPIInterface(): APIInterface { phoneNumbers: getPhoneNumbersForFactorsResult.factorIdToPhoneNumberMap, }; }, + factorsForUserGET: undefined, + addFactorForUserPOST: undefined, + deleteFactorForUserDELETE: undefined, }; } diff --git a/lib/ts/recipe/multifactorauth/types.ts b/lib/ts/recipe/multifactorauth/types.ts index a7e340662..d47cd7b10 100644 --- a/lib/ts/recipe/multifactorauth/types.ts +++ b/lib/ts/recipe/multifactorauth/types.ts @@ -135,6 +135,48 @@ export type APIInterface = { } | GeneralErrorResponse >); + + factorsForUserGET: + | undefined + | ((input: { + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + factors: string[]; + } + | GeneralErrorResponse + >); + + addFactorForUserPOST: + | undefined + | ((input: { + factorId: string; + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + } + | GeneralErrorResponse + >); + + deleteFactorForUserDELETE: + | undefined + | ((input: { + factorId: string; + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + } + | GeneralErrorResponse + >); }; export type GetFactorsSetupForUserFromOtherRecipesFunc = (user: User, userContext: UserContext) => Promise; diff --git a/lib/ts/recipe/session/api/implementation.ts b/lib/ts/recipe/session/api/implementation.ts index e6b799e9d..084e722a7 100644 --- a/lib/ts/recipe/session/api/implementation.ts +++ b/lib/ts/recipe/session/api/implementation.ts @@ -80,5 +80,8 @@ export default function getAPIInterface(): APIInterface { status: "OK", }; }, + + allSessionsGET: undefined, + revokeSessionPOST: undefined, }; } diff --git a/lib/ts/recipe/session/types.ts b/lib/ts/recipe/session/types.ts index accd318bc..253aee8cb 100644 --- a/lib/ts/recipe/session/types.ts +++ b/lib/ts/recipe/session/types.ts @@ -394,6 +394,34 @@ export type APIInterface = { | GeneralErrorResponse >); + allSessionsGET: + | undefined + | ((input: { + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + sessions: SessionInformation[]; + } + | GeneralErrorResponse + >); + + revokeSessionPOST: + | undefined + | ((input: { + sessionHandle: string; + session: SessionContainerInterface; + options: APIOptions; + userContext: UserContext; + }) => Promise< + | { + status: "OK"; + } + | GeneralErrorResponse + >); + verifySession(input: { verifySessionOptions: VerifySessionOptions | undefined; options: APIOptions;