export const HTTP_SCENARIO_IDS = Object.freeze([ "success", "empty", "slow", "network-error", "timeout", "aborted", "content-type-mismatch", "malformed-json", "envelope-mismatch", "schema-mismatch", "auth-recover-once", "auth-persistent-401", "forbidden-403", "not-found-404", "conflict-409", "validation-422", "rate-limited-429", "server-retry-success", "server-terminal-500", ] as const); export type HttpScenarioId = (typeof HTTP_SCENARIO_IDS)[number]; export const OPERATION_SCENARIO_CATALOG = Object.freeze({ LIST_REFERENCE_RESOURCES: HTTP_SCENARIO_IDS, CREATE_REFERENCE_RESOURCE: Object.freeze( HTTP_SCENARIO_IDS.filter( (scenario) => !["empty", "aborted"].includes(scenario), ), ), GET_REFERENCE_RESOURCE: HTTP_SCENARIO_IDS, } satisfies Readonly>); export function assertOperationScenario( operationId: keyof typeof OPERATION_SCENARIO_CATALOG, scenario: HttpScenarioId, ) { if (!OPERATION_SCENARIO_CATALOG[operationId].includes(scenario)) { throw new Error( `Scenario ${scenario} is not declared for ${operationId}`, ); } return scenario; }