@ejfdelgado/ejflab-back 1.32.10 → 1.32.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ejfdelgado/ejflab-back",
3
- "version": "1.32.10",
3
+ "version": "1.32.12",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ejfdelgado/ejflab-back.git"
@@ -19,7 +19,7 @@
19
19
  "license": "ISC",
20
20
  "private": false,
21
21
  "dependencies": {
22
- "@ejfdelgado/ejflab-common": "1.16.3",
22
+ "@ejfdelgado/ejflab-common": "1.16.4",
23
23
  "@google-cloud/compute": "^4.7.0",
24
24
  "@google-cloud/firestore": "^7.9.0",
25
25
  "@google-cloud/storage": "^7.11.3",
@@ -49,10 +49,13 @@ export class SocketIOCall {
49
49
  static socketRoomUUIDMap = {};
50
50
  static socketToImage = {};
51
51
  static hookProcessors = {};
52
+ static internalBus = new EventEmitter();
52
53
 
53
54
  static echoLog(message) {
54
- console.log(message);
55
- SocketIOCall.io.emit('echoLog', { message });
55
+ if (process.env.ENV != "pro") {
56
+ console.log(message);
57
+ SocketIOCall.io.emit('echoLog', { message });
58
+ }
56
59
  }
57
60
 
58
61
  static setFlowChartExec(room, instance) {
@@ -375,10 +378,14 @@ export class SocketIOCall {
375
378
  const extraHooks = Object.keys(SocketIOCall.hookProcessors);
376
379
  for (let k = 0; k < extraHooks.length; k++) {
377
380
  const hookId = extraHooks[k];
378
- socket.on(hookId, (payload) => {
381
+ const commonCall = (payload) => {
379
382
  const className = SocketIOCall.hookProcessors[hookId];
380
383
  new className(SocketIOCall, SocketIOCall.io, socket).executeSave(payload);
381
- });
384
+ };
385
+ socket.on(hookId, commonCall);
386
+ if (SocketIOCall.internalBus.listenerCount(hookId) == 0) {
387
+ SocketIOCall.internalBus.on(hookId, commonCall);
388
+ }
382
389
  }
383
390
  }
384
391
 
@@ -17,11 +17,17 @@ export class DisconnectProcessor extends GenericProcessor {
17
17
  }
18
18
  }
19
19
 
20
- clearPersonFromPeople(people, socketId) {
20
+ clearPersonFromPeople(people, socketId, room) {
21
21
  for (let personId in people) {
22
22
  const onePerson = people[personId];
23
23
  if (onePerson.socket == socketId || socketId == personId) {
24
- delete people[personId]
24
+ if (onePerson.sharedState && onePerson.sharedState.user_id) {
25
+ this.context.internalBus.emit("closeVideoChat", {
26
+ provider: onePerson.sharedState.user_id,
27
+ room: room,
28
+ });
29
+ }
30
+ delete people[personId];
25
31
  break;
26
32
  }
27
33
  }
@@ -43,11 +49,11 @@ export class DisconnectProcessor extends GenericProcessor {
43
49
  //
44
50
  const people = SimpleObj.getValue(roomData.model, "data.people", null);
45
51
  if (people) {
46
- this.clearPersonFromPeople(people, socketId);
52
+ this.clearPersonFromPeople(people, socketId, room);
47
53
  }
48
54
 
49
55
  const observe = ["data", "data.state", "data.state.sources", "data.state.processors", "data.people"];
50
56
  let changes = roomData.builder.trackDifferences(roomData.model, [], null, observe);
51
57
  roomData.model = roomData.builder.affect(changes);
52
58
  }
53
- }
59
+ }