MCPcopy Create free account
hub / github.com/cyclejs/cyclejs / MainHTTPSource

Class MainHTTPSource

http/src/MainHTTPSource.ts:8–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6import {Response, ResponseStream, RequestOptions} from './interfaces';
7
8export 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected