@paultaku/node-mock-server
Version:
A TypeScript-based mock server with automatic Swagger-based mock file generation
57 lines • 1.9 kB
TypeScript
/**
* ActiveScenarioTracker Implementation
*
* Manages the active scenario reference stored in _active.json.
* Implements the IActiveScenarioTracker interface.
*
* @see specs/004-scenario-management/data-model.md
* @see tests/unit/active-scenario-tracker.test.ts
*/
import { ActiveScenarioReference, IActiveScenarioTracker } from '../../shared/types/scenario-types';
/**
* Tracker for managing the currently active scenario
*
* Stores active scenario reference in _active.json:
* {
* "activeScenario": "scenario-name" | null,
* "lastUpdated": "2025-11-30T10:00:00.000Z"
* }
*/
export declare class ActiveScenarioTracker implements IActiveScenarioTracker {
private readonly activeFilePath;
private readonly scenarioDir;
/**
* @param scenarioDir Absolute path to scenario storage directory (default: mock/scenario)
*/
constructor(scenarioDir?: string);
/**
* Get the name of the currently active scenario
*
* @returns Scenario name if active, null otherwise
*/
getActive(): Promise<string | null>;
/**
* Set a scenario as active
*
* Updates _active.json with the scenario name and current timestamp.
* Creates the file and directory if they don't exist.
*
* @param scenarioName Name of the scenario to activate
*/
setActive(scenarioName: string): Promise<void>;
/**
* Clear the active scenario (set to null)
*
* Updates _active.json to indicate no scenario is active.
*/
clearActive(): Promise<void>;
/**
* Get the full active scenario reference with metadata
*
* Useful for API responses that need both active scenario and timestamp.
*
* @returns Active scenario reference, or default if file doesn't exist
*/
getActiveReference(): Promise<ActiveScenarioReference>;
}
//# sourceMappingURL=active-scenario-tracker.d.ts.map