opticore-webapp-core 1.0.15 → 1.0.16
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 +119 -90
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +113 -85
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -33,6 +33,7 @@ __export(index_exports, {
|
|
|
33
33
|
CLogLevel: () => CLogLevel,
|
|
34
34
|
CSignRSAKeyComponent: () => CSignRSAKeyComponent,
|
|
35
35
|
Environment: () => Environment,
|
|
36
|
+
LocalLanguageLoader: () => LocalLanguageLoader,
|
|
36
37
|
MMongoCheckerDatabase: () => MMongoCheckerDatabase,
|
|
37
38
|
MMySqlCheckerDatabase: () => MMySqlCheckerDatabase,
|
|
38
39
|
MPostgresCheckerDatabase: () => MPostgresCheckerDatabase,
|
|
@@ -705,38 +706,13 @@ var UOptionalArgumentConnection = (environnementPath) => {
|
|
|
705
706
|
|
|
706
707
|
// src/utils/parsing/parsingYaml.utils.ts
|
|
707
708
|
var import_promises = require("fs/promises");
|
|
708
|
-
var
|
|
709
|
+
var import_opticore_http_response5 = require("opticore-http-response");
|
|
709
710
|
var import_opticore_logger3 = require("opticore-logger");
|
|
710
|
-
var import_opticore_translator7 = require("opticore-translator");
|
|
711
|
-
|
|
712
|
-
// src/core/config/loaders/translateLanguage.loader.ts
|
|
713
|
-
var import_path = __toESM(require("path"), 1);
|
|
714
|
-
var import_module = require("module");
|
|
715
711
|
var import_opticore_translator6 = require("opticore-translator");
|
|
716
|
-
var import_opticore_http_response5 = require("opticore-http-response");
|
|
717
|
-
var translateWebAppCoreLanguageLoader = (environnementPath, localLang) => {
|
|
718
|
-
try {
|
|
719
|
-
const require2 = (0, import_module.createRequire)(importMetaUrl);
|
|
720
|
-
const packagePath = import_path.default.dirname(require2.resolve("opticore-webapp-core"));
|
|
721
|
-
const translateMsgJsonFilePath = import_path.default.join(packagePath, "utils", "translations");
|
|
722
|
-
import_opticore_translator6.TranslationLoader.loadTranslations(translateMsgJsonFilePath);
|
|
723
|
-
} catch (err) {
|
|
724
|
-
SLoggerFileConfiguration(environnementPath).error(
|
|
725
|
-
import_opticore_translator6.TranslationLoader.t(err.message, localLang),
|
|
726
|
-
err.code,
|
|
727
|
-
err.code,
|
|
728
|
-
err.stackTrace,
|
|
729
|
-
import_opticore_http_response5.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
730
|
-
);
|
|
731
|
-
}
|
|
732
|
-
};
|
|
733
|
-
|
|
734
|
-
// src/utils/parsing/parsingYaml.utils.ts
|
|
735
712
|
var YamlParsing = class {
|
|
736
713
|
logger;
|
|
737
714
|
localeLanguage;
|
|
738
715
|
constructor(localeLanguage, environnementPath) {
|
|
739
|
-
translateWebAppCoreLanguageLoader(environnementPath, localeLanguage);
|
|
740
716
|
this.localeLanguage = localeLanguage;
|
|
741
717
|
this.logger = new import_opticore_logger3.LoggerCore(loggerConfig(environnementPath));
|
|
742
718
|
}
|
|
@@ -747,10 +723,10 @@ var YamlParsing = class {
|
|
|
747
723
|
} catch (error) {
|
|
748
724
|
this.logger.error(
|
|
749
725
|
error.message,
|
|
750
|
-
|
|
751
|
-
|
|
726
|
+
import_opticore_translator6.TranslationLoader.t("parsingFailed", this.localeLanguage, this.logger),
|
|
727
|
+
import_opticore_translator6.TranslationLoader.t("readingError", this.localeLanguage, this.logger),
|
|
752
728
|
error.stack,
|
|
753
|
-
|
|
729
|
+
import_opticore_http_response5.HttpStatusCode.NOT_ACCEPTABLE
|
|
754
730
|
);
|
|
755
731
|
}
|
|
756
732
|
}
|
|
@@ -779,11 +755,11 @@ var YamlParsing = class {
|
|
|
779
755
|
}
|
|
780
756
|
} else {
|
|
781
757
|
this.logger.error(
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
758
|
+
import_opticore_translator6.TranslationLoader.t("badFormat", this.localeLanguage, { line }),
|
|
759
|
+
import_opticore_translator6.TranslationLoader.t("parsingFailed", this.localeLanguage, this.logger),
|
|
760
|
+
import_opticore_translator6.TranslationLoader.t("unsupportedFormat", this.localeLanguage, this.logger),
|
|
785
761
|
content,
|
|
786
|
-
|
|
762
|
+
import_opticore_http_response5.HttpStatusCode.NOT_ACCEPTABLE
|
|
787
763
|
);
|
|
788
764
|
}
|
|
789
765
|
}
|
|
@@ -807,14 +783,14 @@ var Environment = class {
|
|
|
807
783
|
|
|
808
784
|
// src/core/config/database/connexion.config.database.ts
|
|
809
785
|
var import_mysql = __toESM(require("mysql"), 1);
|
|
810
|
-
var
|
|
786
|
+
var import_opticore_http_response7 = require("opticore-http-response");
|
|
811
787
|
var import_opticore_logger4 = require("opticore-logger");
|
|
812
|
-
var
|
|
788
|
+
var import_opticore_translator8 = require("opticore-translator");
|
|
813
789
|
|
|
814
790
|
// src/core/errors/databaseConnexion.error.ts
|
|
815
|
-
var
|
|
791
|
+
var import_opticore_http_response6 = require("opticore-http-response");
|
|
816
792
|
var import_opticore_catch_exception_error3 = require("opticore-catch-exception-error");
|
|
817
|
-
var
|
|
793
|
+
var import_opticore_translator7 = require("opticore-translator");
|
|
818
794
|
var DbConnexionConfigError = class {
|
|
819
795
|
logger;
|
|
820
796
|
localeLanguage;
|
|
@@ -828,16 +804,16 @@ var DbConnexionConfigError = class {
|
|
|
828
804
|
*/
|
|
829
805
|
mongoDBAuthenticationFailed(e) {
|
|
830
806
|
const stackTrace = this.traceError(
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
807
|
+
import_opticore_translator7.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { e }),
|
|
808
|
+
import_opticore_translator7.TranslationLoader.t("mongoDBAuthentication", this.localeLanguage),
|
|
809
|
+
import_opticore_http_response6.HttpStatusCode.UNAUTHORIZED
|
|
834
810
|
);
|
|
835
811
|
this.logger.error(
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
812
|
+
import_opticore_translator7.TranslationLoader.t("mongoDBAuthenticationError", this.localeLanguage),
|
|
813
|
+
import_opticore_translator7.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
814
|
+
import_opticore_translator7.TranslationLoader.t("mongoDBAuthenticationFailed", this.localeLanguage),
|
|
839
815
|
stackTrace.stack,
|
|
840
|
-
|
|
816
|
+
import_opticore_http_response6.HttpStatusCode.UNAUTHORIZED
|
|
841
817
|
);
|
|
842
818
|
}
|
|
843
819
|
/**
|
|
@@ -848,16 +824,16 @@ var DbConnexionConfigError = class {
|
|
|
848
824
|
*/
|
|
849
825
|
mongoDBInvalidUrl(err, dbHost, dbPort) {
|
|
850
826
|
const stackTrace = this.traceError(
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
827
|
+
import_opticore_translator7.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { err }),
|
|
828
|
+
import_opticore_translator7.TranslationLoader.t("mongoDBUnableParsingUrl", this.localeLanguage),
|
|
829
|
+
import_opticore_http_response6.HttpStatusCode.BAD_REQUEST
|
|
854
830
|
);
|
|
855
831
|
this.logger.error(
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
832
|
+
import_opticore_translator7.TranslationLoader.t("dbUrlParsingError", this.localeLanguage, { dbHost, dbPort }),
|
|
833
|
+
import_opticore_translator7.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
834
|
+
import_opticore_translator7.TranslationLoader.t("mongoDBUnableParsingUrl", this.localeLanguage),
|
|
859
835
|
stackTrace.stack,
|
|
860
|
-
|
|
836
|
+
import_opticore_http_response6.HttpStatusCode.BAD_REQUEST
|
|
861
837
|
);
|
|
862
838
|
}
|
|
863
839
|
/**
|
|
@@ -867,16 +843,16 @@ var DbConnexionConfigError = class {
|
|
|
867
843
|
*/
|
|
868
844
|
mongoDBEaiAgain(err, dbHost) {
|
|
869
845
|
const stackTrace = this.traceError(
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
846
|
+
import_opticore_translator7.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { err }),
|
|
847
|
+
import_opticore_translator7.TranslationLoader.t("mongoDBServerSelection", this.localeLanguage),
|
|
848
|
+
import_opticore_http_response6.HttpStatusCode.BAD_REQUEST
|
|
873
849
|
);
|
|
874
850
|
this.logger.error(
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
851
|
+
import_opticore_translator7.TranslationLoader.t("mongoServerError", this.localeLanguage, { dbHost }),
|
|
852
|
+
import_opticore_translator7.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
853
|
+
import_opticore_translator7.TranslationLoader.t("mongoDBServerSelection", this.localeLanguage),
|
|
878
854
|
stackTrace.stack,
|
|
879
|
-
|
|
855
|
+
import_opticore_http_response6.HttpStatusCode.BAD_REQUEST
|
|
880
856
|
);
|
|
881
857
|
}
|
|
882
858
|
/**
|
|
@@ -885,16 +861,16 @@ var DbConnexionConfigError = class {
|
|
|
885
861
|
*/
|
|
886
862
|
mongoDbGlobalError(err) {
|
|
887
863
|
const stackTrace = this.traceError(
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
864
|
+
import_opticore_translator7.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { err }),
|
|
865
|
+
import_opticore_translator7.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
866
|
+
import_opticore_http_response6.HttpStatusCode.NOT_ACCEPTABLE
|
|
891
867
|
);
|
|
892
868
|
this.logger.error(
|
|
893
|
-
|
|
894
|
-
|
|
869
|
+
import_opticore_translator7.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
870
|
+
import_opticore_translator7.TranslationLoader.t("mongoDBConnectionError", this.localeLanguage),
|
|
895
871
|
stackTrace.stack,
|
|
896
872
|
err.message,
|
|
897
|
-
|
|
873
|
+
import_opticore_http_response6.HttpStatusCode.NOT_ACCEPTABLE
|
|
898
874
|
);
|
|
899
875
|
}
|
|
900
876
|
/**
|
|
@@ -952,8 +928,8 @@ var DatabaseConnectionConfig = class {
|
|
|
952
928
|
try {
|
|
953
929
|
await SCheckerMongoDatabaseConnection(url, this.env.get("dataBaseUser"), this.env.get("dataBasePassword"), this.env.get("dataBaseName"));
|
|
954
930
|
this.logger.success(
|
|
955
|
-
|
|
956
|
-
|
|
931
|
+
import_opticore_translator8.TranslationLoader.t("mongoDBConnectionChecker", this.localeLanguage, loggerConfig),
|
|
932
|
+
import_opticore_translator8.TranslationLoader.t("mongoConnectionSuccess", this.localeLanguage, loggerConfig)
|
|
957
933
|
);
|
|
958
934
|
console.log("");
|
|
959
935
|
} catch (e) {
|
|
@@ -1006,22 +982,22 @@ var DatabaseConnectionConfig = class {
|
|
|
1006
982
|
options
|
|
1007
983
|
);
|
|
1008
984
|
this.logger.success(
|
|
1009
|
-
|
|
1010
|
-
|
|
985
|
+
import_opticore_translator8.TranslationLoader.t("postgresDBConnectionChecker", this.localeLanguage, loggerConfig),
|
|
986
|
+
import_opticore_translator8.TranslationLoader.t("postgresConnectionSuccess", this.localeLanguage, loggerConfig)
|
|
1011
987
|
);
|
|
1012
988
|
console.log("");
|
|
1013
989
|
} catch (err) {
|
|
1014
990
|
const stackTrace = this.traceError(
|
|
1015
|
-
|
|
991
|
+
import_opticore_translator8.TranslationLoader.t(`${err.message}`, this.localeLanguage, loggerConfig),
|
|
1016
992
|
"PostgresConnectionError",
|
|
1017
|
-
|
|
993
|
+
import_opticore_http_response7.HttpStatusCode.NOT_ACCEPTABLE
|
|
1018
994
|
);
|
|
1019
995
|
this.logger.error(
|
|
1020
996
|
err.message,
|
|
1021
997
|
"PostgresConnectionError",
|
|
1022
998
|
"Postgres connection error",
|
|
1023
999
|
stackTrace.stack,
|
|
1024
|
-
|
|
1000
|
+
import_opticore_http_response7.HttpStatusCode.NOT_ACCEPTABLE
|
|
1025
1001
|
);
|
|
1026
1002
|
}
|
|
1027
1003
|
}
|
|
@@ -1064,9 +1040,9 @@ var MPostgresCheckerDatabase = (localLanguage, environnementPath, keepAlive, str
|
|
|
1064
1040
|
var import_node_process = __toESM(require("process"), 1);
|
|
1065
1041
|
var import_chalk = __toESM(require("chalk"), 1);
|
|
1066
1042
|
var import_ansi_colors = __toESM(require("ansi-colors"), 1);
|
|
1067
|
-
var
|
|
1043
|
+
var import_path = __toESM(require("path"), 1);
|
|
1068
1044
|
var import_fs = __toESM(require("fs"), 1);
|
|
1069
|
-
var
|
|
1045
|
+
var import_opticore_translator9 = require("opticore-translator");
|
|
1070
1046
|
var Utility = class {
|
|
1071
1047
|
localLang;
|
|
1072
1048
|
constructor(localLanguage) {
|
|
@@ -1131,7 +1107,7 @@ var Utility = class {
|
|
|
1131
1107
|
const endTime = import_node_process.default.hrtime(startTime);
|
|
1132
1108
|
const executionTime = (endTime[0] * 1e9 + endTime[1]) / 1e6;
|
|
1133
1109
|
return {
|
|
1134
|
-
"projectPath":
|
|
1110
|
+
"projectPath": import_path.default.join(import_node_process.default.cwd()),
|
|
1135
1111
|
"startingTime": `${executionTime.toFixed(5)} ms`
|
|
1136
1112
|
};
|
|
1137
1113
|
}
|
|
@@ -1141,7 +1117,7 @@ var Utility = class {
|
|
|
1141
1117
|
* @private
|
|
1142
1118
|
*/
|
|
1143
1119
|
getEnvFileLoading(filePath) {
|
|
1144
|
-
const fullPath =
|
|
1120
|
+
const fullPath = import_path.default.resolve(import_node_process.default.cwd(), filePath);
|
|
1145
1121
|
if (import_fs.default.existsSync(fullPath)) {
|
|
1146
1122
|
const env = import_fs.default.readFileSync(fullPath, "utf-8");
|
|
1147
1123
|
const lines = env.split("\n");
|
|
@@ -1163,19 +1139,19 @@ var Utility = class {
|
|
|
1163
1139
|
this.getEnvFileLoading(".env");
|
|
1164
1140
|
const isDevelopment = import_node_process.default.env.NODE_ENV === "development";
|
|
1165
1141
|
if (isDevelopment) {
|
|
1166
|
-
return `${
|
|
1142
|
+
return `${import_opticore_translator9.TranslationLoader.t("serverRunning", this.localLang)} ${import_ansi_colors.default.bgBlue(`${import_ansi_colors.default.bold(`${development}`)}`)} mode`;
|
|
1167
1143
|
} else {
|
|
1168
|
-
return `${
|
|
1144
|
+
return `${import_opticore_translator9.TranslationLoader.t("serverRunning", this.localLang)} ${import_ansi_colors.default.bgBlue(`${import_ansi_colors.default.bold(`${production}`)}`)} mode`;
|
|
1169
1145
|
}
|
|
1170
1146
|
}
|
|
1171
1147
|
infoServer(nodeVersion, startingTime, host, port, rss, heapUsed, user, system) {
|
|
1172
1148
|
const paddingLength = 52;
|
|
1173
1149
|
const msg0 = " ".padEnd(paddingLength, " ");
|
|
1174
|
-
const msg1 = ` ${
|
|
1150
|
+
const msg1 = ` ${import_opticore_translator9.TranslationLoader.t("okServerListening", this.localLang)}`;
|
|
1175
1151
|
const msg2Value = `${import_ansi_colors.default.bgBlue(`${import_ansi_colors.default.bold(`${nodeVersion}`)}`)}`;
|
|
1176
|
-
const msg2 = ` ${
|
|
1152
|
+
const msg2 = ` ${import_opticore_translator9.TranslationLoader.t("webServerUseNodeVersion", this.localLang)}`;
|
|
1177
1153
|
const msg3Value = `${import_ansi_colors.default.bgBlue(`${import_ansi_colors.default.bold(`${startingTime}`)}`)}`;
|
|
1178
|
-
const msg3 = ` ${
|
|
1154
|
+
const msg3 = ` ${import_opticore_translator9.TranslationLoader.t("startupTime", this.localLang)}`;
|
|
1179
1155
|
const msg4 = ` ${this.getServerRunningMode("development", "production")}`;
|
|
1180
1156
|
const msg5 = ` ${import_ansi_colors.default.underline(`http://${host}:${port}`)}`;
|
|
1181
1157
|
console.log(import_chalk.default.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
@@ -1186,18 +1162,18 @@ var Utility = class {
|
|
|
1186
1162
|
console.log(import_chalk.default.bgGreen.white(msg5.padEnd(61, " ")));
|
|
1187
1163
|
console.log(import_chalk.default.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
1188
1164
|
console.log(``);
|
|
1189
|
-
console.log(`${`${
|
|
1190
|
-
console.log(`${`${
|
|
1191
|
-
console.log(`${`${
|
|
1192
|
-
console.log(`${`${
|
|
1165
|
+
console.log(`${`${import_opticore_translator9.TranslationLoader.t("totalMemory", this.localLang)}`} ${import_ansi_colors.default.cyan(`${import_ansi_colors.default.bold(`${rss}`)}`)}`);
|
|
1166
|
+
console.log(`${`${import_opticore_translator9.TranslationLoader.t("memoryUsedDuringExecution", this.localLang)}`} ${import_ansi_colors.default.cyan(`${import_ansi_colors.default.bold(`${heapUsed}`)}`)}`);
|
|
1167
|
+
console.log(`${`${import_opticore_translator9.TranslationLoader.t("memoryUsedByUser", this.localLang)}`} ${import_ansi_colors.default.cyan(`${import_ansi_colors.default.bold(`${user}`)}`)}`);
|
|
1168
|
+
console.log(`${`${import_opticore_translator9.TranslationLoader.t("memoryUsedBySystem", this.localLang)}`} ${import_ansi_colors.default.cyan(`${import_ansi_colors.default.bold(`${system}`)}`)}`);
|
|
1193
1169
|
console.log(``);
|
|
1194
1170
|
}
|
|
1195
1171
|
};
|
|
1196
1172
|
|
|
1197
1173
|
// src/core/events/pathModuleVerifier.event.ts
|
|
1198
|
-
var
|
|
1199
|
-
var
|
|
1200
|
-
var
|
|
1174
|
+
var import_path2 = require("path");
|
|
1175
|
+
var import_opticore_http_response8 = require("opticore-http-response");
|
|
1176
|
+
var import_opticore_translator10 = require("opticore-translator");
|
|
1201
1177
|
var PathModuleVerifier = class {
|
|
1202
1178
|
log;
|
|
1203
1179
|
localeLanguage;
|
|
@@ -1219,11 +1195,11 @@ var PathModuleVerifier = class {
|
|
|
1219
1195
|
}
|
|
1220
1196
|
if (notLoadedPaths.length > 0) {
|
|
1221
1197
|
this.log.error(
|
|
1222
|
-
|
|
1198
|
+
import_opticore_translator10.TranslationLoader.t("moduleNotLoaded", this.localeLanguage, { notLoadedPaths: notLoadedPaths.join(", ") }),
|
|
1223
1199
|
"",
|
|
1224
1200
|
"",
|
|
1225
1201
|
modulePaths,
|
|
1226
|
-
|
|
1202
|
+
import_opticore_http_response8.HttpStatusCode.NOT_ACCEPTABLE
|
|
1227
1203
|
);
|
|
1228
1204
|
throw new Error();
|
|
1229
1205
|
}
|
|
@@ -1235,18 +1211,71 @@ var PathModuleVerifier = class {
|
|
|
1235
1211
|
*/
|
|
1236
1212
|
isModulePathLoaded(modulePath) {
|
|
1237
1213
|
try {
|
|
1238
|
-
const resolvedPath = (0,
|
|
1214
|
+
const resolvedPath = (0, import_path2.resolve)(modulePath);
|
|
1239
1215
|
return require.cache[resolvedPath] !== void 0;
|
|
1240
1216
|
} catch {
|
|
1241
1217
|
return false;
|
|
1242
1218
|
}
|
|
1243
1219
|
}
|
|
1244
1220
|
};
|
|
1221
|
+
|
|
1222
|
+
// src/core/config/loaders/localLanguage.loader.ts
|
|
1223
|
+
var import_path4 = __toESM(require("path"), 1);
|
|
1224
|
+
var import_opticore_translator12 = require("opticore-translator");
|
|
1225
|
+
var import_opticore_http_response10 = require("opticore-http-response");
|
|
1226
|
+
|
|
1227
|
+
// src/core/config/loaders/translateLanguage.loader.ts
|
|
1228
|
+
var import_path3 = __toESM(require("path"), 1);
|
|
1229
|
+
var import_module = require("module");
|
|
1230
|
+
var import_opticore_translator11 = require("opticore-translator");
|
|
1231
|
+
var import_opticore_http_response9 = require("opticore-http-response");
|
|
1232
|
+
var translateWebAppCoreLanguageLoader = (environnementPath, localLang) => {
|
|
1233
|
+
try {
|
|
1234
|
+
const require2 = (0, import_module.createRequire)(importMetaUrl);
|
|
1235
|
+
const packagePath = import_path3.default.dirname(require2.resolve("opticore-webapp-core"));
|
|
1236
|
+
const translateMsgJsonFilePath = import_path3.default.join(packagePath, "utils", "translations");
|
|
1237
|
+
import_opticore_translator11.TranslationLoader.loadTranslations(translateMsgJsonFilePath);
|
|
1238
|
+
} catch (err) {
|
|
1239
|
+
SLoggerFileConfiguration(environnementPath).error(
|
|
1240
|
+
import_opticore_translator11.TranslationLoader.t(err.message, localLang),
|
|
1241
|
+
err.code,
|
|
1242
|
+
err.code,
|
|
1243
|
+
err.stackTrace,
|
|
1244
|
+
import_opticore_http_response9.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
1245
|
+
);
|
|
1246
|
+
}
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1249
|
+
// src/core/config/loaders/localLanguage.loader.ts
|
|
1250
|
+
var LocalLanguageLoader = class {
|
|
1251
|
+
localeLanguage;
|
|
1252
|
+
environnementPath;
|
|
1253
|
+
constructor(localeLanguage, environnementPath) {
|
|
1254
|
+
this.localeLanguage = localeLanguage;
|
|
1255
|
+
this.environnementPath = environnementPath;
|
|
1256
|
+
translateWebAppCoreLanguageLoader(environnementPath, localeLanguage);
|
|
1257
|
+
}
|
|
1258
|
+
load() {
|
|
1259
|
+
try {
|
|
1260
|
+
const translateMsgJsonFilePath = import_path4.default.join(process.cwd(), "src", "utils", "translations");
|
|
1261
|
+
import_opticore_translator12.TranslationLoader.loadTranslations(translateMsgJsonFilePath);
|
|
1262
|
+
} catch (err) {
|
|
1263
|
+
SLoggerFileConfiguration(this.environnementPath).error(
|
|
1264
|
+
import_opticore_translator12.TranslationLoader.t(err.message, this.localeLanguage),
|
|
1265
|
+
err.code,
|
|
1266
|
+
err.code,
|
|
1267
|
+
err.stackTrace,
|
|
1268
|
+
import_opticore_http_response10.HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
1269
|
+
);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
};
|
|
1245
1273
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1246
1274
|
0 && (module.exports = {
|
|
1247
1275
|
CLogLevel,
|
|
1248
1276
|
CSignRSAKeyComponent,
|
|
1249
1277
|
Environment,
|
|
1278
|
+
LocalLanguageLoader,
|
|
1250
1279
|
MMongoCheckerDatabase,
|
|
1251
1280
|
MMySqlCheckerDatabase,
|
|
1252
1281
|
MPostgresCheckerDatabase,
|
package/dist/index.d.cts
CHANGED
|
@@ -385,6 +385,13 @@ declare class PathModuleVerifier {
|
|
|
385
385
|
private isModulePathLoaded;
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
+
declare class LocalLanguageLoader {
|
|
389
|
+
private readonly localeLanguage;
|
|
390
|
+
private readonly environnementPath;
|
|
391
|
+
constructor(localeLanguage: string, environnementPath: any);
|
|
392
|
+
load(): void;
|
|
393
|
+
}
|
|
394
|
+
|
|
388
395
|
interface IBodyParserOptions {
|
|
389
396
|
type: string;
|
|
390
397
|
}
|
|
@@ -463,4 +470,4 @@ declare function TTextBodyParser(options: IBodyParserOptions, localLanguage: str
|
|
|
463
470
|
*/
|
|
464
471
|
declare function TUrlencodedBodyParser(options: IBodyParserOptions, localLanguage: string, environnementPath: any): void;
|
|
465
472
|
|
|
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 };
|
|
473
|
+
export { CLogLevel, CSignRSAKeyComponent, Environment, type IBodyParserOptions, type IResponseBodyEndFromResponseEvent, type IResponseBodyWriteFromResponseEvent, type IWrappingBodyResponse, LocalLanguageLoader, 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
|
@@ -385,6 +385,13 @@ declare class PathModuleVerifier {
|
|
|
385
385
|
private isModulePathLoaded;
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
+
declare class LocalLanguageLoader {
|
|
389
|
+
private readonly localeLanguage;
|
|
390
|
+
private readonly environnementPath;
|
|
391
|
+
constructor(localeLanguage: string, environnementPath: any);
|
|
392
|
+
load(): void;
|
|
393
|
+
}
|
|
394
|
+
|
|
388
395
|
interface IBodyParserOptions {
|
|
389
396
|
type: string;
|
|
390
397
|
}
|
|
@@ -463,4 +470,4 @@ declare function TTextBodyParser(options: IBodyParserOptions, localLanguage: str
|
|
|
463
470
|
*/
|
|
464
471
|
declare function TUrlencodedBodyParser(options: IBodyParserOptions, localLanguage: string, environnementPath: any): void;
|
|
465
472
|
|
|
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 };
|
|
473
|
+
export { CLogLevel, CSignRSAKeyComponent, Environment, type IBodyParserOptions, type IResponseBodyEndFromResponseEvent, type IResponseBodyWriteFromResponseEvent, type IWrappingBodyResponse, LocalLanguageLoader, 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
|
@@ -654,38 +654,13 @@ var UOptionalArgumentConnection = (environnementPath) => {
|
|
|
654
654
|
|
|
655
655
|
// src/utils/parsing/parsingYaml.utils.ts
|
|
656
656
|
import { readFile } from "fs/promises";
|
|
657
|
-
import { HttpStatusCode
|
|
657
|
+
import { HttpStatusCode } from "opticore-http-response";
|
|
658
658
|
import { LoggerCore as LoggerCore3 } from "opticore-logger";
|
|
659
|
-
import { TranslationLoader as TranslationLoader7 } from "opticore-translator";
|
|
660
|
-
|
|
661
|
-
// src/core/config/loaders/translateLanguage.loader.ts
|
|
662
|
-
import path from "path";
|
|
663
|
-
import { createRequire } from "module";
|
|
664
659
|
import { TranslationLoader as TranslationLoader6 } from "opticore-translator";
|
|
665
|
-
import { HttpStatusCode } from "opticore-http-response";
|
|
666
|
-
var translateWebAppCoreLanguageLoader = (environnementPath, localLang) => {
|
|
667
|
-
try {
|
|
668
|
-
const require2 = createRequire(import.meta.url);
|
|
669
|
-
const packagePath = path.dirname(require2.resolve("opticore-webapp-core"));
|
|
670
|
-
const translateMsgJsonFilePath = path.join(packagePath, "utils", "translations");
|
|
671
|
-
TranslationLoader6.loadTranslations(translateMsgJsonFilePath);
|
|
672
|
-
} catch (err) {
|
|
673
|
-
SLoggerFileConfiguration(environnementPath).error(
|
|
674
|
-
TranslationLoader6.t(err.message, localLang),
|
|
675
|
-
err.code,
|
|
676
|
-
err.code,
|
|
677
|
-
err.stackTrace,
|
|
678
|
-
HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
679
|
-
);
|
|
680
|
-
}
|
|
681
|
-
};
|
|
682
|
-
|
|
683
|
-
// src/utils/parsing/parsingYaml.utils.ts
|
|
684
660
|
var YamlParsing = class {
|
|
685
661
|
logger;
|
|
686
662
|
localeLanguage;
|
|
687
663
|
constructor(localeLanguage, environnementPath) {
|
|
688
|
-
translateWebAppCoreLanguageLoader(environnementPath, localeLanguage);
|
|
689
664
|
this.localeLanguage = localeLanguage;
|
|
690
665
|
this.logger = new LoggerCore3(loggerConfig(environnementPath));
|
|
691
666
|
}
|
|
@@ -696,10 +671,10 @@ var YamlParsing = class {
|
|
|
696
671
|
} catch (error) {
|
|
697
672
|
this.logger.error(
|
|
698
673
|
error.message,
|
|
699
|
-
|
|
700
|
-
|
|
674
|
+
TranslationLoader6.t("parsingFailed", this.localeLanguage, this.logger),
|
|
675
|
+
TranslationLoader6.t("readingError", this.localeLanguage, this.logger),
|
|
701
676
|
error.stack,
|
|
702
|
-
|
|
677
|
+
HttpStatusCode.NOT_ACCEPTABLE
|
|
703
678
|
);
|
|
704
679
|
}
|
|
705
680
|
}
|
|
@@ -728,11 +703,11 @@ var YamlParsing = class {
|
|
|
728
703
|
}
|
|
729
704
|
} else {
|
|
730
705
|
this.logger.error(
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
706
|
+
TranslationLoader6.t("badFormat", this.localeLanguage, { line }),
|
|
707
|
+
TranslationLoader6.t("parsingFailed", this.localeLanguage, this.logger),
|
|
708
|
+
TranslationLoader6.t("unsupportedFormat", this.localeLanguage, this.logger),
|
|
734
709
|
content,
|
|
735
|
-
|
|
710
|
+
HttpStatusCode.NOT_ACCEPTABLE
|
|
736
711
|
);
|
|
737
712
|
}
|
|
738
713
|
}
|
|
@@ -758,12 +733,12 @@ var Environment = class {
|
|
|
758
733
|
import mySQL from "mysql";
|
|
759
734
|
import { HttpStatusCode as status6 } from "opticore-http-response";
|
|
760
735
|
import { LoggerCore as LoggerCore4 } from "opticore-logger";
|
|
761
|
-
import { TranslationLoader as
|
|
736
|
+
import { TranslationLoader as TranslationLoader8 } from "opticore-translator";
|
|
762
737
|
|
|
763
738
|
// src/core/errors/databaseConnexion.error.ts
|
|
764
739
|
import { HttpStatusCode as status5 } from "opticore-http-response";
|
|
765
740
|
import { StackTraceError as StackTraceError2 } from "opticore-catch-exception-error";
|
|
766
|
-
import { TranslationLoader as
|
|
741
|
+
import { TranslationLoader as TranslationLoader7 } from "opticore-translator";
|
|
767
742
|
var DbConnexionConfigError = class {
|
|
768
743
|
logger;
|
|
769
744
|
localeLanguage;
|
|
@@ -777,14 +752,14 @@ var DbConnexionConfigError = class {
|
|
|
777
752
|
*/
|
|
778
753
|
mongoDBAuthenticationFailed(e) {
|
|
779
754
|
const stackTrace = this.traceError(
|
|
780
|
-
|
|
781
|
-
|
|
755
|
+
TranslationLoader7.t("mongoDBConnection", this.localeLanguage, { e }),
|
|
756
|
+
TranslationLoader7.t("mongoDBAuthentication", this.localeLanguage),
|
|
782
757
|
status5.UNAUTHORIZED
|
|
783
758
|
);
|
|
784
759
|
this.logger.error(
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
760
|
+
TranslationLoader7.t("mongoDBAuthenticationError", this.localeLanguage),
|
|
761
|
+
TranslationLoader7.t("mongoDBConnection", this.localeLanguage),
|
|
762
|
+
TranslationLoader7.t("mongoDBAuthenticationFailed", this.localeLanguage),
|
|
788
763
|
stackTrace.stack,
|
|
789
764
|
status5.UNAUTHORIZED
|
|
790
765
|
);
|
|
@@ -797,14 +772,14 @@ var DbConnexionConfigError = class {
|
|
|
797
772
|
*/
|
|
798
773
|
mongoDBInvalidUrl(err, dbHost, dbPort) {
|
|
799
774
|
const stackTrace = this.traceError(
|
|
800
|
-
|
|
801
|
-
|
|
775
|
+
TranslationLoader7.t("mongoDBConnection", this.localeLanguage, { err }),
|
|
776
|
+
TranslationLoader7.t("mongoDBUnableParsingUrl", this.localeLanguage),
|
|
802
777
|
status5.BAD_REQUEST
|
|
803
778
|
);
|
|
804
779
|
this.logger.error(
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
780
|
+
TranslationLoader7.t("dbUrlParsingError", this.localeLanguage, { dbHost, dbPort }),
|
|
781
|
+
TranslationLoader7.t("mongoDBConnection", this.localeLanguage),
|
|
782
|
+
TranslationLoader7.t("mongoDBUnableParsingUrl", this.localeLanguage),
|
|
808
783
|
stackTrace.stack,
|
|
809
784
|
status5.BAD_REQUEST
|
|
810
785
|
);
|
|
@@ -816,14 +791,14 @@ var DbConnexionConfigError = class {
|
|
|
816
791
|
*/
|
|
817
792
|
mongoDBEaiAgain(err, dbHost) {
|
|
818
793
|
const stackTrace = this.traceError(
|
|
819
|
-
|
|
820
|
-
|
|
794
|
+
TranslationLoader7.t("mongoDBConnection", this.localeLanguage, { err }),
|
|
795
|
+
TranslationLoader7.t("mongoDBServerSelection", this.localeLanguage),
|
|
821
796
|
status5.BAD_REQUEST
|
|
822
797
|
);
|
|
823
798
|
this.logger.error(
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
799
|
+
TranslationLoader7.t("mongoServerError", this.localeLanguage, { dbHost }),
|
|
800
|
+
TranslationLoader7.t("mongoDBConnection", this.localeLanguage),
|
|
801
|
+
TranslationLoader7.t("mongoDBServerSelection", this.localeLanguage),
|
|
827
802
|
stackTrace.stack,
|
|
828
803
|
status5.BAD_REQUEST
|
|
829
804
|
);
|
|
@@ -834,13 +809,13 @@ var DbConnexionConfigError = class {
|
|
|
834
809
|
*/
|
|
835
810
|
mongoDbGlobalError(err) {
|
|
836
811
|
const stackTrace = this.traceError(
|
|
837
|
-
|
|
838
|
-
|
|
812
|
+
TranslationLoader7.t("mongoDBConnection", this.localeLanguage, { err }),
|
|
813
|
+
TranslationLoader7.t("mongoDBConnection", this.localeLanguage),
|
|
839
814
|
status5.NOT_ACCEPTABLE
|
|
840
815
|
);
|
|
841
816
|
this.logger.error(
|
|
842
|
-
|
|
843
|
-
|
|
817
|
+
TranslationLoader7.t("mongoDBConnection", this.localeLanguage),
|
|
818
|
+
TranslationLoader7.t("mongoDBConnectionError", this.localeLanguage),
|
|
844
819
|
stackTrace.stack,
|
|
845
820
|
err.message,
|
|
846
821
|
status5.NOT_ACCEPTABLE
|
|
@@ -901,8 +876,8 @@ var DatabaseConnectionConfig = class {
|
|
|
901
876
|
try {
|
|
902
877
|
await SCheckerMongoDatabaseConnection(url, this.env.get("dataBaseUser"), this.env.get("dataBasePassword"), this.env.get("dataBaseName"));
|
|
903
878
|
this.logger.success(
|
|
904
|
-
|
|
905
|
-
|
|
879
|
+
TranslationLoader8.t("mongoDBConnectionChecker", this.localeLanguage, loggerConfig),
|
|
880
|
+
TranslationLoader8.t("mongoConnectionSuccess", this.localeLanguage, loggerConfig)
|
|
906
881
|
);
|
|
907
882
|
console.log("");
|
|
908
883
|
} catch (e) {
|
|
@@ -955,13 +930,13 @@ var DatabaseConnectionConfig = class {
|
|
|
955
930
|
options
|
|
956
931
|
);
|
|
957
932
|
this.logger.success(
|
|
958
|
-
|
|
959
|
-
|
|
933
|
+
TranslationLoader8.t("postgresDBConnectionChecker", this.localeLanguage, loggerConfig),
|
|
934
|
+
TranslationLoader8.t("postgresConnectionSuccess", this.localeLanguage, loggerConfig)
|
|
960
935
|
);
|
|
961
936
|
console.log("");
|
|
962
937
|
} catch (err) {
|
|
963
938
|
const stackTrace = this.traceError(
|
|
964
|
-
|
|
939
|
+
TranslationLoader8.t(`${err.message}`, this.localeLanguage, loggerConfig),
|
|
965
940
|
"PostgresConnectionError",
|
|
966
941
|
status6.NOT_ACCEPTABLE
|
|
967
942
|
);
|
|
@@ -1010,12 +985,12 @@ var MPostgresCheckerDatabase = (localLanguage, environnementPath, keepAlive, str
|
|
|
1010
985
|
};
|
|
1011
986
|
|
|
1012
987
|
// src/utils/utility.utils.ts
|
|
1013
|
-
import
|
|
988
|
+
import process2 from "node:process";
|
|
1014
989
|
import chalk from "chalk";
|
|
1015
990
|
import colors from "ansi-colors";
|
|
1016
|
-
import
|
|
991
|
+
import path from "path";
|
|
1017
992
|
import fs from "fs";
|
|
1018
|
-
import { TranslationLoader as
|
|
993
|
+
import { TranslationLoader as TranslationLoader9 } from "opticore-translator";
|
|
1019
994
|
var Utility = class {
|
|
1020
995
|
localLang;
|
|
1021
996
|
constructor(localLanguage) {
|
|
@@ -1034,7 +1009,7 @@ var Utility = class {
|
|
|
1034
1009
|
* Returns an Object containing a node version, openssl, and v0
|
|
1035
1010
|
*/
|
|
1036
1011
|
getVersions() {
|
|
1037
|
-
const processVers =
|
|
1012
|
+
const processVers = process2.versions;
|
|
1038
1013
|
const data = {
|
|
1039
1014
|
"node version": processVers.node,
|
|
1040
1015
|
"openssl": processVers.openssl,
|
|
@@ -1054,14 +1029,14 @@ var Utility = class {
|
|
|
1054
1029
|
* and Memory usage system
|
|
1055
1030
|
*/
|
|
1056
1031
|
getUsageMemory() {
|
|
1057
|
-
const memoryData =
|
|
1032
|
+
const memoryData = process2.memoryUsage();
|
|
1058
1033
|
const data = {
|
|
1059
1034
|
"Resident Set Size - total memory allocated for the process execution": this.formatMemoryUsage(memoryData.rss),
|
|
1060
1035
|
"Total size of the allocated heap": this.formatMemoryUsage(memoryData.heapTotal),
|
|
1061
1036
|
"Actual memory used during the execution": this.formatMemoryUsage(memoryData.heapUsed),
|
|
1062
1037
|
"V8 external memory": this.formatMemoryUsage(memoryData.external),
|
|
1063
|
-
"Memory usage user": this.formatMemoryUsage(
|
|
1064
|
-
"Memory usage system": this.formatMemoryUsage(
|
|
1038
|
+
"Memory usage user": this.formatMemoryUsage(process2.cpuUsage().user),
|
|
1039
|
+
"Memory usage system": this.formatMemoryUsage(process2.cpuUsage().system)
|
|
1065
1040
|
};
|
|
1066
1041
|
return {
|
|
1067
1042
|
"rss": data["Resident Set Size - total memory allocated for the process execution"],
|
|
@@ -1076,11 +1051,11 @@ var Utility = class {
|
|
|
1076
1051
|
* Return an Object containing a project path and running server time
|
|
1077
1052
|
*/
|
|
1078
1053
|
getProjectInfo() {
|
|
1079
|
-
const startTime =
|
|
1080
|
-
const endTime =
|
|
1054
|
+
const startTime = process2.hrtime();
|
|
1055
|
+
const endTime = process2.hrtime(startTime);
|
|
1081
1056
|
const executionTime = (endTime[0] * 1e9 + endTime[1]) / 1e6;
|
|
1082
1057
|
return {
|
|
1083
|
-
"projectPath":
|
|
1058
|
+
"projectPath": path.join(process2.cwd()),
|
|
1084
1059
|
"startingTime": `${executionTime.toFixed(5)} ms`
|
|
1085
1060
|
};
|
|
1086
1061
|
}
|
|
@@ -1090,7 +1065,7 @@ var Utility = class {
|
|
|
1090
1065
|
* @private
|
|
1091
1066
|
*/
|
|
1092
1067
|
getEnvFileLoading(filePath) {
|
|
1093
|
-
const fullPath =
|
|
1068
|
+
const fullPath = path.resolve(process2.cwd(), filePath);
|
|
1094
1069
|
if (fs.existsSync(fullPath)) {
|
|
1095
1070
|
const env = fs.readFileSync(fullPath, "utf-8");
|
|
1096
1071
|
const lines = env.split("\n");
|
|
@@ -1098,7 +1073,7 @@ var Utility = class {
|
|
|
1098
1073
|
const match = line.match(/^([^#=]+)=([^#]+)$/);
|
|
1099
1074
|
if (match) {
|
|
1100
1075
|
const key = match[1].trim();
|
|
1101
|
-
|
|
1076
|
+
process2.env[key] = match[2].trim();
|
|
1102
1077
|
}
|
|
1103
1078
|
});
|
|
1104
1079
|
}
|
|
@@ -1110,21 +1085,21 @@ var Utility = class {
|
|
|
1110
1085
|
*/
|
|
1111
1086
|
getServerRunningMode(development, production) {
|
|
1112
1087
|
this.getEnvFileLoading(".env");
|
|
1113
|
-
const isDevelopment =
|
|
1088
|
+
const isDevelopment = process2.env.NODE_ENV === "development";
|
|
1114
1089
|
if (isDevelopment) {
|
|
1115
|
-
return `${
|
|
1090
|
+
return `${TranslationLoader9.t("serverRunning", this.localLang)} ${colors.bgBlue(`${colors.bold(`${development}`)}`)} mode`;
|
|
1116
1091
|
} else {
|
|
1117
|
-
return `${
|
|
1092
|
+
return `${TranslationLoader9.t("serverRunning", this.localLang)} ${colors.bgBlue(`${colors.bold(`${production}`)}`)} mode`;
|
|
1118
1093
|
}
|
|
1119
1094
|
}
|
|
1120
1095
|
infoServer(nodeVersion, startingTime, host, port, rss, heapUsed, user, system) {
|
|
1121
1096
|
const paddingLength = 52;
|
|
1122
1097
|
const msg0 = " ".padEnd(paddingLength, " ");
|
|
1123
|
-
const msg1 = ` ${
|
|
1098
|
+
const msg1 = ` ${TranslationLoader9.t("okServerListening", this.localLang)}`;
|
|
1124
1099
|
const msg2Value = `${colors.bgBlue(`${colors.bold(`${nodeVersion}`)}`)}`;
|
|
1125
|
-
const msg2 = ` ${
|
|
1100
|
+
const msg2 = ` ${TranslationLoader9.t("webServerUseNodeVersion", this.localLang)}`;
|
|
1126
1101
|
const msg3Value = `${colors.bgBlue(`${colors.bold(`${startingTime}`)}`)}`;
|
|
1127
|
-
const msg3 = ` ${
|
|
1102
|
+
const msg3 = ` ${TranslationLoader9.t("startupTime", this.localLang)}`;
|
|
1128
1103
|
const msg4 = ` ${this.getServerRunningMode("development", "production")}`;
|
|
1129
1104
|
const msg5 = ` ${colors.underline(`http://${host}:${port}`)}`;
|
|
1130
1105
|
console.log(chalk.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
@@ -1135,18 +1110,18 @@ var Utility = class {
|
|
|
1135
1110
|
console.log(chalk.bgGreen.white(msg5.padEnd(61, " ")));
|
|
1136
1111
|
console.log(chalk.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
1137
1112
|
console.log(``);
|
|
1138
|
-
console.log(`${`${
|
|
1139
|
-
console.log(`${`${
|
|
1140
|
-
console.log(`${`${
|
|
1141
|
-
console.log(`${`${
|
|
1113
|
+
console.log(`${`${TranslationLoader9.t("totalMemory", this.localLang)}`} ${colors.cyan(`${colors.bold(`${rss}`)}`)}`);
|
|
1114
|
+
console.log(`${`${TranslationLoader9.t("memoryUsedDuringExecution", this.localLang)}`} ${colors.cyan(`${colors.bold(`${heapUsed}`)}`)}`);
|
|
1115
|
+
console.log(`${`${TranslationLoader9.t("memoryUsedByUser", this.localLang)}`} ${colors.cyan(`${colors.bold(`${user}`)}`)}`);
|
|
1116
|
+
console.log(`${`${TranslationLoader9.t("memoryUsedBySystem", this.localLang)}`} ${colors.cyan(`${colors.bold(`${system}`)}`)}`);
|
|
1142
1117
|
console.log(``);
|
|
1143
1118
|
}
|
|
1144
1119
|
};
|
|
1145
1120
|
|
|
1146
1121
|
// src/core/events/pathModuleVerifier.event.ts
|
|
1147
1122
|
import { resolve } from "path";
|
|
1148
|
-
import { HttpStatusCode as
|
|
1149
|
-
import { TranslationLoader as
|
|
1123
|
+
import { HttpStatusCode as HttpStatusCode2 } from "opticore-http-response";
|
|
1124
|
+
import { TranslationLoader as TranslationLoader10 } from "opticore-translator";
|
|
1150
1125
|
var PathModuleVerifier = class {
|
|
1151
1126
|
log;
|
|
1152
1127
|
localeLanguage;
|
|
@@ -1168,11 +1143,11 @@ var PathModuleVerifier = class {
|
|
|
1168
1143
|
}
|
|
1169
1144
|
if (notLoadedPaths.length > 0) {
|
|
1170
1145
|
this.log.error(
|
|
1171
|
-
|
|
1146
|
+
TranslationLoader10.t("moduleNotLoaded", this.localeLanguage, { notLoadedPaths: notLoadedPaths.join(", ") }),
|
|
1172
1147
|
"",
|
|
1173
1148
|
"",
|
|
1174
1149
|
modulePaths,
|
|
1175
|
-
|
|
1150
|
+
HttpStatusCode2.NOT_ACCEPTABLE
|
|
1176
1151
|
);
|
|
1177
1152
|
throw new Error();
|
|
1178
1153
|
}
|
|
@@ -1191,10 +1166,63 @@ var PathModuleVerifier = class {
|
|
|
1191
1166
|
}
|
|
1192
1167
|
}
|
|
1193
1168
|
};
|
|
1169
|
+
|
|
1170
|
+
// src/core/config/loaders/localLanguage.loader.ts
|
|
1171
|
+
import path3 from "path";
|
|
1172
|
+
import { TranslationLoader as TranslationLoader12 } from "opticore-translator";
|
|
1173
|
+
import { HttpStatusCode as HttpStatusCode4 } from "opticore-http-response";
|
|
1174
|
+
|
|
1175
|
+
// src/core/config/loaders/translateLanguage.loader.ts
|
|
1176
|
+
import path2 from "path";
|
|
1177
|
+
import { createRequire } from "module";
|
|
1178
|
+
import { TranslationLoader as TranslationLoader11 } from "opticore-translator";
|
|
1179
|
+
import { HttpStatusCode as HttpStatusCode3 } from "opticore-http-response";
|
|
1180
|
+
var translateWebAppCoreLanguageLoader = (environnementPath, localLang) => {
|
|
1181
|
+
try {
|
|
1182
|
+
const require2 = createRequire(import.meta.url);
|
|
1183
|
+
const packagePath = path2.dirname(require2.resolve("opticore-webapp-core"));
|
|
1184
|
+
const translateMsgJsonFilePath = path2.join(packagePath, "utils", "translations");
|
|
1185
|
+
TranslationLoader11.loadTranslations(translateMsgJsonFilePath);
|
|
1186
|
+
} catch (err) {
|
|
1187
|
+
SLoggerFileConfiguration(environnementPath).error(
|
|
1188
|
+
TranslationLoader11.t(err.message, localLang),
|
|
1189
|
+
err.code,
|
|
1190
|
+
err.code,
|
|
1191
|
+
err.stackTrace,
|
|
1192
|
+
HttpStatusCode3.INTERNAL_SERVER_ERROR
|
|
1193
|
+
);
|
|
1194
|
+
}
|
|
1195
|
+
};
|
|
1196
|
+
|
|
1197
|
+
// src/core/config/loaders/localLanguage.loader.ts
|
|
1198
|
+
var LocalLanguageLoader = class {
|
|
1199
|
+
localeLanguage;
|
|
1200
|
+
environnementPath;
|
|
1201
|
+
constructor(localeLanguage, environnementPath) {
|
|
1202
|
+
this.localeLanguage = localeLanguage;
|
|
1203
|
+
this.environnementPath = environnementPath;
|
|
1204
|
+
translateWebAppCoreLanguageLoader(environnementPath, localeLanguage);
|
|
1205
|
+
}
|
|
1206
|
+
load() {
|
|
1207
|
+
try {
|
|
1208
|
+
const translateMsgJsonFilePath = path3.join(process.cwd(), "src", "utils", "translations");
|
|
1209
|
+
TranslationLoader12.loadTranslations(translateMsgJsonFilePath);
|
|
1210
|
+
} catch (err) {
|
|
1211
|
+
SLoggerFileConfiguration(this.environnementPath).error(
|
|
1212
|
+
TranslationLoader12.t(err.message, this.localeLanguage),
|
|
1213
|
+
err.code,
|
|
1214
|
+
err.code,
|
|
1215
|
+
err.stackTrace,
|
|
1216
|
+
HttpStatusCode4.INTERNAL_SERVER_ERROR
|
|
1217
|
+
);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
};
|
|
1194
1221
|
export {
|
|
1195
1222
|
CLogLevel,
|
|
1196
1223
|
CSignRSAKeyComponent,
|
|
1197
1224
|
Environment,
|
|
1225
|
+
LocalLanguageLoader,
|
|
1198
1226
|
MMongoCheckerDatabase,
|
|
1199
1227
|
MMySqlCheckerDatabase,
|
|
1200
1228
|
MPostgresCheckerDatabase,
|