/** * fromService creator * @author yoyoyohamapi * @ignore created 2018-08-13 14:26:55 */ import { Observable } from 'rxjs'; import { Store } from 'redux'; import { Notification, NotificationLevel } from '../types/notification'; interface ServiceTemplates { success: (resp: T) => string; error: (error: E) => string; } export interface ServiceConfig { templates?: ServiceTemplates; isSuccess?: (resp: T) => boolean; errorSelector?: (error: any) => any; } interface ServiceOptions { /** 等级 */ level: NotificationLevel; /** 消息模板 */ templates?: ServiceTemplates; } interface Result { resp?: T | undefined; error?: E | undefined; success?: boolean | undefined; } export declare type ServiceFunc = (serviceName: string, service: Promise, options?: ServiceOptions) => [Observable>, Observable>]; export declare function partition(source: Observable, predicate: (value: T, index: number) => boolean): Observable[]; /** * 创建 fromService creator * @param {Notification} notification */ export default function createFromService(notification: Notification, serviceConfig: ServiceConfig, store: Store): ServiceFunc; export {};