-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.d.ts
More file actions
39 lines (31 loc) · 1.72 KB
/
Copy pathindex.d.ts
File metadata and controls
39 lines (31 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { IncomingMessage, ServerResponse, Server } from 'http';
type RequestHandler = (req: IncomingMessage, res: ServerResponse) => void;
export declare function braidify(handler: RequestHandler): RequestHandler;
export declare function braidify(req: IncomingMessage, res: ServerResponse, next?: () => void): void;
export declare function braidify(server: Server): Server;
// The http_bus API is still settling; these types are deliberately loose
export declare function http_bus(cb: (message: Record<string, any>) => void,
options?: Record<string, any>): any;
/** @deprecated Renamed to `braidify` */
export declare function http_server(handler: RequestHandler): RequestHandler;
/** @deprecated Renamed to `braidify` */
export declare function http_server(req: IncomingMessage, res: ServerResponse, next?: () => void): void;
/** @deprecated Renamed to `braidify` */
export declare function http_server(server: Server): Server;
export declare function free_cors(res: ServerResponse): void;
export declare function fetch(url: string, params?: Record<string, any>): Promise<Response>;
export declare function reliable_update_channel(url: string, options?: {
on_update?: (update: any) => void;
on_status?: (status: { online: boolean; outstanding_puts: number }) => void;
on_warning?: (msg: string) => void;
on_error?: (err: Error) => void;
reconnect_from_parents?: string[] | (() => string[] | null | undefined);
get_headers?: Record<string, string>;
put_headers?: Record<string, string>;
timeout?: number;
}): {
put(update: Record<string, any>): Promise<Response>;
close(): void;
};
/** @deprecated Use `fetch` instead */
export declare function http_client(httpModule: any): any;