@paultaku/node-mock-server
Version:
A TypeScript-based mock server with automatic Swagger-based mock file generation
56 lines • 1.9 kB
TypeScript
/**
* ScenarioApplicator Implementation
*
* Applies scenario configurations to endpoint status.json files.
* Updates the mock server's active endpoint configurations.
*
* @see specs/004-scenario-management/data-model.md
* @see tests/unit/scenario-applicator.test.ts
*/
import { Scenario, EndpointConfiguration, ScenarioApplicationResult } from "../../shared/types/scenario-types";
/**
* Service for applying scenario configurations to endpoints
*
* Updates status.json files in endpoint directories:
* mock/{path}/{METHOD}/status.json
*
* Example:
* - Path: /pet/status, Method: GET
* - Status file: mock/pet/status/GET/status.json
*/
export declare class ScenarioApplicator {
private readonly mockRoot;
/**
* @param mockRoot Absolute path to mock directory root (default: mock/)
*/
constructor(mockRoot?: string);
/**
* Apply all endpoint configurations from a scenario
*
* Processes all endpoints in parallel and collects results.
* Does not throw on individual endpoint failures - check result.failures instead.
*
* @param scenario The scenario to apply
* @returns Result containing successes and failures
*/
apply(scenario: Scenario): Promise<ScenarioApplicationResult>;
/**
* Apply a single endpoint configuration
*
* Updates the status.json file for the specified endpoint.
*
* @param config The endpoint configuration to apply
* @throws Error if endpoint directory or status file cannot be accessed
*/
applyEndpoint(config: EndpointConfiguration): Promise<void>;
/**
* Get the file path for an endpoint's status.json
*
* Converts endpoint configuration to file system path:
* /pet/status + GET -> mock/pet/status/GET/status.json
*
* @private
*/
private getStatusFilePath;
}
//# sourceMappingURL=scenario-applicator.d.ts.map