opticore-webapp-core 1.0.13 → 1.0.15
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 +34 -23
- package/dist/index.js +22 -11
- package/package.json +6 -5
package/dist/index.cjs
CHANGED
|
@@ -705,7 +705,7 @@ var UOptionalArgumentConnection = (environnementPath) => {
|
|
|
705
705
|
|
|
706
706
|
// src/utils/parsing/parsingYaml.utils.ts
|
|
707
707
|
var import_promises = require("fs/promises");
|
|
708
|
-
var
|
|
708
|
+
var import_opticore_http_response6 = require("opticore-http-response");
|
|
709
709
|
var import_opticore_logger3 = require("opticore-logger");
|
|
710
710
|
var import_opticore_translator7 = require("opticore-translator");
|
|
711
711
|
|
|
@@ -713,11 +713,22 @@ var import_opticore_translator7 = require("opticore-translator");
|
|
|
713
713
|
var import_path = __toESM(require("path"), 1);
|
|
714
714
|
var import_module = require("module");
|
|
715
715
|
var import_opticore_translator6 = require("opticore-translator");
|
|
716
|
-
var
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
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
|
+
}
|
|
721
732
|
};
|
|
722
733
|
|
|
723
734
|
// src/utils/parsing/parsingYaml.utils.ts
|
|
@@ -725,9 +736,9 @@ var YamlParsing = class {
|
|
|
725
736
|
logger;
|
|
726
737
|
localeLanguage;
|
|
727
738
|
constructor(localeLanguage, environnementPath) {
|
|
739
|
+
translateWebAppCoreLanguageLoader(environnementPath, localeLanguage);
|
|
728
740
|
this.localeLanguage = localeLanguage;
|
|
729
741
|
this.logger = new import_opticore_logger3.LoggerCore(loggerConfig(environnementPath));
|
|
730
|
-
translateWebAppCoreLanguageLoader();
|
|
731
742
|
}
|
|
732
743
|
async readFile(filePath) {
|
|
733
744
|
try {
|
|
@@ -739,7 +750,7 @@ var YamlParsing = class {
|
|
|
739
750
|
import_opticore_translator7.TranslationLoader.t("parsingFailed", this.localeLanguage, this.logger),
|
|
740
751
|
import_opticore_translator7.TranslationLoader.t("readingError", this.localeLanguage, this.logger),
|
|
741
752
|
error.stack,
|
|
742
|
-
|
|
753
|
+
import_opticore_http_response6.HttpStatusCode.NOT_ACCEPTABLE
|
|
743
754
|
);
|
|
744
755
|
}
|
|
745
756
|
}
|
|
@@ -772,7 +783,7 @@ var YamlParsing = class {
|
|
|
772
783
|
import_opticore_translator7.TranslationLoader.t("parsingFailed", this.localeLanguage, this.logger),
|
|
773
784
|
import_opticore_translator7.TranslationLoader.t("unsupportedFormat", this.localeLanguage, this.logger),
|
|
774
785
|
content,
|
|
775
|
-
|
|
786
|
+
import_opticore_http_response6.HttpStatusCode.NOT_ACCEPTABLE
|
|
776
787
|
);
|
|
777
788
|
}
|
|
778
789
|
}
|
|
@@ -796,12 +807,12 @@ var Environment = class {
|
|
|
796
807
|
|
|
797
808
|
// src/core/config/database/connexion.config.database.ts
|
|
798
809
|
var import_mysql = __toESM(require("mysql"), 1);
|
|
799
|
-
var
|
|
810
|
+
var import_opticore_http_response8 = require("opticore-http-response");
|
|
800
811
|
var import_opticore_logger4 = require("opticore-logger");
|
|
801
812
|
var import_opticore_translator9 = require("opticore-translator");
|
|
802
813
|
|
|
803
814
|
// src/core/errors/databaseConnexion.error.ts
|
|
804
|
-
var
|
|
815
|
+
var import_opticore_http_response7 = require("opticore-http-response");
|
|
805
816
|
var import_opticore_catch_exception_error3 = require("opticore-catch-exception-error");
|
|
806
817
|
var import_opticore_translator8 = require("opticore-translator");
|
|
807
818
|
var DbConnexionConfigError = class {
|
|
@@ -819,14 +830,14 @@ var DbConnexionConfigError = class {
|
|
|
819
830
|
const stackTrace = this.traceError(
|
|
820
831
|
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { e }),
|
|
821
832
|
import_opticore_translator8.TranslationLoader.t("mongoDBAuthentication", this.localeLanguage),
|
|
822
|
-
|
|
833
|
+
import_opticore_http_response7.HttpStatusCode.UNAUTHORIZED
|
|
823
834
|
);
|
|
824
835
|
this.logger.error(
|
|
825
836
|
import_opticore_translator8.TranslationLoader.t("mongoDBAuthenticationError", this.localeLanguage),
|
|
826
837
|
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
827
838
|
import_opticore_translator8.TranslationLoader.t("mongoDBAuthenticationFailed", this.localeLanguage),
|
|
828
839
|
stackTrace.stack,
|
|
829
|
-
|
|
840
|
+
import_opticore_http_response7.HttpStatusCode.UNAUTHORIZED
|
|
830
841
|
);
|
|
831
842
|
}
|
|
832
843
|
/**
|
|
@@ -839,14 +850,14 @@ var DbConnexionConfigError = class {
|
|
|
839
850
|
const stackTrace = this.traceError(
|
|
840
851
|
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { err }),
|
|
841
852
|
import_opticore_translator8.TranslationLoader.t("mongoDBUnableParsingUrl", this.localeLanguage),
|
|
842
|
-
|
|
853
|
+
import_opticore_http_response7.HttpStatusCode.BAD_REQUEST
|
|
843
854
|
);
|
|
844
855
|
this.logger.error(
|
|
845
856
|
import_opticore_translator8.TranslationLoader.t("dbUrlParsingError", this.localeLanguage, { dbHost, dbPort }),
|
|
846
857
|
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
847
858
|
import_opticore_translator8.TranslationLoader.t("mongoDBUnableParsingUrl", this.localeLanguage),
|
|
848
859
|
stackTrace.stack,
|
|
849
|
-
|
|
860
|
+
import_opticore_http_response7.HttpStatusCode.BAD_REQUEST
|
|
850
861
|
);
|
|
851
862
|
}
|
|
852
863
|
/**
|
|
@@ -858,14 +869,14 @@ var DbConnexionConfigError = class {
|
|
|
858
869
|
const stackTrace = this.traceError(
|
|
859
870
|
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { err }),
|
|
860
871
|
import_opticore_translator8.TranslationLoader.t("mongoDBServerSelection", this.localeLanguage),
|
|
861
|
-
|
|
872
|
+
import_opticore_http_response7.HttpStatusCode.BAD_REQUEST
|
|
862
873
|
);
|
|
863
874
|
this.logger.error(
|
|
864
875
|
import_opticore_translator8.TranslationLoader.t("mongoServerError", this.localeLanguage, { dbHost }),
|
|
865
876
|
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
866
877
|
import_opticore_translator8.TranslationLoader.t("mongoDBServerSelection", this.localeLanguage),
|
|
867
878
|
stackTrace.stack,
|
|
868
|
-
|
|
879
|
+
import_opticore_http_response7.HttpStatusCode.BAD_REQUEST
|
|
869
880
|
);
|
|
870
881
|
}
|
|
871
882
|
/**
|
|
@@ -876,14 +887,14 @@ var DbConnexionConfigError = class {
|
|
|
876
887
|
const stackTrace = this.traceError(
|
|
877
888
|
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage, { err }),
|
|
878
889
|
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
879
|
-
|
|
890
|
+
import_opticore_http_response7.HttpStatusCode.NOT_ACCEPTABLE
|
|
880
891
|
);
|
|
881
892
|
this.logger.error(
|
|
882
893
|
import_opticore_translator8.TranslationLoader.t("mongoDBConnection", this.localeLanguage),
|
|
883
894
|
import_opticore_translator8.TranslationLoader.t("mongoDBConnectionError", this.localeLanguage),
|
|
884
895
|
stackTrace.stack,
|
|
885
896
|
err.message,
|
|
886
|
-
|
|
897
|
+
import_opticore_http_response7.HttpStatusCode.NOT_ACCEPTABLE
|
|
887
898
|
);
|
|
888
899
|
}
|
|
889
900
|
/**
|
|
@@ -1003,14 +1014,14 @@ var DatabaseConnectionConfig = class {
|
|
|
1003
1014
|
const stackTrace = this.traceError(
|
|
1004
1015
|
import_opticore_translator9.TranslationLoader.t(`${err.message}`, this.localeLanguage, loggerConfig),
|
|
1005
1016
|
"PostgresConnectionError",
|
|
1006
|
-
|
|
1017
|
+
import_opticore_http_response8.HttpStatusCode.NOT_ACCEPTABLE
|
|
1007
1018
|
);
|
|
1008
1019
|
this.logger.error(
|
|
1009
1020
|
err.message,
|
|
1010
1021
|
"PostgresConnectionError",
|
|
1011
1022
|
"Postgres connection error",
|
|
1012
1023
|
stackTrace.stack,
|
|
1013
|
-
|
|
1024
|
+
import_opticore_http_response8.HttpStatusCode.NOT_ACCEPTABLE
|
|
1014
1025
|
);
|
|
1015
1026
|
}
|
|
1016
1027
|
}
|
|
@@ -1185,7 +1196,7 @@ var Utility = class {
|
|
|
1185
1196
|
|
|
1186
1197
|
// src/core/events/pathModuleVerifier.event.ts
|
|
1187
1198
|
var import_path3 = require("path");
|
|
1188
|
-
var
|
|
1199
|
+
var import_opticore_http_response9 = require("opticore-http-response");
|
|
1189
1200
|
var import_opticore_translator11 = require("opticore-translator");
|
|
1190
1201
|
var PathModuleVerifier = class {
|
|
1191
1202
|
log;
|
|
@@ -1212,7 +1223,7 @@ var PathModuleVerifier = class {
|
|
|
1212
1223
|
"",
|
|
1213
1224
|
"",
|
|
1214
1225
|
modulePaths,
|
|
1215
|
-
|
|
1226
|
+
import_opticore_http_response9.HttpStatusCode.NOT_ACCEPTABLE
|
|
1216
1227
|
);
|
|
1217
1228
|
throw new Error();
|
|
1218
1229
|
}
|
package/dist/index.js
CHANGED
|
@@ -654,7 +654,7 @@ var UOptionalArgumentConnection = (environnementPath) => {
|
|
|
654
654
|
|
|
655
655
|
// src/utils/parsing/parsingYaml.utils.ts
|
|
656
656
|
import { readFile } from "fs/promises";
|
|
657
|
-
import { HttpStatusCode } from "opticore-http-response";
|
|
657
|
+
import { HttpStatusCode as HttpStatusCode2 } from "opticore-http-response";
|
|
658
658
|
import { LoggerCore as LoggerCore3 } from "opticore-logger";
|
|
659
659
|
import { TranslationLoader as TranslationLoader7 } from "opticore-translator";
|
|
660
660
|
|
|
@@ -662,11 +662,22 @@ import { TranslationLoader as TranslationLoader7 } from "opticore-translator";
|
|
|
662
662
|
import path from "path";
|
|
663
663
|
import { createRequire } from "module";
|
|
664
664
|
import { TranslationLoader as TranslationLoader6 } from "opticore-translator";
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
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
|
+
}
|
|
670
681
|
};
|
|
671
682
|
|
|
672
683
|
// src/utils/parsing/parsingYaml.utils.ts
|
|
@@ -674,9 +685,9 @@ var YamlParsing = class {
|
|
|
674
685
|
logger;
|
|
675
686
|
localeLanguage;
|
|
676
687
|
constructor(localeLanguage, environnementPath) {
|
|
688
|
+
translateWebAppCoreLanguageLoader(environnementPath, localeLanguage);
|
|
677
689
|
this.localeLanguage = localeLanguage;
|
|
678
690
|
this.logger = new LoggerCore3(loggerConfig(environnementPath));
|
|
679
|
-
translateWebAppCoreLanguageLoader();
|
|
680
691
|
}
|
|
681
692
|
async readFile(filePath) {
|
|
682
693
|
try {
|
|
@@ -688,7 +699,7 @@ var YamlParsing = class {
|
|
|
688
699
|
TranslationLoader7.t("parsingFailed", this.localeLanguage, this.logger),
|
|
689
700
|
TranslationLoader7.t("readingError", this.localeLanguage, this.logger),
|
|
690
701
|
error.stack,
|
|
691
|
-
|
|
702
|
+
HttpStatusCode2.NOT_ACCEPTABLE
|
|
692
703
|
);
|
|
693
704
|
}
|
|
694
705
|
}
|
|
@@ -721,7 +732,7 @@ var YamlParsing = class {
|
|
|
721
732
|
TranslationLoader7.t("parsingFailed", this.localeLanguage, this.logger),
|
|
722
733
|
TranslationLoader7.t("unsupportedFormat", this.localeLanguage, this.logger),
|
|
723
734
|
content,
|
|
724
|
-
|
|
735
|
+
HttpStatusCode2.NOT_ACCEPTABLE
|
|
725
736
|
);
|
|
726
737
|
}
|
|
727
738
|
}
|
|
@@ -1134,7 +1145,7 @@ var Utility = class {
|
|
|
1134
1145
|
|
|
1135
1146
|
// src/core/events/pathModuleVerifier.event.ts
|
|
1136
1147
|
import { resolve } from "path";
|
|
1137
|
-
import { HttpStatusCode as
|
|
1148
|
+
import { HttpStatusCode as HttpStatusCode3 } from "opticore-http-response";
|
|
1138
1149
|
import { TranslationLoader as TranslationLoader11 } from "opticore-translator";
|
|
1139
1150
|
var PathModuleVerifier = class {
|
|
1140
1151
|
log;
|
|
@@ -1161,7 +1172,7 @@ var PathModuleVerifier = class {
|
|
|
1161
1172
|
"",
|
|
1162
1173
|
"",
|
|
1163
1174
|
modulePaths,
|
|
1164
|
-
|
|
1175
|
+
HttpStatusCode3.NOT_ACCEPTABLE
|
|
1165
1176
|
);
|
|
1166
1177
|
throw new Error();
|
|
1167
1178
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opticore-webapp-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "opticore Web Application core module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -31,11 +31,12 @@
|
|
|
31
31
|
"mongodb": "^6.6.1",
|
|
32
32
|
"mysql": "^2.18.1",
|
|
33
33
|
"opticore-catch-exception-error": "^1.0.18",
|
|
34
|
-
"opticore-env-access": "^1.0.
|
|
34
|
+
"opticore-env-access": "^1.0.6",
|
|
35
35
|
"opticore-express": "^1.0.3",
|
|
36
36
|
"opticore-http-response": "^1.0.3",
|
|
37
|
+
"opticore-inject-dependency": "^1.0.6",
|
|
37
38
|
"opticore-logger": "^1.0.14",
|
|
38
|
-
"opticore-translator": "^1.0.
|
|
39
|
+
"opticore-translator": "^1.0.10",
|
|
39
40
|
"pg": "^8.11.5"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
@@ -43,8 +44,8 @@
|
|
|
43
44
|
"@types/node": "^22.13.10",
|
|
44
45
|
"@types/pg": "^8.11.11",
|
|
45
46
|
"reflect-metadata": "^0.2.2",
|
|
47
|
+
"ts-node": "^10.9.2",
|
|
46
48
|
"tslib": "^2.8.1",
|
|
47
|
-
"typescript": "^5.4.5"
|
|
48
|
-
"ts-node": "^10.9.2"
|
|
49
|
+
"typescript": "^5.4.5"
|
|
49
50
|
}
|
|
50
51
|
}
|