fragment-ts 1.0.33 → 1.0.35

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 (88) hide show
  1. package/API.md +248 -38
  2. package/DOCS.md +327 -63
  3. package/NewCLIGENERATECOMMANDS.txt +5 -0
  4. package/README.md +168 -3
  5. package/USAGE.md +395 -2
  6. package/dist/cli/commands/build.command.d.ts.map +1 -1
  7. package/dist/cli/commands/build.command.js +20 -8
  8. package/dist/cli/commands/build.command.js.map +1 -1
  9. package/dist/cli/commands/diagnostics.command.d.ts +1 -2
  10. package/dist/cli/commands/diagnostics.command.d.ts.map +1 -1
  11. package/dist/cli/commands/diagnostics.command.js +37 -23
  12. package/dist/cli/commands/diagnostics.command.js.map +1 -1
  13. package/dist/cli/commands/generate.command.d.ts +5 -1
  14. package/dist/cli/commands/generate.command.d.ts.map +1 -1
  15. package/dist/cli/commands/generate.command.js +171 -39
  16. package/dist/cli/commands/generate.command.js.map +1 -1
  17. package/dist/cli/commands/init.command.d.ts.map +1 -1
  18. package/dist/cli/commands/init.command.js +98 -28
  19. package/dist/cli/commands/init.command.js.map +1 -1
  20. package/dist/cli/commands/migrate.command.d.ts +10 -17
  21. package/dist/cli/commands/migrate.command.d.ts.map +1 -1
  22. package/dist/cli/commands/migrate.command.js +133 -170
  23. package/dist/cli/commands/migrate.command.js.map +1 -1
  24. package/dist/cli/commands/serve.command.d.ts.map +1 -1
  25. package/dist/cli/commands/serve.command.js +9 -4
  26. package/dist/cli/commands/serve.command.js.map +1 -1
  27. package/dist/cli/commands/test.command.d.ts.map +1 -1
  28. package/dist/cli/commands/test.command.js +24 -6
  29. package/dist/cli/commands/test.command.js.map +1 -1
  30. package/dist/core/decorators/exception-filter.decorator.d.ts.map +1 -1
  31. package/dist/core/decorators/exception-filter.decorator.js +11 -4
  32. package/dist/core/decorators/exception-filter.decorator.js.map +1 -1
  33. package/dist/core/decorators/guard.decorator.d.ts.map +1 -1
  34. package/dist/core/decorators/guard.decorator.js +11 -4
  35. package/dist/core/decorators/guard.decorator.js.map +1 -1
  36. package/dist/core/decorators/interceptor.decorator.d.ts.map +1 -1
  37. package/dist/core/decorators/interceptor.decorator.js +10 -4
  38. package/dist/core/decorators/interceptor.decorator.js.map +1 -1
  39. package/dist/core/decorators/middleware.decorator.d.ts.map +1 -1
  40. package/dist/core/decorators/middleware.decorator.js +8 -4
  41. package/dist/core/decorators/middleware.decorator.js.map +1 -1
  42. package/dist/core/scanner/component-scanner.d.ts +12 -0
  43. package/dist/core/scanner/component-scanner.d.ts.map +1 -1
  44. package/dist/core/scanner/component-scanner.js +72 -14
  45. package/dist/core/scanner/component-scanner.js.map +1 -1
  46. package/dist/shared/config.utils.d.ts +58 -0
  47. package/dist/shared/config.utils.d.ts.map +1 -0
  48. package/dist/shared/config.utils.js +137 -0
  49. package/dist/shared/config.utils.js.map +1 -0
  50. package/dist/shared/env.utils.d.ts +27 -0
  51. package/dist/shared/env.utils.d.ts.map +1 -0
  52. package/dist/shared/env.utils.js +68 -0
  53. package/dist/shared/env.utils.js.map +1 -0
  54. package/dist/shared/tsconfig.utils.d.ts +122 -0
  55. package/dist/shared/tsconfig.utils.d.ts.map +1 -0
  56. package/dist/shared/tsconfig.utils.js +305 -0
  57. package/dist/shared/tsconfig.utils.js.map +1 -0
  58. package/dist/testing/runner.d.ts +9 -1
  59. package/dist/testing/runner.d.ts.map +1 -1
  60. package/dist/testing/runner.js +50 -10
  61. package/dist/testing/runner.js.map +1 -1
  62. package/dist/typeorm/typeorm-module.d.ts +1 -0
  63. package/dist/typeorm/typeorm-module.d.ts.map +1 -1
  64. package/dist/typeorm/typeorm-module.js +193 -85
  65. package/dist/typeorm/typeorm-module.js.map +1 -1
  66. package/dist/web/application.d.ts +0 -1
  67. package/dist/web/application.d.ts.map +1 -1
  68. package/dist/web/application.js +4 -26
  69. package/dist/web/application.js.map +1 -1
  70. package/package.json +1 -1
  71. package/src/cli/commands/build.command.ts +24 -9
  72. package/src/cli/commands/diagnostics.command.ts +42 -30
  73. package/src/cli/commands/generate.command.ts +212 -52
  74. package/src/cli/commands/init.command.ts +100 -29
  75. package/src/cli/commands/migrate.command.ts +145 -198
  76. package/src/cli/commands/serve.command.ts +181 -170
  77. package/src/cli/commands/test.command.ts +25 -11
  78. package/src/core/decorators/exception-filter.decorator.ts +29 -6
  79. package/src/core/decorators/guard.decorator.ts +28 -5
  80. package/src/core/decorators/interceptor.decorator.ts +32 -6
  81. package/src/core/decorators/middleware.decorator.ts +30 -6
  82. package/src/core/scanner/component-scanner.ts +100 -18
  83. package/src/shared/config.utils.ts +148 -0
  84. package/src/shared/env.utils.ts +72 -0
  85. package/src/shared/tsconfig.utils.ts +360 -0
  86. package/src/testing/runner.ts +62 -14
  87. package/src/typeorm/typeorm-module.ts +209 -86
  88. package/src/web/application.ts +4 -33
