exisjs 0.7.11 → 0.7.13

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 (150) hide show
  1. package/README.md +195 -39
  2. package/dist/cli/commands/dev.d.ts +4 -0
  3. package/dist/cli/commands/dev.d.ts.map +1 -1
  4. package/dist/cli/commands/dev.js +136 -32
  5. package/dist/cli/commands/dev.js.map +1 -1
  6. package/dist/cli/commands/run.d.ts +7 -0
  7. package/dist/cli/commands/run.d.ts.map +1 -0
  8. package/dist/cli/commands/run.js +99 -0
  9. package/dist/cli/commands/run.js.map +1 -0
  10. package/dist/cli/index.js +29 -13
  11. package/dist/cli/index.js.map +1 -1
  12. package/dist/cli/manifest.d.ts.map +1 -1
  13. package/dist/cli/manifest.js +18 -3
  14. package/dist/cli/manifest.js.map +1 -1
  15. package/dist/cli/routes.d.ts +6 -0
  16. package/dist/cli/routes.d.ts.map +1 -1
  17. package/dist/cli/routes.js +224 -135
  18. package/dist/cli/routes.js.map +1 -1
  19. package/dist/config/config.d.ts +2 -1
  20. package/dist/config/config.d.ts.map +1 -1
  21. package/dist/config/config.js.map +1 -1
  22. package/dist/config/types.d.ts +30 -9
  23. package/dist/config/types.d.ts.map +1 -1
  24. package/dist/database/lifecycle.d.ts +6 -1
  25. package/dist/database/lifecycle.d.ts.map +1 -1
  26. package/dist/database/lifecycle.js +15 -4
  27. package/dist/database/lifecycle.js.map +1 -1
  28. package/dist/decorators/params.d.ts +21 -0
  29. package/dist/decorators/params.d.ts.map +1 -1
  30. package/dist/decorators/params.js +21 -1
  31. package/dist/decorators/params.js.map +1 -1
  32. package/dist/di/container.d.ts +15 -6
  33. package/dist/di/container.d.ts.map +1 -1
  34. package/dist/di/container.js +26 -3
  35. package/dist/di/container.js.map +1 -1
  36. package/dist/di/index.d.ts +1 -1
  37. package/dist/di/index.d.ts.map +1 -1
  38. package/dist/di/index.js.map +1 -1
  39. package/dist/di/inject.d.ts +2 -1
  40. package/dist/di/inject.d.ts.map +1 -1
  41. package/dist/di/inject.js +2 -1
  42. package/dist/di/inject.js.map +1 -1
  43. package/dist/docs/BENCHMARKS.md +4 -4
  44. package/dist/docs/content/README.md +43 -44
  45. package/dist/docs/content/boundaries.mdx +141 -48
  46. package/dist/docs/content/cli/commands.mdx +161 -107
  47. package/dist/docs/content/cli/overview.mdx +61 -46
  48. package/dist/docs/content/cli/usage.mdx +107 -30
  49. package/dist/docs/content/config.mdx +145 -147
  50. package/dist/docs/content/controllers.mdx +193 -464
  51. package/dist/docs/content/cron.mdx +183 -69
  52. package/dist/docs/content/decorators.mdx +449 -154
  53. package/dist/docs/content/errors.mdx +202 -305
  54. package/dist/docs/content/exisjs-mcp.mdx +59 -49
  55. package/dist/docs/content/installation.mdx +243 -157
  56. package/dist/docs/content/introduction.mdx +220 -48
  57. package/dist/docs/content/middleware.mdx +171 -497
  58. package/dist/docs/content/modules.mdx +141 -83
  59. package/dist/docs/content/providers.mdx +216 -180
  60. package/dist/docs/content/requests.mdx +168 -488
  61. package/dist/docs/content/responses.mdx +200 -533
  62. package/dist/docs/content/routing.mdx +239 -558
  63. package/dist/docs/content/security.mdx +233 -57
  64. package/dist/docs/content/structure.mdx +151 -240
  65. package/dist/docs/content/swagger.mdx +192 -91
  66. package/dist/docs/content/testing.mdx +205 -74
  67. package/dist/docs/content/validation.mdx +479 -341
  68. package/dist/docs/reference/README.md +34 -2
  69. package/dist/docs/reference/config.mdx +277 -73
  70. package/dist/docs/reference/context.mdx +197 -106
  71. package/dist/docs/reference/cron.mdx +266 -152
  72. package/dist/docs/reference/database.mdx +135 -53
  73. package/dist/docs/reference/decorators.mdx +234 -116
  74. package/dist/docs/reference/di.mdx +146 -112
  75. package/dist/docs/reference/error.mdx +155 -178
  76. package/dist/docs/reference/exis.mdx +141 -70
  77. package/dist/docs/reference/logger.mdx +110 -126
  78. package/dist/docs/reference/middleware.mdx +235 -158
  79. package/dist/docs/reference/plugin.mdx +136 -64
  80. package/dist/docs/reference/router.mdx +277 -251
  81. package/dist/docs/reference/sanitize.mdx +91 -87
  82. package/dist/docs/reference/swagger.mdx +280 -100
  83. package/dist/docs/reference/testing.mdx +223 -89
  84. package/dist/docs/reference/validator.mdx +194 -206
  85. package/dist/lib/inspect-routes.d.ts +2 -0
  86. package/dist/lib/inspect-routes.d.ts.map +1 -0
  87. package/dist/lib/inspect-routes.js +148 -0
  88. package/dist/lib/inspect-routes.js.map +1 -0
  89. package/dist/lib/start-server.js +13 -8
  90. package/dist/lib/start-server.js.map +1 -1
  91. package/dist/module/module.d.ts +6 -3
  92. package/dist/module/module.d.ts.map +1 -1
  93. package/dist/module/module.js +17 -3
  94. package/dist/module/module.js.map +1 -1
  95. package/dist/router/controller-registrar.d.ts.map +1 -1
  96. package/dist/router/controller-registrar.js +26 -4
  97. package/dist/router/controller-registrar.js.map +1 -1
  98. package/dist/router/scanner/cron-mounter.d.ts.map +1 -1
  99. package/dist/router/scanner/cron-mounter.js +9 -2
  100. package/dist/router/scanner/cron-mounter.js.map +1 -1
  101. package/dist/server/app.d.ts +3 -1
  102. package/dist/server/app.d.ts.map +1 -1
  103. package/dist/server/app.js +29 -8
  104. package/dist/server/app.js.map +1 -1
  105. package/dist/server/define.d.ts.map +1 -1
  106. package/dist/server/define.js +5 -0
  107. package/dist/server/define.js.map +1 -1
  108. package/dist/server/request.d.ts +2 -0
  109. package/dist/server/request.d.ts.map +1 -1
  110. package/dist/server/request.js +11 -0
  111. package/dist/server/request.js.map +1 -1
  112. package/dist/swagger/generator.d.ts.map +1 -1
  113. package/dist/swagger/generator.js +130 -10
  114. package/dist/swagger/generator.js.map +1 -1
  115. package/dist/telemetry/index.d.ts +12 -0
  116. package/dist/telemetry/index.d.ts.map +1 -0
  117. package/dist/telemetry/index.js +121 -0
  118. package/dist/telemetry/index.js.map +1 -0
  119. package/dist/testing/client.d.ts +1 -0
  120. package/dist/testing/client.d.ts.map +1 -1
  121. package/dist/testing/client.js +4 -1
  122. package/dist/testing/client.js.map +1 -1
  123. package/dist/testing/index.d.ts.map +1 -1
  124. package/dist/testing/index.js +20 -4
  125. package/dist/testing/index.js.map +1 -1
  126. package/dist/validator/builder.d.ts +26 -1
  127. package/dist/validator/builder.d.ts.map +1 -1
  128. package/dist/validator/builder.js +31 -0
  129. package/dist/validator/builder.js.map +1 -1
  130. package/dist/validator/engine.d.ts +23 -0
  131. package/dist/validator/engine.d.ts.map +1 -1
  132. package/dist/validator/engine.js +228 -31
  133. package/dist/validator/engine.js.map +1 -1
  134. package/dist/validator/index.d.ts +8 -4
  135. package/dist/validator/index.d.ts.map +1 -1
  136. package/dist/validator/index.js +4 -1
  137. package/dist/validator/index.js.map +1 -1
  138. package/dist/validator/tex-types.d.ts +15 -0
  139. package/dist/validator/tex-types.d.ts.map +1 -1
  140. package/dist/validator/tex-types.js +102 -0
  141. package/dist/validator/tex-types.js.map +1 -1
  142. package/dist/validator/tex.d.ts +1 -1
  143. package/dist/validator/tex.d.ts.map +1 -1
  144. package/dist/validator/tex.js +3 -1
  145. package/dist/validator/tex.js.map +1 -1
  146. package/dist/validator/types.d.ts +1 -0
  147. package/dist/validator/types.d.ts.map +1 -1
  148. package/package.json +47 -14
  149. package/dist/docs/content/dataloader.mdx +0 -170
  150. package/dist/docs/reference/dataloader.mdx +0 -91
