@futdevpro/nts-dynamo 1.5.30 → 1.5.32
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 +10 -10
- 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-db.service.js +1 -1
- 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 +1041 -365
- package/package.json +4 -7
- 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 +11 -11
- package/src/_services/{dynamobe-api.service.ts → dynamo-nts-api.service.ts} +16 -16
- 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} +5 -5
- package/src/_services/dynamo-nts-controller.service.ts +28 -0
- package/src/_services/{dynamobe-data.service.ts → dynamo-nts-data.service.ts} +29 -29
- package/src/_services/dynamo-nts-db-service-collection.service.ts +12 -0
- package/src/_services/{dynamobe-db.service.ts → dynamo-nts-db.service.ts} +33 -33
- 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} +16 -16
- package/src/_services/{dynamobe-global.service.ts → dynamo-nts-global.service.ts} +27 -27
- package/src/_services/{dynamobe-routing-module.service.ts → dynamo-nts-routing-module.service.ts} +30 -30
- package/src/_services/{dynamobe-shared.service.ts → dynamo-nts-shared.service.ts} +2 -2
- 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
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import { Metadata,
|
|
3
|
+
import { Metadata, DynamoNTS_DataParams } from '@futdevpro/fsm-dynamo';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
5
|
+
import { DynamoNTS_AuthService } from './dynamo-nts-auth.service';
|
|
6
|
+
import { DynamoNTS_DBServiceCollection } from './dynamo-nts-db-service-collection.service';
|
|
7
|
+
import { DynamoNTS_DBService } from './dynamo-nts-db.service';
|
|
8
|
+
import { DynamoNTS_EmailServiceCollection } from './dynamo-nts-email-service-collection.service';
|
|
9
|
+
import { DynamoNTS_Shared } from './dynamo-nts-shared.service';
|
|
10
|
+
import { DynamoNTS_SingletonService } from './dynamo-nts-singleton.service';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* This is the main Global/Core Service Collection used by DynamoBE,
|
|
14
14
|
* you also can use this to access main services as
|
|
15
15
|
* dbServices, emailServices, or authService
|
|
16
16
|
*/
|
|
17
|
-
export class
|
|
17
|
+
export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
18
18
|
|
|
19
|
-
static getInstance():
|
|
20
|
-
return
|
|
19
|
+
static getInstance(): DynamoNTS_GlobalService {
|
|
20
|
+
return DynamoNTS_GlobalService.getSingletonInstance();
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
authService:
|
|
24
|
-
dbServiceCollection:
|
|
25
|
-
emailServiceCollection:
|
|
23
|
+
authService: DynamoNTS_AuthService;
|
|
24
|
+
dbServiceCollection: DynamoNTS_DBServiceCollection;
|
|
25
|
+
emailServiceCollection: DynamoNTS_EmailServiceCollection;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* You need to setup global Services through this function
|
|
@@ -32,35 +32,35 @@ export class DBE_Global_S extends DynamoBESingletonService {
|
|
|
32
32
|
/**
|
|
33
33
|
* You need to setup your Own Auth Service extending the DynamoBEAuthService class
|
|
34
34
|
*/
|
|
35
|
-
authService:
|
|
35
|
+
authService: DynamoNTS_AuthService,
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* You can setup your Own Email Service extending the DynamoBEEmailServiceCollection class
|
|
39
39
|
*/
|
|
40
|
-
emailServiceCollection?:
|
|
40
|
+
emailServiceCollection?: DynamoNTS_EmailServiceCollection,
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* you can setup data tables by passing a DynamoBEDataParams list at this point
|
|
44
44
|
*/
|
|
45
|
-
dbModels:
|
|
45
|
+
dbModels: DynamoNTS_DataParams[],
|
|
46
46
|
}
|
|
47
47
|
): void {
|
|
48
48
|
this.getInstance();
|
|
49
49
|
|
|
50
50
|
try {
|
|
51
|
-
this.instance.dbServiceCollection = new
|
|
52
|
-
set.dbModels.forEach((dbModel:
|
|
51
|
+
this.instance.dbServiceCollection = new DynamoNTS_DBServiceCollection();
|
|
52
|
+
set.dbModels.forEach((dbModel: DynamoNTS_DataParams) => {
|
|
53
53
|
try {
|
|
54
|
-
this.instance.dbServiceCollection[dbModel.dataName] = new
|
|
54
|
+
this.instance.dbServiceCollection[dbModel.dataName] = new DynamoNTS_DBService(dbModel);
|
|
55
55
|
} catch (error) {
|
|
56
|
-
|
|
56
|
+
DynamoNTS_Shared.logError(`\nFailed to create DynamoBEDBService (${dbModel.dataName}).\n`, dbModel, `\n`, error);
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
this.instance.authService = set.authService;
|
|
61
61
|
this.instance.emailServiceCollection = set.emailServiceCollection;
|
|
62
62
|
} catch (error) {
|
|
63
|
-
|
|
63
|
+
DynamoNTS_Shared.logError('\nsetServices failed on DBE_Global_S.\n', error);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -68,7 +68,7 @@ export class DBE_Global_S extends DynamoBESingletonService {
|
|
|
68
68
|
*
|
|
69
69
|
* @returns
|
|
70
70
|
*/
|
|
71
|
-
static getAuthService():
|
|
71
|
+
static getAuthService(): DynamoNTS_AuthService {
|
|
72
72
|
if (!this.instance?.authService?.authenticateToken) {
|
|
73
73
|
throw new Error(
|
|
74
74
|
`\nUnique Authentication Service missing!` +
|
|
@@ -82,7 +82,7 @@ export class DBE_Global_S extends DynamoBESingletonService {
|
|
|
82
82
|
*
|
|
83
83
|
* @returns
|
|
84
84
|
*/
|
|
85
|
-
static getDBServiceCollection():
|
|
85
|
+
static getDBServiceCollection(): DynamoNTS_DBServiceCollection {
|
|
86
86
|
if (!this.instance?.dbServiceCollection) {
|
|
87
87
|
throw new Error(
|
|
88
88
|
`\nUnique DataBase Service Collection missing!` +
|
|
@@ -97,7 +97,7 @@ export class DBE_Global_S extends DynamoBESingletonService {
|
|
|
97
97
|
* @param dataParams
|
|
98
98
|
* @returns
|
|
99
99
|
*/
|
|
100
|
-
static getDBService<T extends Metadata>(dataParams:
|
|
100
|
+
static getDBService<T extends Metadata>(dataParams: DynamoNTS_DataParams): DynamoNTS_DBService<T> {
|
|
101
101
|
return this.getDBServiceByKey<T>(dataParams.dataName);
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -106,10 +106,10 @@ export class DBE_Global_S extends DynamoBESingletonService {
|
|
|
106
106
|
* @param key
|
|
107
107
|
* @returns
|
|
108
108
|
*/
|
|
109
|
-
static getDBServiceByKey<T extends Metadata>(key: string):
|
|
109
|
+
static getDBServiceByKey<T extends Metadata>(key: string): DynamoNTS_DBService<T> {
|
|
110
110
|
const collection = this.getDBServiceCollection();
|
|
111
111
|
if (collection[key]) {
|
|
112
|
-
return collection[key] as
|
|
112
|
+
return collection[key] as DynamoNTS_DBService<T>;
|
|
113
113
|
} else {
|
|
114
114
|
let keys: string = `${Object.keys(collection)}`;
|
|
115
115
|
keys = keys.replace(/,/g, '\n ');
|
|
@@ -125,7 +125,7 @@ export class DBE_Global_S extends DynamoBESingletonService {
|
|
|
125
125
|
*
|
|
126
126
|
* @returns
|
|
127
127
|
*/
|
|
128
|
-
static getEmailServiceCollection():
|
|
128
|
+
static getEmailServiceCollection(): DynamoNTS_EmailServiceCollection {
|
|
129
129
|
if (!this.instance?.emailServiceCollection) {
|
|
130
130
|
throw new Error(
|
|
131
131
|
`Unique Email Service Collection missing!` +
|
package/src/_services/{dynamobe-routing-module.service.ts → dynamo-nts-routing-module.service.ts}
RENAMED
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
|
|
2
2
|
import { Router } from 'express';
|
|
3
|
-
import {
|
|
3
|
+
import { DynamoNTS_Error } from '@futdevpro/fsm-dynamo';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { dynamoNTS_GlobalSettings } from '../_constants/dynamo-nts-global.settings';
|
|
6
|
+
import { DynamoNTS_RouteSecurity } from '../_enums/dynamo-nts-route-security.enum';
|
|
7
7
|
import { HttpCallType } from '../_enums/http/http-call-type.enum';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { DynamoNTS_EndpointParams } from '../_models/dynamo-nts-endpoint-params';
|
|
9
|
+
import { DynamoNTS_Controller } from './dynamo-nts-controller.service';
|
|
10
|
+
import { DynamoNTS_Shared } from './dynamo-nts-shared.service';
|
|
11
11
|
|
|
12
|
-
export interface
|
|
12
|
+
export interface DynamoNTS_RoutingModuleSettings {
|
|
13
13
|
route: string;
|
|
14
|
-
controllers:
|
|
15
|
-
securityOverride?:
|
|
14
|
+
controllers: DynamoNTS_Controller[];
|
|
15
|
+
securityOverride?: DynamoNTS_RouteSecurity;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
|
-
export class
|
|
21
|
+
export class DynamoNTS_RoutingModule {
|
|
22
22
|
|
|
23
|
-
security:
|
|
23
|
+
security: DynamoNTS_RouteSecurity;
|
|
24
24
|
route: string;
|
|
25
25
|
|
|
26
|
-
private controllers:
|
|
27
|
-
endpoints:
|
|
26
|
+
private controllers: DynamoNTS_Controller[];
|
|
27
|
+
endpoints: DynamoNTS_EndpointParams[] = [];
|
|
28
28
|
|
|
29
29
|
openRouter: Router = Router();
|
|
30
30
|
secureRouter: Router = Router();
|
|
31
31
|
|
|
32
|
-
protected log: boolean =
|
|
32
|
+
protected log: boolean = dynamoNTS_GlobalSettings.logSetup;
|
|
33
33
|
|
|
34
34
|
constructor(
|
|
35
|
-
set:
|
|
35
|
+
set: DynamoNTS_RoutingModuleSettings
|
|
36
36
|
){
|
|
37
37
|
try {
|
|
38
|
-
this.route =
|
|
38
|
+
this.route = dynamoNTS_GlobalSettings.baseUrl + set.route;
|
|
39
39
|
this.controllers = set.controllers;
|
|
40
40
|
this.setupRoutes();
|
|
41
41
|
this.mountRoutes(set.securityOverride);
|
|
42
42
|
|
|
43
43
|
if (this.log) console.log(`routing module setup done: ${this.route} serurity: ${this.security}\n`);
|
|
44
44
|
} catch (error) {
|
|
45
|
-
|
|
45
|
+
DynamoNTS_Shared.logError(`Routing module setup failed (${this.route})`, error);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -50,7 +50,7 @@ export class DynamoBERoutingModule {
|
|
|
50
50
|
* You must setup endpoints and required services in this function
|
|
51
51
|
*/
|
|
52
52
|
private setupRoutes(): void {
|
|
53
|
-
this.controllers.forEach((controller:
|
|
53
|
+
this.controllers.forEach((controller: DynamoNTS_Controller) => {
|
|
54
54
|
this.endpoints.push(...controller.endpoints);
|
|
55
55
|
});
|
|
56
56
|
}
|
|
@@ -59,24 +59,24 @@ export class DynamoBERoutingModule {
|
|
|
59
59
|
*
|
|
60
60
|
* @param securityOverride
|
|
61
61
|
*/
|
|
62
|
-
private mountRoutes(securityOverride?:
|
|
62
|
+
private mountRoutes(securityOverride?: DynamoNTS_RouteSecurity): void {
|
|
63
63
|
if (securityOverride) {
|
|
64
64
|
this.security = securityOverride;
|
|
65
65
|
}
|
|
66
|
-
this.endpoints.forEach((endpoint:
|
|
66
|
+
this.endpoints.forEach((endpoint: DynamoNTS_EndpointParams) => {
|
|
67
67
|
if (securityOverride) {
|
|
68
68
|
endpoint.security = securityOverride;
|
|
69
69
|
} else {
|
|
70
70
|
if (!this.security) {
|
|
71
71
|
this.security = endpoint.security;
|
|
72
72
|
} else if (this.security !== endpoint.security) {
|
|
73
|
-
this.security =
|
|
73
|
+
this.security = DynamoNTS_RouteSecurity.both;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
if (this.log) console.log(`endpoint mount (${endpoint.security}): ${this.route}${endpoint.endpoint}`);
|
|
78
|
-
const existingEndPoints:
|
|
79
|
-
(ep:
|
|
78
|
+
const existingEndPoints: DynamoNTS_EndpointParams[] = this.endpoints.filter(
|
|
79
|
+
(ep: DynamoNTS_EndpointParams) => ep.endpoint === endpoint.endpoint);
|
|
80
80
|
if (1 < existingEndPoints.length) {
|
|
81
81
|
let error = new Error(`ENDPOINT DUPLICATION: ${endpoint.endpoint}`);
|
|
82
82
|
let errorStack: string[] = error.stack.split('\n');
|
|
@@ -87,14 +87,14 @@ export class DynamoBERoutingModule {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
try {
|
|
90
|
-
if (endpoint.security !==
|
|
90
|
+
if (endpoint.security !== DynamoNTS_RouteSecurity.secure) {
|
|
91
91
|
this.mountOpenRoute(endpoint);
|
|
92
92
|
}
|
|
93
|
-
if (endpoint.security !==
|
|
93
|
+
if (endpoint.security !== DynamoNTS_RouteSecurity.open) {
|
|
94
94
|
this.mountSecureRoute(endpoint);
|
|
95
95
|
}
|
|
96
96
|
} catch (error) {
|
|
97
|
-
throw new
|
|
97
|
+
throw new DynamoNTS_Error({
|
|
98
98
|
message: `DYNAMOBEERROR: Failed to mount routes.`,
|
|
99
99
|
userMessage: `We encountered an uncought BackEnd Build Error, please contact the responsible development team. errorcode: 900-456-100`,
|
|
100
100
|
error
|
|
@@ -107,7 +107,7 @@ export class DynamoBERoutingModule {
|
|
|
107
107
|
*
|
|
108
108
|
* @param endpointParams
|
|
109
109
|
*/
|
|
110
|
-
private mountOpenRoute(endpointParams:
|
|
110
|
+
private mountOpenRoute(endpointParams: DynamoNTS_EndpointParams): void {
|
|
111
111
|
switch(endpointParams.type) {
|
|
112
112
|
case HttpCallType.get:
|
|
113
113
|
this.openRouter.get(endpointParams.endpoint,
|
|
@@ -130,7 +130,7 @@ export class DynamoBERoutingModule {
|
|
|
130
130
|
endpointParams.preProcessess, endpointParams.getTasksExecution());
|
|
131
131
|
break;
|
|
132
132
|
default:
|
|
133
|
-
throw new
|
|
133
|
+
throw new DynamoNTS_Error({
|
|
134
134
|
message: `DYNAMOBEERROR: INVALID route type: ${endpointParams.type} - ${endpointParams.name}` ,
|
|
135
135
|
userMessage: `We encountered an uncought BackEnd Build Error, please contact the responsible development team. errorcode: 900-456-200`,
|
|
136
136
|
error: new Error()
|
|
@@ -142,7 +142,7 @@ export class DynamoBERoutingModule {
|
|
|
142
142
|
*
|
|
143
143
|
* @param endpointParams
|
|
144
144
|
*/
|
|
145
|
-
private mountSecureRoute(endpointParams:
|
|
145
|
+
private mountSecureRoute(endpointParams: DynamoNTS_EndpointParams): void {
|
|
146
146
|
switch(endpointParams.type) {
|
|
147
147
|
case HttpCallType.get:
|
|
148
148
|
this.secureRouter.get(endpointParams.endpoint,
|
|
@@ -165,7 +165,7 @@ export class DynamoBERoutingModule {
|
|
|
165
165
|
endpointParams.preProcessess, endpointParams.getTasksExecution());
|
|
166
166
|
break;
|
|
167
167
|
default:
|
|
168
|
-
throw new
|
|
168
|
+
throw new DynamoNTS_Error({
|
|
169
169
|
message: `DYNAMOBEERROR: INVALID route type: ${endpointParams.type} - ${endpointParams.name}`,
|
|
170
170
|
userMessage: `We encountered an uncought BackEnd Build Error, please contact the responsible development team. errorcode: 900-456-300`,
|
|
171
171
|
error: new Error()
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import * as ReadLine from 'readline';
|
|
3
3
|
import { Request } from 'express';
|
|
4
4
|
import * as GeoIp from 'geoip-lite';
|
|
5
|
-
import { GeoIpLocation,
|
|
5
|
+
import { GeoIpLocation, Dynamo_Shared } from '@futdevpro/fsm-dynamo/shared-service';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
|
-
export class
|
|
10
|
+
export class DynamoNTS_Shared extends Dynamo_Shared {
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
*
|
package/src/_services/index.ts
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
// SERVICES
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './
|
|
16
|
-
export * from './
|
|
17
|
-
export * from './
|
|
5
|
+
export * from './dynamo-nts-api.service';
|
|
6
|
+
export * from './dynamo-nts-app';
|
|
7
|
+
export * from './dynamo-nts-auth.service';
|
|
8
|
+
export * from './dynamo-nts-controller.service';
|
|
9
|
+
export * from './dynamo-nts-data.service';
|
|
10
|
+
export * from './dynamo-nts-db-service-collection.service';
|
|
11
|
+
export * from './dynamo-nts-db.service';
|
|
12
|
+
export * from './dynamo-nts-email-service-collection.service';
|
|
13
|
+
export * from './dynamo-nts-email.service';
|
|
14
|
+
export * from './dynamo-nts-global.service';
|
|
15
|
+
export * from './dynamo-nts-routing-module.service';
|
|
16
|
+
export * from './dynamo-nts-shared.service';
|
|
17
|
+
export * from './dynamo-nts-singleton.service';
|
|
18
18
|
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { DynamoBERouteSecurity } from '../_enums/dynamobe-route-security.enum';
|
|
3
|
-
import { DynamoBEGlobalSettings } from '../_models/dynamobe-global-settings';
|
|
4
|
-
|
|
5
|
-
export const dynamoBEGlobalSettings: DynamoBEGlobalSettings = {
|
|
6
|
-
baseUrl: '/api',
|
|
7
|
-
defaultRouteSecurity: DynamoBERouteSecurity.open,
|
|
8
|
-
logSetup: false,
|
|
9
|
-
logRequests: true,
|
|
10
|
-
logRequestsContent: true,
|
|
11
|
-
logResponseContent: false,
|
|
12
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DynamoBERouteSecurity } from '../_enums/dynamobe-route-security.enum';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
export interface DynamoBEGlobalSettings {
|
|
7
|
-
baseUrl: string;
|
|
8
|
-
defaultRouteSecurity: DynamoBERouteSecurity;
|
|
9
|
-
logSetup?: boolean;
|
|
10
|
-
logRequests?: boolean;
|
|
11
|
-
logRequestsContent?: boolean;
|
|
12
|
-
logResponseContent?: boolean;
|
|
13
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { DynamoBEEndpointParams } from '../_models/dynamobe-endpoint-params';
|
|
4
|
-
import { DBE_Shared } from './dynamobe-shared.service';
|
|
5
|
-
import { DynamoBESingletonService } from './dynamobe-singleton.service';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
export abstract class DynamoBEController extends DynamoBESingletonService {
|
|
11
|
-
|
|
12
|
-
endpoints: DynamoBEEndpointParams[];
|
|
13
|
-
|
|
14
|
-
protected constructor(){
|
|
15
|
-
super();
|
|
16
|
-
|
|
17
|
-
try {
|
|
18
|
-
this.setupEndpoints();
|
|
19
|
-
} catch (error) {
|
|
20
|
-
DBE_Shared.logError(`DynamoBEController ERROR setup failed:`, error);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* You must setup endpoints and required services in this function
|
|
26
|
-
*/
|
|
27
|
-
abstract setupEndpoints(): void
|
|
28
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { DynamoBEDBService } from './dynamobe-db.service';
|
|
3
|
-
import { DynamoBESingletonService } from './dynamobe-singleton.service';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
export class DynamoBEDBServiceCollection extends DynamoBESingletonService {
|
|
9
|
-
|
|
10
|
-
[service: string]: DynamoBEDBService<any>;
|
|
11
|
-
|
|
12
|
-
}
|