@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.
- package/CHANGELOG.md +78 -0
- package/lib/{index-DW9EPAE6.d.mts → index-D9MNh6Tx.d.mts} +534 -342
- package/lib/index-D9MNh6Tx.d.mts.map +1 -0
- package/lib/{index-pHp-dIGt.d.cts → index-Db1d3cwD.d.cts} +534 -342
- package/lib/index-Db1d3cwD.d.cts.map +1 -0
- package/lib/index.cjs +12 -3
- package/lib/index.d.cts +2 -2
- package/lib/index.d.mts +2 -2
- package/lib/index.mjs +3 -3
- package/lib/legacy-compat/index.cjs +1 -1
- package/lib/legacy-compat/index.cjs.map +1 -1
- package/lib/legacy-compat/index.d.cts +3 -3
- package/lib/legacy-compat/index.d.cts.map +1 -1
- package/lib/legacy-compat/index.d.mts +3 -3
- package/lib/legacy-compat/index.d.mts.map +1 -1
- package/lib/legacy-compat/index.mjs +1 -1
- package/lib/legacy-compat/index.mjs.map +1 -1
- package/lib/{src-QnxR5b7c.cjs → src-BRPtJ9fG.cjs} +474 -53
- package/lib/src-BRPtJ9fG.cjs.map +1 -0
- package/lib/{src-DyvCDuKO.mjs → src-Bo23RIo-.mjs} +454 -51
- package/lib/src-Bo23RIo-.mjs.map +1 -0
- package/lib/testing/index.cjs +346 -29
- package/lib/testing/index.cjs.map +1 -1
- package/lib/testing/index.d.cts +299 -63
- package/lib/testing/index.d.cts.map +1 -1
- package/lib/testing/index.d.mts +299 -63
- package/lib/testing/index.d.mts.map +1 -1
- package/lib/testing/index.mjs +347 -31
- package/lib/testing/index.mjs.map +1 -1
- package/lib/{use-guards.decorator-B6q_N0sf.cjs → use-guards.decorator-Bs8oDHOi.cjs} +29 -99
- package/lib/use-guards.decorator-Bs8oDHOi.cjs.map +1 -0
- package/lib/{use-guards.decorator-kZ3lNK8v.mjs → use-guards.decorator-CzVXuLkz.mjs} +23 -99
- package/lib/use-guards.decorator-CzVXuLkz.mjs.map +1 -0
- package/package.json +4 -4
- package/src/__tests__/controller-resolver.spec.mts +229 -0
- package/src/__tests__/controller.spec.mts +1 -1
- package/src/__tests__/testing-module.spec.mts +459 -0
- package/src/__tests__/unit-testing-module.spec.mts +424 -0
- package/src/decorators/controller.decorator.mts +29 -7
- package/src/decorators/endpoint.decorator.mts +60 -12
- package/src/decorators/module.decorator.mts +23 -5
- package/src/decorators/multipart.decorator.mts +67 -24
- package/src/decorators/stream.decorator.mts +65 -24
- package/src/interfaces/abstract-http-handler-adapter.interface.mts +31 -1
- package/src/legacy-compat/__type-tests__/legacy-decorators.spec-d.mts +2 -6
- package/src/legacy-compat/decorators/endpoint.decorator.mts +1 -1
- package/src/legacy-compat/decorators/multipart.decorator.mts +5 -5
- package/src/legacy-compat/decorators/stream.decorator.mts +5 -5
- package/src/logger/logger.service.mts +0 -2
- package/src/navios.application.mts +23 -9
- package/src/navios.environment.mts +3 -1
- package/src/navios.factory.mts +19 -18
- package/src/services/guard-runner.service.mts +46 -9
- package/src/services/index.mts +1 -0
- package/src/services/instance-resolver.service.mts +187 -0
- package/src/services/module-loader.service.mts +3 -2
- package/src/stores/request-id.store.mts +45 -3
- package/src/testing/index.mts +1 -0
- package/src/testing/testing-module.mts +255 -93
- package/src/testing/unit-testing-module.mts +298 -0
- package/src/tokens/index.mts +1 -0
- package/src/tokens/navios-options.token.mts +6 -0
- package/lib/index-DW9EPAE6.d.mts.map +0 -1
- package/lib/index-pHp-dIGt.d.cts.map +0 -1
- package/lib/src-DyvCDuKO.mjs.map +0 -1
- package/lib/src-QnxR5b7c.cjs.map +0 -1
- package/lib/use-guards.decorator-B6q_N0sf.cjs.map +0 -1
- 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
|