@ccci/micro-server 1.0.97 → 1.0.98
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/index.d.ts +1 -0
- package/dist/index.js +12 -0
- package/dist/utils/ApplicationServer.d.ts +2 -1
- package/dist/utils/WebsocketServer.d.ts +11 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { default as BaseModel } from './utils/BaseModel';
|
|
|
10
10
|
export { default as ErrorHandler } from './utils/ErrorHandler';
|
|
11
11
|
export { generate, verify, decode } from './utils/TokenGenerator';
|
|
12
12
|
export { default as DatabaseConnector } from './utils/DatabaseConnector';
|
|
13
|
+
export { default as WebSocketServer } from './utils/WebSocketServer';
|
|
13
14
|
export { default as BaseSocketHandler } from './utils/BaseSocketHandler';
|
|
14
15
|
export type { WebSocketData } from './types/BaseSocketType';
|
|
15
16
|
export { PublicAccess, PrivateAccess, endpoint } from './decorators/Endpoints';
|
package/dist/index.js
CHANGED
|
@@ -119109,6 +119109,7 @@ class Mailer {
|
|
|
119109
119109
|
import fs6 from "node:fs";
|
|
119110
119110
|
import path3 from "node:path";
|
|
119111
119111
|
class WebSocketServer {
|
|
119112
|
+
static socketHandlers;
|
|
119112
119113
|
static init(port = 5001, dir, folder = "sockets") {
|
|
119113
119114
|
let handlers = [];
|
|
119114
119115
|
let fullDir = path3.join(dir, folder);
|
|
@@ -119158,8 +119159,18 @@ class WebSocketServer {
|
|
|
119158
119159
|
}
|
|
119159
119160
|
});
|
|
119160
119161
|
Logger.info(`Web Socket Sever ready at: http://127.0.0.1:${port}\n`);
|
|
119162
|
+
WebSocketServer.socketHandlers = handlers;
|
|
119161
119163
|
return handlers;
|
|
119162
119164
|
}
|
|
119165
|
+
static getSocketHandlers() {
|
|
119166
|
+
return WebSocketServer.socketHandlers;
|
|
119167
|
+
}
|
|
119168
|
+
static getHandler(path4) {
|
|
119169
|
+
let handler = null;
|
|
119170
|
+
let socket = WebSocketServer.socketHandlers.find((websocket) => websocket.path === path4);
|
|
119171
|
+
handler = socket ? socket.handler : null;
|
|
119172
|
+
return handler;
|
|
119173
|
+
}
|
|
119163
119174
|
}
|
|
119164
119175
|
|
|
119165
119176
|
// src/utils/ApplicationServer.ts
|
|
@@ -119751,6 +119762,7 @@ export {
|
|
|
119751
119762
|
generate,
|
|
119752
119763
|
endpoint,
|
|
119753
119764
|
decode,
|
|
119765
|
+
WebSocketServer,
|
|
119754
119766
|
RouterFactory,
|
|
119755
119767
|
ResponseHelper,
|
|
119756
119768
|
PublicAccess,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Application } from 'express';
|
|
2
2
|
import { ApplicationOptionType } from '@/types/ApplicationOptionType';
|
|
3
|
+
import BaseSocketHandler from './BaseSocketHandler';
|
|
3
4
|
/**
|
|
4
5
|
* Application Sever class
|
|
5
6
|
*/
|
|
@@ -7,7 +8,7 @@ export default class ApplicationServer {
|
|
|
7
8
|
static app: Application;
|
|
8
9
|
static socketHandlers: Array<{
|
|
9
10
|
path: string;
|
|
10
|
-
handler:
|
|
11
|
+
handler: BaseSocketHandler;
|
|
11
12
|
}>;
|
|
12
13
|
/**
|
|
13
14
|
* Initializes the application server
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
+
import BaseSocketHandler from './BaseSocketHandler';
|
|
1
2
|
export default class WebSocketServer {
|
|
3
|
+
static socketHandlers: Array<{
|
|
4
|
+
path: string;
|
|
5
|
+
handler: BaseSocketHandler;
|
|
6
|
+
}>;
|
|
2
7
|
static init(port: number | undefined, dir: string, folder?: string): Array<{
|
|
3
8
|
path: string;
|
|
4
|
-
handler:
|
|
9
|
+
handler: BaseSocketHandler;
|
|
10
|
+
}>;
|
|
11
|
+
static getSocketHandlers(): Array<{
|
|
12
|
+
path: string;
|
|
13
|
+
handler: BaseSocketHandler;
|
|
5
14
|
}>;
|
|
15
|
+
static getHandler(path: string): BaseSocketHandler | null;
|
|
6
16
|
}
|
|
7
17
|
//# sourceMappingURL=WebSocketServer.d.ts.map
|