entropic-bond 1.53.6 → 1.53.7
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/lib/entropic-bond.js +172 -154
- package/lib/entropic-bond.js.map +1 -1
- package/lib/entropic-bond.umd.cjs +2 -2
- package/lib/entropic-bond.umd.cjs.map +1 -1
- package/lib/store/data-source.d.ts +7 -7
- package/lib/store/json-data-source.d.ts +3 -3
- package/lib/store/model.d.ts +1 -0
- package/package.json +1 -1
|
@@ -55,15 +55,15 @@ export type QueryObject<T> = {
|
|
|
55
55
|
};
|
|
56
56
|
export type DocumentListenerUninstaller = () => void;
|
|
57
57
|
export type DocumentChangeType = 'create' | 'update' | 'delete';
|
|
58
|
-
export interface DocumentChange<T extends Persistent> {
|
|
58
|
+
export interface DocumentChange<T extends Persistent | DocumentObject> {
|
|
59
59
|
before: T | undefined;
|
|
60
|
-
after: T;
|
|
60
|
+
after: T | undefined;
|
|
61
61
|
params: {
|
|
62
62
|
[key: string]: any;
|
|
63
63
|
};
|
|
64
64
|
type: DocumentChangeType;
|
|
65
65
|
}
|
|
66
|
-
export type DocumentChangeListerner<T extends Persistent> = (change: DocumentChange<T>) => void;
|
|
66
|
+
export type DocumentChangeListerner<T extends Persistent | DocumentObject> = (change: DocumentChange<T>) => void;
|
|
67
67
|
export interface DocumentChangeListernerHandler {
|
|
68
68
|
uninstall: DocumentListenerUninstaller;
|
|
69
69
|
nativeHandler: unknown;
|
|
@@ -98,7 +98,7 @@ export declare abstract class DataSource {
|
|
|
98
98
|
* @returns a function that uninstalls the listener. If the returned value is undefined
|
|
99
99
|
* the method documentChangeListerner has not been implemented in the concrete data source
|
|
100
100
|
*/
|
|
101
|
-
protected subscribeToDocumentChangeListerner(collectionPathToListen: string, listener: DocumentChangeListerner<
|
|
101
|
+
protected subscribeToDocumentChangeListerner(collectionPathToListen: string, listener: DocumentChangeListerner<DocumentObject>): DocumentChangeListernerHandler | undefined;
|
|
102
102
|
/**
|
|
103
103
|
* Retrieves a document by id
|
|
104
104
|
* Implement the required logic to retrieve a document by id from your concrete
|
|
@@ -158,8 +158,8 @@ export declare abstract class DataSource {
|
|
|
158
158
|
* @see QueryObject
|
|
159
159
|
*/
|
|
160
160
|
abstract count(queryObject: QueryObject<DocumentObject>, collectionName: string): Promise<number>;
|
|
161
|
-
abstract onCollectionChange
|
|
162
|
-
abstract onDocumentChange
|
|
161
|
+
abstract onCollectionChange(query: QueryObject<DocumentObject>, collectionName: string, listener: DocumentChangeListerner<DocumentObject>): Unsubscriber;
|
|
162
|
+
abstract onDocumentChange(documentPath: string, documentId: string, listener: DocumentChangeListerner<DocumentObject>): Unsubscriber;
|
|
163
163
|
/**
|
|
164
164
|
* Utility method to convert a query object to a property path query object
|
|
165
165
|
*
|
|
@@ -175,7 +175,7 @@ export declare abstract class DataSource {
|
|
|
175
175
|
static toPropertyPathOperations<T extends Persistent>(operations: QueryOperation<T>[]): QueryOperation<T>[];
|
|
176
176
|
static isArrayOperator(operator: QueryOperator): boolean;
|
|
177
177
|
private static toPropertyPathValue;
|
|
178
|
-
static onDocumentChange(event: DocumentChange<
|
|
178
|
+
static onDocumentChange(event: DocumentChange<DocumentObject>, propsToUpdate: PropWithOwner[]): Promise<Promise<[Promise<void>[]]>[] | undefined>;
|
|
179
179
|
private static onUpdate;
|
|
180
180
|
}
|
|
181
181
|
export {};
|
|
@@ -41,8 +41,8 @@ export declare class JsonDataSource extends DataSource {
|
|
|
41
41
|
delete(id: string, collectionName: string): Promise<void>;
|
|
42
42
|
next(limit?: number): Promise<DocumentObject[]>;
|
|
43
43
|
count(queryObject: QueryObject<DocumentObject>, collectionName: string): Promise<number>;
|
|
44
|
-
onCollectionChange
|
|
45
|
-
onDocumentChange
|
|
44
|
+
onCollectionChange(query: QueryObject<DocumentObject>, collectionName: string, listener: DocumentChangeListerner<DocumentObject>): Unsubscriber;
|
|
45
|
+
onDocumentChange(collectionName: string, documentId: string, listener: DocumentChangeListerner<DocumentObject>): Unsubscriber;
|
|
46
46
|
/**
|
|
47
47
|
* @returns the raw data store data as a JSON object
|
|
48
48
|
*/
|
|
@@ -54,7 +54,7 @@ export declare class JsonDataSource extends DataSource {
|
|
|
54
54
|
wait(): Promise<any[]>;
|
|
55
55
|
private incCursor;
|
|
56
56
|
simulateError(error: string | ErrorOnOperation | undefined): this;
|
|
57
|
-
protected subscribeToDocumentChangeListerner(collectionNameToListen: string, listener: DocumentChangeListerner<
|
|
57
|
+
protected subscribeToDocumentChangeListerner(collectionNameToListen: string, listener: DocumentChangeListerner<DocumentObject>): DocumentChangeListernerHandler | undefined;
|
|
58
58
|
private notifyChange;
|
|
59
59
|
private decCursor;
|
|
60
60
|
private queryProcessor;
|
package/lib/store/model.d.ts
CHANGED
|
@@ -63,6 +63,7 @@ export declare class Model<T extends Persistent> {
|
|
|
63
63
|
next<U extends T>(limit?: number): Promise<U[]>;
|
|
64
64
|
onDocumentChange(collectionPathToListen: string, documentId: string, listener: DocumentChangeListerner<T>): Unsubscriber;
|
|
65
65
|
onCollectionChange(query: Query<T>, listener: DocumentChangeListerner<T>): Unsubscriber;
|
|
66
|
+
private toPersistentChangeObject;
|
|
66
67
|
private mapToInstance;
|
|
67
68
|
/**
|
|
68
69
|
* Normalizes the query object to match the data source requirements.
|