///
import { BasicConfig, ContainerContextType, TaskConfig, IteratorContextType, RCREContextType, runTimeType } from '../../types';
import { DATA_CUSTOMER_PASS_PAYLOAD } from '../Container/action';
import { ContainerProps } from '../Container/Container';
import { EventEmitter } from 'events';
import { FunsCustomerController } from './funcCustomer';
import { TRIGGER_SET_DATA_OPTIONS } from '../Trigger';
declare type CustomerInstance = (config: any, params: CustomerParams) => any;
/**
* 把DataCustomerFunc函数变量注入到context中
*
* @param {Object} context
*/
export declare function injectDataCustomerIntoContext(context: Object): void;
export interface CustomerParams {
runTime: runTimeType;
model: string;
prev: any;
params: any;
customer: string;
actions: {
taskPass?: (payload: DATA_CUSTOMER_PASS_PAYLOAD) => any;
};
rcreContext: RCREContextType;
containerContext: ContainerContextType;
iteratorContext?: IteratorContextType;
options: TRIGGER_SET_DATA_OPTIONS | undefined;
}
/**
* 自定义函数dataCustomer的传入参数
*/
export declare type FuncCustomerArgs = {
customer: string;
runTime: runTimeType;
model: string;
prev: any;
props: ContainerProps;
context: any;
params: any;
};
declare type DataCustomerItem = {
mode?: string;
config?: any;
func?: string | typeof Function;
};
/**
* DataCustomer是一个数据源输出端
* 它通过注入customer插件的形式, 把各种各样的数据消耗方加载进来
* 针对特殊的业务逻辑场景, 可以使用Group来使用链式调用
*/
export declare class DataCustomer extends EventEmitter {
static customerInstance: {
[name: string]: (config: any, params: CustomerParams) => any;
};
static funcCustomer: FunsCustomerController;
static errorHandler: Function;
parentCustomer?: DataCustomer | null;
customers: {
[name: string]: DataCustomerItem;
};
groups: {
[name: string]: {
steps: string[];
keepWhenError?: boolean;
};
};
static hasCustomerInstance(name: string): boolean;
static getCustomerInstance(name: string): (config: any, params: CustomerParams) => any;
static registerCustomerInstance(name: string, fn: CustomerInstance): void;
static deleteCustomerInstance(name: string): void;
static registerError(fn: Function): void;
constructor(parent?: DataCustomer | null);
depose(): void;
private handleCustomerError;
initCustomerConfig(info: TaskConfig): void;
getGroups(): {
[name: string]: {
steps: string[];
keepWhenError?: boolean | undefined;
};
};
execCustomerItem(customer: string, item: DataCustomerItem, params: CustomerParams): Promise;
execCustomer(params: CustomerParams): Promise;
}
export declare const Task: typeof DataCustomer;
export {};