@eaccess/auth 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +14 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -575,6 +575,7 @@ interface AuthContext {
|
|
|
575
575
|
accountId: number;
|
|
576
576
|
email: string;
|
|
577
577
|
}>;
|
|
578
|
+
userExistsByEmail: (email: string) => Promise<boolean>;
|
|
578
579
|
forceLogoutForUserBy: (identifier: {
|
|
579
580
|
accountId?: number;
|
|
580
581
|
email?: string;
|
|
@@ -630,6 +631,7 @@ declare function confirmResetPassword(config: AuthConfig, token: string, passwor
|
|
|
630
631
|
accountId: number;
|
|
631
632
|
email: string;
|
|
632
633
|
}>;
|
|
634
|
+
declare function userExistsByEmail(config: AuthConfig, email: string): Promise<boolean>;
|
|
633
635
|
declare function forceLogoutForUserBy(config: AuthConfig, identifier: {
|
|
634
636
|
accountId?: number;
|
|
635
637
|
email?: string;
|
|
@@ -650,8 +652,9 @@ declare const authFunctions_register: typeof register;
|
|
|
650
652
|
declare const authFunctions_removeRoleForUserBy: typeof removeRoleForUserBy;
|
|
651
653
|
declare const authFunctions_resetPassword: typeof resetPassword;
|
|
652
654
|
declare const authFunctions_setStatusForUserBy: typeof setStatusForUserBy;
|
|
655
|
+
declare const authFunctions_userExistsByEmail: typeof userExistsByEmail;
|
|
653
656
|
declare namespace authFunctions {
|
|
654
|
-
export { authFunctions_addRoleForUserBy as addRoleForUserBy, authFunctions_changePasswordForUserBy as changePasswordForUserBy, authFunctions_confirmResetPassword as confirmResetPassword, authFunctions_createUser as createUser, authFunctions_deleteUserBy as deleteUserBy, authFunctions_forceLogoutForUserBy as forceLogoutForUserBy, authFunctions_hasRoleForUserBy as hasRoleForUserBy, authFunctions_initiatePasswordResetForUserBy as initiatePasswordResetForUserBy, authFunctions_register as register, authFunctions_removeRoleForUserBy as removeRoleForUserBy, authFunctions_resetPassword as resetPassword, authFunctions_setStatusForUserBy as setStatusForUserBy };
|
|
657
|
+
export { authFunctions_addRoleForUserBy as addRoleForUserBy, authFunctions_changePasswordForUserBy as changePasswordForUserBy, authFunctions_confirmResetPassword as confirmResetPassword, authFunctions_createUser as createUser, authFunctions_deleteUserBy as deleteUserBy, authFunctions_forceLogoutForUserBy as forceLogoutForUserBy, authFunctions_hasRoleForUserBy as hasRoleForUserBy, authFunctions_initiatePasswordResetForUserBy as initiatePasswordResetForUserBy, authFunctions_register as register, authFunctions_removeRoleForUserBy as removeRoleForUserBy, authFunctions_resetPassword as resetPassword, authFunctions_setStatusForUserBy as setStatusForUserBy, authFunctions_userExistsByEmail as userExistsByEmail };
|
|
655
658
|
}
|
|
656
659
|
|
|
657
660
|
type UserIdentifier = {
|
|
@@ -1115,6 +1118,7 @@ declare class AuthManager implements AuthManager$1 {
|
|
|
1115
1118
|
email?: string;
|
|
1116
1119
|
userId?: string;
|
|
1117
1120
|
}, expiresAfter?: string | number | null, callback?: TokenCallback): Promise<void>;
|
|
1121
|
+
userExistsByEmail(email: string): Promise<boolean>;
|
|
1118
1122
|
forceLogoutForUserBy(identifier: {
|
|
1119
1123
|
accountId?: number;
|
|
1120
1124
|
email?: string;
|
|
@@ -1170,4 +1174,4 @@ declare class AzureProvider extends BaseOAuthProvider {
|
|
|
1170
1174
|
protected exchangeCodeForToken(code: string, tokenUrl: string): Promise<string>;
|
|
1171
1175
|
}
|
|
1172
1176
|
|
|
1173
|
-
export { ActivityLogger, type AuthAccount, type AuthActivity, AuthActivityAction, type AuthActivityActionType, type AuthConfig, type AuthConfirmation, type AuthContext, AuthError, type AuthManager$1 as AuthManager, type AuthProvider, type AuthRemember, type AuthReset, AuthRole, type AuthSession, AuthStatus, AzureProvider, type AzureProviderConfig, BaseOAuthProvider, ConfirmationExpiredError, ConfirmationNotFoundError, EmailNotVerifiedError, EmailTakenError, GitHubProvider, type GitHubProviderConfig, GoogleProvider, type GoogleProviderConfig, InvalidBackupCodeError, InvalidEmailError, InvalidPasswordError, InvalidTokenError, InvalidTwoFactorCodeError, type OAuthProvider, type OAuthProviderConfig, type OAuthUserData, OtpProvider, ResetDisabledError, ResetExpiredError, ResetNotFoundError, SecondFactorRequiredError, type TokenCallback, TooManyResetsError, TotpProvider, TwoFactorAlreadyEnabledError, type TwoFactorChallenge, TwoFactorExpiredError, TwoFactorManager, TwoFactorMechanism, type TwoFactorMethod, TwoFactorNotSetupError, TwoFactorSetupIncompleteError, type TwoFactorSetupResult, type TwoFactorToken, type UserIdentifier, UserInactiveError, UserNotFoundError, UserNotLoggedInError, addRoleForUserBy, addRoleToUser, authFunctions, changePasswordForUserBy, cleanupExpiredTokens, confirmResetPassword, createAuthContext, createAuthMiddleware, createAuthTables, createUser, deleteUserBy, dropAuthTables, forceLogoutForUserBy, getAuthTableStats, getUserRoles, hasRoleForUserBy, initiatePasswordResetForUserBy, isValidEmail, register, removeRoleForUserBy, removeRoleFromUser, resetPassword, setStatusForUserBy, setUserRoles, validateEmail };
|
|
1177
|
+
export { ActivityLogger, type AuthAccount, type AuthActivity, AuthActivityAction, type AuthActivityActionType, type AuthConfig, type AuthConfirmation, type AuthContext, AuthError, type AuthManager$1 as AuthManager, type AuthProvider, type AuthRemember, type AuthReset, AuthRole, type AuthSession, AuthStatus, AzureProvider, type AzureProviderConfig, BaseOAuthProvider, ConfirmationExpiredError, ConfirmationNotFoundError, EmailNotVerifiedError, EmailTakenError, GitHubProvider, type GitHubProviderConfig, GoogleProvider, type GoogleProviderConfig, InvalidBackupCodeError, InvalidEmailError, InvalidPasswordError, InvalidTokenError, InvalidTwoFactorCodeError, type OAuthProvider, type OAuthProviderConfig, type OAuthUserData, OtpProvider, ResetDisabledError, ResetExpiredError, ResetNotFoundError, SecondFactorRequiredError, type TokenCallback, TooManyResetsError, TotpProvider, TwoFactorAlreadyEnabledError, type TwoFactorChallenge, TwoFactorExpiredError, TwoFactorManager, TwoFactorMechanism, type TwoFactorMethod, TwoFactorNotSetupError, TwoFactorSetupIncompleteError, type TwoFactorSetupResult, type TwoFactorToken, type UserIdentifier, UserInactiveError, UserNotFoundError, UserNotLoggedInError, addRoleForUserBy, addRoleToUser, authFunctions, changePasswordForUserBy, cleanupExpiredTokens, confirmResetPassword, createAuthContext, createAuthMiddleware, createAuthTables, createUser, deleteUserBy, dropAuthTables, forceLogoutForUserBy, getAuthTableStats, getUserRoles, hasRoleForUserBy, initiatePasswordResetForUserBy, isValidEmail, register, removeRoleForUserBy, removeRoleFromUser, resetPassword, setStatusForUserBy, setUserRoles, userExistsByEmail, validateEmail };
|
package/dist/index.d.ts
CHANGED
|
@@ -575,6 +575,7 @@ interface AuthContext {
|
|
|
575
575
|
accountId: number;
|
|
576
576
|
email: string;
|
|
577
577
|
}>;
|
|
578
|
+
userExistsByEmail: (email: string) => Promise<boolean>;
|
|
578
579
|
forceLogoutForUserBy: (identifier: {
|
|
579
580
|
accountId?: number;
|
|
580
581
|
email?: string;
|
|
@@ -630,6 +631,7 @@ declare function confirmResetPassword(config: AuthConfig, token: string, passwor
|
|
|
630
631
|
accountId: number;
|
|
631
632
|
email: string;
|
|
632
633
|
}>;
|
|
634
|
+
declare function userExistsByEmail(config: AuthConfig, email: string): Promise<boolean>;
|
|
633
635
|
declare function forceLogoutForUserBy(config: AuthConfig, identifier: {
|
|
634
636
|
accountId?: number;
|
|
635
637
|
email?: string;
|
|
@@ -650,8 +652,9 @@ declare const authFunctions_register: typeof register;
|
|
|
650
652
|
declare const authFunctions_removeRoleForUserBy: typeof removeRoleForUserBy;
|
|
651
653
|
declare const authFunctions_resetPassword: typeof resetPassword;
|
|
652
654
|
declare const authFunctions_setStatusForUserBy: typeof setStatusForUserBy;
|
|
655
|
+
declare const authFunctions_userExistsByEmail: typeof userExistsByEmail;
|
|
653
656
|
declare namespace authFunctions {
|
|
654
|
-
export { authFunctions_addRoleForUserBy as addRoleForUserBy, authFunctions_changePasswordForUserBy as changePasswordForUserBy, authFunctions_confirmResetPassword as confirmResetPassword, authFunctions_createUser as createUser, authFunctions_deleteUserBy as deleteUserBy, authFunctions_forceLogoutForUserBy as forceLogoutForUserBy, authFunctions_hasRoleForUserBy as hasRoleForUserBy, authFunctions_initiatePasswordResetForUserBy as initiatePasswordResetForUserBy, authFunctions_register as register, authFunctions_removeRoleForUserBy as removeRoleForUserBy, authFunctions_resetPassword as resetPassword, authFunctions_setStatusForUserBy as setStatusForUserBy };
|
|
657
|
+
export { authFunctions_addRoleForUserBy as addRoleForUserBy, authFunctions_changePasswordForUserBy as changePasswordForUserBy, authFunctions_confirmResetPassword as confirmResetPassword, authFunctions_createUser as createUser, authFunctions_deleteUserBy as deleteUserBy, authFunctions_forceLogoutForUserBy as forceLogoutForUserBy, authFunctions_hasRoleForUserBy as hasRoleForUserBy, authFunctions_initiatePasswordResetForUserBy as initiatePasswordResetForUserBy, authFunctions_register as register, authFunctions_removeRoleForUserBy as removeRoleForUserBy, authFunctions_resetPassword as resetPassword, authFunctions_setStatusForUserBy as setStatusForUserBy, authFunctions_userExistsByEmail as userExistsByEmail };
|
|
655
658
|
}
|
|
656
659
|
|
|
657
660
|
type UserIdentifier = {
|
|
@@ -1115,6 +1118,7 @@ declare class AuthManager implements AuthManager$1 {
|
|
|
1115
1118
|
email?: string;
|
|
1116
1119
|
userId?: string;
|
|
1117
1120
|
}, expiresAfter?: string | number | null, callback?: TokenCallback): Promise<void>;
|
|
1121
|
+
userExistsByEmail(email: string): Promise<boolean>;
|
|
1118
1122
|
forceLogoutForUserBy(identifier: {
|
|
1119
1123
|
accountId?: number;
|
|
1120
1124
|
email?: string;
|
|
@@ -1170,4 +1174,4 @@ declare class AzureProvider extends BaseOAuthProvider {
|
|
|
1170
1174
|
protected exchangeCodeForToken(code: string, tokenUrl: string): Promise<string>;
|
|
1171
1175
|
}
|
|
1172
1176
|
|
|
1173
|
-
export { ActivityLogger, type AuthAccount, type AuthActivity, AuthActivityAction, type AuthActivityActionType, type AuthConfig, type AuthConfirmation, type AuthContext, AuthError, type AuthManager$1 as AuthManager, type AuthProvider, type AuthRemember, type AuthReset, AuthRole, type AuthSession, AuthStatus, AzureProvider, type AzureProviderConfig, BaseOAuthProvider, ConfirmationExpiredError, ConfirmationNotFoundError, EmailNotVerifiedError, EmailTakenError, GitHubProvider, type GitHubProviderConfig, GoogleProvider, type GoogleProviderConfig, InvalidBackupCodeError, InvalidEmailError, InvalidPasswordError, InvalidTokenError, InvalidTwoFactorCodeError, type OAuthProvider, type OAuthProviderConfig, type OAuthUserData, OtpProvider, ResetDisabledError, ResetExpiredError, ResetNotFoundError, SecondFactorRequiredError, type TokenCallback, TooManyResetsError, TotpProvider, TwoFactorAlreadyEnabledError, type TwoFactorChallenge, TwoFactorExpiredError, TwoFactorManager, TwoFactorMechanism, type TwoFactorMethod, TwoFactorNotSetupError, TwoFactorSetupIncompleteError, type TwoFactorSetupResult, type TwoFactorToken, type UserIdentifier, UserInactiveError, UserNotFoundError, UserNotLoggedInError, addRoleForUserBy, addRoleToUser, authFunctions, changePasswordForUserBy, cleanupExpiredTokens, confirmResetPassword, createAuthContext, createAuthMiddleware, createAuthTables, createUser, deleteUserBy, dropAuthTables, forceLogoutForUserBy, getAuthTableStats, getUserRoles, hasRoleForUserBy, initiatePasswordResetForUserBy, isValidEmail, register, removeRoleForUserBy, removeRoleFromUser, resetPassword, setStatusForUserBy, setUserRoles, validateEmail };
|
|
1177
|
+
export { ActivityLogger, type AuthAccount, type AuthActivity, AuthActivityAction, type AuthActivityActionType, type AuthConfig, type AuthConfirmation, type AuthContext, AuthError, type AuthManager$1 as AuthManager, type AuthProvider, type AuthRemember, type AuthReset, AuthRole, type AuthSession, AuthStatus, AzureProvider, type AzureProviderConfig, BaseOAuthProvider, ConfirmationExpiredError, ConfirmationNotFoundError, EmailNotVerifiedError, EmailTakenError, GitHubProvider, type GitHubProviderConfig, GoogleProvider, type GoogleProviderConfig, InvalidBackupCodeError, InvalidEmailError, InvalidPasswordError, InvalidTokenError, InvalidTwoFactorCodeError, type OAuthProvider, type OAuthProviderConfig, type OAuthUserData, OtpProvider, ResetDisabledError, ResetExpiredError, ResetNotFoundError, SecondFactorRequiredError, type TokenCallback, TooManyResetsError, TotpProvider, TwoFactorAlreadyEnabledError, type TwoFactorChallenge, TwoFactorExpiredError, TwoFactorManager, TwoFactorMechanism, type TwoFactorMethod, TwoFactorNotSetupError, TwoFactorSetupIncompleteError, type TwoFactorSetupResult, type TwoFactorToken, type UserIdentifier, UserInactiveError, UserNotFoundError, UserNotLoggedInError, addRoleForUserBy, addRoleToUser, authFunctions, changePasswordForUserBy, cleanupExpiredTokens, confirmResetPassword, createAuthContext, createAuthMiddleware, createAuthTables, createUser, deleteUserBy, dropAuthTables, forceLogoutForUserBy, getAuthTableStats, getUserRoles, hasRoleForUserBy, initiatePasswordResetForUserBy, isValidEmail, register, removeRoleForUserBy, removeRoleFromUser, resetPassword, setStatusForUserBy, setUserRoles, userExistsByEmail, validateEmail };
|
package/dist/index.js
CHANGED
|
@@ -1380,7 +1380,8 @@ __export(auth_functions_exports, {
|
|
|
1380
1380
|
register: () => register,
|
|
1381
1381
|
removeRoleForUserBy: () => removeRoleForUserBy,
|
|
1382
1382
|
resetPassword: () => resetPassword,
|
|
1383
|
-
setStatusForUserBy: () => setStatusForUserBy
|
|
1383
|
+
setStatusForUserBy: () => setStatusForUserBy,
|
|
1384
|
+
userExistsByEmail: () => userExistsByEmail
|
|
1384
1385
|
});
|
|
1385
1386
|
import { hash as hash3 } from "@prsm/hash";
|
|
1386
1387
|
import ms2 from "@prsm/ms";
|
|
@@ -1598,6 +1599,12 @@ async function confirmResetPassword(config, token, password) {
|
|
|
1598
1599
|
await queries.deleteResetToken(token);
|
|
1599
1600
|
return { accountId: account.id, email: account.email };
|
|
1600
1601
|
}
|
|
1602
|
+
async function userExistsByEmail(config, email) {
|
|
1603
|
+
validateEmail(email);
|
|
1604
|
+
const queries = new AuthQueries(config);
|
|
1605
|
+
const account = await queries.findAccountByEmail(email);
|
|
1606
|
+
return account !== null;
|
|
1607
|
+
}
|
|
1601
1608
|
async function forceLogoutForUserBy(config, identifier) {
|
|
1602
1609
|
const queries = new AuthQueries(config);
|
|
1603
1610
|
const account = await findAccountByIdentifier(queries, identifier);
|
|
@@ -2344,6 +2351,9 @@ var AuthManager = class {
|
|
|
2344
2351
|
async initiatePasswordResetForUserBy(identifier, expiresAfter, callback) {
|
|
2345
2352
|
return initiatePasswordResetForUserBy(this.config, identifier, expiresAfter, callback);
|
|
2346
2353
|
}
|
|
2354
|
+
async userExistsByEmail(email) {
|
|
2355
|
+
return userExistsByEmail(this.config, email);
|
|
2356
|
+
}
|
|
2347
2357
|
async forceLogoutForUserBy(identifier) {
|
|
2348
2358
|
const result = await forceLogoutForUserBy(this.config, identifier);
|
|
2349
2359
|
if (this.getId() === result.accountId) {
|
|
@@ -2594,6 +2604,7 @@ function createAuthContext(config) {
|
|
|
2594
2604
|
initiatePasswordResetForUserBy: (identifier, expiresAfter, callback) => initiatePasswordResetForUserBy(config, identifier, expiresAfter, callback),
|
|
2595
2605
|
resetPassword: (email, expiresAfter, maxOpenRequests, callback) => resetPassword(config, email, expiresAfter, maxOpenRequests, callback),
|
|
2596
2606
|
confirmResetPassword: (token, password) => confirmResetPassword(config, token, password),
|
|
2607
|
+
userExistsByEmail: (email) => userExistsByEmail(config, email),
|
|
2597
2608
|
forceLogoutForUserBy: (identifier) => forceLogoutForUserBy(config, identifier)
|
|
2598
2609
|
};
|
|
2599
2610
|
}
|
|
@@ -2694,6 +2705,7 @@ export {
|
|
|
2694
2705
|
resetPassword,
|
|
2695
2706
|
setStatusForUserBy,
|
|
2696
2707
|
setUserRoles,
|
|
2708
|
+
userExistsByEmail,
|
|
2697
2709
|
validateEmail
|
|
2698
2710
|
};
|
|
2699
2711
|
//# sourceMappingURL=index.js.map
|