@@ -1,167 +1,285 @@
1
1
  ---
2
- title: "Decorators"
3
- description: "API Reference for ExisJS Class-Based Routing and Decorators."
2
+ title: "exisjs/decorators"
3
+ description: "API Reference for ExisJS Class-Based routing, controller decorators, parameter injectors, pipes, security guards, caching, and lifecycle hooks."
4
+ nextUrl: "/docs/reference/database"
5
+ nextTitle: "Database Reference"
4
6
  ---
5
7
 
6
- # Decorators (`exisjs/decorators`)
8
+ # `exisjs/decorators`
7
9
 
8
- ExisJS provides a robust Object-Oriented Programming (OOP) paradigm via the `exisjs/decorators` module.
10
+ The `exisjs/decorators` module provides TypeScript decorators for Class-Based OOP architecture. It covers routing controllers, HTTP method endpoints, parameter injection, validation pipes, traffic control, security guards, caching, and application lifecycle hooks.
9
11
 
10
- Unlike frameworks that depend on heavy reflection libraries, ExisJS decorators are built completely on standard ECMAScript decorators and **do not require `reflect-metadata`**.
12
+ ---
13
+
14
+ ## Module Exports Overview
15
+
16
+ ```typescript
17
+ import {
18
+ // Routing & Controllers
19
+ Controller,
20
+ Get,
21
+ Post,
22
+ Put,
23
+ Patch,
24
+ Delete,
25
+ Options,
26
+ Head,
27
+ All,
28
+ Ws,
29
+ Sse,
30
+
31
+ // Parameter Injection
32
+ Body,
33
+ RawBody,
34
+ Param,
35
+ Query,
36
+ QueryParam,
37
+ Headers,
38
+ Req,
39
+ Res,
40
+ Next,
41
+ Ip,
42
+ Cookies,
43
+ Cookie,
44
+ State,
45
+ AppCtx,
46
+ Fields,
47
+ UploadedFile,
48
+ UploadedFiles,
49
+ createParamDecorator,
50
+
51
+ // Pipeline, Middleware & Security
52
+ Use,
53
+ UseGuards,
54
+ UseInterceptors,
55
+ UseFilters,
56
+ UsePipes,
57
+ Catch,
58
+ RateLimit,
59
+ Cors,
60
+ IpFilter,
61
+ Timeout,
62
+ Idempotent,
63
+ Dedupe,
64
+ BlockProbes,
65
+ Upload,
66
+ Roles,
67
+ Permissions,
68
+ Public,
69
+ IsPublic,
70
+ AllowAnonymous,
71
+
72
+ // Responses & Metadata
73
+ HttpCode,
74
+ Header,
75
+ Redirect,
76
+ Returns,
77
+ Hosts,
78
+ SetMetadata,
79
+ Reflector,
80
+
81
+ // IoC, Modules & Boundaries
82
+ Injectable,
83
+ Inject,
84
+ Optional,
85
+ Module,
86
+ Global,
87
+ Boundary,
88
+ Server,
89
+
90
+ // Caching, Transactions & Profiling
91
+ Cacheable,
92
+ CacheEvict,
93
+ Transactional,
94
+ Profile,
95
+
96
+ // Cron & Scheduling
97
+ Cron,
98
+ Interval,
99
+ TimeoutTask,
100
+ } from 'exisjs/decorators'
101
+ ```
11
102
 
