@xeno-js/shared 0.1.6 → 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.
package/dist/index.d.cts CHANGED
@@ -2,6 +2,82 @@ import { SupabaseClient, User, Session as Session$1, Provider as Provider$1 } fr
2
2
  import { AxiosInstance } from 'axios';
3
3
  import { z, ZodType } from 'zod';
4
4
 
5
+ /**
6
+ * @description DomainEvent is an interface that represents a domain event in the application. It defines the structure and properties of a domain event, which is a message that is published when a significant change
7
+ * occurs within the domain. Domain events are used to notify other parts of the application about these changes and trigger appropriate actions.
8
+ *
9
+ * @author Xeno
10
+ * @version 1.0.0
11
+ */
12
+ interface IDomainEvent<TPayload = unknown, TValueObject extends object = object> {
13
+ /**
14
+ * @description The unique identifier of the aggregate that triggered the domain event.
15
+ */
16
+ readonly aggregateId: TValueObject;
17
+ /**
18
+ * @description The type of the domain event.
19
+ */
20
+ readonly eventType: string;
21
+ /**
22
+ * @description The version of the domain event.
23
+ */
24
+ readonly version: number;
25
+ /**
26
+ * @description The timestamp when the domain event occurred.
27
+ */
28
+ readonly occurredAt: Date;
29
+ /**
30
+ * @description The payload of the domain event, containing the specific data related to the event.
31
+ */
32
+ readonly payload: TPayload;
33
+ }
34
+
35
+ /**
36
+ * The IValueObject interface defines the contract for 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 IValueObject interface includes methods for retrieving the underlying value, comparing value objects for equality, and providing a string representation of the value object.
37
+
38
+ *
39
+ * @author Xeno
40
+ * @version 1.0.0
41
+ * @since 2025-09-30
42
+ * @link https://github.com/xeno-js/xeno-js
43
+ */
44
+ interface IValueObject<T extends object> {
45
+ /**
46
+ * Retrieves the underlying value of the value object. This method provides access to the encapsulated data, allowing it to be used in comparisons, transformations, or other operations while maintaining the integrity and immutability of the value object.
47
+ * @returns The underlying value of the value object.
48
+
49
+ *
50
+ * @author Xeno
51
+ * @version 1.0.0
52
+ * @since 2025-09-30
53
+ * @link https://github.com/xeno-js/xeno-js
54
+ */
55
+ getValue(): T;
56
+ /**
57
+ * Compares the current value object with another value object for equality. This method checks if the underlying values of both value objects are equal, allowing for meaningful comparisons between value objects based on their encapsulated data rather than their reference identity.
58
+ * @param other The other value object to compare with the current value object.
59
+ * @returns True if the underlying values of both value objects are equal; otherwise, returns false.
60
+
61
+ *
62
+ * @author Xeno
63
+ * @version 1.0.0
64
+ * @since 2025-09-30
65
+ * @link https://github.com/xeno-js/xeno-js
66
+ */
67
+ equals(other: IValueObject<T>): boolean;
68
+ /**
69
+ * Returns a string representation of the value object. This method can be used for debugging, logging, or any scenario where a human-readable representation of the value object is needed. The string representation should ideally include relevant information about the underlying value to provide context when the value object is printed or logged.
70
+ * @returns A string representation of the value object.
71
+
72
+ *
73
+ * @author Xeno
74
+ * @version 1.0.0
75
+ * @since 2025-09-30
76
+ * @link https://github.com/xeno-js/xeno-js
77
+ */
78
+ toString(): string;
79
+ }
80
+
5
81
  /**
6
82
  * @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.
7
83
 
@@ -785,25 +861,14 @@ type Permission = (typeof PERMISSIONS)[keyof typeof PERMISSIONS];
785
861
  * @description This file defines the tokens used for dependency injection in the application.
786
862
  * Tokens are unique identifiers that are used to register and resolve dependencies in the container.
787
863
  * They can be symbols, strings, or classes, but using symbols is a common practice to avoid naming collisions.
788
-
789
- *
790
- * @author Xeno
791
- * @version 1.0.0
792
- * @since 2025-09-30
793
- * @link https://github.com/xeno-js/xeno-js
794
- */
864
+ *
865
+ * @author Xeno
866
+ * @version 1.0.0
867
+ * @since 2025-09-30
868
+ * @link https://github.com/xeno-js/xeno-js
869
+ */
795
870
  declare const TOKENS: Readonly<{
796
- readonly ALLOW_ORIGIN: "ALLOW_ORIGIN";
797
- readonly ALLOW_METHOD: "ALLOW_METHOD";
798
- /** @description Token used to register and resolve the AuthorizationPipeline instance in the dependency injection container.
799
- *
800
- * @author Xeno
801
- * @version 1.0.0
802
- * @since 2025-09-30
803
- * @link https://github.com/xeno-js/xeno-js
804
- */
805
- readonly AUTHORIZATION_PIPELINE: "AUTHORIZATION_PIPELINE";
806
- /** @description Token used to register and resolve the AuthService instance in the dependency injection container.
871
+ /** @description Token used to register and resolve the Extendend AuthService instance in the dependency injection container.
807
872
  *
808
873
  * @author Xeno
809
874
  * @version 1.0.0
@@ -811,15 +876,14 @@ declare const TOKENS: Readonly<{
811
876
  * @link https://github.com/xeno-js/xeno-js
812
877
  */
813
878
  readonly AUTH_SERVICE: "AUTH_SERVICE";
814
- readonly BASE_AUTH_SERVICE: "BASE_AUTH_SERVICE";
815
- /** @description Token used to register and resolve the BearerTokenExtractor instance in the dependency injection container.
879
+ /** @description Token used to register and resolve the BaseAuthService instance in the dependency injection container.
816
880
  *
817
881
  * @author Xeno
818
882
  * @version 1.0.0
819
883
  * @since 2025-09-30
820
884
  * @link https://github.com/xeno-js/xeno-js
821
885
  */
822
- readonly BEARER_TOKEN_EXTRACTOR: "BEARER_TOKEN_EXTRACTOR";
886
+ readonly BASE_AUTH_SERVICE: "BASE_AUTH_SERVICE";
823
887
  /** @description Token used to register and resolve the InMemoryCache instance in the dependency injection container.
824
888
  *
825
889
  * @author Xeno
@@ -836,14 +900,6 @@ declare const TOKENS: Readonly<{
836
900
  * @link https://github.com/xeno-js/xeno-js
837
901
  */
838
902
  readonly CACHE_KEY_BUILDER: "CACHE_KEY_BUILDER";
839
- /** @description Token used to register and resolve the ClaimsIdentityMapper instance in the dependency injection container.
840
- *
841
- * @author Xeno
842
- * @version 1.0.0
843
- * @since 2025-09-30
844
- * @link https://github.com/xeno-js/xeno-js
845
- */
846
- readonly CLAIMS_IDENTITY_MAPPER: "CLAIMS_IDENTITY_MAPPER";
847
903
  /** @description Token used to register and resolve command pipeline behaviors in the dependency injection container.
848
904
  *
849
905
  * @author Xeno
@@ -852,22 +908,6 @@ declare const TOKENS: Readonly<{
852
908
  * @link https://github.com/xeno-js/xeno-js
853
909
  */
854
910
  readonly COMMAND_PIPELINES_BEHAVIOR: "COMMAND_PIPELINES_BEHAVIOR";
855
- /** @description Token used to register and resolve the CompositePipeline instance in the dependency injection container.
856
- *
857
- * @author Xeno
858
- * @version 1.0.0
859
- * @since 2025-09-30
860
- * @link https://github.com/xeno-js/xeno-js
861
- */
862
- readonly COMPOSITE_PIPELINE: "COMPOSITE_PIPELINE";
863
- /** @description Token used to register and resolve the ConcurrencyRetryPipeline instance in the dependency injection container.
864
- *
865
- * @author Xeno
866
- * @version 1.0.0
867
- * @since 2025-09-30
868
- * @link https://github.com/xeno-js/xeno-js
869
- */
870
- readonly CONCURRENCY_RETRY_PIPELINE: "CONCURRENCY_RETRY_PIPELINE";
871
911
  /** @description Token used to register and resolve the ConcurrencyService instance in the dependency injection container.
872
912
  *
873
913
  * @author Xeno
@@ -884,14 +924,6 @@ declare const TOKENS: Readonly<{
884
924
  * @link https://github.com/xeno-js/xeno-js
885
925
  */
886
926
  readonly CONFIGURATION_SERVICE: "CONFIGURATION_SERVICE";
887
- /** @description Token used to register and resolve the ConsoleLogger instance in the dependency injection container.
888
- *
889
- * @author Xeno
890
- * @version 1.0.0
891
- * @since 2025-09-30
892
- * @link https://github.com/xeno-js/xeno-js
893
- */
894
- readonly CONSOLE_LOGGER: "CONSOLE_LOGGER";
895
927
  /** @description Token used to register and resolve the ContextAccessor instance in the dependency injection container.
896
928
  *
897
929
  * @author Xeno
@@ -900,46 +932,30 @@ declare const TOKENS: Readonly<{
900
932
  * @link https://github.com/xeno-js/xeno-js
901
933
  */
902
934
  readonly CONTEXT_ACCESSOR: "CONTEXT_ACCESSOR";
903
- /** @description Token used to register and resolve the DbContext instance in the dependency injection container.
935
+ /** @description Token used to register and resolve the CryptoService instance in the dependency injection container.
904
936
  *
905
937
  * @author Xeno
906
938
  * @version 1.0.0
907
939
  * @since 2025-09-30
908
940
  * @link https://github.com/xeno-js/xeno-js
909
941
  */
910
- readonly DB_CONTEXT: "DB_CONTEXT";
911
- /** @description Token used to register and resolve the ExceptionPipeline instance in the dependency injection container.
942
+ readonly CRYPTO_SERVICE: "CRYPTO_SERVICE";
943
+ /** @description Token used to register and resolve the CsrfTokenService instance in the dependency injection container.
912
944
  *
913
945
  * @author Xeno
914
946
  * @version 1.0.0
915
947
  * @since 2025-09-30
916
948
  * @link https://github.com/xeno-js/xeno-js
917
949
  */
918
- readonly EXCEPTION_PIPELINE: "EXCEPTION_PIPELINE";
919
- /** @description Token used to register and resolve the GateKeeper instance in the dependency injection container.
920
- *
921
- * @author Xeno
922
- * @version 1.0.0
923
- * @since 2025-09-30
924
- * @link https://github.com/xeno-js/xeno-js
925
- */
926
- readonly GATE_KEEPER: "GATE_KEEPER";
927
- /** @description Token used to register and resolve the IdempotencyPipeline instance in the dependency injection container.
928
- *
929
- * @author Xeno
930
- * @version 1.0.0
931
- * @since 2025-09-30
932
- * @link https://github.com/xeno-js/xeno-js
933
- */
934
- readonly IDEMPOTENCY_PIPELINE: "IDEMPOTENCY_PIPELINE";
935
- /** @description Token used to register and resolve the IdempotencyStore instance in the dependency injection container.
950
+ readonly CSRF_TOKEN_SERVICE: "CSRF_TOKEN_SERVICE";
951
+ /** @description Token used to register and resolve the DbContext instance in the dependency injection container.
936
952
  *
937
953
  * @author Xeno
938
954
  * @version 1.0.0
939
955
  * @since 2025-09-30
940
956
  * @link https://github.com/xeno-js/xeno-js
941
957
  */
942
- readonly IDEMPOTENCY_STORE: "IDEMPOTENCY_STORE";
958
+ readonly DB_CONTEXT: "DB_CONTEXT";
943
959
  /** @description Token used to register and resolve the IdentityAccessor instance in the dependency injection container.
944
960
  *
945
961
  * @author Xeno
@@ -956,22 +972,6 @@ declare const TOKENS: Readonly<{
956
972
  * @link https://github.com/xeno-js/xeno-js
957
973
  */
958
974
  readonly LOGGER: "LOGGER";
959
- /** @description Token used to register and resolve the LoggerConfig instance in the dependency injection container.
960
- *
961
- * @author Xeno
962
- * @version 1.0.0
963
- * @since 2025-09-30
964
- * @link https://github.com/xeno-js/xeno-js
965
- */
966
- readonly LOGGER_CONFIG: "LOGGER_CONFIG";
967
- /** @description Token used to register and resolve the LoggingPipeline instance in the dependency injection container.
968
- *
969
- * @author Xeno
970
- * @version 1.0.0
971
- * @since 2025-09-30
972
- * @link https://github.com/xeno-js/xeno-js
973
- */
974
- readonly LOGGING_PIPELINE: "LOGGING_PIPELINE";
975
975
  /** @description Token used to register and resolve the Mediator instance in the dependency injection container.
976
976
  *
977
977
  * @author Xeno
@@ -980,46 +980,14 @@ declare const TOKENS: Readonly<{
980
980
  * @link https://github.com/xeno-js/xeno-js
981
981
  */
982
982
  readonly MEDIATOR: "MEDIATOR";
983
- /** @description Token used to register and resolve the PerformancePipeline instance in the dependency injection container.
984
- *
985
- * @author Xeno
986
- * @version 1.0.0
987
- * @since 2025-09-30
988
- * @link https://github.com/xeno-js/xeno-js
989
- */
990
- readonly PERFORMANCE_PIPELINE: "PERFORMANCE_PIPELINE";
991
- /** @description Token used to register and resolve the PermissionAuthorizationPipeline instance in the dependency injection container.
992
- *
993
- * @author Xeno
994
- * @version 1.0.0
995
- * @since 2025-09-30
996
- * @link https://github.com/xeno-js/xeno-js
997
- */
998
- readonly PERMISSION_AUTHORIZATION_PIPELINE: "PERMISSION_AUTHORIZATION_PIPELINE";
999
- /** @description Token used to register and resolve the PinoLogger instance in the dependency injection container.
983
+ /** @description Token used to register and resolve the NetworkContextFactory in the dependency injection container.
1000
984
  *
1001
985
  * @author Xeno
1002
986
  * @version 1.0.0
1003
987
  * @since 2025-09-30
1004
988
  * @link https://github.com/xeno-js/xeno-js
1005
989
  */
1006
- readonly PINO_LOGGER: "PINO_LOGGER";
1007
- /** @description Token used to register and resolve the PolicyRegistry instance in the dependency injection container.
1008
- *
1009
- * @author Xeno
1010
- * @version 1.0.0
1011
- * @since 2025-09-30
1012
- * @link https://github.com/xeno-js/xeno-js
1013
- */
1014
- readonly POLICY_REGISTRY: "POLICY_REGISTRY";
1015
- /** @description Token used to register and resolve the QueryCachingPipeline instance in the dependency injection container.
1016
- *
1017
- * @author Xeno
1018
- * @version 1.0.0
1019
- * @since 2025-09-30
1020
- * @link https://github.com/xeno-js/xeno-js
1021
- */
1022
- readonly QUERY_CACHING_PIPELINE: "QUERY_CACHING_PIPELINE";
990
+ readonly NETWORK_CONTEXT_ACCESSOR: "NETWORK_CONTEXT_ACCESSOR";
1023
991
  /** @description Token used to register and resolve query pipeline behaviors in the dependency injection container.
1024
992
  *
1025
993
  * @author Xeno
@@ -1036,7 +1004,7 @@ declare const TOKENS: Readonly<{
1036
1004
  * @link https://github.com/xeno-js/xeno-js
1037
1005
  */
1038
1006
  readonly REQUEST_CONTEXT: "REQUEST_CONTEXT";
1039
- /** @description Token used to register and resolve the RequestContextMiddleware in the dependency injection container.
1007
+ /** @description Token used to register and resolve the CompositeMiddleware in the dependency injection container.
1040
1008
  *
1041
1009
  * @author Xeno
1042
1010
  * @version 1.0.0
@@ -1044,14 +1012,6 @@ declare const TOKENS: Readonly<{
1044
1012
  * @link https://github.com/xeno-js/xeno-js
1045
1013
  */
1046
1014
  readonly MIDDLEWARE: "MIDDLEWARE";
1047
- readonly AUTH_MIDDLEWARE: "AUTH_MIDDLEWARE";
1048
- readonly CSRF_MIDDLEWARE: "CSRF_MIDDLEWARE";
1049
- readonly ALLOW_ORIGIN_MIDDLEWARE: "ALLOW_ORIGIN_MIDDLEWARE";
1050
- readonly CORS_MIDDLEWARE: "CORS_MIDDLEWARE";
1051
- readonly METHOD_CHECK_MIDDLEWARE: "METHOD_CHECK_MIDDLEWARE";
1052
- readonly OPTIONS_MIDDLEWARE: "OPTIONS_MIDDLEWARE";
1053
- readonly REQUEST_CONTEXT_MIDDLEWARE: "REQUEST_CONTEXT_MIDDLEWARE";
1054
- readonly RATE_LIMITER_MIDDLEWARE: "RATE_LIMITER_MIDDLEWARE";
1055
1015
  /** @description Token used to register and resolve the IServiceResilience instance in the dependency injection container.
1056
1016
  *
1057
1017
  * @author Xeno
@@ -1060,14 +1020,6 @@ declare const TOKENS: Readonly<{
1060
1020
  * @link https://github.com/xeno-js/xeno-js
1061
1021
  */
1062
1022
  readonly RESILIENCE_CLIENT: "RESILIENCE_CLIENT";
1063
- /** @description Token used to register and resolve the RoleAuthorizationPipeline instance in the dependency injection container.
1064
- *
1065
- * @author Xeno
1066
- * @version 1.0.0
1067
- * @since 2025-09-30
1068
- * @link https://github.com/xeno-js/xeno-js
1069
- */
1070
- readonly ROLE_AUTHORIZATION_PIPELINE: "ROLE_AUTHORIZATION_PIPELINE";
1071
1023
  /** @description Token used to register and resolve the SchemaValidationStrategy instance in the dependency injection container.
1072
1024
  *
1073
1025
  * @author Xeno
@@ -1076,14 +1028,6 @@ declare const TOKENS: Readonly<{
1076
1028
  * @link https://github.com/xeno-js/xeno-js
1077
1029
  */
1078
1030
  readonly SCHEMA_VALIDATION_STRATEGY: "SCHEMA_VALIDATION_STRATEGY";
1079
- /** @description Token used to register and resolve the SentryLogger instance in the dependency injection container.
1080
- *
1081
- * @author Xeno
1082
- * @version 1.0.0
1083
- * @since 2025-09-30
1084
- * @link https://github.com/xeno-js/xeno-js
1085
- */
1086
- readonly SENTRY_LOGGER: "SENTRY_LOGGER";
1087
1031
  /** @description Token used to register and resolve the ServiceContainer instance in the dependency injection container.
1088
1032
  *
1089
1033
  * @author Xeno
@@ -1100,22 +1044,14 @@ declare const TOKENS: Readonly<{
1100
1044
  * @link https://github.com/xeno-js/xeno-js
1101
1045
  */
1102
1046
  readonly SERVICE_EXTRACTOR: "SERVICE_EXTRACTOR";
1103
- /** @description Token used to register and resolve the ServiceScopeFactory instance in the dependency injection container.
1047
+ /** @description Token used to register and resolve the ServiceScopeAccessor in the dependency injection container.
1104
1048
  *
1105
1049
  * @author Xeno
1106
1050
  * @version 1.0.0
1107
1051
  * @since 2025-09-30
1108
1052
  * @link https://github.com/xeno-js/xeno-js
1109
1053
  */
1110
- readonly SERVICE_SCOPE_FACTORY: "SERVICE_SCOPE_FACTORY";
1111
- /** @description Token used to register and resolve the TenantAuthorizationPipeline instance in the dependency injection container.
1112
- *
1113
- * @author Xeno
1114
- * @version 1.0.0
1115
- * @since 2025-09-30
1116
- * @link https://github.com/xeno-js/xeno-js
1117
- */
1118
- readonly TENANT_AUTHORIZATION_PIPELINE: "TENANT_AUTHORIZATION_PIPELINE";
1054
+ readonly SERVICE_SCOPE_ACCESSOR: "SERVICE_SCOPE_ACCESSOR";
1119
1055
  /** @description Token used to register and resolve the UnitOfWork instance in the dependency injection container.
1120
1056
  *
1121
1057
  * @author Xeno
@@ -1124,34 +1060,14 @@ declare const TOKENS: Readonly<{
1124
1060
  * @link https://github.com/xeno-js/xeno-js
1125
1061
  */
1126
1062
  readonly UNIT_OF_WORK: "UNIT_OF_WORK";
1127
- /** @description Token used to register and resolve the UserAuthorizationPipeline instance in the dependency injection container.
1128
- *
1129
- * @author Xeno
1130
- * @version 1.0.0
1131
- * @since 2025-09-30
1132
- * @link https://github.com/xeno-js/xeno-js
1133
- */
1134
- readonly USER_AUTHORIZATION_PIPELINE: "USER_AUTHORIZATION_PIPELINE";
1135
- /** @description Token used to register and resolve the ValidationPipeline instance in the dependency injection container.
1136
- *
1137
- * @author Xeno
1138
- * @version 1.0.0
1139
- * @since 2025-09-30
1140
- * @link https://github.com/xeno-js/xeno-js
1141
- */
1142
- readonly VALIDATION_PIPELINE: "VALIDATION_PIPELINE";
1143
- /** @description Token used to register and resolve the ZodValidator instance in the dependency injection container.
1063
+ /** @description Token used to register and resolve the ValidatorService instance in the dependency injection container.
1144
1064
  *
1145
1065
  * @author Xeno
1146
1066
  * @version 1.0.0
1147
1067
  * @since 2025-09-30
1148
1068
  * @link https://github.com/xeno-js/xeno-js
1149
1069
  */
1150
- readonly ZOD_VALIDATOR: "ZOD_VALIDATOR";
1151
- readonly SERVICE_SCOPE_ACCESSOR: "SERVICE_SCOPE_ACCESSOR";
1152
- readonly NETWORK_CONTEXT_ACCESSOR: "NETWORK_CONTEXT_ACCESSOR";
1153
- readonly USER_CONTEXT_FACTORY: "USER_CONTEXT_FACTORY";
1154
- readonly TRANSACTION_STATE: "TRANSACTION_STATE";
1070
+ readonly VALIDATOR_SERVICE: "VALIDATOR_SERVICE";
1155
1071
  }>;
