UNPKG

774 BTypeScriptView Raw
1import { OpConfig } from '../interfaces';
2import { DataEntity } from '@terascope/utils';
3import ProcessorCore from './core/processor-core';
4/**
5 * A variation of Processor that can process a single DataEntity at a time.
6 * This processor should return a modified DataEntity.
7 */
8export default abstract class MapProcessor<T = OpConfig> extends ProcessorCore<T> {
9 /**
10 * Called by {@link Processor#handle} and will handle single {@link DataEntity}
11 * @returns a DataEntity
12 */
13 abstract map(data: DataEntity): DataEntity;
14 /**
15 * A generic method called by the Teraslice framework, calls {@link #map}
16 * @param input an array of DataEntities
17 * @returns an array of DataEntities
18 */
19 handle(input: DataEntity[]): Promise<DataEntity[]>;
20}