perimeterx-js-core 0.16.1 → 0.18.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.
Files changed (103) hide show
  1. package/lib/cjs/activities/HttpActivityClient.js +27 -7
  2. package/lib/cjs/activities/utils.js +3 -3
  3. package/lib/cjs/blocker/utils.js +2 -1
  4. package/lib/cjs/config/defaults/constants.js +0 -0
  5. package/lib/cjs/context/ContextJson.js +2 -0
  6. package/lib/cjs/context/DefaultContext.js +41 -20
  7. package/lib/cjs/context/SerializedContext.js +66 -0
  8. package/lib/cjs/context/index.js +2 -0
  9. package/lib/cjs/enforcer/EnforcerBase.js +2 -101
  10. package/lib/cjs/enforcer/index.js +3 -3
  11. package/lib/cjs/enforcer/utils.js +96 -0
  12. package/lib/cjs/impl/url/UrlImpl.js +3 -0
  13. package/lib/cjs/products/bot_defender/first_party/IDefaultBotDefenderFirstPartyConfiguration.js +0 -0
  14. package/lib/cjs/products/credential_intelligence/endpoint/extractor/BodyCredentialExtractor.js +4 -6
  15. package/lib/cjs/products/credential_intelligence/endpoint/extractor/CustomCredentialExtractor.js +1 -11
  16. package/lib/cjs/products/hype_sale_challenge/HypeSaleChallenge.js +1 -1
  17. package/lib/cjs/risk_api/risk_response/RiskResponseBase.js +14 -0
  18. package/lib/cjs/risk_api/risk_response/index.js +1 -0
  19. package/lib/cjs/risk_api/risk_response/serialize/RiskResponseJson.js +2 -0
  20. package/lib/cjs/risk_api/risk_response/serialize/SerializedRiskResponse.js +22 -0
  21. package/lib/cjs/risk_api/risk_response/serialize/index.js +18 -0
  22. package/lib/cjs/risk_token/parser/TokenParserBase.js +1 -1
  23. package/lib/cjs/risk_token/token/TokenBase.js +31 -7
  24. package/lib/cjs/risk_token/token/index.js +19 -9
  25. package/lib/cjs/risk_token/token/serialize/SerializedToken.js +30 -0
  26. package/lib/cjs/risk_token/token/serialize/TokenJson.js +2 -0
  27. package/lib/cjs/risk_token/token/serialize/index.js +18 -0
  28. package/lib/cjs/risk_token/token/v2/index.js +18 -0
  29. package/lib/cjs/risk_token/token/v3/DefaultTokenV3.js +3 -2
  30. package/lib/cjs/risk_token/token/v3/index.js +19 -0
  31. package/lib/cjs/utils/constants.js +1 -1
  32. package/lib/cjs/utils/cookie_parser/StringSplitCookieParser.js +20 -4
  33. package/lib/esm/activities/HttpActivityClient.js +27 -7
  34. package/lib/esm/activities/utils.js +3 -3
  35. package/lib/esm/blocker/utils.js +2 -1
  36. package/lib/esm/config/defaults/constants.js +0 -0
  37. package/lib/esm/context/ContextJson.js +1 -0
  38. package/lib/esm/context/DefaultContext.js +36 -13
  39. package/lib/esm/context/SerializedContext.js +87 -0
  40. package/lib/esm/context/index.js +2 -0
  41. package/lib/esm/enforcer/EnforcerBase.js +2 -89
  42. package/lib/esm/enforcer/index.js +3 -1
  43. package/lib/esm/enforcer/utils.js +79 -0
  44. package/lib/esm/impl/url/UrlImpl.js +3 -0
  45. package/lib/esm/products/bot_defender/first_party/IDefaultBotDefenderFirstPartyConfiguration.js +0 -0
  46. package/lib/esm/products/credential_intelligence/endpoint/extractor/BodyCredentialExtractor.js +6 -8
  47. package/lib/esm/products/credential_intelligence/endpoint/extractor/CustomCredentialExtractor.js +1 -6
  48. package/lib/esm/products/hype_sale_challenge/HypeSaleChallenge.js +1 -1
  49. package/lib/esm/risk_api/risk_response/RiskResponseBase.js +14 -0
  50. package/lib/esm/risk_api/risk_response/index.js +1 -0
  51. package/lib/esm/risk_api/risk_response/serialize/RiskResponseJson.js +1 -0
  52. package/lib/esm/risk_api/risk_response/serialize/SerializedRiskResponse.js +27 -0
  53. package/lib/esm/risk_api/risk_response/serialize/index.js +2 -0
  54. package/lib/esm/risk_token/parser/TokenParserBase.js +1 -1
  55. package/lib/esm/risk_token/token/TokenBase.js +19 -4
  56. package/lib/esm/risk_token/token/index.js +5 -4
  57. package/lib/esm/risk_token/token/serialize/SerializedToken.js +36 -0
  58. package/lib/esm/risk_token/token/serialize/TokenJson.js +1 -0
  59. package/lib/esm/risk_token/token/serialize/index.js +2 -0
  60. package/lib/esm/risk_token/token/v2/index.js +2 -0
  61. package/lib/esm/risk_token/token/v3/DefaultTokenV3.js +2 -2
  62. package/lib/esm/risk_token/token/v3/index.js +3 -0
  63. package/lib/esm/utils/constants.js +1 -1
  64. package/lib/esm/utils/cookie_parser/StringSplitCookieParser.js +16 -3
  65. package/lib/types/activities/HttpActivityClient.d.ts +6 -0
  66. package/lib/types/activities/utils.d.ts +91 -60
  67. package/lib/types/blocker/utils.d.ts +9 -6
  68. package/lib/types/config/defaults/constants.d.ts +0 -0
  69. package/lib/types/context/ContextJson.d.ts +41 -0
  70. package/lib/types/context/DefaultContext.d.ts +5 -3
  71. package/lib/types/context/SerializedContext.d.ts +46 -0
  72. package/lib/types/context/index.d.ts +2 -0
  73. package/lib/types/enforcer/EnforcerBase.d.ts +2 -13
  74. package/lib/types/enforcer/index.d.ts +3 -2
  75. package/lib/types/enforcer/utils.d.ts +7 -0
  76. package/lib/types/impl/url/UrlImpl.d.ts +1 -0
  77. package/lib/types/monitored_request/MonitoredRequestUtils.d.ts +27 -18
  78. package/lib/types/phase/flow/EndEnforcerFlow.d.ts +1 -1
  79. package/lib/types/phase/flow/EnforceFlow.d.ts +3 -1
  80. package/lib/types/phase/flow/PostEnforceFlow.d.ts +1 -1
  81. package/lib/types/products/bot_defender/first_party/IDefaultBotDefenderFirstPartyConfiguration.d.ts +0 -0
  82. package/lib/types/products/bot_defender/first_party/utils.d.ts +7 -6
  83. package/lib/types/pxhd/PXHDUtils.d.ts +18 -12
  84. package/lib/types/risk_api/risk_response/RiskResponseBase.d.ts +2 -0
  85. package/lib/types/risk_api/risk_response/index.d.ts +1 -0
  86. package/lib/types/risk_api/risk_response/serialize/RiskResponseJson.d.ts +15 -0
  87. package/lib/types/risk_api/risk_response/serialize/SerializedRiskResponse.d.ts +19 -0
  88. package/lib/types/risk_api/risk_response/serialize/index.d.ts +2 -0
  89. package/lib/types/risk_token/token/IToken.d.ts +3 -3
  90. package/lib/types/risk_token/token/TokenBase.d.ts +6 -4
  91. package/lib/types/risk_token/token/index.d.ts +5 -7
  92. package/lib/types/risk_token/token/serialize/SerializedToken.d.ts +23 -0
  93. package/lib/types/risk_token/token/serialize/TokenJson.d.ts +13 -0
  94. package/lib/types/risk_token/token/serialize/index.d.ts +2 -0
  95. package/lib/types/risk_token/token/v2/index.d.ts +2 -0
  96. package/lib/types/risk_token/token/v3/DefaultTokenV3.d.ts +1 -1
  97. package/lib/types/risk_token/token/v3/index.d.ts +3 -0
  98. package/lib/types/sensitive_request/SensitiveRequestUtils.d.ts +18 -12
  99. package/lib/types/utils/constants.d.ts +1 -1
  100. package/lib/types/utils/cookie_parser/ICookieParser.d.ts +1 -1
  101. package/lib/types/utils/cookie_parser/StringSplitCookieParser.d.ts +5 -2
  102. package/lib/types/utils/url/IUrl.d.ts +1 -0
  103. package/package.json +1 -1
