@navios/core 0.7.1 → 0.9.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 (68) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/lib/{index-DW9EPAE6.d.mts → index-D9MNh6Tx.d.mts} +534 -342
  3. package/lib/index-D9MNh6Tx.d.mts.map +1 -0
  4. package/lib/{index-pHp-dIGt.d.cts → index-Db1d3cwD.d.cts} +534 -342
  5. package/lib/index-Db1d3cwD.d.cts.map +1 -0
  6. package/lib/index.cjs +12 -3
  7. package/lib/index.d.cts +2 -2
  8. package/lib/index.d.mts +2 -2
  9. package/lib/index.mjs +3 -3
  10. package/lib/legacy-compat/index.cjs +1 -1
  11. package/lib/legacy-compat/index.cjs.map +1 -1
  12. package/lib/legacy-compat/index.d.cts +3 -3
  13. package/lib/legacy-compat/index.d.cts.map +1 -1
  14. package/lib/legacy-compat/index.d.mts +3 -3
  15. package/lib/legacy-compat/index.d.mts.map +1 -1
  16. package/lib/legacy-compat/index.mjs +1 -1
  17. package/lib/legacy-compat/index.mjs.map +1 -1
  18. package/lib/{src-QnxR5b7c.cjs → src-BRPtJ9fG.cjs} +474 -53
  19. package/lib/src-BRPtJ9fG.cjs.map +1 -0
  20. package/lib/{src-DyvCDuKO.mjs → src-Bo23RIo-.mjs} +454 -51
  21. package/lib/src-Bo23RIo-.mjs.map +1 -0
  22. package/lib/testing/index.cjs +346 -29
  23. package/lib/testing/index.cjs.map +1 -1
  24. package/lib/testing/index.d.cts +299 -63
  25. package/lib/testing/index.d.cts.map +1 -1
  26. package/lib/testing/index.d.mts +299 -63
  27. package/lib/testing/index.d.mts.map +1 -1
  28. package/lib/testing/index.mjs +347 -31
  29. package/lib/testing/index.mjs.map +1 -1
  30. package/lib/{use-guards.decorator-B6q_N0sf.cjs → use-guards.decorator-Bs8oDHOi.cjs} +29 -99
  31. package/lib/use-guards.decorator-Bs8oDHOi.cjs.map +1 -0
  32. package/lib/{use-guards.decorator-kZ3lNK8v.mjs → use-guards.decorator-CzVXuLkz.mjs} +23 -99
  33. package/lib/use-guards.decorator-CzVXuLkz.mjs.map +1 -0
  34. package/package.json +4 -4
  35. package/src/__tests__/controller-resolver.spec.mts +229 -0
  36. package/src/__tests__/controller.spec.mts +1 -1
  37. package/src/__tests__/testing-module.spec.mts +459 -0
  38. package/src/__tests__/unit-testing-module.spec.mts +424 -0
  39. package/src/decorators/controller.decorator.mts +29 -7
  40. package/src/decorators/endpoint.decorator.mts +60 -12
  41. package/src/decorators/module.decorator.mts +23 -5
  42. package/src/decorators/multipart.decorator.mts +67 -24
  43. package/src/decorators/stream.decorator.mts +65 -24
  44. package/src/interfaces/abstract-http-handler-adapter.interface.mts +31 -1
  45. package/src/legacy-compat/__type-tests__/legacy-decorators.spec-d.mts +2 -6
  46. package/src/legacy-compat/decorators/endpoint.decorator.mts +1 -1
  47. package/src/legacy-compat/decorators/multipart.decorator.mts +5 -5
  48. package/src/legacy-compat/decorators/stream.decorator.mts +5 -5
  49. package/src/logger/logger.service.mts +0 -2
  50. package/src/navios.application.mts +23 -9
  51. package/src/navios.environment.mts +3 -1
  52. package/src/navios.factory.mts +19 -18
  53. package/src/services/guard-runner.service.mts +46 -9
  54. package/src/services/index.mts +1 -0
  55. package/src/services/instance-resolver.service.mts +187 -0
  56. package/src/services/module-loader.service.mts +3 -2
  57. package/src/stores/request-id.store.mts +45 -3
  58. package/src/testing/index.mts +1 -0
  59. package/src/testing/testing-module.mts +255 -93
  60. package/src/testing/unit-testing-module.mts +298 -0
  61. package/src/tokens/index.mts +1 -0
  62. package/src/tokens/navios-options.token.mts +6 -0
  63. package/lib/index-DW9EPAE6.d.mts.map +0 -1
  64. package/lib/index-pHp-dIGt.d.cts.map +0 -1
  65. package/lib/src-DyvCDuKO.mjs.map +0 -1
  66. package/lib/src-QnxR5b7c.cjs.map +0 -1
  67. package/lib/use-guards.decorator-B6q_N0sf.cjs.map +0 -1
  68. package/lib/use-guards.decorator-kZ3lNK8v.mjs.map +0 -1
@@ -1,9 +1,8 @@
1
1
  import * as _navios_di0 from "@navios/di";
2
- import { AnyInjectableType, ClassType, ClassTypeWithInstance, Container, FactoryContext, FactoryInjectionToken, InjectionToken, ScopedContainer } from "@navios/di";
2
+ import { AnyInjectableType, ClassType, ClassTypeWithInstance, Container, FactoryContext, FactoryInjectionToken, InjectableScope, InjectionToken, Registry, ScopedContainer } from "@navios/di";
3
3
  import z, { ZodDiscriminatedUnion, ZodObject, ZodType, z as z$1 } from "zod/v4";
4
4
  import { BaseEndpointConfig, BaseStreamConfig, EndpointFunctionArgs, HttpMethod, Util_FlatObject } from "@navios/builder";
5
5
  import { InspectOptions } from "util";
6
- import { AsyncLocalStorage } from "node:async_hooks";
7
6
  import { OutgoingHttpHeaders } from "http";
8
7
 
9
8
  //#region src/config/utils/helpers.d.mts
@@ -220,6 +219,21 @@ interface ControllerOptions {
220
219
  * Guards are executed in reverse order (last guard first).
221
220
  */
222
221
  guards?: ClassType[] | Set<ClassType>;
222
+ /**
223
+ * Registry to use for the controller.
224
+ * Registry is used to store the controller and its endpoints.
225
+ */
226
+ registry?: Registry;
227
+ /**
228
+ * Priority to use for the controller.
229
+ * Priority is used to sort the controller in the registry.
230
+ */
231
+ priority?: number;
232
+ /**
233
+ * Scope to use for the controller.
234
+ * Scope is used to determine the scope of the controller.
235
+ */
236
+ scope?: InjectableScope;
223
237
  }
224
238
  /**
225
239
  * Decorator that marks a class as a Navios controller.
@@ -242,7 +256,10 @@ interface ControllerOptions {
242
256
  * ```
243
257
  */
244
258
  declare function Controller({
245
- guards
259
+ guards,
260
+ registry,
261
+ priority,
262
+ scope
246
263
  }?: ControllerOptions): (target: ClassType, context: ClassDecoratorContext) => ClassType;
247
264
  //#endregion
248
265
  //#region src/decorators/endpoint.decorator.d.mts
@@ -328,9 +345,12 @@ type EndpointResult<EndpointDeclaration extends {
328
345
  * }
