opticore-webapp 1.0.8 → 1.0.10
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 +116 -632
- package/dist/index.d.cts +6 -66
- package/dist/index.d.ts +6 -66
- package/dist/index.js +109 -613
- package/package.json +9 -6
- package/src/application/service/core.service.ts +13 -10
- package/src/core/handlers/eventProcess.handler.ts +8 -5
- package/src/core/{utils → helpers}/logMessage.utils.ts +2 -2
- package/src/core/helpers/modulesLoaded.utils.ts +22 -0
- package/src/core/webServer.core.ts +28 -23
- package/src/domains/interfaces/routeDefinition.interface.ts +2 -2
- package/src/domains/types/kernelModule.type.ts +1 -1
- package/src/index.ts +1 -8
- package/src/utils/translations/messages.exception.en.json +78 -0
- package/src/utils/translations/messages.exception.fr.json +78 -0
- package/tsup.config.ts +1 -1
- package/src/application/exceptions/messages.exception.ts +0 -67
- package/src/core/events/errors/serverListen.event.error.ts +0 -335
- package/src/core/events/requestCalls.event.ts +0 -83
- package/src/core/handlers/errors/base/stackTraceError.ts +0 -23
- package/src/core/handlers/errors/stackTraceAssertionError.ts +0 -13
- package/src/core/handlers/errors/stackTraceEvalError.ts +0 -12
- package/src/core/handlers/errors/stackTraceGeneralError.ts +0 -13
- package/src/core/handlers/errors/stackTraceOpenSSLError.ts +0 -12
- package/src/core/handlers/errors/stackTraceRangeError.ts +0 -12
- package/src/core/handlers/errors/stackTraceReferenceError.ts +0 -13
- package/src/core/handlers/errors/stackTraceSyntaxError.ts +0 -12
- package/src/core/handlers/errors/stackTraceSystemError.ts +0 -14
- package/src/core/handlers/errors/stackTraceTypeError.ts +0 -13
- package/src/core/handlers/errors/stackTraceURIError.ts +0 -13
- package/src/core/utils/modulesLoaded.utils.ts +0 -16
- package/src/domains/constants/errorName.constant.ts +0 -12
- package/src/domains/constants/event.constant.ts +0 -15
- package/src/domains/constants/eventNameError.constant.ts +0 -8
- package/src/domains/constants/httpStatusCodes.constant.ts +0 -375
- package/src/domains/constants/logLevel.constant.ts +0 -6
- package/src/domains/env/access.env.ts +0 -23
- package/src/domains/interfaces/envVariables.interface.ts +0 -16
- package/src/domains/interfaces/kernelModule.interface.ts +0 -6
- package/src/infrastructure/events/.gitkeep +0 -0
- package/src/infrastructure/handlers/.gitkeep +0 -0
- package/src/presentation/middleware/.gitkeep +0 -0
- /package/src/core/{errors → events}/.gitkeep +0 -0
- /package/src/core/{utils → helpers}/dateTimeFormatted.utils.ts +0 -0
package/dist/index.cjs
CHANGED
|
@@ -30,609 +30,124 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
WebServer: () => WebServerCore
|
|
34
|
-
errorName: () => CErrorName,
|
|
35
|
-
event: () => CEvent,
|
|
36
|
-
eventName: () => CEventNameError,
|
|
37
|
-
getEnvVariable: () => getEnvVariable
|
|
33
|
+
WebServer: () => WebServerCore
|
|
38
34
|
});
|
|
39
35
|
module.exports = __toCommonJS(index_exports);
|
|
40
36
|
|
|
41
37
|
// src/core/webServer.core.ts
|
|
42
|
-
var import_express2 = __toESM(require("express"), 1);
|
|
43
38
|
var import_cors = __toESM(require("cors"), 1);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
appHost: String((_b = (_a = import_dotenv.default.config()) == null ? void 0 : _a.parsed) == null ? void 0 : _b.APP_HOST),
|
|
50
|
-
appPort: String((_d = (_c = import_dotenv.default.config()) == null ? void 0 : _c.parsed) == null ? void 0 : _d.APP_PORT),
|
|
51
|
-
prodEnv: String((_f = (_e = import_dotenv.default.config()) == null ? void 0 : _e.parsed) == null ? void 0 : _f.ENV_PROD),
|
|
52
|
-
devEnv: String((_h = (_g = import_dotenv.default.config()) == null ? void 0 : _g.parsed) == null ? void 0 : _h.ENV_DEV),
|
|
53
|
-
dataBaseHost: String((_j = (_i = import_dotenv.default.config()) == null ? void 0 : _i.parsed) == null ? void 0 : _j.DATA_BASE_HOST),
|
|
54
|
-
dataBasePort: String((_l = (_k = import_dotenv.default.config()) == null ? void 0 : _k.parsed) == null ? void 0 : _l.DATA_BASE_PORT),
|
|
55
|
-
dataBaseUser: String((_n = (_m = import_dotenv.default.config()) == null ? void 0 : _m.parsed) == null ? void 0 : _n.DATA_BASE_USER),
|
|
56
|
-
dataBasePassword: String((_p = (_o = import_dotenv.default.config()) == null ? void 0 : _o.parsed) == null ? void 0 : _p.DATA_BASE_PASSWORD),
|
|
57
|
-
dataBaseName: String((_r = (_q = import_dotenv.default.config()) == null ? void 0 : _q.parsed) == null ? void 0 : _r.DATA_BASE_NAME),
|
|
58
|
-
apiVersion: String((_t = (_s = import_dotenv.default.config()) == null ? void 0 : _s.parsed) == null ? void 0 : _t.API_VERSION),
|
|
59
|
-
usernameField: String((_v = (_u = import_dotenv.default.config()) == null ? void 0 : _u.parsed) == null ? void 0 : _v.USERNAME_FIELD),
|
|
60
|
-
passwordField: String((_x = (_w = import_dotenv.default.config()) == null ? void 0 : _w.parsed) == null ? void 0 : _x.PASSWORD_FIELD),
|
|
61
|
-
argumentsDatabaseConnection: String((_z = (_y = import_dotenv.default.config()) == null ? void 0 : _y.parsed) == null ? void 0 : _z.ARGUMENTS_DATABASE_CONNECTION),
|
|
62
|
-
logEnv: String((_B = (_A = import_dotenv.default.config()) == null ? void 0 : _A.parsed) == null ? void 0 : _B.LOG_ENVIRONMENT)
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
// src/core/handlers/errors/base/stackTraceError.ts
|
|
66
|
-
var StackTraceError = class extends Error {
|
|
67
|
-
// Centralized error objet that derives from Node's Error.
|
|
68
|
-
constructor(props, name, httpCode, isOperational) {
|
|
69
|
-
super(props);
|
|
70
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
71
|
-
this.name = name;
|
|
72
|
-
this.httpCode = httpCode;
|
|
73
|
-
this.isOperational = isOperational;
|
|
74
|
-
Error.captureStackTrace(this);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
39
|
+
var import_opticore_catch_exception_error3 = require("opticore-catch-exception-error");
|
|
40
|
+
var import_opticore_express2 = require("opticore-express");
|
|
41
|
+
var import_opticore_env_access = require("opticore-env-access");
|
|
42
|
+
var import_opticore_requests_called_events = require("opticore-requests-called-events");
|
|
43
|
+
var import_opticore_http_response2 = require("opticore-http-response");
|
|
77
44
|
|
|
78
45
|
// src/core/handlers/eventProcess.handler.ts
|
|
79
|
-
var import_express = __toESM(require("express"), 1);
|
|
80
46
|
var import_node_process = __toESM(require("process"), 1);
|
|
81
47
|
var import_node_events = __toESM(require("events"), 1);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
var import_process = __toESM(require("process"), 1);
|
|
85
|
-
var import_ansi_colors2 = __toESM(require("ansi-colors"), 1);
|
|
86
|
-
var import_chalk = __toESM(require("chalk"), 1);
|
|
87
|
-
|
|
88
|
-
// src/core/utils/dateTimeFormatted.utils.ts
|
|
89
|
-
var dateTimeFormattedUtils = `${(/* @__PURE__ */ new Date()).getMonth()}-${(/* @__PURE__ */ new Date()).getDate()}-${(/* @__PURE__ */ new Date()).getFullYear()} ${(/* @__PURE__ */ new Date()).getHours()}:${(/* @__PURE__ */ new Date()).getMinutes()}:${(/* @__PURE__ */ new Date()).getSeconds()}`;
|
|
90
|
-
|
|
91
|
-
// src/application/exceptions/messages.exception.ts
|
|
92
|
-
var import_ansi_colors = __toESM(require("ansi-colors"), 1);
|
|
93
|
-
var messageException = {
|
|
94
|
-
dbConnection: "DataBase connection",
|
|
95
|
-
dbConnectionClosed: "MySQL connection is closed",
|
|
96
|
-
mysqlErrorCon: "MysqlError connection",
|
|
97
|
-
mySQLError: "MysqlError",
|
|
98
|
-
mySqlCloseConnection: "MySql close connection",
|
|
99
|
-
verifyExistingKey: "Verify Existing Key",
|
|
100
|
-
invalidRequest: "Invalid request",
|
|
101
|
-
tokenNotProvided: "No token provided.",
|
|
102
|
-
ExpiresToken: "Expires Token. You're not authorize",
|
|
103
|
-
privateKeyNotExist: "A private key doesn't exist.",
|
|
104
|
-
publicKeyNotExist: "A public key doesn't exist.",
|
|
105
|
-
errorNamePublicKeyNotExist: "No public key",
|
|
106
|
-
errorAuthorPublicKeyNotExist: "PublicKey not existing",
|
|
107
|
-
errorDecryption: "Error decryption with private key",
|
|
108
|
-
rsaKeyNotFound: "RSA key provided is not found.",
|
|
109
|
-
notVerifyingRSAKey: "Not verify RSA Key",
|
|
110
|
-
errorNameNotVerifyingRSAKey: "Error Verify RSA Key",
|
|
111
|
-
errorEncryptionPublicKey: "Error encryption with public key",
|
|
112
|
-
errorEncryptionPrivateKey: "Error encryption with private key",
|
|
113
|
-
errorNameRsaVerifyExistingKey: "Verify existing key",
|
|
114
|
-
signatureRSAKeyFailed: "Signature verification failed.",
|
|
115
|
-
encryptionWithPrivateKeyFailed: "Encryption With PrivateKey",
|
|
116
|
-
encryptionFailed: "Encryption failed",
|
|
117
|
-
decryptionWithPublicKeyFailed: "Decryption With PublicKey",
|
|
118
|
-
decryptionFailed: "Decryption failed",
|
|
119
|
-
verifyRSAKey: "Verify RSA Keys",
|
|
120
|
-
verifyRSAKeyFailed: "Verify RSA Keys Failed",
|
|
121
|
-
notVerifying: "Verification failed",
|
|
122
|
-
signatureRSAKeysError: "Signature RSA Keys Error",
|
|
123
|
-
encryptionWithPublicKey: "Encryption error",
|
|
124
|
-
errorDecryptionWithPrivateKey: "Error Decryption With PrivateKey",
|
|
125
|
-
verifyPublicRSAKey: "Verify Public RSA Key",
|
|
126
|
-
PostgresDBConnectionChecker: "PostgresDB Connection Checker",
|
|
127
|
-
PostgresConnection: "connection",
|
|
128
|
-
MongoDBConnectionChecker: "MongoDB Connection Checker",
|
|
129
|
-
MongoConnection: "connection",
|
|
130
|
-
mongoDBAuthentication: "authentication",
|
|
131
|
-
mongoDBConnection: "MongoDB connection",
|
|
132
|
-
mongoDBAuthenticationFailed: "failed",
|
|
133
|
-
mongoDBUnableParsingUrl: "unable to parse",
|
|
134
|
-
mongoDBConnectionUrl: "url",
|
|
135
|
-
mongoDBServerSelection: "MongoServer selection error",
|
|
136
|
-
mongoDBServer: "MongoServer",
|
|
137
|
-
mongoDBConnectionError: "connection error",
|
|
138
|
-
mongoDBError: "error",
|
|
139
|
-
loadedModules: "Loading core modules",
|
|
140
|
-
loadedModulesError: "Required core modules are not loaded properly",
|
|
141
|
-
dbConnexionSuccess: "The database connection was successful \u{1F680}",
|
|
142
|
-
mongoConnectionSuccess: "Connection to database is successfully.",
|
|
143
|
-
PostgresConnectionSuccess: "Connection to database is successfully.",
|
|
144
|
-
verifyExistingKeyError: "The provided key is not found",
|
|
145
|
-
webServer: "Web server",
|
|
146
|
-
listening: "listening",
|
|
147
|
-
webHost: "host",
|
|
148
|
-
badHost: "bad host",
|
|
149
|
-
hostNotFound: "not found",
|
|
150
|
-
errorHostUrl: "The host and port are not define, please define them in .env",
|
|
151
|
-
badPort: "bad port",
|
|
152
|
-
errorPort: "The port is not correct. Please define a right port with number port.",
|
|
153
|
-
errorHost: "The host can't be empty or blank. Please define a string host in .env",
|
|
154
|
-
accessDeniedToDBCon: (user, password) => `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`,
|
|
155
|
-
unknownDB: (database) => `Database ${database} is unknown. Please try to use Database CLI to create your database, or do it manually in your Database Management System`,
|
|
156
|
-
errorDBHost: (host) => `A database host ${host} does not allow connection. Please either set the host like this: ${import_ansi_colors.default.bgRed(`${import_ansi_colors.default.white(`localhost`)}`)} in your .env file`
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
// src/domains/constants/eventNameError.constant.ts
|
|
160
|
-
var CEventNameError = {
|
|
161
|
-
error: "error",
|
|
162
|
-
listening: "listening",
|
|
163
|
-
close: "close",
|
|
164
|
-
connection: "connection",
|
|
165
|
-
drop: "drop",
|
|
166
|
-
request: "request"
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
// src/core/events/errors/serverListen.event.error.ts
|
|
170
|
-
var import_opticore_logger = require("opticore-logger");
|
|
171
|
-
var ServerListenEventError = class {
|
|
172
|
-
/**
|
|
173
|
-
*
|
|
174
|
-
*/
|
|
175
|
-
static hostPortUndefined() {
|
|
176
|
-
this.stackTrace = this.traceError(messageException.errorHostUrl, messageException.listening, 400 /* BAD_REQUEST */);
|
|
177
|
-
this.logger.error(this.stackTrace.message, messageException.webServer, messageException.badHost, this.stackTrace.stack, 400 /* BAD_REQUEST */);
|
|
178
|
-
import_process.default.exit();
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
*
|
|
182
|
-
*/
|
|
183
|
-
static hostUndefined() {
|
|
184
|
-
this.stackTrace = this.traceError(messageException.badHost, messageException.listening, 400 /* BAD_REQUEST */);
|
|
185
|
-
this.logger.error(this.stackTrace.message, messageException.webServer, messageException.badHost, this.stackTrace.stack, 400 /* BAD_REQUEST */);
|
|
186
|
-
import_process.default.exit();
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
*
|
|
190
|
-
*/
|
|
191
|
-
static portUndefined() {
|
|
192
|
-
this.stackTrace = this.traceError(messageException.badPort, messageException.listening, 400 /* BAD_REQUEST */);
|
|
193
|
-
this.logger.error(this.stackTrace.message, messageException.webServer, messageException.badHost, this.stackTrace.stack, 400 /* BAD_REQUEST */);
|
|
194
|
-
import_process.default.exit();
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
*
|
|
198
|
-
* @param err
|
|
199
|
-
*/
|
|
200
|
-
static onEventError(err) {
|
|
201
|
-
this.logger.error(err.message, "Server start error", "Error", err.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
*
|
|
205
|
-
* @param error
|
|
206
|
-
*/
|
|
207
|
-
static listenerError(error) {
|
|
208
|
-
this.stackTrace = this.traceError(error.message, error.name, 400 /* BAD_REQUEST */);
|
|
209
|
-
this.logger.error(this.stackTrace.message, "Event error", "Error", error.stack, 400 /* BAD_REQUEST */);
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
*
|
|
213
|
-
* @param code
|
|
214
|
-
*/
|
|
215
|
-
static processBeforeExit(code) {
|
|
216
|
-
this.stackTrace = this.traceError(`Process will exit with code: ${code}`, "BeforeExit", 503 /* SERVICE_UNAVAILABLE */);
|
|
217
|
-
this.logger.error(this.stackTrace.message, "BeforeExit", "process before exit", this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
218
|
-
import_process.default.exit(code);
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
*
|
|
222
|
-
*/
|
|
223
|
-
static processDisconnected() {
|
|
224
|
-
this.stackTrace = this.traceError("Child process disconnected", "process disconnected", 503 /* SERVICE_UNAVAILABLE */);
|
|
225
|
-
this.logger.error(this.stackTrace.message, "Disconnected", "process disconnected", this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
226
|
-
import_process.default.exit();
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
*
|
|
230
|
-
* @param code
|
|
231
|
-
*/
|
|
232
|
-
static exited(code) {
|
|
233
|
-
switch (code) {
|
|
234
|
-
case 0:
|
|
235
|
-
this.logger.success("completed", "The process finished as expected and everything is ok");
|
|
236
|
-
console.log("");
|
|
237
|
-
const paddingLength = 35;
|
|
238
|
-
const msg0 = " ".padEnd(paddingLength, " ");
|
|
239
|
-
console.log(import_chalk.default.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
240
|
-
console.log(`${import_ansi_colors2.default.bgGreen(` [OK] The server shutting down `)}`);
|
|
241
|
-
console.log(import_chalk.default.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
242
|
-
break;
|
|
243
|
-
case 1:
|
|
244
|
-
this.stackTrace = this.traceError("Something went wrong", "General Errors", 503 /* SERVICE_UNAVAILABLE */);
|
|
245
|
-
this.logger.error(this.stackTrace.message, "Exited", "General Errors", this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
246
|
-
break;
|
|
247
|
-
case 2:
|
|
248
|
-
this.stackTrace = this.traceError("Incorrect using of shell commands", "Misuse of shell builtins", 503 /* SERVICE_UNAVAILABLE */);
|
|
249
|
-
this.logger.error(this.stackTrace.message, "Exited", "Incorrect using of shell commands", this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
250
|
-
break;
|
|
251
|
-
case 126:
|
|
252
|
-
this.stackTrace = this.traceError(
|
|
253
|
-
"Incorrect using of shell commands",
|
|
254
|
-
"The command is found but is not executable (e.g., trying to execute a directory)",
|
|
255
|
-
503 /* SERVICE_UNAVAILABLE */
|
|
256
|
-
);
|
|
257
|
-
this.logger.error(this.stackTrace.message, "Exited", this.stackTrace.name, this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
258
|
-
break;
|
|
259
|
-
case 127:
|
|
260
|
-
this.stackTrace = this.traceError(
|
|
261
|
-
"Command not found",
|
|
262
|
-
"The command was not found in the system's PATH or is misspelled",
|
|
263
|
-
503 /* SERVICE_UNAVAILABLE */
|
|
264
|
-
);
|
|
265
|
-
this.logger.error(this.stackTrace.message, "Exited", this.stackTrace.name, this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
266
|
-
break;
|
|
267
|
-
case 128:
|
|
268
|
-
this.stackTrace = this.traceError(
|
|
269
|
-
"The command was not found in the system's PATH or is misspelled",
|
|
270
|
-
"Invalid argument",
|
|
271
|
-
503 /* SERVICE_UNAVAILABLE */
|
|
272
|
-
);
|
|
273
|
-
this.logger.error(this.stackTrace.message, "Exited", this.stackTrace.name, this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
274
|
-
break;
|
|
275
|
-
case 130:
|
|
276
|
-
this.stackTrace = this.traceError(
|
|
277
|
-
"Indicates that the script was manually terminated by the user using the Control-C (SIGINT) signal",
|
|
278
|
-
"Script terminated",
|
|
279
|
-
503 /* SERVICE_UNAVAILABLE */
|
|
280
|
-
);
|
|
281
|
-
this.logger.error(this.stackTrace.message, "Exited", this.stackTrace.name, this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
282
|
-
break;
|
|
283
|
-
case 137:
|
|
284
|
-
this.stackTrace = this.traceError(
|
|
285
|
-
"Indicates that the process was terminated by a SIGKILL signal, possibly due to an out-of-memory situation",
|
|
286
|
-
"SIGKILL",
|
|
287
|
-
503 /* SERVICE_UNAVAILABLE */
|
|
288
|
-
);
|
|
289
|
-
this.logger.error(this.stackTrace.message, "Exited", this.stackTrace.name, this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
290
|
-
break;
|
|
291
|
-
case 139:
|
|
292
|
-
this.stackTrace = this.traceError(
|
|
293
|
-
"Indicates that the process accessed an illegal memory address (segfault)",
|
|
294
|
-
"Segmentation fault",
|
|
295
|
-
503 /* SERVICE_UNAVAILABLE */
|
|
296
|
-
);
|
|
297
|
-
this.logger.error(this.stackTrace.message, "Exited", this.stackTrace.name, this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
298
|
-
break;
|
|
299
|
-
case 143:
|
|
300
|
-
this.stackTrace = this.traceError(
|
|
301
|
-
"Indicates that the process received a SIGTERM signal to terminate",
|
|
302
|
-
"process received a SIGTERM",
|
|
303
|
-
503 /* SERVICE_UNAVAILABLE */
|
|
304
|
-
);
|
|
305
|
-
this.logger.error(this.stackTrace.message, "Exited", this.stackTrace.name, this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
306
|
-
break;
|
|
307
|
-
case 255:
|
|
308
|
-
this.stackTrace = this.traceError(
|
|
309
|
-
"An exit code that is outside the allowable range (0-255 for Unix-like systems)",
|
|
310
|
-
"out of range",
|
|
311
|
-
503 /* SERVICE_UNAVAILABLE */
|
|
312
|
-
);
|
|
313
|
-
this.logger.error(this.stackTrace.message, "Exited", this.stackTrace.name, this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
314
|
-
break;
|
|
315
|
-
default:
|
|
316
|
-
this.stackTrace = this.traceError(
|
|
317
|
-
"Error is occurring",
|
|
318
|
-
"errors",
|
|
319
|
-
503 /* SERVICE_UNAVAILABLE */
|
|
320
|
-
);
|
|
321
|
-
this.logger.error(this.stackTrace.message, "Exited", this.stackTrace.name, this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
322
|
-
break;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
*
|
|
327
|
-
* @param promise
|
|
328
|
-
*/
|
|
329
|
-
static promiseRejectionHandled(promise) {
|
|
330
|
-
this.stackTrace = this.traceError(
|
|
331
|
-
`Promise rejection is handled at : ${promise}`,
|
|
332
|
-
"rejection promise",
|
|
333
|
-
503 /* SERVICE_UNAVAILABLE */
|
|
334
|
-
);
|
|
335
|
-
this.logger.error(this.stackTrace.message, "PromiseRejectionHandled", this.stackTrace.name, this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
*
|
|
339
|
-
* @param error
|
|
340
|
-
*/
|
|
341
|
-
static uncaughtException(error) {
|
|
342
|
-
if (error.message === "'app.router' is deprecated!\nPlease see the 3.x to 4.x migration guide for details on how to update your app.") {
|
|
343
|
-
console.log("");
|
|
344
|
-
} else {
|
|
345
|
-
this.stackTrace = this.traceError(error.message, "uncaught exception handled", 503 /* SERVICE_UNAVAILABLE */);
|
|
346
|
-
this.logger.error(this.stackTrace.message, "UncaughtException", this.stackTrace.name, this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
*
|
|
351
|
-
* @param error
|
|
352
|
-
*/
|
|
353
|
-
static uncaughtExceptionMonitor(error) {
|
|
354
|
-
if (error.message === "'app.router' is deprecated!\nPlease see the 3.x to 4.x migration guide for details on how to update your app.") {
|
|
355
|
-
console.log("");
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
*
|
|
360
|
-
* @param reason
|
|
361
|
-
* @param promise
|
|
362
|
-
*/
|
|
363
|
-
static unhandledRejection(reason, promise) {
|
|
364
|
-
this.stackTrace = this.traceError(
|
|
365
|
-
`Unhandled Rejection at: Promise ${promise} -- reason ${reason}`,
|
|
366
|
-
"Unhandled rejection",
|
|
367
|
-
503 /* SERVICE_UNAVAILABLE */
|
|
368
|
-
);
|
|
369
|
-
this.logger.error(this.stackTrace.message, "UnhandledRejection", this.stackTrace.name, this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
*
|
|
373
|
-
* @param warning
|
|
374
|
-
*/
|
|
375
|
-
static warning(warning) {
|
|
376
|
-
this.stackTrace = this.traceError(warning.message, "warning", 503 /* SERVICE_UNAVAILABLE */);
|
|
377
|
-
this.logger.error(this.stackTrace.message, "Warning", this.stackTrace.name, this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
*
|
|
381
|
-
* @param message
|
|
382
|
-
*/
|
|
383
|
-
static message(message) {
|
|
384
|
-
this.stackTrace = this.traceError(
|
|
385
|
-
`process got message ${message}`,
|
|
386
|
-
"message exception",
|
|
387
|
-
503 /* SERVICE_UNAVAILABLE */
|
|
388
|
-
);
|
|
389
|
-
this.logger.error(this.stackTrace.message, "Message", this.stackTrace.name, this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
*
|
|
393
|
-
* @param type
|
|
394
|
-
* @param promise
|
|
395
|
-
* @param reason
|
|
396
|
-
*/
|
|
397
|
-
static multipleResolves(type, promise, reason) {
|
|
398
|
-
this.stackTrace = this.traceError(
|
|
399
|
-
`${promise} -- ${reason}`,
|
|
400
|
-
`Multiple resolves detected : ${type}`,
|
|
401
|
-
503 /* SERVICE_UNAVAILABLE */
|
|
402
|
-
);
|
|
403
|
-
this.logger.error(this.stackTrace.message, "multipleResolves", this.stackTrace.name, this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
*
|
|
407
|
-
*/
|
|
408
|
-
static processInterrupted() {
|
|
409
|
-
this.logger.success("[ OK ] Success", "The Web server has been stopped !");
|
|
410
|
-
import_process.default.exit(0);
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
|
-
*
|
|
414
|
-
* @param signal
|
|
415
|
-
*/
|
|
416
|
-
static sigtermSignalReceived(signal) {
|
|
417
|
-
this.stackTrace = this.traceError(
|
|
418
|
-
`Process ${import_process.default.pid} received a SIGTERM signal : ${signal.toString()}`,
|
|
419
|
-
"SIGTERM",
|
|
420
|
-
406 /* NOT_ACCEPTABLE */
|
|
421
|
-
);
|
|
422
|
-
this.logger.error(this.stackTrace.message, "SIGTERM", this.stackTrace.name, this.stackTrace.stack, 406 /* NOT_ACCEPTABLE */);
|
|
423
|
-
import_process.default.exit(0);
|
|
424
|
-
}
|
|
425
|
-
/**
|
|
426
|
-
*
|
|
427
|
-
*/
|
|
428
|
-
static serverClosing() {
|
|
429
|
-
console.log(`${import_ansi_colors2.default.bgCyanBright(` ${import_ansi_colors2.default.bold(`${import_ansi_colors2.default.white(` INFO `)}`)}`)} All processes are stopped`);
|
|
430
|
-
console.log(" Server is closed");
|
|
431
|
-
import_process.default.exit();
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
*
|
|
435
|
-
*/
|
|
436
|
-
static dropNewConnection() {
|
|
437
|
-
console.log(`${import_ansi_colors2.default.cyan(`\u24D8`)} ${import_ansi_colors2.default.bgCyan(` ${import_ansi_colors2.default.bold(`${import_ansi_colors2.default.white(` Server maxConnection `)}`)} `)} ${dateTimeFormattedUtils} | ${import_ansi_colors2.default.bgCyan(`${import_ansi_colors2.default.white(` Info `)}`)} The server dropped new connections`);
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
*
|
|
441
|
-
* @param errorEmitter
|
|
442
|
-
* @param err
|
|
443
|
-
* @param req
|
|
444
|
-
* @param res
|
|
445
|
-
* @param next
|
|
446
|
-
*/
|
|
447
|
-
static expressErrorHandlingMiddleware(errorEmitter, err, req, res, next) {
|
|
448
|
-
if (err) {
|
|
449
|
-
errorEmitter.emit(CEventNameError.error, err);
|
|
450
|
-
if (typeof res.status === "function") {
|
|
451
|
-
res.status(500).send("Internal Server Error");
|
|
452
|
-
} else {
|
|
453
|
-
console.error("res.status is not a function");
|
|
454
|
-
}
|
|
455
|
-
this.stackTrace = this.traceError(err.message, "Express error", 406 /* NOT_ACCEPTABLE */);
|
|
456
|
-
this.logger.error(this.stackTrace.message, "Express error-handling middleware", this.stackTrace.name, this.stackTrace.stack, 503 /* SERVICE_UNAVAILABLE */);
|
|
457
|
-
} else {
|
|
458
|
-
next();
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
static traceError(props, name, status) {
|
|
462
|
-
return new StackTraceError(props, name, status, true);
|
|
463
|
-
}
|
|
464
|
-
};
|
|
465
|
-
ServerListenEventError.logger = new import_opticore_logger.LoggerCore();
|
|
466
|
-
|
|
467
|
-
// src/core/handlers/eventProcess.handler.ts
|
|
48
|
+
var import_opticore_express = require("opticore-express");
|
|
49
|
+
var import_opticore_catch_exception_error = require("opticore-catch-exception-error");
|
|
468
50
|
function eventProcessHandler() {
|
|
469
51
|
const errorEmitter = new import_node_events.default();
|
|
470
|
-
const app = (0,
|
|
471
|
-
errorEmitter.on(CEventNameError.error, (error) => {
|
|
472
|
-
ServerListenEventError.listenerError(error);
|
|
52
|
+
const app = (0, import_opticore_express.express)();
|
|
53
|
+
errorEmitter.on(import_opticore_catch_exception_error.CEventNameError.error, (error) => {
|
|
54
|
+
import_opticore_catch_exception_error.ServerListenEventError.listenerError(error);
|
|
473
55
|
});
|
|
474
|
-
import_node_process.default.on(CEvent.beforeExit, (code) => {
|
|
56
|
+
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.beforeExit, (code) => {
|
|
475
57
|
setTimeout(() => {
|
|
476
|
-
ServerListenEventError.processBeforeExit(code);
|
|
58
|
+
import_opticore_catch_exception_error.ServerListenEventError.processBeforeExit(code);
|
|
477
59
|
}, 100);
|
|
478
60
|
});
|
|
479
|
-
import_node_process.default.on(CEvent.disconnect, () => {
|
|
480
|
-
ServerListenEventError.processDisconnected();
|
|
61
|
+
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.disconnect, () => {
|
|
62
|
+
import_opticore_catch_exception_error.ServerListenEventError.processDisconnected();
|
|
481
63
|
});
|
|
482
|
-
import_node_process.default.on(CEvent.exit, (code) => {
|
|
483
|
-
ServerListenEventError.exited(code);
|
|
64
|
+
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.exit, (code) => {
|
|
65
|
+
import_opticore_catch_exception_error.ServerListenEventError.exited(code);
|
|
484
66
|
});
|
|
485
|
-
import_node_process.default.on(CEvent.rejectionHandled, (promise) => {
|
|
486
|
-
ServerListenEventError.promiseRejectionHandled(promise);
|
|
67
|
+
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.rejectionHandled, (promise) => {
|
|
68
|
+
import_opticore_catch_exception_error.ServerListenEventError.promiseRejectionHandled(promise);
|
|
487
69
|
});
|
|
488
|
-
import_node_process.default.on(CEvent.uncaughtException, (error) => {
|
|
489
|
-
ServerListenEventError.uncaughtException(error);
|
|
70
|
+
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.uncaughtException, (error) => {
|
|
71
|
+
import_opticore_catch_exception_error.ServerListenEventError.uncaughtException(error);
|
|
490
72
|
});
|
|
491
|
-
import_node_process.default.on(CEvent.uncaughtExceptionMonitor, (error) => {
|
|
492
|
-
ServerListenEventError.uncaughtExceptionMonitor(error);
|
|
73
|
+
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.uncaughtExceptionMonitor, (error) => {
|
|
74
|
+
import_opticore_catch_exception_error.ServerListenEventError.uncaughtExceptionMonitor(error);
|
|
493
75
|
});
|
|
494
|
-
import_node_process.default.on(CEvent.unhandledRejection, (reason, promise) => {
|
|
495
|
-
ServerListenEventError.unhandledRejection(reason, promise);
|
|
76
|
+
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.unhandledRejection, (reason, promise) => {
|
|
77
|
+
import_opticore_catch_exception_error.ServerListenEventError.unhandledRejection(reason, promise);
|
|
496
78
|
});
|
|
497
|
-
import_node_process.default.on(CEvent.warning, (warning) => {
|
|
498
|
-
ServerListenEventError.warning(warning);
|
|
79
|
+
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.warning, (warning) => {
|
|
80
|
+
import_opticore_catch_exception_error.ServerListenEventError.warning(warning);
|
|
499
81
|
});
|
|
500
|
-
import_node_process.default.on(CEvent.message, (message) => {
|
|
501
|
-
ServerListenEventError.message(message);
|
|
82
|
+
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.message, (message) => {
|
|
83
|
+
import_opticore_catch_exception_error.ServerListenEventError.message(message);
|
|
502
84
|
});
|
|
503
|
-
import_node_process.default.on(CEvent.multipleResolves, (type, promise, reason) => {
|
|
504
|
-
ServerListenEventError.multipleResolves(type, promise, reason);
|
|
85
|
+
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.multipleResolves, (type, promise, reason) => {
|
|
86
|
+
import_opticore_catch_exception_error.ServerListenEventError.multipleResolves(type, promise, reason);
|
|
505
87
|
});
|
|
506
|
-
import_node_process.default.on(CEvent.sigint, () => {
|
|
507
|
-
ServerListenEventError.processInterrupted();
|
|
88
|
+
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.sigint, () => {
|
|
89
|
+
import_opticore_catch_exception_error.ServerListenEventError.processInterrupted();
|
|
508
90
|
});
|
|
509
|
-
import_node_process.default.on(CEvent.sigterm, (signal) => {
|
|
510
|
-
ServerListenEventError.sigtermSignalReceived(signal);
|
|
91
|
+
import_node_process.default.on(import_opticore_catch_exception_error.CEvent.sigterm, (signal) => {
|
|
92
|
+
import_opticore_catch_exception_error.ServerListenEventError.sigtermSignalReceived(signal);
|
|
511
93
|
});
|
|
512
94
|
app.use((err, req, res, next) => {
|
|
513
|
-
ServerListenEventError.expressErrorHandlingMiddleware(errorEmitter, err, req, res, next);
|
|
95
|
+
import_opticore_catch_exception_error.ServerListenEventError.expressErrorHandlingMiddleware(errorEmitter, err, req, res, next);
|
|
514
96
|
});
|
|
515
97
|
}
|
|
516
98
|
|
|
517
|
-
// src/core/events/requestCalls.event.ts
|
|
518
|
-
var import_ansi_colors3 = __toESM(require("ansi-colors"), 1);
|
|
519
|
-
var import_opticore_logger2 = require("opticore-logger");
|
|
520
|
-
function requestCallsEvent(req, res, host, port, loadingTime) {
|
|
521
|
-
const logger = new import_opticore_logger2.LoggerCore();
|
|
522
|
-
const currentDatePath = `Request called`;
|
|
523
|
-
if (req.originalUrl === "undefined") {
|
|
524
|
-
console.log(`[ ${import_ansi_colors3.default.red(`${currentDatePath}`)} ] ${loadingTime} | ${import_ansi_colors3.default.bgRed(`${import_ansi_colors3.default.white(` Not found `)}`)} [ Host ] http://${host}:${port} - [ Route ] The route do not exist. - [ Status ] ${import_ansi_colors3.default.red(`${import_ansi_colors3.default.white(` 404 `)}`)}`);
|
|
525
|
-
logger.error("The route do not exist.");
|
|
526
|
-
} else {
|
|
527
|
-
switch (res.statusCode) {
|
|
528
|
-
case 200:
|
|
529
|
-
switch (req.method) {
|
|
530
|
-
case "POST":
|
|
531
|
-
logger.info(`[ ${import_ansi_colors3.default.cyan(`${currentDatePath}`)} ] ${loadingTime} | ${import_ansi_colors3.default.bgGreen(`${import_ansi_colors3.default.white(` Success `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ Status ] ${import_ansi_colors3.default.bgCyan(`${import_ansi_colors3.default.white(` 200 `)}`)}`);
|
|
532
|
-
break;
|
|
533
|
-
case "GET":
|
|
534
|
-
case "PUT":
|
|
535
|
-
logger.info(`[ ${import_ansi_colors3.default.cyan(`${currentDatePath}`)} ] ${loadingTime} | ${import_ansi_colors3.default.bgGreen(`${import_ansi_colors3.default.white(` Success `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ query ] ${JSON.stringify(req.query)} - [ params ] ${JSON.stringify(req.params)} - [ Status ] ${import_ansi_colors3.default.bgCyan(`${import_ansi_colors3.default.white(` 200 `)}`)}`);
|
|
536
|
-
break;
|
|
537
|
-
case "DELETE":
|
|
538
|
-
logger.info(`[ ${import_ansi_colors3.default.cyan(`${currentDatePath}`)} ] ${loadingTime} | ${import_ansi_colors3.default.bgGreen(`${import_ansi_colors3.default.white(` Success `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ query ] ${JSON.stringify(req.query)} - [ params ] ${JSON.stringify(req.params)} - [ Status ] ${import_ansi_colors3.default.bgCyan(`${import_ansi_colors3.default.white(` 200 `)}`)}`);
|
|
539
|
-
break;
|
|
540
|
-
}
|
|
541
|
-
break;
|
|
542
|
-
case 404:
|
|
543
|
-
switch (req.method) {
|
|
544
|
-
case "POST":
|
|
545
|
-
console.log(`[ ${import_ansi_colors3.default.red(`${currentDatePath}`)} ] ${loadingTime} | ${import_ansi_colors3.default.bgRed(`${import_ansi_colors3.default.white(` Not found `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ Status ] ${import_ansi_colors3.default.red(`${import_ansi_colors3.default.white(` 404 `)}`)}`);
|
|
546
|
-
break;
|
|
547
|
-
case "GET":
|
|
548
|
-
console.log(`[ ${import_ansi_colors3.default.red(`${currentDatePath}`)} ] ${loadingTime} | ${import_ansi_colors3.default.bgRed(`${import_ansi_colors3.default.white(` Not found `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ query ] ${JSON.stringify(req.query)} - [ params ] ${JSON.stringify(req.params)} - [ Status ] ${import_ansi_colors3.default.red(`${import_ansi_colors3.default.bold(` 404 `)}`)}`);
|
|
549
|
-
break;
|
|
550
|
-
case "PUT":
|
|
551
|
-
console.log(`[ ${import_ansi_colors3.default.red(`${currentDatePath}`)} ] ${loadingTime} | ${import_ansi_colors3.default.bgRed(`${import_ansi_colors3.default.white(` Not found `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ query ] ${JSON.stringify(req.query)} - [ params ] ${JSON.stringify(req.params)} - [ Status ] ${import_ansi_colors3.default.red(`${import_ansi_colors3.default.bold(` 404 `)}`)}`);
|
|
552
|
-
break;
|
|
553
|
-
case "DELETE":
|
|
554
|
-
console.log(`[ ${import_ansi_colors3.default.red(`${currentDatePath}`)} ] ${loadingTime} | ${import_ansi_colors3.default.bgRed(`${import_ansi_colors3.default.white(` Not found `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ query ] ${JSON.stringify(req.query)} - [ params ] ${JSON.stringify(req.params)} - [ Status ] ${import_ansi_colors3.default.red(`${import_ansi_colors3.default.bold(` 404 `)}`)}`);
|
|
555
|
-
break;
|
|
556
|
-
}
|
|
557
|
-
break;
|
|
558
|
-
case 401:
|
|
559
|
-
switch (req.method) {
|
|
560
|
-
case "POST":
|
|
561
|
-
console.log(`[ ${import_ansi_colors3.default.yellowBright(`${currentDatePath}`)} ] ${loadingTime} | ${import_ansi_colors3.default.bgYellowBright(`${import_ansi_colors3.default.white(` Unauthorized `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ Status ] ${import_ansi_colors3.default.bgYellow(`${import_ansi_colors3.default.bold(` 401 `)}`)}`);
|
|
562
|
-
break;
|
|
563
|
-
case "GET":
|
|
564
|
-
console.log(`[ ${import_ansi_colors3.default.yellowBright(`${currentDatePath}`)} ] ${loadingTime} | ${import_ansi_colors3.default.bgYellowBright(`${import_ansi_colors3.default.white(` Unauthorized `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ Status ] ${import_ansi_colors3.default.bgYellow(`${import_ansi_colors3.default.bold(` 401 `)}`)}`);
|
|
565
|
-
break;
|
|
566
|
-
case "PUT":
|
|
567
|
-
console.log(`[ ${import_ansi_colors3.default.yellowBright(`${currentDatePath}`)} ] ${loadingTime} | ${import_ansi_colors3.default.bgYellowBright(`${import_ansi_colors3.default.white(` Unauthorized `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ Status ] ${import_ansi_colors3.default.bgYellow(`${import_ansi_colors3.default.bold(` 401 `)}`)}`);
|
|
568
|
-
break;
|
|
569
|
-
case "DELETE":
|
|
570
|
-
console.log(`[ ${import_ansi_colors3.default.yellowBright(`${currentDatePath}`)} ] ${loadingTime} | ${import_ansi_colors3.default.bgYellowBright(`${import_ansi_colors3.default.white(` Unauthorized `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ Status ] ${import_ansi_colors3.default.bgYellow(`${import_ansi_colors3.default.bold(` 401 `)}`)}`);
|
|
571
|
-
break;
|
|
572
|
-
}
|
|
573
|
-
break;
|
|
574
|
-
case 500:
|
|
575
|
-
switch (req.method) {
|
|
576
|
-
case "POST":
|
|
577
|
-
console.log(`[ ${import_ansi_colors3.default.red(`${currentDatePath}`)} ] ${loadingTime} | ${import_ansi_colors3.default.bgRed(`${import_ansi_colors3.default.white(` Server error `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ Status ] ${import_ansi_colors3.default.red(`${import_ansi_colors3.default.bold(` 500 `)}`)}`);
|
|
578
|
-
break;
|
|
579
|
-
case "GET":
|
|
580
|
-
console.log(`[ ${import_ansi_colors3.default.red(`${currentDatePath}`)} ] ${loadingTime} | ${import_ansi_colors3.default.bgRed(`${import_ansi_colors3.default.white(` Server error `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ query ] ${JSON.stringify(req.query)} - [ params ] ${JSON.stringify(req.params)} - [ Status ] ${import_ansi_colors3.default.red(`${import_ansi_colors3.default.bold(` 500 `)}`)}`);
|
|
581
|
-
break;
|
|
582
|
-
case "PUT":
|
|
583
|
-
console.log(`[ ${import_ansi_colors3.default.red(`${currentDatePath}`)} ] ${loadingTime} | ${import_ansi_colors3.default.bgRed(`${import_ansi_colors3.default.white(` Server error `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ query ] ${JSON.stringify(req.query)} - [ params ] ${JSON.stringify(req.params)} - [ Status ] ${import_ansi_colors3.default.red(`${import_ansi_colors3.default.bold(` 500 `)}`)}`);
|
|
584
|
-
break;
|
|
585
|
-
case "DELETE":
|
|
586
|
-
console.log(`[ ${import_ansi_colors3.default.red(`${currentDatePath}`)} ] ${loadingTime} | ${import_ansi_colors3.default.bgRed(`${import_ansi_colors3.default.white(` Server error `)}`)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ query ] ${JSON.stringify(req.query)} - [ params ] ${JSON.stringify(req.params)} - [ Status ] ${import_ansi_colors3.default.red(`${import_ansi_colors3.default.bold(` 500 `)}`)}`);
|
|
587
|
-
break;
|
|
588
|
-
}
|
|
589
|
-
break;
|
|
590
|
-
default:
|
|
591
|
-
console.log(`[ ${import_ansi_colors3.default.blueBright(`${currentDatePath}`)} ] ${loadingTime} | ${import_ansi_colors3.default.blueBright(` ${res.statusMessage} `)} [ Host ] http://${host}:${port} - [ Route ] ${req.originalUrl} - [ Status ] ${import_ansi_colors3.default.blueBright(` ${res.req.socket._httpMessage.statusCode} `)}`);
|
|
592
|
-
break;
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
|
|
597
99
|
// src/application/service/core.service.ts
|
|
598
100
|
var import_node_process2 = __toESM(require("process"), 1);
|
|
599
|
-
var
|
|
101
|
+
var import_chalk = __toESM(require("chalk"), 1);
|
|
600
102
|
var path = __toESM(require("path"), 1);
|
|
601
103
|
var fs = __toESM(require("fs"), 1);
|
|
602
|
-
var
|
|
104
|
+
var import_ansi_colors3 = __toESM(require("ansi-colors"), 1);
|
|
105
|
+
var import_opticore_http_response = require("opticore-http-response");
|
|
106
|
+
var import_opticore_catch_exception_error2 = require("opticore-catch-exception-error");
|
|
107
|
+
|
|
108
|
+
// src/core/helpers/modulesLoaded.utils.ts
|
|
109
|
+
var import_ansi_colors2 = __toESM(require("ansi-colors"), 1);
|
|
110
|
+
|
|
111
|
+
// src/core/helpers/logMessage.utils.ts
|
|
112
|
+
var import_ansi_colors = __toESM(require("ansi-colors"), 1);
|
|
603
113
|
|
|
604
|
-
// src/core/
|
|
605
|
-
var
|
|
114
|
+
// src/core/helpers/dateTimeFormatted.utils.ts
|
|
115
|
+
var dateTimeFormattedUtils = `${(/* @__PURE__ */ new Date()).getMonth()}-${(/* @__PURE__ */ new Date()).getDate()}-${(/* @__PURE__ */ new Date()).getFullYear()} ${(/* @__PURE__ */ new Date()).getHours()}:${(/* @__PURE__ */ new Date()).getMinutes()}:${(/* @__PURE__ */ new Date()).getSeconds()}`;
|
|
606
116
|
|
|
607
|
-
// src/core/
|
|
608
|
-
var import_ansi_colors4 = __toESM(require("ansi-colors"), 1);
|
|
117
|
+
// src/core/helpers/logMessage.utils.ts
|
|
609
118
|
var LogMessageUtils = class {
|
|
610
119
|
static success(title, action, contentAction) {
|
|
611
|
-
console.log(`${
|
|
120
|
+
console.log(`${import_ansi_colors.default.green(`\u2714`)} ${import_ansi_colors.default.bgGreen(` ${import_ansi_colors.default.bold(`${import_ansi_colors.default.white(`${title}`)}`)} `)} ${dateTimeFormattedUtils} | ${import_ansi_colors.default.bgGreen(`${import_ansi_colors.default.white(` Success `)}`)} [ ${action} ] ${contentAction} - [ Status ] ${import_ansi_colors.default.bgGreen(`${import_ansi_colors.default.white(` 200 `)}`)}`);
|
|
612
121
|
}
|
|
613
122
|
static warning(title, action, contentAction) {
|
|
614
|
-
console.warn(`${
|
|
123
|
+
console.warn(`${import_ansi_colors.default.yellow(`\u26A0\uFE0F`)} ${import_ansi_colors.default.bgYellow(` ${import_ansi_colors.default.bold(`${import_ansi_colors.default.white(`${title}`)}`)} `)} ${dateTimeFormattedUtils} | ${import_ansi_colors.default.bgYellow(`${import_ansi_colors.default.white(` Warning `)}`)} ${contentAction}`);
|
|
615
124
|
}
|
|
616
125
|
static info(title, action, contentAction) {
|
|
617
|
-
console.info(`${
|
|
126
|
+
console.info(`${import_ansi_colors.default.cyan(`\u24D8`)} ${import_ansi_colors.default.bgCyan(` ${import_ansi_colors.default.bold(`${import_ansi_colors.default.white(`${title}`)}`)} `)} ${dateTimeFormattedUtils} | ${import_ansi_colors.default.bgCyan(`${import_ansi_colors.default.white(` Info `)}`)} ${contentAction}`);
|
|
618
127
|
}
|
|
619
128
|
static error(title, errorType, stackTrace, messageContent, httpCodeValue) {
|
|
620
|
-
console.error(`${
|
|
129
|
+
console.error(`${import_ansi_colors.default.red(`\u2718`)} ${import_ansi_colors.default.bgRed(` ${import_ansi_colors.default.bold(`${import_ansi_colors.default.white(`${title}`)}`)} `)} | ${dateTimeFormattedUtils} | [ ${import_ansi_colors.default.red(`${import_ansi_colors.default.bold(` ${errorType} `)}`)} ] | [ ${import_ansi_colors.default.bold(`stack trace`)} ] ${import_ansi_colors.default.red(`${stackTrace}`)} - ${import_ansi_colors.default.red(`${messageContent}`)} - [ ${import_ansi_colors.default.red(`${import_ansi_colors.default.bold(` HttpCode `)}`)} ] ${import_ansi_colors.default.red(`${import_ansi_colors.default.bold(` ${httpCodeValue} `)}`)} `);
|
|
621
130
|
}
|
|
622
131
|
static requestError(title, errorName, errorMessage, errorCode) {
|
|
623
|
-
console.error(`[ ${
|
|
132
|
+
console.error(`[ ${import_ansi_colors.default.red(`${title}`)} ] ${dateTimeFormattedUtils} | ${import_ansi_colors.default.bgRed(`${import_ansi_colors.default.white(` ERROR `)}`)} ${import_ansi_colors.default.red(`[ ${errorName} ]`)} ${import_ansi_colors.default.red(`${errorMessage}`)} - [ Status ] ${import_ansi_colors.default.bgRed(`${import_ansi_colors.default.white(` ${errorCode} `)}`)}`);
|
|
624
133
|
}
|
|
625
134
|
};
|
|
626
135
|
|
|
627
|
-
// src/core/
|
|
136
|
+
// src/core/helpers/modulesLoaded.utils.ts
|
|
137
|
+
var import_opticore_translator = require("opticore-translator");
|
|
628
138
|
function modulesLoadedUtils(allAppRoutes, dbConChecker) {
|
|
629
|
-
LogMessageUtils.success(
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
139
|
+
LogMessageUtils.success(
|
|
140
|
+
`${import_opticore_translator.TranslationLoader.t("kernel", import_opticore_translator.CLocal)}`,
|
|
141
|
+
`${import_opticore_translator.TranslationLoader.t("loadKernel", import_opticore_translator.CLocal)}`,
|
|
142
|
+
`${import_opticore_translator.TranslationLoader.t("moduleAppLoaded", import_opticore_translator.CLocal)}`
|
|
143
|
+
);
|
|
144
|
+
console.log(`${import_ansi_colors2.default.whiteBright(` ${import_opticore_translator.TranslationLoader.t("content", import_opticore_translator.CLocal)}`)} ${import_ansi_colors2.default.green(`${import_opticore_translator.TranslationLoader.t("kernel", import_opticore_translator.CLocal)} :`)} ${import_ansi_colors2.default.cyan(`${import_ansi_colors2.default.bold(`${import_opticore_translator.TranslationLoader.t("serverSide", import_opticore_translator.CLocal)}`)}`)} ${import_opticore_translator.TranslationLoader.t("hasBeenLoadedSuccessfully", import_opticore_translator.CLocal)} ${import_ansi_colors2.default.green(`\u2714`)}`);
|
|
145
|
+
allAppRoutes ? console.log(`${import_ansi_colors2.default.whiteBright(` ${import_opticore_translator.TranslationLoader.t("content", import_opticore_translator.CLocal)}`)} ${import_ansi_colors2.default.green(`${import_opticore_translator.TranslationLoader.t("kernel", import_opticore_translator.CLocal)} :`)} ${import_ansi_colors2.default.cyan(`${import_ansi_colors2.default.bold(`${import_opticore_translator.TranslationLoader.t("routerService", import_opticore_translator.CLocal)}`)} `)} ${import_ansi_colors2.default.green(`\u2714`)}`) : console.log(`${import_ansi_colors2.default.red(`\u2718`)} ${import_ansi_colors2.default.bgRed(` ${import_ansi_colors2.default.bold(`${import_ansi_colors2.default.white(` ${import_opticore_translator.TranslationLoader.t("registerRoutes", import_opticore_translator.CLocal)} `)}`)} `)} | ${dateTimeFormattedUtils} | [ ${import_ansi_colors2.default.red(`${import_ansi_colors2.default.bold(` ${import_opticore_translator.TranslationLoader.t("fail", import_opticore_translator.CLocal)} `)}`)} ] | [ ${import_ansi_colors2.default.bold(` ${import_opticore_translator.TranslationLoader.t("loading", import_opticore_translator.CLocal)} `)} ] - ${import_ansi_colors2.default.red(` ${import_opticore_translator.TranslationLoader.t("routers", import_opticore_translator.CLocal)} `)} - ${import_opticore_translator.TranslationLoader.t("registerLoadingFailed", import_opticore_translator.CLocal)} `);
|
|
146
|
+
typeof dbConChecker == "function" ? console.log(`${import_ansi_colors2.default.whiteBright(` ${import_opticore_translator.TranslationLoader.t("content", import_opticore_translator.CLocal)}`)} ${import_ansi_colors2.default.green(`${import_opticore_translator.TranslationLoader.t("kernel", import_opticore_translator.CLocal)} :`)} ${import_ansi_colors2.default.cyan(`${import_ansi_colors2.default.bold(`${import_opticore_translator.TranslationLoader.t("dbConnChecker", import_opticore_translator.CLocal)}`)}`)} ${import_opticore_translator.TranslationLoader.t("hasBeenLoadedSuccessfully", import_opticore_translator.CLocal)} ${import_ansi_colors2.default.green(`\u2714`)}`) : "";
|
|
633
147
|
}
|
|
634
148
|
|
|
635
149
|
// src/application/service/core.service.ts
|
|
150
|
+
var import_opticore_translator2 = require("opticore-translator");
|
|
636
151
|
var CoreService = class {
|
|
637
152
|
/**
|
|
638
153
|
*
|
|
@@ -725,33 +240,33 @@ var CoreService = class {
|
|
|
725
240
|
this.getEnvFileLoading(".env");
|
|
726
241
|
const isDevelopment = import_node_process2.default.env.NODE_ENV === "development";
|
|
727
242
|
if (isDevelopment) {
|
|
728
|
-
return `The server is running in ${
|
|
243
|
+
return `The server is running in ${import_ansi_colors3.default.bgBlue(`${import_ansi_colors3.default.bold(`${development}`)}`)} mode`;
|
|
729
244
|
} else {
|
|
730
|
-
return `The server is running in ${
|
|
245
|
+
return `The server is running in ${import_ansi_colors3.default.bgBlue(`${import_ansi_colors3.default.bold(`${production}`)}`)} mode`;
|
|
731
246
|
}
|
|
732
247
|
}
|
|
733
248
|
infoServer(nodeVersion, startingTime, host, port, rss, heapUsed, user, system) {
|
|
734
249
|
const paddingLength = 52;
|
|
735
250
|
const msg0 = " ".padEnd(paddingLength, " ");
|
|
736
251
|
const msg1 = " [OK] Web server listening";
|
|
737
|
-
const msg2Value = `${
|
|
252
|
+
const msg2Value = `${import_ansi_colors3.default.bgBlue(`${import_ansi_colors3.default.bold(`${nodeVersion}`)}`)}`;
|
|
738
253
|
const msg2 = ` The Web server is using Node.js version`;
|
|
739
|
-
const msg3Value = `${
|
|
254
|
+
const msg3Value = `${import_ansi_colors3.default.bgBlue(`${import_ansi_colors3.default.bold(`${startingTime}`)}`)}`;
|
|
740
255
|
const msg3 = ` Startup time:`;
|
|
741
256
|
const msg4 = ` ${this.getServerRunningMode("development", "production")}`;
|
|
742
|
-
const msg5 = ` ${
|
|
743
|
-
console.log(
|
|
744
|
-
console.log(
|
|
745
|
-
console.log(
|
|
746
|
-
console.log(
|
|
747
|
-
console.log(
|
|
748
|
-
console.log(
|
|
749
|
-
console.log(
|
|
257
|
+
const msg5 = ` ${import_ansi_colors3.default.underline(`http://${host}:${port}`)}`;
|
|
258
|
+
console.log(import_chalk.default.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
259
|
+
console.log(import_chalk.default.bgGreen.white(msg1.padEnd(paddingLength, " ")));
|
|
260
|
+
console.log(import_chalk.default.bgGreen.white(msg2, msg2Value.padEnd(30.5, " ")));
|
|
261
|
+
console.log(import_chalk.default.bgGreen.white(msg3, msg3Value.padEnd(56, " ")));
|
|
262
|
+
console.log(import_chalk.default.bgGreen.white(msg4.padEnd(71, " ")));
|
|
263
|
+
console.log(import_chalk.default.bgGreen.white(msg5.padEnd(61, " ")));
|
|
264
|
+
console.log(import_chalk.default.bgGreen.white(msg0.padEnd(paddingLength, " ")));
|
|
750
265
|
console.log(``);
|
|
751
|
-
console.log(`${`Resident Set Size - total memory allocated for the process execution :`} ${
|
|
752
|
-
console.log(`${`Actual memory used during the execution :`} ${
|
|
753
|
-
console.log(`${`Memory usage by user :`} ${
|
|
754
|
-
console.log(`${`Memory usage by system :`} ${
|
|
266
|
+
console.log(`${`Resident Set Size - total memory allocated for the process execution :`} ${import_ansi_colors3.default.cyan(`${import_ansi_colors3.default.bold(`${rss}`)}`)}`);
|
|
267
|
+
console.log(`${`Actual memory used during the execution :`} ${import_ansi_colors3.default.cyan(`${import_ansi_colors3.default.bold(`${heapUsed}`)}`)}`);
|
|
268
|
+
console.log(`${`Memory usage by user :`} ${import_ansi_colors3.default.cyan(`${import_ansi_colors3.default.bold(`${user}`)}`)}`);
|
|
269
|
+
console.log(`${`Memory usage by system :`} ${import_ansi_colors3.default.cyan(`${import_ansi_colors3.default.bold(`${system}`)}`)}`);
|
|
755
270
|
console.log(``);
|
|
756
271
|
}
|
|
757
272
|
coreListenerEventLoaderModuleService(kernelModule) {
|
|
@@ -770,10 +285,10 @@ var CoreService = class {
|
|
|
770
285
|
dbCon();
|
|
771
286
|
})();
|
|
772
287
|
} else {
|
|
773
|
-
const stackTrace = new StackTraceError(
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
288
|
+
const stackTrace = new import_opticore_catch_exception_error2.StackTraceError(
|
|
289
|
+
import_opticore_translator2.TranslationLoader.t("loadedModulesError", import_opticore_translator2.CLocal),
|
|
290
|
+
import_opticore_translator2.TranslationLoader.t("loadedModules", import_opticore_translator2.CLocal),
|
|
291
|
+
import_opticore_http_response.HttpStatusCode.NOT_ACCEPTABLE,
|
|
777
292
|
true
|
|
778
293
|
);
|
|
779
294
|
throw new Error(stackTrace.message);
|
|
@@ -782,19 +297,23 @@ var CoreService = class {
|
|
|
782
297
|
};
|
|
783
298
|
|
|
784
299
|
// src/core/webServer.core.ts
|
|
300
|
+
var import_opticore_translator3 = require("opticore-translator");
|
|
301
|
+
var path2 = __toESM(require("path"), 1);
|
|
302
|
+
var import_node_process3 = __toESM(require("process"), 1);
|
|
785
303
|
var WebServerCore = class {
|
|
786
304
|
constructor(app, corsOriginOptions) {
|
|
787
305
|
this.serverUtility = new CoreService();
|
|
788
|
-
this.expressApp = (0,
|
|
789
|
-
this.port = Number(getEnvVariable.appPort);
|
|
790
|
-
this.host = getEnvVariable.appHost;
|
|
306
|
+
this.expressApp = (0, import_opticore_express2.express)();
|
|
307
|
+
this.port = Number(import_opticore_env_access.getEnvVariable.appPort);
|
|
308
|
+
this.host = import_opticore_env_access.getEnvVariable.appHost;
|
|
791
309
|
this.routerExpressApp = app;
|
|
792
|
-
this.expressApp.use(
|
|
793
|
-
this.expressApp.use(
|
|
794
|
-
this.expressApp.use(
|
|
795
|
-
this.expressApp.use(
|
|
310
|
+
this.expressApp.use(import_opticore_express2.express.json());
|
|
311
|
+
this.expressApp.use(import_opticore_express2.express.raw());
|
|
312
|
+
this.expressApp.use(import_opticore_express2.express.text());
|
|
313
|
+
this.expressApp.use(import_opticore_express2.express.urlencoded({ extended: true }));
|
|
796
314
|
this.expressApp.use((0, import_cors.default)(corsOriginOptions));
|
|
797
315
|
this.stackTraceErrorHandling();
|
|
316
|
+
this.translationWebAppLoader();
|
|
798
317
|
}
|
|
799
318
|
onStartServer(routers) {
|
|
800
319
|
return this.expressApp.listen(
|
|
@@ -803,39 +322,39 @@ var WebServerCore = class {
|
|
|
803
322
|
() => {
|
|
804
323
|
try {
|
|
805
324
|
if (this.host === "" && this.port === 0) {
|
|
806
|
-
ServerListenEventError.hostPortUndefined();
|
|
325
|
+
import_opticore_catch_exception_error3.ServerListenEventError.hostPortUndefined();
|
|
807
326
|
} else if (this.host === "") {
|
|
808
|
-
ServerListenEventError.hostUndefined();
|
|
327
|
+
import_opticore_catch_exception_error3.ServerListenEventError.hostUndefined();
|
|
809
328
|
} else if (this.port === 0) {
|
|
810
|
-
ServerListenEventError.portUndefined();
|
|
329
|
+
import_opticore_catch_exception_error3.ServerListenEventError.portUndefined();
|
|
811
330
|
} else {
|
|
812
331
|
this.registerRoutes(routers);
|
|
813
332
|
}
|
|
814
333
|
} catch (err) {
|
|
815
|
-
this.traceError(err.message, "Error",
|
|
334
|
+
this.traceError(err.message, "Error", import_opticore_http_response2.HttpStatusCode.NOT_ACCEPTABLE);
|
|
816
335
|
}
|
|
817
336
|
}
|
|
818
337
|
);
|
|
819
338
|
}
|
|
820
339
|
onListeningOnServerEvent(serverWeb, kernelModule) {
|
|
821
|
-
serverWeb.on(CEventNameError.error, (err) => {
|
|
822
|
-
ServerListenEventError.onEventError(err);
|
|
823
|
-
}).on(CEventNameError.close, () => {
|
|
824
|
-
ServerListenEventError.serverClosing();
|
|
825
|
-
}).on(CEventNameError.drop, () => {
|
|
826
|
-
ServerListenEventError.dropNewConnection();
|
|
827
|
-
}).on(CEventNameError.listening, () => {
|
|
340
|
+
serverWeb.on(import_opticore_catch_exception_error3.CEventNameError.error, (err) => {
|
|
341
|
+
import_opticore_catch_exception_error3.ServerListenEventError.onEventError(err);
|
|
342
|
+
}).on(import_opticore_catch_exception_error3.CEventNameError.close, () => {
|
|
343
|
+
import_opticore_catch_exception_error3.ServerListenEventError.serverClosing();
|
|
344
|
+
}).on(import_opticore_catch_exception_error3.CEventNameError.drop, () => {
|
|
345
|
+
import_opticore_catch_exception_error3.ServerListenEventError.dropNewConnection();
|
|
346
|
+
}).on(import_opticore_catch_exception_error3.CEventNameError.listening, () => {
|
|
828
347
|
this.infoWebApp();
|
|
829
348
|
this.serverUtility.coreListenerEventLoaderModuleService(kernelModule);
|
|
830
349
|
});
|
|
831
350
|
}
|
|
832
351
|
onRequestOnServerEvent(serverWeb) {
|
|
833
|
-
serverWeb.on(CEventNameError.request, (req, res) => {
|
|
834
|
-
requestCallsEvent(req, res, this.host, this.port, dateTimeFormattedUtils);
|
|
352
|
+
serverWeb.on(import_opticore_catch_exception_error3.CEventNameError.request, (req, res) => {
|
|
353
|
+
(0, import_opticore_requests_called_events.requestCallsEvent)(req, res, this.host, this.port, dateTimeFormattedUtils);
|
|
835
354
|
});
|
|
836
355
|
}
|
|
837
|
-
|
|
838
|
-
|
|
356
|
+
translationWebAppLoader() {
|
|
357
|
+
import_opticore_translator3.TranslationLoader.loadTranslations(path2.join(import_node_process3.default.cwd(), "src", "utils", "translations"), import_opticore_env_access.getEnvVariable.defaultLocal);
|
|
839
358
|
}
|
|
840
359
|
registerRoutes(allFeatureRoutes) {
|
|
841
360
|
allFeatureRoutes.map((router) => {
|
|
@@ -851,54 +370,19 @@ var WebServerCore = class {
|
|
|
851
370
|
this.serverUtility.infoServer(
|
|
852
371
|
this.serverUtility.getVersions().nodeVersion,
|
|
853
372
|
this.serverUtility.getProjectInfo().startingTime,
|
|
854
|
-
getEnvVariable.appHost,
|
|
855
|
-
Number(getEnvVariable.appPort),
|
|
373
|
+
import_opticore_env_access.getEnvVariable.appHost,
|
|
374
|
+
Number(import_opticore_env_access.getEnvVariable.appPort),
|
|
856
375
|
this.serverUtility.getUsageMemory().rss,
|
|
857
376
|
this.serverUtility.getUsageMemory().heapUsed,
|
|
858
377
|
this.serverUtility.getUsageMemory().user,
|
|
859
378
|
this.serverUtility.getUsageMemory().system
|
|
860
379
|
);
|
|
861
380
|
}
|
|
862
|
-
traceError(props, name,
|
|
863
|
-
return new StackTraceError(props, name,
|
|
381
|
+
traceError(props, name, status2) {
|
|
382
|
+
return new import_opticore_catch_exception_error3.StackTraceError(props, name, status2, true);
|
|
864
383
|
}
|
|
865
384
|
};
|
|
866
|
-
|
|
867
|
-
// src/domains/constants/errorName.constant.ts
|
|
868
|
-
var CErrorName = {
|
|
869
|
-
evalError: "EvalError",
|
|
870
|
-
syntaxError: "SyntaxError",
|
|
871
|
-
rangeError: "RangeError",
|
|
872
|
-
referenceError: "ReferenceError",
|
|
873
|
-
typeError: "TypeError",
|
|
874
|
-
uriError: "URIError",
|
|
875
|
-
systemError: "SystemError",
|
|
876
|
-
assertionError: "AssertionError",
|
|
877
|
-
openSSLError: "OpenSSLError",
|
|
878
|
-
generalError: "GeneralError"
|
|
879
|
-
};
|
|
880
|
-
|
|
881
|
-
// src/domains/constants/event.constant.ts
|
|
882
|
-
var CEvent = {
|
|
883
|
-
beforeExit: "beforeExit",
|
|
884
|
-
disconnect: "disconnect",
|
|
885
|
-
exit: "exit",
|
|
886
|
-
rejectionHandled: "rejectionHandled",
|
|
887
|
-
uncaughtException: "uncaughtException",
|
|
888
|
-
uncaughtExceptionMonitor: "uncaughtExceptionMonitor",
|
|
889
|
-
unhandledRejection: "unhandledRejection",
|
|
890
|
-
warning: "warning",
|
|
891
|
-
message: "message",
|
|
892
|
-
multipleResolves: "multipleResolves",
|
|
893
|
-
worker: "worker",
|
|
894
|
-
sigint: "SIGINT",
|
|
895
|
-
sigterm: "SIGTERM"
|
|
896
|
-
};
|
|
897
385
|
// Annotate the CommonJS export names for ESM import in node:
|
|
898
386
|
0 && (module.exports = {
|
|
899
|
-
WebServer
|
|
900
|
-
errorName,
|
|
901
|
-
event,
|
|
902
|
-
eventName,
|
|
903
|
-
getEnvVariable
|
|
387
|
+
WebServer
|
|
904
388
|
});
|