@xeno-js/shared 0.1.6 → 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/README.md CHANGED
@@ -197,14 +197,14 @@ flows from feature branches ➡️ `develop` ➡️ `main`._
197
197
 
198
198
  ### Scripts
199
199
 
200
- | Command | Description |
201
- | ------------------- | -------------------------------------------------- |
202
- | `npm run build` | Builds the TypeScript source code into `dist/`<br> |
203
- | `npm run typecheck` | Checks types without emitting files |
204
- | `npm run lint` | Runs ESLint |
205
- | `npm run format` | Formats code with Prettier |
206
- | `npm run test` | Runs the Vitest test suite |
207
- | `npm run test:coverage` | Runs tests and generates a coverage report |
200
+ | Command | Description |
201
+ | ----------------------- | -------------------------------------------------- |
202
+ | `npm run build` | Builds the TypeScript source code into `dist/`<br> |
203
+ | `npm run typecheck` | Checks types without emitting files |
204
+ | `npm run lint` | Runs ESLint |
205
+ | `npm run format` | Formats code with Prettier |
206
+ | `npm run test` | Runs the Vitest test suite |
207
+ | `npm run test:coverage` | Runs tests and generates a coverage report |
208
208
 
209
209
  ### Code Quality (Husky & Git Hooks)
210
210
 
