@futdevpro/nts-dynamo 1.3.57 → 1.3.59
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/package.json +19 -19
- package/src/_models/dynamobe-endpoint-control.ts +39 -30
- package/src/_models/fullstack-models/control-models/dynamobe-data-params.ts +19 -0
- package/src/_models/fullstack-models/control-models/dynamobe-data-property-params.ts +2 -2
- package/src/_models/fullstack-models/data-models/custom-data.ts +8 -4
- package/src/_models/fullstack-models/data-models/usage-session.ts +19 -16
- package/src/_modules/test-route/custom-data.service.ts +0 -2
- package/src/_modules/usage-route/usage.service.ts +0 -3
- package/src/_services/dynamobe-app.ts +280 -0
- package/src/_services/dynamobe-auth.service.ts +16 -1
- package/src/_services/dynamobe-controller.service.ts +6 -1
- package/src/_services/dynamobe-data.service.ts +7 -9
- package/src/_services/dynamobe-db-service-collection.service.ts +1 -1
- package/src/_services/dynamobe-db.service.ts +44 -44
- package/src/_services/dynamobe-email-service-collection.service.ts +13 -0
- package/src/_services/dynamobe-email.service.ts +1 -1
- package/src/_services/dynamobe-global-collection.service.ts +57 -0
- package/src/_services/dynamobe-global.service.ts +50 -5
- package/src/_services/dynamobe-routing-module.service.ts +10 -6
- package/src/_services/dynamobe-server.ts +16 -12
- package/src/dynamobe-global.settings.ts +10 -0
- package/src/sync.ffs_db +0 -0
- package/src/version.json +1 -1
- package/tsconfig.json +3 -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 -12
- package/lib/_constants/dynamobe-global.settings.js.map +0 -1
- package/lib/_enums/data-model-type.enum.d.ts +0 -6
- package/lib/_enums/data-model-type.enum.d.ts.map +0 -1
- package/lib/_enums/data-model-type.enum.js +0 -10
- package/lib/_enums/data-model-type.enum.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/http/http-call-type.enum.d.ts +0 -8
- package/lib/_enums/http/http-call-type.enum.d.ts.map +0 -1
- package/lib/_enums/http/http-call-type.enum.js +0 -12
- package/lib/_enums/http/http-call-type.enum.js.map +0 -1
- package/lib/_enums/http/http-response-type.enum.d.ts +0 -7
- package/lib/_enums/http/http-response-type.enum.d.ts.map +0 -1
- package/lib/_enums/http/http-response-type.enum.js +0 -11
- package/lib/_enums/http/http-response-type.enum.js.map +0 -1
- package/lib/_enums/index.d.ts +0 -8
- package/lib/_enums/index.d.ts.map +0 -1
- package/lib/_enums/index.js +0 -39
- package/lib/_enums/index.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/_enums/predefined-data-types.enum.d.ts +0 -8
- package/lib/_enums/predefined-data-types.enum.d.ts.map +0 -1
- package/lib/_enums/predefined-data-types.enum.js +0 -12
- package/lib/_enums/predefined-data-types.enum.js.map +0 -1
- package/lib/_models/dynamobe-api-call-params.d.ts +0 -35
- package/lib/_models/dynamobe-api-call-params.d.ts.map +0 -1
- package/lib/_models/dynamobe-api-call-params.js +0 -24
- package/lib/_models/dynamobe-api-call-params.js.map +0 -1
- package/lib/_models/dynamobe-app-params.d.ts +0 -15
- package/lib/_models/dynamobe-app-params.d.ts.map +0 -1
- package/lib/_models/dynamobe-app-params.js +0 -14
- package/lib/_models/dynamobe-app-params.js.map +0 -1
- package/lib/_models/dynamobe-data-model-params.d.ts +0 -13
- package/lib/_models/dynamobe-data-model-params.d.ts.map +0 -1
- package/lib/_models/dynamobe-data-model-params.js +0 -15
- package/lib/_models/dynamobe-data-model-params.js.map +0 -1
- package/lib/_models/dynamobe-endpoint-control.d.ts +0 -29
- package/lib/_models/dynamobe-endpoint-control.d.ts.map +0 -1
- package/lib/_models/dynamobe-endpoint-control.js +0 -86
- package/lib/_models/dynamobe-endpoint-control.js.map +0 -1
- package/lib/_models/dynamobe-global-settings.d.ts +0 -9
- 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/_models/fullstack-models/control-models/daily-usage-data.d.ts +0 -18
- package/lib/_models/fullstack-models/control-models/daily-usage-data.d.ts.map +0 -1
- package/lib/_models/fullstack-models/control-models/daily-usage-data.js +0 -22
- package/lib/_models/fullstack-models/control-models/daily-usage-data.js.map +0 -1
- package/lib/_models/fullstack-models/control-models/dynamobe-data-property-params.d.ts +0 -28
- package/lib/_models/fullstack-models/control-models/dynamobe-data-property-params.d.ts.map +0 -1
- package/lib/_models/fullstack-models/control-models/dynamobe-data-property-params.js +0 -67
- package/lib/_models/fullstack-models/control-models/dynamobe-data-property-params.js.map +0 -1
- package/lib/_models/fullstack-models/control-models/dynamobe-error.d.ts +0 -18
- package/lib/_models/fullstack-models/control-models/dynamobe-error.d.ts.map +0 -1
- package/lib/_models/fullstack-models/control-models/dynamobe-error.js +0 -188
- package/lib/_models/fullstack-models/control-models/dynamobe-error.js.map +0 -1
- package/lib/_models/fullstack-models/control-models/geo-ip-location.d.ts +0 -26
- package/lib/_models/fullstack-models/control-models/geo-ip-location.d.ts.map +0 -1
- package/lib/_models/fullstack-models/control-models/geo-ip-location.js +0 -3
- package/lib/_models/fullstack-models/control-models/geo-ip-location.js.map +0 -1
- package/lib/_models/fullstack-models/control-models/usage-action.d.ts +0 -9
- package/lib/_models/fullstack-models/control-models/usage-action.d.ts.map +0 -1
- package/lib/_models/fullstack-models/control-models/usage-action.js +0 -13
- package/lib/_models/fullstack-models/control-models/usage-action.js.map +0 -1
- package/lib/_models/fullstack-models/control-models/usage-data.d.ts +0 -14
- package/lib/_models/fullstack-models/control-models/usage-data.d.ts.map +0 -1
- package/lib/_models/fullstack-models/control-models/usage-data.js +0 -16
- package/lib/_models/fullstack-models/control-models/usage-data.js.map +0 -1
- package/lib/_models/fullstack-models/data-models/custom-data.d.ts +0 -16
- package/lib/_models/fullstack-models/data-models/custom-data.d.ts.map +0 -1
- package/lib/_models/fullstack-models/data-models/custom-data.js +0 -24
- package/lib/_models/fullstack-models/data-models/custom-data.js.map +0 -1
- package/lib/_models/fullstack-models/data-models/metadata.d.ts +0 -17
- package/lib/_models/fullstack-models/data-models/metadata.d.ts.map +0 -1
- package/lib/_models/fullstack-models/data-models/metadata.js +0 -17
- package/lib/_models/fullstack-models/data-models/metadata.js.map +0 -1
- package/lib/_models/fullstack-models/data-models/usage-session.d.ts +0 -34
- package/lib/_models/fullstack-models/data-models/usage-session.d.ts.map +0 -1
- package/lib/_models/fullstack-models/data-models/usage-session.js +0 -49
- package/lib/_models/fullstack-models/data-models/usage-session.js.map +0 -1
- package/lib/_models/index.d.ts +0 -15
- package/lib/_models/index.d.ts.map +0 -1
- package/lib/_models/index.js +0 -32
- package/lib/_models/index.js.map +0 -1
- package/lib/_modules/index.d.ts +0 -5
- package/lib/_modules/index.d.ts.map +0 -1
- package/lib/_modules/index.js +0 -9
- package/lib/_modules/index.js.map +0 -1
- package/lib/_modules/test-route/custom-data.service.d.ts +0 -6
- package/lib/_modules/test-route/custom-data.service.d.ts.map +0 -1
- package/lib/_modules/test-route/custom-data.service.js +0 -13
- package/lib/_modules/test-route/custom-data.service.js.map +0 -1
- package/lib/_modules/test-route/test-controller.d.ts +0 -6
- package/lib/_modules/test-route/test-controller.d.ts.map +0 -1
- package/lib/_modules/test-route/test-controller.js +0 -126
- package/lib/_modules/test-route/test-controller.js.map +0 -1
- package/lib/_modules/usage-route/usage-controller.d.ts +0 -7
- package/lib/_modules/usage-route/usage-controller.d.ts.map +0 -1
- package/lib/_modules/usage-route/usage-controller.js +0 -89
- package/lib/_modules/usage-route/usage-controller.js.map +0 -1
- package/lib/_modules/usage-route/usage.service.d.ts +0 -19
- package/lib/_modules/usage-route/usage.service.d.ts.map +0 -1
- package/lib/_modules/usage-route/usage.service.js +0 -111
- package/lib/_modules/usage-route/usage.service.js.map +0 -1
- package/lib/_services/dynamobe-api.service.d.ts +0 -10
- package/lib/_services/dynamobe-api.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-api.service.js +0 -131
- package/lib/_services/dynamobe-api.service.js.map +0 -1
- package/lib/_services/dynamobe-app.d.ts +0 -12
- package/lib/_services/dynamobe-app.d.ts.map +0 -1
- package/lib/_services/dynamobe-app.js +0 -39
- package/lib/_services/dynamobe-app.js.map +0 -1
- package/lib/_services/dynamobe-auth.service.d.ts +0 -26
- package/lib/_services/dynamobe-auth.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-auth.service.js +0 -25
- package/lib/_services/dynamobe-auth.service.js.map +0 -1
- package/lib/_services/dynamobe-controller.service.d.ts +0 -11
- package/lib/_services/dynamobe-controller.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-controller.service.js +0 -12
- package/lib/_services/dynamobe-controller.service.js.map +0 -1
- package/lib/_services/dynamobe-data.service.d.ts +0 -52
- package/lib/_services/dynamobe-data.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-data.service.js +0 -225
- package/lib/_services/dynamobe-data.service.js.map +0 -1
- package/lib/_services/dynamobe-db-service-collection.service.d.ts +0 -6
- package/lib/_services/dynamobe-db-service-collection.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-db-service-collection.service.js +0 -8
- package/lib/_services/dynamobe-db-service-collection.service.js.map +0 -1
- package/lib/_services/dynamobe-db.service.d.ts +0 -151
- package/lib/_services/dynamobe-db.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-db.service.js +0 -578
- package/lib/_services/dynamobe-db.service.js.map +0 -1
- package/lib/_services/dynamobe-email-service-collection.service.d.ts +0 -6
- package/lib/_services/dynamobe-email-service-collection.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-email-service-collection.service.js +0 -8
- package/lib/_services/dynamobe-email-service-collection.service.js.map +0 -1
- package/lib/_services/dynamobe-email.service.d.ts +0 -34
- package/lib/_services/dynamobe-email.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-email.service.js +0 -145
- package/lib/_services/dynamobe-email.service.js.map +0 -1
- package/lib/_services/dynamobe-global.service.d.ts +0 -23
- package/lib/_services/dynamobe-global.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-global.service.js +0 -85
- package/lib/_services/dynamobe-global.service.js.map +0 -1
- package/lib/_services/dynamobe-routing-module.service.d.ts +0 -26
- package/lib/_services/dynamobe-routing-module.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-routing-module.service.js +0 -113
- package/lib/_services/dynamobe-routing-module.service.js.map +0 -1
- package/lib/_services/dynamobe-server.d.ts +0 -32
- package/lib/_services/dynamobe-server.d.ts.map +0 -1
- package/lib/_services/dynamobe-server.js +0 -178
- package/lib/_services/dynamobe-server.js.map +0 -1
- package/lib/_services/dynamobe-shared.service.d.ts +0 -101
- package/lib/_services/dynamobe-shared.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-shared.service.js +0 -295
- package/lib/_services/dynamobe-shared.service.js.map +0 -1
- package/lib/_services/dynamobe-singleton.service.d.ts +0 -6
- package/lib/_services/dynamobe-singleton.service.d.ts.map +0 -1
- package/lib/_services/dynamobe-singleton.service.js +0 -16
- package/lib/_services/dynamobe-singleton.service.js.map +0 -1
- package/lib/_services/index.d.ts +0 -15
- package/lib/_services/index.d.ts.map +0 -1
- package/lib/_services/index.js +0 -41
- package/lib/_services/index.js.map +0 -1
- package/lib/index.d.ts +0 -5
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -12
- package/lib/index.js.map +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -2099
|
@@ -4,6 +4,7 @@ import { Metadata } from '../_models/fullstack-models/data-models/metadata';
|
|
|
4
4
|
import { DynamoBEDBService } from './dynamobe-db.service';
|
|
5
5
|
import { DynamoBEDataPropertyParams } from '../_models/fullstack-models/control-models/dynamobe-data-property-params';
|
|
6
6
|
import { DBE_Global_S } from './dynamobe-global.service';
|
|
7
|
+
import { DynamoBEDataParams } from '../_models/fullstack-models/control-models/dynamobe-data-params';
|
|
7
8
|
|
|
8
9
|
export class DynamoBEDataService<T extends Metadata> {
|
|
9
10
|
dataDBService: DynamoBEDBService<T>;
|
|
@@ -17,17 +18,14 @@ export class DynamoBEDataService<T extends Metadata> {
|
|
|
17
18
|
dataModelParams?: DynamoBEDataPropertyParams[] = [];
|
|
18
19
|
|
|
19
20
|
constructor(
|
|
20
|
-
dataDBService: DynamoBEDBService<T>,
|
|
21
21
|
data: T,
|
|
22
|
-
|
|
22
|
+
dataParams: DynamoBEDataParams,
|
|
23
23
|
issuer?: string,
|
|
24
24
|
) {
|
|
25
|
-
this.dataDBService =
|
|
25
|
+
this.dataDBService = DBE_Global_S.getDBService<T>(dataParams);
|
|
26
26
|
this.data = data;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this.lookForDependencyDataSettings();
|
|
30
|
-
}
|
|
27
|
+
this.dataModelParams = dataParams.modelParams;
|
|
28
|
+
this.lookForDependencyDataSettings();
|
|
31
29
|
this.issuer = issuer;
|
|
32
30
|
}
|
|
33
31
|
|
|
@@ -199,8 +197,8 @@ export class DynamoBEDataService<T extends Metadata> {
|
|
|
199
197
|
const dependencyParam: DynamoBEDataPropertyParams = this.dataModelParams.find((modelParams: DynamoBEDataPropertyParams) => modelParams.isDependencyHook);
|
|
200
198
|
if (dependencyParam) {
|
|
201
199
|
this.depKey = dependencyParam.key;
|
|
202
|
-
if (dependencyParam.
|
|
203
|
-
this.depDBServiceKey = dependencyParam.
|
|
200
|
+
if (dependencyParam.dependencyName) {
|
|
201
|
+
this.depDBServiceKey = dependencyParam.dependencyName;
|
|
204
202
|
}
|
|
205
203
|
}
|
|
206
204
|
}
|
|
@@ -4,11 +4,12 @@ import { Schema } from 'mongoose';
|
|
|
4
4
|
import { DynamoBEError } from '../_models/fullstack-models/control-models/dynamobe-error';
|
|
5
5
|
import { Metadata } from '../_models/fullstack-models/data-models/metadata';
|
|
6
6
|
import { DynamoBEDataPropertyParams } from '../_models/fullstack-models/control-models/dynamobe-data-property-params';
|
|
7
|
+
import { DynamoBEDataParams } from '../_models/fullstack-models/control-models/dynamobe-data-params';
|
|
7
8
|
|
|
8
9
|
export class DynamoBEDBService<T extends Metadata> {
|
|
9
|
-
dataModel = mongoose.model(this.
|
|
10
|
+
dataModel = mongoose.model(this.dataParams.dbName, this.getSchema());
|
|
10
11
|
|
|
11
|
-
private
|
|
12
|
+
private depDataName: string;
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @param dataName name the model
|
|
@@ -17,8 +18,7 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
17
18
|
* schemaSettings also MUST contain specific types that differs from the listed above (Array, Date)
|
|
18
19
|
*/
|
|
19
20
|
constructor(
|
|
20
|
-
|
|
21
|
-
private dataModelParams: DynamoBEDataPropertyParams[]
|
|
21
|
+
public dataParams: DynamoBEDataParams
|
|
22
22
|
){
|
|
23
23
|
this.lookForDependencyDataSettings();
|
|
24
24
|
}
|
|
@@ -39,10 +39,10 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
39
39
|
if (res) {
|
|
40
40
|
newData = res.toObject() as T;
|
|
41
41
|
} else {
|
|
42
|
-
throw new DynamoBEError({ status: 204, message: `${this.
|
|
42
|
+
throw new DynamoBEError({ status: 204, message: `${this.dataParams.dbName} not found! (BD)` });
|
|
43
43
|
}
|
|
44
44
|
}).catch(error => {
|
|
45
|
-
throw new DynamoBEError({ status: 422, message: `Create new ${this.
|
|
45
|
+
throw new DynamoBEError({ status: 422, message: `Create new ${this.dataParams.dbName} was unsuccessful (BD)`, error });
|
|
46
46
|
});
|
|
47
47
|
if (typeof newData._id === 'object') {
|
|
48
48
|
newData._id = `${newData._id}`;
|
|
@@ -66,10 +66,10 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
66
66
|
if (res) {
|
|
67
67
|
newData = res.toObject() as T;
|
|
68
68
|
} else {
|
|
69
|
-
throw new DynamoBEError({ status: 204, message: `${this.
|
|
69
|
+
throw new DynamoBEError({ status: 204, message: `${this.dataParams.dbName} not found! (BD)` });
|
|
70
70
|
}
|
|
71
71
|
}).catch(error => {
|
|
72
|
-
throw new DynamoBEError({ status: 417, message: `modify ${this.
|
|
72
|
+
throw new DynamoBEError({ status: 417, message: `modify ${this.dataParams.dbName} was unsuccessful (DB)`, error });
|
|
73
73
|
});
|
|
74
74
|
data.__v = newData.__v;
|
|
75
75
|
return data;
|
|
@@ -89,7 +89,7 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
89
89
|
data = null;
|
|
90
90
|
}
|
|
91
91
|
}).catch(error => {
|
|
92
|
-
throw new DynamoBEError({ status: 417, message: `get ${this.
|
|
92
|
+
throw new DynamoBEError({ status: 417, message: `get ${this.dataParams.dbName} by ID was unsuccessful (DB)`, error });
|
|
93
93
|
});
|
|
94
94
|
if (data && typeof data._id === 'object') {
|
|
95
95
|
data._id = `${data._id}`;
|
|
@@ -103,23 +103,23 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
103
103
|
* @returns data
|
|
104
104
|
*/
|
|
105
105
|
async getDataByDependencyId(dependencyId: string): Promise<T> {
|
|
106
|
-
if (this.
|
|
106
|
+
if (this.depDataName) {
|
|
107
107
|
let data: T;
|
|
108
|
-
await this.dataModel.findOne({ [this.
|
|
108
|
+
await this.dataModel.findOne({ [this.depDataName]: dependencyId }).then(res => {
|
|
109
109
|
if (res) {
|
|
110
110
|
data = res.toObject() as T;
|
|
111
111
|
} else {
|
|
112
112
|
data = null;
|
|
113
113
|
}
|
|
114
114
|
}).catch(error => {
|
|
115
|
-
throw new DynamoBEError({ status: 417, message: `get ${this.
|
|
115
|
+
throw new DynamoBEError({ status: 417, message: `get ${this.dataParams.dbName} by ${this.depDataName} was unsuccessful (DB)`, error });
|
|
116
116
|
});
|
|
117
117
|
if (data && typeof data._id === 'object') {
|
|
118
118
|
data._id = `${data._id}`;
|
|
119
119
|
}
|
|
120
120
|
return data;
|
|
121
121
|
} else {
|
|
122
|
-
throw new DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.
|
|
122
|
+
throw new DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.dataParams.dbName}) (BD)` });
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
@@ -129,14 +129,14 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
129
129
|
* @returns dataList
|
|
130
130
|
*/
|
|
131
131
|
async getDataListByDependencyId(dependencyId: string): Promise<T[]> {
|
|
132
|
-
if (this.
|
|
132
|
+
if (this.depDataName) {
|
|
133
133
|
let dataList = [];
|
|
134
|
-
await this.dataModel.find({ [this.
|
|
134
|
+
await this.dataModel.find({ [this.depDataName]: dependencyId }).then(res => {
|
|
135
135
|
if (res) {
|
|
136
136
|
dataList = res;
|
|
137
137
|
}
|
|
138
138
|
}).catch(error => {
|
|
139
|
-
throw new DynamoBEError({ status: 417, message: `get ${this.
|
|
139
|
+
throw new DynamoBEError({ status: 417, message: `get ${this.dataParams.dbName} by ${this.depDataName} was unsuccessful (DB)`, error });
|
|
140
140
|
});
|
|
141
141
|
if (0 < dataList.length && typeof dataList[0]._id === 'object') {
|
|
142
142
|
dataList.forEach((data: T) => {
|
|
@@ -145,7 +145,7 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
145
145
|
}
|
|
146
146
|
return dataList;
|
|
147
147
|
} else {
|
|
148
|
-
throw new DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.
|
|
148
|
+
throw new DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.dataParams.dbName}) (BD)` });
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
|
|
@@ -155,18 +155,18 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
155
155
|
* @returns dataList
|
|
156
156
|
*/
|
|
157
157
|
async getDataListByDependencyIds(ids: string[]): Promise<T[]> {
|
|
158
|
-
if (this.
|
|
158
|
+
if (this.depDataName) {
|
|
159
159
|
let dataList = [];
|
|
160
|
-
await this.dataModel.find({ [this.
|
|
160
|
+
await this.dataModel.find({ [this.depDataName]: { $in: ids }}).then(res => {
|
|
161
161
|
if (res) {
|
|
162
162
|
dataList = res;
|
|
163
163
|
}
|
|
164
164
|
}).catch(error => {
|
|
165
|
-
throw new DynamoBEError({ status: 417, message: `get ${this.
|
|
165
|
+
throw new DynamoBEError({ status: 417, message: `get ${this.dataParams.dbName}s by ${this.depDataName}s was unsuccessful (DB)`, error });
|
|
166
166
|
});
|
|
167
167
|
return dataList;
|
|
168
168
|
} else {
|
|
169
|
-
throw new DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.
|
|
169
|
+
throw new DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.dataParams.dbName}) (BD)` });
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
|
|
@@ -181,13 +181,13 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
181
181
|
const filter = {};
|
|
182
182
|
|
|
183
183
|
if (narrowByDependencyIds.length > 0) {
|
|
184
|
-
if (this.
|
|
185
|
-
filter[this.
|
|
184
|
+
if (this.depDataName) {
|
|
185
|
+
filter[this.depDataName] = { $in: narrowByDependencyIds };
|
|
186
186
|
} else {
|
|
187
|
-
throw new DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.
|
|
187
|
+
throw new DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.dataParams.dbName}) (BD)` });
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
await this.
|
|
190
|
+
await this.dataParams.modelParams.forEach((modelParam: DynamoBEDataPropertyParams) => {
|
|
191
191
|
if ((searchBy[modelParam.key] !== null && searchBy[modelParam.key] !== undefined) || searchBy[modelParam.key + 'Range']) {
|
|
192
192
|
if (modelParam.key.includes('Range') || modelParam.type.includes('[]')) {
|
|
193
193
|
// inverz search filter (for Range and Array functions)
|
|
@@ -231,7 +231,7 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
231
231
|
dataList = res;
|
|
232
232
|
}
|
|
233
233
|
}).catch(error => {
|
|
234
|
-
throw new DynamoBEError({ status: 417, message: `search ${this.
|
|
234
|
+
throw new DynamoBEError({ status: 417, message: `search ${this.dataParams.dbName} was unsuccessful (DB)`, error });
|
|
235
235
|
});
|
|
236
236
|
if (0 < dataList.length && typeof dataList[0]._id === 'object') {
|
|
237
237
|
dataList.forEach((data: T) => {
|
|
@@ -255,7 +255,7 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
255
255
|
data = null;
|
|
256
256
|
}
|
|
257
257
|
}).catch(error => {
|
|
258
|
-
throw new DynamoBEError({ status: 417, message: `find ${this.
|
|
258
|
+
throw new DynamoBEError({ status: 417, message: `find ${this.dataParams.dbName} was unsuccessful (DB)`, error });
|
|
259
259
|
});
|
|
260
260
|
if (data && typeof data._id === 'object') {
|
|
261
261
|
data._id = `${data._id}`;
|
|
@@ -274,7 +274,7 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
274
274
|
dataList = res;
|
|
275
275
|
}
|
|
276
276
|
}).catch(error => {
|
|
277
|
-
throw new DynamoBEError({ status: 417, message: `get all ${this.
|
|
277
|
+
throw new DynamoBEError({ status: 417, message: `get all ${this.dataParams.dbName} was unsuccessful (DB)`, error });
|
|
278
278
|
});
|
|
279
279
|
if (0 < dataList.length && typeof dataList[0]._id === 'object') {
|
|
280
280
|
dataList.forEach((data: T) => {
|
|
@@ -294,7 +294,7 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
294
294
|
update.__lastModified = new Date();
|
|
295
295
|
update.__lastModifiedBy = modifier;
|
|
296
296
|
await this.dataModel.updateOne(updateBy, update).catch(error => {
|
|
297
|
-
throw new DynamoBEError({ status: 417, message: `update one parameter on ${this.
|
|
297
|
+
throw new DynamoBEError({ status: 417, message: `update one parameter on ${this.dataParams.dbName} was unsuccessful (DB)`, error });
|
|
298
298
|
});
|
|
299
299
|
} */
|
|
300
300
|
|
|
@@ -304,7 +304,7 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
304
304
|
*/
|
|
305
305
|
async deleteDataById(id: string): Promise<void> {
|
|
306
306
|
await this.dataModel.findByIdAndDelete(id).catch(error => {
|
|
307
|
-
throw new DynamoBEError({ status: 417, message: `delete ${this.
|
|
307
|
+
throw new DynamoBEError({ status: 417, message: `delete ${this.dataParams.dbName} was unsuccessful (DB)`, error });
|
|
308
308
|
});
|
|
309
309
|
}
|
|
310
310
|
|
|
@@ -313,12 +313,12 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
313
313
|
* @param dependencyId id
|
|
314
314
|
*/
|
|
315
315
|
async deleteDataByDependencyId(dependencyId: string): Promise<void> {
|
|
316
|
-
if (this.
|
|
317
|
-
await this.dataModel.deleteMany({ [this.
|
|
318
|
-
throw new DynamoBEError({ status: 417, message: `delete ${this.
|
|
316
|
+
if (this.depDataName) {
|
|
317
|
+
await this.dataModel.deleteMany({ [this.depDataName]: dependencyId }).catch(error => {
|
|
318
|
+
throw new DynamoBEError({ status: 417, message: `delete ${this.dataParams.dbName} by ${this.depDataName} was unsuccessful (DB)`, error });
|
|
319
319
|
});
|
|
320
320
|
} else {
|
|
321
|
-
throw new DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.
|
|
321
|
+
throw new DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.dataParams.dbName}) (BD)` });
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
324
|
|
|
@@ -341,7 +341,7 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
341
341
|
data = null;
|
|
342
342
|
}
|
|
343
343
|
}).catch(error => {
|
|
344
|
-
throw new DynamoBEError({ status: 417, message: `findOne ${this.
|
|
344
|
+
throw new DynamoBEError({ status: 417, message: `findOne ${this.dataParams.dbName} was unsuccessful (DB)`, error });
|
|
345
345
|
});
|
|
346
346
|
if (data && typeof data._id === 'object') {
|
|
347
347
|
data._id = `${data._id}`;
|
|
@@ -361,7 +361,7 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
361
361
|
dataList = res;
|
|
362
362
|
}
|
|
363
363
|
}).catch(error => {
|
|
364
|
-
throw new DynamoBEError({ status: 417, message: `find ${this.
|
|
364
|
+
throw new DynamoBEError({ status: 417, message: `find ${this.dataParams.dbName} was unsuccessful (DB)`, error });
|
|
365
365
|
});
|
|
366
366
|
if (0 < dataList.length && typeof dataList[0]._id === 'object') {
|
|
367
367
|
dataList.forEach((data: T) => {
|
|
@@ -390,7 +390,7 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
390
390
|
dataList = res;
|
|
391
391
|
}
|
|
392
392
|
}).catch(error => {
|
|
393
|
-
throw new DynamoBEError({ status: 417, message: `findWithPaging ${this.
|
|
393
|
+
throw new DynamoBEError({ status: 417, message: `findWithPaging ${this.dataParams.dbName} was unsuccessful (DB)`, error });
|
|
394
394
|
});
|
|
395
395
|
if (0 < dataList.length && typeof dataList[0]._id === 'object') {
|
|
396
396
|
dataList.forEach((data: T) => {
|
|
@@ -414,10 +414,10 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
414
414
|
if (res) {
|
|
415
415
|
data = res.toObject() as T;
|
|
416
416
|
} else {
|
|
417
|
-
throw new DynamoBEError({ status: 204, message: `${this.
|
|
417
|
+
throw new DynamoBEError({ status: 204, message: `${this.dataParams.dbName} not found! (BD)` });
|
|
418
418
|
}
|
|
419
419
|
}).catch(error => {
|
|
420
|
-
throw new DynamoBEError({ status: 417, message: `findByIdAndUpdate ${this.
|
|
420
|
+
throw new DynamoBEError({ status: 417, message: `findByIdAndUpdate ${this.dataParams.dbName} was unsuccessful (DB)`, error });
|
|
421
421
|
});
|
|
422
422
|
update.__v = data.__v;
|
|
423
423
|
return update;
|
|
@@ -432,7 +432,7 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
432
432
|
update.__lastModified = new Date();
|
|
433
433
|
update.__lastModifiedBy = modifier;
|
|
434
434
|
await this.dataModel.updateOne(updateBy, update).catch(error => {
|
|
435
|
-
throw new DynamoBEError({ status: 417, message: `updateOne ${this.
|
|
435
|
+
throw new DynamoBEError({ status: 417, message: `updateOne ${this.dataParams.dbName} was unsuccessful (DB)`, error });
|
|
436
436
|
});
|
|
437
437
|
}
|
|
438
438
|
|
|
@@ -445,7 +445,7 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
445
445
|
update.__lastModified = new Date();
|
|
446
446
|
update.__lastModifiedBy = modifier;
|
|
447
447
|
await this.dataModel.updateMany(updateBy, update).catch(error => {
|
|
448
|
-
throw new DynamoBEError({ status: 417, message: `updateMany ${this.
|
|
448
|
+
throw new DynamoBEError({ status: 417, message: `updateMany ${this.dataParams.dbName} was unsuccessful (DB)`, error });
|
|
449
449
|
});
|
|
450
450
|
}
|
|
451
451
|
|
|
@@ -477,7 +477,7 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
477
477
|
private buildMongooseSchemaByModelParams(params?: DynamoBEDataPropertyParams[]): any {
|
|
478
478
|
const schemaSettingsObj = {};
|
|
479
479
|
if (!params) {
|
|
480
|
-
params = this.
|
|
480
|
+
params = this.dataParams.modelParams;
|
|
481
481
|
}
|
|
482
482
|
params.forEach((property: DynamoBEDataPropertyParams) => {
|
|
483
483
|
const beType = this.getBEType(property.type);
|
|
@@ -547,10 +547,10 @@ export class DynamoBEDBService<T extends Metadata> {
|
|
|
547
547
|
* sets depDataKey
|
|
548
548
|
*/
|
|
549
549
|
private lookForDependencyDataSettings(): void {
|
|
550
|
-
const dependencyParam: DynamoBEDataPropertyParams = this.
|
|
550
|
+
const dependencyParam: DynamoBEDataPropertyParams = this.dataParams.modelParams.find(
|
|
551
551
|
(modelParams: DynamoBEDataPropertyParams) => modelParams.isDependencyHook);
|
|
552
552
|
if (dependencyParam) {
|
|
553
|
-
this.
|
|
553
|
+
this.depDataName = dependencyParam.key;
|
|
554
554
|
}
|
|
555
555
|
}
|
|
556
556
|
}
|
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
import { DynamoBEEmailService } from './dynamobe-email.service';
|
|
3
3
|
import { DynamoBESingletonService } from './dynamobe-singleton.service';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Extend this class as an Email Service Collection implementation
|
|
7
|
+
*
|
|
8
|
+
* You should use singleton instance getting function by implementing a
|
|
9
|
+
* static getInstance() function
|
|
10
|
+
* @example
|
|
11
|
+
* export class EmailServiceCollectionService extends DynamoBEEmailServiceCollection {
|
|
12
|
+
*
|
|
13
|
+
* static getInstance(): EmailServiceCollectionService {
|
|
14
|
+
* return EmailServiceCollectionService.getSingletonInstance();
|
|
15
|
+
* }
|
|
16
|
+
* ...
|
|
17
|
+
*/
|
|
5
18
|
export class DynamoBEEmailServiceCollection extends DynamoBESingletonService {
|
|
6
19
|
|
|
7
20
|
[service: string]: DynamoBEEmailService;
|
|
@@ -58,7 +58,7 @@ export class DynamoBEEmailService {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
private constructionFinished(): void {
|
|
61
|
-
DBE_Shared.logSuccess(`\
|
|
61
|
+
DBE_Shared.logSuccess(`\nEmailService construction (${this.senderName}) Finished!\n`)
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
public async sendEmail(set: {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
|
|
3
|
+
import { DynamoBEAuthService } from './dynamobe-auth.service';
|
|
4
|
+
import { DynamoBEDBServiceCollection } from './dynamobe-db-service-collection.service';
|
|
5
|
+
import { DynamoBEEmailServiceCollection } from './dynamobe-email-service-collection.service';
|
|
6
|
+
import { DynamoBESingletonService } from './dynamobe-singleton.service';
|
|
7
|
+
|
|
8
|
+
export class DBE_Global_SC extends DynamoBESingletonService { // unused, dont use this for now
|
|
9
|
+
|
|
10
|
+
static getInstance(): DBE_Global_SC {
|
|
11
|
+
return DBE_Global_SC.getSingletonInstance();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
authService: DynamoBEAuthService;
|
|
15
|
+
dbServiceCollection: DynamoBEDBServiceCollection;
|
|
16
|
+
emailServiceCollection: DynamoBEEmailServiceCollection;
|
|
17
|
+
|
|
18
|
+
static setServices(
|
|
19
|
+
set: {
|
|
20
|
+
authService: DynamoBEAuthService,
|
|
21
|
+
dbServiceCollection: DynamoBEDBServiceCollection,
|
|
22
|
+
emailServiceCollection: DynamoBEEmailServiceCollection,
|
|
23
|
+
}
|
|
24
|
+
): void {
|
|
25
|
+
this.getInstance();
|
|
26
|
+
this.instance.authService = set.authService;
|
|
27
|
+
this.instance.dbServiceCollection = set.dbServiceCollection;
|
|
28
|
+
this.instance.emailServiceCollection = set.emailServiceCollection;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static getAuthService(): DynamoBEAuthService {
|
|
32
|
+
if (!this.instance?.authService?.authenticateToken) {
|
|
33
|
+
throw new Error(`Unique Authentication Service missing!` +
|
|
34
|
+
`\nPlease create a Unique Authentication Service extending DynamoBEAuthService, ` +
|
|
35
|
+
`and Setup with "DBE_Global_SC.setServices(...)"`);
|
|
36
|
+
}
|
|
37
|
+
return this.instance.authService;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static getDBServiceCollection(): DynamoBEDBServiceCollection {
|
|
41
|
+
if (!this.instance?.dbServiceCollection) {
|
|
42
|
+
throw new Error(`Unique DataBase Service Collection missing!` +
|
|
43
|
+
`\nPlease create a Unique DataBase Service Collectio extending DynamoBEDBServiceCollection, ` +
|
|
44
|
+
`and Setup with "DBE_Global_SC.setServices(...)"`);
|
|
45
|
+
}
|
|
46
|
+
return this.instance.authService;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static getEmailServiceCollection(): DynamoBEEmailServiceCollection {
|
|
50
|
+
if (!this.instance?.emailServiceCollection) {
|
|
51
|
+
throw new Error(`Unique Email Service Collection missing!` +
|
|
52
|
+
`\nPlease create a Unique Email Service Collection extending DynamoBEEmailServiceCollection, ` +
|
|
53
|
+
`and Setup with "DBE_Global_SC.setServices(...)"`);
|
|
54
|
+
}
|
|
55
|
+
return this.instance.emailServiceCollection;
|
|
56
|
+
}
|
|
57
|
+
} */
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
import { DynamoBERouteSecurity } from '../_enums/dynamobe-route-security.enum';
|
|
4
|
+
import { Metadata } from '../_models/fullstack-models/data-models/metadata';
|
|
4
5
|
import { DynamoBEGlobalSettings } from '../_models/dynamobe-global-settings';
|
|
5
6
|
import { DynamoBEAuthService } from './dynamobe-auth.service';
|
|
6
7
|
import { DynamoBEDBServiceCollection } from './dynamobe-db-service-collection.service';
|
|
8
|
+
import { DynamoBEDBService } from './dynamobe-db.service';
|
|
7
9
|
import { DynamoBEEmailServiceCollection } from './dynamobe-email-service-collection.service';
|
|
8
10
|
import { DynamoBESingletonService } from './dynamobe-singleton.service';
|
|
11
|
+
import { DynamoBEDataParams } from '../_models/fullstack-models/control-models/dynamobe-data-params';
|
|
9
12
|
|
|
13
|
+
/**
|
|
14
|
+
* This is the main Global/Core Service Collection used by DynamoBE,
|
|
15
|
+
* you also can use this to access main services as
|
|
16
|
+
* dbServices, emailServices, or authService
|
|
17
|
+
*/
|
|
10
18
|
export class DBE_Global_S extends DynamoBESingletonService {
|
|
11
19
|
|
|
12
20
|
static getInstance(): DBE_Global_S {
|
|
@@ -25,16 +33,35 @@ export class DBE_Global_S extends DynamoBESingletonService {
|
|
|
25
33
|
dbServiceCollection: DynamoBEDBServiceCollection;
|
|
26
34
|
emailServiceCollection: DynamoBEEmailServiceCollection;
|
|
27
35
|
|
|
36
|
+
/**
|
|
37
|
+
* You need to setup global Services through this function
|
|
38
|
+
*/
|
|
28
39
|
static setServices(
|
|
29
40
|
set: {
|
|
41
|
+
/**
|
|
42
|
+
* You need to setup your Own Auth Service extending the DynamoBEAuthService class
|
|
43
|
+
*/
|
|
30
44
|
authService: DynamoBEAuthService,
|
|
31
|
-
|
|
32
|
-
|
|
45
|
+
/**
|
|
46
|
+
* You can setup your Own Email Service extending the DynamoBEEmailServiceCollection class
|
|
47
|
+
*/
|
|
48
|
+
emailServiceCollection?: DynamoBEEmailServiceCollection,
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* you can setup data tables by passing a DynamoBEDataParams list at this point
|
|
52
|
+
*/
|
|
53
|
+
dbModels: DynamoBEDataParams[],
|
|
33
54
|
}
|
|
34
55
|
): void {
|
|
35
56
|
this.getInstance();
|
|
57
|
+
|
|
58
|
+
this.instance.dbServiceCollection = new DynamoBEDBServiceCollection();
|
|
59
|
+
set.dbModels.forEach((dbModel: DynamoBEDataParams) => {
|
|
60
|
+
this.instance.dbServiceCollection[dbModel.dataName] = new DynamoBEDBService(dbModel); // dbModel.constructDBService();
|
|
61
|
+
});
|
|
62
|
+
|
|
36
63
|
this.instance.authService = set.authService;
|
|
37
|
-
this.instance.dbServiceCollection = set.dbServiceCollection;
|
|
64
|
+
/* this.instance.dbServiceCollection = set.dbServiceCollection; */
|
|
38
65
|
this.instance.emailServiceCollection = set.emailServiceCollection;
|
|
39
66
|
}
|
|
40
67
|
|
|
@@ -85,7 +112,25 @@ export class DBE_Global_S extends DynamoBESingletonService {
|
|
|
85
112
|
`\nPlease create a Unique DataBase Service Collectio extending DynamoBEDBServiceCollection, ` +
|
|
86
113
|
`and Setup with "DBE_Global_SC.setServices(...)"`);
|
|
87
114
|
}
|
|
88
|
-
return this.instance.
|
|
115
|
+
return this.instance.dbServiceCollection;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
static getDBService<T extends Metadata>(dataParams: DynamoBEDataParams): DynamoBEDBService<T> {
|
|
119
|
+
return this.getDBServiceByKey<T>(dataParams.dataName);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
static getDBServiceByKey<T extends Metadata>(key: string): DynamoBEDBService<T> {
|
|
123
|
+
const collection = this.getDBServiceCollection();
|
|
124
|
+
if (collection[key]) {
|
|
125
|
+
return collection[key] as DynamoBEDBService<T>;
|
|
126
|
+
} else {
|
|
127
|
+
let keys: string = `${Object.keys(collection)}`;
|
|
128
|
+
keys = keys.replace(/,/g, '\n ');
|
|
129
|
+
throw new Error(`\nDBE_Global_S.getDBService failed ERROR:
|
|
130
|
+
no dbService on collection with this key: ${key}!
|
|
131
|
+
The available dbServices on collection:
|
|
132
|
+
${keys}\n`);
|
|
133
|
+
}
|
|
89
134
|
}
|
|
90
135
|
|
|
91
136
|
static getEmailServiceCollection(): DynamoBEEmailServiceCollection {
|
|
@@ -96,4 +141,4 @@ export class DBE_Global_S extends DynamoBESingletonService {
|
|
|
96
141
|
}
|
|
97
142
|
return this.instance.emailServiceCollection;
|
|
98
143
|
}
|
|
99
|
-
}
|
|
144
|
+
}
|
|
@@ -6,6 +6,7 @@ import { DynamoBEEndpointParams } from '../_models/dynamobe-endpoint-control';
|
|
|
6
6
|
import { DynamoBEError } from '../_models/fullstack-models/control-models/dynamobe-error';
|
|
7
7
|
import { DynamoBEController } from './dynamobe-controller.service';
|
|
8
8
|
import { DBE_Global_S } from './dynamobe-global.service';
|
|
9
|
+
import { DBE_Shared } from './dynamobe-shared.service';
|
|
9
10
|
|
|
10
11
|
export class DynamoBERountingModule {
|
|
11
12
|
|
|
@@ -27,13 +28,16 @@ export class DynamoBERountingModule {
|
|
|
27
28
|
securityOverride?: DynamoBERouteSecurity,
|
|
28
29
|
}
|
|
29
30
|
){
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
try {
|
|
32
|
+
this.route = set.route;
|
|
33
|
+
this.controllers = set.controllers;
|
|
34
|
+
this.setupRoutes();
|
|
35
|
+
this.mountRoutes(set.securityOverride);
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
if (this.log) console.log(`routing module setup done: ${this.route} serurity: ${this.security}\n`);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
DBE_Shared.logError(`Routing module setup failed (${this.route})`, error);
|
|
40
|
+
}
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
/**
|
|
@@ -35,20 +35,24 @@ export abstract class DynamoBEServer extends DynamoBESingletonService {
|
|
|
35
35
|
protected constructor(){
|
|
36
36
|
super();
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
try {
|
|
39
|
+
this.setupRoutingModules();
|
|
40
|
+
this.setSecurity();
|
|
41
|
+
|
|
42
|
+
this.initExpresses();
|
|
43
|
+
this.startExpresses();
|
|
44
|
+
|
|
45
|
+
if (this.security !== DynamoBERouteSecurity.secure) {
|
|
46
|
+
this.mountOpenRoutes();
|
|
47
|
+
}
|
|
48
|
+
if (this.security !== DynamoBERouteSecurity.open && this.cert) {
|
|
49
|
+
this.mountSecureRoutes();
|
|
50
|
+
}
|
|
43
51
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (this.security !== DynamoBERouteSecurity.open && this.cert) {
|
|
48
|
-
this.mountSecureRoutes();
|
|
52
|
+
if (this.log) console.log(`\nRoutes mounted.... server using security: ${this.security}`);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
DBE_Shared.logError('DynamoBEServer ERROR: Server start failed:', error);
|
|
49
55
|
}
|
|
50
|
-
|
|
51
|
-
if (this.log) console.log(`\nRoutes mounted.... server using security: ${this.security}`);
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
private initExpresses() {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DynamoBERouteSecurity } from './_enums/dynamobe-route-security.enum';
|
|
2
|
+
import { DynamoBEGlobalSettings } from './_models/dynamobe-global-settings';
|
|
3
|
+
|
|
4
|
+
export const dynamoBEGlobalSettings: DynamoBEGlobalSettings = {
|
|
5
|
+
defaultRouteSecurity: DynamoBERouteSecurity.open,
|
|
6
|
+
logSetup: false,
|
|
7
|
+
logRequests: true,
|
|
8
|
+
logRequestsContent: true,
|
|
9
|
+
logResponseContent: false,
|
|
10
|
+
};
|
package/src/sync.ffs_db
ADDED
|
Binary file
|
package/src/version.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"v01.
|
|
2
|
+
"v01.04.01"
|
package/tsconfig.json
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
"incremental": true, /* Enable incremental compilation */
|
|
5
5
|
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
|
|
6
6
|
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
|
7
|
-
"lib": ["es6"
|
|
7
|
+
"lib": ["es6",
|
|
8
|
+
"es2018",
|
|
9
|
+
"dom"], /* Specify library files to be included in the compilation. */
|
|
8
10
|
"allowJs": true, /* Allow javascript files to be compiled. */
|
|
9
11
|
// "checkJs": true, /* Report errors in .js files. */
|
|
10
12
|
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamobe-global.settings.d.ts","sourceRoot":"","sources":["../../src/_constants/dynamobe-global.settings.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,eAAO,MAAM,6BAA6B,EAAE,sBAM3C,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dynamoBEDefaultGlobalSettings = void 0;
|
|
4
|
-
const dynamobe_route_security_enum_1 = require("../_enums/dynamobe-route-security.enum");
|
|
5
|
-
exports.dynamoBEDefaultGlobalSettings = {
|
|
6
|
-
defaultRouteSecurity: dynamobe_route_security_enum_1.DynamoBERouteSecurity.open,
|
|
7
|
-
logSetup: false,
|
|
8
|
-
logRequests: true,
|
|
9
|
-
logRequestsContent: true,
|
|
10
|
-
logResponseContent: false,
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=dynamobe-global.settings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamobe-global.settings.js","sourceRoot":"","sources":["../../src/_constants/dynamobe-global.settings.ts"],"names":[],"mappings":";;;AACA,yFAA+E;AAGlE,QAAA,6BAA6B,GAA2B;IACnE,oBAAoB,EAAE,oDAAqB,CAAC,IAAI;IAChD,QAAQ,EAAE,KAAK;IACf,WAAW,EAAE,IAAI;IACjB,kBAAkB,EAAE,IAAI;IACxB,kBAAkB,EAAE,KAAK;CAC1B,CAAC"}
|