@futdevpro/nts-dynamo 1.7.23 → 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/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/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
|
}
|