@xeno-js/shared 0.1.7 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/shared/constants/concurrency.constants.ts","../src/shared/constants/error.constants.ts","../src/shared/constants/roles.constants.ts","../src/shared/constants/guest.constants.ts","../src/shared/constants/idempotency.constants.ts","../src/shared/constants/log-level.constants.ts","../src/shared/constants/pagination.constants.ts","../src/shared/constants/request.constants.ts","../src/shared/constants/resilience.constants.ts","../src/shared/constants/tokens.constants.ts","../src/shared/utils/guards.utils.ts","../src/shared/utils/abort.utils.ts","../src/shared/utils/date.utils.ts","../src/shared/utils/enumerable.utils.ts","../src/shared/utils/guid.utils.ts","../src/shared/utils/http.utils.ts","../src/shared/utils/math.utils.ts","../src/shared/utils/promise.utils.ts","../src/shared/utils/sanitize.utils.ts","../src/shared/utils/string.utils.ts","../src/application/cqrs/command/command.ts","../src/application/cqrs/query/query.ts","../src/application/loggers/utils/logger-context.utils.ts","../src/application/loggers/base.logger.ts","../src/domain/unique_id/unique-id.ts","../src/domain/entities/entity.ts","../src/domain/errors/app-error.ts","../src/domain/results/result.ts","../src/domain/value_objects/value-object.ts","../src/infrastructure/auth/storage/cookie.storage.ts","../src/infrastructure/auth/storage/memory.storage.ts","../src/infrastructure/auth/storage/storage.utils.ts","../src/infrastructure/auth/supabase-auth.service.ts","../src/infrastructure/cache/in-memory.cache.ts","../src/infrastructure/cache/key-builder.cache.ts","../src/infrastructure/factories/axios.factory.ts","../src/infrastructure/http/axios.http.ts","../src/infrastructure/mappers/supabase-claims.mapper.ts","../src/infrastructure/mappers/supabase-session.mapper.ts","../src/infrastructure/validators/base-schema.constant.ts","../src/infrastructure/validators/schema-zod.utils.ts","../src/infrastructure/validators/zod.validator.ts"],"sourcesContent":["export * from './application/index'\nexport * from './domain/index'\nexport {\n AxiosFactory,\n AxiosHttpClient,\n CacheKeyBuilder,\n InMemoryCache,\n StorageHelper,\n SupabaseAuthService,\n SupabaseClaimsMapper,\n SupabaseSessionMapper,\n ZodUtils,\n ZodValidatorService,\n} from './infrastructure/index'\nexport * from './shared/index'\n","/**\r\n * @description This module defines constants related to concurrency handling in the application, specifically for the ConcurrencyRetryPipeline. These constants include the maximum number of retry attempts, the base delay for retries, and the maximum jitter to be added to the delay. The constants are exported as a frozen object to prevent modification at runtime, ensuring consistent behavior across the application when handling concurrency conflicts.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const DEFAULT_CONCURRENCY = Object.freeze({\r\n /**\r\n * @description Number of maximum retry attempts for handling concurrency conflicts in the pipeline. If the number of attempts exceeds this value, the pipeline will return a failed Result with an AppError indicating that the maximum retry attempts have been exceeded due to concurrency conflicts.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n MAX_RETRIES: 3,\r\n /**\r\n * @description Base delay in milliseconds for retrying a request after a concurrency conflict is detected. The actual delay will be calculated using an exponential backoff strategy with added jitter to prevent thundering herd problems when multiple requests are retried simultaneously.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n BASE_DELAY: 20,\r\n /**\r\n * @description Maximum jitter in milliseconds to be added to the base delay when retrying a request after a concurrency conflict is detected. This helps to randomize the retry attempts and reduce the likelihood of multiple requests being retried at the same time, which can lead to further conflicts. The actual delay for each retry will be calculated as baseDelayMs * (2 ** attempt) + randomJitter, where randomJitter is a random value between 0 and maxJitterMs.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n MAX_JITTER: 30,\r\n} as const)\r\n","/**\r\n * @description Machine-readable, kebab-case error codes for all cross-cutting failures.\r\n * Used by AppError and Result to communicate failure semantics across layer boundaries\r\n * without relying on human-readable strings.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const ERROR_CODES = Object.freeze({\r\n // ── Generic / System ─────────────────────────────────────────────────────\r\n\r\n /** @description Unclassified or unexpected infrastructure-level failure.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n SYSTEM_ERROR: 'SYSTEM_ERROR',\r\n\r\n /** @description An operation that has not yet been implemented was invoked.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n NOT_IMPLEMENTED: 'NOT_IMPLEMENTED',\r\n\r\n /** @description An external API call failed due to network issues or a 5xx response.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n EXTERNAL_SERVICE_ERROR: 'EXTERNAL_SERVICE_ERROR',\r\n\r\n /** @description One or more input fields failed invariant or schema validation.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n VALIDATION_FAILED: 'VALIDATION_FAILED',\r\n\r\n /** @description Authentication failed due to invalid credentials or token.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n AUTHENTICATION_FAILED: 'AUTHENTICATION_FAILED',\r\n\r\n /** @description The caller is not authenticated.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n UNAUTHORIZED: 'UNAUTHORIZED',\r\n\r\n /** @description The caller is authenticated but lacks the required permissions.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n FORBIDDEN: 'FORBIDDEN',\r\n\r\n /** @description The request was well-formed but semantically invalid.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n BAD_REQUEST: 'BAD_REQUEST',\r\n\r\n /** @description The request was aborted before it could be processed.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n ABORTED: 'ABORTED',\r\n\r\n /** @description Required service scope is not available in the request context.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n SCOPE_NOT_AVAILABLE: 'SCOPE_NOT_AVAILABLE',\r\n\r\n /** @description The request conflicts with the current state of the resource.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n CONFLICT: 'CONFLICT',\r\n /** @description The requested resource does not exist.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n NOT_FOUND: 'NOT_FOUND',\r\n\r\n /** @description No handler was found for the given request type.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n HANDLER_NOT_FOUND: 'HANDLER_NOT_FOUND',\r\n\r\n /** @description No pipeline behavior was found for the given request type.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n PIPELINE_NOT_AVAILABLE: 'PIPELINE_NOT_AVAILABLE',\r\n\r\n NOT_ALLOWED: 'METHOD_NOT_ALLOWED',\r\n\r\n TOO_MANY_REQUESTS: 'TOO_MANY_REQUESTS',\r\n} as const)\r\n\r\n/** @description Inferred union of every valid ERROR_CODES value.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES]\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * @description Canonical HTTP status codes used across Presentation and Infrastructure layers.\r\n * Centralising these values prevents magic-number sprawl and ensures\r\n * consistent semantics between the AppError, Result and ApiResponse contracts.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const STATUS_CODES = Object.freeze({\r\n // ── 2xx Success ───────────────────────────────────────────────────────────\r\n\r\n /** @description The request succeeded and a response body is present.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n OK: 200,\r\n\r\n /** @description A new resource has been successfully created.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n CREATED: 201,\r\n\r\n /** @description The request succeeded but there is no response body (e.g. DELETE).\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n NO_CONTENT: 204,\r\n\r\n // ── 4xx Client Errors ─────────────────────────────────────────────────────\r\n\r\n /** @description The request payload is malformed or contains invalid parameters.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n BAD_REQUEST: 400,\r\n\r\n /** @description Authentication credentials are missing or invalid.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n UNAUTHORIZED: 401,\r\n\r\n /** @description The caller lacks permission to perform the requested operation.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n FORBIDDEN: 403,\r\n\r\n /** @description The requested resource does not exist.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n NOT_FOUND: 404,\r\n\r\n NOT_ALLOWED: 405,\r\n\r\n /** @description The request conflicts with the current state of the resource.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n CONFLICT: 409,\r\n\r\n /** @description The payload is syntactically valid but semantically unprocessable.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n UNPROCESSABLE_ENTITY: 422,\r\n\r\n /** @description The caller has exceeded its allowed rate limit.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n TOO_MANY_REQUESTS: 429,\r\n\r\n /** @description The client closed the connection before the server finished responding.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n ABORTED: 499,\r\n\r\n // ── 5xx Server Errors ─────────────────────────────────────────────────────\r\n\r\n /** @description An unexpected condition was encountered by the server.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n INTERNAL_SERVER_ERROR: 500,\r\n\r\n /** @description A downstream dependency is temporarily unavailable.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n SERVICE_UNAVAILABLE: 503,\r\n} as const)\r\n\r\n/** @description Inferred union of every valid STATUS_CODES value.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport type StatusCode = (typeof STATUS_CODES)[keyof typeof STATUS_CODES]\r\n\r\n/**\r\n * @description A mapping of ERROR_CODES to human-readable messages, used for logging and user feedback when an AppError is created with a specific error code. This allows for consistent and centralized management of error messages across the application, ensuring that each error code corresponds to a clear and descriptive message that can be easily maintained and localized if necessary.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const ERROR_CODE_MESSAGES: Record<ErrorCode, string> = Object.freeze({\r\n [ERROR_CODES.SYSTEM_ERROR]: 'errors.system_error',\r\n [ERROR_CODES.NOT_IMPLEMENTED]: 'errors.not_implemented',\r\n [ERROR_CODES.EXTERNAL_SERVICE_ERROR]: 'errors.external_service_error',\r\n [ERROR_CODES.VALIDATION_FAILED]: 'errors.validation_failed',\r\n [ERROR_CODES.UNAUTHORIZED]: 'errors.unauthorized',\r\n [ERROR_CODES.FORBIDDEN]: 'errors.forbidden',\r\n [ERROR_CODES.BAD_REQUEST]: 'errors.bad_request',\r\n [ERROR_CODES.ABORTED]: 'errors.aborted',\r\n [ERROR_CODES.AUTHENTICATION_FAILED]: 'errors.authentication_failed',\r\n [ERROR_CODES.SCOPE_NOT_AVAILABLE]: 'errors.scope_not_available',\r\n [ERROR_CODES.CONFLICT]: 'errors.conflict',\r\n [ERROR_CODES.NOT_FOUND]: 'errors.not_found',\r\n [ERROR_CODES.HANDLER_NOT_FOUND]: 'errors.handler_not_found',\r\n [ERROR_CODES.PIPELINE_NOT_AVAILABLE]: 'errors.pipeline_not_available',\r\n [ERROR_CODES.NOT_ALLOWED]: 'errors.method_not_allowed',\r\n [ERROR_CODES.TOO_MANY_REQUESTS]: 'errors.too_many_requests',\r\n} as const)\r\n","/**\r\n * @fileoverview This file defines the roles used within the application. The ROLES constant is an object that contains the different roles available, such as SUPER_ADMIN, ADMIN, USER, and GUEST. Each role is represented as a string value. The Role type is defined as a union of the values of the ROLES object, allowing for type safety when working with roles throughout the application.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n\r\n/** @description An object containing the different roles available within the application. Each role is represented as a string value.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const ROLES = Object.freeze({\r\n /** @description The SUPER_ADMIN role, which typically has the highest level of permissions and access within the application.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n SUPER_ADMIN: 'super_admin',\r\n /** @description The ADMIN role, which typically has elevated permissions and access within the application, but may have some restrictions compared to the SUPER_ADMIN role.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n ADMIN: 'admin',\r\n /** @description The USER role, which typically has standard permissions and access within the application, allowing them to perform regular user actions but with limited administrative capabilities.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n USER: 'user',\r\n /** @description The GUEST role, which typically has the most limited permissions and access within the application, often used for unauthenticated users or users with very restricted access.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n GUEST: 'guest',\r\n} as const)\r\n\r\n/** @description A type representing the different roles available within the application. It is defined as a union of the values of the ROLES object, allowing for type safety when working with roles throughout the application.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport type Role = (typeof ROLES)[keyof typeof ROLES]\r\n\r\n/** @description An object containing the different permissions available within the application. Each permission is represented as a string value.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const PERMISSIONS = Object.freeze({\r\n /** @description The READ permission, which typically allows access to resources or actions within the application that require read-only access.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n READ: 'read',\r\n} as const)\r\n\r\n/** @description A type representing the different permissions available within the application. It is defined as a union of the values of the PERMISSIONS object, allowing for type safety when working with permissions throughout the application.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport type Permission = (typeof PERMISSIONS)[keyof typeof PERMISSIONS]\r\n","import { PERMISSIONS, ROLES } from './roles.constants'\r\n\r\n/**\r\n * @description The GUEST constant represents a default guest user identity with no specific user ID or tenant ID, assigned the GUEST role, and no permissions. This constant can be used throughout the application to represent unauthenticated users or users with minimal access rights, ensuring a consistent representation of guest users across the system.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const GUEST = Object.freeze({\r\n /** @description The unique identifier for the guest user, which is set to undefined since guest users do not have a specific user ID. This allows the application to differentiate between authenticated users with valid IDs and unauthenticated guest users.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n userId: undefined,\r\n /** @description The email for guest user, which is set to undefined since guest users do not have a specific email.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n email: undefined,\r\n /** @description The unique identifier for the tenant associated with the guest user, which is set to undefined since guest users do not belong to a specific tenant. This allows the application to handle multi-tenancy scenarios while still accommodating unauthenticated users who do not have an associated tenant.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n tenantId: undefined,\r\n /** @description An array of roles assigned to the guest user, which includes only the GUEST role. This indicates that the user has minimal access rights and is typically used to represent unauthenticated users or users with limited permissions in the application.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n roles: [ROLES.GUEST],\r\n /** @description An array of permissions assigned to the guest user, which is empty since guest users do not have any specific permissions. This reinforces the idea that guest users have minimal access rights and cannot perform actions that require specific permissions in the application.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n permissions: [PERMISSIONS.READ],\r\n} as const)\r\n","/**\r\n * @description Constants used in the idempotency store implementation, including key prefixes for locks and processed commands, default time-to-live (TTL) values, and standard values for indicating locked and processed states. These constants are defined as a frozen object to ensure immutability and provide a centralized location for managing configuration values related to idempotency handling in the application.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const IDEMPOTENCY_CONSTANTS = Object.freeze({\r\n /**\r\n * @description Prefix for keys used to store locks in the idempotency store. This prefix is used to differentiate lock entries from other types of entries in the cache, allowing for efficient management of locks when acquiring and releasing them during command processing. The lock key prefix helps ensure that lock-related data is organized and easily identifiable within the caching mechanism.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n LOCK_KEY_PREFIX: 'idempotency_lock:',\r\n\r\n /**\r\n * @description Prefix for keys used to store processed command results in the idempotency store. This prefix is used to differentiate processed command entries from lock entries and other types of data in the cache, allowing for efficient retrieval of stored results when checking if a command has already been processed. The processed key prefix helps maintain a clear structure within the caching mechanism, making it easier to manage and query processed command data.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n PROCESSED_KEY_PREFIX: 'idempotency_processed:',\r\n\r\n /**\r\n * @description Default time-to-live (TTL) in seconds for locks and processed command entries in the idempotency store. This value is used when acquiring locks and marking commands as processed to specify how long the lock or stored result should remain valid before it expires. The default TTL helps ensure that locks and processed command entries do not persist indefinitely, allowing for automatic cleanup of stale data and preventing potential issues with long-lived locks or outdated results in the idempotency store.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n DEFAULT_TTL_SECONDS: 86400,\r\n\r\n /**\r\n * @description Default time-to-live (TTL) in seconds for locks in the idempotency store. This value is used when acquiring locks to specify how long the lock should remain valid before it expires. The default lock TTL helps ensure that locks do not persist indefinitely, allowing for automatic cleanup of stale locks and preventing potential issues with long-lived locks in the idempotency mechanism.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n DEFAULT_IDEMPOTENCY_LOCK_TTL_SECONDS: 60,\r\n\r\n /**\r\n * @description Standard value used to indicate that a lock has been acquired for a specific commandId in the idempotency store. This value is stored in the cache when a lock is successfully acquired, allowing other instances of the command to recognize that the command is currently being processed and prevent duplicate processing. The locked value serves as a marker for active locks in the idempotency mechanism, helping to manage concurrent command processing effectively.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n LOCKED_VALUE: 'LOCKED',\r\n\r\n /**\r\n * @description Standard value used to indicate that a command has been processed and its result has been stored in the idempotency store. This value is stored in the cache when a command is marked as processed, allowing subsequent attempts to process the same commandId to recognize that it has already been handled and return the stored result instead of executing the command again. The processed value serves as a marker for completed commands in the idempotency mechanism, helping to manage command processing outcomes and prevent redundant executions.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n PROCESSED_VALUE: 'PROCESSED',\r\n} as const)\r\n","/**\r\n * Log levels for the logger.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const LOG_LEVEL = Object.freeze({\r\n /** * Debug level for detailed debugging information. This level is typically used during development and should be turned off in production to avoid verbose logging.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n DEBUG: 0,\r\n /** * Info level for general informational messages that highlight the progress of the application at a coarse-grained level. This level is suitable for production environments to track the normal operation of the application.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n INFO: 1,\r\n /** * Warn level for potentially harmful situations that are not necessarily errors but may require attention. This level is useful for identifying issues that could lead to errors if not addressed.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n WARN: 2,\r\n /** * Error level for serious issues that have caused or are likely to cause the application to fail. This level is critical for identifying and addressing problems that need immediate attention.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n ERROR: 3,\r\n} as const)\r\n\r\n/** @description Inferred union of valid log level values.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport type LogLevel = (typeof LOG_LEVEL)[keyof typeof LOG_LEVEL]\r\n\r\n/** @description Mapping of log level values to their corresponding string representations for easier readability in log outputs.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const LOG_LEVEL_NAMES: Record<LogLevel, string> = {\r\n /** Debug level for detailed debugging information. This level is typically used during development and should be turned off in production to avoid verbose logging.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n [LOG_LEVEL.DEBUG]: 'DEBUG',\r\n /** Info level for general informational messages that highlight the progress of the application at a coarse-grained level. This level is suitable for production environments to track the normal operation of the application.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n [LOG_LEVEL.INFO]: 'INFO',\r\n /** Warn level for potentially harmful situations that are not necessarily errors but may require attention. This level is useful for identifying issues that could lead to errors if not addressed.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n [LOG_LEVEL.WARN]: 'WARN',\r\n /** Error level for serious issues that have caused or are likely to cause the application to fail. This level is critical for identifying and addressing problems that need immediate attention.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n [LOG_LEVEL.ERROR]: 'ERROR',\r\n}\r\n","// ─── Constants ────────────────────────────────────────────────────────────────\r\n\r\n/** @description Default page index when no page is supplied by the caller.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nconst DEFAULT_PAGE = 1\r\n\r\n/** @description Default maximum number of items per page.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nconst DEFAULT_PAGE_SIZE = 20\r\n\r\n/** @description Absolute maximum allowed page size to prevent resource exhaustion.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nconst MAX_PAGE_SIZE = 100\r\n\r\n/** @description Canonical pagination defaults.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const PAGINATION_DEFAULTS = Object.freeze({\r\n /** @description Default page index (1-based).\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n PAGE: DEFAULT_PAGE,\r\n\r\n /** @description Default maximum items per page.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n PAGE_SIZE: DEFAULT_PAGE_SIZE,\r\n\r\n /** @description Hard ceiling on page size accepted by the system.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n MAX_PAGE_SIZE,\r\n} as const)\r\n\r\n// ─── Sort Direction ───────────────────────────────────────────────────────────\r\n\r\n/**\r\n * @description Canonical sort direction values.\r\n * Used by IPaginationParams.sortDirection to avoid string magic.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const SORT_DIRECTION = Object.freeze({\r\n /** @description Ascending order (A → Z, 0 → 9, oldest → newest).\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n ASC: 'asc',\r\n\r\n /** @description Descending order (Z → A, 9 → 0, newest → oldest).\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n DESC: 'desc',\r\n} as const)\r\n\r\n/** @description Inferred union of valid sort direction values.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport type SortDirection = (typeof SORT_DIRECTION)[keyof typeof SORT_DIRECTION]\r\n","/** @description Constants related to request handling in the application.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const REQUEST_TYPE = Object.freeze({\r\n /** @description A request that intends to modify state (e.g. create, update, delete).\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n COMMAND: 'COMMAND',\r\n /** @description A request that intends to retrieve data without modifying state.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n QUERY: 'QUERY',\r\n} as const)\r\n\r\n/** @description Inferred union of every valid REQUEST_TYPE value.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport type RequestType = (typeof REQUEST_TYPE)[keyof typeof REQUEST_TYPE]\r\n","/**\r\n * @description Canonical default values for resilience policy configuration.\r\n * Used by the resilience factory as the baseline for retry, circuit breaker,\r\n * and bulkhead settings.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const RESILIENCE_DEFAULTS = Object.freeze({\r\n /** @description Default retry policy values.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n RETRY: Object.freeze({\r\n /** @description Default number of retry attempts.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n ATTEMPTS: 3,\r\n\r\n /** @description Default base delay in milliseconds for retry backoff.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n BASE_DELAY_MS: 100,\r\n\r\n /** @description Default maximum delay in milliseconds for retry backoff.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n MAX_DELAY_MS: 1000,\r\n }),\r\n\r\n /** @description Default circuit breaker policy values.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n CIRCUIT_BREAKER: Object.freeze({\r\n /** @description Default number of consecutive failures before opening the circuit.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n CONSECUTIVE_FAILURES: 5,\r\n\r\n /** @description Default half-open timeout in milliseconds.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n HALF_OPEN_TIMEOUT_MS: 30_000,\r\n }),\r\n\r\n /** @description Default bulkhead policy values.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n BULKHEAD: Object.freeze({\r\n /** @description Default maximum number of concurrent operations.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n MAX_CONCURRENT: 10,\r\n }),\r\n} as const)\r\n","/**\n * @description This file defines the tokens used for dependency injection in the application.\n * Tokens are unique identifiers that are used to register and resolve dependencies in the container.\n * They can be symbols, strings, or classes, but using symbols is a common practice to avoid naming collisions.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\nexport const TOKENS = Object.freeze({\n /** @description Token used to register and resolve the Extendend AuthService instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n AUTH_SERVICE: 'AUTH_SERVICE',\n /** @description Token used to register and resolve the BaseAuthService instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n BASE_AUTH_SERVICE: 'BASE_AUTH_SERVICE',\n /** @description Token used to register and resolve the InMemoryCache instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n CACHE: 'CACHE',\n /** @description Token used to register and resolve the CacheKeyBuilder instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n CACHE_KEY_BUILDER: 'CACHE_KEY_BUILDER',\n /** @description Token used to register and resolve command pipeline behaviors in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n COMMAND_PIPELINES_BEHAVIOR: 'COMMAND_PIPELINES_BEHAVIOR',\n /** @description Token used to register and resolve the ConcurrencyService instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n CONCURRENCY_SERVICE: 'CONCURRENCY_SERVICE',\n /** @description Token used to register and resolve the ConfigurationService instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n CONFIGURATION_SERVICE: 'CONFIGURATION_SERVICE',\n /** @description Token used to register and resolve the ContextAccessor instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n CONTEXT_ACCESSOR: 'CONTEXT_ACCESSOR',\n /** @description Token used to register and resolve the CryptoService instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n CRYPTO_SERVICE: 'CRYPTO_SERVICE',\n /** @description Token used to register and resolve the CsrfTokenService instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n CSRF_TOKEN_SERVICE: 'CSRF_TOKEN_SERVICE',\n /** @description Token used to register and resolve the DbContext instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n DB_CONTEXT: 'DB_CONTEXT',\n /** @description Token used to register and resolve the IdentityAccessor instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n IDENTITY_ACCESSOR: 'IDENTITY_ACCESSOR',\n /** @description Token used to register and resolve the Logger instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n LOGGER: 'LOGGER',\n /** @description Token used to register and resolve the Mediator instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n MEDIATOR: 'MEDIATOR',\n /** @description Token used to register and resolve the NetworkContextFactory in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n NETWORK_CONTEXT_ACCESSOR: 'NETWORK_CONTEXT_ACCESSOR',\n /** @description Token used to register and resolve query pipeline behaviors in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n QUERY_PIPELINES_BEHAVIOR: 'QUERY_PIPELINES_BEHAVIOR',\n /** @description Token used to register and resolve the RequestContext instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n REQUEST_CONTEXT: 'REQUEST_CONTEXT',\n /** @description Token used to register and resolve the CompositeMiddleware in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n MIDDLEWARE: 'MIDDLEWARE',\n /** @description Token used to register and resolve the IServiceResilience instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n RESILIENCE_CLIENT: 'RESILIENCE_CLIENT',\n /** @description Token used to register and resolve the SchemaValidationStrategy instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n SCHEMA_VALIDATION_STRATEGY: 'SCHEMA_VALIDATION_STRATEGY',\n /** @description Token used to register and resolve the ServiceContainer instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n SERVICE_CONTAINER: 'SERVICE_CONTAINER',\n /** @description Token used to register and resolve the ServiceExtractor instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n SERVICE_EXTRACTOR: 'SERVICE_EXTRACTOR',\n /** @description Token used to register and resolve the ServiceScopeAccessor in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n SERVICE_SCOPE_ACCESSOR: 'SERVICE_SCOPE_ACCESSOR',\n /** @description Token used to register and resolve the UnitOfWork instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n UNIT_OF_WORK: 'UNIT_OF_WORK',\n /** @description Token used to register and resolve the ValidatorService instance in the dependency injection container.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n VALIDATOR_SERVICE: 'VALIDATOR_SERVICE',\n} as const)\n","import type { Dictionary, Maybe } from '../types/common.types'\r\n\r\nconst OBJECT_TAG = '[object Object]'\r\nconst DATE_TAG = '[object Date]'\r\n\r\n/**\r\n * @description Centralized type guards and runtime predicates.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const Guards = Object.freeze({\r\n /**\r\n * @description Checks value is neither null nor undefined.\r\n * @param value Candidate value.\r\n * @returns True when value is defined.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isDefined<TValue>(value: Maybe<TValue>): value is TValue {\r\n return value !== null && value !== undefined && value !== '' && !Number.isNaN(value)\r\n },\r\n\r\n /**\r\n * @description Checks value is null, undefined, empty string, or false.\r\n * @param value Candidate value.\r\n * @returns True when value is null, undefined, empty string, or false.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isNullOrEmpty<TValue>(value: Maybe<TValue>): value is null | undefined {\r\n return (\r\n !Guards.isDefined(value) ||\r\n (Guards.isString(value) && value.trim() === '') ||\r\n (Guards.isArray(value) && value.length === 0)\r\n )\r\n },\r\n\r\n /**\r\n * @description Throws an error if the value is null, undefined, empty string, or false.\r\n * @param value Candidate value.\r\n * @param errorMessage Error message to throw if the check fails.\r\n * @throws Error with the provided message if the value is null, undefined, empty string, or false.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n throwIfNullOrEmpty<TValue>(value: Maybe<TValue>, errorMessage: string): void {\r\n if (Guards.isNullOrEmpty(value)) {\r\n throw new Error(errorMessage)\r\n }\r\n },\r\n\r\n /**\r\n * @description Throws an error if the value is not a positive integer.\r\n * @param value Candidate value.\r\n * @param errorMessage Error message to throw if the check fails.\r\n * @throws Error with the provided message if the value is not a positive integer.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n throwIfNegative(value: number, errorMessage: string): void {\r\n if (Guards.isInteger(value) && value < 0) {\r\n throw new Error(errorMessage)\r\n }\r\n },\r\n\r\n /**\r\n * @description Throws an error if the value is not an integer.\r\n * @param value Candidate value.\r\n * @param errorMessage Error message to throw if the check fails.\r\n * @throws Error with the provided message if the value is not an integer.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n throwIfNotInteger(value: number, errorMessage: string): void {\r\n if (!Guards.isInteger(value)) {\r\n throw new Error(errorMessage)\r\n }\r\n },\r\n\r\n /**\r\n * @description Checks if an object has a method with the given name.\r\n * @param obj Object to check.\r\n * @param methodName Name of the method to look for.\r\n * @returns True when obj has a function property named methodName.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n hasMethod(obj: unknown, methodName: string): boolean {\r\n if (!this.isDefined(obj)) return false\r\n\r\n // Essendo all'interno del namespace di utilità, l'uso di typeof qui è consentito\r\n return Guards.isFunction((obj as Dictionary<unknown>)[methodName])\r\n },\r\n\r\n /**\r\n * @description Checks value is a string.\r\n * @param value Candidate value.\r\n * @returns True when value is string.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isString(value: unknown): value is string {\r\n return typeof value === 'string'\r\n },\r\n\r\n /**\r\n * @description Checks value is a finite number.\r\n * @param value Candidate value.\r\n * @returns True when value is finite number.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isNumber(value: unknown): value is number {\r\n return typeof value === 'number' && Number.isFinite(value)\r\n },\r\n\r\n /**\r\n * @description Checks value is an integer number.\r\n * @param value Candidate value.\r\n * @returns True when value is integer number.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isInteger(value: unknown): value is number {\r\n return Guards.isNumber(value) && Number.isInteger(value)\r\n },\r\n\r\n /**\r\n * @description Checks value is boolean.\r\n * @param value Candidate value.\r\n * @returns True when value is boolean.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isBoolean(value: unknown): value is boolean {\r\n return typeof value === 'boolean'\r\n },\r\n\r\n /**\r\n * @description Checks value is bigint.\r\n * @param value Candidate value.\r\n * @returns True when value is bigint.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isBigInt(value: unknown): value is bigint {\r\n return typeof value === 'bigint'\r\n },\r\n\r\n /**\r\n * @description Checks value is symbol.\r\n * @param value Candidate value.\r\n * @returns True when value is symbol.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isSymbol(value: unknown): value is symbol {\r\n return typeof value === 'symbol'\r\n },\r\n\r\n /**\r\n * @description Checks value is a function.\r\n * @param value Candidate value.\r\n * @returns True when value is function.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isFunction(value: unknown): value is (...args: readonly unknown[]) => unknown {\r\n return typeof value === 'function'\r\n },\r\n\r\n /**\r\n * @description Checks value is an array.\r\n * @param value Candidate value.\r\n * @returns True when value is array.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isArray<TValue>(value: unknown): value is TValue[] {\r\n return Array.isArray(value)\r\n },\r\n\r\n /**\r\n * @description Checks value is a Date instance with valid timestamp.\r\n * @param value Candidate value.\r\n * @returns True when value is valid Date.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isDate(value: unknown): value is Date {\r\n if (Object.prototype.toString.call(value) !== DATE_TAG) {\r\n return false\r\n }\r\n\r\n return Number.isFinite((value as Date).getTime())\r\n },\r\n\r\n /**\r\n * @description Checks value is an Error instance.\r\n * @param value Candidate value.\r\n * @returns True when value is Error.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isError(value: unknown): value is Error {\r\n return value instanceof Error\r\n },\r\n\r\n /**\r\n * @description Checks value is a plain object record.\r\n * @param value Candidate value.\r\n * @returns True when value is object record.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isObjectRecord(value: unknown): value is Readonly<Dictionary<unknown>> {\r\n if (!Guards.isDefined(value)) {\r\n return false\r\n }\r\n\r\n return Object.prototype.toString.call(value) === OBJECT_TAG\r\n },\r\n\r\n /**\r\n * @description Checks value is an object (not null).\r\n * @param value Candidate value.\r\n * @returns True when value is object.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isObject(value: unknown): value is object {\r\n return typeof value === 'object' && Guards.isDefined(value)\r\n },\r\n\r\n /**\r\n * @description Checks value is PromiseLike.\r\n * @param value Candidate value.\r\n * @returns True when value has then function.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isPromiseLike<TValue>(value: unknown): value is PromiseLike<TValue> {\r\n if (!Guards.isDefined(value)) {\r\n return false\r\n }\r\n\r\n if (!Guards.isObject(value) && !Guards.isFunction(value)) {\r\n return false\r\n }\r\n\r\n const thenMember = (value as Dictionary<unknown>)['then']\r\n return Guards.isFunction(thenMember)\r\n },\r\n} as const)\r\n","import type { Optional } from '../types/common.types'\r\nimport { Guards } from './guards.utils'\r\n\r\n/**\r\n * @file abort-signal-helper.ts\r\n * @description This file contains the AbortSignalHelper utility class, which provides a method to execute a promise with an optional AbortSignal.\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link www.github.com/Mattia-Carcione/xeno-js\r\n */\r\n\r\n/**\r\n * @class AbortSignalHelper\r\n * @description A utility class that provides a method to execute a promise with an optional AbortSignal.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link www.github.com/Mattia-Carcione/xeno-js\r\n */\r\nexport const AbortSignalHelper = Object.freeze({\r\n /**\r\n * Executes a promise with an optional AbortSignal. If the signal is provided and is aborted, the promise will be rejected with the signal's reason.\r\n * @template T - The type of the promise's resolved value.\r\n * @param promise - The promise to execute.\r\n * @param signal - An optional AbortSignal to cancel the promise.\r\n * @returns A promise that resolves with the original promise's value or rejects if the signal is aborted.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link www.github.com/Mattia-Carcione/xeno-js\r\n */\r\n execute<T>(promise: Promise<T>, signal: Optional<AbortSignal>): Promise<T> {\r\n if (!Guards.isDefined(signal)) return promise\r\n\r\n if (signal.aborted) return Promise.reject(new Error('Operation aborted'))\r\n\r\n return new Promise<T>((resolve, reject) => {\r\n const onAbort = () => {\r\n signal.removeEventListener('abort', onAbort)\r\n reject(new Error('Operation aborted by the client.'))\r\n }\r\n\r\n signal.addEventListener('abort', onAbort)\r\n\r\n promise\r\n .then((res) => {\r\n signal.removeEventListener('abort', onAbort)\r\n resolve(res)\r\n })\r\n .catch((_err) => {\r\n signal.removeEventListener('abort', onAbort)\r\n reject(new Error('Operation aborted by the client.'))\r\n })\r\n })\r\n },\r\n} as const)\r\n","import { Guards } from './guards.utils'\r\n\r\nconst MS_PER_DAY = 86_400_000\r\n\r\n/**\r\n * @description Namespace for timezone-agnostic date utilities.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const DateHelper = Object.freeze({\r\n /**\r\n * @description Converts a Date to an ISO 8601 string.\r\n * @param date Input date.\r\n * @returns ISO 8601 UTC string.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n toISOString(date: Date): string {\r\n return date.toISOString()\r\n },\r\n\r\n /**\r\n * @description Returns a new Date with the given number of days added.\r\n * @param date Base date.\r\n * @param days Number of days to add (negative values subtract).\r\n * @returns New Date instance.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n addDays(date: Date, days: number): Date {\r\n return new Date(date.getTime() + days * MS_PER_DAY)\r\n },\r\n\r\n /**\r\n * @description Checks whether a date has elapsed relative to a reference time.\r\n * @param expiresAt Expiry date.\r\n * @param nowMs Reference epoch in milliseconds (defaults to Date.now()).\r\n * @returns True when expiresAt is in the past.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isExpired(expiresAt: Date, nowMs?: number): boolean {\r\n const now = nowMs ?? Date.now()\r\n return expiresAt.getTime() < now\r\n },\r\n\r\n /**\r\n * @description Checks if one date is after another.\r\n * @param after Date to check if it is after.\r\n * @param before Date to check against.\r\n * @returns True when after is after before.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isAfter(after: Date, before: Date): boolean {\r\n return Guards.isDate(after) && Guards.isDate(before) && after.getTime() > before.getTime()\r\n },\r\n\r\n /**\r\n * @description Checks if a date is in the future relative to now.\r\n * @param date Date to check.\r\n * @returns True when date is in the future.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isFuture(date: Date): boolean {\r\n return Guards.isDate(date) && date.getTime() > Date.now()\r\n },\r\n} as const)\r\n","import type { Optional } from '../types/common.types'\nimport { Guards } from './guards.utils'\n\n/**\n * @file enumerable.utils.ts\n * @description Provides utility functions for array operations, including methods to retrieve the first element of an array with optional filtering.\n */\n\n/**\n * @description A utility object that provides methods for working with arrays, specifically for retrieving the first element of an array with optional filtering.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link www.github.com/Mattia-Carcione/xeno-js\n */\nexport const Enumerable = Object.freeze({\n /**\n * Retrieves the first element of an array that satisfies the provided predicate function. If no predicate is provided, it returns the first element of the array. If the array is empty or no elements satisfy the predicate, an error is thrown.\n * @template T - The type of elements in the array.\n * @param array - The array to search.\n * @param predicate - An optional function to test each element.\n * @returns The first element that satisfies the predicate.\n * @throws {Error} If the array is empty or no elements satisfy the predicate.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link www.github.com/Mattia-Carcione/xeno-js\n */\n first<T>(array: T[], predicate?: (item: T) => boolean): T {\n const item = Guards.isDefined(predicate) ? array.find(predicate) : array[0]\n if (!Guards.isDefined(item)) {\n throw new Error('Sequence contains no elements.')\n }\n return item\n },\n\n /**\n * Retrieves the first element of an array that satisfies the provided predicate function. If no predicate is provided, it returns the first element of the array. If the array is empty or no elements satisfy the predicate, undefined is returned.\n * @template T - The type of elements in the array.\n * @param array - The array to search.\n * @param predicate - An optional function to test each element.\n * @returns The first element that satisfies the predicate or undefined.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link www.github.com/Mattia-Carcione/xeno-js\n */\n firstOrDefault<T>(array: T[], predicate?: (item: T) => boolean): Optional<T> {\n const item = Guards.isDefined(predicate) ? array.find(predicate) : array[0]\n return Guards.isDefined(item) ? item : undefined\n },\n} as const)\n","import type { Guid, Optional } from '../types/common.types'\r\nimport { Guards } from './guards.utils'\r\n\r\n/**\r\n * @fileoverview Utility functions for generating and validating GUIDs (UUID v4).\r\n * This module provides a simple interface for working with GUIDs, including generation and validation.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const GuidHelper = Object.freeze({\r\n /**\r\n * @description Generates a cryptographically-random UUID v4.\r\n * @returns Lowercase UUID v4 string.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n generate(): Guid {\r\n return crypto.randomUUID()\r\n },\r\n\r\n /**\r\n * @description Validates if a value is a valid GUID (UUID v4) and not empty.\r\n * @param value The value to validate.\r\n * @returns True if the value is a valid and non-empty GUID, false otherwise.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isValidGuid(value: Guid): boolean {\r\n const guid = value.toString()\r\n return GuidHelper.isValid(guid) && !GuidHelper.isEmpty(guid)\r\n },\r\n\r\n /**\r\n * @description Validates if a string is a valid UUID v4.\r\n * @param value Candidate string to validate.\r\n * @returns True if the string is a valid UUID v4, false otherwise.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isValid(value: string): value is Guid {\r\n const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i\r\n return uuidRegex.test(value)\r\n },\r\n\r\n /**\r\n * @description Converts a string to a GUID if it's valid.\r\n * @param value The string to convert.\r\n * @returns The GUID if the string is valid, otherwise undefined.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n parse(value: Optional<string>): Optional<Guid> {\r\n if (!Guards.isNullOrEmpty(value) && this.isValid(value) && !this.isEmpty(value)) {\r\n return value\r\n }\r\n return undefined\r\n },\r\n\r\n /**\r\n * @description Checks if a GUID is the empty GUID (all zeros).\r\n * @param value The GUID to check.\r\n * @returns True if the GUID is the empty GUID, false otherwise.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isEmpty(value: string): boolean {\r\n const emptyGuid = '00000000-0000-0000-0000-000000000000'\r\n return value === emptyGuid\r\n },\r\n} as const)\r\n","import { STATUS_CODES } from '../constants/error.constants'\r\nimport type {\r\n Dictionary,\r\n ErrorResponseDto,\r\n HttpHeaders,\r\n IPaginatedResult,\r\n Optional,\r\n ResponseDto,\r\n SuccessResponseDto,\r\n} from '../types/index'\r\nimport { DateHelper } from './date.utils'\r\nimport { Guards } from './guards.utils'\r\n\r\n/**\r\n * @description This module provides utility functions for handling HTTP-related tasks, such as normalizing HTTP headers. It includes a single function, `normalizeHeaders`, which takes an input of unknown type and returns an object with normalized header values. The function ensures that all header values are converted to strings, and if a header value is an array, it joins the elements into a single string separated by commas. This utility is useful for ensuring consistent header formats when working with various HTTP client libraries.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n\r\n/**\r\n * @description A helper object that provides utility functions for HTTP-related tasks. Currently, it includes a method for normalizing HTTP headers, which ensures that all header values are strings and handles cases where header values may be arrays. This helper can be extended in the future to include additional HTTP-related utilities as needed.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const HttpHelper = Object.freeze({\r\n /**\r\n * @description A function that masks the IP address in the given headers object.\r\n * @param ip The IP address to mask.\r\n * @returns The masked IP address.\r\n */\r\n maskIp(ip: Optional<string>): Optional<string> {\r\n if (!Guards.isDefined(ip)) return undefined\r\n\r\n if (ip.includes('.')) {\r\n const parts = ip.split('.')\r\n if (parts.length === 4) {\r\n parts[3] = 'x'\r\n return parts.join('.')\r\n }\r\n }\r\n\r\n if (ip.includes(':')) {\r\n const parts = ip.split(':')\r\n if (parts.length > 0) {\r\n parts[parts.length - 1] = 'x'\r\n return parts.join(':')\r\n }\r\n }\r\n\r\n return ip\r\n },\r\n /**\r\n * @description Normalizes HTTP headers by converting all header values to strings. If a header value is an array, it joins the array elements into a single string separated by commas. This method ensures that the headers are in a consistent format, which can be particularly useful when working with different HTTP client libraries that may represent headers in various ways. If the input headers are not defined or not an object, it returns an empty object.\r\n * @param headers The input headers to be normalized, which can be of any type. The method checks if the headers are defined and are an object before processing them.\r\n * @returns An object containing the normalized headers, where each header value is a string. If the input headers were not valid, it returns an empty object.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n normalizeHeaders(headers: unknown): HttpHeaders {\r\n if (!Guards.isDefined(headers) || !Guards.isObject(headers)) return {}\r\n\r\n const normalized: HttpHeaders = {}\r\n for (const [key, value] of Object.entries(headers as Dictionary)) {\r\n if (!Guards.isDefined(value)) {\r\n continue\r\n }\r\n\r\n normalized[key] = Array.isArray(value)\r\n ? value.map((part) => String(part)).join(',')\r\n : String(value)\r\n }\r\n\r\n return normalized\r\n },\r\n /**\r\n * @description Sanitizes the origin URL by parsing it and extracting the origin part. If the URL is not valid or cannot be parsed or does not contain an origin, it returns undefined.\r\n * @param url The URL to be sanitized.\r\n * @returns The sanitized origin URL or undefined if the URL is not valid or cannot be parsed or does not contain an origin.\r\n *\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n sanitizeOriginUrl(url: Optional<string>): Optional<string> {\r\n if (!Guards.isDefined(url)) return undefined\r\n try {\r\n const parsed = new URL(url)\r\n return parsed.origin\r\n } catch {\r\n return undefined\r\n }\r\n },\r\n /**\r\n * @description Generates a standardized successful HTTP response with the provided data, status code, metadata, and custom headers. The response includes a success flag set to true, the data payload, and any additional metadata. The headers include a default 'Content-Type' of 'application/json' along with any custom headers provided.\r\n * @param data The actual data payload to be included in the successful response. This can be of any type and will be wrapped in a SuccessResponseDto structure.\r\n * @param status The HTTP status code for the response, defaulting to 200 (OK) if not provided. This allows for flexibility in indicating different types of successful responses (e.g., 201 for created, 204 for no content).\r\n * @param meta Optional metadata to be included in the response. This can contain additional information relevant to the response, such as pagination details, rate limit information, or any other contextual data that may be useful for clients consuming the API.\r\n * @param customHeaders Optional custom HTTP headers to be included in the response. This allows for adding any additional headers that may be necessary for specific responses, such as caching directives, custom authentication headers, or other relevant information.\r\n * @returns A ResponseDto object representing the successful HTTP response, containing the status code, success flag, headers, and data payload structured as a SuccessResponseDto.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n success<T>(\r\n data: T | IPaginatedResult<T>,\r\n status = 200,\r\n meta: Dictionary = {},\r\n customHeaders: HttpHeaders = {},\r\n ): ResponseDto<T> {\r\n const successPayload: SuccessResponseDto<T> = {\r\n success: true,\r\n data,\r\n meta,\r\n }\r\n\r\n return {\r\n status,\r\n ok: true,\r\n headers: {\r\n ...customHeaders,\r\n 'Content-Type': ['application/json'],\r\n },\r\n data: successPayload,\r\n }\r\n },\r\n\r\n /**\r\n * @description Generates a standardized error HTTP response with the provided error details, status code, correlation ID, request ID, timestamp, and custom headers. The response includes a success flag set to false, an error object containing the error code, message, and optional details, as well as metadata such as correlation ID and request ID for tracking purposes. The headers include a default 'Content-Type' of 'application/json' along with any custom headers provided.\r\n * @param dto An object containing the error details, including the error code, message, optional details, and optional path. This information is structured as an ErrorResponseDto and provides context about the error that occurred.\r\n * @param status The HTTP status code for the response, defaulting to 500 (Internal Server Error) if not provided. This allows for flexibility in indicating different types of error responses (e.g., 400 for bad request, 404 for not found).\r\n * @param customHeaders Optional custom HTTP headers to be included in the response. This allows for adding any additional headers that may be necessary for specific error responses, such as caching directives, custom authentication headers, or other relevant information.\r\n * @returns A ResponseDto object representing the error HTTP response, containing the status code, success flag, headers, and data payload structured as an ErrorResponseDto.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n error<T>(\r\n dto: ErrorResponseDto,\r\n status: Optional<number> = STATUS_CODES.INTERNAL_SERVER_ERROR,\r\n customHeaders: Optional<HttpHeaders> = undefined,\r\n ): ResponseDto<T> {\r\n const errorPayload: ErrorResponseDto = {\r\n success: false,\r\n error: {\r\n code: dto.error.code,\r\n message: dto.error.message,\r\n details: dto.error.details,\r\n path: dto.error.path,\r\n },\r\n correlationId: dto.correlationId,\r\n requestId: dto.requestId,\r\n spanId: dto.spanId,\r\n timestamp: DateHelper.toISOString(new Date()),\r\n }\r\n\r\n return {\r\n status,\r\n ok: false,\r\n headers: {\r\n 'Content-Type': ['application/json'],\r\n 'X-Correlation-Id': [dto.correlationId],\r\n 'X-Request-Id': [dto.requestId],\r\n 'X-Span-Id': [dto.spanId ?? ''],\r\n 'Cache-Control': ['no-store, no-cache, must-revalidate, proxy-revalidate'],\r\n 'Pragma': ['no-cache'],\r\n 'Expires': ['0'],\r\n ...(customHeaders ?? {}),\r\n },\r\n data: errorPayload,\r\n }\r\n },\r\n} as const)\r\n","import type { Optional } from '../types'\r\nimport { Guards } from './guards.utils'\r\n\r\n/**\r\n * @description Namespace for safe mathematical operations.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const MathHelper = Object.freeze({\r\n /**\r\n * @description Constrains a value within an inclusive min-max range.\r\n * @param value Input value.\r\n * @param min Minimum bound.\r\n * @param max Maximum bound.\r\n * @returns Clamped value.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n clamp(value: number, min: number, max: number): number {\r\n return Math.min(Math.max(value, min), max)\r\n },\r\n\r\n /**\r\n * @description Rounds a number to the specified decimal precision.\r\n * @param value Input value.\r\n * @param decimals Number of decimal places.\r\n * @returns Rounded value.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n roundTo(value: number, decimals: number): number {\r\n const factor = 10 ** decimals\r\n return Math.round(value * factor) / factor\r\n },\r\n\r\n /**\r\n * @description Divides two numbers, returning a safe fallback on zero denominator.\r\n * @param numerator Numerator.\r\n * @param denominator Denominator.\r\n * @param fallback Return value when denominator is zero.\r\n * @returns Division result or fallback.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n safeDivide(numerator: number, denominator: number, fallback = 0): number {\r\n if (denominator === 0) return fallback\r\n return numerator / denominator\r\n },\r\n\r\n /**\r\n * @description Returns the percentage of part over total (0–100 scale).\r\n * @param part Part value.\r\n * @param total Total value.\r\n * @returns Percentage or 0 when total is zero.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n toPercentage(part: number, total: number): number {\r\n if (total === 0) return 0\r\n return (part / total) * 100\r\n },\r\n /**\r\n * @description Converts a value to a number, returning a fallback for non-numeric inputs.\r\n * @param value Input value.\r\n * @param fallback Fallback value for non-numeric inputs.\r\n * @returns Numeric value or fallback.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n toNumber(value: Optional<unknown>, fallback = 0): number {\r\n if (!Guards.isDefined(value) || !Guards.isNumber(value)) return fallback\r\n const num = Number(value)\r\n return isNaN(num) ? fallback : num\r\n },\r\n} as const)\r\n","/**\r\n * @description Fornisce utilità per la gestione avanzata di Promise, ritardi asincroni e concorrenza.\r\n * Astrae le logiche di timing per renderle facilmente testabili e riutilizzabili.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const PromiseHelper = Object.freeze({\r\n /**\r\n * @description Sospende l'esecuzione asincrona per un numero esatto di millisecondi.\r\n * @param ms I millisecondi di attesa.\r\n * @returns Una Promise che si risolve al termine del tempo.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n delay(ms: number): Promise<void> {\r\n return new Promise((resolve) => setTimeout(resolve, ms))\r\n },\r\n\r\n /**\r\n * @description Introduce un ritardo asincrono composto da un tempo base più una variazione casuale.\r\n * Fondamentale per mitigare il \"Thundering Herd problem\" (effetto gregge) distribuendo\r\n * nel tempo i retry simultanei di più client.\r\n * * @param baseDelayMs Il ritardo minimo garantito.\r\n * @param maxJitterMs La variazione massima casuale aggiuntiva.\r\n * @returns Una Promise che si risolve al termine del calcolo.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n delayWithJitter(baseDelayMs: number, maxJitterMs: number): Promise<void> {\r\n const jitter = Math.floor(Math.random() * maxJitterMs)\r\n return new Promise((resolve) => setTimeout(resolve, baseDelayMs + jitter))\r\n },\r\n} as const)\r\n","import type { Optional } from '../types/index'\r\nimport { Guards } from './guards.utils'\r\n\r\nconst start = String.fromCharCode(0)\r\nconst end = String.fromCharCode(31)\r\nconst del = String.fromCharCode(127)\r\n\r\nconst CONTROL_CHARS_REGEX = new RegExp(`[\\\\r\\\\n\\\\t${start}-${end}${del}]`, 'g')\r\nconst DANGEROUS_PROTOCOLS_REGEX = /^(javascript|data|vbscript):/i\r\n\r\n/**\r\n * @description Centralized security utility for data and context sanitization.\r\n * Enforces OWASP guidelines preventing Log Injection (CWE-117), CRLF injection,\r\n * and URI protocol manipulation across all application layers.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const SanitizeHelper = Object.freeze({\r\n /**\r\n * @description Removes carriage returns, line feeds, null bytes, and non-printable control characters.\r\n * Mitigates Log Forging and Log Injection attacks (CWE-117).\r\n * @param value The candidate string to sanitize.\r\n * @param maxLength Maximum allowable length after sanitization. Defaults to 256.\r\n * @returns Sanitized string or undefined if empty/non-string.\r\n */\r\n stripControlChars(value: Optional<string>, maxLength = 256): Optional<string> {\r\n if (Guards.isNullOrEmpty(value)) return undefined\r\n const clean = value.replace(CONTROL_CHARS_REGEX, '').trim()\r\n if (Guards.isNullOrEmpty(clean)) return undefined\r\n return clean.slice(0, maxLength)\r\n },\r\n\r\n /**\r\n * @description Sanitizes navigation paths and URLs, removing control characters\r\n * and preventing execution of dangerous pseudo-protocols (e.g. javascript:, data:).\r\n * @param path The path string to sanitize.\r\n * @param maxLength Maximum length of the path. Defaults to 512.\r\n * @returns Sanitized path or '/' fallback for unsafe inputs.\r\n */\r\n sanitizePath(path: Optional<string>, maxLength = 512): Optional<string> {\r\n if (Guards.isNullOrEmpty(path)) return undefined\r\n const clean = path.replace(CONTROL_CHARS_REGEX, '').trim()\r\n if (Guards.isNullOrEmpty(clean) || DANGEROUS_PROTOCOLS_REGEX.test(clean)) {\r\n return '/'\r\n }\r\n return clean.slice(0, maxLength)\r\n },\r\n\r\n /**\r\n * @description Sanitizes an array of strings (e.g. roles, permissions, scopes).\r\n * Strips control characters, filters out empty entries, and limits collection size.\r\n * @param items Array of strings to sanitize.\r\n * @param maxItemLength Maximum allowable character length per item. Defaults to 64.\r\n * @param maxItems Maximum total number of elements kept. Defaults to 50.\r\n * @returns Immutable array of sanitized strings.\r\n */\r\n sanitizeStringArray(\r\n items: Optional<string[]>,\r\n maxItemLength = 64,\r\n maxItems = 50,\r\n ): Optional<string[]> {\r\n if (Guards.isNullOrEmpty(items)) return undefined\r\n const sanitized = items\r\n .slice(0, maxItems)\r\n .map((item) => SanitizeHelper.stripControlChars(item, maxItemLength))\r\n .filter((item): item is string => Guards.isDefined(item))\r\n\r\n return sanitized\r\n },\r\n} as const)\r\n","import type { Dictionary, Optional } from '../types/index'\r\nimport { Guards } from './guards.utils'\r\n\r\n/**\r\n * @description Namespace for string manipulation utilities.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const StringHelper = Object.freeze({\r\n /**\r\n * @description Safely converts a value to a JSON string, falling back to String() on failure.\r\n * @param value The value to stringify.\r\n * @returns A JSON string representation of the value, or a fallback string if serialization fails.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n safeStringify<T>(value: T): string {\r\n try {\r\n return JSON.stringify(value)\r\n } catch {\r\n return String(value)\r\n }\r\n },\r\n\r\n /**\r\n * @description Safely parses a JSON string, returning a fallback value on failure.\r\n * @param input The JSON string to parse.\r\n * @param fallback Optional fallback value to return if parsing fails.\r\n * @returns The parsed value, or the fallback value if parsing fails.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n safeParse<T = unknown>(input: string, fallback: Optional<T> = undefined): T | Optional<string> {\r\n try {\r\n return JSON.parse(input) as T\r\n } catch {\r\n return fallback ?? input\r\n }\r\n },\r\n\r\n /**\r\n * @description Converts a string to camelCase.\r\n * @param input Input string (supports snake_case, kebab-case, or space-separated).\r\n * @returns camelCase string.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n camelCase(input: string): string {\r\n const segments = input.split(/[-_\\s]+/)\r\n const [first, ...rest] = segments\r\n const head = Guards.isDefined(first) ? first.toLowerCase() : ''\r\n return head + rest.map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1)).join('')\r\n },\r\n\r\n /**\r\n * @description Interpolates {{key}} placeholders in a template string.\r\n * @param template Template string with {{key}} tokens.\r\n * @param vars Key-value substitution map.\r\n * @returns Interpolated string with resolved placeholders.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n interpolate(template: string, vars: Readonly<Dictionary<string | number>>): string {\r\n return template.replace(/\\{\\{(\\w+)\\}\\}/g, (_match, key: string) => {\r\n const value = vars[key]\r\n return Guards.isDefined(value) ? String(value) : `{{${key}}}`\r\n })\r\n },\r\n\r\n /**\r\n * @description Truncates a string to maxLength, appending a suffix when truncated.\r\n * @param input Input string.\r\n * @param maxLength Maximum character length including the suffix.\r\n * @param suffix Appended suffix on truncation.\r\n * @returns Truncated string.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n truncate(input: string, maxLength: number, suffix = '…'): string {\r\n if (input.length <= maxLength) return input\r\n const cutAt = Math.max(0, maxLength - suffix.length)\r\n return input.slice(0, cutAt) + suffix\r\n },\r\n\r\n /**\r\n * @description Generates a reference code with a prefix, random alphanumeric part, and year.\r\n * @param prefix Custom prefix for the reference code (e.g., \"TRV\" for travel).\r\n * @returns Formatted reference code string.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n generateReferenceCode(prefix: string): string {\r\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'\r\n let randomPart = ''\r\n for (let i = 0; i < 6; i++) {\r\n randomPart += chars.charAt(Math.floor(Math.random() * chars.length))\r\n }\r\n const year = new Date().getFullYear()\r\n return `${prefix}-${randomPart}-${year}` // Es: TRV-XJ82L9-2026\r\n },\r\n\r\n /**\r\n * @description Extracts a single string value from a header that may be a string or an array of strings.\r\n * @param value The header value, which can be a string or an array of strings.\r\n * @returns The first string value if it's an array, the string itself if it's a string, or undefined if it's empty or not defined.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n getSingleValue(\r\n value: Optional<string | string[]>,\r\n separator?: Optional<string>,\r\n ): Optional<string> {\r\n if (!Guards.isDefined(value)) return value\r\n\r\n if (Guards.isArray(value)) {\r\n if (Guards.isNullOrEmpty(value)) {\r\n return undefined\r\n }\r\n if (Guards.isDefined(separator))\r\n return StringHelper.getSingleValueWithSplit(value[0], separator)\r\n return value[0]\r\n }\r\n if (Guards.isDefined(separator)) return StringHelper.getSingleValueWithSplit(value, separator)\r\n return value\r\n },\r\n\r\n getSingleValueWithSplit(value: string, separator: string): string {\r\n if (value.includes(separator)) return value.split(separator)[0].trim()\r\n return value\r\n },\r\n} as const)\r\n","import type { ICommand } from '@/domain'\nimport type { RequestType } from '@/shared'\nimport { REQUEST_TYPE } from '@/shared'\n\n/**\n * @description Base class for all commands.\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\nexport abstract class Command<TResponse = unknown> implements ICommand<TResponse> {\n public readonly type: RequestType = REQUEST_TYPE.COMMAND\n\n constructor(readonly intent: string) {}\n}\n","import type { IQuery } from '@/domain'\nimport type { ICacheableOptions, RequestType } from '@/shared'\nimport { REQUEST_TYPE } from '@/shared'\n\n/**\n * @description Base class for all queries.\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\nexport abstract class Query<TResponse = unknown> implements IQuery<TResponse> {\n public readonly type: RequestType = REQUEST_TYPE.QUERY\n\n constructor(\n readonly intent: string,\n readonly cacheOptions: ICacheableOptions,\n ) {}\n}\n","import type { LoggerContext, RequestContext } from '@/domain'\r\nimport { HttpHelper, type Optional } from '@/shared'\r\n\r\n/**\r\n * @description LoggerUtils provides utility functions for working with LoggerContext objects.\r\n */\r\nexport const LoggerUtils = Object.freeze({\r\n /**\r\n * @description toSafeContext converts a RequestContext object to a LoggerContext object, ensuring that only the necessary fields are included.\r\n * @param ctx The RequestContext object to convert.\r\n * @returns The converted LoggerContext object.\r\n */\r\n toSafeContext(ctx: Optional<RequestContext>): LoggerContext {\r\n return {\r\n identity: {\r\n userId: ctx?.identity?.userId,\r\n tenantId: ctx?.identity?.tenantId,\r\n },\r\n network: {\r\n requestId: ctx?.network?.requestId,\r\n path: ctx?.network?.path,\r\n origin: ctx?.network?.origin,\r\n clientIp: HttpHelper.maskIp(ctx?.network?.clientIp),\r\n },\r\n tracing: {\r\n correlationId: ctx?.tracing?.correlationId,\r\n spanId: ctx?.tracing?.spanId,\r\n startTime: ctx?.tracing?.startTime,\r\n parentSpanId: ctx?.tracing.parentSpanId,\r\n },\r\n messaging: ctx?.messaging,\r\n }\r\n },\r\n} as const)\r\n","import type { IContextAccessor, ILogger, ILoggerClient, RequestContext } from '@/domain'\nimport type { LogLevel, Optional } from '@/shared'\nimport { LOG_LEVEL, LOG_LEVEL_NAMES } from '@/shared'\n\nimport { LoggerUtils } from './utils'\n\n/**\n * @description Concrete implementation of the ILogger interface that serves as a central logging service within the application. This class is designed to broadcast log messages to multiple logging clients (implementations of ILoggerClient) that are injected via the constructor. The BaseLogger class provides methods for logging messages at different levels (info, warn, debug, error) and ensures that only messages that meet or exceed the specified minimum log level are forwarded to the registered logging clients. This design allows for flexibility in logging, enabling the use of various logging providers (e.g., Sentry, Pino) without coupling the application code to specific logging frameworks.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\nexport class BaseLogger implements ILogger {\n // ─── Private Fields ─────────────────────────────────────────────────────────\n private readonly _minLevel: LogLevel\n private readonly _loggers: ILoggerClient[]\n\n /**\n * @description Constructs a new instance of the BaseLogger class, which takes an array of ILoggerClient instances and an optional minimum log level. The ILoggerClient instances represent the various logging providers that will receive log messages from this logger. The minimum log level determines the threshold for logging messages, where messages with a log level below the specified minimum will not be forwarded to the logging clients. This allows for efficient logging by filtering out less critical log messages based on the configured log level.\n * @param _requestContext The request context that provides contextual information for log messages, such as request-specific data or metadata.\n * @param config The minimum log level for this logger instance. Only messages with a log level equal to or higher than this level will be processed and forwarded to the logging clients.\n * @param loggers An array of ILoggerClient instances that will receive log messages from this logger. Each ILoggerClient represents a different logging provider or destination (e.g., console, file, external service).\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n constructor(\n private readonly _requestContext: IContextAccessor<RequestContext>,\n config: LogLevel,\n loggers: ILoggerClient[],\n ) {\n this._minLevel = config\n this._loggers = loggers\n }\n\n public info(message: string): void {\n this.broadcast(LOG_LEVEL.INFO, message)\n }\n\n public warn(message: string): void {\n this.broadcast(LOG_LEVEL.WARN, message)\n }\n\n public debug(message: string): void {\n this.broadcast(LOG_LEVEL.DEBUG, message)\n }\n\n public error(message: string, error: unknown): void {\n this.broadcast(LOG_LEVEL.ERROR, message, error)\n }\n\n /**\n * @description Private method to broadcast log messages to all registered ILoggerClient instances. This method checks if the log level of the message meets or exceeds the configured minimum log level before forwarding the message to the logging clients. It iterates through the array of ILoggerClient instances and calls their track method with the appropriate parameters (log level, message, context, and error if applicable). This design allows for efficient logging by ensuring that only relevant log messages are processed and forwarded to the logging clients based on the configured log level.\n * @param level The log level of the message.\n * @param message The log message.\n * @param context Optional context information to include with the log message.\n * @param error Optional error object to include with the log message.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link https://github.com/xeno-js/xeno-js\n */\n private broadcast(level: LogLevel, message: string, error: Optional<unknown> = undefined): void {\n if (level < this._minLevel) return\n\n const logMessage = `[${LOG_LEVEL_NAMES[level]}] ${message}`\n const context = this._requestContext.getContext()\n const safeContext = LoggerUtils.toSafeContext(context)\n for (const logger of this._loggers) {\n logger.track(level, logMessage, safeContext, error)\n }\n }\n}\n","import type { Guid } from '@/shared'\r\nimport { Guards, GuidHelper } from '@/shared'\r\n\r\n/**\r\n * A class representing a unique identifier (UUID v4) for entities in the domain.\r\n * This class encapsulates the generation and representation of unique identifiers.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport class UniqueId {\r\n /**\r\n * Private constructor to prevent direct instantiation. Use the static method `create` to generate a new unique identifier.\r\n * @param _value The string representation of the unique identifier (UUID v4).\r\n * @returns A new instance of UniqueId with a generated UUID v4.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n private constructor(private readonly _value: Guid) {\r\n Object.freeze(this)\r\n }\r\n\r\n /**\r\n * Static factory method to create a new UniqueId instance with a generated UUID v4.\r\n * @returns A new instance of UniqueId with a generated UUID v4.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public static create(id?: string): UniqueId {\r\n const uniqueId =\r\n !Guards.isNullOrEmpty(id) && GuidHelper.isValid(id) ? id : GuidHelper.generate()\r\n return new UniqueId(uniqueId)\r\n }\r\n\r\n /**\r\n * Returns the string representation of the unique identifier.\r\n * @returns The string representation of the unique identifier (UUID v4).\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public toString(): string {\r\n return this._value.toString()\r\n }\r\n\r\n /**\r\n * Returns the underlying GUID value of the UniqueId instance.\r\n * @returns The GUID value of the UniqueId instance.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public getValue(): Guid {\r\n return this._value\r\n }\r\n\r\n /**\r\n * Compares this UniqueId with another for equality based on their string values.\r\n * @param other The other UniqueId to compare with.\r\n * @returns True if both UniqueIds have the same string value, false otherwise.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public equals(other: UniqueId): boolean {\r\n if (!(other instanceof UniqueId)) {\r\n return false\r\n }\r\n return this._value === other.getValue()\r\n }\r\n}\r\n","import type { Optional } from '@/shared'\r\nimport { Guards, GuidHelper } from '@/shared'\r\n\r\nimport { UniqueId } from '../unique_id/unique-id'\r\nimport type { IEntity } from './ientity.contracts'\r\n/**\r\n * A base class representing a generic entity in the domain. An entity is an object that has a unique identity and is defined by its properties.\r\n *\r\n * @template T - The type of the properties of the entity.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport abstract class Entity<T> implements IEntity<T> {\r\n public readonly id: UniqueId\r\n\r\n /**\r\n * The properties of the entity. This is a private property that holds the state of the entity. It should be accessed and modified through methods defined in the concrete entity classes to ensure encapsulation and maintain invariants.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n private readonly props: T\r\n\r\n /**\r\n * Protected constructor to prevent direct instantiation. Concrete entity classes should extend this base class and call this constructor with the appropriate properties and an optional unique identifier.\r\n *\r\n * @param props - The properties of the entity.\r\n * @param id - An optional unique identifier for the entity. If not provided, a new UniqueId will be generated.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n protected constructor(props: T, id: Optional<string> = undefined) {\r\n if (Guards.isNullOrEmpty(id) || GuidHelper.isValid(id)) {\r\n this.id = UniqueId.create(id)\r\n } else {\r\n throw new Error(`Invalid UniqueId provided: ${id}.`)\r\n }\r\n this.props = Object.freeze({ ...props })\r\n Object.freeze(this)\r\n }\r\n\r\n public getProps(): T {\r\n return structuredClone(this.props)\r\n }\r\n\r\n public getId(): UniqueId {\r\n return this.id\r\n }\r\n}\r\n","import type { Maybe, Optional } from '@/shared'\r\nimport { ERROR_CODE_MESSAGES, ERROR_CODES, Guards, STATUS_CODES } from '@/shared'\r\n/**\r\n * A class representing an application error, which extends the built-in Error class.\r\n * It includes additional properties such as an error code and an HTTP status code.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\ninterface ErrorPayload {\r\n /** The error message describing the error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n message: string\r\n /** The error code representing the type of error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n code: string\r\n /** The HTTP status code associated with the error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n status: number\r\n /** The name of the error, typically the class name.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n name: string\r\n /** An optional property to hold the original error or any additional context.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n cause: Optional<unknown>\r\n /** A Dictionary to hold any additional context or information related to the error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n [key: string]: unknown\r\n}\r\n\r\n/**\r\n * A class representing an application error, which extends the built-in Error class.\r\n * It includes additional properties such as an error code and an HTTP status code.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport class AppError extends Error {\r\n /**\r\n * The error code representing the type of error.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public readonly code: string\r\n /**\r\n * The HTTP status code associated with the error.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public readonly status: number\r\n\r\n /**\r\n * A Dictionary to hold any additional context or information related to the error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n readonly [key: string]: unknown\r\n\r\n /**\r\n * Private constructor to prevent direct instantiation. Use the static methods `create` and `throw` to create instances.\r\n *\r\n * @param payload - The payload containing error details.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n private constructor(payload: ErrorPayload) {\r\n super(payload.message)\r\n this.code = payload.code\r\n this.status = payload.status\r\n Object.assign(this, payload)\r\n }\r\n\r\n /**\r\n * Creates an AppError instance with the given error payload.\r\n *\r\n * @param payload - The payload containing error details.\r\n * @returns An AppError instance representing the error.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public static create(payload: ErrorPayload): AppError {\r\n return new AppError(payload)\r\n }\r\n\r\n /**\r\n * Creates an AppError instance and throws it immediately.\r\n * @param payload - The payload containing error details.\r\n * @throws An AppError instance representing the error.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public static throw(payload: ErrorPayload): never {\r\n throw new AppError(payload)\r\n }\r\n\r\n /**\r\n * Creates an AppError instance representing an aborted request.\r\n * @param name - The name of the error, typically the class name or context where the error occurred.\r\n * @returns An AppError instance representing the aborted request error.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public static aborted(name: string): AppError {\r\n return new AppError({\r\n code: ERROR_CODES.ABORTED,\r\n message: ERROR_CODE_MESSAGES[ERROR_CODES.ABORTED],\r\n status: STATUS_CODES.ABORTED,\r\n name,\r\n cause: new Error('The client closed the connection before the server finished responding.'),\r\n })\r\n }\r\n\r\n /**\r\n * Utility method to check if an AbortSignal has been triggered and throw an AppError if it has.\r\n * @param signal - The AbortSignal to check for abortion.\r\n * @param name - The name of the error, typically the class name or context where the error occurred.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public static throwIfAborted(signal: Maybe<AbortSignal>, name: string): void {\r\n if (Guards.isDefined(signal) && signal.aborted) {\r\n throw AppError.aborted(name)\r\n }\r\n }\r\n\r\n /** @description Creates an AppError instance representing an unauthorized access error. This method is used to generate a standardized error response when a user attempts to access a resource or perform an action without the necessary authentication or authorization.\r\n * @param name The name of the error, typically the class name or context where the error occurred. This helps in identifying the source of the error in logs and error reports.\r\n * @param message A custom message describing the reason for the unauthorized access. This message is included in the AppError's cause for detailed error reporting.\r\n * @returns An AppError instance representing the unauthorized access error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n public static unauthorized(name: string, message: string): AppError {\r\n return AppError.create({\r\n code: ERROR_CODES.UNAUTHORIZED,\r\n message: ERROR_CODE_MESSAGES[ERROR_CODES.UNAUTHORIZED],\r\n status: STATUS_CODES.UNAUTHORIZED,\r\n name,\r\n cause: new Error(message),\r\n header: { 'WWW-Authenticate': ['Bearer realm=\"api\"'] },\r\n })\r\n }\r\n\r\n public static notSupported(name: string, message: string): AppError {\r\n return AppError.create({\r\n code: ERROR_CODES.NOT_ALLOWED,\r\n message: ERROR_CODE_MESSAGES[ERROR_CODES.NOT_ALLOWED],\r\n status: STATUS_CODES.NOT_ALLOWED,\r\n name,\r\n cause: new Error(message),\r\n })\r\n }\r\n\r\n /** @description Creates an AppError instance representing a forbidden access error. This method is used to generate a standardized error response when a user attempts to access a resource or perform an action that they are not authorized to access, even if they are authenticated.\r\n * @param name The name of the error, typically the class name or context where the error occurred. This helps in identifying the source of the error in logs and error reports.\r\n * @param message A custom message describing the reason for the forbidden access. This message is included in the AppError's cause for detailed error reporting.\r\n * @returns An AppError instance representing the forbidden access error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n public static forbidden(name: string, message: string): AppError {\r\n return AppError.create({\r\n code: ERROR_CODES.FORBIDDEN,\r\n message: ERROR_CODE_MESSAGES[ERROR_CODES.FORBIDDEN],\r\n status: STATUS_CODES.FORBIDDEN,\r\n name,\r\n cause: new Error(message),\r\n })\r\n }\r\n\r\n /** @description Creates an AppError instance representing a bad request error. This method is used to generate a standardized error response when a request made by the client is invalid or cannot be processed due to client-side issues, such as validation errors or malformed requests.\r\n * @param name The name of the error, typically the class name or context where the error occurred. This helps in identifying the source of the error in logs and error reports.\r\n * @param message A custom message describing the reason for the bad request. This message is included in the AppError's cause for detailed error reporting.\r\n * @returns An AppError instance representing the bad request error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n public static badRequest(name: string, message: string): AppError {\r\n return AppError.create({\r\n code: ERROR_CODES.BAD_REQUEST,\r\n message: ERROR_CODE_MESSAGES[ERROR_CODES.BAD_REQUEST],\r\n status: STATUS_CODES.BAD_REQUEST,\r\n name,\r\n cause: new Error(message),\r\n })\r\n }\r\n\r\n /** @description Creates an AppError instance representing a validation error. This method is used to generate a standardized error response when one or more input fields fail invariant or schema validation, indicating that the request cannot be processed due to invalid data.\r\n * @param name The name of the error, typically the class name or context where the error occurred. This helps in identifying the source of the error in logs and error reports.\r\n * @param message A custom message describing the reason for the validation failure. This message is included in the AppError's cause for detailed error reporting.\r\n * @returns An AppError instance representing the validation error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n public static validationError(name: string, message: string): AppError {\r\n return AppError.create({\r\n code: ERROR_CODES.VALIDATION_FAILED,\r\n message: ERROR_CODE_MESSAGES[ERROR_CODES.VALIDATION_FAILED],\r\n status: STATUS_CODES.BAD_REQUEST,\r\n name,\r\n cause: new Error(message),\r\n })\r\n }\r\n\r\n /** @description Creates an AppError instance representing a conflict error. This method is used to generate a standardized error response when a request conflicts with the current state of the resource, such as when attempting to create a resource that already exists or update a resource that has been modified by another process.\r\n * @param name The name of the error, typically the class name or context where the error occurred. This helps in identifying the source of the error in logs and error reports.\r\n * @param message A custom message describing the reason for the conflict. This message is included in the AppError's cause for detailed error reporting.\r\n * @returns An AppError instance representing the conflict error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n public static conflict(name: string, message: string): AppError {\r\n return AppError.create({\r\n code: ERROR_CODES.CONFLICT,\r\n message: ERROR_CODE_MESSAGES[ERROR_CODES.CONFLICT],\r\n status: STATUS_CODES.CONFLICT,\r\n name,\r\n cause: new Error(message),\r\n })\r\n }\r\n\r\n /** @description Creates an AppError instance representing a not found error. This method is used to generate a standardized error response when a requested resource does not exist, indicating that the client attempted to access a resource that could not be found on the server.\r\n * @param name The name of the error, typically the class name or context where the error occurred. This helps in identifying the source of the error in logs and error reports.\r\n * @param message A custom message describing the reason for the not found error. This message is included in the AppError's cause for detailed error reporting.\r\n * @returns An AppError instance representing the not found error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n public static notFound(name: string, message: string): AppError {\r\n return AppError.create({\r\n code: ERROR_CODES.NOT_FOUND,\r\n message: ERROR_CODE_MESSAGES[ERROR_CODES.NOT_FOUND],\r\n status: STATUS_CODES.NOT_FOUND,\r\n name,\r\n cause: new Error(message),\r\n })\r\n }\r\n\r\n /** @description Creates an AppError instance representing a Authentication failed. This method is used to generate a standardized error response when an auth requested produce an error..\r\n * @param name The name of the error, typically the class name or context where the error occurred. This helps in identifying the source of the error in logs and error reports.\r\n * @param message A custom message describing the reason for the Authentication failed. This message is included in the AppError's cause for detailed error reporting.\r\n * @returns An AppError instance representing the Authentication failed.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n public static authFailed(name: string, message: string): AppError {\r\n return AppError.create({\r\n code: ERROR_CODES.AUTHENTICATION_FAILED,\r\n message: ERROR_CODE_MESSAGES[ERROR_CODES.AUTHENTICATION_FAILED],\r\n name,\r\n status: STATUS_CODES.UNAUTHORIZED,\r\n cause: new Error(message),\r\n })\r\n }\r\n}\r\n","import type { Optional } from '@/shared'\r\n\r\n/**\r\n * A class representing the result of an operation, which can either be a success or a failure.\r\n * It encapsulates the value of a successful operation or the error of a failed operation.\r\n *\r\n * @template TValue - The type of the value in case of a successful operation.\r\n * @template TError - The type of the error in case of a failed operation (default is never).\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport class Result<TValue, TError = never> {\r\n /**\r\n * Indicates whether the operation was successful or not.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n private readonly _isSuccess: boolean\r\n /**\r\n * The error of the operation in case it failed.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n private readonly _error: Optional<TError>\r\n /**\r\n * The value of the operation in case it succeeded.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n private readonly _value: Optional<TValue>\r\n\r\n /**\r\n * Private constructor to prevent direct instantiation. Use the static methods `ok` and `fail` to create instances.\r\n *\r\n * @param isSuccess - A boolean indicating whether the operation was successful.\r\n * @param error - The error of the operation in case it failed (optional).\r\n * @param value - The value of the operation in case it succeeded (optional).\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n private constructor(isSuccess: boolean, error: Optional<TError>, value: Optional<TValue>) {\r\n this._isSuccess = isSuccess\r\n this._error = error\r\n this._value = value\r\n }\r\n\r\n /**\r\n * Creates a successful result with the given value.\r\n *\r\n * @param value - The value of the successful operation.\r\n * @returns A Result instance representing a successful operation.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public static ok<U>(value?: U): Result<U> {\r\n return new Result<U>(true, undefined, value)\r\n }\r\n\r\n /**\r\n * Creates a failed result with the given error.\r\n *\r\n * @param error - The error of the failed operation.\r\n * @returns A Result instance representing a failed operation.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public static fail<U, V = never>(error: V): Result<U, V> {\r\n return new Result<U, V>(false, error, undefined)\r\n }\r\n\r\n /**\r\n * Checks if the result is a success.\r\n *\r\n * @returns True if the result is a success, false otherwise.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public isOk(): boolean {\r\n return this._isSuccess\r\n }\r\n\r\n /**\r\n * Gets the value of the result or throws an error if the result is a failure.\r\n *\r\n * @returns The value of the result.\r\n * @throws An error if the result is a failure.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public getValueOrThrow(): Optional<TValue> {\r\n if (!this._isSuccess) {\r\n throw new Error('Cannot get the value of a failed result.')\r\n }\r\n return this._value\r\n }\r\n\r\n /**\r\n * Gets the error of the result or throws an error if the result is a success.\r\n *\r\n * @returns The error of the result.\r\n * @throws An error if the result is a success.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public getErrorOrThrow(): TError {\r\n if (this._isSuccess) {\r\n throw new Error('Cannot get the error of a successful result.')\r\n }\r\n return this._error as TError\r\n }\r\n}\r\n","import type { Optional } from '@/shared'\r\nimport { Guards, StringHelper } from '@/shared'\r\n\r\nimport type { IValueObject } from './ivalue-object.contracts'\r\n\r\n/**\r\n * The ValueObject class is an abstract implementation of the IValueObject interface, providing a base class for creating value objects in the domain. A value object is an immutable type that represents a concept or measurement in the domain, and its equality is based on its properties rather than its identity. The ValueObject class includes a constructor that initializes the properties of the value object and an equals method that compares two value objects for equality based on their properties.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport abstract class ValueObject<T extends object> implements IValueObject<T> {\r\n /** @description The properties of the value object, which are immutable and define the value represented by the value object.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n protected readonly _props: T\r\n\r\n protected constructor(props: T) {\r\n this._props = Object.freeze({ ...props })\r\n Object.freeze(this)\r\n }\r\n\r\n public equals(vo: Optional<IValueObject<T>> = undefined): boolean {\r\n if (Guards.isNullOrEmpty(vo) || Guards.isNullOrEmpty(vo.getValue())) {\r\n return false\r\n }\r\n\r\n return StringHelper.safeStringify(this._props) === StringHelper.safeStringify(vo.getValue())\r\n }\r\n\r\n public getValue(): T {\r\n return { ...this._props }\r\n }\r\n\r\n public toString(): string {\r\n return StringHelper.safeStringify(this._props)\r\n }\r\n}\r\n","import type { IStorage } from '@/domain'\nimport type { CookieOptions } from '@/shared'\nimport { Guards } from '@/shared'\n\nexport const createCookieStorage = (opts: CookieOptions): IStorage => ({\n getItem: (key: string): string | null => {\n if (!Guards.isDefined(document)) return null\n const match = new RegExp(`(^| )${encodeURIComponent(key)}=([^;]+)`).exec(document.cookie)\n return Guards.isDefined(match) ? decodeURIComponent(match[2]) : null\n },\n setItem: (key: string, value: string): void => {\n if (!Guards.isDefined(document)) return\n let cookieSuffix = ''\n if (Guards.isDefined(opts.path)) cookieSuffix += `; path=${opts.path}`\n if (Guards.isDefined(opts.maxAge)) cookieSuffix += `; max-age=${opts.maxAge}`\n if (Guards.isDefined(opts.domain)) cookieSuffix += `; domain=${opts.domain}`\n if (Guards.isDefined(opts.secure)) cookieSuffix += `; Secure`\n if (Guards.isDefined(opts.sameSite)) cookieSuffix += `; SameSite=${opts.sameSite}`\n document.cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)}${cookieSuffix}`\n },\n removeItem: (key: string): void => {\n if (!Guards.isDefined(document)) return\n document.cookie = `${encodeURIComponent(key)}=; path=${opts.path ?? '/'}; expires=Thu, 01 Jan 1970 00:00:00 GMT`\n },\n})\n","import type { IStorage } from '@/domain'\n\n// infrastructure/auth/memory-storage.adapter.ts\nexport const createMemoryStorage = (): IStorage => {\n const store = new Map<string, string>()\n return {\n getItem: (key: string): string | null => store.get(key) ?? null,\n setItem: (key: string, value: string): void => {\n store.set(key, value)\n },\n removeItem: (key: string): void => {\n store.delete(key)\n },\n }\n}\n","import type { IStorage } from '@/domain'\nimport type { CookieOptions, Optional } from '@/shared'\nimport { Guards } from '@/shared'\n\nimport { createCookieStorage } from './cookie.storage'\nimport { createMemoryStorage } from './memory.storage'\n\nexport const StorageHelper = Object.freeze({\n create(opts: {\n type: Optional<'local' | 'session' | 'memory' | 'cookie'>\n storage: Optional<IStorage>\n cookieOpts: Optional<CookieOptions>\n }): Optional<IStorage> {\n switch (opts.type) {\n case 'memory':\n return createMemoryStorage()\n case 'cookie':\n if (!Guards.isDefined(opts.cookieOpts)) throw new Error('At least ')\n return createCookieStorage(opts.cookieOpts)\n case 'session':\n return sessionStorage\n case 'local':\n return localStorage\n\n default:\n return opts.storage\n }\n },\n} as const)\n","import type {\r\n Provider,\r\n Session as SupabaseSession,\r\n SupabaseClient,\r\n User,\r\n} from '@supabase/supabase-js'\r\n\r\nimport type { IAuthService, IBaseAuthService, IBaseMapper, ResultType } from '@/domain'\r\nimport { AppError, Result } from '@/domain'\r\nimport type { AuthClaims, Maybe, Optional, Session } from '@/shared'\r\nimport { Guards } from '@/shared'\r\n\r\n/**\r\n * @description The SupabaseAuthService class is responsible for handling authentication-related operations using a SupabaseClient instance. It implements the IAuthService interface, providing methods to check if a user is authenticated and to retrieve authentication claims from a given token. The authenticate method interacts with the Supabase authentication API to fetch user information based on the provided token, while the isAuthenticated method checks if there is an active session. The class also includes error handling to create standardized authentication errors when necessary.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport class SupabaseAuthService implements IBaseAuthService, IAuthService {\r\n constructor(\r\n private readonly _supabase: SupabaseClient,\r\n private readonly _mapper: IBaseMapper<User, AuthClaims>,\r\n private readonly _sessionMapper: IBaseMapper<SupabaseSession, Session>,\r\n private readonly _opts: { redirectTo: Optional<string> },\r\n ) {}\r\n\r\n public async authenticate(token: string): Promise<ResultType<AuthClaims>> {\r\n const { data, error } = await this._supabase.auth.getUser(token)\r\n\r\n if (Guards.isDefined(error) || !Guards.isDefined(data.user)) {\r\n return Result.fail(\r\n AppError.authFailed('SupabaseAuthenticationService', error?.message ?? 'Unknown error'),\r\n )\r\n }\r\n\r\n const user = data.user\r\n const claims = this._mapper.map(user)\r\n return Result.ok(claims)\r\n }\r\n\r\n public async isAuthenticated(): Promise<boolean> {\r\n const session = await this._supabase.auth.getSession()\r\n return Guards.isDefined(session.data.session)\r\n }\r\n\r\n public async exchangeCodeForSession(code: string): Promise<ResultType<Optional<Session>>> {\r\n const { data, error } = await this._supabase.auth.exchangeCodeForSession(code)\r\n if (Guards.isDefined(error) || !Guards.isDefined(data.session))\r\n return Result.fail(\r\n AppError.authFailed('SupabaseAuthenticationService', error?.message ?? 'Unknown error'),\r\n )\r\n\r\n const session = data.session\r\n\r\n if (Guards.isDefined(session)) return Result.ok(this._sessionMapper.map(session))\r\n\r\n return Result.ok()\r\n }\r\n\r\n public async signInWithProvider(provider: Provider): Promise<ResultType<{ url: string }>> {\r\n const { data, error } = await this._supabase.auth.signInWithOAuth({\r\n provider,\r\n options: { redirectTo: this._opts.redirectTo },\r\n })\r\n\r\n if (Guards.isDefined(error) || Guards.isNullOrEmpty(data.url)) {\r\n return Result.fail(\r\n AppError.authFailed('SupabaseFrontendAuthService', error?.message ?? 'Unexpected error'),\r\n )\r\n }\r\n\r\n return Result.ok({ url: data.url })\r\n }\r\n\r\n public async getSession(): Promise<ResultType<Maybe<Session>>> {\r\n const { data, error } = await this._supabase.auth.getSession()\r\n if (Guards.isDefined(error)) {\r\n return Result.fail(AppError.authFailed('SupabaseFrontendAuthService', error.message))\r\n }\r\n\r\n const session = data.session\r\n\r\n if (Guards.isDefined(session)) return Result.ok(this._sessionMapper.map(data.session!))\r\n\r\n return Result.ok()\r\n }\r\n\r\n public async getUser(): Promise<ResultType<Maybe<AuthClaims>>> {\r\n const { data, error } = await this._supabase.auth.getUser()\r\n if (Guards.isDefined(error)) {\r\n return Result.fail(AppError.authFailed('SupabaseFrontendAuthService', error.message))\r\n }\r\n const user = data.user\r\n if (Guards.isDefined(user)) return Result.ok(this._mapper.map(user))\r\n\r\n return Result.ok()\r\n }\r\n\r\n public async signOut(): Promise<ResultType<void>> {\r\n const { error } = await this._supabase.auth.signOut()\r\n if (Guards.isDefined(error)) {\r\n return Result.fail(AppError.authFailed('SupabaseFrontendAuthService', error.message))\r\n }\r\n return Result.ok()\r\n }\r\n\r\n public async getSessionToken(): Promise<ResultType<Optional<string>>> {\r\n const sessionResult = await this.getSession()\r\n if (!sessionResult.isOk()) {\r\n return Result.fail(sessionResult.getErrorOrThrow())\r\n }\r\n const session = sessionResult.getValueOrThrow()\r\n return Result.ok(session?.accessToken)\r\n }\r\n}\r\n","import type { ICache } from '@/domain'\r\nimport type { Optional } from '@/shared'\r\nimport { Guards, StringHelper } from '@/shared'\r\n\r\n/**\r\n * @description The InMemoryCache class provides an implementation of the ICache interface using an in-memory Map to store cached values. This class allows for storing, retrieving, and managing cached values in memory, supporting features such as time-to-live (TTL) for cache entries and atomic operations for setting values only if they do not already exist. The InMemoryCache class is a simple and efficient caching solution for scenarios where a lightweight, in-memory cache is sufficient, such as during development or for caching non-critical data that does not require persistence across application restarts.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport class InMemoryCache implements ICache {\r\n /**\r\n * @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.\r\n * @param _cache An optional Map instance to use as the underlying storage for the cache. If not provided, a new Map will be created to store cached values.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n constructor(\r\n private _cache: Map<string, { value: string; expiresAt: Optional<number> }> = new Map(),\r\n ) {}\r\n\r\n public async get<T>(key: string): Promise<Optional<T>> {\r\n const entry = this._cache.get(key)\r\n if (!Guards.isDefined(entry)) {\r\n return undefined\r\n }\r\n if (Guards.isDefined(entry.expiresAt) && entry.expiresAt < Date.now()) {\r\n this._cache.delete(key)\r\n return undefined\r\n }\r\n return JSON.parse(entry.value) as T\r\n }\r\n\r\n public async set<T>(key: string, value: T, ttl: Optional<number>): Promise<void> {\r\n const expiresAt = Guards.isDefined(ttl) ? Date.now() + ttl * 1000 : undefined\r\n this._cache.set(key, { value: StringHelper.safeStringify(value), expiresAt })\r\n }\r\n\r\n public async setIfAbsent<T>(key: string, value: T, ttl: Optional<number>): Promise<boolean> {\r\n if (this._cache.has(key)) {\r\n return false\r\n }\r\n await this.set(key, value, ttl)\r\n return true\r\n }\r\n\r\n public async remove(key: string): Promise<void> {\r\n this._cache.delete(key)\r\n }\r\n\r\n public async has(key: string): Promise<boolean> {\r\n const entry = this._cache.get(key)\r\n if (!Guards.isDefined(entry)) {\r\n return false\r\n }\r\n if (Guards.isDefined(entry.expiresAt) && entry.expiresAt < Date.now()) {\r\n this._cache.delete(key)\r\n return false\r\n }\r\n return true\r\n }\r\n\r\n public async clear(): Promise<void> {\r\n this._cache.clear()\r\n }\r\n}\r\n","import type { ICacheKeyBuilder, IIdentityAccessor } from '@/domain'\r\nimport { Guards } from '@/shared'\r\n\r\n/**\r\n * @description The CacheKeyBuilder class implements the ICacheKeyBuilder interface, providing a method to build contextual cache keys based on the user's identity. This class utilizes an instance of IIdentityAccessor to retrieve the current user's identity, allowing for the creation of tenant-specific cache keys in multi-tenant applications. If a tenant ID is present in the identity, the cache key is prefixed with the tenant ID; otherwise, it defaults to a public cache key. This approach ensures that cached data is appropriately scoped to the user's context, preventing data leakage between tenants.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport class CacheKeyBuilder implements ICacheKeyBuilder {\r\n /**\r\n * @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.\r\n * @param _identityAccessor An instance of IIdentityAccessor used to retrieve the current user's identity, allowing for the construction of tenant-specific cache keys.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n constructor(private readonly _identityAccessor: IIdentityAccessor) {}\r\n\r\n public buildContextualKey(key: string): string {\r\n const identity = this._identityAccessor.getIdentity()\r\n\r\n if (Guards.isDefined(identity) && !Guards.isNullOrEmpty(identity.tenantId)) {\r\n return `tenant:${identity.tenantId}:${key}`\r\n }\r\n\r\n return `${key}:public`\r\n }\r\n\r\n public buildUserScopedKey(key: string): string {\r\n const identity = this._identityAccessor.getIdentity()\r\n\r\n if (Guards.isDefined(identity) && !Guards.isNullOrEmpty(identity.userId)) {\r\n return this.buildContextualKey(`user:${identity.userId}:${key}`)\r\n }\r\n\r\n return this.buildContextualKey(key)\r\n }\r\n}\r\n","import axios from 'axios'\r\n\r\nimport type { IFactory, IHttpClient } from '@/domain'\r\nimport type { HttpClientConfig } from '@/domain'\r\n\r\nimport { AxiosHttpClient } from '../http/axios.http'\r\n\r\n/**\r\n * @description Factory class responsible for creating instances of AxiosHttpClient based on the provided configuration. It implements the IFactory interface, allowing for easy integration with dependency injection systems. The factory encapsulates the creation logic for the AxiosHttpClient, including the initialization of the underlying Axios instance with the specified configuration options such as base URL, default headers, and timeout settings. This design promotes separation of concerns and allows for flexibility in managing AxiosHttpClient instances across the application.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport class AxiosFactory implements IFactory<HttpClientConfig, IHttpClient> {\r\n public create(config: HttpClientConfig): IHttpClient {\r\n const axiosInstance = axios.create({\r\n baseURL: config.baseURL,\r\n headers: config.defaultHeaders,\r\n timeout: config.timeoutMs,\r\n maxRedirects: config.maxRedirects ?? 5,\r\n decompress: config.decompress ?? true,\r\n proxy: config.proxy,\r\n withCredentials: config.withCredentials,\r\n })\r\n\r\n return new AxiosHttpClient(axiosInstance)\r\n }\r\n}\r\n","import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'\nimport { AxiosError } from 'axios'\n\nimport type { IHttpClient } from '@/domain'\nimport { AppError } from '@/domain'\nimport type { HttpOptions, HttpRequest, HttpResponse, Optional } from '@/shared'\nimport { ERROR_CODE_MESSAGES, ERROR_CODES, Guards, HttpHelper, STATUS_CODES } from '@/shared'\n\nexport class AxiosHttpClient implements IHttpClient {\n constructor(private readonly _client: AxiosInstance) {}\n\n private async executInAsync<TResponse = unknown>(\n callback: () => Promise<HttpResponse<TResponse>>,\n opts: { signal: Optional<AbortSignal>; name: string },\n ): Promise<HttpResponse<TResponse>> {\n AppError.throwIfAborted(opts.signal, opts.name)\n\n try {\n return await callback()\n } catch (error: unknown) {\n this.handleError(error, 'AxiosHttpClient.get')\n }\n }\n\n public async get<TResponse = unknown>(\n url: string,\n options?: Optional<Omit<HttpRequest<never>, HttpOptions>>,\n ): Promise<HttpResponse<TResponse>> {\n return await this.executInAsync(\n async () => {\n const response = await this._client.get<TResponse>(url, this.buildConfig(options))\n return this.handleResponse(response)\n },\n { signal: options?.signal, name: 'AxiosHttpClient.get' },\n )\n }\n\n public async post<TResponse = unknown, TBody = unknown>(\n url: string,\n body?: Optional<TBody>,\n options?: Optional<Omit<HttpRequest<TBody>, HttpOptions>>,\n ): Promise<HttpResponse<TResponse>> {\n return await this.executInAsync(\n async () => {\n const response = await this._client.post<TResponse>(url, body, this.buildConfig(options))\n return this.handleResponse(response)\n },\n { signal: options?.signal, name: 'AxiosHttpClient.post' },\n )\n }\n\n public async put<TResponse = unknown, TBody = unknown>(\n url: string,\n body?: Optional<TBody>,\n options?: Optional<Omit<HttpRequest<TBody>, HttpOptions>>,\n ): Promise<HttpResponse<TResponse>> {\n return await this.executInAsync(\n async () => {\n const response = await this._client.put<TResponse>(url, body, this.buildConfig(options))\n return this.handleResponse(response)\n },\n { signal: options?.signal, name: 'AxiosHttpClient.put' },\n )\n }\n\n public async patch<TResponse = unknown, TBody = unknown>(\n url: string,\n body?: Optional<TBody>,\n options?: Optional<Omit<HttpRequest<TBody>, HttpOptions>>,\n ): Promise<HttpResponse<TResponse>> {\n return await this.executInAsync(\n async () => {\n const response = await this._client.patch<TResponse>(url, body, this.buildConfig(options))\n return this.handleResponse(response)\n },\n { signal: options?.signal, name: 'AxiosHttpClient.patch' },\n )\n }\n\n public async delete<TResponse = unknown>(\n url: string,\n options?: Optional<Omit<HttpRequest<never>, HttpOptions>>,\n ): Promise<HttpResponse<TResponse>> {\n return await this.executInAsync(\n async () => {\n const response = await this._client.delete<TResponse>(url, this.buildConfig(options))\n return this.handleResponse(response)\n },\n { signal: options?.signal, name: 'AxiosHttpClient.delete' },\n )\n }\n\n private buildConfig(\n options?: Optional<Omit<HttpRequest<unknown>, HttpOptions>>,\n ): AxiosRequestConfig {\n return {\n headers: options?.headers,\n params: options?.query,\n signal: options?.signal,\n timeout: options?.timeoutMs,\n validateStatus: () => true,\n }\n }\n\n private handleResponse<TResponse>(response: AxiosResponse<TResponse>): HttpResponse<TResponse> {\n if (!Guards.isDefined(response.status) || response.status >= 400) {\n AppError.throw({\n code: ERROR_CODES.EXTERNAL_SERVICE_ERROR,\n message: ERROR_CODE_MESSAGES[ERROR_CODES.EXTERNAL_SERVICE_ERROR],\n status: response.status,\n name: 'AxiosHttpClientException',\n cause: new AxiosError(\n `Request failed with status code ${response.status}`,\n undefined,\n response.config,\n response.request,\n response,\n ),\n })\n }\n\n return {\n status: response.status,\n ok: response.status >= 200 && response.status < 300,\n headers: HttpHelper.normalizeHeaders(response.headers),\n data: response.data,\n }\n }\n\n private handleError(error: unknown, name: string): never {\n if (error instanceof AppError) throw error\n\n const status =\n error instanceof AxiosError && Guards.isDefined(error.response)\n ? error.response.status\n : STATUS_CODES.INTERNAL_SERVER_ERROR\n\n AppError.throw({\n code: ERROR_CODES.EXTERNAL_SERVICE_ERROR,\n message: ERROR_CODE_MESSAGES[ERROR_CODES.EXTERNAL_SERVICE_ERROR],\n status,\n name,\n cause: error,\n })\n }\n}\n","import type { User } from '@supabase/supabase-js'\r\n\r\nimport type { IBaseMapper } from '@/domain'\r\nimport type { AuthClaims } from '@/shared'\r\nimport { Guards } from '@/shared'\r\n\r\n/**\r\n * @description SupabaseClaimsMapper is responsible for mapping authentication claims (AuthClaims) to an Identity object. This mapper takes the claims extracted from a token (such as a JWT) and transforms them into a structured Identity that can be used throughout the application for authentication and authorization purposes. The mapping includes parsing the user ID and tenant ID from the claims, as well as extracting roles and permissions.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport class SupabaseClaimsMapper implements IBaseMapper<User, AuthClaims> {\r\n public map(user: User): AuthClaims {\r\n const appMetadata = user.app_metadata ?? {}\r\n\r\n return {\r\n sub: user.id,\r\n email: user.email,\r\n name: Guards.isString(user.user_metadata?.['name'])\r\n ? user.user_metadata?.['name']\r\n : undefined,\r\n tenantId: Guards.isString(appMetadata?.['tenant_id'])\r\n ? appMetadata?.['tenant_id']\r\n : undefined,\r\n roles: Guards.isArray(appMetadata['roles']) ? (appMetadata['roles'] as string[]) : undefined,\r\n permissions: Guards.isArray(appMetadata['permissions'])\r\n ? (appMetadata['permissions'] as string[])\r\n : undefined,\r\n }\r\n }\r\n}\r\n","// infrastructure/mappers/supabase-session.mapper.ts\r\nimport type { Session as SupabaseSession, User } from '@supabase/supabase-js'\r\n\r\nimport type { IBaseMapper } from '@/domain'\r\nimport type { AuthClaims, Session } from '@/shared'\r\n\r\nexport class SupabaseSessionMapper implements IBaseMapper<SupabaseSession, Session> {\r\n constructor(private readonly _claimsMapper: IBaseMapper<User, AuthClaims>) {}\r\n\r\n public map(source: SupabaseSession): Session {\r\n const claims = this._claimsMapper.map(source.user)\r\n return {\r\n accessToken: source.access_token,\r\n refreshToken: source.refresh_token,\r\n expiresAt: source.expires_at,\r\n user: claims,\r\n }\r\n }\r\n}\r\n","import { z } from 'zod'\r\n\r\nimport { REQUEST_TYPE } from '@/shared'\r\n\r\n/**\r\n * @description Base schema for any Request\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const baseCommandZodSchema = z.object({\r\n intent: z.string().min(1, 'Intent is required'),\r\n type: z.literal(REQUEST_TYPE.COMMAND),\r\n})\r\n\r\n/**\r\n * @description Base schema for any Command\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nconst queryZodSchema = z.object({\r\n intent: z.string().min(1, 'Intent is required'),\r\n type: z.literal(REQUEST_TYPE.QUERY),\r\n})\r\n\r\nconst cacheableOptionsZodSchema = z.object({\r\n cacheKey: z.string().min(1, 'Cache key is required'),\r\n ttl: z.number().int().positive().optional(),\r\n bypassCache: z.boolean().optional(),\r\n consistentRead: z.boolean().optional(),\r\n})\r\n\r\n/**\r\n * @description Base schema for any Query\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const baseQueryZodSchema = queryZodSchema.extend({\r\n cacheOptions: cacheableOptionsZodSchema,\r\n})\r\n","import type { z } from 'zod'\r\n\r\nimport { baseCommandZodSchema, baseQueryZodSchema } from './base-schema.constant'\r\n\r\n/**\r\n * @description Utility functions for creating Zod schemas for commands and queries.\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const ZodUtils = Object.freeze({\r\n /**\r\n * @description Creates a Zod schema for a command by extending the base command schema with additional properties.\r\n * @param additionalSchema - An object representing additional properties to be added to the command schema.\r\n * @returns A Zod schema for the command.\r\n */\r\n createCommandSchema: (additionalSchema: z.ZodRawShape) => {\r\n return baseCommandZodSchema.extend(additionalSchema).strict()\r\n },\r\n /**\r\n * @description Creates a Zod schema for a query by extending the base query schema with additional properties.\r\n * @param additionalSchema - An object representing additional properties to be added to the query schema.\r\n * @returns A Zod schema for the query.\r\n */\r\n createQuerySchema: (additionalSchema: z.ZodRawShape) => {\r\n return baseQueryZodSchema.extend(additionalSchema).strict()\r\n },\r\n})\r\n","import type { core, ZodType } from 'zod'\r\n\r\nimport type { ILogger, IValidatorService, ResultType } from '@/domain'\r\nimport { AppError, Result } from '@/domain'\r\nimport { Guards } from '@/shared'\r\n\r\n/**\r\n * @description Implementation of the IValidatorService interface using Zod schemas for validation. This service maintains a registry of Zod schemas identified by unique keys and provides methods to check for the existence of a schema and to validate data against a specified schema. The validate method returns a ResultType indicating success or failure, with detailed error information in case of validation failure, including formatted error messages from Zod.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport class ZodValidatorService implements IValidatorService {\r\n /**\r\n * @description Constructs a new instance of the ZodValidatorService class, which takes an ICache instance as a parameter. This cache is used to store and manage the validation schemas that will be applied to incoming data. The constructor initializes the service with the provided cache, allowing it to perform validation checks based on the cached schemas when the validate method is called.\r\n *\r\n * @param _cache An instance of ICache used to store and retrieve Zod schemas. This cache is essential for the operation of the validator service, as it allows it to look up and apply the correct schema for validating incoming data.\r\n * @param _logger An instance of ILogger used to log warning when schema was not found.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n constructor(\r\n private readonly _cache: Map<string, ZodType> = new Map(),\r\n private readonly _logger: ILogger,\r\n ) {}\r\n\r\n private static formatIssue(issue: core.$ZodIssue): string {\r\n const issuePath = !Guards.isNullOrEmpty(issue.path) ? issue.path.map(String).join('.') : 'root'\r\n\r\n return `[${issuePath}] ${issue.message}`\r\n }\r\n\r\n public addSchema(key: string, schema: ZodType): void {\r\n this._cache.set(key, schema)\r\n }\r\n\r\n public async validate<T>(key: string, data: T): Promise<ResultType<boolean>> {\r\n const schema = this._cache.get(key)\r\n if (!Guards.isDefined(schema)) {\r\n this._logger.warn(`Schema for intent: ${key} was not found`)\r\n return Result.ok()\r\n }\r\n\r\n const zodResult = schema.safeParse(data)\r\n\r\n if (!zodResult.success) {\r\n const errorMessage = zodResult.error.issues\r\n .map((issue) => ZodValidatorService.formatIssue(issue))\r\n .join(', ')\r\n\r\n return Result.fail(\r\n AppError.validationError(\r\n 'ZodValidatorService',\r\n `Validation failed for schema: ${errorMessage}`,\r\n ),\r\n )\r\n }\r\n\r\n return Result.ok(true)\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,IA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M,eAAe,UAAU,MAAM,OAClC,IAAI,CAAC,UAAU,qBAAoB,YAAY,KAAK,CAAC,EACrD,KAAK,IAAI;AAEZ,aAAO,OAAO;AAAA,QACZ,SAAS;AAAA,UACP;AAAA,UACA,iCAAiC,YAAY;AAAA,QAC/C;AAAA,MACF;AAAA,IACF;AAEA,WAAO,OAAO,GAAG,IAAI;AAAA,EACvB;AACF;","names":["import_axios","axios"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/shared/constants/concurrency.constants.ts","../src/shared/constants/error.constants.ts","../src/shared/constants/roles.constants.ts","../src/shared/constants/guest.constants.ts","../src/shared/constants/idempotency.constants.ts","../src/shared/constants/log-level.constants.ts","../src/shared/constants/pagination.constants.ts","../src/shared/constants/request.constants.ts","../src/shared/constants/resilience.constants.ts","../src/shared/constants/tokens.constants.ts","../src/shared/utils/guards.utils.ts","../src/shared/utils/abort.utils.ts","../src/shared/utils/date.utils.ts","../src/shared/utils/enumerable.utils.ts","../src/shared/utils/guid.utils.ts","../src/shared/utils/http.utils.ts","../src/shared/utils/math.utils.ts","../src/shared/utils/promise.utils.ts","../src/shared/utils/sanitize.utils.ts","../src/shared/utils/string.utils.ts","../src/application/cqrs/command/command.ts","../src/application/cqrs/query/query.ts","../src/application/loggers/utils/logger-context.utils.ts","../src/application/loggers/base.logger.ts","../src/domain/unique_id/unique-id.ts","../src/domain/entities/entity.ts","../src/domain/errors/app-error.ts","../src/domain/results/result.ts","../src/domain/value_objects/value-object.ts","../src/infrastructure/auth/storage/cookie.storage.ts","../src/infrastructure/auth/storage/memory.storage.ts","../src/infrastructure/auth/storage/storage.utils.ts","../src/infrastructure/auth/supabase-auth.service.ts","../src/infrastructure/cache/in-memory.cache.ts","../src/infrastructure/cache/key-builder.cache.ts","../src/infrastructure/factories/axios.factory.ts","../src/infrastructure/http/axios.http.ts","../src/infrastructure/mappers/supabase-claims.mapper.ts","../src/infrastructure/mappers/supabase-session.mapper.ts","../src/infrastructure/validators/base-schema.constant.ts","../src/infrastructure/validators/schema-zod.utils.ts","../src/infrastructure/validators/zod.validator.ts"],"sourcesContent":["export * from './application/index'\nexport * from './domain/index'\nexport {\n AxiosFactory,\n AxiosHttpClient,\n CacheKeyBuilder,\n InMemoryCache,\n StorageHelper,\n SupabaseAuthService,\n SupabaseClaimsMapper,\n SupabaseSessionMapper,\n ZodUtils,\n ZodValidatorService,\n} from './infrastructure/index'\nexport * from './shared/index'\n","/**\r\n * @description This module defines constants related to concurrency handling in the application, specifically for the ConcurrencyRetryPipeline. These constants include the maximum number of retry attempts, the base delay for retries, and the maximum jitter to be added to the delay. The constants are exported as a frozen object to prevent modification at runtime, ensuring consistent behavior across the application when handling concurrency conflicts.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const DEFAULT_CONCURRENCY = Object.freeze({\r\n /**\r\n * @description Number of maximum retry attempts for handling concurrency conflicts in the pipeline. If the number of attempts exceeds this value, the pipeline will return a failed Result with an AppError indicating that the maximum retry attempts have been exceeded due to concurrency conflicts.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n MAX_RETRIES: 3,\r\n /**\r\n * @description Base delay in milliseconds for retrying a request after a concurrency conflict is detected. The actual delay will be calculated using an exponential backoff strategy with added jitter to prevent thundering herd problems when multiple requests are retried simultaneously.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n BASE_DELAY: 20,\r\n /**\r\n * @description Maximum jitter in milliseconds to be added to the base delay when retrying a request after a concurrency conflict is detected. This helps to randomize the retry attempts and reduce the likelihood of multiple requests being retried at the same time, which can lead to further conflicts. The actual delay for each retry will be calculated as baseDelayMs * (2 ** attempt) + randomJitter, where randomJitter is a random value between 0 and maxJitterMs.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n MAX_JITTER: 30,\r\n} as const)\r\n","/**\r\n * @description Machine-readable, kebab-case error codes for all cross-cutting failures.\r\n * Used by AppError and Result to communicate failure semantics across layer boundaries\r\n * without relying on human-readable strings.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const ERROR_CODES = Object.freeze({\r\n // ── Generic / System ─────────────────────────────────────────────────────\r\n\r\n /** @description Unclassified or unexpected infrastructure-level failure.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n SYSTEM_ERROR: 'SYSTEM_ERROR',\r\n\r\n /** @description An operation that has not yet been implemented was invoked.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n NOT_IMPLEMENTED: 'NOT_IMPLEMENTED',\r\n\r\n /** @description An external API call failed due to network issues or a 5xx response.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n EXTERNAL_SERVICE_ERROR: 'EXTERNAL_SERVICE_ERROR',\r\n\r\n /** @description One or more input fields failed invariant or schema validation.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n VALIDATION_FAILED: 'VALIDATION_FAILED',\r\n\r\n /** @description Authentication failed due to invalid credentials or token.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n AUTHENTICATION_FAILED: 'AUTHENTICATION_FAILED',\r\n\r\n /** @description The caller is not authenticated.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n UNAUTHORIZED: 'UNAUTHORIZED',\r\n\r\n /** @description The caller is authenticated but lacks the required permissions.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n FORBIDDEN: 'FORBIDDEN',\r\n\r\n /** @description The request was well-formed but semantically invalid.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n BAD_REQUEST: 'BAD_REQUEST',\r\n\r\n /** @description The request was aborted before it could be processed.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n ABORTED: 'ABORTED',\r\n\r\n /** @description Required service scope is not available in the request context.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n SCOPE_NOT_AVAILABLE: 'SCOPE_NOT_AVAILABLE',\r\n\r\n /** @description The request conflicts with the current state of the resource.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n CONFLICT: 'CONFLICT',\r\n /** @description The requested resource does not exist.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n NOT_FOUND: 'NOT_FOUND',\r\n\r\n /** @description No handler was found for the given request type.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n HANDLER_NOT_FOUND: 'HANDLER_NOT_FOUND',\r\n\r\n /** @description No pipeline behavior was found for the given request type.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n PIPELINE_NOT_AVAILABLE: 'PIPELINE_NOT_AVAILABLE',\r\n\r\n NOT_ALLOWED: 'METHOD_NOT_ALLOWED',\r\n\r\n TOO_MANY_REQUESTS: 'TOO_MANY_REQUESTS',\r\n} as const)\r\n\r\n/** @description Inferred union of every valid ERROR_CODES value.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES]\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * @description Canonical HTTP status codes used across Presentation and Infrastructure layers.\r\n * Centralising these values prevents magic-number sprawl and ensures\r\n * consistent semantics between the AppError, Result and ApiResponse contracts.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const STATUS_CODES = Object.freeze({\r\n // ── 2xx Success ───────────────────────────────────────────────────────────\r\n\r\n /** @description The request succeeded and a response body is present.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n OK: 200,\r\n\r\n /** @description A new resource has been successfully created.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n CREATED: 201,\r\n\r\n /** @description The request succeeded but there is no response body (e.g. DELETE).\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n NO_CONTENT: 204,\r\n\r\n // ── 4xx Client Errors ─────────────────────────────────────────────────────\r\n\r\n /** @description The request payload is malformed or contains invalid parameters.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n BAD_REQUEST: 400,\r\n\r\n /** @description Authentication credentials are missing or invalid.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n UNAUTHORIZED: 401,\r\n\r\n /** @description The caller lacks permission to perform the requested operation.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n FORBIDDEN: 403,\r\n\r\n /** @description The requested resource does not exist.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n NOT_FOUND: 404,\r\n\r\n NOT_ALLOWED: 405,\r\n\r\n /** @description The request conflicts with the current state of the resource.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n CONFLICT: 409,\r\n\r\n /** @description The payload is syntactically valid but semantically unprocessable.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n UNPROCESSABLE_ENTITY: 422,\r\n\r\n /** @description The caller has exceeded its allowed rate limit.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n TOO_MANY_REQUESTS: 429,\r\n\r\n /** @description The client closed the connection before the server finished responding.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n ABORTED: 499,\r\n\r\n // ── 5xx Server Errors ─────────────────────────────────────────────────────\r\n\r\n /** @description An unexpected condition was encountered by the server.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n INTERNAL_SERVER_ERROR: 500,\r\n\r\n /** @description A downstream dependency is temporarily unavailable.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n SERVICE_UNAVAILABLE: 503,\r\n} as const)\r\n\r\n/** @description Inferred union of every valid STATUS_CODES value.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport type StatusCode = (typeof STATUS_CODES)[keyof typeof STATUS_CODES]\r\n\r\n/**\r\n * @description A mapping of ERROR_CODES to human-readable messages, used for logging and user feedback when an AppError is created with a specific error code. This allows for consistent and centralized management of error messages across the application, ensuring that each error code corresponds to a clear and descriptive message that can be easily maintained and localized if necessary.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const ERROR_CODE_MESSAGES: Record<ErrorCode, string> = Object.freeze({\r\n [ERROR_CODES.SYSTEM_ERROR]: 'errors.system_error',\r\n [ERROR_CODES.NOT_IMPLEMENTED]: 'errors.not_implemented',\r\n [ERROR_CODES.EXTERNAL_SERVICE_ERROR]: 'errors.external_service_error',\r\n [ERROR_CODES.VALIDATION_FAILED]: 'errors.validation_failed',\r\n [ERROR_CODES.UNAUTHORIZED]: 'errors.unauthorized',\r\n [ERROR_CODES.FORBIDDEN]: 'errors.forbidden',\r\n [ERROR_CODES.BAD_REQUEST]: 'errors.bad_request',\r\n [ERROR_CODES.ABORTED]: 'errors.aborted',\r\n [ERROR_CODES.AUTHENTICATION_FAILED]: 'errors.authentication_failed',\r\n [ERROR_CODES.SCOPE_NOT_AVAILABLE]: 'errors.scope_not_available',\r\n [ERROR_CODES.CONFLICT]: 'errors.conflict',\r\n [ERROR_CODES.NOT_FOUND]: 'errors.not_found',\r\n [ERROR_CODES.HANDLER_NOT_FOUND]: 'errors.handler_not_found',\r\n [ERROR_CODES.PIPELINE_NOT_AVAILABLE]: 'errors.pipeline_not_available',\r\n [ERROR_CODES.NOT_ALLOWED]: 'errors.method_not_allowed',\r\n [ERROR_CODES.TOO_MANY_REQUESTS]: 'errors.too_many_requests',\r\n} as const)\r\n","/**\r\n * @fileoverview This file defines the roles used within the application. The ROLES constant is an object that contains the different roles available, such as SUPER_ADMIN, ADMIN, USER, and GUEST. Each role is represented as a string value. The Role type is defined as a union of the values of the ROLES object, allowing for type safety when working with roles throughout the application.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n\r\n/** @description An object containing the different roles available within the application. Each role is represented as a string value.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const ROLES = Object.freeze({\r\n /** @description The SUPER_ADMIN role, which typically has the highest level of permissions and access within the application.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n SUPER_ADMIN: 'super_admin',\r\n /** @description The ADMIN role, which typically has elevated permissions and access within the application, but may have some restrictions compared to the SUPER_ADMIN role.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n ADMIN: 'admin',\r\n /** @description The USER role, which typically has standard permissions and access within the application, allowing them to perform regular user actions but with limited administrative capabilities.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n USER: 'user',\r\n /** @description The GUEST role, which typically has the most limited permissions and access within the application, often used for unauthenticated users or users with very restricted access.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n GUEST: 'guest',\r\n} as const)\r\n\r\n/** @description A type representing the different roles available within the application. It is defined as a union of the values of the ROLES object, allowing for type safety when working with roles throughout the application.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport type Role = (typeof ROLES)[keyof typeof ROLES]\r\n\r\n/** @description An object containing the different permissions available within the application. Each permission is represented as a string value.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const PERMISSIONS = Object.freeze({\r\n /** @description The READ permission, which typically allows access to resources or actions within the application that require read-only access.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n READ: 'read',\r\n} as const)\r\n\r\n/** @description A type representing the different permissions available within the application. It is defined as a union of the values of the PERMISSIONS object, allowing for type safety when working with permissions throughout the application.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport type Permission = (typeof PERMISSIONS)[keyof typeof PERMISSIONS]\r\n","import { PERMISSIONS, ROLES } from './roles.constants'\r\n\r\n/**\r\n * @description The GUEST constant represents a default guest user identity with no specific user ID or tenant ID, assigned the GUEST role, and no permissions. This constant can be used throughout the application to represent unauthenticated users or users with minimal access rights, ensuring a consistent representation of guest users across the system.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const GUEST = Object.freeze({\r\n /** @description The unique identifier for the guest user, which is set to undefined since guest users do not have a specific user ID. This allows the application to differentiate between authenticated users with valid IDs and unauthenticated guest users.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n userId: undefined,\r\n /** @description The email for guest user, which is set to undefined since guest users do not have a specific email.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n email: undefined,\r\n /** @description The unique identifier for the tenant associated with the guest user, which is set to undefined since guest users do not belong to a specific tenant. This allows the application to handle multi-tenancy scenarios while still accommodating unauthenticated users who do not have an associated tenant.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n tenantId: undefined,\r\n /** @description An array of roles assigned to the guest user, which includes only the GUEST role. This indicates that the user has minimal access rights and is typically used to represent unauthenticated users or users with limited permissions in the application.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n roles: [ROLES.GUEST],\r\n /** @description An array of permissions assigned to the guest user, which is empty since guest users do not have any specific permissions. This reinforces the idea that guest users have minimal access rights and cannot perform actions that require specific permissions in the application.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n permissions: [PERMISSIONS.READ],\r\n} as const)\r\n","/**\r\n * @description Constants used in the idempotency store implementation, including key prefixes for locks and processed commands, default time-to-live (TTL) values, and standard values for indicating locked and processed states. These constants are defined as a frozen object to ensure immutability and provide a centralized location for managing configuration values related to idempotency handling in the application.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const IDEMPOTENCY_CONSTANTS = Object.freeze({\r\n /**\r\n * @description Prefix for keys used to store locks in the idempotency store. This prefix is used to differentiate lock entries from other types of entries in the cache, allowing for efficient management of locks when acquiring and releasing them during command processing. The lock key prefix helps ensure that lock-related data is organized and easily identifiable within the caching mechanism.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n LOCK_KEY_PREFIX: 'idempotency_lock:',\r\n\r\n /**\r\n * @description Prefix for keys used to store processed command results in the idempotency store. This prefix is used to differentiate processed command entries from lock entries and other types of data in the cache, allowing for efficient retrieval of stored results when checking if a command has already been processed. The processed key prefix helps maintain a clear structure within the caching mechanism, making it easier to manage and query processed command data.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n PROCESSED_KEY_PREFIX: 'idempotency_processed:',\r\n\r\n /**\r\n * @description Default time-to-live (TTL) in seconds for locks and processed command entries in the idempotency store. This value is used when acquiring locks and marking commands as processed to specify how long the lock or stored result should remain valid before it expires. The default TTL helps ensure that locks and processed command entries do not persist indefinitely, allowing for automatic cleanup of stale data and preventing potential issues with long-lived locks or outdated results in the idempotency store.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n DEFAULT_TTL_SECONDS: 86400,\r\n\r\n /**\r\n * @description Default time-to-live (TTL) in seconds for locks in the idempotency store. This value is used when acquiring locks to specify how long the lock should remain valid before it expires. The default lock TTL helps ensure that locks do not persist indefinitely, allowing for automatic cleanup of stale locks and preventing potential issues with long-lived locks in the idempotency mechanism.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n DEFAULT_IDEMPOTENCY_LOCK_TTL_SECONDS: 60,\r\n\r\n /**\r\n * @description Standard value used to indicate that a lock has been acquired for a specific commandId in the idempotency store. This value is stored in the cache when a lock is successfully acquired, allowing other instances of the command to recognize that the command is currently being processed and prevent duplicate processing. The locked value serves as a marker for active locks in the idempotency mechanism, helping to manage concurrent command processing effectively.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n LOCKED_VALUE: 'LOCKED',\r\n\r\n /**\r\n * @description Standard value used to indicate that a command has been processed and its result has been stored in the idempotency store. This value is stored in the cache when a command is marked as processed, allowing subsequent attempts to process the same commandId to recognize that it has already been handled and return the stored result instead of executing the command again. The processed value serves as a marker for completed commands in the idempotency mechanism, helping to manage command processing outcomes and prevent redundant executions.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n PROCESSED_VALUE: 'PROCESSED',\r\n} as const)\r\n","/**\r\n * Log levels for the logger.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const LOG_LEVEL = Object.freeze({\r\n /** * Debug level for detailed debugging information. This level is typically used during development and should be turned off in production to avoid verbose logging.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n DEBUG: 0,\r\n /** * Info level for general informational messages that highlight the progress of the application at a coarse-grained level. This level is suitable for production environments to track the normal operation of the application.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n INFO: 1,\r\n /** * Warn level for potentially harmful situations that are not necessarily errors but may require attention. This level is useful for identifying issues that could lead to errors if not addressed.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n WARN: 2,\r\n /** * Error level for serious issues that have caused or are likely to cause the application to fail. This level is critical for identifying and addressing problems that need immediate attention.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n ERROR: 3,\r\n} as const)\r\n\r\n/** @description Inferred union of valid log level values.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport type LogLevel = (typeof LOG_LEVEL)[keyof typeof LOG_LEVEL]\r\n\r\n/** @description Mapping of log level values to their corresponding string representations for easier readability in log outputs.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const LOG_LEVEL_NAMES: Record<LogLevel, string> = {\r\n /** Debug level for detailed debugging information. This level is typically used during development and should be turned off in production to avoid verbose logging.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n [LOG_LEVEL.DEBUG]: 'DEBUG',\r\n /** Info level for general informational messages that highlight the progress of the application at a coarse-grained level. This level is suitable for production environments to track the normal operation of the application.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n [LOG_LEVEL.INFO]: 'INFO',\r\n /** Warn level for potentially harmful situations that are not necessarily errors but may require attention. This level is useful for identifying issues that could lead to errors if not addressed.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n [LOG_LEVEL.WARN]: 'WARN',\r\n /** Error level for serious issues that have caused or are likely to cause the application to fail. This level is critical for identifying and addressing problems that need immediate attention.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n [LOG_LEVEL.ERROR]: 'ERROR',\r\n}\r\n","// ─── Constants ────────────────────────────────────────────────────────────────\r\n\r\n/** @description Default page index when no page is supplied by the caller.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nconst DEFAULT_PAGE = 1\r\n\r\n/** @description Default maximum number of items per page.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nconst DEFAULT_PAGE_SIZE = 20\r\n\r\n/** @description Absolute maximum allowed page size to prevent resource exhaustion.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nconst MAX_PAGE_SIZE = 100\r\n\r\n/** @description Canonical pagination defaults.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const PAGINATION_DEFAULTS = Object.freeze({\r\n /** @description Default page index (1-based).\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n PAGE: DEFAULT_PAGE,\r\n\r\n /** @description Default maximum items per page.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n PAGE_SIZE: DEFAULT_PAGE_SIZE,\r\n\r\n /** @description Hard ceiling on page size accepted by the system.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n MAX_PAGE_SIZE,\r\n} as const)\r\n\r\n// ─── Sort Direction ───────────────────────────────────────────────────────────\r\n\r\n/**\r\n * @description Canonical sort direction values.\r\n * Used by IPaginationParams.sortDirection to avoid string magic.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const SORT_DIRECTION = Object.freeze({\r\n /** @description Ascending order (A → Z, 0 → 9, oldest → newest).\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n ASC: 'asc',\r\n\r\n /** @description Descending order (Z → A, 9 → 0, newest → oldest).\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n DESC: 'desc',\r\n} as const)\r\n\r\n/** @description Inferred union of valid sort direction values.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport type SortDirection = (typeof SORT_DIRECTION)[keyof typeof SORT_DIRECTION]\r\n","/** @description Constants related to request handling in the application.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const REQUEST_TYPE = Object.freeze({\r\n /** @description A request that intends to modify state (e.g. create, update, delete).\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n COMMAND: 'COMMAND',\r\n /** @description A request that intends to retrieve data without modifying state.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n QUERY: 'QUERY',\r\n} as const)\r\n\r\n/** @description Inferred union of every valid REQUEST_TYPE value.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport type RequestType = (typeof REQUEST_TYPE)[keyof typeof REQUEST_TYPE]\r\n","/**\r\n * @description Canonical default values for resilience policy configuration.\r\n * Used by the resilience factory as the baseline for retry, circuit breaker,\r\n * and bulkhead settings.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const RESILIENCE_DEFAULTS = Object.freeze({\r\n /** @description Default retry policy values.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n RETRY: Object.freeze({\r\n /** @description Default number of retry attempts.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n ATTEMPTS: 3,\r\n\r\n /** @description Default base delay in milliseconds for retry backoff.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n BASE_DELAY_MS: 100,\r\n\r\n /** @description Default maximum delay in milliseconds for retry backoff.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n MAX_DELAY_MS: 1000,\r\n }),\r\n\r\n /** @description Default circuit breaker policy values.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n CIRCUIT_BREAKER: Object.freeze({\r\n /** @description Default number of consecutive failures before opening the circuit.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n CONSECUTIVE_FAILURES: 5,\r\n\r\n /** @description Default half-open timeout in milliseconds.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n HALF_OPEN_TIMEOUT_MS: 30_000,\r\n }),\r\n\r\n /** @description Default bulkhead policy values.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n BULKHEAD: Object.freeze({\r\n /** @description Default maximum number of concurrent operations.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n MAX_CONCURRENT: 10,\r\n }),\r\n} as const)\r\n","/**\r\n * @description This file defines the tokens used for dependency injection in the application.\r\n * Tokens are unique identifiers that are used to register and resolve dependencies in the container.\r\n * They can be symbols, strings, or classes, but using symbols is a common practice to avoid naming collisions.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const TOKENS = Object.freeze({\r\n /** @description Token used to register and resolve the Extendend AuthService instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n AUTH_SERVICE: 'AUTH_SERVICE',\r\n /** @description Token used to register and resolve the BaseAuthService instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n BASE_AUTH_SERVICE: 'BASE_AUTH_SERVICE',\r\n /** @description Token used to register and resolve the InMemoryCache instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n CACHE: 'CACHE',\r\n /** @description Token used to register and resolve the CacheKeyBuilder instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n CACHE_KEY_BUILDER: 'CACHE_KEY_BUILDER',\r\n /** @description Token used to register and resolve command pipeline behaviors in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n COMMAND_PIPELINES_BEHAVIOR: 'COMMAND_PIPELINES_BEHAVIOR',\r\n /** @description Token used to register and resolve the ConcurrencyService instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n CONCURRENCY_SERVICE: 'CONCURRENCY_SERVICE',\r\n /** @description Token used to register and resolve the ConfigurationService instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n CONFIGURATION_SERVICE: 'CONFIGURATION_SERVICE',\r\n /** @description Token used to register and resolve the ContextAccessor instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n CONTEXT_ACCESSOR: 'CONTEXT_ACCESSOR',\r\n /** @description Token used to register and resolve the CryptoService instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n CRYPTO_SERVICE: 'CRYPTO_SERVICE',\r\n /** @description Token used to register and resolve the CsrfTokenService instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n CSRF_TOKEN_SERVICE: 'CSRF_TOKEN_SERVICE',\r\n /** @description Token used to register and resolve the DbContext instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n DB_CONTEXT: 'DB_CONTEXT',\r\n /** @description Token used to register and resolve the IdentityAccessor instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n IDENTITY_ACCESSOR: 'IDENTITY_ACCESSOR',\r\n /** @description Token used to register and resolve the Logger instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n LOGGER: 'LOGGER',\r\n /** @description Token used to register and resolve the Mediator instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n MEDIATOR: 'MEDIATOR',\r\n /** @description Token used to register and resolve the NetworkContextFactory in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n NETWORK_CONTEXT_ACCESSOR: 'NETWORK_CONTEXT_ACCESSOR',\r\n /** @description Token used to register and resolve query pipeline behaviors in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n QUERY_PIPELINES_BEHAVIOR: 'QUERY_PIPELINES_BEHAVIOR',\r\n /** @description Token used to register and resolve the RequestContext instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n REQUEST_CONTEXT: 'REQUEST_CONTEXT',\r\n /** @description Token used to register and resolve the CompositeMiddleware in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n MIDDLEWARE: 'MIDDLEWARE',\r\n /** @description Token used to register and resolve the IServiceResilience instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n RESILIENCE_CLIENT: 'RESILIENCE_CLIENT',\r\n /** @description Token used to register and resolve the SchemaValidationStrategy instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n SCHEMA_VALIDATION_STRATEGY: 'SCHEMA_VALIDATION_STRATEGY',\r\n /** @description Token used to register and resolve the ServiceContainer instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n SERVICE_CONTAINER: 'SERVICE_CONTAINER',\r\n /** @description Token used to register and resolve the ServiceExtractor instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n SERVICE_EXTRACTOR: 'SERVICE_EXTRACTOR',\r\n /** @description Token used to register and resolve the ServiceScopeAccessor in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n SERVICE_SCOPE_ACCESSOR: 'SERVICE_SCOPE_ACCESSOR',\r\n /** @description Token used to register and resolve the UnitOfWork instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n UNIT_OF_WORK: 'UNIT_OF_WORK',\r\n /** @description Token used to register and resolve the ValidatorService instance in the dependency injection container.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n VALIDATOR_SERVICE: 'VALIDATOR_SERVICE',\r\n} as const)\r\n","import type { Dictionary, Maybe } from '../types/common.types'\r\n\r\nconst OBJECT_TAG = '[object Object]'\r\nconst DATE_TAG = '[object Date]'\r\n\r\n/**\r\n * @description Centralized type guards and runtime predicates.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const Guards = Object.freeze({\r\n /**\r\n * @description Checks value is neither null nor undefined.\r\n * @param value Candidate value.\r\n * @returns True when value is defined.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isDefined<TValue>(value: Maybe<TValue>): value is TValue {\r\n return value !== null && value !== undefined && value !== '' && !Number.isNaN(value)\r\n },\r\n\r\n /**\r\n * @description Checks value is null, undefined, empty string, or false.\r\n * @param value Candidate value.\r\n * @returns True when value is null, undefined, empty string, or false.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isNullOrEmpty<TValue>(value: Maybe<TValue>): value is null | undefined {\r\n return (\r\n !Guards.isDefined(value) ||\r\n (Guards.isString(value) && value.trim() === '') ||\r\n (Guards.isArray(value) && value.length === 0)\r\n )\r\n },\r\n\r\n /**\r\n * @description Throws an error if the value is null, undefined, empty string, or false.\r\n * @param value Candidate value.\r\n * @param errorMessage Error message to throw if the check fails.\r\n * @throws Error with the provided message if the value is null, undefined, empty string, or false.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n throwIfNullOrEmpty<TValue>(value: Maybe<TValue>, errorMessage: string): void {\r\n if (Guards.isNullOrEmpty(value)) {\r\n throw new Error(errorMessage)\r\n }\r\n },\r\n\r\n /**\r\n * @description Throws an error if the value is not a positive integer.\r\n * @param value Candidate value.\r\n * @param errorMessage Error message to throw if the check fails.\r\n * @throws Error with the provided message if the value is not a positive integer.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n throwIfNegative(value: number, errorMessage: string): void {\r\n if (Guards.isInteger(value) && value < 0) {\r\n throw new Error(errorMessage)\r\n }\r\n },\r\n\r\n /**\r\n * @description Throws an error if the value is not an integer.\r\n * @param value Candidate value.\r\n * @param errorMessage Error message to throw if the check fails.\r\n * @throws Error with the provided message if the value is not an integer.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n throwIfNotInteger(value: number, errorMessage: string): void {\r\n if (!Guards.isInteger(value)) {\r\n throw new Error(errorMessage)\r\n }\r\n },\r\n\r\n /**\r\n * @description Checks if an object has a method with the given name.\r\n * @param obj Object to check.\r\n * @param methodName Name of the method to look for.\r\n * @returns True when obj has a function property named methodName.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n hasMethod(obj: unknown, methodName: string): boolean {\r\n if (!this.isDefined(obj)) return false\r\n\r\n // Essendo all'interno del namespace di utilità, l'uso di typeof qui è consentito\r\n return Guards.isFunction((obj as Dictionary<unknown>)[methodName])\r\n },\r\n\r\n /**\r\n * @description Checks value is a string.\r\n * @param value Candidate value.\r\n * @returns True when value is string.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isString(value: unknown): value is string {\r\n return typeof value === 'string'\r\n },\r\n\r\n /**\r\n * @description Checks value is a finite number.\r\n * @param value Candidate value.\r\n * @returns True when value is finite number.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isNumber(value: unknown): value is number {\r\n return typeof value === 'number' && Number.isFinite(value)\r\n },\r\n\r\n /**\r\n * @description Checks value is an integer number.\r\n * @param value Candidate value.\r\n * @returns True when value is integer number.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isInteger(value: unknown): value is number {\r\n return Guards.isNumber(value) && Number.isInteger(value)\r\n },\r\n\r\n /**\r\n * @description Checks value is boolean.\r\n * @param value Candidate value.\r\n * @returns True when value is boolean.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isBoolean(value: unknown): value is boolean {\r\n return typeof value === 'boolean'\r\n },\r\n\r\n /**\r\n * @description Checks value is bigint.\r\n * @param value Candidate value.\r\n * @returns True when value is bigint.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isBigInt(value: unknown): value is bigint {\r\n return typeof value === 'bigint'\r\n },\r\n\r\n /**\r\n * @description Checks value is symbol.\r\n * @param value Candidate value.\r\n * @returns True when value is symbol.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isSymbol(value: unknown): value is symbol {\r\n return typeof value === 'symbol'\r\n },\r\n\r\n /**\r\n * @description Checks value is a function.\r\n * @param value Candidate value.\r\n * @returns True when value is function.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isFunction(value: unknown): value is (...args: readonly unknown[]) => unknown {\r\n return typeof value === 'function'\r\n },\r\n\r\n /**\r\n * @description Checks value is an array.\r\n * @param value Candidate value.\r\n * @returns True when value is array.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isArray<TValue>(value: unknown): value is TValue[] {\r\n return Array.isArray(value)\r\n },\r\n\r\n /**\r\n * @description Checks value is a Date instance with valid timestamp.\r\n * @param value Candidate value.\r\n * @returns True when value is valid Date.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isDate(value: unknown): value is Date {\r\n if (Object.prototype.toString.call(value) !== DATE_TAG) {\r\n return false\r\n }\r\n\r\n return Number.isFinite((value as Date).getTime())\r\n },\r\n\r\n /**\r\n * @description Checks value is an Error instance.\r\n * @param value Candidate value.\r\n * @returns True when value is Error.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isError(value: unknown): value is Error {\r\n return value instanceof Error\r\n },\r\n\r\n /**\r\n * @description Checks value is a plain object record.\r\n * @param value Candidate value.\r\n * @returns True when value is object record.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isObjectRecord(value: unknown): value is Readonly<Dictionary<unknown>> {\r\n if (!Guards.isDefined(value)) {\r\n return false\r\n }\r\n\r\n return Object.prototype.toString.call(value) === OBJECT_TAG\r\n },\r\n\r\n /**\r\n * @description Checks value is an object (not null).\r\n * @param value Candidate value.\r\n * @returns True when value is object.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isObject(value: unknown): value is object {\r\n return typeof value === 'object' && Guards.isDefined(value)\r\n },\r\n\r\n /**\r\n * @description Checks value is PromiseLike.\r\n * @param value Candidate value.\r\n * @returns True when value has then function.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isPromiseLike<TValue>(value: unknown): value is PromiseLike<TValue> {\r\n if (!Guards.isDefined(value)) {\r\n return false\r\n }\r\n\r\n if (!Guards.isObject(value) && !Guards.isFunction(value)) {\r\n return false\r\n }\r\n\r\n const thenMember = (value as Dictionary<unknown>)['then']\r\n return Guards.isFunction(thenMember)\r\n },\r\n} as const)\r\n","import type { Optional } from '../types/common.types'\r\nimport { Guards } from './guards.utils'\r\n\r\n/**\r\n * @file abort-signal-helper.ts\r\n * @description This file contains the AbortSignalHelper utility class, which provides a method to execute a promise with an optional AbortSignal.\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link www.github.com/Mattia-Carcione/xeno-js\r\n */\r\n\r\n/**\r\n * @class AbortSignalHelper\r\n * @description A utility class that provides a method to execute a promise with an optional AbortSignal.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link www.github.com/Mattia-Carcione/xeno-js\r\n */\r\nexport const AbortSignalHelper = Object.freeze({\r\n /**\r\n * Executes a promise with an optional AbortSignal. If the signal is provided and is aborted, the promise will be rejected with the signal's reason.\r\n * @template T - The type of the promise's resolved value.\r\n * @param promise - The promise to execute.\r\n * @param signal - An optional AbortSignal to cancel the promise.\r\n * @returns A promise that resolves with the original promise's value or rejects if the signal is aborted.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link www.github.com/Mattia-Carcione/xeno-js\r\n */\r\n execute<T>(promise: Promise<T>, signal: Optional<AbortSignal>): Promise<T> {\r\n if (!Guards.isDefined(signal)) return promise\r\n\r\n if (signal.aborted) return Promise.reject(new Error('Operation aborted'))\r\n\r\n return new Promise<T>((resolve, reject) => {\r\n const onAbort = () => {\r\n signal.removeEventListener('abort', onAbort)\r\n reject(new Error('Operation aborted by the client.'))\r\n }\r\n\r\n signal.addEventListener('abort', onAbort)\r\n\r\n promise\r\n .then((res) => {\r\n signal.removeEventListener('abort', onAbort)\r\n resolve(res)\r\n })\r\n .catch((_err) => {\r\n signal.removeEventListener('abort', onAbort)\r\n reject(new Error('Operation aborted by the client.'))\r\n })\r\n })\r\n },\r\n} as const)\r\n","import { Guards } from './guards.utils'\r\n\r\nconst MS_PER_DAY = 86_400_000\r\n\r\n/**\r\n * @description Namespace for timezone-agnostic date utilities.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const DateHelper = Object.freeze({\r\n /**\r\n * @description Converts a Date to an ISO 8601 string.\r\n * @param date Input date.\r\n * @returns ISO 8601 UTC string.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n toISOString(date: Date): string {\r\n return date.toISOString()\r\n },\r\n\r\n /**\r\n * @description Returns a new Date with the given number of days added.\r\n * @param date Base date.\r\n * @param days Number of days to add (negative values subtract).\r\n * @returns New Date instance.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n addDays(date: Date, days: number): Date {\r\n return new Date(date.getTime() + days * MS_PER_DAY)\r\n },\r\n\r\n /**\r\n * @description Checks whether a date has elapsed relative to a reference time.\r\n * @param expiresAt Expiry date.\r\n * @param nowMs Reference epoch in milliseconds (defaults to Date.now()).\r\n * @returns True when expiresAt is in the past.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isExpired(expiresAt: Date, nowMs?: number): boolean {\r\n const now = nowMs ?? Date.now()\r\n return expiresAt.getTime() < now\r\n },\r\n\r\n /**\r\n * @description Checks if one date is after another.\r\n * @param after Date to check if it is after.\r\n * @param before Date to check against.\r\n * @returns True when after is after before.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isAfter(after: Date, before: Date): boolean {\r\n return Guards.isDate(after) && Guards.isDate(before) && after.getTime() > before.getTime()\r\n },\r\n\r\n /**\r\n * @description Checks if a date is in the future relative to now.\r\n * @param date Date to check.\r\n * @returns True when date is in the future.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isFuture(date: Date): boolean {\r\n return Guards.isDate(date) && date.getTime() > Date.now()\r\n },\r\n} as const)\r\n","import type { Optional } from '../types/common.types'\nimport { Guards } from './guards.utils'\n\n/**\n * @file enumerable.utils.ts\n * @description Provides utility functions for array operations, including methods to retrieve the first element of an array with optional filtering.\n */\n\n/**\n * @description A utility object that provides methods for working with arrays, specifically for retrieving the first element of an array with optional filtering.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link www.github.com/Mattia-Carcione/xeno-js\n */\nexport const Enumerable = Object.freeze({\n /**\n * Retrieves the first element of an array that satisfies the provided predicate function. If no predicate is provided, it returns the first element of the array. If the array is empty or no elements satisfy the predicate, an error is thrown.\n * @template T - The type of elements in the array.\n * @param array - The array to search.\n * @param predicate - An optional function to test each element.\n * @returns The first element that satisfies the predicate.\n * @throws {Error} If the array is empty or no elements satisfy the predicate.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link www.github.com/Mattia-Carcione/xeno-js\n */\n first<T>(array: T[], predicate?: (item: T) => boolean): T {\n const item = Guards.isDefined(predicate) ? array.find(predicate) : array[0]\n if (!Guards.isDefined(item)) {\n throw new Error('Sequence contains no elements.')\n }\n return item\n },\n\n /**\n * Retrieves the first element of an array that satisfies the provided predicate function. If no predicate is provided, it returns the first element of the array. If the array is empty or no elements satisfy the predicate, undefined is returned.\n * @template T - The type of elements in the array.\n * @param array - The array to search.\n * @param predicate - An optional function to test each element.\n * @returns The first element that satisfies the predicate or undefined.\n *\n * @author Xeno\n * @version 1.0.0\n * @since 2025-09-30\n * @link www.github.com/Mattia-Carcione/xeno-js\n */\n firstOrDefault<T>(array: T[], predicate?: (item: T) => boolean): Optional<T> {\n const item = Guards.isDefined(predicate) ? array.find(predicate) : array[0]\n return Guards.isDefined(item) ? item : undefined\n },\n} as const)\n","import type { Guid, Optional } from '../types/common.types'\r\nimport { Guards } from './guards.utils'\r\n\r\n/**\r\n * @fileoverview Utility functions for generating and validating GUIDs (UUID v4).\r\n * This module provides a simple interface for working with GUIDs, including generation and validation.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const GuidHelper = Object.freeze({\r\n /**\r\n * @description Generates a cryptographically-random UUID v4.\r\n * @returns Lowercase UUID v4 string.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n generate(): Guid {\r\n return crypto.randomUUID()\r\n },\r\n\r\n /**\r\n * @description Validates if a value is a valid GUID (UUID v4) and not empty.\r\n * @param value The value to validate.\r\n * @returns True if the value is a valid and non-empty GUID, false otherwise.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isValidGuid(value: Guid): boolean {\r\n const guid = value.toString()\r\n return GuidHelper.isValid(guid) && !GuidHelper.isEmpty(guid)\r\n },\r\n\r\n /**\r\n * @description Validates if a string is a valid UUID v4.\r\n * @param value Candidate string to validate.\r\n * @returns True if the string is a valid UUID v4, false otherwise.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isValid(value: string): value is Guid {\r\n const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i\r\n return uuidRegex.test(value)\r\n },\r\n\r\n /**\r\n * @description Converts a string to a GUID if it's valid.\r\n * @param value The string to convert.\r\n * @returns The GUID if the string is valid, otherwise undefined.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n parse(value: Optional<string>): Optional<Guid> {\r\n if (!Guards.isNullOrEmpty(value) && this.isValid(value) && !this.isEmpty(value)) {\r\n return value\r\n }\r\n return undefined\r\n },\r\n\r\n /**\r\n * @description Checks if a GUID is the empty GUID (all zeros).\r\n * @param value The GUID to check.\r\n * @returns True if the GUID is the empty GUID, false otherwise.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n isEmpty(value: string): boolean {\r\n const emptyGuid = '00000000-0000-0000-0000-000000000000'\r\n return value === emptyGuid\r\n },\r\n} as const)\r\n","import { STATUS_CODES } from '../constants/error.constants'\r\nimport type {\r\n Dictionary,\r\n ErrorResponseDto,\r\n HttpHeaders,\r\n IPaginatedResult,\r\n Optional,\r\n ResponseDto,\r\n SuccessResponseDto,\r\n} from '../types/index'\r\nimport { DateHelper } from './date.utils'\r\nimport { Guards } from './guards.utils'\r\n\r\n/**\r\n * @description This module provides utility functions for handling HTTP-related tasks, such as normalizing HTTP headers. It includes a single function, `normalizeHeaders`, which takes an input of unknown type and returns an object with normalized header values. The function ensures that all header values are converted to strings, and if a header value is an array, it joins the elements into a single string separated by commas. This utility is useful for ensuring consistent header formats when working with various HTTP client libraries.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n\r\n/**\r\n * @description A helper object that provides utility functions for HTTP-related tasks. Currently, it includes a method for normalizing HTTP headers, which ensures that all header values are strings and handles cases where header values may be arrays. This helper can be extended in the future to include additional HTTP-related utilities as needed.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const HttpHelper = Object.freeze({\r\n /**\r\n * @description A function that masks the IP address in the given headers object.\r\n * @param ip The IP address to mask.\r\n * @returns The masked IP address.\r\n */\r\n maskIp(ip: Optional<string>): Optional<string> {\r\n if (!Guards.isDefined(ip)) return undefined\r\n\r\n if (ip.includes('.')) {\r\n const parts = ip.split('.')\r\n if (parts.length === 4) {\r\n parts[3] = 'x'\r\n return parts.join('.')\r\n }\r\n }\r\n\r\n if (ip.includes(':')) {\r\n const parts = ip.split(':')\r\n if (parts.length > 0) {\r\n parts[parts.length - 1] = 'x'\r\n return parts.join(':')\r\n }\r\n }\r\n\r\n return ip\r\n },\r\n /**\r\n * @description Normalizes HTTP headers by converting all header values to strings. If a header value is an array, it joins the array elements into a single string separated by commas. This method ensures that the headers are in a consistent format, which can be particularly useful when working with different HTTP client libraries that may represent headers in various ways. If the input headers are not defined or not an object, it returns an empty object.\r\n * @param headers The input headers to be normalized, which can be of any type. The method checks if the headers are defined and are an object before processing them.\r\n * @returns An object containing the normalized headers, where each header value is a string. If the input headers were not valid, it returns an empty object.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n normalizeHeaders(headers: unknown): HttpHeaders {\r\n if (!Guards.isDefined(headers) || !Guards.isObject(headers)) return {}\r\n\r\n const normalized: HttpHeaders = {}\r\n for (const [key, value] of Object.entries(headers as Dictionary)) {\r\n if (!Guards.isDefined(value)) {\r\n continue\r\n }\r\n\r\n normalized[key] = Array.isArray(value)\r\n ? value.map((part) => String(part)).join(',')\r\n : String(value)\r\n }\r\n\r\n return normalized\r\n },\r\n /**\r\n * @description Sanitizes the origin URL by parsing it and extracting the origin part. If the URL is not valid or cannot be parsed or does not contain an origin, it returns undefined.\r\n * @param url The URL to be sanitized.\r\n * @returns The sanitized origin URL or undefined if the URL is not valid or cannot be parsed or does not contain an origin.\r\n *\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n sanitizeOriginUrl(url: Optional<string>): Optional<string> {\r\n if (!Guards.isDefined(url)) return undefined\r\n try {\r\n const parsed = new URL(url)\r\n return parsed.origin\r\n } catch {\r\n return undefined\r\n }\r\n },\r\n /**\r\n * @description Generates a standardized successful HTTP response with the provided data, status code, metadata, and custom headers. The response includes a success flag set to true, the data payload, and any additional metadata. The headers include a default 'Content-Type' of 'application/json' along with any custom headers provided.\r\n * @param data The actual data payload to be included in the successful response. This can be of any type and will be wrapped in a SuccessResponseDto structure.\r\n * @param status The HTTP status code for the response, defaulting to 200 (OK) if not provided. This allows for flexibility in indicating different types of successful responses (e.g., 201 for created, 204 for no content).\r\n * @param meta Optional metadata to be included in the response. This can contain additional information relevant to the response, such as pagination details, rate limit information, or any other contextual data that may be useful for clients consuming the API.\r\n * @param customHeaders Optional custom HTTP headers to be included in the response. This allows for adding any additional headers that may be necessary for specific responses, such as caching directives, custom authentication headers, or other relevant information.\r\n * @returns A ResponseDto object representing the successful HTTP response, containing the status code, success flag, headers, and data payload structured as a SuccessResponseDto.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n success<T>(\r\n data: T | IPaginatedResult<T>,\r\n status = 200,\r\n meta: Dictionary = {},\r\n customHeaders: HttpHeaders = {},\r\n ): ResponseDto<T> {\r\n const successPayload: SuccessResponseDto<T> = {\r\n success: true,\r\n data,\r\n meta,\r\n }\r\n\r\n return {\r\n status,\r\n ok: true,\r\n headers: {\r\n ...customHeaders,\r\n 'Content-Type': ['application/json'],\r\n },\r\n data: successPayload,\r\n }\r\n },\r\n\r\n /**\r\n * @description Generates a standardized error HTTP response with the provided error details, status code, correlation ID, request ID, timestamp, and custom headers. The response includes a success flag set to false, an error object containing the error code, message, and optional details, as well as metadata such as correlation ID and request ID for tracking purposes. The headers include a default 'Content-Type' of 'application/json' along with any custom headers provided.\r\n * @param dto An object containing the error details, including the error code, message, optional details, and optional path. This information is structured as an ErrorResponseDto and provides context about the error that occurred.\r\n * @param status The HTTP status code for the response, defaulting to 500 (Internal Server Error) if not provided. This allows for flexibility in indicating different types of error responses (e.g., 400 for bad request, 404 for not found).\r\n * @param customHeaders Optional custom HTTP headers to be included in the response. This allows for adding any additional headers that may be necessary for specific error responses, such as caching directives, custom authentication headers, or other relevant information.\r\n * @returns A ResponseDto object representing the error HTTP response, containing the status code, success flag, headers, and data payload structured as an ErrorResponseDto.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n error<T>(\r\n dto: ErrorResponseDto,\r\n status: Optional<number> = STATUS_CODES.INTERNAL_SERVER_ERROR,\r\n customHeaders: Optional<HttpHeaders> = undefined,\r\n ): ResponseDto<T> {\r\n const errorPayload: ErrorResponseDto = {\r\n success: false,\r\n error: {\r\n code: dto.error.code,\r\n message: dto.error.message,\r\n details: dto.error.details,\r\n path: dto.error.path,\r\n },\r\n correlationId: dto.correlationId,\r\n requestId: dto.requestId,\r\n spanId: dto.spanId,\r\n timestamp: DateHelper.toISOString(new Date()),\r\n }\r\n\r\n return {\r\n status,\r\n ok: false,\r\n headers: {\r\n 'Content-Type': ['application/json'],\r\n 'X-Correlation-Id': [dto.correlationId],\r\n 'X-Request-Id': [dto.requestId],\r\n 'X-Span-Id': [dto.spanId ?? ''],\r\n 'Cache-Control': ['no-store, no-cache, must-revalidate, proxy-revalidate'],\r\n 'Pragma': ['no-cache'],\r\n 'Expires': ['0'],\r\n ...(customHeaders ?? {}),\r\n },\r\n data: errorPayload,\r\n }\r\n },\r\n} as const)\r\n","import type { Optional } from '../types'\r\nimport { Guards } from './guards.utils'\r\n\r\n/**\r\n * @description Namespace for safe mathematical operations.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const MathHelper = Object.freeze({\r\n /**\r\n * @description Constrains a value within an inclusive min-max range.\r\n * @param value Input value.\r\n * @param min Minimum bound.\r\n * @param max Maximum bound.\r\n * @returns Clamped value.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n clamp(value: number, min: number, max: number): number {\r\n return Math.min(Math.max(value, min), max)\r\n },\r\n\r\n /**\r\n * @description Rounds a number to the specified decimal precision.\r\n * @param value Input value.\r\n * @param decimals Number of decimal places.\r\n * @returns Rounded value.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n roundTo(value: number, decimals: number): number {\r\n const factor = 10 ** decimals\r\n return Math.round(value * factor) / factor\r\n },\r\n\r\n /**\r\n * @description Divides two numbers, returning a safe fallback on zero denominator.\r\n * @param numerator Numerator.\r\n * @param denominator Denominator.\r\n * @param fallback Return value when denominator is zero.\r\n * @returns Division result or fallback.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n safeDivide(numerator: number, denominator: number, fallback = 0): number {\r\n if (denominator === 0) return fallback\r\n return numerator / denominator\r\n },\r\n\r\n /**\r\n * @description Returns the percentage of part over total (0–100 scale).\r\n * @param part Part value.\r\n * @param total Total value.\r\n * @returns Percentage or 0 when total is zero.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n toPercentage(part: number, total: number): number {\r\n if (total === 0) return 0\r\n return (part / total) * 100\r\n },\r\n /**\r\n * @description Converts a value to a number, returning a fallback for non-numeric inputs.\r\n * @param value Input value.\r\n * @param fallback Fallback value for non-numeric inputs.\r\n * @returns Numeric value or fallback.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n toNumber(value: Optional<unknown>, fallback = 0): number {\r\n if (!Guards.isDefined(value) || !Guards.isNumber(value)) return fallback\r\n const num = Number(value)\r\n return isNaN(num) ? fallback : num\r\n },\r\n} as const)\r\n","/**\r\n * @description Fornisce utilità per la gestione avanzata di Promise, ritardi asincroni e concorrenza.\r\n * Astrae le logiche di timing per renderle facilmente testabili e riutilizzabili.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const PromiseHelper = Object.freeze({\r\n /**\r\n * @description Sospende l'esecuzione asincrona per un numero esatto di millisecondi.\r\n * @param ms I millisecondi di attesa.\r\n * @returns Una Promise che si risolve al termine del tempo.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n delay(ms: number): Promise<void> {\r\n return new Promise((resolve) => setTimeout(resolve, ms))\r\n },\r\n\r\n /**\r\n * @description Introduce un ritardo asincrono composto da un tempo base più una variazione casuale.\r\n * Fondamentale per mitigare il \"Thundering Herd problem\" (effetto gregge) distribuendo\r\n * nel tempo i retry simultanei di più client.\r\n * * @param baseDelayMs Il ritardo minimo garantito.\r\n * @param maxJitterMs La variazione massima casuale aggiuntiva.\r\n * @returns Una Promise che si risolve al termine del calcolo.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n delayWithJitter(baseDelayMs: number, maxJitterMs: number): Promise<void> {\r\n const jitter = Math.floor(Math.random() * maxJitterMs)\r\n return new Promise((resolve) => setTimeout(resolve, baseDelayMs + jitter))\r\n },\r\n} as const)\r\n","import type { Optional } from '../types/index'\r\nimport { Guards } from './guards.utils'\r\n\r\nconst start = String.fromCharCode(0)\r\nconst end = String.fromCharCode(31)\r\nconst del = String.fromCharCode(127)\r\n\r\nconst CONTROL_CHARS_REGEX = new RegExp(`[\\\\r\\\\n\\\\t${start}-${end}${del}]`, 'g')\r\nconst DANGEROUS_PROTOCOLS_REGEX = /^(javascript|data|vbscript):/i\r\n\r\n/**\r\n * @description Centralized security utility for data and context sanitization.\r\n * Enforces OWASP guidelines preventing Log Injection (CWE-117), CRLF injection,\r\n * and URI protocol manipulation across all application layers.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const SanitizeHelper = Object.freeze({\r\n /**\r\n * @description Removes carriage returns, line feeds, null bytes, and non-printable control characters.\r\n * Mitigates Log Forging and Log Injection attacks (CWE-117).\r\n * @param value The candidate string to sanitize.\r\n * @param maxLength Maximum allowable length after sanitization. Defaults to 256.\r\n * @returns Sanitized string or undefined if empty/non-string.\r\n */\r\n stripControlChars(value: Optional<string>, maxLength = 256): Optional<string> {\r\n if (Guards.isNullOrEmpty(value)) return undefined\r\n const clean = value.replace(CONTROL_CHARS_REGEX, '').trim()\r\n if (Guards.isNullOrEmpty(clean)) return undefined\r\n return clean.slice(0, maxLength)\r\n },\r\n\r\n /**\r\n * @description Sanitizes navigation paths and URLs, removing control characters\r\n * and preventing execution of dangerous pseudo-protocols (e.g. javascript:, data:).\r\n * @param path The path string to sanitize.\r\n * @param maxLength Maximum length of the path. Defaults to 512.\r\n * @returns Sanitized path or '/' fallback for unsafe inputs.\r\n */\r\n sanitizePath(path: Optional<string>, maxLength = 512): Optional<string> {\r\n if (Guards.isNullOrEmpty(path)) return undefined\r\n const clean = path.replace(CONTROL_CHARS_REGEX, '').trim()\r\n if (Guards.isNullOrEmpty(clean) || DANGEROUS_PROTOCOLS_REGEX.test(clean)) {\r\n return '/'\r\n }\r\n return clean.slice(0, maxLength)\r\n },\r\n\r\n /**\r\n * @description Sanitizes an array of strings (e.g. roles, permissions, scopes).\r\n * Strips control characters, filters out empty entries, and limits collection size.\r\n * @param items Array of strings to sanitize.\r\n * @param maxItemLength Maximum allowable character length per item. Defaults to 64.\r\n * @param maxItems Maximum total number of elements kept. Defaults to 50.\r\n * @returns Immutable array of sanitized strings.\r\n */\r\n sanitizeStringArray(\r\n items: Optional<string[]>,\r\n maxItemLength = 64,\r\n maxItems = 50,\r\n ): Optional<string[]> {\r\n if (Guards.isNullOrEmpty(items)) return undefined\r\n const sanitized = items\r\n .slice(0, maxItems)\r\n .map((item) => SanitizeHelper.stripControlChars(item, maxItemLength))\r\n .filter((item): item is string => Guards.isDefined(item))\r\n\r\n return sanitized\r\n },\r\n} as const)\r\n","import type { Dictionary, Optional } from '../types/index'\r\nimport { Guards } from './guards.utils'\r\n\r\n/**\r\n * @description Namespace for string manipulation utilities.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport const StringHelper = Object.freeze({\r\n /**\r\n * @description Safely converts a value to a JSON string, falling back to String() on failure.\r\n * @param value The value to stringify.\r\n * @returns A JSON string representation of the value, or a fallback string if serialization fails.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n safeStringify<T>(value: T): string {\r\n try {\r\n return JSON.stringify(value)\r\n } catch {\r\n return String(value)\r\n }\r\n },\r\n\r\n /**\r\n * @description Safely parses a JSON string, returning a fallback value on failure.\r\n * @param input The JSON string to parse.\r\n * @param fallback Optional fallback value to return if parsing fails.\r\n * @returns The parsed value, or the fallback value if parsing fails.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n safeParse<T = unknown>(input: string, fallback: Optional<T> = undefined): T | Optional<string> {\r\n try {\r\n return JSON.parse(input) as T\r\n } catch {\r\n return fallback ?? input\r\n }\r\n },\r\n\r\n /**\r\n * @description Converts a string to camelCase.\r\n * @param input Input string (supports snake_case, kebab-case, or space-separated).\r\n * @returns camelCase string.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n camelCase(input: string): string {\r\n const segments = input.split(/[-_\\s]+/)\r\n const [first, ...rest] = segments\r\n const head = Guards.isDefined(first) ? first.toLowerCase() : ''\r\n return head + rest.map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1)).join('')\r\n },\r\n\r\n /**\r\n * @description Interpolates {{key}} placeholders in a template string.\r\n * @param template Template string with {{key}} tokens.\r\n * @param vars Key-value substitution map.\r\n * @returns Interpolated string with resolved placeholders.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n interpolate(template: string, vars: Readonly<Dictionary<string | number>>): string {\r\n return template.replace(/\\{\\{(\\w+)\\}\\}/g, (_match, key: string) => {\r\n const value = vars[key]\r\n return Guards.isDefined(value) ? String(value) : `{{${key}}}`\r\n })\r\n },\r\n\r\n /**\r\n * @description Truncates a string to maxLength, appending a suffix when truncated.\r\n * @param input Input string.\r\n * @param maxLength Maximum character length including the suffix.\r\n * @param suffix Appended suffix on truncation.\r\n * @returns Truncated string.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n truncate(input: string, maxLength: number, suffix = '…'): string {\r\n if (input.length <= maxLength) return input\r\n const cutAt = Math.max(0, maxLength - suffix.length)\r\n return input.slice(0, cutAt) + suffix\r\n },\r\n\r\n /**\r\n * @description Generates a reference code with a prefix, random alphanumeric part, and year.\r\n * @param prefix Custom prefix for the reference code (e.g., \"TRV\" for travel).\r\n * @returns Formatted reference code string.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n generateReferenceCode(prefix: string): string {\r\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'\r\n let randomPart = ''\r\n for (let i = 0; i < 6; i++) {\r\n randomPart += chars.charAt(Math.floor(Math.random() * chars.length))\r\n }\r\n const year = new Date().getFullYear()\r\n return `${prefix}-${randomPart}-${year}` // Es: TRV-XJ82L9-2026\r\n },\r\n\r\n /**\r\n * @description Extracts a single string value from a header that may be a string or an array of strings.\r\n * @param value The header value, which can be a string or an array of strings.\r\n * @returns The first string value if it's an array, the string itself if it's a string, or undefined if it's empty or not defined.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n getSingleValue(\r\n value: Optional<string | string[]>,\r\n separator?: Optional<string>,\r\n ): Optional<string> {\r\n if (!Guards.isDefined(value)) return value\r\n\r\n if (Guards.isArray(value)) {\r\n if (Guards.isNullOrEmpty(value)) {\r\n return undefined\r\n }\r\n if (Guards.isDefined(separator))\r\n return StringHelper.getSingleValueWithSplit(value[0], separator)\r\n return value[0]\r\n }\r\n if (Guards.isDefined(separator)) return StringHelper.getSingleValueWithSplit(value, separator)\r\n return value\r\n },\r\n\r\n getSingleValueWithSplit(value: string, separator: string): string {\r\n if (value.includes(separator)) return value.split(separator)[0].trim()\r\n return value\r\n },\r\n} as const)\r\n","import type { ICommand } from '@/domain'\r\nimport type { RequestType } from '@/shared'\r\nimport { REQUEST_TYPE } from '@/shared'\r\n\r\n/**\r\n * @description Base class for all commands.\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport abstract class Command<TResponse = unknown> implements ICommand<TResponse> {\r\n public readonly type: RequestType = REQUEST_TYPE.COMMAND\r\n\r\n constructor(readonly intent: string) {}\r\n}\r\n","import type { IQuery } from '@/domain'\r\nimport type { ICacheableOptions, RequestType } from '@/shared'\r\nimport { REQUEST_TYPE } from '@/shared'\r\n\r\n/**\r\n * @description Base class for all queries.\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport abstract class Query<TResponse = unknown> implements IQuery<TResponse> {\r\n public readonly type: RequestType = REQUEST_TYPE.QUERY\r\n\r\n constructor(\r\n readonly intent: string,\r\n readonly cacheOptions: ICacheableOptions,\r\n ) {}\r\n}\r\n","import type { LoggerContext, RequestContext } from '@/domain'\r\nimport { HttpHelper, type Optional } from '@/shared'\r\n\r\n/**\r\n * @description LoggerUtils provides utility functions for working with LoggerContext objects.\r\n */\r\nexport const LoggerUtils = Object.freeze({\r\n /**\r\n * @description toSafeContext converts a RequestContext object to a LoggerContext object, ensuring that only the necessary fields are included.\r\n * @param ctx The RequestContext object to convert.\r\n * @returns The converted LoggerContext object.\r\n */\r\n toSafeContext(ctx: Optional<RequestContext>): LoggerContext {\r\n return {\r\n identity: {\r\n userId: ctx?.identity?.userId,\r\n tenantId: ctx?.identity?.tenantId,\r\n },\r\n network: {\r\n requestId: ctx?.network?.requestId,\r\n path: ctx?.network?.path,\r\n origin: ctx?.network?.origin,\r\n clientIp: HttpHelper.maskIp(ctx?.network?.clientIp),\r\n },\r\n tracing: {\r\n correlationId: ctx?.tracing?.correlationId,\r\n spanId: ctx?.tracing?.spanId,\r\n startTime: ctx?.tracing?.startTime,\r\n parentSpanId: ctx?.tracing.parentSpanId,\r\n },\r\n messaging: ctx?.messaging,\r\n }\r\n },\r\n} as const)\r\n","import type { IContextAccessor, ILogger, ILoggerClient, RequestContext } from '@/domain'\r\nimport type { LogLevel, Optional } from '@/shared'\r\nimport { LOG_LEVEL, LOG_LEVEL_NAMES } from '@/shared'\r\n\r\nimport { LoggerUtils } from './utils'\r\n\r\n/**\r\n * @description Concrete implementation of the ILogger interface that serves as a central logging service within the application. This class is designed to broadcast log messages to multiple logging clients (implementations of ILoggerClient) that are injected via the constructor. The BaseLogger class provides methods for logging messages at different levels (info, warn, debug, error) and ensures that only messages that meet or exceed the specified minimum log level are forwarded to the registered logging clients. This design allows for flexibility in logging, enabling the use of various logging providers (e.g., Sentry, Pino) without coupling the application code to specific logging frameworks.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport class BaseLogger implements ILogger {\r\n // ─── Private Fields ─────────────────────────────────────────────────────────\r\n private readonly _minLevel: LogLevel\r\n private readonly _loggers: ILoggerClient[]\r\n\r\n /**\r\n * @description Constructs a new instance of the BaseLogger class, which takes an array of ILoggerClient instances and an optional minimum log level. The ILoggerClient instances represent the various logging providers that will receive log messages from this logger. The minimum log level determines the threshold for logging messages, where messages with a log level below the specified minimum will not be forwarded to the logging clients. This allows for efficient logging by filtering out less critical log messages based on the configured log level.\r\n * @param _requestContext The request context that provides contextual information for log messages, such as request-specific data or metadata.\r\n * @param config The minimum log level for this logger instance. Only messages with a log level equal to or higher than this level will be processed and forwarded to the logging clients.\r\n * @param loggers An array of ILoggerClient instances that will receive log messages from this logger. Each ILoggerClient represents a different logging provider or destination (e.g., console, file, external service).\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n constructor(\r\n private readonly _requestContext: IContextAccessor<RequestContext>,\r\n config: LogLevel,\r\n loggers: ILoggerClient[],\r\n ) {\r\n this._minLevel = config\r\n this._loggers = loggers\r\n }\r\n\r\n public info(message: string): void {\r\n this.broadcast(LOG_LEVEL.INFO, message)\r\n }\r\n\r\n public warn(message: string): void {\r\n this.broadcast(LOG_LEVEL.WARN, message)\r\n }\r\n\r\n public debug(message: string): void {\r\n this.broadcast(LOG_LEVEL.DEBUG, message)\r\n }\r\n\r\n public error(message: string, error: unknown): void {\r\n this.broadcast(LOG_LEVEL.ERROR, message, error)\r\n }\r\n\r\n /**\r\n * @description Private method to broadcast log messages to all registered ILoggerClient instances. This method checks if the log level of the message meets or exceeds the configured minimum log level before forwarding the message to the logging clients. It iterates through the array of ILoggerClient instances and calls their track method with the appropriate parameters (log level, message, context, and error if applicable). This design allows for efficient logging by ensuring that only relevant log messages are processed and forwarded to the logging clients based on the configured log level.\r\n * @param level The log level of the message.\r\n * @param message The log message.\r\n * @param context Optional context information to include with the log message.\r\n * @param error Optional error object to include with the log message.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n private broadcast(level: LogLevel, message: string, error: Optional<unknown> = undefined): void {\r\n if (level < this._minLevel) return\r\n\r\n const logMessage = `[${LOG_LEVEL_NAMES[level]}] ${message}`\r\n const context = this._requestContext.getContext()\r\n const safeContext = LoggerUtils.toSafeContext(context)\r\n for (const logger of this._loggers) {\r\n logger.track(level, logMessage, safeContext, error)\r\n }\r\n }\r\n}\r\n","import type { Guid } from '@/shared'\r\nimport { Guards, GuidHelper } from '@/shared'\r\n\r\n/**\r\n * A class representing a unique identifier (UUID v4) for entities in the domain.\r\n * This class encapsulates the generation and representation of unique identifiers.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport class UniqueId {\r\n /**\r\n * Private constructor to prevent direct instantiation. Use the static method `create` to generate a new unique identifier.\r\n * @param _value The string representation of the unique identifier (UUID v4).\r\n * @returns A new instance of UniqueId with a generated UUID v4.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n private constructor(private readonly _value: Guid) {\r\n Object.freeze(this)\r\n }\r\n\r\n /**\r\n * Static factory method to create a new UniqueId instance with a generated UUID v4.\r\n * @returns A new instance of UniqueId with a generated UUID v4.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public static create(id?: string): UniqueId {\r\n const uniqueId =\r\n !Guards.isNullOrEmpty(id) && GuidHelper.isValid(id) ? id : GuidHelper.generate()\r\n return new UniqueId(uniqueId)\r\n }\r\n\r\n /**\r\n * Returns the string representation of the unique identifier.\r\n * @returns The string representation of the unique identifier (UUID v4).\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public toString(): string {\r\n return this._value.toString()\r\n }\r\n\r\n /**\r\n * Returns the underlying GUID value of the UniqueId instance.\r\n * @returns The GUID value of the UniqueId instance.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public getValue(): Guid {\r\n return this._value\r\n }\r\n\r\n /**\r\n * Compares this UniqueId with another for equality based on their string values.\r\n * @param other The other UniqueId to compare with.\r\n * @returns True if both UniqueIds have the same string value, false otherwise.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public equals(other: UniqueId): boolean {\r\n if (!(other instanceof UniqueId)) {\r\n return false\r\n }\r\n return this._value === other.getValue()\r\n }\r\n}\r\n","import type { Optional } from '@/shared'\r\nimport { Guards, GuidHelper } from '@/shared'\r\n\r\nimport { UniqueId } from '../unique_id/unique-id'\r\nimport type { IEntity } from './ientity.contracts'\r\n/**\r\n * A base class representing a generic entity in the domain. An entity is an object that has a unique identity and is defined by its properties.\r\n *\r\n * @template T - The type of the properties of the entity.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport abstract class Entity<T> implements IEntity<T> {\r\n public readonly id: UniqueId\r\n\r\n /**\r\n * The properties of the entity. This is a private property that holds the state of the entity. It should be accessed and modified through methods defined in the concrete entity classes to ensure encapsulation and maintain invariants.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n private readonly props: T\r\n\r\n /**\r\n * Protected constructor to prevent direct instantiation. Concrete entity classes should extend this base class and call this constructor with the appropriate properties and an optional unique identifier.\r\n *\r\n * @param props - The properties of the entity.\r\n * @param id - An optional unique identifier for the entity. If not provided, a new UniqueId will be generated.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n protected constructor(props: T, id: Optional<string> = undefined) {\r\n if (Guards.isNullOrEmpty(id) || GuidHelper.isValid(id)) {\r\n this.id = UniqueId.create(id)\r\n } else {\r\n throw new Error(`Invalid UniqueId provided: ${id}.`)\r\n }\r\n this.props = Object.freeze({ ...props })\r\n Object.freeze(this)\r\n }\r\n\r\n public getProps(): T {\r\n return structuredClone(this.props)\r\n }\r\n\r\n public getId(): UniqueId {\r\n return this.id\r\n }\r\n}\r\n","import type { Maybe, Optional } from '@/shared'\r\nimport { ERROR_CODE_MESSAGES, ERROR_CODES, Guards, STATUS_CODES } from '@/shared'\r\n/**\r\n * A class representing an application error, which extends the built-in Error class.\r\n * It includes additional properties such as an error code and an HTTP status code.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\ninterface ErrorPayload {\r\n /** The error message describing the error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n message: string\r\n /** The error code representing the type of error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n code: string\r\n /** The HTTP status code associated with the error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n status: number\r\n /** The name of the error, typically the class name.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n name: string\r\n /** An optional property to hold the original error or any additional context.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n cause: Optional<unknown>\r\n /** A Dictionary to hold any additional context or information related to the error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n [key: string]: unknown\r\n}\r\n\r\n/**\r\n * A class representing an application error, which extends the built-in Error class.\r\n * It includes additional properties such as an error code and an HTTP status code.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport class AppError extends Error {\r\n /**\r\n * The error code representing the type of error.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public readonly code: string\r\n /**\r\n * The HTTP status code associated with the error.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public readonly status: number\r\n\r\n /**\r\n * A Dictionary to hold any additional context or information related to the error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n readonly [key: string]: unknown\r\n\r\n /**\r\n * Private constructor to prevent direct instantiation. Use the static methods `create` and `throw` to create instances.\r\n *\r\n * @param payload - The payload containing error details.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n private constructor(payload: ErrorPayload) {\r\n super(payload.message)\r\n this.code = payload.code\r\n this.status = payload.status\r\n Object.assign(this, payload)\r\n }\r\n\r\n /**\r\n * Creates an AppError instance with the given error payload.\r\n *\r\n * @param payload - The payload containing error details.\r\n * @returns An AppError instance representing the error.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public static create(payload: ErrorPayload): AppError {\r\n return new AppError(payload)\r\n }\r\n\r\n /**\r\n * Creates an AppError instance and throws it immediately.\r\n * @param payload - The payload containing error details.\r\n * @throws An AppError instance representing the error.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public static throw(payload: ErrorPayload): never {\r\n throw new AppError(payload)\r\n }\r\n\r\n /**\r\n * Creates an AppError instance representing an aborted request.\r\n * @param name - The name of the error, typically the class name or context where the error occurred.\r\n * @returns An AppError instance representing the aborted request error.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public static aborted(name: string): AppError {\r\n return new AppError({\r\n code: ERROR_CODES.ABORTED,\r\n message: ERROR_CODE_MESSAGES[ERROR_CODES.ABORTED],\r\n status: STATUS_CODES.ABORTED,\r\n name,\r\n cause: new Error('The client closed the connection before the server finished responding.'),\r\n })\r\n }\r\n\r\n /**\r\n * Utility method to check if an AbortSignal has been triggered and throw an AppError if it has.\r\n * @param signal - The AbortSignal to check for abortion.\r\n * @param name - The name of the error, typically the class name or context where the error occurred.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public static throwIfAborted(signal: Maybe<AbortSignal>, name: string): void {\r\n if (Guards.isDefined(signal) && signal.aborted) {\r\n throw AppError.aborted(name)\r\n }\r\n }\r\n\r\n /** @description Creates an AppError instance representing an unauthorized access error. This method is used to generate a standardized error response when a user attempts to access a resource or perform an action without the necessary authentication or authorization.\r\n * @param name The name of the error, typically the class name or context where the error occurred. This helps in identifying the source of the error in logs and error reports.\r\n * @param message A custom message describing the reason for the unauthorized access. This message is included in the AppError's cause for detailed error reporting.\r\n * @returns An AppError instance representing the unauthorized access error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n public static unauthorized(name: string, message: string): AppError {\r\n return AppError.create({\r\n code: ERROR_CODES.UNAUTHORIZED,\r\n message: ERROR_CODE_MESSAGES[ERROR_CODES.UNAUTHORIZED],\r\n status: STATUS_CODES.UNAUTHORIZED,\r\n name,\r\n cause: new Error(message),\r\n header: { 'WWW-Authenticate': ['Bearer realm=\"api\"'] },\r\n })\r\n }\r\n\r\n public static notSupported(name: string, message: string): AppError {\r\n return AppError.create({\r\n code: ERROR_CODES.NOT_ALLOWED,\r\n message: ERROR_CODE_MESSAGES[ERROR_CODES.NOT_ALLOWED],\r\n status: STATUS_CODES.NOT_ALLOWED,\r\n name,\r\n cause: new Error(message),\r\n })\r\n }\r\n\r\n /** @description Creates an AppError instance representing a forbidden access error. This method is used to generate a standardized error response when a user attempts to access a resource or perform an action that they are not authorized to access, even if they are authenticated.\r\n * @param name The name of the error, typically the class name or context where the error occurred. This helps in identifying the source of the error in logs and error reports.\r\n * @param message A custom message describing the reason for the forbidden access. This message is included in the AppError's cause for detailed error reporting.\r\n * @returns An AppError instance representing the forbidden access error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n public static forbidden(name: string, message: string): AppError {\r\n return AppError.create({\r\n code: ERROR_CODES.FORBIDDEN,\r\n message: ERROR_CODE_MESSAGES[ERROR_CODES.FORBIDDEN],\r\n status: STATUS_CODES.FORBIDDEN,\r\n name,\r\n cause: new Error(message),\r\n })\r\n }\r\n\r\n /** @description Creates an AppError instance representing a bad request error. This method is used to generate a standardized error response when a request made by the client is invalid or cannot be processed due to client-side issues, such as validation errors or malformed requests.\r\n * @param name The name of the error, typically the class name or context where the error occurred. This helps in identifying the source of the error in logs and error reports.\r\n * @param message A custom message describing the reason for the bad request. This message is included in the AppError's cause for detailed error reporting.\r\n * @returns An AppError instance representing the bad request error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n public static badRequest(name: string, message: string): AppError {\r\n return AppError.create({\r\n code: ERROR_CODES.BAD_REQUEST,\r\n message: ERROR_CODE_MESSAGES[ERROR_CODES.BAD_REQUEST],\r\n status: STATUS_CODES.BAD_REQUEST,\r\n name,\r\n cause: new Error(message),\r\n })\r\n }\r\n\r\n /** @description Creates an AppError instance representing a validation error. This method is used to generate a standardized error response when one or more input fields fail invariant or schema validation, indicating that the request cannot be processed due to invalid data.\r\n * @param name The name of the error, typically the class name or context where the error occurred. This helps in identifying the source of the error in logs and error reports.\r\n * @param message A custom message describing the reason for the validation failure. This message is included in the AppError's cause for detailed error reporting.\r\n * @returns An AppError instance representing the validation error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n public static validationError(name: string, message: string): AppError {\r\n return AppError.create({\r\n code: ERROR_CODES.VALIDATION_FAILED,\r\n message: ERROR_CODE_MESSAGES[ERROR_CODES.VALIDATION_FAILED],\r\n status: STATUS_CODES.BAD_REQUEST,\r\n name,\r\n cause: new Error(message),\r\n })\r\n }\r\n\r\n /** @description Creates an AppError instance representing a conflict error. This method is used to generate a standardized error response when a request conflicts with the current state of the resource, such as when attempting to create a resource that already exists or update a resource that has been modified by another process.\r\n * @param name The name of the error, typically the class name or context where the error occurred. This helps in identifying the source of the error in logs and error reports.\r\n * @param message A custom message describing the reason for the conflict. This message is included in the AppError's cause for detailed error reporting.\r\n * @returns An AppError instance representing the conflict error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n public static conflict(name: string, message: string): AppError {\r\n return AppError.create({\r\n code: ERROR_CODES.CONFLICT,\r\n message: ERROR_CODE_MESSAGES[ERROR_CODES.CONFLICT],\r\n status: STATUS_CODES.CONFLICT,\r\n name,\r\n cause: new Error(message),\r\n })\r\n }\r\n\r\n /** @description Creates an AppError instance representing a not found error. This method is used to generate a standardized error response when a requested resource does not exist, indicating that the client attempted to access a resource that could not be found on the server.\r\n * @param name The name of the error, typically the class name or context where the error occurred. This helps in identifying the source of the error in logs and error reports.\r\n * @param message A custom message describing the reason for the not found error. This message is included in the AppError's cause for detailed error reporting.\r\n * @returns An AppError instance representing the not found error.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n public static notFound(name: string, message: string): AppError {\r\n return AppError.create({\r\n code: ERROR_CODES.NOT_FOUND,\r\n message: ERROR_CODE_MESSAGES[ERROR_CODES.NOT_FOUND],\r\n status: STATUS_CODES.NOT_FOUND,\r\n name,\r\n cause: new Error(message),\r\n })\r\n }\r\n\r\n /** @description Creates an AppError instance representing a Authentication failed. This method is used to generate a standardized error response when an auth requested produce an error..\r\n * @param name The name of the error, typically the class name or context where the error occurred. This helps in identifying the source of the error in logs and error reports.\r\n * @param message A custom message describing the reason for the Authentication failed. This message is included in the AppError's cause for detailed error reporting.\r\n * @returns An AppError instance representing the Authentication failed.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n public static authFailed(name: string, message: string): AppError {\r\n return AppError.create({\r\n code: ERROR_CODES.AUTHENTICATION_FAILED,\r\n message: ERROR_CODE_MESSAGES[ERROR_CODES.AUTHENTICATION_FAILED],\r\n name,\r\n status: STATUS_CODES.UNAUTHORIZED,\r\n cause: new Error(message),\r\n })\r\n }\r\n}\r\n","import type { Optional } from '@/shared'\r\n\r\n/**\r\n * A class representing the result of an operation, which can either be a success or a failure.\r\n * It encapsulates the value of a successful operation or the error of a failed operation.\r\n *\r\n * @template TValue - The type of the value in case of a successful operation.\r\n * @template TError - The type of the error in case of a failed operation (default is never).\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport class Result<TValue, TError = never> {\r\n /**\r\n * Indicates whether the operation was successful or not.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n private readonly _isSuccess: boolean\r\n /**\r\n * The error of the operation in case it failed.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n private readonly _error: Optional<TError>\r\n /**\r\n * The value of the operation in case it succeeded.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n private readonly _value: Optional<TValue>\r\n\r\n /**\r\n * Private constructor to prevent direct instantiation. Use the static methods `ok` and `fail` to create instances.\r\n *\r\n * @param isSuccess - A boolean indicating whether the operation was successful.\r\n * @param error - The error of the operation in case it failed (optional).\r\n * @param value - The value of the operation in case it succeeded (optional).\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n private constructor(isSuccess: boolean, error: Optional<TError>, value: Optional<TValue>) {\r\n this._isSuccess = isSuccess\r\n this._error = error\r\n this._value = value\r\n }\r\n\r\n /**\r\n * Creates a successful result with the given value.\r\n *\r\n * @param value - The value of the successful operation.\r\n * @returns A Result instance representing a successful operation.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public static ok<U>(value?: U): Result<U> {\r\n return new Result<U>(true, undefined, value)\r\n }\r\n\r\n /**\r\n * Creates a failed result with the given error.\r\n *\r\n * @param error - The error of the failed operation.\r\n * @returns A Result instance representing a failed operation.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public static fail<U, V = never>(error: V): Result<U, V> {\r\n return new Result<U, V>(false, error, undefined)\r\n }\r\n\r\n /**\r\n * Checks if the result is a success.\r\n *\r\n * @returns True if the result is a success, false otherwise.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public isOk(): boolean {\r\n return this._isSuccess\r\n }\r\n\r\n /**\r\n * Gets the value of the result or throws an error if the result is a failure.\r\n *\r\n * @returns The value of the result.\r\n * @throws An error if the result is a failure.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public getValueOrThrow(): Optional<TValue> {\r\n if (!this._isSuccess) {\r\n throw new Error('Cannot get the value of a failed result.')\r\n }\r\n return this._value\r\n }\r\n\r\n /**\r\n * Gets the error of the result or throws an error if the result is a success.\r\n *\r\n * @returns The error of the result.\r\n * @throws An error if the result is a success.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n public getErrorOrThrow(): TError {\r\n if (this._isSuccess) {\r\n throw new Error('Cannot get the error of a successful result.')\r\n }\r\n return this._error as TError\r\n }\r\n}\r\n","import type { Optional } from '@/shared'\r\nimport { Guards, StringHelper } from '@/shared'\r\n\r\nimport type { IValueObject } from './ivalue-object.contracts'\r\n\r\n/**\r\n * The ValueObject class is an abstract implementation of the IValueObject interface, providing a base class for creating value objects in the domain. A value object is an immutable type that represents a concept or measurement in the domain, and its equality is based on its properties rather than its identity. The ValueObject class includes a constructor that initializes the properties of the value object and an equals method that compares two value objects for equality based on their properties.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport abstract class ValueObject<T extends object> implements IValueObject<T> {\r\n /** @description The properties of the value object, which are immutable and define the value represented by the value object.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n protected readonly _props: T\r\n\r\n protected constructor(props: T) {\r\n this._props = Object.freeze({ ...props })\r\n Object.freeze(this)\r\n }\r\n\r\n public equals(vo: Optional<IValueObject<T>> = undefined): boolean {\r\n if (Guards.isNullOrEmpty(vo) || Guards.isNullOrEmpty(vo.getValue())) {\r\n return false\r\n }\r\n\r\n return StringHelper.safeStringify(this._props) === StringHelper.safeStringify(vo.getValue())\r\n }\r\n\r\n public getValue(): T {\r\n return { ...this._props }\r\n }\r\n\r\n public toString(): string {\r\n return StringHelper.safeStringify(this._props)\r\n }\r\n}\r\n","import type { IStorage } from '@/domain'\nimport type { CookieOptions } from '@/shared'\nimport { Guards } from '@/shared'\n\nexport const createCookieStorage = (opts: CookieOptions): IStorage => ({\n getItem: (key: string): string | null => {\n if (!Guards.isDefined(document)) return null\n const match = new RegExp(`(^| )${encodeURIComponent(key)}=([^;]+)`).exec(document.cookie)\n return Guards.isDefined(match) ? decodeURIComponent(match[2]) : null\n },\n setItem: (key: string, value: string): void => {\n if (!Guards.isDefined(document)) return\n let cookieSuffix = ''\n if (Guards.isDefined(opts.path)) cookieSuffix += `; path=${opts.path}`\n if (Guards.isDefined(opts.maxAge)) cookieSuffix += `; max-age=${opts.maxAge}`\n if (Guards.isDefined(opts.domain)) cookieSuffix += `; domain=${opts.domain}`\n if (Guards.isDefined(opts.secure)) cookieSuffix += `; Secure`\n if (Guards.isDefined(opts.sameSite)) cookieSuffix += `; SameSite=${opts.sameSite}`\n document.cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)}${cookieSuffix}`\n },\n removeItem: (key: string): void => {\n if (!Guards.isDefined(document)) return\n document.cookie = `${encodeURIComponent(key)}=; path=${opts.path ?? '/'}; expires=Thu, 01 Jan 1970 00:00:00 GMT`\n },\n})\n","import type { IStorage } from '@/domain'\n\n// infrastructure/auth/memory-storage.adapter.ts\nexport const createMemoryStorage = (): IStorage => {\n const store = new Map<string, string>()\n return {\n getItem: (key: string): string | null => store.get(key) ?? null,\n setItem: (key: string, value: string): void => {\n store.set(key, value)\n },\n removeItem: (key: string): void => {\n store.delete(key)\n },\n }\n}\n","import type { IStorage } from '@/domain'\nimport type { CookieOptions, Optional } from '@/shared'\nimport { Guards } from '@/shared'\n\nimport { createCookieStorage } from './cookie.storage'\nimport { createMemoryStorage } from './memory.storage'\n\nexport const StorageHelper = Object.freeze({\n create(opts: {\n type: Optional<'local' | 'session' | 'memory' | 'cookie'>\n storage: Optional<IStorage>\n cookieOpts: Optional<CookieOptions>\n }): Optional<IStorage> {\n switch (opts.type) {\n case 'memory':\n return createMemoryStorage()\n case 'cookie':\n if (!Guards.isDefined(opts.cookieOpts)) throw new Error('At least ')\n return createCookieStorage(opts.cookieOpts)\n case 'session':\n return sessionStorage\n case 'local':\n return localStorage\n\n default:\n return opts.storage\n }\n },\n} as const)\n","import type {\r\n Provider,\r\n Session as SupabaseSession,\r\n SupabaseClient,\r\n User,\r\n} from '@supabase/supabase-js'\r\n\r\nimport type { IAuthService, IBaseAuthService, IBaseMapper, ResultType } from '@/domain'\r\nimport { AppError, Result } from '@/domain'\r\nimport type { AuthClaims, Maybe, Optional, Session } from '@/shared'\r\nimport { Guards } from '@/shared'\r\n\r\n/**\r\n * @description The SupabaseAuthService class is responsible for handling authentication-related operations using a SupabaseClient instance. It implements the IAuthService interface, providing methods to check if a user is authenticated and to retrieve authentication claims from a given token. The authenticate method interacts with the Supabase authentication API to fetch user information based on the provided token, while the isAuthenticated method checks if there is an active session. The class also includes error handling to create standardized authentication errors when necessary.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport class SupabaseAuthService implements IBaseAuthService, IAuthService {\r\n constructor(\r\n private readonly _supabase: SupabaseClient,\r\n private readonly _mapper: IBaseMapper<User, AuthClaims>,\r\n private readonly _sessionMapper: IBaseMapper<SupabaseSession, Session>,\r\n private readonly _opts: { redirectTo: Optional<string> },\r\n ) {}\r\n\r\n public async authenticate(token: string): Promise<ResultType<AuthClaims>> {\r\n const { data, error } = await this._supabase.auth.getUser(token)\r\n\r\n if (Guards.isDefined(error) || !Guards.isDefined(data.user)) {\r\n return Result.fail(\r\n AppError.authFailed('SupabaseAuthenticationService', error?.message ?? 'Unknown error'),\r\n )\r\n }\r\n\r\n const user = data.user\r\n const claims = this._mapper.map(user)\r\n return Result.ok(claims)\r\n }\r\n\r\n public async isAuthenticated(): Promise<boolean> {\r\n const session = await this._supabase.auth.getSession()\r\n return Guards.isDefined(session.data.session)\r\n }\r\n\r\n public async exchangeCodeForSession(code: string): Promise<ResultType<Optional<Session>>> {\r\n const { data, error } = await this._supabase.auth.exchangeCodeForSession(code)\r\n if (Guards.isDefined(error) || !Guards.isDefined(data.session))\r\n return Result.fail(\r\n AppError.authFailed('SupabaseAuthenticationService', error?.message ?? 'Unknown error'),\r\n )\r\n\r\n const session = data.session\r\n\r\n if (Guards.isDefined(session)) return Result.ok(this._sessionMapper.map(session))\r\n\r\n return Result.ok()\r\n }\r\n\r\n public async signInWithProvider(provider: Provider): Promise<ResultType<{ url: string }>> {\r\n const { data, error } = await this._supabase.auth.signInWithOAuth({\r\n provider,\r\n options: { redirectTo: this._opts.redirectTo },\r\n })\r\n\r\n if (Guards.isDefined(error) || Guards.isNullOrEmpty(data.url)) {\r\n return Result.fail(\r\n AppError.authFailed('SupabaseFrontendAuthService', error?.message ?? 'Unexpected error'),\r\n )\r\n }\r\n\r\n return Result.ok({ url: data.url })\r\n }\r\n\r\n public async getSession(): Promise<ResultType<Maybe<Session>>> {\r\n const { data, error } = await this._supabase.auth.getSession()\r\n if (Guards.isDefined(error)) {\r\n return Result.fail(AppError.authFailed('SupabaseFrontendAuthService', error.message))\r\n }\r\n\r\n const session = data.session\r\n\r\n if (Guards.isDefined(session)) return Result.ok(this._sessionMapper.map(data.session!))\r\n\r\n return Result.ok()\r\n }\r\n\r\n public async getUser(): Promise<ResultType<Maybe<AuthClaims>>> {\r\n const { data, error } = await this._supabase.auth.getUser()\r\n if (Guards.isDefined(error)) {\r\n return Result.fail(AppError.authFailed('SupabaseFrontendAuthService', error.message))\r\n }\r\n const user = data.user\r\n if (Guards.isDefined(user)) return Result.ok(this._mapper.map(user))\r\n\r\n return Result.ok()\r\n }\r\n\r\n public async signOut(): Promise<ResultType<void>> {\r\n const { error } = await this._supabase.auth.signOut()\r\n if (Guards.isDefined(error)) {\r\n return Result.fail(AppError.authFailed('SupabaseFrontendAuthService', error.message))\r\n }\r\n return Result.ok()\r\n }\r\n\r\n public async getSessionToken(): Promise<ResultType<Optional<string>>> {\r\n const sessionResult = await this.getSession()\r\n if (!sessionResult.isOk()) {\r\n return Result.fail(sessionResult.getErrorOrThrow())\r\n }\r\n const session = sessionResult.getValueOrThrow()\r\n return Result.ok(session?.accessToken)\r\n }\r\n}\r\n","import type { ICache } from '@/domain'\r\nimport type { Optional } from '@/shared'\r\nimport { Guards, StringHelper } from '@/shared'\r\n\r\n/**\r\n * @description The InMemoryCache class provides an implementation of the ICache interface using an in-memory Map to store cached values. This class allows for storing, retrieving, and managing cached values in memory, supporting features such as time-to-live (TTL) for cache entries and atomic operations for setting values only if they do not already exist. The InMemoryCache class is a simple and efficient caching solution for scenarios where a lightweight, in-memory cache is sufficient, such as during development or for caching non-critical data that does not require persistence across application restarts.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport class InMemoryCache implements ICache {\r\n /**\r\n * @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.\r\n * @param _cache An optional Map instance to use as the underlying storage for the cache. If not provided, a new Map will be created to store cached values.\r\n \r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\n constructor(\r\n private _cache: Map<string, { value: string; expiresAt: Optional<number> }> = new Map(),\r\n ) {}\r\n\r\n public async get<T>(key: string): Promise<Optional<T>> {\r\n const entry = this._cache.get(key)\r\n if (!Guards.isDefined(entry)) {\r\n return undefined\r\n }\r\n if (Guards.isDefined(entry.expiresAt) && entry.expiresAt < Date.now()) {\r\n this._cache.delete(key)\r\n return undefined\r\n }\r\n return JSON.parse(entry.value) as T\r\n }\r\n\r\n public async set<T>(key: string, value: T, ttl: Optional<number>): Promise<void> {\r\n const expiresAt = Guards.isDefined(ttl) ? Date.now() + ttl * 1000 : undefined\r\n this._cache.set(key, { value: StringHelper.safeStringify(value), expiresAt })\r\n }\r\n\r\n public async setIfAbsent<T>(key: string, value: T, ttl: Optional<number>): Promise<boolean> {\r\n if (this._cache.has(key)) {\r\n return false\r\n }\r\n await this.set(key, value, ttl)\r\n return true\r\n }\r\n\r\n public async remove(key: string): Promise<void> {\r\n this._cache.delete(key)\r\n }\r\n\r\n public async has(key: string): Promise<boolean> {\r\n const entry = this._cache.get(key)\r\n if (!Guards.isDefined(entry)) {\r\n return false\r\n }\r\n if (Guards.isDefined(entry.expiresAt) && entry.expiresAt < Date.now()) {\r\n this._cache.delete(key)\r\n return false\r\n }\r\n return true\r\n }\r\n\r\n public async clear(): Promise<void> {\r\n this._cache.clear()\r\n }\r\n}\r\n","import type { ICacheKeyBuilder, IIdentityAccessor } from '@/domain'\r\nimport { Guards } from '@/shared'\r\n\r\n/**\r\n * @description The CacheKeyBuilder class implements the ICacheKeyBuilder interface, providing a method to build contextual cache keys based on the user's identity. This class utilizes an instance of IIdentityAccessor to retrieve the current user's identity, allowing for the creation of tenant-specific cache keys in multi-tenant applications. If a tenant ID is present in the identity, the cache key is prefixed with the tenant ID; otherwise, it defaults to a public cache key. This approach ensures that cached data is appropriately scoped to the user's context, preventing data leakage between tenants.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport class CacheKeyBuilder implements ICacheKeyBuilder {\r\n /**\r\n * @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.\r\n * @param _identityAccessor An instance of IIdentityAccessor used to retrieve the current user's identity, allowing for the construction of tenant-specific cache keys.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n constructor(private readonly _identityAccessor: IIdentityAccessor) {}\r\n\r\n public buildContextualKey(key: string): string {\r\n const identity = this._identityAccessor.getIdentity()\r\n\r\n if (Guards.isDefined(identity) && !Guards.isNullOrEmpty(identity.tenantId)) {\r\n return `tenant:${identity.tenantId}:${key}`\r\n }\r\n\r\n return `${key}:public`\r\n }\r\n\r\n public buildUserScopedKey(key: string): string {\r\n const identity = this._identityAccessor.getIdentity()\r\n\r\n if (Guards.isDefined(identity) && !Guards.isNullOrEmpty(identity.userId)) {\r\n return this.buildContextualKey(`user:${identity.userId}:${key}`)\r\n }\r\n\r\n return this.buildContextualKey(key)\r\n }\r\n}\r\n","import axios from 'axios'\r\n\r\nimport type { IFactory, IHttpClient } from '@/domain'\r\nimport type { HttpClientConfig } from '@/domain'\r\n\r\nimport { AxiosHttpClient } from '../http/axios.http'\r\n\r\n/**\r\n * @description Factory class responsible for creating instances of AxiosHttpClient based on the provided configuration. It implements the IFactory interface, allowing for easy integration with dependency injection systems. The factory encapsulates the creation logic for the AxiosHttpClient, including the initialization of the underlying Axios instance with the specified configuration options such as base URL, default headers, and timeout settings. This design promotes separation of concerns and allows for flexibility in managing AxiosHttpClient instances across the application.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport class AxiosFactory implements IFactory<HttpClientConfig, IHttpClient> {\r\n public create(config: HttpClientConfig): IHttpClient {\r\n const axiosInstance = axios.create({\r\n baseURL: config.baseURL,\r\n headers: config.defaultHeaders,\r\n timeout: config.timeoutMs,\r\n maxRedirects: config.maxRedirects ?? 5,\r\n decompress: config.decompress ?? true,\r\n proxy: config.proxy,\r\n withCredentials: config.withCredentials,\r\n })\r\n\r\n return new AxiosHttpClient(axiosInstance)\r\n }\r\n}\r\n","import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'\nimport { AxiosError } from 'axios'\n\nimport type { IHttpClient } from '@/domain'\nimport { AppError } from '@/domain'\nimport type { HttpOptions, HttpRequest, HttpResponse, Optional } from '@/shared'\nimport { ERROR_CODE_MESSAGES, ERROR_CODES, Guards, HttpHelper, STATUS_CODES } from '@/shared'\n\nexport class AxiosHttpClient implements IHttpClient {\n constructor(private readonly _client: AxiosInstance) {}\n\n private async executInAsync<TResponse = unknown>(\n callback: () => Promise<HttpResponse<TResponse>>,\n opts: { signal: Optional<AbortSignal>; name: string },\n ): Promise<HttpResponse<TResponse>> {\n AppError.throwIfAborted(opts.signal, opts.name)\n\n try {\n return await callback()\n } catch (error: unknown) {\n this.handleError(error, 'AxiosHttpClient.get')\n }\n }\n\n public async get<TResponse = unknown>(\n url: string,\n options?: Optional<Omit<HttpRequest<never>, HttpOptions>>,\n ): Promise<HttpResponse<TResponse>> {\n return await this.executInAsync(\n async () => {\n const response = await this._client.get<TResponse>(url, this.buildConfig(options))\n return this.handleResponse(response)\n },\n { signal: options?.signal, name: 'AxiosHttpClient.get' },\n )\n }\n\n public async post<TResponse = unknown, TBody = unknown>(\n url: string,\n body?: Optional<TBody>,\n options?: Optional<Omit<HttpRequest<TBody>, HttpOptions>>,\n ): Promise<HttpResponse<TResponse>> {\n return await this.executInAsync(\n async () => {\n const response = await this._client.post<TResponse>(url, body, this.buildConfig(options))\n return this.handleResponse(response)\n },\n { signal: options?.signal, name: 'AxiosHttpClient.post' },\n )\n }\n\n public async put<TResponse = unknown, TBody = unknown>(\n url: string,\n body?: Optional<TBody>,\n options?: Optional<Omit<HttpRequest<TBody>, HttpOptions>>,\n ): Promise<HttpResponse<TResponse>> {\n return await this.executInAsync(\n async () => {\n const response = await this._client.put<TResponse>(url, body, this.buildConfig(options))\n return this.handleResponse(response)\n },\n { signal: options?.signal, name: 'AxiosHttpClient.put' },\n )\n }\n\n public async patch<TResponse = unknown, TBody = unknown>(\n url: string,\n body?: Optional<TBody>,\n options?: Optional<Omit<HttpRequest<TBody>, HttpOptions>>,\n ): Promise<HttpResponse<TResponse>> {\n return await this.executInAsync(\n async () => {\n const response = await this._client.patch<TResponse>(url, body, this.buildConfig(options))\n return this.handleResponse(response)\n },\n { signal: options?.signal, name: 'AxiosHttpClient.patch' },\n )\n }\n\n public async delete<TResponse = unknown>(\n url: string,\n options?: Optional<Omit<HttpRequest<never>, HttpOptions>>,\n ): Promise<HttpResponse<TResponse>> {\n return await this.executInAsync(\n async () => {\n const response = await this._client.delete<TResponse>(url, this.buildConfig(options))\n return this.handleResponse(response)\n },\n { signal: options?.signal, name: 'AxiosHttpClient.delete' },\n )\n }\n\n private buildConfig(\n options?: Optional<Omit<HttpRequest<unknown>, HttpOptions>>,\n ): AxiosRequestConfig {\n return {\n headers: options?.headers,\n params: options?.query,\n signal: options?.signal,\n timeout: options?.timeoutMs,\n validateStatus: () => true,\n }\n }\n\n private handleResponse<TResponse>(response: AxiosResponse<TResponse>): HttpResponse<TResponse> {\n if (!Guards.isDefined(response.status) || response.status >= 400) {\n AppError.throw({\n code: ERROR_CODES.EXTERNAL_SERVICE_ERROR,\n message: ERROR_CODE_MESSAGES[ERROR_CODES.EXTERNAL_SERVICE_ERROR],\n status: response.status,\n name: 'AxiosHttpClientException',\n cause: new AxiosError(\n `Request failed with status code ${response.status}`,\n undefined,\n response.config,\n response.request,\n response,\n ),\n })\n }\n\n return {\n status: response.status,\n ok: response.status >= 200 && response.status < 300,\n headers: HttpHelper.normalizeHeaders(response.headers),\n data: response.data,\n }\n }\n\n private handleError(error: unknown, name: string): never {\n if (error instanceof AppError) throw error\n\n const status =\n error instanceof AxiosError && Guards.isDefined(error.response)\n ? error.response.status\n : STATUS_CODES.INTERNAL_SERVER_ERROR\n\n AppError.throw({\n code: ERROR_CODES.EXTERNAL_SERVICE_ERROR,\n message: ERROR_CODE_MESSAGES[ERROR_CODES.EXTERNAL_SERVICE_ERROR],\n status,\n name,\n cause: error,\n })\n }\n}\n","import type { User } from '@supabase/supabase-js'\r\n\r\nimport type { IBaseMapper } from '@/domain'\r\nimport type { AuthClaims } from '@/shared'\r\nimport { Guards } from '@/shared'\r\n\r\n/**\r\n * @description SupabaseClaimsMapper is responsible for mapping authentication claims (AuthClaims) to an Identity object. This mapper takes the claims extracted from a token (such as a JWT) and transforms them into a structured Identity that can be used throughout the application for authentication and authorization purposes. The mapping includes parsing the user ID and tenant ID from the claims, as well as extracting roles and permissions.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport class SupabaseClaimsMapper implements IBaseMapper<User, AuthClaims> {\r\n public map(user: User): AuthClaims {\r\n const appMetadata = user.app_metadata ?? {}\r\n\r\n return {\r\n sub: user.id,\r\n email: user.email,\r\n name: Guards.isString(user.user_metadata?.['name'])\r\n ? user.user_metadata?.['name']\r\n : undefined,\r\n tenantId: Guards.isString(appMetadata?.['tenant_id'])\r\n ? appMetadata?.['tenant_id']\r\n : undefined,\r\n roles: Guards.isArray(appMetadata['roles']) ? (appMetadata['roles'] as string[]) : undefined,\r\n permissions: Guards.isArray(appMetadata['permissions'])\r\n ? (appMetadata['permissions'] as string[])\r\n : undefined,\r\n }\r\n }\r\n}\r\n","// infrastructure/mappers/supabase-session.mapper.ts\r\nimport type { Session as SupabaseSession, User } from '@supabase/supabase-js'\r\n\r\nimport type { IBaseMapper } from '@/domain'\r\nimport type { AuthClaims, Session } from '@/shared'\r\n\r\nexport class SupabaseSessionMapper implements IBaseMapper<SupabaseSession, Session> {\r\n constructor(private readonly _claimsMapper: IBaseMapper<User, AuthClaims>) {}\r\n\r\n public map(source: SupabaseSession): Session {\r\n const claims = this._claimsMapper.map(source.user)\r\n return {\r\n accessToken: source.access_token,\r\n refreshToken: source.refresh_token,\r\n expiresAt: source.expires_at,\r\n user: claims,\r\n }\r\n }\r\n}\r\n","import { z } from 'zod'\r\n\r\nimport { REQUEST_TYPE } from '@/shared'\r\n\r\n/**\r\n * @description Base schema for any Request\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const baseCommandZodSchema = z.object({\r\n intent: z.string().min(1, 'Intent is required'),\r\n type: z.literal(REQUEST_TYPE.COMMAND),\r\n})\r\n\r\n/**\r\n * @description Base schema for any Command\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nconst queryZodSchema = z.object({\r\n intent: z.string().min(1, 'Intent is required'),\r\n type: z.literal(REQUEST_TYPE.QUERY),\r\n})\r\n\r\nconst cacheableOptionsZodSchema = z.object({\r\n cacheKey: z.string().min(1, 'Cache key is required'),\r\n ttl: z.number().int().positive().optional(),\r\n bypassCache: z.boolean().optional(),\r\n consistentRead: z.boolean().optional(),\r\n})\r\n\r\n/**\r\n * @description Base schema for any Query\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const baseQueryZodSchema = queryZodSchema.extend({\r\n cacheOptions: cacheableOptionsZodSchema,\r\n})\r\n","import type { z } from 'zod'\r\n\r\nimport { baseCommandZodSchema, baseQueryZodSchema } from './base-schema.constant'\r\n\r\n/**\r\n * @description Utility functions for creating Zod schemas for commands and queries.\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\nexport const ZodUtils = Object.freeze({\r\n /**\r\n * @description Creates a Zod schema for a command by extending the base command schema with additional properties.\r\n * @param additionalSchema - An object representing additional properties to be added to the command schema.\r\n * @returns A Zod schema for the command.\r\n */\r\n createCommandSchema: (additionalSchema: z.ZodRawShape) => {\r\n return baseCommandZodSchema.extend(additionalSchema).strict()\r\n },\r\n /**\r\n * @description Creates a Zod schema for a query by extending the base query schema with additional properties.\r\n * @param additionalSchema - An object representing additional properties to be added to the query schema.\r\n * @returns A Zod schema for the query.\r\n */\r\n createQuerySchema: (additionalSchema: z.ZodRawShape) => {\r\n return baseQueryZodSchema.extend(additionalSchema).strict()\r\n },\r\n})\r\n","import type { core, ZodType } from 'zod'\r\n\r\nimport type { ILogger, IValidatorService, ResultType } from '@/domain'\r\nimport { AppError, Result } from '@/domain'\r\nimport { Guards } from '@/shared'\r\n\r\n/**\r\n * @description Implementation of the IValidatorService interface using Zod schemas for validation. This service maintains a registry of Zod schemas identified by unique keys and provides methods to check for the existence of a schema and to validate data against a specified schema. The validate method returns a ResultType indicating success or failure, with detailed error information in case of validation failure, including formatted error messages from Zod.\r\n\r\n * \r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js \r\n */\r\nexport class ZodValidatorService implements IValidatorService {\r\n /**\r\n * @description Constructs a new instance of the ZodValidatorService class, which takes an ICache instance as a parameter. This cache is used to store and manage the validation schemas that will be applied to incoming data. The constructor initializes the service with the provided cache, allowing it to perform validation checks based on the cached schemas when the validate method is called.\r\n *\r\n * @param _cache An instance of ICache used to store and retrieve Zod schemas. This cache is essential for the operation of the validator service, as it allows it to look up and apply the correct schema for validating incoming data.\r\n * @param _logger An instance of ILogger used to log warning when schema was not found.\r\n *\r\n * @author Xeno\r\n * @version 1.0.0\r\n * @since 2025-09-30\r\n * @link https://github.com/xeno-js/xeno-js\r\n */\r\n constructor(\r\n private readonly _cache: Map<string, ZodType> = new Map(),\r\n private readonly _logger: ILogger,\r\n ) {}\r\n\r\n private static formatIssue(issue: core.$ZodIssue): string {\r\n const issuePath = !Guards.isNullOrEmpty(issue.path) ? issue.path.map(String).join('.') : 'root'\r\n\r\n return `[${issuePath}] ${issue.message}`\r\n }\r\n\r\n public addSchema(key: string, schema: ZodType): void {\r\n this._cache.set(key, schema)\r\n }\r\n\r\n public async validate<T>(key: string, data: T): Promise<ResultType<boolean>> {\r\n const schema = this._cache.get(key)\r\n if (!Guards.isDefined(schema)) {\r\n this._logger.warn(`Schema for intent: ${key} was not found`)\r\n return Result.ok()\r\n }\r\n\r\n const zodResult = schema.safeParse(data)\r\n\r\n if (!zodResult.success) {\r\n const errorMessage = zodResult.error.issues\r\n .map((issue) => ZodValidatorService.formatIssue(issue))\r\n .join(', ')\r\n\r\n return Result.fail(\r\n AppError.validationError(\r\n 'ZodValidatorService',\r\n `Validation failed for schema: ${errorMessage}`,\r\n ),\r\n )\r\n }\r\n\r\n return Result.ok(true)\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,IAAM,sBAAsB,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAU/C,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUb,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUZ,YAAY;AACd,CAAU;;;AC7BH,IAAM,cAAc,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;A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