@futdevpro/nts-dynamo 1.5.76 → 1.5.81
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/LICENSE +2 -2
- package/lib/_constants/dynamo-nts-global-settings.d.ts +2 -2
- package/lib/_constants/dynamo-nts-global-settings.js +17 -17
- package/lib/_constants/index.d.ts +1 -1
- package/lib/_constants/index.js +4 -4
- package/lib/_enums/data-model-type.enum.d.ts +12 -12
- package/lib/_enums/data-model-type.enum.js +16 -16
- package/lib/_enums/data-model-type.enum.js.map +1 -1
- package/lib/_enums/dynamo-nts-data-service-function.enum.d.ts +12 -12
- package/lib/_enums/dynamo-nts-data-service-function.enum.js +18 -18
- package/lib/_enums/dynamo-nts-data-service-function.enum.js.map +1 -1
- package/lib/_enums/dynamo-nts-route-security.enum.d.ts +11 -11
- package/lib/_enums/dynamo-nts-route-security.enum.js +15 -15
- package/lib/_enums/dynamo-nts-route-security.enum.js.map +1 -1
- package/lib/_enums/dynamo-nts-socket-security.enum.d.ts +10 -10
- package/lib/_enums/dynamo-nts-socket-security.enum.js +14 -14
- package/lib/_enums/dynamo-nts-socket-security.enum.js.map +1 -1
- package/lib/_enums/http/http-call-type.enum.d.ts +11 -11
- package/lib/_enums/http/http-call-type.enum.js +15 -15
- package/lib/_enums/http/http-call-type.enum.js.map +1 -1
- package/lib/_enums/http/http-response-type.enum.d.ts +6 -6
- package/lib/_enums/http/http-response-type.enum.js +10 -10
- package/lib/_enums/http/http-response-type.enum.js.map +1 -1
- package/lib/_enums/http/socket-event.enum.d.ts +9 -8
- package/lib/_enums/http/socket-event.enum.d.ts.map +1 -1
- package/lib/_enums/http/socket-event.enum.js +13 -12
- package/lib/_enums/http/socket-event.enum.js.map +1 -1
- package/lib/_enums/index.d.ts +8 -8
- package/lib/_enums/index.js +13 -13
- package/lib/_enums/predefined-data-types.enum.d.ts +10 -10
- package/lib/_enums/predefined-data-types.enum.js +14 -14
- package/lib/_enums/predefined-data-types.enum.js.map +1 -1
- package/lib/_interfaces/certification-settings.interface.d.ts +7 -0
- package/lib/_interfaces/certification-settings.interface.d.ts.map +1 -0
- package/lib/_interfaces/certification-settings.interface.js +3 -0
- package/lib/_interfaces/certification-settings.interface.js.map +1 -0
- package/lib/_interfaces/global-service-settings.interface.d.ts +18 -0
- package/lib/_interfaces/global-service-settings.interface.d.ts.map +1 -0
- package/lib/_interfaces/global-service-settings.interface.js +3 -0
- package/lib/_interfaces/global-service-settings.interface.js.map +1 -0
- package/lib/_interfaces/index.d.ts +1 -0
- package/lib/_interfaces/index.d.ts.map +1 -0
- package/lib/_interfaces/index.js +4 -0
- package/lib/_interfaces/index.js.map +1 -0
- package/lib/_interfaces/port-settings.interface.d.ts +5 -0
- package/lib/_interfaces/port-settings.interface.d.ts.map +1 -0
- package/lib/_interfaces/port-settings.interface.js +3 -0
- package/lib/_interfaces/port-settings.interface.js.map +1 -0
- package/lib/_models/dynamo-nts-api-call-params.d.ts +95 -95
- package/lib/_models/dynamo-nts-api-call-params.js +47 -47
- package/lib/_models/dynamo-nts-app-params.d.ts +49 -49
- package/lib/_models/dynamo-nts-app-params.js +17 -17
- package/lib/_models/dynamo-nts-endpoint-params.d.ts +80 -80
- package/lib/_models/dynamo-nts-endpoint-params.js +139 -139
- package/lib/_models/dynamo-nts-global-settings.d.ts +53 -53
- package/lib/_models/dynamo-nts-global-settings.js +2 -2
- package/lib/_models/dynamo-nts-routing-module-settings.d.ts +19 -19
- package/lib/_models/dynamo-nts-routing-module-settings.js +2 -2
- package/lib/_models/dynamo-nts-socket-event-params.d.ts +32 -30
- package/lib/_models/dynamo-nts-socket-event-params.d.ts.map +1 -1
- package/lib/_models/dynamo-nts-socket-event-params.js +80 -79
- package/lib/_models/dynamo-nts-socket-event-params.js.map +1 -1
- package/lib/_models/dynamo-nts-socket-presence.d.ts +21 -0
- package/lib/_models/dynamo-nts-socket-presence.d.ts.map +1 -0
- package/lib/_models/dynamo-nts-socket-presence.js +45 -0
- package/lib/_models/dynamo-nts-socket-presence.js.map +1 -0
- package/lib/_models/dynamo-nts-socket-service-params.d.ts +18 -18
- package/lib/_models/dynamo-nts-socket-service-params.d.ts.map +1 -1
- package/lib/_models/dynamo-nts-socket-service-params.js +26 -26
- package/lib/_models/dynamo-nts-socket-service-params.js.map +1 -1
- package/lib/_models/index.d.ts +7 -8
- package/lib/_models/index.d.ts.map +1 -1
- package/lib/_models/index.js +12 -12
- package/lib/_models/index.js.map +1 -1
- package/lib/_modules/api-service.index.d.ts +5 -5
- package/lib/_modules/api-service.index.js +11 -11
- package/lib/_modules/app-extended.index.d.ts +15 -12
- package/lib/_modules/app-extended.index.d.ts.map +1 -1
- package/lib/_modules/app-extended.index.js +23 -19
- package/lib/_modules/app-extended.index.js.map +1 -1
- package/lib/_modules/app.index.d.ts +13 -10
- package/lib/_modules/app.index.d.ts.map +1 -1
- package/lib/_modules/app.index.js +21 -17
- package/lib/_modules/app.index.js.map +1 -1
- package/lib/_modules/auth.index.d.ts +3 -3
- package/lib/_modules/auth.index.js +8 -8
- package/lib/_modules/constants.index.d.ts +1 -1
- package/lib/_modules/constants.index.js +4 -4
- package/lib/_modules/controller.index.d.ts +4 -4
- package/lib/_modules/controller.index.js +10 -10
- package/lib/_modules/custom-data/custom-data.controller.d.ts +5 -5
- package/lib/_modules/custom-data/custom-data.controller.js +55 -55
- package/lib/_modules/custom-data/custom-data.service.d.ts +5 -5
- package/lib/_modules/custom-data/custom-data.service.js +11 -11
- package/lib/_modules/custom-data/get-custom-data-routing-module.d.ts +3 -3
- package/lib/_modules/custom-data/get-custom-data-routing-module.js +17 -17
- package/lib/_modules/custom-data/index.d.ts +4 -4
- package/lib/_modules/custom-data/index.js +8 -8
- package/lib/_modules/custom-data-module.index.d.ts +1 -1
- package/lib/_modules/custom-data-module.index.js +4 -4
- package/lib/_modules/data-service.index.d.ts +5 -5
- package/lib/_modules/data-service.index.js +10 -10
- package/lib/_modules/email.index.d.ts +3 -3
- package/lib/_modules/email.index.js +8 -8
- package/lib/_modules/enums.index.d.ts +1 -1
- package/lib/_modules/enums.index.js +4 -4
- package/lib/_modules/models.index.d.ts +1 -1
- package/lib/_modules/models.index.js +4 -4
- package/lib/_modules/services.index.d.ts +1 -1
- package/lib/_modules/services.index.js +4 -4
- package/lib/_modules/test/get-test-routing-module.d.ts +3 -3
- package/lib/_modules/test/get-test-routing-module.js +17 -17
- package/lib/_modules/test/index.d.ts +3 -3
- package/lib/_modules/test/index.js +7 -7
- package/lib/_modules/test/test.controller.d.ts +5 -5
- package/lib/_modules/test/test.controller.js +104 -104
- package/lib/_modules/test-module.index.d.ts +1 -1
- package/lib/_modules/test-module.index.js +4 -4
- package/lib/_modules/usage/get-usage-routing-module.d.ts +3 -3
- package/lib/_modules/usage/get-usage-routing-module.js +17 -17
- package/lib/_modules/usage/index.d.ts +4 -4
- package/lib/_modules/usage/index.js +8 -8
- package/lib/_modules/usage/usage-controller.d.ts +6 -6
- package/lib/_modules/usage/usage-controller.js +88 -88
- package/lib/_modules/usage/usage.service.d.ts +16 -16
- package/lib/_modules/usage/usage.service.js +132 -132
- package/lib/_modules/usage-module.index.d.ts +1 -1
- package/lib/_modules/usage-module.index.js +4 -4
- package/lib/_services/dynamo-nts-api.service.d.ts +34 -34
- package/lib/_services/dynamo-nts-api.service.js +188 -188
- package/lib/_services/dynamo-nts-app-extended.d.ts +128 -128
- package/lib/_services/dynamo-nts-app-extended.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-app-extended.js +212 -212
- package/lib/_services/dynamo-nts-app-extended.js.map +1 -1
- package/lib/_services/dynamo-nts-app.d.ts +270 -278
- package/lib/_services/dynamo-nts-app.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-app.js +371 -371
- package/lib/_services/dynamo-nts-app.js.map +1 -1
- package/lib/_services/dynamo-nts-app.spec.d.ts +1 -0
- package/lib/_services/dynamo-nts-app.spec.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-app.spec.js +10 -0
- package/lib/_services/dynamo-nts-app.spec.js.map +1 -0
- package/lib/_services/dynamo-nts-auth.service.d.ts +127 -127
- package/lib/_services/dynamo-nts-auth.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-auth.service.js +53 -53
- package/lib/_services/dynamo-nts-auth.service.js.map +1 -1
- package/lib/_services/dynamo-nts-controller.service.d.ts +105 -105
- package/lib/_services/dynamo-nts-controller.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-controller.service.js +57 -57
- package/lib/_services/dynamo-nts-controller.service.js.map +1 -1
- package/lib/_services/dynamo-nts-data.service.d.ts +230 -229
- package/lib/_services/dynamo-nts-data.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-data.service.js +689 -686
- package/lib/_services/dynamo-nts-data.service.js.map +1 -1
- package/lib/_services/dynamo-nts-db-service-collection.service.d.ts +8 -8
- package/lib/_services/dynamo-nts-db-service-collection.service.js +10 -10
- package/lib/_services/dynamo-nts-db.service.d.ts +312 -312
- package/lib/_services/dynamo-nts-db.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-db.service.js +856 -856
- package/lib/_services/dynamo-nts-db.service.js.map +1 -1
- package/lib/_services/dynamo-nts-email-service-collection.service.d.ts +18 -18
- package/lib/_services/dynamo-nts-email-service-collection.service.js +20 -20
- package/lib/_services/dynamo-nts-email.service.d.ts +56 -56
- package/lib/_services/dynamo-nts-email.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-email.service.js +203 -203
- package/lib/_services/dynamo-nts-email.service.js.map +1 -1
- package/lib/_services/dynamo-nts-global.service.d.ts +71 -84
- package/lib/_services/dynamo-nts-global.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-global.service.js +156 -156
- package/lib/_services/dynamo-nts-global.service.js.map +1 -1
- package/lib/_services/dynamo-nts-routing-module.service.d.ts +76 -76
- package/lib/_services/dynamo-nts-routing-module.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-routing-module.service.js +191 -191
- package/lib/_services/dynamo-nts-routing-module.service.js.map +1 -1
- package/lib/_services/dynamo-nts-shared.service.d.ts +31 -31
- package/lib/_services/dynamo-nts-shared.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-shared.service.js +70 -70
- package/lib/_services/dynamo-nts-shared.service.js.map +1 -1
- package/lib/_services/dynamo-nts-shared.service.spec.d.ts +2 -0
- package/lib/_services/dynamo-nts-shared.service.spec.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-shared.service.spec.js +12 -0
- package/lib/_services/dynamo-nts-shared.service.spec.js.map +1 -0
- package/lib/_services/dynamo-nts-singleton.service.d.ts +8 -8
- package/lib/_services/dynamo-nts-singleton.service.js +18 -18
- package/lib/_services/dynamo-nts-singleton.service.js.map +1 -1
- package/lib/_services/dynamo-nts-socket-service-collection.service.d.ts +9 -9
- package/lib/_services/dynamo-nts-socket-service-collection.service.js +13 -13
- package/lib/_services/dynamo-nts-socket.service.d.ts +57 -45
- package/lib/_services/dynamo-nts-socket.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-socket.service.js +188 -165
- package/lib/_services/dynamo-nts-socket.service.js.map +1 -1
- package/lib/_services/index.d.ts +14 -16
- package/lib/_services/index.d.ts.map +1 -1
- package/lib/_services/index.js +20 -20
- package/lib/_services/index.js.map +1 -1
- package/lib/index.d.ts +6 -6
- package/lib/index.js +14 -14
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package SAVE.json +216 -0
- package/package-NEW with test but not working.json +228 -0
- package/package.json +15 -8
- package/spec/support/jasmine.json +14 -0
- package/src/_enums/http/socket-event.enum.ts +2 -1
- package/src/_interfaces/certification-settings.interface.ts +7 -0
- package/src/_interfaces/global-service-settings.interface.ts +23 -0
- package/src/_interfaces/index.ts +5 -0
- package/src/_interfaces/port-settings.interface.ts +5 -0
- package/src/_models/dynamo-nts-socket-event-params.ts +23 -21
- package/src/_models/{dynamo-nts-socket-dictionary.ts → dynamo-nts-socket-presence.ts} +21 -5
- package/src/_models/dynamo-nts-socket-service-params.ts +1 -0
- package/src/_models/index.ts +2 -2
- package/src/_modules/app-extended.index.ts +7 -2
- package/src/_modules/app.index.ts +5 -0
- package/src/_services/dynamo-nts-app-extended.ts +6 -2
- package/src/_services/dynamo-nts-app.spec.ts +14 -0
- package/src/_services/dynamo-nts-app.ts +8 -14
- package/src/_services/dynamo-nts-auth.service.ts +1 -0
- package/src/_services/dynamo-nts-controller.service.ts +2 -1
- package/src/_services/dynamo-nts-data.service.ts +16 -10
- package/src/_services/dynamo-nts-db.service.ts +8 -5
- package/src/_services/dynamo-nts-email.service.ts +1 -0
- package/src/_services/dynamo-nts-global.service.ts +3 -18
- package/src/_services/dynamo-nts-routing-module.service.ts +1 -0
- package/src/_services/dynamo-nts-shared.service.spec.ts +10 -0
- package/src/_services/dynamo-nts-shared.service.ts +2 -1
- package/src/_services/dynamo-nts-socket.service.ts +80 -41
- package/src/_services/index.ts +2 -2
|
@@ -5,26 +5,41 @@ import * as SocketIO from 'socket.io';
|
|
|
5
5
|
/**
|
|
6
6
|
* socket handling and clarification is under development
|
|
7
7
|
*/
|
|
8
|
-
export class
|
|
8
|
+
export class DynamoNTS_SocketPresence {
|
|
9
9
|
issuerId: string;
|
|
10
10
|
sockets: SocketIO.Socket[];
|
|
11
|
+
onDestroy: (issuerId: string) => void;
|
|
11
12
|
|
|
12
13
|
constructor(
|
|
13
|
-
set
|
|
14
|
+
set: {
|
|
14
15
|
issuerId: string,
|
|
15
16
|
sockets: SocketIO.Socket[],
|
|
17
|
+
onDestroy?: (issuerId: string) => void,
|
|
16
18
|
}
|
|
17
19
|
) {
|
|
18
|
-
|
|
19
|
-
if (!set.sockets.length) {
|
|
20
|
+
if (!set?.issuerId) {
|
|
20
21
|
throw new Dynamo_Error({
|
|
21
22
|
status: 406,
|
|
22
23
|
errorCode: 'NTS-SD0-C00',
|
|
23
24
|
addECToUserMsg: true,
|
|
24
|
-
message: 'trying to create
|
|
25
|
+
message: 'trying to create DynamoNTS_SocketPresence without a valid issuerId!',
|
|
26
|
+
userMessage: 'We encountered an unhandled Server Error, please contact the responsible development team.'
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
this.issuerId = set.issuerId;
|
|
31
|
+
this.onDestroy = set.onDestroy ?? (id => {});
|
|
32
|
+
|
|
33
|
+
if (!set?.sockets?.length) {
|
|
34
|
+
throw new Dynamo_Error({
|
|
35
|
+
status: 406,
|
|
36
|
+
errorCode: 'NTS-SD0-C01',
|
|
37
|
+
addECToUserMsg: true,
|
|
38
|
+
message: 'trying to create DynamoNTS_SocketPresence without a single active socket!',
|
|
25
39
|
userMessage: 'We encountered an unhandled Server Error, please contact the responsible development team.'
|
|
26
40
|
});
|
|
27
41
|
}
|
|
42
|
+
|
|
28
43
|
this.sockets = set.sockets;
|
|
29
44
|
}
|
|
30
45
|
|
|
@@ -38,5 +53,6 @@ export class DynamoNTS_SocketDictionary {
|
|
|
38
53
|
socket.emit(event, content);
|
|
39
54
|
});
|
|
40
55
|
}
|
|
56
|
+
|
|
41
57
|
}
|
|
42
58
|
|
|
@@ -30,6 +30,7 @@ export class DynamoNTS_SocketServiceParams {
|
|
|
30
30
|
|
|
31
31
|
if (set.getIdFromSubscrioption) {
|
|
32
32
|
this.getIdFromSubscrioption = set.getIdFromSubscrioption;
|
|
33
|
+
|
|
33
34
|
if (set.groupActiveSocketsBy) {
|
|
34
35
|
Dynamo_Log.error(
|
|
35
36
|
`setting groupActiveSocketsBy on DynamoNTS_SocketService (${this.name}) won't take effect, ` +
|
package/src/_models/index.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
// MODELS
|
|
4
4
|
export * from './dynamo-nts-api-call-params';
|
|
5
|
-
export * from './dynamo-nts-app-params';
|
|
5
|
+
//export * from './dynamo-nts-app-params';
|
|
6
6
|
export * from './dynamo-nts-endpoint-params';
|
|
7
7
|
export * from './dynamo-nts-global-settings';
|
|
8
8
|
export * from './dynamo-nts-routing-module-settings';
|
|
9
9
|
export * from './dynamo-nts-socket-event-params';
|
|
10
10
|
export * from './dynamo-nts-socket-service-params';
|
|
11
|
-
export * from './dynamo-nts-socket-
|
|
11
|
+
export * from './dynamo-nts-socket-presence';
|
|
12
12
|
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
|
|
2
2
|
// SERVICES
|
|
3
|
-
export * from '../_services/dynamo-nts-app';
|
|
4
3
|
export * from '../_services/dynamo-nts-app-extended';
|
|
5
4
|
export * from '../_services/dynamo-nts-global.service';
|
|
6
5
|
export * from '../_services/dynamo-nts-routing-module.service';
|
|
7
6
|
export * from '../_services/dynamo-nts-shared.service';
|
|
7
|
+
export * from '../_services/dynamo-nts-socket.service';
|
|
8
|
+
|
|
9
|
+
// INTERFACES
|
|
10
|
+
export * from '../_interfaces/global-service-settings.interface';
|
|
11
|
+
export * from '../_interfaces/port-settings.interface';
|
|
12
|
+
export * from '../_interfaces/certification-settings.interface';
|
|
8
13
|
|
|
9
14
|
// MODELS
|
|
10
15
|
export * from '../_models/dynamo-nts-app-params';
|
|
11
16
|
export * from '../_models/dynamo-nts-endpoint-params';
|
|
12
17
|
export * from '../_models/dynamo-nts-global-settings';
|
|
13
18
|
export * from '../_models/dynamo-nts-routing-module-settings';
|
|
14
|
-
export * from '../_models/dynamo-nts-socket-
|
|
19
|
+
export * from '../_models/dynamo-nts-socket-presence';
|
|
15
20
|
|
|
16
21
|
// ENUMS
|
|
17
22
|
export * from '../_enums/dynamo-nts-route-security.enum';
|
|
@@ -5,6 +5,11 @@ export * from '../_services/dynamo-nts-global.service';
|
|
|
5
5
|
export * from '../_services/dynamo-nts-routing-module.service';
|
|
6
6
|
export * from '../_services/dynamo-nts-shared.service';
|
|
7
7
|
|
|
8
|
+
// INTERFACES
|
|
9
|
+
export * from '../_interfaces/global-service-settings.interface';
|
|
10
|
+
export * from '../_interfaces/port-settings.interface';
|
|
11
|
+
export * from '../_interfaces/certification-settings.interface';
|
|
12
|
+
|
|
8
13
|
// MODELS
|
|
9
14
|
export * from '../_models/dynamo-nts-app-params';
|
|
10
15
|
export * from '../_models/dynamo-nts-endpoint-params';
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
import * as SocketIO from 'socket.io';
|
|
3
3
|
import * as Http from 'http';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
6
|
+
|
|
6
7
|
import { DynamoNTS_App } from './dynamo-nts-app';
|
|
8
|
+
import { DynamoNTS_RouteSecurity } from '../_enums/dynamo-nts-route-security.enum';
|
|
7
9
|
import { DynamoNTS_SocketService } from './dynamo-nts-socket.service';
|
|
8
10
|
import { DynamoNTS_SocketSecurity } from '../_enums/dynamo-nts-socket-security.enum';
|
|
9
|
-
import { Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* This will be the MAIN service of our server project,
|
|
@@ -170,6 +171,7 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
170
171
|
}
|
|
171
172
|
httpSocketServer = Http.createServer(this.openExpress);
|
|
172
173
|
}
|
|
174
|
+
|
|
173
175
|
if (this.socketSecurity !== DynamoNTS_RouteSecurity.open) {
|
|
174
176
|
if (!this.httpsServer) {
|
|
175
177
|
if (this.cert) {
|
|
@@ -219,9 +221,11 @@ export abstract class DynamoNTS_AppExtended extends DynamoNTS_App {
|
|
|
219
221
|
if (service.security === DynamoNTS_SocketSecurity.open) {
|
|
220
222
|
if (this.debugLog) console.log(`\nsocket setup (open): ${service.name}:${service.port}`);
|
|
221
223
|
service.setupSocketServer(new SocketIO.Server(httpSocketServer));
|
|
224
|
+
|
|
222
225
|
} else if (service.security === DynamoNTS_SocketSecurity.secure) {
|
|
223
226
|
if (this.debugLog) console.log(`\nsocket setup (secure): ${service.name}:${service.port}`);
|
|
224
227
|
service.setupSocketServer(new SocketIO.Server(this.httpsServer));
|
|
228
|
+
|
|
225
229
|
} else {
|
|
226
230
|
let error = new Error(`INVALID Socket Service security: ${service.security} on ${service.name}`);
|
|
227
231
|
let errorStack: string[] = error.stack.split('\n');
|
|
@@ -1,28 +1,22 @@
|
|
|
1
1
|
|
|
2
|
-
import { DynamoNTS_AppParams } from '../_models/dynamo-nts-app-params';
|
|
3
2
|
import Mongoose = require("mongoose");
|
|
4
3
|
import Express = require("express");
|
|
5
4
|
import * as Https from 'https';
|
|
6
5
|
import * as FileSystem from 'fs';
|
|
7
6
|
import * as BodyParser from 'body-parser';
|
|
8
7
|
|
|
8
|
+
import { Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
9
|
+
|
|
10
|
+
import { DynamoNTS_AppParams } from '../_models/dynamo-nts-app-params';
|
|
9
11
|
import { DynamoNTS_SingletonService } from './dynamo-nts-singleton.service';
|
|
10
12
|
import { DynamoNTS_RouteSecurity } from '../_enums/dynamo-nts-route-security.enum';
|
|
11
13
|
import { DynamoNTS_RoutingModule } from './dynamo-nts-routing-module.service';
|
|
12
14
|
import { DynamoNTS_EndpointParams } from '../_models/dynamo-nts-endpoint-params';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
keyPath: FileSystem.PathLike,
|
|
19
|
-
certPath: FileSystem.PathLike,
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface DynamoNTS_PortSettings {
|
|
23
|
-
httpPort?: number,
|
|
24
|
-
httpsPort?: number,
|
|
25
|
-
}
|
|
15
|
+
import { DynamoNTS_GlobalService } from './dynamo-nts-global.service';
|
|
16
|
+
import { DynamoNTS_PortSettings } from '../_interfaces/port-settings.interface';
|
|
17
|
+
import { DynamoNTS_CertificationSettings } from '../_interfaces/certification-settings.interface';
|
|
18
|
+
import { DynamoNTS_GlobalServiceSettings } from '../_interfaces/global-service-settings.interface';
|
|
19
|
+
import { dynamoNTS_GlobalSettings } from '../_constants/dynamo-nts-global-settings';
|
|
26
20
|
|
|
27
21
|
/**
|
|
28
22
|
* This will be the MAIN service of our server project,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
import { Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import { DynamoNTS_SingletonService } from './dynamo-nts-singleton.service';
|
|
6
|
+
import { DynamoNTS_EndpointParams } from '../_models/dynamo-nts-endpoint-params';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Basic controller for endpoint handlings
|
|
@@ -31,6 +31,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
31
31
|
|
|
32
32
|
depKey?: string;
|
|
33
33
|
depDBServiceKey?: string;
|
|
34
|
+
depKeyIsUnique?: boolean;
|
|
34
35
|
private depDataDBService: DynamoNTS_DBService<any>;
|
|
35
36
|
|
|
36
37
|
dataParams: Dynamo_DataParams;
|
|
@@ -116,7 +117,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
116
117
|
status: 417,
|
|
117
118
|
errorCode: 'NTS-DS0-GI1',
|
|
118
119
|
addECToUserMsg: true,
|
|
119
|
-
message: `ID is missing! (maybe you wanted to use getDataByDependencyId() instead...) (${this.dataParams.dataName})`,
|
|
120
|
+
message: `getDataById failed, ID is missing! (maybe you wanted to use getDataByDependencyId() instead...) (${this.dataParams.dataName})`,
|
|
120
121
|
userMessage: this.defaultErrorUserMsg
|
|
121
122
|
});
|
|
122
123
|
}
|
|
@@ -155,7 +156,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
155
156
|
status: 417,
|
|
156
157
|
errorCode: 'NTS-DS0-GD1',
|
|
157
158
|
addECToUserMsg: true,
|
|
158
|
-
message: `
|
|
159
|
+
message: `getDataByDependencyId failed, dependencyDataIdKey is missing from service! (${this.dataParams.dataName})`,
|
|
159
160
|
userMessage: this.defaultErrorUserMsg
|
|
160
161
|
});
|
|
161
162
|
}
|
|
@@ -165,14 +166,14 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
165
166
|
status: 417,
|
|
166
167
|
errorCode: 'NTS-DS0-GD2',
|
|
167
168
|
addECToUserMsg: true,
|
|
168
|
-
message:
|
|
169
|
+
message: `getDataByDependencyId failed, ${this.depKey} is missing! (${this.dataParams.dataName})`,
|
|
169
170
|
userMessage: this.defaultErrorUserMsg
|
|
170
171
|
});
|
|
171
172
|
}
|
|
172
173
|
|
|
173
174
|
const dataExists: T = await this.dataDBService.getDataByDependencyId(dependencyId ?? this.data[this.depKey]).catch(error => {
|
|
174
175
|
if (error?.errorCode === 'NTS-DBS-GD2') {
|
|
175
|
-
Dynamo_Log.warn(`getDataByDependencyId ${this.dataParams.dataName} (${this.depKey}: ${dependencyId ?? this.data[this.depKey]}) didn't found any.`);
|
|
176
|
+
Dynamo_Log.warn(`getDataByDependencyId failed; ${this.dataParams.dataName} (${this.depKey}: ${dependencyId ?? this.data[this.depKey]}) didn't found any.`);
|
|
176
177
|
return null;
|
|
177
178
|
} else {
|
|
178
179
|
throw error;
|
|
@@ -220,7 +221,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
220
221
|
status: 417,
|
|
221
222
|
errorCode: 'NTS-DS0-GLD2',
|
|
222
223
|
addECToUserMsg: true,
|
|
223
|
-
message:
|
|
224
|
+
message: `getDataListByDependencyId failed, ${this.depKey} is missing (${this.dataParams.dataName})`,
|
|
224
225
|
userMessage: this.defaultErrorUserMsg
|
|
225
226
|
});
|
|
226
227
|
}
|
|
@@ -517,7 +518,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
517
518
|
});
|
|
518
519
|
}
|
|
519
520
|
|
|
520
|
-
if (this.
|
|
521
|
+
if (this.depKeyIsUnique) {
|
|
521
522
|
dataExists = await this.getDataByDependencyId(null, true);
|
|
522
523
|
|
|
523
524
|
if (dataExists) {
|
|
@@ -551,7 +552,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
551
552
|
status: 417,
|
|
552
553
|
errorCode: 'NTS-DS0-SD0',
|
|
553
554
|
addECToUserMsg: true,
|
|
554
|
-
message: `
|
|
555
|
+
message: `saveData was unsuccessful (${this.dataParams.dataName})`,
|
|
555
556
|
userMessage: this.defaultErrorUserMsg,
|
|
556
557
|
error: error
|
|
557
558
|
});
|
|
@@ -569,7 +570,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
569
570
|
status: 417,
|
|
570
571
|
errorCode: 'NTS-DS0-DD1',
|
|
571
572
|
addECToUserMsg: true,
|
|
572
|
-
message: `ID is missing! (${this.dataParams.dataName})` ,
|
|
573
|
+
message: `deleteData failed, ID is missing! (${this.dataParams.dataName})` ,
|
|
573
574
|
userMessage: this.defaultErrorUserMsg,
|
|
574
575
|
});
|
|
575
576
|
}
|
|
@@ -613,7 +614,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
613
614
|
status: 422,
|
|
614
615
|
errorCode: 'NTS-DS0-VD1',
|
|
615
616
|
addECToUserMsg: true,
|
|
616
|
-
message:
|
|
617
|
+
message: `validateForSave failed, ${this.dataParams.modelParams[i].key} is missing! (${this.dataParams.modelParams[i].required ? 'required' : 'index'}) (${this.dataParams.dataName})`,
|
|
617
618
|
userMessage: this.defaultValidationErrorUserMsg
|
|
618
619
|
});
|
|
619
620
|
}
|
|
@@ -626,7 +627,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
626
627
|
status: 422,
|
|
627
628
|
errorCode: 'NTS-DS0-VD2',
|
|
628
629
|
addECToUserMsg: true,
|
|
629
|
-
message:
|
|
630
|
+
message: `validateForSave failed, ${this.dataParams.modelParams[i].key} is not a date! (${this.dataParams.dataName})`,
|
|
630
631
|
userMessage: this.defaultValidationErrorUserMsg
|
|
631
632
|
});
|
|
632
633
|
}
|
|
@@ -661,9 +662,14 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
661
662
|
const dependencyParam: Dynamo_DataPropertyParams = this.dataParams.modelParams.find((modelParams: Dynamo_DataPropertyParams) => modelParams.isDependencyHook);
|
|
662
663
|
if (dependencyParam) {
|
|
663
664
|
this.depKey = dependencyParam.key;
|
|
665
|
+
|
|
664
666
|
if (dependencyParam.dependencyDataName) {
|
|
665
667
|
this.depDBServiceKey = dependencyParam.dependencyDataName;
|
|
666
668
|
}
|
|
669
|
+
|
|
670
|
+
if (dependencyParam.unique) {
|
|
671
|
+
this.depKeyIsUnique = true;
|
|
672
|
+
}
|
|
667
673
|
}
|
|
668
674
|
}
|
|
669
675
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
import * as mongoose from 'mongoose';
|
|
3
3
|
import { Schema } from 'mongoose';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Dynamo_Metadata, Dynamo_DataParams, Dynamo_DataPropertyParams, Dynamo_Error
|
|
7
|
+
} from '@futdevpro/fsm-dynamo';
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
*
|
|
@@ -47,7 +50,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata, F extends T = any, U
|
|
|
47
50
|
status: 204,
|
|
48
51
|
errorCode: 'NTS-DBS-CD1',
|
|
49
52
|
addECToUserMsg: true,
|
|
50
|
-
message: `save ${this.dataParams.dbName} result not found! (NTS DB)`,
|
|
53
|
+
message: `createData failed, save ${this.dataParams.dbName} result not found! (NTS DB)`,
|
|
51
54
|
userMessage: this.defaultErrorUserMsg
|
|
52
55
|
});
|
|
53
56
|
}
|
|
@@ -59,7 +62,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata, F extends T = any, U
|
|
|
59
62
|
status: 422,
|
|
60
63
|
errorCode: 'NTS-DBS-CD0',
|
|
61
64
|
addECToUserMsg: true,
|
|
62
|
-
message: `Create new ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
|
|
65
|
+
message: `createData failed, Create new ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
|
|
63
66
|
userMessage: this.defaultErrorUserMsg,
|
|
64
67
|
error
|
|
65
68
|
});
|
|
@@ -93,7 +96,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata, F extends T = any, U
|
|
|
93
96
|
status: 204,
|
|
94
97
|
errorCode: 'NTS-DBS-FU1',
|
|
95
98
|
addECToUserMsg: true,
|
|
96
|
-
message: `modify ${this.dataParams.dbName} result not found! (NTS DB)`,
|
|
99
|
+
message: `modifyData failed, modify ${this.dataParams.dbName} result not found! (NTS DB)`,
|
|
97
100
|
userMessage: this.defaultErrorUserMsg,
|
|
98
101
|
});
|
|
99
102
|
}
|
|
@@ -102,7 +105,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata, F extends T = any, U
|
|
|
102
105
|
status: 417,
|
|
103
106
|
errorCode: 'NTS-DBS-FU0',
|
|
104
107
|
addECToUserMsg: true,
|
|
105
|
-
message: `
|
|
108
|
+
message: `modifyData ${this.dataParams.dbName} was unsuccessful (NTS DB)`,
|
|
106
109
|
userMessage: this.defaultErrorUserMsg,
|
|
107
110
|
error
|
|
108
111
|
});
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
import { Dynamo_Metadata, Dynamo_DataParams, Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
import { DynamoNTS_GlobalServiceSettings } from '../_interfaces/global-service-settings.interface';
|
|
6
|
+
import { DynamoNTS_AppParams } from '../_models/dynamo-nts-app-params';
|
|
5
7
|
|
|
6
8
|
import { DynamoNTS_AuthService } from './dynamo-nts-auth.service';
|
|
7
9
|
import { DynamoNTS_DBServiceCollection } from './dynamo-nts-db-service-collection.service';
|
|
@@ -11,23 +13,6 @@ import { DynamoNTS_SingletonService } from './dynamo-nts-singleton.service';
|
|
|
11
13
|
import { DynamoNTS_SocketServiceCollection } from './dynamo-nts-socket-service-collection.service';
|
|
12
14
|
import { DynamoNTS_SocketService } from './dynamo-nts-socket.service';
|
|
13
15
|
|
|
14
|
-
export interface DynamoNTS_GlobalServiceSettings {
|
|
15
|
-
/**
|
|
16
|
-
* You need to setup your Own Auth Service extending the DynamoBEAuthService class
|
|
17
|
-
*/
|
|
18
|
-
authService?: DynamoNTS_AuthService,
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* You can setup your Own Email Service extending the DynamoBEEmailServiceCollection class
|
|
22
|
-
*/
|
|
23
|
-
emailServiceCollection?: DynamoNTS_EmailServiceCollection,
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* you can setup data tables by passing a DynamoBEDataParams list at this point
|
|
27
|
-
*/
|
|
28
|
-
dbModels: Dynamo_DataParams[],
|
|
29
|
-
}
|
|
30
|
-
|
|
31
16
|
/**
|
|
32
17
|
* This is the main Global/Core Service Collection used by DynamoBE,
|
|
33
18
|
* you also can use this to access main services as
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DynamoNTS_Shared } from './dynamo-nts-shared.service';
|
|
2
|
+
|
|
3
|
+
describe('DynamoNTS_Shared', () => {
|
|
4
|
+
it('fns should be accessible', () => {
|
|
5
|
+
expect(DynamoNTS_Shared.getIpFromRequest).toBeTruthy();
|
|
6
|
+
expect(DynamoNTS_Shared.getLocationDataByRequest).toBeTruthy();
|
|
7
|
+
expect(DynamoNTS_Shared.getLocationByIp).toBeTruthy();
|
|
8
|
+
expect(DynamoNTS_Shared.prompt).toBeTruthy();
|
|
9
|
+
});
|
|
10
|
+
});
|