@futdevpro/nts-dynamo 1.8.5 → 1.9.1
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/.copilot/patterns.json +1 -1
- package/.eslintrc.json +9 -1
- package/lib/_constants/mocks/app-extended-server.mock.js +5 -5
- package/lib/_constants/mocks/app-extended-server.mock.js.map +1 -1
- package/lib/_constants/mocks/app-server.mock.js +4 -4
- package/lib/_constants/mocks/app-server.mock.js.map +1 -1
- package/lib/_constants/mocks/data-model.mock.d.ts +5 -5
- package/lib/_constants/mocks/data-model.mock.d.ts.map +1 -1
- package/lib/_constants/mocks/data-model.mock.js +4 -4
- package/lib/_constants/mocks/data-model.mock.js.map +1 -1
- package/lib/_models/control-models/api-call-params.control-model.js +1 -1
- package/lib/_models/control-models/api-call-params.control-model.js.map +1 -1
- package/lib/_models/control-models/endpoint-params.control-model.js +17 -17
- package/lib/_models/control-models/endpoint-params.control-model.js.map +1 -1
- package/lib/_models/control-models/socket-event.control-model.js +7 -7
- package/lib/_models/control-models/socket-event.control-model.js.map +1 -1
- package/lib/_models/control-models/socket-presence.control-model.js +8 -8
- package/lib/_models/control-models/socket-presence.control-model.js.map +1 -1
- package/lib/_models/interfaces/global-service-settings.interface.d.ts +3 -3
- package/lib/_models/interfaces/global-service-settings.interface.d.ts.map +1 -1
- package/lib/_modules/custom-data/custom-data.controller.js +4 -4
- package/lib/_modules/custom-data/custom-data.controller.js.map +1 -1
- package/lib/_modules/custom-data/custom-data.data-service.d.ts +3 -3
- package/lib/_modules/custom-data/custom-data.data-service.d.ts.map +1 -1
- package/lib/_modules/custom-data/custom-data.data-service.js +4 -4
- package/lib/_modules/custom-data/custom-data.data-service.js.map +1 -1
- package/lib/_modules/custom-data/get-custom-data-routing-module.util.js +1 -1
- package/lib/_modules/custom-data/get-custom-data-routing-module.util.js.map +1 -1
- package/lib/_modules/test/get-test-routing-module.util.js +1 -1
- package/lib/_modules/test/get-test-routing-module.util.js.map +1 -1
- package/lib/_modules/test/test.controller.js +6 -6
- package/lib/_modules/test/test.controller.js.map +1 -1
- package/lib/_modules/usage/get-usage-routing-module.util.js +1 -1
- package/lib/_modules/usage/get-usage-routing-module.util.js.map +1 -1
- package/lib/_modules/usage/usage.controller.js +5 -5
- package/lib/_modules/usage/usage.controller.js.map +1 -1
- package/lib/_modules/usage/usage.data-service.d.ts +8 -8
- package/lib/_modules/usage/usage.data-service.d.ts.map +1 -1
- package/lib/_modules/usage/usage.data-service.js +8 -8
- package/lib/_modules/usage/usage.data-service.js.map +1 -1
- package/lib/_services/base/data.service.d.ts +4 -4
- package/lib/_services/base/data.service.d.ts.map +1 -1
- package/lib/_services/base/data.service.js +35 -35
- package/lib/_services/base/data.service.js.map +1 -1
- package/lib/_services/base/db.service.d.ts +6 -6
- package/lib/_services/base/db.service.d.ts.map +1 -1
- package/lib/_services/base/db.service.js +31 -31
- package/lib/_services/base/db.service.js.map +1 -1
- package/lib/_services/core/api.service.js +25 -25
- package/lib/_services/core/api.service.js.map +1 -1
- package/lib/_services/core/auth.service.d.ts +6 -6
- package/lib/_services/core/auth.service.js +2 -2
- package/lib/_services/core/auth.service.js.map +1 -1
- package/lib/_services/core/email.service.js +23 -23
- package/lib/_services/core/email.service.js.map +1 -1
- package/lib/_services/core/global.service.d.ts +3 -3
- package/lib/_services/core/global.service.d.ts.map +1 -1
- package/lib/_services/core/global.service.js +7 -7
- package/lib/_services/core/global.service.js.map +1 -1
- package/lib/_services/route/controller.service.js +1 -1
- package/lib/_services/route/controller.service.js.map +1 -1
- package/lib/_services/route/routing-module.service.js +8 -8
- package/lib/_services/route/routing-module.service.js.map +1 -1
- package/lib/_services/server/app-extended.server.d.ts +2 -2
- package/lib/_services/server/app-extended.server.js +25 -25
- package/lib/_services/server/app-extended.server.js.map +1 -1
- package/lib/_services/server/app-extended.server.spec.js +3 -3
- package/lib/_services/server/app-extended.server.spec.js.map +1 -1
- package/lib/_services/server/app.server.d.ts +4 -4
- package/lib/_services/server/app.server.d.ts.map +1 -1
- package/lib/_services/server/app.server.js +89 -88
- package/lib/_services/server/app.server.js.map +1 -1
- package/lib/_services/server/app.server.spec.js +5 -5
- package/lib/_services/server/app.server.spec.js.map +1 -1
- package/lib/_services/shared.static-service.d.ts +4 -4
- package/lib/_services/shared.static-service.d.ts.map +1 -1
- package/lib/_services/shared.static-service.js +1 -1
- package/lib/_services/shared.static-service.js.map +1 -1
- package/lib/_services/socket/socket-client.service.js +19 -19
- package/lib/_services/socket/socket-client.service.js.map +1 -1
- package/lib/_services/socket/socket-server.service.js +46 -46
- package/lib/_services/socket/socket-server.service.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +233 -230
- package/src/_constants/mocks/app-extended-server.mock.ts +8 -8
- package/src/_constants/mocks/app-server.mock.ts +6 -6
- package/src/_constants/mocks/data-model.mock.ts +5 -5
- package/src/_models/control-models/api-call-params.control-model.ts +2 -2
- package/src/_models/control-models/endpoint-params.control-model.ts +28 -28
- package/src/_models/control-models/socket-event.control-model.ts +8 -8
- package/src/_models/control-models/socket-presence.control-model.ts +14 -14
- package/src/_models/interfaces/global-service-settings.interface.ts +3 -3
- package/src/_modules/custom-data/custom-data.controller.ts +6 -6
- package/src/_modules/custom-data/custom-data.data-service.ts +5 -5
- package/src/_modules/custom-data/get-custom-data-routing-module.util.ts +2 -2
- package/src/_modules/test/get-test-routing-module.util.ts +2 -2
- package/src/_modules/test/test.controller.ts +7 -7
- package/src/_modules/usage/get-usage-routing-module.util.ts +2 -2
- package/src/_modules/usage/usage.controller.ts +7 -7
- package/src/_modules/usage/usage.data-service.ts +28 -28
- package/src/_services/base/data.service.ts +46 -46
- package/src/_services/base/db.service.ts +45 -45
- package/src/_services/core/api.service.ts +32 -32
- package/src/_services/core/auth.service.ts +9 -9
- package/src/_services/core/email.service.ts +29 -29
- package/src/_services/core/global.service.ts +12 -12
- package/src/_services/route/controller.service.ts +2 -2
- package/src/_services/route/routing-module.service.ts +9 -9
- package/src/_services/server/app-extended.server.spec.ts +4 -4
- package/src/_services/server/app-extended.server.ts +26 -26
- package/src/_services/server/app.server.spec.ts +6 -6
- package/src/_services/server/app.server.ts +99 -97
- package/src/_services/shared.static-service.ts +4 -4
- package/src/_services/socket/socket-client.service.ts +21 -21
- package/src/_services/socket/socket-server.service.ts +52 -52
- package/tsconfig.json +7 -7
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Request, Response } from 'express';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { DynamoFM_Array, DynamoFM_Error, DynamoFM_Log } from '@futdevpro/fsm-dynamo';
|
|
6
6
|
import { DynamoNTS_RouteSecurity } from '../../_enums/route-security.enum';
|
|
7
7
|
import { DynamoNTS_HttpCallType } from '../../_enums/http/http-call-type.enum';
|
|
8
8
|
import { DynamoNTS_globalSettings } from '../../_constants/global-settings.const';
|
|
@@ -91,7 +91,7 @@ export class DynamoNTS_Endpoint_Params {
|
|
|
91
91
|
this.endpoint = set.endpoint;
|
|
92
92
|
|
|
93
93
|
if (!this.endpoint) {
|
|
94
|
-
throw new
|
|
94
|
+
throw new DynamoFM_Error({
|
|
95
95
|
status: 406,
|
|
96
96
|
errorCode: 'NTS-EP0-C00',
|
|
97
97
|
addECToUserMsg: true,
|
|
@@ -118,7 +118,7 @@ export class DynamoNTS_Endpoint_Params {
|
|
|
118
118
|
this.logResponseContent =
|
|
119
119
|
set.logResponseContent ?? DynamoNTS_globalSettings.logResponseContent;
|
|
120
120
|
} catch (error) {
|
|
121
|
-
|
|
121
|
+
DynamoFM_Log.error(
|
|
122
122
|
`\nEndpoint params setup failed: name: '${set.name}' ` +
|
|
123
123
|
`(security: ${set.security}) endpoint: ${set.endpoint}` +
|
|
124
124
|
`\nERROR:` +
|
|
@@ -145,9 +145,9 @@ export class DynamoNTS_Endpoint_Params {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
if (this.logRequestsContent && req.body && 0 < Object.keys(req.body).length) {
|
|
148
|
-
|
|
148
|
+
DynamoFM_Log.info(msg + `\nbody:`, req.body);
|
|
149
149
|
} else {
|
|
150
|
-
|
|
150
|
+
DynamoFM_Log.info(msg);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
@@ -171,13 +171,13 @@ export class DynamoNTS_Endpoint_Params {
|
|
|
171
171
|
await this.preLog(req, res, issuer);
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
await
|
|
174
|
+
await DynamoFM_Array.asyncForEach(this.preProcessess,
|
|
175
175
|
async (preProcess: (req: Request, res: Response) => Promise<void>): Promise<void> => {
|
|
176
176
|
await preProcess(req, res);
|
|
177
177
|
}
|
|
178
178
|
);
|
|
179
179
|
|
|
180
|
-
await
|
|
180
|
+
await DynamoFM_Array.asyncForEach(this.tasks,
|
|
181
181
|
async (
|
|
182
182
|
task: (req: Request, res: Response, issuer?: string) => Promise<void>
|
|
183
183
|
): Promise<void> => {
|
|
@@ -187,10 +187,10 @@ export class DynamoNTS_Endpoint_Params {
|
|
|
187
187
|
|
|
188
188
|
if (this.logRequest) {
|
|
189
189
|
if (this.logResponseContent) {
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
DynamoFM_Log.success(` <<<===== ${this.name} result sent.`);
|
|
191
|
+
DynamoFM_Log.warn('sorry, the logResponseContent is not implemented yet.');
|
|
192
192
|
} else {
|
|
193
|
-
|
|
193
|
+
DynamoFM_Log.success(` <<<===== ${this.name} result sent.`);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
} catch (error) {
|
|
@@ -207,7 +207,7 @@ export class DynamoNTS_Endpoint_Params {
|
|
|
207
207
|
private async error(
|
|
208
208
|
req: Request,
|
|
209
209
|
res: Response,
|
|
210
|
-
error: Error |
|
|
210
|
+
error: Error | DynamoFM_Error,
|
|
211
211
|
issuer: string
|
|
212
212
|
): Promise<void> {
|
|
213
213
|
try {
|
|
@@ -215,20 +215,20 @@ export class DynamoNTS_Endpoint_Params {
|
|
|
215
215
|
|
|
216
216
|
msg += this.getPathParamsLogContent(req);
|
|
217
217
|
|
|
218
|
-
|
|
219
|
-
|
|
218
|
+
DynamoFM_Log.error(msg);
|
|
219
|
+
DynamoFM_Log.error(
|
|
220
220
|
'ERROR:',
|
|
221
|
-
(error as
|
|
222
|
-
(error as
|
|
221
|
+
(error as DynamoFM_Error)?.flag?.includes('DYNAMO') ?
|
|
222
|
+
(error as DynamoFM_Error).getErrorSimplified() :
|
|
223
223
|
error,
|
|
224
224
|
'\n'
|
|
225
225
|
);
|
|
226
226
|
|
|
227
|
-
if ((error as
|
|
228
|
-
if (!(error as
|
|
229
|
-
(error as
|
|
227
|
+
if ((error as DynamoFM_Error)?.flag?.includes('DYNAMO')) {
|
|
228
|
+
if (!(error as DynamoFM_Error).additionalContent) {
|
|
229
|
+
(error as DynamoFM_Error).additionalContent = {};
|
|
230
230
|
}
|
|
231
|
-
(error as
|
|
231
|
+
(error as DynamoFM_Error).additionalContent.endpointInfo = msg;
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
await DynamoNTS_GlobalService.globalErrorHandler?.(
|
|
@@ -237,29 +237,29 @@ export class DynamoNTS_Endpoint_Params {
|
|
|
237
237
|
res,
|
|
238
238
|
issuer
|
|
239
239
|
).catch((err): void => {
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
DynamoFM_Log.warn('DynamoNTS_GlobalService.globalErrorHandler failed to handle error: ', err);
|
|
241
|
+
DynamoFM_Log.warn('It will proceed as normal.');
|
|
242
242
|
});
|
|
243
243
|
|
|
244
|
-
res.status((error as
|
|
244
|
+
res.status((error as DynamoFM_Error)?.___status ?? 501);
|
|
245
245
|
res.send(error);
|
|
246
246
|
|
|
247
247
|
if (this.logRequest) {
|
|
248
248
|
if (this.logResponseContent) {
|
|
249
|
-
|
|
250
|
-
` <<<===== ${this.name} error sent: ${(error as
|
|
249
|
+
DynamoFM_Log.error(
|
|
250
|
+
` <<<===== ${this.name} error sent: ${(error as DynamoFM_Error)?._message ?? ''}`
|
|
251
251
|
);
|
|
252
|
-
|
|
252
|
+
DynamoFM_Log.error(
|
|
253
253
|
'sorry, the logResponseContent is not implemented yet.'
|
|
254
254
|
);
|
|
255
255
|
} else {
|
|
256
|
-
|
|
257
|
-
` <<<===== ${this.name} error sent: ${(error as
|
|
256
|
+
DynamoFM_Log.error(
|
|
257
|
+
` <<<===== ${this.name} error sent: ${(error as DynamoFM_Error)?._message ?? ''}`
|
|
258
258
|
);
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
} catch (error) {
|
|
262
|
-
|
|
262
|
+
DynamoFM_Log.H_error(
|
|
263
263
|
`\n\nDYNAMO MULTILEVEL ERROR:DynamoNTS_EndpointParams: error: ` +
|
|
264
264
|
`(${this.name}, ${this.endpoint})` +
|
|
265
265
|
`\n(DYNAMO MULTILEVEL ERROR means, that the ERRORHANDLING is ALSO FAILED, ` +
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { DynamoFM_Array, DynamoFM_Log } from '@futdevpro/fsm-dynamo';
|
|
3
3
|
import { DynamoNTS_globalSettings } from '../../_constants/global-settings.const';
|
|
4
4
|
import { DynamoNTS_SocketEventKey } from '../../_enums/http/socket-event-type.enum';
|
|
5
5
|
|
|
@@ -86,7 +86,7 @@ export class DynamoNTS_SocketEvent<T>{
|
|
|
86
86
|
this.logEventContent = set.logEventContent !== undefined ?
|
|
87
87
|
set.logEventContent : DynamoNTS_globalSettings.logSocketEventContent;
|
|
88
88
|
} catch (error) {
|
|
89
|
-
|
|
89
|
+
DynamoFM_Log.error(
|
|
90
90
|
`\nSocket Event params setup failed (${this.serviceName}): ${set.eventKey}`,
|
|
91
91
|
error
|
|
92
92
|
);
|
|
@@ -102,15 +102,15 @@ export class DynamoNTS_SocketEvent<T>{
|
|
|
102
102
|
private async getPreLog(content: T, issuer?: string): Promise<void> {
|
|
103
103
|
try {
|
|
104
104
|
if (this.logEventContent && this.eventKey !== DynamoNTS_SocketEventKey.connection) {
|
|
105
|
-
|
|
105
|
+
DynamoFM_Log.log(
|
|
106
106
|
`---> incoming socket(${this.serviceName}) event: ${this.eventKey};
|
|
107
107
|
\ncontent:`, content
|
|
108
108
|
);
|
|
109
109
|
} else {
|
|
110
|
-
|
|
110
|
+
DynamoFM_Log.log(`---> incoming socket(${this.serviceName}) event: ${this.eventKey}...`);
|
|
111
111
|
}
|
|
112
112
|
} catch (error) {
|
|
113
|
-
|
|
113
|
+
DynamoFM_Log.error(`PreLog failed... (socket: ${this.serviceName})`, error);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
@@ -124,18 +124,18 @@ export class DynamoNTS_SocketEvent<T>{
|
|
|
124
124
|
await this.getPreLog(content, issuer);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
await
|
|
127
|
+
await DynamoFM_Array.asyncForEach(
|
|
128
128
|
this.preProcessess,
|
|
129
129
|
async (preProcess: DynamoNTS_SocketEventPreprocessTask<any, any>) => {
|
|
130
130
|
content = await preProcess(content);
|
|
131
131
|
}
|
|
132
132
|
);
|
|
133
133
|
|
|
134
|
-
await
|
|
134
|
+
await DynamoFM_Array.asyncForEach(this.tasks, async (task: DynamoNTS_SocketEventTask<T>) => {
|
|
135
135
|
await task(content, issuer);
|
|
136
136
|
});
|
|
137
137
|
} catch (error) {
|
|
138
|
-
|
|
138
|
+
DynamoFM_Log.error(
|
|
139
139
|
`Socket Event tasks failed to execute on ${this.serviceName}.... (${this.eventKey})`,
|
|
140
140
|
error,
|
|
141
141
|
'content:',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
DynamoFM_AnyError, DynamoFM_Error, DynamoFM_Error_Settings, DynamoFM_Log
|
|
4
4
|
} from '@futdevpro/fsm-dynamo';
|
|
5
5
|
import * as SocketIO from 'socket.io';
|
|
6
6
|
|
|
@@ -43,7 +43,7 @@ export class DynamoNTS_SocketPresence {
|
|
|
43
43
|
}
|
|
44
44
|
) {
|
|
45
45
|
if (!set?.issuerId) {
|
|
46
|
-
throw new
|
|
46
|
+
throw new DynamoFM_Error({
|
|
47
47
|
...this._getDefaultErrorSettings(
|
|
48
48
|
'constructor',
|
|
49
49
|
new Error(
|
|
@@ -72,7 +72,7 @@ export class DynamoNTS_SocketPresence {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
if (!set?.sockets?.length) {
|
|
75
|
-
throw new
|
|
75
|
+
throw new DynamoFM_Error({
|
|
76
76
|
...this._getDefaultErrorSettings(
|
|
77
77
|
'constructor',
|
|
78
78
|
new Error(
|
|
@@ -101,13 +101,13 @@ export class DynamoNTS_SocketPresence {
|
|
|
101
101
|
|
|
102
102
|
this.sockets.forEach((socket: SocketIO.Socket, index: number) => {
|
|
103
103
|
if (!socket.connected) {
|
|
104
|
-
|
|
104
|
+
DynamoFM_Log.warn(
|
|
105
105
|
`Emitting event '${event}' on socket(${this.serviceName})-(${index}) failed!` +
|
|
106
106
|
`\nERROR: socket[${socket.id}] is not connected! (it will be removed...)`
|
|
107
107
|
);
|
|
108
108
|
|
|
109
109
|
/* errors.push(
|
|
110
|
-
new
|
|
110
|
+
new DynamoFM_Error({
|
|
111
111
|
status: 500,
|
|
112
112
|
errorCode: 'NTS-SPC-EE1',
|
|
113
113
|
addECToUserMsg: true,
|
|
@@ -137,7 +137,7 @@ export class DynamoNTS_SocketPresence {
|
|
|
137
137
|
|
|
138
138
|
this.sockets.forEach((socket: SocketIO.Socket, index: number): void => {
|
|
139
139
|
const success: boolean = socket.emit(event, content, (error): void => {
|
|
140
|
-
|
|
140
|
+
DynamoFM_Log.error(
|
|
141
141
|
`Emitting event '${event}' on socket(${this.serviceName})-(${index}) failed!(0)` +
|
|
142
142
|
`\nerror:`, error
|
|
143
143
|
);
|
|
@@ -145,14 +145,14 @@ export class DynamoNTS_SocketPresence {
|
|
|
145
145
|
});
|
|
146
146
|
|
|
147
147
|
if (!success) {
|
|
148
|
-
|
|
148
|
+
DynamoFM_Log.error(
|
|
149
149
|
`Emitting event '${event}' on socket(${this.serviceName})-(${index}) failed!(1)`
|
|
150
150
|
);
|
|
151
151
|
}
|
|
152
152
|
});
|
|
153
153
|
|
|
154
154
|
if (0 < errors.length) {
|
|
155
|
-
throw new
|
|
155
|
+
throw new DynamoFM_Error({
|
|
156
156
|
...this._getDefaultErrorSettings(
|
|
157
157
|
'emitEvent',
|
|
158
158
|
new Error(
|
|
@@ -171,7 +171,7 @@ export class DynamoNTS_SocketPresence {
|
|
|
171
171
|
});
|
|
172
172
|
|
|
173
173
|
} else if (this.sockets.length === 0) {
|
|
174
|
-
throw new
|
|
174
|
+
throw new DynamoFM_Error({
|
|
175
175
|
...this._getDefaultErrorSettings(
|
|
176
176
|
'emitEvent',
|
|
177
177
|
new Error(
|
|
@@ -189,15 +189,15 @@ export class DynamoNTS_SocketPresence {
|
|
|
189
189
|
|
|
190
190
|
private _getDefaultErrorSettings(
|
|
191
191
|
fnName: string,
|
|
192
|
-
error:
|
|
192
|
+
error: DynamoFM_AnyError,
|
|
193
193
|
issuer: string
|
|
194
|
-
):
|
|
194
|
+
): DynamoFM_Error_Settings {
|
|
195
195
|
return {
|
|
196
|
-
status: (error as
|
|
196
|
+
status: (error as DynamoFM_Error)?.___status ?? 406,
|
|
197
197
|
message: (error as Error)?.message ?? `${fnName} was UNSUCCESFUL (NTS; ${this.serviceName})`,
|
|
198
|
-
userMessage: (error as
|
|
198
|
+
userMessage: (error as DynamoFM_Error)?.__userMessage ?? this.defaultErrorUserMsg,
|
|
199
199
|
issuerService: this.serviceName + ` (${this?.constructor?.name}-DynamoNTS_SocketPresence)`,
|
|
200
|
-
addECToUserMsg: !(error as
|
|
200
|
+
addECToUserMsg: !(error as DynamoFM_Error)?.__userMessage,
|
|
201
201
|
issuer: issuer,
|
|
202
202
|
error: error,
|
|
203
203
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { Request, Response } from 'express';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { DynamoFM_DataModel_Params } from '@futdevpro/fsm-dynamo';
|
|
8
8
|
|
|
9
9
|
import { DynamoNTS_Service_Collection } from '../../_services/core/service-collection.service';
|
|
10
10
|
import { DynamoNTS_EmailService } from '../../_services/core/email.service';
|
|
@@ -23,9 +23,9 @@ export interface DynamoNTS_GlobalService_Settings {
|
|
|
23
23
|
emailServiceCollection?: DynamoNTS_Service_Collection<DynamoNTS_EmailService>,
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* you can setup data tables by passing a
|
|
26
|
+
* you can setup data tables by passing a DynamoFM_DataModel_Params list at this point
|
|
27
27
|
*/
|
|
28
|
-
dbModels?:
|
|
28
|
+
dbModels?: DynamoFM_DataModel_Params[],
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* you can setup other services by passing a DynamoNTS_SingletonService list at this point
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { DynamoFM_customDataModule_settings } from '@futdevpro/fsm-dynamo';
|
|
5
5
|
|
|
6
6
|
import { DynamoNTS_HttpCallType } from '../../_enums/http/http-call-type.enum';
|
|
7
7
|
import { DynamoNTS_Controller } from '../../_services/route/controller.service';
|
|
8
|
-
import {
|
|
8
|
+
import { DynamoFM_CustomData_DataService } from './custom-data.data-service';
|
|
9
9
|
import {
|
|
10
10
|
DynamoNTS_Endpoint_Params
|
|
11
11
|
} from '../../_models/control-models/endpoint-params.control-model';
|
|
@@ -22,10 +22,10 @@ export class DynamoNTS_CustomData_Controller extends DynamoNTS_Controller {
|
|
|
22
22
|
new DynamoNTS_Endpoint_Params({
|
|
23
23
|
name: 'getCustomData',
|
|
24
24
|
type: DynamoNTS_HttpCallType.get,
|
|
25
|
-
endpoint:
|
|
25
|
+
endpoint: DynamoFM_customDataModule_settings.endPoints.getCustomData,
|
|
26
26
|
tasks: [
|
|
27
27
|
async (req: Request, res: Response): Promise<void> => {
|
|
28
|
-
const customDataService = new
|
|
28
|
+
const customDataService = new DynamoFM_CustomData_DataService({
|
|
29
29
|
_id: req.params.customId,
|
|
30
30
|
});
|
|
31
31
|
|
|
@@ -44,10 +44,10 @@ export class DynamoNTS_CustomData_Controller extends DynamoNTS_Controller {
|
|
|
44
44
|
new DynamoNTS_Endpoint_Params({
|
|
45
45
|
name: 'modifyCustomData',
|
|
46
46
|
type: DynamoNTS_HttpCallType.post,
|
|
47
|
-
endpoint:
|
|
47
|
+
endpoint: DynamoFM_customDataModule_settings.endPoints.modifyCustomData,
|
|
48
48
|
tasks: [
|
|
49
49
|
async (req: Request, res: Response, issuer: string): Promise<void> => {
|
|
50
|
-
const customDataService = new
|
|
50
|
+
const customDataService = new DynamoFM_CustomData_DataService(req.body, issuer);
|
|
51
51
|
|
|
52
52
|
await customDataService.saveData();
|
|
53
53
|
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
DynamoFM_customDataModel_params, DynamoFM_CustomData
|
|
6
6
|
} from '@futdevpro/fsm-dynamo/custom-data-module';
|
|
7
7
|
import { DynamoNTS_DataService } from '../../_services/base/data.service';
|
|
8
8
|
|
|
9
|
-
export class
|
|
9
|
+
export class DynamoFM_CustomData_DataService extends DynamoNTS_DataService<DynamoFM_CustomData> {
|
|
10
10
|
|
|
11
11
|
constructor(
|
|
12
|
-
customData?:
|
|
12
|
+
customData?: DynamoFM_CustomData,
|
|
13
13
|
issuer?: string
|
|
14
14
|
) {
|
|
15
15
|
super(
|
|
16
|
-
new
|
|
17
|
-
|
|
16
|
+
new DynamoFM_CustomData(customData),
|
|
17
|
+
DynamoFM_customDataModel_params,
|
|
18
18
|
issuer
|
|
19
19
|
);
|
|
20
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { DynamoFM_customDataModule_settings } from '@futdevpro/fsm-dynamo';
|
|
3
3
|
import { DynamoNTS_RouteSecurity } from '../../_enums/route-security.enum';
|
|
4
4
|
import {
|
|
5
5
|
DynamoNTS_RoutingModule_Settings
|
|
@@ -11,7 +11,7 @@ export function DynamoNTS_getCustomDataRoutingModule(
|
|
|
11
11
|
securityOverride?: DynamoNTS_RouteSecurity
|
|
12
12
|
): DynamoNTS_RoutingModule {
|
|
13
13
|
const set: DynamoNTS_RoutingModule_Settings = {
|
|
14
|
-
route:
|
|
14
|
+
route: DynamoFM_customDataModule_settings.mainRoute,
|
|
15
15
|
controllers: [ DynamoNTS_CustomData_Controller.getInstance() ],
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { DynamoFM_testModule_settings } from '@futdevpro/fsm-dynamo/test-module';
|
|
3
3
|
import { DynamoNTS_RouteSecurity } from '../../_enums/route-security.enum';
|
|
4
4
|
import {
|
|
5
5
|
DynamoNTS_RoutingModule_Settings
|
|
@@ -11,7 +11,7 @@ export function DynamoNTS_getTestRoutingModule(
|
|
|
11
11
|
securityOverride?: DynamoNTS_RouteSecurity
|
|
12
12
|
): DynamoNTS_RoutingModule {
|
|
13
13
|
const set: DynamoNTS_RoutingModule_Settings = {
|
|
14
|
-
route:
|
|
14
|
+
route: DynamoFM_testModule_settings.mainRoute,
|
|
15
15
|
controllers: [ DynamoNTS_Test_Controller.getInstance() ],
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { DynamoFM_testModule_settings } from '@futdevpro/fsm-dynamo/test-module';
|
|
5
5
|
|
|
6
6
|
import { DynamoNTS_HttpCallType } from '../../_enums/http/http-call-type.enum';
|
|
7
7
|
import { DynamoNTS_Controller } from '../../_services/route/controller.service';
|
|
@@ -22,7 +22,7 @@ export class DynamoNTS_Test_Controller extends DynamoNTS_Controller {
|
|
|
22
22
|
new DynamoNTS_Endpoint_Params({
|
|
23
23
|
name: 'testGet',
|
|
24
24
|
type: DynamoNTS_HttpCallType.get,
|
|
25
|
-
endpoint:
|
|
25
|
+
endpoint: DynamoFM_testModule_settings.endPoints.testGet,
|
|
26
26
|
tasks: [
|
|
27
27
|
async (req: Request, res: Response): Promise<void> => {
|
|
28
28
|
res.send({
|
|
@@ -37,7 +37,7 @@ export class DynamoNTS_Test_Controller extends DynamoNTS_Controller {
|
|
|
37
37
|
new DynamoNTS_Endpoint_Params({
|
|
38
38
|
name: 'testPost',
|
|
39
39
|
type: DynamoNTS_HttpCallType.post,
|
|
40
|
-
endpoint:
|
|
40
|
+
endpoint: DynamoFM_testModule_settings.endPoints.testPost,
|
|
41
41
|
tasks: [
|
|
42
42
|
async (req: Request, res: Response): Promise<void> => {
|
|
43
43
|
res.send({
|
|
@@ -52,7 +52,7 @@ export class DynamoNTS_Test_Controller extends DynamoNTS_Controller {
|
|
|
52
52
|
new DynamoNTS_Endpoint_Params({
|
|
53
53
|
name: 'testPut',
|
|
54
54
|
type: DynamoNTS_HttpCallType.put,
|
|
55
|
-
endpoint:
|
|
55
|
+
endpoint: DynamoFM_testModule_settings.endPoints.testPut,
|
|
56
56
|
tasks: [
|
|
57
57
|
async (req: Request, res: Response): Promise<void> => {
|
|
58
58
|
res.send({
|
|
@@ -67,7 +67,7 @@ export class DynamoNTS_Test_Controller extends DynamoNTS_Controller {
|
|
|
67
67
|
new DynamoNTS_Endpoint_Params({
|
|
68
68
|
name: 'testPatch',
|
|
69
69
|
type: DynamoNTS_HttpCallType.patch,
|
|
70
|
-
endpoint:
|
|
70
|
+
endpoint: DynamoFM_testModule_settings.endPoints.testPatch,
|
|
71
71
|
tasks: [
|
|
72
72
|
async (req: Request, res: Response): Promise<void> => {
|
|
73
73
|
res.send({
|
|
@@ -82,7 +82,7 @@ export class DynamoNTS_Test_Controller extends DynamoNTS_Controller {
|
|
|
82
82
|
new DynamoNTS_Endpoint_Params({
|
|
83
83
|
name: 'testDelete',
|
|
84
84
|
type: DynamoNTS_HttpCallType.delete,
|
|
85
|
-
endpoint:
|
|
85
|
+
endpoint: DynamoFM_testModule_settings.endPoints.testDelete,
|
|
86
86
|
tasks: [
|
|
87
87
|
async (req: Request, res: Response): Promise<void> => {
|
|
88
88
|
res.send({
|
|
@@ -97,7 +97,7 @@ export class DynamoNTS_Test_Controller extends DynamoNTS_Controller {
|
|
|
97
97
|
new DynamoNTS_Endpoint_Params({
|
|
98
98
|
name: 'getServerStatus',
|
|
99
99
|
type: DynamoNTS_HttpCallType.get,
|
|
100
|
-
endpoint:
|
|
100
|
+
endpoint: DynamoFM_testModule_settings.endPoints.getServerStatus,
|
|
101
101
|
tasks: [
|
|
102
102
|
async (req: Request, res: Response): Promise<void> => {
|
|
103
103
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { DynamoFM_usageModule_settings } from '@futdevpro/fsm-dynamo/usage-module';
|
|
3
3
|
import { DynamoNTS_RouteSecurity } from '../../_enums/route-security.enum';
|
|
4
4
|
import {
|
|
5
5
|
DynamoNTS_RoutingModule_Settings
|
|
@@ -11,7 +11,7 @@ export function DynamoNTS_getUsageRoutingModule(
|
|
|
11
11
|
securityOverride?: DynamoNTS_RouteSecurity
|
|
12
12
|
): DynamoNTS_RoutingModule {
|
|
13
13
|
const set: DynamoNTS_RoutingModule_Settings = {
|
|
14
|
-
route:
|
|
14
|
+
route: DynamoFM_usageModule_settings.mainRoute,
|
|
15
15
|
controllers: [ DynamoNTS_Usage_Controller.getInstance() ],
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
DynamoFM_usageModule_settings, DynamoFM_UsageSession, DynamoFM_RelativeDate
|
|
6
6
|
} from '@futdevpro/fsm-dynamo/usage-module';
|
|
7
7
|
|
|
8
8
|
import { DynamoNTS_HttpCallType } from '../../_enums/http/http-call-type.enum';
|
|
@@ -30,13 +30,13 @@ export class DynamoNTS_Usage_Controller extends DynamoNTS_Controller {
|
|
|
30
30
|
new DynamoNTS_Endpoint_Params({
|
|
31
31
|
name: 'newSession',
|
|
32
32
|
type: DynamoNTS_HttpCallType.get,
|
|
33
|
-
endpoint:
|
|
33
|
+
endpoint: DynamoFM_usageModule_settings.endPoints.newSession,
|
|
34
34
|
tasks: [
|
|
35
35
|
async (req: Request, res: Response, issuer: string): Promise<void> => {
|
|
36
36
|
const authService = DynamoNTS_GlobalService.getAuthService();
|
|
37
37
|
const username = authService.getUsernameFromRequest(req);
|
|
38
38
|
const usageService = new DynamoNTS_Usage_DataService({
|
|
39
|
-
usageSession: new
|
|
39
|
+
usageSession: new DynamoFM_UsageSession({
|
|
40
40
|
sessionStart: new Date(),
|
|
41
41
|
issuer: username,
|
|
42
42
|
}),
|
|
@@ -56,7 +56,7 @@ export class DynamoNTS_Usage_Controller extends DynamoNTS_Controller {
|
|
|
56
56
|
new DynamoNTS_Endpoint_Params({
|
|
57
57
|
name: 'updateUsage',
|
|
58
58
|
type: DynamoNTS_HttpCallType.post,
|
|
59
|
-
endpoint:
|
|
59
|
+
endpoint: DynamoFM_usageModule_settings.endPoints.updateUsage,
|
|
60
60
|
logRequestsContent: false,
|
|
61
61
|
tasks: [
|
|
62
62
|
async (req: Request, res: Response, issuer: string): Promise<void> => {
|
|
@@ -78,7 +78,7 @@ export class DynamoNTS_Usage_Controller extends DynamoNTS_Controller {
|
|
|
78
78
|
new DynamoNTS_Endpoint_Params({
|
|
79
79
|
name: 'closeSession',
|
|
80
80
|
type: DynamoNTS_HttpCallType.get,
|
|
81
|
-
endpoint:
|
|
81
|
+
endpoint: DynamoFM_usageModule_settings.endPoints.closeSession,
|
|
82
82
|
tasks: [
|
|
83
83
|
async (req: Request, res: Response, issuer: string): Promise<void> => {
|
|
84
84
|
const usageService = new DynamoNTS_Usage_DataService({
|
|
@@ -98,11 +98,11 @@ export class DynamoNTS_Usage_Controller extends DynamoNTS_Controller {
|
|
|
98
98
|
new DynamoNTS_Endpoint_Params({
|
|
99
99
|
name: 'getUsageData',
|
|
100
100
|
type: DynamoNTS_HttpCallType.get,
|
|
101
|
-
endpoint:
|
|
101
|
+
endpoint: DynamoFM_usageModule_settings.endPoints.getUsageData,
|
|
102
102
|
preProcessess: [this.authService.authTokenPermAccUsageData],
|
|
103
103
|
tasks: [
|
|
104
104
|
async (req: Request, res: Response): Promise<void> => {
|
|
105
|
-
const range:
|
|
105
|
+
const range: DynamoFM_RelativeDate = req.params.range as DynamoFM_RelativeDate;
|
|
106
106
|
|
|
107
107
|
const usageService = new DynamoNTS_Usage_DataService();
|
|
108
108
|
|