@xeno-js/shared 0.1.5 → 0.1.7

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.ts CHANGED
@@ -785,25 +785,14 @@ type Permission = (typeof PERMISSIONS)[keyof typeof PERMISSIONS];
785
785
  * @description This file defines the tokens used for dependency injection in the application.
786
786
  * Tokens are unique identifiers that are used to register and resolve dependencies in the container.
787
787
  * 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
- */
788
+ *
789
+ * @author Xeno
790
+ * @version 1.0.0
791
+ * @since 2025-09-30
792
+ * @link https://github.com/xeno-js/xeno-js
793
+ */
795
794
  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.
795
+ /** @description Token used to register and resolve the Extendend AuthService instance in the dependency injection container.
807
796
  *
808
797
  * @author Xeno
809
798
  * @version 1.0.0
@@ -811,15 +800,14 @@ declare const TOKENS: Readonly<{
811
800
  * @link https://github.com/xeno-js/xeno-js
812
801
  */
813
802
  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.
803
+ /** @description Token used to register and resolve the BaseAuthService instance in the dependency injection container.
816
804
  *
817
805
  * @author Xeno
818
806
  * @version 1.0.0
819
807
  * @since 2025-09-30
820
808
  * @link https://github.com/xeno-js/xeno-js
821
809
  */
822
- readonly BEARER_TOKEN_EXTRACTOR: "BEARER_TOKEN_EXTRACTOR";
810
+ readonly BASE_AUTH_SERVICE: "BASE_AUTH_SERVICE";
823
811
  /** @description Token used to register and resolve the InMemoryCache instance in the dependency injection container.
824
812
  *
825
813
  * @author Xeno
@@ -836,14 +824,6 @@ declare const TOKENS: Readonly<{
836
824
  * @link https://github.com/xeno-js/xeno-js
837
825
  */
838
826
  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
827
  /** @description Token used to register and resolve command pipeline behaviors in the dependency injection container.
848
828
  *
849
829
  * @author Xeno
@@ -852,22 +832,6 @@ declare const TOKENS: Readonly<{
852
832
  * @link https://github.com/xeno-js/xeno-js
853
833
  */
854
834
  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
835
  /** @description Token used to register and resolve the ConcurrencyService instance in the dependency injection container.
872
836
  *
873
837
  * @author Xeno
@@ -884,14 +848,6 @@ declare const TOKENS: Readonly<{
884
848
  * @link https://github.com/xeno-js/xeno-js
885
849
  */
886
850
  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
851
  /** @description Token used to register and resolve the ContextAccessor instance in the dependency injection container.
896
852
  *
897
853
  * @author Xeno
@@ -900,46 +856,30 @@ declare const TOKENS: Readonly<{
900
856
  * @link https://github.com/xeno-js/xeno-js
901
857
  */
902
858
  readonly CONTEXT_ACCESSOR: "CONTEXT_ACCESSOR";
903
- /** @description Token used to register and resolve the DbContext instance in the dependency injection container.
904
- *
905
- * @author Xeno
906
- * @version 1.0.0
907
- * @since 2025-09-30
908
- * @link https://github.com/xeno-js/xeno-js
909
- */
910
- readonly DB_CONTEXT: "DB_CONTEXT";
911
- /** @description Token used to register and resolve the ExceptionPipeline instance in the dependency injection container.
859
+ /** @description Token used to register and resolve the CryptoService instance in the dependency injection container.
912
860
  *
913
861
  * @author Xeno
914
862
  * @version 1.0.0
915
863
  * @since 2025-09-30
916
864
  * @link https://github.com/xeno-js/xeno-js
917
865
  */
