@navios/core 0.9.3 → 1.0.0-alpha.2

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 (67) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +4 -2
  3. package/docs/README.md +3 -1
  4. package/docs/exceptions.md +37 -1
  5. package/lib/{index-B2ulzZIr.d.cts → index-BJjk2X1S.d.mts} +478 -33
  6. package/lib/index-BJjk2X1S.d.mts.map +1 -0
  7. package/lib/{index-C8lUQePd.d.mts → index-DZ6NU03y.d.cts} +478 -33
  8. package/lib/index-DZ6NU03y.d.cts.map +1 -0
  9. package/lib/index.cjs +37 -2
  10. package/lib/index.d.cts +2 -2
  11. package/lib/index.d.mts +2 -2
  12. package/lib/index.mjs +3 -3
  13. package/lib/legacy-compat/index.cjs +8 -6
  14. package/lib/legacy-compat/index.cjs.map +1 -1
  15. package/lib/legacy-compat/index.d.cts +11 -16
  16. package/lib/legacy-compat/index.d.cts.map +1 -1
  17. package/lib/legacy-compat/index.d.mts +11 -16
  18. package/lib/legacy-compat/index.d.mts.map +1 -1
  19. package/lib/legacy-compat/index.mjs +7 -5
  20. package/lib/legacy-compat/index.mjs.map +1 -1
  21. package/lib/{src-Cu9OAnfp.cjs → src-C46ePe3d.cjs} +1970 -171
  22. package/lib/src-C46ePe3d.cjs.map +1 -0
  23. package/lib/{src-Baabu2R8.mjs → src-K2k0riYJ.mjs} +1941 -202
  24. package/lib/src-K2k0riYJ.mjs.map +1 -0
  25. package/lib/testing/index.cjs +2 -2
  26. package/lib/testing/index.d.cts +1 -1
  27. package/lib/testing/index.d.mts +1 -1
  28. package/lib/testing/index.mjs +2 -2
  29. package/lib/{use-guards.decorator-EvI2m2DK.cjs → use-guards.decorator-B6tghdxM.cjs} +7 -4
  30. package/lib/use-guards.decorator-B6tghdxM.cjs.map +1 -0
  31. package/lib/{use-guards.decorator-ChJVzYLW.mjs → use-guards.decorator-Be_QUx6b.mjs} +6 -3
  32. package/lib/use-guards.decorator-Be_QUx6b.mjs.map +1 -0
  33. package/package.json +3 -3
  34. package/src/__tests__/responders.spec.mts +339 -0
  35. package/src/decorators/endpoint.decorator.mts +49 -97
  36. package/src/decorators/module.decorator.mts +12 -0
  37. package/src/decorators/multipart.decorator.mts +62 -87
  38. package/src/decorators/stream.decorator.mts +66 -76
  39. package/src/index.mts +1 -0
  40. package/src/legacy-compat/__type-tests__/legacy-decorators.spec-d.mts +0 -2
  41. package/src/legacy-compat/decorators/endpoint.decorator.mts +21 -47
  42. package/src/legacy-compat/decorators/multipart.decorator.mts +20 -41
  43. package/src/legacy-compat/decorators/stream.decorator.mts +48 -42
  44. package/src/metadata/module.metadata.mts +2 -0
  45. package/src/responders/enums/framework-error.enum.mts +38 -0
  46. package/src/responders/enums/index.mts +1 -0
  47. package/src/responders/index.mts +4 -0
  48. package/src/responders/interfaces/error-responder.interface.mts +42 -0
  49. package/src/responders/interfaces/error-response.interface.mts +22 -0
  50. package/src/responders/interfaces/index.mts +3 -0
  51. package/src/responders/interfaces/problem-details.interface.mts +34 -0
  52. package/src/responders/services/error-response-producer.service.mts +143 -0
  53. package/src/responders/services/forbidden-responder.service.mts +77 -0
  54. package/src/responders/services/index.mts +5 -0
  55. package/src/responders/services/internal-server-error-responder.service.mts +57 -0
  56. package/src/responders/services/not-found-responder.service.mts +76 -0
  57. package/src/responders/services/validation-error-responder.service.mts +78 -0
  58. package/src/responders/tokens/index.mts +1 -0
  59. package/src/responders/tokens/responder.tokens.mts +84 -0
  60. package/src/services/guard-runner.service.mts +19 -6
  61. package/src/services/module-loader.service.mts +63 -0
  62. package/lib/index-B2ulzZIr.d.cts.map +0 -1
  63. package/lib/index-C8lUQePd.d.mts.map +0 -1
  64. package/lib/src-Baabu2R8.mjs.map +0 -1
  65. package/lib/src-Cu9OAnfp.cjs.map +0 -1
  66. package/lib/use-guards.decorator-ChJVzYLW.mjs.map +0 -1
  67. package/lib/use-guards.decorator-EvI2m2DK.cjs.map +0 -1
@@ -25,7 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  }) : target, mod));
26
26
 
27
27
  //#endregion
28
- const require_use_guards_decorator = require('./use-guards.decorator-EvI2m2DK.cjs');
28
+ const require_use_guards_decorator = require('./use-guards.decorator-B6tghdxM.cjs');
29
29
  let _navios_di = require("@navios/di");
30
30
  let node_process = require("node:process");
31
31
  let zod_v4 = require("zod/v4");
