builder.io 1.11.39 → 1.11.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Type for methods that can be called on the code generation server
3
+ */
4
+ export type CodeGenMethod = (...args: any[]) => any;
5
+ /**
6
+ * Type for the code generation server object
7
+ */
8
+ export interface CodeGenServer {
9
+ [key: string]: CodeGenMethod | undefined;
10
+ }
11
+ /**
12
+ * Type guard to check if a value is a valid CodeGenMethod
13
+ */
14
+ export declare function isCodeGenMethod(value: any): value is CodeGenMethod;
@@ -0,0 +1,24 @@
1
+ import type { Duplex } from "stream";
2
+ /**
3
+ * Tracks active WebSocket connections to prevent memory leaks
4
+ */
5
+ export declare class ConnectionTracker {
6
+ private connections;
7
+ private maxConnections;
8
+ /**
9
+ * Add a connection to tracking
10
+ */
11
+ addConnection(socket: Duplex): boolean;
12
+ /**
13
+ * Remove a connection from tracking
14
+ */
15
+ removeConnection(socket: Duplex): void;
16
+ /**
17
+ * Get current connection count
18
+ */
19
+ getConnectionCount(): number;
20
+ /**
21
+ * Clean up all connections
22
+ */
23
+ cleanup(): void;
24
+ }
@@ -0,0 +1,31 @@
1
+ import type { Request, Response, NextFunction } from "express";
2
+ import type { IncomingMessage } from "http";
3
+ import type { Duplex } from "stream";
4
+ /**
5
+ * Express middleware function type
6
+ */
7
+ export type MiddlewareFunction = (req: Request, res: Response, next: NextFunction) => void;
8
+ /**
9
+ * WebSocket upgrade function type
10
+ */
11
+ export type WebSocketUpgradeFunction = (req: IncomingMessage, socket: Duplex, head: Buffer) => void;
12
+ /**
13
+ * Extended Express middleware that includes WebSocket upgrade functionality
14
+ */
15
+ export interface ProxyMiddleware extends MiddlewareFunction {
16
+ /**
17
+ * Handle WebSocket upgrade requests
18
+ * @param req - The incoming request
19
+ * @param socket - The socket connection
20
+ * @param head - The first packet of the upgraded stream
21
+ */
22
+ upgrade?: WebSocketUpgradeFunction;
23
+ /**
24
+ * Cleanup method for graceful shutdown
25
+ */
26
+ cleanup?: () => void;
27
+ }
28
+ /**
29
+ * Type guard to check if a middleware has WebSocket upgrade capability
30
+ */
31
+ export declare function hasUpgrade(middleware: any): middleware is ProxyMiddleware;
@@ -0,0 +1,17 @@
1
+ import type { IncomingMessage } from "http";
2
+ import type { Socket } from "net";
3
+ /**
4
+ * WebSocket upgrade request parameters
5
+ */
6
+ export interface WebSocketUpgradeParams {
7
+ /** The incoming HTTP request */
8
+ req: IncomingMessage;
9
+ /** The socket connection */
10
+ socket: Socket;
11
+ /** The first packet of the upgraded stream */
12
+ head: Buffer;
13
+ }
14
+ /**
15
+ * Type guard to check if an object has WebSocket upgrade parameters
16
+ */
17
+ export declare function isWebSocketUpgradeParams(obj: any): obj is WebSocketUpgradeParams;