@moostjs/event-ws 0.6.9 → 0.6.10
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.cjs +26 -48
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,29 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
-
key = keys[i];
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
-
value: mod,
|
|
20
|
-
enumerable: true
|
|
21
|
-
}) : target, mod));
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
const moost = __toESM(require("moost"));
|
|
25
|
-
const __wooksjs_event_ws = __toESM(require("@wooksjs/event-ws"));
|
|
26
|
-
const __prostojs_infact = __toESM(require("@prostojs/infact"));
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let moost = require("moost");
|
|
3
|
+
let _wooksjs_event_ws = require("@wooksjs/event-ws");
|
|
4
|
+
let _prostojs_infact = require("@prostojs/infact");
|
|
27
5
|
|
|
28
6
|
//#region packages/event-ws/src/decorators/ws-method.decorator.ts
|
|
29
7
|
/**
|
|
@@ -68,7 +46,7 @@ const __prostojs_infact = __toESM(require("@prostojs/infact"));
|
|
|
68
46
|
* @decorator
|
|
69
47
|
* @paramType T
|
|
70
48
|
*/ function MessageData() {
|
|
71
|
-
return (0, moost.Resolve)(() => (0,
|
|
49
|
+
return (0, moost.Resolve)(() => (0, _wooksjs_event_ws.useWsMessage)().data, "ws_data");
|
|
72
50
|
}
|
|
73
51
|
/**
|
|
74
52
|
* Get the raw WebSocket message (Buffer or string before parsing).
|
|
@@ -76,7 +54,7 @@ const __prostojs_infact = __toESM(require("@prostojs/infact"));
|
|
|
76
54
|
* @decorator
|
|
77
55
|
* @paramType Buffer | string
|
|
78
56
|
*/ function RawMessage() {
|
|
79
|
-
return (0, moost.Resolve)(() => (0,
|
|
57
|
+
return (0, moost.Resolve)(() => (0, _wooksjs_event_ws.useWsMessage)().raw, "ws_raw");
|
|
80
58
|
}
|
|
81
59
|
/**
|
|
82
60
|
* Get the WebSocket message correlation ID.
|
|
@@ -84,7 +62,7 @@ const __prostojs_infact = __toESM(require("@prostojs/infact"));
|
|
|
84
62
|
* @decorator
|
|
85
63
|
* @paramType string | number | undefined
|
|
86
64
|
*/ function MessageId() {
|
|
87
|
-
return (0, moost.Resolve)(() => (0,
|
|
65
|
+
return (0, moost.Resolve)(() => (0, _wooksjs_event_ws.useWsMessage)().id, "ws_message_id");
|
|
88
66
|
}
|
|
89
67
|
/**
|
|
90
68
|
* Get the WebSocket message event type.
|
|
@@ -92,7 +70,7 @@ const __prostojs_infact = __toESM(require("@prostojs/infact"));
|
|
|
92
70
|
* @decorator
|
|
93
71
|
* @paramType string
|
|
94
72
|
*/ function MessageType() {
|
|
95
|
-
return (0, moost.Resolve)(() => (0,
|
|
73
|
+
return (0, moost.Resolve)(() => (0, _wooksjs_event_ws.useWsMessage)().event, "ws_event");
|
|
96
74
|
}
|
|
97
75
|
/**
|
|
98
76
|
* Get the WebSocket message path.
|
|
@@ -100,7 +78,7 @@ const __prostojs_infact = __toESM(require("@prostojs/infact"));
|
|
|
100
78
|
* @decorator
|
|
101
79
|
* @paramType string
|
|
102
80
|
*/ function MessagePath() {
|
|
103
|
-
return (0, moost.Resolve)(() => (0,
|
|
81
|
+
return (0, moost.Resolve)(() => (0, _wooksjs_event_ws.useWsMessage)().path, "ws_path");
|
|
104
82
|
}
|
|
105
83
|
/**
|
|
106
84
|
* Get the WebSocket connection ID (UUID).
|
|
@@ -108,7 +86,7 @@ const __prostojs_infact = __toESM(require("@prostojs/infact"));
|
|
|
108
86
|
* @decorator
|
|
109
87
|
* @paramType string
|
|
110
88
|
*/ function ConnectionId() {
|
|
111
|
-
return (0, moost.Resolve)(() => (0,
|
|
89
|
+
return (0, moost.Resolve)(() => (0, _wooksjs_event_ws.useWsConnection)().id, "ws_connection_id");
|
|
112
90
|
}
|
|
113
91
|
|
|
114
92
|
//#endregion
|
|
@@ -179,7 +157,7 @@ const LOGGER_TITLE = "moost-ws";
|
|
|
179
157
|
this.moost = moost$1;
|
|
180
158
|
}
|
|
181
159
|
getProvideRegistry() {
|
|
182
|
-
return (0,
|
|
160
|
+
return (0, _prostojs_infact.createProvideRegistry)([MoostWs, () => this], ["MoostWs", () => this], [_wooksjs_event_ws.WooksWs, () => this.getWsApp()], ["WooksWs", () => this.getWsApp()]);
|
|
183
161
|
}
|
|
184
162
|
getLogger() {
|
|
185
163
|
return this.wsApp.getLogger("[moost-ws]");
|
|
@@ -247,11 +225,11 @@ const LOGGER_TITLE = "moost-ws";
|
|
|
247
225
|
this.opts = opts;
|
|
248
226
|
this.name = "ws";
|
|
249
227
|
const wsOpts = opts?.wooksWs;
|
|
250
|
-
if (wsOpts && wsOpts instanceof
|
|
228
|
+
if (wsOpts && wsOpts instanceof _wooksjs_event_ws.WooksWs) this.wsApp = wsOpts;
|
|
251
229
|
else {
|
|
252
230
|
const httpApp = opts?.httpApp && "getHttpApp" in opts.httpApp ? opts.httpApp.getHttpApp() : opts?.httpApp;
|
|
253
|
-
if (httpApp) this.wsApp = (0,
|
|
254
|
-
else this.wsApp = (0,
|
|
231
|
+
if (httpApp) this.wsApp = (0, _wooksjs_event_ws.createWsApp)(httpApp, wsOpts || {});
|
|
232
|
+
else this.wsApp = (0, _wooksjs_event_ws.createWsApp)(wsOpts || {});
|
|
255
233
|
}
|
|
256
234
|
}
|
|
257
235
|
};
|
|
@@ -356,26 +334,26 @@ exports.RawMessage = RawMessage;
|
|
|
356
334
|
Object.defineProperty(exports, 'WooksWs', {
|
|
357
335
|
enumerable: true,
|
|
358
336
|
get: function () {
|
|
359
|
-
return
|
|
337
|
+
return _wooksjs_event_ws.WooksWs;
|
|
360
338
|
}
|
|
361
339
|
});
|
|
362
340
|
exports.WsApp = WsApp;
|
|
363
341
|
Object.defineProperty(exports, 'WsError', {
|
|
364
342
|
enumerable: true,
|
|
365
343
|
get: function () {
|
|
366
|
-
return
|
|
344
|
+
return _wooksjs_event_ws.WsError;
|
|
367
345
|
}
|
|
368
346
|
});
|
|
369
347
|
Object.defineProperty(exports, 'WsRoomManager', {
|
|
370
348
|
enumerable: true,
|
|
371
349
|
get: function () {
|
|
372
|
-
return
|
|
350
|
+
return _wooksjs_event_ws.WsRoomManager;
|
|
373
351
|
}
|
|
374
352
|
});
|
|
375
353
|
Object.defineProperty(exports, 'currentConnection', {
|
|
376
354
|
enumerable: true,
|
|
377
355
|
get: function () {
|
|
378
|
-
return
|
|
356
|
+
return _wooksjs_event_ws.currentConnection;
|
|
379
357
|
}
|
|
380
358
|
});
|
|
381
359
|
Object.defineProperty(exports, 'defineAfterInterceptor', {
|
|
@@ -399,48 +377,48 @@ Object.defineProperty(exports, 'defineInterceptor', {
|
|
|
399
377
|
Object.defineProperty(exports, 'prepareTestWsConnectionContext', {
|
|
400
378
|
enumerable: true,
|
|
401
379
|
get: function () {
|
|
402
|
-
return
|
|
380
|
+
return _wooksjs_event_ws.prepareTestWsConnectionContext;
|
|
403
381
|
}
|
|
404
382
|
});
|
|
405
383
|
Object.defineProperty(exports, 'prepareTestWsMessageContext', {
|
|
406
384
|
enumerable: true,
|
|
407
385
|
get: function () {
|
|
408
|
-
return
|
|
386
|
+
return _wooksjs_event_ws.prepareTestWsMessageContext;
|
|
409
387
|
}
|
|
410
388
|
});
|
|
411
389
|
Object.defineProperty(exports, 'useWsConnection', {
|
|
412
390
|
enumerable: true,
|
|
413
391
|
get: function () {
|
|
414
|
-
return
|
|
392
|
+
return _wooksjs_event_ws.useWsConnection;
|
|
415
393
|
}
|
|
416
394
|
});
|
|
417
395
|
Object.defineProperty(exports, 'useWsMessage', {
|
|
418
396
|
enumerable: true,
|
|
419
397
|
get: function () {
|
|
420
|
-
return
|
|
398
|
+
return _wooksjs_event_ws.useWsMessage;
|
|
421
399
|
}
|
|
422
400
|
});
|
|
423
401
|
Object.defineProperty(exports, 'useWsRooms', {
|
|
424
402
|
enumerable: true,
|
|
425
403
|
get: function () {
|
|
426
|
-
return
|
|
404
|
+
return _wooksjs_event_ws.useWsRooms;
|
|
427
405
|
}
|
|
428
406
|
});
|
|
429
407
|
Object.defineProperty(exports, 'useWsServer', {
|
|
430
408
|
enumerable: true,
|
|
431
409
|
get: function () {
|
|
432
|
-
return
|
|
410
|
+
return _wooksjs_event_ws.useWsServer;
|
|
433
411
|
}
|
|
434
412
|
});
|
|
435
413
|
Object.defineProperty(exports, 'wsConnectionKind', {
|
|
436
414
|
enumerable: true,
|
|
437
415
|
get: function () {
|
|
438
|
-
return
|
|
416
|
+
return _wooksjs_event_ws.wsConnectionKind;
|
|
439
417
|
}
|
|
440
418
|
});
|
|
441
419
|
Object.defineProperty(exports, 'wsMessageKind', {
|
|
442
420
|
enumerable: true,
|
|
443
421
|
get: function () {
|
|
444
|
-
return
|
|
422
|
+
return _wooksjs_event_ws.wsMessageKind;
|
|
445
423
|
}
|
|
446
424
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moostjs/event-ws",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.10",
|
|
4
4
|
"description": "@moostjs/event-ws",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"composables",
|
|
@@ -39,15 +39,15 @@
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@wooksjs/event-ws": "^0.7.
|
|
42
|
+
"@wooksjs/event-ws": "^0.7.12"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"vitest": "3.2.4"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@prostojs/infact": "^0.4.1",
|
|
49
|
-
"@wooksjs/event-core": "^0.7.
|
|
50
|
-
"moost": "^0.6.
|
|
49
|
+
"@wooksjs/event-core": "^0.7.12",
|
|
50
|
+
"moost": "^0.6.10"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"pub": "pnpm publish --access public",
|