12
103
  ---
13
104
 
14
105
  ## 1. Controller & Routing
15
106
 
16
- ### `@Controller(prefixOrOptions?)`
107
+ ### `@Controller(prefixOrOptions?, options?)`
17
108
 
18
- Marks a class as a Controller. All route handler methods within the class will be grouped under the specified prefix.
109
+ Marks a class as an HTTP controller slice mounted at the specified route prefix.
110
+
111
+ ```typescript
112
+ function Controller(
113
+ prefixOrOptions?: string | ControllerOptions,
114
+ options?: ControllerOptions
115
+ ): ClassDecorator
116
+ ```
19
117
 
20
- ```typescript filename="src/http/users/route.ts"
21
- import { Controller } from 'exisjs/decorators'
118
+ #### `ControllerOptions`
119
+
120
+ | Property | Type | Description |
121
+ | :--- | :--- | :--- |
122
+ | `prefix` | `string` | Base URL path for all routes in this controller class. |
123
+ | `host` | `string \| string[]` | Subdomain or host restriction for this controller. |
124
+ | `cors` | `boolean \| CorsConfig` | Controller-scoped CORS configuration. |
125
+ | `tags` | `string[]` | OpenAPI / Swagger tags for documentation grouping. |
126
+
127
+ ```typescript
128
+ import { Controller, Get } from 'exisjs/decorators'
22
129
 
