@navios/core 0.6.0 → 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 (273) 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 -190
  13. package/lib/index.mjs +4 -1459
  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 +24 -4
  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/multipart-adapter.factory.d.mts +6 -0
  116. package/src/factories/multipart-adapter.factory.d.mts.map +1 -0
  117. package/src/factories/reply.factory.d.mts +6 -0
  118. package/src/factories/reply.factory.d.mts.map +1 -0
  119. package/src/factories/request.factory.d.mts +6 -0
  120. package/src/factories/request.factory.d.mts.map +1 -0
  121. package/src/factories/stream-adapter.factory.d.mts +6 -0
  122. package/src/factories/stream-adapter.factory.d.mts.map +1 -0
  123. package/src/factories/xml-stream-adapter.factory.d.mts +6 -0
  124. package/src/factories/xml-stream-adapter.factory.d.mts.map +1 -0
  125. package/src/index.d.mts +15 -0
  126. package/src/index.d.mts.map +1 -0
  127. package/src/index.mts +1 -0
  128. package/src/interfaces/abstract-execution-context.inteface.d.mts +44 -0
  129. package/src/interfaces/abstract-execution-context.inteface.d.mts.map +1 -0
  130. package/src/interfaces/abstract-execution-context.inteface.mts +35 -0
  131. package/src/interfaces/abstract-http-adapter.interface.d.mts +15 -0
  132. package/src/interfaces/abstract-http-adapter.interface.d.mts.map +1 -0
  133. package/src/interfaces/abstract-http-cors-options.interface.d.mts +58 -0
  134. package/src/interfaces/abstract-http-cors-options.interface.d.mts.map +1 -0
  135. package/src/interfaces/abstract-http-handler-adapter.interface.d.mts +7 -0
  136. package/src/interfaces/abstract-http-handler-adapter.interface.d.mts.map +1 -0
  137. package/src/interfaces/abstract-http-handler-adapter.interface.mts +2 -2
  138. package/src/interfaces/abstract-http-listen-options.interface.d.mts +5 -0
  139. package/src/interfaces/abstract-http-listen-options.interface.d.mts.map +1 -0
  140. package/src/interfaces/can-activate.d.mts +36 -0
  141. package/src/interfaces/can-activate.d.mts.map +1 -0
  142. package/src/interfaces/can-activate.mts +31 -0
  143. package/src/interfaces/http-header.d.mts +10 -0
  144. package/src/interfaces/http-header.d.mts.map +1 -0
  145. package/src/interfaces/index.d.mts +9 -0
  146. package/src/interfaces/index.d.mts.map +1 -0
  147. package/src/interfaces/navios-module.d.mts +29 -0
  148. package/src/interfaces/navios-module.d.mts.map +1 -0
  149. package/src/interfaces/navios-module.mts +25 -0
  150. package/src/legacy-compat/__type-tests__/legacy-decorators.spec-d.mts +420 -0
  151. package/src/legacy-compat/__type-tests__/tsconfig.json +15 -0
  152. package/src/legacy-compat/context-compat.d.mts +19 -0
  153. package/src/legacy-compat/context-compat.d.mts.map +1 -0
  154. package/src/legacy-compat/context-compat.mts +93 -0
  155. package/src/legacy-compat/decorators/controller.decorator.d.mts +21 -0
  156. package/src/legacy-compat/decorators/controller.decorator.d.mts.map +1 -0
  157. package/src/legacy-compat/decorators/controller.decorator.mts +31 -0
  158. package/src/legacy-compat/decorators/endpoint.decorator.d.mts +33 -0
  159. package/src/legacy-compat/decorators/endpoint.decorator.d.mts.map +1 -0
  160. package/src/legacy-compat/decorators/endpoint.decorator.mts +99 -0
  161. package/src/legacy-compat/decorators/header.decorator.d.mts +24 -0
  162. package/src/legacy-compat/decorators/header.decorator.d.mts.map +1 -0
  163. package/src/legacy-compat/decorators/header.decorator.mts +42 -0
  164. package/src/legacy-compat/decorators/http-code.decorator.d.mts +22 -0
  165. package/src/legacy-compat/decorators/http-code.decorator.d.mts.map +1 -0
  166. package/src/legacy-compat/decorators/http-code.decorator.mts +38 -0
  167. package/src/legacy-compat/decorators/index.d.mts +9 -0
  168. package/src/legacy-compat/decorators/index.d.mts.map +1 -0
  169. package/src/legacy-compat/decorators/index.mts +9 -0
  170. package/src/legacy-compat/decorators/module.decorator.d.mts +22 -0
  171. package/src/legacy-compat/decorators/module.decorator.d.mts.map +1 -0
  172. package/src/legacy-compat/decorators/module.decorator.mts +37 -0
  173. package/src/legacy-compat/decorators/multipart.decorator.d.mts +34 -0
  174. package/src/legacy-compat/decorators/multipart.decorator.d.mts.map +1 -0
  175. package/src/legacy-compat/decorators/multipart.decorator.mts +93 -0
  176. package/src/legacy-compat/decorators/stream.decorator.d.mts +34 -0
  177. package/src/legacy-compat/decorators/stream.decorator.d.mts.map +1 -0
  178. package/src/legacy-compat/decorators/stream.decorator.mts +76 -0
  179. package/src/legacy-compat/decorators/use-guards.decorator.d.mts +29 -0
  180. package/src/legacy-compat/decorators/use-guards.decorator.d.mts.map +1 -0
  181. package/src/legacy-compat/decorators/use-guards.decorator.mts +80 -0
  182. package/src/legacy-compat/index.d.mts +19 -0
  183. package/src/legacy-compat/index.d.mts.map +1 -0
  184. package/src/legacy-compat/index.mts +40 -0
  185. package/src/logger/console-logger.service.d.mts +196 -0
  186. package/src/logger/console-logger.service.d.mts.map +1 -0
  187. package/src/logger/console-logger.service.mts +15 -2
  188. package/src/logger/index.d.mts +7 -0
  189. package/src/logger/index.d.mts.map +1 -0
  190. package/src/logger/log-levels.d.mts +14 -0
  191. package/src/logger/log-levels.d.mts.map +1 -0
  192. package/src/logger/log-levels.mts +9 -0
  193. package/src/logger/logger-service.interface.d.mts +36 -0
  194. package/src/logger/logger-service.interface.d.mts.map +1 -0
  195. package/src/logger/logger.service.d.mts +57 -0
  196. package/src/logger/logger.service.d.mts.map +1 -0
  197. package/src/logger/logger.service.mts +19 -0
  198. package/src/logger/logger.tokens.d.mts +36 -0
  199. package/src/logger/logger.tokens.d.mts.map +1 -0
  200. package/src/logger/logger.tokens.mts +23 -0
  201. package/src/logger/utils/cli-colors.util.d.mts +10 -0
  202. package/src/logger/utils/cli-colors.util.d.mts.map +1 -0
  203. package/src/logger/utils/filter-log-levelts.util.d.mts +6 -0
  204. package/src/logger/utils/filter-log-levelts.util.d.mts.map +1 -0
  205. package/src/logger/utils/index.d.mts +6 -0
  206. package/src/logger/utils/index.d.mts.map +1 -0
  207. package/src/logger/utils/is-log-level-enabled.d.mts +8 -0
  208. package/src/logger/utils/is-log-level-enabled.d.mts.map +1 -0
  209. package/src/logger/utils/is-log-level.util.d.mts +6 -0
  210. package/src/logger/utils/is-log-level.util.d.mts.map +1 -0
  211. package/src/logger/utils/shared.utils.d.mts +14 -0
  212. package/src/logger/utils/shared.utils.d.mts.map +1 -0
  213. package/src/metadata/controller.metadata.d.mts +13 -0
  214. package/src/metadata/controller.metadata.d.mts.map +1 -0
  215. package/src/metadata/handler.metadata.d.mts +18 -0
  216. package/src/metadata/handler.metadata.d.mts.map +1 -0
  217. package/src/metadata/index.d.mts +4 -0
  218. package/src/metadata/index.d.mts.map +1 -0
  219. package/src/metadata/module.metadata.d.mts +13 -0
  220. package/src/metadata/module.metadata.d.mts.map +1 -0
  221. package/src/navios.application.d.mts +210 -0
  222. package/src/navios.application.d.mts.map +1 -0
  223. package/src/navios.application.mts +176 -2
  224. package/src/navios.environment.d.mts +11 -0
  225. package/src/navios.environment.d.mts.map +1 -0
  226. package/src/navios.factory.d.mts +68 -0
  227. package/src/navios.factory.d.mts.map +1 -0
  228. package/src/navios.factory.mts +59 -1
  229. package/src/services/guard-runner.service.d.mts +10 -0
  230. package/src/services/guard-runner.service.d.mts.map +1 -0
  231. package/src/services/guard-runner.service.mts +12 -11
  232. package/src/services/index.d.mts +3 -0
  233. package/src/services/index.d.mts.map +1 -0
  234. package/src/services/module-loader.service.d.mts +17 -0
  235. package/src/services/module-loader.service.d.mts.map +1 -0
  236. package/src/services/module-loader.service.mts +16 -11
  237. package/src/stores/index.d.mts +2 -0
  238. package/src/stores/index.d.mts.map +1 -0
  239. package/src/stores/index.mts +1 -0
  240. package/src/stores/request-id.store.d.mts +37 -0
  241. package/src/stores/request-id.store.d.mts.map +1 -0
  242. package/src/stores/request-id.store.mts +43 -0
  243. package/src/testing/index.mts +2 -0
  244. package/src/testing/testing-module.mts +231 -0
  245. package/src/tokens/endpoint-adapter.token.d.mts +4 -0
  246. package/src/tokens/endpoint-adapter.token.d.mts.map +1 -0
  247. package/src/tokens/execution-context.token.d.mts +5 -0
  248. package/src/tokens/execution-context.token.d.mts.map +1 -0
  249. package/src/tokens/http-adapter.token.d.mts +4 -0
  250. package/src/tokens/http-adapter.token.d.mts.map +1 -0
  251. package/src/tokens/index.d.mts +9 -0
  252. package/src/tokens/index.d.mts.map +1 -0
  253. package/src/tokens/multipart-adapter.token.d.mts +4 -0
  254. package/src/tokens/multipart-adapter.token.d.mts.map +1 -0
  255. package/src/tokens/reply.token.d.mts +3 -0
  256. package/src/tokens/reply.token.d.mts.map +1 -0
  257. package/src/tokens/request.token.d.mts +3 -0
  258. package/src/tokens/request.token.d.mts.map +1 -0
  259. package/src/tokens/stream-adapter.token.d.mts +4 -0
  260. package/src/tokens/stream-adapter.token.d.mts.map +1 -0
  261. package/src/tokens/xml-stream-adapter.token.d.mts +4 -0
  262. package/src/tokens/xml-stream-adapter.token.d.mts.map +1 -0
  263. package/tsconfig.lib.json +1 -1
  264. package/tsconfig.spec.json +3 -0
  265. package/tsdown.config.mts +35 -0
  266. package/vitest.config.mts +6 -0
  267. package/lib/_tsup-dts-rollup.d.mts +0 -1365
  268. package/lib/_tsup-dts-rollup.d.ts +0 -1365
  269. package/lib/index.d.ts +0 -190
  270. package/lib/index.js +0 -1540
  271. package/lib/index.js.map +0 -1
  272. package/lib/index.mjs.map +0 -1
  273. package/tsup.config.mts +0 -13
