@expressots/core 1.0.0 → 1.1.0

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.
Files changed (124) hide show
  1. package/README.md +33 -122
  2. package/lib/CHANGELOG.md +101 -0
  3. package/lib/README.md +64 -0
  4. package/lib/cjs/application/app-container.js +28 -0
  5. package/{application → lib/cjs/application}/application.js +17 -6
  6. package/lib/cjs/console/console.js +77 -0
  7. package/{container-module → lib/cjs/container-module}/container-module.js +11 -3
  8. package/lib/cjs/controller/base-controller.js +56 -0
  9. package/{environment → lib/cjs/environment}/env-validator.js +13 -5
  10. package/lib/cjs/error/application-error.js +26 -0
  11. package/lib/cjs/error/report.js +20 -0
  12. package/lib/cjs/index.js +23 -0
  13. package/{logger → lib/cjs/logger}/general-logger.js +15 -4
  14. package/{application → lib/cjs/types/application}/app-container.d.ts +1 -0
  15. package/lib/cjs/types/application/app-container.d.ts.map +1 -0
  16. package/{application → lib/cjs/types/application}/application.d.ts +1 -0
  17. package/lib/cjs/types/application/application.d.ts.map +1 -0
  18. package/lib/cjs/types/application/index.d.ts +3 -0
  19. package/lib/cjs/types/application/index.d.ts.map +1 -0
  20. package/{console → lib/cjs/types/console}/console.d.ts +1 -0
  21. package/lib/cjs/types/console/console.d.ts.map +1 -0
  22. package/{console → lib/cjs/types/console}/index.d.ts +1 -0
  23. package/lib/cjs/types/console/index.d.ts.map +1 -0
  24. package/{container-module → lib/cjs/types/container-module}/container-module.d.ts +1 -0
  25. package/lib/cjs/types/container-module/container-module.d.ts.map +1 -0
  26. package/lib/cjs/types/container-module/index.d.ts +2 -0
  27. package/lib/cjs/types/container-module/index.d.ts.map +1 -0
  28. package/{controller → lib/cjs/types/controller}/base-controller.d.ts +1 -0
  29. package/lib/cjs/types/controller/base-controller.d.ts.map +1 -0
  30. package/lib/cjs/types/controller/index.d.ts +2 -0
  31. package/lib/cjs/types/controller/index.d.ts.map +1 -0
  32. package/{environment → lib/cjs/types/environment}/env-validator.d.ts +1 -0
  33. package/lib/cjs/types/environment/env-validator.d.ts.map +1 -0
  34. package/lib/cjs/types/environment/index.d.ts +2 -0
  35. package/lib/cjs/types/environment/index.d.ts.map +1 -0
  36. package/{error → lib/cjs/types/error}/application-error.d.ts +1 -0
  37. package/lib/cjs/types/error/application-error.d.ts.map +1 -0
  38. package/{error → lib/cjs/types/error}/error-handler-middleware.d.ts +1 -0
  39. package/lib/cjs/types/error/error-handler-middleware.d.ts.map +1 -0
  40. package/lib/cjs/types/error/index.d.ts +4 -0
  41. package/lib/cjs/types/error/index.d.ts.map +1 -0
  42. package/{error → lib/cjs/types/error}/report.d.ts +1 -0
  43. package/lib/cjs/types/error/report.d.ts.map +1 -0
  44. package/{error → lib/cjs/types/error}/status-code.d.ts +1 -0
  45. package/lib/cjs/types/error/status-code.d.ts.map +1 -0
  46. package/lib/cjs/types/index.d.ts +8 -0
  47. package/lib/cjs/types/index.d.ts.map +1 -0
  48. package/{logger → lib/cjs/types/logger}/general-logger.d.ts +2 -1
  49. package/lib/cjs/types/logger/general-logger.d.ts.map +1 -0
  50. package/lib/cjs/types/logger/index.d.ts +2 -0
  51. package/lib/cjs/types/logger/index.d.ts.map +1 -0
  52. package/lib/esm/application/app-container.js +26 -0
  53. package/lib/esm/application/application.js +68 -0
  54. package/{console → lib/esm/console}/console.js +17 -15
  55. package/lib/esm/console/index.js +1 -0
  56. package/lib/esm/container-module/container-module.js +39 -0
  57. package/lib/esm/controller/base-controller.js +43 -0
  58. package/lib/esm/environment/env-validator.js +65 -0
  59. package/lib/esm/error/application-error.js +25 -0
  60. package/lib/esm/error/error-handler-middleware.js +7 -0
  61. package/lib/esm/error/report.js +17 -0
  62. package/lib/esm/error/status-code.js +80 -0
  63. package/lib/esm/logger/general-logger.js +96 -0
  64. package/lib/esm/types/application/app-container.d.ts +8 -0
  65. package/lib/esm/types/application/app-container.d.ts.map +1 -0
  66. package/lib/esm/types/application/application.d.ts +22 -0
  67. package/lib/esm/types/application/application.d.ts.map +1 -0
  68. package/lib/esm/types/application/index.d.ts +3 -0
  69. package/lib/esm/types/application/index.d.ts.map +1 -0
  70. package/lib/esm/types/console/console.d.ts +10 -0
  71. package/lib/esm/types/console/console.d.ts.map +1 -0
  72. package/lib/esm/types/console/index.d.ts +2 -0
  73. package/lib/esm/types/console/index.d.ts.map +1 -0
  74. package/lib/esm/types/container-module/container-module.d.ts +9 -0
  75. package/lib/esm/types/container-module/container-module.d.ts.map +1 -0
  76. package/lib/esm/types/container-module/index.d.ts +2 -0
  77. package/lib/esm/types/container-module/index.d.ts.map +1 -0
  78. package/lib/esm/types/controller/base-controller.d.ts +9 -0
  79. package/lib/esm/types/controller/base-controller.d.ts.map +1 -0
  80. package/lib/esm/types/controller/index.d.ts +2 -0
  81. package/lib/esm/types/controller/index.d.ts.map +1 -0
  82. package/lib/esm/types/environment/env-validator.d.ts +13 -0
  83. package/lib/esm/types/environment/env-validator.d.ts.map +1 -0
  84. package/lib/esm/types/environment/index.d.ts +2 -0
  85. package/lib/esm/types/environment/index.d.ts.map +1 -0
  86. package/lib/esm/types/error/application-error.d.ts +7 -0
  87. package/lib/esm/types/error/application-error.d.ts.map +1 -0
  88. package/lib/esm/types/error/error-handler-middleware.d.ts +5 -0
  89. package/lib/esm/types/error/error-handler-middleware.d.ts.map +1 -0
  90. package/lib/esm/types/error/index.d.ts +4 -0
  91. package/lib/esm/types/error/index.d.ts.map +1 -0
  92. package/lib/esm/types/error/report.d.ts +6 -0
  93. package/lib/esm/types/error/report.d.ts.map +1 -0
  94. package/lib/esm/types/error/status-code.d.ts +137 -0
  95. package/lib/esm/types/error/status-code.d.ts.map +1 -0
  96. package/lib/esm/types/index.d.ts +8 -0
  97. package/lib/esm/types/index.d.ts.map +1 -0
  98. package/lib/esm/types/logger/general-logger.d.ts +17 -0
  99. package/lib/esm/types/logger/general-logger.d.ts.map +1 -0
  100. package/lib/esm/types/logger/index.d.ts +2 -0
  101. package/lib/esm/types/logger/index.d.ts.map +1 -0
  102. package/lib/package.json +146 -0
  103. package/package.json +109 -13
  104. package/application/app-container.js +0 -20
  105. package/controller/base-controller.js +0 -37
  106. package/error/application-error.js +0 -18
  107. package/error/report.js +0 -15
  108. package/index.js +0 -10
  109. /package/{application → lib/cjs/application}/index.js +0 -0
  110. /package/{console → lib/cjs/console}/index.js +0 -0
  111. /package/{container-module → lib/cjs/container-module}/index.js +0 -0
  112. /package/{controller → lib/cjs/controller}/index.js +0 -0
  113. /package/{environment → lib/cjs/environment}/index.js +0 -0
  114. /package/{error → lib/cjs/error}/error-handler-middleware.js +0 -0
  115. /package/{error → lib/cjs/error}/index.js +0 -0
  116. /package/{error → lib/cjs/error}/status-code.js +0 -0
  117. /package/{logger → lib/cjs/logger}/index.js +0 -0
  118. /package/{application/index.d.ts → lib/esm/application/index.js} +0 -0
  119. /package/{container-module/index.d.ts → lib/esm/container-module/index.js} +0 -0
  120. /package/{controller/index.d.ts → lib/esm/controller/index.js} +0 -0
  121. /package/{environment/index.d.ts → lib/esm/environment/index.js} +0 -0
  122. /package/{error/index.d.ts → lib/esm/error/index.js} +0 -0
  123. /package/{index.d.ts → lib/esm/index.mjs} +0 -0
  124. /package/{logger/index.d.ts → lib/esm/logger/index.js} +0 -0