23
130
  @Controller('/users')
24
131
  export default class UserController {
25
- // ...
132
+ @Get('/')
133
+ async list() {
134
+ return { users: [] }
135
+ }
26
136
  }
27
137
  ```
28
138
 
29
- ### HTTP Methods
30
- Defines an HTTP route handler on a class method. You can optionally pass a schema to validate incoming requests.
139
+ ---
140
+
141
+ ### HTTP Method Decorators
31
142
 
32
- - `@Get(path?, schema?)`
33
- - `@Post(path?, schema?)`
34
- - `@Put(path?, schema?)`
35
- - `@Patch(path?, schema?)`
36
- - `@Delete(path?, schema?)`
37
- - `@Options(path?, schema?)`
38
- - `@Head(path?, schema?)`
39
- - `@Connect(path?, schema?)`
40
- - `@Trace(path?, schema?)`
41
- - `@All(path?, schema?)`
143
+ Method decorators register class methods as HTTP route handlers and attach validation schemas.
42
144
 
43
- ```typescript filename="src/http/users/route.ts"
44
- import { Controller, Get, Post } from 'exisjs/decorators'
45
- import { tex } from 'exisjs/validator'
145
+ | Decorator | HTTP Method | Signature |
146
+ | :--- | :--- | :--- |
147
+ | `@Get(path?, schema?)` | `GET` | `(path?: string, schema?: MethodSchemaInput) => MethodDecorator` |
148
+ | `@Post(path?, schema?)` | `POST` | `(path?: string, schema?: MethodSchemaInput) => MethodDecorator` |
149
+ | `@Put(path?, schema?)` | `PUT` | `(path?: string, schema?: MethodSchemaInput) => MethodDecorator` |
150
+ | `@Patch(path?, schema?)` | `PATCH` | `(path?: string, schema?: MethodSchemaInput) => MethodDecorator` |
151
+ | `@Delete(path?, schema?)` | `DELETE` | `(path?: string, schema?: MethodSchemaInput) => MethodDecorator` |
152
+ | `@Options(path?, schema?)` | `OPTIONS` | `(path?: string, schema?: MethodSchemaInput) => MethodDecorator` |
153
+ | `@Head(path?, schema?)` | `HEAD` | `(path?: string, schema?: MethodSchemaInput) => MethodDecorator` |
154
+ | `@All(path?, schema?)` | Any Method | `(path?: string, schema?: MethodSchemaInput) => MethodDecorator` |
155
+ | `@Sse(path?, schema?)` | SSE Stream | `(path?: string, schema?: MethodSchemaInput) => MethodDecorator` |
156
+ | `@Ws(path?, schema?)` | WebSocket | `(path?: string, schema?: MethodSchemaInput) => MethodDecorator` |
46
157
 