@@ -4,10 +4,45 @@ import type {
4
4
  ModuleMetadata,
5
5
  } from '../metadata/index.mjs'
6
6
 
7
+ /**
8
+ * Interface providing access to the execution context during request handling.
9
+ *
10
+ * The execution context provides access to metadata and request/reply objects
11
+ * for the current request. It is available in guards and can be injected into
12
+ * services if needed.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * @Injectable()
17
+ * export class AuthGuard implements CanActivate {
18
+ * async canActivate(context: AbstractExecutionContext): Promise<boolean> {
19
+ * const request = context.getRequest()
20
+ * const handler = context.getHandler()
21
+ * // Access request and handler metadata
22
+ * return true
23
+ * }
24
+ * }
25
+ * ```
26
+ */
7
27
  export interface AbstractExecutionContext {
28
+ /**
29
+ * Gets the metadata for the module containing the current endpoint.
30
+ */
8
31
  getModule(): ModuleMetadata
32
+ /**
33
+ * Gets the metadata for the controller containing the current endpoint.
34
+ */
9
35
  getController(): ControllerMetadata
36
+ /**
37
+ * Gets the metadata for the current endpoint handler.
38
+ */
10
39
  getHandler(): HandlerMetadata
40
+ /**
41
+ * Gets the HTTP request object (adapter-specific).
42
+ */
11
43
  getRequest(): any
44
+ /**
45
+ * Gets the HTTP reply object (adapter-specific).
46
+ */
12
47
  getReply(): any
13
48
  }
