@futdevpro/nts-dynamo 1.5.30 → 1.5.31
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/lib/_constants/dynamo-nts-global.settings.d.ts +3 -0
- package/lib/_constants/dynamo-nts-global.settings.d.ts.map +1 -0
- package/lib/_constants/dynamo-nts-global.settings.js +13 -0
- package/lib/_constants/dynamo-nts-global.settings.js.map +1 -0
- package/lib/_constants/index.d.ts +1 -1
- package/lib/_constants/index.d.ts.map +1 -1
- package/lib/_constants/index.js +1 -1
- package/lib/_constants/index.js.map +1 -1
- package/lib/_enums/dynamo-nts-data-service-function.enum.d.ts +8 -0
- package/lib/_enums/dynamo-nts-data-service-function.enum.d.ts.map +1 -0
- package/lib/_enums/dynamo-nts-data-service-function.enum.js +15 -0
- package/lib/_enums/dynamo-nts-data-service-function.enum.js.map +1 -0
- package/lib/_enums/dynamo-nts-route-security.enum.d.ts +6 -0
- package/lib/_enums/dynamo-nts-route-security.enum.d.ts.map +1 -0
- package/lib/_enums/dynamo-nts-route-security.enum.js +10 -0
- package/lib/_enums/dynamo-nts-route-security.enum.js.map +1 -0
- package/lib/_enums/index.d.ts +2 -2
- package/lib/_enums/index.d.ts.map +1 -1
- package/lib/_enums/index.js +2 -2
- package/lib/_enums/index.js.map +1 -1
- package/lib/_models/dynamo-module-settings.d.ts +0 -6
- package/lib/_models/dynamo-module-settings.d.ts.map +1 -1
- package/lib/_models/dynamo-module-settings.js +9 -2
- package/lib/_models/dynamo-module-settings.js.map +1 -1
- package/lib/_models/dynamo-nts-api-call-params.d.ts +37 -0
- package/lib/_models/dynamo-nts-api-call-params.d.ts.map +1 -0
- package/lib/_models/dynamo-nts-api-call-params.js +29 -0
- package/lib/_models/dynamo-nts-api-call-params.js.map +1 -0
- package/lib/_models/dynamo-nts-app-params.d.ts +18 -0
- package/lib/_models/dynamo-nts-app-params.d.ts.map +1 -0
- package/lib/_models/dynamo-nts-app-params.js +17 -0
- package/lib/_models/dynamo-nts-app-params.js.map +1 -0
- package/lib/_models/dynamo-nts-endpoint-params.d.ts +46 -0
- package/lib/_models/dynamo-nts-endpoint-params.d.ts.map +1 -0
- package/lib/_models/dynamo-nts-endpoint-params.js +117 -0
- package/lib/_models/dynamo-nts-endpoint-params.js.map +1 -0
- package/lib/_models/dynamo-nts-global-settings.d.ts +13 -0
- package/lib/_models/dynamo-nts-global-settings.d.ts.map +1 -0
- package/lib/_models/dynamo-nts-global-settings.js +3 -0
- package/lib/_models/dynamo-nts-global-settings.js.map +1 -0
- package/lib/_models/index.d.ts +4 -4
- package/lib/_models/index.d.ts.map +1 -1
- package/lib/_models/index.js +4 -5
- package/lib/_models/index.js.map +1 -1
- package/lib/_modules/api-service.index.d.ts +3 -3
- package/lib/_modules/api-service.index.d.ts.map +1 -1
- package/lib/_modules/api-service.index.js +3 -3
- package/lib/_modules/api-service.index.js.map +1 -1
- package/lib/_modules/app.index.d.ts +9 -9
- package/lib/_modules/app.index.d.ts.map +1 -1
- package/lib/_modules/app.index.js +9 -9
- package/lib/_modules/app.index.js.map +1 -1
- package/lib/_modules/auth.index.d.ts +2 -2
- package/lib/_modules/auth.index.d.ts.map +1 -1
- package/lib/_modules/auth.index.js +2 -2
- package/lib/_modules/auth.index.js.map +1 -1
- package/lib/_modules/controller.index.d.ts +3 -3
- package/lib/_modules/controller.index.d.ts.map +1 -1
- package/lib/_modules/controller.index.js +3 -3
- package/lib/_modules/controller.index.js.map +1 -1
- package/lib/_modules/data-service.index.d.ts +4 -4
- package/lib/_modules/data-service.index.d.ts.map +1 -1
- package/lib/_modules/data-service.index.js +4 -4
- package/lib/_modules/data-service.index.js.map +1 -1
- package/lib/_modules/email.index.d.ts +2 -2
- package/lib/_modules/email.index.d.ts.map +1 -1
- package/lib/_modules/email.index.js +2 -2
- package/lib/_modules/email.index.js.map +1 -1
- package/lib/_modules/test/custom-data.service.d.ts +2 -2
- package/lib/_modules/test/custom-data.service.d.ts.map +1 -1
- package/lib/_modules/test/custom-data.service.js +2 -2
- package/lib/_modules/test/custom-data.service.js.map +1 -1
- package/lib/_modules/test/get-test-routing-module.d.ts +3 -3
- package/lib/_modules/test/get-test-routing-module.d.ts.map +1 -1
- package/lib/_modules/test/get-test-routing-module.js +2 -2
- package/lib/_modules/test/get-test-routing-module.js.map +1 -1
- package/lib/_modules/test/test-controller.d.ts +2 -2
- package/lib/_modules/test/test-controller.d.ts.map +1 -1
- package/lib/_modules/test/test-controller.js +10 -10
- package/lib/_modules/test/test-controller.js.map +1 -1
- package/lib/_modules/usage/get-usage-routing-module.d.ts +3 -3
- package/lib/_modules/usage/get-usage-routing-module.d.ts.map +1 -1
- package/lib/_modules/usage/get-usage-routing-module.js +2 -2
- package/lib/_modules/usage/get-usage-routing-module.js.map +1 -1
- package/lib/_modules/usage/usage-controller.d.ts +2 -2
- package/lib/_modules/usage/usage-controller.d.ts.map +1 -1
- package/lib/_modules/usage/usage-controller.js +10 -10
- package/lib/_modules/usage/usage-controller.js.map +1 -1
- package/lib/_modules/usage/usage.service.d.ts +2 -2
- package/lib/_modules/usage/usage.service.d.ts.map +1 -1
- package/lib/_modules/usage/usage.service.js +6 -6
- package/lib/_modules/usage/usage.service.js.map +1 -1
- package/lib/_services/dynamo-nts-api.service.d.ts +19 -0
- package/lib/_services/dynamo-nts-api.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-api.service.js +167 -0
- package/lib/_services/dynamo-nts-api.service.js.map +1 -0
- package/lib/_services/dynamo-nts-app-extended.d.ts +23 -0
- package/lib/_services/dynamo-nts-app-extended.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-app-extended.js +92 -0
- package/lib/_services/dynamo-nts-app-extended.js.map +1 -0
- package/lib/_services/dynamo-nts-app.d.ts +130 -0
- package/lib/_services/dynamo-nts-app.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-app.js +238 -0
- package/lib/_services/dynamo-nts-app.js.map +1 -0
- package/lib/_services/dynamo-nts-auth.service.d.ts +54 -0
- package/lib/_services/dynamo-nts-auth.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-auth.service.js +46 -0
- package/lib/_services/dynamo-nts-auth.service.js.map +1 -0
- package/lib/_services/dynamo-nts-controller.service.d.ts +14 -0
- package/lib/_services/dynamo-nts-controller.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-controller.service.js +21 -0
- package/lib/_services/dynamo-nts-controller.service.js.map +1 -0
- package/lib/_services/dynamo-nts-data.service.d.ts +54 -0
- package/lib/_services/dynamo-nts-data.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-data.service.js +301 -0
- package/lib/_services/dynamo-nts-data.service.js.map +1 -0
- package/lib/_services/dynamo-nts-db-service-collection.service.d.ts +9 -0
- package/lib/_services/dynamo-nts-db-service-collection.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-db-service-collection.service.js +11 -0
- package/lib/_services/dynamo-nts-db-service-collection.service.js.map +1 -0
- package/lib/_services/dynamo-nts-db.service.d.ts +244 -0
- package/lib/_services/dynamo-nts-db.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-db.service.js +759 -0
- package/lib/_services/dynamo-nts-db.service.js.map +1 -0
- package/lib/_services/dynamo-nts-email-service-collection.service.d.ts +19 -0
- package/lib/_services/dynamo-nts-email-service-collection.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-email-service-collection.service.js +21 -0
- package/lib/_services/dynamo-nts-email-service-collection.service.js.map +1 -0
- package/lib/_services/dynamo-nts-email.service.d.ts +56 -0
- package/lib/_services/dynamo-nts-email.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-email.service.js +194 -0
- package/lib/_services/dynamo-nts-email.service.js.map +1 -0
- package/lib/_services/dynamo-nts-global.service.d.ts +62 -0
- package/lib/_services/dynamo-nts-global.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-global.service.js +107 -0
- package/lib/_services/dynamo-nts-global.service.js.map +1 -0
- package/lib/_services/dynamo-nts-routing-module.service.d.ts +42 -0
- package/lib/_services/dynamo-nts-routing-module.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-routing-module.service.js +146 -0
- package/lib/_services/dynamo-nts-routing-module.service.js.map +1 -0
- package/lib/_services/dynamo-nts-shared.service.d.ts +26 -0
- package/lib/_services/dynamo-nts-shared.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-shared.service.js +63 -0
- package/lib/_services/dynamo-nts-shared.service.js.map +1 -0
- package/lib/_services/dynamo-nts-singleton.service.d.ts +9 -0
- package/lib/_services/dynamo-nts-singleton.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-singleton.service.js +19 -0
- package/lib/_services/dynamo-nts-singleton.service.js.map +1 -0
- package/lib/_services/dynamobe-email.service.js +1 -1
- package/lib/_services/index.d.ts +13 -13
- package/lib/_services/index.d.ts.map +1 -1
- package/lib/_services/index.js +13 -13
- package/lib/_services/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +995 -319
- package/package.json +2 -6
- package/src/_constants/dynamo-nts-global.settings.ts +12 -0
- package/src/_constants/index.ts +1 -1
- package/src/_enums/{dynamobe-data-service-function.enum.ts → dynamo-nts-data-service-function.enum.ts} +1 -1
- package/src/_enums/{dynamobe-route-security.enum.ts → dynamo-nts-route-security.enum.ts} +1 -1
- package/src/_enums/index.ts +2 -2
- package/src/_models/dynamo-module-settings.ts +2 -2
- package/src/_models/{dynamobe-api-call-params.ts → dynamo-nts-api-call-params.ts} +1 -1
- package/src/_models/{dynamobe-app-params.ts → dynamo-nts-app-params.ts} +1 -1
- package/src/_models/{dynamobe-endpoint-params.ts → dynamo-nts-endpoint-params.ts} +20 -20
- package/src/_models/dynamo-nts-global-settings.ts +13 -0
- package/src/_models/index.ts +4 -5
- package/src/_modules/api-service.index.ts +3 -3
- package/src/_modules/app.index.ts +9 -9
- package/src/_modules/auth.index.ts +2 -2
- package/src/_modules/controller.index.ts +3 -3
- package/src/_modules/data-service.index.ts +4 -4
- package/src/_modules/email.index.ts +2 -2
- package/src/_modules/test/custom-data.service.ts +2 -2
- package/src/_modules/test/get-test-routing-module.ts +5 -5
- package/src/_modules/test/test-controller.ts +10 -10
- package/src/_modules/usage/get-usage-routing-module.ts +5 -5
- package/src/_modules/usage/usage-controller.ts +12 -12
- package/src/_modules/usage/usage.service.ts +6 -6
- package/src/_services/{dynamobe-api.service.ts → dynamo-nts-api.service.ts} +12 -12
- package/src/_services/dynamo-nts-app-extended.ts +124 -0
- package/src/_services/{dynamobe-app.ts → dynamo-nts-app.ts} +49 -49
- package/src/_services/{dynamobe-auth.service.ts → dynamo-nts-auth.service.ts} +2 -2
- package/src/_services/dynamo-nts-controller.service.ts +28 -0
- package/src/_services/{dynamobe-data.service.ts → dynamo-nts-data.service.ts} +7 -7
- package/src/_services/dynamo-nts-db-service-collection.service.ts +12 -0
- package/src/_services/{dynamobe-db.service.ts → dynamo-nts-db.service.ts} +1 -1
- package/src/_services/{dynamobe-email-service-collection.service.ts → dynamo-nts-email-service-collection.service.ts} +4 -4
- package/src/_services/{dynamobe-email.service.ts → dynamo-nts-email.service.ts} +11 -11
- package/src/_services/{dynamobe-global.service.ts → dynamo-nts-global.service.ts} +24 -24
- package/src/_services/{dynamobe-routing-module.service.ts → dynamo-nts-routing-module.service.ts} +26 -26
- package/src/_services/{dynamobe-shared.service.ts → dynamo-nts-shared.service.ts} +1 -1
- package/src/_services/{dynamobe-singleton.service.ts → dynamo-nts-singleton.service.ts} +1 -1
- package/src/_services/index.ts +13 -13
- package/src/_constants/dynamobe-global.settings.ts +0 -12
- package/src/_models/dynamobe-global-settings.ts +0 -13
- package/src/_services/dynamobe-controller.service.ts +0 -28
- package/src/_services/dynamobe-db-service-collection.service.ts +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@futdevpro/nts-dynamo",
|
|
3
|
-
"version": "01.05.
|
|
3
|
+
"version": "01.05.31",
|
|
4
4
|
"description": "Dynamic NodeTS (NodeJS-Typescript), MongoDB Backend System Framework by Future Development Ltd.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npx tsc",
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"types": "./lib/_services/index.d.ts",
|
|
42
42
|
"typings": "./lib/_services/index.d.ts"
|
|
43
43
|
},
|
|
44
|
-
|
|
45
44
|
"./test-module": {
|
|
46
45
|
"default": "./lib/_modules/test/index.js",
|
|
47
46
|
"module": "./lib/_modules/test/index.js",
|
|
@@ -54,7 +53,6 @@
|
|
|
54
53
|
"types": "./lib/_modules/usage/index.d.ts",
|
|
55
54
|
"typings": "./lib/_modules/usage/index.d.ts"
|
|
56
55
|
},
|
|
57
|
-
|
|
58
56
|
"./app": {
|
|
59
57
|
"default": "./lib/_modules/app.index.js",
|
|
60
58
|
"module": "./lib/_modules/app.index.js",
|
|
@@ -112,14 +110,12 @@
|
|
|
112
110
|
"services": [
|
|
113
111
|
"lib/_services/index.d.ts"
|
|
114
112
|
],
|
|
115
|
-
|
|
116
113
|
"test-module": [
|
|
117
114
|
"lib/_modules/test/index.d.ts"
|
|
118
115
|
],
|
|
119
116
|
"usage-module": [
|
|
120
117
|
"lib/_modules/usage/index.d.ts"
|
|
121
118
|
],
|
|
122
|
-
|
|
123
119
|
"app": [
|
|
124
120
|
"lib/_modules/app.index.d.ts"
|
|
125
121
|
],
|
|
@@ -163,7 +159,6 @@
|
|
|
163
159
|
"homepage": "https:/futdevpro.hu/projects/dynamo",
|
|
164
160
|
"peerDependencies": {
|
|
165
161
|
"@futdevpro/fsm-dynamo": "^1.5.23",
|
|
166
|
-
|
|
167
162
|
"@types/express": "^4.17.7",
|
|
168
163
|
"@types/geoip-lite": "^1.4.1",
|
|
169
164
|
"@types/nodemailer": "^6.4.4",
|
|
@@ -176,6 +171,7 @@
|
|
|
176
171
|
},
|
|
177
172
|
"dependencies": {
|
|
178
173
|
"@types/node": "~14.0.27",
|
|
174
|
+
"socket.io": "^4.5.2",
|
|
179
175
|
"ts-node": "~8.10.2",
|
|
180
176
|
"tslib": "~2.0.1",
|
|
181
177
|
"typescript": "~3.9.7"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
import { DynamoNTS_RouteSecurity } from '../_enums/dynamo-nts-route-security.enum';
|
|
3
|
+
import { DynamoNTS_GlobalSettings } from '../_models/dynamo-nts-global-settings';
|
|
4
|
+
|
|
5
|
+
export const dynamoNTS_GlobalSettings: DynamoNTS_GlobalSettings = {
|
|
6
|
+
baseUrl: '/api',
|
|
7
|
+
defaultRouteSecurity: DynamoNTS_RouteSecurity.open,
|
|
8
|
+
logSetup: false,
|
|
9
|
+
logRequests: true,
|
|
10
|
+
logRequestsContent: true,
|
|
11
|
+
logResponseContent: false,
|
|
12
|
+
};
|
package/src/_constants/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './dynamo-nts-global.settings';
|
package/src/_enums/index.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
// ENUMS
|
|
4
4
|
export * from './data-model-type.enum';
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
5
|
+
export * from './dynamo-nts-data-service-function.enum';
|
|
6
|
+
export * from './dynamo-nts-route-security.enum';
|
|
7
7
|
export * from './predefined-data-types.enum';
|
|
8
8
|
// HTTP ENUMS
|
|
9
9
|
export * from './http/http-call-type.enum';
|
|
@@ -2,7 +2,7 @@
|
|
|
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
|
-
export class
|
|
5
|
+
export class DynamoNTS_ApiCallParams {
|
|
6
6
|
name: string;
|
|
7
7
|
type: HttpCallType;
|
|
8
8
|
baseUrl: string;
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
import { NextFunction, Request, Response } from 'express';
|
|
4
4
|
|
|
5
5
|
import { HttpCallType } from '../_enums/http/http-call-type.enum';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { DynamoNTS_RouteSecurity } from '../_enums/dynamo-nts-route-security.enum';
|
|
7
|
+
import { DynamoNTS_Shared } from '../_services/dynamo-nts-shared.service';
|
|
8
|
+
import { DynamoNTS_GlobalService } from '../_services/dynamo-nts-global.service';
|
|
9
|
+
import { dynamoNTS_GlobalSettings } from '../_constants';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
*
|
|
13
13
|
*/
|
|
14
|
-
export class
|
|
14
|
+
export class DynamoNTS_EndpointParams{
|
|
15
15
|
name: string;
|
|
16
|
-
security:
|
|
16
|
+
security: DynamoNTS_RouteSecurity;
|
|
17
17
|
|
|
18
18
|
type: HttpCallType;
|
|
19
19
|
endpoint: string;
|
|
@@ -30,7 +30,7 @@ export class DynamoBEEndpointParams{
|
|
|
30
30
|
constructor(
|
|
31
31
|
set: {
|
|
32
32
|
name: string,
|
|
33
|
-
security?:
|
|
33
|
+
security?: DynamoNTS_RouteSecurity,
|
|
34
34
|
|
|
35
35
|
type: HttpCallType,
|
|
36
36
|
endpoint: string,
|
|
@@ -45,7 +45,7 @@ export class DynamoBEEndpointParams{
|
|
|
45
45
|
) {
|
|
46
46
|
try {
|
|
47
47
|
this.name = set.name ? set.name : set.endpoint;
|
|
48
|
-
this.security = set.security ? set.security :
|
|
48
|
+
this.security = set.security ? set.security : dynamoNTS_GlobalSettings.defaultRouteSecurity;
|
|
49
49
|
|
|
50
50
|
this.type = set.type;
|
|
51
51
|
this.endpoint = set.endpoint;
|
|
@@ -58,15 +58,15 @@ export class DynamoBEEndpointParams{
|
|
|
58
58
|
this.preProcessess = set.preProcessess ? set.preProcessess : [];
|
|
59
59
|
this.tasks = set.tasks;
|
|
60
60
|
|
|
61
|
-
this.logRequest = set.logRequest !== undefined ? set.logRequest :
|
|
62
|
-
this.logRequestsContent = set.logRequestsContent !== undefined ? set.logRequestsContent :
|
|
63
|
-
this.logResponseContent = set.logResponseContent !== undefined ? set.logResponseContent :
|
|
61
|
+
this.logRequest = set.logRequest !== undefined ? set.logRequest : dynamoNTS_GlobalSettings.logRequests;
|
|
62
|
+
this.logRequestsContent = set.logRequestsContent !== undefined ? set.logRequestsContent : dynamoNTS_GlobalSettings.logRequestsContent;
|
|
63
|
+
this.logResponseContent = set.logResponseContent !== undefined ? set.logResponseContent : dynamoNTS_GlobalSettings.logResponseContent;
|
|
64
64
|
|
|
65
65
|
if (this.logRequest) {
|
|
66
66
|
this.preProcessess.unshift(this.getPreLog());
|
|
67
67
|
}
|
|
68
68
|
} catch (error) {
|
|
69
|
-
|
|
69
|
+
DynamoNTS_Shared.logError(
|
|
70
70
|
`\nEndpoint params setup failed: ${set.name} (${set.security}): ${set.endpoint}`, error);
|
|
71
71
|
throw error;
|
|
72
72
|
}
|
|
@@ -113,7 +113,7 @@ export class DynamoBEEndpointParams{
|
|
|
113
113
|
getTasksExecution(): (req: Request, res: Response) => Promise<void> {
|
|
114
114
|
return async (req: Request, res: Response) => {
|
|
115
115
|
try {
|
|
116
|
-
const issuer: string =
|
|
116
|
+
const issuer: string = DynamoNTS_GlobalService.getAuthService().getAccountIdFromRequest(req);
|
|
117
117
|
|
|
118
118
|
for (let i = 0; i < this.tasks.length; i++) {
|
|
119
119
|
await this.tasks[i](req, res, issuer);
|
|
@@ -121,10 +121,10 @@ export class DynamoBEEndpointParams{
|
|
|
121
121
|
|
|
122
122
|
if (this.logRequest) {
|
|
123
123
|
if (this.logResponseContent) {
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
DynamoNTS_Shared.logSuccess(` <<<===== ${this.name} result sent.`);
|
|
125
|
+
DynamoNTS_Shared.logSuccess('sorry, the logResponseContent is not implemented yet.');
|
|
126
126
|
} else {
|
|
127
|
-
|
|
127
|
+
DynamoNTS_Shared.logSuccess(` <<<===== ${this.name} result sent.`);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
} catch (error) {
|
|
@@ -139,16 +139,16 @@ export class DynamoBEEndpointParams{
|
|
|
139
139
|
* @param error
|
|
140
140
|
*/
|
|
141
141
|
error(res: Response, error): void {
|
|
142
|
-
|
|
142
|
+
DynamoNTS_Shared.logError(`${this.name} ERROR`, error, '\n');
|
|
143
143
|
res.status(error.status ? error.status : 501);
|
|
144
144
|
res.send(error);
|
|
145
145
|
|
|
146
146
|
if (this.logRequest) {
|
|
147
147
|
if (this.logResponseContent) {
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
DynamoNTS_Shared.logError(` <<<===== ${this.name} error sent.`);
|
|
149
|
+
DynamoNTS_Shared.logError('sorry, the logResponseContent is not implemented yet.');
|
|
150
150
|
} else {
|
|
151
|
-
|
|
151
|
+
DynamoNTS_Shared.logError(` <<<===== ${this.name} error sent.`);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DynamoNTS_RouteSecurity } from '../_enums/dynamo-nts-route-security.enum';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export interface DynamoNTS_GlobalSettings {
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
defaultRouteSecurity: DynamoNTS_RouteSecurity;
|
|
9
|
+
logSetup?: boolean;
|
|
10
|
+
logRequests?: boolean;
|
|
11
|
+
logRequestsContent?: boolean;
|
|
12
|
+
logResponseContent?: boolean;
|
|
13
|
+
}
|
package/src/_models/index.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
// MODELS
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './dynamobe-global-settings';
|
|
4
|
+
export * from './dynamo-nts-api-call-params';
|
|
5
|
+
export * from './dynamo-nts-app-params';
|
|
6
|
+
export * from './dynamo-nts-endpoint-params';
|
|
7
|
+
export * from './dynamo-nts-global-settings';
|
|
9
8
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
// SERVICES
|
|
3
|
-
export * from '../_services/
|
|
4
|
-
export * from '../_services/
|
|
3
|
+
export * from '../_services/dynamo-nts-api.service';
|
|
4
|
+
export * from '../_services/dynamo-nts-singleton.service';
|
|
5
5
|
|
|
6
6
|
// MODELS
|
|
7
|
-
export * from '../_models/
|
|
7
|
+
export * from '../_models/dynamo-nts-api-call-params';
|
|
8
8
|
export * from '@futdevpro/fsm-dynamo/error-module';
|
|
9
9
|
|
|
10
10
|
// ENUMS
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
|
|
2
2
|
// SERVICES
|
|
3
|
-
export * from '../_services/
|
|
4
|
-
export * from '../_services/
|
|
5
|
-
export * from '../_services/
|
|
6
|
-
export * from '../_services/
|
|
3
|
+
export * from '../_services/dynamo-nts-app';
|
|
4
|
+
export * from '../_services/dynamo-nts-global.service';
|
|
5
|
+
export * from '../_services/dynamo-nts-routing-module.service';
|
|
6
|
+
export * from '../_services/dynamo-nts-shared.service';
|
|
7
7
|
|
|
8
8
|
// MODELS
|
|
9
|
-
export * from '../_models/
|
|
10
|
-
export * from '../_models/
|
|
11
|
-
export * from '../_models/
|
|
9
|
+
export * from '../_models/dynamo-nts-app-params';
|
|
10
|
+
export * from '../_models/dynamo-nts-endpoint-params';
|
|
11
|
+
export * from '../_models/dynamo-nts-global-settings';
|
|
12
12
|
|
|
13
13
|
// ENUMS
|
|
14
|
-
export * from '../_enums/
|
|
14
|
+
export * from '../_enums/dynamo-nts-route-security.enum';
|
|
15
15
|
|
|
16
16
|
// CONSTANTS
|
|
17
|
-
export * from '../_constants/
|
|
17
|
+
export * from '../_constants/dynamo-nts-global.settings';
|
|
18
18
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
// SERVICES
|
|
3
|
-
export * from '../_services/
|
|
4
|
-
export * from '../_services/
|
|
3
|
+
export * from '../_services/dynamo-nts-auth.service';
|
|
4
|
+
export * from '../_services/dynamo-nts-shared.service';
|
|
5
5
|
|
|
6
6
|
// MODELS
|
|
7
7
|
export * from '@futdevpro/fsm-dynamo/error-module';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
// SERVICES
|
|
3
|
-
export * from '../_services/
|
|
3
|
+
export * from '../_services/dynamo-nts-controller.service';
|
|
4
4
|
|
|
5
5
|
// MODELS
|
|
6
|
-
export * from '../_models/
|
|
6
|
+
export * from '../_models/dynamo-nts-endpoint-params';
|
|
7
7
|
|
|
8
8
|
// ENUMS
|
|
9
|
-
export * from '../_enums/
|
|
9
|
+
export * from '../_enums/dynamo-nts-route-security.enum';
|
|
10
10
|
export * from '../_enums/http/http-call-type.enum';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
// SERVICES
|
|
3
|
-
export * from '../_services/
|
|
4
|
-
export * from '../_services/
|
|
5
|
-
export * from '../_services/
|
|
6
|
-
export * from '../_services/
|
|
3
|
+
export * from '../_services/dynamo-nts-data.service';
|
|
4
|
+
export * from '../_services/dynamo-nts-db.service';
|
|
5
|
+
export * from '../_services/dynamo-nts-global.service';
|
|
6
|
+
export * from '../_services/dynamo-nts-shared.service';
|
|
7
7
|
|
|
8
8
|
// MODELS
|
|
9
9
|
export * from '@futdevpro/fsm-dynamo/error-module';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
// SERVICES
|
|
3
|
-
export * from '../_services/
|
|
4
|
-
export * from '../_services/
|
|
3
|
+
export * from '../_services/dynamo-nts-email.service';
|
|
4
|
+
export * from '../_services/dynamo-nts-email-service-collection.service';
|
|
5
5
|
|
|
6
6
|
// MODELS
|
|
7
7
|
export * from '@futdevpro/fsm-dynamo/error-module';
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
import { CustomData, customDataModelParams } from '@futdevpro/fsm-dynamo/test-module';
|
|
5
|
-
import {
|
|
5
|
+
import { DynamoNTS_DataService } from '../../_services/dynamo-nts-data.service';
|
|
6
6
|
|
|
7
|
-
export class CustomDataService extends
|
|
7
|
+
export class CustomDataService extends DynamoNTS_DataService<CustomData> {
|
|
8
8
|
|
|
9
9
|
constructor(
|
|
10
10
|
customData?: CustomData,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
import { testModuleSettings } from '@futdevpro/fsm-dynamo/test-module';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { DynamoNTS_RouteSecurity } from '../../_enums/dynamo-nts-route-security.enum';
|
|
4
|
+
import { DynamoNTS_RoutingModule, DynamoNTS_RoutingModuleSettings } from '../../_services/dynamo-nts-routing-module.service';
|
|
5
5
|
import { TestController } from './test-controller';
|
|
6
6
|
|
|
7
|
-
export function getTestRoutingModule(securityOverride?:
|
|
8
|
-
const set:
|
|
7
|
+
export function getTestRoutingModule(securityOverride?: DynamoNTS_RouteSecurity): DynamoNTS_RoutingModule {
|
|
8
|
+
const set: DynamoNTS_RoutingModuleSettings = {
|
|
9
9
|
route: testModuleSettings.mainRoute,
|
|
10
10
|
controllers: [ TestController.getInstance() ]
|
|
11
11
|
}
|
|
12
12
|
if (securityOverride) {
|
|
13
13
|
set.securityOverride = securityOverride;
|
|
14
14
|
}
|
|
15
|
-
return new
|
|
15
|
+
return new DynamoNTS_RoutingModule(set);
|
|
16
16
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
3
|
import { testModuleSettings } from '@futdevpro/fsm-dynamo/test-module';
|
|
4
4
|
import { HttpCallType } from '../../_enums/http/http-call-type.enum';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { DynamoNTS_EndpointParams } from '../../_models/dynamo-nts-endpoint-params';
|
|
6
|
+
import { DynamoNTS_Controller } from '../../_services/dynamo-nts-controller.service';
|
|
7
7
|
import { CustomDataService } from './custom-data.service';
|
|
8
8
|
|
|
9
|
-
export class TestController extends
|
|
9
|
+
export class TestController extends DynamoNTS_Controller {
|
|
10
10
|
|
|
11
11
|
static getInstance(): TestController {
|
|
12
12
|
return TestController.getSingletonInstance();
|
|
@@ -15,7 +15,7 @@ export class TestController extends DynamoBEController {
|
|
|
15
15
|
setupEndpoints(): void {
|
|
16
16
|
this.endpoints = [
|
|
17
17
|
// TESTS
|
|
18
|
-
new
|
|
18
|
+
new DynamoNTS_EndpointParams({
|
|
19
19
|
name: 'testGet',
|
|
20
20
|
type: HttpCallType.get,
|
|
21
21
|
endpoint: testModuleSettings.endPoints.testGet,
|
|
@@ -30,7 +30,7 @@ export class TestController extends DynamoBEController {
|
|
|
30
30
|
]
|
|
31
31
|
}),
|
|
32
32
|
|
|
33
|
-
new
|
|
33
|
+
new DynamoNTS_EndpointParams({
|
|
34
34
|
name: 'testPost',
|
|
35
35
|
type: HttpCallType.post,
|
|
36
36
|
endpoint: testModuleSettings.endPoints.testPost,
|
|
@@ -45,7 +45,7 @@ export class TestController extends DynamoBEController {
|
|
|
45
45
|
]
|
|
46
46
|
}),
|
|
47
47
|
|
|
48
|
-
new
|
|
48
|
+
new DynamoNTS_EndpointParams({
|
|
49
49
|
name: 'testPut',
|
|
50
50
|
type: HttpCallType.put,
|
|
51
51
|
endpoint: testModuleSettings.endPoints.testPut,
|
|
@@ -60,7 +60,7 @@ export class TestController extends DynamoBEController {
|
|
|
60
60
|
]
|
|
61
61
|
}),
|
|
62
62
|
|
|
63
|
-
new
|
|
63
|
+
new DynamoNTS_EndpointParams({
|
|
64
64
|
name: 'testPatch',
|
|
65
65
|
type: HttpCallType.patch,
|
|
66
66
|
endpoint: testModuleSettings.endPoints.testPatch,
|
|
@@ -75,7 +75,7 @@ export class TestController extends DynamoBEController {
|
|
|
75
75
|
]
|
|
76
76
|
}),
|
|
77
77
|
|
|
78
|
-
new
|
|
78
|
+
new DynamoNTS_EndpointParams({
|
|
79
79
|
name: 'testDelete',
|
|
80
80
|
type: HttpCallType.delete,
|
|
81
81
|
endpoint: testModuleSettings.endPoints.testDelete,
|
|
@@ -91,7 +91,7 @@ export class TestController extends DynamoBEController {
|
|
|
91
91
|
}),
|
|
92
92
|
|
|
93
93
|
// CUSTOM DATA
|
|
94
|
-
new
|
|
94
|
+
new DynamoNTS_EndpointParams({
|
|
95
95
|
name: 'getCustomData',
|
|
96
96
|
type: HttpCallType.get,
|
|
97
97
|
endpoint: testModuleSettings.endPoints.getCustomData,
|
|
@@ -111,7 +111,7 @@ export class TestController extends DynamoBEController {
|
|
|
111
111
|
]
|
|
112
112
|
}),
|
|
113
113
|
|
|
114
|
-
new
|
|
114
|
+
new DynamoNTS_EndpointParams({
|
|
115
115
|
name: 'modifyCustomData',
|
|
116
116
|
type: HttpCallType.post,
|
|
117
117
|
endpoint: testModuleSettings.endPoints.modifyCustomData,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
import { usageModuleSettings } from '@futdevpro/fsm-dynamo/usage-module';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { DynamoNTS_RouteSecurity } from '../../_enums/dynamo-nts-route-security.enum';
|
|
4
|
+
import { DynamoNTS_RoutingModule, DynamoNTS_RoutingModuleSettings } from '../../_services/dynamo-nts-routing-module.service';
|
|
5
5
|
import { UsageController } from './usage-controller';
|
|
6
6
|
|
|
7
|
-
export function getUsageRoutingModule(securityOverride?:
|
|
8
|
-
const set:
|
|
7
|
+
export function getUsageRoutingModule(securityOverride?: DynamoNTS_RouteSecurity): DynamoNTS_RoutingModule {
|
|
8
|
+
const set: DynamoNTS_RoutingModuleSettings = {
|
|
9
9
|
route: usageModuleSettings.mainRoute,
|
|
10
10
|
controllers: [ UsageController.getInstance() ]
|
|
11
11
|
}
|
|
12
12
|
if (securityOverride) {
|
|
13
13
|
set.securityOverride = securityOverride;
|
|
14
14
|
}
|
|
15
|
-
return new
|
|
15
|
+
return new DynamoNTS_RoutingModule(set);
|
|
16
16
|
}
|
|
@@ -2,32 +2,32 @@
|
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
3
|
import { usageModuleSettings, DynamoUsageSession } from '@futdevpro/fsm-dynamo/usage-module';
|
|
4
4
|
import { HttpCallType } from '../../_enums/http/http-call-type.enum';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { DynamoNTS_EndpointParams } from '../../_models/dynamo-nts-endpoint-params';
|
|
6
|
+
import { DynamoNTS_AuthService } from '../../_services/dynamo-nts-auth.service';
|
|
7
|
+
import { DynamoNTS_Controller } from '../../_services/dynamo-nts-controller.service';
|
|
8
|
+
import { DynamoNTS_GlobalService } from '../../_services/dynamo-nts-global.service';
|
|
9
9
|
import { UsageService } from './usage.service';
|
|
10
10
|
|
|
11
|
-
export class UsageController extends
|
|
11
|
+
export class UsageController extends DynamoNTS_Controller {
|
|
12
12
|
|
|
13
13
|
static getInstance(): UsageController {
|
|
14
14
|
return UsageController.getSingletonInstance();
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
// SERVICES
|
|
18
|
-
private authService:
|
|
18
|
+
private authService: DynamoNTS_AuthService;
|
|
19
19
|
|
|
20
20
|
setupEndpoints(): void {
|
|
21
|
-
this.authService =
|
|
21
|
+
this.authService = DynamoNTS_GlobalService.getAuthService();
|
|
22
22
|
|
|
23
23
|
this.endpoints = [
|
|
24
|
-
new
|
|
24
|
+
new DynamoNTS_EndpointParams({
|
|
25
25
|
name: 'newSession',
|
|
26
26
|
type: HttpCallType.get,
|
|
27
27
|
endpoint: usageModuleSettings.endPoints.newSession,
|
|
28
28
|
tasks: [
|
|
29
29
|
async (req: Request, res: Response, issuer: string) => {
|
|
30
|
-
const authService =
|
|
30
|
+
const authService = DynamoNTS_GlobalService.getAuthService();
|
|
31
31
|
const username = authService.getUsernameFromRequest(req);
|
|
32
32
|
const usageService = new UsageService({
|
|
33
33
|
usageSession: new DynamoUsageSession({
|
|
@@ -47,7 +47,7 @@ export class UsageController extends DynamoBEController {
|
|
|
47
47
|
]
|
|
48
48
|
}),
|
|
49
49
|
|
|
50
|
-
new
|
|
50
|
+
new DynamoNTS_EndpointParams({
|
|
51
51
|
name: 'updateUsage',
|
|
52
52
|
type: HttpCallType.post,
|
|
53
53
|
endpoint: usageModuleSettings.endPoints.updateUsage,
|
|
@@ -69,7 +69,7 @@ export class UsageController extends DynamoBEController {
|
|
|
69
69
|
]
|
|
70
70
|
}),
|
|
71
71
|
|
|
72
|
-
new
|
|
72
|
+
new DynamoNTS_EndpointParams({
|
|
73
73
|
name: 'closeSession',
|
|
74
74
|
type: HttpCallType.get,
|
|
75
75
|
endpoint: usageModuleSettings.endPoints.closeSession,
|
|
@@ -90,7 +90,7 @@ export class UsageController extends DynamoBEController {
|
|
|
90
90
|
]
|
|
91
91
|
}),
|
|
92
92
|
|
|
93
|
-
new
|
|
93
|
+
new DynamoNTS_EndpointParams({
|
|
94
94
|
name: 'getAllUsageData',
|
|
95
95
|
type: HttpCallType.get,
|
|
96
96
|
endpoint: usageModuleSettings.endPoints.getAllUsageData,
|
|
@@ -4,10 +4,10 @@ import { DynamoBEError } from '@futdevpro/fsm-dynamo';
|
|
|
4
4
|
import { DynamoUsageSession, usageSessionModelParams, DynamoUsageData,
|
|
5
5
|
DailyUsageData } from '@futdevpro/fsm-dynamo/usage-module';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { DynamoNTS_DataService } from '../../_services/dynamo-nts-data.service';
|
|
8
|
+
import { DynamoNTS_Shared } from '../../_services/dynamo-nts-shared.service';
|
|
9
9
|
|
|
10
|
-
export class UsageService extends
|
|
10
|
+
export class UsageService extends DynamoNTS_DataService<DynamoUsageSession> {
|
|
11
11
|
usageData: DynamoUsageData[] = [];
|
|
12
12
|
simplifiedDailyUsage: DailyUsageData[] = [];
|
|
13
13
|
|
|
@@ -28,8 +28,8 @@ export class UsageService extends DynamoBEDataService<DynamoUsageSession> {
|
|
|
28
28
|
|
|
29
29
|
getLocationDataFromRequest(req: Request): void {
|
|
30
30
|
try {
|
|
31
|
-
this.data.address =
|
|
32
|
-
this.data.locationData =
|
|
31
|
+
this.data.address = DynamoNTS_Shared.getIpFromRequest(req);
|
|
32
|
+
this.data.locationData = DynamoNTS_Shared.getLocationDataByRequest(req);
|
|
33
33
|
|
|
34
34
|
/* console.log(`...getLocationDataFromRequest... ip: ${this.data.address}`, this.data.locationData); */
|
|
35
35
|
} catch (error) {
|
|
@@ -44,7 +44,7 @@ export class UsageService extends DynamoBEDataService<DynamoUsageSession> {
|
|
|
44
44
|
async getLastWeekUsage(): Promise<void> {
|
|
45
45
|
try {
|
|
46
46
|
await this.dataDBService.find({
|
|
47
|
-
sessionStart: { $gte:
|
|
47
|
+
sessionStart: { $gte: DynamoNTS_Shared.oneWeekAgo() }
|
|
48
48
|
}).then((res: DynamoUsageSession[]) => {
|
|
49
49
|
this.dataList = res;
|
|
50
50
|
});
|