@futdevpro/nts-dynamo 1.5.49 → 1.5.51
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/_models/dynamo-nts-endpoint-params.d.ts.map +1 -1
- package/lib/_models/dynamo-nts-endpoint-params.js +11 -1
- package/lib/_models/dynamo-nts-endpoint-params.js.map +1 -1
- package/lib/_modules/test/test-controller.js +4 -4
- package/lib/_modules/test/test-controller.js.map +1 -1
- package/lib/_services/dynamo-nts-api.service.d.ts +1 -0
- package/lib/_services/dynamo-nts-api.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-api.service.js +6 -5
- package/lib/_services/dynamo-nts-api.service.js.map +1 -1
- package/lib/_services/dynamo-nts-auth.service.d.ts +1 -0
- package/lib/_services/dynamo-nts-auth.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-auth.service.js +3 -2
- package/lib/_services/dynamo-nts-auth.service.js.map +1 -1
- package/lib/_services/dynamo-nts-data.service.d.ts +2 -0
- package/lib/_services/dynamo-nts-data.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-data.service.js +26 -18
- package/lib/_services/dynamo-nts-data.service.js.map +1 -1
- package/lib/_services/dynamo-nts-db.service.d.ts +1 -0
- package/lib/_services/dynamo-nts-db.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-db.service.js +30 -25
- package/lib/_services/dynamo-nts-db.service.js.map +1 -1
- package/lib/_services/dynamo-nts-email.service.d.ts +1 -0
- package/lib/_services/dynamo-nts-email.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-email.service.js +5 -4
- package/lib/_services/dynamo-nts-email.service.js.map +1 -1
- package/lib/_services/dynamo-nts-routing-module.service.d.ts +1 -0
- package/lib/_services/dynamo-nts-routing-module.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-routing-module.service.js +4 -3
- package/lib/_services/dynamo-nts-routing-module.service.js.map +1 -1
- package/lib/_services/dynamo-nts-socket.service.d.ts +1 -0
- package/lib/_services/dynamo-nts-socket.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-socket.service.js +6 -2
- package/lib/_services/dynamo-nts-socket.service.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/src/_models/dynamo-nts-endpoint-params.ts +11 -1
- package/src/_modules/test/test-controller.ts +4 -4
- package/src/_services/dynamo-nts-api.service.ts +7 -5
- package/src/_services/dynamo-nts-auth.service.ts +4 -2
- package/src/_services/dynamo-nts-data.service.ts +27 -18
- package/src/_services/dynamo-nts-db.service.ts +31 -25
- package/src/_services/dynamo-nts-email.service.ts +6 -4
- package/src/_services/dynamo-nts-routing-module.service.ts +5 -3
- package/src/_services/dynamo-nts-socket.service.ts +13 -7
- package/futdevpro-nts-dynamo-01.05.40.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.41.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.42.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.43.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.44.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.45.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.47.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.49.tgz +0 -0
- package/lib/_constants/dynamo-nts-global.settings.d.ts +0 -3
- package/lib/_constants/dynamo-nts-global.settings.d.ts.map +0 -1
- package/lib/_constants/dynamo-nts-global.settings.js +0 -18
- package/lib/_constants/dynamo-nts-global.settings.js.map +0 -1
- package/lib/_constants/dynamobe-global.settings.d.ts +0 -3
- package/lib/_constants/dynamobe-global.settings.d.ts.map +0 -1
- package/lib/_constants/dynamobe-global.settings.js +0 -13
- package/lib/_constants/dynamobe-global.settings.js.map +0 -1
- package/lib/_enums/dynamobe-data-service-function.enum.d.ts +0 -8
- package/lib/_enums/dynamobe-data-service-function.enum.d.ts.map +0 -1
- package/lib/_enums/dynamobe-data-service-function.enum.js +0 -15
- package/lib/_enums/dynamobe-data-service-function.enum.js.map +0 -1
- package/lib/_enums/dynamobe-route-security.enum.d.ts +0 -6
- package/lib/_enums/dynamobe-route-security.enum.d.ts.map +0 -1
- package/lib/_enums/dynamobe-route-security.enum.js +0 -10
- package/lib/_enums/dynamobe-route-security.enum.js.map +0 -1
- package/lib/_enums/log-style.enum.d.ts +0 -26
- package/lib/_enums/log-style.enum.d.ts.map +0 -1
- package/lib/_enums/log-style.enum.js +0 -30
- package/lib/_enums/log-style.enum.js.map +0 -1
- package/lib/_models/dynamo-module-settings.d.ts +0 -4
- package/lib/_models/dynamo-module-settings.d.ts.map +0 -1
- package/lib/_models/dynamo-module-settings.js +0 -10
- package/lib/_models/dynamo-module-settings.js.map +0 -1
- package/lib/_models/dynamo-nts-socket-module-settings.d.ts +0 -19
- package/lib/_models/dynamo-nts-socket-module-settings.d.ts.map +0 -1
- package/lib/_models/dynamo-nts-socket-module-settings.js +0 -27
- package/lib/_models/dynamo-nts-socket-module-settings.js.map +0 -1
- package/lib/_models/dynamobe-api-call-params.d.ts +0 -37
- package/lib/_models/dynamobe-api-call-params.d.ts.map +0 -1
- package/lib/_models/dynamobe-api-call-params.js +0 -29
- package/lib/_models/dynamobe-api-call-params.js.map +0 -1
- package/lib/_models/dynamobe-app-params.d.ts +0 -18
- package/lib/_models/dynamobe-app-params.d.ts.map +0 -1
- package/lib/_models/dynamobe-app-params.js +0 -17
- package/lib/_models/dynamobe-app-params.js.map +0 -1
- package/lib/_models/dynamobe-data-model-params.d.ts +0 -1
- package/lib/_models/dynamobe-data-model-params.d.ts.map +0 -1
- package/lib/_models/dynamobe-data-model-params.js +0 -25
- package/lib/_models/dynamobe-data-model-params.js.map +0 -1
- package/lib/_models/dynamobe-endpoint-params.d.ts +0 -46
- package/lib/_models/dynamobe-endpoint-params.d.ts.map +0 -1
- package/lib/_models/dynamobe-endpoint-params.js +0 -117
- package/lib/_models/dynamobe-endpoint-params.js.map +0 -1
- package/lib/_models/dynamobe-global-settings.d.ts +0 -13
- package/lib/_models/dynamobe-global-settings.d.ts.map +0 -1
- package/lib/_models/dynamobe-global-settings.js +0 -3
- package/lib/_models/dynamobe-global-settings.js.map +0 -1
- package/lib/_modules/data-models.index.d.ts +0 -3
- package/lib/_modules/data-models.index.d.ts.map +0 -1
- package/lib/_modules/data-models.index.js +0 -6
- package/lib/_modules/data-models.index.js.map +0 -1
- package/lib/_services/dynamobe-api.service.d.ts +0 -19
- package/lib/_services/dynamobe-api.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-api.service.js +0 -167
- package/lib/_services/dynamobe-api.service.js.map +0 -1
- package/lib/_services/dynamobe-app.d.ts +0 -129
- package/lib/_services/dynamobe-app.d.ts.map +0 -1
- package/lib/_services/dynamobe-app.js +0 -238
- package/lib/_services/dynamobe-app.js.map +0 -1
- package/lib/_services/dynamobe-auth.service.d.ts +0 -54
- package/lib/_services/dynamobe-auth.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-auth.service.js +0 -46
- package/lib/_services/dynamobe-auth.service.js.map +0 -1
- package/lib/_services/dynamobe-controller.service.d.ts +0 -14
- package/lib/_services/dynamobe-controller.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-controller.service.js +0 -21
- package/lib/_services/dynamobe-controller.service.js.map +0 -1
- package/lib/_services/dynamobe-data.service.d.ts +0 -54
- package/lib/_services/dynamobe-data.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-data.service.js +0 -301
- package/lib/_services/dynamobe-data.service.js.map +0 -1
- package/lib/_services/dynamobe-db-service-collection.service.d.ts +0 -9
- package/lib/_services/dynamobe-db-service-collection.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-db-service-collection.service.js +0 -11
- package/lib/_services/dynamobe-db-service-collection.service.js.map +0 -1
- package/lib/_services/dynamobe-db.service.d.ts +0 -244
- package/lib/_services/dynamobe-db.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-db.service.js +0 -759
- package/lib/_services/dynamobe-db.service.js.map +0 -1
- package/lib/_services/dynamobe-email-service-collection.service.d.ts +0 -19
- package/lib/_services/dynamobe-email-service-collection.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-email-service-collection.service.js +0 -21
- package/lib/_services/dynamobe-email-service-collection.service.js.map +0 -1
- package/lib/_services/dynamobe-email.service.d.ts +0 -56
- package/lib/_services/dynamobe-email.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-email.service.js +0 -194
- package/lib/_services/dynamobe-email.service.js.map +0 -1
- package/lib/_services/dynamobe-global.service.d.ts +0 -62
- package/lib/_services/dynamobe-global.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-global.service.js +0 -107
- package/lib/_services/dynamobe-global.service.js.map +0 -1
- package/lib/_services/dynamobe-routing-module.service.d.ts +0 -42
- package/lib/_services/dynamobe-routing-module.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-routing-module.service.js +0 -146
- package/lib/_services/dynamobe-routing-module.service.js.map +0 -1
- package/lib/_services/dynamobe-shared-be.service.d.ts +0 -8
- package/lib/_services/dynamobe-shared-be.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-shared-be.service.js +0 -45
- package/lib/_services/dynamobe-shared-be.service.js.map +0 -1
- package/lib/_services/dynamobe-shared.service.d.ts +0 -26
- package/lib/_services/dynamobe-shared.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-shared.service.js +0 -63
- package/lib/_services/dynamobe-shared.service.js.map +0 -1
- package/lib/_services/dynamobe-singleton.service.d.ts +0 -9
- package/lib/_services/dynamobe-singleton.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-singleton.service.js +0 -19
- package/lib/_services/dynamobe-singleton.service.js.map +0 -1
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DynamoBEApiService = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const Axios = tslib_1.__importStar(require("axios"));
|
|
6
|
-
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
7
|
-
const http_call_type_enum_1 = require("../_enums/http/http-call-type.enum");
|
|
8
|
-
const http_response_type_enum_1 = require("../_enums/http/http-response-type.enum");
|
|
9
|
-
const dynamobe_shared_service_1 = require("./dynamobe-shared.service");
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
class DynamoBEApiService {
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
* @param callParams
|
|
17
|
-
* @param inputParams
|
|
18
|
-
* @returns
|
|
19
|
-
*/
|
|
20
|
-
static startApiCall(callParams, inputParams) {
|
|
21
|
-
var _a, _b, _c, _d;
|
|
22
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
try {
|
|
24
|
-
let a;
|
|
25
|
-
let url = callParams.baseUrl + callParams.endPoint;
|
|
26
|
-
const privateAxiosInstance = Axios.default.create();
|
|
27
|
-
if ((_a = callParams === null || callParams === void 0 ? void 0 : callParams.httpOptions) === null || _a === void 0 ? void 0 : _a.headers) {
|
|
28
|
-
for (const headerKey in callParams.httpOptions.headers) {
|
|
29
|
-
if (callParams.httpOptions.headers[headerKey]) {
|
|
30
|
-
privateAxiosInstance.defaults.headers.common[headerKey] = callParams.httpOptions.headers[headerKey];
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
dynamobe_shared_service_1.DBE_Shared.logError('DYNAMOBE ERROR: \n missing header:', headerKey, '\n\n', new Error());
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
if (inputParams === null || inputParams === void 0 ? void 0 : inputParams.pathParams) {
|
|
38
|
-
for (const pathParamKey in inputParams.pathParams) {
|
|
39
|
-
if (inputParams.pathParams[pathParamKey]) {
|
|
40
|
-
const paramType = typeof inputParams.pathParams[pathParamKey];
|
|
41
|
-
switch (paramType) {
|
|
42
|
-
case 'number':
|
|
43
|
-
url = url.replace(`:${pathParamKey}`, inputParams.pathParams[pathParamKey].toString());
|
|
44
|
-
break;
|
|
45
|
-
case 'string':
|
|
46
|
-
url = url.replace(`:${pathParamKey}`, inputParams.pathParams[pathParamKey]);
|
|
47
|
-
break;
|
|
48
|
-
default:
|
|
49
|
-
dynamobe_shared_service_1.DBE_Shared.logError(`DYNAMOBE ERROR: \n wrong path param type: (${pathParamKey}): ${paramType} \n${inputParams.pathParams[pathParamKey]}\nMUST BE string or number\n\n`, new Error());
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
dynamobe_shared_service_1.DBE_Shared.logError('DYNAMOBE ERROR: \n missing pathParam:', pathParamKey, '\n\n', new Error());
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/* if (inputParams?.queryParams) {
|
|
59
|
-
const httpParams = new HttpParams();
|
|
60
|
-
for (const queryParamKey in inputParams.queryParams) {
|
|
61
|
-
if (inputParams.queryParams[queryParamKey]) {
|
|
62
|
-
switch (typeof inputParams.queryParams[queryParamKey]) {
|
|
63
|
-
case 'number':
|
|
64
|
-
httpParams.set(queryParamKey, inputParams.queryParams[queryParamKey].toString());
|
|
65
|
-
break;
|
|
66
|
-
case 'string':
|
|
67
|
-
httpParams.set(queryParamKey, inputParams.queryParams[queryParamKey]);
|
|
68
|
-
break;
|
|
69
|
-
default:
|
|
70
|
-
console.error('DYNAMOBE ERROR: \n wrong query param type', '\n\n', new Error());
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
callParams.httpOptions.params = httpParams;
|
|
76
|
-
} */
|
|
77
|
-
switch (callParams.type) {
|
|
78
|
-
case http_call_type_enum_1.HttpCallType.get:
|
|
79
|
-
if (inputParams === null || inputParams === void 0 ? void 0 : inputParams.body) {
|
|
80
|
-
console.log('WARNING you cant send body in get calls');
|
|
81
|
-
}
|
|
82
|
-
yield privateAxiosInstance.get(url, callParams.httpOptions).then((res) => {
|
|
83
|
-
if (callParams.getFullResponse) {
|
|
84
|
-
a = res;
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
a = res.data;
|
|
88
|
-
}
|
|
89
|
-
console.log(`${callParams.name} was successful`, res.data);
|
|
90
|
-
});
|
|
91
|
-
break;
|
|
92
|
-
case http_call_type_enum_1.HttpCallType.delete:
|
|
93
|
-
if (inputParams === null || inputParams === void 0 ? void 0 : inputParams.body) {
|
|
94
|
-
console.log('WARNING you cant send body in delete calls');
|
|
95
|
-
}
|
|
96
|
-
yield privateAxiosInstance.delete(url, callParams.httpOptions).then((res) => {
|
|
97
|
-
if (callParams.getFullResponse) {
|
|
98
|
-
a = res;
|
|
99
|
-
}
|
|
100
|
-
console.log(`${callParams.name} was successful`, res.data);
|
|
101
|
-
});
|
|
102
|
-
break;
|
|
103
|
-
case http_call_type_enum_1.HttpCallType.post:
|
|
104
|
-
case http_call_type_enum_1.HttpCallType.put:
|
|
105
|
-
case http_call_type_enum_1.HttpCallType.patch:
|
|
106
|
-
if (!(inputParams === null || inputParams === void 0 ? void 0 : inputParams.body)) {
|
|
107
|
-
if (!inputParams) {
|
|
108
|
-
inputParams = {};
|
|
109
|
-
}
|
|
110
|
-
inputParams.body = {};
|
|
111
|
-
}
|
|
112
|
-
yield privateAxiosInstance[callParams.type](url, inputParams.body, callParams.httpOptions).then((res) => {
|
|
113
|
-
if (callParams.getFullResponse) {
|
|
114
|
-
a = res;
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
a = res.data;
|
|
118
|
-
}
|
|
119
|
-
console.log(`${callParams.name} api call was successful`, res.data);
|
|
120
|
-
});
|
|
121
|
-
break;
|
|
122
|
-
default:
|
|
123
|
-
dynamobe_shared_service_1.DBE_Shared.logError('DYNAMOBE ERROR: \n wrong api call type', '\n\n', new Error());
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
if (callParams.getFullResponse) {
|
|
127
|
-
return a;
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
return a;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
catch (error) {
|
|
134
|
-
dynamobe_shared_service_1.DBE_Shared.logError(`\nAPI ERRROR: ${callParams === null || callParams === void 0 ? void 0 : callParams.name} failed...` +
|
|
135
|
-
`\n${callParams === null || callParams === void 0 ? void 0 : callParams.baseUrl}${callParams === null || callParams === void 0 ? void 0 : callParams.endPoint}`);
|
|
136
|
-
if (((_b = callParams === null || callParams === void 0 ? void 0 : callParams.httpOptions) === null || _b === void 0 ? void 0 : _b.responseType) === http_response_type_enum_1.HttpResponseType.text) {
|
|
137
|
-
error.error = JSON.parse(error.error);
|
|
138
|
-
}
|
|
139
|
-
if (((_d = (_c = error === null || error === void 0 ? void 0 : error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.flag) === 'DYNAMO-BE ERROR OBJECT') {
|
|
140
|
-
dynamobe_shared_service_1.DBE_Shared.logError(`\n${callParams.name} was UNSUCCESSFUL\n\n`, new Error());
|
|
141
|
-
throw new fsm_dynamo_1.DynamoBEError(error.response.data);
|
|
142
|
-
}
|
|
143
|
-
else if (error.code === 'ENOTFOUND') {
|
|
144
|
-
dynamobe_shared_service_1.DBE_Shared.logError(`\n${callParams.name} was UNSUCCESSFUL\n\n`, new Error());
|
|
145
|
-
throw new fsm_dynamo_1.DynamoBEError({
|
|
146
|
-
status: 404, message: 'DNS error; address cannot be resolved!',
|
|
147
|
-
userMessage: `We encountered a BackEnd API Error, please contact the responsible development team. \nerrorCode: 965-453-300`,
|
|
148
|
-
error: error
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
else if (error.config && error.message) {
|
|
152
|
-
throw new fsm_dynamo_1.DynamoBEError({
|
|
153
|
-
status: +error.message.substring(error.message.length - 4, 3),
|
|
154
|
-
userMessage: `We encountered a BackEnd API Error, please contact the responsible development team. \nerrorCode: 965-453-303`,
|
|
155
|
-
error: error
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
dynamobe_shared_service_1.DBE_Shared.logError(`\n${callParams.name} was UNSUCCESSFUL`, error, '\n\n', new Error());
|
|
160
|
-
throw error;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
exports.DynamoBEApiService = DynamoBEApiService;
|
|
167
|
-
//# sourceMappingURL=dynamobe-api.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamobe-api.service.js","sourceRoot":"","sources":["../../src/_services/dynamobe-api.service.ts"],"names":[],"mappings":";;;;AACA,qDAA+B;AAC/B,sDAAsD;AAEtD,4EAAkE;AAClE,oFAA0E;AAE1E,uEAAuD;AAEvD;;GAEG;AACH,MAAa,kBAAkB;IAE3B;;;;;OAKG;IACE,MAAM,CAAO,YAAY,CAC9B,UAAiC,EACjC,WAMC;;;YAED,IAAI;gBACA,IAAI,CAAM,CAAC;gBACX,IAAI,GAAG,GAAW,UAAU,CAAC,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC;gBAC3D,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;gBAEpD,UAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,WAAW,0CAAE,OAAO,EAAE;oBAClC,KAAK,MAAM,SAAS,IAAI,UAAU,CAAC,WAAW,CAAC,OAAO,EAAE;wBACpD,IAAI,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;4BAC3C,oBAAoB,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;yBACvG;6BAAM;4BACH,oCAAU,CAAC,QAAQ,CAAC,oCAAoC,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,KAAK,EAAE,CAAC,CAAC;yBAC7F;qBACJ;iBACJ;gBAED,IAAI,WAAW,aAAX,WAAW,uBAAX,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AK,WAAW,EAAE;oBACnC,oCAAU,CAAC,QAAQ,CAAC,KAAK,UAAU,CAAC,IAAI,uBAAuB,EAAE,IAAI,KAAK,EAAE,CAAC,CAAC;oBAC9E,MAAM,IAAI,0BAAa,CAAC;wBACpB,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,wCAAwC;wBAC9D,WAAW,EAAE,6GAA6G;wBAC1H,KAAK,EAAE,KAAK;qBACf,CAAC,CAAC;iBACN;qBAAM,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO,EAAE;oBACtC,MAAM,IAAI,0BAAa,CAAC;wBACpB,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC;wBAC7D,WAAW,EAAE,6GAA6G;wBAC1H,KAAK,EAAE,KAAK;qBACf,CAAC,CAAC;iBACN;qBAAM;oBACH,oCAAU,CAAC,QAAQ,CAAC,KAAK,UAAU,CAAC,IAAI,mBAAmB,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,KAAK,EAAE,CAAC,CAAC;oBACzF,MAAM,KAAK,CAAC;iBACf;aACJ;;KACF;CACF;AA3JD,gDA2JC"}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { DynamoBEAppParams } from '../_models/dynamobe-app-params';
|
|
3
|
-
import Mongoose = require("mongoose");
|
|
4
|
-
import * as FileSystem from 'fs';
|
|
5
|
-
import { DynamoBESingletonService } from './dynamobe-singleton.service';
|
|
6
|
-
import { DynamoBERouteSecurity } from '../_enums/dynamobe-route-security.enum';
|
|
7
|
-
import { DynamoBERoutingModule } from './dynamobe-routing-module.service';
|
|
8
|
-
/**
|
|
9
|
-
* This will be the main service of our server project,
|
|
10
|
-
* follow the types and type instructions while setting up your project
|
|
11
|
-
*
|
|
12
|
-
* In this service, there are abstract functions that you will need to implement,
|
|
13
|
-
* where you need to set up the main params for your application.
|
|
14
|
-
*/
|
|
15
|
-
export declare abstract class DynamoBEApp extends DynamoBESingletonService {
|
|
16
|
-
protected params: DynamoBEAppParams;
|
|
17
|
-
protected mongoose: typeof Mongoose;
|
|
18
|
-
protected security: DynamoBERouteSecurity;
|
|
19
|
-
protected httpPort?: number;
|
|
20
|
-
protected httpsPort?: number;
|
|
21
|
-
protected cert?: {
|
|
22
|
-
keyPath: FileSystem.PathLike;
|
|
23
|
-
certPath: FileSystem.PathLike;
|
|
24
|
-
};
|
|
25
|
-
private secureExpress;
|
|
26
|
-
private httpsServer;
|
|
27
|
-
private openExpress;
|
|
28
|
-
protected routingModules: DynamoBERoutingModule[];
|
|
29
|
-
protected log: boolean;
|
|
30
|
-
constructor();
|
|
31
|
-
/**
|
|
32
|
-
*
|
|
33
|
-
*/
|
|
34
|
-
private startDB;
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
*/
|
|
38
|
-
private initExpresses;
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
41
|
-
*/
|
|
42
|
-
private initOpenExpress;
|
|
43
|
-
/**
|
|
44
|
-
*
|
|
45
|
-
*/
|
|
46
|
-
private initSecureExpress;
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
*/
|
|
50
|
-
private startExpresses;
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
*/
|
|
54
|
-
private mountSecureRoutes;
|
|
55
|
-
/**
|
|
56
|
-
*
|
|
57
|
-
*/
|
|
58
|
-
private mountOpenRoutes;
|
|
59
|
-
/**
|
|
60
|
-
*
|
|
61
|
-
*/
|
|
62
|
-
private setSecurity;
|
|
63
|
-
/**
|
|
64
|
-
* You must setup app params in this function like this:
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* this.params = new DynamoBEAppParams({
|
|
68
|
-
* name: 'Sample Server',
|
|
69
|
-
* title: 'A BIG nice header that will be logged on start',
|
|
70
|
-
* version: version,
|
|
71
|
-
* dbName: 'sampleapp',
|
|
72
|
-
* });
|
|
73
|
-
*/
|
|
74
|
-
abstract setupAppParams(): void;
|
|
75
|
-
/**
|
|
76
|
-
* You must setup globalServiceCollection and dbServices in this function
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* DBE_Global_S.setServices({
|
|
80
|
-
* authService: AuthService.getInstance(),
|
|
81
|
-
* emailServiceCollection: EmailServiceCollectionService.getInstance(),
|
|
82
|
-
* dbModels: [
|
|
83
|
-
* accountModelParams,
|
|
84
|
-
* projectModelParams,
|
|
85
|
-
* ...
|
|
86
|
-
* ]
|
|
87
|
-
* });
|
|
88
|
-
*
|
|
89
|
-
* DBE_Global_S.setGlobalSettings({
|
|
90
|
-
* defaultRouteSecurity: DynamoBERouteSecurity.secure,
|
|
91
|
-
* logSetup: true,
|
|
92
|
-
* });
|
|
93
|
-
*
|
|
94
|
-
*/
|
|
95
|
-
abstract setGlobalServiceCollection(): void;
|
|
96
|
-
/**
|
|
97
|
-
* You must setup endpoints and required services in this function
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* this.httpPort = env.httpPort;
|
|
101
|
-
* this.httpsPort = env.httpsPort;
|
|
102
|
-
|
|
103
|
-
* this.cert = {
|
|
104
|
-
* keyPath: Path.join(__dirname, './_assets/cert/ucc.key'),
|
|
105
|
-
* certPath: Path.join(__dirname, './_assets/cert/ucc.crt'),
|
|
106
|
-
* };
|
|
107
|
-
|
|
108
|
-
* this.routingModules = [
|
|
109
|
-
* new DynamoBERountingModule({
|
|
110
|
-
* route: '/api/account',
|
|
111
|
-
* controllers: [
|
|
112
|
-
* AccountController.getInstance(),
|
|
113
|
-
* PersonalInformationController.getInstance(),
|
|
114
|
-
* ...
|
|
115
|
-
* ]
|
|
116
|
-
* }),
|
|
117
|
-
* new DynamoBERountingModule({
|
|
118
|
-
* route: '/api/project',
|
|
119
|
-
* controllers: [
|
|
120
|
-
* ProjectController.getInstance(),
|
|
121
|
-
* ProjectExtensionController.getInstance(),
|
|
122
|
-
* ]
|
|
123
|
-
* }),
|
|
124
|
-
* ...
|
|
125
|
-
* ];
|
|
126
|
-
*/
|
|
127
|
-
abstract setupRoutingModules(): void;
|
|
128
|
-
}
|
|
129
|
-
//# sourceMappingURL=dynamobe-app.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamobe-app.d.ts","sourceRoot":"","sources":["../../src/_services/dynamobe-app.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,QAAQ,GAAG,QAAQ,UAAU,CAAC,CAAC;AAGtC,OAAO,KAAK,UAAU,MAAM,IAAI,CAAC;AAIjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAI1E;;;;;;GAMG;AACH,8BAAsB,WAAY,SAAQ,wBAAwB;IAEhE,SAAS,CAAC,MAAM,EAAE,iBAAiB,CAAC;IAEpC,SAAS,CAAC,QAAQ,kBAAY;IAE9B,SAAS,CAAC,QAAQ,EAAE,qBAAqB,CAAC;IAE1C,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAE7B,SAAS,CAAC,IAAI,CAAC,EAAE;QACf,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC;QAC7B,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC;KAC/B,CAAC;IAEF,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,WAAW,CAAe;IAClC,OAAO,CAAC,WAAW,CAAsB;IAEzC,SAAS,CAAC,cAAc,EAAE,qBAAqB,EAAE,CAAC;IAElD,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC;;IAoCvB;;OAEG;IACH,OAAO,CAAC,OAAO;IAkBf;;OAEG;IACH,OAAO,CAAC,aAAa;IAsErB;;OAEG;IACH,OAAO,CAAC,eAAe;IAMvB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAYzB;;OAEG;YACW,cAAc;IAgC5B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAmBzB;;OAEG;IACH,OAAO,CAAC,eAAe;IAmBvB;;OAEG;IACH,OAAO,CAAC,WAAW;IAUnB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,cAAc,IAAI,IAAI;IAE/B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,0BAA0B,IAAI,IAAI;IAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,QAAQ,CAAC,mBAAmB,IAAI,IAAI;CACrC"}
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DynamoBEApp = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const Mongoose = require("mongoose");
|
|
6
|
-
const Express = require("express");
|
|
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_shared_service_1 = require("./dynamobe-shared.service");
|
|
11
|
-
const dynamobe_singleton_service_1 = require("./dynamobe-singleton.service");
|
|
12
|
-
const dynamobe_route_security_enum_1 = require("../_enums/dynamobe-route-security.enum");
|
|
13
|
-
const _constants_1 = require("../_constants");
|
|
14
|
-
/**
|
|
15
|
-
* This will be the main service of our server project,
|
|
16
|
-
* follow the types and type instructions while setting up your project
|
|
17
|
-
*
|
|
18
|
-
* In this service, there are abstract functions that you will need to implement,
|
|
19
|
-
* where you need to set up the main params for your application.
|
|
20
|
-
*/
|
|
21
|
-
class DynamoBEApp extends dynamobe_singleton_service_1.DynamoBESingletonService {
|
|
22
|
-
constructor() {
|
|
23
|
-
super();
|
|
24
|
-
this.mongoose = Mongoose;
|
|
25
|
-
try {
|
|
26
|
-
this.setupAppParams();
|
|
27
|
-
console.log(`\n\n\nStarting ${this.params.name}... \nVersion: ${this.params.version}`);
|
|
28
|
-
if (this.params.title)
|
|
29
|
-
console.log(this.params.title);
|
|
30
|
-
this.startDB();
|
|
31
|
-
this.setGlobalServiceCollection();
|
|
32
|
-
this.log = _constants_1.dynamoBEGlobalSettings.logSetup;
|
|
33
|
-
this.setupRoutingModules();
|
|
34
|
-
this.setSecurity();
|
|
35
|
-
if (0 < this.routingModules.length) {
|
|
36
|
-
this.initExpresses();
|
|
37
|
-
this.startExpresses();
|
|
38
|
-
if (this.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.secure) {
|
|
39
|
-
this.mountOpenRoutes();
|
|
40
|
-
}
|
|
41
|
-
if (this.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.open && this.cert) {
|
|
42
|
-
this.mountSecureRoutes();
|
|
43
|
-
}
|
|
44
|
-
if (this.log)
|
|
45
|
-
console.log(`\nRoutes mounted.... server using security: ${this.security}`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
dynamobe_shared_service_1.DBE_Shared.logError('\nApplication start failed.\n', error);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
*/
|
|
55
|
-
startDB() {
|
|
56
|
-
this.mongoose.connection
|
|
57
|
-
.on('error', (error) => {
|
|
58
|
-
dynamobe_shared_service_1.DBE_Shared.logError('\nUnable to connect to MongoDB server, ERROR: ', error);
|
|
59
|
-
})
|
|
60
|
-
.once('open', () => {
|
|
61
|
-
dynamobe_shared_service_1.DBE_Shared.logSuccess('\nConnected to MongoDB\n');
|
|
62
|
-
});
|
|
63
|
-
this.mongoose.connect(this.params.dbUri);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
*
|
|
67
|
-
*/
|
|
68
|
-
initExpresses() {
|
|
69
|
-
if (this.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.secure) {
|
|
70
|
-
if (!this.httpPort) {
|
|
71
|
-
let errorMsg = `\nYou have open routes, but httpPort is not set!` +
|
|
72
|
-
`\nsecurity: ${this.security}` +
|
|
73
|
-
`\nset httpPort in DynamoBEServer - setupRoutingModules() to enable secure routes.`;
|
|
74
|
-
errorMsg += '\n\nThe routes setted to use open server:';
|
|
75
|
-
this.routingModules.forEach((module) => {
|
|
76
|
-
if (module.security != dynamobe_route_security_enum_1.DynamoBERouteSecurity.secure) {
|
|
77
|
-
errorMsg += `\n ${module.route} (security: ${module.security}) \n subroutes using open sever:`;
|
|
78
|
-
module.endpoints.forEach((endpoint) => {
|
|
79
|
-
if (endpoint.security != dynamobe_route_security_enum_1.DynamoBERouteSecurity.secure) {
|
|
80
|
-
errorMsg += `\n ${endpoint.endpoint} (security: ${endpoint.security})`;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
dynamobe_shared_service_1.DBE_Shared.logError(errorMsg);
|
|
86
|
-
let error = new Error('Open routes cannot be established!');
|
|
87
|
-
let errorStack = error.stack.split('\n');
|
|
88
|
-
errorStack.splice(1, 2);
|
|
89
|
-
error.stack = errorStack.join('\n');
|
|
90
|
-
throw error;
|
|
91
|
-
}
|
|
92
|
-
this.initOpenExpress();
|
|
93
|
-
}
|
|
94
|
-
if (this.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.open) {
|
|
95
|
-
if (!this.cert || !this.httpsPort) {
|
|
96
|
-
let errorMsg = `\nYou have secure routes, but the certification paths or httpsPort are not set!` +
|
|
97
|
-
`\nsecurity: ${this.security}` +
|
|
98
|
-
`\nset...` +
|
|
99
|
-
`\n httpsPort and` +
|
|
100
|
-
`\n cert: {` +
|
|
101
|
-
`\n keyPath: FileSystem.PathLike,` +
|
|
102
|
-
`\n certPath: FileSystem.PathLike,` +
|
|
103
|
-
`\n }` +
|
|
104
|
-
`\nin DynamoBEServer - setupRoutingModules() to enable secure routes.`;
|
|
105
|
-
errorMsg += '\n\nThe routes setted to use secure server:';
|
|
106
|
-
this.routingModules.forEach((module) => {
|
|
107
|
-
if (module.security != dynamobe_route_security_enum_1.DynamoBERouteSecurity.open) {
|
|
108
|
-
errorMsg += `\n ${module.route} (security: ${module.security}) \n subroutes using secure sever:`;
|
|
109
|
-
module.endpoints.forEach((endpoint) => {
|
|
110
|
-
if (endpoint.security != dynamobe_route_security_enum_1.DynamoBERouteSecurity.open) {
|
|
111
|
-
errorMsg += `\n ${endpoint.endpoint} (security: ${endpoint.security})`;
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
dynamobe_shared_service_1.DBE_Shared.logError(errorMsg);
|
|
117
|
-
let error = new Error('Secure routes cannot be established!');
|
|
118
|
-
let errorStack = error.stack.split('\n');
|
|
119
|
-
errorStack.splice(1, 2);
|
|
120
|
-
error.stack = errorStack.join('\n');
|
|
121
|
-
throw error;
|
|
122
|
-
}
|
|
123
|
-
this.initSecureExpress();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
*
|
|
128
|
-
*/
|
|
129
|
-
initOpenExpress() {
|
|
130
|
-
this.openExpress = Express();
|
|
131
|
-
this.openExpress.use(BodyParser.urlencoded({ limit: '50mb', extended: true }));
|
|
132
|
-
this.openExpress.use(BodyParser.json({ limit: '50mb' }));
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
*
|
|
136
|
-
*/
|
|
137
|
-
initSecureExpress() {
|
|
138
|
-
this.secureExpress = Express();
|
|
139
|
-
this.secureExpress.use(BodyParser.urlencoded({ limit: '50mb', extended: true }));
|
|
140
|
-
this.secureExpress.use(BodyParser.json({ limit: '50mb' }));
|
|
141
|
-
const options = {
|
|
142
|
-
key: FileSystem.readFileSync(this.cert.keyPath),
|
|
143
|
-
cert: FileSystem.readFileSync(this.cert.certPath),
|
|
144
|
-
};
|
|
145
|
-
this.httpsServer = Https.createServer(options, this.secureExpress);
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
*
|
|
149
|
-
*/
|
|
150
|
-
startExpresses() {
|
|
151
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
152
|
-
try {
|
|
153
|
-
if (this.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.open) {
|
|
154
|
-
this.httpsServer
|
|
155
|
-
.listen(this.httpsPort, 'localhost', 0, () => {
|
|
156
|
-
dynamobe_shared_service_1.DBE_Shared.logSuccess(`\nHTTPS (secure) server is listening on port ${this.httpsPort}\n`);
|
|
157
|
-
})
|
|
158
|
-
.on('error', (error) => {
|
|
159
|
-
dynamobe_shared_service_1.DBE_Shared.logError(`\nHTTPS (secure) server ERROR`, error);
|
|
160
|
-
})
|
|
161
|
-
.on('uncaughtException', (ex) => {
|
|
162
|
-
dynamobe_shared_service_1.DBE_Shared.logWarning(`\nHTTPS (secure) server uncaughtException`, ex);
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
if (this.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.secure) {
|
|
166
|
-
this.openExpress
|
|
167
|
-
.listen(this.httpPort, () => {
|
|
168
|
-
dynamobe_shared_service_1.DBE_Shared.logSuccess(`\nHTTP (-open-) server is listening on port ${this.httpPort}\n`);
|
|
169
|
-
})
|
|
170
|
-
.on('error', (error) => {
|
|
171
|
-
dynamobe_shared_service_1.DBE_Shared.logError(`\nHTTP (-open-) server ERROR`, error);
|
|
172
|
-
})
|
|
173
|
-
.on('uncaughtException', (ex) => {
|
|
174
|
-
dynamobe_shared_service_1.DBE_Shared.logWarning(`\nHTTP (-open-) server uncaughtException`, ex);
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
catch (error) {
|
|
179
|
-
dynamobe_shared_service_1.DBE_Shared.logError(`startExpresses failed...`, error);
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
*
|
|
185
|
-
*/
|
|
186
|
-
mountSecureRoutes() {
|
|
187
|
-
this.routingModules.forEach((module) => {
|
|
188
|
-
if (module.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.open) {
|
|
189
|
-
if (this.log)
|
|
190
|
-
console.log(`route mount (secure): ${module.route}`);
|
|
191
|
-
const existingRoutes = this.routingModules.filter((mod) => mod.route === module.route);
|
|
192
|
-
if (1 < existingRoutes.length) {
|
|
193
|
-
let error = new Error(`ROUTE DUPLICATION: ${module.route}`);
|
|
194
|
-
let errorStack = error.stack.split('\n');
|
|
195
|
-
errorStack.splice(1, 4);
|
|
196
|
-
error.stack = errorStack.join('\n');
|
|
197
|
-
throw error;
|
|
198
|
-
}
|
|
199
|
-
this.secureExpress.use(module.route, module.secureRouter);
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
*
|
|
205
|
-
*/
|
|
206
|
-
mountOpenRoutes() {
|
|
207
|
-
this.routingModules.forEach((module) => {
|
|
208
|
-
if (module.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.secure) {
|
|
209
|
-
if (this.log)
|
|
210
|
-
console.log(`route mount (open): ${module.route}`);
|
|
211
|
-
const existingRoutes = this.routingModules.filter((mod) => mod.route === module.route);
|
|
212
|
-
if (1 < existingRoutes.length) {
|
|
213
|
-
let error = new Error(`ROUTE DUPLICATION: ${module.route}`);
|
|
214
|
-
let errorStack = error.stack.split('\n');
|
|
215
|
-
errorStack.splice(1, 4);
|
|
216
|
-
error.stack = errorStack.join('\n');
|
|
217
|
-
throw error;
|
|
218
|
-
}
|
|
219
|
-
this.openExpress.use(module.route, module.openRouter);
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
*
|
|
225
|
-
*/
|
|
226
|
-
setSecurity() {
|
|
227
|
-
this.routingModules.forEach((module) => {
|
|
228
|
-
if (!this.security) {
|
|
229
|
-
this.security = module.security;
|
|
230
|
-
}
|
|
231
|
-
else if (this.security !== module.security) {
|
|
232
|
-
this.security = dynamobe_route_security_enum_1.DynamoBERouteSecurity.both;
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
exports.DynamoBEApp = DynamoBEApp;
|
|
238
|
-
//# sourceMappingURL=dynamobe-app.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamobe-app.js","sourceRoot":"","sources":["../../src/_services/dynamobe-app.ts"],"names":[],"mappings":";;;;AAEA,qCAAsC;AACtC,mCAAoC;AACpC,qDAA+B;AAC/B,uDAAiC;AACjC,gEAA0C;AAE1C,uEAAuD;AACvD,6EAAwE;AACxE,yFAA+E;AAG/E,8CAAuD;AAEvD;;;;;;GAMG;AACH,MAAsB,WAAY,SAAQ,qDAAwB;IAwBhE;QACE,KAAK,EAAE,CAAC;QArBA,aAAQ,GAAG,QAAQ,CAAC;QAuB5B,IAAI;YACF,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,CAAC,MAAM,CAAC,IAAI,kBAAkB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;YACvF,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK;gBAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAEtD,IAAI,CAAC,OAAO,EAAE,CAAC;YAEf,IAAI,CAAC,0BAA0B,EAAE,CAAC;YAClC,IAAI,CAAC,GAAG,GAAG,mCAAsB,CAAC,QAAQ,CAAC;YAE3C,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC3B,IAAI,CAAC,WAAW,EAAE,CAAC;YAEnB,IAAI,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,MAA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CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;aACvD;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACK,WAAW;QACjB,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,MAA6B,EAAE,EAAE;YAC5D,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAClB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;aACjC;iBAAM,IAAI,IAAI,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,EAAE;gBAC5C,IAAI,CAAC,QAAQ,GAAG,oDAAqB,CAAC,IAAI,CAAC;aAC5C;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CAqEF;AA/UD,kCA+UC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { NextFunction, Request, Response } from 'express';
|
|
2
|
-
import { DynamoBESingletonService } from './dynamobe-singleton.service';
|
|
3
|
-
/**
|
|
4
|
-
* Extend this class as an Auth Service implementation
|
|
5
|
-
*
|
|
6
|
-
* You should use singleton instance getting function by implementing a
|
|
7
|
-
* static getInstance() function
|
|
8
|
-
* @example
|
|
9
|
-
* export class AuthService extends DynamoBEAuthService {
|
|
10
|
-
*
|
|
11
|
-
* static getInstance(): AuthService {
|
|
12
|
-
* return AuthService.getSingletonInstance();
|
|
13
|
-
* }
|
|
14
|
-
* ...
|
|
15
|
-
*/
|
|
16
|
-
export declare abstract class DynamoBEAuthService extends DynamoBESingletonService {
|
|
17
|
-
/**
|
|
18
|
-
* this function returns the 'authorization' header from the Request,
|
|
19
|
-
* or throws error, if its missing
|
|
20
|
-
*
|
|
21
|
-
* @param req
|
|
22
|
-
* @returns
|
|
23
|
-
*/
|
|
24
|
-
static getTokenFromRequest(req: Request): string;
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* @param req
|
|
28
|
-
* @param res
|
|
29
|
-
* @param next
|
|
30
|
-
*/
|
|
31
|
-
abstract authenticateTokenSelf(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
34
|
-
*/
|
|
35
|
-
abstract authenticateToken(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* Authenticate Token for Permission to Access UsageData
|
|
38
|
-
* @param req
|
|
39
|
-
* @param res
|
|
40
|
-
* @param next
|
|
41
|
-
*/
|
|
42
|
-
abstract authTokenPermAccUsageData(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
43
|
-
/**
|
|
44
|
-
* The DynamoBE System is using this to get issuer, that will be set on DBServices
|
|
45
|
-
* @param req
|
|
46
|
-
*/
|
|
47
|
-
abstract getAccountIdFromRequest(req: Request): string;
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
* @param req
|
|
51
|
-
*/
|
|
52
|
-
abstract getUsernameFromRequest(req: Request): string;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=dynamobe-auth.service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamobe-auth.service.d.ts","sourceRoot":"","sources":["../../src/_services/dynamobe-auth.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE;;;;;;;;;;;;GAYG;AACH,8BAAsB,mBAAoB,SAAQ,wBAAwB;IAExE;;;;;;OAMG;IACH,MAAM,CAAC,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM;IAkBhD;;;;;OAKG;IACH,QAAQ,CAAC,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAC9F;;OAEG;IACH,QAAQ,CAAC,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAE1F;;;;;OAKG;IACH,QAAQ,CAAC,yBAAyB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAElG;;;OAGG;IACH,QAAQ,CAAC,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM;IACtD;;;OAGG;IACH,QAAQ,CAAC,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM;CACtD"}
|