export type RoleConfigurationMode = 'default' | 'default-except' | 'all-except' | 'only'; export interface RoleConfiguration { mode: RoleConfigurationMode; roles: any[]; } /** * Role registration information. Use this when your module provides a service which should support being turned on and * off at runtime. */ export interface RoleRegistration { /** * The instance of the module being registered. This should be `this` for the caller in most cases, as it should be * called from an Alterior module's `altOnInit()` method. */ instance?: any; /** * Set to false to cause this role to be disabled unless explicitly asked for. When unspecified, the default is * true. */ enabledByDefault?: boolean; /** * The identifier that will be matched when interpreting command line role enablements. */ identifier: string; /** * The human readable name for this role. */ name: string; /** * A short (one sentence) summary which may be shown in command line help output and other places. */ summary: string; /** * Start services associated with this role. * For instance, an HTTP server module would start it's HTTP server. */ start(): Promise; /** * Stop services associated with this role. */ stop(): Promise; } export interface RoleState extends RoleRegistration { class: any; running: boolean; } /** * Roles allow runtime configuration of which outward facing services to start. * For instance WebServerModule and TasksModule both register their respective roles, * so that they can be easily turned on and off when the application is called. * */ export declare class RolesService { constructor(); _configuration: RoleConfiguration; _roles: RoleState[]; get configuration(): RoleConfiguration; /** * Register a role which can be managed by this service. */ registerRole(role: RoleRegistration): void; get roles(): RoleState[]; /** * Calculate the exact list of roles the configuration currently applies to. */ get effectiveRoles(): RoleState[]; get activeRoles(): RoleState[]; /** * Configure which roles should be run by this service */ configure(config: RoleConfiguration): void; getForModule(roleModuleClass: Function): RoleState; getById(id: string): RoleState; restartAll(): Promise; silent: boolean; startAll(): Promise; stopAll(): Promise; } //# sourceMappingURL=roles.service.d.ts.map