@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
@@ -0,0 +1,32 @@
1
+ import type { ModuleMetadata } from '../metadata/index.mjs'
2
+
3
+ /**
4
+ * Base interface for all Navios adapters (HTTP, CLI, etc.).
5
+ *
6
+ * Adapters implement this interface to provide runtime-specific functionality.
7
+ * This interface defines the common lifecycle methods shared across all adapter types.
8
+ */
9
+ export interface AbstractAdapterInterface {
10
+ /**
11
+ * Sets up the adapter with the provided options.
12
+ * Called during application initialization before modules are initialized.
13
+ */
14
+ setupAdapter(options: unknown): Promise<void>
15
+
16
+ /**
17
+ * Called after all modules are loaded.
18
+ * Adapters use this to register routes, commands, or other module-based functionality.
19
+ */
20
+ onModulesInit(modules: Map<string, ModuleMetadata>): Promise<void>
21
+
22
+ /**
23
+ * Signals that the adapter is ready to handle requests/commands.
24
+ * Called after onModulesInit completes.
25
+ */
26
+ ready(): Promise<void>
27
+
28
+ /**
29
+ * Disposes of the adapter and cleans up resources.
30
+ */
31
+ dispose(): Promise<void>
32
+ }
@@ -1,28 +1,24 @@
1
1
  import type { ModuleMetadata } from '../metadata/index.mjs'
2
- import type { AbstractHttpCorsOptions } from './abstract-http-cors-options.interface.mjs'
3
- import type { AbstractHttpListenOptions } from './abstract-http-listen-options.interface.mjs'
2
+ import type { AbstractAdapterInterface } from './abstract-adapter.interface.mjs'
3
+ import type { HttpAdapterEnvironment } from './adapter-environment.interface.mjs'
4
4
 
5
5
  /**
6
- * Abstract interface for HTTP adapters.
6
+ * Interface for HTTP adapters extending the base adapter interface.
7
7
  *
8
8
  * Adapters implement this interface to provide runtime-specific HTTP server
9
9
  * functionality (Fastify, Bun, etc.).
10
10
  *
11
- * @typeParam ServerInstance - The underlying server type (e.g., FastifyInstance)
12
- * @typeParam CorsOptions - CORS configuration options type
13
- * @typeParam Options - Server setup options type
14
- * @typeParam MultipartOptions - Multipart form handling options type
11
+ * @typeParam Environment - The adapter environment providing type-safe access to
12
+ * server instance, CORS options, listen options, etc.
15
13
  */
16
14
  export interface AbstractHttpAdapterInterface<
