perimeterx-js-core 0.25.0 → 0.26.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 (255) hide show
  1. package/lib/cjs/action/Action.js +15 -0
  2. package/lib/cjs/action/ActionPriorityOrder.js +4 -0
  3. package/lib/cjs/action/utils.js +20 -0
  4. package/lib/cjs/activities/HttpActivityClient.js +61 -1
  5. package/lib/cjs/activities/HttpBatchedActivityClient.js +7 -0
  6. package/lib/cjs/activities/utils.js +128 -62
  7. package/lib/cjs/additional_activity_handler/AdditionalActivityHandlerUtils.js +6 -0
  8. package/lib/cjs/blocker/BlockerBase.js +14 -0
  9. package/lib/cjs/blocker/JsonBlockerBase.js +5 -0
  10. package/lib/cjs/blocker/utils.js +13 -0
  11. package/lib/cjs/config/ConfigurationBase.js +17 -0
  12. package/lib/cjs/context/DefaultContext.js +4 -0
  13. package/lib/cjs/context/SerializedContext.js +5 -0
  14. package/lib/cjs/enforcer/EnforcerBase.js +61 -22
  15. package/lib/cjs/enforcer/index.js +1 -0
  16. package/lib/cjs/{phase/flow → flow}/EndEnforcerFlow.js +11 -7
  17. package/lib/cjs/{phase/flow → flow}/EnforceFlow.js +10 -15
  18. package/lib/cjs/{phase/flow → flow}/FilterFlow.js +10 -9
  19. package/lib/cjs/flow/Flow.js +60 -0
  20. package/lib/cjs/flow/IFlow.js +2 -0
  21. package/lib/cjs/{phase/flow → flow}/PostEnforceFlow.js +6 -6
  22. package/lib/cjs/{phase/flow → flow}/index.js +2 -0
  23. package/lib/cjs/index.js +1 -0
  24. package/lib/cjs/phase/impl/AdditionalActivityHandlerPhase.js +3 -0
  25. package/lib/cjs/phase/impl/ClearLogsPhase.js +3 -0
  26. package/lib/cjs/phase/impl/CompositePhase.js +9 -0
  27. package/lib/cjs/phase/impl/CreateBlockResponsePhase.js +16 -0
  28. package/lib/cjs/phase/impl/DecideActionPhase.js +11 -0
  29. package/lib/cjs/phase/impl/EnrichContextFromRequestPhase.js +13 -9
  30. package/lib/cjs/phase/impl/EnrichContextFromResponsePhase.js +4 -0
  31. package/lib/cjs/phase/impl/FilterPhase.js +4 -0
  32. package/lib/cjs/phase/impl/FirstPartyPhase.js +5 -0
  33. package/lib/cjs/phase/impl/IdentifyRemoteConfigNotifyRequestPhase.js +5 -0
  34. package/lib/cjs/phase/impl/IdentifyTelemetryRequestPhase.js +5 -0
  35. package/lib/cjs/phase/impl/ModifyIncomingRequestPhase.js +5 -0
  36. package/lib/cjs/phase/impl/ModifyOutgoingResponsePhase.js +5 -0
  37. package/lib/cjs/phase/impl/ParseTokenPhase.js +14 -7
  38. package/lib/cjs/phase/impl/PreflightPhase.js +4 -0
  39. package/lib/cjs/phase/impl/RiskApiPhase.js +18 -7
  40. package/lib/cjs/phase/impl/{SendAsyncActivitiesOnResponsePhase.js → SendAsyncActivitiesPhase.js} +15 -8
  41. package/lib/cjs/phase/impl/SendLogsPhase.js +3 -0
  42. package/lib/cjs/phase/impl/SendTelemetryActivityPhase.js +3 -0
  43. package/lib/cjs/phase/impl/UpdateRemoteConfigPhase.js +3 -0
  44. package/lib/cjs/phase/impl/index.js +1 -2
  45. package/lib/cjs/phase/index.js +0 -1
  46. package/lib/cjs/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.js +1 -1
  47. package/lib/cjs/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulParserFactory.js +5 -2
  48. package/lib/cjs/products/credential_intelligence/endpoint/matcher/CredentialIntelligenceEndpointMatcherFactory.js +3 -1
  49. package/lib/cjs/risk_api/client/GetRiskApiClientV2.js +80 -0
  50. package/lib/cjs/risk_api/client/PostRiskApiClientV2.js +3 -3
  51. package/lib/cjs/risk_api/client/PostRiskApiClientV3.js +3 -3
  52. package/lib/cjs/risk_api/client/abstract/IRiskApiClient.js +2 -0
  53. package/lib/cjs/risk_api/client/abstract/PostRiskApiClientBase.js +43 -0
  54. package/lib/cjs/risk_api/client/{PostRiskApiClientBase.js → abstract/RiskApiClientBase.js} +22 -69
  55. package/lib/cjs/risk_api/client/abstract/index.js +19 -0
  56. package/lib/cjs/risk_api/client/index.js +2 -2
  57. package/lib/cjs/risk_api/index.js +1 -0
  58. package/lib/cjs/risk_api/model/GetRiskRequestHeaders.js +185 -0
  59. package/lib/cjs/risk_api/model/GetRiskResponseHeaders.js +16 -0
  60. package/lib/cjs/risk_api/model/index.js +2 -0
  61. package/lib/cjs/{phase/impl/SendAsyncActivitiesOnRequestPhase.js → risk_api/risk_response/PostRiskResponseBase.js} +26 -30
  62. package/lib/cjs/risk_api/risk_response/RiskResponseBase.js +11 -8
  63. package/lib/cjs/risk_api/risk_response/index.js +1 -0
  64. package/lib/cjs/risk_api/risk_response/serialize/SerializedRiskResponse.js +5 -1
  65. package/lib/cjs/risk_api/risk_response/v2/GetRiskResponseV2.js +80 -0
  66. package/lib/cjs/risk_api/risk_response/v2/{DefaultRiskResponseV2.js → PostRiskResponseV2.js} +10 -10
  67. package/lib/cjs/risk_api/risk_response/v2/index.js +2 -1
  68. package/lib/cjs/risk_api/risk_response/v3/{DefaultRiskResponseV3.js → PostRiskResponseV3.js} +10 -10
  69. package/lib/cjs/risk_api/risk_response/v3/index.js +1 -1
  70. package/lib/cjs/risk_api/utils.js +36 -0
  71. package/lib/cjs/telemetry/DefaultTelemetry.js +12 -9
  72. package/lib/cjs/utils/constants.js +1 -1
  73. package/lib/cjs/utils/utils.js +1 -19
  74. package/lib/esm/action/Action.js +15 -0
  75. package/lib/esm/action/ActionPriorityOrder.js +4 -0
  76. package/lib/esm/action/utils.js +20 -0
  77. package/lib/esm/activities/HttpActivityClient.js +61 -1
  78. package/lib/esm/activities/HttpBatchedActivityClient.js +7 -0
  79. package/lib/esm/activities/utils.js +128 -63
  80. package/lib/esm/additional_activity_handler/AdditionalActivityHandlerUtils.js +6 -0
  81. package/lib/esm/blocker/BlockerBase.js +14 -0
  82. package/lib/esm/blocker/JsonBlockerBase.js +5 -0
  83. package/lib/esm/blocker/utils.js +13 -0
  84. package/lib/esm/config/ConfigurationBase.js +13 -0
  85. package/lib/esm/context/DefaultContext.js +4 -0
  86. package/lib/esm/context/SerializedContext.js +5 -0
  87. package/lib/esm/enforcer/EnforcerBase.js +43 -6
  88. package/lib/esm/enforcer/index.js +1 -0
  89. package/lib/esm/flow/EndEnforcerFlow.js +18 -0
  90. package/lib/esm/flow/EnforceFlow.js +14 -0
  91. package/lib/esm/{phase/flow → flow}/FilterFlow.js +5 -4
  92. package/lib/esm/flow/Flow.js +56 -0
  93. package/lib/esm/flow/IFlow.js +1 -0
  94. package/lib/esm/flow/PostEnforceFlow.js +10 -0
  95. package/lib/esm/{phase/flow → flow}/index.js +2 -0
  96. package/lib/esm/index.js +1 -0
  97. package/lib/esm/phase/impl/AdditionalActivityHandlerPhase.js +3 -0
  98. package/lib/esm/phase/impl/ClearLogsPhase.js +3 -0
  99. package/lib/esm/phase/impl/CompositePhase.js +9 -0
  100. package/lib/esm/phase/impl/CreateBlockResponsePhase.js +16 -1
  101. package/lib/esm/phase/impl/DecideActionPhase.js +11 -0
  102. package/lib/esm/phase/impl/EnrichContextFromRequestPhase.js +9 -0
  103. package/lib/esm/phase/impl/EnrichContextFromResponsePhase.js +4 -0
  104. package/lib/esm/phase/impl/FilterPhase.js +4 -0
  105. package/lib/esm/phase/impl/FirstPartyPhase.js +5 -0
  106. package/lib/esm/phase/impl/IdentifyRemoteConfigNotifyRequestPhase.js +5 -0
  107. package/lib/esm/phase/impl/IdentifyTelemetryRequestPhase.js +5 -0
  108. package/lib/esm/phase/impl/ModifyIncomingRequestPhase.js +5 -0
  109. package/lib/esm/phase/impl/ModifyOutgoingResponsePhase.js +5 -0
  110. package/lib/esm/phase/impl/ParseTokenPhase.js +15 -8
  111. package/lib/esm/phase/impl/PreflightPhase.js +4 -0
  112. package/lib/esm/phase/impl/RiskApiPhase.js +19 -8
  113. package/lib/esm/phase/impl/SendAsyncActivitiesPhase.js +16 -0
  114. package/lib/esm/phase/impl/SendLogsPhase.js +3 -0
  115. package/lib/esm/phase/impl/SendTelemetryActivityPhase.js +3 -0
  116. package/lib/esm/phase/impl/UpdateRemoteConfigPhase.js +3 -0
  117. package/lib/esm/phase/impl/index.js +1 -2
  118. package/lib/esm/phase/index.js +0 -1
  119. package/lib/esm/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.js +1 -1
  120. package/lib/esm/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulParserFactory.js +5 -2
  121. package/lib/esm/products/credential_intelligence/endpoint/matcher/CredentialIntelligenceEndpointMatcherFactory.js +2 -1
  122. package/lib/esm/risk_api/client/GetRiskApiClientV2.js +57 -0
  123. package/lib/esm/risk_api/client/PostRiskApiClientV2.js +3 -3
  124. package/lib/esm/risk_api/client/PostRiskApiClientV3.js +3 -3
  125. package/lib/esm/risk_api/client/abstract/IRiskApiClient.js +1 -0
  126. package/lib/esm/risk_api/client/abstract/PostRiskApiClientBase.js +18 -0
  127. package/lib/esm/risk_api/client/{PostRiskApiClientBase.js → abstract/RiskApiClientBase.js} +10 -49
  128. package/lib/esm/risk_api/client/abstract/index.js +3 -0
  129. package/lib/esm/risk_api/client/index.js +2 -2
  130. package/lib/esm/risk_api/index.js +1 -0
  131. package/lib/esm/risk_api/model/GetRiskRequestHeaders.js +182 -0
  132. package/lib/esm/risk_api/model/GetRiskResponseHeaders.js +13 -0
  133. package/lib/esm/risk_api/model/index.js +2 -0
  134. package/lib/esm/risk_api/risk_response/PostRiskResponseBase.js +6 -0
  135. package/lib/esm/risk_api/risk_response/RiskResponseBase.js +5 -1
  136. package/lib/esm/risk_api/risk_response/index.js +1 -0
  137. package/lib/esm/risk_api/risk_response/serialize/SerializedRiskResponse.js +5 -1
  138. package/lib/esm/risk_api/risk_response/v2/GetRiskResponseV2.js +52 -0
  139. package/lib/esm/risk_api/risk_response/v2/{DefaultRiskResponseV2.js → PostRiskResponseV2.js} +2 -2
  140. package/lib/esm/risk_api/risk_response/v2/index.js +2 -1
  141. package/lib/esm/risk_api/risk_response/v3/{DefaultRiskResponseV3.js → PostRiskResponseV3.js} +2 -2
  142. package/lib/esm/risk_api/risk_response/v3/index.js +1 -1
  143. package/lib/esm/risk_api/utils.js +23 -0
  144. package/lib/esm/telemetry/DefaultTelemetry.js +13 -10
  145. package/lib/esm/utils/constants.js +1 -1
  146. package/lib/esm/utils/utils.js +0 -16
  147. package/lib/types/action/Action.d.ts +15 -0
  148. package/lib/types/action/ActionData.d.ts +3 -0
  149. package/lib/types/action/ActionPriorityOrder.d.ts +4 -0
  150. package/lib/types/action/Decision.d.ts +9 -0
  151. package/lib/types/action/ProductAction.d.ts +3 -0
  152. package/lib/types/action/utils.d.ts +20 -0
  153. package/lib/types/activities/HttpActivityClient.d.ts +57 -1
  154. package/lib/types/activities/HttpBatchedActivityClient.d.ts +7 -0
  155. package/lib/types/activities/IActivityClient.d.ts +4 -1
  156. package/lib/types/activities/model/AsyncActivity.d.ts +3 -0
  157. package/lib/types/activities/model/AsyncActivityDetails.d.ts +12 -0
  158. package/lib/types/activities/model/CommonActivityDetails.d.ts +3 -0
  159. package/lib/types/activities/utils.d.ts +14 -0
  160. package/lib/types/additional_activity_handler/AdditionalActivityHandlerUtils.d.ts +6 -0
  161. package/lib/types/blocker/BlockerBase.d.ts +21 -0
  162. package/lib/types/blocker/IBlocker.d.ts +8 -0
  163. package/lib/types/blocker/IConditionalBlocker.d.ts +4 -0
  164. package/lib/types/blocker/JsonBlockerBase.d.ts +12 -0
  165. package/lib/types/blocker/model/BlockData.d.ts +3 -0
  166. package/lib/types/blocker/utils.d.ts +13 -0
  167. package/lib/types/config/ConfigurationBase.d.ts +22 -0
  168. package/lib/types/config/IConfiguration.d.ts +4 -0
  169. package/lib/types/config/params/CoreConfigurationParams.d.ts +21 -0
  170. package/lib/types/config/params/RemoteConfigurationParams.d.ts +3 -0
  171. package/lib/types/config/params/StaticConfigurationParams.d.ts +3 -0
  172. package/lib/types/context/ContextJson.d.ts +4 -0
  173. package/lib/types/context/DefaultContext.d.ts +4 -0
  174. package/lib/types/context/SerializedContext.d.ts +5 -0
  175. package/lib/types/custom_parameters/CustomParameters.d.ts +3 -0
  176. package/lib/types/enforcer/EnforcerBase.d.ts +48 -12
  177. package/lib/types/enforcer/IEnforcer.d.ts +1 -2
  178. package/lib/types/enforcer/IPostEnforcer.d.ts +3 -0
  179. package/lib/types/enforcer/index.d.ts +1 -0
  180. package/lib/types/first_party/IFirstParty.d.ts +1 -1
  181. package/lib/types/flow/EndEnforcerFlow.d.ts +8 -0
  182. package/lib/types/flow/EnforceFlow.d.ts +8 -0
  183. package/lib/types/{phase/flow → flow}/FilterFlow.d.ts +7 -7
  184. package/lib/types/flow/Flow.d.ts +13 -0
  185. package/lib/types/flow/IFlow.d.ts +57 -0
  186. package/lib/types/flow/PostEnforceFlow.d.ts +6 -0
  187. package/lib/types/{phase/flow → flow}/index.d.ts +2 -0
  188. package/lib/types/index.d.ts +1 -0
  189. package/lib/types/phase/IPhase.d.ts +9 -0
  190. package/lib/types/phase/PhaseResult.d.ts +11 -0
  191. package/lib/types/phase/impl/AdditionalActivityHandlerPhase.d.ts +3 -0
  192. package/lib/types/phase/impl/ClearLogsPhase.d.ts +3 -0
  193. package/lib/types/phase/impl/CompositePhase.d.ts +9 -0
  194. package/lib/types/phase/impl/CreateBlockResponsePhase.d.ts +11 -1
  195. package/lib/types/phase/impl/DecideActionPhase.d.ts +11 -0
  196. package/lib/types/phase/impl/EnrichContextFromRequestPhase.d.ts +9 -0
  197. package/lib/types/phase/impl/EnrichContextFromResponsePhase.d.ts +4 -0
  198. package/lib/types/phase/impl/FilterPhase.d.ts +4 -0
  199. package/lib/types/phase/impl/FirstPartyPhase.d.ts +5 -0
  200. package/lib/types/phase/impl/IdentifyRemoteConfigNotifyRequestPhase.d.ts +5 -0
  201. package/lib/types/phase/impl/IdentifyTelemetryRequestPhase.d.ts +5 -0
  202. package/lib/types/phase/impl/ModifyIncomingRequestPhase.d.ts +5 -0
  203. package/lib/types/phase/impl/ModifyOutgoingResponsePhase.d.ts +5 -0
  204. package/lib/types/phase/impl/ParseTokenPhase.d.ts +3 -0
  205. package/lib/types/phase/impl/PreflightPhase.d.ts +4 -0
  206. package/lib/types/phase/impl/RiskApiPhase.d.ts +5 -0
  207. package/lib/types/phase/impl/{SendAsyncActivitiesOnResponsePhase.d.ts → SendAsyncActivitiesPhase.d.ts} +5 -2
  208. package/lib/types/phase/impl/SendLogsPhase.d.ts +3 -0
  209. package/lib/types/phase/impl/SendTelemetryActivityPhase.d.ts +3 -0
  210. package/lib/types/phase/impl/UpdateRemoteConfigPhase.d.ts +3 -0
  211. package/lib/types/phase/impl/index.d.ts +1 -2
  212. package/lib/types/phase/index.d.ts +0 -1
  213. package/lib/types/products/credential_intelligence/endpoint/CredentialEndpointConfiguration.d.ts +1 -1
  214. package/lib/types/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.d.ts +1 -1
  215. package/lib/types/products/interfaces/IProduct.d.ts +28 -0
  216. package/lib/types/products/interfaces/ProductDataType.d.ts +1 -1
  217. package/lib/types/risk_api/client/GetRiskApiClientV2.d.ts +15 -0
  218. package/lib/types/risk_api/client/PostRiskApiClientV2.d.ts +1 -1
  219. package/lib/types/risk_api/client/PostRiskApiClientV3.d.ts +2 -2
  220. package/lib/types/risk_api/client/{IRiskApiClient.d.ts → abstract/IRiskApiClient.d.ts} +1 -1
  221. package/lib/types/risk_api/client/abstract/PostRiskApiClientBase.d.ts +8 -0
  222. package/lib/types/risk_api/client/abstract/RiskApiClientBase.d.ts +26 -0
  223. package/lib/types/risk_api/client/abstract/index.d.ts +3 -0
  224. package/lib/types/risk_api/client/index.d.ts +2 -2
  225. package/lib/types/risk_api/index.d.ts +1 -0
  226. package/lib/types/risk_api/model/GetRiskRequestHeaders.d.ts +17 -0
  227. package/lib/types/risk_api/model/GetRiskResponseHeaders.d.ts +3 -0
  228. package/lib/types/risk_api/model/index.d.ts +2 -0
  229. package/lib/types/risk_api/risk_response/IRiskResponse.d.ts +2 -0
  230. package/lib/types/risk_api/risk_response/PostRiskResponseBase.d.ts +7 -0
  231. package/lib/types/risk_api/risk_response/RiskResponseBase.d.ts +3 -1
  232. package/lib/types/risk_api/risk_response/index.d.ts +1 -0
  233. package/lib/types/risk_api/risk_response/serialize/SerializedRiskResponse.d.ts +1 -0
  234. package/lib/types/risk_api/risk_response/v2/GetRiskResponseV2.d.ts +11 -0
  235. package/lib/types/risk_api/risk_response/{v3/DefaultRiskResponseV3.d.ts → v2/PostRiskResponseV2.d.ts} +2 -2
  236. package/lib/types/risk_api/risk_response/v2/index.d.ts +2 -1
  237. package/lib/types/risk_api/risk_response/{v2/DefaultRiskResponseV2.d.ts → v3/PostRiskResponseV3.d.ts} +2 -2
  238. package/lib/types/risk_api/risk_response/v3/index.d.ts +1 -1
  239. package/lib/types/risk_api/utils.d.ts +69 -0
  240. package/lib/types/telemetry/model/TelemetryActivity.d.ts +1 -1
  241. package/lib/types/utils/constants.d.ts +1 -1
  242. package/lib/types/utils/utils.d.ts +0 -5
  243. package/package.json +1 -1
  244. package/lib/esm/phase/flow/EndEnforcerFlow.js +0 -14
  245. package/lib/esm/phase/flow/EnforceFlow.js +0 -18
  246. package/lib/esm/phase/flow/PostEnforceFlow.js +0 -10
  247. package/lib/esm/phase/impl/SendAsyncActivitiesOnRequestPhase.js +0 -16
  248. package/lib/esm/phase/impl/SendAsyncActivitiesOnResponsePhase.js +0 -10
  249. package/lib/types/phase/flow/EndEnforcerFlow.d.ts +0 -8
  250. package/lib/types/phase/flow/EnforceFlow.d.ts +0 -8
  251. package/lib/types/phase/flow/PostEnforceFlow.d.ts +0 -6
  252. package/lib/types/phase/impl/SendAsyncActivitiesOnRequestPhase.d.ts +0 -10
  253. package/lib/types/risk_api/client/PostRiskApiClientBase.d.ts +0 -40
  254. /package/lib/cjs/{risk_api/client/IRiskApiClient.js → enforcer/IPostEnforcer.js} +0 -0
  255. /package/lib/esm/{risk_api/client/IRiskApiClient.js → enforcer/IPostEnforcer.js} +0 -0
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RISK_ACTIVITY_ADDITIONAL_FIELDS_TO_HEADER_NAMES = exports.RISK_ACTIVITY_REQUEST_FIELDS_TO_HEADER_NAMES = exports.RISK_ACTIVITY_FIELDS_TO_HEADER_NAMES = void 0;
4
+ exports.RISK_ACTIVITY_FIELDS_TO_HEADER_NAMES = {
5
+ vid: {
6
+ header: 'x-px-vid',
7
+ },
8
+ client_uuid: {
9
+ header: 'x-px-client-uuid',
10
+ },
11
+ pxhd: {
12
+ header: 'x-px-pxhd',
13
+ },
14
+ };
15
+ exports.RISK_ACTIVITY_REQUEST_FIELDS_TO_HEADER_NAMES = {
16
+ socket_ip: {
17
+ header: 'x-px-socket-ip',
18
+ },
19
+ url: {
20
+ header: 'x-px-url',
21
+ },
22
+ };
23
+ exports.RISK_ACTIVITY_ADDITIONAL_FIELDS_TO_HEADER_NAMES = {
24
+ cpa: {
25
+ header: 'x-px-add-cpa',
26
+ convertToString: function (value) { return "".concat(value); },
27
+ },
28
+ enforcer_start_time: {
29
+ header: 'x-px-add-enforcer-start-time',
30
+ convertToString: function (value) { return "".concat(value); },
31
+ },
32
+ is_hype_sale: {
33
+ header: 'x-px-add-is-hype-sale',
34
+ convertToString: function (value) { return "".concat(value); },
35
+ },
36
+ px_cookie_hmac: {
37
+ header: 'x-px-add-cookie-hmac',
38
+ },
39
+ raw_url: {
40
+ header: 'x-px-add-raw-url',
41
+ },
42
+ tls_ja3_fingerprint: {
43
+ header: 'x-px-add-tls-ja3-fingerprint',
44
+ },
45
+ tls_preferred_ciphers: {
46
+ header: 'x-px-add-tls-preferred-ciphers',
47
+ },
48
+ used_cookie_secret: {
49
+ header: 'x-px-add-used-cookie-secret',
50
+ },
51
+ risk_start_time: {
52
+ header: 'x-px-add-risk-start-time',
53
+ convertToString: function (value) { return "".concat(value); },
54
+ },
55
+ app_user_id: {
56
+ header: 'x-px-add-app-user-id',
57
+ },
58
+ ci_version: {
59
+ header: 'x-px-add-ci-version',
60
+ },
61
+ cookie_origin: {
62
+ header: 'x-px-add-cookie-origin',
63
+ },
64
+ cross_tab_session: {
65
+ header: 'x-px-add-cross-tab-session',
66
+ },
67
+ custom_param1: {
68
+ header: 'x-px-custom-param1',
69
+ },
70
+ custom_param10: {
71
+ header: 'x-px-custom-param10',
72
+ },
73
+ custom_param2: {
74
+ header: 'x-px-custom-param2',
75
+ },
76
+ custom_param3: {
77
+ header: 'x-px-custom-param3',
78
+ },
79
+ custom_param4: {
80
+ header: 'x-px-custom-param4',
81
+ },
82
+ custom_param5: {
83
+ header: 'x-px-custom-param5',
84
+ },
85
+ custom_param6: {
86
+ header: 'x-px-custom-param6',
87
+ },
88
+ custom_param7: {
89
+ header: 'x-px-custom-param7',
90
+ },
91
+ custom_param8: {
92
+ header: 'x-px-custom-param8',
93
+ },
94
+ custom_param9: {
95
+ header: 'x-px-custom-param9',
96
+ },
97
+ enforcer_vid_source: {
98
+ header: 'x-px-add-enforcer-vid-source',
99
+ },
100
+ server_info_datacenter: {
101
+ header: 'x-px-add-server-info-datacenter',
102
+ },
103
+ server_info_region: {
104
+ header: 'x-px-add-server-info-region',
105
+ },
106
+ graphql_operations: {
107
+ header: 'x-px-add-graphql-operations',
108
+ convertToString: function (value) { return JSON.stringify(value); },
109
+ },
110
+ http_method: {
111
+ header: 'x-px-add-http-method',
112
+ },
113
+ http_version: {
114
+ header: 'x-px-add-http-version',
115
+ },
116
+ jwt_additional_fields: {
117
+ header: 'x-px-add-jwt-additional-fields',
118
+ convertToString: function (value) { return JSON.stringify(value); },
119
+ },
120
+ module_version: {
121
+ header: 'x-px-add-module-version',
122
+ },
123
+ original_token: {
124
+ header: 'x-px-add-original-token',
125
+ },
126
+ original_token_error: {
127
+ header: 'x-px-add-original-token-error',
128
+ },
129
+ original_uuid: {
130
+ header: 'x-px-add-original-uuid',
131
+ },
132
+ pass: {
133
+ header: 'x-px-add-pass',
134
+ },
135
+ px_cookie: {
136
+ header: 'x-px-add-px-cookie',
137
+ },
138
+ px_decoded_original_token: {
139
+ header: 'x-px-decoded-original-token',
140
+ },
141
+ px_orig_cookie: {
142
+ header: 'x-px-add-px-orig-cookie',
143
+ },
144
+ request_cookie_names: {
145
+ header: 'x-px-add-request-cookie-names',
146
+ convertToString: function (value) { return value.join(','); },
147
+ },
148
+ request_id: {
149
+ header: 'x-px-add-request-id',
150
+ },
151
+ risk_mode: {
152
+ header: 'x-px-add-risk-mode',
153
+ },
154
+ sso_step: {
155
+ header: 'x-px-add-sso-step',
156
+ },
157
+ tls_cipher: {
158
+ header: 'x-px-add-tls-cipher',
159
+ },
160
+ tls_ciphers_sha: {
161
+ header: 'x-px-add-tls-ciphers-sha',
162
+ },
163
+ tls_extension_sha: {
164
+ header: 'x-px-add-tls-extension-sha',
165
+ },
166
+ tls_protocol: {
167
+ header: 'x-px-add-tls-protocol',
168
+ },
169
+ tls_server: {
170
+ header: 'x-px-add-tls-server',
171
+ },
172
+ user: {
173
+ header: 'x-px-add-user',
174
+ },
175
+ remote_config_id: {
176
+ header: 'x-px-add-remote-config-id',
177
+ },
178
+ remote_config_version: {
179
+ header: 'x-px-add-remote-config-version',
180
+ convertToString: function (value) { return "".concat(value); },
181
+ },
182
+ s2s_call_reason: {
183
+ header: 'x-px-add-s2s-call-reason',
184
+ },
185
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetRiskResponseHeaders = void 0;
4
+ exports.GetRiskResponseHeaders = {
5
+ Action: 'x-px-action',
6
+ AdditionalRiskInfo: 'x-px-additional-risk-info',
7
+ CookieCfgBlockResult: 'x-px-cookie-cfg-block-result',
8
+ DataEnrichment: 'x-px-data-enrichment',
9
+ Drc: 'x-px-drc',
10
+ Message: 'x-px-message',
11
+ Pxhd: 'x-px-pxhd',
12
+ PxhdDomain: 'x-px-pxhddomain',
13
+ Status: 'x-px-status',
14
+ TelemetryRequested: 'x-px-telemetry-requested',
15
+ Uuid: 'x-px-uuid',
16
+ };
@@ -18,3 +18,5 @@ __exportStar(require("./RiskActivity.js"), exports);
18
18
  __exportStar(require("./RiskStatus.js"), exports);
19
19
  __exportStar(require("./RiskApiCallResult.js"), exports);
20
20
  __exportStar(require("./S2SErrorReason.js"), exports);
21
+ __exportStar(require("./GetRiskResponseHeaders.js"), exports);
22
+ __exportStar(require("./GetRiskRequestHeaders.js"), exports);
@@ -1,4 +1,19 @@
1
1
  "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
2
17
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
18
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
19
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -36,39 +51,20 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
51
  }
