@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 +8 -8
- package/dist/index.cjs +24 -185
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +130 -217
- package/dist/index.d.ts +130 -217
- package/dist/index.js +24 -185
- package/dist/index.js.map +1 -1
- package/package.json +110 -109
package/dist/index.js
CHANGED
|
@@ -657,17 +657,7 @@ var RESILIENCE_DEFAULTS = Object.freeze({
|
|
|
657
657
|
|
|
658
658
|
// src/shared/constants/tokens.constants.ts
|
|
659
659
|
var TOKENS = Object.freeze({
|
|
660
|
-
|
|
661
|
-
ALLOW_METHOD: "ALLOW_METHOD",
|
|
662
|
-
/** @description Token used to register and resolve the AuthorizationPipeline instance in the dependency injection container.
|
|
663
|
-
*
|
|
664
|
-
* @author Xeno
|
|
665
|
-
* @version 1.0.0
|
|
666
|
-
* @since 2025-09-30
|
|
667
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
668
|
-
*/
|
|
669
|
-
AUTHORIZATION_PIPELINE: "AUTHORIZATION_PIPELINE",
|
|
670
|
-
/** @description Token used to register and resolve the AuthService instance in the dependency injection container.
|
|
660
|
+
/** @description Token used to register and resolve the Extendend AuthService instance in the dependency injection container.
|
|
671
661
|
*
|
|
672
662
|
* @author Xeno
|
|
673
663
|
* @version 1.0.0
|
|
@@ -675,15 +665,14 @@ var TOKENS = Object.freeze({
|
|
|
675
665
|
* @link https://github.com/xeno-js/xeno-js
|
|
676
666
|
*/
|
|
677
667
|
AUTH_SERVICE: "AUTH_SERVICE",
|
|
678
|
-
|
|
679
|
-
/** @description Token used to register and resolve the BearerTokenExtractor instance in the dependency injection container.
|
|
668
|
+
/** @description Token used to register and resolve the BaseAuthService instance in the dependency injection container.
|
|
680
669
|
*
|
|
681
670
|
* @author Xeno
|
|
682
671
|
* @version 1.0.0
|
|
683
672
|
* @since 2025-09-30
|
|
684
673
|
* @link https://github.com/xeno-js/xeno-js
|
|
685
674
|
*/
|
|
686
|
-
|
|
675
|
+
BASE_AUTH_SERVICE: "BASE_AUTH_SERVICE",
|
|
687
676
|
/** @description Token used to register and resolve the InMemoryCache instance in the dependency injection container.
|
|
688
677
|
*
|
|
689
678
|
* @author Xeno
|
|
@@ -700,14 +689,6 @@ var TOKENS = Object.freeze({
|
|
|
700
689
|
* @link https://github.com/xeno-js/xeno-js
|
|
701
690
|
*/
|
|
702
691
|
CACHE_KEY_BUILDER: "CACHE_KEY_BUILDER",
|
|
703
|
-
/** @description Token used to register and resolve the ClaimsIdentityMapper instance in the dependency injection container.
|
|
704
|
-
*
|
|
705
|
-
* @author Xeno
|
|
706
|
-
* @version 1.0.0
|
|
707
|
-
* @since 2025-09-30
|
|
708
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
709
|
-
*/
|
|
710
|
-
CLAIMS_IDENTITY_MAPPER: "CLAIMS_IDENTITY_MAPPER",
|
|
711
692
|
/** @description Token used to register and resolve command pipeline behaviors in the dependency injection container.
|
|
712
693
|
*
|
|
713
694
|
* @author Xeno
|
|
@@ -716,22 +697,6 @@ var TOKENS = Object.freeze({
|
|
|
716
697
|
* @link https://github.com/xeno-js/xeno-js
|
|
717
698
|
*/
|
|
718
699
|
COMMAND_PIPELINES_BEHAVIOR: "COMMAND_PIPELINES_BEHAVIOR",
|
|
719
|
-
/** @description Token used to register and resolve the CompositePipeline instance in the dependency injection container.
|
|
720
|
-
*
|
|
721
|
-
* @author Xeno
|
|
722
|
-
* @version 1.0.0
|
|
723
|
-
* @since 2025-09-30
|
|
724
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
725
|
-
*/
|
|
726
|
-
COMPOSITE_PIPELINE: "COMPOSITE_PIPELINE",
|
|
727
|
-
/** @description Token used to register and resolve the ConcurrencyRetryPipeline instance in the dependency injection container.
|
|
728
|
-
*
|
|
729
|
-
* @author Xeno
|
|
730
|
-
* @version 1.0.0
|
|
731
|
-
* @since 2025-09-30
|
|
732
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
733
|
-
*/
|
|
734
|
-
CONCURRENCY_RETRY_PIPELINE: "CONCURRENCY_RETRY_PIPELINE",
|
|
735
700
|
/** @description Token used to register and resolve the ConcurrencyService instance in the dependency injection container.
|
|
736
701
|
*
|
|
737
702
|
* @author Xeno
|
|
@@ -748,14 +713,6 @@ var TOKENS = Object.freeze({
|
|
|
748
713
|
* @link https://github.com/xeno-js/xeno-js
|
|
749
714
|
*/
|
|
750
715
|
CONFIGURATION_SERVICE: "CONFIGURATION_SERVICE",
|
|
751
|
-
/** @description Token used to register and resolve the ConsoleLogger instance in the dependency injection container.
|
|
752
|
-
*
|
|
753
|
-
* @author Xeno
|
|
754
|
-
* @version 1.0.0
|
|
755
|
-
* @since 2025-09-30
|
|
756
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
757
|
-
*/
|
|
758
|
-
CONSOLE_LOGGER: "CONSOLE_LOGGER",
|
|
759
716
|
/** @description Token used to register and resolve the ContextAccessor instance in the dependency injection container.
|
|
760
717
|
*
|
|
761
718
|
* @author Xeno
|
|
@@ -764,46 +721,30 @@ var TOKENS = Object.freeze({
|
|
|
764
721
|
* @link https://github.com/xeno-js/xeno-js
|
|
765
722
|
*/
|
|
766
723
|
CONTEXT_ACCESSOR: "CONTEXT_ACCESSOR",
|
|
767
|
-
/** @description Token used to register and resolve the
|
|
724
|
+
/** @description Token used to register and resolve the CryptoService instance in the dependency injection container.
|
|
768
725
|
*
|
|
769
726
|
* @author Xeno
|
|
770
727
|
* @version 1.0.0
|
|
771
728
|
* @since 2025-09-30
|
|
772
729
|
* @link https://github.com/xeno-js/xeno-js
|
|
773
730
|
*/
|
|
774
|
-
|
|
775
|
-
/** @description Token used to register and resolve the
|
|
776
|
-
*
|
|
777
|
-
* @author Xeno
|
|
778
|
-
* @version 1.0.0
|
|
779
|
-
* @since 2025-09-30
|
|
780
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
781
|
-
*/
|
|
782
|
-
EXCEPTION_PIPELINE: "EXCEPTION_PIPELINE",
|
|
783
|
-
/** @description Token used to register and resolve the GateKeeper instance in the dependency injection container.
|
|
784
|
-
*
|
|
785
|
-
* @author Xeno
|
|
786
|
-
* @version 1.0.0
|
|
787
|
-
* @since 2025-09-30
|
|
788
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
789
|
-
*/
|
|
790
|
-
GATE_KEEPER: "GATE_KEEPER",
|
|
791
|
-
/** @description Token used to register and resolve the IdempotencyPipeline instance in the dependency injection container.
|
|
731
|
+
CRYPTO_SERVICE: "CRYPTO_SERVICE",
|
|
732
|
+
/** @description Token used to register and resolve the CsrfTokenService instance in the dependency injection container.
|
|
792
733
|
*
|
|
793
734
|
* @author Xeno
|
|
794
735
|
* @version 1.0.0
|
|
795
736
|
* @since 2025-09-30
|
|
796
737
|
* @link https://github.com/xeno-js/xeno-js
|
|
797
738
|
*/
|
|
798
|
-
|
|
799
|
-
/** @description Token used to register and resolve the
|
|
739
|
+
CSRF_TOKEN_SERVICE: "CSRF_TOKEN_SERVICE",
|
|
740
|
+
/** @description Token used to register and resolve the DbContext instance in the dependency injection container.
|
|
800
741
|
*
|
|
801
742
|
* @author Xeno
|
|
802
743
|
* @version 1.0.0
|
|
803
744
|
* @since 2025-09-30
|
|
804
745
|
* @link https://github.com/xeno-js/xeno-js
|
|
805
746
|
*/
|
|
806
|
-
|
|
747
|
+
DB_CONTEXT: "DB_CONTEXT",
|
|
807
748
|
/** @description Token used to register and resolve the IdentityAccessor instance in the dependency injection container.
|
|
808
749
|
*
|
|
809
750
|
* @author Xeno
|
|
@@ -820,22 +761,6 @@ var TOKENS = Object.freeze({
|
|
|
820
761
|
* @link https://github.com/xeno-js/xeno-js
|
|
821
762
|
*/
|
|
822
763
|
LOGGER: "LOGGER",
|
|
823
|
-
/** @description Token used to register and resolve the LoggerConfig instance in the dependency injection container.
|
|
824
|
-
*
|
|
825
|
-
* @author Xeno
|
|
826
|
-
* @version 1.0.0
|
|
827
|
-
* @since 2025-09-30
|
|
828
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
829
|
-
*/
|
|
830
|
-
LOGGER_CONFIG: "LOGGER_CONFIG",
|
|
831
|
-
/** @description Token used to register and resolve the LoggingPipeline instance in the dependency injection container.
|
|
832
|
-
*
|
|
833
|
-
* @author Xeno
|
|
834
|
-
* @version 1.0.0
|
|
835
|
-
* @since 2025-09-30
|
|
836
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
837
|
-
*/
|
|
838
|
-
LOGGING_PIPELINE: "LOGGING_PIPELINE",
|
|
839
764
|
/** @description Token used to register and resolve the Mediator instance in the dependency injection container.
|
|
840
765
|
*
|
|
841
766
|
* @author Xeno
|
|
@@ -844,46 +769,14 @@ var TOKENS = Object.freeze({
|
|
|
844
769
|
* @link https://github.com/xeno-js/xeno-js
|
|
845
770
|
*/
|
|
846
771
|
MEDIATOR: "MEDIATOR",
|
|
847
|
-
/** @description Token used to register and resolve the
|
|
772
|
+
/** @description Token used to register and resolve the NetworkContextFactory in the dependency injection container.
|
|
848
773
|
*
|
|
849
774
|
* @author Xeno
|
|
850
775
|
* @version 1.0.0
|
|
851
776
|
* @since 2025-09-30
|
|
852
777
|
* @link https://github.com/xeno-js/xeno-js
|
|
853
778
|
*/
|
|
854
|
-
|
|
855
|
-
/** @description Token used to register and resolve the PermissionAuthorizationPipeline 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
|
-
PERMISSION_AUTHORIZATION_PIPELINE: "PERMISSION_AUTHORIZATION_PIPELINE",
|
|
863
|
-
/** @description Token used to register and resolve the PinoLogger 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
|
-
PINO_LOGGER: "PINO_LOGGER",
|
|
871
|
-
/** @description Token used to register and resolve the PolicyRegistry instance in the dependency injection container.
|
|
872
|
-
*
|
|
873
|
-
* @author Xeno
|
|
874
|
-
* @version 1.0.0
|
|
875
|
-
* @since 2025-09-30
|
|
876
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
877
|
-
*/
|
|
878
|
-
POLICY_REGISTRY: "POLICY_REGISTRY",
|
|
879
|
-
/** @description Token used to register and resolve the QueryCachingPipeline instance in the dependency injection container.
|
|
880
|
-
*
|
|
881
|
-
* @author Xeno
|
|
882
|
-
* @version 1.0.0
|
|
883
|
-
* @since 2025-09-30
|
|
884
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
885
|
-
*/
|
|
886
|
-
QUERY_CACHING_PIPELINE: "QUERY_CACHING_PIPELINE",
|
|
779
|
+
NETWORK_CONTEXT_ACCESSOR: "NETWORK_CONTEXT_ACCESSOR",
|
|
887
780
|
/** @description Token used to register and resolve query pipeline behaviors in the dependency injection container.
|
|
888
781
|
*
|
|
889
782
|
* @author Xeno
|
|
@@ -900,7 +793,7 @@ var TOKENS = Object.freeze({
|
|
|
900
793
|
* @link https://github.com/xeno-js/xeno-js
|
|
901
794
|
*/
|
|
902
795
|
REQUEST_CONTEXT: "REQUEST_CONTEXT",
|
|
903
|
-
/** @description Token used to register and resolve the
|
|
796
|
+
/** @description Token used to register and resolve the CompositeMiddleware in the dependency injection container.
|
|
904
797
|
*
|
|
905
798
|
* @author Xeno
|
|
906
799
|
* @version 1.0.0
|
|
@@ -908,14 +801,6 @@ var TOKENS = Object.freeze({
|
|
|
908
801
|
* @link https://github.com/xeno-js/xeno-js
|
|
909
802
|
*/
|
|
910
803
|
MIDDLEWARE: "MIDDLEWARE",
|
|
911
|
-
AUTH_MIDDLEWARE: "AUTH_MIDDLEWARE",
|
|
912
|
-
CSRF_MIDDLEWARE: "CSRF_MIDDLEWARE",
|
|
913
|
-
ALLOW_ORIGIN_MIDDLEWARE: "ALLOW_ORIGIN_MIDDLEWARE",
|
|
914
|
-
CORS_MIDDLEWARE: "CORS_MIDDLEWARE",
|
|
915
|
-
METHOD_CHECK_MIDDLEWARE: "METHOD_CHECK_MIDDLEWARE",
|
|
916
|
-
OPTIONS_MIDDLEWARE: "OPTIONS_MIDDLEWARE",
|
|
917
|
-
REQUEST_CONTEXT_MIDDLEWARE: "REQUEST_CONTEXT_MIDDLEWARE",
|
|
918
|
-
RATE_LIMITER_MIDDLEWARE: "RATE_LIMITER_MIDDLEWARE",
|
|
919
804
|
/** @description Token used to register and resolve the IServiceResilience instance in the dependency injection container.
|
|
920
805
|
*
|
|
921
806
|
* @author Xeno
|
|
@@ -924,14 +809,6 @@ var TOKENS = Object.freeze({
|
|
|
924
809
|
* @link https://github.com/xeno-js/xeno-js
|
|
925
810
|
*/
|
|
926
811
|
RESILIENCE_CLIENT: "RESILIENCE_CLIENT",
|
|
927
|
-
/** @description Token used to register and resolve the RoleAuthorizationPipeline 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
|
-
ROLE_AUTHORIZATION_PIPELINE: "ROLE_AUTHORIZATION_PIPELINE",
|
|
935
812
|
/** @description Token used to register and resolve the SchemaValidationStrategy instance in the dependency injection container.
|
|
936
813
|
*
|
|
937
814
|
* @author Xeno
|
|
@@ -940,14 +817,6 @@ var TOKENS = Object.freeze({
|
|
|
940
817
|
* @link https://github.com/xeno-js/xeno-js
|
|
941
818
|
*/
|
|
942
819
|
SCHEMA_VALIDATION_STRATEGY: "SCHEMA_VALIDATION_STRATEGY",
|
|
943
|
-
/** @description Token used to register and resolve the SentryLogger instance in the dependency injection container.
|
|
944
|
-
*
|
|
945
|
-
* @author Xeno
|
|
946
|
-
* @version 1.0.0
|
|
947
|
-
* @since 2025-09-30
|
|
948
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
949
|
-
*/
|
|
950
|
-
SENTRY_LOGGER: "SENTRY_LOGGER",
|
|
951
820
|
/** @description Token used to register and resolve the ServiceContainer instance in the dependency injection container.
|
|
952
821
|
*
|
|
953
822
|
* @author Xeno
|
|
@@ -964,22 +833,14 @@ var TOKENS = Object.freeze({
|
|
|
964
833
|
* @link https://github.com/xeno-js/xeno-js
|
|
965
834
|
*/
|
|
966
835
|
SERVICE_EXTRACTOR: "SERVICE_EXTRACTOR",
|
|
967
|
-
/** @description Token used to register and resolve the
|
|
836
|
+
/** @description Token used to register and resolve the ServiceScopeAccessor in the dependency injection container.
|
|
968
837
|
*
|
|
969
838
|
* @author Xeno
|
|
970
839
|
* @version 1.0.0
|
|
971
840
|
* @since 2025-09-30
|
|
972
841
|
* @link https://github.com/xeno-js/xeno-js
|
|
973
842
|
*/
|
|
974
|
-
|
|
975
|
-
/** @description Token used to register and resolve the TenantAuthorizationPipeline instance in the dependency injection container.
|
|
976
|
-
*
|
|
977
|
-
* @author Xeno
|
|
978
|
-
* @version 1.0.0
|
|
979
|
-
* @since 2025-09-30
|
|
980
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
981
|
-
*/
|
|
982
|
-
TENANT_AUTHORIZATION_PIPELINE: "TENANT_AUTHORIZATION_PIPELINE",
|
|
843
|
+
SERVICE_SCOPE_ACCESSOR: "SERVICE_SCOPE_ACCESSOR",
|
|
983
844
|
/** @description Token used to register and resolve the UnitOfWork instance in the dependency injection container.
|
|
984
845
|
*
|
|
985
846
|
* @author Xeno
|
|
@@ -988,34 +849,14 @@ var TOKENS = Object.freeze({
|
|
|
988
849
|
* @link https://github.com/xeno-js/xeno-js
|
|
989
850
|
*/
|
|
990
851
|
UNIT_OF_WORK: "UNIT_OF_WORK",
|
|
991
|
-
/** @description Token used to register and resolve the
|
|
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
|
-
USER_AUTHORIZATION_PIPELINE: "USER_AUTHORIZATION_PIPELINE",
|
|
999
|
-
/** @description Token used to register and resolve the ValidationPipeline 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
|
-
VALIDATION_PIPELINE: "VALIDATION_PIPELINE",
|
|
1007
|
-
/** @description Token used to register and resolve the ZodValidator instance in the dependency injection container.
|
|
852
|
+
/** @description Token used to register and resolve the ValidatorService instance in the dependency injection container.
|
|
1008
853
|
*
|
|
1009
854
|
* @author Xeno
|
|
1010
855
|
* @version 1.0.0
|
|
1011
856
|
* @since 2025-09-30
|
|
1012
857
|
* @link https://github.com/xeno-js/xeno-js
|
|
1013
858
|
*/
|
|
1014
|
-
|
|
1015
|
-
SERVICE_SCOPE_ACCESSOR: "SERVICE_SCOPE_ACCESSOR",
|
|
1016
|
-
NETWORK_CONTEXT_ACCESSOR: "NETWORK_CONTEXT_ACCESSOR",
|
|
1017
|
-
USER_CONTEXT_FACTORY: "USER_CONTEXT_FACTORY",
|
|
1018
|
-
TRANSACTION_STATE: "TRANSACTION_STATE"
|
|
859
|
+
VALIDATOR_SERVICE: "VALIDATOR_SERVICE"
|
|
1019
860
|
});
|
|
1020
861
|
|
|
1021
862
|
// src/shared/utils/guards.utils.ts
|
|
@@ -1549,10 +1390,10 @@ var GuidHelper = Object.freeze({
|
|
|
1549
1390
|
// src/shared/utils/http.utils.ts
|
|
1550
1391
|
var HttpHelper = Object.freeze({
|
|
1551
1392
|
/**
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1393
|
+
* @description A function that masks the IP address in the given headers object.
|
|
1394
|
+
* @param ip The IP address to mask.
|
|
1395
|
+
* @returns The masked IP address.
|
|
1396
|
+
*/
|
|
1556
1397
|
maskIp(ip) {
|
|
1557
1398
|
if (!Guards.isDefined(ip)) return void 0;
|
|
1558
1399
|
if (ip.includes(".")) {
|
|
@@ -2058,12 +1899,11 @@ var BaseLogger = class {
|
|
|
2058
1899
|
* @param _requestContext The request context that provides contextual information for log messages, such as request-specific data or metadata.
|
|
2059
1900
|
* @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.
|
|
2060
1901
|
* @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).
|
|
2061
|
-
|
|
2062
|
-
*
|
|
1902
|
+
*
|
|
2063
1903
|
* @author Xeno
|
|
2064
1904
|
* @version 1.0.0
|
|
2065
1905
|
* @since 2025-09-30
|
|
2066
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1906
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
2067
1907
|
*/
|
|
2068
1908
|
constructor(_requestContext, config, loggers) {
|
|
2069
1909
|
this._requestContext = _requestContext;
|
|
@@ -2092,12 +1932,11 @@ var BaseLogger = class {
|
|
|
2092
1932
|
* @param message The log message.
|
|
2093
1933
|
* @param context Optional context information to include with the log message.
|
|
2094
1934
|
* @param error Optional error object to include with the log message.
|
|
2095
|
-
|
|
2096
|
-
*
|
|
1935
|
+
*
|
|
2097
1936
|
* @author Xeno
|
|
2098
1937
|
* @version 1.0.0
|
|
2099
1938
|
* @since 2025-09-30
|
|
2100
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1939
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
2101
1940
|
*/
|
|
2102
1941
|
broadcast(level, message, error = void 0) {
|
|
2103
1942
|
if (level < this._minLevel) return;
|