| 
					
				 | 
			
			
				@@ -2,6 +2,7 @@ import { isObject, get } from 'lodash' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { Observable, Subject, interval, map, of } from 'rxjs' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { DataPrepService } from './dataprep.service' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import _ = require("lodash") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { Conditions, DateRange, Storage } from '../types/interface' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export class SearchService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private dataPrepService: DataPrepService 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -22,8 +23,8 @@ export class SearchService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public query(storage: Storage, ...conditions: Conditions[]): Observable<any> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let dataFromStorage: Subject<any> = new Subject() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let filteredResult: Subject<any> = new Subject() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // check if storaage is of type ObservableStorage 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (typeof storage === "object" && storage !== null && "type" in storage && "ref" in storage) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (storage.type == 'observable') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             let obsRef = storage.ref 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             obsRef.subscribe((element) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 dataFromStorage.next(element) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -31,6 +32,7 @@ export class SearchService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             this.dataPrepService.loadObsData(storage, dataFromStorage) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.filterFromObs(dataFromStorage, filteredResult, ...conditions) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return filteredResult.pipe() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -172,26 +174,3 @@ export class SearchService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// Entries that client will use. Subject to be improved later on 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-export interface Conditions { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    $regex?: string, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    $dateRange?: DateRange, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    [key: string]: string | Date | DateRange | string[] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-export interface DateRange { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    startDate: string | Date, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    endDate: string | Date, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    column: string 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-export interface StorageLocation { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    type: string, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    url: string 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-export interface ObservableStorage { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    type: "observable", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    ref: Observable<any> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-export type Storage = ObservableStorage | StorageLocation 
			 |