@navios/core 1.1.0 → 2.0.0-alpha.1

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 (237) hide show
  1. package/CHANGELOG.md +85 -13
  2. package/README.md +69 -220
  3. package/lib/async-context-BAdt7bno.d.mts +239 -0
  4. package/lib/async-context-BAdt7bno.d.mts.map +1 -0
  5. package/lib/async-context-RsWmy2Hi.d.cts +239 -0
  6. package/lib/async-context-RsWmy2Hi.d.cts.map +1 -0
  7. package/lib/attribute-factory-BW1kgBqf.d.mts +70 -0
  8. package/lib/attribute-factory-BW1kgBqf.d.mts.map +1 -0
  9. package/lib/attribute-factory-DqN4x5XM.d.cts +70 -0
  10. package/lib/attribute-factory-DqN4x5XM.d.cts.map +1 -0
  11. package/lib/attribute-value-BNiJjxl1.mjs +225 -0
  12. package/lib/attribute-value-BNiJjxl1.mjs.map +1 -0
  13. package/lib/attribute-value-Cux5HhOL.cjs +314 -0
  14. package/lib/attribute-value-Cux5HhOL.cjs.map +1 -0
  15. package/lib/basic-execution-context-5uq2DvEA.cjs +318 -0
  16. package/lib/basic-execution-context-5uq2DvEA.cjs.map +1 -0
  17. package/lib/basic-execution-context-u1VktGoM.mjs +277 -0
  18. package/lib/basic-execution-context-u1VktGoM.mjs.map +1 -0
  19. package/lib/execution-context-BVSmLkYp.d.cts +71 -0
  20. package/lib/execution-context-BVSmLkYp.d.cts.map +1 -0
  21. package/lib/execution-context-C5F9rojO.d.mts +71 -0
  22. package/lib/execution-context-C5F9rojO.d.mts.map +1 -0
  23. package/lib/execution-context-token--cKS4cJv.cjs +270 -0
  24. package/lib/execution-context-token--cKS4cJv.cjs.map +1 -0
  25. package/lib/execution-context-token-Cb3M3Ao0.mjs +223 -0
  26. package/lib/execution-context-token-Cb3M3Ao0.mjs.map +1 -0
  27. package/lib/index.cjs +1672 -4426
  28. package/lib/index.cjs.map +1 -1
  29. package/lib/index.d.cts +842 -3
  30. package/lib/index.d.cts.map +1 -0
  31. package/lib/index.d.mts +842 -3
  32. package/lib/index.d.mts.map +1 -0
  33. package/lib/index.mjs +1559 -4221
  34. package/lib/index.mjs.map +1 -1
  35. package/lib/legacy-compat/index.cjs +72 -371
  36. package/lib/legacy-compat/index.cjs.map +1 -1
  37. package/lib/legacy-compat/index.d.cts +42 -382
  38. package/lib/legacy-compat/index.d.cts.map +1 -1
  39. package/lib/legacy-compat/index.d.mts +41 -382
  40. package/lib/legacy-compat/index.d.mts.map +1 -1
  41. package/lib/legacy-compat/index.mjs +51 -345
  42. package/lib/legacy-compat/index.mjs.map +1 -1
  43. package/lib/module-Bz83ZnJ5.cjs +173 -0
  44. package/lib/module-Bz83ZnJ5.cjs.map +1 -0
  45. package/lib/module-options-CSqQUSTm.d.mts +51 -0
  46. package/lib/module-options-CSqQUSTm.d.mts.map +1 -0
  47. package/lib/module-options-DSRBri4J.d.cts +51 -0
  48. package/lib/module-options-DSRBri4J.d.cts.map +1 -0
  49. package/lib/module-zPXwR2qp.mjs +138 -0
  50. package/lib/module-zPXwR2qp.mjs.map +1 -0
  51. package/lib/settled-within-B6gpu2XW.cjs +32 -0
  52. package/lib/settled-within-B6gpu2XW.cjs.map +1 -0
  53. package/lib/settled-within-Bc2pj8WB.mjs +21 -0
  54. package/lib/settled-within-Bc2pj8WB.mjs.map +1 -0
  55. package/lib/testing/index.cjs +74 -414
  56. package/lib/testing/index.cjs.map +1 -1
  57. package/lib/testing/index.d.cts +25 -385
  58. package/lib/testing/index.d.cts.map +1 -1
  59. package/lib/testing/index.d.mts +24 -385
  60. package/lib/testing/index.d.mts.map +1 -1
  61. package/lib/testing/index.mjs +72 -408
  62. package/lib/testing/index.mjs.map +1 -1
  63. package/lib/transport.cjs +36 -0
  64. package/lib/transport.d.cts +254 -0
  65. package/lib/transport.d.cts.map +1 -0
  66. package/lib/transport.d.mts +254 -0
  67. package/lib/transport.d.mts.map +1 -0
  68. package/lib/transport.mjs +6 -0
  69. package/package.json +37 -17
  70. package/docs/README.md +0 -316
  71. package/docs/adapters.md +0 -308
  72. package/docs/application-setup.md +0 -524
  73. package/docs/attributes.md +0 -689
  74. package/docs/controllers.md +0 -373
  75. package/docs/endpoints.md +0 -444
  76. package/docs/exceptions.md +0 -352
  77. package/docs/guards.md +0 -550
  78. package/docs/legacy-compat.md +0 -356
  79. package/docs/modules.md +0 -377
  80. package/docs/quick-start.md +0 -290
  81. package/docs/services.md +0 -427
  82. package/docs/testing.md +0 -827
  83. package/lib/index-3LcTrbxz.d.mts +0 -3804
  84. package/lib/index-3LcTrbxz.d.mts.map +0 -1
  85. package/lib/index-B14SekVb.d.cts +0 -3804
  86. package/lib/index-B14SekVb.d.cts.map +0 -1
  87. package/lib/navios.factory-CUrO_p6K.cjs +0 -4538
  88. package/lib/navios.factory-CUrO_p6K.cjs.map +0 -1
  89. package/lib/navios.factory-DjUOOVVL.mjs +0 -4151
  90. package/lib/navios.factory-DjUOOVVL.mjs.map +0 -1
  91. package/lib/tokens-BEuBMGGX.cjs +0 -193
  92. package/lib/tokens-BEuBMGGX.cjs.map +0 -1
  93. package/lib/tokens-COyNGV1I.mjs +0 -97
  94. package/lib/tokens-COyNGV1I.mjs.map +0 -1
  95. package/lib/use-guards.decorator-DLmRl2CV.mjs +0 -336
  96. package/lib/use-guards.decorator-DLmRl2CV.mjs.map +0 -1
  97. package/lib/use-guards.decorator-DhumFTk3.cjs +0 -444
  98. package/lib/use-guards.decorator-DhumFTk3.cjs.map +0 -1
  99. package/project.json +0 -66
  100. package/src/__tests__/attribute.factory.spec.mts +0 -300
  101. package/src/__tests__/config.service.spec.mts +0 -43
  102. package/src/__tests__/console-logger.service.spec.mts +0 -312
  103. package/src/__tests__/controller-resolver.spec.mts +0 -229
  104. package/src/__tests__/controller.spec.mts +0 -58
  105. package/src/__tests__/guard-runner.service.spec.mts +0 -399
  106. package/src/__tests__/logger.service.spec.mts +0 -147
  107. package/src/__tests__/responders.spec.mts +0 -340
  108. package/src/__tests__/testing-module.spec.mts +0 -459
  109. package/src/__tests__/unit-testing-module.spec.mts +0 -424
  110. package/src/attribute.factory.mts +0 -325
  111. package/src/config/config-service.interface.mts +0 -47
  112. package/src/config/config.provider.mts +0 -69
  113. package/src/config/config.service.mts +0 -176
  114. package/src/config/index.mts +0 -5
  115. package/src/config/types.mts +0 -58
  116. package/src/config/utils/helpers.mts +0 -23
  117. package/src/config/utils/index.mts +0 -1
  118. package/src/decorators/controller.decorator.mts +0 -81
  119. package/src/decorators/endpoint.decorator.mts +0 -181
  120. package/src/decorators/header.decorator.mts +0 -38
  121. package/src/decorators/http-code.decorator.mts +0 -38
  122. package/src/decorators/index.mts +0 -8
  123. package/src/decorators/module.decorator.mts +0 -106
  124. package/src/decorators/multipart.decorator.mts +0 -169
  125. package/src/decorators/stream.decorator.mts +0 -155
  126. package/src/decorators/use-guards.decorator.mts +0 -73
  127. package/src/exceptions/bad-request.exception.mts +0 -28
  128. package/src/exceptions/conflict.exception.mts +0 -31
  129. package/src/exceptions/forbidden.exception.mts +0 -30
  130. package/src/exceptions/http.exception.mts +0 -33
  131. package/src/exceptions/index.mts +0 -7
  132. package/src/exceptions/internal-server-error.exception.mts +0 -33
  133. package/src/exceptions/not-found.exception.mts +0 -33
  134. package/src/exceptions/unauthorized.exception.mts +0 -30
  135. package/src/factories/adapter.factory.mts +0 -20
  136. package/src/factories/endpoint-adapter.factory.mts +0 -21
  137. package/src/factories/http-adapter.factory.mts +0 -20
  138. package/src/factories/index.mts +0 -8
  139. package/src/factories/multipart-adapter.factory.mts +0 -21
  140. package/src/factories/reply.factory.mts +0 -21
  141. package/src/factories/request.factory.mts +0 -21
  142. package/src/factories/stream-adapter.factory.mts +0 -20
  143. package/src/factories/xml-stream-adapter.factory.mts +0 -20
  144. package/src/index.mts +0 -16
  145. package/src/interfaces/abstract-adapter.interface.mts +0 -32
  146. package/src/interfaces/abstract-execution-context.inteface.mts +0 -48
  147. package/src/interfaces/abstract-http-adapter.interface.mts +0 -79
  148. package/src/interfaces/abstract-http-cors-options.interface.mts +0 -59
  149. package/src/interfaces/abstract-http-handler-adapter.interface.mts +0 -127
  150. package/src/interfaces/abstract-http-listen-options.interface.mts +0 -4
  151. package/src/interfaces/adapter-environment.interface.mts +0 -74
  152. package/src/interfaces/can-activate.mts +0 -38
  153. package/src/interfaces/http-header.mts +0 -18
  154. package/src/interfaces/index.mts +0 -14
  155. package/src/interfaces/navios-module.mts +0 -28
  156. package/src/interfaces/plugin-context.mts +0 -104
  157. package/src/interfaces/plugin-stage.mts +0 -62
  158. package/src/interfaces/plugin.interface.mts +0 -119
  159. package/src/interfaces/staged-plugin.interface.mts +0 -209
  160. package/src/legacy-compat/__type-tests__/legacy-decorators.spec-d.mts +0 -521
  161. package/src/legacy-compat/__type-tests__/tsconfig.json +0 -15
  162. package/src/legacy-compat/attribute.factory.mts +0 -351
  163. package/src/legacy-compat/decorators/controller.decorator.mts +0 -31
  164. package/src/legacy-compat/decorators/endpoint.decorator.mts +0 -73
  165. package/src/legacy-compat/decorators/header.decorator.mts +0 -43
  166. package/src/legacy-compat/decorators/http-code.decorator.mts +0 -39
  167. package/src/legacy-compat/decorators/index.mts +0 -11
  168. package/src/legacy-compat/decorators/module.decorator.mts +0 -37
  169. package/src/legacy-compat/decorators/multipart.decorator.mts +0 -72
  170. package/src/legacy-compat/decorators/stream.decorator.mts +0 -89
  171. package/src/legacy-compat/decorators/use-guards.decorator.mts +0 -80
  172. package/src/legacy-compat/index.mts +0 -57
  173. package/src/logger/README.md +0 -3
  174. package/src/logger/console-logger.service.mts +0 -714
  175. package/src/logger/index.mts +0 -6
  176. package/src/logger/log-levels.mts +0 -21
  177. package/src/logger/logger-service.interface.mts +0 -42
  178. package/src/logger/logger.service.mts +0 -113
  179. package/src/logger/logger.tokens.mts +0 -44
  180. package/src/logger/utils/cli-colors.util.mts +0 -17
  181. package/src/logger/utils/filter-log-levelts.util.mts +0 -29
  182. package/src/logger/utils/index.mts +0 -5
  183. package/src/logger/utils/is-log-level-enabled.mts +0 -33
  184. package/src/logger/utils/is-log-level.util.mts +0 -10
  185. package/src/logger/utils/shared.utils.mts +0 -51
  186. package/src/metadata/controller.metadata.mts +0 -79
  187. package/src/metadata/handler.metadata.mts +0 -80
  188. package/src/metadata/index.mts +0 -4
  189. package/src/metadata/module.metadata.mts +0 -116
  190. package/src/metadata/navios-managed.metadata.mts +0 -42
  191. package/src/navios.application.mts +0 -678
  192. package/src/navios.environment.mts +0 -42
  193. package/src/navios.factory.mts +0 -158
  194. package/src/responders/enums/framework-error.enum.mts +0 -38
  195. package/src/responders/enums/index.mts +0 -1
  196. package/src/responders/index.mts +0 -4
  197. package/src/responders/interfaces/error-responder.interface.mts +0 -42
  198. package/src/responders/interfaces/error-response.interface.mts +0 -22
  199. package/src/responders/interfaces/index.mts +0 -3
  200. package/src/responders/interfaces/problem-details.interface.mts +0 -34
  201. package/src/responders/services/error-response-producer.service.mts +0 -143
  202. package/src/responders/services/forbidden-responder.service.mts +0 -77
  203. package/src/responders/services/index.mts +0 -5
  204. package/src/responders/services/internal-server-error-responder.service.mts +0 -57
  205. package/src/responders/services/not-found-responder.service.mts +0 -76
  206. package/src/responders/services/validation-error-responder.service.mts +0 -78
  207. package/src/responders/tokens/index.mts +0 -1
  208. package/src/responders/tokens/responder.tokens.mts +0 -84
  209. package/src/services/abstract-handler-adapter.service.mts +0 -366
  210. package/src/services/guard-runner.service.mts +0 -152
  211. package/src/services/index.mts +0 -4
  212. package/src/services/instance-resolver.service.mts +0 -177
  213. package/src/services/module-loader.service.mts +0 -255
  214. package/src/stores/index.mts +0 -1
  215. package/src/stores/request-id.store.mts +0 -85
  216. package/src/testing/index.mts +0 -3
  217. package/src/testing/testing-module.mts +0 -393
  218. package/src/testing/unit-testing-module.mts +0 -298
  219. package/src/tokens/adapter.token.mts +0 -6
  220. package/src/tokens/endpoint-adapter.token.mts +0 -8
  221. package/src/tokens/execution-context.token.mts +0 -9
  222. package/src/tokens/http-adapter.token.mts +0 -8
  223. package/src/tokens/index.mts +0 -10
  224. package/src/tokens/multipart-adapter.token.mts +0 -8
  225. package/src/tokens/navios-options.token.mts +0 -6
  226. package/src/tokens/reply.token.mts +0 -3
  227. package/src/tokens/request.token.mts +0 -3
  228. package/src/tokens/stream-adapter.token.mts +0 -8
  229. package/src/tokens/xml-stream-adapter.token.mts +0 -8
  230. package/src/utils/adapter-supports.util.mts +0 -47
  231. package/src/utils/define-plugin.mts +0 -251
  232. package/src/utils/index.mts +0 -2
  233. package/tsconfig.json +0 -21
  234. package/tsconfig.lib.json +0 -8
  235. package/tsconfig.spec.json +0 -15
  236. package/tsdown.config.mts +0 -35
  237. package/vitest.config.mts +0 -15
