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

51 lines 2.42 kB
import { OpenAPIObject, Operation, PathItem, Schema } from "loas3/dist/src/generated/full"; import { ISerializedRequest } from "../interfaces"; import { IDSL, ITopLevelDSL } from "./dsl/interfaces"; export { Header, isOperation, isReference, isSchema, MediaType, OpenAPIObject, Paths, Schema, Operation, Parameter, PathItem, Reference, Response, Responses, } from "loas3/dist/src/generated/full"; declare const RESTMethodTypes: readonly ["get", "head", "post", "put", "patch", "delete", "options", "trace"]; declare const DEF_REST_METHOD: readonly ["any"]; declare type DEFAULT_HTTP_METHOD_AS_TYPE = typeof DEF_REST_METHOD[number]; export declare type HTTPMethod = typeof RESTMethodTypes[number]; export declare type ExtendedHTTPMethod = HTTPMethod | DEFAULT_HTTP_METHOD_AS_TYPE; export declare type OASMethodKey = keyof PathItem & HTTPMethod; export declare const isRESTMethod: (maybeMethod: string) => maybeMethod is "get" | "head" | "post" | "put" | "patch" | "delete" | "options" | "trace"; export declare const isExtendedRESTMethod: (maybeMethod: string) => maybeMethod is ExtendedHTTPMethod; export interface IServiceMapping { [serviceName: string]: IService; } export interface IStateInputGenerator { isEmpty: boolean; gen: (schema: Schema) => Record<string, Schema> | Schema; top: ITopLevelDSL; } export declare const isStateInputGenerator: (u: any) => u is IStateInputGenerator; export interface IStateInput { method: ExtendedHTTPMethod; endpoint: string; newState: IStateInputGenerator; } export interface IServiceInput { schema: OpenAPIObject; name: string; } export declare type mediaTypeToSchema = Record<string, Schema>; export declare type codeToMedia = Record<string, mediaTypeToSchema>; export declare type MatcherResponse = { operation: Operation; state: codeToMedia | undefined; } | undefined; export interface IService { readonly name: string; readonly schema: OpenAPIObject; hasDefinedPaths: boolean; updateState(input: IStateInput): void; resetState(): void; match(sreq: ISerializedRequest): MatcherResponse; } interface INestedState<T> { [key: string]: INestedState<T> | T; } interface IUnmockServiceState extends INestedState<IDSL | string | number | (() => string | number) | undefined | boolean> { } export declare type UnmockServiceState = IUnmockServiceState & ITopLevelDSL; //# sourceMappingURL=interfaces.d.ts.map