@@ -34,6 +34,7 @@ export declare const createAsyncActivity: <Req, Res>(activityType: ActivityType,
34
34
  readonly has: (name: string) => boolean;
35
35
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
36
36
  };
37
+ readonly toJSON: () => string;
37
38
  };
38
39
  readonly rawUrl: string;
39
40
  readonly method: import("..").HttpMethod;
@@ -106,6 +107,7 @@ export declare const createAsyncActivity: <Req, Res>(activityType: ActivityType,
106
107
  readonly has: (name: string) => boolean;
107
108
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
108
109
  };
110
+ readonly toJSON: () => string;
109
111
  };
110
112
  readonly rawUrl: string;
111
113
  readonly method: import("..").HttpMethod;
@@ -290,9 +292,9 @@ export declare const createAsyncActivity: <Req, Res>(activityType: ActivityType,
290
292
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
291
293
  readonly isExpired: () => boolean;
292
294
  readonly isHighScore: () => boolean;
293
- readonly isValid: () => boolean;
294
- readonly getTokenString: () => string;
295
- readonly getPayloadString: () => string;
295
+ readonly isValidated: boolean;
296
+ readonly tokenString: string;
297
+ readonly payloadString: string;
296
298
  };
297
299
  readonly mobileData?: {
298
300
  readonly mobileError?: import("../risk_token").MobileError;
@@ -331,6 +333,7 @@ export declare const createAsyncActivity: <Req, Res>(activityType: ActivityType,
331
333
  readonly has: (name: string) => boolean;
332
334
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
333
335
  };
336
+ readonly toJSON: () => string;
334
337
  };
335
338
  readonly rawUrl: string;
