opticore-webapp 1.0.30 → 1.0.32
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 +45 -36
- package/dist/index.js +45 -36
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -218,6 +218,7 @@ var CoreService = class {
|
|
|
218
218
|
*
|
|
219
219
|
* @param data
|
|
220
220
|
* @private
|
|
221
|
+
*
|
|
221
222
|
* Return a string converted in MegaBytes
|
|
222
223
|
*/
|
|
223
224
|
formatMemoryUsage(data) {
|
|
@@ -281,6 +282,8 @@ var CoreService = class {
|
|
|
281
282
|
*
|
|
282
283
|
* @param filePath
|
|
283
284
|
* @private
|
|
285
|
+
*
|
|
286
|
+
* Return void
|
|
284
287
|
*/
|
|
285
288
|
getEnvFileLoading(filePath) {
|
|
286
289
|
const fullPath = path2.resolve(import_node_process2.default.cwd(), filePath);
|
|
@@ -300,6 +303,8 @@ var CoreService = class {
|
|
|
300
303
|
*
|
|
301
304
|
* @param development
|
|
302
305
|
* @param production
|
|
306
|
+
*
|
|
307
|
+
* Return string
|
|
303
308
|
*/
|
|
304
309
|
getServerRunningMode(development, production) {
|
|
305
310
|
this.getEnvFileLoading(".env");
|
|
@@ -320,13 +325,13 @@ var CoreService = class {
|
|
|
320
325
|
const msg3Value = `${import_ansi_colors3.default.bgBlue(`${import_ansi_colors3.default.bold(`${startingTime}`)}`)}`;
|
|
321
326
|
const msg3 = ` ${import_opticore_translator3.TranslationLoader.t("startTime", this.localLanguage)}`;
|
|
322
327
|
const msg4 = ` ${this.getServerRunningMode(`${import_opticore_translator3.TranslationLoader.t("runningModeDev", this.localLanguage)}`, `${import_opticore_translator3.TranslationLoader.t("runningModeProd", this.localLanguage)}`)}`;
|
|
323
|
-
const msg5 = getEnvironnement.protocolTransfert === "" ?
|
|
328
|
+
const msg5 = getEnvironnement.protocolTransfert === "" ? ` ${import_ansi_colors3.default.underline(`http://${host}:${port}`)}` : ` ${import_ansi_colors3.default.underline(`${getEnvironnement.protocolTransfert}://${host}:${port}`)}`;
|
|
324
329
|
console.log(import_chalk.default.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
325
330
|
console.log(import_chalk.default.bgGreen.white(msg1.padEnd(paddingLength, " ")));
|
|
326
|
-
console.log(import_chalk.default.bgGreen.white(msg2, msg2Value.padEnd(
|
|
327
|
-
console.log(import_chalk.default.bgGreen.white(msg3, msg3Value.padEnd(
|
|
328
|
-
console.log(import_chalk.default.bgGreen.white(msg4.padEnd(
|
|
329
|
-
console.log(import_chalk.default.bgGreen.white(msg5.padEnd(
|
|
331
|
+
console.log(import_chalk.default.bgGreen.white(msg2, msg2Value.padEnd(paddingLength, " ")));
|
|
332
|
+
console.log(import_chalk.default.bgGreen.white(msg3, msg3Value.padEnd(paddingLength, " ")));
|
|
333
|
+
console.log(import_chalk.default.bgGreen.white(msg4.padEnd(paddingLength, " ")));
|
|
334
|
+
console.log(import_chalk.default.bgGreen.white(msg5.padEnd(paddingLength, " ")));
|
|
330
335
|
console.log(import_chalk.default.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
331
336
|
console.log(``);
|
|
332
337
|
}
|
|
@@ -477,6 +482,14 @@ var SServerStartError = (err, javaScriptErrors, systemErrors, openSSLErrors, int
|
|
|
477
482
|
|
|
478
483
|
// src/core/webServer.core.ts
|
|
479
484
|
var import_opticore_request_call_event = require("opticore-request-call-event");
|
|
485
|
+
|
|
486
|
+
// src/application/service/logger.service.ts
|
|
487
|
+
var import_opticore_logger2 = require("opticore-logger");
|
|
488
|
+
var SLogger = () => {
|
|
489
|
+
return new import_opticore_logger2.LoggerCore();
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
// src/core/webServer.core.ts
|
|
480
493
|
var WebServerCore = class {
|
|
481
494
|
serverUtility;
|
|
482
495
|
expressApp = (0, import_opticore_express2.express)();
|
|
@@ -513,35 +526,39 @@ var WebServerCore = class {
|
|
|
513
526
|
this.translationWebAppLoader();
|
|
514
527
|
}
|
|
515
528
|
onStartServer(routers, dbConnexion, dependenciesContainerService) {
|
|
516
|
-
|
|
517
|
-
Number(this.getEnvironnement.appPort)
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
529
|
+
if (this.getEnvironnement.appHost === "" && Number(this.getEnvironnement.appPort) === 0) {
|
|
530
|
+
this.serverListenEvent.hostPortUndefined(Number(this.getEnvironnement.appPort));
|
|
531
|
+
} else if (this.getEnvironnement.appHost === "") {
|
|
532
|
+
this.serverListenEvent.hostUndefined(this.getEnvironnement.appHost);
|
|
533
|
+
} else if (Number(this.getEnvironnement.appPort) === 0) {
|
|
534
|
+
this.serverListenEvent.portUndefined();
|
|
535
|
+
} else if (this.localLanguage === "") {
|
|
536
|
+
SLogger().error(
|
|
537
|
+
import_opticore_translator5.TranslationLoader.t("", this.localLanguage)
|
|
538
|
+
);
|
|
539
|
+
} else {
|
|
540
|
+
return this.expressApp.listen(
|
|
541
|
+
Number(this.getEnvironnement.appPort),
|
|
542
|
+
() => {
|
|
543
|
+
try {
|
|
527
544
|
dbConnexion;
|
|
528
545
|
dependenciesContainerService;
|
|
529
546
|
this.expressApp.use(import_opticore_express2.express.static(path3.join(import_node_process3.default.cwd(), "public/template")));
|
|
530
547
|
this.registerRoutes(routers);
|
|
548
|
+
} catch (err) {
|
|
549
|
+
SServerStartError(
|
|
550
|
+
err,
|
|
551
|
+
this.javaScriptErrors,
|
|
552
|
+
this.systemErrors,
|
|
553
|
+
this.openSSLErrors,
|
|
554
|
+
this.internalErrors,
|
|
555
|
+
this.loggerConfig,
|
|
556
|
+
this.localLanguage
|
|
557
|
+
);
|
|
531
558
|
}
|
|
532
|
-
} catch (err) {
|
|
533
|
-
SServerStartError(
|
|
534
|
-
err,
|
|
535
|
-
this.javaScriptErrors,
|
|
536
|
-
this.systemErrors,
|
|
537
|
-
this.openSSLErrors,
|
|
538
|
-
this.internalErrors,
|
|
539
|
-
this.loggerConfig,
|
|
540
|
-
this.localLanguage
|
|
541
|
-
);
|
|
542
559
|
}
|
|
543
|
-
|
|
544
|
-
|
|
560
|
+
);
|
|
561
|
+
}
|
|
545
562
|
}
|
|
546
563
|
onListeningOnServerEvent(serverWeb) {
|
|
547
564
|
serverWeb.on(import_opticore_catch_exception_error4.CEventNameError.error, (err) => {
|
|
@@ -601,14 +618,6 @@ var envPath = import_process.default.cwd() + "/config/env/.env";
|
|
|
601
618
|
var import_dotenv = __toESM(require("dotenv"), 1);
|
|
602
619
|
var import_child_process = require("child_process");
|
|
603
620
|
var import_opticore_translator6 = require("opticore-translator");
|
|
604
|
-
|
|
605
|
-
// src/application/service/logger.service.ts
|
|
606
|
-
var import_opticore_logger2 = require("opticore-logger");
|
|
607
|
-
var SLogger = () => {
|
|
608
|
-
return new import_opticore_logger2.LoggerCore();
|
|
609
|
-
};
|
|
610
|
-
|
|
611
|
-
// src/utils/stopServer.utils.ts
|
|
612
621
|
var UStopServer = () => {
|
|
613
622
|
import_dotenv.default.config();
|
|
614
623
|
const port = process.env.PORT;
|
package/dist/index.js
CHANGED
|
@@ -188,6 +188,7 @@ var CoreService = class {
|
|
|
188
188
|
*
|
|
189
189
|
* @param data
|
|
190
190
|
* @private
|
|
191
|
+
*
|
|
191
192
|
* Return a string converted in MegaBytes
|
|
192
193
|
*/
|
|
193
194
|
formatMemoryUsage(data) {
|
|
@@ -251,6 +252,8 @@ var CoreService = class {
|
|
|
251
252
|
*
|
|
252
253
|
* @param filePath
|
|
253
254
|
* @private
|
|
255
|
+
*
|
|
256
|
+
* Return void
|
|
254
257
|
*/
|
|
255
258
|
getEnvFileLoading(filePath) {
|
|
256
259
|
const fullPath = path2.resolve(process3.cwd(), filePath);
|
|
@@ -270,6 +273,8 @@ var CoreService = class {
|
|
|
270
273
|
*
|
|
271
274
|
* @param development
|
|
272
275
|
* @param production
|
|
276
|
+
*
|
|
277
|
+
* Return string
|
|
273
278
|
*/
|
|
274
279
|
getServerRunningMode(development, production) {
|
|
275
280
|
this.getEnvFileLoading(".env");
|
|
@@ -290,13 +295,13 @@ var CoreService = class {
|
|
|
290
295
|
const msg3Value = `${colors3.bgBlue(`${colors3.bold(`${startingTime}`)}`)}`;
|
|
291
296
|
const msg3 = ` ${TranslationLoader3.t("startTime", this.localLanguage)}`;
|
|
292
297
|
const msg4 = ` ${this.getServerRunningMode(`${TranslationLoader3.t("runningModeDev", this.localLanguage)}`, `${TranslationLoader3.t("runningModeProd", this.localLanguage)}`)}`;
|
|
293
|
-
const msg5 = getEnvironnement.protocolTransfert === "" ?
|
|
298
|
+
const msg5 = getEnvironnement.protocolTransfert === "" ? ` ${colors3.underline(`http://${host}:${port}`)}` : ` ${colors3.underline(`${getEnvironnement.protocolTransfert}://${host}:${port}`)}`;
|
|
294
299
|
console.log(chalk.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
295
300
|
console.log(chalk.bgGreen.white(msg1.padEnd(paddingLength, " ")));
|
|
296
|
-
console.log(chalk.bgGreen.white(msg2, msg2Value.padEnd(
|
|
297
|
-
console.log(chalk.bgGreen.white(msg3, msg3Value.padEnd(
|
|
298
|
-
console.log(chalk.bgGreen.white(msg4.padEnd(
|
|
299
|
-
console.log(chalk.bgGreen.white(msg5.padEnd(
|
|
301
|
+
console.log(chalk.bgGreen.white(msg2, msg2Value.padEnd(paddingLength, " ")));
|
|
302
|
+
console.log(chalk.bgGreen.white(msg3, msg3Value.padEnd(paddingLength, " ")));
|
|
303
|
+
console.log(chalk.bgGreen.white(msg4.padEnd(paddingLength, " ")));
|
|
304
|
+
console.log(chalk.bgGreen.white(msg5.padEnd(paddingLength, " ")));
|
|
300
305
|
console.log(chalk.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
301
306
|
console.log(``);
|
|
302
307
|
}
|
|
@@ -447,6 +452,14 @@ var SServerStartError = (err, javaScriptErrors, systemErrors, openSSLErrors, int
|
|
|
447
452
|
|
|
448
453
|
// src/core/webServer.core.ts
|
|
449
454
|
import { requestCallsEvent } from "opticore-request-call-event";
|
|
455
|
+
|
|
456
|
+
// src/application/service/logger.service.ts
|
|
457
|
+
import { LoggerCore as LoggerCore2 } from "opticore-logger";
|
|
458
|
+
var SLogger = () => {
|
|
459
|
+
return new LoggerCore2();
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
// src/core/webServer.core.ts
|
|
450
463
|
var WebServerCore = class {
|
|
451
464
|
serverUtility;
|
|
452
465
|
expressApp = express2();
|
|
@@ -483,35 +496,39 @@ var WebServerCore = class {
|
|
|
483
496
|
this.translationWebAppLoader();
|
|
484
497
|
}
|
|
485
498
|
onStartServer(routers, dbConnexion, dependenciesContainerService) {
|
|
486
|
-
|
|
487
|
-
Number(this.getEnvironnement.appPort)
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
499
|
+
if (this.getEnvironnement.appHost === "" && Number(this.getEnvironnement.appPort) === 0) {
|
|
500
|
+
this.serverListenEvent.hostPortUndefined(Number(this.getEnvironnement.appPort));
|
|
501
|
+
} else if (this.getEnvironnement.appHost === "") {
|
|
502
|
+
this.serverListenEvent.hostUndefined(this.getEnvironnement.appHost);
|
|
503
|
+
} else if (Number(this.getEnvironnement.appPort) === 0) {
|
|
504
|
+
this.serverListenEvent.portUndefined();
|
|
505
|
+
} else if (this.localLanguage === "") {
|
|
506
|
+
SLogger().error(
|
|
507
|
+
TranslationLoader5.t("", this.localLanguage)
|
|
508
|
+
);
|
|
509
|
+
} else {
|
|
510
|
+
return this.expressApp.listen(
|
|
511
|
+
Number(this.getEnvironnement.appPort),
|
|
512
|
+
() => {
|
|
513
|
+
try {
|
|
497
514
|
dbConnexion;
|
|
498
515
|
dependenciesContainerService;
|
|
499
516
|
this.expressApp.use(express2.static(path3.join(process4.cwd(), "public/template")));
|
|
500
517
|
this.registerRoutes(routers);
|
|
518
|
+
} catch (err) {
|
|
519
|
+
SServerStartError(
|
|
520
|
+
err,
|
|
521
|
+
this.javaScriptErrors,
|
|
522
|
+
this.systemErrors,
|
|
523
|
+
this.openSSLErrors,
|
|
524
|
+
this.internalErrors,
|
|
525
|
+
this.loggerConfig,
|
|
526
|
+
this.localLanguage
|
|
527
|
+
);
|
|
501
528
|
}
|
|
502
|
-
} catch (err) {
|
|
503
|
-
SServerStartError(
|
|
504
|
-
err,
|
|
505
|
-
this.javaScriptErrors,
|
|
506
|
-
this.systemErrors,
|
|
507
|
-
this.openSSLErrors,
|
|
508
|
-
this.internalErrors,
|
|
509
|
-
this.loggerConfig,
|
|
510
|
-
this.localLanguage
|
|
511
|
-
);
|
|
512
529
|
}
|
|
513
|
-
|
|
514
|
-
|
|
530
|
+
);
|
|
531
|
+
}
|
|
515
532
|
}
|
|
516
533
|
onListeningOnServerEvent(serverWeb) {
|
|
517
534
|
serverWeb.on(eventName2.error, (err) => {
|
|
@@ -571,14 +588,6 @@ var envPath = process5.cwd() + "/config/env/.env";
|
|
|
571
588
|
import dotenv from "dotenv";
|
|
572
589
|
import { execSync } from "child_process";
|
|
573
590
|
import { TranslationLoader as TranslationLoader6 } from "opticore-translator";
|
|
574
|
-
|
|
575
|
-
// src/application/service/logger.service.ts
|
|
576
|
-
import { LoggerCore as LoggerCore2 } from "opticore-logger";
|
|
577
|
-
var SLogger = () => {
|
|
578
|
-
return new LoggerCore2();
|
|
579
|
-
};
|
|
580
|
-
|
|
581
|
-
// src/utils/stopServer.utils.ts
|
|
582
591
|
var UStopServer = () => {
|
|
583
592
|
dotenv.config();
|
|
584
593
|
const port = process.env.PORT;
|