17
- ServerInstance,
18
- CorsOptions = AbstractHttpCorsOptions,
19
- Options = {},
20
- MultipartOptions = {},
21
- > {
15
+ Environment extends HttpAdapterEnvironment = HttpAdapterEnvironment,
16
+ > extends AbstractAdapterInterface {
22
17
  /**
23
- * Sets up the HTTP server with the provided options.
18
+ * Sets up the adapter with the provided options.
19
+ * Called during application initialization before modules are initialized.
24
20
  */
25
- setupHttpServer(options: Options): Promise<void>
21
+ setupAdapter(options: Environment['options']): Promise<void>
26
22
 
27
23
  /**
28
24
  * Called after all modules are loaded to register routes.
@@ -34,10 +30,15 @@ export interface AbstractHttpAdapterInterface<
34
30
  */
35
31
  ready(): Promise<void>
36
32
 
33
+ /**
34
+ * Disposes of the server and cleans up resources.
35
+ */
36
+ dispose(): Promise<void>
37
+
37
38
  /**
38
39
  * Returns the underlying HTTP server instance.
39
40
  */
40
- getServer(): ServerInstance
41
+ getServer(): Environment['server']
41
42
 
42
43
  /**
43
44
  * Sets a global prefix for all routes.
@@ -53,20 +54,26 @@ export interface AbstractHttpAdapterInterface<
53
54
  /**
54
55
  * Enables CORS with the specified options.
55
56
  */
56
- enableCors(options: CorsOptions): void
57
+ enableCors(options: Environment['corsOptions']): void
57
58
 
58
59
  /**
59
60
  * Enables multipart form data handling.
60
61
  */
61
- enableMultipart(options: MultipartOptions): void
62
+ enableMultipart(options: Environment['multipartOptions']): void
62
63
 
63
64
  /**
64
65
  * Starts the server and listens for incoming requests.
65
66
  */
66
- listen(options: AbstractHttpListenOptions): Promise<string>
67
+ listen(options: Environment['listenOptions']): Promise<string>
67
68
 
68
69
  /**
69
- * Disposes of the server and cleans up resources.
70
+ * Configures the adapter with additional options before init.
71
+ *
72
+ * This method allows setting adapter-specific configuration options
73
+ * before the server is initialized. Options set via configure() are
74
+ * merged with options passed to setupAdapter().
75
+ *
76
+ * Must be called before setupAdapter().
70
77
  */
71
- dispose(): Promise<void>
78
+ configure(options: Partial<Environment['options']>): void
72
79
  }
@@ -32,10 +32,94 @@ export type HandlerResult<TRequest = any, TReply = any> =
32
32
  | StaticHandler<TRequest, TReply>
33
33
  | DynamicHandler<TRequest, TReply>
34
34
 
35
- export interface AbstractHttpHandlerAdapterInterface {
35
+ /**
36
+ * Function type for argument getters that extract data from requests.
37
+ * Each getter populates a target object with data from the request.
38
+ */
39
+ export type ArgumentGetterFn<TRequest = any> = (
40
+ target: Record<string, any>,
41
+ request: TRequest,
42
+ ) => void | Promise<void>
43
+
44
+ /**
45
+ * Function type for formatting arguments from a request.
46
+ * Built from argument getters, optimized for sync/async handling.
47
+ */
48
+ export type FormatArgumentsFn<TRequest = any> = (
49
+ request: TRequest,
50
+ ) => Record<string, any> | Promise<Record<string, any>>
51
+
52
+ /**
53
+ * Interface for HTTP handler adapter services.
54
+ *
55
+ * Adapters handle different types of HTTP requests (REST, streaming, multipart)
56
+ * and are responsible for:
57
+ * - Parsing and validating request data
58
+ * - Creating handler functions
59
+ * - Formatting responses
60
+ * - Providing schema information (for frameworks like Fastify)
61
+ */
62
+ export interface AbstractHttpHandlerAdapterInterface<TRequest = any> {
63
+ /**
64
+ * Prepares argument getters for parsing request data.
65
+ *
66
+ * Creates functions that extract and validate data from the request,
67
+ * populating a target object with validated arguments.
68
+ *
69
+ * @param handlerMetadata - The handler metadata with schemas and configuration.
70
+ * @returns An array of getter functions that populate request arguments.
71
+ */
36
72
  prepareArguments?: (
37
73
  handlerMetadata: HandlerMetadata<any>,
38
- ) => ((target: Record<string, any>, request: any) => Promise<void> | void)[]
74
+ ) => ArgumentGetterFn<TRequest>[]
75
+
76
+ /**
77
+ * Builds a formatArguments function from argument getters.
78
+ *
79
+ * Automatically detects sync vs async getters and optimizes accordingly:
80
+ * - If all getters are sync: returns sync function (no Promise overhead)
81
+ * - If any getter is async: returns async function with Promise.all
82
+ * - If no getters: returns frozen empty object (zero allocation)
83
+ *
84
+ * This method is useful for composition-based adapters that need to
85
+ * build formatArguments without duplicating the optimization logic.
86
+ *
87
+ * @param getters - Array of argument getter functions
88
+ * @returns Function to format arguments from request
89
+ */
90
+ buildFormatArguments?: (
91
+ getters: ArgumentGetterFn<TRequest>[],
92
+ ) => FormatArgumentsFn<TRequest>
93
+
94
+ /**
95
+ * Checks if the handler has any validation schemas defined.
96
+ *
97
+ * @param handlerMetadata - The handler metadata containing configuration.
98
+ * @returns `true` if the handler has any schemas (request, query, response).
99
+ */
100
+ hasSchema?: (handlerMetadata: HandlerMetadata<any>) => boolean
101
+
102
+ /**
103
+ * Provides schema information for the framework's validation system.
104
+ *
105
+ * For frameworks like Fastify, this returns route schema objects.
106
+ * For frameworks like Bun, this typically returns an empty object.
107
+ *
108
+ * @param handlerMetadata - The handler metadata containing configuration.
109
+ * @returns Schema information for framework registration.
110
+ */
111
+ provideSchema?: (handlerMetadata: HandlerMetadata<any>) => Record<string, any>
112
+
113
+ /**
114
+ * Creates a request handler function for the endpoint.
115
+ *
116
+ * This is the core method that generates the actual handler function
117
+ * that will be called when a request matches the endpoint.
118
+ *
119
+ * @param controller - The controller class containing the handler method.
120
+ * @param handlerMetadata - The handler metadata with configuration and schemas.
121
+ * @returns A handler result that is either static or dynamic.
122
+ */
39
123
  provideHandler: (
40
124
  controller: ClassType,
41
125
  handlerMetadata: HandlerMetadata<any>,
@@ -0,0 +1,74 @@
1
+ import type { AbstractAdapterInterface } from './abstract-adapter.interface.mjs'
2
+
3
+ /**
4
+ * Base interface for adapter environments.
5
+ *
6
+ * All adapter environments extend this interface to provide
7
+ * type-safe access to adapter-specific configuration options.
8
+ */
9
+ export interface AdapterEnvironment {
10
+ /**
11
+ * Adapter setup/configuration options type
12
+ */
13
+ options: unknown
14
+ /**
15
+ * Adapter type
16
+ */
17
+ adapter: AbstractAdapterInterface
18
+ }
19
+
20
+ /**
21
+ * Environment interface for HTTP adapters.
22
+ *
23
+ * Each HTTP adapter (Fastify, Bun, etc.) implements this interface to provide
24
+ * type-safe access to HTTP-specific types throughout the application.
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * // Using with a specific adapter
29
+ * import { FastifyEnvironment } from '@navios/adapter-fastify'
30
+ *
31
+ * const app = await NaviosFactory.create<FastifyEnvironment>(AppModule, {
32
+ * adapter: defineFastifyEnvironment(),
33
+ * })
34
+ *
35
+ * // All methods are now type-safe for Fastify
36
+ * app.configure({ trustProxy: true })
37
+ * app.enableCors({ origin: true }) // FastifyCorsOptions
38
+ * const server = app.getServer() // FastifyInstance
39
+ * await app.listen({ port: 3000 }) // FastifyListenOptions
40
+ * ```
41
+ */
42
+ export interface HttpAdapterEnvironment extends AdapterEnvironment {
43
+ /**
44
+ * The underlying HTTP server instance type (e.g., FastifyInstance, Bun.Server)
45
+ */
46
+ server: unknown
47
+
48
+ /**
49
+ * CORS configuration options type
50
+ */
51
+ corsOptions: unknown
52
+
53
+ /**
54
+ * Multipart form data configuration options type
55
+ */
56
+ multipartOptions: unknown
57
+
58
+ /**
59
+ * Server listen options type (port, host, etc.)
60
+ */
61
+ listenOptions: unknown
62
+ }
63
+
64
+ /**
65
+ * Default environment with unknown types.
66
+ *
67
+ * Forces users to specify an Environment generic for type-safe adapter access.
68
+ * When no generic is provided to `NaviosApplication` or `NaviosFactory.create()`,
69
+ * this default is used, resulting in `unknown` types for all adapter-specific
70
+ * methods.
71
+ */
72
+ export interface DefaultAdapterEnvironment extends AdapterEnvironment {
73
+ options: unknown
74
+ }
@@ -1,4 +1,6 @@
1
+ export * from './abstract-adapter.interface.mjs'
1
2
  export * from './abstract-execution-context.inteface.mjs'
3
+ export * from './adapter-environment.interface.mjs'
2
4
  export * from './abstract-http-adapter.interface.mjs'
3
5
  export * from './abstract-http-cors-options.interface.mjs'
4
6
  export * from './abstract-http-handler-adapter.interface.mjs'
@@ -2,14 +2,34 @@ import type { Container } from '@navios/di'
2
2
 
3
3
  import type { ModuleMetadata } from '../metadata/index.mjs'
4
4
  import type { ModuleLoaderService } from '../services/module-loader.service.mjs'
5
+ import type { AbstractAdapterInterface } from './abstract-adapter.interface.mjs'
5
6
 
6
7
  /**
7
8
  * Context provided to plugins during registration.
8
9
  *
9
10
  * This context gives plugins access to the application's modules,
10
- * server instance, DI container, and configuration.
11
+ * adapter instance, DI container, and module loader.
12
+ *
13
+ * @typeParam TAdapter - The adapter type, defaults to AbstractAdapterInterface
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * // Generic plugin that works with any adapter
18
+ * async register(context: PluginContext) {
19
+ * const modules = context.modules
20
+ * // ...
21
+ * }
22
+ *
23
+ * // Adapter-specific plugin with typed adapter
24
+ * async register(context: PluginContext<BunApplicationService>) {
25
+ * const server = context.adapter.getServer() // Typed as Bun.Server
26
+ * // ...
27
+ * }
28
+ * ```
11
29
  */
12
- export interface PluginContext {
30
+ export interface PluginContext<
31
+ TAdapter extends AbstractAdapterInterface = AbstractAdapterInterface,
32
+ > {
13
33
  /**
14
34
  * All loaded modules with their metadata.
15
35
  * Keys are module class names, values are their metadata.
@@ -17,22 +37,16 @@ export interface PluginContext {
17
37
  modules: Map<string, ModuleMetadata>
18
38
 
19
39
  /**
20
- * The underlying HTTP server instance.
21
- * Type depends on the adapter used (Fastify, Bun, etc.)
40
+ * The current adapter instance.
41
+ * Use type guards or cast to adapter-specific types for HTTP methods.
22
42
  */
23
- server: any
43
+ adapter: TAdapter
24
44
 
25
45
  /**
26
46
  * The dependency injection container.
27
47
  */
28
48
  container: Container
29
49
 
30
- /**
31
- * Global route prefix (e.g., '/api/v1').
32
- * Empty string if no prefix is set.
33
- */
34
- globalPrefix: string
35
-
36
50
  /**
37
51
  * Module loader service for extending the module tree.
38
52
  * Use `moduleLoader.extendModules()` to add controllers dynamically.
@@ -47,9 +61,11 @@ export interface PluginContext {
47
61
  * after all modules are loaded but before the server starts listening.
48
62
  *
49
63
  * @typeParam TOptions - The type of options the plugin accepts
64
+ * @typeParam TAdapter - The adapter type the plugin requires
50
65
  *
51
66
  * @example
52
67
  * ```typescript
68
+ * // Generic plugin
53
69
  * const myPlugin: NaviosPlugin<{ enabled: boolean }> = {
54
70
  * name: 'my-plugin',
55
71
  * register: async (context, options) => {
@@ -58,9 +74,20 @@ export interface PluginContext {
58
74
  * }
59
75
  * },
60
76
  * }
77
+ *
78
+ * // Adapter-specific plugin
79
+ * const fastifyPlugin: NaviosPlugin<Options, FastifyApplicationService> = {
80
+ * name: 'fastify-plugin',
81
+ * register: async (context, options) => {
82
+ * const fastify = context.adapter.getServer() // Typed!
83
+ * },
84
+ * }
61
85
  * ```
62
86
  */
63
- export interface NaviosPlugin<TOptions = unknown> {
87
+ export interface NaviosPlugin<
88
+ TOptions = unknown,
89
+ TAdapter extends AbstractAdapterInterface = AbstractAdapterInterface,
90
+ > {
64
91
  /**
65
92
  * Plugin name for identification and logging.
66
93
  */
@@ -69,10 +96,13 @@ export interface NaviosPlugin<TOptions = unknown> {
69
96
  /**
70
97
  * Called after modules are loaded but before the server starts listening.
71
98
  *
72
- * @param context - The plugin context with access to modules and server
99
+ * @param context - The plugin context with access to modules and adapter
73
100
  * @param options - Plugin-specific configuration options
74
101
  */
75
- register(context: PluginContext, options: TOptions): Promise<void> | void
102
+ register(
103
+ context: PluginContext<TAdapter>,
104
+ options: TOptions,
105
+ ): Promise<void> | void
76
106
  }
77
107
 
78
108
  /**
@@ -81,6 +111,7 @@ export interface NaviosPlugin<TOptions = unknown> {
81
111
  * This is the type returned by plugin factory functions like `defineOpenApiPlugin()`.
82
112
  *
83
113
  * @typeParam TOptions - The type of options the plugin accepts
114
+ * @typeParam TAdapter - The adapter type the plugin requires
84
115
  *
85
116
  * @example
86
117
  * ```typescript
@@ -92,11 +123,14 @@ export interface NaviosPlugin<TOptions = unknown> {
92
123
  * }
93
124
  * ```
94
125
  */
95
- export interface PluginDefinition<TOptions = unknown> {
126
+ export interface PluginDefinition<
127
+ TOptions = unknown,
128
+ TAdapter extends AbstractAdapterInterface = AbstractAdapterInterface,
129
+ > {
96
130
  /**
97
131
  * The plugin instance.
98
132
  */
99
- plugin: NaviosPlugin<TOptions>
133
+ plugin: NaviosPlugin<TOptions, TAdapter>
100
134
 
101
135
  /**
102
136
  * Options to pass to the plugin's register function.
@@ -1,5 +1,6 @@
1
- import type { z, ZodType } from 'zod/v4'
2
1
  import type { ClassType } from '@navios/di'
2
+ import { createClassContext, createMethodContext } from '@navios/di/legacy-compat'
3
+ import type { z, ZodType } from 'zod/v4'
3
4
 
4
5
  import type {
5
6
  ControllerMetadata,
@@ -18,7 +19,6 @@ import {
18
19
  getManagedMetadata,
19
20
  hasManagedMetadata,
20
21
  } from '../metadata/navios-managed.metadata.mjs'
21
- import { createClassContext, createMethodContext } from './context-compat.mjs'
22
22
 
23
23
  /**
24
24
  * Type for a legacy class/method attribute decorator without a value.
@@ -1,9 +1,9 @@
1
1
  import type { ClassType } from '@navios/di'
2
+ import { createClassContext } from '@navios/di/legacy-compat'
2
3
 
3
4
  import type { ControllerOptions } from '../../decorators/controller.decorator.mjs'
4
5
 
5
6
  import { Controller as OriginalController } from '../../decorators/controller.decorator.mjs'
6
- import { createClassContext } from '../context-compat.mjs'
7
7
 
8
8
  /**
9
9
  * Legacy-compatible Controller decorator.
@@ -3,10 +3,10 @@ import type {
3
3
  EndpointOptions,
4
4
  RequestArgs,
5
5
  } from '@navios/builder'
6
+ import { createMethodContext } from '@navios/di/legacy-compat'
6
7
  import type { z } from 'zod/v4'
7
8
 
8
9
  import { Endpoint as OriginalEndpoint } from '../../decorators/endpoint.decorator.mjs'
9
- import { createMethodContext } from '../context-compat.mjs'
10
10
 
11
11
  /**
12
12
  * Type helper to constrain a PropertyDescriptor's value to match an endpoint signature.
@@ -1,7 +1,8 @@
1
+ import { createMethodContext } from '@navios/di/legacy-compat'
2
+
1
3
  import type { HttpHeader } from '../../interfaces/index.mjs'
2
4
 
3
5
  import { Header as OriginalHeader } from '../../decorators/header.decorator.mjs'
4
- import { createMethodContext } from '../context-compat.mjs'
5
6
 
6
7
  /**
7
8
  * Legacy-compatible Header decorator.
@@ -1,5 +1,6 @@
1
+ import { createMethodContext } from '@navios/di/legacy-compat'
2
+
1
3
  import { HttpCode as OriginalHttpCode } from '../../decorators/http-code.decorator.mjs'
2
- import { createMethodContext } from '../context-compat.mjs'
3
4
 
4
5
  /**
5
6
  * Legacy-compatible HttpCode decorator.
@@ -6,6 +6,6 @@ export * from './header.decorator.mjs'
6
6
  export * from './http-code.decorator.mjs'
7
7
  export * from './multipart.decorator.mjs'
8
8
  export * from './stream.decorator.mjs'
9
- export * from './injectable.decorator.mjs'
10
- export * from './factory.decorator.mjs'
11
9
 
10
+ // Re-export DI decorators from @navios/di/legacy-compat
11
+ export { Injectable, Factory, type InjectableOptions, type FactoryOptions } from '@navios/di/legacy-compat'
@@ -1,7 +1,7 @@
1
1
  import type { ClassType } from '@navios/di'
2
+ import { createClassContext } from '@navios/di/legacy-compat'
2
3
 
3
4
  import { Module as OriginalModule, type ModuleOptions } from '../../decorators/module.decorator.mjs'
4
- import { createClassContext } from '../context-compat.mjs'
5
5
 
6
6
  /**
7
7
  * Legacy-compatible Module decorator.
@@ -3,10 +3,10 @@ import type {
3
3
  EndpointOptions,
4
4
  RequestArgs,
5
5
  } from '@navios/builder'
6
+ import { createMethodContext } from '@navios/di/legacy-compat'
6
7
  import type { z } from 'zod/v4'
7
8
 
8
9
  import { Multipart as OriginalMultipart } from '../../decorators/multipart.decorator.mjs'
9
- import { createMethodContext } from '../context-compat.mjs'
10
10
 
11
11
  /**
12
12
  * Type helper to constrain a PropertyDescriptor's value to match a multipart endpoint signature.
@@ -3,9 +3,9 @@ import type {
3
3
  RequestArgs,
4
4
  StreamHandler,
5
5
  } from '@navios/builder'
6
+ import { createMethodContext } from '@navios/di/legacy-compat'
6
7
 
7
8
  import { Stream as OriginalStream } from '../../decorators/stream.decorator.mjs'
8
- import { createMethodContext } from '../context-compat.mjs'
9
9
 
10
10
  /**
11
11
  * Type helper to constrain a PropertyDescriptor's value to match a stream endpoint signature.
@@ -3,11 +3,11 @@ import type {
3
3
  ClassTypeWithInstance,
4
4
  InjectionToken,
5
5
  } from '@navios/di'
6
+ import { createClassContext, createMethodContext } from '@navios/di/legacy-compat'
6
7
 
7
8
  import type { CanActivate } from '../../interfaces/index.mjs'
8
9
 
9
10
  import { UseGuards as OriginalUseGuards } from '../../decorators/use-guards.decorator.mjs'
10
- import { createClassContext, createMethodContext } from '../context-compat.mjs'
11
11
 
12
12
  /**
13
13
  * Legacy-compatible UseGuards decorator.
@@ -26,7 +26,7 @@ export type {
26
26
  StreamParams,
27
27
  } from '../decorators/index.mjs'
28
28
 
29
- // Export legacy-compatible decorators
29
+ // Export legacy-compatible decorators (core-specific)
30
30
  export {
31
31
  Module,
32
32
  Controller,
@@ -36,9 +36,17 @@ export {
36
36
  HttpCode,
37
37
  Multipart,
38
38
  Stream,
39
+ } from './decorators/index.mjs'
40
+
41
+ // Re-export DI decorators and context utilities from @navios/di/legacy-compat
42
+ export {
39
43
  Injectable,
40
44
  Factory,
41
- } from './decorators/index.mjs'
45
+ createClassContext,
46
+ createMethodContext,
47
+ type InjectableOptions,
48
+ type FactoryOptions,
49
+ } from '@navios/di/legacy-compat'
42
50
 
43
51
  // Export legacy-compatible AttributeFactory
44
52
  export {
@@ -47,6 +55,3 @@ export {
47
55
  type LegacyClassAttribute,
48
56
  type LegacyClassSchemaAttribute,
49
57
  } from './attribute.factory.mjs'
50
-
51
- // Export context compatibility utilities
52
- export * from './context-compat.mjs'