import type { ProcessDestroySignal, HandlerBuilderFunc, RunnerServices, StopFunc, HandlerFunc, RunnerTrigger, AnyObject, Source } from '../typings'; import type { IncomingMessage, Server, ServerResponse } from 'http'; import type { MessageOptions, Route } from '../services/broker'; import { Command } from 'commander'; import type Datastore from './Datastore'; declare let server: Server | null; export interface ProcessingStats { processingTimeWindowInMilliseconds: number; queuing: number; waiting: number; waited: number; processing: number; processed: number; progress: number; totalWaitingDurationInMilliseconds: number; averageWaitingDurationInMilliseconds: number; totalProcessingDurationInMilliseconds: number; averageProcessingDurationInMilliseconds: number; maxParallelEvents: number; } export declare function getServer(): Server | null; export declare function setServer(_server: typeof server): Server | null; export declare function log(services: RunnerServices | undefined, options: { verbose?: boolean; }, level: string, message: string, context?: { [key: string]: any; }): void; export declare function init(services: RunnerServices, stopHandler: StopFunc, options: any): void; export declare function signalHandler(services: RunnerServices, stopHandler: StopFunc, options: any, signal: ProcessDestroySignal, destroyHandler?: typeof destroy): () => Promise; export declare function errorHandler(services: RunnerServices, stopHandler: StopFunc, options: any, signal: ProcessDestroySignal, destroyHandler?: typeof destroy): (err: Error) => Promise; /** * Cleanup and stop the process properly, then exit the process. * @param signal - Signal to stop the process with * @param err - Error that caused the destruction of the process */ export declare function destroy(services: RunnerServices | undefined, stopHandler: StopFunc | undefined, options: any, signal: ProcessDestroySignal, err?: Error): Promise; export declare function stop(services?: RunnerServices, options?: any, stopHandler?: StopFunc): Promise; export declare function heartbeat(port?: string | undefined): Promise<{ app: import("express-serve-static-core").Express; server: Server; port: string | undefined; }>; export declare function getDatastoreFromTrigger(services: RunnerServices, trigger: RunnerTrigger, options: { timeout: number; }): Promise; export declare function mapReceivedData(input: string | object, raw: boolean): string | object; export declare function readyForProcessing(stats: ProcessingStats): boolean; export declare function waitForProcessing(stats: ProcessingStats, queueId: number, waitTimeInMilliseconds?: number, maxWaitInMilliseconds?: number): Promise; export declare function isDataProcessed(services: RunnerServices, datastore: string, model: string, input: any, processingStateIndex: number, processing?: RunnerTrigger['processing']): Promise; export declare function shouldProcessData(services: RunnerServices, datastore: string, model: string, input: any, processing?: RunnerTrigger['processing']): Promise; export declare function getProcessingStats(from?: Partial): ProcessingStats; export declare function localEventHandler(services: RunnerServices, handler: HandlerFunc, handlerId: string, datastore: string, model: string, source: Source, raw: boolean, stats?: ProcessingStats, processing?: RunnerTrigger['processing']): (input: string | object, route?: Route, headers?: AnyObject, opts?: MessageOptions) => Promise; export declare function buildHandler(handlerId: string, cmd: any, handlersForTest?: { [key: string]: HandlerBuilderFunc; }): Promise<{ services: RunnerServices; triggers: RunnerTrigger[]; stop: StopFunc; handler: HandlerFunc; }>; export declare function start(): (handlerIds: string[], options: any, command: any, handlersForTest?: { [key: string]: HandlerBuilderFunc; }) => Promise; export declare function replayHandler(handlerId: string, options: any, services: RunnerServices, triggers: RunnerTrigger[], stopHandler: StopFunc, handler: HandlerFunc): Promise; export declare function replay(): (handlerIds: string[], options: any, command: any, handlersForTest?: { [key: string]: HandlerBuilderFunc; }) => Promise; export default function register(name?: string): Command; export {};