fix(watcher.changeSubject): now emits correct type into observer functions

This commit is contained in:
Philipp Kunz 2022-05-19 16:15:28 +02:00
parent 055298172f
commit 206ccd40e9
2 changed files with 3 additions and 3 deletions

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@pushrocks/smartdata',
version: '5.0.2',
version: '5.0.3',
description: 'do more with data'
}

View File

@ -11,11 +11,11 @@ export class SmartdataDbWatcher<T = any> {
// INSTANCE
private changeStream: plugins.mongodb.ChangeStream<T>;
public changeSubject = new plugins.smartrx.rxjs.Subject<SmartDataDbDoc<T, T>>();
public changeSubject = new plugins.smartrx.rxjs.Subject<T>();
constructor(changeStreamArg: plugins.mongodb.ChangeStream<T>, smartdataDbDocArg: typeof SmartDataDbDoc) {
this.changeStream = changeStreamArg;
this.changeStream.on('change', async (item: T) => {
this.changeSubject.next(smartdataDbDocArg.createInstanceFromMongoDbNativeDoc(item));
this.changeSubject.next(smartdataDbDocArg.createInstanceFromMongoDbNativeDoc(item) as any as T);
})
plugins.smartdelay.delayFor(0).then(() => {
this.readyDeferred.resolve();