mirror of
https://github.com/Start9Labs/patch-db.git
synced 2026-03-31 04:13:39 +00:00
simplify websocket opening and response types from BE
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
import { Observable } from 'rxjs'
|
||||
import { map } from 'rxjs/operators'
|
||||
import { Update } from '../types'
|
||||
import { Source } from './source'
|
||||
import { RPCResponse } from './ws-source'
|
||||
|
||||
export class MockSource<T> implements Source<T> {
|
||||
constructor(private readonly seed: Observable<Update<T>>) {}
|
||||
|
||||
watch$(): Observable<RPCResponse<Update<T>>> {
|
||||
return this.seed.pipe(map(result => ({ result, jsonrpc: '2.0' })))
|
||||
watch$(): Observable<Update<T>> {
|
||||
return this.seed
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user