@athenna/http 3.11.0 → 4.0.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 (126) hide show
  1. package/package.json +238 -234
  2. package/src/{Decorators → annotations}/Controller.d.ts +1 -1
  3. package/src/{Decorators → annotations}/Controller.js +2 -0
  4. package/src/{Decorators → annotations}/Interceptor.d.ts +2 -2
  5. package/src/{Decorators → annotations}/Interceptor.js +5 -2
  6. package/src/{Decorators → annotations}/Middleware.d.ts +1 -1
  7. package/src/{Decorators → annotations}/Middleware.js +4 -1
  8. package/src/{Decorators → annotations}/Terminator.d.ts +2 -2
  9. package/src/{Decorators → annotations}/Terminator.js +5 -2
  10. package/src/{Commands → commands}/MakeControllerCommand.js +0 -1
  11. package/src/{Commands → commands}/MakeInterceptorCommand.js +0 -1
  12. package/src/{Commands → commands}/MakeMiddlewareCommand.js +0 -1
  13. package/src/{Commands → commands}/MakeTerminatorCommand.js +0 -1
  14. package/src/{Context → context}/Request.d.ts +1 -1
  15. package/src/{Context → context}/Request.js +0 -4
  16. package/src/{Context → context}/Response.d.ts +2 -2
  17. package/src/{Context → context}/Response.js +0 -4
  18. package/src/debug/index.d.ts +10 -0
  19. package/src/debug/index.js +10 -0
  20. package/src/{Exceptions → exceptions}/BadGatewayException.d.ts +1 -1
  21. package/src/{Exceptions → exceptions}/BadGatewayException.js +1 -1
  22. package/src/{Exceptions → exceptions}/BadRequestException.d.ts +1 -1
  23. package/src/{Exceptions → exceptions}/BadRequestException.js +1 -1
  24. package/src/{Exceptions → exceptions}/ForbiddenException.d.ts +1 -1
  25. package/src/{Exceptions → exceptions}/ForbiddenException.js +1 -1
  26. package/src/{Exceptions → exceptions}/HttpException.d.ts +3 -2
  27. package/src/{Exceptions → exceptions}/InternalServerException.d.ts +1 -1
  28. package/src/{Exceptions → exceptions}/InternalServerException.js +1 -1
  29. package/src/{Exceptions → exceptions}/MethodNotAllowedException.d.ts +1 -1
  30. package/src/{Exceptions → exceptions}/MethodNotAllowedException.js +1 -1
  31. package/src/{Exceptions → exceptions}/NotAcceptableException.d.ts +1 -1
  32. package/src/{Exceptions → exceptions}/NotAcceptableException.js +1 -1
  33. package/src/{Exceptions → exceptions}/NotFoundException.d.ts +1 -1
  34. package/src/{Exceptions → exceptions}/NotFoundException.js +1 -1
  35. package/src/{Exceptions → exceptions}/NotImplementedException.d.ts +1 -1
  36. package/src/{Exceptions → exceptions}/NotImplementedException.js +1 -1
  37. package/src/{Exceptions → exceptions}/PayloadTooLargeException.d.ts +1 -1
  38. package/src/{Exceptions → exceptions}/PayloadTooLargeException.js +1 -1
  39. package/src/{Exceptions → exceptions}/RequestTimeoutException.d.ts +1 -1
  40. package/src/{Exceptions → exceptions}/RequestTimeoutException.js +1 -1
  41. package/src/{Exceptions → exceptions}/ServiceUnavailableException.d.ts +1 -1
  42. package/src/{Exceptions → exceptions}/ServiceUnavailableException.js +1 -1
  43. package/src/{Exceptions → exceptions}/UnauthorizedException.d.ts +1 -1
  44. package/src/{Exceptions → exceptions}/UnauthorizedException.js +1 -1
  45. package/src/{Exceptions → exceptions}/UnprocessableEntityException.d.ts +1 -1
  46. package/src/{Exceptions → exceptions}/UnprocessableEntityException.js +1 -1
  47. package/src/{Facades → facades}/Route.d.ts +2 -2
  48. package/src/{Facades → facades}/Server.d.ts +2 -2
  49. package/src/{Handlers → handlers}/FastifyHandler.d.ts +4 -4
  50. package/src/{Handlers → handlers}/FastifyHandler.js +2 -2
  51. package/src/{Handlers → handlers}/HttpExceptionHandler.d.ts +1 -1
  52. package/src/{Handlers → handlers}/HttpExceptionHandler.js +6 -6
  53. package/src/index.d.ts +32 -40
  54. package/src/index.js +32 -40
  55. package/src/{Kernels → kernels}/HttpKernel.js +14 -1
  56. package/src/{Providers → providers}/HttpRouteProvider.js +1 -1
  57. package/src/{Providers → providers}/HttpServerProvider.js +1 -1
  58. package/src/{Router → router}/Route.d.ts +3 -9
  59. package/src/{Router → router}/Route.js +1 -5
  60. package/src/{Router → router}/RouteGroup.d.ts +3 -5
  61. package/src/{Router → router}/RouteGroup.js +2 -6
  62. package/src/{Router → router}/RouteResource.d.ts +2 -5
  63. package/src/{Router → router}/RouteResource.js +5 -13
  64. package/src/{Router → router}/Router.d.ts +7 -9
  65. package/src/{Router → router}/Router.js +15 -17
  66. package/src/{Server → server}/ServerImpl.d.ts +11 -14
  67. package/src/{Server → server}/ServerImpl.js +1 -9
  68. package/src/{Testing/Plugins → testing/plugins}/index.d.ts +5 -5
  69. package/src/{Testing/Plugins → testing/plugins}/index.js +5 -5
  70. package/src/{Testing/Plugins/Request → testing/plugins/request}/TestRequest.d.ts +2 -2
  71. package/src/{Testing/Plugins/Request → testing/plugins/request}/TestRequest.js +7 -5
  72. package/src/{Testing/Plugins/Request → testing/plugins/request}/TestResponse.d.ts +1 -1
  73. package/src/{Testing/Plugins/Request → testing/plugins/request}/TestResponse.js +1 -8
  74. package/src/{Types/Contexts → types/contexts}/Context.d.ts +2 -2
  75. package/src/types/contexts/Context.js +10 -0
  76. package/src/{Types/Contexts → types/contexts}/ErrorContext.d.ts +2 -2
  77. package/src/{Types/Contexts → types/contexts}/ErrorContext.js +2 -1
  78. package/src/{Types/Contexts → types/contexts}/InterceptContext.d.ts +2 -2
  79. package/src/{Types/Contexts → types/contexts}/InterceptContext.js +2 -1
  80. package/src/{Types/Contexts → types/contexts}/TerminateContext.d.ts +2 -2
  81. package/src/{Types/Contexts → types/contexts}/TerminateContext.js +2 -1
  82. package/src/{Contracts → types/contracts}/InterceptorContract.d.ts +1 -1
  83. package/src/{Contracts → types/contracts}/MiddlewareContract.d.ts +1 -1
  84. package/src/{Contracts → types/contracts}/TerminatorContract.d.ts +1 -1
  85. package/src/types/index.d.ts +24 -0
  86. package/src/types/index.js +24 -0
  87. package/src/{Types/Middlewares → types/middlewares}/InterceptorRouteType.d.ts +2 -2
  88. package/src/{Types/Middlewares → types/middlewares}/MiddlewareHandler.d.ts +3 -3
  89. package/src/{Types/Middlewares → types/middlewares}/MiddlewareRouteType.d.ts +2 -2
  90. package/src/{Types/Middlewares → types/middlewares}/TerminatorRouteType.d.ts +2 -2
  91. package/src/{Types/Router → types/router}/RouteHandler.d.ts +1 -1
  92. package/src/{Types/Router/RouteJSON.d.ts → types/router/RouteJson.d.ts} +3 -4
  93. package/src/Types/Router/RouteJSON.js +0 -9
  94. package/templates/controller.edge +0 -24
  95. package/templates/interceptor.edge +0 -8
  96. package/templates/middleware.edge +0 -6
  97. package/templates/terminator.edge +0 -6
  98. /package/src/{Commands → commands}/MakeControllerCommand.d.ts +0 -0
  99. /package/src/{Commands → commands}/MakeInterceptorCommand.d.ts +0 -0
  100. /package/src/{Commands → commands}/MakeMiddlewareCommand.d.ts +0 -0
  101. /package/src/{Commands → commands}/MakeTerminatorCommand.d.ts +0 -0
  102. /package/src/{Commands → commands}/RouteListCommand.d.ts +0 -0
  103. /package/src/{Commands → commands}/RouteListCommand.js +0 -0
  104. /package/src/{Exceptions → exceptions}/HttpException.js +0 -0
  105. /package/src/{Exceptions → exceptions}/UndefinedMethodException.d.ts +0 -0
  106. /package/src/{Exceptions → exceptions}/UndefinedMethodException.js +0 -0
  107. /package/src/{Facades → facades}/Route.js +0 -0
  108. /package/src/{Facades → facades}/Server.js +0 -0
  109. /package/src/{Kernels → kernels}/HttpKernel.d.ts +0 -0
  110. /package/src/{Providers → providers}/HttpRouteProvider.d.ts +0 -0
  111. /package/src/{Providers → providers}/HttpServerProvider.d.ts +0 -0
  112. /package/src/{Contracts → types/contracts}/InterceptorContract.js +0 -0
  113. /package/src/{Contracts → types/contracts}/MiddlewareContract.js +0 -0
  114. /package/src/{Contracts → types/contracts}/TerminatorContract.js +0 -0
  115. /package/src/{Types/Controllers → types/controllers}/ControllerOptions.d.ts +0 -0
  116. /package/src/{Types/Controllers → types/controllers}/ControllerOptions.js +0 -0
  117. /package/src/{Types/Middlewares → types/middlewares}/InterceptorRouteType.js +0 -0
  118. /package/src/{Types/Middlewares → types/middlewares}/MiddlewareHandler.js +0 -0
  119. /package/src/{Types/Middlewares → types/middlewares}/MiddlewareOptions.d.ts +0 -0
  120. /package/src/{Types/Middlewares → types/middlewares}/MiddlewareOptions.js +0 -0
  121. /package/src/{Types/Middlewares → types/middlewares}/MiddlewareRouteType.js +0 -0
  122. /package/src/{Types/Middlewares → types/middlewares}/TerminatorRouteType.js +0 -0
  123. /package/src/{Types/Router → types/router}/RouteHandler.js +0 -0
  124. /package/src/{Types/Contexts/Context.js → types/router/RouteJson.js} +0 -0
  125. /package/src/{Types/Router → types/router}/RouteResourceTypes.d.ts +0 -0
  126. /package/src/{Types/Router → types/router}/RouteResourceTypes.js +0 -0