336
339
  readonly method: import("..").HttpMethod;
@@ -515,9 +518,9 @@ export declare const createAsyncActivity: <Req, Res>(activityType: ActivityType,
515
518
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
516
519
  readonly isExpired: () => boolean;
517
520
  readonly isHighScore: () => boolean;
518
- readonly isValid: () => boolean;
519
- readonly getTokenString: () => string;
520
- readonly getPayloadString: () => string;
521
+ readonly isValidated: boolean;
522
+ readonly tokenString: string;
523
+ readonly payloadString: string;
521
524
  };
522
525
  readonly bypassReason?: string;
523
526
  readonly originalTokenParseResult?: TokenParseResult;
@@ -697,6 +700,7 @@ export declare const createActivityDetails: <Req, Res>(activityType: ActivityTyp
697
700
  readonly has: (name: string) => boolean;
698
701
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
699
702
  };
703
+ readonly toJSON: () => string;
700
704
  };
701
705
  readonly rawUrl: string;
702
706
  readonly method: import("..").HttpMethod;
@@ -769,6 +773,7 @@ export declare const createActivityDetails: <Req, Res>(activityType: ActivityTyp
769
773
  readonly has: (name: string) => boolean;
770
774
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
771
775
  };
776
+ readonly toJSON: () => string;
772
777
  };
773
778
  readonly rawUrl: string;
774
779
  readonly method: import("..").HttpMethod;
@@ -953,9 +958,9 @@ export declare const createActivityDetails: <Req, Res>(activityType: ActivityTyp
953
958
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
954
959
  readonly isExpired: () => boolean;
955
960
  readonly isHighScore: () => boolean;
956
- readonly isValid: () => boolean;
957
- readonly getTokenString: () => string;
958
- readonly getPayloadString: () => string;
961
+ readonly isValidated: boolean;
962
+ readonly tokenString: string;
963
+ readonly payloadString: string;
959
964
  };
960
965
  readonly mobileData?: {
961
966
  readonly mobileError?: import("../risk_token").MobileError;
@@ -994,6 +999,7 @@ export declare const createActivityDetails: <Req, Res>(activityType: ActivityTyp
994
999
  readonly has: (name: string) => boolean;
995
1000
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
996
1001
  };
1002
+ readonly toJSON: () => string;
997
1003
  };
998
1004
  readonly rawUrl: string;
999
1005
  readonly method: import("..").HttpMethod;
@@ -1178,9 +1184,9 @@ export declare const createActivityDetails: <Req, Res>(activityType: ActivityTyp
1178
1184
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
1179
1185
  readonly isExpired: () => boolean;
1180
1186
  readonly isHighScore: () => boolean;
1181
- readonly isValid: () => boolean;
1182
- readonly getTokenString: () => string;
1183
- readonly getPayloadString: () => string;
1187
+ readonly isValidated: boolean;
1188
+ readonly tokenString: string;
1189
+ readonly payloadString: string;
1184
1190
  };
1185
1191
  readonly bypassReason?: string;
1186
1192
  readonly originalTokenParseResult?: TokenParseResult;
@@ -1360,6 +1366,7 @@ export declare const createAsyncActivityCommonDetails: <Req, Res>(context: {
1360
1366
  readonly has: (name: string) => boolean;
1361
1367
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
1362
1368
  };
1369
+ readonly toJSON: () => string;
1363
1370
  };
1364
1371
  readonly rawUrl: string;
1365
1372
  readonly method: import("..").HttpMethod;
@@ -1432,6 +1439,7 @@ export declare const createAsyncActivityCommonDetails: <Req, Res>(context: {
1432
1439
  readonly has: (name: string) => boolean;
1433
1440
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
1434
1441
  };
1442
+ readonly toJSON: () => string;
1435
1443
  };
1436
1444
  readonly rawUrl: string;
1437
1445
  readonly method: import("..").HttpMethod;