@@ -0,0 +1,146 @@
1
+ {
2
+ "name": "@expressots/core",
3
+ "version": "1.1.0",
4
+ "description": "Expressots - modern, fast, lightweight nodejs web framework (@core)",
5
+ "author": "Richard Zampieri",
6
+ "main": "./lib/cjs/index.js",
7
+ "types": "./lib/cjs/types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./lib/esm/types/index.d.ts",
12
+ "default": "./lib/esm/index.mjs"
13
+ },
14
+ "require": {
15
+ "types": "./lib/cjs/types/index.d.ts",
16
+ "default": "./lib/cjs/index.js"
17
+ }
18
+ }
19
+ },
20
+ "files": [
21
+ "lib/**/*"
22
+ ],
23
+ "license": "MIT",
24
+ "homepage": "https://expresso-ts.com",
25
+ "funding": {
26
+ "type": "",
27
+ "url": ""
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/expressots/expressots"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/expressots/expressots/issues"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "keywords": [
40
+ "expressots",
41
+ "nodejs",
42
+ "microservices",
43
+ "typescript",
44
+ "clean-architecture",
45
+ "typescript-framework",
46
+ "framework",
47
+ "server-side"
48
+ ],
49
+ "engines": {
50
+ "node": ">=18.10.0"
51
+ },
52
+ "scripts": {
53
+ "win-clean": "if exist lib (del /q lib\\*)",
54
+ "linux-clean": "rm -f lib/*",
55
+ "win-cpy": "xcopy package.json lib\\ && xcopy README.md lib\\ && xcopy CHANGELOG.md lib\\ /Y",
56
+ "linux-cpy": "cp package.json README.md CHANGELOG.md lib/",
57
+ "build:win": "npm run win-clean && npm run build:esm && npm run build:cjs && npm run win-cpy",
58
+ "build:linux": "npm run linux-clean && npm run build:esm && npm run build:cjs && npm run linux-cpy",
59
+ "build:esm": "tsc -p tsconfig.esm.json && mv lib/esm/index.js lib/esm/index.mjs ",
60
+ "build:cjs": "tsc -p tsconfig.cjs.json",
61
+ "git": "powershell -Command \"git add .; git commit -m \"%1\"; npm run release\"",
62
+ "release": "release-it",
63
+ "test": "jest"
64
+ },
65
+ "dependencies": {
66
+ "@commitlint/cli": "^17.5.1",
67
+ "@commitlint/config-conventional": "^17.4.4",
68
+ "@release-it/conventional-changelog": "^5.1.1",
69
+ "chalk": "^4.1.2",
70
+ "dotenv": "^16.0.3",
71
+ "express": "^4.18.2",
72
+ "husky": "^8.0.3",
73
+ "inversify": "^6.0.1",
74
+ "inversify-binding-decorators": "^4.0.0",
75
+ "inversify-express-utils": "^6.4.3",
76
+ "jest": "^29.5.0",
77
+ "reflect-metadata": "^0.1.13",
78
+ "release-it": "^15.9.3",
79
+ "winston": "^3.8.2",
80
+ "winston-daily-rotate-file": "^4.7.1"
81
+ },
82
+ "devDependencies": {
83
+ "@types/express": "^4.17.17",
84
+ "@types/jest": "^29.5.0",
85
+ "@types/node": "^18.15.11",
86
+ "ts-jest": "^29.0.5",
87
+ "typescript": "^4.9.5"
88
+ },
89
+ "release-it": {
90
+ "git": {
91
+ "commitMessage": "chore(release): ${version}"
92
+ },
93
+ "github": {
94
+ "release": true
95
+ },
96
+ "npm": {
97
+ "publish": false
98
+ },
99
+ "plugins": {
100
+ "@release-it/conventional-changelog": {
101
+ "infile": "CHANGELOG.md",
102
+ "preset": {
103
+ "name": "conventionalcommits",
104
+ "types": [
105
+ {
106
+ "type": "feat",
107
+ "section": "Features"
108
+ },
109
+ {
110
+ "type": "fix",
111
+ "section": "Bug Fixes"
112
+ },
113
+ {
114
+ "type": "perf",
115
+ "section": "Performance Improvements"
116
+ },
117
+ {
118
+ "type": "revert",
119
+ "section": "Reverts"
120
+ },
121
+ {
122
+ "type": "docs",
123
+ "section": "Documentation"
124
+ },
125
+ {
126
+ "type": "refactor",
127
+ "section": "Code Refactoring"
128
+ },
129
+ {
130
+ "type": "test",
131
+ "section": "Tests"
132
+ },
133
+ {
134
+ "type": "build",
135
+ "section": "Build System"
136
+ },
137
+ {
138
+ "type": "ci",
139
+ "section": "Continuous Integrations"
140
+ }
141
+ ]
142
+ }
143
+ }
144
+ }
145
+ }
146
+ }
package/package.json CHANGED
@@ -1,10 +1,25 @@
1
1
  {
2
2
  "name": "@expressots/core",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Expressots - modern, fast, lightweight nodejs web framework (@core)",
5
5
  "author": "Richard Zampieri",
6
- "main": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
6
+ "main": "./lib/cjs/index.js",
7
+ "types": "./lib/cjs/types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./lib/esm/types/index.d.ts",
12
+ "default": "./lib/esm/index.mjs"
13
+ },
14
+ "require": {
15
+ "types": "./lib/cjs/types/index.d.ts",
16
+ "default": "./lib/cjs/index.js"
17
+ }
18
+ }
19
+ },
20
+ "files": [
21
+ "lib/**/*"
22
+ ],
8
23
  "license": "MIT",
