@cloudnux/local-cloud-provider 0.11.0 → 0.14.0
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/dist/dev-console-plugin/index.d.ts +37 -2
- package/dist/dev-console-plugin/index.js +452 -249
- package/dist/dev-console-plugin/index.js.map +1 -1
- package/dist/index.js +191 -90
- package/dist/index.js.map +1 -1
- package/dist/queue-plugin/index.d.ts +2 -1
- package/dist/queue-plugin/index.js +187 -102
- package/dist/queue-plugin/index.js.map +1 -1
- package/dist/schedule-plugin/index.js +193 -118
- package/dist/schedule-plugin/index.js.map +1 -1
- package/dist/websocket-plugin/index.d.ts +10 -3
- package/dist/websocket-plugin/index.js +1063 -11
- package/dist/websocket-plugin/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FastifyPluginOptions, FastifyPluginAsync } from 'fastify';
|
|
1
|
+
import { FastifyRequest, FastifyReply, FastifyPluginOptions, FastifyPluginAsync } from 'fastify';
|
|
2
2
|
import { WebSocket } from 'ws';
|
|
3
3
|
|
|
4
4
|
type WebSocketEvent = "connect" | "disconnect" | "message";
|
|
@@ -8,13 +8,18 @@ interface WebSocketConnection {
|
|
|
8
8
|
path: string;
|
|
9
9
|
connectedAt: Date;
|
|
10
10
|
}
|
|
11
|
-
type WebSocketEventHandler = (connectionId: string, event: WebSocketEvent, data?:
|
|
11
|
+
type WebSocketEventHandler = (connectionId: string, event: WebSocketEvent, data: any | null, request: FastifyRequest, reply?: FastifyReply) => Promise<any>;
|
|
12
12
|
interface WebSocketRouteHandler {
|
|
13
13
|
path: string;
|
|
14
14
|
event: WebSocketEvent;
|
|
15
15
|
route?: string;
|
|
16
|
+
module?: string;
|
|
16
17
|
handler: WebSocketEventHandler;
|
|
17
18
|
}
|
|
19
|
+
interface RegisteredWebSocketPath {
|
|
20
|
+
path: string;
|
|
21
|
+
module?: string;
|
|
22
|
+
}
|
|
18
23
|
interface WebSocketConfig {
|
|
19
24
|
routeKeyField: string;
|
|
20
25
|
}
|
|
@@ -25,7 +30,9 @@ interface WebSocketPluginOptions extends FastifyPluginOptions {
|
|
|
25
30
|
interface WebSocketManager {
|
|
26
31
|
registerHandler(handler: WebSocketRouteHandler): void;
|
|
27
32
|
getConnections(path?: string): WebSocketConnection[];
|
|
33
|
+
getRegisteredPaths(module?: string): RegisteredWebSocketPath[];
|
|
28
34
|
sendToClient(connectionId: string, data: any): Promise<void>;
|
|
35
|
+
disconnect(connectionId: string): Promise<void>;
|
|
29
36
|
}
|
|
30
37
|
interface WebSocketDecoratorOptions {
|
|
31
38
|
connections: Map<string, WebSocketConnection>;
|
|
@@ -40,4 +47,4 @@ declare module 'fastify' {
|
|
|
40
47
|
|
|
41
48
|
declare const websocketsPlugin: FastifyPluginAsync<WebSocketPluginOptions>;
|
|
42
49
|
|
|
43
|
-
export { type WebSocketConfig, type WebSocketConnection, type WebSocketDecoratorOptions, type WebSocketEvent, type WebSocketEventHandler, type WebSocketManager, type WebSocketPluginOptions, type WebSocketRouteHandler, websocketsPlugin };
|
|
50
|
+
export { type RegisteredWebSocketPath, type WebSocketConfig, type WebSocketConnection, type WebSocketDecoratorOptions, type WebSocketEvent, type WebSocketEventHandler, type WebSocketManager, type WebSocketPluginOptions, type WebSocketRouteHandler, websocketsPlugin };
|