/** * Shared utilities for server hooks. */ /** * Extract requestId from context object if it exists. * This helper reduces type casting duplication throughout the codebase. */ export function getRequestIdFromContext(ctx: unknown): string | undefined { if (ctx !== null && ctx !== undefined && typeof ctx === "object") { const ctxRecord = ctx as Record; const requestId = ctxRecord.requestId; return typeof requestId === "string" ? requestId : undefined; } return undefined; }