@navios/core 0.7.1 → 0.9.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 (68) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/lib/{index-DW9EPAE6.d.mts → index-D9MNh6Tx.d.mts} +534 -342
  3. package/lib/index-D9MNh6Tx.d.mts.map +1 -0
  4. package/lib/{index-pHp-dIGt.d.cts → index-Db1d3cwD.d.cts} +534 -342
  5. package/lib/index-Db1d3cwD.d.cts.map +1 -0
  6. package/lib/index.cjs +12 -3
  7. package/lib/index.d.cts +2 -2
  8. package/lib/index.d.mts +2 -2
  9. package/lib/index.mjs +3 -3
  10. package/lib/legacy-compat/index.cjs +1 -1
  11. package/lib/legacy-compat/index.cjs.map +1 -1
  12. package/lib/legacy-compat/index.d.cts +3 -3
  13. package/lib/legacy-compat/index.d.cts.map +1 -1
  14. package/lib/legacy-compat/index.d.mts +3 -3
  15. package/lib/legacy-compat/index.d.mts.map +1 -1
  16. package/lib/legacy-compat/index.mjs +1 -1
  17. package/lib/legacy-compat/index.mjs.map +1 -1
  18. package/lib/{src-QnxR5b7c.cjs → src-BRPtJ9fG.cjs} +474 -53
  19. package/lib/src-BRPtJ9fG.cjs.map +1 -0
  20. package/lib/{src-DyvCDuKO.mjs → src-Bo23RIo-.mjs} +454 -51
  21. package/lib/src-Bo23RIo-.mjs.map +1 -0
  22. package/lib/testing/index.cjs +346 -29
  23. package/lib/testing/index.cjs.map +1 -1
  24. package/lib/testing/index.d.cts +299 -63
  25. package/lib/testing/index.d.cts.map +1 -1
  26. package/lib/testing/index.d.mts +299 -63
  27. package/lib/testing/index.d.mts.map +1 -1
  28. package/lib/testing/index.mjs +347 -31
  29. package/lib/testing/index.mjs.map +1 -1
  30. package/lib/{use-guards.decorator-B6q_N0sf.cjs → use-guards.decorator-Bs8oDHOi.cjs} +29 -99
  31. package/lib/use-guards.decorator-Bs8oDHOi.cjs.map +1 -0
  32. package/lib/{use-guards.decorator-kZ3lNK8v.mjs → use-guards.decorator-CzVXuLkz.mjs} +23 -99
  33. package/lib/use-guards.decorator-CzVXuLkz.mjs.map +1 -0
  34. package/package.json +4 -4
  35. package/src/__tests__/controller-resolver.spec.mts +229 -0
  36. package/src/__tests__/controller.spec.mts +1 -1
  37. package/src/__tests__/testing-module.spec.mts +459 -0
  38. package/src/__tests__/unit-testing-module.spec.mts +424 -0
  39. package/src/decorators/controller.decorator.mts +29 -7
  40. package/src/decorators/endpoint.decorator.mts +60 -12
  41. package/src/decorators/module.decorator.mts +23 -5
  42. package/src/decorators/multipart.decorator.mts +67 -24
  43. package/src/decorators/stream.decorator.mts +65 -24
  44. package/src/interfaces/abstract-http-handler-adapter.interface.mts +31 -1
  45. package/src/legacy-compat/__type-tests__/legacy-decorators.spec-d.mts +2 -6
  46. package/src/legacy-compat/decorators/endpoint.decorator.mts +1 -1
  47. package/src/legacy-compat/decorators/multipart.decorator.mts +5 -5
  48. package/src/legacy-compat/decorators/stream.decorator.mts +5 -5
  49. package/src/logger/logger.service.mts +0 -2
  50. package/src/navios.application.mts +23 -9
  51. package/src/navios.environment.mts +3 -1
  52. package/src/navios.factory.mts +19 -18
  53. package/src/services/guard-runner.service.mts +46 -9
  54. package/src/services/index.mts +1 -0
  55. package/src/services/instance-resolver.service.mts +187 -0
  56. package/src/services/module-loader.service.mts +3 -2
  57. package/src/stores/request-id.store.mts +45 -3
  58. package/src/testing/index.mts +1 -0
  59. package/src/testing/testing-module.mts +255 -93
  60. package/src/testing/unit-testing-module.mts +298 -0
  61. package/src/tokens/index.mts +1 -0
  62. package/src/tokens/navios-options.token.mts +6 -0
  63. package/lib/index-DW9EPAE6.d.mts.map +0 -1
  64. package/lib/index-pHp-dIGt.d.cts.map +0 -1
  65. package/lib/src-DyvCDuKO.mjs.map +0 -1
  66. package/lib/src-QnxR5b7c.cjs.map +0 -1
  67. package/lib/use-guards.decorator-B6q_N0sf.cjs.map +0 -1
  68. package/lib/use-guards.decorator-kZ3lNK8v.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,84 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.9.0] - 2025-12-23