@@ -1,391 +1,92 @@
1
- const require_navios_factory = require('../navios.factory-CUrO_p6K.cjs');
2
- const require_use_guards_decorator = require('../use-guards.decorator-DhumFTk3.cjs');
3
- const require_tokens = require('../tokens-BEuBMGGX.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../attribute-value-Cux5HhOL.cjs");
4
3
  let _navios_di_legacy_compat = require("@navios/di/legacy-compat");
5
-
6
- //#region src/legacy-compat/decorators/module.decorator.mts
7
- /**
8
- * Legacy-compatible Module decorator.
9
- *
10
- * Works with TypeScript experimental decorators (legacy API).
11
- *
12
- * @param options - Module configuration options
13
- * @returns A class decorator compatible with legacy decorator API
14
- *
15
- * @example
16
- * ```typescript
17
- * @Module({
18
- * controllers: [UserController, AuthController],
19
- * imports: [DatabaseModule],
20
- * guards: [AuthGuard],
21
- * })
22
- * export class AppModule {}
23
- * ```
24
- */ function Module(options = {
25
- controllers: [],
26
- imports: [],
27
- guards: []
28
- }) {
29
- return function(target) {
30
- const context = (0, _navios_di_legacy_compat.createClassContext)(target);
31
- return require_use_guards_decorator.Module(options)(target, context);
32
- };
33
- }
34
-
35
- //#endregion
36
- //#region src/legacy-compat/decorators/controller.decorator.mts
37
- /**
38
- * Legacy-compatible Controller decorator.
39
- *
40
- * Works with TypeScript experimental decorators (legacy API).
41
- *
42
- * @param options - Controller configuration options
43
- * @returns A class decorator compatible with legacy decorator API
44
- *
45
- * @example
46
- * ```typescript
47
- * @Controller({ guards: [AuthGuard] })
48
- * export class UserController {
49
- * @Endpoint(getUserEndpoint)
50
- * async getUser() { }
51
- * }
52
- * ```
53
- */ function Controller(options = {}) {
54
- return function(target) {
55
- const context = (0, _navios_di_legacy_compat.createClassContext)(target);
56
- return require_use_guards_decorator.Controller(options)(target, context);
57
- };
58
- }
59
-
60
- //#endregion
61
- //#region src/legacy-compat/decorators/endpoint.decorator.mts
62
- /**
63
- * Legacy-compatible Endpoint decorator.
64
- *
65
- * Works with TypeScript experimental decorators (legacy API).
66
- * Provides type safety by ensuring method signatures match the endpoint configuration.
67
- *
68
- * @param endpoint - The endpoint declaration from @navios/builder
69
- * @returns A method decorator compatible with legacy decorator API
70
- *
71
- * @example
72
- * ```typescript
73
- * @Controller()
74
- * export class UserController {
75
- * @Endpoint(getUserEndpoint)
76
- * async getUser(request: EndpointParams<typeof getUserEndpoint>): EndpointResult<typeof getUserEndpoint> {
77
- * return { id: '1', name: 'John' }
78
- * }
79
- * }
80
- * ```
81
- */ function Endpoint(endpoint) {
82
- return function(target, propertyKey, descriptor) {
83
- if (!descriptor) throw new Error("[Navios] @Endpoint decorator requires a method descriptor. Make sure experimentalDecorators is enabled.");
84
- const typedDescriptor = descriptor;
85
- const context = (0, _navios_di_legacy_compat.createMethodContext)(target, propertyKey, typedDescriptor);
86
- const result = require_use_guards_decorator.Endpoint(endpoint)(typedDescriptor.value, context);
87
- if (result !== typedDescriptor.value) typedDescriptor.value = result;
88
- return typedDescriptor;
89
- };
90
- }
91
-
92
- //#endregion
93
- //#region src/legacy-compat/decorators/use-guards.decorator.mts
4
+ const require_module = require("../module-Bz83ZnJ5.cjs");
5
+ // src/legacy-compat/legacy-decorator.mts
94
6
  /**
95
- * Legacy-compatible UseGuards decorator.
96
- *
97
- * Works with TypeScript experimental decorators (legacy API).
98
- * Can be applied to classes or methods.
99
- *
100
- * @param guards - Guard classes or injection tokens to apply
101
- * @returns A class or method decorator compatible with legacy decorator API
102
- *
103
- * @example
104
- * ```typescript
105
- * // Apply to a controller
106
- * @Controller()
107
- * @UseGuards(AuthGuard, RoleGuard)
108
- * export class UserController { }
109
- *
110
- * // Apply to a specific endpoint
111
- * @Controller()
112
- * export class UserController {
113
- * @Endpoint(getUserEndpoint)
114
- * @UseGuards(AuthGuard)
115
- * async getUser() { }
116
- * }
117
- * ```
118
- */ function UseGuards(...guards) {
119
- function decoratorImpl(target, propertyKey, descriptor) {
120
- if (propertyKey !== void 0 && descriptor !== void 0) {
7
+ * Turns a standard decorator into one that accepts the legacy call shapes:
8
+ * `(constructor)`, `(prototype, key, descriptor)` and `(prototype, key)`.
9
+ */
10
+ function legacy(decorator) {
11
+ return (target, propertyKey, descriptor) => {
12
+ if (propertyKey === void 0) return decorator(target, (0, _navios_di_legacy_compat.createClassContext)(target)) ?? target;
13
+ if (descriptor && typeof descriptor.value === "function") {
121
14
  const context = (0, _navios_di_legacy_compat.createMethodContext)(target, propertyKey, descriptor);
122
- const result = require_use_guards_decorator.UseGuards(...guards)(descriptor.value, context);
123
- if (result !== descriptor.value) descriptor.value = result;
15
+ const replaced = decorator(descriptor.value, context);
16
+ if (replaced && replaced !== descriptor.value) descriptor.value = replaced;
124
17
  return descriptor;
125
- } else {
126
- const context = (0, _navios_di_legacy_compat.createClassContext)(target);
127
- return require_use_guards_decorator.UseGuards(...guards)(target, context);
128
18
  }
129
- }
130
- return decoratorImpl;
131
- }
132
-
133
- //#endregion
134
- //#region src/legacy-compat/decorators/header.decorator.mts
135
- /**
136
- * Legacy-compatible Header decorator.
137
- *
138
- * Works with TypeScript experimental decorators (legacy API).
139
- *
140
- * @param name - The header name (e.g., 'Content-Type', 'Cache-Control')
141
- * @param value - The header value (string, number, or array of strings)
142
- * @returns A method decorator compatible with legacy decorator API
143
- *
144
- * @example
145
- * ```typescript
146
- * @Controller()
147
- * export class UserController {
148
- * @Endpoint(getUserEndpoint)
149
- * @Header('Cache-Control', 'max-age=3600')
150
- * async getUser() {
151
- * return { id: '1', name: 'John' }
152
- * }
153
- * }
154
- * ```
155
- */ function Header(name, value) {
156
- return function(target, propertyKey, descriptor) {
157
- const context = (0, _navios_di_legacy_compat.createMethodContext)(target, propertyKey, descriptor);
158
- const result = require_use_guards_decorator.Header(name, value)(descriptor.value, context);
159
- if (result !== descriptor.value) descriptor.value = result;
160
- return descriptor;
19
+ decorator(void 0, {
20
+ ...(0, _navios_di_legacy_compat.createMethodContext)(target, propertyKey, descriptor ?? {}),
21
+ kind: "field"
22
+ });
161
23
  };
162
24
  }
163
-
164
- //#endregion
165
- //#region src/legacy-compat/decorators/http-code.decorator.mts
166
- /**
167
- * Legacy-compatible HttpCode decorator.
168
- *
169
- * Works with TypeScript experimental decorators (legacy API).
170
- *
171
- * @param code - The HTTP status code to return (e.g., 201, 204, 202)
172
- * @returns A method decorator compatible with legacy decorator API
173
- *
174
- * @example
175
- * ```typescript
176
- * @Controller()
177
- * export class UserController {
178
- * @Endpoint(createUserEndpoint)
179
- * @HttpCode(201)
180
- * async createUser() {
181
- * return { id: '1', name: 'John' }
182
- * }
183
- * }
184
- * ```
185
- */ function HttpCode(code) {
186
- return function(target, propertyKey, descriptor) {
187
- const context = (0, _navios_di_legacy_compat.createMethodContext)(target, propertyKey, descriptor);
188
- const result = require_use_guards_decorator.HttpCode(code)(descriptor.value, context);
189
- if (result !== descriptor.value) descriptor.value = result;
190
- return descriptor;
25
+ // src/legacy-compat/attribute-factory.mts
26
+ function createAttribute(token, schema) {
27
+ const standard = schema ? require_module.AttributeFactory.createAttribute(token, schema) : require_module.AttributeFactory.createAttribute(token);
28
+ const attribute = (value) => {
29
+ const application = standard(value);
30
+ return Object.assign(legacy(application), {
31
+ token: application.token,
32
+ value: application.value
33
+ });
191
34
  };
35
+ return Object.assign(attribute, schema ? {
36
+ token,
37
+ schema
38
+ } : { token });
192
39
  }
193
-
194
- //#endregion
195
- //#region src/legacy-compat/decorators/multipart.decorator.mts
196
40
  /**
197
- * Legacy-compatible Multipart decorator.
198
- *
199
- * Works with TypeScript experimental decorators (legacy API).
200
- * Provides type safety by ensuring method signatures match the endpoint configuration.
201
- *
202
- * @param endpoint - The multipart endpoint declaration from @navios/builder
203
- * @returns A method decorator compatible with legacy decorator API
204
- *
205
- * @example
206
- * ```typescript
207
- * @Controller()
208
- * export class FileController {
209
- * @Multipart(uploadFileEndpoint)
210
- * async uploadFile(request: MultipartParams<typeof uploadFileEndpoint>): MultipartResult<typeof uploadFileEndpoint> {
211
- * const { file } = request.data
212
- * return { url: 'https://example.com/file.jpg' }
213
- * }
214
- * }
215
- * ```
216
- */ function Multipart(endpoint) {
217
- return function(target, propertyKey, descriptor) {
218
- if (!descriptor) throw new Error("[Navios] @Multipart decorator requires a method descriptor. Make sure experimentalDecorators is enabled.");
219
- const context = (0, _navios_di_legacy_compat.createMethodContext)(target, propertyKey, descriptor);
220
- const result = require_use_guards_decorator.Multipart(endpoint)(descriptor.value, context);
221
- if (result !== descriptor.value) descriptor.value = result;
222
- return descriptor;
223
- };
41
+ * `AttributeFactory` whose attributes are legacy decorators. Reading
42
+ * (`get`, `getAll`, `has`) is the same as the standard one.
43
+ */
44
+ const AttributeFactory = {
45
+ createAttribute,
46
+ get: require_module.AttributeFactory.get,
47
+ getAll: require_module.AttributeFactory.getAll,
48
+ has: require_module.AttributeFactory.has
49
+ };
50
+ // src/legacy-compat/module.mts
51
+ function Module(options = {}) {
52
+ return legacy(require_module.Module(options));
224
53
  }
225
-
226
- //#endregion
227
- //#region src/legacy-compat/decorators/stream.decorator.mts
228
- /**
229
- * Legacy-compatible Stream decorator.
230
- *
231
- * Works with TypeScript experimental decorators (legacy API).
232
- * Provides type safety by ensuring method signatures match the endpoint configuration.
233
- *
234
- * @param endpoint - The stream endpoint declaration from @navios/builder
235
- * @returns A method decorator compatible with legacy decorator API
236
- *
237
- * @example
238
- * ```typescript
239
- * @Controller()
240
- * export class FileController {
241
- * @Stream(downloadFileEndpoint)
242
- * async downloadFile(request: StreamParams<typeof downloadFileEndpoint>, reply: any) {
243
- * const { fileId } = request.urlParams
244
- * // Stream file data to reply
245
- * }
246
- * }
247
- * ```
248
- */ function Stream(endpoint) {
249
- return function(target, propertyKey, descriptor) {
250
- if (!descriptor || !descriptor.value) throw new Error("[Navios] @Stream decorator requires a method descriptor. Make sure experimentalDecorators is enabled.");
251
- const typedDescriptor = descriptor;
252
- const context = (0, _navios_di_legacy_compat.createMethodContext)(target, propertyKey, typedDescriptor);
253
- const result = require_use_guards_decorator.Stream(endpoint)(typedDescriptor.value, context);
254
- if (result && result !== typedDescriptor.value) typedDescriptor.value = result;
255
- return typedDescriptor;
256
- };
54
+ // src/legacy-compat/use-guards.mts
55
+ function UseGuards(...guards) {
56
+ return legacy(require_module.UseGuards(...guards));
257
57
  }
258
-
259
- //#endregion
260
- //#region src/legacy-compat/attribute.factory.mts
261
- /**
262
- * Legacy-compatible factory for creating custom attribute decorators.
263
- *
264
- * Works with TypeScript experimental decorators (legacy API).
265
- *
266
- * Attributes allow you to add custom metadata to modules, controllers, and endpoints.
267
- * This is useful for cross-cutting concerns like rate limiting, caching, API versioning, etc.
268
- *
269
- * @example
270
- * ```typescript
271
- * // Create a simple boolean attribute
272
- * const Public = LegacyAttributeFactory.createAttribute(Symbol.for('Public'))
273
- *
274
- * // Use it as a decorator
275
- * @Controller()
276
- * @Public()
277
- * export class PublicController { }
278
- *
279
- * // Check if attribute exists
280
- * if (LegacyAttributeFactory.has(Public, controllerMetadata)) {
281
- * // Skip authentication
282
- * }
283
- * ```
284
- *
285
- * @example
286
- * ```typescript
287
- * // Create an attribute with a validated value
288
- * const RateLimit = LegacyAttributeFactory.createAttribute(
289
- * Symbol.for('RateLimit'),
290
- * z.object({ requests: z.number(), window: z.number() })
291
- * )
292
- *
293
- * // Use it with a value
294
- * @Endpoint(apiEndpoint)
295
- * @RateLimit({ requests: 100, window: 60000 })
296
- * async handler() { }
297
- *
298
- * // Get the value
299
- * const limit = LegacyAttributeFactory.get(RateLimit, endpointMetadata)
300
- * // limit is typed as { requests: number, window: number } | null
301
- * ```
302
- */ var LegacyAttributeFactory = class {
303
- static createAttribute(token, schema) {
304
- const res = (value) => {
305
- function decorator(target, propertyKey, descriptor) {
306
- if (propertyKey !== void 0 && descriptor !== void 0) {
307
- const context = (0, _navios_di_legacy_compat.createMethodContext)(target, propertyKey, descriptor);
308
- const metadata = require_use_guards_decorator.getEndpointMetadata(descriptor.value, context);
309
- if (schema) {
310
- const validatedValue = schema.safeParse(value);
311
- if (!validatedValue.success) throw new Error(`[Navios] Invalid value for attribute ${token.toString()}: ${validatedValue.error}`);
312
- metadata.customAttributes.set(token, validatedValue.data);
313
- } else metadata.customAttributes.set(token, true);
314
- return descriptor;
315
- } else {
316
- const isController = require_use_guards_decorator.hasControllerMetadata(target);
317
- const isModule = require_tokens.hasModuleMetadata(target);
318
- const isManaged = require_use_guards_decorator.hasManagedMetadata(target);
319
- if (!isController && !isModule && !isManaged) throw new Error("[Navios] Attribute can only be applied to classes with @Controller, @Module, or other Navios-managed decorators");
320
- const context = (0, _navios_di_legacy_compat.createClassContext)(target);
321
- const metadata = isController ? require_use_guards_decorator.getControllerMetadata(target, context) : isModule ? require_tokens.getModuleMetadata(target, context) : isManaged ? require_use_guards_decorator.getManagedMetadata(target) : null;
322
- if (!metadata) throw new Error("[Navios] Could not determine metadata for attribute target");
323
- if (schema) {
324
- const validatedValue = schema.safeParse(value);
325
- if (!validatedValue.success) throw new Error(`[Navios] Invalid value for attribute ${token.toString()}: ${validatedValue.error}`);
326
- metadata.customAttributes.set(token, validatedValue.data);
327
- } else metadata.customAttributes.set(token, true);
328
- return target;
329
- }
330
- }
331
- return decorator;
332
- };
333
- res.token = token;
334
- if (schema) res.schema = schema;
335
- return res;
336
- }
337
- static get(attribute, target) {
338
- return target.customAttributes.get(attribute.token) ?? null;
339
- }
340
- static getAll(attribute, target) {
341
- const values = Array.from(target.customAttributes.entries()).filter(([key]) => key === attribute.token).map(([, value]) => value);
342
- return values.length > 0 ? values : null;
343
- }
344
- static getLast(attribute, target) {
345
- for (let i = target.length - 1; i >= 0; i--) {
346
- const value = target[i].customAttributes.get(attribute.token);
347
- if (value) return value;
348
- }
349
- return null;
350
- }
351
- static has(attribute, target) {
352
- return target.customAttributes.has(attribute.token);
58
+ // src/legacy-compat/use-interceptors.mts
59
+ function UseInterceptors(...interceptors) {
60
+ return legacy(require_module.UseInterceptors(...interceptors));
61
+ }
62
+ exports.AttributeFactory = AttributeFactory;
63
+ Object.defineProperty(exports, "Factory", {
64
+ enumerable: true,
65
+ get: function() {
66
+ return _navios_di_legacy_compat.Factory;
353
67
  }
354
- };
355
-
356
- //#endregion
357
- exports.AttributeFactory = LegacyAttributeFactory;
358
- exports.Controller = Controller;
359
- exports.Endpoint = Endpoint;
360
- Object.defineProperty(exports, 'Factory', {
361
- enumerable: true,
362
- get: function () {
363
- return _navios_di_legacy_compat.Factory;
364
- }
365
68
  });
366
- exports.Header = Header;
367
- exports.HttpCode = HttpCode;
368
- Object.defineProperty(exports, 'Injectable', {
369
- enumerable: true,
370
- get: function () {
371
- return _navios_di_legacy_compat.Injectable;
372
- }
69
+ Object.defineProperty(exports, "Injectable", {
70
+ enumerable: true,
71
+ get: function() {
72
+ return _navios_di_legacy_compat.Injectable;
73
+ }
373
74
  });
374
- exports.LegacyAttributeFactory = LegacyAttributeFactory;
375
75
  exports.Module = Module;
376
- exports.Multipart = Multipart;
377
- exports.Stream = Stream;
378
76
  exports.UseGuards = UseGuards;
379
- Object.defineProperty(exports, 'createClassContext', {
380
- enumerable: true,
381
- get: function () {
382
- return _navios_di_legacy_compat.createClassContext;
383
- }
77
+ exports.UseInterceptors = UseInterceptors;
78
+ Object.defineProperty(exports, "createClassContext", {
79
+ enumerable: true,
80
+ get: function() {
81
+ return _navios_di_legacy_compat.createClassContext;
82
+ }
384
83
  });
385
- Object.defineProperty(exports, 'createMethodContext', {
386
- enumerable: true,
387
- get: function () {
388
- return _navios_di_legacy_compat.createMethodContext;
389
- }
84
+ Object.defineProperty(exports, "createMethodContext", {
85
+ enumerable: true,
86
+ get: function() {
87
+ return _navios_di_legacy_compat.createMethodContext;
88
+ }
390
89
  });
90
+ exports.legacy = legacy;
91
+
391
92
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["createClassContext","Module","OriginalModule","options","controllers","imports","guards","target","context","originalDecorator","createClassContext","Controller","OriginalController","options","target","context","originalDecorator","createMethodContext","Endpoint","OriginalEndpoint","endpoint","target","propertyKey","descriptor","Error","typedDescriptor","context","originalDecorator","result","value","createClassContext","createMethodContext","UseGuards","OriginalUseGuards","guards","decoratorImpl","target","propertyKey","descriptor","undefined","context","originalDecorator","result","value","createMethodContext","Header","OriginalHeader","name","value","target","propertyKey","descriptor","context","originalDecorator","result","createMethodContext","HttpCode","OriginalHttpCode","code","target","propertyKey","descriptor","context","originalDecorator","result","value","createMethodContext","Multipart","OriginalMultipart","endpoint","target","propertyKey","descriptor","Error","context","originalDecorator","result","value","createMethodContext","Stream","OriginalStream","endpoint","target","propertyKey","descriptor","value","Error","typedDescriptor","context","originalDecorator","result","createClassContext","createMethodContext","getControllerMetadata","getEndpointMetadata","getModuleMetadata","hasControllerMetadata","hasModuleMetadata","getManagedMetadata","hasManagedMetadata","LegacyAttributeFactory","createAttribute","token","schema","res","value","decorator","target","propertyKey","descriptor","isMethodDecorator","undefined","context","metadata","validatedValue","safeParse","success","Error","toString","error","customAttributes","set","data","isController","isModule","isManaged","get","attribute","getAll","values","Array","from","entries","filter","key","map","length","getLast","i","has","AttributeFactory"],"sources":["../../src/legacy-compat/decorators/module.decorator.mts","../../src/legacy-compat/decorators/controller.decorator.mts","../../src/legacy-compat/decorators/endpoint.decorator.mts","../../src/legacy-compat/decorators/use-guards.decorator.mts","../../src/legacy-compat/decorators/header.decorator.mts","../../src/legacy-compat/decorators/http-code.decorator.mts","../../src/legacy-compat/decorators/multipart.decorator.mts","../../src/legacy-compat/decorators/stream.decorator.mts","../../src/legacy-compat/attribute.factory.mts"],"sourcesContent":["import type { ClassType } from '@navios/di'\nimport { createClassContext } from '@navios/di/legacy-compat'\n\nimport { Module as OriginalModule, type ModuleOptions } from '../../decorators/module.decorator.mjs'\n\n/**\n * Legacy-compatible Module decorator.\n * \n * Works with TypeScript experimental decorators (legacy API).\n * \n * @param options - Module configuration options\n * @returns A class decorator compatible with legacy decorator API\n * \n * @example\n * ```typescript\n * @Module({\n * controllers: [UserController, AuthController],\n * imports: [DatabaseModule],\n * guards: [AuthGuard],\n * })\n * export class AppModule {}\n * ```\n */\nexport function Module(\n options: ModuleOptions = {\n controllers: [],\n imports: [],\n guards: [],\n },\n) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n const originalDecorator = OriginalModule(options)\n return originalDecorator(target, context)\n }\n}\n\n","import type { ClassType } from '@navios/di'\nimport { createClassContext } from '@navios/di/legacy-compat'\n\nimport type { ControllerOptions } from '../../decorators/controller.decorator.mjs'\n\nimport { Controller as OriginalController } from '../../decorators/controller.decorator.mjs'\n\n/**\n * Legacy-compatible Controller decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - Controller configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller({ guards: [AuthGuard] })\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * async getUser() { }\n * }\n * ```\n */\nexport function Controller(options: ControllerOptions = {}) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n const originalDecorator = OriginalController(options)\n return originalDecorator(target, context)\n }\n}\n","import type {\n EndpointHandler,\n EndpointOptions,\n RequestArgs,\n} from '@navios/builder'\nimport { createMethodContext } from '@navios/di/legacy-compat'\nimport type { z } from 'zod/v4'\n\nimport { Endpoint as OriginalEndpoint } from '../../decorators/endpoint.decorator.mjs'\n\n/**\n * Type helper to constrain a PropertyDescriptor's value to match an endpoint signature.\n * Note: In legacy decorators, type constraints are checked when the decorator is applied,\n * but may not be preserved perfectly when decorators are stacked.\n */\ntype EndpointMethodDescriptor<Config extends EndpointOptions> =\n TypedPropertyDescriptor<\n (\n params: RequestArgs<\n Config['url'],\n Config['querySchema'],\n Config['requestSchema'],\n Config['urlParamsSchema'],\n true\n >,\n ) => Promise<z.input<Config['responseSchema']>>\n >\n\n/**\n * Legacy-compatible Endpoint decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Provides type safety by ensuring method signatures match the endpoint configuration.\n *\n * @param endpoint - The endpoint declaration from @navios/builder\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * async getUser(request: EndpointParams<typeof getUserEndpoint>): EndpointResult<typeof getUserEndpoint> {\n * return { id: '1', name: 'John' }\n * }\n * }\n * ```\n */\nexport function Endpoint<const Config extends EndpointOptions>(\n endpoint: EndpointHandler<Config, false>,\n) {\n return function (\n target: any,\n propertyKey: string | symbol,\n descriptor: EndpointMethodDescriptor<Config>,\n ): PropertyDescriptor | void {\n if (!descriptor) {\n throw new Error(\n '[Navios] @Endpoint decorator requires a method descriptor. Make sure experimentalDecorators is enabled.',\n )\n }\n // Type check the descriptor value matches expected signature\n const typedDescriptor = descriptor as EndpointMethodDescriptor<Config>\n const context = createMethodContext(target, propertyKey, typedDescriptor)\n const originalDecorator = OriginalEndpoint(endpoint)\n // @ts-expect-error - we don't need to type the value\n const result = originalDecorator(typedDescriptor.value, context)\n if (result !== typedDescriptor.value) {\n typedDescriptor.value = result as any\n }\n return typedDescriptor\n }\n}\n","import type {\n ClassType,\n ClassTypeWithInstance,\n InjectionToken,\n} from '@navios/di'\nimport { createClassContext, createMethodContext } from '@navios/di/legacy-compat'\n\nimport type { CanActivate } from '../../interfaces/index.mjs'\n\nimport { UseGuards as OriginalUseGuards } from '../../decorators/use-guards.decorator.mjs'\n\n/**\n * Legacy-compatible UseGuards decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Can be applied to classes or methods.\n *\n * @param guards - Guard classes or injection tokens to apply\n * @returns A class or method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * // Apply to a controller\n * @Controller()\n * @UseGuards(AuthGuard, RoleGuard)\n * export class UserController { }\n *\n * // Apply to a specific endpoint\n * @Controller()\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * @UseGuards(AuthGuard)\n * async getUser() { }\n * }\n * ```\n */\nexport function UseGuards(\n ...guards: (\n | ClassTypeWithInstance<CanActivate>\n | InjectionToken<CanActivate, undefined>\n )[]\n) {\n // Create the decorator function\n // Note: TypeScript's legacy decorator system has strict type checking for decorators\n // We use a flexible implementation that works for both class and method decorators\n function decoratorImpl(\n target: ClassType | Function,\n propertyKey?: string | symbol,\n descriptor?: PropertyDescriptor,\n ): any {\n // Determine if this is a class or method decorator\n if (propertyKey !== undefined && descriptor !== undefined) {\n // Method decorator\n const context = createMethodContext(\n target as Function,\n propertyKey,\n descriptor,\n )\n const originalDecorator = OriginalUseGuards(...guards)\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result\n }\n return descriptor\n } else {\n // Class decorator\n const context = createClassContext(target as ClassType)\n const originalDecorator = OriginalUseGuards(...guards)\n return originalDecorator(target as ClassType, context)\n }\n }\n\n // Return with 'any' type to work around TypeScript's strict decorator checking\n // TypeScript's legacy decorator system cannot properly type-check decorators\n // that work as both class and method decorators. The runtime behavior is correct.\n // When used as a class decorator, it returns the class (preserving type at runtime)\n // When used as a method decorator, it returns the PropertyDescriptor\n // @ts-ignore - TypeScript limitation with dual-purpose legacy decorators\n return decoratorImpl as any\n}\n","import { createMethodContext } from '@navios/di/legacy-compat'\n\nimport type { HttpHeader } from '../../interfaces/index.mjs'\n\nimport { Header as OriginalHeader } from '../../decorators/header.decorator.mjs'\n\n/**\n * Legacy-compatible Header decorator.\n * \n * Works with TypeScript experimental decorators (legacy API).\n * \n * @param name - The header name (e.g., 'Content-Type', 'Cache-Control')\n * @param value - The header value (string, number, or array of strings)\n * @returns A method decorator compatible with legacy decorator API\n * \n * @example\n * ```typescript\n * @Controller()\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * @Header('Cache-Control', 'max-age=3600')\n * async getUser() {\n * return { id: '1', name: 'John' }\n * }\n * }\n * ```\n */\nexport function Header(name: HttpHeader, value: string | number | string[]) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ) {\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalHeader(name, value)\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result\n }\n return descriptor\n }\n}\n\n","import { createMethodContext } from '@navios/di/legacy-compat'\n\nimport { HttpCode as OriginalHttpCode } from '../../decorators/http-code.decorator.mjs'\n\n/**\n * Legacy-compatible HttpCode decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param code - The HTTP status code to return (e.g., 201, 204, 202)\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class UserController {\n * @Endpoint(createUserEndpoint)\n * @HttpCode(201)\n * async createUser() {\n * return { id: '1', name: 'John' }\n * }\n * }\n * ```\n */\nexport function HttpCode(code: number) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ) {\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalHttpCode(code)\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result\n }\n return descriptor\n }\n}\n","import type {\n EndpointHandler,\n EndpointOptions,\n RequestArgs,\n} from '@navios/builder'\nimport { createMethodContext } from '@navios/di/legacy-compat'\nimport type { z } from 'zod/v4'\n\nimport { Multipart as OriginalMultipart } from '../../decorators/multipart.decorator.mjs'\n\n/**\n * Type helper to constrain a PropertyDescriptor's value to match a multipart endpoint signature.\n * Note: In legacy decorators, type constraints are checked when the decorator is applied,\n * but may not be preserved perfectly when decorators are stacked.\n */\ntype MultipartMethodDescriptor<Config extends EndpointOptions> =\n TypedPropertyDescriptor<\n (\n params: RequestArgs<\n Config['url'],\n Config['querySchema'],\n Config['requestSchema'],\n Config['urlParamsSchema'],\n true\n >,\n ) => Promise<z.input<Config['responseSchema']>>\n >\n\n/**\n * Legacy-compatible Multipart decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Provides type safety by ensuring method signatures match the endpoint configuration.\n *\n * @param endpoint - The multipart endpoint declaration from @navios/builder\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class FileController {\n * @Multipart(uploadFileEndpoint)\n * async uploadFile(request: MultipartParams<typeof uploadFileEndpoint>): MultipartResult<typeof uploadFileEndpoint> {\n * const { file } = request.data\n * return { url: 'https://example.com/file.jpg' }\n * }\n * }\n * ```\n */\nexport function Multipart<const Config extends EndpointOptions>(\n endpoint: EndpointHandler<Config, false>,\n) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: MultipartMethodDescriptor<Config>,\n ): PropertyDescriptor | void {\n if (!descriptor) {\n throw new Error(\n '[Navios] @Multipart decorator requires a method descriptor. Make sure experimentalDecorators is enabled.',\n )\n }\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalMultipart(endpoint)\n // @ts-expect-error - we don't need to type the value\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result as any\n }\n return descriptor\n }\n}\n","import type {\n BaseEndpointOptions,\n RequestArgs,\n StreamHandler,\n} from '@navios/builder'\nimport { createMethodContext } from '@navios/di/legacy-compat'\n\nimport { Stream as OriginalStream } from '../../decorators/stream.decorator.mjs'\n\n/**\n * Type helper to constrain a PropertyDescriptor's value to match a stream endpoint signature.\n * Supports both with and without reply parameter (Bun doesn't use reply parameter).\n * Note: In legacy decorators, type constraints are checked when the decorator is applied,\n * but may not be preserved perfectly when decorators are stacked.\n */\ntype StreamMethodDescriptor<Config extends BaseEndpointOptions> =\n | TypedPropertyDescriptor<\n (\n params: RequestArgs<\n Config['url'],\n Config['querySchema'],\n Config['requestSchema'],\n Config['urlParamsSchema'],\n true\n >,\n reply: any,\n ) => any\n >\n | TypedPropertyDescriptor<\n (\n params: RequestArgs<\n Config['url'],\n Config['querySchema'],\n Config['requestSchema'],\n Config['urlParamsSchema'],\n true\n >,\n ) => any\n >\n\n/**\n * Legacy-compatible Stream decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Provides type safety by ensuring method signatures match the endpoint configuration.\n *\n * @param endpoint - The stream endpoint declaration from @navios/builder\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class FileController {\n * @Stream(downloadFileEndpoint)\n * async downloadFile(request: StreamParams<typeof downloadFileEndpoint>, reply: any) {\n * const { fileId } = request.urlParams\n * // Stream file data to reply\n * }\n * }\n * ```\n */\nexport function Stream<const Config extends BaseEndpointOptions>(\n endpoint: StreamHandler<Config, false>,\n) {\n return function (\n target: any,\n propertyKey: string | symbol,\n descriptor: StreamMethodDescriptor<Config>,\n ): PropertyDescriptor | void {\n if (!descriptor || !descriptor.value) {\n throw new Error(\n '[Navios] @Stream decorator requires a method descriptor. Make sure experimentalDecorators is enabled.',\n )\n }\n // Type check the descriptor value matches expected signature\n const typedDescriptor = descriptor as StreamMethodDescriptor<Config>\n const context = createMethodContext(target, propertyKey, typedDescriptor)\n const originalDecorator = OriginalStream(endpoint)\n // Stage3 decorator returns void in type signature but actually returns the function\n // We know value is defined because we checked above\n const result = originalDecorator(typedDescriptor.value!, context) as\n | typeof typedDescriptor.value\n | void\n if (result && result !== typedDescriptor.value) {\n typedDescriptor.value = result as any\n }\n return typedDescriptor\n }\n}\n","import type { ClassType } from '@navios/di'\nimport { createClassContext, createMethodContext } from '@navios/di/legacy-compat'\nimport type { z, ZodType } from 'zod/v4'\n\nimport type {\n ControllerMetadata,\n HandlerMetadata,\n ModuleMetadata,\n} from '../metadata/index.mjs'\n\nimport {\n getControllerMetadata,\n getEndpointMetadata,\n getModuleMetadata,\n hasControllerMetadata,\n hasModuleMetadata,\n} from '../metadata/index.mjs'\nimport {\n getManagedMetadata,\n hasManagedMetadata,\n} from '../metadata/navios-managed.metadata.mjs'\n\n/**\n * Type for a legacy class/method attribute decorator without a value.\n *\n * Attributes are custom metadata decorators that can be applied to modules,\n * controllers, and endpoints.\n */\nexport type LegacyClassAttribute = {\n (): ClassDecorator & MethodDecorator\n token: symbol\n}\n\n/**\n * Type for a legacy class/method attribute decorator with a validated value.\n *\n * @typeParam S - The Zod schema type for validation\n */\nexport type LegacyClassSchemaAttribute<S extends ZodType> = {\n (value: z.input<S>): ClassDecorator & MethodDecorator\n token: symbol\n schema: ZodType\n}\n\n/**\n * Legacy-compatible factory for creating custom attribute decorators.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * Attributes allow you to add custom metadata to modules, controllers, and endpoints.\n * This is useful for cross-cutting concerns like rate limiting, caching, API versioning, etc.\n *\n * @example\n * ```typescript\n * // Create a simple boolean attribute\n * const Public = LegacyAttributeFactory.createAttribute(Symbol.for('Public'))\n *\n * // Use it as a decorator\n * @Controller()\n * @Public()\n * export class PublicController { }\n *\n * // Check if attribute exists\n * if (LegacyAttributeFactory.has(Public, controllerMetadata)) {\n * // Skip authentication\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Create an attribute with a validated value\n * const RateLimit = LegacyAttributeFactory.createAttribute(\n * Symbol.for('RateLimit'),\n * z.object({ requests: z.number(), window: z.number() })\n * )\n *\n * // Use it with a value\n * @Endpoint(apiEndpoint)\n * @RateLimit({ requests: 100, window: 60000 })\n * async handler() { }\n *\n * // Get the value\n * const limit = LegacyAttributeFactory.get(RateLimit, endpointMetadata)\n * // limit is typed as { requests: number, window: number } | null\n * ```\n */\nexport class LegacyAttributeFactory {\n /**\n * Creates a simple attribute decorator without a value.\n *\n * @param token - A unique symbol to identify this attribute\n * @returns A decorator function that can be applied to classes or methods\n *\n * @example\n * ```typescript\n * const Public = LegacyAttributeFactory.createAttribute(Symbol.for('Public'))\n *\n * @Public()\n * @Controller()\n * export class PublicController { }\n * ```\n */\n static createAttribute(token: symbol): LegacyClassAttribute\n /**\n * Creates an attribute decorator with a validated value.\n *\n * @param token - A unique symbol to identify this attribute\n * @param schema - A Zod schema to validate the attribute value\n * @returns A decorator function that accepts a value and can be applied to classes or methods\n *\n * @example\n * ```typescript\n * const RateLimit = LegacyAttributeFactory.createAttribute(\n * Symbol.for('RateLimit'),\n * z.object({ requests: z.number(), window: z.number() })\n * )\n *\n * @RateLimit({ requests: 100, window: 60000 })\n * @Endpoint(apiEndpoint)\n * async handler() { }\n * ```\n */\n static createAttribute<T extends ZodType>(\n token: symbol,\n schema: T,\n ): LegacyClassSchemaAttribute<T>\n\n static createAttribute(token: symbol, schema?: ZodType) {\n const res = (value?: unknown) => {\n // Return a decorator that can handle both class and method targets\n function decorator(target: any): any\n function decorator(\n target: any,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ): PropertyDescriptor\n function decorator(\n target: any,\n propertyKey?: string | symbol,\n descriptor?: PropertyDescriptor,\n ): any {\n const isMethodDecorator =\n propertyKey !== undefined && descriptor !== undefined\n\n if (isMethodDecorator) {\n // Method decorator - apply to endpoint\n const context = createMethodContext(target, propertyKey, descriptor)\n const metadata = getEndpointMetadata(descriptor.value, context)\n\n if (schema) {\n const validatedValue = schema.safeParse(value)\n if (!validatedValue.success) {\n throw new Error(\n `[Navios] Invalid value for attribute ${token.toString()}: ${validatedValue.error}`,\n )\n }\n metadata.customAttributes.set(token, validatedValue.data)\n } else {\n metadata.customAttributes.set(token, true)\n }\n return descriptor\n } else {\n // Class decorator\n const isController = hasControllerMetadata(target as ClassType)\n const isModule = hasModuleMetadata(target as ClassType)\n const isManaged = hasManagedMetadata(target as ClassType)\n\n if (!isController && !isModule && !isManaged) {\n throw new Error(\n '[Navios] Attribute can only be applied to classes with @Controller, @Module, or other Navios-managed decorators',\n )\n }\n\n const context = createClassContext(target)\n const metadata = isController\n ? getControllerMetadata(target, context)\n : isModule\n ? getModuleMetadata(target, context)\n : isManaged\n ? getManagedMetadata(target)!\n : null\n\n if (!metadata) {\n throw new Error(\n '[Navios] Could not determine metadata for attribute target',\n )\n }\n\n if (schema) {\n const validatedValue = schema.safeParse(value)\n if (!validatedValue.success) {\n throw new Error(\n `[Navios] Invalid value for attribute ${token.toString()}: ${validatedValue.error}`,\n )\n }\n metadata.customAttributes.set(token, validatedValue.data)\n } else {\n metadata.customAttributes.set(token, true)\n }\n return target\n }\n }\n return decorator\n }\n res.token = token\n if (schema) {\n res.schema = schema\n }\n return res\n }\n\n /**\n * Gets the value of an attribute from metadata.\n *\n * Returns `null` if the attribute is not present.\n * For simple attributes (without values), returns `true` if present.\n *\n * @param attribute - The attribute decorator\n * @param target - The metadata object (module, controller, or handler)\n * @returns The attribute value, `true` for simple attributes, or `null` if not found\n *\n * @example\n * ```typescript\n * const isPublic = LegacyAttributeFactory.get(Public, controllerMetadata)\n * // isPublic is true | null\n *\n * const rateLimit = LegacyAttributeFactory.get(RateLimit, endpointMetadata)\n * // rateLimit is { requests: number, window: number } | null\n * ```\n */\n static get(\n attribute: LegacyClassAttribute,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): true | null\n static get<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): z.output<T> | null\n static get(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ) {\n return target.customAttributes.get(attribute.token) ?? null\n }\n\n /**\n * Gets all values of an attribute from metadata (useful when an attribute can appear multiple times).\n *\n * Returns `null` if the attribute is not present.\n *\n * @param attribute - The attribute decorator\n * @param target - The metadata object (module, controller, or handler)\n * @returns An array of attribute values, or `null` if not found\n *\n * @example\n * ```typescript\n * const tags = LegacyAttributeFactory.getAll(Tag, endpointMetadata)\n * // tags is string[] | null\n * ```\n */\n static getAll(\n attribute: LegacyClassAttribute,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): Array<true> | null\n static getAll<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): Array<z.output<T>> | null\n static getAll(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ) {\n const values = Array.from(target.customAttributes.entries())\n .filter(([key]) => key === attribute.token)\n .map(([, value]) => value)\n return values.length > 0 ? values : null\n }\n\n /**\n * Gets the last value of an attribute from an array of metadata objects.\n *\n * Searches from the end of the array backwards, useful for finding the most\n * specific attribute value (e.g., endpoint-level overrides module-level).\n *\n * @param attribute - The attribute decorator\n * @param target - An array of metadata objects (typically [module, controller, handler])\n * @returns The last attribute value found, or `null` if not found\n *\n * @example\n * ```typescript\n * // Check attribute hierarchy: endpoint -> controller -> module\n * const rateLimit = LegacyAttributeFactory.getLast(RateLimit, [\n * moduleMetadata,\n * controllerMetadata,\n * endpointMetadata\n * ])\n * ```\n */\n static getLast(\n attribute: LegacyClassAttribute,\n target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[],\n ): true | null\n static getLast<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[],\n ): z.output<T> | null\n static getLast(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[],\n ) {\n for (let i = target.length - 1; i >= 0; i--) {\n const value = target[i].customAttributes.get(attribute.token)\n if (value) {\n return value\n }\n }\n return null\n }\n\n /**\n * Checks if an attribute is present on the metadata object.\n *\n * @param attribute - The attribute decorator\n * @param target - The metadata object (module, controller, or handler)\n * @returns `true` if the attribute is present, `false` otherwise\n *\n * @example\n * ```typescript\n * if (LegacyAttributeFactory.has(Public, controllerMetadata)) {\n * // Skip authentication\n * }\n * ```\n */\n static has(\n attribute: LegacyClassAttribute,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): boolean\n static has<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): boolean\n static has(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ) {\n return target.customAttributes.has(attribute.token)\n }\n}\n\n// Re-export as AttributeFactory for convenience\nexport { LegacyAttributeFactory as AttributeFactory }\n"],"mappings":"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"}
1
+ {"version":3,"file":"index.cjs","names":["createClassContext","createMethodContext","StandardAttributeFactory","StandardModule","StandardUseGuards","StandardUseInterceptors"],"sources":["../../src/legacy-compat/legacy-decorator.mts","../../src/legacy-compat/attribute-factory.mts","../../src/legacy-compat/module.mts","../../src/legacy-compat/use-guards.mts","../../src/legacy-compat/use-interceptors.mts"],"sourcesContent":["import { createClassContext, createMethodContext } from '@navios/di/legacy-compat'\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport type StandardDecorator = (target: any, context: any) => any\n\n/** A decorator that accepts every legacy call shape. */\nexport type LegacyAnyDecorator = (\n target: any,\n propertyKey?: string | symbol,\n descriptor?: PropertyDescriptor,\n) => any\n\n/**\n * Turns a standard decorator into one that accepts the legacy call shapes:\n * `(constructor)`, `(prototype, key, descriptor)` and `(prototype, key)`.\n */\nexport function legacy(decorator: StandardDecorator) {\n return (target: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any => {\n if (propertyKey === undefined) {\n return decorator(target, createClassContext(target)) ?? target\n }\n if (descriptor && typeof descriptor.value === 'function') {\n const context = createMethodContext(target, propertyKey, descriptor)\n const replaced = decorator(descriptor.value, context)\n if (replaced && replaced !== descriptor.value) {\n descriptor.value = replaced\n }\n return descriptor\n }\n const context = createMethodContext(target, propertyKey, descriptor ?? {})\n decorator(undefined, { ...context, kind: 'field' })\n return undefined\n }\n}\n","import type { InferInput, StandardSchemaV1 } from '@navios/di'\n\nimport { AttributeFactory as StandardAttributeFactory } from '../attributes/attribute-factory.mjs'\n\nimport type { AttributeApplication } from '../attributes/attribute-factory.mjs'\n\nimport { legacy } from './legacy-decorator.mjs'\n\nimport type { LegacyAnyDecorator } from './legacy-decorator.mjs'\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * An attribute application usable as a legacy decorator and in\n * `handler(endpoint, { attributes: [...] }, fn)`.\n */\nexport type LegacyAttributeApplication = LegacyAnyDecorator &\n Pick<AttributeApplication, 'token' | 'value'>\n\nexport interface LegacyClassAttribute {\n (): LegacyAttributeApplication\n readonly token: symbol\n}\n\nexport interface LegacyClassSchemaAttribute<Schema extends StandardSchemaV1> {\n (value: InferInput<Schema>): LegacyAttributeApplication\n readonly token: symbol\n readonly schema: Schema\n}\n\nfunction createAttribute(token: symbol): LegacyClassAttribute\nfunction createAttribute<Schema extends StandardSchemaV1>(\n token: symbol,\n schema: Schema,\n): LegacyClassSchemaAttribute<Schema>\nfunction createAttribute(token: symbol, schema?: StandardSchemaV1): any {\n const standard: any = schema\n ? StandardAttributeFactory.createAttribute(token, schema)\n : StandardAttributeFactory.createAttribute(token)\n const attribute = (value?: unknown) => {\n const application: AttributeApplication = standard(value)\n return Object.assign(legacy(application), {\n token: application.token,\n value: application.value,\n })\n }\n return Object.assign(attribute, schema ? { token, schema } : { token })\n}\n\n/**\n * `AttributeFactory` whose attributes are legacy decorators. Reading\n * (`get`, `getAll`, `has`) is the same as the standard one.\n */\nexport const AttributeFactory = {\n createAttribute,\n get: StandardAttributeFactory.get,\n getAll: StandardAttributeFactory.getAll,\n has: StandardAttributeFactory.has,\n}\n","import type { ClassType } from '@navios/di'\n\nimport { Module as StandardModule } from '../modules/module.mjs'\n\nimport type { ModuleOptions } from '../modules/module-options.mjs'\n\nimport { legacy } from './legacy-decorator.mjs'\n\nexport function Module(options: ModuleOptions = {}) {\n return legacy(StandardModule(options)) as <T extends ClassType>(target: T) => T\n}\n","import { UseGuards as StandardUseGuards } from '../guards/use-guards.mjs'\n\nimport type { GuardClass } from '../guards/guard.mjs'\n\nimport { legacy } from './legacy-decorator.mjs'\n\nimport type { LegacyAnyDecorator } from './legacy-decorator.mjs'\n\nexport function UseGuards(...guards: GuardClass[]): LegacyAnyDecorator {\n return legacy(StandardUseGuards(...guards))\n}\n","import { UseInterceptors as StandardUseInterceptors } from '../interceptors/use-interceptors.mjs'\n\nimport type { InterceptorClass } from '../interceptors/interceptor.mjs'\n\nimport { legacy } from './legacy-decorator.mjs'\n\nimport type { LegacyAnyDecorator } from './legacy-decorator.mjs'\n\nexport function UseInterceptors(...interceptors: InterceptorClass[]): LegacyAnyDecorator {\n return legacy(StandardUseInterceptors(...interceptors))\n}\n"],"mappings":";;;;;;;;;AAiBA,SAAgB,OAAO,WAA8B;CACnD,QAAQ,QAAa,aAA+B,eAAyC;EAC3F,IAAI,gBAAgB,KAAA,GAClB,OAAO,UAAU,SAAA,GAAQA,yBAAAA,mBAAAA,CAAmB,MAAM,CAAC,KAAK;EAE1D,IAAI,cAAc,OAAO,WAAW,UAAU,YAAY;GACxD,MAAM,WAAA,GAAUC,yBAAAA,oBAAAA,CAAoB,QAAQ,aAAa,UAAU;GACnE,MAAM,WAAW,UAAU,WAAW,OAAO,OAAO;GACpD,IAAI,YAAY,aAAa,WAAW,OACtC,WAAW,QAAQ;GAErB,OAAO;EACT;EAEA,UAAU,KAAA,GAAW;GAAE,IAAA,GADPA,yBAAAA,oBAAAA,CAAoB,QAAQ,aAAa,cAAc,CAAC,CACxC;GAAG,MAAM;EAAQ,CAAC;CAEpD;AACF;;ACCA,SAAS,gBAAgB,OAAe,QAAgC;CACtE,MAAM,WAAgB,SAClBC,eAAAA,iBAAyB,gBAAgB,OAAO,MAAM,IACtDA,eAAAA,iBAAyB,gBAAgB,KAAK;CAClD,MAAM,aAAa,UAAoB;EACrC,MAAM,cAAoC,SAAS,KAAK;EACxD,OAAO,OAAO,OAAO,OAAO,WAAW,GAAG;GACxC,OAAO,YAAY;GACnB,OAAO,YAAY;EACrB,CAAC;CACH;CACA,OAAO,OAAO,OAAO,WAAW,SAAS;EAAE;EAAO;CAAO,IAAI,EAAE,MAAM,CAAC;AACxE;;;;;AAMA,MAAa,mBAAmB;CAC9B;CACA,KAAKA,eAAAA,iBAAyB;CAC9B,QAAQA,eAAAA,iBAAyB;CACjC,KAAKA,eAAAA,iBAAyB;AAChC;;AClDA,SAAgB,OAAO,UAAyB,CAAC,GAAG;CAClD,OAAO,OAAOC,eAAAA,OAAe,OAAO,CAAC;AACvC;;ACFA,SAAgB,UAAU,GAAG,QAA0C;CACrE,OAAO,OAAOC,eAAAA,UAAkB,GAAG,MAAM,CAAC;AAC5C;;ACFA,SAAgB,gBAAgB,GAAG,cAAsD;CACvF,OAAO,OAAOC,eAAAA,gBAAwB,GAAG,YAAY,CAAC;AACxD"}