@xeno-js/core 4.1.1 → 4.1.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.
package/dist/index.js CHANGED
@@ -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 { 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,7 @@ var LoggerUtils = Object.freeze({
925
925
  },
926
926
  messaging: ctx?.messaging
927
927
  };
928
+ return StringHelper.safeStringify(context);
928
929
  }
929
930
  });
930
931
 
@@ -1802,7 +1803,7 @@ var AuthModule = class {
1802
1803
  import { Guards as Guards29, TOKENS as TOKENS6 } from "@xeno-js/shared";
1803
1804
 
1804
1805
  // src/infrastructure/cache/inmemory.cache.ts
1805
- import { Guards as Guards23, StringHelper } from "@xeno-js/shared";
1806
+ import { Guards as Guards23, StringHelper as StringHelper2 } from "@xeno-js/shared";
1806
1807
  var InMemoryCache = class {
1807
1808
  /**
1808
1809
  * @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.
@@ -1839,7 +1840,7 @@ var InMemoryCache = class {
1839
1840
  }
1840
1841
  async set(key, value, ttl) {
1841
1842
  const expiresAt = Guards23.isDefined(ttl) ? Date.now() + ttl * 1e3 : void 0;
1842
- this._cache.set(key, { value: StringHelper.safeStringify(value), expiresAt });
1843
+ this._cache.set(key, { value: StringHelper2.safeStringify(value), expiresAt });
1843
1844
  }
1844
1845
  async setIfAbsent(key, value, ttl) {
1845
1846
  if (this._cache.has(key)) {
@@ -1869,16 +1870,16 @@ var InMemoryCache = class {
1869
1870
  const entry = this._cache.get(key);
1870
1871
  const now = Date.now();
1871
1872
  if (Guards23.isDefined(entry) && (!Guards23.isDefined(entry.expiresAt) || entry.expiresAt > now)) {
1872
- const nextValue = Number(StringHelper.safeParse(entry.value)) + 1;
1873
+ const nextValue = Number(StringHelper2.safeParse(entry.value)) + 1;
1873
1874
  this._cache.set(key, {
1874
- value: StringHelper.safeStringify(nextValue),
1875
+ value: StringHelper2.safeStringify(nextValue),
1875
1876
  expiresAt: entry.expiresAt
1876
1877
  });
1877
1878
  return nextValue;
1878
1879
  }
1879
1880
  const ttl = !Guards23.isNullOrEmpty(ttlSeconds) ? Number(ttlSeconds) : 60;
1880
1881
  const expiresAt = now + ttl * 1e3;
1881
- this._cache.set(key, { value: StringHelper.safeStringify(1), expiresAt });
1882
+ this._cache.set(key, { value: StringHelper2.safeStringify(1), expiresAt });
1882
1883
  return 1;
1883
1884
  }
1884
1885
  evictExpired() {
@@ -2289,6 +2290,7 @@ var CreateServicesProxy = class {
2289
2290
  // src/infrastructure/modules/context.module.ts
2290
2291
  var ContextModule = class {
2291
2292
  async configure(container, opts) {
2293
+ if (container.isRegistered(TOKENS7.REQUEST_CONTEXT)) return;
2292
2294
  const requestContext = await this._getRequestContext(container, opts);
2293
2295
  container.addSingleton(TOKENS7.REQUEST_CONTEXT, () => requestContext);
2294
2296
  container.addSingleton(TOKENS7.CONTEXT_ACCESSOR, () => requestContext);