@navios/commander 0.7.0 → 0.8.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.
package/lib/index.cjs CHANGED
@@ -32,27 +32,21 @@ var __copyProps = (to, from, except, desc) => {
32
32
  }
33
33
  return to;
34
34
  };
35
- var __reExport = (target, mod, secondTarget, symbols) => {
36
- if (symbols) {
37
- __defProp(target, Symbol.toStringTag, { value: "Module" });
38
- secondTarget && __defProp(secondTarget, Symbol.toStringTag, { value: "Module" });
39
- }
40
- __copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default");
41
- };
35
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
42
36
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
43
37
  value: mod,
44
38
  enumerable: true
45
39
  }) : target, mod));
46
40
 
47
41
  //#endregion
48
- let __navios_di = require("@navios/di");
42
+ let _navios_di = require("@navios/di");
49
43
  let node_process = require("node:process");
50
44
  let zod_v4 = require("zod/v4");
51
45
  zod_v4 = __toESM(zod_v4);
52
46
  let util = require("util");
53
47
  let node_async_hooks = require("node:async_hooks");
54
48
 
55
- //#region ../core/lib/use-guards.decorator-kZ3lNK8v.mjs
49
+ //#region ../core/lib/use-guards.decorator-CUww54Nt.mjs
56
50
  const EndpointMetadataKey = Symbol("EndpointMetadataKey");