47
- @Controller('/users')
48
- export default class UserController {
49
- @Get('/:id')
50
- getUser() {
51
- return { id: 1 }
52
- }
158
+ ---
53
159
 
54
- @Post('/', { body: tex.object({ name: tex.string() }) })
55
- createUser() {
56
- return { success: true }
57
- }
58
- }
160
+ ## 2. Parameter Injectors
161
+
162
+ Parameter decorators extract and inject typed data directly into handler method arguments:
163
+
164
+ | Decorator | Signature | Description | Example |
165
+ | :--- | :--- | :--- | :--- |
166
+ | `@Body(property?, ...pipes)` | `(prop?: string, ...pipes: Pipe[])` | Injects parsed request body or subfield. | `@Body() dto: CreateUserDto` |
167
+ | `@RawBody(encoding?)` | `(encoding?: 'string' \| 'utf8' \| { encoding: string })` | Injects unparsed raw `Buffer` or string. | `@RawBody() payload: Buffer` |
168
+ | `@Param(key?, ...pipes)` | `(key?: string, ...pipes: Pipe[])` | Injects URL path parameter. | `@Param('id', ParseIntPipe) id: number` |
169
+ | `@Query(key?, ...pipes)` | `(key?: string, ...pipes: Pipe[])` | Injects query string parameter or dictionary. | `@Query('page') page: number` |
170
+ | `@Headers(name?, ...pipes)` | `(name?: string, ...pipes: Pipe[])` | Injects HTTP request header. | `@Headers('authorization') auth: string` |
171
+ | `@Cookies(name?, ...pipes)` | `(name?: string, ...pipes: Pipe[])` | Injects parsed cookie value or record. | `@Cookies('session') sid: string` |
172
+ | `@State(key?, ...pipes)` | `(key?: string, ...pipes: Pipe[])` | Injects request state dictionary or property. | `@State('user') user: User` |
173
+ | `@UploadedFile(field?)` | `(field?: string)` | Injects single uploaded file object. | `@UploadedFile('avatar') file: ExisFile` |
174
+ | `@UploadedFiles(field?)` | `(field?: string)` | Injects multiple uploaded files. | `@UploadedFiles('docs') files: ExisFile[]` |
175
+ | `@Req()` | `()` | Injects underlying `ExisRequest`. | `@Req() req: Request` |
176
+ | `@Res(options?)` | `(opts?: { passthrough?: boolean })` | Injects underlying `ExisResponse`. | `@Res() res: Response` |
177
+ | `@Next()` | `()` | Injects pipeline `NextFunction`. | `@Next() next: NextFunction` |
178
+ | `@Ip()` | `()` | Injects client IP address string. | `@Ip() ip: string` |
179
+ | `@AppCtx()` | `()` | Injects root Exis application instance. | `@AppCtx() app: App` |
180
+
181
+ ### `createParamDecorator(factory)`
182
+
183
+ Factory to create reusable custom parameter decorators:
184
+
185
+ ```typescript
186
+ import { createParamDecorator } from 'exisjs/decorators'
187
+
188
+ export const CurrentUser = createParamDecorator((data: string | undefined, ctx) => {
189
+ const req = ctx.req
190
+ return data ? req.user?.[data] : req.user
191
+ })
59
192
  ```
60
193
 
61
194
  ---
62
195
 
63
- ## 2. Parameter Injection
64
-
65
- Parameter decorators automatically extract data from the incoming request and inject them directly into your method arguments:
66
-
67
- - `@Body(nameOrPipe?)`: Parses and injects the JSON request body (or passes it through a validator/pipe).
68
- - `@Param(nameOrPipe?)`: Injects a URL path parameter (e.g., `id` from `/:id`).
69
- - `@Headers(nameOrPipe?)`: Injects an HTTP header by name.
70
- - `@QueryParam(nameOrPipe?)` / `@Query(nameOrPipe?)`: Injects a URL query parameter (e.g., `?search=term`).
71
- - `@Cookies(nameOrPipe?)` / `@Cookie(nameOrPipe?)`: Injects incoming parsed cookies or a specific cookie value.
72
- - `@State(keyOrPipe?)`: Injects request state from execution context or middleware.
73
- - `@AppCtx()`: Injects the root ExisJS Application instance.
74
- - `@Fields(nameOrPipe?)`: Injects non-file multipart form fields.
75
- - `@UploadedFile()`: Injects the uploaded file (`req.file`) into the method argument.
76
- - `@UploadedFiles()`: Injects the uploaded files array or dictionary (`req.files`) into the method argument.
77
- - `@HostParam(nameOrPipe?)`: Injects a subdomain parameter.
78
- - `@Req()`: Injects the raw ExisJS Request object.
79
- - `@Res(options?)`: Injects the raw ExisJS Response object (`{ passthrough: true }`).
80
- - `@Ip()`: Injects the client's IP address.
81
- - `@Next()`: Injects the Next function.
82
- - `createParamDecorator(factory)`: Exports a factory to create custom parameter decorators (e.g. `@CurrentUser()`).
196
+ ## 3. Transformation & Validation Pipes
197
+
198
+ | Pipe | Options Interface | Description |
199
+ | :--- | :--- | :--- |
200
+ | `ParseIntPipe` | `{ errorHttpStatusCode?: number }` | Parses string to integer, throwing 400 if invalid. |
201
+ | `ParseFloatPipe` | `{ errorHttpStatusCode?: number }` | Parses string to floating point number. |
202
+ | `ParseBoolPipe` | `{ errorHttpStatusCode?: number }` | Parses `"true"`, `"false"`, `1`, `0` to boolean. |
203
+ | `ParseUUIDPipe` | `{ version?: '1' \| '4' \| 'all' }` | Validates UUID strings. |
204
+ | `ParseArrayPipe` | `{ items?: Pipe, separator?: string }` | Splits comma-separated strings and applies item pipes. |
205
+ | `ValidationPipe` | `{ transform?: boolean }` | Validates DTO classes using schema assertions. |
83
206
 
