Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recipe interface changes regarding account-linking #439

Merged
merged 15 commits into from
Nov 25, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/build/recipe/accountlinking/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export declare type RecipeInterface = {
}
| {
status:
| "PRIMARY_USER_ALREADY_EXISTS_FOR_RECIPE_USER_ID_ERROR"
| "PRIMARY_USER_ALREADY_EXISTS_FOR_ACCOUNT_INFO_ERROR";
| "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"
| "ACCOUNT_INFO_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
primaryUserId: string;
}
>;
Expand All @@ -78,8 +78,8 @@ export declare type RecipeInterface = {
}
| {
status:
| "PRIMARY_USER_ALREADY_EXISTS_FOR_RECIPE_USER_ID_ERROR"
| "PRIMARY_USER_ALREADY_EXISTS_FOR_ACCOUNT_INFO_ERROR";
| "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"
| "ACCOUNT_INFO_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
primaryUserId: string;
}
>;
Expand Down
5 changes: 3 additions & 2 deletions lib/build/recipe/emailpassword/api/implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ const logger_1 = require("../../../logger");
const session_1 = require("../../session");
function getAPIImplementation() {
return {
linkNewAccountToExistingAccountPOST: function (_input) {
linkAccountToExistingAccountPOST: function (_input) {
return __awaiter(this, void 0, void 0, function* () {
return {
status: "ACCOUNT_NOT_VERIFIED_ERROR",
isNotVerifiedAccountFromInputSession: false,
};
});
},
Expand Down Expand Up @@ -147,7 +148,7 @@ function getAPIImplementation() {
session,
user,
createdNewUser: true,
createdNewRecipeUser: true, // TODO
createdNewRecipeUser: true,
};
});
},
Expand Down
13 changes: 5 additions & 8 deletions lib/build/recipe/emailpassword/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ export declare type APIInterface = {
status: "OK";
user: User;
createdNewUser: boolean;
createdNewRecipeUser: boolean;
session: SessionContainerInterface;
}
| {
Expand All @@ -250,7 +249,7 @@ export declare type APIInterface = {
}
| GeneralErrorResponse
>);
linkNewAccountToExistingAccountPOST:
linkAccountToExistingAccountPOST:
| undefined
| ((input: {
formFields: {
Expand All @@ -270,22 +269,20 @@ export declare type APIInterface = {
| {
status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
primaryUserId: string;
description: string;
}
| {
status: "ACCOUNT_INFO_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
primaryUserId: string;
}
| {
status: "EXISTING_ACCOUNT_NEEDS_TO_BE_VERIFIED_ERROR";
description: string;
}
| {
status: "ACCOUNT_LINKING_NOT_ALLOWED_ERROR";
}
| {
status: "CANNOT_CREATE_PRIMARY_USER_FOR_EXISTING_ACCOUNT_ERROR";
description: string;
}
| {
status: "ACCOUNT_NOT_VERIFIED_ERROR";
isNotVerifiedAccountFromInputSession: boolean;
}
| GeneralErrorResponse
>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ function getIterfaceImpl(apiImplmentation) {
(_e = apiImplmentation.emailPasswordSignUpPOST) === null || _e === void 0
? void 0
: _e.bind(apiImplmentation),
linkNewAccountToExistingAccountPOST:
(_f = apiImplmentation.emailPasswordLinkNewAccountToExistingAccountPOST) === null || _f === void 0
linkAccountToExistingAccountPOST:
(_f = apiImplmentation.emailPasswordLinkAccountToExistingAccountPOST) === null || _f === void 0
? void 0
: _f.bind(apiImplmentation),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ function getAPIImplementation() {
(_e = emailPasswordImplementation.generatePasswordResetTokenPOST) === null || _e === void 0
? void 0
: _e.bind(emailPasswordAPIImplementation_1.default(this)),
emailPasswordLinkNewAccountToExistingAccountPOST:
(_f = emailPasswordImplementation.linkNewAccountToExistingAccountPOST) === null || _f === void 0
emailPasswordLinkAccountToExistingAccountPOST:
(_f = emailPasswordImplementation.linkAccountToExistingAccountPOST) === null || _f === void 0
? void 0
: _f.bind(emailPasswordAPIImplementation_1.default(this)),
passwordResetPOST:
Expand Down
8 changes: 5 additions & 3 deletions lib/build/recipe/thirdpartyemailpassword/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,11 @@ class Wrapper {
return recipe_1.default.getInstanceOrThrowError().recipeInterfaceImpl.getUsersByEmail({ email, userContext });
}
static createResetPasswordToken(userId, email, userContext = {}) {
return recipe_1.default
.getInstanceOrThrowError()
.recipeInterfaceImpl.createResetPasswordToken({ userId, email, userContext });
return recipe_1.default.getInstanceOrThrowError().recipeInterfaceImpl.createResetPasswordToken({
userId,
email,
userContext,
});
}
static resetPasswordUsingToken(token, newPassword, userContext = {}) {
return recipe_1.default.getInstanceOrThrowError().recipeInterfaceImpl.resetPasswordUsingToken({
Expand Down
13 changes: 5 additions & 8 deletions lib/build/recipe/thirdpartyemailpassword/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export declare type APIInterface = {
status: "NO_EMAIL_GIVEN_BY_PROVIDER";
}
>);
emailPasswordLinkNewAccountToExistingAccountPOST:
emailPasswordLinkAccountToExistingAccountPOST:
| undefined
| ((input: {
formFields: {
Expand All @@ -264,22 +264,20 @@ export declare type APIInterface = {
| {
status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
primaryUserId: string;
description: string;
}
| {
status: "ACCOUNT_INFO_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
primaryUserId: string;
}
| {
status: "EXISTING_ACCOUNT_NEEDS_TO_BE_VERIFIED_ERROR";
description: string;
}
| {
status: "ACCOUNT_LINKING_NOT_ALLOWED_ERROR";
}
| {
status: "CANNOT_CREATE_PRIMARY_USER_FOR_EXISTING_ACCOUNT_ERROR";
description: string;
}
| {
status: "ACCOUNT_NOT_VERIFIED_ERROR";
isNotVerifiedAccountFromInputSession: boolean;
}
| GeneralErrorResponse
>);
Expand Down Expand Up @@ -317,7 +315,6 @@ export declare type APIInterface = {
status: "OK";
user: User;
createdNewUser: boolean;
createdNewRecipeUser: boolean;
session: SessionContainerInterface;
}
| {
Expand Down
8 changes: 4 additions & 4 deletions lib/ts/recipe/accountlinking/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ export type RecipeInterface = {
}
| {
status:
| "PRIMARY_USER_ALREADY_EXISTS_FOR_RECIPE_USER_ID_ERROR"
| "PRIMARY_USER_ALREADY_EXISTS_FOR_ACCOUNT_INFO_ERROR";
| "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"
| "ACCOUNT_INFO_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
primaryUserId: string;
}
>;
Expand All @@ -96,8 +96,8 @@ export type RecipeInterface = {
}
| {
status:
| "PRIMARY_USER_ALREADY_EXISTS_FOR_RECIPE_USER_ID_ERROR"
| "PRIMARY_USER_ALREADY_EXISTS_FOR_ACCOUNT_INFO_ERROR";
| "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"
| "ACCOUNT_INFO_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
primaryUserId: string;
}
>;
Expand Down
13 changes: 6 additions & 7 deletions lib/ts/recipe/emailpassword/api/implementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { GeneralErrorResponse } from "../../../types";

export default function getAPIImplementation(): APIInterface {
return {
linkNewAccountToExistingAccountPOST: async function (_input: {
linkAccountToExistingAccountPOST: async function (_input: {
formFields: {
id: string;
value: string;
Expand All @@ -24,27 +24,26 @@ export default function getAPIImplementation(): APIInterface {
| {
status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
primaryUserId: string;
description: string;
}
| {
status: "ACCOUNT_INFO_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
primaryUserId: string;
bhumilsarvaiya marked this conversation as resolved.
Show resolved Hide resolved
}
| {
status: "EXISTING_ACCOUNT_NEEDS_TO_BE_VERIFIED_ERROR";
description: string;
}
| {
status: "ACCOUNT_LINKING_NOT_ALLOWED_ERROR";
bhumilsarvaiya marked this conversation as resolved.
Show resolved Hide resolved
}
| {
status: "CANNOT_CREATE_PRIMARY_USER_FOR_EXISTING_ACCOUNT_ERROR";
description: string;
}
| {
status: "ACCOUNT_NOT_VERIFIED_ERROR";
isNotVerifiedAccountFromInputSession: boolean;
}
| GeneralErrorResponse
> {
return {
status: "ACCOUNT_NOT_VERIFIED_ERROR",
isNotVerifiedAccountFromInputSession: false,
};
},
emailExistsGET: async function ({
Expand Down
13 changes: 5 additions & 8 deletions lib/ts/recipe/emailpassword/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ export type APIInterface = {
status: "OK";
user: User;
createdNewUser: boolean;
createdNewRecipeUser: boolean;
session: SessionContainerInterface;
}
| {
Expand All @@ -260,7 +259,7 @@ export type APIInterface = {
| GeneralErrorResponse
>);

linkNewAccountToExistingAccountPOST:
linkAccountToExistingAccountPOST:
| undefined
| ((input: {
formFields: {
Expand All @@ -280,22 +279,20 @@ export type APIInterface = {
| {
status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
primaryUserId: string;
description: string;
}
| {
status: "ACCOUNT_INFO_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
primaryUserId: string;
}
| {
status: "EXISTING_ACCOUNT_NEEDS_TO_BE_VERIFIED_ERROR";
description: string;
}
| {
status: "ACCOUNT_LINKING_NOT_ALLOWED_ERROR";
}
| {
status: "CANNOT_CREATE_PRIMARY_USER_FOR_EXISTING_ACCOUNT_ERROR";
description: string;
rishabhpoddar marked this conversation as resolved.
Show resolved Hide resolved
}
| {
status: "ACCOUNT_NOT_VERIFIED_ERROR";
isNotVerifiedAccountFromInputSession: boolean;
}
| GeneralErrorResponse
>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function getIterfaceImpl(apiImplmentation: ThirdPartyEmailPasswor
passwordResetPOST: apiImplmentation.passwordResetPOST?.bind(apiImplmentation),
signInPOST: apiImplmentation.emailPasswordSignInPOST?.bind(apiImplmentation),
signUpPOST: apiImplmentation.emailPasswordSignUpPOST?.bind(apiImplmentation),
linkNewAccountToExistingAccountPOST: apiImplmentation.emailPasswordLinkNewAccountToExistingAccountPOST?.bind(
linkAccountToExistingAccountPOST: apiImplmentation.emailPasswordLinkAccountToExistingAccountPOST?.bind(
apiImplmentation
),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function getAPIImplementation(): APIInterface {
generatePasswordResetTokenPOST: emailPasswordImplementation.generatePasswordResetTokenPOST?.bind(
DerivedEP(this)
),
emailPasswordLinkNewAccountToExistingAccountPOST: emailPasswordImplementation.linkNewAccountToExistingAccountPOST?.bind(
emailPasswordLinkAccountToExistingAccountPOST: emailPasswordImplementation.linkAccountToExistingAccountPOST?.bind(
DerivedEP(this)
),
passwordResetPOST: emailPasswordImplementation.passwordResetPOST?.bind(DerivedEP(this)),
Expand Down
13 changes: 5 additions & 8 deletions lib/ts/recipe/thirdpartyemailpassword/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export type APIInterface = {
}
>);

emailPasswordLinkNewAccountToExistingAccountPOST:
emailPasswordLinkAccountToExistingAccountPOST:
bhumilsarvaiya marked this conversation as resolved.
Show resolved Hide resolved
| undefined
| ((input: {
formFields: {
Expand All @@ -271,22 +271,20 @@ export type APIInterface = {
| {
status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
primaryUserId: string;
description: string;
}
| {
status: "ACCOUNT_INFO_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
primaryUserId: string;
}
| {
status: "EXISTING_ACCOUNT_NEEDS_TO_BE_VERIFIED_ERROR";
description: string;
}
| {
status: "ACCOUNT_LINKING_NOT_ALLOWED_ERROR";
}
| {
status: "CANNOT_CREATE_PRIMARY_USER_FOR_EXISTING_ACCOUNT_ERROR";
description: string;
}
| {
status: "ACCOUNT_NOT_VERIFIED_ERROR";
isNotVerifiedAccountFromInputSession: boolean;
}
| GeneralErrorResponse
>);
Expand Down Expand Up @@ -325,7 +323,6 @@ export type APIInterface = {
status: "OK";
user: User;
createdNewUser: boolean;
createdNewRecipeUser: boolean;
session: SessionContainerInterface;
}
| {
Expand Down