@futdevpro/nts-dynamo 1.5.40 → 1.5.47

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.
Files changed (118) hide show
  1. package/futdevpro-nts-dynamo-01.05.41.tgz +0 -0
  2. package/futdevpro-nts-dynamo-01.05.42.tgz +0 -0
  3. package/futdevpro-nts-dynamo-01.05.43.tgz +0 -0
  4. package/futdevpro-nts-dynamo-01.05.44.tgz +0 -0
  5. package/futdevpro-nts-dynamo-01.05.45.tgz +0 -0
  6. package/lib/_enums/http/socket-event.enum.d.ts +2 -0
  7. package/lib/_enums/http/socket-event.enum.d.ts.map +1 -1
  8. package/lib/_enums/http/socket-event.enum.js +2 -0
  9. package/lib/_enums/http/socket-event.enum.js.map +1 -1
  10. package/lib/_models/dynamo-nts-endpoint-params.js +1 -1
  11. package/lib/_models/dynamo-nts-endpoint-params.js.map +1 -1
  12. package/lib/_models/dynamo-nts-socket-dictionary.d.ts +16 -0
  13. package/lib/_models/dynamo-nts-socket-dictionary.d.ts.map +1 -0
  14. package/lib/_models/dynamo-nts-socket-dictionary.js +31 -0
  15. package/lib/_models/dynamo-nts-socket-dictionary.js.map +1 -0
  16. package/lib/_models/dynamo-nts-socket-event-params.d.ts +2 -0
  17. package/lib/_models/dynamo-nts-socket-event-params.d.ts.map +1 -1
  18. package/lib/_models/dynamo-nts-socket-event-params.js +6 -5
  19. package/lib/_models/dynamo-nts-socket-event-params.js.map +1 -1
  20. package/lib/_models/index.d.ts +1 -0
  21. package/lib/_models/index.d.ts.map +1 -1
  22. package/lib/_models/index.js +1 -0
  23. package/lib/_models/index.js.map +1 -1
  24. package/lib/_modules/app-extended.index.d.ts +1 -0
  25. package/lib/_modules/app-extended.index.d.ts.map +1 -1
  26. package/lib/_modules/app-extended.index.js +1 -0
  27. package/lib/_modules/app-extended.index.js.map +1 -1
  28. package/lib/_modules/test/custom-data.service.d.ts +3 -3
  29. package/lib/_modules/test/custom-data.service.d.ts.map +1 -1
  30. package/lib/_modules/test/custom-data.service.js +4 -4
  31. package/lib/_modules/test/custom-data.service.js.map +1 -1
  32. package/lib/_modules/test/test-controller.js +6 -6
  33. package/lib/_modules/test/test-controller.js.map +1 -1
  34. package/lib/_modules/usage/usage-controller.js +1 -1
  35. package/lib/_modules/usage/usage-controller.js.map +1 -1
  36. package/lib/_modules/usage/usage.service.d.ts +6 -6
  37. package/lib/_modules/usage/usage.service.d.ts.map +1 -1
  38. package/lib/_modules/usage/usage.service.js +18 -10
  39. package/lib/_modules/usage/usage.service.js.map +1 -1
  40. package/lib/_services/dynamo-nts-api.service.d.ts.map +1 -1
  41. package/lib/_services/dynamo-nts-api.service.js +19 -8
  42. package/lib/_services/dynamo-nts-api.service.js.map +1 -1
  43. package/lib/_services/dynamo-nts-app-extended.d.ts +1 -1
  44. package/lib/_services/dynamo-nts-app-extended.d.ts.map +1 -1
  45. package/lib/_services/dynamo-nts-app-extended.js +2 -4
  46. package/lib/_services/dynamo-nts-app-extended.js.map +1 -1
  47. package/lib/_services/dynamo-nts-app.d.ts +1 -0
  48. package/lib/_services/dynamo-nts-app.d.ts.map +1 -1
  49. package/lib/_services/dynamo-nts-app.js +4 -1
  50. package/lib/_services/dynamo-nts-app.js.map +1 -1
  51. package/lib/_services/dynamo-nts-auth.service.d.ts.map +1 -1
  52. package/lib/_services/dynamo-nts-auth.service.js +10 -4
  53. package/lib/_services/dynamo-nts-auth.service.js.map +1 -1
  54. package/lib/_services/dynamo-nts-controller.service.d.ts +37 -0
  55. package/lib/_services/dynamo-nts-controller.service.d.ts.map +1 -1
  56. package/lib/_services/dynamo-nts-controller.service.js +37 -0
  57. package/lib/_services/dynamo-nts-controller.service.js.map +1 -1
  58. package/lib/_services/dynamo-nts-data.service.d.ts +21 -2
  59. package/lib/_services/dynamo-nts-data.service.d.ts.map +1 -1
  60. package/lib/_services/dynamo-nts-data.service.js +121 -53
  61. package/lib/_services/dynamo-nts-data.service.js.map +1 -1
  62. package/lib/_services/dynamo-nts-db.service.d.ts +4 -4
  63. package/lib/_services/dynamo-nts-db.service.d.ts.map +1 -1
  64. package/lib/_services/dynamo-nts-db.service.js +148 -84
  65. package/lib/_services/dynamo-nts-db.service.js.map +1 -1
  66. package/lib/_services/dynamo-nts-email.service.d.ts.map +1 -1
  67. package/lib/_services/dynamo-nts-email.service.js +20 -16
  68. package/lib/_services/dynamo-nts-email.service.js.map +1 -1
  69. package/lib/_services/dynamo-nts-global.service.d.ts +5 -5
  70. package/lib/_services/dynamo-nts-global.service.d.ts.map +1 -1
  71. package/lib/_services/dynamo-nts-global.service.js.map +1 -1
  72. package/lib/_services/dynamo-nts-routing-module.service.d.ts.map +1 -1
  73. package/lib/_services/dynamo-nts-routing-module.service.js +17 -11
  74. package/lib/_services/dynamo-nts-routing-module.service.js.map +1 -1
  75. package/lib/_services/dynamo-nts-shared.service.d.ts +6 -0
  76. package/lib/_services/dynamo-nts-shared.service.d.ts.map +1 -1
  77. package/lib/_services/dynamo-nts-shared.service.js +8 -0
  78. package/lib/_services/dynamo-nts-shared.service.js.map +1 -1
  79. package/lib/_services/dynamo-nts-socket-service-collection.service.d.ts +1 -1
  80. package/lib/_services/dynamo-nts-socket-service-collection.service.d.ts.map +1 -1
  81. package/lib/_services/dynamo-nts-socket.service.d.ts +6 -9
  82. package/lib/_services/dynamo-nts-socket.service.d.ts.map +1 -1
  83. package/lib/_services/dynamo-nts-socket.service.js +25 -20
  84. package/lib/_services/dynamo-nts-socket.service.js.map +1 -1
  85. package/lib/_services/dynamobe-api.service.js +2 -2
  86. package/lib/_services/dynamobe-auth.service.js +2 -2
  87. package/lib/_services/dynamobe-data.service.d.ts +2 -2
  88. package/lib/_services/dynamobe-data.service.js +15 -15
  89. package/lib/_services/dynamobe-db.service.d.ts +4 -4
  90. package/lib/_services/dynamobe-db.service.js +28 -28
  91. package/lib/_services/dynamobe-email.service.js +4 -4
  92. package/lib/_services/dynamobe-global.service.d.ts +3 -3
  93. package/lib/_services/dynamobe-routing-module.service.js +3 -3
  94. package/lib/tsconfig.tsbuildinfo +1 -5564
  95. package/package.json +22 -12
  96. package/src/_enums/http/socket-event.enum.ts +2 -0
  97. package/src/_models/dynamo-nts-endpoint-params.ts +1 -1
  98. package/src/_models/dynamo-nts-socket-dictionary.ts +39 -0
  99. package/src/_models/dynamo-nts-socket-event-params.ts +8 -5
  100. package/src/_models/index.ts +1 -0
  101. package/src/_modules/app-extended.index.ts +1 -0
  102. package/src/_modules/test/custom-data.service.ts +4 -4
  103. package/src/_modules/test/test-controller.ts +7 -7
  104. package/src/_modules/usage/usage-controller.ts +2 -2
  105. package/src/_modules/usage/usage.service.ts +34 -26
  106. package/src/_services/dynamo-nts-api.service.ts +26 -9
  107. package/src/_services/dynamo-nts-app-extended.ts +9 -9
  108. package/src/_services/dynamo-nts-app.ts +2 -2
  109. package/src/_services/dynamo-nts-auth.service.ts +13 -5
  110. package/src/_services/dynamo-nts-controller.service.ts +37 -0
  111. package/src/_services/dynamo-nts-data.service.ts +123 -55
  112. package/src/_services/dynamo-nts-db.service.ts +181 -87
  113. package/src/_services/dynamo-nts-email.service.ts +21 -17
  114. package/src/_services/dynamo-nts-global.service.ts +12 -5
  115. package/src/_services/dynamo-nts-routing-module.service.ts +16 -10
  116. package/src/_services/dynamo-nts-shared.service.ts +9 -0
  117. package/src/_services/dynamo-nts-socket-service-collection.service.ts +1 -1
  118. package/src/_services/dynamo-nts-socket.service.ts +33 -29
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- import { Metadata, DynamoNTS_DataParams } from '@futdevpro/fsm-dynamo';
3
+ import { Dynamo_Metadata, DynamoNTS_DataParams } from '@futdevpro/fsm-dynamo';
4
4
 
