/** * WpResponse - Wraps controller responses for the filter chain. * * Generic type parameter TResult represents the controller's return type. * The filter chain uses WpResponse because it handles all response types uniformly. * * The jsonTranslator middleware is responsible for: * 1. Serializing WpResponse.response to JSON * 2. Writing the JSON to the HTTP response body * 3. Setting the HTTP status code from WpResponse.statusCode */ export declare class WpResponse { response: TResult; constructor(response: TResult); } /** * Service interface - Similar to Java WebPieces Service. * Represents any component that can process a request and return a response. * * Used for: * - Final controller invocation * - Wrapping filters as services in the chain * - Functional composition of filters */ export interface Service { /** * Invoke the service with the given metadata. * @param meta - Request metadata * @returns Promise of the response */ invoke(meta: REQ): Promise; } /** * Filter abstract class - Similar to Java WebPieces Filter. * * Filters are STATELESS and can handle N concurrent requests. * They wrap the execution of subsequent filters and the controller. * * Key principles: * - STATELESS: No instance variables for request data * - COMPOSABLE: Use chain() methods for functional composition * * For HTTP filters, use Filter>: * - MethodMeta: Standardized request metadata (defined in http-server) * - WpResponse: Wraps any controller response */ export declare abstract class Filter { /** * Filter method that wraps the next filter/controller. * * @param meta - Metadata about the method being invoked * @param nextFilter - Next filter/controller as a Service * @returns Promise of the response */ abstract filter(meta: REQ, nextFilter: Service): Promise; /** * Chain this filter with another filter. * Returns a new Filter that composes both filters. * * Similar to Java: filter1.chain(filter2) * * @param nextFilter - The filter to execute after this one * @returns Composed filter */ chain(nextFilter: Filter): Filter; /** * Chain this filter with a final service (controller). * Returns a Service that can be invoked. * * Similar to Java: filter.chain(service) * * @param svc - The final service (controller) to execute * @returns Service wrapping the entire filter chain */ chainService(svc: Service): Service; }