918
- readonly EXCEPTION_PIPELINE: "EXCEPTION_PIPELINE";
919
- /** @description Token used to register and resolve the GateKeeper instance in the dependency injection container.
866
+ readonly CRYPTO_SERVICE: "CRYPTO_SERVICE";
867
+ /** @description Token used to register and resolve the CsrfTokenService instance in the dependency injection container.
920
868
  *
921
869
  * @author Xeno
922
870
  * @version 1.0.0
923
871
  * @since 2025-09-30
924
872
  * @link https://github.com/xeno-js/xeno-js
925
873
  */
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.
874
+ readonly CSRF_TOKEN_SERVICE: "CSRF_TOKEN_SERVICE";
875
+ /** @description Token used to register and resolve the DbContext instance in the dependency injection container.
936
876
  *
937
877
  * @author Xeno
938
878
  * @version 1.0.0
939
879
  * @since 2025-09-30
940
880
  * @link https://github.com/xeno-js/xeno-js
941
881
  */
942
- readonly IDEMPOTENCY_STORE: "IDEMPOTENCY_STORE";
882
+ readonly DB_CONTEXT: "DB_CONTEXT";
943
883
  /** @description Token used to register and resolve the IdentityAccessor instance in the dependency injection container.
944
884
  *
945
885
  * @author Xeno
@@ -956,22 +896,6 @@ declare const TOKENS: Readonly<{
956
896
  * @link https://github.com/xeno-js/xeno-js
957
897
  */
958
898
  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
899
  /** @description Token used to register and resolve the Mediator instance in the dependency injection container.
976
900
  *
977
901
  * @author Xeno
@@ -980,46 +904,14 @@ declare const TOKENS: Readonly<{
980
904
  * @link https://github.com/xeno-js/xeno-js
981
905
  */
982
906
  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.
1000
- *
1001
- * @author Xeno
1002
- * @version 1.0.0
1003
- * @since 2025-09-30
1004
- * @link https://github.com/xeno-js/xeno-js
1005
- */
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.
907
+ /** @description Token used to register and resolve the NetworkContextFactory in the dependency injection container.
1016
908
  *
1017
909
  * @author Xeno
1018
910
  * @version 1.0.0
1019
911
  * @since 2025-09-30
1020
912
  * @link https://github.com/xeno-js/xeno-js
1021
913
  */
1022
- readonly QUERY_CACHING_PIPELINE: "QUERY_CACHING_PIPELINE";
914
+ readonly NETWORK_CONTEXT_ACCESSOR: "NETWORK_CONTEXT_ACCESSOR";
1023
915
  /** @description Token used to register and resolve query pipeline behaviors in the dependency injection container.
1024
916
  *
1025
917
  * @author Xeno
@@ -1036,7 +928,7 @@ declare const TOKENS: Readonly<{
1036
928
  * @link https://github.com/xeno-js/xeno-js
1037
929
  */
1038
930
  readonly REQUEST_CONTEXT: "REQUEST_CONTEXT";
1039
- /** @description Token used to register and resolve the RequestContextMiddleware in the dependency injection container.
931
+ /** @description Token used to register and resolve the CompositeMiddleware in the dependency injection container.
1040
932
  *
1041
933
  * @author Xeno
1042
934
  * @version 1.0.0
@@ -1044,14 +936,6 @@ declare const TOKENS: Readonly<{
1044
936
  * @link https://github.com/xeno-js/xeno-js
1045
937
  */
1046
938
  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
939
  /** @description Token used to register and resolve the IServiceResilience instance in the dependency injection container.
1056
940
  *
1057
941
  * @author Xeno
@@ -1060,14 +944,6 @@ declare const TOKENS: Readonly<{
1060
944
  * @link https://github.com/xeno-js/xeno-js
1061
945
  */
1062
946
  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
947
  /** @description Token used to register and resolve the SchemaValidationStrategy instance in the dependency injection container.
1072
948
  *
1073
949
  * @author Xeno
@@ -1076,14 +952,6 @@ declare const TOKENS: Readonly<{
1076
952
  * @link https://github.com/xeno-js/xeno-js
1077
953
  */
1078
954
  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
955
  /** @description Token used to register and resolve the ServiceContainer instance in the dependency injection container.
1088
956
  *
1089
957
  * @author Xeno
@@ -1100,22 +968,14 @@ declare const TOKENS: Readonly<{
1100
968
  * @link https://github.com/xeno-js/xeno-js
1101
969
  */
1102
970
  readonly SERVICE_EXTRACTOR: "SERVICE_EXTRACTOR";
