@navios/core 0.5.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/README.md +18 -1
  3. package/docs/README.md +1 -0
  4. package/docs/legacy-compat.md +320 -0
  5. package/docs/testing.md +140 -17
  6. package/lib/index-BFwNx9WQ.d.cts +1951 -0
  7. package/lib/index-BFwNx9WQ.d.cts.map +1 -0
  8. package/lib/index-D657ijFO.d.mts +1951 -0
  9. package/lib/index-D657ijFO.d.mts.map +1 -0
  10. package/lib/index.cjs +157 -0
  11. package/lib/index.d.cts +3 -0
  12. package/lib/index.d.mts +3 -188
  13. package/lib/index.mjs +4 -1439
  14. package/lib/legacy-compat/index.cjs +315 -0
  15. package/lib/legacy-compat/index.cjs.map +1 -0
  16. package/lib/legacy-compat/index.d.cts +219 -0
  17. package/lib/legacy-compat/index.d.cts.map +1 -0
  18. package/lib/legacy-compat/index.d.mts +219 -0
  19. package/lib/legacy-compat/index.d.mts.map +1 -0
  20. package/lib/legacy-compat/index.mjs +308 -0
  21. package/lib/legacy-compat/index.mjs.map +1 -0
  22. package/lib/src-Cb1aTjl0.cjs +5710 -0
  23. package/lib/src-Cb1aTjl0.cjs.map +1 -0
  24. package/lib/src-DzPY5s6d.mjs +5353 -0
  25. package/lib/src-DzPY5s6d.mjs.map +1 -0
  26. package/lib/testing/index.cjs +106 -0
  27. package/lib/testing/index.cjs.map +1 -0
  28. package/lib/testing/index.d.cts +156 -0
  29. package/lib/testing/index.d.cts.map +1 -0
  30. package/lib/testing/index.d.mts +156 -0
  31. package/lib/testing/index.d.mts.map +1 -0
  32. package/lib/testing/index.mjs +100 -0
  33. package/lib/testing/index.mjs.map +1 -0
  34. package/lib/use-guards.decorator-DdvUhB03.cjs +622 -0
  35. package/lib/use-guards.decorator-DdvUhB03.cjs.map +1 -0
  36. package/lib/use-guards.decorator-kZ3lNK8v.mjs +454 -0
  37. package/lib/use-guards.decorator-kZ3lNK8v.mjs.map +1 -0
  38. package/package.json +26 -6
  39. package/project.json +2 -2
  40. package/src/attribute.factory.d.mts +175 -0
  41. package/src/attribute.factory.d.mts.map +1 -0
  42. package/src/attribute.factory.mts +154 -0
  43. package/src/config/config-service.interface.d.mts +39 -0
  44. package/src/config/config-service.interface.d.mts.map +1 -0
  45. package/src/config/config-service.interface.mts +31 -0
  46. package/src/config/config.provider.d.mts +46 -0
  47. package/src/config/config.provider.d.mts.map +1 -0
  48. package/src/config/config.provider.mts +36 -0
  49. package/src/config/config.service.d.mts +108 -0
  50. package/src/config/config.service.d.mts.map +1 -0
  51. package/src/config/config.service.mts +94 -4
  52. package/src/config/index.d.mts +6 -0
  53. package/src/config/index.d.mts.map +1 -0
  54. package/src/config/types.d.mts +13 -0
  55. package/src/config/types.d.mts.map +1 -0
  56. package/src/config/utils/helpers.d.mts +3 -0
  57. package/src/config/utils/helpers.d.mts.map +1 -0
  58. package/src/config/utils/index.d.mts +2 -0
  59. package/src/config/utils/index.d.mts.map +1 -0
  60. package/src/decorators/controller.decorator.d.mts +33 -0
  61. package/src/decorators/controller.decorator.d.mts.map +1 -0
  62. package/src/decorators/controller.decorator.mts +28 -0
  63. package/src/decorators/endpoint.decorator.d.mts +89 -0
  64. package/src/decorators/endpoint.decorator.d.mts.map +1 -0
  65. package/src/decorators/endpoint.decorator.mts +76 -0
  66. package/src/decorators/header.decorator.d.mts +22 -0
  67. package/src/decorators/header.decorator.d.mts.map +1 -0
  68. package/src/decorators/header.decorator.mts +19 -0
  69. package/src/decorators/http-code.decorator.d.mts +22 -0
  70. package/src/decorators/http-code.decorator.d.mts.map +1 -0
  71. package/src/decorators/http-code.decorator.mts +20 -0
  72. package/src/decorators/index.d.mts +9 -0
  73. package/src/decorators/index.d.mts.map +1 -0
  74. package/src/decorators/module.decorator.d.mts +42 -0
  75. package/src/decorators/module.decorator.d.mts.map +1 -0
  76. package/src/decorators/module.decorator.mts +34 -0
  77. package/src/decorators/multipart.decorator.d.mts +54 -0
  78. package/src/decorators/multipart.decorator.d.mts.map +1 -0
  79. package/src/decorators/multipart.decorator.mts +41 -0
  80. package/src/decorators/stream.decorator.d.mts +42 -0
  81. package/src/decorators/stream.decorator.d.mts.map +1 -0
  82. package/src/decorators/stream.decorator.mts +33 -0
  83. package/src/decorators/use-guards.decorator.d.mts +33 -0
  84. package/src/decorators/use-guards.decorator.d.mts.map +1 -0
  85. package/src/decorators/use-guards.decorator.mts +29 -0
  86. package/src/exceptions/bad-request.exception.d.mts +26 -0
  87. package/src/exceptions/bad-request.exception.d.mts.map +1 -0
  88. package/src/exceptions/bad-request.exception.mts +21 -0
  89. package/src/exceptions/conflict.exception.d.mts +29 -0
  90. package/src/exceptions/conflict.exception.d.mts.map +1 -0
  91. package/src/exceptions/conflict.exception.mts +24 -0
  92. package/src/exceptions/forbidden.exception.d.mts +28 -0
  93. package/src/exceptions/forbidden.exception.d.mts.map +1 -0
  94. package/src/exceptions/forbidden.exception.mts +23 -0
  95. package/src/exceptions/http.exception.d.mts +33 -0
  96. package/src/exceptions/http.exception.d.mts.map +1 -0
  97. package/src/exceptions/http.exception.mts +26 -0
  98. package/src/exceptions/index.d.mts +8 -0
  99. package/src/exceptions/index.d.mts.map +1 -0
  100. package/src/exceptions/internal-server-error.exception.d.mts +31 -0
  101. package/src/exceptions/internal-server-error.exception.d.mts.map +1 -0
  102. package/src/exceptions/internal-server-error.exception.mts +26 -0
  103. package/src/exceptions/not-found.exception.d.mts +30 -0
  104. package/src/exceptions/not-found.exception.d.mts.map +1 -0
  105. package/src/exceptions/not-found.exception.mts +23 -0
  106. package/src/exceptions/unauthorized.exception.d.mts +28 -0
  107. package/src/exceptions/unauthorized.exception.d.mts.map +1 -0
  108. package/src/exceptions/unauthorized.exception.mts +23 -0
  109. package/src/factories/endpoint-adapter.factory.d.mts +6 -0
  110. package/src/factories/endpoint-adapter.factory.d.mts.map +1 -0
  111. package/src/factories/http-adapter.factory.d.mts +6 -0
  112. package/src/factories/http-adapter.factory.d.mts.map +1 -0
  113. package/src/factories/index.d.mts +8 -0
  114. package/src/factories/index.d.mts.map +1 -0
  115. package/src/factories/index.mts +1 -0
  116. package/src/factories/multipart-adapter.factory.d.mts +6 -0
  117. package/src/factories/multipart-adapter.factory.d.mts.map +1 -0
  118. package/src/factories/reply.factory.d.mts +6 -0
  119. package/src/factories/reply.factory.d.mts.map +1 -0
  120. package/src/factories/request.factory.d.mts +6 -0
  121. package/src/factories/request.factory.d.mts.map +1 -0
  122. package/src/factories/stream-adapter.factory.d.mts +6 -0
  123. package/src/factories/stream-adapter.factory.d.mts.map +1 -0
  124. package/src/factories/xml-stream-adapter.factory.d.mts +6 -0
  125. package/src/factories/xml-stream-adapter.factory.d.mts.map +1 -0
  126. package/src/factories/xml-stream-adapter.factory.mts +20 -0
  127. package/src/index.d.mts +15 -0
  128. package/src/index.d.mts.map +1 -0
  129. package/src/index.mts +1 -0
  130. package/src/interfaces/abstract-execution-context.inteface.d.mts +44 -0
  131. package/src/interfaces/abstract-execution-context.inteface.d.mts.map +1 -0
  132. package/src/interfaces/abstract-execution-context.inteface.mts +35 -0
  133. package/src/interfaces/abstract-http-adapter.interface.d.mts +15 -0
  134. package/src/interfaces/abstract-http-adapter.interface.d.mts.map +1 -0
  135. package/src/interfaces/abstract-http-cors-options.interface.d.mts +58 -0
  136. package/src/interfaces/abstract-http-cors-options.interface.d.mts.map +1 -0
  137. package/src/interfaces/abstract-http-handler-adapter.interface.d.mts +7 -0
  138. package/src/interfaces/abstract-http-handler-adapter.interface.d.mts.map +1 -0
  139. package/src/interfaces/abstract-http-handler-adapter.interface.mts +2 -2
  140. package/src/interfaces/abstract-http-listen-options.interface.d.mts +5 -0
  141. package/src/interfaces/abstract-http-listen-options.interface.d.mts.map +1 -0
  142. package/src/interfaces/can-activate.d.mts +36 -0
  143. package/src/interfaces/can-activate.d.mts.map +1 -0
  144. package/src/interfaces/can-activate.mts +31 -0
  145. package/src/interfaces/http-header.d.mts +10 -0
  146. package/src/interfaces/http-header.d.mts.map +1 -0
  147. package/src/interfaces/index.d.mts +9 -0
  148. package/src/interfaces/index.d.mts.map +1 -0
  149. package/src/interfaces/navios-module.d.mts +29 -0
  150. package/src/interfaces/navios-module.d.mts.map +1 -0
  151. package/src/interfaces/navios-module.mts +25 -0
  152. package/src/legacy-compat/__type-tests__/legacy-decorators.spec-d.mts +420 -0
  153. package/src/legacy-compat/__type-tests__/tsconfig.json +15 -0
  154. package/src/legacy-compat/context-compat.d.mts +19 -0
  155. package/src/legacy-compat/context-compat.d.mts.map +1 -0
  156. package/src/legacy-compat/context-compat.mts +93 -0
  157. package/src/legacy-compat/decorators/controller.decorator.d.mts +21 -0
  158. package/src/legacy-compat/decorators/controller.decorator.d.mts.map +1 -0
  159. package/src/legacy-compat/decorators/controller.decorator.mts +31 -0
  160. package/src/legacy-compat/decorators/endpoint.decorator.d.mts +33 -0
  161. package/src/legacy-compat/decorators/endpoint.decorator.d.mts.map +1 -0
  162. package/src/legacy-compat/decorators/endpoint.decorator.mts +99 -0
  163. package/src/legacy-compat/decorators/header.decorator.d.mts +24 -0
  164. package/src/legacy-compat/decorators/header.decorator.d.mts.map +1 -0
  165. package/src/legacy-compat/decorators/header.decorator.mts +42 -0
  166. package/src/legacy-compat/decorators/http-code.decorator.d.mts +22 -0
  167. package/src/legacy-compat/decorators/http-code.decorator.d.mts.map +1 -0
  168. package/src/legacy-compat/decorators/http-code.decorator.mts +38 -0
  169. package/src/legacy-compat/decorators/index.d.mts +9 -0
  170. package/src/legacy-compat/decorators/index.d.mts.map +1 -0
  171. package/src/legacy-compat/decorators/index.mts +9 -0
  172. package/src/legacy-compat/decorators/module.decorator.d.mts +22 -0
  173. package/src/legacy-compat/decorators/module.decorator.d.mts.map +1 -0
  174. package/src/legacy-compat/decorators/module.decorator.mts +37 -0
  175. package/src/legacy-compat/decorators/multipart.decorator.d.mts +34 -0
  176. package/src/legacy-compat/decorators/multipart.decorator.d.mts.map +1 -0
  177. package/src/legacy-compat/decorators/multipart.decorator.mts +93 -0
  178. package/src/legacy-compat/decorators/stream.decorator.d.mts +34 -0
  179. package/src/legacy-compat/decorators/stream.decorator.d.mts.map +1 -0
  180. package/src/legacy-compat/decorators/stream.decorator.mts +76 -0
  181. package/src/legacy-compat/decorators/use-guards.decorator.d.mts +29 -0
  182. package/src/legacy-compat/decorators/use-guards.decorator.d.mts.map +1 -0
  183. package/src/legacy-compat/decorators/use-guards.decorator.mts +80 -0
  184. package/src/legacy-compat/index.d.mts +19 -0
  185. package/src/legacy-compat/index.d.mts.map +1 -0
  186. package/src/legacy-compat/index.mts +40 -0
  187. package/src/logger/console-logger.service.d.mts +196 -0
  188. package/src/logger/console-logger.service.d.mts.map +1 -0
  189. package/src/logger/console-logger.service.mts +15 -2
  190. package/src/logger/index.d.mts +7 -0
  191. package/src/logger/index.d.mts.map +1 -0
  192. package/src/logger/log-levels.d.mts +14 -0
  193. package/src/logger/log-levels.d.mts.map +1 -0
  194. package/src/logger/log-levels.mts +9 -0
  195. package/src/logger/logger-service.interface.d.mts +36 -0
  196. package/src/logger/logger-service.interface.d.mts.map +1 -0
  197. package/src/logger/logger.service.d.mts +57 -0
  198. package/src/logger/logger.service.d.mts.map +1 -0
  199. package/src/logger/logger.service.mts +19 -0
  200. package/src/logger/logger.tokens.d.mts +36 -0
  201. package/src/logger/logger.tokens.d.mts.map +1 -0
  202. package/src/logger/logger.tokens.mts +23 -0
  203. package/src/logger/utils/cli-colors.util.d.mts +10 -0
  204. package/src/logger/utils/cli-colors.util.d.mts.map +1 -0
  205. package/src/logger/utils/filter-log-levelts.util.d.mts +6 -0
  206. package/src/logger/utils/filter-log-levelts.util.d.mts.map +1 -0
  207. package/src/logger/utils/index.d.mts +6 -0
  208. package/src/logger/utils/index.d.mts.map +1 -0
  209. package/src/logger/utils/is-log-level-enabled.d.mts +8 -0
  210. package/src/logger/utils/is-log-level-enabled.d.mts.map +1 -0
  211. package/src/logger/utils/is-log-level.util.d.mts +6 -0
  212. package/src/logger/utils/is-log-level.util.d.mts.map +1 -0
  213. package/src/logger/utils/shared.utils.d.mts +14 -0
  214. package/src/logger/utils/shared.utils.d.mts.map +1 -0
  215. package/src/metadata/controller.metadata.d.mts +13 -0
  216. package/src/metadata/controller.metadata.d.mts.map +1 -0
  217. package/src/metadata/handler.metadata.d.mts +18 -0
  218. package/src/metadata/handler.metadata.d.mts.map +1 -0
  219. package/src/metadata/index.d.mts +4 -0
  220. package/src/metadata/index.d.mts.map +1 -0
  221. package/src/metadata/module.metadata.d.mts +13 -0
  222. package/src/metadata/module.metadata.d.mts.map +1 -0
  223. package/src/navios.application.d.mts +210 -0
  224. package/src/navios.application.d.mts.map +1 -0
  225. package/src/navios.application.mts +176 -2
  226. package/src/navios.environment.d.mts +11 -0
  227. package/src/navios.environment.d.mts.map +1 -0
  228. package/src/navios.factory.d.mts +68 -0
  229. package/src/navios.factory.d.mts.map +1 -0
  230. package/src/navios.factory.mts +59 -1
  231. package/src/services/guard-runner.service.d.mts +10 -0
  232. package/src/services/guard-runner.service.d.mts.map +1 -0
  233. package/src/services/guard-runner.service.mts +12 -11
  234. package/src/services/index.d.mts +3 -0
  235. package/src/services/index.d.mts.map +1 -0
  236. package/src/services/module-loader.service.d.mts +17 -0
  237. package/src/services/module-loader.service.d.mts.map +1 -0
  238. package/src/services/module-loader.service.mts +16 -11
  239. package/src/stores/index.d.mts +2 -0
  240. package/src/stores/index.d.mts.map +1 -0
  241. package/src/stores/index.mts +1 -0
  242. package/src/stores/request-id.store.d.mts +37 -0
  243. package/src/stores/request-id.store.d.mts.map +1 -0
  244. package/src/stores/request-id.store.mts +43 -0
  245. package/src/testing/index.mts +2 -0
  246. package/src/testing/testing-module.mts +231 -0
  247. package/src/tokens/endpoint-adapter.token.d.mts +4 -0
  248. package/src/tokens/endpoint-adapter.token.d.mts.map +1 -0
  249. package/src/tokens/execution-context.token.d.mts +5 -0
  250. package/src/tokens/execution-context.token.d.mts.map +1 -0
  251. package/src/tokens/http-adapter.token.d.mts +4 -0
  252. package/src/tokens/http-adapter.token.d.mts.map +1 -0
  253. package/src/tokens/index.d.mts +9 -0
  254. package/src/tokens/index.d.mts.map +1 -0
  255. package/src/tokens/index.mts +1 -0
  256. package/src/tokens/multipart-adapter.token.d.mts +4 -0
  257. package/src/tokens/multipart-adapter.token.d.mts.map +1 -0
  258. package/src/tokens/reply.token.d.mts +3 -0
  259. package/src/tokens/reply.token.d.mts.map +1 -0
  260. package/src/tokens/request.token.d.mts +3 -0
  261. package/src/tokens/request.token.d.mts.map +1 -0
  262. package/src/tokens/stream-adapter.token.d.mts +4 -0
  263. package/src/tokens/stream-adapter.token.d.mts.map +1 -0
  264. package/src/tokens/xml-stream-adapter.token.d.mts +4 -0
  265. package/src/tokens/xml-stream-adapter.token.d.mts.map +1 -0
  266. package/src/tokens/xml-stream-adapter.token.mts +8 -0
  267. package/tsconfig.lib.json +1 -1
  268. package/tsconfig.spec.json +3 -0
  269. package/tsdown.config.mts +35 -0
  270. package/vitest.config.mts +6 -0
  271. package/lib/_tsup-dts-rollup.d.mts +0 -1352
  272. package/lib/_tsup-dts-rollup.d.ts +0 -1352
  273. package/lib/index.d.ts +0 -188
  274. package/lib/index.js +0 -1519
  275. package/lib/index.js.map +0 -1
  276. package/lib/index.mjs.map +0 -1
  277. package/tsup.config.mts +0 -13
