Skip to content

Commit

Permalink
feat: add backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus committed Sep 5, 2023
1 parent 1c388be commit 4ca4e14
Show file tree
Hide file tree
Showing 34 changed files with 243 additions and 66 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Breaking changes

- Only supporting FDI 1.18
- Added support for FDI 1.18
- User type has changed across recipes and functions: recipe specific user types have been removed and replaced by a generic one that contains more information
- `createdNewUser` has been renamed to `createdNewRecipeUser`
- `createCode`, `consumeCode`, `createPasswordlessCode` and `consumePasswordlessCode` can now return status: `SIGN_IN_UP_NOT_ALLOWED`
- `signInAndUp` and `thirdPartySignInAndUp` can now return new statuses: `EMAIL_ALREADY_USED_IN_ANOTHER_ACCOUNT`, `SIGN_IN_UP_NOT_ALLOWED`
- `sendPasswordResetEmail` can now return `status: "PASSWORD_RESET_NOT_ALLOWED"`
- `submitNewPassword` includes `user` and `email` in the `status: "OK"` response

## [0.7.3] - 2023-08-21

Expand Down
2 changes: 1 addition & 1 deletion bundle/emailpassword.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/emailverification.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/multitenancy.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/passwordless.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/session.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/supertokens.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/thirdparty.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/thirdpartyemailpassword.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/thirdpartypasswordless.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/userroles.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontendDriverInterfaceSupported.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_comment": "contains a list of frontend-backend interface versions that this package supports",
"versions": ["1.18"]
"versions": ["1.17", "1.18"]
}
2 changes: 0 additions & 2 deletions lib/build/recipe/emailpassword/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 17 additions & 11 deletions lib/build/recipe/emailpassword/recipeImplementation.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions lib/build/recipe/emailpassword/types.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion lib/build/recipe/passwordless/recipeImplementation.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion lib/build/recipe/thirdparty/recipeImplementation.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions lib/build/recipe/thirdpartyemailpassword/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions lib/build/recipe/thirdpartyemailpassword/types.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/build/types.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 44 additions & 1 deletion lib/build/utils.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 41 additions & 1 deletion lib/build/utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/build/version.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions lib/ts/recipe/emailpassword/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ export default class RecipeWrapper {
}): Promise<
| {
status: "OK";
user: User;
email: string;
fetchResponse: Response;
}
| {
Expand Down
14 changes: 4 additions & 10 deletions lib/ts/recipe/emailpassword/recipeImplementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import Querier from "../../querier";
import Multitenancy from "../multitenancy/recipe";
import { PreAndPostAPIHookAction, RecipeInterface } from "./types";
import { getQueryParams } from "../../utils";
import { getQueryParams, normaliseUser } from "../../utils";
import { RecipeFunctionOptions, RecipeImplementationInput } from "../recipeModule/types";
import { User } from "../../types";

Expand All @@ -39,8 +39,6 @@ export default function getRecipeImplementation(
}): Promise<
| {
status: "OK";
user: User;
email: string;
fetchResponse: Response;
}
| {
Expand All @@ -64,8 +62,6 @@ export default function getRecipeImplementation(
const { jsonBody, fetchResponse } = await querier.post<
| {
status: "OK";
user: User;
email: string;
}
| {
status: "RESET_PASSWORD_INVALID_TOKEN_ERROR";
Expand Down Expand Up @@ -109,9 +105,7 @@ export default function getRecipeImplementation(
};
}
return {
status: jsonBody.status,
user: jsonBody.user,
email: jsonBody.email,
...jsonBody,
fetchResponse,
};
},
Expand Down Expand Up @@ -265,7 +259,7 @@ export default function getRecipeImplementation(

return {
status: jsonBody.status,
user: jsonBody.user,
user: normaliseUser("emailpassword", jsonBody.user),
fetchResponse,
};
},
Expand Down Expand Up @@ -349,7 +343,7 @@ export default function getRecipeImplementation(

return {
status: "OK",
user: jsonBody.user,
user: normaliseUser("emailpassword", jsonBody.user),
fetchResponse,
};
},
Expand Down
2 changes: 0 additions & 2 deletions lib/ts/recipe/emailpassword/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ export type RecipeInterface = {
}) => Promise<
| {
status: "OK";
user: User;
email: string;
fetchResponse: Response;
}
| {
Expand Down
12 changes: 10 additions & 2 deletions lib/ts/recipe/passwordless/recipeImplementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import { WindowHandlerReference } from "../../windowHandler";
import Querier from "../../querier";
import { getHashFromLocation, getQueryParams } from "../../utils";
import { getHashFromLocation, getQueryParams, normaliseUserResponse } from "../../utils";
import Multitenancy from "../multitenancy/recipe";
import { RecipeFunctionOptions, RecipeImplementationInput } from "../recipeModule/types";
import { PASSWORDLESS_LOGIN_ATTEMPT_INFO_STORAGE_KEY } from "./constants";
Expand Down Expand Up @@ -206,8 +206,16 @@ export default function getRecipeImplementation(
})
);

if (jsonBody.status !== "OK") {
return {
...jsonBody,
fetchResponse,
};
}

return {
...jsonBody,
status: "OK",
...normaliseUserResponse("passwordless", jsonBody),
fetchResponse,
};
},
Expand Down
Loading

0 comments on commit 4ca4e14

Please sign in to comment.