@eleven-am/pondsocket 0.1.86 → 0.1.88
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/nest.js +15 -9
- package/package.json +1 -1
package/nest.js
CHANGED
|
@@ -50,6 +50,12 @@ const channelClassKey = Symbol('channel');
|
|
|
50
50
|
const endpointClassKey = Symbol('endpoint');
|
|
51
51
|
const channelsClassKey = Symbol('channels');
|
|
52
52
|
const endpointsClassKey = Symbol('endpoints');
|
|
53
|
+
function isNotEmpty(value) {
|
|
54
|
+
return value !== null &&
|
|
55
|
+
value !== undefined &&
|
|
56
|
+
value !== '' &&
|
|
57
|
+
Object.keys(value).length !== 0;
|
|
58
|
+
}
|
|
53
59
|
function createClassDecorator(key, value) {
|
|
54
60
|
return (0, common_1.applyDecorators)((0, common_1.Injectable)(), (0, common_1.SetMetadata)(key, value));
|
|
55
61
|
}
|
|
@@ -360,10 +366,10 @@ function OnJoinRequest() {
|
|
|
360
366
|
if (!response.hasResponded) {
|
|
361
367
|
if (data) {
|
|
362
368
|
const { event, presence, assigns } = data, rest = __rest(data, ["event", "presence", "assigns"]);
|
|
363
|
-
if (event
|
|
364
|
-
response.send(event
|
|
369
|
+
if (typeof event === 'string' && isNotEmpty(rest)) {
|
|
370
|
+
response.send(event, rest, assigns);
|
|
365
371
|
}
|
|
366
|
-
else
|
|
372
|
+
else {
|
|
367
373
|
response.accept(assigns);
|
|
368
374
|
}
|
|
369
375
|
if (presence) {
|
|
@@ -392,10 +398,10 @@ function OnEvent(event = '*') {
|
|
|
392
398
|
if (!response.hasResponded) {
|
|
393
399
|
if (data) {
|
|
394
400
|
const { event, presence, updatePresence, assigns } = data, rest = __rest(data, ["event", "presence", "updatePresence", "assigns"]);
|
|
395
|
-
if (event
|
|
396
|
-
response.send(event
|
|
401
|
+
if (typeof event === 'string' && isNotEmpty(rest)) {
|
|
402
|
+
response.send(event, rest, assigns);
|
|
397
403
|
}
|
|
398
|
-
else
|
|
404
|
+
else {
|
|
399
405
|
response.accept(assigns);
|
|
400
406
|
}
|
|
401
407
|
if (presence) {
|
|
@@ -427,10 +433,10 @@ function OnConnectionRequest() {
|
|
|
427
433
|
if (!response.hasResponded) {
|
|
428
434
|
if (data) {
|
|
429
435
|
const { event, assigns } = data, rest = __rest(data, ["event", "assigns"]);
|
|
430
|
-
if (event
|
|
431
|
-
response.send(event
|
|
436
|
+
if (typeof event === 'string' && isNotEmpty(rest)) {
|
|
437
|
+
response.send(event, rest, assigns);
|
|
432
438
|
}
|
|
433
|
-
else
|
|
439
|
+
else {
|
|
434
440
|
response.accept(assigns);
|
|
435
441
|
}
|
|
436
442
|
}
|