import type { BaseEndpointOptions } from '@navios/builder'; import type { AbstractDynamicHandler, AbstractStaticHandler, FormatArgumentsFn, HandlerContext, InstanceResolution } from '@navios/core'; import type { BunRequest } from 'bun'; import { InjectionToken } from '@navios/core'; import { AbstractBunHandlerAdapterService } from './abstract-bun-handler-adapter.service.mjs'; /** * Injection token for the Bun stream adapter service. * * This token is used to inject the `BunStreamAdapterService` instance * into the dependency injection container. */ export declare const BunStreamAdapterToken: InjectionToken; /** * Adapter service for handling streaming requests and responses in Bun. * * This service extends `AbstractBunHandlerAdapterService` and provides * handling for stream-based endpoints. Handlers receive a streamWriter * stub and can return Response objects directly for streaming. * * @extends {AbstractBunHandlerAdapterService} * * @example * ```ts * // Used automatically when defining endpoints with @Stream() * @Controller() * class StreamController { * @Stream(streamEvents) * async streamData(data: StreamDto) { * // Returns a Response object for streaming * return new Response(stream, { * headers: { 'Content-Type': 'text/event-stream' }, * }) * } * } * ``` */ export declare class BunStreamAdapterService extends AbstractBunHandlerAdapterService { /** * Creates a static handler for singleton controllers. * * Passes a streamWriter stub as the second argument to the controller method. * * @param boundMethod - Pre-bound controller method * @param formatArguments - Function to format request arguments * @param context - Handler context with metadata * @returns Static handler result */ protected createStaticHandler(boundMethod: (...args: any[]) => Promise, formatArguments: FormatArgumentsFn, context: HandlerContext): AbstractStaticHandler; /** * Creates a dynamic handler for request-scoped controllers. * * Passes a streamWriter stub as the second argument to the controller method. * * @param resolution - Instance resolution with resolve function * @param formatArguments - Function to format request arguments * @param context - Handler context with metadata * @returns Dynamic handler result */ protected createDynamicHandler(resolution: InstanceResolution, formatArguments: FormatArgumentsFn, context: HandlerContext): AbstractDynamicHandler; /** * Creates a stream writer stub for Bun. */ protected createStreamWriter(): { write: (_data: any) => void; end: () => void; }; /** * Creates a handler for stream results. * * If the result is a Response, adds custom headers. * Otherwise, wraps the result in a new Response. */ protected createStreamResultHandler(context: HandlerContext, headersTemplate: Record): (result: any) => Response; } //# sourceMappingURL=stream-adapter.service.d.mts.map