import pathToRegexp from 'path-to-regexp'; interface BootOptions { name?: string; noProxy?: boolean; prependServerURL?: boolean; modifyRequest?: ModifyRequest; noPolyfill?: boolean; noWebSocket?: boolean; host?: string; port?: number; adminHost?: string; adminPort?: number; portHttps?: number; suiteHeader?: string; suiteCookie?: string; ignorePrefix?: string; latency?: Responder; fetch?: WindowOrWorkerGlobalScope['fetch']; aliases?: string[][]; responseHeaders?: boolean; fileResolver?: (filePath: string) => Promise; fixtureResolver?: (filePath: string) => Promise; mockSuiteResolver?: MockSuiteResolver; devTools?: boolean; devToolsTimeout?: number; devToolsInterval?: number; serviceWorker?: boolean; serviceWorkerRegister?: boolean; serviceWorkerURL?: string; serviceWorkerScope?: string; } declare type MethodLower = 'get' | 'put' | 'delete' | 'post' | 'options' | 'patch'; declare type MethodUpper = 'GET' | 'PUT' | 'DELETE' | 'POST' | 'OPTIONS' | 'PATCH'; declare type Method = MethodLower | MethodUpper; declare type MethodOrAll = Method | 'all' | 'ALL' | '*'; interface JsonObject { [key: string]: Json; } declare type JsonPrimitive = string | number | boolean | null; declare type Json = JsonPrimitive | JsonPrimitive[] | JsonObject | JsonObject[]; declare type ModifyRequest = (req: RequestForHandler) => RequestForHandler | RequestForHandler[]; interface RequestForHandler { url: string; path?: string; method: Method; query?: DeepObjectOfStrings; headers?: Record; cookies?: Record; body?: any; } interface ResponseObject { status?: number; headers?: Record; body?: any; } declare type ResponderResult = T | Promise; declare type ResponderFunction = ((req: RequestForHandler, res?: ResponseObject) => T) | ((req: RequestForHandler, res?: ResponseObject) => Promise); declare type Responder = ResponderResult | ResponderFunction; interface ResponseOptionsObject { name?: string; json?: Responder; text?: Responder; html?: Responder; raw?: Responder; filePath?: Responder; fixture?: Responder; status?: Responder; type?: Responder; latency?: Responder; headers?: Responder>; } declare const responseOptionsResponderKeys: string[]; declare type ResponseOptions = string | ResponseOptionsObject; declare type MatcherFunction = (arg: T) => boolean | undefined; declare type Matcher = T | MatcherFunction; declare type MatchString = Matcher | RegExp; declare type VerifyCallback = (err?: Error) => void; declare type RunHandler = (callback: (err?: Error) => void) => Promise | void; declare type RunHandlerOrPromise = RunHandler | Promise; interface DeepObjectOfStrings { [key: string]: string | DeepObjectOfStrings; } interface MatchDeepObjectOfStrings { [key: string]: MatchString | MatchDeepObjectOfStrings; } declare type MatcherDeepObjectOfStrings = MatchDeepObjectOfStrings | MatcherFunction; declare type ObjectOfStrings = Record; declare type MatchObjectOfStrings = Record; declare type MatcherObjectOfStrings = MatchObjectOfStrings | MatcherFunction; interface Expectation { request(request: RequestForHandler): void; api(match: MatchObject): Expectation; atLeast(num: number): Expectation; atMost(num: number): Expectation; never(): Expectation; once(): Expectation; twice(): Expectation; thrice(): Expectation; exactly(number: number): Expectation; path(path: string): Expectation; url(url: string): Expectation; header(name: string, value: string): Expectation; params(match: MatcherDeepObjectOfStrings): Expectation; query(match: MatcherDeepObjectOfStrings): Expectation; body(match: any): Expectation; verifier(fn: () => void): (err?: Error) => void; run(handlerOrPromise: RunHandlerOrPromise): Expectation; verify(callback: VerifyCallback): void; } interface MatchMeta { id?: string; fn?: string; regex?: RegExp; matchKeys?: pathToRegexp.Key[]; original?: Match; originalNormal?: MatchObject; originalSerialized?: MatchObject; expectation?: Expectation; } interface MatchObject { url?: MatchString & { toStringForMatchDeep?: () => string | undefined; }; path?: MatchString; method?: MatchString; query?: MatcherDeepObjectOfStrings; headers?: MatcherObjectOfStrings; cookies?: MatcherObjectOfStrings; body?: any; status?: Matcher; $meta?: MatchMeta; } interface MatchFunction { (req: RequestForHandler): boolean; $meta?: MatchMeta; } declare type MatchNormal = (MatchObject & { url(value: string): boolean; }) | MatchFunction; declare type Match = string | RegExp | MatchObject | MatchFunction; declare type Mock = [Match, ResponseOptions]; declare type MockSuite = Mock[]; declare type MockSuiteResolver = (suiteName: string) => Promise; declare type MockNormal = [MatchNormal, ResponseOptionsObject]; interface MockReturn { id: string; removedIds: string[]; expect(match: Match): Expectation; } declare type MockFunction = (match: Match, res?: ResponseOptions) => MockReturn; interface MakeMockOptions { name?: string; keepExisting?: boolean; } interface MakeMockReturn { mock: MockNormal; removed: MockNormal[]; removedIndex?: number; } interface FetchOptions { dynamicMocks?: Mock[]; dynamicMockSuite?: string; noProxy?: boolean; } interface Action { type?: string; payload?: Record; } interface ActionMockyeahServiceWorkerDataResponse { type?: 'mockyeahServiceWorkerDataResponse'; payload?: { requestId?: string; response?: ResponseObject; }; } interface ActionMockyeahServiceWorkerDataRequest { type?: 'mockyeahServiceWorkerDataRequest'; payload?: { requestId?: string; }; } export { Json, BootOptions, FetchOptions, Method, MethodOrAll, ResponseOptions, ResponseOptionsObject, Responder, ResponderFunction, ResponderResult, ResponseObject, Matcher, MatcherDeepObjectOfStrings, MatcherObjectOfStrings, Match, MatchFunction, MatchObject, MatchString, MatchNormal, Mock, MockSuite, MockSuiteResolver, MockNormal, MockFunction, MockReturn, RequestForHandler, Expectation, VerifyCallback, RunHandler, RunHandlerOrPromise, Action, MakeMockOptions, MakeMockReturn, responseOptionsResponderKeys, ActionMockyeahServiceWorkerDataResponse, ActionMockyeahServiceWorkerDataRequest };