@futdevpro/nts-dynamo 1.3.47 → 1.3.48
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/dynamobe-global.settings.js +6 -4
- package/lib/_enums/data-model-type.enum.js +5 -3
- package/lib/_enums/dynamobe-data-service-function.enum.js +5 -3
- package/lib/_enums/dynamobe-route-security.enum.js +5 -3
- package/lib/_enums/http/http-call-type.enum.js +5 -3
- package/lib/_enums/http/http-response-type.enum.js +5 -3
- package/lib/_enums/index.js +10 -8
- package/lib/_enums/log-style.enum.js +5 -3
- package/lib/_enums/predefined-data-types.enum.js +5 -3
- package/lib/_models/dynamobe-api-call-params.js +7 -3
- package/lib/_models/dynamobe-app-params.js +5 -2
- package/lib/_models/dynamobe-data-model-params.js +5 -2
- package/lib/_models/dynamobe-endpoint-control.js +23 -20
- package/lib/_models/dynamobe-global-settings.js +2 -1
- package/lib/_models/fullstack-models/control-models/daily-usage-data.js +5 -2
- package/lib/_models/fullstack-models/control-models/dynamobe-data-property-params.js +7 -4
- package/lib/_models/fullstack-models/control-models/dynamobe-error.js +5 -2
- package/lib/_models/fullstack-models/control-models/geo-ip-location.js +2 -1
- package/lib/_models/fullstack-models/control-models/usage-action.js +5 -2
- package/lib/_models/fullstack-models/control-models/usage-data.js +5 -2
- package/lib/_models/fullstack-models/data-models/custom-data.js +7 -4
- package/lib/_models/fullstack-models/data-models/metadata.js +5 -2
- package/lib/_models/fullstack-models/data-models/usage-session.js +7 -4
- package/lib/_models/index.js +17 -15
- package/lib/_modules/index.js +7 -5
- package/lib/_modules/test-route/custom-data.service.js +9 -6
- package/lib/_modules/test-route/test-controller.js +33 -30
- package/lib/_modules/usage-route/usage-controller.js +31 -28
- package/lib/_modules/usage-route/usage.service.js +24 -21
- package/lib/_services/dynamobe-api.service.js +29 -26
- package/lib/_services/dynamobe-app.js +12 -8
- package/lib/_services/dynamobe-auth.service.js +9 -6
- package/lib/_services/dynamobe-controller.service.js +6 -3
- package/lib/_services/dynamobe-data.service.js +32 -29
- package/lib/_services/dynamobe-db-service-collection.service.js +6 -3
- package/lib/_services/dynamobe-db.service.js +52 -49
- package/lib/_services/dynamobe-email-service-collection.service.js +6 -3
- package/lib/_services/dynamobe-email.service.js +18 -15
- package/lib/_services/dynamobe-global.service.js +8 -5
- package/lib/_services/dynamobe-routing-module.service.js +29 -26
- package/lib/_services/dynamobe-server.js +37 -34
- package/lib/_services/dynamobe-shared.service.js +34 -30
- package/lib/_services/dynamobe-singleton.service.js +5 -2
- package/lib/_services/index.js +17 -15
- package/lib/index.js +7 -5
- package/lib/tsconfig.tsbuildinfo +2 -12
- package/package.json +1 -1
- package/tsconfig.json +7 -7
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DBE_Global_S = void 0;
|
|
4
|
+
const dynamobe_route_security_enum_1 = require("../_enums/dynamobe-route-security.enum");
|
|
5
|
+
const dynamobe_singleton_service_1 = require("./dynamobe-singleton.service");
|
|
6
|
+
class DBE_Global_S extends dynamobe_singleton_service_1.DynamoBESingletonService {
|
|
4
7
|
constructor() {
|
|
5
8
|
super(...arguments);
|
|
6
9
|
this.globalSettings = {
|
|
7
|
-
defaultRouteSecurity: DynamoBERouteSecurity.open,
|
|
10
|
+
defaultRouteSecurity: dynamobe_route_security_enum_1.DynamoBERouteSecurity.open,
|
|
8
11
|
logSetup: false,
|
|
9
12
|
logRequests: true,
|
|
10
13
|
logRequestsContent: true,
|
|
@@ -78,4 +81,4 @@ export class DBE_Global_S extends DynamoBESingletonService {
|
|
|
78
81
|
return this.instance.emailServiceCollection;
|
|
79
82
|
}
|
|
80
83
|
}
|
|
81
|
-
|
|
84
|
+
exports.DBE_Global_S = DBE_Global_S;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DynamoBERountingModule = void 0;
|
|
4
|
+
const express_1 = require("express");
|
|
5
|
+
const dynamobe_route_security_enum_1 = require("../_enums/dynamobe-route-security.enum");
|
|
6
|
+
const http_call_type_enum_1 = require("../_enums/http/http-call-type.enum");
|
|
7
|
+
const dynamobe_error_1 = require("../_models/fullstack-models/control-models/dynamobe-error");
|
|
8
|
+
const dynamobe_global_service_1 = require("./dynamobe-global.service");
|
|
9
|
+
class DynamoBERountingModule {
|
|
7
10
|
constructor(set) {
|
|
8
11
|
this.endpoints = [];
|
|
9
|
-
this.openRouter = Router();
|
|
10
|
-
this.secureRouter = Router();
|
|
11
|
-
this.log = DBE_Global_S.getGlobalSettings().logSetup;
|
|
12
|
+
this.openRouter = express_1.Router();
|
|
13
|
+
this.secureRouter = express_1.Router();
|
|
14
|
+
this.log = dynamobe_global_service_1.DBE_Global_S.getGlobalSettings().logSetup;
|
|
12
15
|
this.route = set.route;
|
|
13
16
|
this.controllers = set.controllers;
|
|
14
17
|
this.setupRoutes();
|
|
@@ -37,7 +40,7 @@ export class DynamoBERountingModule {
|
|
|
37
40
|
this.security = endpoint.security;
|
|
38
41
|
}
|
|
39
42
|
else if (this.security !== endpoint.security) {
|
|
40
|
-
this.security = DynamoBERouteSecurity.both;
|
|
43
|
+
this.security = dynamobe_route_security_enum_1.DynamoBERouteSecurity.both;
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
46
|
if (this.log)
|
|
@@ -51,59 +54,59 @@ export class DynamoBERountingModule {
|
|
|
51
54
|
throw error;
|
|
52
55
|
}
|
|
53
56
|
try {
|
|
54
|
-
if (endpoint.security !== DynamoBERouteSecurity.secure) {
|
|
57
|
+
if (endpoint.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.secure) {
|
|
55
58
|
this.mountOpenRoute(endpoint);
|
|
56
59
|
}
|
|
57
|
-
if (endpoint.security !== DynamoBERouteSecurity.open) {
|
|
60
|
+
if (endpoint.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.open) {
|
|
58
61
|
this.mountSecureRoute(endpoint);
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
64
|
catch (error) {
|
|
62
|
-
throw new DynamoBEError({ message: `DYNAMOBEERROR: Failed to mount routes.`, error });
|
|
65
|
+
throw new dynamobe_error_1.DynamoBEError({ message: `DYNAMOBEERROR: Failed to mount routes.`, error });
|
|
63
66
|
}
|
|
64
67
|
});
|
|
65
68
|
}
|
|
66
69
|
mountOpenRoute(endpointParams) {
|
|
67
70
|
switch (endpointParams.type) {
|
|
68
|
-
case HttpCallType.get:
|
|
71
|
+
case http_call_type_enum_1.HttpCallType.get:
|
|
69
72
|
this.openRouter.get(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
|
|
70
73
|
break;
|
|
71
|
-
case HttpCallType.post:
|
|
74
|
+
case http_call_type_enum_1.HttpCallType.post:
|
|
72
75
|
this.openRouter.post(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
|
|
73
76
|
break;
|
|
74
|
-
case HttpCallType.put:
|
|
77
|
+
case http_call_type_enum_1.HttpCallType.put:
|
|
75
78
|
this.openRouter.put(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
|
|
76
79
|
break;
|
|
77
|
-
case HttpCallType.patch:
|
|
80
|
+
case http_call_type_enum_1.HttpCallType.patch:
|
|
78
81
|
this.openRouter.patch(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
|
|
79
82
|
break;
|
|
80
|
-
case HttpCallType.delete:
|
|
83
|
+
case http_call_type_enum_1.HttpCallType.delete:
|
|
81
84
|
this.openRouter.delete(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
|
|
82
85
|
break;
|
|
83
86
|
default:
|
|
84
|
-
throw new DynamoBEError({ message: `DYNAMOBEERROR: INVALID route type: ${endpointParams.type} - ${endpointParams.name}` });
|
|
87
|
+
throw new dynamobe_error_1.DynamoBEError({ message: `DYNAMOBEERROR: INVALID route type: ${endpointParams.type} - ${endpointParams.name}` });
|
|
85
88
|
}
|
|
86
89
|
}
|
|
87
90
|
mountSecureRoute(endpointParams) {
|
|
88
91
|
switch (endpointParams.type) {
|
|
89
|
-
case HttpCallType.get:
|
|
92
|
+
case http_call_type_enum_1.HttpCallType.get:
|
|
90
93
|
this.secureRouter.get(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
|
|
91
94
|
break;
|
|
92
|
-
case HttpCallType.post:
|
|
95
|
+
case http_call_type_enum_1.HttpCallType.post:
|
|
93
96
|
this.secureRouter.post(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
|
|
94
97
|
break;
|
|
95
|
-
case HttpCallType.put:
|
|
98
|
+
case http_call_type_enum_1.HttpCallType.put:
|
|
96
99
|
this.secureRouter.put(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
|
|
97
100
|
break;
|
|
98
|
-
case HttpCallType.patch:
|
|
101
|
+
case http_call_type_enum_1.HttpCallType.patch:
|
|
99
102
|
this.secureRouter.patch(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
|
|
100
103
|
break;
|
|
101
|
-
case HttpCallType.delete:
|
|
104
|
+
case http_call_type_enum_1.HttpCallType.delete:
|
|
102
105
|
this.secureRouter.delete(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
|
|
103
106
|
break;
|
|
104
107
|
default:
|
|
105
|
-
throw new DynamoBEError({ message: `DYNAMOBEERROR: INVALID route type: ${endpointParams.type} - ${endpointParams.name}` });
|
|
108
|
+
throw new dynamobe_error_1.DynamoBEError({ message: `DYNAMOBEERROR: INVALID route type: ${endpointParams.type} - ${endpointParams.name}` });
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
|
-
|
|
112
|
+
exports.DynamoBERountingModule = DynamoBERountingModule;
|
|
@@ -1,48 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DynamoBEServer = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const Express = tslib_1.__importStar(require("express"));
|
|
3
6
|
/* import Express = require("express"); */
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
const Https = tslib_1.__importStar(require("https"));
|
|
8
|
+
const FileSystem = tslib_1.__importStar(require("fs"));
|
|
9
|
+
const BodyParser = tslib_1.__importStar(require("body-parser"));
|
|
10
|
+
const dynamobe_singleton_service_1 = require("./dynamobe-singleton.service");
|
|
11
|
+
const dynamobe_route_security_enum_1 = require("../_enums/dynamobe-route-security.enum");
|
|
12
|
+
const dynamobe_shared_service_1 = require("./dynamobe-shared.service");
|
|
13
|
+
const dynamobe_global_service_1 = require("./dynamobe-global.service");
|
|
14
|
+
class DynamoBEServer extends dynamobe_singleton_service_1.DynamoBESingletonService {
|
|
12
15
|
constructor() {
|
|
13
16
|
super();
|
|
14
|
-
this.log = DBE_Global_S.getGlobalSettings().logSetup;
|
|
17
|
+
this.log = dynamobe_global_service_1.DBE_Global_S.getGlobalSettings().logSetup;
|
|
15
18
|
this.setupRoutingModules();
|
|
16
19
|
this.setSecurity();
|
|
17
20
|
this.initExpresses();
|
|
18
21
|
this.startExpresses();
|
|
19
|
-
if (this.security !== DynamoBERouteSecurity.secure) {
|
|
22
|
+
if (this.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.secure) {
|
|
20
23
|
this.mountOpenRoutes();
|
|
21
24
|
}
|
|
22
|
-
if (this.security !== DynamoBERouteSecurity.open && this.cert) {
|
|
25
|
+
if (this.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.open && this.cert) {
|
|
23
26
|
this.mountSecureRoutes();
|
|
24
27
|
}
|
|
25
28
|
if (this.log)
|
|
26
29
|
console.log(`\nRoutes mounted.... server using security: ${this.security}`);
|
|
27
30
|
}
|
|
28
31
|
initExpresses() {
|
|
29
|
-
if (this.security !== DynamoBERouteSecurity.secure) {
|
|
32
|
+
if (this.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.secure) {
|
|
30
33
|
if (!this.httpPort) {
|
|
31
34
|
let errorMsg = `You have open routes, but httpPort is not set!` +
|
|
32
35
|
`\nsecurity: ${this.security}` +
|
|
33
36
|
`\nset httpPort in DynamoBEServer - setupRoutingModules() to enable secure routes.`;
|
|
34
37
|
errorMsg += '\n\nThe routes setted to use open server:';
|
|
35
38
|
this.routingModules.forEach((module) => {
|
|
36
|
-
if (module.security != DynamoBERouteSecurity.secure) {
|
|
39
|
+
if (module.security != dynamobe_route_security_enum_1.DynamoBERouteSecurity.secure) {
|
|
37
40
|
errorMsg += `\n ${module.route} (security: ${module.security}) \n subroutes using open sever:`;
|
|
38
41
|
module.endpoints.forEach((endpoint) => {
|
|
39
|
-
if (endpoint.security != DynamoBERouteSecurity.secure) {
|
|
42
|
+
if (endpoint.security != dynamobe_route_security_enum_1.DynamoBERouteSecurity.secure) {
|
|
40
43
|
errorMsg += `\n ${endpoint.endpoint} (security: ${endpoint.security})`;
|
|
41
44
|
}
|
|
42
45
|
});
|
|
43
46
|
}
|
|
44
47
|
});
|
|
45
|
-
DBE_Shared.logError(errorMsg);
|
|
48
|
+
dynamobe_shared_service_1.DBE_Shared.logError(errorMsg);
|
|
46
49
|
let error = new Error('Open routes cannot be established!');
|
|
47
50
|
let errorStack = error.stack.split('\n');
|
|
48
51
|
errorStack.splice(1, 2);
|
|
@@ -51,7 +54,7 @@ export class DynamoBEServer extends DynamoBESingletonService {
|
|
|
51
54
|
}
|
|
52
55
|
this.initOpenExpress();
|
|
53
56
|
}
|
|
54
|
-
if (this.security !== DynamoBERouteSecurity.open) {
|
|
57
|
+
if (this.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.open) {
|
|
55
58
|
if (!this.cert || !this.httpsPort) {
|
|
56
59
|
let errorMsg = `You have secure routes, but the certification paths or httpsPort are not set!` +
|
|
57
60
|
`\nsecurity: ${this.security}` +
|
|
@@ -64,16 +67,16 @@ export class DynamoBEServer extends DynamoBESingletonService {
|
|
|
64
67
|
`\nin DynamoBEServer - setupRoutingModules() to enable secure routes.`;
|
|
65
68
|
errorMsg += '\n\nThe routes setted to use secure server:';
|
|
66
69
|
this.routingModules.forEach((module) => {
|
|
67
|
-
if (module.security != DynamoBERouteSecurity.open) {
|
|
70
|
+
if (module.security != dynamobe_route_security_enum_1.DynamoBERouteSecurity.open) {
|
|
68
71
|
errorMsg += `\n ${module.route} (security: ${module.security}) \n subroutes using secure sever:`;
|
|
69
72
|
module.endpoints.forEach((endpoint) => {
|
|
70
|
-
if (endpoint.security != DynamoBERouteSecurity.open) {
|
|
73
|
+
if (endpoint.security != dynamobe_route_security_enum_1.DynamoBERouteSecurity.open) {
|
|
71
74
|
errorMsg += `\n ${endpoint.endpoint} (security: ${endpoint.security})`;
|
|
72
75
|
}
|
|
73
76
|
});
|
|
74
77
|
}
|
|
75
78
|
});
|
|
76
|
-
DBE_Shared.logError(errorMsg);
|
|
79
|
+
dynamobe_shared_service_1.DBE_Shared.logError(errorMsg);
|
|
77
80
|
let error = new Error('Secure routes cannot be established!');
|
|
78
81
|
let errorStack = error.stack.split('\n');
|
|
79
82
|
errorStack.splice(1, 2);
|
|
@@ -99,36 +102,36 @@ export class DynamoBEServer extends DynamoBESingletonService {
|
|
|
99
102
|
this.httpsServer = Https.createServer(options, this.secureExpress);
|
|
100
103
|
}
|
|
101
104
|
startExpresses() {
|
|
102
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
if (this.security !== DynamoBERouteSecurity.open) {
|
|
105
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
if (this.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.open) {
|
|
104
107
|
this.httpsServer
|
|
105
108
|
.listen(this.httpsPort, 'localhost', 0, () => {
|
|
106
|
-
DBE_Shared.logSuccess(`\nHTTPS (secure) server is listening on port ${this.httpsPort}\n`);
|
|
109
|
+
dynamobe_shared_service_1.DBE_Shared.logSuccess(`\nHTTPS (secure) server is listening on port ${this.httpsPort}\n`);
|
|
107
110
|
})
|
|
108
111
|
.on('error', (error) => {
|
|
109
|
-
DBE_Shared.logError(`https (secure) server ERROR`, error);
|
|
112
|
+
dynamobe_shared_service_1.DBE_Shared.logError(`https (secure) server ERROR`, error);
|
|
110
113
|
})
|
|
111
114
|
.on('uncaughtException', (ex) => {
|
|
112
|
-
DBE_Shared.logWarning(`https (secure) server uncaughtException`, ex);
|
|
115
|
+
dynamobe_shared_service_1.DBE_Shared.logWarning(`https (secure) server uncaughtException`, ex);
|
|
113
116
|
});
|
|
114
117
|
}
|
|
115
|
-
if (this.security !== DynamoBERouteSecurity.secure) {
|
|
118
|
+
if (this.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.secure) {
|
|
116
119
|
this.openExpress
|
|
117
120
|
.listen(this.httpPort, () => {
|
|
118
|
-
DBE_Shared.logSuccess(`\nHTTP (-open-) server is listening on port ${this.httpPort}\n`);
|
|
121
|
+
dynamobe_shared_service_1.DBE_Shared.logSuccess(`\nHTTP (-open-) server is listening on port ${this.httpPort}\n`);
|
|
119
122
|
})
|
|
120
123
|
.on('error', (error) => {
|
|
121
|
-
DBE_Shared.logError(`http (-open-) server ERROR`, error);
|
|
124
|
+
dynamobe_shared_service_1.DBE_Shared.logError(`http (-open-) server ERROR`, error);
|
|
122
125
|
})
|
|
123
126
|
.on('uncaughtException', (ex) => {
|
|
124
|
-
DBE_Shared.logWarning(`http (-open-) server uncaughtException`, ex);
|
|
127
|
+
dynamobe_shared_service_1.DBE_Shared.logWarning(`http (-open-) server uncaughtException`, ex);
|
|
125
128
|
});
|
|
126
129
|
}
|
|
127
130
|
});
|
|
128
131
|
}
|
|
129
132
|
mountSecureRoutes() {
|
|
130
133
|
this.routingModules.forEach((module) => {
|
|
131
|
-
if (module.security !== DynamoBERouteSecurity.open) {
|
|
134
|
+
if (module.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.open) {
|
|
132
135
|
if (this.log)
|
|
133
136
|
console.log(`route mount (secure): ${module.route}`);
|
|
134
137
|
const existingRoutes = this.routingModules.filter((mod) => mod.route === module.route);
|
|
@@ -145,7 +148,7 @@ export class DynamoBEServer extends DynamoBESingletonService {
|
|
|
145
148
|
}
|
|
146
149
|
mountOpenRoutes() {
|
|
147
150
|
this.routingModules.forEach((module) => {
|
|
148
|
-
if (module.security !== DynamoBERouteSecurity.secure) {
|
|
151
|
+
if (module.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.secure) {
|
|
149
152
|
if (this.log)
|
|
150
153
|
console.log(`route mount (open): ${module.route}`);
|
|
151
154
|
const existingRoutes = this.routingModules.filter((mod) => mod.route === module.route);
|
|
@@ -166,9 +169,9 @@ export class DynamoBEServer extends DynamoBESingletonService {
|
|
|
166
169
|
this.security = module.security;
|
|
167
170
|
}
|
|
168
171
|
else if (this.security !== module.security) {
|
|
169
|
-
this.security = DynamoBERouteSecurity.both;
|
|
172
|
+
this.security = dynamobe_route_security_enum_1.DynamoBERouteSecurity.both;
|
|
170
173
|
}
|
|
171
174
|
});
|
|
172
175
|
}
|
|
173
176
|
}
|
|
174
|
-
|
|
177
|
+
exports.DynamoBEServer = DynamoBEServer;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dynamoTitleLog = exports.DBE_Shared = exports.year = exports.month = exports.week = exports.day = exports.hour = exports.minute = exports.second = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const GeoIp = tslib_1.__importStar(require("geoip-lite"));
|
|
6
|
+
const log_style_enum_1 = require("../_enums/log-style.enum");
|
|
7
|
+
const dynamobe_error_1 = require("../_models/fullstack-models/control-models/dynamobe-error");
|
|
8
|
+
exports.second = 1000;
|
|
9
|
+
exports.minute = exports.second * 60;
|
|
10
|
+
exports.hour = exports.minute * 60;
|
|
11
|
+
exports.day = exports.hour * 24;
|
|
12
|
+
exports.week = exports.day * 7;
|
|
13
|
+
exports.month = exports.day * 30.4368499;
|
|
14
|
+
exports.year = exports.day * 365.242199;
|
|
15
|
+
class DBE_Shared {
|
|
12
16
|
/**
|
|
13
17
|
* returns remapped object list by path list
|
|
14
18
|
* @param objList object list to map
|
|
@@ -145,16 +149,16 @@ export class DBE_Shared {
|
|
|
145
149
|
if (typeof date === 'string') {
|
|
146
150
|
date = new Date(date);
|
|
147
151
|
}
|
|
148
|
-
return (+date / year);
|
|
152
|
+
return (+date / exports.year);
|
|
149
153
|
}
|
|
150
154
|
static getHour(date) {
|
|
151
155
|
if (typeof date === 'string') {
|
|
152
156
|
date = new Date(date);
|
|
153
157
|
}
|
|
154
|
-
return (+date / hour);
|
|
158
|
+
return (+date / exports.hour);
|
|
155
159
|
}
|
|
156
160
|
static getDateByAge(age) {
|
|
157
|
-
return new Date(+new Date() - (year * age));
|
|
161
|
+
return new Date(+new Date() - (exports.year * age));
|
|
158
162
|
}
|
|
159
163
|
static getDistanceInKilometres(from, to) {
|
|
160
164
|
const R = 6371; // kilometres
|
|
@@ -177,7 +181,7 @@ export class DBE_Shared {
|
|
|
177
181
|
return distanceInKm / (Math.cos(this.toRadians(latitude)) * 111.320);
|
|
178
182
|
}
|
|
179
183
|
else {
|
|
180
|
-
throw new DynamoBEError({ status: 417, message: 'When using getLocationDegByKilometers for longitude, you need to give latitude!' });
|
|
184
|
+
throw new dynamobe_error_1.DynamoBEError({ status: 417, message: 'When using getLocationDegByKilometers for longitude, you need to give latitude!' });
|
|
181
185
|
}
|
|
182
186
|
}
|
|
183
187
|
}
|
|
@@ -192,19 +196,19 @@ export class DBE_Shared {
|
|
|
192
196
|
return schema;
|
|
193
197
|
}
|
|
194
198
|
static oneHourAgo() {
|
|
195
|
-
return new Date(+new Date() - hour);
|
|
199
|
+
return new Date(+new Date() - exports.hour);
|
|
196
200
|
}
|
|
197
201
|
static oneDayAgo() {
|
|
198
|
-
return new Date(+new Date() - day);
|
|
202
|
+
return new Date(+new Date() - exports.day);
|
|
199
203
|
}
|
|
200
204
|
static oneWeekAgo() {
|
|
201
|
-
return new Date(+new Date() - week);
|
|
205
|
+
return new Date(+new Date() - exports.week);
|
|
202
206
|
}
|
|
203
207
|
static oneMonthAgo() {
|
|
204
|
-
return new Date(+new Date() - month);
|
|
208
|
+
return new Date(+new Date() - exports.month);
|
|
205
209
|
}
|
|
206
210
|
static oneYearAgo() {
|
|
207
|
-
return new Date(+new Date() - year);
|
|
211
|
+
return new Date(+new Date() - exports.year);
|
|
208
212
|
}
|
|
209
213
|
static getIpFromRequest(request) {
|
|
210
214
|
/* console.log('TESTTTT route:\n',
|
|
@@ -238,7 +242,7 @@ export class DBE_Shared {
|
|
|
238
242
|
console.log(styleSets);
|
|
239
243
|
}
|
|
240
244
|
static resetLogStyle() {
|
|
241
|
-
console.log(LogStyle.reset);
|
|
245
|
+
console.log(log_style_enum_1.LogStyle.reset);
|
|
242
246
|
}
|
|
243
247
|
static logStyle(input, styles, dontReset) {
|
|
244
248
|
let result = '';
|
|
@@ -247,36 +251,37 @@ export class DBE_Shared {
|
|
|
247
251
|
});
|
|
248
252
|
result += input;
|
|
249
253
|
if (!dontReset) {
|
|
250
|
-
result += LogStyle.reset;
|
|
254
|
+
result += log_style_enum_1.LogStyle.reset;
|
|
251
255
|
}
|
|
252
256
|
return result;
|
|
253
257
|
}
|
|
254
258
|
static logSuccess(message, ...optionalParams) {
|
|
255
259
|
if (0 < optionalParams.length) {
|
|
256
|
-
console.error(`${LogStyle.green}${LogStyle.bright}${message}`, ...optionalParams, LogStyle.reset);
|
|
260
|
+
console.error(`${log_style_enum_1.LogStyle.green}${log_style_enum_1.LogStyle.bright}${message}`, ...optionalParams, log_style_enum_1.LogStyle.reset);
|
|
257
261
|
}
|
|
258
262
|
else {
|
|
259
|
-
console.error(`${LogStyle.green}${LogStyle.bright}${message}${LogStyle.reset}`);
|
|
263
|
+
console.error(`${log_style_enum_1.LogStyle.green}${log_style_enum_1.LogStyle.bright}${message}${log_style_enum_1.LogStyle.reset}`);
|
|
260
264
|
}
|
|
261
265
|
}
|
|
262
266
|
static logError(message, ...optionalParams) {
|
|
263
267
|
if (0 < optionalParams.length) {
|
|
264
|
-
console.error(`${LogStyle.red}${LogStyle.bright}${message}`, ...optionalParams, LogStyle.reset);
|
|
268
|
+
console.error(`${log_style_enum_1.LogStyle.red}${log_style_enum_1.LogStyle.bright}${message}`, ...optionalParams, log_style_enum_1.LogStyle.reset);
|
|
265
269
|
}
|
|
266
270
|
else {
|
|
267
|
-
console.error(`${LogStyle.red}${LogStyle.bright}${message}${LogStyle.reset}`);
|
|
271
|
+
console.error(`${log_style_enum_1.LogStyle.red}${log_style_enum_1.LogStyle.bright}${message}${log_style_enum_1.LogStyle.reset}`);
|
|
268
272
|
}
|
|
269
273
|
}
|
|
270
274
|
static logWarning(message, ...optionalParams) {
|
|
271
275
|
if (0 < optionalParams.length) {
|
|
272
|
-
console.warn(`${LogStyle.yellow}${LogStyle.bright}${message}`, ...optionalParams, LogStyle.reset);
|
|
276
|
+
console.warn(`${log_style_enum_1.LogStyle.yellow}${log_style_enum_1.LogStyle.bright}${message}`, ...optionalParams, log_style_enum_1.LogStyle.reset);
|
|
273
277
|
}
|
|
274
278
|
else {
|
|
275
|
-
console.warn(`${LogStyle.yellow}${LogStyle.bright}${message}${LogStyle.reset}`);
|
|
279
|
+
console.warn(`${log_style_enum_1.LogStyle.yellow}${log_style_enum_1.LogStyle.bright}${message}${log_style_enum_1.LogStyle.reset}`);
|
|
276
280
|
}
|
|
277
281
|
}
|
|
278
282
|
}
|
|
279
|
-
|
|
283
|
+
exports.DBE_Shared = DBE_Shared;
|
|
284
|
+
exports.dynamoTitleLog = `\x1b[32m \x1b[1m
|
|
280
285
|
|
|
281
286
|
||||||VVV VVV /// |||V ||| //VV |||V /||| /|||||V
|
|
282
287
|
||| VVV VVV /// |||VV ||| ///VVV |||VV //||| /// VVV
|
|
@@ -287,4 +292,3 @@ export const dynamoTitleLog = `\x1b[32m \x1b[1m
|
|
|
287
292
|
||||||/// ||| ||| V||| ||| ||| ||| ||| V|||||/
|
|
288
293
|
|
|
289
294
|
By Future Development Program Kft.\x1b[0m`.replace(/V/g, '\\');
|
|
290
|
-
//# sourceMappingURL=dynamobe-shared.service.js.map
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DynamoBESingletonService = void 0;
|
|
4
|
+
class DynamoBESingletonService {
|
|
2
5
|
/// --- --- --- SINGLETON --- --- --- ///
|
|
3
6
|
// SINGLETON services are using private constructor
|
|
4
7
|
constructor() { }
|
|
@@ -9,4 +12,4 @@ export class DynamoBESingletonService {
|
|
|
9
12
|
return this.instance;
|
|
10
13
|
}
|
|
11
14
|
}
|
|
12
|
-
|
|
15
|
+
exports.DynamoBESingletonService = DynamoBESingletonService;
|
package/lib/_services/index.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
1
4
|
// SERVICES
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
tslib_1.__exportStar(require("./dynamobe-api.service"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./dynamobe-app"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./dynamobe-auth.service"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./dynamobe-controller.service"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./dynamobe-data.service"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./dynamobe-db-service-collection.service"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./dynamobe-db.service"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./dynamobe-email-service-collection.service"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./dynamobe-email.service"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./dynamobe-global.service"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./dynamobe-routing-module.service"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./dynamobe-server"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./dynamobe-shared.service"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./dynamobe-singleton.service"), exports);
|
|
16
19
|
/*
|
|
17
20
|
import { DynamoBEApiService } from './dynamobe-api.service';
|
|
18
21
|
import { DynamoBEApp } from './dynamobe-app';
|
|
@@ -35,4 +38,3 @@ module.exports = {
|
|
|
35
38
|
DynamoBEEmailServiceCollection, DynamoBEEmailService, DBE_Global_S,
|
|
36
39
|
DynamoBERountingModule, DynamoBEServer, DBE_Shared, DynamoBESingletonService
|
|
37
40
|
} */
|
|
38
|
-
//# sourceMappingURL=index.js.map
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
1
4
|
// ENUMS
|
|
2
|
-
|
|
5
|
+
tslib_1.__exportStar(require("./_enums/index"), exports);
|
|
3
6
|
// MODULES
|
|
4
|
-
|
|
7
|
+
tslib_1.__exportStar(require("./_models/index"), exports);
|
|
5
8
|
// MODULES
|
|
6
|
-
|
|
9
|
+
tslib_1.__exportStar(require("./_modules/index"), exports);
|
|
7
10
|
// SERVICES
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
11
|
+
tslib_1.__exportStar(require("./_services/index"), exports);
|
package/lib/tsconfig.tsbuildinfo
CHANGED
|
@@ -26,11 +26,6 @@
|
|
|
26
26
|
"signature": "5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06",
|
|
27
27
|
"affectsGlobalScope": false
|
|
28
28
|
},
|
|
29
|
-
"../node_modules/typescript/lib/lib.dom.d.ts": {
|
|
30
|
-
"version": "9affb0a2ddc57df5b8174c0af96c288d697a262e5bc9ca1f544c999dc64a91e6",
|
|
31
|
-
"signature": "9affb0a2ddc57df5b8174c0af96c288d697a262e5bc9ca1f544c999dc64a91e6",
|
|
32
|
-
"affectsGlobalScope": true
|
|
33
|
-
},
|
|
34
29
|
"../node_modules/typescript/lib/lib.es2015.core.d.ts": {
|
|
35
30
|
"version": "63e0cc12d0f77394094bd19e84464f9840af0071e5b9358ced30511efef1d8d2",
|
|
36
31
|
"signature": "63e0cc12d0f77394094bd19e84464f9840af0071e5b9358ced30511efef1d8d2",
|
|
@@ -745,23 +740,19 @@
|
|
|
745
740
|
"options": {
|
|
746
741
|
"incremental": true,
|
|
747
742
|
"target": 2,
|
|
748
|
-
"module":
|
|
743
|
+
"module": 1,
|
|
749
744
|
"lib": [
|
|
750
|
-
"lib.es2018.d.ts",
|
|
751
|
-
"lib.dom.d.ts",
|
|
752
745
|
"lib.es2015.d.ts"
|
|
753
746
|
],
|
|
754
|
-
"sourceMap": true,
|
|
755
|
-
"downlevelIteration": true,
|
|
756
747
|
"allowJs": true,
|
|
757
748
|
"declaration": true,
|
|
758
749
|
"declarationMap": true,
|
|
759
750
|
"outDir": "./",
|
|
760
751
|
"importHelpers": true,
|
|
761
752
|
"esModuleInterop": true,
|
|
762
|
-
"moduleResolution": 2,
|
|
763
753
|
"skipLibCheck": true,
|
|
764
754
|
"forceConsistentCasingInFileNames": true,
|
|
755
|
+
"resolveJsonModule": true,
|
|
765
756
|
"configFilePath": "../tsconfig.json"
|
|
766
757
|
},
|
|
767
758
|
"referencedMap": {
|
|
@@ -2028,7 +2019,6 @@
|
|
|
2028
2019
|
"../node_modules/axios/index.d.ts",
|
|
2029
2020
|
"../node_modules/mongoose/index.d.ts",
|
|
2030
2021
|
"../node_modules/tslib/tslib.d.ts",
|
|
2031
|
-
"../node_modules/typescript/lib/lib.dom.d.ts",
|
|
2032
2022
|
"../node_modules/typescript/lib/lib.es2015.collection.d.ts",
|
|
2033
2023
|
"../node_modules/typescript/lib/lib.es2015.core.d.ts",
|
|
2034
2024
|
"../node_modules/typescript/lib/lib.es2015.d.ts",
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
/* Basic Options */
|
|
4
4
|
"incremental": true, /* Enable incremental compilation */
|
|
5
|
-
"target": "es2015",
|
|
5
|
+
/* "target": "es2015",
|
|
6
6
|
"module": "es2020",
|
|
7
7
|
"lib": [
|
|
8
8
|
"es2018",
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
],
|
|
12
12
|
"sourceMap": true,
|
|
13
13
|
"downlevelIteration": true,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
"moduleResolution": "Node", */
|
|
15
|
+
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
|
|
16
|
+
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
|
17
|
+
"lib": ["es6"], /* Specify library files to be included in the compilation. */
|
|
17
18
|
"allowJs": true, /* Allow javascript files to be compiled. */
|
|
18
19
|
// "checkJs": true, /* Report errors in .js files. */
|
|
19
20
|
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
|
@@ -58,7 +59,6 @@
|
|
|
58
59
|
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
59
60
|
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
60
61
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
61
|
-
"moduleResolution": "Node",
|
|
62
62
|
|
|
63
63
|
/* Source Map Options */
|
|
64
64
|
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
72
72
|
|
|
73
73
|
"skipLibCheck": true,
|
|
74
|
-
"forceConsistentCasingInFileNames": true
|
|
74
|
+
"forceConsistentCasingInFileNames": true,
|
|
75
75
|
|
|
76
76
|
/* Advanced Options */
|
|
77
|
-
|
|
77
|
+
"resolveJsonModule": true /* Include modules imported with '.json' extension */
|
|
78
78
|
},
|
|
79
79
|
"include": [
|
|
80
80
|
"src"
|