/** * Defines the available interface on a Mirage server. * This is not an exhaustive list but exposes some of the api that's used within the app */ export interface IMirageServer { options: object; urlPrefix: string; namespace: string; timing: number; logging: boolean; pretender: object; environment: string; get: (this: IMirageServer, path: string, ...args: Array) => void; post: (this: IMirageServer, path: string, ...args: Array) => void; put: (this: IMirageServer, path: string, ...args: Array) => void; delete: (this: IMirageServer, path: string, ...args: Array) => void; del: (this: IMirageServer, path: string, ...args: Array) => void; patch: (this: IMirageServer, path: string, ...args: Array) => void; head: (this: IMirageServer, path: string, ...args: Array) => void; isTest: (this: IMirageServer) => boolean; passthrough: (...paths: Array) => void; loadFixtures: (...files: Array) => void; loadFactories: (factoryMap: object) => void; create: (type: string, options?: object) => object; createList: (type: string, amount: number, traitsAndOverrides?: object) => Array; shutdown: (this: IMirageServer) => void; } /** * Describes the public interface for the IBaseRouteHandler */ interface IBaseRouteHandler { getModelClassFromPath: (fullPath: string) => string; } /** * Describes the interface for the IFunctionRouteHandler: the execution context for route handlers in * Mirage's config file - mirage/config.ts */ export interface IFunctionRouteHandler extends IBaseRouteHandler { handle: (request: any) => any; setRequest: (request: any) => void; serialize: (response: any, serializerType?: string) => any; normalizedRequestAttrs: () => any; }