histoire
Version:
A fast story book powered by Vite
32 lines • 1.81 kB
TypeScript
import type { CatalogEvents, CatalogListArgs, CatalogListPage, CatalogStateDto, CatalogVariantsArgs, CatalogVariantsPage } from '@histoire/cli/protocol/catalog';
import type { RuntimeCatalog } from '../../catalog/publication.js';
import type { ProjectRuntimeHandle } from '../../types.js';
/** Inputs of the per-generation catalog service. */
export interface CatalogServiceOptions {
/** Active runtime generation; supplies routing facts and the activity fence. */
handle: Pick<ProjectRuntimeHandle, 'context' | 'server' | 'isActive' | 'onCollection'>;
/** Canonical catalog of the generation. */
catalog: RuntimeCatalog | undefined;
/** Parent event sink; dropped by the adapter once the generation retires. */
emit: <K extends keyof CatalogEvents & string>(event: K, data: CatalogEvents[K]) => void;
/** Aborted when the generation is released: stop observing. */
signal: AbortSignal;
}
/** Read-only view of the canonical catalog of one generation. */
export interface CatalogService {
/** One page of matching stories, all of one revision. */
list: (args: CatalogListArgs) => CatalogListPage;
/** One page of a story's variants, all of one revision. */
variants: (args: CatalogVariantsArgs) => CatalogVariantsPage;
/** Lifecycle and counts right now. */
state: () => CatalogStateDto;
}
/**
* Creates the read-only terminal view of the canonical catalog. It reads the catalog
* attached to the generation (never a second publisher), pages synchronously from one
* immutable snapshot, and emits `catalog.state` when the revision or the updating
* fence changes.
* @param options Generation-scoped capabilities.
*/
export declare function createCatalogService(options: CatalogServiceOptions): CatalogService;
//# sourceMappingURL=service.d.ts.map