9
24
  "homepage": "https://expresso-ts.com",
10
25
  "funding": {
@@ -15,36 +30,117 @@
15
30
  "type": "git",
16
31
  "url": "https://github.com/expressots/expressots"
17
32
  },
33
+ "bugs": {
34
+ "url": "https://github.com/expressots/expressots/issues"
35
+ },
18
36
  "publishConfig": {
19
37
  "access": "public"
20
38
  },
39
+ "keywords": [
40
+ "expressots",
41
+ "nodejs",
42
+ "microservices",
43
+ "typescript",
44
+ "clean-architecture",
45
+ "typescript-framework",
46
+ "framework",
47
+ "server-side"
48
+ ],
21
49
  "engines": {
22
50
  "node": ">=18.10.0"
23
51
  },
24
52
  "scripts": {
25
- "build": "tsc",
26
- "postbuild": "xcopy \"package.json\" \"dist\" /y && xcopy \"README.md\" \"dist\" /y",
27
- "release": "npm run build && npm run postbuild",
53
+ "win-clean": "if exist lib (del /q lib\\*)",
54
+ "linux-clean": "rm -f lib/*",
55
+ "win-cpy": "xcopy package.json lib\\ && xcopy README.md lib\\ && xcopy CHANGELOG.md lib\\ /Y",
56
+ "linux-cpy": "cp package.json README.md CHANGELOG.md lib/",
57
+ "build:win": "npm run win-clean && npm run build:esm && npm run build:cjs && npm run win-cpy",
58
+ "build:linux": "npm run linux-clean && npm run build:esm && npm run build:cjs && npm run linux-cpy",
59
+ "build:esm": "tsc -p tsconfig.esm.json && mv lib/esm/index.js lib/esm/index.mjs ",
60
+ "build:cjs": "tsc -p tsconfig.cjs.json",
61
+ "git": "powershell -Command \"git add .; git commit -m \"%1\"; npm run release\"",
62
+ "release": "release-it",
28
63
  "test": "jest"
29
64
  },
