UNPKG

@centinel/nextjs

Version:

Package designed to add Centinel Analytica functionality to Next.js applications

65 lines 2.19 kB
import { NextRequest, NextResponse } from 'next/server'; export interface CentinelConfig { readonly siteKey: string; readonly secretKey: string; readonly timeout?: number; readonly debugMode?: boolean; } export interface MiddlewareEvent { readonly request: NextRequest; } export interface ClientInfo { readonly ip: string; readonly referer: string; } export interface ValidationPayload { readonly cookie?: string | undefined; readonly url: string; readonly ip: string; readonly referrer?: string | undefined; readonly method: string; readonly headers: Record<string, string>; } export interface ValidationResult { readonly success: boolean; readonly decision: 'allow' | 'block' | 'redirect' | 'not_matched'; readonly status_code?: number | undefined; readonly response_html?: string | undefined; readonly cookies?: readonly CentinelCookie[] | undefined; readonly headers?: Readonly<Record<string, string>> | undefined; } export interface CentinelCookie { readonly name: string; readonly value: string; readonly path?: string; readonly domain?: string; } export interface CentinelResult { readonly response: NextResponse; readonly decision: 'allow' | 'block' | 'redirect' | 'not_matched'; readonly should_intercept: boolean; } export interface ValidationApiResponse { readonly success?: boolean; readonly decision?: string; readonly status_code?: number; readonly response_html?: string; readonly cookies?: readonly CentinelCookie[]; readonly headers?: Readonly<Record<string, string>>; } export type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS'; export interface RequestHeaders extends Record<string, string> { readonly 'user-agent'?: string; readonly 'x-forwarded-for'?: string; readonly 'x-real-ip'?: string; readonly 'cf-connecting-ip'?: string; readonly referer?: string; readonly referrer?: string; readonly host?: string; } export interface BackoffState { consecutiveFailures: number; lastFailureTime: number | null; isInBackoff: boolean; } //# sourceMappingURL=types.d.ts.map