package/API.md CHANGED
@@ -1,3 +1,5 @@
1
+ ---
2
+
1
3
  # API Reference
2
4
 
3
5
  ## Core Decorators
@@ -7,6 +9,7 @@
7
9
  Application class decorator that configures the web server.
8
10
 
9
11
  **Parameters:**
12
+
10
13
  - `options` (ApplicationOptions, optional):
11
14
  - `port`: number (default: 3000) - Server port
12
15
  - `host`: string (default: "0.0.0.0") - Server host
@@ -14,11 +17,12 @@ Application class decorator that configures the web server.
14
17
  - `autoScan`: boolean (default: true) - Enable automatic component scanning
15
18
 
16
19
  **Example:**
20
+
17
21
  ```typescript
18
22
  @FragmentApplication({
19
23
  port: 8080,
20
- host: 'localhost',
21
- autoScan: true
24
+ host: "localhost",
25
+ autoScan: true,
22
26
  })
23
27
  export class Application {}
24
28
  ```
@@ -28,11 +32,13 @@ export class Application {}
28
32
  Class decorator that marks a class as an HTTP controller.
29
33
 
30
34
  **Parameters:**
35
+
31
36
  - `path`: string (optional) - Base route path for all methods in this controller
32
37
 
33
38
  **Example:**
39
+
34
40
  ```typescript
35
- @Controller('/users')
41
+ @Controller("/users")
36
42
  export class UserController {}
37
43
  ```
38
44
 
@@ -41,6 +47,7 @@ export class UserController {}
41
47
  Class decorator that marks a class as a service (singleton-scoped by default).
42
48
 
43
49
  **Example:**
50
+
44
51
  ```typescript
45
52
  @Service()
46
53
  export class UserService {}
@@ -51,6 +58,7 @@ export class UserService {}
51
58
  Class decorator that marks a class as a repository (singleton-scoped by default).
52
59
 
53
60
  **Example:**
61
+
54
62
  ```typescript
55
63
  @Repository()
56
64
  export class UserRepository {}
@@ -61,6 +69,7 @@ export class UserRepository {}
61
69
  Class decorator that marks a class as an auto-configuration component. These are loaded automatically and can conditionally register beans.