30
- "keywords": [],
31
65
  "dependencies": {
66
+ "@commitlint/cli": "^17.5.1",
67
+ "@commitlint/config-conventional": "^17.4.4",
68
+ "@release-it/conventional-changelog": "^5.1.1",
32
69
  "chalk": "^4.1.2",
33
70
  "dotenv": "^16.0.3",
34
71
  "express": "^4.18.2",
72
+ "husky": "^8.0.3",
35
73
  "inversify": "^6.0.1",
36
74
  "inversify-binding-decorators": "^4.0.0",
37
- "inversify-express-utils": "^6.3.2",
75
+ "inversify-express-utils": "^6.4.3",
76
+ "jest": "^29.5.0",
38
77
  "reflect-metadata": "^0.1.13",
39
- "typescript": "^4.9.5",
40
- "winston": "^3.8.1",
78
+ "release-it": "^15.9.3",
79
+ "winston": "^3.8.2",
41
80
  "winston-daily-rotate-file": "^4.7.1"
42
81
  },
43
82
  "devDependencies": {
44
83
  "@types/express": "^4.17.17",
45
- "@types/jest": "^29.4.0",
46
- "jest": "^29.4.2",
84
+ "@types/jest": "^29.5.0",
85
+ "@types/node": "^18.15.11",
47
86
  "ts-jest": "^29.0.5",
48
- "ts-node-dev": "^2.0.0"
87
+ "typescript": "^4.9.5"
88
+ },
89
+ "release-it": {
90
+ "git": {
91
+ "commitMessage": "chore(release): ${version}"
92
+ },
93
+ "github": {
94
+ "release": true
95
+ },
96
+ "npm": {
97
+ "publish": false
98
+ },
99
+ "plugins": {
100
+ "@release-it/conventional-changelog": {
101
+ "infile": "CHANGELOG.md",
102
+ "preset": {
103
+ "name": "conventionalcommits",
104
+ "types": [
105
+ {
106
+ "type": "feat",
107
+ "section": "Features"
108
+ },
109
+ {
110
+ "type": "fix",
111
+ "section": "Bug Fixes"
112
+ },
113
+ {
114
+ "type": "perf",
115
+ "section": "Performance Improvements"
116
+ },
117
+ {
118
+ "type": "revert",
119
+ "section": "Reverts"
120
+ },
121
+ {
122
+ "type": "docs",
123
+ "section": "Documentation"
124
+ },
125
+ {
126
+ "type": "refactor",
127
+ "section": "Code Refactoring"
128
+ },
129
+ {
130
+ "type": "test",
131
+ "section": "Tests"
132
+ },
133
+ {
134
+ "type": "build",
135
+ "section": "Build System"
136
+ },
137
+ {
138
+ "type": "ci",
139
+ "section": "Continuous Integrations"
140
+ }
141
+ ]
142
+ }
143
+ }
144
+ }
49
145
  }
