edmaxlabs-core 2.5.0 → 2.5.2

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.d.cts CHANGED
@@ -45,6 +45,7 @@ interface DisplayInfo {
45
45
  declare class Credentials {
46
46
  uid: string;
47
47
  displayInfo: DisplayInfo;
48
+ logged: boolean;
48
49
  createdAt: Timestamp;
49
50
  updatedAt: Timestamp;
50
51
  lastLogged: Timestamp;
@@ -53,25 +54,23 @@ declare class Credentials {
53
54
  toMap(): Record<string, any>;
54
55
  }
55
56
 
57
+ type Listener<T = any> = (value: T) => void;
56
58
  declare class Authentication {
57
59
  static instance: Authentication | null;
58
- private eUser;
59
- private client;
60
- private app;
60
+ private eUser?;
61
+ private client?;
62
+ private app?;
61
63
  private eventListeners;
62
- private isHandlingChange;
64
+ private eventWaiters;
65
+ private unsubscribers;
63
66
  constructor();
67
+ private isSameCredentials;
68
+ private restoreSession;
64
69
  static getInstance(): Authentication;
65
- private emitValue;
66
- private onValue;
70
+ emitValue<T>(key: string, value: T): void;
71
+ onValue<T>(key: string, callback: Listener<T>): () => void;
67
72
  currentUser(): Credentials | null;
68
73
  private saveCredentials;
69
- private isSameCredentials;
70
- private restoreSession;
71
- /**
72
- * Main method to listen to authentication state changes.
73
- * This listener stays alive for the entire app lifetime.
74
- */
75
74
  authState({ onChange, onSignOut, onDeleted, }: {
76
75
  onChange: (user: Credentials) => void;
77
76
  onSignOut?: () => void;
@@ -85,8 +84,8 @@ declare class Authentication {
85
84
  email: string;
86
85
  password: string;
87
86
  }) => Promise<Credentials | null>;
88
- signOut: () => Promise<void>;
89
87
  deleteUser: () => Promise<void>;
88
+ signOut: () => Promise<void>;
90
89
  rules: (path: string, context: Record<string, any>) => Promise<{
91
90
  success: boolean;
92
91
  allowed: any;
@@ -108,10 +107,11 @@ declare class DocumentRef {
108
107
  private persistence;
109
108
  private syncEngine;
110
109
  private localStore;
110
+ private _isUpdating;
111
111
  constructor(app: EdmaxLabs, collection: string, id: string);
112
112
  get(): Promise<DocumentSnapshot | null>;
113
- set(data: Record<string, any>): Promise<DocumentSnapshot | null>;
114
113
  update(data: Record<string, any>): Promise<DocumentSnapshot | null>;
114
+ set(data: Record<string, any>): Promise<DocumentSnapshot | null>;
115
115
  delete(): Promise<boolean>;
116
116
  onSnapshot(callback: (snapshot: DocumentSnapshot | null, change: string) => void): () => void;
117
117
  }
package/dist/index.d.ts CHANGED
@@ -45,6 +45,7 @@ interface DisplayInfo {
45
45
  declare class Credentials {
46
46
  uid: string;
47
47
  displayInfo: DisplayInfo;
48
+ logged: boolean;
48
49
  createdAt: Timestamp;
49
50
  updatedAt: Timestamp;
50
51
  lastLogged: Timestamp;
@@ -53,25 +54,23 @@ declare class Credentials {
53
54
  toMap(): Record<string, any>;
54
55
  }
55
56
 
57
+ type Listener<T = any> = (value: T) => void;
56
58
  declare class Authentication {
57
59
  static instance: Authentication | null;
58
- private eUser;
59
- private client;
60
- private app;
60
+ private eUser?;
61
+ private client?;
62
+ private app?;
61
63
  private eventListeners;
62
- private isHandlingChange;
64
+ private eventWaiters;
65
+ private unsubscribers;
63
66
  constructor();
67
+ private isSameCredentials;
68
+ private restoreSession;
64
69
  static getInstance(): Authentication;
65
- private emitValue;
66
- private onValue;
70
+ emitValue<T>(key: string, value: T): void;
71
+ onValue<T>(key: string, callback: Listener<T>): () => void;
67
72
  currentUser(): Credentials | null;
68
73
  private saveCredentials;
69
- private isSameCredentials;
70
- private restoreSession;
71
- /**
72
- * Main method to listen to authentication state changes.
73
- * This listener stays alive for the entire app lifetime.
74
- */
75
74
  authState({ onChange, onSignOut, onDeleted, }: {
76
75
  onChange: (user: Credentials) => void;
77
76
  onSignOut?: () => void;
@@ -85,8 +84,8 @@ declare class Authentication {
85
84
  email: string;
86
85
  password: string;
87
86
  }) => Promise<Credentials | null>;
88
- signOut: () => Promise<void>;
89
87
  deleteUser: () => Promise<void>;
88
+ signOut: () => Promise<void>;
90
89
  rules: (path: string, context: Record<string, any>) => Promise<{
91
90
  success: boolean;
92
91
  allowed: any;
@@ -108,10 +107,11 @@ declare class DocumentRef {
108
107
  private persistence;
109
108
  private syncEngine;
110
109
  private localStore;
110
+ private _isUpdating;
111
111
  constructor(app: EdmaxLabs, collection: string, id: string);
112
112
  get(): Promise<DocumentSnapshot | null>;
113
- set(data: Record<string, any>): Promise<DocumentSnapshot | null>;
114
113
  update(data: Record<string, any>): Promise<DocumentSnapshot | null>;
114
+ set(data: Record<string, any>): Promise<DocumentSnapshot | null>;
115
115
  delete(): Promise<boolean>;
116
116
  onSnapshot(callback: (snapshot: DocumentSnapshot | null, change: string) => void): () => void;
117
117
  }