329
346
  * ```
330
347
  */
348
+ declare function Endpoint<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, ResponseSchema extends ZodType = ZodType, RequestSchema = ZodType, 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>)>(endpoint: {
349
+ config: BaseEndpointConfig<Method, Url, QuerySchema, ResponseSchema, RequestSchema>;
350
+ }): (target: (params: Params) => Promise<z$1.input<ResponseSchema>> | z$1.input<ResponseSchema>, context: ClassMethodDecoratorContext) => void;
331
351
  declare function Endpoint<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, ResponseSchema extends ZodType = ZodType, RequestSchema = ZodType>(endpoint: {
332
352
  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>>;
353
+ }): (target: () => Promise<z$1.input<ResponseSchema>> | z$1.input<ResponseSchema>, context: ClassMethodDecoratorContext) => void;
334
354
  //#endregion
335
355
  //#region src/metadata/handler.metadata.d.mts
336
356
  declare const EndpointMetadataKey: unique symbol;
@@ -914,9 +934,30 @@ interface AbstractHttpAdapterInterface<ServerInstance, CorsOptions = AbstractHtt
914
934
  }
915
935
  //#endregion
916
936
  //#region src/interfaces/abstract-http-handler-adapter.interface.d.mts
937
+ /**
938
+ * Static handler result - handler can be called without a scoped container.
939
+ * Used when the controller and all its dependencies are singletons.
940
+ */
941
+ type StaticHandler<TRequest = any, TReply = any> = {
942
+ isStatic: true;
943
+ handler: (request: TRequest, reply: TReply) => Promise<any>;
944
+ };
945
+ /**
946
+ * Dynamic handler result - handler requires a scoped container for resolution.
947
+ * Used when the controller or its dependencies need per-request resolution.
948
+ */
949
+ type DynamicHandler<TRequest = any, TReply = any> = {
950
+ isStatic: false;
951
+ handler: (scoped: ScopedContainer, request: TRequest, reply: TReply) => Promise<any>;
952
+ };
953
+ /**
954
+ * Handler result returned by provideHandler.
955
+ * Can be either static (pre-resolved) or dynamic (needs scoped container).
956
+ */
957
+ type HandlerResult<TRequest = any, TReply = any> = StaticHandler<TRequest, TReply> | DynamicHandler<TRequest, TReply>;
917
958
  interface AbstractHttpHandlerAdapterInterface {
918
959
  prepareArguments?: (handlerMetadata: HandlerMetadata<any>) => ((target: Record<string, any>, request: any) => Promise<void> | void)[];
919
- provideHandler: (controller: ClassType, handlerMetadata: HandlerMetadata<any>) => (context: ScopedContainer, request: any, reply: any) => Promise<any>;
960
+ provideHandler: (controller: ClassType, handlerMetadata: HandlerMetadata<any>) => Promise<HandlerResult>;
920
961
  }
921
962
  //#endregion
922
963
  //#region src/interfaces/can-activate.d.mts
@@ -1212,6 +1253,16 @@ interface ModuleOptions {
1212
1253
  * Guards are executed in reverse order (last guard first).
1213
1254
  */
1214
1255
  guards?: ClassType[] | Set<ClassType>;
1256
+ /**
1257
+ * Priority to use for the module.
1258
+ * Priority is used to sort the module in the registry.
1259
+ */
1260
+ priority?: number;
1261
+ /**
1262
+ * Registry to use for the module.
1263
+ * Registry is used to store the module and its controllers.
1264
+ */
1265
+ registry?: Registry;
1215
1266
  }
1216
1267
  /**
1217
1268
  * Decorator that marks a class as a Navios module.
@@ -1235,7 +1286,9 @@ interface ModuleOptions {
1235
1286
  declare function Module({
1236
1287
  controllers,
1237
1288
  imports,
1238
- guards
1289
+ guards,
1290
+ priority,
1291
+ registry
1239
1292
  }?: ModuleOptions): (target: ClassType, context: ClassDecoratorContext) => ClassType;
1240
1293
  //#endregion
1241
1294
  //#region src/decorators/multipart.decorator.d.mts
@@ -1286,9 +1339,12 @@ type MultipartResult<EndpointDeclaration extends {
1286
1339
  * }
1287
1340
  * ```
1288
1341
  */
1342
+ declare function Multipart<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, ResponseSchema extends ZodType = ZodType, RequestSchema = ZodType, Params = (QuerySchema extends ZodObject ? 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>)>(endpoint: {
1343
+ config: BaseEndpointConfig<Method, Url, QuerySchema, ResponseSchema, RequestSchema>;
1344
+ }): (target: (params: Params) => Promise<z$1.input<ResponseSchema>> | z$1.input<ResponseSchema>, context: ClassMethodDecoratorContext) => void;
1289
1345
  declare function Multipart<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, ResponseSchema extends ZodType = ZodType, RequestSchema = ZodType>(endpoint: {
1290
1346
  config: BaseEndpointConfig<Method, Url, QuerySchema, ResponseSchema, RequestSchema>;
1291
- }): (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>>;
1347
+ }): (target: () => Promise<z$1.input<ResponseSchema>> | z$1.input<ResponseSchema>, context: ClassMethodDecoratorContext) => void;
1292
1348
  //#endregion
1293
1349
  //#region src/decorators/stream.decorator.d.mts
1294
1350
  /**
@@ -1327,9 +1383,15 @@ type StreamParams<EndpointDeclaration extends {
1327
1383
  * }
1328
1384
  * ```
1329
1385
  */
1386
+ declare function Stream<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, RequestSchema = ZodType, Params = (QuerySchema extends ZodObject ? 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>)>(endpoint: {
1387
+ config: BaseStreamConfig<Method, Url, QuerySchema, RequestSchema>;
1388
+ }): (target: (params: Params, reply: any) => any, context: ClassMethodDecoratorContext) => void;
1389
+ declare function Stream<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, RequestSchema = ZodType, Params = (QuerySchema extends ZodObject ? 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>)>(endpoint: {
1390
+ config: BaseStreamConfig<Method, Url, QuerySchema, RequestSchema>;
1391
+ }): (target: (params: Params) => any, context: ClassMethodDecoratorContext) => void;
1330
1392
  declare function Stream<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, RequestSchema = ZodType>(endpoint: {
1331
1393
  config: BaseStreamConfig<Method, Url, QuerySchema, RequestSchema>;
1332
- }): (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>;
1394
+ }): (target: () => any, context: ClassMethodDecoratorContext) => void;
1333
1395
  //#endregion
1334
1396
  //#region src/decorators/use-guards.decorator.d.mts
