UNPKG

nehoid

Version:

Advanced unique ID generation utility with multi-layer encoding, collision detection, and context-aware features

34 lines 1.04 kB
/** * Express middleware options */ export interface MiddlewareOptions { /** Header name to use for the request ID */ header?: string; /** ID format to use */ format?: "standard" | "uuid" | "short" | "nano"; /** Whether to expose the ID as a response header */ exposeHeader?: boolean; /** Whether to add the ID to the request object */ addToRequest?: boolean; /** Custom ID generator function */ generator?: () => string; /** * Generate a name while requesting. * @default NehoID * * @example ```js * const headerId = req.NehoID * * console.log(headerId) //undefined or something-like-this * ``` * */ name4Req?: string; } /** * Create Express middleware for request ID generation * @param options Middleware configuration options * @returns Express middleware function */ export declare function createMiddleware(options?: MiddlewareOptions): (req: any, res: any, next: Function) => void; //# sourceMappingURL=middleware.d.ts.map