mirror of
https://github.com/Start9Labs/patch-db.git
synced 2026-03-26 02:11:54 +00:00
* feat(client): remove data mutation * chore: address comments and fix some other issues * chore: send the most recent cache upon subscription
14 lines
427 B
TypeScript
14 lines
427 B
TypeScript
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' })))
|
|
}
|
|
}
|