UNPKG

unmock-core

Version:

[![npm](https://img.shields.io/npm/v/unmock-core.svg)][npmjs] [![CircleCI](https://circleci.com/gh/unmock/unmock-js.svg?style=svg)](https://circleci.com/gh/unmock/unmock-js) [![codecov](https://codecov.io/gh/unmock/unmock-js/branch/dev/graph/badge.svg)](h

75 lines 2 kB
/// <reference types="node" /> import { UnmockOptions } from "./options"; import { IService } from "./service/interfaces"; export interface ILogger { log: (message: string) => void; } export interface IMetaData { lang?: string; } export interface IRequestData { body?: string; headers?: any; host?: string; method?: string; path?: string; } export interface IResponseData { body?: string; headers?: any; } export interface IBackend { initialize: (opts: UnmockOptions) => any; reset: () => void; } export interface IUnmockOptions { logger?: ILogger; signature?: string; whitelist?: string[] | string; useInProduction?: boolean; } export interface IIncomingHeaders { [header: string]: string | string[] | undefined; } export interface IOutgoingHeaders { [header: string]: string | string[] | number | undefined; } export interface ISerializedRequest { body?: string; headers?: IIncomingHeaders; host: string; method: string; path: string; protocol: "http" | "https"; } export declare type IMockRequest = { [P in keyof ISerializedRequest]?: ISerializedRequest[P] | RegExp; }; export interface ISerializedResponse { body?: string; headers?: IOutgoingHeaders; statusCode: number; } export interface IMock { request: IMockRequest; response: ISerializedResponse; } export declare type CreateResponse = (request: ISerializedRequest) => ISerializedResponse | undefined; export declare type RequestToSpec = (sreq: ISerializedRequest) => any; export declare type GeneratedMock = any; export interface IServiceDefLoader { load(): Promise<IServiceDef[]>; loadSync(): IServiceDef[]; } export interface IServiceDefFile { basename: string; contents: string | Buffer; } export interface IServiceDef { directoryName: string; serviceFiles: IServiceDefFile[]; } export interface IServiceParser { parse(serviceDef: IServiceDef): IService; } //# sourceMappingURL=interfaces.d.ts.map