package/package.json CHANGED
@@ -1,245 +1,249 @@
1
1
  {
2
- "name": "@athenna/http",
3
- "version": "3.11.0",
4
- "description": "The Athenna Http server. Built on top of fastify.",
5
- "license": "MIT",
6
- "author": "João Lenon <lenon@athenna.io>",
7
- "bugs": "https://github.com/AthennaIO/Http/issues",
8
- "repository": "https://github.com/AthennaIO/Http.git",
9
- "homepage": "https://github.com/AthennaIO/Http#readme",
10
- "keywords": [
11
- "fastify",
12
- "router",
13
- "cors",
14
- "ctx",
15
- "helmet",
16
- "swagger",
17
- "exception-handling",
18
- "rate-limiting",
19
- "middlewares",
20
- "terminators",
21
- "interceptors",
22
- "http-server",
23
- "athenna",
24
- "esm"
25
- ],
26
- "scripts": {
27
- "lint:fix": "eslint \"{bin,src,tests}/**/*.ts\" --fix",
28
- "test": "npm run --silent lint:fix && sh node bin/test.ts",
29
- "test:debug": "cross-env DEBUG=api:* sh node --inspect bin/test.ts",
30
- "test:coverage": "c8 npm run --silent test"
31
- },
32
- "files": [
33
- "src/*.js",
34
- "src/*.d.ts",
35
- "src/**/*.js",
36
- "src/**/*.d.ts",
37
- "templates"
38
- ],
39
- "type": "module",
40
- "main": "./src/index.js",
41
- "types": "./src/index.d.ts",
42
- "exports": {
43
- ".": "./src/index.js",
44
- "./testing/plugins": "./src/Testing/Plugins/index.js",
45
- "./kernels/HttpKernel": "./src/Kernels/HttpKernel.js",
46
- "./handlers/HttpExceptionHandler": "./src/Handlers/HttpExceptionHandler.js",
47
- "./providers/HttpRouteProvider": "./src/Providers/HttpRouteProvider.js",
48
- "./providers/HttpServerProvider": "./src/Providers/HttpServerProvider.js",
49
- "./commands/RouteListCommand": "./src/Commands/RouteListCommand.js",
50
- "./commands/MakeControllerCommand": "./src/Commands/MakeControllerCommand.js",
51
- "./commands/MakeMiddlewareCommand": "./src/Commands/MakeMiddlewareCommand.js",
52
- "./commands/MakeTerminatorCommand": "./src/Commands/MakeTerminatorCommand.js",
53
- "./commands/MakeInterceptorCommand": "./src/Commands/MakeInterceptorCommand.js"
54
- },
55
- "imports": {
56
- "#bin/*": "./bin/*.js",
57
- "#bin": "./bin/index.js",
58
- "#src/*": "./src/*.js",
59
- "#src": "./src/index.js",
60
- "#tests/*": "./tests/*.js",
61
- "#tests": "./tests/index.js"
62
- },
63
- "dependencies": {
64
- "fastify": "^4.15.0"
65
- },
66
- "devDependencies": {
67
- "@athenna/artisan": "^3.9.0",
68
- "@athenna/common": "^3.6.0",
69
- "@athenna/config": "^3.6.0",
70
- "@athenna/ioc": "^3.4.0",
71
- "@athenna/logger": "^3.4.0",
72
- "@athenna/test": "^3.6.0",
73
- "@athenna/view": "^3.3.0",
74
- "@fastify/cors": "^8.1.1",
75
- "@fastify/helmet": "^10.0.2",
76
- "@fastify/rate-limit": "^7.5.0",
77
- "@fastify/swagger": "^8.1.0",
78
- "@fastify/swagger-ui": "^1.1.0",
79
- "@swc/core": "^1.3.27",
80
- "@typescript-eslint/eslint-plugin": "^5.56.0",
81
- "@typescript-eslint/parser": "^5.56.0",
82
- "c8": "^7.12.0",
83
- "commitizen": "^4.2.6",
84
- "cross-env": "^7.0.3",
85
- "cz-conventional-changelog": "^3.3.0",
86
- "eslint": "^8.36.0",
87
- "eslint-config-prettier": "^8.8.0",
88
- "eslint-config-standard": "^17.0.0",
89
- "eslint-plugin-import": "^2.27.5",
90
- "eslint-plugin-n": "^15.6.1",
91
- "eslint-plugin-prettier": "^4.2.1",
92
- "eslint-plugin-promise": "^6.1.1",
93
- "husky": "^3.1.0",
94
- "lint-staged": "^12.5.0",
95
- "prettier": "^2.8.7",
96
- "reflect-metadata": "^0.1.13",
97
- "ts-node": "^10.9.1",
98
- "typescript": "^5.0.2"
99
- },
100
- "c8": {
101
- "all": true,
102
- "include": [
103
- "src/**/*.ts"
2
+ "name": "@athenna/http",
3
+ "version": "4.0.0",
4
+ "description": "The Athenna Http server. Built on top of fastify.",
5
+ "license": "MIT",
6
+ "author": "João Lenon <lenon@athenna.io>",
7
+ "bugs": "https://github.com/AthennaIO/Http/issues",
8
+ "repository": "https://github.com/AthennaIO/Http.git",
9
+ "homepage": "https://github.com/AthennaIO/Http#readme",
10
+ "keywords": [
11
+ "fastify",
12
+ "router",
13
+ "cors",
14
+ "ctx",
15
+ "helmet",
16
+ "swagger",
17
+ "exception-handling",
18
+ "rate-limiting",
19
+ "middlewares",
20
+ "terminators",
21
+ "interceptors",
22
+ "http-server",
23
+ "athenna",
24
+ "esm"
104
25
  ],
105
- "exclude": [
106
- "src/Types/*",
107
- "src/Contracts/*",
108
- "src/Exceptions/*",
109
- "src/Commands/*"
110
- ],
111
- "reporter": [
112
- "text-summary",
113
- "html"
114
- ],
115
- "report-dir": "./tests/Coverage",
116
- "check-coverage": true
117
- },
118
- "husky": {
119
- "hooks": {
120
- "prepare-commit-msg": "lint-staged && exec < /dev/tty && git cz --hook || true"
121
- }
122
- },
123
- "lint-staged": {
124
- "*.ts": [
125
- "eslint --fix",
126
- "git add"
26
+ "scripts": {
27
+ "build": "rimraf build && tsc --project bin/tsconfig.build.json",
28
+ "lint:fix": "eslint \"{bin,src,tests}/**/*.ts\" --fix",
29
+ "test": "npm run --silent lint:fix && sh node bin/test.ts",
30
+ "test:debug": "cross-env NODE_DEBUG=athenna:* sh node --inspect bin/test.ts",
31
+ "test:coverage": "c8 npm run --silent test"
32
+ },
33
+ "files": [
34
+ "src/*.js",
35
+ "src/*.d.ts",
36
+ "src/**/*.js",
37
+ "src/**/*.d.ts",
38
+ "templates"
127
39
  ],
128
- "*.json": [
129
- "prettier --write",
130
- "git add"
131
- ]
132
- },
133
- "config": {
134
- "commitizen": {
135
- "path": "./node_modules/cz-conventional-changelog"
136
- }
137
- },
138
- "prettier": {
139
- "singleQuote": true,
140
- "trailingComma": "all",
141
- "arrowParens": "avoid",
142
- "endOfLine": "lf",
143
- "semi": false,
144
- "printWidth": 80,
145
- "overrides": [
146
- {
147
- "files": "tests/**/*",
148
- "options": {
149
- "printWidth": 120
40
+ "type": "module",
41
+ "main": "./src/index.js",
42
+ "types": "./src/index.d.ts",
43
+ "exports": {
44
+ ".": "./src/index.js",
45
+ "./types": "./src/types/index.js",
46
+ "./package.json": "./package.json",
47
+ "./testing/plugins": "./src/Testing/Plugins/index.js",
48
+ "./kernels/HttpKernel": "./src/Kernels/HttpKernel.js",
49
+ "./handlers/HttpExceptionHandler": "./src/Handlers/HttpExceptionHandler.js",
50
+ "./providers/HttpRouteProvider": "./src/Providers/HttpRouteProvider.js",
51
+ "./providers/HttpServerProvider": "./src/Providers/HttpServerProvider.js",
52
+ "./commands/RouteListCommand": "./src/Commands/RouteListCommand.js",
53
+ "./commands/MakeControllerCommand": "./src/Commands/MakeControllerCommand.js",
54
+ "./commands/MakeMiddlewareCommand": "./src/Commands/MakeMiddlewareCommand.js",
55
+ "./commands/MakeTerminatorCommand": "./src/Commands/MakeTerminatorCommand.js",
56
+ "./commands/MakeInterceptorCommand": "./src/Commands/MakeInterceptorCommand.js"
57
+ },
58
+ "imports": {
59
+ "#bin/*": "./bin/*.js",
60
+ "#bin": "./bin/index.js",
61
+ "#src/*": "./src/*.js",
62
+ "#src": "./src/index.js",
63
+ "#src/types": "./src/types/index.js",
64
+ "#src/debug": "./src/debug/index.js",
65
+ "#tests/*": "./tests/*.js",
66
+ "#tests": "./tests/index.js"
67
+ },
68
+ "dependencies": {
69
+ "fastify": "^4.21.0"
70
+ },
71
+ "devDependencies": {
72
+ "@athenna/artisan": "^4.0.0",
73
+ "@athenna/common": "^4.2.0",
74
+ "@athenna/config": "^4.2.0",
75
+ "@athenna/ioc": "^4.0.0",
76
+ "@athenna/logger": "^4.1.0",
77
+ "@athenna/test": "^4.2.0",
78
+ "@athenna/view": "^4.0.0",
79
+ "@fastify/cors": "^8.1.1",
80
+ "@fastify/helmet": "^10.0.2",
81
+ "@fastify/rate-limit": "^7.5.0",
82
+ "@fastify/swagger": "^8.1.0",
83
+ "@fastify/swagger-ui": "^1.1.0",
84
+ "@typescript-eslint/eslint-plugin": "^5.56.0",
85
+ "@typescript-eslint/parser": "^5.56.0",
86
+ "c8": "^7.12.0",
87
+ "commitizen": "^4.2.6",
88
+ "cross-env": "^7.0.3",
89
+ "cz-conventional-changelog": "^3.3.0",
90
+ "eslint": "^8.36.0",
91
+ "eslint-config-prettier": "^8.8.0",
92
+ "eslint-config-standard": "^17.0.0",
93
+ "eslint-plugin-import": "^2.27.5",
94
+ "eslint-plugin-n": "^15.6.1",
95
+ "eslint-plugin-prettier": "^4.2.1",
96
+ "eslint-plugin-promise": "^6.1.1",
97
+ "husky": "^3.1.0",
98
+ "lint-staged": "^12.5.0",
99
+ "prettier": "^2.8.7",
100
+ "reflect-metadata": "^0.1.13",
101
+ "rimraf": "^5.0.1",
102
+ "ts-node": "^10.9.1",
103
+ "typescript": "^5.0.2"
104
+ },
105
+ "c8": {
106
+ "all": true,
107
+ "include": [
108
+ "src/**/*.ts"
109
+ ],
110
+ "exclude": [
111
+ "src/types/*",
112
+ "src/exceptions/*",
113
+ "src/commands/*"
114
+ ],
115
+ "reporter": [
116
+ "text-summary",
117
+ "html"
118
+ ],
119
+ "report-dir": "./tests/coverage",
120
+ "check-coverage": true
121
+ },
122
+ "husky": {
123
+ "hooks": {
124
+ "prepare-commit-msg": "lint-staged && exec < /dev/tty && git cz --hook || true"
150
125
  }
151
- }
152
- ]
153
- },
154
- "eslintIgnore": [],
155
- "eslintConfig": {
156
- "env": {
157
- "es2021": true,
158
- "node": true
159
126
  },
160
- "globals": {
161
- "ioc": true,
162
- "Env": true,
163
- "Path": true,
164
- "Config": true
127
+ "lint-staged": {
128
+ "*.ts": [
129
+ "eslint --fix",
130
+ "git add"
131
+ ],
132
+ "*.json": [
133
+ "prettier --write",
134
+ "git add"
135
+ ]
165
136
  },
166
- "plugins": [
167
- "prettier",
168
- "@typescript-eslint"
169
- ],
170
- "extends": [
171
- "standard",
172
- "eslint:recommended",
173
- "plugin:prettier/recommended",
174
- "plugin:@typescript-eslint/recommended",
175
- "plugin:@typescript-eslint/eslint-recommended"
176
- ],
177
- "parser": "@typescript-eslint/parser",
178
- "rules": {
179
- "camelcase": "off",
180
- "dot-notation": "off",
181
- "prettier/prettier": "error",
182
- "no-useless-constructor": "off",
183
- "@typescript-eslint/no-explicit-any": "off",
184
- "@typescript-eslint/no-empty-function": "off",
185
- "@typescript-eslint/no-unused-vars": [
186
- "error",
187
- {
188
- "argsIgnorePattern": "^_",
189
- "varsIgnorePattern": "^_",
190
- "caughtErrorsIgnorePattern": "^_"
137
+ "config": {
138
+ "commitizen": {
139
+ "path": "./node_modules/cz-conventional-changelog"
191
140
  }
192
- ]
193
- }
194
- },
195
- "athenna": {
196
- "templates": {
197
- "controller": "./templates/controller.edge",
198
- "interceptor": "./templates/interceptor.edge",
199
- "middleware": "./templates/middleware.edge",
200
- "terminator": "./templates/terminator.edge",
201
- "command": "@athenna/artisan/templates/command.edge"
202
141
  },
203
- "preloads": [],
204
- "services": [],
205
- "providers": [],
206
- "controllers": [
207
- "#tests/Stubs/controllers/HelloController",
208
- "#tests/Stubs/controllers/DecoratedController"
209
- ],
210
- "middlewares": [
211
- "#tests/Stubs/middlewares/Middleware",
212
- "#tests/Stubs/middlewares/ImportedMiddleware",
213
- "#tests/Stubs/middlewares/DecoratedMiddleware",
214
- "#tests/Stubs/middlewares/DecoratedInterceptor",
215
- "#tests/Stubs/middlewares/DecoratedTerminator"
216
- ],
217
- "namedMiddlewares": {
218
- "middleware": "#tests/Stubs/middlewares/Middleware",
219
- "interceptor": "#tests/Stubs/middlewares/Interceptor",
220
- "terminator": "#tests/Stubs/middlewares/Terminator",
221
- "not-found-middleware": "#tests/Stubs/middlewares/DecoratedMiddleware",
222
- "not-found-interceptor": "#tests/Stubs/middlewares/DecoratedInterceptor",
223
- "not-found-terminator": "#tests/Stubs/middlewares/DecoratedTerminator"
142
+ "prettier": {
143
+ "singleQuote": true,
144
+ "trailingComma": "all",
145
+ "arrowParens": "avoid",
146
+ "endOfLine": "lf",
147
+ "semi": false,
148
+ "printWidth": 80,
149
+ "overrides": [
150
+ {
151
+ "files": "tests/**/*",
152
+ "options": {
153
+ "printWidth": 120
154
+ }
155
+ }
156
+ ]
224
157
  },
225
- "globalMiddlewares": [
226
- "#tests/Stubs/middlewares/Middleware",
227
- "#tests/Stubs/middlewares/Interceptor",
228
- "#tests/Stubs/middlewares/Terminator",
229
- "#tests/Stubs/middlewares/DecoratedGlobalMiddleware",
230
- "#tests/Stubs/middlewares/DecoratedGlobalInterceptor",
231
- "#tests/Stubs/middlewares/DecoratedGlobalTerminator"
232
- ],
233
- "commands": {
234
- "route:list": {
235
- "path": "#src/Commands/RouteListCommand",
236
- "route": "./tests/Stubs/routes/http.js",
237
- "kernel": "./tests/Stubs/kernels/HttpKernel.js"
238
- },
239
- "make:controller": "#src/Commands/MakeControllerCommand",
240
- "make:interceptor": "#src/Commands/MakeInterceptorCommand",
241
- "make:middleware": "#src/Commands/MakeMiddlewareCommand",
242
- "make:terminator": "#src/Commands/MakeTerminatorCommand"
158
+ "eslintIgnore": [],
159
+ "eslintConfig": {
160
+ "env": {
161
+ "es2021": true,
162
+ "node": true
163
+ },
164
+ "globals": {
165
+ "ioc": true,
166
+ "Env": true,
167
+ "Path": true,
168
+ "Config": true
169
+ },
170
+ "plugins": [
171
+ "prettier",
172
+ "@typescript-eslint"
173
+ ],
174
+ "extends": [
175
+ "standard",
176
+ "eslint:recommended",
177
+ "plugin:prettier/recommended",
178
+ "plugin:@typescript-eslint/recommended",
179
+ "plugin:@typescript-eslint/eslint-recommended"
180
+ ],
181
+ "parser": "@typescript-eslint/parser",
182
+ "rules": {
183
+ "camelcase": "off",
184
+ "dot-notation": "off",
185
+ "prettier/prettier": "error",
186
+ "no-useless-constructor": "off",
187
+ "@typescript-eslint/no-explicit-any": "off",
188
+ "@typescript-eslint/no-empty-function": "off",
189
+ "@typescript-eslint/no-unused-vars": [
190
+ "error",
191
+ {
192
+ "argsIgnorePattern": "^_",
193
+ "varsIgnorePattern": "^_",
194
+ "caughtErrorsIgnorePattern": "^_"
195
+ }
196
+ ]
197
+ }
198
+ },
199
+ "athenna": {
200
+ "templates": {
201
+ "controller": "./templates/controller.edge",
202
+ "interceptor": "./templates/interceptor.edge",
203
+ "middleware": "./templates/middleware.edge",
204
+ "terminator": "./templates/terminator.edge",
205
+ "command": "@athenna/artisan/templates/command.edge"
206
+ },
207
+ "preloads": [],
208
+ "services": [],
209
+ "providers": [],
210
+ "controllers": [
211
+ "#tests/stubs/controllers/HelloController",
212
+ "#tests/stubs/controllers/DecoratedController"
213
+ ],
214
+ "middlewares": [
215
+ "#tests/stubs/middlewares/Middleware",
216
+ "#tests/stubs/middlewares/ImportedMiddleware",
217
+ "#tests/stubs/middlewares/DecoratedMiddleware",
218
+ "#tests/stubs/middlewares/DecoratedInterceptor",
219
+ "#tests/stubs/middlewares/DecoratedTerminator"
220
+ ],
221
+ "namedMiddlewares": {
222
+ "middleware": "#tests/stubs/middlewares/Middleware",
223
+ "interceptor": "#tests/stubs/middlewares/Interceptor",
224
+ "terminator": "#tests/stubs/middlewares/Terminator",
225
+ "not-found-middleware": "#tests/stubs/middlewares/DecoratedMiddleware",
226
+ "not-found-interceptor": "#tests/stubs/middlewares/DecoratedInterceptor",
227
+ "not-found-terminator": "#tests/stubs/middlewares/DecoratedTerminator"
228
+ },
229
+ "globalMiddlewares": [
230
+ "#tests/stubs/middlewares/Middleware",
231
+ "#tests/stubs/middlewares/Interceptor",
232
+ "#tests/stubs/middlewares/Terminator",
233
+ "#tests/stubs/middlewares/DecoratedGlobalMiddleware",
234
+ "#tests/stubs/middlewares/DecoratedGlobalInterceptor",
235
+ "#tests/stubs/middlewares/DecoratedGlobalTerminator"
236
+ ],
237
+ "commands": {
238
+ "route:list": {
239
+ "path": "#src/commands/RouteListCommand",
240
+ "route": "./tests/stubs/routes/http.js",
241
+ "kernel": "./tests/stubs/kernels/HttpKernel.js"
242
+ },
243
+ "make:controller": "#src/commands/MakeControllerCommand",
244
+ "make:interceptor": "#src/commands/MakeInterceptorCommand",
245
+ "make:middleware": "#src/commands/MakeMiddlewareCommand",
246
+ "make:terminator": "#src/commands/MakeTerminatorCommand"
247
+ }
243
248
  }
244
- }
245
249
  }
@@ -7,7 +7,7 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  import 'reflect-metadata';
10
- import { ControllerOptions } from '#src/Types/Controllers/ControllerOptions';
10
+ import type { ControllerOptions } from '#src/types/controllers/ControllerOptions';
11
11
  /**
12
12
  * Create a controller inside the service provider.
13
13
  */
@@ -7,6 +7,7 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  import 'reflect-metadata';
10
+ import { debug } from '#src/debug';
10
11
  import { Options } from '@athenna/common';
11
12
  /**
12
13
  * Create a controller inside the service provider.
@@ -20,6 +21,7 @@ export function Controller(options) {
20
21
  const alias = options.alias;
21
22
  const createCamelAlias = false;
22
23
  if (ioc.hasDependency(alias)) {
24
+ debug('Controller %s was already registered in the service container. Skipping registration via Controller annotation.', alias);
23
25
  return;
24
26
  }
25
27
  ioc[options.type](alias, target, createCamelAlias);
@@ -7,8 +7,8 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  import 'reflect-metadata';
10
- import { MiddlewareOptions } from '#src/Types/Middlewares/MiddlewareOptions';
10
+ import type { MiddlewareOptions } from '#src/types/middlewares/MiddlewareOptions';
11
11
  /**
12
- * Create a interceptor inside the service provider.
12
+ * Create an interceptor inside the service provider.
13
13
  */
14
14
  export declare function Interceptor(options?: MiddlewareOptions): ClassDecorator;
@@ -7,10 +7,11 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  import 'reflect-metadata';
10
- import { Server } from '#src/Facades/Server';
10
+ import { Server } from '#src/facades/Server';
11
11
  import { Options, String } from '@athenna/common';
12
+ import { debug } from '#src/debug/index';
12
13
  /**
13
- * Create a interceptor inside the service provider.
14
+ * Create an interceptor inside the service provider.
14
15
  */
15
16
  export function Interceptor(options) {
16
17
  return (target) => {
@@ -23,6 +24,7 @@ export function Interceptor(options) {
23
24
  const alias = options.alias;
24
25
  const createCamelAlias = false;
25
26
  if (ioc.hasDependency(alias)) {
27
+ debug('Interceptor %s was already registered in the service container. Skipping registration via Interceptor annotation.', alias);
26
28
  return;
27
29
  }
28
30
  ioc[options.type](alias, target, createCamelAlias);
@@ -32,6 +34,7 @@ export function Interceptor(options) {
32
34
  return;
33
35
  }
34
36
  const Interceptor = ioc.safeUse(alias);
37
+ debug('Registering %s as a global interceptor via Interceptor annotation.', Interceptor.constructor.name);
35
38
  Server.intercept(Interceptor.intercept);
36
39
  };
37
40
  }
@@ -7,7 +7,7 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  import 'reflect-metadata';
10
- import { MiddlewareOptions } from '#src/Types/Middlewares/MiddlewareOptions';
10
+ import type { MiddlewareOptions } from '#src/types/middlewares/MiddlewareOptions';
11
11
  /**
12
12
  * Create a middleware inside the service provider.
13
13
  */
@@ -7,8 +7,9 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  import 'reflect-metadata';
10
- import { Server } from '#src/Facades/Server';
10
+ import { Server } from '#src/facades/Server';
11
11
  import { Options, String } from '@athenna/common';
12
+ import { debug } from '#src/debug/index';
12
13
  /**
13
14
  * Create a middleware inside the service provider.
14
15
  */
@@ -23,6 +24,7 @@ export function Middleware(options) {
23
24
  const alias = options.alias;
24
25
  const createCamelAlias = false;
25
26
  if (ioc.hasDependency(alias)) {
27
+ debug('Middleware %s was already registered in the service container. Skipping registration via Middleware annotation.', alias);
26
28
  return;
27
29
  }
28
30
  ioc[options.type](alias, target, createCamelAlias);
@@ -32,6 +34,7 @@ export function Middleware(options) {
32
34
  return;
33
35
  }
34
36
  const Middleware = ioc.safeUse(alias);
37
+ debug('Registering %s as a global middleware via Middleware annotation.', Middleware.constructor.name);
35
38
  Server.middleware(Middleware.handle);
36
39
  };
37
40
  }
@@ -7,8 +7,8 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  import 'reflect-metadata';
10
- import { MiddlewareOptions } from '#src/Types/Middlewares/MiddlewareOptions';
10
+ import type { MiddlewareOptions } from '#src/types/middlewares/MiddlewareOptions';
11
11
  /**
12
- * Create a middleware inside the service provider.
12
+ * Create a terminator inside the service provider.
13
13
  */
14
14
  export declare function Terminator(options?: MiddlewareOptions): ClassDecorator;
@@ -7,10 +7,11 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  import 'reflect-metadata';
10
- import { Server } from '#src/Facades/Server';
10
+ import { Server } from '#src/facades/Server';
11
11
  import { Options, String } from '@athenna/common';
12
+ import { debug } from '#src/debug/index';
12
13
  /**
13
- * Create a middleware inside the service provider.
14
+ * Create a terminator inside the service provider.
14
15
  */
15
16
  export function Terminator(options) {
16
17
  return (target) => {
@@ -23,6 +24,7 @@ export function Terminator(options) {
23
24
  const alias = options.alias;
24
25
  const createCamelAlias = false;
25
26
  if (ioc.hasDependency(alias)) {
27
+ debug('Terminator %s was already registered in the service container. Skipping registration via Terminator annotation.', alias);
26
28
  return;
27
29
  }
28
30
  ioc[options.type](alias, target, createCamelAlias);
@@ -32,6 +34,7 @@ export function Terminator(options) {
32
34
  return;
33
35
  }
34
36
  const Terminator = ioc.safeUse(alias);
37
+ debug('Registering %s as a global terminator via Terminator annotation.', Terminator.constructor.name);
35
38
  Server.middleware(Terminator.terminate);
36
39
  };
37
40
  }
@@ -16,7 +16,6 @@ import { Path } from '@athenna/common';
16
16
  import { sep, resolve, isAbsolute } from 'node:path';
17
17
  import { BaseCommand, Argument } from '@athenna/artisan';
18
18
  export class MakeControllerCommand extends BaseCommand {
19
- name;
20
19
  static signature() {
21
20
  return 'make:controller';
22
21
  }
@@ -16,7 +16,6 @@ import { Path } from '@athenna/common';
16
16
  import { sep, resolve, isAbsolute } from 'node:path';
17
17
  import { BaseCommand, Argument } from '@athenna/artisan';
18
18
  export class MakeInterceptorCommand extends BaseCommand {
19
- name;
20
19
  static signature() {
21
20
  return 'make:interceptor';
22
21
  }