import type { RequestHandler } from 'express'; import type { SSEManager } from '../http/sse-connection-manager.js'; /** * Creates middleware that attaches RequestContext to req.context * * The context includes: * - requestId: Unique request identifier * - identity: User identity from JWT (orgId, userId, role) * - log: Logger function that sends to both Winston and SSE * * @param sseManager - SSE manager for real-time logging * @returns Express middleware that attaches context to req.context * * @example * ```typescript * const { app, sseManager } = createApp(); * * // Apply context middleware globally * app.use(attachRequestContext(sseManager)); * * // Use context in route handlers * app.get('/pipelines', requireAuth, async (req, res) => { * const ctx = getContext(req); * ctx.log('INFO', 'Fetching pipelines'); * * if (!ctx.identity.orgId) { * return sendError(res, 400, 'Organization ID required'); * } * * // ... rest of handler * }); * ``` */ export declare function attachRequestContext(sseManager: SSEManager): RequestHandler;