@@ -229,7 +229,7 @@ function getRequestIdStore() {
229
229
 
230
230
  //#endregion
231
231
  //#region src/logger/console-logger.service.mts
232
- function applyDecs2203RFactory$14() {
232
+ function applyDecs2203RFactory$19() {
233
233
  function createAddInitializerMethod(initializers, decoratorFinishedRef) {
234
234
  return function addInitializer(initializer) {
235
235
  assertNotFinished(decoratorFinishedRef, "addInitializer");
@@ -503,10 +503,10 @@ function applyDecs2203RFactory$14() {
503
503
  };
504
504
  };
505
505
  }
506
- function _apply_decs_2203_r$14(targetClass, memberDecs, classDecs, parentClass) {
507
- return (_apply_decs_2203_r$14 = applyDecs2203RFactory$14())(targetClass, memberDecs, classDecs, parentClass);
506
+ function _apply_decs_2203_r$19(targetClass, memberDecs, classDecs, parentClass) {
507
+ return (_apply_decs_2203_r$19 = applyDecs2203RFactory$19())(targetClass, memberDecs, classDecs, parentClass);
508
508
  }
509
- var _dec$14, _initClass$14;
509
+ var _dec$19, _initClass$19;
510
510
  const DEFAULT_DEPTH = 5;
511
511
  const DEFAULT_LOG_LEVELS = [
512
512
  "log",
@@ -525,10 +525,10 @@ const dateTimeFormatter = new Intl.DateTimeFormat(void 0, {
525
525
  month: "2-digit"
526
526
  });
527
527
  let _ConsoleLogger;
528
- _dec$14 = (0, _navios_di.Injectable)({ token: LoggerOutput });
528
+ _dec$19 = (0, _navios_di.Injectable)({ token: LoggerOutput });
529
529
  var ConsoleLogger = class {
530
530
  static {
531
- ({c: [_ConsoleLogger, _initClass$14]} = _apply_decs_2203_r$14(this, [], [_dec$14]));
531
+ ({c: [_ConsoleLogger, _initClass$19]} = _apply_decs_2203_r$19(this, [], [_dec$19]));
532
532
  }
533
533
  /**
534
534
  * The options of the logger.
@@ -777,13 +777,13 @@ var ConsoleLogger = class {
777
777
  }
778
778
  }
779
779
  static {
780
- _initClass$14();
780
+ _initClass$19();
781
781
  }
782
782
  };
783
783
 
784
784
  //#endregion
785
785
  //#region src/logger/logger.service.mts
786
- function applyDecs2203RFactory$13() {
786
+ function applyDecs2203RFactory$18() {
787
787
  function createAddInitializerMethod(initializers, decoratorFinishedRef) {
788
788
  return function addInitializer(initializer) {
789
789
  assertNotFinished(decoratorFinishedRef, "addInitializer");
@@ -1057,15 +1057,15 @@ function applyDecs2203RFactory$13() {
1057
1057
  };
1058
1058
  };
1059
1059
  }
1060
- function _apply_decs_2203_r$13(targetClass, memberDecs, classDecs, parentClass) {
1061
- return (_apply_decs_2203_r$13 = applyDecs2203RFactory$13())(targetClass, memberDecs, classDecs, parentClass);
1060
+ function _apply_decs_2203_r$18(targetClass, memberDecs, classDecs, parentClass) {
1061
+ return (_apply_decs_2203_r$18 = applyDecs2203RFactory$18())(targetClass, memberDecs, classDecs, parentClass);
1062
1062
  }
1063
- var _dec$13, _initClass$13;
1063
+ var _dec$18, _initClass$18;
1064
1064
  let _LoggerInstance;
1065
- _dec$13 = (0, _navios_di.Injectable)({ token: Logger });
1065
+ _dec$18 = (0, _navios_di.Injectable)({ token: Logger });
1066
1066
  var LoggerInstance = class {
1067
1067
  static {
1068
- ({c: [_LoggerInstance, _initClass$13]} = _apply_decs_2203_r$13(this, [], [_dec$13]));
1068
+ ({c: [_LoggerInstance, _initClass$18]} = _apply_decs_2203_r$18(this, [], [_dec$18]));
1069
1069
  }
1070
1070
  constructor(config = {}) {
1071
1071
  this.context = config.context;
@@ -1097,13 +1097,13 @@ var LoggerInstance = class {
1097
1097
  this.localInstance?.fatal?.(message, ...optionalParams);
1098
1098
  }
1099
1099
  static {
1100
- _initClass$13();
1100
+ _initClass$18();
1101
1101
  }
1102
1102
  };
1103
1103
 
1104
1104
  //#endregion
1105
1105
  //#region src/config/config.service.mts
1106
- function applyDecs2203RFactory$12() {
1106
+ function applyDecs2203RFactory$17() {
1107
1107
  function createAddInitializerMethod(initializers, decoratorFinishedRef) {
1108
1108
  return function addInitializer(initializer) {
1109
1109
  assertNotFinished(decoratorFinishedRef, "addInitializer");
@@ -1377,10 +1377,10 @@ function applyDecs2203RFactory$12() {
1377
1377
  };
1378
1378
  };
1379
1379
  }
1380
- function _apply_decs_2203_r$12(targetClass, memberDecs, classDecs, parentClass) {
1381
- return (_apply_decs_2203_r$12 = applyDecs2203RFactory$12())(targetClass, memberDecs, classDecs, parentClass);
1380
+ function _apply_decs_2203_r$17(targetClass, memberDecs, classDecs, parentClass) {
1381
+ return (_apply_decs_2203_r$17 = applyDecs2203RFactory$17())(targetClass, memberDecs, classDecs, parentClass);
1382
1382
  }
1383
- var _dec$12, _initClass$12;
1383
+ var _dec$17, _initClass$17;
1384
1384
  /**
1385
1385
  * Schema for validating configuration service options.
1386
1386
  */ const ConfigServiceOptionsSchema = zod_v4.z.record(zod_v4.z.string(), zod_v4.z.unknown());
@@ -1388,11 +1388,11 @@ var _dec$12, _initClass$12;
1388
1388
  * Injection token for ConfigService.
1389
1389
  */ const ConfigServiceToken = _navios_di.InjectionToken.create(Symbol.for("ConfigService"), ConfigServiceOptionsSchema);
1390
1390
  let _ConfigService;
1391
- _dec$12 = (0, _navios_di.Injectable)({ token: ConfigServiceToken });
1391
+ _dec$17 = (0, _navios_di.Injectable)({ token: ConfigServiceToken });
1392
1392
  var ConfigService = class {
1393
1393
  config;
1394
1394
  static {
1395
- ({c: [_ConfigService, _initClass$12]} = _apply_decs_2203_r$12(this, [], [_dec$12]));
1395
+ ({c: [_ConfigService, _initClass$17]} = _apply_decs_2203_r$17(this, [], [_dec$17]));
1396
1396
  }
1397
1397
  /**
1398
1398
  * Creates a new ConfigService instance.
@@ -1474,7 +1474,7 @@ var ConfigService = class {
1474
1474
  return value;
1475
1475
  }
1476
1476
  static {
1477
- _initClass$12();
1477
+ _initClass$17();
1478
1478
  }
1479
1479
  };
1480
1480
 
@@ -1581,156 +1581,1870 @@ var ConfigService = class {
1581
1581
  */ constructor(message) {
1582
1582
  super(400, message);
1583
1583
  }
1584
- };
1585
-
1586
- //#endregion
1587
- //#region src/exceptions/forbidden.exception.mts
1588
- /**
1589
- * Exception that represents a 403 Forbidden HTTP error.
1590
- *
1591
- * Use this exception when the client is authenticated but does not have
1592
- * permission to access the requested resource.
1593
- *
1594
- * @example
1595
- * ```typescript
1596
- * @Endpoint(deleteUserEndpoint)
1597
- * @UseGuards(AuthGuard, RoleGuard)
1598
- * async deleteUser(request: EndpointParams<typeof deleteUserEndpoint>) {
1599
- * if (!this.userService.hasPermission(request.user, 'delete')) {
1600
- * throw new ForbiddenException('Insufficient permissions')
1601
- * }
1602
- * // ...
1603
- * }
1604
- * ```
1605
- */ var ForbiddenException = class extends HttpException {
1606
- /**
1607
- * Creates a new ForbiddenException.
1608
- *
1609
- * @param message - Error message
1610
- */ constructor(message) {
1611
- super(403, message);
1584
+ };
1585
+
1586
+ //#endregion
1587
+ //#region src/exceptions/forbidden.exception.mts
1588
+ /**
1589
+ * Exception that represents a 403 Forbidden HTTP error.
1590
+ *
1591
+ * Use this exception when the client is authenticated but does not have
1592
+ * permission to access the requested resource.
1593
+ *
1594
+ * @example
1595
+ * ```typescript
1596
+ * @Endpoint(deleteUserEndpoint)
1597
+ * @UseGuards(AuthGuard, RoleGuard)
1598
+ * async deleteUser(request: EndpointParams<typeof deleteUserEndpoint>) {
1599
+ * if (!this.userService.hasPermission(request.user, 'delete')) {
1600
+ * throw new ForbiddenException('Insufficient permissions')
1601
+ * }
1602
+ * // ...
1603
+ * }
1604
+ * ```
1605
+ */ var ForbiddenException = class extends HttpException {
1606
+ /**
1607
+ * Creates a new ForbiddenException.
1608
+ *
1609
+ * @param message - Error message
1610
+ */ constructor(message) {
1611
+ super(403, message);
1612
+ }
1613
+ };
1614
+
1615
+ //#endregion
1616
+ //#region src/exceptions/internal-server-error.exception.mts
1617
+ /**
1618
+ * Exception that represents a 500 Internal Server Error HTTP error.
1619
+ *
1620
+ * Use this exception when an unexpected error occurs on the server.
1621
+ * Generally, you should let unhandled errors bubble up rather than catching
1622
+ * and rethrowing as InternalServerErrorException, as Navios will handle them appropriately.
1623
+ *
1624
+ * @example
1625
+ * ```typescript
1626
+ * @Endpoint(processPaymentEndpoint)
1627
+ * async processPayment(request: EndpointParams<typeof processPaymentEndpoint>) {
1628
+ * try {
1629
+ * return await this.paymentService.process(request.data)
1630
+ * } catch (error) {
1631
+ * this.logger.error('Payment processing failed', error)
1632
+ * throw new InternalServerErrorException('Payment processing failed', error)
1633
+ * }
1634
+ * }
1635
+ * ```
1636
+ */ var InternalServerErrorException = class extends HttpException {
1637
+ /**
1638
+ * Creates a new InternalServerErrorException.
1639
+ *
1640
+ * @param message - Error message or response object
1641
+ * @param error - Optional underlying error for logging
1642
+ */ constructor(message, error) {
1643
+ super(500, message, error);
1644
+ }
1645
+ };
1646
+
1647
+ //#endregion
1648
+ //#region src/exceptions/not-found.exception.mts
1649
+ /**
1650
+ * Exception that represents a 404 Not Found HTTP error.
1651
+ *
1652
+ * Use this exception when the requested resource does not exist.
1653
+ *
1654
+ * @example
1655
+ * ```typescript
1656
+ * @Endpoint(getUserEndpoint)
1657
+ * async getUser(request: EndpointParams<typeof getUserEndpoint>) {
1658
+ * const user = await this.userService.findById(request.urlParams.userId)
1659
+ * if (!user) {
1660
+ * throw new NotFoundException('User not found')
1661
+ * }
1662
+ * return user
1663
+ * }
1664
+ * ```
1665
+ */ var NotFoundException = class extends HttpException {
1666
+ response;
1667
+ error;
1668
+ /**
1669
+ * Creates a new NotFoundException.
1670
+ *
1671
+ * @param response - Error message or response object
1672
+ * @param error - Optional underlying error for logging
1673
+ */ constructor(response, error) {
1674
+ super(404, response, error), this.response = response, this.error = error;
1675
+ }
1676
+ };
1677
+
1678
+ //#endregion
1679
+ //#region src/exceptions/unauthorized.exception.mts
1680
+ /**
1681
+ * Exception that represents a 401 Unauthorized HTTP error.
1682
+ *
1683
+ * Use this exception when the client is not authenticated or authentication failed.
1684
+ *
1685
+ * @example
1686
+ * ```typescript
1687
+ * @Endpoint(getUserEndpoint)
1688
+ * @UseGuards(AuthGuard)
1689
+ * async getUser(request: EndpointParams<typeof getUserEndpoint>) {
1690
+ * if (!request.headers.authorization) {
1691
+ * throw new UnauthorizedException('Authentication required')
1692
+ * }
1693
+ * // ...
1694
+ * }
1695
+ * ```
1696
+ */ var UnauthorizedException = class extends HttpException {
1697
+ /**
1698
+ * Creates a new UnauthorizedException.
1699
+ *
1700
+ * @param message - Error message or response object
1701
+ * @param error - Optional underlying error for logging
1702
+ */ constructor(message, error) {
1703
+ super(401, message, error);
1704
+ }
1705
+ };
1706
+
1707
+ //#endregion
1708
+ //#region src/exceptions/conflict.exception.mts
1709
+ /**
1710
+ * Exception that represents a 409 Conflict HTTP error.
1711
+ *
1712
+ * Use this exception when the request conflicts with the current state of the resource
1713
+ * (e.g., trying to create a resource that already exists).
1714
+ *
1715
+ * @example
1716
+ * ```typescript
1717
+ * @Endpoint(createUserEndpoint)
1718
+ * async createUser(request: EndpointParams<typeof createUserEndpoint>) {
1719
+ * const existing = await this.userService.findByEmail(request.data.email)
1720
+ * if (existing) {
1721
+ * throw new ConflictException('User with this email already exists')
1722
+ * }
1723
+ * // ...
1724
+ * }
1725
+ * ```
1726
+ */ var ConflictException = class extends HttpException {
1727
+ /**
1728
+ * Creates a new ConflictException.
1729
+ *
1730
+ * @param message - Error message or response object
1731
+ * @param error - Optional underlying error for logging
1732
+ */ constructor(message, error) {
1733
+ super(409, message, error);
1734
+ }
1735
+ };
1736
+
1737
+ //#endregion
1738
+ //#region src/responders/enums/framework-error.enum.mts
1739
+ /**
1740
+ * Enumeration of framework-level error types.
1741
+ * Used to explicitly specify which error responder should handle an error.
1742
+ *
1743
+ * @example
1744
+ * ```typescript
1745
+ * // In adapter error handling
1746
+ * if (error instanceof ZodError) {
1747
+ * return errorProducer.respond(FrameworkError.ValidationError, error)
1748
+ * }
1749
+ * return errorProducer.handleUnknown(error)
1750
+ * ```
1751
+ */ var FrameworkError = /* @__PURE__ */ function(FrameworkError$1) {
1752
+ /**
1753
+ * Resource not found (HTTP 404).
1754
+ * Use when a requested resource does not exist.
1755
+ */ FrameworkError$1["NotFound"] = "NotFound";
1756
+ /**
1757
+ * Forbidden (HTTP 403).
1758
+ * Use when access to a resource is denied (e.g., guard rejection).
1759
+ */ FrameworkError$1["Forbidden"] = "Forbidden";
1760
+ /**
1761
+ * Internal server error (HTTP 500).
1762
+ * Use for unexpected errors that don't fit other categories.
1763
+ */ FrameworkError$1["InternalServerError"] = "InternalServerError";
1764
+ /**
1765
+ * Validation error (HTTP 400).
1766
+ * Use when request data fails validation (e.g., Zod errors).
1767
+ */ FrameworkError$1["ValidationError"] = "ValidationError";
1768
+ return FrameworkError$1;
1769
+ }({});
1770
+
1771
+ //#endregion
1772
+ //#region src/responders/tokens/responder.tokens.mts
1773
+ /**
1774
+ * Injection token for the Internal Server Error responder.
1775
+ * Default implementation returns HTTP 500 with RFC 7807 Problem Details.
1776
+ *
1777
+ * @example Override with custom implementation:
1778
+ * ```typescript
1779
+ * @Injectable({
1780
+ * token: InternalServerErrorResponderToken,
1781
+ * priority: 0, // Higher than default -10
1782
+ * })
1783
+ * export class CustomInternalErrorResponder implements ErrorResponder {
1784
+ * getResponse(error: unknown, description?: string): ErrorResponse {
1785
+ * // Custom implementation
1786
+ * }
1787
+ * }
1788
+ * ```
1789
+ */ const InternalServerErrorResponderToken = _navios_di.InjectionToken.create("InternalServerErrorResponder");
1790
+ /**
1791
+ * Injection token for the Not Found responder.
1792
+ * Default implementation returns HTTP 404 with RFC 7807 Problem Details.
1793
+ *
1794
+ * @example Override with custom implementation:
1795
+ * ```typescript
1796
+ * @Injectable({
1797
+ * token: NotFoundResponderToken,
1798
+ * priority: 0, // Higher than default -10
1799
+ * })
1800
+ * export class CustomNotFoundResponder implements ErrorResponder {
1801
+ * getResponse(error: unknown, description?: string): ErrorResponse {
1802
+ * // Custom implementation
1803
+ * }
1804
+ * }
1805
+ * ```
1806
+ */ const NotFoundResponderToken = _navios_di.InjectionToken.create("NotFoundResponder");
1807
+ /**
1808
+ * Injection token for the Validation Error responder.
1809
+ * Default implementation returns HTTP 400 with RFC 7807 Problem Details
1810
+ * and includes validation errors from ZodError.
1811
+ *
1812
+ * @example Override with custom implementation:
1813
+ * ```typescript
1814
+ * @Injectable({
1815
+ * token: ValidationErrorResponderToken,
1816
+ * priority: 0, // Higher than default -10
1817
+ * })
1818
+ * export class CustomValidationResponder implements ErrorResponder {
1819
+ * getResponse(error: unknown, description?: string): ErrorResponse {
1820
+ * // Custom implementation
1821
+ * }
1822
+ * }
1823
+ * ```
1824
+ */ const ValidationErrorResponderToken = _navios_di.InjectionToken.create("ValidationErrorResponder");
1825
+ /**
1826
+ * Injection token for the Forbidden responder.
1827
+ * Default implementation returns HTTP 403 with RFC 7807 Problem Details.
1828
+ *
1829
+ * @example Override with custom implementation:
1830
+ * ```typescript
1831
+ * @Injectable({
1832
+ * token: ForbiddenResponderToken,
1833
+ * priority: 0, // Higher than default -10
1834
+ * })
1835
+ * export class CustomForbiddenResponder implements ErrorResponder {
1836
+ * getResponse(error: unknown, description?: string): ErrorResponse {
1837
+ * // Custom implementation
1838
+ * }
1839
+ * }
1840
+ * ```
1841
+ */ const ForbiddenResponderToken = _navios_di.InjectionToken.create("ForbiddenResponder");
1842
+
1843
+ //#endregion
1844
+ //#region src/responders/services/error-response-producer.service.mts
1845
+ function applyDecs2203RFactory$16() {
1846
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
1847
+ return function addInitializer(initializer) {
1848
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
1849
+ assertCallable(initializer, "An initializer");
1850
+ initializers.push(initializer);
1851
+ };
1852
+ }
1853
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
1854
+ var kindStr;
1855
+ switch (kind) {
1856
+ case 1:
1857
+ kindStr = "accessor";
1858
+ break;
1859
+ case 2:
1860
+ kindStr = "method";
1861
+ break;
1862
+ case 3:
1863
+ kindStr = "getter";
1864
+ break;
1865
+ case 4:
1866
+ kindStr = "setter";
1867
+ break;
1868
+ default: kindStr = "field";
1869
+ }
1870
+ var ctx = {
1871
+ kind: kindStr,
1872
+ name: isPrivate ? "#" + name : name,
1873
+ static: isStatic,
1874
+ private: isPrivate,
1875
+ metadata
1876
+ };
1877
+ var decoratorFinishedRef = { v: false };
1878
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
1879
+ var get, set;
1880
+ if (kind === 0) if (isPrivate) {
1881
+ get = desc.get;
1882
+ set = desc.set;
1883
+ } else {
1884
+ get = function() {
1885
+ return this[name];
1886
+ };
1887
+ set = function(v) {
1888
+ this[name] = v;
1889
+ };
1890
+ }
1891
+ else if (kind === 2) get = function() {
1892
+ return desc.value;
1893
+ };
1894
+ else {
1895
+ if (kind === 1 || kind === 3) get = function() {
1896
+ return desc.get.call(this);
1897
+ };
1898
+ if (kind === 1 || kind === 4) set = function(v) {
1899
+ desc.set.call(this, v);
1900
+ };
1901
+ }
1902
+ ctx.access = get && set ? {
1903
+ get,
1904
+ set
1905
+ } : get ? { get } : { set };
1906
+ try {
1907
+ return dec(value, ctx);
1908
+ } finally {
1909
+ decoratorFinishedRef.v = true;
1910
+ }
1911
+ }
1912
+ function assertNotFinished(decoratorFinishedRef, fnName) {
1913
+ if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
1914
+ }
1915
+ function assertCallable(fn, hint) {
1916
+ if (typeof fn !== "function") throw new TypeError(hint + " must be a function");
1917
+ }
1918
+ function assertValidReturnValue(kind, value) {
1919
+ var type = typeof value;
1920
+ if (kind === 1) {
1921
+ if (type !== "object" || value === null) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
1922
+ if (value.get !== void 0) assertCallable(value.get, "accessor.get");
1923
+ if (value.set !== void 0) assertCallable(value.set, "accessor.set");
1924
+ if (value.init !== void 0) assertCallable(value.init, "accessor.init");
1925
+ } else if (type !== "function") {
1926
+ var hint;
1927
+ if (kind === 0) hint = "field";
1928
+ else if (kind === 10) hint = "class";
1929
+ else hint = "method";
1930
+ throw new TypeError(hint + " decorators must return a function or void 0");
1931
+ }
1932
+ }
1933
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
1934
+ var decs = decInfo[0];
1935
+ var desc, init, value;
1936
+ if (isPrivate) if (kind === 0 || kind === 1) desc = {
1937
+ get: decInfo[3],
1938
+ set: decInfo[4]
1939
+ };
1940
+ else if (kind === 3) desc = { get: decInfo[3] };
1941
+ else if (kind === 4) desc = { set: decInfo[3] };
1942
+ else desc = { value: decInfo[3] };
1943
+ else if (kind !== 0) desc = Object.getOwnPropertyDescriptor(base, name);
1944
+ if (kind === 1) value = {
1945
+ get: desc.get,
1946
+ set: desc.set
1947
+ };
1948
+ else if (kind === 2) value = desc.value;
1949
+ else if (kind === 3) value = desc.get;
1950
+ else if (kind === 4) value = desc.set;
1951
+ var newValue, get, set;
1952
+ if (typeof decs === "function") {
1953
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
1954
+ if (newValue !== void 0) {
1955
+ assertValidReturnValue(kind, newValue);
1956
+ if (kind === 0) init = newValue;
1957
+ else if (kind === 1) {
1958
+ init = newValue.init;
1959
+ get = newValue.get || value.get;
1960
+ set = newValue.set || value.set;
1961
+ value = {
1962
+ get,
1963
+ set
1964
+ };
1965
+ } else value = newValue;
1966
+ }
1967
+ } else for (var i = decs.length - 1; i >= 0; i--) {
1968
+ var dec = decs[i];
1969
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
1970
+ if (newValue !== void 0) {
1971
+ assertValidReturnValue(kind, newValue);
1972
+ var newInit;
1973
+ if (kind === 0) newInit = newValue;
1974
+ else if (kind === 1) {
1975
+ newInit = newValue.init;
1976
+ get = newValue.get || value.get;
1977
+ set = newValue.set || value.set;
1978
+ value = {
1979
+ get,
1980
+ set
1981
+ };
1982
+ } else value = newValue;
1983
+ if (newInit !== void 0) if (init === void 0) init = newInit;
1984
+ else if (typeof init === "function") init = [init, newInit];
1985
+ else init.push(newInit);
1986
+ }
1987
+ }
1988
+ if (kind === 0 || kind === 1) {
1989
+ if (init === void 0) init = function(instance, init$1) {
1990
+ return init$1;
1991
+ };
1992
+ else if (typeof init !== "function") {
1993
+ var ownInitializers = init;
1994
+ init = function(instance, init$1) {
1995
+ var value$1 = init$1;
1996
+ for (var i$1 = 0; i$1 < ownInitializers.length; i$1++) value$1 = ownInitializers[i$1].call(instance, value$1);
1997
+ return value$1;
1998
+ };
1999
+ } else {
2000
+ var originalInitializer = init;
2001
+ init = function(instance, init$1) {
2002
+ return originalInitializer.call(instance, init$1);
2003
+ };
2004
+ }
2005
+ ret.push(init);
2006
+ }
2007
+ if (kind !== 0) {
2008
+ if (kind === 1) {
2009
+ desc.get = value.get;
2010
+ desc.set = value.set;
2011
+ } else if (kind === 2) desc.value = value;
2012
+ else if (kind === 3) desc.get = value;
2013
+ else if (kind === 4) desc.set = value;
2014
+ if (isPrivate) if (kind === 1) {
2015
+ ret.push(function(instance, args) {
2016
+ return value.get.call(instance, args);
2017
+ });
2018
+ ret.push(function(instance, args) {
2019
+ return value.set.call(instance, args);
2020
+ });
2021
+ } else if (kind === 2) ret.push(value);
2022
+ else ret.push(function(instance, args) {
2023
+ return value.call(instance, args);
2024
+ });
2025
+ else Object.defineProperty(base, name, desc);
2026
+ }
2027
+ }
2028
+ function applyMemberDecs(Class, decInfos, metadata) {
2029
+ var ret = [];
2030
+ var protoInitializers;
2031
+ var staticInitializers;
2032
+ var existingProtoNonFields = /* @__PURE__ */ new Map();
2033
+ var existingStaticNonFields = /* @__PURE__ */ new Map();
2034
+ for (var i = 0; i < decInfos.length; i++) {
2035
+ var decInfo = decInfos[i];
2036
+ if (!Array.isArray(decInfo)) continue;
2037
+ var kind = decInfo[1];
2038
+ var name = decInfo[2];
2039
+ var isPrivate = decInfo.length > 3;
2040
+ var isStatic = kind >= 5;
2041
+ var base;
2042
+ var initializers;
2043
+ if (isStatic) {
2044
+ base = Class;
2045
+ kind = kind - 5;
2046
+ staticInitializers = staticInitializers || [];
2047
+ initializers = staticInitializers;
2048
+ } else {
2049
+ base = Class.prototype;
2050
+ protoInitializers = protoInitializers || [];
2051
+ initializers = protoInitializers;
2052
+ }
2053
+ if (kind !== 0 && !isPrivate) {
2054
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
2055
+ var existingKind = existingNonFields.get(name) || 0;
2056
+ 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);
2057
+ else if (!existingKind && kind > 2) existingNonFields.set(name, kind);
2058
+ else existingNonFields.set(name, true);
2059
+ }
2060
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
2061
+ }
2062
+ pushInitializers(ret, protoInitializers);
2063
+ pushInitializers(ret, staticInitializers);
2064
+ return ret;
2065
+ }
2066
+ function pushInitializers(ret, initializers) {
2067
+ if (initializers) ret.push(function(instance) {
2068
+ for (var i = 0; i < initializers.length; i++) initializers[i].call(instance);
2069
+ return instance;
2070
+ });
2071
+ }
2072
+ function applyClassDecs(targetClass, classDecs, metadata) {
2073
+ if (classDecs.length > 0) {
2074
+ var initializers = [];
2075
+ var newClass = targetClass;
2076
+ var name = targetClass.name;
2077
+ for (var i = classDecs.length - 1; i >= 0; i--) {
2078
+ var decoratorFinishedRef = { v: false };
2079
+ try {
2080
+ var nextNewClass = classDecs[i](newClass, {
2081
+ kind: "class",
2082
+ name,
2083
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
2084
+ metadata
2085
+ });
2086
+ } finally {
2087
+ decoratorFinishedRef.v = true;
2088
+ }
2089
+ if (nextNewClass !== void 0) {
2090
+ assertValidReturnValue(10, nextNewClass);
2091
+ newClass = nextNewClass;
2092
+ }
2093
+ }
2094
+ return [defineMetadata(newClass, metadata), function() {
2095
+ for (var i$1 = 0; i$1 < initializers.length; i$1++) initializers[i$1].call(newClass);
2096
+ }];
2097
+ }
2098
+ }
2099
+ function defineMetadata(Class, metadata) {
2100
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
2101
+ configurable: true,
2102
+ enumerable: true,
2103
+ value: metadata
2104
+ });
2105
+ }
2106
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
2107
+ if (parentClass !== void 0) var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
2108
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
2109
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
2110
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
2111
+ return {
2112
+ e,
2113
+ get c() {
2114
+ return applyClassDecs(targetClass, classDecs, metadata);
2115
+ }
2116
+ };
2117
+ };
2118
+ }
2119
+ function _apply_decs_2203_r$16(targetClass, memberDecs, classDecs, parentClass) {
2120
+ return (_apply_decs_2203_r$16 = applyDecs2203RFactory$16())(targetClass, memberDecs, classDecs, parentClass);
2121
+ }
2122
+ var _dec$16, _initClass$16;
2123
+ let _ErrorResponseProducerService;
2124
+ _dec$16 = (0, _navios_di.Injectable)();
2125
+ var ErrorResponseProducerService = class {
2126
+ static {
2127
+ ({c: [_ErrorResponseProducerService, _initClass$16]} = _apply_decs_2203_r$16(this, [], [_dec$16]));
2128
+ }
2129
+ forbiddenResponder = (0, _navios_di.inject)(ForbiddenResponderToken);
2130
+ internalServerErrorResponder = (0, _navios_di.inject)(InternalServerErrorResponderToken);
2131
+ notFoundResponder = (0, _navios_di.inject)(NotFoundResponderToken);
2132
+ validationErrorResponder = (0, _navios_di.inject)(ValidationErrorResponderToken);
2133
+ /**
2134
+ * Produces an error response for a specific framework error type.
2135
+ *
2136
+ * @param type - The type of framework error (from FrameworkError enum)
2137
+ * @param error - The original error that was thrown
2138
+ * @param description - Optional custom description to include in the response
2139
+ * @returns ErrorResponse with status code, RFC 7807 payload, and headers
2140
+ */ respond(type, error, description) {
2141
+ switch (type) {
2142
+ case FrameworkError.NotFound: return this.notFoundResponder.getResponse(error, description);
2143
+ case FrameworkError.Forbidden: return this.forbiddenResponder.getResponse(error, description);
2144
+ case FrameworkError.InternalServerError: return this.internalServerErrorResponder.getResponse(error, description);
2145
+ case FrameworkError.ValidationError: return this.validationErrorResponder.getResponse(error, description);
2146
+ }
2147
+ }
2148
+ /**
2149
+ * Handles unknown errors by producing an Internal Server Error response.
2150
+ *
2151
+ * Use this as a fallback when the error type is not known or doesn't
2152
+ * match any specific framework error type.
2153
+ *
2154
+ * @param error - The original error that was thrown
2155
+ * @param description - Optional custom description to include in the response
2156
+ * @returns ErrorResponse with 500 status code
2157
+ */ handleUnknown(error, description) {
2158
+ return this.internalServerErrorResponder.getResponse(error, description);
2159
+ }
2160
+ /**
2161
+ * Convenience method to produce a Not Found error response.
2162
+ *
2163
+ * @param error - The original error that was thrown
2164
+ * @param description - Optional custom description
2165
+ * @returns ErrorResponse with 404 status code
2166
+ */ notFound(error, description) {
2167
+ return this.notFoundResponder.getResponse(error, description);
2168
+ }
2169
+ /**
2170
+ * Convenience method to produce a Validation Error response.
2171
+ *
2172
+ * @param error - The original error (typically a ZodError)
2173
+ * @param description - Optional custom description
2174
+ * @returns ErrorResponse with 400 status code
2175
+ */ validationError(error, description) {
2176
+ return this.validationErrorResponder.getResponse(error, description);
2177
+ }
2178
+ /**
2179
+ * Convenience method to produce an Internal Server Error response.
2180
+ *
2181
+ * @param error - The original error
2182
+ * @param description - Optional custom description
2183
+ * @returns ErrorResponse with 500 status code
2184
+ */ internalServerError(error, description) {
2185
+ return this.internalServerErrorResponder.getResponse(error, description);
2186
+ }
2187
+ /**
2188
+ * Convenience method to produce a Forbidden error response.
2189
+ *
2190
+ * @param error - The original error
2191
+ * @param description - Optional custom description
2192
+ * @returns ErrorResponse with 403 status code
2193
+ */ forbidden(error, description) {
2194
+ return this.forbiddenResponder.getResponse(error, description);
2195
+ }
2196
+ static {
2197
+ _initClass$16();
2198
+ }
2199
+ };
2200
+
2201
+ //#endregion
2202
+ //#region src/responders/services/forbidden-responder.service.mts
2203
+ function applyDecs2203RFactory$15() {
2204
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
2205
+ return function addInitializer(initializer) {
2206
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
2207
+ assertCallable(initializer, "An initializer");
2208
+ initializers.push(initializer);
2209
+ };
2210
+ }
2211
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
2212
+ var kindStr;
2213
+ switch (kind) {
2214
+ case 1:
2215
+ kindStr = "accessor";
2216
+ break;
2217
+ case 2:
2218
+ kindStr = "method";
2219
+ break;
2220
+ case 3:
2221
+ kindStr = "getter";
2222
+ break;
2223
+ case 4:
2224
+ kindStr = "setter";
2225
+ break;
2226
+ default: kindStr = "field";
2227
+ }
2228
+ var ctx = {
2229
+ kind: kindStr,
2230
+ name: isPrivate ? "#" + name : name,
2231
+ static: isStatic,
2232
+ private: isPrivate,
2233
+ metadata
2234
+ };
2235
+ var decoratorFinishedRef = { v: false };
2236
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
2237
+ var get, set;
2238
+ if (kind === 0) if (isPrivate) {
2239
+ get = desc.get;
2240
+ set = desc.set;
2241
+ } else {
2242
+ get = function() {
2243
+ return this[name];
2244
+ };
2245
+ set = function(v) {
2246
+ this[name] = v;
2247
+ };
2248
+ }
2249
+ else if (kind === 2) get = function() {
2250
+ return desc.value;
2251
+ };
2252
+ else {
2253
+ if (kind === 1 || kind === 3) get = function() {
2254
+ return desc.get.call(this);
2255
+ };
2256
+ if (kind === 1 || kind === 4) set = function(v) {
2257
+ desc.set.call(this, v);
2258
+ };
2259
+ }
2260
+ ctx.access = get && set ? {
2261
+ get,
2262
+ set
2263
+ } : get ? { get } : { set };
2264
+ try {
2265
+ return dec(value, ctx);
2266
+ } finally {
2267
+ decoratorFinishedRef.v = true;
2268
+ }
2269
+ }
2270
+ function assertNotFinished(decoratorFinishedRef, fnName) {
2271
+ if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
2272
+ }
2273
+ function assertCallable(fn, hint) {
2274
+ if (typeof fn !== "function") throw new TypeError(hint + " must be a function");
2275
+ }
2276
+ function assertValidReturnValue(kind, value) {
2277
+ var type = typeof value;
2278
+ if (kind === 1) {
2279
+ if (type !== "object" || value === null) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
2280
+ if (value.get !== void 0) assertCallable(value.get, "accessor.get");
2281
+ if (value.set !== void 0) assertCallable(value.set, "accessor.set");
2282
+ if (value.init !== void 0) assertCallable(value.init, "accessor.init");
2283
+ } else if (type !== "function") {
2284
+ var hint;
2285
+ if (kind === 0) hint = "field";
2286
+ else if (kind === 10) hint = "class";
2287
+ else hint = "method";
2288
+ throw new TypeError(hint + " decorators must return a function or void 0");
2289
+ }
2290
+ }
2291
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
2292
+ var decs = decInfo[0];
2293
+ var desc, init, value;
2294
+ if (isPrivate) if (kind === 0 || kind === 1) desc = {
2295
+ get: decInfo[3],
2296
+ set: decInfo[4]
2297
+ };
2298
+ else if (kind === 3) desc = { get: decInfo[3] };
2299
+ else if (kind === 4) desc = { set: decInfo[3] };
2300
+ else desc = { value: decInfo[3] };
2301
+ else if (kind !== 0) desc = Object.getOwnPropertyDescriptor(base, name);
2302
+ if (kind === 1) value = {
2303
+ get: desc.get,
2304
+ set: desc.set
2305
+ };
2306
+ else if (kind === 2) value = desc.value;
2307
+ else if (kind === 3) value = desc.get;
2308
+ else if (kind === 4) value = desc.set;
2309
+ var newValue, get, set;
2310
+ if (typeof decs === "function") {
2311
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
2312
+ if (newValue !== void 0) {
2313
+ assertValidReturnValue(kind, newValue);
2314
+ if (kind === 0) init = newValue;
2315
+ else if (kind === 1) {
2316
+ init = newValue.init;
2317
+ get = newValue.get || value.get;
2318
+ set = newValue.set || value.set;
2319
+ value = {
2320
+ get,
2321
+ set
2322
+ };
2323
+ } else value = newValue;
2324
+ }
2325
+ } else for (var i = decs.length - 1; i >= 0; i--) {
2326
+ var dec = decs[i];
2327
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
2328
+ if (newValue !== void 0) {
2329
+ assertValidReturnValue(kind, newValue);
2330
+ var newInit;
2331
+ if (kind === 0) newInit = newValue;
2332
+ else if (kind === 1) {
2333
+ newInit = newValue.init;
2334
+ get = newValue.get || value.get;
2335
+ set = newValue.set || value.set;
2336
+ value = {
2337
+ get,
2338
+ set
2339
+ };
2340
+ } else value = newValue;
2341
+ if (newInit !== void 0) if (init === void 0) init = newInit;
2342
+ else if (typeof init === "function") init = [init, newInit];
2343
+ else init.push(newInit);
2344
+ }
2345
+ }
2346
+ if (kind === 0 || kind === 1) {
2347
+ if (init === void 0) init = function(instance, init$1) {
2348
+ return init$1;
2349
+ };
2350
+ else if (typeof init !== "function") {
2351
+ var ownInitializers = init;
2352
+ init = function(instance, init$1) {
2353
+ var value$1 = init$1;
2354
+ for (var i$1 = 0; i$1 < ownInitializers.length; i$1++) value$1 = ownInitializers[i$1].call(instance, value$1);
2355
+ return value$1;
2356
+ };
2357
+ } else {
2358
+ var originalInitializer = init;
2359
+ init = function(instance, init$1) {
2360
+ return originalInitializer.call(instance, init$1);
2361
+ };
2362
+ }
2363
+ ret.push(init);
2364
+ }
2365
+ if (kind !== 0) {
2366
+ if (kind === 1) {
2367
+ desc.get = value.get;
2368
+ desc.set = value.set;
2369
+ } else if (kind === 2) desc.value = value;
2370
+ else if (kind === 3) desc.get = value;
2371
+ else if (kind === 4) desc.set = value;
2372
+ if (isPrivate) if (kind === 1) {
2373
+ ret.push(function(instance, args) {
2374
+ return value.get.call(instance, args);
2375
+ });
2376
+ ret.push(function(instance, args) {
2377
+ return value.set.call(instance, args);
2378
+ });
2379
+ } else if (kind === 2) ret.push(value);
2380
+ else ret.push(function(instance, args) {
2381
+ return value.call(instance, args);
2382
+ });
2383
+ else Object.defineProperty(base, name, desc);
2384
+ }
2385
+ }
2386
+ function applyMemberDecs(Class, decInfos, metadata) {
2387
+ var ret = [];
2388
+ var protoInitializers;
2389
+ var staticInitializers;
2390
+ var existingProtoNonFields = /* @__PURE__ */ new Map();
2391
+ var existingStaticNonFields = /* @__PURE__ */ new Map();
2392
+ for (var i = 0; i < decInfos.length; i++) {
2393
+ var decInfo = decInfos[i];
2394
+ if (!Array.isArray(decInfo)) continue;
2395
+ var kind = decInfo[1];
2396
+ var name = decInfo[2];
2397
+ var isPrivate = decInfo.length > 3;
2398
+ var isStatic = kind >= 5;
2399
+ var base;
2400
+ var initializers;
2401
+ if (isStatic) {
2402
+ base = Class;
2403
+ kind = kind - 5;
2404
+ staticInitializers = staticInitializers || [];
2405
+ initializers = staticInitializers;
2406
+ } else {
2407
+ base = Class.prototype;
2408
+ protoInitializers = protoInitializers || [];
2409
+ initializers = protoInitializers;
2410
+ }
2411
+ if (kind !== 0 && !isPrivate) {
2412
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
2413
+ var existingKind = existingNonFields.get(name) || 0;
2414
+ 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);
2415
+ else if (!existingKind && kind > 2) existingNonFields.set(name, kind);
2416
+ else existingNonFields.set(name, true);
2417
+ }
2418
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
2419
+ }
2420
+ pushInitializers(ret, protoInitializers);
2421
+ pushInitializers(ret, staticInitializers);
2422
+ return ret;
2423
+ }
2424
+ function pushInitializers(ret, initializers) {
2425
+ if (initializers) ret.push(function(instance) {
2426
+ for (var i = 0; i < initializers.length; i++) initializers[i].call(instance);
2427
+ return instance;
2428
+ });
2429
+ }
2430
+ function applyClassDecs(targetClass, classDecs, metadata) {
2431
+ if (classDecs.length > 0) {
2432
+ var initializers = [];
2433
+ var newClass = targetClass;
2434
+ var name = targetClass.name;
2435
+ for (var i = classDecs.length - 1; i >= 0; i--) {
2436
+ var decoratorFinishedRef = { v: false };
2437
+ try {
2438
+ var nextNewClass = classDecs[i](newClass, {
2439
+ kind: "class",
2440
+ name,
2441
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
2442
+ metadata
2443
+ });
2444
+ } finally {
2445
+ decoratorFinishedRef.v = true;
2446
+ }
2447
+ if (nextNewClass !== void 0) {
2448
+ assertValidReturnValue(10, nextNewClass);
2449
+ newClass = nextNewClass;
2450
+ }
2451
+ }
2452
+ return [defineMetadata(newClass, metadata), function() {
2453
+ for (var i$1 = 0; i$1 < initializers.length; i$1++) initializers[i$1].call(newClass);
2454
+ }];
2455
+ }
2456
+ }
2457
+ function defineMetadata(Class, metadata) {
2458
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
2459
+ configurable: true,
2460
+ enumerable: true,
2461
+ value: metadata
2462
+ });
2463
+ }
2464
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
2465
+ if (parentClass !== void 0) var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
2466
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
2467
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
2468
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
2469
+ return {
2470
+ e,
2471
+ get c() {
2472
+ return applyClassDecs(targetClass, classDecs, metadata);
2473
+ }
2474
+ };
2475
+ };
2476
+ }
2477
+ function _apply_decs_2203_r$15(targetClass, memberDecs, classDecs, parentClass) {
2478
+ return (_apply_decs_2203_r$15 = applyDecs2203RFactory$15())(targetClass, memberDecs, classDecs, parentClass);
2479
+ }
2480
+ var _dec$15, _initClass$15;
2481
+ let _ForbiddenResponderService;
2482
+ _dec$15 = (0, _navios_di.Injectable)({
2483
+ token: ForbiddenResponderToken,
2484
+ priority: -10
2485
+ });
2486
+ var ForbiddenResponderService = class {
2487
+ static {
2488
+ ({c: [_ForbiddenResponderService, _initClass$15]} = _apply_decs_2203_r$15(this, [], [_dec$15]));
2489
+ }
2490
+ getResponse(error, description) {
2491
+ if (description) return this.createResponse(description);
2492
+ if (error && typeof error === "object" && "response" in error && error.response) {
2493
+ if (typeof error.response === "string") return this.createResponse(error.response);
2494
+ }
2495
+ return this.createResponse("Access to this resource is forbidden");
2496
+ }
2497
+ createResponse(detail) {
2498
+ return {
2499
+ statusCode: 403,
2500
+ payload: {
2501
+ type: "about:blank",
2502
+ title: "Forbidden",
2503
+ status: 403,
2504
+ detail
2505
+ },
2506
+ headers: { "Content-Type": "application/problem+json" }
2507
+ };
2508
+ }
2509
+ static {
2510
+ _initClass$15();
2511
+ }
2512
+ };
2513
+
2514
+ //#endregion
2515
+ //#region src/responders/services/internal-server-error-responder.service.mts
2516
+ function applyDecs2203RFactory$14() {
2517
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
2518
+ return function addInitializer(initializer) {
2519
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
2520
+ assertCallable(initializer, "An initializer");
2521
+ initializers.push(initializer);
2522
+ };
2523
+ }
2524
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
2525
+ var kindStr;
2526
+ switch (kind) {
2527
+ case 1:
2528
+ kindStr = "accessor";
2529
+ break;
2530
+ case 2:
2531
+ kindStr = "method";
2532
+ break;
2533
+ case 3:
2534
+ kindStr = "getter";
2535
+ break;
2536
+ case 4:
2537
+ kindStr = "setter";
2538
+ break;
2539
+ default: kindStr = "field";
2540
+ }
2541
+ var ctx = {
2542
+ kind: kindStr,
2543
+ name: isPrivate ? "#" + name : name,
2544
+ static: isStatic,
2545
+ private: isPrivate,
2546
+ metadata
2547
+ };
2548
+ var decoratorFinishedRef = { v: false };
2549
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
2550
+ var get, set;
2551
+ if (kind === 0) if (isPrivate) {
2552
+ get = desc.get;
2553
+ set = desc.set;
2554
+ } else {
2555
+ get = function() {
2556
+ return this[name];
2557
+ };
2558
+ set = function(v) {
2559
+ this[name] = v;
2560
+ };
2561
+ }
2562
+ else if (kind === 2) get = function() {
2563
+ return desc.value;
2564
+ };
2565
+ else {
2566
+ if (kind === 1 || kind === 3) get = function() {
2567
+ return desc.get.call(this);
2568
+ };
2569
+ if (kind === 1 || kind === 4) set = function(v) {
2570
+ desc.set.call(this, v);
2571
+ };
2572
+ }
2573
+ ctx.access = get && set ? {
2574
+ get,
2575
+ set
2576
+ } : get ? { get } : { set };
2577
+ try {
2578
+ return dec(value, ctx);
2579
+ } finally {
2580
+ decoratorFinishedRef.v = true;
2581
+ }
2582
+ }
2583
+ function assertNotFinished(decoratorFinishedRef, fnName) {
2584
+ if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
2585
+ }
2586
+ function assertCallable(fn, hint) {
2587
+ if (typeof fn !== "function") throw new TypeError(hint + " must be a function");
2588
+ }
2589
+ function assertValidReturnValue(kind, value) {
2590
+ var type = typeof value;
2591
+ if (kind === 1) {
2592
+ if (type !== "object" || value === null) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
2593
+ if (value.get !== void 0) assertCallable(value.get, "accessor.get");
2594
+ if (value.set !== void 0) assertCallable(value.set, "accessor.set");
2595
+ if (value.init !== void 0) assertCallable(value.init, "accessor.init");
2596
+ } else if (type !== "function") {
2597
+ var hint;
2598
+ if (kind === 0) hint = "field";
2599
+ else if (kind === 10) hint = "class";
2600
+ else hint = "method";
2601
+ throw new TypeError(hint + " decorators must return a function or void 0");
2602
+ }
2603
+ }
2604
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
2605
+ var decs = decInfo[0];
2606
+ var desc, init, value;
2607
+ if (isPrivate) if (kind === 0 || kind === 1) desc = {
2608
+ get: decInfo[3],
2609
+ set: decInfo[4]
2610
+ };
2611
+ else if (kind === 3) desc = { get: decInfo[3] };
2612
+ else if (kind === 4) desc = { set: decInfo[3] };
2613
+ else desc = { value: decInfo[3] };
2614
+ else if (kind !== 0) desc = Object.getOwnPropertyDescriptor(base, name);
2615
+ if (kind === 1) value = {
2616
+ get: desc.get,
2617
+ set: desc.set
2618
+ };
2619
+ else if (kind === 2) value = desc.value;
2620
+ else if (kind === 3) value = desc.get;
2621
+ else if (kind === 4) value = desc.set;
2622
+ var newValue, get, set;
2623
+ if (typeof decs === "function") {
2624
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
2625
+ if (newValue !== void 0) {
2626
+ assertValidReturnValue(kind, newValue);
2627
+ if (kind === 0) init = newValue;
2628
+ else if (kind === 1) {
2629
+ init = newValue.init;
2630
+ get = newValue.get || value.get;
2631
+ set = newValue.set || value.set;
2632
+ value = {
2633
+ get,
2634
+ set
2635
+ };
2636
+ } else value = newValue;
2637
+ }
2638
+ } else for (var i = decs.length - 1; i >= 0; i--) {
2639
+ var dec = decs[i];
2640
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
2641
+ if (newValue !== void 0) {
2642
+ assertValidReturnValue(kind, newValue);
2643
+ var newInit;
2644
+ if (kind === 0) newInit = newValue;
2645
+ else if (kind === 1) {
2646
+ newInit = newValue.init;
2647
+ get = newValue.get || value.get;
2648
+ set = newValue.set || value.set;
2649
+ value = {
2650
+ get,
2651
+ set
2652
+ };
2653
+ } else value = newValue;
2654
+ if (newInit !== void 0) if (init === void 0) init = newInit;
2655
+ else if (typeof init === "function") init = [init, newInit];
2656
+ else init.push(newInit);
2657
+ }
2658
+ }
2659
+ if (kind === 0 || kind === 1) {
2660
+ if (init === void 0) init = function(instance, init$1) {
2661
+ return init$1;
2662
+ };
2663
+ else if (typeof init !== "function") {
2664
+ var ownInitializers = init;
2665
+ init = function(instance, init$1) {
2666
+ var value$1 = init$1;
2667
+ for (var i$1 = 0; i$1 < ownInitializers.length; i$1++) value$1 = ownInitializers[i$1].call(instance, value$1);
2668
+ return value$1;
2669
+ };
2670
+ } else {
2671
+ var originalInitializer = init;
2672
+ init = function(instance, init$1) {
2673
+ return originalInitializer.call(instance, init$1);
2674
+ };
2675
+ }
2676
+ ret.push(init);
2677
+ }
2678
+ if (kind !== 0) {
2679
+ if (kind === 1) {
2680
+ desc.get = value.get;
2681
+ desc.set = value.set;
2682
+ } else if (kind === 2) desc.value = value;
2683
+ else if (kind === 3) desc.get = value;
2684
+ else if (kind === 4) desc.set = value;
2685
+ if (isPrivate) if (kind === 1) {
2686
+ ret.push(function(instance, args) {
2687
+ return value.get.call(instance, args);
2688
+ });
2689
+ ret.push(function(instance, args) {
2690
+ return value.set.call(instance, args);
2691
+ });
2692
+ } else if (kind === 2) ret.push(value);
2693
+ else ret.push(function(instance, args) {
2694
+ return value.call(instance, args);
2695
+ });
2696
+ else Object.defineProperty(base, name, desc);
2697
+ }
2698
+ }
2699
+ function applyMemberDecs(Class, decInfos, metadata) {
2700
+ var ret = [];
2701
+ var protoInitializers;
2702
+ var staticInitializers;
2703
+ var existingProtoNonFields = /* @__PURE__ */ new Map();
2704
+ var existingStaticNonFields = /* @__PURE__ */ new Map();
2705
+ for (var i = 0; i < decInfos.length; i++) {
2706
+ var decInfo = decInfos[i];
2707
+ if (!Array.isArray(decInfo)) continue;
2708
+ var kind = decInfo[1];
2709
+ var name = decInfo[2];
2710
+ var isPrivate = decInfo.length > 3;
2711
+ var isStatic = kind >= 5;
2712
+ var base;
2713
+ var initializers;
2714
+ if (isStatic) {
2715
+ base = Class;
2716
+ kind = kind - 5;
2717
+ staticInitializers = staticInitializers || [];
2718
+ initializers = staticInitializers;
2719
+ } else {
2720
+ base = Class.prototype;
2721
+ protoInitializers = protoInitializers || [];
2722
+ initializers = protoInitializers;
2723
+ }
2724
+ if (kind !== 0 && !isPrivate) {
2725
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
2726
+ var existingKind = existingNonFields.get(name) || 0;
2727
+ 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);
2728
+ else if (!existingKind && kind > 2) existingNonFields.set(name, kind);
2729
+ else existingNonFields.set(name, true);
2730
+ }
2731
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
2732
+ }
2733
+ pushInitializers(ret, protoInitializers);
2734
+ pushInitializers(ret, staticInitializers);
2735
+ return ret;
2736
+ }
2737
+ function pushInitializers(ret, initializers) {
2738
+ if (initializers) ret.push(function(instance) {
2739
+ for (var i = 0; i < initializers.length; i++) initializers[i].call(instance);
2740
+ return instance;
2741
+ });
2742
+ }
2743
+ function applyClassDecs(targetClass, classDecs, metadata) {
2744
+ if (classDecs.length > 0) {
2745
+ var initializers = [];
2746
+ var newClass = targetClass;
2747
+ var name = targetClass.name;
2748
+ for (var i = classDecs.length - 1; i >= 0; i--) {
2749
+ var decoratorFinishedRef = { v: false };
2750
+ try {
2751
+ var nextNewClass = classDecs[i](newClass, {
2752
+ kind: "class",
2753
+ name,
2754
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
2755
+ metadata
2756
+ });
2757
+ } finally {
2758
+ decoratorFinishedRef.v = true;
2759
+ }
2760
+ if (nextNewClass !== void 0) {
2761
+ assertValidReturnValue(10, nextNewClass);
2762
+ newClass = nextNewClass;
2763
+ }
2764
+ }
2765
+ return [defineMetadata(newClass, metadata), function() {
2766
+ for (var i$1 = 0; i$1 < initializers.length; i$1++) initializers[i$1].call(newClass);
2767
+ }];
2768
+ }
2769
+ }
2770
+ function defineMetadata(Class, metadata) {
2771
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
2772
+ configurable: true,
2773
+ enumerable: true,
2774
+ value: metadata
2775
+ });
2776
+ }
2777
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
2778
+ if (parentClass !== void 0) var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
2779
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
2780
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
2781
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
2782
+ return {
2783
+ e,
2784
+ get c() {
2785
+ return applyClassDecs(targetClass, classDecs, metadata);
2786
+ }
2787
+ };
2788
+ };
2789
+ }
2790
+ function _apply_decs_2203_r$14(targetClass, memberDecs, classDecs, parentClass) {
2791
+ return (_apply_decs_2203_r$14 = applyDecs2203RFactory$14())(targetClass, memberDecs, classDecs, parentClass);
2792
+ }
2793
+ var _dec$14, _initClass$14;
2794
+ let _InternalServerErrorResponderService;
2795
+ _dec$14 = (0, _navios_di.Injectable)({
2796
+ token: InternalServerErrorResponderToken,
2797
+ priority: -10
2798
+ });
2799
+ var InternalServerErrorResponderService = class {
2800
+ static {
2801
+ ({c: [_InternalServerErrorResponderService, _initClass$14]} = _apply_decs_2203_r$14(this, [], [_dec$14]));
2802
+ }
2803
+ getResponse(error, description) {
2804
+ const message = error instanceof Error ? error.message : "Internal Server Error";
2805
+ return {
2806
+ statusCode: 500,
2807
+ payload: {
2808
+ type: "about:blank",
2809
+ title: "Internal Server Error",
2810
+ status: 500,
2811
+ detail: description ?? message
2812
+ },
2813
+ headers: { "Content-Type": "application/problem+json" }
2814
+ };
2815
+ }
2816
+ static {
2817
+ _initClass$14();
2818
+ }
2819
+ };
2820
+
2821
+ //#endregion
2822
+ //#region src/responders/services/not-found-responder.service.mts
2823
+ function applyDecs2203RFactory$13() {
2824
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
2825
+ return function addInitializer(initializer) {
2826
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
2827
+ assertCallable(initializer, "An initializer");
2828
+ initializers.push(initializer);
2829
+ };
2830
+ }
2831
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
2832
+ var kindStr;
2833
+ switch (kind) {
2834
+ case 1:
2835
+ kindStr = "accessor";
2836
+ break;
2837
+ case 2:
2838
+ kindStr = "method";
2839
+ break;
2840
+ case 3:
2841
+ kindStr = "getter";
2842
+ break;
2843
+ case 4:
2844
+ kindStr = "setter";
2845
+ break;
2846
+ default: kindStr = "field";
2847
+ }
2848
+ var ctx = {
2849
+ kind: kindStr,
2850
+ name: isPrivate ? "#" + name : name,
2851
+ static: isStatic,
2852
+ private: isPrivate,
2853
+ metadata
2854
+ };
2855
+ var decoratorFinishedRef = { v: false };
2856
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
2857
+ var get, set;
2858
+ if (kind === 0) if (isPrivate) {
2859
+ get = desc.get;
2860
+ set = desc.set;
2861
+ } else {
2862
+ get = function() {
2863
+ return this[name];
2864
+ };
2865
+ set = function(v) {
2866
+ this[name] = v;
2867
+ };
2868
+ }
2869
+ else if (kind === 2) get = function() {
2870
+ return desc.value;
2871
+ };
2872
+ else {
2873
+ if (kind === 1 || kind === 3) get = function() {
2874
+ return desc.get.call(this);
2875
+ };
2876
+ if (kind === 1 || kind === 4) set = function(v) {
2877
+ desc.set.call(this, v);
2878
+ };
2879
+ }
2880
+ ctx.access = get && set ? {
2881
+ get,
2882
+ set
2883
+ } : get ? { get } : { set };
2884
+ try {
2885
+ return dec(value, ctx);
2886
+ } finally {
2887
+ decoratorFinishedRef.v = true;
2888
+ }
2889
+ }
2890
+ function assertNotFinished(decoratorFinishedRef, fnName) {
2891
+ if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
2892
+ }
2893
+ function assertCallable(fn, hint) {
2894
+ if (typeof fn !== "function") throw new TypeError(hint + " must be a function");
2895
+ }
2896
+ function assertValidReturnValue(kind, value) {
2897
+ var type = typeof value;
2898
+ if (kind === 1) {
2899
+ if (type !== "object" || value === null) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
2900
+ if (value.get !== void 0) assertCallable(value.get, "accessor.get");
2901
+ if (value.set !== void 0) assertCallable(value.set, "accessor.set");
2902
+ if (value.init !== void 0) assertCallable(value.init, "accessor.init");
2903
+ } else if (type !== "function") {
2904
+ var hint;
2905
+ if (kind === 0) hint = "field";
2906
+ else if (kind === 10) hint = "class";
2907
+ else hint = "method";
2908
+ throw new TypeError(hint + " decorators must return a function or void 0");
2909
+ }
2910
+ }
2911
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
2912
+ var decs = decInfo[0];
2913
+ var desc, init, value;
2914
+ if (isPrivate) if (kind === 0 || kind === 1) desc = {
2915
+ get: decInfo[3],
2916
+ set: decInfo[4]
2917
+ };
2918
+ else if (kind === 3) desc = { get: decInfo[3] };
2919
+ else if (kind === 4) desc = { set: decInfo[3] };
2920
+ else desc = { value: decInfo[3] };
2921
+ else if (kind !== 0) desc = Object.getOwnPropertyDescriptor(base, name);
2922
+ if (kind === 1) value = {
2923
+ get: desc.get,
2924
+ set: desc.set
2925
+ };
2926
+ else if (kind === 2) value = desc.value;
2927
+ else if (kind === 3) value = desc.get;
2928
+ else if (kind === 4) value = desc.set;
2929
+ var newValue, get, set;
2930
+ if (typeof decs === "function") {
2931
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
2932
+ if (newValue !== void 0) {
2933
+ assertValidReturnValue(kind, newValue);
2934
+ if (kind === 0) init = newValue;
2935
+ else if (kind === 1) {
2936
+ init = newValue.init;
2937
+ get = newValue.get || value.get;
2938
+ set = newValue.set || value.set;
2939
+ value = {
2940
+ get,
2941
+ set
2942
+ };
2943
+ } else value = newValue;
2944
+ }
2945
+ } else for (var i = decs.length - 1; i >= 0; i--) {
2946
+ var dec = decs[i];
2947
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
2948
+ if (newValue !== void 0) {
2949
+ assertValidReturnValue(kind, newValue);
2950
+ var newInit;
2951
+ if (kind === 0) newInit = newValue;
2952
+ else if (kind === 1) {
2953
+ newInit = newValue.init;
2954
+ get = newValue.get || value.get;
2955
+ set = newValue.set || value.set;
2956
+ value = {
2957
+ get,
2958
+ set
2959
+ };
2960
+ } else value = newValue;
2961
+ if (newInit !== void 0) if (init === void 0) init = newInit;
2962
+ else if (typeof init === "function") init = [init, newInit];
2963
+ else init.push(newInit);
2964
+ }
2965
+ }
2966
+ if (kind === 0 || kind === 1) {
2967
+ if (init === void 0) init = function(instance, init$1) {
2968
+ return init$1;
2969
+ };
2970
+ else if (typeof init !== "function") {
2971
+ var ownInitializers = init;
2972
+ init = function(instance, init$1) {
2973
+ var value$1 = init$1;
2974
+ for (var i$1 = 0; i$1 < ownInitializers.length; i$1++) value$1 = ownInitializers[i$1].call(instance, value$1);
2975
+ return value$1;
2976
+ };
2977
+ } else {
2978
+ var originalInitializer = init;
2979
+ init = function(instance, init$1) {
2980
+ return originalInitializer.call(instance, init$1);
2981
+ };
2982
+ }
2983
+ ret.push(init);
2984
+ }
2985
+ if (kind !== 0) {
2986
+ if (kind === 1) {
2987
+ desc.get = value.get;
2988
+ desc.set = value.set;
2989
+ } else if (kind === 2) desc.value = value;
2990
+ else if (kind === 3) desc.get = value;
2991
+ else if (kind === 4) desc.set = value;
2992
+ if (isPrivate) if (kind === 1) {
2993
+ ret.push(function(instance, args) {
2994
+ return value.get.call(instance, args);
2995
+ });
2996
+ ret.push(function(instance, args) {
2997
+ return value.set.call(instance, args);
2998
+ });
2999
+ } else if (kind === 2) ret.push(value);
3000
+ else ret.push(function(instance, args) {
3001
+ return value.call(instance, args);
3002
+ });
3003
+ else Object.defineProperty(base, name, desc);
3004
+ }
3005
+ }
3006
+ function applyMemberDecs(Class, decInfos, metadata) {
3007
+ var ret = [];
3008
+ var protoInitializers;
3009
+ var staticInitializers;
3010
+ var existingProtoNonFields = /* @__PURE__ */ new Map();
3011
+ var existingStaticNonFields = /* @__PURE__ */ new Map();
3012
+ for (var i = 0; i < decInfos.length; i++) {
3013
+ var decInfo = decInfos[i];
3014
+ if (!Array.isArray(decInfo)) continue;
3015
+ var kind = decInfo[1];
3016
+ var name = decInfo[2];
3017
+ var isPrivate = decInfo.length > 3;
3018
+ var isStatic = kind >= 5;
3019
+ var base;
3020
+ var initializers;
3021
+ if (isStatic) {
3022
+ base = Class;
3023
+ kind = kind - 5;
3024
+ staticInitializers = staticInitializers || [];
3025
+ initializers = staticInitializers;
3026
+ } else {
3027
+ base = Class.prototype;
3028
+ protoInitializers = protoInitializers || [];
3029
+ initializers = protoInitializers;
3030
+ }
3031
+ if (kind !== 0 && !isPrivate) {
3032
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
3033
+ var existingKind = existingNonFields.get(name) || 0;
3034
+ 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);
3035
+ else if (!existingKind && kind > 2) existingNonFields.set(name, kind);
3036
+ else existingNonFields.set(name, true);
3037
+ }
3038
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
3039
+ }
3040
+ pushInitializers(ret, protoInitializers);
3041
+ pushInitializers(ret, staticInitializers);
3042
+ return ret;
3043
+ }
3044
+ function pushInitializers(ret, initializers) {
3045
+ if (initializers) ret.push(function(instance) {
3046
+ for (var i = 0; i < initializers.length; i++) initializers[i].call(instance);
3047
+ return instance;
3048
+ });
3049
+ }
3050
+ function applyClassDecs(targetClass, classDecs, metadata) {
3051
+ if (classDecs.length > 0) {
3052
+ var initializers = [];
3053
+ var newClass = targetClass;
3054
+ var name = targetClass.name;
3055
+ for (var i = classDecs.length - 1; i >= 0; i--) {
3056
+ var decoratorFinishedRef = { v: false };
3057
+ try {
3058
+ var nextNewClass = classDecs[i](newClass, {
3059
+ kind: "class",
3060
+ name,
3061
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
3062
+ metadata
3063
+ });
3064
+ } finally {
3065
+ decoratorFinishedRef.v = true;
3066
+ }
3067
+ if (nextNewClass !== void 0) {
3068
+ assertValidReturnValue(10, nextNewClass);
3069
+ newClass = nextNewClass;
3070
+ }
3071
+ }
3072
+ return [defineMetadata(newClass, metadata), function() {
3073
+ for (var i$1 = 0; i$1 < initializers.length; i$1++) initializers[i$1].call(newClass);
3074
+ }];
3075
+ }
3076
+ }
3077
+ function defineMetadata(Class, metadata) {
3078
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
3079
+ configurable: true,
3080
+ enumerable: true,
3081
+ value: metadata
3082
+ });
3083
+ }
3084
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
3085
+ if (parentClass !== void 0) var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
3086
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
3087
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
3088
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
3089
+ return {
3090
+ e,
3091
+ get c() {
3092
+ return applyClassDecs(targetClass, classDecs, metadata);
3093
+ }
3094
+ };
3095
+ };
3096
+ }
3097
+ function _apply_decs_2203_r$13(targetClass, memberDecs, classDecs, parentClass) {
3098
+ return (_apply_decs_2203_r$13 = applyDecs2203RFactory$13())(targetClass, memberDecs, classDecs, parentClass);
3099
+ }
3100
+ var _dec$13, _initClass$13;
3101
+ let _NotFoundResponderService;
3102
+ _dec$13 = (0, _navios_di.Injectable)({
3103
+ token: NotFoundResponderToken,
3104
+ priority: -10
3105
+ });
3106
+ var NotFoundResponderService = class {
3107
+ static {
3108
+ ({c: [_NotFoundResponderService, _initClass$13]} = _apply_decs_2203_r$13(this, [], [_dec$13]));
3109
+ }
3110
+ getResponse(error, description) {
3111
+ if (description) return this.createResponse(description);
3112
+ if (error && typeof error === "object" && "response" in error && error.response) {
3113
+ if (typeof error.response === "string") return this.createResponse(error.response);
3114
+ }
3115
+ return this.createResponse("The requested resource was not found");
3116
+ }
3117
+ createResponse(detail) {
3118
+ return {
3119
+ statusCode: 404,
3120
+ payload: {
3121
+ type: "about:blank",
3122
+ title: "Not Found",
3123
+ status: 404,
3124
+ detail
3125
+ },
3126
+ headers: { "Content-Type": "application/problem+json" }
3127
+ };
3128
+ }
3129
+ static {
3130
+ _initClass$13();
3131
+ }
3132
+ };
3133
+
3134
+ //#endregion
3135
+ //#region src/responders/services/validation-error-responder.service.mts
3136
+ function applyDecs2203RFactory$12() {
3137
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
3138
+ return function addInitializer(initializer) {
3139
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
3140
+ assertCallable(initializer, "An initializer");
3141
+ initializers.push(initializer);
3142
+ };
3143
+ }
3144
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
3145
+ var kindStr;
3146
+ switch (kind) {
3147
+ case 1:
3148
+ kindStr = "accessor";
3149
+ break;
3150
+ case 2:
3151
+ kindStr = "method";
3152
+ break;
3153
+ case 3:
3154
+ kindStr = "getter";
3155
+ break;
3156
+ case 4:
3157
+ kindStr = "setter";
3158
+ break;
3159
+ default: kindStr = "field";
3160
+ }
3161
+ var ctx = {
3162
+ kind: kindStr,
3163
+ name: isPrivate ? "#" + name : name,
3164
+ static: isStatic,
3165
+ private: isPrivate,
3166
+ metadata
3167
+ };
3168
+ var decoratorFinishedRef = { v: false };
3169
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
3170
+ var get, set;
3171
+ if (kind === 0) if (isPrivate) {
3172
+ get = desc.get;
3173
+ set = desc.set;
3174
+ } else {
3175
+ get = function() {
3176
+ return this[name];
3177
+ };
3178
+ set = function(v) {
3179
+ this[name] = v;
3180
+ };
3181
+ }
3182
+ else if (kind === 2) get = function() {
3183
+ return desc.value;
3184
+ };
3185
+ else {
3186
+ if (kind === 1 || kind === 3) get = function() {
3187
+ return desc.get.call(this);
3188
+ };
3189
+ if (kind === 1 || kind === 4) set = function(v) {
3190
+ desc.set.call(this, v);
3191
+ };
3192
+ }
3193
+ ctx.access = get && set ? {
3194
+ get,
3195
+ set
3196
+ } : get ? { get } : { set };
3197
+ try {
3198
+ return dec(value, ctx);
3199
+ } finally {
3200
+ decoratorFinishedRef.v = true;
3201
+ }
3202
+ }
3203
+ function assertNotFinished(decoratorFinishedRef, fnName) {
3204
+ if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
3205
+ }
3206
+ function assertCallable(fn, hint) {
3207
+ if (typeof fn !== "function") throw new TypeError(hint + " must be a function");
3208
+ }
3209
+ function assertValidReturnValue(kind, value) {
3210
+ var type = typeof value;
3211
+ if (kind === 1) {
3212
+ if (type !== "object" || value === null) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
3213
+ if (value.get !== void 0) assertCallable(value.get, "accessor.get");
3214
+ if (value.set !== void 0) assertCallable(value.set, "accessor.set");
3215
+ if (value.init !== void 0) assertCallable(value.init, "accessor.init");
3216
+ } else if (type !== "function") {
3217
+ var hint;
3218
+ if (kind === 0) hint = "field";
3219
+ else if (kind === 10) hint = "class";
3220
+ else hint = "method";
3221
+ throw new TypeError(hint + " decorators must return a function or void 0");
3222
+ }
3223
+ }
3224
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
3225
+ var decs = decInfo[0];
3226
+ var desc, init, value;
3227
+ if (isPrivate) if (kind === 0 || kind === 1) desc = {
3228
+ get: decInfo[3],
3229
+ set: decInfo[4]
3230
+ };
3231
+ else if (kind === 3) desc = { get: decInfo[3] };
3232
+ else if (kind === 4) desc = { set: decInfo[3] };
3233
+ else desc = { value: decInfo[3] };
3234
+ else if (kind !== 0) desc = Object.getOwnPropertyDescriptor(base, name);
3235
+ if (kind === 1) value = {
3236
+ get: desc.get,
3237
+ set: desc.set
3238
+ };
3239
+ else if (kind === 2) value = desc.value;
3240
+ else if (kind === 3) value = desc.get;
3241
+ else if (kind === 4) value = desc.set;
3242
+ var newValue, get, set;
3243
+ if (typeof decs === "function") {
3244
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
3245
+ if (newValue !== void 0) {
3246
+ assertValidReturnValue(kind, newValue);
3247
+ if (kind === 0) init = newValue;
3248
+ else if (kind === 1) {
3249
+ init = newValue.init;
3250
+ get = newValue.get || value.get;
3251
+ set = newValue.set || value.set;
3252
+ value = {
3253
+ get,
3254
+ set
3255
+ };
3256
+ } else value = newValue;
3257
+ }
3258
+ } else for (var i = decs.length - 1; i >= 0; i--) {
3259
+ var dec = decs[i];
3260
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
3261
+ if (newValue !== void 0) {
3262
+ assertValidReturnValue(kind, newValue);
3263
+ var newInit;
3264
+ if (kind === 0) newInit = newValue;
3265
+ else if (kind === 1) {
3266
+ newInit = newValue.init;
3267
+ get = newValue.get || value.get;
3268
+ set = newValue.set || value.set;
3269
+ value = {
3270
+ get,
3271
+ set
3272
+ };
3273
+ } else value = newValue;
3274
+ if (newInit !== void 0) if (init === void 0) init = newInit;
3275
+ else if (typeof init === "function") init = [init, newInit];
3276
+ else init.push(newInit);
3277
+ }
3278
+ }
3279
+ if (kind === 0 || kind === 1) {
3280
+ if (init === void 0) init = function(instance, init$1) {
3281
+ return init$1;
3282
+ };
3283
+ else if (typeof init !== "function") {
3284
+ var ownInitializers = init;
3285
+ init = function(instance, init$1) {
3286
+ var value$1 = init$1;
3287
+ for (var i$1 = 0; i$1 < ownInitializers.length; i$1++) value$1 = ownInitializers[i$1].call(instance, value$1);
3288
+ return value$1;
3289
+ };
3290
+ } else {
3291
+ var originalInitializer = init;
3292
+ init = function(instance, init$1) {
3293
+ return originalInitializer.call(instance, init$1);
3294
+ };
3295
+ }
3296
+ ret.push(init);
3297
+ }
3298
+ if (kind !== 0) {
3299
+ if (kind === 1) {
3300
+ desc.get = value.get;
3301
+ desc.set = value.set;
3302
+ } else if (kind === 2) desc.value = value;
3303
+ else if (kind === 3) desc.get = value;
3304
+ else if (kind === 4) desc.set = value;
3305
+ if (isPrivate) if (kind === 1) {
3306
+ ret.push(function(instance, args) {
3307
+ return value.get.call(instance, args);
3308
+ });
3309
+ ret.push(function(instance, args) {
3310
+ return value.set.call(instance, args);
3311
+ });
3312
+ } else if (kind === 2) ret.push(value);
3313
+ else ret.push(function(instance, args) {
3314
+ return value.call(instance, args);
3315
+ });
3316
+ else Object.defineProperty(base, name, desc);
3317
+ }
3318
+ }
3319
+ function applyMemberDecs(Class, decInfos, metadata) {
3320
+ var ret = [];
3321
+ var protoInitializers;
3322
+ var staticInitializers;
3323
+ var existingProtoNonFields = /* @__PURE__ */ new Map();
3324
+ var existingStaticNonFields = /* @__PURE__ */ new Map();
3325
+ for (var i = 0; i < decInfos.length; i++) {
3326
+ var decInfo = decInfos[i];
3327
+ if (!Array.isArray(decInfo)) continue;
3328
+ var kind = decInfo[1];
3329
+ var name = decInfo[2];
3330
+ var isPrivate = decInfo.length > 3;
3331
+ var isStatic = kind >= 5;
3332
+ var base;
3333
+ var initializers;
3334
+ if (isStatic) {
3335
+ base = Class;
3336
+ kind = kind - 5;
3337
+ staticInitializers = staticInitializers || [];
3338
+ initializers = staticInitializers;
3339
+ } else {
3340
+ base = Class.prototype;
3341
+ protoInitializers = protoInitializers || [];
3342
+ initializers = protoInitializers;
3343
+ }
3344
+ if (kind !== 0 && !isPrivate) {
3345
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
3346
+ var existingKind = existingNonFields.get(name) || 0;
3347
+ 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);
3348
+ else if (!existingKind && kind > 2) existingNonFields.set(name, kind);
3349
+ else existingNonFields.set(name, true);
3350
+ }
3351
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
3352
+ }
3353
+ pushInitializers(ret, protoInitializers);
3354
+ pushInitializers(ret, staticInitializers);
3355
+ return ret;
3356
+ }
3357
+ function pushInitializers(ret, initializers) {
3358
+ if (initializers) ret.push(function(instance) {
3359
+ for (var i = 0; i < initializers.length; i++) initializers[i].call(instance);
3360
+ return instance;
3361
+ });
1612
3362
  }
