@navios/core 1.0.0-alpha.2 → 1.0.0-alpha.4

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 (93) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/lib/{index-BJjk2X1S.d.mts → index-6S7veHKD.d.mts} +845 -294
  3. package/lib/index-6S7veHKD.d.mts.map +1 -0
  4. package/lib/{index-DZ6NU03y.d.cts → index-r0i2txmg.d.cts} +845 -294
  5. package/lib/index-r0i2txmg.d.cts.map +1 -0
  6. package/lib/index.cjs +4420 -84
  7. package/lib/index.cjs.map +1 -0
  8. package/lib/index.d.cts +2 -2
  9. package/lib/index.d.mts +2 -2
  10. package/lib/index.mjs +4328 -3
  11. package/lib/index.mjs.map +1 -0
  12. package/lib/legacy-compat/index.cjs +41 -126
  13. package/lib/legacy-compat/index.cjs.map +1 -1
  14. package/lib/legacy-compat/index.d.cts +4 -60
  15. package/lib/legacy-compat/index.d.cts.map +1 -1
  16. package/lib/legacy-compat/index.d.mts +4 -60
  17. package/lib/legacy-compat/index.d.mts.map +1 -1
  18. package/lib/legacy-compat/index.mjs +14 -119
  19. package/lib/legacy-compat/index.mjs.map +1 -1
  20. package/lib/navios.factory-BanZIvtR.cjs +4134 -0
  21. package/lib/navios.factory-BanZIvtR.cjs.map +1 -0
  22. package/lib/navios.factory-C75yZCoD.mjs +3831 -0
  23. package/lib/navios.factory-C75yZCoD.mjs.map +1 -0
  24. package/lib/testing/index.cjs +3 -3
  25. package/lib/testing/index.cjs.map +1 -1
  26. package/lib/testing/index.d.cts +1 -1
  27. package/lib/testing/index.d.mts +1 -1
  28. package/lib/testing/index.mjs +2 -2
  29. package/lib/tokens-4J9sredA.mjs +100 -0
  30. package/lib/tokens-4J9sredA.mjs.map +1 -0
  31. package/lib/tokens-BuXXB01L.cjs +196 -0
  32. package/lib/tokens-BuXXB01L.cjs.map +1 -0
  33. package/lib/{use-guards.decorator-Be_QUx6b.mjs → use-guards.decorator-BecoQSmE.mjs} +3 -70
  34. package/lib/use-guards.decorator-BecoQSmE.mjs.map +1 -0
  35. package/lib/{use-guards.decorator-B6tghdxM.cjs → use-guards.decorator-DgD-kxF5.cjs} +7 -158
  36. package/lib/use-guards.decorator-DgD-kxF5.cjs.map +1 -0
  37. package/package.json +4 -4
  38. package/src/__tests__/attribute.factory.spec.mts +300 -0
  39. package/src/__tests__/console-logger.service.spec.mts +312 -0
  40. package/src/__tests__/guard-runner.service.spec.mts +399 -0
  41. package/src/__tests__/logger.service.spec.mts +147 -0
  42. package/src/__tests__/responders.spec.mts +6 -5
  43. package/src/factories/adapter.factory.mts +20 -0
  44. package/src/factories/endpoint-adapter.factory.mts +1 -1
  45. package/src/factories/http-adapter.factory.mts +1 -1
  46. package/src/factories/index.mts +1 -0
  47. package/src/factories/multipart-adapter.factory.mts +1 -1
  48. package/src/factories/reply.factory.mts +1 -1
  49. package/src/factories/request.factory.mts +1 -1
  50. package/src/factories/stream-adapter.factory.mts +1 -1
  51. package/src/factories/xml-stream-adapter.factory.mts +1 -1
  52. package/src/index.mts +1 -0
  53. package/src/interfaces/abstract-adapter.interface.mts +32 -0
  54. package/src/interfaces/abstract-http-adapter.interface.mts +27 -20
  55. package/src/interfaces/abstract-http-handler-adapter.interface.mts +86 -2
  56. package/src/interfaces/adapter-environment.interface.mts +74 -0
  57. package/src/interfaces/index.mts +2 -0
  58. package/src/interfaces/plugin.interface.mts +50 -16
  59. package/src/legacy-compat/attribute.factory.mts +2 -2
  60. package/src/legacy-compat/decorators/controller.decorator.mts +1 -1
  61. package/src/legacy-compat/decorators/endpoint.decorator.mts +1 -1
  62. package/src/legacy-compat/decorators/header.decorator.mts +2 -1
  63. package/src/legacy-compat/decorators/http-code.decorator.mts +2 -1
  64. package/src/legacy-compat/decorators/index.mts +2 -2
  65. package/src/legacy-compat/decorators/module.decorator.mts +1 -1
  66. package/src/legacy-compat/decorators/multipart.decorator.mts +1 -1
  67. package/src/legacy-compat/decorators/stream.decorator.mts +1 -1
  68. package/src/legacy-compat/decorators/use-guards.decorator.mts +1 -1
  69. package/src/legacy-compat/index.mts +10 -5
  70. package/src/logger/console-logger.service.mts +97 -7
  71. package/src/metadata/module.metadata.mts +43 -0
  72. package/src/navios.application.mts +172 -60
  73. package/src/navios.environment.mts +22 -12
  74. package/src/navios.factory.mts +31 -10
  75. package/src/services/abstract-handler-adapter.service.mts +366 -0
  76. package/src/services/index.mts +1 -0
  77. package/src/services/module-loader.service.mts +1 -0
  78. package/src/tokens/adapter.token.mts +6 -0
  79. package/src/tokens/http-adapter.token.mts +1 -1
  80. package/src/tokens/index.mts +1 -0
  81. package/src/utils/adapter-supports.util.mts +47 -0
  82. package/src/utils/index.mts +1 -0
  83. package/lib/index-BJjk2X1S.d.mts.map +0 -1
  84. package/lib/index-DZ6NU03y.d.cts.map +0 -1
  85. package/lib/src-C46ePe3d.cjs +0 -8022
  86. package/lib/src-C46ePe3d.cjs.map +0 -1
  87. package/lib/src-K2k0riYJ.mjs +0 -7587
  88. package/lib/src-K2k0riYJ.mjs.map +0 -1
  89. package/lib/use-guards.decorator-B6tghdxM.cjs.map +0 -1
  90. package/lib/use-guards.decorator-Be_QUx6b.mjs.map +0 -1
  91. package/src/legacy-compat/context-compat.mts +0 -95
  92. package/src/legacy-compat/decorators/factory.decorator.mts +0 -37
  93. package/src/legacy-compat/decorators/injectable.decorator.mts +0 -41
