Skip to content

Commit

Permalink
account linking: fixes bugs and refactors (#498)
Browse files Browse the repository at this point in the history
* fixes bugs and refactors

* small refactors and fixes

* small refactor

* small type changes

* review changes
  • Loading branch information
rishabhpoddar authored Mar 1, 2023
1 parent 4bc7809 commit 9fb3586
Show file tree
Hide file tree
Showing 12 changed files with 673 additions and 413 deletions.
4 changes: 2 additions & 2 deletions lib/build/recipe/accountlinking/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default class Wrapper {
): Promise<{
[primaryUserId: string]: string[];
}>;
static getPrimaryUserIdsforRecipeUserIds(
static getPrimaryUserIdsForRecipeUserIds(
recipeUserIds: string[],
userContext?: any
): Promise<{
Expand Down Expand Up @@ -127,7 +127,7 @@ export default class Wrapper {
}
export declare const init: typeof Recipe.init;
export declare const getRecipeUserIdsForPrimaryUserIds: typeof Wrapper.getRecipeUserIdsForPrimaryUserIds;
export declare const getPrimaryUserIdsforRecipeUserIds: typeof Wrapper.getPrimaryUserIdsforRecipeUserIds;
export declare const getPrimaryUserIdsForRecipeUserIds: typeof Wrapper.getPrimaryUserIdsForRecipeUserIds;
export declare const addNewRecipeUserIdWithoutPrimaryUserId: typeof Wrapper.addNewRecipeUserIdWithoutPrimaryUserId;
export declare const canCreatePrimaryUserId: typeof Wrapper.canCreatePrimaryUserId;
export declare const createPrimaryUser: typeof Wrapper.createPrimaryUser;
Expand Down
8 changes: 4 additions & 4 deletions lib/build/recipe/accountlinking/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var __importDefault =
return mod && mod.__esModule ? mod : { default: mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.storeIntoAccountToLinkTable = exports.fetchFromAccountToLinkTable = exports.unlinkAccounts = exports.linkAccounts = exports.canLinkAccounts = exports.createPrimaryUser = exports.canCreatePrimaryUserId = exports.addNewRecipeUserIdWithoutPrimaryUserId = exports.getPrimaryUserIdsforRecipeUserIds = exports.getRecipeUserIdsForPrimaryUserIds = exports.init = void 0;
exports.storeIntoAccountToLinkTable = exports.fetchFromAccountToLinkTable = exports.unlinkAccounts = exports.linkAccounts = exports.canLinkAccounts = exports.createPrimaryUser = exports.canCreatePrimaryUserId = exports.addNewRecipeUserIdWithoutPrimaryUserId = exports.getPrimaryUserIdsForRecipeUserIds = exports.getRecipeUserIdsForPrimaryUserIds = exports.init = void 0;
const recipe_1 = __importDefault(require("./recipe"));
class Wrapper {
static getRecipeUserIdsForPrimaryUserIds(primaryUserIds, userContext) {
Expand All @@ -63,11 +63,11 @@ class Wrapper {
});
});
}
static getPrimaryUserIdsforRecipeUserIds(recipeUserIds, userContext) {
static getPrimaryUserIdsForRecipeUserIds(recipeUserIds, userContext) {
return __awaiter(this, void 0, void 0, function* () {
return yield recipe_1.default
.getInstanceOrThrowError()
.recipeInterfaceImpl.getPrimaryUserIdsforRecipeUserIds({
.recipeInterfaceImpl.getPrimaryUserIdsForRecipeUserIds({
recipeUserIds,
userContext: userContext === undefined ? {} : userContext,
});
Expand Down Expand Up @@ -151,7 +151,7 @@ exports.default = Wrapper;
Wrapper.init = recipe_1.default.init;
exports.init = Wrapper.init;
exports.getRecipeUserIdsForPrimaryUserIds = Wrapper.getRecipeUserIdsForPrimaryUserIds;
exports.getPrimaryUserIdsforRecipeUserIds = Wrapper.getPrimaryUserIdsforRecipeUserIds;
exports.getPrimaryUserIdsForRecipeUserIds = Wrapper.getPrimaryUserIdsForRecipeUserIds;
exports.addNewRecipeUserIdWithoutPrimaryUserId = Wrapper.addNewRecipeUserIdWithoutPrimaryUserId;
exports.canCreatePrimaryUserId = Wrapper.canCreatePrimaryUserId;
exports.createPrimaryUser = Wrapper.createPrimaryUser;
Expand Down
18 changes: 11 additions & 7 deletions lib/build/recipe/accountlinking/recipe.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,25 +74,29 @@ export default class Recipe extends RecipeModule {
}) => Promise<string>;
accountLinkPostSignInViaSession: ({
session,
info,
infoVerified,
newUser,
newUserVerified,
userContext,
}: {
session: SessionContainer;
info: AccountInfoAndEmailWithRecipeId;
infoVerified: boolean;
newUser: AccountInfoAndEmailWithRecipeId;
newUserVerified: boolean;
userContext: any;
}) => Promise<
| {
createRecipeUser: true;
updateVerificationClaim: boolean;
updateAccountLinkingClaim: "ADD_CLAIM" | "NO_CHANGE";
}
| ({
createRecipeUser: false;
} & (
| {
accountsLinked: true;
updateVerificationClaim: boolean;
updateAccountLinkingClaim: "REMOVE_CLAIM";
}
| {
accountsLinked: false;
updateAccountLinkingClaim: "ADD_CLAIM";
}
| {
accountsLinked: false;
Expand All @@ -117,7 +121,7 @@ export default class Recipe extends RecipeModule {
recipeUserId: string;
userContext: any;
}) => Promise<User | undefined>;
createPrimaryUserIdOrLinkAccounts: ({
createPrimaryUserIdOrLinkAccountsAfterEmailVerification: ({
recipeUserId,
session,
userContext,
Expand Down
Loading

0 comments on commit 9fb3586

Please sign in to comment.