entropic-bond 1.39.0 → 1.39.1
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 +5 -0
- package/lib/auth/auth.d.ts +86 -0
- package/lib/auth/auth.js +84 -1
- package/lib/auth/auth.js.map +1 -1
- package/lib/cloud-functions/cloud-functions.js +1 -1
- package/lib/cloud-functions/cloud-functions.js.map +1 -1
- package/lib/cloud-storage/cloud-storage.js +1 -1
- package/lib/cloud-storage/cloud-storage.js.map +1 -1
- package/lib/cloud-storage/cloud-storage.spec.js.map +1 -1
- package/lib/cloud-storage/mock-cloud-storage.js.map +1 -1
- package/lib/cloud-storage/stored-file.js.map +1 -1
- package/lib/observable/observable.d.ts +15 -0
- package/lib/observable/observable.js +15 -0
- package/lib/observable/observable.js.map +1 -1
- package/lib/persistent/persistent.d.ts +64 -0
- package/lib/persistent/persistent.js +51 -0
- package/lib/persistent/persistent.js.map +1 -1
- package/lib/persistent/persistent.spec.js.map +1 -1
- package/lib/server-auth/server-auth.js +1 -1
- package/lib/server-auth/server-auth.js.map +1 -1
- package/lib/store/data-source.d.ts +101 -1
- package/lib/store/data-source.js +19 -0
- package/lib/store/data-source.js.map +1 -1
- package/lib/store/json-data-source.d.ts +26 -0
- package/lib/store/json-data-source.js +26 -0
- package/lib/store/json-data-source.js.map +1 -1
- package/lib/store/mocks/test-user.js.map +1 -1
- package/lib/store/model.d.ts +74 -1
- package/lib/store/model.js +81 -4
- package/lib/store/model.js.map +1 -1
- package/lib/store/model.spec.js +0 -7
- package/lib/store/model.spec.js.map +1 -1
- package/lib/store/store.d.ts +34 -0
- package/lib/store/store.js +35 -1
- package/lib/store/store.js.map +1 -1
- package/lib/utils/utils.d.ts +23 -0
- package/lib/utils/utils.js +18 -0
- package/lib/utils/utils.js.map +1 -1
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -14,8 +14,13 @@
|
|
|
14
14
|
|
|
15
15
|
## How to use
|
|
16
16
|
|
|
17
|
+
|
|
17
18
|
Typically, you will derive all your business logic entities from the `EntropicComponent` class. This class provides two main functionalities; persistence and observability.
|
|
18
19
|
|
|
20
|
+
### API
|
|
21
|
+
|
|
22
|
+
You can find the API documentation [here](docs/modules.md).
|
|
23
|
+
|
|
19
24
|
### Persistence
|
|
20
25
|
|
|
21
26
|
The persistence mechanism allows defining which entities and which properties of those entities should be stored in the database. To make an entity persistent, it should derive from the `EntropicComponent` class or the `Persistent` class.
|
package/lib/auth/auth.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { AuthProvider, SignData, UserCredentials } from "./user-auth-types";
|
|
2
|
+
/**
|
|
3
|
+
* The AuthService class is an abstract class that defines the interface of an authentication service.
|
|
4
|
+
* You should derive from this class to implement your own authentication service.
|
|
5
|
+
*/
|
|
2
6
|
export declare abstract class AuthService {
|
|
3
7
|
abstract signUp<T extends {}>(signData: SignData): Promise<UserCredentials<T>>;
|
|
4
8
|
abstract login<T extends {}>(signData: SignData): Promise<UserCredentials<T>>;
|
|
@@ -13,22 +17,104 @@ export interface AuthError {
|
|
|
13
17
|
code: AuthErrorCode;
|
|
14
18
|
message: string;
|
|
15
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Types the callback to accept a user credentials object
|
|
22
|
+
*/
|
|
16
23
|
export type ResovedCallback<T extends {}> = (credentials: UserCredentials<T>) => void;
|
|
17
24
|
export type RejectedCallback = (reason: AuthError) => void;
|
|
25
|
+
/**
|
|
26
|
+
* The Auth class is a singleton that provides a unified interface to the authentication service.
|
|
27
|
+
* You should register an authentication service by using `Auth.useAuthService`
|
|
28
|
+
* method before using the Auth class.
|
|
29
|
+
*/
|
|
18
30
|
export declare class Auth extends AuthService {
|
|
19
31
|
static error: {
|
|
20
32
|
shouldBeRegistered: string;
|
|
21
33
|
};
|
|
22
34
|
protected constructor();
|
|
35
|
+
/**
|
|
36
|
+
* Registers an authentication service to be used by the Auth class.
|
|
37
|
+
* You need to register an authentication service before using the Auth class.
|
|
38
|
+
* @param authService the authentication service to be used by the Auth class
|
|
39
|
+
*/
|
|
23
40
|
static useAuthService(authService: AuthService): void;
|
|
41
|
+
/**
|
|
42
|
+
* The instance of the Auth class
|
|
43
|
+
* @returns the authentication service
|
|
44
|
+
*/
|
|
24
45
|
static get instance(): Auth;
|
|
46
|
+
/**
|
|
47
|
+
* Signs up a new user
|
|
48
|
+
* @param singData the data to be used to sign up the user
|
|
49
|
+
* @returns a promise that resolves to the user credentials
|
|
50
|
+
* @example
|
|
51
|
+
* // Sign up a new user with email and password
|
|
52
|
+
* Auth.instance.signUp({ authProvider: 'email', email: 'john@test.com', password: '123456' })
|
|
53
|
+
* // Sign up a new user with a Google account
|
|
54
|
+
* Auth.instance.signUp({ authProvider: 'google'})
|
|
55
|
+
*/
|
|
25
56
|
signUp<T extends {}>(singData: SignData): Promise<UserCredentials<T>>;
|
|
57
|
+
/**
|
|
58
|
+
* Logs in an existing user
|
|
59
|
+
* @param singData the data to be used to log in the user
|
|
60
|
+
* @returns a promise that resolves to the user credentials
|
|
61
|
+
* @example
|
|
62
|
+
* // Log in an existing user with email and password
|
|
63
|
+
* Auth.instance.login({ authProvider: 'email', email: 'john@test.com', password: '123456' })
|
|
64
|
+
* // Log in an existing user with a Google account
|
|
65
|
+
* Auth.instance.login({ authProvider: 'google'})
|
|
66
|
+
*/
|
|
26
67
|
login<T extends {}>(singData: SignData): Promise<UserCredentials<T>>;
|
|
68
|
+
/**
|
|
69
|
+
* Logs out the current user
|
|
70
|
+
* @returns a promise that resolves when the user is logged out
|
|
71
|
+
*/
|
|
27
72
|
logout(): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Resets the password associated with the email.
|
|
75
|
+
* @param email the email address of the user to reset the password
|
|
76
|
+
* @returns a promise that resolves when the process is done
|
|
77
|
+
*/
|
|
28
78
|
resetEmailPassword(email: string): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Adds a listener to be called when the authentication state changes.
|
|
81
|
+
* @param onChange the listener to be called when the authentication state changes.
|
|
82
|
+
* The listener is called with the user credentials as a parameter.
|
|
83
|
+
* If the user is logged out, the listener is called with `undefined` as a parameter.
|
|
84
|
+
* @returns a function to remove the listener
|
|
85
|
+
* @example
|
|
86
|
+
* // Add a listener to be called when the authentication state changes
|
|
87
|
+
* const removeListener = Auth.instance.onAuthStateChange( userCredentials => {
|
|
88
|
+
* if ( userCredentials ) {
|
|
89
|
+
* // The user is logged in
|
|
90
|
+
* } else {
|
|
91
|
+
* // The user is logged out
|
|
92
|
+
* }
|
|
93
|
+
* })
|
|
94
|
+
*/
|
|
29
95
|
onAuthStateChange<T extends {}>(onChange: (userCredentials: UserCredentials<T>) => void): import("../observable/observable").Unsubscriber;
|
|
96
|
+
/**
|
|
97
|
+
* Removes a listener that was added by `onAuthStateChange` method.
|
|
98
|
+
* @param onChange the listener to be removed
|
|
99
|
+
*/
|
|
30
100
|
removeAuthStateChange<T extends {}>(onChange: (userCredentials: UserCredentials<T>) => void): void;
|
|
101
|
+
/**
|
|
102
|
+
* Links an additional authentication provider to the authenticated user.
|
|
103
|
+
* @param provider the provider to be linked
|
|
104
|
+
* @returns a promise that resolves when the process is done
|
|
105
|
+
* @example
|
|
106
|
+
* // Link a Google account to the auth service
|
|
107
|
+
* Auth.instance.linkAdditionalProvider({ authProvider: 'google' })
|
|
108
|
+
*/
|
|
31
109
|
linkAdditionalProvider(provider: AuthProvider): Promise<unknown>;
|
|
110
|
+
/**
|
|
111
|
+
* Unlinks an authentication provider from the authenticated user.
|
|
112
|
+
* @param provider the provider to be unlinked
|
|
113
|
+
* @returns a promise that resolves when the process is done
|
|
114
|
+
* @example
|
|
115
|
+
* // Unlink the Google account from the auth service
|
|
116
|
+
* Auth.instance.unlinkProvider({ authProvider: 'google' })
|
|
117
|
+
*/
|
|
32
118
|
unlinkProvider(provider: AuthProvider): Promise<unknown>;
|
|
33
119
|
private authStateChanged;
|
|
34
120
|
private static _instance;
|
package/lib/auth/auth.js
CHANGED
|
@@ -2,9 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Auth = exports.AuthService = void 0;
|
|
4
4
|
const observable_1 = require("../observable/observable");
|
|
5
|
+
/**
|
|
6
|
+
* The AuthService class is an abstract class that defines the interface of an authentication service.
|
|
7
|
+
* You should derive from this class to implement your own authentication service.
|
|
8
|
+
*/
|
|
5
9
|
class AuthService {
|
|
6
10
|
}
|
|
7
11
|
exports.AuthService = AuthService;
|
|
12
|
+
/**
|
|
13
|
+
* The Auth class is a singleton that provides a unified interface to the authentication service.
|
|
14
|
+
* You should register an authentication service by using `Auth.useAuthService`
|
|
15
|
+
* method before using the Auth class.
|
|
16
|
+
*/
|
|
8
17
|
class Auth extends AuthService {
|
|
9
18
|
constructor() {
|
|
10
19
|
super();
|
|
@@ -13,36 +22,110 @@ class Auth extends AuthService {
|
|
|
13
22
|
throw (new Error(Auth.error.shouldBeRegistered));
|
|
14
23
|
Auth._authService.onAuthStateChange(userCredentials => this.authStateChanged(userCredentials));
|
|
15
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Registers an authentication service to be used by the Auth class.
|
|
27
|
+
* You need to register an authentication service before using the Auth class.
|
|
28
|
+
* @param authService the authentication service to be used by the Auth class
|
|
29
|
+
*/
|
|
16
30
|
static useAuthService(authService) {
|
|
17
31
|
if (Auth._authService != authService) {
|
|
18
32
|
Auth._authService = authService;
|
|
19
33
|
this._instance = undefined;
|
|
20
34
|
}
|
|
21
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* The instance of the Auth class
|
|
38
|
+
* @returns the authentication service
|
|
39
|
+
*/
|
|
22
40
|
static get instance() {
|
|
23
41
|
return this._instance || (this._instance = new this());
|
|
24
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Signs up a new user
|
|
45
|
+
* @param singData the data to be used to sign up the user
|
|
46
|
+
* @returns a promise that resolves to the user credentials
|
|
47
|
+
* @example
|
|
48
|
+
* // Sign up a new user with email and password
|
|
49
|
+
* Auth.instance.signUp({ authProvider: 'email', email: 'john@test.com', password: '123456' })
|
|
50
|
+
* // Sign up a new user with a Google account
|
|
51
|
+
* Auth.instance.signUp({ authProvider: 'google'})
|
|
52
|
+
*/
|
|
25
53
|
signUp(singData) {
|
|
26
54
|
return Auth._authService.signUp(singData);
|
|
27
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Logs in an existing user
|
|
58
|
+
* @param singData the data to be used to log in the user
|
|
59
|
+
* @returns a promise that resolves to the user credentials
|
|
60
|
+
* @example
|
|
61
|
+
* // Log in an existing user with email and password
|
|
62
|
+
* Auth.instance.login({ authProvider: 'email', email: 'john@test.com', password: '123456' })
|
|
63
|
+
* // Log in an existing user with a Google account
|
|
64
|
+
* Auth.instance.login({ authProvider: 'google'})
|
|
65
|
+
*/
|
|
28
66
|
login(singData) {
|
|
29
67
|
return Auth._authService.login(singData);
|
|
30
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Logs out the current user
|
|
71
|
+
* @returns a promise that resolves when the user is logged out
|
|
72
|
+
*/
|
|
31
73
|
logout() {
|
|
32
74
|
return Auth._authService.logout();
|
|
33
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Resets the password associated with the email.
|
|
78
|
+
* @param email the email address of the user to reset the password
|
|
79
|
+
* @returns a promise that resolves when the process is done
|
|
80
|
+
*/
|
|
34
81
|
resetEmailPassword(email) {
|
|
35
82
|
return Auth._authService.resetEmailPassword(email);
|
|
36
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Adds a listener to be called when the authentication state changes.
|
|
86
|
+
* @param onChange the listener to be called when the authentication state changes.
|
|
87
|
+
* The listener is called with the user credentials as a parameter.
|
|
88
|
+
* If the user is logged out, the listener is called with `undefined` as a parameter.
|
|
89
|
+
* @returns a function to remove the listener
|
|
90
|
+
* @example
|
|
91
|
+
* // Add a listener to be called when the authentication state changes
|
|
92
|
+
* const removeListener = Auth.instance.onAuthStateChange( userCredentials => {
|
|
93
|
+
* if ( userCredentials ) {
|
|
94
|
+
* // The user is logged in
|
|
95
|
+
* } else {
|
|
96
|
+
* // The user is logged out
|
|
97
|
+
* }
|
|
98
|
+
* })
|
|
99
|
+
*/
|
|
37
100
|
onAuthStateChange(onChange) {
|
|
38
101
|
return this._onAuthStateChange.subscribe(onChange);
|
|
39
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Removes a listener that was added by `onAuthStateChange` method.
|
|
105
|
+
* @param onChange the listener to be removed
|
|
106
|
+
*/
|
|
40
107
|
removeAuthStateChange(onChange) {
|
|
41
108
|
this._onAuthStateChange.unsubscribe(onChange);
|
|
42
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Links an additional authentication provider to the authenticated user.
|
|
112
|
+
* @param provider the provider to be linked
|
|
113
|
+
* @returns a promise that resolves when the process is done
|
|
114
|
+
* @example
|
|
115
|
+
* // Link a Google account to the auth service
|
|
116
|
+
* Auth.instance.linkAdditionalProvider({ authProvider: 'google' })
|
|
117
|
+
*/
|
|
43
118
|
linkAdditionalProvider(provider) {
|
|
44
119
|
return Auth._authService.linkAdditionalProvider(provider);
|
|
45
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Unlinks an authentication provider from the authenticated user.
|
|
123
|
+
* @param provider the provider to be unlinked
|
|
124
|
+
* @returns a promise that resolves when the process is done
|
|
125
|
+
* @example
|
|
126
|
+
* // Unlink the Google account from the auth service
|
|
127
|
+
* Auth.instance.unlinkProvider({ authProvider: 'google' })
|
|
128
|
+
*/
|
|
46
129
|
unlinkProvider(provider) {
|
|
47
130
|
return Auth._authService.unlinkProvider(provider);
|
|
48
131
|
}
|
|
@@ -50,7 +133,7 @@ class Auth extends AuthService {
|
|
|
50
133
|
this._onAuthStateChange.notify(userCredentials);
|
|
51
134
|
}
|
|
52
135
|
}
|
|
53
|
-
exports.Auth = Auth;
|
|
54
136
|
Auth.error = { shouldBeRegistered: 'You should register an auth service before using Auth.' };
|
|
55
137
|
Auth._instance = null;
|
|
138
|
+
exports.Auth = Auth;
|
|
56
139
|
//# sourceMappingURL=auth.js.map
|
package/lib/auth/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth/auth.ts"],"names":[],"mappings":";;;AAAA,yDAAqD;AAGrD,MAAsB,WAAW;CAQhC;AARD,kCAQC;
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth/auth.ts"],"names":[],"mappings":";;;AAAA,yDAAqD;AAGrD;;;GAGG;AACH,MAAsB,WAAW;CAQhC;AARD,kCAQC;AAeD;;;;GAIG;AACH,MAAa,IAAK,SAAQ,WAAW;IAGpC;QACC,KAAK,EAAE,CAAA;QAkIA,uBAAkB,GAAoC,IAAI,uBAAU,EAAuB,CAAA;QAjIlG,IAAI,CAAC,IAAI,CAAC,YAAY;YAAG,MAAM,CAAE,IAAI,KAAK,CAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAE,CAAE,CAAA;QAC7E,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAClC,eAAe,CAAC,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAE,eAAe,CAAE,CAC3D,CAAA;IACF,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAE,WAAwB;QAC9C,IAAK,IAAI,CAAC,YAAY,IAAI,WAAW,EAAG;YACvC,IAAI,CAAC,YAAY,GAAG,WAAW,CAAA;YAC/B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;SAC1B;IACF,CAAC;IAED;;;OAGG;IACH,MAAM,KAAK,QAAQ;QAClB,OAAO,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAE,CAAA;IACxD,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAgB,QAAkB;QACvC,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAE,QAAQ,CAAE,CAAA;IAC5C,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAgB,QAAkB;QACtC,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAE,QAAQ,CAAE,CAAA;IAC3C,CAAC;IAED;;;OAGG;IACH,MAAM;QACL,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAA;IAClC,CAAC;IAED;;;;OAIG;IACH,kBAAkB,CAAE,KAAa;QAChC,OAAO,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAE,KAAK,CAAE,CAAA;IACrD,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,iBAAiB,CAAgB,QAAuD;QACvF,OAAO,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAE,QAAQ,CAAE,CAAA;IACrD,CAAC;IAED;;;OAGG;IACH,qBAAqB,CAAgB,QAAuD;QAC3F,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAE,QAAQ,CAAE,CAAA;IAChD,CAAC;IAED;;;;;;;OAOG;IACH,sBAAsB,CAAE,QAAsB;QAC7C,OAAO,IAAI,CAAC,YAAY,CAAC,sBAAsB,CAAE,QAAQ,CAAE,CAAA;IAC5D,CAAC;IAED;;;;;;;OAOG;IACH,cAAc,CAAE,QAAsB;QACrC,OAAO,IAAI,CAAC,YAAY,CAAC,cAAc,CAAE,QAAQ,CAAE,CAAA;IACpD,CAAC;IAEO,gBAAgB,CAAE,eAAoC;QAC7D,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAE,eAAe,CAAE,CAAA;IAClD,CAAC;;AAjIM,UAAK,GAAG,EAAE,kBAAkB,EAAE,wDAAwD,EAAE,AAAnF,CAAmF;AAmIhF,cAAS,GAAS,IAAI,AAAb,CAAa;AApIzB,oBAAI"}
|
|
@@ -68,6 +68,6 @@ class CloudFunctions {
|
|
|
68
68
|
return value;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
exports.CloudFunctions = CloudFunctions;
|
|
72
71
|
CloudFunctions.error = { shouldBeRegistered: 'You should register a cloud functions service with useCloudFunctionsService static method before using CloudFunctions.' };
|
|
72
|
+
exports.CloudFunctions = CloudFunctions;
|
|
73
73
|
//# sourceMappingURL=cloud-functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-functions.js","sourceRoot":"","sources":["../../src/cloud-functions/cloud-functions.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAuE;AAUvE,MAAa,cAAc;IAC1B,gBAAuB,CAAC;IAIxB,MAAM,CAAC,wBAAwB,CAAE,qBAA4C;QAC5E,IAAK,IAAI,CAAC,sBAAsB,IAAI,qBAAqB,EAAG;YAC3D,IAAI,CAAC,sBAAsB,GAAG,qBAAqB,CAAA;SACnD;IACF,CAAC;IAED,MAAM,KAAK,QAAQ;QAClB,IAAK,CAAC,IAAI,CAAC,sBAAsB;YAAG,MAAM,IAAI,KAAK,CAAE,cAAc,CAAC,KAAK,CAAC,kBAAkB,CAAE,CAAA;QAC9F,OAAO,cAAc,CAAC,SAAS,IAAI,CAAE,cAAc,CAAC,SAAS,GAAG,IAAI,cAAc,EAAE,CAAE,CAAA;IACvF,CAAC;IAED,cAAc,CAAQ,aAAqB;QAC1C,OAAO,cAAc,CAAC,sBAAsB,CAAC,gBAAgB,CAAE,aAAa,CAAE,CAAA;IAC/E,CAAC;IAED,WAAW,CAAa,aAAqB;QAC5C,MAAM,YAAY,GAAG,cAAc,CAAC,sBAAsB,CAAC,YAAY,CAAA;QACvE,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAQ,aAAa,CAAE,CAAA;QAEvD,OAAO,CAAQ,KAAS,EAAG,EAAE;YAC5B,MAAM,MAAM,GAAG,MAAM,YAAY,CAAE,IAAI,EAAE,IAAI,CAAC,YAAY,CAAE,KAAK,CAAE,CAAE,CAAA;YACrE,OAAO,IAAI,CAAC,aAAa,CAAE,MAAM,CAAE,CAAA;QACpC,CAAC,CAAA,CAAA;IACF,CAAC;IAEO,YAAY,CAAK,KAAQ;QAChC,IAAK,CAAC,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AAE,EAAE,CAAM,CAAA;SACX;QAED,OAAO,KAAU,CAAA;IAClB,CAAC;;AAjEM,oBAAK,GAAG,EAAE,kBAAkB,EAAE,wHAAwH,EAAE,CAAA;AAHnJ,wCAAc"}
|
|
@@ -24,8 +24,8 @@ class CloudStorage {
|
|
|
24
24
|
return CloudStorage._defaultCloudStorage;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
exports.CloudStorage = CloudStorage;
|
|
28
27
|
CloudStorage._cloudStorageFactoryMap = {};
|
|
28
|
+
exports.CloudStorage = CloudStorage;
|
|
29
29
|
function registerCloudStorage(cloudStorageProviderName, factory) {
|
|
30
30
|
CloudStorage.registerCloudStorage(cloudStorageProviderName, factory);
|
|
31
31
|
return (constructor) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-storage.js","sourceRoot":"","sources":["../../src/cloud-storage/cloud-storage.ts"],"names":[],"mappings":";;;AAiBA,MAAsB,YAAY;IAMjC,MAAM,CAAC,oBAAoB,CAAE,wBAAgC,EAAE,OAA4B;QAC1F,YAAY,CAAC,uBAAuB,CAAE,wBAAwB,CAAE,GAAG,OAAO,CAAA;IAC3E,CAAC;IAED,MAAM,CAAC,cAAc,CAAE,YAAoB;QAC1C,IAAK,CAAC,YAAY,CAAC,uBAAuB,CAAE,YAAY,CAAE,EAAG;YAC5D,MAAM,IAAI,KAAK,CAAE,2BAA4B,YAAa,yCAAyC,CAAC,CAAA;SACpG;QAED,OAAO,YAAY,CAAC,uBAAuB,CAAE,YAAY,CAAE,EAAE,CAAA;IAC9D,CAAC;IAED,IAAI,SAAS;QACZ,OAAO,IAAI,CAAE,aAAa,CAAE,CAAC;IAC9B,CAAC;IAED,MAAM,CAAC,eAAe,CAAE,QAAsB;QAC7C,YAAY,CAAC,oBAAoB,GAAG,QAAQ,CAAA;IAC7C,CAAC;IAED,MAAM,KAAK,mBAAmB;QAC7B,IAAK,CAAC,YAAY,CAAC,oBAAoB,EAAG;YACzC,MAA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,oDAKC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-storage.spec.js","sourceRoot":"","sources":["../../src/cloud-storage/cloud-storage.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAA0F;AAC1F,gEAA0D;AAE1D,0CAAsC;AACtC,mDAA8C;AAC9C,6DAAuD;AACvD,+CAA2D;AAE3D,SAAS,QAAQ,CAAE,IAAW,EAAE,QAAgB;IAC/C,IAAI,CAAC,IAAI,GAAG,IAAa,CAAA;IACzB,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAA;AACrB,CAAC;AAED,MAAM,CAAC,IAAI,GAAG,QAAe,CAAA;AAG7B,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,uBAAU;IAA7B;;QAMqB,UAAK,GAAe,IAAI,wBAAU,EAAE,CAAA;IACzD,CAAC;IALA,IAAI,IAAI;QACP,OAAO,IAAI,CAAC,KAAK,CAAA;IAClB,CAAC;CAGD,CAAA;
|
|
1
|
+
{"version":3,"file":"cloud-storage.spec.js","sourceRoot":"","sources":["../../src/cloud-storage/cloud-storage.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAA0F;AAC1F,gEAA0D;AAE1D,0CAAsC;AACtC,mDAA8C;AAC9C,6DAAuD;AACvD,+CAA2D;AAE3D,SAAS,QAAQ,CAAE,IAAW,EAAE,QAAgB;IAC/C,IAAI,CAAC,IAAI,GAAG,IAAa,CAAA;IACzB,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAA;AACrB,CAAC;AAED,MAAM,CAAC,IAAI,GAAG,QAAe,CAAA;AAG7B,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,uBAAU;IAA7B;;QAMqB,UAAK,GAAe,IAAI,wBAAU,EAAE,CAAA;IACzD,CAAC;IALA,IAAI,IAAI;QACP,OAAO,IAAI,CAAC,KAAK,CAAA;IAClB,CAAC;CAGD,CAAA;AADoB;IAAnB,uBAAU;mCAA6C;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I,CAAC,SAAS,CAAE,SAAS,CAAE,CAAE,CAAA;YAExC,MAAM,CAAE,SAAS,CAAE,CAAC,gBAAgB,EAAE,CAAA;QACvC,CAAC,CAAA,CAAC,CAAA;IAEH,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-cloud-storage.js","sourceRoot":"","sources":["../../src/cloud-storage/mock-cloud-storage.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,mDAAiH;
|
|
1
|
+
{"version":3,"file":"mock-cloud-storage.js","sourceRoot":"","sources":["../../src/cloud-storage/mock-cloud-storage.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,mDAAiH;AAGjH,IAAa,gBAAgB,wBAA7B,MAAa,gBAAiB,SAAQ,4BAAY;IACjD,YAAa,kBAA0B,EAAE;QACxC,KAAK,EAAE,CAAA;QAqCD,mBAAc,GAAG,EAAE,CAAA;QApCzB,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAA;IACxC,CAAC;IAED,IAAI,CAAE,EAAU,EAAE,IAAkB;QACnC,MAAM,QAAQ,GAAG,EAAE,CAAA;QAEnB,IAAK,IAAI,CAAC,WAAW;YAAG,IAAI,CAAC,WAAW,CAAE,CAAC,EAAE,GAAG,CAAE,CAAA;QAElD,IAAI,CAAC,cAAc,CAAE,EAAE,CAAE,GAAG,IAAI,CAAC,SAAS,CAAE,IAAI,CAAE,CAAA;QAElD,IAAK,IAAI,CAAC,WAAW;YAAG,IAAI,CAAC,WAAW,CAAE,GAAG,EAAE,GAAG,CAAE,CAAA;QAEpD,MAAM,GAAG,GAAG,IAAI,YAAY,IAAI,CAAA,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAA;QACtD,OAAO,OAAO,CAAC,OAAO,CAAE,GAAG,CAAE,CAAA;IAC9B,CAAC;IAED,aAAa;QACZ,OAAO;YACN,MAAM,EAAE,GAAE,EAAE,GAAC,CAAC;YACd,KAAK,EAAE,GAAE,EAAE,GAAC,CAAC;YACb,MAAM,EAAE,GAAE,EAAE,GAAC,CAAC;YACd,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,GAAG,QAAQ;SACnD,CAAA;IACF,CAAC;IAED,MAAM,CAAE,SAAiB;QACxB,OAAO,OAAO,CAAC,OAAO,CAAE,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAE,CAAA;IAC5D,CAAC;IAED,MAAM,CAAE,SAAiB;QACxB,OAAO,IAAI,CAAC,cAAc,CAAE,SAAS,CAAE,CAAA;QACvC,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IACzB,CAAC;CAKD,CAAA;AAxCY,gBAAgB;IAD5B,IAAA,oCAAoB,EAAE,kBAAkB,EAAE,GAAE,EAAE,CAAA,IAAI,kBAAgB,EAAE,CAAE;GAC1D,gBAAgB,CAwC5B;AAxCY,4CAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stored-file.js","sourceRoot":"","sources":["../../src/cloud-storage/stored-file.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yDAA+D;AAC/D,yDAA0F;AAC1F,mDAA2F;AAE3F,IAAa,eAAmD;AAAhE,WAAa,eAAe;IAAG,yDAAM,CAAA;IAAE,yEAAc,CAAA;IAAE,2DAAO,CAAA;AAAC,CAAC,EAAnD,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAAoC;
|
|
1
|
+
{"version":3,"file":"stored-file.js","sourceRoot":"","sources":["../../src/cloud-storage/stored-file.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yDAA+D;AAC/D,yDAA0F;AAC1F,mDAA2F;AAE3F,IAAa,eAAmD;AAAhE,WAAa,eAAe;IAAG,yDAAM,CAAA;IAAE,yEAAc,CAAA;IAAE,2DAAO,CAAA;AAAC,CAAC,EAAnD,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAAoC;AAehE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gBAAgB,CAAE,CAAA;IACpD,CAAC;CASD,CAAA;AAPoB;IAAnB,uBAAU;8CAA2B;AAClB;IAAnB,uBAAU;wCAAqB;AACZ;IAAnB,uBAAU;6DAA0C;AACjC;IAAnB,uBAAU;qDAAkC;AAxEjC,UAAU;IADtB,IAAA,oCAAuB,EAAE,YAAY,CAAE;GAC3B,UAAU,CA4EtB;AA5EY,gCAAU"}
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
export type Callback<T> = (event: T) => void;
|
|
2
2
|
export type Unsubscriber = () => void;
|
|
3
|
+
/**
|
|
4
|
+
* Implements the Observer pattern.
|
|
5
|
+
* The Observable class is used to notify a list of subscribers when an event occurs.
|
|
6
|
+
* The subscribers are callback functions that are called when the event occurs.
|
|
7
|
+
* The event is passed as a parameter to the callback function.
|
|
8
|
+
* @example
|
|
9
|
+
* // Create an observable
|
|
10
|
+
* const observable = new Observable<number>()
|
|
11
|
+
* // Subscribe a listener
|
|
12
|
+
* const unsubscribe = observable.subscribe( event => console.log( event ) )
|
|
13
|
+
* // Notify the subscribers
|
|
14
|
+
* observable.notify( 1 )
|
|
15
|
+
* // Unsubscribe the listener
|
|
16
|
+
* unsubscribe()
|
|
17
|
+
*/
|
|
3
18
|
export declare class Observable<T> {
|
|
4
19
|
/**
|
|
5
20
|
* Subscribes a listener callback function. On every notification,
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Observable = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Implements the Observer pattern.
|
|
6
|
+
* The Observable class is used to notify a list of subscribers when an event occurs.
|
|
7
|
+
* The subscribers are callback functions that are called when the event occurs.
|
|
8
|
+
* The event is passed as a parameter to the callback function.
|
|
9
|
+
* @example
|
|
10
|
+
* // Create an observable
|
|
11
|
+
* const observable = new Observable<number>()
|
|
12
|
+
* // Subscribe a listener
|
|
13
|
+
* const unsubscribe = observable.subscribe( event => console.log( event ) )
|
|
14
|
+
* // Notify the subscribers
|
|
15
|
+
* observable.notify( 1 )
|
|
16
|
+
* // Unsubscribe the listener
|
|
17
|
+
* unsubscribe()
|
|
18
|
+
*/
|
|
4
19
|
class Observable {
|
|
5
20
|
constructor() {
|
|
6
21
|
this.subscribers = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observable.js","sourceRoot":"","sources":["../../src/observable/observable.ts"],"names":[],"mappings":";;;AAGA,MAAa,UAAU;IAAvB;QAgCS,gBAAW,GAAkB,EAAE,CAAA;IACxC,CAAC;IA/BA;;;;;;OAMG;IACF,SAAS,CAAE,QAAqB;QAChC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC/B,OAAO,GAAE,EAAE,CAAA,IAAI,CAAC,WAAW,CAAE,QAAQ,CAAE,CAAA;IACxC,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAE,QAAqB;QACjC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAE,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,QAAQ,CAAE,CAAA;IACpE,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAE,KAAS;QAChB,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IAC9C,CAAC;CAGD;AAjCD,gCAiCC"}
|
|
1
|
+
{"version":3,"file":"observable.js","sourceRoot":"","sources":["../../src/observable/observable.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;GAcG;AACH,MAAa,UAAU;IAAvB;QAgCS,gBAAW,GAAkB,EAAE,CAAA;IACxC,CAAC;IA/BA;;;;;;OAMG;IACF,SAAS,CAAE,QAAqB;QAChC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC/B,OAAO,GAAE,EAAE,CAAA,IAAI,CAAC,WAAW,CAAE,QAAQ,CAAE,CAAA;IACxC,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAE,QAAqB;QACjC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAE,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,QAAQ,CAAE,CAAA;IACpE,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAE,KAAS;QAChB,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IAC9C,CAAC;CAGD;AAjCD,gCAiCC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ClassPropNames, SomeClassProps } from '../types/utility-types';
|
|
2
2
|
export type PersistentConstructor = new () => Persistent;
|
|
3
|
+
/**
|
|
4
|
+
* The corresponding type of the plain object of a persistent class.
|
|
5
|
+
*/
|
|
3
6
|
export type PersistentObject<T extends Persistent> = Omit<SomeClassProps<T>, 'className'> & {
|
|
4
7
|
__className?: string;
|
|
5
8
|
__rootCollections?: Collections;
|
|
@@ -7,12 +10,22 @@ export type PersistentObject<T extends Persistent> = Omit<SomeClassProps<T>, 'cl
|
|
|
7
10
|
storedInCollection: string;
|
|
8
11
|
};
|
|
9
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* The type of the plain object of a persistent class for all the nested properties.
|
|
15
|
+
*/
|
|
10
16
|
export type MakePersistentObjects<T> = {
|
|
11
17
|
[A in keyof T]: T[A] extends Persistent ? PersistentObject<T[A]> : MakePersistentObjects<T[A]>;
|
|
12
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* A collection of document objects typically returned by Persistent.toObject()
|
|
21
|
+
* @see Persistent.toObject
|
|
22
|
+
*/
|
|
13
23
|
export type Collections = {
|
|
14
24
|
[collectionPath: string]: PersistentObject<Persistent>[];
|
|
15
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Stores information about a reference in another collection.
|
|
28
|
+
*/
|
|
16
29
|
export interface DocumentReference {
|
|
17
30
|
id: string;
|
|
18
31
|
__className: string;
|
|
@@ -65,16 +78,67 @@ export declare class Persistent {
|
|
|
65
78
|
* @see registerFactory
|
|
66
79
|
*/
|
|
67
80
|
static annotations(className: string | Persistent | PersistentConstructor): unknown;
|
|
81
|
+
/**
|
|
82
|
+
* Returns a new instance of Persistent class.
|
|
83
|
+
* @param className the initial id of this instance. If not provided, a new id will be generated
|
|
84
|
+
*/
|
|
68
85
|
constructor(id?: string);
|
|
86
|
+
/**
|
|
87
|
+
* Gets the class name of this instance.
|
|
88
|
+
*/
|
|
69
89
|
get className(): string;
|
|
90
|
+
/**
|
|
91
|
+
* Sets the id of this instance.
|
|
92
|
+
* @param value the id of this instance
|
|
93
|
+
*/
|
|
70
94
|
protected setId(value: string): void;
|
|
95
|
+
/**
|
|
96
|
+
* Returns the id of this instance.
|
|
97
|
+
* @returns the id of this instance
|
|
98
|
+
*/
|
|
71
99
|
get id(): string;
|
|
100
|
+
/**
|
|
101
|
+
* This method is called by the persistence engine when the instance has been
|
|
102
|
+
* just serialized. It is called after the properties are initialized.
|
|
103
|
+
*/
|
|
72
104
|
protected onSerialized(): void;
|
|
105
|
+
/**
|
|
106
|
+
* This method is called by the persistence engine before the instance is
|
|
107
|
+
* serialized.
|
|
108
|
+
*/
|
|
73
109
|
protected beforeSerialize(): void;
|
|
110
|
+
/**
|
|
111
|
+
* Returns an array of the persistent properties of this instance.
|
|
112
|
+
* @returns an array of the persistent properties of this instance
|
|
113
|
+
*/
|
|
74
114
|
getPersistentProperties(): readonly PersistentProperty[];
|
|
115
|
+
/**
|
|
116
|
+
* Copy the persistent properties of the given instance to this instance.
|
|
117
|
+
* The property `id` will be ignored.
|
|
118
|
+
* Only the properties that are not null or undefined will be copied.
|
|
119
|
+
* @param instance the instance to be copied
|
|
120
|
+
* @returns this instance
|
|
121
|
+
* @see fromObject
|
|
122
|
+
* @see toObject
|
|
123
|
+
*/
|
|
75
124
|
clone(instance: Persistent): void;
|
|
125
|
+
/**
|
|
126
|
+
* Initializes the persistent properties of this instance from the properties
|
|
127
|
+
* of given object.
|
|
128
|
+
* @param obj the object to be copied
|
|
129
|
+
* @returns this instance
|
|
130
|
+
* @see clone
|
|
131
|
+
* @see toObject
|
|
132
|
+
*/
|
|
76
133
|
fromObject(obj: PersistentObject<this>): this;
|
|
77
134
|
private fromObj;
|
|
135
|
+
/**
|
|
136
|
+
* Returns a plain object representation of this instance.
|
|
137
|
+
* Only the properties that are not null or undefined will be copied.
|
|
138
|
+
* @returns a plain object representation of this instance
|
|
139
|
+
* @see fromObject
|
|
140
|
+
* @see clone
|
|
141
|
+
*/
|
|
78
142
|
toObject(): PersistentObject<this>;
|
|
79
143
|
private toObj;
|
|
80
144
|
private fromDeepObject;
|
|
@@ -75,28 +75,72 @@ class Persistent {
|
|
|
75
75
|
throw new Error(`You should register class ${className} prior to use.`);
|
|
76
76
|
return this._factoryMap[className].annotation;
|
|
77
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Returns a new instance of Persistent class.
|
|
80
|
+
* @param className the initial id of this instance. If not provided, a new id will be generated
|
|
81
|
+
*/
|
|
78
82
|
constructor(id = (0, uuid_1.v4)()) {
|
|
79
83
|
this._id = id;
|
|
80
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Gets the class name of this instance.
|
|
87
|
+
*/
|
|
81
88
|
get className() {
|
|
82
89
|
return this['__className'];
|
|
83
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Sets the id of this instance.
|
|
93
|
+
* @param value the id of this instance
|
|
94
|
+
*/
|
|
84
95
|
setId(value) {
|
|
85
96
|
this._id = value;
|
|
86
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Returns the id of this instance.
|
|
100
|
+
* @returns the id of this instance
|
|
101
|
+
*/
|
|
87
102
|
get id() {
|
|
88
103
|
return this._id;
|
|
89
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* This method is called by the persistence engine when the instance has been
|
|
107
|
+
* just serialized. It is called after the properties are initialized.
|
|
108
|
+
*/
|
|
90
109
|
onSerialized() { }
|
|
110
|
+
/**
|
|
111
|
+
* This method is called by the persistence engine before the instance is
|
|
112
|
+
* serialized.
|
|
113
|
+
*/
|
|
91
114
|
beforeSerialize() { }
|
|
115
|
+
/**
|
|
116
|
+
* Returns an array of the persistent properties of this instance.
|
|
117
|
+
* @returns an array of the persistent properties of this instance
|
|
118
|
+
*/
|
|
92
119
|
getPersistentProperties() {
|
|
93
120
|
return this._persistentProperties.map(prop => (Object.assign(Object.assign({}, prop), { name: prop.name.slice(1) })));
|
|
94
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Copy the persistent properties of the given instance to this instance.
|
|
124
|
+
* The property `id` will be ignored.
|
|
125
|
+
* Only the properties that are not null or undefined will be copied.
|
|
126
|
+
* @param instance the instance to be copied
|
|
127
|
+
* @returns this instance
|
|
128
|
+
* @see fromObject
|
|
129
|
+
* @see toObject
|
|
130
|
+
*/
|
|
95
131
|
clone(instance) {
|
|
96
132
|
const obj = instance.toObject();
|
|
97
133
|
delete obj['id'];
|
|
98
134
|
this.fromObject(obj);
|
|
99
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Initializes the persistent properties of this instance from the properties
|
|
138
|
+
* of given object.
|
|
139
|
+
* @param obj the object to be copied
|
|
140
|
+
* @returns this instance
|
|
141
|
+
* @see clone
|
|
142
|
+
* @see toObject
|
|
143
|
+
*/
|
|
100
144
|
fromObject(obj) {
|
|
101
145
|
this.fromObj(obj);
|
|
102
146
|
this.onSerialized();
|
|
@@ -112,6 +156,13 @@ class Persistent {
|
|
|
112
156
|
});
|
|
113
157
|
return this;
|
|
114
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Returns a plain object representation of this instance.
|
|
161
|
+
* Only the properties that are not null or undefined will be copied.
|
|
162
|
+
* @returns a plain object representation of this instance
|
|
163
|
+
* @see fromObject
|
|
164
|
+
* @see clone
|
|
165
|
+
*/
|
|
115
166
|
toObject() {
|
|
116
167
|
this.beforeSerialize();
|
|
117
168
|
const rootCollections = {};
|