57
51
  function getAllEndpointMetadata(context) {
58
52
  if (context.metadata) {
@@ -145,13 +139,13 @@ function hasModuleMetadata(target) {
145
139
  }
146
140
  /**
147
141
  * Decorator that marks a class as a Navios controller.
148
- *
142
+ *
149
143
  * Controllers handle HTTP requests and define endpoints.
150
144
  * They are request-scoped by default, meaning a new instance is created for each request.
151
- *
145
+ *
152
146
  * @param options - Controller configuration options
153
147
  * @returns A class decorator
154
- *
148
+ *
155
149
  * @example
156
150
  * ```typescript
157
151
  * @Controller({ guards: [AuthGuard] })
@@ -162,59 +156,31 @@ function hasModuleMetadata(target) {
162
156
  * }
163
157
  * }
164
158
  * ```
165
- */ function Controller({ guards } = {}) {
159
+ */ function Controller({ guards, registry } = {}) {
166
160
  return function(target, context) {
167
161
  if (context.kind !== "class") throw new Error("[Navios] @Controller decorator can only be used on classes.");
168
- const token = __navios_di.InjectionToken.create(target);
162
+ const token = _navios_di.InjectionToken.create(target);
169
163
  if (context.metadata) {
170
164
  const controllerMetadata = getControllerMetadata(target, context);
171
165
  if (guards) for (const guard of Array.from(guards).reverse()) controllerMetadata.guards.add(guard);
172
166
  }
173
- return (0, __navios_di.Injectable)({
167
+ return (0, _navios_di.Injectable)({
174
168
  token,
175
- scope: __navios_di.InjectableScope.Request
169
+ registry
176
170
  })(target, context);
177
171
  };
178
172
  }
179
- const EndpointAdapterToken = __navios_di.InjectionToken.create("EndpointAdapterToken");
173
+ const EndpointAdapterToken = _navios_di.InjectionToken.create("EndpointAdapterToken");
180
174
  const ExecutionContextInjectionToken = "ExecutionContextInjectionToken";
181
- const ExecutionContext = __navios_di.InjectionToken.create(ExecutionContextInjectionToken);
182
- const HttpAdapterToken = __navios_di.InjectionToken.create("HttpAdapterToken");
183
- const MultipartAdapterToken = __navios_di.InjectionToken.create("MultipartAdapterToken");
184
- const Reply = __navios_di.InjectionToken.create("ReplyToken");
185
- const Request = __navios_di.InjectionToken.create("RequestToken");
186
- const StreamAdapterToken = __navios_di.InjectionToken.create("StreamAdapterToken");
187
- const XmlStreamAdapterToken = __navios_di.InjectionToken.create("XmlStreamAdapterToken");
188
- /**
189
- * Decorator that marks a method as an HTTP endpoint.
190
- *
191
- * The endpoint must be defined using @navios/builder's `declareEndpoint` method.
192
- * This ensures type safety and consistency between client and server.
193
- *
194
- * @param endpoint - The endpoint declaration from @navios/builder
195
- * @returns A method decorator
196
- *
197
- * @example
198
- * ```typescript
199
- * import { builder } from '@navios/builder'
200
- *
201
- * const api = builder()
202
- * const getUserEndpoint = api.declareEndpoint({
203
- * method: 'get',
204
- * url: '/users/$userId',
205
- * responseSchema: z.object({ id: z.string(), name: z.string() }),
206
- * })
207
- *
208
- * @Controller()
209
- * export class UserController {
210
- * @Endpoint(getUserEndpoint)
211
- * async getUser(request: EndpointParams<typeof getUserEndpoint>) {
212
- * const { userId } = request.urlParams
213
- * return { id: userId, name: 'John' }
214
- * }
215
- * }
216
- * ```
217
- */ function Endpoint(endpoint) {
175
+ const ExecutionContext = _navios_di.InjectionToken.create(ExecutionContextInjectionToken);
176
+ const HttpAdapterToken = _navios_di.InjectionToken.create("HttpAdapterToken");
177
+ const MultipartAdapterToken = _navios_di.InjectionToken.create("MultipartAdapterToken");
178
+ const NaviosOptionsToken = _navios_di.InjectionToken.create("NaviosOptionsToken");
179
+ const Reply = _navios_di.InjectionToken.create("ReplyToken");
180
+ const Request = _navios_di.InjectionToken.create("RequestToken");
181
+ const StreamAdapterToken = _navios_di.InjectionToken.create("StreamAdapterToken");
182
+ const XmlStreamAdapterToken = _navios_di.InjectionToken.create("XmlStreamAdapterToken");
183
+ function Endpoint(endpoint) {
218
184
  return (target, context) => {
219
185
  if (context.kind !== "method") throw new Error("[Navios] Endpoint decorator can only be used on methods.");
220
186
  const config = endpoint.config;
@@ -308,48 +274,19 @@ const XmlStreamAdapterToken = __navios_di.InjectionToken.create("XmlStreamAdapte
308
274
  }) {
309
275
  return (target, context) => {
310
276
  if (context.kind !== "class") throw new Error("[Navios] @Module decorator can only be used on classes.");
311
- const token = __navios_di.InjectionToken.create(target);
277
+ const token = _navios_di.InjectionToken.create(target);
312
278
  const moduleMetadata = getModuleMetadata(target, context);
313
279
  for (const controller of controllers) moduleMetadata.controllers.add(controller);
314
280
  for (const importedModule of imports) moduleMetadata.imports.add(importedModule);
315
281
  for (const guard of Array.from(guards).reverse()) moduleMetadata.guards.add(guard);
316
- return (0, __navios_di.Injectable)({
282
+ return (0, _navios_di.Injectable)({
317
283
  token,
318
- scope: __navios_di.InjectableScope.Singleton
284
+ scope: _navios_di.InjectableScope.Singleton
319
285
  })(target, context);
320
286
  };
321
287
  }
322
- /**
323
- * Decorator that marks a method as a multipart/form-data endpoint.
324
- *
325
- * Use this decorator for endpoints that handle file uploads or form data.
326
- * The endpoint must be defined using @navios/builder's `declareMultipart` method.
327
- *
328
- * @param endpoint - The multipart endpoint declaration from @navios/builder
329
- * @returns A method decorator
330
- *
331
- * @example
332
- * ```typescript
333
- * const uploadFileEndpoint = api.declareMultipart({
334
- * method: 'post',
335
- * url: '/upload',
336
- * requestSchema: z.object({ file: z.instanceof(File) }),
337
- * responseSchema: z.object({ url: z.string() }),
338
- * })
339
- *
340
- * @Controller()
341
- * export class FileController {
342
- * @Multipart(uploadFileEndpoint)
343
- * async uploadFile(request: MultipartParams<typeof uploadFileEndpoint>) {
344
- * const { file } = request.data
345
- * // Handle file upload
346
- * return { url: 'https://example.com/file.jpg' }
347
- * }
348
- * }
349
- * ```
350
- */ function Multipart(endpoint) {
288
+ function Multipart(endpoint) {
351
289
  return (target, context) => {
352
- if (typeof target !== "function") throw new Error("[Navios] Endpoint decorator can only be used on functions.");
353
290
  if (context.kind !== "method") throw new Error("[Navios] Endpoint decorator can only be used on methods.");
354
291
  const config = endpoint.config;
355
292
  if (context.metadata) {
@@ -364,34 +301,8 @@ const XmlStreamAdapterToken = __navios_di.InjectionToken.create("XmlStreamAdapte
364
301
  return target;
365
302
  };
366
303
  }
367
- /**
368
- * Decorator that marks a method as a streaming endpoint.
369
- *
370
- * Use this decorator for endpoints that stream data (e.g., file downloads, SSE).
371
- * The endpoint must be defined using @navios/builder's `declareStream` method.
372
- *
373
- * @param endpoint - The stream endpoint declaration from @navios/builder
374
- * @returns A method decorator
375
- *
376
- * @example
377
- * ```typescript
378
- * const downloadFileEndpoint = api.declareStream({
379
- * method: 'get',
380
- * url: '/files/$fileId',
381
- * })
382
- *
383
- * @Controller()
384
- * export class FileController {
385
- * @Stream(downloadFileEndpoint)
386
- * async downloadFile(request: StreamParams<typeof downloadFileEndpoint>, reply: any) {
387
- * const { fileId } = request.urlParams
388
- * // Stream file data to reply
389
- * }
390
- * }
391
- * ```
392
- */ function Stream(endpoint) {
304
+ function Stream(endpoint) {
393
305
  return (target, context) => {
394
- if (typeof target !== "function") throw new Error("[Navios] Endpoint decorator can only be used on functions.");
395
306
  if (context.kind !== "method") throw new Error("[Navios] Endpoint decorator can only be used on methods.");
396
307
  const config = endpoint.config;
397
308
  if (context.metadata) {
@@ -474,7 +385,7 @@ const XmlStreamAdapterToken = __navios_di.InjectionToken.create("XmlStreamAdapte
474
385
  };
475
386
 
476
387
  //#endregion
477
- //#region ../core/lib/src-DzPY5s6d.mjs
388
+ //#region ../core/lib/src-gBAChVRL.mjs
478
389
  function envInt(key, defaultValue) {
479
390
  const envKey = node_process.env[key] || process.env[key];
480
391
  return envKey ? parseInt(envKey, 10) : defaultValue;
@@ -557,6 +468,15 @@ const isConstructor = (val) => val === "constructor";
557
468
  const isNil = (val) => isUndefined(val) || val === null;
558
469
  const isEmpty = (array) => !(array && array.length > 0);
559
470
  const isSymbol = (val) => typeof val === "symbol";
471
+ let requestCounter = 0;
472
+ /**
473
+ * Generates a simple incremental request ID.
474
+ * Much faster than crypto.randomUUID() and sufficient for request tracking.
475
+ *
476
+ * @returns A unique request ID string (e.g., "req-1", "req-2", ...)
477
+ */ function generateRequestId() {
478
+ return `req-${++requestCounter}`;
479
+ }
560
480
  /**
561
481
  * AsyncLocalStorage store for the current request ID.
562
482
  *
@@ -576,29 +496,49 @@ const isSymbol = (val) => typeof val === "symbol";
576
496
  * // Get current request ID (returns undefined if not in a request context)
577
497
  * const currentId = getRequestId()
578
498
  * ```
579
- */ const requestIdStore = new node_async_hooks.AsyncLocalStorage();
499
+ */ let requestIdStore = null;
500
+ function getRequestIdStore() {
501
+ if (!requestIdStore) requestIdStore = new node_async_hooks.AsyncLocalStorage();
502
+ return requestIdStore;
503
+ }
504
+ /**
505
+ * Whether request ID propagation is enabled.
506
+ * When disabled, runWithRequestId is a pass-through for better performance.
507
+ */ let requestIdEnabled = false;
508
+ /**
509
+ * Enables or disables request ID propagation.
510
+ * Called by NaviosFactory based on the enableRequestId option.
511
+ *
512
+ * @param enabled - Whether to enable request ID propagation
513
+ */ function setRequestIdEnabled(enabled) {
514
+ requestIdEnabled = enabled;
515
+ }
580
516
  /**
581
517
  * Runs a function with a request ID in the async local storage context.
518
+ * If request ID propagation is disabled, the function is called directly
519
+ * without AsyncLocalStorage overhead.
582
520
  *
583
521
  * @param requestId - The request ID to set for this context
584
522
  * @param fn - The function to run within this context
585
523
  * @returns The return value of the function
586
524
  */ function runWithRequestId(requestId, fn) {
587
- return requestIdStore.run(requestId, fn);
525
+ if (!requestIdEnabled) return fn();
526
+ return getRequestIdStore().run(requestId, fn);
588
527
  }
589
528
  /**
590
529
  * Gets the current request ID from the async local storage context.
591
530
  *
592
531
  * @returns The current request ID, or undefined if not in a request context
593
532
  */ function getRequestId() {
594
- return requestIdStore.getStore();
533
+ if (!requestIdEnabled) return;
534
+ return getRequestIdStore().getStore();
595
535
  }
596
536
  /**
597
537
  * Injection token for the logger output service.
598
538
  *
599
539
  * This token is used to provide a custom logger implementation.
600
540
  * By default, it's bound to ConsoleLogger.
601
- */ const LoggerOutput = __navios_di.InjectionToken.create("LoggerOutput");
541
+ */ const LoggerOutput = _navios_di.InjectionToken.create("LoggerOutput");
602
542
  /**
603
543
  * Schema for logger options.
604
544
  */ const loggerOptionsSchema = zod_v4.default.object({ context: zod_v4.default.string().optional() }).optional();
@@ -612,8 +552,8 @@ const isSymbol = (val) => typeof val === "symbol";
612
552
  * const logger = inject(Logger, { context: 'MyService' })
613
553
  * logger.log('Hello world') // Logs with context: [MyService]
614
554
  * ```
615
- */ const Logger = __navios_di.InjectionToken.create("Logger", loggerOptionsSchema);
616
- function applyDecs2203RFactory$13() {
555
+ */ const Logger = _navios_di.InjectionToken.create("Logger", loggerOptionsSchema);
556
+ function applyDecs2203RFactory$14() {
617
557
  function createAddInitializerMethod(initializers, decoratorFinishedRef) {
618
558
  return function addInitializer(initializer) {
619
559
  assertNotFinished(decoratorFinishedRef, "addInitializer");
@@ -887,10 +827,10 @@ function applyDecs2203RFactory$13() {
887
827
  };
888
828
  };
889
829
  }
890
- function _apply_decs_2203_r$13(targetClass, memberDecs, classDecs, parentClass) {
891
- return (_apply_decs_2203_r$13 = applyDecs2203RFactory$13())(targetClass, memberDecs, classDecs, parentClass);
830
+ function _apply_decs_2203_r$14(targetClass, memberDecs, classDecs, parentClass) {
831
+ return (_apply_decs_2203_r$14 = applyDecs2203RFactory$14())(targetClass, memberDecs, classDecs, parentClass);
892
832
  }
893
- var _dec$13, _initClass$13;
833
+ var _dec$14, _initClass$14;
894
834
  const DEFAULT_DEPTH = 5;
895
835
  const DEFAULT_LOG_LEVELS = [
896
836
  "log",
@@ -909,10 +849,10 @@ const dateTimeFormatter = new Intl.DateTimeFormat(void 0, {
909
849
  month: "2-digit"
910
850
  });
911
851
  let _ConsoleLogger;
912
- _dec$13 = (0, __navios_di.Injectable)({ token: LoggerOutput });
852
+ _dec$14 = (0, _navios_di.Injectable)({ token: LoggerOutput });
913
853
  (class {
914
854
  static {
915
- ({c: [_ConsoleLogger, _initClass$13]} = _apply_decs_2203_r$13(this, [], [_dec$13]));
855
+ ({c: [_ConsoleLogger, _initClass$14]} = _apply_decs_2203_r$14(this, [], [_dec$14]));
916
856
  }
917
857
  /**
918
858
  * The options of the logger.
@@ -1161,10 +1101,10 @@ _dec$13 = (0, __navios_di.Injectable)({ token: LoggerOutput });
1161
1101
  }
1162
1102
  }
1163
1103
  static {
1164
- _initClass$13();
1104
+ _initClass$14();
1165
1105
  }
1166
1106
  });
1167
- function applyDecs2203RFactory$12() {
1107
+ function applyDecs2203RFactory$13() {
1168
1108
  function createAddInitializerMethod(initializers, decoratorFinishedRef) {
1169
1109
  return function addInitializer(initializer) {
1170
1110
  assertNotFinished(decoratorFinishedRef, "addInitializer");
@@ -1438,20 +1378,20 @@ function applyDecs2203RFactory$12() {
1438
1378
  };
1439
1379
  };
1440
1380
  }
1441
- function _apply_decs_2203_r$12(targetClass, memberDecs, classDecs, parentClass) {
1442
- return (_apply_decs_2203_r$12 = applyDecs2203RFactory$12())(targetClass, memberDecs, classDecs, parentClass);
1381
+ function _apply_decs_2203_r$13(targetClass, memberDecs, classDecs, parentClass) {
1382
+ return (_apply_decs_2203_r$13 = applyDecs2203RFactory$13())(targetClass, memberDecs, classDecs, parentClass);
1443
1383
  }
1444
- var _dec$12, _initClass$12;
1384
+ var _dec$13, _initClass$13;
1445
1385
  let _LoggerInstance;
1446
- _dec$12 = (0, __navios_di.Injectable)({ token: Logger });
1386
+ _dec$13 = (0, _navios_di.Injectable)({ token: Logger });
1447
1387
  (class {
1448
1388
  static {
1449
- ({c: [_LoggerInstance, _initClass$12]} = _apply_decs_2203_r$12(this, [], [_dec$12]));
1389
+ ({c: [_LoggerInstance, _initClass$13]} = _apply_decs_2203_r$13(this, [], [_dec$13]));
1450
1390
  }
1451
1391
  constructor(config = {}) {
1452
1392
  this.context = config.context;
1453
1393
  }
1454
- localInstance = (0, __navios_di.inject)(LoggerOutput);
1394
+ localInstance = (0, _navios_di.inject)(LoggerOutput);
1455
1395
  context;
1456
1396
  error(message, ...optionalParams) {
1457
1397
  optionalParams = this.context ? (optionalParams.length ? optionalParams : [void 0]).concat(this.context) : optionalParams;
@@ -1478,10 +1418,10 @@ _dec$12 = (0, __navios_di.Injectable)({ token: Logger });
1478
1418
  this.localInstance?.fatal?.(message, ...optionalParams);
1479
1419
  }
1480
1420
  static {
1481
- _initClass$12();
1421
+ _initClass$13();
1482
1422
  }
1483
1423
  });
1484
- function applyDecs2203RFactory$11() {
1424
+ function applyDecs2203RFactory$12() {
1485
1425
  function createAddInitializerMethod(initializers, decoratorFinishedRef) {
1486
1426
  return function addInitializer(initializer) {
1487
1427
  assertNotFinished(decoratorFinishedRef, "addInitializer");
@@ -1755,22 +1695,22 @@ function applyDecs2203RFactory$11() {
1755
1695
  };
1756
1696
  };
1757
1697
  }
1758
- function _apply_decs_2203_r$11(targetClass, memberDecs, classDecs, parentClass) {
1759
- return (_apply_decs_2203_r$11 = applyDecs2203RFactory$11())(targetClass, memberDecs, classDecs, parentClass);
1698
+ function _apply_decs_2203_r$12(targetClass, memberDecs, classDecs, parentClass) {
1699
+ return (_apply_decs_2203_r$12 = applyDecs2203RFactory$12())(targetClass, memberDecs, classDecs, parentClass);
1760
1700
  }
1761
- var _dec$11, _initClass$11;
1701
+ var _dec$12, _initClass$12;
1762
1702
  /**
1763
1703
  * Schema for validating configuration service options.
1764
1704
  */ const ConfigServiceOptionsSchema = zod_v4.z.record(zod_v4.z.string(), zod_v4.z.unknown());
1765
1705
  /**
1766
1706
  * Injection token for ConfigService.
1767
- */ const ConfigServiceToken = __navios_di.InjectionToken.create(Symbol.for("ConfigService"), ConfigServiceOptionsSchema);
1707
+ */ const ConfigServiceToken = _navios_di.InjectionToken.create(Symbol.for("ConfigService"), ConfigServiceOptionsSchema);
1768
1708
  let _ConfigService;
1769
- _dec$11 = (0, __navios_di.Injectable)({ token: ConfigServiceToken });
1709
+ _dec$12 = (0, _navios_di.Injectable)({ token: ConfigServiceToken });
1770
1710
  (class {
1771
1711
  config;
1772
1712
  static {
1773
- ({c: [_ConfigService, _initClass$11]} = _apply_decs_2203_r$11(this, [], [_dec$11]));
1713
+ ({c: [_ConfigService, _initClass$12]} = _apply_decs_2203_r$12(this, [], [_dec$12]));
1774
1714
  }
1775
1715
  /**
1776
1716
  * Creates a new ConfigService instance.
@@ -1779,7 +1719,7 @@ _dec$11 = (0, __navios_di.Injectable)({ token: ConfigServiceToken });
1779
1719
  */ constructor(config = {}) {
1780
1720
  this.config = config;
1781
1721
  }
1782
- logger = (0, __navios_di.inject)(Logger, { context: _ConfigService.name });
1722
+ logger = (0, _navios_di.inject)(Logger, { context: _ConfigService.name });
1783
1723
  /**
1784
1724
  * Gets the entire configuration object.
1785
1725
  *
@@ -1852,7 +1792,7 @@ _dec$11 = (0, __navios_di.Injectable)({ token: ConfigServiceToken });
1852
1792
  return value;
1853
1793
  }
1854
1794
  static {
1855
- _initClass$11();
1795
+ _initClass$12();
1856
1796
  }
1857
1797
  });
1858
1798
  /**
@@ -1880,7 +1820,7 @@ _dec$11 = (0, __navios_di.Injectable)({ token: ConfigServiceToken });
1880
1820
  * container.bind(ConfigServiceToken).toFactory(configProvider)
1881
1821
  * ```
1882
1822
  */ function provideConfig(options) {
1883
- return __navios_di.InjectionToken.factory(ConfigServiceToken, async () => options.load());
1823
+ return _navios_di.InjectionToken.factory(ConfigServiceToken, async () => options.load());
1884
1824
  }
1885
1825
  /**
1886
1826
  * Pre-configured ConfigService provider that uses environment variables.
@@ -1892,7 +1832,7 @@ _dec$11 = (0, __navios_di.Injectable)({ token: ConfigServiceToken });
1892
1832
  * // Use environment variables as configuration
1893
1833
  * container.bind(ConfigServiceToken).toValue(EnvConfigProvider)
1894
1834
  * ```
1895
- */ const EnvConfigProvider = __navios_di.InjectionToken.bound(ConfigServiceToken, { ...node_process.env });
1835
+ */ const EnvConfigProvider = _navios_di.InjectionToken.bound(ConfigServiceToken, { ...node_process.env });
1896
1836
  /**
1897
1837
  * Base exception class for all HTTP exceptions in Navios.
1898
1838
  *
@@ -2087,6 +2027,357 @@ _dec$11 = (0, __navios_di.Injectable)({ token: ConfigServiceToken });
2087
2027
  super(409, message, error);
2088
2028
  }
2089
2029
  };
2030
+ function applyDecs2203RFactory$11() {
2031
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
2032
+ return function addInitializer(initializer) {
2033
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
2034
+ assertCallable(initializer, "An initializer");
2035
+ initializers.push(initializer);
2036
+ };
2037
+ }
2038
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
2039
+ var kindStr;
2040
+ switch (kind) {
2041
+ case 1:
2042
+ kindStr = "accessor";
2043
+ break;
2044
+ case 2:
2045
+ kindStr = "method";
2046
+ break;
2047
+ case 3:
2048
+ kindStr = "getter";
2049
+ break;
2050
+ case 4:
2051
+ kindStr = "setter";
2052
+ break;
2053
+ default: kindStr = "field";
2054
+ }
2055
+ var ctx = {
2056
+ kind: kindStr,
2057
+ name: isPrivate ? "#" + name : name,
2058
+ static: isStatic,
2059
+ private: isPrivate,
2060
+ metadata
2061
+ };
2062
+ var decoratorFinishedRef = { v: false };
2063
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
2064
+ var get, set;
2065
+ if (kind === 0) if (isPrivate) {
2066
+ get = desc.get;
2067
+ set = desc.set;
2068
+ } else {
2069
+ get = function() {
2070
+ return this[name];
2071
+ };
2072
+ set = function(v) {
2073
+ this[name] = v;
2074
+ };
2075
+ }
2076
+ else if (kind === 2) get = function() {
2077
+ return desc.value;
2078
+ };
2079
+ else {
2080
+ if (kind === 1 || kind === 3) get = function() {
2081
+ return desc.get.call(this);
2082
+ };
2083
+ if (kind === 1 || kind === 4) set = function(v) {
2084
+ desc.set.call(this, v);
2085
+ };
2086
+ }
2087
+ ctx.access = get && set ? {
2088
+ get,
2089
+ set
2090
+ } : get ? { get } : { set };
2091
+ try {
2092
+ return dec(value, ctx);
2093
+ } finally {
2094
+ decoratorFinishedRef.v = true;
2095
+ }
2096
+ }
2097
+ function assertNotFinished(decoratorFinishedRef, fnName) {
2098
+ if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
2099
+ }
2100
+ function assertCallable(fn, hint) {
2101
+ if (typeof fn !== "function") throw new TypeError(hint + " must be a function");
2102
+ }
2103
+ function assertValidReturnValue(kind, value) {
2104
+ var type = typeof value;
2105
+ if (kind === 1) {
2106
+ if (type !== "object" || value === null) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
2107
+ if (value.get !== void 0) assertCallable(value.get, "accessor.get");
2108
+ if (value.set !== void 0) assertCallable(value.set, "accessor.set");
2109
+ if (value.init !== void 0) assertCallable(value.init, "accessor.init");
2110
+ } else if (type !== "function") {
2111
+ var hint;
2112
+ if (kind === 0) hint = "field";
2113
+ else if (kind === 10) hint = "class";
2114
+ else hint = "method";
2115
+ throw new TypeError(hint + " decorators must return a function or void 0");
2116
+ }
2117
+ }
2118
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
2119
+ var decs = decInfo[0];
2120
+ var desc, init, value;
2121
+ if (isPrivate) if (kind === 0 || kind === 1) desc = {
2122
+ get: decInfo[3],
2123
+ set: decInfo[4]
2124
+ };
2125
+ else if (kind === 3) desc = { get: decInfo[3] };
2126
+ else if (kind === 4) desc = { set: decInfo[3] };
2127
+ else desc = { value: decInfo[3] };
2128
+ else if (kind !== 0) desc = Object.getOwnPropertyDescriptor(base, name);
2129
+ if (kind === 1) value = {
2130
+ get: desc.get,
2131
+ set: desc.set
2132
+ };
2133
+ else if (kind === 2) value = desc.value;
2134
+ else if (kind === 3) value = desc.get;
2135
+ else if (kind === 4) value = desc.set;
2136
+ var newValue, get, set;
2137
+ if (typeof decs === "function") {
2138
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
2139
+ if (newValue !== void 0) {
2140
+ assertValidReturnValue(kind, newValue);
2141
+ if (kind === 0) init = newValue;
2142
+ else if (kind === 1) {
2143
+ init = newValue.init;
2144
+ get = newValue.get || value.get;
2145
+ set = newValue.set || value.set;
2146
+ value = {
2147
+ get,
2148
+ set
2149
+ };
2150
+ } else value = newValue;
2151
+ }
2152
+ } else for (var i = decs.length - 1; i >= 0; i--) {
2153
+ var dec = decs[i];
2154
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
2155
+ if (newValue !== void 0) {
2156
+ assertValidReturnValue(kind, newValue);
2157
+ var newInit;
2158
+ if (kind === 0) newInit = newValue;
2159
+ else if (kind === 1) {
2160
+ newInit = newValue.init;
2161
+ get = newValue.get || value.get;
2162
+ set = newValue.set || value.set;
2163
+ value = {
2164
+ get,
2165
+ set
2166
+ };
2167
+ } else value = newValue;
2168
+ if (newInit !== void 0) if (init === void 0) init = newInit;
2169
+ else if (typeof init === "function") init = [init, newInit];
2170
+ else init.push(newInit);
2171
+ }
2172
+ }
2173
+ if (kind === 0 || kind === 1) {
2174
+ if (init === void 0) init = function(instance, init$1) {
2175
+ return init$1;
2176
+ };
2177
+ else if (typeof init !== "function") {
2178
+ var ownInitializers = init;
2179
+ init = function(instance, init$1) {
2180
+ var value$1 = init$1;
2181
+ for (var i$1 = 0; i$1 < ownInitializers.length; i$1++) value$1 = ownInitializers[i$1].call(instance, value$1);
2182
+ return value$1;
2183
+ };
2184
+ } else {
2185
+ var originalInitializer = init;
2186
+ init = function(instance, init$1) {
2187
+ return originalInitializer.call(instance, init$1);
2188
+ };
2189
+ }
2190
+ ret.push(init);
2191
+ }
2192
+ if (kind !== 0) {
2193
+ if (kind === 1) {
2194
+ desc.get = value.get;
2195
+ desc.set = value.set;
2196
+ } else if (kind === 2) desc.value = value;
2197
+ else if (kind === 3) desc.get = value;
2198
+ else if (kind === 4) desc.set = value;
2199
+ if (isPrivate) if (kind === 1) {
2200
+ ret.push(function(instance, args) {
2201
+ return value.get.call(instance, args);
2202
+ });
2203
+ ret.push(function(instance, args) {
2204
+ return value.set.call(instance, args);
2205
+ });
2206
+ } else if (kind === 2) ret.push(value);
2207
+ else ret.push(function(instance, args) {
2208
+ return value.call(instance, args);
2209
+ });
2210
+ else Object.defineProperty(base, name, desc);
2211
+ }
2212
+ }
2213
+ function applyMemberDecs(Class, decInfos, metadata) {
2214
+ var ret = [];
2215
+ var protoInitializers;
2216
+ var staticInitializers;
2217
+ var existingProtoNonFields = /* @__PURE__ */ new Map();
2218
+ var existingStaticNonFields = /* @__PURE__ */ new Map();
2219
+ for (var i = 0; i < decInfos.length; i++) {
2220
+ var decInfo = decInfos[i];
2221
+ if (!Array.isArray(decInfo)) continue;
2222
+ var kind = decInfo[1];
2223
+ var name = decInfo[2];
2224
+ var isPrivate = decInfo.length > 3;
2225
+ var isStatic = kind >= 5;
2226
+ var base;
2227
+ var initializers;
2228
+ if (isStatic) {
2229
+ base = Class;
2230
+ kind = kind - 5;
2231
+ staticInitializers = staticInitializers || [];
2232
+ initializers = staticInitializers;
2233
+ } else {
2234
+ base = Class.prototype;
2235
+ protoInitializers = protoInitializers || [];
2236
+ initializers = protoInitializers;
2237
+ }
2238
+ if (kind !== 0 && !isPrivate) {
2239
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
2240
+ var existingKind = existingNonFields.get(name) || 0;
2241
+ if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
2242
+ else if (!existingKind && kind > 2) existingNonFields.set(name, kind);
2243
+ else existingNonFields.set(name, true);
2244
+ }
2245
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
2246
+ }
2247
+ pushInitializers(ret, protoInitializers);
2248
+ pushInitializers(ret, staticInitializers);
2249
+ return ret;
2250
+ }
2251
+ function pushInitializers(ret, initializers) {
2252
+ if (initializers) ret.push(function(instance) {
2253
+ for (var i = 0; i < initializers.length; i++) initializers[i].call(instance);
2254
+ return instance;
2255
+ });
2256
+ }
2257
+ function applyClassDecs(targetClass, classDecs, metadata) {
2258
+ if (classDecs.length > 0) {
2259
+ var initializers = [];
2260
+ var newClass = targetClass;
2261
+ var name = targetClass.name;
2262
+ for (var i = classDecs.length - 1; i >= 0; i--) {
2263
+ var decoratorFinishedRef = { v: false };
2264
+ try {
2265
+ var nextNewClass = classDecs[i](newClass, {
2266
+ kind: "class",
2267
+ name,
2268
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
2269
+ metadata
2270
+ });
2271
+ } finally {
2272
+ decoratorFinishedRef.v = true;
2273
+ }
2274
+ if (nextNewClass !== void 0) {
2275
+ assertValidReturnValue(10, nextNewClass);
2276
+ newClass = nextNewClass;
2277
+ }
2278
+ }
2279
+ return [defineMetadata(newClass, metadata), function() {
2280
+ for (var i$1 = 0; i$1 < initializers.length; i$1++) initializers[i$1].call(newClass);
2281
+ }];
2282
+ }
2283
+ }
2284
+ function defineMetadata(Class, metadata) {
2285
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
2286
+ configurable: true,
2287
+ enumerable: true,
2288
+ value: metadata
2289
+ });
2290
+ }
2291
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
2292
+ if (parentClass !== void 0) var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
2293
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
2294
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
2295
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
2296
+ return {
2297
+ e,
2298
+ get c() {
2299
+ return applyClassDecs(targetClass, classDecs, metadata);
2300
+ }
2301
+ };
2302
+ };
2303
+ }
2304
+ function _apply_decs_2203_r$11(targetClass, memberDecs, classDecs, parentClass) {
2305
+ return (_apply_decs_2203_r$11 = applyDecs2203RFactory$11())(targetClass, memberDecs, classDecs, parentClass);
2306
+ }
2307
+ var _dec$11, _initClass$11;
2308
+ let _InstanceResolverService;
2309
+ _dec$11 = (0, _navios_di.Injectable)();
2310
+ (class {
2311
+ static {
2312
+ ({c: [_InstanceResolverService, _initClass$11]} = _apply_decs_2203_r$11(this, [], [_dec$11]));
2313
+ }
2314
+ container = (0, _navios_di.inject)(_navios_di.Container);
2315
+ /**
2316
+ * Attempts to resolve a class instance, automatically detecting if it needs
2317
+ * request scope based on its dependencies.
2318
+ *
2319
+ * @param classType - The class to resolve
2320
+ * @returns A resolution result containing either a cached instance or resolver function
2321
+ */ async resolve(classType) {
2322
+ let cachedInstance = null;
2323
+ try {
2324
+ cachedInstance = await this.container.get(classType);
2325
+ } catch {
2326
+ const token = (0, _navios_di.getInjectableToken)(classType);
2327
+ this.container.getRegistry().updateScope(token, _navios_di.InjectableScope.Request);
2328
+ }
2329
+ return {
2330
+ cached: cachedInstance !== null,
2331
+ instance: cachedInstance,
2332
+ resolve: (scoped) => scoped.get(classType)
2333
+ };
2334
+ }
2335
+ /**
2336
+ * Attempts to resolve multiple class instances, automatically detecting if any need
2337
+ * request scope based on their dependencies.
2338
+ *
2339
+ * Returns `cached: true` only if ALL classes can be resolved as singletons.
2340
+ * If any class has request-scoped dependencies, returns `cached: false`.
2341
+ *
2342
+ * @param classTypes - The classes to resolve
2343
+ * @returns A resolution result containing either all cached instances or resolver function
2344
+ */ async resolveMany(classTypes) {
2345
+ if (classTypes.length === 0) return {
2346
+ cached: true,
2347
+ instances: [],
2348
+ classTypes: [],
2349
+ resolve: async () => []
2350
+ };
2351
+ const results = await Promise.all(classTypes.map(async (classType) => {
2352
+ try {
2353
+ return {
2354
+ success: true,
2355
+ instance: await this.container.get(classType)
2356
+ };
2357
+ } catch {
2358
+ const token = (0, _navios_di.getInjectableToken)(classType);
2359
+ this.container.getRegistry().updateScope(token, _navios_di.InjectableScope.Request);
2360
+ return {
2361
+ success: false,
2362
+ instance: null
2363
+ };
2364
+ }
2365
+ }));
2366
+ const allCached = results.every((r) => r.success);
2367
+ return {
2368
+ cached: allCached,
2369
+ instances: allCached ? results.map((r) => r.instance) : null,
2370
+ classTypes,
2371
+ resolve: (scoped) => Promise.all(classTypes.map((classType) => scoped.get(classType)))
2372
+ };
2373
+ }
2374
+ static {
2375
+ _initClass$11();
2376
+ }
2377
+ });
2378
+ /**
2379
+ * @deprecated Use InstanceResolverService instead
2380
+ */ const ControllerResolverService = _InstanceResolverService;
2090
2381
  function applyDecs2203RFactory$10() {
2091
2382
  function createAddInitializerMethod(initializers, decoratorFinishedRef) {
2092
2383
  return function addInitializer(initializer) {
@@ -2366,29 +2657,46 @@ function _apply_decs_2203_r$10(targetClass, memberDecs, classDecs, parentClass)
2366
2657
  }
2367
2658
  var _dec$10, _initClass$10;
2368
2659
  let _GuardRunnerService;
2369
- _dec$10 = (0, __navios_di.Injectable)();
2660
+ _dec$10 = (0, _navios_di.Injectable)();
2370
2661
  (class {
2371
2662
  static {
2372
2663
  ({c: [_GuardRunnerService, _initClass$10]} = _apply_decs_2203_r$10(this, [], [_dec$10]));
2373
2664
  }
2374
- logger = (0, __navios_di.inject)(Logger, { context: _GuardRunnerService.name });
2375
- async runGuards(allGuards, executionContext, context) {
2376
- let canActivate = true;
2377
- for (const guard of Array.from(allGuards).reverse()) {
2665
+ logger = (0, _navios_di.inject)(Logger, { context: _GuardRunnerService.name });
2666
+ /**
2667
+ * Runs guards that need to be resolved from a scoped container.
2668
+ * Use this when guards have request-scoped dependencies.
2669
+ */ async runGuards(allGuards, executionContext, context) {
2670
+ const guardsArray = Array.from(allGuards).reverse();
2671
+ const guardInstances = await Promise.all(guardsArray.map(async (guard) => {
2378
2672
  const guardInstance = await context.get(guard);
2379
2673
  if (!guardInstance.canActivate) throw new Error(`[Navios] Guard ${guard.name} does not implement canActivate()`);
2380
- try {
2381
- canActivate = await guardInstance.canActivate(executionContext);
2382
- if (!canActivate) break;
2383
- } catch (error) {
2384
- if (error instanceof HttpException) {
2385
- executionContext.getReply().status(error.statusCode).send(error.response);
2386
- return false;
2387
- } else {
2388
- this.logger.error("Error running guard", error);
2389
- executionContext.getReply().status(500).send({ message: "Internal server error" });
2390
- return false;
2391
- }
2674
+ return guardInstance;
2675
+ }));
2676
+ return this.executeGuards(guardInstances, executionContext);
2677
+ }
2678
+ /**
2679
+ * Runs pre-resolved guard instances.
2680
+ * Use this when all guards are singletons and have been pre-resolved at startup.
2681
+ */ async runGuardsStatic(guardInstances, executionContext) {
2682
+ return this.executeGuards(guardInstances, executionContext);
2683
+ }
2684
+ /**
2685
+ * Shared guard execution logic.
2686
+ * Iterates through guard instances and calls canActivate on each.
2687
+ */ async executeGuards(guardInstances, executionContext) {
2688
+ let canActivate = true;
2689
+ for (const guardInstance of guardInstances) try {
2690
+ canActivate = await guardInstance.canActivate(executionContext);
2691
+ if (!canActivate) break;
2692
+ } catch (error) {
2693
+ if (error instanceof HttpException) {
2694
+ executionContext.getReply().status(error.statusCode).send(error.response);
2695
+ return false;
2696
+ } else {
2697
+ this.logger.error("Error running guard", error);
2698
+ executionContext.getReply().status(500).send({ message: "Internal server error" });
2699
+ return false;
2392
2700
  }
2393
2701
  }
2394
2702
  if (!canActivate) {
@@ -2690,13 +2998,13 @@ function _apply_decs_2203_r$9(targetClass, memberDecs, classDecs, parentClass) {
2690
2998
  }
2691
2999
  var _dec$9, _initClass$9;
2692
3000
  let _ModuleLoaderService;
2693
- _dec$9 = (0, __navios_di.Injectable)();
3001
+ _dec$9 = (0, _navios_di.Injectable)();
2694
3002
  (class {
2695
3003
  static {
2696
3004
  ({c: [_ModuleLoaderService, _initClass$9]} = _apply_decs_2203_r$9(this, [], [_dec$9]));
2697
3005
  }
2698
- logger = (0, __navios_di.inject)(Logger, { context: _ModuleLoaderService.name });
2699
- container = (0, __navios_di.inject)(__navios_di.Container);
3006
+ logger = (0, _navios_di.inject)(Logger, { context: _ModuleLoaderService.name });
3007
+ container = (0, _navios_di.inject)(_navios_di.Container);
2700
3008
  modulesMetadata = /* @__PURE__ */ new Map();
2701
3009
  loadedModules = /* @__PURE__ */ new Map();
2702
3010
  initialized = false;
@@ -2705,6 +3013,49 @@ _dec$9 = (0, __navios_di.Injectable)();
2705
3013
  await this.traverseModules(appModule);
2706
3014
  this.initialized = true;
2707
3015
  }
3016
+ /**
3017
+ * Extends the module tree with additional modules or controllers.
3018
+ *
3019
+ * This method is designed to be called by plugins during registration,
3020
+ * which happens after initial module loading but before route registration.
3021
+ *
3022
+ * @param extensions - Array of module extensions to add
3023
+ * @throws Error if not initialized (loadModules must be called first)
3024
+ *
3025
+ * @example
3026
+ * ```typescript
3027
+ * // In plugin registration
3028
+ * const moduleLoader = await context.container.get(ModuleLoaderService)
3029
+ * await moduleLoader.extendModules([{
3030
+ * controllers: [OpenApiJsonController, OpenApiYamlController],
3031
+ * moduleName: 'OpenApiBunModule',
3032
+ * }])
3033
+ * ```
3034
+ */ async extendModules(extensions) {
3035
+ if (!this.initialized) throw new Error("ModuleLoaderService must be initialized before extending. Call loadModules() first.");
3036
+ for (const extension of extensions) if (extension.module) await this.traverseModules(extension.module);
3037
+ else if (extension.controllers && extension.moduleName) await this.registerControllers(extension.controllers, extension.moduleName);
3038
+ else if (extension.controllers) throw new Error("moduleName is required when providing controllers without a module");
3039
+ }
3040
+ /**
3041
+ * Registers controllers under a synthetic module.
3042
+ * Used when plugins want to add controllers without a full module class.
3043
+ */ async registerControllers(controllers, moduleName) {
3044
+ if (this.modulesMetadata.has(moduleName)) {
3045
+ const existing = this.modulesMetadata.get(moduleName);
3046
+ for (const controller of controllers) existing.controllers.add(controller);
3047
+ this.logger.debug(`Extended module ${moduleName} with ${controllers.length} controllers`);
3048
+ } else {
3049
+ const metadata = {
3050
+ controllers: new Set(controllers),
3051
+ imports: /* @__PURE__ */ new Set(),
3052
+ guards: /* @__PURE__ */ new Set(),
3053
+ customAttributes: /* @__PURE__ */ new Map()
3054
+ };
3055
+ this.modulesMetadata.set(moduleName, metadata);
3056
+ this.logger.debug(`Created module ${moduleName} with ${controllers.length} controllers`);
3057
+ }
3058
+ }
2708
3059
  async traverseModules(module$1, parentMetadata) {
2709
3060
  const metadata = extractModuleMetadata(module$1);
2710
3061
  if (parentMetadata) this.mergeMetadata(metadata, parentMetadata);
@@ -3098,7 +3449,7 @@ function _apply_decs_2203_r$8(targetClass, memberDecs, classDecs, parentClass) {
3098
3449
  }
3099
3450
  var _dec$8, _initClass$8;
3100
3451
  let _NaviosEnvironment;
3101
- _dec$8 = (0, __navios_di.Injectable)();
3452
+ _dec$8 = (0, _navios_di.Injectable)();
3102
3453
  (class {
3103
3454
  static {
3104
3455
  ({c: [_NaviosEnvironment, _initClass$8]} = _apply_decs_2203_r$8(this, [], [_dec$8]));
@@ -3396,12 +3747,12 @@ function _apply_decs_2203_r$7(targetClass, memberDecs, classDecs, parentClass) {
3396
3747
  }
3397
3748
  var _dec$7, _initClass$7;
3398
3749
  let _EndpointAdapterFactory;
3399
- _dec$7 = (0, __navios_di.Factory)({ token: EndpointAdapterToken });
3750
+ _dec$7 = (0, _navios_di.Factory)({ token: EndpointAdapterToken });
3400
3751
  (class {
3401
3752
  static {
3402
3753
  ({c: [_EndpointAdapterFactory, _initClass$7]} = _apply_decs_2203_r$7(this, [], [_dec$7]));
3403
3754
  }
3404
- environment = (0, __navios_di.inject)(_NaviosEnvironment);
3755
+ environment = (0, _navios_di.inject)(_NaviosEnvironment);
3405
3756
  create(ctx) {
3406
3757
  const service = this.environment.getHttpToken(EndpointAdapterToken);
3407
3758
  if (!service) throw new Error("EndpointAdapterToken service not found in environment");
@@ -3690,12 +4041,12 @@ function _apply_decs_2203_r$6(targetClass, memberDecs, classDecs, parentClass) {
3690
4041
  }
3691
4042
  var _dec$6, _initClass$6;
3692
4043
  let _HttpAdapterFactory;
3693
- _dec$6 = (0, __navios_di.Factory)({ token: HttpAdapterToken });
4044
+ _dec$6 = (0, _navios_di.Factory)({ token: HttpAdapterToken });
3694
4045
  (class {
3695
4046
  static {
3696
4047
  ({c: [_HttpAdapterFactory, _initClass$6]} = _apply_decs_2203_r$6(this, [], [_dec$6]));
3697
4048
  }
3698
- environment = (0, __navios_di.inject)(_NaviosEnvironment);
4049
+ environment = (0, _navios_di.inject)(_NaviosEnvironment);
3699
4050
  create(ctx) {
3700
4051
  const service = this.environment.getHttpToken(HttpAdapterToken);
3701
4052
  if (!service) throw new Error("HttpAdapterToken service not found in environment");
@@ -3984,12 +4335,12 @@ function _apply_decs_2203_r$5(targetClass, memberDecs, classDecs, parentClass) {
3984
4335
  }
3985
4336
  var _dec$5, _initClass$5;
3986
4337
  let _MultipartAdapterFactory;
3987
- _dec$5 = (0, __navios_di.Factory)({ token: MultipartAdapterToken });
4338
+ _dec$5 = (0, _navios_di.Factory)({ token: MultipartAdapterToken });
3988
4339
  (class {
3989
4340
  static {
3990
4341
  ({c: [_MultipartAdapterFactory, _initClass$5]} = _apply_decs_2203_r$5(this, [], [_dec$5]));
3991
4342
  }
3992
- environment = (0, __navios_di.inject)(_NaviosEnvironment);
4343
+ environment = (0, _navios_di.inject)(_NaviosEnvironment);
3993
4344
  create(ctx) {
3994
4345
  const service = this.environment.getHttpToken(MultipartAdapterToken);
3995
4346
  if (!service) throw new Error("MultipartAdapterToken service not found in environment");
@@ -4278,15 +4629,15 @@ function _apply_decs_2203_r$4(targetClass, memberDecs, classDecs, parentClass) {
4278
4629
  }
4279
4630
  var _dec$4, _initClass$4;
4280
4631
  let _RequestFactory;
4281
- _dec$4 = (0, __navios_di.Factory)({
4632
+ _dec$4 = (0, _navios_di.Factory)({
4282
4633
  token: Request,
4283
- scope: __navios_di.InjectableScope.Request
4634
+ scope: _navios_di.InjectableScope.Request
4284
4635
  });
4285
4636
  (class {
4286
4637
  static {
4287
4638
  ({c: [_RequestFactory, _initClass$4]} = _apply_decs_2203_r$4(this, [], [_dec$4]));
4288
4639
  }
4289
- environment = (0, __navios_di.inject)(_NaviosEnvironment);
4640
+ environment = (0, _navios_di.inject)(_NaviosEnvironment);
4290
4641
  create(ctx) {
4291
4642
  const service = this.environment.getHttpToken(Request);
4292
4643
  if (!service) throw new Error("RequestToken service not found in environment");
@@ -4575,15 +4926,15 @@ function _apply_decs_2203_r$3(targetClass, memberDecs, classDecs, parentClass) {
4575
4926
  }
4576
4927
  var _dec$3, _initClass$3;
4577
4928
  let _ReplyFactory;
4578
- _dec$3 = (0, __navios_di.Factory)({
4929
+ _dec$3 = (0, _navios_di.Factory)({
4579
4930
  token: Reply,
4580
- scope: __navios_di.InjectableScope.Request
4931
+ scope: _navios_di.InjectableScope.Request
4581
4932
  });
4582
4933
  (class {
4583
4934
  static {
4584
4935
  ({c: [_ReplyFactory, _initClass$3]} = _apply_decs_2203_r$3(this, [], [_dec$3]));
4585
4936
  }
4586
- environment = (0, __navios_di.inject)(_NaviosEnvironment);
4937
+ environment = (0, _navios_di.inject)(_NaviosEnvironment);
4587
4938
  create(ctx) {
4588
4939
  const service = this.environment.getHttpToken(Reply);
4589
4940
  if (!service) throw new Error("ReplyToken service not found in environment");
@@ -4872,12 +5223,12 @@ function _apply_decs_2203_r$2$1(targetClass, memberDecs, classDecs, parentClass)
4872
5223
  }
4873
5224
  var _dec$2$1, _initClass$2$1;
4874
5225
  let _StreamAdapterFactory;
4875
- _dec$2$1 = (0, __navios_di.Factory)({ token: StreamAdapterToken });
5226
+ _dec$2$1 = (0, _navios_di.Factory)({ token: StreamAdapterToken });
4876
5227
  (class {
4877
5228
  static {
4878
5229
  ({c: [_StreamAdapterFactory, _initClass$2$1]} = _apply_decs_2203_r$2$1(this, [], [_dec$2$1]));
4879
5230
  }
4880
- environment = (0, __navios_di.inject)(_NaviosEnvironment);
5231
+ environment = (0, _navios_di.inject)(_NaviosEnvironment);
4881
5232
  create(ctx) {
4882
5233
  const service = this.environment.getHttpToken(StreamAdapterToken);
4883
5234
  if (!service) throw new Error("StreamAdapterToken service not found in environment");
@@ -5166,12 +5517,12 @@ function _apply_decs_2203_r$1$1(targetClass, memberDecs, classDecs, parentClass)
5166
5517
  }
5167
5518
  var _dec$1$1, _initClass$1$1;
5168
5519
  let _XmlStreamAdapterFactory;
5169
- _dec$1$1 = (0, __navios_di.Factory)({ token: XmlStreamAdapterToken });
5520
+ _dec$1$1 = (0, _navios_di.Factory)({ token: XmlStreamAdapterToken });
5170
5521
  (class {
5171
5522
  static {
5172
5523
  ({c: [_XmlStreamAdapterFactory, _initClass$1$1]} = _apply_decs_2203_r$1$1(this, [], [_dec$1$1]));
5173
5524
  }
5174
- environment = (0, __navios_di.inject)(_NaviosEnvironment);
5525
+ environment = (0, _navios_di.inject)(_NaviosEnvironment);
5175
5526
  create(ctx) {
5176
5527
  const service = this.environment.getHttpToken(XmlStreamAdapterToken);
5177
5528
  if (!service) throw new Error("XmlStreamAdapterToken service not found in environment");
@@ -5181,7 +5532,7 @@ _dec$1$1 = (0, __navios_di.Factory)({ token: XmlStreamAdapterToken });
5181
5532
  _initClass$1$1();
5182
5533
  }
5183
5534
  });
5184
- function applyDecs2203RFactory$14() {
5535
+ function applyDecs2203RFactory$15() {
5185
5536
  function createAddInitializerMethod(initializers, decoratorFinishedRef) {
5186
5537
  return function addInitializer(initializer) {
5187
5538
  assertNotFinished(decoratorFinishedRef, "addInitializer");
@@ -5455,23 +5806,24 @@ function applyDecs2203RFactory$14() {
5455
5806
  };
5456
5807
  };
5457
5808
  }
5458
- function _apply_decs_2203_r$14(targetClass, memberDecs, classDecs, parentClass) {
5459
- return (_apply_decs_2203_r$14 = applyDecs2203RFactory$14())(targetClass, memberDecs, classDecs, parentClass);
5809
+ function _apply_decs_2203_r$15(targetClass, memberDecs, classDecs, parentClass) {
5810
+ return (_apply_decs_2203_r$15 = applyDecs2203RFactory$15())(targetClass, memberDecs, classDecs, parentClass);
5460
5811
  }
5461
- var _dec$14, _initClass$14;
5812
+ var _dec$15, _initClass$15;
5462
5813
  let _NaviosApplication;
5463
- _dec$14 = (0, __navios_di.Injectable)();
5814
+ _dec$15 = (0, _navios_di.Injectable)();
5464
5815
  (class {
5465
5816
  static {
5466
- ({c: [_NaviosApplication, _initClass$14]} = _apply_decs_2203_r$14(this, [], [_dec$14]));
5817
+ ({c: [_NaviosApplication, _initClass$15]} = _apply_decs_2203_r$15(this, [], [_dec$15]));
5467
5818
  }
5468
- environment = (0, __navios_di.inject)(_NaviosEnvironment);
5469
- moduleLoader = (0, __navios_di.inject)(_ModuleLoaderService);
5819
+ environment = (0, _navios_di.inject)(_NaviosEnvironment);
5820
+ moduleLoader = (0, _navios_di.inject)(_ModuleLoaderService);
5470
5821
  httpApplication = null;
5471
- logger = (0, __navios_di.inject)(Logger, { context: _NaviosApplication.name });
5472
- container = (0, __navios_di.inject)(__navios_di.Container);
5822
+ logger = (0, _navios_di.inject)(Logger, { context: _NaviosApplication.name });
5823
+ container = (0, _navios_di.inject)(_navios_di.Container);
5473
5824
  appModule = null;
5474
5825
  options = { adapter: [] };
5826
+ plugins = [];
5475
5827
  /**
5476
5828
  * Indicates whether the application has been initialized.
5477
5829
  * Set to `true` after `init()` completes successfully.
@@ -5479,7 +5831,7 @@ _dec$14 = (0, __navios_di.Injectable)();
5479
5831
  /**
5480
5832
  * Sets up the application with the provided module and options.
5481
5833
  * This is called automatically by NaviosFactory.create().
5482
- *
5834
+ *
5483
5835
  * @param appModule - The root application module
5484
5836
  * @param options - Application configuration options
5485
5837
  * @internal
@@ -5490,24 +5842,46 @@ _dec$14 = (0, __navios_di.Injectable)();
5490
5842
  }
5491
5843
  /**
5492
5844
  * Gets the dependency injection container used by this application.
5493
- *
5845
+ *
5494
5846
  * @returns The Container instance
5495
5847
  */ getContainer() {
5496
5848
  return this.container;
5497
5849
  }
5498
5850
  /**
5851
+ * Registers a plugin to be initialized after modules are loaded.
5852
+ *
5853
+ * Plugins are initialized in the order they are registered,
5854
+ * after all modules are loaded but before the server starts listening.
5855
+ *
5856
+ * @param definition - Plugin definition with options
5857
+ * @returns this for method chaining
5858
+ *
5859
+ * @example
5860
+ * ```typescript
5861
+ * import { defineOpenApiPlugin } from '@navios/openapi-fastify'
5862
+ *
5863
+ * app.usePlugin(defineOpenApiPlugin({
5864
+ * info: { title: 'My API', version: '1.0.0' },
5865
+ * }))
5866
+ * ```
5867
+ */ usePlugin(definition) {
5868
+ this.plugins.push(definition);
5869
+ return this;
5870
+ }
5871
+ /**
5499
5872
  * Initializes the application.
5500
- *
5873
+ *
5501
5874
  * This method:
5502
5875
  * - Loads all modules and their dependencies
5503
5876
  * - Sets up the HTTP server if an adapter is configured
5504
5877
  * - Calls onModuleInit hooks on all modules
5878
+ * - Initializes registered plugins
5505
5879
  * - Marks the application as initialized
5506
- *
5880
+ *
5507
5881
  * Must be called before `listen()`.
5508
- *
5882
+ *
5509
5883
  * @throws Error if app module is not set
5510
- *
5884
+ *
5511
5885
  * @example
5512
5886
  * ```typescript
5513
5887
  * const app = await NaviosFactory.create(AppModule, {
@@ -5520,6 +5894,7 @@ _dec$14 = (0, __navios_di.Injectable)();
5520
5894
  if (!this.appModule) throw new Error("App module is not set. Call setAppModule() first.");
5521
5895
  await this.moduleLoader.loadModules(this.appModule);
5522
5896
  if (this.environment.hasHttpSetup()) await this.httpApplication?.setupHttpServer(this.options);
5897
+ await this.initPlugins();
5523
5898
  await this.initModules();
5524
5899
  if (this.environment.hasHttpSetup()) await this.httpApplication?.ready();
5525
5900
  this.isInitialized = true;
@@ -5529,12 +5904,30 @@ _dec$14 = (0, __navios_di.Injectable)();
5529
5904
  const modules = this.moduleLoader.getAllModules();
5530
5905
  await this.httpApplication?.onModulesInit(modules);
5531
5906
  }
5907
+ async initPlugins() {
5908
+ if (this.plugins.length === 0) return;
5909
+ let server = null;
5910
+ try {
5911
+ server = this.httpApplication?.getServer() ?? null;
5912
+ } catch {}
5913
+ const context = {
5914
+ modules: this.moduleLoader.getAllModules(),
5915
+ server,
5916
+ container: this.container,
5917
+ globalPrefix: this.httpApplication?.getGlobalPrefix() ?? "",
5918
+ moduleLoader: this.moduleLoader
5919
+ };
5920
+ for (const { plugin, options } of this.plugins) {
5921
+ this.logger.debug(`Initializing plugin: ${plugin.name}`);
5922
+ await plugin.register(context, options);
5923
+ }
5924
+ }
5532
5925
  /**
5533
5926
  * Enables CORS (Cross-Origin Resource Sharing) for the application.
5534
- *
5927
+ *
5535
5928
  * @param options - CORS configuration options (adapter-specific)
5536
5929
  * @throws Error if HTTP application is not set
5537
- *
5930
+ *
5538
5931
  * @example
5539
5932
  * ```typescript
5540
5933
  * app.enableCors({
@@ -5549,10 +5942,10 @@ _dec$14 = (0, __navios_di.Injectable)();
5549
5942
  }
5550
5943
  /**
5551
5944
  * Enables multipart/form-data support for file uploads.
5552
- *
5945
+ *
5553
5946
  * @param options - Multipart configuration options (adapter-specific)
5554
5947
  * @throws Error if HTTP application is not set
5555
- *
5948
+ *
5556
5949
  * @example
5557
5950
  * ```typescript
5558
5951
  * app.enableMultipart({
@@ -5567,10 +5960,10 @@ _dec$14 = (0, __navios_di.Injectable)();
5567
5960
  }
5568
5961
  /**
5569
5962
  * Sets a global prefix for all routes.
5570
- *
5963
+ *
5571
5964
  * @param prefix - The prefix to prepend to all route URLs (e.g., '/api')
5572
5965
  * @throws Error if HTTP application is not set
5573
- *
5966
+ *
5574
5967
  * @example
5575
5968
  * ```typescript
5576
5969
  * app.setGlobalPrefix('/api/v1')
@@ -5582,14 +5975,14 @@ _dec$14 = (0, __navios_di.Injectable)();
5582
5975
  }
5583
5976
  /**
5584
5977
  * Gets the underlying HTTP server instance.
5585
- *
5978
+ *
5586
5979
  * The type of the returned server depends on the adapter used:
5587
5980
  * - Fastify adapter: Returns FastifyInstance
5588
5981
  * - Bun adapter: Returns Bun.Server
5589
- *
5982
+ *
5590
5983
  * @returns The HTTP server instance
5591
5984
  * @throws Error if HTTP application is not set
5592
- *
5985
+ *
5593
5986
  * @example
5594
5987
  * ```typescript
5595
5988
  * const server = app.getServer()
@@ -5601,10 +5994,10 @@ _dec$14 = (0, __navios_di.Injectable)();
5601
5994
  }
5602
5995
  /**
5603
5996
  * Starts the HTTP server and begins listening for requests.
5604
- *
5997
+ *
5605
5998
  * @param options - Listen options (port, host, etc.)
5606
5999
  * @throws Error if HTTP application is not set
5607
- *
6000
+ *
5608
6001
  * @example
5609
6002
  * ```typescript
5610
6003
  * await app.listen({ port: 3000, host: '0.0.0.0' })
@@ -5615,7 +6008,7 @@ _dec$14 = (0, __navios_di.Injectable)();
5615
6008
  }
5616
6009
  /**
5617
6010
  * Disposes of application resources.
5618
- *
6011
+ *
5619
6012
  * Cleans up the HTTP server and module loader.
5620
6013
  * This method is called automatically by `close()`.
5621
6014
  */ async dispose() {
@@ -5624,9 +6017,9 @@ _dec$14 = (0, __navios_di.Injectable)();
5624
6017
  }
5625
6018
  /**
5626
6019
  * Closes the application and cleans up all resources.
5627
- *
6020
+ *
5628
6021
  * This is an alias for `dispose()`.
5629
- *
6022
+ *
5630
6023
  * @example
5631
6024
  * ```typescript
5632
6025
  * // Graceful shutdown
@@ -5639,36 +6032,36 @@ _dec$14 = (0, __navios_di.Injectable)();
5639
6032
  await this.dispose();
5640
6033
  }
5641
6034
  static {
5642
- _initClass$14();
6035
+ _initClass$15();
5643
6036
  }
5644
6037
  });
5645
6038
  /**
5646
6039
  * Factory class for creating and configuring Navios applications.
5647
- *
6040
+ *
5648
6041
  * This is the main entry point for bootstrapping a Navios application.
5649
6042
  * It handles dependency injection container setup, adapter registration,
5650
6043
  * and logger configuration.
5651
- *
6044
+ *
5652
6045
  * @example
5653
6046
  * ```typescript
5654
6047
  * import { NaviosFactory } from '@navios/core'
5655
6048
  * import { defineFastifyEnvironment } from '@navios/adapter-fastify'
5656
- *
6049
+ *
5657
6050
  * const app = await NaviosFactory.create(AppModule, {
5658
6051
  * adapter: defineFastifyEnvironment(),
5659
6052
  * logger: ['log', 'error', 'warn'],
5660
6053
  * })
5661
- *
6054
+ *
5662
6055
  * await app.init()
5663
6056
  * await app.listen({ port: 3000 })
5664
6057
  * ```
5665
6058
  */ var NaviosFactory = class {
5666
6059
  /**
5667
6060
  * Creates a new Navios application instance.
5668
- *
6061
+ *
5669
6062
  * This method sets up the dependency injection container, registers the HTTP adapter,
5670
6063
  * configures logging, and initializes the application with the provided module.
5671
- *
6064
+ *
5672
6065
  * @param appModule - The root application module class decorated with @Module()
5673
6066
  * @param options - Configuration options for the application
5674
6067
  * @param options.adapter - HTTP adapter environment (required for HTTP server functionality)
@@ -5678,20 +6071,20 @@ _dec$14 = (0, __navios_di.Injectable)();
5678
6071
  * - `false` to disable logging
5679
6072
  * @param options.container - Optional custom dependency injection container (useful for testing)
5680
6073
  * @returns A configured NaviosApplication instance ready to be initialized
5681
- *
6074
+ *
5682
6075
  * @example
5683
6076
  * ```typescript
5684
6077
  * // Basic setup with Fastify adapter
5685
6078
  * const app = await NaviosFactory.create(AppModule, {
5686
6079
  * adapter: defineFastifyEnvironment(),
5687
6080
  * })
5688
- *
6081
+ *
5689
6082
  * // With custom logger configuration
5690
6083
  * const app = await NaviosFactory.create(AppModule, {
5691
6084
  * adapter: defineFastifyEnvironment(),
5692
6085
  * logger: ['error', 'warn', 'log'],
5693
6086
  * })
5694
- *
6087
+ *
5695
6088
  * // With custom container for testing
5696
6089
  * const container = new Container()
5697
6090
  * const app = await NaviosFactory.create(AppModule, {
@@ -5700,7 +6093,9 @@ _dec$14 = (0, __navios_di.Injectable)();
5700
6093
  * })
5701
6094
  * ```
5702
6095
  */ static async create(appModule, options = { adapter: [] }) {
5703
- const container = options.container ?? new __navios_di.Container();
6096
+ const container = options.container ?? new _navios_di.Container();
6097
+ if (options.enableRequestId === true) setRequestIdEnabled(true);
6098
+ container.getServiceLocator().getManager().storeCreatedHolder(NaviosOptionsToken.toString(), options, _navios_di.InjectableType.Class, _navios_di.InjectableScope.Singleton);
5704
6099
  await this.registerLoggerConfiguration(container, options);
5705
6100
  const adapters = Array.isArray(options.adapter) ? options.adapter : [options.adapter];
5706
6101
  for (const adapter of adapters) await this.registerEnvironment(container, adapter);
@@ -5715,8 +6110,11 @@ _dec$14 = (0, __navios_di.Injectable)();
5715
6110
  }
5716
6111
  static async registerLoggerConfiguration(container, options) {
5717
6112
  const { logger } = options;
5718
- if (Array.isArray(logger) || isNil(logger)) (await container.get(LoggerOutput))?.setup({ logLevels: logger });
5719
- if (logger !== true && !isNil(logger)) container.getServiceLocator().getManager().storeCreatedHolder(LoggerOutput.toString(), logger, __navios_di.InjectableType.Class, __navios_di.InjectableScope.Singleton);
6113
+ if (Array.isArray(logger) || isNil(logger)) {
6114
+ (await container.get(LoggerOutput))?.setup({ logLevels: logger });
6115
+ return;
6116
+ }
6117
+ if (logger !== true && !isNil(logger)) container.getServiceLocator().getManager().storeCreatedHolder(LoggerOutput.toString(), logger, _navios_di.InjectableType.Class, _navios_di.InjectableScope.Singleton);
5720
6118
  }
5721
6119
  };
5722
6120
 
@@ -5733,6 +6131,7 @@ var lib_exports = /* @__PURE__ */ __export({
5733
6131
  ConsoleLogger: () => _ConsoleLogger,
5734
6132
  Controller: () => Controller,
5735
6133
  ControllerMetadataKey: () => ControllerMetadataKey,
6134
+ ControllerResolverService: () => ControllerResolverService,
5736
6135
  Endpoint: () => Endpoint,
5737
6136
  EndpointAdapterFactory: () => _EndpointAdapterFactory,
5738
6137
  EndpointAdapterToken: () => EndpointAdapterToken,
@@ -5747,6 +6146,7 @@ var lib_exports = /* @__PURE__ */ __export({
5747
6146
  HttpAdapterToken: () => HttpAdapterToken,
5748
6147
  HttpCode: () => HttpCode,
5749
6148
  HttpException: () => HttpException,
6149
+ InstanceResolverService: () => _InstanceResolverService,
5750
6150
  InternalServerErrorException: () => InternalServerErrorException,
5751
6151
  LOG_LEVELS: () => LOG_LEVELS,
5752
6152
  Logger: () => Logger,
@@ -5760,6 +6160,7 @@ var lib_exports = /* @__PURE__ */ __export({
5760
6160
  MultipartAdapterToken: () => MultipartAdapterToken,
5761
6161
  NaviosApplication: () => _NaviosApplication,
5762
6162
  NaviosFactory: () => NaviosFactory,
6163
+ NaviosOptionsToken: () => NaviosOptionsToken,
5763
6164
  NotFoundException: () => NotFoundException,
5764
6165
  Reply: () => Reply,
5765
6166
  ReplyFactory: () => _ReplyFactory,
@@ -5779,6 +6180,7 @@ var lib_exports = /* @__PURE__ */ __export({
5779
6180
  extractControllerMetadata: () => extractControllerMetadata,
5780
6181
  extractModuleMetadata: () => extractModuleMetadata,
5781
6182
  filterLogLevels: () => filterLogLevels,
6183
+ generateRequestId: () => generateRequestId,
5782
6184
  getAllEndpointMetadata: () => getAllEndpointMetadata,
5783
6185
  getControllerMetadata: () => getControllerMetadata,
5784
6186
  getEndpointMetadata: () => getEndpointMetadata,
@@ -5801,8 +6203,8 @@ var lib_exports = /* @__PURE__ */ __export({
5801
6203
  loggerOptionsSchema: () => loggerOptionsSchema,
5802
6204
  normalizePath: () => normalizePath,
5803
6205
  provideConfig: () => provideConfig,
5804
- requestIdStore: () => requestIdStore,
5805
6206
  runWithRequestId: () => runWithRequestId,
6207
+ setRequestIdEnabled: () => setRequestIdEnabled,
5806
6208
  stripEndSlash: () => stripEndSlash,
5807
6209
  yellow: () => yellow
5808
6210
  });
@@ -7451,6 +7853,7 @@ var src_exports = /* @__PURE__ */ __export({
7451
7853
  ConsoleLogger: () => _ConsoleLogger,
7452
7854
  Controller: () => Controller,
7453
7855
  ControllerMetadataKey: () => ControllerMetadataKey,
7856
+ ControllerResolverService: () => ControllerResolverService,
7454
7857
  Endpoint: () => Endpoint,
7455
7858
  EndpointAdapterFactory: () => _EndpointAdapterFactory,
7456
7859
  EndpointAdapterToken: () => EndpointAdapterToken,
@@ -7465,6 +7868,7 @@ var src_exports = /* @__PURE__ */ __export({
7465
7868
  HttpAdapterToken: () => HttpAdapterToken,
7466
7869
  HttpCode: () => HttpCode,
7467
7870
  HttpException: () => HttpException,
7871
+ InstanceResolverService: () => _InstanceResolverService,
7468
7872
  InternalServerErrorException: () => InternalServerErrorException,
7469
7873
  LOG_LEVELS: () => LOG_LEVELS,
7470
7874
  Logger: () => Logger,
@@ -7478,6 +7882,7 @@ var src_exports = /* @__PURE__ */ __export({
7478
7882
  MultipartAdapterToken: () => MultipartAdapterToken,
7479
7883
  NaviosApplication: () => _NaviosApplication,
7480
7884
  NaviosFactory: () => NaviosFactory,
7885
+ NaviosOptionsToken: () => NaviosOptionsToken,
7481
7886
  NotFoundException: () => NotFoundException,
7482
7887
  Reply: () => Reply,
7483
7888
  ReplyFactory: () => _ReplyFactory,
@@ -7499,6 +7904,7 @@ var src_exports = /* @__PURE__ */ __export({
7499
7904
  extractControllerMetadata: () => extractControllerMetadata,
7500
7905
  extractModuleMetadata: () => extractModuleMetadata,
7501
7906
  filterLogLevels: () => filterLogLevels,
7907
+ generateRequestId: () => generateRequestId,
7502
7908
  getAllEndpointMetadata: () => getAllEndpointMetadata,
7503
7909
  getCliModuleMetadata: () => getCliModuleMetadata,
7504
7910
  getCommandMetadata: () => getCommandMetadata,
@@ -7525,8 +7931,8 @@ var src_exports = /* @__PURE__ */ __export({
7525
7931
  loggerOptionsSchema: () => loggerOptionsSchema,
7526
7932
  normalizePath: () => normalizePath,
7527
7933
  provideConfig: () => provideConfig,
7528
- requestIdStore: () => requestIdStore,
7529
7934
  runWithRequestId: () => runWithRequestId,
7935
+ setRequestIdEnabled: () => setRequestIdEnabled,
7530
7936
  stripEndSlash: () => stripEndSlash,
7531
7937
  yellow: () => yellow
7532
7938
  });
@@ -7578,6 +7984,7 @@ Object.defineProperty(exports, 'ConsoleLogger', {
7578
7984
  });
7579
7985
  exports.Controller = Controller;
7580
7986
  exports.ControllerMetadataKey = ControllerMetadataKey;
7987
+ exports.ControllerResolverService = ControllerResolverService;
7581
7988
  exports.Endpoint = Endpoint;
7582
7989
  Object.defineProperty(exports, 'EndpointAdapterFactory', {
7583
7990
  enumerable: true,
@@ -7607,6 +8014,12 @@ Object.defineProperty(exports, 'HttpAdapterFactory', {
7607
8014
  exports.HttpAdapterToken = HttpAdapterToken;
7608
8015
  exports.HttpCode = HttpCode;
7609
8016
  exports.HttpException = HttpException;
8017
+ Object.defineProperty(exports, 'InstanceResolverService', {
8018
+ enumerable: true,
8019
+ get: function () {
8020
+ return _InstanceResolverService;
8021
+ }
8022
+ });
7610
8023
  exports.InternalServerErrorException = InternalServerErrorException;
7611
8024
  exports.LOG_LEVELS = LOG_LEVELS;
7612
8025
  exports.Logger = Logger;
@@ -7640,6 +8053,7 @@ Object.defineProperty(exports, 'NaviosApplication', {
7640
8053
  }
7641
8054
  });
7642
8055
  exports.NaviosFactory = NaviosFactory;
8056
+ exports.NaviosOptionsToken = NaviosOptionsToken;
7643
8057
  exports.NotFoundException = NotFoundException;
7644
8058
  exports.Reply = Reply;
7645
8059
  Object.defineProperty(exports, 'ReplyFactory', {
@@ -7681,6 +8095,7 @@ exports.extractCommandMetadata = extractCommandMetadata;
7681
8095
  exports.extractControllerMetadata = extractControllerMetadata;
7682
8096
  exports.extractModuleMetadata = extractModuleMetadata;
7683
8097
  exports.filterLogLevels = filterLogLevels;
8098
+ exports.generateRequestId = generateRequestId;
7684
8099
  exports.getAllEndpointMetadata = getAllEndpointMetadata;
7685
8100
  exports.getCliModuleMetadata = getCliModuleMetadata;
7686
8101
  exports.getCommandMetadata = getCommandMetadata;
@@ -7707,14 +8122,14 @@ exports.isUndefined = isUndefined;
7707
8122
  exports.loggerOptionsSchema = loggerOptionsSchema;
7708
8123
  exports.normalizePath = normalizePath;
7709
8124
  exports.provideConfig = provideConfig;
7710
- exports.requestIdStore = requestIdStore;
7711
8125
  exports.runWithRequestId = runWithRequestId;
8126
+ exports.setRequestIdEnabled = setRequestIdEnabled;
7712
8127
  exports.stripEndSlash = stripEndSlash;
7713
8128
  exports.yellow = yellow;
7714
- Object.keys(__navios_di).forEach(function (k) {
8129
+ Object.keys(_navios_di).forEach(function (k) {
7715
8130
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
7716
8131
  enumerable: true,
7717
- get: function () { return __navios_di[k]; }
8132
+ get: function () { return _navios_di[k]; }
7718
8133
  });
7719
8134
  });
7720
8135