@futdevpro/nts-dynamo 1.6.17 → 1.6.19
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/global-settings.const.d.ts +1 -1
- package/lib/_constants/global-settings.const.js +2 -2
- package/lib/_constants/mocks/app-params.mock.d.ts +3 -0
- package/lib/_constants/mocks/app-params.mock.d.ts.map +1 -0
- package/lib/_constants/mocks/app-params.mock.js +10 -0
- package/lib/_constants/mocks/app-params.mock.js.map +1 -0
- package/lib/_constants/mocks/app-server.mock.d.ts +27 -0
- package/lib/_constants/mocks/app-server.mock.d.ts.map +1 -0
- package/lib/_constants/mocks/app-server.mock.js +86 -0
- package/lib/_constants/mocks/app-server.mock.js.map +1 -0
- package/lib/_constants/mocks/auth-service.mock.d.ts +11 -0
- package/lib/_constants/mocks/auth-service.mock.d.ts.map +1 -0
- package/lib/_constants/mocks/auth-service.mock.js +33 -0
- package/lib/_constants/mocks/auth-service.mock.js.map +1 -0
- package/lib/_constants/mocks/controller.mock.d.ts +6 -0
- package/lib/_constants/mocks/controller.mock.d.ts.map +1 -0
- package/lib/_constants/mocks/controller.mock.js +15 -0
- package/lib/_constants/mocks/controller.mock.js.map +1 -0
- package/lib/_constants/mocks/endpoint.mock.d.ts +9 -0
- package/lib/_constants/mocks/endpoint.mock.d.ts.map +1 -0
- package/lib/_constants/mocks/endpoint.mock.js +81 -0
- package/lib/_constants/mocks/endpoint.mock.js.map +1 -0
- package/lib/_constants/mocks/socket-server.mock.d.ts +11 -0
- package/lib/_constants/mocks/socket-server.mock.d.ts.map +1 -0
- package/lib/{_services/socket-server.service.spec.js → _constants/mocks/socket-server.mock.js} +7 -10
- package/lib/_constants/mocks/socket-server.mock.js.map +1 -0
- package/lib/_models/control-models/endpoint-params.control-model.d.ts +3 -1
- package/lib/_models/control-models/endpoint-params.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/endpoint-params.control-model.js +31 -9
- package/lib/_models/control-models/endpoint-params.control-model.js.map +1 -1
- package/lib/_models/control-models/socket-event.control-model.js +3 -3
- package/lib/_models/control-models/socket-server-service-params.control-model.js +1 -1
- package/lib/_models/interfaces/global-service-settings.interface.d.ts +4 -4
- package/lib/_models/interfaces/global-service-settings.interface.d.ts.map +1 -1
- package/lib/_modules/api-service.index.d.ts +2 -2
- package/lib/_modules/api-service.index.d.ts.map +1 -1
- package/lib/_modules/api-service.index.js +2 -2
- package/lib/_modules/api-service.index.js.map +1 -1
- package/lib/_modules/app-extended.index.d.ts +5 -5
- package/lib/_modules/app-extended.index.d.ts.map +1 -1
- package/lib/_modules/app-extended.index.js +5 -5
- package/lib/_modules/app-extended.index.js.map +1 -1
- package/lib/_modules/app.index.d.ts +3 -3
- package/lib/_modules/app.index.d.ts.map +1 -1
- package/lib/_modules/app.index.js +3 -3
- package/lib/_modules/app.index.js.map +1 -1
- package/lib/_modules/auth.index.d.ts +1 -1
- package/lib/_modules/auth.index.d.ts.map +1 -1
- package/lib/_modules/auth.index.js +1 -1
- package/lib/_modules/auth.index.js.map +1 -1
- package/lib/_modules/controller.index.d.ts +1 -1
- package/lib/_modules/controller.index.d.ts.map +1 -1
- package/lib/_modules/controller.index.js +1 -1
- package/lib/_modules/controller.index.js.map +1 -1
- package/lib/_modules/custom-data/custom-data.controller.d.ts +1 -1
- package/lib/_modules/custom-data/custom-data.controller.d.ts.map +1 -1
- package/lib/_modules/custom-data/custom-data.controller.js +1 -1
- package/lib/_modules/custom-data/custom-data.controller.js.map +1 -1
- package/lib/_modules/custom-data/custom-data.data-service.d.ts +1 -1
- package/lib/_modules/custom-data/custom-data.data-service.d.ts.map +1 -1
- package/lib/_modules/custom-data/custom-data.data-service.js +1 -1
- package/lib/_modules/custom-data/custom-data.data-service.js.map +1 -1
- package/lib/_modules/custom-data/get-custom-data-routing-module.util.d.ts +1 -1
- package/lib/_modules/custom-data/get-custom-data-routing-module.util.d.ts.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/data-service.index.d.ts +3 -3
- package/lib/_modules/data-service.index.d.ts.map +1 -1
- package/lib/_modules/data-service.index.js +3 -3
- 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/extended.index.d.ts +2 -2
- package/lib/_modules/extended.index.d.ts.map +1 -1
- package/lib/_modules/extended.index.js +2 -2
- package/lib/_modules/extended.index.js.map +1 -1
- package/lib/_modules/test/get-test-routing-module.util.d.ts +1 -1
- package/lib/_modules/test/get-test-routing-module.util.d.ts.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.d.ts +1 -1
- package/lib/_modules/test/test.controller.d.ts.map +1 -1
- package/lib/_modules/test/test.controller.js +2 -2
- package/lib/_modules/test/test.controller.js.map +1 -1
- package/lib/_modules/usage/get-usage-routing-module.util.d.ts +1 -1
- package/lib/_modules/usage/get-usage-routing-module.util.d.ts.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.d.ts +1 -1
- package/lib/_modules/usage/usage.controller.d.ts.map +1 -1
- package/lib/_modules/usage/usage.controller.js +2 -2
- package/lib/_modules/usage/usage.controller.js.map +1 -1
- package/lib/_modules/usage/usage.data-service.d.ts +1 -1
- package/lib/_modules/usage/usage.data-service.d.ts.map +1 -1
- package/lib/_modules/usage/usage.data-service.js +1 -1
- package/lib/_modules/usage/usage.data-service.js.map +1 -1
- package/lib/_services/{data.service.d.ts → base/data.service.d.ts} +3 -2
- package/lib/_services/base/data.service.d.ts.map +1 -0
- package/lib/_services/{data.service.js → base/data.service.js} +73 -18
- package/lib/_services/base/data.service.js.map +1 -0
- package/lib/_services/{db.service.d.ts → base/db.service.d.ts} +5 -3
- package/lib/_services/base/db.service.d.ts.map +1 -0
- package/lib/_services/{db.service.js → base/db.service.js} +50 -180
- package/lib/_services/base/db.service.js.map +1 -0
- package/lib/_services/base/singleton.service.d.ts.map +1 -0
- package/lib/_services/base/singleton.service.js.map +1 -0
- package/lib/_services/{api.service.d.ts → core/api.service.d.ts} +1 -1
- package/lib/_services/core/api.service.d.ts.map +1 -0
- package/lib/_services/{api.service.js → core/api.service.js} +24 -9
- package/lib/_services/core/api.service.js.map +1 -0
- package/lib/_services/{auth.service.d.ts → core/auth.service.d.ts} +2 -1
- package/lib/_services/core/auth.service.d.ts.map +1 -0
- package/lib/_services/{auth.service.js → core/auth.service.js} +4 -1
- package/lib/_services/core/auth.service.js.map +1 -0
- package/lib/_services/{email.service.d.ts → core/email.service.d.ts} +1 -0
- package/lib/_services/core/email.service.d.ts.map +1 -0
- package/lib/_services/{email.service.js → core/email.service.js} +7 -2
- package/lib/_services/core/email.service.js.map +1 -0
- package/lib/_services/{global.service.d.ts → core/global.service.d.ts} +5 -5
- package/lib/_services/core/global.service.d.ts.map +1 -0
- package/lib/_services/core/global.service.js +129 -0
- package/lib/_services/core/global.service.js.map +1 -0
- package/lib/_services/core/service-collection.service.d.ts +5 -0
- package/lib/_services/core/service-collection.service.d.ts.map +1 -0
- package/lib/_services/{service-collection.service.js → core/service-collection.service.js} +1 -1
- package/lib/_services/core/service-collection.service.js.map +1 -0
- package/lib/_services/index.d.ts +11 -11
- package/lib/_services/index.d.ts.map +1 -1
- package/lib/_services/index.js +11 -11
- package/lib/_services/index.js.map +1 -1
- package/lib/_services/{controller.service.d.ts → route/controller.service.d.ts} +2 -2
- package/lib/_services/route/controller.service.d.ts.map +1 -0
- package/lib/_services/{controller.service.js → route/controller.service.js} +2 -2
- package/lib/_services/route/controller.service.js.map +1 -0
- package/lib/_services/{routing-module.service.d.ts → route/routing-module.service.d.ts} +4 -3
- package/lib/_services/route/routing-module.service.d.ts.map +1 -0
- package/lib/_services/{routing-module.service.js → route/routing-module.service.js} +16 -8
- package/lib/_services/route/routing-module.service.js.map +1 -0
- package/lib/_services/{app-extended.server.d.ts → server/app-extended.server.d.ts} +1 -1
- package/lib/_services/server/app-extended.server.d.ts.map +1 -0
- package/lib/_services/{app-extended.server.js → server/app-extended.server.js} +2 -2
- package/lib/_services/server/app-extended.server.js.map +1 -0
- package/lib/_services/{app.server.d.ts → server/app.server.d.ts} +23 -7
- package/lib/_services/server/app.server.d.ts.map +1 -0
- package/lib/_services/{app.server.js → server/app.server.js} +134 -14
- package/lib/_services/server/app.server.js.map +1 -0
- package/lib/_services/server/app.server.spec.d.ts.map +1 -0
- package/lib/_services/server/app.server.spec.js +39 -0
- package/lib/_services/server/app.server.spec.js.map +1 -0
- package/lib/_services/{socket-client.service.d.ts → socket/socket-client.service.d.ts} +3 -3
- package/lib/_services/socket/socket-client.service.d.ts.map +1 -0
- package/lib/_services/{socket-client.service.js → socket/socket-client.service.js} +8 -7
- package/lib/_services/socket/socket-client.service.js.map +1 -0
- package/lib/_services/{socket-server.service.d.ts → socket/socket-server.service.d.ts} +5 -5
- package/lib/_services/socket/socket-server.service.d.ts.map +1 -0
- package/lib/_services/{socket-server.service.js → socket/socket-server.service.js} +5 -5
- package/lib/_services/socket/socket-server.service.js.map +1 -0
- package/lib/_services/socket/socket-server.service.spec.d.ts.map +1 -0
- package/lib/_services/socket/socket-server.service.spec.js +9 -0
- package/lib/_services/socket/socket-server.service.spec.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/_constants/global-settings.const.ts +1 -1
- package/src/_constants/mocks/app-params.mock.ts +9 -0
- package/src/_constants/mocks/app-server.mock.ts +100 -0
- package/src/_constants/mocks/auth-service.mock.ts +34 -0
- package/src/_constants/mocks/controller.mock.ts +16 -0
- package/src/_constants/mocks/endpoint.mock.ts +85 -0
- package/src/_constants/mocks/socket-server.mock.ts +27 -0
- package/src/_models/control-models/endpoint-params.control-model.ts +41 -12
- package/src/_models/control-models/socket-event.control-model.ts +4 -4
- package/src/_models/control-models/socket-server-service-params.control-model.ts +2 -2
- package/src/_models/interfaces/global-service-settings.interface.ts +4 -4
- package/src/_modules/api-service.index.ts +2 -2
- package/src/_modules/app-extended.index.ts +5 -5
- package/src/_modules/app.index.ts +3 -3
- package/src/_modules/auth.index.ts +1 -1
- package/src/_modules/controller.index.ts +1 -1
- package/src/_modules/custom-data/custom-data.controller.ts +1 -1
- package/src/_modules/custom-data/custom-data.data-service.ts +1 -1
- package/src/_modules/custom-data/get-custom-data-routing-module.util.ts +1 -1
- package/src/_modules/data-service.index.ts +3 -3
- package/src/_modules/email.index.ts +2 -2
- package/src/_modules/extended.index.ts +2 -2
- package/src/_modules/test/get-test-routing-module.util.ts +1 -1
- package/src/_modules/test/test.controller.ts +2 -2
- package/src/_modules/usage/get-usage-routing-module.util.ts +1 -1
- package/src/_modules/usage/usage.controller.ts +3 -3
- package/src/_modules/usage/usage.data-service.ts +1 -1
- package/src/_services/{data.service.ts → base/data.service.ts} +77 -21
- package/src/_services/{db.service.ts → base/db.service.ts} +114 -90
- package/src/_services/{singleton.service.ts → base/singleton.service.ts} +2 -0
- package/src/_services/{api.service.ts → core/api.service.ts} +26 -10
- package/src/_services/{auth.service.ts → core/auth.service.ts} +5 -1
- package/src/_services/{email.service.ts → core/email.service.ts} +9 -2
- package/src/_services/{global.service.ts → core/global.service.ts} +35 -21
- package/src/_services/{service-collection.service.ts → core/service-collection.service.ts} +1 -1
- package/src/_services/index.ts +11 -11
- package/src/_services/{controller.service.ts → route/controller.service.ts} +3 -3
- package/src/_services/{routing-module.service.ts → route/routing-module.service.ts} +39 -15
- package/src/_services/{app-extended.server.ts → server/app-extended.server.ts} +3 -3
- package/src/_services/server/app.server.spec.ts +49 -0
- package/src/_services/{app.server.ts → server/app.server.ts} +161 -22
- package/src/_services/{socket-client.service.ts → socket/socket-client.service.ts} +8 -8
- package/src/_services/socket/socket-server.service.spec.ts +11 -0
- package/src/_services/{socket-server.service.ts → socket/socket-server.service.ts} +8 -8
- package/lib/_services/api.service.d.ts.map +0 -1
- package/lib/_services/api.service.js.map +0 -1
- package/lib/_services/app-extended.server.d.ts.map +0 -1
- package/lib/_services/app-extended.server.js.map +0 -1
- package/lib/_services/app.server.d.ts.map +0 -1
- package/lib/_services/app.server.js.map +0 -1
- package/lib/_services/app.server.spec.d.ts.map +0 -1
- package/lib/_services/app.server.spec.js +0 -32
- package/lib/_services/app.server.spec.js.map +0 -1
- package/lib/_services/auth.service.d.ts.map +0 -1
- package/lib/_services/auth.service.js.map +0 -1
- package/lib/_services/controller.service.d.ts.map +0 -1
- package/lib/_services/controller.service.js.map +0 -1
- package/lib/_services/data.service.d.ts.map +0 -1
- package/lib/_services/data.service.js.map +0 -1
- package/lib/_services/db.service.d.ts.map +0 -1
- package/lib/_services/db.service.js.map +0 -1
- package/lib/_services/email.service.d.ts.map +0 -1
- package/lib/_services/email.service.js.map +0 -1
- package/lib/_services/global.service.d.ts.map +0 -1
- package/lib/_services/global.service.js +0 -116
- package/lib/_services/global.service.js.map +0 -1
- package/lib/_services/routing-module.service.d.ts.map +0 -1
- package/lib/_services/routing-module.service.js.map +0 -1
- package/lib/_services/service-collection.service.d.ts +0 -5
- package/lib/_services/service-collection.service.d.ts.map +0 -1
- package/lib/_services/service-collection.service.js.map +0 -1
- package/lib/_services/singleton.service.d.ts.map +0 -1
- package/lib/_services/singleton.service.js.map +0 -1
- package/lib/_services/socket-client.service.d.ts.map +0 -1
- package/lib/_services/socket-client.service.js.map +0 -1
- package/lib/_services/socket-server.service.d.ts.map +0 -1
- package/lib/_services/socket-server.service.js.map +0 -1
- package/lib/_services/socket-server.service.spec.d.ts.map +0 -1
- package/lib/_services/socket-server.service.spec.js.map +0 -1
- package/src/_services/app.server.spec.ts +0 -40
- package/src/_services/socket-server.service.spec.ts +0 -32
- /package/lib/_services/{singleton.service.d.ts → base/singleton.service.d.ts} +0 -0
- /package/lib/_services/{singleton.service.js → base/singleton.service.js} +0 -0
- /package/lib/_services/{app.server.spec.d.ts → server/app.server.spec.d.ts} +0 -0
- /package/lib/_services/{socket-server.service.spec.d.ts → socket/socket-server.service.spec.d.ts} +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import { Dynamo_Metadata, Dynamo_DataParams, Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
4
|
-
import { DynamoNTS_AppParams } from '
|
|
3
|
+
import { Dynamo_Metadata, Dynamo_DataParams, Dynamo_Log, Dynamo_Error } from '@futdevpro/fsm-dynamo';
|
|
4
|
+
import { DynamoNTS_AppParams } from '../../_models/control-models/app-params.control-model';
|
|
5
5
|
|
|
6
|
-
import { DynamoNTS_GlobalServiceSettings } from '
|
|
6
|
+
import { DynamoNTS_GlobalServiceSettings } from '../../_models/interfaces/global-service-settings.interface';
|
|
7
7
|
|
|
8
8
|
import { DynamoNTS_AuthService } from './auth.service';
|
|
9
9
|
/* import { DynamoNTS_DBServiceCollection } from './db-service-collection.service'; */
|
|
10
|
-
import { DynamoNTS_DBService } from '
|
|
10
|
+
import { DynamoNTS_DBService } from '../base/db.service';
|
|
11
11
|
import { DynamoNTS_EmailService } from './email.service';
|
|
12
12
|
import { DynamoNTS_ServiceCollection } from './service-collection.service';
|
|
13
13
|
/* import { DynamoNTS_EmailServiceCollection } from './email-service-collection.service'; */
|
|
14
|
-
import { DynamoNTS_SingletonService } from '
|
|
14
|
+
import { DynamoNTS_SingletonService } from '../base/singleton.service';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* This is the main Global/Core Service Collection used by DynamoBE,
|
|
@@ -38,7 +38,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
38
38
|
/**
|
|
39
39
|
* You need to setup global Services through this function
|
|
40
40
|
*/
|
|
41
|
-
static setServices(set: DynamoNTS_GlobalServiceSettings): void {
|
|
41
|
+
static async setServices(set: DynamoNTS_GlobalServiceSettings): Promise<void> {
|
|
42
42
|
this.getInstance();
|
|
43
43
|
|
|
44
44
|
try {
|
|
@@ -47,14 +47,24 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
47
47
|
try {
|
|
48
48
|
this.instance.dbServiceCollection[dbModel.dataName] = new DynamoNTS_DBService(dbModel);
|
|
49
49
|
} catch (error) {
|
|
50
|
-
|
|
50
|
+
error = new Dynamo_Error({
|
|
51
|
+
message: `Failed to create DynamoNTS_DBService (${dbModel.dataName}).\n` + dbModel,
|
|
52
|
+
issuerService: 'DynamoNTS_GlobalService',
|
|
53
|
+
error: error
|
|
54
|
+
});
|
|
55
|
+
throw error;
|
|
51
56
|
}
|
|
52
57
|
});
|
|
53
58
|
|
|
54
59
|
this.instance.authService = set.authService;
|
|
55
60
|
this.instance.emailServiceCollection = set.emailServiceCollection;
|
|
56
61
|
} catch (error) {
|
|
57
|
-
Dynamo_Log.error(
|
|
62
|
+
Dynamo_Log.error(`Failed to create DynamoNTS_GlobalService.`, error);
|
|
63
|
+
/* error = new Dynamo_Error({
|
|
64
|
+
message: `Failed to create DynamoNTS_GlobalService.`,
|
|
65
|
+
error: error
|
|
66
|
+
});
|
|
67
|
+
throw error; */
|
|
58
68
|
}
|
|
59
69
|
}
|
|
60
70
|
|
|
@@ -69,9 +79,10 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
69
79
|
static getAuthService(): DynamoNTS_AuthService {
|
|
70
80
|
if (!this.instance?.authService?.authenticateToken) {
|
|
71
81
|
throw new Error(
|
|
72
|
-
`\
|
|
73
|
-
`\
|
|
74
|
-
|
|
82
|
+
`\n Unique Authentication Service missing!` +
|
|
83
|
+
`\n Please create a Unique Authentication Service extending DynamoNTS_AuthService, ` +
|
|
84
|
+
`\n and Setup with DynamoNTS_GlobalServiceC.setServices(...)\n`
|
|
85
|
+
);
|
|
75
86
|
}
|
|
76
87
|
|
|
77
88
|
return this.instance.authService;
|
|
@@ -84,9 +95,10 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
84
95
|
static getDBServiceCollection(): DynamoNTS_ServiceCollection<DynamoNTS_DBService<any>> {
|
|
85
96
|
if (!this.instance?.dbServiceCollection) {
|
|
86
97
|
throw new Error(
|
|
87
|
-
`\
|
|
88
|
-
`\
|
|
89
|
-
|
|
98
|
+
`\n Unique DataBase Service Collection missing!` +
|
|
99
|
+
`\n Please create a Unique DataBase Service Collection extending DynamoNTS_DBServiceCollection, ` +
|
|
100
|
+
`\n and Setup with DynamoNTS_GlobalServiceC.setServices(...)\n`
|
|
101
|
+
);
|
|
90
102
|
}
|
|
91
103
|
|
|
92
104
|
return this.instance.dbServiceCollection;
|
|
@@ -115,10 +127,11 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
115
127
|
keys = keys.replace(/,/g, '\n ');
|
|
116
128
|
|
|
117
129
|
throw new Error(
|
|
118
|
-
`\
|
|
119
|
-
no dbService on collection with this key: ${key}
|
|
120
|
-
The available dbServices on collection
|
|
121
|
-
|
|
130
|
+
`\n DynamoNTS_GlobalService.getDBService failed, ERROR: ` +
|
|
131
|
+
`\n no dbService on collection with this key: ${key}!` +
|
|
132
|
+
`\n The available dbServices on collection:` +
|
|
133
|
+
`\n ${keys}\n`
|
|
134
|
+
);
|
|
122
135
|
}
|
|
123
136
|
}
|
|
124
137
|
|
|
@@ -129,9 +142,10 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
129
142
|
static getEmailServiceCollection(): DynamoNTS_ServiceCollection<DynamoNTS_EmailService> {
|
|
130
143
|
if (!this.instance?.emailServiceCollection) {
|
|
131
144
|
throw new Error(
|
|
132
|
-
|
|
133
|
-
`\
|
|
134
|
-
|
|
145
|
+
`\n Unique Email Service Collection missing!` +
|
|
146
|
+
`\n Please create a Unique Email Service Collection extending DynamoBEEmailServiceCollection, ` +
|
|
147
|
+
`\n and Setup with DynamoNTS_GlobalServiceC.setServices(...)\n`
|
|
148
|
+
);
|
|
135
149
|
}
|
|
136
150
|
|
|
137
151
|
return this.instance.emailServiceCollection;
|
package/src/_services/index.ts
CHANGED
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
// SERVICES
|
|
5
|
-
export * from './api.service';
|
|
6
|
-
export * from './app.server';
|
|
7
|
-
export * from './auth.service';
|
|
8
|
-
export * from './controller.service';
|
|
9
|
-
export * from './data.service';
|
|
10
|
-
export * from './db.service';
|
|
11
|
-
export * from './email.service';
|
|
12
|
-
export * from './global.service';
|
|
13
|
-
export * from './routing-module.service';
|
|
14
|
-
export * from './service-collection.service';
|
|
5
|
+
export * from './core/api.service';
|
|
6
|
+
export * from './server/app.server';
|
|
7
|
+
export * from './core/auth.service';
|
|
8
|
+
export * from './route/controller.service';
|
|
9
|
+
export * from './base/data.service';
|
|
10
|
+
export * from './base/db.service';
|
|
11
|
+
export * from './core/email.service';
|
|
12
|
+
export * from './core/global.service';
|
|
13
|
+
export * from './route/routing-module.service';
|
|
14
|
+
export * from './core/service-collection.service';
|
|
15
15
|
export * from './shared.static-service';
|
|
16
|
-
export * from './singleton.service';
|
|
16
|
+
export * from './base/singleton.service';
|
|
17
17
|
|
|
18
18
|
// these are using socket.io therefore they are not included in the service index
|
|
19
19
|
// export * from './app-extended.server';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
import { Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
4
|
-
import { DynamoNTS_EndpointParams } from '
|
|
4
|
+
import { DynamoNTS_EndpointParams } from '../../_models/control-models/endpoint-params.control-model';
|
|
5
5
|
|
|
6
|
-
import { DynamoNTS_SingletonService } from '
|
|
6
|
+
import { DynamoNTS_SingletonService } from '../base/singleton.service';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Basic controller for endpoint handlings
|
|
@@ -82,7 +82,7 @@ export abstract class DynamoNTS_Controller extends DynamoNTS_SingletonService {
|
|
|
82
82
|
try {
|
|
83
83
|
this.setupEndpoints();
|
|
84
84
|
} catch (error) {
|
|
85
|
-
Dynamo_Log.error(
|
|
85
|
+
Dynamo_Log.error(`\nDynamoNTS_Controller ERROR setup failed`, error);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -3,12 +3,12 @@ import { Router } from 'express';
|
|
|
3
3
|
|
|
4
4
|
import { Dynamo_Error, Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { DynamoNTS_RouteSecurity } from '
|
|
8
|
-
import { DynamoNTS_HttpCallType } from '
|
|
6
|
+
import { dynamoNTS_globalSettings } from '../../_constants/global-settings.const';
|
|
7
|
+
import { DynamoNTS_RouteSecurity } from '../../_enums/route-security.enum';
|
|
8
|
+
import { DynamoNTS_HttpCallType } from '../../_enums/http/http-call-type.enum';
|
|
9
9
|
import { DynamoNTS_Controller } from './controller.service';
|
|
10
|
-
import { DynamoNTS_RoutingModuleSettings } from '
|
|
11
|
-
import { DynamoNTS_EndpointParams } from '
|
|
10
|
+
import { DynamoNTS_RoutingModuleSettings } from '../../_models/interfaces/routing-module-settings.interface';
|
|
11
|
+
import { DynamoNTS_EndpointParams } from '../../_models/control-models/endpoint-params.control-model';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Routing Module
|
|
@@ -53,6 +53,8 @@ import { DynamoNTS_EndpointParams } from '../_models/control-models/endpoint-par
|
|
|
53
53
|
* }
|
|
54
54
|
*/
|
|
55
55
|
export class DynamoNTS_RoutingModule {
|
|
56
|
+
|
|
57
|
+
serviceName: string;
|
|
56
58
|
|
|
57
59
|
security: DynamoNTS_RouteSecurity;
|
|
58
60
|
route: string;
|
|
@@ -63,7 +65,7 @@ export class DynamoNTS_RoutingModule {
|
|
|
63
65
|
openRouter: Router = Router();
|
|
64
66
|
secureRouter: Router = Router();
|
|
65
67
|
|
|
66
|
-
protected log: boolean =
|
|
68
|
+
protected log: boolean = dynamoNTS_globalSettings.logSetup;
|
|
67
69
|
|
|
68
70
|
defaultErrorUserMsg =
|
|
69
71
|
`We encountered an uncought BackEnd Build Error, ` +
|
|
@@ -73,14 +75,15 @@ export class DynamoNTS_RoutingModule {
|
|
|
73
75
|
set: DynamoNTS_RoutingModuleSettings
|
|
74
76
|
){
|
|
75
77
|
try {
|
|
76
|
-
this.
|
|
77
|
-
this.
|
|
78
|
+
this.serviceName = set.route.replace('/', '') + 'RoutingModule';
|
|
79
|
+
this.route = dynamoNTS_globalSettings.baseUrl + set.route;
|
|
80
|
+
this.controllers = set.controllers ?? [];
|
|
78
81
|
this.setupRoutes();
|
|
79
82
|
this.mountRoutes(set.securityOverride);
|
|
80
83
|
|
|
81
84
|
if (this.log) console.log(`routing module setup done: ${this.route} serurity: ${this.security}\n`);
|
|
82
85
|
} catch (error) {
|
|
83
|
-
Dynamo_Log.error(
|
|
86
|
+
Dynamo_Log.error(`\nRouting module setup failed (${this.route})`, error);
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
89
|
|
|
@@ -106,7 +109,9 @@ export class DynamoNTS_RoutingModule {
|
|
|
106
109
|
if (securityOverride) {
|
|
107
110
|
endpoint.security = securityOverride;
|
|
108
111
|
} else {
|
|
109
|
-
if (!
|
|
112
|
+
if (!endpoint.security) {
|
|
113
|
+
Dynamo_Log.error(`Endpoint security not set: ${endpoint.endpoint}\n`);
|
|
114
|
+
} else if (!this.security) {
|
|
110
115
|
this.security = endpoint.security;
|
|
111
116
|
} else if (this.security !== endpoint.security) {
|
|
112
117
|
this.security = DynamoNTS_RouteSecurity.both;
|
|
@@ -139,6 +144,7 @@ export class DynamoNTS_RoutingModule {
|
|
|
139
144
|
addECToUserMsg: true,
|
|
140
145
|
message: `DYNAMO-NTS ERROR: Failed to mount routes.`,
|
|
141
146
|
userMessage: this.defaultErrorUserMsg,
|
|
147
|
+
issuerService: this.serviceName + ' - ' + this.route,
|
|
142
148
|
error
|
|
143
149
|
})
|
|
144
150
|
}
|
|
@@ -151,32 +157,44 @@ export class DynamoNTS_RoutingModule {
|
|
|
151
157
|
*/
|
|
152
158
|
private mountOpenRoute(endpointParams: DynamoNTS_EndpointParams): void {
|
|
153
159
|
switch(endpointParams.type) {
|
|
160
|
+
|
|
154
161
|
case DynamoNTS_HttpCallType.get:
|
|
155
162
|
this.openRouter.get(endpointParams.endpoint,
|
|
156
|
-
endpointParams.preProcessess, endpointParams.getTasksExecution()
|
|
163
|
+
endpointParams.preProcessess, endpointParams.getTasksExecution()
|
|
164
|
+
);
|
|
157
165
|
break;
|
|
166
|
+
|
|
158
167
|
case DynamoNTS_HttpCallType.post:
|
|
159
168
|
this.openRouter.post(endpointParams.endpoint,
|
|
160
|
-
endpointParams.preProcessess, endpointParams.getTasksExecution()
|
|
169
|
+
endpointParams.preProcessess, endpointParams.getTasksExecution()
|
|
170
|
+
);
|
|
161
171
|
break;
|
|
172
|
+
|
|
162
173
|
case DynamoNTS_HttpCallType.put:
|
|
163
174
|
this.openRouter.put(endpointParams.endpoint,
|
|
164
|
-
endpointParams.preProcessess, endpointParams.getTasksExecution()
|
|
175
|
+
endpointParams.preProcessess, endpointParams.getTasksExecution()
|
|
176
|
+
);
|
|
165
177
|
break;
|
|
178
|
+
|
|
166
179
|
case DynamoNTS_HttpCallType.patch:
|
|
167
180
|
this.openRouter.patch(endpointParams.endpoint,
|
|
168
|
-
endpointParams.preProcessess, endpointParams.getTasksExecution()
|
|
181
|
+
endpointParams.preProcessess, endpointParams.getTasksExecution()
|
|
182
|
+
);
|
|
169
183
|
break;
|
|
184
|
+
|
|
170
185
|
case DynamoNTS_HttpCallType.delete:
|
|
171
186
|
this.openRouter.delete(endpointParams.endpoint,
|
|
172
|
-
endpointParams.preProcessess, endpointParams.getTasksExecution()
|
|
187
|
+
endpointParams.preProcessess, endpointParams.getTasksExecution()
|
|
188
|
+
);
|
|
173
189
|
break;
|
|
190
|
+
|
|
174
191
|
default:
|
|
175
192
|
throw new Dynamo_Error({
|
|
176
193
|
errorCode: 'NTS-RM9-200',
|
|
177
194
|
addECToUserMsg: true,
|
|
178
195
|
message: `DYNAMO-NTS ERROR: INVALID route type: ${endpointParams.type} - ${endpointParams.name}` ,
|
|
179
196
|
userMessage: this.defaultErrorUserMsg,
|
|
197
|
+
issuerService: this.serviceName + ' - ' + this.route,
|
|
180
198
|
error: new Error()
|
|
181
199
|
})
|
|
182
200
|
}
|
|
@@ -192,28 +210,34 @@ export class DynamoNTS_RoutingModule {
|
|
|
192
210
|
this.secureRouter.get(endpointParams.endpoint,
|
|
193
211
|
endpointParams.preProcessess, endpointParams.getTasksExecution());
|
|
194
212
|
break;
|
|
213
|
+
|
|
195
214
|
case DynamoNTS_HttpCallType.post:
|
|
196
215
|
this.secureRouter.post(endpointParams.endpoint,
|
|
197
216
|
endpointParams.preProcessess, endpointParams.getTasksExecution());
|
|
198
217
|
break;
|
|
218
|
+
|
|
199
219
|
case DynamoNTS_HttpCallType.put:
|
|
200
220
|
this.secureRouter.put(endpointParams.endpoint,
|
|
201
221
|
endpointParams.preProcessess, endpointParams.getTasksExecution());
|
|
202
222
|
break;
|
|
223
|
+
|
|
203
224
|
case DynamoNTS_HttpCallType.patch:
|
|
204
225
|
this.secureRouter.patch(endpointParams.endpoint,
|
|
205
226
|
endpointParams.preProcessess, endpointParams.getTasksExecution());
|
|
206
227
|
break;
|
|
228
|
+
|
|
207
229
|
case DynamoNTS_HttpCallType.delete:
|
|
208
230
|
this.secureRouter.delete(endpointParams.endpoint,
|
|
209
231
|
endpointParams.preProcessess, endpointParams.getTasksExecution());
|
|
210
232
|
break;
|
|
233
|
+
|
|
211
234
|
default:
|
|
212
235
|
throw new Dynamo_Error({
|
|
213
236
|
errorCode: 'NTS-RM9-300',
|
|
214
237
|
addECToUserMsg: true,
|
|
215
238
|
message: `DYNAMO-NTS ERROR: INVALID route type: ${endpointParams.type} - ${endpointParams.name}`,
|
|
216
239
|
userMessage: this.defaultErrorUserMsg,
|
|
240
|
+
issuerService: this.serviceName + ' - ' + this.route,
|
|
217
241
|
error: new Error()
|
|
218
242
|
})
|
|
219
243
|
}
|
|
@@ -5,9 +5,9 @@ import * as Http from 'http';
|
|
|
5
5
|
import { Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
6
6
|
|
|
7
7
|
import { DynamoNTS_App } from './app.server';
|
|
8
|
-
import { DynamoNTS_RouteSecurity } from '
|
|
9
|
-
import { DynamoNTS_SocketServerService } from '
|
|
10
|
-
import { DynamoNTS_SocketSecurity } from '
|
|
8
|
+
import { DynamoNTS_RouteSecurity } from '../../_enums/route-security.enum';
|
|
9
|
+
import { DynamoNTS_SocketServerService } from '../socket/socket-server.service';
|
|
10
|
+
import { DynamoNTS_SocketSecurity } from '../../_enums/socket-security.enum';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* This will be the MAIN service of our server project,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
import { delay } from '@futdevpro/fsm-dynamo';
|
|
3
|
+
import { DynamoNTS_AppBase_Mock, DynamoNTS_AppFull_Mock } from '../../_constants/mocks/app-server.mock';
|
|
4
|
+
|
|
5
|
+
describe('DynamoNTS_App;', () => {
|
|
6
|
+
describe('a base instance;', () => {
|
|
7
|
+
let app: DynamoNTS_AppBase_Mock;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
app = new DynamoNTS_AppBase_Mock();
|
|
11
|
+
await app.ready();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
afterEach(async () => {
|
|
15
|
+
await app.stop();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should be created', () => {
|
|
19
|
+
expect(app).toBeDefined();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should be started', () => {
|
|
23
|
+
expect(app.started).toBeTrue();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe('a full instance;', () => {
|
|
28
|
+
let app: DynamoNTS_AppFull_Mock;
|
|
29
|
+
|
|
30
|
+
beforeEach(async () => {
|
|
31
|
+
app = new DynamoNTS_AppFull_Mock();
|
|
32
|
+
await app.ready();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
afterEach(async () => {
|
|
36
|
+
await app.stop();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should be created', () => {
|
|
40
|
+
expect(app).toBeDefined();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('should be started', () => {
|
|
44
|
+
expect(app.started).toBeTrue();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|