5
5
  import { DynamoNTS_AuthService } from './dynamo-nts-auth.service';
6
6
  import { DynamoNTS_DBServiceCollection } from './dynamo-nts-db-service-collection.service';
@@ -79,6 +79,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
79
79
  `\nPlease create a Unique Authentication Service extending DynamoNTS_AuthService, ` +
80
80
  `and Setup with "DBE_Global_SC.setServices(...)"`);
81
81
  }
82
+
82
83
  return this.instance.authService;
83
84
  }
84
85
 
@@ -93,6 +94,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
93
94
  `\nPlease create a Unique DataBase Service Collection extending DynamoNTS_DBServiceCollection, ` +
94
95
  `and Setup with "DBE_Global_SC.setServices(...)"`);
95
96
  }
97
+
96
98
  return this.instance.dbServiceCollection;
97
99
  }
98
100
 
@@ -101,7 +103,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
101
103
  * @param dataParams
102
104
  * @returns
103
105
  */
104
- static getDBService<T extends Metadata>(dataParams: DynamoNTS_DataParams): DynamoNTS_DBService<T> {
106
+ static getDBService<T extends Dynamo_Metadata>(dataParams: DynamoNTS_DataParams): DynamoNTS_DBService<T> {
105
107
  return this.getDBServiceByKey<T>(dataParams.dataName);
106
108
  }
107
109
 
@@ -110,13 +112,14 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
110
112
  * @param key
111
113
  * @returns
112
114
  */
113
- static getDBServiceByKey<T extends Metadata>(key: string): DynamoNTS_DBService<T> {
115
+ static getDBServiceByKey<T extends Dynamo_Metadata>(key: string): DynamoNTS_DBService<T> {
114
116
  const collection = this.getDBServiceCollection();
115
117
  if (collection[key]) {
116
118
  return collection[key] as DynamoNTS_DBService<T>;
117
119
  } else {
118
120
  let keys: string = `${Object.keys(collection)}`;
119
121
  keys = keys.replace(/,/g, '\n ');
122
+
120
123
  throw new Error(
121
124
  `\nDBE_Global_S.getDBService failed, ERROR:
122
125
  no dbService on collection with this key: ${key}!
@@ -136,6 +139,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
136
139
  `\nPlease create a Unique Email Service Collection extending DynamoBEEmailServiceCollection, ` +
137
140
  `and Setup with "DBE_Global_SC.setServices(...)"`);
138
141
  }
142
+
139
143
  return this.instance.emailServiceCollection;
140
144
  }
141
145
 
@@ -151,6 +155,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
151
155
  `in the setupModules in the App using DynamoNTS_AppExtended, ` +
152
156
  `and Setup with "DBE_Global_SC.setServices(...)"`);
153
157
  }
158
+
154
159
  return this.instance.socketServiceCollection;
155
160
  }
156
161
 
@@ -159,13 +164,14 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
159
164
  * @param name
160
165
  * @returns
161
166
  */
162
- static getSocketServiceByName(name: string): DynamoNTS_SocketService {
167
+ static getSocketServiceByName(name: string): DynamoNTS_SocketService<any> {
163
168
  const collection = this.getSocketServiceCollection();
164
169
  if (collection[name]) {
165
170
  return collection[name];
166
171
  } else {
167
172
  let names: string = `${Object.keys(collection)}`;
168
173
  names = names.replace(/,/g, '\n ');
174
+
169
175
  throw new Error(
170
176
  `\nDBE_Global_S.getSocketServiceByName failed, ERROR:
171
177
  no socketService on collection with this name: ${name}!
@@ -174,13 +180,14 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
174
180
  }
175
181
  }
176
182
 
177
- static attachNewSocketService(service: DynamoNTS_SocketService): void {
183
+ static attachNewSocketService(service: DynamoNTS_SocketService<any>): void {
178
184
  const collection = this.getSocketServiceCollection();
179
185
  if (!collection[service.name]) {
180
186
  collection[service.name] = service;
181
187
  } else {
182
188
  let names: string = `${Object.keys(collection)}`;
183
189
  names = names.replace(/,/g, '\n ');
190
+
184
191
  throw new Error(
185
192
  `\nDBE_Global_S.attachNewSocketService failed, ERROR:
186
193
  socketService name is already taken on collection with this name: ${service.name}!
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { Router } from 'express';
3
- import { DynamoNTS_Error } from '@futdevpro/fsm-dynamo';
3
+ import { Dynamo_Error } from '@futdevpro/fsm-dynamo';
4
4
 
5
5
  import { dynamoNTS_GlobalSettings } from '../_constants/dynamo-nts-global-settings';
6
6
  import { DynamoNTS_RouteSecurity } from '../_enums/dynamo-nts-route-security.enum';
@@ -89,9 +89,11 @@ export class DynamoNTS_RoutingModule {
89
89
  this.mountSecureRoute(endpoint);
90
90
  }
91
91
  } catch (error) {
92
- throw new DynamoNTS_Error({
93
- message: `DYNAMOBEERROR: Failed to mount routes.`,
94
- userMessage: `We encountered an uncought BackEnd Build Error, please contact the responsible development team. errorcode: 900-456-100`,
92
+ throw new Dynamo_Error({
93
+ errorCode: 'NTS-RM9-100',
94
+ addECToUserMsg: true,
95
+ message: `DYNAMO-NTS ERROR: Failed to mount routes.`,
96
+ userMessage: `We encountered an uncought BackEnd Build Error, please contact the responsible development team.`,
95
97
  error
96
98
  })
97
99
  }
@@ -125,9 +127,11 @@ export class DynamoNTS_RoutingModule {
125
127
  endpointParams.preProcessess, endpointParams.getTasksExecution());
126
128
  break;
127
129
  default:
128
- throw new DynamoNTS_Error({
129
- message: `DYNAMOBEERROR: INVALID route type: ${endpointParams.type} - ${endpointParams.name}` ,
130
- userMessage: `We encountered an uncought BackEnd Build Error, please contact the responsible development team. errorcode: 900-456-200`,
130
+ throw new Dynamo_Error({
131
+ errorCode: 'NTS-RM9-200',
132
+ addECToUserMsg: true,
133
+ message: `DYNAMO-NTS ERROR: INVALID route type: ${endpointParams.type} - ${endpointParams.name}` ,
134
+ userMessage: `We encountered an uncought BackEnd Build Error, please contact the responsible development team.`,
131
135
  error: new Error()
132
136
  })
133
137
  }
@@ -160,9 +164,11 @@ export class DynamoNTS_RoutingModule {
160
164
  endpointParams.preProcessess, endpointParams.getTasksExecution());
161
165
  break;
162
166
  default:
163
- throw new DynamoNTS_Error({
164
- message: `DYNAMOBEERROR: INVALID route type: ${endpointParams.type} - ${endpointParams.name}`,
165
- userMessage: `We encountered an uncought BackEnd Build Error, please contact the responsible development team. errorcode: 900-456-300`,
167
+ throw new Dynamo_Error({
168
+ errorCode: 'NTS-RM9-300',
169
+ addECToUserMsg: true,
170
+ message: `DYNAMO-NTS ERROR: INVALID route type: ${endpointParams.type} - ${endpointParams.name}`,
171
+ userMessage: `We encountered an uncought BackEnd Build Error, please contact the responsible development team.`,
166
172
  error: new Error()
167
173
  })
168
174
  }
@@ -35,6 +35,15 @@ export class DynamoNTS_Shared extends Dynamo_Shared {
35
35
  return GeoIp.lookup(this.getIpFromRequest(request));
36
36
  }
37
37
 
38
+ /**
39
+ *
40
+ * @param request
41
+ * @returns
42
+ */
43
+ static getLocationByIp(ip: string): GeoIpLocation {
44
+ return GeoIp.lookup(ip);
45
+ }
46
+
38
47
  /**
39
48
  *
40
49
  * @param question
@@ -11,6 +11,6 @@ export class DynamoNTS_SocketServiceCollection extends DynamoNTS_SingletonServic
11
11
  return DynamoNTS_SocketServiceCollection.getSingletonInstance();
12
12
  }
13
13
 
14
- [service: string]: DynamoNTS_SocketService;
14
+ [service: string]: DynamoNTS_SocketService<any>;
15
15
 
16
16
  }
@@ -3,23 +3,19 @@ import * as SocketIO from 'socket.io';
3
3
 
4
4
  import { dynamoNTS_GlobalSettings } from '../_constants/dynamo-nts-global-settings';
5
5
  import { DynamoNTS_Shared } from './dynamo-nts-shared.service';
6
- import { DynamoNTS_SocketServiceParams } from '../_models';
7
6
  import { DynamoNTS_SingletonService } from './dynamo-nts-singleton.service';
8
7
  import { DynamoNTS_SocketEventParams } from '../_models/dynamo-nts-socket-event-params';
9
8
  import { DynamoNTS_SocketEvent } from '../_enums/http/socket-event.enum';
10
9
  import { DynamoNTS_GlobalService } from './dynamo-nts-global.service';
11
- import { DynamoNTS_Error } from '@futdevpro/fsm-dynamo';
12
- import { DynamoNTS_SocketSecurity } from '../_enums';
13
-
14
- export interface DynamoNTS_SocketDictionary {
15
- id?: string;
16
- sockets: SocketIO.Socket[];
17
- }
10
+ import { Dynamo_Error } from '@futdevpro/fsm-dynamo';
11
+ import { DynamoNTS_SocketServiceParams } from '../_models/dynamo-nts-socket-service-params';
12
+ import { DynamoNTS_SocketDictionary } from '../_models/dynamo-nts-socket-dictionary';
13
+ import { DynamoNTS_SocketSecurity } from '../_enums/dynamo-nts-socket-security.enum';
18
14
 
19
15
  /**
20
16
  *
21
17
  */
22
- export abstract class DynamoNTS_SocketService extends DynamoNTS_SingletonService {
18
+ export abstract class DynamoNTS_SocketService<T extends DynamoNTS_SocketDictionary> extends DynamoNTS_SingletonService {
23
19
  protected params: DynamoNTS_SocketServiceParams;
24
20
  get name(): string { return this.params.name; }
25
21
  get port(): number { return this.params.port; }
@@ -31,8 +27,8 @@ export abstract class DynamoNTS_SocketService extends DynamoNTS_SingletonService
31
27
  protected incomingEvents: DynamoNTS_SocketEventParams<any>[];
32
28
 
33
29
  private subscriptionEvent: DynamoNTS_SocketEventParams<any>;
34
- private getIdFromSubscrioption?: <T>(content: T) => Promise<string>;
35
- private activeSockets: DynamoNTS_SocketDictionary[] = [];
30
+ private getDicFromSubscrioption?: (content: any) => Promise<T>;
31
+ protected activeSockets: T[] = [];
36
32
 
37
33
  protected log: boolean = dynamoNTS_GlobalSettings.logSetup;
38
34
 
@@ -69,8 +65,9 @@ export abstract class DynamoNTS_SocketService extends DynamoNTS_SingletonService
69
65
  tasks: []
70
66
  });
71
67
  }
68
+ this.connectEvent.socketName = this.params.name;
72
69
 
73
- if (this.getIdFromSubscrioption) {
70
+ if (this.getDicFromSubscrioption) {
74
71
  const subscriptionEventIndex = this.incomingEvents.findIndex((event: DynamoNTS_SocketEventParams<any>) => event.event === DynamoNTS_SocketEvent.subscribe);
75
72
  if (0 <= subscriptionEventIndex) {
76
73
  this.subscriptionEvent = this.incomingEvents.splice(subscriptionEventIndex)[0];
@@ -92,7 +89,13 @@ export abstract class DynamoNTS_SocketService extends DynamoNTS_SingletonService
92
89
  ]
93
90
  }));
94
91
  }
92
+
93
+ this.subscriptionEvent.socketName = this.params.name;
95
94
  }
95
+
96
+ this.incomingEvents.forEach((event: DynamoNTS_SocketEventParams<any>) => {
97
+ event.socketName = this.params.name;
98
+ });
96
99
  }
97
100
 
98
101
  async setupSocketServer(newSocketServer: SocketIO.Server): Promise<void> {
@@ -108,11 +111,12 @@ export abstract class DynamoNTS_SocketService extends DynamoNTS_SingletonService
108
111
  await this.connectEvent.tasks[i](socket);
109
112
  }
110
113
 
111
- if (this.getIdFromSubscrioption) {
114
+ if (this.getDicFromSubscrioption) {
112
115
  socket.on(DynamoNTS_SocketEvent.subscribe, async (content: any) => {
113
- issuer = await this.getIdFromSubscrioption(content);
116
+ const dic: T = await this.getDicFromSubscrioption(content);
117
+ issuer = dic.issuerId;
114
118
 
115
- this.socketSubscription(socket, issuer);
119
+ this.socketSubscription(dic);
116
120
  this.subscriptionEvent.getFullExecution(issuer)(content);
117
121
  })
118
122
  }
@@ -124,18 +128,18 @@ export abstract class DynamoNTS_SocketService extends DynamoNTS_SingletonService
124
128
 
125
129
  this.socketServer.listen(this.params.port);
126
130
 
127
- if (this.log) console.log(
131
+ console.log(
128
132
  `\nsocket service setup finished: ${this.params.name}` +
129
133
  `\nsocket server listening on port: ${this.params.port}`
130
134
  );
131
135
  }
132
136
 
133
- private async socketSubscription(newSocket: SocketIO.Socket, id: string): Promise<void> {
134
- const activeSocket: DynamoNTS_SocketDictionary = this.activeSockets.find((dic: DynamoNTS_SocketDictionary) => dic.id === id);
137
+ private async socketSubscription(dictionary: T): Promise<void> {
138
+ const activeSocket: T = this.activeSockets.find((dic: T) => dic.issuerId === dictionary.issuerId);
135
139
  if (activeSocket) {
136
- activeSocket.sockets.push(newSocket);
140
+ activeSocket.sockets.push(dictionary.sockets[0]);
137
141
  } else {
138
- this.activeSockets.push({ id, sockets: [ newSocket ] });
142
+ this.activeSockets.push(dictionary);
139
143
  }
140
144
  }
141
145
 
@@ -155,26 +159,26 @@ export abstract class DynamoNTS_SocketService extends DynamoNTS_SingletonService
155
159
  }
156
160
 
157
161
  idIsSubscribed(id: string): boolean {
158
- return !!this.activeSockets.find((dic: DynamoNTS_SocketDictionary) => dic.id === id);
162
+ return !!this.activeSockets.find((dic: DynamoNTS_SocketDictionary) => dic.issuerId === id);
159
163
  }
160
164
 
161
165
  async sendEventForId(id: string, event: string, content: any, error?: (err: any) => void): Promise<void> {
162
- const dic: DynamoNTS_SocketDictionary = this.activeSockets.find((dic: DynamoNTS_SocketDictionary) => dic.id === id);
166
+ const dic: DynamoNTS_SocketDictionary = this.activeSockets.find((dic: DynamoNTS_SocketDictionary) => dic.issuerId === id);
163
167
  if (dic) {
164
- dic.sockets.forEach((socket: SocketIO.Socket) => {
165
- socket.emit(event, content);
166
- });
168
+ dic.emitEvent(event, content);
167
169
  } else {
168
170
  if (error)
169
- throw new DynamoNTS_Error({ status: 404, message: `No active socket whit this specific ID: ${id}` });
171
+ throw new Dynamo_Error({
172
+ status: 404,
173
+ errorCode: 'NTS-S99-001',
174
+ message: `No active socket whit this specific ID: ${id}`
175
+ });
170
176
  }
171
177
  }
172
178
 
173
179
  broadcastEvent(event: string, content: any): void {
174
180
  this.activeSockets.forEach((dic: DynamoNTS_SocketDictionary) => {
175
- dic.sockets.forEach((socket: SocketIO.Socket) => {
176
- socket.emit(event, content);
177
- })
181
+ dic.emitEvent(event, content);
178
182
  })
179
183
  }
180
184