@@ -0,0 +1,15 @@
1
+ import type { ModuleMetadata } from '../metadata/index.mjs';
2
+ import type { AbstractHttpCorsOptions } from './abstract-http-cors-options.interface.mjs';
3
+ import type { AbstractHttpListenOptions } from './abstract-http-listen-options.interface.mjs';
4
+ export interface AbstractHttpAdapterInterface<ServerInstance, CorsOptions = AbstractHttpCorsOptions, Options = {}, MultipartOptions = {}> {
5
+ setupHttpServer(options: Options): Promise<void>;
6
+ onModulesInit(modules: Map<string, ModuleMetadata>): Promise<void>;
7
+ ready(): Promise<void>;
8
+ getServer(): ServerInstance;
9
+ setGlobalPrefix(prefix: string): void;
10
+ enableCors(options: CorsOptions): void;
11
+ enableMultipart(options: MultipartOptions): void;
12
+ listen(options: AbstractHttpListenOptions): Promise<string>;
13
+ dispose(): Promise<void>;
14
+ }
15
+ //# sourceMappingURL=abstract-http-adapter.interface.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract-http-adapter.interface.d.mts","sourceRoot":"","sources":["abstract-http-adapter.interface.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAA;AACzF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAA;AAE7F,MAAM,WAAW,4BAA4B,CAC3C,cAAc,EACd,WAAW,GAAG,uBAAuB,EACrC,OAAO,GAAG,EAAE,EACZ,gBAAgB,GAAG,EAAE;IAErB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAChD,aAAa,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAClE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB,SAAS,IAAI,cAAc,CAAA;IAC3B,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrC,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;IACtC,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAA;IAChD,MAAM,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAC3D,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACzB"}
@@ -0,0 +1,58 @@
1
+ import type { LogLevel } from '../logger/index.mjs';
2
+ interface ArrayOfValueOrArray<T> extends Array<ValueOrArray<T>> {
3
+ }
4
+ type OriginType = string | boolean | RegExp;
5
+ type ValueOrArray<T> = T | ArrayOfValueOrArray<T>;
6
+ export interface AbstractHttpCorsOptions {
7
+ /**
8
+ * Configures the Access-Control-Allow-Origin CORS header.
9
+ */
10
+ origin?: ValueOrArray<OriginType>;
11
+ /**
12
+ * Configures the Access-Control-Allow-Credentials CORS header.
13
+ * Set to true to pass the header, otherwise it is omitted.
14
+ */
15
+ credentials?: boolean;
16
+ /**
17
+ * Configures the Access-Control-Expose-Headers CORS header.
18
+ * Expects a comma-delimited string (ex: 'Content-Range,X-Content-Range')
19
+ * or an array (ex: ['Content-Range', 'X-Content-Range']).
20
+ * If not specified, no custom headers are exposed.
21
+ */
22
+ exposedHeaders?: string | string[];
23
+ /**
24
+ * Configures the Access-Control-Allow-Headers CORS header.
25
+ * Expects a comma-delimited string (ex: 'Content-Type,Authorization')
26
+ * or an array (ex: ['Content-Type', 'Authorization']). If not
27
+ * specified, defaults to reflecting the headers specified in the
28
+ * request's Access-Control-Request-Headers header.
29
+ */
30
+ allowedHeaders?: string | string[];
31
+ /**
32
+ * Configures the Access-Control-Allow-Methods CORS header.
33
+ * Expects a comma-delimited string (ex: 'GET,PUT,POST') or an array (ex: ['GET', 'PUT', 'POST']).
34
+ */
35
+ methods?: string | string[];
36
+ /**
37
+ * Configures the Access-Control-Max-Age CORS header.
38
+ * Set to an integer to pass the header, otherwise it is omitted.
39
+ */
40
+ maxAge?: number;
41
+ /**
42
+ * Configures the Cache-Control header for CORS preflight responses.
43
+ * Set to an integer to pass the header as `Cache-Control: max-age=${cacheControl}`,
44
+ * or set to a string to pass the header as `Cache-Control: ${cacheControl}` (fully define
45
+ * the header value), otherwise the header is omitted.
46
+ */
47
+ cacheControl?: number | string;
48
+ /**
49
+ * Sets the Fastify log level specifically for the internal OPTIONS route
50
+ * used to handle CORS preflight requests. For example, setting this to `'silent'`
51
+ * will prevent these requests from being logged.
52
+ * Useful for reducing noise in application logs.
53
+ * Default: inherits Fastify's global log level.
54
+ */
55
+ logLevel?: LogLevel;
56
+ }
57
+
58
+ //# sourceMappingURL=abstract-http-cors-options.interface.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract-http-cors-options.interface.d.mts","sourceRoot":"","sources":["abstract-http-cors-options.interface.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAEnD,UAAU,mBAAmB,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CAAG;AAElE,KAAK,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;AAC3C,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAA;AAEjD,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC,UAAU,CAAC,CAAA;IACjC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAClC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAE9B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB"}
@@ -0,0 +1,7 @@
1
+ import type { ClassType, ScopedContainer } from '@navios/di';
2
+ import type { HandlerMetadata } from '../metadata/index.mjs';
3
+ export interface AbstractHttpHandlerAdapterInterface {
4
+ prepareArguments?: (handlerMetadata: HandlerMetadata<any>) => ((target: Record<string, any>, request: any) => Promise<void> | void)[];
5
+ provideHandler: (controller: ClassType, handlerMetadata: HandlerMetadata<any>) => (context: ScopedContainer, request: any, reply: any) => Promise<any>;
6
+ }
7
+ //# sourceMappingURL=abstract-http-handler-adapter.interface.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract-http-handler-adapter.interface.d.mts","sourceRoot":"","sources":["abstract-http-handler-adapter.interface.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE5D,MAAM,WAAW,mCAAmC;IAClD,gBAAgB,CAAC,EAAE,CACjB,eAAe,EAAE,eAAe,CAAC,GAAG,CAAC,KAClC,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,CAAA;IAC5E,cAAc,EAAE,CACd,UAAU,EAAE,SAAS,EACrB,eAAe,EAAE,eAAe,CAAC,GAAG,CAAC,KAClC,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;CAC1E"}
@@ -1,4 +1,4 @@
1
- import type { ClassType, RequestContextHolder } from '@navios/di'
1
+ import type { ClassType, ScopedContainer } from '@navios/di'
2
2
 
