From 03e1a867169b3777fde2c86c34fd89c0076e77dd Mon Sep 17 00:00:00 2001 From: Andrew Meyer Date: Wed, 14 Sep 2022 09:24:04 +0200 Subject: [PATCH] Match types for User#callFunction implementation across platforms (#4840) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove deprecated EmailPasswordAuth functions (#4842) The positional argument functions have been removed and now only the object arguments are accepted. * Match types for `User#callFunction` implementation across platforms The unifies the call signature of User#callFunction across all documentation and platforms. `callFunction` now has the signature: ```javascript user.callFunction('func', 1, 2, 3); ``` * Update lib/user.js Co-authored-by: Kræn Hansen Co-authored-by: Kræn Hansen --- CHANGELOG.md | 19 ++- docs/sync.js | 127 ++++-------------- lib/email-password-auth-methods.js | 50 +++---- lib/user.js | 12 +- .../src/auth-providers/EmailPasswordAuth.ts | 91 ++----------- tests/js/user-tests.js | 5 +- types/app.d.ts | 2 +- types/auth-providers.d.ts | 90 ++----------- 8 files changed, 99 insertions(+), 297 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ea6e81479..2e4a0858a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,23 @@ ### Notes Based on Realm JS v10.21.1: See changelog below for details on enhancements and fixes introduced between this and the previous pre release (which was based on Realm JS v10.19.5). +### Breaking change +* Removed deprecated positional arguments to Email/Password authentication functions + * The following functions now only accept object arguments: + ```javascript + Realm.Auth.EmailPasswordAuth.registerUser({email, password}); + Realm.Auth.EmailPasswordAuth.confirmUser({token, tokenId}); + Realm.Auth.EmailPasswordAuth.resendConfirmationEmail({email}); + Realm.Auth.EmailPasswordAuth.retryCustomConfirmation({email}); + Realm.Auth.EmailPasswordAuth.resetPassword({token, tokenId, password}); + Realm.Auth.EmailPasswordAuth.sendResetPasswordEmail({email}); + Realm.Auth.EmailPasswordAuth.callResetPasswordFunction({email, password}, ...args); +* Unify the call signature documentation of `User#callFunction` ([#3733](https://github.com/realm/realm-js/issues/3733)) + * Example: + ```javascript + user.callFunction("sum", 1, 2, 3); // Valid + user.callFunction("sum", [1, 2, 3]); // Invalid + ``` ### Enhancements * Small improvement to performance by caching JSI property String object [#4863](https://github.com/realm/realm-js/pull/4863) @@ -45,7 +62,7 @@ Based on Realm JS v10.21.1: See changelog below for details on enhancements and * Fixed an exception `fcntl() with F_BARRIERFSYNC failed: Inappropriate ioctl for device` when running with MacOS on an exFAT drive. ([realm/realm-core#5789](https://github.com/realm/realm-core/issues/5789), since v10.18.0) * Syncing of a Decimal128 with big significand could result in a crash. ([realm/realm-core#5728](https://github.com/realm/realm-core/issues/5728), since v10.0.0) * `discardLocal` client reset mode will now wait for flexible sync Realms to be fully synchronized before beginning recovery operations. ([realm/realm-core#5705](https://github.com/realm/realm-core/issues/5705), since v10.11.0) - + ### Compatibility * MongoDB Realm Cloud. * Realm Studio v11.0.0. diff --git a/docs/sync.js b/docs/sync.js index 2dc3aa1df9..3e841b537d 100644 --- a/docs/sync.js +++ b/docs/sync.js @@ -542,152 +542,81 @@ class EmailPasswordAuth { * Registers a new email identity with the email/password provider, * and sends a confirmation email to the provided address. * - * @param {object} userDetails The new user's email and password details - * @param {string} userDetails.email - The email address of the user to register. - * @param {string} userDetails.password - The password that the user created for the new username/password identity. + * @param {object} details The new user's email and password details + * @param {string} details.email - The email address of the user to register. + * @param {string} details.password - The password that the user created for the new username/password identity. * @returns {Promise} * @since v10.10.0 */ - registerUser(userDetails) {} - - /** - * Registers a new email identity with the email/password provider, - * and sends a confirmation email to the provided address. - * - * @param {string} email - The email address of the user to register. - * @param {string} password - The password that the user created for the new username/password identity. - * @returns {Promise} - * @deprecated Use `registerUser(userDetails)` instead - */ - registerUser(email, password) {} + registerUser(details) {} /** * Confirms an email identity with the email/password provider. * - * @param {object} tokenDetails The received token and ID details - * @param {string} tokenDetails.token - The confirmation token that was emailed to the user. - * @param {string} tokenDetails.tokenId - The confirmation token id that was emailed to the user. + * @param {object} details The received token and ID details + * @param {string} details.token - The confirmation token that was emailed to the user. + * @param {string} details.tokenId - The confirmation token id that was emailed to the user. * @returns {Promise} * @since v10.10.0 */ - confirmUser(tokenDetails) {} - - /** - * Confirms an email identity with the email/password provider. - * - * @param {string} token - The confirmation token that was emailed to the user. - * @param {string} id - The confirmation token id that was emailed to the user. - * @returns {Promise} - * @deprecated Use `confirmUser(tokenDetails)` instead - */ - confirmUser(token, id) {} + confirmUser(details) {} /** * Re-sends a confirmation email to a user that has registered but * not yet confirmed their email address. * - * @param {object} emailDetails The associated email details - * @param {string} emailDetails.email - The email address of the user to re-send a confirmation for. + * @param {object} details The associated email details + * @param {string} details.email - The email address of the user to re-send a confirmation for. * @returns {Promise} * @since v10.10.0 */ - resendConfirmationEmail(emailDetails) {} - - /** - * Re-sends a confirmation email to a user that has registered but - * not yet confirmed their email address. - * - * @param {string} email - The email address of the user to re-send a confirmation for. - * @returns {Promise} - * @deprecated Use `resendConfirmationEmail(emailDetails)` instead - */ - resendConfirmationEmail(email) {} + resendConfirmationEmail(details) {} /** * Re-run the custom confirmation function for user that has registered but * not yet confirmed their email address. * - * @param {object} emailDetails The associated email details - * @param {string} emailDetails.email - The email address of the user to re-run the confirmation for. + * @param {object} details The associated email details + * @param {string} details.email - The email address of the user to re-run the confirmation for. * @returns {Promise} * @since v10.10.0 */ - retryCustomConfirmation(emailDetails) {} - - /** - * Re-run the custom confirmation function for user that has registered but - * not yet confirmed their email address. - * - * @param {string} email - The email address of the user to re-run the confirmation for. - * @returns {Promise} - * @deprecated Use `retryCustomConfirmation(emailDetails)` instead - */ - retryCustomConfirmation(email) {} + retryCustomConfirmation(details) {} /** * Sends an email to the user for resetting the password. * - * @param {object} emailDetails The email details to send the reset to - * @param {string} emailDetails.email - The email address of the user to re-send a confirmation for. + * @param {object} details The email details to send the reset to + * @param {string} details.email - The email address of the user to re-send a confirmation for. * @returns {Promise} * @since v10.10.0 */ - sendResetPasswordEmail(emailDetails) {} - - /** - * Sends an email to the user for resetting the password. - * @param {string} email - The email address of the user to re-send a confirmation for. - * @returns {Promise} - * @deprecated Use `sendResetPasswordEmail(emailDetails)` instead - */ - sendResetPasswordEmail(email) {} + sendResetPasswordEmail(details) {} /** * Resets the password of an email identity using the password reset token emailed to a user. * - * @param {object} resetDetails The token and password details for the reset - * @param {string} resetDetails.password - The desired new password. - * @param {string} resetDetails.token - The password reset token that was emailed to the user. - * @param {string} resetDetails.tokenId - The password reset token id that was emailed to the user. + * @param {object} details The token and password details for the reset + * @param {string} details.password - The desired new password. + * @param {string} details.token - The password reset token that was emailed to the user. + * @param {string} details.tokenId - The password reset token id that was emailed to the user. * @returns {Promise} * @since v10.10.0 */ - resetPassword(resetDetails) {} - - /** - * Resets the password of an email identity using the password reset token emailed to a user. - * @param {string} password - The desired new password. - * @param {string} token - The password reset token that was emailed to the user. - * @param {string} id - The password reset token id that was emailed to the user. - * @returns {Promise} - * @deprecated Use `resetPassword(resetDetails)` instead - */ - resetPassword(password, token, id) {} + resetPassword(details) {} /** * Resets the password of an email identity using the * password reset function set up in the application. * - * @param resetDetails The email and password details to reset - * @param {string} resetDetails.email - The email address of the user. - * @param {string} resetDetails.password - The desired new password. + * @param details The email and password details to reset + * @param {string} details.email - The email address of the user. + * @param {string} details.password - The desired new password. * @param {Array} args - Arguments passed onto the function. * @return {Promise} * @since v10.10.0 */ - callResetPasswordFunction(resetDetails, ...args) {} - - /** - * Resets the password of an email identity using the - * password reset function set up in the application. - * - * @param {string} email - The email address of the user. - * @param {string} password - The desired new password. - * @param {Array} args - Arguments passed onto the function. - * @return {Promise} - * @deprecated Use `callResetPasswordFunction(resetDetails, ...args)` instead - */ - callResetPasswordFunction(email, password, ...args) {} + callResetPasswordFunction(details, ...args) {} } /** @@ -871,10 +800,10 @@ class User { /** * Calls the named server function as this user. * @param {string} name - name of the function to call - * @param {any[]} args = [] - list of arguments to pass + * @param {...*} [args] - arguments to pass to the function * @return {Promise} - resolves when the function terminates. */ - callFunction(name, args) {} + callFunction(name, ...args) {} /** * Convenience wrapper around `callFunction(name, [args])` diff --git a/lib/email-password-auth-methods.js b/lib/email-password-auth-methods.js index d385562c97..ce52544b67 100644 --- a/lib/email-password-auth-methods.js +++ b/lib/email-password-auth-methods.js @@ -19,7 +19,6 @@ const { EJSON } = require("bson"); const { promisify } = require("./utils.js"); -const { handleDeprecatedPositionalArgs } = require("@realm.io/common"); // TODO for v11: change all signatures to methodName(argsObject) and remove handleDeprecatedPositionalArgs call // @@ -28,52 +27,33 @@ const { handleDeprecatedPositionalArgs } = require("@realm.io/common"); // return promisify((cb) => this._registerUser(argsObject, cb)); // }, const instanceMethods = { - registerUser(...args) { - const { argsObject } = handleDeprecatedPositionalArgs(args, "registerUser", ["email", "password"]); - - return promisify((cb) => this._registerUser(argsObject, cb)); + registerUser(details) { + return promisify((cb) => this._registerUser(details, cb)); }, - confirmUser(...args) { - const { argsObject } = handleDeprecatedPositionalArgs(args, "confirmUser", ["token", "tokenId"]); - - return promisify((cb) => this._confirmUser(argsObject, cb)); + confirmUser(details) { + return promisify((cb) => this._confirmUser(details, cb)); }, - resendConfirmationEmail(...args) { - const { argsObject } = handleDeprecatedPositionalArgs(args, "resendConfirmationEmail", ["email"]); - - return promisify((cb) => this._resendConfirmationEmail(argsObject, cb)); + resendConfirmationEmail(details) { + return promisify((cb) => this._resendConfirmationEmail(details, cb)); }, - retryCustomConfirmation(...args) { - const { argsObject } = handleDeprecatedPositionalArgs(args, "retryCustomConfirmation", ["email"]); - - return promisify((cb) => this._retryCustomConfirmation(argsObject, cb)); + retryCustomConfirmation(details) { + return promisify((cb) => this._retryCustomConfirmation(details, cb)); }, - sendResetPasswordEmail(...args) { - const { argsObject } = handleDeprecatedPositionalArgs(args, "sendResetPasswordEmail", ["email"]); - - return promisify((cb) => this._sendResetPasswordEmail(argsObject, cb)); + sendResetPasswordEmail(details) { + return promisify((cb) => this._sendResetPasswordEmail(details, cb)); }, - resetPassword(...args) { - const { argsObject } = handleDeprecatedPositionalArgs(args, "resetPassword", ["password", "token", "tokenId"]); - - return promisify((cb) => this._resetPassword(argsObject, cb)); + resetPassword(details) { + return promisify((cb) => this._resetPassword(details, cb)); }, - callResetPasswordFunction(...args) { - const { argsObject, restArgs } = handleDeprecatedPositionalArgs( - args, - "callResetPasswordFunction", - ["email", "password"], - true, - ); - - const stringifiedArgs = EJSON.stringify(restArgs, { relaxed: false }); - return promisify((cb) => this._callResetPasswordFunction(argsObject, stringifiedArgs, cb)); + callResetPasswordFunction(details, ...args) { + const stringifiedArgs = EJSON.stringify(args, { relaxed: false }); + return promisify((cb) => this._callResetPasswordFunction(details, stringifiedArgs, cb)); }, }; diff --git a/lib/user.js b/lib/user.js index dc0b938392..c10b53965e 100644 --- a/lib/user.js +++ b/lib/user.js @@ -30,10 +30,14 @@ const instanceMethods = { return promisify((cb) => this._logOut(cb)); }, - async callFunction(name, args = [], service = undefined) { + async callFunction(name, ...args) { + return this._callFunctionOnService(name, undefined, ...args); + }, + + async _callFunctionOnService(name, serviceName, ...args) { const cleanedArgs = cleanArguments(args); const stringifiedArgs = EJSON.stringify(cleanedArgs, { relaxed: false }); - const result = await promisify((cb) => this._callFunction(name, stringifiedArgs, service, cb)); + const result = await promisify((cb) => this._callFunction(name, stringifiedArgs, serviceName, cb)); return EJSON.parse(result); }, @@ -98,7 +102,7 @@ const instanceMethods = { }, // Internal helpers. - _functionsOnService(service) { + _functionsOnService(serviceName) { const user = this; return new Proxy( {}, @@ -106,7 +110,7 @@ const instanceMethods = { get(target, name, receiver) { if (typeof name === "string" && name != "inspect") { return (...args) => { - return user.callFunction(name, args, service); + return user._callFunctionOnService(name, serviceName, ...args); }; } else { return Reflect.get(target, name, receiver); diff --git a/packages/realm-web/src/auth-providers/EmailPasswordAuth.ts b/packages/realm-web/src/auth-providers/EmailPasswordAuth.ts index 41603f4801..088a0c78fd 100644 --- a/packages/realm-web/src/auth-providers/EmailPasswordAuth.ts +++ b/packages/realm-web/src/auth-providers/EmailPasswordAuth.ts @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////////////// import { Fetcher } from "../Fetcher"; -import { handleDeprecatedPositionalArgs } from "@realm.io/common"; /** @inheritdoc */ export class EmailPasswordAuth implements Realm.Auth.EmailPasswordAuth { @@ -36,137 +35,75 @@ export class EmailPasswordAuth implements Realm.Auth.EmailPasswordAuth { } /** @inheritdoc */ - async registerUser(email: string, password: string): Promise; - async registerUser(userDetails: Realm.Auth.RegisterUserDetails): Promise; - async registerUser(...args: [string, string] | [Realm.Auth.RegisterUserDetails]): Promise { - const { argsObject: userDetails } = handleDeprecatedPositionalArgs( - args, - "registerUser", - ["email", "password"], - ); - + async registerUser(details: Realm.Auth.RegisterUserDetails): Promise { const appRoute = this.fetcher.appRoute; await this.fetcher.fetchJSON({ method: "POST", path: appRoute.emailPasswordAuth(this.providerName).register().path, - body: userDetails, + body: details, }); } /** @inheritdoc */ - async confirmUser(token: string, tokenId: string): Promise; - async confirmUser(tokenDetails: Realm.Auth.ConfirmUserDetails): Promise; - async confirmUser(...args: [string, string] | [Realm.Auth.ConfirmUserDetails]): Promise { - const { argsObject: tokenDetails } = handleDeprecatedPositionalArgs( - args, - "confirmUser", - ["token", "tokenId"], - ); - + async confirmUser(details: Realm.Auth.ConfirmUserDetails): Promise { const appRoute = this.fetcher.appRoute; await this.fetcher.fetchJSON({ method: "POST", path: appRoute.emailPasswordAuth(this.providerName).confirm().path, - body: tokenDetails, + body: details, }); } /** @inheritdoc */ - async resendConfirmationEmail(email: string): Promise; - async resendConfirmationEmail(emailDetails: Realm.Auth.ResendConfirmationDetails): Promise; - async resendConfirmationEmail(...args: [string] | [Realm.Auth.ResendConfirmationDetails]): Promise { - const { argsObject: emailDetails } = handleDeprecatedPositionalArgs( - args, - "resendConfirmationEmail", - ["email"], - ); - + async resendConfirmationEmail(details: Realm.Auth.ResendConfirmationDetails): Promise { const appRoute = this.fetcher.appRoute; await this.fetcher.fetchJSON({ method: "POST", path: appRoute.emailPasswordAuth(this.providerName).confirmSend().path, - body: emailDetails, + body: details, }); } /** @inheritdoc */ - async retryCustomConfirmation(email: string): Promise; - async retryCustomConfirmation(emailDetails: Realm.Auth.RetryCustomConfirmationDetails): Promise; - async retryCustomConfirmation(...args: [string] | [Realm.Auth.RetryCustomConfirmationDetails]): Promise { - const { argsObject: emailDetails } = handleDeprecatedPositionalArgs( - args, - "retryCustomConfirmation", - ["email"], - ); - + async retryCustomConfirmation(details: Realm.Auth.RetryCustomConfirmationDetails): Promise { const appRoute = this.fetcher.appRoute; await this.fetcher.fetchJSON({ method: "POST", path: appRoute.emailPasswordAuth(this.providerName).confirmCall().path, - body: emailDetails, + body: details, }); } /** @inheritdoc */ - async resetPassword(token: string, tokenId: string, password: string): Promise; - async resetPassword(resetDetails: Realm.Auth.ResetPasswordDetails): Promise; - async resetPassword(...args: [string, string, string] | [Realm.Auth.ResetPasswordDetails]): Promise { - const { argsObject: resetDetails } = handleDeprecatedPositionalArgs( - args, - "resetPassword", - ["token", "tokenId", "password"], - ); - + async resetPassword(details: Realm.Auth.ResetPasswordDetails): Promise { const appRoute = this.fetcher.appRoute; await this.fetcher.fetchJSON({ method: "POST", path: appRoute.emailPasswordAuth(this.providerName).reset().path, - body: resetDetails, + body: details, }); } /** @inheritdoc */ - async sendResetPasswordEmail(email: string): Promise; - async sendResetPasswordEmail(emailDetails: Realm.Auth.SendResetPasswordDetails): Promise; - async sendResetPasswordEmail(...args: [string] | [Realm.Auth.SendResetPasswordDetails]): Promise { - const { argsObject: emailDetails } = handleDeprecatedPositionalArgs( - args, - "sendResetPasswordEmail", - ["email"], - ); - + async sendResetPasswordEmail(details: Realm.Auth.SendResetPasswordDetails): Promise { const appRoute = this.fetcher.appRoute; await this.fetcher.fetchJSON({ method: "POST", path: appRoute.emailPasswordAuth(this.providerName).resetSend().path, - body: emailDetails, + body: details, }); } /** @inheritdoc */ - async callResetPasswordFunction(email: string, password: string, ...args: unknown[]): Promise; async callResetPasswordFunction( - resetDetails: Realm.Auth.CallResetPasswordFunctionDetails, + details: Realm.Auth.CallResetPasswordFunctionDetails, ...args: unknown[] - ): Promise; - async callResetPasswordFunction( - ...args: [string, string, ...unknown[]] | [Realm.Auth.CallResetPasswordFunctionDetails, ...unknown[]] ): Promise { - const { - argsObject: resetDetails, - restArgs, - } = handleDeprecatedPositionalArgs( - args, - "callResetPasswordFunction", - ["email", "password"], - true, - ); - const appRoute = this.fetcher.appRoute; await this.fetcher.fetchJSON({ method: "POST", path: appRoute.emailPasswordAuth(this.providerName).resetCall().path, - body: { ...resetDetails, arguments: restArgs }, + body: { ...details, arguments: args }, }); } } diff --git a/tests/js/user-tests.js b/tests/js/user-tests.js index 7682499328..5616423bb1 100644 --- a/tests/js/user-tests.js +++ b/tests/js/user-tests.js @@ -333,7 +333,7 @@ module.exports = { let user = await app.logIn(credentials); TestCase.assertEqual(await user.callFunction("sumFunc"), 0); - TestCase.assertEqual(await user.callFunction("sumFunc", [123]), 123); + TestCase.assertEqual(await user.callFunction("sumFunc", 123), 123); TestCase.assertEqual(await user.functions.sumFunc(123), 123); TestCase.assertEqual(await user.functions["sumFunc"](123), 123); @@ -348,9 +348,6 @@ module.exports = { const err = await TestCase.assertThrowsAsync(async () => await user.functions.error()); TestCase.assertEqual(err.message, "function not found: 'error'"); - - // Regression tests for invalid inputs to function (non array) - TestCase.assertThrowsAsync(async () => await user.callFunction("sumFunc", 123)); }, async testMongoClient() { diff --git a/types/app.d.ts b/types/app.d.ts index edfdc2d25d..13daba372c 100644 --- a/types/app.d.ts +++ b/types/app.d.ts @@ -490,7 +490,7 @@ declare namespace Realm { * * @example * // These are all equivalent: - * await user.callFunction("doThing", [a1, a2, a3]); + * await user.callFunction("doThing", a1, a2, a3); * await user.functions.doThing(a1, a2, a3); * await user.functions["doThing"](a1, a2, a3); * @example diff --git a/types/auth-providers.d.ts b/types/auth-providers.d.ts index 19a48ac101..4a79b18dca 100644 --- a/types/auth-providers.d.ts +++ b/types/auth-providers.d.ts @@ -101,121 +101,59 @@ declare namespace Realm { /** * Register a new user. * - * @param userDetails The new user's email and password details + * @param details The new user's email and password details * @since v10.10.0 */ - registerUser(userDetails: RegisterUserDetails): Promise; - - /** - * Register a new user. - * - * @param email the new user's email. - * @param password the new user's passsword. - * @deprecated Use `registerUser(userDetails)` instead - */ - registerUser(email: string, password: string): Promise; + registerUser(details: RegisterUserDetails): Promise; /** * Confirm a user by the token received. * - * @param tokenDetails The received token and ID details + * @param details The received token and ID details * @since v10.10.0 */ - confirmUser(tokenDetails: ConfirmUserDetails): Promise; - - /** - * Confirm a user by the token received. - * - * @param token the token received. - * @param tokenId the id of the token received. - * @deprecated Use `confirmUser(tokenDetails)` instead - */ - confirmUser(token: string, tokenId: string): Promise; + confirmUser(details: ConfirmUserDetails): Promise; /** * Resend the confirmation email. * - * @param emailDetails The associated email details + * @param details The associated email details * @since v10.10.0 */ - resendConfirmationEmail(emailDetails: ResendConfirmationDetails): Promise; - - /** - * Resend the confirmation email. - * - * @param email the email associated to resend the confirmation to. - * @deprecated Use `resendConfirmationEmail(emailDetails)` instead - */ - resendConfirmationEmail(email: string): Promise; + resendConfirmationEmail(details: ResendConfirmationDetails): Promise; /** * Rerun the custom confirmation function. * - * @param emailDetails The associated email details + * @param details The associated email details * @since v10.10.0 */ - retryCustomConfirmation(emailDetails: RetryCustomConfirmationDetails): Promise; - - /** - * Rerun the custom confirmation function. - * - * @param email the email associated to resend the confirmation to. - * @deprecated Use `retryCustomConfirmation(emailDetails)` instead - */ - retryCustomConfirmation(email: string): Promise; + retryCustomConfirmation(details: RetryCustomConfirmationDetails): Promise; /** * Complete resetting the password * - * @param resetDetails The token and password details for the reset + * @param details The token and password details for the reset * @since v10.10.0 */ - resetPassword(resetDetails: ResetPasswordDetails): Promise; - - /** - * Complete resetting the password - * - * @param token the token received. - * @param tokenId the id of the token received. - * @param password the new password. - * @deprecated Use `resetPassword(resetDetails)` instead - */ - resetPassword(token: string, tokenId: string, password: string): Promise; + resetPassword(details: ResetPasswordDetails): Promise; /** * Send an email with tokens to reset the password. * - * @param emailDetails The email details to send the reset to + * @param details The email details to send the reset to * @since v10.10.0 */ - sendResetPasswordEmail(emailDetails: SendResetPasswordDetails): Promise; - - /** - * Send an email with tokens to reset the password. - * - * @param email the email to send the tokens to. - * @deprecated Use `sendResetPasswordEmail(emailDetails)` instead - */ - sendResetPasswordEmail(email: string): Promise; + sendResetPasswordEmail(details: SendResetPasswordDetails): Promise; /** * Call the custom function to reset the password. * - * @param resetDetails The email and password details to reset + * @param details The email and password details to reset * @param args One or more arguments to pass to the function. * @since v10.10.0 */ - callResetPasswordFunction(resetDetails: CallResetPasswordFunctionDetails, ...args: unknown[]): Promise; - - /** - * Call the custom function to reset the password. - * - * @param email the email associated with the user. - * @param password the new password. - * @param args one or more arguments to pass to the function. - * @deprecated Use `callResetPasswordFunction(resetDetails, ...args)` instead - */ - callResetPasswordFunction(email: string, password: string, ...args: unknown[]): Promise; + callResetPasswordFunction(details: CallResetPasswordFunctionDetails, ...args: unknown[]): Promise; } /**