@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
|
@@ -1,140 +1,140 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DynamoNTS_EndpointParams = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const dynamo_nts_global_service_1 = require("../_services/dynamo-nts-global.service");
|
|
6
|
-
const _constants_1 = require("../_constants");
|
|
7
|
-
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
8
|
-
/**
|
|
9
|
-
* High level endpoint for API
|
|
10
|
-
* used for specific events such as saving or getting data,
|
|
11
|
-
* triggering events, logging in or out, and much more
|
|
12
|
-
*/
|
|
13
|
-
class DynamoNTS_EndpointParams {
|
|
14
|
-
constructor(set) {
|
|
15
|
-
var _a, _b, _c, _d, _e, _f;
|
|
16
|
-
try {
|
|
17
|
-
this.name = (_a = set.name) !== null && _a !== void 0 ? _a : set.endpoint;
|
|
18
|
-
this.security = (_b = set.security) !== null && _b !== void 0 ? _b : _constants_1.dynamoNTS_GlobalSettings.defaultRouteSecurity;
|
|
19
|
-
this.type = set.type;
|
|
20
|
-
this.endpoint = set.endpoint;
|
|
21
|
-
if (!this.endpoint) {
|
|
22
|
-
throw new fsm_dynamo_1.Dynamo_Error({
|
|
23
|
-
status: 406,
|
|
24
|
-
errorCode: 'NTS-EP0-C00',
|
|
25
|
-
addECToUserMsg: true,
|
|
26
|
-
message: 'trying to create DynamoNTS_EndpointParams without endpoint value',
|
|
27
|
-
userMessage: 'We encountered an unhandled Server Error, please contact the responsible development team.'
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
let pathParts = this.endpoint.split('/');
|
|
31
|
-
pathParts = pathParts.filter((part) => part[0] === ':');
|
|
32
|
-
pathParts = pathParts.map((part) => part = part.replace(':', ''));
|
|
33
|
-
this.pathParams = pathParts;
|
|
34
|
-
this.preProcessess = (_c = set.preProcessess) !== null && _c !== void 0 ? _c : [];
|
|
35
|
-
this.tasks = set.tasks;
|
|
36
|
-
this.logRequest = (_d = set.logRequest) !== null && _d !== void 0 ? _d : _constants_1.dynamoNTS_GlobalSettings.logRequest;
|
|
37
|
-
this.logRequestsContent = (_e = set.logRequestsContent) !== null && _e !== void 0 ? _e : _constants_1.dynamoNTS_GlobalSettings.logRequestsContent;
|
|
38
|
-
this.logResponseContent = (_f = set.logResponseContent) !== null && _f !== void 0 ? _f : _constants_1.dynamoNTS_GlobalSettings.logResponseContent;
|
|
39
|
-
if (this.logRequest) {
|
|
40
|
-
this.preProcessess.unshift(this.getPreLog());
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
fsm_dynamo_1.Dynamo_Log.error(`\nEndpoint params setup failed: name: '${set.name}' (security: ${set.security}) endpoint: ${set.endpoint}\nERROR:\n`, error);
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
* @returns
|
|
51
|
-
*/
|
|
52
|
-
getPreLog() {
|
|
53
|
-
return (req, res, next) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
try {
|
|
55
|
-
if (this.logRequest) {
|
|
56
|
-
if (this.logRequestsContent) {
|
|
57
|
-
let inputs = '';
|
|
58
|
-
for (let i = 0; i < this.pathParams.length; i++) {
|
|
59
|
-
inputs += ` ${this.pathParams[i]}: ${req.params[this.pathParams[i]]}`;
|
|
60
|
-
if (i + 1 < this.pathParams.length || req.body && `${req.body}` !== '{}') {
|
|
61
|
-
inputs += ',';
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (req.body && 0 < Object.keys(req.body).length) {
|
|
65
|
-
console.log(`==> incoming ${this.name} request...${inputs} body:`, req.body);
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
console.log(`==> incoming ${this.name} request...${inputs}`);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
console.log(`==> incoming ${this.name} request...`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
next();
|
|
76
|
-
}
|
|
77
|
-
catch (error) {
|
|
78
|
-
this.error(res, error);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
*
|
|
84
|
-
* @returns
|
|
85
|
-
*/
|
|
86
|
-
getTasksExecution() {
|
|
87
|
-
return (req, res) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
var _a;
|
|
89
|
-
try {
|
|
90
|
-
const issuer = (_a = dynamo_nts_global_service_1.DynamoNTS_GlobalService === null || dynamo_nts_global_service_1.DynamoNTS_GlobalService === void 0 ? void 0 : dynamo_nts_global_service_1.DynamoNTS_GlobalService.getAuthService()) === null || _a === void 0 ? void 0 : _a.getAccountIdFromRequest(req);
|
|
91
|
-
for (let i = 0; i < this.tasks.length; i++) {
|
|
92
|
-
yield this.tasks[i](req, res, issuer);
|
|
93
|
-
}
|
|
94
|
-
if (this.logRequest) {
|
|
95
|
-
if (this.logResponseContent) {
|
|
96
|
-
fsm_dynamo_1.Dynamo_Log.success(` <<<===== ${this.name} result sent.`);
|
|
97
|
-
fsm_dynamo_1.Dynamo_Log.success('sorry, the logResponseContent is not implemented yet.');
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
fsm_dynamo_1.Dynamo_Log.success(` <<<===== ${this.name} result sent.`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
catch (error) {
|
|
105
|
-
this.error(res, error);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
*
|
|
111
|
-
* @param res
|
|
112
|
-
* @param error
|
|
113
|
-
*/
|
|
114
|
-
error(res, error) {
|
|
115
|
-
var _a;
|
|
116
|
-
try {
|
|
117
|
-
fsm_dynamo_1.Dynamo_Log.error(`Endpoint catched an error. ${this.name} (${this.endpoint})` +
|
|
118
|
-
`\nERROR:`, error, '\n');
|
|
119
|
-
res.status((_a = error === null || error === void 0 ? void 0 : error.status) !== null && _a !== void 0 ? _a : 501);
|
|
120
|
-
res.send(error);
|
|
121
|
-
if (this.logRequest) {
|
|
122
|
-
if (this.logResponseContent) {
|
|
123
|
-
fsm_dynamo_1.Dynamo_Log.error(` <<<===== ${this.name} error sent.` +
|
|
124
|
-
(error === null || error === void 0 ? void 0 : error.userMessage) ? ` (${error.userMessage})` : '');
|
|
125
|
-
fsm_dynamo_1.Dynamo_Log.error('sorry, the logResponseContent is not implemented yet.');
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
fsm_dynamo_1.Dynamo_Log.error(` <<<===== ${this.name} error sent.` +
|
|
129
|
-
(error === null || error === void 0 ? void 0 : error.userMessage) ? ` (${error.userMessage})` : '');
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
catch (error) {
|
|
134
|
-
console.error(`DYNAMO MULTILEVEL ERROR:DynamoNTS_EndpointParams:error: (${this.name}, ${this.endpoint})` +
|
|
135
|
-
`\nERROR:`, error, '\n');
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
exports.DynamoNTS_EndpointParams = DynamoNTS_EndpointParams;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DynamoNTS_EndpointParams = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const dynamo_nts_global_service_1 = require("../_services/dynamo-nts-global.service");
|
|
6
|
+
const _constants_1 = require("../_constants");
|
|
7
|
+
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
8
|
+
/**
|
|
9
|
+
* High level endpoint for API
|
|
10
|
+
* used for specific events such as saving or getting data,
|
|
11
|
+
* triggering events, logging in or out, and much more
|
|
12
|
+
*/
|
|
13
|
+
class DynamoNTS_EndpointParams {
|
|
14
|
+
constructor(set) {
|
|
15
|
+
var _a, _b, _c, _d, _e, _f;
|
|
16
|
+
try {
|
|
17
|
+
this.name = (_a = set.name) !== null && _a !== void 0 ? _a : set.endpoint;
|
|
18
|
+
this.security = (_b = set.security) !== null && _b !== void 0 ? _b : _constants_1.dynamoNTS_GlobalSettings.defaultRouteSecurity;
|
|
19
|
+
this.type = set.type;
|
|
20
|
+
this.endpoint = set.endpoint;
|
|
21
|
+
if (!this.endpoint) {
|
|
22
|
+
throw new fsm_dynamo_1.Dynamo_Error({
|
|
23
|
+
status: 406,
|
|
24
|
+
errorCode: 'NTS-EP0-C00',
|
|
25
|
+
addECToUserMsg: true,
|
|
26
|
+
message: 'trying to create DynamoNTS_EndpointParams without endpoint value',
|
|
27
|
+
userMessage: 'We encountered an unhandled Server Error, please contact the responsible development team.'
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
let pathParts = this.endpoint.split('/');
|
|
31
|
+
pathParts = pathParts.filter((part) => part[0] === ':');
|
|
32
|
+
pathParts = pathParts.map((part) => part = part.replace(':', ''));
|
|
33
|
+
this.pathParams = pathParts;
|
|
34
|
+
this.preProcessess = (_c = set.preProcessess) !== null && _c !== void 0 ? _c : [];
|
|
35
|
+
this.tasks = set.tasks;
|
|
36
|
+
this.logRequest = (_d = set.logRequest) !== null && _d !== void 0 ? _d : _constants_1.dynamoNTS_GlobalSettings.logRequest;
|
|
37
|
+
this.logRequestsContent = (_e = set.logRequestsContent) !== null && _e !== void 0 ? _e : _constants_1.dynamoNTS_GlobalSettings.logRequestsContent;
|
|
38
|
+
this.logResponseContent = (_f = set.logResponseContent) !== null && _f !== void 0 ? _f : _constants_1.dynamoNTS_GlobalSettings.logResponseContent;
|
|
39
|
+
if (this.logRequest) {
|
|
40
|
+
this.preProcessess.unshift(this.getPreLog());
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
fsm_dynamo_1.Dynamo_Log.error(`\nEndpoint params setup failed: name: '${set.name}' (security: ${set.security}) endpoint: ${set.endpoint}\nERROR:\n`, error);
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
getPreLog() {
|
|
53
|
+
return (req, res, next) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
try {
|
|
55
|
+
if (this.logRequest) {
|
|
56
|
+
if (this.logRequestsContent) {
|
|
57
|
+
let inputs = '';
|
|
58
|
+
for (let i = 0; i < this.pathParams.length; i++) {
|
|
59
|
+
inputs += ` ${this.pathParams[i]}: ${req.params[this.pathParams[i]]}`;
|
|
60
|
+
if (i + 1 < this.pathParams.length || req.body && `${req.body}` !== '{}') {
|
|
61
|
+
inputs += ',';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (req.body && 0 < Object.keys(req.body).length) {
|
|
65
|
+
console.log(`==> incoming ${this.name} request...${inputs} body:`, req.body);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
console.log(`==> incoming ${this.name} request...${inputs}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
console.log(`==> incoming ${this.name} request...`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
next();
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
this.error(res, error);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* @returns
|
|
85
|
+
*/
|
|
86
|
+
getTasksExecution() {
|
|
87
|
+
return (req, res) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
var _a;
|
|
89
|
+
try {
|
|
90
|
+
const issuer = (_a = dynamo_nts_global_service_1.DynamoNTS_GlobalService === null || dynamo_nts_global_service_1.DynamoNTS_GlobalService === void 0 ? void 0 : dynamo_nts_global_service_1.DynamoNTS_GlobalService.getAuthService()) === null || _a === void 0 ? void 0 : _a.getAccountIdFromRequest(req);
|
|
91
|
+
for (let i = 0; i < this.tasks.length; i++) {
|
|
92
|
+
yield this.tasks[i](req, res, issuer);
|
|
93
|
+
}
|
|
94
|
+
if (this.logRequest) {
|
|
95
|
+
if (this.logResponseContent) {
|
|
96
|
+
fsm_dynamo_1.Dynamo_Log.success(` <<<===== ${this.name} result sent.`);
|
|
97
|
+
fsm_dynamo_1.Dynamo_Log.success('sorry, the logResponseContent is not implemented yet.');
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
fsm_dynamo_1.Dynamo_Log.success(` <<<===== ${this.name} result sent.`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
this.error(res, error);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
*
|
|
111
|
+
* @param res
|
|
112
|
+
* @param error
|
|
113
|
+
*/
|
|
114
|
+
error(res, error) {
|
|
115
|
+
var _a;
|
|
116
|
+
try {
|
|
117
|
+
fsm_dynamo_1.Dynamo_Log.error(`Endpoint catched an error. ${this.name} (${this.endpoint})` +
|
|
118
|
+
`\nERROR:`, error, '\n');
|
|
119
|
+
res.status((_a = error === null || error === void 0 ? void 0 : error.status) !== null && _a !== void 0 ? _a : 501);
|
|
120
|
+
res.send(error);
|
|
121
|
+
if (this.logRequest) {
|
|
122
|
+
if (this.logResponseContent) {
|
|
123
|
+
fsm_dynamo_1.Dynamo_Log.error(` <<<===== ${this.name} error sent.` +
|
|
124
|
+
(error === null || error === void 0 ? void 0 : error.userMessage) ? ` (${error.userMessage})` : '');
|
|
125
|
+
fsm_dynamo_1.Dynamo_Log.error('sorry, the logResponseContent is not implemented yet.');
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
fsm_dynamo_1.Dynamo_Log.error(` <<<===== ${this.name} error sent.` +
|
|
129
|
+
(error === null || error === void 0 ? void 0 : error.userMessage) ? ` (${error.userMessage})` : '');
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
console.error(`DYNAMO MULTILEVEL ERROR:DynamoNTS_EndpointParams:error: (${this.name}, ${this.endpoint})` +
|
|
135
|
+
`\nERROR:`, error, '\n');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.DynamoNTS_EndpointParams = DynamoNTS_EndpointParams;
|
|
140
140
|
//# sourceMappingURL=dynamo-nts-endpoint-params.js.map
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { DynamoNTS_RouteSecurity } from '../_enums/dynamo-nts-route-security.enum';
|
|
2
|
-
import { DynamoNTS_SocketSecurity } from '../_enums/dynamo-nts-socket-security.enum';
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param logRequestsContent only will log if the specific logRequest is also true
|
|
7
|
-
*
|
|
8
|
-
* @param logEventContent only will log if the specific socket event is also set to log
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
export interface DynamoNTS_GlobalSettings {
|
|
12
|
-
/**
|
|
13
|
-
* this will be used as the main baseUrl for the application,
|
|
14
|
-
* this is not required, but we suggest to use at least a '/api' as base route
|
|
15
|
-
*/
|
|
16
|
-
baseUrl: string;
|
|
17
|
-
/**
|
|
18
|
-
* this sets the default security for routes
|
|
19
|
-
*/
|
|
20
|
-
defaultRouteSecurity: DynamoNTS_RouteSecurity;
|
|
21
|
-
/**
|
|
22
|
-
* this sets the default security for sockets
|
|
23
|
-
*/
|
|
24
|
-
defaultSocketSecurity: DynamoNTS_SocketSecurity;
|
|
25
|
-
/**
|
|
26
|
-
* this setting will enable debug logs for setting up the application
|
|
27
|
-
*/
|
|
28
|
-
logSetup?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* this is an application wide default setting for route debug logs
|
|
31
|
-
*/
|
|
32
|
-
logRequest?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* this is an application wide default setting for route debug logs
|
|
35
|
-
*/
|
|
36
|
-
logRequestsContent?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* this is an application wide default setting for route debug logs
|
|
39
|
-
*/
|
|
40
|
-
logResponseContent?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* this is an application wide default setting for socket debug logs
|
|
43
|
-
*/
|
|
44
|
-
logMainSocketEvent?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* this is an application wide default setting for socket debug logs
|
|
47
|
-
*/
|
|
48
|
-
logAllSocketEvent?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* this is an application wide default setting for socket debug logs
|
|
51
|
-
*/
|
|
52
|
-
logEventContent?: boolean;
|
|
53
|
-
}
|
|
1
|
+
import { DynamoNTS_RouteSecurity } from '../_enums/dynamo-nts-route-security.enum';
|
|
2
|
+
import { DynamoNTS_SocketSecurity } from '../_enums/dynamo-nts-socket-security.enum';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* @param logRequestsContent only will log if the specific logRequest is also true
|
|
7
|
+
*
|
|
8
|
+
* @param logEventContent only will log if the specific socket event is also set to log
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export interface DynamoNTS_GlobalSettings {
|
|
12
|
+
/**
|
|
13
|
+
* this will be used as the main baseUrl for the application,
|
|
14
|
+
* this is not required, but we suggest to use at least a '/api' as base route
|
|
15
|
+
*/
|
|
16
|
+
baseUrl: string;
|
|
17
|
+
/**
|
|
18
|
+
* this sets the default security for routes
|
|
19
|
+
*/
|
|
20
|
+
defaultRouteSecurity: DynamoNTS_RouteSecurity;
|
|
21
|
+
/**
|
|
22
|
+
* this sets the default security for sockets
|
|
23
|
+
*/
|
|
24
|
+
defaultSocketSecurity: DynamoNTS_SocketSecurity;
|
|
25
|
+
/**
|
|
26
|
+
* this setting will enable debug logs for setting up the application
|
|
27
|
+
*/
|
|
28
|
+
logSetup?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* this is an application wide default setting for route debug logs
|
|
31
|
+
*/
|
|
32
|
+
logRequest?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* this is an application wide default setting for route debug logs
|
|
35
|
+
*/
|
|
36
|
+
logRequestsContent?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* this is an application wide default setting for route debug logs
|
|
39
|
+
*/
|
|
40
|
+
logResponseContent?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* this is an application wide default setting for socket debug logs
|
|
43
|
+
*/
|
|
44
|
+
logMainSocketEvent?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* this is an application wide default setting for socket debug logs
|
|
47
|
+
*/
|
|
48
|
+
logAllSocketEvent?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* this is an application wide default setting for socket debug logs
|
|
51
|
+
*/
|
|
52
|
+
logEventContent?: boolean;
|
|
53
|
+
}
|
|
54
54
|
//# sourceMappingURL=dynamo-nts-global-settings.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=dynamo-nts-global-settings.js.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { DynamoNTS_RouteSecurity } from '../_enums';
|
|
2
|
-
import { DynamoNTS_Controller } from '../_services';
|
|
3
|
-
/**
|
|
4
|
-
* This is a main route point handler, which collects a list of controllers for the API
|
|
5
|
-
*/
|
|
6
|
-
export interface DynamoNTS_RoutingModuleSettings {
|
|
7
|
-
/**
|
|
8
|
-
* main route of the module
|
|
9
|
-
*/
|
|
10
|
-
route: string;
|
|
11
|
-
/**
|
|
12
|
-
* the collection of controllers (sub-routes, with differentlogical parts, to different db elements)
|
|
13
|
-
*/
|
|
14
|
-
controllers: DynamoNTS_Controller[];
|
|
15
|
-
/**
|
|
16
|
-
* securityOverride will be used to create different security for a single module without changing the default security (http/https/both)
|
|
17
|
-
*/
|
|
18
|
-
securityOverride?: DynamoNTS_RouteSecurity;
|
|
19
|
-
}
|
|
1
|
+
import { DynamoNTS_RouteSecurity } from '../_enums';
|
|
2
|
+
import { DynamoNTS_Controller } from '../_services';
|
|
3
|
+
/**
|
|
4
|
+
* This is a main route point handler, which collects a list of controllers for the API
|
|
5
|
+
*/
|
|
6
|
+
export interface DynamoNTS_RoutingModuleSettings {
|
|
7
|
+
/**
|
|
8
|
+
* main route of the module
|
|
9
|
+
*/
|
|
10
|
+
route: string;
|
|
11
|
+
/**
|
|
12
|
+
* the collection of controllers (sub-routes, with differentlogical parts, to different db elements)
|
|
13
|
+
*/
|
|
14
|
+
controllers: DynamoNTS_Controller[];
|
|
15
|
+
/**
|
|
16
|
+
* securityOverride will be used to create different security for a single module without changing the default security (http/https/both)
|
|
17
|
+
*/
|
|
18
|
+
securityOverride?: DynamoNTS_RouteSecurity;
|
|
19
|
+
}
|
|
20
20
|
//# sourceMappingURL=dynamo-nts-routing-module-settings.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=dynamo-nts-routing-module-settings.js.map
|
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
import { DynamoNTS_SocketEvent } from '../_enums/http/socket-event.enum';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
import { DynamoNTS_SocketEvent } from '../_enums/http/socket-event.enum';
|
|
2
|
+
export type DynamoNTS_SocketEventPreprocessTask<T_EventContent> = (content?: any, issuer?: string) => Promise<T_EventContent>;
|
|
3
|
+
export type DynamoNTS_SocketEventTask = (content?: any, issuer?: string) => Promise<void>;
|
|
4
|
+
/**
|
|
5
|
+
* socket handling and clarification is under development
|
|
6
|
+
*/
|
|
7
|
+
export declare class DynamoNTS_SocketEventParams<T_EventContent> {
|
|
8
|
+
socketName?: string;
|
|
9
|
+
event: DynamoNTS_SocketEvent | string;
|
|
10
|
+
preProcessess?: DynamoNTS_SocketEventPreprocessTask<T_EventContent>[];
|
|
11
|
+
tasks: DynamoNTS_SocketEventTask[];
|
|
12
|
+
logEvent: boolean;
|
|
13
|
+
logEventContent: boolean;
|
|
14
|
+
constructor(set: {
|
|
15
|
+
socketName?: string;
|
|
16
|
+
event: DynamoNTS_SocketEvent | string;
|
|
17
|
+
preProcessess?: DynamoNTS_SocketEventPreprocessTask<T_EventContent>[];
|
|
18
|
+
tasks?: DynamoNTS_SocketEventTask[];
|
|
19
|
+
logEvent?: boolean;
|
|
20
|
+
logEventContent?: boolean;
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
getPreLog(): DynamoNTS_SocketEventPreprocessTask<T_EventContent>;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
executeEventTasks(issuer?: string, content?: T_EventContent): Promise<void>;
|
|
32
|
+
}
|
|
31
33
|
//# sourceMappingURL=dynamo-nts-socket-event-params.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamo-nts-socket-event-params.d.ts","sourceRoot":"","sources":["../../src/_models/dynamo-nts-socket-event-params.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"dynamo-nts-socket-event-params.d.ts","sourceRoot":"","sources":["../../src/_models/dynamo-nts-socket-event-params.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAIzE,MAAM,MAAM,mCAAmC,CAAC,cAAc,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;AAC9H,MAAM,MAAM,yBAAyB,GAAG,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1F;;GAEG;AACH,qBAAa,2BAA2B,CAAC,cAAc;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,qBAAqB,GAAG,MAAM,CAAC;IAEtC,aAAa,CAAC,EAAE,mCAAmC,CAAC,cAAc,CAAC,EAAE,CAAC;IACtE,KAAK,EAAE,yBAAyB,EAAE,CAAC;IAEnC,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;gBAGvB,GAAG,EAAE;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,KAAK,EAAE,qBAAqB,GAAG,MAAM,CAAC;QAEtC,aAAa,CAAC,EAAE,mCAAmC,CAAC,cAAc,CAAC,EAAE,CAAC;QACtE,KAAK,CAAC,EAAE,yBAAyB,EAAE,CAAC;QAEpC,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B;IA4BH;;;OAGG;IACH,SAAS,IAAI,mCAAmC,CAAC,cAAc,CAAC;IAiBhE;;;OAGG;IACG,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAalF"}
|