@futdevpro/nts-dynamo 1.7.22 → 1.7.24
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/.eslintrc.json +1 -1
- package/lib/_enums/http/socket-event-type.enum.d.ts +1 -0
- package/lib/_enums/http/socket-event-type.enum.d.ts.map +1 -1
- package/lib/_enums/http/socket-event-type.enum.js +1 -0
- package/lib/_enums/http/socket-event-type.enum.js.map +1 -1
- package/lib/_models/control-models/socket-event.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/socket-event.control-model.js +4 -2
- package/lib/_models/control-models/socket-event.control-model.js.map +1 -1
- package/lib/_services/core/api.service.d.ts +3 -2
- package/lib/_services/core/api.service.d.ts.map +1 -1
- package/lib/_services/core/api.service.js +3 -1
- package/lib/_services/core/api.service.js.map +1 -1
- package/lib/_services/socket/socket-server.service.d.ts +9 -0
- package/lib/_services/socket/socket-server.service.d.ts.map +1 -1
- package/lib/_services/socket/socket-server.service.js +76 -16
- package/lib/_services/socket/socket-server.service.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/_enums/http/socket-event-type.enum.ts +1 -0
- package/src/_models/control-models/socket-event.control-model.ts +22 -8
- package/src/_services/core/api.service.ts +4 -2
- package/src/_services/socket/socket-server.service.ts +292 -80
package/package.json
CHANGED
|
@@ -4,7 +4,8 @@ import { dynamoNTS_globalSettings } from '../../_constants/global-settings.const
|
|
|
4
4
|
import { DynamoNTS_SocketEventKey } from '../../_enums/http/socket-event-type.enum';
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
export type DynamoNTS_SocketEventPreprocessTask<T = any, R = any> =
|
|
7
|
+
export type DynamoNTS_SocketEventPreprocessTask<T = any, R = any> =
|
|
8
|
+
(content?: T, issuer?: string) => Promise<R>;
|
|
8
9
|
export type DynamoNTS_SocketEventTask<T> = (content?: T, issuer?: string) => Promise<void>;
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -77,14 +78,19 @@ export class DynamoNTS_SocketEvent<T>{
|
|
|
77
78
|
DynamoNTS_SocketEventKey.disconnect,
|
|
78
79
|
] as string[]).includes(this.eventKey)
|
|
79
80
|
) {
|
|
80
|
-
this.logEvent = dynamoNTS_globalSettings.logMainSocketEvents ||
|
|
81
|
+
this.logEvent = dynamoNTS_globalSettings.logMainSocketEvents ||
|
|
82
|
+
dynamoNTS_globalSettings.logAllSocketEvent;
|
|
81
83
|
} else {
|
|
82
84
|
this.logEvent = dynamoNTS_globalSettings.logAllSocketEvent;
|
|
83
85
|
}
|
|
84
|
-
this.logEventContent = set.logEventContent !== undefined ?
|
|
86
|
+
this.logEventContent = set.logEventContent !== undefined ?
|
|
87
|
+
set.logEventContent : dynamoNTS_globalSettings.logSocketEventContent;
|
|
85
88
|
} catch (error) {
|
|
86
89
|
Dynamo_Log.error(
|
|
87
|
-
`\nSocket Event params setup failed (${this.serviceName}): ${set.eventKey}`,
|
|
90
|
+
`\nSocket Event params setup failed (${this.serviceName}): ${set.eventKey}`,
|
|
91
|
+
error
|
|
92
|
+
);
|
|
93
|
+
|
|
88
94
|
throw error;
|
|
89
95
|
}
|
|
90
96
|
}
|
|
@@ -118,15 +124,23 @@ export class DynamoNTS_SocketEvent<T>{
|
|
|
118
124
|
await this.getPreLog(content, issuer);
|
|
119
125
|
}
|
|
120
126
|
|
|
121
|
-
await Dynamo_Array.asyncForEach(
|
|
122
|
-
|
|
123
|
-
|
|
127
|
+
await Dynamo_Array.asyncForEach(
|
|
128
|
+
this.preProcessess,
|
|
129
|
+
async (preProcess: DynamoNTS_SocketEventPreprocessTask<any, any>) => {
|
|
130
|
+
content = await preProcess(content);
|
|
131
|
+
}
|
|
132
|
+
);
|
|
124
133
|
|
|
125
134
|
await Dynamo_Array.asyncForEach(this.tasks, async (task: DynamoNTS_SocketEventTask<T>) => {
|
|
126
135
|
await task(content, issuer);
|
|
127
136
|
});
|
|
128
137
|
} catch (error) {
|
|
129
|
-
Dynamo_Log.error(
|
|
138
|
+
Dynamo_Log.error(
|
|
139
|
+
`Socket Event tasks failed to execute on ${this.serviceName}.... (${this.eventKey})`,
|
|
140
|
+
error,
|
|
141
|
+
'content:',
|
|
142
|
+
content
|
|
143
|
+
);
|
|
130
144
|
}
|
|
131
145
|
}
|
|
132
146
|
}
|
|
@@ -35,6 +35,8 @@ export class DynamoNTS_ApiService {
|
|
|
35
35
|
`\n(Internal BE to BE error)`;
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
+
* if the callParams.getFullResponse is set to true,
|
|
39
|
+
* use the Axios.AxiosResponse type as T_Response
|
|
38
40
|
*
|
|
39
41
|
* @param callParams
|
|
40
42
|
* @param inputParams
|
|
@@ -50,7 +52,7 @@ export class DynamoNTS_ApiService {
|
|
|
50
52
|
* you can pass data and other inputs in this section
|
|
51
53
|
*/
|
|
52
54
|
inputParams?: DynamoNTS_ApiCallInputParams<T_Body>
|
|
53
|
-
): Promise<T_Response | Axios.AxiosResponse
|
|
55
|
+
): Promise<T_Response /* | Axios.AxiosResponse */> {
|
|
54
56
|
try {
|
|
55
57
|
let a: T_Response;
|
|
56
58
|
let url: string = callParams.baseUrl + callParams.endPoint;
|
|
@@ -109,7 +111,7 @@ export class DynamoNTS_ApiService {
|
|
|
109
111
|
}
|
|
110
112
|
|
|
111
113
|
if (callParams.getFullResponse) {
|
|
112
|
-
return a as Axios.AxiosResponse
|
|
114
|
+
return a as T_Response /* Axios.AxiosResponse */;
|
|
113
115
|
|
|
114
116
|
} else {
|
|
115
117
|
return a as T_Response;
|