@@ -1616,9 +1624,9 @@ export declare const createAsyncActivityCommonDetails: <Req, Res>(context: {
1616
1624
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
1617
1625
  readonly isExpired: () => boolean;
1618
1626
  readonly isHighScore: () => boolean;
1619
- readonly isValid: () => boolean;
1620
- readonly getTokenString: () => string;
1621
- readonly getPayloadString: () => string;
1627
+ readonly isValidated: boolean;
1628
+ readonly tokenString: string;
1629
+ readonly payloadString: string;
1622
1630
  };
1623
1631
  readonly mobileData?: {
1624
1632
  readonly mobileError?: import("../risk_token").MobileError;
@@ -1657,6 +1665,7 @@ export declare const createAsyncActivityCommonDetails: <Req, Res>(context: {
1657
1665
  readonly has: (name: string) => boolean;
1658
1666
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
1659
1667
  };
1668
+ readonly toJSON: () => string;
1660
1669
  };
1661
1670
  readonly rawUrl: string;
1662
1671
  readonly method: import("..").HttpMethod;
@@ -1841,9 +1850,9 @@ export declare const createAsyncActivityCommonDetails: <Req, Res>(context: {
1841
1850
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
1842
1851
  readonly isExpired: () => boolean;
1843
1852
  readonly isHighScore: () => boolean;
1844
- readonly isValid: () => boolean;
1845
- readonly getTokenString: () => string;
1846
- readonly getPayloadString: () => string;
1853
+ readonly isValidated: boolean;
1854
+ readonly tokenString: string;
1855
+ readonly payloadString: string;
1847
1856
  };
1848
1857
  readonly bypassReason?: string;
1849
1858
  readonly originalTokenParseResult?: TokenParseResult;
@@ -2023,6 +2032,7 @@ export declare const createCommonActivityDetails: <Req, Res>(config: IConfigurat
2023
2032
  readonly has: (name: string) => boolean;
2024
2033
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
2025
2034
  };
2035
+ readonly toJSON: () => string;
2026
2036
  };
2027
2037
  readonly rawUrl: string;
2028
2038
  readonly method: import("..").HttpMethod;
@@ -2095,6 +2105,7 @@ export declare const createCommonActivityDetails: <Req, Res>(config: IConfigurat
2095
2105
  readonly has: (name: string) => boolean;
2096
2106
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
2097
2107
  };
2108
+ readonly toJSON: () => string;
2098
2109
  };
2099
2110
  readonly rawUrl: string;
2100
2111
  readonly method: import("..").HttpMethod;
@@ -2279,9 +2290,9 @@ export declare const createCommonActivityDetails: <Req, Res>(config: IConfigurat
2279
2290
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
2280
2291
  readonly isExpired: () => boolean;
2281
2292
  readonly isHighScore: () => boolean;
2282
- readonly isValid: () => boolean;
2283
- readonly getTokenString: () => string;
2284
- readonly getPayloadString: () => string;
2293
+ readonly isValidated: boolean;
2294
+ readonly tokenString: string;
2295
+ readonly payloadString: string;
2285
2296
  };
2286
2297
  readonly mobileData?: {
2287
2298
  readonly mobileError?: import("../risk_token").MobileError;
@@ -2320,6 +2331,7 @@ export declare const createCommonActivityDetails: <Req, Res>(config: IConfigurat
2320
2331
  readonly has: (name: string) => boolean;
2321
2332
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
2322
2333
  };
2334
+ readonly toJSON: () => string;
2323
2335
  };
2324
2336
  readonly rawUrl: string;
2325
2337
  readonly method: import("..").HttpMethod;
@@ -2504,9 +2516,9 @@ export declare const createCommonActivityDetails: <Req, Res>(config: IConfigurat
2504
2516
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
2505
2517
  readonly isExpired: () => boolean;
2506
2518
  readonly isHighScore: () => boolean;
2507
- readonly isValid: () => boolean;
2508
- readonly getTokenString: () => string;
2509
- readonly getPayloadString: () => string;
2519
+ readonly isValidated: boolean;
2520
+ readonly tokenString: string;
2521
+ readonly payloadString: string;
2510
2522
  };
2511
2523
  readonly bypassReason?: string;
2512
2524
  readonly originalTokenParseResult?: TokenParseResult;
@@ -2686,6 +2698,7 @@ export declare const addRootContextDataToDetails: <Req, Res>(details: CommonActi
2686
2698
  readonly has: (name: string) => boolean;
2687
2699
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
2688
2700
  };
2701
+ readonly toJSON: () => string;
2689
2702
  };
2690
2703
  readonly rawUrl: string;
2691
2704
  readonly method: import("..").HttpMethod;
@@ -2758,6 +2771,7 @@ export declare const addRootContextDataToDetails: <Req, Res>(details: CommonActi
2758
2771
  readonly has: (name: string) => boolean;
2759
2772
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
2760
2773
  };
2774
+ readonly toJSON: () => string;
2761
2775
  };
2762
2776
  readonly rawUrl: string;
2763
2777
  readonly method: import("..").HttpMethod;
@@ -2942,9 +2956,9 @@ export declare const addRootContextDataToDetails: <Req, Res>(details: CommonActi
2942
2956
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
2943
2957
  readonly isExpired: () => boolean;
2944
2958
  readonly isHighScore: () => boolean;
2945
- readonly isValid: () => boolean;
2946
- readonly getTokenString: () => string;
2947
- readonly getPayloadString: () => string;
2959
+ readonly isValidated: boolean;
2960
+ readonly tokenString: string;
2961
+ readonly payloadString: string;
2948
2962
  };
2949
2963
  readonly mobileData?: {
2950
2964
  readonly mobileError?: import("../risk_token").MobileError;
@@ -2983,6 +2997,7 @@ export declare const addRootContextDataToDetails: <Req, Res>(details: CommonActi
2983
2997
  readonly has: (name: string) => boolean;
2984
2998
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
2985
2999
  };
3000
+ readonly toJSON: () => string;
2986
3001
  };
2987
3002
  readonly rawUrl: string;
2988
3003
  readonly method: import("..").HttpMethod;
@@ -3167,9 +3182,9 @@ export declare const addRootContextDataToDetails: <Req, Res>(details: CommonActi
3167
3182
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
3168
3183
  readonly isExpired: () => boolean;
3169
3184
  readonly isHighScore: () => boolean;
3170
- readonly isValid: () => boolean;
3171
- readonly getTokenString: () => string;
3172
- readonly getPayloadString: () => string;
3185
+ readonly isValidated: boolean;
3186
+ readonly tokenString: string;
3187
+ readonly payloadString: string;
3173
3188
  };
