import { EventEmitter } from "stream"; import { PLATFORMS } from "../src/config/constants"; declare namespace kumologica { type KLHttpInNode = { id: string, type: 'http in', name: string, url: string, method: string, upload: boolean, swaggerDoc: string, x: number, y: number, wires: string[][], App: NodeApp, debug: LogFn, trace: LogFn, warn: LogFn, info: LogFn, log: LogFn, error: (error: Error, msg?: Message) => void, } type LogFn = (msg: Message, ...args: any[]) => void; type Node = { App: NodeApp, debug: LogFn, trace: LogFn, warn: LogFn, info: LogFn, log: LogFn, error: (error: Error, msg?: Message) => void, }; type NodeProps = { // Specific to each node [key: string]: any; } type NodeApp = { dynamicHandlers: any, expressApp: any, flowFile: string, middlewares: any, // internal types } type PlatformType = keyof typeof PLATFORMS type Message = { _msgid: string; header: any; payload: any; } type AppSettings = { adminEnabled: boolean, adminPort: number, adminSecured: boolean, basePath: string, // eg. '/path/to/flow' ... excluding the flow.json coreNodesDir: string, // eg. 'packages/runtime/src/nodes flowFile: string, // eg. 'flows.json' functionGlobalContext: KVPair, host: string, httpNodeRoot: string, // eg. '/' logging: { console: { level: 'trace' | 'debug' | 'info' | 'warn' | 'error' }, metrics: boolean, audit: boolean }, middlewares: any[], platform: PlatformType, plugins: any[], port: number, projectDir: string, // alias to basePath userDir: string, // alias to basePath version: string } interface KVPair { [key: string]: string; } type NodePropType = 'str' | 'json' | 're' | 'date' | 'bin' | 'msg' | 'flow' | 'global' | 'props' | 'vars' | 'bool' | 'jsonata' | 'env' ; type JSONataExpression = any; type EncodeObjectOpts = { maxLength?: number; } type CallbackFunction = (...params: any[]) => void; interface App { // TODO: validate comms: { publish(topic: string, data: any, retain: boolean): void; }, events: EventEmitter, httpAdmin: any, httpNode: NodeApp, library: { register(type: string): void; }, log: { warn(msg: Message): void, error(msg: Message): void, trace(msg: Message): void, debug(msg: Message): void, info(msg: Message): void, log(msg: Message): void }, nodes: { createNode(node: any, def: any): Node, registerType(type: string, constructor: any, opts: any): void, eachNode(cb: (node: Node) => void): void, findNodesOfType(type: string): Node[], getNode(id: string): Node }, pluginRegistry: any, settings: AppSettings, util: { evaluateDynamicField: (field: string, msg: Message, node: Node) => any; encodeObject(msg: Message, opts: EncodeObjectOpts): Message; ensureString(input: any): string; ensureBuffer(input: any): Buffer; cloneMessage(msg: Message, removePrivateProps: boolean | false): Message; compareObjects(obj1: any, obj2: any): boolean; generateId(): string; getMessageProperty(msg: Message, property: string): any; getObjectProperty(object: any, property: string): any; setObjectProperty(object: any, property: string, value: any): void; evaluateNodeProperty(value: any, type: NodePropType, msg: Message, nodeContext: any): any; prepareJSONataExpression(value: any, node: Node): JSONataExpression; evaluateJSONataExpression(expression: JSONataExpression, msg: Message, cb?: CallbackFunction): any; parseContextStore(key: string): {type: string, key: string}; readJSONFile(filename: string): any; readJSONSync(filename: string): any; fileExists(filepath: string): boolean; getRemainingTimeInMillis(msg: Message): undefined | number; getSafeTimeout(msg: Message, timeoutDesired: number): number; getGlobalEventEmitter(): EventEmitter; getOriginalNodeId(universalNodeId: string): string; getVars(node: Node): KVPair; getDateTimeISOString(): string; }, version: () => string } }