37
52
  };
38
53
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.SendAsyncActivitiesOnRequestPhase = void 0;
40
- var action_1 = require("../../action/index.js");
41
- var SendAsyncActivitiesOnRequestPhase = /** @class */ (function () {
42
- function SendAsyncActivitiesOnRequestPhase(activityClient) {
43
- this.activityClient = activityClient;
54
+ exports.PostRiskResponseBase = void 0;
55
+ var RiskResponseBase_1 = require("./RiskResponseBase.js");
56
+ var PostRiskResponseBase = /** @class */ (function (_super) {
57
+ __extends(PostRiskResponseBase, _super);
58
+ function PostRiskResponseBase() {
59
+ return _super !== null && _super.apply(this, arguments) || this;
44
60
  }
45
- SendAsyncActivitiesOnRequestPhase.prototype.execute = function (context) {
46
- return __awaiter(this, void 0, void 0, function () {
47
- return __generator(this, function (_a) {
48
- switch (_a.label) {
49
- case 0:
50
- if (!(context.action === action_1.Action.BLOCK)) return [3 /*break*/, 2];
51
- return [4 /*yield*/, this.sendAsyncActivity(context)];
52
- case 1:
53
- _a.sent();
54
- _a.label = 2;
55
- case 2: return [2 /*return*/, { done: false }];
56
- }
57
- });
58
- });
59
- };
60
- SendAsyncActivitiesOnRequestPhase.prototype.sendAsyncActivity = function (context) {
61
+ PostRiskResponseBase.prototype.parseRiskResponse = function (response) {
61
62
  return __awaiter(this, void 0, void 0, function () {
62
63
  return __generator(this, function (_a) {
63
- switch (_a.label) {
64
- case 0: return [4 /*yield*/, this.activityClient.sendActivities(context)];
65
- case 1:
66
- _a.sent();
67
- return [2 /*return*/];
68
- }
64
+ return [2 /*return*/, response.json()];
69
65
  });
70
66
  });
71
67
  };
72
- return SendAsyncActivitiesOnRequestPhase;
73
- }());
74
- exports.SendAsyncActivitiesOnRequestPhase = SendAsyncActivitiesOnRequestPhase;
68
+ return PostRiskResponseBase;
69
+ }(RiskResponseBase_1.RiskResponseBase));
70
+ exports.PostRiskResponseBase = PostRiskResponseBase;
@@ -44,18 +44,21 @@ var RiskResponseBase = /** @class */ (function () {
44
44
  }
45
45
  RiskResponseBase.prototype.validate = function () {
46
46
  return __awaiter(this, void 0, void 0, function () {
47
- var _a, e_1;
48
- return __generator(this, function (_b) {
49
- switch (_b.label) {
47
+ var riskResponse, e_1;
48
+ return __generator(this, function (_a) {
49
+ switch (_a.label) {
50
50
  case 0:
51
- _b.trys.push([0, 2, , 3]);
52
- _a = this;
53
- return [4 /*yield*/, this.response.json()];
51
+ _a.trys.push([0, 2, , 3]);
52
+ return [4 /*yield*/, this.parseRiskResponse(this.response)];
54
53
  case 1:
55
- _a.riskResponse = (_b.sent());
54
+ riskResponse = _a.sent();
55
+ if (!riskResponse) {
56
+ return [2 /*return*/, false];
57
+ }
58
+ this.riskResponse = riskResponse;
56
59
  return [2 /*return*/, this.status === model_1.RiskStatus.SUCCESS && this.validateRiskResponseScore()];
57
60
  case 2:
58
- e_1 = _b.sent();
61
+ e_1 = _a.sent();
59
62
  return [2 /*return*/, false];
60
63
  case 3: return [2 /*return*/];
61
64
  }
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./IRiskResponse.js"), exports);
18
18
  __exportStar(require("./RiskResponseBase.js"), exports);
19
+ __exportStar(require("./PostRiskResponseBase.js"), exports);
19
20
  __exportStar(require("./CommonRiskResponsePayload.js"), exports);
20
21
  __exportStar(require("./v2/index.js"), exports);
21
22
  __exportStar(require("./v3/index.js"), exports);
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SerializedRiskResponse = void 0;
4
+ var utils_1 = require("../../../utils/index.js");
4
5
  var SerializedRiskResponse = /** @class */ (function () {
5
6
  function SerializedRiskResponse(riskResponseJson) {
6
7
  this.action = riskResponseJson.action;
@@ -16,7 +17,10 @@ var SerializedRiskResponse = /** @class */ (function () {
16
17
  this.uuid = riskResponseJson.uuid;
17
18
  }
18
19
  SerializedRiskResponse.prototype.validate = function () {
19
- return true;
20
+ throw new utils_1.EnforcerError('SerializedRiskResponse.validate() should not be invoked');
21
+ };
22
+ SerializedRiskResponse.prototype.toJSON = function () {
23
+ return this;
20
24
  };
21
25
  return SerializedRiskResponse;
22
26
  }());
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.GetRiskResponseV2 = void 0;
19
+ var RiskResponseBase_1 = require("../RiskResponseBase.js");
20
+ var model_1 = require("../../model/index.js");
21
+ var GetRiskResponseV2 = /** @class */ (function (_super) {
22
+ __extends(GetRiskResponseV2, _super);
23
+ function GetRiskResponseV2(response) {
24
+ return _super.call(this, response) || this;
25
+ }
26
+ GetRiskResponseV2.prototype.parseRiskResponse = function (response) {
27
+ var riskStatus = this.getHeader(response, model_1.GetRiskResponseHeaders.Status);
28
+ if (!riskStatus) {
29
+ return null;
30
+ }
31
+ var status = parseInt(riskStatus);
32
+ var blockResult = this.getHeader(response, model_1.GetRiskResponseHeaders.CookieCfgBlockResult);
33
+ var additionalRiskInfo = this.getHeader(response, model_1.GetRiskResponseHeaders.AdditionalRiskInfo);
34
+ var dataEnrichment = this.getHeader(response, model_1.GetRiskResponseHeaders.DataEnrichment);
35
+ var drc = this.getHeader(response, model_1.GetRiskResponseHeaders.Drc);
36
+ var message = this.getHeader(response, model_1.GetRiskResponseHeaders.Message);
37
+ var pxhd = this.getHeader(response, model_1.GetRiskResponseHeaders.Pxhd);
38
+ var pxhdDomain = this.getHeader(response, model_1.GetRiskResponseHeaders.PxhdDomain);
39
+ var telemetryRequested = this.getHeader(response, model_1.GetRiskResponseHeaders.TelemetryRequested);
40
+ var uuid = this.getHeader(response, model_1.GetRiskResponseHeaders.Uuid);
41
+ var action = this.getHeader(response, model_1.GetRiskResponseHeaders.Action);
42
+ return {
43
+ status: status,
44
+ action: action,
45
+ uuid: uuid,
46
+ pxhd: pxhd,
47
+ message: message,
48
+ data_enrichment: dataEnrichment ? JSON.parse(dataEnrichment) : undefined,
49
+ pxhdDomain: pxhdDomain,
50
+ additional_risk_info: additionalRiskInfo,
51
+ telemetry_requested: !!telemetryRequested,
52
+ drc: drc ? parseInt(drc) : undefined,
53
+ cookie_cfg_block_result: blockResult,
54
+ };
55
+ };
56
+ GetRiskResponseV2.prototype.getHeader = function (response, header) {
57
+ var _a;
58
+ return (_a = response.headers[header.toLowerCase()]) === null || _a === void 0 ? void 0 : _a[0];
59
+ };
60
+ Object.defineProperty(GetRiskResponseV2.prototype, "score", {
61
+ // TODO: This is the same as in PostRiskResponseV2. We should deduplicate this.
62
+ get: function () {
63
+ var _a;
64
+ return typeof ((_a = this.riskResponse) === null || _a === void 0 ? void 0 : _a.cookie_cfg_block_result) === 'undefined'
65
+ ? undefined
66
+ : this.riskResponse.cookie_cfg_block_result === '1'
67
+ ? 100
68
+ : 0;
69
+ },
70
+ enumerable: false,
71
+ configurable: true
72
+ });
73
+ GetRiskResponseV2.prototype.validateRiskResponseScore = function () {
74
+ var _a;
75
+ var blockResult = (_a = this.riskResponse) === null || _a === void 0 ? void 0 : _a.cookie_cfg_block_result;
76
+ return typeof blockResult === 'string' && ['0', '1'].includes(blockResult);
77
+ };
78
+ return GetRiskResponseV2;
79
+ }(RiskResponseBase_1.RiskResponseBase));
80
+ exports.GetRiskResponseV2 = GetRiskResponseV2;
@@ -15,14 +15,14 @@ var __extends = (this && this.__extends) || (function () {
15
15
  };
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.DefaultRiskResponseV2 = void 0;
19
- var RiskResponseBase_1 = require("../RiskResponseBase.js");
20
- var DefaultRiskResponseV2 = /** @class */ (function (_super) {
21
- __extends(DefaultRiskResponseV2, _super);
22
- function DefaultRiskResponseV2(response) {
18
+ exports.PostRiskResponseV2 = void 0;
19
+ var PostRiskResponseBase_1 = require("../PostRiskResponseBase.js");
20
+ var PostRiskResponseV2 = /** @class */ (function (_super) {
21
+ __extends(PostRiskResponseV2, _super);
22
+ function PostRiskResponseV2(response) {
23
23
  return _super.call(this, response) || this;
24
24
  }
25
- Object.defineProperty(DefaultRiskResponseV2.prototype, "score", {
25
+ Object.defineProperty(PostRiskResponseV2.prototype, "score", {
26
26
  get: function () {
27
27
  var _a;
28
28
  return typeof ((_a = this.riskResponse) === null || _a === void 0 ? void 0 : _a.cookie_cfg_block_result) === 'undefined'
@@ -34,11 +34,11 @@ var DefaultRiskResponseV2 = /** @class */ (function (_super) {
34
34
  enumerable: false,
35
35
  configurable: true
36
36
  });
37
- DefaultRiskResponseV2.prototype.validateRiskResponseScore = function () {
37
+ PostRiskResponseV2.prototype.validateRiskResponseScore = function () {
38
38
  var _a;
39
39
  var blockResult = (_a = this.riskResponse) === null || _a === void 0 ? void 0 : _a.cookie_cfg_block_result;
40
40
  return typeof blockResult === 'string' && ['0', '1'].includes(blockResult);
41
41
  };
42
- return DefaultRiskResponseV2;
43
- }(RiskResponseBase_1.RiskResponseBase));
44
- exports.DefaultRiskResponseV2 = DefaultRiskResponseV2;
42
+ return PostRiskResponseV2;
43
+ }(PostRiskResponseBase_1.PostRiskResponseBase));
44
+ exports.PostRiskResponseV2 = PostRiskResponseV2;
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./DefaultRiskResponseV2.js"), exports);
17
+ __exportStar(require("./GetRiskResponseV2.js"), exports);
18
+ __exportStar(require("./PostRiskResponseV2.js"), exports);
18
19
  __exportStar(require("./RiskResponseV2Payload.js"), exports);
@@ -15,14 +15,14 @@ var __extends = (this && this.__extends) || (function () {
15
15
  };
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.DefaultRiskResponseV3 = void 0;
19
- var RiskResponseBase_1 = require("../RiskResponseBase.js");
20
- var DefaultRiskResponseV3 = /** @class */ (function (_super) {
21
- __extends(DefaultRiskResponseV3, _super);
22
- function DefaultRiskResponseV3(response) {
18
+ exports.PostRiskResponseV3 = void 0;
19
+ var PostRiskResponseBase_1 = require("../PostRiskResponseBase.js");
20
+ var PostRiskResponseV3 = /** @class */ (function (_super) {
21
+ __extends(PostRiskResponseV3, _super);
22
+ function PostRiskResponseV3(response) {
23
23
  return _super.call(this, response) || this;
24
24
  }
25
- Object.defineProperty(DefaultRiskResponseV3.prototype, "score", {
25
+ Object.defineProperty(PostRiskResponseV3.prototype, "score", {
26
26
  get: function () {
27
27
  var _a;
28
28
  return (_a = this.riskResponse) === null || _a === void 0 ? void 0 : _a.score;
@@ -30,10 +30,10 @@ var DefaultRiskResponseV3 = /** @class */ (function (_super) {
30
30
  enumerable: false,
31
31
  configurable: true
32
32
  });
33
- DefaultRiskResponseV3.prototype.validateRiskResponseScore = function () {
33
+ PostRiskResponseV3.prototype.validateRiskResponseScore = function () {
34
34
  var _a;
35
35
  return typeof ((_a = this.riskResponse) === null || _a === void 0 ? void 0 : _a.score) === 'number';
36
36
  };
37
- return DefaultRiskResponseV3;
38
- }(RiskResponseBase_1.RiskResponseBase));
39
- exports.DefaultRiskResponseV3 = DefaultRiskResponseV3;
37
+ return PostRiskResponseV3;
38
+ }(PostRiskResponseBase_1.PostRiskResponseBase));
39
+ exports.PostRiskResponseV3 = PostRiskResponseV3;
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./DefaultRiskResponseV3.js"), exports);
17
+ __exportStar(require("./PostRiskResponseV3.js"), exports);
18
18
  __exportStar(require("./RiskResponseV3Payload.js"), exports);
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.formatRiskHeadersField = exports.createRiskApiActivity = void 0;
15
+ var activities_1 = require("../activities/index.js");
16
+ var utils_1 = require("../utils/index.js");
17
+ var createRiskApiActivity = function (config, context) {
18
+ var _a, _b, _c;
19
+ return {
20
+ vid: context.vid,
21
+ client_uuid: context.uuid,
22
+ pxhd: (_a = context.pxhd) === null || _a === void 0 ? void 0 : _a.value,
23
+ request: {
24
+ socket_ip: context.requestData.ip,
25
+ headers: (0, exports.formatRiskHeadersField)(context.requestData.headers, config),
26
+ url: context.requestData.url.href,
27
+ },
28
+ additional: __assign(__assign({}, (0, activities_1.createCommonActivityDetails)(config, context)), { s2s_call_reason: (_b = context.riskApiData.s2sCallReason) !== null && _b !== void 0 ? _b : 'unknown_reason', risk_start_time: (_c = context.riskApiData.riskStartTime) !== null && _c !== void 0 ? _c : Date.now() }),
29
+ };
30
+ };
31
+ exports.createRiskApiActivity = createRiskApiActivity;
32
+ var formatRiskHeadersField = function (headers, config) {
33
+ var headersWithoutSensitive = (0, utils_1.removeSensitiveHeaders)(headers, config.sensitiveHeaders);
34
+ return (0, activities_1.toHeaderEntryArray)(headersWithoutSensitive);
35
+ };
36
+ exports.formatRiskHeadersField = formatRiskHeadersField;
@@ -127,7 +127,6 @@ var DefaultTelemetry = /** @class */ (function () {
127
127
  _a[http_1.AUTHORIZATION_HEADER_NAME] = [(0, utils_1.getAuthorizationHeader)(this.config.authToken)],
128
128
  _a);
129
129
  var activity = this.createTelemetryActivity(context);
130
- context.logger.debug("created telemetry activity config - ".concat(JSON.stringify(activity.details.enforcer_configs, utils_1.telemetryConfigReplacer)));
131
130
  return new http_1.OutgoingRequestImpl({
132
131
  url: url,
133
132
  method: method,
@@ -157,14 +156,18 @@ var DefaultTelemetry = /** @class */ (function () {
157
156
  enforcer_configs: telemetryConfig,
158
157
  },
159
158
  };
160
- (0, utils_1.transferExistingProperties)(context.serverData, activity.details, {
161
- osName: 'os_name',
162
- nodeName: 'node_name',
163
- });
164
- (0, utils_1.transferExistingProperties)(this.config, activity.details, {
165
- remoteConfigId: 'remote_config_id',
166
- remoteConfigVersion: 'remote_config_version',
167
- });
159
+ if (context.serverData.osName) {
160
+ activity.details.os_name = context.serverData.osName;
161
+ }
162
+ if (context.serverData.nodeName) {
163
+ activity.details.node_name = context.serverData.nodeName;
164
+ }
165
+ if (this.config.remoteConfigId) {
166
+ activity.details.remote_config_id = this.config.remoteConfigId;
167
+ }
168
+ if (this.config.remoteConfigVersion) {
169
+ activity.details.remote_config_version = this.config.remoteConfigVersion;
170
+ }
168
171
  return activity;
169
172
  };
170
173
  return DefaultTelemetry;
@@ -14,4 +14,4 @@ exports.PUSH_DATA_FEATURE_HEADER_NAME = 'x-px-feature';
14
14
  exports.EMAIL_ADDRESS_REGEX = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
15
15
  exports.URL_REGEX = /^(https?:)\/\/(([^@\s:\/]+):?([^@\s\/]*)@)?(([^:\/?#]*)(?:\:([0-9]+))?)(\/?[^?#]*)(\?[^#]*|)(#.*|)$/;
16
16
  exports.REGEX_STRUCTURE = /^\/(.+?)\/([gimsuyvd]*)$/;
17
- exports.CORE_MODULE_VERSION = 'JS Core 0.25.0';
17
+ exports.CORE_MODULE_VERSION = 'JS Core 0.26.0';
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.isNullOrUndefined = exports.isValidTokenVersion = exports.telemetryConfigReplacer = exports.convertRegexStringToRegex = exports.algoToCryptoString = exports.algoToSubtleCryptoString = exports.sleep = exports.getPropertyFromObject = exports.rejectOnTimeout = exports.transferExistingProperties = exports.isStringMatch = exports.isStringInPatterns = exports.removeSensitiveHeaders = exports.redactSensitiveFields = exports.getExtension = exports.getAuthorizationHeader = exports.getCollectorDomain = exports.getScoreApiDomain = exports.isEmailAddress = exports.isValidUuid = exports.isValidEnumValue = void 0;
39
+ exports.isNullOrUndefined = exports.isValidTokenVersion = exports.telemetryConfigReplacer = exports.convertRegexStringToRegex = exports.algoToCryptoString = exports.algoToSubtleCryptoString = exports.sleep = exports.getPropertyFromObject = exports.rejectOnTimeout = exports.isStringMatch = exports.isStringInPatterns = exports.removeSensitiveHeaders = exports.redactSensitiveFields = exports.getExtension = exports.getAuthorizationHeader = exports.getCollectorDomain = exports.getScoreApiDomain = exports.isEmailAddress = exports.isValidUuid = exports.isValidEnumValue = void 0;
40
40
  var http_1 = require("../http/index.js");
41
41
  var error_1 = require("./error/index.js");
42
42
  var constants_1 = require("./constants.js");
@@ -136,24 +136,6 @@ var isStringMatch = function (str, pattern) {
136
136
  return false;
137
137
  };
138
138
  exports.isStringMatch = isStringMatch;
139
- /**
140
- * @deprecated this method is not typesafe. Copy the fields manually instead,
141
- * unsafe - ignores compilerOptions.strictNullChecks
142
- */
143
- var transferExistingProperties = function (fromObj, toObj, propertyMappings) {
144
- if (!toObj || !fromObj) {
145
- return;
146
- }
147
- Object.entries(propertyMappings).forEach(function (_a) {
148
- var fromObjKey = _a[0], toObjKey = _a[1];
149
- if ((typeof fromObj[fromObjKey] !== 'string' && fromObj[fromObjKey] != null) ||
150
- (typeof fromObj[fromObjKey] === 'string' && fromObj[fromObjKey] !== '')) {
151
- // @ts-ignore
152
- toObj[toObjKey] = fromObj[fromObjKey];
153
- }
154
- });
155
- };
156
- exports.transferExistingProperties = transferExistingProperties;
157
139
  var rejectOnTimeout = function (promise, ms) { return __awaiter(void 0, void 0, void 0, function () {
158
140
  var id, timeout, resolvedPromise;
159
141
  return __generator(this, function (_a) {
@@ -1,7 +1,22 @@
1
+ /**
2
+ * The action that should be taken by the enforcer.
3
+ */
1
4
  export var Action;
2
5
  (function (Action) {
6
+ /**
7
+ * Indicates that the request should be allowed to pass.
8
+ */
3
9
  Action["PASS_REQUEST"] = "pass_request";
10
+ /**
11
+ * Indicates that there is not enough information to make a decision and a Risk API request should be made.
12
+ */
4
13
  Action["TRIGGER_RISK_API"] = "trigger_risk_api";
14
+ /**
15
+ * Indicates that the request should be blocked, but no block response will be returned.
16
+ */
5
17
  Action["SIMULATED_BLOCK"] = "simulated_block";
18
+ /**
19
+ * Indicates that the request should be blocked and a block response should be returned.
20
+ */
6
21
  Action["BLOCK"] = "block";
7
22
  })(Action || (Action = {}));
@@ -1,4 +1,8 @@
1
1
  import { Action } from './Action.js';
2
+ /**
3
+ * The priority order of actions that the enforcer should take. The array will be traversed in order,
4
+ * and the first action that matches a product recommendation will be taken.
5
+ */
2
6
  export const ACTION_PRIORITY_ORDER = [
3
7
  Action.BLOCK,
4
8
  Action.SIMULATED_BLOCK,