3174
3189
  readonly bypassReason?: string;
3175
3190
  readonly originalTokenParseResult?: TokenParseResult;
@@ -3343,6 +3358,7 @@ export declare const addRequestDataToDetails: <Req>(details: CommonActivityDetai
3343
3358
  readonly has: (name: string) => boolean;
3344
3359
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
3345
3360
  };
3361
+ readonly toJSON: () => string;
3346
3362
  };
3347
3363
  readonly rawUrl: string;
3348
3364
  readonly method: import("..").HttpMethod;
@@ -3406,6 +3422,7 @@ export declare const addRiskApiDataToAsyncActivityCommonDetails: <Req, Res>(deta
3406
3422
  readonly has: (name: string) => boolean;
3407
3423
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
3408
3424
  };
3425
+ readonly toJSON: () => string;
3409
3426
  };
3410
3427
  readonly rawUrl: string;
3411
3428
  readonly method: import("..").HttpMethod;
@@ -3478,6 +3495,7 @@ export declare const addRiskApiDataToAsyncActivityCommonDetails: <Req, Res>(deta
3478
3495
  readonly has: (name: string) => boolean;
3479
3496
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
3480
3497
  };
3498
+ readonly toJSON: () => string;
3481
3499
  };
3482
3500
  readonly rawUrl: string;
3483
3501
  readonly method: import("..").HttpMethod;
@@ -3662,9 +3680,9 @@ export declare const addRiskApiDataToAsyncActivityCommonDetails: <Req, Res>(deta
3662
3680
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
3663
3681
  readonly isExpired: () => boolean;
3664
3682
  readonly isHighScore: () => boolean;
3665
- readonly isValid: () => boolean;
3666
- readonly getTokenString: () => string;
3667
- readonly getPayloadString: () => string;
3683
+ readonly isValidated: boolean;
3684
+ readonly tokenString: string;
3685
+ readonly payloadString: string;
3668
3686
  };
3669
3687
  readonly mobileData?: {
3670
3688
  readonly mobileError?: import("../risk_token").MobileError;
@@ -3703,6 +3721,7 @@ export declare const addRiskApiDataToAsyncActivityCommonDetails: <Req, Res>(deta
3703
3721
  readonly has: (name: string) => boolean;
3704
3722
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
3705
3723
  };
3724
+ readonly toJSON: () => string;
3706
3725
  };
3707
3726
  readonly rawUrl: string;
3708
3727
  readonly method: import("..").HttpMethod;
@@ -3887,9 +3906,9 @@ export declare const addRiskApiDataToAsyncActivityCommonDetails: <Req, Res>(deta
3887
3906
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
3888
3907
  readonly isExpired: () => boolean;
3889
3908
  readonly isHighScore: () => boolean;
3890
- readonly isValid: () => boolean;
3891
- readonly getTokenString: () => string;
3892
- readonly getPayloadString: () => string;
3909
+ readonly isValidated: boolean;
3910
+ readonly tokenString: string;
3911
+ readonly payloadString: string;
3893
3912
  };
3894
3913
  readonly bypassReason?: string;
3895
3914
  readonly originalTokenParseResult?: TokenParseResult;
@@ -4069,6 +4088,7 @@ export declare const addResponseDataToAsyncActivityCommonDetails: <Req, Res>(det
4069
4088
  readonly has: (name: string) => boolean;
4070
4089
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
4071
4090
  };
4091
+ readonly toJSON: () => string;
4072
4092
  };
4073
4093
  readonly rawUrl: string;
4074
4094
  readonly method: import("..").HttpMethod;
@@ -4141,6 +4161,7 @@ export declare const addResponseDataToAsyncActivityCommonDetails: <Req, Res>(det
4141
4161
  readonly has: (name: string) => boolean;
4142
4162
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
4143
4163
  };
4164
+ readonly toJSON: () => string;
4144
4165
  };
4145
4166
  readonly rawUrl: string;
4146
4167
  readonly method: import("..").HttpMethod;
@@ -4325,9 +4346,9 @@ export declare const addResponseDataToAsyncActivityCommonDetails: <Req, Res>(det
4325
4346
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
4326
4347
  readonly isExpired: () => boolean;
4327
4348
  readonly isHighScore: () => boolean;
4328
- readonly isValid: () => boolean;
4329
- readonly getTokenString: () => string;
4330
- readonly getPayloadString: () => string;
4349
+ readonly isValidated: boolean;
4350
+ readonly tokenString: string;
4351
+ readonly payloadString: string;
4331
4352
  };
4332
4353
  readonly mobileData?: {
4333
4354
  readonly mobileError?: import("../risk_token").MobileError;
@@ -4366,6 +4387,7 @@ export declare const addResponseDataToAsyncActivityCommonDetails: <Req, Res>(det
4366
4387
  readonly has: (name: string) => boolean;
4367
4388
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
4368
4389
  };
4390
+ readonly toJSON: () => string;
4369
4391
  };
4370
4392
  readonly rawUrl: string;