3
3
  import type { HandlerMetadata } from '../metadata/index.mjs'
4
4
 
@@ -9,5 +9,5 @@ export interface AbstractHttpHandlerAdapterInterface {
9
9
  provideHandler: (
10
10
  controller: ClassType,
11
11
  handlerMetadata: HandlerMetadata<any>,
12
- ) => (context: RequestContextHolder, request: any, reply: any) => Promise<any>
12
+ ) => (context: ScopedContainer, request: any, reply: any) => Promise<any>
13
13
  }
@@ -0,0 +1,5 @@
1
+ export interface AbstractHttpListenOptions {
2
+ port: number;
3
+ host?: string;
4
+ }
5
+ //# sourceMappingURL=abstract-http-listen-options.interface.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract-http-listen-options.interface.d.mts","sourceRoot":"","sources":["abstract-http-listen-options.interface.mts"],"names":[],"mappings":"AAAA,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;CACd"}
@@ -0,0 +1,36 @@
1
+ import type { AbstractExecutionContext } from '../interfaces/index.mjs';
2
+ /**
3
+ * Interface that guards must implement to control access to endpoints.
4
+ *
5
+ * Guards are used for authentication, authorization, and request validation.
6
+ * They are executed before the endpoint handler and can prevent the request
7
+ * from proceeding by returning `false` or throwing an exception.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * @Injectable()
12
+ * export class AuthGuard implements CanActivate {
13
+ * async canActivate(context: AbstractExecutionContext): Promise<boolean> {
14
+ * const request = context.getRequest()
15
+ * const token = request.headers.authorization
16
+ *
17
+ * if (!token) {
18
+ * throw new UnauthorizedException('Authentication required')
19
+ * }
20
+ *
21
+ * // Validate token
22
+ * return true
23
+ * }
24
+ * }
25
+ * ```
26
+ */
27
+ export interface CanActivate {
28
+ /**
29
+ * Determines if the current request can proceed to the endpoint handler.
30
+ *
31
+ * @param executionContext - The execution context containing request, reply, and metadata
32
+ * @returns `true` if the request can proceed, `false` otherwise. Can also throw an exception.
33
+ */
34
+ canActivate(executionContext: AbstractExecutionContext): Promise<boolean> | boolean;
35
+ }
36
+ //# sourceMappingURL=can-activate.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"can-activate.d.mts","sourceRoot":"","sources":["can-activate.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;OAKG;IACH,WAAW,CACT,gBAAgB,EAAE,wBAAwB,GACzC,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;CAC9B"}
@@ -1,6 +1,37 @@
1
1
  import type { AbstractExecutionContext } from '../interfaces/index.mjs'
