UNPKG

@paultaku/node-mock-server

Version:

A TypeScript-based mock server with automatic Swagger-based mock file generation

46 lines 1.65 kB
/** * Status Tracker * * Manages the state of mock responses for each endpoint. * Handles reading and writing status.json files. */ export interface StatusJson { selected: string; delayMillisecond?: number; } /** * Get the path to status.json for an endpoint * @param mockRoot - Mock root directory * @param endpointPath - API path like /pet/{petId} * @param method - HTTP method (GET/POST/...) * @returns Path to status.json file */ export declare function getStatusJsonPath(mockRoot: string, endpointPath: string, method: string): string; /** * Read status.json file * @param statusPath - Path to status.json file * @returns StatusJson object or null if not found/invalid */ export declare function readStatusJson(statusPath: string): Promise<StatusJson | null>; /** * Write status.json file (atomic write) * @param statusPath - Path to status.json file * @param selected - Selected mock filename */ export declare function writeStatusJson(statusPath: string, selected: string): Promise<void>; /** * Initialize selected mock status for all endpoints * Loads all status.json files and builds a state map * @param mockRoot - Mock root directory * @param templates - All endpoint templates array * @returns Map of stateKey to selectedMockFile */ export declare function loadAllStatusJson(mockRoot: string, templates: string[][]): Promise<Map<string, string>>; /** * Get the mock state key for an endpoint * @param path - API path * @param method - HTTP method * @returns State key string */ export declare function getMockStateKey(path: string, method: string): string; //# sourceMappingURL=status-tracker.d.ts.map