@athenna/http 1.4.7 → 1.5.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@athenna/http",
3
- "version": "1.4.7",
3
+ "version": "1.5.0",
4
4
  "description": "The Athenna Http server. Built on top of fastify.",
5
5
  "license": "MIT",
6
6
  "author": "João Lenon <lenon@athenna.io>",
@@ -54,7 +54,7 @@
54
54
  "#tests/*": "./tests/*.js"
55
55
  },
56
56
  "dependencies": {
57
- "@athenna/artisan": "1.3.0",
57
+ "@athenna/artisan": "1.3.2",
58
58
  "@athenna/ioc": "1.2.3",
59
59
  "@athenna/logger": "1.2.8",
60
60
  "@secjs/utils": "1.9.7",
@@ -7,14 +7,18 @@ export class HttpExceptionHandler {
7
7
  *
8
8
  * @type {string[]}
9
9
  */
10
- ignoreCodes = []
10
+ get ignoreCodes() {
11
+ return []
12
+ }
11
13
 
12
14
  /**
13
15
  * Error statuses that should be ignored by Log.
14
16
  *
15
17
  * @type {number[]}
16
18
  */
17
- ignoreStatuses = []
19
+ get ignoreStatuses() {
20
+ return []
21
+ }
18
22
 
19
23
  /**
20
24
  * The global exception handler of all HTTP requests.
@@ -1,3 +1,6 @@
1
+ import { join } from 'node:path'
2
+ import { Folder, Module } from '@secjs/utils'
3
+
1
4
  export class HttpCommandsLoader {
2
5
  /**
3
6
  * Return all commands from http package.
@@ -11,4 +14,15 @@ export class HttpCommandsLoader {
11
14
  import('#src/Commands/Make/Middleware'),
12
15
  ]
13
16
  }
17
+
18
+ /**
19
+ * Return all custom templates from http package.
20
+ *
21
+ * @return {any[]}
22
+ */
23
+ static loadTemplates() {
24
+ return new Folder(
25
+ join(Module.createDirname(import.meta.url), '..', '..', 'templates'),
26
+ ).loadSync().files
27
+ }
14
28
  }
package/src/index.d.ts CHANGED
@@ -22,7 +22,7 @@ export class HttpKernel {
22
22
  *
23
23
  * @type {any | Promise<any>}
24
24
  */
25
- globalMiddlewares: any | Promise<any>
25
+ get globalMiddlewares(): any | Promise<any>
26
26
  /**
27
27
  * The application's named HTTP middlewares.
28
28
  *
@@ -30,7 +30,7 @@ export class HttpKernel {
30
30
  *
31
31
  * @type {Record<string, any | Promise<any>>}
32
32
  */
33
- namedMiddlewares: Record<string, any | Promise<any>>
33
+ get namedMiddlewares(): Record<string, any | Promise<any>>
34
34
 
35
35
  /**
36
36
  * Register all global and named middlewares to the server.
@@ -81,13 +81,13 @@ export class HttpExceptionHandler {
81
81
  *
82
82
  * @type {string[]}
83
83
  */
84
- ignoreCodes: string[]
84
+ get ignoreCodes(): string[]
85
85
  /**
86
86
  * Error statuses that should be ignored by Log.
87
87
  *
88
88
  * @type {number[]}
89
89
  */
90
- ignoreStatuses: number[]
90
+ get ignoreStatuses(): number[]
91
91
 
92
92
  /**
93
93
  * The global exception handler of all HTTP requests.
@@ -586,6 +586,13 @@ export class HttpCommandsLoader {
586
586
  * @return {any[]}
587
587
  */
588
588
  static loadCommands(): any[]
589
+
590
+ /**
591
+ * Return all custom templates from http package.
592
+ *
593
+ * @return {any[]}
594
+ */
595
+ static loadTemplates(): any[]
589
596
  }
590
597
 
591
598
  export interface NextContract {