@futdevpro/nts-dynamo 1.5.54 → 1.5.58
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/README.md +123 -0
- package/lib/_enums/data-model-type.enum.d.ts +7 -0
- package/lib/_enums/data-model-type.enum.d.ts.map +1 -1
- package/lib/_enums/data-model-type.enum.js +7 -0
- package/lib/_enums/data-model-type.enum.js.map +1 -1
- package/lib/_enums/dynamo-nts-data-service-function.enum.d.ts +5 -0
- package/lib/_enums/dynamo-nts-data-service-function.enum.d.ts.map +1 -1
- package/lib/_enums/dynamo-nts-data-service-function.enum.js +5 -1
- package/lib/_enums/dynamo-nts-data-service-function.enum.js.map +1 -1
- package/lib/_enums/dynamo-nts-route-security.enum.d.ts +6 -0
- package/lib/_enums/dynamo-nts-route-security.enum.d.ts.map +1 -1
- package/lib/_enums/dynamo-nts-route-security.enum.js +6 -0
- package/lib/_enums/dynamo-nts-route-security.enum.js.map +1 -1
- package/lib/_enums/dynamo-nts-socket-security.enum.d.ts +6 -0
- package/lib/_enums/dynamo-nts-socket-security.enum.d.ts.map +1 -1
- package/lib/_enums/dynamo-nts-socket-security.enum.js +6 -0
- package/lib/_enums/dynamo-nts-socket-security.enum.js.map +1 -1
- package/lib/_enums/http/http-call-type.enum.d.ts +4 -0
- package/lib/_enums/http/http-call-type.enum.d.ts.map +1 -1
- package/lib/_enums/http/http-call-type.enum.js +4 -0
- package/lib/_enums/http/http-call-type.enum.js.map +1 -1
- package/lib/_enums/predefined-data-types.enum.d.ts +3 -0
- package/lib/_enums/predefined-data-types.enum.d.ts.map +1 -1
- package/lib/_enums/predefined-data-types.enum.js +3 -0
- package/lib/_enums/predefined-data-types.enum.js.map +1 -1
- package/lib/_models/dynamo-nts-api-call-params.d.ts +61 -2
- package/lib/_models/dynamo-nts-api-call-params.d.ts.map +1 -1
- package/lib/_models/dynamo-nts-api-call-params.js +24 -7
- package/lib/_models/dynamo-nts-api-call-params.js.map +1 -1
- package/lib/_models/dynamo-nts-app-params.d.ts +33 -1
- package/lib/_models/dynamo-nts-app-params.d.ts.map +1 -1
- package/lib/_models/dynamo-nts-app-params.js +1 -1
- package/lib/_models/dynamo-nts-app-params.js.map +1 -1
- package/lib/_models/dynamo-nts-endpoint-params.d.ts +36 -1
- package/lib/_models/dynamo-nts-endpoint-params.d.ts.map +1 -1
- package/lib/_models/dynamo-nts-endpoint-params.js +15 -13
- package/lib/_models/dynamo-nts-endpoint-params.js.map +1 -1
- package/lib/_models/dynamo-nts-global-settings.d.ts +31 -0
- package/lib/_models/dynamo-nts-global-settings.d.ts.map +1 -1
- package/lib/_models/dynamo-nts-routing-module-settings.d.ts +10 -1
- package/lib/_models/dynamo-nts-routing-module-settings.d.ts.map +1 -1
- package/lib/_models/dynamo-nts-socket-dictionary.d.ts +3 -0
- package/lib/_models/dynamo-nts-socket-dictionary.d.ts.map +1 -1
- package/lib/_models/dynamo-nts-socket-dictionary.js +3 -0
- package/lib/_models/dynamo-nts-socket-dictionary.js.map +1 -1
- package/lib/_models/dynamo-nts-socket-event-params.d.ts +1 -1
- package/lib/_models/dynamo-nts-socket-event-params.d.ts.map +1 -1
- package/lib/_models/dynamo-nts-socket-event-params.js +3 -3
- package/lib/_models/dynamo-nts-socket-event-params.js.map +1 -1
- package/lib/_models/dynamo-nts-socket-service-params.d.ts +1 -1
- package/lib/_models/dynamo-nts-socket-service-params.d.ts.map +1 -1
- package/lib/_models/dynamo-nts-socket-service-params.js +3 -3
- package/lib/_models/dynamo-nts-socket-service-params.js.map +1 -1
- package/lib/_modules/usage/usage.service.js +1 -1
- package/lib/_modules/usage/usage.service.js.map +1 -1
- package/lib/_services/dynamo-nts-api.service.d.ts +17 -2
- package/lib/_services/dynamo-nts-api.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-api.service.js +19 -11
- package/lib/_services/dynamo-nts-api.service.js.map +1 -1
- package/lib/_services/dynamo-nts-app-extended.d.ts +10 -1
- package/lib/_services/dynamo-nts-app-extended.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-app-extended.js +8 -8
- package/lib/_services/dynamo-nts-app-extended.js.map +1 -1
- package/lib/_services/dynamo-nts-app.d.ts +30 -3
- package/lib/_services/dynamo-nts-app.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-app.js +19 -19
- package/lib/_services/dynamo-nts-app.js.map +1 -1
- package/lib/_services/dynamo-nts-auth.service.d.ts +4 -4
- package/lib/_services/dynamo-nts-controller.service.d.ts +55 -0
- package/lib/_services/dynamo-nts-controller.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-controller.service.js +2 -2
- package/lib/_services/dynamo-nts-controller.service.js.map +1 -1
- package/lib/_services/dynamo-nts-data.service.d.ts +15 -3
- package/lib/_services/dynamo-nts-data.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-data.service.js +203 -147
- 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 +132 -83
- package/lib/_services/dynamo-nts-db.service.js.map +1 -1
- package/lib/_services/dynamo-nts-email.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-email.service.js +26 -22
- package/lib/_services/dynamo-nts-email.service.js.map +1 -1
- package/lib/_services/dynamo-nts-global.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-global.service.js +3 -3
- package/lib/_services/dynamo-nts-global.service.js.map +1 -1
- package/lib/_services/dynamo-nts-routing-module.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-routing-module.service.js +1 -2
- package/lib/_services/dynamo-nts-routing-module.service.js.map +1 -1
- package/lib/_services/dynamo-nts-socket.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-socket.service.js +1 -2
- package/lib/_services/dynamo-nts-socket.service.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -13
- package/src/_assets/dynamo-nts-128.png +0 -0
- package/src/_assets/dynamo-nts-256.png +0 -0
- package/src/_assets/dynamo-nts-512.png +0 -0
- package/src/_assets/dynamo-nts-64.png +0 -0
- package/src/_enums/data-model-type.enum.ts +7 -0
- package/src/_enums/dynamo-nts-data-service-function.enum.ts +5 -1
- package/src/_enums/dynamo-nts-route-security.enum.ts +6 -0
- package/src/_enums/dynamo-nts-socket-security.enum.ts +6 -0
- package/src/_enums/http/http-call-type.enum.ts +4 -0
- package/src/_enums/predefined-data-types.enum.ts +3 -0
- package/src/_models/dynamo-nts-api-call-params.ts +74 -14
- package/src/_models/dynamo-nts-app-params.ts +33 -1
- package/src/_models/dynamo-nts-endpoint-params.ts +49 -14
- package/src/_models/dynamo-nts-global-settings.ts +31 -0
- package/src/_models/dynamo-nts-routing-module-settings.ts +10 -1
- package/src/_models/dynamo-nts-socket-dictionary.ts +3 -0
- package/src/_models/dynamo-nts-socket-event-params.ts +3 -3
- package/src/_models/dynamo-nts-socket-service-params.ts +3 -3
- package/src/_modules/usage/usage.service.ts +2 -2
- package/src/_services/dynamo-nts-api.service.ts +23 -12
- package/src/_services/dynamo-nts-app-extended.ts +17 -8
- package/src/_services/dynamo-nts-app.ts +47 -20
- package/src/_services/dynamo-nts-auth.service.ts +4 -4
- package/src/_services/dynamo-nts-controller.service.ts +57 -2
- package/src/_services/dynamo-nts-data.service.ts +200 -132
- package/src/_services/dynamo-nts-db.service.ts +122 -83
- package/src/_services/dynamo-nts-email.service.ts +33 -23
- package/src/_services/dynamo-nts-global.service.ts +3 -4
- package/src/_services/dynamo-nts-routing-module.service.ts +2 -3
- package/src/_services/dynamo-nts-socket.service.ts +2 -3
- package/src/version.json +0 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@futdevpro/nts-dynamo",
|
|
3
|
-
"version": "01.05.
|
|
4
|
-
"description": "Dynamic NodeTS (NodeJS-Typescript), MongoDB Backend System Framework by Future Development Ltd.",
|
|
3
|
+
"version": "01.05.58",
|
|
4
|
+
"description": "Dynamic NodeTS (NodeJS-Typescript), MongoDB Backend System Framework by Future Development Program Ltd.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
7
|
|
|
@@ -180,17 +180,17 @@
|
|
|
180
180
|
},
|
|
181
181
|
"homepage": "https:/futdevpro.hu/projects/dynamo",
|
|
182
182
|
"peerDependencies": {
|
|
183
|
-
"@futdevpro/fsm-dynamo": "
|
|
183
|
+
"@futdevpro/fsm-dynamo": "~1.5.45",
|
|
184
184
|
|
|
185
|
-
"@types/express": "
|
|
186
|
-
"@types/geoip-lite": "
|
|
187
|
-
"@types/nodemailer": "
|
|
188
|
-
"axios": "
|
|
189
|
-
"express": "
|
|
190
|
-
"geoip-lite": "
|
|
191
|
-
"mongoose": "
|
|
192
|
-
"nodemailer": "
|
|
193
|
-
"rxjs": "
|
|
185
|
+
"@types/express": "~4.17.7",
|
|
186
|
+
"@types/geoip-lite": "~1.4.1",
|
|
187
|
+
"@types/nodemailer": "~6.4.4",
|
|
188
|
+
"axios": "~0.21.4",
|
|
189
|
+
"express": "~4.17.1",
|
|
190
|
+
"geoip-lite": "~1.4.5",
|
|
191
|
+
"mongoose": "~5.13.14",
|
|
192
|
+
"nodemailer": "~6.7.5",
|
|
193
|
+
"rxjs": "~7.4.0",
|
|
194
194
|
|
|
195
195
|
"@types/node": "~14.0.27",
|
|
196
196
|
"ts-node": "~8.10.2",
|
|
@@ -200,6 +200,6 @@
|
|
|
200
200
|
"tslib": "~2.0.1"
|
|
201
201
|
},
|
|
202
202
|
"devDependencies": {
|
|
203
|
-
"socket.io": "
|
|
203
|
+
"socket.io": "~4.5.2"
|
|
204
204
|
}
|
|
205
205
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
|
|
2
|
+
/**
|
|
3
|
+
* DataModelType is declaring where the data type is used
|
|
4
|
+
*
|
|
5
|
+
* dataModel: used in DB
|
|
6
|
+
* controlModel: used only in runtime
|
|
7
|
+
* interfaceModel: used only in runtime and doesnt need constructor
|
|
8
|
+
*/
|
|
2
9
|
export enum DataModelType {
|
|
3
10
|
dataModel = 'data-model',
|
|
4
11
|
controlModel = 'control-model',
|
|
@@ -2,22 +2,74 @@
|
|
|
2
2
|
import { HttpCallType } from "../_enums/http/http-call-type.enum";
|
|
3
3
|
import { HttpResponseType } from "../_enums/http/http-response-type.enum";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* API call params,
|
|
7
|
+
* such as
|
|
8
|
+
* type (HttpCallType),
|
|
9
|
+
* endpoint,
|
|
10
|
+
* and other options as httpOptions
|
|
11
|
+
*/
|
|
5
12
|
export class DynamoNTS_ApiCallParams {
|
|
13
|
+
/**
|
|
14
|
+
* name the call to be able to identify it when debugging
|
|
15
|
+
*/
|
|
6
16
|
name: string;
|
|
17
|
+
/**
|
|
18
|
+
* type of the call as; HttpCallType .get, .post, ...ect
|
|
19
|
+
*/
|
|
7
20
|
type: HttpCallType;
|
|
21
|
+
/**
|
|
22
|
+
* the endpoint of the API, without the baseUrl:
|
|
23
|
+
* '/user/get/:userId',
|
|
24
|
+
* where the parts starting with ':', will be used as pathParam
|
|
25
|
+
*/
|
|
8
26
|
baseUrl: string;
|
|
27
|
+
/**
|
|
28
|
+
* baseUrl of the API;
|
|
29
|
+
* 'https://futdevpro.hu/api'
|
|
30
|
+
*/
|
|
9
31
|
endPoint: string;
|
|
10
32
|
|
|
33
|
+
/**
|
|
34
|
+
* if this value is true, the call will return the full HTTP call response in raw
|
|
35
|
+
*/
|
|
11
36
|
getFullResponse: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* this setting will be passed to the axios http call
|
|
39
|
+
*/
|
|
12
40
|
httpOptions: any;
|
|
13
41
|
|
|
14
42
|
constructor(
|
|
43
|
+
/**
|
|
44
|
+
* set of options necessary for setting up an API call
|
|
45
|
+
*/
|
|
15
46
|
set: {
|
|
47
|
+
/**
|
|
48
|
+
* name the call to be able to identify it when debugging
|
|
49
|
+
*/
|
|
16
50
|
name: string,
|
|
51
|
+
/**
|
|
52
|
+
* set type as; HttpCallType .get, .post, ...ect
|
|
53
|
+
*/
|
|
17
54
|
type: HttpCallType,
|
|
55
|
+
/**
|
|
56
|
+
* the endpoint of the API, without the baseUrl:
|
|
57
|
+
* '/user/get/:userId',
|
|
58
|
+
* where the parts starting with ':', will be used as pathParam
|
|
59
|
+
*/
|
|
18
60
|
endPoint: string,
|
|
61
|
+
/**
|
|
62
|
+
* baseUrl of the API;
|
|
63
|
+
* 'https://futdevpro.hu/api'
|
|
64
|
+
*/
|
|
19
65
|
baseUrl: string,
|
|
66
|
+
/**
|
|
67
|
+
* setting this value to true, will return the full HTTP call response in raw
|
|
68
|
+
*/
|
|
20
69
|
getFullResponse?: boolean,
|
|
70
|
+
/**
|
|
71
|
+
* this setting will pass any kind of http setting used by the axios http messaging package
|
|
72
|
+
*/
|
|
21
73
|
httpOptions?: HttpOptions,
|
|
22
74
|
}
|
|
23
75
|
) {
|
|
@@ -34,6 +86,12 @@ export class DynamoNTS_ApiCallParams {
|
|
|
34
86
|
}
|
|
35
87
|
}
|
|
36
88
|
|
|
89
|
+
/**
|
|
90
|
+
* basic axios HttpsOptions,
|
|
91
|
+
*
|
|
92
|
+
* learn more on axios package....
|
|
93
|
+
* TOD: link package documentations
|
|
94
|
+
*/
|
|
37
95
|
export class HttpOptions {
|
|
38
96
|
responseType?: HttpResponseType;
|
|
39
97
|
headers?: {
|
|
@@ -43,19 +101,21 @@ export class HttpOptions {
|
|
|
43
101
|
reportProgress?: boolean;
|
|
44
102
|
withCredentials?: boolean;
|
|
45
103
|
|
|
46
|
-
constructor(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
this.
|
|
58
|
-
this.
|
|
59
|
-
this.
|
|
104
|
+
constructor(
|
|
105
|
+
set: {
|
|
106
|
+
responseType?: HttpResponseType,
|
|
107
|
+
headers?: {
|
|
108
|
+
[header: string]: string | string[];
|
|
109
|
+
},
|
|
110
|
+
observe?: 'body',
|
|
111
|
+
reportProgress?: boolean,
|
|
112
|
+
withCredentials?: boolean
|
|
113
|
+
}
|
|
114
|
+
) {
|
|
115
|
+
this.responseType = set.responseType;
|
|
116
|
+
this.headers = set.headers;
|
|
117
|
+
this.observe = set.observe;
|
|
118
|
+
this.reportProgress = set.reportProgress;
|
|
119
|
+
this.withCredentials = set.withCredentials;
|
|
60
120
|
}
|
|
61
121
|
}
|
|
@@ -1,20 +1,52 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* This will hold and set the basic settings of an application
|
|
4
4
|
*/
|
|
5
5
|
export class DynamoNTS_AppParams {
|
|
6
|
+
/**
|
|
7
|
+
* name of the application
|
|
8
|
+
*/
|
|
6
9
|
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* title will be shown on the start of the application
|
|
12
|
+
*/
|
|
7
13
|
title: string;
|
|
14
|
+
/**
|
|
15
|
+
* version of the application
|
|
16
|
+
*/
|
|
8
17
|
version: string;
|
|
18
|
+
/**
|
|
19
|
+
* name of your MongoDB table
|
|
20
|
+
*/
|
|
9
21
|
dbUri: string;
|
|
22
|
+
/**
|
|
23
|
+
* mongoDB uri, by default, its: `mongodb://localhost:27017/${this.dbName}`
|
|
24
|
+
*/
|
|
10
25
|
dbName: string;
|
|
11
26
|
|
|
12
27
|
constructor(
|
|
13
28
|
set: {
|
|
29
|
+
/**
|
|
30
|
+
* name the application
|
|
31
|
+
*/
|
|
14
32
|
name: string,
|
|
33
|
+
/**
|
|
34
|
+
* you can set a big f*in title to show on the start of the application
|
|
35
|
+
*/
|
|
15
36
|
title?: string,
|
|
37
|
+
/**
|
|
38
|
+
* you should set the version,
|
|
39
|
+
* probably, you should set from the package.json as follows:
|
|
40
|
+
* import { version } from '../package.json';
|
|
41
|
+
*/
|
|
16
42
|
version: string,
|
|
43
|
+
/**
|
|
44
|
+
* You need to name your MongoDB table
|
|
45
|
+
*/
|
|
17
46
|
dbName: string,
|
|
47
|
+
/**
|
|
48
|
+
* you can change the mongoDB uri here. by default, its: `mongodb://localhost:27017/${this.dbName}`
|
|
49
|
+
*/
|
|
18
50
|
dbUri?: string,
|
|
19
51
|
}
|
|
20
52
|
) {
|
|
@@ -4,13 +4,14 @@ import { NextFunction, Request, Response } from 'express';
|
|
|
4
4
|
|
|
5
5
|
import { HttpCallType } from '../_enums/http/http-call-type.enum';
|
|
6
6
|
import { DynamoNTS_RouteSecurity } from '../_enums/dynamo-nts-route-security.enum';
|
|
7
|
-
import { DynamoNTS_Shared } from '../_services/dynamo-nts-shared.service';
|
|
8
7
|
import { DynamoNTS_GlobalService } from '../_services/dynamo-nts-global.service';
|
|
9
8
|
import { dynamoNTS_GlobalSettings } from '../_constants';
|
|
10
|
-
import { Dynamo_Error } from '@futdevpro/fsm-dynamo';
|
|
9
|
+
import { Dynamo_Error, Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
|
-
*
|
|
12
|
+
* High level endpoint for API
|
|
13
|
+
* used for specific events such as saving or getting data,
|
|
14
|
+
* triggering events, logging in or out, and much more
|
|
14
15
|
*/
|
|
15
16
|
export class DynamoNTS_EndpointParams{
|
|
16
17
|
name: string;
|
|
@@ -30,23 +31,56 @@ export class DynamoNTS_EndpointParams{
|
|
|
30
31
|
|
|
31
32
|
constructor(
|
|
32
33
|
set: {
|
|
34
|
+
/**
|
|
35
|
+
* naming the endpoint will help to follow events on service
|
|
36
|
+
*/
|
|
33
37
|
name: string,
|
|
38
|
+
/**
|
|
39
|
+
* security settings for API, different security paths will need different handlers
|
|
40
|
+
*
|
|
41
|
+
* open; http, secure; https or both
|
|
42
|
+
*/
|
|
34
43
|
security?: DynamoNTS_RouteSecurity,
|
|
35
44
|
|
|
45
|
+
/**
|
|
46
|
+
* define basic Http Call Type such as; get, post, put, patch, delete
|
|
47
|
+
*/
|
|
36
48
|
type: HttpCallType,
|
|
49
|
+
/**
|
|
50
|
+
* set endpoint here, without baseUrl and route module path
|
|
51
|
+
*
|
|
52
|
+
* like: '/get-user/:userId'
|
|
53
|
+
*/
|
|
37
54
|
endpoint: string,
|
|
38
55
|
|
|
56
|
+
/**
|
|
57
|
+
* preprocesses are the functions you need to run before the actual function,
|
|
58
|
+
* such as authentications
|
|
59
|
+
*/
|
|
39
60
|
preProcessess?: ((req: Request, res: Response, next: NextFunction) => Promise<void>)[],
|
|
61
|
+
/**
|
|
62
|
+
* the actual tasks to run,
|
|
63
|
+
* the last one should contain the res.send(); execution to send response on API requests
|
|
64
|
+
*/
|
|
40
65
|
tasks: ((req: Request, res: Response, issuer?: string) => Promise<void>)[],
|
|
41
66
|
|
|
67
|
+
/**
|
|
68
|
+
* this flag will enable the debug logs on this endpoint
|
|
69
|
+
*/
|
|
42
70
|
logRequest?: boolean,
|
|
71
|
+
/**
|
|
72
|
+
* this flag will enable the debug logs on this endpoint's requests
|
|
73
|
+
*/
|
|
43
74
|
logRequestsContent?: boolean,
|
|
75
|
+
/**
|
|
76
|
+
* this flag will enable detailed debug logs on this endpoint's requests
|
|
77
|
+
*/
|
|
44
78
|
logResponseContent?: boolean,
|
|
45
79
|
}
|
|
46
80
|
) {
|
|
47
81
|
try {
|
|
48
|
-
this.name = set.name
|
|
49
|
-
this.security = set.security
|
|
82
|
+
this.name = set.name ?? set.endpoint;
|
|
83
|
+
this.security = set.security ?? dynamoNTS_GlobalSettings.defaultRouteSecurity;
|
|
50
84
|
|
|
51
85
|
this.type = set.type;
|
|
52
86
|
this.endpoint = set.endpoint;
|
|
@@ -60,12 +94,13 @@ export class DynamoNTS_EndpointParams{
|
|
|
60
94
|
userMessage: 'We encountered an unhandled Server Error, please contact the responsible development team.'
|
|
61
95
|
});
|
|
62
96
|
}
|
|
97
|
+
|
|
63
98
|
let pathParts: string[] = this.endpoint.split('/');
|
|
64
99
|
pathParts = pathParts.filter((part: string) => part[0] === ':');
|
|
65
100
|
pathParts = pathParts.map((part: string) => part = part.replace(':', ''));
|
|
66
101
|
this.pathParams = pathParts;
|
|
67
102
|
|
|
68
|
-
this.preProcessess = set.preProcessess
|
|
103
|
+
this.preProcessess = set.preProcessess ?? [];
|
|
69
104
|
this.tasks = set.tasks;
|
|
70
105
|
|
|
71
106
|
this.logRequest = set.logRequest !== undefined ? set.logRequest : dynamoNTS_GlobalSettings.logRequest;
|
|
@@ -76,7 +111,7 @@ export class DynamoNTS_EndpointParams{
|
|
|
76
111
|
this.preProcessess.unshift(this.getPreLog());
|
|
77
112
|
}
|
|
78
113
|
} catch (error) {
|
|
79
|
-
|
|
114
|
+
Dynamo_Log.logError(
|
|
80
115
|
`\nEndpoint params setup failed: name: '${set.name}' (security: ${set.security}) endpoint: ${set.endpoint}\nERROR:\n`, error);
|
|
81
116
|
throw error;
|
|
82
117
|
}
|
|
@@ -131,10 +166,10 @@ export class DynamoNTS_EndpointParams{
|
|
|
131
166
|
|
|
132
167
|
if (this.logRequest) {
|
|
133
168
|
if (this.logResponseContent) {
|
|
134
|
-
|
|
135
|
-
|
|
169
|
+
Dynamo_Log.logSuccess(` <<<===== ${this.name} result sent.`);
|
|
170
|
+
Dynamo_Log.logSuccess('sorry, the logResponseContent is not implemented yet.');
|
|
136
171
|
} else {
|
|
137
|
-
|
|
172
|
+
Dynamo_Log.logSuccess(` <<<===== ${this.name} result sent.`);
|
|
138
173
|
}
|
|
139
174
|
}
|
|
140
175
|
} catch (error) {
|
|
@@ -149,16 +184,16 @@ export class DynamoNTS_EndpointParams{
|
|
|
149
184
|
* @param error
|
|
150
185
|
*/
|
|
151
186
|
error(res: Response, error): void {
|
|
152
|
-
|
|
187
|
+
Dynamo_Log.logError(`Endpoint catched an error. ${this.name} (${this.endpoint})\nERROR:`, error, '\n');
|
|
153
188
|
res.status(error.status ? error.status : 501);
|
|
154
189
|
res.send(error);
|
|
155
190
|
|
|
156
191
|
if (this.logRequest) {
|
|
157
192
|
if (this.logResponseContent) {
|
|
158
|
-
|
|
159
|
-
|
|
193
|
+
Dynamo_Log.logError(` <<<===== ${this.name} error sent.`);
|
|
194
|
+
Dynamo_Log.logError('sorry, the logResponseContent is not implemented yet.');
|
|
160
195
|
} else {
|
|
161
|
-
|
|
196
|
+
Dynamo_Log.logError(` <<<===== ${this.name} error sent.`);
|
|
162
197
|
}
|
|
163
198
|
}
|
|
164
199
|
}
|
|
@@ -10,17 +10,48 @@ import { DynamoNTS_SocketSecurity } from '../_enums/dynamo-nts-socket-security.e
|
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
export interface DynamoNTS_GlobalSettings {
|
|
13
|
+
/**
|
|
14
|
+
* this will be used as the main baseUrl for the application,
|
|
15
|
+
* this is not required, but we suggest to use at least a '/api' as base route
|
|
16
|
+
*/
|
|
13
17
|
baseUrl: string;
|
|
18
|
+
/**
|
|
19
|
+
* this sets the default security for routes
|
|
20
|
+
*/
|
|
14
21
|
defaultRouteSecurity: DynamoNTS_RouteSecurity;
|
|
22
|
+
/**
|
|
23
|
+
* this sets the default security for sockets
|
|
24
|
+
*/
|
|
15
25
|
defaultSocketSecurity: DynamoNTS_SocketSecurity;
|
|
16
26
|
|
|
27
|
+
/**
|
|
28
|
+
* this setting will enable debug logs for setting up the application
|
|
29
|
+
*/
|
|
17
30
|
logSetup?: boolean;
|
|
18
31
|
|
|
32
|
+
/**
|
|
33
|
+
* this is an application wide default setting for route debug logs
|
|
34
|
+
*/
|
|
19
35
|
logRequest?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* this is an application wide default setting for route debug logs
|
|
38
|
+
*/
|
|
20
39
|
logRequestsContent?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* this is an application wide default setting for route debug logs
|
|
42
|
+
*/
|
|
21
43
|
logResponseContent?: boolean;
|
|
22
44
|
|
|
45
|
+
/**
|
|
46
|
+
* this is an application wide default setting for socket debug logs
|
|
47
|
+
*/
|
|
23
48
|
logMainSocketEvent?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* this is an application wide default setting for socket debug logs
|
|
51
|
+
*/
|
|
24
52
|
logAllSocketEvent?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* this is an application wide default setting for socket debug logs
|
|
55
|
+
*/
|
|
25
56
|
logEventContent?: boolean;
|
|
26
57
|
}
|
|
@@ -2,10 +2,19 @@ import { DynamoNTS_RouteSecurity } from '../_enums';
|
|
|
2
2
|
import { DynamoNTS_Controller } from '../_services';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* This is a main route point handler, which collects a list of controllers for the API
|
|
6
6
|
*/
|
|
7
7
|
export interface DynamoNTS_RoutingModuleSettings {
|
|
8
|
+
/**
|
|
9
|
+
* main route of the module
|
|
10
|
+
*/
|
|
8
11
|
route: string;
|
|
12
|
+
/**
|
|
13
|
+
* the collection of controllers (sub-routes, with differentlogical parts, to different db elements)
|
|
14
|
+
*/
|
|
9
15
|
controllers: DynamoNTS_Controller[];
|
|
16
|
+
/**
|
|
17
|
+
* securityOverride will be used to create different security for a single module without changing the default security (http/https/both)
|
|
18
|
+
*/
|
|
10
19
|
securityOverride?: DynamoNTS_RouteSecurity;
|
|
11
20
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import { DynamoNTS_Shared } from '../_services/dynamo-nts-shared.service';
|
|
4
3
|
import { dynamoNTS_GlobalSettings } from '../_constants';
|
|
5
4
|
import { DynamoNTS_SocketEvent } from '../_enums/http/socket-event.enum';
|
|
5
|
+
import { Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* socket handling and clarification is under development
|
|
9
9
|
*/
|
|
10
10
|
export class DynamoNTS_SocketEventParams<T>{
|
|
11
11
|
socketName?: string;
|
|
@@ -49,7 +49,7 @@ export class DynamoNTS_SocketEventParams<T>{
|
|
|
49
49
|
this.preProcessess.unshift(this.getPreLog());
|
|
50
50
|
}
|
|
51
51
|
} catch (error) {
|
|
52
|
-
|
|
52
|
+
Dynamo_Log.logError(
|
|
53
53
|
`\nSocket Event params setup failed (${this.socketName}): ${set.event}`, error);
|
|
54
54
|
throw error;
|
|
55
55
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
+
import { Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
2
3
|
import { dynamoNTS_GlobalSettings } from '../_constants';
|
|
3
4
|
import { DynamoNTS_SocketSecurity } from '../_enums/dynamo-nts-socket-security.enum';
|
|
4
|
-
import { DynamoNTS_Shared } from '../_services';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* socket handling and clarification is under development
|
|
8
8
|
*/
|
|
9
9
|
export class DynamoNTS_SocketServiceParams {
|
|
10
10
|
name: string;
|
|
@@ -31,7 +31,7 @@ export class DynamoNTS_SocketServiceParams {
|
|
|
31
31
|
if (set.getIdFromSubscrioption) {
|
|
32
32
|
this.getIdFromSubscrioption = set.getIdFromSubscrioption;
|
|
33
33
|
if (set.groupActiveSocketsBy) {
|
|
34
|
-
|
|
34
|
+
Dynamo_Log.logError(
|
|
35
35
|
`setting groupActiveSocketsBy on DynamoNTS_SocketService (${this.name}) won't take effect, ` +
|
|
36
36
|
`since getIdFromSubscrioption is also setted, so it will be used instead`)
|
|
37
37
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { Request } from 'express';
|
|
3
|
-
import { Dynamo_Error } from '@futdevpro/fsm-dynamo';
|
|
3
|
+
import { Dynamo_Error, Dynamo_Time } from '@futdevpro/fsm-dynamo';
|
|
4
4
|
import { Dynamo_UsageSession, usageSessionModelParams, Dynamo_UsageData,
|
|
5
5
|
Dynamo_DailyUsageData } from '@futdevpro/fsm-dynamo/usage-module';
|
|
6
6
|
|
|
@@ -46,7 +46,7 @@ export class UsageService extends DynamoNTS_DataService<Dynamo_UsageSession> {
|
|
|
46
46
|
async getLastWeekUsage(): Promise<void> {
|
|
47
47
|
try {
|
|
48
48
|
await this.dataDBService.find({
|
|
49
|
-
sessionStart: { $gte:
|
|
49
|
+
sessionStart: { $gte: Dynamo_Time.oneWeekAgo() }
|
|
50
50
|
}).then((res: Dynamo_UsageSession[]) => {
|
|
51
51
|
this.dataList = res;
|
|
52
52
|
});
|