@futdevpro/nts-dynamo 1.10.14 → 1.10.16
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/build/_models/control-models/endpoint-params.control-model.js +1 -1
- package/build/_models/control-models/endpoint-params.control-model.js.map +1 -1
- package/build/_modules/server/errors/errors.control-service.d.ts +18 -0
- package/build/_modules/server/errors/errors.control-service.d.ts.map +1 -0
- package/build/_modules/server/errors/errors.control-service.js +11 -0
- package/build/_modules/server/errors/errors.control-service.js.map +1 -0
- package/build/_modules/server/{error/error.controller.d.ts → errors/errors.controller.d.ts} +5 -5
- package/build/_modules/server/errors/errors.controller.d.ts.map +1 -0
- package/build/_modules/server/{error/error.controller.js → errors/errors.controller.js} +35 -23
- package/build/_modules/server/errors/errors.controller.js.map +1 -0
- package/build/_modules/server/errors/errors.data-service.d.ts +20 -0
- package/build/_modules/server/errors/errors.data-service.d.ts.map +1 -0
- package/build/_modules/server/{error/error.data-service.js → errors/errors.data-service.js} +101 -18
- package/build/_modules/server/errors/errors.data-service.js.map +1 -0
- package/build/_modules/server/index.d.ts +2 -2
- package/build/_modules/server/index.d.ts.map +1 -1
- package/build/_modules/server/index.js +2 -2
- package/build/_modules/server/index.js.map +1 -1
- package/build/_modules/server/server-status/server-status-snapshot.data-service.d.ts +5 -0
- package/build/_modules/server/server-status/server-status-snapshot.data-service.d.ts.map +1 -0
- package/build/_modules/server/server-status/server-status-snapshot.data-service.js +9 -0
- package/build/_modules/server/server-status/server-status-snapshot.data-service.js.map +1 -0
- package/build/_modules/server/server-status/server-status.control-service.d.ts +4 -4
- package/build/_modules/server/server-status/server-status.control-service.d.ts.map +1 -1
- package/build/_modules/server/server-status/server-status.control-service.js +5 -8
- package/build/_modules/server/server-status/server-status.control-service.js.map +1 -1
- package/build/_modules/server/server-status/server-status.controller.d.ts +3 -3
- package/build/_modules/server/server-status/server-status.controller.d.ts.map +1 -1
- package/build/_modules/server/server-status/server-status.controller.js +1 -1
- package/build/_modules/socket/_models/socket-presence.control-model.d.ts.map +1 -1
- package/build/_modules/socket/_models/socket-presence.control-model.js +7 -6
- package/build/_modules/socket/_models/socket-presence.control-model.js.map +1 -1
- package/build/_modules/socket/_services/socket-client.service.js +1 -1
- package/build/_modules/socket/_services/socket-client.service.js.map +1 -1
- package/build/_modules/socket/_services/socket-server.service.js +20 -20
- package/build/_modules/socket/_services/socket-server.service.js.map +1 -1
- package/build/_modules/socket/app-extended.server.js +5 -5
- package/build/_modules/socket/app-extended.server.js.map +1 -1
- package/build/_modules/usage/usage.data-service.d.ts.map +1 -1
- package/build/_modules/usage/usage.data-service.js +5 -4
- package/build/_modules/usage/usage.data-service.js.map +1 -1
- package/build/_services/base/archive-data.service.d.ts.map +1 -1
- package/build/_services/base/archive-data.service.js +12 -11
- package/build/_services/base/archive-data.service.js.map +1 -1
- package/build/_services/base/data.service.d.ts.map +1 -1
- package/build/_services/base/data.service.js +83 -74
- package/build/_services/base/data.service.js.map +1 -1
- package/build/_services/base/db.service.d.ts.map +1 -1
- package/build/_services/base/db.service.js +34 -33
- package/build/_services/base/db.service.js.map +1 -1
- package/build/_services/core/api.service.js +9 -9
- package/build/_services/core/api.service.js.map +1 -1
- package/build/_services/core/auth.service.d.ts.map +1 -1
- package/build/_services/core/auth.service.js +3 -2
- package/build/_services/core/auth.service.js.map +1 -1
- package/build/_services/core/email.service.js +19 -19
- package/build/_services/core/email.service.js.map +1 -1
- package/build/_services/core/global.service.js +7 -7
- package/build/_services/core/global.service.js.map +1 -1
- package/build/_services/route/routing-module.service.js +5 -5
- package/build/_services/route/routing-module.service.js.map +1 -1
- package/build/_services/server/app.server.js +25 -25
- package/build/_services/server/app.server.js.map +1 -1
- package/package.json +1 -1
- package/src/_models/control-models/endpoint-params.control-model.ts +1 -1
- package/src/_modules/server/errors/errors.control-service.ts +66 -0
- package/src/_modules/server/{error/error.controller.ts → errors/errors.controller.ts} +51 -35
- package/src/_modules/server/{error/error.data-service.ts → errors/errors.data-service.ts} +138 -34
- package/src/_modules/server/index.ts +2 -2
- package/src/_modules/server/server-status/server-status-snapshot.data-service.ts +45 -0
- package/src/_modules/server/server-status/server-status.control-service.ts +14 -33
- package/src/_modules/server/server-status/server-status.controller.ts +6 -6
- package/src/_modules/socket/_models/socket-presence.control-model.ts +7 -6
- package/src/_modules/socket/_services/socket-client.service.ts +1 -1
- package/src/_modules/socket/_services/socket-server.service.ts +20 -20
- package/src/_modules/socket/app-extended.server.ts +5 -5
- package/src/_modules/usage/usage.data-service.ts +5 -4
- package/src/_services/base/archive-data.service.ts +12 -11
- package/src/_services/base/data.service.ts +83 -74
- package/src/_services/base/db.service.ts +34 -33
- package/src/_services/core/api.service.ts +9 -9
- package/src/_services/core/auth.service.ts +3 -2
- package/src/_services/core/email.service.ts +19 -19
- package/src/_services/core/global.service.ts +7 -7
- package/src/_services/route/controller.service.ts +1 -1
- package/src/_services/route/routing-module.service.ts +5 -5
- package/src/_services/server/app.server.ts +25 -25
- package/build/_modules/server/error/error.controller.d.ts.map +0 -1
- package/build/_modules/server/error/error.controller.js.map +0 -1
- package/build/_modules/server/error/error.data-service.d.ts +0 -21
- package/build/_modules/server/error/error.data-service.d.ts.map +0 -1
- package/build/_modules/server/error/error.data-service.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
3
|
|
|
4
|
-
import { DyFM_Array, DyFM_Error, DyFM_HttpCallType, DyFM_Errors } from '@futdevpro/fsm-dynamo';
|
|
4
|
+
import { DyFM_Array, DyFM_Error, DyFM_HttpCallType, DyFM_Errors, DyFM_RelativeDate } from '@futdevpro/fsm-dynamo';
|
|
5
5
|
import { DyNTS_Controller } from '../../../_services/route/controller.service';
|
|
6
6
|
import { DyNTS_Endpoint_Params } from '../../../_models/control-models/endpoint-params.control-model';
|
|
7
|
-
import {
|
|
7
|
+
import { DyNTS_Errors_ControlService } from './errors.control-service';
|
|
8
8
|
import { DyNTS_global_settings } from '../../../_collections/global-settings.const';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -30,34 +30,37 @@ import { DyNTS_global_settings } from '../../../_collections/global-settings.con
|
|
|
30
30
|
*
|
|
31
31
|
*
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
// Documentation:
|
|
34
|
+
// Local: [MD](./errors.md)
|
|
35
|
+
//
|
|
36
|
+
export abstract class DyNTS_Errors_Controller<
|
|
34
37
|
T_Error extends DyFM_Error,
|
|
35
38
|
T_Errors extends DyFM_Errors<T_Error>,
|
|
36
|
-
|
|
39
|
+
T_Error_ControlService extends DyNTS_Errors_ControlService<T_Error, T_Errors>
|
|
37
40
|
> extends DyNTS_Controller {
|
|
38
41
|
|
|
39
|
-
/* static getInstance():
|
|
40
|
-
return
|
|
42
|
+
/* static getInstance(): DyNTS_Error_Controller {
|
|
43
|
+
return DyNTS_Error_Controller.getSingletonInstance();
|
|
41
44
|
} */
|
|
42
45
|
|
|
43
|
-
/* protected abstract errorDataService:
|
|
44
|
-
protected abstract
|
|
46
|
+
/* protected abstract errorDataService: DyNTS_Error_DataService<T_Error>; */
|
|
47
|
+
protected abstract getError_ControlService?(
|
|
45
48
|
set?: { data?: T_Error, issuer?: string }
|
|
46
|
-
):
|
|
49
|
+
): T_Error_ControlService;
|
|
47
50
|
protected readonly additionalEndpoints: DyNTS_Endpoint_Params[] = [];
|
|
48
51
|
|
|
49
52
|
setupEndpoints(): void {
|
|
50
53
|
/* if (!this.getErrorDataService) {
|
|
51
54
|
throw new DyFM_Error({
|
|
52
55
|
message: 'getUserDataService() method not implemented in Error_Controller.',
|
|
53
|
-
errorCode: `${DyNTS_global_settings.systemShortCodeName}|
|
|
56
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-ERC-001`,
|
|
54
57
|
});
|
|
55
58
|
} */
|
|
56
59
|
|
|
57
60
|
if (!this.additionalEndpoints) {
|
|
58
61
|
throw new DyFM_Error({
|
|
59
62
|
message: 'additionalEndpoints must be defined in Error_Controller.',
|
|
60
|
-
errorCode: `${DyNTS_global_settings.systemShortCodeName}|
|
|
63
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-ERC-002`,
|
|
61
64
|
});
|
|
62
65
|
}
|
|
63
66
|
|
|
@@ -68,12 +71,12 @@ export abstract class DyNTS_Error_Controller<
|
|
|
68
71
|
endpoint: '/error/log',
|
|
69
72
|
tasks: [
|
|
70
73
|
async (req: Request, res: Response, issuer?: string): Promise<void> => {
|
|
71
|
-
const
|
|
74
|
+
const error_CS: T_Error_ControlService = this.getError_ControlService({
|
|
72
75
|
data: req.body,
|
|
73
76
|
issuer: issuer ?? req.body?.issuer ?? 'unknown-client',
|
|
74
77
|
});
|
|
75
78
|
|
|
76
|
-
await
|
|
79
|
+
await error_CS.recordError();
|
|
77
80
|
|
|
78
81
|
res.send({
|
|
79
82
|
result: 'error logged',
|
|
@@ -88,11 +91,11 @@ export abstract class DyNTS_Error_Controller<
|
|
|
88
91
|
endpoint: '/error/mark-done/:errorId',
|
|
89
92
|
tasks: [
|
|
90
93
|
async (req: Request, res: Response, issuer?: string): Promise<void> => {
|
|
91
|
-
const
|
|
94
|
+
const error_CS: T_Error_ControlService = this.getError_ControlService({
|
|
92
95
|
issuer: issuer,
|
|
93
96
|
});
|
|
94
97
|
|
|
95
|
-
await
|
|
98
|
+
await error_CS.deleteError(req.params.errorId, true);
|
|
96
99
|
|
|
97
100
|
res.send({
|
|
98
101
|
result: 'error deleted',
|
|
@@ -107,11 +110,11 @@ export abstract class DyNTS_Error_Controller<
|
|
|
107
110
|
endpoint: '/error/mark-all-done',
|
|
108
111
|
tasks: [
|
|
109
112
|
async (req: Request, res: Response, issuer?: string): Promise<void> => {
|
|
110
|
-
const
|
|
113
|
+
const error_CS: T_Error_ControlService = this.getError_ControlService({
|
|
111
114
|
issuer: issuer,
|
|
112
115
|
});
|
|
113
116
|
|
|
114
|
-
await
|
|
117
|
+
await error_CS.deleteAllErrors(true);
|
|
115
118
|
|
|
116
119
|
res.send({
|
|
117
120
|
result: 'all error deleted',
|
|
@@ -126,7 +129,7 @@ export abstract class DyNTS_Error_Controller<
|
|
|
126
129
|
endpoint: '/mark-error-done/:errorId',
|
|
127
130
|
tasks: [
|
|
128
131
|
async (req: Request, res: Response, issuer?: string): Promise<void> => {
|
|
129
|
-
const errorDataService:
|
|
132
|
+
const errorDataService: DyNTS_Error_DataService<Error_T> = this.getErrorDataService({
|
|
130
133
|
data: { _id: req.params.errorId },
|
|
131
134
|
issuer: issuer,
|
|
132
135
|
});
|
|
@@ -146,14 +149,12 @@ export abstract class DyNTS_Error_Controller<
|
|
|
146
149
|
endpoint: '/error/get-range/:range',
|
|
147
150
|
tasks: [
|
|
148
151
|
async (req: Request, res: Response, issuer: string) : Promise<void> => {
|
|
149
|
-
const
|
|
152
|
+
const error_CS: T_Error_ControlService = this.getError_ControlService({
|
|
150
153
|
issuer: issuer,
|
|
151
154
|
});
|
|
152
155
|
|
|
153
156
|
res.send(
|
|
154
|
-
|
|
155
|
-
(a, b): number => b.priority - a.priority
|
|
156
|
-
).slice(0, 10)
|
|
157
|
+
await error_CS.getErrorsInRange(req.params.range as DyFM_RelativeDate)
|
|
157
158
|
);
|
|
158
159
|
},
|
|
159
160
|
],
|
|
@@ -165,7 +166,7 @@ export abstract class DyNTS_Error_Controller<
|
|
|
165
166
|
endpoint: '/error/get-paged/:range/:pageSize/:pageIndex',
|
|
166
167
|
tasks: [
|
|
167
168
|
async (req: Request, res: Response, issuer: string) : Promise<void> => {
|
|
168
|
-
const
|
|
169
|
+
const error_CS: T_Error_ControlService = this.getError_ControlService({
|
|
169
170
|
issuer: issuer,
|
|
170
171
|
});
|
|
171
172
|
|
|
@@ -179,9 +180,11 @@ export abstract class DyNTS_Error_Controller<
|
|
|
179
180
|
}
|
|
180
181
|
|
|
181
182
|
res.send(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
await error_CS.getErrorsPaged(
|
|
184
|
+
req.params.range as DyFM_RelativeDate,
|
|
185
|
+
pageSize,
|
|
186
|
+
pageIndex
|
|
187
|
+
)
|
|
185
188
|
);
|
|
186
189
|
},
|
|
187
190
|
],
|
|
@@ -193,7 +196,7 @@ export abstract class DyNTS_Error_Controller<
|
|
|
193
196
|
endpoint: '/error/get-last-paged/:range/:pageSize/:pageIndex',
|
|
194
197
|
tasks: [
|
|
195
198
|
async (req: Request, res: Response, issuer: string) : Promise<void> => {
|
|
196
|
-
const
|
|
199
|
+
const error_CS: T_Error_ControlService = this.getError_ControlService({
|
|
197
200
|
issuer: issuer,
|
|
198
201
|
});
|
|
199
202
|
|
|
@@ -207,15 +210,28 @@ export abstract class DyNTS_Error_Controller<
|
|
|
207
210
|
}
|
|
208
211
|
|
|
209
212
|
res.send(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
pageIndex, pageSize
|
|
213
|
+
await error_CS.getLastErrors(
|
|
214
|
+
req.params.range as DyFM_RelativeDate,
|
|
215
|
+
pageSize,
|
|
216
|
+
pageIndex
|
|
215
217
|
)
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
218
|
+
);
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
}),
|
|
222
|
+
|
|
223
|
+
new DyNTS_Endpoint_Params({
|
|
224
|
+
name: 'searchErrors',
|
|
225
|
+
type: DyFM_HttpCallType.get,
|
|
226
|
+
endpoint: '/error/search',
|
|
227
|
+
tasks: [
|
|
228
|
+
async (req: Request, res: Response, issuer: string) : Promise<void> => {
|
|
229
|
+
const error_CS: T_Error_ControlService = this.getError_ControlService({
|
|
230
|
+
issuer: issuer,
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
res.send(
|
|
234
|
+
await error_CS.searchErrors(req.body)
|
|
219
235
|
);
|
|
220
236
|
},
|
|
221
237
|
],
|
|
@@ -2,42 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
import { DyNTS_global_settings } from '../../../_collections/global-settings.const';
|
|
6
|
-
import { DyNTS_DBUpdate } from '../../../_models/types/db-update.type';
|
|
7
|
-
import { DyNTS_DataService } from '../../../_services/base/data.service';
|
|
8
|
-
|
|
9
5
|
import {
|
|
10
6
|
DyFM_AnyError,
|
|
11
7
|
DyFM_DBFilter,
|
|
12
8
|
DyFM_DataModel_Params, DyFM_Error, DyFM_ErrorLevel, DyFM_Error_Settings,
|
|
13
|
-
DyFM_Log, DyFM_Shared, DyFM_clone, DyFM_errorFlag, DyFM_Errors
|
|
9
|
+
DyFM_Log, DyFM_Shared, DyFM_clone, DyFM_errorFlag, DyFM_Errors,
|
|
10
|
+
DyFM_RelativeDate,
|
|
11
|
+
DyFM_Array,
|
|
12
|
+
DyFM_Paged,
|
|
13
|
+
DyFM_Time,
|
|
14
|
+
DyFM_SearchQuery,
|
|
15
|
+
DyFM_SearchResult
|
|
14
16
|
} from '@futdevpro/fsm-dynamo';
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
debugLog: boolean = false;
|
|
21
|
-
readonly version: string = DyNTS_global_settings.systemVersion;
|
|
22
|
-
duplicationCounter: number;
|
|
23
|
-
|
|
24
|
-
abstract recordError(data?: T_Errors, alwaysRecord?: boolean): Promise<void>;
|
|
25
|
-
|
|
26
|
-
abstract handleInternalError(
|
|
27
|
-
error: DyFM_AnyError | any,
|
|
28
|
-
issuer: string,
|
|
29
|
-
alwaysRecord?: boolean,
|
|
30
|
-
): Promise<void>;
|
|
31
|
-
|
|
32
|
-
abstract checkErrorIsStringifyableOrResolvable(error: T_Error): T_Error | 'UNRESOLVABLE';
|
|
33
|
-
|
|
34
|
-
abstract getPriorityMultiplierByLevel(level: DyFM_ErrorLevel): number;
|
|
35
|
-
}
|
|
18
|
+
import { DyNTS_Errors_ControlService } from './errors.control-service';
|
|
19
|
+
import { DyNTS_global_settings } from '../../../_collections/global-settings.const';
|
|
20
|
+
import { DyNTS_DBUpdate } from '../../../_models/types/db-update.type';
|
|
21
|
+
import { DyNTS_DataService } from '../../../_services/base/data.service';
|
|
36
22
|
|
|
37
|
-
export class
|
|
23
|
+
export class DyNTS_Errors_DataService<
|
|
38
24
|
T_Error extends DyFM_Error,
|
|
39
25
|
T_Errors extends DyFM_Errors<T_Error>
|
|
40
|
-
> extends DyNTS_DataService<T_Errors> implements
|
|
26
|
+
> extends DyNTS_DataService<T_Errors> implements DyNTS_Errors_ControlService<T_Error, T_Errors> {
|
|
41
27
|
|
|
42
28
|
debugLog: boolean = false;
|
|
43
29
|
readonly version: string = DyNTS_global_settings.systemVersion;
|
|
@@ -51,7 +37,7 @@ export class DyNTS_Error_DataService<
|
|
|
51
37
|
dataParams: DyFM_DataModel_Params<T_Error>
|
|
52
38
|
) {
|
|
53
39
|
super(
|
|
54
|
-
new
|
|
40
|
+
new FDP_Errors(set?.data) as T_Error,
|
|
55
41
|
dataParams,
|
|
56
42
|
set.issuer
|
|
57
43
|
);
|
|
@@ -81,7 +67,7 @@ export class DyNTS_Error_DataService<
|
|
|
81
67
|
new Error('error data is not defined')
|
|
82
68
|
),
|
|
83
69
|
|
|
84
|
-
errorCode: `${DyNTS_global_settings.systemShortCodeName}|
|
|
70
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-EDS-RE1`,
|
|
85
71
|
});
|
|
86
72
|
}
|
|
87
73
|
|
|
@@ -186,7 +172,7 @@ export class DyNTS_Error_DataService<
|
|
|
186
172
|
error
|
|
187
173
|
),
|
|
188
174
|
|
|
189
|
-
errorCode: `${DyNTS_global_settings.systemShortCodeName}|
|
|
175
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-EDS-RE0`,
|
|
190
176
|
}); */
|
|
191
177
|
}
|
|
192
178
|
}
|
|
@@ -234,7 +220,7 @@ export class DyNTS_Error_DataService<
|
|
|
234
220
|
}) as T_Errors;
|
|
235
221
|
}
|
|
236
222
|
|
|
237
|
-
/* if (!(error as
|
|
223
|
+
/* if (!(error as FDP_Errors)?.flag?.includes('WB-ERROR-OBJECT')) {
|
|
238
224
|
DyFM_Log.H_error('__ERROR__:', error);
|
|
239
225
|
} */
|
|
240
226
|
|
|
@@ -245,12 +231,12 @@ export class DyNTS_Error_DataService<
|
|
|
245
231
|
!(error instanceof DyFM_Error)
|
|
246
232
|
) {
|
|
247
233
|
DyFM_Log.H_error(
|
|
248
|
-
`
|
|
234
|
+
`DyNTS_Error_DataService handling InternalError...`,
|
|
249
235
|
`\n ERROR:`, error
|
|
250
236
|
);
|
|
251
237
|
} else {
|
|
252
238
|
error.logSimple(
|
|
253
|
-
`
|
|
239
|
+
`DyNTS_Error_DataService handling InternalError...`
|
|
254
240
|
);
|
|
255
241
|
}
|
|
256
242
|
} catch (error) {
|
|
@@ -261,7 +247,7 @@ export class DyNTS_Error_DataService<
|
|
|
261
247
|
error
|
|
262
248
|
),
|
|
263
249
|
|
|
264
|
-
errorCode: `${DyNTS_global_settings.systemShortCodeName}|
|
|
250
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-EDS-HIE0`,
|
|
265
251
|
}); */
|
|
266
252
|
}
|
|
267
253
|
}
|
|
@@ -318,4 +304,122 @@ export class DyNTS_Error_DataService<
|
|
|
318
304
|
}
|
|
319
305
|
}
|
|
320
306
|
|
|
307
|
+
async getErrorsFromDate(
|
|
308
|
+
date: Date,
|
|
309
|
+
issuer: string,
|
|
310
|
+
): Promise<DyFM_Paged<T_Errors>> {
|
|
311
|
+
try {
|
|
312
|
+
const errors: T_Errors[] = await this.findDataList({ __created: { $gte: date } });
|
|
313
|
+
|
|
314
|
+
return DyFM_Array.paged(errors, 0, 100);
|
|
315
|
+
} catch (error) {
|
|
316
|
+
throw new DyFM_Error({
|
|
317
|
+
...this.getDefaultErrorSettings(
|
|
318
|
+
'getErrorsFromDate',
|
|
319
|
+
error
|
|
320
|
+
),
|
|
321
|
+
|
|
322
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-EDS-GED0`,
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
async deleteError(errorId: string, alwaysDelete?: boolean): Promise<void> {
|
|
328
|
+
try {
|
|
329
|
+
await this.deleteData(errorId, alwaysDelete);
|
|
330
|
+
} catch (error) {
|
|
331
|
+
throw new DyFM_Error({
|
|
332
|
+
...this.getDefaultErrorSettings('deleteError', error),
|
|
333
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-EDS-DE0`,
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
async deleteAllErrors(alwaysDelete?: boolean): Promise<void> {
|
|
339
|
+
try {
|
|
340
|
+
await this.deleteAllData(alwaysDelete);
|
|
341
|
+
} catch (error) {
|
|
342
|
+
throw new DyFM_Error({
|
|
343
|
+
...this.getDefaultErrorSettings('deleteAllErrors', error),
|
|
344
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-EDS-DAE0`,
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
async getErrorsInRange(range: DyFM_RelativeDate): Promise<DyFM_Paged<T_Errors>> {
|
|
350
|
+
try {
|
|
351
|
+
const fromDate: Date = DyFM_Time.getDateByRelativeDate(range);
|
|
352
|
+
|
|
353
|
+
let errors: T_Errors[] = await this.findDataList({ __lastModified: { $gte: fromDate } });
|
|
354
|
+
errors = errors.sort(
|
|
355
|
+
(a, b): number => b.priority - a.priority
|
|
356
|
+
);
|
|
357
|
+
|
|
358
|
+
return DyFM_Array.paged(errors, 0, 10);
|
|
359
|
+
} catch (error) {
|
|
360
|
+
throw new DyFM_Error({
|
|
361
|
+
...this.getDefaultErrorSettings('getErrorsInRange', error),
|
|
362
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-EDS-GIR0`,
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
async getErrorsPaged(
|
|
368
|
+
range: DyFM_RelativeDate,
|
|
369
|
+
pageSize: number,
|
|
370
|
+
pageIndex: number,
|
|
371
|
+
): Promise<DyFM_Paged<T_Errors>> {
|
|
372
|
+
try {
|
|
373
|
+
const fromDate: Date = DyFM_Time.getDateByRelativeDate(range);
|
|
374
|
+
|
|
375
|
+
let errors: T_Errors[] = await this.findDataList({ __lastModified: { $gte: fromDate } });
|
|
376
|
+
errors = errors.sort(
|
|
377
|
+
(a, b): number => b.priority - a.priority
|
|
378
|
+
);
|
|
379
|
+
|
|
380
|
+
return DyFM_Array.paged(errors, pageIndex, pageSize);
|
|
381
|
+
} catch (error) {
|
|
382
|
+
throw new DyFM_Error({
|
|
383
|
+
...this.getDefaultErrorSettings('getErrorsPaged', error),
|
|
384
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-EDS-GIP0`,
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
async getLastErrors(
|
|
390
|
+
range: DyFM_RelativeDate,
|
|
391
|
+
pageSize: number,
|
|
392
|
+
pageIndex: number,
|
|
393
|
+
): Promise<DyFM_Paged<T_Errors>> {
|
|
394
|
+
try {
|
|
395
|
+
const fromDate: Date = DyFM_Time.getDateByRelativeDate(range);
|
|
396
|
+
|
|
397
|
+
let errors: T_Errors[] = await this.findDataList({
|
|
398
|
+
__lastModified: { $gte: fromDate }
|
|
399
|
+
});
|
|
400
|
+
errors = errors.sort(
|
|
401
|
+
(a, b): number => +b.__lastModified - +a.__lastModified
|
|
402
|
+
);
|
|
403
|
+
|
|
404
|
+
return DyFM_Array.paged(errors, pageIndex, pageSize);
|
|
405
|
+
} catch (error) {
|
|
406
|
+
throw new DyFM_Error({
|
|
407
|
+
...this.getDefaultErrorSettings('getLastErrors', error),
|
|
408
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-EDS-GLE0`,
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
async searchErrors(
|
|
414
|
+
searchQuery: DyFM_SearchQuery<T_Errors>,
|
|
415
|
+
): Promise<DyFM_SearchResult<T_Errors>> {
|
|
416
|
+
try {
|
|
417
|
+
return await this.searchData(searchQuery);
|
|
418
|
+
} catch (error) {
|
|
419
|
+
throw new DyFM_Error({
|
|
420
|
+
...this.getDefaultErrorSettings('searchErrors', error),
|
|
421
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-EDS-SE0`,
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
}
|
|
321
425
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
// ERROR
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
3
|
+
export * from './errors/errors.controller';
|
|
4
|
+
export * from './errors/errors.control-service';
|
|
5
5
|
|
|
6
6
|
// SERVER-STATUS
|
|
7
7
|
export * from './server-status/server-status.control-service';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/* import { ServerStatus_ControlService } from './server-status.control-service'; */
|
|
6
|
+
|
|
7
|
+
import { DyFM_Error, DyFM_ServerStatus } from '@futdevpro/fsm-dynamo';
|
|
8
|
+
import { DyNTS_DataService } from '../../../_services/base/data.service';
|
|
9
|
+
|
|
10
|
+
export class DyNTS_ServerStatusSnapshot_DataService<
|
|
11
|
+
T_ServerStatus extends DyFM_ServerStatus
|
|
12
|
+
> extends DyNTS_DataService<T_ServerStatus> {
|
|
13
|
+
|
|
14
|
+
/* constructor(
|
|
15
|
+
set: {
|
|
16
|
+
data?: T_ServerStatus,
|
|
17
|
+
issuer: string,
|
|
18
|
+
}
|
|
19
|
+
) {
|
|
20
|
+
super(
|
|
21
|
+
new T_ServerStatus(set?.data),
|
|
22
|
+
set?.issuer,
|
|
23
|
+
);
|
|
24
|
+
} */
|
|
25
|
+
|
|
26
|
+
/* async getServerSnapshot(): Promise<CCAP_ServerStatusSnapshot> {
|
|
27
|
+
try {
|
|
28
|
+
const serverStatus_CS: ServerStatus_ControlService =
|
|
29
|
+
ServerStatus_ControlService.getInstance();
|
|
30
|
+
|
|
31
|
+
return new CCAP_ServerStatusSnapshot({
|
|
32
|
+
...serverStatus_CS.getServerStatus(),
|
|
33
|
+
});
|
|
34
|
+
} catch (error) {
|
|
35
|
+
throw new DyFM_Error({
|
|
36
|
+
...this.getDefaultErrorSettings(
|
|
37
|
+
'getMatchStatistics',
|
|
38
|
+
error?.response?.data ?? error
|
|
39
|
+
),
|
|
40
|
+
|
|
41
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|FDPNTS-SSS-GES0',
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
} */
|
|
45
|
+
}
|
|
@@ -2,43 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
DyFM_Metadata, DyFM_RelativeDate, DyFM_Time, DyFM_ServerStatus, DyFM_ErrorLevel, DyFM_Log,
|
|
5
|
-
DyFM_Error, DyFM_Error_Statistics, DyFM_Errors
|
|
5
|
+
DyFM_Error, DyFM_Error_Statistics, DyFM_Errors,
|
|
6
|
+
DyFM_Paged
|
|
6
7
|
} from '@futdevpro/fsm-dynamo';
|
|
7
8
|
|
|
8
9
|
import { version as _serverVersion } from '../../../../package.json';
|
|
9
10
|
import { DyNTS_SingletonService } from '../../../_services/base/singleton.service';
|
|
10
|
-
import { DyNTS_DataService } from '../../../_services/base/data.service';
|
|
11
11
|
import { DyNTS_global_settings } from '../../../_collections/global-settings.const';
|
|
12
|
-
import {
|
|
12
|
+
import { DyNTS_Errors_ControlService } from '../errors/errors.control-service';
|
|
13
|
+
|
|
14
|
+
|
|
13
15
|
|
|
14
16
|
export abstract class DyNTS_ServerStatus_ControlService<
|
|
15
17
|
T_Error extends DyFM_Error,
|
|
16
18
|
T_Errors extends DyFM_Errors<T_Error>,
|
|
17
19
|
T_ServerStatus extends DyFM_ServerStatus,
|
|
18
|
-
|
|
20
|
+
T_Error_ControlService extends DyNTS_Errors_ControlService<T_Error, T_Errors>
|
|
19
21
|
> extends DyNTS_SingletonService {
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
return FDPNTS_ServerStatus_ControlService.getSingletonInstance();
|
|
23
|
-
} */
|
|
24
|
-
|
|
25
|
-
/* protected constructor() {
|
|
26
|
-
super();
|
|
27
|
-
|
|
28
|
-
if (!this.getErrorDataService) {
|
|
29
|
-
throw new DyFM_Error({
|
|
30
|
-
message: 'getErrorDataService() method not implemented in ServerStatus_ControlService.',
|
|
31
|
-
status: 500,
|
|
32
|
-
errorCode: `${DyNTS_global_settings.systemShortCodeName}|FDPNTS-SSS-GED0',
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
} */
|
|
36
|
-
|
|
37
|
-
protected abstract getErrorDataService?(
|
|
23
|
+
protected abstract getErrorControlService?(
|
|
38
24
|
set?: { data?: T_Errors, issuer?: string }
|
|
39
|
-
):
|
|
40
|
-
|
|
41
|
-
/* protected abstract error_DS: FDPNTS_Error_DataService<T_Error>; */
|
|
25
|
+
): T_Error_ControlService;
|
|
42
26
|
|
|
43
27
|
protected readonly up: Date = new Date();
|
|
44
28
|
|
|
@@ -53,8 +37,6 @@ export abstract class DyNTS_ServerStatus_ControlService<
|
|
|
53
37
|
|
|
54
38
|
override readonly defaultErrorUserMsg = 'Something went wrong';
|
|
55
39
|
|
|
56
|
-
/* private readonly serverSnapshotOverseer */
|
|
57
|
-
|
|
58
40
|
getServerStatus(clientVersion?: string): DyFM_ServerStatus {
|
|
59
41
|
return {
|
|
60
42
|
status: 'ready',
|
|
@@ -78,14 +60,13 @@ export abstract class DyNTS_ServerStatus_ControlService<
|
|
|
78
60
|
issuer: string
|
|
79
61
|
): Promise<DyFM_Error_Statistics> {
|
|
80
62
|
try {
|
|
81
|
-
const error_DS:
|
|
82
|
-
this.
|
|
83
|
-
/* new
|
|
63
|
+
const error_DS: T_Error_ControlService =
|
|
64
|
+
this.getErrorControlService({ issuer: issuer });
|
|
65
|
+
/* new DyNTS_Error_DataService({ issuer: issuer }); */
|
|
84
66
|
|
|
85
67
|
const from: Date = DyFM_Time.getDateByRelativeDate(range);
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
});
|
|
68
|
+
const errorsPaged: DyFM_Paged<T_Errors> = await error_DS.getErrorsFromDate(from, issuer);
|
|
69
|
+
const errors: T_Errors[] = errorsPaged.items;
|
|
89
70
|
|
|
90
71
|
return {
|
|
91
72
|
range: range,
|
|
@@ -167,7 +148,7 @@ export abstract class DyNTS_ServerStatus_ControlService<
|
|
|
167
148
|
issuer
|
|
168
149
|
),
|
|
169
150
|
|
|
170
|
-
errorCode: `${DyNTS_global_settings.systemShortCodeName}|
|
|
151
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-GES0`,
|
|
171
152
|
});
|
|
172
153
|
}
|
|
173
154
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
3
|
|
|
4
4
|
import { DyFM_Error, DyFM_Errors, DyFM_HttpCallType, DyFM_RelativeDate, DyFM_ServerStatus } from '@futdevpro/fsm-dynamo';
|
|
5
|
-
import {
|
|
5
|
+
import { DyNTS_Errors_ControlService } from '../errors/errors.control-service';
|
|
6
6
|
import { DyNTS_Controller } from '../../../_services/route/controller.service';
|
|
7
7
|
import { DyNTS_Endpoint_Params } from '../../../_models/control-models/endpoint-params.control-model';
|
|
8
8
|
import { DyNTS_global_settings } from '../../../_collections/global-settings.const';
|
|
9
|
-
import {
|
|
9
|
+
import { DyNTS_ServerStatus_ControlService } from './server-status.control-service';
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -30,12 +30,12 @@ export abstract class DyNTS_ServerStatus_Controller<
|
|
|
30
30
|
T_Error,
|
|
31
31
|
T_Errors,
|
|
32
32
|
T_ServerStatus,
|
|
33
|
-
|
|
33
|
+
DyNTS_Errors_ControlService<T_Error, T_Errors>
|
|
34
34
|
>
|
|
35
35
|
> extends DyNTS_Controller {
|
|
36
36
|
|
|
37
|
-
/* static getInstance():
|
|
38
|
-
return
|
|
37
|
+
/* static getInstance(): DyNTS_ServerStatus_Controller {
|
|
38
|
+
return DyNTS_ServerStatus_Controller.getSingletonInstance();
|
|
39
39
|
} */
|
|
40
40
|
|
|
41
41
|
protected abstract readonly server_CS: T_ServerStatusService;
|
|
@@ -47,7 +47,7 @@ export abstract class DyNTS_ServerStatus_Controller<
|
|
|
47
47
|
/* if (!this.getServerService) {
|
|
48
48
|
throw new DyFM_Error({
|
|
49
49
|
message: 'getServerService() method not implemented in ServerStatus_Controller.',
|
|
50
|
-
errorCode: `${DyNTS_global_settings.systemShortCodeName}|
|
|
50
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-SSC-001`,
|
|
51
51
|
});
|
|
52
52
|
} */
|
|
53
53
|
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
DyFM_AnyError, DyFM_Error, DyFM_Error_Settings, DyFM_Log
|
|
4
4
|
} from '@futdevpro/fsm-dynamo';
|
|
5
5
|
import * as SocketIO from 'socket.io';
|
|
6
|
+
import { DyNTS_global_settings } from '../../..';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* socket handling and clarification is under development
|
|
@@ -53,7 +54,7 @@ export class DyNTS_SocketPresence {
|
|
|
53
54
|
),
|
|
54
55
|
set?.issuer
|
|
55
56
|
),
|
|
56
|
-
errorCode:
|
|
57
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-SD0-C00`,
|
|
57
58
|
additionalContent: { set: set },
|
|
58
59
|
});
|
|
59
60
|
}
|
|
@@ -83,7 +84,7 @@ export class DyNTS_SocketPresence {
|
|
|
83
84
|
set?.issuer
|
|
84
85
|
),
|
|
85
86
|
|
|
86
|
-
errorCode:
|
|
87
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-SD0-C01`,
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
90
|
|
|
@@ -112,7 +113,7 @@ export class DyNTS_SocketPresence {
|
|
|
112
113
|
),
|
|
113
114
|
issuer
|
|
114
115
|
),
|
|
115
|
-
errorCode:
|
|
116
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-SPC-EE1`,
|
|
116
117
|
});
|
|
117
118
|
}
|
|
118
119
|
|
|
@@ -126,7 +127,7 @@ export class DyNTS_SocketPresence {
|
|
|
126
127
|
/* errors.push(
|
|
127
128
|
new DyFM_Error({
|
|
128
129
|
status: 500,
|
|
129
|
-
errorCode:
|
|
130
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-SPC-EE2',
|
|
130
131
|
addECToUserMsg: true,
|
|
131
132
|
message:
|
|
132
133
|
`Emitting event '${event}' on socket(${this.serviceName})-(${index}) failed!`+
|
|
@@ -179,7 +180,7 @@ export class DyNTS_SocketPresence {
|
|
|
179
180
|
issuer
|
|
180
181
|
),
|
|
181
182
|
|
|
182
|
-
errorCode:
|
|
183
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-SPC-EE3`,
|
|
183
184
|
additionalContent: {
|
|
184
185
|
inactiveSockets: inactiveSockets,
|
|
185
186
|
errors: errors,
|
|
@@ -196,7 +197,7 @@ export class DyNTS_SocketPresence {
|
|
|
196
197
|
),
|
|
197
198
|
issuer
|
|
198
199
|
),
|
|
199
|
-
errorCode:
|
|
200
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-SPC-EE3`,
|
|
200
201
|
});
|
|
201
202
|
}
|
|
202
203
|
}
|