4371
4393
  readonly method: import("..").HttpMethod;
@@ -4550,9 +4572,9 @@ export declare const addResponseDataToAsyncActivityCommonDetails: <Req, Res>(det
4550
4572
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
4551
4573
  readonly isExpired: () => boolean;
4552
4574
  readonly isHighScore: () => boolean;
4553
- readonly isValid: () => boolean;
4554
- readonly getTokenString: () => string;
4555
- readonly getPayloadString: () => string;
4575
+ readonly isValidated: boolean;
4576
+ readonly tokenString: string;
4577
+ readonly payloadString: string;
4556
4578
  };
4557
4579
  readonly bypassReason?: string;
4558
4580
  readonly originalTokenParseResult?: TokenParseResult;
@@ -4732,6 +4754,7 @@ export declare const createPageRequestedActivityDetails: <Req, Res>(context: {
4732
4754
  readonly has: (name: string) => boolean;
4733
4755
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
4734
4756
  };
4757
+ readonly toJSON: () => string;
4735
4758
  };
4736
4759
  readonly rawUrl: string;
4737
4760
  readonly method: import("..").HttpMethod;
@@ -4804,6 +4827,7 @@ export declare const createPageRequestedActivityDetails: <Req, Res>(context: {
4804
4827
  readonly has: (name: string) => boolean;
4805
4828
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
4806
4829
  };
4830
+ readonly toJSON: () => string;
4807
4831
  };
4808
4832
  readonly rawUrl: string;
4809
4833
  readonly method: import("..").HttpMethod;
