import { BpmsEngine } from '../BpmsEngine'; import { DataSourceRepository } from './DataSourceRepository'; import { QueryOptions, QueryResult, ScalarOptions, FilterExpression } from './Repository'; import { BpmsService } from '../BpmsService'; export interface DataSourceServiceOptions { name: string; datasourceRepository?: DataSourceRepository; } export interface DataSourceSchema { name: string; find(fn: (item: T, index: number) => boolean): Promise; list(): Promise; create(data: T): Promise; remove(data: T | string | number): Promise; count(): Promise; } export declare type DataSourceObjectSchema = DataSourceSchema>; export interface DataSourceWebApiSchema extends DataSourceSchema { url?: string; params?: any; method?: 'POST' | 'GET' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS'; } export interface DataSourceRestApiSchema extends DataSourceSchema { url?: string; params?: any; } export interface DataSourceDefinition { sources: Array>; } export interface BpmsDataSource { id?: string; name: string; definition: DataSourceDefinition; createdAt?: Date; } export declare class DataSourceService implements BpmsService { private datasourceCache; private id; private name; private datasourceRepository; private options; private bpmsEngine; constructor(options?: DataSourceServiceOptions); constructor(bpmsEngine?: BpmsEngine, options?: DataSourceServiceOptions); get Id(): string; get Name(): string; get BpmsEngine(): BpmsEngine | undefined; static createEngine(options?: DataSourceServiceOptions): DataSourceService; static createEngine(bpmsEngine?: BpmsEngine, options?: DataSourceServiceOptions): DataSourceService; create(dataSource: T): Promise; remove(dataSourceId: string): Promise; clear(): Promise; find(dataSourceId: string): Promise; list(filter?: FilterExpression): Promise; count(filter?: FilterExpression): Promise; query(options: QueryOptions): Promise>; scalar(options: ScalarOptions): Promise; }