1156
1072
 
1157
1073
  /**
@@ -1546,12 +1462,25 @@ interface HttpResponse<TData = unknown> {
1546
1462
  */
1547
1463
  readonly data: TData;
1548
1464
  }
1465
+ /**
1466
+ * @description Represents the CookieOptions interface.
1467
+ *
1468
+ * @author Xeno
1469
+ * @version 1.0.0
1470
+ * @since 2025-09-30
1471
+ * @link https://github.com/xeno-js/xeno-js
1472
+ */
1549
1473
  interface CookieOptions {
1474
+ /** @description The path for which the cookie is valid. Defaults to '/'. */
1550
1475
  path?: Optional<string>;
1476
+ /** @description The value of the maximum age in seconds. If not specified, the cookie will expire when the browser session ends. */
1551
1477
  maxAge?: Optional<number>;
1552
- sameSite?: Optional<'lax' | 'strict' | 'none' | boolean>;
1553
- secure?: boolean;
1478
+ /** @description The domain for which the cookie is valid. Defaults to the domain of the current document host. */
1554
1479
  domain?: Optional<string>;
1480
+ /** @description Whether the cookie is only transmitted over secure (HTTPS) connections. Defaults to true in production. */
1481
+ secure?: Optional<boolean>;
1482
+ /** @description Controls whether the cookie is withheld on cross-site requests, providing some protection against cross-site request forgery attacks. */
1483
+ sameSite?: Optional<'lax' | 'strict' | 'none' | boolean>;
1555
1484
  }