1613
- };
1614
-
1615
- //#endregion
1616
- //#region src/exceptions/internal-server-error.exception.mts
1617
- /**
1618
- * Exception that represents a 500 Internal Server Error HTTP error.
1619
- *
1620
- * Use this exception when an unexpected error occurs on the server.
1621
- * Generally, you should let unhandled errors bubble up rather than catching
1622
- * and rethrowing as InternalServerErrorException, as Navios will handle them appropriately.
1623
- *
1624
- * @example
1625
- * ```typescript
1626
- * @Endpoint(processPaymentEndpoint)
1627
- * async processPayment(request: EndpointParams<typeof processPaymentEndpoint>) {
1628
- * try {
1629
- * return await this.paymentService.process(request.data)
1630
- * } catch (error) {
1631
- * this.logger.error('Payment processing failed', error)
1632
- * throw new InternalServerErrorException('Payment processing failed', error)
1633
- * }
1634
- * }
1635
- * ```
1636
- */ var InternalServerErrorException = class extends HttpException {
1637
- /**
1638
- * Creates a new InternalServerErrorException.
1639
- *
1640
- * @param message - Error message or response object
1641
- * @param error - Optional underlying error for logging
1642
- */ constructor(message, error) {
1643
- super(500, message, error);
3363
+ function applyClassDecs(targetClass, classDecs, metadata) {
3364
+ if (classDecs.length > 0) {
3365
+ var initializers = [];
3366
+ var newClass = targetClass;
3367
+ var name = targetClass.name;
3368
+ for (var i = classDecs.length - 1; i >= 0; i--) {
3369
+ var decoratorFinishedRef = { v: false };
3370
+ try {
3371
+ var nextNewClass = classDecs[i](newClass, {
3372
+ kind: "class",
3373
+ name,
3374
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
3375
+ metadata
3376
+ });
3377
+ } finally {
3378
+ decoratorFinishedRef.v = true;
3379
+ }
3380
+ if (nextNewClass !== void 0) {
3381
+ assertValidReturnValue(10, nextNewClass);
3382
+ newClass = nextNewClass;
3383
+ }
3384
+ }
3385
+ return [defineMetadata(newClass, metadata), function() {
3386
+ for (var i$1 = 0; i$1 < initializers.length; i$1++) initializers[i$1].call(newClass);
3387
+ }];
3388
+ }
1644
3389
  }
1645
- };
1646
-
1647
- //#endregion
1648
- //#region src/exceptions/not-found.exception.mts
1649
- /**
1650
- * Exception that represents a 404 Not Found HTTP error.
1651
- *
1652
- * Use this exception when the requested resource does not exist.
1653
- *
1654
- * @example
1655
- * ```typescript
1656
- * @Endpoint(getUserEndpoint)
1657
- * async getUser(request: EndpointParams<typeof getUserEndpoint>) {
1658
- * const user = await this.userService.findById(request.urlParams.userId)
1659
- * if (!user) {
1660
- * throw new NotFoundException('User not found')
1661
- * }
1662
- * return user
1663
- * }
1664
- * ```
1665
- */ var NotFoundException = class extends HttpException {
1666
- response;
1667
- error;
1668
- /**
1669
- * Creates a new NotFoundException.
1670
- *
1671
- * @param response - Error message or response object
1672
- * @param error - Optional underlying error for logging
1673
- */ constructor(response, error) {
1674
- super(404, response, error), this.response = response, this.error = error;
3390
+ function defineMetadata(Class, metadata) {
3391
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
3392
+ configurable: true,
3393
+ enumerable: true,
3394
+ value: metadata
3395
+ });
1675
3396
  }
1676
- };
1677
-
1678
- //#endregion
1679
- //#region src/exceptions/unauthorized.exception.mts
1680
- /**
1681
- * Exception that represents a 401 Unauthorized HTTP error.
1682
- *
1683
- * Use this exception when the client is not authenticated or authentication failed.
1684
- *
1685
- * @example
1686
- * ```typescript
1687
- * @Endpoint(getUserEndpoint)
1688
- * @UseGuards(AuthGuard)
1689
- * async getUser(request: EndpointParams<typeof getUserEndpoint>) {
1690
- * if (!request.headers.authorization) {
1691
- * throw new UnauthorizedException('Authentication required')
1692
- * }
1693
- * // ...
1694
- * }
1695
- * ```
1696
- */ var UnauthorizedException = class extends HttpException {
1697
- /**
1698
- * Creates a new UnauthorizedException.
1699
- *
1700
- * @param message - Error message or response object
1701
- * @param error - Optional underlying error for logging
1702
- */ constructor(message, error) {
1703
- super(401, message, error);
3397
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
3398
+ if (parentClass !== void 0) var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
3399
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
3400
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
3401
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
3402
+ return {
3403
+ e,
3404
+ get c() {
3405
+ return applyClassDecs(targetClass, classDecs, metadata);
3406
+ }
3407
+ };
3408
+ };
3409
+ }
3410
+ function _apply_decs_2203_r$12(targetClass, memberDecs, classDecs, parentClass) {
3411
+ return (_apply_decs_2203_r$12 = applyDecs2203RFactory$12())(targetClass, memberDecs, classDecs, parentClass);
3412
+ }
3413
+ var _dec$12, _initClass$12;
3414
+ let _ValidationErrorResponderService;
3415
+ _dec$12 = (0, _navios_di.Injectable)({
3416
+ token: ValidationErrorResponderToken,
3417
+ priority: -10
3418
+ });
3419
+ var ValidationErrorResponderService = class {
3420
+ static {
3421
+ ({c: [_ValidationErrorResponderService, _initClass$12]} = _apply_decs_2203_r$12(this, [], [_dec$12]));
3422
+ }
3423
+ getResponse(error, description) {
3424
+ if (error instanceof zod_v4.ZodError) return {
3425
+ statusCode: 400,
3426
+ payload: {
3427
+ type: "about:blank",
3428
+ title: "Validation Error",
3429
+ status: 400,
3430
+ detail: description ?? "Request validation failed",
3431
+ errors: (0, zod_v4.treeifyError)(error)
3432
+ },
3433
+ headers: { "Content-Type": "application/problem+json" }
3434
+ };
3435
+ return {
3436
+ statusCode: 400,
3437
+ payload: {
3438
+ type: "about:blank",
3439
+ title: "Validation Error",
3440
+ status: 400,
3441
+ detail: description ?? (error instanceof Error ? error.message : "Validation failed")
3442
+ },
3443
+ headers: { "Content-Type": "application/problem+json" }
3444
+ };
1704
3445
  }
1705
- };
1706
-
1707
- //#endregion
1708
- //#region src/exceptions/conflict.exception.mts
1709
- /**
1710
- * Exception that represents a 409 Conflict HTTP error.
1711
- *
1712
- * Use this exception when the request conflicts with the current state of the resource
1713
- * (e.g., trying to create a resource that already exists).
1714
- *
1715
- * @example
1716
- * ```typescript
1717
- * @Endpoint(createUserEndpoint)
1718
- * async createUser(request: EndpointParams<typeof createUserEndpoint>) {
1719
- * const existing = await this.userService.findByEmail(request.data.email)
1720
- * if (existing) {
1721
- * throw new ConflictException('User with this email already exists')
1722
- * }
1723
- * // ...
1724
- * }
1725
- * ```
1726
- */ var ConflictException = class extends HttpException {
1727
- /**
1728
- * Creates a new ConflictException.
1729
- *
1730
- * @param message - Error message or response object
1731
- * @param error - Optional underlying error for logging
1732
- */ constructor(message, error) {
1733
- super(409, message, error);
3446
+ static {
3447
+ _initClass$12();
1734
3448
  }
1735
3449
  };
1736
3450
 
@@ -2374,6 +4088,7 @@ var GuardRunnerService = class {
2374
4088
  static {
2375
4089
  ({c: [_GuardRunnerService, _initClass$10]} = _apply_decs_2203_r$10(this, [], [_dec$10]));
2376
4090
  }
4091
+ errorProducer = (0, _navios_di.inject)(_ErrorResponseProducerService);
2377
4092
  logger = (0, _navios_di.inject)(Logger, { context: _GuardRunnerService.name });
2378
4093
  /**
2379
4094
  * Runs guards that need to be resolved from a scoped container.
@@ -2407,12 +4122,14 @@ var GuardRunnerService = class {
2407
4122
  return false;
2408
4123
  } else {
2409
4124
  this.logger.error("Error running guard", error);
2410
- executionContext.getReply().status(500).send({ message: "Internal server error" });
4125
+ const errorResponse = this.errorProducer.respond(FrameworkError.InternalServerError, error);
4126
+ executionContext.getReply().status(errorResponse.statusCode).send(errorResponse.payload);
2411
4127
  return false;
2412
4128
  }
2413
4129
  }
2414
4130
  if (!canActivate) {
2415
- executionContext.getReply().status(403).send({ message: "Forbidden" });
4131
+ const errorResponse = this.errorProducer.respond(FrameworkError.Forbidden, null);
4132
+ executionContext.getReply().status(errorResponse.statusCode).send(errorResponse.payload);
2416
4133
  return false;
2417
4134
  }
2418
4135
  return canActivate;
@@ -2765,6 +4482,7 @@ var ModuleLoaderService = class {
2765
4482
  controllers: new Set(controllers),
2766
4483
  imports: /* @__PURE__ */ new Set(),
2767
4484
  guards: /* @__PURE__ */ new Set(),
4485
+ overrides: /* @__PURE__ */ new Set(),
2768
4486
  customAttributes: /* @__PURE__ */ new Map()
2769
4487
  };
2770
4488
  this.modulesMetadata.set(moduleName, metadata);
@@ -2781,6 +4499,7 @@ var ModuleLoaderService = class {
2781
4499
  const imports = metadata.imports ?? /* @__PURE__ */ new Set();
2782
4500
  const loadingPromises = Array.from(imports).map(async (importedModule) => this.traverseModules(importedModule, metadata));
2783
4501
  await Promise.all(loadingPromises);
4502
+ this.validateOverrides(metadata, moduleName);
2784
4503
  const instance = await this.container.get(module$1);
2785
4504
  if (instance.onModuleInit) await instance.onModuleInit();
2786
4505
  this.logger.debug(`Module ${moduleName} loaded`);
@@ -2790,6 +4509,26 @@ var ModuleLoaderService = class {
2790
4509
  throw error;
2791
4510
  }
2792
4511
  }
4512
+ validateOverrides(metadata, moduleName) {
4513
+ if (!metadata.overrides || metadata.overrides.size === 0) return;
4514
+ const registry = this.container.getRegistry();
4515
+ for (const overrideClass of metadata.overrides) try {
4516
+ const overrideToken = (0, _navios_di.getInjectableToken)(overrideClass);
4517
+ const allRegistrations = registry.getAll(overrideToken);
4518
+ if (allRegistrations.length === 0) {
4519
+ this.logger.warn(`[Navios] Override ${overrideClass.name} in module ${moduleName} is not registered. Make sure it has @Injectable decorator.`);
4520
+ continue;
4521
+ }
4522
+ const highestPriorityRegistration = allRegistrations[0];
4523
+ if (highestPriorityRegistration.target !== overrideClass) {
4524
+ const overrideRegistration = allRegistrations.find((r) => r.target === overrideClass);
4525
+ if (!overrideRegistration) this.logger.warn(`[Navios] Override ${overrideClass.name} in module ${moduleName} is registered but not found in registry for token ${overrideToken.toString()}.`);
4526
+ else this.logger.warn(`[Navios] Override ${overrideClass.name} in module ${moduleName} is not active. Current active service: ${highestPriorityRegistration.target.name} (priority: ${highestPriorityRegistration.priority}). Override priority: ${overrideRegistration.priority}. Override needs higher priority to take effect.`);
4527
+ } else this.logger.debug(`[Navios] Override ${overrideClass.name} in module ${moduleName} is active (priority: ${highestPriorityRegistration.priority})`);
4528
+ } catch (error) {
4529
+ this.logger.warn(`[Navios] Failed to validate override ${overrideClass.name} in module ${moduleName}: ${error}`);
4530
+ }
4531
+ }
2793
4532
  mergeMetadata(metadata, parentMetadata) {
2794
4533
  if (parentMetadata.guards) for (const guard of parentMetadata.guards) metadata.guards.add(guard);
2795
4534
  if (parentMetadata.customAttributes) for (const [key, value] of parentMetadata.customAttributes) {
@@ -5926,6 +7665,18 @@ Object.defineProperty(exports, 'ForbiddenException', {
5926
7665
  return ForbiddenException;
5927
7666
  }
5928
7667
  });
7668
+ Object.defineProperty(exports, 'ForbiddenResponderToken', {
7669
+ enumerable: true,
7670
+ get: function () {
7671
+ return ForbiddenResponderToken;
7672
+ }
7673
+ });
7674
+ Object.defineProperty(exports, 'FrameworkError', {
7675
+ enumerable: true,
7676
+ get: function () {
7677
+ return FrameworkError;
7678
+ }
7679
+ });
5929
7680
  Object.defineProperty(exports, 'HttpException', {
5930
7681
  enumerable: true,
5931
7682
  get: function () {
@@ -5938,6 +7689,12 @@ Object.defineProperty(exports, 'InternalServerErrorException', {
5938
7689
  return InternalServerErrorException;
5939
7690
  }
5940
7691
  });
7692
+ Object.defineProperty(exports, 'InternalServerErrorResponderToken', {
7693
+ enumerable: true,
7694
+ get: function () {
7695
+ return InternalServerErrorResponderToken;
7696
+ }
7697
+ });
5941
7698
  Object.defineProperty(exports, 'LOG_LEVELS', {
5942
7699
  enumerable: true,
5943
7700
  get: function () {
@@ -5968,12 +7725,24 @@ Object.defineProperty(exports, 'NotFoundException', {
5968
7725
  return NotFoundException;
5969
7726
  }
5970
7727
  });
7728
+ Object.defineProperty(exports, 'NotFoundResponderToken', {
7729
+ enumerable: true,
7730
+ get: function () {
7731
+ return NotFoundResponderToken;
7732
+ }
7733
+ });
5971
7734
  Object.defineProperty(exports, 'UnauthorizedException', {
5972
7735
  enumerable: true,
5973
7736
  get: function () {
5974
7737
  return UnauthorizedException;
5975
7738
  }
5976
7739
  });
7740
+ Object.defineProperty(exports, 'ValidationErrorResponderToken', {
7741
+ enumerable: true,
7742
+ get: function () {
7743
+ return ValidationErrorResponderToken;
7744
+ }
7745
+ });
5977
7746
  Object.defineProperty(exports, '_ConfigService', {
5978
7747
  enumerable: true,
5979
7748
  get: function () {
@@ -5992,6 +7761,18 @@ Object.defineProperty(exports, '_EndpointAdapterFactory', {
5992
7761
  return _EndpointAdapterFactory;
5993
7762
  }
5994
7763
  });
7764
+ Object.defineProperty(exports, '_ErrorResponseProducerService', {
7765
+ enumerable: true,
7766
+ get: function () {
7767
+ return _ErrorResponseProducerService;
7768
+ }
7769
+ });
7770
+ Object.defineProperty(exports, '_ForbiddenResponderService', {
7771
+ enumerable: true,
7772
+ get: function () {
7773
+ return _ForbiddenResponderService;
7774
+ }
7775
+ });
5995
7776
  Object.defineProperty(exports, '_GuardRunnerService', {
5996
7777
  enumerable: true,
5997
7778
  get: function () {
@@ -6010,6 +7791,12 @@ Object.defineProperty(exports, '_InstanceResolverService', {
6010
7791
  return _InstanceResolverService;
6011
7792
  }
6012
7793
  });
7794
+ Object.defineProperty(exports, '_InternalServerErrorResponderService', {
7795
+ enumerable: true,
7796
+ get: function () {
7797
+ return _InternalServerErrorResponderService;
7798
+ }
7799
+ });
6013
7800
  Object.defineProperty(exports, '_LoggerInstance', {
6014
7801
  enumerable: true,
6015
7802
  get: function () {
@@ -6034,6 +7821,12 @@ Object.defineProperty(exports, '_NaviosApplication', {
6034
7821
  return _NaviosApplication;
6035
7822
  }
6036
7823
  });
7824
+ Object.defineProperty(exports, '_NotFoundResponderService', {
7825
+ enumerable: true,
7826
+ get: function () {
7827
+ return _NotFoundResponderService;
7828
+ }
7829
+ });
6037
7830
  Object.defineProperty(exports, '_ReplyFactory', {
6038
7831
  enumerable: true,
6039
7832
  get: function () {
@@ -6052,6 +7845,12 @@ Object.defineProperty(exports, '_StreamAdapterFactory', {
6052
7845
  return _StreamAdapterFactory;
6053
7846
  }
6054
7847
  });
7848
+ Object.defineProperty(exports, '_ValidationErrorResponderService', {
7849
+ enumerable: true,
7850
+ get: function () {
7851
+ return _ValidationErrorResponderService;
7852
+ }
7853
+ });
6055
7854
  Object.defineProperty(exports, '_XmlStreamAdapterFactory', {
6056
7855
  enumerable: true,
6057
7856
  get: function () {
@@ -6220,4 +8019,4 @@ Object.defineProperty(exports, 'yellow', {
6220
8019
  return yellow;
6221
8020
  }
6222
8021
  });
6223
- //# sourceMappingURL=src-Cu9OAnfp.cjs.map
8022
+ //# sourceMappingURL=src-C46ePe3d.cjs.map