import type { SinonSandbox, SinonStub } from 'sinon'; import type { Service } from '../core/Service/Service.impl.js'; import type { FromEmitToOtherType } from '../core/types/FromEmitToOtherType.js'; import type { ServiceClass } from '../core/types/ServiceClass.js'; import type { ServiceClassMetrics } from '../core/types/ServiceClassMetrics.js'; import type { StreamFunctionContext } from '../core/types/stream/StreamFunctionContext.js'; import type { StreamOpenRequest } from '../core/types/stream/StreamOpenRequest.js'; import type { StreamWriter } from '../core/types/stream/StreamWriter.js'; import type { StreamDefinitionBuilder } from '../StreamDefinitionBuilder/StreamDefinitionBuilder.impl.js'; import type { Infer, InferIn } from '../schema/index.js'; /** * Infer the internal builder type configuration from a stream builder. * * @group Unit test helper */ export type StreamContextMockBuilderTypes = T extends StreamDefinitionBuilder ? C : never; export type StreamContextMockServiceClass = T extends StreamDefinitionBuilder ? S : ServiceClass; export type CreateStreamContextMockInput> = { payload: InferIn['PayloadSchema']>; parameter: InferIn['ParamsSchema']>; sandbox?: SinonSandbox; resources?: Partial['Resources']>; message?: Partial['PayloadSchema']>, Infer['ParamsSchema']>>>; }; export type StreamContextMockResult> = { context: StreamFunctionContext['PayloadSchema']>, Infer['ParamsSchema']>, StreamContextMockBuilderTypes['Resources'], StreamContextMockBuilderTypes['Invokes'], StreamContextMockBuilderTypes['StreamInvokes'], StreamContextMockBuilderTypes['EmitList'], StreamContextMockBuilderTypes['QueueInvokes'], ServiceClassMetrics>>; writer: StreamWriter['ChunkSchema']>, InferIn['FinalSchema']>>; stubs: { logger: Record; emit: FromEmitToOtherType['EmitList'], SinonStub>; wrapInSpan: SinonStub; startActiveSpan: SinonStub; getSecret: SinonStub; setSecret: SinonStub; removeSecret: SinonStub; getConfig: SinonStub; setConfig: SinonStub; removeConfig: SinonStub; getState: SinonStub; setState: SinonStub; removeState: SinonStub; enqueue: SinonStub; scheduleAt: SinonStub; service: StreamFunctionContext['PayloadSchema']>, Infer['ParamsSchema']>, StreamContextMockBuilderTypes['Resources'], StreamContextMockBuilderTypes['Invokes'], StreamContextMockBuilderTypes['StreamInvokes'], StreamContextMockBuilderTypes['EmitList'], StreamContextMockBuilderTypes['QueueInvokes'], ServiceClassMetrics>>['service']; resources: Partial['Resources']>; writer: { write: SinonStub; close: SinonStub; fail: SinonStub; }; }; chunks: InferIn['ChunkSchema']>[]; finalValue: InferIn['FinalSchema']> | undefined; failedWith: unknown[]; cancel(reason?: string): void; }; /** * Create a typed stream handler context mock together with a capture writer. * * Use this helper to unit test a stream handler without booting a full service * runtime. The returned writer records chunks, the final value, and failures. * * @group Unit test helper */ export declare const createStreamContextMock: >(builder: TBuilder, input: CreateStreamContextMockInput) => StreamContextMockResult; //# sourceMappingURL=createStreamContextMock.d.ts.map