84
207
  ---
85
208
 
86
- ## 3. Transformation Pipes & Middleware Decorators
87
-
88
- - `@UsePipes(...pipes)`: Binds transformation and validation pipes to a controller class or route method.
89
- - **Built-in Pipes**:
90
- - `ParseIntPipe`: Parses numeric strings to integers (`options?: { errorHttpStatusCode, exceptionFactory }`).
91
- - `ParseFloatPipe`: Parses numeric float strings (`options?: { errorHttpStatusCode, exceptionFactory }`).
92
- - `ParseBoolPipe`: Parses boolean strings (`'true'`, `'false'`, `1`, `0`).
93
- - `ParseUUIDPipe`: Validates UUID format (`options?: { version: '3' | '4' | '5' | 'all' }`).
94
- - `ParseArrayPipe`: Splits comma-separated strings and applies item-level transformation pipes.
95
- - `ValidationPipe`: Validates DTO classes and schemas (`options?: { transform: boolean }`).
96
- - `@Use(...middlewaresOrGuardsOrInterceptorsOrFilters)`: Unified decorator that binds middlewares, guards (`canActivate`), interceptors (`intercept`), or exception filters (`catch`) to a controller class or method.
97
- - `@UseGuards(...guards)`: Dedicated decorator to apply guards to a class or method.
98
- - `@UseInterceptors(...interceptors)`: Dedicated decorator to apply interceptors to a class or method.
99
- - `@UseFilters(...filters)`: Dedicated decorator to apply exception filters to a class or method.
100
- - `@Catch(...exceptions)`: Class decorator for `ExceptionFilter` implementations declaring handled exception types.
101
- - `@Upload(fieldName, options?)` / `@UseUpload(...)`: Configures multipart file upload handling for a method, populating `@UploadedFile()` or `@UploadedFiles()`.
102
- - `@Timeout(ms: number | TimeoutOptions)`: Overrides the request timeout for a class or method (e.g. `@Timeout(120000)`). Passing `0` disables timeouts for long-running streaming or exports.
103
- - `@Idempotent(options?)`: Caches responses based on the `Idempotency-Key` header using native in-memory off-heap storage. Works at class and method level.
104
- - `@RateLimit(options?)`: Enforces rate limits (e.g. `@RateLimit({ max: 100, windowMs: 60000 })`) at class or method level.
105
- - `@Cors(options?)`: Enforces Cross-Origin Resource Sharing rules at class or method level.
106
- - `@IpFilter(options)`: Enforces CIDR and IP allow/deny lists at class or method level.
107
- - `@Compress()`: Enables automatic Gzip and Brotli compression on responses.
108
- - `@Dedupe(options)`: Deduplicates concurrent identical requests sharing the same key.
109
- - `@BlockProbes(options?)`: Intercepts vulnerability scanner probes (`.env`, `/.git`, `/.DS_Store`) and blackholes them without triggering log noise.
209
+ ## 4. Pipeline & Middleware Decorators
210
+
211
+ | Decorator | Target | Options / Arguments | Description |
212
+ | :--- | :--- | :--- | :--- |
213
+ | `@Use(...items)` | Class / Method | `(Handler \| Guard \| Interceptor \| Filter)[]` | Attaches middlewares, guards, interceptors, or filters. |
214
+ | `@UseGuards(...guards)` | Class / Method | `Guard[]` | Attaches authorization guards (`canActivate`). |
215
+ | `@UseInterceptors(...interceptors)` | Class / Method | `Interceptor[]` | Attaches response/request interceptors (`intercept`). |
216
+ | `@UseFilters(...filters)` | Class / Method | `Filter[]` | Attaches exception filters (`catch`). |
217
+ | `@Catch(...exceptions)` | Class | `ErrorConstructor[]` | Declares exception types handled by an `ExceptionFilter`. |
218
+ | `@Timeout(ms)` | Class / Method | `number \| TimeoutOptions` | Overrides request timeout threshold in ms (`0` to disable). |
219
+ | `@RateLimit(options)` | Class / Method | `RateLimitOptions` | Enforces rate limits on endpoints. |
220
+ | `@Cors(options)` | Class / Method | `CorsConfig \| boolean` | Enforces CORS configuration. |
221
+ | `@IpFilter(options)` | Class / Method | `IpFilterOptions` | Enforces CIDR IP allow/deny lists. |
222
+ | `@Idempotent(options?)` | Class / Method | `IdempotencyOptions` | Enables off-heap request caching via `Idempotency-Key`. |
223
+ | `@Dedupe(options?)` | Class / Method | `DedupeOptions` | Deduplicates concurrent in-flight requests with identical keys. |
224
+ | `@BlockProbes(options?)` | Class / Method | `BlockProbesOptions` | Blackholes malicious scanner probes (`.env`, `wp-admin`). |
225
+ | `@Upload(field, options?)` | Method | `string, FileUploadOptions` | Configures multipart file upload streaming on the endpoint. |
110
226
 
