core/src/core/coreref.ts

55 lines
1.5 KiB
TypeScript

import { ChannelManager } from '../channel';
import { NPMExecutor } from '../npm';
import { PluginManager, PluginMetaLoader } from '../plugin';
import { RepositoryManager } from '../plugin/repository';
import { Configuration, IEnvironment } from '../types';
import { ScopedEventEmitter } from '../util';
/**
* Reference of a fully featured Squeebot core.
* Recommended implementation of a squeebot runner implements this interface.
*/
export interface ISqueebotCore {
/**
* Squeebot environment information, mainly paths
*/
environment: IEnvironment;
/**
* NPM executor. Used to install and upgrade packages programmatically.
*/
npm: NPMExecutor;
/**
* Main scoped event stream.
*/
stream: ScopedEventEmitter;
/**
* Squeebot plugin manager. Hot load/unload/restart functionality.
*/
pluginManager: PluginManager;
/**
* Squeebot plugin repository manager. Hot install/uninstall/update functionality.
*/
repositoryManager: RepositoryManager;
/**
* Squeebot message channel manager. Used to route events between plugins.
*/
channelManager: ChannelManager;
/**
* Squeebot plugin metadata/manifest loader.
*/
pluginLoader: PluginMetaLoader;
/**
* Squeebot main configuration file.
*/
config: Configuration;
/**
* Initialize all Squeebot components.
* @param autostart Automatically start everything (load plugins, etc)
*/
initialize(autostart: boolean): Promise<void>;
/**
* Trigger a graceful shutdown.
*/
shutdown(): void;
}