@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.cjs CHANGED
@@ -958,7 +958,7 @@ var LoggerUtils = Object.freeze({
958
958
  * @returns The converted LoggerContext object.
959
959
  */
960
960
  toSafeContext(ctx) {
961
- return {
961
+ const context = {
962
962
  identity: {
963
963
  userId: ctx?.identity?.userId,
964
964
  tenantId: ctx?.identity?.tenantId
@@ -977,6 +977,23 @@ var LoggerUtils = Object.freeze({
977
977
  },
978
978
  messaging: ctx?.messaging
979
979
  };
980
+ return import_shared32.StringHelper.safeStringifyObject(context);
981
+ },
982
+ toNormalizeError(error) {
983
+ if (error instanceof Error) {
984
+ return {
985
+ message: error.message,
986
+ name: error.name,
987
+ stack: error.stack,
988
+ cause: error.cause
989
+ };
990
+ }
991
+ const errorString = import_shared32.Guards.isString(error) ? error : import_shared32.StringHelper.safeStringify(error);
992
+ const customError = new Error(errorString);
993
+ if (import_shared32.Guards.isObject(error) && import_shared32.Guards.isDefined(error)) {
994
+ Object.assign(customError, error);
995
+ }
996
+ return customError;
980
997
  }
981
998
  });
982
999
 
@@ -2340,6 +2357,7 @@ var CreateServicesProxy = class {
2340
2357
  // src/infrastructure/modules/context.module.ts
2341
2358
  var ContextModule = class {
2342
2359
  async configure(container, opts) {
2360
+ if (container.isRegistered(import_shared63.TOKENS.REQUEST_CONTEXT)) return;
2343
2361
  const requestContext = await this._getRequestContext(container, opts);
2344
2362
  container.addSingleton(import_shared63.TOKENS.REQUEST_CONTEXT, () => requestContext);
2345
2363
  container.addSingleton(import_shared63.TOKENS.CONTEXT_ACCESSOR, () => requestContext);