@pact-foundation/pact-node
Version:
Core of @pact-foundation/pact. You almost certainly don't want to depend on this directly.
48 lines (47 loc) • 1.58 kB
TypeScript
/// <reference types="node" />
import events = require('events');
import q = require('q');
import { CliVerbOptions } from './spawn';
import { ChildProcess } from 'child_process';
import needle = require('needle');
interface AbstractServiceEventInterface {
START_EVENT: string;
STOP_EVENT: string;
DELETE_EVENT: string;
}
export declare abstract class AbstractService extends events.EventEmitter {
static get Events(): AbstractServiceEventInterface;
readonly options: ServiceOptions;
protected __argMapping: any;
protected __running: boolean;
protected __instance: ChildProcess | undefined;
protected __cliVerb?: CliVerbOptions;
protected __serviceCommand: string;
protected constructor(command: string, options: ServiceOptions, argMapping: any, cliVerb?: CliVerbOptions);
start(): q.Promise<AbstractService>;
stop(): q.Promise<AbstractService>;
delete(): q.Promise<AbstractService>;
protected spawnBinary(): ChildProcess;
protected __waitForServiceUp(): q.Promise<unknown>;
protected __waitForServiceDown(): q.Promise<unknown>;
private __call;
}
export interface ServiceOptions {
port?: number;
ssl?: boolean;
cors?: boolean;
host?: string;
sslcert?: string;
sslkey?: string;
log?: string;
logLevel?: LogLevel;
timeout?: number;
}
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
export interface HTTPConfig extends Omit<needle.NeedleOptions, 'headers'> {
headers: {
'X-Pact-Mock-Service': string;
'Content-Type': string;
};
}
export {};