opticore-webapp 1.0.15 → 1.0.17
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/dist/index.cjs +45 -43
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +47 -45
- package/dist/utils/translations/messages.exception.en.json +78 -0
- package/dist/utils/translations/messages.exception.fr.json +78 -0
- package/package.json +3 -3
- package/src/application/service/core.service.ts +5 -4
- package/src/core/handlers/eventProcess.handler.ts +15 -15
- package/src/core/helpers/modulesLoaded.utils.ts +10 -9
- package/src/core/webServer.core.ts +24 -19
package/dist/index.cjs
CHANGED
|
@@ -40,65 +40,66 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
|
40
40
|
|
|
41
41
|
// src/core/webServer.core.ts
|
|
42
42
|
var path2 = __toESM(require("path"), 1);
|
|
43
|
+
var import_module = require("module");
|
|
43
44
|
var import_cors = __toESM(require("cors"), 1);
|
|
44
|
-
var import_url = require("url");
|
|
45
45
|
var import_opticore_catch_exception_error3 = require("opticore-catch-exception-error");
|
|
46
46
|
var import_opticore_express2 = require("opticore-express");
|
|
47
47
|
var import_opticore_env_access = require("opticore-env-access");
|
|
48
48
|
var import_opticore_requests_called_events = require("opticore-requests-called-events");
|
|
49
49
|
var import_opticore_http_response2 = require("opticore-http-response");
|
|
50
|
+
var import_opticore_translator3 = require("opticore-translator");
|
|
50
51
|
|
|
51
52
|
// src/core/handlers/eventProcess.handler.ts
|
|
52
53
|
var import_node_process = __toESM(require("process"), 1);
|
|
53
54
|
var import_node_events = __toESM(require("events"), 1);
|
|
54
55
|
var import_opticore_express = require("opticore-express");
|
|
55
56
|
var import_opticore_catch_exception_error = require("opticore-catch-exception-error");
|
|
56
|
-
function eventProcessHandler() {
|
|
57
|
+
function eventProcessHandler(localeLanguage) {
|
|
57
58
|
const errorEmitter = new import_node_events.default();
|
|
58
59
|
const app = (0, import_opticore_express.express)();
|
|
59
60
|
errorEmitter.on(import_opticore_catch_exception_error.CEventNameError.error, (error) => {
|
|
60
|
-
import_opticore_catch_exception_error.ServerListenEventError.__init().listenerError(error);
|
|
61
|
+
import_opticore_catch_exception_error.ServerListenEventError.__init(localeLanguage).listenerError(error);
|
|
61
62
|
});
|
|
62
63
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.beforeExit, (code) => {
|
|
63
64
|
setTimeout(() => {
|
|
64
|
-
import_opticore_catch_exception_error.ServerListenEventError.__init().processBeforeExit(code);
|
|
65
|
+
import_opticore_catch_exception_error.ServerListenEventError.__init(localeLanguage).processBeforeExit(code);
|
|
65
66
|
}, 100);
|
|
66
67
|
});
|
|
67
68
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.disconnect, () => {
|
|
68
|
-
import_opticore_catch_exception_error.ServerListenEventError.__init().processDisconnected();
|
|
69
|
+
import_opticore_catch_exception_error.ServerListenEventError.__init(localeLanguage).processDisconnected();
|
|
69
70
|
});
|
|
70
71
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.exit, (code) => {
|
|
71
|
-
import_opticore_catch_exception_error.ServerListenEventError.__init().exited(code);
|
|
72
|
+
import_opticore_catch_exception_error.ServerListenEventError.__init(localeLanguage).exited(code);
|
|
72
73
|
});
|
|
73
74
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.rejectionHandled, (promise) => {
|
|
74
|
-
import_opticore_catch_exception_error.ServerListenEventError.__init().promiseRejectionHandled(promise);
|
|
75
|
+
import_opticore_catch_exception_error.ServerListenEventError.__init(localeLanguage).promiseRejectionHandled(promise);
|
|
75
76
|
});
|
|
76
77
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.uncaughtException, (error) => {
|
|
77
|
-
import_opticore_catch_exception_error.ServerListenEventError.__init().uncaughtException(error);
|
|
78
|
+
import_opticore_catch_exception_error.ServerListenEventError.__init(localeLanguage).uncaughtException(error);
|
|
78
79
|
});
|
|
79
80
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.uncaughtExceptionMonitor, (error) => {
|
|
80
|
-
import_opticore_catch_exception_error.ServerListenEventError.__init().uncaughtExceptionMonitor(error);
|
|
81
|
+
import_opticore_catch_exception_error.ServerListenEventError.__init(localeLanguage).uncaughtExceptionMonitor(error);
|
|
81
82
|
});
|
|
82
83
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.unhandledRejection, (reason, promise) => {
|
|
83
|
-
import_opticore_catch_exception_error.ServerListenEventError.__init().unhandledRejection(reason, promise);
|
|
84
|
+
import_opticore_catch_exception_error.ServerListenEventError.__init(localeLanguage).unhandledRejection(reason, promise);
|
|
84
85
|
});
|
|
85
86
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.warning, (warning) => {
|
|
86
|
-
import_opticore_catch_exception_error.ServerListenEventError.__init().warning(warning);
|
|
87
|
+
import_opticore_catch_exception_error.ServerListenEventError.__init(localeLanguage).warning(warning);
|
|
87
88
|
});
|
|
88
89
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.message, (message) => {
|
|
89
|
-
import_opticore_catch_exception_error.ServerListenEventError.__init().message(message);
|
|
90
|
+
import_opticore_catch_exception_error.ServerListenEventError.__init(localeLanguage).message(message);
|
|
90
91
|
});
|
|
91
92
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.multipleResolves, (type, promise, reason) => {
|
|
92
|
-
import_opticore_catch_exception_error.ServerListenEventError.__init().multipleResolves(type, promise, reason);
|
|
93
|
+
import_opticore_catch_exception_error.ServerListenEventError.__init(localeLanguage).multipleResolves(type, promise, reason);
|
|
93
94
|
});
|
|
94
95
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.sigint, () => {
|
|
95
|
-
import_opticore_catch_exception_error.ServerListenEventError.__init().processInterrupted();
|
|
96
|
+
import_opticore_catch_exception_error.ServerListenEventError.__init(localeLanguage).processInterrupted();
|
|
96
97
|
});
|
|
97
98
|
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.sigterm, (signal) => {
|
|
98
|
-
import_opticore_catch_exception_error.ServerListenEventError.__init().sigtermSignalReceived(signal);
|
|
99
|
+
import_opticore_catch_exception_error.ServerListenEventError.__init(localeLanguage).sigtermSignalReceived(signal);
|
|
99
100
|
});
|
|
100
101
|
app.use((err, req, res, next) => {
|
|
101
|
-
import_opticore_catch_exception_error.ServerListenEventError.__init().expressErrorHandlingMiddleware(errorEmitter, err, req, res, next);
|
|
102
|
+
import_opticore_catch_exception_error.ServerListenEventError.__init(localeLanguage).expressErrorHandlingMiddleware(errorEmitter, err, req, res, next);
|
|
102
103
|
});
|
|
103
104
|
}
|
|
104
105
|
|
|
@@ -141,15 +142,15 @@ var LogMessageUtils = class {
|
|
|
141
142
|
|
|
142
143
|
// src/core/helpers/modulesLoaded.utils.ts
|
|
143
144
|
var import_opticore_translator = require("opticore-translator");
|
|
144
|
-
function modulesLoadedUtils(allAppRoutes, dbConChecker) {
|
|
145
|
+
function modulesLoadedUtils(allAppRoutes, dbConChecker, localeLanguage, loggerConfig) {
|
|
145
146
|
LogMessageUtils.success(
|
|
146
|
-
`${import_opticore_translator.TranslationLoader.t("kernel",
|
|
147
|
-
`${import_opticore_translator.TranslationLoader.t("loadKernel",
|
|
148
|
-
`${import_opticore_translator.TranslationLoader.t("moduleAppLoaded",
|
|
147
|
+
`${import_opticore_translator.TranslationLoader.t("kernel", localeLanguage, loggerConfig)}`,
|
|
148
|
+
`${import_opticore_translator.TranslationLoader.t("loadKernel", localeLanguage, loggerConfig)}`,
|
|
149
|
+
`${import_opticore_translator.TranslationLoader.t("moduleAppLoaded", localeLanguage, loggerConfig)}`
|
|
149
150
|
);
|
|
150
|
-
console.log(`${import_ansi_colors2.default.whiteBright(` ${import_opticore_translator.TranslationLoader.t("content",
|
|
151
|
-
allAppRoutes ? console.log(`${import_ansi_colors2.default.whiteBright(` ${import_opticore_translator.TranslationLoader.t("content",
|
|
152
|
-
typeof dbConChecker == "function" ? console.log(`${import_ansi_colors2.default.whiteBright(` ${import_opticore_translator.TranslationLoader.t("content",
|
|
151
|
+
console.log(`${import_ansi_colors2.default.whiteBright(` ${import_opticore_translator.TranslationLoader.t("content", localeLanguage, loggerConfig)}`)} ${import_ansi_colors2.default.green(`${import_opticore_translator.TranslationLoader.t("kernel", localeLanguage, loggerConfig)} :`)} ${import_ansi_colors2.default.cyan(`${import_ansi_colors2.default.bold(`${import_opticore_translator.TranslationLoader.t("serverSide", localeLanguage, loggerConfig)}`)}`)} ${import_opticore_translator.TranslationLoader.t("hasBeenLoadedSuccessfully", localeLanguage, loggerConfig)} ${import_ansi_colors2.default.green(`\u2714`)}`);
|
|
152
|
+
allAppRoutes ? console.log(`${import_ansi_colors2.default.whiteBright(` ${import_opticore_translator.TranslationLoader.t("content", localeLanguage, loggerConfig)}`)} ${import_ansi_colors2.default.green(`${import_opticore_translator.TranslationLoader.t("kernel", localeLanguage, loggerConfig)} :`)} ${import_ansi_colors2.default.cyan(`${import_ansi_colors2.default.bold(`${import_opticore_translator.TranslationLoader.t("routerService", localeLanguage, loggerConfig)}`)} `)} ${import_ansi_colors2.default.green(`\u2714`)}`) : console.log(`${import_ansi_colors2.default.red(`\u2718`)} ${import_ansi_colors2.default.bgRed(` ${import_ansi_colors2.default.bold(`${import_ansi_colors2.default.white(` ${import_opticore_translator.TranslationLoader.t("registerRoutes", localeLanguage, loggerConfig)} `)}`)} `)} | ${dateTimeFormattedUtils} | [ ${import_ansi_colors2.default.red(`${import_ansi_colors2.default.bold(` ${import_opticore_translator.TranslationLoader.t("fail", localeLanguage, loggerConfig)} `)}`)} ] | [ ${import_ansi_colors2.default.bold(` ${import_opticore_translator.TranslationLoader.t("loading", localeLanguage, loggerConfig)} `)} ] - ${import_ansi_colors2.default.red(` ${import_opticore_translator.TranslationLoader.t("routers", localeLanguage, loggerConfig)} `)} - ${import_opticore_translator.TranslationLoader.t("registerLoadingFailed", localeLanguage, loggerConfig)} `);
|
|
153
|
+
typeof dbConChecker == "function" ? console.log(`${import_ansi_colors2.default.whiteBright(` ${import_opticore_translator.TranslationLoader.t("content", localeLanguage, loggerConfig)}`)} ${import_ansi_colors2.default.green(`${import_opticore_translator.TranslationLoader.t("kernel", localeLanguage, loggerConfig)} :`)} ${import_ansi_colors2.default.cyan(`${import_ansi_colors2.default.bold(`${import_opticore_translator.TranslationLoader.t("dbConnChecker", localeLanguage, loggerConfig)}`)}`)} ${import_opticore_translator.TranslationLoader.t("hasBeenLoadedSuccessfully", localeLanguage, loggerConfig)} ${import_ansi_colors2.default.green(`\u2714`)}`) : "";
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
// src/application/service/core.service.ts
|
|
@@ -275,7 +276,7 @@ var CoreService = class {
|
|
|
275
276
|
console.log(`${`Memory usage by system :`} ${import_ansi_colors3.default.cyan(`${import_ansi_colors3.default.bold(`${system}`)}`)}`);
|
|
276
277
|
console.log(``);
|
|
277
278
|
}
|
|
278
|
-
coreListenerEventLoaderModuleService(kernelModule) {
|
|
279
|
+
coreListenerEventLoaderModuleService(kernelModule, localeLanguage, loggerConfig) {
|
|
279
280
|
let router = [];
|
|
280
281
|
let dbCon;
|
|
281
282
|
kernelModule.forEach((module2) => {
|
|
@@ -292,8 +293,8 @@ var CoreService = class {
|
|
|
292
293
|
})();
|
|
293
294
|
} else {
|
|
294
295
|
const stackTrace = new import_opticore_catch_exception_error2.StackTraceError(
|
|
295
|
-
import_opticore_translator2.TranslationLoader.t("loadedModulesError",
|
|
296
|
-
import_opticore_translator2.TranslationLoader.t("loadedModules",
|
|
296
|
+
import_opticore_translator2.TranslationLoader.t("loadedModulesError", localeLanguage, loggerConfig),
|
|
297
|
+
import_opticore_translator2.TranslationLoader.t("loadedModules", localeLanguage, loggerConfig),
|
|
297
298
|
import_opticore_http_response.HttpStatusCode.NOT_ACCEPTABLE,
|
|
298
299
|
true
|
|
299
300
|
);
|
|
@@ -303,37 +304,38 @@ var CoreService = class {
|
|
|
303
304
|
};
|
|
304
305
|
|
|
305
306
|
// src/core/webServer.core.ts
|
|
306
|
-
var import_opticore_translator3 = require("opticore-translator");
|
|
307
307
|
var WebServerCore = class {
|
|
308
308
|
serverUtility = new CoreService();
|
|
309
309
|
expressApp = (0, import_opticore_express2.express)();
|
|
310
|
+
loggerConfig;
|
|
310
311
|
routerExpressApp;
|
|
311
312
|
port;
|
|
312
313
|
host;
|
|
313
|
-
constructor(app, corsOriginOptions) {
|
|
314
|
+
constructor(app, loggerConfig, localeLanguage, corsOriginOptions) {
|
|
314
315
|
this.port = Number(import_opticore_env_access.getEnvVariable.appPort);
|
|
315
316
|
this.host = import_opticore_env_access.getEnvVariable.appHost;
|
|
316
317
|
this.routerExpressApp = app;
|
|
318
|
+
this.loggerConfig = loggerConfig;
|
|
317
319
|
this.expressApp.use(import_opticore_express2.express.json());
|
|
318
320
|
this.expressApp.use(import_opticore_express2.express.raw());
|
|
319
321
|
this.expressApp.use(import_opticore_express2.express.text());
|
|
320
322
|
this.expressApp.use(import_opticore_express2.express.urlencoded({ extended: true }));
|
|
321
323
|
this.expressApp.use((0, import_cors.default)(corsOriginOptions));
|
|
322
|
-
this.stackTraceErrorHandling();
|
|
324
|
+
this.stackTraceErrorHandling(localeLanguage);
|
|
323
325
|
this.translationWebAppLoader();
|
|
324
326
|
}
|
|
325
|
-
onStartServer(routers) {
|
|
327
|
+
onStartServer(routers, localeLanguage) {
|
|
326
328
|
return this.expressApp.listen(
|
|
327
329
|
this.port,
|
|
328
330
|
this.host,
|
|
329
331
|
() => {
|
|
330
332
|
try {
|
|
331
333
|
if (this.host === "" && this.port === 0) {
|
|
332
|
-
import_opticore_catch_exception_error3.ServerListenEventError.__init().hostPortUndefined();
|
|
334
|
+
import_opticore_catch_exception_error3.ServerListenEventError.__init(localeLanguage).hostPortUndefined();
|
|
333
335
|
} else if (this.host === "") {
|
|
334
|
-
import_opticore_catch_exception_error3.ServerListenEventError.__init().hostUndefined();
|
|
336
|
+
import_opticore_catch_exception_error3.ServerListenEventError.__init(localeLanguage).hostUndefined();
|
|
335
337
|
} else if (this.port === 0) {
|
|
336
|
-
import_opticore_catch_exception_error3.ServerListenEventError.__init().portUndefined();
|
|
338
|
+
import_opticore_catch_exception_error3.ServerListenEventError.__init(localeLanguage).portUndefined();
|
|
337
339
|
} else {
|
|
338
340
|
this.registerRoutes(routers);
|
|
339
341
|
}
|
|
@@ -344,13 +346,13 @@ var WebServerCore = class {
|
|
|
344
346
|
);
|
|
345
347
|
}
|
|
346
348
|
//, kernelModule: KernelModuleType
|
|
347
|
-
onListeningOnServerEvent(serverWeb) {
|
|
349
|
+
onListeningOnServerEvent(serverWeb, localeLanguage) {
|
|
348
350
|
serverWeb.on(import_opticore_catch_exception_error3.CEventNameError.error, (err) => {
|
|
349
|
-
import_opticore_catch_exception_error3.ServerListenEventError.__init().onEventError(err);
|
|
351
|
+
import_opticore_catch_exception_error3.ServerListenEventError.__init(localeLanguage).onEventError(err);
|
|
350
352
|
}).on(import_opticore_catch_exception_error3.CEventNameError.close, () => {
|
|
351
|
-
import_opticore_catch_exception_error3.ServerListenEventError.__init().serverClosing();
|
|
353
|
+
import_opticore_catch_exception_error3.ServerListenEventError.__init(localeLanguage).serverClosing();
|
|
352
354
|
}).on(import_opticore_catch_exception_error3.CEventNameError.drop, () => {
|
|
353
|
-
import_opticore_catch_exception_error3.ServerListenEventError.__init().dropNewConnection();
|
|
355
|
+
import_opticore_catch_exception_error3.ServerListenEventError.__init(localeLanguage).dropNewConnection();
|
|
354
356
|
}).on(import_opticore_catch_exception_error3.CEventNameError.listening, () => {
|
|
355
357
|
this.infoWebApp();
|
|
356
358
|
});
|
|
@@ -361,10 +363,10 @@ var WebServerCore = class {
|
|
|
361
363
|
});
|
|
362
364
|
}
|
|
363
365
|
translationWebAppLoader() {
|
|
364
|
-
const
|
|
365
|
-
const
|
|
366
|
-
const translateMsgJsonFilePath = path2.join(
|
|
367
|
-
import_opticore_translator3.TranslationLoader.loadTranslations(translateMsgJsonFilePath,
|
|
366
|
+
const require2 = (0, import_module.createRequire)(importMetaUrl);
|
|
367
|
+
const packagePath = path2.dirname(require2.resolve("opticore-webapp"));
|
|
368
|
+
const translateMsgJsonFilePath = path2.join(packagePath, "utils", "translations");
|
|
369
|
+
import_opticore_translator3.TranslationLoader.loadTranslations(translateMsgJsonFilePath, this.loggerConfig);
|
|
368
370
|
}
|
|
369
371
|
registerRoutes(allFeatureRoutes) {
|
|
370
372
|
allFeatureRoutes.map((router) => {
|
|
@@ -373,8 +375,8 @@ var WebServerCore = class {
|
|
|
373
375
|
});
|
|
374
376
|
});
|
|
375
377
|
}
|
|
376
|
-
stackTraceErrorHandling() {
|
|
377
|
-
eventProcessHandler();
|
|
378
|
+
stackTraceErrorHandling(localeLanguage) {
|
|
379
|
+
eventProcessHandler(localeLanguage);
|
|
378
380
|
}
|
|
379
381
|
infoWebApp() {
|
|
380
382
|
this.serverUtility.infoServer(
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CorsOptions } from 'cors';
|
|
2
2
|
import { Server } from 'http';
|
|
3
3
|
import { Router, express } from 'opticore-express';
|
|
4
|
+
import { LoggerCore } from 'opticore-logger';
|
|
4
5
|
|
|
5
6
|
interface IRouteDefinition {
|
|
6
7
|
path: string;
|
|
@@ -10,14 +11,15 @@ interface IRouteDefinition {
|
|
|
10
11
|
declare class WebServerCore {
|
|
11
12
|
private serverUtility;
|
|
12
13
|
private expressApp;
|
|
14
|
+
private readonly loggerConfig;
|
|
13
15
|
private readonly routerExpressApp;
|
|
14
16
|
private readonly port;
|
|
15
17
|
private readonly host;
|
|
16
|
-
constructor(app: express.Application, corsOriginOptions?: Partial<CorsOptions>);
|
|
18
|
+
constructor(app: express.Application, loggerConfig: LoggerCore, localeLanguage: string, corsOriginOptions?: Partial<CorsOptions>);
|
|
17
19
|
onStartServer(routers: {
|
|
18
20
|
featureRoute: IRouteDefinition[];
|
|
19
|
-
}[]): any;
|
|
20
|
-
onListeningOnServerEvent(serverWeb: Server): void;
|
|
21
|
+
}[], localeLanguage: string): any;
|
|
22
|
+
onListeningOnServerEvent(serverWeb: Server, localeLanguage: string): void;
|
|
21
23
|
onRequestOnServerEvent(serverWeb: Server): void;
|
|
22
24
|
private translationWebAppLoader;
|
|
23
25
|
private registerRoutes;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CorsOptions } from 'cors';
|
|
2
2
|
import { Server } from 'http';
|
|
3
3
|
import { Router, express } from 'opticore-express';
|
|
4
|
+
import { LoggerCore } from 'opticore-logger';
|
|
4
5
|
|
|
5
6
|
interface IRouteDefinition {
|
|
6
7
|
path: string;
|
|
@@ -10,14 +11,15 @@ interface IRouteDefinition {
|
|
|
10
11
|
declare class WebServerCore {
|
|
11
12
|
private serverUtility;
|
|
12
13
|
private expressApp;
|
|
14
|
+
private readonly loggerConfig;
|
|
13
15
|
private readonly routerExpressApp;
|
|
14
16
|
private readonly port;
|
|
15
17
|
private readonly host;
|
|
16
|
-
constructor(app: express.Application, corsOriginOptions?: Partial<CorsOptions>);
|
|
18
|
+
constructor(app: express.Application, loggerConfig: LoggerCore, localeLanguage: string, corsOriginOptions?: Partial<CorsOptions>);
|
|
17
19
|
onStartServer(routers: {
|
|
18
20
|
featureRoute: IRouteDefinition[];
|
|
19
|
-
}[]): any;
|
|
20
|
-
onListeningOnServerEvent(serverWeb: Server): void;
|
|
21
|
+
}[], localeLanguage: string): any;
|
|
22
|
+
onListeningOnServerEvent(serverWeb: Server, localeLanguage: string): void;
|
|
21
23
|
onRequestOnServerEvent(serverWeb: Server): void;
|
|
22
24
|
private translationWebAppLoader;
|
|
23
25
|
private registerRoutes;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/core/webServer.core.ts
|
|
2
2
|
import * as path2 from "path";
|
|
3
|
+
import { createRequire } from "module";
|
|
3
4
|
import corsOrigin from "cors";
|
|
4
|
-
import { fileURLToPath } from "url";
|
|
5
5
|
import {
|
|
6
6
|
CEventNameError as eventName2,
|
|
7
7
|
StackTraceError as StackTraceError2,
|
|
@@ -11,6 +11,7 @@ import { express as express2 } from "opticore-express";
|
|
|
11
11
|
import { getEnvVariable } from "opticore-env-access";
|
|
12
12
|
import { requestCallsEvent } from "opticore-requests-called-events";
|
|
13
13
|
import { HttpStatusCode } from "opticore-http-response";
|
|
14
|
+
import { TranslationLoader as TranslationLoader3 } from "opticore-translator";
|
|
14
15
|
|
|
15
16
|
// src/core/handlers/eventProcess.handler.ts
|
|
16
17
|
import process from "node:process";
|
|
@@ -21,52 +22,52 @@ import {
|
|
|
21
22
|
CEventNameError as eventName,
|
|
22
23
|
CEvent as event
|
|
23
24
|
} from "opticore-catch-exception-error";
|
|
24
|
-
function eventProcessHandler() {
|
|
25
|
+
function eventProcessHandler(localeLanguage) {
|
|
25
26
|
const errorEmitter = new EventEmitter();
|
|
26
27
|
const app = express();
|
|
27
28
|
errorEmitter.on(eventName.error, (error) => {
|
|
28
|
-
ServerListenEventError.__init().listenerError(error);
|
|
29
|
+
ServerListenEventError.__init(localeLanguage).listenerError(error);
|
|
29
30
|
});
|
|
30
31
|
process.on(event.beforeExit, (code) => {
|
|
31
32
|
setTimeout(() => {
|
|
32
|
-
ServerListenEventError.__init().processBeforeExit(code);
|
|
33
|
+
ServerListenEventError.__init(localeLanguage).processBeforeExit(code);
|
|
33
34
|
}, 100);
|
|
34
35
|
});
|
|
35
36
|
process.on(event.disconnect, () => {
|
|
36
|
-
ServerListenEventError.__init().processDisconnected();
|
|
37
|
+
ServerListenEventError.__init(localeLanguage).processDisconnected();
|
|
37
38
|
});
|
|
38
39
|
process.on(event.exit, (code) => {
|
|
39
|
-
ServerListenEventError.__init().exited(code);
|
|
40
|
+
ServerListenEventError.__init(localeLanguage).exited(code);
|
|
40
41
|
});
|
|
41
42
|
process.on(event.rejectionHandled, (promise) => {
|
|
42
|
-
ServerListenEventError.__init().promiseRejectionHandled(promise);
|
|
43
|
+
ServerListenEventError.__init(localeLanguage).promiseRejectionHandled(promise);
|
|
43
44
|
});
|
|
44
45
|
process.on(event.uncaughtException, (error) => {
|
|
45
|
-
ServerListenEventError.__init().uncaughtException(error);
|
|
46
|
+
ServerListenEventError.__init(localeLanguage).uncaughtException(error);
|
|
46
47
|
});
|
|
47
48
|
process.on(event.uncaughtExceptionMonitor, (error) => {
|
|
48
|
-
ServerListenEventError.__init().uncaughtExceptionMonitor(error);
|
|
49
|
+
ServerListenEventError.__init(localeLanguage).uncaughtExceptionMonitor(error);
|
|
49
50
|
});
|
|
50
51
|
process.on(event.unhandledRejection, (reason, promise) => {
|
|
51
|
-
ServerListenEventError.__init().unhandledRejection(reason, promise);
|
|
52
|
+
ServerListenEventError.__init(localeLanguage).unhandledRejection(reason, promise);
|
|
52
53
|
});
|
|
53
54
|
process.on(event.warning, (warning) => {
|
|
54
|
-
ServerListenEventError.__init().warning(warning);
|
|
55
|
+
ServerListenEventError.__init(localeLanguage).warning(warning);
|
|
55
56
|
});
|
|
56
57
|
process.on(event.message, (message) => {
|
|
57
|
-
ServerListenEventError.__init().message(message);
|
|
58
|
+
ServerListenEventError.__init(localeLanguage).message(message);
|
|
58
59
|
});
|
|
59
60
|
process.on(event.multipleResolves, (type, promise, reason) => {
|
|
60
|
-
ServerListenEventError.__init().multipleResolves(type, promise, reason);
|
|
61
|
+
ServerListenEventError.__init(localeLanguage).multipleResolves(type, promise, reason);
|
|
61
62
|
});
|
|
62
63
|
process.on(event.sigint, () => {
|
|
63
|
-
ServerListenEventError.__init().processInterrupted();
|
|
64
|
+
ServerListenEventError.__init(localeLanguage).processInterrupted();
|
|
64
65
|
});
|
|
65
66
|
process.on(event.sigterm, (signal) => {
|
|
66
|
-
ServerListenEventError.__init().sigtermSignalReceived(signal);
|
|
67
|
+
ServerListenEventError.__init(localeLanguage).sigtermSignalReceived(signal);
|
|
67
68
|
});
|
|
68
69
|
app.use((err, req, res, next) => {
|
|
69
|
-
ServerListenEventError.__init().expressErrorHandlingMiddleware(errorEmitter, err, req, res, next);
|
|
70
|
+
ServerListenEventError.__init(localeLanguage).expressErrorHandlingMiddleware(errorEmitter, err, req, res, next);
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
|
|
@@ -108,20 +109,20 @@ var LogMessageUtils = class {
|
|
|
108
109
|
};
|
|
109
110
|
|
|
110
111
|
// src/core/helpers/modulesLoaded.utils.ts
|
|
111
|
-
import {
|
|
112
|
-
function modulesLoadedUtils(allAppRoutes, dbConChecker) {
|
|
112
|
+
import { TranslationLoader } from "opticore-translator";
|
|
113
|
+
function modulesLoadedUtils(allAppRoutes, dbConChecker, localeLanguage, loggerConfig) {
|
|
113
114
|
LogMessageUtils.success(
|
|
114
|
-
`${TranslationLoader.t("kernel",
|
|
115
|
-
`${TranslationLoader.t("loadKernel",
|
|
116
|
-
`${TranslationLoader.t("moduleAppLoaded",
|
|
115
|
+
`${TranslationLoader.t("kernel", localeLanguage, loggerConfig)}`,
|
|
116
|
+
`${TranslationLoader.t("loadKernel", localeLanguage, loggerConfig)}`,
|
|
117
|
+
`${TranslationLoader.t("moduleAppLoaded", localeLanguage, loggerConfig)}`
|
|
117
118
|
);
|
|
118
|
-
console.log(`${colors2.whiteBright(` ${TranslationLoader.t("content",
|
|
119
|
-
allAppRoutes ? console.log(`${colors2.whiteBright(` ${TranslationLoader.t("content",
|
|
120
|
-
typeof dbConChecker == "function" ? console.log(`${colors2.whiteBright(` ${TranslationLoader.t("content",
|
|
119
|
+
console.log(`${colors2.whiteBright(` ${TranslationLoader.t("content", localeLanguage, loggerConfig)}`)} ${colors2.green(`${TranslationLoader.t("kernel", localeLanguage, loggerConfig)} :`)} ${colors2.cyan(`${colors2.bold(`${TranslationLoader.t("serverSide", localeLanguage, loggerConfig)}`)}`)} ${TranslationLoader.t("hasBeenLoadedSuccessfully", localeLanguage, loggerConfig)} ${colors2.green(`\u2714`)}`);
|
|
120
|
+
allAppRoutes ? console.log(`${colors2.whiteBright(` ${TranslationLoader.t("content", localeLanguage, loggerConfig)}`)} ${colors2.green(`${TranslationLoader.t("kernel", localeLanguage, loggerConfig)} :`)} ${colors2.cyan(`${colors2.bold(`${TranslationLoader.t("routerService", localeLanguage, loggerConfig)}`)} `)} ${colors2.green(`\u2714`)}`) : console.log(`${colors2.red(`\u2718`)} ${colors2.bgRed(` ${colors2.bold(`${colors2.white(` ${TranslationLoader.t("registerRoutes", localeLanguage, loggerConfig)} `)}`)} `)} | ${dateTimeFormattedUtils} | [ ${colors2.red(`${colors2.bold(` ${TranslationLoader.t("fail", localeLanguage, loggerConfig)} `)}`)} ] | [ ${colors2.bold(` ${TranslationLoader.t("loading", localeLanguage, loggerConfig)} `)} ] - ${colors2.red(` ${TranslationLoader.t("routers", localeLanguage, loggerConfig)} `)} - ${TranslationLoader.t("registerLoadingFailed", localeLanguage, loggerConfig)} `);
|
|
121
|
+
typeof dbConChecker == "function" ? console.log(`${colors2.whiteBright(` ${TranslationLoader.t("content", localeLanguage, loggerConfig)}`)} ${colors2.green(`${TranslationLoader.t("kernel", localeLanguage, loggerConfig)} :`)} ${colors2.cyan(`${colors2.bold(`${TranslationLoader.t("dbConnChecker", localeLanguage, loggerConfig)}`)}`)} ${TranslationLoader.t("hasBeenLoadedSuccessfully", localeLanguage, loggerConfig)} ${colors2.green(`\u2714`)}`) : "";
|
|
121
122
|
}
|
|
122
123
|
|
|
123
124
|
// src/application/service/core.service.ts
|
|
124
|
-
import {
|
|
125
|
+
import { TranslationLoader as TranslationLoader2 } from "opticore-translator";
|
|
125
126
|
var CoreService = class {
|
|
126
127
|
/**
|
|
127
128
|
*
|
|
@@ -243,7 +244,7 @@ var CoreService = class {
|
|
|
243
244
|
console.log(`${`Memory usage by system :`} ${colors3.cyan(`${colors3.bold(`${system}`)}`)}`);
|
|
244
245
|
console.log(``);
|
|
245
246
|
}
|
|
246
|
-
coreListenerEventLoaderModuleService(kernelModule) {
|
|
247
|
+
coreListenerEventLoaderModuleService(kernelModule, localeLanguage, loggerConfig) {
|
|
247
248
|
let router = [];
|
|
248
249
|
let dbCon;
|
|
249
250
|
kernelModule.forEach((module) => {
|
|
@@ -260,8 +261,8 @@ var CoreService = class {
|
|
|
260
261
|
})();
|
|
261
262
|
} else {
|
|
262
263
|
const stackTrace = new StackTraceError(
|
|
263
|
-
TranslationLoader2.t("loadedModulesError",
|
|
264
|
-
TranslationLoader2.t("loadedModules",
|
|
264
|
+
TranslationLoader2.t("loadedModulesError", localeLanguage, loggerConfig),
|
|
265
|
+
TranslationLoader2.t("loadedModules", localeLanguage, loggerConfig),
|
|
265
266
|
status.NOT_ACCEPTABLE,
|
|
266
267
|
true
|
|
267
268
|
);
|
|
@@ -271,37 +272,38 @@ var CoreService = class {
|
|
|
271
272
|
};
|
|
272
273
|
|
|
273
274
|
// src/core/webServer.core.ts
|
|
274
|
-
import { TranslationLoader as TranslationLoader3 } from "opticore-translator";
|
|
275
275
|
var WebServerCore = class {
|
|
276
276
|
serverUtility = new CoreService();
|
|
277
277
|
expressApp = express2();
|
|
278
|
+
loggerConfig;
|
|
278
279
|
routerExpressApp;
|
|
279
280
|
port;
|
|
280
281
|
host;
|
|
281
|
-
constructor(app, corsOriginOptions) {
|
|
282
|
+
constructor(app, loggerConfig, localeLanguage, corsOriginOptions) {
|
|
282
283
|
this.port = Number(getEnvVariable.appPort);
|
|
283
284
|
this.host = getEnvVariable.appHost;
|
|
284
285
|
this.routerExpressApp = app;
|
|
286
|
+
this.loggerConfig = loggerConfig;
|
|
285
287
|
this.expressApp.use(express2.json());
|
|
286
288
|
this.expressApp.use(express2.raw());
|
|
287
289
|
this.expressApp.use(express2.text());
|
|
288
290
|
this.expressApp.use(express2.urlencoded({ extended: true }));
|
|
289
291
|
this.expressApp.use(corsOrigin(corsOriginOptions));
|
|
290
|
-
this.stackTraceErrorHandling();
|
|
292
|
+
this.stackTraceErrorHandling(localeLanguage);
|
|
291
293
|
this.translationWebAppLoader();
|
|
292
294
|
}
|
|
293
|
-
onStartServer(routers) {
|
|
295
|
+
onStartServer(routers, localeLanguage) {
|
|
294
296
|
return this.expressApp.listen(
|
|
295
297
|
this.port,
|
|
296
298
|
this.host,
|
|
297
299
|
() => {
|
|
298
300
|
try {
|
|
299
301
|
if (this.host === "" && this.port === 0) {
|
|
300
|
-
eventErrorOnListeningServer.__init().hostPortUndefined();
|
|
302
|
+
eventErrorOnListeningServer.__init(localeLanguage).hostPortUndefined();
|
|
301
303
|
} else if (this.host === "") {
|
|
302
|
-
eventErrorOnListeningServer.__init().hostUndefined();
|
|
304
|
+
eventErrorOnListeningServer.__init(localeLanguage).hostUndefined();
|
|
303
305
|
} else if (this.port === 0) {
|
|
304
|
-
eventErrorOnListeningServer.__init().portUndefined();
|
|
306
|
+
eventErrorOnListeningServer.__init(localeLanguage).portUndefined();
|
|
305
307
|
} else {
|
|
306
308
|
this.registerRoutes(routers);
|
|
307
309
|
}
|
|
@@ -312,13 +314,13 @@ var WebServerCore = class {
|
|
|
312
314
|
);
|
|
313
315
|
}
|
|
314
316
|
//, kernelModule: KernelModuleType
|
|
315
|
-
onListeningOnServerEvent(serverWeb) {
|
|
317
|
+
onListeningOnServerEvent(serverWeb, localeLanguage) {
|
|
316
318
|
serverWeb.on(eventName2.error, (err) => {
|
|
317
|
-
eventErrorOnListeningServer.__init().onEventError(err);
|
|
319
|
+
eventErrorOnListeningServer.__init(localeLanguage).onEventError(err);
|
|
318
320
|
}).on(eventName2.close, () => {
|
|
319
|
-
eventErrorOnListeningServer.__init().serverClosing();
|
|
321
|
+
eventErrorOnListeningServer.__init(localeLanguage).serverClosing();
|
|
320
322
|
}).on(eventName2.drop, () => {
|
|
321
|
-
eventErrorOnListeningServer.__init().dropNewConnection();
|
|
323
|
+
eventErrorOnListeningServer.__init(localeLanguage).dropNewConnection();
|
|
322
324
|
}).on(eventName2.listening, () => {
|
|
323
325
|
this.infoWebApp();
|
|
324
326
|
});
|
|
@@ -329,10 +331,10 @@ var WebServerCore = class {
|
|
|
329
331
|
});
|
|
330
332
|
}
|
|
331
333
|
translationWebAppLoader() {
|
|
332
|
-
const
|
|
333
|
-
const
|
|
334
|
-
const translateMsgJsonFilePath = path2.join(
|
|
335
|
-
TranslationLoader3.loadTranslations(translateMsgJsonFilePath,
|
|
334
|
+
const require2 = createRequire(import.meta.url);
|
|
335
|
+
const packagePath = path2.dirname(require2.resolve("opticore-webapp"));
|
|
336
|
+
const translateMsgJsonFilePath = path2.join(packagePath, "utils", "translations");
|
|
337
|
+
TranslationLoader3.loadTranslations(translateMsgJsonFilePath, this.loggerConfig);
|
|
336
338
|
}
|
|
337
339
|
registerRoutes(allFeatureRoutes) {
|
|
338
340
|
allFeatureRoutes.map((router) => {
|
|
@@ -341,8 +343,8 @@ var WebServerCore = class {
|
|
|
341
343
|
});
|
|
342
344
|
});
|
|
343
345
|
}
|
|
344
|
-
stackTraceErrorHandling() {
|
|
345
|
-
eventProcessHandler();
|
|
346
|
+
stackTraceErrorHandling(localeLanguage) {
|
|
347
|
+
eventProcessHandler(localeLanguage);
|
|
346
348
|
}
|
|
347
349
|
infoWebApp() {
|
|
348
350
|
this.serverUtility.infoServer(
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dbConnection": "DataBase connection",
|
|
3
|
+
"dbConnectionClosed": "MySQL connection is closed",
|
|
4
|
+
"mysqlErrorCon": "MysqlError connection",
|
|
5
|
+
"mySQLError": "MysqlError",
|
|
6
|
+
"mySqlCloseConnection": "MySql close connection",
|
|
7
|
+
"verifyExistingKey": "Verify Existing Key",
|
|
8
|
+
"invalidRequest": "Invalid request",
|
|
9
|
+
"tokenNotProvided": "No token provided.",
|
|
10
|
+
"ExpiresToken": "Expires Token. You're not authorize",
|
|
11
|
+
"privateKeyNotExist": "A private key doesn't exist.",
|
|
12
|
+
"publicKeyNotExist": "A public key doesn't exist.",
|
|
13
|
+
"errorNamePublicKeyNotExist": "No public key",
|
|
14
|
+
"errorAuthorPublicKeyNotExist": "PublicKey not existing",
|
|
15
|
+
"errorDecryption": "Error decryption with private key",
|
|
16
|
+
"rsaKeyNotFound": "RSA key provided is not found.",
|
|
17
|
+
"notVerifyingRSAKey": "Not verify RSA Key",
|
|
18
|
+
"errorNameNotVerifyingRSAKey": "Error Verify RSA Key",
|
|
19
|
+
"errorEncryptionPublicKey": "Error encryption with public key",
|
|
20
|
+
"errorEncryptionPrivateKey": "Error encryption with private key",
|
|
21
|
+
"errorNameRsaVerifyExistingKey": "Verify existing key",
|
|
22
|
+
"signatureRSAKeyFailed": "Signature verification failed.",
|
|
23
|
+
"encryptionWithPrivateKeyFailed": "Encryption With PrivateKey",
|
|
24
|
+
"encryptionFailed": "Encryption failed",
|
|
25
|
+
"decryptionWithPublicKeyFailed": "Decryption With PublicKey",
|
|
26
|
+
"decryptionFailed": "Decryption failed",
|
|
27
|
+
"verifyRSAKey": "Verify RSA Keys",
|
|
28
|
+
"verifyRSAKeyFailed": "Verify RSA Keys Failed",
|
|
29
|
+
"notVerifying": "Verification failed",
|
|
30
|
+
"signatureRSAKeysError": "Signature RSA Keys Error",
|
|
31
|
+
"encryptionWithPublicKey": "Encryption error",
|
|
32
|
+
"errorDecryptionWithPrivateKey": "Error Decryption With PrivateKey",
|
|
33
|
+
"verifyPublicRSAKey": "Verify Public RSA Key",
|
|
34
|
+
"PostgresDBConnectionChecker": "PostgresDB Connection Checker",
|
|
35
|
+
"PostgresConnection": "connection",
|
|
36
|
+
"MongoDBConnectionChecker": "MongoDB Connection Checker",
|
|
37
|
+
"MongoConnection": "connection",
|
|
38
|
+
"mongoDBAuthentication": "authentication",
|
|
39
|
+
"mongoDBConnection": "MongoDB connection",
|
|
40
|
+
"mongoDBAuthenticationFailed": "failed",
|
|
41
|
+
"mongoDBUnableParsingUrl": "unable to parse",
|
|
42
|
+
"mongoDBConnectionUrl": "url",
|
|
43
|
+
"mongoDBServerSelection": "MongoServer selection error",
|
|
44
|
+
"mongoDBServer": "MongoServer",
|
|
45
|
+
"mongoDBConnectionError": "connection error",
|
|
46
|
+
"mongoDBError": "error",
|
|
47
|
+
"loadedModules": "Loading core modules",
|
|
48
|
+
"kernel": "Kernel",
|
|
49
|
+
"loadKernel": "load kernel",
|
|
50
|
+
"moduleAppLoaded": "Modules app have been successfully loaded",
|
|
51
|
+
"content": "content",
|
|
52
|
+
"serverSide": "server side",
|
|
53
|
+
"hasBeenLoadedSuccessfully": "has been loaded successfully",
|
|
54
|
+
"routerService": "Routers service",
|
|
55
|
+
"registerRoutes": "Register routes",
|
|
56
|
+
"fail": "fail",
|
|
57
|
+
"loading": "loading",
|
|
58
|
+
"routers": "routers",
|
|
59
|
+
"registerLoadingFailed": "The route register failed to load",
|
|
60
|
+
"dbConnChecker": "database checker connection",
|
|
61
|
+
"loadedModulesError": "Required core modules are not loaded properly",
|
|
62
|
+
"dbConnexionSuccess": "The database connection was successful 🚀",
|
|
63
|
+
"mongoConnectionSuccess": "Connection to database is successfully.",
|
|
64
|
+
"PostgresConnectionSuccess": "Connection to database is successfully.",
|
|
65
|
+
"verifyExistingKeyError": "The provided key is not found",
|
|
66
|
+
"webServer": "Web server",
|
|
67
|
+
"listening": "listening",
|
|
68
|
+
"webHost": "host",
|
|
69
|
+
"badHost": "bad host",
|
|
70
|
+
"hostNotFound": "not found",
|
|
71
|
+
"errorHostUrl": "The host and port are not define, please define them in .env",
|
|
72
|
+
"badPort": "bad port",
|
|
73
|
+
"errorPort": "The port is not correct. Please define a right port with number port.",
|
|
74
|
+
"errorHost": "The host can't be empty or blank. Please define a string host in .env",
|
|
75
|
+
"accessDeniedToDBCon": "Access denied for user {user}. Database credentials in .env file are User: {user} and Password: {password}. {user}''{password}'@'localhost'. Try to set user and password in .env file",
|
|
76
|
+
"unknownDB": "Database {database} is unknown. Please try to use Database CLI to create your database, or do it manually in your Database Management System",
|
|
77
|
+
"errorDBHost": "A database host ${host} does not allow connection. Please either set the host like this: {localhost} in your .env file"
|
|
78
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dbConnection": "DataBase connection",
|
|
3
|
+
"dbConnectionClosed": "MySQL connection is closed",
|
|
4
|
+
"mysqlErrorCon": "MysqlError connection",
|
|
5
|
+
"mySQLError": "MysqlError",
|
|
6
|
+
"mySqlCloseConnection": "MySql close connection",
|
|
7
|
+
"verifyExistingKey": "Verify Existing Key",
|
|
8
|
+
"invalidRequest": "Invalid request",
|
|
9
|
+
"tokenNotProvided": "No token provided.",
|
|
10
|
+
"ExpiresToken": "Expires Token. You're not authorize",
|
|
11
|
+
"privateKeyNotExist": "A private key doesn't exist.",
|
|
12
|
+
"publicKeyNotExist": "A public key doesn't exist.",
|
|
13
|
+
"errorNamePublicKeyNotExist": "No public key",
|
|
14
|
+
"errorAuthorPublicKeyNotExist": "PublicKey not existing",
|
|
15
|
+
"errorDecryption": "Error decryption with private key",
|
|
16
|
+
"rsaKeyNotFound": "RSA key provided is not found.",
|
|
17
|
+
"notVerifyingRSAKey": "Not verify RSA Key",
|
|
18
|
+
"errorNameNotVerifyingRSAKey": "Error Verify RSA Key",
|
|
19
|
+
"errorEncryptionPublicKey": "Error encryption with public key",
|
|
20
|
+
"errorEncryptionPrivateKey": "Error encryption with private key",
|
|
21
|
+
"errorNameRsaVerifyExistingKey": "Verify existing key",
|
|
22
|
+
"signatureRSAKeyFailed": "Signature verification failed.",
|
|
23
|
+
"encryptionWithPrivateKeyFailed": "Encryption With PrivateKey",
|
|
24
|
+
"encryptionFailed": "Encryption failed",
|
|
25
|
+
"decryptionWithPublicKeyFailed": "Decryption With PublicKey",
|
|
26
|
+
"decryptionFailed": "Decryption failed",
|
|
27
|
+
"verifyRSAKey": "Verify RSA Keys",
|
|
28
|
+
"verifyRSAKeyFailed": "Verify RSA Keys Failed",
|
|
29
|
+
"notVerifying": "Verification failed",
|
|
30
|
+
"signatureRSAKeysError": "Signature RSA Keys Error",
|
|
31
|
+
"encryptionWithPublicKey": "Encryption error",
|
|
32
|
+
"errorDecryptionWithPrivateKey": "Error Decryption With PrivateKey",
|
|
33
|
+
"verifyPublicRSAKey": "Verify Public RSA Key",
|
|
34
|
+
"PostgresDBConnectionChecker": "PostgresDB Connection Checker",
|
|
35
|
+
"PostgresConnection": "connection",
|
|
36
|
+
"MongoDBConnectionChecker": "MongoDB Connection Checker",
|
|
37
|
+
"MongoConnection": "connection",
|
|
38
|
+
"mongoDBAuthentication": "authentication",
|
|
39
|
+
"mongoDBConnection": "MongoDB connection",
|
|
40
|
+
"mongoDBAuthenticationFailed": "failed",
|
|
41
|
+
"mongoDBUnableParsingUrl": "unable to parse",
|
|
42
|
+
"mongoDBConnectionUrl": "url",
|
|
43
|
+
"mongoDBServerSelection": "MongoServer selection error",
|
|
44
|
+
"mongoDBServer": "MongoServer",
|
|
45
|
+
"mongoDBConnectionError": "connection error",
|
|
46
|
+
"mongoDBError": "error",
|
|
47
|
+
"loadedModules": "Loading core modules",
|
|
48
|
+
"kernel": "Kernel",
|
|
49
|
+
"loadKernel": "load kernel",
|
|
50
|
+
"moduleAppLoaded": "Modules app have been successfully loaded",
|
|
51
|
+
"content": "content",
|
|
52
|
+
"serverSide": "server side",
|
|
53
|
+
"hasBeenLoadedSuccessfully": "has been loaded successfully",
|
|
54
|
+
"routerService": "Routers service",
|
|
55
|
+
"registerRoutes": "Register routes",
|
|
56
|
+
"fail": "fail",
|
|
57
|
+
"loading": "loading",
|
|
58
|
+
"routers": "routers",
|
|
59
|
+
"registerLoadingFailed": "The route register failed to load",
|
|
60
|
+
"dbConnChecker": "database checker connection",
|
|
61
|
+
"loadedModulesError": "Required core modules are not loaded properly",
|
|
62
|
+
"dbConnexionSuccess": "The database connection was successful 🚀",
|
|
63
|
+
"mongoConnectionSuccess": "Connection to database is successfully.",
|
|
64
|
+
"PostgresConnectionSuccess": "Connection to database is successfully.",
|
|
65
|
+
"verifyExistingKeyError": "The provided key is not found",
|
|
66
|
+
"webServer": "Web server",
|
|
67
|
+
"listening": "listening",
|
|
68
|
+
"webHost": "host",
|
|
69
|
+
"badHost": "bad host",
|
|
70
|
+
"hostNotFound": "not found",
|
|
71
|
+
"errorHostUrl": "The host and port are not define, please define them in .env",
|
|
72
|
+
"badPort": "bad port",
|
|
73
|
+
"errorPort": "The port is not correct. Please define a right port with number port.",
|
|
74
|
+
"errorHost": "The host can't be empty or blank. Please define a string host in .env",
|
|
75
|
+
"accessDeniedToDBCon": "Access denied for user {user}. Database credentials in .env file are User: {user} and Password: {password}. {user}''{password}'@'localhost'. Try to set user and password in .env file",
|
|
76
|
+
"unknownDB": "Database {database} is unknown. Please try to use Database CLI to create your database, or do it manually in your Database Management System",
|
|
77
|
+
"errorDBHost": "A database host ${host} does not allow connection. Please either set the host like this: {localhost} in your .env file"
|
|
78
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opticore-webapp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"description": "wep server",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"cors": "^2.8.5",
|
|
30
30
|
"dotenv": "^16.4.7",
|
|
31
31
|
"gradient-string": "^2.0.2",
|
|
32
|
-
"opticore-catch-exception-error": "^1.0.
|
|
32
|
+
"opticore-catch-exception-error": "^1.0.12",
|
|
33
33
|
"opticore-env-access": "^1.0.2",
|
|
34
34
|
"opticore-express": "^1.0.3",
|
|
35
35
|
"opticore-http-response": "^1.0.3",
|
|
36
36
|
"opticore-logger": "^1.0.13",
|
|
37
37
|
"opticore-requests-called-events": "^1.0.0",
|
|
38
38
|
"opticore-router": "^1.0.10",
|
|
39
|
-
"opticore-translator": "^1.0.
|
|
39
|
+
"opticore-translator": "^1.0.5",
|
|
40
40
|
"opticore-validator": "^1.0.3"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
@@ -10,7 +10,8 @@ import { Router } from "opticore-express";
|
|
|
10
10
|
|
|
11
11
|
import { KernelModuleType } from "@webApp/domains/types/kernelModule.type";
|
|
12
12
|
import { modulesLoadedUtils as loadedModules } from "@webApp/core/helpers/modulesLoaded.utils";
|
|
13
|
-
import {
|
|
13
|
+
import { TranslationLoader } from "opticore-translator";
|
|
14
|
+
import { LoggerCore } from "opticore-logger";
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
|
|
@@ -155,7 +156,7 @@ export class CoreService {
|
|
|
155
156
|
console.log(``);
|
|
156
157
|
}
|
|
157
158
|
|
|
158
|
-
public coreListenerEventLoaderModuleService<T extends KernelModuleType>(kernelModule: T) {
|
|
159
|
+
public coreListenerEventLoaderModuleService<T extends KernelModuleType>(kernelModule: T, localeLanguage: string, loggerConfig: LoggerCore) {
|
|
159
160
|
let router: Router[] = [];
|
|
160
161
|
let dbCon: (() => void) | undefined;
|
|
161
162
|
|
|
@@ -172,8 +173,8 @@ export class CoreService {
|
|
|
172
173
|
((): void => { dbCon(); })();
|
|
173
174
|
} else {
|
|
174
175
|
const stackTrace: StackTraceError = new StackTraceError(
|
|
175
|
-
TranslationLoader.t("loadedModulesError",
|
|
176
|
-
TranslationLoader.t("loadedModules",
|
|
176
|
+
TranslationLoader.t("loadedModulesError", localeLanguage, loggerConfig),
|
|
177
|
+
TranslationLoader.t("loadedModules", localeLanguage, loggerConfig),
|
|
177
178
|
status.NOT_ACCEPTABLE,
|
|
178
179
|
true
|
|
179
180
|
);
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
/**
|
|
13
13
|
*
|
|
14
14
|
*/
|
|
15
|
-
export function eventProcessHandler(): void {
|
|
15
|
+
export function eventProcessHandler(localeLanguage: string): void {
|
|
16
16
|
const errorEmitter = new EventEmitter();
|
|
17
17
|
const app = express();
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ export function eventProcessHandler(): void {
|
|
|
20
20
|
* Listener for error events
|
|
21
21
|
*/
|
|
22
22
|
errorEmitter.on(eventName.error, (error: Error): void => {
|
|
23
|
-
ServerListenEventError.__init().listenerError(error);
|
|
23
|
+
ServerListenEventError.__init(localeLanguage).listenerError(error);
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
/**
|
|
@@ -29,7 +29,7 @@ export function eventProcessHandler(): void {
|
|
|
29
29
|
*/
|
|
30
30
|
process.on(event.beforeExit, (code: number): void => {
|
|
31
31
|
setTimeout((): void => {
|
|
32
|
-
ServerListenEventError.__init().processBeforeExit(code);
|
|
32
|
+
ServerListenEventError.__init(localeLanguage).processBeforeExit(code);
|
|
33
33
|
}, 100);
|
|
34
34
|
});
|
|
35
35
|
|
|
@@ -37,75 +37,75 @@ export function eventProcessHandler(): void {
|
|
|
37
37
|
*
|
|
38
38
|
*/
|
|
39
39
|
process.on(event.disconnect, (): void => {
|
|
40
|
-
ServerListenEventError.__init().processDisconnected();
|
|
40
|
+
ServerListenEventError.__init(localeLanguage).processDisconnected();
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
*
|
|
45
45
|
*/
|
|
46
46
|
process.on(event.exit, (code: number): void => {
|
|
47
|
-
ServerListenEventError.__init().exited(code);
|
|
47
|
+
ServerListenEventError.__init(localeLanguage).exited(code);
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
*
|
|
52
52
|
*/
|
|
53
53
|
process.on(event.rejectionHandled, (promise: Promise<any>): void => {
|
|
54
|
-
ServerListenEventError.__init().promiseRejectionHandled(promise);
|
|
54
|
+
ServerListenEventError.__init(localeLanguage).promiseRejectionHandled(promise);
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
*
|
|
59
59
|
*/
|
|
60
60
|
process.on(event.uncaughtException, (error: any): void => {
|
|
61
|
-
ServerListenEventError.__init().uncaughtException(error);
|
|
61
|
+
ServerListenEventError.__init(localeLanguage).uncaughtException(error);
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
*
|
|
66
66
|
*/
|
|
67
67
|
process.on(event.uncaughtExceptionMonitor, (error: any): void => {
|
|
68
|
-
ServerListenEventError.__init().uncaughtExceptionMonitor(error);
|
|
68
|
+
ServerListenEventError.__init(localeLanguage).uncaughtExceptionMonitor(error);
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
*
|
|
73
73
|
*/
|
|
74
74
|
process.on(event.unhandledRejection, (reason: any, promise: Promise<any>): void => {
|
|
75
|
-
ServerListenEventError.__init().unhandledRejection(reason, promise);
|
|
75
|
+
ServerListenEventError.__init(localeLanguage).unhandledRejection(reason, promise);
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
*
|
|
80
80
|
*/
|
|
81
81
|
process.on(event.warning, (warning: any): void => {
|
|
82
|
-
ServerListenEventError.__init().warning(warning);
|
|
82
|
+
ServerListenEventError.__init(localeLanguage).warning(warning);
|
|
83
83
|
});
|
|
84
84
|
process.on(event.message, (message: any): void => {
|
|
85
|
-
ServerListenEventError.__init().message(message);
|
|
85
|
+
ServerListenEventError.__init(localeLanguage).message(message);
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
89
|
*
|
|
90
90
|
*/
|
|
91
91
|
process.on(event.multipleResolves, (type: string, promise: Promise<any>, reason: any): void => {
|
|
92
|
-
ServerListenEventError.__init().multipleResolves(type, promise, reason);
|
|
92
|
+
ServerListenEventError.__init(localeLanguage).multipleResolves(type, promise, reason);
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
96
|
* Handle specific signals
|
|
97
97
|
*/
|
|
98
98
|
process.on(event.sigint, (): void => {
|
|
99
|
-
ServerListenEventError.__init().processInterrupted();
|
|
99
|
+
ServerListenEventError.__init(localeLanguage).processInterrupted();
|
|
100
100
|
});
|
|
101
101
|
process.on(event.sigterm, (signal: any): void => {
|
|
102
|
-
ServerListenEventError.__init().sigtermSignalReceived(signal);
|
|
102
|
+
ServerListenEventError.__init(localeLanguage).sigtermSignalReceived(signal);
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
106
|
* Express error-handling middleware
|
|
107
107
|
*/
|
|
108
108
|
app.use((err: Error, req: Request, res: Response, next: NextFunction): void => {
|
|
109
|
-
ServerListenEventError.__init().expressErrorHandlingMiddleware(errorEmitter, err, req, res, next);
|
|
109
|
+
ServerListenEventError.__init(localeLanguage).expressErrorHandlingMiddleware(errorEmitter, err, req, res, next);
|
|
110
110
|
});
|
|
111
111
|
}
|
|
@@ -2,21 +2,22 @@ import colors from "ansi-colors";
|
|
|
2
2
|
import { Router } from "opticore-express";
|
|
3
3
|
import { LogMessageUtils } from "@webApp/core/helpers/logMessage.utils";
|
|
4
4
|
import { dateTimeFormattedUtils } from "@webApp/core/helpers/dateTimeFormatted.utils";
|
|
5
|
-
import {
|
|
5
|
+
import { TranslationLoader } from "opticore-translator";
|
|
6
|
+
import { LoggerCore } from "opticore-logger";
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
9
|
-
export function modulesLoadedUtils(allAppRoutes: Router[], dbConChecker: () => void): void {
|
|
10
|
+
export function modulesLoadedUtils(allAppRoutes: Router[], dbConChecker: () => void, localeLanguage: string, loggerConfig: LoggerCore): void {
|
|
10
11
|
LogMessageUtils.success(
|
|
11
|
-
`${TranslationLoader.t("kernel",
|
|
12
|
-
`${TranslationLoader.t("loadKernel",
|
|
13
|
-
`${TranslationLoader.t("moduleAppLoaded",
|
|
12
|
+
`${TranslationLoader.t("kernel", localeLanguage, loggerConfig)}`,
|
|
13
|
+
`${TranslationLoader.t("loadKernel", localeLanguage, loggerConfig)}`,
|
|
14
|
+
`${TranslationLoader.t("moduleAppLoaded", localeLanguage, loggerConfig)}`
|
|
14
15
|
);
|
|
15
|
-
console.log(`${colors.whiteBright(` ${TranslationLoader.t("content",
|
|
16
|
+
console.log(`${colors.whiteBright(` ${TranslationLoader.t("content", localeLanguage, loggerConfig)}`)} ${colors.green(`${TranslationLoader.t("kernel", localeLanguage, loggerConfig)} :`)} ${colors.cyan(`${colors.bold(`${TranslationLoader.t("serverSide", localeLanguage, loggerConfig)}`)}`)} ${TranslationLoader.t("hasBeenLoadedSuccessfully", localeLanguage, loggerConfig)} ${colors.green(`✔`)}`);
|
|
16
17
|
allAppRoutes
|
|
17
|
-
? console.log(`${colors.whiteBright(` ${TranslationLoader.t("content",
|
|
18
|
-
: console.log(`${colors.red(`✘`)} ${colors.bgRed(` ${colors.bold(`${colors.white(` ${TranslationLoader.t("registerRoutes",
|
|
18
|
+
? console.log(`${colors.whiteBright(` ${TranslationLoader.t("content", localeLanguage, loggerConfig)}`)} ${colors.green(`${TranslationLoader.t("kernel", localeLanguage, loggerConfig)} :`)} ${colors.cyan(`${colors.bold(`${TranslationLoader.t("routerService", localeLanguage, loggerConfig)}`)} `)} ${colors.green(`✔`)}`)
|
|
19
|
+
: console.log(`${colors.red(`✘`)} ${colors.bgRed(` ${colors.bold(`${colors.white(` ${TranslationLoader.t("registerRoutes", localeLanguage, loggerConfig)} `)}`)} `)} | ${dateTimeFormattedUtils} | [ ${colors.red(`${colors.bold(` ${TranslationLoader.t("fail", localeLanguage, loggerConfig)} `)}`)} ] | [ ${colors.bold(` ${TranslationLoader.t("loading", localeLanguage, loggerConfig)} `)} ] - ${colors.red(` ${TranslationLoader.t("routers", localeLanguage, loggerConfig)} `)} - ${TranslationLoader.t("registerLoadingFailed", localeLanguage, loggerConfig)} `);
|
|
19
20
|
typeof dbConChecker == "function"
|
|
20
|
-
? console.log(`${colors.whiteBright(` ${TranslationLoader.t("content",
|
|
21
|
+
? console.log(`${colors.whiteBright(` ${TranslationLoader.t("content", localeLanguage, loggerConfig)}`)} ${colors.green(`${TranslationLoader.t("kernel", localeLanguage, loggerConfig)} :`)} ${colors.cyan(`${colors.bold(`${TranslationLoader.t("dbConnChecker", localeLanguage, loggerConfig)}`)}`)} ${TranslationLoader.t("hasBeenLoadedSuccessfully", localeLanguage, loggerConfig)} ${colors.green(`✔`)}`)
|
|
21
22
|
: "";
|
|
22
23
|
}
|
|
@@ -1,38 +1,42 @@
|
|
|
1
1
|
import * as path from "path";
|
|
2
|
+
import { createRequire } from "module";
|
|
2
3
|
import corsOrigin, { CorsOptions } from "cors";
|
|
3
4
|
import { Server as serverWebApp } from "http";
|
|
4
5
|
import { IncomingMessage, ServerResponse } from "node:http";
|
|
5
|
-
import { fileURLToPath } from 'url';
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
CEventNameError as eventName,
|
|
9
9
|
StackTraceError,
|
|
10
10
|
ServerListenEventError as eventErrorOnListeningServer
|
|
11
11
|
} from "opticore-catch-exception-error";
|
|
12
|
-
import {
|
|
12
|
+
import { express } from "opticore-express";
|
|
13
13
|
import { getEnvVariable } from "opticore-env-access";
|
|
14
14
|
import { requestCallsEvent } from "opticore-requests-called-events";
|
|
15
15
|
import { HttpStatusCode } from "opticore-http-response";
|
|
16
|
+
import { TranslationLoader } from "opticore-translator";
|
|
17
|
+
import { LoggerCore } from "opticore-logger";
|
|
16
18
|
|
|
17
19
|
import { IRouteDefinition } from "@webApp/domains/interfaces/routeDefinition.interface";
|
|
18
20
|
import { eventProcessHandler } from "@webApp/core/handlers/eventProcess.handler";
|
|
19
21
|
import { CoreService } from "@webApp/application/service/core.service";
|
|
20
22
|
import { dateTimeFormattedUtils as currentDate } from "@webApp/core/helpers/dateTimeFormatted.utils";
|
|
21
|
-
|
|
23
|
+
|
|
22
24
|
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
export class WebServerCore {
|
|
26
28
|
private serverUtility: CoreService = new CoreService();
|
|
27
29
|
private expressApp = express();
|
|
30
|
+
private readonly loggerConfig: LoggerCore;
|
|
28
31
|
private readonly routerExpressApp: express.Application;
|
|
29
32
|
private readonly port: number;
|
|
30
33
|
private readonly host: string;
|
|
31
34
|
|
|
32
|
-
constructor(app: express.Application, corsOriginOptions?: Partial<CorsOptions>) {
|
|
35
|
+
constructor(app: express.Application, loggerConfig: LoggerCore, localeLanguage: string, corsOriginOptions?: Partial<CorsOptions>) {
|
|
33
36
|
this.port = Number(getEnvVariable.appPort);
|
|
34
37
|
this.host = getEnvVariable.appHost;
|
|
35
38
|
this.routerExpressApp = app;
|
|
39
|
+
this.loggerConfig = loggerConfig;
|
|
36
40
|
|
|
37
41
|
this.expressApp.use(express.json());
|
|
38
42
|
this.expressApp.use(express.raw());
|
|
@@ -40,22 +44,22 @@ export class WebServerCore {
|
|
|
40
44
|
this.expressApp.use(express.urlencoded({ extended: true }));
|
|
41
45
|
this.expressApp.use(corsOrigin(corsOriginOptions));
|
|
42
46
|
|
|
43
|
-
this.stackTraceErrorHandling();
|
|
47
|
+
this.stackTraceErrorHandling(localeLanguage);
|
|
44
48
|
this.translationWebAppLoader();
|
|
45
49
|
}
|
|
46
50
|
|
|
47
|
-
public onStartServer(routers: { featureRoute: IRouteDefinition[] }[]) {
|
|
51
|
+
public onStartServer(routers: { featureRoute: IRouteDefinition[] }[], localeLanguage: string) {
|
|
48
52
|
return this.expressApp.listen(
|
|
49
53
|
this.port,
|
|
50
54
|
this.host,
|
|
51
55
|
(): void => {
|
|
52
56
|
try {
|
|
53
57
|
if (this.host === "" && this.port === 0) {
|
|
54
|
-
eventErrorOnListeningServer.__init().hostPortUndefined();
|
|
58
|
+
eventErrorOnListeningServer.__init(localeLanguage).hostPortUndefined();
|
|
55
59
|
} else if (this.host === "") {
|
|
56
|
-
eventErrorOnListeningServer.__init().hostUndefined();
|
|
60
|
+
eventErrorOnListeningServer.__init(localeLanguage).hostUndefined();
|
|
57
61
|
} else if (this.port === 0) {
|
|
58
|
-
eventErrorOnListeningServer.__init().portUndefined();
|
|
62
|
+
eventErrorOnListeningServer.__init(localeLanguage).portUndefined();
|
|
59
63
|
} else {
|
|
60
64
|
this.registerRoutes(routers);
|
|
61
65
|
}
|
|
@@ -67,13 +71,13 @@ export class WebServerCore {
|
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
//, kernelModule: KernelModuleType
|
|
70
|
-
public onListeningOnServerEvent(serverWeb: serverWebApp): void {
|
|
74
|
+
public onListeningOnServerEvent(serverWeb: serverWebApp, localeLanguage: string): void {
|
|
71
75
|
serverWeb.on(eventName.error, (err: Error): void => {
|
|
72
|
-
eventErrorOnListeningServer.__init().onEventError(err);
|
|
76
|
+
eventErrorOnListeningServer.__init(localeLanguage).onEventError(err);
|
|
73
77
|
}).on(eventName.close, (): void => {
|
|
74
|
-
eventErrorOnListeningServer.__init().serverClosing();
|
|
78
|
+
eventErrorOnListeningServer.__init(localeLanguage).serverClosing();
|
|
75
79
|
}).on(eventName.drop, (): void => {
|
|
76
|
-
eventErrorOnListeningServer.__init().dropNewConnection();
|
|
80
|
+
eventErrorOnListeningServer.__init(localeLanguage).dropNewConnection();
|
|
77
81
|
}).on(eventName.listening, (): void => {
|
|
78
82
|
this.infoWebApp();
|
|
79
83
|
//this.serverUtility.coreListenerEventLoaderModuleService(kernelModule);
|
|
@@ -87,10 +91,11 @@ export class WebServerCore {
|
|
|
87
91
|
}
|
|
88
92
|
|
|
89
93
|
private translationWebAppLoader(): void {
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
const require: NodeJS.Require = createRequire(import.meta.url);
|
|
95
|
+
const packagePath: string = path.dirname(require.resolve("opticore-webapp"));
|
|
96
|
+
|
|
97
|
+
const translateMsgJsonFilePath: string = path.join(packagePath, "utils", "translations");
|
|
98
|
+
TranslationLoader.loadTranslations(translateMsgJsonFilePath, this.loggerConfig);
|
|
94
99
|
}
|
|
95
100
|
private registerRoutes(allFeatureRoutes: { featureRoute: IRouteDefinition[] }[]): void {
|
|
96
101
|
allFeatureRoutes.map((router: {featureRoute: IRouteDefinition[]} ): void => {
|
|
@@ -99,8 +104,8 @@ export class WebServerCore {
|
|
|
99
104
|
});
|
|
100
105
|
});
|
|
101
106
|
}
|
|
102
|
-
private stackTraceErrorHandling(): void {
|
|
103
|
-
eventProcessHandler();
|
|
107
|
+
private stackTraceErrorHandling(localeLanguage: string): void {
|
|
108
|
+
eventProcessHandler(localeLanguage);
|
|
104
109
|
}
|
|
105
110
|
private infoWebApp(): void {
|
|
106
111
|
this.serverUtility.infoServer(
|