import type { Constructor } from '@cratis/fundamentals'; import type { AppendedEvent } from '../events/AppendedEvent.js'; import type { EventForEventSourceId } from '../eventSequences/EventForEventSourceId.js'; import type { AppendOptions } from '../eventSequences/AppendOptions.js'; import type { ReactorDeliveryResult } from './ReactorDeliveryResult.js'; import type { ReactorScenarioOptions } from './ReactorScenarioOptions.js'; import type { RecordedReactorSideEffect } from './RecordedReactorSideEffect.js'; import type { BatchPartitionOutcome } from './BatchPartitionOutcome.js'; /** Live, ordered reactor deliveries over the fixture-proven EventScenario event boundary. */ export declare class ReactorScenario { private readonly _reactor; private readonly _options; readonly given: ReactorScenarioPhase; readonly when: ReactorScenarioPhase; private readonly _events; private readonly _entries; private readonly _batchMethods; private readonly _batchEventTypeIds; private readonly _partitionOutcomes; private readonly _eventTypes; private readonly _instance?; private readonly _validateInstance; private readonly _store; private readonly _controller; private readonly _effects; private readonly _results; private _busy; private _failed; private _delivery?; private readonly _deliveryContext; private _deliveryIndex; constructor(_reactor: Constructor, _options?: ReactorScenarioOptions); private scenarioStore; get produced(): readonly unknown[]; get sideEffects(): readonly RecordedReactorSideEffect[]; get results(): readonly ReactorDeliveryResult[]; /** * The partitions the reactor's batch methods reported as failed or deferred, in the order they were reported. A batch * method that throws fails every partition in its batch instead, and the scenario rejects the call that delivered it. */ get partitionOutcomes(): readonly BatchPartitionOutcome[]; /** Committed input and explicit service appends; recorded returned effects are not part of this history. */ get appendedEvents(): readonly AppendedEvent[]; /** Assertion view, deliberately not a callable Promise-like `then`. */ get then(): { readonly produced: readonly unknown[]; readonly sideEffects: readonly RecordedReactorSideEffect[]; readonly results: readonly ReactorDeliveryResult[]; readonly partitionOutcomes: readonly BatchPartitionOutcome[]; }; shouldHaveProduced(type: new (...args: never[]) => T, predicate?: (value: T) => boolean): void; /** * Asserts that a batch method failed a partition. * @param partition - The event source identifier of the partition. */ shouldHaveFailed(partition: string): void; /** * Asserts that a batch method deferred a partition. * @param partition - The event source identifier of the partition. */ shouldHaveDeferred(partition: string): void; private assertOutcome; shouldNotHaveProduced(type: Function): void; /** Replay, redelivery and scheduler semantics need a separate kernel-backed increment. */ replay(): Promise; redeliver(): Promise; private deliver; private deliverPage; private exclusively; private violation; private latch; private throwIfViolated; private process; private processBatches; private deliveryFor; private record; } /** The reactor scenario phase that delivers events for one event source, or a page of several. */ export interface ReactorScenarioPhase { /** * Selects the event source to deliver events for. * @param id - The event source identifier. * @param options - Optional append options. * @returns The builder whose `events(...)` delivers its events as one page. */ forEventSource(id: string, options?: AppendOptions): { events(...events: object[]): Promise; }; /** * Delivers events of several event sources as one live page, as the kernel delivers a page to batch methods. * @param events - The events and the event sources they are for, in the order they are appended. * @returns A promise that resolves when every method has handled its events. */ page(...events: EventForEventSourceId[]): Promise; } //# sourceMappingURL=ReactorScenario.d.ts.map