entropic-bond 1.59.2 → 1.59.4

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.
@@ -1,10 +1,10 @@
1
1
  import { Collection } from '../types/utility-types';
2
2
  import { AuthService } from './auth';
3
- import { UserCredentials, SignData, AuthProvider } from './user-auth-types';
3
+ import { UserCredentials, SignData, AuthProvider, CredentialsCustomData } from './user-auth-types';
4
4
  export declare class AuthMock extends AuthService {
5
- signUp<T extends {}>(signData: SignData): Promise<UserCredentials<T>>;
6
- login<T extends {}>(signData: SignData): Promise<UserCredentials<T>>;
7
- onAuthStateChange<T extends {}>(onChange: (userCredentials: UserCredentials<T>) => void): void;
5
+ signUp<T extends CredentialsCustomData>(signData: SignData): Promise<UserCredentials<T>>;
6
+ login<T extends CredentialsCustomData>(signData: SignData): Promise<UserCredentials<T>>;
7
+ onAuthStateChange<T extends CredentialsCustomData>(onChange: (userCredentials: UserCredentials<T>) => void): void;
8
8
  logout(): Promise<void>;
9
9
  resetEmailPassword(email: string): Promise<void>;
10
10
  resendVerificationEmail(email: string, _password: string, _verificationLink: string): Promise<void>;
@@ -12,8 +12,8 @@ export declare class AuthMock extends AuthService {
12
12
  linkAdditionalProvider(provider: AuthProvider): Promise<unknown>;
13
13
  unlinkProvider(provider: AuthProvider): Promise<unknown>;
14
14
  flush(): Promise<void>;
15
- fakeRegisteredUser<T extends {}>(userCredentials: UserCredentials<T>): this;
16
- get fakeRegisteredUsers(): Collection<UserCredentials<{}>>;
15
+ fakeRegisteredUser<T extends CredentialsCustomData>(userCredentials: UserCredentials<T>): this;
16
+ get fakeRegisteredUsers(): Collection<UserCredentials<CredentialsCustomData>>;
17
17
  private userCredentials;
18
18
  private pendingPromises;
19
19
  private _loggedUser;
@@ -1,17 +1,17 @@
1
- import { AuthProvider, SignData, UserCredentials } from './user-auth-types';
1
+ import { AuthProvider, CredentialsCustomData, SignData, UserCredentials } from './user-auth-types';
2
2
  /**
3
3
  * The AuthService class is an abstract class that defines the interface of an authentication service.
4
4
  * You should derive from this class to implement your own authentication service.
5
5
  */
6
6
  export declare abstract class AuthService {
7
- abstract signUp<T extends {}>(signData: SignData): Promise<UserCredentials<T>>;
8
- abstract login<T extends {}>(signData: SignData): Promise<UserCredentials<T>>;
7
+ abstract signUp<T extends CredentialsCustomData>(signData: SignData): Promise<UserCredentials<T>>;
8
+ abstract login<T extends CredentialsCustomData>(signData: SignData): Promise<UserCredentials<T>>;
9
9
  abstract logout(): Promise<void>;
10
10
  abstract resetEmailPassword(email: string): Promise<void>;
11
11
  abstract refreshToken(): Promise<void>;
12
12
  abstract linkAdditionalProvider(provider: AuthProvider): Promise<unknown>;
13
13
  abstract unlinkProvider(provider: AuthProvider): Promise<unknown>;
14
- abstract onAuthStateChange<T extends {}>(onChange: (userCredentials: UserCredentials<T> | undefined) => void): void;
14
+ abstract onAuthStateChange<T extends CredentialsCustomData>(onChange: (userCredentials: UserCredentials<T> | undefined) => void): void;
15
15
  abstract resendVerificationEmail(email: string, password: string, verificationLink: string): Promise<void>;
16
16
  }
17
17
  export type AuthErrorCode = 'wrongPassword' | 'popupClosedByUser' | 'userNotFound' | 'invalidEmail' | 'missingPassword' | 'missingEmail';
@@ -22,7 +22,7 @@ export interface AuthError {
22
22
  /**
23
23
  * Types the callback to accept a user credentials object
24
24
  */
25
- export type ResovedCallback<T extends {}> = (credentials: UserCredentials<T>) => void;
25
+ export type ResovedCallback<T extends CredentialsCustomData> = (credentials: UserCredentials<T>) => void;
26
26
  export type RejectedCallback = (reason: AuthError) => void;
27
27
  /**
28
28
  * The Auth class is a singleton that provides a unified interface to the authentication service.
@@ -55,7 +55,7 @@ export declare class Auth extends AuthService {
55
55
  * // Sign up a new user with a Google account
56
56
  * Auth.instance.signUp({ authProvider: 'google'})
57
57
  */
58
- signUp<T extends {}>(singData: SignData): Promise<UserCredentials<T>>;
58
+ signUp<T extends CredentialsCustomData>(singData: SignData): Promise<UserCredentials<T>>;
59
59
  /**
60
60
  * Logs in an existing user
61
61
  * @param singData the data to be used to log in the user
@@ -66,7 +66,7 @@ export declare class Auth extends AuthService {
66
66
  * // Log in an existing user with a Google account
67
67
  * Auth.instance.login({ authProvider: 'google'})
68
68
  */
69
- login<T extends {}>(singData: SignData): Promise<UserCredentials<T>>;
69
+ login<T extends CredentialsCustomData>(singData: SignData): Promise<UserCredentials<T>>;
70
70
  /**
71
71
  * Logs out the current user
72
72
  * @returns a promise that resolves when the user is logged out
@@ -100,12 +100,12 @@ export declare class Auth extends AuthService {
100
100
  * }
101
101
  * })
102
102
  */
103
- onAuthStateChange<T extends {}>(onChange: (userCredentials: UserCredentials<T>) => void): import('..').Unsubscriber;
103
+ onAuthStateChange<T extends CredentialsCustomData>(onChange: (userCredentials: UserCredentials<T>) => void): import('..').Unsubscriber;
104
104
  /**
105
105
  * Removes a listener that was added by `onAuthStateChange` method.
106
106
  * @param onChange the listener to be removed
107
107
  */
108
- removeAuthStateChange<T extends {}>(onChange: (userCredentials: UserCredentials<T>) => void): void;
108
+ removeAuthStateChange<T extends CredentialsCustomData>(onChange: (userCredentials: UserCredentials<T>) => void): void;
109
109
  /**
110
110
  * Links an additional authentication provider to the authenticated user.
111
111
  * @param provider the provider to be linked
@@ -1,4 +1,7 @@
1
- export interface UserCredentials<T extends {} = {}> {
1
+ export interface CredentialsCustomData {
2
+ [key: string]: any;
3
+ }
4
+ export interface UserCredentials<T extends CredentialsCustomData = {}> {
2
5
  id: string;
3
6
  email: string;
4
7
  name?: string;