opticore-webapp-core 1.0.18 → 1.0.19
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 +147 -559
- package/dist/index.d.cts +3 -61
- package/dist/index.d.ts +3 -61
- package/dist/index.js +153 -558
- package/package.json +9 -9
- package/dist/utils/translations/message.translation.en.json +0 -130
- package/dist/utils/translations/message.translation.fr.json +0 -49
package/dist/index.cjs
CHANGED
|
@@ -34,18 +34,11 @@ __export(index_exports, {
|
|
|
34
34
|
CSignRSAKeyComponent: () => CSignRSAKeyComponent,
|
|
35
35
|
Environment: () => Environment,
|
|
36
36
|
LocalLanguageLoader: () => LocalLanguageLoader,
|
|
37
|
-
MMongoCheckerDatabase: () => MMongoCheckerDatabase,
|
|
38
|
-
MMySqlCheckerDatabase: () => MMySqlCheckerDatabase,
|
|
39
|
-
MPostgresCheckerDatabase: () => MPostgresCheckerDatabase,
|
|
40
37
|
PathModuleVerifier: () => PathModuleVerifier,
|
|
41
38
|
RSAKeyDecryption: () => RSAKeyDecryption,
|
|
42
39
|
RSAKeyEncryption: () => RSAKeyEncryption,
|
|
43
40
|
SAsymmetricCryptionDataWithPrivateRSAKey: () => SAsymmetricCryptionDataWithPrivateRSAKey,
|
|
44
41
|
SAsymmetricCryptionDataWithPublicRSAKey: () => SAsymmetricCryptionDataWithPublicRSAKey,
|
|
45
|
-
SCheckerMongoDatabaseConnection: () => SCheckerMongoDatabaseConnection,
|
|
46
|
-
SCheckerMySqlDatabaseConnection: () => SCheckerMySqlDatabaseConnection,
|
|
47
|
-
SCheckerPostgresDatabaseConnection: () => SCheckerPostgresDatabaseConnection,
|
|
48
|
-
UOptionalArgumentConnection: () => UOptionalArgumentConnection,
|
|
49
42
|
Utility: () => Utility,
|
|
50
43
|
YamlParsing: () => YamlParsing,
|
|
51
44
|
dateTimeFormatted: () => dateTimeFormatted,
|
|
@@ -249,14 +242,13 @@ var SAsymmetricCryptionDataWithPrivateRSAKey = class {
|
|
|
249
242
|
import_opticore_translator.TranslationLoader.t("erBadDbError", this.localeLanguage, this.log),
|
|
250
243
|
import_opticore_http_response.HttpStatusCode.NOT_FOUND
|
|
251
244
|
);
|
|
252
|
-
this.log.error(
|
|
253
|
-
import_opticore_translator.TranslationLoader.t("rsaKeyNotFound", this.localeLanguage, this.log),
|
|
254
|
-
import_opticore_translator.TranslationLoader.t("verifyExistingKey", this.localeLanguage, this.log),
|
|
255
|
-
import_opticore_translator.TranslationLoader.t("erBadDbError", this.localeLanguage, this.log),
|
|
256
|
-
stackTrace.stack,
|
|
257
|
-
import_opticore_http_response.HttpStatusCode.NOT_FOUND
|
|
258
|
-
);
|
|
259
|
-
throw new Error();
|
|
245
|
+
this.log.error({
|
|
246
|
+
message: import_opticore_translator.TranslationLoader.t("rsaKeyNotFound", this.localeLanguage, this.log),
|
|
247
|
+
title: import_opticore_translator.TranslationLoader.t("verifyExistingKey", this.localeLanguage, this.log),
|
|
248
|
+
errorType: import_opticore_translator.TranslationLoader.t("erBadDbError", this.localeLanguage, this.log),
|
|
249
|
+
stackTrace: stackTrace.stack,
|
|
250
|
+
httpCodeValue: import_opticore_http_response.HttpStatusCode.NOT_FOUND
|
|
251
|
+
});
|
|
260
252
|
}
|
|
261
253
|
return rsaKey;
|
|
262
254
|
}
|
|
@@ -279,14 +271,14 @@ var SAsymmetricCryptionDataWithPrivateRSAKey = class {
|
|
|
279
271
|
import_opticore_translator.TranslationLoader.t("encryptionFailed", this.localeLanguage, this.log),
|
|
280
272
|
import_opticore_http_response.HttpStatusCode.NOT_FOUND
|
|
281
273
|
);
|
|
282
|
-
this.log.error(
|
|
283
|
-
err.message,
|
|
284
|
-
import_opticore_translator.TranslationLoader.t("encryptionFailed", this.localeLanguage, this.log),
|
|
285
|
-
import_opticore_translator.TranslationLoader.t("encryptionWithPrivateKeyFailed", this.localeLanguage, this.log),
|
|
286
|
-
stackTrace.stack,
|
|
287
|
-
import_opticore_http_response.HttpStatusCode.NOT_FOUND
|
|
288
|
-
);
|
|
289
|
-
|
|
274
|
+
this.log.error({
|
|
275
|
+
message: err.message,
|
|
276
|
+
title: import_opticore_translator.TranslationLoader.t("encryptionFailed", this.localeLanguage, this.log),
|
|
277
|
+
errorType: import_opticore_translator.TranslationLoader.t("encryptionWithPrivateKeyFailed", this.localeLanguage, this.log),
|
|
278
|
+
stackTrace: stackTrace.stack,
|
|
279
|
+
httpCodeValue: import_opticore_http_response.HttpStatusCode.NOT_FOUND
|
|
280
|
+
});
|
|
281
|
+
process.exit();
|
|
290
282
|
}
|
|
291
283
|
}
|
|
292
284
|
/**
|
|
@@ -307,14 +299,14 @@ var SAsymmetricCryptionDataWithPrivateRSAKey = class {
|
|
|
307
299
|
import_opticore_translator.TranslationLoader.t("decryptionFailed", this.localeLanguage, this.log),
|
|
308
300
|
import_opticore_http_response.HttpStatusCode.NOT_ACCEPTABLE
|
|
309
301
|
);
|
|
310
|
-
this.log.error(
|
|
311
|
-
import_opticore_translator.TranslationLoader.t("decryptionWithPublicKeyFailed", this.localeLanguage, this.log),
|
|
312
|
-
import_opticore_translator.TranslationLoader.t("decryptionFailed", this.localeLanguage, this.log),
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
import_opticore_http_response.HttpStatusCode.NOT_ACCEPTABLE
|
|
316
|
-
);
|
|
317
|
-
|
|
302
|
+
this.log.error({
|
|
303
|
+
message: import_opticore_translator.TranslationLoader.t("decryptionWithPublicKeyFailed", this.localeLanguage, this.log),
|
|
304
|
+
title: import_opticore_translator.TranslationLoader.t("decryptionFailed", this.localeLanguage, this.log),
|
|
305
|
+
errorType: import_opticore_translator.TranslationLoader.t("errorDecryption", this.localeLanguage, this.log),
|
|
306
|
+
stackTrace: stackTrace.stack,
|
|
307
|
+
httpCodeValue: import_opticore_http_response.HttpStatusCode.NOT_ACCEPTABLE
|
|
308
|
+
});
|
|
309
|
+
process.exit();
|
|
318
310
|
}
|
|
319
311
|
}
|
|
320
312
|
/**
|
|
@@ -350,14 +342,14 @@ var SAsymmetricCryptionDataWithPrivateRSAKey = class {
|
|
|
350
342
|
import_opticore_translator.TranslationLoader.t("verifyRSAKeyFailed", this.localeLanguage, this.log),
|
|
351
343
|
import_opticore_http_response.HttpStatusCode.NOT_ACCEPTABLE
|
|
352
344
|
);
|
|
353
|
-
this.log.error(
|
|
354
|
-
import_opticore_translator.TranslationLoader.t("verifyRSAKey", this.localeLanguage, this.log),
|
|
355
|
-
import_opticore_translator.TranslationLoader.t("verifyRSAKeyFailed", this.localeLanguage, this.log),
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
import_opticore_http_response.HttpStatusCode.NOT_FOUND
|
|
359
|
-
);
|
|
360
|
-
|
|
345
|
+
this.log.error({
|
|
346
|
+
message: import_opticore_translator.TranslationLoader.t("verifyRSAKey", this.localeLanguage, this.log),
|
|
347
|
+
title: import_opticore_translator.TranslationLoader.t("verifyRSAKeyFailed", this.localeLanguage, this.log),
|
|
348
|
+
errorType: import_opticore_translator.TranslationLoader.t("signatureRSAKeyFailed", this.localeLanguage, this.log),
|
|
349
|
+
stackTrace: stackTrace.stack,
|
|
350
|
+
httpCodeValue: import_opticore_http_response.HttpStatusCode.NOT_FOUND
|
|
351
|
+
});
|
|
352
|
+
process.exit();
|
|
361
353
|
}
|
|
362
354
|
} catch (err) {
|
|
363
355
|
const stackTrace = this.traceError(
|
|
@@ -365,14 +357,14 @@ var SAsymmetricCryptionDataWithPrivateRSAKey = class {
|
|
|
365
357
|
import_opticore_translator.TranslationLoader.t("signatureRSAKeysError", this.localeLanguage, this.log),
|
|
366
358
|
import_opticore_http_response.HttpStatusCode.NOT_ACCEPTABLE
|
|
367
359
|
);
|
|
368
|
-
this.log.error(
|
|
369
|
-
import_opticore_translator.TranslationLoader.t("signatureRSAKeysError", this.localeLanguage, this.log),
|
|
370
|
-
import_opticore_translator.TranslationLoader.t("errorNameNotVerifyingRSAKey", this.localeLanguage, this.log),
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
import_opticore_http_response.HttpStatusCode.NOT_FOUND
|
|
374
|
-
);
|
|
375
|
-
|
|
360
|
+
this.log.error({
|
|
361
|
+
message: import_opticore_translator.TranslationLoader.t("signatureRSAKeysError", this.localeLanguage, this.log),
|
|
362
|
+
title: import_opticore_translator.TranslationLoader.t("errorNameNotVerifyingRSAKey", this.localeLanguage, this.log),
|
|
363
|
+
errorType: err.name,
|
|
364
|
+
stackTrace: stackTrace.stack,
|
|
365
|
+
httpCodeValue: import_opticore_http_response.HttpStatusCode.NOT_FOUND
|
|
366
|
+
});
|
|
367
|
+
process.exit();
|
|
376
368
|
}
|
|
377
369
|
}
|
|
378
370
|
/**
|
|
@@ -382,8 +374,8 @@ var SAsymmetricCryptionDataWithPrivateRSAKey = class {
|
|
|
382
374
|
* @param status
|
|
383
375
|
* @private
|
|
384
376
|
*/
|
|
385
|
-
traceError(props, name,
|
|
386
|
-
return new import_opticore_catch_exception_error.StackTraceError(props, name,
|
|
377
|
+
traceError(props, name, status2) {
|
|
378
|
+
return new import_opticore_catch_exception_error.StackTraceError(props, name, status2, true);
|
|
387
379
|
}
|
|
388
380
|
};
|
|
389
381
|
|
|
@@ -409,18 +401,17 @@ var SAsymmetricCryptionDataWithPublicRSAKey = class {
|
|
|
409
401
|
verifyExistingKey(rsaKey, keyType) {
|
|
410
402
|
if (!rsaKey) {
|
|
411
403
|
const stackTrace = this.traceError(
|
|
412
|
-
keyType + import_opticore_translator2.TranslationLoader.t("verifyExistingKey", this.localeLanguage
|
|
413
|
-
import_opticore_translator2.TranslationLoader.t("verifyExistingKey", this.localeLanguage
|
|
414
|
-
import_opticore_http_response2.HttpStatusCode.NOT_FOUND
|
|
415
|
-
);
|
|
416
|
-
this.logger.error(
|
|
417
|
-
import_opticore_translator2.TranslationLoader.t("verifyExistingKey", this.localeLanguage, this.logger),
|
|
418
|
-
"key verification",
|
|
419
|
-
stackTrace.stack,
|
|
420
|
-
import_opticore_translator2.TranslationLoader.t("verifyExistingKeyError", this.localeLanguage, this.logger),
|
|
404
|
+
keyType + import_opticore_translator2.TranslationLoader.t("verifyExistingKey", this.localeLanguage),
|
|
405
|
+
import_opticore_translator2.TranslationLoader.t("verifyExistingKey", this.localeLanguage),
|
|
421
406
|
import_opticore_http_response2.HttpStatusCode.NOT_FOUND
|
|
422
407
|
);
|
|
423
|
-
|
|
408
|
+
this.logger.error({
|
|
409
|
+
message: import_opticore_translator2.TranslationLoader.t("verifyExistingKey", this.localeLanguage),
|
|
410
|
+
title: "key verification",
|
|
411
|
+
errorType: import_opticore_translator2.TranslationLoader.t("verifyExistingKeyError", this.localeLanguage),
|
|
412
|
+
stackTrace: stackTrace.stack,
|
|
413
|
+
httpCodeValue: import_opticore_http_response2.HttpStatusCode.NOT_FOUND
|
|
414
|
+
});
|
|
424
415
|
}
|
|
425
416
|
return rsaKey;
|
|
426
417
|
}
|
|
@@ -439,17 +430,17 @@ var SAsymmetricCryptionDataWithPublicRSAKey = class {
|
|
|
439
430
|
} catch (err) {
|
|
440
431
|
const stackTrace = this.traceError(
|
|
441
432
|
err.message,
|
|
442
|
-
import_opticore_translator2.TranslationLoader.t("encryptionWithPublicKey", this.localeLanguage
|
|
433
|
+
import_opticore_translator2.TranslationLoader.t("encryptionWithPublicKey", this.localeLanguage),
|
|
443
434
|
import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
|
|
444
435
|
);
|
|
445
|
-
this.logger.error(
|
|
446
|
-
import_opticore_translator2.TranslationLoader.t("errorEncryptionPublicKey", this.localeLanguage
|
|
447
|
-
import_opticore_translator2.TranslationLoader.t("encryptionWithPublicKey", this.localeLanguage
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
|
|
451
|
-
);
|
|
452
|
-
|
|
436
|
+
this.logger.error({
|
|
437
|
+
message: import_opticore_translator2.TranslationLoader.t("errorEncryptionPublicKey", this.localeLanguage),
|
|
438
|
+
title: import_opticore_translator2.TranslationLoader.t("encryptionWithPublicKey", this.localeLanguage),
|
|
439
|
+
errorType: err.code,
|
|
440
|
+
stackTrace: stackTrace.stack,
|
|
441
|
+
httpCodeValue: import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
|
|
442
|
+
});
|
|
443
|
+
process.exit();
|
|
453
444
|
}
|
|
454
445
|
}
|
|
455
446
|
/**
|
|
@@ -468,17 +459,17 @@ var SAsymmetricCryptionDataWithPublicRSAKey = class {
|
|
|
468
459
|
} catch (err) {
|
|
469
460
|
const stackTrace = this.traceError(
|
|
470
461
|
err.code,
|
|
471
|
-
import_opticore_translator2.TranslationLoader.t("errorDecryption", this.localeLanguage
|
|
472
|
-
import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
|
|
473
|
-
);
|
|
474
|
-
this.logger.error(
|
|
475
|
-
import_opticore_translator2.TranslationLoader.t("errorDecryptionWithPrivateKey", this.localeLanguage, this.logger),
|
|
476
|
-
import_opticore_translator2.TranslationLoader.t("errorDecryption", this.localeLanguage, this.logger),
|
|
477
|
-
stackTrace.stack,
|
|
478
|
-
err.message,
|
|
462
|
+
import_opticore_translator2.TranslationLoader.t("errorDecryption", this.localeLanguage),
|
|
479
463
|
import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
|
|
480
464
|
);
|
|
481
|
-
|
|
465
|
+
this.logger.error({
|
|
466
|
+
message: import_opticore_translator2.TranslationLoader.t("errorDecryptionWithPrivateKey", this.localeLanguage),
|
|
467
|
+
title: import_opticore_translator2.TranslationLoader.t("errorDecryption", this.localeLanguage),
|
|
468
|
+
errorType: err.message,
|
|
469
|
+
stackTrace: stackTrace.stack,
|
|
470
|
+
httpCodeValue: import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
|
|
471
|
+
});
|
|
472
|
+
process.exit();
|
|
482
473
|
}
|
|
483
474
|
}
|
|
484
475
|
/**
|
|
@@ -512,183 +503,40 @@ var SAsymmetricCryptionDataWithPublicRSAKey = class {
|
|
|
512
503
|
return decryptedData.toString(CSignRSAKeyComponent.encodingFormat.utf_8);
|
|
513
504
|
} else {
|
|
514
505
|
const stackTrace = this.traceError(
|
|
515
|
-
import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKeyError", this.localeLanguage
|
|
516
|
-
import_opticore_translator2.TranslationLoader.t("signatureRSAKeyFailed", this.localeLanguage
|
|
517
|
-
import_opticore_http_response2.HttpStatusCode.NOT_FOUND
|
|
518
|
-
);
|
|
519
|
-
this.logger.error(
|
|
520
|
-
import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKey", this.localeLanguage, this.logger),
|
|
521
|
-
import_opticore_translator2.TranslationLoader.t("signatureRSAKeyFailed", this.localeLanguage, this.logger),
|
|
522
|
-
stackTrace.stack,
|
|
523
|
-
import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKeyError", this.localeLanguage, this.logger),
|
|
506
|
+
import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKeyError", this.localeLanguage),
|
|
507
|
+
import_opticore_translator2.TranslationLoader.t("signatureRSAKeyFailed", this.localeLanguage),
|
|
524
508
|
import_opticore_http_response2.HttpStatusCode.NOT_FOUND
|
|
525
509
|
);
|
|
510
|
+
this.logger.error({
|
|
511
|
+
message: import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKey", this.localeLanguage),
|
|
512
|
+
title: import_opticore_translator2.TranslationLoader.t("signatureRSAKeyFailed", this.localeLanguage),
|
|
513
|
+
errorType: import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKeyError", this.localeLanguage),
|
|
514
|
+
stackTrace: stackTrace.stack,
|
|
515
|
+
httpCodeValue: import_opticore_http_response2.HttpStatusCode.NOT_FOUND
|
|
516
|
+
});
|
|
526
517
|
return stackTrace;
|
|
527
518
|
}
|
|
528
519
|
} catch (err) {
|
|
529
520
|
const stackTrace = this.traceError(
|
|
530
521
|
err.code,
|
|
531
|
-
import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKey", this.localeLanguage
|
|
532
|
-
import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
|
|
533
|
-
);
|
|
534
|
-
this.logger.error(
|
|
535
|
-
import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKey", this.localeLanguage, this.logger),
|
|
536
|
-
import_opticore_translator2.TranslationLoader.t("errorDecryption", this.localeLanguage, this.logger),
|
|
537
|
-
stackTrace.stack,
|
|
538
|
-
err.message,
|
|
522
|
+
import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKey", this.localeLanguage),
|
|
539
523
|
import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
|
|
540
524
|
);
|
|
541
|
-
|
|
525
|
+
this.logger.error({
|
|
526
|
+
message: import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKey", this.localeLanguage),
|
|
527
|
+
title: import_opticore_translator2.TranslationLoader.t("errorDecryption", this.localeLanguage),
|
|
528
|
+
errorType: err.message,
|
|
529
|
+
stackTrace: stackTrace.stack,
|
|
530
|
+
httpCodeValue: import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
|
|
531
|
+
});
|
|
532
|
+
process.exit();
|
|
542
533
|
}
|
|
543
534
|
}
|
|
544
|
-
traceError(props, name,
|
|
545
|
-
return new import_opticore_catch_exception_error2.StackTraceError(props, name,
|
|
535
|
+
traceError(props, name, HttpStatusCode6) {
|
|
536
|
+
return new import_opticore_catch_exception_error2.StackTraceError(props, name, HttpStatusCode6, true);
|
|
546
537
|
}
|
|
547
538
|
};
|
|
548
539
|
|
|
549
|
-
// src/application/services/checkerMongoDatabaseConnection.service.ts
|
|
550
|
-
var import_mongodb = require("mongodb");
|
|
551
|
-
async function SCheckerMongoDatabaseConnection(url, user, password, dbName) {
|
|
552
|
-
const client = new import_mongodb.MongoClient(
|
|
553
|
-
url,
|
|
554
|
-
{
|
|
555
|
-
auth: { username: user, password }
|
|
556
|
-
}
|
|
557
|
-
);
|
|
558
|
-
await client.connect();
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
// src/core/handlers/errors/database/mySqlError.handler.database.ts
|
|
562
|
-
var import_opticore_logger2 = require("opticore-logger");
|
|
563
|
-
var import_opticore_http_response3 = require("opticore-http-response");
|
|
564
|
-
var import_opticore_translator3 = require("opticore-translator");
|
|
565
|
-
function mySqlErrorHandlerDatabase(localLanguage, environnementPath, err, dbHost, database, user, password) {
|
|
566
|
-
const logger = new import_opticore_logger2.LoggerCore(loggerConfig(environnementPath));
|
|
567
|
-
switch (err.code) {
|
|
568
|
-
case "EAI_AGAIN":
|
|
569
|
-
logger.error(
|
|
570
|
-
import_opticore_translator3.TranslationLoader.t("errorDBHost", localLanguage, { dbHost }),
|
|
571
|
-
import_opticore_translator3.TranslationLoader.t("mySQLError", localLanguage),
|
|
572
|
-
import_opticore_translator3.TranslationLoader.t("eAiAgain", localLanguage),
|
|
573
|
-
err.stack,
|
|
574
|
-
import_opticore_http_response3.HttpStatusCode.NOT_ACCEPTABLE
|
|
575
|
-
);
|
|
576
|
-
break;
|
|
577
|
-
case "ER_NOT_SUPPORTED_AUTH_MODE":
|
|
578
|
-
logger.error(
|
|
579
|
-
import_opticore_translator3.TranslationLoader.t("erNotSupportedAuthModeError", localLanguage),
|
|
580
|
-
import_opticore_translator3.TranslationLoader.t("dbConnection", localLanguage),
|
|
581
|
-
import_opticore_translator3.TranslationLoader.t("erNotSupportedAuthMode", localLanguage),
|
|
582
|
-
err.stack,
|
|
583
|
-
import_opticore_http_response3.HttpStatusCode.NOT_ACCEPTABLE
|
|
584
|
-
);
|
|
585
|
-
break;
|
|
586
|
-
case "ER_ACCESS_DENIED_ERROR":
|
|
587
|
-
logger.error(
|
|
588
|
-
import_opticore_translator3.TranslationLoader.t("accessDeniedToDBCon", localLanguage, { user, password }),
|
|
589
|
-
import_opticore_translator3.TranslationLoader.t("dbConnection", localLanguage),
|
|
590
|
-
import_opticore_translator3.TranslationLoader.t("erAccessDeniedError", localLanguage),
|
|
591
|
-
err.stack,
|
|
592
|
-
import_opticore_http_response3.HttpStatusCode.NOT_ACCEPTABLE
|
|
593
|
-
);
|
|
594
|
-
break;
|
|
595
|
-
case "ER_BAD_DB_ERROR":
|
|
596
|
-
logger.error(
|
|
597
|
-
import_opticore_translator3.TranslationLoader.t("unknownDB", localLanguage, { database }),
|
|
598
|
-
import_opticore_translator3.TranslationLoader.t("dbConnection", localLanguage),
|
|
599
|
-
import_opticore_translator3.TranslationLoader.t("erBadDbError", localLanguage),
|
|
600
|
-
err.stack,
|
|
601
|
-
import_opticore_http_response3.HttpStatusCode.NOT_ACCEPTABLE
|
|
602
|
-
);
|
|
603
|
-
break;
|
|
604
|
-
default:
|
|
605
|
-
logger.error(
|
|
606
|
-
err.message,
|
|
607
|
-
import_opticore_translator3.TranslationLoader.t("dbConnection", localLanguage),
|
|
608
|
-
import_opticore_translator3.TranslationLoader.t("mysqlErrorCon", localLanguage),
|
|
609
|
-
err.stack,
|
|
610
|
-
import_opticore_http_response3.HttpStatusCode.NOT_ACCEPTABLE
|
|
611
|
-
);
|
|
612
|
-
break;
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
// src/application/services/checkerMySqlDatabaseConnection.service.ts
|
|
617
|
-
var import_opticore_translator4 = require("opticore-translator");
|
|
618
|
-
function SCheckerMySqlDatabaseConnection(localeLanguage, environnementPath, dbConnection, user, database, dbHost, password) {
|
|
619
|
-
const logger = SLoggerFileConfiguration(environnementPath);
|
|
620
|
-
dbConnection.connect((err) => {
|
|
621
|
-
if (err) {
|
|
622
|
-
return mySqlErrorHandlerDatabase(localeLanguage, environnementPath, err, dbHost, database, user, password);
|
|
623
|
-
} else {
|
|
624
|
-
logger.success(
|
|
625
|
-
import_opticore_translator4.TranslationLoader.t("dbConnection", localeLanguage, logger),
|
|
626
|
-
import_opticore_translator4.TranslationLoader.t("dbConnexionSuccess", localeLanguage, logger)
|
|
627
|
-
);
|
|
628
|
-
return dbConnection.end((endConErr) => {
|
|
629
|
-
if (endConErr) {
|
|
630
|
-
return mySqlErrorHandlerDatabase(localeLanguage, environnementPath, err, dbHost, database, user, password);
|
|
631
|
-
} else {
|
|
632
|
-
logger.success(
|
|
633
|
-
import_opticore_translator4.TranslationLoader.t("dbConnection", localeLanguage, logger),
|
|
634
|
-
import_opticore_translator4.TranslationLoader.t("dbConnectionClosed", localeLanguage, logger)
|
|
635
|
-
);
|
|
636
|
-
console.log("");
|
|
637
|
-
}
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
});
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
// src/application/services/checkerPostgresDatabaseConnection.service.ts
|
|
644
|
-
var import_opticore_http_response4 = require("opticore-http-response");
|
|
645
|
-
var import_pg = __toESM(require("pg"), 1);
|
|
646
|
-
var import_opticore_translator5 = require("opticore-translator");
|
|
647
|
-
async function SCheckerPostgresDatabaseConnection(localeLanguage, environnementPath, connectionString, keepAlive, stream, statement_timeout, ssl, query_timeout, keepAliveInitialDelayMillis, idle_in_transaction_session_timeout, application_name, connectionTimeoutMillis, types, options) {
|
|
648
|
-
const logger = SLoggerFileConfiguration(environnementPath);
|
|
649
|
-
const configOptions = {
|
|
650
|
-
connectionString,
|
|
651
|
-
keepAlive,
|
|
652
|
-
stream,
|
|
653
|
-
statement_timeout,
|
|
654
|
-
ssl,
|
|
655
|
-
query_timeout,
|
|
656
|
-
keepAliveInitialDelayMillis,
|
|
657
|
-
idle_in_transaction_session_timeout,
|
|
658
|
-
application_name,
|
|
659
|
-
connectionTimeoutMillis,
|
|
660
|
-
types,
|
|
661
|
-
options
|
|
662
|
-
};
|
|
663
|
-
const client = new import_pg.default.Client(configOptions);
|
|
664
|
-
await client.connect();
|
|
665
|
-
await client.end().then(
|
|
666
|
-
() => {
|
|
667
|
-
logger.success(
|
|
668
|
-
import_opticore_translator5.TranslationLoader.t("postgresSuccessConn", localeLanguage, logger),
|
|
669
|
-
import_opticore_translator5.TranslationLoader.t("postgresClosingConnSuccess", localeLanguage, logger)
|
|
670
|
-
);
|
|
671
|
-
},
|
|
672
|
-
(onRejected) => {
|
|
673
|
-
logger.error(
|
|
674
|
-
import_opticore_translator5.TranslationLoader.t("postgresEndClientRejection", localeLanguage, logger),
|
|
675
|
-
import_opticore_translator5.TranslationLoader.t("postgresClientError", localeLanguage, logger),
|
|
676
|
-
import_opticore_translator5.TranslationLoader.t("postgresEndRejection", localeLanguage, logger),
|
|
677
|
-
onRejected,
|
|
678
|
-
import_opticore_http_response4.HttpStatusCode.BAD_REQUEST
|
|
679
|
-
);
|
|
680
|
-
}
|
|
681
|
-
).catch((onError) => {
|
|
682
|
-
logger.error(
|
|
683
|
-
onError.message,
|
|
684
|
-
import_opticore_translator5.TranslationLoader.t("postgresConnError", localeLanguage, logger),
|
|
685
|
-
import_opticore_translator5.TranslationLoader.t("postgresException", localeLanguage, logger),
|
|
686
|
-
onError.stack,
|
|
687
|
-
import_opticore_http_response4.HttpStatusCode.BAD_REQUEST
|
|
688
|
-
);
|
|
689
|
-
});
|
|
690
|
-
}
|
|
691
|
-
|
|
692
540
|
// src/domains/constants/logLevel.constant.ts
|
|
693
541
|
var CLogLevel = {
|
|
694
542
|
debug: "DEBUG",
|
|
@@ -697,38 +545,31 @@ var CLogLevel = {
|
|
|
697
545
|
error: "ERROR"
|
|
698
546
|
};
|
|
699
547
|
|
|
700
|
-
// src/utils/connection/optionalArgumentConnection.util.ts
|
|
701
|
-
var import_opticore_env_access2 = require("opticore-env-access");
|
|
702
|
-
var UOptionalArgumentConnection = (environnementPath) => {
|
|
703
|
-
const envPath = (0, import_opticore_env_access2.getEnvironnementValue)(environnementPath);
|
|
704
|
-
return envPath.argumentsDatabaseConnection;
|
|
705
|
-
};
|
|
706
|
-
|
|
707
548
|
// src/utils/parsing/parsingYaml.utils.ts
|
|
708
549
|
var import_promises = require("fs/promises");
|
|
709
|
-
var
|
|
710
|
-
var
|
|
711
|
-
var
|
|
550
|
+
var import_opticore_http_response4 = require("opticore-http-response");
|
|
551
|
+
var import_opticore_logger2 = require("opticore-logger");
|
|
552
|
+
var import_opticore_translator4 = require("opticore-translator");
|
|
712
553
|
|
|
713
554
|
// src/core/config/loaders/translateLanguage.loader.ts
|
|
714
555
|
var import_path = __toESM(require("path"), 1);
|
|
715
556
|
var import_module = require("module");
|
|
716
|
-
var
|
|
717
|
-
var
|
|
557
|
+
var import_opticore_translator3 = require("opticore-translator");
|
|
558
|
+
var import_opticore_http_response3 = require("opticore-http-response");
|
|
718
559
|
var translateWebAppCoreLanguageLoader = (environnementPath, localLang) => {
|
|
719
560
|
try {
|
|
720
561
|
const require2 = (0, import_module.createRequire)(importMetaUrl);
|
|
721
562
|
const packagePath = import_path.default.dirname(require2.resolve("opticore-webapp-core"));
|
|
722
563
|
const translateMsgJsonFilePath = import_path.default.join(packagePath, "utils", "translations");
|
|
723
|
-
|
|
564
|
+
import_opticore_translator3.TranslationLoader.loadTranslations(translateMsgJsonFilePath);
|
|
724
565
|
} catch (err) {
|
|
725
|
-
SLoggerFileConfiguration(environnementPath).error(
|
|
726
|
-
|
|
727
|
-
err.code,
|
|
728
|
-
err.code,
|
|
729
|
-
err.stackTrace,
|
|
730
|
-
|
|
731
|
-
);
|
|
566
|
+
SLoggerFileConfiguration(environnementPath).error({
|
|
567
|
+
message: import_opticore_translator3.TranslationLoader.t(err.message, localLang),
|
|
568
|
+
title: err.code,
|
|
569
|
+
errorType: err.code,
|
|
570
|
+
stackTrace: err.stackTrace,
|
|
571
|
+
httpCodeValue: import_opticore_http_response3.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
572
|
+
});
|
|
732
573
|
}
|
|
733
574
|
};
|
|
734
575
|
|
|
@@ -737,10 +578,10 @@ var import_path2 = __toESM(require("path"), 1);
|
|
|
737
578
|
var YamlParsing = class {
|
|
738
579
|
logger;
|
|
739
580
|
localeLanguage;
|
|
740
|
-
constructor(localeLanguage,
|
|
741
|
-
translateWebAppCoreLanguageLoader(
|
|
581
|
+
constructor(localeLanguage, environmentPath) {
|
|
582
|
+
translateWebAppCoreLanguageLoader(environmentPath, localeLanguage);
|
|
742
583
|
this.localeLanguage = localeLanguage;
|
|
743
|
-
this.logger = new
|
|
584
|
+
this.logger = new import_opticore_logger2.LoggerCore(loggerConfig(environmentPath));
|
|
744
585
|
}
|
|
745
586
|
absolutPath() {
|
|
746
587
|
return import_path2.default.join(process.cwd(), "src", "utils", "translations");
|
|
@@ -750,13 +591,13 @@ var YamlParsing = class {
|
|
|
750
591
|
const yamlContent = await (0, import_promises.readFile)(filePath, "utf-8");
|
|
751
592
|
await this.parsing(yamlContent);
|
|
752
593
|
} catch (error) {
|
|
753
|
-
this.logger.error(
|
|
754
|
-
error.message,
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
error.stack,
|
|
758
|
-
|
|
759
|
-
);
|
|
594
|
+
this.logger.error({
|
|
595
|
+
message: error.message,
|
|
596
|
+
title: import_opticore_translator4.TranslationLoader.t("parsingFailed", this.localeLanguage, this.logger),
|
|
597
|
+
errorType: import_opticore_translator4.TranslationLoader.t("readingError", this.localeLanguage, this.logger),
|
|
598
|
+
stackTrace: error.stack,
|
|
599
|
+
httpCodeValue: import_opticore_http_response4.HttpStatusCode.NOT_ACCEPTABLE
|
|
600
|
+
});
|
|
760
601
|
}
|
|
761
602
|
}
|
|
762
603
|
/**
|
|
@@ -783,13 +624,13 @@ var YamlParsing = class {
|
|
|
783
624
|
result[key] = value?.trim() || null;
|
|
784
625
|
}
|
|
785
626
|
} else {
|
|
786
|
-
this.logger.error(
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
content,
|
|
791
|
-
|
|
792
|
-
);
|
|
627
|
+
this.logger.error({
|
|
628
|
+
message: import_opticore_translator4.TranslationLoader.t("badFormat", this.localeLanguage, { line }),
|
|
629
|
+
title: import_opticore_translator4.TranslationLoader.t("parsingFailed", this.localeLanguage, this.logger),
|
|
630
|
+
errorType: import_opticore_translator4.TranslationLoader.t("unsupportedFormat", this.localeLanguage, this.logger),
|
|
631
|
+
stackTrace: content,
|
|
632
|
+
httpCodeValue: import_opticore_http_response4.HttpStatusCode.NOT_ACCEPTABLE
|
|
633
|
+
});
|
|
793
634
|
}
|
|
794
635
|
}
|
|
795
636
|
return result;
|
|
@@ -810,258 +651,13 @@ var Environment = class {
|
|
|
810
651
|
}
|
|
811
652
|
};
|
|
812
653
|
|
|
813
|
-
// src/core/config/database/connexion.config.database.ts
|
|
814
|
-
var import_mysql = __toESM(require("mysql"), 1);
|
|
815
|
-
var import_opticore_http_response8 = require("opticore-http-response");
|
|
816
|
-
var import_opticore_logger4 = require("opticore-logger");
|
|
817
|
-
var import_opticore_translator9 = require("opticore-translator");
|
|
818
|
-
|
|
819
|
-
// src/core/errors/databaseConnexion.error.ts
|
|
820
|
-
var import_opticore_http_response7 = require("opticore-http-response");
|
|
821
|
-
var import_opticore_catch_exception_error3 = require("opticore-catch-exception-error");
|
|
822
|
-
var import_opticore_translator8 = require("opticore-translator");
|
|
823
|
-
var DbConnexionConfigError = class {
|
|
824
|
-
logger;
|
|
825
|
-
localeLanguage;
|
|
826
|
-
constructor(localeLanguage, environnementPath) {
|
|
827
|
-
this.localeLanguage = localeLanguage;
|
|
828
|
-
this.logger = SLoggerFileConfiguration(environnementPath);
|
|
829
|
-
}
|
|
830
|
-
/**
|
|
831
|
-
*
|
|
832
|
-
* @param e
|
|
833
|
-
*/
|
|
834
|
-
mongoDBAuthenticationFailed(e) {
|
|
835
|
-
const stackTrace = this.traceError(
|
|
836
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { e }),
|
|
837
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBAuthentication", this.localeLanguage),
|
|
838
|
-
import_opticore_http_response7.HttpStatusCode.UNAUTHORIZED
|
|
839
|
-
);
|
|
840
|
-
this.logger.error(
|
|
841
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBAuthenticationError", this.localeLanguage),
|
|
842
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
843
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBAuthenticationFailed", this.localeLanguage),
|
|
844
|
-
stackTrace.stack,
|
|
845
|
-
import_opticore_http_response7.HttpStatusCode.UNAUTHORIZED
|
|
846
|
-
);
|
|
847
|
-
}
|
|
848
|
-
/**
|
|
849
|
-
*
|
|
850
|
-
* @param err
|
|
851
|
-
* @param dbHost
|
|
852
|
-
* @param dbPort
|
|
853
|
-
*/
|
|
854
|
-
mongoDBInvalidUrl(err, dbHost, dbPort) {
|
|
855
|
-
const stackTrace = this.traceError(
|
|
856
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { err }),
|
|
857
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBUnableParsingUrl", this.localeLanguage),
|
|
858
|
-
import_opticore_http_response7.HttpStatusCode.BAD_REQUEST
|
|
859
|
-
);
|
|
860
|
-
this.logger.error(
|
|
861
|
-
import_opticore_translator8.TranslationLoader.t("dbUrlParsingError", this.localeLanguage, { dbHost, dbPort }),
|
|
862
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
863
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBUnableParsingUrl", this.localeLanguage),
|
|
864
|
-
stackTrace.stack,
|
|
865
|
-
import_opticore_http_response7.HttpStatusCode.BAD_REQUEST
|
|
866
|
-
);
|
|
867
|
-
}
|
|
868
|
-
/**
|
|
869
|
-
*
|
|
870
|
-
* @param err
|
|
871
|
-
* @param dbHost
|
|
872
|
-
*/
|
|
873
|
-
mongoDBEaiAgain(err, dbHost) {
|
|
874
|
-
const stackTrace = this.traceError(
|
|
875
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { err }),
|
|
876
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBServerSelection", this.localeLanguage),
|
|
877
|
-
import_opticore_http_response7.HttpStatusCode.BAD_REQUEST
|
|
878
|
-
);
|
|
879
|
-
this.logger.error(
|
|
880
|
-
import_opticore_translator8.TranslationLoader.t("mongoServerError", this.localeLanguage, { dbHost }),
|
|
881
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
882
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBServerSelection", this.localeLanguage),
|
|
883
|
-
stackTrace.stack,
|
|
884
|
-
import_opticore_http_response7.HttpStatusCode.BAD_REQUEST
|
|
885
|
-
);
|
|
886
|
-
}
|
|
887
|
-
/**
|
|
888
|
-
*
|
|
889
|
-
* @param err
|
|
890
|
-
*/
|
|
891
|
-
mongoDbGlobalError(err) {
|
|
892
|
-
const stackTrace = this.traceError(
|
|
893
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { err }),
|
|
894
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
895
|
-
import_opticore_http_response7.HttpStatusCode.NOT_ACCEPTABLE
|
|
896
|
-
);
|
|
897
|
-
this.logger.error(
|
|
898
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
899
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnectionError", this.localeLanguage),
|
|
900
|
-
stackTrace.stack,
|
|
901
|
-
err.message,
|
|
902
|
-
import_opticore_http_response7.HttpStatusCode.NOT_ACCEPTABLE
|
|
903
|
-
);
|
|
904
|
-
}
|
|
905
|
-
/**
|
|
906
|
-
*
|
|
907
|
-
* @param props
|
|
908
|
-
* @param name
|
|
909
|
-
* @param status
|
|
910
|
-
* @private
|
|
911
|
-
*/
|
|
912
|
-
traceError(props, name, status7) {
|
|
913
|
-
return new import_opticore_catch_exception_error3.StackTraceError(props, name, status7, true);
|
|
914
|
-
}
|
|
915
|
-
};
|
|
916
|
-
|
|
917
|
-
// src/core/config/database/connexion.config.database.ts
|
|
918
|
-
var import_opticore_catch_exception_error4 = require("opticore-catch-exception-error");
|
|
919
|
-
var DatabaseConnectionConfig = class {
|
|
920
|
-
env;
|
|
921
|
-
logger;
|
|
922
|
-
localeLanguage;
|
|
923
|
-
environnementPath;
|
|
924
|
-
DbConnexionConfigError;
|
|
925
|
-
constructor(localeLanguage, environnementPath) {
|
|
926
|
-
this.localeLanguage = localeLanguage;
|
|
927
|
-
this.environnementPath = environnementPath;
|
|
928
|
-
this.DbConnexionConfigError = new DbConnexionConfigError(localeLanguage, environnementPath);
|
|
929
|
-
this.env = new Environment(environnementPath);
|
|
930
|
-
this.logger = new import_opticore_logger4.LoggerCore(loggerConfig(environnementPath));
|
|
931
|
-
}
|
|
932
|
-
/**
|
|
933
|
-
*
|
|
934
|
-
* @param optionalArgumentConnection
|
|
935
|
-
*
|
|
936
|
-
* MySQL database connection with an optional arguments
|
|
937
|
-
* Establish the connection between app and Database Management System.
|
|
938
|
-
* Inside this class, a checker verifies if database credentials are right,
|
|
939
|
-
* and it's show off in the log that the connection has been created successfully.
|
|
940
|
-
* But if any error is occurring during trying connection, it'd specify that error by stack traces.
|
|
941
|
-
*/
|
|
942
|
-
databaseMySQLConnexionChecker(optionalArgumentConnection) {
|
|
943
|
-
const dbURL = `${this.env.get("dataBaseUser")}:${this.env.get("dataBasePassword")}@${this.env.get("dataBaseHost")}:${this.env.get("dataBasePort")}/${this.env.get("dataBaseName")}`;
|
|
944
|
-
let url = `mysql://${dbURL}?${optionalArgumentConnection}`;
|
|
945
|
-
const dbConnection = import_mysql.default.createConnection(url);
|
|
946
|
-
return SCheckerMySqlDatabaseConnection(this.localeLanguage, this.environnementPath, dbConnection, this.env.get("dataBaseUser"), this.env.get("dataBaseName"), this.env.get("dataBaseHost"), this.env.get("dataBasePassword"));
|
|
947
|
-
}
|
|
948
|
-
/**
|
|
949
|
-
*
|
|
950
|
-
* @param optionalArgumentConnection
|
|
951
|
-
*
|
|
952
|
-
* Mongo database connection with optional connection arguments
|
|
953
|
-
*/
|
|
954
|
-
async databaseMongoDBConnectionChecker(optionalArgumentConnection) {
|
|
955
|
-
const dbUrl = `${this.env.get("dataBaseUser")}:${this.env.get("dataBasePassword")}@${this.env.get("dataBaseHost")}:${this.env.get("dataBasePort")}/${this.env.get("dataBaseName")}`;
|
|
956
|
-
const url = `mongodb://${dbUrl}${optionalArgumentConnection}`;
|
|
957
|
-
try {
|
|
958
|
-
await SCheckerMongoDatabaseConnection(url, this.env.get("dataBaseUser"), this.env.get("dataBasePassword"), this.env.get("dataBaseName"));
|
|
959
|
-
this.logger.success(
|
|
960
|
-
import_opticore_translator9.TranslationLoader.t("mongoDBConnectionChecker", this.localeLanguage, loggerConfig),
|
|
961
|
-
import_opticore_translator9.TranslationLoader.t("mongoConnectionSuccess", this.localeLanguage, loggerConfig)
|
|
962
|
-
);
|
|
963
|
-
console.log("");
|
|
964
|
-
} catch (e) {
|
|
965
|
-
if (e.code === 18) {
|
|
966
|
-
this.DbConnexionConfigError.mongoDBAuthenticationFailed(e);
|
|
967
|
-
}
|
|
968
|
-
if (e.cause.code === "ERR_INVALID_URL") {
|
|
969
|
-
this.DbConnexionConfigError.mongoDBInvalidUrl(e, this.env.get("dataBaseHost"), this.env.get("dataBasePort"));
|
|
970
|
-
}
|
|
971
|
-
if (e.code === void 0) {
|
|
972
|
-
this.DbConnexionConfigError.mongoDBEaiAgain(e, this.env.get("dataBaseHost"));
|
|
973
|
-
} else {
|
|
974
|
-
this.DbConnexionConfigError.mongoDbGlobalError(e);
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
/**
|
|
979
|
-
*
|
|
980
|
-
* @param keepAlive
|
|
981
|
-
* @param stream
|
|
982
|
-
* @param statement_timeout
|
|
983
|
-
* @param ssl
|
|
984
|
-
* @param query_timeout
|
|
985
|
-
* @param keepAliveInitialDelayMillis
|
|
986
|
-
* @param idle_in_transaction_session_timeout
|
|
987
|
-
* @param application_name
|
|
988
|
-
* @param connectionTimeoutMillis
|
|
989
|
-
* @param types
|
|
990
|
-
* @param options
|
|
991
|
-
*
|
|
992
|
-
* Postgres database connection with optional connection arguments
|
|
993
|
-
*/
|
|
994
|
-
async databasePostgresDBConnectionChecker(keepAlive, stream, statement_timeout, ssl, query_timeout, keepAliveInitialDelayMillis, idle_in_transaction_session_timeout, application_name, connectionTimeoutMillis, types, options) {
|
|
995
|
-
const url = `postgresql:/${this.env.get("dataBaseUser")}:${this.env.get("dataBasePassword")}@${this.env.get("dataBaseHost")}:${this.env.get("dataBasePort")}/${this.env.get("dataBaseName")}`;
|
|
996
|
-
try {
|
|
997
|
-
await SCheckerPostgresDatabaseConnection(
|
|
998
|
-
this.localeLanguage,
|
|
999
|
-
this.environnementPath,
|
|
1000
|
-
url,
|
|
1001
|
-
keepAlive,
|
|
1002
|
-
stream,
|
|
1003
|
-
statement_timeout,
|
|
1004
|
-
ssl,
|
|
1005
|
-
query_timeout,
|
|
1006
|
-
keepAliveInitialDelayMillis,
|
|
1007
|
-
idle_in_transaction_session_timeout,
|
|
1008
|
-
application_name,
|
|
1009
|
-
connectionTimeoutMillis,
|
|
1010
|
-
types,
|
|
1011
|
-
options
|
|
1012
|
-
);
|
|
1013
|
-
this.logger.success(
|
|
1014
|
-
import_opticore_translator9.TranslationLoader.t("postgresDBConnectionChecker", this.localeLanguage, loggerConfig),
|
|
1015
|
-
import_opticore_translator9.TranslationLoader.t("postgresConnectionSuccess", this.localeLanguage, loggerConfig)
|
|
1016
|
-
);
|
|
1017
|
-
console.log("");
|
|
1018
|
-
} catch (err) {
|
|
1019
|
-
const stackTrace = this.traceError(import_opticore_translator9.TranslationLoader.t(`${err.message}`, this.localeLanguage, loggerConfig), "PostgresConnectionError", import_opticore_http_response8.HttpStatusCode.NOT_ACCEPTABLE);
|
|
1020
|
-
this.logger.error(err.message, "PostgresConnectionError", "Postgres connection error", stackTrace.stack, import_opticore_http_response8.HttpStatusCode.NOT_ACCEPTABLE);
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
traceError(props, name, status7) {
|
|
1024
|
-
return new import_opticore_catch_exception_error4.StackTraceError(props, name, status7, true);
|
|
1025
|
-
}
|
|
1026
|
-
};
|
|
1027
|
-
|
|
1028
|
-
// src/core/config/database/middleware/mongoChecker.database.ts
|
|
1029
|
-
var MMongoCheckerDatabase = (optionalArgumentConnection, localLanguage, environnementPath) => {
|
|
1030
|
-
const DbConnexion = new DatabaseConnectionConfig(localLanguage, environnementPath);
|
|
1031
|
-
return DbConnexion.databaseMongoDBConnectionChecker(optionalArgumentConnection);
|
|
1032
|
-
};
|
|
1033
|
-
|
|
1034
|
-
// src/core/config/database/middleware/mySqlChecker.database.ts
|
|
1035
|
-
var MMySqlCheckerDatabase = (optionalArgumentConnection, localLanguage, environnementPath) => {
|
|
1036
|
-
const DbConnexion = new DatabaseConnectionConfig(localLanguage, environnementPath);
|
|
1037
|
-
return DbConnexion.databaseMySQLConnexionChecker(optionalArgumentConnection);
|
|
1038
|
-
};
|
|
1039
|
-
|
|
1040
|
-
// src/core/config/database/middleware/postgresChecker.database.ts
|
|
1041
|
-
var MPostgresCheckerDatabase = (localLanguage, environnementPath, keepAlive, stream, statement_timeout, ssl, query_timeout, keepAliveInitialDelayMillis, idle_in_transaction_session_timeout, application_name, connectionTimeoutMillis, types, options) => {
|
|
1042
|
-
const DbConnexion = new DatabaseConnectionConfig(localLanguage, environnementPath);
|
|
1043
|
-
return DbConnexion.databasePostgresDBConnectionChecker(
|
|
1044
|
-
keepAlive,
|
|
1045
|
-
stream,
|
|
1046
|
-
statement_timeout,
|
|
1047
|
-
ssl,
|
|
1048
|
-
query_timeout,
|
|
1049
|
-
keepAliveInitialDelayMillis,
|
|
1050
|
-
idle_in_transaction_session_timeout,
|
|
1051
|
-
application_name,
|
|
1052
|
-
connectionTimeoutMillis,
|
|
1053
|
-
types,
|
|
1054
|
-
options
|
|
1055
|
-
);
|
|
1056
|
-
};
|
|
1057
|
-
|
|
1058
654
|
// src/utils/utility.utils.ts
|
|
1059
655
|
var import_node_process = __toESM(require("process"), 1);
|
|
1060
656
|
var import_chalk = __toESM(require("chalk"), 1);
|
|
1061
657
|
var import_ansi_colors = __toESM(require("ansi-colors"), 1);
|
|
1062
658
|
var import_path3 = __toESM(require("path"), 1);
|
|
1063
659
|
var import_fs = __toESM(require("fs"), 1);
|
|
1064
|
-
var
|
|
660
|
+
var import_opticore_translator5 = require("opticore-translator");
|
|
1065
661
|
var Utility = class {
|
|
1066
662
|
localLang;
|
|
1067
663
|
constructor(localLanguage) {
|
|
@@ -1158,19 +754,19 @@ var Utility = class {
|
|
|
1158
754
|
this.getEnvFileLoading(".env");
|
|
1159
755
|
const isDevelopment = import_node_process.default.env.NODE_ENV === "development";
|
|
1160
756
|
if (isDevelopment) {
|
|
1161
|
-
return `${
|
|
757
|
+
return `${import_opticore_translator5.TranslationLoader.t("serverRunning", this.localLang)} ${import_ansi_colors.default.bgBlue(`${import_ansi_colors.default.bold(`${development}`)}`)} mode`;
|
|
1162
758
|
} else {
|
|
1163
|
-
return `${
|
|
759
|
+
return `${import_opticore_translator5.TranslationLoader.t("serverRunning", this.localLang)} ${import_ansi_colors.default.bgBlue(`${import_ansi_colors.default.bold(`${production}`)}`)} mode`;
|
|
1164
760
|
}
|
|
1165
761
|
}
|
|
1166
762
|
infoServer(nodeVersion, startingTime, host, port, rss, heapUsed, user, system) {
|
|
1167
763
|
const paddingLength = 52;
|
|
1168
764
|
const msg0 = " ".padEnd(paddingLength, " ");
|
|
1169
|
-
const msg1 = ` ${
|
|
765
|
+
const msg1 = ` ${import_opticore_translator5.TranslationLoader.t("okServerListening", this.localLang)}`;
|
|
1170
766
|
const msg2Value = `${import_ansi_colors.default.bgBlue(`${import_ansi_colors.default.bold(`${nodeVersion}`)}`)}`;
|
|
1171
|
-
const msg2 = ` ${
|
|
767
|
+
const msg2 = ` ${import_opticore_translator5.TranslationLoader.t("webServerUseNodeVersion", this.localLang)}`;
|
|
1172
768
|
const msg3Value = `${import_ansi_colors.default.bgBlue(`${import_ansi_colors.default.bold(`${startingTime}`)}`)}`;
|
|
1173
|
-
const msg3 = ` ${
|
|
769
|
+
const msg3 = ` ${import_opticore_translator5.TranslationLoader.t("startupTime", this.localLang)}`;
|
|
1174
770
|
const msg4 = ` ${this.getServerRunningMode("development", "production")}`;
|
|
1175
771
|
const msg5 = ` ${import_ansi_colors.default.underline(`http://${host}:${port}`)}`;
|
|
1176
772
|
console.log(import_chalk.default.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
@@ -1181,18 +777,18 @@ var Utility = class {
|
|
|
1181
777
|
console.log(import_chalk.default.bgGreen.white(msg5.padEnd(61, " ")));
|
|
1182
778
|
console.log(import_chalk.default.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
1183
779
|
console.log(``);
|
|
1184
|
-
console.log(`${`${
|
|
1185
|
-
console.log(`${`${
|
|
1186
|
-
console.log(`${`${
|
|
1187
|
-
console.log(`${`${
|
|
780
|
+
console.log(`${`${import_opticore_translator5.TranslationLoader.t("totalMemory", this.localLang)}`} ${import_ansi_colors.default.cyan(`${import_ansi_colors.default.bold(`${rss}`)}`)}`);
|
|
781
|
+
console.log(`${`${import_opticore_translator5.TranslationLoader.t("memoryUsedDuringExecution", this.localLang)}`} ${import_ansi_colors.default.cyan(`${import_ansi_colors.default.bold(`${heapUsed}`)}`)}`);
|
|
782
|
+
console.log(`${`${import_opticore_translator5.TranslationLoader.t("memoryUsedByUser", this.localLang)}`} ${import_ansi_colors.default.cyan(`${import_ansi_colors.default.bold(`${user}`)}`)}`);
|
|
783
|
+
console.log(`${`${import_opticore_translator5.TranslationLoader.t("memoryUsedBySystem", this.localLang)}`} ${import_ansi_colors.default.cyan(`${import_ansi_colors.default.bold(`${system}`)}`)}`);
|
|
1188
784
|
console.log(``);
|
|
1189
785
|
}
|
|
1190
786
|
};
|
|
1191
787
|
|
|
1192
788
|
// src/core/events/pathModuleVerifier.event.ts
|
|
1193
789
|
var import_path4 = require("path");
|
|
1194
|
-
var
|
|
1195
|
-
var
|
|
790
|
+
var import_opticore_http_response5 = require("opticore-http-response");
|
|
791
|
+
var import_opticore_translator6 = require("opticore-translator");
|
|
1196
792
|
var PathModuleVerifier = class {
|
|
1197
793
|
log;
|
|
1198
794
|
localeLanguage;
|
|
@@ -1213,13 +809,13 @@ var PathModuleVerifier = class {
|
|
|
1213
809
|
}
|
|
1214
810
|
}
|
|
1215
811
|
if (notLoadedPaths.length > 0) {
|
|
1216
|
-
this.log.error(
|
|
1217
|
-
|
|
1218
|
-
"",
|
|
1219
|
-
"",
|
|
1220
|
-
modulePaths,
|
|
1221
|
-
|
|
1222
|
-
);
|
|
812
|
+
this.log.error({
|
|
813
|
+
message: import_opticore_translator6.TranslationLoader.t("moduleNotLoaded", this.localeLanguage, { notLoadedPaths: notLoadedPaths.join(", ") }),
|
|
814
|
+
title: "",
|
|
815
|
+
errorType: "",
|
|
816
|
+
stackTrace: modulePaths,
|
|
817
|
+
httpCodeValue: import_opticore_http_response5.HttpStatusCode.NOT_ACCEPTABLE
|
|
818
|
+
});
|
|
1223
819
|
throw new Error();
|
|
1224
820
|
}
|
|
1225
821
|
}
|
|
@@ -1240,8 +836,8 @@ var PathModuleVerifier = class {
|
|
|
1240
836
|
|
|
1241
837
|
// src/core/config/loaders/localLanguage.loader.ts
|
|
1242
838
|
var import_path5 = __toESM(require("path"), 1);
|
|
1243
|
-
var
|
|
1244
|
-
var
|
|
839
|
+
var import_opticore_translator7 = require("opticore-translator");
|
|
840
|
+
var import_opticore_http_response6 = require("opticore-http-response");
|
|
1245
841
|
var LocalLanguageLoader = class {
|
|
1246
842
|
localeLanguage;
|
|
1247
843
|
environnementPath;
|
|
@@ -1252,16 +848,15 @@ var LocalLanguageLoader = class {
|
|
|
1252
848
|
load() {
|
|
1253
849
|
try {
|
|
1254
850
|
const translateMsgJsonFilePath = import_path5.default.join(process.cwd(), "src", "utils", "translations");
|
|
1255
|
-
|
|
851
|
+
import_opticore_translator7.TranslationLoader.loadTranslations(translateMsgJsonFilePath);
|
|
1256
852
|
} catch (err) {
|
|
1257
|
-
SLoggerFileConfiguration(this.environnementPath).error(
|
|
1258
|
-
|
|
1259
|
-
err.
|
|
1260
|
-
err.code,
|
|
1261
|
-
err.
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
);
|
|
853
|
+
SLoggerFileConfiguration(this.environnementPath).error({
|
|
854
|
+
message: err.message,
|
|
855
|
+
title: err.code,
|
|
856
|
+
errorType: err.code,
|
|
857
|
+
stackTrace: err.stackTrace,
|
|
858
|
+
httpCodeValue: import_opticore_http_response6.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
859
|
+
});
|
|
1265
860
|
}
|
|
1266
861
|
}
|
|
1267
862
|
};
|
|
@@ -1271,18 +866,11 @@ var LocalLanguageLoader = class {
|
|
|
1271
866
|
CSignRSAKeyComponent,
|
|
1272
867
|
Environment,
|
|
1273
868
|
LocalLanguageLoader,
|
|
1274
|
-
MMongoCheckerDatabase,
|
|
1275
|
-
MMySqlCheckerDatabase,
|
|
1276
|
-
MPostgresCheckerDatabase,
|
|
1277
869
|
PathModuleVerifier,
|
|
1278
870
|
RSAKeyDecryption,
|
|
1279
871
|
RSAKeyEncryption,
|
|
1280
872
|
SAsymmetricCryptionDataWithPrivateRSAKey,
|
|
1281
873
|
SAsymmetricCryptionDataWithPublicRSAKey,
|
|
1282
|
-
SCheckerMongoDatabaseConnection,
|
|
1283
|
-
SCheckerMySqlDatabaseConnection,
|
|
1284
|
-
SCheckerPostgresDatabaseConnection,
|
|
1285
|
-
UOptionalArgumentConnection,
|
|
1286
874
|
Utility,
|
|
1287
875
|
YamlParsing,
|
|
1288
876
|
dateTimeFormatted,
|