opticore-webapp-core 1.0.2 → 1.0.4
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 +27 -17
- package/dist/index.d.cts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +33 -26
- package/package.json +4 -5
- package/tsconfig.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -48,11 +48,14 @@ __export(index_exports, {
|
|
|
48
48
|
YamlParsing: () => YamlParsing,
|
|
49
49
|
dateTimeFormatted: () => dateTimeFormatted,
|
|
50
50
|
loggerConfig: () => loggerConfig,
|
|
51
|
-
optionalArgumentConnectionUtil: () => optionalArgumentConnectionUtil
|
|
52
|
-
translateWebAppCoreLanguageLoader: () => translateWebAppCoreLanguageLoader
|
|
51
|
+
optionalArgumentConnectionUtil: () => optionalArgumentConnectionUtil
|
|
53
52
|
});
|
|
54
53
|
module.exports = __toCommonJS(index_exports);
|
|
55
54
|
|
|
55
|
+
// node_modules/tsup/assets/cjs_shims.js
|
|
56
|
+
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
57
|
+
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
58
|
+
|
|
56
59
|
// src/application/services/asymmetricCryptionDataWithPrivateRSAKey.service.ts
|
|
57
60
|
var import_crypto3 = __toESM(require("crypto"), 1);
|
|
58
61
|
var import_opticore_http_response = require("opticore-http-response");
|
|
@@ -214,6 +217,7 @@ var loggerConfig = {
|
|
|
214
217
|
|
|
215
218
|
// src/application/services/asymmetricCryptionDataWithPrivateRSAKey.service.ts
|
|
216
219
|
var SAsymmetricCryptionDataWithPrivateRSAKey = class {
|
|
220
|
+
static log = new import_opticore_logger.LoggerCore(loggerConfig);
|
|
217
221
|
/**
|
|
218
222
|
*
|
|
219
223
|
* @param rsaKey
|
|
@@ -366,7 +370,6 @@ var SAsymmetricCryptionDataWithPrivateRSAKey = class {
|
|
|
366
370
|
return new import_opticore_catch_exception_error.StackTraceError(props, name, status7, true);
|
|
367
371
|
}
|
|
368
372
|
};
|
|
369
|
-
SAsymmetricCryptionDataWithPrivateRSAKey.log = new import_opticore_logger.LoggerCore(loggerConfig);
|
|
370
373
|
|
|
371
374
|
// src/application/services/asymmetricCryptionDataWithPublicRSAKey.service.ts
|
|
372
375
|
var import_crypto4 = __toESM(require("crypto"), 1);
|
|
@@ -375,6 +378,7 @@ var import_opticore_translator2 = require("opticore-translator");
|
|
|
375
378
|
var import_opticore_http_response2 = require("opticore-http-response");
|
|
376
379
|
var import_opticore_catch_exception_error2 = require("opticore-catch-exception-error");
|
|
377
380
|
var SAsymmetricCryptionDataWithPublicRSAKey = class {
|
|
381
|
+
static log = new import_opticore_logger2.LoggerCore(loggerConfig);
|
|
378
382
|
/**
|
|
379
383
|
*
|
|
380
384
|
* @param rsaKey
|
|
@@ -516,7 +520,6 @@ var SAsymmetricCryptionDataWithPublicRSAKey = class {
|
|
|
516
520
|
return new import_opticore_catch_exception_error2.StackTraceError(props, name, status7, true);
|
|
517
521
|
}
|
|
518
522
|
};
|
|
519
|
-
SAsymmetricCryptionDataWithPublicRSAKey.log = new import_opticore_logger2.LoggerCore(loggerConfig);
|
|
520
523
|
|
|
521
524
|
// src/application/services/checkerMongoDatabaseConnection.service.ts
|
|
522
525
|
var import_mongodb = require("mongodb");
|
|
@@ -681,6 +684,7 @@ var import_opticore_http_response5 = require("opticore-http-response");
|
|
|
681
684
|
var import_opticore_logger6 = require("opticore-logger");
|
|
682
685
|
var import_opticore_translator6 = require("opticore-translator");
|
|
683
686
|
var YamlParsing = class {
|
|
687
|
+
static logger = new import_opticore_logger6.LoggerCore(loggerConfig);
|
|
684
688
|
static async readFile(filePath) {
|
|
685
689
|
try {
|
|
686
690
|
const yamlContent = await (0, import_promises.readFile)(filePath, "utf-8");
|
|
@@ -713,10 +717,10 @@ var YamlParsing = class {
|
|
|
713
717
|
const [, indent, key, value] = keyValueMatch;
|
|
714
718
|
if (indent.length > 0 && currentKey) {
|
|
715
719
|
result[currentKey] = result[currentKey] || {};
|
|
716
|
-
result[currentKey][key] =
|
|
720
|
+
result[currentKey][key] = value?.trim() || null;
|
|
717
721
|
} else {
|
|
718
722
|
currentKey = key;
|
|
719
|
-
result[key] =
|
|
723
|
+
result[key] = value?.trim() || null;
|
|
720
724
|
}
|
|
721
725
|
} else {
|
|
722
726
|
this.logger.error(
|
|
@@ -731,13 +735,13 @@ var YamlParsing = class {
|
|
|
731
735
|
return result;
|
|
732
736
|
}
|
|
733
737
|
};
|
|
734
|
-
YamlParsing.logger = new import_opticore_logger6.LoggerCore(loggerConfig);
|
|
735
738
|
|
|
736
739
|
// src/utils/dateTimeFormatted.utils.ts
|
|
737
740
|
var dateTimeFormatted = `${(/* @__PURE__ */ new Date()).getMonth()}-${(/* @__PURE__ */ new Date()).getDate()}-${(/* @__PURE__ */ new Date()).getFullYear()} ${(/* @__PURE__ */ new Date()).getHours()}:${(/* @__PURE__ */ new Date()).getMinutes()}:${(/* @__PURE__ */ new Date()).getSeconds()}`;
|
|
738
741
|
|
|
739
742
|
// src/utils/environment.utils.ts
|
|
740
743
|
var Environment = class {
|
|
744
|
+
config;
|
|
741
745
|
constructor(config) {
|
|
742
746
|
this.config = config;
|
|
743
747
|
}
|
|
@@ -759,6 +763,7 @@ var import_opticore_logger7 = require("opticore-logger");
|
|
|
759
763
|
var import_opticore_catch_exception_error3 = require("opticore-catch-exception-error");
|
|
760
764
|
var import_opticore_translator7 = require("opticore-translator");
|
|
761
765
|
var DbConnexionConfigError = class {
|
|
766
|
+
static logger = new import_opticore_logger7.LoggerCore(loggerConfig);
|
|
762
767
|
/**
|
|
763
768
|
*
|
|
764
769
|
* @param e
|
|
@@ -845,15 +850,12 @@ var DbConnexionConfigError = class {
|
|
|
845
850
|
return new import_opticore_catch_exception_error3.StackTraceError(props, name, status7, true);
|
|
846
851
|
}
|
|
847
852
|
};
|
|
848
|
-
DbConnexionConfigError.logger = new import_opticore_logger7.LoggerCore(loggerConfig);
|
|
849
853
|
|
|
850
854
|
// src/core/config/database/connexion.config.database.ts
|
|
851
855
|
var import_opticore_catch_exception_error4 = require("opticore-catch-exception-error");
|
|
852
856
|
var DatabaseConnectionConfig = class {
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
this.logger = new import_opticore_logger8.LoggerCore(loggerConfig);
|
|
856
|
-
}
|
|
857
|
+
env = new Environment(import_opticore_env_access3.getEnvVariable);
|
|
858
|
+
logger = new import_opticore_logger8.LoggerCore(loggerConfig);
|
|
857
859
|
/**
|
|
858
860
|
* MySQL database connection with an optional arguments
|
|
859
861
|
* Establish the connection between app and Database Management System.
|
|
@@ -1106,6 +1108,7 @@ var import_opticore_logger9 = require("opticore-logger");
|
|
|
1106
1108
|
var import_opticore_http_response8 = require("opticore-http-response");
|
|
1107
1109
|
var import_opticore_translator10 = require("opticore-translator");
|
|
1108
1110
|
var PathModuleVerifier = class {
|
|
1111
|
+
static log = new import_opticore_logger9.LoggerCore(loggerConfig);
|
|
1109
1112
|
/**
|
|
1110
1113
|
* Verifies if modules at specific paths are loaded.
|
|
1111
1114
|
* If any module is not loaded, it throws an error.
|
|
@@ -1138,20 +1141,28 @@ var PathModuleVerifier = class {
|
|
|
1138
1141
|
try {
|
|
1139
1142
|
const resolvedPath = (0, import_path2.resolve)(modulePath);
|
|
1140
1143
|
return require.cache[resolvedPath] !== void 0;
|
|
1141
|
-
} catch
|
|
1144
|
+
} catch {
|
|
1142
1145
|
return false;
|
|
1143
1146
|
}
|
|
1144
1147
|
}
|
|
1145
1148
|
};
|
|
1146
|
-
PathModuleVerifier.log = new import_opticore_logger9.LoggerCore(loggerConfig);
|
|
1147
1149
|
|
|
1148
1150
|
// src/core/config/loaders/translateLanguage.loader.ts
|
|
1149
1151
|
var import_path3 = __toESM(require("path"), 1);
|
|
1150
1152
|
var import_opticore_translator11 = require("opticore-translator");
|
|
1151
1153
|
var import_opticore_env_access4 = require("opticore-env-access");
|
|
1154
|
+
var import_url = require("url");
|
|
1152
1155
|
var translateWebAppCoreLanguageLoader = () => {
|
|
1153
|
-
|
|
1156
|
+
const __filename2 = (0, import_url.fileURLToPath)(importMetaUrl);
|
|
1157
|
+
const __dirname = import_path3.default.dirname(__filename2);
|
|
1158
|
+
const translateMsgJsonFilePath = import_path3.default.join(__dirname, "../../../", "utils", "translations");
|
|
1159
|
+
import_opticore_translator11.TranslationLoader.loadTranslations(translateMsgJsonFilePath, import_opticore_env_access4.getEnvVariable.defaultLocal);
|
|
1154
1160
|
};
|
|
1161
|
+
|
|
1162
|
+
// src/index.ts
|
|
1163
|
+
(() => {
|
|
1164
|
+
translateWebAppCoreLanguageLoader();
|
|
1165
|
+
})();
|
|
1155
1166
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1156
1167
|
0 && (module.exports = {
|
|
1157
1168
|
CLogLevel,
|
|
@@ -1172,6 +1183,5 @@ var translateWebAppCoreLanguageLoader = () => {
|
|
|
1172
1183
|
YamlParsing,
|
|
1173
1184
|
dateTimeFormatted,
|
|
1174
1185
|
loggerConfig,
|
|
1175
|
-
optionalArgumentConnectionUtil
|
|
1176
|
-
translateWebAppCoreLanguageLoader
|
|
1186
|
+
optionalArgumentConnectionUtil
|
|
1177
1187
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -363,8 +363,6 @@ declare class PathModuleVerifier {
|
|
|
363
363
|
private static isModulePathLoaded;
|
|
364
364
|
}
|
|
365
365
|
|
|
366
|
-
declare const translateWebAppCoreLanguageLoader: () => void;
|
|
367
|
-
|
|
368
366
|
interface IBodyParserOptions {
|
|
369
367
|
type: string;
|
|
370
368
|
}
|
|
@@ -435,4 +433,4 @@ declare function TTextBodyParser(options: IBodyParserOptions): void;
|
|
|
435
433
|
*/
|
|
436
434
|
declare function TUrlencodedBodyParser(options: IBodyParserOptions): void;
|
|
437
435
|
|
|
438
|
-
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
|
|
436
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -363,8 +363,6 @@ declare class PathModuleVerifier {
|
|
|
363
363
|
private static isModulePathLoaded;
|
|
364
364
|
}
|
|
365
365
|
|
|
366
|
-
declare const translateWebAppCoreLanguageLoader: () => void;
|
|
367
|
-
|
|
368
366
|
interface IBodyParserOptions {
|
|
369
367
|
type: string;
|
|
370
368
|
}
|
|
@@ -435,4 +433,4 @@ declare function TTextBodyParser(options: IBodyParserOptions): void;
|
|
|
435
433
|
*/
|
|
436
434
|
declare function TUrlencodedBodyParser(options: IBodyParserOptions): void;
|
|
437
435
|
|
|
438
|
-
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
|
|
436
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -166,6 +166,7 @@ var loggerConfig = {
|
|
|
166
166
|
|
|
167
167
|
// src/application/services/asymmetricCryptionDataWithPrivateRSAKey.service.ts
|
|
168
168
|
var SAsymmetricCryptionDataWithPrivateRSAKey = class {
|
|
169
|
+
static log = new LoggerCore(loggerConfig);
|
|
169
170
|
/**
|
|
170
171
|
*
|
|
171
172
|
* @param rsaKey
|
|
@@ -318,7 +319,6 @@ var SAsymmetricCryptionDataWithPrivateRSAKey = class {
|
|
|
318
319
|
return new ErrorHandler(props, name, status7, true);
|
|
319
320
|
}
|
|
320
321
|
};
|
|
321
|
-
SAsymmetricCryptionDataWithPrivateRSAKey.log = new LoggerCore(loggerConfig);
|
|
322
322
|
|
|
323
323
|
// src/application/services/asymmetricCryptionDataWithPublicRSAKey.service.ts
|
|
324
324
|
import crypto4 from "crypto";
|
|
@@ -327,6 +327,7 @@ import { CLocal as CLocal2, TranslationLoader as TranslationLoader2 } from "opti
|
|
|
327
327
|
import { HttpStatusCode as status2 } from "opticore-http-response";
|
|
328
328
|
import { StackTraceError } from "opticore-catch-exception-error";
|
|
329
329
|
var SAsymmetricCryptionDataWithPublicRSAKey = class {
|
|
330
|
+
static log = new LoggerCore2(loggerConfig);
|
|
330
331
|
/**
|
|
331
332
|
*
|
|
332
333
|
* @param rsaKey
|
|
@@ -468,7 +469,6 @@ var SAsymmetricCryptionDataWithPublicRSAKey = class {
|
|
|
468
469
|
return new StackTraceError(props, name, status7, true);
|
|
469
470
|
}
|
|
470
471
|
};
|
|
471
|
-
SAsymmetricCryptionDataWithPublicRSAKey.log = new LoggerCore2(loggerConfig);
|
|
472
472
|
|
|
473
473
|
// src/application/services/checkerMongoDatabaseConnection.service.ts
|
|
474
474
|
import { MongoClient } from "mongodb";
|
|
@@ -633,6 +633,7 @@ import { HttpStatusCode } from "opticore-http-response";
|
|
|
633
633
|
import { LoggerCore as LoggerCore6 } from "opticore-logger";
|
|
634
634
|
import { CLocal as CLocal6, TranslationLoader as TranslationLoader6 } from "opticore-translator";
|
|
635
635
|
var YamlParsing = class {
|
|
636
|
+
static logger = new LoggerCore6(loggerConfig);
|
|
636
637
|
static async readFile(filePath) {
|
|
637
638
|
try {
|
|
638
639
|
const yamlContent = await readFile(filePath, "utf-8");
|
|
@@ -665,10 +666,10 @@ var YamlParsing = class {
|
|
|
665
666
|
const [, indent, key, value] = keyValueMatch;
|
|
666
667
|
if (indent.length > 0 && currentKey) {
|
|
667
668
|
result[currentKey] = result[currentKey] || {};
|
|
668
|
-
result[currentKey][key] =
|
|
669
|
+
result[currentKey][key] = value?.trim() || null;
|
|
669
670
|
} else {
|
|
670
671
|
currentKey = key;
|
|
671
|
-
result[key] =
|
|
672
|
+
result[key] = value?.trim() || null;
|
|
672
673
|
}
|
|
673
674
|
} else {
|
|
674
675
|
this.logger.error(
|
|
@@ -683,13 +684,13 @@ var YamlParsing = class {
|
|
|
683
684
|
return result;
|
|
684
685
|
}
|
|
685
686
|
};
|
|
686
|
-
YamlParsing.logger = new LoggerCore6(loggerConfig);
|
|
687
687
|
|
|
688
688
|
// src/utils/dateTimeFormatted.utils.ts
|
|
689
689
|
var dateTimeFormatted = `${(/* @__PURE__ */ new Date()).getMonth()}-${(/* @__PURE__ */ new Date()).getDate()}-${(/* @__PURE__ */ new Date()).getFullYear()} ${(/* @__PURE__ */ new Date()).getHours()}:${(/* @__PURE__ */ new Date()).getMinutes()}:${(/* @__PURE__ */ new Date()).getSeconds()}`;
|
|
690
690
|
|
|
691
691
|
// src/utils/environment.utils.ts
|
|
692
692
|
var Environment = class {
|
|
693
|
+
config;
|
|
693
694
|
constructor(config) {
|
|
694
695
|
this.config = config;
|
|
695
696
|
}
|
|
@@ -711,6 +712,7 @@ import { LoggerCore as LoggerCore7 } from "opticore-logger";
|
|
|
711
712
|
import { StackTraceError as StackTraceError2 } from "opticore-catch-exception-error";
|
|
712
713
|
import { CLocal as CLocal7, TranslationLoader as TranslationLoader7 } from "opticore-translator";
|
|
713
714
|
var DbConnexionConfigError = class {
|
|
715
|
+
static logger = new LoggerCore7(loggerConfig);
|
|
714
716
|
/**
|
|
715
717
|
*
|
|
716
718
|
* @param e
|
|
@@ -797,15 +799,12 @@ var DbConnexionConfigError = class {
|
|
|
797
799
|
return new StackTraceError2(props, name, status7, true);
|
|
798
800
|
}
|
|
799
801
|
};
|
|
800
|
-
DbConnexionConfigError.logger = new LoggerCore7(loggerConfig);
|
|
801
802
|
|
|
802
803
|
// src/core/config/database/connexion.config.database.ts
|
|
803
804
|
import { StackTraceError as ErrorHandler2 } from "opticore-catch-exception-error";
|
|
804
805
|
var DatabaseConnectionConfig = class {
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
this.logger = new LoggerCore8(loggerConfig);
|
|
808
|
-
}
|
|
806
|
+
env = new Environment(getEnvVariable3);
|
|
807
|
+
logger = new LoggerCore8(loggerConfig);
|
|
809
808
|
/**
|
|
810
809
|
* MySQL database connection with an optional arguments
|
|
811
810
|
* Establish the connection between app and Database Management System.
|
|
@@ -923,7 +922,7 @@ var MPostgresCheckerDatabase = (optionalArgumentConnection) => {
|
|
|
923
922
|
};
|
|
924
923
|
|
|
925
924
|
// src/utils/utility.utils.ts
|
|
926
|
-
import
|
|
925
|
+
import process from "node:process";
|
|
927
926
|
import chalk from "chalk";
|
|
928
927
|
import colors from "ansi-colors";
|
|
929
928
|
import path from "path";
|
|
@@ -943,7 +942,7 @@ var Utility = class {
|
|
|
943
942
|
* Returns an Object containing a node version, openssl, and v0
|
|
944
943
|
*/
|
|
945
944
|
getVersions() {
|
|
946
|
-
const processVers =
|
|
945
|
+
const processVers = process.versions;
|
|
947
946
|
const data = {
|
|
948
947
|
"node version": processVers.node,
|
|
949
948
|
"openssl": processVers.openssl,
|
|
@@ -963,14 +962,14 @@ var Utility = class {
|
|
|
963
962
|
* and Memory usage system
|
|
964
963
|
*/
|
|
965
964
|
getUsageMemory() {
|
|
966
|
-
const memoryData =
|
|
965
|
+
const memoryData = process.memoryUsage();
|
|
967
966
|
const data = {
|
|
968
967
|
"Resident Set Size - total memory allocated for the process execution": this.formatMemoryUsage(memoryData.rss),
|
|
969
968
|
"Total size of the allocated heap": this.formatMemoryUsage(memoryData.heapTotal),
|
|
970
969
|
"Actual memory used during the execution": this.formatMemoryUsage(memoryData.heapUsed),
|
|
971
970
|
"V8 external memory": this.formatMemoryUsage(memoryData.external),
|
|
972
|
-
"Memory usage user": this.formatMemoryUsage(
|
|
973
|
-
"Memory usage system": this.formatMemoryUsage(
|
|
971
|
+
"Memory usage user": this.formatMemoryUsage(process.cpuUsage().user),
|
|
972
|
+
"Memory usage system": this.formatMemoryUsage(process.cpuUsage().system)
|
|
974
973
|
};
|
|
975
974
|
return {
|
|
976
975
|
"rss": data["Resident Set Size - total memory allocated for the process execution"],
|
|
@@ -985,11 +984,11 @@ var Utility = class {
|
|
|
985
984
|
* Return an Object containing a project path and running server time
|
|
986
985
|
*/
|
|
987
986
|
getProjectInfo() {
|
|
988
|
-
const startTime =
|
|
989
|
-
const endTime =
|
|
987
|
+
const startTime = process.hrtime();
|
|
988
|
+
const endTime = process.hrtime(startTime);
|
|
990
989
|
const executionTime = (endTime[0] * 1e9 + endTime[1]) / 1e6;
|
|
991
990
|
return {
|
|
992
|
-
"projectPath": path.join(
|
|
991
|
+
"projectPath": path.join(process.cwd()),
|
|
993
992
|
"startingTime": `${executionTime.toFixed(5)} ms`
|
|
994
993
|
};
|
|
995
994
|
}
|
|
@@ -999,7 +998,7 @@ var Utility = class {
|
|
|
999
998
|
* @private
|
|
1000
999
|
*/
|
|
1001
1000
|
getEnvFileLoading(filePath) {
|
|
1002
|
-
const fullPath = path.resolve(
|
|
1001
|
+
const fullPath = path.resolve(process.cwd(), filePath);
|
|
1003
1002
|
if (fs.existsSync(fullPath)) {
|
|
1004
1003
|
const env = fs.readFileSync(fullPath, "utf-8");
|
|
1005
1004
|
const lines = env.split("\n");
|
|
@@ -1007,7 +1006,7 @@ var Utility = class {
|
|
|
1007
1006
|
const match = line.match(/^([^#=]+)=([^#]+)$/);
|
|
1008
1007
|
if (match) {
|
|
1009
1008
|
const key = match[1].trim();
|
|
1010
|
-
|
|
1009
|
+
process.env[key] = match[2].trim();
|
|
1011
1010
|
}
|
|
1012
1011
|
});
|
|
1013
1012
|
}
|
|
@@ -1019,7 +1018,7 @@ var Utility = class {
|
|
|
1019
1018
|
*/
|
|
1020
1019
|
getServerRunningMode(development, production) {
|
|
1021
1020
|
this.getEnvFileLoading(".env");
|
|
1022
|
-
const isDevelopment =
|
|
1021
|
+
const isDevelopment = process.env.NODE_ENV === "development";
|
|
1023
1022
|
if (isDevelopment) {
|
|
1024
1023
|
return `${TranslationLoader9.t("serverRunning", CLocal9)} ${colors.bgBlue(`${colors.bold(`${development}`)}`)} mode`;
|
|
1025
1024
|
} else {
|
|
@@ -1058,6 +1057,7 @@ import { LoggerCore as LoggerCore9 } from "opticore-logger";
|
|
|
1058
1057
|
import { HttpStatusCode as HttpStatusCode2 } from "opticore-http-response";
|
|
1059
1058
|
import { CLocal as CLocal10, TranslationLoader as TranslationLoader10 } from "opticore-translator";
|
|
1060
1059
|
var PathModuleVerifier = class {
|
|
1060
|
+
static log = new LoggerCore9(loggerConfig);
|
|
1061
1061
|
/**
|
|
1062
1062
|
* Verifies if modules at specific paths are loaded.
|
|
1063
1063
|
* If any module is not loaded, it throws an error.
|
|
@@ -1090,20 +1090,28 @@ var PathModuleVerifier = class {
|
|
|
1090
1090
|
try {
|
|
1091
1091
|
const resolvedPath = resolve(modulePath);
|
|
1092
1092
|
return __require.cache[resolvedPath] !== void 0;
|
|
1093
|
-
} catch
|
|
1093
|
+
} catch {
|
|
1094
1094
|
return false;
|
|
1095
1095
|
}
|
|
1096
1096
|
}
|
|
1097
1097
|
};
|
|
1098
|
-
PathModuleVerifier.log = new LoggerCore9(loggerConfig);
|
|
1099
1098
|
|
|
1100
1099
|
// src/core/config/loaders/translateLanguage.loader.ts
|
|
1101
1100
|
import path2 from "path";
|
|
1102
1101
|
import { TranslationLoader as TranslationLoader11 } from "opticore-translator";
|
|
1103
1102
|
import { getEnvVariable as getEnvVariable4 } from "opticore-env-access";
|
|
1103
|
+
import { fileURLToPath } from "url";
|
|
1104
1104
|
var translateWebAppCoreLanguageLoader = () => {
|
|
1105
|
-
|
|
1105
|
+
const __filename2 = fileURLToPath(import.meta.url);
|
|
1106
|
+
const __dirname2 = path2.dirname(__filename2);
|
|
1107
|
+
const translateMsgJsonFilePath = path2.join(__dirname2, "../../../", "utils", "translations");
|
|
1108
|
+
TranslationLoader11.loadTranslations(translateMsgJsonFilePath, getEnvVariable4.defaultLocal);
|
|
1106
1109
|
};
|
|
1110
|
+
|
|
1111
|
+
// src/index.ts
|
|
1112
|
+
(() => {
|
|
1113
|
+
translateWebAppCoreLanguageLoader();
|
|
1114
|
+
})();
|
|
1107
1115
|
export {
|
|
1108
1116
|
CLogLevel,
|
|
1109
1117
|
CSignRSAKeyComponent,
|
|
@@ -1123,6 +1131,5 @@ export {
|
|
|
1123
1131
|
YamlParsing,
|
|
1124
1132
|
dateTimeFormatted,
|
|
1125
1133
|
loggerConfig,
|
|
1126
|
-
optionalArgumentConnectionUtil
|
|
1127
|
-
translateWebAppCoreLanguageLoader
|
|
1134
|
+
optionalArgumentConnectionUtil
|
|
1128
1135
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opticore-webapp-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "opticore Web Application core module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -30,16 +30,15 @@
|
|
|
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.
|
|
33
|
+
"opticore-catch-exception-error": "^1.0.9",
|
|
34
34
|
"opticore-env-access": "^1.0.2",
|
|
35
35
|
"opticore-express": "^1.0.3",
|
|
36
36
|
"opticore-http-response": "^1.0.3",
|
|
37
|
-
"opticore-logger": "^1.0.
|
|
38
|
-
"opticore-translator": "^1.0.
|
|
37
|
+
"opticore-logger": "^1.0.13",
|
|
38
|
+
"opticore-translator": "^1.0.3",
|
|
39
39
|
"pg": "^8.11.5"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@types/express": "^5.0.0",
|
|
43
42
|
"@types/mysql": "^2.15.26",
|
|
44
43
|
"@types/node": "^22.13.5",
|
|
45
44
|
"@types/pg": "^8.11.11",
|
package/tsconfig.json
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"noImplicitAny": true,
|
|
5
5
|
"esModuleInterop": true,
|
|
6
6
|
"strictNullChecks": true,
|
|
7
|
-
"module": "
|
|
7
|
+
"module": "ES2022",
|
|
8
8
|
"pretty": true,
|
|
9
|
-
"target": "
|
|
9
|
+
"target": "es2022",
|
|
10
10
|
"moduleResolution": "node",
|
|
11
11
|
"declaration": true,
|
|
12
12
|
"isolatedModules": true,
|