UNPKG

@pulzar/core

Version:

Next-generation Node.js framework for ultra-fast web applications with zero-reflection DI, GraphQL, WebSockets, events, and edge runtime support

114 lines 2.96 kB
import { FastifyInstance } from "fastify"; import { EdgeAdapterOptions, EdgePlatform } from "./types"; export declare class FastifyEdgeAdapter { private app; private options; private compressionEnabled; private websocketEnabled; constructor(app: FastifyInstance, options: Partial<EdgeAdapterOptions>); /** * Create an edge-compatible handler for the given platform */ createHandler(): (request: any, ...args: any[]) => Promise<Response>; /** * Cloudflare Workers handler with WebSocket support */ private createCloudflareHandler; /** * Vercel Edge handler */ private createVercelHandler; /** * Deno Deploy handler with WebSocket support */ private createDenoHandler; /** * Netlify Edge handler */ private createNetlifyHandler; /** * Handle WebSocket upgrade */ private handleWebSocketUpgrade; /** * Process request through Fastify with compression support */ private processRequest; /** * Determine if response should be compressed */ private shouldCompress; /** * Compress response body */ private compressResponse; /** * Parse Cloudflare Workers request */ private parseCloudflareRequest; /** * Parse Vercel Edge request */ private parseVercelRequest; /** * Parse Deno Deploy request */ private parseDenoRequest; /** * Parse Netlify Edge request */ private parseNetlifyRequest; /** * Parse request body with better error handling */ private parseBody; /** * Get remote address from request with better fallbacks */ private getRemoteAddress; /** * Extract geographic information from Cloudflare */ private extractGeo; /** * Extract geographic information from Vercel */ private extractVercelGeo; /** * Extract geographic information from Deno */ private extractDenoGeo; /** * Create Cloudflare Workers Response */ private createCloudflareResponse; /** * Create Vercel Edge Response */ private createVercelResponse; /** * Create Deno Deploy Response */ private createDenoResponse; /** * Create Netlify Edge Response */ private createNetlifyResponse; /** * Create error response with proper logging */ private createErrorResponse; /** * Log request for analytics (background task) */ private logRequest; } /** * Create a Fastify edge adapter */ export declare function createFastifyEdgeAdapter(app: FastifyInstance, options: Partial<EdgeAdapterOptions>): FastifyEdgeAdapter; /** * Create platform-specific handler */ export declare function createEdgeHandler(app: FastifyInstance, platform: EdgePlatform): (request: any, ...args: any[]) => Promise<Response>; //# sourceMappingURL=fastify-adapter.d.ts.map