50
146
  }
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var AppContainer_1;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.AppContainer = void 0;
5
- const tslib_1 = require("tslib");
6
- const inversify_1 = require("inversify");
7
- const inversify_binding_decorators_1 = require("inversify-binding-decorators");
8
- let AppContainer = AppContainer_1 = class AppContainer {
9
- constructor() { }
10
- create(modules) {
11
- this.container = new inversify_1.Container();
12
- this.container.load((0, inversify_binding_decorators_1.buildProviderModule)(), ...modules);
13
- return this.container;
14
- }
15
- };
16
- AppContainer = AppContainer_1 = tslib_1.__decorate([
17
- (0, inversify_binding_decorators_1.provide)(AppContainer_1),
18
- tslib_1.__metadata("design:paramtypes", [])
19
- ], AppContainer);
20
- exports.AppContainer = AppContainer;
@@ -1,37 +0,0 @@
1
- "use strict";
2
- var BaseController_1;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.BaseController = void 0;
5
- const tslib_1 = require("tslib");
6
- const inversify_binding_decorators_1 = require("inversify-binding-decorators");
7
- const error_1 = require("../error");
8
- let BaseController = BaseController_1 = class BaseController {
9
- constructor(serviceName) {
10
- this.serviceName = serviceName;
11
- }
12
- async callUseCaseAsync(useCase, res, successStatusCode) {
13
- let dataReturn;
14
- try {
15
- dataReturn = await useCase;
16
- return res.status(successStatusCode).json(dataReturn);
17
- }
18
- catch (error) {
19
- error_1.Report.Error(error);
20
- }
21
- }
22
- callUseCase(useCase, res, successStatusCode) {
23
- let dataReturn;
24
- try {
25
- dataReturn = useCase;
26
- return res.status(successStatusCode).json(dataReturn);
27
- }
28
- catch (error) {
29
- error_1.Report.Error(error);
30
- }
31
- }
32
- };
33
- BaseController = BaseController_1 = tslib_1.__decorate([
34
- (0, inversify_binding_decorators_1.provide)(BaseController_1),
35
- tslib_1.__metadata("design:paramtypes", [String])
36
- ], BaseController);
37
- exports.BaseController = BaseController;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var AppError_1;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.AppError = void 0;
5
- const tslib_1 = require("tslib");
6
- const inversify_binding_decorators_1 = require("inversify-binding-decorators");
7
- let AppError = AppError_1 = class AppError extends Error {
8
- constructor(statusCode, message, service) {
9
- super(message);
10
- this.statusCode = statusCode;
11
- this.service = service;
12
- }
13
- };
14
- AppError = AppError_1 = tslib_1.__decorate([
15
- (0, inversify_binding_decorators_1.provide)(AppError_1),
16
- tslib_1.__metadata("design:paramtypes", [Number, String, String])
17
- ], AppError);
18
- exports.AppError = AppError;
package/error/report.js DELETED
@@ -1,15 +0,0 @@
1
- "use strict";
2
- var Report_1;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Report = void 0;
5
- const tslib_1 = require("tslib");
6
- const inversify_binding_decorators_1 = require("inversify-binding-decorators");
7
- let Report = Report_1 = class Report {
8
- static Error(error) {
9
- throw error;
10
- }
11
- };
12
- Report = Report_1 = tslib_1.__decorate([
13
- (0, inversify_binding_decorators_1.provide)(Report_1)
14
- ], Report);
15
- exports.Report = Report;
package/index.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./application"), exports);
5
- tslib_1.__exportStar(require("./console"), exports);
6
- tslib_1.__exportStar(require("./container-module"), exports);
7
- tslib_1.__exportStar(require("./controller"), exports);
8
- tslib_1.__exportStar(require("./environment"), exports);
9
- tslib_1.__exportStar(require("./error"), exports);
10
- tslib_1.__exportStar(require("./logger"), exports);
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes