builder.io 1.11.40 → 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.
- package/cli/index.cjs +415 -451
- package/cli/index.cjs.map +4 -4
- package/core/index.cjs +1 -1
- package/core/index.mjs +1 -1
- package/node/index.cjs +1 -1
- package/node/index.mjs +1 -1
- package/package.json +2 -3
- package/server/index.cjs +115 -169
- package/server/index.mjs +125 -179
- package/types/cli/credentials.d.ts +1 -1
- package/types/cli/launch/dev-server-orchestrator.d.ts +2 -2
- package/types/cli/launch/proxy.d.ts +2 -2
- package/types/tsconfig.tsbuildinfo +1 -1
- package/types/types/codegen-server.d.ts +14 -0
- package/types/types/connection-tracker.d.ts +24 -0
- package/types/types/proxy-middleware.d.ts +31 -0
- package/types/types/websocket-types.d.ts +17 -0
|
@@ -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;
|