opticore-webapp-core 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -44,11 +44,11 @@ __export(index_exports, {
44
44
  SCheckerMongoDatabaseConnection: () => SCheckerMongoDatabaseConnection,
45
45
  SCheckerMySqlDatabaseConnection: () => SCheckerMySqlDatabaseConnection,
46
46
  SCheckerPostgresDatabaseConnection: () => SCheckerPostgresDatabaseConnection,
47
+ UOptionalArgumentConnection: () => UOptionalArgumentConnection,
47
48
  Utility: () => Utility,
48
49
  YamlParsing: () => YamlParsing,
49
50
  dateTimeFormatted: () => dateTimeFormatted,
50
- loggerConfig: () => loggerConfig,
51
- optionalArgumentConnectionUtil: () => optionalArgumentConnectionUtil
51
+ loggerConfig: () => loggerConfig
52
52
  });
53
53
  module.exports = __toCommonJS(index_exports);
54
54
 
@@ -193,41 +193,45 @@ var import_opticore_logger = require("opticore-logger");
193
193
 
194
194
  // src/core/config/logger/logger.config.ts
195
195
  var import_opticore_env_access = require("opticore-env-access");
196
- var loggerConfig = {
197
- logLevels: [
198
- import_opticore_env_access.getEnvVariable.logLevelInfo,
199
- import_opticore_env_access.getEnvVariable.logLevelWarning,
200
- import_opticore_env_access.getEnvVariable.logLevelSuccess,
201
- import_opticore_env_access.getEnvVariable.logLevelError,
202
- import_opticore_env_access.getEnvVariable.logLevelDebug
203
- ],
204
- transports: {
205
- file: {
206
- enabled: import_opticore_env_access.getEnvVariable.logFileEnabled,
207
- maxSizeMB: import_opticore_env_access.getEnvVariable.logFileMaxSize,
208
- rotate: import_opticore_env_access.getEnvVariable.logFileRotate
209
- },
210
- console: {
211
- enabled: import_opticore_env_access.getEnvVariable.logConsoleEnabled
212
- },
213
- remote: {
214
- enabled: import_opticore_env_access.getEnvVariable.logRemoteEnabled,
215
- endpoint: import_opticore_env_access.getEnvVariable.logRemoteEndPoint
196
+ var loggerConfig = (envDir) => {
197
+ const getEnvAccess = (0, import_opticore_env_access.getEnvironnementValue)(envDir);
198
+ return {
199
+ logLevels: [
200
+ getEnvAccess.logLevelInfo,
201
+ getEnvAccess.logLevelWarning,
202
+ getEnvAccess.logLevelSuccess,
203
+ getEnvAccess.logLevelError,
204
+ getEnvAccess.logLevelDebug
205
+ ],
206
+ transports: {
207
+ file: {
208
+ enabled: getEnvAccess.logFileEnabled,
209
+ maxSizeMB: getEnvAccess.logFileMaxSize,
210
+ rotate: getEnvAccess.logFileRotate
211
+ },
212
+ console: {
213
+ enabled: getEnvAccess.logConsoleEnabled
214
+ },
215
+ remote: {
216
+ enabled: getEnvAccess.logRemoteEnabled,
217
+ endpoint: getEnvAccess.logRemoteEndPoint
218
+ }
216
219
  }
217
- }
220
+ };
218
221
  };
219
222
 
220
223
  // src/application/services/loggerFileConfiguration.service.ts
221
- var SLoggerFileConfiguration = () => {
222
- return new import_opticore_logger.LoggerCore(loggerConfig);
224
+ var SLoggerFileConfiguration = (environnementPath) => {
225
+ return new import_opticore_logger.LoggerCore(loggerConfig(environnementPath));
223
226
  };
224
227
 
225
228
  // src/application/services/asymmetricCryptionDataWithPrivateRSAKey.service.ts
226
229
  var SAsymmetricCryptionDataWithPrivateRSAKey = class {
227
- log = SLoggerFileConfiguration();
230
+ log;
228
231
  localeLanguage;
229
- constructor(localeLanguage) {
232
+ constructor(localeLanguage, environnementPath) {
230
233
  this.localeLanguage = localeLanguage;
234
+ this.log = SLoggerFileConfiguration(environnementPath);
231
235
  }
232
236
  /**
233
237
  *
@@ -388,10 +392,11 @@ var import_opticore_translator2 = require("opticore-translator");
388
392
  var import_opticore_http_response2 = require("opticore-http-response");
389
393
  var import_opticore_catch_exception_error2 = require("opticore-catch-exception-error");
390
394
  var SAsymmetricCryptionDataWithPublicRSAKey = class {
391
- logger = SLoggerFileConfiguration();
395
+ logger;
392
396
  localeLanguage;
393
- constructor(localeLanguage) {
397
+ constructor(localeLanguage, environnementPath) {
394
398
  this.localeLanguage = localeLanguage;
399
+ this.logger = SLoggerFileConfiguration(environnementPath);
395
400
  }
396
401
  /**
397
402
  *
@@ -556,8 +561,8 @@ async function SCheckerMongoDatabaseConnection(url, user, password, dbName) {
556
561
  var import_opticore_logger2 = require("opticore-logger");
557
562
  var import_opticore_http_response3 = require("opticore-http-response");
558
563
  var import_opticore_translator3 = require("opticore-translator");
559
- function mySqlErrorHandlerDatabase(localLanguage, err, dbHost, database, user, password) {
560
- const logger = new import_opticore_logger2.LoggerCore(loggerConfig);
564
+ function mySqlErrorHandlerDatabase(localLanguage, environnementPath, err, dbHost, database, user, password) {
565
+ const logger = new import_opticore_logger2.LoggerCore(loggerConfig(environnementPath));
561
566
  switch (err.code) {
562
567
  case "EAI_AGAIN":
563
568
  logger.error(
@@ -609,11 +614,11 @@ function mySqlErrorHandlerDatabase(localLanguage, err, dbHost, database, user, p
609
614
 
610
615
  // src/application/services/checkerMySqlDatabaseConnection.service.ts
611
616
  var import_opticore_translator4 = require("opticore-translator");
612
- function SCheckerMySqlDatabaseConnection(localeLanguage, dbConnection, user, database, dbHost, password) {
613
- const logger = SLoggerFileConfiguration();
617
+ function SCheckerMySqlDatabaseConnection(localeLanguage, environnementPath, dbConnection, user, database, dbHost, password) {
618
+ const logger = SLoggerFileConfiguration(environnementPath);
614
619
  dbConnection.connect((err) => {
615
620
  if (err) {
616
- return mySqlErrorHandlerDatabase(localeLanguage, err, dbHost, database, user, password);
621
+ return mySqlErrorHandlerDatabase(localeLanguage, environnementPath, err, dbHost, database, user, password);
617
622
  } else {
618
623
  logger.success(
619
624
  import_opticore_translator4.TranslationLoader.t("dbConnection", localeLanguage, logger),
@@ -621,7 +626,7 @@ function SCheckerMySqlDatabaseConnection(localeLanguage, dbConnection, user, dat
621
626
  );
622
627
  return dbConnection.end((endConErr) => {
623
628
  if (endConErr) {
624
- return mySqlErrorHandlerDatabase(localeLanguage, err, dbHost, database, user, password);
629
+ return mySqlErrorHandlerDatabase(localeLanguage, environnementPath, err, dbHost, database, user, password);
625
630
  } else {
626
631
  logger.success(
627
632
  import_opticore_translator4.TranslationLoader.t("dbConnection", localeLanguage, logger),
@@ -638,8 +643,8 @@ function SCheckerMySqlDatabaseConnection(localeLanguage, dbConnection, user, dat
638
643
  var import_opticore_http_response4 = require("opticore-http-response");
639
644
  var import_pg = __toESM(require("pg"), 1);
640
645
  var import_opticore_translator5 = require("opticore-translator");
641
- async function SCheckerPostgresDatabaseConnection(localeLanguage, connectionString, keepAlive, stream, statement_timeout, ssl, query_timeout, keepAliveInitialDelayMillis, idle_in_transaction_session_timeout, application_name, connectionTimeoutMillis, types, options) {
642
- const logger = SLoggerFileConfiguration();
646
+ async function SCheckerPostgresDatabaseConnection(localeLanguage, environnementPath, connectionString, keepAlive, stream, statement_timeout, ssl, query_timeout, keepAliveInitialDelayMillis, idle_in_transaction_session_timeout, application_name, connectionTimeoutMillis, types, options) {
647
+ const logger = SLoggerFileConfiguration(environnementPath);
643
648
  const configOptions = {
644
649
  connectionString,
645
650
  keepAlive,
@@ -693,7 +698,10 @@ var CLogLevel = {
693
698
 
694
699
  // src/utils/connection/optionalArgumentConnection.util.ts
695
700
  var import_opticore_env_access2 = require("opticore-env-access");
696
- var optionalArgumentConnectionUtil = import_opticore_env_access2.getEnvVariable.argumentsDatabaseConnection;
701
+ var UOptionalArgumentConnection = (environnementPath) => {
702
+ const envPath = (0, import_opticore_env_access2.getEnvironnementValue)(environnementPath);
703
+ return envPath.argumentsDatabaseConnection;
704
+ };
697
705
 
698
706
  // src/utils/parsing/parsingYaml.utils.ts
699
707
  var import_promises = require("fs/promises");
@@ -714,10 +722,11 @@ var translateWebAppCoreLanguageLoader = () => {
714
722
 
715
723
  // src/utils/parsing/parsingYaml.utils.ts
716
724
  var YamlParsing = class {
717
- logger = new import_opticore_logger3.LoggerCore(loggerConfig);
725
+ logger;
718
726
  localeLanguage;
719
- constructor(localeLanguage) {
727
+ constructor(localeLanguage, environnementPath) {
720
728
  this.localeLanguage = localeLanguage;
729
+ this.logger = new import_opticore_logger3.LoggerCore(loggerConfig(environnementPath));
721
730
  translateWebAppCoreLanguageLoader();
722
731
  }
723
732
  async readFile(filePath) {
@@ -788,20 +797,19 @@ var Environment = class {
788
797
  // src/core/config/database/connexion.config.database.ts
789
798
  var import_mysql = __toESM(require("mysql"), 1);
790
799
  var import_opticore_http_response7 = require("opticore-http-response");
791
- var import_opticore_env_access3 = require("opticore-env-access");
792
- var import_opticore_logger5 = require("opticore-logger");
800
+ var import_opticore_logger4 = require("opticore-logger");
793
801
  var import_opticore_translator9 = require("opticore-translator");
794
802
 
795
803
  // src/core/errors/databaseConnexion.error.ts
796
804
  var import_opticore_http_response6 = require("opticore-http-response");
797
- var import_opticore_logger4 = require("opticore-logger");
798
805
  var import_opticore_catch_exception_error3 = require("opticore-catch-exception-error");
799
806
  var import_opticore_translator8 = require("opticore-translator");
800
807
  var DbConnexionConfigError = class {
801
- logger = new import_opticore_logger4.LoggerCore(loggerConfig);
808
+ logger;
802
809
  localeLanguage;
803
- constructor(localeLanguage) {
810
+ constructor(localeLanguage, environnementPath) {
804
811
  this.localeLanguage = localeLanguage;
812
+ this.logger = SLoggerFileConfiguration(environnementPath);
805
813
  }
806
814
  /**
807
815
  *
@@ -893,13 +901,17 @@ var DbConnexionConfigError = class {
893
901
  // src/core/config/database/connexion.config.database.ts
894
902
  var import_opticore_catch_exception_error4 = require("opticore-catch-exception-error");
895
903
  var DatabaseConnectionConfig = class {
896
- env = new Environment(import_opticore_env_access3.getEnvVariable);
897
- logger = new import_opticore_logger5.LoggerCore(loggerConfig);
904
+ env;
905
+ logger;
898
906
  localeLanguage;
907
+ environnementPath;
899
908
  DbConnexionConfigError;
900
- constructor(localeLanguage) {
909
+ constructor(localeLanguage, environnementPath) {
901
910
  this.localeLanguage = localeLanguage;
902
- this.DbConnexionConfigError = new DbConnexionConfigError(localeLanguage);
911
+ this.environnementPath = environnementPath;
912
+ this.DbConnexionConfigError = new DbConnexionConfigError(localeLanguage, environnementPath);
913
+ this.env = new Environment(environnementPath);
914
+ this.logger = new import_opticore_logger4.LoggerCore(loggerConfig(environnementPath));
903
915
  }
904
916
  /**
905
917
  *
@@ -915,7 +927,7 @@ var DatabaseConnectionConfig = class {
915
927
  const dbURL = `${this.env.get("dataBaseUser")}:${this.env.get("dataBasePassword")}@${this.env.get("dataBaseHost")}:${this.env.get("dataBasePort")}/${this.env.get("dataBaseName")}`;
916
928
  let url = `mysql://${dbURL}?${optionalArgumentConnection}`;
917
929
  const dbConnection = import_mysql.default.createConnection(url);
918
- return SCheckerMySqlDatabaseConnection(this.localeLanguage, dbConnection, this.env.get("dataBaseUser"), this.env.get("dataBaseName"), this.env.get("dataBaseHost"), this.env.get("dataBasePassword"));
930
+ return SCheckerMySqlDatabaseConnection(this.localeLanguage, this.environnementPath, dbConnection, this.env.get("dataBaseUser"), this.env.get("dataBaseName"), this.env.get("dataBaseHost"), this.env.get("dataBasePassword"));
919
931
  }
920
932
  /**
921
933
  *
@@ -968,6 +980,7 @@ var DatabaseConnectionConfig = class {
968
980
  try {
969
981
  await SCheckerPostgresDatabaseConnection(
970
982
  this.localeLanguage,
983
+ this.environnementPath,
971
984
  url,
972
985
  keepAlive,
973
986
  stream,
@@ -1007,20 +1020,20 @@ var DatabaseConnectionConfig = class {
1007
1020
  };
1008
1021
 
1009
1022
  // src/core/config/database/middleware/mongoChecker.database.ts
1010
- var MMongoCheckerDatabase = (optionalArgumentConnection, localLanguage) => {
1011
- const DbConnexion = new DatabaseConnectionConfig(localLanguage);
1023
+ var MMongoCheckerDatabase = (optionalArgumentConnection, localLanguage, environnementPath) => {
1024
+ const DbConnexion = new DatabaseConnectionConfig(localLanguage, environnementPath);
1012
1025
  return DbConnexion.databaseMongoDBConnectionChecker(optionalArgumentConnection);
1013
1026
  };
1014
1027
 
1015
1028
  // src/core/config/database/middleware/mySqlChecker.database.ts
1016
- var MMySqlCheckerDatabase = (optionalArgumentConnection, localLanguage) => {
1017
- const DbConnexion = new DatabaseConnectionConfig(localLanguage);
1029
+ var MMySqlCheckerDatabase = (optionalArgumentConnection, localLanguage, environnementPath) => {
1030
+ const DbConnexion = new DatabaseConnectionConfig(localLanguage, environnementPath);
1018
1031
  return DbConnexion.databaseMySQLConnexionChecker(optionalArgumentConnection);
1019
1032
  };
1020
1033
 
1021
1034
  // src/core/config/database/middleware/postgresChecker.database.ts
1022
- var MPostgresCheckerDatabase = (localLanguage, keepAlive, stream, statement_timeout, ssl, query_timeout, keepAliveInitialDelayMillis, idle_in_transaction_session_timeout, application_name, connectionTimeoutMillis, types, options) => {
1023
- const DbConnexion = new DatabaseConnectionConfig(localLanguage);
1035
+ var MPostgresCheckerDatabase = (localLanguage, environnementPath, keepAlive, stream, statement_timeout, ssl, query_timeout, keepAliveInitialDelayMillis, idle_in_transaction_session_timeout, application_name, connectionTimeoutMillis, types, options) => {
1036
+ const DbConnexion = new DatabaseConnectionConfig(localLanguage, environnementPath);
1024
1037
  return DbConnexion.databasePostgresDBConnectionChecker(
1025
1038
  keepAlive,
1026
1039
  stream,
@@ -1172,14 +1185,14 @@ var Utility = class {
1172
1185
 
1173
1186
  // src/core/events/pathModuleVerifier.event.ts
1174
1187
  var import_path3 = require("path");
1175
- var import_opticore_logger6 = require("opticore-logger");
1176
1188
  var import_opticore_http_response8 = require("opticore-http-response");
1177
1189
  var import_opticore_translator11 = require("opticore-translator");
1178
1190
  var PathModuleVerifier = class {
1179
- log = new import_opticore_logger6.LoggerCore(loggerConfig);
1191
+ log;
1180
1192
  localeLanguage;
1181
- constructor(localeLanguage) {
1193
+ constructor(localeLanguage, environnementPath) {
1182
1194
  this.localeLanguage = localeLanguage;
1195
+ this.log = SLoggerFileConfiguration(environnementPath);
1183
1196
  }
1184
1197
  /**
1185
1198
  * Verifies if modules at specific paths are loaded.
@@ -1234,9 +1247,9 @@ var PathModuleVerifier = class {
1234
1247
  SCheckerMongoDatabaseConnection,
1235
1248
  SCheckerMySqlDatabaseConnection,
1236
1249
  SCheckerPostgresDatabaseConnection,
1250
+ UOptionalArgumentConnection,
1237
1251
  Utility,
1238
1252
  YamlParsing,
1239
1253
  dateTimeFormatted,
1240
- loggerConfig,
1241
- optionalArgumentConnectionUtil
1254
+ loggerConfig
1242
1255
  });
package/dist/index.d.cts CHANGED
@@ -6,9 +6,9 @@ import stream from 'stream';
6
6
  import { ServerResponse, IncomingMessage } from 'node:http';
7
7
 
8
8
  declare class SAsymmetricCryptionDataWithPrivateRSAKey {
9
- private log;
9
+ private readonly log;
10
10
  private readonly localeLanguage;
11
- constructor(localeLanguage: string);
11
+ constructor(localeLanguage: string, environnementPath: any);
12
12
  /**
13
13
  *
14
14
  * @param rsaKey
@@ -60,9 +60,9 @@ declare class SAsymmetricCryptionDataWithPrivateRSAKey {
60
60
  }
61
61
 
62
62
  declare class SAsymmetricCryptionDataWithPublicRSAKey {
63
- private logger;
63
+ private readonly logger;
64
64
  private readonly localeLanguage;
65
- constructor(localeLanguage: string);
65
+ constructor(localeLanguage: string, environnementPath: any);
66
66
  /**
67
67
  *
68
68
  * @param rsaKey
@@ -119,6 +119,7 @@ declare function SCheckerMongoDatabaseConnection(url: string, user: string | any
119
119
 
120
120
  /**
121
121
  *
122
+ * @param environnementPath
122
123
  * @param dbConnection
123
124
  * @param user
124
125
  * @param database
@@ -129,9 +130,9 @@ declare function SCheckerMongoDatabaseConnection(url: string, user: string | any
129
130
  *
130
131
  * Return void
131
132
  */
132
- declare function SCheckerMySqlDatabaseConnection(localeLanguage: string, dbConnection: mySQL.Connection, user: string, database: string, dbHost: string, password: string): void;
133
+ declare function SCheckerMySqlDatabaseConnection(localeLanguage: string, environnementPath: any, dbConnection: mySQL.Connection, user: string, database: string, dbHost: string, password: string): void;
133
134
 
134
- declare function SCheckerPostgresDatabaseConnection(localeLanguage: string, connectionString: any, keepAlive?: boolean | undefined, stream?: any, statement_timeout?: false | number | undefined, ssl?: boolean | ConnectionOptions | undefined, query_timeout?: number | undefined, keepAliveInitialDelayMillis?: number | undefined, idle_in_transaction_session_timeout?: number | undefined, application_name?: string | undefined, connectionTimeoutMillis?: number | undefined, types?: CustomTypesConfig | undefined, options?: string | undefined): Promise<void>;
135
+ declare function SCheckerPostgresDatabaseConnection(localeLanguage: string, environnementPath: any, connectionString: any, keepAlive?: boolean | undefined, stream?: any, statement_timeout?: false | number | undefined, ssl?: boolean | ConnectionOptions | undefined, query_timeout?: number | undefined, keepAliveInitialDelayMillis?: number | undefined, idle_in_transaction_session_timeout?: number | undefined, application_name?: string | undefined, connectionTimeoutMillis?: number | undefined, types?: CustomTypesConfig | undefined, options?: string | undefined): Promise<void>;
135
136
 
136
137
  declare const CLogLevel: {
137
138
  readonly debug: "DEBUG";
@@ -159,7 +160,7 @@ declare const CLogLevel: {
159
160
  *
160
161
  * ---------------------------------------------------------------------------------------------------------------------------------
161
162
  */
162
- declare const optionalArgumentConnectionUtil: string;
163
+ declare const UOptionalArgumentConnection: (environnementPath: any) => string;
163
164
 
164
165
  /**
165
166
  * This class contains methods that allow to decrypt data using public and private keys.
@@ -179,9 +180,9 @@ declare class RSAKeyEncryption {
179
180
  }
180
181
 
181
182
  declare class YamlParsing {
182
- private logger;
183
+ private readonly logger;
183
184
  private readonly localeLanguage;
184
- constructor(localeLanguage: string);
185
+ constructor(localeLanguage: string, environnementPath: any);
185
186
  readFile(filePath: string): Promise<void>;
186
187
  /**
187
188
  *
@@ -202,13 +203,17 @@ declare class Environment<T> {
202
203
  get<K extends keyof T>(key: K): T[K];
203
204
  }
204
205
 
205
- declare const MMongoCheckerDatabase: (optionalArgumentConnection: string | any, localLanguage: string) => Promise<void>;
206
+ declare const MMongoCheckerDatabase: (optionalArgumentConnection: string | any, localLanguage: string, environnementPath: any) => Promise<void>;
206
207
 
207
- declare const MMySqlCheckerDatabase: (optionalArgumentConnection: string | any, localLanguage: string) => void;
208
+ declare const MMySqlCheckerDatabase: (optionalArgumentConnection: string | any, localLanguage: string, environnementPath: any) => void;
208
209
 
209
- declare const MPostgresCheckerDatabase: (localLanguage: string, keepAlive?: boolean | undefined, stream?: (() => (stream.Duplex | undefined)) | undefined, statement_timeout?: false | number | undefined, ssl?: boolean | ConnectionOptions | undefined, query_timeout?: number | undefined, keepAliveInitialDelayMillis?: number | undefined, idle_in_transaction_session_timeout?: number | undefined, application_name?: string | undefined, connectionTimeoutMillis?: number | undefined, types?: CustomTypesConfig | undefined, options?: string | undefined) => Promise<void>;
210
+ declare const MPostgresCheckerDatabase: (localLanguage: string, environnementPath: any, keepAlive?: boolean | undefined, stream?: (() => (stream.Duplex | undefined)) | undefined, statement_timeout?: false | number | undefined, ssl?: boolean | ConnectionOptions | undefined, query_timeout?: number | undefined, keepAliveInitialDelayMillis?: number | undefined, idle_in_transaction_session_timeout?: number | undefined, application_name?: string | undefined, connectionTimeoutMillis?: number | undefined, types?: CustomTypesConfig | undefined, options?: string | undefined) => Promise<void>;
210
211
 
211
- declare const loggerConfig: {
212
+ /**
213
+ *
214
+ * @param envDir
215
+ */
216
+ declare const loggerConfig: (envDir: any) => {
212
217
  logLevels: string[];
213
218
  transports: {
214
219
  file: {
@@ -308,7 +313,7 @@ declare const CSignRSAKeyComponent: {
308
313
  };
309
314
 
310
315
  declare class Utility {
311
- private localLang;
316
+ private readonly localLang;
312
317
  constructor(localLanguage: string);
313
318
  /**
314
319
  *
@@ -365,7 +370,7 @@ declare class Utility {
365
370
  declare class PathModuleVerifier {
366
371
  private log;
367
372
  private readonly localeLanguage;
368
- constructor(localeLanguage: string);
373
+ constructor(localeLanguage: string, environnementPath: any);
369
374
  /**
370
375
  * Verifies if modules at specific paths are loaded.
371
376
  * If any module is not loaded, it throws an error.
@@ -410,47 +415,52 @@ type TParseFunction = (rawBody: string) => any;
410
415
  *
411
416
  * @param options
412
417
  * @param localLanguage
418
+ * @param environnementPath
413
419
  *
414
420
  * Use by this: TJSONBodyParser({ type: 'application/vnd.custom-type' })
415
421
  *
416
422
  * in express, it can be used like this: app.use(TJSONBodyParser({ type: 'application/vnd.custom-type' }));
417
423
  *
418
424
  */
419
- declare function TJSONBodyParser(options: IBodyParserOptions, localLanguage: string): void;
425
+ declare function TJSONBodyParser(options: IBodyParserOptions, localLanguage: string, environnementPath: any): void;
420
426
 
421
427
  /**
422
428
  *
423
429
  * @param options
424
430
  * @param localLanguage
431
+ * @param environnementPath
425
432
  *
426
433
  * Use by this: TRawBodyParser({ type: 'application/vnd.custom-type' })
427
434
  *
428
435
  * in express, it can be used like this: app.use(rawBodyParserType({ type: 'application/vnd.custom-type' }));
429
436
  *
430
437
  */
431
- declare function TRawBodyParser(options: IBodyParserOptions, localLanguage: string): void;
438
+ declare function TRawBodyParser(options: IBodyParserOptions, localLanguage: string, environnementPath: any): void;
432
439
 
433
440
  /**
434
441
  *
435
442
  * @param options
436
443
  * @param localLanguage
444
+ * @param environnementPath
437
445
  *
438
446
  * Use by this: textBodyParserType({ type: 'text/html' })
439
447
  *
440
448
  * in express, it can be used like this: app.use(textBodyParserType({ type: 'text/html' }));
441
449
  *
442
450
  */
443
- declare function TTextBodyParser(options: IBodyParserOptions, localLanguage: string): void;
451
+ declare function TTextBodyParser(options: IBodyParserOptions, localLanguage: string, environnementPath: any): void;
444
452
 
445
453
  /**
446
454
  *
447
455
  * @param options
448
456
  * @param localLanguage
457
+ * @param environnementPath
458
+ *
449
459
  * Use by this: urlencodedBodyParserType({ type: 'application/x-www-form-urlencoded' })
450
460
  *
451
461
  * in express, it can be used like this: app.use(urlencodedBodyParserType({ type: 'application/x-www-form-urlencoded' }));
452
462
  *
453
463
  */
454
- declare function TUrlencodedBodyParser(options: IBodyParserOptions, localLanguage: string): void;
464
+ declare function TUrlencodedBodyParser(options: IBodyParserOptions, localLanguage: string, environnementPath: any): void;
455
465
 
456
- export { CLogLevel, CSignRSAKeyComponent, Environment, type IBodyParserOptions, type IResponseBodyEndFromResponseEvent, type IResponseBodyWriteFromResponseEvent, type IWrappingBodyResponse, MMongoCheckerDatabase, MMySqlCheckerDatabase, MPostgresCheckerDatabase, PathModuleVerifier, RSAKeyDecryption, RSAKeyEncryption, SAsymmetricCryptionDataWithPrivateRSAKey, SAsymmetricCryptionDataWithPublicRSAKey, SCheckerMongoDatabaseConnection, SCheckerMySqlDatabaseConnection, SCheckerPostgresDatabaseConnection, TJSONBodyParser, type TLogLevel, type TOriginalWriteEncoding, type TParseFunction, TRawBodyParser, TTextBodyParser, TUrlencodedBodyParser, Utility, YamlParsing, dateTimeFormatted, loggerConfig, optionalArgumentConnectionUtil };
466
+ export { CLogLevel, CSignRSAKeyComponent, Environment, type IBodyParserOptions, type IResponseBodyEndFromResponseEvent, type IResponseBodyWriteFromResponseEvent, type IWrappingBodyResponse, MMongoCheckerDatabase, MMySqlCheckerDatabase, MPostgresCheckerDatabase, PathModuleVerifier, RSAKeyDecryption, RSAKeyEncryption, SAsymmetricCryptionDataWithPrivateRSAKey, SAsymmetricCryptionDataWithPublicRSAKey, SCheckerMongoDatabaseConnection, SCheckerMySqlDatabaseConnection, SCheckerPostgresDatabaseConnection, TJSONBodyParser, type TLogLevel, type TOriginalWriteEncoding, type TParseFunction, TRawBodyParser, TTextBodyParser, TUrlencodedBodyParser, UOptionalArgumentConnection, Utility, YamlParsing, dateTimeFormatted, loggerConfig };
package/dist/index.d.ts CHANGED
@@ -6,9 +6,9 @@ import stream from 'stream';
6
6
  import { ServerResponse, IncomingMessage } from 'node:http';
7
7
 
8
8
  declare class SAsymmetricCryptionDataWithPrivateRSAKey {
9
- private log;
9
+ private readonly log;
10
10
  private readonly localeLanguage;
11
- constructor(localeLanguage: string);
11
+ constructor(localeLanguage: string, environnementPath: any);
12
12
  /**
13
13
  *
14
14
  * @param rsaKey
@@ -60,9 +60,9 @@ declare class SAsymmetricCryptionDataWithPrivateRSAKey {
60
60
  }
61
61
 
62
62
  declare class SAsymmetricCryptionDataWithPublicRSAKey {
63
- private logger;
63
+ private readonly logger;
64
64
  private readonly localeLanguage;
65
- constructor(localeLanguage: string);
65
+ constructor(localeLanguage: string, environnementPath: any);
66
66
  /**
67
67
  *
68
68
  * @param rsaKey
@@ -119,6 +119,7 @@ declare function SCheckerMongoDatabaseConnection(url: string, user: string | any
119
119
 
120
120
  /**
121
121
  *
122
+ * @param environnementPath
122
123
  * @param dbConnection
123
124
  * @param user
124
125
  * @param database
@@ -129,9 +130,9 @@ declare function SCheckerMongoDatabaseConnection(url: string, user: string | any
129
130
  *
130
131
  * Return void
131
132
  */
132
- declare function SCheckerMySqlDatabaseConnection(localeLanguage: string, dbConnection: mySQL.Connection, user: string, database: string, dbHost: string, password: string): void;
133
+ declare function SCheckerMySqlDatabaseConnection(localeLanguage: string, environnementPath: any, dbConnection: mySQL.Connection, user: string, database: string, dbHost: string, password: string): void;
133
134
 
134
- declare function SCheckerPostgresDatabaseConnection(localeLanguage: string, connectionString: any, keepAlive?: boolean | undefined, stream?: any, statement_timeout?: false | number | undefined, ssl?: boolean | ConnectionOptions | undefined, query_timeout?: number | undefined, keepAliveInitialDelayMillis?: number | undefined, idle_in_transaction_session_timeout?: number | undefined, application_name?: string | undefined, connectionTimeoutMillis?: number | undefined, types?: CustomTypesConfig | undefined, options?: string | undefined): Promise<void>;
135
+ declare function SCheckerPostgresDatabaseConnection(localeLanguage: string, environnementPath: any, connectionString: any, keepAlive?: boolean | undefined, stream?: any, statement_timeout?: false | number | undefined, ssl?: boolean | ConnectionOptions | undefined, query_timeout?: number | undefined, keepAliveInitialDelayMillis?: number | undefined, idle_in_transaction_session_timeout?: number | undefined, application_name?: string | undefined, connectionTimeoutMillis?: number | undefined, types?: CustomTypesConfig | undefined, options?: string | undefined): Promise<void>;
135
136
 
136
137
  declare const CLogLevel: {
137
138
  readonly debug: "DEBUG";
@@ -159,7 +160,7 @@ declare const CLogLevel: {
159
160
  *
160
161
  * ---------------------------------------------------------------------------------------------------------------------------------
161
162
  */
162
- declare const optionalArgumentConnectionUtil: string;
163
+ declare const UOptionalArgumentConnection: (environnementPath: any) => string;
163
164
 
164
165
  /**
165
166
  * This class contains methods that allow to decrypt data using public and private keys.
@@ -179,9 +180,9 @@ declare class RSAKeyEncryption {
179
180
  }
180
181
 
181
182
  declare class YamlParsing {
182
- private logger;
183
+ private readonly logger;
183
184
  private readonly localeLanguage;
184
- constructor(localeLanguage: string);
185
+ constructor(localeLanguage: string, environnementPath: any);
185
186
  readFile(filePath: string): Promise<void>;
186
187
  /**
187
188
  *
@@ -202,13 +203,17 @@ declare class Environment<T> {
202
203
  get<K extends keyof T>(key: K): T[K];
203
204
  }
204
205
 
205
- declare const MMongoCheckerDatabase: (optionalArgumentConnection: string | any, localLanguage: string) => Promise<void>;
206
+ declare const MMongoCheckerDatabase: (optionalArgumentConnection: string | any, localLanguage: string, environnementPath: any) => Promise<void>;
206
207
 
207
- declare const MMySqlCheckerDatabase: (optionalArgumentConnection: string | any, localLanguage: string) => void;
208
+ declare const MMySqlCheckerDatabase: (optionalArgumentConnection: string | any, localLanguage: string, environnementPath: any) => void;
208
209
 
209
- declare const MPostgresCheckerDatabase: (localLanguage: string, keepAlive?: boolean | undefined, stream?: (() => (stream.Duplex | undefined)) | undefined, statement_timeout?: false | number | undefined, ssl?: boolean | ConnectionOptions | undefined, query_timeout?: number | undefined, keepAliveInitialDelayMillis?: number | undefined, idle_in_transaction_session_timeout?: number | undefined, application_name?: string | undefined, connectionTimeoutMillis?: number | undefined, types?: CustomTypesConfig | undefined, options?: string | undefined) => Promise<void>;
210
+ declare const MPostgresCheckerDatabase: (localLanguage: string, environnementPath: any, keepAlive?: boolean | undefined, stream?: (() => (stream.Duplex | undefined)) | undefined, statement_timeout?: false | number | undefined, ssl?: boolean | ConnectionOptions | undefined, query_timeout?: number | undefined, keepAliveInitialDelayMillis?: number | undefined, idle_in_transaction_session_timeout?: number | undefined, application_name?: string | undefined, connectionTimeoutMillis?: number | undefined, types?: CustomTypesConfig | undefined, options?: string | undefined) => Promise<void>;
210
211
 
211
- declare const loggerConfig: {
212
+ /**
213
+ *
214
+ * @param envDir
215
+ */
216
+ declare const loggerConfig: (envDir: any) => {
212
217
  logLevels: string[];
213
218
  transports: {
214
219
  file: {
@@ -308,7 +313,7 @@ declare const CSignRSAKeyComponent: {
308
313
  };
309
314
 
310
315
  declare class Utility {
311
- private localLang;
316
+ private readonly localLang;
312
317
  constructor(localLanguage: string);
313
318
  /**
314
319
  *
@@ -365,7 +370,7 @@ declare class Utility {
365
370
  declare class PathModuleVerifier {
366
371
  private log;
367
372
  private readonly localeLanguage;
368
- constructor(localeLanguage: string);
373
+ constructor(localeLanguage: string, environnementPath: any);
369
374
  /**
370
375
  * Verifies if modules at specific paths are loaded.
371
376
  * If any module is not loaded, it throws an error.
@@ -410,47 +415,52 @@ type TParseFunction = (rawBody: string) => any;
410
415
  *
411
416
  * @param options
412
417
  * @param localLanguage
418
+ * @param environnementPath
413
419
  *
414
420
  * Use by this: TJSONBodyParser({ type: 'application/vnd.custom-type' })
415
421
  *
416
422
  * in express, it can be used like this: app.use(TJSONBodyParser({ type: 'application/vnd.custom-type' }));
417
423
  *
418
424
  */
419
- declare function TJSONBodyParser(options: IBodyParserOptions, localLanguage: string): void;
425
+ declare function TJSONBodyParser(options: IBodyParserOptions, localLanguage: string, environnementPath: any): void;
420
426
 
421
427
  /**
422
428
  *
423
429
  * @param options
424
430
  * @param localLanguage
431
+ * @param environnementPath
425
432
  *
426
433
  * Use by this: TRawBodyParser({ type: 'application/vnd.custom-type' })
427
434
  *
428
435
  * in express, it can be used like this: app.use(rawBodyParserType({ type: 'application/vnd.custom-type' }));
429
436
  *
430
437
  */
431
- declare function TRawBodyParser(options: IBodyParserOptions, localLanguage: string): void;
438
+ declare function TRawBodyParser(options: IBodyParserOptions, localLanguage: string, environnementPath: any): void;
432
439
 
433
440
  /**
434
441
  *
435
442
  * @param options
436
443
  * @param localLanguage
444
+ * @param environnementPath
437
445
  *
438
446
  * Use by this: textBodyParserType({ type: 'text/html' })
439
447
  *
440
448
  * in express, it can be used like this: app.use(textBodyParserType({ type: 'text/html' }));
441
449
  *
442
450
  */
443
- declare function TTextBodyParser(options: IBodyParserOptions, localLanguage: string): void;
451
+ declare function TTextBodyParser(options: IBodyParserOptions, localLanguage: string, environnementPath: any): void;
444
452
 
445
453
  /**
446
454
  *
447
455
  * @param options
448
456
  * @param localLanguage
457
+ * @param environnementPath
458
+ *
449
459
  * Use by this: urlencodedBodyParserType({ type: 'application/x-www-form-urlencoded' })
450
460
  *
451
461
  * in express, it can be used like this: app.use(urlencodedBodyParserType({ type: 'application/x-www-form-urlencoded' }));
452
462
  *
453
463
  */
454
- declare function TUrlencodedBodyParser(options: IBodyParserOptions, localLanguage: string): void;
464
+ declare function TUrlencodedBodyParser(options: IBodyParserOptions, localLanguage: string, environnementPath: any): void;
455
465
 
456
- export { CLogLevel, CSignRSAKeyComponent, Environment, type IBodyParserOptions, type IResponseBodyEndFromResponseEvent, type IResponseBodyWriteFromResponseEvent, type IWrappingBodyResponse, MMongoCheckerDatabase, MMySqlCheckerDatabase, MPostgresCheckerDatabase, PathModuleVerifier, RSAKeyDecryption, RSAKeyEncryption, SAsymmetricCryptionDataWithPrivateRSAKey, SAsymmetricCryptionDataWithPublicRSAKey, SCheckerMongoDatabaseConnection, SCheckerMySqlDatabaseConnection, SCheckerPostgresDatabaseConnection, TJSONBodyParser, type TLogLevel, type TOriginalWriteEncoding, type TParseFunction, TRawBodyParser, TTextBodyParser, TUrlencodedBodyParser, Utility, YamlParsing, dateTimeFormatted, loggerConfig, optionalArgumentConnectionUtil };
466
+ export { CLogLevel, CSignRSAKeyComponent, Environment, type IBodyParserOptions, type IResponseBodyEndFromResponseEvent, type IResponseBodyWriteFromResponseEvent, type IWrappingBodyResponse, MMongoCheckerDatabase, MMySqlCheckerDatabase, MPostgresCheckerDatabase, PathModuleVerifier, RSAKeyDecryption, RSAKeyEncryption, SAsymmetricCryptionDataWithPrivateRSAKey, SAsymmetricCryptionDataWithPublicRSAKey, SCheckerMongoDatabaseConnection, SCheckerMySqlDatabaseConnection, SCheckerPostgresDatabaseConnection, TJSONBodyParser, type TLogLevel, type TOriginalWriteEncoding, type TParseFunction, TRawBodyParser, TTextBodyParser, TUrlencodedBodyParser, UOptionalArgumentConnection, Utility, YamlParsing, dateTimeFormatted, loggerConfig };
package/dist/index.js CHANGED
@@ -141,42 +141,46 @@ var RSAKeyDecryption = class {
141
141
  import { LoggerCore } from "opticore-logger";
142
142
 
143
143
  // src/core/config/logger/logger.config.ts
144
- import { getEnvVariable } from "opticore-env-access";
145
- var loggerConfig = {
146
- logLevels: [
147
- getEnvVariable.logLevelInfo,
148
- getEnvVariable.logLevelWarning,
149
- getEnvVariable.logLevelSuccess,
150
- getEnvVariable.logLevelError,
151
- getEnvVariable.logLevelDebug
152
- ],
153
- transports: {
154
- file: {
155
- enabled: getEnvVariable.logFileEnabled,
156
- maxSizeMB: getEnvVariable.logFileMaxSize,
157
- rotate: getEnvVariable.logFileRotate
158
- },
159
- console: {
160
- enabled: getEnvVariable.logConsoleEnabled
161
- },
162
- remote: {
163
- enabled: getEnvVariable.logRemoteEnabled,
164
- endpoint: getEnvVariable.logRemoteEndPoint
144
+ import { getEnvironnementValue } from "opticore-env-access";
145
+ var loggerConfig = (envDir) => {
146
+ const getEnvAccess = getEnvironnementValue(envDir);
147
+ return {
148
+ logLevels: [
149
+ getEnvAccess.logLevelInfo,
150
+ getEnvAccess.logLevelWarning,
151
+ getEnvAccess.logLevelSuccess,
152
+ getEnvAccess.logLevelError,
153
+ getEnvAccess.logLevelDebug
154
+ ],
155
+ transports: {
156
+ file: {
157
+ enabled: getEnvAccess.logFileEnabled,
158
+ maxSizeMB: getEnvAccess.logFileMaxSize,
159
+ rotate: getEnvAccess.logFileRotate
160
+ },
161
+ console: {
162
+ enabled: getEnvAccess.logConsoleEnabled
163
+ },
164
+ remote: {
165
+ enabled: getEnvAccess.logRemoteEnabled,
166
+ endpoint: getEnvAccess.logRemoteEndPoint
167
+ }
165
168
  }
166
- }
169
+ };
167
170
  };
168
171
 
169
172
  // src/application/services/loggerFileConfiguration.service.ts
170
- var SLoggerFileConfiguration = () => {
171
- return new LoggerCore(loggerConfig);
173
+ var SLoggerFileConfiguration = (environnementPath) => {
174
+ return new LoggerCore(loggerConfig(environnementPath));
172
175
  };
173
176
 
174
177
  // src/application/services/asymmetricCryptionDataWithPrivateRSAKey.service.ts
175
178
  var SAsymmetricCryptionDataWithPrivateRSAKey = class {
176
- log = SLoggerFileConfiguration();
179
+ log;
177
180
  localeLanguage;
178
- constructor(localeLanguage) {
181
+ constructor(localeLanguage, environnementPath) {
179
182
  this.localeLanguage = localeLanguage;
183
+ this.log = SLoggerFileConfiguration(environnementPath);
180
184
  }
181
185
  /**
182
186
  *
@@ -337,10 +341,11 @@ import { TranslationLoader as TranslationLoader2 } from "opticore-translator";
337
341
  import { HttpStatusCode as status2 } from "opticore-http-response";
338
342
  import { StackTraceError } from "opticore-catch-exception-error";
339
343
  var SAsymmetricCryptionDataWithPublicRSAKey = class {
340
- logger = SLoggerFileConfiguration();
344
+ logger;
341
345
  localeLanguage;
342
- constructor(localeLanguage) {
346
+ constructor(localeLanguage, environnementPath) {
343
347
  this.localeLanguage = localeLanguage;
348
+ this.logger = SLoggerFileConfiguration(environnementPath);
344
349
  }
345
350
  /**
346
351
  *
@@ -505,8 +510,8 @@ async function SCheckerMongoDatabaseConnection(url, user, password, dbName) {
505
510
  import { LoggerCore as LoggerCore2 } from "opticore-logger";
506
511
  import { HttpStatusCode as status3 } from "opticore-http-response";
507
512
  import { TranslationLoader as TranslationLoader3 } from "opticore-translator";
508
- function mySqlErrorHandlerDatabase(localLanguage, err, dbHost, database, user, password) {
509
- const logger = new LoggerCore2(loggerConfig);
513
+ function mySqlErrorHandlerDatabase(localLanguage, environnementPath, err, dbHost, database, user, password) {
514
+ const logger = new LoggerCore2(loggerConfig(environnementPath));
510
515
  switch (err.code) {
511
516
  case "EAI_AGAIN":
512
517
  logger.error(
@@ -558,11 +563,11 @@ function mySqlErrorHandlerDatabase(localLanguage, err, dbHost, database, user, p
558
563
 
559
564
  // src/application/services/checkerMySqlDatabaseConnection.service.ts
560
565
  import { TranslationLoader as TranslationLoader4 } from "opticore-translator";
561
- function SCheckerMySqlDatabaseConnection(localeLanguage, dbConnection, user, database, dbHost, password) {
562
- const logger = SLoggerFileConfiguration();
566
+ function SCheckerMySqlDatabaseConnection(localeLanguage, environnementPath, dbConnection, user, database, dbHost, password) {
567
+ const logger = SLoggerFileConfiguration(environnementPath);
563
568
  dbConnection.connect((err) => {
564
569
  if (err) {
565
- return mySqlErrorHandlerDatabase(localeLanguage, err, dbHost, database, user, password);
570
+ return mySqlErrorHandlerDatabase(localeLanguage, environnementPath, err, dbHost, database, user, password);
566
571
  } else {
567
572
  logger.success(
568
573
  TranslationLoader4.t("dbConnection", localeLanguage, logger),
@@ -570,7 +575,7 @@ function SCheckerMySqlDatabaseConnection(localeLanguage, dbConnection, user, dat
570
575
  );
571
576
  return dbConnection.end((endConErr) => {
572
577
  if (endConErr) {
573
- return mySqlErrorHandlerDatabase(localeLanguage, err, dbHost, database, user, password);
578
+ return mySqlErrorHandlerDatabase(localeLanguage, environnementPath, err, dbHost, database, user, password);
574
579
  } else {
575
580
  logger.success(
576
581
  TranslationLoader4.t("dbConnection", localeLanguage, logger),
@@ -587,8 +592,8 @@ function SCheckerMySqlDatabaseConnection(localeLanguage, dbConnection, user, dat
587
592
  import { HttpStatusCode as status4 } from "opticore-http-response";
588
593
  import pg from "pg";
589
594
  import { TranslationLoader as TranslationLoader5 } from "opticore-translator";
590
- async function SCheckerPostgresDatabaseConnection(localeLanguage, connectionString, keepAlive, stream, statement_timeout, ssl, query_timeout, keepAliveInitialDelayMillis, idle_in_transaction_session_timeout, application_name, connectionTimeoutMillis, types, options) {
591
- const logger = SLoggerFileConfiguration();
595
+ async function SCheckerPostgresDatabaseConnection(localeLanguage, environnementPath, connectionString, keepAlive, stream, statement_timeout, ssl, query_timeout, keepAliveInitialDelayMillis, idle_in_transaction_session_timeout, application_name, connectionTimeoutMillis, types, options) {
596
+ const logger = SLoggerFileConfiguration(environnementPath);
592
597
  const configOptions = {
593
598
  connectionString,
594
599
  keepAlive,
@@ -641,8 +646,11 @@ var CLogLevel = {
641
646
  };
642
647
 
643
648
  // src/utils/connection/optionalArgumentConnection.util.ts
644
- import { getEnvVariable as getEnvVariable2 } from "opticore-env-access";
645
- var optionalArgumentConnectionUtil = getEnvVariable2.argumentsDatabaseConnection;
649
+ import { getEnvironnementValue as getEnvironnementValue2 } from "opticore-env-access";
650
+ var UOptionalArgumentConnection = (environnementPath) => {
651
+ const envPath = getEnvironnementValue2(environnementPath);
652
+ return envPath.argumentsDatabaseConnection;
653
+ };
646
654
 
647
655
  // src/utils/parsing/parsingYaml.utils.ts
648
656
  import { readFile } from "fs/promises";
@@ -663,10 +671,11 @@ var translateWebAppCoreLanguageLoader = () => {
663
671
 
664
672
  // src/utils/parsing/parsingYaml.utils.ts
665
673
  var YamlParsing = class {
666
- logger = new LoggerCore3(loggerConfig);
674
+ logger;
667
675
  localeLanguage;
668
- constructor(localeLanguage) {
676
+ constructor(localeLanguage, environnementPath) {
669
677
  this.localeLanguage = localeLanguage;
678
+ this.logger = new LoggerCore3(loggerConfig(environnementPath));
670
679
  translateWebAppCoreLanguageLoader();
671
680
  }
672
681
  async readFile(filePath) {
@@ -737,20 +746,19 @@ var Environment = class {
737
746
  // src/core/config/database/connexion.config.database.ts
738
747
  import mySQL from "mysql";
739
748
  import { HttpStatusCode as status6 } from "opticore-http-response";
740
- import { getEnvVariable as getEnvVariable3 } from "opticore-env-access";
741
- import { LoggerCore as LoggerCore5 } from "opticore-logger";
749
+ import { LoggerCore as LoggerCore4 } from "opticore-logger";
742
750
  import { TranslationLoader as TranslationLoader9 } from "opticore-translator";
743
751
 
744
752
  // src/core/errors/databaseConnexion.error.ts
745
753
  import { HttpStatusCode as status5 } from "opticore-http-response";
746
- import { LoggerCore as LoggerCore4 } from "opticore-logger";
747
754
  import { StackTraceError as StackTraceError2 } from "opticore-catch-exception-error";
748
755
  import { TranslationLoader as TranslationLoader8 } from "opticore-translator";
749
756
  var DbConnexionConfigError = class {
750
- logger = new LoggerCore4(loggerConfig);
757
+ logger;
751
758
  localeLanguage;
752
- constructor(localeLanguage) {
759
+ constructor(localeLanguage, environnementPath) {
753
760
  this.localeLanguage = localeLanguage;
761
+ this.logger = SLoggerFileConfiguration(environnementPath);
754
762
  }
755
763
  /**
756
764
  *
@@ -842,13 +850,17 @@ var DbConnexionConfigError = class {
842
850
  // src/core/config/database/connexion.config.database.ts
843
851
  import { StackTraceError as ErrorHandler2 } from "opticore-catch-exception-error";
844
852
  var DatabaseConnectionConfig = class {
845
- env = new Environment(getEnvVariable3);
846
- logger = new LoggerCore5(loggerConfig);
853
+ env;
854
+ logger;
847
855
  localeLanguage;
856
+ environnementPath;
848
857
  DbConnexionConfigError;
849
- constructor(localeLanguage) {
858
+ constructor(localeLanguage, environnementPath) {
850
859
  this.localeLanguage = localeLanguage;
851
- this.DbConnexionConfigError = new DbConnexionConfigError(localeLanguage);
860
+ this.environnementPath = environnementPath;
861
+ this.DbConnexionConfigError = new DbConnexionConfigError(localeLanguage, environnementPath);
862
+ this.env = new Environment(environnementPath);
863
+ this.logger = new LoggerCore4(loggerConfig(environnementPath));
852
864
  }
853
865
  /**
854
866
  *
@@ -864,7 +876,7 @@ var DatabaseConnectionConfig = class {
864
876
  const dbURL = `${this.env.get("dataBaseUser")}:${this.env.get("dataBasePassword")}@${this.env.get("dataBaseHost")}:${this.env.get("dataBasePort")}/${this.env.get("dataBaseName")}`;
865
877
  let url = `mysql://${dbURL}?${optionalArgumentConnection}`;
866
878
  const dbConnection = mySQL.createConnection(url);
867
- return SCheckerMySqlDatabaseConnection(this.localeLanguage, dbConnection, this.env.get("dataBaseUser"), this.env.get("dataBaseName"), this.env.get("dataBaseHost"), this.env.get("dataBasePassword"));
879
+ return SCheckerMySqlDatabaseConnection(this.localeLanguage, this.environnementPath, dbConnection, this.env.get("dataBaseUser"), this.env.get("dataBaseName"), this.env.get("dataBaseHost"), this.env.get("dataBasePassword"));
868
880
  }
869
881
  /**
870
882
  *
@@ -917,6 +929,7 @@ var DatabaseConnectionConfig = class {
917
929
  try {
918
930
  await SCheckerPostgresDatabaseConnection(
919
931
  this.localeLanguage,
932
+ this.environnementPath,
920
933
  url,
921
934
  keepAlive,
922
935
  stream,
@@ -956,20 +969,20 @@ var DatabaseConnectionConfig = class {
956
969
  };
957
970
 
958
971
  // src/core/config/database/middleware/mongoChecker.database.ts
959
- var MMongoCheckerDatabase = (optionalArgumentConnection, localLanguage) => {
960
- const DbConnexion = new DatabaseConnectionConfig(localLanguage);
972
+ var MMongoCheckerDatabase = (optionalArgumentConnection, localLanguage, environnementPath) => {
973
+ const DbConnexion = new DatabaseConnectionConfig(localLanguage, environnementPath);
961
974
  return DbConnexion.databaseMongoDBConnectionChecker(optionalArgumentConnection);
962
975
  };
963
976
 
964
977
  // src/core/config/database/middleware/mySqlChecker.database.ts
965
- var MMySqlCheckerDatabase = (optionalArgumentConnection, localLanguage) => {
966
- const DbConnexion = new DatabaseConnectionConfig(localLanguage);
978
+ var MMySqlCheckerDatabase = (optionalArgumentConnection, localLanguage, environnementPath) => {
979
+ const DbConnexion = new DatabaseConnectionConfig(localLanguage, environnementPath);
967
980
  return DbConnexion.databaseMySQLConnexionChecker(optionalArgumentConnection);
968
981
  };
969
982
 
970
983
  // src/core/config/database/middleware/postgresChecker.database.ts
971
- var MPostgresCheckerDatabase = (localLanguage, keepAlive, stream, statement_timeout, ssl, query_timeout, keepAliveInitialDelayMillis, idle_in_transaction_session_timeout, application_name, connectionTimeoutMillis, types, options) => {
972
- const DbConnexion = new DatabaseConnectionConfig(localLanguage);
984
+ var MPostgresCheckerDatabase = (localLanguage, environnementPath, keepAlive, stream, statement_timeout, ssl, query_timeout, keepAliveInitialDelayMillis, idle_in_transaction_session_timeout, application_name, connectionTimeoutMillis, types, options) => {
985
+ const DbConnexion = new DatabaseConnectionConfig(localLanguage, environnementPath);
973
986
  return DbConnexion.databasePostgresDBConnectionChecker(
974
987
  keepAlive,
975
988
  stream,
@@ -1121,14 +1134,14 @@ var Utility = class {
1121
1134
 
1122
1135
  // src/core/events/pathModuleVerifier.event.ts
1123
1136
  import { resolve } from "path";
1124
- import { LoggerCore as LoggerCore6 } from "opticore-logger";
1125
1137
  import { HttpStatusCode as HttpStatusCode2 } from "opticore-http-response";
1126
1138
  import { TranslationLoader as TranslationLoader11 } from "opticore-translator";
1127
1139
  var PathModuleVerifier = class {
1128
- log = new LoggerCore6(loggerConfig);
1140
+ log;
1129
1141
  localeLanguage;
1130
- constructor(localeLanguage) {
1142
+ constructor(localeLanguage, environnementPath) {
1131
1143
  this.localeLanguage = localeLanguage;
1144
+ this.log = SLoggerFileConfiguration(environnementPath);
1132
1145
  }
1133
1146
  /**
1134
1147
  * Verifies if modules at specific paths are loaded.
@@ -1182,9 +1195,9 @@ export {
1182
1195
  SCheckerMongoDatabaseConnection,
1183
1196
  SCheckerMySqlDatabaseConnection,
1184
1197
  SCheckerPostgresDatabaseConnection,
1198
+ UOptionalArgumentConnection,
1185
1199
  Utility,
1186
1200
  YamlParsing,
1187
1201
  dateTimeFormatted,
1188
- loggerConfig,
1189
- optionalArgumentConnectionUtil
1202
+ loggerConfig
1190
1203
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opticore-webapp-core",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "opticore Web Application core module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -30,8 +30,8 @@
30
30
  "dotenv": "^16.4.7",
31
31
  "mongodb": "^6.6.1",
32
32
  "mysql": "^2.18.1",
33
- "opticore-catch-exception-error": "^1.0.14",
34
- "opticore-env-access": "^1.0.2",
33
+ "opticore-catch-exception-error": "^1.0.17",
34
+ "opticore-env-access": "^1.0.5",
35
35
  "opticore-express": "^1.0.3",
36
36
  "opticore-http-response": "^1.0.3",
37
37
  "opticore-logger": "^1.0.13",
@@ -1,130 +0,0 @@
1
- {
2
- "erBadDbError": "ER_BAD_DB_ERROR",
3
- "erAccessDeniedError": "ER_ACCESS_DENIED_ERROR",
4
- "erNotSupportedAuthMode": "ER_NOT_SUPPORTED_AUTH_MODE",
5
- "eAiAgain": "EAI_AGAIN",
6
- "dbConnection": "Database connection",
7
- "dbConnectionClosed": "MySQL connection is closed",
8
- "mysqlErrorCon": "MysqlError connection",
9
- "mySQLError": "MysqlError",
10
- "mySqlCloseConnection": "MySql close connection",
11
- "dbConnexionSuccess": "The database connection was successful 🚀",
12
- "mongoConnectionSuccess": "Connection to database is successfully.",
13
- "connSuccess": "success connection",
14
- "mongoDBConnectionChecker": "MongoDB Connection Checker",
15
- "mongoConnection": "connection",
16
- "mongoDBAuthentication": "authentication",
17
- "mongoDBConnection": "MongoDB connection : {err}",
18
- "mongoDBAuthenticationFailed": "failed",
19
- "mongoDBUnableParsingUrl": "unable to parse",
20
- "mongoDBConnectionUrl": "url",
21
- "mongoDBServerSelection": "MongoServer selection error",
22
- "mongoDBServer": "MongoServer",
23
- "mongoDBConnectionError": "connection error",
24
- "mongoDBError": "error",
25
- "mongoDBAuthenticationError": "Authentication failed, be sure the credentials is correct.",
26
- "postgresDBConnectionChecker": "PostgresDB Connection Checker",
27
- "postgresConnection": "connection",
28
- "postgresConnectionSuccess": "Connection to database is successfully.",
29
- "postgresSuccessConn": "Postgres client Connection",
30
- "postgresClosingConnSuccess": "Postgres client is close connection.",
31
- "postgresEndClientRejection": "Postgres client end rejected",
32
- "postgresClientError": "Postgres client error",
33
- "postgresEndRejection": "End rejected",
34
- "postgresConnError": "Postgres connection error",
35
- "postgresException": "Exception",
36
- "rsaKeyNotFound": "RSA key provided is not found.",
37
- "encryptionWithPrivateKeyFailed": "Encryption With PrivateKey",
38
- "encryptionFailed": "Encryption failed",
39
- "verifyExistingKey": "Verify Existing Key",
40
- "signatureRSAKeyFailed": "Signature verification failed.",
41
- "signatureRSAKeysError": "Signature RSA Keys Error",
42
- "errorDecryption": "Error decryption with private key",
43
- "errorNameNotVerifyingRSAKey": "Error Verify RSA Key",
44
- "decryptionWithPublicKeyFailed": "Decryption With PublicKey",
45
- "decryptionFailed": "Decryption failed",
46
- "verifyRSAKey": "Verify RSA Keys",
47
- "verifyRSAKeyFailed": "Verify RSA Keys Failed",
48
- "notVerifying": "Verification failed",
49
- "mongoServerError": "MongoServerSelectionError: getaddrinfo EAI_AGAIN ({dbHost} is not allow to database connection)",
50
- "dbUrlParsingError": "Unable to parse {dbHost}:{dbPort} with URL",
51
- "errorDBHost": "A database host {host} does not allow connection. Please either set the host like this: {localhost} in your .env file",
52
- "unknownDB": "Database {database} is unknown. Please try to use Database CLI to create your database, or do it manually in your Database Management System",
53
- "accessDeniedToDBCon": "Access denied for user {user}. Database credentials in .env file are User: {user} and Password: {password}. '{user}''{password}'@'localhost'. Try to set user and password in .env file",
54
- "badFormat": "Unsupported YAML line format",
55
- "parsingFailed": "YAML Parsing failed",
56
- "unsupportedFormat": "Unsupported YAML format",
57
- "readingError": "Error reading YAML file",
58
- "invalidRequest": "Invalid request",
59
- "moduleNotLoaded": "The following module paths are not loaded: {notLoadedPaths}",
60
- "serverRouteNotExist": "This route : http://{host}:{port} do not exist.",
61
- "webServer": "Web server",
62
- "listening": "listening",
63
- "webHost": "host",
64
- "badHost": "bad host",
65
- "hostNotFound": "not found",
66
- "errorHostUrl": "The host and port are not define, please define them in .env",
67
- "badPort": "bad port",
68
- "errorPort": "The port is not correct. Please define a right port with number port.",
69
- "errorHost": "The host can't be empty or blank. Please define a string host in .env",
70
- "serverStart": "Server start",
71
- "serverStartError": "Server start error",
72
- "processExitCode": "Process will exit with code: {code}",
73
- "beforeExit": "BeforeExit",
74
- "processBeforeExit": "process before exit",
75
- "childProcessDiscon": "Child process disconnected",
76
- "processDiscon": "process disconnected",
77
- "disconnected": "Disconnected",
78
- "completed": "completed",
79
- "finishingProcessWell": "The process finished as expected and everything is ok",
80
- "serverStopped": "[OK] The server shutting down",
81
- "somethingWentWrong": "Something went wrong",
82
- "genErrors": "General Errors",
83
- "exited": "Exited",
84
- "incorrectCmd": "Incorrect using of shell commands",
85
- "misuseShell": "Misuse of shell builtins",
86
- "cmdNotExecutable": "The command is found but is not executable (e.g., trying to execute a directory)",
87
- "cmdNotFound": "Command not found",
88
- "cmdNotFoundInSystemPath": "The command was not found in the system's PATH or is misspelled",
89
- "argInvalid": "Invalid argument",
90
- "scriptEndedManuallyByCtrlC": "Indicates that the script was manually terminated by the user using the Control-C (SIGINT) signal",
91
- "processEndedBySIGKILL": "Indicates that the process was terminated by a SIGKILL signal, possibly due to an out-of-memory situation",
92
- "scriptEnded": "Script terminated",
93
- "accessProcessIllegally": "Indicates that the process accessed an illegal memory address (segfault)",
94
- "defaultSegment": "Segmentation fault",
95
- "processReceivedSigtermSignal": "Indicates that the process received a SIGTERM signal to terminate",
96
- "processReceived": "process received a SIGTERM",
97
- "exitCode": "An exit code that is outside the allowable range (0-255 for Unix-like systems)",
98
- "outRange": "out of range",
99
- "errorOccurring": "Error is occurring",
100
- "errors": "errors",
101
- "promiseRejectionHandled": "Promise rejection is handled at : {promise}",
102
- "rejectionPromise": "rejection promise",
103
- "uncaughtExceptionHandled": "uncaught exception handled",
104
- "unhandledRejectionAtPromise": "Unhandled Rejection at: Promise {promise} -- reason {reason}",
105
- "unhandledRejection": "Unhandled rejection",
106
- "processGotMsg": "process got message {message}",
107
- "msgException": "message exception",
108
- "promiseReason": "{promise} -- {reason}",
109
- "multipleResolvesDetected": "Multiple resolves detected : {type}",
110
- "serverWebStopped": "The Web server has been stopped !",
111
- "okSuccess": "[ OK ] Success",
112
- "processPIDReceivedSignal": "Process ${process.pid} received a SIGTERM signal : {signal}",
113
- "serverClosed": "Server is closed",
114
- "allProcessStopped": "All processes are stopped",
115
- "serverDroppedCon": "The server dropped new connections",
116
- "serverMaxCon": "Server maxConnection",
117
- "internalServerError": "Internal Server Error",
118
- "resStatusNotFunc": "res.status is not a function",
119
- "respndNotFunc": "response not Function",
120
- "expressErrorHandlingMiddleware": "Express error-handling middleware",
121
- "expressError": "Express error",
122
- "serverRunning": "The server is running in",
123
- "okServerListening": "[OK] Web server listening",
124
- "webServerUseNodeVersion": "The Web server is using Node.js version",
125
- "startupTime": "Startup time:",
126
- "totalMemory": "Resident Set Size - total memory allocated for the process execution :",
127
- "memoryUsedDuringExecution": "Actual memory used during the execution :",
128
- "memoryUsedByUser": "Memory usage by user :",
129
- "memoryUsedBySystem": "Memory usage by system :"
130
- }
@@ -1,49 +0,0 @@
1
- {
2
- "erBadDbError": "ER_BAD_DB_ERROR",
3
- "erAccessDeniedError": "ER_ACCESS_DENIED_ERROR",
4
- "erNotSupportedAuthMode": "ER_NOT_SUPPORTED_AUTH_MODE",
5
- "eAiAgain": "EAI_AGAIN",
6
- "dbConnection": "DataBase connection",
7
- "dbConnectionClosed": "MySQL connection is closed",
8
- "mysqlErrorCon": "MysqlError connection",
9
- "mySQLError": "MysqlError",
10
- "mySqlCloseConnection": "MySql close connection",
11
- "mongoConnectionSuccess": "Connection to database is successfully.",
12
- "mongoDBConnectionChecker": "MongoDB Connection Checker",
13
- "mongoConnection": "connection",
14
- "mongoDBAuthentication": "authentication",
15
- "mongoDBConnection": "MongoDB connection",
16
- "mongoDBAuthenticationFailed": "failed",
17
- "mongoDBUnableParsingUrl": "unable to parse",
18
- "mongoDBConnectionUrl": "url",
19
- "mongoDBServerSelection": "MongoServer selection error",
20
- "mongoDBServer": "MongoServer",
21
- "mongoDBConnectionError": "connection error",
22
- "mongoDBError": "error",
23
- "mongoDBAuthenticationError": "Authentication failed, be sure the credentials is correct.",
24
- "postgresDBConnectionChecker": "PostgresDB Connection Checker",
25
- "postgresConnection": "connection",
26
- "postgresConnectionSuccess": "Connection to database is successfully.",
27
- "postgresSuccessConn": "Postgres client Connection",
28
- "postgresClosingConnSuccess": "Postgres client is close connection.",
29
- "postgresEndClientRejection": "Postgres client end rejected",
30
- "postgresClientError": "Postgres client error",
31
- "postgresEndRejection": "End rejected",
32
- "postgresConnError": "Postgres connection error",
33
- "postgresException": "Exception",
34
- "rsaKeyNotFound": "RSA key provided is not found.",
35
- "encryptionWithPrivateKeyFailed": "Encryption With PrivateKey",
36
- "encryptionFailed": "Encryption failed",
37
- "verifyExistingKey": "Verify Existing Key",
38
- "signatureRSAKeyFailed": "Signature verification failed.",
39
- "signatureRSAKeysError": "Signature RSA Keys Error",
40
- "errorDecryption": "Error decryption with private key",
41
- "errorNameNotVerifyingRSAKey": "Error Verify RSA Key",
42
- "decryptionWithPublicKeyFailed": "Decryption With PublicKey",
43
- "decryptionFailed": "Decryption failed",
44
- "verifyRSAKey": "Verify RSA Keys",
45
- "verifyRSAKeyFailed": "Verify RSA Keys Failed",
46
- "notVerifying": "Verification failed",
47
- "mongoServerError": "MongoServerSelectionError: getaddrinfo EAI_AGAIN ({dbHost} is not allow to database connection)",
48
- "dbUrlParsingError": "Unable to parse ${dbHost}:${dbPort} with URL"
49
- }