opticore-webapp-core 1.0.8 → 1.0.10

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 CHANGED
@@ -224,27 +224,30 @@ var SLoggerFileConfiguration = () => {
224
224
 
225
225
  // src/application/services/asymmetricCryptionDataWithPrivateRSAKey.service.ts
226
226
  var SAsymmetricCryptionDataWithPrivateRSAKey = class {
227
- static log = SLoggerFileConfiguration();
227
+ log = SLoggerFileConfiguration();
228
+ localeLanguage;
229
+ constructor(localeLanguage) {
230
+ this.localeLanguage = localeLanguage;
231
+ }
228
232
  /**
229
233
  *
230
234
  * @param rsaKey
231
235
  * @param keyType
232
- * @param localeLanguage
233
236
  * @protected
234
237
  *
235
238
  * Return ErrorHandler | string
236
239
  */
237
- static verifyExistingKey(rsaKey, keyType, localeLanguage) {
240
+ verifyExistingKey(rsaKey, keyType) {
238
241
  if (!rsaKey) {
239
242
  const stackTrace = this.traceError(
240
- keyType + " " + import_opticore_translator.TranslationLoader.t("rsaKeyNotFound", localeLanguage, this.log),
241
- import_opticore_translator.TranslationLoader.t("erBadDbError", localeLanguage, this.log),
243
+ keyType + " " + import_opticore_translator.TranslationLoader.t("rsaKeyNotFound", this.localeLanguage, this.log),
244
+ import_opticore_translator.TranslationLoader.t("erBadDbError", this.localeLanguage, this.log),
242
245
  import_opticore_http_response.HttpStatusCode.NOT_FOUND
243
246
  );
244
247
  this.log.error(
245
- import_opticore_translator.TranslationLoader.t("rsaKeyNotFound", localeLanguage, this.log),
246
- import_opticore_translator.TranslationLoader.t("verifyExistingKey", localeLanguage, this.log),
247
- import_opticore_translator.TranslationLoader.t("erBadDbError", localeLanguage, this.log),
248
+ import_opticore_translator.TranslationLoader.t("rsaKeyNotFound", this.localeLanguage, this.log),
249
+ import_opticore_translator.TranslationLoader.t("verifyExistingKey", this.localeLanguage, this.log),
250
+ import_opticore_translator.TranslationLoader.t("erBadDbError", this.localeLanguage, this.log),
248
251
  stackTrace.stack,
249
252
  import_opticore_http_response.HttpStatusCode.NOT_FOUND
250
253
  );
@@ -256,26 +259,25 @@ var SAsymmetricCryptionDataWithPrivateRSAKey = class {
256
259
  *
257
260
  * @param privateKey
258
261
  * @param payload
259
- * @param localeLanguage
260
262
  * @private
261
263
  *
262
264
  * Return Buffer
263
265
  */
264
- static encryptionWithPrivateKey(privateKey, payload, localeLanguage) {
265
- this.verifyExistingKey(privateKey, CSignRSAKeyComponent.keyType.private, localeLanguage);
266
+ encryptionWithPrivateKey(privateKey, payload) {
267
+ this.verifyExistingKey(privateKey, CSignRSAKeyComponent.keyType.private);
266
268
  try {
267
269
  const bufferedData = Buffer.from(payload, Number(CSignRSAKeyComponent.encodingFormat));
268
270
  return RSAKeyEncryption.privateEncrypt(privateKey, bufferedData);
269
271
  } catch (err) {
270
272
  const stackTrace = this.traceError(
271
- import_opticore_translator.TranslationLoader.t("encryptionWithPrivateKeyFailed", localeLanguage, this.log),
272
- import_opticore_translator.TranslationLoader.t("encryptionFailed", localeLanguage, this.log),
273
+ import_opticore_translator.TranslationLoader.t("encryptionWithPrivateKeyFailed", this.localeLanguage, this.log),
274
+ import_opticore_translator.TranslationLoader.t("encryptionFailed", this.localeLanguage, this.log),
273
275
  import_opticore_http_response.HttpStatusCode.NOT_FOUND
274
276
  );
275
277
  this.log.error(
276
278
  err.message,
277
- import_opticore_translator.TranslationLoader.t("encryptionFailed", localeLanguage, this.log),
278
- import_opticore_translator.TranslationLoader.t("encryptionWithPrivateKeyFailed", localeLanguage, this.log),
279
+ import_opticore_translator.TranslationLoader.t("encryptionFailed", this.localeLanguage, this.log),
280
+ import_opticore_translator.TranslationLoader.t("encryptionWithPrivateKeyFailed", this.localeLanguage, this.log),
279
281
  stackTrace.stack,
280
282
  import_opticore_http_response.HttpStatusCode.NOT_FOUND
281
283
  );
@@ -287,25 +289,24 @@ var SAsymmetricCryptionDataWithPrivateRSAKey = class {
287
289
  * @param privateKey
288
290
  * @param publicKey
289
291
  * @param payload
290
- * @param localeLanguage
291
292
  * @private
292
293
  */
293
- static decryptionWithPublicKey(privateKey, publicKey, payload, localeLanguage) {
294
- this.verifyExistingKey(publicKey, CSignRSAKeyComponent.keyType.public, localeLanguage);
294
+ decryptionWithPublicKey(privateKey, publicKey, payload) {
295
+ this.verifyExistingKey(publicKey, CSignRSAKeyComponent.keyType.public);
295
296
  try {
296
- const encryptedPayload = this.encryptionWithPrivateKey(privateKey, payload, localeLanguage);
297
+ const encryptedPayload = this.encryptionWithPrivateKey(privateKey, payload);
297
298
  return RSAKeyDecryption.publicDecrypt(publicKey, encryptedPayload);
298
299
  } catch (error) {
299
300
  const stackTrace = this.traceError(
300
- import_opticore_translator.TranslationLoader.t("errorDecryption", localeLanguage, this.log),
301
- import_opticore_translator.TranslationLoader.t("decryptionFailed", localeLanguage, this.log),
301
+ import_opticore_translator.TranslationLoader.t("errorDecryption", this.localeLanguage, this.log),
302
+ import_opticore_translator.TranslationLoader.t("decryptionFailed", this.localeLanguage, this.log),
302
303
  import_opticore_http_response.HttpStatusCode.NOT_ACCEPTABLE
303
304
  );
304
305
  this.log.error(
305
- import_opticore_translator.TranslationLoader.t("decryptionWithPublicKeyFailed", localeLanguage, this.log),
306
- import_opticore_translator.TranslationLoader.t("decryptionFailed", localeLanguage, this.log),
306
+ import_opticore_translator.TranslationLoader.t("decryptionWithPublicKeyFailed", this.localeLanguage, this.log),
307
+ import_opticore_translator.TranslationLoader.t("decryptionFailed", this.localeLanguage, this.log),
307
308
  stackTrace.stack,
308
- import_opticore_translator.TranslationLoader.t("errorDecryption", localeLanguage, this.log),
309
+ import_opticore_translator.TranslationLoader.t("errorDecryption", this.localeLanguage, this.log),
309
310
  import_opticore_http_response.HttpStatusCode.NOT_ACCEPTABLE
310
311
  );
311
312
  throw new Error();
@@ -315,11 +316,10 @@ var SAsymmetricCryptionDataWithPrivateRSAKey = class {
315
316
  *
316
317
  * @param privateKey
317
318
  * @param payload
318
- * @param localeLanguage
319
319
  * @private
320
320
  */
321
- static signWithRSAKey(privateKey, payload, localeLanguage) {
322
- this.verifyExistingKey(privateKey, CSignRSAKeyComponent.keyType.private, localeLanguage);
321
+ signWithRSAKey(privateKey, payload) {
322
+ this.verifyExistingKey(privateKey, CSignRSAKeyComponent.keyType.private);
323
323
  const sign = import_crypto3.default.createSign(CSignRSAKeyComponent.algorithm.sha256);
324
324
  sign.update(payload);
325
325
  return sign.sign(privateKey, CSignRSAKeyComponent.outputFormat.base64);
@@ -329,28 +329,27 @@ var SAsymmetricCryptionDataWithPrivateRSAKey = class {
329
329
  * @param privateKey
330
330
  * @param publicKey
331
331
  * @param payload
332
- * @param localeLanguage
333
332
  */
334
- static verifyRSAKey(privateKey, publicKey, payload, localeLanguage) {
333
+ verifyRSAKey(privateKey, publicKey, payload) {
335
334
  try {
336
335
  const verify = import_crypto3.default.createVerify(CSignRSAKeyComponent.algorithm.sha256);
337
336
  verify.update(payload);
338
- const signature = this.signWithRSAKey(privateKey, payload, localeLanguage);
337
+ const signature = this.signWithRSAKey(privateKey, payload);
339
338
  const isVerified = verify.verify(publicKey, signature, CSignRSAKeyComponent.outputFormat.base64);
340
339
  if (isVerified) {
341
- const decryptedData = this.decryptionWithPublicKey(privateKey, publicKey, payload, localeLanguage);
340
+ const decryptedData = this.decryptionWithPublicKey(privateKey, publicKey, payload);
342
341
  return decryptedData.toString(CSignRSAKeyComponent.encodingFormat.utf_8);
343
342
  } else {
344
343
  const stackTrace = this.traceError(
345
- import_opticore_translator.TranslationLoader.t("signatureRSAKeyFailed", localeLanguage, this.log),
346
- import_opticore_translator.TranslationLoader.t("verifyRSAKeyFailed", localeLanguage, this.log),
344
+ import_opticore_translator.TranslationLoader.t("signatureRSAKeyFailed", this.localeLanguage, this.log),
345
+ import_opticore_translator.TranslationLoader.t("verifyRSAKeyFailed", this.localeLanguage, this.log),
347
346
  import_opticore_http_response.HttpStatusCode.NOT_ACCEPTABLE
348
347
  );
349
348
  this.log.error(
350
- import_opticore_translator.TranslationLoader.t("verifyRSAKey", localeLanguage, this.log),
351
- import_opticore_translator.TranslationLoader.t("verifyRSAKeyFailed", localeLanguage, this.log),
349
+ import_opticore_translator.TranslationLoader.t("verifyRSAKey", this.localeLanguage, this.log),
350
+ import_opticore_translator.TranslationLoader.t("verifyRSAKeyFailed", this.localeLanguage, this.log),
352
351
  stackTrace.stack,
353
- import_opticore_translator.TranslationLoader.t("signatureRSAKeyFailed", localeLanguage, this.log),
352
+ import_opticore_translator.TranslationLoader.t("signatureRSAKeyFailed", this.localeLanguage, this.log),
354
353
  import_opticore_http_response.HttpStatusCode.NOT_FOUND
355
354
  );
356
355
  return new Error();
@@ -358,12 +357,12 @@ var SAsymmetricCryptionDataWithPrivateRSAKey = class {
358
357
  } catch (err) {
359
358
  const stackTrace = this.traceError(
360
359
  err.name,
361
- import_opticore_translator.TranslationLoader.t("signatureRSAKeysError", localeLanguage, this.log),
360
+ import_opticore_translator.TranslationLoader.t("signatureRSAKeysError", this.localeLanguage, this.log),
362
361
  import_opticore_http_response.HttpStatusCode.NOT_ACCEPTABLE
363
362
  );
364
363
  this.log.error(
365
- import_opticore_translator.TranslationLoader.t("signatureRSAKeysError", localeLanguage, this.log),
366
- import_opticore_translator.TranslationLoader.t("errorNameNotVerifyingRSAKey", localeLanguage, this.log),
364
+ import_opticore_translator.TranslationLoader.t("signatureRSAKeysError", this.localeLanguage, this.log),
365
+ import_opticore_translator.TranslationLoader.t("errorNameNotVerifyingRSAKey", this.localeLanguage, this.log),
367
366
  stackTrace.stack,
368
367
  err.message,
369
368
  import_opticore_http_response.HttpStatusCode.NOT_FOUND
@@ -378,7 +377,7 @@ var SAsymmetricCryptionDataWithPrivateRSAKey = class {
378
377
  * @param status
379
378
  * @private
380
379
  */
381
- static traceError(props, name, status7) {
380
+ traceError(props, name, status7) {
382
381
  return new import_opticore_catch_exception_error.StackTraceError(props, name, status7, true);
383
382
  }
384
383
  };
@@ -389,26 +388,30 @@ var import_opticore_translator2 = require("opticore-translator");
389
388
  var import_opticore_http_response2 = require("opticore-http-response");
390
389
  var import_opticore_catch_exception_error2 = require("opticore-catch-exception-error");
391
390
  var SAsymmetricCryptionDataWithPublicRSAKey = class {
392
- static logger = SLoggerFileConfiguration();
391
+ logger = SLoggerFileConfiguration();
392
+ localeLanguage;
393
+ constructor(localeLanguage) {
394
+ this.localeLanguage = localeLanguage;
395
+ }
393
396
  /**
394
397
  *
395
398
  * @param rsaKey
396
399
  * @param keyType
397
- * @param localeLanguage
400
+ *
398
401
  * @protected
399
402
  */
400
- static verifyExistingKey(rsaKey, keyType, localeLanguage) {
403
+ verifyExistingKey(rsaKey, keyType) {
401
404
  if (!rsaKey) {
402
405
  const stackTrace = this.traceError(
403
- keyType + import_opticore_translator2.TranslationLoader.t("verifyExistingKey", localeLanguage, this.logger),
404
- import_opticore_translator2.TranslationLoader.t("verifyExistingKey", localeLanguage, this.logger),
406
+ keyType + import_opticore_translator2.TranslationLoader.t("verifyExistingKey", this.localeLanguage, this.logger),
407
+ import_opticore_translator2.TranslationLoader.t("verifyExistingKey", this.localeLanguage, this.logger),
405
408
  import_opticore_http_response2.HttpStatusCode.NOT_FOUND
406
409
  );
407
410
  this.logger.error(
408
- import_opticore_translator2.TranslationLoader.t("verifyExistingKey", localeLanguage, this.logger),
411
+ import_opticore_translator2.TranslationLoader.t("verifyExistingKey", this.localeLanguage, this.logger),
409
412
  "key verification",
410
413
  stackTrace.stack,
411
- import_opticore_translator2.TranslationLoader.t("verifyExistingKeyError", localeLanguage, this.logger),
414
+ import_opticore_translator2.TranslationLoader.t("verifyExistingKeyError", this.localeLanguage, this.logger),
412
415
  import_opticore_http_response2.HttpStatusCode.NOT_FOUND
413
416
  );
414
417
  return new Error();
@@ -419,23 +422,23 @@ var SAsymmetricCryptionDataWithPublicRSAKey = class {
419
422
  *
420
423
  * @param publicKey
421
424
  * @param payload
422
- * @param localeLanguage
425
+ *
423
426
  * @private
424
427
  */
425
- static encryptionWithPublicKey(publicKey, payload, localeLanguage) {
426
- this.verifyExistingKey(publicKey, CSignRSAKeyComponent.keyType.public, localeLanguage);
428
+ encryptionWithPublicKey(publicKey, payload) {
429
+ this.verifyExistingKey(publicKey, CSignRSAKeyComponent.keyType.public);
427
430
  try {
428
431
  const bufferedData = Buffer.from(payload, Number(CSignRSAKeyComponent.encodingFormat));
429
432
  return RSAKeyEncryption.publicEncrypt(publicKey, bufferedData);
430
433
  } catch (err) {
431
434
  const stackTrace = this.traceError(
432
435
  err.message,
433
- import_opticore_translator2.TranslationLoader.t("encryptionWithPublicKey", localeLanguage, this.logger),
436
+ import_opticore_translator2.TranslationLoader.t("encryptionWithPublicKey", this.localeLanguage, this.logger),
434
437
  import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
435
438
  );
436
439
  this.logger.error(
437
- import_opticore_translator2.TranslationLoader.t("errorEncryptionPublicKey", localeLanguage, this.logger),
438
- import_opticore_translator2.TranslationLoader.t("encryptionWithPublicKey", localeLanguage, this.logger),
440
+ import_opticore_translator2.TranslationLoader.t("errorEncryptionPublicKey", this.localeLanguage, this.logger),
441
+ import_opticore_translator2.TranslationLoader.t("encryptionWithPublicKey", this.localeLanguage, this.logger),
439
442
  stackTrace.stack,
440
443
  err.message,
441
444
  import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
@@ -448,23 +451,23 @@ var SAsymmetricCryptionDataWithPublicRSAKey = class {
448
451
  * @param privateKey
449
452
  * @param publicKey
450
453
  * @param payload
451
- * @param localeLanguage
454
+ *
452
455
  * @private
453
456
  */
454
- static decryptionWithPrivateKey(privateKey, publicKey, payload, localeLanguage) {
455
- this.verifyExistingKey(publicKey, CSignRSAKeyComponent.keyType.public, localeLanguage);
457
+ decryptionWithPrivateKey(privateKey, publicKey, payload) {
458
+ this.verifyExistingKey(publicKey, CSignRSAKeyComponent.keyType.public);
456
459
  try {
457
- const encryptedPayload = this.encryptionWithPublicKey(publicKey, payload, localeLanguage);
460
+ const encryptedPayload = this.encryptionWithPublicKey(publicKey, payload);
458
461
  return RSAKeyDecryption.privateDecrypt(privateKey, encryptedPayload);
459
462
  } catch (err) {
460
463
  const stackTrace = this.traceError(
461
464
  err.code,
462
- import_opticore_translator2.TranslationLoader.t("errorDecryption", localeLanguage, this.logger),
465
+ import_opticore_translator2.TranslationLoader.t("errorDecryption", this.localeLanguage, this.logger),
463
466
  import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
464
467
  );
465
468
  this.logger.error(
466
- import_opticore_translator2.TranslationLoader.t("errorDecryptionWithPrivateKey", localeLanguage, this.logger),
467
- import_opticore_translator2.TranslationLoader.t("errorDecryption", localeLanguage, this.logger),
469
+ import_opticore_translator2.TranslationLoader.t("errorDecryptionWithPrivateKey", this.localeLanguage, this.logger),
470
+ import_opticore_translator2.TranslationLoader.t("errorDecryption", this.localeLanguage, this.logger),
468
471
  stackTrace.stack,
469
472
  err.message,
470
473
  import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
@@ -476,11 +479,11 @@ var SAsymmetricCryptionDataWithPublicRSAKey = class {
476
479
  *
477
480
  * @param publicKey
478
481
  * @param payload
479
- * @param localeLanguage
482
+ *
480
483
  * @private
481
484
  */
482
- static signWithPublicRSAKey(publicKey, payload, localeLanguage) {
483
- this.verifyExistingKey(publicKey, CSignRSAKeyComponent.keyType.private, localeLanguage);
485
+ signWithPublicRSAKey(publicKey, payload) {
486
+ this.verifyExistingKey(publicKey, CSignRSAKeyComponent.keyType.private);
484
487
  const sign = import_crypto4.default.createSign(CSignRSAKeyComponent.algorithm.sha256);
485
488
  sign.update(payload);
486
489
  return sign.sign(publicKey, CSignRSAKeyComponent.outputFormat.base64);
@@ -490,28 +493,28 @@ var SAsymmetricCryptionDataWithPublicRSAKey = class {
490
493
  * @param privateKey
491
494
  * @param publicKey
492
495
  * @param payload
493
- * @param localeLanguage
496
+ *
494
497
  */
495
- static verifyPublicRSAKey(privateKey, publicKey, payload, localeLanguage) {
498
+ verifyPublicRSAKey(privateKey, publicKey, payload) {
496
499
  try {
497
500
  const verify = import_crypto4.default.createVerify(CSignRSAKeyComponent.algorithm.sha256);
498
501
  verify.update(payload);
499
- const signature = this.signWithPublicRSAKey(publicKey, payload, localeLanguage);
502
+ const signature = this.signWithPublicRSAKey(publicKey, payload);
500
503
  const isVerified = verify.verify(publicKey, signature, CSignRSAKeyComponent.outputFormat.base64);
501
504
  if (isVerified) {
502
- const decryptedData = this.decryptionWithPrivateKey(privateKey, publicKey, payload, localeLanguage);
505
+ const decryptedData = this.decryptionWithPrivateKey(privateKey, publicKey, payload);
503
506
  return decryptedData.toString(CSignRSAKeyComponent.encodingFormat.utf_8);
504
507
  } else {
505
508
  const stackTrace = this.traceError(
506
- import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKeyError", localeLanguage, this.logger),
507
- import_opticore_translator2.TranslationLoader.t("signatureRSAKeyFailed", localeLanguage, this.logger),
509
+ import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKeyError", this.localeLanguage, this.logger),
510
+ import_opticore_translator2.TranslationLoader.t("signatureRSAKeyFailed", this.localeLanguage, this.logger),
508
511
  import_opticore_http_response2.HttpStatusCode.NOT_FOUND
509
512
  );
510
513
  this.logger.error(
511
- import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKey", localeLanguage, this.logger),
512
- import_opticore_translator2.TranslationLoader.t("signatureRSAKeyFailed", localeLanguage, this.logger),
514
+ import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKey", this.localeLanguage, this.logger),
515
+ import_opticore_translator2.TranslationLoader.t("signatureRSAKeyFailed", this.localeLanguage, this.logger),
513
516
  stackTrace.stack,
514
- import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKeyError", localeLanguage, this.logger),
517
+ import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKeyError", this.localeLanguage, this.logger),
515
518
  import_opticore_http_response2.HttpStatusCode.NOT_FOUND
516
519
  );
517
520
  return stackTrace;
@@ -519,12 +522,12 @@ var SAsymmetricCryptionDataWithPublicRSAKey = class {
519
522
  } catch (err) {
520
523
  const stackTrace = this.traceError(
521
524
  err.code,
522
- import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKey", localeLanguage, this.logger),
525
+ import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKey", this.localeLanguage, this.logger),
523
526
  import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
524
527
  );
525
528
  this.logger.error(
526
- import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKey", localeLanguage, this.logger),
527
- import_opticore_translator2.TranslationLoader.t("errorDecryption", localeLanguage, this.logger),
529
+ import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKey", this.localeLanguage, this.logger),
530
+ import_opticore_translator2.TranslationLoader.t("errorDecryption", this.localeLanguage, this.logger),
528
531
  stackTrace.stack,
529
532
  err.message,
530
533
  import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
@@ -532,7 +535,7 @@ var SAsymmetricCryptionDataWithPublicRSAKey = class {
532
535
  throw new Error();
533
536
  }
534
537
  }
535
- static traceError(props, name, status7) {
538
+ traceError(props, name, status7) {
536
539
  return new import_opticore_catch_exception_error2.StackTraceError(props, name, status7, true);
537
540
  }
538
541
  };
@@ -711,22 +714,21 @@ var translateWebAppCoreLanguageLoader = () => {
711
714
 
712
715
  // src/utils/parsing/parsingYaml.utils.ts
713
716
  var YamlParsing = class {
714
- static logger = new import_opticore_logger3.LoggerCore(loggerConfig);
715
- static localeLanguage;
716
- static __init(localeLanguage) {
717
- translateWebAppCoreLanguageLoader();
717
+ logger = new import_opticore_logger3.LoggerCore(loggerConfig);
718
+ localeLanguage;
719
+ constructor(localeLanguage) {
718
720
  this.localeLanguage = localeLanguage;
719
- return this;
721
+ translateWebAppCoreLanguageLoader();
720
722
  }
721
- static async readFile(filePath, localeLanguage) {
723
+ async readFile(filePath) {
722
724
  try {
723
725
  const yamlContent = await (0, import_promises.readFile)(filePath, "utf-8");
724
- await this.parsing(yamlContent, localeLanguage);
726
+ await this.parsing(yamlContent);
725
727
  } catch (error) {
726
728
  this.logger.error(
727
729
  error.message,
728
- import_opticore_translator7.TranslationLoader.t("parsingFailed", localeLanguage, this.logger),
729
- import_opticore_translator7.TranslationLoader.t("readingError", localeLanguage, this.logger),
730
+ import_opticore_translator7.TranslationLoader.t("parsingFailed", this.localeLanguage, this.logger),
731
+ import_opticore_translator7.TranslationLoader.t("readingError", this.localeLanguage, this.logger),
730
732
  error.stack,
731
733
  import_opticore_http_response5.HttpStatusCode.NOT_ACCEPTABLE
732
734
  );
@@ -735,10 +737,9 @@ var YamlParsing = class {
735
737
  /**
736
738
  *
737
739
  * @param content
738
- * @param localeLanguage
739
740
  * @private
740
741
  */
741
- static async parsing(content, localeLanguage) {
742
+ async parsing(content) {
742
743
  const result = {};
743
744
  const lines = content.split("\n");
744
745
  let currentKey = null;
@@ -758,9 +759,9 @@ var YamlParsing = class {
758
759
  }
759
760
  } else {
760
761
  this.logger.error(
761
- import_opticore_translator7.TranslationLoader.t("badFormat", localeLanguage, { line }),
762
- import_opticore_translator7.TranslationLoader.t("parsingFailed", localeLanguage, this.logger),
763
- import_opticore_translator7.TranslationLoader.t("unsupportedFormat", localeLanguage, this.logger),
762
+ import_opticore_translator7.TranslationLoader.t("badFormat", this.localeLanguage, { line }),
763
+ import_opticore_translator7.TranslationLoader.t("parsingFailed", this.localeLanguage, this.logger),
764
+ import_opticore_translator7.TranslationLoader.t("unsupportedFormat", this.localeLanguage, this.logger),
764
765
  content,
765
766
  import_opticore_http_response5.HttpStatusCode.NOT_ACCEPTABLE
766
767
  );
@@ -797,81 +798,81 @@ var import_opticore_logger4 = require("opticore-logger");
797
798
  var import_opticore_catch_exception_error3 = require("opticore-catch-exception-error");
798
799
  var import_opticore_translator8 = require("opticore-translator");
799
800
  var DbConnexionConfigError = class {
800
- static logger = new import_opticore_logger4.LoggerCore(loggerConfig);
801
+ logger = new import_opticore_logger4.LoggerCore(loggerConfig);
802
+ localeLanguage;
803
+ constructor(localeLanguage) {
804
+ this.localeLanguage = localeLanguage;
805
+ }
801
806
  /**
802
807
  *
803
- * @param localLanguage
804
808
  * @param e
805
809
  */
806
- static mongoDBAuthenticationFailed(localLanguage, e) {
810
+ mongoDBAuthenticationFailed(e) {
807
811
  const stackTrace = this.traceError(
808
- import_opticore_translator8.TranslationLoader.t("mongoDBConnection", localLanguage, { e }),
809
- import_opticore_translator8.TranslationLoader.t("mongoDBAuthentication", localLanguage),
812
+ import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { e }),
813
+ import_opticore_translator8.TranslationLoader.t("mongoDBAuthentication", this.localeLanguage),
810
814
  import_opticore_http_response6.HttpStatusCode.UNAUTHORIZED
811
815
  );
812
816
  this.logger.error(
813
- import_opticore_translator8.TranslationLoader.t("mongoDBAuthenticationError", localLanguage),
814
- import_opticore_translator8.TranslationLoader.t("mongoDBConnection", localLanguage),
815
- import_opticore_translator8.TranslationLoader.t("mongoDBAuthenticationFailed", localLanguage),
817
+ import_opticore_translator8.TranslationLoader.t("mongoDBAuthenticationError", this.localeLanguage),
818
+ import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
819
+ import_opticore_translator8.TranslationLoader.t("mongoDBAuthenticationFailed", this.localeLanguage),
816
820
  stackTrace.stack,
817
821
  import_opticore_http_response6.HttpStatusCode.UNAUTHORIZED
818
822
  );
819
823
  }
820
824
  /**
821
825
  *
822
- * @param localLanguage
823
826
  * @param err
824
827
  * @param dbHost
825
828
  * @param dbPort
826
829
  */
827
- static mongoDBInvalidUrl(localLanguage, err, dbHost, dbPort) {
830
+ mongoDBInvalidUrl(err, dbHost, dbPort) {
828
831
  const stackTrace = this.traceError(
829
- import_opticore_translator8.TranslationLoader.t("mongoDBConnection", localLanguage, { err }),
830
- import_opticore_translator8.TranslationLoader.t("mongoDBUnableParsingUrl", localLanguage),
832
+ import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { err }),
833
+ import_opticore_translator8.TranslationLoader.t("mongoDBUnableParsingUrl", this.localeLanguage),
831
834
  import_opticore_http_response6.HttpStatusCode.BAD_REQUEST
832
835
  );
833
836
  this.logger.error(
834
- import_opticore_translator8.TranslationLoader.t("dbUrlParsingError", localLanguage, { dbHost, dbPort }),
835
- import_opticore_translator8.TranslationLoader.t("mongoDBConnection", localLanguage),
836
- import_opticore_translator8.TranslationLoader.t("mongoDBUnableParsingUrl", localLanguage),
837
+ import_opticore_translator8.TranslationLoader.t("dbUrlParsingError", this.localeLanguage, { dbHost, dbPort }),
838
+ import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
839
+ import_opticore_translator8.TranslationLoader.t("mongoDBUnableParsingUrl", this.localeLanguage),
837
840
  stackTrace.stack,
838
841
  import_opticore_http_response6.HttpStatusCode.BAD_REQUEST
839
842
  );
840
843
  }
841
844
  /**
842
845
  *
843
- * @param localLanguage
844
846
  * @param err
845
847
  * @param dbHost
846
848
  */
847
- static mongoDBEaiAgain(localLanguage, err, dbHost) {
849
+ mongoDBEaiAgain(err, dbHost) {
848
850
  const stackTrace = this.traceError(
849
- import_opticore_translator8.TranslationLoader.t("mongoDBConnection", localLanguage, { err }),
850
- import_opticore_translator8.TranslationLoader.t("mongoDBServerSelection", localLanguage),
851
+ import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { err }),
852
+ import_opticore_translator8.TranslationLoader.t("mongoDBServerSelection", this.localeLanguage),
851
853
  import_opticore_http_response6.HttpStatusCode.BAD_REQUEST
852
854
  );
853
855
  this.logger.error(
854
- import_opticore_translator8.TranslationLoader.t("mongoServerError", localLanguage, { dbHost }),
855
- import_opticore_translator8.TranslationLoader.t("mongoDBConnection", localLanguage),
856
- import_opticore_translator8.TranslationLoader.t("mongoDBServerSelection", localLanguage),
856
+ import_opticore_translator8.TranslationLoader.t("mongoServerError", this.localeLanguage, { dbHost }),
857
+ import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
858
+ import_opticore_translator8.TranslationLoader.t("mongoDBServerSelection", this.localeLanguage),
857
859
  stackTrace.stack,
858
860
  import_opticore_http_response6.HttpStatusCode.BAD_REQUEST
859
861
  );
860
862
  }
861
863
  /**
862
864
  *
863
- * @param localLanguage
864
865
  * @param err
865
866
  */
866
- static mongoDbGlobalError(localLanguage, err) {
867
+ mongoDbGlobalError(err) {
867
868
  const stackTrace = this.traceError(
868
- import_opticore_translator8.TranslationLoader.t("mongoDBConnection", localLanguage, { err }),
869
- import_opticore_translator8.TranslationLoader.t("mongoDBConnection", localLanguage),
869
+ import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { err }),
870
+ import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
870
871
  import_opticore_http_response6.HttpStatusCode.NOT_ACCEPTABLE
871
872
  );
872
873
  this.logger.error(
873
- import_opticore_translator8.TranslationLoader.t("mongoDBConnection", localLanguage),
874
- import_opticore_translator8.TranslationLoader.t("mongoDBConnectionError", localLanguage),
874
+ import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
875
+ import_opticore_translator8.TranslationLoader.t("mongoDBConnectionError", this.localeLanguage),
875
876
  stackTrace.stack,
876
877
  err.message,
877
878
  import_opticore_http_response6.HttpStatusCode.NOT_ACCEPTABLE
@@ -884,7 +885,7 @@ var DbConnexionConfigError = class {
884
885
  * @param status
885
886
  * @private
886
887
  */
887
- static traceError(props, name, status7) {
888
+ traceError(props, name, status7) {
888
889
  return new import_opticore_catch_exception_error3.StackTraceError(props, name, status7, true);
889
890
  }
890
891
  };
@@ -894,10 +895,15 @@ var import_opticore_catch_exception_error4 = require("opticore-catch-exception-e
894
895
  var DatabaseConnectionConfig = class {
895
896
  env = new Environment(import_opticore_env_access3.getEnvVariable);
896
897
  logger = new import_opticore_logger5.LoggerCore(loggerConfig);
898
+ localeLanguage;
899
+ DbConnexionConfigError;
900
+ constructor(localeLanguage) {
901
+ this.localeLanguage = localeLanguage;
902
+ this.DbConnexionConfigError = new DbConnexionConfigError(localeLanguage);
903
+ }
897
904
  /**
898
905
  *
899
906
  * @param optionalArgumentConnection
900
- * @param localeLanguage
901
907
  *
902
908
  * MySQL database connection with an optional arguments
903
909
  * Establish the connection between app and Database Management System.
@@ -905,46 +911,44 @@ var DatabaseConnectionConfig = class {
905
911
  * and it's show off in the log that the connection has been created successfully.
906
912
  * But if any error is occurring during trying connection, it'd specify that error by stack traces.
907
913
  */
908
- databaseMySQLConnexionChecker(optionalArgumentConnection, localeLanguage) {
914
+ databaseMySQLConnexionChecker(optionalArgumentConnection) {
909
915
  const dbURL = `${this.env.get("dataBaseUser")}:${this.env.get("dataBasePassword")}@${this.env.get("dataBaseHost")}:${this.env.get("dataBasePort")}/${this.env.get("dataBaseName")}`;
910
916
  let url = `mysql://${dbURL}?${optionalArgumentConnection}`;
911
917
  const dbConnection = import_mysql.default.createConnection(url);
912
- return SCheckerMySqlDatabaseConnection(localeLanguage, dbConnection, this.env.get("dataBaseUser"), this.env.get("dataBaseName"), this.env.get("dataBaseHost"), this.env.get("dataBasePassword"));
918
+ return SCheckerMySqlDatabaseConnection(this.localeLanguage, dbConnection, this.env.get("dataBaseUser"), this.env.get("dataBaseName"), this.env.get("dataBaseHost"), this.env.get("dataBasePassword"));
913
919
  }
914
920
  /**
915
921
  *
916
922
  * @param optionalArgumentConnection
917
- * @param localeLanguage
918
923
  *
919
924
  * Mongo database connection with optional connection arguments
920
925
  */
921
- async databaseMongoDBConnectionChecker(optionalArgumentConnection, localeLanguage) {
926
+ async databaseMongoDBConnectionChecker(optionalArgumentConnection) {
922
927
  const dbUrl = `${this.env.get("dataBaseUser")}:${this.env.get("dataBasePassword")}@${this.env.get("dataBaseHost")}:${this.env.get("dataBasePort")}/${this.env.get("dataBaseName")}`;
923
928
  const url = `mongodb://${dbUrl}${optionalArgumentConnection}`;
924
929
  try {
925
930
  await SCheckerMongoDatabaseConnection(url, this.env.get("dataBaseUser"), this.env.get("dataBasePassword"), this.env.get("dataBaseName"));
926
931
  this.logger.success(
927
- import_opticore_translator9.TranslationLoader.t("mongoDBConnectionChecker", localeLanguage, loggerConfig),
928
- import_opticore_translator9.TranslationLoader.t("mongoConnectionSuccess", localeLanguage, loggerConfig)
932
+ import_opticore_translator9.TranslationLoader.t("mongoDBConnectionChecker", this.localeLanguage, loggerConfig),
933
+ import_opticore_translator9.TranslationLoader.t("mongoConnectionSuccess", this.localeLanguage, loggerConfig)
929
934
  );
930
935
  console.log("");
931
936
  } catch (e) {
932
937
  if (e.code === 18) {
933
- DbConnexionConfigError.mongoDBAuthenticationFailed(e);
938
+ this.DbConnexionConfigError.mongoDBAuthenticationFailed(e);
934
939
  }
935
940
  if (e.cause.code === "ERR_INVALID_URL") {
936
- DbConnexionConfigError.mongoDBInvalidUrl(e, this.env.get("dataBaseHost"), this.env.get("dataBasePort"));
941
+ this.DbConnexionConfigError.mongoDBInvalidUrl(e, this.env.get("dataBaseHost"), this.env.get("dataBasePort"));
937
942
  }
938
943
  if (e.code === void 0) {
939
- DbConnexionConfigError.mongoDBEaiAgain(e, this.env.get("dataBaseHost"));
944
+ this.DbConnexionConfigError.mongoDBEaiAgain(e, this.env.get("dataBaseHost"));
940
945
  } else {
941
- DbConnexionConfigError.mongoDbGlobalError(e);
946
+ this.DbConnexionConfigError.mongoDbGlobalError(e);
942
947
  }
943
948
  }
944
949
  }
945
950
  /**
946
951
  *
947
- * @param localeLanguage
948
952
  * @param keepAlive
949
953
  * @param stream
950
954
  * @param statement_timeout
@@ -959,11 +963,11 @@ var DatabaseConnectionConfig = class {
959
963
  *
960
964
  * Postgres database connection with optional connection arguments
961
965
  */
962
- async databasePostgresDBConnectionChecker(localeLanguage, keepAlive, stream, statement_timeout, ssl, query_timeout, keepAliveInitialDelayMillis, idle_in_transaction_session_timeout, application_name, connectionTimeoutMillis, types, options) {
966
+ async databasePostgresDBConnectionChecker(keepAlive, stream, statement_timeout, ssl, query_timeout, keepAliveInitialDelayMillis, idle_in_transaction_session_timeout, application_name, connectionTimeoutMillis, types, options) {
963
967
  const url = `postgresql:/${this.env.get("dataBaseUser")}:${this.env.get("dataBasePassword")}@${this.env.get("dataBaseHost")}:${this.env.get("dataBasePort")}/${this.env.get("dataBaseName")}`;
964
968
  try {
965
969
  await SCheckerPostgresDatabaseConnection(
966
- localeLanguage,
970
+ this.localeLanguage,
967
971
  url,
968
972
  keepAlive,
969
973
  stream,
@@ -978,13 +982,13 @@ var DatabaseConnectionConfig = class {
978
982
  options
979
983
  );
980
984
  this.logger.success(
981
- import_opticore_translator9.TranslationLoader.t("postgresDBConnectionChecker", localeLanguage, loggerConfig),
982
- import_opticore_translator9.TranslationLoader.t("postgresConnectionSuccess", localeLanguage, loggerConfig)
985
+ import_opticore_translator9.TranslationLoader.t("postgresDBConnectionChecker", this.localeLanguage, loggerConfig),
986
+ import_opticore_translator9.TranslationLoader.t("postgresConnectionSuccess", this.localeLanguage, loggerConfig)
983
987
  );
984
988
  console.log("");
985
989
  } catch (err) {
986
990
  const stackTrace = this.traceError(
987
- import_opticore_translator9.TranslationLoader.t(`${err.message}`, localeLanguage, loggerConfig),
991
+ import_opticore_translator9.TranslationLoader.t(`${err.message}`, this.localeLanguage, loggerConfig),
988
992
  "PostgresConnectionError",
989
993
  import_opticore_http_response7.HttpStatusCode.NOT_ACCEPTABLE
990
994
  );
@@ -1004,21 +1008,20 @@ var DatabaseConnectionConfig = class {
1004
1008
 
1005
1009
  // src/core/config/database/middleware/mongoChecker.database.ts
1006
1010
  var MMongoCheckerDatabase = (optionalArgumentConnection, localLanguage) => {
1007
- const DbConnexion = new DatabaseConnectionConfig();
1008
- return DbConnexion.databaseMongoDBConnectionChecker(optionalArgumentConnection, localLanguage);
1011
+ const DbConnexion = new DatabaseConnectionConfig(localLanguage);
1012
+ return DbConnexion.databaseMongoDBConnectionChecker(optionalArgumentConnection);
1009
1013
  };
1010
1014
 
1011
1015
  // src/core/config/database/middleware/mySqlChecker.database.ts
1012
1016
  var MMySqlCheckerDatabase = (optionalArgumentConnection, localLanguage) => {
1013
- const DbConnexion = new DatabaseConnectionConfig();
1014
- return DbConnexion.databaseMySQLConnexionChecker(optionalArgumentConnection, localLanguage);
1017
+ const DbConnexion = new DatabaseConnectionConfig(localLanguage);
1018
+ return DbConnexion.databaseMySQLConnexionChecker(optionalArgumentConnection);
1015
1019
  };
1016
1020
 
1017
1021
  // src/core/config/database/middleware/postgresChecker.database.ts
1018
1022
  var MPostgresCheckerDatabase = (localLanguage, keepAlive, stream, statement_timeout, ssl, query_timeout, keepAliveInitialDelayMillis, idle_in_transaction_session_timeout, application_name, connectionTimeoutMillis, types, options) => {
1019
- const DbConnexion = new DatabaseConnectionConfig();
1023
+ const DbConnexion = new DatabaseConnectionConfig(localLanguage);
1020
1024
  return DbConnexion.databasePostgresDBConnectionChecker(
1021
- localLanguage,
1022
1025
  keepAlive,
1023
1026
  stream,
1024
1027
  statement_timeout,
@@ -1173,14 +1176,17 @@ var import_opticore_logger6 = require("opticore-logger");
1173
1176
  var import_opticore_http_response8 = require("opticore-http-response");
1174
1177
  var import_opticore_translator11 = require("opticore-translator");
1175
1178
  var PathModuleVerifier = class {
1176
- static log = new import_opticore_logger6.LoggerCore(loggerConfig);
1179
+ log = new import_opticore_logger6.LoggerCore(loggerConfig);
1180
+ localeLanguage;
1181
+ constructor(localeLanguage) {
1182
+ this.localeLanguage = localeLanguage;
1183
+ }
1177
1184
  /**
1178
1185
  * Verifies if modules at specific paths are loaded.
1179
1186
  * If any module is not loaded, it throws an error.
1180
- * @param localLanguage
1181
1187
  * @param modulePaths - An array of paths to the modules to verify.
1182
1188
  */
1183
- static verifyModulePaths(localLanguage, modulePaths) {
1189
+ verifyModulePaths(modulePaths) {
1184
1190
  const notLoadedPaths = [];
1185
1191
  for (const modulePath of modulePaths) {
1186
1192
  if (!this.isModulePathLoaded(modulePath)) {
@@ -1189,7 +1195,7 @@ var PathModuleVerifier = class {
1189
1195
  }
1190
1196
  if (notLoadedPaths.length > 0) {
1191
1197
  this.log.error(
1192
- import_opticore_translator11.TranslationLoader.t("moduleNotLoaded", localLanguage, { notLoadedPaths: notLoadedPaths.join(", ") }),
1198
+ import_opticore_translator11.TranslationLoader.t("moduleNotLoaded", this.localeLanguage, { notLoadedPaths: notLoadedPaths.join(", ") }),
1193
1199
  "",
1194
1200
  "",
1195
1201
  modulePaths,
@@ -1203,7 +1209,7 @@ var PathModuleVerifier = class {
1203
1209
  * @param modulePath - The path to the module.
1204
1210
  * @returns True if the module is loaded, false otherwise.
1205
1211
  */
1206
- static isModulePathLoaded(modulePath) {
1212
+ isModulePathLoaded(modulePath) {
1207
1213
  try {
1208
1214
  const resolvedPath = (0, import_path3.resolve)(modulePath);
1209
1215
  return require.cache[resolvedPath] !== void 0;