1335
1397
  /**
@@ -1569,37 +1631,153 @@ declare class ConflictException extends HttpException {
1569
1631
  constructor(message: string | object, error?: Error);
1570
1632
  }
1571
1633
  //#endregion
1634
+ //#region src/services/instance-resolver.service.d.mts
1635
+ /**
1636
+ * Result of instance resolution attempt.
1637
+ * Contains either a cached singleton instance or a resolver function
1638
+ * that can be used to get a fresh instance per request.
1639
+ */
1640
+ interface InstanceResolution<T = any> {
1641
+ /**
1642
+ * Whether the instance was successfully cached as a singleton.
1643
+ * If true, `instance` contains the cached instance.
1644
+ * If false, the class has request-scoped dependencies and
1645
+ * must be resolved per-request using `resolve()`.
1646
+ */
1647
+ cached: boolean;
1648
+ /**
1649
+ * The cached instance (only available if `cached` is true).
1650
+ */
1651
+ instance: T | null;
1652
+ /**
1653
+ * Resolves the instance from a scoped container.
1654
+ * Use this when `cached` is false to get a fresh instance per request.
1655
+ */
1656
+ resolve: (scoped: ScopedContainer) => Promise<T>;
1657
+ }
1658
+ /**
1659
+ * Result of resolving multiple instances.
1660
+ * Contains either all cached singleton instances or a resolver function.
1661
+ */
1662
+ interface MultiInstanceResolution<T = any> {
1663
+ /**
1664
+ * Whether ALL instances were successfully cached as singletons.
1665
+ * If true, `instances` contains all cached instances.
1666
+ * If false, at least one class has request-scoped dependencies.
1667
+ */
1668
+ cached: boolean;
1669
+ /**
1670
+ * The cached instances (only available if `cached` is true).
1671
+ * Order matches the input array order.
1672
+ */
1673
+ instances: T[] | null;
1674
+ /**
1675
+ * The original class types for dynamic resolution.
1676
+ */
1677
+ classTypes: ClassType[];
1678
+ /**
1679
+ * Resolves all instances from a scoped container.
1680
+ * Use this when `cached` is false to get fresh instances per request.
1681
+ */
1682
+ resolve: (scoped: ScopedContainer) => Promise<T[]>;
1683
+ }
1684
+ /**
1685
+ * Service responsible for resolving class instances with automatic scope detection.
1686
+ *
1687
+ * This service attempts to resolve classes as singletons from the root container.
1688
+ * If resolution fails (because the class has request-scoped dependencies),
1689
+ * it automatically updates the class's scope to Request and provides a
1690
+ * resolver function for per-request instantiation.
1691
+ *
1692
+ * This enables optimal performance:
1693
+ * - Classes without request-scoped deps stay as singletons (faster)
1694
+ * - Classes with request-scoped deps are automatically promoted to request scope
1695
+ *
1696
+ * @example
1697
+ * ```ts
1698
+ * const resolution = await instanceResolver.resolve(UserController)
1699
+ *
1700
+ * if (resolution.cached) {
1701
+ * // Use cached singleton
1702
+ * return resolution.instance.handleRequest(req)
1703
+ * } else {
1704
+ * // Resolve per request
1705
+ * const controller = await resolution.resolve(scopedContainer)
1706
+ * return controller.handleRequest(req)
1707
+ * }
1708
+ * ```
1709
+ */
1710
+ declare class InstanceResolverService {
1711
+ private container;
1712
+ /**
1713
+ * Attempts to resolve a class instance, automatically detecting if it needs
1714
+ * request scope based on its dependencies.
1715
+ *
1716
+ * @param classType - The class to resolve
1717
+ * @returns A resolution result containing either a cached instance or resolver function
1718
+ */
1719
+ resolve<T>(classType: ClassType): Promise<InstanceResolution<T>>;
1720
+ /**
1721
+ * Attempts to resolve multiple class instances, automatically detecting if any need
1722
+ * request scope based on their dependencies.
1723
+ *
1724
+ * Returns `cached: true` only if ALL classes can be resolved as singletons.
1725
+ * If any class has request-scoped dependencies, returns `cached: false`.
1726
+ *
1727
+ * @param classTypes - The classes to resolve
1728
+ * @returns A resolution result containing either all cached instances or resolver function
1729
+ */
1730
+ resolveMany<T>(classTypes: ClassType[]): Promise<MultiInstanceResolution<T>>;
1731
+ }
1732
+ /**
1733
+ * @deprecated Use InstanceResolverService instead
1734
+ */
1735
+ declare const ControllerResolverService: typeof InstanceResolverService;
1736
+ /**
1737
+ * @deprecated Use InstanceResolution instead
1738
+ */
1739
+ type ControllerResolution<T = any> = InstanceResolution<T>;
1740
+ //#endregion
1572
1741
  //#region src/services/guard-runner.service.d.mts
1573
1742
  declare class GuardRunnerService {
1574
1743
  private readonly logger;
1744
+ /**
1745
+ * Runs guards that need to be resolved from a scoped container.
1746
+ * Use this when guards have request-scoped dependencies.
1747
+ */
1575
1748
  runGuards(allGuards: Set<ClassTypeWithInstance<CanActivate> | InjectionToken<CanActivate, undefined>>, executionContext: AbstractExecutionContext, context: ScopedContainer): Promise<boolean>;
1749
+ /**
1750
+ * Runs pre-resolved guard instances.
1751
+ * Use this when all guards are singletons and have been pre-resolved at startup.
1752
+ */
1753
+ runGuardsStatic(guardInstances: CanActivate[], executionContext: AbstractExecutionContext): Promise<boolean>;
1754
+ /**
1755
+ * Shared guard execution logic.
1756
+ * Iterates through guard instances and calls canActivate on each.
1757
+ */
1758
+ private executeGuards;
1576
1759
  makeContext(moduleMetadata: ModuleMetadata, controllerMetadata: ControllerMetadata, endpoint: HandlerMetadata): Set<ClassTypeWithInstance<CanActivate> | InjectionToken<CanActivate, undefined>>;
1577
1760
  }
1578
1761
  //#endregion
1579
1762
  //#region src/stores/request-id.store.d.mts
1580
1763
  /**
1581
- * AsyncLocalStorage store for the current request ID.
1582
- *
1583
- * This allows logging and other services to access the current request ID
1584
- * without explicitly passing it through the call stack.
1585
- *
1586
- * @example
1587
- * ```typescript
1588
- * import { requestIdStore, runWithRequestId, getRequestId } from '@navios/core'
1764
+ * Generates a simple incremental request ID.
1765
+ * Much faster than crypto.randomUUID() and sufficient for request tracking.
1589
1766
  *
1590
- * // Run code with a request ID in context
1591
- * runWithRequestId('req-123', () => {
1592
- * // Inside this callback, getRequestId() returns 'req-123'
1593
- * logger.log('Processing request') // Will include request ID if logger is configured
1594
- * })
1767
+ * @returns A unique request ID string (e.g., "req-1", "req-2", ...)
1768
+ */
1769
+ declare function generateRequestId(): string;
1770
+ /**
1771
+ * Enables or disables request ID propagation.
1772
+ * Called by NaviosFactory based on the enableRequestId option.
1595
1773
  *
1596
- * // Get current request ID (returns undefined if not in a request context)
1597
- * const currentId = getRequestId()
1598
- * ```
1774
+ * @param enabled - Whether to enable request ID propagation
1599
1775
  */