111
227
  ---
112
228
 
113
- ## 4. Security & Access Control Decorators
229
+ ## 5. Security & Access Control
114
230
 
115
- - `@Permissions(...permissions: string[])`: Sets required permission keys for a controller or route method (automatically bypassed if `req.user.isSuperAdmin` is true).
116
- - `@Roles(...roles: string[])`: Sets required role names for a controller or route method.
117
- - `@Public()` / `@IsPublic()` / `@AllowAnonymous()`: Marks a controller or route as public, instructing global authentication guards to bypass credential checks.
231
+ | Decorator | Target | Arguments | Description |
232
+ | :--- | :--- | :--- | :--- |
233
+ | `@Permissions(...permissions)` | Class / Method | `string[]` | Enforces required permission strings on the route. |
234
+ | `@Roles(...roles)` | Class / Method | `string[]` | Enforces required user role strings on the route. |
235
+ | `@Public()` / `@IsPublic()` | Class / Method | None | Bypasses global authentication guards. |
118
236
 
119
237
  ---
120
238
 
121
- ## 5. Service Enhancements: Caching, Transactions & Profiling
239
+ ## 6. Response Modifiers & Metadata
122
240
 
123
- - `@Cacheable({ ttl?: number, key?: string | ((...args) => string) })`: Caches method return values in ExisJS's off-heap native memory LRU cache.
124
- - `@CacheEvict({ key: string | ((...args) => string) })`: Evicts cached entries matching the key when the method completes.
125
- - `@Transactional(options?)`: Automatically wraps service operations in an atomic database transaction.
126
- - `@Profile({ thresholdMs?: number, warnSlow?: boolean, log?: Function })`: Profiles method execution time with sub-millisecond precision.
127
- - `OnInit` (`onInit()`): Invoked when the application or service boots up.
128
- - `OnDestroy` (`onDestroy()`): Invoked when the application gracefully terminates.
129
- - `OnModuleInit`, `OnModuleDestroy`, `OnApplicationBootstrap`: Modular lifecycle hooks.
241
+ | Decorator | Target | Signature | Description |
242
+ | :--- | :--- | :--- | :--- |
243
+ | `@HttpCode(code)` | Method | `(code: number) => MethodDecorator` | Sets the default HTTP status code for successful responses. |
244
+ | `@Header(name, value)` | Method | `(name: string, value: string) => MethodDecorator` | Injects a static HTTP response header. |
245
+ | `@Redirect(url, status?)` | Method | `(url: string, status?: number) => MethodDecorator` | Redirects response to target URL. |
246
+ | `@Returns(schema)` | Method | `(schema: any) => MethodDecorator` | Defines response schema for OpenAPI documentation. |
247
+ | `@Hosts(...hosts)` | Class / Method | `(...hosts: string[]) => any` | Restricts route to specific host/subdomain headers. |
248
+ | `@SetMetadata(key, value)` | Class / Method | `(key: string, value: any) => any` | Attaches custom metadata inspectable via `Reflector`. |
130
249
 
131
250
  ---
132
251
 
133
- ## 6. Response & Metadata Modifiers
252
+ ## 7. IoC, Dependency Injection & Modules
134
253
 
