@futdevpro/nts-dynamo 1.6.59 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/_constants/mocks/app-extended-server.mock.js +8 -13
- package/lib/_constants/mocks/app-extended-server.mock.js.map +1 -1
- package/lib/_constants/mocks/app-server.mock.js +4 -9
- package/lib/_constants/mocks/app-server.mock.js.map +1 -1
- package/lib/_constants/mocks/auth-service.mock.js +3 -10
- package/lib/_constants/mocks/auth-service.mock.js.map +1 -1
- package/lib/_constants/mocks/data-model.mock.js +17 -0
- package/lib/_constants/mocks/data-model.mock.js.map +1 -1
- package/lib/_constants/mocks/email-service-collection.mock.js +1 -4
- package/lib/_constants/mocks/email-service-collection.mock.js.map +1 -1
- package/lib/_constants/mocks/endpoint.mock.js +12 -13
- package/lib/_constants/mocks/endpoint.mock.js.map +1 -1
- package/lib/_constants/mocks/socket-client.mock.js +2 -3
- package/lib/_constants/mocks/socket-client.mock.js.map +1 -1
- package/lib/_constants/mocks/socket-server.mock.js +2 -5
- package/lib/_constants/mocks/socket-server.mock.js.map +1 -1
- package/lib/_models/control-models/api-call-params.control-model.js +32 -0
- package/lib/_models/control-models/api-call-params.control-model.js.map +1 -1
- package/lib/_models/control-models/app-params.control-model.js +31 -4
- package/lib/_models/control-models/app-params.control-model.js.map +1 -1
- package/lib/_models/control-models/app-system-controls.control-model copy.js +3 -5
- package/lib/_models/control-models/app-system-controls.control-model copy.js.map +1 -1
- package/lib/_models/control-models/app-system-controls.control-model.js +4 -6
- package/lib/_models/control-models/app-system-controls.control-model.js.map +1 -1
- package/lib/_models/control-models/endpoint-params.control-model.js +91 -88
- package/lib/_models/control-models/endpoint-params.control-model.js.map +1 -1
- package/lib/_models/control-models/socket-client-service-params.control-model.js +8 -5
- package/lib/_models/control-models/socket-client-service-params.control-model.js.map +1 -1
- package/lib/_models/control-models/socket-event.control-model.js +35 -34
- package/lib/_models/control-models/socket-event.control-model.js.map +1 -1
- package/lib/_models/control-models/socket-presence.control-model.js +10 -9
- package/lib/_models/control-models/socket-presence.control-model.js.map +1 -1
- package/lib/_models/control-models/socket-server-service-params.control-model.js +3 -0
- package/lib/_models/control-models/socket-server-service-params.control-model.js.map +1 -1
- package/lib/_models/control-models/system-control.control-model.js +3 -5
- package/lib/_models/control-models/system-control.control-model.js.map +1 -1
- package/lib/_modules/custom-data/custom-data.controller.js +6 -7
- package/lib/_modules/custom-data/custom-data.controller.js.map +1 -1
- package/lib/_modules/test/test.controller.js +12 -13
- package/lib/_modules/test/test.controller.js.map +1 -1
- package/lib/_modules/usage/usage.controller.js +15 -14
- package/lib/_modules/usage/usage.controller.js.map +1 -1
- package/lib/_modules/usage/usage.data-service.js +88 -96
- package/lib/_modules/usage/usage.data-service.js.map +1 -1
- package/lib/_services/base/data.service.js +370 -295
- package/lib/_services/base/data.service.js.map +1 -1
- package/lib/_services/base/db.service.js +315 -246
- package/lib/_services/base/db.service.js.map +1 -1
- package/lib/_services/base/singleton.service.js +2 -0
- package/lib/_services/base/singleton.service.js.map +1 -1
- package/lib/_services/core/api.service.js +185 -188
- package/lib/_services/core/api.service.js.map +1 -1
- package/lib/_services/core/auth.service.js +3 -3
- package/lib/_services/core/auth.service.js.map +1 -1
- package/lib/_services/core/email.service.js +103 -88
- package/lib/_services/core/email.service.js.map +1 -1
- package/lib/_services/core/global.service.js +38 -40
- package/lib/_services/core/global.service.js.map +1 -1
- package/lib/_services/route/controller.service.js +28 -0
- package/lib/_services/route/controller.service.js.map +1 -1
- package/lib/_services/route/routing-module.service.js +11 -8
- package/lib/_services/route/routing-module.service.js.map +1 -1
- package/lib/_services/server/app-extended.server.js +241 -247
- package/lib/_services/server/app-extended.server.js.map +1 -1
- package/lib/_services/server/app-extended.server.spec.js +18 -19
- package/lib/_services/server/app-extended.server.spec.js.map +1 -1
- package/lib/_services/server/app.server.js +404 -412
- package/lib/_services/server/app.server.js.map +1 -1
- package/lib/_services/server/app.server.spec.js +12 -13
- package/lib/_services/server/app.server.spec.js.map +1 -1
- package/lib/_services/shared.static-service.js +15 -17
- package/lib/_services/shared.static-service.js.map +1 -1
- package/lib/_services/socket/socket-client.service.js +134 -145
- package/lib/_services/socket/socket-client.service.js.map +1 -1
- package/lib/_services/socket/socket-server.service.js +294 -263
- package/lib/_services/socket/socket-server.service.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/nodemon.json +12 -5
- package/package.json +24 -24
- package/tsconfig.json +2 -2
|
@@ -169,25 +169,39 @@ const app_system_controls_control_model_1 = require("../../_models/control-model
|
|
|
169
169
|
*
|
|
170
170
|
*/
|
|
171
171
|
class DynamoNTS_App extends singleton_service_1.DynamoNTS_SingletonService {
|
|
172
|
+
systemControls = new app_system_controls_control_model_1.DynamoNTS_AppSystemControls();
|
|
172
173
|
get started() { return this.systemControls.app.started; }
|
|
173
174
|
get superStarted() { return this.systemControls.app.started; }
|
|
175
|
+
constructErrors = [];
|
|
174
176
|
get serverName() { return this.params.name; }
|
|
177
|
+
_params;
|
|
175
178
|
get params() { return this._params; }
|
|
179
|
+
mongoose = Mongoose;
|
|
180
|
+
_security;
|
|
176
181
|
get security() { return this._security; }
|
|
182
|
+
_ports;
|
|
177
183
|
get ports() { return this._ports; }
|
|
184
|
+
_cert;
|
|
178
185
|
get cert() { return this._cert; }
|
|
186
|
+
openExpress;
|
|
187
|
+
secureExpress;
|
|
188
|
+
httpsServer;
|
|
189
|
+
httpServer;
|
|
190
|
+
globalService;
|
|
191
|
+
_rootServices = [];
|
|
192
|
+
_routingModules = [];
|
|
193
|
+
/**
|
|
194
|
+
* setting this value to true, enables this service debug logs
|
|
195
|
+
*/
|
|
196
|
+
logSetup;
|
|
197
|
+
deepLog;
|
|
198
|
+
logFn;
|
|
179
199
|
constructor(extended) {
|
|
180
200
|
super();
|
|
181
|
-
this.systemControls = new app_system_controls_control_model_1.DynamoNTS_AppSystemControls();
|
|
182
|
-
this.constructErrors = [];
|
|
183
|
-
this.mongoose = Mongoose;
|
|
184
|
-
this._rootServices = [];
|
|
185
|
-
this._routingModules = [];
|
|
186
201
|
process.on('unhandledRejection', (reason, p) => {
|
|
187
|
-
var _a;
|
|
188
202
|
fsm_dynamo_1.Dynamo_Log.highlightedError('Unhandled Rejection at: ', p, '\nRejection reason:', reason);
|
|
189
203
|
try {
|
|
190
|
-
|
|
204
|
+
global_service_1.DynamoNTS_GlobalService.globalErrorHandler?.(new fsm_dynamo_1.Dynamo_Error({
|
|
191
205
|
errorCode: 'NTS-AS0-BASE-UR',
|
|
192
206
|
message: 'Unhandled Rejection!',
|
|
193
207
|
error: new Error(p),
|
|
@@ -201,469 +215,447 @@ class DynamoNTS_App extends singleton_service_1.DynamoNTS_SingletonService {
|
|
|
201
215
|
fsm_dynamo_1.Dynamo_Log.error(`\nApplication: ${this._params.name} start failed.\n`, error);
|
|
202
216
|
});
|
|
203
217
|
}
|
|
204
|
-
asyncConstruct(extended) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
218
|
+
async asyncConstruct(extended) {
|
|
219
|
+
if (this.logFn && this.deepLog)
|
|
220
|
+
console.log('\nfn:. asyncConstruct');
|
|
221
|
+
try {
|
|
222
|
+
this.systemControls.app.init = true;
|
|
223
|
+
this._params = this.getAppParams();
|
|
224
|
+
fsm_dynamo_1.dynamo_error_default.issuerSystem = this._params.systemName;
|
|
225
|
+
this.overrideDynamoNTSGlobalSettings?.();
|
|
226
|
+
this.logSetup = global_settings_const_1.dynamoNTS_globalSettings.logSetup;
|
|
227
|
+
this.globalService = global_service_1.DynamoNTS_GlobalService.getInstance();
|
|
228
|
+
global_service_1.DynamoNTS_GlobalService.setServices(this.getGlobalServiceCollection());
|
|
229
|
+
global_service_1.DynamoNTS_GlobalService.setParams(this.params);
|
|
230
|
+
global_service_1.DynamoNTS_GlobalService.setGlobalErrorHandler(this.getGlobalErrorHandler?.());
|
|
231
|
+
if (this.getPortSettings) {
|
|
232
|
+
this._ports = this.getPortSettings();
|
|
233
|
+
}
|
|
234
|
+
if (this.getCertificationSettings) {
|
|
235
|
+
this._cert = this.getCertificationSettings();
|
|
236
|
+
}
|
|
237
|
+
if (this.getRoutingModules) {
|
|
238
|
+
this._routingModules = this.getRoutingModules();
|
|
239
|
+
}
|
|
240
|
+
await this.createEntries?.();
|
|
241
|
+
console.log(`\n\n\nStarting ${this._params.name}... `);
|
|
242
|
+
await this.startDB();
|
|
243
|
+
this.setSecurity();
|
|
244
|
+
if (this._routingModules?.length) {
|
|
245
|
+
await this.initExpresses();
|
|
246
|
+
await this.startExpresses();
|
|
247
|
+
if (this._security !== route_security_enum_1.DynamoNTS_RouteSecurity.secure) {
|
|
248
|
+
await this.mountOpenRoutes();
|
|
227
249
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
yield this.startDB();
|
|
231
|
-
this.setSecurity();
|
|
232
|
-
if ((_d = this._routingModules) === null || _d === void 0 ? void 0 : _d.length) {
|
|
233
|
-
yield this.initExpresses();
|
|
234
|
-
yield this.startExpresses();
|
|
235
|
-
if (this._security !== route_security_enum_1.DynamoNTS_RouteSecurity.secure) {
|
|
236
|
-
yield this.mountOpenRoutes();
|
|
237
|
-
}
|
|
238
|
-
if (this._security !== route_security_enum_1.DynamoNTS_RouteSecurity.open && this._cert) {
|
|
239
|
-
yield this.mountSecureRoutes();
|
|
240
|
-
}
|
|
241
|
-
if (this.logSetup) {
|
|
242
|
-
console.log(`\nRoutes mounted.... server using security: ${this._security}`);
|
|
243
|
-
}
|
|
250
|
+
if (this._security !== route_security_enum_1.DynamoNTS_RouteSecurity.open && this._cert) {
|
|
251
|
+
await this.mountSecureRoutes();
|
|
244
252
|
}
|
|
245
|
-
if (this.
|
|
246
|
-
|
|
253
|
+
if (this.logSetup) {
|
|
254
|
+
console.log(`\nRoutes mounted.... server using security: ${this._security}`);
|
|
247
255
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
+
}
|
|
257
|
+
if (this.getRootServices) {
|
|
258
|
+
this._rootServices = await this.getRootServices();
|
|
259
|
+
}
|
|
260
|
+
await this.postProcess?.();
|
|
261
|
+
if (!extended) {
|
|
262
|
+
await this.ready();
|
|
263
|
+
if (this.params.title) {
|
|
264
|
+
console.log(this.params.title);
|
|
265
|
+
console.log(`Version: ${this.params.version}`);
|
|
256
266
|
}
|
|
267
|
+
fsm_dynamo_1.Dynamo_Log.H_success(`${this.params.name} started successfully.`);
|
|
257
268
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
271
|
+
this.constructErrors.push(error);
|
|
272
|
+
fsm_dynamo_1.Dynamo_Log.error(`${this._params.name} start failed. ERRORS`, this.constructErrors);
|
|
273
|
+
throw new fsm_dynamo_1.Dynamo_Error({
|
|
274
|
+
errorCode: 'NTS-AS0-001',
|
|
275
|
+
error: error,
|
|
276
|
+
additionalContent: {
|
|
277
|
+
constructErrors: this.constructErrors,
|
|
278
|
+
systemControls: this.systemControls,
|
|
279
|
+
systemReadies: {
|
|
280
|
+
app: this.systemControls.app.getReady(),
|
|
281
|
+
mongoose: this.systemControls.mongoose.getReady(),
|
|
282
|
+
httpServer: this.systemControls.httpServer.getReady(),
|
|
283
|
+
httpsServer: this.systemControls.httpsServer.getReady(),
|
|
273
284
|
},
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
285
|
+
},
|
|
286
|
+
});
|
|
287
|
+
}
|
|
277
288
|
}
|
|
278
|
-
ready(timeout = 4 * fsm_dynamo_1.second) {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
289
|
+
async ready(timeout = 4 * fsm_dynamo_1.second) {
|
|
290
|
+
if (this.logFn)
|
|
291
|
+
console.log('\nfn:. ready');
|
|
292
|
+
let ready = false;
|
|
293
|
+
const start = +new Date();
|
|
294
|
+
if (this.constructErrors.length) {
|
|
295
|
+
fsm_dynamo_1.Dynamo_Log.error(`${this._params.name} start failed. ERRORS`, this.constructErrors);
|
|
296
|
+
throw new fsm_dynamo_1.Dynamo_Error({
|
|
297
|
+
message: `${this._params.name} start failed. ERRORS`,
|
|
298
|
+
additionalContent: this.constructErrors.length === 1 ? this.constructErrors[0] : { errors: this.constructErrors },
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
while (!ready && +new Date() - start < timeout) {
|
|
302
|
+
if (this.systemControls.app.init) {
|
|
303
|
+
ready = (this.systemControls.mongoose.getReady() &&
|
|
304
|
+
this.systemControls.httpServer.getReady() &&
|
|
305
|
+
this.systemControls.httpsServer.getReady());
|
|
291
306
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
ready = (this.systemControls.mongoose.getReady() &&
|
|
295
|
-
this.systemControls.httpServer.getReady() &&
|
|
296
|
-
this.systemControls.httpsServer.getReady());
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
fsm_dynamo_1.Dynamo_Log.error(`${this.params.name} APP NOT INITIALIZED while trying to get ready.`);
|
|
300
|
-
}
|
|
301
|
-
if (!ready) {
|
|
302
|
-
yield (0, fsm_dynamo_1.wait)(100);
|
|
303
|
-
}
|
|
307
|
+
else {
|
|
308
|
+
fsm_dynamo_1.Dynamo_Log.error(`${this.params.name} APP NOT INITIALIZED while trying to get ready.`);
|
|
304
309
|
}
|
|
305
|
-
if (
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
310
|
+
if (!ready) {
|
|
311
|
+
await (0, fsm_dynamo_1.wait)(100);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (timeout < +new Date() - start) {
|
|
315
|
+
fsm_dynamo_1.Dynamo_Log.error(`${this._params.name} start failed. TIMEOUT`, this.constructErrors);
|
|
316
|
+
throw new fsm_dynamo_1.Dynamo_Error({
|
|
317
|
+
message: `${this._params.name} start failed. TIMEOUT`,
|
|
318
|
+
additionalContent: {
|
|
319
|
+
constructErrors: this.constructErrors,
|
|
320
|
+
systemControls: this.systemControls,
|
|
321
|
+
systemReadies: {
|
|
322
|
+
mongoose: this.systemControls.mongoose.getReady(),
|
|
323
|
+
httpServer: this.systemControls.httpServer.getReady(),
|
|
324
|
+
httpsServer: this.systemControls.httpsServer.getReady(),
|
|
317
325
|
},
|
|
318
|
-
}
|
|
326
|
+
},
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
if (this.constructErrors.length) {
|
|
330
|
+
fsm_dynamo_1.Dynamo_Log.error(`${this._params.name} start failed. ERROR`, this.constructErrors);
|
|
331
|
+
throw new fsm_dynamo_1.Dynamo_Error({
|
|
332
|
+
message: `${this._params.name} start failed. ERROR`,
|
|
333
|
+
additionalContent: this.constructErrors,
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
if (ready) {
|
|
337
|
+
this.systemControls.app.started = true;
|
|
338
|
+
if (this.logFn && this.deepLog)
|
|
339
|
+
console.log('\nfn:. ready: return');
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
this.systemControls.app.started = false;
|
|
344
|
+
let msg = `${this._params.name} start failed. UNKNOWN`;
|
|
345
|
+
if (this.systemControls.mongoose.init && !this.systemControls.mongoose.started) {
|
|
346
|
+
msg += `\nMongoose start failed.`;
|
|
319
347
|
}
|
|
320
|
-
if (this.
|
|
321
|
-
|
|
322
|
-
throw new fsm_dynamo_1.Dynamo_Error({
|
|
323
|
-
message: `${this._params.name} start failed. ERROR`,
|
|
324
|
-
additionalContent: this.constructErrors,
|
|
325
|
-
});
|
|
348
|
+
if (this.systemControls.httpServer.init && !this.systemControls.httpServer.started) {
|
|
349
|
+
msg += `\nHTTP Server start failed.`;
|
|
326
350
|
}
|
|
327
|
-
if (
|
|
328
|
-
|
|
329
|
-
if (this.logFn && this.deepLog)
|
|
330
|
-
console.log('\nfn:. ready: return');
|
|
331
|
-
return;
|
|
351
|
+
if (this.systemControls.httpsServer.init && !this.systemControls.httpsServer.started) {
|
|
352
|
+
msg += `\nHTTPS Server start failed.`;
|
|
332
353
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
354
|
+
fsm_dynamo_1.Dynamo_Log.error(msg, this.constructErrors);
|
|
355
|
+
throw new fsm_dynamo_1.Dynamo_Error({
|
|
356
|
+
errorCode: 'NTS-AS0-110',
|
|
357
|
+
message: msg,
|
|
358
|
+
additionalContent: {
|
|
359
|
+
constructErrors: this.constructErrors,
|
|
360
|
+
systemControls: this.systemControls,
|
|
361
|
+
systemReadies: {
|
|
362
|
+
app: this.systemControls.app.getReady(),
|
|
363
|
+
mongoose: this.systemControls.mongoose.getReady(),
|
|
364
|
+
httpServer: this.systemControls.httpServer.getReady(),
|
|
365
|
+
httpsServer: this.systemControls.httpsServer.getReady(),
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
error: this.constructErrors?.[0] ?? new Error(),
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
async stop(dontLog) {
|
|
373
|
+
if (this.logFn)
|
|
374
|
+
console.log('\nfn:. stop');
|
|
375
|
+
if (this.started) {
|
|
376
|
+
if (this.systemControls.mongoose.init) {
|
|
377
|
+
this.systemControls.mongoose.started = false;
|
|
378
|
+
if (this.mongoose) {
|
|
379
|
+
await fsm_dynamo_1.Dynamo_Array.asyncForEach(Object.keys(this.mongoose.models), async (modelName) => {
|
|
380
|
+
await this.mongoose.deleteModel(modelName);
|
|
381
|
+
});
|
|
382
|
+
await this.mongoose.disconnect();
|
|
341
383
|
}
|
|
342
|
-
|
|
343
|
-
|
|
384
|
+
else {
|
|
385
|
+
fsm_dynamo_1.Dynamo_Log.error(`\nMongoose not found.`);
|
|
344
386
|
}
|
|
345
|
-
|
|
346
|
-
throw new fsm_dynamo_1.Dynamo_Error({
|
|
347
|
-
errorCode: 'NTS-AS0-110',
|
|
348
|
-
message: msg,
|
|
349
|
-
additionalContent: {
|
|
350
|
-
constructErrors: this.constructErrors,
|
|
351
|
-
systemControls: this.systemControls,
|
|
352
|
-
systemReadies: {
|
|
353
|
-
app: this.systemControls.app.getReady(),
|
|
354
|
-
mongoose: this.systemControls.mongoose.getReady(),
|
|
355
|
-
httpServer: this.systemControls.httpServer.getReady(),
|
|
356
|
-
httpsServer: this.systemControls.httpsServer.getReady(),
|
|
357
|
-
},
|
|
358
|
-
},
|
|
359
|
-
error: (_b = (_a = this.constructErrors) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : new Error(),
|
|
360
|
-
});
|
|
387
|
+
this.systemControls.mongoose.init = false;
|
|
361
388
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
if (this.started) {
|
|
369
|
-
if (this.systemControls.mongoose.init) {
|
|
370
|
-
this.systemControls.mongoose.started = false;
|
|
371
|
-
if (this.mongoose) {
|
|
372
|
-
yield fsm_dynamo_1.Dynamo_Array.asyncForEach(Object.keys(this.mongoose.models), (modelName) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
373
|
-
yield this.mongoose.deleteModel(modelName);
|
|
374
|
-
}));
|
|
375
|
-
yield this.mongoose.disconnect();
|
|
376
|
-
}
|
|
377
|
-
else {
|
|
378
|
-
fsm_dynamo_1.Dynamo_Log.error(`\nMongoose not found.`);
|
|
379
|
-
}
|
|
380
|
-
this.systemControls.mongoose.init = false;
|
|
389
|
+
if (this.systemControls.httpServer.init) {
|
|
390
|
+
this.systemControls.httpServer.started = false;
|
|
391
|
+
if (this.httpServer) {
|
|
392
|
+
await new Promise((resolve) => {
|
|
393
|
+
this.httpServer.close(resolve);
|
|
394
|
+
});
|
|
381
395
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
if (this.httpServer) {
|
|
385
|
-
yield new Promise((resolve) => {
|
|
386
|
-
this.httpServer.close(resolve);
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
else {
|
|
390
|
-
fsm_dynamo_1.Dynamo_Log.error(`\nHTTP Server not found.`);
|
|
391
|
-
}
|
|
392
|
-
this.systemControls.httpServer.init = false;
|
|
396
|
+
else {
|
|
397
|
+
fsm_dynamo_1.Dynamo_Log.error(`\nHTTP Server not found.`);
|
|
393
398
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
fsm_dynamo_1.Dynamo_Log.error(`\nHTTPS Server not found.`);
|
|
403
|
-
}
|
|
404
|
-
this.systemControls.httpsServer.init = false;
|
|
399
|
+
this.systemControls.httpServer.init = false;
|
|
400
|
+
}
|
|
401
|
+
if (this.systemControls.httpsServer.init) {
|
|
402
|
+
this.systemControls.httpsServer.started = false;
|
|
403
|
+
if (this.httpsServer) {
|
|
404
|
+
await new Promise((resolve) => {
|
|
405
|
+
this.httpsServer.close(resolve);
|
|
406
|
+
});
|
|
405
407
|
}
|
|
406
|
-
|
|
407
|
-
fsm_dynamo_1.Dynamo_Log.
|
|
408
|
+
else {
|
|
409
|
+
fsm_dynamo_1.Dynamo_Log.error(`\nHTTPS Server not found.`);
|
|
408
410
|
}
|
|
411
|
+
this.systemControls.httpsServer.init = false;
|
|
409
412
|
}
|
|
410
|
-
|
|
413
|
+
if (!dontLog) {
|
|
414
|
+
fsm_dynamo_1.Dynamo_Log.H_log(`${this._params.name} stopped successfully.`);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
411
417
|
}
|
|
412
418
|
/**
|
|
413
419
|
*
|
|
414
420
|
*/
|
|
415
|
-
startDB() {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
});
|
|
441
|
-
}));
|
|
421
|
+
async startDB() {
|
|
422
|
+
if (this.logFn && this.deepLog)
|
|
423
|
+
console.log('\nfn:. startDB');
|
|
424
|
+
await new Promise(async (resolve, reject) => {
|
|
425
|
+
this.systemControls.mongoose.init = true;
|
|
426
|
+
this.mongoose.connection
|
|
427
|
+
.on('error', (error) => {
|
|
428
|
+
this.systemControls.mongoose.started = false;
|
|
429
|
+
this.constructErrors.push(error);
|
|
430
|
+
fsm_dynamo_1.Dynamo_Log.error('\nUnable to connect to MongoDB server, ERROR: ', error);
|
|
431
|
+
reject(new fsm_dynamo_1.Dynamo_Error({
|
|
432
|
+
errorCode: 'NTS-AS0-100',
|
|
433
|
+
message: `Unable to connect to MongoDB server, ERROR: ${error}`,
|
|
434
|
+
error: error,
|
|
435
|
+
}));
|
|
436
|
+
})
|
|
437
|
+
.once('open', () => {
|
|
438
|
+
this.systemControls.mongoose.started = true;
|
|
439
|
+
fsm_dynamo_1.Dynamo_Log.success('\nConnected to MongoDB\n');
|
|
440
|
+
resolve();
|
|
441
|
+
});
|
|
442
|
+
this.mongoose.connect(this._params.dbUri, {
|
|
443
|
+
useNewUrlParser: true,
|
|
444
|
+
useUnifiedTopology: true
|
|
445
|
+
});
|
|
442
446
|
});
|
|
443
447
|
}
|
|
444
448
|
/**
|
|
445
449
|
*
|
|
446
450
|
*/
|
|
447
|
-
initExpresses() {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
if (this.
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
throw error;
|
|
473
|
-
}
|
|
474
|
-
yield this.initOpenExpress();
|
|
451
|
+
async initExpresses() {
|
|
452
|
+
if (this.logFn && this.deepLog)
|
|
453
|
+
console.log('\nfn:. initExpresses');
|
|
454
|
+
if (this._security && this._security !== route_security_enum_1.DynamoNTS_RouteSecurity.secure) {
|
|
455
|
+
if (!this._ports.httpPort) {
|
|
456
|
+
let errorMsg = `\nYou have open routes, but httpPort is not set!` +
|
|
457
|
+
`\nsecurity: ${this._security}` +
|
|
458
|
+
`\nset httpPort in DynamoBEServer - setupRoutingModules() to enable secure routes.`;
|
|
459
|
+
errorMsg += '\n\nThe routes setted to use open server:';
|
|
460
|
+
this._routingModules.forEach((module) => {
|
|
461
|
+
if (module.security != route_security_enum_1.DynamoNTS_RouteSecurity.secure) {
|
|
462
|
+
errorMsg += `\n ${module.route} (security: ${module.security}) \n subroutes using open sever:`;
|
|
463
|
+
module.endpoints.forEach((endpoint) => {
|
|
464
|
+
if (endpoint.security != route_security_enum_1.DynamoNTS_RouteSecurity.secure) {
|
|
465
|
+
errorMsg += `\n ${endpoint.endpoint} (security: ${endpoint.security})`;
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
let error = new Error('Open routes cannot be established!');
|
|
471
|
+
let errorStack = error.stack.split('\n');
|
|
472
|
+
errorStack.splice(1, 2);
|
|
473
|
+
error.stack = errorStack.join('\n');
|
|
474
|
+
fsm_dynamo_1.Dynamo_Log.error(errorMsg);
|
|
475
|
+
throw error;
|
|
475
476
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
477
|
+
await this.initOpenExpress();
|
|
478
|
+
}
|
|
479
|
+
if (this._security && this._security !== route_security_enum_1.DynamoNTS_RouteSecurity.open) {
|
|
480
|
+
if (!this._cert || !this._ports.httpsPort) {
|
|
481
|
+
let errorMsg = `\nYou have secure routes, but the certification paths or httpsPort are not set!` +
|
|
482
|
+
`\nsecurity: ${this._security}` +
|
|
483
|
+
`\nset...` +
|
|
484
|
+
`\n httpsPort and` +
|
|
485
|
+
`\n cert: {` +
|
|
486
|
+
`\n keyPath: FileSystem.PathLike,` +
|
|
487
|
+
`\n certPath: FileSystem.PathLike,` +
|
|
488
|
+
`\n }` +
|
|
489
|
+
`\nin DynamoBEServer - getRoutingModules() to enable secure routes.`;
|
|
490
|
+
errorMsg += '\n\nThe routes setted to use secure server:';
|
|
491
|
+
this._routingModules.forEach((module) => {
|
|
492
|
+
if (module.security && module.security !== route_security_enum_1.DynamoNTS_RouteSecurity.open) {
|
|
493
|
+
errorMsg += `\n ${module.route} (security: ${module.security}) \n subroutes using secure sever:`;
|
|
494
|
+
module.endpoints.forEach((endpoint) => {
|
|
495
|
+
if (endpoint.security && endpoint.security !== route_security_enum_1.DynamoNTS_RouteSecurity.open) {
|
|
496
|
+
errorMsg += `\n ${endpoint.endpoint} (security: ${endpoint.security})`;
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
let error = new Error('Secure routes cannot be established!');
|
|
502
|
+
let errorStack = error.stack.split('\n');
|
|
503
|
+
errorStack.splice(1, 2);
|
|
504
|
+
error.stack = errorStack.join('\n');
|
|
505
|
+
fsm_dynamo_1.Dynamo_Log.error(errorMsg);
|
|
506
|
+
throw error;
|
|
506
507
|
}
|
|
507
|
-
|
|
508
|
+
await this.initSecureExpress();
|
|
509
|
+
}
|
|
508
510
|
}
|
|
509
511
|
/**
|
|
510
512
|
*
|
|
511
513
|
*/
|
|
512
|
-
initOpenExpress() {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
this.openExpress.use(BodyParser.json({ limit: '50mb' }));
|
|
519
|
-
});
|
|
514
|
+
async initOpenExpress() {
|
|
515
|
+
if (this.logFn)
|
|
516
|
+
console.log('\nfn:. initOpenExpress');
|
|
517
|
+
this.openExpress = Express();
|
|
518
|
+
this.openExpress.use(BodyParser.urlencoded({ limit: '50mb', extended: true }));
|
|
519
|
+
this.openExpress.use(BodyParser.json({ limit: '50mb' }));
|
|
520
520
|
}
|
|
521
521
|
/**
|
|
522
522
|
*
|
|
523
523
|
*/
|
|
524
|
-
initSecureExpress() {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
this.httpsServer = Https.createServer(options, this.secureExpress);
|
|
536
|
-
});
|
|
524
|
+
async initSecureExpress() {
|
|
525
|
+
if (this.logFn)
|
|
526
|
+
console.log('\nfn:. initSecureExpress');
|
|
527
|
+
this.secureExpress = Express();
|
|
528
|
+
this.secureExpress.use(BodyParser.urlencoded({ limit: '50mb', extended: true }));
|
|
529
|
+
this.secureExpress.use(BodyParser.json({ limit: '50mb' }));
|
|
530
|
+
const options = {
|
|
531
|
+
key: FileSystem.readFileSync(this._cert.keyPath),
|
|
532
|
+
cert: FileSystem.readFileSync(this._cert.certPath),
|
|
533
|
+
};
|
|
534
|
+
this.httpsServer = Https.createServer(options, this.secureExpress);
|
|
537
535
|
}
|
|
538
536
|
/**
|
|
539
537
|
*
|
|
540
538
|
*/
|
|
541
|
-
startExpresses() {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
this.
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
}));
|
|
571
|
-
});
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
|
-
if (this._security && this._security !== route_security_enum_1.DynamoNTS_RouteSecurity.secure) {
|
|
575
|
-
this.systemControls.httpServer.init = true;
|
|
576
|
-
yield new Promise((resolve, reject) => {
|
|
577
|
-
this.httpServer = this.openExpress
|
|
578
|
-
.listen(this._ports.httpPort, () => {
|
|
579
|
-
this.systemControls.httpServer.started = true;
|
|
580
|
-
fsm_dynamo_1.Dynamo_Log.success(`\nHTTP (open) server is listening on port: ${this._ports.httpPort}`);
|
|
581
|
-
resolve();
|
|
582
|
-
})
|
|
583
|
-
.on('error', (error) => {
|
|
584
|
-
this.systemControls.httpServer.started = false;
|
|
585
|
-
this.constructErrors.push(error);
|
|
586
|
-
fsm_dynamo_1.Dynamo_Log.error(`\nHTTP (open) server ERROR`, error);
|
|
587
|
-
reject(new fsm_dynamo_1.Dynamo_Error({
|
|
588
|
-
errorCode: 'NTS-AS0-003',
|
|
589
|
-
message: `HTTP (open) server ERROR`,
|
|
590
|
-
error: error,
|
|
591
|
-
}));
|
|
592
|
-
})
|
|
593
|
-
.on('uncaughtException', (ex) => {
|
|
594
|
-
fsm_dynamo_1.Dynamo_Log.warn(`\nHTTP (open) server uncaughtException`, new fsm_dynamo_1.Dynamo_Error({
|
|
595
|
-
errorCode: 'NTS-AS0-004',
|
|
596
|
-
message: `HTTP (open) server uncaughtException`,
|
|
597
|
-
error: ex
|
|
598
|
-
}));
|
|
599
|
-
});
|
|
539
|
+
async startExpresses() {
|
|
540
|
+
if (this.logFn && this.deepLog)
|
|
541
|
+
console.log('\nfn:. startExpresses');
|
|
542
|
+
try {
|
|
543
|
+
if (this._security && this._security !== route_security_enum_1.DynamoNTS_RouteSecurity.open) {
|
|
544
|
+
await new Promise((resolve, reject) => {
|
|
545
|
+
this.systemControls.httpsServer.init = true;
|
|
546
|
+
this.httpsServer
|
|
547
|
+
.listen(this._ports.httpsPort, 'localhost', 0, () => {
|
|
548
|
+
this.systemControls.httpsServer.started = true;
|
|
549
|
+
fsm_dynamo_1.Dynamo_Log.success(`\nHTTPS (secure) server is listening on port: ${this._ports.httpsPort}`);
|
|
550
|
+
resolve();
|
|
551
|
+
})
|
|
552
|
+
.on('error', (error) => {
|
|
553
|
+
this.systemControls.httpsServer.started = false;
|
|
554
|
+
this.constructErrors.push(error);
|
|
555
|
+
fsm_dynamo_1.Dynamo_Log.error(`\nHTTPS (secure) server ERROR`, error);
|
|
556
|
+
reject(new fsm_dynamo_1.Dynamo_Error({
|
|
557
|
+
errorCode: 'NTS-AS0-001',
|
|
558
|
+
message: `HTTPS (secure) server ERROR`,
|
|
559
|
+
error: error,
|
|
560
|
+
}));
|
|
561
|
+
})
|
|
562
|
+
.on('uncaughtException', (ex) => {
|
|
563
|
+
fsm_dynamo_1.Dynamo_Log.warn(`\nHTTPS (secure) server uncaughtException`, new fsm_dynamo_1.Dynamo_Error({
|
|
564
|
+
errorCode: 'NTS-AS0-002',
|
|
565
|
+
message: `HTTPS (secure) server uncaughtException`,
|
|
566
|
+
error: ex,
|
|
567
|
+
}));
|
|
600
568
|
});
|
|
601
|
-
}
|
|
569
|
+
});
|
|
602
570
|
}
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
571
|
+
if (this._security && this._security !== route_security_enum_1.DynamoNTS_RouteSecurity.secure) {
|
|
572
|
+
this.systemControls.httpServer.init = true;
|
|
573
|
+
await new Promise((resolve, reject) => {
|
|
574
|
+
this.httpServer = this.openExpress
|
|
575
|
+
.listen(this._ports.httpPort, () => {
|
|
576
|
+
this.systemControls.httpServer.started = true;
|
|
577
|
+
fsm_dynamo_1.Dynamo_Log.success(`\nHTTP (open) server is listening on port: ${this._ports.httpPort}`);
|
|
578
|
+
resolve();
|
|
579
|
+
})
|
|
580
|
+
.on('error', (error) => {
|
|
581
|
+
this.systemControls.httpServer.started = false;
|
|
582
|
+
this.constructErrors.push(error);
|
|
583
|
+
fsm_dynamo_1.Dynamo_Log.error(`\nHTTP (open) server ERROR`, error);
|
|
584
|
+
reject(new fsm_dynamo_1.Dynamo_Error({
|
|
585
|
+
errorCode: 'NTS-AS0-003',
|
|
586
|
+
message: `HTTP (open) server ERROR`,
|
|
587
|
+
error: error,
|
|
588
|
+
}));
|
|
589
|
+
})
|
|
590
|
+
.on('uncaughtException', (ex) => {
|
|
591
|
+
fsm_dynamo_1.Dynamo_Log.warn(`\nHTTP (open) server uncaughtException`, new fsm_dynamo_1.Dynamo_Error({
|
|
592
|
+
errorCode: 'NTS-AS0-004',
|
|
593
|
+
message: `HTTP (open) server uncaughtException`,
|
|
594
|
+
error: ex
|
|
595
|
+
}));
|
|
596
|
+
});
|
|
597
|
+
});
|
|
606
598
|
}
|
|
607
|
-
}
|
|
599
|
+
}
|
|
600
|
+
catch (error) {
|
|
601
|
+
fsm_dynamo_1.Dynamo_Log.error(`startExpresses failed...`, error);
|
|
602
|
+
throw error;
|
|
603
|
+
}
|
|
608
604
|
}
|
|
609
605
|
/**
|
|
610
606
|
*
|
|
611
607
|
*/
|
|
612
|
-
mountSecureRoutes() {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
if (
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
this.secureExpress.use(module.route, module.secureRouter);
|
|
608
|
+
async mountSecureRoutes() {
|
|
609
|
+
if (this.logFn && this.deepLog)
|
|
610
|
+
console.log('\nfn:. mountSecureRoutes');
|
|
611
|
+
await fsm_dynamo_1.Dynamo_Array.asyncForEach(this._routingModules, async (module) => {
|
|
612
|
+
if (module.security !== route_security_enum_1.DynamoNTS_RouteSecurity.open) {
|
|
613
|
+
if (this.logSetup) {
|
|
614
|
+
console.log(`route mount (secure): ${module.route}`);
|
|
615
|
+
}
|
|
616
|
+
const existingRoutes = this._routingModules.filter((mod) => mod.route === module.route);
|
|
617
|
+
if (1 < existingRoutes.length) {
|
|
618
|
+
let error = new Error(`ROUTE DUPLICATION: ${module.route}`);
|
|
619
|
+
let errorStack = error.stack.split('\n');
|
|
620
|
+
errorStack.splice(1, 4);
|
|
621
|
+
error.stack = errorStack.join('\n');
|
|
622
|
+
fsm_dynamo_1.Dynamo_Log.error(`ROUTE DUPLICATION: ${module.route}`, error);
|
|
623
|
+
throw new fsm_dynamo_1.Dynamo_Error({
|
|
624
|
+
errorCode: 'NTS-AS0-005',
|
|
625
|
+
message: `ROUTE DUPLICATION: ${module.route}`,
|
|
626
|
+
error: error,
|
|
627
|
+
});
|
|
635
628
|
}
|
|
636
|
-
|
|
629
|
+
this.secureExpress.use(module.route, module.secureRouter);
|
|
630
|
+
}
|
|
637
631
|
});
|
|
638
632
|
}
|
|
639
633
|
/**
|
|
640
634
|
*
|
|
641
635
|
*/
|
|
642
|
-
mountOpenRoutes() {
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
if (
|
|
648
|
-
|
|
649
|
-
console.log(`route mount (open): ${module.route}`);
|
|
650
|
-
}
|
|
651
|
-
const existingRoutes = this._routingModules.filter((mod) => mod.route === module.route);
|
|
652
|
-
if (1 < existingRoutes.length) {
|
|
653
|
-
let error = new Error(`ROUTE DUPLICATION: ${module.route}`);
|
|
654
|
-
let errorStack = error.stack.split('\n');
|
|
655
|
-
errorStack.splice(1, 4);
|
|
656
|
-
error.stack = errorStack.join('\n');
|
|
657
|
-
fsm_dynamo_1.Dynamo_Log.error(`ROUTE DUPLICATION: ${module.route}`, error);
|
|
658
|
-
throw new fsm_dynamo_1.Dynamo_Error({
|
|
659
|
-
errorCode: 'NTS-AS0-006',
|
|
660
|
-
message: `ROUTE DUPLICATION: ${module.route}`,
|
|
661
|
-
error: error,
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
this.openExpress.use(module.route, module.openRouter);
|
|
636
|
+
async mountOpenRoutes() {
|
|
637
|
+
if (this.logFn && this.deepLog)
|
|
638
|
+
console.log('\nfn:. mountOpenRoutes');
|
|
639
|
+
await fsm_dynamo_1.Dynamo_Array.asyncForEach(this._routingModules, async (module) => {
|
|
640
|
+
if (module.security !== route_security_enum_1.DynamoNTS_RouteSecurity.secure) {
|
|
641
|
+
if (this.logSetup) {
|
|
642
|
+
console.log(`route mount (open): ${module.route}`);
|
|
665
643
|
}
|
|
666
|
-
|
|
644
|
+
const existingRoutes = this._routingModules.filter((mod) => mod.route === module.route);
|
|
645
|
+
if (1 < existingRoutes.length) {
|
|
646
|
+
let error = new Error(`ROUTE DUPLICATION: ${module.route}`);
|
|
647
|
+
let errorStack = error.stack.split('\n');
|
|
648
|
+
errorStack.splice(1, 4);
|
|
649
|
+
error.stack = errorStack.join('\n');
|
|
650
|
+
fsm_dynamo_1.Dynamo_Log.error(`ROUTE DUPLICATION: ${module.route}`, error);
|
|
651
|
+
throw new fsm_dynamo_1.Dynamo_Error({
|
|
652
|
+
errorCode: 'NTS-AS0-006',
|
|
653
|
+
message: `ROUTE DUPLICATION: ${module.route}`,
|
|
654
|
+
error: error,
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
this.openExpress.use(module.route, module.openRouter);
|
|
658
|
+
}
|
|
667
659
|
});
|
|
668
660
|
}
|
|
669
661
|
/**
|