1600
- declare const requestIdStore: AsyncLocalStorage<string>;
1776
+ declare function setRequestIdEnabled(enabled: boolean): void;
1601
1777
  /**
1602
1778
  * Runs a function with a request ID in the async local storage context.
1779
+ * If request ID propagation is disabled, the function is called directly
1780
+ * without AsyncLocalStorage overhead.
1603
1781
  *
1604
1782
  * @param requestId - The request ID to set for this context
1605
1783
  * @param fn - The function to run within this context
@@ -1626,345 +1804,128 @@ declare const HttpAdapterToken: InjectionToken<AbstractHttpAdapterInterface<any,
1626
1804
  //#region src/tokens/multipart-adapter.token.d.mts
1627
1805
  declare const MultipartAdapterToken: InjectionToken<AbstractHttpHandlerAdapterInterface, undefined, false>;
1628
1806
  //#endregion
1629
- //#region src/tokens/reply.token.d.mts
1630
- declare const Reply: InjectionToken<any, undefined, false>;
1631
- //#endregion
1632
- //#region src/tokens/request.token.d.mts
1633
- declare const Request: InjectionToken<any, undefined, false>;
1634
- //#endregion
1635
- //#region src/tokens/stream-adapter.token.d.mts
1636
- declare const StreamAdapterToken: InjectionToken<AbstractHttpHandlerAdapterInterface, undefined, false>;
1637
- //#endregion
1638
- //#region src/tokens/xml-stream-adapter.token.d.mts
1639
- declare const XmlStreamAdapterToken: InjectionToken<AbstractHttpHandlerAdapterInterface, undefined, false>;
1807
+ //#region src/navios.environment.d.mts
1808
+ interface NaviosEnvironmentOptions {
1809
+ httpTokens?: Map<InjectionToken<any, undefined>, AnyInjectableType>;
1810
+ }
1640
1811
  //#endregion
1641
- //#region src/attribute.factory.d.mts
1642
- /**
1643
- * Type for a class attribute decorator without a value.
1644
- *
1645
- * Attributes are custom metadata decorators that can be applied to modules,
1646
- * controllers, and endpoints.
1647
- */
1648
- type ClassAttribute = (() => <T>(target: T, context: ClassDecoratorContext | ClassMethodDecoratorContext) => T) & {
1649
- token: symbol;
1650
- };
1812
+ //#region src/navios.application.d.mts
1651
1813
  /**
1652
- * Type for a class attribute decorator with a validated value.
1653
- *
1654
- * @typeParam T - The Zod schema type for validation
1814
+ * Options for configuring the Navios application context.
1815
+ * These options control the application configuration.
1655
1816
  */
1656
- type ClassSchemaAttribute<T extends ZodType> = ((value: z$1.input<T>) => <T>(target: T, context: ClassDecoratorContext | ClassMethodDecoratorContext) => T) & {
1657
- token: symbol;
1658
- schema: ZodType;
1659
- };
1817
+ interface NaviosApplicationOptions {
1818
+ /**
1819
+ * Specifies the logger to use. Pass `false` to turn off logging.
1820
+ *
1821
+ * - `LoggerService` instance: Use a custom logger implementation
1822
+ * - `LogLevel[]`: Enable specific log levels (e.g., ['error', 'warn', 'log'])
1823
+ * - `false`: Disable logging completely
1824
+ */
1825
+ logger?: LoggerService | LogLevel[] | false;
1826
+ /**
1827
+ * Specifies a custom registry to use. Useful for testing.
1828
+ * If not provided, a new Registry will be created.
1829
+ */
1830
+ registry?: Registry;
1831
+ /**
1832
+ * Specifies a custom container to use. Useful for testing.
1833
+ * If not provided, a new Container will be created.
1834
+ */
1835
+ container?: Container;
1836
+ /**
1837
+ * HTTP adapter environment(s) to use for the application.
1838
+ * Can be a single adapter or an array of adapters.
1839
+ *
1840
+ * @example
1841
+ * ```typescript
1842
+ * adapter: defineFastifyEnvironment()
1843
+ * // or
1844
+ * adapter: [defineFastifyEnvironment(), defineBunEnvironment()]
1845
+ * ```
1846
+ */
1847
+ adapter: NaviosEnvironmentOptions | NaviosEnvironmentOptions[];
1848
+ /**
1849
+ * Whether to validate response schemas.
1850
+ * When `false`, response schema validation is skipped for better performance.
1851
+ * @default true
1852
+ */
1853
+ validateResponses?: boolean;
1854
+ /**
1855
+ * Whether to enable request ID propagation via AsyncLocalStorage.
1856
+ * When `true`, request IDs are available via `getRequestId()` throughout the request.
1857
+ * @default false
1858
+ */
1859
+ enableRequestId?: boolean;
1860
+ }
1660
1861
  /**
1661
- * Factory for creating custom attribute decorators.
1662
- *
1663
- * Attributes allow you to add custom metadata to modules, controllers, and endpoints.
1664
- * This is useful for cross-cutting concerns like rate limiting, caching, API versioning, etc.
1665
- *
1666
- * @example
1667
- * ```typescript
1668
- * // Create a simple boolean attribute
1669
- * const Public = AttributeFactory.createAttribute(Symbol.for('Public'))
1670
- *
1671
- * // Use it as a decorator
1672
- * @Controller()
1673
- * @Public()
1674
- * export class PublicController { }
1862
+ * Main application class for Navios.
1675
1863
  *
1676
- * // Check if attribute exists
1677
- * if (AttributeFactory.has(Public, controllerMetadata)) {
1678
- * // Skip authentication
1679
- * }
1680
- * ```
1864
+ * This class represents a Navios application instance and provides methods
1865
+ * for initializing, configuring, and managing the HTTP server.
1681
1866
  *
1682
1867
  * @example
1683
1868
  * ```typescript
1684
- * // Create an attribute with a validated value
1685
- * const RateLimit = AttributeFactory.createAttribute(
1686
- * Symbol.for('RateLimit'),
1687
- * z.object({ requests: z.number(), window: z.number() })
1688
- * )
1689
- *
1690
- * // Use it with a value
1691
- * @Endpoint(apiEndpoint)
1692
- * @RateLimit({ requests: 100, window: 60000 })
1693
- * async handler() { }
1869
+ * const app = await NaviosFactory.create(AppModule, {
1870
+ * adapter: defineFastifyEnvironment(),
1871
+ * })
1694
1872
  *
1695
- * // Get the value
1696
- * const limit = AttributeFactory.get(RateLimit, endpointMetadata)
1697
- * // limit is typed as { requests: number, window: number } | null
1873
+ * app.setGlobalPrefix('/api')
1874
+ * app.enableCors({ origin: ['http://localhost:3000'] })
1875
+ * await app.init()
1876
+ * await app.listen({ port: 3000, host: '0.0.0.0' })
1698
1877
  * ```
1699
1878
  */