package/CHANGELOG.md CHANGED
@@ -5,6 +5,96 @@ 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
+ ## [1.0.0-alpha.4] - 2026-01-09
9
+
10
+ ### Added
11
+
12
+ - **Unified Adapter Architecture**: New abstract adapter system supporting multiple adapter types (HTTP, CLI, etc.)
13
+ - `AbstractAdapterInterface` - Base interface for all adapters with lifecycle methods (`setupAdapter`, `onModulesInit`, `ready`, `dispose`)
14
+ - `AdapterEnvironment` - Base interface for adapter environments with type-safe options
15
+ - `HttpAdapterEnvironment` - Extended environment interface for HTTP adapters with server, CORS, multipart, and listen options types
16
+ - `DefaultAdapterEnvironment` - Default environment with unknown types for generic usage
17
+ - `AdapterToken` - New injection token for accessing the current adapter instance
18
+ - `AdapterFactory` - Factory for creating adapter instances from environment definitions
19
+ - **Type-Safe Application Generic**: `NaviosApplication<TEnvironment>` now accepts an environment type parameter
20
+ - All adapter-specific methods (`configure`, `enableCors`, `enableMultipart`, `listen`, `getServer`) are now properly typed based on the environment
21
+ - Environment types provide IntelliSense for adapter-specific options
22
+ - **Enhanced Plugin System**: Plugins are now typed with adapter constraints
23
+ - `NaviosPlugin<TOptions, TAdapter>` - Second type parameter for adapter-specific plugins
24
+ - `PluginContext<TAdapter>` - Typed context with adapter access
25
+ - Plugins can access `context.adapter` instead of `context.server` for better type safety
26
+ - **Module Custom Entries**: New `customEntries` property on `ModuleMetadata` for adapter-specific module data
27
+ - Allows adapters to store custom metadata on modules (e.g., commands for CLI adapter)
28
+ - **Console Logger Tests**: Added comprehensive test suite for `ConsoleLoggerService`
29
+
30
+ ### Changed
31
+
32
+ - **Renamed Environment Methods**: `getHttpToken` renamed to `getToken` for adapter-agnostic naming
33
+ - **Renamed Environment Property**: `httpTokens` renamed to `tokens` in environment definitions
34
+ - **Application Configuration**: New `configure()` method replaces `setupHttpServer()` for pre-init configuration
35
+ - Configuration options are merged with adapter defaults
36
+ - Must be called before `init()` for options to take effect
37
+ - **Plugin Context**: `PluginContext.server` replaced with `PluginContext.adapter` for accessing the adapter instance
38
+ - Use `context.adapter.getServer()` for HTTP server access
39
+ - `context.globalPrefix` removed; use `context.adapter.getGlobalPrefix()` instead
40
+ - **Abstract HTTP Adapter**: `AbstractHttpAdapterInterface` now extends `AbstractAdapterInterface`
41
+ - Added `configure(options)` method for pre-init configuration
42
+ - Method signatures updated for environment-based typing
43
+
44
+ ### Breaking Changes
45
+
46
+ - **Environment Definition Format**: `httpTokens` property renamed to `tokens`
47
+ - Before: `{ httpTokens: new Map([...]) }`
48
+ - After: `{ tokens: new Map([...]) }`
49
+ - **Plugin Context API**: `context.server` and `context.globalPrefix` removed
50
+ - Before: `const server = context.server`
51
+ - After: `const server = context.adapter.getServer()`
52
+ - Before: `const prefix = context.globalPrefix`
53
+ - After: `const prefix = context.adapter.getGlobalPrefix()`
54
+ - **Application Setup**: `setupHttpServer()` replaced with `configure()`
55
+ - Before: `await app.setupHttpServer({ logger: true })`
56
+ - After: `app.configure({ logger: true }); await app.init()`
57
+
58
+ ### Dependencies
59
+
60
+ - Updated to support unified adapter architecture across all packages
61
+
62
+ ## [1.0.0-alpha.3] - 2026-01-08
63
+
64
+ ### Added
65
+
66
+ - **Abstract Handler Adapter Base Class**: New `AbstractHandlerAdapterService` base class for HTTP handler adapters
67
+ - Provides shared logic for controller resolution (singleton vs request-scoped)
68
+ - Automatic sync/async detection for argument formatting
69
+ - Standardized handler generation with static/dynamic branching
70
+ - Supports all adapter types: endpoint, stream, and multipart
71
+ - **New Handler Adapter Types**: Exported types for adapter implementations
72
+ - `ArgumentGetterFn<TRequest>` - Function type for extracting data from requests
73
+ - `FormatArgumentsFn<TRequest>` - Function type for formatting arguments
74
+ - `AbstractStaticHandler<TRequest, TReply>` - Static handler type for singleton controllers
75
+ - `AbstractDynamicHandler<TRequest, TReply>` - Dynamic handler type for request-scoped controllers
76
+ - `AbstractHandlerResult<TRequest, TReply>` - Union type for handler results
77
+ - `HandlerContext<TConfig>` - Context passed to handler creation methods
78
+ - **Enhanced Handler Adapter Interface**: Extended `AbstractHttpHandlerAdapterInterface` with new optional methods
79
+ - `buildFormatArguments()` - Builds optimized formatArguments function from getters
80
+ - `hasSchema()` - Checks if handler has validation schemas
81
+ - `provideSchema()` - Provides schema information for framework registration
82
+
83
+ ### Changed
84
+
85
+ - **Legacy-Compat DI Re-exports**: `Injectable`, `Factory`, `createClassContext`, and `createMethodContext` are now re-exported from `@navios/di/legacy-compat` instead of being defined locally
86
+ - Removes code duplication between core and di packages
87
+ - Ensures consistent behavior across the framework
88
+
89
+ ### Removed
90
+
91
+ - **Local DI Decorators**: Removed local `Injectable` and `Factory` decorator implementations from legacy-compat (now imported from `@navios/di/legacy-compat`)
92
+ - **Context Compat Module**: Removed `context-compat.mts` module (functionality moved to `@navios/di`)
93
+
94
+ ### Dependencies
95
+
96
+ - Updated to support `@navios/di` with legacy-compat exports
97
+
8
98
  ## [1.0.0-alpha.2] - 2026-01-07
9
99
 
10
100
  ### Added