/// /** * @module server */ /** End Typedoc Module Declaration */ import { Injector } from '@angular/core'; import { Logger } from '../../common/services/logger.service'; import { AbstractService } from '../../common/services/service'; import { AuthService } from './auth.service'; import Socket = SocketIO.Socket; export interface TableBorderTemplate { topBody?: string; topJoin?: string; topLeft?: string; topRight?: string; bottomBody?: string; bottomJoin?: string; bottomLeft?: string; bottomRight?: string; bodyLeft?: string; bodyRight?: string; bodyJoin?: string; joinBody?: string; joinLeft?: string; joinRight?: string; joinJoin?: string; } export interface TableBorderTemplateFactory { (name: string): TableBorderTemplate; } export interface TableConfig { columnDefault?: { width?: number; paddingLeft?: number; paddingRight?: number; }; columnCount?: number; columns?: { [key: number]: { width?: number; minWidth?: number; alignment?: 'center' | 'left' | 'right'; truncate: number; wrapWord: boolean; }; }; border?: TableBorderTemplate | TableBorderTemplateFactory; drawHorizontalLine: (index: number, size: number) => boolean; drawJoin: () => boolean; } export interface Table { (data: any[][], config?: TableConfig): string; } export interface ConnectedSocketCallback { (socket: Socket): void; } export interface RemoteCliContext { logger: Logger; authService: AuthService; } export interface AuthenticationStrategyFactory { (remoteCliContext: RemoteCliContext): AuthenticationStrategy; } export interface Authenticator { (args: any, cb: Function): void; } export interface AuthenticationStrategy { (vantage: any, options?: any): Authenticator; } export interface AuthenticationCallback { (errorMessage: string, isSuccessful: boolean): void; } /** * Class allows developers to register custom commands that can be remote executed in a * shell environment. Useful for things like migrations and debugging. */ export declare class RemoteCli extends AbstractService { private injector; protected authService: AuthService; /** * The instance of Vantage */ protected vantage: any; /** * Logger instance for the class, initialized with `remote-cli` source */ protected logger: Logger; constructor(loggerBase: Logger, injector: Injector, authService: AuthService); /** * Initialize the vantage client * @returns {RemoteCli} */ initialize(): this; /** * Registers the pre-defined commands */ protected registerCommands(): this; /** * Starts the Vantage server. This is done on start of the server so debugging can start * immediately * @param port * @param callback */ start(port: number, callback?: ConnectedSocketCallback): this; /** * Constructs table string for output to the cli * @see https://github.com/gajus/table * @param data * @param config * @returns {string} */ makeTable(data: any[][], config?: TableConfig): string; /** * Register the authentication strategy with vantage */ protected registerAuthenticationStrategy(): void; }