1700
- declare class AttributeFactory {
1879
+ declare class NaviosApplication {
1880
+ private environment;
1881
+ private moduleLoader;
1882
+ private httpApplication;
1883
+ private logger;
1884
+ protected container: Container;
1885
+ private appModule;
1886
+ private options;
1887
+ private plugins;
1701
1888
  /**
1702
- * Creates a simple attribute decorator without a value.
1703
- *
1704
- * @param token - A unique symbol to identify this attribute
1705
- * @returns A decorator function that can be applied to classes or methods
1889
+ * Indicates whether the application has been initialized.
1890
+ * Set to `true` after `init()` completes successfully.
1891
+ */
1892
+ isInitialized: boolean;
1893
+ /**
1894
+ * Sets up the application with the provided module and options.
1895
+ * This is called automatically by NaviosFactory.create().
1706
1896
  *
1707
- * @example
1708
- * ```typescript
1709
- * const Public = AttributeFactory.createAttribute(Symbol.for('Public'))
1897
+ * @param appModule - The root application module
1898
+ * @param options - Application configuration options
1899
+ * @internal
1900
+ */
1901
+ setup(appModule: ClassTypeWithInstance<NaviosModule>, options?: NaviosApplicationOptions): Promise<void>;
1902
+ /**
1903
+ * Gets the dependency injection container used by this application.
1710
1904
  *
1711
- * @Public()
1712
- * @Controller()
1713
- * export class PublicController { }
1714
- * ```
1905
+ * @returns The Container instance
1715
1906
  */
1716
- static createAttribute(token: symbol): ClassAttribute;
1907
+ getContainer(): Container;
1717
1908
  /**
1718
- * Creates an attribute decorator with a validated value.
1909
+ * Registers a plugin to be initialized after modules are loaded.
1719
1910
  *
1720
- * @param token - A unique symbol to identify this attribute
1721
- * @param schema - A Zod schema to validate the attribute value
1722
- * @returns A decorator function that accepts a value and can be applied to classes or methods
1911
+ * Plugins are initialized in the order they are registered,
1912
+ * after all modules are loaded but before the server starts listening.
1913
+ *
1914
+ * @param definition - Plugin definition with options
1915
+ * @returns this for method chaining
1723
1916
  *
1724
1917
  * @example
1725
1918
  * ```typescript
1726
- * const RateLimit = AttributeFactory.createAttribute(
1727
- * Symbol.for('RateLimit'),
1728
- * z.object({ requests: z.number(), window: z.number() })
1729
- * )
1919
+ * import { defineOpenApiPlugin } from '@navios/openapi-fastify'
1730
1920
  *
1731
- * @RateLimit({ requests: 100, window: 60000 })
1732
- * @Endpoint(apiEndpoint)
1733
- * async handler() { }
1921
+ * app.usePlugin(defineOpenApiPlugin({
1922
+ * info: { title: 'My API', version: '1.0.0' },
1923
+ * }))
1734
1924
  * ```
1735
1925
  */
1736
- static createAttribute<T extends ZodType>(token: symbol, schema: T): ClassSchemaAttribute<T>;
1926
+ usePlugin<TOptions>(definition: PluginDefinition<TOptions>): this;
1737
1927
  /**
1738
- * Gets the value of an attribute from metadata.
1739
- *
1740
- * Returns `null` if the attribute is not present.
1741
- * For simple attributes (without values), returns `true` if present.
1742
- *
1743
- * @param attribute - The attribute decorator
1744
- * @param target - The metadata object (module, controller, or handler)
1745
- * @returns The attribute value, `true` for simple attributes, or `null` if not found
1746
- *
1747
- * @example
1748
- * ```typescript
1749
- * const isPublic = AttributeFactory.get(Public, controllerMetadata)
1750
- * // isPublic is true | null
1751
- *
1752
- * const rateLimit = AttributeFactory.get(RateLimit, endpointMetadata)
1753
- * // rateLimit is { requests: number, window: number } | null
1754
- * ```
1755
- */
1756
- static get(attribute: ClassAttribute, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): true | null;
1757
- static get<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): z$1.output<T> | null;
1758
- /**
1759
- * Gets all values of an attribute from metadata (useful when an attribute can appear multiple times).
1760
- *
1761
- * Returns `null` if the attribute is not present.
1762
- *
1763
- * @param attribute - The attribute decorator
1764
- * @param target - The metadata object (module, controller, or handler)
1765
- * @returns An array of attribute values, or `null` if not found
1766
- *
1767
- * @example
1768
- * ```typescript
1769
- * const tags = AttributeFactory.getAll(Tag, endpointMetadata)
1770
- * // tags is string[] | null
1771
- * ```
1772
- */
1773
- static getAll(attribute: ClassAttribute, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): Array<true> | null;
1774
- static getAll<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): Array<z$1.output<T>> | null;
1775
- /**
1776
- * Gets the last value of an attribute from an array of metadata objects.
1777
- *
1778
- * Searches from the end of the array backwards, useful for finding the most
1779
- * specific attribute value (e.g., endpoint-level overrides module-level).
1780
- *
1781
- * @param attribute - The attribute decorator
1782
- * @param target - An array of metadata objects (typically [module, controller, handler])
1783
- * @returns The last attribute value found, or `null` if not found
1784
- *
1785
- * @example
1786
- * ```typescript
1787
- * // Check attribute hierarchy: endpoint -> controller -> module
1788
- * const rateLimit = AttributeFactory.getLast(RateLimit, [
1789
- * moduleMetadata,
1790
- * controllerMetadata,
1791
- * endpointMetadata
1792
- * ])
1793
- * ```
1794
- */
1795
- static getLast(attribute: ClassAttribute, target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[]): true | null;
1796
- static getLast<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[]): z$1.output<T> | null;
1797
- /**
1798
- * Checks if an attribute is present on the metadata object.
1799
- *
1800
- * @param attribute - The attribute decorator
1801
- * @param target - The metadata object (module, controller, or handler)
1802
- * @returns `true` if the attribute is present, `false` otherwise
1803
- *
1804
- * @example
1805
- * ```typescript
1806
- * if (AttributeFactory.has(Public, controllerMetadata)) {
1807
- * // Skip authentication
1808
- * }
1809
- * ```
1810
- */
1811
- static has(attribute: ClassAttribute, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): boolean;
1812
- static has<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): boolean;
1813
- }
1814
- //#endregion
1815
- //#region src/factories/endpoint-adapter.factory.d.mts
1816
- declare class EndpointAdapterFactory {
1817
- private readonly environment;
1818
- create(ctx: FactoryContext): Promise<any>;
1819
- }
1820
- //#endregion
1821
- //#region src/factories/http-adapter.factory.d.mts
1822
- declare class HttpAdapterFactory {
1823
- private readonly environment;
1824
- create(ctx: FactoryContext): Promise<any>;
1825
- }
1826
- //#endregion
1827
- //#region src/factories/multipart-adapter.factory.d.mts
1828
- declare class MultipartAdapterFactory {
1829
- private readonly environment;
1830
- create(ctx: FactoryContext): Promise<any>;
1831
- }
1832
- //#endregion
1833
- //#region src/factories/request.factory.d.mts
1834
- declare class RequestFactory {
1835
- private readonly environment;
1836
- create(ctx: FactoryContext): Promise<any>;
1837
- }
1838
- //#endregion
1839
- //#region src/factories/reply.factory.d.mts
1840
- declare class ReplyFactory {
1841
- private readonly environment;
1842
- create(ctx: FactoryContext): Promise<any>;
1843
- }
1844
- //#endregion
1845
- //#region src/factories/stream-adapter.factory.d.mts
1846
- declare class StreamAdapterFactory {
1847
- private readonly environment;
1848
- create(ctx: FactoryContext): Promise<any>;
1849
- }
1850
- //#endregion
1851
- //#region src/factories/xml-stream-adapter.factory.d.mts
1852
- declare class XmlStreamAdapterFactory {
1853
- private readonly environment;
1854
- create(ctx: FactoryContext): Promise<any>;
1855
- }
1856
- //#endregion
1857
- //#region src/navios.environment.d.mts
1858
- interface NaviosEnvironmentOptions {
1859
- httpTokens?: Map<InjectionToken<any, undefined>, AnyInjectableType>;
1860
- }
1861
- //#endregion
1862
- //#region src/navios.application.d.mts
1863
- /**
1864
- * Options for configuring the Navios application context.
1865
- * These options control dependency injection and logging behavior.
1866
- */
1867
- interface NaviosApplicationContextOptions {
1868
- /**
1869
- * Specifies the logger to use. Pass `false` to turn off logging.
1870
- *
1871
- * - `LoggerService` instance: Use a custom logger implementation
1872
- * - `LogLevel[]`: Enable specific log levels (e.g., ['error', 'warn', 'log'])
1873
- * - `false`: Disable logging completely
1874
- */
1875
- logger?: LoggerService | LogLevel[] | false;
1876
- /**
1877
- * Specifies a custom container to use. Useful for testing.
1878
- * If not provided, a new Container will be created.
1879
- */
1880
- container?: Container;
1881
- }
1882
- /**
1883
- * Complete options for creating a Navios application.
1884
- * Extends NaviosApplicationContextOptions with adapter configuration.
1885
- */
1886
- interface NaviosApplicationOptions extends NaviosApplicationContextOptions {
1887
- /**
1888
- * HTTP adapter environment(s) to use for the application.
1889
- * Can be a single adapter or an array of adapters.
1890
- *
1891
- * @example
1892
- * ```typescript
1893
- * adapter: defineFastifyEnvironment()
1894
- * // or
1895
- * adapter: [defineFastifyEnvironment(), defineBunEnvironment()]
1896
- * ```
1897
- */
1898
- adapter: NaviosEnvironmentOptions | NaviosEnvironmentOptions[];
1899
- }
1900
- /**
1901
- * Main application class for Navios.
1902
- *
1903
- * This class represents a Navios application instance and provides methods
1904
- * for initializing, configuring, and managing the HTTP server.
1905
- *
1906
- * @example
1907
- * ```typescript
1908
- * const app = await NaviosFactory.create(AppModule, {
1909
- * adapter: defineFastifyEnvironment(),
1910
- * })
1911
- *
1912
- * app.setGlobalPrefix('/api')
1913
- * app.enableCors({ origin: ['http://localhost:3000'] })
1914
- * await app.init()
1915
- * await app.listen({ port: 3000, host: '0.0.0.0' })
1916
- * ```
1917
- */
1918
- declare class NaviosApplication {
1919
- private environment;
1920
- private moduleLoader;
1921
- private httpApplication;
1922
- private logger;
1923
- protected container: Container;
1924
- private appModule;
1925
- private options;
1926
- private plugins;
1927
- /**
1928
- * Indicates whether the application has been initialized.
1929
- * Set to `true` after `init()` completes successfully.
1930
- */
1931
- isInitialized: boolean;
1932
- /**
1933
- * Sets up the application with the provided module and options.
1934
- * This is called automatically by NaviosFactory.create().
1935
- *
1936
- * @param appModule - The root application module
1937
- * @param options - Application configuration options
1938
- * @internal
1939
- */
1940
- setup(appModule: ClassTypeWithInstance<NaviosModule>, options?: NaviosApplicationOptions): Promise<void>;
1941
- /**
1942
- * Gets the dependency injection container used by this application.
1943
- *
1944
- * @returns The Container instance
1945
- */
1946
- getContainer(): Container;
1947
- /**
1948
- * Registers a plugin to be initialized after modules are loaded.
1949
- *
1950
- * Plugins are initialized in the order they are registered,
1951
- * after all modules are loaded but before the server starts listening.
1952
- *
1953
- * @param definition - Plugin definition with options
1954
- * @returns this for method chaining
1955
- *
1956
- * @example
1957
- * ```typescript
1958
- * import { defineOpenApiPlugin } from '@navios/openapi-fastify'
1959
- *
1960
- * app.usePlugin(defineOpenApiPlugin({
1961
- * info: { title: 'My API', version: '1.0.0' },
1962
- * }))
1963
- * ```
1964
- */
1965
- usePlugin<TOptions>(definition: PluginDefinition<TOptions>): this;
1966
- /**
1967
- * Initializes the application.
1928
+ * Initializes the application.
1968
1929
  *
1969
1930
  * This method:
1970
1931
  * - Loads all modules and their dependencies
@@ -2087,6 +2048,237 @@ declare class NaviosApplication {
2087
2048
  close(): Promise<void>;
2088
2049
  }
2089
2050
  //#endregion
2051
+ //#region src/tokens/navios-options.token.d.mts
2052
+ declare const NaviosOptionsToken: InjectionToken<NaviosApplicationOptions, undefined, false>;
2053
+ //#endregion
2054
+ //#region src/tokens/reply.token.d.mts
2055
+ declare const Reply: InjectionToken<any, undefined, false>;
2056
+ //#endregion
2057
+ //#region src/tokens/request.token.d.mts
2058
+ declare const Request: InjectionToken<any, undefined, false>;
2059
+ //#endregion
2060
+ //#region src/tokens/stream-adapter.token.d.mts
2061
+ declare const StreamAdapterToken: InjectionToken<AbstractHttpHandlerAdapterInterface, undefined, false>;
2062
+ //#endregion
2063
+ //#region src/tokens/xml-stream-adapter.token.d.mts
2064
+ declare const XmlStreamAdapterToken: InjectionToken<AbstractHttpHandlerAdapterInterface, undefined, false>;
2065
+ //#endregion
2066
+ //#region src/attribute.factory.d.mts
2067
+ /**
2068
+ * Type for a class attribute decorator without a value.
2069
+ *
2070
+ * Attributes are custom metadata decorators that can be applied to modules,
2071
+ * controllers, and endpoints.
2072
+ */
2073
+ type ClassAttribute = (() => <T>(target: T, context: ClassDecoratorContext | ClassMethodDecoratorContext) => T) & {
2074
+ token: symbol;
2075
+ };
2076
+ /**
2077
+ * Type for a class attribute decorator with a validated value.
2078
+ *
2079
+ * @typeParam T - The Zod schema type for validation
2080
+ */
2081
+ type ClassSchemaAttribute<T extends ZodType> = ((value: z$1.input<T>) => <T>(target: T, context: ClassDecoratorContext | ClassMethodDecoratorContext) => T) & {
2082
+ token: symbol;
2083
+ schema: ZodType;
2084
+ };
2085
+ /**
2086
+ * Factory for creating custom attribute decorators.
2087
+ *
2088
+ * Attributes allow you to add custom metadata to modules, controllers, and endpoints.
2089
+ * This is useful for cross-cutting concerns like rate limiting, caching, API versioning, etc.
2090
+ *
2091
+ * @example
2092
+ * ```typescript
2093
+ * // Create a simple boolean attribute
2094
+ * const Public = AttributeFactory.createAttribute(Symbol.for('Public'))
2095
+ *
2096
+ * // Use it as a decorator
2097
+ * @Controller()
2098
+ * @Public()
2099
+ * export class PublicController { }
2100
+ *
2101
+ * // Check if attribute exists
2102
+ * if (AttributeFactory.has(Public, controllerMetadata)) {
2103
+ * // Skip authentication
2104
+ * }
2105
+ * ```
2106
+ *
2107
+ * @example
2108
+ * ```typescript
2109
+ * // Create an attribute with a validated value
2110
+ * const RateLimit = AttributeFactory.createAttribute(
2111
+ * Symbol.for('RateLimit'),
2112
+ * z.object({ requests: z.number(), window: z.number() })
2113
+ * )
2114
+ *
2115
+ * // Use it with a value
2116
+ * @Endpoint(apiEndpoint)
2117
+ * @RateLimit({ requests: 100, window: 60000 })
2118
+ * async handler() { }
2119
+ *
2120
+ * // Get the value
2121
+ * const limit = AttributeFactory.get(RateLimit, endpointMetadata)
2122
+ * // limit is typed as { requests: number, window: number } | null
2123
+ * ```
2124
+ */
2125
+ declare class AttributeFactory {
2126
+ /**
2127
+ * Creates a simple attribute decorator without a value.
2128
+ *
2129
+ * @param token - A unique symbol to identify this attribute
2130
+ * @returns A decorator function that can be applied to classes or methods
2131
+ *
2132
+ * @example
2133
+ * ```typescript
2134
+ * const Public = AttributeFactory.createAttribute(Symbol.for('Public'))
2135
+ *
2136
+ * @Public()
2137
+ * @Controller()
2138
+ * export class PublicController { }
2139
+ * ```
2140
+ */
2141
+ static createAttribute(token: symbol): ClassAttribute;
2142
+ /**
2143
+ * Creates an attribute decorator with a validated value.
2144
+ *
2145
+ * @param token - A unique symbol to identify this attribute
2146
+ * @param schema - A Zod schema to validate the attribute value
2147
+ * @returns A decorator function that accepts a value and can be applied to classes or methods
2148
+ *
2149
+ * @example
2150
+ * ```typescript
2151
+ * const RateLimit = AttributeFactory.createAttribute(
2152
+ * Symbol.for('RateLimit'),
2153
+ * z.object({ requests: z.number(), window: z.number() })
2154
+ * )
2155
+ *
2156
+ * @RateLimit({ requests: 100, window: 60000 })
2157
+ * @Endpoint(apiEndpoint)
2158
+ * async handler() { }
2159
+ * ```
2160
+ */
2161
+ static createAttribute<T extends ZodType>(token: symbol, schema: T): ClassSchemaAttribute<T>;
2162
+ /**
2163
+ * Gets the value of an attribute from metadata.
2164
+ *
2165
+ * Returns `null` if the attribute is not present.
2166
+ * For simple attributes (without values), returns `true` if present.
2167
+ *
2168
+ * @param attribute - The attribute decorator
2169
+ * @param target - The metadata object (module, controller, or handler)
2170
+ * @returns The attribute value, `true` for simple attributes, or `null` if not found
2171
+ *
2172
+ * @example
2173
+ * ```typescript
2174
+ * const isPublic = AttributeFactory.get(Public, controllerMetadata)
2175
+ * // isPublic is true | null
2176
+ *
2177
+ * const rateLimit = AttributeFactory.get(RateLimit, endpointMetadata)
2178
+ * // rateLimit is { requests: number, window: number } | null
2179
+ * ```
2180
+ */
2181
+ static get(attribute: ClassAttribute, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): true | null;
2182
+ static get<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): z$1.output<T> | null;
2183
+ /**
2184
+ * Gets all values of an attribute from metadata (useful when an attribute can appear multiple times).
2185
+ *
2186
+ * Returns `null` if the attribute is not present.
2187
+ *
2188
+ * @param attribute - The attribute decorator
2189
+ * @param target - The metadata object (module, controller, or handler)
2190
+ * @returns An array of attribute values, or `null` if not found
2191
+ *
2192
+ * @example
2193
+ * ```typescript
2194
+ * const tags = AttributeFactory.getAll(Tag, endpointMetadata)
2195
+ * // tags is string[] | null
2196
+ * ```
2197
+ */
2198
+ static getAll(attribute: ClassAttribute, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): Array<true> | null;
2199
+ static getAll<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): Array<z$1.output<T>> | null;
2200
+ /**
2201
+ * Gets the last value of an attribute from an array of metadata objects.
2202
+ *
2203
+ * Searches from the end of the array backwards, useful for finding the most
2204
+ * specific attribute value (e.g., endpoint-level overrides module-level).
2205
+ *
2206
+ * @param attribute - The attribute decorator
2207
+ * @param target - An array of metadata objects (typically [module, controller, handler])
2208
+ * @returns The last attribute value found, or `null` if not found
2209
+ *
2210
+ * @example
2211
+ * ```typescript
2212
+ * // Check attribute hierarchy: endpoint -> controller -> module
2213
+ * const rateLimit = AttributeFactory.getLast(RateLimit, [
2214
+ * moduleMetadata,
2215
+ * controllerMetadata,
2216
+ * endpointMetadata
2217
+ * ])
2218
+ * ```
2219
+ */
2220
+ static getLast(attribute: ClassAttribute, target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[]): true | null;
2221
+ static getLast<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[]): z$1.output<T> | null;
2222
+ /**
2223
+ * Checks if an attribute is present on the metadata object.
2224
+ *
2225
+ * @param attribute - The attribute decorator
2226
+ * @param target - The metadata object (module, controller, or handler)
2227
+ * @returns `true` if the attribute is present, `false` otherwise
2228
+ *
2229
+ * @example
2230
+ * ```typescript
2231
+ * if (AttributeFactory.has(Public, controllerMetadata)) {
2232
+ * // Skip authentication
2233
+ * }
2234
+ * ```
2235
+ */
2236
+ static has(attribute: ClassAttribute, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): boolean;
2237
+ static has<T extends ZodType>(attribute: ClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): boolean;
2238
+ }
2239
+ //#endregion
2240
+ //#region src/factories/endpoint-adapter.factory.d.mts
2241
+ declare class EndpointAdapterFactory {
2242
+ private readonly environment;
2243
+ create(ctx: FactoryContext): Promise<any>;
2244
+ }
2245
+ //#endregion
2246
+ //#region src/factories/http-adapter.factory.d.mts
2247
+ declare class HttpAdapterFactory {
2248
+ private readonly environment;
2249
+ create(ctx: FactoryContext): Promise<any>;
2250
+ }
2251
+ //#endregion
2252
+ //#region src/factories/multipart-adapter.factory.d.mts
2253
+ declare class MultipartAdapterFactory {
2254
+ private readonly environment;
2255
+ create(ctx: FactoryContext): Promise<any>;
2256
+ }
2257
+ //#endregion
2258
+ //#region src/factories/request.factory.d.mts
2259
+ declare class RequestFactory {
2260
+ private readonly environment;
2261
+ create(ctx: FactoryContext): Promise<any>;
2262
+ }
2263
+ //#endregion
2264
+ //#region src/factories/reply.factory.d.mts
2265
+ declare class ReplyFactory {
2266
+ private readonly environment;
2267
+ create(ctx: FactoryContext): Promise<any>;
2268
+ }
2269
+ //#endregion
2270
+ //#region src/factories/stream-adapter.factory.d.mts
2271
+ declare class StreamAdapterFactory {
2272
+ private readonly environment;
2273
+ create(ctx: FactoryContext): Promise<any>;
2274
+ }
2275
+ //#endregion
2276
+ //#region src/factories/xml-stream-adapter.factory.d.mts
2277
+ declare class XmlStreamAdapterFactory {
2278
+ private readonly environment;
2279
+ create(ctx: FactoryContext): Promise<any>;
2280
+ }
2281
+ //#endregion
2090
2282
  //#region src/navios.factory.d.mts