package/dist/index.cjs CHANGED
@@ -736,17 +736,7 @@ var RESILIENCE_DEFAULTS = Object.freeze({
736
736
 
737
737
  // src/shared/constants/tokens.constants.ts
738
738
  var TOKENS = Object.freeze({
739
- ALLOW_ORIGIN: "ALLOW_ORIGIN",
740
- ALLOW_METHOD: "ALLOW_METHOD",
741
- /** @description Token used to register and resolve the AuthorizationPipeline instance in the dependency injection container.
742
- *
743
- * @author Xeno
744
- * @version 1.0.0
745
- * @since 2025-09-30
746
- * @link https://github.com/xeno-js/xeno-js
747
- */
748
- AUTHORIZATION_PIPELINE: "AUTHORIZATION_PIPELINE",
749
- /** @description Token used to register and resolve the AuthService instance in the dependency injection container.
739
+ /** @description Token used to register and resolve the Extendend AuthService instance in the dependency injection container.
750
740
  *
751
741
  * @author Xeno
752
742
  * @version 1.0.0
@@ -754,15 +744,14 @@ var TOKENS = Object.freeze({
754
744
  * @link https://github.com/xeno-js/xeno-js
755
745
  */
756
746
  AUTH_SERVICE: "AUTH_SERVICE",
757
- BASE_AUTH_SERVICE: "BASE_AUTH_SERVICE",
758
- /** @description Token used to register and resolve the BearerTokenExtractor instance in the dependency injection container.
747
+ /** @description Token used to register and resolve the BaseAuthService instance in the dependency injection container.
759
748
  *
760
749
  * @author Xeno
761
750
  * @version 1.0.0
762
751
  * @since 2025-09-30
763
752
  * @link https://github.com/xeno-js/xeno-js
764
753
  */
765
- BEARER_TOKEN_EXTRACTOR: "BEARER_TOKEN_EXTRACTOR",
754
+ BASE_AUTH_SERVICE: "BASE_AUTH_SERVICE",
766
755
  /** @description Token used to register and resolve the InMemoryCache instance in the dependency injection container.
767
756
  *
768
757
  * @author Xeno
@@ -779,14 +768,6 @@ var TOKENS = Object.freeze({
779
768
  * @link https://github.com/xeno-js/xeno-js
780
769
  */
781
770
  CACHE_KEY_BUILDER: "CACHE_KEY_BUILDER",
782
- /** @description Token used to register and resolve the ClaimsIdentityMapper instance in the dependency injection container.
783
- *
784
- * @author Xeno
785
- * @version 1.0.0
786
- * @since 2025-09-30
787
- * @link https://github.com/xeno-js/xeno-js
788
- */
789
- CLAIMS_IDENTITY_MAPPER: "CLAIMS_IDENTITY_MAPPER",
790
771
  /** @description Token used to register and resolve command pipeline behaviors in the dependency injection container.
791
772
  *
792
773
  * @author Xeno
@@ -795,22 +776,6 @@ var TOKENS = Object.freeze({
795
776
  * @link https://github.com/xeno-js/xeno-js
796
777
  */
797
778
  COMMAND_PIPELINES_BEHAVIOR: "COMMAND_PIPELINES_BEHAVIOR",
798
- /** @description Token used to register and resolve the CompositePipeline 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
- COMPOSITE_PIPELINE: "COMPOSITE_PIPELINE",
806
- /** @description Token used to register and resolve the ConcurrencyRetryPipeline instance in the dependency injection container.
807
- *
808
- * @author Xeno
809
- * @version 1.0.0
810
- * @since 2025-09-30
811
- * @link https://github.com/xeno-js/xeno-js
812
- */
813
- CONCURRENCY_RETRY_PIPELINE: "CONCURRENCY_RETRY_PIPELINE",
814
779
  /** @description Token used to register and resolve the ConcurrencyService instance in the dependency injection container.
815
780
  *
816
781
  * @author Xeno
@@ -827,14 +792,6 @@ var TOKENS = Object.freeze({
827
792
  * @link https://github.com/xeno-js/xeno-js
828
793
  */
829
794
  CONFIGURATION_SERVICE: "CONFIGURATION_SERVICE",
830
- /** @description Token used to register and resolve the ConsoleLogger instance in the dependency injection container.
831
- *
832
- * @author Xeno
833
- * @version 1.0.0
834
- * @since 2025-09-30
835
- * @link https://github.com/xeno-js/xeno-js
836
- */
837
- CONSOLE_LOGGER: "CONSOLE_LOGGER",
838
795
  /** @description Token used to register and resolve the ContextAccessor instance in the dependency injection container.
839
796
  *
840
797
  * @author Xeno
@@ -843,46 +800,30 @@ var TOKENS = Object.freeze({
843
800
  * @link https://github.com/xeno-js/xeno-js
844
801
  */
845
802
  CONTEXT_ACCESSOR: "CONTEXT_ACCESSOR",
846
- /** @description Token used to register and resolve the DbContext instance in the dependency injection container.
803
+ /** @description Token used to register and resolve the CryptoService instance in the dependency injection container.
847
804
  *
848
805
  * @author Xeno
849
806
  * @version 1.0.0
850
807
  * @since 2025-09-30
851
808
  * @link https://github.com/xeno-js/xeno-js
852
809
  */
853
- DB_CONTEXT: "DB_CONTEXT",
854
- /** @description Token used to register and resolve the ExceptionPipeline instance in the dependency injection container.
855
- *
856
- * @author Xeno
857
- * @version 1.0.0
858
- * @since 2025-09-30
859
- * @link https://github.com/xeno-js/xeno-js
860
- */
861
- EXCEPTION_PIPELINE: "EXCEPTION_PIPELINE",
862
- /** @description Token used to register and resolve the GateKeeper instance in the dependency injection container.
863
- *
864
- * @author Xeno
865
- * @version 1.0.0
866
- * @since 2025-09-30
867
- * @link https://github.com/xeno-js/xeno-js
868
- */
869
- GATE_KEEPER: "GATE_KEEPER",
870
- /** @description Token used to register and resolve the IdempotencyPipeline instance in the dependency injection container.
810
+ CRYPTO_SERVICE: "CRYPTO_SERVICE",
811
+ /** @description Token used to register and resolve the CsrfTokenService instance in the dependency injection container.
871
812
  *
872
813
  * @author Xeno
873
814
  * @version 1.0.0
874
815
  * @since 2025-09-30
875
816
  * @link https://github.com/xeno-js/xeno-js
876
817
  */
877
- IDEMPOTENCY_PIPELINE: "IDEMPOTENCY_PIPELINE",
878
- /** @description Token used to register and resolve the IdempotencyStore instance in the dependency injection container.
818
+ CSRF_TOKEN_SERVICE: "CSRF_TOKEN_SERVICE",
819
+ /** @description Token used to register and resolve the DbContext instance in the dependency injection container.
879
820
  *
880
821
  * @author Xeno
881
822
  * @version 1.0.0
882
823
  * @since 2025-09-30
883
824
  * @link https://github.com/xeno-js/xeno-js
884
825
  */
885
- IDEMPOTENCY_STORE: "IDEMPOTENCY_STORE",
826
+ DB_CONTEXT: "DB_CONTEXT",
886
827
  /** @description Token used to register and resolve the IdentityAccessor instance in the dependency injection container.
887
828
  *
888
829
  * @author Xeno
@@ -899,22 +840,6 @@ var TOKENS = Object.freeze({
899
840
  * @link https://github.com/xeno-js/xeno-js
900
841
  */
901
842
  LOGGER: "LOGGER",
902
- /** @description Token used to register and resolve the LoggerConfig instance in the dependency injection container.
903
- *
904
- * @author Xeno
905
- * @version 1.0.0
906
- * @since 2025-09-30
907
- * @link https://github.com/xeno-js/xeno-js
908
- */
909
- LOGGER_CONFIG: "LOGGER_CONFIG",
910
- /** @description Token used to register and resolve the LoggingPipeline instance in the dependency injection container.
911
- *
912
- * @author Xeno
913
- * @version 1.0.0
914
- * @since 2025-09-30
915
- * @link https://github.com/xeno-js/xeno-js
916
- */
917
- LOGGING_PIPELINE: "LOGGING_PIPELINE",
918
843
  /** @description Token used to register and resolve the Mediator instance in the dependency injection container.
919
844
  *
920
845
  * @author Xeno
@@ -923,46 +848,14 @@ var TOKENS = Object.freeze({
923
848
  * @link https://github.com/xeno-js/xeno-js
924
849
  */
925
850
  MEDIATOR: "MEDIATOR",
926
- /** @description Token used to register and resolve the PerformancePipeline instance in the dependency injection container.
851
+ /** @description Token used to register and resolve the NetworkContextFactory in the dependency injection container.
927
852
  *
928
853
  * @author Xeno
929
854
  * @version 1.0.0
930
855
  * @since 2025-09-30
931
856
  * @link https://github.com/xeno-js/xeno-js
932
857
  */
933
- PERFORMANCE_PIPELINE: "PERFORMANCE_PIPELINE",
934
- /** @description Token used to register and resolve the PermissionAuthorizationPipeline instance in the dependency injection container.
935
- *
936
- * @author Xeno
937
- * @version 1.0.0
938
- * @since 2025-09-30
939
- * @link https://github.com/xeno-js/xeno-js
940
- */
941
- PERMISSION_AUTHORIZATION_PIPELINE: "PERMISSION_AUTHORIZATION_PIPELINE",
942
- /** @description Token used to register and resolve the PinoLogger instance in the dependency injection container.
943
- *
944
- * @author Xeno
945
- * @version 1.0.0
946
- * @since 2025-09-30
947
- * @link https://github.com/xeno-js/xeno-js
948
- */
949
- PINO_LOGGER: "PINO_LOGGER",
950
- /** @description Token used to register and resolve the PolicyRegistry instance in the dependency injection container.
951
- *
952
- * @author Xeno
953
- * @version 1.0.0
954
- * @since 2025-09-30
955
- * @link https://github.com/xeno-js/xeno-js
956
- */
957
- POLICY_REGISTRY: "POLICY_REGISTRY",
958
- /** @description Token used to register and resolve the QueryCachingPipeline instance in the dependency injection container.
959
- *
960
- * @author Xeno
961
- * @version 1.0.0
962
- * @since 2025-09-30
963
- * @link https://github.com/xeno-js/xeno-js
964
- */
965
- QUERY_CACHING_PIPELINE: "QUERY_CACHING_PIPELINE",
858
+ NETWORK_CONTEXT_ACCESSOR: "NETWORK_CONTEXT_ACCESSOR",
966
859
  /** @description Token used to register and resolve query pipeline behaviors in the dependency injection container.
967
860
  *
968
861
  * @author Xeno
@@ -979,7 +872,7 @@ var TOKENS = Object.freeze({
979
872
  * @link https://github.com/xeno-js/xeno-js
980
873
  */
981
874
  REQUEST_CONTEXT: "REQUEST_CONTEXT",
982
- /** @description Token used to register and resolve the RequestContextMiddleware in the dependency injection container.
875
+ /** @description Token used to register and resolve the CompositeMiddleware in the dependency injection container.
983
876
  *
984
877
  * @author Xeno
985
878
  * @version 1.0.0
@@ -987,14 +880,6 @@ var TOKENS = Object.freeze({
987
880
  * @link https://github.com/xeno-js/xeno-js
988
881
  */
989
882
  MIDDLEWARE: "MIDDLEWARE",
990
- AUTH_MIDDLEWARE: "AUTH_MIDDLEWARE",
991
- CSRF_MIDDLEWARE: "CSRF_MIDDLEWARE",
992
- ALLOW_ORIGIN_MIDDLEWARE: "ALLOW_ORIGIN_MIDDLEWARE",
993
- CORS_MIDDLEWARE: "CORS_MIDDLEWARE",
994
- METHOD_CHECK_MIDDLEWARE: "METHOD_CHECK_MIDDLEWARE",
995
- OPTIONS_MIDDLEWARE: "OPTIONS_MIDDLEWARE",
996
- REQUEST_CONTEXT_MIDDLEWARE: "REQUEST_CONTEXT_MIDDLEWARE",
997
- RATE_LIMITER_MIDDLEWARE: "RATE_LIMITER_MIDDLEWARE",
998
883
  /** @description Token used to register and resolve the IServiceResilience instance in the dependency injection container.
999
884
  *
1000
885
  * @author Xeno
@@ -1003,14 +888,6 @@ var TOKENS = Object.freeze({
1003
888
  * @link https://github.com/xeno-js/xeno-js
1004
889
  */
1005
890
  RESILIENCE_CLIENT: "RESILIENCE_CLIENT",
1006
- /** @description Token used to register and resolve the RoleAuthorizationPipeline instance in the dependency injection container.
1007
- *
1008
- * @author Xeno
1009
- * @version 1.0.0
1010
- * @since 2025-09-30
1011
- * @link https://github.com/xeno-js/xeno-js
1012
- */
1013
- ROLE_AUTHORIZATION_PIPELINE: "ROLE_AUTHORIZATION_PIPELINE",
1014
891
  /** @description Token used to register and resolve the SchemaValidationStrategy instance in the dependency injection container.
1015
892
  *
1016
893
  * @author Xeno
@@ -1019,14 +896,6 @@ var TOKENS = Object.freeze({
1019
896
  * @link https://github.com/xeno-js/xeno-js
1020
897
  */
1021
898
  SCHEMA_VALIDATION_STRATEGY: "SCHEMA_VALIDATION_STRATEGY",
1022
- /** @description Token used to register and resolve the SentryLogger instance in the dependency injection container.
1023
- *
1024
- * @author Xeno
1025
- * @version 1.0.0
1026
- * @since 2025-09-30
1027
- * @link https://github.com/xeno-js/xeno-js
1028
- */
1029
- SENTRY_LOGGER: "SENTRY_LOGGER",
1030
899
  /** @description Token used to register and resolve the ServiceContainer instance in the dependency injection container.
1031
900
  *
1032
901
  * @author Xeno
@@ -1043,22 +912,14 @@ var TOKENS = Object.freeze({
1043
912
  * @link https://github.com/xeno-js/xeno-js
1044
913
  */
1045
914
  SERVICE_EXTRACTOR: "SERVICE_EXTRACTOR",
1046
- /** @description Token used to register and resolve the ServiceScopeFactory instance in the dependency injection container.
915
+ /** @description Token used to register and resolve the ServiceScopeAccessor in the dependency injection container.
1047
916
  *
1048
917
  * @author Xeno
1049
918
  * @version 1.0.0
1050
919
  * @since 2025-09-30
1051
920
  * @link https://github.com/xeno-js/xeno-js
1052
921
  */
1053
- SERVICE_SCOPE_FACTORY: "SERVICE_SCOPE_FACTORY",
1054
- /** @description Token used to register and resolve the TenantAuthorizationPipeline instance in the dependency injection container.
1055
- *
1056
- * @author Xeno
1057
- * @version 1.0.0
1058
- * @since 2025-09-30
1059
- * @link https://github.com/xeno-js/xeno-js
1060
- */
1061
- TENANT_AUTHORIZATION_PIPELINE: "TENANT_AUTHORIZATION_PIPELINE",
922
+ SERVICE_SCOPE_ACCESSOR: "SERVICE_SCOPE_ACCESSOR",
1062
923
  /** @description Token used to register and resolve the UnitOfWork instance in the dependency injection container.
1063
924
  *
1064
925
  * @author Xeno
@@ -1067,34 +928,14 @@ var TOKENS = Object.freeze({
1067
928
  * @link https://github.com/xeno-js/xeno-js
1068
929
  */
1069
930
  UNIT_OF_WORK: "UNIT_OF_WORK",
1070
- /** @description Token used to register and resolve the UserAuthorizationPipeline instance in the dependency injection container.
1071
- *
1072
- * @author Xeno
1073
- * @version 1.0.0
1074
- * @since 2025-09-30
1075
- * @link https://github.com/xeno-js/xeno-js
1076
- */
1077
- USER_AUTHORIZATION_PIPELINE: "USER_AUTHORIZATION_PIPELINE",
1078
- /** @description Token used to register and resolve the ValidationPipeline instance in the dependency injection container.
1079
- *
1080
- * @author Xeno
1081
- * @version 1.0.0
1082
- * @since 2025-09-30
1083
- * @link https://github.com/xeno-js/xeno-js
1084
- */
1085
- VALIDATION_PIPELINE: "VALIDATION_PIPELINE",
1086
- /** @description Token used to register and resolve the ZodValidator instance in the dependency injection container.
931
+ /** @description Token used to register and resolve the ValidatorService instance in the dependency injection container.
1087
932
  *
1088
933
  * @author Xeno
1089
934
  * @version 1.0.0
1090
935
  * @since 2025-09-30
1091
936
  * @link https://github.com/xeno-js/xeno-js
1092
937
  */
1093
- ZOD_VALIDATOR: "ZOD_VALIDATOR",
1094
- SERVICE_SCOPE_ACCESSOR: "SERVICE_SCOPE_ACCESSOR",
1095
- NETWORK_CONTEXT_ACCESSOR: "NETWORK_CONTEXT_ACCESSOR",
1096
- USER_CONTEXT_FACTORY: "USER_CONTEXT_FACTORY",
1097
- TRANSACTION_STATE: "TRANSACTION_STATE"
938
+ VALIDATOR_SERVICE: "VALIDATOR_SERVICE"
1098
939
  });
1099
940
 
1100
941
  // src/shared/utils/guards.utils.ts
@@ -1628,10 +1469,10 @@ var GuidHelper = Object.freeze({
1628
1469
  // src/shared/utils/http.utils.ts
1629
1470
  var HttpHelper = Object.freeze({
1630
1471
  /**
1631
- * @description A function that masks the IP address in the given headers object.
1632
- * @param ip The IP address to mask.
1633
- * @returns The masked IP address.
1634
- */
1472
+ * @description A function that masks the IP address in the given headers object.
1473
+ * @param ip The IP address to mask.
1474
+ * @returns The masked IP address.
1475
+ */
1635
1476
  maskIp(ip) {
1636
1477
  if (!Guards.isDefined(ip)) return void 0;
1637
1478
  if (ip.includes(".")) {
@@ -2137,12 +1978,11 @@ var BaseLogger = class {
2137
1978
  * @param _requestContext The request context that provides contextual information for log messages, such as request-specific data or metadata.
2138
1979
  * @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.
2139
1980
  * @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).
2140
-
2141
- *
1981
+ *
2142
1982
  * @author Xeno
2143
1983
  * @version 1.0.0
2144
1984
  * @since 2025-09-30
2145
- * @link https://github.com/xeno-js/xeno-js
1985
+ * @link https://github.com/xeno-js/xeno-js
2146
1986
  */
2147
1987
  constructor(_requestContext, config, loggers) {
2148
1988
  this._requestContext = _requestContext;
@@ -2171,12 +2011,11 @@ var BaseLogger = class {
2171
2011
  * @param message The log message.
2172
2012
  * @param context Optional context information to include with the log message.
2173
2013
  * @param error Optional error object to include with the log message.
2174
-
2175
- *
2014
+ *
2176
2015
  * @author Xeno
2177
2016
  * @version 1.0.0
2178
2017
  * @since 2025-09-30
2179
- * @link https://github.com/xeno-js/xeno-js
2018
+ * @link https://github.com/xeno-js/xeno-js
2180
2019
  */
2181
2020
  broadcast(level, message, error = void 0) {
2182
2021
  if (level < this._minLevel) return;