@xeno-js/core 4.1.1 → 4.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -37,7 +37,7 @@ var init_concurrency = __esm({
37
37
  });
38
38
 
39
39
  // src/infrastructure/context/request-context.ts
40
- import { Guards as Guards31 } from "@xeno-js/shared";
40
+ import { Guards as Guards32 } from "@xeno-js/shared";
41
41
  var NodeRequestContext;
42
42
  var init_request_context = __esm({
43
43
  "src/infrastructure/context/request-context.ts"() {
@@ -69,7 +69,7 @@ var init_request_context = __esm({
69
69
  }
70
70
  updateIdentity(identity) {
71
71
  const store = this._storage.getStore();
72
- if (Guards31.isDefined(store) && Guards31.isDefined(store.context)) {
72
+ if (Guards32.isDefined(store) && Guards32.isDefined(store.context)) {
73
73
  store.context = Object.freeze({
74
74
  ...store.context,
75
75
  identity: Object.freeze(identity)
@@ -78,28 +78,28 @@ var init_request_context = __esm({
78
78
  }
79
79
  getContext() {
80
80
  const store = this._storage.getStore();
81
- if (!Guards31.isDefined(store)) return void 0;
81
+ if (!Guards32.isDefined(store)) return void 0;
82
82
  const context = store.context;
83
83
  return Object.freeze(context);
84
84
  }
85
85
  getIdentity() {
86
86
  const store = this._storage.getStore();
87
- if (!Guards31.isDefined(store)) return void 0;
87
+ if (!Guards32.isDefined(store)) return void 0;
88
88
  return Object.freeze(store.context?.identity);
89
89
  }
90
90
  getScope() {
91
91
  const store = this._storage.getStore();
92
- if (!Guards31.isDefined(store)) return void 0;
92
+ if (!Guards32.isDefined(store)) return void 0;
93
93
  return store.scope;
94
94
  }
95
95
  getNetworkContext() {
96
96
  const store = this._storage.getStore();
97
- if (!Guards31.isDefined(store)) return void 0;
97
+ if (!Guards32.isDefined(store)) return void 0;
98
98
  return Object.freeze(store.context?.network);
99
99
  }
100
100
  getTracingContext() {
101
101
  const store = this._storage.getStore();
102
- if (!Guards31.isDefined(store)) return void 0;
102
+ if (!Guards32.isDefined(store)) return void 0;
103
103
  return Object.freeze(store.context?.tracing);
104
104
  }
105
105
  };
@@ -898,7 +898,7 @@ var NoAuthGateKeeper = class {
898
898
  import { LOG_LEVEL, LOG_LEVEL_NAMES } from "@xeno-js/shared";
899
899
 
900
900
  // src/application/loggers/utils/logger-context.utils.ts
901
- import { HttpHelper } from "@xeno-js/shared";
901
+ import { Guards as Guards11, HttpHelper, StringHelper } from "@xeno-js/shared";
902
902
  var LoggerUtils = Object.freeze({
903
903
  /**
904
904
  * @description toSafeContext converts a RequestContext object to a LoggerContext object, ensuring that only the necessary fields are included.
@@ -906,7 +906,7 @@ var LoggerUtils = Object.freeze({
906
906
  * @returns The converted LoggerContext object.
907
907
  */
908
908
  toSafeContext(ctx) {
909
- return {
909
+ const context = {
910
910
  identity: {
911
911
  userId: ctx?.identity?.userId,
912
912
  tenantId: ctx?.identity?.tenantId
@@ -925,6 +925,23 @@ var LoggerUtils = Object.freeze({
925
925
  },
926
926
  messaging: ctx?.messaging
927
927
  };
928
+ return StringHelper.safeStringifyObject(context);
929
+ },
930
+ toNormalizeError(error) {
931
+ if (error instanceof Error) {
932
+ return {
933
+ message: error.message,
934
+ name: error.name,
935
+ stack: error.stack,
936
+ cause: error.cause
937
+ };
938
+ }
939
+ const errorString = Guards11.isString(error) ? error : StringHelper.safeStringify(error);
940
+ const customError = new Error(errorString);
941
+ if (Guards11.isObject(error) && Guards11.isDefined(error)) {
942
+ Object.assign(customError, error);
943
+ }
944
+ return customError;
928
945
  }
929
946
  });
930
947
 
@@ -1113,10 +1130,10 @@ var NotSpecification = class extends Specification {
1113
1130
  };
1114
1131
 
1115
1132
  // src/infrastructure/builder/app.builder.ts
1116
- import { Guards as Guards65, LOG_LEVEL as LOG_LEVEL8, TOKENS as TOKENS17 } from "@xeno-js/shared";
1133
+ import { Guards as Guards66, LOG_LEVEL as LOG_LEVEL8, TOKENS as TOKENS17 } from "@xeno-js/shared";
1117
1134
 
1118
1135
  // src/infrastructure/configuration/node.configuration.ts
1119
- import { Guards as Guards11 } from "@xeno-js/shared";
1136
+ import { Guards as Guards12 } from "@xeno-js/shared";
1120
1137
  var EnvironmentConfigurationService = class {
1121
1138
  /**
1122
1139
  * @description Internal dictionary to hold environment variables.
@@ -1138,7 +1155,7 @@ var EnvironmentConfigurationService = class {
1138
1155
  }
1139
1156
  get(key, defaultValue) {
1140
1157
  const value = this._env[key];
1141
- if (Guards11.isNullOrEmpty(value)) {
1158
+ if (Guards12.isNullOrEmpty(value)) {
1142
1159
  return defaultValue;
1143
1160
  }
1144
1161
  return value;
@@ -1148,7 +1165,7 @@ var EnvironmentConfigurationService = class {
1148
1165
  }
1149
1166
  getNumber(key, defaultValue) {
1150
1167
  const value = this.get(key);
1151
- if (Guards11.isNullOrEmpty(value)) {
1168
+ if (Guards12.isNullOrEmpty(value)) {
1152
1169
  return defaultValue;
1153
1170
  }
1154
1171
  const parsed = Number(value);
@@ -1161,7 +1178,7 @@ var EnvironmentConfigurationService = class {
1161
1178
  }
1162
1179
  getBoolean(key, defaultValue) {
1163
1180
  const value = this.get(key);
1164
- if (Guards11.isNullOrEmpty(value)) {
1181
+ if (Guards12.isNullOrEmpty(value)) {
1165
1182
  return defaultValue;
1166
1183
  }
1167
1184
  const normalized = value.toLowerCase().trim();
@@ -1173,7 +1190,7 @@ var EnvironmentConfigurationService = class {
1173
1190
  }
1174
1191
  getOrThrow(key) {
1175
1192
  const value = this.get(key);
1176
- if (!Guards11.isDefined(value)) {
1193
+ if (!Guards12.isDefined(value)) {
1177
1194
  throw new Error(
1178
1195
  `[Configuration Error]: Required configuration key "${key}" is missing in the environment.`
1179
1196
  );
@@ -1183,7 +1200,7 @@ var EnvironmentConfigurationService = class {
1183
1200
  };
1184
1201
 
1185
1202
  // src/infrastructure/configuration/vite.configuration.ts
1186
- import { Guards as Guards12 } from "@xeno-js/shared";
1203
+ import { Guards as Guards13 } from "@xeno-js/shared";
1187
1204
  var VITE_PREFIX = "VITE_";
1188
1205
  var ViteConfigurationService = class {
1189
1206
  constructor(_env = import.meta.env ?? {}) {
@@ -1193,12 +1210,12 @@ var ViteConfigurationService = class {
1193
1210
  get(key, defaultValue) {
1194
1211
  const fullKey = key.startsWith(VITE_PREFIX) ? key : `VITE_${key}`;
1195
1212
  const value = String(this._env[fullKey]);
1196
- if (!Guards12.isNullOrEmpty(value)) return value;
1213
+ if (!Guards13.isNullOrEmpty(value)) return value;
1197
1214
  return defaultValue;
1198
1215
  }
1199
1216
  getNumber(key, defaultValue) {
1200
1217
  const rawValue = this.get(key);
1201
- if (Guards12.isDefined(rawValue)) {
1218
+ if (Guards13.isDefined(rawValue)) {
1202
1219
  const parsed = Number(rawValue);
1203
1220
  if (!Number.isNaN(parsed)) return parsed;
1204
1221
  }
@@ -1206,7 +1223,7 @@ var ViteConfigurationService = class {
1206
1223
  }
1207
1224
  getBoolean(key, defaultValue) {
1208
1225
  const rawValue = this.get(key);
1209
- if (Guards12.isDefined(rawValue)) {
1226
+ if (Guards13.isDefined(rawValue)) {
1210
1227
  const str = String(rawValue).toLowerCase().trim();
1211
1228
  if (str.toLowerCase() === "true" || str === "1") return true;
1212
1229
  if (str.toLowerCase() === "false" || str === "0") return false;
@@ -1215,7 +1232,7 @@ var ViteConfigurationService = class {
1215
1232
  }
1216
1233
  getOrThrow(key) {
1217
1234
  const val = this.get(key);
1218
- if (!Guards12.isDefined(val)) {
1235
+ if (!Guards13.isDefined(val)) {
1219
1236
  throw new Error(`[Configuration Error]: Missing required environment variable "${key}".`);
1220
1237
  }
1221
1238
  return val;
@@ -1226,7 +1243,7 @@ var ViteConfigurationService = class {
1226
1243
  };
1227
1244
 
1228
1245
  // src/infrastructure/container/service-container.ts
1229
- import { Guards as Guards13 } from "@xeno-js/shared";
1246
+ import { Guards as Guards14 } from "@xeno-js/shared";
1230
1247
  var ContainerScope = class {
1231
1248
  constructor(container, parentScope) {
1232
1249
  this.container = container;
@@ -1332,7 +1349,7 @@ var ServiceContainer = class {
1332
1349
  * @link https://github.com/xeno-js/xeno-js
1333
1350
  */
1334
1351
  internalExecuteInContext(callback) {
1335
- if (Guards13.isDefined(this.resolutionStack)) return callback();
1352
+ if (Guards14.isDefined(this.resolutionStack)) return callback();
1336
1353
  this.resolutionStack = {
1337
1354
  stack: /* @__PURE__ */ new Set()
1338
1355
  };
@@ -1357,14 +1374,14 @@ var ServiceContainer = class {
1357
1374
  */
1358
1375
  internalResolveInternal(token, currentScope) {
1359
1376
  const registration = this.registrations.get(token);
1360
- if (!Guards13.isDefined(registration)) {
1377
+ if (!Guards14.isDefined(registration)) {
1361
1378
  const tokenName = token.toString();
1362
1379
  throw new Error(
1363
1380
  `[DI Container Error]: Registration not found for token '${tokenName}'. Ensure the service is registered before resolving.`
1364
1381
  );
1365
1382
  }
1366
1383
  const currentStack = this.resolutionStack;
1367
- if (!Guards13.isDefined(currentStack)) {
1384
+ if (!Guards14.isDefined(currentStack)) {
1368
1385
  throw new Error(`[DI Container Error]: Execution outside the IoC container context.`);
1369
1386
  }
1370
1387
  if (currentStack.stack.has(token)) {
@@ -1404,7 +1421,7 @@ var ServiceContainer = class {
1404
1421
  }
1405
1422
  if (registration.lifetime === "scoped") {
1406
1423
  const existingInstance = currentScope.getScopedInstance(token);
1407
- if (Guards13.isDefined(existingInstance)) {
1424
+ if (Guards14.isDefined(existingInstance)) {
1408
1425
  return existingInstance;
1409
1426
  }
1410
1427
  return executeWithStackIsolation("scoped", () => {
@@ -1429,16 +1446,16 @@ var ServiceContainer = class {
1429
1446
  };
1430
1447
  var isDisposable = Object.freeze({
1431
1448
  check: (obj) => {
1432
- return Guards13.isDefined(obj) && Guards13.isObject(obj) && "dispose" in obj && Guards13.hasMethod(obj, "dispose");
1449
+ return Guards14.isDefined(obj) && Guards14.isObject(obj) && "dispose" in obj && Guards14.hasMethod(obj, "dispose");
1433
1450
  }
1434
1451
  });
1435
1452
 
1436
1453
  // src/infrastructure/modules/auth.module.ts
1437
- import { Guards as Guards22 } from "@xeno-js/shared";
1454
+ import { Guards as Guards23 } from "@xeno-js/shared";
1438
1455
  import { TOKENS as TOKENS2 } from "@xeno-js/shared";
1439
1456
 
1440
1457
  // src/infrastructure/services/allow_methods/allow-method.service.ts
1441
- import { Guards as Guards14, RoutePatternHelper } from "@xeno-js/shared";
1458
+ import { Guards as Guards15, RoutePatternHelper } from "@xeno-js/shared";
1442
1459
  var AllowMethodRegistry = class {
1443
1460
  _staticRoutes = /* @__PURE__ */ new Map();
1444
1461
  _dynamicRoutes = [];
@@ -1454,7 +1471,7 @@ var AllowMethodRegistry = class {
1454
1471
  check(path, method) {
1455
1472
  const cleanPath = RoutePatternHelper.normalizePath(path.split("?")[0].split("#")[0]);
1456
1473
  const staticMethods = this._staticRoutes.get(cleanPath);
1457
- if (Guards14.isDefined(staticMethods)) return staticMethods.includes(method);
1474
+ if (Guards15.isDefined(staticMethods)) return staticMethods.includes(method);
1458
1475
  for (const route of this._dynamicRoutes) {
1459
1476
  if (route.pattern.test(cleanPath)) return route.methods.includes(method);
1460
1477
  }
@@ -1463,11 +1480,11 @@ var AllowMethodRegistry = class {
1463
1480
  getMethods(path) {
1464
1481
  const cleanPath = RoutePatternHelper.normalizePath(path.split("?")[0].split("#")[0]);
1465
1482
  const methods = this.findMethods(cleanPath);
1466
- return Guards14.isDefined(methods) ? methods.join(", ").toUpperCase() : "";
1483
+ return Guards15.isDefined(methods) ? methods.join(", ").toUpperCase() : "";
1467
1484
  }
1468
1485
  findMethods(cleanPath) {
1469
1486
  const staticMethods = this._staticRoutes.get(cleanPath);
1470
- if (Guards14.isDefined(staticMethods)) return staticMethods;
1487
+ if (Guards15.isDefined(staticMethods)) return staticMethods;
1471
1488
  for (const route of this._dynamicRoutes) {
1472
1489
  if (route.pattern.test(cleanPath)) return route.methods;
1473
1490
  }
@@ -1476,14 +1493,14 @@ var AllowMethodRegistry = class {
1476
1493
  };
1477
1494
 
1478
1495
  // src/infrastructure/services/allow_origins/allow-origin.http.ts
1479
- import { Guards as Guards15 } from "@xeno-js/shared";
1496
+ import { Guards as Guards16 } from "@xeno-js/shared";
1480
1497
  var AllowOrigin = class {
1481
1498
  constructor(_list) {
1482
1499
  this._list = _list;
1483
1500
  }
1484
1501
  _list;
1485
1502
  isAllowed(origin) {
1486
- if (Guards15.isNullOrEmpty(origin)) return true;
1503
+ if (Guards16.isNullOrEmpty(origin)) return true;
1487
1504
  const cleanOrigin = origin.trim().toLowerCase();
1488
1505
  for (const pattern of this._list) {
1489
1506
  const cleanPattern = pattern.trim().toLowerCase();
@@ -1493,7 +1510,7 @@ var AllowOrigin = class {
1493
1510
  const domainSuffix = cleanPattern.substring(1);
1494
1511
  if (cleanOrigin.endsWith(domainSuffix)) {
1495
1512
  const prefix = cleanOrigin.slice(0, cleanOrigin.length - domainSuffix.length);
1496
- if (!Guards15.isNullOrEmpty(prefix) && !prefix.includes(".")) return true;
1513
+ if (!Guards16.isNullOrEmpty(prefix) && !prefix.includes(".")) return true;
1497
1514
  }
1498
1515
  }
1499
1516
  }
@@ -1505,7 +1522,7 @@ var AllowOrigin = class {
1505
1522
  init_concurrency();
1506
1523
 
1507
1524
  // src/infrastructure/services/cookies/cookies.service.ts
1508
- import { Guards as Guards16, HttpHelper as HttpHelper2 } from "@xeno-js/shared";
1525
+ import { Guards as Guards17, HttpHelper as HttpHelper2 } from "@xeno-js/shared";
1509
1526
  var CookieHandler = class {
1510
1527
  constructor(_contextAccessor, _config, _defaultOpts) {
1511
1528
  this._contextAccessor = _contextAccessor;
@@ -1519,7 +1536,7 @@ var CookieHandler = class {
1519
1536
  getAll() {
1520
1537
  const network = this._contextAccessor.getNetworkContext();
1521
1538
  const cookie = network?.cookies;
1522
- if (Guards16.isNullOrEmpty(cookie)) return [];
1539
+ if (Guards17.isNullOrEmpty(cookie)) return [];
1523
1540
  const parsedCookies = HttpHelper2.parseCookies(network?.cookies);
1524
1541
  return Object.entries(parsedCookies).map(([name, value]) => ({
1525
1542
  name,
@@ -1545,14 +1562,14 @@ var CookieHandler = class {
1545
1562
  ...this._defaultOpts,
1546
1563
  ...cookie
1547
1564
  };
1548
- if (!Guards16.isNullOrEmpty(merged.path)) str += `; Path=${merged.path}`;
1549
- if (!Guards16.isNullOrEmpty(merged.maxAge)) str += `; Max-Age=${merged.maxAge}`;
1550
- if (!Guards16.isNullOrEmpty(merged.expires)) str += `; Expires=${merged.expires.toUTCString()}`;
1551
- if (!Guards16.isNullOrEmpty(merged.domain)) str += `; Domain=${merged.domain}`;
1552
- if (!Guards16.isNullOrEmpty(merged.secure) && merged.secure) str += "; Secure";
1553
- if (!Guards16.isNullOrEmpty(merged.httpOnly) && merged.httpOnly) str += "; HttpOnly";
1554
- if (!Guards16.isNullOrEmpty(merged.sameSite)) {
1555
- if (Guards16.isBoolean(merged.sameSite)) {
1565
+ if (!Guards17.isNullOrEmpty(merged.path)) str += `; Path=${merged.path}`;
1566
+ if (!Guards17.isNullOrEmpty(merged.maxAge)) str += `; Max-Age=${merged.maxAge}`;
1567
+ if (!Guards17.isNullOrEmpty(merged.expires)) str += `; Expires=${merged.expires.toUTCString()}`;
1568
+ if (!Guards17.isNullOrEmpty(merged.domain)) str += `; Domain=${merged.domain}`;
1569
+ if (!Guards17.isNullOrEmpty(merged.secure) && merged.secure) str += "; Secure";
1570
+ if (!Guards17.isNullOrEmpty(merged.httpOnly) && merged.httpOnly) str += "; HttpOnly";
1571
+ if (!Guards17.isNullOrEmpty(merged.sameSite)) {
1572
+ if (Guards17.isBoolean(merged.sameSite)) {
1556
1573
  str += merged.sameSite ? "; SameSite=Strict" : "";
1557
1574
  } else {
1558
1575
  const val = merged.sameSite.toLowerCase();
@@ -1560,8 +1577,8 @@ var CookieHandler = class {
1560
1577
  str += `; SameSite=${formatted}`;
1561
1578
  }
1562
1579
  }
1563
- if (Guards16.isDefined(merged.partitioned)) str += "; Partitioned";
1564
- if (Guards16.isDefined(merged.priority)) {
1580
+ if (Guards17.isDefined(merged.partitioned)) str += "; Partitioned";
1581
+ if (Guards17.isDefined(merged.priority)) {
1565
1582
  const p = merged.priority.toLowerCase();
1566
1583
  const formattedPriority = p.charAt(0).toUpperCase() + p.slice(1);
1567
1584
  str += `; Priority=${formattedPriority}`;
@@ -1604,7 +1621,7 @@ var EdgeCryptoService = class {
1604
1621
  };
1605
1622
 
1606
1623
  // src/infrastructure/services/csrf/csrf-token.service.ts
1607
- import { Guards as Guards17 } from "@xeno-js/shared";
1624
+ import { Guards as Guards18 } from "@xeno-js/shared";
1608
1625
  var CsrfTokenService = class {
1609
1626
  constructor(_secret, _cryptoService) {
1610
1627
  this._secret = _secret;
@@ -1623,7 +1640,7 @@ var CsrfTokenService = class {
1623
1640
  if (separatorIndex <= 0) return false;
1624
1641
  const nonce = token.slice(0, separatorIndex);
1625
1642
  const signature = token.slice(separatorIndex + 1);
1626
- if (Guards17.isNullOrEmpty(nonce) || Guards17.isNullOrEmpty(signature)) return false;
1643
+ if (Guards18.isNullOrEmpty(nonce) || Guards18.isNullOrEmpty(signature)) return false;
1627
1644
  const expected = await this._cryptoService.hmacSha256(this._secret, `${subject}.${nonce}`);
1628
1645
  const encoder = new TextEncoder();
1629
1646
  const actualBuffer = encoder.encode(signature);
@@ -1634,7 +1651,7 @@ var CsrfTokenService = class {
1634
1651
  };
1635
1652
 
1636
1653
  // src/infrastructure/services/extractors/extract-bearer.extractor.ts
1637
- import { Guards as Guards18, HttpHelper as HttpHelper3 } from "@xeno-js/shared";
1654
+ import { Guards as Guards19, HttpHelper as HttpHelper3 } from "@xeno-js/shared";
1638
1655
  var BearerTokenExtractor = class {
1639
1656
  constructor(_cookiePrefix) {
1640
1657
  this._cookiePrefix = _cookiePrefix;
@@ -1642,14 +1659,14 @@ var BearerTokenExtractor = class {
1642
1659
  _cookiePrefix;
1643
1660
  extract(headers) {
1644
1661
  const authHeader = headers.get("Authorization");
1645
- if (Guards18.isDefined(authHeader) && authHeader.toLowerCase().startsWith("bearer ")) {
1662
+ if (Guards19.isDefined(authHeader) && authHeader.toLowerCase().startsWith("bearer ")) {
1646
1663
  return authHeader.substring(7);
1647
1664
  }
1648
1665
  const cookieHeader = headers.get("cookie");
1649
- if (Guards18.isDefined(cookieHeader)) {
1666
+ if (Guards19.isDefined(cookieHeader)) {
1650
1667
  const cookies = HttpHelper3.parseCookies(cookieHeader);
1651
1668
  const token = cookies[this._cookiePrefix];
1652
- if (Guards18.isDefined(token)) {
1669
+ if (Guards19.isDefined(token)) {
1653
1670
  return token;
1654
1671
  }
1655
1672
  }
@@ -1658,17 +1675,17 @@ var BearerTokenExtractor = class {
1658
1675
  };
1659
1676
 
1660
1677
  // src/infrastructure/services/extractors/http-cookie.extractor.ts
1661
- import { Guards as Guards19, HttpHelper as HttpHelper4 } from "@xeno-js/shared";
1678
+ import { Guards as Guards20, HttpHelper as HttpHelper4 } from "@xeno-js/shared";
1662
1679
  var HttpCookieExtractor = class {
1663
1680
  extract(cookie) {
1664
- if (!Guards19.isDefined(cookie.header)) return void 0;
1681
+ if (!Guards20.isDefined(cookie.header)) return void 0;
1665
1682
  const cookies = HttpHelper4.parseCookies(cookie.header);
1666
1683
  return cookies[cookie.name];
1667
1684
  }
1668
1685
  };
1669
1686
 
1670
1687
  // src/infrastructure/services/extractors/http-header.extractor.ts
1671
- import { Guards as Guards20, GuidHelper as GuidHelper4, HttpHelper as HttpHelper5, MathHelper } from "@xeno-js/shared";
1688
+ import { Guards as Guards21, GuidHelper as GuidHelper4, HttpHelper as HttpHelper5, MathHelper } from "@xeno-js/shared";
1672
1689
  var HttpHeaderExtractor = class {
1673
1690
  /**
1674
1691
  * @description Constructor for HttpHeaderExtractor. It takes an instance of IServiceExtractor for extracting Bearer tokens, allowing for separation of concerns and adherence to the Single Responsibility Principle (SRP). This design enables the HttpHeaderExtractor to focus on general header extraction while delegating the specific logic of Bearer token extraction to a dedicated extractor, promoting code reusability and maintainability.
@@ -1731,17 +1748,17 @@ var HttpHeaderExtractor = class {
1731
1748
  referer: cleanReferer,
1732
1749
  sequence: {
1733
1750
  sequenceId,
1734
- position: Guards20.isDefined(position) ? MathHelper.toNumber(position) : void 0,
1735
- size: Guards20.isDefined(size) ? MathHelper.toNumber(size) : void 0
1751
+ position: Guards21.isDefined(position) ? MathHelper.toNumber(position) : void 0,
1752
+ size: Guards21.isDefined(size) ? MathHelper.toNumber(size) : void 0
1736
1753
  },
1737
- expiration: Guards20.isDefined(expiration) ? MathHelper.toNumber(expiration) : void 0
1754
+ expiration: Guards21.isDefined(expiration) ? MathHelper.toNumber(expiration) : void 0
1738
1755
  };
1739
1756
  return metadata;
1740
1757
  }
1741
1758
  };
1742
1759
 
1743
1760
  // src/infrastructure/services/resolver/client-ip.resolver.ts
1744
- import { Guards as Guards21 } from "@xeno-js/shared";
1761
+ import { Guards as Guards22 } from "@xeno-js/shared";
1745
1762
  var ClientIpResolver = class {
1746
1763
  constructor(_trustedProxies = []) {
1747
1764
  this._trustedProxies = _trustedProxies;
@@ -1749,11 +1766,11 @@ var ClientIpResolver = class {
1749
1766
  _trustedProxies;
1750
1767
  resolve(req, clientIp) {
1751
1768
  const socketIp = req.socket?.remoteAddress;
1752
- if (!Guards21.isDefined(socketIp))
1753
- return !Guards21.isNullOrEmpty(clientIp) ? clientIp.split(",")[0].trim() : void 0;
1769
+ if (!Guards22.isDefined(socketIp))
1770
+ return !Guards22.isNullOrEmpty(clientIp) ? clientIp.split(",")[0].trim() : void 0;
1754
1771
  const isTrustedProxy = this._trustedProxies.includes(socketIp);
1755
1772
  if (!isTrustedProxy) return socketIp;
1756
- if (Guards21.isDefined(clientIp)) return clientIp.split(",")[0].trim();
1773
+ if (Guards22.isDefined(clientIp)) return clientIp.split(",")[0].trim();
1757
1774
  return socketIp;
1758
1775
  }
1759
1776
  };
@@ -1761,17 +1778,17 @@ var ClientIpResolver = class {
1761
1778
  // src/infrastructure/modules/auth.module.ts
1762
1779
  var AuthModule = class {
1763
1780
  async configure(container, opts) {
1764
- if (!Guards22.isDefined(opts.authService))
1781
+ if (!Guards23.isDefined(opts.authService))
1765
1782
  throw new Error(
1766
1783
  "[AuthModule Error]: An authService instance is required to configure AuthModule."
1767
1784
  );
1768
- if (Guards22.isDefined(opts.cookieHandlerOptions)) {
1769
- if (Guards22.isDefined(opts.cookieHandlerOptions.cookieHandlerCustom)) {
1785
+ if (Guards23.isDefined(opts.cookieHandlerOptions)) {
1786
+ if (Guards23.isDefined(opts.cookieHandlerOptions.cookieHandlerCustom)) {
1770
1787
  container.addScoped(
1771
1788
  TOKENS2.COOKIE_HANDLER,
1772
1789
  (c) => opts.cookieHandlerOptions.cookieHandlerCustom(c)
1773
1790
  );
1774
- } else if (Guards22.isDefined(opts.cookieHandlerOptions.enableDefault) && opts.cookieHandlerOptions.enableDefault.enable) {
1791
+ } else if (Guards23.isDefined(opts.cookieHandlerOptions.enableDefault) && opts.cookieHandlerOptions.enableDefault.enable) {
1775
1792
  container.addScoped(
1776
1793
  TOKENS2.COOKIE_HANDLER,
1777
1794
  (c) => new CookieHandler(
@@ -1787,7 +1804,7 @@ var AuthModule = class {
1787
1804
  container.addScoped(TOKENS2.BASE_AUTH_SERVICE, (c) => c.resolve(TOKENS2.AUTH_SERVICE));
1788
1805
  }
1789
1806
  getExtractor(opts, container) {
1790
- if (Guards22.isDefined(opts.tokenExtractor)) {
1807
+ if (Guards23.isDefined(opts.tokenExtractor)) {
1791
1808
  container.addSingleton(TOKENS2.TOKEN_SERVICE_EXTRACTOR, (c) => opts.tokenExtractor(c));
1792
1809
  } else {
1793
1810
  container.addSingleton(
@@ -1799,10 +1816,10 @@ var AuthModule = class {
1799
1816
  };
1800
1817
 
1801
1818
  // src/infrastructure/modules/cache.module.ts
1802
- import { Guards as Guards29, TOKENS as TOKENS6 } from "@xeno-js/shared";
1819
+ import { Guards as Guards30, TOKENS as TOKENS6 } from "@xeno-js/shared";
1803
1820
 
1804
1821
  // src/infrastructure/cache/inmemory.cache.ts
1805
- import { Guards as Guards23, StringHelper } from "@xeno-js/shared";
1822
+ import { Guards as Guards24, StringHelper as StringHelper2 } from "@xeno-js/shared";
1806
1823
  var InMemoryCache = class {
1807
1824
  /**
1808
1825
  * @description Constructs a new instance of the InMemoryCache class, which initializes an internal Map to store cached values. The Map is used to associate cache keys with their corresponding values and expiration times, allowing for efficient retrieval and management of cached data. The constructor does not take any parameters, as the in-memory cache is self-contained and does not require external dependencies or configuration.
@@ -1824,22 +1841,22 @@ var InMemoryCache = class {
1824
1841
  _cache;
1825
1842
  _cleanupInterval;
1826
1843
  _isNodeTimeout(timer) {
1827
- return Guards23.isDefined(timer) && Guards23.isObject(timer) && Guards23.hasMethod(timer, "unref");
1844
+ return Guards24.isDefined(timer) && Guards24.isObject(timer) && Guards24.hasMethod(timer, "unref");
1828
1845
  }
1829
1846
  async get(key) {
1830
1847
  const entry = this._cache.get(key);
1831
- if (!Guards23.isDefined(entry)) {
1848
+ if (!Guards24.isDefined(entry)) {
1832
1849
  return void 0;
1833
1850
  }
1834
- if (Guards23.isDefined(entry.expiresAt) && entry.expiresAt < Date.now()) {
1851
+ if (Guards24.isDefined(entry.expiresAt) && entry.expiresAt < Date.now()) {
1835
1852
  this._cache.delete(key);
1836
1853
  return void 0;
1837
1854
  }
1838
1855
  return JSON.parse(entry.value);
1839
1856
  }
1840
1857
  async set(key, value, ttl) {
1841
- const expiresAt = Guards23.isDefined(ttl) ? Date.now() + ttl * 1e3 : void 0;
1842
- this._cache.set(key, { value: StringHelper.safeStringify(value), expiresAt });
1858
+ const expiresAt = Guards24.isDefined(ttl) ? Date.now() + ttl * 1e3 : void 0;
1859
+ this._cache.set(key, { value: StringHelper2.safeStringify(value), expiresAt });
1843
1860
  }
1844
1861
  async setIfAbsent(key, value, ttl) {
1845
1862
  if (this._cache.has(key)) {
@@ -1853,10 +1870,10 @@ var InMemoryCache = class {
1853
1870
  }
1854
1871
  async has(key) {
1855
1872
  const entry = this._cache.get(key);
1856
- if (!Guards23.isDefined(entry)) {
1873
+ if (!Guards24.isDefined(entry)) {
1857
1874
  return false;
1858
1875
  }
1859
- if (Guards23.isDefined(entry.expiresAt) && entry.expiresAt < Date.now()) {
1876
+ if (Guards24.isDefined(entry.expiresAt) && entry.expiresAt < Date.now()) {
1860
1877
  this._cache.delete(key);
1861
1878
  return false;
1862
1879
  }
@@ -1868,23 +1885,23 @@ var InMemoryCache = class {
1868
1885
  async increment(key, ttlSeconds) {
1869
1886
  const entry = this._cache.get(key);
1870
1887
  const now = Date.now();
1871
- if (Guards23.isDefined(entry) && (!Guards23.isDefined(entry.expiresAt) || entry.expiresAt > now)) {
1872
- const nextValue = Number(StringHelper.safeParse(entry.value)) + 1;
1888
+ if (Guards24.isDefined(entry) && (!Guards24.isDefined(entry.expiresAt) || entry.expiresAt > now)) {
1889
+ const nextValue = Number(StringHelper2.safeParse(entry.value)) + 1;
1873
1890
  this._cache.set(key, {
1874
- value: StringHelper.safeStringify(nextValue),
1891
+ value: StringHelper2.safeStringify(nextValue),
1875
1892
  expiresAt: entry.expiresAt
1876
1893
  });
1877
1894
  return nextValue;
1878
1895
  }
1879
- const ttl = !Guards23.isNullOrEmpty(ttlSeconds) ? Number(ttlSeconds) : 60;
1896
+ const ttl = !Guards24.isNullOrEmpty(ttlSeconds) ? Number(ttlSeconds) : 60;
1880
1897
  const expiresAt = now + ttl * 1e3;
1881
- this._cache.set(key, { value: StringHelper.safeStringify(1), expiresAt });
1898
+ this._cache.set(key, { value: StringHelper2.safeStringify(1), expiresAt });
1882
1899
  return 1;
1883
1900
  }
1884
1901
  evictExpired() {
1885
1902
  const now = Date.now();
1886
1903
  for (const [key, entry] of this._cache.entries()) {
1887
- if (!Guards23.isDefined(entry.expiresAt) || entry.expiresAt > now) {
1904
+ if (!Guards24.isDefined(entry.expiresAt) || entry.expiresAt > now) {
1888
1905
  this._cache.delete(key);
1889
1906
  }
1890
1907
  }
@@ -1906,7 +1923,7 @@ var InMemoryCache = class {
1906
1923
  };
1907
1924
 
1908
1925
  // src/infrastructure/cache/key-builder.cache.ts
1909
- import { Guards as Guards24 } from "@xeno-js/shared";
1926
+ import { Guards as Guards25 } from "@xeno-js/shared";
1910
1927
  var CacheKeyBuilder = class {
1911
1928
  /**
1912
1929
  * @description Constructs a new instance of the CacheKeyBuilder class, which requires an IIdentityAccessor to access the current user's identity. The constructor initializes the dependency needed for building contextual cache keys based on the user's identity, enabling tenant-specific caching behavior in multi-tenant applications.
@@ -1923,14 +1940,14 @@ var CacheKeyBuilder = class {
1923
1940
  _identityAccessor;
1924
1941
  buildContextualKey(key) {
1925
1942
  const identity = this._identityAccessor.getIdentity();
1926
- if (Guards24.isDefined(identity) && !Guards24.isNullOrEmpty(identity.tenantId)) {
1943
+ if (Guards25.isDefined(identity) && !Guards25.isNullOrEmpty(identity.tenantId)) {
1927
1944
  return `tenant:${identity.tenantId}:${key}`;
1928
1945
  }
1929
1946
  return `${key}:public`;
1930
1947
  }
1931
1948
  buildUserScopedKey(key) {
1932
1949
  const identity = this._identityAccessor.getIdentity();
1933
- if (Guards24.isDefined(identity) && !Guards24.isNullOrEmpty(identity.userId)) {
1950
+ if (Guards25.isDefined(identity) && !Guards25.isNullOrEmpty(identity.userId)) {
1934
1951
  return this.buildContextualKey(`user:${identity.userId}:${key}`);
1935
1952
  }
1936
1953
  return this.buildContextualKey(key);
@@ -1938,7 +1955,7 @@ var CacheKeyBuilder = class {
1938
1955
  };
1939
1956
 
1940
1957
  // src/infrastructure/cache/rate-limit-key-builder.cache.ts
1941
- import { Guards as Guards25 } from "@xeno-js/shared";
1958
+ import { Guards as Guards26 } from "@xeno-js/shared";
1942
1959
  var RateLimitKeyBuilder = class {
1943
1960
  constructor(_contextAccessor) {
1944
1961
  this._contextAccessor = _contextAccessor;
@@ -1949,18 +1966,18 @@ var RateLimitKeyBuilder = class {
1949
1966
  const tenantId = ctx?.identity?.tenantId;
1950
1967
  const userId = ctx?.identity?.userId;
1951
1968
  const clientIp = ctx?.network?.clientIp;
1952
- if (!Guards25.isNullOrEmpty(tenantId) && !Guards25.isNullOrEmpty(userId))
1969
+ if (!Guards26.isNullOrEmpty(tenantId) && !Guards26.isNullOrEmpty(userId))
1953
1970
  return `ratelimit:tenant:${tenantId}:user:${userId}:${resource}`;
1954
- if (!Guards25.isNullOrEmpty(tenantId) && !Guards25.isNullOrEmpty(clientIp))
1971
+ if (!Guards26.isNullOrEmpty(tenantId) && !Guards26.isNullOrEmpty(clientIp))
1955
1972
  return `ratelimit:tenant:${tenantId}:ip:${clientIp}:${resource}`;
1956
- if (!Guards25.isNullOrEmpty(userId)) return `ratelimit:user:${userId}:${resource}`;
1957
- if (!Guards25.isNullOrEmpty(clientIp)) return `ratelimit:ip:${clientIp}:${resource}`;
1973
+ if (!Guards26.isNullOrEmpty(userId)) return `ratelimit:user:${userId}:${resource}`;
1974
+ if (!Guards26.isNullOrEmpty(clientIp)) return `ratelimit:ip:${clientIp}:${resource}`;
1958
1975
  return void 0;
1959
1976
  }
1960
1977
  };
1961
1978
 
1962
1979
  // src/infrastructure/modules/utils/auth.utils.ts
1963
- import { Guards as Guards26 } from "@xeno-js/shared";
1980
+ import { Guards as Guards27 } from "@xeno-js/shared";
1964
1981
  import {
1965
1982
  TOKENS as TOKENS3
1966
1983
  } from "@xeno-js/shared";
@@ -1977,7 +1994,7 @@ var AuthUtils = Object.freeze({
1977
1994
  */
1978
1995
  async addAuthZ(container, opts) {
1979
1996
  const strategies = [];
1980
- if (Guards26.isDefined(opts.policies)) {
1997
+ if (Guards27.isDefined(opts.policies)) {
1981
1998
  const policyRegistry = opts.policies;
1982
1999
  const registryInstance = new PolicyRegistry();
1983
2000
  const ctxAccessor = container.resolve(TOKENS3.CONTEXT_ACCESSOR);
@@ -1985,16 +2002,16 @@ var AuthUtils = Object.freeze({
1985
2002
  for (const [intent, policy] of Object.entries(policyRegistry)) {
1986
2003
  const intentLower = intent.toLowerCase();
1987
2004
  registryInstance.addPolicy(intentLower, policy);
1988
- if (!Guards26.isNullOrEmpty(policy.roles)) {
2005
+ if (!Guards27.isNullOrEmpty(policy.roles)) {
1989
2006
  Policies.add("roles");
1990
2007
  }
1991
- if (!Guards26.isNullOrEmpty(policy.permissions)) {
2008
+ if (!Guards27.isNullOrEmpty(policy.permissions)) {
1992
2009
  Policies.add("permissions");
1993
2010
  }
1994
- if (!Guards26.isNullOrEmpty(policy.userId)) {
2011
+ if (!Guards27.isNullOrEmpty(policy.userId)) {
1995
2012
  Policies.add("userId");
1996
2013
  }
1997
- if (!Guards26.isNullOrEmpty(policy.tenantId)) {
2014
+ if (!Guards27.isNullOrEmpty(policy.tenantId)) {
1998
2015
  Policies.add("tenantId");
1999
2016
  }
2000
2017
  }
@@ -2011,10 +2028,10 @@ var AuthUtils = Object.freeze({
2011
2028
  strategies.push(new TenantAuthorizationStrategy(registryInstance, ctxAccessor));
2012
2029
  }
2013
2030
  }
2014
- if (!Guards26.isNullOrEmpty(opts.customAuthorizationStrategy)) {
2031
+ if (!Guards27.isNullOrEmpty(opts.customAuthorizationStrategy)) {
2015
2032
  const customStrategies = opts.customAuthorizationStrategy;
2016
2033
  customStrategies.forEach((strategyToken) => {
2017
- if (Guards26.isDefined(strategyToken)) {
2034
+ if (Guards27.isDefined(strategyToken)) {
2018
2035
  strategies.push(strategyToken(container));
2019
2036
  }
2020
2037
  });
@@ -2043,11 +2060,11 @@ var CacheUtils = Object.freeze({
2043
2060
  });
2044
2061
 
2045
2062
  // src/infrastructure/modules/utils/logger.utils.ts
2046
- import { Guards as Guards28, LOG_LEVEL as LOG_LEVEL3 } from "@xeno-js/shared";
2063
+ import { Guards as Guards29, LOG_LEVEL as LOG_LEVEL3 } from "@xeno-js/shared";
2047
2064
  import { TOKENS as TOKENS5 } from "@xeno-js/shared";
2048
2065
 
2049
2066
  // src/infrastructure/loggers/console.logger.ts
2050
- import { Guards as Guards27, LOG_LEVEL as LOG_LEVEL2 } from "@xeno-js/shared";
2067
+ import { Guards as Guards28, LOG_LEVEL as LOG_LEVEL2 } from "@xeno-js/shared";
2051
2068
  var ConsoleLogger = class {
2052
2069
  /**
2053
2070
  * Constructs a new instance of the ConsoleLogger class, which takes an optional minimum log level. The minimum log level determines the threshold for logging messages, where messages with a log level below the specified minimum will be ignored.
@@ -2066,7 +2083,7 @@ var ConsoleLogger = class {
2066
2083
  track(level, message, context, error = void 0) {
2067
2084
  if (level < this._minLevel) return;
2068
2085
  const logMessage = `[${level}] ${message}`;
2069
- const payload = Guards27.isDefined(error) ? { ...context, error } : context;
2086
+ const payload = Guards28.isDefined(error) ? { ...context, error } : context;
2070
2087
  switch (level) {
2071
2088
  case LOG_LEVEL2.ERROR:
2072
2089
  console.error(logMessage, payload ?? {});
@@ -2100,7 +2117,7 @@ var LoggerUtils2 = Object.freeze({
2100
2117
  async addLogger(container, opts) {
2101
2118
  const loggerDependencies = [];
2102
2119
  if (opts.console) loggerDependencies.push(new ConsoleLogger(opts?.level));
2103
- if (!Guards28.isNullOrEmpty(opts.customLoggers)) {
2120
+ if (!Guards29.isNullOrEmpty(opts.customLoggers)) {
2104
2121
  const customLoggers = opts.customLoggers;
2105
2122
  for (const logger of customLoggers) {
2106
2123
  loggerDependencies.push(logger(container));
@@ -2120,21 +2137,21 @@ var CacheModule = class {
2120
2137
  TOKENS6.CACHE_KEY_BUILDER,
2121
2138
  (c) => new CacheKeyBuilder(c.resolve(TOKENS6.IDENTITY_ACCESSOR))
2122
2139
  );
2123
- if (opts.inMemory && Guards29.isDefined(opts.provider))
2140
+ if (opts.inMemory && Guards30.isDefined(opts.provider))
2124
2141
  throw new Error("Cannot use both in memory and provider cache");
2125
2142
  else if (opts.inMemory) {
2126
2143
  await CacheUtils.addCache(container);
2127
- } else if (Guards29.isDefined(opts.provider)) {
2144
+ } else if (Guards30.isDefined(opts.provider)) {
2128
2145
  container.addSingleton(TOKENS6.CACHE, (c) => opts.provider(c));
2129
2146
  } else throw new Error("No cache provider specified");
2130
2147
  }
2131
2148
  };
2132
2149
 
2133
2150
  // src/infrastructure/modules/context.module.ts
2134
- import { Guards as Guards35, TOKENS as TOKENS7 } from "@xeno-js/shared";
2151
+ import { Guards as Guards36, TOKENS as TOKENS7 } from "@xeno-js/shared";
2135
2152
 
2136
2153
  // src/infrastructure/events/event.dispatcher.ts
2137
- import { AppError as AppError12, Guards as Guards30, Result as Result16 } from "@xeno-js/shared";
2154
+ import { AppError as AppError12, Guards as Guards31, Result as Result16 } from "@xeno-js/shared";
2138
2155
  var EventDispatcher = class {
2139
2156
  _handlers = /* @__PURE__ */ new Map();
2140
2157
  subscribe(eventType, handler) {
@@ -2145,7 +2162,7 @@ var EventDispatcher = class {
2145
2162
  async publish(event, signal) {
2146
2163
  AppError12.throwIfAborted(signal, "EventDispatcher.publish");
2147
2164
  const handlers = this._handlers.get(event.eventType);
2148
- if (Guards30.isNullOrEmpty(handlers)) return Result16.ok();
2165
+ if (Guards31.isNullOrEmpty(handlers)) return Result16.ok();
2149
2166
  try {
2150
2167
  for (const handler of handlers) {
2151
2168
  const result = await handler.handle(event, signal);
@@ -2195,7 +2212,7 @@ var ServiceScopeFactory = class {
2195
2212
  };
2196
2213
 
2197
2214
  // src/infrastructure/factories/user-context.factory.ts
2198
- import { Guards as Guards32 } from "@xeno-js/shared";
2215
+ import { Guards as Guards33 } from "@xeno-js/shared";
2199
2216
  var UserContextFactory = class {
2200
2217
  /**
2201
2218
  * @description Constructs an instance of UserContextFactory.
@@ -2216,7 +2233,7 @@ var UserContextFactory = class {
2216
2233
  tenantId: void 0
2217
2234
  };
2218
2235
  const identity = this._identityFactory.getIdentity();
2219
- if (Guards32.isDefined(identity)) {
2236
+ if (Guards33.isDefined(identity)) {
2220
2237
  output.userId = identity.userId;
2221
2238
  output.tenantId = identity.tenantId;
2222
2239
  }
@@ -2225,7 +2242,7 @@ var UserContextFactory = class {
2225
2242
  };
2226
2243
 
2227
2244
  // src/infrastructure/http/adapter.http.ts
2228
- import { Guards as Guards33, HttpHelper as HttpHelper6, HttpRouteParamHelper } from "@xeno-js/shared";
2245
+ import { Guards as Guards34, HttpHelper as HttpHelper6, HttpRouteParamHelper } from "@xeno-js/shared";
2229
2246
  var HttpAdapter = class {
2230
2247
  constructor(_urlFactory) {
2231
2248
  this._urlFactory = _urlFactory;
@@ -2245,7 +2262,7 @@ var HttpAdapter = class {
2245
2262
  headers: req.headers
2246
2263
  };
2247
2264
  const parsedBody = HttpHelper6.parseBody(method, req.body);
2248
- if (Guards33.isDefined(parsedBody)) {
2265
+ if (Guards34.isDefined(parsedBody)) {
2249
2266
  init.body = parsedBody;
2250
2267
  init.duplex = "half";
2251
2268
  }
@@ -2258,14 +2275,14 @@ var HttpAdapter = class {
2258
2275
  };
2259
2276
 
2260
2277
  // src/infrastructure/http/url-builder.http.ts
2261
- import { Guards as Guards34 } from "@xeno-js/shared";
2278
+ import { Guards as Guards35 } from "@xeno-js/shared";
2262
2279
  var UrlBuilder = class {
2263
2280
  create(headers) {
2264
2281
  const forwardedProto = headers.get("x-forwarded-proto");
2265
- const protocol = Guards34.isDefined(forwardedProto) ? forwardedProto.split(",")[0].trim() : "http";
2282
+ const protocol = Guards35.isDefined(forwardedProto) ? forwardedProto.split(",")[0].trim() : "http";
2266
2283
  const forwardedHost = headers.get("x-forwarded-host");
2267
2284
  const hostHeader = headers.get("host");
2268
- const host = Guards34.isDefined(forwardedHost) ? forwardedHost.split(",")[0].trim() : hostHeader ?? "localhost";
2285
+ const host = Guards35.isDefined(forwardedHost) ? forwardedHost.split(",")[0].trim() : hostHeader ?? "localhost";
2269
2286
  return `${protocol}://${host}`;
2270
2287
  }
2271
2288
  };
@@ -2289,6 +2306,7 @@ var CreateServicesProxy = class {
2289
2306
  // src/infrastructure/modules/context.module.ts
2290
2307
  var ContextModule = class {
2291
2308
  async configure(container, opts) {
2309
+ if (container.isRegistered(TOKENS7.REQUEST_CONTEXT)) return;
2292
2310
  const requestContext = await this._getRequestContext(container, opts);
2293
2311
  container.addSingleton(TOKENS7.REQUEST_CONTEXT, () => requestContext);
2294
2312
  container.addSingleton(TOKENS7.CONTEXT_ACCESSOR, () => requestContext);
@@ -2305,7 +2323,7 @@ var ContextModule = class {
2305
2323
  container.addSingleton(TOKENS7.EVENT_DISPATCHER, () => new EventDispatcher());
2306
2324
  }
2307
2325
  async _getRequestContext(container, opts) {
2308
- if (Guards35.isDefined(opts)) return opts;
2326
+ if (Guards36.isDefined(opts)) return opts;
2309
2327
  const { NodeRequestContextFactory: NodeRequestContextFactory2 } = await Promise.resolve().then(() => (init_request_context_factory(), request_context_factory_exports));
2310
2328
  return new NodeRequestContextFactory2(
2311
2329
  new ServiceScopeFactory(container)
@@ -2314,11 +2332,11 @@ var ContextModule = class {
2314
2332
  };
2315
2333
 
2316
2334
  // src/infrastructure/modules/cqrs.module.ts
2317
- import { Guards as Guards38, LOG_LEVEL as LOG_LEVEL4 } from "@xeno-js/shared";
2335
+ import { Guards as Guards39, LOG_LEVEL as LOG_LEVEL4 } from "@xeno-js/shared";
2318
2336
  import { TOKENS as TOKENS8 } from "@xeno-js/shared";
2319
2337
 
2320
2338
  // src/application/cqrs/pipelines/cache-invalidation.pipeline.ts
2321
- import { Guards as Guards36 } from "@xeno-js/shared";
2339
+ import { Guards as Guards37 } from "@xeno-js/shared";
2322
2340
  var CommandCacheInvalidationBehavior = class {
2323
2341
  constructor(_cacheService, _logger) {
2324
2342
  this._cacheService = _cacheService;
@@ -2328,16 +2346,16 @@ var CommandCacheInvalidationBehavior = class {
2328
2346
  _logger;
2329
2347
  async handle(request, next) {
2330
2348
  const result = await next();
2331
- if (result.isOk() && Guards36.isDefined(request.cacheInvalidation)) {
2349
+ if (result.isOk() && Guards37.isDefined(request.cacheInvalidation)) {
2332
2350
  try {
2333
2351
  const { keys, patterns } = request.cacheInvalidation;
2334
- if (Guards36.isArray(keys)) {
2352
+ if (Guards37.isArray(keys)) {
2335
2353
  for (const key of keys) {
2336
2354
  await this._cacheService.remove(key);
2337
2355
  this._logger.debug(`[Cache Invalidation] Removed key: ${key}`);
2338
2356
  }
2339
2357
  }
2340
- if (Guards36.isArray(patterns) && Guards36.hasMethod(this._cacheService, "removePattern")) {
2358
+ if (Guards37.isArray(patterns) && Guards37.hasMethod(this._cacheService, "removePattern")) {
2341
2359
  for (const pattern of patterns) {
2342
2360
  await this._cacheService.removePattern(pattern);
2343
2361
  this._logger.debug(`[Cache Invalidation] Removed pattern: ${pattern}`);
@@ -2406,7 +2424,7 @@ var IdempotencyStore = class {
2406
2424
 
2407
2425
  // src/infrastructure/pipeline_setup/setup.pipeline.ts
2408
2426
  import {
2409
- Guards as Guards37
2427
+ Guards as Guards38
2410
2428
  } from "@xeno-js/shared";
2411
2429
  var PipelineSetupContext = class {
2412
2430
  isQueryCaching = false;
@@ -2418,14 +2436,14 @@ var PipelineSetupContext = class {
2418
2436
  this._idempotencyOpts = opts;
2419
2437
  }
2420
2438
  get idempotencyOpts() {
2421
- if (Guards37.isDefined(this._idempotencyOpts)) return Object.freeze(this._idempotencyOpts);
2439
+ if (Guards38.isDefined(this._idempotencyOpts)) return Object.freeze(this._idempotencyOpts);
2422
2440
  return this._idempotencyOpts;
2423
2441
  }
2424
2442
  set authzOpts(opts) {
2425
2443
  this._authzOpts = opts;
2426
2444
  }
2427
2445
  get authzOpts() {
2428
- if (Guards37.isDefined(this._authzOpts)) return Object.freeze(this._authzOpts);
2446
+ if (Guards38.isDefined(this._authzOpts)) return Object.freeze(this._authzOpts);
2429
2447
  return this._authzOpts;
2430
2448
  }
2431
2449
  addCommon(behavior, order = 50) {
@@ -2466,14 +2484,14 @@ var CqrsModule = class {
2466
2484
  context.addCommon(new LoggingPipeline(logger), 10);
2467
2485
  for (const plugin of opts.plugins)
2468
2486
  await plugin(opts.builder, container.resolve(TOKENS8.CONFIGURATION_SERVICE), context);
2469
- if (Guards38.isDefined(context.authzOpts)) {
2487
+ if (Guards39.isDefined(context.authzOpts)) {
2470
2488
  const authzPipeline = await AuthUtils.addAuthZ(container, context.authzOpts);
2471
2489
  context.addCommon(authzPipeline, 40);
2472
2490
  }
2473
- if ((Guards38.isDefined(context.idempotencyOpts) || context.isQueryCaching) && !container.isRegistered(TOKENS8.CACHE)) {
2491
+ if ((Guards39.isDefined(context.idempotencyOpts) || context.isQueryCaching) && !container.isRegistered(TOKENS8.CACHE)) {
2474
2492
  await new CacheModule().configure(container);
2475
2493
  }
2476
- if (Guards38.isDefined(context.idempotencyOpts)) {
2494
+ if (Guards39.isDefined(context.idempotencyOpts)) {
2477
2495
  const store = new IdempotencyStore(
2478
2496
  container.resolve(TOKENS8.CACHE),
2479
2497
  container.resolve(TOKENS8.CACHE_KEY_BUILDER)
@@ -2513,12 +2531,12 @@ var CqrsModule = class {
2513
2531
  };
2514
2532
 
2515
2533
  // src/infrastructure/modules/db.module.ts
2516
- import { Guards as Guards40 } from "@xeno-js/shared";
2534
+ import { Guards as Guards41 } from "@xeno-js/shared";
2517
2535
  import { TOKENS as TOKENS9 } from "@xeno-js/shared";
2518
2536
 
2519
2537
  // src/infrastructure/transaction/unit-of-work.ts
2520
2538
  import { AppError as AppError13 } from "@xeno-js/shared";
2521
- import { Guards as Guards39 } from "@xeno-js/shared";
2539
+ import { Guards as Guards40 } from "@xeno-js/shared";
2522
2540
  var UnitOfWork = class {
2523
2541
  /**
2524
2542
  * Creates an instance of UnitOfWork.
@@ -2549,9 +2567,9 @@ var UnitOfWork = class {
2549
2567
  });
2550
2568
  }
2551
2569
  async dispose() {
2552
- if (Guards39.isDefined(this._ttx.state)) {
2570
+ if (Guards40.isDefined(this._ttx.state)) {
2553
2571
  try {
2554
- if (Guards39.hasMethod(this._ttx.state, "rollback")) {
2572
+ if (Guards40.hasMethod(this._ttx.state, "rollback")) {
2555
2573
  await this._ttx.state.rollback();
2556
2574
  }
2557
2575
  } finally {
@@ -2597,7 +2615,7 @@ var DbModule = class {
2597
2615
  container.addScoped(TOKENS9.TRANSACTION_STATE, () => {
2598
2616
  return new TransactionState();
2599
2617
  });
2600
- if (Guards40.isDefined(opts.uow)) {
2618
+ if (Guards41.isDefined(opts.uow)) {
2601
2619
  container.addScoped(TOKENS9.UNIT_OF_WORK, (c) => {
2602
2620
  return opts.uow(c);
2603
2621
  });
@@ -2612,9 +2630,9 @@ var DbModule = class {
2612
2630
  return new Proxy(db, {
2613
2631
  get(_target, prop, receiver) {
2614
2632
  const activeState = ttx.state;
2615
- if (Guards40.isDefined(activeState)) {
2633
+ if (Guards41.isDefined(activeState)) {
2616
2634
  const value = Reflect.get(activeState, prop, receiver);
2617
- if (Guards40.isFunction(value)) {
2635
+ if (Guards41.isFunction(value)) {
2618
2636
  return value.bind(activeState);
2619
2637
  }
2620
2638
  return value;
@@ -2634,7 +2652,7 @@ import { RoutePatternHelper as RoutePatternHelper3 } from "@xeno-js/shared";
2634
2652
 
2635
2653
  // src/infrastructure/http/route-matcher.http.ts
2636
2654
  import {
2637
- Guards as Guards41,
2655
+ Guards as Guards42,
2638
2656
  HttpHelper as HttpHelper7,
2639
2657
  RoutePatternHelper as RoutePatternHelper2,
2640
2658
  STATUS_CODES as STATUS_CODES4
@@ -2645,14 +2663,14 @@ var RouteMatcher = class {
2645
2663
  }
2646
2664
  _compiledRoutes;
2647
2665
  match(rawUrl, method) {
2648
- const url = !Guards41.isNullOrEmpty(rawUrl) ? rawUrl : "/";
2666
+ const url = !Guards42.isNullOrEmpty(rawUrl) ? rawUrl : "/";
2649
2667
  const safeUrl = HttpHelper7.parseSafeUrl(url);
2650
2668
  const parsedPath = RoutePatternHelper2.normalizePath(safeUrl.pathname);
2651
2669
  const upperMethod = method.toUpperCase();
2652
2670
  const matched = this._compiledRoutes.find(
2653
2671
  (r) => r.upperMethod === upperMethod && r.pattern.test(parsedPath)
2654
2672
  );
2655
- if (Guards41.isDefined(matched)) return matched.definition;
2673
+ if (Guards42.isDefined(matched)) return matched.definition;
2656
2674
  if (upperMethod === "OPTIONS") {
2657
2675
  const pathExists = this._compiledRoutes.some((r) => r.pattern.test(parsedPath));
2658
2676
  if (pathExists) {
@@ -2734,17 +2752,17 @@ var HttpServerModule = class {
2734
2752
  };
2735
2753
 
2736
2754
  // src/infrastructure/modules/logger.module.ts
2737
- import { Guards as Guards43 } from "@xeno-js/shared";
2755
+ import { Guards as Guards44 } from "@xeno-js/shared";
2738
2756
 
2739
2757
  // src/infrastructure/loggers/setup.logger.ts
2740
- import { Guards as Guards42, LOG_LEVEL as LOG_LEVEL5 } from "@xeno-js/shared";
2758
+ import { Guards as Guards43, LOG_LEVEL as LOG_LEVEL5 } from "@xeno-js/shared";
2741
2759
  var LoggerSetupContext = class {
2742
2760
  console = false;
2743
2761
  level = LOG_LEVEL5.DEBUG;
2744
2762
  _customLoggers = [];
2745
2763
  addConsole(enabled = true, level) {
2746
2764
  this.console = enabled;
2747
- if (Guards42.isDefined(level)) {
2765
+ if (Guards43.isDefined(level)) {
2748
2766
  this.level = level;
2749
2767
  }
2750
2768
  }
@@ -2761,9 +2779,9 @@ var LoggerModule = class {
2761
2779
  async configure(container, opts) {
2762
2780
  const loggerSetup = new LoggerSetupContext();
2763
2781
  loggerSetup.addConsole(opts.console, opts.level);
2764
- if (!Guards43.isNullOrEmpty(opts.plugins))
2782
+ if (!Guards44.isNullOrEmpty(opts.plugins))
2765
2783
  opts.plugins.forEach((plugin) => plugin(opts.builder, opts.config, loggerSetup));
2766
- if (!Guards43.isNullOrEmpty(opts.customLoggers)) {
2784
+ if (!Guards44.isNullOrEmpty(opts.customLoggers)) {
2767
2785
  for (const logger of opts.customLoggers) {
2768
2786
  loggerSetup.addCustomLogger((c) => logger(c));
2769
2787
  }
@@ -2778,7 +2796,7 @@ var LoggerModule = class {
2778
2796
  };
2779
2797
 
2780
2798
  // src/infrastructure/modules/middleware.module.ts
2781
- import { Guards as Guards53, LOG_LEVEL as LOG_LEVEL6 } from "@xeno-js/shared";
2799
+ import { Guards as Guards54, LOG_LEVEL as LOG_LEVEL6 } from "@xeno-js/shared";
2782
2800
  import { TOKENS as TOKENS12 } from "@xeno-js/shared";
2783
2801
 
2784
2802
  // src/presentation/controllers/base.controller.ts
@@ -2934,7 +2952,7 @@ var MethodCheckMiddleware = class {
2934
2952
  import {
2935
2953
  ERROR_CODE_MESSAGES as ERROR_CODE_MESSAGES4,
2936
2954
  ERROR_CODES as ERROR_CODES5,
2937
- Guards as Guards44,
2955
+ Guards as Guards45,
2938
2956
  GuidHelper as GuidHelper7,
2939
2957
  HttpHelper as HttpHelper10,
2940
2958
  STATUS_CODES as STATUS_CODES6
@@ -2977,7 +2995,7 @@ var AllowOriginMiddleware = class {
2977
2995
  return next();
2978
2996
  }
2979
2997
  checkOrigin(policy, origin) {
2980
- if (Guards44.isDefined(policy.allowOrigins)) {
2998
+ if (Guards45.isDefined(policy.allowOrigins)) {
2981
2999
  return policy.allowOrigins.includes("*") || policy.allowOrigins.includes(origin ?? "");
2982
3000
  } else {
2983
3001
  return this._allowOrigin.isAllowed(origin);
@@ -3048,7 +3066,7 @@ var CompositeMiddleware = class {
3048
3066
  };
3049
3067
 
3050
3068
  // src/presentation/middlewares/cookie-response.middleware.ts
3051
- import { Guards as Guards45 } from "@xeno-js/shared";
3069
+ import { Guards as Guards46 } from "@xeno-js/shared";
3052
3070
  import { TOKENS as TOKENS11 } from "@xeno-js/shared";
3053
3071
  var CookieResponseMiddleware = class {
3054
3072
  constructor(_requestContext) {
@@ -3058,15 +3076,15 @@ var CookieResponseMiddleware = class {
3058
3076
  async execute(req, next) {
3059
3077
  const response = await next();
3060
3078
  const scope = this._requestContext.getScope();
3061
- if (!Guards45.isDefined(scope)) {
3079
+ if (!Guards46.isDefined(scope)) {
3062
3080
  return response;
3063
3081
  }
3064
3082
  try {
3065
3083
  const cookieHandler = scope.resolve(TOKENS11.COOKIE_HANDLER);
3066
3084
  const pending = cookieHandler.getPendingCookies();
3067
- if (!Guards45.isNullOrEmpty(pending)) {
3085
+ if (!Guards46.isNullOrEmpty(pending)) {
3068
3086
  const existingSetCookie = response.headers?.["Set-Cookie"];
3069
- const mergedCookies = Guards45.isArray(existingSetCookie) ? [...existingSetCookie, ...pending] : Guards45.isDefined(existingSetCookie) ? [String(existingSetCookie), ...pending] : [...pending];
3087
+ const mergedCookies = Guards46.isArray(existingSetCookie) ? [...existingSetCookie, ...pending] : Guards46.isDefined(existingSetCookie) ? [String(existingSetCookie), ...pending] : [...pending];
3070
3088
  response.headers = {
3071
3089
  ...response?.headers ?? {},
3072
3090
  "Set-Cookie": mergedCookies
@@ -3079,7 +3097,7 @@ var CookieResponseMiddleware = class {
3079
3097
  };
3080
3098
 
3081
3099
  // src/presentation/middlewares/cors.middleware.ts
3082
- import { Guards as Guards46 } from "@xeno-js/shared";
3100
+ import { Guards as Guards47 } from "@xeno-js/shared";
3083
3101
  var CORSMiddleware = class {
3084
3102
  constructor(_requestContext, _getRouteMatcher, _withCredentials = "false") {
3085
3103
  this._requestContext = _requestContext;
@@ -3094,12 +3112,12 @@ var CORSMiddleware = class {
3094
3112
  const origin = network?.origin;
3095
3113
  const response = await next();
3096
3114
  const policy = this._getRouteMatcher().checkRoutePolicy(req.path, req.method);
3097
- const withCredentials = Guards46.isDefined(policy.withCredentials) ? policy.withCredentials ? "true" : "false" : this._withCredentials;
3115
+ const withCredentials = Guards47.isDefined(policy.withCredentials) ? policy.withCredentials ? "true" : "false" : this._withCredentials;
3098
3116
  const allowOrigins = policy.allowOrigins;
3099
- if (Guards46.isDefined(origin) || Guards46.isDefined(allowOrigins) && allowOrigins.includes("*")) {
3117
+ if (Guards47.isDefined(origin) || Guards47.isDefined(allowOrigins) && allowOrigins.includes("*")) {
3100
3118
  response.headers = {
3101
3119
  ...response?.headers ?? {},
3102
- "Access-Control-Allow-Origin": Guards46.isDefined(allowOrigins) && allowOrigins.includes("*") && withCredentials === "false" ? "*" : origin,
3120
+ "Access-Control-Allow-Origin": Guards47.isDefined(allowOrigins) && allowOrigins.includes("*") && withCredentials === "false" ? "*" : origin,
3103
3121
  "Access-Control-Allow-Credentials": withCredentials,
3104
3122
  "Vary": "Origin"
3105
3123
  };
@@ -3112,7 +3130,7 @@ var CORSMiddleware = class {
3112
3130
  import {
3113
3131
  ERROR_CODE_MESSAGES as ERROR_CODE_MESSAGES5,
3114
3132
  ERROR_CODES as ERROR_CODES6,
3115
- Guards as Guards47,
3133
+ Guards as Guards48,
3116
3134
  GuidHelper as GuidHelper9,
3117
3135
  HttpHelper as HttpHelper12,
3118
3136
  STATUS_CODES as STATUS_CODES8
@@ -3131,11 +3149,11 @@ var CsrfMiddleware = class {
3131
3149
  const isStateChanging = ["POST", "PUT", "DELETE", "PATCH"].includes(method);
3132
3150
  if (isStateChanging) {
3133
3151
  const policy = this._getRouteMatcher().checkRoutePolicy(req.path, method);
3134
- if (Guards47.isDefined(policy.withCsrf) && !policy.withCsrf) return await next();
3152
+ if (Guards48.isDefined(policy.withCsrf) && !policy.withCsrf) return await next();
3135
3153
  const { network, tracing, identity } = this._requestContext.getContext() ?? {};
3136
3154
  const headerToken = network?.csrf;
3137
3155
  const cookieToken = network?.csrfCookie;
3138
- if (!Guards47.isDefined(headerToken) || !Guards47.isDefined(cookieToken)) {
3156
+ if (!Guards48.isDefined(headerToken) || !Guards48.isDefined(cookieToken)) {
3139
3157
  return HttpHelper12.error(
3140
3158
  {
3141
3159
  success: false,
@@ -3177,7 +3195,7 @@ var CsrfMiddleware = class {
3177
3195
  }
3178
3196
  );
3179
3197
  }
3180
- if (!Guards47.isDefined(identity?.userId) || !await this._csrfTokenService.validate(headerToken, identity?.userId)) {
3198
+ if (!Guards48.isDefined(identity?.userId) || !await this._csrfTokenService.validate(headerToken, identity?.userId)) {
3181
3199
  return HttpHelper12.error(
3182
3200
  {
3183
3201
  success: false,
@@ -3204,7 +3222,7 @@ var CsrfMiddleware = class {
3204
3222
  };
3205
3223
 
3206
3224
  // src/presentation/middlewares/csrf-cookie.middleware.ts
3207
- import { Guards as Guards48 } from "@xeno-js/shared";
3225
+ import { Guards as Guards49 } from "@xeno-js/shared";
3208
3226
  var CsrfCookieMiddleware = class {
3209
3227
  constructor(_requestContext, _csrfTokenService, _csrf) {
3210
3228
  this._requestContext = _requestContext;
@@ -3219,8 +3237,8 @@ var CsrfCookieMiddleware = class {
3219
3237
  const context = this._requestContext.getContext();
3220
3238
  const identity = context?.identity;
3221
3239
  const network = context?.network;
3222
- if (!Guards48.isDefined(identity?.userId)) return response;
3223
- if (Guards48.isDefined(network?.csrfCookie)) return response;
3240
+ if (!Guards49.isDefined(identity?.userId)) return response;
3241
+ if (Guards49.isDefined(network?.csrfCookie)) return response;
3224
3242
  const token = await this._csrfTokenService.generate(identity.userId);
3225
3243
  const cookieName = this._csrf.cookieName ?? "__Host-xeno-csrf";
3226
3244
  const maxAge = this._csrf.cookieMaxAgeSeconds ?? 3600;
@@ -3236,7 +3254,7 @@ var CsrfCookieMiddleware = class {
3236
3254
  };
3237
3255
 
3238
3256
  // src/presentation/middlewares/options.middleware.ts
3239
- import { Guards as Guards49, HttpHelper as HttpHelper13, STATUS_CODES as STATUS_CODES9 } from "@xeno-js/shared";
3257
+ import { Guards as Guards50, HttpHelper as HttpHelper13, STATUS_CODES as STATUS_CODES9 } from "@xeno-js/shared";
3240
3258
  var OptionsMiddleware = class {
3241
3259
  constructor(_requestContext, _allowMethod, _getRouteMatcher, _allowHeaders = [], _withCredentials = "false") {
3242
3260
  this._requestContext = _requestContext;
@@ -3256,10 +3274,10 @@ var OptionsMiddleware = class {
3256
3274
  const origin = network?.origin;
3257
3275
  const targetMethod = req.headers.get("access-control-request-method") ?? "GET";
3258
3276
  const policy = this._getRouteMatcher().checkRoutePolicy(req.path, targetMethod);
3259
- const withCredentials = Guards49.isDefined(policy.withCredentials) ? policy.withCredentials ? "true" : "false" : this._withCredentials;
3277
+ const withCredentials = Guards50.isDefined(policy.withCredentials) ? policy.withCredentials ? "true" : "false" : this._withCredentials;
3260
3278
  const headers = {};
3261
- if (Guards49.isDefined(origin) || Guards49.isDefined(policy.allowOrigins) && policy.allowOrigins.includes("*")) {
3262
- headers["Access-Control-Allow-Origin"] = Guards49.isDefined(policy.allowOrigins) && policy.allowOrigins.includes("*") && withCredentials === "false" ? "*" : origin;
3279
+ if (Guards50.isDefined(origin) || Guards50.isDefined(policy.allowOrigins) && policy.allowOrigins.includes("*")) {
3280
+ headers["Access-Control-Allow-Origin"] = Guards50.isDefined(policy.allowOrigins) && policy.allowOrigins.includes("*") && withCredentials === "false" ? "*" : origin;
3263
3281
  headers["Access-Control-Allow-Credentials"] = withCredentials;
3264
3282
  headers["Vary"] = "Origin";
3265
3283
  }
@@ -3275,7 +3293,7 @@ var OptionsMiddleware = class {
3275
3293
  import {
3276
3294
  ERROR_CODE_MESSAGES as ERROR_CODE_MESSAGES6,
3277
3295
  ERROR_CODES as ERROR_CODES7,
3278
- Guards as Guards50,
3296
+ Guards as Guards51,
3279
3297
  GuidHelper as GuidHelper10,
3280
3298
  HttpHelper as HttpHelper14,
3281
3299
  STATUS_CODES as STATUS_CODES10
@@ -3296,7 +3314,7 @@ var RateLimitMiddleware = class {
3296
3314
  async execute(req, next) {
3297
3315
  const cacheKey = this._keyBuilder.buildRateLimitKey(req.path);
3298
3316
  const { network, tracing } = this._ctxAccessor.getContext() ?? {};
3299
- if (!Guards50.isDefined(cacheKey))
3317
+ if (!Guards51.isDefined(cacheKey))
3300
3318
  return HttpHelper14.error(
3301
3319
  {
3302
3320
  success: false,
@@ -3356,7 +3374,7 @@ import {
3356
3374
  } from "@xeno-js/shared";
3357
3375
 
3358
3376
  // src/presentation/mappers/context.mapper.ts
3359
- import { Guards as Guards51 } from "@xeno-js/shared";
3377
+ import { Guards as Guards52 } from "@xeno-js/shared";
3360
3378
  var ContextMapper = Object.freeze({
3361
3379
  /**
3362
3380
  * @description Maps to RequestContext. It extracts relevant information from the object, such as correlation ID, request ID, authentication token, client IP, user agent, format indicator, and messaging context (if available). The method constructs a RequestContext object that encapsulates all this information, providing a structured representation of the request context for further processing in the application.
@@ -3397,13 +3415,13 @@ var ContextMapper = Object.freeze({
3397
3415
  }
3398
3416
  });
3399
3417
  function _buildMessagingContext(meta) {
3400
- const hasSequenceData = Guards51.isDefined(meta.sequence?.sequenceId) || Guards51.isDefined(meta.sequence?.position) || Guards51.isDefined(meta.sequence?.size);
3401
- const hasMessagingData = hasSequenceData || Guards51.isDefined(meta.expiration) || Guards51.isDefined(meta.returnAddress);
3418
+ const hasSequenceData = Guards52.isDefined(meta.sequence?.sequenceId) || Guards52.isDefined(meta.sequence?.position) || Guards52.isDefined(meta.sequence?.size);
3419
+ const hasMessagingData = hasSequenceData || Guards52.isDefined(meta.expiration) || Guards52.isDefined(meta.returnAddress);
3402
3420
  if (!hasMessagingData) return void 0;
3403
3421
  return {
3404
3422
  returnAddress: meta.returnAddress,
3405
3423
  expiration: meta.expiration,
3406
- sequence: hasSequenceData && Guards51.isDefined(meta.sequence) ? {
3424
+ sequence: hasSequenceData && Guards52.isDefined(meta.sequence) ? {
3407
3425
  sequenceId: meta.sequence.sequenceId,
3408
3426
  position: meta.sequence.position,
3409
3427
  size: meta.sequence.size
@@ -3486,7 +3504,7 @@ var RequestContextMiddleware = class {
3486
3504
  };
3487
3505
 
3488
3506
  // src/infrastructure/http/dispatcher.http.ts
3489
- import { Guards as Guards52 } from "@xeno-js/shared";
3507
+ import { Guards as Guards53 } from "@xeno-js/shared";
3490
3508
  var HttpDispatcher = class {
3491
3509
  constructor(_requestContext, _middleware, _serviceProxy) {
3492
3510
  this._requestContext = _requestContext;
@@ -3499,14 +3517,14 @@ var HttpDispatcher = class {
3499
3517
  async handle(req, token, input) {
3500
3518
  return await this._middleware.execute(req, async () => {
3501
3519
  const scope = this._requestContext.getScope();
3502
- if (!Guards52.isDefined(scope)) {
3520
+ if (!Guards53.isDefined(scope)) {
3503
3521
  throw new Error(
3504
3522
  "[HttpDispatcher Error]: Active scope not found. Execution outside RequestContext."
3505
3523
  );
3506
3524
  }
3507
3525
  const services = this._serviceProxy.getServiceProxy(scope);
3508
3526
  const controller = services[token];
3509
- if (!Guards52.isDefined(controller) || !Guards52.hasMethod(controller, "handle")) {
3527
+ if (!Guards53.isDefined(controller) || !Guards53.hasMethod(controller, "handle")) {
3510
3528
  throw new Error(
3511
3529
  `[HttpDispatcher Error]: The provided '${String(token)}' does not implement the 'handle' method.`
3512
3530
  );
@@ -3535,7 +3553,7 @@ var MiddlewareModule = class {
3535
3553
  )
3536
3554
  );
3537
3555
  const getRouteMatcher = () => container.resolve(TOKENS12.ROUTE_MATCHER);
3538
- const withCredentials = Guards53.isDefined(opts.cors?.withCredentials) && opts.cors?.withCredentials ? "true" : "false";
3556
+ const withCredentials = Guards54.isDefined(opts.cors?.withCredentials) && opts.cors?.withCredentials ? "true" : "false";
3539
3557
  const [optionsMw, cookieRespMw, corsMw, authMw, csrfMws] = [
3540
3558
  this._buildOptionsMiddleware(
3541
3559
  opts,
@@ -3562,7 +3580,7 @@ var MiddlewareModule = class {
3562
3580
  logger
3563
3581
  );
3564
3582
  const defaultOrigin = configuration.get("APP_URL") ?? `http://localhost:${configuration.getNumber("PORT", 3e3)}`;
3565
- const origins = !Guards53.isNullOrEmpty(opts.cors?.allowOrigins) ? opts.cors.allowOrigins : [defaultOrigin];
3583
+ const origins = !Guards54.isNullOrEmpty(opts.cors?.allowOrigins) ? opts.cors.allowOrigins : [defaultOrigin];
3566
3584
  const allowOriginMw = new AllowOriginMiddleware(
3567
3585
  new AllowOrigin(origins),
3568
3586
  requestContext,
@@ -3572,14 +3590,14 @@ var MiddlewareModule = class {
3572
3590
  const methodCheckMw = new MethodCheckMiddleware(requestContext, allowMethod);
3573
3591
  const pipeline = [
3574
3592
  requestCtxMw,
3575
- ...Guards53.isDefined(cookieRespMw) ? [cookieRespMw] : [],
3593
+ ...Guards54.isDefined(cookieRespMw) ? [cookieRespMw] : [],
3576
3594
  allowOriginMw,
3577
- ...Guards53.isDefined(optionsMw) && !Guards53.isNullOrEmpty(opts.routes) ? [optionsMw] : [],
3578
- ...!Guards53.isNullOrEmpty(opts.routes) ? [methodCheckMw] : [],
3579
- ...Guards53.isDefined(corsMw) ? [corsMw] : [],
3580
- ...Guards53.isDefined(rateLimitMw) ? [rateLimitMw] : [],
3595
+ ...Guards54.isDefined(optionsMw) && !Guards54.isNullOrEmpty(opts.routes) ? [optionsMw] : [],
3596
+ ...!Guards54.isNullOrEmpty(opts.routes) ? [methodCheckMw] : [],
3597
+ ...Guards54.isDefined(corsMw) ? [corsMw] : [],
3598
+ ...Guards54.isDefined(rateLimitMw) ? [rateLimitMw] : [],
3581
3599
  authMw,
3582
- ...!Guards53.isNullOrEmpty(csrfMws) ? csrfMws : []
3600
+ ...!Guards54.isNullOrEmpty(csrfMws) ? csrfMws : []
3583
3601
  ];
3584
3602
  container.addSingleton(TOKENS12.MIDDLEWARE, () => new CompositeMiddleware(pipeline));
3585
3603
  container.addSingleton(
@@ -3592,11 +3610,11 @@ var MiddlewareModule = class {
3592
3610
  );
3593
3611
  }
3594
3612
  _buildCookieResponseMiddleware(opts, requestContext) {
3595
- if (!Guards53.isDefined(opts.isSSR) || !opts.isSSR) return void 0;
3613
+ if (!Guards54.isDefined(opts.isSSR) || !opts.isSSR) return void 0;
3596
3614
  return new CookieResponseMiddleware(requestContext);
3597
3615
  }
3598
3616
  _buildCsrfMiddlewares(opts, container, requestContext, routePolicyCheck) {
3599
- if (!Guards53.isDefined(opts.csrf)) return [];
3617
+ if (!Guards54.isDefined(opts.csrf)) return [];
3600
3618
  const csrf = opts.csrf;
3601
3619
  container.addSingleton(TOKENS12.CRYPTO_SERVICE, () => new EdgeCryptoService());
3602
3620
  container.addSingleton(TOKENS12.CSRF_TOKEN_SERVICE, (c) => {
@@ -3612,7 +3630,7 @@ var MiddlewareModule = class {
3612
3630
  ];
3613
3631
  }
3614
3632
  async _buildRateLimitMiddleware(opts, container, requestContext, logger) {
3615
- if (Guards53.isDefined(opts.rateLimit?.enabled) && opts.rateLimit?.enabled) {
3633
+ if (Guards54.isDefined(opts.rateLimit?.enabled) && opts.rateLimit?.enabled) {
3616
3634
  const maxRequests = opts.rateLimit?.maxRequests ?? 100;
3617
3635
  const windowSeconds = opts.rateLimit?.windowSeconds ?? 60;
3618
3636
  if (!container.isRegistered(TOKENS12.CACHE)) {
@@ -3628,12 +3646,12 @@ var MiddlewareModule = class {
3628
3646
  }
3629
3647
  }
3630
3648
  _buildCorsMiddleware(opts, requestContext, withCredentials, routePolicyCheck) {
3631
- if (Guards53.isDefined(opts.cors?.enabled) && opts.cors.enabled) {
3649
+ if (Guards54.isDefined(opts.cors?.enabled) && opts.cors.enabled) {
3632
3650
  return new CORSMiddleware(requestContext, routePolicyCheck, withCredentials);
3633
3651
  }
3634
3652
  }
3635
3653
  _buildOptionsMiddleware(opts, requestContext, allowMethod, withCredentials, routePolicyCheck) {
3636
- if (Guards53.isDefined(opts.cors?.enablePreflight) && opts.cors?.enablePreflight) {
3654
+ if (Guards54.isDefined(opts.cors?.enablePreflight) && opts.cors?.enablePreflight) {
3637
3655
  const allowHeaders = Array.from(
3638
3656
  /* @__PURE__ */ new Set([
3639
3657
  "x-csrf-token",
@@ -3685,7 +3703,7 @@ var MiddlewareModule = class {
3685
3703
  tokenExtractor,
3686
3704
  new GateKeeper(() => {
3687
3705
  const scope = requestContext.getScope();
3688
- if (!Guards53.isDefined(scope)) {
3706
+ if (!Guards54.isDefined(scope)) {
3689
3707
  throw new Error("[GateKeeper Error]: No active scope found.");
3690
3708
  }
3691
3709
  return scope.resolve(TOKENS12.BASE_AUTH_SERVICE);
@@ -3758,12 +3776,12 @@ var withAuth = (setup) => {
3758
3776
  };
3759
3777
 
3760
3778
  // src/infrastructure/plugin/authz.plugin.ts
3761
- import { Guards as Guards54 } from "@xeno-js/shared";
3779
+ import { Guards as Guards55 } from "@xeno-js/shared";
3762
3780
  var withAuthZ = (setup) => {
3763
3781
  return definePlugin(
3764
3782
  "pipeline",
3765
3783
  (_builder, config, context) => {
3766
- if (!Guards54.isDefined(context)) throw new Error("Pipeline setup is not available.");
3784
+ if (!Guards55.isDefined(context)) throw new Error("Pipeline setup is not available.");
3767
3785
  const options = {
3768
3786
  policies: void 0
3769
3787
  };
@@ -3775,25 +3793,25 @@ var withAuthZ = (setup) => {
3775
3793
 
3776
3794
  // src/infrastructure/plugin/concurrency.plugin.ts
3777
3795
  import {
3778
- Guards as Guards55
3796
+ Guards as Guards56
3779
3797
  } from "@xeno-js/shared";
3780
3798
  var withConcurrency = (setup) => {
3781
3799
  return definePlugin(
3782
3800
  "pipeline",
3783
3801
  (_builder, config, context) => {
3784
- if (!Guards55.isDefined(context)) throw new Error("Pipeline setup is not available.");
3802
+ if (!Guards56.isDefined(context)) throw new Error("Pipeline setup is not available.");
3785
3803
  const options = {};
3786
- if (Guards55.isDefined(setup)) setup(options, config);
3804
+ if (Guards56.isDefined(setup)) setup(options, config);
3787
3805
  context.addCommand(new ConcurrencyRetryPipeline(options), 70);
3788
3806
  }
3789
3807
  );
3790
3808
  };
3791
3809
 
3792
3810
  // src/infrastructure/plugin/http.plugin.ts
3793
- import { Guards as Guards58 } from "@xeno-js/shared";
3811
+ import { Guards as Guards59 } from "@xeno-js/shared";
3794
3812
 
3795
3813
  // src/infrastructure/modules/http-core.module.ts
3796
- import { Guards as Guards57 } from "@xeno-js/shared";
3814
+ import { Guards as Guards58 } from "@xeno-js/shared";
3797
3815
  import { TOKENS as TOKENS14 } from "@xeno-js/shared";
3798
3816
 
3799
3817
  // src/infrastructure/datasources/remote.datasource.ts
@@ -3882,7 +3900,7 @@ var RemoteDataSource = class {
3882
3900
  };
3883
3901
 
3884
3902
  // src/infrastructure/factories/http.factory.ts
3885
- import { AppError as AppError15, Guards as Guards56 } from "@xeno-js/shared";
3903
+ import { AppError as AppError15, Guards as Guards57 } from "@xeno-js/shared";
3886
3904
  var HttpClientFactory = class {
3887
3905
  _clients = /* @__PURE__ */ new Map();
3888
3906
  add(name, client) {
@@ -3893,7 +3911,7 @@ var HttpClientFactory = class {
3893
3911
  }
3894
3912
  get(name = "default") {
3895
3913
  const client = this._clients.get(name);
3896
- if (!Guards56.isDefined(client)) {
3914
+ if (!Guards57.isDefined(client)) {
3897
3915
  const available = Array.from(this._clients.keys()).join(", ") ?? "none";
3898
3916
  throw AppError15.notFound(
3899
3917
  "HttpClientFactory",
@@ -3926,7 +3944,7 @@ var HttpCoreModule = class {
3926
3944
  container.addSingleton(TOKENS14.HTTP_CLIENT_FACTORY, () => factory);
3927
3945
  }
3928
3946
  getResilienceService(container, resilience) {
3929
- if (!Guards57.isDefined(resilience)) {
3947
+ if (!Guards58.isDefined(resilience)) {
3930
3948
  return new NoOpResilienceService();
3931
3949
  } else {
3932
3950
  return resilience(container);
@@ -3939,9 +3957,9 @@ var withCustomHttp = (config) => {
3939
3957
  return definePlugin(
3940
3958
  "http",
3941
3959
  (builder, _config) => {
3942
- const clientEntries = Guards58.isArray(config.clients) ? config.clients : [config.clients];
3960
+ const clientEntries = Guards59.isArray(config.clients) ? config.clients : [config.clients];
3943
3961
  const entries = clientEntries.map((item) => {
3944
- if (!Guards58.isDefined(item.client)) {
3962
+ if (!Guards59.isDefined(item.client)) {
3945
3963
  throw new Error(
3946
3964
  `[withCustomHttp Error]: 'client' instance is required for registration '${item.name ?? "default"}'.`
3947
3965
  );
@@ -3961,27 +3979,27 @@ var withCustomHttp = (config) => {
3961
3979
 
3962
3980
  // src/infrastructure/plugin/idempotency.plugin.ts
3963
3981
  import {
3964
- Guards as Guards59
3982
+ Guards as Guards60
3965
3983
  } from "@xeno-js/shared";
3966
3984
  var withIdempotency = (setup) => {
3967
3985
  return definePlugin(
3968
3986
  "pipeline",
3969
3987
  (_builder, config, context) => {
3970
- if (!Guards59.isDefined(context)) throw new Error("Pipeline setup is not available.");
3988
+ if (!Guards60.isDefined(context)) throw new Error("Pipeline setup is not available.");
3971
3989
  const options = {};
3972
- if (Guards59.isDefined(setup)) setup(options, config);
3990
+ if (Guards60.isDefined(setup)) setup(options, config);
3973
3991
  context.idempotencyOpts = options;
3974
3992
  }
3975
3993
  );
3976
3994
  };
3977
3995
 
3978
3996
  // src/infrastructure/plugin/logger.plugin.ts
3979
- import { Guards as Guards60, LOG_LEVEL as LOG_LEVEL7 } from "@xeno-js/shared";
3997
+ import { Guards as Guards61, LOG_LEVEL as LOG_LEVEL7 } from "@xeno-js/shared";
3980
3998
  var withConsoleLogger = (setup) => {
3981
3999
  return definePlugin(
3982
4000
  "logger",
3983
4001
  (_builder, config, ctx) => {
3984
- if (!Guards60.isDefined(ctx)) throw new Error("LoggerSetup is not defined.");
4002
+ if (!Guards61.isDefined(ctx)) throw new Error("LoggerSetup is not defined.");
3985
4003
  const options = {
3986
4004
  isEnabled: true,
3987
4005
  level: LOG_LEVEL7.DEBUG
@@ -3994,16 +4012,16 @@ var withConsoleLogger = (setup) => {
3994
4012
 
3995
4013
  // src/infrastructure/plugin/performance.plugin.ts
3996
4014
  import {
3997
- Guards as Guards61
4015
+ Guards as Guards62
3998
4016
  } from "@xeno-js/shared";
3999
4017
  import { TOKENS as TOKENS15 } from "@xeno-js/shared";
4000
4018
  var withPerformance = (setup) => {
4001
4019
  return definePlugin(
4002
4020
  "pipeline",
4003
4021
  (builder, config, context) => {
4004
- if (!Guards61.isDefined(context)) throw new Error("Pipeline setup is not available.");
4022
+ if (!Guards62.isDefined(context)) throw new Error("Pipeline setup is not available.");
4005
4023
  const options = {};
4006
- if (Guards61.isDefined(setup)) setup(options, config);
4024
+ if (Guards62.isDefined(setup)) setup(options, config);
4007
4025
  const logger = builder.resolve(TOKENS15.LOGGER);
4008
4026
  context.addCommon(
4009
4027
  new PerformancePipeline(logger, options?.intentThresholdMs, options?.thresholdMs ?? 500),
@@ -4014,12 +4032,12 @@ var withPerformance = (setup) => {
4014
4032
  };
4015
4033
 
4016
4034
  // src/infrastructure/plugin/query.plugin.ts
4017
- import { Guards as Guards62 } from "@xeno-js/shared";
4035
+ import { Guards as Guards63 } from "@xeno-js/shared";
4018
4036
  var withQueryCaching = () => {
4019
4037
  return definePlugin(
4020
4038
  "pipeline",
4021
4039
  (_builder, _config, context) => {
4022
- if (!Guards62.isDefined(context)) throw new Error("Pipeline setup is not available.");
4040
+ if (!Guards63.isDefined(context)) throw new Error("Pipeline setup is not available.");
4023
4041
  context.addQuery();
4024
4042
  }
4025
4043
  );
@@ -4027,16 +4045,16 @@ var withQueryCaching = () => {
4027
4045
 
4028
4046
  // src/infrastructure/plugin/validation.plugin.ts
4029
4047
  import {
4030
- Guards as Guards63
4048
+ Guards as Guards64
4031
4049
  } from "@xeno-js/shared";
4032
4050
  var withValidation = (setup) => {
4033
4051
  return definePlugin(
4034
4052
  "pipeline",
4035
4053
  (_builder, config, context) => {
4036
- if (!Guards63.isDefined(context)) throw new Error("Pipeline setup is not available.");
4054
+ if (!Guards64.isDefined(context)) throw new Error("Pipeline setup is not available.");
4037
4055
  const strategies = [];
4038
4056
  setup(strategies, config);
4039
- if (Guards63.isNullOrEmpty(strategies)) return;
4057
+ if (Guards64.isNullOrEmpty(strategies)) return;
4040
4058
  const validationPipeline = new ValidationPipeline(strategies);
4041
4059
  context.addCommon(validationPipeline, 50);
4042
4060
  }
@@ -4044,7 +4062,7 @@ var withValidation = (setup) => {
4044
4062
  };
4045
4063
 
4046
4064
  // src/infrastructure/xeno_application/xeno.application.ts
4047
- import { AppError as AppError17, Guards as Guards64, GUEST as GUEST5, GuidHelper as GuidHelper13 } from "@xeno-js/shared";
4065
+ import { AppError as AppError17, Guards as Guards65, GUEST as GUEST5, GuidHelper as GuidHelper13 } from "@xeno-js/shared";
4048
4066
  import { TOKENS as TOKENS16 } from "@xeno-js/shared";
4049
4067
  var XenoApplication = class {
4050
4068
  constructor(_container) {
@@ -4071,7 +4089,7 @@ var XenoApplication = class {
4071
4089
  const serviceProxy = this._container.resolve(TOKENS16.SERVICE_PROXY);
4072
4090
  const requestContext = this._container.resolve(TOKENS16.REQUEST_CONTEXT);
4073
4091
  const scope = requestContext.getScope();
4074
- if (!Guards64.isDefined(scope)) {
4092
+ if (!Guards65.isDefined(scope)) {
4075
4093
  throw AppError17.notFound(
4076
4094
  "[XenoApplication Error]",
4077
4095
  'Active scope not found.\nPlease use the "runInScope" or "handle" method for tasks outside the HTTP transport.'
@@ -4148,7 +4166,7 @@ var XenoAppBuilder = class {
4148
4166
  this._container.addSingleton(TOKENS17.CONFIGURATION_SERVICE, () => this._configuration);
4149
4167
  }
4150
4168
  _getConfigurationService(service) {
4151
- if (!Guards65.isDefined(service) || service === "node")
4169
+ if (!Guards66.isDefined(service) || service === "node")
4152
4170
  return new EnvironmentConfigurationService();
4153
4171
  if (service === "vite") return new ViteConfigurationService();
4154
4172
  return service;
@@ -4236,7 +4254,7 @@ var XenoAppBuilder = class {
4236
4254
  */
4237
4255
  addMiddlewares(setupAction) {
4238
4256
  if (this._isMiddlewareModuleQueued) return this;
4239
- if (Guards65.isDefined(setupAction)) setupAction(this._middlewareConfig, this._configuration);
4257
+ if (Guards66.isDefined(setupAction)) setupAction(this._middlewareConfig, this._configuration);
4240
4258
  this._modules.push({
4241
4259
  priority: 4,
4242
4260
  name: "MiddlewareModule",
@@ -4262,7 +4280,7 @@ var XenoAppBuilder = class {
4262
4280
  */
4263
4281
  addContext(plugin) {
4264
4282
  if (this._isContextModuleQueued) return this;
4265
- if (Guards65.isDefined(plugin)) plugin(this, this._configuration);
4283
+ if (Guards66.isDefined(plugin)) plugin(this, this._configuration);
4266
4284
  else
4267
4285
  this._modules.push({
4268
4286
  priority: 0,
@@ -4277,7 +4295,7 @@ var XenoAppBuilder = class {
4277
4295
  }
4278
4296
  addLogger(pluginOrSetup) {
4279
4297
  if (this._isLoggerModuleQueued) return this;
4280
- if (!Guards65.isDefined(pluginOrSetup)) {
4298
+ if (!Guards66.isDefined(pluginOrSetup)) {
4281
4299
  this._modules.push({
4282
4300
  priority: 1,
4283
4301
  name: "LoggerModule",
@@ -4291,7 +4309,7 @@ var XenoAppBuilder = class {
4291
4309
  });
4292
4310
  }
4293
4311
  });
4294
- } else if (Guards65.isArray(pluginOrSetup)) {
4312
+ } else if (Guards66.isArray(pluginOrSetup)) {
4295
4313
  this._modules.push({
4296
4314
  priority: 1,
4297
4315
  name: "LoggerModule",
@@ -4345,7 +4363,7 @@ var XenoAppBuilder = class {
4345
4363
  }
4346
4364
  addCache(pluginOrSetup) {
4347
4365
  if (this._isCacheModuleQueued) return this;
4348
- if (!Guards65.isDefined(pluginOrSetup))
4366
+ if (!Guards66.isDefined(pluginOrSetup))
4349
4367
  this._modules.push({
4350
4368
  priority: 2,
4351
4369
  name: "CacheModule",
@@ -4442,8 +4460,8 @@ var XenoAppBuilder = class {
4442
4460
  */
4443
4461
  addPipeline(pluginOrPlugins) {
4444
4462
  if (this._isPipelineModuleQueued) return this;
4445
- if (Guards65.isDefined(pluginOrPlugins))
4446
- this._pipelinePlugins = Guards65.isArray(pluginOrPlugins) ? pluginOrPlugins : [pluginOrPlugins];
4463
+ if (Guards66.isDefined(pluginOrPlugins))
4464
+ this._pipelinePlugins = Guards66.isArray(pluginOrPlugins) ? pluginOrPlugins : [pluginOrPlugins];
4447
4465
  this._modules.push({
4448
4466
  priority: 5,
4449
4467
  name: "CqrsModule",
@@ -4544,7 +4562,7 @@ var XenoAppBuilder = class {
4544
4562
  * @link https://github.com/xeno-js/xeno-js
4545
4563
  */
4546
4564
  build() {
4547
- if (Guards65.isDefined(this._buildPromise)) {
4565
+ if (Guards66.isDefined(this._buildPromise)) {
4548
4566
  return this._buildPromise;
4549
4567
  }
4550
4568
  const attempt = this._executeBuild();
@@ -4590,21 +4608,21 @@ var XenoAppBuilder = class {
4590
4608
  console.error(`\u{1F449} Module: **${queued.name}**`);
4591
4609
  console.error(`\u{1F4DD} Reason: ${errorMessage}
4592
4610
  `);
4593
- if (error instanceof Error && Guards65.isDefined(error.stack)) {
4611
+ if (error instanceof Error && Guards66.isDefined(error.stack)) {
4594
4612
  console.error(error.stack);
4595
4613
  }
4596
4614
  throw new Error(`Bootstrap failed at [${queued.name}]: ${errorMessage}`, { cause: error });
4597
4615
  }
4598
4616
  }
4599
4617
  console.info("\u2705 Application modules bootstrapped successfully.");
4600
- if (Guards65.isDefined(this._appFactory)) return this._appFactory(this._container);
4618
+ if (Guards66.isDefined(this._appFactory)) return this._appFactory(this._container);
4601
4619
  return new XenoApplication(this._container);
4602
4620
  }
4603
4621
  };
4604
4622
 
4605
4623
  // src/infrastructure/repositories/read-dao.ts
4606
4624
  import { AppError as AppError18, Result as Result18 } from "@xeno-js/shared";
4607
- import { Guards as Guards66 } from "@xeno-js/shared";
4625
+ import { Guards as Guards67 } from "@xeno-js/shared";
4608
4626
  var ReadDao = class {
4609
4627
  /**
4610
4628
  * Constructs a new ReadDao instance.
@@ -4626,7 +4644,7 @@ var ReadDao = class {
4626
4644
  async findById(id, ctx, signal) {
4627
4645
  AppError18.throwIfAborted(signal, "ReadDao.findById");
4628
4646
  const result = await this._dataSource.findById(id, ctx, signal);
4629
- if (Guards66.isNullOrEmpty(result)) return Result18.ok();
4647
+ if (Guards67.isNullOrEmpty(result)) return Result18.ok();
4630
4648
  const entity = this._mapper.toEntity(result);
4631
4649
  return Result18.ok(entity);
4632
4650
  }
@@ -4640,7 +4658,7 @@ var ReadDao = class {
4640
4658
 
4641
4659
  // src/infrastructure/repositories/repository.ts
4642
4660
  import { AppError as AppError19, Result as Result19 } from "@xeno-js/shared";
4643
- import { Guards as Guards67 } from "@xeno-js/shared";
4661
+ import { Guards as Guards68 } from "@xeno-js/shared";
4644
4662
  var Repository = class {
4645
4663
  /**
4646
4664
  * Constructs a new Repository instance.
@@ -4662,7 +4680,7 @@ var Repository = class {
4662
4680
  async findById(id, ctx, signal) {
4663
4681
  AppError19.throwIfAborted(signal, "Repository.findById");
4664
4682
  const result = await this._dataSource.findById(id, ctx, signal);
4665
- if (Guards67.isNullOrEmpty(result)) return Result19.ok();
4683
+ if (Guards68.isNullOrEmpty(result)) return Result19.ok();
4666
4684
  const entity = this._mapper.toEntity(result);
4667
4685
  return Result19.ok(entity);
4668
4686
  }