@expressots/core 1.1.0 → 1.2.1
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/LICENSE.md +21 -0
- package/README.md +2 -1
- package/lib/CHANGELOG.md +19 -0
- package/lib/README.md +2 -1
- package/lib/cjs/application/app-container.js +40 -28
- package/lib/cjs/application/application.js +108 -73
- package/lib/cjs/application/index.js +9 -9
- package/lib/cjs/common/index.js +2 -0
- package/lib/cjs/common/project-config.provider.js +2 -0
- package/lib/cjs/console/console.js +95 -77
- package/lib/cjs/console/index.js +5 -5
- package/lib/cjs/container-module/container-module.js +56 -42
- package/lib/cjs/container-module/index.js +5 -5
- package/lib/cjs/controller/base-controller.js +77 -56
- package/lib/cjs/controller/index.js +5 -5
- package/lib/cjs/environment/env-validator.js +87 -72
- package/lib/cjs/environment/index.js +5 -5
- package/lib/cjs/error/application-error.js +37 -26
- package/lib/cjs/error/error-handler-middleware.js +17 -9
- package/lib/cjs/error/index.js +9 -9
- package/lib/cjs/error/report.js +27 -20
- package/lib/cjs/error/status-code.js +83 -83
- package/lib/cjs/index.js +24 -23
- package/lib/cjs/logger/general-logger.js +132 -103
- package/lib/cjs/logger/index.js +7 -7
- package/lib/cjs/types/application/app-container.d.ts +19 -7
- package/lib/cjs/types/application/app-container.d.ts.map +1 -1
- package/lib/cjs/types/application/application.d.ts +52 -21
- package/lib/cjs/types/application/application.d.ts.map +1 -1
- package/lib/cjs/types/application/index.d.ts +2 -2
- package/lib/cjs/types/common/index.d.ts +2 -0
- package/lib/cjs/types/common/index.d.ts.map +1 -0
- package/lib/cjs/types/common/project-config.provider.d.ts +22 -0
- package/lib/cjs/types/common/project-config.provider.d.ts.map +1 -0
- package/lib/cjs/types/console/console.d.ts +27 -9
- package/lib/cjs/types/console/console.d.ts.map +1 -1
- package/lib/cjs/types/console/index.d.ts +1 -1
- package/lib/cjs/types/container-module/container-module.d.ts +22 -8
- package/lib/cjs/types/container-module/container-module.d.ts.map +1 -1
- package/lib/cjs/types/container-module/index.d.ts +1 -1
- package/lib/cjs/types/controller/base-controller.d.ts +29 -8
- package/lib/cjs/types/controller/base-controller.d.ts.map +1 -1
- package/lib/cjs/types/controller/index.d.ts +1 -1
- package/lib/cjs/types/environment/env-validator.d.ts +27 -12
- package/lib/cjs/types/environment/env-validator.d.ts.map +1 -1
- package/lib/cjs/types/environment/index.d.ts +1 -1
- package/lib/cjs/types/error/application-error.d.ts +17 -6
- package/lib/cjs/types/error/application-error.d.ts.map +1 -1
- package/lib/cjs/types/error/error-handler-middleware.d.ts +12 -4
- package/lib/cjs/types/error/error-handler-middleware.d.ts.map +1 -1
- package/lib/cjs/types/error/index.d.ts +3 -3
- package/lib/cjs/types/error/report.d.ts +12 -5
- package/lib/cjs/types/error/report.d.ts.map +1 -1
- package/lib/cjs/types/error/status-code.d.ts +136 -136
- package/lib/cjs/types/index.d.ts +8 -7
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/lib/cjs/types/logger/general-logger.d.ts +45 -16
- package/lib/cjs/types/logger/general-logger.d.ts.map +1 -1
- package/lib/cjs/types/logger/index.d.ts +1 -1
- package/lib/esm/application/app-container.js +38 -26
- package/lib/esm/application/application.js +103 -68
- package/lib/esm/application/index.js +2 -2
- package/lib/esm/common/index.js +1 -0
- package/lib/esm/common/project-config.provider.js +1 -0
- package/lib/esm/console/console.js +76 -58
- package/lib/esm/console/index.js +1 -1
- package/lib/esm/container-module/container-module.js +53 -39
- package/lib/esm/container-module/index.js +1 -1
- package/lib/esm/controller/base-controller.js +64 -43
- package/lib/esm/controller/index.js +1 -1
- package/lib/esm/environment/env-validator.js +80 -65
- package/lib/esm/environment/index.js +1 -1
- package/lib/esm/error/application-error.js +36 -25
- package/lib/esm/error/error-handler-middleware.js +15 -7
- package/lib/esm/error/index.js +3 -3
- package/lib/esm/error/report.js +24 -17
- package/lib/esm/error/status-code.js +80 -80
- package/lib/esm/index.mjs +8 -7
- package/lib/esm/logger/general-logger.js +125 -96
- package/lib/esm/logger/index.js +1 -1
- package/lib/esm/types/application/app-container.d.ts +19 -7
- package/lib/esm/types/application/app-container.d.ts.map +1 -1
- package/lib/esm/types/application/application.d.ts +52 -21
- package/lib/esm/types/application/application.d.ts.map +1 -1
- package/lib/esm/types/application/index.d.ts +2 -2
- package/lib/esm/types/common/index.d.ts +2 -0
- package/lib/esm/types/common/index.d.ts.map +1 -0
- package/lib/esm/types/common/project-config.provider.d.ts +22 -0
- package/lib/esm/types/common/project-config.provider.d.ts.map +1 -0
- package/lib/esm/types/console/console.d.ts +27 -9
- package/lib/esm/types/console/console.d.ts.map +1 -1
- package/lib/esm/types/console/index.d.ts +1 -1
- package/lib/esm/types/container-module/container-module.d.ts +22 -8
- package/lib/esm/types/container-module/container-module.d.ts.map +1 -1
- package/lib/esm/types/container-module/index.d.ts +1 -1
- package/lib/esm/types/controller/base-controller.d.ts +29 -8
- package/lib/esm/types/controller/base-controller.d.ts.map +1 -1
- package/lib/esm/types/controller/index.d.ts +1 -1
- package/lib/esm/types/environment/env-validator.d.ts +27 -12
- package/lib/esm/types/environment/env-validator.d.ts.map +1 -1
- package/lib/esm/types/environment/index.d.ts +1 -1
- package/lib/esm/types/error/application-error.d.ts +17 -6
- package/lib/esm/types/error/application-error.d.ts.map +1 -1
- package/lib/esm/types/error/error-handler-middleware.d.ts +12 -4
- package/lib/esm/types/error/error-handler-middleware.d.ts.map +1 -1
- package/lib/esm/types/error/index.d.ts +3 -3
- package/lib/esm/types/error/report.d.ts +12 -5
- package/lib/esm/types/error/report.d.ts.map +1 -1
- package/lib/esm/types/error/status-code.d.ts +136 -136
- package/lib/esm/types/index.d.ts +8 -7
- package/lib/esm/types/index.d.ts.map +1 -1
- package/lib/esm/types/logger/general-logger.d.ts +45 -16
- package/lib/esm/types/logger/general-logger.d.ts.map +1 -1
- package/lib/esm/types/logger/index.d.ts +1 -1
- package/lib/package.json +2 -2
- package/package.json +2 -2
|
@@ -1,96 +1,125 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
var GeneralLogger_1;
|
|
11
|
-
import { format, transports, createLogger } from "winston";
|
|
12
|
-
import DailyRotateFile from "winston-daily-rotate-file";
|
|
13
|
-
import { provide } from "inversify-binding-decorators";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var GeneralLogger_1;
|
|
11
|
+
import { format, transports, createLogger } from "winston";
|
|
12
|
+
import DailyRotateFile from "winston-daily-rotate-file";
|
|
13
|
+
import { provide } from "inversify-binding-decorators";
|
|
14
|
+
/**
|
|
15
|
+
* LogLevel enumeration defines the available log levels.
|
|
16
|
+
*/
|
|
17
|
+
var LogLevel;
|
|
18
|
+
(function (LogLevel) {
|
|
19
|
+
LogLevel[LogLevel["Debug"] = 0] = "Debug";
|
|
20
|
+
LogLevel[LogLevel["Error"] = 1] = "Error";
|
|
21
|
+
LogLevel[LogLevel["Info"] = 2] = "Info";
|
|
22
|
+
})(LogLevel || (LogLevel = {}));
|
|
23
|
+
/**
|
|
24
|
+
* GeneralLogger class is a utility class to manage logging within the application.
|
|
25
|
+
*/
|
|
26
|
+
let GeneralLogger = GeneralLogger_1 = class GeneralLogger {
|
|
27
|
+
logger;
|
|
28
|
+
constructor() {
|
|
29
|
+
this.logger = createLogger(this.createLoggerOptions());
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Creates a console transport for logging.
|
|
33
|
+
* @returns {transports.ConsoleTransportInstance} A Winston console transport instance.
|
|
34
|
+
*/
|
|
35
|
+
createConsoleTransport() {
|
|
36
|
+
const consoleTransport = new transports.Console({
|
|
37
|
+
level: "debug",
|
|
38
|
+
handleExceptions: true,
|
|
39
|
+
handleRejections: true
|
|
40
|
+
});
|
|
41
|
+
return consoleTransport;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Creates a rotational file transport for logging.
|
|
45
|
+
* @returns {DailyRotateFile} A Winston daily rotate file transport instance.
|
|
46
|
+
*/
|
|
47
|
+
createRotationalFileTransport() {
|
|
48
|
+
const rotationalFileTransport = new DailyRotateFile({
|
|
49
|
+
level: "error",
|
|
50
|
+
filename: "logs/general-%DATE%.log",
|
|
51
|
+
datePattern: "YYYY-MM-DD",
|
|
52
|
+
zippedArchive: true,
|
|
53
|
+
maxSize: "20m",
|
|
54
|
+
maxFiles: "7d",
|
|
55
|
+
silent: false
|
|
56
|
+
});
|
|
57
|
+
return rotationalFileTransport;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Creates a logger options object for Winston.
|
|
61
|
+
* @returns {LoggerOptions} A Winston logger options object.
|
|
62
|
+
*/
|
|
63
|
+
createLoggerOptions() {
|
|
64
|
+
const loggerOptions = {
|
|
65
|
+
transports: [
|
|
66
|
+
this.createConsoleTransport(),
|
|
67
|
+
this.createRotationalFileTransport()
|
|
68
|
+
],
|
|
69
|
+
defaultMeta: { service: "service-unknown" },
|
|
70
|
+
format: format.combine(format.splat(), format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }), format.label({ label: "core-api" }), format.printf(({ timestamp, level, message, service, label }) => {
|
|
71
|
+
return `[${timestamp}] [${label}] [${service}] ${level}: ${message}`;
|
|
72
|
+
}))
|
|
73
|
+
};
|
|
74
|
+
return loggerOptions;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Retrieves the path and line number of the error.
|
|
78
|
+
* @param error - An Error object containing error details.
|
|
79
|
+
* @returns {string} A string containing the path and line number of the error.
|
|
80
|
+
*/
|
|
81
|
+
getPathAndLine(error) {
|
|
82
|
+
let pathLine = "";
|
|
83
|
+
if (error.stack) {
|
|
84
|
+
let callerLine = error.stack.split("\n")[1];
|
|
85
|
+
let index = callerLine.indexOf("at ");
|
|
86
|
+
pathLine = callerLine.substring(index + +2, callerLine.length);
|
|
87
|
+
}
|
|
88
|
+
return pathLine;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Logs a message or error with the specified log level and service.
|
|
92
|
+
* @param logLevel - The log level to use (Debug, Error, or Info).
|
|
93
|
+
* @param content - The message or Error object to log.
|
|
94
|
+
* @param service - The service name (optional) associated with the log.
|
|
95
|
+
*/
|
|
96
|
+
log(logLevel, content, service) {
|
|
97
|
+
let pathLine = "";
|
|
98
|
+
let logMessageFormat = "";
|
|
99
|
+
if (typeof content === "object") {
|
|
100
|
+
pathLine = this.getPathAndLine(content);
|
|
101
|
+
logMessageFormat = `${content.message} - (${content.name}) [file: %s]`;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
logMessageFormat = content;
|
|
105
|
+
}
|
|
106
|
+
switch (logLevel) {
|
|
107
|
+
case LogLevel.Debug:
|
|
108
|
+
console.log(logMessageFormat, pathLine, { service });
|
|
109
|
+
break;
|
|
110
|
+
case LogLevel.Error:
|
|
111
|
+
this.logger.error(logMessageFormat, pathLine, { service });
|
|
112
|
+
break;
|
|
113
|
+
case LogLevel.Info:
|
|
114
|
+
this.logger.info(content, { service });
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
GeneralLogger = GeneralLogger_1 = __decorate([
|
|
120
|
+
provide(GeneralLogger_1),
|
|
121
|
+
__metadata("design:paramtypes", [])
|
|
122
|
+
], GeneralLogger);
|
|
123
|
+
const Log = new GeneralLogger();
|
|
124
|
+
const log = Log.log.bind(Log);
|
|
125
|
+
export { LogLevel, GeneralLogger, log };
|
package/lib/esm/logger/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { GeneralLogger, LogLevel, log } from './general-logger';
|
|
1
|
+
export { GeneralLogger, LogLevel, log } from './general-logger';
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
import { Container, ContainerModule } from "inversify";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Container, ContainerModule } from "inversify";
|
|
2
|
+
/**
|
|
3
|
+
* The AppContainer class provides a container for managing dependency injection.
|
|
4
|
+
* @provide AppContainer
|
|
5
|
+
*/
|
|
6
|
+
declare class AppContainer {
|
|
7
|
+
private container;
|
|
8
|
+
/**
|
|
9
|
+
* Constructs a new instance of the AppContainer class.
|
|
10
|
+
*/
|
|
11
|
+
constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Creates and configures a new dependency injection container.
|
|
14
|
+
* @param modules - An array of ContainerModule instances to load into the container.
|
|
15
|
+
* @returns The configured dependency injection container.
|
|
16
|
+
*/
|
|
17
|
+
create(modules: ContainerModule[]): Container;
|
|
18
|
+
}
|
|
19
|
+
export { AppContainer };
|
|
8
20
|
//# sourceMappingURL=app-container.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-container.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/application/app-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGvD,cACM,YAAY;IAEd,OAAO,CAAC,SAAS,CAAY;;
|
|
1
|
+
{"version":3,"file":"app-container.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/application/app-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGvD;;;GAGG;AACH,cACM,YAAY;IAEd,OAAO,CAAC,SAAS,CAAY;IAE7B;;OAEG;;IAGH;;;;OAIG;IACI,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,SAAS;CAKvD;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,22 +1,53 @@
|
|
|
1
|
-
import express from "express";
|
|
2
|
-
import { Container } from "inversify";
|
|
3
|
-
import { IApplicationMessageToConsole } from "../console/console";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import express from "express";
|
|
2
|
+
import { Container } from "inversify";
|
|
3
|
+
import { IApplicationMessageToConsole } from "../console/console";
|
|
4
|
+
/**
|
|
5
|
+
* Enum representing possible server environments.
|
|
6
|
+
*/
|
|
7
|
+
declare enum ServerEnvironment {
|
|
8
|
+
Development = "development",
|
|
9
|
+
Staging = "staging",
|
|
10
|
+
Production = "production"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The Application class provides a way to configure and manage an Express application.
|
|
14
|
+
* @provide Application
|
|
15
|
+
*/
|
|
16
|
+
declare class Application {
|
|
17
|
+
private app;
|
|
18
|
+
private port;
|
|
19
|
+
private environment;
|
|
20
|
+
/**
|
|
21
|
+
* Constructs a new instance of the Application class.
|
|
22
|
+
*/
|
|
23
|
+
constructor();
|
|
24
|
+
/**
|
|
25
|
+
* Configure services that should be initialized before the server starts.
|
|
26
|
+
*/
|
|
27
|
+
protected configureServices(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Configure services that should be executed after the server starts.
|
|
30
|
+
*/
|
|
31
|
+
protected postServerInitialization(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Perform actions or cleanup after the server is shutdown.
|
|
34
|
+
*/
|
|
35
|
+
protected serverShutdown(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Create and configure the Express application.
|
|
38
|
+
* @param container - The InversifyJS container.
|
|
39
|
+
* @param middlewares - An array of Express middlewares to be applied.
|
|
40
|
+
* @returns The configured Application instance.
|
|
41
|
+
*/
|
|
42
|
+
create(container: Container, middlewares?: express.RequestHandler[]): Application;
|
|
43
|
+
/**
|
|
44
|
+
* Start listening on the given port and environment.
|
|
45
|
+
* @param port - The port number to listen on.
|
|
46
|
+
* @param environment - The server environment.
|
|
47
|
+
* @param consoleMessage - Optional message to display in the console.
|
|
48
|
+
*/
|
|
49
|
+
listen(port: number, environment: ServerEnvironment, consoleMessage?: IApplicationMessageToConsole): void;
|
|
50
|
+
}
|
|
51
|
+
declare const appServerInstance: Application;
|
|
52
|
+
export { appServerInstance as AppInstance, Application, ServerEnvironment };
|
|
22
53
|
//# sourceMappingURL=application.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/application/application.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAItC,OAAO,EAAW,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAG3E,aAAK,iBAAiB;IAClB,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;CAC5B;AAED,cACM,WAAW;IAEb,OAAO,CAAC,GAAG,CAAsB;IACjC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,WAAW,CAAoB;;
|
|
1
|
+
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/application/application.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAItC,OAAO,EAAW,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAG3E;;GAEG;AACH,aAAK,iBAAiB;IAClB,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;CAC5B;AAED;;;GAGG;AACH,cACM,WAAW;IAEb,OAAO,CAAC,GAAG,CAAsB;IACjC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,WAAW,CAAoB;IAEvC;;OAEG;;IAGH;;OAEG;IACH,SAAS,CAAC,iBAAiB,IAAI,IAAI;IAEnC;;OAEG;IACH,SAAS,CAAC,wBAAwB,IAAI,IAAI;IAE1C;;OAEG;IACH,SAAS,CAAC,cAAc,IAAI,IAAI;IAIhC;;;;;OAKG;IACI,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,GAAE,OAAO,CAAC,cAAc,EAAO,GAAG,WAAW;IAoC5F;;;;;OAKG;IACI,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,cAAc,CAAC,EAAE,4BAA4B,GAAG,IAAI;CAanH;AAED,QAAA,MAAM,iBAAiB,EAAE,WAA+B,CAAC;AAEzD,OAAO,EAAE,iBAAiB,IAAI,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { AppInstance, Application, ServerEnvironment } from './application';
|
|
2
|
-
export { AppContainer } from './app-container';
|
|
1
|
+
export { AppInstance, Application, ServerEnvironment } from './application';
|
|
2
|
+
export { AppContainer } from './app-container';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare const enum Pattern {
|
|
2
|
+
LOWER_CASE = "lowercase",
|
|
3
|
+
KEBAB_CASE = "kebab-case",
|
|
4
|
+
PASCAL_CASE = "PascalCase",
|
|
5
|
+
CAMEL_CASE = "camelCase"
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The configuration object for the Expresso CLI.
|
|
9
|
+
*
|
|
10
|
+
* @property {Pattern} scaffoldPattern - The pattern to use when scaffolding files.
|
|
11
|
+
* @property {string} sourceRoot - The root directory for the source files.
|
|
12
|
+
* @property {boolean} opinionated - Whether or not to use the opinionated configuration.
|
|
13
|
+
*
|
|
14
|
+
* @see [ExpressoConfig](https://expresso-ts.com/docs)
|
|
15
|
+
*/
|
|
16
|
+
interface ExpressoConfig {
|
|
17
|
+
scaffoldPattern: Pattern;
|
|
18
|
+
sourceRoot: string;
|
|
19
|
+
opinionated: boolean;
|
|
20
|
+
}
|
|
21
|
+
export { ExpressoConfig, Pattern };
|
|
22
|
+
//# sourceMappingURL=project-config.provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-config.provider.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/common/project-config.provider.ts"],"names":[],"mappings":"AAAA,mBAAW,OAAO;IACjB,UAAU,cAAc;IACxB,UAAU,eAAe;IACzB,WAAW,eAAe;IAC1B,UAAU,cAAc;CACxB;AAED;;;;;;;;GAQG;AACH,UAAU,cAAc;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACrB;AAED,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1,10 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Interface representing application message details for console output.
|
|
3
|
+
*/
|
|
4
|
+
interface IApplicationMessageToConsole {
|
|
5
|
+
appName: string;
|
|
6
|
+
appVersion: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The Console class provides methods for displaying styled messages in the console.
|
|
10
|
+
* @provide Console
|
|
11
|
+
*/
|
|
12
|
+
declare class Console {
|
|
13
|
+
/**
|
|
14
|
+
* Print a message to the console with the specified color style.
|
|
15
|
+
* @param message - The message to be printed.
|
|
16
|
+
* @param colorStyle - The color style for the message.
|
|
17
|
+
*/
|
|
18
|
+
private printColor;
|
|
19
|
+
/**
|
|
20
|
+
* Display a message in the console with details about the running server.
|
|
21
|
+
* @param port - The port number the server is running on.
|
|
22
|
+
* @param environment - The server environment.
|
|
23
|
+
* @param consoleMessage - Optional application message details for console output.
|
|
24
|
+
*/
|
|
25
|
+
messageServer(port: any, environment: string, consoleMessage?: IApplicationMessageToConsole): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export { Console, IApplicationMessageToConsole };
|
|
10
28
|
//# sourceMappingURL=console.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/console/console.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/console/console.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,UAAU,4BAA4B;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,cACM,OAAO;IAET;;;;OAIG;YACW,UAAU;IAcxB;;;;;OAKG;IACU,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC;CA+B3H;AAED,OAAO,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Console, IApplicationMessageToConsole } from "./console";
|
|
1
|
+
export { Console, IApplicationMessageToConsole } from "./console";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import { ContainerModule } from "inversify";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { ContainerModule } from "inversify";
|
|
2
|
+
/**
|
|
3
|
+
* The BaseModule class provides methods for creating InversifyJS container modules.
|
|
4
|
+
* @provide BaseModule
|
|
5
|
+
*/
|
|
6
|
+
declare class BaseModule {
|
|
7
|
+
constructor();
|
|
8
|
+
/**
|
|
9
|
+
* Create a map of symbols for the provided controllers.
|
|
10
|
+
* @param controllers - An array of controller classes.
|
|
11
|
+
* @returns A map of symbols mapped to controller constructor functions.
|
|
12
|
+
*/
|
|
13
|
+
private static createSymbols;
|
|
14
|
+
/**
|
|
15
|
+
* Create an InversifyJS ContainerModule for the provided controllers.
|
|
16
|
+
* @param controllers - An array of controller classes.
|
|
17
|
+
* @returns A ContainerModule with the controller bindings.
|
|
18
|
+
*/
|
|
19
|
+
static createContainerModule(controllers: any[]): ContainerModule;
|
|
20
|
+
}
|
|
21
|
+
declare const CreateModule: typeof BaseModule.createContainerModule;
|
|
22
|
+
export { CreateModule };
|
|
9
23
|
//# sourceMappingURL=container-module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container-module.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/container-module/container-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"container-module.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/container-module/container-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAQ5C;;;GAGG;AACH,cACM,UAAU;;IAIZ;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAa3B;;;;MAIE;WACW,qBAAqB,CAAC,WAAW,EAAE,GAAG,EAAE,GAAG,eAAe;CAY3E;AAED,QAAA,MAAM,YAAY,yCAAmC,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CreateModule } from "./container-module";
|
|
1
|
+
export { CreateModule } from "./container-module";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,9 +1,30 @@
|
|
|
1
|
-
import { interfaces } from 'inversify-express-utils';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { interfaces } from 'inversify-express-utils';
|
|
2
|
+
/**
|
|
3
|
+
* The BaseController class is an abstract base class for controllers.
|
|
4
|
+
* It provides methods for handling use case calls and sending appropriate responses.
|
|
5
|
+
* @provide BaseController
|
|
6
|
+
*/
|
|
7
|
+
declare abstract class BaseController implements interfaces.Controller {
|
|
8
|
+
private serviceName;
|
|
9
|
+
/**
|
|
10
|
+
* Constructs a new BaseController instance with a specified service name.
|
|
11
|
+
* @param serviceName - The name of the service associated with the controller.
|
|
12
|
+
*/
|
|
13
|
+
constructor(serviceName: string);
|
|
14
|
+
/**
|
|
15
|
+
* Calls an asynchronous use case and sends an appropriate response based on the result.
|
|
16
|
+
* @param useCase - A promise representing the asynchronous use case to call.
|
|
17
|
+
* @param res - The Express response object.
|
|
18
|
+
* @param successStatusCode - The HTTP status code to return upon successful execution.
|
|
19
|
+
*/
|
|
20
|
+
protected callUseCaseAsync(useCase: Promise<any>, res: any, successStatusCode: number): Promise<any>;
|
|
21
|
+
/**
|
|
22
|
+
* Calls a use case and sends an appropriate response based on the result.
|
|
23
|
+
* @param useCase - The use case to call.
|
|
24
|
+
* @param res - The Express response object.
|
|
25
|
+
* @param successStatusCode - The HTTP status code to return upon successful execution.
|
|
26
|
+
*/
|
|
27
|
+
protected callUseCase(useCase: any, res: any, successStatusCode: number): any;
|
|
28
|
+
}
|
|
29
|
+
export { BaseController };
|
|
9
30
|
//# sourceMappingURL=base-controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-controller.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/controller/base-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD,uBACe,cAAe,YAAW,UAAU,CAAC,UAAU;IAE1D,OAAO,CAAC,WAAW,CAAS;
|
|
1
|
+
{"version":3,"file":"base-controller.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/controller/base-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD;;;;GAIG;AACH,uBACe,cAAe,YAAW,UAAU,CAAC,UAAU;IAE1D,OAAO,CAAC,WAAW,CAAS;IAE5B;;;OAGG;gBACS,WAAW,EAAE,MAAM;IAI/B;;;;;OAKG;cACa,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM;IAa3F;;;;;OAKG;IACH,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM;CAc1E;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { BaseController } from './base-controller';
|
|
1
|
+
export { BaseController } from './base-controller';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,13 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The EnvValidatorProvider class provides utility methods for working with environment variables.
|
|
3
|
+
* It validates, loads, and retrieves environment variables from the .env file.
|
|
4
|
+
* @provide EnvValidatorProvider
|
|
5
|
+
*/
|
|
6
|
+
declare class EnvValidatorProvider {
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves the value of an environment variable, or a default value if the variable is not set.
|
|
9
|
+
* @param key - The key of the environment variable.
|
|
10
|
+
* @param defaultValue - The default value to return if the environment variable is not set.
|
|
11
|
+
* @returns The value of the environment variable, or the default value if not set.
|
|
12
|
+
*/
|
|
13
|
+
static get(key: string, defaultValue?: any): any;
|
|
14
|
+
/**
|
|
15
|
+
* Validates and loads all environment variables from the .env file.
|
|
16
|
+
* If the .env file does not exist or any environment variables are not set, the process will exit with an error.
|
|
17
|
+
*/
|
|
18
|
+
static checkAll(): void;
|
|
19
|
+
}
|
|
20
|
+
declare global {
|
|
21
|
+
interface String {
|
|
22
|
+
AsBoolean(): boolean | undefined;
|
|
23
|
+
AsNumber(): number | undefined;
|
|
24
|
+
AsString(): string | undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export { EnvValidatorProvider as Environments };
|
|
13
28
|
//# sourceMappingURL=env-validator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-validator.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/environment/env-validator.ts"],"names":[],"mappings":"AAOA,cACM,oBAAoB;
|
|
1
|
+
{"version":3,"file":"env-validator.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/environment/env-validator.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,cACM,oBAAoB;IAEtB;;;;;OAKG;WACW,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,GAAE,GAAe,GAAG,GAAG;IAIlE;;;OAGG;WACW,QAAQ,IAAI,IAAI;CA+BjC;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,SAAS,IAAI,OAAO,GAAG,SAAS,CAAC;QACjC,QAAQ,IAAI,MAAM,GAAG,SAAS,CAAC;QAC/B,QAAQ,IAAI,MAAM,GAAG,SAAS,CAAC;KAClC;CACJ;AAyBD,OAAO,EAAE,oBAAoB,IAAI,YAAY,EAAE,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Environments } from './env-validator';
|
|
1
|
+
export { Environments } from './env-validator';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The AppError class extends the built-in Error class, adding a status code and service property.
|
|
3
|
+
* It is designed for handling application-specific errors with more detailed information.
|
|
4
|
+
* @provide AppError
|
|
5
|
+
*/
|
|
6
|
+
declare class AppError extends Error {
|
|
7
|
+
statusCode: number;
|
|
8
|
+
service: string;
|
|
9
|
+
/**
|
|
10
|
+
* Constructs a new AppError instance.
|
|
11
|
+
* @param statusCode - The status code associated with the error.
|
|
12
|
+
* @param message - The error message.
|
|
13
|
+
* @param service - An optional service name related to the error.
|
|
14
|
+
*/
|
|
15
|
+
constructor(statusCode: number, message: string, service?: string);
|
|
16
|
+
}
|
|
17
|
+
export { AppError };
|
|
7
18
|
//# sourceMappingURL=application-error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-error.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/error/application-error.ts"],"names":[],"mappings":"AAEA,cACM,QAAS,SAAQ,KAAK;IAEjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"application-error.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/error/application-error.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,cACM,QAAS,SAAQ,KAAK;IAEjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;gBACS,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAMpE;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|