@@ -4988,9 +5012,9 @@ export declare const createPageRequestedActivityDetails: <Req, Res>(context: {
4988
5012
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
4989
5013
  readonly isExpired: () => boolean;
4990
5014
  readonly isHighScore: () => boolean;
4991
- readonly isValid: () => boolean;
4992
- readonly getTokenString: () => string;
4993
- readonly getPayloadString: () => string;
5015
+ readonly isValidated: boolean;
5016
+ readonly tokenString: string;
5017
+ readonly payloadString: string;
4994
5018
  };
4995
5019
  readonly mobileData?: {
4996
5020
  readonly mobileError?: import("../risk_token").MobileError;
@@ -5029,6 +5053,7 @@ export declare const createPageRequestedActivityDetails: <Req, Res>(context: {
5029
5053
  readonly has: (name: string) => boolean;
5030
5054
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
5031
5055
  };
5056
+ readonly toJSON: () => string;
5032
5057
  };
5033
5058
  readonly rawUrl: string;
5034
5059
  readonly method: import("..").HttpMethod;
@@ -5213,9 +5238,9 @@ export declare const createPageRequestedActivityDetails: <Req, Res>(context: {
5213
5238
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
5214
5239
  readonly isExpired: () => boolean;
5215
5240
  readonly isHighScore: () => boolean;
5216
- readonly isValid: () => boolean;
5217
- readonly getTokenString: () => string;
5218
- readonly getPayloadString: () => string;
5241
+ readonly isValidated: boolean;
5242
+ readonly tokenString: string;
5243
+ readonly payloadString: string;
5219
5244
  };
5220
5245
  readonly bypassReason?: string;
5221
5246
  readonly originalTokenParseResult?: TokenParseResult;
@@ -5395,6 +5420,7 @@ export declare const createBlockActivityDetails: <Req, Res>(context: {
5395
5420
  readonly has: (name: string) => boolean;
5396
5421
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
5397
5422
  };
5423
+ readonly toJSON: () => string;
5398
5424
  };
5399
5425
  readonly rawUrl: string;
5400
5426
  readonly method: import("..").HttpMethod;
@@ -5467,6 +5493,7 @@ export declare const createBlockActivityDetails: <Req, Res>(context: {
5467
5493
  readonly has: (name: string) => boolean;
5468
5494
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
5469
5495
  };
5496
+ readonly toJSON: () => string;
5470
5497
  };
5471
5498
  readonly rawUrl: string;
5472
5499
  readonly method: import("..").HttpMethod;
@@ -5651,9 +5678,9 @@ export declare const createBlockActivityDetails: <Req, Res>(context: {
5651
5678
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
5652
5679
  readonly isExpired: () => boolean;
5653
5680
  readonly isHighScore: () => boolean;
5654
- readonly isValid: () => boolean;
5655
- readonly getTokenString: () => string;
5656
- readonly getPayloadString: () => string;
5681
+ readonly isValidated: boolean;
5682
+ readonly tokenString: string;
5683
+ readonly payloadString: string;
5657
5684
  };
5658
5685
  readonly mobileData?: {
5659
5686
  readonly mobileError?: import("../risk_token").MobileError;
@@ -5692,6 +5719,7 @@ export declare const createBlockActivityDetails: <Req, Res>(context: {
5692
5719
  readonly has: (name: string) => boolean;
5693
5720
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
5694
5721
  };
5722
+ readonly toJSON: () => string;
5695
5723
  };
5696
5724
  readonly rawUrl: string;
5697
5725
  readonly method: import("..").HttpMethod;
@@ -5876,9 +5904,9 @@ export declare const createBlockActivityDetails: <Req, Res>(context: {
5876
5904
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
5877
5905
  readonly isExpired: () => boolean;
5878
5906
  readonly isHighScore: () => boolean;
5879
- readonly isValid: () => boolean;
5880
- readonly getTokenString: () => string;
5881
- readonly getPayloadString: () => string;
5907
+ readonly isValidated: boolean;
5908
+ readonly tokenString: string;
5909
+ readonly payloadString: string;
5882
5910
  };
5883
5911
  readonly bypassReason?: string;
5884
5912
  readonly originalTokenParseResult?: TokenParseResult;
@@ -6058,6 +6086,7 @@ export declare const createAdditionalS2SActivityDetails: <Req, Res>({ ciSendRawU
6058
6086
  readonly has: (name: string) => boolean;
6059
6087
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
6060
6088
  };
6089
+ readonly toJSON: () => string;
6061
6090
  };
6062
6091
  readonly rawUrl: string;
6063
6092
  readonly method: import("..").HttpMethod;
@@ -6130,6 +6159,7 @@ export declare const createAdditionalS2SActivityDetails: <Req, Res>({ ciSendRawU
6130
6159
  readonly has: (name: string) => boolean;
6131
6160
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
6132
6161
  };
6162
+ readonly toJSON: () => string;
6133
6163
  };
6134
6164
  readonly rawUrl: string;
6135
6165
  readonly method: import("..").HttpMethod;
@@ -6314,9 +6344,9 @@ export declare const createAdditionalS2SActivityDetails: <Req, Res>({ ciSendRawU
6314
6344
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
6315
6345
  readonly isExpired: () => boolean;
6316
6346
  readonly isHighScore: () => boolean;
6317
- readonly isValid: () => boolean;
6318
- readonly getTokenString: () => string;
6319
- readonly getPayloadString: () => string;
6347
+ readonly isValidated: boolean;
6348
+ readonly tokenString: string;
6349
+ readonly payloadString: string;
6320
6350
  };
6321
6351
  readonly mobileData?: {
6322
6352
  readonly mobileError?: import("../risk_token").MobileError;
@@ -6355,6 +6385,7 @@ export declare const createAdditionalS2SActivityDetails: <Req, Res>({ ciSendRawU
6355
6385
  readonly has: (name: string) => boolean;
6356
6386
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
6357
6387
  };
6388
+ readonly toJSON: () => string;
6358
6389
  };
6359
6390
  readonly rawUrl: string;
6360
6391
  readonly method: import("..").HttpMethod;
@@ -6539,9 +6570,9 @@ export declare const createAdditionalS2SActivityDetails: <Req, Res>({ ciSendRawU
6539
6570
  }) => import("ts-essentials").AsyncOrSync<TokenParseResult>;
6540
6571
  readonly isExpired: () => boolean;
6541
6572
  readonly isHighScore: () => boolean;
6542
- readonly isValid: () => boolean;
6543
- readonly getTokenString: () => string;
6544
- readonly getPayloadString: () => string;
6573
+ readonly isValidated: boolean;
6574
+ readonly tokenString: string;
6575
+ readonly payloadString: string;
6545
6576
  };
6546
6577
  readonly bypassReason?: string;
6547
6578
  readonly originalTokenParseResult?: TokenParseResult;
@@ -30,6 +30,7 @@ export declare const createBlockData: <Req, Res>(config: IConfiguration<Req, Res
30
30
  readonly has: (name: string) => boolean;
31
31
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
32
32
  };
33
+ readonly toJSON: () => string;
33
34
  };
34
35
  readonly rawUrl: string;
35
36
  readonly method: import("..").HttpMethod;
@@ -102,6 +103,7 @@ export declare const createBlockData: <Req, Res>(config: IConfiguration<Req, Res
102
103
  readonly has: (name: string) => boolean;
103
104
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
104
105
  };
106
+ readonly toJSON: () => string;
105
107
  };
106
108
  readonly rawUrl: string;
107
109
  readonly method: import("..").HttpMethod;
@@ -286,9 +288,9 @@ export declare const createBlockData: <Req, Res>(config: IConfiguration<Req, Res
286
288
  }) => import("ts-essentials").AsyncOrSync<import("..").TokenParseResult>;
287
289
  readonly isExpired: () => boolean;
288
290
  readonly isHighScore: () => boolean;
289
- readonly isValid: () => boolean;
290
- readonly getTokenString: () => string;
291
- readonly getPayloadString: () => string;
291
+ readonly isValidated: boolean;
292
+ readonly tokenString: string;
293
+ readonly payloadString: string;
292
294
  };
293
295
  readonly mobileData?: {
294
296
  readonly mobileError?: import("..").MobileError;
@@ -327,6 +329,7 @@ export declare const createBlockData: <Req, Res>(config: IConfiguration<Req, Res
327
329
  readonly has: (name: string) => boolean;
328
330
  readonly forEach: (callback: (value: string, key: string, params?: import("../utils").IUrlSearchParams, thisArg?: any) => void) => void;
329
331
  };
332
+ readonly toJSON: () => string;
330
333
  };
331
334
  readonly rawUrl: string;
332
335
  readonly method: import("..").HttpMethod;
@@ -511,9 +514,9 @@ export declare const createBlockData: <Req, Res>(config: IConfiguration<Req, Res
511
514
  }) => import("ts-essentials").AsyncOrSync<import("..").TokenParseResult>;
512
515
  readonly isExpired: () => boolean;
513
516
  readonly isHighScore: () => boolean;
514
- readonly isValid: () => boolean;
515
- readonly getTokenString: () => string;
516
- readonly getPayloadString: () => string;
517
+ readonly isValidated: boolean;
518
+ readonly tokenString: string;
519
+ readonly payloadString: string;
517
520
  };
518
521
  readonly bypassReason?: string;
519
522
  readonly originalTokenParseResult?: import("..").TokenParseResult;
File without changes
@@ -0,0 +1,41 @@
1
+ import { TokenOrigin } from '../risk_token';
2
+ import { VidSource } from '../utils';
3
+ import { ProductData, ProductName } from '../products';
4
+ import { Action } from '../action';
5
+ import { BlockAction } from '../blocker';
6
+ import { PXHD } from '../pxhd';
7
+ import { PXDE } from '../pxde';
8
+ import { CustomParameters } from '../custom_parameters';
9
+ import { GraphQLData } from '../graphql';
10
+ import { RequestData, RiskApiData, ServerData, TlsData, TokenData } from './interfaces';
11
+ type RequestDataJson<Req> = Omit<RequestData<Req>, 'url' | 'request'> & {
12
+ url: string;
13
+ request: undefined;
14
+ };
15
+ export type ContextJson<Req = unknown, Res = unknown> = {
16
+ readonly requestId: string;
17
+ readonly isMobile: boolean;
18
+ readonly requestData: RequestDataJson<Req>;
19
+ readonly tokenData: TokenData<Req, Res>;
20
+ readonly riskApiData: RiskApiData;
21
+ readonly tlsData: TlsData;
22
+ readonly serverData: ServerData;
23
+ readonly productData: ProductData;
24
+ uuid: string;
25
+ vid?: string;
26
+ vidSource?: VidSource;
27
+ tokenOrigin: TokenOrigin;
28
+ score?: number;
29
+ action: Action;
30
+ reasons?: Partial<Record<ProductName, string>>;
31
+ blockAction?: BlockAction;
32
+ pxhd?: PXHD;
33
+ pxde?: PXDE;
34
+ pxdeVerified?: boolean;
35
+ customParameters?: CustomParameters;
36
+ graphqlData?: GraphQLData[];
37
+ readonly shouldSendLogs: boolean;
38
+ readonly isRemoteConfigUpdateRequest: boolean;
39
+ readonly enforcerStartTime?: number;
40
+ };
41
+ export {};
@@ -10,6 +10,8 @@ import { ProductData, ProductName } from '../products';
10
10
  import { Action } from '../action';
11
11
  import { ILogger } from '../logger';
12
12
  import { IContext, RequestData, RiskApiData, ServerData, TlsData, TokenData } from './interfaces';
13
+ import { ContextJson } from './ContextJson';
14
+ import { GraphQLData } from '../graphql';
13
15
  export type DefaultContextOptions = {
14
16
  cookieParser?: ICookieParser;
15
17
  requestIdGenerator: IRequestIdGenerator;
@@ -37,21 +39,21 @@ export declare class DefaultContext<Req, Res> implements IContext<Req, Res> {
37
39
  pxde?: PXDE;
38
40
  pxdeVerified?: boolean;
39
41
  customParameters?: CustomParameters;
42
+ graphqlData?: GraphQLData[];
40
43
  response?: IOutgoingResponse<Res>;
41
44
  enforcerStartTime?: number;
45
+ logger: ILogger;
42
46
  protected readonly config: IConfiguration<Req, Res>;
43
47
  protected readonly urlUtils: IUrlUtils;
44
- protected readonly contextLogger: ILogger;
45
48
  constructor(config: IConfiguration<Req, Res>, request: IIncomingRequest<Req>, options: DefaultContextOptions);
46
- get logger(): ILogger;
47
49
  get isMobile(): boolean;
48
50
  protected createContextLogger(config: IConfiguration<Req, Res>, shouldSaveLogs: boolean): ILogger;
49
51
  protected createRequestData(config: IConfiguration<Req, Res>, request: IIncomingRequest<Req>, cookieParser?: ICookieParser): RequestData<Req>;
50
- protected static getCookies(cookieParser: ICookieParser, ...cookieHeaderValues: string[]): Record<string, string>;
51
52
  protected normalizeUrl(rawUrl: string): IUrl;
52
53
  protected extractUserAgentFromHeader(config: IConfiguration<Req, Res>, headers: ReadonlyHeaders): string;
53
54
  protected extractIpFromHeader(config: IConfiguration<Req, Res>, headers: ReadonlyHeaders): string;
54
55
  protected getTokenOrigin(request: IIncomingRequest<Req>): TokenOrigin;
55
56
  protected setCookiesOnContext(): void;
56
57
  protected isHeaderBasedLoggerRequest(config: IConfiguration<Req, Res>, request: IIncomingRequest<Req>): boolean;
58
+ toJSON(): ContextJson<Req, Res>;
57
59
  }