62
70
 
63
71
  **Example:**
72
+
64
73
  ```typescript
65
74
  @AutoConfiguration()
66
75
  export class DatabaseAutoConfiguration {}
@@ -71,14 +80,111 @@ export class DatabaseAutoConfiguration {}
71
80
  Class decorator that marks a class as injectable with a specific scope.
72
81
 
73
82
  **Parameters:**
83
+
74
84
  - `scope`: "singleton" | "request" | "transient" (default: "singleton")
75
85
 
76
86
  **Example:**
87
+
77
88
  ```typescript
78
- @Injectable('transient')
89
+ @Injectable("transient")
79
90
  export class RequestLogger {}
80
91
  ```
81
92
 
93
+ ## Enhancement Decorators
94
+
95
+ ### `@FragmentMiddleware(middlewareClass)`
96
+
97
+ Class or method decorator that applies Express-compatible middleware to controllers or routes.
98
+
99
+ **Parameters:**
100
+
101
+ - `middlewareClass`: Class implementing `Middleware` interface
102
+
103
+ **Example:**
104
+
105
+ ```typescript
106
+ @FragmentMiddleware(AuthMiddleware)
107
+ @Controller("/api")
108
+ export class AppController {}
109
+
110
+ // Or on a specific route
111
+ @Controller("/api")
112
+ export class AppController {
113
+ @Get("/health")
114
+ @FragmentMiddleware(LoggingMiddleware)
115
+ health() {}
116
+ }
117
+ ```
118
+
119
+ ### `@FragmentGuard(guardClass)`
120
+
121
+ Class or method decorator that applies authorization/activation guards to controllers or routes.
122
+
123
+ **Parameters:**
124
+
125
+ - `guardClass`: Class implementing `Guard` interface
126
+
127
+ **Example:**
128
+
129
+ ```typescript
130
+ @FragmentGuard(AuthGuard)
131
+ @Controller("/secure")
132
+ export class SecureController {}
133
+
134
+ // Or on a specific route
135
+ @Controller("/api")
136
+ export class AppController {
137
+ @Get("/admin")
138
+ @FragmentGuard(AdminGuard)
139
+ adminData() {}
140
+ }
141
+ ```
142
+
143
+ ### `@FragmentInterceptor(interceptorClass)`
144
+
145
+ Class or method decorator that applies interceptors to transform request/response data.
146
+
147
+ **Parameters:**
148
+
149
+ - `interceptorClass`: Class implementing `Interceptor` interface
150
+
151
+ **Example:**
152
+
153
+ ```typescript
154
+ @FragmentInterceptor(TransformInterceptor)
155
+ @Controller("/api")
156
+ export class DataController {}
157
+
158
+ // Or on a specific route
159
+ @Controller("/api")
160
+ export class AppController {
161
+ @Get("/data")
162
+ @FragmentInterceptor(CacheInterceptor)
163
+ getData() {}
164
+ }
165
+ ```
166
+
167
+ ### `@FragmentExceptionFilter(filterClass)`
168
+
169
+ Class or method decorator that applies exception filters for error handling.
170
+
171
+ **Parameters:**
172
+
173
+ - `filterClass`: Class implementing `ExceptionFilter` interface
174
+
175
+ **Example:**
176
+
177
+ ```typescript
178
+ @FragmentExceptionFilter(GlobalExceptionFilter)
179
+ @FragmentApplication()
180
+ export class Application {}
181
+
182
+ // Or on a controller
183
+ @FragmentExceptionFilter(DatabaseExceptionFilter)
184
+ @Controller("/api")
185
+ export class AppController {}
186
+ ```
187
+
82
188
  ## Property Decorators
83
189
 
84
190
  ### `@Autowired()`
@@ -86,6 +192,7 @@ export class RequestLogger {}
86
192
  Property decorator that injects a dependency based on its type.
87
193
 
88
194
  **Example:**
195
+
89
196
  ```typescript
