opticore-webapp 1.0.16 → 1.0.18

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.js CHANGED
@@ -1,16 +1,20 @@
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
- StackTraceError as StackTraceError2,
8
- ServerListenEventError as eventErrorOnListeningServer
7
+ ServerListenEventError as ServerListenEventError2,
8
+ JavaScriptErrors,
9
+ InternalErrors,
10
+ AssertionErrors,
11
+ OpenSSLErrors,
12
+ SystemErrors
9
13
  } from "opticore-catch-exception-error";
10
14
  import { express as express2 } from "opticore-express";
11
15
  import { getEnvVariable } from "opticore-env-access";
12
16
  import { requestCallsEvent } from "opticore-requests-called-events";
13
- import { HttpStatusCode } from "opticore-http-response";
17
+ import { TranslationLoader as TranslationLoader4 } from "opticore-translator";
14
18
 
15
19
  // src/core/handlers/eventProcess.handler.ts
16
20
  import process from "node:process";
@@ -21,52 +25,53 @@ import {
21
25
  CEventNameError as eventName,
22
26
  CEvent as event
23
27
  } from "opticore-catch-exception-error";
24
- function eventProcessHandler() {
28
+ function eventProcessHandler(localeLanguage) {
25
29
  const errorEmitter = new EventEmitter();
26
30
  const app = express();
31
+ const serverListenEvent = new ServerListenEventError(localeLanguage);
27
32
  errorEmitter.on(eventName.error, (error) => {
28
- ServerListenEventError.__init().listenerError(error);
33
+ serverListenEvent.listenerError(error);
29
34
  });
30
35
  process.on(event.beforeExit, (code) => {
31
36
  setTimeout(() => {
32
- ServerListenEventError.__init().processBeforeExit(code);
37
+ serverListenEvent.processBeforeExit(code);
33
38
  }, 100);
34
39
  });
35
40
  process.on(event.disconnect, () => {
36
- ServerListenEventError.__init().processDisconnected();
41
+ serverListenEvent.processDisconnected();
37
42
  });
38
43
  process.on(event.exit, (code) => {
39
- ServerListenEventError.__init().exited(code);
44
+ serverListenEvent.exited(code);
40
45
  });
41
46
  process.on(event.rejectionHandled, (promise) => {
42
- ServerListenEventError.__init().promiseRejectionHandled(promise);
47
+ serverListenEvent.promiseRejectionHandled(promise);
43
48
  });
44
49
  process.on(event.uncaughtException, (error) => {
45
- ServerListenEventError.__init().uncaughtException(error);
50
+ serverListenEvent.uncaughtException(error);
46
51
  });
47
52
  process.on(event.uncaughtExceptionMonitor, (error) => {
48
- ServerListenEventError.__init().uncaughtExceptionMonitor(error);
53
+ serverListenEvent.uncaughtExceptionMonitor(error);
49
54
  });
50
55
  process.on(event.unhandledRejection, (reason, promise) => {
51
- ServerListenEventError.__init().unhandledRejection(reason, promise);
56
+ serverListenEvent.unhandledRejection(reason, promise);
52
57
  });
53
58
  process.on(event.warning, (warning) => {
54
- ServerListenEventError.__init().warning(warning);
59
+ serverListenEvent.warning(warning);
55
60
  });
56
61
  process.on(event.message, (message) => {
57
- ServerListenEventError.__init().message(message);
62
+ serverListenEvent.message(message);
58
63
  });
59
64
  process.on(event.multipleResolves, (type, promise, reason) => {
60
- ServerListenEventError.__init().multipleResolves(type, promise, reason);
65
+ serverListenEvent.multipleResolves(type, promise, reason);
61
66
  });
62
67
  process.on(event.sigint, () => {
63
- ServerListenEventError.__init().processInterrupted();
68
+ serverListenEvent.processInterrupted();
64
69
  });
65
70
  process.on(event.sigterm, (signal) => {
66
- ServerListenEventError.__init().sigtermSignalReceived(signal);
71
+ serverListenEvent.sigtermSignalReceived(signal);
67
72
  });
68
73
  app.use((err, req, res, next) => {
69
- ServerListenEventError.__init().expressErrorHandlingMiddleware(errorEmitter, err, req, res, next);
74
+ serverListenEvent.expressErrorHandlingMiddleware(errorEmitter, err, req, res, next);
70
75
  });
71
76
  }
72
77
 
@@ -108,20 +113,20 @@ var LogMessageUtils = class {
108
113
  };
109
114
 
110
115
  // src/core/helpers/modulesLoaded.utils.ts
111
- import { CLocal, TranslationLoader } from "opticore-translator";
112
- function modulesLoadedUtils(allAppRoutes, dbConChecker) {
116
+ import { TranslationLoader } from "opticore-translator";
117
+ function modulesLoadedUtils(allAppRoutes, dbConChecker, localeLanguage) {
113
118
  LogMessageUtils.success(
114
- `${TranslationLoader.t("kernel", CLocal)}`,
115
- `${TranslationLoader.t("loadKernel", CLocal)}`,
116
- `${TranslationLoader.t("moduleAppLoaded", CLocal)}`
119
+ `${TranslationLoader.t("kernel", localeLanguage, loggerConfig)}`,
120
+ `${TranslationLoader.t("loadKernel", localeLanguage, loggerConfig)}`,
121
+ `${TranslationLoader.t("moduleAppLoaded", localeLanguage, loggerConfig)}`
117
122
  );
118
- console.log(`${colors2.whiteBright(` ${TranslationLoader.t("content", CLocal)}`)} ${colors2.green(`${TranslationLoader.t("kernel", CLocal)} :`)} ${colors2.cyan(`${colors2.bold(`${TranslationLoader.t("serverSide", CLocal)}`)}`)} ${TranslationLoader.t("hasBeenLoadedSuccessfully", CLocal)} ${colors2.green(`\u2714`)}`);
119
- allAppRoutes ? console.log(`${colors2.whiteBright(` ${TranslationLoader.t("content", CLocal)}`)} ${colors2.green(`${TranslationLoader.t("kernel", CLocal)} :`)} ${colors2.cyan(`${colors2.bold(`${TranslationLoader.t("routerService", CLocal)}`)} `)} ${colors2.green(`\u2714`)}`) : console.log(`${colors2.red(`\u2718`)} ${colors2.bgRed(` ${colors2.bold(`${colors2.white(` ${TranslationLoader.t("registerRoutes", CLocal)} `)}`)} `)} | ${dateTimeFormattedUtils} | [ ${colors2.red(`${colors2.bold(` ${TranslationLoader.t("fail", CLocal)} `)}`)} ] | [ ${colors2.bold(` ${TranslationLoader.t("loading", CLocal)} `)} ] - ${colors2.red(` ${TranslationLoader.t("routers", CLocal)} `)} - ${TranslationLoader.t("registerLoadingFailed", CLocal)} `);
120
- typeof dbConChecker == "function" ? console.log(`${colors2.whiteBright(` ${TranslationLoader.t("content", CLocal)}`)} ${colors2.green(`${TranslationLoader.t("kernel", CLocal)} :`)} ${colors2.cyan(`${colors2.bold(`${TranslationLoader.t("dbConnChecker", CLocal)}`)}`)} ${TranslationLoader.t("hasBeenLoadedSuccessfully", CLocal)} ${colors2.green(`\u2714`)}`) : "";
123
+ 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`)}`);
124
+ 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)} `);
125
+ 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
126
  }
122
127
 
123
128
  // src/application/service/core.service.ts
124
- import { CLocal as CLocal2, TranslationLoader as TranslationLoader2 } from "opticore-translator";
129
+ import { TranslationLoader as TranslationLoader2 } from "opticore-translator";
125
130
  var CoreService = class {
126
131
  /**
127
132
  *
@@ -243,7 +248,7 @@ var CoreService = class {
243
248
  console.log(`${`Memory usage by system :`} ${colors3.cyan(`${colors3.bold(`${system}`)}`)}`);
244
249
  console.log(``);
245
250
  }
246
- coreListenerEventLoaderModuleService(kernelModule) {
251
+ coreListenerEventLoaderModuleService(kernelModule, localeLanguage, loggerConfig2) {
247
252
  let router = [];
248
253
  let dbCon;
249
254
  kernelModule.forEach((module) => {
@@ -260,8 +265,8 @@ var CoreService = class {
260
265
  })();
261
266
  } else {
262
267
  const stackTrace = new StackTraceError(
263
- TranslationLoader2.t("loadedModulesError", CLocal2),
264
- TranslationLoader2.t("loadedModules", CLocal2),
268
+ TranslationLoader2.t("loadedModulesError", localeLanguage, loggerConfig2),
269
+ TranslationLoader2.t("loadedModules", localeLanguage, loggerConfig2),
265
270
  status.NOT_ACCEPTABLE,
266
271
  true
267
272
  );
@@ -270,24 +275,152 @@ var CoreService = class {
270
275
  }
271
276
  };
272
277
 
273
- // src/core/webServer.core.ts
278
+ // src/application/service/serverStartError.service.ts
279
+ import assert from "assert";
280
+ import { CErrorName } from "opticore-catch-exception-error";
281
+ import { HttpStatusCode } from "opticore-http-response";
274
282
  import { TranslationLoader as TranslationLoader3 } from "opticore-translator";
283
+ var SServerStartError = (err) => {
284
+ switch (err.name) {
285
+ case CErrorName.typeError:
286
+ (void 0).javaScriptErrors.typeError(err);
287
+ break;
288
+ case CErrorName.error:
289
+ (void 0).javaScriptErrors.allError(err);
290
+ break;
291
+ case CErrorName.evalError:
292
+ (void 0).javaScriptErrors.evalError(err);
293
+ break;
294
+ case CErrorName.referenceError:
295
+ (void 0).javaScriptErrors.referenceError(err);
296
+ break;
297
+ case CErrorName.rangeError:
298
+ (void 0).javaScriptErrors.rangeError(err);
299
+ break;
300
+ case CErrorName.syntaxError:
301
+ (void 0).javaScriptErrors.syntaxError(err);
302
+ break;
303
+ case CErrorName.uriError:
304
+ (void 0).javaScriptErrors.uRIError(err);
305
+ break;
306
+ case CErrorName.eacces:
307
+ (void 0).systemErrors.eAcces(err);
308
+ break;
309
+ case CErrorName.eaddrinuse:
310
+ (void 0).systemErrors.eAddrInUse(err);
311
+ break;
312
+ case CErrorName.econnrefused:
313
+ (void 0).systemErrors.eConnRefused(err);
314
+ break;
315
+ case CErrorName.econnreset:
316
+ (void 0).systemErrors.eConnReset(err);
317
+ break;
318
+ case CErrorName.eexist:
319
+ (void 0).systemErrors.eExist(err);
320
+ break;
321
+ case CErrorName.eisdir:
322
+ (void 0).systemErrors.eIsDir(err);
323
+ break;
324
+ case CErrorName.emfile:
325
+ (void 0).systemErrors.eMFile(err);
326
+ break;
327
+ case CErrorName.enoent:
328
+ (void 0).systemErrors.eNoEnt(err);
329
+ break;
330
+ case CErrorName.enotdir:
331
+ (void 0).systemErrors.eNotDir(err);
332
+ break;
333
+ case CErrorName.enotEmpty:
334
+ (void 0).systemErrors.eNotEmpty(err);
335
+ break;
336
+ case CErrorName.eperm:
337
+ (void 0).systemErrors.ePerm(err);
338
+ break;
339
+ case CErrorName.epipe:
340
+ (void 0).systemErrors.ePipe(err);
341
+ break;
342
+ case CErrorName.etimedout:
343
+ (void 0).systemErrors.eTimedOut(err);
344
+ break;
345
+ case CErrorName.assertionError:
346
+ (void 0).stackTrace = (void 0).traceError(err.message, err.name, HttpStatusCode.NOT_ACCEPTABLE);
347
+ err instanceof assert.AssertionError ? (void 0).logger.error(
348
+ TranslationLoader3.t((void 0).stackTrace.name, (void 0).localLanguage),
349
+ "AssertionError",
350
+ (void 0).stackTrace.name,
351
+ (void 0).stackTrace.stack,
352
+ HttpStatusCode.INTERNAL_SERVER_ERROR
353
+ ) : (void 0).logger.error(
354
+ TranslationLoader3.t((void 0).stackTrace.name, (void 0).localLanguage),
355
+ "Another Error",
356
+ (void 0).stackTrace.name,
357
+ (void 0).stackTrace.stack,
358
+ HttpStatusCode.INTERNAL_SERVER_ERROR
359
+ );
360
+ break;
361
+ case CErrorName.errOsslEvpUnsupported:
362
+ (void 0).openSSLErrors.errOsSLEvpUnsupported(err);
363
+ break;
364
+ case CErrorName.errOsslBadDecrypt:
365
+ (void 0).openSSLErrors.errOsSLBadDecrypt(err);
366
+ break;
367
+ case CErrorName.errOsslWrongFinalBlockLength:
368
+ (void 0).openSSLErrors.errOsSLWrongFinalBlockLength(err);
369
+ break;
370
+ case CErrorName.errInvalidArgType:
371
+ (void 0).internalErrors.errInvalidArgType(err);
372
+ break;
373
+ case CErrorName.errInvalidCallback:
374
+ (void 0).internalErrors.errInvalidCallback(err);
375
+ break;
376
+ case CErrorName.errHttpHeadersSent:
377
+ (void 0).internalErrors.errHttpHeadersSent(err);
378
+ break;
379
+ case CErrorName.errStreamDestroyed:
380
+ (void 0).internalErrors.errStreamDestroyed(err);
381
+ break;
382
+ case CErrorName.errTlsCertAltnameInvalid:
383
+ (void 0).internalErrors.errTlsCertAltNameInvalid(err);
384
+ break;
385
+ case CErrorName.errUnsupportedEsmUrlScheme:
386
+ (void 0).internalErrors.errUnsupportedEsmUrlScheme(err);
387
+ break;
388
+ }
389
+ };
390
+
391
+ // src/core/webServer.core.ts
275
392
  var WebServerCore = class {
276
393
  serverUtility = new CoreService();
277
394
  expressApp = express2();
395
+ localLanguage;
396
+ loggerConfig;
278
397
  routerExpressApp;
279
398
  port;
280
399
  host;
281
- constructor(app, corsOriginOptions) {
400
+ serverListenEvent;
401
+ javaScriptErrors;
402
+ internalErrors;
403
+ assertionErrors;
404
+ openSSLErrors;
405
+ systemErrors;
406
+ constructor(app, loggerConfig2, localLanguage, corsOriginOptions) {
282
407
  this.port = Number(getEnvVariable.appPort);
283
408
  this.host = getEnvVariable.appHost;
284
409
  this.routerExpressApp = app;
410
+ this.loggerConfig = loggerConfig2;
411
+ this.localLanguage = localLanguage;
285
412
  this.expressApp.use(express2.json());
286
413
  this.expressApp.use(express2.raw());
287
414
  this.expressApp.use(express2.text());
288
415
  this.expressApp.use(express2.urlencoded({ extended: true }));
289
416
  this.expressApp.use(corsOrigin(corsOriginOptions));
290
- this.stackTraceErrorHandling();
417
+ this.serverListenEvent = new ServerListenEventError2(localLanguage);
418
+ this.javaScriptErrors = new JavaScriptErrors(localLanguage);
419
+ this.assertionErrors = new AssertionErrors(localLanguage);
420
+ this.internalErrors = new InternalErrors(localLanguage);
421
+ this.openSSLErrors = new OpenSSLErrors(localLanguage);
422
+ this.systemErrors = new SystemErrors(localLanguage);
423
+ this.stackTraceErrorHandling(localLanguage);
291
424
  this.translationWebAppLoader();
292
425
  }
293
426
  onStartServer(routers) {
@@ -297,28 +430,28 @@ var WebServerCore = class {
297
430
  () => {
298
431
  try {
299
432
  if (this.host === "" && this.port === 0) {
300
- eventErrorOnListeningServer.__init().hostPortUndefined();
433
+ this.serverListenEvent.hostPortUndefined(this.port);
301
434
  } else if (this.host === "") {
302
- eventErrorOnListeningServer.__init().hostUndefined();
435
+ this.serverListenEvent.hostUndefined(this.host);
303
436
  } else if (this.port === 0) {
304
- eventErrorOnListeningServer.__init().portUndefined();
437
+ this.serverListenEvent.portUndefined();
305
438
  } else {
306
439
  this.registerRoutes(routers);
307
440
  }
308
441
  } catch (err) {
309
- this.traceError(err.message, "Error", HttpStatusCode.NOT_ACCEPTABLE);
442
+ SServerStartError(err);
310
443
  }
311
444
  }
312
445
  );
313
446
  }
314
447
  //, kernelModule: KernelModuleType
315
- onListeningOnServerEvent(serverWeb) {
448
+ onListeningOnServerEvent(serverWeb, localLanguage) {
316
449
  serverWeb.on(eventName2.error, (err) => {
317
- eventErrorOnListeningServer.__init().onEventError(err);
450
+ this.serverListenEvent.onEventError(err);
318
451
  }).on(eventName2.close, () => {
319
- eventErrorOnListeningServer.__init().serverClosing();
452
+ this.serverListenEvent.serverClosing();
320
453
  }).on(eventName2.drop, () => {
321
- eventErrorOnListeningServer.__init().dropNewConnection();
454
+ this.serverListenEvent.dropNewConnection();
322
455
  }).on(eventName2.listening, () => {
323
456
  this.infoWebApp();
324
457
  });
@@ -329,10 +462,10 @@ var WebServerCore = class {
329
462
  });
330
463
  }
331
464
  translationWebAppLoader() {
332
- const __filename2 = fileURLToPath(import.meta.url);
333
- const __dirname2 = path2.dirname(__filename2);
334
- const translateMsgJsonFilePath = path2.join(__dirname2, "../../../", "utils", "translations");
335
- TranslationLoader3.loadTranslations(translateMsgJsonFilePath, getEnvVariable.defaultLocal);
465
+ const require2 = createRequire(import.meta.url);
466
+ const packagePath = path2.dirname(require2.resolve("opticore-webapp"));
467
+ const translateMsgJsonFilePath = path2.join(packagePath, "utils", "translations");
468
+ TranslationLoader4.loadTranslations(translateMsgJsonFilePath);
336
469
  }
337
470
  registerRoutes(allFeatureRoutes) {
338
471
  allFeatureRoutes.map((router) => {
@@ -341,8 +474,8 @@ var WebServerCore = class {
341
474
  });
342
475
  });
343
476
  }
344
- stackTraceErrorHandling() {
345
- eventProcessHandler();
477
+ stackTraceErrorHandling(localLanguage) {
478
+ eventProcessHandler(localLanguage);
346
479
  }
347
480
  infoWebApp() {
348
481
  this.serverUtility.infoServer(
@@ -356,9 +489,6 @@ var WebServerCore = class {
356
489
  this.serverUtility.getUsageMemory().system
357
490
  );
358
491
  }
359
- traceError(props, name, status2) {
360
- return new StackTraceError2(props, name, status2, true);
361
- }
362
492
  };
363
493
  export {
364
494
  WebServerCore as WebServer
@@ -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.16",
3
+ "version": "1.0.18",
4
4
  "description": "wep server",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -29,23 +29,23 @@
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.9",
32
+ "opticore-catch-exception-error": "^1.0.17",
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.3",
39
+ "opticore-translator": "^1.0.7",
40
40
  "opticore-validator": "^1.0.3"
41
41
  },
42
42
  "devDependencies": {
43
- "@types/node": "^22.13.5",
43
+ "@types/node": "^22.13.10",
44
44
  "@types/cors": "^2.8.17",
45
45
  "@types/gradient-string": "^1.1.6",
46
46
  "reflect-metadata": "^0.2.2",
47
47
  "tslib": "^2.8.1",
48
- "tsup": "^8.3.5",
48
+ "tsup": "^8.4.0",
49
49
  "typescript": "^5.4.5"
50
50
  }
51
51
  }
@@ -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 { CLocal, TranslationLoader } from "opticore-translator";
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", CLocal),
176
- TranslationLoader.t("loadedModules", CLocal),
176
+ TranslationLoader.t("loadedModulesError", localeLanguage, loggerConfig),
177
+ TranslationLoader.t("loadedModules", localeLanguage, loggerConfig),
177
178
  status.NOT_ACCEPTABLE,
178
179
  true
179
180
  );