1103
- /** @description Token used to register and resolve the ServiceScopeFactory instance in the dependency injection container.
971
+ /** @description Token used to register and resolve the ServiceScopeAccessor in the dependency injection container.
1104
972
  *
1105
973
  * @author Xeno
1106
974
  * @version 1.0.0
1107
975
  * @since 2025-09-30
1108
976
  * @link https://github.com/xeno-js/xeno-js
1109
977
  */
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";
978
+ readonly SERVICE_SCOPE_ACCESSOR: "SERVICE_SCOPE_ACCESSOR";
1119
979
  /** @description Token used to register and resolve the UnitOfWork instance in the dependency injection container.
1120
980
  *
1121
981
  * @author Xeno
@@ -1124,34 +984,14 @@ declare const TOKENS: Readonly<{
1124
984
  * @link https://github.com/xeno-js/xeno-js
1125
985
  */
1126
986
  readonly UNIT_OF_WORK: "UNIT_OF_WORK";
1127
- /** @description Token used to register and resolve the UserAuthorizationPipeline instance in the dependency injection container.
987
+ /** @description Token used to register and resolve the ValidatorService instance in the dependency injection container.
1128
988
  *
1129
989
  * @author Xeno
1130
990
  * @version 1.0.0
1131
991
  * @since 2025-09-30
1132
992
  * @link https://github.com/xeno-js/xeno-js
1133
993
  */
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.
1144
- *
1145
- * @author Xeno
1146
- * @version 1.0.0
1147
- * @since 2025-09-30
1148
- * @link https://github.com/xeno-js/xeno-js
1149
- */
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";
994
+ readonly VALIDATOR_SERVICE: "VALIDATOR_SERVICE";
1155
995
  }>;
1156
996
 
1157
997
  /**
@@ -1546,12 +1386,25 @@ interface HttpResponse<TData = unknown> {
1546
1386
  */
1547
1387
  readonly data: TData;
1548
1388
  }
1389
+ /**
1390
+ * @description Represents the CookieOptions interface.
1391
+ *
1392
+ * @author Xeno
1393
+ * @version 1.0.0
1394
+ * @since 2025-09-30
1395
+ * @link https://github.com/xeno-js/xeno-js
1396
+ */
1549
1397
  interface CookieOptions {
1398
+ /** @description The path for which the cookie is valid. Defaults to '/'. */
1550
1399
  path?: Optional<string>;
1400
+ /** @description The value of the maximum age in seconds. If not specified, the cookie will expire when the browser session ends. */
1551
1401
  maxAge?: Optional<number>;
1552
- sameSite?: Optional<'lax' | 'strict' | 'none' | boolean>;
1553
- secure?: boolean;
1402
+ /** @description The domain for which the cookie is valid. Defaults to the domain of the current document host. */
1554
1403
  domain?: Optional<string>;
1404
+ /** @description Whether the cookie is only transmitted over secure (HTTPS) connections. Defaults to true in production. */
1405
+ secure?: Optional<boolean>;
1406
+ /** @description Controls whether the cookie is withheld on cross-site requests, providing some protection against cross-site request forgery attacks. */
1407
+ sameSite?: Optional<'lax' | 'strict' | 'none' | boolean>;
1555
1408
  }
1556
1409
 
1557
1410
  /**
@@ -2720,6 +2573,12 @@ declare const GuidHelper: Readonly<{
2720
2573
  * @link https://github.com/xeno-js/xeno-js
2721
2574
  */
