| 6 | import {Response, ResponseStream, RequestOptions} from './interfaces'; |
| 7 | |
| 8 | export class MainHTTPSource implements HTTPSource { |
| 9 | constructor(private _res$$: Stream<MemoryStream<Response> & ResponseStream>, |
| 10 | private _name: string, |
| 11 | private _namespace: Array<string> = []) { |
| 12 | } |
| 13 | |
| 14 | public filter(predicate: (request: RequestOptions) => boolean): HTTPSource { |
| 15 | const filteredResponse$$ = this._res$$.filter(r$ => predicate(r$.request)); |
| 16 | return new MainHTTPSource(filteredResponse$$, this._name, this._namespace); |
| 17 | } |
| 18 | |
| 19 | public select(category?: string): any { |
| 20 | const res$$ = category ? |
| 21 | this._res$$.filter(res$ => res$.request && res$.request.category === category) : |
| 22 | this._res$$; |
| 23 | const out: DevToolEnabledSource = adapt(res$$); |
| 24 | out._isCycleSource = this._name; |
| 25 | return out; |
| 26 | } |
| 27 | |
| 28 | public isolateSource: (source: HTTPSource, scope: string) => HTTPSource = isolateSource; |
| 29 | public isolateSink: (sink: Stream<any>, scope: string) => Stream<any> = isolateSink; |
| 30 | } |
nothing calls this directly
no outgoing calls
no test coverage detected