opticore-webapp-core 1.0.17 → 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 +158 -569
- package/dist/index.d.cts +4 -62
- package/dist/index.d.ts +4 -62
- package/dist/index.js +162 -566
- 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
|
|
443
|
-
import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
|
|
444
|
-
);
|
|
445
|
-
this.logger.error(
|
|
446
|
-
import_opticore_translator2.TranslationLoader.t("errorEncryptionPublicKey", this.localeLanguage, this.logger),
|
|
447
|
-
import_opticore_translator2.TranslationLoader.t("encryptionWithPublicKey", this.localeLanguage, this.logger),
|
|
448
|
-
stackTrace.stack,
|
|
449
|
-
err.message,
|
|
433
|
+
import_opticore_translator2.TranslationLoader.t("encryptionWithPublicKey", this.localeLanguage),
|
|
450
434
|
import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
|
|
451
435
|
);
|
|
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
|
|
462
|
+
import_opticore_translator2.TranslationLoader.t("errorDecryption", this.localeLanguage),
|
|
472
463
|
import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
|
|
473
464
|
);
|
|
474
|
-
this.logger.error(
|
|
475
|
-
import_opticore_translator2.TranslationLoader.t("errorDecryptionWithPrivateKey", this.localeLanguage
|
|
476
|
-
import_opticore_translator2.TranslationLoader.t("errorDecryption", this.localeLanguage
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
|
|
480
|
-
);
|
|
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
|
|
522
|
+
import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKey", this.localeLanguage),
|
|
532
523
|
import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
|
|
533
524
|
);
|
|
534
|
-
this.logger.error(
|
|
535
|
-
import_opticore_translator2.TranslationLoader.t("verifyPublicRSAKey", this.localeLanguage
|
|
536
|
-
import_opticore_translator2.TranslationLoader.t("errorDecryption", this.localeLanguage
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE
|
|
540
|
-
);
|
|
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,62 +545,59 @@ 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
|
|
|
735
576
|
// src/utils/parsing/parsingYaml.utils.ts
|
|
577
|
+
var import_path2 = __toESM(require("path"), 1);
|
|
736
578
|
var YamlParsing = class {
|
|
737
579
|
logger;
|
|
738
580
|
localeLanguage;
|
|
739
|
-
constructor(localeLanguage,
|
|
740
|
-
translateWebAppCoreLanguageLoader(
|
|
581
|
+
constructor(localeLanguage, environmentPath) {
|
|
582
|
+
translateWebAppCoreLanguageLoader(environmentPath, localeLanguage);
|
|
741
583
|
this.localeLanguage = localeLanguage;
|
|
742
|
-
this.logger = new
|
|
584
|
+
this.logger = new import_opticore_logger2.LoggerCore(loggerConfig(environmentPath));
|
|
585
|
+
}
|
|
586
|
+
absolutPath() {
|
|
587
|
+
return import_path2.default.join(process.cwd(), "src", "utils", "translations");
|
|
743
588
|
}
|
|
744
589
|
async readFile(filePath) {
|
|
745
590
|
try {
|
|
746
591
|
const yamlContent = await (0, import_promises.readFile)(filePath, "utf-8");
|
|
747
592
|
await this.parsing(yamlContent);
|
|
748
593
|
} catch (error) {
|
|
749
|
-
this.logger.error(
|
|
750
|
-
error.message,
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
error.stack,
|
|
754
|
-
|
|
755
|
-
);
|
|
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
|
+
});
|
|
756
601
|
}
|
|
757
602
|
}
|
|
758
603
|
/**
|
|
@@ -779,13 +624,13 @@ var YamlParsing = class {
|
|
|
779
624
|
result[key] = value?.trim() || null;
|
|
780
625
|
}
|
|
781
626
|
} else {
|
|
782
|
-
this.logger.error(
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
content,
|
|
787
|
-
|
|
788
|
-
);
|
|
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
|
+
});
|
|
789
634
|
}
|
|
790
635
|
}
|
|
791
636
|
return result;
|
|
@@ -806,258 +651,13 @@ var Environment = class {
|
|
|
806
651
|
}
|
|
807
652
|
};
|
|
808
653
|
|
|
809
|
-
// src/core/config/database/connexion.config.database.ts
|
|
810
|
-
var import_mysql = __toESM(require("mysql"), 1);
|
|
811
|
-
var import_opticore_http_response8 = require("opticore-http-response");
|
|
812
|
-
var import_opticore_logger4 = require("opticore-logger");
|
|
813
|
-
var import_opticore_translator9 = require("opticore-translator");
|
|
814
|
-
|
|
815
|
-
// src/core/errors/databaseConnexion.error.ts
|
|
816
|
-
var import_opticore_http_response7 = require("opticore-http-response");
|
|
817
|
-
var import_opticore_catch_exception_error3 = require("opticore-catch-exception-error");
|
|
818
|
-
var import_opticore_translator8 = require("opticore-translator");
|
|
819
|
-
var DbConnexionConfigError = class {
|
|
820
|
-
logger;
|
|
821
|
-
localeLanguage;
|
|
822
|
-
constructor(localeLanguage, environnementPath) {
|
|
823
|
-
this.localeLanguage = localeLanguage;
|
|
824
|
-
this.logger = SLoggerFileConfiguration(environnementPath);
|
|
825
|
-
}
|
|
826
|
-
/**
|
|
827
|
-
*
|
|
828
|
-
* @param e
|
|
829
|
-
*/
|
|
830
|
-
mongoDBAuthenticationFailed(e) {
|
|
831
|
-
const stackTrace = this.traceError(
|
|
832
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { e }),
|
|
833
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBAuthentication", this.localeLanguage),
|
|
834
|
-
import_opticore_http_response7.HttpStatusCode.UNAUTHORIZED
|
|
835
|
-
);
|
|
836
|
-
this.logger.error(
|
|
837
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBAuthenticationError", this.localeLanguage),
|
|
838
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
839
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBAuthenticationFailed", this.localeLanguage),
|
|
840
|
-
stackTrace.stack,
|
|
841
|
-
import_opticore_http_response7.HttpStatusCode.UNAUTHORIZED
|
|
842
|
-
);
|
|
843
|
-
}
|
|
844
|
-
/**
|
|
845
|
-
*
|
|
846
|
-
* @param err
|
|
847
|
-
* @param dbHost
|
|
848
|
-
* @param dbPort
|
|
849
|
-
*/
|
|
850
|
-
mongoDBInvalidUrl(err, dbHost, dbPort) {
|
|
851
|
-
const stackTrace = this.traceError(
|
|
852
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { err }),
|
|
853
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBUnableParsingUrl", this.localeLanguage),
|
|
854
|
-
import_opticore_http_response7.HttpStatusCode.BAD_REQUEST
|
|
855
|
-
);
|
|
856
|
-
this.logger.error(
|
|
857
|
-
import_opticore_translator8.TranslationLoader.t("dbUrlParsingError", this.localeLanguage, { dbHost, dbPort }),
|
|
858
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
859
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBUnableParsingUrl", this.localeLanguage),
|
|
860
|
-
stackTrace.stack,
|
|
861
|
-
import_opticore_http_response7.HttpStatusCode.BAD_REQUEST
|
|
862
|
-
);
|
|
863
|
-
}
|
|
864
|
-
/**
|
|
865
|
-
*
|
|
866
|
-
* @param err
|
|
867
|
-
* @param dbHost
|
|
868
|
-
*/
|
|
869
|
-
mongoDBEaiAgain(err, dbHost) {
|
|
870
|
-
const stackTrace = this.traceError(
|
|
871
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { err }),
|
|
872
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBServerSelection", this.localeLanguage),
|
|
873
|
-
import_opticore_http_response7.HttpStatusCode.BAD_REQUEST
|
|
874
|
-
);
|
|
875
|
-
this.logger.error(
|
|
876
|
-
import_opticore_translator8.TranslationLoader.t("mongoServerError", this.localeLanguage, { dbHost }),
|
|
877
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
878
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBServerSelection", this.localeLanguage),
|
|
879
|
-
stackTrace.stack,
|
|
880
|
-
import_opticore_http_response7.HttpStatusCode.BAD_REQUEST
|
|
881
|
-
);
|
|
882
|
-
}
|
|
883
|
-
/**
|
|
884
|
-
*
|
|
885
|
-
* @param err
|
|
886
|
-
*/
|
|
887
|
-
mongoDbGlobalError(err) {
|
|
888
|
-
const stackTrace = this.traceError(
|
|
889
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { err }),
|
|
890
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
891
|
-
import_opticore_http_response7.HttpStatusCode.NOT_ACCEPTABLE
|
|
892
|
-
);
|
|
893
|
-
this.logger.error(
|
|
894
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
895
|
-
import_opticore_translator8.TranslationLoader.t("mongoDBConnectionError", this.localeLanguage),
|
|
896
|
-
stackTrace.stack,
|
|
897
|
-
err.message,
|
|
898
|
-
import_opticore_http_response7.HttpStatusCode.NOT_ACCEPTABLE
|
|
899
|
-
);
|
|
900
|
-
}
|
|
901
|
-
/**
|
|
902
|
-
*
|
|
903
|
-
* @param props
|
|
904
|
-
* @param name
|
|
905
|
-
* @param status
|
|
906
|
-
* @private
|
|
907
|
-
*/
|
|
908
|
-
traceError(props, name, status7) {
|
|
909
|
-
return new import_opticore_catch_exception_error3.StackTraceError(props, name, status7, true);
|
|
910
|
-
}
|
|
911
|
-
};
|
|
912
|
-
|
|
913
|
-
// src/core/config/database/connexion.config.database.ts
|
|
914
|
-
var import_opticore_catch_exception_error4 = require("opticore-catch-exception-error");
|
|
915
|
-
var DatabaseConnectionConfig = class {
|
|
916
|
-
env;
|
|
917
|
-
logger;
|
|
918
|
-
localeLanguage;
|
|
919
|
-
environnementPath;
|
|
920
|
-
DbConnexionConfigError;
|
|
921
|
-
constructor(localeLanguage, environnementPath) {
|
|
922
|
-
this.localeLanguage = localeLanguage;
|
|
923
|
-
this.environnementPath = environnementPath;
|
|
924
|
-
this.DbConnexionConfigError = new DbConnexionConfigError(localeLanguage, environnementPath);
|
|
925
|
-
this.env = new Environment(environnementPath);
|
|
926
|
-
this.logger = new import_opticore_logger4.LoggerCore(loggerConfig(environnementPath));
|
|
927
|
-
}
|
|
928
|
-
/**
|
|
929
|
-
*
|
|
930
|
-
* @param optionalArgumentConnection
|
|
931
|
-
*
|
|
932
|
-
* MySQL database connection with an optional arguments
|
|
933
|
-
* Establish the connection between app and Database Management System.
|
|
934
|
-
* Inside this class, a checker verifies if database credentials are right,
|
|
935
|
-
* and it's show off in the log that the connection has been created successfully.
|
|
936
|
-
* But if any error is occurring during trying connection, it'd specify that error by stack traces.
|
|
937
|
-
*/
|
|
938
|
-
databaseMySQLConnexionChecker(optionalArgumentConnection) {
|
|
939
|
-
const dbURL = `${this.env.get("dataBaseUser")}:${this.env.get("dataBasePassword")}@${this.env.get("dataBaseHost")}:${this.env.get("dataBasePort")}/${this.env.get("dataBaseName")}`;
|
|
940
|
-
let url = `mysql://${dbURL}?${optionalArgumentConnection}`;
|
|
941
|
-
const dbConnection = import_mysql.default.createConnection(url);
|
|
942
|
-
return SCheckerMySqlDatabaseConnection(this.localeLanguage, this.environnementPath, dbConnection, this.env.get("dataBaseUser"), this.env.get("dataBaseName"), this.env.get("dataBaseHost"), this.env.get("dataBasePassword"));
|
|
943
|
-
}
|
|
944
|
-
/**
|
|
945
|
-
*
|
|
946
|
-
* @param optionalArgumentConnection
|
|
947
|
-
*
|
|
948
|
-
* Mongo database connection with optional connection arguments
|
|
949
|
-
*/
|
|
950
|
-
async databaseMongoDBConnectionChecker(optionalArgumentConnection) {
|
|
951
|
-
const dbUrl = `${this.env.get("dataBaseUser")}:${this.env.get("dataBasePassword")}@${this.env.get("dataBaseHost")}:${this.env.get("dataBasePort")}/${this.env.get("dataBaseName")}`;
|
|
952
|
-
const url = `mongodb://${dbUrl}${optionalArgumentConnection}`;
|
|
953
|
-
try {
|
|
954
|
-
await SCheckerMongoDatabaseConnection(url, this.env.get("dataBaseUser"), this.env.get("dataBasePassword"), this.env.get("dataBaseName"));
|
|
955
|
-
this.logger.success(
|
|
956
|
-
import_opticore_translator9.TranslationLoader.t("mongoDBConnectionChecker", this.localeLanguage, loggerConfig),
|
|
957
|
-
import_opticore_translator9.TranslationLoader.t("mongoConnectionSuccess", this.localeLanguage, loggerConfig)
|
|
958
|
-
);
|
|
959
|
-
console.log("");
|
|
960
|
-
} catch (e) {
|
|
961
|
-
if (e.code === 18) {
|
|
962
|
-
this.DbConnexionConfigError.mongoDBAuthenticationFailed(e);
|
|
963
|
-
}
|
|
964
|
-
if (e.cause.code === "ERR_INVALID_URL") {
|
|
965
|
-
this.DbConnexionConfigError.mongoDBInvalidUrl(e, this.env.get("dataBaseHost"), this.env.get("dataBasePort"));
|
|
966
|
-
}
|
|
967
|
-
if (e.code === void 0) {
|
|
968
|
-
this.DbConnexionConfigError.mongoDBEaiAgain(e, this.env.get("dataBaseHost"));
|
|
969
|
-
} else {
|
|
970
|
-
this.DbConnexionConfigError.mongoDbGlobalError(e);
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
/**
|
|
975
|
-
*
|
|
976
|
-
* @param keepAlive
|
|
977
|
-
* @param stream
|
|
978
|
-
* @param statement_timeout
|
|
979
|
-
* @param ssl
|
|
980
|
-
* @param query_timeout
|
|
981
|
-
* @param keepAliveInitialDelayMillis
|
|
982
|
-
* @param idle_in_transaction_session_timeout
|
|
983
|
-
* @param application_name
|
|
984
|
-
* @param connectionTimeoutMillis
|
|
985
|
-
* @param types
|
|
986
|
-
* @param options
|
|
987
|
-
*
|
|
988
|
-
* Postgres database connection with optional connection arguments
|
|
989
|
-
*/
|
|
990
|
-
async databasePostgresDBConnectionChecker(keepAlive, stream, statement_timeout, ssl, query_timeout, keepAliveInitialDelayMillis, idle_in_transaction_session_timeout, application_name, connectionTimeoutMillis, types, options) {
|
|
991
|
-
const url = `postgresql:/${this.env.get("dataBaseUser")}:${this.env.get("dataBasePassword")}@${this.env.get("dataBaseHost")}:${this.env.get("dataBasePort")}/${this.env.get("dataBaseName")}`;
|
|
992
|
-
try {
|
|
993
|
-
await SCheckerPostgresDatabaseConnection(
|
|
994
|
-
this.localeLanguage,
|
|
995
|
-
this.environnementPath,
|
|
996
|
-
url,
|
|
997
|
-
keepAlive,
|
|
998
|
-
stream,
|
|
999
|
-
statement_timeout,
|
|
1000
|
-
ssl,
|
|
1001
|
-
query_timeout,
|
|
1002
|
-
keepAliveInitialDelayMillis,
|
|
1003
|
-
idle_in_transaction_session_timeout,
|
|
1004
|
-
application_name,
|
|
1005
|
-
connectionTimeoutMillis,
|
|
1006
|
-
types,
|
|
1007
|
-
options
|
|
1008
|
-
);
|
|
1009
|
-
this.logger.success(
|
|
1010
|
-
import_opticore_translator9.TranslationLoader.t("postgresDBConnectionChecker", this.localeLanguage, loggerConfig),
|
|
1011
|
-
import_opticore_translator9.TranslationLoader.t("postgresConnectionSuccess", this.localeLanguage, loggerConfig)
|
|
1012
|
-
);
|
|
1013
|
-
console.log("");
|
|
1014
|
-
} catch (err) {
|
|
1015
|
-
const stackTrace = this.traceError(import_opticore_translator9.TranslationLoader.t(`${err.message}`, this.localeLanguage, loggerConfig), "PostgresConnectionError", import_opticore_http_response8.HttpStatusCode.NOT_ACCEPTABLE);
|
|
1016
|
-
this.logger.error(err.message, "PostgresConnectionError", "Postgres connection error", stackTrace.stack, import_opticore_http_response8.HttpStatusCode.NOT_ACCEPTABLE);
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
traceError(props, name, status7) {
|
|
1020
|
-
return new import_opticore_catch_exception_error4.StackTraceError(props, name, status7, true);
|
|
1021
|
-
}
|
|
1022
|
-
};
|
|
1023
|
-
|
|
1024
|
-
// src/core/config/database/middleware/mongoChecker.database.ts
|
|
1025
|
-
var MMongoCheckerDatabase = (optionalArgumentConnection, localLanguage, environnementPath) => {
|
|
1026
|
-
const DbConnexion = new DatabaseConnectionConfig(localLanguage, environnementPath);
|
|
1027
|
-
return DbConnexion.databaseMongoDBConnectionChecker(optionalArgumentConnection);
|
|
1028
|
-
};
|
|
1029
|
-
|
|
1030
|
-
// src/core/config/database/middleware/mySqlChecker.database.ts
|
|
1031
|
-
var MMySqlCheckerDatabase = (optionalArgumentConnection, localLanguage, environnementPath) => {
|
|
1032
|
-
const DbConnexion = new DatabaseConnectionConfig(localLanguage, environnementPath);
|
|
1033
|
-
return DbConnexion.databaseMySQLConnexionChecker(optionalArgumentConnection);
|
|
1034
|
-
};
|
|
1035
|
-
|
|
1036
|
-
// src/core/config/database/middleware/postgresChecker.database.ts
|
|
1037
|
-
var MPostgresCheckerDatabase = (localLanguage, environnementPath, keepAlive, stream, statement_timeout, ssl, query_timeout, keepAliveInitialDelayMillis, idle_in_transaction_session_timeout, application_name, connectionTimeoutMillis, types, options) => {
|
|
1038
|
-
const DbConnexion = new DatabaseConnectionConfig(localLanguage, environnementPath);
|
|
1039
|
-
return DbConnexion.databasePostgresDBConnectionChecker(
|
|
1040
|
-
keepAlive,
|
|
1041
|
-
stream,
|
|
1042
|
-
statement_timeout,
|
|
1043
|
-
ssl,
|
|
1044
|
-
query_timeout,
|
|
1045
|
-
keepAliveInitialDelayMillis,
|
|
1046
|
-
idle_in_transaction_session_timeout,
|
|
1047
|
-
application_name,
|
|
1048
|
-
connectionTimeoutMillis,
|
|
1049
|
-
types,
|
|
1050
|
-
options
|
|
1051
|
-
);
|
|
1052
|
-
};
|
|
1053
|
-
|
|
1054
654
|
// src/utils/utility.utils.ts
|
|
1055
655
|
var import_node_process = __toESM(require("process"), 1);
|
|
1056
656
|
var import_chalk = __toESM(require("chalk"), 1);
|
|
1057
657
|
var import_ansi_colors = __toESM(require("ansi-colors"), 1);
|
|
1058
|
-
var
|
|
658
|
+
var import_path3 = __toESM(require("path"), 1);
|
|
1059
659
|
var import_fs = __toESM(require("fs"), 1);
|
|
1060
|
-
var
|
|
660
|
+
var import_opticore_translator5 = require("opticore-translator");
|
|
1061
661
|
var Utility = class {
|
|
1062
662
|
localLang;
|
|
1063
663
|
constructor(localLanguage) {
|
|
@@ -1122,7 +722,7 @@ var Utility = class {
|
|
|
1122
722
|
const endTime = import_node_process.default.hrtime(startTime);
|
|
1123
723
|
const executionTime = (endTime[0] * 1e9 + endTime[1]) / 1e6;
|
|
1124
724
|
return {
|
|
1125
|
-
"projectPath":
|
|
725
|
+
"projectPath": import_path3.default.join(import_node_process.default.cwd()),
|
|
1126
726
|
"startingTime": `${executionTime.toFixed(5)} ms`
|
|
1127
727
|
};
|
|
1128
728
|
}
|
|
@@ -1132,7 +732,7 @@ var Utility = class {
|
|
|
1132
732
|
* @private
|
|
1133
733
|
*/
|
|
1134
734
|
getEnvFileLoading(filePath) {
|
|
1135
|
-
const fullPath =
|
|
735
|
+
const fullPath = import_path3.default.resolve(import_node_process.default.cwd(), filePath);
|
|
1136
736
|
if (import_fs.default.existsSync(fullPath)) {
|
|
1137
737
|
const env = import_fs.default.readFileSync(fullPath, "utf-8");
|
|
1138
738
|
const lines = env.split("\n");
|
|
@@ -1154,19 +754,19 @@ var Utility = class {
|
|
|
1154
754
|
this.getEnvFileLoading(".env");
|
|
1155
755
|
const isDevelopment = import_node_process.default.env.NODE_ENV === "development";
|
|
1156
756
|
if (isDevelopment) {
|
|
1157
|
-
return `${
|
|
757
|
+
return `${import_opticore_translator5.TranslationLoader.t("serverRunning", this.localLang)} ${import_ansi_colors.default.bgBlue(`${import_ansi_colors.default.bold(`${development}`)}`)} mode`;
|
|
1158
758
|
} else {
|
|
1159
|
-
return `${
|
|
759
|
+
return `${import_opticore_translator5.TranslationLoader.t("serverRunning", this.localLang)} ${import_ansi_colors.default.bgBlue(`${import_ansi_colors.default.bold(`${production}`)}`)} mode`;
|
|
1160
760
|
}
|
|
1161
761
|
}
|
|
1162
762
|
infoServer(nodeVersion, startingTime, host, port, rss, heapUsed, user, system) {
|
|
1163
763
|
const paddingLength = 52;
|
|
1164
764
|
const msg0 = " ".padEnd(paddingLength, " ");
|
|
1165
|
-
const msg1 = ` ${
|
|
765
|
+
const msg1 = ` ${import_opticore_translator5.TranslationLoader.t("okServerListening", this.localLang)}`;
|
|
1166
766
|
const msg2Value = `${import_ansi_colors.default.bgBlue(`${import_ansi_colors.default.bold(`${nodeVersion}`)}`)}`;
|
|
1167
|
-
const msg2 = ` ${
|
|
767
|
+
const msg2 = ` ${import_opticore_translator5.TranslationLoader.t("webServerUseNodeVersion", this.localLang)}`;
|
|
1168
768
|
const msg3Value = `${import_ansi_colors.default.bgBlue(`${import_ansi_colors.default.bold(`${startingTime}`)}`)}`;
|
|
1169
|
-
const msg3 = ` ${
|
|
769
|
+
const msg3 = ` ${import_opticore_translator5.TranslationLoader.t("startupTime", this.localLang)}`;
|
|
1170
770
|
const msg4 = ` ${this.getServerRunningMode("development", "production")}`;
|
|
1171
771
|
const msg5 = ` ${import_ansi_colors.default.underline(`http://${host}:${port}`)}`;
|
|
1172
772
|
console.log(import_chalk.default.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
@@ -1177,18 +777,18 @@ var Utility = class {
|
|
|
1177
777
|
console.log(import_chalk.default.bgGreen.white(msg5.padEnd(61, " ")));
|
|
1178
778
|
console.log(import_chalk.default.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
1179
779
|
console.log(``);
|
|
1180
|
-
console.log(`${`${
|
|
1181
|
-
console.log(`${`${
|
|
1182
|
-
console.log(`${`${
|
|
1183
|
-
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}`)}`)}`);
|
|
1184
784
|
console.log(``);
|
|
1185
785
|
}
|
|
1186
786
|
};
|
|
1187
787
|
|
|
1188
788
|
// src/core/events/pathModuleVerifier.event.ts
|
|
1189
|
-
var
|
|
1190
|
-
var
|
|
1191
|
-
var
|
|
789
|
+
var import_path4 = require("path");
|
|
790
|
+
var import_opticore_http_response5 = require("opticore-http-response");
|
|
791
|
+
var import_opticore_translator6 = require("opticore-translator");
|
|
1192
792
|
var PathModuleVerifier = class {
|
|
1193
793
|
log;
|
|
1194
794
|
localeLanguage;
|
|
@@ -1209,13 +809,13 @@ var PathModuleVerifier = class {
|
|
|
1209
809
|
}
|
|
1210
810
|
}
|
|
1211
811
|
if (notLoadedPaths.length > 0) {
|
|
1212
|
-
this.log.error(
|
|
1213
|
-
|
|
1214
|
-
"",
|
|
1215
|
-
"",
|
|
1216
|
-
modulePaths,
|
|
1217
|
-
|
|
1218
|
-
);
|
|
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
|
+
});
|
|
1219
819
|
throw new Error();
|
|
1220
820
|
}
|
|
1221
821
|
}
|
|
@@ -1226,7 +826,7 @@ var PathModuleVerifier = class {
|
|
|
1226
826
|
*/
|
|
1227
827
|
isModulePathLoaded(modulePath) {
|
|
1228
828
|
try {
|
|
1229
|
-
const resolvedPath = (0,
|
|
829
|
+
const resolvedPath = (0, import_path4.resolve)(modulePath);
|
|
1230
830
|
return require.cache[resolvedPath] !== void 0;
|
|
1231
831
|
} catch {
|
|
1232
832
|
return false;
|
|
@@ -1235,9 +835,9 @@ var PathModuleVerifier = class {
|
|
|
1235
835
|
};
|
|
1236
836
|
|
|
1237
837
|
// src/core/config/loaders/localLanguage.loader.ts
|
|
1238
|
-
var
|
|
1239
|
-
var
|
|
1240
|
-
var
|
|
838
|
+
var import_path5 = __toESM(require("path"), 1);
|
|
839
|
+
var import_opticore_translator7 = require("opticore-translator");
|
|
840
|
+
var import_opticore_http_response6 = require("opticore-http-response");
|
|
1241
841
|
var LocalLanguageLoader = class {
|
|
1242
842
|
localeLanguage;
|
|
1243
843
|
environnementPath;
|
|
@@ -1247,22 +847,18 @@ var LocalLanguageLoader = class {
|
|
|
1247
847
|
}
|
|
1248
848
|
load() {
|
|
1249
849
|
try {
|
|
1250
|
-
const translateMsgJsonFilePath =
|
|
1251
|
-
|
|
850
|
+
const translateMsgJsonFilePath = import_path5.default.join(process.cwd(), "src", "utils", "translations");
|
|
851
|
+
import_opticore_translator7.TranslationLoader.loadTranslations(translateMsgJsonFilePath);
|
|
1252
852
|
} catch (err) {
|
|
1253
|
-
SLoggerFileConfiguration(this.environnementPath).error(
|
|
1254
|
-
|
|
1255
|
-
err.
|
|
1256
|
-
err.code,
|
|
1257
|
-
err.
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
);
|
|
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
|
+
});
|
|
1261
860
|
}
|
|
1262
861
|
}
|
|
1263
|
-
absolutPath() {
|
|
1264
|
-
return import_path4.default.join(process.cwd(), "src", "utils", "translations");
|
|
1265
|
-
}
|
|
1266
862
|
};
|
|
1267
863
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1268
864
|
0 && (module.exports = {
|
|
@@ -1270,18 +866,11 @@ var LocalLanguageLoader = class {
|
|
|
1270
866
|
CSignRSAKeyComponent,
|
|
1271
867
|
Environment,
|
|
1272
868
|
LocalLanguageLoader,
|
|
1273
|
-
MMongoCheckerDatabase,
|
|
1274
|
-
MMySqlCheckerDatabase,
|
|
1275
|
-
MPostgresCheckerDatabase,
|
|
1276
869
|
PathModuleVerifier,
|
|
1277
870
|
RSAKeyDecryption,
|
|
1278
871
|
RSAKeyEncryption,
|
|
1279
872
|
SAsymmetricCryptionDataWithPrivateRSAKey,
|
|
1280
873
|
SAsymmetricCryptionDataWithPublicRSAKey,
|
|
1281
|
-
SCheckerMongoDatabaseConnection,
|
|
1282
|
-
SCheckerMySqlDatabaseConnection,
|
|
1283
|
-
SCheckerPostgresDatabaseConnection,
|
|
1284
|
-
UOptionalArgumentConnection,
|
|
1285
874
|
Utility,
|
|
1286
875
|
YamlParsing,
|
|
1287
876
|
dateTimeFormatted,
|