2722
2575
  declare const HttpHelper: Readonly<{
2576
+ /**
2577
+ * @description A function that masks the IP address in the given headers object.
2578
+ * @param ip The IP address to mask.
2579
+ * @returns The masked IP address.
2580
+ */
2581
+ readonly maskIp: (ip: Optional<string>) => Optional<string>;
2723
2582
  /**
2724
2583
  * @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.
2725
2584
  * @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.
@@ -3032,17 +2891,47 @@ declare const StringHelper: Readonly<{
3032
2891
  readonly getSingleValueWithSplit: (value: string, separator: string) => string;
3033
2892
  }>;
3034
2893
 
2894
+ /**
2895
+ * @description Configuration options for the authentication service.
2896
+ * @author Xeno
2897
+ * @version 1.0.0
2898
+ * @since 2025-09-30
2899
+ * @link https://github.com/xeno-js/xeno-js
2900
+ */
3035
2901
  interface AuthConfig<TOptions = unknown> {
2902
+ /**
2903
+ * @description The URL of the authentication service.
2904
+ * @type {string}
2905
+ */
3036
2906
  url: string;
2907
+ /**
2908
+ * @description The key of the authentication service.
2909
+ * @type {string}
2910
+ */
3037
2911
  key: string;
2912
+ /**
2913
+ * @description The options of the authentication service.
2914
+ * @type {TOptions}
2915
+ */
3038
2916
  opts: Optional<TOptions>;
3039
- storageOpts: {
3040
- type: Optional<'local' | 'session' | 'memory' | 'cookie'>;
3041
- cookieOpts: Optional<CookieOptions>;
3042
- storage: Optional<IStorage>;
3043
- };
2917
+ /**
2918
+ * @description The storage options of the authentication service.
2919
+ * @type {StorageOptions}
2920
+ * @default { type: 'local', cookieOpts: {}, storage: null }
2921
+ */
2922
+ storageOpts: Optional<StorageOptions>;
2923
+ /**
2924
+ * @description The redirect URL of the authentication service.
2925
+ * @type {string}
2926
+ * @default '/'
2927
+ */
3044
2928
  redirectTo: Optional<string>;
3045
2929
  }
2930
+ interface StorageOptions {
2931
+ type: Optional<'local' | 'session' | 'memory' | 'cookie'>;
2932
+ cookieOpts: Optional<CookieOptions>;
2933
+ storage: Optional<IStorage>;
2934
+ }
3046
2935
 
3047
2936
  /** @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.
3048
2937
  *
@@ -3686,6 +3575,15 @@ interface NetworkContext {
3686
3575
  * @link https://github.com/xeno-js/xeno-js
3687
3576
  */
3688
3577
  readonly csrf: Optional<string>;
3578
+ /**
3579
+ * @description The CSRF cookie for the request, which can be used for preventing cross-site request forgery attacks.
3580
+ *
3581
+ * @author Xeno
3582
+ * @version 1.0.0
3583
+ * @since 2025-09-30
3584
+ * @link https://github.com/xeno-js/xeno-js
3585
+ */
3586
+ readonly csrfCookie: Optional<string>;
3689
3587
  /**
3690
3588
  * @description The transport used for the request, which can be used for logging, monitoring, or applying specific middleware logic.
3691
3589
  *
@@ -4969,6 +4867,29 @@ interface ILoggerClient {
4969
4867
  track<T>(level: LogLevel, message: string, context: Optional<T>, error: Optional<unknown>): void;
4970
4868
  }
4971
4869
 
4870
+ /**
4871
+ * @description LoggerContext defines the structure for logging-related information used in logging and monitoring. It includes identity, network, and tracing information, as well as optional messaging context for distributed tracing.
4872
+ */
4873
+ interface LoggerContext {
4874
+ identity: {
4875
+ userId: Optional<string>;
4876
+ tenantId: Optional<string>;
4877
+ };
4878
+ network: {
4879
+ requestId: Optional<string>;
4880
+ path: Optional<string>;
4881
+ origin: Optional<string>;
4882
+ clientIp: Optional<string>;
4883
+ };
4884
+ tracing: {
4885
+ correlationId: Optional<string>;
4886
+ spanId: Optional<string>;
4887
+ startTime: Optional<number>;
4888
+ parentSpanId: Optional<string>;
4889
+ };
4890
+ messaging?: Maybe<MessagingContext>;
4891
+ }
4892
+
4972
4893
  /**
4973
4894
  * @description Generic mapper interface defining a contract for mapping objects of type TSource to type TDestination. Mappers are used to convert data between different layers of the application, such as transforming DTOs to domain entities or vice versa. This interface defines a contract that all mappers must implement, ensuring consistency and maintainability of the code.
4974
4895
  * @template TSource The type of the source object to be mapped.
@@ -5260,18 +5181,16 @@ interface IRepository<T> {
5260
5181
  /**
5261
5182
  * @description IAuthService defines the contract for authentication services.
5262
5183
  * It provides methods to check if a user is authenticated and to retrieve the user's claims.
5263
-
5264
- *
5265
- * @author Xeno
5266
- * @version 1.0.0
5267
- * @since 2025-09-30
5268
- * @link https://github.com/xeno-js/xeno-js
5269
- */
5184
+ *
5185
+ * @author Xeno
5186
+ * @version 1.0.0
5187
+ * @since 2025-09-30
5188
+ * @link https://github.com/xeno-js/xeno-js
5189
+ */
5270
5190
  interface IBaseAuthService {
5271
5191
  /**
5272
5192
  * Checks if the user is authenticated.
5273
5193
  * @returns A promise that resolves to true if the user is authenticated, false otherwise.
5274
-
5275
5194
  *
5276
5195
  * @author Xeno
5277
5196
  * @version 1.0.0
@@ -5280,14 +5199,19 @@ interface IBaseAuthService {
5280
5199
  */
5281
5200
  isAuthenticated(): Promise<boolean>;
5282
5201
  /**
5283
- * Restituisce l'utente attualmente autenticato.
5202
+ * Retrieves the user's claims.
5203
+ * @returns A promise that resolves to the user's claims, or null if not authenticated.
5204
+ *
5205
+ * @author Xeno
5206
+ * @version 1.0.0
5207
+ * @since 2025-09-30
5208
+ * @link https://github.com/xeno-js/xeno-js
5284
5209
  */
5285
5210
  getUser(): Promise<ResultType<Maybe<AuthClaims>>>;
5286
5211
  /**
5287
5212
  * Authenticates a user based on a token.
5288
5213
  * @param token The token to authenticate the user.
5289
5214
  * @returns A promise that resolves to the user's claims, or null if not authenticated.
5290
-
5291
5215
  *
5292
5216
  * @author Xeno
5293
5217
  * @version 1.0.0
@@ -5308,22 +5232,38 @@ interface IBaseAuthService {
5308
5232
  */
5309
5233
  interface IAuthService {
5310
5234
  /**
5311
- * Avvia il flusso di autenticazione OAuth con un provider esterno (es. Google).
5235
+ * Signs in a user by the specified provider.
5236
+ * @param provider The provider to use for signing in the user.
5237
+ * @returns A promise that resolves to the URL for the specified provider.
5312
5238
  */
5313
5239
  signInWithProvider(provider: Provider): Promise<ResultType<{
5314
5240
  url: string;
5315
5241
  }>>;
5316
5242
  /**
5317
- * Restituisce la sessione corrente attiva salvata nel client Supabase.
5243
+ * @description Gets the current session of the user.
5244
+ * @returns A promise that resolves to the current session of the user.
5318
5245
  */
5319
5246
  getSession(): Promise<ResultType<Maybe<Session>>>;
5320
5247
  /**
5321
- * Esegue il logout dell'utente e pulisce la sessione locale.
5248
+ * @description Signs out the user.
5249
+ * @returns A promise that resolves when the user is signed out.
5322
5250
  */
5323
5251
  signOut(): Promise<ResultType<void>>;
5252
+ /**
5253
+ * @description Exchanges the code for a session.
5254
+ * @param code the code to exchange for a session
5255
+ * @returns A promise that resolves to the session wit
5256
+ */
5324
5257
  exchangeCodeForSession(code: string): Promise<ResultType<Optional<Session>>>;
5325
5258
  }
5326
- interface IExtendendService extends IBaseAuthService, IAuthService {
5259
+ /**
5260
+ * @description An extended version of the IAuthService interface that includes additional methods for managing user sessions.
5261
+ * @author Xeno
5262
+ * @version 1.0.0
5263
+ * @since 2025-09-30
5264
+ * @link https://github.com/xeno-js/xeno-js
5265
+ */
5266
+ interface IExtendendAuthService extends IBaseAuthService, IAuthService {
5327
5267
  }
5328
5268
 
5329
5269
  /**
@@ -5815,12 +5755,26 @@ declare abstract class ValueObject<T extends object> implements IValueObject<T>
5815
5755
  toString(): string;
5816
5756
  }
5817
5757
 
5758
+ /**
5759
+ * @description Base class for all commands.
5760
+ * @author Xeno
5761
+ * @version 1.0.0
5762
+ * @since 2025-09-30
5763
+ * @link https://github.com/xeno-js/xeno-js
5764
+ */
5818
5765
  declare abstract class Command<TResponse = unknown> implements ICommand<TResponse> {
5819
5766
  readonly intent: string;
5820
5767
  readonly type: RequestType;
5821
5768
  constructor(intent: string);
5822
5769
  }
5823
5770
 
5771
+ /**
5772
+ * @description Base class for all queries.
5773
+ * @author Xeno
5774
+ * @version 1.0.0
5775
+ * @since 2025-09-30
5776
+ * @link https://github.com/xeno-js/xeno-js
5777
+ */
5824
5778
  declare abstract class Query<TResponse = unknown> implements IQuery<TResponse> {
5825
5779
  readonly intent: string;
5826
5780
  readonly cacheOptions: ICacheableOptions;
@@ -5830,13 +5784,12 @@ declare abstract class Query<TResponse = unknown> implements IQuery<TResponse> {
5830
5784
 
5831
5785
  /**
5832
5786
  * @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.
5833
-
5834
- *
5835
- * @author Xeno
5836
- * @version 1.0.0
5837
- * @since 2025-09-30
5838
- * @link https://github.com/xeno-js/xeno-js
5839
- */
5787
+ *
5788
+ * @author Xeno
5789
+ * @version 1.0.0
5790
+ * @since 2025-09-30
5791
+ * @link https://github.com/xeno-js/xeno-js
5792
+ */
5840
5793
  declare class BaseLogger implements ILogger {
5841
5794
  private readonly _requestContext;
5842
5795
  private readonly _minLevel;
@@ -5846,7 +5799,6 @@ declare class BaseLogger implements ILogger {
5846
5799
  * @param _requestContext The request context that provides contextual information for log messages, such as request-specific data or metadata.
5847
5800
  * @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.
5848
5801
  * @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).
5849
-
5850
5802
  *
5851
5803
  * @author Xeno
5852
5804
  * @version 1.0.0
@@ -5864,7 +5816,6 @@ declare class BaseLogger implements ILogger {
5864
5816
  * @param message The log message.
5865
5817
  * @param context Optional context information to include with the log message.
5866
5818
  * @param error Optional error object to include with the log message.
5867
-
5868
5819
  *
5869
5820
  * @author Xeno
5870
5821
  * @version 1.0.0
@@ -5874,6 +5825,18 @@ declare class BaseLogger implements ILogger {
5874
5825
  private broadcast;
5875
5826
  }
5876
5827
 
5828
+ /**
5829
+ * @description LoggerUtils provides utility functions for working with LoggerContext objects.
5830
+ */
5831
+ declare const LoggerUtils: Readonly<{
5832
+ /**
5833
+ * @description toSafeContext converts a RequestContext object to a LoggerContext object, ensuring that only the necessary fields are included.
5834
+ * @param ctx The RequestContext object to convert.
5835
+ * @returns The converted LoggerContext object.
5836
+ */
5837
+ readonly toSafeContext: (ctx: Optional<RequestContext>) => LoggerContext;
5838
+ }>;
5839
+
5877
5840
  declare const StorageHelper: Readonly<{
5878
5841
  readonly create: (opts: {
5879
5842
  type: Optional<"local" | "session" | "memory" | "cookie">;
@@ -6068,4 +6031,4 @@ declare class ZodValidatorService implements IValidatorService {
6068
6031
  validate<T>(key: string, data: T): Promise<ResultType<boolean>>;
6069
6032
  }
6070
6033
 
6071
- 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, 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 };
6034
+ 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 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 };