@futdevpro/nts-dynamo 1.5.40 → 1.5.45
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/futdevpro-nts-dynamo-01.05.41.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.42.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.43.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.44.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.45.tgz +0 -0
- package/lib/_enums/http/socket-event.enum.d.ts +2 -0
- package/lib/_enums/http/socket-event.enum.d.ts.map +1 -1
- package/lib/_enums/http/socket-event.enum.js +2 -0
- package/lib/_enums/http/socket-event.enum.js.map +1 -1
- package/lib/_models/dynamo-nts-socket-dictionary.d.ts +16 -0
- package/lib/_models/dynamo-nts-socket-dictionary.d.ts.map +1 -0
- package/lib/_models/dynamo-nts-socket-dictionary.js +28 -0
- package/lib/_models/dynamo-nts-socket-dictionary.js.map +1 -0
- package/lib/_models/dynamo-nts-socket-event-params.d.ts +2 -0
- package/lib/_models/dynamo-nts-socket-event-params.d.ts.map +1 -1
- package/lib/_models/dynamo-nts-socket-event-params.js +6 -5
- package/lib/_models/dynamo-nts-socket-event-params.js.map +1 -1
- package/lib/_models/index.d.ts +1 -0
- package/lib/_models/index.d.ts.map +1 -1
- package/lib/_models/index.js +1 -0
- package/lib/_models/index.js.map +1 -1
- package/lib/_modules/app-extended.index.d.ts +1 -0
- package/lib/_modules/app-extended.index.d.ts.map +1 -1
- package/lib/_modules/app-extended.index.js +1 -0
- package/lib/_modules/app-extended.index.js.map +1 -1
- package/lib/_modules/usage/usage.service.d.ts.map +1 -1
- package/lib/_modules/usage/usage.service.js +8 -4
- package/lib/_modules/usage/usage.service.js.map +1 -1
- package/lib/_services/dynamo-nts-api.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-api.service.js +5 -4
- package/lib/_services/dynamo-nts-api.service.js.map +1 -1
- package/lib/_services/dynamo-nts-app-extended.d.ts +1 -1
- package/lib/_services/dynamo-nts-app-extended.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-app-extended.js +2 -4
- package/lib/_services/dynamo-nts-app-extended.js.map +1 -1
- package/lib/_services/dynamo-nts-app.js +4 -1
- package/lib/_services/dynamo-nts-app.js.map +1 -1
- package/lib/_services/dynamo-nts-auth.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-auth.service.js +4 -2
- package/lib/_services/dynamo-nts-auth.service.js.map +1 -1
- package/lib/_services/dynamo-nts-controller.service.d.ts +37 -0
- package/lib/_services/dynamo-nts-controller.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-controller.service.js +37 -0
- package/lib/_services/dynamo-nts-controller.service.js.map +1 -1
- package/lib/_services/dynamo-nts-data.service.d.ts +19 -0
- package/lib/_services/dynamo-nts-data.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-data.service.js +70 -31
- package/lib/_services/dynamo-nts-data.service.js.map +1 -1
- package/lib/_services/dynamo-nts-db.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-db.service.js +72 -48
- package/lib/_services/dynamo-nts-db.service.js.map +1 -1
- package/lib/_services/dynamo-nts-email.service.js +4 -4
- package/lib/_services/dynamo-nts-email.service.js.map +1 -1
- package/lib/_services/dynamo-nts-global.service.d.ts +2 -2
- package/lib/_services/dynamo-nts-global.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-global.service.js.map +1 -1
- package/lib/_services/dynamo-nts-routing-module.service.js +3 -3
- package/lib/_services/dynamo-nts-routing-module.service.js.map +1 -1
- package/lib/_services/dynamo-nts-shared.service.d.ts +6 -0
- package/lib/_services/dynamo-nts-shared.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-shared.service.js +8 -0
- package/lib/_services/dynamo-nts-shared.service.js.map +1 -1
- package/lib/_services/dynamo-nts-socket-service-collection.service.d.ts +1 -1
- package/lib/_services/dynamo-nts-socket-service-collection.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-socket.service.d.ts +6 -9
- package/lib/_services/dynamo-nts-socket.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-socket.service.js +20 -19
- package/lib/_services/dynamo-nts-socket.service.js.map +1 -1
- package/lib/_services/dynamobe-api.service.js +2 -2
- package/lib/_services/dynamobe-auth.service.js +2 -2
- package/lib/_services/dynamobe-data.service.js +15 -15
- package/lib/_services/dynamobe-db.service.js +24 -24
- package/lib/_services/dynamobe-email.service.js +4 -4
- package/lib/_services/dynamobe-routing-module.service.js +3 -3
- package/lib/tsconfig.tsbuildinfo +77 -52
- package/package.json +12 -9
- package/src/_enums/http/socket-event.enum.ts +2 -0
- package/src/_models/dynamo-nts-socket-dictionary.ts +36 -0
- package/src/_models/dynamo-nts-socket-event-params.ts +8 -5
- package/src/_models/index.ts +1 -0
- package/src/_modules/app-extended.index.ts +1 -0
- package/src/_modules/usage/usage.service.ts +8 -4
- package/src/_services/dynamo-nts-api.service.ts +7 -4
- package/src/_services/dynamo-nts-app-extended.ts +9 -9
- package/src/_services/dynamo-nts-app.ts +2 -2
- package/src/_services/dynamo-nts-auth.service.ts +6 -2
- package/src/_services/dynamo-nts-controller.service.ts +37 -0
- package/src/_services/dynamo-nts-data.service.ts +70 -31
- package/src/_services/dynamo-nts-db.service.ts +72 -48
- package/src/_services/dynamo-nts-email.service.ts +4 -4
- package/src/_services/dynamo-nts-global.service.ts +9 -2
- package/src/_services/dynamo-nts-routing-module.service.ts +3 -3
- package/src/_services/dynamo-nts-shared.service.ts +9 -0
- package/src/_services/dynamo-nts-socket-service-collection.service.ts +1 -1
- package/src/_services/dynamo-nts-socket.service.ts +27 -27
|
@@ -91,7 +91,7 @@ export class DynamoNTS_RoutingModule {
|
|
|
91
91
|
} catch (error) {
|
|
92
92
|
throw new DynamoNTS_Error({
|
|
93
93
|
message: `DYNAMOBEERROR: Failed to mount routes.`,
|
|
94
|
-
userMessage: `We encountered an uncought BackEnd Build Error, please contact the responsible development team.
|
|
94
|
+
userMessage: `We encountered an uncought BackEnd Build Error, please contact the responsible development team. \nerrorCode: 900-456-100`,
|
|
95
95
|
error
|
|
96
96
|
})
|
|
97
97
|
}
|
|
@@ -127,7 +127,7 @@ export class DynamoNTS_RoutingModule {
|
|
|
127
127
|
default:
|
|
128
128
|
throw new DynamoNTS_Error({
|
|
129
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.
|
|
130
|
+
userMessage: `We encountered an uncought BackEnd Build Error, please contact the responsible development team. \nerrorCode: 900-456-200`,
|
|
131
131
|
error: new Error()
|
|
132
132
|
})
|
|
133
133
|
}
|
|
@@ -162,7 +162,7 @@ export class DynamoNTS_RoutingModule {
|
|
|
162
162
|
default:
|
|
163
163
|
throw new DynamoNTS_Error({
|
|
164
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.
|
|
165
|
+
userMessage: `We encountered an uncought BackEnd Build Error, please contact the responsible development team. \nerrorCode: 900-456-300`,
|
|
166
166
|
error: new Error()
|
|
167
167
|
})
|
|
168
168
|
}
|
|
@@ -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
10
|
import { DynamoNTS_Error } from '@futdevpro/fsm-dynamo';
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
id?: string;
|
|
16
|
-
sockets: SocketIO.Socket[];
|
|
17
|
-
}
|
|
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
|
|
35
|
-
|
|
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.
|
|
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.
|
|
114
|
+
if (this.getDicFromSubscrioption) {
|
|
112
115
|
socket.on(DynamoNTS_SocketEvent.subscribe, async (content: any) => {
|
|
113
|
-
|
|
116
|
+
const dic: T = await this.getDicFromSubscrioption(content);
|
|
117
|
+
issuer = dic.issuerId;
|
|
114
118
|
|
|
115
|
-
this.socketSubscription(
|
|
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
|
-
|
|
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(
|
|
134
|
-
const activeSocket:
|
|
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(
|
|
140
|
+
activeSocket.sockets.push(dictionary.sockets[0]);
|
|
137
141
|
} else {
|
|
138
|
-
this.activeSockets.push(
|
|
142
|
+
this.activeSockets.push(dictionary);
|
|
139
143
|
}
|
|
140
144
|
}
|
|
141
145
|
|
|
@@ -155,15 +159,13 @@ 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.
|
|
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.
|
|
166
|
+
const dic: DynamoNTS_SocketDictionary = this.activeSockets.find((dic: DynamoNTS_SocketDictionary) => dic.issuerId === id);
|
|
163
167
|
if (dic) {
|
|
164
|
-
dic.
|
|
165
|
-
socket.emit(event, content);
|
|
166
|
-
});
|
|
168
|
+
dic.emitEvent(event, content);
|
|
167
169
|
} else {
|
|
168
170
|
if (error)
|
|
169
171
|
throw new DynamoNTS_Error({ status: 404, message: `No active socket whit this specific ID: ${id}` });
|
|
@@ -172,9 +174,7 @@ export abstract class DynamoNTS_SocketService extends DynamoNTS_SingletonService
|
|
|
172
174
|
|
|
173
175
|
broadcastEvent(event: string, content: any): void {
|
|
174
176
|
this.activeSockets.forEach((dic: DynamoNTS_SocketDictionary) => {
|
|
175
|
-
dic.
|
|
176
|
-
socket.emit(event, content);
|
|
177
|
-
})
|
|
177
|
+
dic.emitEvent(event, content);
|
|
178
178
|
})
|
|
179
179
|
}
|
|
180
180
|
|