opticore-webapp 1.0.64 → 1.0.66
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 +154 -32
- package/dist/index.d.cts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +186 -50
- package/dist/utils/translations/message.translation.en.json +104 -0
- package/dist/utils/translations/message.translation.fr.json +103 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -159,6 +159,16 @@ var STraceError = (props, name, httpCode, isOperational) => {
|
|
|
159
159
|
var import_process = __toESM(require("process"), 1);
|
|
160
160
|
var envPath = import_process.default.cwd() + "/config/env/.env";
|
|
161
161
|
|
|
162
|
+
// src/application/service/loaderTranslationFile.service.ts
|
|
163
|
+
var import_opticore_loader_translation = require("opticore-loader-translation");
|
|
164
|
+
var loaderTranslationFile = (localLanguage) => {
|
|
165
|
+
return (0, import_opticore_loader_translation.translationLoaderConfig)({
|
|
166
|
+
packageName: "opticore-webapp",
|
|
167
|
+
locationTranslationFile: ["utils", "translations"],
|
|
168
|
+
localLang: localLanguage
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
|
|
162
172
|
// src/core/providers/dependencies.provider.ts
|
|
163
173
|
var import_opticore_dependency_inject = require("opticore-dependency-inject");
|
|
164
174
|
|
|
@@ -172,8 +182,8 @@ var dependencies = [
|
|
|
172
182
|
scope: "singleton"
|
|
173
183
|
},
|
|
174
184
|
{
|
|
175
|
-
key: "
|
|
176
|
-
factory: () => new import_opticore_server_logger.
|
|
185
|
+
key: "OpticoreLogger",
|
|
186
|
+
factory: () => new import_opticore_server_logger.OpticoreLogger(),
|
|
177
187
|
scope: "singleton"
|
|
178
188
|
}
|
|
179
189
|
];
|
|
@@ -183,33 +193,17 @@ var dependenciesContainerProvider = (localLang) => {
|
|
|
183
193
|
return new import_opticore_dependency_inject.SContainer(localLang, dependencies);
|
|
184
194
|
};
|
|
185
195
|
|
|
186
|
-
// src/application/service/logger.service.ts
|
|
187
|
-
var SLogger = (localLang) => {
|
|
188
|
-
const serverLog = dependenciesContainerProvider(localLang).resolve("serverLogger");
|
|
189
|
-
const logger = dependenciesContainerProvider(localLang).resolve("LoggerCore");
|
|
190
|
-
return {
|
|
191
|
-
serverLog,
|
|
192
|
-
logger
|
|
193
|
-
};
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
// src/application/service/loaderTranslationFile.service.ts
|
|
197
|
-
var import_opticore_loader_translation = require("opticore-loader-translation");
|
|
198
|
-
var loaderTranslationFile = (localLanguage) => {
|
|
199
|
-
return (0, import_opticore_loader_translation.translationLoaderConfig)({
|
|
200
|
-
packageName: "opticore-webapp",
|
|
201
|
-
locationTranslationFile: ["utils", "translations"],
|
|
202
|
-
localLang: localLanguage
|
|
203
|
-
});
|
|
204
|
-
};
|
|
205
|
-
|
|
206
196
|
// src/application/service/core.service.ts
|
|
207
197
|
var CoreService = class {
|
|
208
198
|
localLanguage;
|
|
209
199
|
environmentPath;
|
|
200
|
+
serverLog;
|
|
201
|
+
logger;
|
|
210
202
|
constructor(localLang, environmentPath) {
|
|
211
203
|
this.environmentPath = environmentPath;
|
|
212
204
|
this.localLanguage = localLang;
|
|
205
|
+
this.serverLog = dependenciesContainerProvider(localLang).resolve("OpticoreLogger");
|
|
206
|
+
this.logger = dependenciesContainerProvider(localLang).resolve("LoggerCore");
|
|
213
207
|
}
|
|
214
208
|
/**
|
|
215
209
|
*
|
|
@@ -299,7 +293,7 @@ var CoreService = class {
|
|
|
299
293
|
});
|
|
300
294
|
}
|
|
301
295
|
} catch (err) {
|
|
302
|
-
|
|
296
|
+
this.logger.error({
|
|
303
297
|
message: err.message,
|
|
304
298
|
title: import_opticore_translator2.TranslationLoader.t("EnvFileLoading", this.localLanguage),
|
|
305
299
|
errorType: err.code,
|
|
@@ -329,7 +323,7 @@ var CoreService = class {
|
|
|
329
323
|
return `${import_opticore_translator2.TranslationLoader.t("serverRunning", this.localLanguage)} ${import_ansi_colors3.default.bgBlue(`${import_ansi_colors3.default.bold(`${development}`)}`)} mode`;
|
|
330
324
|
}
|
|
331
325
|
} catch (err) {
|
|
332
|
-
|
|
326
|
+
this.logger.error({
|
|
333
327
|
message: err.message,
|
|
334
328
|
title: import_opticore_translator2.TranslationLoader.t("serverRunning mode", this.localLanguage),
|
|
335
329
|
errorType: err.code,
|
|
@@ -338,7 +332,7 @@ var CoreService = class {
|
|
|
338
332
|
});
|
|
339
333
|
}
|
|
340
334
|
}
|
|
341
|
-
infoServer(
|
|
335
|
+
infoServer(host, port) {
|
|
342
336
|
try {
|
|
343
337
|
loaderTranslationFile(this.localLanguage);
|
|
344
338
|
const getEnvironment = (0, import_opticore_env_access.getEnvironnementValue)(this.environmentPath);
|
|
@@ -347,7 +341,10 @@ var CoreService = class {
|
|
|
347
341
|
import_opticore_translator2.TranslationLoader.t("webServerListening", this.localLanguage),
|
|
348
342
|
import_opticore_translator2.TranslationLoader.t("webServerUsingNodeVersion", this.localLanguage, { nodeVersion: this.getVersions().nodeVersion }),
|
|
349
343
|
import_opticore_translator2.TranslationLoader.t("startTime", this.localLanguage, { startTime: this.getProjectInfo().startingTime }),
|
|
350
|
-
this.getServerRunningMode(
|
|
344
|
+
this.getServerRunningMode(
|
|
345
|
+
import_opticore_translator2.TranslationLoader.t("runningModeDev", this.localLanguage),
|
|
346
|
+
import_opticore_translator2.TranslationLoader.t("runningModeProd", this.localLanguage)
|
|
347
|
+
)
|
|
351
348
|
];
|
|
352
349
|
const maxLength = Math.max(...messages.map((m) => {
|
|
353
350
|
return m.replace(/\u001b\[[0-9]{1,2}m/g, "").length;
|
|
@@ -362,7 +359,7 @@ var CoreService = class {
|
|
|
362
359
|
});
|
|
363
360
|
console.log(border);
|
|
364
361
|
console.log("\n");
|
|
365
|
-
|
|
362
|
+
this.serverLog.serverLog({
|
|
366
363
|
timestamp: (/* @__PURE__ */ new Date()).toString(),
|
|
367
364
|
level: "SERVER",
|
|
368
365
|
title: import_opticore_translator2.TranslationLoader.t("serverRunningTitle", this.localLanguage),
|
|
@@ -370,7 +367,7 @@ var CoreService = class {
|
|
|
370
367
|
message: import_opticore_translator2.TranslationLoader.t("serverRunningAt", this.localLanguage, { server: msg5 })
|
|
371
368
|
});
|
|
372
369
|
} catch (err) {
|
|
373
|
-
|
|
370
|
+
this.logger.error({
|
|
374
371
|
message: err.message,
|
|
375
372
|
title: import_opticore_translator2.TranslationLoader.t("server", this.localLanguage),
|
|
376
373
|
errorType: err.code,
|
|
@@ -409,6 +406,16 @@ var CoreService = class {
|
|
|
409
406
|
|
|
410
407
|
// src/application/service/serverStartError.service.ts
|
|
411
408
|
var import_opticore_catch_exception_error3 = require("opticore-catch-exception-error");
|
|
409
|
+
|
|
410
|
+
// src/application/service/logger.service.ts
|
|
411
|
+
var SLogger = (localLang) => {
|
|
412
|
+
return {
|
|
413
|
+
serverLog: dependenciesContainerProvider(localLang).resolve("OpticoreLogger"),
|
|
414
|
+
logger: dependenciesContainerProvider(localLang).resolve("LoggerCore")
|
|
415
|
+
};
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
// src/application/service/serverStartError.service.ts
|
|
412
419
|
var import_opticore_http_response2 = require("opticore-http-response");
|
|
413
420
|
var SServerStartError = (err, environmentPath) => {
|
|
414
421
|
if (err.name) {
|
|
@@ -454,6 +461,9 @@ var WebServerCore = class {
|
|
|
454
461
|
getEnvironment;
|
|
455
462
|
environmentPath;
|
|
456
463
|
serverListenEvent;
|
|
464
|
+
isHotReloading = false;
|
|
465
|
+
currentRoutes = [];
|
|
466
|
+
currentDependencies = [];
|
|
457
467
|
constructor(app, loggerConfig, localLanguage, environmentPath, corsOriginOptions) {
|
|
458
468
|
this.stackTraceErrorHandling(localLanguage);
|
|
459
469
|
this.getEnvironment = (0, import_opticore_env_access2.getEnvironnementValue)(environmentPath);
|
|
@@ -468,6 +478,7 @@ var WebServerCore = class {
|
|
|
468
478
|
this.expressApp.use((0, import_cors.default)(corsOriginOptions));
|
|
469
479
|
this.serverListenEvent = new import_opticore_catch_exception_error4.ServerListenEventError(localLanguage);
|
|
470
480
|
this.serverUtility = new CoreService(localLanguage, environmentPath);
|
|
481
|
+
this.setupSignalHandlers();
|
|
471
482
|
}
|
|
472
483
|
/**
|
|
473
484
|
*
|
|
@@ -494,6 +505,8 @@ var WebServerCore = class {
|
|
|
494
505
|
*/
|
|
495
506
|
onStartServer(routers, databaseCallback, dependenciesProvider) {
|
|
496
507
|
loaderTranslationFile(this.localLanguage);
|
|
508
|
+
this.currentRoutes = routers;
|
|
509
|
+
this.currentDependencies = dependenciesProvider || [];
|
|
497
510
|
if (this.getEnvironment.appPort === "" && Number(this.getEnvironment.appPort) === 0) {
|
|
498
511
|
this.serverListenEvent.hostPortUndefined(Number(this.getEnvironment.appPort));
|
|
499
512
|
} else if (this.getEnvironment.appHost === "") {
|
|
@@ -515,9 +528,9 @@ var WebServerCore = class {
|
|
|
515
528
|
loaderTranslationFile(this.localLanguage);
|
|
516
529
|
try {
|
|
517
530
|
databaseCallback(this.getEnvironment);
|
|
518
|
-
new import_opticore_dependency_inject2.SContainer(this.localLanguage,
|
|
531
|
+
new import_opticore_dependency_inject2.SContainer(this.localLanguage, this.currentDependencies);
|
|
519
532
|
this.expressApp.use(import_opticore_express2.express.static(path2.join(import_node_process3.default.cwd(), "public/template")));
|
|
520
|
-
this.registerRoutes(
|
|
533
|
+
this.registerRoutes(this.currentRoutes);
|
|
521
534
|
} catch (err) {
|
|
522
535
|
SServerStartError(err, this.environmentPath);
|
|
523
536
|
}
|
|
@@ -585,12 +598,121 @@ var WebServerCore = class {
|
|
|
585
598
|
*/
|
|
586
599
|
infoWebApp() {
|
|
587
600
|
this.serverUtility.infoServer(
|
|
588
|
-
this.serverUtility.getVersions().nodeVersion,
|
|
589
|
-
this.serverUtility.getProjectInfo().startingTime,
|
|
590
601
|
this.getEnvironment.appHost,
|
|
591
602
|
Number(this.getEnvironment.appPort)
|
|
592
603
|
);
|
|
593
604
|
}
|
|
605
|
+
setupSignalHandlers() {
|
|
606
|
+
import_node_process3.default.on("SIGHUP", async () => {
|
|
607
|
+
if (!this.isHotReloading) {
|
|
608
|
+
console.log(`${dateTimeFormattedUtils} | [Server] Received SIGHUP signal, hot reloading...`);
|
|
609
|
+
try {
|
|
610
|
+
this.isHotReloading = true;
|
|
611
|
+
await this.handleHotReload();
|
|
612
|
+
console.log(`${dateTimeFormattedUtils} | [Server] Hot reload completed successfully`);
|
|
613
|
+
} catch (error) {
|
|
614
|
+
console.error(`${dateTimeFormattedUtils} | [Server] Hot reload failed:`, error);
|
|
615
|
+
this.serverListenEvent.onEventError(error);
|
|
616
|
+
} finally {
|
|
617
|
+
this.isHotReloading = false;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Logique de rechargement à chaud
|
|
624
|
+
*/
|
|
625
|
+
async handleHotReload() {
|
|
626
|
+
const context = {
|
|
627
|
+
clearedModules: [],
|
|
628
|
+
reloadedRoutes: [],
|
|
629
|
+
reloadedServices: []
|
|
630
|
+
};
|
|
631
|
+
try {
|
|
632
|
+
this.clearServerCache(context);
|
|
633
|
+
await this.reloadConfigurations(context);
|
|
634
|
+
await this.reloadDependencies(context);
|
|
635
|
+
await this.reloadRoutes(context);
|
|
636
|
+
await this.reloadServices(context);
|
|
637
|
+
} catch (error) {
|
|
638
|
+
console.error(`${dateTimeFormattedUtils} | [Server] Hot reload error:`, error);
|
|
639
|
+
throw error;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Clear server module cache
|
|
644
|
+
*/
|
|
645
|
+
clearServerCache(context) {
|
|
646
|
+
const baseDirs = [
|
|
647
|
+
path2.join(import_node_process3.default.cwd(), "src"),
|
|
648
|
+
path2.join(import_node_process3.default.cwd(), "dist"),
|
|
649
|
+
path2.join(__dirname, "..")
|
|
650
|
+
];
|
|
651
|
+
for (const key in require.cache) {
|
|
652
|
+
if (!key.includes("node_modules") && !key.endsWith(".json") && baseDirs.some((dir) => key.startsWith(dir))) {
|
|
653
|
+
delete require.cache[key];
|
|
654
|
+
context.clearedModules.push(path2.basename(key));
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
console.log(`${dateTimeFormattedUtils} | [Server] Cleared ${context.clearedModules.length} modules from cache`);
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Recharger les configurations
|
|
661
|
+
*/
|
|
662
|
+
async reloadConfigurations(context) {
|
|
663
|
+
try {
|
|
664
|
+
const newEnv = (0, import_opticore_env_access2.getEnvironnementValue)(this.environmentPath);
|
|
665
|
+
Object.assign(this.getEnvironment, newEnv);
|
|
666
|
+
loaderTranslationFile(this.localLanguage);
|
|
667
|
+
console.log(`${dateTimeFormattedUtils} | [Server] Configurations reloaded`);
|
|
668
|
+
} catch (error) {
|
|
669
|
+
console.warn(`${dateTimeFormattedUtils} | [Server] Configuration reload warning:`, error.message);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Recharger les dépendances
|
|
674
|
+
*/
|
|
675
|
+
async reloadDependencies(context) {
|
|
676
|
+
try {
|
|
677
|
+
new import_opticore_dependency_inject2.SContainer(this.localLanguage, this.currentDependencies);
|
|
678
|
+
console.log(`${dateTimeFormattedUtils} | [Server] Dependencies reloaded`);
|
|
679
|
+
} catch (error) {
|
|
680
|
+
console.warn(`${dateTimeFormattedUtils} | [Server] Dependencies reload warning:`, error.message);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Recharger les routes
|
|
685
|
+
*/
|
|
686
|
+
async reloadRoutes(context) {
|
|
687
|
+
try {
|
|
688
|
+
this.expressApp._router.stack = this.expressApp._router.stack.filter((layer) => {
|
|
689
|
+
return !layer.route;
|
|
690
|
+
});
|
|
691
|
+
this.registerRoutes(this.currentRoutes);
|
|
692
|
+
context.reloadedRoutes = this.currentRoutes.map((route, index) => {
|
|
693
|
+
if (route.featureName && typeof route.featureName === "string") {
|
|
694
|
+
return route.featureName;
|
|
695
|
+
}
|
|
696
|
+
return `RouteGroup_${index + 1}`;
|
|
697
|
+
}).filter((name) => !!name);
|
|
698
|
+
console.log(`${dateTimeFormattedUtils} | [Server] Routes reloaded: ${context.reloadedRoutes.join(", ")}`);
|
|
699
|
+
} catch (error) {
|
|
700
|
+
console.error(`${dateTimeFormattedUtils} | [Server] Routes reload error:`, error.message);
|
|
701
|
+
throw error;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Recharger les services
|
|
706
|
+
*/
|
|
707
|
+
async reloadServices(context) {
|
|
708
|
+
try {
|
|
709
|
+
const services = dependenciesContainerProvider(this.localLanguage).getServices();
|
|
710
|
+
context.reloadedServices = Array.from(services.keys());
|
|
711
|
+
console.log(`${dateTimeFormattedUtils} | [Server] Services reloaded: ${context.reloadedServices.length} services`);
|
|
712
|
+
} catch (error) {
|
|
713
|
+
console.warn(`${dateTimeFormattedUtils} | [Server] Services reload warning:`, error.message);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
594
716
|
};
|
|
595
717
|
// Annotate the CommonJS export names for ESM import in node:
|
|
596
718
|
0 && (module.exports = {
|
package/dist/index.d.cts
CHANGED
|
@@ -10,6 +10,7 @@ interface IRouteDefinition {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
type TFeatureRoutes = {
|
|
13
|
+
featureName?: string;
|
|
13
14
|
featureRoute: IRouteDefinition[];
|
|
14
15
|
};
|
|
15
16
|
|
|
@@ -22,6 +23,9 @@ declare class WebServerCore {
|
|
|
22
23
|
private readonly getEnvironment;
|
|
23
24
|
private readonly environmentPath;
|
|
24
25
|
private serverListenEvent;
|
|
26
|
+
private isHotReloading;
|
|
27
|
+
private currentRoutes;
|
|
28
|
+
private currentDependencies;
|
|
25
29
|
constructor(app: express.Application, loggerConfig: LoggerCore, localLanguage: string, environmentPath: any, corsOriginOptions?: Partial<CorsOptions>);
|
|
26
30
|
/**
|
|
27
31
|
*
|
|
@@ -62,6 +66,31 @@ declare class WebServerCore {
|
|
|
62
66
|
* @private
|
|
63
67
|
*/
|
|
64
68
|
private infoWebApp;
|
|
69
|
+
private setupSignalHandlers;
|
|
70
|
+
/**
|
|
71
|
+
* Logique de rechargement à chaud
|
|
72
|
+
*/
|
|
73
|
+
private handleHotReload;
|
|
74
|
+
/**
|
|
75
|
+
* Clear server module cache
|
|
76
|
+
*/
|
|
77
|
+
private clearServerCache;
|
|
78
|
+
/**
|
|
79
|
+
* Recharger les configurations
|
|
80
|
+
*/
|
|
81
|
+
private reloadConfigurations;
|
|
82
|
+
/**
|
|
83
|
+
* Recharger les dépendances
|
|
84
|
+
*/
|
|
85
|
+
private reloadDependencies;
|
|
86
|
+
/**
|
|
87
|
+
* Recharger les routes
|
|
88
|
+
*/
|
|
89
|
+
private reloadRoutes;
|
|
90
|
+
/**
|
|
91
|
+
* Recharger les services
|
|
92
|
+
*/
|
|
93
|
+
private reloadServices;
|
|
65
94
|
}
|
|
66
95
|
|
|
67
96
|
declare const envPath: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ interface IRouteDefinition {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
type TFeatureRoutes = {
|
|
13
|
+
featureName?: string;
|
|
13
14
|
featureRoute: IRouteDefinition[];
|
|
14
15
|
};
|
|
15
16
|
|
|
@@ -22,6 +23,9 @@ declare class WebServerCore {
|
|
|
22
23
|
private readonly getEnvironment;
|
|
23
24
|
private readonly environmentPath;
|
|
24
25
|
private serverListenEvent;
|
|
26
|
+
private isHotReloading;
|
|
27
|
+
private currentRoutes;
|
|
28
|
+
private currentDependencies;
|
|
25
29
|
constructor(app: express.Application, loggerConfig: LoggerCore, localLanguage: string, environmentPath: any, corsOriginOptions?: Partial<CorsOptions>);
|
|
26
30
|
/**
|
|
27
31
|
*
|
|
@@ -62,6 +66,31 @@ declare class WebServerCore {
|
|
|
62
66
|
* @private
|
|
63
67
|
*/
|
|
64
68
|
private infoWebApp;
|
|
69
|
+
private setupSignalHandlers;
|
|
70
|
+
/**
|
|
71
|
+
* Logique de rechargement à chaud
|
|
72
|
+
*/
|
|
73
|
+
private handleHotReload;
|
|
74
|
+
/**
|
|
75
|
+
* Clear server module cache
|
|
76
|
+
*/
|
|
77
|
+
private clearServerCache;
|
|
78
|
+
/**
|
|
79
|
+
* Recharger les configurations
|
|
80
|
+
*/
|
|
81
|
+
private reloadConfigurations;
|
|
82
|
+
/**
|
|
83
|
+
* Recharger les dépendances
|
|
84
|
+
*/
|
|
85
|
+
private reloadDependencies;
|
|
86
|
+
/**
|
|
87
|
+
* Recharger les routes
|
|
88
|
+
*/
|
|
89
|
+
private reloadRoutes;
|
|
90
|
+
/**
|
|
91
|
+
* Recharger les services
|
|
92
|
+
*/
|
|
93
|
+
private reloadServices;
|
|
65
94
|
}
|
|
66
95
|
|
|
67
96
|
declare const envPath: string;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// node_modules/tsup/assets/esm_shims.js
|
|
9
|
+
import { fileURLToPath } from "url";
|
|
10
|
+
import path from "path";
|
|
11
|
+
var getFilename = () => fileURLToPath(import.meta.url);
|
|
12
|
+
var getDirname = () => path.dirname(getFilename());
|
|
13
|
+
var __dirname = /* @__PURE__ */ getDirname();
|
|
14
|
+
|
|
1
15
|
// src/core/webServer.core.ts
|
|
2
|
-
import * as
|
|
16
|
+
import * as path3 from "path";
|
|
3
17
|
import process4 from "node:process";
|
|
4
18
|
import corsOrigin from "cors";
|
|
5
19
|
import { CEventNameError as eventName2, ServerListenEventError as ServerListenEventError2 } from "opticore-catch-exception-error";
|
|
@@ -68,10 +82,10 @@ function eventProcessHandler(localeLanguage) {
|
|
|
68
82
|
// src/application/service/core.service.ts
|
|
69
83
|
import process3 from "node:process";
|
|
70
84
|
import chalk from "chalk";
|
|
71
|
-
import * as
|
|
85
|
+
import * as path2 from "path";
|
|
72
86
|
import * as fs from "fs";
|
|
73
87
|
import colors3 from "ansi-colors";
|
|
74
|
-
import { HttpStatusCode
|
|
88
|
+
import { HttpStatusCode as status } from "opticore-http-response";
|
|
75
89
|
import { TranslationLoader as TranslationLoader2 } from "opticore-translator";
|
|
76
90
|
import { getEnvironnementValue } from "opticore-env-access";
|
|
77
91
|
|
|
@@ -126,12 +140,22 @@ var STraceError = (props, name, httpCode, isOperational) => {
|
|
|
126
140
|
import process2 from "process";
|
|
127
141
|
var envPath = process2.cwd() + "/config/env/.env";
|
|
128
142
|
|
|
143
|
+
// src/application/service/loaderTranslationFile.service.ts
|
|
144
|
+
import { translationLoaderConfig } from "opticore-loader-translation";
|
|
145
|
+
var loaderTranslationFile = (localLanguage) => {
|
|
146
|
+
return translationLoaderConfig({
|
|
147
|
+
packageName: "opticore-webapp",
|
|
148
|
+
locationTranslationFile: ["utils", "translations"],
|
|
149
|
+
localLang: localLanguage
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
|
|
129
153
|
// src/core/providers/dependencies.provider.ts
|
|
130
154
|
import { SContainer } from "opticore-dependency-inject";
|
|
131
155
|
|
|
132
156
|
// src/application/service/dependencies.service.ts
|
|
133
157
|
import { LoggerCore } from "opticore-logger";
|
|
134
|
-
import {
|
|
158
|
+
import { OpticoreLogger } from "opticore-server-logger";
|
|
135
159
|
var dependencies = [
|
|
136
160
|
{
|
|
137
161
|
key: "LoggerCore",
|
|
@@ -139,8 +163,8 @@ var dependencies = [
|
|
|
139
163
|
scope: "singleton"
|
|
140
164
|
},
|
|
141
165
|
{
|
|
142
|
-
key: "
|
|
143
|
-
factory: () => new
|
|
166
|
+
key: "OpticoreLogger",
|
|
167
|
+
factory: () => new OpticoreLogger(),
|
|
144
168
|
scope: "singleton"
|
|
145
169
|
}
|
|
146
170
|
];
|
|
@@ -150,33 +174,17 @@ var dependenciesContainerProvider = (localLang) => {
|
|
|
150
174
|
return new SContainer(localLang, dependencies);
|
|
151
175
|
};
|
|
152
176
|
|
|
153
|
-
// src/application/service/logger.service.ts
|
|
154
|
-
var SLogger = (localLang) => {
|
|
155
|
-
const serverLog = dependenciesContainerProvider(localLang).resolve("serverLogger");
|
|
156
|
-
const logger = dependenciesContainerProvider(localLang).resolve("LoggerCore");
|
|
157
|
-
return {
|
|
158
|
-
serverLog,
|
|
159
|
-
logger
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
// src/application/service/loaderTranslationFile.service.ts
|
|
164
|
-
import { translationLoaderConfig } from "opticore-loader-translation";
|
|
165
|
-
var loaderTranslationFile = (localLanguage) => {
|
|
166
|
-
return translationLoaderConfig({
|
|
167
|
-
packageName: "opticore-webapp",
|
|
168
|
-
locationTranslationFile: ["utils", "translations"],
|
|
169
|
-
localLang: localLanguage
|
|
170
|
-
});
|
|
171
|
-
};
|
|
172
|
-
|
|
173
177
|
// src/application/service/core.service.ts
|
|
174
178
|
var CoreService = class {
|
|
175
179
|
localLanguage;
|
|
176
180
|
environmentPath;
|
|
181
|
+
serverLog;
|
|
182
|
+
logger;
|
|
177
183
|
constructor(localLang, environmentPath) {
|
|
178
184
|
this.environmentPath = environmentPath;
|
|
179
185
|
this.localLanguage = localLang;
|
|
186
|
+
this.serverLog = dependenciesContainerProvider(localLang).resolve("OpticoreLogger");
|
|
187
|
+
this.logger = dependenciesContainerProvider(localLang).resolve("LoggerCore");
|
|
180
188
|
}
|
|
181
189
|
/**
|
|
182
190
|
*
|
|
@@ -240,7 +248,7 @@ var CoreService = class {
|
|
|
240
248
|
const endTime = process3.hrtime(startTime);
|
|
241
249
|
const executionTime = (endTime[0] * 1e9 + endTime[1]) / 1e6;
|
|
242
250
|
return {
|
|
243
|
-
"projectPath":
|
|
251
|
+
"projectPath": path2.join(process3.cwd()),
|
|
244
252
|
"startingTime": `${executionTime.toFixed(5)} ms`
|
|
245
253
|
};
|
|
246
254
|
}
|
|
@@ -253,7 +261,7 @@ var CoreService = class {
|
|
|
253
261
|
*/
|
|
254
262
|
getEnvFileLoading(filePath) {
|
|
255
263
|
try {
|
|
256
|
-
const fullPath =
|
|
264
|
+
const fullPath = path2.resolve(process3.cwd(), filePath);
|
|
257
265
|
if (fs.existsSync(fullPath)) {
|
|
258
266
|
const env = fs.readFileSync(fullPath, "utf-8");
|
|
259
267
|
const lines = env.split("\n");
|
|
@@ -266,12 +274,12 @@ var CoreService = class {
|
|
|
266
274
|
});
|
|
267
275
|
}
|
|
268
276
|
} catch (err) {
|
|
269
|
-
|
|
277
|
+
this.logger.error({
|
|
270
278
|
message: err.message,
|
|
271
279
|
title: TranslationLoader2.t("EnvFileLoading", this.localLanguage),
|
|
272
280
|
errorType: err.code,
|
|
273
281
|
stackTrace: err.stack,
|
|
274
|
-
httpCodeValue:
|
|
282
|
+
httpCodeValue: status.INTERNAL_SERVER_ERROR
|
|
275
283
|
});
|
|
276
284
|
}
|
|
277
285
|
}
|
|
@@ -286,7 +294,7 @@ var CoreService = class {
|
|
|
286
294
|
try {
|
|
287
295
|
loaderTranslationFile(this.localLanguage);
|
|
288
296
|
this.getEnvFileLoading(".env");
|
|
289
|
-
const env = getEnvironnementValue(
|
|
297
|
+
const env = getEnvironnementValue(path2.join(envPath));
|
|
290
298
|
const isDevelopment = env.devEnv === development && env.prodEnv === "";
|
|
291
299
|
if (isDevelopment) {
|
|
292
300
|
return `${TranslationLoader2.t("serverRunning", this.localLanguage)} ${colors3.bgBlue(`${colors3.bold(`${development}`)}`)} mode`;
|
|
@@ -296,16 +304,16 @@ var CoreService = class {
|
|
|
296
304
|
return `${TranslationLoader2.t("serverRunning", this.localLanguage)} ${colors3.bgBlue(`${colors3.bold(`${development}`)}`)} mode`;
|
|
297
305
|
}
|
|
298
306
|
} catch (err) {
|
|
299
|
-
|
|
307
|
+
this.logger.error({
|
|
300
308
|
message: err.message,
|
|
301
309
|
title: TranslationLoader2.t("serverRunning mode", this.localLanguage),
|
|
302
310
|
errorType: err.code,
|
|
303
311
|
stackTrace: err.stack,
|
|
304
|
-
httpCodeValue:
|
|
312
|
+
httpCodeValue: status.INTERNAL_SERVER_ERROR
|
|
305
313
|
});
|
|
306
314
|
}
|
|
307
315
|
}
|
|
308
|
-
infoServer(
|
|
316
|
+
infoServer(host, port) {
|
|
309
317
|
try {
|
|
310
318
|
loaderTranslationFile(this.localLanguage);
|
|
311
319
|
const getEnvironment = getEnvironnementValue(this.environmentPath);
|
|
@@ -314,12 +322,15 @@ var CoreService = class {
|
|
|
314
322
|
TranslationLoader2.t("webServerListening", this.localLanguage),
|
|
315
323
|
TranslationLoader2.t("webServerUsingNodeVersion", this.localLanguage, { nodeVersion: this.getVersions().nodeVersion }),
|
|
316
324
|
TranslationLoader2.t("startTime", this.localLanguage, { startTime: this.getProjectInfo().startingTime }),
|
|
317
|
-
this.getServerRunningMode(
|
|
325
|
+
this.getServerRunningMode(
|
|
326
|
+
TranslationLoader2.t("runningModeDev", this.localLanguage),
|
|
327
|
+
TranslationLoader2.t("runningModeProd", this.localLanguage)
|
|
328
|
+
)
|
|
318
329
|
];
|
|
319
330
|
const maxLength = Math.max(...messages.map((m) => {
|
|
320
331
|
return m.replace(/\u001b\[[0-9]{1,2}m/g, "").length;
|
|
321
332
|
})) + 4;
|
|
322
|
-
console.log(chalk.blackBright(`${TranslationLoader2.t("tailingServerLog", this.localLanguage)} (${
|
|
333
|
+
console.log(chalk.blackBright(`${TranslationLoader2.t("tailingServerLog", this.localLanguage)} (${path2.join(path2.basename(process3.cwd()), "logs", "app.log")})`));
|
|
323
334
|
const border = chalk.bgGreen.white(" ".repeat(maxLength));
|
|
324
335
|
console.log(border);
|
|
325
336
|
messages.forEach((msg) => {
|
|
@@ -329,7 +340,7 @@ var CoreService = class {
|
|
|
329
340
|
});
|
|
330
341
|
console.log(border);
|
|
331
342
|
console.log("\n");
|
|
332
|
-
|
|
343
|
+
this.serverLog.serverLog({
|
|
333
344
|
timestamp: (/* @__PURE__ */ new Date()).toString(),
|
|
334
345
|
level: "SERVER",
|
|
335
346
|
title: TranslationLoader2.t("serverRunningTitle", this.localLanguage),
|
|
@@ -337,12 +348,12 @@ var CoreService = class {
|
|
|
337
348
|
message: TranslationLoader2.t("serverRunningAt", this.localLanguage, { server: msg5 })
|
|
338
349
|
});
|
|
339
350
|
} catch (err) {
|
|
340
|
-
|
|
351
|
+
this.logger.error({
|
|
341
352
|
message: err.message,
|
|
342
353
|
title: TranslationLoader2.t("server", this.localLanguage),
|
|
343
354
|
errorType: err.code,
|
|
344
355
|
stackTrace: err.stack,
|
|
345
|
-
httpCodeValue:
|
|
356
|
+
httpCodeValue: status.INTERNAL_SERVER_ERROR
|
|
346
357
|
});
|
|
347
358
|
}
|
|
348
359
|
}
|
|
@@ -379,7 +390,17 @@ import {
|
|
|
379
390
|
CCodeError,
|
|
380
391
|
CErrorName
|
|
381
392
|
} from "opticore-catch-exception-error";
|
|
382
|
-
|
|
393
|
+
|
|
394
|
+
// src/application/service/logger.service.ts
|
|
395
|
+
var SLogger = (localLang) => {
|
|
396
|
+
return {
|
|
397
|
+
serverLog: dependenciesContainerProvider(localLang).resolve("OpticoreLogger"),
|
|
398
|
+
logger: dependenciesContainerProvider(localLang).resolve("LoggerCore")
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
// src/application/service/serverStartError.service.ts
|
|
403
|
+
import { HttpStatusCode } from "opticore-http-response";
|
|
383
404
|
var SServerStartError = (err, environmentPath) => {
|
|
384
405
|
if (err.name) {
|
|
385
406
|
for (const [key, code] of Object.entries(CErrorName)) {
|
|
@@ -389,7 +410,7 @@ var SServerStartError = (err, environmentPath) => {
|
|
|
389
410
|
title: code,
|
|
390
411
|
errorType: code,
|
|
391
412
|
stackTrace: err.stack,
|
|
392
|
-
httpCodeValue:
|
|
413
|
+
httpCodeValue: HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
393
414
|
});
|
|
394
415
|
break;
|
|
395
416
|
}
|
|
@@ -402,7 +423,7 @@ var SServerStartError = (err, environmentPath) => {
|
|
|
402
423
|
title: code,
|
|
403
424
|
errorType: key,
|
|
404
425
|
stackTrace: err.stack,
|
|
405
|
-
httpCodeValue:
|
|
426
|
+
httpCodeValue: HttpStatusCode.INTERNAL_SERVER_ERROR
|
|
406
427
|
});
|
|
407
428
|
break;
|
|
408
429
|
}
|
|
@@ -413,7 +434,7 @@ var SServerStartError = (err, environmentPath) => {
|
|
|
413
434
|
// src/core/webServer.core.ts
|
|
414
435
|
import { requestCallsEvent } from "opticore-request-call-event";
|
|
415
436
|
import { SContainer as SContainer2 } from "opticore-dependency-inject";
|
|
416
|
-
import { HttpStatusCode as
|
|
437
|
+
import { HttpStatusCode as HttpStatusCode2 } from "opticore-http-response";
|
|
417
438
|
import { TranslationLoader as TranslationLoader3 } from "opticore-translator";
|
|
418
439
|
var WebServerCore = class {
|
|
419
440
|
serverUtility;
|
|
@@ -424,6 +445,9 @@ var WebServerCore = class {
|
|
|
424
445
|
getEnvironment;
|
|
425
446
|
environmentPath;
|
|
426
447
|
serverListenEvent;
|
|
448
|
+
isHotReloading = false;
|
|
449
|
+
currentRoutes = [];
|
|
450
|
+
currentDependencies = [];
|
|
427
451
|
constructor(app, loggerConfig, localLanguage, environmentPath, corsOriginOptions) {
|
|
428
452
|
this.stackTraceErrorHandling(localLanguage);
|
|
429
453
|
this.getEnvironment = getEnvironnementValue2(environmentPath);
|
|
@@ -438,6 +462,7 @@ var WebServerCore = class {
|
|
|
438
462
|
this.expressApp.use(corsOrigin(corsOriginOptions));
|
|
439
463
|
this.serverListenEvent = new ServerListenEventError2(localLanguage);
|
|
440
464
|
this.serverUtility = new CoreService(localLanguage, environmentPath);
|
|
465
|
+
this.setupSignalHandlers();
|
|
441
466
|
}
|
|
442
467
|
/**
|
|
443
468
|
*
|
|
@@ -452,7 +477,7 @@ var WebServerCore = class {
|
|
|
452
477
|
title: TranslationLoader3.t("registerDependencies", this.localLanguage),
|
|
453
478
|
errorType: err.code,
|
|
454
479
|
stackTrace: err.stack,
|
|
455
|
-
httpCodeValue:
|
|
480
|
+
httpCodeValue: HttpStatusCode2.INTERNAL_SERVER_ERROR
|
|
456
481
|
});
|
|
457
482
|
}
|
|
458
483
|
}
|
|
@@ -464,6 +489,8 @@ var WebServerCore = class {
|
|
|
464
489
|
*/
|
|
465
490
|
onStartServer(routers, databaseCallback, dependenciesProvider) {
|
|
466
491
|
loaderTranslationFile(this.localLanguage);
|
|
492
|
+
this.currentRoutes = routers;
|
|
493
|
+
this.currentDependencies = dependenciesProvider || [];
|
|
467
494
|
if (this.getEnvironment.appPort === "" && Number(this.getEnvironment.appPort) === 0) {
|
|
468
495
|
this.serverListenEvent.hostPortUndefined(Number(this.getEnvironment.appPort));
|
|
469
496
|
} else if (this.getEnvironment.appHost === "") {
|
|
@@ -476,7 +503,7 @@ var WebServerCore = class {
|
|
|
476
503
|
title: TranslationLoader3.t("noLocalLang", this.localLanguage),
|
|
477
504
|
errorType: TranslationLoader3.t("localLangMissing", this.localLanguage),
|
|
478
505
|
stackTrace: void 0,
|
|
479
|
-
httpCodeValue:
|
|
506
|
+
httpCodeValue: HttpStatusCode2.NOT_FOUND
|
|
480
507
|
});
|
|
481
508
|
} else {
|
|
482
509
|
return this.expressApp.listen(
|
|
@@ -485,9 +512,9 @@ var WebServerCore = class {
|
|
|
485
512
|
loaderTranslationFile(this.localLanguage);
|
|
486
513
|
try {
|
|
487
514
|
databaseCallback(this.getEnvironment);
|
|
488
|
-
new SContainer2(this.localLanguage,
|
|
489
|
-
this.expressApp.use(express2.static(
|
|
490
|
-
this.registerRoutes(
|
|
515
|
+
new SContainer2(this.localLanguage, this.currentDependencies);
|
|
516
|
+
this.expressApp.use(express2.static(path3.join(process4.cwd(), "public/template")));
|
|
517
|
+
this.registerRoutes(this.currentRoutes);
|
|
491
518
|
} catch (err) {
|
|
492
519
|
SServerStartError(err, this.environmentPath);
|
|
493
520
|
}
|
|
@@ -555,12 +582,121 @@ var WebServerCore = class {
|
|
|
555
582
|
*/
|
|
556
583
|
infoWebApp() {
|
|
557
584
|
this.serverUtility.infoServer(
|
|
558
|
-
this.serverUtility.getVersions().nodeVersion,
|
|
559
|
-
this.serverUtility.getProjectInfo().startingTime,
|
|
560
585
|
this.getEnvironment.appHost,
|
|
561
586
|
Number(this.getEnvironment.appPort)
|
|
562
587
|
);
|
|
563
588
|
}
|
|
589
|
+
setupSignalHandlers() {
|
|
590
|
+
process4.on("SIGHUP", async () => {
|
|
591
|
+
if (!this.isHotReloading) {
|
|
592
|
+
console.log(`${dateTimeFormattedUtils} | [Server] Received SIGHUP signal, hot reloading...`);
|
|
593
|
+
try {
|
|
594
|
+
this.isHotReloading = true;
|
|
595
|
+
await this.handleHotReload();
|
|
596
|
+
console.log(`${dateTimeFormattedUtils} | [Server] Hot reload completed successfully`);
|
|
597
|
+
} catch (error) {
|
|
598
|
+
console.error(`${dateTimeFormattedUtils} | [Server] Hot reload failed:`, error);
|
|
599
|
+
this.serverListenEvent.onEventError(error);
|
|
600
|
+
} finally {
|
|
601
|
+
this.isHotReloading = false;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Logique de rechargement à chaud
|
|
608
|
+
*/
|
|
609
|
+
async handleHotReload() {
|
|
610
|
+
const context = {
|
|
611
|
+
clearedModules: [],
|
|
612
|
+
reloadedRoutes: [],
|
|
613
|
+
reloadedServices: []
|
|
614
|
+
};
|
|
615
|
+
try {
|
|
616
|
+
this.clearServerCache(context);
|
|
617
|
+
await this.reloadConfigurations(context);
|
|
618
|
+
await this.reloadDependencies(context);
|
|
619
|
+
await this.reloadRoutes(context);
|
|
620
|
+
await this.reloadServices(context);
|
|
621
|
+
} catch (error) {
|
|
622
|
+
console.error(`${dateTimeFormattedUtils} | [Server] Hot reload error:`, error);
|
|
623
|
+
throw error;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Clear server module cache
|
|
628
|
+
*/
|
|
629
|
+
clearServerCache(context) {
|
|
630
|
+
const baseDirs = [
|
|
631
|
+
path3.join(process4.cwd(), "src"),
|
|
632
|
+
path3.join(process4.cwd(), "dist"),
|
|
633
|
+
path3.join(__dirname, "..")
|
|
634
|
+
];
|
|
635
|
+
for (const key in __require.cache) {
|
|
636
|
+
if (!key.includes("node_modules") && !key.endsWith(".json") && baseDirs.some((dir) => key.startsWith(dir))) {
|
|
637
|
+
delete __require.cache[key];
|
|
638
|
+
context.clearedModules.push(path3.basename(key));
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
console.log(`${dateTimeFormattedUtils} | [Server] Cleared ${context.clearedModules.length} modules from cache`);
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Recharger les configurations
|
|
645
|
+
*/
|
|
646
|
+
async reloadConfigurations(context) {
|
|
647
|
+
try {
|
|
648
|
+
const newEnv = getEnvironnementValue2(this.environmentPath);
|
|
649
|
+
Object.assign(this.getEnvironment, newEnv);
|
|
650
|
+
loaderTranslationFile(this.localLanguage);
|
|
651
|
+
console.log(`${dateTimeFormattedUtils} | [Server] Configurations reloaded`);
|
|
652
|
+
} catch (error) {
|
|
653
|
+
console.warn(`${dateTimeFormattedUtils} | [Server] Configuration reload warning:`, error.message);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Recharger les dépendances
|
|
658
|
+
*/
|
|
659
|
+
async reloadDependencies(context) {
|
|
660
|
+
try {
|
|
661
|
+
new SContainer2(this.localLanguage, this.currentDependencies);
|
|
662
|
+
console.log(`${dateTimeFormattedUtils} | [Server] Dependencies reloaded`);
|
|
663
|
+
} catch (error) {
|
|
664
|
+
console.warn(`${dateTimeFormattedUtils} | [Server] Dependencies reload warning:`, error.message);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Recharger les routes
|
|
669
|
+
*/
|
|
670
|
+
async reloadRoutes(context) {
|
|
671
|
+
try {
|
|
672
|
+
this.expressApp._router.stack = this.expressApp._router.stack.filter((layer) => {
|
|
673
|
+
return !layer.route;
|
|
674
|
+
});
|
|
675
|
+
this.registerRoutes(this.currentRoutes);
|
|
676
|
+
context.reloadedRoutes = this.currentRoutes.map((route, index) => {
|
|
677
|
+
if (route.featureName && typeof route.featureName === "string") {
|
|
678
|
+
return route.featureName;
|
|
679
|
+
}
|
|
680
|
+
return `RouteGroup_${index + 1}`;
|
|
681
|
+
}).filter((name) => !!name);
|
|
682
|
+
console.log(`${dateTimeFormattedUtils} | [Server] Routes reloaded: ${context.reloadedRoutes.join(", ")}`);
|
|
683
|
+
} catch (error) {
|
|
684
|
+
console.error(`${dateTimeFormattedUtils} | [Server] Routes reload error:`, error.message);
|
|
685
|
+
throw error;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Recharger les services
|
|
690
|
+
*/
|
|
691
|
+
async reloadServices(context) {
|
|
692
|
+
try {
|
|
693
|
+
const services = dependenciesContainerProvider(this.localLanguage).getServices();
|
|
694
|
+
context.reloadedServices = Array.from(services.keys());
|
|
695
|
+
console.log(`${dateTimeFormattedUtils} | [Server] Services reloaded: ${context.reloadedServices.length} services`);
|
|
696
|
+
} catch (error) {
|
|
697
|
+
console.warn(`${dateTimeFormattedUtils} | [Server] Services reload warning:`, error.message);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
564
700
|
};
|
|
565
701
|
export {
|
|
566
702
|
WebServerCore as WebServer,
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"serverRunning": "The server is running in",
|
|
3
|
+
"webServerListening": "[OK] Web server listening",
|
|
4
|
+
"webServerUsingNodeVersion": "The Web server is using Node.js version {nodeVersion}",
|
|
5
|
+
"startTime": "Startup time : {startTime}",
|
|
6
|
+
"serverRunningAt": "Server is running at : {server}",
|
|
7
|
+
"serverRunningTitle": "Server running",
|
|
8
|
+
"opticoreServerTypeName": "OptiCore server",
|
|
9
|
+
"runningModeDev": "development",
|
|
10
|
+
"runningModeProd": "production",
|
|
11
|
+
"totalMemoryAllocated": "Resident Set Size - total memory allocated for the process execution",
|
|
12
|
+
"sizeAllocatedHeap": "Total size of the allocated heap",
|
|
13
|
+
"memoryUsedExecution": "Actual memory used during the execution",
|
|
14
|
+
"externalMemory":"V8 external memory",
|
|
15
|
+
"memoryUsageUser": "Memory usage user",
|
|
16
|
+
"memoryUsageSystem": "Memory usage system",
|
|
17
|
+
"dbConnection": "DataBase connection",
|
|
18
|
+
"dbConnectionClosed": "MySQL connection is closed",
|
|
19
|
+
"mysqlErrorCon": "MysqlError connection",
|
|
20
|
+
"mySQLError": "MysqlError",
|
|
21
|
+
"mySqlCloseConnection": "MySql close connection",
|
|
22
|
+
"verifyExistingKey": "Verify Existing Key",
|
|
23
|
+
"invalidRequest": "Invalid request",
|
|
24
|
+
"tokenNotProvided": "No token provided.",
|
|
25
|
+
"ExpiresToken": "Expires Token. You're not authorize",
|
|
26
|
+
"privateKeyNotExist": "A private key doesn't exist.",
|
|
27
|
+
"publicKeyNotExist": "A public key doesn't exist.",
|
|
28
|
+
"errorNamePublicKeyNotExist": "No public key",
|
|
29
|
+
"errorAuthorPublicKeyNotExist": "PublicKey not existing",
|
|
30
|
+
"errorDecryption": "Error decryption with private key",
|
|
31
|
+
"rsaKeyNotFound": "RSA key provided is not found.",
|
|
32
|
+
"notVerifyingRSAKey": "Not verify RSA Key",
|
|
33
|
+
"errorNameNotVerifyingRSAKey": "Error Verify RSA Key",
|
|
34
|
+
"errorEncryptionPublicKey": "Error encryption with public key",
|
|
35
|
+
"errorEncryptionPrivateKey": "Error encryption with private key",
|
|
36
|
+
"errorNameRsaVerifyExistingKey": "Verify existing key",
|
|
37
|
+
"signatureRSAKeyFailed": "Signature verification failed.",
|
|
38
|
+
"encryptionWithPrivateKeyFailed": "Encryption With PrivateKey",
|
|
39
|
+
"encryptionFailed": "Encryption failed",
|
|
40
|
+
"decryptionWithPublicKeyFailed": "Decryption With PublicKey",
|
|
41
|
+
"decryptionFailed": "Decryption failed",
|
|
42
|
+
"verifyRSAKey": "Verify RSA Keys",
|
|
43
|
+
"verifyRSAKeyFailed": "Verify RSA Keys Failed",
|
|
44
|
+
"notVerifying": "Verification failed",
|
|
45
|
+
"signatureRSAKeysError": "Signature RSA Keys Error",
|
|
46
|
+
"encryptionWithPublicKey": "Encryption error",
|
|
47
|
+
"errorDecryptionWithPrivateKey": "Error Decryption With PrivateKey",
|
|
48
|
+
"verifyPublicRSAKey": "Verify Public RSA Key",
|
|
49
|
+
"PostgresDBConnectionChecker": "PostgresDB Connection Checker",
|
|
50
|
+
"PostgresConnection": "connection",
|
|
51
|
+
"MongoDBConnectionChecker": "MongoDB Connection Checker",
|
|
52
|
+
"MongoConnection": "connection",
|
|
53
|
+
"mongoDBAuthentication": "authentication",
|
|
54
|
+
"mongoDBConnection": "MongoDB connection",
|
|
55
|
+
"mongoDBAuthenticationFailed": "failed",
|
|
56
|
+
"mongoDBUnableParsingUrl": "unable to parse",
|
|
57
|
+
"mongoDBConnectionUrl": "url",
|
|
58
|
+
"mongoDBServerSelection": "MongoServer selection error",
|
|
59
|
+
"mongoDBServer": "MongoServer",
|
|
60
|
+
"mongoDBConnectionError": "connection error",
|
|
61
|
+
"mongoDBError": "error",
|
|
62
|
+
"loadedModules": "Loading core modules",
|
|
63
|
+
"kernel": "Kernel",
|
|
64
|
+
"loadKernel": "load kernel",
|
|
65
|
+
"moduleAppLoaded": "Modules app have been successfully loaded",
|
|
66
|
+
"content": "content",
|
|
67
|
+
"serverSide": "server side",
|
|
68
|
+
"hasBeenLoadedSuccessfully": "has been loaded successfully",
|
|
69
|
+
"routerService": "Routers service",
|
|
70
|
+
"registerRoutes": "Register routes",
|
|
71
|
+
"fail": "fail",
|
|
72
|
+
"loading": "loading",
|
|
73
|
+
"routers": "routers",
|
|
74
|
+
"registerLoadingFailed": "The route register failed to load",
|
|
75
|
+
"dbConnChecker": "database checker connection",
|
|
76
|
+
"loadedModulesError": "Required core modules are not loaded properly",
|
|
77
|
+
"dbConnexionSuccess": "The database connection was successful 🚀",
|
|
78
|
+
"mongoConnectionSuccess": "Connection to database is successfully.",
|
|
79
|
+
"PostgresConnectionSuccess": "Connection to database is successfully.",
|
|
80
|
+
"verifyExistingKeyError": "The provided key is not found",
|
|
81
|
+
"webServer": "Web server",
|
|
82
|
+
"listening": "listening",
|
|
83
|
+
"webHost": "host",
|
|
84
|
+
"badHost": "bad host",
|
|
85
|
+
"hostNotFound": "not found",
|
|
86
|
+
"errorHostUrl": "The host is not define, please define them in .env",
|
|
87
|
+
"badPort": "bad port",
|
|
88
|
+
"errorPort": "The port is not correct. Please define a right port with number port.",
|
|
89
|
+
"errorHost": "The host can't be empty or blank. Please define a string host in .env",
|
|
90
|
+
"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",
|
|
91
|
+
"unknownDB": "Database {database} is unknown. Please try to use Database CLI to create your database, or do it manually in your Database Management System",
|
|
92
|
+
"errorDBHost": "A database host {host} does not allow connection. Please either set the host like this: {localhost} in your .env file",
|
|
93
|
+
"serverPortKill": "Server which started on port {port} has been stopped successfully.",
|
|
94
|
+
"pidOnPortNotFound": "No process found on port {port}.",
|
|
95
|
+
"noProcessRunningOnPort": "Error: No process running on port {port}",
|
|
96
|
+
"noDefaultLocalLang": "A default local language is not define. Please define it into .env file at the key : DEFAULT_LOCAL_LANG",
|
|
97
|
+
"noLocalLang": "Local lang missing",
|
|
98
|
+
"localLangMissing": "DEFAULT_LOCAL_LANG missing",
|
|
99
|
+
"ENOENT:NoSuchFileOrDir": "ENOENT:NoSuchFileOrDir",
|
|
100
|
+
"serverRunning mode": "serverRunning mode",
|
|
101
|
+
"server": "server",
|
|
102
|
+
"registerDependencies": "Register Dependencies",
|
|
103
|
+
"tailingServerLog": "OptiCore Web Server log file"
|
|
104
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
{
|
|
2
|
+
"serverRunning": "Le serveur est en cours d'exécution en",
|
|
3
|
+
"webServerListening": "[OK] Le serveur web écoute",
|
|
4
|
+
"webServerUsingNodeVersion": "Le serveur Web utilise la version Node.js {nodeVersion}",
|
|
5
|
+
"startTime": "Temps de démarrage : {startTime}",
|
|
6
|
+
"serverRunningAt": "Le serveur est en cours d'exécution sur : {server}",
|
|
7
|
+
"serverRunningTitle": "Serveur est en cours d'exécution",
|
|
8
|
+
"opticoreServerTypeName": "Serveur OptiCore",
|
|
9
|
+
"runningModeDev": "développement",
|
|
10
|
+
"runningModeProd": "production",
|
|
11
|
+
"totalMemoryAllocated": "Taille de l'ensemble résident - mémoire totale allouée à l'exécution du processus",
|
|
12
|
+
"sizeAllocatedHeap": "Taille totale du segment alloué",
|
|
13
|
+
"memoryUsedExecution": "Mémoire réelle utilisée lors de l'exécution",
|
|
14
|
+
"externalMemory":"Mémoire externe V8",
|
|
15
|
+
"memoryUsageUser": "Utilisation de la mémoire par l'utilisateur",
|
|
16
|
+
"memoryUsageSystem": "Système d'usage de la mémoire",
|
|
17
|
+
"dbConnection": "Connexion à la base de données",
|
|
18
|
+
"dbConnectionClosed": "La connexion MySQL est fermée",
|
|
19
|
+
"mysqlErrorCon": "MysqlError connection",
|
|
20
|
+
"mySQLError": "MysqlError",
|
|
21
|
+
"mySqlCloseConnection": "Connexion MySql fermée",
|
|
22
|
+
"verifyExistingKey": "Vérifier la clé existante",
|
|
23
|
+
"invalidRequest": "Demande invalide",
|
|
24
|
+
"tokenNotProvided": "Aucun jeton fourni.",
|
|
25
|
+
"ExpiresToken": "Jeton expiré. Vous n'êtes pas autorisé",
|
|
26
|
+
"privateKeyNotExist": "Il n'existe pas de clé privée.",
|
|
27
|
+
"publicKeyNotExist": "Il n'existe pas de clé public.",
|
|
28
|
+
"errorNamePublicKeyNotExist": "Aucune clé public.",
|
|
29
|
+
"errorAuthorPublicKeyNotExist": "Clé publique inexistante",
|
|
30
|
+
"errorDecryption": "Erreur de décryptage avec la clé privée",
|
|
31
|
+
"rsaKeyNotFound": "La clé RSA fournie n'est pas trouvée.",
|
|
32
|
+
"notVerifyingRSAKey": "Pas de vérification de la clé RSA",
|
|
33
|
+
"errorNameNotVerifyingRSAKey": "Erreur lors de la vérification de la clé RSA",
|
|
34
|
+
"errorEncryptionPublicKey": "Erreur de chiffrement avec la clé publique",
|
|
35
|
+
"errorEncryptionPrivateKey": "Erreur de chiffrement avec la clé privée",
|
|
36
|
+
"errorNameRsaVerifyExistingKey": "Vérification de la clé existante",
|
|
37
|
+
"signatureRSAKeyFailed": "La vérification de la signature a échoué.",
|
|
38
|
+
"encryptionWithPrivateKeyFailed": "Chiffrement avec clé privée",
|
|
39
|
+
"encryptionFailed": "Le cryptage a échoué",
|
|
40
|
+
"decryptionWithPublicKeyFailed": "Décryptage avec la clé publique",
|
|
41
|
+
"decryptionFailed": "Le décryptage a échoué",
|
|
42
|
+
"verifyRSAKey": "Vérification des clés RSA",
|
|
43
|
+
"verifyRSAKeyFailed": "Échec de la vérification des clés RSA",
|
|
44
|
+
"notVerifying": "La vérification a échoué",
|
|
45
|
+
"signatureRSAKeysError": "Erreur de clé de signature RSA",
|
|
46
|
+
"encryptionWithPublicKey": "Erreur de cryptage",
|
|
47
|
+
"errorDecryptionWithPrivateKey": "Erreur de décryptage avec la clé privée",
|
|
48
|
+
"verifyPublicRSAKey": "Vérifier la clé publique RSA",
|
|
49
|
+
"PostgresDBConnectionChecker": "Vérificateur de la connexion a la base de donnée Postgres",
|
|
50
|
+
"PostgresConnection": "connection",
|
|
51
|
+
"MongoDBConnectionChecker": "Vérificateur de la connexion a la base de donnée connexion MongoDB",
|
|
52
|
+
"MongoConnection": "connection",
|
|
53
|
+
"mongoDBAuthentication": "authentication",
|
|
54
|
+
"mongoDBConnection": "Connexion à la base de données Mongo",
|
|
55
|
+
"mongoDBAuthenticationFailed": "échoué",
|
|
56
|
+
"mongoDBUnableParsingUrl": "impossible d'analyser",
|
|
57
|
+
"mongoDBConnectionUrl": "url",
|
|
58
|
+
"mongoDBServerSelection": "Erreur de sélection du serveur Mongo",
|
|
59
|
+
"mongoDBServer": "Serveur Mongo",
|
|
60
|
+
"mongoDBConnectionError": "Erreur de connection",
|
|
61
|
+
"mongoDBError": "erreur",
|
|
62
|
+
"loadedModules": "Chargement des modules de base",
|
|
63
|
+
"kernel": "Noyau",
|
|
64
|
+
"loadKernel": "charger le kernel",
|
|
65
|
+
"moduleAppLoaded": "Les modules de l'application ont été chargés avec succès",
|
|
66
|
+
"content": "contenu",
|
|
67
|
+
"serverSide": "côté serveur",
|
|
68
|
+
"hasBeenLoadedSuccessfully": "a été chargé avec succès",
|
|
69
|
+
"routerService": "Service de routeurs",
|
|
70
|
+
"registerRoutes": "Registre des routes",
|
|
71
|
+
"fail": "échec",
|
|
72
|
+
"loading": "Chargement",
|
|
73
|
+
"routers": "routes",
|
|
74
|
+
"registerLoadingFailed": "Le registre des routes n'a pas pu être chargé",
|
|
75
|
+
"dbConnChecker": "vérificateur a la connexion de base de données",
|
|
76
|
+
"loadedModulesError": "Les modules de base requis ne sont pas chargés correctement",
|
|
77
|
+
"dbConnexionSuccess": "La connexion à la base de données a réussi 🚀",
|
|
78
|
+
"mongoConnectionSuccess": "La connexion à la base de données est réussie.",
|
|
79
|
+
"PostgresConnectionSuccess": "La connexion à la base de données est réussie.",
|
|
80
|
+
"verifyExistingKeyError": "La clé fournie est introuvable",
|
|
81
|
+
"webServer": "Serveur Web",
|
|
82
|
+
"listening": "écoute",
|
|
83
|
+
"webHost": "hôte",
|
|
84
|
+
"badHost": "mauvais hôte",
|
|
85
|
+
"hostNotFound": "introuvable",
|
|
86
|
+
"errorHostUrl": "L'hôte et le port ne sont pas définis, veuillez les définir dans .env",
|
|
87
|
+
"badPort": "mauvais port",
|
|
88
|
+
"errorPort": "Le port est incorrect. Veuillez définir un port correct avec le numéro port.",
|
|
89
|
+
"errorHost": "L'hôte ne peut être vide. Veuillez définir une chaîne d'hôte dans .env.",
|
|
90
|
+
"accessDeniedToDBCon": "Accès refusé pour l'utilisateur {user}. Les identifiants de la base de données dans le fichier .env sont : utilisateur : {user} et le mot de passe : {password}. {user}''{password}'@'localhost'. Essayez de définir l'utilisateur et le mot de passe dans le fichier .env",
|
|
91
|
+
"unknownDB": "La base de données {database} est inconnue. Veuillez utiliser l'interface de ligne de commande de la base de données pour la créer, ou le faire manuellement dans votre système de gestion de bases de données.",
|
|
92
|
+
"errorDBHost": "L'hôte de la base de données {host} n'autorise pas la connexion. Veuillez définir l'hôte comme suit : {localhost} dans votre fichier .env",
|
|
93
|
+
"serverPortKill": "Serveur qui a démarré sur le port {port} a été arrêté avec succès.",
|
|
94
|
+
"pidOnPortNotFound": "Aucun processus trouvé sur le port {port}.",
|
|
95
|
+
"noProcessRunningOnPort": "Erreur : Aucun processus en cours sur le port {port}.",
|
|
96
|
+
"noDefaultLocalLang": "La langue locale par défaut n'est pas définie. Veuillez le définir dans le fichier .env a la clé: DEFAULT_LOCAL_LANG",
|
|
97
|
+
"noLocalLang": "Langue local manquante",
|
|
98
|
+
"localLangMissing": "DEFAULT_LOCAL_LANG manquante",
|
|
99
|
+
"ENOENT:NoSuchFileOrDir": "ENOENT:NoSuchFileOrDir",
|
|
100
|
+
"serverRunning mode": "serverRunning mode",
|
|
101
|
+
"server": "serveur",
|
|
102
|
+
"tailingServerLog": "Fichier journal Queue du serveur Web"
|
|
103
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opticore-webapp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.66",
|
|
4
4
|
"description": "wep server",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"cors": "^2.8.5",
|
|
34
34
|
"dotenv": "^16.5.0",
|
|
35
35
|
"gradient-string": "^3.0.0",
|
|
36
|
-
"opticore-catch-exception-error": "^1.0.
|
|
36
|
+
"opticore-catch-exception-error": "^1.0.26",
|
|
37
37
|
"opticore-dependency-inject": "^1.0.2",
|
|
38
38
|
"opticore-env-access": "^1.0.7",
|
|
39
39
|
"opticore-express": "^1.0.3",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"opticore-logger": "^1.0.19",
|
|
43
43
|
"opticore-request-call-event": "^1.0.6",
|
|
44
44
|
"opticore-router": "^1.0.16",
|
|
45
|
-
"opticore-server-logger": "^1.0.
|
|
45
|
+
"opticore-server-logger": "^1.0.5",
|
|
46
46
|
"opticore-translator": "^1.0.10",
|
|
47
47
|
"opticore-validator": "^1.0.3"
|
|
48
48
|
},
|