( query: Query, events: DocumentChangeType[], scheduler?: SchedulerLike)
| 51 | * Return a stream of document changes on a query. These results are in sort order. |
| 52 | */ |
| 53 | export function sortedChanges<T>( |
| 54 | query: Query, |
| 55 | events: DocumentChangeType[], |
| 56 | scheduler?: SchedulerLike): Observable<DocumentChangeAction<T>[]> { |
| 57 | return docChanges<T>(query, scheduler) |
| 58 | .pipe( |
| 59 | scan((current, changes) => combineChanges<T>(current, changes.map(it => it.payload), events), []), |
| 60 | distinctUntilChanged(), // cut down on unneed change cycles |
| 61 | map(changes => changes.map(c => ({ type: c.type, payload: c } as DocumentChangeAction<T>)))); |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Combines the total result set from the current set of changes from an incoming set |
no test coverage detected