/// import { Evented, EventObject, Handle, CancellablePromise } from '@theintern/common'; import { ChildProcess } from 'child_process'; import { JobState } from './interfaces'; export default class Tunnel extends Evented implements TunnelProperties { environmentUrl: string | undefined; accessKey: string | undefined; username: string | undefined; architecture: string; auth: string | undefined; directory: string; executable: string; hostname: string; pathname: string; platform: string; port: string; protocol: string; proxy: string | undefined; tunnelProxy: string | undefined; tunnelId: string | undefined; url: string; verbose: boolean; protected _startTask: CancellablePromise | undefined; protected _stopTask: Promise | undefined; protected _handle: Handle | undefined; protected _process: ChildProcess | undefined; protected _state: 'stopped' | 'starting' | 'running' | 'stopping'; constructor(options?: TunnelOptions); get clientUrl(): string; get extraCapabilities(): object; get isDownloaded(): boolean; get isRunning(): boolean; get isStarting(): boolean; get isStopping(): boolean; download(forceDownload?: boolean): CancellablePromise; getEnvironments(): CancellablePromise; sendJobState(_jobId: string, _data: JobState): CancellablePromise; start(): CancellablePromise; stop(): Promise; protected _downloadFile(url: string | undefined, proxy: string | undefined, options?: DownloadOptions): CancellablePromise; protected _makeArgs(..._values: string[]): string[]; protected _makeChild(executor: ChildExecutor, ...values: string[]): CancellablePromise; protected _makeOptions(..._values: string[]): { env: NodeJS.ProcessEnv; }; protected _normalizeEnvironment(environment: Object): NormalizedEnvironment; protected _postDownloadFile(data: Buffer, options?: DownloadOptions): Promise; protected _start(executor: ChildExecutor): CancellablePromise; protected _stop(): Promise; } export interface TunnelEventObject extends EventObject { readonly target: T; } export interface TunnelEvents { stdout: IOEvent; stderr: IOEvent; status: StatusEvent; downloadprogress: DownloadProgressEvent; [index: string]: any; } export interface IOEvent extends TunnelEventObject { readonly type: 'stdout' | 'stderr'; readonly data: string; } export interface StatusEvent extends TunnelEventObject { readonly type: 'status'; readonly status: string; } export interface DownloadProgressEvent extends TunnelEventObject { readonly type: 'downloadprogress'; readonly url: string; readonly total: number; readonly received: number; } export interface ChildExecutor { (child: ChildProcess, resolve: () => void, reject: (reason?: any) => void): Handle | void; } export interface DownloadProperties { directory: string | undefined; proxy: string | undefined; url: string; } export declare type DownloadOptions = Partial; export interface NormalizedEnvironment { browserName: string; browserVersion?: string; descriptor: Object; platform: string; platformName?: string; platformVersion?: string; version: string; intern: { platform: string; browserName: string; version: string; }; } export interface TunnelProperties extends DownloadProperties { architecture: string; auth: string | undefined; accessKey: string | undefined; executable: string | undefined; hostname: string; pathname: string; platform: string; port: string; protocol: string; tunnelProxy: string | undefined; tunnelId: string | undefined; username: string | undefined; verbose: boolean; } export declare type TunnelOptions = Partial;