90
197
  class MyService {
91
198
  @Autowired()
@@ -98,14 +205,16 @@ class MyService {
98
205
  Property decorator that injects a dependency by token (string or class).
99
206
 
100
207
  **Parameters:**
208
+
101
209
  - `token`: string | Function - Token to resolve the dependency
102
210
 
103
211
  **Example:**
212
+
104
213
  ```typescript
105
214
  class MyService {
106
- @Inject('Logger')
215
+ @Inject("Logger")
107
216
  private logger!: Logger;
108
-
217
+
109
218
  @Inject(CacheService)
110
219
  private cacheService!: CacheService;
111
220
  }
@@ -116,9 +225,11 @@ class MyService {
116
225
  Property decorator that injects a TypeORM repository for the specified entity.
117
226
 
118
227
  **Parameters:**
228
+
119
229
  - `entity`: Function - Entity class for which to get the repository
120
230
 
121
231
  **Example:**
232
+
122
233
  ```typescript
123
234
  @Repository()
124
235
  class UserRepository {
@@ -132,16 +243,18 @@ class UserRepository {
132
243
  Property decorator that injects configuration values from environment variables or config.
133
244
 
134
245
  **Parameters:**
246
+
135
247
  - `expression`: string - Configuration expression (e.g., "${PORT:3000}")
136
248
 
137
249
  **Example:**
250
+
138
251
  ```typescript
139
252
  @Service()
140
253
  class ConfigService {
141
- @Value('${PORT:3000}')
254
+ @Value("${PORT:3000}")
142
255
  private port!: number;
143
-
144
- @Value('${DB_HOST:localhost}')
256
+
257
+ @Value("${DB_HOST:localhost}")
145
258
  private dbHost!: string;
146
259
  }
147
260
  ```
@@ -151,12 +264,14 @@ class ConfigService {
151
264
  Property decorator that specifies which bean to inject when multiple implementations exist.
152
265
 
153
266
  **Parameters:**
267
+
154
268
  - `name`: string - Qualifier name to match
155
269
 
156
270
  **Example:**
271
+
157
272
  ```typescript
158
273
  class PaymentService {
159
- @Qualifier('creditCard')
274
+ @Qualifier("creditCard")
160
275
  @Autowired()
161
276
  private paymentProcessor!: PaymentProcessor;
162
277
  }
@@ -167,6 +282,7 @@ class PaymentService {
167
282
  Property decorator that marks a dependency as optional (won't throw if not found).
168
283
 
169
284
  **Example:**
285
+
170
286
  ```typescript
171
287
  class FeatureService {
172
288
  @Autowired()
@@ -180,6 +296,7 @@ class FeatureService {
180
296
  Property decorator that lazily loads a dependency on first access.
181
297
 
182
298
  **Example:**
299
+
183
300
  ```typescript
184
301
  class HeavyService {
185
302
  @Lazy()
@@ -195,6 +312,7 @@ class HeavyService {
195
312
  Method decorator that marks a method to be called after dependency injection is complete.
196
313
 
197
314
  **Example:**
315
+
198
316
  ```typescript
199
317
  @Service()
200
318
  class DatabaseService {
@@ -210,6 +328,7 @@ class DatabaseService {
210
328
  Method decorator that marks a method to be called before the bean is destroyed.
211
329
 
212
330
  **Example:**
331
+
213
332
  ```typescript
214
333
  @Service()
215
334
  class DatabaseService {
@@ -227,17 +346,19 @@ class DatabaseService {
227
346
  Method decorator for GET HTTP endpoints.
228
347
 
229
348
  **Parameters:**
349
+
230
350
  - `path`: string (optional) - Route path
231
351
 
232
352
  **Example:**
353
+
233
354
  ```typescript
234
- @Controller('/users')
355
+ @Controller("/users")
235
356
  class UserController {
236
357
  @Get()
237
358
  findAll() {}
238
-
239
- @Get('/:id')
240
- findById(@Param('id') id: string) {}
359
+
360
+ @Get("/:id")
361
+ findById(@Param("id") id: string) {}
241
362
  }
242
363
  ```
243
364
 
@@ -246,11 +367,13 @@ class UserController {
246
367
  Method decorator for POST HTTP endpoints.
247
368
 
248
369
  **Parameters:**
370
+
249
371
  - `path`: string (optional) - Route path
250
372
 
251
373
  **Example:**
374
+
252
375
  ```typescript
253
- @Controller('/users')
376
+ @Controller("/users")
254
377
  class UserController {
255
378
  @Post()
256
379
  create(@Body() createUserDto: CreateUserDto) {}
@@ -262,14 +385,16 @@ class UserController {
262
385
  Method decorator for PUT HTTP endpoints.
263
386
 
264
387
  **Parameters:**
388
+
265
389
  - `path`: string (optional) - Route path
266
390
 
267
391
  **Example:**
392
+
268
393
  ```typescript
269
- @Controller('/users')
394
+ @Controller("/users")
270
395
  class UserController {
271
- @Put('/:id')
272
- update(@Param('id') id: string, @Body() updateUserDto: UpdateUserDto) {}
396
+ @Put("/:id")
397
+ update(@Param("id") id: string, @Body() updateUserDto: UpdateUserDto) {}
273
398
  }
274
399
  ```
275
400
 
@@ -278,14 +403,16 @@ class UserController {
278
403
  Method decorator for DELETE HTTP endpoints.
279
404
 
280
405
  **Parameters:**
406
+
281
407
  - `path`: string (optional) - Route path
282
408
 
283
409
  **Example:**
410
+
284
411
  ```typescript
285
- @Controller('/users')
412
+ @Controller("/users")
286
413
  class UserController {
287
- @Delete('/:id')
288
- delete(@Param('id') id: string) {}
414
+ @Delete("/:id")
415
+ delete(@Param("id") id: string) {}
289
416
  }
290
417
  ```
291
418
 
@@ -294,14 +421,16 @@ class UserController {
294
421
  Method decorator for PATCH HTTP endpoints.
295
422
 
296
423
  **Parameters:**
424
+
297
425
  - `path`: string (optional) - Route path
298
426
 
299
427
  **Example:**
428
+
300
429
  ```typescript
301
- @Controller('/users')
430
+ @Controller("/users")
302
431
  class UserController {
303
- @Patch('/:id')
304
- partialUpdate(@Param('id') id: string, @Body() partialUser: Partial<User>) {}
432
+ @Patch("/:id")
433
+ partialUpdate(@Param("id") id: string, @Body() partialUser: Partial<User>) {}
305
434
  }
306
435
  ```
307
436
 
@@ -312,6 +441,7 @@ class UserController {
312
441
  Parameter decorator to inject the request body.
313
442
 
314
443
  **Example:**
444
+
315
445
  ```typescript
316
446
  @Post()
317
447
  create(@Body() createUserDto: CreateUserDto) {}
@@ -322,9 +452,11 @@ create(@Body() createUserDto: CreateUserDto) {}
322
452
  Parameter decorator to inject route parameters.
323
453
 
324
454
  **Parameters:**
455
+
325
456
  - `name`: string (optional) - Specific parameter name to extract
326
457
 
327
458
  **Example:**
459
+
328
460
  ```typescript
329
461
  @Get('/:id')
330
462
  findById(@Param('id') id: string) {}
@@ -338,9 +470,11 @@ findPost(@Param() params: { userId: string, postId: string }) {}
338
470
  Parameter decorator to inject query parameters.
339
471
 
340
472
  **Parameters:**
473
+
341
474
  - `name`: string (optional) - Specific query parameter name to extract
342
475
 
343
476
  **Example:**
477
+
344
478
  ```typescript
345
479
  @Get()
346
480
  search(@Query('q') query: string, @Query('page') page: number) {}
@@ -354,9 +488,11 @@ filter(@Query() queryParams: { category?: string, minPrice?: number }) {}
354
488
  Parameter decorator to inject request headers.
355
489
 
356
490
  **Parameters:**
491
+
357
492
  - `name`: string (optional) - Specific header name to extract
358
493
 
359
494
  **Example:**
495
+
360
496
  ```typescript
361
497
  @Get()
362
498
  getWithHeaders(@Header('authorization') authHeader: string) {}
@@ -370,6 +506,7 @@ getInfo(@Header() headers: Record<string, string>) {}
370
506
  Parameter decorator to inject the Express Request object.
371
507
 
372
508
  **Example:**
509
+
373
510
  ```typescript
374
511
  @Get()
375
512
  handleRequest(@Req() req: Request) {
@@ -382,6 +519,7 @@ handleRequest(@Req() req: Request) {
382
519
  Parameter decorator to inject the Express Response object.
383
520
 
384
521
  **Example:**
522
+
385
523
  ```typescript
386
524
  @Get('/file')
387
525
  getFile(@Res() res: Response) {
@@ -396,9 +534,11 @@ getFile(@Res() res: Response) {
396
534
  Class decorator that registers the component only if the specified class is available.
397
535
 
398
536
  **Parameters:**
537
+
399
538
  - `classRef`: any - Reference to the class to check for
400
539
 
401
540
  **Example:**
541
+
402
542
  ```typescript
403
543
  @AutoConfiguration()
404
544
  @ConditionalOnClass(Redis)
@@ -410,9 +550,11 @@ class RedisAutoConfiguration {}
410
550
  Class decorator that registers the component only if no bean of the specified type is already registered.
411
551
 
412
552
  **Parameters:**
553
+
413
554
  - `token`: any - Token or class to check for
414
555
 
415
556
  **Example:**
557
+
416
558
  ```typescript
417
559
  @Service()
418
560
  @ConditionalOnMissingBean(LoggerService)
@@ -424,13 +566,15 @@ class DefaultLoggerService implements LoggerService {}
424
566
  Class decorator that registers the component only if the specified environment property exists (and optionally matches a value).
425
567
 
426
568
  **Parameters:**
569
+
427
570
  - `key`: string - Environment variable key to check
428
571
  - `expectedValue`: any (optional) - Expected value of the environment variable
429
572
 
430
573
  **Example:**
574
+
431
575
  ```typescript
432
576
  @Service()
433
- @ConditionalOnProperty('USE_CACHE', 'true')
577
+ @ConditionalOnProperty("USE_CACHE", "true")
434
578
  class CacheService {}
435
579
  ```
436
580
 
@@ -443,6 +587,7 @@ Returns the singleton instance of the dependency injection container.
443
587
  **Returns:** DIContainer
444
588
 
445
589
  **Example:**
590
+
446
591
  ```typescript
447
592
  const container = DIContainer.getInstance();
448
593
  ```
@@ -452,11 +597,13 @@ const container = DIContainer.getInstance();
452
597
  Registers a token with an instance or factory function.
453
598
 
454
599
  **Parameters:**
600
+
455
601
  - `token`: any - Token to register
456
602
  - `instance`: any (optional) - Instance to register
457
603
  - `factory`: () => any (optional) - Factory function to create instances
458
604
 
459
605
  **Example:**
606
+
460
607
  ```typescript
461
608
  container.register(LoggerService, new ConsoleLogger());
462
609
  container.register(DatabaseService, null, () => new DatabaseService());
@@ -467,11 +614,13 @@ container.register(DatabaseService, null, () => new DatabaseService());
467
614
  Resolves and returns an instance for the specified token.
468
615
 
469
616
  **Parameters:**
617
+
470
618
  - `token`: any - Token to resolve
471
619
 
472
620
  **Returns:** T - Resolved instance
473
621
 
474
622
  **Example:**
623
+
475
624
  ```typescript
476
625
  const userService = container.resolve(UserService);
477
626
  ```
@@ -481,11 +630,13 @@ const userService = container.resolve(UserService);
481
630
  Checks if a token has been registered with the container.
482
631
 
483
632
  **Parameters:**
633
+
484
634
  - `token`: any - Token to check
485
635
 
486
636
  **Returns:** boolean
487
637
 
488
638
  **Example:**
639
+
489
640
  ```typescript
490
641
  if (container.has(UserService)) {
491
642
  // Service is registered
@@ -499,6 +650,7 @@ Returns all singleton instances maintained by the container.
499
650
  **Returns:** any[]
500
651
 
501
652
  **Example:**
653
+
502
654
  ```typescript
503
655
  const allServices = container.getAllInstances();
504
656
  ```
@@ -508,6 +660,7 @@ const allServices = container.getAllInstances();
508
660
  Clears all registered tokens and instances from the container.
509
661
 
510
662
  **Example:**
663
+
511
664
  ```typescript
512
665
  container.clear();
513
666
  ```
@@ -517,6 +670,7 @@ container.clear();
517
670
  Resets the container to its initial state.
518
671
 
519
672
  **Example:**
673
+
520
674
  ```typescript
521
675
  container.reset();
522
676
  ```
@@ -528,6 +682,7 @@ container.reset();
528
682
  Creates a new instance of the web application.
529
683
 
530
684
  **Example:**
685
+
531
686
  ```typescript
532
687
  const app = new FragmentWebApplication();
533
688
  ```
@@ -537,11 +692,13 @@ const app = new FragmentWebApplication();
537
692
  Bootstraps the application with the specified application class.
538
693
 
539
694
  **Parameters:**
695
+
540
696
  - `appClass`: any - Application class decorated with `@FragmentApplication`
541
697
 
542
698
  **Returns:** Promise<void>
543
699
 
544
700
  **Example:**
701
+
545
702
  ```typescript
546
703
  await app.bootstrap(Application);
547
704
  ```
@@ -553,9 +710,10 @@ Returns the underlying Express application instance.
553
710
  **Returns:** Express
554
711
 
555
712
  **Example:**
713
+
556
714
  ```typescript
557
715
  const expressApp = app.getExpressApp();
558
- expressApp.use('/custom', customMiddleware);
716
+ expressApp.use("/custom", customMiddleware);
559
717
  ```
560
718
 
561
719
  ## Metadata Storage API
@@ -567,6 +725,7 @@ Returns the singleton instance of the metadata storage.
567
725
  **Returns:** MetadataStorage
568
726
 
569
727
  **Example:**
728
+
570
729
  ```typescript
571
730
  const storage = MetadataStorage.getInstance();
572
731
  ```
@@ -576,14 +735,16 @@ const storage = MetadataStorage.getInstance();
576
735
  Adds class metadata to storage.
577
736
 
578
737
  **Parameters:**
738
+
579
739
  - `metadata`: ClassMetadata - Class metadata object
580
740
 
581
741
  **Example:**
742
+
582
743
  ```typescript
583
744
  storage.addClass({
584
745
  target: UserService,
585
- type: 'service',
586
- scope: 'singleton'
746
+ type: "service",
747
+ scope: "singleton",
587
748
  });
588
749
  ```
589
750
 
@@ -592,11 +753,13 @@ storage.addClass({
592
753
  Retrieves class metadata for the specified target.
593
754
 
594
755
  **Parameters:**
756
+
595
757
  - `target`: any - Target class
596
758
 
597
759
  **Returns:** ClassMetadata | undefined
598
760
 
599
761
  **Example:**
762
+
600
763
  ```typescript
601
764
  const metadata = storage.getClass(UserService);
602
765
  ```
@@ -608,6 +771,7 @@ Returns all registered class metadata.
608
771
  **Returns:** ClassMetadata[]
609
772
 
610
773
  **Example:**
774
+
611
775
  ```typescript
612
776
  const allClasses = storage.getAllClasses();
613
777
  ```
@@ -617,9 +781,11 @@ const allClasses = storage.getAllClasses();
617
781
  Adds method metadata to storage.
618
782
 
619
783
  **Parameters:**
784
+
620
785
  - `metadata`: MethodMetadata - Method metadata object
621
786
 
622
787
  **Example:**
788
+
623
789
  ```typescript
624
790
  storage.addMethod({
625
791
  target: UserController,
@@ -635,14 +801,16 @@ storage.addMethod({
635
801
  Retrieves method metadata for the specified target and property key.
636
802
 
637
803
  **Parameters:**
804
+
638
805
  - `target`: any - Target class
639
806
  - `propertyKey`: string - Method name
640
807
 
641
808
  **Returns:** MethodMetadata | undefined
642
809
 
643
810
  **Example:**
811
+
644
812
  ```typescript
645
- const metadata = storage.getMethod(UserController, 'findAll');
813
+ const metadata = storage.getMethod(UserController, "findAll");
646
814
  ```
647
815
 
648
816
  ### `storage.getAllMethods()`
@@ -652,6 +820,7 @@ Returns all registered method metadata.
652
820
  **Returns:** MethodMetadata[]
653
821
 
654
822
  **Example:**
823
+
655
824
  ```typescript
656
825
  const allMethods = storage.getAllMethods();
657
826
  ```
@@ -661,16 +830,18 @@ const allMethods = storage.getAllMethods();
661
830
  Adds parameter metadata to storage.
662
831
 
663
832
  **Parameters:**
833
+
664
834
  - `metadata`: ParamMetadata - Parameter metadata object
665
835
 
666
836
  **Example:**
837
+
667
838
  ```typescript
668
839
  storage.addParam({
669
840
  target: UserController.prototype,
670
- propertyKey: 'findById',
841
+ propertyKey: "findById",
671
842
  index: 0,
672
- type: 'param',
673
- paramName: 'id'
843
+ type: "param",
844
+ paramName: "id",
674
845
  });
675
846
  ```
676
847
 
@@ -679,14 +850,16 @@ storage.addParam({
679
850
  Retrieves parameter metadata for the specified target and property key.
680
851
 
681
852
  **Parameters:**
853
+
682
854
  - `target`: any - Target class
683
855
  - `propertyKey`: string - Method name
684
856
 
685
857
  **Returns:** ParamMetadata[]
686
858
 
687
859
  **Example:**
860
+
688
861
  ```typescript
689
- const params = storage.getParams(UserController.prototype, 'findById');
862
+ const params = storage.getParams(UserController.prototype, "findById");
690
863
  ```
691
864
 
692
865
  ## Interfaces
@@ -707,8 +880,13 @@ interface ApplicationOptions {
707
880
  ```typescript
708
881
  interface ClassMetadata {
709
882
  target: any;
710
- type: 'injectable' | 'service' | 'controller' | 'repository' | 'auto-configuration';
711
- scope?: 'singleton' | 'request' | 'transient';
883
+ type:
884
+ | "injectable"
885
+ | "service"
886
+ | "controller"
887
+ | "repository"
888
+ | "auto-configuration";
889
+ scope?: "singleton" | "request" | "transient";
712
890
  path?: string;
713
891
  }
714
892
  ```
@@ -732,21 +910,53 @@ interface ParamMetadata {
732
910
  target: any;
733
911
  propertyKey: string;
734
912
  index: number;
735
- type: 'body' | 'param' | 'query' | 'header' | 'req' | 'res';
913
+ type: "body" | "param" | "query" | "header" | "req" | "res";
736
914
  paramName?: string;
737
915
  }
738
916
  ```
739
917
 
918
+ ### `Middleware`
919
+
920
+ ```typescript
921
+ interface Middleware {
922
+ use(req: Request, res: Response, next: NextFunction): void | Promise<void>;
923
+ }
924
+ ```
925
+
926
+ ### `Guard`
927
+
928
+ ```typescript
929
+ interface Guard {
930
+ canActivate(req: Request): boolean | Promise<boolean>;
931
+ }
932
+ ```
933
+
934
+ ### `Interceptor`
935
+
936
+ ```typescript
937
+ interface Interceptor {
938
+ intercept(req: Request, res: Response, result: any): any | Promise<any>;
939
+ }
940
+ ```
941
+
942
+ ### `ExceptionFilter`
943
+
944
+ ```typescript
945
+ interface ExceptionFilter {
946
+ catch(exception: Error, req: Request, res: Response): void;
947
+ }
948
+ ```
949
+
740
950
  ## Type Definitions
741
951
 
742
952
  ### `Scope`
743
953
 
744
954
  ```typescript
745
- type Scope = 'singleton' | 'request' | 'transient';
955
+ type Scope = "singleton" | "request" | "transient";
746
956
  ```
747
957
 
748
958
  ### `MetadataKey`
749
959
 
750
960
  ```typescript
751
961
  type MetadataKey = (typeof METADATA_KEYS)[keyof typeof METADATA_KEYS];
752
- ```
962
+ ```