histoire
Version:
A fast story book powered by Vite
38 lines • 1.7 kB
TypeScript
import type { TestCaseDto, TestOperationDto, TestUnavailableReason } from '@histoire/cli/protocol/tests';
/** Retention bounds of completed operations. */
export interface StoreLimits {
/** Completed operations kept. */
runs: number;
/** Serialized bytes of completed summaries plus retained cases. */
bytes: number;
}
/** Frozen defaults from the retention contract. */
export declare const DEFAULT_STORE_LIMITS: StoreLimits;
/**
* Bounded history of finished operations. Active operations are never stored
* here, so they cannot be evicted as if they were completed results. The
* newest entry always survives its own insertion; older ones go first.
* @param limits Count and byte bounds.
*/
export declare function createResultStore(limits?: StoreLimits): {
/**
* Stores (or replaces) a finished operation with its retained cases.
* @param operation Final snapshot.
* @param cases Retained case results.
* @param caseBytes Serialized size of `cases`.
*/
put(operation: TestOperationDto, cases: TestCaseDto[], caseBytes: number): void;
/** Final snapshot of a retained operation. */
operation: (id: string) => TestOperationDto;
/** Retained cases of a finished operation. */
cases: (id: string) => TestCaseDto[];
/** Why a finished operation cannot be read, when it cannot. */
missing(id: string): TestUnavailableReason | undefined;
/** Retained entry count. */
readonly size: number;
/** Retained serialized bytes. */
readonly bytes: number;
};
/** Store type returned by {@link createResultStore}. */
export type ResultStore = ReturnType<typeof createResultStore>;
//# sourceMappingURL=store.d.ts.map