2091
2283
  /**
2092
2284
  * Factory class for creating and configuring Navios applications.
@@ -2152,5 +2344,5 @@ declare class NaviosFactory {
2152
2344
  private static registerLoggerConfiguration;
2153
2345
  }
2154
2346
  //#endregion
2155
- export { CanActivate as $, EnvConfigProvider as $t, NotFoundException as A, clc as At, MultipartResult as B, extractControllerMetadata as Bt, EndpointAdapterToken as C, normalizePath as Ct, GuardRunnerService as D, filterLogLevels as Dt, runWithRequestId as E, isLogLevel as Et, UseGuards as F, extractModuleMetadata as Ft, NaviosPlugin as G, getAllEndpointMetadata as Gt, ModuleOptions as H, hasControllerMetadata as Ht, Stream as I, getModuleMetadata as It, ModuleExtension as J, EndpointParams as Jt, PluginContext as K, getEndpointMetadata as Kt, StreamParams as L, hasModuleMetadata as Lt, ForbiddenException as M, AbstractExecutionContext as Mt, BadRequestException as N, ModuleMetadata as Nt, ConflictException as O, LOG_LEVELS as Ot, HttpException as P, ModuleMetadataKey as Pt, OmitIndexSignature as Q, ConfigProviderOptions as Qt, Multipart as R, ControllerMetadata as Rt, ExecutionContextInjectionToken as S, isUndefined as St, requestIdStore as T, isLogLevelEnabled as Tt, HttpCode as U, EndpointMetadataKey as Ut, Module as V, getControllerMetadata as Vt, Header as W, HandlerMetadata as Wt, NaviosModule as X, Controller as Xt, ModuleLoaderService as Y, EndpointResult as Yt, HttpHeader as Z, ControllerOptions as Zt, Request as _, isNumber as _t, XmlStreamAdapterFactory as a, ConfigServiceInterface as an, LoggerOptions as at, HttpAdapterToken as b, isString as bt, RequestFactory as c, PathImpl2 as cn, LoggerInstance as ct, EndpointAdapterFactory as d, envString as dn, LoggerService as dt, provideConfig as en, AbstractHttpHandlerAdapterInterface as et, AttributeFactory as f, addLeadingSlash as ft, StreamAdapterToken as g, isNil as gt, XmlStreamAdapterToken as h, isFunction as ht, NaviosApplicationOptions as i, ConfigServiceToken as in, Logger as it, InternalServerErrorException as j, yellow as jt, UnauthorizedException as k, LogLevel as kt, MultipartAdapterFactory as l, PathValue as ln, ConsoleLogger as lt, ClassSchemaAttribute as m, isEmpty as mt, NaviosApplication as n, ConfigServiceOptions as nn, AbstractHttpListenOptions as nt, StreamAdapterFactory as o, Path as on, LoggerOutput as ot, ClassAttribute as p, isConstructor as pt, PluginDefinition as q, Endpoint as qt, NaviosApplicationContextOptions as r, ConfigServiceOptionsSchema as rn, AbstractHttpCorsOptions as rt, ReplyFactory as s, PathImpl as sn, loggerOptionsSchema as st, NaviosFactory as t, ConfigService as tn, AbstractHttpAdapterInterface as tt, HttpAdapterFactory as u, envInt as un, ConsoleLoggerOptions as ut, Reply as v, isObject as vt, getRequestId as w, stripEndSlash as wt, ExecutionContext as x, isSymbol as xt, MultipartAdapterToken as y, isPlainObject as yt, MultipartParams as z, ControllerMetadataKey as zt };
2156
- //# sourceMappingURL=index-DW9EPAE6.d.mts.map
2347
+ export { PluginDefinition as $, HandlerMetadata as $t, ControllerResolverService as A, isSymbol as At, HttpException as B, yellow as Bt, EndpointAdapterToken as C, isEmpty as Ct, setRequestIdEnabled as D, isObject as Dt, runWithRequestId as E, isNumber as Et, UnauthorizedException as F, isLogLevel as Ft, MultipartParams as G, getModuleMetadata as Gt, Stream as H, ModuleMetadata as Ht, NotFoundException as I, filterLogLevels as It, ModuleOptions as J, ControllerMetadataKey as Jt, MultipartResult as K, hasModuleMetadata as Kt, InternalServerErrorException as L, LOG_LEVELS as Lt, InstanceResolverService as M, normalizePath as Mt, MultiInstanceResolution as N, stripEndSlash as Nt, GuardRunnerService as O, isPlainObject as Ot, ConflictException as P, isLogLevelEnabled as Pt, PluginContext as Q, EndpointMetadataKey as Qt, ForbiddenException as R, LogLevel as Rt, ExecutionContextInjectionToken as S, isConstructor as St, getRequestId as T, isNil as Tt, StreamParams as U, ModuleMetadataKey as Ut, UseGuards as V, AbstractExecutionContext as Vt, Multipart as W, extractModuleMetadata as Wt, Header as X, getControllerMetadata as Xt, HttpCode as Y, extractControllerMetadata as Yt, NaviosPlugin as Z, hasControllerMetadata as Zt, NaviosApplication as _, PathImpl2 as _n, LoggerInstance as _t, RequestFactory as a, Controller as an, CanActivate as at, HttpAdapterToken as b, envString as bn, LoggerService as bt, EndpointAdapterFactory as c, EnvConfigProvider as cn, HandlerResult as ct, ClassSchemaAttribute as d, ConfigServiceOptions as dn, AbstractHttpListenOptions as dt, getAllEndpointMetadata as en, ModuleExtension as et, XmlStreamAdapterToken as f, ConfigServiceOptionsSchema as fn, AbstractHttpCorsOptions as ft, NaviosOptionsToken as g, PathImpl as gn, loggerOptionsSchema as gt, Reply as h, Path as hn, LoggerOutput as ht, ReplyFactory as i, EndpointResult as in, OmitIndexSignature as it, InstanceResolution as j, isUndefined as jt, ControllerResolution as k, isString as kt, AttributeFactory as l, provideConfig as ln, StaticHandler as lt, Request as m, ConfigServiceInterface as mn, LoggerOptions as mt, XmlStreamAdapterFactory as n, Endpoint as nn, NaviosModule as nt, MultipartAdapterFactory as o, ControllerOptions as on, AbstractHttpHandlerAdapterInterface as ot, StreamAdapterToken as p, ConfigServiceToken as pn, Logger as pt, Module as q, ControllerMetadata as qt, StreamAdapterFactory as r, EndpointParams as rn, HttpHeader as rt, HttpAdapterFactory as s, ConfigProviderOptions as sn, DynamicHandler as st, NaviosFactory as t, getEndpointMetadata as tn, ModuleLoaderService as tt, ClassAttribute as u, ConfigService as un, AbstractHttpAdapterInterface as ut, NaviosApplicationOptions as v, PathValue as vn, ConsoleLogger as vt, generateRequestId as w, isFunction as wt, ExecutionContext as x, addLeadingSlash as xt, MultipartAdapterToken as y, envInt as yn, ConsoleLoggerOptions as yt, BadRequestException as z, clc as zt };
2348
+ //# sourceMappingURL=index-D9MNh6Tx.d.mts.map