import { IExecution, IItem, IModelsDatastore, IDataStore, ICacheManager, IScriptHandler } from '../'; interface IConfiguration { definitionsPath?: string; templatesPath?: string; timers: { forceTimersDelay: number; precision: number; }; database: IMongoDBDatabaseConfiguration | ISQLiteDatabaseConfiguration; apiKey: string; logger: ILogger; definitions(server: any): IModelsDatastore; appDelegate(server: any): IAppDelegate; dataStore(server: any): IDataStore; scriptHandler(server: any): IScriptHandler; cacheManager(server: any): ICacheManager; } interface IDatabaseConfigurationBase { loopbackRepositories?: any; } interface IMongoDBDatabaseConfiguration extends IDatabaseConfigurationBase { MongoDB: { db_url: string; db: string; Locks_collection: string; Instance_collection: string; Archive_collection: string; }; } interface ISQLiteDatabaseConfiguration extends IDatabaseConfigurationBase { SQLite: { db_connection: string; }; } /** * A logging tool to take various message for monitoring and debugging * * it can also keep the message in memory till saved later through saveToFile * msgs can be cleared by the clean method * * */ interface ILogger { /** * * @param toConsole boolean * writes to the output console * @param toFile string * writes to file * */ setOptions({ toConsole, toFile, callback }: { toConsole: any; toFile: any; callback: any; }): void; clear(): void; get(): any[]; debug(...message: any): void; warn(...message: any): void; log(...message: any): void; error(err: any): void; reportError(err: any): void; save(filename: any): Promise; saveForInstance(instanceId: string): any; } /** * Object to respond to all named services */ interface IServiceProvider { [serviceName: string]: CallableFunction | IServiceProvider; } /** * Application Delegate Object to respond to various events and services: * * 1. receive all events from workflow * 2. receive service calls * 3. receive message and signal calls * 4. execute scripts * * */ interface IAppDelegate { moddleOptions: any; /** * Get the service task handlers, default to `this`, so you can add handlers on this class directly. */ getServicesProvider(execution: IExecution): IServiceProvider | Promise; sendEmail(to: any, msg: any, body: any): any; executionStarted(execution: IExecution): any; startUp(options: any): any; messageThrown(signalId: string, data: any, messageMatchingKey: any, item: IItem): any; signalThrown(signalId: string, data: any, messageMatchingKey: any, item: IItem): any; /** * * is called when an event throws a message that can not be answered by another process * * @param messageId * @param data */ issueMessage(messageId: string, data: any): any; issueSignal(messageId: string, data: any): any; /** * is called only if the serviceTask has no implementation; otherwise the specified implementation will be called. * * @param item */ serviceCalled(input: Record, execution: IExecution, item: IItem): unknown; } export { ILogger, IAppDelegate, IConfiguration, IServiceProvider };