entropic-bond 1.59.3 → 1.59.5

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/README.md CHANGED
@@ -19,7 +19,7 @@ Typically, you will derive all your business logic entities from the `EntropicCo
19
19
 
20
20
  ### API
21
21
 
22
- You can find the API documentation [here](docs/modules.md).
22
+ You can find the API documentation in the docs/ directory.
23
23
 
24
24
  ### Persistence
25
25
 
@@ -45,7 +45,7 @@ class MyEntity extends EntropicBond {
45
45
 
46
46
  #### Storing and querying the persistent entities
47
47
 
48
- The database abstraction is provided by the `Store` object. To learn how to set up a concrete database, [see below](setup_the_database_access).
48
+ The database abstraction is provided by the `Store` object.
49
49
 
50
50
  The `Store.getModel` method will return an object with methods to access the database.
51
51
 
@@ -80,7 +80,7 @@ Currently, there is an official plugin to connect to a **Firebase** _Firestore_
80
80
  npm i entropic-bond-firebase
81
81
  ```
82
82
 
83
- You can develop new plugins following the [plugin developer's](plugin_development) section.
83
+ You can develop new plugins following the plugin developer's section.
84
84
 
85
85
  You should instantiate the concrete implementation of the `DataSource` and pass it to the `useDataSource` method of the `Store` object.
86
86
 
@@ -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;
@@ -1,5 +1,5 @@
1
1
  import { CloudFunction, CloudFunctionsService } from './cloud-functions';
2
- interface FunctionCollection {
2
+ export interface FunctionCollection {
3
3
  [key: string]: CloudFunction<any, any>;
4
4
  }
5
5
  export declare class CloudFunctionsMock implements CloudFunctionsService {
@@ -8,4 +8,3 @@ export declare class CloudFunctionsMock implements CloudFunctionsService {
8
8
  callFunction<P, R>(func: CloudFunction<P, R>, params: P): Promise<R>;
9
9
  private _registeredFunctions;
10
10
  }
11
- export {};
@@ -1,5 +1,5 @@
1
1
  export type UploadProgress = (uploadedBytes: number, fileSize: number) => void;
2
- type CloudStorageFactory = () => CloudStorage;
2
+ export type CloudStorageFactory = () => CloudStorage;
3
3
  export interface UploadControl {
4
4
  pause: () => void;
5
5
  resume: () => void;
@@ -21,4 +21,3 @@ export declare abstract class CloudStorage {
21
21
  private static _cloudStorageFactoryMap;
22
22
  }
23
23
  export declare function registerCloudStorage(cloudStorageProviderName: string, factory: CloudStorageFactory): (constructor: Function) => void;
24
- export {};
@@ -338,12 +338,12 @@ var S = class extends c {
338
338
  this._onChange.notify(e);
339
339
  }
340
340
  pushAndNotify(e, t, n) {
341
- let r = "_" + String(e);
342
- if (!(n && this[r].find((e) => !n(e, t)))) return this[r].push(t), this.notify({ [e]: this[e] }), t;
341
+ let r = "_" + String(e), i = this[r];
342
+ if (!(n && i.find((e) => !n(e, t)))) return i.push(t), this.notify({ [e]: this[e] }), t;
343
343
  }
344
344
  removeAndNotify(e, t, n) {
345
- let r = "_" + String(e), i = this[r].length;
346
- if (this[r] = this[r].filter((e) => !n(e, t)), i !== this[r].length) return this.notify({ [e]: this[e] }), t;
345
+ let r = "_" + String(e), i = this[r], a = i.length, o = i.filter((e) => !n(e, t)), s = this;
346
+ if (s[r] = o, a !== o.length) return this.notify({ [e]: this[e] }), t;
347
347
  }
348
348
  }, C = class e {
349
349
  static {
@@ -797,7 +797,10 @@ var S = class extends c {
797
797
  return {
798
798
  limit: (t) => e,
799
799
  operations: (t) => this.retrieveQueryDocs(e, t),
800
- sort: ({ order: t, propertyName: n }) => e.sort((e, r) => t === "asc" ? this.deepValue(e, n) > this.deepValue(r, n) ? 1 : -1 : this.deepValue(e, n) < this.deepValue(r, n) ? 1 : -1)
800
+ sort: ({ order: t, propertyName: n }) => e.sort((e, r) => {
801
+ let i = this.deepValue(e, n), a = this.deepValue(r, n);
802
+ return t === "asc" ? i > a ? 1 : -1 : i < a ? 1 : -1;
803
+ })
801
804
  }[t](n);
802
805
  }
803
806
  retrieveQueryDocs(e, t) {
@@ -1209,6 +1212,6 @@ function G(e, t) {
1209
1212
  return t.split(".").reduce((e, t) => e[t], e);
1210
1213
  }
1211
1214
  //#endregion
1212
- export { F as Auth, I as AuthMock, P as AuthService, L as CloudFunctions, R as CloudFunctionsMock, k as CloudStorage, D as DataSource, S as EntropicComponent, O as JsonDataSource, j as MockCloudStorage, C as Model, e as Observable, c as Persistent, w as Query, B as ServerAuth, V as ServerAuthMock, z as ServerAuthService, T as Store, N as StoredFile, M as StoredFileEvent, U as camelCase, G as getDeepValue, l as persistent, h as persistentParser, p as persistentPureReference, m as persistentPureReferenceWithCachedProps, d as persistentReference, u as persistentReferenceAt, f as persistentReferenceWithCachedProps, A as registerCloudStorage, _ as registerLegacyClassName, g as registerPersistentClass, H as replaceValue, y as required, b as requiredWithValidator, v as searchableArray, W as snakeCase, x as typeName };
1215
+ export { F as Auth, I as AuthMock, P as AuthService, E as CachedPropsUpdater, L as CloudFunctions, R as CloudFunctionsMock, k as CloudStorage, D as DataSource, S as EntropicComponent, O as JsonDataSource, j as MockCloudStorage, C as Model, e as Observable, c as Persistent, w as Query, B as ServerAuth, V as ServerAuthMock, z as ServerAuthService, T as Store, N as StoredFile, M as StoredFileEvent, U as camelCase, G as getDeepValue, l as persistent, h as persistentParser, p as persistentPureReference, m as persistentPureReferenceWithCachedProps, d as persistentReference, u as persistentReferenceAt, f as persistentReferenceWithCachedProps, A as registerCloudStorage, _ as registerLegacyClassName, g as registerPersistentClass, H as replaceValue, y as required, b as requiredWithValidator, v as searchableArray, W as snakeCase, x as typeName };
1213
1216
 
1214
1217
  //# sourceMappingURL=entropic-bond.js.map