135
- - `@HttpCode(code: number)`: Enforces a custom HTTP status code on success.
136
- - `@Header(name: string, value: string)`: Appends an HTTP header to the response.
137
- - `@Returns(schema)`: Attaches response schema for OpenAPI documentation.
138
- - `@Redirect(url: string, statusCode?: number)`: Redirects request to target URL.
139
- - `@Hosts(...hosts: string[])`: Restricts routes to specific Host headers.
140
- - `@SetMetadata(key, value)`: Attaches arbitrary custom metadata to a class or handler method, retrievable via `Reflector`.
141
- - `Reflector`: Utility class to inspect metadata attached by `@SetMetadata`:
142
- - `Reflector.get(key, target)`: Retrieves metadata for a specific target.
143
- - `Reflector.getAllAndOverride(key, targets)`: Retrieves metadata, overriding higher-level targets with lower-level targets.
144
- - `Reflector.getAllAndMerge(key, targets)`: Merges array/object metadata across multiple targets.
254
+ | Decorator | Target | Options | Description |
255
+ | :--- | :--- | :--- | :--- |
256
+ | `@Injectable(options?)` | Class | `{ scope?: 'singleton' \| 'request' \| 'transient' }` | Marks a class as an IoC provider managed by the container. |
257
+ | `@Inject(token)` | Constructor / Property | `ProviderToken<T>` | Injects dependency by class, token string, or symbol. |
258
+ | `@Optional()` | Constructor / Property | None | Allows unresolved dependencies to return `undefined` instead of throwing. |
259
+ | `@Module(metadata)` | Class | `ModuleMetadata` | Declares an application module (`imports`, `controllers`, `providers`, `exports`). |
260
+ | `@Global()` | Class | None | Makes module exports globally available without explicit importing. |
261
+ | `@Boundary(config)` | Class | `BoundaryConfig` | Declares a folder-scoped boundary class. |
145
262
 
146
263
  ---
147
264
 
148
- ## 7. Dependency Injection & Modules
265
+ ## 8. Caching, Transactions & Profiling
149
266
 
150
- - `@Global()`: Marks a `@Module()` as global, automatically making its exported providers available across the entire application without explicit re-importing.
151
- - `@Module({ imports?, controllers?, providers?, exports? })`: OOP class decorator equivalent to `defineModule()` for structuring application modules.
152
- - `@Injectable(options?)`: Marks a service class as an IoC provider managed by the container. Supports `{ scope: 'singleton' | 'request' | 'transient' }`.
153
- - `@Inject(token)`: Constructor parameter and class property decorator from `exisjs/di` for injecting dependencies by class, string, or symbol token.
154
- - `@Optional()`: Parameter and property decorator from `exisjs/di` resolving missing dependencies to `undefined` without throwing.
155
- - `forwardRef(() => Target)`: Creates a lazy forward reference for resolving circular dependencies in constructor or property injection.
156
- - `@Boundary(config)`: Marks a class as a folder-scoped Boundary configuring CORS, headers, exclusions, and pipeline steps.
157
- - `@Server(config)`: Marks a class as a root server definition.
267
+ | Decorator | Target | Options | Description |
268
+ | :--- | :--- | :--- | :--- |
269
+ | `@Cacheable(options)` | Method | `{ ttl?: number, key?: string \| ((...args) => string) }` | Caches method return value in native off-heap LRU cache. |
270
+ | `@CacheEvict(options)` | Method | `{ key: string \| ((...args) => string) }` | Evicts cached keys upon successful method execution. |
271
+ | `@Transactional(options?)` | Method | `TransactionOptions` | Wraps database queries within an atomic transaction. |
272
+ | `@Profile(options?)` | Method | `{ thresholdMs?: number, warnSlow?: boolean }` | Measures and logs method execution latency. |
158
273
 
159
274
  ---
160
275
 
161
- ## 8. Cron & Task Scheduling
276
+ ## 9. Cron & Scheduling Decorators
277
+
278
+ | Decorator | Target | Signature | Description |
279
+ | :--- | :--- | :--- | :--- |
280
+ | `@Cron(schedule, options?)` | Method | `(schedule: string, options?: CronOptions)` | Schedules method to run according to a standard 5-part cron expression. |
281
+ | `@Interval(ms, options?)` | Method | `(ms: number, options?: IntervalOptions)` | Schedules method to execute repeatedly every `ms` milliseconds. |
282
+ | `@TimeoutTask(ms, options?)` | Method | `(ms: number, options?: TimeoutOptions)` | Schedules method to execute once after `ms` milliseconds following boot. |
162
283
 
163
- - `@Cron(schedule: string, options?: CronJobOptions)`: Schedules a class method as a recurring cron job on any `@Injectable()` service.
164
- - `@Interval(ms: number, options?: IntervalOptions)`: Schedules a class method to execute repeatedly every `ms` milliseconds.
165
- - `@TimeoutTask(ms: number, options?: TimeoutOptions)` (alias `@ScheduledTimeout`): Schedules a class method to execute once after `ms` milliseconds following application bootstrap.
166
284
 
167
285