1556
1485
 
1557
1486
  /**
@@ -2721,10 +2650,10 @@ declare const GuidHelper: Readonly<{
2721
2650
  */
2722
2651
  declare const HttpHelper: Readonly<{
2723
2652
  /**
2724
- * @description A function that masks the IP address in the given headers object.
2725
- * @param ip The IP address to mask.
2726
- * @returns The masked IP address.
2727
- */
2653
+ * @description A function that masks the IP address in the given headers object.
2654
+ * @param ip The IP address to mask.
2655
+ * @returns The masked IP address.
2656
+ */
2728
2657
  readonly maskIp: (ip: Optional<string>) => Optional<string>;
2729
2658
  /**
2730
2659
  * @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.
@@ -3038,17 +2967,118 @@ declare const StringHelper: Readonly<{
3038
2967
  readonly getSingleValueWithSplit: (value: string, separator: string) => string;
3039
2968
  }>;
3040
2969
 
2970
+ /**
2971
+ * 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.
2972
+
2973
+ *
2974
+ * @author Xeno
2975
+ * @version 1.0.0
2976
+ * @since 2025-09-30
2977
+ * @link https://github.com/xeno-js/xeno-js
2978
+ */
2979
+ declare abstract class ValueObject<T extends object> implements IValueObject<T> {
2980
+ /** @description The properties of the value object, which are immutable and define the value represented by the value object.
2981
+ *
2982
+ * @author Xeno
2983
+ * @version 1.0.0
2984
+ * @since 2025-09-30
2985
+ * @link https://github.com/xeno-js/xeno-js
2986
+ */
2987
+ protected readonly _props: T;
2988
+ protected constructor(props: T);
2989
+ equals(vo?: Optional<IValueObject<T>>): boolean;
2990
+ getValue(): T;
2991
+ toString(): string;
2992
+ }
2993
+
2994
+ /**
2995
+ * @description AggregateRoot is an abstract class that represents the base class for all aggregate roots in the application. An aggregate root is the root entity of an aggregate, which is a group of related entities and value objects that are treated as a single unit. The AggregateRoot class provides common functionality for managing the state and behavior of aggregate roots, including methods for adding and retrieving uncommitted events, and methods for applying events to the aggregate.
2996
+ *
2997
+ * @author Xeno
2998
+ * @version 1.0.0
2999
+ */
3000
+ declare abstract class AggregateRoot<TEvent = unknown, TValueObject extends object = object> {
3001
+ readonly id: IValueObject<TValueObject>;
3002
+ private _version;
3003
+ private readonly _uncommittedEvents;
3004
+ /**
3005
+ * @description Constructs a new instance of the AggregateRoot class with the specified ID.
3006
+ * @param {IValueObject<TValueObject>} id - The ID of the aggregate.
3007
+ */
3008
+ constructor(id: IValueObject<TValueObject>);
3009
+ /**
3010
+ * @description Gets the current version of the aggregate.
3011
+ * @returns {number} The current version of the aggregate.
3012
+ */
3013
+ get version(): number;
3014
+ /**
3015
+ * @description Gets the uncommitted events of the aggregate.
3016
+ * @returns {readonly IDomainEvent[]} The uncommitted events of the aggregate.
3017
+ */
3018
+ getUncommittedEvents(): readonly IDomainEvent<TEvent, IValueObject<TValueObject>>[];
3019
+ /**
3020
+ * @description Clears the uncommitted events of the aggregate.
3021
+ */
3022
+ clearUncommittedEvents(): void;
3023
+ /**
3024
+ * @description Loads the aggregate from a history of domain events.
3025
+ * @param {IDomainEvent<TEvent, IValueObject<TValueObject>>[]} history - The history of domain events to load.
3026
+ */
3027
+ loadFromHistory(history: IDomainEvent<TEvent, IValueObject<TValueObject>>[]): void;
3028
+ /**
3029
+ * @description Raises a domain event and adds it to the uncommitted events list.
3030
+ * @param {Omit<IDomainEvent<TEvent, IValueObject<TValueObject>>, 'aggregateId' | 'version' | 'occurredAt'>} eventData - The data of the domain event to raise.
3031
+ */
3032
+ protected raise(eventData: Omit<IDomainEvent<TEvent, IValueObject<TValueObject>>, 'aggregateId' | 'version' | 'occurredAt'>): void;
3033
+ /**
3034
+ * @description Applies a domain event to the aggregate root.
3035
+ * @param {IDomainEvent<TEvent, IValueObject<TValueObject>>} event - The domain event to apply.
3036
+ * @param {boolean} isNew - Indicates whether the event is new or already committed.
3037
+ */
3038
+ protected abstract apply(event: IDomainEvent<TEvent, IValueObject<TValueObject>>, isNew: boolean): void;
3039
+ }
3040
+
3041
+ /**
3042
+ * @description Configuration options for the authentication service.
3043
+ * @author Xeno
3044
+ * @version 1.0.0
3045
+ * @since 2025-09-30
3046
+ * @link https://github.com/xeno-js/xeno-js
3047
+ */
3041
3048
  interface AuthConfig<TOptions = unknown> {
3049
+ /**
3050
+ * @description The URL of the authentication service.
3051
+ * @type {string}
3052
+ */
3042
3053
  url: string;
3054
+ /**
3055
+ * @description The key of the authentication service.
3056
+ * @type {string}
3057
+ */
3043
3058
  key: string;
3059
+ /**
3060
+ * @description The options of the authentication service.
3061
+ * @type {TOptions}
3062
+ */
3044
3063
  opts: Optional<TOptions>;
3045
- storageOpts: {
3046
- type: Optional<'local' | 'session' | 'memory' | 'cookie'>;
3047
- cookieOpts: Optional<CookieOptions>;
3048
- storage: Optional<IStorage>;
3049
- };
3064
+ /**
3065
+ * @description The storage options of the authentication service.
3066
+ * @type {StorageOptions}
3067
+ * @default { type: 'local', cookieOpts: {}, storage: null }
3068
+ */
3069
+ storageOpts: Optional<StorageOptions>;
3070
+ /**
3071
+ * @description The redirect URL of the authentication service.
3072
+ * @type {string}
3073
+ * @default '/'
3074
+ */
3050
3075
  redirectTo: Optional<string>;
3051
3076
  }
3077
+ interface StorageOptions {
3078
+ type: Optional<'local' | 'session' | 'memory' | 'cookie'>;
3079
+ cookieOpts: Optional<CookieOptions>;
3080
+ storage: Optional<IStorage>;
3081
+ }
3052
3082
 
3053
3083
  /** @description Configuration for Redis integration, including details such as host, port, and credentials. If enabled, the query bus and command bus (in case of idempotency) pipelines will use Redis as the cache system to store and retrieve data efficiently. The configuration includes specific details for Redis integration, such as host, port, and credentials, providing flexibility in how the cache is implemented and used within the application.
3054
3084
  *
@@ -5298,18 +5328,16 @@ interface IRepository<T> {
5298
5328
  /**
5299
5329
  * @description IAuthService defines the contract for authentication services.
5300
5330
  * It provides methods to check if a user is authenticated and to retrieve the user's claims.
5301
-
5302
- *
5303
- * @author Xeno
5304
- * @version 1.0.0
5305
- * @since 2025-09-30
5306
- * @link https://github.com/xeno-js/xeno-js
5307
- */
5331
+ *
5332
+ * @author Xeno
5333
+ * @version 1.0.0
5334
+ * @since 2025-09-30
5335
+ * @link https://github.com/xeno-js/xeno-js
5336
+ */
5308
5337
  interface IBaseAuthService {
5309
5338
  /**
5310
5339
  * Checks if the user is authenticated.
5311
5340
  * @returns A promise that resolves to true if the user is authenticated, false otherwise.
5312
-
5313
5341
  *
5314
5342
  * @author Xeno
5315
5343
  * @version 1.0.0
@@ -5318,14 +5346,19 @@ interface IBaseAuthService {
5318
5346
  */
5319
5347
  isAuthenticated(): Promise<boolean>;
5320
5348
  /**
5321
- * Restituisce l'utente attualmente autenticato.
5349
+ * Retrieves the user's claims.
5350
+ * @returns A promise that resolves to the user's claims, or null if not authenticated.
5351
+ *
5352
+ * @author Xeno
5353
+ * @version 1.0.0
5354
+ * @since 2025-09-30
5355
+ * @link https://github.com/xeno-js/xeno-js
5322
5356
  */
5323
5357
  getUser(): Promise<ResultType<Maybe<AuthClaims>>>;
5324
5358
  /**
5325
5359
  * Authenticates a user based on a token.
5326
5360
  * @param token The token to authenticate the user.
5327
5361
  * @returns A promise that resolves to the user's claims, or null if not authenticated.
5328
-
5329
5362
  *
5330
5363
  * @author Xeno
5331
5364
  * @version 1.0.0
@@ -5346,22 +5379,38 @@ interface IBaseAuthService {
5346
5379
  */
5347
5380
  interface IAuthService {
5348
5381
  /**
5349
- * Avvia il flusso di autenticazione OAuth con un provider esterno (es. Google).
5382
+ * Signs in a user by the specified provider.
5383
+ * @param provider The provider to use for signing in the user.
5384
+ * @returns A promise that resolves to the URL for the specified provider.
5350
5385
  */
5351
5386
  signInWithProvider(provider: Provider): Promise<ResultType<{
5352
5387
  url: string;
5353
5388
  }>>;
5354
5389
  /**
5355
- * Restituisce la sessione corrente attiva salvata nel client Supabase.
5390
+ * @description Gets the current session of the user.
5391
+ * @returns A promise that resolves to the current session of the user.
5356
5392
  */
5357
5393
  getSession(): Promise<ResultType<Maybe<Session>>>;
5358
5394
  /**
5359
- * Esegue il logout dell'utente e pulisce la sessione locale.
5395
+ * @description Signs out the user.
5396
+ * @returns A promise that resolves when the user is signed out.
5360
5397
  */
5361
5398
  signOut(): Promise<ResultType<void>>;
5399
+ /**
5400
+ * @description Exchanges the code for a session.
5401
+ * @param code the code to exchange for a session
5402
+ * @returns A promise that resolves to the session wit
5403
+ */
5362
5404
  exchangeCodeForSession(code: string): Promise<ResultType<Optional<Session>>>;
5363
5405
  }
5364
- interface IExtendendService extends IBaseAuthService, IAuthService {
5406
+ /**
5407
+ * @description An extended version of the IAuthService interface that includes additional methods for managing user sessions.
5408
+ * @author Xeno
5409
+ * @version 1.0.0
5410
+ * @since 2025-09-30
5411
+ * @link https://github.com/xeno-js/xeno-js
5412
+ */
5413
+ interface IExtendendAuthService extends IBaseAuthService, IAuthService {
5365
5414
  }
5366
5415
 
5367
5416
  /**
@@ -5784,81 +5833,25 @@ declare abstract class Entity<T> implements IEntity<T> {
5784
5833
  }
5785
5834
 
5786
5835
  /**
5787
- * The IValueObject interface defines the contract for 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 IValueObject interface includes methods for retrieving the underlying value, comparing value objects for equality, and providing a string representation of the value object.
5788
-
5789
- *
5790
- * @author Xeno
5791
- * @version 1.0.0
5792
- * @since 2025-09-30
5793
- * @link https://github.com/xeno-js/xeno-js
5794
- */
5795
- interface IValueObject<T extends object> {
5796
- /**
5797
- * Retrieves the underlying value of the value object. This method provides access to the encapsulated data, allowing it to be used in comparisons, transformations, or other operations while maintaining the integrity and immutability of the value object.
5798
- * @returns The underlying value of the value object.
5799
-
5800
- *
5801
- * @author Xeno
5802
- * @version 1.0.0
5803
- * @since 2025-09-30
5804
- * @link https://github.com/xeno-js/xeno-js
5805
- */
5806
- getValue(): T;
5807
- /**
5808
- * Compares the current value object with another value object for equality. This method checks if the underlying values of both value objects are equal, allowing for meaningful comparisons between value objects based on their encapsulated data rather than their reference identity.
5809
- * @param other The other value object to compare with the current value object.
5810
- * @returns True if the underlying values of both value objects are equal; otherwise, returns false.
5811
-
5812
- *
5813
- * @author Xeno
5814
- * @version 1.0.0
5815
- * @since 2025-09-30
5816
- * @link https://github.com/xeno-js/xeno-js
5817
- */
5818
- equals(other: IValueObject<T>): boolean;
5819
- /**
5820
- * Returns a string representation of the value object. This method can be used for debugging, logging, or any scenario where a human-readable representation of the value object is needed. The string representation should ideally include relevant information about the underlying value to provide context when the value object is printed or logged.
5821
- * @returns A string representation of the value object.
5822
-
5823
- *
5824
- * @author Xeno
5825
- * @version 1.0.0
5826
- * @since 2025-09-30
5827
- * @link https://github.com/xeno-js/xeno-js
5828
- */
5829
- toString(): string;
5830
- }
5831
-
5832
- /**
5833
- * 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.
5834
-
5835
- *
5836
- * @author Xeno
5837
- * @version 1.0.0
5838
- * @since 2025-09-30
5839
- * @link https://github.com/xeno-js/xeno-js
5840
- */
5841
- declare abstract class ValueObject<T extends object> implements IValueObject<T> {
5842
- /** @description The properties of the value object, which are immutable and define the value represented by the value object.
5843
- *
5844
- * @author Xeno
5845
- * @version 1.0.0
5846
- * @since 2025-09-30
5847
- * @link https://github.com/xeno-js/xeno-js
5848
- */
5849
- protected readonly _props: T;
5850
- protected constructor(props: T);
5851
- equals(vo?: Optional<IValueObject<T>>): boolean;
5852
- getValue(): T;
5853
- toString(): string;
5854
- }
5855
-
5836
+ * @description Base class for all commands.
5837
+ * @author Xeno
5838
+ * @version 1.0.0
5839
+ * @since 2025-09-30
5840
+ * @link https://github.com/xeno-js/xeno-js
5841
+ */
5856
5842
  declare abstract class Command<TResponse = unknown> implements ICommand<TResponse> {
5857
5843
  readonly intent: string;
5858
5844
  readonly type: RequestType;
5859
5845
  constructor(intent: string);
5860
5846
  }
5861
5847
 
5848
+ /**
5849
+ * @description Base class for all queries.
5850
+ * @author Xeno
5851
+ * @version 1.0.0
5852
+ * @since 2025-09-30
5853
+ * @link https://github.com/xeno-js/xeno-js
5854
+ */
5862
5855
  declare abstract class Query<TResponse = unknown> implements IQuery<TResponse> {
5863
5856
  readonly intent: string;
5864
5857
  readonly cacheOptions: ICacheableOptions;
@@ -5868,13 +5861,12 @@ declare abstract class Query<TResponse = unknown> implements IQuery<TResponse> {
5868
5861
 
5869
5862
  /**
5870
5863
  * @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.
5871
-
5872
- *
5873
- * @author Xeno
5874
- * @version 1.0.0
5875
- * @since 2025-09-30
5876
- * @link https://github.com/xeno-js/xeno-js
5877
- */
5864
+ *
5865
+ * @author Xeno
5866
+ * @version 1.0.0
5867
+ * @since 2025-09-30
5868
+ * @link https://github.com/xeno-js/xeno-js
5869
+ */
5878
5870
  declare class BaseLogger implements ILogger {
5879
5871
  private readonly _requestContext;
5880
5872
  private readonly _minLevel;
@@ -5884,7 +5876,6 @@ declare class BaseLogger implements ILogger {
5884
5876
  * @param _requestContext The request context that provides contextual information for log messages, such as request-specific data or metadata.
5885
5877
  * @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.
5886
5878
  * @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).
5887
-
5888
5879
  *
5889
5880
  * @author Xeno
5890
5881
  * @version 1.0.0
@@ -5902,7 +5893,6 @@ declare class BaseLogger implements ILogger {
5902
5893
  * @param message The log message.
5903
5894
  * @param context Optional context information to include with the log message.
5904
5895
  * @param error Optional error object to include with the log message.
5905
-
5906
5896
  *
5907
5897
  * @author Xeno
5908
5898
  * @version 1.0.0
@@ -6118,4 +6108,4 @@ declare class ZodValidatorService implements IValidatorService {
6118
6108
  validate<T>(key: string, data: T): Promise<ResultType<boolean>>;
6119
6109
  }
6120
6110
 
6121
- export { AbortSignalHelper, type AbstractConstructor, type ApiResponseDto, AppError, type AsyncFactory, type AsyncResolver, type AuthClaims, type AuthConfig, type AuthPolicy, AxiosFactory, AxiosHttpClient, BaseLogger, type CacheClientConfig, type CacheConfig, CacheKeyBuilder, Command, type Constructor, type CookieOptions, DEFAULT_CONCURRENCY, DateHelper, type DbConfig, type Delegate, type Dictionary, ERROR_CODES, ERROR_CODE_MESSAGES, Entity, Enumerable, type ErrorCode, type ErrorResponseDto, type Factory, GUEST, Guards, type Guid, GuidHelper, type HttpBaseRequest, type HttpClientConfig, type HttpHeaders, HttpHelper, type HttpMethod, type HttpOptions, type HttpQueryValue, type HttpRequest, type HttpResponse, type HttpResponseType, type IAuthService, type IBaseAccessor, type IBaseAuthService, type IBaseMapper, type ICache, type ICacheKeyBuilder, type ICacheableOptions, type ICommand, type IConcurrencyService, type IConfigurationService, type IContextAccessor, type IController, IDEMPOTENCY_CONSTANTS, type IDisposable, type IEntity, type IExtendendService, type IFactory, type IGateKeeper, type IHandler, type IHttpClient, type IIdempotencyStore, type IIdentityAccessor, type ILogger, type ILoggerClient, type IMapper, type IMediator, type IMiddleware, type INetworkContextAccessor, type IPaginatedResult, type IPipelineBehavior, type IPolicyRegistry, type IQuery, type IReadDao, type IReadDataSource, type IRemoteDataSource, type IRepository, type IRequest, type IServiceExtractor, type IServiceResilience, type ISpecification, type IStorage, type IStrategy, type ITransactionState, type IUnitOfWork, type IValidatorService, type IValueObject, type IWriteDataSource, type Identity, InMemoryCache, type InjectionToken, type KeysOfType, LOG_LEVEL, LOG_LEVEL_NAMES, type LogLevel, type LoggerContext, LoggerUtils, MathHelper, type Maybe, type MessageSequence, type MessagingContext, type Metadata, type NetworkContext, type Nullable, type Optional, type Override, PAGINATION_DEFAULTS, PERMISSIONS, type Permission, PromiseHelper, type Provider, type ProxyConfig, Query, REQUEST_TYPE, RESILIENCE_DEFAULTS, ROLES, type RequestContext, type RequestType, type RequireKeys, type Resolver, type ResponseDto, Result, type ResultType, type Role, SORT_DIRECTION, STATUS_CODES, SanitizeHelper, type Session, type SetupAction, type SortDirection, type StatusCode, StorageHelper, StringHelper, type SuccessResponseDto, SupabaseAuthService, SupabaseClaimsMapper, SupabaseSessionMapper, TOKENS, type TracingContext, UniqueId, type UserContext, ValueObject, ZodUtils, ZodValidatorService };
6111
+ export { AbortSignalHelper, type AbstractConstructor, AggregateRoot, type ApiResponseDto, AppError, type AsyncFactory, type AsyncResolver, type AuthClaims, type AuthConfig, type AuthPolicy, AxiosFactory, AxiosHttpClient, BaseLogger, type CacheClientConfig, type CacheConfig, CacheKeyBuilder, Command, type Constructor, type CookieOptions, DEFAULT_CONCURRENCY, DateHelper, type DbConfig, type Delegate, type Dictionary, ERROR_CODES, ERROR_CODE_MESSAGES, Entity, Enumerable, type ErrorCode, type ErrorResponseDto, type Factory, GUEST, Guards, type Guid, GuidHelper, type HttpBaseRequest, type HttpClientConfig, type HttpHeaders, HttpHelper, type HttpMethod, type HttpOptions, type HttpQueryValue, type HttpRequest, type HttpResponse, type HttpResponseType, type IAuthService, type IBaseAccessor, type IBaseAuthService, type IBaseMapper, type ICache, type ICacheKeyBuilder, type ICacheableOptions, type ICommand, type IConcurrencyService, type IConfigurationService, type IContextAccessor, type IController, IDEMPOTENCY_CONSTANTS, type IDisposable, type IDomainEvent, type IEntity, type IExtendendAuthService, type IFactory, type IGateKeeper, type IHandler, type IHttpClient, type IIdempotencyStore, type IIdentityAccessor, type ILogger, type ILoggerClient, type IMapper, type IMediator, type IMiddleware, type INetworkContextAccessor, type IPaginatedResult, type IPipelineBehavior, type IPolicyRegistry, type IQuery, type IReadDao, type IReadDataSource, type IRemoteDataSource, type IRepository, type IRequest, type IServiceExtractor, type IServiceResilience, type ISpecification, type IStorage, type IStrategy, type ITransactionState, type IUnitOfWork, type IValidatorService, type IValueObject, type IWriteDataSource, type Identity, InMemoryCache, type InjectionToken, type KeysOfType, LOG_LEVEL, LOG_LEVEL_NAMES, type LogLevel, type LoggerContext, LoggerUtils, MathHelper, type Maybe, type MessageSequence, type MessagingContext, type Metadata, type NetworkContext, type Nullable, type Optional, type Override, PAGINATION_DEFAULTS, PERMISSIONS, type Permission, PromiseHelper, type Provider, type ProxyConfig, Query, REQUEST_TYPE, RESILIENCE_DEFAULTS, ROLES, type RequestContext, type RequestType, type RequireKeys, type Resolver, type ResponseDto, Result, type ResultType, type Role, SORT_DIRECTION, STATUS_CODES, SanitizeHelper, type Session, type SetupAction, type SortDirection, type StatusCode, StorageHelper, StringHelper, type SuccessResponseDto, SupabaseAuthService, SupabaseClaimsMapper, SupabaseSessionMapper, TOKENS, type TracingContext, UniqueId, type UserContext, ValueObject, ZodUtils, ZodValidatorService };