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.
@@ -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<Persistent>): DocumentChangeListernerHandler | undefined;
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<T extends Persistent>(query: QueryObject<T>, collectionName: string, listener: DocumentChangeListerner<T>): Unsubscriber;
162
- abstract onDocumentChange<T extends Persistent>(documentPath: string, documentId: string, listener: DocumentChangeListerner<T>): Unsubscriber;
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<Persistent>, propsToUpdate: PropWithOwner[]): Promise<Promise<[Promise<void>[]]>[] | undefined>;
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<T extends Persistent>(query: QueryObject<T>, collectionName: string, listener: DocumentChangeListerner<T>): Unsubscriber;
45
- onDocumentChange<T extends Persistent>(collectionName: string, documentId: string, listener: DocumentChangeListerner<T>): Unsubscriber;
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<Persistent>): DocumentChangeListernerHandler | undefined;
57
+ protected subscribeToDocumentChangeListerner(collectionNameToListen: string, listener: DocumentChangeListerner<DocumentObject>): DocumentChangeListernerHandler | undefined;
58
58
  private notifyChange;
59
59
  private decCursor;
60
60
  private queryProcessor;
@@ -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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "entropic-bond",
3
3
  "type": "module",
4
- "version": "1.53.6",
4
+ "version": "1.53.7",
5
5
  "description": "Tidy up your messy components",
6
6
  "main": "./lib/entropic-bond.umd.cjs",
7
7
  "module": "./lib/entropic-bond.js",