import type { MessageProcessingResult, MessageProcessingResultStatus } from '../types/MessageQueueTypes.ts'; /** * Symbol that can be used in place of a message type value in `waitForMessage` or `checkForMessage` * to match messages regardless of their type. Useful when using custom message type resolvers * where the type may not be available in the message payload itself. * * @example * // Match any message with a specific ID, regardless of type * await spy.waitForMessage({ id: '123', type: ANY_MESSAGE_TYPE }) */ export declare const ANY_MESSAGE_TYPE: unique symbol; /** * Symbol used to indicate that the message type could not be resolved. * Typically used when message parsing failed before type resolution could occur. * * @example * // For failed message parsing * spy.addProcessedMessage({ message: null, processingResult }, messageId, TYPE_NOT_RESOLVED) */ export declare const TYPE_NOT_RESOLVED: unique symbol; export type HandlerSpyParams = { bufferSize?: number; messageIdField?: string; }; export type SpyResultCounts = { consumed: number; published: number; retryLater: number; error: number; }; export type SpyResultInput = { message: MessagePayloadSchemas | null; processingResult: MessageProcessingResult; }; export type SpyResultOutput = { message: MessagePayloadSchemas; processingResult: MessageProcessingResult; }; export declare function isHandlerSpy(value: unknown): value is HandlerSpy; export type PublicHandlerSpy = Omit, 'addProcessedMessage'>; type DeepPartial = T extends Function ? T : T extends object ? { [P in keyof T]?: T[P] extends Array ? Array> : T[P] extends ReadonlyArray ? ReadonlyArray> : DeepPartial; } : T; export declare class HandlerSpy { name: string; private readonly messageBuffer; private readonly messageIdField; private readonly spyPromises; private _counts; constructor(params?: HandlerSpyParams); private messageMatchesFilter; waitForMessageWithId(id: string, status?: MessageProcessingResultStatus): Promise>; checkForMessage(expectedFields: DeepPartial, status?: MessageProcessingResultStatus): SpyResultOutput | undefined; waitForMessage(expectedFields: DeepPartial, status?: MessageProcessingResultStatus): Promise>; get counts(): SpyResultCounts; clear(): void; getAllReceivedMessages(): SpyResultOutput[]; /** * Add a processed message to the spy buffer. * @param processingResult - The processing result containing the message and status * @param messageId - Optional message ID override (used if message parsing failed) * @param messageType - The resolved message type, or TYPE_NOT_RESOLVED symbol if type couldn't be determined */ addProcessedMessage(processingResult: SpyResultInput, messageId: string | undefined, messageType: string | typeof TYPE_NOT_RESOLVED): void; } export declare function resolveHandlerSpy(queueOptions: { handlerSpy?: HandlerSpy | HandlerSpyParams | boolean; }): HandlerSpy | undefined; export {};