2
2
 
3
+ /**
4
+ * Interface that guards must implement to control access to endpoints.
5
+ *
6
+ * Guards are used for authentication, authorization, and request validation.
7
+ * They are executed before the endpoint handler and can prevent the request
8
+ * from proceeding by returning `false` or throwing an exception.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * @Injectable()
13
+ * export class AuthGuard implements CanActivate {
14
+ * async canActivate(context: AbstractExecutionContext): Promise<boolean> {
15
+ * const request = context.getRequest()
16
+ * const token = request.headers.authorization
17
+ *
18
+ * if (!token) {
19
+ * throw new UnauthorizedException('Authentication required')
20
+ * }
21
+ *
22
+ * // Validate token
23
+ * return true
24
+ * }
25
+ * }
26
+ * ```
27
+ */
3
28
  export interface CanActivate {
29
+ /**
30
+ * Determines if the current request can proceed to the endpoint handler.
31
+ *
32
+ * @param executionContext - The execution context containing request, reply, and metadata
33
+ * @returns `true` if the request can proceed, `false` otherwise. Can also throw an exception.
34
+ */
4
35
  canActivate(
5
36
  executionContext: AbstractExecutionContext,
6
37
  ): Promise<boolean> | boolean
@@ -0,0 +1,10 @@
1
+ import type { OutgoingHttpHeaders } from 'http';
2
+ export type OmitIndexSignature<T> = {
3
+ [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K];
4
+ };
5
+ /**
6
+ * HTTP header strings
7
+ * Use this type only for input values, not for output values.
8
+ */
9
+ export type HttpHeader = keyof OmitIndexSignature<OutgoingHttpHeaders> | (string & Record<never, never>);
10
+ //# sourceMappingURL=http-header.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-header.d.mts","sourceRoot":"","sources":["http-header.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAA;AAE/C,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI;KACjC,CAAC,IAAI,MAAM,CAAC,IAAI,MAAM,SAAS,CAAC,GAC7B,KAAK,GACL,MAAM,SAAS,CAAC,GACd,KAAK,GACL,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACf,CAAA;AAED;;;GAGG;AAEH,MAAM,MAAM,UAAU,GAClB,MAAM,kBAAkB,CAAC,mBAAmB,CAAC,GAC7C,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ export * from './abstract-execution-context.inteface.mjs';
2
+ export * from './abstract-http-adapter.interface.mjs';
3
+ export * from './abstract-http-cors-options.interface.mjs';
4
+ export * from './abstract-http-handler-adapter.interface.mjs';
5
+ export * from './abstract-http-listen-options.interface.mjs';
6
+ export * from './can-activate.mjs';
7
+ export * from './http-header.mjs';
8
+ export * from './navios-module.mjs';
9
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["index.mts"],"names":[],"mappings":"AAAA,cAAc,2CAA2C,CAAA;AACzD,cAAc,uCAAuC,CAAA;AACrD,cAAc,4CAA4C,CAAA;AAC1D,cAAc,+CAA+C,CAAA;AAC7D,cAAc,8CAA8C,CAAA;AAC5D,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Interface that all Navios modules must implement.
3
+ *
4
+ * Modules decorated with @Module() should implement this interface to receive
5
+ * lifecycle hooks.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * @Module({
10
+ * controllers: [UserController],
11
+ * })
12
+ * export class AppModule implements NaviosModule {
13
+ * async onModuleInit() {
14
+ * console.log('AppModule initialized')
15
+ * // Perform initialization logic
16
+ * }
17
+ * }
18
+ * ```
19
+ */
20
+ export interface NaviosModule {
21
+ /**
22
+ * Optional lifecycle hook called after the module is initialized.
23
+ *
24
+ * This is called after all modules are loaded and the HTTP server is set up
25
+ * (if an adapter is configured), but before the server starts listening.
26
+ */
27
+ onModuleInit?: () => Promise<void> | void;
28
+ }
29
+ //# sourceMappingURL=navios-module.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navios-module.d.mts","sourceRoot":"","sources":["navios-module.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;CAC1C"}
@@ -1,3 +1,28 @@
1
+ /**
2
+ * Interface that all Navios modules must implement.
3
+ *
4
+ * Modules decorated with @Module() should implement this interface to receive
5
+ * lifecycle hooks.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * @Module({
10
+ * controllers: [UserController],
11
+ * })
12
+ * export class AppModule implements NaviosModule {
13
+ * async onModuleInit() {
14
+ * console.log('AppModule initialized')
15
+ * // Perform initialization logic
16
+ * }
17
+ * }
18
+ * ```
19
+ */
1
20
  export interface NaviosModule {
21
+ /**
22
+ * Optional lifecycle hook called after the module is initialized.
23
+ *
24
+ * This is called after all modules are loaded and the HTTP server is set up
25
+ * (if an adapter is configured), but before the server starts listening.
26
+ */
2
27
  onModuleInit?: () => Promise<void> | void
3
28
  }