@logtail/next
Version:
Better Stack Telemetry Next.js client
65 lines (64 loc) • 1.71 kB
TypeScript
import { type NextRequest } from 'next/server';
export declare const isNoPrettyPrint: boolean;
export declare enum EndpointType {
webVitals = "web-vitals",
logs = "logs"
}
export interface RequestJSON {
method: string;
url: string;
headers: Record<string, string>;
cookies: Record<string, string>;
nextUrl?: {
basePath: string;
buildId?: string;
defaultLocale?: string;
domainLocale?: {
defaultLocale: string;
domain: string;
locales?: string[];
};
hash: string;
host: string;
hostname: string;
href: string;
locale?: string;
origin: string;
password: string;
pathname: string;
port: string;
protocol: string;
search: string;
searchParams: Record<string, string>;
username: string;
};
ip?: string;
geo?: {
city?: string;
country?: string;
region?: string;
latitude?: string;
longitude?: string;
};
body?: any;
cache: {
mode: RequestCache;
credentials: RequestCredentials;
redirect: RequestRedirect;
referrerPolicy: ReferrerPolicy;
integrity: string;
};
mode: RequestMode;
destination: RequestDestination;
referrer: string;
keepalive: boolean;
signal: {
aborted: boolean;
reason: any;
};
}
/**
* Transforms a NextRequest or Request object into a JSON-serializable object
*/
export declare function requestToJSON(request: Request | NextRequest): Promise<RequestJSON>;
export declare const throttle: (fn: Function, wait: number) => (this: any) => void;