9
+
10
+ ### Added
11
+
12
+ - **Priority and Scope Options in Decorators**: Extended decorator options to leverage new DI features
13
+ - `@Controller()` now accepts `priority?: number` and `scope?: InjectableScope` options
14
+ - `@Module()` now accepts `priority?: number` and `registry?: Registry` options
15
+ - **New TestingModule API**: Completely refactored testing module with improved ergonomics
16
+ - New `TestingModule.create()` static method as the primary entry point
17
+ - Fluent API with `overrideProvider(token).useValue()` / `.useClass()` for mocking
18
+ - Automatic request scope creation on `init()` for proper request-scoped service resolution
19
+ - New `getScopedContainer()` method for accessing the request-scoped container
20
+ - Comprehensive assertion helpers delegated from `TestContainer`:
21
+ - `expectResolved()`, `expectNotResolved()` - service resolution tracking
22
+ - `expectSingleton()`, `expectTransient()`, `expectRequestScoped()` - scope assertions
23
+ - `expectCalled()`, `expectCalledWith()`, `expectCallCount()` - method call assertions
24
+ - `recordMethodCall()`, `getMethodCalls()` - manual call tracking
25
+ - `getDependencyGraph()`, `getSimplifiedDependencyGraph()` - debugging utilities
26
+ - **New UnitTestingModule**: Lightweight testing module for isolated unit tests
27
+ - Does NOT load Navios modules or create an application
28
+ - Uses `UnitTestContainer` with strict mode by default
29
+ - Automatic method call tracking via Proxy
30
+ - Auto-mocking mode for unregistered dependencies
31
+ - Provider-based configuration: `UnitTestingModule.create({ providers: [...] })`
32
+ - Methods: `get()`, `close()`, `enableAutoMocking()`, `disableAutoMocking()`
33
+ - Lifecycle assertions: `expectInitialized()`, `expectDestroyed()`, `expectNotDestroyed()`
34
+
35
+ ### Changed
36
+
37
+ - **Registry Support in NaviosFactory**: Factory now passes `options.registry` to Container constructor
38
+ - Allows custom registries to be used when creating applications
39
+ - **NaviosApplication Options Simplified**: Merged `NaviosApplicationContextOptions` into `NaviosApplicationOptions`
40
+ - Added `registry?: Registry` option directly to application options
41
+ - **NaviosEnvironment**: Changed `setupHttpEnvironment()` to merge tokens instead of replacing
42
+ - Allows multiple adapters to contribute HTTP tokens
43
+ - **Module Loader Service**: Uses `getInjectableToken()` for more reliable module name resolution
44
+ - **Legacy Decorators Type Fix**: Fixed URL parameter type inference in multipart and stream decorators
45
+ - URL parameters now correctly typed as `string` instead of `string | number`
46
+
47
+ ### Deprecated
48
+
49
+ - `createTestingModule()` function is deprecated in favor of `TestingModule.create()`
50
+
51
+ ### Dependencies
52
+
53
+ - Updated to `@navios/di` 0.9.0 with priority system, unified storage architecture, and enhanced testing utilities
54
+
55
+ ## [0.8.0] - 2025-12-21
56
+
57
+ ### Added
58
+
59
+ - **Handler Result Types**: New `HandlerResult`, `StaticHandler`, and `DynamicHandler` types for optimized handler dispatch
60
+ - Enables static/dynamic branching for performance optimization in adapters
61
+ - Pre-resolved controllers can use static handlers without per-request container creation
62
+ - **Response Validation Control**: New `validateResponses?: boolean` option in `NaviosApplicationOptions`
63
+ - Allows disabling response validation for performance in production
64
+ - **Request ID Control**: New `enableRequestId?: boolean` option for async local storage optimization
65
+ - Can be disabled when request ID tracking is not needed
66
+ - **Static Guard Execution**: New `runGuardsStatic()` method in `GuardRunnerService`
67
+ - Allows running pre-resolved guard instances for improved performance
68
+ - **Registry Support in Controllers**: `@Controller()` decorator now accepts optional `registry` parameter
69
+ - Enables custom registries for controller-level dependency overrides
70
+ - **NaviosOptionsToken**: New injection token for accessing application options from services
71
+ - **InstanceResolverService Export**: Now exported from `@navios/core/services`
72
+
73
+ ### Changed
74
+
75
+ - **Handler Adapter Interface**: `provideHandler()` now returns `Promise<HandlerResult>` instead of direct handler function
76
+ - Enables adapters to distinguish between static and dynamic handlers
77
+ - **Endpoint Decorator Flexibility**: Now supports optional parameters and no-parameter handlers
78
+ - **Logger Cleanup**: Removed debug console.log statements
79
+
80
+ ### Performance
81
+
82
+ - Static/dynamic handler branching eliminates unnecessary container creation for singleton controllers
83
+ - Guards can be pre-resolved at startup for faster request handling
84
+ - Response validation can be disabled for production performance
85
+
8
86
  ## [0.7.1] - 2025-12-18
9
87
 
10
88
  ### Added