UNPKG

@godspeedsystems/core

Version:

> 4th Generation Declarative Microservice Framework

42 lines (41 loc) 1.37 kB
import { PlainObject } from './common'; import { GSFunction } from './interfaces'; type BaseJSON = { fn?: string; id?: string; workflow_name?: string; on_error?: OnError; }; export type WorkflowJSON = BaseJSON & { tasks: Array<TaskJSON>; }; type OnError = { tasks: TasksJSON | GSFunction | null; }; type TasksJSON = Array<TaskJSON> & { workflow_name?: string; }; type TaskJSON = BaseJSON & { isEachParallel?: boolean; authz?: TasksJSON | GSFunction; args: any; }; export type NativeFunctions = { [key: string]: Function | null; }; /** * * @param json a workflow or array of yaml tasks or a single yaml task * @param workflows all workflows that exist whether loaded yet or in json form and yet to be loaded. * @param nativeFunctions * @param onError * @returns GSFunction or null (in case of com.gs.elif or com.gs.else) */ export declare function createGSFunction(json: WorkflowJSON | TasksJSON | TaskJSON, workflows: PlainObject, nativeFunctions: NativeFunctions, onError: OnError | null, location: PlainObject): GSFunction | null; export type LoadedFunctions = { nativeFunctions: NativeFunctions; functions: PlainObject; success: boolean; }; export default function loadFunctions(datasources: PlainObject, pathString: string): Promise<LoadedFunctions>; export {};