Skip to content

Commit 3fc4aec

Browse files
rishabhpoddarRishabh
andauthored
refactor!: renames functions in tpep (#267)
Co-authored-by: Rishabh <[email protected]>
1 parent 9bb801f commit 3fc4aec

File tree

16 files changed

+74
-49
lines changed

16 files changed

+74
-49
lines changed

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010

1111
### Breaking Change
1212

13-
- Adds user context to all functions exposed to the user, and to API and Recipe interface functions.
13+
- Adds user context to all functions exposed to the user, and to API and Recipe interface functions. This is a non breaking change for User exposed function calls, but a breaking change if you are using the Recipe or APIs override feature
1414
- Returns session from API interface functions that create a session
15+
- Renames functions in ThirdPartyEmailPassword recipe (https://github.com/supertokens/supertokens-node/issues/219):
16+
- Recipe Interface:
17+
- `signInUp` -> `thirdPartySignInUp`
18+
- `signUp` -> `emailPasswordSignUp`
19+
- `signIn` -> `emailPasswordSignIn`
20+
- API Interface:
21+
- `emailExistsGET` -> `emailPasswordEmailExistsGET`
22+
- User exposed functions (in `recipe/thirdpartyemailpassword/index.ts`)
23+
- `signInUp` -> `thirdPartySignInUp`
24+
- `signUp` -> `emailPasswordSignUp`
25+
- `signIn` -> `emailPasswordSignIn`
1526

1627
### Change:
1728

lib/build/recipe/thirdpartyemailpassword/api/emailPasswordAPIImplementation.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ function getIterfaceImpl(apiImplmentation) {
44
var _a, _b, _c, _d, _e;
55
return {
66
emailExistsGET:
7-
(_a = apiImplmentation.emailExistsGET) === null || _a === void 0 ? void 0 : _a.bind(apiImplmentation),
7+
(_a = apiImplmentation.emailPasswordEmailExistsGET) === null || _a === void 0
8+
? void 0
9+
: _a.bind(apiImplmentation),
810
generatePasswordResetTokenPOST:
911
(_b = apiImplmentation.generatePasswordResetTokenPOST) === null || _b === void 0
1012
? void 0

lib/build/recipe/thirdpartyemailpassword/api/implementation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function getAPIImplementation() {
99
let emailPasswordImplementation = implementation_1.default();
1010
let thirdPartyImplementation = implementation_2.default();
1111
return {
12-
emailExistsGET:
12+
emailPasswordEmailExistsGET:
1313
(_a = emailPasswordImplementation.emailExistsGET) === null || _a === void 0
1414
? void 0
1515
: _a.bind(emailPasswordAPIImplementation_1.default(this)),

lib/build/recipe/thirdpartyemailpassword/index.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { TypeProvider } from "../thirdparty/types";
66
export default class Wrapper {
77
static init: typeof Recipe.init;
88
static Error: typeof SuperTokensError;
9-
static signInUp(
9+
static thirdPartySignInUp(
1010
thirdPartyId: string,
1111
thirdPartyUserId: string,
1212
email: {
@@ -30,7 +30,7 @@ export default class Wrapper {
3030
thirdPartyUserId: string,
3131
userContext?: any
3232
): Promise<User | undefined>;
33-
static signUp(
33+
static emailPasswordSignUp(
3434
email: string,
3535
password: string,
3636
userContext?: any
@@ -43,7 +43,7 @@ export default class Wrapper {
4343
status: "EMAIL_ALREADY_EXISTS_ERROR";
4444
}
4545
>;
46-
static signIn(
46+
static emailPasswordSignIn(
4747
email: string,
4848
password: string,
4949
userContext?: any
@@ -135,9 +135,9 @@ export default class Wrapper {
135135
}
136136
export declare let init: typeof Recipe.init;
137137
export declare let Error: typeof SuperTokensError;
138-
export declare let signUp: typeof Wrapper.signUp;
139-
export declare let signIn: typeof Wrapper.signIn;
140-
export declare let signInUp: typeof Wrapper.signInUp;
138+
export declare let emailPasswordSignUp: typeof Wrapper.emailPasswordSignUp;
139+
export declare let emailPasswordSignIn: typeof Wrapper.emailPasswordSignIn;
140+
export declare let thirdPartySignInUp: typeof Wrapper.thirdPartySignInUp;
141141
export declare let getUserById: typeof Wrapper.getUserById;
142142
export declare let getUserByThirdPartyInfo: typeof Wrapper.getUserByThirdPartyInfo;
143143
export declare let getUsersByEmail: typeof Wrapper.getUsersByEmail;

lib/build/recipe/thirdpartyemailpassword/index.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ const recipe_1 = require("./recipe");
4949
const error_1 = require("./error");
5050
const thirdPartyProviders = require("../thirdparty/providers");
5151
class Wrapper {
52-
static signInUp(thirdPartyId, thirdPartyUserId, email, userContext = {}) {
53-
return recipe_1.default.getInstanceOrThrowError().recipeInterfaceImpl.signInUp({
52+
static thirdPartySignInUp(thirdPartyId, thirdPartyUserId, email, userContext = {}) {
53+
return recipe_1.default.getInstanceOrThrowError().recipeInterfaceImpl.thirdPartySignInUp({
5454
thirdPartyId,
5555
thirdPartyUserId,
5656
email,
@@ -64,11 +64,15 @@ class Wrapper {
6464
userContext,
6565
});
6666
}
67-
static signUp(email, password, userContext = {}) {
68-
return recipe_1.default.getInstanceOrThrowError().recipeInterfaceImpl.signUp({ email, password, userContext });
67+
static emailPasswordSignUp(email, password, userContext = {}) {
68+
return recipe_1.default
69+
.getInstanceOrThrowError()
70+
.recipeInterfaceImpl.emailPasswordSignUp({ email, password, userContext });
6971
}
70-
static signIn(email, password, userContext = {}) {
71-
return recipe_1.default.getInstanceOrThrowError().recipeInterfaceImpl.signIn({ email, password, userContext });
72+
static emailPasswordSignIn(email, password, userContext = {}) {
73+
return recipe_1.default
74+
.getInstanceOrThrowError()
75+
.recipeInterfaceImpl.emailPasswordSignIn({ email, password, userContext });
7276
}
7377
static getUserById(userId, userContext = {}) {
7478
return recipe_1.default.getInstanceOrThrowError().recipeInterfaceImpl.getUserById({ userId, userContext });
@@ -162,9 +166,9 @@ Wrapper.Discord = thirdPartyProviders.Discord;
162166
Wrapper.GoogleWorkspaces = thirdPartyProviders.GoogleWorkspaces;
163167
exports.init = Wrapper.init;
164168
exports.Error = Wrapper.Error;
165-
exports.signUp = Wrapper.signUp;
166-
exports.signIn = Wrapper.signIn;
167-
exports.signInUp = Wrapper.signInUp;
169+
exports.emailPasswordSignUp = Wrapper.emailPasswordSignUp;
170+
exports.emailPasswordSignIn = Wrapper.emailPasswordSignIn;
171+
exports.thirdPartySignInUp = Wrapper.thirdPartySignInUp;
168172
exports.getUserById = Wrapper.getUserById;
169173
exports.getUserByThirdPartyInfo = Wrapper.getUserByThirdPartyInfo;
170174
exports.getUsersByEmail = Wrapper.getUsersByEmail;

lib/build/recipe/thirdpartyemailpassword/recipeImplementation/emailPasswordRecipeImplementation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ function getRecipeInterface(recipeInterface) {
3535
return {
3636
signUp: function (input) {
3737
return __awaiter(this, void 0, void 0, function* () {
38-
return yield recipeInterface.signUp(input);
38+
return yield recipeInterface.emailPasswordSignUp(input);
3939
});
4040
},
4141
signIn: function (input) {
4242
return __awaiter(this, void 0, void 0, function* () {
43-
return recipeInterface.signIn(input);
43+
return recipeInterface.emailPasswordSignIn(input);
4444
});
4545
},
4646
getUserById: function (input) {

lib/build/recipe/thirdpartyemailpassword/recipeImplementation/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ function getRecipeInterface(emailPasswordQuerier, thirdPartyQuerier) {
4242
originalThirdPartyImplementation = recipeImplementation_2.default(thirdPartyQuerier);
4343
}
4444
return {
45-
signUp: function (input) {
45+
emailPasswordSignUp: function (input) {
4646
return __awaiter(this, void 0, void 0, function* () {
4747
return yield originalEmailPasswordImplementation.signUp.bind(
4848
emailPasswordRecipeImplementation_1.default(this)
4949
)(input);
5050
});
5151
},
52-
signIn: function (input) {
52+
emailPasswordSignIn: function (input) {
5353
return __awaiter(this, void 0, void 0, function* () {
5454
return originalEmailPasswordImplementation.signIn.bind(
5555
emailPasswordRecipeImplementation_1.default(this)
5656
)(input);
5757
});
5858
},
59-
signInUp: function (input) {
59+
thirdPartySignInUp: function (input) {
6060
return __awaiter(this, void 0, void 0, function* () {
6161
if (originalThirdPartyImplementation === undefined) {
6262
throw new Error("No thirdparty provider configured");

lib/build/recipe/thirdpartyemailpassword/recipeImplementation/thirdPartyRecipeImplementation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function getRecipeInterface(recipeInterface) {
4949
},
5050
signInUp: function (input) {
5151
return __awaiter(this, void 0, void 0, function* () {
52-
let result = yield recipeInterface.signInUp(input);
52+
let result = yield recipeInterface.thirdPartySignInUp(input);
5353
if (result.status === "FIELD_ERROR") {
5454
return result;
5555
}

lib/build/recipe/thirdpartyemailpassword/types.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export declare type RecipeInterface = {
155155
thirdPartyUserId: string;
156156
userContext: any;
157157
}): Promise<User | undefined>;
158-
signInUp(input: {
158+
thirdPartySignInUp(input: {
159159
thirdPartyId: string;
160160
thirdPartyUserId: string;
161161
email: {
@@ -174,7 +174,7 @@ export declare type RecipeInterface = {
174174
error: string;
175175
}
176176
>;
177-
signUp(input: {
177+
emailPasswordSignUp(input: {
178178
email: string;
179179
password: string;
180180
userContext: any;
@@ -187,7 +187,7 @@ export declare type RecipeInterface = {
187187
status: "EMAIL_ALREADY_EXISTS_ERROR";
188188
}
189189
>;
190-
signIn(input: {
190+
emailPasswordSignIn(input: {
191191
email: string;
192192
password: string;
193193
userContext: any;
@@ -251,7 +251,7 @@ export declare type APIInterface = {
251251
status: "OK";
252252
url: string;
253253
}>);
254-
emailExistsGET:
254+
emailPasswordEmailExistsGET:
255255
| undefined
256256
| ((input: {
257257
email: string;

lib/ts/recipe/thirdpartyemailpassword/api/emailPasswordAPIImplementation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { APIInterface as ThirdPartyEmailPasswordAPIInterface } from "../";
33

44
export default function getIterfaceImpl(apiImplmentation: ThirdPartyEmailPasswordAPIInterface): APIInterface {
55
return {
6-
emailExistsGET: apiImplmentation.emailExistsGET?.bind(apiImplmentation),
6+
emailExistsGET: apiImplmentation.emailPasswordEmailExistsGET?.bind(apiImplmentation),
77
generatePasswordResetTokenPOST: apiImplmentation.generatePasswordResetTokenPOST?.bind(apiImplmentation),
88
passwordResetPOST: apiImplmentation.passwordResetPOST?.bind(apiImplmentation),
99
signInPOST: apiImplmentation.emailPasswordSignInPOST?.bind(apiImplmentation),

0 commit comments

Comments
 (0)