// services/api/src/shared/request-with-id.ts —— 请求对象带 req.id 的共享类型 // (Task 7 遗留项⑥):request-id 中间件 / pino-http genReqId 写入,异常过滤器、 // 后续 auth guard(req.user)等读取。此前在过滤器与中间件各声明一份局部接口。 // 注意不继承 IncomingMessage:pino-http 经 module augmentation 给后者挂了 // 非可选的 id: ReqId,扩展会与其冲突;组合用 ServerRequestWithId。 import type { IncomingMessage } from 'node:http'; /** 请求 ID 字段约定:上游 x-request-id 透传或 UUID v4(见 request-id.middleware.ts)。 */ export interface RequestWithId { id?: string; } /** 中间件/genReqId 实际操作的请求对象(node 原始请求 + id 字段)。 */ export type ServerRequestWithId = IncomingMessage & RequestWithId;