@navios/core 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/lib/{index-BFwNx9WQ.d.cts → index-DW9EPAE6.d.mts} +222 -17
  3. package/lib/index-DW9EPAE6.d.mts.map +1 -0
  4. package/lib/{index-D657ijFO.d.mts → index-pHp-dIGt.d.cts} +222 -17
  5. package/lib/index-pHp-dIGt.d.cts.map +1 -0
  6. package/lib/index.cjs +5 -5
  7. package/lib/index.d.cts +2 -2
  8. package/lib/index.d.mts +2 -2
  9. package/lib/index.mjs +1 -1
  10. package/lib/legacy-compat/index.cjs +1 -1
  11. package/lib/legacy-compat/index.d.cts +1 -1
  12. package/lib/legacy-compat/index.d.cts.map +1 -1
  13. package/lib/legacy-compat/index.d.mts +1 -1
  14. package/lib/legacy-compat/index.d.mts.map +1 -1
  15. package/lib/{src-DzPY5s6d.mjs → src-DyvCDuKO.mjs} +121 -31
  16. package/lib/src-DyvCDuKO.mjs.map +1 -0
  17. package/lib/{src-Cb1aTjl0.cjs → src-QnxR5b7c.cjs} +164 -74
  18. package/lib/src-QnxR5b7c.cjs.map +1 -0
  19. package/lib/testing/index.cjs +6 -6
  20. package/lib/testing/index.cjs.map +1 -1
  21. package/lib/testing/index.d.cts +1 -1
  22. package/lib/testing/index.d.mts +1 -1
  23. package/lib/testing/index.mjs +1 -1
  24. package/lib/{use-guards.decorator-DdvUhB03.cjs → use-guards.decorator-B6q_N0sf.cjs} +17 -17
  25. package/lib/{use-guards.decorator-DdvUhB03.cjs.map → use-guards.decorator-B6q_N0sf.cjs.map} +1 -1
  26. package/package.json +12 -12
  27. package/src/interfaces/abstract-http-adapter.interface.mts +52 -0
  28. package/src/interfaces/index.mts +1 -0
  29. package/src/interfaces/plugin.interface.mts +105 -0
  30. package/src/logger/logger.service.mts +5 -3
  31. package/src/navios.application.mts +77 -27
  32. package/src/navios.factory.mts +10 -9
  33. package/src/services/module-loader.service.mts +102 -1
  34. package/lib/index-BFwNx9WQ.d.cts.map +0 -1
  35. package/lib/index-D657ijFO.d.mts.map +0 -1
  36. package/lib/src-Cb1aTjl0.cjs.map +0 -1
  37. package/lib/src-DzPY5s6d.mjs.map +0 -1
  38. package/src/attribute.factory.d.mts +0 -175
  39. package/src/attribute.factory.d.mts.map +0 -1
  40. package/src/config/config-service.interface.d.mts +0 -39
  41. package/src/config/config-service.interface.d.mts.map +0 -1
  42. package/src/config/config.provider.d.mts +0 -46
  43. package/src/config/config.provider.d.mts.map +0 -1
  44. package/src/config/config.service.d.mts +0 -108
  45. package/src/config/config.service.d.mts.map +0 -1
  46. package/src/config/index.d.mts +0 -6
  47. package/src/config/index.d.mts.map +0 -1
  48. package/src/config/types.d.mts +0 -13
  49. package/src/config/types.d.mts.map +0 -1
  50. package/src/config/utils/helpers.d.mts +0 -3
  51. package/src/config/utils/helpers.d.mts.map +0 -1
  52. package/src/config/utils/index.d.mts +0 -2
  53. package/src/config/utils/index.d.mts.map +0 -1
  54. package/src/decorators/controller.decorator.d.mts +0 -33
  55. package/src/decorators/controller.decorator.d.mts.map +0 -1
  56. package/src/decorators/endpoint.decorator.d.mts +0 -89
  57. package/src/decorators/endpoint.decorator.d.mts.map +0 -1
  58. package/src/decorators/header.decorator.d.mts +0 -22
  59. package/src/decorators/header.decorator.d.mts.map +0 -1
  60. package/src/decorators/http-code.decorator.d.mts +0 -22
  61. package/src/decorators/http-code.decorator.d.mts.map +0 -1
  62. package/src/decorators/index.d.mts +0 -9
  63. package/src/decorators/index.d.mts.map +0 -1
  64. package/src/decorators/module.decorator.d.mts +0 -42
  65. package/src/decorators/module.decorator.d.mts.map +0 -1
  66. package/src/decorators/multipart.decorator.d.mts +0 -54
  67. package/src/decorators/multipart.decorator.d.mts.map +0 -1
  68. package/src/decorators/stream.decorator.d.mts +0 -42
  69. package/src/decorators/stream.decorator.d.mts.map +0 -1
  70. package/src/decorators/use-guards.decorator.d.mts +0 -33
  71. package/src/decorators/use-guards.decorator.d.mts.map +0 -1
  72. package/src/exceptions/bad-request.exception.d.mts +0 -26
  73. package/src/exceptions/bad-request.exception.d.mts.map +0 -1
  74. package/src/exceptions/conflict.exception.d.mts +0 -29
  75. package/src/exceptions/conflict.exception.d.mts.map +0 -1
  76. package/src/exceptions/forbidden.exception.d.mts +0 -28
  77. package/src/exceptions/forbidden.exception.d.mts.map +0 -1
  78. package/src/exceptions/http.exception.d.mts +0 -33
  79. package/src/exceptions/http.exception.d.mts.map +0 -1
  80. package/src/exceptions/index.d.mts +0 -8
  81. package/src/exceptions/index.d.mts.map +0 -1
  82. package/src/exceptions/internal-server-error.exception.d.mts +0 -31
  83. package/src/exceptions/internal-server-error.exception.d.mts.map +0 -1
  84. package/src/exceptions/not-found.exception.d.mts +0 -30
  85. package/src/exceptions/not-found.exception.d.mts.map +0 -1
  86. package/src/exceptions/unauthorized.exception.d.mts +0 -28
  87. package/src/exceptions/unauthorized.exception.d.mts.map +0 -1
  88. package/src/factories/endpoint-adapter.factory.d.mts +0 -6
  89. package/src/factories/endpoint-adapter.factory.d.mts.map +0 -1
  90. package/src/factories/http-adapter.factory.d.mts +0 -6
  91. package/src/factories/http-adapter.factory.d.mts.map +0 -1
  92. package/src/factories/index.d.mts +0 -8
  93. package/src/factories/index.d.mts.map +0 -1
  94. package/src/factories/multipart-adapter.factory.d.mts +0 -6
  95. package/src/factories/multipart-adapter.factory.d.mts.map +0 -1
  96. package/src/factories/reply.factory.d.mts +0 -6
  97. package/src/factories/reply.factory.d.mts.map +0 -1
  98. package/src/factories/request.factory.d.mts +0 -6
  99. package/src/factories/request.factory.d.mts.map +0 -1
  100. package/src/factories/stream-adapter.factory.d.mts +0 -6
  101. package/src/factories/stream-adapter.factory.d.mts.map +0 -1
  102. package/src/factories/xml-stream-adapter.factory.d.mts +0 -6
  103. package/src/factories/xml-stream-adapter.factory.d.mts.map +0 -1
  104. package/src/index.d.mts +0 -15
  105. package/src/index.d.mts.map +0 -1
  106. package/src/interfaces/abstract-execution-context.inteface.d.mts +0 -44
  107. package/src/interfaces/abstract-execution-context.inteface.d.mts.map +0 -1
  108. package/src/interfaces/abstract-http-adapter.interface.d.mts +0 -15
  109. package/src/interfaces/abstract-http-adapter.interface.d.mts.map +0 -1
  110. package/src/interfaces/abstract-http-cors-options.interface.d.mts +0 -58
  111. package/src/interfaces/abstract-http-cors-options.interface.d.mts.map +0 -1
  112. package/src/interfaces/abstract-http-handler-adapter.interface.d.mts +0 -7
  113. package/src/interfaces/abstract-http-handler-adapter.interface.d.mts.map +0 -1
  114. package/src/interfaces/abstract-http-listen-options.interface.d.mts +0 -5
  115. package/src/interfaces/abstract-http-listen-options.interface.d.mts.map +0 -1
  116. package/src/interfaces/can-activate.d.mts +0 -36
  117. package/src/interfaces/can-activate.d.mts.map +0 -1
  118. package/src/interfaces/http-header.d.mts +0 -10
  119. package/src/interfaces/http-header.d.mts.map +0 -1
  120. package/src/interfaces/index.d.mts +0 -9
  121. package/src/interfaces/index.d.mts.map +0 -1
  122. package/src/interfaces/navios-module.d.mts +0 -29
  123. package/src/interfaces/navios-module.d.mts.map +0 -1
  124. package/src/legacy-compat/context-compat.d.mts +0 -19
  125. package/src/legacy-compat/context-compat.d.mts.map +0 -1
  126. package/src/legacy-compat/decorators/controller.decorator.d.mts +0 -21
  127. package/src/legacy-compat/decorators/controller.decorator.d.mts.map +0 -1
  128. package/src/legacy-compat/decorators/endpoint.decorator.d.mts +0 -33
  129. package/src/legacy-compat/decorators/endpoint.decorator.d.mts.map +0 -1
  130. package/src/legacy-compat/decorators/header.decorator.d.mts +0 -24
  131. package/src/legacy-compat/decorators/header.decorator.d.mts.map +0 -1
  132. package/src/legacy-compat/decorators/http-code.decorator.d.mts +0 -22
  133. package/src/legacy-compat/decorators/http-code.decorator.d.mts.map +0 -1
  134. package/src/legacy-compat/decorators/index.d.mts +0 -9
  135. package/src/legacy-compat/decorators/index.d.mts.map +0 -1
  136. package/src/legacy-compat/decorators/module.decorator.d.mts +0 -22
  137. package/src/legacy-compat/decorators/module.decorator.d.mts.map +0 -1
  138. package/src/legacy-compat/decorators/multipart.decorator.d.mts +0 -34
  139. package/src/legacy-compat/decorators/multipart.decorator.d.mts.map +0 -1
  140. package/src/legacy-compat/decorators/stream.decorator.d.mts +0 -34
  141. package/src/legacy-compat/decorators/stream.decorator.d.mts.map +0 -1
  142. package/src/legacy-compat/decorators/use-guards.decorator.d.mts +0 -29
  143. package/src/legacy-compat/decorators/use-guards.decorator.d.mts.map +0 -1
  144. package/src/legacy-compat/index.d.mts +0 -19
  145. package/src/legacy-compat/index.d.mts.map +0 -1
  146. package/src/logger/console-logger.service.d.mts +0 -196
  147. package/src/logger/console-logger.service.d.mts.map +0 -1
  148. package/src/logger/index.d.mts +0 -7
  149. package/src/logger/index.d.mts.map +0 -1
  150. package/src/logger/log-levels.d.mts +0 -14
  151. package/src/logger/log-levels.d.mts.map +0 -1
  152. package/src/logger/logger-service.interface.d.mts +0 -36
  153. package/src/logger/logger-service.interface.d.mts.map +0 -1
  154. package/src/logger/logger.service.d.mts +0 -57
  155. package/src/logger/logger.service.d.mts.map +0 -1
  156. package/src/logger/logger.tokens.d.mts +0 -36
  157. package/src/logger/logger.tokens.d.mts.map +0 -1
  158. package/src/logger/utils/cli-colors.util.d.mts +0 -10
  159. package/src/logger/utils/cli-colors.util.d.mts.map +0 -1
  160. package/src/logger/utils/filter-log-levelts.util.d.mts +0 -6
  161. package/src/logger/utils/filter-log-levelts.util.d.mts.map +0 -1
  162. package/src/logger/utils/index.d.mts +0 -6
  163. package/src/logger/utils/index.d.mts.map +0 -1
  164. package/src/logger/utils/is-log-level-enabled.d.mts +0 -8
  165. package/src/logger/utils/is-log-level-enabled.d.mts.map +0 -1
  166. package/src/logger/utils/is-log-level.util.d.mts +0 -6
  167. package/src/logger/utils/is-log-level.util.d.mts.map +0 -1
  168. package/src/logger/utils/shared.utils.d.mts +0 -14
  169. package/src/logger/utils/shared.utils.d.mts.map +0 -1
  170. package/src/metadata/controller.metadata.d.mts +0 -13
  171. package/src/metadata/controller.metadata.d.mts.map +0 -1
  172. package/src/metadata/handler.metadata.d.mts +0 -18
  173. package/src/metadata/handler.metadata.d.mts.map +0 -1
  174. package/src/metadata/index.d.mts +0 -4
  175. package/src/metadata/index.d.mts.map +0 -1
  176. package/src/metadata/module.metadata.d.mts +0 -13
  177. package/src/metadata/module.metadata.d.mts.map +0 -1
  178. package/src/navios.application.d.mts +0 -210
  179. package/src/navios.application.d.mts.map +0 -1
  180. package/src/navios.environment.d.mts +0 -11
  181. package/src/navios.environment.d.mts.map +0 -1
  182. package/src/navios.factory.d.mts +0 -68
  183. package/src/navios.factory.d.mts.map +0 -1
  184. package/src/services/guard-runner.service.d.mts +0 -10
  185. package/src/services/guard-runner.service.d.mts.map +0 -1
  186. package/src/services/index.d.mts +0 -3
  187. package/src/services/index.d.mts.map +0 -1
  188. package/src/services/module-loader.service.d.mts +0 -17
  189. package/src/services/module-loader.service.d.mts.map +0 -1
  190. package/src/stores/index.d.mts +0 -2
  191. package/src/stores/index.d.mts.map +0 -1
  192. package/src/stores/request-id.store.d.mts +0 -37
  193. package/src/stores/request-id.store.d.mts.map +0 -1
  194. package/src/tokens/endpoint-adapter.token.d.mts +0 -4
  195. package/src/tokens/endpoint-adapter.token.d.mts.map +0 -1
  196. package/src/tokens/execution-context.token.d.mts +0 -5
  197. package/src/tokens/execution-context.token.d.mts.map +0 -1
  198. package/src/tokens/http-adapter.token.d.mts +0 -4
  199. package/src/tokens/http-adapter.token.d.mts.map +0 -1
  200. package/src/tokens/index.d.mts +0 -9
  201. package/src/tokens/index.d.mts.map +0 -1
  202. package/src/tokens/multipart-adapter.token.d.mts +0 -4
  203. package/src/tokens/multipart-adapter.token.d.mts.map +0 -1
  204. package/src/tokens/reply.token.d.mts +0 -3
  205. package/src/tokens/reply.token.d.mts.map +0 -1
  206. package/src/tokens/request.token.d.mts +0 -3
  207. package/src/tokens/request.token.d.mts.map +0 -1
  208. package/src/tokens/stream-adapter.token.d.mts +0 -4
  209. package/src/tokens/stream-adapter.token.d.mts.map +0 -1
  210. package/src/tokens/xml-stream-adapter.token.d.mts +0 -4
  211. package/src/tokens/xml-stream-adapter.token.d.mts.map +0 -1