@@ -0,0 +1,1951 @@
1
+ import * as _navios_di0 from "@navios/di";
2
+ import { AnyInjectableType, ClassType, ClassTypeWithInstance, Container, FactoryContext, FactoryInjectionToken, InjectionToken, ScopedContainer } from "@navios/di";
3
+ import z, { ZodDiscriminatedUnion, ZodObject, ZodType, z as z$1 } from "zod/v4";
4
+ import { BaseEndpointConfig, BaseStreamConfig, EndpointFunctionArgs, HttpMethod, Util_FlatObject } from "@navios/builder";
5
+ import { InspectOptions } from "util";
6
+ import { AsyncLocalStorage } from "node:async_hooks";
7
+ import { OutgoingHttpHeaders } from "http";
8
+
9
+ //#region src/config/utils/helpers.d.mts
10
+ declare function envInt(key: keyof NodeJS.ProcessEnv, defaultValue: number): number;
11
+ declare function envString<DefaultValue extends string | undefined, Ensured = (DefaultValue extends string ? true : false)>(key: keyof NodeJS.ProcessEnv, defaultValue?: DefaultValue): Ensured extends true ? string : string | undefined;
12
+ //#endregion
13
+ //#region src/config/types.d.mts
14
+ /**
15
+ * Evaluates to `true` if `T` is `any`. `false` otherwise.
16
+ * (c) https://stackoverflow.com/a/68633327/5290447
17
+ */
18
+ type IsAny<T> = unknown extends T ? [keyof T] extends [never] ? false : true : false;
19
+ type ExcludedParts = 'services' | 'mailer' | 'aws' | 'computedTimeRates' | 'aiModelsRates';
20
+ type ExcludedKeys = 'computedTimeRates' | 'aiModelsRates' | 'aiModel';
21
+ type PathImpl<T, Key$1 extends keyof T> = Key$1 extends string ? Key$1 extends ExcludedKeys ? never : IsAny<T[Key$1]> extends true ? never : T[Key$1] extends string ? never : T[Key$1] extends any[] ? never : T[Key$1] extends Record<string, any> ? Key$1 extends ExcludedParts ? `${Key$1}.${Exclude<keyof T[Key$1], keyof any[]> & string}` : `${Key$1}.${PathImpl<T[Key$1], Exclude<keyof T[Key$1], keyof any[]>> & string}` | `${Key$1}.${Exclude<keyof T[Key$1], keyof any[]> & string}` : never : never;
22
+ type PathImpl2<T> = PathImpl<T, keyof T> | keyof T;
23
+ type Path<T> = keyof T extends string ? PathImpl2<T> extends infer P ? P extends string | keyof T ? P : keyof T : keyof T : never;
24
+ type PathValue<T, P extends Path<T>> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? Rest extends Path<T[Key]> ? PathValue<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
25
+ //#endregion
26
+ //#region src/config/config-service.interface.d.mts
27
+ /**
28
+ * Interface for configuration service implementations.
29
+ *
30
+ * Provides type-safe access to configuration values with support for nested paths.
31
+ *
32
+ * @typeParam Config - The configuration object type
33
+ */
34
+ interface ConfigServiceInterface<Config = Record<string, unknown>> {
35
+ /**
36
+ * Gets the entire configuration object.
37
+ */
38
+ getConfig: () => Config;
39
+ /**
40
+ * Gets a configuration value by key path. Returns `null` if not found.
41
+ *
42
+ * @param key - Dot-separated path to the configuration value (e.g., 'database.host')
43
+ * @returns The configuration value or `null` if not found
44
+ */
45
+ get: <Key$1 extends Path<Config>>(key: Key$1) => PathValue<Config, Key$1> | null;
46
+ /**
47
+ * Gets a configuration value by key path, or returns a default value if not found.
48
+ *
49
+ * @param key - Dot-separated path to the configuration value
50
+ * @param defaultValue - Default value to return if the key is not found
51
+ * @returns The configuration value or the default value
52
+ */
53
+ getOrDefault: <Key$1 extends Path<Config>>(key: Key$1, defaultValue: PathValue<Config, Key$1>) => PathValue<Config, Key$1>;
54
+ /**
55
+ * Gets a configuration value by key path, or throws an error if not found.
56
+ *
57
+ * @param key - Dot-separated path to the configuration value
58
+ * @param errorMessage - Optional custom error message
59
+ * @returns The configuration value
60
+ * @throws Error if the key is not found
61
+ */
62
+ getOrThrow: <Key$1 extends Path<Config>>(key: Key$1, errorMessage?: string) => PathValue<Config, Key$1>;
63
+ }
64
+ //#endregion
65
+ //#region src/config/config.service.d.mts
66
+ /**
67
+ * Schema for validating configuration service options.
68
+ */
69
+ declare const ConfigServiceOptionsSchema: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
70
+ /**
71
+ * Type for configuration service options.
72
+ */
73
+ type ConfigServiceOptions = z$1.infer<typeof ConfigServiceOptionsSchema>;
74
+ /**
75
+ * Injection token for ConfigService.
76
+ */
77
+ declare const ConfigServiceToken: InjectionToken<ConfigServiceInterface<Record<string, unknown>>, z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>, true>;
78
+ /**
79
+ * Service for managing application configuration with type-safe access.
80
+ *
81
+ * Provides methods to access configuration values using dot-notation paths
82
+ * with full TypeScript type inference.
83
+ *
84
+ * @typeParam Config - The configuration object type
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * interface AppConfig {
89
+ * database: {
90
+ * host: string
91
+ * port: number
92
+ * }
93
+ * api: {
94
+ * timeout: number
95
+ * }
96
+ * }
97
+ *
98
+ * @Injectable()
99
+ * export class DatabaseService {
100
+ * private config = inject(MyConfigService)
101
+ *
102
+ * connect() {
103
+ * const host = this.config.getOrThrow('database.host')
104
+ * const port = this.config.getOrDefault('database.port', 5432)
105
+ * // host is typed as string, port is typed as number
106
+ * }
107
+ * }
108
+ * ```
109
+ */
110
+ declare class ConfigService<Config extends ConfigServiceOptions = Record<string, unknown>> implements ConfigServiceInterface<Config> {
111
+ private config;
112
+ private readonly logger;
113
+ /**
114
+ * Creates a new ConfigService instance.
115
+ *
116
+ * @param config - The configuration object
117
+ */
118
+ constructor(config?: Config);
119
+ /**
120
+ * Gets the entire configuration object.
121
+ *
122
+ * @returns The complete configuration object
123
+ */
124
+ getConfig(): Config;
125
+ /**
126
+ * Gets a configuration value by key path.
127
+ *
128
+ * Returns `null` if the key is not found or if any part of the path is invalid.
129
+ *
130
+ * @param key - Dot-separated path to the configuration value (e.g., 'database.host')
131
+ * @returns The configuration value or `null` if not found
132
+ *
133
+ * @example
134
+ * ```typescript
135
+ * const host = config.get('database.host') // string | null
136
+ * const port = config.get('database.port') // number | null
137
+ * ```
138
+ */
139
+ get<Key$1 extends Path<Config>>(key: Key$1): PathValue<Config, Key$1> | null;
140
+ /**
141
+ * Gets a configuration value by key path, or returns a default value if not found.
142
+ *
143
+ * @param key - Dot-separated path to the configuration value
144
+ * @param defaultValue - Default value to return if the key is not found
145
+ * @returns The configuration value or the default value
146
+ *
147
+ * @example
148
+ * ```typescript
149
+ * const port = config.getOrDefault('database.port', 5432) // number
150
+ * ```
151
+ */
152
+ getOrDefault<Key$1 extends Path<Config>>(key: Key$1, defaultValue: PathValue<Config, Key$1>): PathValue<Config, Key$1>;
153
+ /**
154
+ * Gets a configuration value by key path, or throws an error if not found.
155
+ *
156
+ * @param key - Dot-separated path to the configuration value
157
+ * @param errorMessage - Optional custom error message
158
+ * @returns The configuration value
159
+ * @throws Error if the key is not found
160
+ *
161
+ * @example
162
+ * ```typescript
163
+ * const host = config.getOrThrow('database.host') // string (throws if not found)
164
+ * const apiKey = config.getOrThrow('api.key', 'API key is required') // string
165
+ * ```
166
+ */
167
+ getOrThrow<Key$1 extends Path<Config>>(key: Key$1, errorMessage?: string): PathValue<Config, Key$1>;
168
+ }
169
+ //#endregion
170
+ //#region src/config/config.provider.d.mts
171
+ /**
172
+ * Schema for configuration provider options.
173
+ */
174
+ declare const ConfigProviderOptions: z$1.ZodObject<{
175
+ load: z$1.ZodFunction<z$1.core.$ZodFunctionArgs, z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
176
+ }, z$1.core.$strip>;
177
+ /**
178
+ * Creates a factory injection token for ConfigService that loads configuration asynchronously.
179
+ *
180
+ * Use this when you need to load configuration from a file, database, or other async source.
181
+ *
182
+ * @param options - Configuration provider options
183
+ * @param options.load - Async function that loads and returns the configuration object
184
+ * @returns A factory injection token for ConfigService
185
+ *
186
+ * @example
187
+ * ```typescript
188
+ * const MyConfigService = provideConfig({
189
+ * load: async () => {
190
+ * const config = await loadConfigFromFile('config.json')
191
+ * return config
192
+ * },
193
+ * })
194
+ *
195
+ * // Use in module setup
196
+ * container.bind(ConfigServiceToken).toFactory(configProvider)
197
+ * ```
198
+ */
199
+ declare function provideConfig<ConfigMap extends ConfigServiceOptions>(options: z$1.input<typeof ConfigProviderOptions>): FactoryInjectionToken<ConfigService<ConfigMap>, typeof ConfigServiceOptionsSchema>;
200
+ /**
201
+ * Pre-configured ConfigService provider that uses environment variables.
202
+ *
203
+ * Provides a ConfigService instance bound to `process.env`.
204
+ *
205
+ * @example
206
+ * ```typescript
207
+ * // Use environment variables as configuration
208
+ * container.bind(ConfigServiceToken).toValue(EnvConfigProvider)
209
+ * ```
210
+ */
211
+ declare const EnvConfigProvider: _navios_di0.BoundInjectionToken<ConfigService<Record<string, string>>, z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
212
+ //#endregion
213
+ //#region src/decorators/controller.decorator.d.mts
214
+ /**
215
+ * Options for configuring a Navios controller.
216
+ */
217
+ interface ControllerOptions {
218
+ /**
219
+ * Guards to apply to all endpoints in this controller.
220
+ * Guards are executed in reverse order (last guard first).
221
+ */
222
+ guards?: ClassType[] | Set<ClassType>;
223
+ }
224
+ /**
225
+ * Decorator that marks a class as a Navios controller.
226
+ *
227
+ * Controllers handle HTTP requests and define endpoints.
228
+ * They are request-scoped by default, meaning a new instance is created for each request.
229
+ *
230
+ * @param options - Controller configuration options
231
+ * @returns A class decorator
232
+ *
233
+ * @example
234
+ * ```typescript
235
+ * @Controller({ guards: [AuthGuard] })
236
+ * export class UserController {
237
+ * @Endpoint(getUserEndpoint)
238
+ * async getUser(request: EndpointParams<typeof getUserEndpoint>) {
239
+ * // Handle request
240
+ * }
241
+ * }
242
+ * ```
243
+ */
244
+ declare function Controller({
245
+ guards
246
+ }?: ControllerOptions): (target: ClassType, context: ClassDecoratorContext) => ClassType;
247
+ //#endregion
248
+ //#region src/decorators/endpoint.decorator.d.mts
249
+ /**
250
+ * Extracts the typed parameters for an endpoint handler function.
251
+ *
252
+ * This utility type extracts URL parameters, query parameters, and request body
253
+ * from an endpoint declaration and flattens them into a single object.
254
+ *
255
+ * @typeParam EndpointDeclaration - The endpoint declaration from @navios/builder
256
+ *
257
+ * @example
258
+ * ```typescript
259
+ * const getUserEndpoint = api.declareEndpoint({
260
+ * method: 'get',
261
+ * url: '/users/$userId',
262
+ * querySchema: z.object({ include: z.string().optional() }),
263
+ * responseSchema: z.object({ id: z.string(), name: z.string() }),
264
+ * })
265
+ *
266
+ * @Endpoint(getUserEndpoint)
267
+ * async getUser(request: EndpointParams<typeof getUserEndpoint>) {
268
+ * // request.urlParams.userId is typed as string
269
+ * // request.query.include is typed as string | undefined
270
+ * }
271
+ * ```
272
+ */
273
+ type EndpointParams<EndpointDeclaration extends {
274
+ config: BaseEndpointConfig<any, any, any, any, any>;
275
+ }, Url extends string = EndpointDeclaration['config']['url'], QuerySchema = EndpointDeclaration['config']['querySchema']> = QuerySchema extends ZodType ? EndpointDeclaration['config']['requestSchema'] extends ZodType ? Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, EndpointDeclaration['config']['requestSchema'], true>> : Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, undefined, true>> : EndpointDeclaration['config']['requestSchema'] extends ZodType ? Util_FlatObject<EndpointFunctionArgs<Url, undefined, EndpointDeclaration['config']['requestSchema'], true>> : Util_FlatObject<EndpointFunctionArgs<Url, undefined, undefined, true>>;
276
+ /**
277
+ * Extracts the typed return value for an endpoint handler function.
278
+ *
279
+ * This utility type extracts the response schema from an endpoint declaration
280
+ * and returns the appropriate Promise type.
281
+ *
282
+ * @typeParam EndpointDeclaration - The endpoint declaration from @navios/builder
283
+ *
284
+ * @example
285
+ * ```typescript
286
+ * const getUserEndpoint = api.declareEndpoint({
287
+ * method: 'get',
288
+ * url: '/users/$userId',
289
+ * responseSchema: z.object({ id: z.string(), name: z.string() }),
290
+ * })
291
+ *
292
+ * @Endpoint(getUserEndpoint)
293
+ * async getUser(request: EndpointParams<typeof getUserEndpoint>): EndpointResult<typeof getUserEndpoint> {
294
+ * return { id: '1', name: 'John' } // Type-checked against responseSchema
295
+ * }
296
+ * ```
297
+ */
298
+ type EndpointResult<EndpointDeclaration extends {
299
+ config: BaseEndpointConfig<any, any, any, any, any>;
300
+ }> = EndpointDeclaration['config']['responseSchema'] extends ZodDiscriminatedUnion<infer Options> ? Promise<z$1.input<Options[number]>> : Promise<z$1.input<EndpointDeclaration['config']['responseSchema']>>;
301
+ /**
302
+ * Decorator that marks a method as an HTTP endpoint.
303
+ *
304
+ * The endpoint must be defined using @navios/builder's `declareEndpoint` method.
305
+ * This ensures type safety and consistency between client and server.
306
+ *
307
+ * @param endpoint - The endpoint declaration from @navios/builder
308
+ * @returns A method decorator
309
+ *
310
+ * @example
311
+ * ```typescript
312
+ * import { builder } from '@navios/builder'
313
+ *
314
+ * const api = builder()
315
+ * const getUserEndpoint = api.declareEndpoint({
316
+ * method: 'get',
317
+ * url: '/users/$userId',
318
+ * responseSchema: z.object({ id: z.string(), name: z.string() }),
319
+ * })
320
+ *
321
+ * @Controller()
322
+ * export class UserController {
323
+ * @Endpoint(getUserEndpoint)
324
+ * async getUser(request: EndpointParams<typeof getUserEndpoint>) {
325
+ * const { userId } = request.urlParams
326
+ * return { id: userId, name: 'John' }
327
+ * }
328
+ * }
329
+ * ```
330
+ */
331
+ declare function Endpoint<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, ResponseSchema extends ZodType = ZodType, RequestSchema = ZodType>(endpoint: {
332
+ config: BaseEndpointConfig<Method, Url, QuerySchema, ResponseSchema, RequestSchema>;
333
+ }): (target: (params: QuerySchema extends ZodType ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true> : EndpointFunctionArgs<Url, QuerySchema, undefined, true> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema, true> : EndpointFunctionArgs<Url, undefined, undefined, true>) => Promise<z$1.input<ResponseSchema>>, context: ClassMethodDecoratorContext) => (params: QuerySchema extends ZodType ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true> : EndpointFunctionArgs<Url, QuerySchema, undefined, true> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema, true> : EndpointFunctionArgs<Url, undefined, undefined, true>) => Promise<z$1.input<ResponseSchema>>;
334
+ //#endregion
335
+ //#region src/metadata/handler.metadata.d.mts
336
+ declare const EndpointMetadataKey: unique symbol;
337
+ interface HandlerMetadata<Config = null> {
338
+ classMethod: string;
339
+ url: string;
340
+ successStatusCode: number;
341
+ adapterToken: InjectionToken<AbstractHttpHandlerAdapterInterface, undefined> | ClassTypeWithInstance<AbstractHttpHandlerAdapterInterface> | null;
342
+ headers: Partial<Record<HttpHeader, number | string | string[] | undefined>>;
343
+ httpMethod: HttpMethod;
344
+ config: Config;
345
+ guards: Set<ClassTypeWithInstance<CanActivate> | InjectionToken<CanActivate, undefined>>;
346
+ customAttributes: Map<string | symbol, any>;
347
+ }
348
+ declare function getAllEndpointMetadata(context: ClassMethodDecoratorContext | ClassDecoratorContext): Set<HandlerMetadata<any>>;
349
+ declare function getEndpointMetadata<Config = any>(target: Function, context: ClassMethodDecoratorContext): HandlerMetadata<Config>;
350
+ //#endregion
351
+ //#region src/metadata/controller.metadata.d.mts
352
+ declare const ControllerMetadataKey: unique symbol;
353
+ interface ControllerMetadata {
354
+ endpoints: Set<HandlerMetadata>;
355
+ guards: Set<ClassTypeWithInstance<CanActivate> | InjectionToken<CanActivate, undefined>>;
356
+ customAttributes: Map<string | symbol, any>;
357
+ }
358
+ declare function getControllerMetadata(target: ClassType, context: ClassDecoratorContext): ControllerMetadata;
359
+ declare function extractControllerMetadata(target: ClassType): ControllerMetadata;
360
+ declare function hasControllerMetadata(target: ClassType): boolean;
361
+ //#endregion
362
+ //#region src/metadata/module.metadata.d.mts
363
+ declare const ModuleMetadataKey: unique symbol;
364
+ interface ModuleMetadata {
365
+ controllers: Set<ClassType>;
366
+ imports: Set<ClassType>;
367
+ guards: Set<ClassTypeWithInstance<CanActivate> | InjectionToken<CanActivate, undefined>>;
368
+ customAttributes: Map<string | symbol, any>;
369
+ }
370
+ declare function getModuleMetadata(target: ClassType, context: ClassDecoratorContext): ModuleMetadata;
371
+ declare function extractModuleMetadata(target: ClassType): ModuleMetadata;
372
+ declare function hasModuleMetadata(target: ClassType): boolean;
373
+ //#endregion
374
+ //#region src/interfaces/abstract-execution-context.inteface.d.mts
375
+ /**
376
+ * Interface providing access to the execution context during request handling.
377
+ *
378
+ * The execution context provides access to metadata and request/reply objects
379
+ * for the current request. It is available in guards and can be injected into
380
+ * services if needed.
381
+ *
382
+ * @example
383
+ * ```typescript
384
+ * @Injectable()
385
+ * export class AuthGuard implements CanActivate {
386
+ * async canActivate(context: AbstractExecutionContext): Promise<boolean> {
387
+ * const request = context.getRequest()
388
+ * const handler = context.getHandler()
389
+ * // Access request and handler metadata
390
+ * return true
391
+ * }
392
+ * }
393
+ * ```
394
+ */
395
+ interface AbstractExecutionContext {
396
+ /**
397
+ * Gets the metadata for the module containing the current endpoint.
398
+ */
399
+ getModule(): ModuleMetadata;
400
+ /**
401
+ * Gets the metadata for the controller containing the current endpoint.
402
+ */
403
+ getController(): ControllerMetadata;
404
+ /**
405
+ * Gets the metadata for the current endpoint handler.
406
+ */
407
+ getHandler(): HandlerMetadata;
408
+ /**
409
+ * Gets the HTTP request object (adapter-specific).
410
+ */
411
+ getRequest(): any;
412
+ /**
413
+ * Gets the HTTP reply object (adapter-specific).
414
+ */
415
+ getReply(): any;
416
+ }
417
+ //#endregion
418
+ //#region src/logger/utils/cli-colors.util.d.mts
419
+ declare const clc: {
420
+ bold: (text: string) => string;
421
+ green: (text: string) => string;
422
+ yellow: (text: string) => string;
423
+ red: (text: string) => string;
424
+ magentaBright: (text: string) => string;
425
+ cyanBright: (text: string) => string;
426
+ };
427
+ declare const yellow: (text: string) => string;
428
+ //#endregion
429
+ //#region src/logger/log-levels.d.mts
430
+ /**
431
+ * Available log levels in order of severity (lowest to highest).
432
+ */
433
+ declare const LOG_LEVELS: ["verbose", "debug", "log", "warn", "error", "fatal"];
434
+ /**
435
+ * Log level type.
436
+ *
437
+ * Represents the severity level of a log message.
438
+ * Levels are: 'verbose', 'debug', 'log', 'warn', 'error', 'fatal'
439
+ *
440
+ * @publicApi
441
+ */
442
+ type LogLevel = (typeof LOG_LEVELS)[number];
443
+ //#endregion
444
+ //#region src/logger/utils/filter-log-levelts.util.d.mts
445
+ /**
446
+ * @publicApi
447
+ */
448
+ declare function filterLogLevels(parseableString?: string): LogLevel[];
449
+ //#endregion
450
+ //#region src/logger/utils/is-log-level.util.d.mts
451
+ /**
452
+ * @publicApi
453
+ */
454
+ declare function isLogLevel(maybeLogLevel: any): maybeLogLevel is LogLevel;
455
+ //#endregion
456
+ //#region src/logger/utils/is-log-level-enabled.d.mts
457
+ /**
458
+ * Checks if target level is enabled.
459
+ * @param targetLevel target level
460
+ * @param logLevels array of enabled log levels
461
+ */
462
+ declare function isLogLevelEnabled(targetLevel: LogLevel, logLevels: LogLevel[] | undefined): boolean;
463
+ //#endregion
464
+ //#region src/logger/utils/shared.utils.d.mts
465
+ declare const isUndefined: (obj: any) => obj is undefined;
466
+ declare const isObject: (fn: any) => fn is object;
467
+ declare const isPlainObject: (fn: any) => fn is object;
468
+ declare const addLeadingSlash: (path?: string) => string;
469
+ declare const normalizePath: (path?: string) => string;
470
+ declare const stripEndSlash: (path: string) => string;
471
+ declare const isFunction: (val: any) => val is Function;
472
+ declare const isString: (val: any) => val is string;
473
+ declare const isNumber: (val: any) => val is number;
474
+ declare const isConstructor: (val: any) => boolean;
475
+ declare const isNil: (val: any) => val is null | undefined;
476
+ declare const isEmpty: (array: any) => boolean;
477
+ declare const isSymbol: (val: any) => val is symbol;
478
+ //#endregion
479
+ //#region src/logger/logger-service.interface.d.mts
480
+ /**
481
+ * @publicApi
482
+ */
483
+ interface LoggerService {
484
+ /**
485
+ * Write a 'log' level log.
486
+ */
487
+ log(message: any, ...optionalParams: any[]): any;
488
+ /**
489
+ * Write an 'error' level log.
490
+ */
491
+ error(message: any, ...optionalParams: any[]): any;
492
+ /**
493
+ * Write a 'warn' level log.
494
+ */
495
+ warn(message: any, ...optionalParams: any[]): any;
496
+ /**
497
+ * Write a 'debug' level log.
498
+ */
499
+ debug?(message: any, ...optionalParams: any[]): any;
500
+ /**
501
+ * Write a 'verbose' level log.
502
+ */
503
+ verbose?(message: any, ...optionalParams: any[]): any;
504
+ /**
505
+ * Write a 'fatal' level log.
506
+ */
507
+ fatal?(message: any, ...optionalParams: any[]): any;
508
+ /**
509
+ * Set log levels.
510
+ * @param levels log levels
511
+ */
512
+ setLogLevels?(levels: LogLevel[]): any;
513
+ }
514
+ //#endregion
515
+ //#region src/logger/console-logger.service.d.mts
516
+ /**
517
+ * @publicApi
518
+ */
519
+ interface ConsoleLoggerOptions {
520
+ /**
521
+ * Enabled log levels.
522
+ */
523
+ logLevels?: LogLevel[];
524
+ /**
525
+ * If enabled, will print timestamp (time difference) between current and previous log message.
526
+ * Note: This option is not used when `json` is enabled.
527
+ */
528
+ timestamp?: boolean;
529
+ /**
530
+ * A prefix to be used for each log message.
531
+ * Note: This option is not used when `json` is enabled.
532
+ */
533
+ prefix?: string;
534
+ /**
535
+ * If enabled, will add a request ID to the log message.
536
+ */
537
+ requestId?: boolean;
538
+ /**
539
+ * If enabled, will print the log message in JSON format.
540
+ */
541
+ json?: boolean;
542
+ /**
543
+ * If enabled, will print the log message in color.
544
+ * Default true if json is disabled, false otherwise
545
+ */
546
+ colors?: boolean;
547
+ /**
548
+ * The context of the logger.
549
+ */
550
+ context?: string;
551
+ /**
552
+ * If enabled, will print the log message in a single line, even if it is an object with multiple properties.
553
+ * If set to a number, the most n inner elements are united on a single line as long as all properties fit into breakLength. Short array elements are also grouped together.
554
+ * Default true when `json` is enabled, false otherwise.
555
+ */
556
+ compact?: boolean | number;
557
+ /**
558
+ * Specifies the maximum number of Array, TypedArray, Map, Set, WeakMap, and WeakSet elements to include when formatting.
559
+ * Set to null or Infinity to show all elements. Set to 0 or negative to show no elements.
560
+ * Ignored when `json` is enabled, colors are disabled, and `compact` is set to true as it produces a parseable JSON output.
561
+ * @default 100
562
+ */
563
+ maxArrayLength?: number;
564
+ /**
565
+ * Specifies the maximum number of characters to include when formatting.
566
+ * Set to null or Infinity to show all elements. Set to 0 or negative to show no characters.
567
+ * Ignored when `json` is enabled, colors are disabled, and `compact` is set to true as it produces a parseable JSON output.
568
+ * @default 10000.
569
+ */
570
+ maxStringLength?: number;
571
+ /**
572
+ * If enabled, will sort keys while formatting objects.
573
+ * Can also be a custom sorting function.
574
+ * Ignored when `json` is enabled, colors are disabled, and `compact` is set to true as it produces a parseable JSON output.
575
+ * @default false
576
+ */
577
+ sorted?: boolean | ((a: string, b: string) => number);
578
+ /**
579
+ * Specifies the number of times to recurse while formatting object. T
580
+ * This is useful for inspecting large objects. To recurse up to the maximum call stack size pass Infinity or null.
581
+ * Ignored when `json` is enabled, colors are disabled, and `compact` is set to true as it produces a parseable JSON output.
582
+ * @default 5
583
+ */
584
+ depth?: number;
585
+ /**
586
+ * If true, object's non-enumerable symbols and properties are included in the formatted result.
587
+ * WeakMap and WeakSet entries are also included as well as user defined prototype properties
588
+ * @default false
589
+ */
590
+ showHidden?: boolean;
591
+ /**
592
+ * The length at which input values are split across multiple lines. Set to Infinity to format the input as a single line (in combination with "compact" set to true).
593
+ * Default Infinity when "compact" is true, 80 otherwise.
594
+ * Ignored when `json` is enabled, colors are disabled, and `compact` is set to true as it produces a parseable JSON output.
595
+ */
596
+ breakLength?: number;
597
+ }
598
+ /**
599
+ * @publicApi
600
+ */
601
+ declare class ConsoleLogger implements LoggerService {
602
+ /**
603
+ * The options of the logger.
604
+ */
605
+ protected options: ConsoleLoggerOptions;
606
+ /**
607
+ * The context of the logger (can be set manually or automatically inferred).
608
+ */
609
+ protected context?: string;
610
+ /**
611
+ * The original context of the logger (set in the constructor).
612
+ */
613
+ protected originalContext?: string;
614
+ /**
615
+ * The options used for the "inspect" method.
616
+ */
617
+ protected inspectOptions: InspectOptions;
618
+ /**
619
+ * The last timestamp at which the log message was printed.
620
+ */
621
+ protected lastTimestampAt?: number;
622
+ setup(): void;
623
+ setup(context: string): void;
624
+ setup(options: ConsoleLoggerOptions): void;
625
+ setup(context: string, options: ConsoleLoggerOptions): void;
626
+ /**
627
+ * Write a 'log' level log, if the configured level allows for it.
628
+ * Prints to `stdout` with newline.
629
+ */
630
+ log(message: any, context?: string): void;
631
+ log(message: any, ...optionalParams: [...any, string?]): void;
632
+ /**
633
+ * Write an 'error' level log, if the configured level allows for it.
634
+ * Prints to `stderr` with newline.
635
+ */
636
+ error(message: any, stackOrContext?: string): void;
637
+ error(message: any, stack?: string, context?: string): void;
638
+ error(message: any, ...optionalParams: [...any, string?, string?]): void;
639
+ /**
640
+ * Write a 'warn' level log, if the configured level allows for it.
641
+ * Prints to `stdout` with newline.
642
+ */
643
+ warn(message: any, context?: string): void;
644
+ warn(message: any, ...optionalParams: [...any, string?]): void;
645
+ /**
646
+ * Write a 'debug' level log, if the configured level allows for it.
647
+ * Prints to `stdout` with newline.
648
+ */
649
+ debug(message: any, context?: string): void;
650
+ debug(message: any, ...optionalParams: [...any, string?]): void;
651
+ /**
652
+ * Write a 'verbose' level log, if the configured level allows for it.
653
+ * Prints to `stdout` with newline.
654
+ */
655
+ verbose(message: any, context?: string): void;
656
+ verbose(message: any, ...optionalParams: [...any, string?]): void;
657
+ /**
658
+ * Write a 'fatal' level log, if the configured level allows for it.
659
+ * Prints to `stdout` with newline.
660
+ */
661
+ fatal(message: any, context?: string): void;
662
+ fatal(message: any, ...optionalParams: [...any, string?]): void;
663
+ /**
664
+ * Set log levels
665
+ * @param levels log levels
666
+ */
667
+ setLogLevels(levels: LogLevel[]): void;
668
+ /**
669
+ * Set logger context
670
+ * @param context context
671
+ */
672
+ setContext(context: string): void;
673
+ /**
674
+ * Resets the logger context to the value that was passed in the constructor.
675
+ */
676
+ resetContext(): void;
677
+ isLevelEnabled(level: LogLevel): boolean;
678
+ /**
679
+ * Gets the current request ID from the AsyncLocalStorage store.
680
+ * Only returns a value if the requestId option is enabled.
681
+ */
682
+ protected getCurrentRequestId(): string | undefined;
683
+ protected getTimestamp(): string;
684
+ protected printMessages(messages: unknown[], context?: string, logLevel?: LogLevel, requestId?: string, writeStreamType?: 'stdout' | 'stderr', errorStack?: unknown): void;
685
+ protected printAsJson(message: unknown, options: {
686
+ context: string;
687
+ logLevel: LogLevel;
688
+ writeStreamType?: 'stdout' | 'stderr';
689
+ errorStack?: unknown;
690
+ requestId?: string;
691
+ }): void;
692
+ protected formatPid(pid: number): string;
693
+ protected formatContext(context: string): string;
694
+ protected formatMessage(logLevel: LogLevel, message: unknown, pidMessage: string, formattedLogLevel: string, contextMessage: string, timestampDiff: string, requestId?: string): string;
695
+ protected getRequestId(requestId?: string): string;
696
+ protected stringifyMessage(message: unknown, logLevel: LogLevel): string;
697
+ protected colorize(message: string, logLevel: LogLevel): string;
698
+ protected printStackTrace(stack: string): void;
699
+ protected updateAndGetTimestampDiff(): string;
700
+ protected formatTimestampDiff(timestampDiff: number): string;
701
+ protected getInspectOptions(): InspectOptions;
702
+ protected stringifyReplacer(key: string, value: unknown): unknown;
703
+ private getContextAndMessagesToPrint;
704
+ private getContextAndStackAndMessagesToPrint;
705
+ private isStackFormat;
706
+ private getColorByLogLevel;
707
+ }
708
+ //#endregion
709
+ //#region src/logger/logger.service.d.mts
710
+ /**
711
+ * Logger service instance that can be injected into services and controllers.
712
+ *
713
+ * Provides contextualized logging with automatic context injection.
714
+ * The context is set when the logger is injected using the `inject` function.
715
+ *
716
+ * @example
717
+ * ```typescript
718
+ * @Injectable()
719
+ * export class UserService {
720
+ * private logger = inject(Logger, { context: UserService.name })
721
+ *
722
+ * async findUser(id: string) {
723
+ * this.logger.log(`Finding user ${id}`)
724
+ * // Logs with context: [UserService]
725
+ * }
726
+ * }
727
+ * ```
728
+ */
729
+ declare class LoggerInstance implements LoggerService {
730
+ protected localInstance: LoggerService;
731
+ protected context?: string;
732
+ constructor(config?: LoggerOptions);
733
+ /**
734
+ * Write an 'error' level log.
735
+ */
736
+ error(message: any, stack?: string, context?: string): void;
737
+ error(message: any, ...optionalParams: [...any, string?, string?]): void;
738
+ /**
739
+ * Write a 'log' level log.
740
+ */
741
+ log(message: any, context?: string): void;
742
+ log(message: any, ...optionalParams: [...any, string?]): void;
743
+ /**
744
+ * Write a 'warn' level log.
745
+ */
746
+ warn(message: any, context?: string): void;
747
+ warn(message: any, ...optionalParams: [...any, string?]): void;
748
+ /**
749
+ * Write a 'debug' level log.
750
+ */
751
+ debug(message: any, context?: string): void;
752
+ debug(message: any, ...optionalParams: [...any, string?]): void;
753
+ /**
754
+ * Write a 'verbose' level log.
755
+ */
756
+ verbose(message: any, context?: string): void;
757
+ verbose(message: any, ...optionalParams: [...any, string?]): void;
758
+ /**
759
+ * Write a 'fatal' level log.
760
+ */
761
+ fatal(message: any, context?: string): void;
762
+ fatal(message: any, ...optionalParams: [...any, string?]): void;
763
+ }
764
+ //#endregion
765
+ //#region src/logger/logger.tokens.d.mts
766
+ /**
767
+ * Injection token for the logger output service.
768
+ *
769
+ * This token is used to provide a custom logger implementation.
770
+ * By default, it's bound to ConsoleLogger.
771
+ */
772
+ declare const LoggerOutput: InjectionToken<LoggerService, undefined, false>;
773
+ /**
774
+ * Schema for logger options.
775
+ */
776
+ declare const loggerOptionsSchema: z.ZodOptional<z.ZodObject<{
777
+ context: z.ZodOptional<z.ZodString>;
778
+ }, z.core.$strip>>;
779
+ /**
780
+ * Options for creating a logger instance.
781
+ */
782
+ type LoggerOptions = z.infer<typeof loggerOptionsSchema>;
783
+ /**
784
+ * Injection token for the Logger service.
785
+ *
786
+ * Use this token to inject a contextualized logger instance.
787
+ *
788
+ * @example
789
+ * ```typescript
790
+ * const logger = inject(Logger, { context: 'MyService' })
791
+ * logger.log('Hello world') // Logs with context: [MyService]
792
+ * ```
793
+ */
794
+ declare const Logger: InjectionToken<LoggerInstance, z.ZodOptional<z.ZodObject<{
795
+ context: z.ZodOptional<z.ZodString>;
796
+ }, z.core.$strip>>, false>;
797
+ //#endregion
798
+ //#region src/interfaces/abstract-http-cors-options.interface.d.mts
799
+ interface ArrayOfValueOrArray<T> extends Array<ValueOrArray<T>> {}
800
+ type OriginType = string | boolean | RegExp;
801
+ type ValueOrArray<T> = T | ArrayOfValueOrArray<T>;
802
+ interface AbstractHttpCorsOptions {
803
+ /**
804
+ * Configures the Access-Control-Allow-Origin CORS header.
805
+ */
806
+ origin?: ValueOrArray<OriginType>;
807
+ /**
808
+ * Configures the Access-Control-Allow-Credentials CORS header.
809
+ * Set to true to pass the header, otherwise it is omitted.
810
+ */
811
+ credentials?: boolean;
812
+ /**
813
+ * Configures the Access-Control-Expose-Headers CORS header.
814
+ * Expects a comma-delimited string (ex: 'Content-Range,X-Content-Range')
815
+ * or an array (ex: ['Content-Range', 'X-Content-Range']).
816
+ * If not specified, no custom headers are exposed.
817
+ */
818
+ exposedHeaders?: string | string[];
819
+ /**
820
+ * Configures the Access-Control-Allow-Headers CORS header.
821
+ * Expects a comma-delimited string (ex: 'Content-Type,Authorization')
822
+ * or an array (ex: ['Content-Type', 'Authorization']). If not
823
+ * specified, defaults to reflecting the headers specified in the
824
+ * request's Access-Control-Request-Headers header.
825
+ */
826
+ allowedHeaders?: string | string[];
827
+ /**
828
+ * Configures the Access-Control-Allow-Methods CORS header.
829
+ * Expects a comma-delimited string (ex: 'GET,PUT,POST') or an array (ex: ['GET', 'PUT', 'POST']).
830
+ */
831
+ methods?: string | string[];
832
+ /**
833
+ * Configures the Access-Control-Max-Age CORS header.
834
+ * Set to an integer to pass the header, otherwise it is omitted.
835
+ */
836
+ maxAge?: number;
837
+ /**
838
+ * Configures the Cache-Control header for CORS preflight responses.
839
+ * Set to an integer to pass the header as `Cache-Control: max-age=${cacheControl}`,
840
+ * or set to a string to pass the header as `Cache-Control: ${cacheControl}` (fully define
841
+ * the header value), otherwise the header is omitted.
842
+ */
843
+ cacheControl?: number | string;
844
+ /**
845
+ * Sets the Fastify log level specifically for the internal OPTIONS route
846
+ * used to handle CORS preflight requests. For example, setting this to `'silent'`
847
+ * will prevent these requests from being logged.
848
+ * Useful for reducing noise in application logs.
849
+ * Default: inherits Fastify's global log level.
850
+ */
851
+ logLevel?: LogLevel;
852
+ }
853
+ //#endregion
854
+ //#region src/interfaces/abstract-http-listen-options.interface.d.mts
855
+ interface AbstractHttpListenOptions {
856
+ port: number;
857
+ host?: string;
858
+ }
859
+ //#endregion
860
+ //#region src/interfaces/abstract-http-adapter.interface.d.mts
861
+ interface AbstractHttpAdapterInterface<ServerInstance, CorsOptions = AbstractHttpCorsOptions, Options$1 = {}, MultipartOptions = {}> {
862
+ setupHttpServer(options: Options$1): Promise<void>;
863
+ onModulesInit(modules: Map<string, ModuleMetadata>): Promise<void>;
864
+ ready(): Promise<void>;
865
+ getServer(): ServerInstance;
866
+ setGlobalPrefix(prefix: string): void;
867
+ enableCors(options: CorsOptions): void;
868
+ enableMultipart(options: MultipartOptions): void;
869
+ listen(options: AbstractHttpListenOptions): Promise<string>;
870
+ dispose(): Promise<void>;
871
+ }
872
+ //#endregion
873
+ //#region src/interfaces/abstract-http-handler-adapter.interface.d.mts
874
+ interface AbstractHttpHandlerAdapterInterface {
875
+ prepareArguments?: (handlerMetadata: HandlerMetadata<any>) => ((target: Record<string, any>, request: any) => Promise<void> | void)[];
876
+ provideHandler: (controller: ClassType, handlerMetadata: HandlerMetadata<any>) => (context: ScopedContainer, request: any, reply: any) => Promise<any>;
877
+ }
878
+ //#endregion
879
+ //#region src/interfaces/can-activate.d.mts
880
+ /**
881
+ * Interface that guards must implement to control access to endpoints.
882
+ *
883
+ * Guards are used for authentication, authorization, and request validation.
884
+ * They are executed before the endpoint handler and can prevent the request
885
+ * from proceeding by returning `false` or throwing an exception.
886
+ *
887
+ * @example
888
+ * ```typescript
889
+ * @Injectable()
890
+ * export class AuthGuard implements CanActivate {
891
+ * async canActivate(context: AbstractExecutionContext): Promise<boolean> {
892
+ * const request = context.getRequest()
893
+ * const token = request.headers.authorization
894
+ *
895
+ * if (!token) {
896
+ * throw new UnauthorizedException('Authentication required')
897
+ * }
898
+ *
899
+ * // Validate token
900
+ * return true
901
+ * }
902
+ * }
903
+ * ```
904
+ */
905
+ interface CanActivate {
906
+ /**
907
+ * Determines if the current request can proceed to the endpoint handler.
908
+ *
909
+ * @param executionContext - The execution context containing request, reply, and metadata
910
+ * @returns `true` if the request can proceed, `false` otherwise. Can also throw an exception.
911
+ */
912
+ canActivate(executionContext: AbstractExecutionContext): Promise<boolean> | boolean;
913
+ }
914
+ //#endregion
915
+ //#region src/interfaces/http-header.d.mts
916
+ type OmitIndexSignature<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K] };
917
+ /**
918
+ * HTTP header strings
919
+ * Use this type only for input values, not for output values.
920
+ */
921
+ type HttpHeader = keyof OmitIndexSignature<OutgoingHttpHeaders> | (string & Record<never, never>);
922
+ //#endregion
923
+ //#region src/interfaces/navios-module.d.mts
924
+ /**
925
+ * Interface that all Navios modules must implement.
926
+ *
927
+ * Modules decorated with @Module() should implement this interface to receive
928
+ * lifecycle hooks.
929
+ *
930
+ * @example
931
+ * ```typescript
932
+ * @Module({
933
+ * controllers: [UserController],
934
+ * })
935
+ * export class AppModule implements NaviosModule {
936
+ * async onModuleInit() {
937
+ * console.log('AppModule initialized')
938
+ * // Perform initialization logic
939
+ * }
940
+ * }
941
+ * ```
942
+ */
943
+ interface NaviosModule {
944
+ /**
945
+ * Optional lifecycle hook called after the module is initialized.
946
+ *
947
+ * This is called after all modules are loaded and the HTTP server is set up
948
+ * (if an adapter is configured), but before the server starts listening.
949
+ */
950
+ onModuleInit?: () => Promise<void> | void;
951
+ }
952
+ //#endregion
953
+ //#region src/decorators/header.decorator.d.mts
954
+ /**
955
+ * Decorator that sets a custom HTTP response header for an endpoint.
956
+ *
957
+ * @param name - The header name (e.g., 'Content-Type', 'Cache-Control')
958
+ * @param value - The header value (string, number, or array of strings)
959
+ * @returns A method decorator
960
+ *
961
+ * @example
962
+ * ```typescript
963
+ * @Controller()
964
+ * export class UserController {
965
+ * @Endpoint(getUserEndpoint)
966
+ * @Header('Cache-Control', 'max-age=3600')
967
+ * async getUser() {
968
+ * return { id: '1', name: 'John' }
969
+ * }
970
+ * }
971
+ * ```
972
+ */
973
+ declare function Header(name: HttpHeader, value: string | number | string[]): <T extends Function>(target: T, context: ClassMethodDecoratorContext) => T;
974
+ //#endregion
975
+ //#region src/decorators/http-code.decorator.d.mts
976
+ /**
977
+ * Decorator that sets a custom HTTP status code for successful responses.
978
+ *
979
+ * By default, endpoints return 200 OK. Use this decorator to return a different status code.
980
+ *
981
+ * @param code - The HTTP status code to return (e.g., 201, 204, 202)
982
+ * @returns A method decorator
983
+ *
984
+ * @example
985
+ * ```typescript
986
+ * @Controller()
987
+ * export class UserController {
988
+ * @Endpoint(createUserEndpoint)
989
+ * @HttpCode(201)
990
+ * async createUser() {
991
+ * return { id: '1', name: 'John' }
992
+ * }
993
+ * }
994
+ * ```
995
+ */
996
+ declare function HttpCode(code: number): <T extends Function>(target: T, context: ClassMethodDecoratorContext) => T;
997
+ //#endregion
998
+ //#region src/decorators/module.decorator.d.mts
999
+ /**
1000
+ * Options for configuring a Navios module.
1001
+ */
1002
+ interface ModuleOptions {
1003
+ /**
1004
+ * Controllers to register in this module.
1005
+ * Controllers handle HTTP requests and define endpoints.
1006
+ */
1007
+ controllers?: ClassType[] | Set<ClassType>;
1008
+ /**
1009
+ * Other modules to import into this module.
1010
+ * Imported modules' controllers and services become available.
1011
+ */
1012
+ imports?: ClassType[] | Set<ClassType>;
1013
+ /**
1014
+ * Guards to apply to all controllers in this module.
1015
+ * Guards are executed in reverse order (last guard first).
1016
+ */
1017
+ guards?: ClassType[] | Set<ClassType>;
1018
+ }
1019
+ /**
1020
+ * Decorator that marks a class as a Navios module.
1021
+ *
1022
+ * Modules are the basic building blocks of a Navios application.
1023
+ * They organize controllers, services, and other modules into logical units.
1024
+ *
1025
+ * @param options - Module configuration options
1026
+ * @returns A class decorator
1027
+ *
1028
+ * @example
1029
+ * ```typescript
1030
+ * @Module({
1031
+ * controllers: [UserController, AuthController],
1032
+ * imports: [DatabaseModule],
1033
+ * guards: [AuthGuard],
1034
+ * })
1035
+ * export class AppModule {}
1036
+ * ```
1037
+ */
1038
+ declare function Module({
1039
+ controllers,
1040
+ imports,
1041
+ guards
1042
+ }?: ModuleOptions): (target: ClassType, context: ClassDecoratorContext) => ClassType;
1043
+ //#endregion
1044
+ //#region src/decorators/multipart.decorator.d.mts
1045
+ /**
1046
+ * Extracts the typed parameters for a multipart endpoint handler function.
1047
+ *
1048
+ * Similar to `EndpointParams`, but specifically for multipart/form-data endpoints.
1049
+ *
1050
+ * @typeParam EndpointDeclaration - The endpoint declaration from @navios/builder
1051
+ */
1052
+ type MultipartParams<EndpointDeclaration extends {
1053
+ config: BaseEndpointConfig<any, any, any, any, any>;
1054
+ }, Url extends string = EndpointDeclaration['config']['url'], QuerySchema = EndpointDeclaration['config']['querySchema']> = QuerySchema extends ZodObject ? EndpointDeclaration['config']['requestSchema'] extends ZodType ? Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, EndpointDeclaration['config']['requestSchema'], true>> : Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, undefined, true>> : EndpointDeclaration['config']['requestSchema'] extends ZodType ? Util_FlatObject<EndpointFunctionArgs<Url, undefined, EndpointDeclaration['config']['requestSchema'], true>> : Util_FlatObject<EndpointFunctionArgs<Url, undefined, undefined, true>>;
1055
+ /**
1056
+ * Extracts the typed return value for a multipart endpoint handler function.
1057
+ *
1058
+ * @typeParam EndpointDeclaration - The endpoint declaration from @navios/builder
1059
+ */
1060
+ type MultipartResult<EndpointDeclaration extends {
1061
+ config: BaseEndpointConfig<any, any, any, any, any>;
1062
+ }> = EndpointDeclaration['config']['responseSchema'] extends ZodDiscriminatedUnion<infer Options> ? Promise<z$1.input<Options[number]>> : Promise<z$1.input<EndpointDeclaration['config']['responseSchema']>>;
1063
+ /**
1064
+ * Decorator that marks a method as a multipart/form-data endpoint.
1065
+ *
1066
+ * Use this decorator for endpoints that handle file uploads or form data.
1067
+ * The endpoint must be defined using @navios/builder's `declareMultipart` method.
1068
+ *
1069
+ * @param endpoint - The multipart endpoint declaration from @navios/builder
1070
+ * @returns A method decorator
1071
+ *
1072
+ * @example
1073
+ * ```typescript
1074
+ * const uploadFileEndpoint = api.declareMultipart({
1075
+ * method: 'post',
1076
+ * url: '/upload',
1077
+ * requestSchema: z.object({ file: z.instanceof(File) }),
1078
+ * responseSchema: z.object({ url: z.string() }),
1079
+ * })
1080
+ *
1081
+ * @Controller()
1082
+ * export class FileController {
1083
+ * @Multipart(uploadFileEndpoint)
1084
+ * async uploadFile(request: MultipartParams<typeof uploadFileEndpoint>) {
1085
+ * const { file } = request.data
1086
+ * // Handle file upload
1087
+ * return { url: 'https://example.com/file.jpg' }
1088
+ * }
1089
+ * }
1090
+ * ```
1091
+ */
1092
+ declare function Multipart<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, ResponseSchema extends ZodType = ZodType, RequestSchema = ZodType>(endpoint: {
1093
+ config: BaseEndpointConfig<Method, Url, QuerySchema, ResponseSchema, RequestSchema>;
1094
+ }): (target: (params: QuerySchema extends ZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema> : EndpointFunctionArgs<Url, QuerySchema, undefined> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema> : EndpointFunctionArgs<Url, undefined, undefined>) => Promise<z$1.input<ResponseSchema>>, context: ClassMethodDecoratorContext) => (params: QuerySchema extends ZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema> : EndpointFunctionArgs<Url, QuerySchema, undefined> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema> : EndpointFunctionArgs<Url, undefined, undefined>) => Promise<z$1.input<ResponseSchema>>;
1095
+ //#endregion
1096
+ //#region src/decorators/stream.decorator.d.mts
1097
+ /**
1098
+ * Extracts the typed parameters for a stream endpoint handler function.
1099
+ *
1100
+ * Similar to `EndpointParams`, but specifically for streaming endpoints.
1101
+ *
1102
+ * @typeParam EndpointDeclaration - The stream endpoint declaration from @navios/builder
1103
+ */
1104
+ type StreamParams<EndpointDeclaration extends {
1105
+ config: BaseStreamConfig<any, any, any, any>;
1106
+ }, Url extends string = EndpointDeclaration['config']['url'], QuerySchema = EndpointDeclaration['config']['querySchema']> = QuerySchema extends ZodObject ? EndpointDeclaration['config']['requestSchema'] extends ZodType ? Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, EndpointDeclaration['config']['requestSchema'], true>> : Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, undefined, true>> : EndpointDeclaration['config']['requestSchema'] extends ZodType ? Util_FlatObject<EndpointFunctionArgs<Url, undefined, EndpointDeclaration['config']['requestSchema'], true>> : Util_FlatObject<EndpointFunctionArgs<Url, undefined, undefined, true>>;
1107
+ /**
1108
+ * Decorator that marks a method as a streaming endpoint.
1109
+ *
1110
+ * Use this decorator for endpoints that stream data (e.g., file downloads, SSE).
1111
+ * The endpoint must be defined using @navios/builder's `declareStream` method.
1112
+ *
1113
+ * @param endpoint - The stream endpoint declaration from @navios/builder
1114
+ * @returns A method decorator
1115
+ *
1116
+ * @example
1117
+ * ```typescript
1118
+ * const downloadFileEndpoint = api.declareStream({
1119
+ * method: 'get',
1120
+ * url: '/files/$fileId',
1121
+ * })
1122
+ *
1123
+ * @Controller()
1124
+ * export class FileController {
1125
+ * @Stream(downloadFileEndpoint)
1126
+ * async downloadFile(request: StreamParams<typeof downloadFileEndpoint>, reply: any) {
1127
+ * const { fileId } = request.urlParams
1128
+ * // Stream file data to reply
1129
+ * }
1130
+ * }
1131
+ * ```
1132
+ */
1133
+ declare function Stream<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, RequestSchema = ZodType>(endpoint: {
1134
+ config: BaseStreamConfig<Method, Url, QuerySchema, RequestSchema>;
1135
+ }): (target: (params: QuerySchema extends ZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema> : EndpointFunctionArgs<Url, QuerySchema, undefined> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema> : EndpointFunctionArgs<Url, undefined, undefined>, reply: any) => Promise<void>, context: ClassMethodDecoratorContext) => (params: QuerySchema extends ZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema> : EndpointFunctionArgs<Url, QuerySchema, undefined> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema> : EndpointFunctionArgs<Url, undefined, undefined>, reply: any) => Promise<void>;
1136
+ //#endregion
1137
+ //#region src/decorators/use-guards.decorator.d.mts
1138
+ /**
1139
+ * Decorator that applies guards to a controller or endpoint.
1140
+ *
1141
+ * Guards are used for authentication, authorization, and request validation.
1142
+ * They implement the `CanActivate` interface and are executed before the endpoint handler.
1143
+ * Guards can be applied at the module, controller, or endpoint level.
1144
+ *
1145
+ * @param guards - Guard classes or injection tokens to apply
1146
+ * @returns A class or method decorator
1147
+ *
1148
+ * @example
1149
+ * ```typescript
1150
+ * // Apply to a controller
1151
+ * @Controller()
1152
+ * @UseGuards(AuthGuard, RoleGuard)
1153
+ * export class UserController {
1154
+ * @Endpoint(getUserEndpoint)
1155
+ * async getUser() { }
1156
+ * }
1157
+ *
1158
+ * // Apply to a specific endpoint
1159
+ * @Controller()
1160
+ * export class UserController {
1161
+ * @Endpoint(getUserEndpoint)
1162
+ * @UseGuards(AuthGuard)
1163
+ * async getUser() { }
1164
+ * }
1165
+ * ```
1166
+ */
1167
+ declare function UseGuards(...guards: (ClassTypeWithInstance<CanActivate> | InjectionToken<CanActivate, undefined>)[]): <T extends Function>(target: T, context: ClassMethodDecoratorContext | ClassDecoratorContext) => T;
1168
+ //#endregion
1169
+ //#region src/exceptions/http.exception.d.mts
1170
+ /**
1171
+ * Base exception class for all HTTP exceptions in Navios.
1172
+ *
1173
+ * All HTTP exception classes extend this base class. When thrown from an endpoint handler,
1174
+ * Navios will automatically convert it to an appropriate HTTP response with the specified
1175
+ * status code and response body.
1176
+ *
1177
+ * @example
1178
+ * ```typescript
1179
+ * @Endpoint(getUserEndpoint)
1180
+ * async getUser(request: EndpointParams<typeof getUserEndpoint>) {
1181
+ * const user = await this.userService.findById(request.urlParams.userId)
1182
+ * if (!user) {
1183
+ * throw new HttpException(404, 'User not found')
1184
+ * }
1185
+ * return user
1186
+ * }
1187
+ * ```
1188
+ */
1189
+ declare class HttpException {
1190
+ readonly statusCode: number;
1191
+ readonly response: string | object;
1192
+ readonly error?: Error | undefined;
1193
+ /**
1194
+ * Creates a new HttpException instance.
1195
+ *
1196
+ * @param statusCode - HTTP status code (e.g., 400, 404, 500)
1197
+ * @param response - Response body (string or object)
1198
+ * @param error - Optional underlying error for logging/debugging
1199
+ */
1200
+ constructor(statusCode: number, response: string | object, error?: Error | undefined);
1201
+ }
1202
+ //#endregion
1203
+ //#region src/exceptions/bad-request.exception.d.mts
1204
+ /**
1205
+ * Exception that represents a 400 Bad Request HTTP error.
1206
+ *
1207
+ * Use this exception when the client's request is malformed or invalid.
1208
+ *
1209
+ * @example
1210
+ * ```typescript
1211
+ * @Endpoint(createUserEndpoint)
1212
+ * async createUser(request: EndpointParams<typeof createUserEndpoint>) {
1213
+ * if (!request.data.email) {
1214
+ * throw new BadRequestException('Email is required')
1215
+ * }
1216
+ * // ...
1217
+ * }
1218
+ * ```
1219
+ */
1220
+ declare class BadRequestException extends HttpException {
1221
+ /**
1222
+ * Creates a new BadRequestException.
1223
+ *
1224
+ * @param message - Error message or response object
1225
+ */
1226
+ constructor(message: string | object);
1227
+ }
1228
+ //#endregion
1229
+ //#region src/exceptions/forbidden.exception.d.mts
1230
+ /**
1231
+ * Exception that represents a 403 Forbidden HTTP error.
1232
+ *
1233
+ * Use this exception when the client is authenticated but does not have
1234
+ * permission to access the requested resource.
1235
+ *
1236
+ * @example
1237
+ * ```typescript
1238
+ * @Endpoint(deleteUserEndpoint)
1239
+ * @UseGuards(AuthGuard, RoleGuard)
1240
+ * async deleteUser(request: EndpointParams<typeof deleteUserEndpoint>) {
1241
+ * if (!this.userService.hasPermission(request.user, 'delete')) {
1242
+ * throw new ForbiddenException('Insufficient permissions')
1243
+ * }
1244
+ * // ...
1245
+ * }
1246
+ * ```
1247
+ */
1248
+ declare class ForbiddenException extends HttpException {
1249
+ /**
1250
+ * Creates a new ForbiddenException.
1251
+ *
1252
+ * @param message - Error message
1253
+ */
1254
+ constructor(message: string);
1255
+ }
1256
+ //#endregion
1257
+ //#region src/exceptions/internal-server-error.exception.d.mts
1258
+ /**
1259
+ * Exception that represents a 500 Internal Server Error HTTP error.
1260
+ *
1261
+ * Use this exception when an unexpected error occurs on the server.
1262
+ * Generally, you should let unhandled errors bubble up rather than catching
1263
+ * and rethrowing as InternalServerErrorException, as Navios will handle them appropriately.
1264
+ *
1265
+ * @example
1266
+ * ```typescript
1267
+ * @Endpoint(processPaymentEndpoint)
1268
+ * async processPayment(request: EndpointParams<typeof processPaymentEndpoint>) {
1269
+ * try {
1270
+ * return await this.paymentService.process(request.data)
1271
+ * } catch (error) {
1272
+ * this.logger.error('Payment processing failed', error)
1273
+ * throw new InternalServerErrorException('Payment processing failed', error)
1274
+ * }
1275
+ * }
1276
+ * ```
1277
+ */
1278
+ declare class InternalServerErrorException extends HttpException {
1279
+ /**
1280
+ * Creates a new InternalServerErrorException.
1281
+ *
1282
+ * @param message - Error message or response object
1283
+ * @param error - Optional underlying error for logging
1284
+ */
1285
+ constructor(message: string | object, error?: Error);
1286
+ }
1287
+ //#endregion
1288
+ //#region src/exceptions/not-found.exception.d.mts
1289
+ /**
1290
+ * Exception that represents a 404 Not Found HTTP error.
1291
+ *
1292
+ * Use this exception when the requested resource does not exist.
1293
+ *
1294
+ * @example
1295
+ * ```typescript
1296
+ * @Endpoint(getUserEndpoint)
1297
+ * async getUser(request: EndpointParams<typeof getUserEndpoint>) {
1298
+ * const user = await this.userService.findById(request.urlParams.userId)
1299
+ * if (!user) {
1300
+ * throw new NotFoundException('User not found')
1301
+ * }
1302
+ * return user
1303
+ * }
1304
+ * ```
1305
+ */
1306
+ declare class NotFoundException extends HttpException {
1307
+ readonly response: string | object;
1308
+ readonly error?: Error | undefined;
1309
+ /**
1310
+ * Creates a new NotFoundException.
1311
+ *
1312
+ * @param response - Error message or response object
1313
+ * @param error - Optional underlying error for logging
1314
+ */
1315
+ constructor(response: string | object, error?: Error | undefined);
1316
+ }
1317
+ //#endregion
1318
+ //#region src/exceptions/unauthorized.exception.d.mts
1319
+ /**
1320
+ * Exception that represents a 401 Unauthorized HTTP error.
1321
+ *
1322
+ * Use this exception when the client is not authenticated or authentication failed.
1323
+ *
1324
+ * @example
1325
+ * ```typescript
1326
+ * @Endpoint(getUserEndpoint)
1327
+ * @UseGuards(AuthGuard)
1328
+ * async getUser(request: EndpointParams<typeof getUserEndpoint>) {
1329
+ * if (!request.headers.authorization) {
1330
+ * throw new UnauthorizedException('Authentication required')
1331
+ * }
1332
+ * // ...
1333
+ * }
1334
+ * ```
1335
+ */
1336
+ declare class UnauthorizedException extends HttpException {
1337
+ /**
1338
+ * Creates a new UnauthorizedException.
1339
+ *
1340
+ * @param message - Error message or response object
1341
+ * @param error - Optional underlying error for logging
1342
+ */
1343
+ constructor(message: string | object, error?: Error);
1344
+ }
1345
+ //#endregion
1346
+ //#region src/exceptions/conflict.exception.d.mts
1347
+ /**
1348
+ * Exception that represents a 409 Conflict HTTP error.
1349
+ *
1350
+ * Use this exception when the request conflicts with the current state of the resource
1351
+ * (e.g., trying to create a resource that already exists).
1352
+ *
1353
+ * @example
1354
+ * ```typescript
1355
+ * @Endpoint(createUserEndpoint)
1356
+ * async createUser(request: EndpointParams<typeof createUserEndpoint>) {
1357
+ * const existing = await this.userService.findByEmail(request.data.email)
1358
+ * if (existing) {
1359
+ * throw new ConflictException('User with this email already exists')
1360
+ * }
1361
+ * // ...
1362
+ * }
1363
+ * ```
1364
+ */
1365
+ declare class ConflictException extends HttpException {
1366
+ /**
1367
+ * Creates a new ConflictException.
1368
+ *
1369
+ * @param message - Error message or response object
1370
+ * @param error - Optional underlying error for logging
1371
+ */
1372
+ constructor(message: string | object, error?: Error);
1373
+ }
1374
+ //#endregion
1375
+ //#region src/services/guard-runner.service.d.mts
1376
+ declare class GuardRunnerService {
1377
+ private readonly logger;
1378
+ runGuards(allGuards: Set<ClassTypeWithInstance<CanActivate> | InjectionToken<CanActivate, undefined>>, executionContext: AbstractExecutionContext, context: ScopedContainer): Promise<boolean>;
1379
+ makeContext(moduleMetadata: ModuleMetadata, controllerMetadata: ControllerMetadata, endpoint: HandlerMetadata): Set<ClassTypeWithInstance<CanActivate> | InjectionToken<CanActivate, undefined>>;
1380
+ }
1381
+ //#endregion
1382
+ //#region src/services/module-loader.service.d.mts
1383
+ declare class ModuleLoaderService {
1384
+ private logger;
1385
+ protected container: Container;
1386
+ private modulesMetadata;
1387
+ private loadedModules;
1388
+ private initialized;
1389
+ loadModules(appModule: ClassTypeWithInstance<NaviosModule>): Promise<void>;
1390
+ private traverseModules;
1391
+ private mergeMetadata;
1392
+ getAllModules(): Map<string, ModuleMetadata>;
1393
+ dispose(): void;
1394
+ }
1395
+ //#endregion
1396
+ //#region src/stores/request-id.store.d.mts
1397
+ /**
1398
+ * AsyncLocalStorage store for the current request ID.
1399
+ *
1400
+ * This allows logging and other services to access the current request ID
1401
+ * without explicitly passing it through the call stack.
1402
+ *
1403
+ * @example
1404
+ * ```typescript
1405
+ * import { requestIdStore, runWithRequestId, getRequestId } from '@navios/core'
1406
+ *
1407
+ * // Run code with a request ID in context
1408
+ * runWithRequestId('req-123', () => {
1409
+ * // Inside this callback, getRequestId() returns 'req-123'
1410
+ * logger.log('Processing request') // Will include request ID if logger is configured
1411
+ * })
1412
+ *
1413
+ * // Get current request ID (returns undefined if not in a request context)
1414
+ * const currentId = getRequestId()
1415
+ * ```
1416
+ */
1417
+ declare const requestIdStore: AsyncLocalStorage<string>;
1418
+ /**
1419
+ * Runs a function with a request ID in the async local storage context.
1420
+ *
1421
+ * @param requestId - The request ID to set for this context
1422
+ * @param fn - The function to run within this context
1423
+ * @returns The return value of the function
1424
+ */
1425
+ declare function runWithRequestId<R>(requestId: string, fn: () => R): R;
1426
+ /**
1427
+ * Gets the current request ID from the async local storage context.
1428
+ *
1429
+ * @returns The current request ID, or undefined if not in a request context
1430
+ */
1431
+ declare function getRequestId(): string | undefined;
1432
+ //#endregion
1433
+ //#region src/tokens/endpoint-adapter.token.d.mts
1434
+ declare const EndpointAdapterToken: InjectionToken<AbstractHttpHandlerAdapterInterface, undefined, false>;
1435
+ //#endregion
1436
+ //#region src/tokens/execution-context.token.d.mts
1437
+ declare const ExecutionContextInjectionToken = "ExecutionContextInjectionToken";
1438
+ declare const ExecutionContext: InjectionToken<AbstractExecutionContext, undefined, false>;
1439
+ //#endregion
1440
+ //#region src/tokens/http-adapter.token.d.mts
1441
+ declare const HttpAdapterToken: InjectionToken<AbstractHttpAdapterInterface<any, any, any, any>, undefined, false>;
1442
+ //#endregion
1443
+ //#region src/tokens/multipart-adapter.token.d.mts
1444
+ declare const MultipartAdapterToken: InjectionToken<AbstractHttpHandlerAdapterInterface, undefined, false>;
1445
+ //#endregion
1446
+ //#region src/tokens/reply.token.d.mts
1447
+ declare const Reply: InjectionToken<any, undefined, false>;
1448
+ //#endregion
1449
+ //#region src/tokens/request.token.d.mts
1450
+ declare const Request: InjectionToken<any, undefined, false>;
1451
+ //#endregion
1452
+ //#region src/tokens/stream-adapter.token.d.mts
1453
+ declare const StreamAdapterToken: InjectionToken<AbstractHttpHandlerAdapterInterface, undefined, false>;
1454
+ //#endregion
1455
+ //#region src/tokens/xml-stream-adapter.token.d.mts
1456
+ declare const XmlStreamAdapterToken: InjectionToken<AbstractHttpHandlerAdapterInterface, undefined, false>;
1457
+ //#endregion
1458
+ //#region src/attribute.factory.d.mts
1459
+ /**
1460
+ * Type for a class attribute decorator without a value.
1461
+ *
1462
+ * Attributes are custom metadata decorators that can be applied to modules,
1463
+ * controllers, and endpoints.
1464
+ */
1465
+ type ClassAttribute = (() => <T>(target: T, context: ClassDecoratorContext | ClassMethodDecoratorContext) => T) & {
1466
+ token: symbol;
1467
+ };
1468
+ /**
1469
+ * Type for a class attribute decorator with a validated value.
1470
+ *
1471
+ * @typeParam T - The Zod schema type for validation
1472
+ */
1473
+ type ClassSchemaAttribute<T extends ZodType> = ((value: z$1.input<T>) => <T>(target: T, context: ClassDecoratorContext | ClassMethodDecoratorContext) => T) & {
1474
+ token: symbol;
1475
+ schema: ZodType;
1476
+ };
1477
+ /**
1478
+ * Factory for creating custom attribute decorators.
1479
+ *
1480
+ * Attributes allow you to add custom metadata to modules, controllers, and endpoints.
1481
+ * This is useful for cross-cutting concerns like rate limiting, caching, API versioning, etc.
1482
+ *
1483
+ * @example
1484
+ * ```typescript
1485
+ * // Create a simple boolean attribute
1486
+ * const Public = AttributeFactory.createAttribute(Symbol.for('Public'))
1487
+ *
1488
+ * // Use it as a decorator
1489
+ * @Controller()
1490
+ * @Public()
1491
+ * export class PublicController { }
1492
+ *
1493
+ * // Check if attribute exists
1494
+ * if (AttributeFactory.has(Public, controllerMetadata)) {
1495
+ * // Skip authentication
1496
+ * }
1497
+ * ```
1498
+ *
1499
+ * @example
1500
+ * ```typescript
1501
+ * // Create an attribute with a validated value
1502
+ * const RateLimit = AttributeFactory.createAttribute(
1503
+ * Symbol.for('RateLimit'),
1504
+ * z.object({ requests: z.number(), window: z.number() })
1505
+ * )
1506
+ *
1507
+ * // Use it with a value
1508
+ * @Endpoint(apiEndpoint)
1509
+ * @RateLimit({ requests: 100, window: 60000 })
1510
+ * async handler() { }
1511
+ *
1512
+ * // Get the value
1513
+ * const limit = AttributeFactory.get(RateLimit, endpointMetadata)
1514
+ * // limit is typed as { requests: number, window: number } | null
1515
+ * ```
1516
+ */
1517
+ declare class AttributeFactory {
1518
+ /**
1519
+ * Creates a simple attribute decorator without a value.
1520
+ *
1521
+ * @param token - A unique symbol to identify this attribute
1522
+ * @returns A decorator function that can be applied to classes or methods
1523
+ *
1524
+ * @example
1525
+ * ```typescript
1526
+ * const Public = AttributeFactory.createAttribute(Symbol.for('Public'))
1527
+ *
1528
+ * @Public()
1529
+ * @Controller()
1530
+ * export class PublicController { }
1531
+ * ```
1532
+ */
1533
+ static createAttribute(token: symbol): ClassAttribute;
1534
+ /**
1535
+ * Creates an attribute decorator with a validated value.
1536
+ *
1537
+ * @param token - A unique symbol to identify this attribute
1538
+ * @param schema - A Zod schema to validate the attribute value
1539
+ * @returns A decorator function that accepts a value and can be applied to classes or methods
1540
+ *
1541
+ * @example
1542
+ * ```typescript
1543
+ * const RateLimit = AttributeFactory.createAttribute(
1544
+ * Symbol.for('RateLimit'),
1545
+ * z.object({ requests: z.number(), window: z.number() })
1546
+ * )
1547
+ *
1548
+ * @RateLimit({ requests: 100, window: 60000 })
1549
+ * @Endpoint(apiEndpoint)
1550
+ * async handler() { }
1551
+ * ```
1552
+ */
1553
+ static createAttribute<T extends ZodType>(token: symbol, schema: T): ClassSchemaAttribute<T>;
1554
+ /**
1555
+ * Gets the value of an attribute from metadata.
1556
+ *
1557
+ * Returns `null` if the attribute is not present.
1558
+ * For simple attributes (without values), returns `true` if present.
1559
+ *
1560
+ * @param attribute - The attribute decorator
1561
+ * @param target - The metadata object (module, controller, or handler)
1562
+ * @returns The attribute value, `true` for simple attributes, or `null` if not found
1563
+ *
1564
+ * @example
1565
+ * ```typescript
1566
+ * const isPublic = AttributeFactory.get(Public, controllerMetadata)
1567
+ * // isPublic is true | null
1568
+ *
1569
+ * const rateLimit = AttributeFactory.get(RateLimit, endpointMetadata)
1570
+ * // rateLimit is { requests: number, window: number } | null
1571
+ * ```
1572
+ */
1573
+ static get(attribute: ClassAttribute, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): true | null;
1574
+ static get<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): z$1.output<T> | null;
1575
+ /**
1576
+ * Gets all values of an attribute from metadata (useful when an attribute can appear multiple times).
1577
+ *
1578
+ * Returns `null` if the attribute is not present.
1579
+ *
1580
+ * @param attribute - The attribute decorator
1581
+ * @param target - The metadata object (module, controller, or handler)
1582
+ * @returns An array of attribute values, or `null` if not found
1583
+ *
1584
+ * @example
1585
+ * ```typescript
1586
+ * const tags = AttributeFactory.getAll(Tag, endpointMetadata)
1587
+ * // tags is string[] | null
1588
+ * ```
1589
+ */
1590
+ static getAll(attribute: ClassAttribute, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): Array<true> | null;
1591
+ static getAll<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): Array<z$1.output<T>> | null;
1592
+ /**
1593
+ * Gets the last value of an attribute from an array of metadata objects.
1594
+ *
1595
+ * Searches from the end of the array backwards, useful for finding the most
1596
+ * specific attribute value (e.g., endpoint-level overrides module-level).
1597
+ *
1598
+ * @param attribute - The attribute decorator
1599
+ * @param target - An array of metadata objects (typically [module, controller, handler])
1600
+ * @returns The last attribute value found, or `null` if not found
1601
+ *
1602
+ * @example
1603
+ * ```typescript
1604
+ * // Check attribute hierarchy: endpoint -> controller -> module
1605
+ * const rateLimit = AttributeFactory.getLast(RateLimit, [
1606
+ * moduleMetadata,
1607
+ * controllerMetadata,
1608
+ * endpointMetadata
1609
+ * ])
1610
+ * ```
1611
+ */
1612
+ static getLast(attribute: ClassAttribute, target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[]): true | null;
1613
+ static getLast<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[]): z$1.output<T> | null;
1614
+ /**
1615
+ * Checks if an attribute is present on the metadata object.
1616
+ *
1617
+ * @param attribute - The attribute decorator
1618
+ * @param target - The metadata object (module, controller, or handler)
1619
+ * @returns `true` if the attribute is present, `false` otherwise
1620
+ *
1621
+ * @example
1622
+ * ```typescript
1623
+ * if (AttributeFactory.has(Public, controllerMetadata)) {
1624
+ * // Skip authentication
1625
+ * }
1626
+ * ```
1627
+ */
1628
+ static has(attribute: ClassAttribute, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): boolean;
1629
+ static has<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): boolean;
1630
+ }
1631
+ //#endregion
1632
+ //#region src/factories/endpoint-adapter.factory.d.mts
1633
+ declare class EndpointAdapterFactory {
1634
+ private readonly environment;
1635
+ create(ctx: FactoryContext): Promise<any>;
1636
+ }
1637
+ //#endregion
1638
+ //#region src/factories/http-adapter.factory.d.mts
1639
+ declare class HttpAdapterFactory {
1640
+ private readonly environment;
1641
+ create(ctx: FactoryContext): Promise<any>;
1642
+ }
1643
+ //#endregion
1644
+ //#region src/factories/multipart-adapter.factory.d.mts
1645
+ declare class MultipartAdapterFactory {
1646
+ private readonly environment;
1647
+ create(ctx: FactoryContext): Promise<any>;
1648
+ }
1649
+ //#endregion
1650
+ //#region src/factories/request.factory.d.mts
1651
+ declare class RequestFactory {
1652
+ private readonly environment;
1653
+ create(ctx: FactoryContext): Promise<any>;
1654
+ }
1655
+ //#endregion
1656
+ //#region src/factories/reply.factory.d.mts
1657
+ declare class ReplyFactory {
1658
+ private readonly environment;
1659
+ create(ctx: FactoryContext): Promise<any>;
1660
+ }
1661
+ //#endregion
1662
+ //#region src/factories/stream-adapter.factory.d.mts
1663
+ declare class StreamAdapterFactory {
1664
+ private readonly environment;
1665
+ create(ctx: FactoryContext): Promise<any>;
1666
+ }
1667
+ //#endregion
1668
+ //#region src/factories/xml-stream-adapter.factory.d.mts
1669
+ declare class XmlStreamAdapterFactory {
1670
+ private readonly environment;
1671
+ create(ctx: FactoryContext): Promise<any>;
1672
+ }
1673
+ //#endregion
1674
+ //#region src/navios.environment.d.mts
1675
+ interface NaviosEnvironmentOptions {
1676
+ httpTokens?: Map<InjectionToken<any, undefined>, AnyInjectableType>;
1677
+ }
1678
+ //#endregion
1679
+ //#region src/navios.application.d.mts
1680
+ /**
1681
+ * Options for configuring the Navios application context.
1682
+ * These options control dependency injection and logging behavior.
1683
+ */
1684
+ interface NaviosApplicationContextOptions {
1685
+ /**
1686
+ * Specifies the logger to use. Pass `false` to turn off logging.
1687
+ *
1688
+ * - `LoggerService` instance: Use a custom logger implementation
1689
+ * - `LogLevel[]`: Enable specific log levels (e.g., ['error', 'warn', 'log'])
1690
+ * - `false`: Disable logging completely
1691
+ */
1692
+ logger?: LoggerService | LogLevel[] | false;
1693
+ /**
1694
+ * Specifies a custom container to use. Useful for testing.
1695
+ * If not provided, a new Container will be created.
1696
+ */
1697
+ container?: Container;
1698
+ }
1699
+ /**
1700
+ * Complete options for creating a Navios application.
1701
+ * Extends NaviosApplicationContextOptions with adapter configuration.
1702
+ */
1703
+ interface NaviosApplicationOptions extends NaviosApplicationContextOptions {
1704
+ /**
1705
+ * HTTP adapter environment(s) to use for the application.
1706
+ * Can be a single adapter or an array of adapters.
1707
+ *
1708
+ * @example
1709
+ * ```typescript
1710
+ * adapter: defineFastifyEnvironment()
1711
+ * // or
1712
+ * adapter: [defineFastifyEnvironment(), defineBunEnvironment()]
1713
+ * ```
1714
+ */
1715
+ adapter: NaviosEnvironmentOptions | NaviosEnvironmentOptions[];
1716
+ }
1717
+ /**
1718
+ * Main application class for Navios.
1719
+ *
1720
+ * This class represents a Navios application instance and provides methods
1721
+ * for initializing, configuring, and managing the HTTP server.
1722
+ *
1723
+ * @example
1724
+ * ```typescript
1725
+ * const app = await NaviosFactory.create(AppModule, {
1726
+ * adapter: defineFastifyEnvironment(),
1727
+ * })
1728
+ *
1729
+ * app.setGlobalPrefix('/api')
1730
+ * app.enableCors({ origin: ['http://localhost:3000'] })
1731
+ * await app.init()
1732
+ * await app.listen({ port: 3000, host: '0.0.0.0' })
1733
+ * ```
1734
+ */
1735
+ declare class NaviosApplication {
1736
+ private environment;
1737
+ private moduleLoader;
1738
+ private httpApplication;
1739
+ private logger;
1740
+ protected container: Container;
1741
+ private appModule;
1742
+ private options;
1743
+ /**
1744
+ * Indicates whether the application has been initialized.
1745
+ * Set to `true` after `init()` completes successfully.
1746
+ */
1747
+ isInitialized: boolean;
1748
+ /**
1749
+ * Sets up the application with the provided module and options.
1750
+ * This is called automatically by NaviosFactory.create().
1751
+ *
1752
+ * @param appModule - The root application module
1753
+ * @param options - Application configuration options
1754
+ * @internal
1755
+ */
1756
+ setup(appModule: ClassTypeWithInstance<NaviosModule>, options?: NaviosApplicationOptions): Promise<void>;
1757
+ /**
1758
+ * Gets the dependency injection container used by this application.
1759
+ *
1760
+ * @returns The Container instance
1761
+ */
1762
+ getContainer(): Container;
1763
+ /**
1764
+ * Initializes the application.
1765
+ *
1766
+ * This method:
1767
+ * - Loads all modules and their dependencies
1768
+ * - Sets up the HTTP server if an adapter is configured
1769
+ * - Calls onModuleInit hooks on all modules
1770
+ * - Marks the application as initialized
1771
+ *
1772
+ * Must be called before `listen()`.
1773
+ *
1774
+ * @throws Error if app module is not set
1775
+ *
1776
+ * @example
1777
+ * ```typescript
1778
+ * const app = await NaviosFactory.create(AppModule, {
1779
+ * adapter: defineFastifyEnvironment(),
1780
+ * })
1781
+ * await app.init()
1782
+ * await app.listen({ port: 3000 })
1783
+ * ```
1784
+ */
1785
+ init(): Promise<void>;
1786
+ private initModules;
1787
+ /**
1788
+ * Enables CORS (Cross-Origin Resource Sharing) for the application.
1789
+ *
1790
+ * @param options - CORS configuration options (adapter-specific)
1791
+ * @throws Error if HTTP application is not set
1792
+ *
1793
+ * @example
1794
+ * ```typescript
1795
+ * app.enableCors({
1796
+ * origin: ['http://localhost:3000', 'https://example.com'],
1797
+ * methods: ['GET', 'POST', 'PUT', 'DELETE'],
1798
+ * credentials: true,
1799
+ * })
1800
+ * ```
1801
+ */
1802
+ enableCors(options: any): void;
1803
+ /**
1804
+ * Enables multipart/form-data support for file uploads.
1805
+ *
1806
+ * @param options - Multipart configuration options (adapter-specific)
1807
+ * @throws Error if HTTP application is not set
1808
+ *
1809
+ * @example
1810
+ * ```typescript
1811
+ * app.enableMultipart({
1812
+ * limits: {
1813
+ * fileSize: 1024 * 1024 * 10, // 10MB
1814
+ * },
1815
+ * })
1816
+ * ```
1817
+ */
1818
+ enableMultipart(options: any): void;
1819
+ /**
1820
+ * Sets a global prefix for all routes.
1821
+ *
1822
+ * @param prefix - The prefix to prepend to all route URLs (e.g., '/api')
1823
+ * @throws Error if HTTP application is not set
1824
+ *
1825
+ * @example
1826
+ * ```typescript
1827
+ * app.setGlobalPrefix('/api/v1')
1828
+ * // All routes will be prefixed with /api/v1
1829
+ * ```
1830
+ */
1831
+ setGlobalPrefix(prefix: string): void;
1832
+ /**
1833
+ * Gets the underlying HTTP server instance.
1834
+ *
1835
+ * The type of the returned server depends on the adapter used:
1836
+ * - Fastify adapter: Returns FastifyInstance
1837
+ * - Bun adapter: Returns Bun.Server
1838
+ *
1839
+ * @returns The HTTP server instance
1840
+ * @throws Error if HTTP application is not set
1841
+ *
1842
+ * @example
1843
+ * ```typescript
1844
+ * const server = app.getServer()
1845
+ * // Use adapter-specific server methods
1846
+ * ```
1847
+ */
1848
+ getServer(): any;
1849
+ /**
1850
+ * Starts the HTTP server and begins listening for requests.
1851
+ *
1852
+ * @param options - Listen options (port, host, etc.)
1853
+ * @throws Error if HTTP application is not set
1854
+ *
1855
+ * @example
1856
+ * ```typescript
1857
+ * await app.listen({ port: 3000, host: '0.0.0.0' })
1858
+ * ```
1859
+ */
1860
+ listen(options: AbstractHttpListenOptions): Promise<void>;
1861
+ /**
1862
+ * Disposes of application resources.
1863
+ *
1864
+ * Cleans up the HTTP server and module loader.
1865
+ * This method is called automatically by `close()`.
1866
+ */
1867
+ dispose(): Promise<void>;
1868
+ /**
1869
+ * Closes the application and cleans up all resources.
1870
+ *
1871
+ * This is an alias for `dispose()`.
1872
+ *
1873
+ * @example
1874
+ * ```typescript
1875
+ * // Graceful shutdown
1876
+ * process.on('SIGTERM', async () => {
1877
+ * await app.close()
1878
+ * process.exit(0)
1879
+ * })
1880
+ * ```
1881
+ */
1882
+ close(): Promise<void>;
1883
+ }
1884
+ //#endregion
1885
+ //#region src/navios.factory.d.mts
1886
+ /**
1887
+ * Factory class for creating and configuring Navios applications.
1888
+ *
1889
+ * This is the main entry point for bootstrapping a Navios application.
1890
+ * It handles dependency injection container setup, adapter registration,
1891
+ * and logger configuration.
1892
+ *
1893
+ * @example
1894
+ * ```typescript
1895
+ * import { NaviosFactory } from '@navios/core'
1896
+ * import { defineFastifyEnvironment } from '@navios/adapter-fastify'
1897
+ *
1898
+ * const app = await NaviosFactory.create(AppModule, {
1899
+ * adapter: defineFastifyEnvironment(),
1900
+ * logger: ['log', 'error', 'warn'],
1901
+ * })
1902
+ *
1903
+ * await app.init()
1904
+ * await app.listen({ port: 3000 })
1905
+ * ```
1906
+ */
1907
+ declare class NaviosFactory {
1908
+ /**
1909
+ * Creates a new Navios application instance.
1910
+ *
1911
+ * This method sets up the dependency injection container, registers the HTTP adapter,
1912
+ * configures logging, and initializes the application with the provided module.
1913
+ *
1914
+ * @param appModule - The root application module class decorated with @Module()
1915
+ * @param options - Configuration options for the application
1916
+ * @param options.adapter - HTTP adapter environment (required for HTTP server functionality)
1917
+ * @param options.logger - Logger configuration. Can be:
1918
+ * - A LoggerService instance for custom logging
1919
+ * - An array of LogLevel strings to enable specific log levels
1920
+ * - `false` to disable logging
1921
+ * @param options.container - Optional custom dependency injection container (useful for testing)
1922
+ * @returns A configured NaviosApplication instance ready to be initialized
1923
+ *
1924
+ * @example
1925
+ * ```typescript
1926
+ * // Basic setup with Fastify adapter
1927
+ * const app = await NaviosFactory.create(AppModule, {
1928
+ * adapter: defineFastifyEnvironment(),
1929
+ * })
1930
+ *
1931
+ * // With custom logger configuration
1932
+ * const app = await NaviosFactory.create(AppModule, {
1933
+ * adapter: defineFastifyEnvironment(),
1934
+ * logger: ['error', 'warn', 'log'],
1935
+ * })
1936
+ *
1937
+ * // With custom container for testing
1938
+ * const container = new Container()
1939
+ * const app = await NaviosFactory.create(AppModule, {
1940
+ * adapter: defineFastifyEnvironment(),
1941
+ * container,
1942
+ * })
1943
+ * ```
1944
+ */
1945
+ static create(appModule: ClassTypeWithInstance<NaviosModule>, options?: NaviosApplicationOptions): Promise<NaviosApplication>;
1946
+ private static registerEnvironment;
1947
+ private static registerLoggerConfiguration;
1948
+ }
1949
+ //#endregion
1950
+ export { AbstractHttpCorsOptions as $, ConfigServiceOptionsSchema as $t, UnauthorizedException as A, ModuleMetadataKey as At, MultipartParams as B, HandlerMetadata as Bt, EndpointAdapterToken as C, filterLogLevels as Ct, ModuleLoaderService as D, yellow as Dt, runWithRequestId as E, clc as Et, HttpException as F, ControllerMetadataKey as Ft, Header as G, EndpointResult as Gt, Module as H, getEndpointMetadata as Ht, UseGuards as I, extractControllerMetadata as It, OmitIndexSignature as J, ConfigProviderOptions as Jt, NaviosModule as K, Controller as Kt, Stream as L, getControllerMetadata as Lt, InternalServerErrorException as M, getModuleMetadata as Mt, ForbiddenException as N, hasModuleMetadata as Nt, GuardRunnerService as O, AbstractExecutionContext as Ot, BadRequestException as P, ControllerMetadata as Pt, AbstractHttpListenOptions as Q, ConfigServiceOptions as Qt, StreamParams as R, hasControllerMetadata as Rt, ExecutionContextInjectionToken as S, isLogLevel as St, requestIdStore as T, LogLevel as Tt, ModuleOptions as U, Endpoint as Ut, MultipartResult as V, getAllEndpointMetadata as Vt, HttpCode as W, EndpointParams as Wt, AbstractHttpHandlerAdapterInterface as X, provideConfig as Xt, CanActivate as Y, EnvConfigProvider as Yt, AbstractHttpAdapterInterface as Z, ConfigService as Zt, Request as _, isSymbol as _t, XmlStreamAdapterFactory as a, PathValue as an, ConsoleLogger as at, HttpAdapterToken as b, stripEndSlash as bt, RequestFactory as c, addLeadingSlash as ct, EndpointAdapterFactory as d, isFunction as dt, ConfigServiceToken as en, Logger as et, AttributeFactory as f, isNil as ft, StreamAdapterToken as g, isString as gt, XmlStreamAdapterToken as h, isPlainObject as ht, NaviosApplicationOptions as i, PathImpl2 as in, LoggerInstance as it, NotFoundException as j, extractModuleMetadata as jt, ConflictException as k, ModuleMetadata as kt, MultipartAdapterFactory as l, isConstructor as lt, ClassSchemaAttribute as m, isObject as mt, NaviosApplication as n, Path as nn, LoggerOutput as nt, StreamAdapterFactory as o, envInt as on, ConsoleLoggerOptions as ot, ClassAttribute as p, isNumber as pt, HttpHeader as q, ControllerOptions as qt, NaviosApplicationContextOptions as r, PathImpl as rn, loggerOptionsSchema as rt, ReplyFactory as s, envString as sn, LoggerService as st, NaviosFactory as t, ConfigServiceInterface as tn, LoggerOptions as tt, HttpAdapterFactory as u, isEmpty as ut, Reply as v, isUndefined as vt, getRequestId as w, LOG_LEVELS as wt, ExecutionContext as x, isLogLevelEnabled as xt, MultipartAdapterToken as y, normalizePath as yt, Multipart as z, EndpointMetadataKey as zt };
1951
+ //# sourceMappingURL=index-D657ijFO.d.mts.map