@hotmeshio/hotmesh
Version:
Serverless Workflow
49 lines (48 loc) • 2.02 kB
TypeScript
import { JobState, JobData } from '../../types/job';
import { PipeContext, PipeItem, PipeItems, Pipe as PipeType } from '../../types/pipe';
declare class Pipe {
rules: PipeType;
jobData: JobData;
context: PipeContext;
constructor(rules: PipeType, jobData: JobData, context?: PipeContext);
private isPipeType;
private isreduceType;
static isPipeObject(obj: {
[key: string]: unknown;
} | PipeItem): boolean;
static resolve(unresolved: {
[key: string]: unknown;
} | PipeItem, context: Partial<JobState>): any;
/**
* loop through each PipeItem row in this Pipe, resolving and transforming line by line
* @returns {any} the result of the pipe
*/
process(resolved?: unknown[] | null): any;
cloneUnknown<T>(value: T): T;
/**
* Transforms iterable `input` into a single value. Vars $output, $item, $key
* and $input are available. The final statement in the iterator (the reduction)
* is assumed to be the return value. A default $output object may be provided
* to the iterator by placing the the second cell of the preceding row. Otherwise,
* construct the object during first run and ensure it is the first cell of the
* last row of the iterator, so it is returned as the $output for the next cycle
* @param {unknown[]} input
* @returns {unknown}
* @private
*/
reduce(input: Array<unknown[]>): unknown;
private processRow;
static resolveFunction(functionName: string): any;
processCells(cells: PipeItems): unknown[];
private isFunction;
private isContextVariable;
private isMappable;
resolveCellValue(currentCell: PipeItem): unknown;
private getNestedProperty;
resolveMappableValue(currentCell: string): unknown;
resolveContextValue(currentCell: string): unknown;
resolveContextTerm(currentCell: string): string;
resolveFunctionTerm(currentCell: string): string;
resolveMapTerm(currentCell: string): string;
}
export { Pipe };