@@ -1,175 +0,0 @@
1
- import type { z, ZodType } from 'zod/v4';
2
- import type { ControllerMetadata, HandlerMetadata, ModuleMetadata } from './metadata/index.mjs';
3
- /**
4
- * Type for a class attribute decorator without a value.
5
- *
6
- * Attributes are custom metadata decorators that can be applied to modules,
7
- * controllers, and endpoints.
8
- */
9
- export type ClassAttribute = (() => <T>(target: T, context: ClassDecoratorContext | ClassMethodDecoratorContext) => T) & {
10
- token: symbol;
11
- };
12
- /**
13
- * Type for a class attribute decorator with a validated value.
14
- *
15
- * @typeParam T - The Zod schema type for validation
16
- */
17
- export type ClassSchemaAttribute<T extends ZodType> = ((value: z.input<T>) => <T>(target: T, context: ClassDecoratorContext | ClassMethodDecoratorContext) => T) & {
18
- token: symbol;
19
- schema: ZodType;
20
- };
21
- /**
22
- * Factory for creating custom attribute decorators.
23
- *
24
- * Attributes allow you to add custom metadata to modules, controllers, and endpoints.
25
- * This is useful for cross-cutting concerns like rate limiting, caching, API versioning, etc.
26
- *
27
- * @example
28
- * ```typescript
29
- * // Create a simple boolean attribute
30
- * const Public = AttributeFactory.createAttribute(Symbol.for('Public'))
31
- *
32
- * // Use it as a decorator
33
- * @Controller()
34
- * @Public()
35
- * export class PublicController { }
36
- *
37
- * // Check if attribute exists
38
- * if (AttributeFactory.has(Public, controllerMetadata)) {
39
- * // Skip authentication
40
- * }
41
- * ```
42
- *
43
- * @example
44
- * ```typescript
45
- * // Create an attribute with a validated value
46
- * const RateLimit = AttributeFactory.createAttribute(
47
- * Symbol.for('RateLimit'),
48
- * z.object({ requests: z.number(), window: z.number() })
49
- * )
50
- *
51
- * // Use it with a value
52
- * @Endpoint(apiEndpoint)
53
- * @RateLimit({ requests: 100, window: 60000 })
54
- * async handler() { }
55
- *
56
- * // Get the value
57
- * const limit = AttributeFactory.get(RateLimit, endpointMetadata)
58
- * // limit is typed as { requests: number, window: number } | null
59
- * ```
60
- */
61
- export declare class AttributeFactory {
62
- /**
63
- * Creates a simple attribute decorator without a value.
64
- *
65
- * @param token - A unique symbol to identify this attribute
66
- * @returns A decorator function that can be applied to classes or methods
67
- *
68
- * @example
69
- * ```typescript
70
- * const Public = AttributeFactory.createAttribute(Symbol.for('Public'))
71
- *
72
- * @Public()
73
- * @Controller()
74
- * export class PublicController { }
75
- * ```
76
- */
77
- static createAttribute(token: symbol): ClassAttribute;
78
- /**
79
- * Creates an attribute decorator with a validated value.
80
- *
81
- * @param token - A unique symbol to identify this attribute
82
- * @param schema - A Zod schema to validate the attribute value
83
- * @returns A decorator function that accepts a value and can be applied to classes or methods
84
- *
85
- * @example
86
- * ```typescript
87
- * const RateLimit = AttributeFactory.createAttribute(
88
- * Symbol.for('RateLimit'),
89
- * z.object({ requests: z.number(), window: z.number() })
90
- * )
91
- *
92
- * @RateLimit({ requests: 100, window: 60000 })
93
- * @Endpoint(apiEndpoint)
94
- * async handler() { }
95
- * ```
96
- */
97
- static createAttribute<T extends ZodType>(token: symbol, schema: T): ClassSchemaAttribute<T>;
98
- /**
99
- * Gets the value of an attribute from metadata.
100
- *
101
- * Returns `null` if the attribute is not present.
102
- * For simple attributes (without values), returns `true` if present.
103
- *
104
- * @param attribute - The attribute decorator
105
- * @param target - The metadata object (module, controller, or handler)
106
- * @returns The attribute value, `true` for simple attributes, or `null` if not found
107
- *
108
- * @example
109
- * ```typescript
110
- * const isPublic = AttributeFactory.get(Public, controllerMetadata)
111
- * // isPublic is true | null
112
- *
113
- * const rateLimit = AttributeFactory.get(RateLimit, endpointMetadata)
114
- * // rateLimit is { requests: number, window: number } | null
115
- * ```
116
- */
117
- static get(attribute: ClassAttribute, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): true | null;
118
- static get<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): z.output<T> | null;
119
- /**
120
- * Gets all values of an attribute from metadata (useful when an attribute can appear multiple times).
121
- *
122
- * Returns `null` if the attribute is not present.
123
- *
124
- * @param attribute - The attribute decorator
125
- * @param target - The metadata object (module, controller, or handler)
126
- * @returns An array of attribute values, or `null` if not found
127
- *
128
- * @example
129
- * ```typescript
130
- * const tags = AttributeFactory.getAll(Tag, endpointMetadata)
131
- * // tags is string[] | null
132
- * ```
133
- */
134
- static getAll(attribute: ClassAttribute, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): Array<true> | null;
135
- static getAll<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): Array<z.output<T>> | null;
136
- /**
137
- * Gets the last value of an attribute from an array of metadata objects.
138
- *
139
- * Searches from the end of the array backwards, useful for finding the most
140
- * specific attribute value (e.g., endpoint-level overrides module-level).
141
- *
142
- * @param attribute - The attribute decorator
143
- * @param target - An array of metadata objects (typically [module, controller, handler])
144
- * @returns The last attribute value found, or `null` if not found
145
- *
146
- * @example
147
- * ```typescript
148
- * // Check attribute hierarchy: endpoint -> controller -> module
149
- * const rateLimit = AttributeFactory.getLast(RateLimit, [
150
- * moduleMetadata,
151
- * controllerMetadata,
152
- * endpointMetadata
153
- * ])
154
- * ```
155
- */
156
- static getLast(attribute: ClassAttribute, target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[]): true | null;
157
- static getLast<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[]): z.output<T> | null;
158
- /**
159
- * Checks if an attribute is present on the metadata object.
160
- *
161
- * @param attribute - The attribute decorator
162
- * @param target - The metadata object (module, controller, or handler)
163
- * @returns `true` if the attribute is present, `false` otherwise
164
- *
165
- * @example
166
- * ```typescript
167
- * if (AttributeFactory.has(Public, controllerMetadata)) {
168
- * // Skip authentication
169
- * }
170
- * ```
171
- */
172
- static has(attribute: ClassAttribute, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): boolean;
173
- static has<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): boolean;
174
- }
175
- //# sourceMappingURL=attribute.factory.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attribute.factory.d.mts","sourceRoot":"","sources":["attribute.factory.mts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAExC,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,cAAc,EACf,MAAM,sBAAsB,CAAA;AAU7B;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,CAAC,CAAC,EACpC,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,qBAAqB,GAAG,2BAA2B,KACzD,CAAC,CAAC,GAAG;IACR,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,OAAO,IAAI,CAAC,CACrD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KACd,CAAC,CAAC,EACL,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,qBAAqB,GAAG,2BAA2B,KACzD,CAAC,CAAC,GAAG;IACR,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,OAAO,CAAA;CAChB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,qBAAa,gBAAgB;IAC3B;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc;IACrD;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,eAAe,CAAC,CAAC,SAAS,OAAO,EACtC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,CAAC,GACR,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,CAAC,CAAC,CAAC,GAAG,IAAI;IAcrB;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,GAAG,CACR,SAAS,EAAE,cAAc,EACzB,MAAM,EAAE,cAAc,GAAG,kBAAkB,GAAG,eAAe,CAAC,GAAG,CAAC,GACjE,OAAO;IACV,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,OAAO,EAC1B,SAAS,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAClC,MAAM,EAAE,cAAc,GAAG,kBAAkB,GAAG,eAAe,CAAC,GAAG,CAAC,GACjE,OAAO;CAOX"}
@@ -1,39 +0,0 @@
1
- import type { Path, PathValue } from './types.mjs';
2
- /**
3
- * Interface for configuration service implementations.
4
- *
5
- * Provides type-safe access to configuration values with support for nested paths.
6
- *
7
- * @typeParam Config - The configuration object type
8
- */
9
- export interface ConfigServiceInterface<Config = Record<string, unknown>> {
10
- /**
11
- * Gets the entire configuration object.
12
- */
13
- getConfig: () => Config;
14
- /**
15
- * Gets a configuration value by key path. Returns `null` if not found.
16
- *
17
- * @param key - Dot-separated path to the configuration value (e.g., 'database.host')
18
- * @returns The configuration value or `null` if not found
19
- */
20
- get: <Key extends Path<Config>>(key: Key) => PathValue<Config, Key> | null;
21
- /**
22
- * Gets a configuration value by key path, or returns a default value if not found.
23
- *
24
- * @param key - Dot-separated path to the configuration value
25
- * @param defaultValue - Default value to return if the key is not found
26
- * @returns The configuration value or the default value
27
- */
28
- getOrDefault: <Key extends Path<Config>>(key: Key, defaultValue: PathValue<Config, Key>) => PathValue<Config, Key>;
29
- /**
30
- * Gets a configuration value by key path, or throws an error if not found.
31
- *
32
- * @param key - Dot-separated path to the configuration value
33
- * @param errorMessage - Optional custom error message
34
- * @returns The configuration value
35
- * @throws Error if the key is not found
36
- */
37
- getOrThrow: <Key extends Path<Config>>(key: Key, errorMessage?: string) => PathValue<Config, Key>;
38
- }
39
- //# sourceMappingURL=config-service.interface.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-service.interface.d.mts","sourceRoot":"","sources":["config-service.interface.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAElD;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACtE;;OAEG;IACH,SAAS,EAAE,MAAM,MAAM,CAAA;IACvB;;;;;OAKG;IACH,GAAG,EAAE,CAAC,GAAG,SAAS,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,KAAK,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAA;IAE1E;;;;;;OAMG;IACH,YAAY,EAAE,CAAC,GAAG,SAAS,IAAI,CAAC,MAAM,CAAC,EACrC,GAAG,EAAE,GAAG,EACR,YAAY,EAAE,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,KACjC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAE3B;;;;;;;OAOG;IACH,UAAU,EAAE,CAAC,GAAG,SAAS,IAAI,CAAC,MAAM,CAAC,EACnC,GAAG,EAAE,GAAG,EACR,YAAY,CAAC,EAAE,MAAM,KAClB,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC5B"}
@@ -1,46 +0,0 @@
1
- import { FactoryInjectionToken } from '@navios/di';
2
- import { z } from 'zod/v4';
3
- import type { ConfigServiceOptions } from './config.service.mjs';
4
- import { ConfigService, ConfigServiceOptionsSchema } from './config.service.mjs';
5
- /**
6
- * Schema for configuration provider options.
7
- */
8
- export declare const ConfigProviderOptions: z.ZodObject<{
9
- load: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
10
- }, z.core.$strip>;
11
- /**
12
- * Creates a factory injection token for ConfigService that loads configuration asynchronously.
13
- *
14
- * Use this when you need to load configuration from a file, database, or other async source.
15
- *
16
- * @param options - Configuration provider options
17
- * @param options.load - Async function that loads and returns the configuration object
18
- * @returns A factory injection token for ConfigService
19
- *
20
- * @example
21
- * ```typescript
22
- * const MyConfigService = provideConfig({
23
- * load: async () => {
24
- * const config = await loadConfigFromFile('config.json')
25
- * return config
26
- * },
27
- * })
28
- *
29
- * // Use in module setup
30
- * container.bind(ConfigServiceToken).toFactory(configProvider)
31
- * ```
32
- */
33
- export declare function provideConfig<ConfigMap extends ConfigServiceOptions>(options: z.input<typeof ConfigProviderOptions>): FactoryInjectionToken<ConfigService<ConfigMap>, typeof ConfigServiceOptionsSchema>;
34
- /**
35
- * Pre-configured ConfigService provider that uses environment variables.
36
- *
37
- * Provides a ConfigService instance bound to `process.env`.
38
- *
39
- * @example
40
- * ```typescript
41
- * // Use environment variables as configuration
42
- * container.bind(ConfigServiceToken).toValue(EnvConfigProvider)
43
- * ```
44
- */
45
- export declare const EnvConfigProvider: import("@navios/di").BoundInjectionToken<ConfigService<Record<string, string>>, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
46
- //# sourceMappingURL=config.provider.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.provider.d.mts","sourceRoot":"","sources":["config.provider.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAkB,MAAM,YAAY,CAAA;AAElE,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAEhE,OAAO,EACL,aAAa,EACb,0BAA0B,EAE3B,MAAM,sBAAsB,CAAA;AAE7B;;GAEG;AACH,eAAO,MAAM,qBAAqB;;iBAEhC,CAAA;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,aAAa,CAAC,SAAS,SAAS,oBAAoB,EAClE,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,GAC7C,qBAAqB,CACtB,aAAa,CAAC,SAAS,CAAC,EACxB,OAAO,0BAA0B,CAClC,CAEA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,yHAK5B,CAAA"}
@@ -1,108 +0,0 @@
1
- import { InjectionToken } from '@navios/di';
2
- import { z } from 'zod/v4';
3
- import type { ConfigServiceInterface as IConfigService } from './config-service.interface.mjs';
4
- import type { Path, PathValue } from './types.mjs';
5
- /**
6
- * Schema for validating configuration service options.
7
- */
8
- export declare const ConfigServiceOptionsSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
9
- /**
10
- * Type for configuration service options.
11
- */
12
- export type ConfigServiceOptions = z.infer<typeof ConfigServiceOptionsSchema>;
13
- /**
14
- * Injection token for ConfigService.
15
- */
16
- export declare const ConfigServiceToken: InjectionToken<IConfigService<Record<string, unknown>>, z.ZodRecord<z.ZodString, z.ZodUnknown>, true>;
17
- /**
18
- * Service for managing application configuration with type-safe access.
19
- *
20
- * Provides methods to access configuration values using dot-notation paths
21
- * with full TypeScript type inference.
22
- *
23
- * @typeParam Config - The configuration object type
24
- *
25
- * @example
26
- * ```typescript
27
- * interface AppConfig {
28
- * database: {
29
- * host: string
30
- * port: number
31
- * }
32
- * api: {
33
- * timeout: number
34
- * }
35
- * }
36
- *
37
- * @Injectable()
38
- * export class DatabaseService {
39
- * private config = inject(MyConfigService)
40
- *
41
- * connect() {
42
- * const host = this.config.getOrThrow('database.host')
43
- * const port = this.config.getOrDefault('database.port', 5432)
44
- * // host is typed as string, port is typed as number
45
- * }
46
- * }
47
- * ```
48
- */
49
- export declare class ConfigService<Config extends ConfigServiceOptions = Record<string, unknown>> implements IConfigService<Config> {
50
- private config;
51
- private readonly logger;
52
- /**
53
- * Creates a new ConfigService instance.
54
- *
55
- * @param config - The configuration object
56
- */
57
- constructor(config?: Config);
58
- /**
59
- * Gets the entire configuration object.
60
- *
61
- * @returns The complete configuration object
62
- */
63
- getConfig(): Config;
64
- /**
65
- * Gets a configuration value by key path.
66
- *
67
- * Returns `null` if the key is not found or if any part of the path is invalid.
68
- *
69
- * @param key - Dot-separated path to the configuration value (e.g., 'database.host')
70
- * @returns The configuration value or `null` if not found
71
- *
72
- * @example
73
- * ```typescript
74
- * const host = config.get('database.host') // string | null
75
- * const port = config.get('database.port') // number | null
76
- * ```
77
- */
78
- get<Key extends Path<Config>>(key: Key): PathValue<Config, Key> | null;
79
- /**
80
- * Gets a configuration value by key path, or returns a default value if not found.
81
- *
82
- * @param key - Dot-separated path to the configuration value
83
- * @param defaultValue - Default value to return if the key is not found
84
- * @returns The configuration value or the default value
85
- *
86
- * @example
87
- * ```typescript
88
- * const port = config.getOrDefault('database.port', 5432) // number
89
- * ```
90
- */
91
- getOrDefault<Key extends Path<Config>>(key: Key, defaultValue: PathValue<Config, Key>): PathValue<Config, Key>;
92
- /**
93
- * Gets a configuration value by key path, or throws an error if not found.
94
- *
95
- * @param key - Dot-separated path to the configuration value
96
- * @param errorMessage - Optional custom error message
97
- * @returns The configuration value
98
- * @throws Error if the key is not found
99
- *
100
- * @example
101
- * ```typescript
102
- * const host = config.getOrThrow('database.host') // string (throws if not found)
103
- * const apiKey = config.getOrThrow('api.key', 'API key is required') // string
104
- * ```
105
- */
106
- getOrThrow<Key extends Path<Config>>(key: Key, errorMessage?: string): PathValue<Config, Key>;
107
- }
108
- //# sourceMappingURL=config.service.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.service.d.mts","sourceRoot":"","sources":["config.service.mts"],"names":[],"mappings":"AACA,OAAO,EAAsB,cAAc,EAAE,MAAM,YAAY,CAAA;AAE/D,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,OAAO,KAAK,EAAE,sBAAsB,IAAI,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAC9F,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAIlD;;GAEG;AACH,eAAO,MAAM,0BAA0B,wCAAoC,CAAA;AAC3E;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAE7E;;GAEG;AACH,eAAO,MAAM,kBAAkB,uGAG2B,CAAA;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAGa,aAAa,CACxB,MAAM,SAAS,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC7D,YAAW,cAAc,CAAC,MAAM,CAAC;IAUrB,OAAO,CAAC,MAAM;IAT1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAErB;IAEF;;;;OAIG;gBACiB,MAAM,GAAE,MAAqB;IAEjD;;;;OAIG;IACH,SAAS,IAAI,MAAM;IAInB;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAC,GAAG,SAAS,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IA0BtE;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,GAAG,SAAS,IAAI,CAAC,MAAM,CAAC,EACnC,GAAG,EAAE,GAAG,EACR,YAAY,EAAE,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,GACnC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC;IAKzB;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,GAAG,SAAS,IAAI,CAAC,MAAM,CAAC,EACjC,GAAG,EAAE,GAAG,EACR,YAAY,CAAC,EAAE,MAAM,GACpB,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC;CAa1B"}
@@ -1,6 +0,0 @@
1
- export * from './utils/index.mjs';
2
- export * from './config.provider.mjs';
3
- export * from './config.service.mjs';
4
- export * from './config-service.interface.mjs';
5
- export * from './types.mjs';
6
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["index.mts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,aAAa,CAAA"}
@@ -1,13 +0,0 @@
1
- /**
2
- * Evaluates to `true` if `T` is `any`. `false` otherwise.
3
- * (c) https://stackoverflow.com/a/68633327/5290447
4
- */
5
- type IsAny<T> = unknown extends T ? [keyof T] extends [never] ? false : true : false;
6
- type ExcludedParts = 'services' | 'mailer' | 'aws' | 'computedTimeRates' | 'aiModelsRates';
7
- type ExcludedKeys = 'computedTimeRates' | 'aiModelsRates' | 'aiModel';
8
- export type PathImpl<T, Key extends keyof T> = Key extends string ? Key extends ExcludedKeys ? never : IsAny<T[Key]> extends true ? never : T[Key] extends string ? never : T[Key] extends any[] ? never : T[Key] extends Record<string, any> ? Key extends ExcludedParts ? `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
9
- export type PathImpl2<T> = PathImpl<T, keyof T> | keyof T;
10
- export type Path<T> = keyof T extends string ? PathImpl2<T> extends infer P ? P extends string | keyof T ? P : keyof T : keyof T : never;
11
- export 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;
12
-
13
- //# sourceMappingURL=types.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["types.mts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,KAAK,KAAK,CAAC,CAAC,IAAI,OAAO,SAAS,CAAC,GAC7B,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GACvB,KAAK,GACL,IAAI,GACN,KAAK,CAAA;AAET,KAAK,aAAa,GACd,UAAU,GACV,QAAQ,GACR,KAAK,GACL,mBAAmB,GACnB,eAAe,CAAA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M,MAAM,SAAS,CACnB,CAAC,EACD,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,IACf,CAAC,SAAS,GAAG,MAAM,GAAG,IAAI,MAAM,IAAI,EAAE,GACtC,GAAG,SAAS,MAAM,CAAC,GACjB,IAAI,SAAS,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GACvB,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GACvB,KAAK,GACP,KAAK,GACP,CAAC,SAAS,MAAM,CAAC,GACf,CAAC,CAAC,CAAC,CAAC,GACJ,KAAK,CAAA"}
@@ -1,3 +0,0 @@
1
- export declare function envInt(key: keyof NodeJS.ProcessEnv, defaultValue: number): number;
2
- export 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;
3
- //# sourceMappingURL=helpers.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.d.mts","sourceRoot":"","sources":["helpers.mts"],"names":[],"mappings":"AAEA,wBAAgB,MAAM,CACpB,GAAG,EAAE,MAAM,MAAM,CAAC,UAAU,EAC5B,YAAY,EAAE,MAAM,GACnB,MAAM,CAIR;AAED,wBAAgB,SAAS,CACvB,YAAY,SAAS,MAAM,GAAG,SAAS,EACvC,OAAO,GAAG,YAAY,SAAS,MAAM,GAAG,IAAI,GAAG,KAAK,EAEpD,GAAG,EAAE,MAAM,MAAM,CAAC,UAAU,EAC5B,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,SAAS,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAKpD"}
@@ -1,2 +0,0 @@
1
- export * from './helpers.mjs';
2
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["index.mts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
@@ -1,33 +0,0 @@
1
- import type { ClassType } from '@navios/di';
2
- /**
3
- * Options for configuring a Navios controller.
4
- */
5
- export interface ControllerOptions {
6
- /**
7
- * Guards to apply to all endpoints in this controller.
8
- * Guards are executed in reverse order (last guard first).
9
- */
10
- guards?: ClassType[] | Set<ClassType>;
11
- }
12
- /**
13
- * Decorator that marks a class as a Navios controller.
14
- *
15
- * Controllers handle HTTP requests and define endpoints.
16
- * They are request-scoped by default, meaning a new instance is created for each request.
17
- *
18
- * @param options - Controller configuration options
19
- * @returns A class decorator
20
- *
21
- * @example
22
- * ```typescript
23
- * @Controller({ guards: [AuthGuard] })
24
- * export class UserController {
25
- * @Endpoint(getUserEndpoint)
26
- * async getUser(request: EndpointParams<typeof getUserEndpoint>) {
27
- * // Handle request
28
- * }
29
- * }
30
- * ```
31
- */
32
- export declare function Controller({ guards }?: ControllerOptions): (target: ClassType, context: ClassDecoratorContext) => ClassType;
33
- //# sourceMappingURL=controller.decorator.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"controller.decorator.d.mts","sourceRoot":"","sources":["controller.decorator.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAM3C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;CACtC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,GAAE,iBAAsB,IAC1C,QAAQ,SAAS,EAAE,SAAS,qBAAqB,eAoBnE"}
@@ -1,89 +0,0 @@
1
- import type { BaseEndpointConfig, EndpointFunctionArgs, HttpMethod, Util_FlatObject } from '@navios/builder';
2
- import type { z, ZodType } from 'zod/v4';
3
- import { ZodDiscriminatedUnion } from 'zod/v4';
4
- /**
5
- * Extracts the typed parameters for an endpoint handler function.
6
- *
7
- * This utility type extracts URL parameters, query parameters, and request body
8
- * from an endpoint declaration and flattens them into a single object.
9
- *
10
- * @typeParam EndpointDeclaration - The endpoint declaration from @navios/builder
11
- *
12
- * @example
13
- * ```typescript
14
- * const getUserEndpoint = api.declareEndpoint({
15
- * method: 'get',
16
- * url: '/users/$userId',
17
- * querySchema: z.object({ include: z.string().optional() }),
18
- * responseSchema: z.object({ id: z.string(), name: z.string() }),
19
- * })
20
- *
21
- * @Endpoint(getUserEndpoint)
22
- * async getUser(request: EndpointParams<typeof getUserEndpoint>) {
23
- * // request.urlParams.userId is typed as string
24
- * // request.query.include is typed as string | undefined
25
- * }
26
- * ```
27
- */
28
- export type EndpointParams<EndpointDeclaration extends {
29
- config: BaseEndpointConfig<any, any, any, any, any>;
30
- }, 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>>;
31
- /**
32
- * Extracts the typed return value for an endpoint handler function.
33
- *
34
- * This utility type extracts the response schema from an endpoint declaration
35
- * and returns the appropriate Promise type.
36
- *
37
- * @typeParam EndpointDeclaration - The endpoint declaration from @navios/builder
38
- *
39
- * @example
40
- * ```typescript
41
- * const getUserEndpoint = api.declareEndpoint({
42
- * method: 'get',
43
- * url: '/users/$userId',
44
- * responseSchema: z.object({ id: z.string(), name: z.string() }),
45
- * })
46
- *
47
- * @Endpoint(getUserEndpoint)
48
- * async getUser(request: EndpointParams<typeof getUserEndpoint>): EndpointResult<typeof getUserEndpoint> {
49
- * return { id: '1', name: 'John' } // Type-checked against responseSchema
50
- * }
51
- * ```
52
- */
53
- export type EndpointResult<EndpointDeclaration extends {
54
- config: BaseEndpointConfig<any, any, any, any, any>;
55
- }> = EndpointDeclaration['config']['responseSchema'] extends ZodDiscriminatedUnion<infer Options> ? Promise<z.input<Options[number]>> : Promise<z.input<EndpointDeclaration['config']['responseSchema']>>;
56
- /**
57
- * Decorator that marks a method as an HTTP endpoint.
58
- *
59
- * The endpoint must be defined using @navios/builder's `declareEndpoint` method.
60
- * This ensures type safety and consistency between client and server.
61
- *
62
- * @param endpoint - The endpoint declaration from @navios/builder
63
- * @returns A method decorator
64
- *
65
- * @example
66
- * ```typescript
67
- * import { builder } from '@navios/builder'
68
- *
69
- * const api = builder()
70
- * const getUserEndpoint = api.declareEndpoint({
71
- * method: 'get',
72
- * url: '/users/$userId',
73
- * responseSchema: z.object({ id: z.string(), name: z.string() }),
74
- * })
75
- *
76
- * @Controller()
77
- * export class UserController {
78
- * @Endpoint(getUserEndpoint)
79
- * async getUser(request: EndpointParams<typeof getUserEndpoint>) {
80
- * const { userId } = request.urlParams
81
- * return { id: userId, name: 'John' }
82
- * }
83
- * }
84
- * ```
85
- */
86
- export declare function Endpoint<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, ResponseSchema extends ZodType = ZodType, RequestSchema = ZodType>(endpoint: {
87
- config: BaseEndpointConfig<Method, Url, QuerySchema, ResponseSchema, RequestSchema>;
88
- }): (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.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.input<ResponseSchema>>;
89
- //# sourceMappingURL=endpoint.decorator.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"endpoint.decorator.d.mts","sourceRoot":"","sources":["endpoint.decorator.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,EACV,eAAe,EAChB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAExC,OAAO,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAA;AAK9C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,cAAc,CACxB,mBAAmB,SAAS;IAC1B,MAAM,EAAE,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;CACpD,EACD,GAAG,SAAS,MAAM,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,EACzD,WAAW,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC,IACxD,WAAW,SAAS,OAAO,GAC3B,mBAAmB,CAAC,QAAQ,CAAC,CAAC,eAAe,CAAC,SAAS,OAAO,GAC5D,eAAe,CACb,oBAAoB,CAClB,GAAG,EACH,WAAW,EACX,mBAAmB,CAAC,QAAQ,CAAC,CAAC,eAAe,CAAC,EAC9C,IAAI,CACL,CACF,GACD,eAAe,CAAC,oBAAoB,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,GAC1E,mBAAmB,CAAC,QAAQ,CAAC,CAAC,eAAe,CAAC,SAAS,OAAO,GAC5D,eAAe,CACb,oBAAoB,CAClB,GAAG,EACH,SAAS,EACT,mBAAmB,CAAC,QAAQ,CAAC,CAAC,eAAe,CAAC,EAC9C,IAA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AAC,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,KACxD,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,EACrC,SAAS,2BAA2B,cAR1B,WAAW,SAAS,OAAO,GAC/B,aAAa,SAAS,OAAO,GAC3B,oBAAoB,CAAC,GAAG,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,CAAC,GAC3D,oBAAoB,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,CAAC,GACzD,aAAa,SAAS,OAAO,GAC3B,oBAAoB,CAAC,GAAG,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,CAAC,GACzD,oBAAoB,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,KACxD,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CA4BxC"}
@@ -1,22 +0,0 @@
1
- import type { HttpHeader } from '../interfaces/index.mjs';
2
- /**
3
- * Decorator that sets a custom HTTP response header for an endpoint.
4
- *
5
- * @param name - The header name (e.g., 'Content-Type', 'Cache-Control')
6
- * @param value - The header value (string, number, or array of strings)
7
- * @returns A method decorator
8
- *
9
- * @example
10
- * ```typescript
11
- * @Controller()
12
- * export class UserController {
13
- * @Endpoint(getUserEndpoint)
14
- * @Header('Cache-Control', 'max-age=3600')
15
- * async getUser() {
16
- * return { id: '1', name: 'John' }
17
- * }
18
- * }
19
- * ```
20
- */
21
- export declare function Header(name: HttpHeader, value: string | number | string[]): <T extends Function>(target: T, context: ClassMethodDecoratorContext) => T;
22
- //# sourceMappingURL=header.decorator.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"header.decorator.d.mts","sourceRoot":"","sources":["header.decorator.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAIzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAChE,CAAC,SAAS,QAAQ,EACxB,QAAQ,CAAC,EACT,SAAS,2BAA2B,OAWvC"}
@@ -1,22 +0,0 @@
1
- /**
2
- * Decorator that sets a custom HTTP status code for successful responses.
3
- *
4
- * By default, endpoints return 200 OK. Use this decorator to return a different status code.
5
- *
6
- * @param code - The HTTP status code to return (e.g., 201, 204, 202)
7
- * @returns A method decorator
8
- *
9
- * @example
10
- * ```typescript
11
- * @Controller()
12
- * export class UserController {
13
- * @Endpoint(createUserEndpoint)
14
- * @HttpCode(201)
15
- * async createUser() {
16
- * return { id: '1', name: 'John' }
17
- * }
18
- * }
19
- * ```
20
- */
21
- export declare function HttpCode(code: number): <T extends Function>(target: T, context: ClassMethodDecoratorContext) => T;
22
- //# sourceMappingURL=http-code.decorator.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"http-code.decorator.d.mts","sourceRoot":"","sources":["http-code.decorator.mts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,IAC3B,CAAC,SAAS,QAAQ,EACxB,QAAQ,CAAC,EACT,SAAS,2BAA2B,OAYvC"}
@@ -1,9 +0,0 @@
1
- export * from './controller.decorator.mjs';
2
- export * from './endpoint.decorator.mjs';
3
- export * from './header.decorator.mjs';
4
- export * from './http-code.decorator.mjs';
5
- export * from './module.decorator.mjs';
6
- export * from './multipart.decorator.mjs';
7
- export * from './stream.decorator.mjs';
8
- export * from './use-guards.decorator.mjs';
9
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["index.mts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,4BAA4B,CAAA"}